]> www.pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6
authorLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 18 Aug 2007 16:30:07 +0000 (09:30 -0700)
committerLinus Torvalds <torvalds@woody.linux-foundation.org>
Sat, 18 Aug 2007 16:30:07 +0000 (09:30 -0700)
* git://git.kernel.org/pub/scm/linux/kernel/git/sfrench/cifs-2.6:
  [CIFS] Check return code on failed alloc
  [CIFS] Update CIFS project web site
  [CIFS] Fix hang in find_writable_file

1682 files changed:
.gitignore
CREDITS
Documentation/Changes
Documentation/DMA-API.txt
Documentation/DocBook/kernel-api.tmpl
Documentation/DocBook/uio-howto.tmpl
Documentation/dontdiff
Documentation/fb/pvr2fb.txt
Documentation/feature-removal-schedule.txt
Documentation/filesystems/hfsplus.txt [new file with mode: 0644]
Documentation/hpet.txt
Documentation/hwmon/adm1031
Documentation/hwmon/thmc50 [new file with mode: 0644]
Documentation/i386/zero-page.txt
Documentation/ja_JP/HOWTO
Documentation/ja_JP/stable_api_nonsense.txt
Documentation/kbuild/kconfig-language.txt
Documentation/kernel-parameters.txt
Documentation/keys.txt
Documentation/kobject.txt
Documentation/lguest/Makefile
Documentation/lguest/extract [new file with mode: 0644]
Documentation/lguest/lguest.c
Documentation/memory-hotplug.txt [new file with mode: 0644]
Documentation/sched-design-CFS.txt
Documentation/sched-nice-design.txt [new file with mode: 0644]
Documentation/sched-stats.txt
Documentation/spi/spidev_test.c [new file with mode: 0644]
Documentation/stable_api_nonsense.txt
Documentation/sysfs-rules.txt
Documentation/sysrq.txt
Documentation/thinkpad-acpi.txt
Documentation/vm/slabinfo.c
MAINTAINERS
Makefile
arch/alpha/boot/Makefile
arch/alpha/boot/main.c
arch/alpha/boot/tools/mkbb.c
arch/alpha/boot/tools/objstrip.c
arch/alpha/kernel/head.S
arch/alpha/kernel/pci.c
arch/alpha/kernel/pci_iommu.c
arch/alpha/kernel/smp.c
arch/alpha/kernel/sys_titan.c
arch/alpha/kernel/vmlinux.lds.S
arch/alpha/mm/init.c
arch/arm/Kconfig
arch/arm/configs/iop13xx_defconfig
arch/arm/configs/iop32x_defconfig
arch/arm/configs/iop33x_defconfig
arch/arm/configs/rpc_defconfig
arch/arm/kernel/entry-common.S
arch/arm/kernel/setup.c
arch/arm/kernel/smp.c
arch/arm/kernel/traps.c
arch/arm/mach-at91/at91sam9261_devices.c
arch/arm/mach-at91/at91sam9263_devices.c
arch/arm/mach-sa1100/jornada720.c
arch/arm/mach-sa1100/jornada720_ssp.c
arch/arm/nwfpe/Makefile
arch/arm/nwfpe/entry26.S [deleted file]
arch/arm26/ACKNOWLEDGEMENTS [deleted file]
arch/arm26/Kconfig [deleted file]
arch/arm26/Kconfig.debug [deleted file]
arch/arm26/Makefile [deleted file]
arch/arm26/boot/Makefile [deleted file]
arch/arm26/boot/compressed/Makefile [deleted file]
arch/arm26/boot/compressed/head.S [deleted file]
arch/arm26/boot/compressed/ll_char_wr.S [deleted file]
arch/arm26/boot/compressed/misc.c [deleted file]
arch/arm26/boot/compressed/uncompress.h [deleted file]
arch/arm26/boot/compressed/vmlinux.lds.in [deleted file]
arch/arm26/boot/install.sh [deleted file]
arch/arm26/defconfig [deleted file]
arch/arm26/kernel/Makefile [deleted file]
arch/arm26/kernel/armksyms.c [deleted file]
arch/arm26/kernel/asm-offsets.c [deleted file]
arch/arm26/kernel/calls.S [deleted file]
arch/arm26/kernel/compat.c [deleted file]
arch/arm26/kernel/dma.c [deleted file]
arch/arm26/kernel/ecard.c [deleted file]
arch/arm26/kernel/entry.S [deleted file]
arch/arm26/kernel/fiq.c [deleted file]
arch/arm26/kernel/head.S [deleted file]
arch/arm26/kernel/init_task.c [deleted file]
arch/arm26/kernel/irq.c [deleted file]
arch/arm26/kernel/process.c [deleted file]
arch/arm26/kernel/ptrace.c [deleted file]
arch/arm26/kernel/ptrace.h [deleted file]
arch/arm26/kernel/semaphore.c [deleted file]
arch/arm26/kernel/setup.c [deleted file]
arch/arm26/kernel/signal.c [deleted file]
arch/arm26/kernel/sys_arm.c [deleted file]
arch/arm26/kernel/time.c [deleted file]
arch/arm26/kernel/traps.c [deleted file]
arch/arm26/kernel/vmlinux-arm26-xip.lds.in [deleted file]
arch/arm26/kernel/vmlinux-arm26.lds.in [deleted file]
arch/arm26/kernel/vmlinux.lds.S [deleted file]
arch/arm26/lib/Makefile [deleted file]
arch/arm26/lib/ashldi3.c [deleted file]
arch/arm26/lib/ashrdi3.c [deleted file]
arch/arm26/lib/backtrace.S [deleted file]
arch/arm26/lib/changebit.S [deleted file]
arch/arm26/lib/clearbit.S [deleted file]
arch/arm26/lib/copy_page.S [deleted file]
arch/arm26/lib/csumipv6.S [deleted file]
arch/arm26/lib/csumpartial.S [deleted file]
arch/arm26/lib/csumpartialcopy.S [deleted file]
arch/arm26/lib/csumpartialcopygeneric.S [deleted file]
arch/arm26/lib/csumpartialcopyuser.S [deleted file]
arch/arm26/lib/delay.S [deleted file]
arch/arm26/lib/ecard.S [deleted file]
arch/arm26/lib/findbit.S [deleted file]
arch/arm26/lib/floppydma.S [deleted file]
arch/arm26/lib/gcclib.h [deleted file]
arch/arm26/lib/getuser.S [deleted file]
arch/arm26/lib/io-acorn.S [deleted file]
arch/arm26/lib/io-readsb.S [deleted file]
arch/arm26/lib/io-readsl.S [deleted file]
arch/arm26/lib/io-readsw.S [deleted file]
arch/arm26/lib/io-writesb.S [deleted file]
arch/arm26/lib/io-writesl.S [deleted file]
arch/arm26/lib/io-writesw.S [deleted file]
arch/arm26/lib/kbd.c [deleted file]
arch/arm26/lib/lib1funcs.S [deleted file]
arch/arm26/lib/longlong.h [deleted file]
arch/arm26/lib/lshrdi3.c [deleted file]
arch/arm26/lib/memchr.S [deleted file]
arch/arm26/lib/memcpy.S [deleted file]
arch/arm26/lib/memset.S [deleted file]
arch/arm26/lib/memzero.S [deleted file]
arch/arm26/lib/muldi3.c [deleted file]
arch/arm26/lib/putuser.S [deleted file]
arch/arm26/lib/setbit.S [deleted file]
arch/arm26/lib/strchr.S [deleted file]
arch/arm26/lib/strrchr.S [deleted file]
arch/arm26/lib/testchangebit.S [deleted file]
arch/arm26/lib/testclearbit.S [deleted file]
arch/arm26/lib/testsetbit.S [deleted file]
arch/arm26/lib/uaccess-kernel.S [deleted file]
arch/arm26/lib/uaccess-user.S [deleted file]
arch/arm26/lib/ucmpdi2.c [deleted file]
arch/arm26/lib/udivdi3.c [deleted file]
arch/arm26/machine/Makefile [deleted file]
arch/arm26/machine/dma.c [deleted file]
arch/arm26/machine/irq.c [deleted file]
arch/arm26/machine/latches.c [deleted file]
arch/arm26/mm/Makefile [deleted file]
arch/arm26/mm/extable.c [deleted file]
arch/arm26/mm/fault.c [deleted file]
arch/arm26/mm/fault.h [deleted file]
arch/arm26/mm/init.c [deleted file]
arch/arm26/mm/memc.c [deleted file]
arch/arm26/mm/proc-funcs.S [deleted file]
arch/arm26/mm/small_page.c [deleted file]
arch/arm26/nwfpe/ARM-gcc.h [deleted file]
arch/arm26/nwfpe/ChangeLog [deleted file]
arch/arm26/nwfpe/Makefile [deleted file]
arch/arm26/nwfpe/double_cpdo.c [deleted file]
arch/arm26/nwfpe/entry.S [deleted file]
arch/arm26/nwfpe/extended_cpdo.c [deleted file]
arch/arm26/nwfpe/fpa11.c [deleted file]
arch/arm26/nwfpe/fpa11.h [deleted file]
arch/arm26/nwfpe/fpa11.inl [deleted file]
arch/arm26/nwfpe/fpa11_cpdo.c [deleted file]
arch/arm26/nwfpe/fpa11_cpdt.c [deleted file]
arch/arm26/nwfpe/fpa11_cprt.c [deleted file]
arch/arm26/nwfpe/fpmodule.c [deleted file]
arch/arm26/nwfpe/fpmodule.h [deleted file]
arch/arm26/nwfpe/fpmodule.inl [deleted file]
arch/arm26/nwfpe/fpopcode.c [deleted file]
arch/arm26/nwfpe/fpopcode.h [deleted file]
arch/arm26/nwfpe/fpsr.h [deleted file]
arch/arm26/nwfpe/milieu.h [deleted file]
arch/arm26/nwfpe/single_cpdo.c [deleted file]
arch/arm26/nwfpe/softfloat-macros [deleted file]
arch/arm26/nwfpe/softfloat-specialize [deleted file]
arch/arm26/nwfpe/softfloat.c [deleted file]
arch/arm26/nwfpe/softfloat.h [deleted file]
arch/blackfin/Makefile
arch/blackfin/kernel/dma-mapping.c
arch/blackfin/kernel/init_task.c
arch/blackfin/kernel/process.c
arch/blackfin/kernel/setup.c
arch/blackfin/kernel/sys_bfin.c
arch/blackfin/kernel/traps.c
arch/blackfin/kernel/vmlinux.lds.S
arch/blackfin/mach-bf561/head.S
arch/blackfin/mach-common/cacheinit.S
arch/blackfin/mach-common/ints-priority-dc.c
arch/blackfin/mach-common/ints-priority-sc.c
arch/cris/Kconfig
arch/frv/kernel/entry.S
arch/frv/kernel/sys_frv.c
arch/frv/mb93090-mb00/pci-vdk.c
arch/i386/Kconfig
arch/i386/Kconfig.debug
arch/i386/boot/code16gcc.h
arch/i386/boot/edd.c
arch/i386/boot/header.S
arch/i386/boot/install.sh
arch/i386/boot/pm.c
arch/i386/boot/video-bios.c
arch/i386/boot/video-vesa.c
arch/i386/kernel/Makefile
arch/i386/kernel/acpi/Makefile
arch/i386/kernel/alternative.c
arch/i386/kernel/apic.c
arch/i386/kernel/apm.c
arch/i386/kernel/cpu/amd.c
arch/i386/kernel/cpu/bugs.c
arch/i386/kernel/cpu/cpufreq/Kconfig
arch/i386/kernel/cpu/cpufreq/acpi-cpufreq.c
arch/i386/kernel/doublefault.c
arch/i386/kernel/e820.c
arch/i386/kernel/head.S
arch/i386/kernel/io_apic.c
arch/i386/kernel/legacy_serial.c [deleted file]
arch/i386/kernel/microcode.c
arch/i386/kernel/paravirt.c
arch/i386/kernel/setup.c
arch/i386/kernel/sys_i386.c
arch/i386/kernel/sysenter.c
arch/i386/kernel/vmi.c
arch/i386/mm/init.c
arch/i386/mm/pageattr.c
arch/i386/pci/common.c
arch/i386/pci/fixup.c
arch/i386/pci/irq.c
arch/i386/pci/legacy.c
arch/i386/pci/mmconfig.c
arch/i386/pci/numa.c
arch/i386/pci/pci.h
arch/i386/pci/visws.c
arch/i386/power/Makefile
arch/i386/xen/enlighten.c
arch/ia64/Kconfig
arch/ia64/hp/common/sba_iommu.c
arch/ia64/hp/sim/simscsi.c
arch/ia64/ia32/sys_ia32.c
arch/ia64/kernel/acpi.c
arch/ia64/kernel/cyclone.c
arch/ia64/kernel/init_task.c
arch/ia64/kernel/iosapic.c
arch/ia64/kernel/irq_ia64.c
arch/ia64/kernel/mca.c
arch/ia64/kernel/perfmon.c
arch/ia64/kernel/setup.c
arch/ia64/kernel/smp.c
arch/ia64/kernel/time.c
arch/ia64/sn/kernel/io_common.c
arch/ia64/sn/kernel/setup.c
arch/ia64/sn/kernel/sn2/timer.c
arch/m32r/kernel/ptrace.c
arch/m32r/kernel/setup_mappi.c
arch/m32r/kernel/smpboot.c
arch/m32r/kernel/sys_m32r.c
arch/m68k/kernel/process.c
arch/m68k/kernel/sys_m68k.c
arch/m68knommu/kernel/setup.c
arch/m68knommu/platform/5206/config.c
arch/m68knommu/platform/5206e/config.c
arch/m68knommu/platform/520x/config.c
arch/m68knommu/platform/523x/config.c
arch/m68knommu/platform/5249/config.c
arch/m68knommu/platform/5272/config.c
arch/m68knommu/platform/527x/config.c
arch/m68knommu/platform/528x/config.c
arch/m68knommu/platform/5307/config.c
arch/m68knommu/platform/5307/pit.c
arch/m68knommu/platform/5307/timers.c
arch/m68knommu/platform/532x/config.c
arch/m68knommu/platform/5407/config.c
arch/m68knommu/platform/68328/timers.c
arch/m68knommu/platform/68360/config.c
arch/mips/Kconfig
arch/mips/Makefile
arch/mips/arc/file.c
arch/mips/au1000/common/Makefile
arch/mips/boot/Makefile
arch/mips/cobalt/Makefile
arch/mips/cobalt/serial.c
arch/mips/configs/atlas_defconfig
arch/mips/configs/bigsur_defconfig
arch/mips/configs/capcella_defconfig
arch/mips/configs/cobalt_defconfig
arch/mips/configs/db1000_defconfig
arch/mips/configs/db1100_defconfig
arch/mips/configs/db1200_defconfig
arch/mips/configs/db1500_defconfig
arch/mips/configs/db1550_defconfig
arch/mips/configs/ddb5477_defconfig [deleted file]
arch/mips/configs/decstation_defconfig
arch/mips/configs/e55_defconfig
arch/mips/configs/emma2rh_defconfig
arch/mips/configs/excite_defconfig
arch/mips/configs/fulong_defconfig
arch/mips/configs/ip22_defconfig
arch/mips/configs/ip27_defconfig
arch/mips/configs/ip32_defconfig
arch/mips/configs/jazz_defconfig
arch/mips/configs/jmr3927_defconfig
arch/mips/configs/malta_defconfig
arch/mips/configs/mipssim_defconfig
arch/mips/configs/mpc30x_defconfig
arch/mips/configs/msp71xx_defconfig
arch/mips/configs/ocelot_defconfig [deleted file]
arch/mips/configs/pb1100_defconfig
arch/mips/configs/pb1500_defconfig
arch/mips/configs/pb1550_defconfig
arch/mips/configs/pnx8550-jbs_defconfig
arch/mips/configs/pnx8550-stb810_defconfig
arch/mips/configs/qemu_defconfig
arch/mips/configs/rbhma4200_defconfig
arch/mips/configs/rbhma4500_defconfig
arch/mips/configs/rm200_defconfig
arch/mips/configs/sb1250-swarm_defconfig
arch/mips/configs/sead_defconfig
arch/mips/configs/tb0219_defconfig
arch/mips/configs/tb0226_defconfig
arch/mips/configs/tb0287_defconfig
arch/mips/configs/workpad_defconfig
arch/mips/configs/wrppmc_defconfig
arch/mips/configs/yosemite_defconfig
arch/mips/ddb5xxx/Kconfig [deleted file]
arch/mips/ddb5xxx/common/Makefile [deleted file]
arch/mips/ddb5xxx/common/nile4.c [deleted file]
arch/mips/ddb5xxx/common/prom.c [deleted file]
arch/mips/ddb5xxx/common/rtc_ds1386.c [deleted file]
arch/mips/ddb5xxx/ddb5477/Makefile [deleted file]
arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c [deleted file]
arch/mips/ddb5xxx/ddb5477/debug.c [deleted file]
arch/mips/ddb5xxx/ddb5477/irq.c [deleted file]
arch/mips/ddb5xxx/ddb5477/irq_5477.c [deleted file]
arch/mips/ddb5xxx/ddb5477/kgdb_io.c [deleted file]
arch/mips/ddb5xxx/ddb5477/lcd44780.c [deleted file]
arch/mips/ddb5xxx/ddb5477/lcd44780.h [deleted file]
arch/mips/ddb5xxx/ddb5477/setup.c [deleted file]
arch/mips/dec/Makefile
arch/mips/defconfig
arch/mips/gt64120/common/Makefile [deleted file]
arch/mips/gt64120/common/time.c [deleted file]
arch/mips/gt64120/momenco_ocelot/Makefile [deleted file]
arch/mips/gt64120/momenco_ocelot/dbg_io.c [deleted file]
arch/mips/gt64120/momenco_ocelot/irq.c [deleted file]
arch/mips/gt64120/momenco_ocelot/ocelot-platform.c [deleted file]
arch/mips/gt64120/momenco_ocelot/ocelot_pld.h [deleted file]
arch/mips/gt64120/momenco_ocelot/prom.c [deleted file]
arch/mips/gt64120/momenco_ocelot/reset.c [deleted file]
arch/mips/gt64120/momenco_ocelot/setup.c [deleted file]
arch/mips/gt64120/wrppmc/Makefile
arch/mips/jazz/Makefile
arch/mips/jmr3927/common/Makefile
arch/mips/jmr3927/rbhma3100/Makefile
arch/mips/kernel/Makefile
arch/mips/kernel/asm-offsets.c
arch/mips/kernel/head.S
arch/mips/kernel/kspd.c
arch/mips/kernel/linux32.c
arch/mips/kernel/machine_kexec.c
arch/mips/kernel/mips-mt-fpaff.c
arch/mips/kernel/mips-mt.c
arch/mips/kernel/process.c
arch/mips/kernel/ptrace.c
arch/mips/kernel/relocate_kernel.S
arch/mips/kernel/rtlx.c
arch/mips/kernel/scall32-o32.S
arch/mips/kernel/scall64-64.S
arch/mips/kernel/scall64-n32.S
arch/mips/kernel/scall64-o32.S
arch/mips/kernel/signal32.c
arch/mips/kernel/smp.c
arch/mips/kernel/smtc.c
arch/mips/kernel/syscall.c
arch/mips/kernel/traps.c
arch/mips/kernel/unaligned.c
arch/mips/kernel/vpe.c
arch/mips/lemote/lm2e/Makefile
arch/mips/lemote/lm2e/irq.c
arch/mips/lemote/lm2e/prom.c
arch/mips/lemote/lm2e/setup.c
arch/mips/math-emu/Makefile
arch/mips/mips-boards/atlas/Makefile
arch/mips/mips-boards/atlas/atlas_int.c
arch/mips/mips-boards/generic/Makefile
arch/mips/mips-boards/generic/init.c
arch/mips/mips-boards/generic/time.c
arch/mips/mips-boards/malta/Makefile
arch/mips/mips-boards/malta/malta_int.c
arch/mips/mips-boards/malta/malta_smtc.c
arch/mips/mips-boards/sead/Makefile
arch/mips/mipssim/Makefile
arch/mips/mipssim/sim_setup.c
arch/mips/mm/Makefile
arch/mips/mm/c-r4k.c
arch/mips/oprofile/op_model_rm9000.c
arch/mips/pci/Makefile
arch/mips/pci/fixup-ddb5477.c [deleted file]
arch/mips/pci/fixup-ocelot.c [deleted file]
arch/mips/pci/fixup-rbtx4927.c
arch/mips/pci/fixup-tx4938.c
arch/mips/pci/ops-ddb5477.c [deleted file]
arch/mips/pci/ops-emma2rh.c
arch/mips/pci/ops-pnx8550.c
arch/mips/pci/pci-ddb5477.c [deleted file]
arch/mips/pci/pci-ocelot.c [deleted file]
arch/mips/philips/pnx8550/common/Makefile
arch/mips/pmc-sierra/yosemite/Makefile
arch/mips/pmc-sierra/yosemite/i2c-yosemite.c [deleted file]
arch/mips/pmc-sierra/yosemite/irq.c
arch/mips/pmc-sierra/yosemite/prom.c
arch/mips/pmc-sierra/yosemite/setup.c
arch/mips/pmc-sierra/yosemite/smp.c
arch/mips/qemu/Makefile
arch/mips/sgi-ip27/Makefile
arch/mips/sgi-ip27/ip27-klnuma.c
arch/mips/sgi-ip27/ip27-smp.c
arch/mips/sgi-ip32/Makefile
arch/mips/sgi-ip32/ip32-reset.c
arch/mips/sibyte/bcm1480/Makefile
arch/mips/sibyte/bcm1480/setup.c
arch/mips/sibyte/common/Makefile
arch/mips/sibyte/sb1250/Makefile
arch/mips/sni/Makefile
arch/mips/tx4927/common/tx4927_irq.c
arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_irq.c
arch/mips/tx4927/toshiba_rbtx4927/toshiba_rbtx4927_setup.c
arch/mips/tx4938/toshiba_rbtx4938/setup.c
arch/mips/vr41xx/common/Makefile
arch/parisc/hpux/fs.c
arch/parisc/kernel/init_task.c
arch/parisc/kernel/process.c
arch/parisc/kernel/smp.c
arch/powerpc/Kconfig.debug
arch/powerpc/boot/dts/kuroboxHD.dts
arch/powerpc/boot/dts/kuroboxHG.dts
arch/powerpc/boot/dts/mpc7448hpc2.dts
arch/powerpc/boot/dts/mpc8544ds.dts
arch/powerpc/boot/dts/mpc8568mds.dts
arch/powerpc/boot/dts/prpmc2800.dts
arch/powerpc/configs/lite5200_defconfig
arch/powerpc/configs/pmac32_defconfig
arch/powerpc/configs/ps3_defconfig
arch/powerpc/kernel/Makefile
arch/powerpc/kernel/entry_64.S
arch/powerpc/kernel/head_64.S
arch/powerpc/kernel/iomap.c
arch/powerpc/kernel/irq.c
arch/powerpc/kernel/pci-common.c
arch/powerpc/kernel/pci_32.c
arch/powerpc/kernel/pci_64.c
arch/powerpc/kernel/process.c
arch/powerpc/kernel/prom_parse.c
arch/powerpc/kernel/setup-common.c
arch/powerpc/kernel/smp.c
arch/powerpc/kernel/syscalls.c
arch/powerpc/kernel/udbg.c
arch/powerpc/lib/rheap.c
arch/powerpc/mm/hash_low_64.S
arch/powerpc/mm/hash_utils_64.c
arch/powerpc/mm/lmb.c
arch/powerpc/mm/numa.c
arch/powerpc/mm/slb.c
arch/powerpc/mm/slice.c
arch/powerpc/oprofile/cell/spu_task_sync.c
arch/powerpc/platforms/83xx/mpc832x_mds.c
arch/powerpc/platforms/83xx/mpc832x_rdb.c
arch/powerpc/platforms/83xx/mpc836x_mds.c
arch/powerpc/platforms/85xx/mpc85xx_mds.c
arch/powerpc/platforms/cell/spu_base.c
arch/powerpc/platforms/cell/spu_manage.c
arch/powerpc/platforms/cell/spufs/context.c
arch/powerpc/platforms/cell/spufs/run.c
arch/powerpc/platforms/cell/spufs/sched.c
arch/powerpc/platforms/iseries/lpevents.c
arch/powerpc/platforms/maple/pci.c
arch/powerpc/platforms/powermac/feature.c
arch/powerpc/platforms/ps3/Kconfig
arch/powerpc/platforms/ps3/device-init.c
arch/powerpc/platforms/ps3/setup.c
arch/powerpc/platforms/ps3/spu.c
arch/powerpc/sysdev/fsl_pci.c
arch/powerpc/sysdev/fsl_soc.c
arch/powerpc/sysdev/indirect_pci.c
arch/powerpc/sysdev/mv64x60_dev.c
arch/ppc/configs/TQM8540_defconfig
arch/ppc/configs/TQM8541_defconfig
arch/ppc/configs/TQM8555_defconfig
arch/ppc/configs/TQM8560_defconfig
arch/ppc/configs/ev64360_defconfig
arch/ppc/configs/ml300_defconfig
arch/ppc/configs/ml403_defconfig
arch/ppc/configs/mpc834x_sys_defconfig
arch/ppc/configs/prep_defconfig
arch/ppc/syslib/mv64x60.c
arch/s390/Kconfig
arch/s390/appldata/appldata_base.c
arch/s390/hypfs/inode.c
arch/s390/kernel/compat_wrapper.S
arch/s390/kernel/entry.S
arch/s390/kernel/entry64.S
arch/s390/kernel/head.S
arch/s390/kernel/init_task.c
arch/s390/kernel/process.c
arch/s390/kernel/smp.c
arch/s390/kernel/sys_s390.c
arch/s390/kernel/syscalls.S
arch/s390/kernel/vmlinux.lds.S
arch/s390/kernel/vtime.c
arch/s390/mm/vmem.c
arch/sh/Kconfig
arch/sh/Makefile
arch/sh/boards/renesas/rts7751r2d/setup.c
arch/sh/boards/se/7300/Makefile [deleted file]
arch/sh/boards/se/7300/io.c [deleted file]
arch/sh/boards/se/7300/irq.c [deleted file]
arch/sh/boards/se/7300/setup.c [deleted file]
arch/sh/boards/se/73180/Makefile [deleted file]
arch/sh/boards/se/73180/io.c [deleted file]
arch/sh/boards/se/73180/irq.c [deleted file]
arch/sh/boards/se/73180/setup.c [deleted file]
arch/sh/boot/Makefile
arch/sh/boot/compressed/Makefile
arch/sh/configs/hs7751rvoip_defconfig
arch/sh/configs/landisk_defconfig
arch/sh/configs/lboxre2_defconfig
arch/sh/configs/rts7751r2d_defconfig
arch/sh/configs/se7300_defconfig [deleted file]
arch/sh/configs/se73180_defconfig [deleted file]
arch/sh/configs/snapgear_defconfig
arch/sh/configs/systemh_defconfig
arch/sh/configs/titan_defconfig
arch/sh/drivers/dma/dma-api.c
arch/sh/kernel/cpu/irq/Makefile
arch/sh/kernel/cpu/irq/ipr.c
arch/sh/kernel/cpu/irq/pint.c [deleted file]
arch/sh/kernel/cpu/sh3/Makefile
arch/sh/kernel/cpu/sh3/clock-sh7710.c [moved from arch/sh/kernel/cpu/sh3/clock-sh7300.c with 74% similarity]
arch/sh/kernel/cpu/sh3/entry.S
arch/sh/kernel/cpu/sh3/setup-sh7300.c [deleted file]
arch/sh/kernel/cpu/sh4/probe.c
arch/sh/kernel/cpu/sh4/sq.c
arch/sh/kernel/cpu/sh4a/Makefile
arch/sh/kernel/cpu/sh4a/clock-sh73180.c [deleted file]
arch/sh/kernel/cpu/sh4a/setup-sh73180.c [deleted file]
arch/sh/kernel/init_task.c
arch/sh/kernel/process.c
arch/sh/kernel/setup.c
arch/sh/kernel/sys_sh.c
arch/sh/kernel/timers/timer-tmu.c
arch/sh/kernel/traps.c
arch/sh/kernel/vsyscall/vsyscall.c
arch/sh/mm/Kconfig
arch/sh/mm/Makefile
arch/sh/mm/cache-sh4.c
arch/sh/mm/fault-nommu.c
arch/sh/mm/fault.c
arch/sh/mm/pg-sh4.c
arch/sh/tools/mach-types
arch/sh64/Kconfig
arch/sh64/kernel/init_task.c
arch/sh64/kernel/irq_intc.c
arch/sh64/kernel/pci-dma.c
arch/sh64/kernel/process.c
arch/sh64/kernel/sys_sh64.c
arch/sh64/lib/dbg.c
arch/sparc/defconfig
arch/sparc/kernel/entry.S
arch/sparc/kernel/init_task.c
arch/sparc/kernel/irq.c
arch/sparc/kernel/prom.c
arch/sparc/kernel/sparc_ksyms.c
arch/sparc/mm/sun4c.c
arch/sparc64/Kconfig.debug
arch/sparc64/kernel/Makefile
arch/sparc64/kernel/cpu.c
arch/sparc64/kernel/ebus.c
arch/sparc64/kernel/head.S
arch/sparc64/kernel/hvtramp.S
arch/sparc64/kernel/init_task.c
arch/sparc64/kernel/iommu.c [moved from arch/sparc64/kernel/pci_iommu.c with 68% similarity]
arch/sparc64/kernel/irq.c
arch/sparc64/kernel/isa.c
arch/sparc64/kernel/mdesc.c
arch/sparc64/kernel/pci.c
arch/sparc64/kernel/pci_common.c
arch/sparc64/kernel/pci_fire.c
arch/sparc64/kernel/pci_psycho.c
arch/sparc64/kernel/pci_sabre.c
arch/sparc64/kernel/pci_schizo.c
arch/sparc64/kernel/pci_sun4v.c
arch/sparc64/kernel/process.c
arch/sparc64/kernel/prom.c
arch/sparc64/kernel/sbus.c
arch/sparc64/kernel/smp.c
arch/sparc64/kernel/sparc64_ksyms.c
arch/sparc64/kernel/time.c
arch/sparc64/kernel/trampoline.S
arch/sparc64/kernel/traps.c
arch/sparc64/kernel/vio.c
arch/sparc64/kernel/viohs.c
arch/sparc64/lib/GENbzero.S [new file with mode: 0644]
arch/sparc64/lib/GENcopy_from_user.S [new file with mode: 0644]
arch/sparc64/lib/GENcopy_to_user.S [new file with mode: 0644]
arch/sparc64/lib/GENmemcpy.S [new file with mode: 0644]
arch/sparc64/lib/GENpage.S [new file with mode: 0644]
arch/sparc64/lib/GENpatch.S [new file with mode: 0644]
arch/sparc64/lib/Makefile
arch/sparc64/mm/fault.c
arch/um/drivers/chan_kern.c
arch/um/drivers/mmapper_kern.c
arch/um/kernel/exec.c
arch/um/kernel/init_task.c
arch/um/kernel/syscall.c
arch/x86_64/Kconfig
arch/x86_64/boot/compressed/head.S
arch/x86_64/defconfig
arch/x86_64/ia32/ia32_binfmt.c
arch/x86_64/ia32/ptrace32.c
arch/x86_64/ia32/syscall32.c
arch/x86_64/kernel/Makefile
arch/x86_64/kernel/acpi/Makefile
arch/x86_64/kernel/apic.c
arch/x86_64/kernel/bugs.c
arch/x86_64/kernel/entry.S
arch/x86_64/kernel/head.S
arch/x86_64/kernel/io_apic.c
arch/x86_64/kernel/pci-calgary.c
arch/x86_64/kernel/process.c
arch/x86_64/kernel/setup.c
arch/x86_64/kernel/suspend.c
arch/x86_64/kernel/sys_x86_64.c
arch/x86_64/kernel/tce.c
arch/x86_64/kernel/tsc.c
arch/x86_64/lib/memcpy.S
arch/x86_64/mm/init.c
arch/x86_64/mm/pageattr.c
arch/x86_64/pci/mmconfig.c
arch/x86_64/vdso/.gitignore [new file with mode: 0644]
arch/x86_64/vdso/vma.c
block/Kconfig
block/blktrace.c
block/bsg.c
block/ll_rw_blk.c
crypto/ablkcipher.c
crypto/blkcipher.c
crypto/cipher.c
crypto/hash.c
drivers/Makefile
drivers/acorn/README [deleted file]
drivers/acorn/block/Kconfig [deleted file]
drivers/acorn/block/Makefile [deleted file]
drivers/acorn/block/fd1772.c [deleted file]
drivers/acorn/block/fd1772dma.S [deleted file]
drivers/acorn/block/mfm.S [deleted file]
drivers/acorn/block/mfmhd.c [deleted file]
drivers/acpi/Kconfig
drivers/acpi/asus_acpi.c
drivers/acpi/battery.c
drivers/acpi/bay.c
drivers/acpi/dock.c
drivers/acpi/ec.c
drivers/acpi/event.c
drivers/acpi/processor_idle.c
drivers/acpi/processor_perflib.c
drivers/acpi/resources/rsxface.c
drivers/acpi/sbs.c
drivers/acpi/sleep/Makefile
drivers/acpi/sleep/main.c
drivers/acpi/sleep/poweroff.c
drivers/acpi/sleep/proc.c
drivers/acpi/sleep/sleep.h
drivers/acpi/tables/tbxface.c
drivers/acpi/thermal.c
drivers/ata/ata_piix.c
drivers/ata/libata-core.c
drivers/ata/libata-sff.c
drivers/ata/pata_cmd64x.c
drivers/ata/pata_icside.c
drivers/ata/pata_sis.c
drivers/atm/fore200e.c
drivers/atm/iphase.c
drivers/atm/lanai.c
drivers/base/core.c
drivers/base/cpu.c
drivers/base/firmware_class.c
drivers/base/power/Makefile
drivers/base/power/power.h
drivers/base/power/shutdown.c
drivers/block/Makefile
drivers/block/cciss.c
drivers/block/cpqarray.c
drivers/block/lguest_blk.c
drivers/block/viodasd.c
drivers/block/xsysace.c
drivers/char/Kconfig
drivers/char/Makefile
drivers/char/agp/Kconfig
drivers/char/agp/ati-agp.c
drivers/char/agp/compat_ioctl.c
drivers/char/agp/frontend.c
drivers/char/agp/generic.c
drivers/char/agp/intel-agp.c
drivers/char/agp/sgi-agp.c
drivers/char/drm/i915_dma.c
drivers/char/drm/i915_drv.h
drivers/char/hpet.c
drivers/char/hvc_lguest.c
drivers/char/ip2/ip2main.c
drivers/char/ipmi/ipmi_si_intf.c
drivers/char/mmtimer.c
drivers/char/mspec.c
drivers/char/pcmcia/cm4000_cs.c
drivers/char/pcmcia/cm4040_cs.c
drivers/char/sonypi.c
drivers/char/synclink_gt.c
drivers/char/tty_io.c
drivers/char/watchdog/Kconfig
drivers/char/watchdog/Makefile
drivers/char/watchdog/bfin_wdt.c [new file with mode: 0644]
drivers/char/watchdog/booke_wdt.c
drivers/char/watchdog/cpu5wdt.c
drivers/char/watchdog/davinci_wdt.c [new file with mode: 0644]
drivers/char/watchdog/iTCO_wdt.c
drivers/char/watchdog/machzwd.c
drivers/char/watchdog/mixcomwd.c
drivers/char/watchdog/mpc5200_wdt.c [new file with mode: 0644]
drivers/char/watchdog/mpc83xx_wdt.c
drivers/char/watchdog/mpc8xx_wdt.c
drivers/char/watchdog/mtx-1_wdt.c
drivers/char/watchdog/mv64x60_wdt.c
drivers/char/watchdog/omap_wdt.c
drivers/char/watchdog/s3c2410_wdt.c
drivers/char/watchdog/sa1100_wdt.c
drivers/char/watchdog/sbc60xxwdt.c
drivers/char/watchdog/sc1200wdt.c
drivers/char/watchdog/sc520_wdt.c
drivers/char/watchdog/w83627hf_wdt.c
drivers/dma/iovlock.c
drivers/edac/Kconfig
drivers/edac/edac_mc.c
drivers/edac/edac_mc_sysfs.c
drivers/edac/edac_module.h
drivers/edac/edac_pci.c
drivers/edac/edac_pci_sysfs.c
drivers/edac/i3000_edac.c
drivers/firewire/fw-ohci.c
drivers/firewire/fw-sbp2.c
drivers/firewire/fw-transaction.c
drivers/firewire/fw-transaction.h
drivers/hid/usbhid/hid-core.c
drivers/hid/usbhid/hid-quirks.c
drivers/hwmon/Kconfig
drivers/hwmon/Makefile
drivers/hwmon/abituguru3.c
drivers/hwmon/ams/ams-core.c
drivers/hwmon/applesmc.c
drivers/hwmon/dme1737.c
drivers/hwmon/fscher.c
drivers/hwmon/it87.c
drivers/hwmon/lm78.c
drivers/hwmon/lm90.c
drivers/hwmon/lm93.c
drivers/hwmon/pc87360.c
drivers/hwmon/sis5595.c
drivers/hwmon/smsc47m1.c
drivers/hwmon/thmc50.c [new file with mode: 0644]
drivers/hwmon/via686a.c
drivers/hwmon/vt8231.c
drivers/hwmon/w83627hf.c
drivers/i2c/busses/Kconfig
drivers/i2c/busses/i2c-i801.c
drivers/i2c/busses/i2c-iop3xx.c
drivers/i2c/busses/i2c-mpc.c
drivers/i2c/busses/i2c-mv64xxx.c
drivers/i2c/busses/i2c-s3c2410.c
drivers/i2c/chips/ds1682.c
drivers/i2c/chips/isp1301_omap.c
drivers/i2c/chips/menelaus.c
drivers/i2c/chips/tps65010.c
drivers/ide/Kconfig
drivers/ide/arm/icside.c
drivers/ide/arm/ide_arm.c
drivers/ide/ide-tape.c
drivers/ide/pci/alim15x3.c
drivers/ide/pci/cmd64x.c
drivers/ide/pci/cs5520.c
drivers/ide/pci/cs5535.c
drivers/ide/pci/it8213.c
drivers/ide/pci/jmicron.c
drivers/ide/pci/piix.c
drivers/ide/pci/scc_pata.c
drivers/ide/pci/sis5513.c
drivers/ide/pci/slc90e66.c
drivers/ieee1394/Kconfig
drivers/ieee1394/raw1394.c
drivers/ieee1394/sbp2.c
drivers/infiniband/hw/amso1100/c2_qp.c
drivers/infiniband/hw/ehca/ehca_classes.h
drivers/infiniband/hw/ehca/ehca_irq.c
drivers/infiniband/hw/ehca/ehca_mrmw.c
drivers/infiniband/hw/ehca/ehca_pd.c
drivers/infiniband/hw/ehca/hcp_if.c
drivers/infiniband/hw/ehca/ipz_pt_fn.h
drivers/infiniband/hw/ipath/ipath_common.h
drivers/infiniband/hw/ipath/ipath_diag.c
drivers/infiniband/hw/ipath/ipath_driver.c
drivers/infiniband/hw/ipath/ipath_iba6120.c
drivers/infiniband/hw/ipath/ipath_init_chip.c
drivers/infiniband/hw/ipath/ipath_intr.c
drivers/infiniband/hw/ipath/ipath_kernel.h
drivers/infiniband/hw/ipath/ipath_stats.c
drivers/infiniband/hw/mlx4/qp.c
drivers/infiniband/ulp/iser/iscsi_iser.c
drivers/input/evdev.c
drivers/input/serio/Kconfig
drivers/isdn/divert/divert_procfs.c
drivers/kvm/x86_emulate.c
drivers/lguest/Kconfig
drivers/lguest/Makefile
drivers/lguest/README [new file with mode: 0644]
drivers/lguest/core.c
drivers/lguest/hypercalls.c
drivers/lguest/interrupts_and_traps.c
drivers/lguest/io.c
drivers/lguest/lg.h
drivers/lguest/lguest.c
drivers/lguest/lguest_asm.S
drivers/lguest/lguest_bus.c
drivers/lguest/lguest_user.c
drivers/lguest/page_tables.c
drivers/lguest/segments.c
drivers/lguest/switcher.S
drivers/md/dm.c
drivers/md/raid10.c
drivers/media/dvb/dvb-usb/af9005-fe.c
drivers/media/dvb/frontends/dvb-pll.c
drivers/media/video/Kconfig
drivers/media/video/bt8xx/bttv-cards.c
drivers/media/video/ivtv/ivtv-driver.h
drivers/media/video/ivtv/ivtv-fileops.c
drivers/media/video/ivtv/ivtv-firmware.c
drivers/media/video/ivtv/ivtv-ioctl.c
drivers/media/video/ivtv/ivtv-mailbox.c
drivers/media/video/ivtv/ivtv-streams.c
drivers/media/video/usbvision/usbvision-video.c
drivers/media/video/zoran.h
drivers/media/video/zoran_device.c
drivers/media/video/zoran_driver.c
drivers/message/fusion/Kconfig
drivers/message/fusion/Makefile
drivers/message/fusion/mptbase.c
drivers/message/fusion/mptbase.h
drivers/message/fusion/mptctl.c
drivers/message/fusion/mptdebug.h [new file with mode: 0644]
drivers/message/fusion/mptfc.c
drivers/message/fusion/mptlan.c
drivers/message/fusion/mptsas.c
drivers/message/fusion/mptscsih.c
drivers/message/fusion/mptspi.c
drivers/message/i2o/i2o_block.c
drivers/misc/Kconfig
drivers/misc/sony-laptop.c
drivers/misc/thinkpad_acpi.c
drivers/misc/thinkpad_acpi.h
drivers/mmc/card/queue.c
drivers/mmc/core/bus.c
drivers/mmc/core/core.c
drivers/mmc/core/core.h
drivers/mmc/core/host.c
drivers/mmc/core/mmc.c
drivers/mmc/core/mmc_ops.c
drivers/mmc/core/mmc_ops.h
drivers/mmc/core/sd.c
drivers/mmc/core/sd_ops.c
drivers/mmc/core/sd_ops.h
drivers/mmc/host/at91_mci.c
drivers/mmc/host/au1xmmc.c
drivers/mmc/host/imxmmc.c
drivers/mmc/host/mmci.c
drivers/mmc/host/mmci.h
drivers/mmc/host/omap.c
drivers/mmc/host/pxamci.c
drivers/mmc/host/sdhci.c
drivers/mmc/host/sdhci.h
drivers/mmc/host/wbsd.c
drivers/mmc/host/wbsd.h
drivers/mtd/Makefile
drivers/mtd/devices/docprobe.c
drivers/mtd/maps/Kconfig
drivers/mtd/mtdchar.c
drivers/mtd/mtdpart.c
drivers/mtd/nand/at91_nand.c
drivers/mtd/nand/diskonchip.c
drivers/mtd/nand/edb7312.c
drivers/mtd/nand/nand_base.c
drivers/mtd/rfd_ftl.c
drivers/net/3c59x.c
drivers/net/8139cp.c
drivers/net/8139too.c
drivers/net/Kconfig
drivers/net/Makefile
drivers/net/atl1/atl1_main.c
drivers/net/ax88796.c
drivers/net/b44.c
drivers/net/bfin_mac.c
drivers/net/bnx2.c
drivers/net/bonding/bond_main.c
drivers/net/cxgb3/cxgb3_main.c
drivers/net/cxgb3/cxgb3_offload.c
drivers/net/e100.c
drivers/net/e1000/e1000_ethtool.c
drivers/net/e1000/e1000_hw.c
drivers/net/e1000/e1000_hw.h
drivers/net/e1000/e1000_main.c
drivers/net/ehea/ehea.h
drivers/net/ehea/ehea_main.c
drivers/net/fec.c
drivers/net/forcedeth.c
drivers/net/gianfar_mii.c
drivers/net/gianfar_mii.h
drivers/net/hamradio/bpqether.c
drivers/net/ibmveth.c
drivers/net/ibmveth.h
drivers/net/irda/irda-usb.c
drivers/net/ixgb/ixgb_ethtool.c
drivers/net/lguest_net.c
drivers/net/lib8390.c
drivers/net/loopback.c
drivers/net/mlx4/mr.c
drivers/net/myri10ge/myri10ge.c
drivers/net/natsemi.c
drivers/net/ne2k-pci.c
drivers/net/netxen/netxen_nic_ethtool.c
drivers/net/netxen/netxen_nic_main.c
drivers/net/pcmcia/nmclan_cs.c
drivers/net/pcmcia/smc91c92_cs.c
drivers/net/pcnet32.c
drivers/net/phy/phy.c
drivers/net/pppoe.c
drivers/net/pppol2tp.c
drivers/net/pppox.c
drivers/net/qla3xxx.c
drivers/net/r8169.c
drivers/net/s2io-regs.h
drivers/net/s2io.c
drivers/net/s2io.h
drivers/net/sc92031.c
drivers/net/sis190.c
drivers/net/skfp/pmf.c
drivers/net/skge.c
drivers/net/sky2.c
drivers/net/smc91x.h
drivers/net/sundance.c
drivers/net/sunlance.c
drivers/net/sunvnet.c
drivers/net/tc35815.c
drivers/net/tg3.c
drivers/net/tulip/tulip_core.c
drivers/net/ucc_geth_ethtool.c
drivers/net/ucc_geth_mii.c
drivers/net/usb/pegasus.c
drivers/net/via-rhine.c
drivers/net/via-velocity.c
drivers/net/wan/hdlc_fr.c
drivers/net/wireless/bcm43xx/bcm43xx_phy.c
drivers/net/wireless/rtl8187_dev.c
drivers/net/wireless/zd1211rw/zd_mac.c
drivers/net/xen-netfront.c
drivers/parport/parport_pc.c
drivers/pci/pci-acpi.c
drivers/pci/pci-driver.c
drivers/pci/pci.c
drivers/pcmcia/cs.c
drivers/pnp/card.c
drivers/pnp/core.c
drivers/pnp/driver.c
drivers/pnp/interface.c
drivers/pnp/isapnp/compat.c
drivers/pnp/isapnp/core.c
drivers/pnp/isapnp/proc.c
drivers/pnp/manager.c
drivers/pnp/pnpacpi/core.c
drivers/pnp/pnpacpi/rsparser.c
drivers/pnp/pnpbios/bioscalls.c
drivers/pnp/pnpbios/core.c
drivers/pnp/pnpbios/proc.c
drivers/pnp/pnpbios/rsparser.c
drivers/pnp/quirks.c
drivers/pnp/resource.c
drivers/pnp/support.c
drivers/pnp/system.c
drivers/power/Kconfig
drivers/rtc/Kconfig
drivers/rtc/Makefile
drivers/rtc/rtc-bfin.c
drivers/rtc/rtc-dev.c
drivers/rtc/rtc-ds1307.c
drivers/rtc/rtc-m48t59.c
drivers/rtc/rtc-s3c.c
drivers/rtc/rtc-sh.c
drivers/rtc/rtc-stk17ta8.c
drivers/s390/block/dasd_eckd.c
drivers/s390/char/Kconfig
drivers/s390/char/monwriter.c
drivers/s390/char/raw3270.c
drivers/s390/char/sclp_vt220.c
drivers/s390/char/vmur.c
drivers/s390/char/vmur.h
drivers/s390/cio/blacklist.c
drivers/s390/cio/ccwgroup.c
drivers/s390/cio/chp.c
drivers/s390/cio/chsc.c
drivers/s390/cio/chsc.h
drivers/s390/cio/cio.c
drivers/s390/cio/cio_debug.h
drivers/s390/cio/cmf.c
drivers/s390/cio/css.c
drivers/s390/cio/css.h
drivers/s390/cio/device.c
drivers/s390/cio/device_fsm.c
drivers/s390/cio/device_ops.c
drivers/s390/cio/qdio.c
drivers/s390/scsi/zfcp_fsf.c
drivers/s390/scsi/zfcp_qdio.c
drivers/sbus/char/bbc_envctrl.c
drivers/sbus/char/bbc_i2c.c
drivers/sbus/char/vfc_dev.c
drivers/sbus/sbus.c
drivers/scsi/aacraid/aachba.c
drivers/scsi/aacraid/aacraid.h
drivers/scsi/aacraid/linit.c
drivers/scsi/aacraid/nark.c
drivers/scsi/aacraid/rkt.c
drivers/scsi/aacraid/rx.c
drivers/scsi/advansys.c
drivers/scsi/aha152x.c
drivers/scsi/aha152x.h
drivers/scsi/aic7xxx/aic79xx_osm.c
drivers/scsi/aic7xxx/aic7xxx_core.c
drivers/scsi/aic7xxx/aic7xxx_osm.c
drivers/scsi/aic94xx/aic94xx_init.c
drivers/scsi/arm/Kconfig
drivers/scsi/arm/Makefile
drivers/scsi/arm/ecoscsi.c [deleted file]
drivers/scsi/dpt_i2o.c
drivers/scsi/dpti.h
drivers/scsi/esp_scsi.h
drivers/scsi/gdth.c
drivers/scsi/gdth.h
drivers/scsi/hosts.c
drivers/scsi/ibmvscsi/ibmvscsi.c
drivers/scsi/ide-scsi.c
drivers/scsi/iscsi_tcp.c
drivers/scsi/libiscsi.c
drivers/scsi/libsas/Kconfig
drivers/scsi/libsas/sas_ata.c
drivers/scsi/libsas/sas_discover.c
drivers/scsi/libsas/sas_dump.c
drivers/scsi/libsas/sas_expander.c
drivers/scsi/lpfc/lpfc.h
drivers/scsi/lpfc/lpfc_attr.c
drivers/scsi/lpfc/lpfc_crtn.h
drivers/scsi/lpfc/lpfc_ct.c
drivers/scsi/lpfc/lpfc_debugfs.c
drivers/scsi/lpfc/lpfc_debugfs.h
drivers/scsi/lpfc/lpfc_els.c
drivers/scsi/lpfc/lpfc_hbadisc.c
drivers/scsi/lpfc/lpfc_hw.h
drivers/scsi/lpfc/lpfc_init.c
drivers/scsi/lpfc/lpfc_logmsg.h
drivers/scsi/lpfc/lpfc_mbox.c
drivers/scsi/lpfc/lpfc_mem.c
drivers/scsi/lpfc/lpfc_nportdisc.c
drivers/scsi/lpfc/lpfc_scsi.c
drivers/scsi/lpfc/lpfc_sli.c
drivers/scsi/lpfc/lpfc_sli.h
drivers/scsi/lpfc/lpfc_version.h
drivers/scsi/lpfc/lpfc_vport.c
drivers/scsi/lpfc/lpfc_vport.h
drivers/scsi/qla2xxx/qla_attr.c
drivers/scsi/qla2xxx/qla_def.h
drivers/scsi/qla2xxx/qla_init.c
drivers/scsi/qla2xxx/qla_isr.c
drivers/scsi/qla2xxx/qla_os.c
drivers/scsi/qlogicpti.c
drivers/scsi/scsi_devinfo.c
drivers/scsi/scsi_lib.c
drivers/scsi/sd.c
drivers/scsi/st.c
drivers/scsi/st.h
drivers/scsi/sym53c8xx_2/sym_glue.c
drivers/serial/8250.c
drivers/serial/8250_early.c
drivers/serial/8250_pci.c
drivers/serial/Kconfig
drivers/serial/mpsc.c
drivers/serial/sb1250-duart.c
drivers/serial/serial_txx9.c
drivers/serial/sh-sci.c
drivers/serial/sh-sci.h
drivers/serial/vr41xx_siu.c
drivers/spi/spi.c
drivers/spi/spi_mpc83xx.c
drivers/spi/spi_s3c24xx.c
drivers/spi/spidev.c
drivers/usb/Makefile
drivers/usb/core/message.c
drivers/usb/core/quirks.c
drivers/usb/gadget/config.c
drivers/usb/gadget/epautoconf.c
drivers/usb/gadget/ether.c
drivers/usb/gadget/inode.c
drivers/usb/gadget/m66592-udc.c
drivers/usb/gadget/pxa2xx_udc.c
drivers/usb/gadget/zero.c
drivers/usb/serial/cp2101.c
drivers/usb/serial/digi_acceleport.c
drivers/usb/serial/io_edgeport.c
drivers/usb/serial/mct_u232.c
drivers/usb/serial/mct_u232.h
drivers/usb/serial/sierra.c
drivers/usb/serial/usb-serial.c
drivers/usb/storage/unusual_devs.h
drivers/video/Kconfig
drivers/video/Makefile
drivers/video/acornfb.c
drivers/video/bw2.c
drivers/video/cg14.c
drivers/video/cg3.c
drivers/video/cg6.c
drivers/video/chipsfb.c
drivers/video/console/fbcon.c
drivers/video/console/fonts.c
drivers/video/fbmem.c
drivers/video/ffb.c
drivers/video/geode/Kconfig
drivers/video/geode/Makefile
drivers/video/geode/lxfb.h [new file with mode: 0644]
drivers/video/geode/lxfb_core.c [new file with mode: 0644]
drivers/video/geode/lxfb_ops.c [new file with mode: 0644]
drivers/video/leo.c
drivers/video/matrox/g450_pll.c
drivers/video/matrox/matroxfb_DAC1064.h
drivers/video/matrox/matroxfb_base.h
drivers/video/matrox/matroxfb_misc.c
drivers/video/p9100.c
drivers/video/pvr2fb.c
drivers/video/s3c2410fb.c
drivers/video/s3c2410fb.h
drivers/video/sbuslib.c
drivers/video/stifb.c
drivers/video/tcx.c
drivers/video/tgafb.c
drivers/video/tx3912fb.c [deleted file]
drivers/video/xilinxfb.c
drivers/w1/masters/ds1wm.c
drivers/xen/xenbus/xenbus_xs.c
fs/afs/flock.c
fs/compat_ioctl.c
fs/dcookies.c
fs/direct-io.c
fs/dlm/lock.c
fs/dlm/lowcomms.c
fs/dlm/member.c
fs/dlm/rcom.c
fs/ecryptfs/inode.c
fs/ecryptfs/main.c
fs/exec.c
fs/ext2/super.c
fs/ext3/super.c
fs/ext4/extents.c
fs/ext4/super.c
fs/gfs2/lops.c
fs/gfs2/mount.c
fs/gfs2/ops_address.c
fs/gfs2/ops_file.c
fs/gfs2/rgrp.c
fs/isofs/inode.c
fs/jffs2/background.c
fs/jffs2/nodelist.h
fs/jffs2/readinode.c
fs/jffs2/scan.c
fs/jffs2/write.c
fs/lockd/svclock.c
fs/locks.c
fs/ncpfs/ncplib_kernel.c
fs/nfs/delegation.c
fs/nfs/inode.c
fs/nfs/namespace.c
fs/nfs/nfs4proc.c
fs/nfs/nfs4renewd.c
fs/nfs/nfs4state.c
fs/nfsd/export.c
fs/nfsd/nfs4idmap.c
fs/nfsd/nfs4proc.c
fs/nfsd/nfs4xdr.c
fs/nfsd/vfs.c
fs/ocfs2/alloc.c
fs/ocfs2/cluster/tcp.c
fs/ocfs2/file.c
fs/ocfs2/namei.c
fs/ocfs2/ocfs2.h
fs/ocfs2/super.c
fs/ocfs2/super.h
fs/open.c
fs/partitions/msdos.c
fs/partitions/sun.c
fs/partitions/sun.h
fs/pipe.c
fs/proc/base.c
fs/proc/inode.c
fs/quota.c
fs/ramfs/file-nommu.c
fs/reiserfs/stree.c
fs/signalfd.c
fs/splice.c
fs/timerfd.c
fs/udf/inode.c
fs/udf/super.c
fs/udf/udf_sb.h
fs/xfs/linux-2.6/xfs_ioctl32.c
include/acpi/acpi_bus.h
include/acpi/acpi_drivers.h
include/acpi/processor.h
include/asm-alpha/bitops.h
include/asm-alpha/fcntl.h
include/asm-alpha/thread_info.h
include/asm-arm/arch-mxc/uncompress.h
include/asm-arm/pgtable-nommu.h
include/asm-arm/thread_info.h
include/asm-arm/unaligned.h
include/asm-arm26/a.out.h [deleted file]
include/asm-arm26/assembler.h [deleted file]
include/asm-arm26/atomic.h [deleted file]
include/asm-arm26/auxvec.h [deleted file]
include/asm-arm26/bitops.h [deleted file]
include/asm-arm26/bug.h [deleted file]
include/asm-arm26/bugs.h [deleted file]
include/asm-arm26/byteorder.h [deleted file]
include/asm-arm26/cache.h [deleted file]
include/asm-arm26/cacheflush.h [deleted file]
include/asm-arm26/checksum.h [deleted file]
include/asm-arm26/constants.h [deleted file]
include/asm-arm26/cputime.h [deleted file]
include/asm-arm26/current.h [deleted file]
include/asm-arm26/delay.h [deleted file]
include/asm-arm26/device.h [deleted file]
include/asm-arm26/div64.h [deleted file]
include/asm-arm26/dma.h [deleted file]
include/asm-arm26/ecard.h [deleted file]
include/asm-arm26/elf.h [deleted file]
include/asm-arm26/emergency-restart.h [deleted file]
include/asm-arm26/errno.h [deleted file]
include/asm-arm26/fb.h [deleted file]
include/asm-arm26/fcntl.h [deleted file]
include/asm-arm26/fiq.h [deleted file]
include/asm-arm26/floppy.h [deleted file]
include/asm-arm26/fpstate.h [deleted file]
include/asm-arm26/futex.h [deleted file]
include/asm-arm26/hardirq.h [deleted file]
include/asm-arm26/hardware.h [deleted file]
include/asm-arm26/ide.h [deleted file]
include/asm-arm26/io.h [deleted file]
include/asm-arm26/ioc.h [deleted file]
include/asm-arm26/ioctl.h [deleted file]
include/asm-arm26/ioctls.h [deleted file]
include/asm-arm26/ipc.h [deleted file]
include/asm-arm26/ipcbuf.h [deleted file]
include/asm-arm26/irq.h [deleted file]
include/asm-arm26/irqchip.h [deleted file]
include/asm-arm26/kdebug.h [deleted file]
include/asm-arm26/kmap_types.h [deleted file]
include/asm-arm26/leds.h [deleted file]
include/asm-arm26/limits.h [deleted file]
include/asm-arm26/linkage.h [deleted file]
include/asm-arm26/local.h [deleted file]
include/asm-arm26/locks.h [deleted file]
include/asm-arm26/mach-types.h [deleted file]
include/asm-arm26/map.h [deleted file]
include/asm-arm26/mc146818rtc.h [deleted file]
include/asm-arm26/memory.h [deleted file]
include/asm-arm26/mman.h [deleted file]
include/asm-arm26/mmu.h [deleted file]
include/asm-arm26/mmu_context.h [deleted file]
include/asm-arm26/module.h [deleted file]
include/asm-arm26/msgbuf.h [deleted file]
include/asm-arm26/namei.h [deleted file]
include/asm-arm26/oldlatches.h [deleted file]
include/asm-arm26/page.h [deleted file]
include/asm-arm26/param.h [deleted file]
include/asm-arm26/parport.h [deleted file]
include/asm-arm26/pci.h [deleted file]
include/asm-arm26/percpu.h [deleted file]
include/asm-arm26/pgalloc.h [deleted file]
include/asm-arm26/pgtable.h [deleted file]
include/asm-arm26/poll.h [deleted file]
include/asm-arm26/posix_types.h [deleted file]
include/asm-arm26/proc-fns.h [deleted file]
include/asm-arm26/processor.h [deleted file]
include/asm-arm26/procinfo.h [deleted file]
include/asm-arm26/ptrace.h [deleted file]
include/asm-arm26/resource.h [deleted file]
include/asm-arm26/scatterlist.h [deleted file]
include/asm-arm26/sections.h [deleted file]
include/asm-arm26/segment.h [deleted file]
include/asm-arm26/semaphore-helper.h [deleted file]
include/asm-arm26/semaphore.h [deleted file]
include/asm-arm26/sembuf.h [deleted file]
include/asm-arm26/serial.h [deleted file]
include/asm-arm26/setup.h [deleted file]
include/asm-arm26/shmbuf.h [deleted file]
include/asm-arm26/shmparam.h [deleted file]
include/asm-arm26/sigcontext.h [deleted file]
include/asm-arm26/siginfo.h [deleted file]
include/asm-arm26/signal.h [deleted file]
include/asm-arm26/sizes.h [deleted file]
include/asm-arm26/smp.h [deleted file]
include/asm-arm26/socket.h [deleted file]
include/asm-arm26/sockios.h [deleted file]
include/asm-arm26/spinlock.h [deleted file]
include/asm-arm26/stat.h [deleted file]
include/asm-arm26/statfs.h [deleted file]
include/asm-arm26/string.h [deleted file]
include/asm-arm26/suspend.h [deleted file]
include/asm-arm26/sysirq.h [deleted file]
include/asm-arm26/system.h [deleted file]
include/asm-arm26/termbits.h [deleted file]
include/asm-arm26/termios.h [deleted file]
include/asm-arm26/thread_info.h [deleted file]
include/asm-arm26/timex.h [deleted file]
include/asm-arm26/tlb.h [deleted file]
include/asm-arm26/tlbflush.h [deleted file]
include/asm-arm26/topology.h [deleted file]
include/asm-arm26/types.h [deleted file]
include/asm-arm26/uaccess-asm.h [deleted file]
include/asm-arm26/uaccess.h [deleted file]
include/asm-arm26/ucontext.h [deleted file]
include/asm-arm26/unaligned.h [deleted file]
include/asm-arm26/uncompress.h [deleted file]
include/asm-arm26/unistd.h [deleted file]
include/asm-arm26/user.h [deleted file]
include/asm-arm26/xor.h [deleted file]
include/asm-avr32/bug.h
include/asm-avr32/thread_info.h
include/asm-blackfin/bfin-global.h
include/asm-blackfin/mach-bf548/cdefBF54x_base.h
include/asm-blackfin/mach-bf548/irq.h
include/asm-blackfin/mach-bf561/cdefBF561.h
include/asm-blackfin/mach-bf561/defBF561.h
include/asm-blackfin/thread_info.h
include/asm-cris/thread_info.h
include/asm-frv/mb86943a.h
include/asm-frv/thread_info.h
include/asm-frv/unistd.h
include/asm-generic/bug.h
include/asm-generic/pgtable.h
include/asm-generic/unaligned.h
include/asm-h8300/thread_info.h
include/asm-i386/apic.h
include/asm-i386/cpufeature.h
include/asm-i386/e820.h
include/asm-i386/paravirt.h
include/asm-i386/pci.h
include/asm-i386/serial.h
include/asm-i386/thread_info.h
include/asm-ia64/thread_info.h
include/asm-m32r/thread_info.h
include/asm-m68k/raw_io.h
include/asm-m68k/system.h
include/asm-m68knommu/hardirq.h
include/asm-m68knommu/machdep.h
include/asm-m68knommu/thread_info.h
include/asm-mips/a.out.h
include/asm-mips/bootinfo.h
include/asm-mips/ddb5xxx/ddb5477.h [deleted file]
include/asm-mips/ddb5xxx/ddb5xxx.h [deleted file]
include/asm-mips/edac.h [new file with mode: 0644]
include/asm-mips/elf.h
include/asm-mips/hazards.h
include/asm-mips/mach-tx49xx/cpu-feature-overrides.h [new file with mode: 0644]
include/asm-mips/mach-tx49xx/kmalloc.h [new file with mode: 0644]
include/asm-mips/mips-boards/generic.h
include/asm-mips/mips_mt.h
include/asm-mips/pmon.h
include/asm-mips/processor.h
include/asm-mips/seccomp.h [new file with mode: 0644]
include/asm-mips/system.h
include/asm-mips/thread_info.h
include/asm-mips/tx3912.h [deleted file]
include/asm-mips/tx4927/toshiba_rbtx4927.h
include/asm-mips/unistd.h
include/asm-mips/war.h
include/asm-parisc/bug.h
include/asm-parisc/thread_info.h
include/asm-powerpc/bug.h
include/asm-powerpc/dma-mapping.h
include/asm-powerpc/mmu-hash64.h
include/asm-powerpc/page.h
include/asm-powerpc/pci-bridge.h
include/asm-powerpc/pgtable-64k.h
include/asm-powerpc/ppc_asm.h
include/asm-powerpc/spu_priv1.h
include/asm-powerpc/thread_info.h
include/asm-powerpc/vio.h
include/asm-ppc/mv64x60.h
include/asm-s390/bug.h
include/asm-s390/ccwdev.h
include/asm-s390/s390_ext.h
include/asm-s390/smp.h
include/asm-s390/unistd.h
include/asm-sh/bug.h
include/asm-sh/bugs.h
include/asm-sh/cpu-sh3/freq.h
include/asm-sh/cpu-sh3/mmu_context.h
include/asm-sh/cpu-sh3/timer.h
include/asm-sh/cpu-sh4/freq.h
include/asm-sh/dma-mapping.h
include/asm-sh/dma.h
include/asm-sh/fixmap.h
include/asm-sh/floppy.h
include/asm-sh/io.h
include/asm-sh/pgtable.h
include/asm-sh/processor.h
include/asm-sh/rts7751r2d.h
include/asm-sh/se7300.h [deleted file]
include/asm-sh/se73180.h [deleted file]
include/asm-sh/thread_info.h
include/asm-sh/ubc.h
include/asm-sh64/dma-mapping.h
include/asm-sh64/io.h
include/asm-sparc/device.h
include/asm-sparc/fcntl.h
include/asm-sparc/floppy.h
include/asm-sparc/irq.h
include/asm-sparc/prom.h
include/asm-sparc64/dma-mapping.h
include/asm-sparc64/fbio.h
include/asm-sparc64/fcntl.h
include/asm-sparc64/floppy.h
include/asm-sparc64/iommu.h
include/asm-sparc64/oplib.h
include/asm-sparc64/parport.h
include/asm-sparc64/pci.h
include/asm-sparc64/prom.h
include/asm-sparc64/sbus.h
include/asm-sparc64/spitfire.h
include/asm-sparc64/xor.h
include/asm-v850/thread_info.h
include/asm-x86_64/pci.h
include/asm-x86_64/serial.h
include/asm-x86_64/tce.h
include/asm-x86_64/thread_info.h
include/asm-x86_64/uaccess.h
include/asm-xtensa/thread_info.h
include/linux/Kbuild
include/linux/bio.h
include/linux/blkdev.h
include/linux/blktrace_api.h
include/linux/bsg.h
include/linux/clockchips.h
include/linux/compiler.h
include/linux/cpu.h
include/linux/device.h
include/linux/dvb/video.h
include/linux/ethtool.h
include/linux/freezer.h
include/linux/fs.h
include/linux/genhd.h
include/linux/hugetlb.h
include/linux/i2c.h
include/linux/init.h
include/linux/interrupt.h
include/linux/ipv6.h
include/linux/irq.h
include/linux/kdebug.h
include/linux/kernel.h
include/linux/kobject.h
include/linux/lguest.h
include/linux/lguest_bus.h
include/linux/lguest_launcher.h
include/linux/mm.h
include/linux/mmc/core.h
include/linux/mmzone.h
include/linux/mv643xx.h
include/linux/netdevice.h
include/linux/netfilter/Kbuild
include/linux/netfilter/xt_connlimit.h
include/linux/nfs_fs.h
include/linux/notifier.h
include/linux/pci.h
include/linux/pci_ids.h
include/linux/pm.h
include/linux/pnp.h
include/linux/pnpbios.h
include/linux/preempt.h
include/linux/proc_fs.h
include/linux/rcupdate.h
include/linux/reiserfs_fs.h
include/linux/sched.h
include/linux/skbuff.h
include/linux/spi/spi.h
include/linux/spi/spidev.h
include/linux/suspend.h
include/linux/sysctl.h
include/linux/topology.h
include/linux/tty.h
include/linux/usb.h
include/net/af_unix.h
include/net/bluetooth/l2cap.h
include/net/ipv6.h
include/net/netfilter/ipv4/nf_conntrack_ipv4.h
include/net/netfilter/ipv6/nf_conntrack_ipv6.h
include/net/netfilter/nf_conntrack_tuple.h
include/net/netlabel.h
include/net/sctp/sctp.h
include/net/tcp.h
include/scsi/libiscsi.h
include/scsi/libsas.h
include/scsi/scsi_driver.h
include/scsi/sd.h
include/video/tx3912.h [deleted file]
include/xen/page.h
init/Kconfig
init/initramfs.c
ipc/shm.c
kernel/Kconfig.preempt
kernel/auditsc.c
kernel/exit.c
kernel/futex.c
kernel/irq/chip.c
kernel/irq/devres.c
kernel/irq/resend.c
kernel/kmod.c
kernel/kprobes.c
kernel/kthread.c
kernel/lockdep_proc.c
kernel/params.c
kernel/power/Kconfig
kernel/power/Makefile
kernel/power/disk.c
kernel/power/main.c
kernel/power/power.h
kernel/power/snapshot.c
kernel/printk.c
kernel/profile.c
kernel/relay.c
kernel/sched.c
kernel/sched_debug.c
kernel/sched_fair.c
kernel/sched_idletask.c
kernel/sched_rt.c
kernel/sched_stats.h
kernel/signal.c
kernel/sys.c
kernel/sysctl.c
kernel/time/clockevents.c
kernel/time/timer_list.c
kernel/time/timer_stats.c
lib/Kconfig.debug
lib/Makefile
lib/hexdump.c
lib/idr.c
lib/kasprintf.c [new file with mode: 0644]
lib/kobject_uevent.c
lib/lzo/lzo1x_compress.c
lib/vsprintf.c
mm/Kconfig
mm/filemap.c
mm/migrate.c
mm/mmap.c
mm/oom_kill.c
mm/page_alloc.c
mm/slub.c
mm/swapfile.c
mm/vmstat.c
net/8021q/vlan_dev.c
net/9p/conv.c
net/atm/lec.c
net/bluetooth/l2cap.c
net/bluetooth/rfcomm/tty.c
net/bridge/br_device.c
net/bridge/br_if.c
net/bridge/br_input.c
net/core/dev.c
net/core/ethtool.c
net/core/pktgen.c
net/core/rtnetlink.c
net/core/utils.c
net/dccp/ccid.c
net/dccp/feat.c
net/decnet/dn_route.c
net/ieee80211/softmac/ieee80211softmac_wx.c
net/ipv4/af_inet.c
net/ipv4/devinet.c
net/ipv4/ip_options.c
net/ipv4/ip_output.c
net/ipv4/ipconfig.c
net/ipv4/ipvs/ip_vs_ctl.c
net/ipv4/ipvs/ip_vs_xmit.c
net/ipv4/netfilter/ipt_CLUSTERIP.c
net/ipv4/netfilter/ipt_recent.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4.c
net/ipv4/netfilter/nf_conntrack_l3proto_ipv4_compat.c
net/ipv4/netfilter/nf_nat_core.c
net/ipv4/netfilter/nf_nat_rule.c
net/ipv4/netfilter/nf_nat_standalone.c
net/ipv4/raw.c
net/ipv4/route.c
net/ipv4/tcp.c
net/ipv4/tcp_bic.c
net/ipv4/tcp_cubic.c
net/ipv4/tcp_htcp.c
net/ipv4/tcp_illinois.c
net/ipv4/tcp_input.c
net/ipv4/tcp_ipv4.c
net/ipv4/tcp_lp.c
net/ipv4/tcp_vegas.c
net/ipv4/tcp_vegas.h
net/ipv4/tcp_veno.c
net/ipv4/tcp_westwood.c
net/ipv4/tcp_yeah.c
net/ipv6/addrconf.c
net/ipv6/addrconf_core.c
net/ipv6/af_inet6.c
net/ipv6/ip6_tunnel.c
net/ipv6/netfilter/nf_conntrack_l3proto_ipv6.c
net/ipv6/route.c
net/ipv6/tcp_ipv6.c
net/iucv/iucv.c
net/key/af_key.c
net/mac80211/debugfs_netdev.c
net/mac80211/debugfs_sta.c
net/mac80211/ieee80211.c
net/mac80211/ieee80211_ioctl.c
net/netfilter/nf_conntrack_core.c
net/netfilter/nf_conntrack_expect.c
net/netfilter/nf_conntrack_helper.c
net/netfilter/nf_conntrack_netlink.c
net/netfilter/xt_connlimit.c
net/netfilter/xt_u32.c
net/netlabel/netlabel_domainhash.c
net/netlabel/netlabel_user.c
net/rxrpc/ar-connection.c
net/sched/act_police.c
net/sched/sch_api.c
net/sched/sch_ingress.c
net/sched/sch_prio.c
net/sctp/input.c
net/sctp/ipv6.c
net/sctp/sm_make_chunk.c
net/sctp/sm_statefuns.c
net/sctp/socket.c
net/sctp/tsnmap.c
net/sunrpc/auth_gss/auth_gss.c
net/sunrpc/auth_gss/svcauth_gss.c
net/sunrpc/cache.c
net/sunrpc/rpc_pipe.c
net/sunrpc/sched.c
net/sunrpc/svcsock.c
net/tipc/link.c
net/tipc/msg.h
net/tipc/name_table.c
net/tipc/node.c
net/tipc/port.c
net/unix/af_unix.c
net/wanrouter/wanmain.c
net/xfrm/xfrm_policy.c
net/xfrm/xfrm_state.c
net/xfrm/xfrm_user.c
scripts/checkpatch.pl
scripts/mod/modpost.c
security/selinux/hooks.c
security/selinux/netlabel.c
security/selinux/ss/services.c
sound/oss/Kconfig
sound/oss/Makefile
sound/oss/nec_vrc5477.c [deleted file]
sound/pci/bt87x.c
sound/sh/aica.h
sound/soc/pxa/pxa2xx-ac97.c
sound/sparc/cs4231.c

index a232295b99ac87331f375ce17c7e9bba5ea46d58..27c3e839b54e9d81eb32a6cb7f28a1e71c05b8ef 100644 (file)
@@ -7,6 +7,7 @@
 #
 .*
 *.o
+*.o.*
 *.a
 *.s
 *.ko
diff --git a/CREDITS b/CREDITS
index 10c214dc95e764865c23834e9ff2ea4fa2bcde73..832436e1dd91c491fdb81efbda723e071c7084f6 100644 (file)
--- a/CREDITS
+++ b/CREDITS
@@ -966,6 +966,7 @@ N: Pekka Enberg
 E: penberg@cs.helsinki.fi
 W: http://www.cs.helsinki.fi/u/penberg/
 D: Various kernel hacks, fixes, and cleanups.
+D: Slab allocators
 S: Finland
 
 N: David Engebretsen
@@ -1939,8 +1940,8 @@ D: for Menuconfig's lxdialog.
 N: Christoph Lameter
 E: christoph@lameter.com
 D: Digiboard PC/Xe and PC/Xi, Digiboard EPCA
-D: Early protocol filter for bridging code
-D: Bug fixes
+D: NUMA support, Slab allocators, Page migration
+D: Scalability, Time subsystem
 
 N: Paul Laufer
 E: paul@laufernet.com
index 73a8617f1861754198c18c5e7285da95358994fe..cb2b141b1c3e8c2d1cb956d79dc645b8d1dc2ae1 100644 (file)
@@ -45,6 +45,7 @@ o  nfs-utils              1.0.5                   # showmount --version
 o  procps                 3.2.0                   # ps --version
 o  oprofile               0.9                     # oprofiled --version
 o  udev                   081                     # udevinfo -V
+o  grub                   0.93                    # grub --version
 
 Kernel compilation
 ==================
index 805db4b2cba65b65bd966f054c71ca13427f9287..cc7a8c39fb6fbf224483355cd169a2cee0d6a30a 100644 (file)
@@ -26,7 +26,7 @@ Part Ia - Using large dma-coherent buffers
 
 void *
 dma_alloc_coherent(struct device *dev, size_t size,
-                            dma_addr_t *dma_handle, int flag)
+                            dma_addr_t *dma_handle, gfp_t flag)
 void *
 pci_alloc_consistent(struct pci_dev *dev, size_t size,
                             dma_addr_t *dma_handle)
@@ -38,7 +38,7 @@ to make sure to flush the processor's write buffers before telling
 devices to read that memory.)
 
 This routine allocates a region of <size> bytes of consistent memory.
-it also returns a <dma_handle> which may be cast to an unsigned
+It also returns a <dma_handle> which may be cast to an unsigned
 integer the same width as the bus and used as the physical address
 base of the region.
 
@@ -52,21 +52,21 @@ The simplest way to do that is to use the dma_pool calls (see below).
 
 The flag parameter (dma_alloc_coherent only) allows the caller to
 specify the GFP_ flags (see kmalloc) for the allocation (the
-implementation may chose to ignore flags that affect the location of
+implementation may choose to ignore flags that affect the location of
 the returned memory, like GFP_DMA).  For pci_alloc_consistent, you
 must assume GFP_ATOMIC behaviour.
 
 void
-dma_free_coherent(struct device *dev, size_t size, void *cpu_addr
+dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
                           dma_addr_t dma_handle)
 void
-pci_free_consistent(struct pci_dev *dev, size_t size, void *cpu_addr
+pci_free_consistent(struct pci_dev *dev, size_t size, void *cpu_addr,
                           dma_addr_t dma_handle)
 
 Free the region of consistent memory you previously allocated.  dev,
 size and dma_handle must all be the same as those passed into the
 consistent allocate.  cpu_addr must be the virtual address returned by
-the consistent allocate
+the consistent allocate.
 
 
 Part Ib - Using small dma-coherent buffers
@@ -77,9 +77,9 @@ To get this part of the dma_ API, you must #include <linux/dmapool.h>
 Many drivers need lots of small dma-coherent memory regions for DMA
 descriptors or I/O buffers.  Rather than allocating in units of a page
 or more using dma_alloc_coherent(), you can use DMA pools.  These work
-much like a struct kmem_cache, except that they use the dma-coherent allocator
+much like a struct kmem_cache, except that they use the dma-coherent allocator,
 not __get_free_pages().  Also, they understand common hardware constraints
-for alignment, like queue heads needing to be aligned on N byte boundaries.
+for alignment, like queue heads needing to be aligned on N-byte boundaries.
 
 
        struct dma_pool *
@@ -102,15 +102,15 @@ crossing restrictions, pass 0 for alloc; passing 4096 says memory allocated
 from this pool must not cross 4KByte boundaries.
 
 
-       void *dma_pool_alloc(struct dma_pool *pool, int gfp_flags,
+       void *dma_pool_alloc(struct dma_pool *pool, gfp_t gfp_flags,
                        dma_addr_t *dma_handle);
 
-       void *pci_pool_alloc(struct pci_pool *pool, int gfp_flags,
+       void *pci_pool_alloc(struct pci_pool *pool, gfp_t gfp_flags,
                        dma_addr_t *dma_handle);
 
 This allocates memory from the pool; the returned memory will meet the size
 and alignment requirements specified at creation time.  Pass GFP_ATOMIC to
-prevent blocking, or if it's permitted (not in_interrupt, not holding SMP locks)
+prevent blocking, or if it's permitted (not in_interrupt, not holding SMP locks),
 pass GFP_KERNEL to allow blocking.  Like dma_alloc_coherent(), this returns
 two values:  an address usable by the cpu, and the dma address usable by the
 pool's device.
@@ -123,7 +123,7 @@ pool's device.
                        dma_addr_t addr);
 
 This puts memory back into the pool.  The pool is what was passed to
-the pool allocation routine; the cpu and dma addresses are what
+the pool allocation routine; the cpu (vaddr) and dma addresses are what
 were returned when that routine allocated the memory being freed.
 
 
@@ -209,18 +209,18 @@ Notes:  Not all memory regions in a machine can be mapped by this
 API.  Further, regions that appear to be physically contiguous in
 kernel virtual space may not be contiguous as physical memory.  Since
 this API does not provide any scatter/gather capability, it will fail
-if the user tries to map a non physically contiguous piece of memory.
+if the user tries to map a non-physically contiguous piece of memory.
 For this reason, it is recommended that memory mapped by this API be
-obtained only from sources which guarantee to be physically contiguous
+obtained only from sources which guarantee it to be physically contiguous
 (like kmalloc).
 
 Further, the physical address of the memory must be within the
 dma_mask of the device (the dma_mask represents a bit mask of the
-addressable region for the device.  i.e. if the physical address of
+addressable region for the device.  I.e., if the physical address of
 the memory anded with the dma_mask is still equal to the physical
 address, then the device can perform DMA to the memory).  In order to
 ensure that the memory allocated by kmalloc is within the dma_mask,
-the driver may specify various platform dependent flags to restrict
+the driver may specify various platform-dependent flags to restrict
 the physical memory range of the allocation (e.g. on x86, GFP_DMA
 guarantees to be within the first 16Mb of available physical memory,
 as required by ISA devices).
@@ -244,14 +244,14 @@ are guaranteed also to be cache line boundaries).
 
 DMA_TO_DEVICE synchronisation must be done after the last modification
 of the memory region by the software and before it is handed off to
-the driver.  Once this primitive is used.  Memory covered by this
-primitive should be treated as read only by the device.  If the device
+the driver.  Once this primitive is used, memory covered by this
+primitive should be treated as read-only by the device.  If the device
 may write to it at any point, it should be DMA_BIDIRECTIONAL (see
 below).
 
 DMA_FROM_DEVICE synchronisation must be done before the driver
 accesses data that may be changed by the device.  This memory should
-be treated as read only by the driver.  If the driver needs to write
+be treated as read-only by the driver.  If the driver needs to write
 to it at any point, it should be DMA_BIDIRECTIONAL (see below).
 
 DMA_BIDIRECTIONAL requires special handling: it means that the driver
@@ -261,7 +261,7 @@ you must always sync bidirectional memory twice: once before the
 memory is handed off to the device (to make sure all memory changes
 are flushed from the processor) and once before the data may be
 accessed after being used by the device (to make sure any processor
-cache lines are updated with data that the device may have changed.
+cache lines are updated with data that the device may have changed).
 
 void
 dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
@@ -302,8 +302,8 @@ pci_dma_mapping_error(dma_addr_t dma_addr)
 
 In some circumstances dma_map_single and dma_map_page will fail to create
 a mapping. A driver can check for these errors by testing the returned
-dma address with dma_mapping_error(). A non zero return value means the mapping
-could not be created and the driver should take appropriate action (eg
+dma address with dma_mapping_error(). A non-zero return value means the mapping
+could not be created and the driver should take appropriate action (e.g.
 reduce current DMA mapping usage or delay and try again later).
 
        int
@@ -315,7 +315,7 @@ reduce current DMA mapping usage or delay and try again later).
 
 Maps a scatter gather list from the block layer.
 
-Returns: the number of physical segments mapped (this may be shorted
+Returns: the number of physical segments mapped (this may be shorter
 than <nents> passed in if the block layer determines that some
 elements of the scatter/gather list are physically adjacent and thus
 may be mapped with a single entry).
@@ -357,7 +357,7 @@ accessed sg->address and sg->length as shown above.
        pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg,
                int nents, int direction)
 
-unmap the previously mapped scatter/gather list.  All the parameters
+Unmap the previously mapped scatter/gather list.  All the parameters
 must be the same as those and passed in to the scatter/gather mapping
 API.
 
@@ -377,7 +377,7 @@ void
 pci_dma_sync_sg(struct pci_dev *hwdev, struct scatterlist *sg,
                       int nelems, int direction)
 
-synchronise a single contiguous or scatter/gather mapping.  All the
+Synchronise a single contiguous or scatter/gather mapping.  All the
 parameters must be the same as those passed into the single mapping
 API.
 
@@ -406,7 +406,7 @@ API at all.
 
 void *
 dma_alloc_noncoherent(struct device *dev, size_t size,
-                              dma_addr_t *dma_handle, int flag)
+                              dma_addr_t *dma_handle, gfp_t flag)
 
 Identical to dma_alloc_coherent() except that the platform will
 choose to return either consistent or non-consistent memory as it sees
@@ -426,34 +426,34 @@ void
 dma_free_noncoherent(struct device *dev, size_t size, void *cpu_addr,
                              dma_addr_t dma_handle)
 
-free memory allocated by the nonconsistent API.  All parameters must
+Free memory allocated by the nonconsistent API.  All parameters must
 be identical to those passed in (and returned by
 dma_alloc_noncoherent()).
 
 int
 dma_is_consistent(struct device *dev, dma_addr_t dma_handle)
 
-returns true if the device dev is performing consistent DMA on the memory
+Returns true if the device dev is performing consistent DMA on the memory
 area pointed to by the dma_handle.
 
 int
 dma_get_cache_alignment(void)
 
-returns the processor cache alignment.  This is the absolute minimum
+Returns the processor cache alignment.  This is the absolute minimum
 alignment *and* width that you must observe when either mapping
 memory or doing partial flushes.
 
 Notes: This API may return a number *larger* than the actual cache
 line, but it will guarantee that one or more cache lines fit exactly
 into the width returned by this call.  It will also always be a power
-of two for easy alignment
+of two for easy alignment.
 
 void
 dma_sync_single_range(struct device *dev, dma_addr_t dma_handle,
                      unsigned long offset, size_t size,
                      enum dma_data_direction direction)
 
-does a partial sync.  starting at offset and continuing for size.  You
+Does a partial sync, starting at offset and continuing for size.  You
 must be careful to observe the cache alignment and width when doing
 anything like this.  You must also be extra careful about accessing
 memory you intend to sync partially.
@@ -472,21 +472,20 @@ dma_declare_coherent_memory(struct device *dev, dma_addr_t bus_addr,
                            dma_addr_t device_addr, size_t size, int
                            flags)
 
-
 Declare region of memory to be handed out by dma_alloc_coherent when
 it's asked for coherent memory for this device.
 
 bus_addr is the physical address to which the memory is currently
 assigned in the bus responding region (this will be used by the
-platform to perform the mapping)
+platform to perform the mapping).
 
 device_addr is the physical address the device needs to be programmed
 with actually to address this memory (this will be handed out as the
-dma_addr_t in dma_alloc_coherent())
+dma_addr_t in dma_alloc_coherent()).
 
 size is the size of the area (must be multiples of PAGE_SIZE).
 
-flags can be or'd together and are
+flags can be or'd together and are:
 
 DMA_MEMORY_MAP - request that the memory returned from
 dma_alloc_coherent() be directly writable.
@@ -494,7 +493,7 @@ dma_alloc_coherent() be directly writable.
 DMA_MEMORY_IO - request that the memory returned from
 dma_alloc_coherent() be addressable using read/write/memcpy_toio etc.
 
-One or both of these flags must be present
+One or both of these flags must be present.
 
 DMA_MEMORY_INCLUDES_CHILDREN - make the declared memory be allocated by
 dma_alloc_coherent of any child devices of this one (for memory residing
@@ -528,7 +527,7 @@ dma_release_declared_memory(struct device *dev)
 Remove the memory region previously declared from the system.  This
 API performs *no* in-use checking for this region and will return
 unconditionally having removed all the required structures.  It is the
-drivers job to ensure that no parts of this memory region are
+driver's job to ensure that no parts of this memory region are
 currently in use.
 
 void *
@@ -538,12 +537,10 @@ dma_mark_declared_memory_occupied(struct device *dev,
 This is used to occupy specific regions of the declared space
 (dma_alloc_coherent() will hand out the first free region it finds).
 
-device_addr is the *device* address of the region requested
+device_addr is the *device* address of the region requested.
 
-size is the size (and should be a page sized multiple).
+size is the size (and should be a page-sized multiple).
 
 The return value will be either a pointer to the processor virtual
 address of the memory, or an error (via PTR_ERR()) if any part of the
 region is occupied.
-
-
index eb42bf9847cb97e388cbebbeb35ef7ec428e85cc..b886f52a9aac8f48212a50ff3079f382e4735f68 100644 (file)
@@ -380,7 +380,6 @@ X!Edrivers/base/interface.c
 !Edrivers/base/bus.c
      </sect1>
      <sect1><title>Device Drivers Power Management</title>
-!Edrivers/base/power/main.c
 !Edrivers/base/power/resume.c
 !Edrivers/base/power/suspend.c
      </sect1>
@@ -398,12 +397,12 @@ X!Edrivers/acpi/pci_bind.c
 -->
      </sect1>
      <sect1><title>Device drivers PnP support</title>
-!Edrivers/pnp/core.c
+!Idrivers/pnp/core.c
 <!-- No correct structured comments
 X!Edrivers/pnp/system.c
  -->
 !Edrivers/pnp/card.c
-!Edrivers/pnp/driver.c
+!Idrivers/pnp/driver.c
 !Edrivers/pnp/manager.c
 !Edrivers/pnp/support.c
      </sect1>
@@ -704,14 +703,22 @@ X!Idrivers/video/console/fonts.c
 
   <chapter id="splice">
       <title>splice API</title>
-  <para>)
+  <para>
        splice is a method for moving blocks of data around inside the
-       kernel, without continually transferring it between the kernel
+       kernel, without continually transferring them between the kernel
        and user space.
   </para>
-!Iinclude/linux/splice.h
 !Ffs/splice.c
   </chapter>
 
+  <chapter id="pipes">
+      <title>pipes API</title>
+  <para>
+       Pipe interfaces are all for in-kernel (builtin image) use.
+       They are not exported for use by modules.
+  </para>
+!Iinclude/linux/pipe_fs_i.h
+!Ffs/pipe.c
+  </chapter>
 
 </book>
index e3bb29a8d8dd89f60f6bd2f83771a06111ea64cd..c119484258b8428d59b07b3046a5c5d48def9519 100644 (file)
@@ -133,10 +133,6 @@ interested in translating it, please email me
        <para>updates of your driver can take place without recompiling
        the kernel.</para>
 </listitem>
-<listitem>
-       <para>if you need to keep some parts of your driver closed source,
-       you can do so without violating the GPL license on the kernel.</para>
-</listitem>
 </itemizedlist>
 
 <sect1 id="how_uio_works">
index 595a5ea4c690340294de4fde47a57ece245fec59..7b9551fc6fe3ffdea3523b1571da44748059d312 100644 (file)
@@ -18,6 +18,7 @@
 *.moc
 *.mod.c
 *.o
+*.o.*
 *.orig
 *.out
 *.pdf
@@ -163,6 +164,8 @@ raid6tables.c
 relocs
 series
 setup
+setup.bin
+setup.elf
 sim710_d.h*
 sImage
 sm_tbl*
index 2bf6c2321c2d0d181e87ae7238caa703aafd5b21..36bdeff585e2d12ffe84f6ef25b3d38ea874fac3 100644 (file)
@@ -9,14 +9,13 @@ one found in the Dreamcast.
 Advantages:
 
  * It provides a nice large console (128 cols + 48 lines with 1024x768)
-   without using tiny, unreadable fonts.
+   without using tiny, unreadable fonts (NOT on the Dreamcast)
  * You can run XF86_FBDev on top of /dev/fb0
  * Most important: boot logo :-)
 
 Disadvantages:
 
- * Driver is currently limited to the Dreamcast PowerVR 2 implementation
-   at the time of this writing.
+ * Driver is largely untested on non-Dreamcast systems.
 
 Configuration
 =============
@@ -29,11 +28,16 @@ Accepted options:
 font:X    - default font to use. All fonts are supported, including the
             SUN12x22 font which is very nice at high resolutions.
 
-mode:X    - default video mode. The following video modes are supported:
-            640x240-60, 640x480-60.
            
+mode:X    - default video mode with format [xres]x[yres]-<bpp>@<refresh rate>
+            The following video modes are supported:
+            640x640-16@60, 640x480-24@60, 640x480-32@60. The Dreamcast
+            defaults to 640x480-16@60. At the time of writing the
+            24bpp and 32bpp modes function poorly. Work to fix that is
+            ongoing
+
             Note: the 640x240 mode is currently broken, and should not be
-            used for any reason. It is only mentioned as a reference.
+            used for any reason. It is only mentioned here as a reference.
 
 inverse   - invert colors on screen (for LCD displays)
 
@@ -52,10 +56,10 @@ output:X  - output type. This can be any of the following: pal, ntsc, and
 X11
 ===
 
-XF86_FBDev should work, in theory. At the time of this writing it is
-totally untested and may or may not even portray the beginnings of
-working. If you end up testing this, please let me know!
+XF86_FBDev has been shown to work on the Dreamcast in the past - though not yet
+on any 2.6 series kernel.
 
 --
 Paul Mundt <lethal@linuxdc.org>
+Updated by Adrian McMenamin <adrian@mcmen.demon.co.uk>
 
index c175eedadb5fb358f589d93da61720e9453b73ad..a43d2878a4efd7a7d0fbe8d50d324c3fcaf75416 100644 (file)
@@ -211,22 +211,6 @@ Who:       Richard Purdie <rpurdie@rpsys.net>
 
 ---------------------------
 
-What:  read_dev_chars(), read_conf_data{,_lpm}() (s390 common I/O layer)
-When:  December 2007
-Why:   These functions are a leftover from 2.4 times. They have several
-       problems:
-       - Duplication of checks that are done in the device driver's
-         interrupt handler
-       - common I/O layer can't do device specific error recovery
-       - device driver can't be notified for conditions happening during
-         execution of the function
-       Device drivers should issue the read device characteristics and read
-       configuration data ccws and do the appropriate error handling
-       themselves.
-Who:   Cornelia Huck <cornelia.huck@de.ibm.com>
-
----------------------------
-
 What:  i2c-ixp2000, i2c-ixp4xx and scx200_i2c drivers
 When:  September 2007
 Why:   Obsolete. The new i2c-gpio driver replaces all hardware-specific
diff --git a/Documentation/filesystems/hfsplus.txt b/Documentation/filesystems/hfsplus.txt
new file mode 100644 (file)
index 0000000..af1628a
--- /dev/null
@@ -0,0 +1,59 @@
+
+Macintosh HFSPlus Filesystem for Linux
+======================================
+
+HFSPlus is a filesystem first introduced in MacOS 8.1.
+HFSPlus has several extensions to HFS, including 32-bit allocation
+blocks, 255-character unicode filenames, and file sizes of 2^63 bytes.
+
+
+Mount options
+=============
+
+When mounting an HFSPlus filesystem, the following options are accepted:
+
+  creator=cccc, type=cccc
+       Specifies the creator/type values as shown by the MacOS finder
+       used for creating new files.  Default values: '????'.
+
+  uid=n, gid=n
+       Specifies the user/group that owns all files on the filesystem
+       that have uninitialized permissions structures.
+       Default:  user/group id of the mounting process.
+
+  umask=n
+       Specifies the umask (in octal) used for files and directories
+       that have uninitialized permissions structures.
+       Default:  umask of the mounting process.
+
+  session=n
+       Select the CDROM session to mount as HFSPlus filesystem.  Defaults to
+       leaving that decision to the CDROM driver.  This option will fail
+       with anything but a CDROM as underlying devices.
+
+  part=n
+       Select partition number n from the devices.  This option only makes
+       sense for CDROMs because they can't be partitioned under Linux.
+       For disk devices the generic partition parsing code does this
+       for us.  Defaults to not parsing the partition table at all.
+
+  decompose
+       Decompose file name characters.
+
+  nodecompose
+       Do not decompose file name characters.
+
+  force
+       Used to force write access to volumes that are marked as journalled
+       or locked.  Use at your own risk.
+
+  nls=cccc
+       Encoding to use when presenting file names.
+
+
+References
+==========
+
+kernel source:         <file:fs/hfsplus>
+
+Apple Technote 1150    http://developer.apple.com/technotes/tn/tn1150.html
index b7a3dc38dd524777f67bd185c1fabcf867015326..6ad52d9dad6cab36b4fac984aa3f39b3aba073fe 100644 (file)
@@ -5,7 +5,7 @@ for the 8254 and Real Time Clock (RTC) periodic timer functionality.
 Each HPET can have up to 32 timers.  It is possible to configure the
 first two timers as legacy replacements for 8254 and RTC periodic timers.
 A specification done by Intel and Microsoft can be found at
-<http://www.intel.com/hardwaredesign/hpetspec.htm>.
+<http://www.intel.com/technology/architecture/hpetspec.htm>.
 
 The driver supports detection of HPET driver allocation and initialization
 of the HPET before the driver module_init routine is called.  This enables
index 130a38382b989771c33e9f8492eaca8f48f74f3d..be92a77da1d5116d9e828903a61f58fffc1feea3 100644 (file)
@@ -6,13 +6,13 @@ Supported chips:
     Prefix: 'adm1030'
     Addresses scanned: I2C 0x2c to 0x2e
     Datasheet: Publicly available at the Analog Devices website
-               http://products.analog.com/products/info.asp?product=ADM1030
+               http://www.analog.com/en/prod/0%2C2877%2CADM1030%2C00.html
 
   * Analog Devices ADM1031
     Prefix: 'adm1031'
     Addresses scanned: I2C 0x2c to 0x2e
     Datasheet: Publicly available at the Analog Devices website
-               http://products.analog.com/products/info.asp?product=ADM1031
+               http://www.analog.com/en/prod/0%2C2877%2CADM1031%2C00.html
 
 Authors:
         Alexandre d'Alton <alex@alexdalton.org>
diff --git a/Documentation/hwmon/thmc50 b/Documentation/hwmon/thmc50
new file mode 100644 (file)
index 0000000..9639ca9
--- /dev/null
@@ -0,0 +1,74 @@
+Kernel driver thmc50
+=====================
+
+Supported chips:
+  * Analog Devices ADM1022
+    Prefix: 'adm1022'
+    Addresses scanned: I2C 0x2c - 0x2e
+    Datasheet: http://www.analog.com/en/prod/0,2877,ADM1022,00.html
+  * Texas Instruments THMC50
+    Prefix: 'thmc50'
+    Addresses scanned: I2C 0x2c - 0x2e
+    Datasheet: http://focus.ti.com/docs/prod/folders/print/thmc50.html
+
+Author: Krzysztof Helt <krzysztof.h1@wp.pl>
+
+This driver was derived from the 2.4 kernel thmc50.c source file.
+
+Credits:
+  thmc50.c (2.4 kernel):
+       Frodo Looijaard <frodol@dds.nl>
+       Philip Edelbrock <phil@netroedge.com>
+
+Module Parameters
+-----------------
+
+* adm1022_temp3: short array
+  List of adapter,address pairs to force chips into ADM1022 mode with
+  second remote temperature. This does not work for original THMC50 chips.
+
+Description
+-----------
+
+The THMC50 implements: an internal temperature sensor, support for an
+external diode-type temperature sensor (compatible w/ the diode sensor inside
+many processors), and a controllable fan/analog_out DAC. For the temperature
+sensors, limits can be set through the appropriate Overtemperature Shutdown
+register and Hysteresis register. Each value can be set and read to half-degree
+accuracy.  An alarm is issued (usually to a connected LM78) when the
+temperature gets higher then the Overtemperature Shutdown value; it stays on
+until the temperature falls below the Hysteresis value. All temperatures are in
+degrees Celsius, and are guaranteed within a range of -55 to +125 degrees.
+
+The THMC50 only updates its values each 1.5 seconds; reading it more often
+will do no harm, but will return 'old' values.
+
+The THMC50 is usually used in combination with LM78-like chips, to measure
+the temperature of the processor(s).
+
+The ADM1022 works the same as THMC50 but it is faster (5 Hz instead of
+1 Hz for THMC50). It can be also put in a new mode to handle additional
+remote temperature sensor. The driver use the mode set by BIOS by default.
+
+In case the BIOS is broken and the mode is set incorrectly, you can force
+the mode with additional remote temperature with adm1022_temp3 parameter.
+A typical symptom of wrong setting is a fan forced to full speed.
+
+Driver Features
+---------------
+
+The driver provides up to three temperatures:
+
+temp1          -- internal
+temp2          -- remote
+temp3          -- 2nd remote only for ADM1022
+
+pwm1           -- fan speed (0 = stop, 255 = full)
+pwm1_mode      -- always 0 (DC mode)
+
+The value of 0 for pwm1 also forces FAN_OFF signal from the chip,
+so it stops fans even if the value 0 into the ANALOG_OUT register does not.
+
+The driver was tested on Compaq AP550 with two ADM1022 chips (one works
+in the temp3 mode), five temperature readings and two fans.
+
index 75b3680c41eb835e751a242191f2439914166152..6c0817c45683fd07f6367c8234d419a4e824ee48 100644 (file)
@@ -1,3 +1,13 @@
+---------------------------------------------------------------------------
+!!!!!!!!!!!!!!!WARNING!!!!!!!!
+The zero page is a kernel internal data structure, not a stable ABI.  It might change
+without warning and the kernel has no way to detect old version of it.
+If you're writing some external code like a boot loader you should only use
+the stable versioned real mode boot protocol described in boot.txt. Otherwise the kernel
+might break you at any time.
+!!!!!!!!!!!!!WARNING!!!!!!!!!!!
+----------------------------------------------------------------------------
+
 Summary of boot_params layout (kernel point of view)
      ( collected by Hans Lermen and Martin Mares )
  
index b2446a090870ea9ecb694b622bd66d20feeac98e..9f08dab1e75be0d2ea0b39315c82fdc7023e60d5 100644 (file)
@@ -1,23 +1,24 @@
-NOTE:
-This is Japanese translated version of "Documentation/HOWTO".
-This one is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com>
-and JF Project team <www.linux.or.jp/JF>.
-If you find difference with original file or problem in translation,
-please contact maintainer of this file or JF project.
-
-Please also note that purpose of this file is easier to read for non
-English natives and not to be intended to fork. So, if you have any
-comments or updates of this file, please try to update Original(English)
-file at first.
-
-Last Updated: 2007/06/04
+NOTE:
+This is a version of Documentation/HOWTO translated into Japanese.
+This document is maintained by Tsugikazu Shibata <tshibata@ab.jp.nec.com>
+and the JF Project team <www.linux.or.jp/JF>.
+If you find any difference between this document and the original file
+or a problem with the translation,
+please contact the maintainer of this file or JF project.
+
+Please also note that the purpose of this file is to be easier to read
+for non English (read: Japanese) speakers and is not intended as a
+fork. So if you have any comments or updates for this file, please try
+to update the original English file first.
+
+Last Updated: 2007/07/18
 ==================================
 これは、
-linux-2.6.21/Documentation/HOWTO
+linux-2.6.22/Documentation/HOWTO
 の和訳です。
 
 翻訳団体: JF プロジェクト < http://www.linux.or.jp/JF/ >
-翻訳日: 2007/06/04
+翻訳日: 2007/07/16
 翻訳者: Tsugikazu Shibata <tshibata at ab dot jp dot nec dot com>
 校正者: 松倉さん <nbh--mats at nifty dot com>
          小林 雅典さん (Masanori Kobayasi) <zap03216 at nifty dot ne dot jp>
@@ -52,6 +53,7 @@ Linux カーネル開発コミュニティと共に活動するやり方を学
 また、このコミュニティがなぜ今うまくまわっているのかという理由の一部も
 説明しようと試みています。
 
+
 カーネルは 少量のアーキテクチャ依存部分がアセンブリ言語で書かれている
 以外は大部分は C 言語で書かれています。C言語をよく理解していることはカー
 ネル開発者には必要です。アーキテクチャ向けの低レベル部分の開発をするの
@@ -141,6 +143,7 @@ Linux カーネルソースツリーは幅広い範囲のドキュメントを
      これらのルールに従えばうまくいくことを保証することではありません
      が (すべてのパッチは内容とスタイルについて精査を受けるので)、
      ルールに従わなければ間違いなくうまくいかないでしょう。
+
      この他にパッチを作る方法についてのよくできた記述は-
 
        "The Perfect Patch"
@@ -360,44 +363,42 @@ linux-kernel メーリングリストで収集された多数のパッチと同
 
   git ツリー-
     - Kbuild の開発ツリー、Sam Ravnborg <sam@ravnborg.org>
-       kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
+       git.kernel.org:/pub/scm/linux/kernel/git/sam/kbuild.git
 
     - ACPI の開発ツリー、 Len Brown <len.brown@intel.com>
-       kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
+       git.kernel.org:/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6.git
 
     - Block の開発ツリー、Jens Axboe <axboe@suse.de>
-       kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
+       git.kernel.org:/pub/scm/linux/kernel/git/axboe/linux-2.6-block.git
 
     - DRM の開発ツリー、Dave Airlie <airlied@linux.ie>
-       kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
+       git.kernel.org:/pub/scm/linux/kernel/git/airlied/drm-2.6.git
 
     - ia64 の開発ツリー、Tony Luck <tony.luck@intel.com>
-       kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
-
-    - ieee1394 の開発ツリー、Jody McIntyre <scjody@modernduck.com>
-       kernel.org:/pub/scm/linux/kernel/git/scjody/ieee1394.git
+       git.kernel.org:/pub/scm/linux/kernel/git/aegl/linux-2.6.git
 
     - infiniband, Roland Dreier <rolandd@cisco.com>
-       kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
+       git.kernel.org:/pub/scm/linux/kernel/git/roland/infiniband.git
 
     - libata, Jeff Garzik <jgarzik@pobox.com>
-       kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
+       git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/libata-dev.git
 
     - ネットワークドライバ, Jeff Garzik <jgarzik@pobox.com>
-       kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
+       git.kernel.org:/pub/scm/linux/kernel/git/jgarzik/netdev-2.6.git
 
     - pcmcia, Dominik Brodowski <linux@dominikbrodowski.net>
-       kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
+       git.kernel.org:/pub/scm/linux/kernel/git/brodo/pcmcia-2.6.git
 
     - SCSI, James Bottomley <James.Bottomley@SteelEye.com>
-       kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
-
-  その他の git カーネルツリーは http://kernel.org/git に一覧表がありま
-  す。
+       git.kernel.org:/pub/scm/linux/kernel/git/jejb/scsi-misc-2.6.git
 
   quilt ツリー-
     - USB, PCI ドライバコアと I2C, Greg Kroah-Hartman <gregkh@suse.de>
        kernel.org/pub/linux/kernel/people/gregkh/gregkh-2.6/
+    - x86-64 と i386 の仲間 Andi Kleen <ak@suse.de>
+
+  その他のカーネルツリーは http://git.kernel.org/ と MAINTAINERS ファ
+  イルに一覧表があります。
 
 バグレポート
 -------------
@@ -508,6 +509,7 @@ MAINTAINERS ファイルにリストがありますので参照してくださ
 せん*。単に自分のパッチに対して指摘された問題を全て修正して再送すれば
 いいのです。
 
+
 カーネルコミュニティと企業組織のちがい
 -----------------------------------------------------------------
 
@@ -577,6 +579,7 @@ Linux カーネルコミュニティは、一度に大量のコードの塊を
    かし、500行のパッチは、正しいことをレビューするのに数時間かかるかも
    しれません(時間はパッチのサイズなどにより指数関数に比例してかかりま
    す)
+
    小さいパッチは何かあったときにデバッグもとても簡単になります。パッ
    チを1個1個取り除くのは、とても大きなパッチを当てた後に(かつ、何かお
    かしくなった後で)解剖するのに比べればとても簡単です。
@@ -591,6 +594,7 @@ Linux カーネルコミュニティは、一度に大量のコードの塊を
         う。先生は簡潔な最高の解をみたいのです。良い生徒はこれを知って
         おり、そして最終解の前の中間作業を提出することは決してないので
         す"
+
         カーネル開発でもこれは同じです。メンテナー達とレビューア達は、
         問題を解決する解の背後になる思考プロセスをみたいとは思いません。
         彼らは単純であざやかな解決方法をみたいのです。
index b3f2b27f0881869178b7052749758ca121a88335..7653b5cbfed2bfcf8db4f95d0d738968647f2a45 100644 (file)
@@ -1,17 +1,17 @@
 NOTE:
-This is a Japanese translated version of
-"Documentation/stable_api_nonsense.txt".
-This one is maintained by
-IKEDA, Munehiro <m-ikeda@ds.jp.nec.com>
-and JF Project team <http://www.linux.or.jp/JF/>.
-If you find difference with original file or problem in translation,
+This is a version of Documentation/stable_api_nonsense.txt into Japanese.
+This document is maintained by IKEDA, Munehiro <m-ikeda@ds.jp.nec.com>
+and the JF Project team <http://www.linux.or.jp/JF/>.
+If you find any difference between this document and the original file
+or a problem with the translation,
 please contact the maintainer of this file or JF project.
 
-Please also note that purpose of this file is easier to read for non
-English natives and not to be intended to fork. So, if you have any
-comments or updates of this file, please try to update
-Original(English) file at first.
+Please also note that the purpose of this file is to be easier to read
+for non English (read: Japanese) speakers and is not intended as a
+fork. So if you have any comments or updates of this file, please try
+to update the original English file first.
 
+Last Updated: 2007/07/18
 ==================================
 これは、
 linux-2.6.22-rc4/Documentation/stable_api_nonsense.txt の和訳
index 536d5bfbdb8d390fa412d6e0b200ac980ecebecd..fe8b0c4892cf14e6f39e255ac368f150c41647c8 100644 (file)
@@ -98,6 +98,15 @@ applicable everywhere (see syntax).
   times, the limit is set to the largest selection.
   Reverse dependencies can only be used with boolean or tristate
   symbols.
+  Note:
+       select is evil.... select will by brute force set a symbol
+       equal to 'y' without visiting the dependencies. So abusing
+       select you are able to select a symbol FOO even if FOO depends
+       on BAR that is not set. In general use select only for
+       non-visible symbols (no promts anywhere) and for symbols with
+       no dependencies. That will limit the usefulness but on the
+       other hand avoid the illegal configurations all over. kconfig
+       should one day warn about such things.
 
 - numerical ranges: "range" <symbol> <symbol> ["if" <expr>]
   This allows to limit the range of possible input values for int
index fb80e9ffea68b7a0f8d1bbcd0229957276cfe747..975f029be25cb991e02ac9d310a15cd767ad2d29 100644 (file)
@@ -30,6 +30,7 @@ the beginning of each description states the restrictions within which a
 parameter is applicable:
 
        ACPI    ACPI support is enabled.
+       AGP     AGP (Accelerated Graphics Port) is enabled.
        ALSA    ALSA sound support is enabled.
        APIC    APIC support is enabled.
        APM     Advanced Power Management support is enabled.
@@ -40,7 +41,6 @@ parameter is applicable:
        EIDE    EIDE/ATAPI support is enabled.
        FB      The frame buffer device is enabled.
        HW      Appropriate hardware is enabled.
-       IA-32   IA-32 aka i386 architecture is enabled.
        IA-64   IA-64 architecture is enabled.
        IOSCHED More than one I/O scheduler is enabled.
        IP_PNP  IP DHCP, BOOTP, or RARP is enabled.
@@ -57,14 +57,14 @@ parameter is applicable:
        MDA     MDA console support is enabled.
        MOUSE   Appropriate mouse support is enabled.
        MSI     Message Signaled Interrupts (PCI).
-       MTD     MTD support is enabled.
+       MTD     MTD (Memory Technology Device) support is enabled.
        NET     Appropriate network support is enabled.
        NUMA    NUMA support is enabled.
        GENERIC_TIME The generic timeofday code is enabled.
        NFS     Appropriate NFS support is enabled.
        OSS     OSS sound support is enabled.
-       PV_OPS  A paravirtualized kernel
-       PARIDE  The ParIDE subsystem is enabled.
+       PV_OPS  A paravirtualized kernel is enabled.
+       PARIDE  The ParIDE (parallel port IDE) subsystem is enabled.
        PARISC  The PA-RISC architecture is enabled.
        PCI     PCI bus support is enabled.
        PCMCIA  The PCMCIA subsystem is enabled.
@@ -91,6 +91,7 @@ parameter is applicable:
        VT      Virtual terminal support is enabled.
        WDT     Watchdog support is enabled.
        XT      IBM PC/XT MFM hard disk support is enabled.
+       X86-32  X86-32, aka i386 architecture is enabled.
        X86-64  X86-64 architecture is enabled.
                        More X86-64 boot options can be found in
                        Documentation/x86_64/boot-options.txt .
@@ -122,10 +123,6 @@ and is between 256 and 4096 characters. It is defined in the file
 ./include/asm/setup.h as COMMAND_LINE_SIZE.
 
 
-       53c7xx=         [HW,SCSI] Amiga SCSI controllers
-                       See header of drivers/scsi/53c7xx.c.
-                       See also Documentation/scsi/ncr53c7xx.txt.
-
        acpi=           [HW,ACPI,X86-64,i386]
                        Advanced Configuration and Power Interface
                        Format: { force | off | ht | strict | noirq }
@@ -166,6 +163,8 @@ and is between 256 and 4096 characters. It is defined in the file
        acpi_irq_isa=   [HW,ACPI] If irq_balance, mark listed IRQs used by ISA
                        Format: <irq>,<irq>...
 
+       acpi_no_auto_ssdt       [HW,ACPI] Disable automatic loading of SSDT
+
        acpi_os_name=   [HW,ACPI] Tell ACPI BIOS the name of the OS
                        Format: To spoof as Windows 98: ="Microsoft Windows"
 
@@ -222,11 +221,17 @@ and is between 256 and 4096 characters. It is defined in the file
 
        acpi_fake_ecdt  [HW,ACPI] Workaround failure due to BIOS lacking ECDT
 
-       acpi_pm_good    [IA-32,X86-64]
+       acpi_pm_good    [X86-32,X86-64]
                        Override the pmtimer bug detection: force the kernel
                        to assume that this machine's pmtimer latches its value
                        and always returns good values.
 
+       agp=            [AGP]
+                       { off | try_unsupported }
+                       off: disable AGP support
+                       try_unsupported: try to drive unsupported chipsets
+                               (may crash computer or cause data corruption)
+
        enable_timer_pin_1 [i386,x86-64]
                        Enable PIN 1 of APIC timer
                        Can be useful to work around chipset bugs
@@ -279,7 +284,8 @@ and is between 256 and 4096 characters. It is defined in the file
                        not play well with APC CPU idle - disable it if you have
                        APC and your system crashes randomly.
 
-       apic=           [APIC,i386] Change the output verbosity whilst booting
+       apic=           [APIC,i386] Advanced Programmable Interrupt Controller
+                       Change the output verbosity whilst booting
                        Format: { quiet (default) | verbose | debug }
                        Change the amount of debugging information output
                        when initialising the APIC and IO-APIC components.
@@ -353,7 +359,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
        c101=           [NET] Moxa C101 synchronous serial card
 
-       cachesize=      [BUGS=IA-32] Override level 2 CPU cache size detection.
+       cachesize=      [BUGS=X86-32] Override level 2 CPU cache size detection.
                        Sometimes CPU hardware bugs make them report the cache
                        size incorrectly. The kernel will attempt work arounds
                        to fix known problems, but for some CPUs it is not
@@ -372,7 +378,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        Value can be changed at runtime via
                                /selinux/checkreqprot.
 
-       clock=          [BUGS=IA-32, HW] gettimeofday clocksource override.
+       clock=          [BUGS=X86-32, HW] gettimeofday clocksource override.
                        [Deprecated]
                        Forces specified clocksource (if available) to be used
                        when calculating gettimeofday(). If specified
@@ -390,7 +396,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        [ARM] imx_timer1,OSTS,netx_timer,mpu_timer2,
                                pxa_timer,timer3,32k_counter,timer0_1
                        [AVR32] avr32
-                       [IA-32] pit,hpet,tsc,vmi-timer;
+                       [X86-32] pit,hpet,tsc,vmi-timer;
                                scx200_hrt on Geode; cyclone on IBM x440
                        [MIPS] MIPS
                        [PARISC] cr16
@@ -410,7 +416,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        over the 8254 in addition to over the IO-APIC. The
                        kernel tries to set a sensible default.
 
-       hpet=           [IA-32,HPET] option to disable HPET and use PIT.
+       hpet=           [X86-32,HPET] option to disable HPET and use PIT.
                        Format: disable
 
        com20020=       [HW,NET] ARCnet - COM20020 chipset
@@ -547,7 +553,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
        dtc3181e=       [HW,SCSI]
 
-       earlyprintk=    [IA-32,X86-64,SH]
+       earlyprintk=    [X86-32,X86-64,SH]
                        earlyprintk=vga
                        earlyprintk=serial[,ttySn[,baudrate]]
 
@@ -585,7 +591,7 @@ and is between 256 and 4096 characters. It is defined in the file
        eisa_irq_edge=  [PARISC,HW]
                        See header of drivers/parisc/eisa.c.
 
-       elanfreq=       [IA-32]
+       elanfreq=       [X86-32]
                        See comment before function elanfreq_setup() in
                        arch/i386/kernel/cpu/cpufreq/elanfreq.c.
 
@@ -594,7 +600,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        See Documentation/block/as-iosched.txt and
                        Documentation/block/deadline-iosched.txt for details.
 
-       elfcorehdr=     [IA-32, X86_64]
+       elfcorehdr=     [X86-32, X86_64]
                        Specifies physical address of start of kernel core
                        image elf header. Generally kexec loader will
                        pass this option to capture kernel.
@@ -676,7 +682,7 @@ and is between 256 and 4096 characters. It is defined in the file
        hisax=          [HW,ISDN]
                        See Documentation/isdn/README.HiSax.
 
-       hugepages=      [HW,IA-32,IA-64] Maximal number of HugeTLB pages.
+       hugepages=      [HW,X86-32,IA-64] Maximal number of HugeTLB pages.
 
        i8042.direct    [HW] Put keyboard port into non-translated mode
        i8042.dumbkbd   [HW] Pretend that controller can only read data from
@@ -768,7 +774,8 @@ and is between 256 and 4096 characters. It is defined in the file
                        See Documentation/nfsroot.txt.
 
        ip2=            [HW] Set IO/IRQ pairs for up to 4 IntelliPort boards
-                       See comment before ip2_setup() in drivers/char/ip2.c.
+                       See comment before ip2_setup() in
+                       drivers/char/ip2/ip2base.c.
 
        ips=            [HW,SCSI] Adaptec / IBM ServeRAID controller
                        See header of drivers/scsi/ips.c.
@@ -817,7 +824,7 @@ and is between 256 and 4096 characters. It is defined in the file
        js=             [HW,JOY] Analog joystick
                        See Documentation/input/joystick.txt.
 
-       kernelcore=nn[KMG]      [KNL,IA-32,IA-64,PPC,X86-64] This parameter
+       kernelcore=nn[KMG]      [KNL,X86-32,IA-64,PPC,X86-64] This parameter
                        specifies the amount of memory usable by the kernel
                        for non-movable allocations.  The requested amount is
                        spread evenly throughout all nodes in the system. The
@@ -833,7 +840,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        use the HighMem zone if it exists, and the Normal
                        zone if it does not.
 
-       movablecore=nn[KMG]     [KNL,IA-32,IA-64,PPC,X86-64] This parameter
+       movablecore=nn[KMG]     [KNL,X86-32,IA-64,PPC,X86-64] This parameter
                        is similar to kernelcore except it specifies the
                        amount of memory used for migratable allocations.
                        If both kernelcore and movablecore is specified,
@@ -845,28 +852,20 @@ and is between 256 and 4096 characters. It is defined in the file
 
        keepinitrd      [HW,ARM]
 
-       kstack=N        [IA-32,X86-64] Print N words from the kernel stack
+       kstack=N        [X86-32,X86-64] Print N words from the kernel stack
                        in oops dumps.
 
        l2cr=           [PPC]
 
-       lapic           [IA-32,APIC] Enable the local APIC even if BIOS
+       lapic           [X86-32,APIC] Enable the local APIC even if BIOS
                        disabled it.
 
-       lapic_timer_c2_ok       [IA-32,x86-64,APIC] trust the local apic timer in
+       lapic_timer_c2_ok       [X86-32,x86-64,APIC] trust the local apic timer in
                        C2 power state.
 
        lasi=           [HW,SCSI] PARISC LASI driver for the 53c700 chip
                        Format: addr:<io>,irq:<irq>
 
-       legacy_serial.force [HW,IA-32,X86-64]
-                       Probe for COM ports at legacy addresses even
-                       if PNPBIOS or ACPI should describe them.  This
-                       is for working around firmware defects.
-
-       llsc*=          [IA64] See function print_params() in
-                       arch/ia64/sn/kernel/llsc4.c.
-
        load_ramdisk=   [RAM] List of ramdisks to load from floppy
                        See Documentation/ramdisk.txt.
 
@@ -972,11 +971,11 @@ and is between 256 and 4096 characters. It is defined in the file
                        [SCSI] Maximum number of LUNs received.
                        Should be between 1 and 16384.
 
-       mca-pentium     [BUGS=IA-32]
+       mca-pentium     [BUGS=X86-32]
 
        mcatest=        [IA-64]
 
-       mce             [IA-32] Machine Check Exception
+       mce             [X86-32] Machine Check Exception
 
        md=             [HW] RAID subsystems devices and level
                        See Documentation/md.txt.
@@ -988,14 +987,14 @@ and is between 256 and 4096 characters. It is defined in the file
        mem=nn[KMG]     [KNL,BOOT] Force usage of a specific amount of memory
                        Amount of memory to be used when the kernel is not able
                        to see the whole system memory or for test.
-                       [IA-32] Use together with memmap= to avoid physical
+                       [X86-32] Use together with memmap= to avoid physical
                        address space collisions. Without memmap= PCI devices
                        could be placed at addresses belonging to unused RAM.
 
-       mem=nopentium   [BUGS=IA-32] Disable usage of 4MB pages for kernel
+       mem=nopentium   [BUGS=X86-32] Disable usage of 4MB pages for kernel
                        memory.
 
-       memmap=exactmap [KNL,IA-32,X86_64] Enable setting of an exact
+       memmap=exactmap [KNL,X86-32,X86_64] Enable setting of an exact
                        E820 memory map, as specified by the user.
                        Such memmap=exactmap lines can be constructed based on
                        BIOS output or other requirements. See the memmap=nn@ss
@@ -1039,7 +1038,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        <name>,<region-number>[,<base>,<size>,<buswidth>,<altbuswidth>]
 
        mtdparts=       [MTD]
-                       See drivers/mtd/cmdline.c.
+                       See drivers/mtd/cmdlinepart.c.
 
        mtouchusb.raw_coordinates=
                        [HW] Make the MicroTouch USB driver use raw coordinates
@@ -1081,9 +1080,9 @@ and is between 256 and 4096 characters. It is defined in the file
                        [NFS] set the maximum lifetime for idmapper cache
                        entries.
 
-       nmi_watchdog=   [KNL,BUGS=IA-32] Debugging features for SMP kernels
+       nmi_watchdog=   [KNL,BUGS=X86-32] Debugging features for SMP kernels
 
-       no387           [BUGS=IA-32] Tells the kernel to use the 387 maths
+       no387           [BUGS=X86-32] Tells the kernel to use the 387 maths
                        emulation library even if a 387 maths coprocessor
                        is present.
 
@@ -1114,17 +1113,17 @@ and is between 256 and 4096 characters. It is defined in the file
 
        noexec          [IA-64]
 
-       noexec          [IA-32,X86-64]
+       noexec          [X86-32,X86-64]
                        noexec=on: enable non-executable mappings (default)
                        noexec=off: disable nn-executable mappings
 
-       nofxsr          [BUGS=IA-32] Disables x86 floating point extended
+       nofxsr          [BUGS=X86-32] Disables x86 floating point extended
                        register save and restore. The kernel will only save
                        legacy floating-point registers on task switch.
 
        nohlt           [BUGS=ARM]
 
-       no-hlt          [BUGS=IA-32] Tells the kernel that the hlt
+       no-hlt          [BUGS=X86-32] Tells the kernel that the hlt
                        instruction doesn't work correctly and not to
                        use it.
 
@@ -1139,12 +1138,12 @@ and is between 256 and 4096 characters. It is defined in the file
                        Valid arguments: on, off
                        Default: on
 
-       noirqbalance    [IA-32,SMP,KNL] Disable kernel irq balancing
+       noirqbalance    [X86-32,SMP,KNL] Disable kernel irq balancing
 
-       noirqdebug      [IA-32] Disables the code which attempts to detect and
+       noirqdebug      [X86-32] Disables the code which attempts to detect and
                        disable unhandled interrupt sources.
 
-       no_timer_check  [IA-32,X86_64,APIC] Disables the code which tests for
+       no_timer_check  [X86-32,X86_64,APIC] Disables the code which tests for
                        broken timer IRQ sources.
 
        noisapnp        [ISAPNP] Disables ISA PnP code.
@@ -1156,20 +1155,20 @@ and is between 256 and 4096 characters. It is defined in the file
 
        nojitter        [IA64] Disables jitter checking for ITC timers.
 
-       nolapic         [IA-32,APIC] Do not enable or use the local APIC.
+       nolapic         [X86-32,APIC] Do not enable or use the local APIC.
 
-       nolapic_timer   [IA-32,APIC] Do not use the local APIC timer.
+       nolapic_timer   [X86-32,APIC] Do not use the local APIC timer.
 
        noltlbs         [PPC] Do not use large page/tlb entries for kernel
                        lowmem mapping on PPC40x.
 
        nomca           [IA-64] Disable machine check abort handling
 
-       nomce           [IA-32] Machine Check Exception
+       nomce           [X86-32] Machine Check Exception
 
-       noreplace-paravirt      [IA-32,PV_OPS] Don't patch paravirt_ops
+       noreplace-paravirt      [X86-32,PV_OPS] Don't patch paravirt_ops
 
-       noreplace-smp   [IA-32,SMP] Don't replace SMP instructions
+       noreplace-smp   [X86-32,SMP] Don't replace SMP instructions
                        with UP alternatives
 
        noresidual      [PPC] Don't use residual data on PReP machines.
@@ -1183,7 +1182,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
        nosbagart       [IA-64]
 
-       nosep           [BUGS=IA-32] Disables x86 SYSENTER/SYSEXIT support.
+       nosep           [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support.
 
        nosmp           [SMP] Tells an SMP kernel to act as a UP kernel.
 
@@ -1191,7 +1190,7 @@ and is between 256 and 4096 characters. It is defined in the file
 
        nosync          [HW,M68K] Disables sync negotiation for all devices.
 
-       notsc           [BUGS=IA-32] Disable Time Stamp Counter
+       notsc           [BUGS=X86-32] Disable Time Stamp Counter
 
        nousb           [USB] Disable the USB subsystem
 
@@ -1264,28 +1263,28 @@ and is between 256 and 4096 characters. It is defined in the file
                        See also Documentation/paride.txt.
 
        pci=option[,option...]  [PCI] various PCI subsystem options:
-               off             [IA-32] don't probe for the PCI bus
-               bios            [IA-32] force use of PCI BIOS, don't access
+               off             [X86-32] don't probe for the PCI bus
+               bios            [X86-32] force use of PCI BIOS, don't access
                                the hardware directly. Use this if your machine
                                has a non-standard PCI host bridge.
-               nobios          [IA-32] disallow use of PCI BIOS, only direct
+               nobios          [X86-32] disallow use of PCI BIOS, only direct
                                hardware access methods are allowed. Use this
                                if you experience crashes upon bootup and you
                                suspect they are caused by the BIOS.
-               conf1           [IA-32] Force use of PCI Configuration
+               conf1           [X86-32] Force use of PCI Configuration
                                Mechanism 1.
-               conf2           [IA-32] Force use of PCI Configuration
+               conf2           [X86-32] Force use of PCI Configuration
                                Mechanism 2.
-               nommconf        [IA-32,X86_64] Disable use of MMCONFIG for PCI
+               nommconf        [X86-32,X86_64] Disable use of MMCONFIG for PCI
                                Configuration
                nomsi           [MSI] If the PCI_MSI kernel config parameter is
                                enabled, this kernel boot option can be used to
                                disable the use of MSI interrupts system-wide.
-               nosort          [IA-32] Don't sort PCI devices according to
+               nosort          [X86-32] Don't sort PCI devices according to
                                order given by the PCI BIOS. This sorting is
                                done to get a device order compatible with
                                older kernels.
-               biosirq         [IA-32] Use PCI BIOS calls to get the interrupt
+               biosirq         [X86-32] Use PCI BIOS calls to get the interrupt
                                routing table. These calls are known to be buggy
                                on several machines and they hang the machine
                                when used, but on other computers it's the only
@@ -1293,32 +1292,32 @@ and is between 256 and 4096 characters. It is defined in the file
                                this option if the kernel is unable to allocate
                                IRQs or discover secondary PCI buses on your
                                motherboard.
-               rom             [IA-32] Assign address space to expansion ROMs.
+               rom             [X86-32] Assign address space to expansion ROMs.
                                Use with caution as certain devices share
                                address decoders between ROMs and other
                                resources.
-               irqmask=0xMMMM  [IA-32] Set a bit mask of IRQs allowed to be
+               irqmask=0xMMMM  [X86-32] Set a bit mask of IRQs allowed to be
                                assigned automatically to PCI devices. You can
                                make the kernel exclude IRQs of your ISA cards
                                this way.
-               pirqaddr=0xAAAAA        [IA-32] Specify the physical address
+               pirqaddr=0xAAAAA        [X86-32] Specify the physical address
                                of the PIRQ table (normally generated
                                by the BIOS) if it is outside the
                                F0000h-100000h range.
-               lastbus=N       [IA-32] Scan all buses thru bus #N. Can be
+               lastbus=N       [X86-32] Scan all buses thru bus #N. Can be
                                useful if the kernel is unable to find your
                                secondary buses and you want to tell it
                                explicitly which ones they are.
-               assign-busses   [IA-32] Always assign all PCI bus
+               assign-busses   [X86-32] Always assign all PCI bus
                                numbers ourselves, overriding
                                whatever the firmware may have done.
-               usepirqmask     [IA-32] Honor the possible IRQ mask stored
+               usepirqmask     [X86-32] Honor the possible IRQ mask stored
                                in the BIOS $PIR table. This is needed on
                                some systems with broken BIOSes, notably
                                some HP Pavilion N5400 and Omnibook XE3
                                notebooks. This will have no effect if ACPI
                                IRQ routing is enabled.
-               noacpi          [IA-32] Do not use ACPI for IRQ routing
+               noacpi          [X86-32] Do not use ACPI for IRQ routing
                                or for PCI scanning.
                routeirq        Do IRQ routing for all PCI devices.
                                This is normally done in pci_enable_device(),
@@ -1467,13 +1466,13 @@ and is between 256 and 4096 characters. It is defined in the file
                        Run specified binary instead of /init from the ramdisk,
                        used for early userspace startup. See initrd.
 
-       reboot=         [BUGS=IA-32,BUGS=ARM,BUGS=IA-64] Rebooting mode
+       reboot=         [BUGS=X86-32,BUGS=ARM,BUGS=IA-64] Rebooting mode
                        Format: <reboot_mode>[,<reboot_mode2>[,...]]
                        See arch/*/kernel/reboot.c or arch/*/kernel/process.c                   
 
        reserve=        [KNL,BUGS] Force the kernel to ignore some iomem area
 
-       reservetop=     [IA-32]
+       reservetop=     [X86-32]
                        Format: nn[KMG]
                        Reserves a hole at the top of the kernel virtual
                        address space.
@@ -1564,7 +1563,7 @@ and is between 256 and 4096 characters. It is defined in the file
                         Value can be changed at runtime via
                         /selinux/compat_net.
 
-       serialnumber    [BUGS=IA-32]
+       serialnumber    [BUGS=X86-32]
 
        sg_def_reserved_size=   [SCSI]
 
@@ -1617,7 +1616,7 @@ and is between 256 and 4096 characters. It is defined in the file
        smart2=         [HW]
                        Format: <io1>[,<io2>[,...,<io8>]]
 
-       smp-alt-once    [IA-32,SMP] On a hotplug CPU system, only
+       smp-alt-once    [X86-32,SMP] On a hotplug CPU system, only
                        attempt to substitute SMP alternatives once at boot.
 
        smsc-ircc2.nopnp        [HW] Don't use PNP to discover SMC devices
@@ -1823,6 +1822,26 @@ and is between 256 and 4096 characters. It is defined in the file
        thash_entries=  [KNL,NET]
                        Set number of hash buckets for TCP connection
 
+       thermal.act=    [HW,ACPI]
+                       -1: disable all active trip points in all thermal zones
+                       <degrees C>: override all lowest active trip points
+
+       thermal.nocrt=  [HW,ACPI]
+                       Set to disable actions on ACPI thermal zone
+                       critical and hot trip points.
+
+       thermal.off=    [HW,ACPI]
+                       1: disable ACPI thermal control
+
+       thermal.psv=    [HW,ACPI]
+                       -1: disable all passive trip points
+                       <degrees C>: override all passive trip points to this value
+
+       thermal.tzp=    [HW,ACPI]
+                       Specify global default ACPI thermal zone polling rate
+                       <deci-seconds>: poll all this frequency
+                       0: no polling (default)
+
        time            Show timing data prefixed to each printk message line
                        [deprecated, see 'printk.time']
 
@@ -1882,7 +1901,7 @@ and is between 256 and 4096 characters. It is defined in the file
        usbhid.mousepoll=
                        [USBHID] The interval which mice are to be polled at.
 
-       vdso=           [IA-32,SH,x86-64]
+       vdso=           [X86-32,SH,x86-64]
                        vdso=2: enable compat VDSO (default with COMPAT_VDSO)
                        vdso=1: enable VDSO (default)
                        vdso=0: disable VDSO mapping
@@ -1893,7 +1912,7 @@ and is between 256 and 4096 characters. It is defined in the file
        video=          [FB] Frame buffer configuration
                        See Documentation/fb/modedb.txt.
 
-       vga=            [BOOT,IA-32] Select a particular video mode
+       vga=            [BOOT,X86-32] Select a particular video mode
                        See Documentation/i386/boot.txt and
                        Documentation/svga.txt.
                        Use vga=ask for menu.
@@ -1925,7 +1944,7 @@ and is between 256 and 4096 characters. It is defined in the file
                        See header of drivers/scsi/wd7000.c.
 
        wdt=            [WDT] Watchdog
-                       See Documentation/watchdog/watchdog.txt.
+                       See Documentation/watchdog/wdt.txt.
 
        xd=             [HW,XT] Original XT pre-IDE (RLL encoded) disks.
        xd_geo=         See header of drivers/block/xd.c.
index 81d9aa09729811e7ca2cec3500e796d8a583c600..947d57d53453be799851155b0231cce1c9593217 100644 (file)
@@ -859,9 +859,8 @@ payload contents" for more information.
        void unregister_key_type(struct key_type *type);
 
 
-Under some circumstances, it may be desirable to desirable to deal with a
-bundle of keys.  The facility provides access to the keyring type for managing
-such a bundle:
+Under some circumstances, it may be desirable to deal with a bundle of keys.
+The facility provides access to the keyring type for managing such a bundle:
 
        struct key_type key_type_keyring;
 
index e44855513b3d4f044177d871a8af7b8383c3fa59..8ee49ee7c9636ad6b16cd0ecf3e98539ff818fee 100644 (file)
@@ -27,7 +27,6 @@ in detail, and briefly here:
 - kobjects     a simple object.
 - kset         a set of objects of a certain type.
 - ktype                a set of helpers for objects of a common type. 
-- subsystem    a controlling object for a number of ksets.
 
 
 The kobject infrastructure maintains a close relationship with the
@@ -54,13 +53,15 @@ embedded in larger data structures and replace fields they duplicate.
 1.2 Definition
 
 struct kobject {
+       const char              * k_name;
        char                    name[KOBJ_NAME_LEN];
-       atomic_t                refcount;
+       struct kref             kref;
        struct list_head        entry;
        struct kobject          * parent;
        struct kset             * kset;
        struct kobj_type        * ktype;
-       struct dentry           * dentry;
+       struct sysfs_dirent     * sd;
+       wait_queue_head_t       poll;
 };
 
 void kobject_init(struct kobject *);
@@ -137,8 +138,7 @@ If a kobject does not have a parent when it is registered, its parent
 becomes its dominant kset. 
 
 If a kobject does not have a parent nor a dominant kset, its directory
-is created at the top-level of the sysfs partition. This should only
-happen for kobjects that are embedded in a struct subsystem. 
+is created at the top-level of the sysfs partition.
 
 
 
@@ -150,10 +150,10 @@ A kset is a set of kobjects that are embedded in the same type.
 
 
 struct kset {
-       struct subsystem        * subsys;
        struct kobj_type        * ktype;
        struct list_head        list;
        struct kobject          kobj;
+       struct kset_uevent_ops  * uevent_ops;
 };
 
 
@@ -169,8 +169,7 @@ struct kobject * kset_find_obj(struct kset *, char *);
 
 
 The type that the kobjects are embedded in is described by the ktype
-pointer. The subsystem that the kobject belongs to is pointed to by the
-subsys pointer. 
+pointer.
 
 A kset contains a kobject itself, meaning that it may be registered in
 the kobject hierarchy and exported via sysfs. More importantly, the
@@ -209,6 +208,58 @@ the hierarchy.
 kset_find_obj() may be used to locate a kobject with a particular
 name. The kobject, if found, is returned. 
 
+There are also some helper functions which names point to the formerly
+existing "struct subsystem", whose functions have been taken over by
+ksets.
+
+
+decl_subsys(name,type,uevent_ops)
+
+Declares a kset named '<name>_subsys' of type <type> with
+uevent_ops <uevent_ops>. For example,
+
+decl_subsys(devices, &ktype_device, &device_uevent_ops);
+
+is equivalent to doing:
+
+struct kset devices_subsys = {
+     .kobj = {
+          .name = "devices",
+     },
+     .ktype = &ktype_devices,
+     .uevent_ops = &device_uevent_ops,
+};
+
+
+The objects that are registered with a subsystem that use the
+subsystem's default list must have their kset ptr set properly. These
+objects may have embedded kobjects or ksets. The
+following helpers make setting the kset easier:
+
+
+kobj_set_kset_s(obj,subsys)
+
+- Assumes that obj->kobj exists, and is a struct kobject.
+- Sets the kset of that kobject to the kset <subsys>.
+
+
+kset_set_kset_s(obj,subsys)
+
+- Assumes that obj->kset exists, and is a struct kset.
+- Sets the kset of the embedded kobject to the kset <subsys>.
+
+subsys_set_kset(obj,subsys)
+
+- Assumes obj->subsys exists, and is a struct subsystem.
+- Sets obj->subsys.kset.kobj.kset to the subsystem's embedded kset.
+
+void subsystem_init(struct kset *s);
+int subsystem_register(struct kset *s);
+void subsystem_unregister(struct kset *s);
+struct kset *subsys_get(struct kset *s);
+void kset_put(struct kset *s);
+
+These are just wrappers around the respective kset_* functions.
 
 2.3 sysfs
 
@@ -254,114 +305,3 @@ Instances of struct kobj_type are not registered; only referenced by
 the kset. A kobj_type may be referenced by an arbitrary number of
 ksets, as there may be disparate sets of identical objects. 
 
-
-
-4. subsystems
-
-4.1 Description
-
-A subsystem represents a significant entity of code that maintains an
-arbitrary number of sets of objects of various types. Since the number
-of ksets and the type of objects they contain are variable, a
-generic representation of a subsystem is minimal. 
-
-
-struct subsystem {
-       struct kset             kset;
-       struct rw_semaphore     rwsem;
-};
-
-int subsystem_register(struct subsystem *);
-void subsystem_unregister(struct subsystem *);
-
-struct subsystem * subsys_get(struct subsystem * s);
-void subsys_put(struct subsystem * s);
-
-
-A subsystem contains an embedded kset so:
-
-- It can be represented in the object hierarchy via the kset's
-  embedded kobject. 
-
-- It can maintain a default list of objects of one type. 
-
-Additional ksets may attach to the subsystem simply by referencing the
-subsystem before they are registered. (This one-way reference means
-that there is no way to determine the ksets that are attached to the
-subsystem.) 
-
-All ksets that are attached to a subsystem share the subsystem's R/W
-semaphore. 
-
-
-4.2 subsystem Programming Interface.
-
-The subsystem programming interface is simple and does not offer the
-flexibility that the kset and kobject programming interfaces do. They
-may be registered and unregistered, as well as reference counted. Each
-call forwards the calls to their embedded ksets (which forward the
-calls to their embedded kobjects).
-
-
-4.3 Helpers
-
-A number of macros are available to make dealing with subsystems and
-their embedded objects easier. 
-
-
-decl_subsys(name,type)
-
-Declares a subsystem named '<name>_subsys', with an embedded kset of
-type <type>. For example, 
-
-decl_subsys(devices,&ktype_devices);
-
-is equivalent to doing:
-
-struct subsystem device_subsys = {
-       .kset = {
-            .kobj = {
-                  .name = "devices",
-            },
-            .ktype = &ktype_devices,
-       }
-}; 
-
-
-The objects that are registered with a subsystem that use the
-subsystem's default list must have their kset ptr set properly. These
-objects may have embedded kobjects, ksets, or other subsystems. The
-following helpers make setting the kset easier: 
-
-
-kobj_set_kset_s(obj,subsys)
-
-- Assumes that obj->kobj exists, and is a struct kobject. 
-- Sets the kset of that kobject to the subsystem's embedded kset.
-
-
-kset_set_kset_s(obj,subsys)
-
-- Assumes that obj->kset exists, and is a struct kset.
-- Sets the kset of the embedded kobject to the subsystem's 
-  embedded kset. 
-
-subsys_set_kset(obj,subsys)
-
-- Assumes obj->subsys exists, and is a struct subsystem.
-- Sets obj->subsys.kset.kobj.kset to the subsystem's embedded kset.
-
-
-4.4 sysfs
-
-subsystems are represented in sysfs via their embedded kobjects. They
-follow the same rules as previously mentioned with no exceptions. They
-typically receive a top-level directory in sysfs, except when their
-embedded kobject is part of another kset, or the parent of the
-embedded kobject is explicitly set. 
-
-Note that the subsystem's embedded kset must be 'attached' to the
-subsystem itself in order to use its rwsem. This is done after
-kset_add() has been called. (Not before, because kset_add() uses its
-subsystem for a default parent if it doesn't already have one).
-
index 31e794ef5f98ad7ce428444e4bc73f540b0fe718..c0b7a4556390e7c15e3f088ab1368c5db3cb9cca 100644 (file)
@@ -13,7 +13,9 @@ LGUEST_GUEST_TOP := ($(CONFIG_PAGE_OFFSET) - 0x08000000)
 
 CFLAGS:=-Wall -Wmissing-declarations -Wmissing-prototypes -O3 -Wl,-T,lguest.lds
 LDLIBS:=-lz
-
+# Removing this works for some versions of ld.so (eg. Ubuntu Feisty) and
+# not others (eg. FC7).
+LDFLAGS+=-static
 all: lguest.lds lguest
 
 # The linker script on x86 is so complex the only way of creating one
diff --git a/Documentation/lguest/extract b/Documentation/lguest/extract
new file mode 100644 (file)
index 0000000..7730bb6
--- /dev/null
@@ -0,0 +1,58 @@
+#! /bin/sh
+
+set -e
+
+PREFIX=$1
+shift
+
+trap 'rm -r $TMPDIR' 0
+TMPDIR=`mktemp -d`
+
+exec 3>/dev/null
+for f; do
+    while IFS="
+" read -r LINE; do
+       case "$LINE" in
+           *$PREFIX:[0-9]*:\**)
+               NUM=`echo "$LINE" | sed "s/.*$PREFIX:\([0-9]*\).*/\1/"`
+               if [ -f $TMPDIR/$NUM ]; then
+                   echo "$TMPDIR/$NUM already exits prior to $f"
+                   exit 1
+               fi
+               exec 3>>$TMPDIR/$NUM
+               echo $f | sed 's,\.\./,,g' > $TMPDIR/.$NUM
+               /bin/echo "$LINE" | sed -e "s/$PREFIX:[0-9]*//" -e "s/:\*/*/" >&3
+               ;;
+           *$PREFIX:[0-9]*)
+               NUM=`echo "$LINE" | sed "s/.*$PREFIX:\([0-9]*\).*/\1/"`
+               if [ -f $TMPDIR/$NUM ]; then
+                   echo "$TMPDIR/$NUM already exits prior to $f"
+                   exit 1
+               fi
+               exec 3>>$TMPDIR/$NUM
+               echo $f | sed 's,\.\./,,g' > $TMPDIR/.$NUM
+               /bin/echo "$LINE" | sed "s/$PREFIX:[0-9]*//" >&3
+               ;;
+           *:\**)
+               /bin/echo "$LINE" | sed -e "s/:\*/*/" -e "s,/\*\*/,," >&3
+               echo >&3
+               exec 3>/dev/null
+               ;;
+           *)
+               /bin/echo "$LINE" >&3
+               ;;
+       esac
+    done < $f
+    echo >&3
+    exec 3>/dev/null
+done
+
+LASTFILE=""
+for f in $TMPDIR/*; do
+    if [ "$LASTFILE" != $(cat $TMPDIR/.$(basename $f) ) ]; then
+       LASTFILE=$(cat $TMPDIR/.$(basename $f) )
+       echo "[ $LASTFILE ]"
+    fi
+    cat $f
+done
+
index 62a8133393e19d3991781317bc10c834a6ed5939..f7918401a0072c9b08bf81bb07434b66a96f6085 100644 (file)
@@ -1,5 +1,10 @@
-/* Simple program to layout "physical" memory for new lguest guest.
- * Linked high to avoid likely physical memory.  */
+/*P:100 This is the Launcher code, a simple program which lays out the
+ * "physical" memory for the new Guest by mapping the kernel image and the
+ * virtual devices, then reads repeatedly from /dev/lguest to run the Guest.
+ *
+ * The only trick: the Makefile links it at a high address so it will be clear
+ * of the guest memory region.  It means that each Guest cannot have more than
+ * about 2.5G of memory on a normally configured Host. :*/
 #define _LARGEFILE64_SOURCE
 #define _GNU_SOURCE
 #include <stdio.h>
 #include <termios.h>
 #include <getopt.h>
 #include <zlib.h>
+/*L:110 We can ignore the 28 include files we need for this program, but I do
+ * want to draw attention to the use of kernel-style types.
+ *
+ * As Linus said, "C is a Spartan language, and so should your naming be."  I
+ * like these abbreviations and the header we need uses them, so we define them
+ * here.
+ */
 typedef unsigned long long u64;
 typedef uint32_t u32;
 typedef uint16_t u16;
 typedef uint8_t u8;
 #include "../../include/linux/lguest_launcher.h"
 #include "../../include/asm-i386/e820.h"
+/*:*/
 
 #define PAGE_PRESENT 0x7       /* Present, RW, Execute */
 #define NET_PEERNUM 1
@@ -43,33 +56,52 @@ typedef uint8_t u8;
 #define SIOCBRADDIF    0x89a2          /* add interface to bridge      */
 #endif
 
+/*L:120 verbose is both a global flag and a macro.  The C preprocessor allows
+ * this, and although I wouldn't recommend it, it works quite nicely here. */
 static bool verbose;
 #define verbose(args...) \
        do { if (verbose) printf(args); } while(0)
+/*:*/
+
+/* The pipe to send commands to the waker process */
 static int waker_fd;
+/* The top of guest physical memory. */
 static u32 top;
 
+/* This is our list of devices. */
 struct device_list
 {
+       /* Summary information about the devices in our list: ready to pass to
+        * select() to ask which need servicing.*/
        fd_set infds;
        int max_infd;
 
+       /* The descriptor page for the devices. */
        struct lguest_device_desc *descs;
+
+       /* A single linked list of devices. */
        struct device *dev;
+       /* ... And an end pointer so we can easily append new devices */
        struct device **lastdev;
 };
 
+/* The device structure describes a single device. */
 struct device
 {
+       /* The linked-list pointer. */
        struct device *next;
+       /* The descriptor for this device, as mapped into the Guest. */
        struct lguest_device_desc *desc;
+       /* The memory page(s) of this device, if any.  Also mapped in Guest. */
        void *mem;
 
-       /* Watch this fd if handle_input non-NULL. */
+       /* If handle_input is set, it wants to be called when this file
+        * descriptor is ready. */
        int fd;
        bool (*handle_input)(int fd, struct device *me);
 
-       /* Watch DMA to this key if handle_input non-NULL. */
+       /* If handle_output is set, it wants to be called when the Guest sends
+        * DMA to this key. */
        unsigned long watch_key;
        u32 (*handle_output)(int fd, const struct iovec *iov,
                             unsigned int num, struct device *me);
@@ -78,6 +110,11 @@ struct device
        void *priv;
 };
 
+/*L:130
+ * Loading the Kernel.
+ *
+ * We start with couple of simple helper routines.  open_or_die() avoids
+ * error-checking code cluttering the callers: */
 static int open_or_die(const char *name, int flags)
 {
        int fd = open(name, flags);
@@ -86,26 +123,38 @@ static int open_or_die(const char *name, int flags)
        return fd;
 }
 
+/* map_zeroed_pages() takes a (page-aligned) address and a number of pages. */
 static void *map_zeroed_pages(unsigned long addr, unsigned int num)
 {
+       /* We cache the /dev/zero file-descriptor so we only open it once. */
        static int fd = -1;
 
        if (fd == -1)
                fd = open_or_die("/dev/zero", O_RDONLY);
 
+       /* We use a private mapping (ie. if we write to the page, it will be
+        * copied), and obviously we insist that it be mapped where we ask. */
        if (mmap((void *)addr, getpagesize() * num,
                 PROT_READ|PROT_WRITE|PROT_EXEC, MAP_FIXED|MAP_PRIVATE, fd, 0)
            != (void *)addr)
                err(1, "Mmaping %u pages of /dev/zero @%p", num, (void *)addr);
+
+       /* Returning the address is just a courtesy: can simplify callers. */
        return (void *)addr;
 }
 
-/* Find magic string marking entry point, return entry point. */
+/* To find out where to start we look for the magic Guest string, which marks
+ * the code we see in lguest_asm.S.  This is a hack which we are currently
+ * plotting to replace with the normal Linux entry point. */
 static unsigned long entry_point(void *start, void *end,
                                 unsigned long page_offset)
 {
        void *p;
 
+       /* The scan gives us the physical starting address.  We want the
+        * virtual address in this case, and fortunately, we already figured
+        * out the physical-virtual difference and passed it here in
+        * "page_offset". */
        for (p = start; p < end; p++)
                if (memcmp(p, "GenuineLguest", strlen("GenuineLguest")) == 0)
                        return (long)p + strlen("GenuineLguest") + page_offset;
@@ -113,7 +162,17 @@ static unsigned long entry_point(void *start, void *end,
        err(1, "Is this image a genuine lguest?");
 }
 
-/* Returns the entry point */
+/* This routine takes an open vmlinux image, which is in ELF, and maps it into
+ * the Guest memory.  ELF = Embedded Linking Format, which is the format used
+ * by all modern binaries on Linux including the kernel.
+ *
+ * The ELF headers give *two* addresses: a physical address, and a virtual
+ * address.  The Guest kernel expects to be placed in memory at the physical
+ * address, and the page tables set up so it will correspond to that virtual
+ * address.  We return the difference between the virtual and physical
+ * addresses in the "page_offset" pointer.
+ *
+ * We return the starting address. */
 static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr,
                             unsigned long *page_offset)
 {
@@ -122,40 +181,61 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr,
        unsigned int i;
        unsigned long start = -1UL, end = 0;
 
-       /* Sanity checks. */
+       /* Sanity checks on the main ELF header: an x86 executable with a
+        * reasonable number of correctly-sized program headers. */
        if (ehdr->e_type != ET_EXEC
            || ehdr->e_machine != EM_386
            || ehdr->e_phentsize != sizeof(Elf32_Phdr)
            || ehdr->e_phnum < 1 || ehdr->e_phnum > 65536U/sizeof(Elf32_Phdr))
                errx(1, "Malformed elf header");
 
+       /* An ELF executable contains an ELF header and a number of "program"
+        * headers which indicate which parts ("segments") of the program to
+        * load where. */
+
+       /* We read in all the program headers at once: */
        if (lseek(elf_fd, ehdr->e_phoff, SEEK_SET) < 0)
                err(1, "Seeking to program headers");
        if (read(elf_fd, phdr, sizeof(phdr)) != sizeof(phdr))
                err(1, "Reading program headers");
 
+       /* We don't know page_offset yet. */
        *page_offset = 0;
-       /* We map the loadable segments at virtual addresses corresponding
-        * to their physical addresses (our virtual == guest physical). */
+
+       /* Try all the headers: there are usually only three.  A read-only one,
+        * a read-write one, and a "note" section which isn't loadable. */
        for (i = 0; i < ehdr->e_phnum; i++) {
+               /* If this isn't a loadable segment, we ignore it */
                if (phdr[i].p_type != PT_LOAD)
                        continue;
 
                verbose("Section %i: size %i addr %p\n",
                        i, phdr[i].p_memsz, (void *)phdr[i].p_paddr);
 
-               /* We expect linear address space. */
+               /* We expect a simple linear address space: every segment must
+                * have the same difference between virtual (p_vaddr) and
+                * physical (p_paddr) address. */
                if (!*page_offset)
                        *page_offset = phdr[i].p_vaddr - phdr[i].p_paddr;
                else if (*page_offset != phdr[i].p_vaddr - phdr[i].p_paddr)
                        errx(1, "Page offset of section %i different", i);
 
+               /* We track the first and last address we mapped, so we can
+                * tell entry_point() where to scan. */
                if (phdr[i].p_paddr < start)
                        start = phdr[i].p_paddr;
                if (phdr[i].p_paddr + phdr[i].p_filesz > end)
                        end = phdr[i].p_paddr + phdr[i].p_filesz;
 
-               /* We map everything private, writable. */
+               /* We map this section of the file at its physical address.  We
+                * map it read & write even if the header says this segment is
+                * read-only.  The kernel really wants to be writable: it
+                * patches its own instructions which would normally be
+                * read-only.
+                *
+                * MAP_PRIVATE means that the page won't be copied until a
+                * write is done to it.  This allows us to share much of the
+                * kernel memory between Guests. */
                addr = mmap((void *)phdr[i].p_paddr,
                            phdr[i].p_filesz,
                            PROT_READ|PROT_WRITE|PROT_EXEC,
@@ -169,7 +249,31 @@ static unsigned long map_elf(int elf_fd, const Elf32_Ehdr *ehdr,
        return entry_point((void *)start, (void *)end, *page_offset);
 }
 
-/* This is amazingly reliable. */
+/*L:170 Prepare to be SHOCKED and AMAZED.  And possibly a trifle nauseated.
+ *
+ * We know that CONFIG_PAGE_OFFSET sets what virtual address the kernel expects
+ * to be.  We don't know what that option was, but we can figure it out
+ * approximately by looking at the addresses in the code.  I chose the common
+ * case of reading a memory location into the %eax register:
+ *
+ *  movl <some-address>, %eax
+ *
+ * This gets encoded as five bytes: "0xA1 <4-byte-address>".  For example,
+ * "0xA1 0x18 0x60 0x47 0xC0" reads the address 0xC0476018 into %eax.
+ *
+ * In this example can guess that the kernel was compiled with
+ * CONFIG_PAGE_OFFSET set to 0xC0000000 (it's always a round number).  If the
+ * kernel were larger than 16MB, we might see 0xC1 addresses show up, but our
+ * kernel isn't that bloated yet.
+ *
+ * Unfortunately, x86 has variable-length instructions, so finding this
+ * particular instruction properly involves writing a disassembler.  Instead,
+ * we rely on statistics.  We look for "0xA1" and tally the different bytes
+ * which occur 4 bytes later (the "0xC0" in our example above).  When one of
+ * those bytes appears three times, we can be reasonably confident that it
+ * forms the start of CONFIG_PAGE_OFFSET.
+ *
+ * This is amazingly reliable. */
 static unsigned long intuit_page_offset(unsigned char *img, unsigned long len)
 {
        unsigned int i, possibilities[256] = { 0 };
@@ -182,30 +286,52 @@ static unsigned long intuit_page_offset(unsigned char *img, unsigned long len)
        errx(1, "could not determine page offset");
 }
 
+/*L:160 Unfortunately the entire ELF image isn't compressed: the segments
+ * which need loading are extracted and compressed raw.  This denies us the
+ * information we need to make a fully-general loader. */
 static unsigned long unpack_bzimage(int fd, unsigned long *page_offset)
 {
        gzFile f;
        int ret, len = 0;
+       /* A bzImage always gets loaded at physical address 1M.  This is
+        * actually configurable as CONFIG_PHYSICAL_START, but as the comment
+        * there says, "Don't change this unless you know what you are doing".
+        * Indeed. */
        void *img = (void *)0x100000;
 
+       /* gzdopen takes our file descriptor (carefully placed at the start of
+        * the GZIP header we found) and returns a gzFile. */
        f = gzdopen(fd, "rb");
+       /* We read it into memory in 64k chunks until we hit the end. */
        while ((ret = gzread(f, img + len, 65536)) > 0)
                len += ret;
        if (ret < 0)
                err(1, "reading image from bzImage");
 
        verbose("Unpacked size %i addr %p\n", len, img);
+
+       /* Without the ELF header, we can't tell virtual-physical gap.  This is
+        * CONFIG_PAGE_OFFSET, and people do actually change it.  Fortunately,
+        * I have a clever way of figuring it out from the code itself.  */
        *page_offset = intuit_page_offset(img, len);
 
        return entry_point(img, img + len, *page_offset);
 }
 
+/*L:150 A bzImage, unlike an ELF file, is not meant to be loaded.  You're
+ * supposed to jump into it and it will unpack itself.  We can't do that
+ * because the Guest can't run the unpacking code, and adding features to
+ * lguest kills puppies, so we don't want to.
+ *
+ * The bzImage is formed by putting the decompressing code in front of the
+ * compressed kernel code.  So we can simple scan through it looking for the
+ * first "gzip" header, and start decompressing from there. */
 static unsigned long load_bzimage(int fd, unsigned long *page_offset)
 {
        unsigned char c;
        int state = 0;
 
-       /* Ugly brute force search for gzip header. */
+       /* GZIP header is 0x1F 0x8B <method> <flags>... <compressed-by>. */
        while (read(fd, &c, 1) == 1) {
                switch (state) {
                case 0:
@@ -222,8 +348,10 @@ static unsigned long load_bzimage(int fd, unsigned long *page_offset)
                        state++;
                        break;
                case 9:
+                       /* Seek back to the start of the gzip header. */
                        lseek(fd, -10, SEEK_CUR);
-                       if (c != 0x03) /* Compressed under UNIX. */
+                       /* One final check: "compressed under UNIX". */
+                       if (c != 0x03)
                                state = -1;
                        else
                                return unpack_bzimage(fd, page_offset);
@@ -232,25 +360,43 @@ static unsigned long load_bzimage(int fd, unsigned long *page_offset)
        errx(1, "Could not find kernel in bzImage");
 }
 
+/*L:140 Loading the kernel is easy when it's a "vmlinux", but most kernels
+ * come wrapped up in the self-decompressing "bzImage" format.  With some funky
+ * coding, we can load those, too. */
 static unsigned long load_kernel(int fd, unsigned long *page_offset)
 {
        Elf32_Ehdr hdr;
 
+       /* Read in the first few bytes. */
        if (read(fd, &hdr, sizeof(hdr)) != sizeof(hdr))
                err(1, "Reading kernel");
 
+       /* If it's an ELF file, it starts with "\177ELF" */
        if (memcmp(hdr.e_ident, ELFMAG, SELFMAG) == 0)
                return map_elf(fd, &hdr, page_offset);
 
+       /* Otherwise we assume it's a bzImage, and try to unpack it */
        return load_bzimage(fd, page_offset);
 }
 
+/* This is a trivial little helper to align pages.  Andi Kleen hated it because
+ * it calls getpagesize() twice: "it's dumb code."
+ *
+ * Kernel guys get really het up about optimization, even when it's not
+ * necessary.  I leave this code as a reaction against that. */
 static inline unsigned long page_align(unsigned long addr)
 {
+       /* Add upwards and truncate downwards. */
        return ((addr + getpagesize()-1) & ~(getpagesize()-1));
 }
 
-/* initrd gets loaded at top of memory: return length. */
+/*L:180 An "initial ram disk" is a disk image loaded into memory along with
+ * the kernel which the kernel can use to boot from without needing any
+ * drivers.  Most distributions now use this as standard: the initrd contains
+ * the code to load the appropriate driver modules for the current machine.
+ *
+ * Importantly, James Morris works for RedHat, and Fedora uses initrds for its
+ * kernels.  He sent me this (and tells me when I break it). */
 static unsigned long load_initrd(const char *name, unsigned long mem)
 {
        int ifd;
@@ -259,21 +405,35 @@ static unsigned long load_initrd(const char *name, unsigned long mem)
        void *iaddr;
 
        ifd = open_or_die(name, O_RDONLY);
+       /* fstat() is needed to get the file size. */
        if (fstat(ifd, &st) < 0)
                err(1, "fstat() on initrd '%s'", name);
 
+       /* The length needs to be rounded up to a page size: mmap needs the
+        * address to be page aligned. */
        len = page_align(st.st_size);
+       /* We map the initrd at the top of memory. */
        iaddr = mmap((void *)mem - len, st.st_size,
                     PROT_READ|PROT_EXEC|PROT_WRITE,
                     MAP_FIXED|MAP_PRIVATE, ifd, 0);
        if (iaddr != (void *)mem - len)
                err(1, "Mmaping initrd '%s' returned %p not %p",
                    name, iaddr, (void *)mem - len);
+       /* Once a file is mapped, you can close the file descriptor.  It's a
+        * little odd, but quite useful. */
        close(ifd);
        verbose("mapped initrd %s size=%lu @ %p\n", name, st.st_size, iaddr);
+
+       /* We return the initrd size. */
        return len;
 }
 
+/* Once we know how much memory we have, and the address the Guest kernel
+ * expects, we can construct simple linear page tables which will get the Guest
+ * far enough into the boot to create its own.
+ *
+ * We lay them out of the way, just below the initrd (which is why we need to
+ * know its size). */
 static unsigned long setup_pagetables(unsigned long mem,
                                      unsigned long initrd_size,
                                      unsigned long page_offset)
@@ -282,23 +442,32 @@ static unsigned long setup_pagetables(unsigned long mem,
        unsigned int mapped_pages, i, linear_pages;
        unsigned int ptes_per_page = getpagesize()/sizeof(u32);
 
-       /* If we can map all of memory above page_offset, we do so. */
+       /* Ideally we map all physical memory starting at page_offset.
+        * However, if page_offset is 0xC0000000 we can only map 1G of physical
+        * (0xC0000000 + 1G overflows). */
        if (mem <= -page_offset)
                mapped_pages = mem/getpagesize();
        else
                mapped_pages = -page_offset/getpagesize();
 
-       /* Each linear PTE page can map ptes_per_page pages. */
+       /* Each PTE page can map ptes_per_page pages: how many do we need? */
        linear_pages = (mapped_pages + ptes_per_page-1)/ptes_per_page;
 
-       /* We lay out top-level then linear mapping immediately below initrd */
+       /* We put the toplevel page directory page at the top of memory. */
        pgdir = (void *)mem - initrd_size - getpagesize();
+
+       /* Now we use the next linear_pages pages as pte pages */
        linear = (void *)pgdir - linear_pages*getpagesize();
 
+       /* Linear mapping is easy: put every page's address into the mapping in
+        * order.  PAGE_PRESENT contains the flags Present, Writable and
+        * Executable. */
        for (i = 0; i < mapped_pages; i++)
                linear[i] = ((i * getpagesize()) | PAGE_PRESENT);
 
-       /* Now set up pgd so that this memory is at page_offset */
+       /* The top level points to the linear page table pages above.  The
+        * entry representing page_offset points to the first one, and they
+        * continue from there. */
        for (i = 0; i < mapped_pages; i += ptes_per_page) {
                pgdir[(i + page_offset/getpagesize())/ptes_per_page]
                        = (((u32)linear + i*sizeof(u32)) | PAGE_PRESENT);
@@ -307,9 +476,13 @@ static unsigned long setup_pagetables(unsigned long mem,
        verbose("Linear mapping of %u pages in %u pte pages at %p\n",
                mapped_pages, linear_pages, linear);
 
+       /* We return the top level (guest-physical) address: the kernel needs
+        * to know where it is. */
        return (unsigned long)pgdir;
 }
 
+/* Simple routine to roll all the commandline arguments together with spaces
+ * between them. */
 static void concat(char *dst, char *args[])
 {
        unsigned int i, len = 0;
@@ -323,6 +496,10 @@ static void concat(char *dst, char *args[])
        dst[len] = '\0';
 }
 
+/* This is where we actually tell the kernel to initialize the Guest.  We saw
+ * the arguments it expects when we looked at initialize() in lguest_user.c:
+ * the top physical page to allow, the top level pagetable, the entry point and
+ * the page_offset constant for the Guest. */
 static int tell_kernel(u32 pgdir, u32 start, u32 page_offset)
 {
        u32 args[] = { LHREQ_INITIALIZE,
@@ -332,8 +509,11 @@ static int tell_kernel(u32 pgdir, u32 start, u32 page_offset)
        fd = open_or_die("/dev/lguest", O_RDWR);
        if (write(fd, args, sizeof(args)) < 0)
                err(1, "Writing to /dev/lguest");
+
+       /* We return the /dev/lguest file descriptor to control this Guest */
        return fd;
 }
+/*:*/
 
 static void set_fd(int fd, struct device_list *devices)
 {
@@ -342,61 +522,108 @@ static void set_fd(int fd, struct device_list *devices)
                devices->max_infd = fd;
 }
 
-/* When input arrives, we tell the kernel to kick lguest out with -EAGAIN. */
+/*L:200
+ * The Waker.
+ *
+ * With a console and network devices, we can have lots of input which we need
+ * to process.  We could try to tell the kernel what file descriptors to watch,
+ * but handing a file descriptor mask through to the kernel is fairly icky.
+ *
+ * Instead, we fork off a process which watches the file descriptors and writes
+ * the LHREQ_BREAK command to the /dev/lguest filedescriptor to tell the Host
+ * loop to stop running the Guest.  This causes it to return from the
+ * /dev/lguest read with -EAGAIN, where it will write to /dev/lguest to reset
+ * the LHREQ_BREAK and wake us up again.
+ *
+ * This, of course, is merely a different *kind* of icky.
+ */
 static void wake_parent(int pipefd, int lguest_fd, struct device_list *devices)
 {
+       /* Add the pipe from the Launcher to the fdset in the device_list, so
+        * we watch it, too. */
        set_fd(pipefd, devices);
 
        for (;;) {
                fd_set rfds = devices->infds;
                u32 args[] = { LHREQ_BREAK, 1 };
 
+               /* Wait until input is ready from one of the devices. */
                select(devices->max_infd+1, &rfds, NULL, NULL, NULL);
+               /* Is it a message from the Launcher? */
                if (FD_ISSET(pipefd, &rfds)) {
                        int ignorefd;
+                       /* If read() returns 0, it means the Launcher has
+                        * exited.  We silently follow. */
                        if (read(pipefd, &ignorefd, sizeof(ignorefd)) == 0)
                                exit(0);
+                       /* Otherwise it's telling us there's a problem with one
+                        * of the devices, and we should ignore that file
+                        * descriptor from now on. */
                        FD_CLR(ignorefd, &devices->infds);
-               } else
+               } else /* Send LHREQ_BREAK command. */
                        write(lguest_fd, args, sizeof(args));
        }
 }
 
+/* This routine just sets up a pipe to the Waker process. */
 static int setup_waker(int lguest_fd, struct device_list *device_list)
 {
        int pipefd[2], child;
 
+       /* We create a pipe to talk to the waker, and also so it knows when the
+        * Launcher dies (and closes pipe). */
        pipe(pipefd);
        child = fork();
        if (child == -1)
                err(1, "forking");
 
        if (child == 0) {
+               /* Close the "writing" end of our copy of the pipe */
                close(pipefd[1]);
                wake_parent(pipefd[0], lguest_fd, device_list);
        }
+       /* Close the reading end of our copy of the pipe. */
        close(pipefd[0]);
 
+       /* Here is the fd used to talk to the waker. */
        return pipefd[1];
 }
 
+/*L:210
+ * Device Handling.
+ *
+ * When the Guest sends DMA to us, it sends us an array of addresses and sizes.
+ * We need to make sure it's not trying to reach into the Launcher itself, so
+ * we have a convenient routine which check it and exits with an error message
+ * if something funny is going on:
+ */
 static void *_check_pointer(unsigned long addr, unsigned int size,
                            unsigned int line)
 {
+       /* We have to separately check addr and addr+size, because size could
+        * be huge and addr + size might wrap around. */
        if (addr >= top || addr + size >= top)
                errx(1, "%s:%i: Invalid address %li", __FILE__, line, addr);
+       /* We return a pointer for the caller's convenience, now we know it's
+        * safe to use. */
        return (void *)addr;
 }
+/* A macro which transparently hands the line number to the real function. */
 #define check_pointer(addr,size) _check_pointer(addr, size, __LINE__)
 
-/* Returns pointer to dma->used_len */
+/* The Guest has given us the address of a "struct lguest_dma".  We check it's
+ * OK and convert it to an iovec (which is a simple array of ptr/size
+ * pairs). */
 static u32 *dma2iov(unsigned long dma, struct iovec iov[], unsigned *num)
 {
        unsigned int i;
        struct lguest_dma *udma;
 
+       /* First we make sure that the array memory itself is valid. */
        udma = check_pointer(dma, sizeof(*udma));
+       /* Now we check each element */
        for (i = 0; i < LGUEST_MAX_DMA_SECTIONS; i++) {
+               /* A zero length ends the array. */
                if (!udma->len[i])
                        break;
 
@@ -404,9 +631,15 @@ static u32 *dma2iov(unsigned long dma, struct iovec iov[], unsigned *num)
                iov[i].iov_len = udma->len[i];
        }
        *num = i;
+
+       /* We return the pointer to where the caller should write the amount of
+        * the buffer used. */
        return &udma->used_len;
 }
 
+/* This routine gets a DMA buffer from the Guest for a given key, and converts
+ * it to an iovec array.  It returns the interrupt the Guest wants when we're
+ * finished, and a pointer to the "used_len" field to fill in. */
 static u32 *get_dma_buffer(int fd, void *key,
                           struct iovec iov[], unsigned int *num, u32 *irq)
 {
@@ -414,16 +647,21 @@ static u32 *get_dma_buffer(int fd, void *key,
        unsigned long udma;
        u32 *res;
 
+       /* Ask the kernel for a DMA buffer corresponding to this key. */
        udma = write(fd, buf, sizeof(buf));
+       /* They haven't registered any, or they're all used? */
        if (udma == (unsigned long)-1)
                return NULL;
 
-       /* Kernel stashes irq in ->used_len. */
+       /* Convert it into our iovec array */
        res = dma2iov(udma, iov, num);
+       /* The kernel stashes irq in ->used_len to get it out to us. */
        *irq = *res;
+       /* Return a pointer to ((struct lguest_dma *)udma)->used_len. */
        return res;
 }
 
+/* This is a convenient routine to send the Guest an interrupt. */
 static void trigger_irq(int fd, u32 irq)
 {
        u32 buf[] = { LHREQ_IRQ, irq };
@@ -431,6 +669,10 @@ static void trigger_irq(int fd, u32 irq)
                err(1, "Triggering irq %i", irq);
 }
 
+/* This simply sets up an iovec array where we can put data to be discarded.
+ * This happens when the Guest doesn't want or can't handle the input: we have
+ * to get rid of it somewhere, and if we bury it in the ceiling space it will
+ * start to smell after a week. */
 static void discard_iovec(struct iovec *iov, unsigned int *num)
 {
        static char discard_buf[1024];
@@ -439,19 +681,24 @@ static void discard_iovec(struct iovec *iov, unsigned int *num)
        iov->iov_len = sizeof(discard_buf);
 }
 
+/* Here is the input terminal setting we save, and the routine to restore them
+ * on exit so the user can see what they type next. */
 static struct termios orig_term;
 static void restore_term(void)
 {
        tcsetattr(STDIN_FILENO, TCSANOW, &orig_term);
 }
 
+/* We associate some data with the console for our exit hack. */
 struct console_abort
 {
+       /* How many times have they hit ^C? */
        int count;
+       /* When did they start? */
        struct timeval start;
 };
 
-/* We DMA input to buffer bound at start of console page. */
+/* This is the routine which handles console input (ie. stdin). */
 static bool handle_console_input(int fd, struct device *dev)
 {
        u32 irq = 0, *lenp;
@@ -460,24 +707,38 @@ static bool handle_console_input(int fd, struct device *dev)
        struct iovec iov[LGUEST_MAX_DMA_SECTIONS];
        struct console_abort *abort = dev->priv;
 
+       /* First we get the console buffer from the Guest.  The key is dev->mem
+        * which was set to 0 in setup_console(). */
        lenp = get_dma_buffer(fd, dev->mem, iov, &num, &irq);
        if (!lenp) {
+               /* If it's not ready for input, warn and set up to discard. */
                warn("console: no dma buffer!");
                discard_iovec(iov, &num);
        }
 
+       /* This is why we convert to iovecs: the readv() call uses them, and so
+        * it reads straight into the Guest's buffer. */
        len = readv(dev->fd, iov, num);
        if (len <= 0) {
+               /* This implies that the console is closed, is /dev/null, or
+                * something went terribly wrong.  We still go through the rest
+                * of the logic, though, especially the exit handling below. */
                warnx("Failed to get console input, ignoring console.");
                len = 0;
        }
 
+       /* If we read the data into the Guest, fill in the length and send the
+        * interrupt. */
        if (lenp) {
                *lenp = len;
                trigger_irq(fd, irq);
        }
 
-       /* Three ^C within one second?  Exit. */
+       /* Three ^C within one second?  Exit.
+        *
+        * This is such a hack, but works surprisingly well.  Each ^C has to be
+        * in a buffer by itself, so they can't be too fast.  But we check that
+        * we get three within about a second, so they can't be too slow. */
        if (len == 1 && ((char *)iov[0].iov_base)[0] == 3) {
                if (!abort->count++)
                        gettimeofday(&abort->start, NULL);
@@ -485,43 +746,60 @@ static bool handle_console_input(int fd, struct device *dev)
                        struct timeval now;
                        gettimeofday(&now, NULL);
                        if (now.tv_sec <= abort->start.tv_sec+1) {
-                               /* Make sure waker is not blocked in BREAK */
                                u32 args[] = { LHREQ_BREAK, 0 };
+                               /* Close the fd so Waker will know it has to
+                                * exit. */
                                close(waker_fd);
+                               /* Just in case waker is blocked in BREAK, send
+                                * unbreak now. */
                                write(fd, args, sizeof(args));
                                exit(2);
                        }
                        abort->count = 0;
                }
        } else
+               /* Any other key resets the abort counter. */
                abort->count = 0;
 
+       /* Now, if we didn't read anything, put the input terminal back and
+        * return failure (meaning, don't call us again). */
        if (!len) {
                restore_term();
                return false;
        }
+       /* Everything went OK! */
        return true;
 }
 
+/* Handling console output is much simpler than input. */
 static u32 handle_console_output(int fd, const struct iovec *iov,
                                 unsigned num, struct device*dev)
 {
+       /* Whatever the Guest sends, write it to standard output.  Return the
+        * number of bytes written. */
        return writev(STDOUT_FILENO, iov, num);
 }
 
+/* Guest->Host network output is also pretty easy. */
 static u32 handle_tun_output(int fd, const struct iovec *iov,
                             unsigned num, struct device *dev)
 {
-       /* Now we've seen output, we should warn if we can't get buffers. */
+       /* We put a flag in the "priv" pointer of the network device, and set
+        * it as soon as we see output.  We'll see why in handle_tun_input() */
        *(bool *)dev->priv = true;
+       /* Whatever packet the Guest sent us, write it out to the tun
+        * device. */
        return writev(dev->fd, iov, num);
 }
 
+/* This matches the peer_key() in lguest_net.c.  The key for any given slot
+ * is the address of the network device's page plus 4 * the slot number. */
 static unsigned long peer_offset(unsigned int peernum)
 {
        return 4 * peernum;
 }
 
+/* This is where we handle a packet coming in from the tun device */
 static bool handle_tun_input(int fd, struct device *dev)
 {
        u32 irq = 0, *lenp;
@@ -529,17 +807,28 @@ static bool handle_tun_input(int fd, struct device *dev)
        unsigned num;
        struct iovec iov[LGUEST_MAX_DMA_SECTIONS];
 
+       /* First we get a buffer the Guest has bound to its key. */
        lenp = get_dma_buffer(fd, dev->mem+peer_offset(NET_PEERNUM), iov, &num,
                              &irq);
        if (!lenp) {
+               /* Now, it's expected that if we try to send a packet too
+                * early, the Guest won't be ready yet.  This is why we set a
+                * flag when the Guest sends its first packet.  If it's sent a
+                * packet we assume it should be ready to receive them.
+                *
+                * Actually, this is what the status bits in the descriptor are
+                * for: we should *use* them.  FIXME! */
                if (*(bool *)dev->priv)
                        warn("network: no dma buffer!");
                discard_iovec(iov, &num);
        }
 
+       /* Read the packet from the device directly into the Guest's buffer. */
        len = readv(dev->fd, iov, num);
        if (len <= 0)
                err(1, "reading network");
+
+       /* Write the used_len, and trigger the interrupt for the Guest */
        if (lenp) {
                *lenp = len;
                trigger_irq(fd, irq);
@@ -547,9 +836,13 @@ static bool handle_tun_input(int fd, struct device *dev)
        verbose("tun input packet len %i [%02x %02x] (%s)\n", len,
                ((u8 *)iov[0].iov_base)[0], ((u8 *)iov[0].iov_base)[1],
                lenp ? "sent" : "discarded");
+       /* All good. */
        return true;
 }
 
+/* The last device handling routine is block output: the Guest has sent a DMA
+ * to the block device.  It will have placed the command it wants in the
+ * "struct lguest_block_page". */
 static u32 handle_block_output(int fd, const struct iovec *iov,
                               unsigned num, struct device *dev)
 {
@@ -559,36 +852,64 @@ static u32 handle_block_output(int fd, const struct iovec *iov,
        struct iovec reply[LGUEST_MAX_DMA_SECTIONS];
        off64_t device_len, off = (off64_t)p->sector * 512;
 
+       /* First we extract the device length from the dev->priv pointer. */
        device_len = *(off64_t *)dev->priv;
 
+       /* We first check that the read or write is within the length of the
+        * block file. */
        if (off >= device_len)
                err(1, "Bad offset %llu vs %llu", off, device_len);
+       /* Move to the right location in the block file.  This shouldn't fail,
+        * but best to check. */
        if (lseek64(dev->fd, off, SEEK_SET) != off)
                err(1, "Bad seek to sector %i", p->sector);
 
        verbose("Block: %s at offset %llu\n", p->type ? "WRITE" : "READ", off);
 
+       /* They were supposed to bind a reply buffer at key equal to the start
+        * of the block device memory.  We need this to tell them when the
+        * request is finished. */
        lenp = get_dma_buffer(fd, dev->mem, reply, &reply_num, &irq);
        if (!lenp)
                err(1, "Block request didn't give us a dma buffer");
 
        if (p->type) {
+               /* A write request.  The DMA they sent contained the data, so
+                * write it out. */
                len = writev(dev->fd, iov, num);
+               /* Grr... Now we know how long the "struct lguest_dma" they
+                * sent was, we make sure they didn't try to write over the end
+                * of the block file (possibly extending it). */
                if (off + len > device_len) {
+                       /* Trim it back to the correct length */
                        ftruncate(dev->fd, device_len);
+                       /* Die, bad Guest, die. */
                        errx(1, "Write past end %llu+%u", off, len);
                }
+               /* The reply length is 0: we just send back an empty DMA to
+                * interrupt them and tell them the write is finished. */
                *lenp = 0;
        } else {
+               /* A read request.  They sent an empty DMA to start the
+                * request, and we put the read contents into the reply
+                * buffer. */
                len = readv(dev->fd, reply, reply_num);
                *lenp = len;
        }
 
+       /* The result is 1 (done), 2 if there was an error (short read or
+        * write). */
        p->result = 1 + (p->bytes != len);
+       /* Now tell them we've used their reply buffer. */
        trigger_irq(fd, irq);
+
+       /* We're supposed to return the number of bytes of the output buffer we
+        * used.  But the block device uses the "result" field instead, so we
+        * don't bother. */
        return 0;
 }
 
+/* This is the generic routine we call when the Guest sends some DMA out. */
 static void handle_output(int fd, unsigned long dma, unsigned long key,
                          struct device_list *devices)
 {
@@ -597,30 +918,53 @@ static void handle_output(int fd, unsigned long dma, unsigned long key,
        struct iovec iov[LGUEST_MAX_DMA_SECTIONS];
        unsigned num = 0;
 
+       /* Convert the "struct lguest_dma" they're sending to a "struct
+        * iovec". */
        lenp = dma2iov(dma, iov, &num);
+
+       /* Check each device: if they expect output to this key, tell them to
+        * handle it. */
        for (i = devices->dev; i; i = i->next) {
                if (i->handle_output && key == i->watch_key) {
+                       /* We write the result straight into the used_len field
+                        * for them. */
                        *lenp = i->handle_output(fd, iov, num, i);
                        return;
                }
        }
+
+       /* This can happen: the kernel sends any SEND_DMA which doesn't match
+        * another Guest to us.  It could be that another Guest just left a
+        * network, for example.  But it's unusual. */
        warnx("Pending dma %p, key %p", (void *)dma, (void *)key);
 }
 
+/* This is called when the waker wakes us up: check for incoming file
+ * descriptors. */
 static void handle_input(int fd, struct device_list *devices)
 {
+       /* select() wants a zeroed timeval to mean "don't wait". */
        struct timeval poll = { .tv_sec = 0, .tv_usec = 0 };
 
        for (;;) {
                struct device *i;
                fd_set fds = devices->infds;
 
+               /* If nothing is ready, we're done. */
                if (select(devices->max_infd+1, &fds, NULL, NULL, &poll) == 0)
                        break;
 
+               /* Otherwise, call the device(s) which have readable
+                * file descriptors and a method of handling them.  */
                for (i = devices->dev; i; i = i->next) {
                        if (i->handle_input && FD_ISSET(i->fd, &fds)) {
+                               /* If handle_input() returns false, it means we
+                                * should no longer service it.
+                                * handle_console_input() does this. */
                                if (!i->handle_input(fd, i)) {
+                                       /* Clear it from the set of input file
+                                        * descriptors kept at the head of the
+                                        * device list. */
                                        FD_CLR(i->fd, &devices->infds);
                                        /* Tell waker to ignore it too... */
                                        write(waker_fd, &i->fd, sizeof(i->fd));
@@ -630,6 +974,15 @@ static void handle_input(int fd, struct device_list *devices)
        }
 }
 
+/*L:190
+ * Device Setup
+ *
+ * All devices need a descriptor so the Guest knows it exists, and a "struct
+ * device" so the Launcher can keep track of it.  We have common helper
+ * routines to allocate them.
+ *
+ * This routine allocates a new "struct lguest_device_desc" from descriptor
+ * table in the devices array just above the Guest's normal memory. */
 static struct lguest_device_desc *
 new_dev_desc(struct lguest_device_desc *descs,
             u16 type, u16 features, u16 num_pages)
@@ -641,6 +994,8 @@ new_dev_desc(struct lguest_device_desc *descs,
                        descs[i].type = type;
                        descs[i].features = features;
                        descs[i].num_pages = num_pages;
+                       /* If they said the device needs memory, we allocate
+                        * that now, bumping up the top of Guest memory. */
                        if (num_pages) {
                                map_zeroed_pages(top, num_pages);
                                descs[i].pfn = top/getpagesize();
@@ -652,6 +1007,9 @@ new_dev_desc(struct lguest_device_desc *descs,
        errx(1, "too many devices");
 }
 
+/* This monster routine does all the creation and setup of a new device,
+ * including caling new_dev_desc() to allocate the descriptor and device
+ * memory. */
 static struct device *new_device(struct device_list *devices,
                                 u16 type, u16 num_pages, u16 features,
                                 int fd,
@@ -664,12 +1022,18 @@ static struct device *new_device(struct device_list *devices,
 {
        struct device *dev = malloc(sizeof(*dev));
 
-       /* Append to device list. */
+       /* Append to device list.  Prepending to a single-linked list is
+        * easier, but the user expects the devices to be arranged on the bus
+        * in command-line order.  The first network device on the command line
+        * is eth0, the first block device /dev/lgba, etc. */
        *devices->lastdev = dev;
        dev->next = NULL;
        devices->lastdev = &dev->next;
 
+       /* Now we populate the fields one at a time. */
        dev->fd = fd;
+       /* If we have an input handler for this file descriptor, then we add it
+        * to the device_list's fdset and maxfd. */
        if (handle_input)
                set_fd(dev->fd, devices);
        dev->desc = new_dev_desc(devices->descs, type, features, num_pages);
@@ -680,27 +1044,37 @@ static struct device *new_device(struct device_list *devices,
        return dev;
 }
 
+/* Our first setup routine is the console.  It's a fairly simple device, but
+ * UNIX tty handling makes it uglier than it could be. */
 static void setup_console(struct device_list *devices)
 {
        struct device *dev;
 
+       /* If we can save the initial standard input settings... */
        if (tcgetattr(STDIN_FILENO, &orig_term) == 0) {
                struct termios term = orig_term;
+               /* Then we turn off echo, line buffering and ^C etc.  We want a
+                * raw input stream to the Guest. */
                term.c_lflag &= ~(ISIG|ICANON|ECHO);
                tcsetattr(STDIN_FILENO, TCSANOW, &term);
+               /* If we exit gracefully, the original settings will be
+                * restored so the user can see what they're typing. */
                atexit(restore_term);
        }
 
-       /* We don't currently require a page for the console. */
+       /* We don't currently require any memory for the console, so we ask for
+        * 0 pages. */
        dev = new_device(devices, LGUEST_DEVICE_T_CONSOLE, 0, 0,
                         STDIN_FILENO, handle_console_input,
                         LGUEST_CONSOLE_DMA_KEY, handle_console_output);
+       /* We store the console state in dev->priv, and initialize it. */
        dev->priv = malloc(sizeof(struct console_abort));
        ((struct console_abort *)dev->priv)->count = 0;
        verbose("device %p: console\n",
                (void *)(dev->desc->pfn * getpagesize()));
 }
 
+/* Setting up a block file is also fairly straightforward. */
 static void setup_block_file(const char *filename, struct device_list *devices)
 {
        int fd;
@@ -708,20 +1082,47 @@ static void setup_block_file(const char *filename, struct device_list *devices)
        off64_t *device_len;
        struct lguest_block_page *p;
 
+       /* We open with O_LARGEFILE because otherwise we get stuck at 2G.  We
+        * open with O_DIRECT because otherwise our benchmarks go much too
+        * fast. */
        fd = open_or_die(filename, O_RDWR|O_LARGEFILE|O_DIRECT);
+
+       /* We want one page, and have no input handler (the block file never
+        * has anything interesting to say to us).  Our timing will be quite
+        * random, so it should be a reasonable randomness source. */
        dev = new_device(devices, LGUEST_DEVICE_T_BLOCK, 1,
                         LGUEST_DEVICE_F_RANDOMNESS,
                         fd, NULL, 0, handle_block_output);
+
+       /* We store the device size in the private area */
        device_len = dev->priv = malloc(sizeof(*device_len));
+       /* This is the safe way of establishing the size of our device: it
+        * might be a normal file or an actual block device like /dev/hdb. */
        *device_len = lseek64(fd, 0, SEEK_END);
-       p = dev->mem;
 
+       /* The device memory is a "struct lguest_block_page".  It's zeroed
+        * already, we just need to put in the device size.  Block devices
+        * think in sectors (ie. 512 byte chunks), so we translate here. */
+       p = dev->mem;
        p->num_sectors = *device_len/512;
        verbose("device %p: block %i sectors\n",
                (void *)(dev->desc->pfn * getpagesize()), p->num_sectors);
 }
 
-/* We use fnctl locks to reserve network slots (autocleanup!) */
+/*
+ * Network Devices.
+ *
+ * Setting up network devices is quite a pain, because we have three types.
+ * First, we have the inter-Guest network.  This is a file which is mapped into
+ * the address space of the Guests who are on the network.  Because it is a
+ * shared mapping, the same page underlies all the devices, and they can send
+ * DMA to each other.
+ *
+ * Remember from our network driver, the Guest is told what slot in the page it
+ * is to use.  We use exclusive fnctl locks to reserve a slot.  If another
+ * Guest is using a slot, the lock will fail and we try another.  Because fnctl
+ * locks are cleaned up automatically when we die, this cleverly means that our
+ * reservation on the slot will vanish if we crash. */
 static unsigned int find_slot(int netfd, const char *filename)
 {
        struct flock fl;
@@ -729,26 +1130,33 @@ static unsigned int find_slot(int netfd, const char *filename)
        fl.l_type = F_WRLCK;
        fl.l_whence = SEEK_SET;
        fl.l_len = 1;
+       /* Try a 1 byte lock in each possible position number */
        for (fl.l_start = 0;
             fl.l_start < getpagesize()/sizeof(struct lguest_net);
             fl.l_start++) {
+               /* If we succeed, return the slot number. */
                if (fcntl(netfd, F_SETLK, &fl) == 0)
                        return fl.l_start;
        }
        errx(1, "No free slots in network file %s", filename);
 }
 
+/* This function sets up the network file */
 static void setup_net_file(const char *filename,
                           struct device_list *devices)
 {
        int netfd;
        struct device *dev;
 
+       /* We don't use open_or_die() here: for friendliness we create the file
+        * if it doesn't already exist. */
        netfd = open(filename, O_RDWR, 0);
        if (netfd < 0) {
                if (errno == ENOENT) {
                        netfd = open(filename, O_RDWR|O_CREAT, 0600);
                        if (netfd >= 0) {
+                               /* If we succeeded, initialize the file with a
+                                * blank page. */
                                char page[getpagesize()];
                                memset(page, 0, sizeof(page));
                                write(netfd, page, sizeof(page));
@@ -758,11 +1166,15 @@ static void setup_net_file(const char *filename,
                        err(1, "cannot open net file '%s'", filename);
        }
 
+       /* We need 1 page, and the features indicate the slot to use and that
+        * no checksum is needed.  We never touch this device again; it's
+        * between the Guests on the network, so we don't register input or
+        * output handlers. */
        dev = new_device(devices, LGUEST_DEVICE_T_NET, 1,
                         find_slot(netfd, filename)|LGUEST_NET_F_NOCSUM,
                         -1, NULL, 0, NULL);
 
-       /* We overwrite the /dev/zero mapping with the actual file. */
+       /* Map the shared file. */
        if (mmap(dev->mem, getpagesize(), PROT_READ|PROT_WRITE,
                         MAP_FIXED|MAP_SHARED, netfd, 0) != dev->mem)
                        err(1, "could not mmap '%s'", filename);
@@ -770,6 +1182,7 @@ static void setup_net_file(const char *filename,
                (void *)(dev->desc->pfn * getpagesize()), filename,
                dev->desc->features & ~LGUEST_NET_F_NOCSUM);
 }
+/*:*/
 
 static u32 str2ip(const char *ipaddr)
 {
@@ -779,7 +1192,11 @@ static u32 str2ip(const char *ipaddr)
        return (byte[0] << 24) | (byte[1] << 16) | (byte[2] << 8) | byte[3];
 }
 
-/* adapted from libbridge */
+/* This code is "adapted" from libbridge: it attaches the Host end of the
+ * network device to the bridge device specified by the command line.
+ *
+ * This is yet another James Morris contribution (I'm an IP-level guy, so I
+ * dislike bridging), and I just try not to break it. */
 static void add_to_bridge(int fd, const char *if_name, const char *br_name)
 {
        int ifidx;
@@ -798,12 +1215,16 @@ static void add_to_bridge(int fd, const char *if_name, const char *br_name)
                err(1, "can't add %s to bridge %s", if_name, br_name);
 }
 
+/* This sets up the Host end of the network device with an IP address, brings
+ * it up so packets will flow, the copies the MAC address into the hwaddr
+ * pointer (in practice, the Host's slot in the network device's memory). */
 static void configure_device(int fd, const char *devname, u32 ipaddr,
                             unsigned char hwaddr[6])
 {
        struct ifreq ifr;
        struct sockaddr_in *sin = (struct sockaddr_in *)&ifr.ifr_addr;
 
+       /* Don't read these incantations.  Just cut & paste them like I did! */
        memset(&ifr, 0, sizeof(ifr));
        strcpy(ifr.ifr_name, devname);
        sin->sin_family = AF_INET;
@@ -814,12 +1235,19 @@ static void configure_device(int fd, const char *devname, u32 ipaddr,
        if (ioctl(fd, SIOCSIFFLAGS, &ifr) != 0)
                err(1, "Bringing interface %s up", devname);
 
+       /* SIOC stands for Socket I/O Control.  G means Get (vs S for Set
+        * above).  IF means Interface, and HWADDR is hardware address.
+        * Simple! */
        if (ioctl(fd, SIOCGIFHWADDR, &ifr) != 0)
                err(1, "getting hw address for %s", devname);
-
        memcpy(hwaddr, ifr.ifr_hwaddr.sa_data, 6);
 }
 
+/*L:195 The other kind of network is a Host<->Guest network.  This can either
+ * use briding or routing, but the principle is the same: it uses the "tun"
+ * device to inject packets into the Host as if they came in from a normal
+ * network card.  We just shunt packets between the Guest and the tun
+ * device. */
 static void setup_tun_net(const char *arg, struct device_list *devices)
 {
        struct device *dev;
@@ -828,36 +1256,56 @@ static void setup_tun_net(const char *arg, struct device_list *devices)
        u32 ip;
        const char *br_name = NULL;
 
+       /* We open the /dev/net/tun device and tell it we want a tap device.  A
+        * tap device is like a tun device, only somehow different.  To tell
+        * the truth, I completely blundered my way through this code, but it
+        * works now! */
        netfd = open_or_die("/dev/net/tun", O_RDWR);
        memset(&ifr, 0, sizeof(ifr));
        ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
        strcpy(ifr.ifr_name, "tap%d");
        if (ioctl(netfd, TUNSETIFF, &ifr) != 0)
                err(1, "configuring /dev/net/tun");
+       /* We don't need checksums calculated for packets coming in this
+        * device: trust us! */
        ioctl(netfd, TUNSETNOCSUM, 1);
 
-       /* You will be peer 1: we should create enough jitter to randomize */
+       /* We create the net device with 1 page, using the features field of
+        * the descriptor to tell the Guest it is in slot 1 (NET_PEERNUM), and
+        * that the device has fairly random timing.  We do *not* specify
+        * LGUEST_NET_F_NOCSUM: these packets can reach the real world.
+        *
+        * We will put our MAC address is slot 0 for the Guest to see, so
+        * it will send packets to us using the key "peer_offset(0)": */
        dev = new_device(devices, LGUEST_DEVICE_T_NET, 1,
                         NET_PEERNUM|LGUEST_DEVICE_F_RANDOMNESS, netfd,
                         handle_tun_input, peer_offset(0), handle_tun_output);
+
+       /* We keep a flag which says whether we've seen packets come out from
+        * this network device. */
        dev->priv = malloc(sizeof(bool));
        *(bool *)dev->priv = false;
 
+       /* We need a socket to perform the magic network ioctls to bring up the
+        * tap interface, connect to the bridge etc.  Any socket will do! */
        ipfd = socket(PF_INET, SOCK_DGRAM, IPPROTO_IP);
        if (ipfd < 0)
                err(1, "opening IP socket");
 
+       /* If the command line was --tunnet=bridge:<name> do bridging. */
        if (!strncmp(BRIDGE_PFX, arg, strlen(BRIDGE_PFX))) {
                ip = INADDR_ANY;
                br_name = arg + strlen(BRIDGE_PFX);
                add_to_bridge(ipfd, ifr.ifr_name, br_name);
-       } else
+       } else /* It is an IP address to set up the device with */
                ip = str2ip(arg);
 
-       /* We are peer 0, ie. first slot. */
+       /* We are peer 0, ie. first slot, so we hand dev->mem to this routine
+        * to write the MAC address at the start of the device memory.  */
        configure_device(ipfd, ifr.ifr_name, ip, dev->mem);
 
-       /* Set "promisc" bit: we want every single packet. */
+       /* Set "promisc" bit: we want every single packet if we're going to
+        * bridge to other machines (and otherwise it doesn't matter). */
        *((u8 *)dev->mem) |= 0x1;
 
        close(ipfd);
@@ -868,7 +1316,10 @@ static void setup_tun_net(const char *arg, struct device_list *devices)
        if (br_name)
                verbose("attached to bridge: %s\n", br_name);
 }
+/* That's the end of device setup. */
 
+/*L:220 Finally we reach the core of the Launcher, which runs the Guest, serves
+ * its input and output, and finally, lays it to rest. */
 static void __attribute__((noreturn))
 run_guest(int lguest_fd, struct device_list *device_list)
 {
@@ -880,20 +1331,37 @@ run_guest(int lguest_fd, struct device_list *device_list)
                /* We read from the /dev/lguest device to run the Guest. */
                readval = read(lguest_fd, arr, sizeof(arr));
 
+               /* The read can only really return sizeof(arr) (the Guest did a
+                * SEND_DMA to us), or an error. */
+
+               /* For a successful read, arr[0] is the address of the "struct
+                * lguest_dma", and arr[1] is the key the Guest sent to. */
                if (readval == sizeof(arr)) {
                        handle_output(lguest_fd, arr[0], arr[1], device_list);
                        continue;
+               /* ENOENT means the Guest died.  Reading tells us why. */
                } else if (errno == ENOENT) {
                        char reason[1024] = { 0 };
                        read(lguest_fd, reason, sizeof(reason)-1);
                        errx(1, "%s", reason);
+               /* EAGAIN means the waker wanted us to look at some input.
+                * Anything else means a bug or incompatible change. */
                } else if (errno != EAGAIN)
                        err(1, "Running guest failed");
+
+               /* Service input, then unset the BREAK which releases
+                * the Waker. */
                handle_input(lguest_fd, device_list);
                if (write(lguest_fd, args, sizeof(args)) < 0)
                        err(1, "Resetting break");
        }
 }
+/*
+ * This is the end of the Launcher.
+ *
+ * But wait!  We've seen I/O from the Launcher, and we've seen I/O from the
+ * Drivers.  If we were to see the Host kernel I/O code, our understanding
+ * would be complete... :*/
 
 static struct option opts[] = {
        { "verbose", 0, NULL, 'v' },
@@ -911,20 +1379,49 @@ static void usage(void)
             "<mem-in-mb> vmlinux [args...]");
 }
 
+/*L:100 The Launcher code itself takes us out into userspace, that scary place
+ * where pointers run wild and free!  Unfortunately, like most userspace
+ * programs, it's quite boring (which is why everyone like to hack on the
+ * kernel!).  Perhaps if you make up an Lguest Drinking Game at this point, it
+ * will get you through this section.  Or, maybe not.
+ *
+ * The Launcher binary sits up high, usually starting at address 0xB8000000.
+ * Everything below this is the "physical" memory for the Guest.  For example,
+ * if the Guest were to write a "1" at physical address 0, we would see a "1"
+ * in the Launcher at "(int *)0".  Guest physical == Launcher virtual.
+ *
+ * This can be tough to get your head around, but usually it just means that we
+ * don't need to do any conversion when the Guest gives us it's "physical"
+ * addresses.
+ */
 int main(int argc, char *argv[])
 {
+       /* Memory, top-level pagetable, code startpoint, PAGE_OFFSET and size
+        * of the (optional) initrd. */
        unsigned long mem = 0, pgdir, start, page_offset, initrd_size = 0;
+       /* A temporary and the /dev/lguest file descriptor. */
        int i, c, lguest_fd;
+       /* The list of Guest devices, based on command line arguments. */
        struct device_list device_list;
+       /* The boot information for the Guest: at guest-physical address 0. */
        void *boot = (void *)0;
+       /* If they specify an initrd file to load. */
        const char *initrd_name = NULL;
 
+       /* First we initialize the device list.  Since console and network
+        * device receive input from a file descriptor, we keep an fdset
+        * (infds) and the maximum fd number (max_infd) with the head of the
+        * list.  We also keep a pointer to the last device, for easy appending
+        * to the list. */
        device_list.max_infd = -1;
        device_list.dev = NULL;
        device_list.lastdev = &device_list.dev;
        FD_ZERO(&device_list.infds);
 
-       /* We need to know how much memory so we can allocate devices. */
+       /* We need to know how much memory so we can set up the device
+        * descriptor and memory pages for the devices as we parse the command
+        * line.  So we quickly look through the arguments to find the amount
+        * of memory now. */
        for (i = 1; i < argc; i++) {
                if (argv[i][0] != '-') {
                        mem = top = atoi(argv[i]) * 1024 * 1024;
@@ -933,6 +1430,8 @@ int main(int argc, char *argv[])
                        break;
                }
        }
+
+       /* The options are fairly straight-forward */
        while ((c = getopt_long(argc, argv, "v", opts, NULL)) != EOF) {
                switch (c) {
                case 'v':
@@ -955,42 +1454,71 @@ int main(int argc, char *argv[])
                        usage();
                }
        }
+       /* After the other arguments we expect memory and kernel image name,
+        * followed by command line arguments for the kernel. */
        if (optind + 2 > argc)
                usage();
 
-       /* We need a console device */
+       /* We always have a console device */
        setup_console(&device_list);
 
-       /* First we map /dev/zero over all of guest-physical memory. */
+       /* We start by mapping anonymous pages over all of guest-physical
+        * memory range.  This fills it with 0, and ensures that the Guest
+        * won't be killed when it tries to access it. */
        map_zeroed_pages(0, mem / getpagesize());
 
        /* Now we load the kernel */
        start = load_kernel(open_or_die(argv[optind+1], O_RDONLY),
                            &page_offset);
 
-       /* Map the initrd image if requested */
+       /* Map the initrd image if requested (at top of physical memory) */
        if (initrd_name) {
                initrd_size = load_initrd(initrd_name, mem);
+               /* These are the location in the Linux boot header where the
+                * start and size of the initrd are expected to be found. */
                *(unsigned long *)(boot+0x218) = mem - initrd_size;
                *(unsigned long *)(boot+0x21c) = initrd_size;
+               /* The bootloader type 0xFF means "unknown"; that's OK. */
                *(unsigned char *)(boot+0x210) = 0xFF;
        }
 
-       /* Set up the initial linar pagetables. */
+       /* Set up the initial linear pagetables, starting below the initrd. */
        pgdir = setup_pagetables(mem, initrd_size, page_offset);
 
-       /* E820 memory map: ours is a simple, single region. */
+       /* The Linux boot header contains an "E820" memory map: ours is a
+        * simple, single region. */
        *(char*)(boot+E820NR) = 1;
        *((struct e820entry *)(boot+E820MAP))
                = ((struct e820entry) { 0, mem, E820_RAM });
-       /* Command line pointer and command line (at 4096) */
+       /* The boot header contains a command line pointer: we put the command
+        * line after the boot header (at address 4096) */
        *(void **)(boot + 0x228) = boot + 4096;
        concat(boot + 4096, argv+optind+2);
-       /* Paravirt type: 1 == lguest */
+
+       /* The guest type value of "1" tells the Guest it's under lguest. */
        *(int *)(boot + 0x23c) = 1;
 
+       /* We tell the kernel to initialize the Guest: this returns the open
+        * /dev/lguest file descriptor. */
        lguest_fd = tell_kernel(pgdir, start, page_offset);
+
+       /* We fork off a child process, which wakes the Launcher whenever one
+        * of the input file descriptors needs attention.  Otherwise we would
+        * run the Guest until it tries to output something. */
        waker_fd = setup_waker(lguest_fd, &device_list);
 
+       /* Finally, run the Guest.  This doesn't return. */
        run_guest(lguest_fd, &device_list);
 }
+/*:*/
+
+/*M:999
+ * Mastery is done: you now know everything I do.
+ *
+ * But surely you have seen code, features and bugs in your wanderings which
+ * you now yearn to attack?  That is the real game, and I look forward to you
+ * patching and forking lguest into the Your-Name-Here-visor.
+ *
+ * Farewell, and good coding!
+ * Rusty Russell.
+ */
diff --git a/Documentation/memory-hotplug.txt b/Documentation/memory-hotplug.txt
new file mode 100644 (file)
index 0000000..5fbcc22
--- /dev/null
@@ -0,0 +1,322 @@
+==============
+Memory Hotplug
+==============
+
+Last Updated: Jul 28 2007
+
+This document is about memory hotplug including how-to-use and current status.
+Because Memory Hotplug is still under development, contents of this text will
+be changed often.
+
+1. Introduction
+  1.1 purpose of memory hotplug
+  1.2. Phases of memory hotplug
+  1.3. Unit of Memory online/offline operation
+2. Kernel Configuration
+3. sysfs files for memory hotplug
+4. Physical memory hot-add phase
+  4.1 Hardware(Firmware) Support
+  4.2 Notify memory hot-add event by hand
+5. Logical Memory hot-add phase
+  5.1. State of memory
+  5.2. How to online memory
+6. Logical memory remove
+  6.1 Memory offline and ZONE_MOVABLE
+  6.2. How to offline memory
+7. Physical memory remove
+8. Future Work List
+
+Note(1): x86_64's has special implementation for memory hotplug.
+         This text does not describe it.
+Note(2): This text assumes that sysfs is mounted at /sys.
+
+
+---------------
+1. Introduction
+---------------
+
+1.1 purpose of memory hotplug
+------------
+Memory Hotplug allows users to increase/decrease the amount of memory.
+Generally, there are two purposes.
+
+(A) For changing the amount of memory.
+    This is to allow a feature like capacity on demand.
+(B) For installing/removing DIMMs or NUMA-nodes physically.
+    This is to exchange DIMMs/NUMA-nodes, reduce power consumption, etc.
+
+(A) is required by highly virtualized environments and (B) is required by
+hardware which supports memory power management.
+
+Linux memory hotplug is designed for both purpose.
+
+
+1.2. Phases of memory hotplug
+---------------
+There are 2 phases in Memory Hotplug.
+  1) Physical Memory Hotplug phase
+  2) Logical Memory Hotplug phase.
+
+The First phase is to communicate hardware/firmware and make/erase
+environment for hotplugged memory. Basically, this phase is necessary
+for the purpose (B), but this is good phase for communication between
+highly virtualized environments too.
+
+When memory is hotplugged, the kernel recognizes new memory, makes new memory
+management tables, and makes sysfs files for new memory's operation.
+
+If firmware supports notification of connection of new memory to OS,
+this phase is triggered automatically. ACPI can notify this event. If not,
+"probe" operation by system administration is used instead.
+(see Section 4.).
+
+Logical Memory Hotplug phase is to change memory state into
+avaiable/unavailable for users. Amount of memory from user's view is
+changed by this phase. The kernel makes all memory in it as free pages
+when a memory range is available.
+
+In this document, this phase is described as online/offline.
+
+Logical Memory Hotplug phase is triggred by write of sysfs file by system
+administrator. For the hot-add case, it must be executed after Physical Hotplug
+phase by hand.
+(However, if you writes udev's hotplug scripts for memory hotplug, these
+ phases can be execute in seamless way.)
+
+
+1.3. Unit of Memory online/offline operation
+------------
+Memory hotplug uses SPARSEMEM memory model. SPARSEMEM divides the whole memory
+into chunks of the same size. The chunk is called a "section". The size of
+a section is architecture dependent. For example, power uses 16MiB, ia64 uses
+1GiB. The unit of online/offline operation is "one section". (see Section 3.)
+
+To determine the size of sections, please read this file:
+
+/sys/devices/system/memory/block_size_bytes
+
+This file shows the size of sections in byte.
+
+-----------------------
+2. Kernel Configuration
+-----------------------
+To use memory hotplug feature, kernel must be compiled with following
+config options.
+
+- For all memory hotplug
+    Memory model -> Sparse Memory  (CONFIG_SPARSEMEM)
+    Allow for memory hot-add       (CONFIG_MEMORY_HOTPLUG)
+
+- To enable memory removal, the followings are also necessary
+    Allow for memory hot remove    (CONFIG_MEMORY_HOTREMOVE)
+    Page Migration                 (CONFIG_MIGRATION)
+
+- For ACPI memory hotplug, the followings are also necessary
+    Memory hotplug (under ACPI Support menu) (CONFIG_ACPI_HOTPLUG_MEMORY)
+    This option can be kernel module.
+
+- As a related configuration, if your box has a feature of NUMA-node hotplug
+  via ACPI, then this option is necessary too.
+    ACPI0004,PNP0A05 and PNP0A06 Container Driver (under ACPI Support menu)
+    (CONFIG_ACPI_CONTAINER).
+    This option can be kernel module too.
+
+--------------------------------
+3 sysfs files for memory hotplug
+--------------------------------
+All sections have their device information under /sys/devices/system/memory as
+
+/sys/devices/system/memory/memoryXXX
+(XXX is section id.)
+
+Now, XXX is defined as start_address_of_section / section_size.
+
+For example, assume 1GiB section size. A device for a memory starting at
+0x100000000 is /sys/device/system/memory/memory4
+(0x100000000 / 1Gib = 4)
+This device covers address range [0x100000000 ... 0x140000000)
+
+Under each section, you can see 3 files.
+
+/sys/devices/system/memory/memoryXXX/phys_index
+/sys/devices/system/memory/memoryXXX/phys_device
+/sys/devices/system/memory/memoryXXX/state
+
+'phys_index' : read-only and contains section id, same as XXX.
+'state'      : read-write
+               at read:  contains online/offline state of memory.
+               at write: user can specify "online", "offline" command
+'phys_device': read-only: designed to show the name of physical memory device.
+               This is not well implemented now.
+
+NOTE:
+  These directories/files appear after physical memory hotplug phase.
+
+
+--------------------------------
+4. Physical memory hot-add phase
+--------------------------------
+
+4.1 Hardware(Firmware) Support
+------------
+On x86_64/ia64 platform, memory hotplug by ACPI is supported.
+
+In general, the firmware (ACPI) which supports memory hotplug defines
+memory class object of _HID "PNP0C80". When a notify is asserted to PNP0C80,
+Linux's ACPI handler does hot-add memory to the system and calls a hotplug udev
+script. This will be done automatically.
+
+But scripts for memory hotplug are not contained in generic udev package(now).
+You may have to write it by yourself or online/offline memory by hand.
+Please see "How to online memory", "How to offline memory" in this text.
+
+If firmware supports NUMA-node hotplug, and defines an object _HID "ACPI0004",
+"PNP0A05", or "PNP0A06", notification is asserted to it, and ACPI handler
+calls hotplug code for all of objects which are defined in it.
+If memory device is found, memory hotplug code will be called.
+
+
+4.2 Notify memory hot-add event by hand
+------------
+In some environments, especially virtualized environment, firmware will not
+notify memory hotplug event to the kernel. For such environment, "probe"
+interface is supported. This interface depends on CONFIG_ARCH_MEMORY_PROBE.
+
+Now, CONFIG_ARCH_MEMORY_PROBE is supported only by powerpc but it does not
+contain highly architecture codes. Please add config if you need "probe"
+interface.
+
+Probe interface is located at
+/sys/devices/system/memory/probe
+
+You can tell the physical address of new memory to the kernel by
+
+% echo start_address_of_new_memory > /sys/devices/system/memory/probe
+
+Then, [start_address_of_new_memory, start_address_of_new_memory + section_size)
+memory range is hot-added. In this case, hotplug script is not called (in
+current implementation). You'll have to online memory by yourself.
+Please see "How to online memory" in this text.
+
+
+
+------------------------------
+5. Logical Memory hot-add phase
+------------------------------
+
+5.1. State of memory
+------------
+To see (online/offline) state of memory section, read 'state' file.
+
+% cat /sys/device/system/memory/memoryXXX/state
+
+
+If the memory section is online, you'll read "online".
+If the memory section is offline, you'll read "offline".
+
+
+5.2. How to online memory
+------------
+Even if the memory is hot-added, it is not at ready-to-use state.
+For using newly added memory, you have to "online" the memory section.
+
+For onlining, you have to write "online" to the section's state file as:
+
+% echo online > /sys/devices/system/memory/memoryXXX/state
+
+After this, section memoryXXX's state will be 'online' and the amount of
+available memory will be increased.
+
+Currently, newly added memory is added as ZONE_NORMAL (for powerpc, ZONE_DMA).
+This may be changed in future.
+
+
+
+------------------------
+6. Logical memory remove
+------------------------
+
+6.1 Memory offline and ZONE_MOVABLE
+------------
+Memory offlining is more complicated than memory online. Because memory offline
+has to make the whole memory section be unused, memory offline can fail if
+the section includes memory which cannot be freed.
+
+In general, memory offline can use 2 techniques.
+
+(1) reclaim and free all memory in the section.
+(2) migrate all pages in the section.
+
+In the current implementation, Linux's memory offline uses method (2), freeing
+all  pages in the section by page migration. But not all pages are
+migratable. Under current Linux, migratable pages are anonymous pages and
+page caches. For offlining a section by migration, the kernel has to guarantee
+that the section contains only migratable pages.
+
+Now, a boot option for making a section which consists of migratable pages is
+supported. By specifying "kernelcore=" or "movablecore=" boot option, you can
+create ZONE_MOVABLE...a zone which is just used for movable pages.
+(See also Documentation/kernel-parameters.txt)
+
+Assume the system has "TOTAL" amount of memory at boot time, this boot option
+creates ZONE_MOVABLE as following.
+
+1) When kernelcore=YYYY boot option is used,
+  Size of memory not for movable pages (not for offline) is YYYY.
+  Size of memory for movable pages (for offline) is TOTAL-YYYY.
+
+2) When movablecore=ZZZZ boot option is used,
+  Size of memory not for movable pages (not for offline) is TOTAL - ZZZZ.
+  Size of memory for movable pages (for offline) is ZZZZ.
+
+
+Note) Unfortunately, there is no information to show which section belongs
+to ZONE_MOVABLE. This is TBD.
+
+
+6.2. How to offline memory
+------------
+You can offline a section by using the same sysfs interface that was used in
+memory onlining.
+
+% echo offline > /sys/devices/system/memory/memoryXXX/state
+
+If offline succeeds, the state of the memory section is changed to be "offline".
+If it fails, some error core (like -EBUSY) will be returned by the kernel.
+Even if a section does not belong to ZONE_MOVABLE, you can try to offline it.
+If it doesn't contain 'unmovable' memory, you'll get success.
+
+A section under ZONE_MOVABLE is considered to be able to be offlined easily.
+But under some busy state, it may return -EBUSY. Even if a memory section
+cannot be offlined due to -EBUSY, you can retry offlining it and may be able to
+offline it (or not).
+(For example, a page is referred to by some kernel internal call and released
+ soon.)
+
+Consideration:
+Memory hotplug's design direction is to make the possibility of memory offlining
+higher and to guarantee unplugging memory under any situation. But it needs
+more work. Returning -EBUSY under some situation may be good because the user
+can decide to retry more or not by himself. Currently, memory offlining code
+does some amount of retry with 120 seconds timeout.
+
+-------------------------
+7. Physical memory remove
+-------------------------
+Need more implementation yet....
+ - Notification completion of remove works by OS to firmware.
+ - Guard from remove if not yet.
+
+--------------
+8. Future Work
+--------------
+  - allowing memory hot-add to ZONE_MOVABLE. maybe we need some switch like
+    sysctl or new control file.
+  - showing memory section and physical device relationship.
+  - showing memory section and node relationship (maybe good for NUMA)
+  - showing memory section is under ZONE_MOVABLE or not
+  - test and make it better memory offlining.
+  - support HugeTLB page migration and offlining.
+  - memmap removing at memory offline.
+  - physical remove memory.
+
index 16feebb7bdc077f334964443235996a187a4cf90..84901e7c05084e1f767d024b7f06cde1f19d6854 100644 (file)
@@ -83,7 +83,7 @@ Some implementation details:
    CFS uses nanosecond granularity accounting and does not rely on any
    jiffies or other HZ detail. Thus the CFS scheduler has no notion of
    'timeslices' and has no heuristics whatsoever. There is only one
-   central tunable:
+   central tunable (you have to switch on CONFIG_SCHED_DEBUG):
 
          /proc/sys/kernel/sched_granularity_ns
 
diff --git a/Documentation/sched-nice-design.txt b/Documentation/sched-nice-design.txt
new file mode 100644 (file)
index 0000000..e2bae5a
--- /dev/null
@@ -0,0 +1,108 @@
+This document explains the thinking about the revamped and streamlined
+nice-levels implementation in the new Linux scheduler.
+
+Nice levels were always pretty weak under Linux and people continuously
+pestered us to make nice +19 tasks use up much less CPU time.
+
+Unfortunately that was not that easy to implement under the old
+scheduler, (otherwise we'd have done it long ago) because nice level
+support was historically coupled to timeslice length, and timeslice
+units were driven by the HZ tick, so the smallest timeslice was 1/HZ.
+
+In the O(1) scheduler (in 2003) we changed negative nice levels to be
+much stronger than they were before in 2.4 (and people were happy about
+that change), and we also intentionally calibrated the linear timeslice
+rule so that nice +19 level would be _exactly_ 1 jiffy. To better
+understand it, the timeslice graph went like this (cheesy ASCII art
+alert!):
+
+
+                   A
+             \     | [timeslice length]
+              \    |
+               \   |
+                \  |
+                 \ |
+                  \|___100msecs
+                   |^ . _
+                   |      ^ . _
+                   |            ^ . _
+ -*----------------------------------*-----> [nice level]
+ -20               |                +19
+                   |
+                   |
+
+So that if someone wanted to really renice tasks, +19 would give a much
+bigger hit than the normal linear rule would do. (The solution of
+changing the ABI to extend priorities was discarded early on.)
+
+This approach worked to some degree for some time, but later on with
+HZ=1000 it caused 1 jiffy to be 1 msec, which meant 0.1% CPU usage which
+we felt to be a bit excessive. Excessive _not_ because it's too small of
+a CPU utilization, but because it causes too frequent (once per
+millisec) rescheduling. (and would thus trash the cache, etc. Remember,
+this was long ago when hardware was weaker and caches were smaller, and
+people were running number crunching apps at nice +19.)
+
+So for HZ=1000 we changed nice +19 to 5msecs, because that felt like the
+right minimal granularity - and this translates to 5% CPU utilization.
+But the fundamental HZ-sensitive property for nice+19 still remained,
+and we never got a single complaint about nice +19 being too _weak_ in
+terms of CPU utilization, we only got complaints about it (still) being
+too _strong_ :-)
+
+To sum it up: we always wanted to make nice levels more consistent, but
+within the constraints of HZ and jiffies and their nasty design level
+coupling to timeslices and granularity it was not really viable.
+
+The second (less frequent but still periodically occuring) complaint
+about Linux's nice level support was its assymetry around the origo
+(which you can see demonstrated in the picture above), or more
+accurately: the fact that nice level behavior depended on the _absolute_
+nice level as well, while the nice API itself is fundamentally
+"relative":
+
+   int nice(int inc);
+
+   asmlinkage long sys_nice(int increment)
+
+(the first one is the glibc API, the second one is the syscall API.)
+Note that the 'inc' is relative to the current nice level. Tools like
+bash's "nice" command mirror this relative API.
+
+With the old scheduler, if you for example started a niced task with +1
+and another task with +2, the CPU split between the two tasks would
+depend on the nice level of the parent shell - if it was at nice -10 the
+CPU split was different than if it was at +5 or +10.
+
+A third complaint against Linux's nice level support was that negative
+nice levels were not 'punchy enough', so lots of people had to resort to
+run audio (and other multimedia) apps under RT priorities such as
+SCHED_FIFO. But this caused other problems: SCHED_FIFO is not starvation
+proof, and a buggy SCHED_FIFO app can also lock up the system for good.
+
+The new scheduler in v2.6.23 addresses all three types of complaints:
+
+To address the first complaint (of nice levels being not "punchy"
+enough), the scheduler was decoupled from 'time slice' and HZ concepts
+(and granularity was made a separate concept from nice levels) and thus
+it was possible to implement better and more consistent nice +19
+support: with the new scheduler nice +19 tasks get a HZ-independent
+1.5%, instead of the variable 3%-5%-9% range they got in the old
+scheduler.
+
+To address the second complaint (of nice levels not being consistent),
+the new scheduler makes nice(1) have the same CPU utilization effect on
+tasks, regardless of their absolute nice levels. So on the new
+scheduler, running a nice +10 and a nice 11 task has the same CPU
+utilization "split" between them as running a nice -5 and a nice -4
+task. (one will get 55% of the CPU, the other 45%.) That is why nice
+levels were changed to be "multiplicative" (or exponential) - that way
+it does not matter which nice level you start out from, the 'relative
+result' will always be the same.
+
+The third complaint (of negative nice levels not being "punchy" enough
+and forcing audio apps to run under the more dangerous SCHED_FIFO
+scheduling policy) is addressed by the new scheduler almost
+automatically: stronger negative nice levels are an automatic
+side-effect of the recalibrated dynamic range of nice levels.
index 6f72021aae51f5e1a015468f342b2b3355315e3b..442e14d35dea272f6906d65723055b82d0566ef3 100644 (file)
@@ -1,10 +1,11 @@
-Version 10 of schedstats includes support for sched_domains, which
-hit the mainline kernel in 2.6.7.  Some counters make more sense to be
-per-runqueue; other to be per-domain.  Note that domains (and their associated
-information) will only be pertinent and available on machines utilizing
-CONFIG_SMP.
-
-In version 10 of schedstat, there is at least one level of domain
+Version 14 of schedstats includes support for sched_domains, which hit the
+mainline kernel in 2.6.20 although it is identical to the stats from version
+12 which was in the kernel from 2.6.13-2.6.19 (version 13 never saw a kernel
+release).  Some counters make more sense to be per-runqueue; other to be
+per-domain.  Note that domains (and their associated information) will only
+be pertinent and available on machines utilizing CONFIG_SMP.
+
+In version 14 of schedstat, there is at least one level of domain
 statistics for each cpu listed, and there may well be more than one
 domain.  Domains have no particular names in this implementation, but
 the highest numbered one typically arbitrates balancing across all the
@@ -27,7 +28,7 @@ to write their own scripts, the fields are described here.
 
 CPU statistics
 --------------
-cpu<N> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28
+cpu<N> 1 2 3 4 5 6 7 8 9 10 11 12
 
 NOTE: In the sched_yield() statistics, the active queue is considered empty
     if it has only one process in it, since obviously the process calling
@@ -39,48 +40,20 @@ First four fields are sched_yield() statistics:
      3) # of times just the expired queue was empty
      4) # of times sched_yield() was called
 
-Next four are schedule() statistics:
-     5) # of times the active queue had at least one other process on it
-     6) # of times we switched to the expired queue and reused it
-     7) # of times schedule() was called
-     8) # of times schedule() left the processor idle
-
-Next four are active_load_balance() statistics:
-     9) # of times active_load_balance() was called
-    10) # of times active_load_balance() caused this cpu to gain a task
-    11) # of times active_load_balance() caused this cpu to lose a task
-    12) # of times active_load_balance() tried to move a task and failed
-
-Next three are try_to_wake_up() statistics:
-    13) # of times try_to_wake_up() was called
-    14) # of times try_to_wake_up() successfully moved the awakening task
-    15) # of times try_to_wake_up() attempted to move the awakening task
-
-Next two are wake_up_new_task() statistics:
-    16) # of times wake_up_new_task() was called
-    17) # of times wake_up_new_task() successfully moved the new task
-
-Next one is a sched_migrate_task() statistic:
-    18) # of times sched_migrate_task() was called
+Next three are schedule() statistics:
+     5) # of times we switched to the expired queue and reused it
+     6) # of times schedule() was called
+     7) # of times schedule() left the processor idle
 
-Next one is a sched_balance_exec() statistic:
-    19) # of times sched_balance_exec() was called
+Next two are try_to_wake_up() statistics:
+     8) # of times try_to_wake_up() was called
+     9) # of times try_to_wake_up() was called to wake up the local cpu
 
 Next three are statistics describing scheduling latency:
-    20) sum of all time spent running by tasks on this processor (in ms)
-    21) sum of all time spent waiting to run by tasks on this processor (in ms)
-    22) # of tasks (not necessarily unique) given to the processor
-
-The last six are statistics dealing with pull_task():
-    23) # of times pull_task() moved a task to this cpu when newly idle
-    24) # of times pull_task() stole a task from this cpu when another cpu
-       was newly idle
-    25) # of times pull_task() moved a task to this cpu when idle
-    26) # of times pull_task() stole a task from this cpu when another cpu
-       was idle
-    27) # of times pull_task() moved a task to this cpu when busy
-    28) # of times pull_task() stole a task from this cpu when another cpu
-       was busy
+    10) sum of all time spent running by tasks on this processor (in jiffies)
+    11) sum of all time spent waiting to run by tasks on this processor (in
+        jiffies)
+    12) # of timeslices run on this cpu
 
 
 Domain statistics
@@ -89,65 +62,95 @@ One of these is produced per domain for each cpu described. (Note that if
 CONFIG_SMP is not defined, *no* domains are utilized and these lines
 will not appear in the output.)
 
-domain<N> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20
+domain<N> <cpumask> 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36
 
 The first field is a bit mask indicating what cpus this domain operates over.
 
-The next fifteen are a variety of load_balance() statistics:
-
-     1) # of times in this domain load_balance() was called when the cpu
-       was idle
-     2) # of times in this domain load_balance() was called when the cpu
-       was busy
-     3) # of times in this domain load_balance() was called when the cpu
-       was just becoming idle
-     4) # of times in this domain load_balance() tried to move one or more
-       tasks and failed, when the cpu was idle
-     5) # of times in this domain load_balance() tried to move one or more
-       tasks and failed, when the cpu was busy
-     6) # of times in this domain load_balance() tried to move one or more
-       tasks and failed, when the cpu was just becoming idle
-     7) sum of imbalances discovered (if any) with each call to
-       load_balance() in this domain when the cpu was idle
-     8) sum of imbalances discovered (if any) with each call to
-       load_balance() in this domain when the cpu was busy
-     9) sum of imbalances discovered (if any) with each call to
-       load_balance() in this domain when the cpu was just becoming idle
-    10) # of times in this domain load_balance() was called but did not find
-       a busier queue while the cpu was idle
-    11) # of times in this domain load_balance() was called but did not find
-       a busier queue while the cpu was busy
-    12) # of times in this domain load_balance() was called but did not find
-       a busier queue while the cpu was just becoming idle
-    13) # of times in this domain a busier queue was found while the cpu was
-       idle but no busier group was found
-    14) # of times in this domain a busier queue was found while the cpu was
-       busy but no busier group was found
-    15) # of times in this domain a busier queue was found while the cpu was
-       just becoming idle but no busier group was found
-
-Next two are sched_balance_exec() statistics:
-    17) # of times in this domain sched_balance_exec() successfully pushed
-       a task to a new cpu
-    18) # of times in this domain sched_balance_exec() tried but failed to
-       push a task to a new cpu
-
-Next two are try_to_wake_up() statistics:
-    19) # of times in this domain try_to_wake_up() tried to move a task based
-       on affinity and cache warmth
-    20) # of times in this domain try_to_wake_up() tried to move a task based
-       on load balancing
-
+The next 24 are a variety of load_balance() statistics in grouped into types
+of idleness (idle, busy, and newly idle):
+
+     1) # of times in this domain load_balance() was called when the
+        cpu was idle
+     2) # of times in this domain load_balance() checked but found
+        the load did not require balancing when the cpu was idle
+     3) # of times in this domain load_balance() tried to move one or
+        more tasks and failed, when the cpu was idle
+     4) sum of imbalances discovered (if any) with each call to
+        load_balance() in this domain when the cpu was idle
+     5) # of times in this domain pull_task() was called when the cpu
+        was idle
+     6) # of times in this domain pull_task() was called even though
+        the target task was cache-hot when idle
+     7) # of times in this domain load_balance() was called but did
+        not find a busier queue while the cpu was idle
+     8) # of times in this domain a busier queue was found while the
+        cpu was idle but no busier group was found
+
+     9) # of times in this domain load_balance() was called when the
+        cpu was busy
+    10) # of times in this domain load_balance() checked but found the
+        load did not require balancing when busy
+    11) # of times in this domain load_balance() tried to move one or
+        more tasks and failed, when the cpu was busy
+    12) sum of imbalances discovered (if any) with each call to
+        load_balance() in this domain when the cpu was busy
+    13) # of times in this domain pull_task() was called when busy
+    14) # of times in this domain pull_task() was called even though the
+        target task was cache-hot when busy
+    15) # of times in this domain load_balance() was called but did not
+        find a busier queue while the cpu was busy
+    16) # of times in this domain a busier queue was found while the cpu
+        was busy but no busier group was found
+
+    17) # of times in this domain load_balance() was called when the
+        cpu was just becoming idle
+    18) # of times in this domain load_balance() checked but found the
+        load did not require balancing when the cpu was just becoming idle
+    19) # of times in this domain load_balance() tried to move one or more
+        tasks and failed, when the cpu was just becoming idle
+    20) sum of imbalances discovered (if any) with each call to
+        load_balance() in this domain when the cpu was just becoming idle
+    21) # of times in this domain pull_task() was called when newly idle
+    22) # of times in this domain pull_task() was called even though the
+        target task was cache-hot when just becoming idle
+    23) # of times in this domain load_balance() was called but did not
+        find a busier queue while the cpu was just becoming idle
+    24) # of times in this domain a busier queue was found while the cpu
+        was just becoming idle but no busier group was found
+
+   Next three are active_load_balance() statistics:
+    25) # of times active_load_balance() was called
+    26) # of times active_load_balance() tried to move a task and failed
+    27) # of times active_load_balance() successfully moved a task
+
+   Next three are sched_balance_exec() statistics:
+    28) sbe_cnt is not used
+    29) sbe_balanced is not used
+    30) sbe_pushed is not used
+
+   Next three are sched_balance_fork() statistics:
+    31) sbf_cnt is not used
+    32) sbf_balanced is not used
+    33) sbf_pushed is not used
+
+   Next three are try_to_wake_up() statistics:
+    34) # of times in this domain try_to_wake_up() awoke a task that
+        last ran on a different cpu in this domain
+    35) # of times in this domain try_to_wake_up() moved a task to the
+        waking cpu because it was cache-cold on its own cpu anyway
+    36) # of times in this domain try_to_wake_up() started passive balancing
 
 /proc/<pid>/schedstat
 ----------------
 schedstats also adds a new /proc/<pid/schedstat file to include some of
 the same information on a per-process level.  There are three fields in
-this file correlating to fields 20, 21, and 22 in the CPU fields, but
-they only apply for that process.
+this file correlating for that process to:
+     1) time spent on the cpu
+     2) time spent waiting on a runqueue
+     3) # of timeslices run on this cpu
 
 A program could be easily written to make use of these extra fields to
 report on how well a particular process or set of processes is faring
 under the scheduler's policies.  A simple version of such a program is
 available at
-    http://eaglet.rain.com/rick/linux/schedstat/v10/latency.c
+    http://eaglet.rain.com/rick/linux/schedstat/v12/latency.c
diff --git a/Documentation/spi/spidev_test.c b/Documentation/spi/spidev_test.c
new file mode 100644 (file)
index 0000000..218e862
--- /dev/null
@@ -0,0 +1,202 @@
+/*
+ * SPI testing utility (using spidev driver)
+ *
+ * Copyright (c) 2007  MontaVista Software, Inc.
+ * Copyright (c) 2007  Anton Vorontsov <avorontsov@ru.mvista.com>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License.
+ *
+ * Cross-compile with cross-gcc -I/path/to/cross-kernel/include
+ */
+
+#include <stdint.h>
+#include <unistd.h>
+#include <stdio.h>
+#include <stdlib.h>
+#include <getopt.h>
+#include <fcntl.h>
+#include <sys/ioctl.h>
+#include <linux/types.h>
+#include <linux/spi/spidev.h>
+
+#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
+
+static void pabort(const char *s)
+{
+       perror(s);
+       abort();
+}
+
+static char *device = "/dev/spidev1.1";
+static uint8_t mode;
+static uint8_t bits = 8;
+static uint32_t speed = 500000;
+static uint16_t delay;
+
+static void transfer(int fd)
+{
+       int ret;
+       uint8_t tx[] = {
+               0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+               0x40, 0x00, 0x00, 0x00, 0x00, 0x95,
+               0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+               0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+               0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF,
+               0xDE, 0xAD, 0xBE, 0xEF, 0xBA, 0xAD,
+               0xF0, 0x0D,
+       };
+       uint8_t rx[ARRAY_SIZE(tx)] = {0, };
+       struct spi_ioc_transfer tr = {
+               .tx_buf = (unsigned long)tx,
+               .rx_buf = (unsigned long)rx,
+               .len = ARRAY_SIZE(tx),
+               .delay_usecs = delay,
+               .speed_hz = speed,
+               .bits_per_word = bits,
+       };
+
+       ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
+       if (ret == 1)
+               pabort("can't send spi message");
+
+       for (ret = 0; ret < ARRAY_SIZE(tx); ret++) {
+               if (!(ret % 6))
+                       puts("");
+               printf("%.2X ", rx[ret]);
+       }
+       puts("");
+}
+
+void print_usage(char *prog)
+{
+       printf("Usage: %s [-DsbdlHOLC3]\n", prog);
+       puts("  -D --device   device to use (default /dev/spidev1.1)\n"
+            "  -s --speed    max speed (Hz)\n"
+            "  -d --delay    delay (usec)\n"
+            "  -b --bpw      bits per word \n"
+            "  -l --loop     loopback\n"
+            "  -H --cpha     clock phase\n"
+            "  -O --cpol     clock polarity\n"
+            "  -L --lsb      least significant bit first\n"
+            "  -C --cs-high  chip select active high\n"
+            "  -3 --3wire    SI/SO signals shared\n");
+       exit(1);
+}
+
+void parse_opts(int argc, char *argv[])
+{
+       while (1) {
+               static struct option lopts[] = {
+                       { "device",  1, 0, 'D' },
+                       { "speed",   1, 0, 's' },
+                       { "delay",   1, 0, 'd' },
+                       { "bpw",     1, 0, 'b' },
+                       { "loop",    0, 0, 'l' },
+                       { "cpha",    0, 0, 'H' },
+                       { "cpol",    0, 0, 'O' },
+                       { "lsb",     0, 0, 'L' },
+                       { "cs-high", 0, 0, 'C' },
+                       { "3wire",   0, 0, '3' },
+                       { NULL, 0, 0, 0 },
+               };
+               int c;
+
+               c = getopt_long(argc, argv, "D:s:d:b:lHOLC3", lopts, NULL);
+
+               if (c == -1)
+                       break;
+
+               switch (c) {
+               case 'D':
+                       device = optarg;
+                       break;
+               case 's':
+                       speed = atoi(optarg);
+                       break;
+               case 'd':
+                       delay = atoi(optarg);
+                       break;
+               case 'b':
+                       bits = atoi(optarg);
+                       break;
+               case 'l':
+                       mode |= SPI_LOOP;
+                       break;
+               case 'H':
+                       mode |= SPI_CPHA;
+                       break;
+               case 'O':
+                       mode |= SPI_CPOL;
+                       break;
+               case 'L':
+                       mode |= SPI_LSB_FIRST;
+                       break;
+               case 'C':
+                       mode |= SPI_CS_HIGH;
+                       break;
+               case '3':
+                       mode |= SPI_3WIRE;
+                       break;
+               default:
+                       print_usage(argv[0]);
+                       break;
+               }
+       }
+}
+
+int main(int argc, char *argv[])
+{
+       int ret = 0;
+       int fd;
+
+       parse_opts(argc, argv);
+
+       fd = open(device, O_RDWR);
+       if (fd < 0)
+               pabort("can't open device");
+
+       /*
+        * spi mode
+        */
+       ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
+       if (ret == -1)
+               pabort("can't set spi mode");
+
+       ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
+       if (ret == -1)
+               pabort("can't get spi mode");
+
+       /*
+        * bits per word
+        */
+       ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
+       if (ret == -1)
+               pabort("can't set bits per word");
+
+       ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
+       if (ret == -1)
+               pabort("can't get bits per word");
+
+       /*
+        * max speed hz
+        */
+       ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
+       if (ret == -1)
+               pabort("can't set max speed hz");
+
+       ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
+       if (ret == -1)
+               pabort("can't get max speed hz");
+
+       printf("spi mode: %d\n", mode);
+       printf("bits per word: %d\n", bits);
+       printf("max speed: %d Hz (%d KHz)\n", speed, speed/1000);
+
+       transfer(fd);
+
+       close(fd);
+
+       return ret;
+}
index a2afca3b2bab6fb923fb9eda102073606d15c278..847b342b7b20bd73758c603d833811c5ac738930 100644 (file)
@@ -10,7 +10,7 @@ kernel to userspace interfaces.  The kernel to userspace interface is
 the one that application programs use, the syscall interface.  That
 interface is _very_ stable over time, and will not break.  I have old
 programs that were built on a pre 0.9something kernel that still work
-just fine on the latest 2.6 kernel release.  This interface is the one
+just fine on the latest 2.6 kernel release.  That interface is the one
 that users and application programmers can count on being stable.
 
 
index 42861bb0bc9b3f451585a9fef2655ee2a22dafd9..80ef562160bba8697c5623ee3b5fa9b4c163ab4a 100644 (file)
@@ -1,19 +1,18 @@
 Rules on how to access information in the Linux kernel sysfs
 
-The kernel exported sysfs exports internal kernel implementation-details
+The kernel-exported sysfs exports internal kernel implementation details
 and depends on internal kernel structures and layout. It is agreed upon
 by the kernel developers that the Linux kernel does not provide a stable
 internal API. As sysfs is a direct export of kernel internal
-structures, the sysfs interface can not provide a stable interface eighter,
+structures, the sysfs interface cannot provide a stable interface either;
 it may always change along with internal kernel changes.
 
 To minimize the risk of breaking users of sysfs, which are in most cases
 low-level userspace applications, with a new kernel release, the users
-of sysfs must follow some rules to use an as abstract-as-possible way to
+of sysfs must follow some rules to use an as-abstract-as-possible way to
 access this filesystem. The current udev and HAL programs already
 implement this and users are encouraged to plug, if possible, into the
-abstractions these programs provide instead of accessing sysfs
-directly.
+abstractions these programs provide instead of accessing sysfs directly.
 
 But if you really do want or need to access sysfs directly, please follow
 the following rules and then your programs should work with future
@@ -25,22 +24,22 @@ versions of the sysfs interface.
   implementation details in its own API. Therefore it is not better than
   reading directories and opening the files yourself.
   Also, it is not actively maintained, in the sense of reflecting the
-  current kernel-development. The goal of providing a stable interface
-  to sysfs has failed, it causes more problems, than it solves. It
+  current kernel development. The goal of providing a stable interface
+  to sysfs has failed; it causes more problems than it solves. It
   violates many of the rules in this document.
 
 - sysfs is always at /sys
   Parsing /proc/mounts is a waste of time. Other mount points are a
   system configuration bug you should not try to solve. For test cases,
   possibly support a SYSFS_PATH environment variable to overwrite the
-  applications behavior, but never try to search for sysfs. Never try
+  application's behavior, but never try to search for sysfs. Never try
   to mount it, if you are not an early boot script.
 
 - devices are only "devices"
   There is no such thing like class-, bus-, physical devices,
   interfaces, and such that you can rely on in userspace. Everything is
   just simply a "device". Class-, bus-, physical, ... types are just
-  kernel implementation details, which should not be expected by
+  kernel implementation details which should not be expected by
   applications that look for devices in sysfs.
 
   The properties of a device are:
@@ -48,11 +47,11 @@ versions of the sysfs interface.
       - identical to the DEVPATH value in the event sent from the kernel
         at device creation and removal
       - the unique key to the device at that point in time
-      - the kernels path to the device-directory without the leading
+      - the kernel's path to the device directory without the leading
         /sys, and always starting with with a slash
       - all elements of a devpath must be real directories. Symlinks
         pointing to /sys/devices must always be resolved to their real
-        target, and the target path must be used to access the device.
+        target and the target path must be used to access the device.
         That way the devpath to the device matches the devpath of the
         kernel used at event time.
       - using or exposing symlink values as elements in a devpath string
@@ -73,17 +72,17 @@ versions of the sysfs interface.
         link
       - it is retrieved by reading the "driver"-link and using only the
         last element of the target path
-      - devices which do not have "driver"-link, just do not have a
-        driver; copying the driver value in a child device context, is a
+      - devices which do not have "driver"-link just do not have a
+        driver; copying the driver value in a child device context is a
         bug in the application
 
     o attributes
-      - the files in the device directory or files below subdirectories
+      - the files in the device directory or files below subdirectories
         of the same device directory
       - accessing attributes reached by a symlink pointing to another device,
         like the "device"-link, is a bug in the application
 
-  Everything else is just a kernel driver-core implementation detail,
+  Everything else is just a kernel driver-core implementation detail
   that should not be assumed to be stable across kernel releases.
 
 - Properties of parent devices never belong into a child device.
@@ -91,25 +90,25 @@ versions of the sysfs interface.
   context properties. If the device 'eth0' or 'sda' does not have a
   "driver"-link, then this device does not have a driver. Its value is empty.
   Never copy any property of the parent-device into a child-device. Parent
-  device-properties may change dynamically without any notice to the
+  device properties may change dynamically without any notice to the
   child device.
 
-- Hierarchy in a single device-tree
+- Hierarchy in a single device tree
   There is only one valid place in sysfs where hierarchy can be examined
   and this is below: /sys/devices.
-  It is planned, that all device directories will end up in the tree
+  It is planned that all device directories will end up in the tree
   below this directory.
 
 - Classification by subsystem
   There are currently three places for classification of devices:
   /sys/block, /sys/class and /sys/bus. It is planned that these will
-  not contain any device-directories themselves, but only flat lists of
+  not contain any device directories themselves, but only flat lists of
   symlinks pointing to the unified /sys/devices tree.
   All three places have completely different rules on how to access
   device information. It is planned to merge all three
-  classification-directories into one place at /sys/subsystem,
-  following the layout of the bus-directories. All buses and
-  classes, including the converted block-subsystem, will show up
+  classification directories into one place at /sys/subsystem,
+  following the layout of the bus directories. All buses and
+  classes, including the converted block subsystem, will show up
   there.
   The devices belonging to a subsystem will create a symlink in the
   "devices" directory at /sys/subsystem/<name>/devices.
@@ -121,38 +120,38 @@ versions of the sysfs interface.
   subsystem name.
 
   Assuming /sys/class/<subsystem> and /sys/bus/<subsystem>, or
-  /sys/block and /sys/class/block are not interchangeable, is a bug in
+  /sys/block and /sys/class/block are not interchangeable is a bug in
   the application.
 
 - Block
-  The converted block-subsystem at /sys/class/block, or
+  The converted block subsystem at /sys/class/block or
   /sys/subsystem/block will contain the links for disks and partitions
-  at the same level, never in a hierarchy. Assuming the block-subsytem to
-  contain only disks and not partition-devices in the same flat list is
+  at the same level, never in a hierarchy. Assuming the block subsytem to
+  contain only disks and not partition devices in the same flat list is
   a bug in the application.
 
 - "device"-link and <subsystem>:<kernel name>-links
   Never depend on the "device"-link. The "device"-link is a workaround
-  for the old layout, where class-devices are not created in
-  /sys/devices/ like the bus-devices. If the link-resolving of a
-  device-directory does not end in /sys/devices/, you can use the
+  for the old layout, where class devices are not created in
+  /sys/devices/ like the bus devices. If the link-resolving of a
+  device directory does not end in /sys/devices/, you can use the
   "device"-link to find the parent devices in /sys/devices/. That is the
-  single valid use of the "device"-link, it must never appear in any
+  single valid use of the "device"-link; it must never appear in any
   path as an element. Assuming the existence of the "device"-link for
   a device in /sys/devices/ is a bug in the application.
   Accessing /sys/class/net/eth0/device is a bug in the application.
 
   Never depend on the class-specific links back to the /sys/class
   directory.  These links are also a workaround for the design mistake
-  that class-devices are not created in /sys/devices. If a device
+  that class devices are not created in /sys/devices. If a device
   directory does not contain directories for child devices, these links
   may be used to find the child devices in /sys/class. That is the single
-  valid use of these links, they must never appear in any path as an
+  valid use of these links; they must never appear in any path as an
   element. Assuming the existence of these links for devices which are
-  real child device directories in the /sys/devices tree, is a bug in
+  real child device directories in the /sys/devices tree is a bug in
   the application.
 
-  It is planned to remove all these links when when all class-device
+  It is planned to remove all these links when all class device
   directories live in /sys/devices.
 
 - Position of devices along device chain can change.
@@ -161,6 +160,5 @@ versions of the sysfs interface.
   the chain. You must always request the parent device you are looking for
   by its subsystem value. You need to walk up the chain until you find
   the device that matches the expected subsystem. Depending on a specific
-  position of a parent device, or exposing relative paths, using "../" to
-  access the chain of parents, is a bug in the application.
-
+  position of a parent device or exposing relative paths using "../" to
+  access the chain of parents is a bug in the application.
index ba328f255417a7e240a3e8df12b030faec34374d..ef19142896ca0688ca82b62a82a51fd13b7e7700 100644 (file)
@@ -1,6 +1,6 @@
 Linux Magic System Request Key Hacks
 Documentation for sysrq.c
-Last update: 2007-MAR-14
+Last update: 2007-AUG-04
 
 *  What is the magic SysRq key?
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
@@ -78,7 +78,7 @@ On all -  write a character to /proc/sysrq-trigger.  e.g.:
 'g'    - Used by kgdb on ppc and sh platforms.
 
 'h'     - Will display help (actually any other key than those listed
-          above will display help. but 'h' is easy to remember :-)
+          here will display help. but 'h' is easy to remember :-)
 
 'i'     - Send a SIGKILL to all processes, except for init.
 
index 6711fbcf408078644bf237b2f46466b69b7040ff..eb2f5986e1eb911e94c760c5107dccef5b053f76 100644 (file)
@@ -105,10 +105,10 @@ The version of thinkpad-acpi's sysfs interface is exported by the driver
 as a driver attribute (see below).
 
 Sysfs driver attributes are on the driver's sysfs attribute space,
-for 2.6.20 this is /sys/bus/platform/drivers/thinkpad-acpi/.
+for 2.6.20 this is /sys/bus/platform/drivers/thinkpad_acpi/.
 
 Sysfs device attributes are on the driver's sysfs attribute space,
-for 2.6.20 this is /sys/devices/platform/thinkpad-acpi/.
+for 2.6.20 this is /sys/devices/platform/thinkpad_acpi/.
 
 Driver version
 --------------
index d4f21ffd14041b5664eea1c36d386b9290d4eb6a..1af7bd5a2183ec83d1b4481191b61973006f2a46 100644 (file)
@@ -396,7 +396,7 @@ void report(struct slabinfo *s)
        if (strcmp(s->name, "*") == 0)
                return;
 
-       printf("\nSlabcache: %-20s  Aliases: %2d Order : %2d Objects: %d\n",
+       printf("\nSlabcache: %-20s  Aliases: %2d Order : %2d Objects: %lu\n",
                s->name, s->aliases, s->order, s->objects);
        if (s->hwcache_align)
                printf("** Hardware cacheline aligned\n");
index 24c119407f72a39d4bdc6c547b4021a52085644f..371fe67a4eef3eb4bfe00039ea895da2a2c318c8 100644 (file)
@@ -97,6 +97,12 @@ M:   philb@gnu.org
 L:     netdev@vger.kernel.org
 S:     Maintained
 
+3C59X NETWORK DRIVER
+P:     Steffen Klassert
+M:     klassert@mathematik.tu-chemnitz.de
+L:     netdev@vger.kernel.org
+S:     Maintained
+
 3CR990 NETWORK DRIVER
 P:     David Dillow
 M:     dave@thedillows.org
@@ -387,21 +393,6 @@ P: Jaya Kumar
 M:     jayalk@intworks.biz
 S:     Maintained
 
-ARM26 ARCHITECTURE
-P:     Ian Molton
-M:     spyro@f2s.com
-S:     Maintained
-
-ARM26/ARCHIMEDES
-P:     Ian Molton
-M:     spyro@f2s.com
-S:     Maintained
-
-ARM26/A5000
-P:     John Appleby
-M:     john@dnsworld.co.uk
-S:     Maintained
-
 ARM MFM AND FLOPPY DRIVERS
 P:     Ian Molton
 M:     spyro@f2s.com
@@ -627,6 +618,15 @@ W: http://sourceforge.net/projects/acpi4asus
 W:     http://xf.iksaif.net/acpi4asus
 S:     Maintained
 
+ASYNCHRONOUS TRANSFERS/TRANSFORMS API
+P:     Dan Williams
+M:     dan.j.williams@intel.com
+P:     Shannon Nelson
+M:     shannon.nelson@intel.com
+L:     linux-kernel@vger.kernel.org
+W:     http://sourceforge.net/projects/xscaleiop
+S:     Supported
+
 ATA OVER ETHERNET DRIVER
 P:     Ed L. Cashin
 M:     ecashin@coraid.com
@@ -679,7 +679,7 @@ S:  Maintained
 AUDIT SUBSYSTEM
 P:     David Woodhouse
 M:     dwmw2@infradead.org
-L:     linux-audit@redhat.com
+L:     linux-audit@redhat.com (subscribers-only)
 W:     http://people.redhat.com/sgrubb/audit/
 T:     git kernel.org:/pub/scm/linux/kernel/git/dwmw2/audit-2.6.git
 S:     Maintained
@@ -771,6 +771,14 @@ L: uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
 W:     http://blackfin.uclinux.org
 S:     Supported
 
+BLACKFIN WATCHDOG DRIVER
+P:     Mike Frysinger
+M:     michael.frysinger@analog.com
+M:     vapier.adi@gmail.com
+L:     uclinux-dist-devel@blackfin.uclinux.org (subscribers-only)
+W:     http://blackfin.uclinux.org
+S:     Supported
+
 BAYCOM/HDLCDRV DRIVERS FOR AX.25
 P:     Thomas Sailer
 M:     t.sailer@alumni.ethz.ch
@@ -1284,11 +1292,13 @@ M:      tori@unhappy.mine.nu
 L:     netdev@vger.kernel.org
 S:     Maintained
 
-DMA GENERIC MEMCPY SUBSYSTEM
+DMA GENERIC OFFLOAD ENGINE SUBSYSTEM
 P:     Shannon Nelson
 M:     shannon.nelson@intel.com
+P:     Dan Williams
+M:     dan.j.williams@intel.com
 L:     linux-kernel@vger.kernel.org
-S:     Maintained
+S:     Supported
 
 DME1737 HARDWARE MONITOR DRIVER
 P:     Juerg Haefliger
@@ -1965,6 +1975,12 @@ M:       shannon.nelson@intel.com
 L:     linux-kernel@vger.kernel.org
 S:     Supported
 
+INTEL IOP-ADMA DMA DRIVER
+P:     Dan Williams
+M:     dan.j.williams@intel.com
+L:     linux-kernel@vger.kernel.org
+S:     Supported
+
 INTEL IXP4XX RANDOM NUMBER GENERATOR SUPPORT
 P:     Deepak Saxena
 M:     dsaxena@plexity.net
@@ -2171,6 +2187,8 @@ W:        http://www.kerneljanitors.org/
 S:     Maintained
 
 KERNEL NFSD
+P:     J. Bruce Fields
+M:     bfields@fieldses.org
 P:     Neil Brown
 M:     neilb@suse.de
 L:     nfs@lists.sourceforge.net
@@ -3339,6 +3357,14 @@ M:       thomas@winischhofer.net
 W:     http://www.winischhofer.at/linuxsisusbvga.shtml
 S:     Maintained
 
+SLAB ALLOCATOR
+P:     Christoph Lameter
+M:     clameter@sgi.com
+P:     Pekka Enberg
+M:     penberg@cs.helsinki.fi
+L:     linux-mm@kvack.org
+S:     Maintained
+
 SMC91x ETHERNET DRIVER
 P:     Nicolas Pitre
 M:     nico@cam.org
@@ -3666,11 +3692,9 @@ W:       http://www.auk.cx/tms380tr/
 S:     Maintained
 
 TULIP NETWORK DRIVER
-P:     Valerie Henson
-M:     val@nmt.edu
 L:     tulip-users@lists.sourceforge.net
 W:     http://sourceforge.net/projects/tulip/
-S:     Maintained
+S:     Orphan
 
 TUN/TAP driver
 P:     Maxim Krasnyansky
@@ -3753,7 +3777,7 @@ L:        linux-usb-devel@lists.sourceforge.net
 W:     http://www.linux-usb.org/gadget
 S:     Maintained
 
-USB HID/HIDBP DRIVERS
+USB HID/HIDBP DRIVERS (USB KEYBOARDS, MICE, REMOTE CONTROLS, ...)
 P:     Jiri Kosina
 M:     jkosina@suse.cz
 L:     linux-usb-devel@lists.sourceforge.net
index dfe3d1610a7b3a7495507e9e95d6109592be4af1..f3229a4945bf57f80f4c87eb504123c4ed21bb29 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -1,7 +1,7 @@
 VERSION = 2
 PATCHLEVEL = 6
 SUBLEVEL = 23
-EXTRAVERSION =-rc1
+EXTRAVERSION =-rc3
 NAME = Holy Dancing Manatees, Batman!
 
 # *DOCUMENTATION*
index e1ae14cd2b4e4d19209adc4d11350531b0acbe3d..cd143887380a26da88e8372828dc586ce3ff7b31 100644 (file)
@@ -104,7 +104,7 @@ OBJ_bootlx   := $(obj)/head.o $(obj)/main.o
 OBJ_bootph   := $(obj)/head.o $(obj)/bootp.o
 OBJ_bootpzh  := $(obj)/head.o $(obj)/bootpz.o $(obj)/misc.o
 
-$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) FORCE
+$(obj)/bootloader: $(obj)/bootloader.lds $(OBJ_bootlx) $(LIBS_Y) FORCE
        $(call if_changed,ld)
 
 $(obj)/bootpheader: $(obj)/bootloader.lds $(OBJ_bootph) $(LIBS_Y) FORCE
index 90ed55b662a85e32d91f1d8fb8dc5c0f9896232f..89f3be071ae5df5f947c7d7ee9fb888e93fa2912 100644 (file)
@@ -132,7 +132,7 @@ static inline long load(long dev, unsigned long addr, unsigned long count)
        if (result)
                srm_printk("Boot file specification (%s) not implemented\n",
                       bootfile);
-       return callback_read(dev, count, addr, boot_size/512 + 1);
+       return callback_read(dev, count, (void *)addr, boot_size/512 + 1);
 }
 
 /*
index 632a7fd6d7dcfeb42efd837e8188d55b5ebd933d..1185778e6a1e0731a3b33fbbf0a6c42f3cb17aa2 100644 (file)
@@ -11,6 +11,7 @@
 
 #include <fcntl.h>
 #include <unistd.h>
+#include <stdlib.h>
 #include <stdio.h>
 
 /* Minimal definition of disklabel, so we don't have to include
@@ -114,7 +115,7 @@ int main(int argc, char ** argv)
     nread = read(fd, &bootloader_image, sizeof(bootblock));
     if(nread != sizeof(bootblock)) {
        perror("lxboot read");
-       fprintf(stderr, "expected %d, got %d\n", sizeof(bootblock), nread);
+       fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread);
        exit(0);
     }
 
@@ -122,7 +123,7 @@ int main(int argc, char ** argv)
     nread = read(dev, &bootblock_from_disk, sizeof(bootblock));
     if(nread != sizeof(bootblock)) {
        perror("bootblock read");
-       fprintf(stderr, "expected %d, got %d\n", sizeof(bootblock), nread);
+       fprintf(stderr, "expected %zd, got %d\n", sizeof(bootblock), nread);
        exit(0);
     }
 
index 96154e768a20d66a34d48a4301e7d80d4eaaa6b3..ef1838230291190f6fcdb2e151919594b738edc1 100644 (file)
@@ -144,7 +144,7 @@ main (int argc, char *argv[])
 #ifdef __ELF__
     elf = (struct elfhdr *) buf;
 
-    if (elf->e_ident[0] == 0x7f && strncmp(elf->e_ident + 1, "ELF", 3) == 0) {
+    if (elf->e_ident[0] == 0x7f && strncmp((char *)elf->e_ident + 1, "ELF", 3) == 0) {
        if (elf->e_type != ET_EXEC) {
            fprintf(stderr, "%s: %s is not an ELF executable\n",
                    prog_name, inname);
index e27d23c74ba8172e2b4be60bb21e3880060101fc..7ac1f1372c361648eb4f1d24315b7a10ecf3b984 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/system.h>
 #include <asm/asm-offsets.h>
 
+.section .text.head, "ax"
 .globl swapper_pg_dir
 .globl _stext
 swapper_pg_dir=SWAPPER_PGD
index ab642a4f08de85eb538077c0261fb9d381d49ae9..9dc1cee43265e206d6863ff40430a2c7a4559e6c 100644 (file)
@@ -195,7 +195,7 @@ pcibios_init(void)
 
 subsys_initcall(pcibios_init);
 
-char * __init
+char * __devinit
 pcibios_setup(char *str)
 {
        return str;
@@ -204,7 +204,7 @@ pcibios_setup(char *str)
 #ifdef ALPHA_RESTORE_SRM_SETUP
 static struct pdev_srm_saved_conf *srm_saved_configs;
 
-void __init
+void __devinit
 pdev_save_srm_config(struct pci_dev *dev)
 {
        struct pdev_srm_saved_conf *tmp;
@@ -247,14 +247,14 @@ pci_restore_srm_config(void)
 }
 #endif
 
-void __init
+void __devinit
 pcibios_fixup_resource(struct resource *res, struct resource *root)
 {
        res->start += root->start;
        res->end += root->start;
 }
 
-void __init
+void __devinit
 pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus)
 {
        /* Update device resources.  */
@@ -273,7 +273,7 @@ pcibios_fixup_device_resources(struct pci_dev *dev, struct pci_bus *bus)
        }
 }
 
-void __init
+void __devinit
 pcibios_fixup_bus(struct pci_bus *bus)
 {
        /* Propagate hose info into the subordinate devices.  */
index 6b07f89a72c70af2b4bf11d7ab5eb3653db0102c..e1c470752ebc0db7e146c2d544da50496f3076af 100644 (file)
@@ -58,7 +58,7 @@ size_for_memory(unsigned long max)
        return max;
 }
 \f
-struct pci_iommu_arena *
+struct pci_iommu_arena * __init
 iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base,
                     unsigned long window_size, unsigned long align)
 {
@@ -117,7 +117,7 @@ iommu_arena_new_node(int nid, struct pci_controller *hose, dma_addr_t base,
        return arena;
 }
 
-struct pci_iommu_arena *
+struct pci_iommu_arena * __init
 iommu_arena_new(struct pci_controller *hose, dma_addr_t base,
                unsigned long window_size, unsigned long align)
 {
index b28731437c31c8e7f66549da67bfd79f54b8060f..ad176441be558bcf41d7dfd109913ef77a36fa7d 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/threads.h>
 #include <linux/smp.h>
 #include <linux/interrupt.h>
@@ -358,7 +359,7 @@ secondary_cpu_start(int cpuid, struct task_struct *idle)
 /*
  * Bring one cpu online.
  */
-static int __devinit
+static int __cpuinit
 smp_boot_one_cpu(int cpuid)
 {
        struct task_struct *idle;
@@ -487,7 +488,7 @@ smp_prepare_boot_cpu(void)
 {
 }
 
-int __devinit
+int __cpuinit
 __cpu_up(unsigned int cpu)
 {
        smp_boot_one_cpu(cpu);
@@ -541,7 +542,7 @@ smp_percpu_timer_interrupt(struct pt_regs *regs)
        set_irq_regs(old_regs);
 }
 
-int __init
+int
 setup_profiling_timer(unsigned int multiplier)
 {
        return -EINVAL;
index 1d3c1398c428d324d42f67b4fc24284831278b2b..52c91ccc164866d3c08ed24ed6984d7b53e35c65 100644 (file)
@@ -270,6 +270,19 @@ titan_dispatch_irqs(u64 mask)
 /*
  * Titan Family
  */
+static void __init
+titan_request_irq(unsigned int irq, irq_handler_t handler,
+                 unsigned long irqflags, const char *devname,
+                 void *dev_id)
+{
+       int err;
+       err = request_irq(irq, handler, irqflags, devname, dev_id);
+       if (err) {
+               printk("titan_request_irq for IRQ %d returned %d; ignoring\n",
+                      irq, err);
+       }
+}
+
 static void __init
 titan_late_init(void)
 {
@@ -278,15 +291,15 @@ titan_late_init(void)
         * all reported to the kernel as machine checks, so the handler
         * is a nop so it can be called to count the individual events.
         */
-       request_irq(63+16, titan_intr_nop, IRQF_DISABLED,
+       titan_request_irq(63+16, titan_intr_nop, IRQF_DISABLED,
                    "CChip Error", NULL);
-       request_irq(62+16, titan_intr_nop, IRQF_DISABLED,
+       titan_request_irq(62+16, titan_intr_nop, IRQF_DISABLED,
                    "PChip 0 H_Error", NULL);
-       request_irq(61+16, titan_intr_nop, IRQF_DISABLED,
+       titan_request_irq(61+16, titan_intr_nop, IRQF_DISABLED,
                    "PChip 1 H_Error", NULL);
-       request_irq(60+16, titan_intr_nop, IRQF_DISABLED,
+       titan_request_irq(60+16, titan_intr_nop, IRQF_DISABLED,
                    "PChip 0 C_Error", NULL);
-       request_irq(59+16, titan_intr_nop, IRQF_DISABLED,
+       titan_request_irq(59+16, titan_intr_nop, IRQF_DISABLED,
                    "PChip 1 C_Error", NULL);
 
        /* 
@@ -345,9 +358,9 @@ privateer_init_pci(void)
         * Hook a couple of extra err interrupts that the
         * common titan code won't.
         */
-       request_irq(53+16, titan_intr_nop, IRQF_DISABLED,
+       titan_request_irq(53+16, titan_intr_nop, IRQF_DISABLED,
                    "NMI", NULL);
-       request_irq(50+16, titan_intr_nop, IRQF_DISABLED,
+       titan_request_irq(50+16, titan_intr_nop, IRQF_DISABLED,
                    "Temperature Warning", NULL);
 
        /*
index fe13daa5cb2c17702463cba91ceb7f9d873a3d16..7af07d3ad5f0dc0dcc276763c84d38453cca15dc 100644 (file)
@@ -15,6 +15,7 @@ SECTIONS
 
   _text = .;                                   /* Text and read-only data */
   .text : { 
+       *(.text.head)
        TEXT_TEXT
        SCHED_TEXT
        LOCK_TEXT
index 550f4907d61305f94b0361283a336ab0746c3001..5e6da47779a408afd3392689f434444f81ee2d9a 100644 (file)
@@ -267,8 +267,7 @@ callback_init(void * kernel_end)
 /*
  * paging_init() sets up the memory map.
  */
-void
-paging_init(void)
+void __init paging_init(void)
 {
        unsigned long zones_size[MAX_NR_ZONES] = {0, };
        unsigned long dma_pfn, high_pfn;
index 85016313bd1175779772fbfe45d1c798780e064e..d6145298a32574e03821415f590fad7c98490025 100644 (file)
@@ -341,6 +341,7 @@ config ARCH_PXA
        select ARCH_MTD_XIP
        select GENERIC_GPIO
        select GENERIC_TIME
+       select GENERIC_CLOCKEVENTS
        help
          Support for Intel's PXA2XX processor line.
 
@@ -990,8 +991,6 @@ source "drivers/pnp/Kconfig"
 
 source "drivers/block/Kconfig"
 
-source "drivers/acorn/block/Kconfig"
-
 if PCMCIA || ARCH_CLPS7500 || ARCH_IOP32X || ARCH_IOP33X || ARCH_IXP4XX \
        || ARCH_L7200 || ARCH_LH7A40X || ARCH_PXA || ARCH_RPC \
        || ARCH_S3C2410 || ARCH_SA1100 || ARCH_SHARK || FOOTBRIDGE \
index 43c4a37e92473caec13518cb7dc15b728610ca4f..add03c9e55531bcb0e7e17d617154aa8aa843236 100644 (file)
@@ -1,12 +1,18 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20-rc1-git5
-# Tue Dec 19 21:38:01 2006
+# Linux kernel version: 2.6.22
+# Thu Jul 19 15:57:52 2007
 #
 CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+# CONFIG_GENERIC_GPIO is not set
 # CONFIG_GENERIC_TIME is not set
+# CONFIG_GENERIC_CLOCKEVENTS is not set
 CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_GENERIC_IRQ_PROBE=y
@@ -15,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
 CONFIG_VECTORS_BASE=0xffff0000
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
@@ -32,17 +39,19 @@ CONFIG_LOCALVERSION=""
 # CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
+CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 CONFIG_IKCONFIG=y
 CONFIG_IKCONFIG_PROC=y
+CONFIG_LOG_BUF_SHIFT=14
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 # CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
 CONFIG_SYSCTL=y
@@ -57,32 +66,30 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
-CONFIG_SLAB=y
 CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 CONFIG_MODVERSIONS=y
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
 
 #
 # IO Schedulers
@@ -114,13 +121,15 @@ CONFIG_DEFAULT_IOSCHED="deadline"
 # CONFIG_ARCH_NETX is not set
 # CONFIG_ARCH_H720X is not set
 # CONFIG_ARCH_IMX is not set
+CONFIG_ARCH_IOP13XX=y
 # CONFIG_ARCH_IOP32X is not set
 # CONFIG_ARCH_IOP33X is not set
-CONFIG_ARCH_IOP13XX=y
-# CONFIG_ARCH_IXP4XX is not set
-# CONFIG_ARCH_IXP2000 is not set
 # CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
 # CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
 # CONFIG_ARCH_PNX4008 is not set
 # CONFIG_ARCH_PXA is not set
 # CONFIG_ARCH_RPC is not set
@@ -128,6 +137,7 @@ CONFIG_ARCH_IOP13XX=y
 # CONFIG_ARCH_S3C2410 is not set
 # CONFIG_ARCH_SHARK is not set
 # CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
 # CONFIG_ARCH_OMAP is not set
 
 #
@@ -140,6 +150,12 @@ CONFIG_ARCH_IOP13XX=y
 CONFIG_MACH_IQ81340SC=y
 CONFIG_MACH_IQ81340MC=y
 
+#
+# IOP13XX IMU Support
+#
+# CONFIG_IOP_IMU is not set
+CONFIG_PLAT_IOP=y
+
 #
 # Processor Type
 #
@@ -159,13 +175,16 @@ CONFIG_IO_36=y
 CONFIG_ARM_THUMB=y
 # CONFIG_CPU_DCACHE_DISABLE is not set
 # CONFIG_CPU_BPREDICT_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
 # CONFIG_IWMMXT is not set
 
 #
 # Bus support
 #
 CONFIG_PCI=y
-# CONFIG_PCI_MULTITHREAD_PROBE is not set
+CONFIG_PCI_SYSCALL=y
+CONFIG_ARCH_SUPPORTS_MSI=y
+# CONFIG_PCI_MSI is not set
 
 #
 # PCCARD (PCMCIA/CardBus) support
@@ -175,6 +194,7 @@ CONFIG_PCI=y
 #
 # Kernel Features
 #
+# CONFIG_TICK_ONESHOT is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_NO_IDLE_HZ is not set
 CONFIG_HZ=100
@@ -189,6 +209,9 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4096
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
 CONFIG_ALIGNMENT_TRAP=y
 
 #
@@ -198,6 +221,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CMDLINE="ip=bootp root=nfs console=ttyS0,115200 nfsroot=,tcp,v3,wsize=8192,rsize=8192"
 # CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
 
 #
 # Floating point emulation
@@ -222,7 +246,6 @@ CONFIG_BINFMT_AOUT=y
 # Power management options
 #
 # CONFIG_PM is not set
-# CONFIG_APM is not set
 
 #
 # Networking
@@ -232,14 +255,15 @@ CONFIG_NET=y
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
 CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
 # CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
 CONFIG_NET_KEY=y
+# CONFIG_NET_KEY_MIGRATE is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 # CONFIG_IP_ADVANCED_ROUTER is not set
@@ -270,6 +294,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 CONFIG_IPV6=y
 # CONFIG_IPV6_PRIVACY is not set
 # CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
 # CONFIG_INET6_AH is not set
 # CONFIG_INET6_ESP is not set
 # CONFIG_INET6_IPCOMP is not set
@@ -285,20 +310,8 @@ CONFIG_IPV6=y
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -324,7 +337,17 @@ CONFIG_IPV6=y
 # CONFIG_HAMRADIO is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -337,15 +360,7 @@ CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 # CONFIG_MTD_CONCAT is not set
@@ -361,6 +376,7 @@ CONFIG_MTD_REDBOOT_PARTS_READONLY=y
 # User Modules And Translation Layers
 #
 # CONFIG_MTD_CHAR is not set
+CONFIG_MTD_BLKDEVS=y
 CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
@@ -397,7 +413,6 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
@@ -425,42 +440,27 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=2
 # CONFIG_MTD_DOC2000 is not set
 # CONFIG_MTD_DOC2001 is not set
 # CONFIG_MTD_DOC2001PLUS is not set
-
-#
-# NAND Flash Device Drivers
-#
 # CONFIG_MTD_NAND is not set
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 # CONFIG_BLK_DEV_LOOP is not set
-CONFIG_BLK_DEV_NBD=y
+# CONFIG_BLK_DEV_NBD is not set
 # CONFIG_BLK_DEV_SX8 is not set
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=2
 CONFIG_BLK_DEV_RAM_SIZE=8192
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-CONFIG_BLK_DEV_INITRD=y
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
 
@@ -469,6 +469,7 @@ CONFIG_BLK_DEV_INITRD=y
 #
 # CONFIG_RAID_ATTRS is not set
 CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
 # CONFIG_SCSI_TGT is not set
 # CONFIG_SCSI_NETLINK is not set
 CONFIG_SCSI_PROC_FS=y
@@ -490,6 +491,7 @@ CONFIG_CHR_DEV_SG=y
 CONFIG_SCSI_CONSTANTS=y
 # CONFIG_SCSI_LOGGING is not set
 # CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
 
 #
 # SCSI Transports
@@ -534,15 +536,7 @@ CONFIG_SCSI_SAS_ATTRS=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=y
 # CONFIG_MD_LINEAR is not set
@@ -560,6 +554,7 @@ CONFIG_BLK_DEV_DM=y
 # CONFIG_DM_MIRROR is not set
 # CONFIG_DM_ZERO is not set
 # CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
 
 #
 # Fusion MPT device support
@@ -572,39 +567,19 @@ CONFIG_BLK_DEV_DM=y
 #
 # IEEE 1394 (FireWire) support
 #
+# CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
 # CONFIG_I2O is not set
-
-#
-# Network device support
-#
 CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
-
-#
-# Ethernet (10 or 100Mbit)
-#
 # CONFIG_NET_ETHERNET is not set
-
-#
-# Ethernet (1000 Mbit)
-#
+CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 CONFIG_E1000=y
@@ -617,33 +592,26 @@ CONFIG_E1000_NAPI=y
 # 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 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
-
-#
-# Ethernet (10000 Mbit)
-#
+# CONFIG_ATL1 is not set
+CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
+# CONFIG_CHELSIO_T3 is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
-
-#
-# Token Ring devices
-#
+# CONFIG_MLX4_CORE is not set
 # CONFIG_TR is not set
 
 #
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
+# Wireless LAN
 #
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
@@ -654,10 +622,6 @@ CONFIG_E1000_NAPI=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
 
 #
@@ -665,6 +629,7 @@ CONFIG_E1000_NAPI=y
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
@@ -684,6 +649,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
@@ -721,33 +687,18 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
 # CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
+CONFIG_DEVPORT=y
 CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
 # CONFIG_I2C_CHARDEV is not set
 
 #
@@ -774,25 +725,28 @@ CONFIG_I2C_IOP3XX=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PROSAVAGE is not set
 # CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_I2C_SIMTEC is not set
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_STUB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
-# CONFIG_I2C_PCA_ISA is not set
 
 #
 # Miscellaneous I2C Chip support
 #
 # CONFIG_SENSORS_DS1337 is not set
 # CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_EEPROM is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_PCF8591 is not set
 # CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
@@ -803,21 +757,15 @@ CONFIG_I2C_IOP3XX=y
 #
 # CONFIG_SPI is not set
 # CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
@@ -840,6 +788,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
 # CONFIG_SENSORS_PC87427 is not set
 # CONFIG_SENSORS_SIS5595 is not set
@@ -857,12 +806,16 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_PHANTOM is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_SGI_IOC4 is not set
+# CONFIG_TIFM_CORE is not set
 
 #
-# Misc devices
+# Multifunction device drivers
 #
-# CONFIG_SGI_IOC4 is not set
-# CONFIG_TIFM_CORE is not set
+# CONFIG_MFD_SM501 is not set
 
 #
 # LED devices
@@ -881,16 +834,19 @@ CONFIG_HWMON=y
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+CONFIG_DAB=y
 
 #
-# Digital Video Broadcasting Devices
+# Graphics support
 #
-# CONFIG_DVB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Graphics support
+# Display device support
 #
-CONFIG_FIRMWARE_EDID=y
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
 # CONFIG_FB is not set
 
 #
@@ -898,21 +854,15 @@ CONFIG_FIRMWARE_EDID=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
 #
 # CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
+CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
-
-#
-# USB support
-#
+# CONFIG_HID_DEBUG is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
@@ -926,10 +876,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
 # CONFIG_MMC is not set
 
 #
@@ -938,6 +884,22 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 CONFIG_RTC_LIB=y
 # CONFIG_RTC_CLASS is not set
 
+#
+# DMA Engine support
+#
+CONFIG_DMA_ENGINE=y
+
+#
+# DMA Clients
+#
+# CONFIG_NET_DMA is not set
+
+#
+# DMA Devices
+#
+# CONFIG_INTEL_IOATDMA is not set
+CONFIG_INTEL_IOP_ADMA=y
+
 #
 # File systems
 #
@@ -1004,7 +966,6 @@ CONFIG_ECRYPT_FS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
 CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -1014,7 +975,7 @@ CONFIG_JFFS2_FS_WRITEBUFFER=y
 CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
 # CONFIG_JFFS2_RUBIN is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=y
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
@@ -1040,6 +1001,7 @@ CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 CONFIG_SMB_FS=m
@@ -1053,7 +1015,6 @@ CONFIG_CIFS=m
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
@@ -1075,6 +1036,7 @@ CONFIG_MSDOS_PARTITION=y
 # CONFIG_SUN_PARTITION is not set
 # CONFIG_KARMA_PARTITION is not set
 # CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
 
 #
 # Native Language Support
@@ -1140,7 +1102,6 @@ CONFIG_ENABLE_MUST_CHECK=y
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
 CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_FRAME_POINTER=y
 CONFIG_DEBUG_USER=y
@@ -1151,10 +1112,10 @@ CONFIG_DEBUG_USER=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
+CONFIG_XOR_BLOCKS=y
+CONFIG_ASYNC_CORE=y
+CONFIG_ASYNC_MEMCPY=y
+CONFIG_ASYNC_XOR=y
 CONFIG_CRYPTO=y
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
@@ -1173,8 +1134,11 @@ CONFIG_CRYPTO_TGR192=y
 CONFIG_CRYPTO_GF128MUL=y
 CONFIG_CRYPTO_ECB=y
 CONFIG_CRYPTO_CBC=y
+CONFIG_CRYPTO_PCBC=m
 CONFIG_CRYPTO_LRW=y
+# CONFIG_CRYPTO_CRYPTD is not set
 CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
 CONFIG_CRYPTO_BLOWFISH=y
 CONFIG_CRYPTO_TWOFISH=y
 CONFIG_CRYPTO_TWOFISH_COMMON=y
@@ -1189,11 +1153,9 @@ CONFIG_CRYPTO_ANUBIS=y
 CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_MICHAEL_MIC=y
 CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_CAMELLIA is not set
 # CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_CRYPTO_HW=y
 
 #
 # Library routines
@@ -1201,9 +1163,13 @@ CONFIG_CRYPTO_CRC32C=y
 CONFIG_BITREVERSE=y
 CONFIG_CRC_CCITT=y
 # CONFIG_CRC16 is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
 CONFIG_LIBCRC32C=y
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 CONFIG_PLIST=y
-CONFIG_IOMAP_COPY=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
index 7909a555706d8e77788e1b7f685e24a46439f184..027aef22b4d15ae54b88908e2a4742b1372f8704 100644 (file)
@@ -1,12 +1,18 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20-rc1-git5
-# Tue Dec 19 21:37:52 2006
+# Linux kernel version: 2.6.22
+# Thu Jul 19 16:00:36 2007
 #
 CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+# CONFIG_GENERIC_GPIO is not set
 # CONFIG_GENERIC_TIME is not set
+# CONFIG_GENERIC_CLOCKEVENTS is not set
 CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_GENERIC_IRQ_PROBE=y
@@ -15,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
 CONFIG_VECTORS_BASE=0xffff0000
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
@@ -32,16 +39,18 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
+CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
@@ -57,32 +66,30 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
-CONFIG_SLAB=y
 CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
 
 #
 # IO Schedulers
@@ -114,13 +121,15 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_ARCH_NETX is not set
 # CONFIG_ARCH_H720X is not set
 # CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
 CONFIG_ARCH_IOP32X=y
 # CONFIG_ARCH_IOP33X is not set
-# CONFIG_ARCH_IOP13XX is not set
-# CONFIG_ARCH_IXP4XX is not set
-# CONFIG_ARCH_IXP2000 is not set
 # CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
 # CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
 # CONFIG_ARCH_PNX4008 is not set
 # CONFIG_ARCH_PXA is not set
 # CONFIG_ARCH_RPC is not set
@@ -128,6 +137,7 @@ CONFIG_ARCH_IOP32X=y
 # CONFIG_ARCH_S3C2410 is not set
 # CONFIG_ARCH_SHARK is not set
 # CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
 # CONFIG_ARCH_OMAP is not set
 
 #
@@ -137,10 +147,12 @@ CONFIG_ARCH_IOP32X=y
 #
 # IOP32x Platform Types
 #
+CONFIG_MACH_EP80219=y
 CONFIG_MACH_GLANTANK=y
 CONFIG_ARCH_IQ80321=y
 CONFIG_ARCH_IQ31244=y
 CONFIG_MACH_N2100=y
+CONFIG_IOP3XX_ATU=y
 CONFIG_PLAT_IOP=y
 
 #
@@ -160,6 +172,7 @@ CONFIG_CPU_CP15_MMU=y
 #
 # CONFIG_ARM_THUMB is not set
 # CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
 # CONFIG_IWMMXT is not set
 CONFIG_XSCALE_PMU=y
 
@@ -167,7 +180,8 @@ CONFIG_XSCALE_PMU=y
 # Bus support
 #
 CONFIG_PCI=y
-# CONFIG_PCI_MULTITHREAD_PROBE is not set
+CONFIG_PCI_SYSCALL=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCI_DEBUG is not set
 
 #
@@ -178,6 +192,7 @@ CONFIG_PCI=y
 #
 # Kernel Features
 #
+# CONFIG_TICK_ONESHOT is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_NO_IDLE_HZ is not set
 CONFIG_HZ=100
@@ -192,6 +207,9 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4096
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
 CONFIG_ALIGNMENT_TRAP=y
 
 #
@@ -199,8 +217,9 @@ CONFIG_ALIGNMENT_TRAP=y
 #
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp"
+CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp cachepolicy=writealloc"
 # CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
 
 #
 # Floating point emulation
@@ -225,7 +244,6 @@ CONFIG_BINFMT_AOUT=y
 # Power management options
 #
 # CONFIG_PM is not set
-# CONFIG_APM is not set
 
 #
 # Networking
@@ -235,13 +253,13 @@ CONFIG_NET=y
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
 CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
 # CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
@@ -273,6 +291,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 CONFIG_IPV6=y
 # CONFIG_IPV6_PRIVACY is not set
 # CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
 # CONFIG_INET6_AH is not set
 # CONFIG_INET6_ESP is not set
 # CONFIG_INET6_IPCOMP is not set
@@ -288,20 +307,8 @@ CONFIG_IPV6=y
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -327,7 +334,17 @@ CONFIG_IPV6=y
 # CONFIG_HAMRADIO is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -340,16 +357,9 @@ CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 # CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 # CONFIG_MTD_CONCAT is not set
@@ -365,6 +375,7 @@ CONFIG_MTD_REDBOOT_PARTS_READONLY=y
 # User Modules And Translation Layers
 #
 CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
 CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
@@ -396,7 +407,6 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
@@ -424,29 +434,15 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1
 # CONFIG_MTD_DOC2000 is not set
 # CONFIG_MTD_DOC2001 is not set
 # CONFIG_MTD_DOC2001PLUS is not set
-
-#
-# NAND Flash Device Drivers
-#
 # CONFIG_MTD_NAND is not set
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
@@ -461,13 +457,8 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=8192
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-CONFIG_BLK_DEV_INITRD=y
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
 # CONFIG_IDE is not set
 
 #
@@ -475,6 +466,7 @@ CONFIG_BLK_DEV_INITRD=y
 #
 # CONFIG_RAID_ATTRS is not set
 CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
 # CONFIG_SCSI_TGT is not set
 # CONFIG_SCSI_NETLINK is not set
 CONFIG_SCSI_PROC_FS=y
@@ -496,6 +488,7 @@ CONFIG_CHR_DEV_SG=y
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
 # CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
 
 #
 # SCSI Transports
@@ -541,11 +534,8 @@ CONFIG_CHR_DEV_SG=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 CONFIG_ATA=y
+# CONFIG_ATA_NONSTANDARD is not set
 # CONFIG_SATA_AHCI is not set
 # CONFIG_SATA_SVW is not set
 # CONFIG_ATA_PIIX is not set
@@ -560,11 +550,13 @@ CONFIG_SATA_SIL=y
 # CONFIG_SATA_SIS is not set
 # CONFIG_SATA_ULI is not set
 # CONFIG_SATA_VIA is not set
-# CONFIG_SATA_VITESSE is not set
+CONFIG_SATA_VITESSE=y
+# CONFIG_SATA_INIC162X is not set
 # CONFIG_PATA_ALI is not set
 # CONFIG_PATA_AMD is not set
 # CONFIG_PATA_ARTOP is not set
 # CONFIG_PATA_ATIIXP is not set
+# CONFIG_PATA_CMD640_PCI is not set
 # CONFIG_PATA_CMD64X is not set
 # CONFIG_PATA_CS5520 is not set
 # CONFIG_PATA_CS5530 is not set
@@ -576,6 +568,7 @@ CONFIG_SATA_SIL=y
 # CONFIG_PATA_HPT3X2N is not set
 # CONFIG_PATA_HPT3X3 is not set
 # CONFIG_PATA_IT821X is not set
+# CONFIG_PATA_IT8213 is not set
 # CONFIG_PATA_JMICRON is not set
 # CONFIG_PATA_TRIFLEX is not set
 # CONFIG_PATA_MARVELL is not set
@@ -595,17 +588,14 @@ CONFIG_SATA_SIL=y
 # CONFIG_PATA_SIS is not set
 # CONFIG_PATA_VIA is not set
 # CONFIG_PATA_WINBOND is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=y
 # CONFIG_MD_LINEAR is not set
 CONFIG_MD_RAID0=y
 CONFIG_MD_RAID1=y
-# CONFIG_MD_RAID10 is not set
-# CONFIG_MD_RAID456 is not set
+CONFIG_MD_RAID10=y
+CONFIG_MD_RAID456=y
+# CONFIG_MD_RAID5_RESHAPE is not set
 # CONFIG_MD_MULTIPATH is not set
 # CONFIG_MD_FAULTY is not set
 CONFIG_BLK_DEV_DM=y
@@ -615,6 +605,7 @@ CONFIG_BLK_DEV_DM=y
 # CONFIG_DM_MIRROR is not set
 # CONFIG_DM_ZERO is not set
 # CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
 
 #
 # Fusion MPT device support
@@ -627,47 +618,27 @@ CONFIG_BLK_DEV_DM=y
 #
 # IEEE 1394 (FireWire) support
 #
+# CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
 # CONFIG_I2O is not set
-
-#
-# Network device support
-#
 CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 # CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
+# CONFIG_AX88796 is not set
 # CONFIG_HAPPYMEAL is not set
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
 # CONFIG_DM9000 is not set
-
-#
-# Tulip family network device support
-#
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_NET_PCI=y
@@ -689,10 +660,8 @@ CONFIG_E100=y
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
-
-#
-# Ethernet (1000 Mbit)
-#
+# CONFIG_SC92031 is not set
+CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 CONFIG_E1000=y
@@ -706,34 +675,36 @@ CONFIG_R8169=y
 # 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 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
-
-#
-# Ethernet (10000 Mbit)
-#
+# CONFIG_ATL1 is not set
+CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
+# CONFIG_CHELSIO_T3 is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
-
-#
-# Token Ring devices
-#
+# CONFIG_MLX4_CORE is not set
 # CONFIG_TR is not set
 
 #
-# Wireless LAN (non-hamradio)
+# Wireless LAN
 #
-# CONFIG_NET_RADIO is not set
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
 
 #
-# Wan interfaces
+# USB Network Adapters
 #
+# CONFIG_USB_CATC is not set
+# CONFIG_USB_KAWETH is not set
+# CONFIG_USB_PEGASUS is not set
+# CONFIG_USB_RTL8150 is not set
+# CONFIG_USB_USBNET_MII is not set
+# CONFIG_USB_USBNET is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
@@ -744,10 +715,6 @@ CONFIG_R8169=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
 
 #
@@ -755,6 +722,7 @@ CONFIG_R8169=y
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
@@ -774,6 +742,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
@@ -811,33 +780,18 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
 # CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
+CONFIG_DEVPORT=y
 CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
 
 #
@@ -864,25 +818,29 @@ CONFIG_I2C_IOP3XX=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PROSAVAGE is not set
 # CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_I2C_SIMTEC is not set
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_STUB is not set
+# CONFIG_I2C_TINY_USB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
-# CONFIG_I2C_PCA_ISA is not set
 
 #
 # Miscellaneous I2C Chip support
 #
 # CONFIG_SENSORS_DS1337 is not set
 # CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_EEPROM is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_PCF8591 is not set
 # CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
@@ -893,21 +851,15 @@ CONFIG_I2C_IOP3XX=y
 #
 # CONFIG_SPI is not set
 # CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
@@ -930,6 +882,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
 # CONFIG_SENSORS_PC87427 is not set
 # CONFIG_SENSORS_SIS5595 is not set
@@ -947,12 +900,16 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_PHANTOM is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_SGI_IOC4 is not set
+# CONFIG_TIFM_CORE is not set
 
 #
-# Misc devices
+# Multifunction device drivers
 #
-# CONFIG_SGI_IOC4 is not set
-# CONFIG_TIFM_CORE is not set
+# CONFIG_MFD_SM501 is not set
 
 #
 # LED devices
@@ -971,17 +928,20 @@ CONFIG_HWMON=y
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+CONFIG_DAB=y
+# CONFIG_USB_DABUSB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Graphics support
 #
-# CONFIG_DVB is not set
-# CONFIG_USB_DABUSB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Graphics support
+# Display device support
 #
-CONFIG_FIRMWARE_EDID=y
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
 # CONFIG_FB is not set
 
 #
@@ -989,21 +949,26 @@ CONFIG_FIRMWARE_EDID=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
 #
 # CONFIG_SOUND is not set
+CONFIG_HID_SUPPORT=y
+CONFIG_HID=y
+# CONFIG_HID_DEBUG is not set
 
 #
-# HID Devices
+# USB Input Devices
 #
-CONFIG_HID=y
+# CONFIG_USB_HID is not set
 
 #
-# USB support
+# USB HID Boot Protocol drivers
 #
+# CONFIG_USB_KBD is not set
+# CONFIG_USB_MOUSE is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
@@ -1014,9 +979,8 @@ CONFIG_USB=y
 # Miscellaneous USB options
 #
 # CONFIG_USB_DEVICEFS is not set
-# CONFIG_USB_BANDWIDTH is not set
+CONFIG_USB_DEVICE_CLASS=y
 # CONFIG_USB_DYNAMIC_MINORS is not set
-# CONFIG_USB_MULTITHREAD_PROBE is not set
 # CONFIG_USB_OTG is not set
 
 #
@@ -1030,6 +994,7 @@ CONFIG_USB_EHCI_TT_NEWSCHED=y
 # CONFIG_USB_OHCI_HCD is not set
 CONFIG_USB_UHCI_HCD=y
 # CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
 
 #
 # USB Device Class drivers
@@ -1057,44 +1022,11 @@ CONFIG_USB_STORAGE=y
 # CONFIG_USB_STORAGE_KARMA is not set
 # CONFIG_USB_LIBUSUAL is not set
 
-#
-# USB Input Devices
-#
-# CONFIG_USB_HID is not set
-
-#
-# USB HID Boot Protocol drivers
-#
-# CONFIG_USB_KBD is not set
-# CONFIG_USB_MOUSE is not set
-# CONFIG_USB_AIPTEK is not set
-# CONFIG_USB_WACOM is not set
-# CONFIG_USB_ACECAD is not set
-# CONFIG_USB_KBTAB is not set
-# CONFIG_USB_POWERMATE is not set
-# CONFIG_USB_TOUCHSCREEN is not set
-# 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
-
 #
 # USB Imaging devices
 #
 # CONFIG_USB_MDC800 is not set
 # CONFIG_USB_MICROTEK is not set
-
-#
-# USB Network Adapters
-#
-# CONFIG_USB_CATC is not set
-# CONFIG_USB_KAWETH is not set
-# CONFIG_USB_PEGASUS is not set
-# CONFIG_USB_RTL8150 is not set
-# CONFIG_USB_USBNET_MII is not set
-# CONFIG_USB_USBNET is not set
 CONFIG_USB_MON=y
 
 #
@@ -1116,6 +1048,7 @@ CONFIG_USB_MON=y
 # CONFIG_USB_RIO500 is not set
 # CONFIG_USB_LEGOTOWER is not set
 # CONFIG_USB_LCD is not set
+# CONFIG_USB_BERRY_CHARGE is not set
 # CONFIG_USB_LED is not set
 # CONFIG_USB_CYPRESS_CY7C63 is not set
 # CONFIG_USB_CYTHERM is not set
@@ -1126,6 +1059,7 @@ CONFIG_USB_MON=y
 # CONFIG_USB_SISUSBVGA is not set
 # CONFIG_USB_LD is not set
 # CONFIG_USB_TRANCEVIBRATOR is not set
+# CONFIG_USB_IOWARRIOR is not set
 
 #
 # USB DSL modem support
@@ -1135,10 +1069,6 @@ CONFIG_USB_MON=y
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
 # CONFIG_MMC is not set
 
 #
@@ -1147,6 +1077,22 @@ CONFIG_USB_MON=y
 CONFIG_RTC_LIB=y
 # CONFIG_RTC_CLASS is not set
 
+#
+# DMA Engine support
+#
+CONFIG_DMA_ENGINE=y
+
+#
+# DMA Clients
+#
+CONFIG_NET_DMA=y
+
+#
+# DMA Devices
+#
+# CONFIG_INTEL_IOATDMA is not set
+CONFIG_INTEL_IOP_ADMA=y
+
 #
 # File systems
 #
@@ -1164,11 +1110,7 @@ CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_XFS_FS=y
-# CONFIG_XFS_QUOTA is not set
-CONFIG_XFS_SECURITY=y
-CONFIG_XFS_POSIX_ACL=y
-# CONFIG_XFS_RT is not set
+# CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_MINIX_FS is not set
@@ -1217,7 +1159,6 @@ CONFIG_ECRYPT_FS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
 CONFIG_JFFS2_FS_WRITEBUFFER=y
@@ -1227,7 +1168,7 @@ CONFIG_JFFS2_FS_WRITEBUFFER=y
 CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
 # CONFIG_JFFS2_RUBIN is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=y
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
@@ -1253,6 +1194,7 @@ CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -1260,7 +1202,6 @@ CONFIG_SUNRPC=y
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
@@ -1282,6 +1223,7 @@ CONFIG_MSDOS_PARTITION=y
 # CONFIG_SUN_PARTITION is not set
 # CONFIG_KARMA_PARTITION is not set
 # CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
 
 #
 # Native Language Support
@@ -1308,15 +1250,19 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 CONFIG_DEBUG_KERNEL=y
-CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_DEBUG_SHIRQ is not set
 CONFIG_DETECT_SOFTLOCKUP=y
+CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
-# CONFIG_DEBUG_RWSEMS is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -1327,6 +1273,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_FRAME_POINTER=y
 # CONFIG_FORCED_INLINING is not set
 # CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_FAULT_INJECTION is not set
 CONFIG_DEBUG_USER=y
 # CONFIG_DEBUG_ERRORS is not set
 CONFIG_DEBUG_LL=y
@@ -1338,10 +1285,10 @@ CONFIG_DEBUG_LL=y
 CONFIG_KEYS=y
 CONFIG_KEYS_DEBUG_PROC_KEYS=y
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
+CONFIG_XOR_BLOCKS=y
+CONFIG_ASYNC_CORE=y
+CONFIG_ASYNC_MEMCPY=y
+CONFIG_ASYNC_XOR=y
 CONFIG_CRYPTO=y
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
@@ -1360,8 +1307,11 @@ CONFIG_CRYPTO_TGR192=y
 CONFIG_CRYPTO_GF128MUL=y
 CONFIG_CRYPTO_ECB=y
 CONFIG_CRYPTO_CBC=y
+CONFIG_CRYPTO_PCBC=m
 CONFIG_CRYPTO_LRW=y
+# CONFIG_CRYPTO_CRYPTD is not set
 CONFIG_CRYPTO_DES=y
+# CONFIG_CRYPTO_FCRYPT is not set
 CONFIG_CRYPTO_BLOWFISH=y
 CONFIG_CRYPTO_TWOFISH=y
 CONFIG_CRYPTO_TWOFISH_COMMON=y
@@ -1376,11 +1326,9 @@ CONFIG_CRYPTO_ANUBIS=y
 CONFIG_CRYPTO_DEFLATE=y
 CONFIG_CRYPTO_MICHAEL_MIC=y
 CONFIG_CRYPTO_CRC32C=y
+# CONFIG_CRYPTO_CAMELLIA is not set
 # CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_CRYPTO_HW=y
 
 #
 # Library routines
@@ -1388,9 +1336,13 @@ CONFIG_CRYPTO_CRC32C=y
 CONFIG_BITREVERSE=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
 CONFIG_LIBCRC32C=y
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
 CONFIG_PLIST=y
-CONFIG_IOMAP_COPY=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
index fa271bce8ff7de55170a6bfa283bf1670977017d..721ee64a13f7fb740034a27ef646064f0a2355ff 100644 (file)
@@ -1,12 +1,18 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20-rc1
-# Sat Dec 16 06:05:34 2006
+# Linux kernel version: 2.6.22
+# Thu Jul 19 16:05:59 2007
 #
 CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+# CONFIG_GENERIC_GPIO is not set
 # CONFIG_GENERIC_TIME is not set
+# CONFIG_GENERIC_CLOCKEVENTS is not set
 CONFIG_MMU=y
+# CONFIG_NO_IOPORT is not set
 CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
 CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 CONFIG_HARDIRQS_SW_RESEND=y
 CONFIG_GENERIC_IRQ_PROBE=y
@@ -15,6 +21,7 @@ CONFIG_RWSEM_GENERIC_SPINLOCK=y
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_ZONE_DMA=y
 CONFIG_VECTORS_BASE=0xffff0000
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
@@ -32,16 +39,18 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
+CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 CONFIG_BSD_PROCESS_ACCT=y
 # CONFIG_BSD_PROCESS_ACCT_V3 is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
 CONFIG_SYSFS_DEPRECATED=y
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
@@ -57,32 +66,30 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
-CONFIG_SLAB=y
 CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
 
 #
 # IO Schedulers
@@ -114,13 +121,15 @@ CONFIG_DEFAULT_IOSCHED="cfq"
 # CONFIG_ARCH_NETX is not set
 # CONFIG_ARCH_H720X is not set
 # CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
 # CONFIG_ARCH_IOP32X is not set
 CONFIG_ARCH_IOP33X=y
-# CONFIG_ARCH_IOP13XX is not set
-# CONFIG_ARCH_IXP4XX is not set
-# CONFIG_ARCH_IXP2000 is not set
 # CONFIG_ARCH_IXP23XX is not set
+# CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
 # CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
 # CONFIG_ARCH_PNX4008 is not set
 # CONFIG_ARCH_PXA is not set
 # CONFIG_ARCH_RPC is not set
@@ -128,7 +137,9 @@ CONFIG_ARCH_IOP33X=y
 # CONFIG_ARCH_S3C2410 is not set
 # CONFIG_ARCH_SHARK is not set
 # CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
 # CONFIG_ARCH_OMAP is not set
+CONFIG_IOP3XX_ATU=y
 
 #
 # IOP33x Implementation Options
@@ -158,6 +169,7 @@ CONFIG_CPU_CP15_MMU=y
 #
 # CONFIG_ARM_THUMB is not set
 # CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
 # CONFIG_IWMMXT is not set
 CONFIG_XSCALE_PMU=y
 
@@ -165,7 +177,8 @@ CONFIG_XSCALE_PMU=y
 # Bus support
 #
 CONFIG_PCI=y
-# CONFIG_PCI_MULTITHREAD_PROBE is not set
+CONFIG_PCI_SYSCALL=y
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCI_DEBUG is not set
 
 #
@@ -176,6 +189,7 @@ CONFIG_PCI=y
 #
 # Kernel Features
 #
+# CONFIG_TICK_ONESHOT is not set
 # CONFIG_PREEMPT is not set
 # CONFIG_NO_IDLE_HZ is not set
 CONFIG_HZ=100
@@ -190,6 +204,9 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 # CONFIG_SPARSEMEM_STATIC is not set
 CONFIG_SPLIT_PTLOCK_CPUS=4096
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
 CONFIG_ALIGNMENT_TRAP=y
 
 #
@@ -197,8 +214,9 @@ CONFIG_ALIGNMENT_TRAP=y
 #
 CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
-CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp"
+CONFIG_CMDLINE="console=ttyS0,115200 root=/dev/nfs ip=bootp cachepolicy=writealloc"
 # CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
 
 #
 # Floating point emulation
@@ -223,7 +241,6 @@ CONFIG_BINFMT_AOUT=y
 # Power management options
 #
 # CONFIG_PM is not set
-# CONFIG_APM is not set
 
 #
 # Networking
@@ -233,13 +250,13 @@ CONFIG_NET=y
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 CONFIG_PACKET=y
 CONFIG_PACKET_MMAP=y
 CONFIG_UNIX=y
 CONFIG_XFRM=y
 # CONFIG_XFRM_USER is not set
 # CONFIG_XFRM_SUB_POLICY is not set
+# CONFIG_XFRM_MIGRATE is not set
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
@@ -271,6 +288,7 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 CONFIG_IPV6=y
 # CONFIG_IPV6_PRIVACY is not set
 # CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
 # CONFIG_INET6_AH is not set
 # CONFIG_INET6_ESP is not set
 # CONFIG_INET6_IPCOMP is not set
@@ -286,20 +304,8 @@ CONFIG_IPV6=y
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -325,7 +331,17 @@ CONFIG_IPV6=y
 # CONFIG_HAMRADIO is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -338,16 +354,9 @@ CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_FW_LOADER is not set
 # CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
 CONFIG_MTD=y
 # CONFIG_MTD_DEBUG is not set
 # CONFIG_MTD_CONCAT is not set
@@ -363,6 +372,7 @@ CONFIG_MTD_REDBOOT_PARTS_READONLY=y
 # User Modules And Translation Layers
 #
 CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
 CONFIG_MTD_BLOCK=y
 # CONFIG_FTL is not set
 # CONFIG_NFTL is not set
@@ -399,7 +409,6 @@ CONFIG_MTD_CFI_UTIL=y
 # CONFIG_MTD_RAM is not set
 # CONFIG_MTD_ROM is not set
 # CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_OBSOLETE_CHIPS is not set
 
 #
 # Mapping drivers for chip access
@@ -427,29 +436,15 @@ CONFIG_MTD_PHYSMAP_BANKWIDTH=1
 # CONFIG_MTD_DOC2000 is not set
 # CONFIG_MTD_DOC2001 is not set
 # CONFIG_MTD_DOC2001PLUS is not set
-
-#
-# NAND Flash Device Drivers
-#
 # CONFIG_MTD_NAND is not set
-
-#
-# OneNAND Flash Device Drivers
-#
 # CONFIG_MTD_ONENAND is not set
 
 #
-# Parallel port support
+# UBI - Unsorted block images
 #
+# CONFIG_MTD_UBI is not set
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
@@ -462,13 +457,8 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=8192
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-CONFIG_BLK_DEV_INITRD=y
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
 # CONFIG_IDE is not set
 
 #
@@ -476,6 +466,7 @@ CONFIG_BLK_DEV_INITRD=y
 #
 # CONFIG_RAID_ATTRS is not set
 CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
 # CONFIG_SCSI_TGT is not set
 # CONFIG_SCSI_NETLINK is not set
 CONFIG_SCSI_PROC_FS=y
@@ -497,6 +488,7 @@ CONFIG_CHR_DEV_SG=y
 # CONFIG_SCSI_CONSTANTS is not set
 # CONFIG_SCSI_LOGGING is not set
 # CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
 
 #
 # SCSI Transports
@@ -541,22 +533,15 @@ CONFIG_CHR_DEV_SG=y
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
 # CONFIG_SCSI_SRP is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
 CONFIG_MD=y
 CONFIG_BLK_DEV_MD=y
 CONFIG_MD_LINEAR=y
 CONFIG_MD_RAID0=y
 CONFIG_MD_RAID1=y
 # CONFIG_MD_RAID10 is not set
-# CONFIG_MD_RAID456 is not set
+CONFIG_MD_RAID456=y
+# CONFIG_MD_RAID5_RESHAPE is not set
 # CONFIG_MD_MULTIPATH is not set
 # CONFIG_MD_FAULTY is not set
 CONFIG_BLK_DEV_DM=y
@@ -566,6 +551,7 @@ CONFIG_BLK_DEV_DM=y
 # CONFIG_DM_MIRROR is not set
 # CONFIG_DM_ZERO is not set
 # CONFIG_DM_MULTIPATH is not set
+# CONFIG_DM_DELAY is not set
 
 #
 # Fusion MPT device support
@@ -578,39 +564,19 @@ CONFIG_BLK_DEV_DM=y
 #
 # IEEE 1394 (FireWire) support
 #
+# CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
 # CONFIG_I2O is not set
-
-#
-# Network device support
-#
 CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
-
-#
-# Ethernet (10 or 100Mbit)
-#
 # CONFIG_NET_ETHERNET is not set
-
-#
-# Ethernet (1000 Mbit)
-#
+CONFIG_NETDEV_1000=y
 # CONFIG_ACENIC is not set
 # CONFIG_DL2K is not set
 CONFIG_E1000=y
@@ -623,33 +589,26 @@ CONFIG_E1000_NAPI=y
 # 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 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
-
-#
-# Ethernet (10000 Mbit)
-#
+# CONFIG_ATL1 is not set
+CONFIG_NETDEV_10000=y
 # CONFIG_CHELSIO_T1 is not set
+# CONFIG_CHELSIO_T3 is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
-
-#
-# Token Ring devices
-#
+# CONFIG_MLX4_CORE is not set
 # CONFIG_TR is not set
 
 #
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
+# Wireless LAN
 #
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
@@ -660,10 +619,6 @@ CONFIG_E1000_NAPI=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
 
 #
@@ -671,6 +626,7 @@ CONFIG_E1000_NAPI=y
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
@@ -690,6 +646,7 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
@@ -727,33 +684,18 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
 # CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=y
 # CONFIG_NVRAM is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
+CONFIG_DEVPORT=y
 CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
 
 #
@@ -780,25 +722,28 @@ CONFIG_I2C_IOP3XX=y
 # CONFIG_I2C_PARPORT_LIGHT is not set
 # CONFIG_I2C_PROSAVAGE is not set
 # CONFIG_I2C_SAVAGE4 is not set
+# CONFIG_I2C_SIMTEC is not set
 # CONFIG_I2C_SIS5595 is not set
 # CONFIG_I2C_SIS630 is not set
 # CONFIG_I2C_SIS96X is not set
+# CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_STUB is not set
 # CONFIG_I2C_VIA is not set
 # CONFIG_I2C_VIAPRO is not set
 # CONFIG_I2C_VOODOO3 is not set
-# CONFIG_I2C_PCA_ISA is not set
 
 #
 # Miscellaneous I2C Chip support
 #
 # CONFIG_SENSORS_DS1337 is not set
 # CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_EEPROM is not set
 # CONFIG_SENSORS_PCF8574 is not set
 # CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_PCF8591 is not set
 # CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
@@ -809,21 +754,15 @@ CONFIG_I2C_IOP3XX=y
 #
 # CONFIG_SPI is not set
 # CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
 # CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_AD7418 is not set
 # CONFIG_SENSORS_ADM1021 is not set
 # CONFIG_SENSORS_ADM1025 is not set
 # CONFIG_SENSORS_ADM1026 is not set
+# CONFIG_SENSORS_ADM1029 is not set
 # CONFIG_SENSORS_ADM1031 is not set
 # CONFIG_SENSORS_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
@@ -846,6 +785,7 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_LM90 is not set
 # CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_MAX1619 is not set
+# CONFIG_SENSORS_MAX6650 is not set
 # CONFIG_SENSORS_PC87360 is not set
 # CONFIG_SENSORS_PC87427 is not set
 # CONFIG_SENSORS_SIS5595 is not set
@@ -863,12 +803,16 @@ CONFIG_HWMON=y
 # CONFIG_SENSORS_W83627HF is not set
 # CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_PHANTOM is not set
+# CONFIG_EEPROM_93CX6 is not set
+# CONFIG_SGI_IOC4 is not set
+# CONFIG_TIFM_CORE is not set
 
 #
-# Misc devices
+# Multifunction device drivers
 #
-# CONFIG_SGI_IOC4 is not set
-# CONFIG_TIFM_CORE is not set
+# CONFIG_MFD_SM501 is not set
 
 #
 # LED devices
@@ -887,16 +831,19 @@ CONFIG_HWMON=y
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+CONFIG_DAB=y
 
 #
-# Digital Video Broadcasting Devices
+# Graphics support
 #
-# CONFIG_DVB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Graphics support
+# Display device support
 #
-CONFIG_FIRMWARE_EDID=y
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
 # CONFIG_FB is not set
 
 #
@@ -904,21 +851,15 @@ CONFIG_FIRMWARE_EDID=y
 #
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
 #
 # CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
+CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
-
-#
-# USB support
-#
+# CONFIG_HID_DEBUG is not set
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
@@ -932,10 +873,6 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # USB Gadget Support
 #
 # CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
 # CONFIG_MMC is not set
 
 #
@@ -944,6 +881,22 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 CONFIG_RTC_LIB=y
 # CONFIG_RTC_CLASS is not set
 
+#
+# DMA Engine support
+#
+CONFIG_DMA_ENGINE=y
+
+#
+# DMA Clients
+#
+CONFIG_NET_DMA=y
+
+#
+# DMA Devices
+#
+# CONFIG_INTEL_IOATDMA is not set
+CONFIG_INTEL_IOP_ADMA=y
+
 #
 # File systems
 #
@@ -961,11 +914,7 @@ CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
-CONFIG_XFS_FS=y
-# CONFIG_XFS_QUOTA is not set
-CONFIG_XFS_SECURITY=y
-CONFIG_XFS_POSIX_ACL=y
-# CONFIG_XFS_RT is not set
+# CONFIG_XFS_FS is not set
 # CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_MINIX_FS is not set
@@ -1013,9 +962,8 @@ CONFIG_RAMFS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
 # CONFIG_JFFS2_FS is not set
-# CONFIG_CRAMFS is not set
+CONFIG_CRAMFS=y
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
 # CONFIG_QNX4FS_FS is not set
@@ -1041,6 +989,7 @@ CONFIG_LOCKD_V4=y
 CONFIG_EXPORTFS=y
 CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -1048,7 +997,6 @@ CONFIG_SUNRPC=y
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
@@ -1070,6 +1018,7 @@ CONFIG_MSDOS_PARTITION=y
 # CONFIG_SUN_PARTITION is not set
 # CONFIG_KARMA_PARTITION is not set
 # CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
 
 #
 # Native Language Support
@@ -1096,15 +1045,19 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_DEBUG_FS is not set
 # CONFIG_HEADERS_CHECK is not set
 CONFIG_DEBUG_KERNEL=y
-CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_DEBUG_SHIRQ is not set
 CONFIG_DETECT_SOFTLOCKUP=y
+CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_RT_MUTEXES is not set
 # CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
 # CONFIG_DEBUG_MUTEXES is not set
-# CONFIG_DEBUG_RWSEMS is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
 # CONFIG_DEBUG_SPINLOCK_SLEEP is not set
 # CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
@@ -1115,6 +1068,7 @@ CONFIG_DEBUG_BUGVERBOSE=y
 CONFIG_FRAME_POINTER=y
 # CONFIG_FORCED_INLINING is not set
 # CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_FAULT_INJECTION is not set
 CONFIG_DEBUG_USER=y
 # CONFIG_DEBUG_ERRORS is not set
 CONFIG_DEBUG_LL=y
@@ -1125,10 +1079,10 @@ CONFIG_DEBUG_LL=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
+CONFIG_XOR_BLOCKS=y
+CONFIG_ASYNC_CORE=y
+CONFIG_ASYNC_MEMCPY=y
+CONFIG_ASYNC_XOR=y
 # CONFIG_CRYPTO is not set
 
 #
@@ -1136,7 +1090,12 @@ CONFIG_DEBUG_LL=y
 #
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+# CONFIG_CRC_ITU_T is not set
 # CONFIG_CRC32 is not set
+# CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
+CONFIG_ZLIB_INFLATE=y
 CONFIG_PLIST=y
-CONFIG_IOMAP_COPY=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
index 8452dc8c7cc3c39a970664dc7e37afcd15628f40..5ddecb9ddf01df02111c587c7c076eed53ec2bc4 100644 (file)
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.11
-# Wed Mar  9 14:41:48 2005
+# Linux kernel version: 2.6.23-rc2
+# Mon Aug  6 16:47:24 2007
 #
 CONFIG_ARM=y
+CONFIG_SYS_SUPPORTS_APM_EMULATION=y
+# CONFIG_GENERIC_GPIO is not set
+# CONFIG_GENERIC_TIME is not set
+# CONFIG_GENERIC_CLOCKEVENTS is not set
 CONFIG_MMU=y
-CONFIG_UID16=y
+CONFIG_NO_IOPORT=y
+CONFIG_GENERIC_HARDIRQS=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
+CONFIG_HARDIRQS_SW_RESEND=y
+CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_IOMAP=y
+CONFIG_ARCH_MAY_HAVE_PC_FDC=y
+CONFIG_ZONE_DMA=y
 CONFIG_FIQ=y
+CONFIG_VECTORS_BASE=0xffff0000
+CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
-CONFIG_CLEAN_COMPILE=y
 CONFIG_BROKEN_ON_SMP=y
-
-#
-# General setup
-#
+CONFIG_INIT_ENV_ARG_LIMIT=32
 CONFIG_LOCALVERSION=""
+# CONFIG_LOCALVERSION_AUTO is not set
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
+CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
-CONFIG_SYSCTL=y
+# CONFIG_TASKSTATS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
-CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_HOTPLUG is not set
-CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+CONFIG_SYSFS_DEPRECATED=y
+# CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SYSCTL=y
 # CONFIG_EMBEDDED is not set
+CONFIG_UID16=y
+CONFIG_SYSCTL_SYSCALL=y
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_ALL is not set
 # 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_ANON_INODES=y
 CONFIG_EPOLL=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
-CONFIG_CC_ALIGN_FUNCTIONS=0
-CONFIG_CC_ALIGN_LABELS=0
-CONFIG_CC_ALIGN_LOOPS=0
-CONFIG_CC_ALIGN_JUMPS=0
+CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
+CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
-CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
+CONFIG_BLOCK=y
+# CONFIG_LBD is not set
+# CONFIG_BLK_DEV_IO_TRACE is not set
+# CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
+
+#
+# IO Schedulers
+#
+CONFIG_IOSCHED_NOOP=y
+CONFIG_IOSCHED_AS=y
+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"
 
 #
 # System Type
 #
+# CONFIG_ARCH_AAEC2000 is not set
+# CONFIG_ARCH_INTEGRATOR is not set
+# CONFIG_ARCH_REALVIEW is not set
+# CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_AT91 is not set
 # CONFIG_ARCH_CLPS7500 is not set
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
 # CONFIG_ARCH_EBSA110 is not set
+# CONFIG_ARCH_EP93XX is not set
 # CONFIG_ARCH_FOOTBRIDGE is not set
-# CONFIG_ARCH_INTEGRATOR is not set
-# CONFIG_ARCH_IOP3XX is not set
-# CONFIG_ARCH_IXP4XX is not set
+# CONFIG_ARCH_NETX is not set
+# CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_IMX is not set
+# CONFIG_ARCH_IOP13XX is not set
+# CONFIG_ARCH_IOP32X is not set
+# CONFIG_ARCH_IOP33X is not set
+# CONFIG_ARCH_IXP23XX is not set
 # CONFIG_ARCH_IXP2000 is not set
+# CONFIG_ARCH_IXP4XX is not set
 # CONFIG_ARCH_L7200 is not set
+# CONFIG_ARCH_KS8695 is not set
+# CONFIG_ARCH_NS9XXX is not set
+# CONFIG_ARCH_MXC is not set
+# CONFIG_ARCH_PNX4008 is not set
 # CONFIG_ARCH_PXA is not set
 CONFIG_ARCH_RPC=y
 # CONFIG_ARCH_SA1100 is not set
 # CONFIG_ARCH_S3C2410 is not set
 # CONFIG_ARCH_SHARK is not set
 # CONFIG_ARCH_LH7A40X is not set
+# CONFIG_ARCH_DAVINCI is not set
 # CONFIG_ARCH_OMAP is not set
-# CONFIG_ARCH_VERSATILE is not set
-# CONFIG_ARCH_IMX is not set
-# CONFIG_ARCH_H720X is not set
+
+#
+# Boot options
+#
+
+#
+# Power management
+#
 CONFIG_ARCH_ACORN=y
 
 #
@@ -100,29 +163,49 @@ CONFIG_CPU_COPY_V3=y
 CONFIG_CPU_COPY_V4WB=y
 CONFIG_CPU_TLB_V3=y
 CONFIG_CPU_TLB_V4WB=y
+CONFIG_CPU_CP15=y
+CONFIG_CPU_CP15_MMU=y
 
 #
 # Processor Features
 #
+# CONFIG_CPU_DCACHE_DISABLE is not set
+# CONFIG_OUTER_CACHE is not set
 CONFIG_TIMER_ACORN=y
 
 #
 # Bus support
 #
+CONFIG_ISA_DMA_API=y
+# CONFIG_PCI_SYSCALL is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 
 #
 # PCCARD (PCMCIA/CardBus) support
 #
 # CONFIG_PCCARD is not set
 
-#
-# PC-card bridges
-#
-
 #
 # Kernel Features
 #
+# CONFIG_TICK_ONESHOT is not set
 # CONFIG_PREEMPT is not set
+# CONFIG_NO_IDLE_HZ is not set
+CONFIG_HZ=100
+# CONFIG_AEABI is not set
+# CONFIG_ARCH_DISCONTIGMEM_ENABLE is not set
+CONFIG_SELECT_MEMORY_MODEL=y
+CONFIG_FLATMEM_MANUAL=y
+# CONFIG_DISCONTIGMEM_MANUAL is not set
+# CONFIG_SPARSEMEM_MANUAL is not set
+CONFIG_FLATMEM=y
+CONFIG_FLAT_NODE_MEM_MAP=y
+# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPLIT_PTLOCK_CPUS=4096
+# CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
+CONFIG_VIRT_TO_BUS=y
 CONFIG_ALIGNMENT_TRAP=y
 
 #
@@ -132,6 +215,7 @@ CONFIG_ZBOOT_ROM_TEXT=0x0
 CONFIG_ZBOOT_ROM_BSS=0x0
 CONFIG_CMDLINE=""
 # CONFIG_XIP_KERNEL is not set
+# CONFIG_KEXEC is not set
 
 #
 # Floating point emulation
@@ -157,41 +241,122 @@ CONFIG_BINFMT_AOUT=y
 # CONFIG_PM is not set
 
 #
-# Device Drivers
+# Networking
 #
+CONFIG_NET=y
 
 #
-# Generic Driver Options
+# Networking options
 #
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_FW_LOADER is not set
-# CONFIG_DEBUG_DRIVER is not set
+CONFIG_PACKET=y
+CONFIG_PACKET_MMAP=y
+CONFIG_UNIX=y
+# CONFIG_NET_KEY is not set
+CONFIG_INET=y
+CONFIG_IP_MULTICAST=y
+# CONFIG_IP_ADVANCED_ROUTER is not set
+CONFIG_IP_FIB_HASH=y
+# CONFIG_IP_PNP is not set
+# CONFIG_NET_IPIP is not set
+# CONFIG_NET_IPGRE is not set
+# CONFIG_IP_MROUTE is not set
+# CONFIG_ARPD is not set
+# CONFIG_SYN_COOKIES is not set
+# CONFIG_INET_AH is not set
+# CONFIG_INET_ESP is not set
+# CONFIG_INET_IPCOMP is not set
+# CONFIG_INET_XFRM_TUNNEL is not set
+CONFIG_INET_TUNNEL=m
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_CUBIC=y
+CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
+CONFIG_IPV6=m
+# CONFIG_IPV6_PRIVACY is not set
+# CONFIG_IPV6_ROUTER_PREF is not set
+# CONFIG_IPV6_OPTIMISTIC_DAD is not set
+# CONFIG_INET6_AH is not set
+# CONFIG_INET6_ESP is not set
+# CONFIG_INET6_IPCOMP is not set
+# CONFIG_IPV6_MIP6 is not set
+# CONFIG_INET6_XFRM_TUNNEL is not set
+# CONFIG_INET6_TUNNEL is not set
+# CONFIG_INET6_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET6_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET6_XFRM_MODE_BEET is not set
+# CONFIG_INET6_XFRM_MODE_ROUTEOPTIMIZATION is not set
+CONFIG_IPV6_SIT=m
+# CONFIG_IPV6_TUNNEL is not set
+# CONFIG_IPV6_MULTIPLE_TABLES is not set
+# CONFIG_NETWORK_SECMARK is not set
+# CONFIG_NETFILTER is not set
+# CONFIG_IP_DCCP is not set
+# CONFIG_IP_SCTP is not set
+# CONFIG_TIPC is not set
+# CONFIG_ATM is not set
+# CONFIG_BRIDGE is not set
+# CONFIG_VLAN_8021Q is not set
+# CONFIG_DECNET is not set
+# CONFIG_LLC2 is not set
+# CONFIG_IPX is not set
+# CONFIG_ATALK is not set
+# CONFIG_X25 is not set
+# CONFIG_LAPB is not set
+# CONFIG_ECONET is not set
+# CONFIG_WAN_ROUTER is not set
 
 #
-# Memory Technology Devices (MTD)
+# QoS and/or fair queueing
 #
-# CONFIG_MTD is not set
+# CONFIG_NET_SCHED is not set
 
 #
-# Parallel port support
+# Network testing
 #
-CONFIG_PARPORT=y
-CONFIG_PARPORT_PC=y
-CONFIG_PARPORT_PC_CML1=y
-CONFIG_PARPORT_PC_FIFO=y
-# CONFIG_PARPORT_PC_SUPERIO is not set
-# CONFIG_PARPORT_ARC is not set
-# CONFIG_PARPORT_OTHER is not set
-# CONFIG_PARPORT_1284 is not set
+# CONFIG_NET_PKTGEN is not set
+# CONFIG_HAMRADIO is not set
+# CONFIG_IRDA is not set
+# CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
+# CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
-# Plug and Play support
+# Device Drivers
 #
 
 #
-# Block devices
+# Generic Driver Options
 #
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER is not set
+# CONFIG_DEBUG_DEVRES is not set
+# CONFIG_SYS_HYPERVISOR is not set
+# CONFIG_CONNECTOR is not set
+# CONFIG_MTD is not set
+CONFIG_PARPORT=y
+CONFIG_PARPORT_PC=y
+CONFIG_PARPORT_PC_FIFO=y
+# CONFIG_PARPORT_PC_SUPERIO is not set
+# CONFIG_PARPORT_GSC is not set
+# CONFIG_PARPORT_AX88796 is not set
+# CONFIG_PARPORT_1284 is not set
+CONFIG_BLK_DEV=y
 CONFIG_BLK_DEV_FD=y
 # CONFIG_PARIDE is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
@@ -201,59 +366,19 @@ CONFIG_BLK_DEV_LOOP=m
 CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_INITRAMFS_SOURCE=""
+CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 # CONFIG_CDROM_PKTCDVD is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# Acorn-specific block devices
-#
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-CONFIG_IDE=y
-CONFIG_BLK_DEV_IDE=y
-
-#
-# Please see Documentation/ide.txt for help/info on IDE drives
-#
-# CONFIG_BLK_DEV_IDE_SATA is not set
-CONFIG_BLK_DEV_IDEDISK=y
-CONFIG_IDEDISK_MULTI_MODE=y
-CONFIG_BLK_DEV_IDECD=y
-# CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_BLK_DEV_IDESCSI is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-
-#
-# IDE chipset support/bugfixes
-#
-CONFIG_IDE_GENERIC=y
-CONFIG_IDE_ARM=y
-CONFIG_BLK_DEV_IDE_ICSIDE=y
-CONFIG_BLK_DEV_IDEDMA_ICS=y
-CONFIG_IDEDMA_ICS_AUTO=y
-CONFIG_BLK_DEV_IDE_RAPIDE=y
-CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-CONFIG_IDEDMA_AUTO=y
-# CONFIG_BLK_DEV_HD is not set
+# CONFIG_IDE is not set
 
 #
 # SCSI device support
 #
+# CONFIG_RAID_ATTRS is not set
 CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
+# CONFIG_SCSI_TGT is not set
+# CONFIG_SCSI_NETLINK is not set
 CONFIG_SCSI_PROC_FS=y
 
 #
@@ -265,6 +390,7 @@ CONFIG_CHR_DEV_ST=m
 CONFIG_BLK_DEV_SR=y
 CONFIG_BLK_DEV_SR_VENDOR=y
 CONFIG_CHR_DEV_SG=y
+# CONFIG_CHR_DEV_SCH is not set
 
 #
 # Some SCSI devices (e.g. CD jukebox) support multiple LUNs
@@ -272,26 +398,23 @@ CONFIG_CHR_DEV_SG=y
 # CONFIG_SCSI_MULTI_LUN is not set
 CONFIG_SCSI_CONSTANTS=y
 CONFIG_SCSI_LOGGING=y
+# CONFIG_SCSI_SCAN_ASYNC is not set
+CONFIG_SCSI_WAIT_SCAN=m
 
 #
-# SCSI Transport Attributes
+# SCSI Transports
 #
-# CONFIG_SCSI_SPI_ATTRS is not set
+CONFIG_SCSI_SPI_ATTRS=m
 # CONFIG_SCSI_FC_ATTRS is not set
 # CONFIG_SCSI_ISCSI_ATTRS is not set
-
-#
-# SCSI low-level drivers
-#
-# CONFIG_SCSI_SATA is not set
-CONFIG_SCSI_PPA=m
-CONFIG_SCSI_IMM=m
+# CONFIG_SCSI_SAS_LIBSAS is not set
+CONFIG_SCSI_LOWLEVEL=y
+# CONFIG_ISCSI_TCP is not set
+# CONFIG_SCSI_PPA is not set
+# CONFIG_SCSI_IMM is not set
 # CONFIG_SCSI_IZIP_EPP16 is not set
 # CONFIG_SCSI_IZIP_SLOW_CTR is not set
 # CONFIG_SCSI_DEBUG is not set
-CONFIG_SCSI_ACORNSCSI_3=m
-CONFIG_SCSI_ACORNSCSI_TAGGED_QUEUE=y
-CONFIG_SCSI_ACORNSCSI_SYNC=y
 CONFIG_SCSI_ARXESCSI=m
 CONFIG_SCSI_CUMANA_2=m
 CONFIG_SCSI_EESOXSCSI=m
@@ -302,129 +425,36 @@ CONFIG_SCSI_POWERTECSCSI=y
 #
 CONFIG_SCSI_CUMANA_1=m
 CONFIG_SCSI_OAK1=m
-
-#
-# Multi-device support (RAID and LVM)
-#
+CONFIG_ATA=y
+# CONFIG_ATA_NONSTANDARD is not set
+CONFIG_PATA_PLATFORM=y
+CONFIG_PATA_ICSIDE=y
 # CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-
-#
-# IEEE 1394 (FireWire) support
-#
-
-#
-# I2O device support
-#
-
-#
-# Networking support
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-# CONFIG_PACKET is not set
-CONFIG_NETLINK_DEV=y
-CONFIG_UNIX=y
-# CONFIG_NET_KEY is not set
-CONFIG_INET=y
-CONFIG_IP_MULTICAST=y
-# CONFIG_IP_ADVANCED_ROUTER is not set
-# CONFIG_IP_PNP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_IP_MROUTE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_TUNNEL is not set
-# CONFIG_IP_TCPDIAG is not set
-# CONFIG_IP_TCPDIAG_IPV6 is not set
-CONFIG_IPV6=m
-# CONFIG_IPV6_PRIVACY is not set
-# CONFIG_INET6_AH is not set
-# CONFIG_INET6_ESP is not set
-# CONFIG_INET6_IPCOMP is not set
-# CONFIG_INET6_TUNNEL is not set
-# CONFIG_IPV6_TUNNEL is not set
-# CONFIG_NETFILTER is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB is not set
-# 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
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
 CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-# CONFIG_ETHERTAP is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
+# CONFIG_PHYLIB is not set
 CONFIG_NET_ETHERNET=y
 # CONFIG_MII is not set
 CONFIG_ARM_ETHER1=y
 CONFIG_ARM_ETHER3=y
 CONFIG_ARM_ETHERH=y
+# CONFIG_AX88796 is not set
 # CONFIG_SMC91X is not set
+# CONFIG_DM9000 is not set
+# CONFIG_NET_POCKET is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
 
 #
-# Ethernet (1000 Mbit)
-#
-
-#
-# Ethernet (10000 Mbit)
-#
-
-#
-# Token Ring devices
-#
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
+# Wireless LAN
 #
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
 # CONFIG_WAN is not set
 # CONFIG_PLIP is not set
 CONFIG_PPP=m
@@ -434,20 +464,23 @@ CONFIG_PPP=m
 # CONFIG_PPP_SYNC_TTY is not set
 # CONFIG_PPP_DEFLATE is not set
 # CONFIG_PPP_BSDCOMP is not set
+# CONFIG_PPP_MPPE is not set
 CONFIG_PPPOE=m
+# CONFIG_PPPOL2TP is not set
 # CONFIG_SLIP is not set
+CONFIG_SLHC=m
 # CONFIG_SHAPER is not set
 # CONFIG_NETCONSOLE is not set
-
-#
-# ISDN subsystem
-#
+# CONFIG_NETPOLL is not set
+# CONFIG_NET_POLL_CONTROLLER is not set
 # CONFIG_ISDN is not set
 
 #
 # Input device support
 #
 CONFIG_INPUT=y
+# CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
@@ -461,19 +494,6 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 CONFIG_INPUT_EVDEV=y
 # CONFIG_INPUT_EVBUG is not set
 
-#
-# Input I/O drivers
-#
-# CONFIG_GAMEPORT is not set
-CONFIG_SOUND_GAMEPORT=y
-CONFIG_SERIO=y
-# CONFIG_SERIO_SERPORT is not set
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PARKBD is not set
-CONFIG_SERIO_RPCKBD=y
-CONFIG_SERIO_LIBPS2=y
-# CONFIG_SERIO_RAW is not set
-
 #
 # Input Device Drivers
 #
@@ -483,21 +503,35 @@ CONFIG_KEYBOARD_ATKBD=y
 # CONFIG_KEYBOARD_LKKBD is not set
 # CONFIG_KEYBOARD_XTKBD is not set
 # CONFIG_KEYBOARD_NEWTON is not set
+# CONFIG_KEYBOARD_STOWAWAY is not set
 CONFIG_INPUT_MOUSE=y
 # CONFIG_MOUSE_PS2 is not set
 # CONFIG_MOUSE_SERIAL is not set
 CONFIG_MOUSE_RISCPC=y
 # CONFIG_MOUSE_VSXXXAA is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
+#
+# Hardware I/O ports
+#
+CONFIG_SERIO=y
+# CONFIG_SERIO_SERPORT is not set
+# CONFIG_SERIO_PARKBD is not set
+CONFIG_SERIO_RPCKBD=y
+CONFIG_SERIO_LIBPS2=y
+# CONFIG_SERIO_RAW is not set
+# CONFIG_GAMEPORT is not set
+
 #
 # Character devices
 #
 CONFIG_VT=y
 CONFIG_VT_CONSOLE=y
 CONFIG_HW_CONSOLE=y
+# CONFIG_VT_HW_CONSOLE_BINDING is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -506,12 +540,13 @@ CONFIG_HW_CONSOLE=y
 CONFIG_SERIAL_8250=y
 CONFIG_SERIAL_8250_CONSOLE=y
 CONFIG_SERIAL_8250_NR_UARTS=16
+CONFIG_SERIAL_8250_RUNTIME_UARTS=8
 # CONFIG_SERIAL_8250_EXTENDED is not set
+CONFIG_SERIAL_8250_ACORN=y
 
 #
 # Non-8250 serial port support
 #
-CONFIG_SERIAL_8250_ACORN=y
 CONFIG_SERIAL_CORE=y
 CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
@@ -521,31 +556,15 @@ CONFIG_PRINTER=m
 # CONFIG_LP_CONSOLE is not set
 # CONFIG_PPDEV is not set
 # CONFIG_TIPAR is not set
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
 # CONFIG_WATCHDOG is not set
+# CONFIG_HW_RANDOM is not set
 # CONFIG_NVRAM is not set
-# CONFIG_RTC is not set
-# CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# I2C support
-#
+# CONFIG_TCG_TPM is not set
 CONFIG_I2C=y
+CONFIG_I2C_BOARDINFO=y
 CONFIG_I2C_CHARDEV=y
 
 #
@@ -558,76 +577,87 @@ CONFIG_I2C_ALGOBIT=y
 #
 # I2C Hardware Bus support
 #
+# CONFIG_I2C_OCORES is not set
 # CONFIG_I2C_PARPORT is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
+# CONFIG_I2C_SIMTEC is not set
+# CONFIG_I2C_TAOS_EVM is not set
 # CONFIG_I2C_STUB is not set
-# CONFIG_I2C_PCA_ISA is not set
-
-#
-# Hardware Sensors Chip support
-#
-# CONFIG_I2C_SENSOR is not set
-# CONFIG_SENSORS_ADM1021 is not set
-# CONFIG_SENSORS_ADM1025 is not set
-# CONFIG_SENSORS_ADM1026 is not set
-# CONFIG_SENSORS_ADM1031 is not set
-# CONFIG_SENSORS_ASB100 is not set
-# CONFIG_SENSORS_DS1621 is not set
-# CONFIG_SENSORS_FSCHER is not set
-# CONFIG_SENSORS_FSCPOS is not set
-# CONFIG_SENSORS_GL518SM is not set
-# CONFIG_SENSORS_GL520SM is not set
-# CONFIG_SENSORS_IT87 is not set
-# CONFIG_SENSORS_LM63 is not set
-# CONFIG_SENSORS_LM75 is not set
-# CONFIG_SENSORS_LM77 is not set
-# CONFIG_SENSORS_LM78 is not set
-# CONFIG_SENSORS_LM80 is not set
-# CONFIG_SENSORS_LM83 is not set
-# CONFIG_SENSORS_LM85 is not set
-# CONFIG_SENSORS_LM87 is not set
-# CONFIG_SENSORS_LM90 is not set
-# CONFIG_SENSORS_MAX1619 is not set
-# CONFIG_SENSORS_PC87360 is not set
-# CONFIG_SENSORS_SMSC47B397 is not set
-# CONFIG_SENSORS_SMSC47M1 is not set
-# CONFIG_SENSORS_W83781D is not set
-# CONFIG_SENSORS_W83L785TS is not set
-# CONFIG_SENSORS_W83627HF is not set
-
-#
-# Other I2C Chip support
+CONFIG_I2C_ACORN=y
+
+#
+# Miscellaneous I2C Chip support
 #
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+# CONFIG_DS1682 is not set
 # CONFIG_SENSORS_EEPROM is not set
 # CONFIG_SENSORS_PCF8574 is not set
+# CONFIG_SENSORS_PCA9539 is not set
 # CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_RTC8564 is not set
+# CONFIG_SENSORS_MAX6875 is not set
+# CONFIG_SENSORS_TSL2550 is not set
 # CONFIG_I2C_DEBUG_CORE is not set
 # CONFIG_I2C_DEBUG_ALGO is not set
 # CONFIG_I2C_DEBUG_BUS is not set
 # CONFIG_I2C_DEBUG_CHIP is not set
 
 #
-# Misc devices
+# SPI support
 #
+# CONFIG_SPI is not set
+# CONFIG_SPI_MASTER is not set
+# CONFIG_W1 is not set
+# CONFIG_HWMON is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
+
+#
+# Multifunction device drivers
+#
+# CONFIG_MFD_SM501 is not set
+# CONFIG_NEW_LEDS is not set
 
 #
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_DAB is not set
 
 #
-# Digital Video Broadcasting Devices
+# Graphics support
 #
-# CONFIG_DVB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Graphics support
+# Display device support
 #
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 CONFIG_FB=y
+# CONFIG_FIRMWARE_EDID is not set
+# CONFIG_FB_DDC is not set
+CONFIG_FB_CFB_FILLRECT=y
+CONFIG_FB_CFB_COPYAREA=y
+CONFIG_FB_CFB_IMAGEBLIT=y
+# CONFIG_FB_SYS_FILLRECT is not set
+# CONFIG_FB_SYS_COPYAREA is not set
+# CONFIG_FB_SYS_IMAGEBLIT is not set
+# CONFIG_FB_SYS_FOPS is not set
+CONFIG_FB_DEFERRED_IO=y
+# CONFIG_FB_SVGALIB is not set
+# CONFIG_FB_MACMODES is not set
+# CONFIG_FB_BACKLIGHT is not set
 # CONFIG_FB_MODE_HELPERS is not set
 # CONFIG_FB_TILEBLITTING is not set
+
+#
+# Frame buffer hardware drivers
+#
 CONFIG_FB_ACORN=y
+# CONFIG_FB_S1D13XXX is not set
 # CONFIG_FB_VIRTUAL is not set
 
 #
@@ -635,24 +665,23 @@ CONFIG_FB_ACORN=y
 #
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
+# CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY is not set
+# CONFIG_FRAMEBUFFER_CONSOLE_ROTATION is not set
 CONFIG_FONTS=y
 # CONFIG_FONT_8x8 is not set
 CONFIG_FONT_8x16=y
 # CONFIG_FONT_6x11 is not set
+# CONFIG_FONT_7x14 is not set
 # CONFIG_FONT_PEARL_8x8 is not set
 CONFIG_FONT_ACORN_8x8=y
 # CONFIG_FONT_MINI_4x6 is not set
 # CONFIG_FONT_SUN8x16 is not set
 # CONFIG_FONT_SUN12x22 is not set
-
-#
-# Logo configuration
-#
+# CONFIG_FONT_10x18 is not set
 CONFIG_LOGO=y
 CONFIG_LOGO_LINUX_MONO=y
 CONFIG_LOGO_LINUX_VGA16=y
 CONFIG_LOGO_LINUX_CLUT224=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
 # Sound
@@ -668,91 +697,115 @@ CONFIG_SOUND=m
 # Open Sound System
 #
 CONFIG_SOUND_PRIME=m
-# CONFIG_SOUND_BT878 is not set
-# CONFIG_SOUND_FUSION is not set
-# CONFIG_SOUND_CS4281 is not set
-# CONFIG_SOUND_SONICVIBES is not set
-# CONFIG_SOUND_TRIDENT is not set
 # CONFIG_SOUND_MSNDCLAS is not set
 # CONFIG_SOUND_MSNDPIN is not set
 CONFIG_SOUND_OSS=m
 # CONFIG_SOUND_TRACEINIT is not set
 # CONFIG_SOUND_DMAP is not set
-# CONFIG_SOUND_AD1816 is not set
-# CONFIG_SOUND_AD1889 is not set
-# CONFIG_SOUND_SGALAXY is not set
-# CONFIG_SOUND_ADLIB is not set
-# CONFIG_SOUND_ACI_MIXER is not set
-# CONFIG_SOUND_CS4232 is not set
 # CONFIG_SOUND_SSCAPE is not set
-# CONFIG_SOUND_GUS is not set
 # CONFIG_SOUND_VMIDI is not set
 # CONFIG_SOUND_TRIX is not set
 # CONFIG_SOUND_MSS is not set
 # CONFIG_SOUND_MPU401 is not set
-# CONFIG_SOUND_NM256 is not set
-# CONFIG_SOUND_MAD16 is not set
 # CONFIG_SOUND_PAS is not set
 # CONFIG_SOUND_PSS is not set
 # CONFIG_SOUND_SB is not set
-# CONFIG_SOUND_AWE32_SYNTH is not set
-# CONFIG_SOUND_WAVEFRONT is not set
-# CONFIG_SOUND_MAUI is not set
 # CONFIG_SOUND_YM3812 is not set
-# CONFIG_SOUND_OPL3SA1 is not set
-# CONFIG_SOUND_OPL3SA2 is not set
 # CONFIG_SOUND_UART6850 is not set
 # CONFIG_SOUND_AEDSP16 is not set
 CONFIG_SOUND_VIDC=m
-# CONFIG_SOUND_TVMIXER is not set
-# CONFIG_SOUND_AD1980 is not set
+# CONFIG_HID_SUPPORT is not set
+# CONFIG_USB_SUPPORT is not set
+# CONFIG_MMC is not set
+CONFIG_RTC_LIB=y
+CONFIG_RTC_CLASS=y
+CONFIG_RTC_HCTOSYS=y
+CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
+# CONFIG_RTC_DEBUG is not set
 
 #
-# USB support
+# RTC interfaces
 #
-# CONFIG_USB is not set
-CONFIG_USB_ARCH_HAS_HCD=y
-# CONFIG_USB_ARCH_HAS_OHCI is not set
+CONFIG_RTC_INTF_SYSFS=y
+CONFIG_RTC_INTF_PROC=y
+CONFIG_RTC_INTF_DEV=y
+# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
+# CONFIG_RTC_DRV_TEST is not set
 
 #
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support' may also be needed; see USB_STORAGE Help for more information
+# I2C RTC drivers
 #
+# CONFIG_RTC_DRV_DS1307 is not set
+# CONFIG_RTC_DRV_DS1672 is not set
+# CONFIG_RTC_DRV_MAX6900 is not set
+# CONFIG_RTC_DRV_RS5C372 is not set
+# CONFIG_RTC_DRV_ISL1208 is not set
+# CONFIG_RTC_DRV_X1205 is not set
+# CONFIG_RTC_DRV_PCF8563 is not set
+CONFIG_RTC_DRV_PCF8583=y
+# CONFIG_RTC_DRV_M41T80 is not set
 
 #
-# USB Gadget Support
+# SPI RTC drivers
 #
-# CONFIG_USB_GADGET is not set
 
 #
-# MMC/SD Card support
+# Platform RTC drivers
+#
+# CONFIG_RTC_DRV_CMOS is not set
+# CONFIG_RTC_DRV_DS1553 is not set
+# CONFIG_RTC_DRV_STK17TA8 is not set
+# CONFIG_RTC_DRV_DS1742 is not set
+# CONFIG_RTC_DRV_M48T86 is not set
+# CONFIG_RTC_DRV_M48T59 is not set
+# CONFIG_RTC_DRV_V3020 is not set
+
+#
+# on-CPU RTC drivers
+#
+
+#
+# DMA Engine support
+#
+# CONFIG_DMA_ENGINE is not set
+
+#
+# DMA Clients
+#
+
+#
+# DMA Devices
 #
-# CONFIG_MMC is not set
 
 #
 # File systems
 #
 CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XATTR is not set
+# CONFIG_EXT2_FS_XIP is not set
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 # CONFIG_EXT3_FS_POSIX_ACL is not set
 # CONFIG_EXT3_FS_SECURITY is not set
+# CONFIG_EXT4DEV_FS is not set
 CONFIG_JBD=y
 # CONFIG_JBD_DEBUG is not set
 CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
-
-#
-# XFS support
-#
+# CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
+# CONFIG_GFS2_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
+CONFIG_INOTIFY_USER=y
 # CONFIG_QUOTA is not set
 CONFIG_DNOTIFY=y
 # CONFIG_AUTOFS_FS is not set
 CONFIG_AUTOFS4_FS=m
+# CONFIG_FUSE_FS is not set
 
 #
 # CD-ROM/DVD Filesystems
@@ -776,12 +829,12 @@ CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
 # Pseudo filesystems
 #
 CONFIG_PROC_FS=y
+CONFIG_PROC_SYSCTL=y
 CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVPTS_FS_XATTR is not set
 # CONFIG_TMPFS is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
+# CONFIG_CONFIGFS_FS is not set
 
 #
 # Miscellaneous filesystems
@@ -810,7 +863,9 @@ CONFIG_NFS_FS=y
 # CONFIG_NFS_DIRECTIO is not set
 # CONFIG_NFSD is not set
 CONFIG_LOCKD=y
+CONFIG_NFS_COMMON=y
 CONFIG_SUNRPC=y
+# CONFIG_SUNRPC_BIND34 is not set
 # CONFIG_RPCSEC_GSS_KRB5 is not set
 # CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
@@ -830,20 +885,22 @@ CONFIG_ACORN_PARTITION_ICS=y
 CONFIG_ACORN_PARTITION_ADFS=y
 CONFIG_ACORN_PARTITION_POWERTEC=y
 CONFIG_ACORN_PARTITION_RISCIX=y
-CONFIG_OSF_PARTITION=y
-CONFIG_AMIGA_PARTITION=y
+# CONFIG_OSF_PARTITION is not set
+# CONFIG_AMIGA_PARTITION is not set
 # CONFIG_ATARI_PARTITION is not set
-CONFIG_MAC_PARTITION=y
+# CONFIG_MAC_PARTITION is not set
 CONFIG_MSDOS_PARTITION=y
 CONFIG_BSD_DISKLABEL=y
 # CONFIG_MINIX_SUBPARTITION is not set
-CONFIG_SOLARIS_X86_PARTITION=y
+# CONFIG_SOLARIS_X86_PARTITION is not set
 # CONFIG_UNIXWARE_DISKLABEL is not set
 # CONFIG_LDM_PARTITION is not set
-CONFIG_SGI_PARTITION=y
+# CONFIG_SGI_PARTITION is not set
 # CONFIG_ULTRIX_PARTITION is not set
-CONFIG_SUN_PARTITION=y
+# CONFIG_SUN_PARTITION is not set
+# CONFIG_KARMA_PARTITION is not set
 # CONFIG_EFI_PARTITION is not set
+# CONFIG_SYSV68_PARTITION is not set
 
 #
 # Native Language Support
@@ -889,6 +946,11 @@ CONFIG_NLS_KOI8_R=m
 # CONFIG_NLS_KOI8_U is not set
 # CONFIG_NLS_UTF8 is not set
 
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
 #
 # Profiling support
 #
@@ -897,17 +959,37 @@ CONFIG_NLS_KOI8_R=m
 #
 # Kernel hacking
 #
-CONFIG_DEBUG_KERNEL=y
-CONFIG_MAGIC_SYSRQ=y
 # CONFIG_PRINTK_TIME is not set
+CONFIG_ENABLE_MUST_CHECK=y
+CONFIG_MAGIC_SYSRQ=y
+# CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
+CONFIG_DEBUG_KERNEL=y
+# CONFIG_DEBUG_SHIRQ is not set
+CONFIG_DETECT_SOFTLOCKUP=y
+CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
+# CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_SLAB is not set
+# CONFIG_DEBUG_RT_MUTEXES is not set
+# CONFIG_RT_MUTEX_TESTER is not set
 # CONFIG_DEBUG_SPINLOCK is not set
+# CONFIG_DEBUG_MUTEXES is not set
+# CONFIG_DEBUG_LOCK_ALLOC is not set
+# CONFIG_PROVE_LOCKING is not set
+# CONFIG_LOCK_STAT is not set
+# CONFIG_DEBUG_SPINLOCK_SLEEP is not set
+# CONFIG_DEBUG_LOCKING_API_SELFTESTS is not set
 # CONFIG_DEBUG_KOBJECT is not set
 CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_INFO is not set
-# CONFIG_DEBUG_FS is not set
+# CONFIG_DEBUG_VM is not set
+# CONFIG_DEBUG_LIST is not set
 CONFIG_FRAME_POINTER=y
+CONFIG_FORCED_INLINING=y
+# CONFIG_RCU_TORTURE_TEST is not set
+# CONFIG_FAULT_INJECTION is not set
 CONFIG_DEBUG_USER=y
 CONFIG_DEBUG_ERRORS=y
 CONFIG_DEBUG_LL=y
@@ -918,19 +1000,18 @@ CONFIG_DEBUG_LL=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
 # CONFIG_CRYPTO is not set
 
-#
-# Hardware crypto devices
-#
-
 #
 # Library routines
 #
+CONFIG_BITREVERSE=y
 # CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
+CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_DMA=y
index c589dc3ecd1ac0fb48cc619496fd3456649cb0a6..33e6cc2ffd3bacbf3c8d030efac78684f52da623 100644 (file)
@@ -46,7 +46,7 @@ fast_work_pending:
 work_pending:
        tst     r1, #_TIF_NEED_RESCHED
        bne     work_resched
-       tst     r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING
+       tst     r1, #_TIF_SIGPENDING
        beq     no_work_pending
        mov     r0, sp                          @ 'regs'
        mov     r2, why                         @ 'syscall'
index 5be2e987b8435b047bf168128364e3736eda30f4..4de432ec903aecc4bef4b91aab249c9bd0c62edd 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/cpu.h>
 #include <linux/interrupt.h>
 #include <linux/smp.h>
+#include <linux/fs.h>
 
 #include <asm/cpu.h>
 #include <asm/elf.h>
index 1b76d87fa335de634f7151c630cec6005ec340ec..eafbb2b05eb8a2cb7f78a522053f16e4cf70f574 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/profile.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/cpu.h>
 #include <linux/smp.h>
 #include <linux/seq_file.h>
@@ -630,7 +631,7 @@ void smp_send_stop(void)
 /*
  * not supported here
  */
-int __init setup_profiling_timer(unsigned int multiplier)
+int setup_profiling_timer(unsigned int multiplier)
 {
        return -EINVAL;
 }
index f2114bcf09d522994d11fcfafef264b2ba318e92..8ad47619c07906b31dcd60c97490426f6330e34c 100644 (file)
@@ -352,10 +352,8 @@ asmlinkage void __exception do_undefinstr(struct pt_regs *regs)
 
 asmlinkage void do_unexp_fiq (struct pt_regs *regs)
 {
-#ifndef CONFIG_IGNORE_FIQ
        printk("Hmm.  Unexpected FIQ received, but trying to continue\n");
        printk("You may have a hardware problem...\n");
-#endif
 }
 
 /*
index 9db58da0475435d79e7068e2681a612f373b346a..3576595b4941b7ecefcf75b0ab1ec0128f1bc261 100644 (file)
@@ -15,6 +15,8 @@
 
 #include <linux/platform_device.h>
 
+#include <video/atmel_lcdc.h>
+
 #include <asm/arch/board.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/at91sam9261.h>
index 635695787f91c271be62769b6716fdebcebfd6f4..f924bd5017de19ef1efac43b5dc125fdcc65ee13 100644 (file)
@@ -14,6 +14,8 @@
 
 #include <linux/platform_device.h>
 
+#include <video/atmel_lcdc.h>
+
 #include <asm/arch/board.h>
 #include <asm/arch/gpio.h>
 #include <asm/arch/at91sam9263.h>
index 64067cd58d36e075cd7fede2ddbdb48e2d715f1e..52ac37d1e23aa91f6ec67c548db310287051fc87 100644 (file)
@@ -3,6 +3,7 @@
  *
  * HP Jornada720 init code
  *
+ * Copyright (C) 2007 Kristoffer Ericson <Kristoffer.Ericson@gmail.com>
  * Copyright (C) 2006 Filip Zyzniewski <filip.zyzniewski@tefnet.pl>
  *  Copyright (C) 2005 Michael Gernoth <michael@gernoth.net>
  *
@@ -220,14 +221,16 @@ static struct platform_device sa1111_device = {
        .resource       = sa1111_resources,
 };
 
-static struct platform_device jornada720_mcu_device = {
-       .name           = "jornada720_mcu",
-       .id             = -1,
+static struct platform_device jornada_ssp_device = {
+       .name           = "jornada_ssp",
+       .id             = -1,
 };
 
 static struct platform_device *devices[] __initdata = {
        &sa1111_device,
-       &jornada720_mcu_device,
+#ifdef CONFIG_SA1100_JORNADA720_SSP
+       &jornada_ssp_device,
+#endif
        &s1d13xxxfb_device,
 };
 
@@ -236,19 +239,19 @@ static int __init jornada720_init(void)
        int ret = -ENODEV;
 
        if (machine_is_jornada720()) {
-               GPDR |= GPIO_GPIO20;
-               /* oscillator setup (line 116 of HP's doc) */
+               /* we want to use gpio20 as input to drive the clock of our uart 3 */
+               GPDR |= GPIO_GPIO20;    /* Clear gpio20 pin as input */
                TUCR = TUCR_VAL;
-               /* resetting SA1111 (line 118 of HP's doc) */
-               GPSR = GPIO_GPIO20;
+               GPSR = GPIO_GPIO20;     /* start gpio20 pin */
                udelay(1);
-               GPCR = GPIO_GPIO20;
+               GPCR = GPIO_GPIO20;     /* stop gpio20 */
                udelay(1);
-               GPSR = GPIO_GPIO20;
-               udelay(20);
+               GPSR = GPIO_GPIO20;     /* restart gpio20 */
+               udelay(20);             /* give it some time to restart */
 
                ret = platform_add_devices(devices, ARRAY_SIZE(devices));
        }
+
        return ret;
 }
 
@@ -345,7 +348,7 @@ static void __init jornada720_mach_init(void)
 }
 
 MACHINE_START(JORNADA720, "HP Jornada 720")
-       /* Maintainer: Michael Gernoth <michael@gernoth.net> */
+       /* Maintainer: Kristoffer Ericson <Kristoffer.Ericson@gmail.com> */
        .phys_io        = 0x80000000,
        .io_pg_offst    = ((0xf8000000) >> 18) & 0xfffc,
        .boot_params    = 0xc0000100,
index 0a45e1ac8ad6700d27f7d30fb8c47cdfab7318fc..395c39bed7d823c06fca82b10525279e45c0dd7b 100644 (file)
@@ -161,7 +161,7 @@ static int __init jornada_ssp_probe(struct platform_device *dev)
        ret = jornada_ssp_inout(GETBRIGHTNESS);
 
        /* seems like it worked, just feed it with TxDummy to get rid of data */
-       if (ret == TxDummy)
+       if (ret == TXDUMMY)
                jornada_ssp_inout(TXDUMMY);
 
        jornada_ssp_end();
index ed7b26bf73f5764b00f0846b930f426071bde2fc..b29178c0414ebca807db4bc7b7bcedad5e15075b 100644 (file)
@@ -9,5 +9,4 @@ nwfpe-y                         += fpa11.o fpa11_cpdo.o fpa11_cpdt.o \
                                   softfloat.o single_cpdo.o double_cpdo.o
 
 nwfpe-$(CONFIG_FPE_NWFPE_XP)   += extended_cpdo.o
-nwfpe-$(CONFIG_CPU_26)         += entry26.o
 nwfpe-$(CONFIG_CPU_32)         += entry.o
diff --git a/arch/arm/nwfpe/entry26.S b/arch/arm/nwfpe/entry26.S
deleted file mode 100644 (file)
index 3e6fb5d..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998
-    (c) Philip Blundell 1998-1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <asm/asm-offsets.h>
-
-/* This is the kernel's entry point into the floating point emulator.
-It is called from the kernel with code similar to this:
-
-       mov     fp, #0
-       teqp    pc, #PSR_I_BIT | SVC_MODE
-       ldr     r4, .LC2
-       ldr     pc, [r4]                @ Call FP module USR entry point
-
-The kernel expects the emulator to return via one of two possible
-points of return it passes to the emulator.  The emulator, if
-successful in its emulation, jumps to ret_from_exception and the
-kernel takes care of returning control from the trap to the user code.
-If the emulator is unable to emulate the instruction, it returns to
-fpundefinstr and the kernel halts the user program with a core dump.
-
-This routine does four things:
-
-1) It saves SP into a variable called userRegisters.  The kernel has
-created a struct pt_regs on the stack and saved the user registers
-into it.  See /usr/include/asm/proc/ptrace.h for details.  The
-emulator code uses userRegisters as the base of an array of words from
-which the contents of the registers can be extracted.
-
-2) It locates the FP emulator work area within the TSS structure and
-points `fpa11' to it.
-
-3) It calls EmulateAll to emulate a floating point instruction.
-EmulateAll returns 1 if the emulation was successful, or 0 if not.
-
-4) If an instruction has been emulated successfully, it looks ahead at
-the next instruction.  If it is a floating point instruction, it
-executes the instruction, without returning to user space.  In this
-way it repeatedly looks ahead and executes floating point instructions
-until it encounters a non floating point instruction, at which time it
-returns via _fpreturn.
-
-This is done to reduce the effect of the trap overhead on each
-floating point instructions.  GCC attempts to group floating point
-instructions to allow the emulator to spread the cost of the trap over
-several floating point instructions.  */
-
-       .globl  nwfpe_enter
-nwfpe_enter:
-       mov     sl, sp
-       ldr     r5, [sp, #60]           @ get contents of PC
-       bic     r5, r5, #0xfc000003
-       ldr     r0, [r5, #-4]           @ get actual instruction into r0
-       bl      EmulateAll              @ emulate the instruction
-1:     cmp     r0, #0                  @ was emulation successful
-       beq     fpundefinstr            @ no, return failure
-
-next:
-.Lx1:  ldrt    r6, [r5], #4            @ get the next instruction and
-                                       @ increment PC
-
-       and     r2, r6, #0x0F000000     @ test for FP insns
-       teq     r2, #0x0C000000
-       teqne   r2, #0x0D000000
-       teqne   r2, #0x0E000000
-       bne     ret_from_exception      @ return ok if not a fp insn
-
-       ldr     r9, [sp, #60]           @ get new condition codes
-       and     r9, r9, #0xfc000003
-       orr     r7, r5, r9
-       str     r7, [sp, #60]           @ update PC copy in regs
-
-       mov     r0, r6                  @ save a copy
-       mov     r1, r9                  @ fetch the condition codes
-       bl      checkCondition          @ check the condition
-       cmp     r0, #0                  @ r0 = 0 ==> condition failed
-
-       @ if condition code failed to match, next insn
-       beq     next                    @ get the next instruction;
-
-       mov     r0, r6                  @ prepare for EmulateAll()
-       adr     lr, 1b
-       orr     lr, lr, #3
-       b       EmulateAll              @ if r0 != 0, goto EmulateAll
-
-.Lret: b       ret_from_exception      @ let the user eat segfaults
-       
-       @ We need to be prepared for the instruction at .Lx1 to fault.
-       @ Emit the appropriate exception gunk to fix things up.
-       .section __ex_table,"a"
-       .align  3
-       .long   .Lx1
-       ldr     lr, [lr, $(.Lret - .Lx1)/4]
-       .previous
diff --git a/arch/arm26/ACKNOWLEDGEMENTS b/arch/arm26/ACKNOWLEDGEMENTS
deleted file mode 100644 (file)
index 0a17a45..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-The work in this architecture (ARM26) is that of a great many people.
-
-This is what has happened:
-
-I [Ian Molton] have been trying to repair the ARM26 architecture support, but it has become an impossible task whilst it is still merged with the ARM32 (arch/arm) code. The ARM26 code is too different to be sensible to keep with the ARM32 code now, and Russell King really doesnt have the time to maintain the ARM26 code. Add to that that most ARM32 developers dont know about or care about ARM26 when writing patches, and you have a reall mess.
-
-As a result, I've split it off into a new architecture of its own. I've named it arm26 since these CPUs have only a 26 bit address space, unlike the other ARMs.
-
-The upheaval in moving around so many source files and chopping out vasty ammounts of cruft was enormous, and the copyright of many files is sometimes unclear. Because of this, I am writing this, in order that no-one is left out / misaccredited / blamed for any of the code.
-
-People I KNOW have made major contributions to the code:
-
-David Alan Gilbert (former maintainer of ARM26 bits)
-Philip Blundell
-Russell King
-Keith Owens
-
-also thanks to Nicholas Pitre for hints, and for the basis or our XIP support.
-
-Currently maintaing the code are
-
-Ian Molton (Maintainer / Archimedes)
-John Appleby (kernel / A5K)
-
-If anyone has a problem with attributions in header files / source files, please do contact me to straighten things out.
-
-Ian Molton (aka spyro)  -  ARM26 maintainer
-spyro@f2s.com
-
diff --git a/arch/arm26/Kconfig b/arch/arm26/Kconfig
deleted file mode 100644 (file)
index 9044f33..0000000
+++ /dev/null
@@ -1,253 +0,0 @@
-#
-# For a description of the syntax of this configuration file,
-# see Documentation/kbuild/kconfig-language.txt.
-#
-
-mainmenu "Linux Kernel Configuration"
-
-config ARM
-       bool
-       default y
-
-config ARM26
-       bool
-       default y
-
-config MMU
-       bool
-       default y
-
-config NO_DMA
-       def_bool y
-
-config ARCH_ACORN
-        bool
-        default y
-
-config CPU_26
-        bool
-        default y
-
-config FIQ
-        bool
-        default y
-
-# 9 = 512 pages 8 = 256 pages 7 = 128 pages
-config FORCE_MAX_ZONEORDER
-        int
-        default 9
-
-config RWSEM_GENERIC_SPINLOCK
-       bool
-       default y
-
-config RWSEM_XCHGADD_ALGORITHM
-       bool
-
-config ARCH_HAS_ILOG2_U32
-       bool
-       default n
-
-config ARCH_HAS_ILOG2_U64
-       bool
-       default n
-
-config GENERIC_HWEIGHT
-       bool
-       default y
-
-config GENERIC_CALIBRATE_DELAY
-       bool
-       default y
-
-config ZONE_DMA
-       bool
-       default y
-
-config GENERIC_ISA_DMA
-       bool
-
-config ARCH_MAY_HAVE_PC_FDC
-       bool
-
-source "init/Kconfig"
-
-
-menu "System Type"
-
-choice
-       prompt "Archimedes/A5000 Implementations"
-
-config ARCH_ARC
-        bool "Archimedes"
-        help
-          Say Y to support the Acorn Archimedes.
-
-         The Acorn Archimedes was an personal computer based on an 8MHz ARM2
-          processor, released in 1987.  It supported up to 16MB of RAM in
-         later models and floppy, harddisc, ethernet etc.
-
-config ARCH_A5K
-        bool "A5000"
-       select ARCH_MAY_HAVE_PC_FDC
-        help
-          Say Y here to support the Acorn A5000.
-
-         Linux can support the
-          internal IDE disk and CD-ROM interface, serial and parallel port,
-          and the floppy drive.  Note that on some A5000s the floppy is
-          plugged into the wrong socket on the motherboard.
-
-config PAGESIZE_16
-        bool "2MB physical memory (broken)"
-        help
-          Say Y here if your Archimedes or A5000 system has only 2MB of
-          memory, otherwise say N.  The resulting kernel will not run on a
-          machine with 4MB of memory.
-endchoice
-endmenu
-
-config ISA_DMA_API
-       bool
-       default y
-
-menu "General setup"
-
-# Compressed boot loader in ROM.  Yes, we really want to ask about
-# TEXT and BSS so we preserve their values in the config files.
-config ZBOOT_ROM
-       bool "Compressed boot loader in ROM/flash"
-       help
-         Say Y here if you intend to execute your compressed kernel image (zImage)
-         directly from ROM or flash.  If unsure, say N.
-
-config ZBOOT_ROM_TEXT
-       depends on ZBOOT_ROM
-       hex "Compressed ROM boot loader base address"
-       default "0"
-       help
-         The base address for zImage.  Unless you have special requirements, you
-         should not change this value.
-
-config ZBOOT_ROM_BSS
-       depends on ZBOOT_ROM
-       hex "Compressed ROM boot loader BSS address"
-       default "0"
-       help
-         The base address of 64KiB of read/write memory, which must be available
-         while the decompressor is running.  Unless you have special requirements,
-         you should not change this value.
-
-config XIP_KERNEL
-       bool "Execute In Place (XIP) kernel image"
-       help
-         Select this option to create a kernel that can be programmed into
-         the OS ROMs.
-
-comment "At least one math emulation must be selected"
-
-config FPE_NWFPE
-       tristate "NWFPE math emulation"
-       ---help---
-         Say Y to include the NWFPE floating point emulator in the kernel.
-         This is necessary to run most binaries. Linux does not currently
-         support floating point hardware so you need to say Y here even if
-         your machine has an FPA or floating point co-processor module.
-
-         It is also possible to say M to build the emulator as a module
-         (nwfpe) or indeed to leave it out altogether. However, unless you
-         know what you are doing this can easily render your machine
-         unbootable. Saying Y is the safe option.
-
-         You may say N here if you are going to load the Acorn FPEmulator
-         early in the bootup.
-
-source "fs/Kconfig.binfmt"
-
-config PREEMPT
-       bool "Preemptible Kernel (EXPERIMENTAL)"
-       depends on CPU_32 && EXPERIMENTAL
-       help
-         This option reduces the latency of the kernel when reacting to
-         real-time or interactive events by allowing a low priority process to
-         be preempted even if it is in kernel mode executing a system call.
-         This allows applications to run more reliably even when the system is
-         under load.
-
-         Say Y here if you are building a kernel for a desktop, embedded
-         or real-time system.  Say N if you are unsure.
-
-config ARTHUR
-       tristate "RISC OS personality"
-       depends on CPU_32
-       help
-         Say Y here to include the kernel code necessary if you want to run
-         Acorn RISC OS/Arthur binaries under Linux. This code is still very
-         experimental; if this sounds frightening, say N and sleep in peace.
-         You can also say M here to compile this support as a module (which
-         will be called arthur).
-
-config CMDLINE
-       string "Default kernel command string"
-       default ""
-       help
-         On some architectures (EBSA110 and CATS), there is currently no way
-         for the boot loader to pass arguments to the kernel. For these
-         architectures, you should supply some command-line options at build
-         time by entering them here. As a minimum, you should specify the
-         memory size and the root device (e.g., mem=64M root=/dev/nfs).
-
-source "mm/Kconfig"
-
-endmenu
-
-source "net/Kconfig"
-
-source "drivers/base/Kconfig"
-
-source "drivers/parport/Kconfig"
-
-source "drivers/pnp/Kconfig"
-
-source "drivers/block/Kconfig"
-
-source "drivers/md/Kconfig"
-
-source "drivers/net/Kconfig"
-
-source "drivers/ide/Kconfig"
-
-source "drivers/scsi/Kconfig"
-
-source "drivers/isdn/Kconfig"
-
-#
-# input before char - char/joystick depends on it. As does USB.
-#
-source "drivers/input/Kconfig"
-
-source "drivers/char/Kconfig"
-
-source "drivers/media/Kconfig"
-
-source "fs/Kconfig"
-
-source "drivers/video/Kconfig"
-
-if ARCH_ACORN
-
-source "sound/Kconfig"
-
-endif
-
-source "drivers/misc/Kconfig"
-
-source "drivers/usb/Kconfig"
-
-source "arch/arm26/Kconfig.debug"
-
-source "security/Kconfig"
-
-source "crypto/Kconfig"
-
-source "lib/Kconfig"
diff --git a/arch/arm26/Kconfig.debug b/arch/arm26/Kconfig.debug
deleted file mode 100644 (file)
index 611fc86..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-menu "Kernel hacking"
-
-source "lib/Kconfig.debug"
-
-# RMK wants arm kernels compiled with frame pointers so hardwire this to y.
-# If you know what you are doing and are willing to live without stack
-# traces, you can get a slightly smaller kernel by setting this option to
-# n, but then RMK will have to kill you ;).
-config FRAME_POINTER
-       bool
-       default y
-       help
-         If you say N here, the resulting kernel will be slightly smaller and
-         faster. However, when a problem occurs with the kernel, the
-         information that is reported is severely limited. Most people
-         should say Y here.
-
-config DEBUG_USER
-       bool "Verbose user fault messages"
-       help
-         When a user program crashes due to an exception, the kernel can
-         print a brief message explaining what the problem was. This is
-         sometimes helpful for debugging but serves no purpose on a
-         production system. Most people should say N here.
-
-config DEBUG_WAITQ
-       bool "Wait queue debugging"
-       depends on DEBUG_KERNEL
-
-config DEBUG_ERRORS
-       bool "Verbose kernel error messages"
-       depends on DEBUG_KERNEL
-       help
-         This option controls verbose debugging information which can be
-         printed when the kernel detects an internal error. This debugging
-         information is useful to kernel hackers when tracking down problems,
-         but mostly meaningless to other people. It's safe to say Y unless
-         you are concerned with the code size or don't want to see these
-         messages.
-
-# These options are only for real kernel hackers who want to get their hands dirty.
-config DEBUG_LL
-       bool "Kernel low-level debugging functions"
-       depends on DEBUG_KERNEL
-       help
-         Say Y here to include definitions of printascii, printchar, printhex
-         in the kernel.  This is helpful if you are debugging code that
-         executes before the console is initialized.
-
-endmenu
diff --git a/arch/arm26/Makefile b/arch/arm26/Makefile
deleted file mode 100644 (file)
index fe91eda..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-#
-# arch/arm26/Makefile
-#
-# This file is included by the global makefile so that you can add your own
-# architecture-specific flags and dependencies.
-#
-# This file is subject to the terms and conditions of the GNU General Public
-# License.  See the file "COPYING" in the main directory of this archive
-# for more details.
-#
-# Copyright (C) 1995-2001 by Russell King
-# Copyright (c) 2004 Ian Molton
-
-LDFLAGS_vmlinux        :=-p -X
-CPPFLAGS_vmlinux.lds = -DTEXTADDR=$(TEXTADDR) -DDATAADDR=$(DATAADDR)
-OBJCOPYFLAGS   :=-O binary -R .note -R .comment -S
-GZFLAGS                :=-9
-
-ifeq ($(CONFIG_FRAME_POINTER),y)
-CFLAGS         +=-fno-omit-frame-pointer -mno-sched-prolog
-endif
-
-CFLAGS_BOOT    :=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm
-CFLAGS         +=-mapcs-26 -mcpu=arm3 -msoft-float -Uarm
-AFLAGS         +=-mapcs-26 -mcpu=arm3 -msoft-float
-
-ifeq ($(CONFIG_XIP_KERNEL),y)
-  TEXTADDR      := 0x03880000
-  DATAADDR      := 0x02080000
-else
-  TEXTADDR      := 0x02080000
-  DATAADDR       := .
-endif
-
-head-y          := arch/arm26/kernel/head.o arch/arm26/kernel/init_task.o
-
-ifeq ($(incdir-y),)
-incdir-y :=
-endif
-INCDIR   :=
-  
-export MACHINE TEXTADDR GZFLAGS CFLAGS_BOOT
-
-# If we have a machine-specific directory, then include it in the build.
-core-y                         += arch/arm26/kernel/ arch/arm26/mm/ arch/arm26/machine/
-core-$(CONFIG_FPE_NWFPE)       += arch/arm26/nwfpe/
-
-libs-y                         += arch/arm26/lib/
-
-# Default target when executing plain make
-all: zImage
-
-boot := arch/arm26/boot
-
-PHONY += maketools FORCE
-maketools: FORCE
-
-
-# Convert bzImage to zImage
-bzImage: vmlinux
-       $(Q)$(MAKE) $(build)=$(boot) $(boot)/zImage
-
-zImage Image bootpImage xipImage: vmlinux
-       $(Q)$(MAKE) $(build)=$(boot) $(boot)/$@
-
-zinstall install: vmlinux
-       $(Q)$(MAKE) $(build)=$(boot) $@
-
-# We use MRPROPER_FILES and CLEAN_FILES now
-archclean:
-       $(Q)$(MAKE) $(clean)=$(boot)
-
-# My testing targets (that short circuit a few dependencies)
-zImg:; $(Q)$(MAKE) $(build)=$(boot) $(boot)/zImage
-Img:;  $(Q)$(MAKE) $(build)=$(boot) $(boot)/Image
-bp:;   $(Q)$(MAKE) $(build)=$(boot) $(boot)/bootpImage
-i:;    $(Q)$(MAKE) $(build)=$(boot) install
-zi:;   $(Q)$(MAKE) $(build)=$(boot) zinstall
-
-#
-# Configuration targets.  Use these to select a
-# configuration for your architecture
-%_config:
-       @( \
-       CFG=$(@:_config=); \
-       if [ -f arch/arm26/def-configs/$$CFG ]; then \
-         [ -f .config ] && mv -f .config .config.old; \
-         cp arch/arm26/def-configs/$$CFG .config; \
-         echo "*** Default configuration for $$CFG installed"; \
-         echo "*** Next, you may run 'make oldconfig'"; \
-       else \
-         echo "$$CFG does not exist"; \
-       fi; \
-       )
-
-define archhelp
-  echo  '* zImage        - Compressed kernel image (arch/$(ARCH)/boot/zImage)'
-  echo  '  Image         - Uncompressed kernel image (arch/$(ARCH)/boot/Image)'
-  echo  '  bootpImage    - Combined zImage and initial RAM disk' 
-  echo  '  xipImage      - eXecute In Place capable image for ROM use (arch/$(ARCH)/boot/xipImage)'
-  echo  '  initrd        - Create an initial image'
-  echo  '  install       - Install uncompressed kernel'
-  echo  '  zinstall      - Install compressed kernel'
-  echo  '                  Install using (your) ~/bin/installkernel or'
-  echo  '                  (distribution) /sbin/installkernel or'
-  echo  '                  install to $$(INSTALL_PATH) and run lilo'
-endef
diff --git a/arch/arm26/boot/Makefile b/arch/arm26/boot/Makefile
deleted file mode 100644 (file)
index 68acb7b..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-#
-# arch/arm26/boot/Makefile
-#
-# This file is included by the global makefile so that you can add your own
-# architecture-specific flags and dependencies.
-#
-# This file is subject to the terms and conditions of the GNU General Public
-# License.  See the file "COPYING" in the main directory of this archive
-# for more details.
-#
-# Copyright (C) 1995-2002 Russell King
-#
-
-# Note: the following conditions must always be true:
-#   ZRELADDR == virt_to_phys(TEXTADDR)
-#   PARAMS_PHYS must be with 4MB of ZRELADDR
-#   INITRD_PHYS must be in RAM
-
-   zreladdr-y          := 0x02080000 
-params_phys-y          := 0x0207c000
-initrd_phys-y          := 0x02180000
-
-ZRELADDR    := 0x02080000
-ZTEXTADDR   := 0x0207c000
-PARAMS_PHYS := $(params_phys-y)
-INITRD_PHYS := 0x02180000
-
-# We now have a PIC decompressor implementation.  Decompressors running
-# from RAM should not define ZTEXTADDR.  Decompressors running directly
-# from ROM or Flash must define ZTEXTADDR (preferably via the config)
-# FIXME: Previous assignment to ztextaddr-y is lost here. See SHARK
-ifeq ($(CONFIG_ZBOOT_ROM),y)
-ZTEXTADDR      := $(CONFIG_ZBOOT_ROM_TEXT)
-ZBSSADDR       := $(CONFIG_ZBOOT_ROM_BSS)
-else
-ZTEXTADDR      := 0
-ZBSSADDR       := ALIGN(4)
-endif
-
-export ZTEXTADDR ZBSSADDR ZRELADDR INITRD_PHYS PARAMS_PHYS
-
-targets := Image zImage bootpImage xipImage
-
-$(obj)/Image: vmlinux FORCE
-       $(call if_changed,objcopy)
-       @echo '  Kernel: $@ is ready'
-
-$(obj)/zImage: $(obj)/compressed/vmlinux FORCE
-       $(call if_changed,objcopy)
-       @echo '  Kernel: $@ is ready'
-
-$(obj)/compressed/vmlinux: vmlinux FORCE
-       $(Q)$(MAKE) $(build)=$(obj)/compressed $@
-
-ifeq ($(CONFIG_XIP_KERNEL),y)
-$(obj)/xipImage: vmlinux FORCE
-#      $(OBJCOPY) -S -O binary -R .data -R .comment vmlinux vmlinux-text.bin
-# FIXME - where has .pci_fixup crept in from?
-       $(OBJCOPY) -S -O binary -R .data -R .pci_fixup -R .comment vmlinux vmlinux-text.bin
-       $(OBJCOPY) -S -O binary -R .init -R .text -R __ex_table -R .pci_fixup -R __ksymtab -R __ksymtab_gpl -R __kcrctab -R __kcrctab_gpl -R __param -R .comment vmlinux vmlinux-data.bin
-       cat vmlinux-text.bin vmlinux-data.bin > $@
-       $(RM) -f vmlinux-text.bin vmlinux-data.bin
-       @echo '  Kernel: $@ is ready'
-endif
-
-PHONY += initrd
-initrd:
-       @test "$(INITRD_PHYS)" != "" || \
-       (echo This machine does not support INITRD; exit -1)
-       @test "$(INITRD)" != "" || \
-       (echo You must specify INITRD; exit -1)
-
-install: $(obj)/Image
-       $(CONFIG_SHELL) $(obj)/install.sh \
-       $(KERNELRELEASE) \
-       $(obj)/Image System.map "$(INSTALL_PATH)"
-
-zinstall: $(obj)/zImage
-       $(CONFIG_SHELL) $(obj)/install.sh \
-       $(KERNELRELEASE) \
-       $(obj)/zImage System.map "$(INSTALL_PATH)"
-
-subdir-            := compressed
diff --git a/arch/arm26/boot/compressed/Makefile b/arch/arm26/boot/compressed/Makefile
deleted file mode 100644 (file)
index b1d9dde..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-#
-# linux/arch/arm26/boot/compressed/Makefile
-#
-# create a compressed vmlinuz image from the original vmlinux
-#
-# Note! ZTEXTADDR, ZBSSADDR and ZRELADDR are now exported
-# from arch/arm26/boot/Makefile
-#
-
-HEAD   = head.o
-OBJS   = misc.o
-FONTC  = drivers/video/console/font_acorn_8x8.c
-
-OBJS           += ll_char_wr.o font.o
-CFLAGS_misc.o  := -DPARAMS_PHYS=$(PARAMS_PHYS)
-
-targets       := vmlinux vmlinux.lds piggy piggy.gz piggy.o font.o head.o $(OBJS)
-
-SEDFLAGS       = s/TEXT_START/$(ZTEXTADDR)/;s/LOAD_ADDR/$(ZRELADDR)/;s/BSS_START/$(ZBSSADDR)/
-
-EXTRA_CFLAGS  := $(CFLAGS_BOOT) -fpic
-EXTRA_AFLAGS  := -traditional
-
-LDFLAGS_vmlinux := -p -X \
-       $(shell $(CC) $(CFLAGS)) -T
-
-$(obj)/vmlinux: $(obj)/vmlinux.lds $(obj)/$(HEAD) $(obj)/piggy.o \
-               $(addprefix $(obj)/, $(OBJS)) FORCE
-       $(call if_changed,ld)
-       @:
-
-
-$(obj)/piggy: vmlinux FORCE
-       $(call if_changed,objcopy)
-
-$(obj)/piggy.gz: $(obj)/piggy FORCE
-       $(call if_changed,gzip)
-
-LDFLAGS_piggy.o := -r -b binary
-$(obj)/piggy.o:  $(obj)/piggy.gz FORCE
-       $(call if_changed,ld)
-
-$(obj)/font.o: $(FONTC)
-       $(CC) $(CFLAGS) -Dstatic= -c $(FONTC) -o $(obj)/font.o
-
-$(obj)/vmlinux.lds: $(obj)/vmlinux.lds.in Makefile arch/arm26/boot/Makefile .config
-       @sed "$(SEDFLAGS)" < $< > $@
-
-$(obj)/misc.o: $(obj)/misc.c $(obj)/uncompress.h lib/inflate.c
-
diff --git a/arch/arm26/boot/compressed/head.S b/arch/arm26/boot/compressed/head.S
deleted file mode 100644 (file)
index 2a2cda3..0000000
+++ /dev/null
@@ -1,516 +0,0 @@
-/*
- *  linux/arch/arm26/boot/compressed/head.S
- *
- *  Copyright (C) 1996-2002 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-
-/*
- * Debugging stuff
- *
- * Note that these macros must not contain any code which is not
- * 100% relocatable.  Any attempt to do so will result in a crash.
- * Please select one of the following when turning on debugging.
- */
-
-               .macro  kputc,val
-               mov     r0, \val
-               bl      putc
-               .endm
-
-               .macro  kphex,val,len
-               mov     r0, \val
-               mov     r1, #\len
-               bl      phex
-               .endm
-
-               .macro  debug_reloc_start
-               .endm
-
-               .macro  debug_reloc_end
-               .endm
-
-               .section ".start", #alloc, #execinstr
-/*
- * sort out different calling conventions
- */
-               .align
-start:
-               .type   start,#function
-               .rept   8
-               mov     r0, r0
-               .endr
-
-               b       1f
-               .word   0x016f2818              @ Magic numbers to help the loader
-               .word   start                   @ absolute load/run zImage address
-               .word   _edata                  @ zImage end address
-1:             mov     r7, r1                  @ save architecture ID
-               mov     r8, #0                  @ save r0
-               teqp    pc, #0x0c000003         @ turn off interrupts
-
-               .text
-               adr     r0, LC0
-               ldmia   r0, {r1, r2, r3, r4, r5, r6, ip, sp}
-               subs    r0, r0, r1              @ calculate the delta offset
-
-               teq     r0, #0                  @ if delta is zero, we're
-               beq     not_relocated           @ running at the address we
-                                               @ were linked at.
-
-               add     r2, r2, r0              @ different address, so we
-               add     r3, r3, r0              @ need to fix up various
-               add     r5, r5, r0              @ pointers.
-               add     r6, r6, r0
-               add     ip, ip, r0
-               add     sp, sp, r0
-
-1:             ldr     r1, [r6, #0]            @ relocate entries in the GOT
-               add     r1, r1, r0              @ table.  This fixes up the
-               str     r1, [r6], #4            @ C references.
-               cmp     r6, ip
-               blo     1b
-
-not_relocated: mov     r0, #0
-1:             str     r0, [r2], #4            @ clear bss
-               str     r0, [r2], #4
-               str     r0, [r2], #4
-               str     r0, [r2], #4
-               cmp     r2, r3
-               blo     1b
-
-               bl      cache_on
-
-               mov     r1, sp                  @ malloc space above stack
-               add     r2, sp, #0x10000        @ 64k max
-
-/*
- * Check to see if we will overwrite ourselves.
- *   r4 = final kernel address
- *   r5 = start of this image
- *   r2 = end of malloc space (and therefore this image)
- * We basically want:
- *   r4 >= r2 -> OK
- *   r4 + image length <= r5 -> OK
- */
-               cmp     r4, r2
-               bhs     wont_overwrite
-               add     r0, r4, #4096*1024      @ 4MB largest kernel size
-               cmp     r0, r5
-               bls     wont_overwrite
-
-               mov     r5, r2                  @ decompress after malloc space
-               mov     r0, r5
-               mov     r3, r7
-               bl      decompress_kernel
-
-               add     r0, r0, #127
-               bic     r0, r0, #127            @ align the kernel length
-/*
- * r0     = decompressed kernel length
- * r1-r3  = unused
- * r4     = kernel execution address
- * r5     = decompressed kernel start
- * r6     = processor ID
- * r7     = architecture ID
- * r8-r14 = unused
- */
-               add     r1, r5, r0              @ end of decompressed kernel
-               adr     r2, reloc_start
-               ldr     r3, LC1
-               add     r3, r2, r3
-1:             ldmia   r2!, {r8 - r13}         @ copy relocation code
-               stmia   r1!, {r8 - r13}
-               ldmia   r2!, {r8 - r13}
-               stmia   r1!, {r8 - r13}
-               cmp     r2, r3
-               blo     1b
-
-               bl      cache_clean_flush
-               add     pc, r5, r0              @ call relocation code
-
-/*
- * We're not in danger of overwriting ourselves.  Do this the simple way.
- *
- * r4     = kernel execution address
- * r7     = architecture ID
- */
-wont_overwrite:        mov     r0, r4
-               mov     r3, r7
-               bl      decompress_kernel
-               b       call_kernel
-
-               .type   LC0, #object
-LC0:           .word   LC0                     @ r1
-               .word   __bss_start             @ r2
-               .word   _end                    @ r3
-               .word   _load_addr              @ r4
-               .word   _start                  @ r5
-               .word   _got_start              @ r6
-               .word   _got_end                @ ip
-               .word   user_stack+4096         @ sp
-LC1:           .word   reloc_end - reloc_start
-               .size   LC0, . - LC0
-
-/*
- * Turn on the cache.  We need to setup some page tables so that we
- * can have both the I and D caches on.
- *
- * We place the page tables 16k down from the kernel execution address,
- * and we hope that nothing else is using it.  If we're using it, we
- * will go pop!
- *
- * On entry,
- *  r4 = kernel execution address
- *  r6 = processor ID
- *  r7 = architecture number
- *  r8 = run-time address of "start"
- * On exit,
- *  r1, r2, r3, r8, r9, r12 corrupted
- * This routine must preserve:
- *  r4, r5, r6, r7
- */
-               .align  5
-cache_on:      mov     r3, #8                  @ cache_on function
-               b       call_cache_fn
-
-__setup_mmu:   sub     r3, r4, #16384          @ Page directory size
-               bic     r3, r3, #0xff           @ Align the pointer
-               bic     r3, r3, #0x3f00
-/*
- * Initialise the page tables, turning on the cacheable and bufferable
- * bits for the RAM area only.
- */
-               mov     r0, r3
-               mov     r8, r0, lsr #18
-               mov     r8, r8, lsl #18         @ start of RAM
-               add     r9, r8, #0x10000000     @ a reasonable RAM size
-               mov     r1, #0x12
-               orr     r1, r1, #3 << 10
-               add     r2, r3, #16384
-1:             cmp     r1, r8                  @ if virt > start of RAM
-               orrhs   r1, r1, #0x0c           @ set cacheable, bufferable
-               cmp     r1, r9                  @ if virt > end of RAM
-               bichs   r1, r1, #0x0c           @ clear cacheable, bufferable
-               str     r1, [r0], #4            @ 1:1 mapping
-               add     r1, r1, #1048576
-               teq     r0, r2
-               bne     1b
-/*
- * If ever we are running from Flash, then we surely want the cache
- * to be enabled also for our execution instance...  We map 2MB of it
- * so there is no map overlap problem for up to 1 MB compressed kernel.
- * If the execution is in RAM then we would only be duplicating the above.
- */
-               mov     r1, #0x1e
-               orr     r1, r1, #3 << 10
-               mov     r2, pc, lsr #20
-               orr     r1, r1, r2, lsl #20
-               add     r0, r3, r2, lsl #2
-               str     r1, [r0], #4
-               add     r1, r1, #1048576
-               str     r1, [r0]
-               mov     pc, lr
-
-__armv4_cache_on:
-               mov     r12, lr
-               bl      __setup_mmu
-               mov     r0, #0
-               mcr     p15, 0, r0, c7, c10, 4  @ drain write buffer
-               mcr     p15, 0, r0, c8, c7, 0   @ flush I,D TLBs
-               mrc     p15, 0, r0, c1, c0, 0   @ read control reg
-               orr     r0, r0, #0x1000         @ I-cache enable
-               orr     r0, r0, #0x0030
-               b       __common_cache_on
-
-__arm6_cache_on:
-               mov     r12, lr
-               bl      __setup_mmu
-               mov     r0, #0
-               mcr     p15, 0, r0, c7, c0, 0   @ invalidate whole cache v3
-               mcr     p15, 0, r0, c5, c0, 0   @ invalidate whole TLB v3
-               mov     r0, #0x30
-__common_cache_on:
-#ifndef DEBUG
-               orr     r0, r0, #0x000d         @ Write buffer, mmu
-#endif
-               mov     r1, #-1
-               mcr     p15, 0, r3, c2, c0, 0   @ load page table pointer
-               mcr     p15, 0, r1, c3, c0, 0   @ load domain access control
-               mcr     p15, 0, r0, c1, c0, 0   @ load control register
-               mov     pc, r12
-
-/*
- * All code following this line is relocatable.  It is relocated by
- * the above code to the end of the decompressed kernel image and
- * executed there.  During this time, we have no stacks.
- *
- * r0     = decompressed kernel length
- * r1-r3  = unused
- * r4     = kernel execution address
- * r5     = decompressed kernel start
- * r6     = processor ID
- * r7     = architecture ID
- * r8-r14 = unused
- */
-               .align  5
-reloc_start:   add     r8, r5, r0
-               debug_reloc_start
-               mov     r1, r4
-1:
-               .rept   4
-               ldmia   r5!, {r0, r2, r3, r9 - r13}     @ relocate kernel
-               stmia   r1!, {r0, r2, r3, r9 - r13}
-               .endr
-
-               cmp     r5, r8
-               blo     1b
-               debug_reloc_end
-
-call_kernel:   bl      cache_clean_flush
-               bl      cache_off
-               mov     r0, #0
-               mov     r1, r7                  @ restore architecture number
-               mov     pc, r4                  @ call kernel
-
-/*
- * Here follow the relocatable cache support functions for the
- * various processors.  This is a generic hook for locating an
- * entry and jumping to an instruction at the specified offset
- * from the start of the block.  Please note this is all position
- * independent code.
- *
- *  r1  = corrupted
- *  r2  = corrupted
- *  r3  = block offset
- *  r6  = corrupted
- *  r12 = corrupted
- */
-
-call_cache_fn: adr     r12, proc_types
-               mrc     p15, 0, r6, c0, c0      @ get processor ID
-1:             ldr     r1, [r12, #0]           @ get value
-               ldr     r2, [r12, #4]           @ get mask
-               eor     r1, r1, r6              @ (real ^ match)
-               tst     r1, r2                  @       & mask
-               addeq   pc, r12, r3             @ call cache function
-               add     r12, r12, #4*5
-               b       1b
-
-/*
- * Table for cache operations.  This is basically:
- *   - CPU ID match
- *   - CPU ID mask
- *   - 'cache on' method instruction
- *   - 'cache off' method instruction
- *   - 'cache flush' method instruction
- *
- * We match an entry using: ((real_id ^ match) & mask) == 0
- *
- * Writethrough caches generally only need 'on' and 'off'
- * methods.  Writeback caches _must_ have the flush method
- * defined.
- */
-               .type   proc_types,#object
-proc_types:
-               .word   0x41560600              @ ARM6/610
-               .word   0xffffffe0
-               b       __arm6_cache_off        @ works, but slow
-               b       __arm6_cache_off
-               mov     pc, lr
-@              b       __arm6_cache_on         @ untested
-@              b       __arm6_cache_off
-@              b       __armv3_cache_flush
-
-               .word   0x41007000              @ ARM7/710
-               .word   0xfff8fe00
-               b       __arm7_cache_off
-               b       __arm7_cache_off
-               mov     pc, lr
-
-               .word   0x41807200              @ ARM720T (writethrough)
-               .word   0xffffff00
-               b       __armv4_cache_on
-               b       __armv4_cache_off
-               mov     pc, lr
-
-               .word   0x41129200              @ ARM920T
-               .word   0xff00fff0
-               b       __armv4_cache_on
-               b       __armv4_cache_off
-               b       __armv4_cache_flush
-
-               .word   0x4401a100              @ sa110 / sa1100
-               .word   0xffffffe0
-               b       __armv4_cache_on
-               b       __armv4_cache_off
-               b       __armv4_cache_flush
-
-               .word   0x6901b110              @ sa1110
-               .word   0xfffffff0
-               b       __armv4_cache_on
-               b       __armv4_cache_off
-               b       __armv4_cache_flush
-
-               .word   0x69050000              @ xscale
-               .word   0xffff0000
-               b       __armv4_cache_on
-               b       __armv4_cache_off
-               b       __armv4_cache_flush
-
-               .word   0                       @ unrecognised type
-               .word   0
-               mov     pc, lr
-               mov     pc, lr
-               mov     pc, lr
-
-               .size   proc_types, . - proc_types
-
-/*
- * Turn off the Cache and MMU.  ARMv3 does not support
- * reading the control register, but ARMv4 does.
- *
- * On entry,  r6 = processor ID
- * On exit,   r0, r1, r2, r3, r12 corrupted
- * This routine must preserve: r4, r6, r7
- */
-               .align  5
-cache_off:     mov     r3, #12                 @ cache_off function
-               b       call_cache_fn
-
-__armv4_cache_off:
-               mrc     p15, 0, r0, c1, c0
-               bic     r0, r0, #0x000d
-               mcr     p15, 0, r0, c1, c0      @ turn MMU and cache off
-               mov     r0, #0
-               mcr     p15, 0, r0, c7, c7      @ invalidate whole cache v4
-               mcr     p15, 0, r0, c8, c7      @ invalidate whole TLB v4
-               mov     pc, lr
-
-__arm6_cache_off:
-               mov     r0, #0x00000030         @ ARM6 control reg.
-               b       __armv3_cache_off
-
-__arm7_cache_off:
-               mov     r0, #0x00000070         @ ARM7 control reg.
-               b       __armv3_cache_off
-
-__armv3_cache_off:
-               mcr     p15, 0, r0, c1, c0, 0   @ turn MMU and cache off
-               mov     r0, #0
-               mcr     p15, 0, r0, c7, c0, 0   @ invalidate whole cache v3
-               mcr     p15, 0, r0, c5, c0, 0   @ invalidate whole TLB v3
-               mov     pc, lr
-
-/*
- * Clean and flush the cache to maintain consistency.
- *
- * On entry,
- *  r6 = processor ID
- * On exit,
- *  r1, r2, r3, r12 corrupted
- * This routine must preserve:
- *  r0, r4, r5, r6, r7
- */
-               .align  5
-cache_clean_flush:
-               mov     r3, #16
-               b       call_cache_fn
-
-__armv4_cache_flush:
-               bic     r1, pc, #31
-               add     r2, r1, #65536          @ 2x the largest dcache size
-1:             ldr     r12, [r1], #32          @ s/w flush D cache
-               teq     r1, r2
-               bne     1b
-
-               mcr     p15, 0, r1, c7, c7, 0   @ flush I cache
-               mcr     p15, 0, r1, c7, c10, 4  @ drain WB
-               mov     pc, lr
-
-__armv3_cache_flush:
-               mov     r1, #0
-               mcr     p15, 0, r0, c7, c0, 0   @ invalidate whole cache v3
-               mov     pc, lr
-
-/*
- * Various debugging routines for printing hex characters and
- * memory, which again must be relocatable.
- */
-#ifdef DEBUG
-               .type   phexbuf,#object
-phexbuf:       .space  12
-               .size   phexbuf, . - phexbuf
-
-phex:          adr     r3, phexbuf
-               mov     r2, #0
-               strb    r2, [r3, r1]
-1:             subs    r1, r1, #1
-               movmi   r0, r3
-               bmi     puts
-               and     r2, r0, #15
-               mov     r0, r0, lsr #4
-               cmp     r2, #10
-               addge   r2, r2, #7
-               add     r2, r2, #'0'
-               strb    r2, [r3, r1]
-               b       1b
-
-puts:          loadsp  r3
-1:             ldrb    r2, [r0], #1
-               teq     r2, #0
-               moveq   pc, lr
-2:             writeb  r2
-               mov     r1, #0x00020000
-3:             subs    r1, r1, #1
-               bne     3b
-               teq     r2, #'\n'
-               moveq   r2, #'\r'
-               beq     2b
-               teq     r0, #0
-               bne     1b
-               mov     pc, lr
-putc:
-               mov     r2, r0
-               mov     r0, #0
-               loadsp  r3
-               b       2b
-
-memdump:       mov     r12, r0
-               mov     r10, lr
-               mov     r11, #0
-2:             mov     r0, r11, lsl #2
-               add     r0, r0, r12
-               mov     r1, #8
-               bl      phex
-               mov     r0, #':'
-               bl      putc
-1:             mov     r0, #' '
-               bl      putc
-               ldr     r0, [r12, r11, lsl #2]
-               mov     r1, #8
-               bl      phex
-               and     r0, r11, #7
-               teq     r0, #3
-               moveq   r0, #' '
-               bleq    putc
-               and     r0, r11, #7
-               add     r11, r11, #1
-               teq     r0, #7
-               bne     1b
-               mov     r0, #'\n'
-               bl      putc
-               cmp     r11, #64
-               blt     2b
-               mov     pc, r10
-#endif
-
-reloc_end:
-
-               .align
-               .section ".stack", "aw"
-user_stack:    .space  4096
diff --git a/arch/arm26/boot/compressed/ll_char_wr.S b/arch/arm26/boot/compressed/ll_char_wr.S
deleted file mode 100644 (file)
index f024c3e..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-/*
- *  linux/arch/arm26/lib/ll_char_wr.S
- *
- *  Copyright (C) 1995, 1996 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Speedups & 1bpp code (C) 1996 Philip Blundell & Russell King.
- *
- *  10-04-96   RMK     Various cleanups & reduced register usage.
- *  08-04-98   RMK     Shifts re-ordered
- */
-
-@ Regs: [] = corruptible
-@       {} = used
-@       () = do not use
-
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-               .text
-
-#define BOLD            0x01
-#define ITALIC          0x02
-#define UNDERLINE       0x04
-#define FLASH           0x08
-#define INVERSE         0x10
-
-LC0:           .word   bytes_per_char_h
-               .word   video_size_row
-               .word   acorndata_8x8
-               .word   con_charconvtable
-
-ENTRY(ll_write_char)
-               stmfd   sp!, {r4 - r7, lr}
-@
-@ Smashable regs: {r0 - r3}, [r4 - r7], (r8 - fp), [ip], (sp), [lr], (pc)
-@
-               eor     ip, r1, #UNDERLINE << 9
-/*
- * calculate colours
- */
-               tst     r1, #INVERSE << 9
-               moveq   r2, r1, lsr #16
-               moveq   r3, r1, lsr #24
-               movne   r2, r1, lsr #24
-               movne   r3, r1, lsr #16
-               and     r3, r3, #255
-               and     r2, r2, #255
-/*
- * calculate offset into character table
- */
-               mov     r1, r1, lsl #23
-               mov     r1, r1, lsr #20
-/*
- * calculate offset required for each row [maybe I should make this an argument to this fn.
- * Have to see what the register usage is like in the calling routines.
- */
-               adr     r4, LC0
-               ldmia   r4, {r4, r5, r6, lr}
-               ldr     r4, [r4]
-               ldr     r5, [r5]
-/*
- * Go to resolution-dependent routine...
- */
-               cmp     r4, #4
-               blt     Lrow1bpp
-               eor     r2, r3, r2                      @ Create eor mask to change colour from bg
-               orr     r3, r3, r3, lsl #8              @ to fg.
-               orr     r3, r3, r3, lsl #16
-               add     r0, r0, r5, lsl #3              @ Move to bottom of character
-               add     r1, r1, #7
-               ldrb    r7, [r6, r1]
-               tst     ip, #UNDERLINE << 9
-               eoreq   r7, r7, #255
-               teq     r4, #8
-               beq     Lrow8bpplp
-@
-@ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
-@
-               orr     r3, r3, r3, lsl #4
-Lrow4bpplp:    ldr     r7, [lr, r7, lsl #2]
-               mul     r7, r2, r7
-               tst     r1, #7                          @ avoid using r7 directly after
-               eor     ip, r3, r7
-               str     ip, [r0, -r5]!
-               LOADREGS(eqfd, sp!, {r4 - r7, pc})
-               sub     r1, r1, #1
-               ldrb    r7, [r6, r1]
-               ldr     r7, [lr, r7, lsl #2]
-               mul     r7, r2, r7
-               tst     r1, #7                          @ avoid using r7 directly after
-               eor     ip, r3, r7
-               str     ip, [r0, -r5]!
-               subne   r1, r1, #1
-               ldrneb  r7, [r6, r1]
-               bne     Lrow4bpplp
-               LOADREGS(fd, sp!, {r4 - r7, pc})
-
-@
-@ Smashable regs: {r0 - r3}, [r4], {r5 - r7}, (r8 - fp), [ip], (sp), {lr}, (pc)
-@
-Lrow8bpplp:    mov     ip, r7, lsr #4
-               ldr     ip, [lr, ip, lsl #2]
-               mul     r4, r2, ip
-               and     ip, r7, #15                     @ avoid r4
-               ldr     ip, [lr, ip, lsl #2]            @ avoid r4
-               mul     ip, r2, ip                      @ avoid r4
-               eor     r4, r3, r4                      @ avoid ip
-               tst     r1, #7                          @ avoid ip
-               sub     r0, r0, r5                      @ avoid ip
-               eor     ip, r3, ip
-               stmia   r0, {r4, ip}
-               LOADREGS(eqfd, sp!, {r4 - r7, pc})
-               sub     r1, r1, #1
-               ldrb    r7, [r6, r1]
-               mov     ip, r7, lsr #4
-               ldr     ip, [lr, ip, lsl #2]
-               mul     r4, r2, ip
-               and     ip, r7, #15                     @ avoid r4
-               ldr     ip, [lr, ip, lsl #2]            @ avoid r4
-               mul     ip, r2, ip                      @ avoid r4
-               eor     r4, r3, r4                      @ avoid ip
-               tst     r1, #7                          @ avoid ip
-               sub     r0, r0, r5                      @ avoid ip
-               eor     ip, r3, ip
-               stmia   r0, {r4, ip}
-               subne   r1, r1, #1
-               ldrneb  r7, [r6, r1]
-               bne     Lrow8bpplp
-               LOADREGS(fd, sp!, {r4 - r7, pc})
-
-@
-@ Smashable regs: {r0 - r3}, [r4], {r5, r6}, [r7], (r8 - fp), [ip], (sp), [lr], (pc)
-@
-Lrow1bpp:      add     r6, r6, r1
-               ldmia   r6, {r4, r7}
-               tst     ip, #INVERSE << 9
-               mvnne   r4, r4
-               mvnne   r7, r7
-               strb    r4, [r0], r5
-               mov     r4, r4, lsr #8
-               strb    r4, [r0], r5
-               mov     r4, r4, lsr #8
-               strb    r4, [r0], r5
-               mov     r4, r4, lsr #8
-               strb    r4, [r0], r5
-               strb    r7, [r0], r5
-               mov     r7, r7, lsr #8
-               strb    r7, [r0], r5
-               mov     r7, r7, lsr #8
-               strb    r7, [r0], r5
-               mov     r7, r7, lsr #8
-               tst     ip, #UNDERLINE << 9
-               mvneq   r7, r7
-               strb    r7, [r0], r5
-               LOADREGS(fd, sp!, {r4 - r7, pc})
-
-               .bss
-ENTRY(con_charconvtable)
-               .space  1024
diff --git a/arch/arm26/boot/compressed/misc.c b/arch/arm26/boot/compressed/misc.c
deleted file mode 100644 (file)
index 0714d19..0000000
+++ /dev/null
@@ -1,316 +0,0 @@
-/*
- * misc.c
- * 
- * This is a collection of several routines from gzip-1.0.3 
- * adapted for Linux.
- *
- * malloc by Hannu Savolainen 1993 and Matthias Urlichs 1994
- *
- * Modified for ARM Linux by Russell King
- *
- * Nicolas Pitre <nico@visuaide.com>  1999/04/14 :
- *  For this code to run directly from Flash, all constant variables must
- *  be marked with 'const' and all other variables initialized at run-time 
- *  only.  This way all non constant variables will end up in the bss segment,
- *  which should point to addresses in RAM and cleared to 0 on start.
- *  This allows for a much quicker boot time.
- */
-
-unsigned int __machine_arch_type;
-
-#include <linux/kernel.h>
-
-#include <asm/uaccess.h>
-#include "uncompress.h"
-
-#ifdef STANDALONE_DEBUG
-#define puts printf
-#endif
-
-#define __ptr_t void *
-
-/*
- * Optimised C version of memzero for the ARM.
- */
-void __memzero (__ptr_t s, size_t n)
-{
-       union { void *vp; unsigned long *ulp; unsigned char *ucp; } u;
-       int i;
-
-       u.vp = s;
-
-       for (i = n >> 5; i > 0; i--) {
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-       }
-
-       if (n & 1 << 4) {
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-       }
-
-       if (n & 1 << 3) {
-               *u.ulp++ = 0;
-               *u.ulp++ = 0;
-       }
-
-       if (n & 1 << 2)
-               *u.ulp++ = 0;
-
-       if (n & 1 << 1) {
-               *u.ucp++ = 0;
-               *u.ucp++ = 0;
-       }
-
-       if (n & 1)
-               *u.ucp++ = 0;
-}
-
-static inline __ptr_t memcpy(__ptr_t __dest, __const __ptr_t __src,
-                           size_t __n)
-{
-       int i = 0;
-       unsigned char *d = (unsigned char *)__dest, *s = (unsigned char *)__src;
-
-       for (i = __n >> 3; i > 0; i--) {
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-       }
-
-       if (__n & 1 << 2) {
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-               *d++ = *s++;
-       }
-
-       if (__n & 1 << 1) {
-               *d++ = *s++;
-               *d++ = *s++;
-       }
-
-       if (__n & 1)
-               *d++ = *s++;
-
-       return __dest;
-}
-
-/*
- * gzip delarations
- */
-#define OF(args)  args
-#define STATIC static
-
-typedef unsigned char  uch;
-typedef unsigned short ush;
-typedef unsigned long  ulg;
-
-#define WSIZE 0x8000           /* Window size must be at least 32k, */
-                               /* and a power of two */
-
-static uch *inbuf;             /* input buffer */
-static uch window[WSIZE];      /* Sliding window buffer */
-
-static unsigned insize;                /* valid bytes in inbuf */
-static unsigned inptr;         /* index of next byte to be processed in inbuf */
-static unsigned outcnt;                /* bytes in output buffer */
-
-/* gzip flag byte */
-#define ASCII_FLAG   0x01 /* bit 0 set: file probably ascii text */
-#define CONTINUATION 0x02 /* bit 1 set: continuation of multi-part gzip file */
-#define EXTRA_FIELD  0x04 /* bit 2 set: extra field present */
-#define ORIG_NAME    0x08 /* bit 3 set: original file name present */
-#define COMMENT      0x10 /* bit 4 set: file comment present */
-#define ENCRYPTED    0x20 /* bit 5 set: file is encrypted */
-#define RESERVED     0xC0 /* bit 6,7:   reserved */
-
-#define get_byte()  (inptr < insize ? inbuf[inptr++] : fill_inbuf())
-
-/* Diagnostic functions */
-#ifdef DEBUG
-#  define Assert(cond,msg) {if(!(cond)) error(msg);}
-#  define Trace(x) fprintf x
-#  define Tracev(x) {if (verbose) fprintf x ;}
-#  define Tracevv(x) {if (verbose>1) fprintf x ;}
-#  define Tracec(c,x) {if (verbose && (c)) fprintf x ;}
-#  define Tracecv(c,x) {if (verbose>1 && (c)) fprintf x ;}
-#else
-#  define Assert(cond,msg)
-#  define Trace(x)
-#  define Tracev(x)
-#  define Tracevv(x)
-#  define Tracec(c,x)
-#  define Tracecv(c,x)
-#endif
-
-static int  fill_inbuf(void);
-static void flush_window(void);
-static void error(char *m);
-static void gzip_mark(void **);
-static void gzip_release(void **);
-
-extern char input_data[];
-extern char input_data_end[];
-
-static uch *output_data;
-static ulg output_ptr;
-static ulg bytes_out;
-
-static void *malloc(int size);
-static void free(void *where);
-static void error(char *m);
-static void gzip_mark(void **);
-static void gzip_release(void **);
-
-static void puts(const char *);
-
-extern int end;
-static ulg free_mem_ptr;
-static ulg free_mem_ptr_end;
-
-#define HEAP_SIZE 0x3000
-
-#include "../../../../lib/inflate.c"
-
-#ifndef STANDALONE_DEBUG
-static void *malloc(int size)
-{
-       void *p;
-
-       if (size <0) error("Malloc error");
-       if (free_mem_ptr <= 0) error("Memory error");
-
-       free_mem_ptr = (free_mem_ptr + 3) & ~3; /* Align */
-
-       p = (void *)free_mem_ptr;
-       free_mem_ptr += size;
-
-       if (free_mem_ptr >= free_mem_ptr_end)
-               error("Out of memory");
-       return p;
-}
-
-static void free(void *where)
-{ /* gzip_mark & gzip_release do the free */
-}
-
-static void gzip_mark(void **ptr)
-{
-       arch_decomp_wdog();
-       *ptr = (void *) free_mem_ptr;
-}
-
-static void gzip_release(void **ptr)
-{
-       arch_decomp_wdog();
-       free_mem_ptr = (long) *ptr;
-}
-#else
-static void gzip_mark(void **ptr)
-{
-}
-
-static void gzip_release(void **ptr)
-{
-}
-#endif
-
-/* ===========================================================================
- * Fill the input buffer. This is called only when the buffer is empty
- * and at least one byte is really needed.
- */
-int fill_inbuf(void)
-{
-       if (insize != 0)
-               error("ran out of input data");
-
-       inbuf = input_data;
-       insize = &input_data_end[0] - &input_data[0];
-
-       inptr = 1;
-       return inbuf[0];
-}
-
-/* ===========================================================================
- * Write the output window window[0..outcnt-1] and update crc and bytes_out.
- * (Used for the decompressed data only.)
- */
-void flush_window(void)
-{
-       ulg c = crc;
-       unsigned n;
-       uch *in, *out, ch;
-
-       in = window;
-       out = &output_data[output_ptr];
-       for (n = 0; n < outcnt; n++) {
-               ch = *out++ = *in++;
-               c = crc_32_tab[((int)c ^ ch) & 0xff] ^ (c >> 8);
-       }
-       crc = c;
-       bytes_out += (ulg)outcnt;
-       output_ptr += (ulg)outcnt;
-       outcnt = 0;
-       puts(".");
-}
-
-static void error(char *x)
-{
-       int ptr;
-
-       puts("\n\n");
-       puts(x);
-       puts("\n\n -- System halted");
-
-       while(1);       /* Halt */
-}
-
-#ifndef STANDALONE_DEBUG
-
-ulg
-decompress_kernel(ulg output_start, ulg free_mem_ptr_p, ulg free_mem_ptr_end_p,
-                 int arch_id)
-{
-       output_data             = (uch *)output_start;  /* Points to kernel start */
-       free_mem_ptr            = free_mem_ptr_p;
-       free_mem_ptr_end        = free_mem_ptr_end_p;
-       __machine_arch_type     = arch_id;
-
-       arch_decomp_setup();
-
-       makecrc();
-       puts("Uncompressing Linux...");
-       gunzip();
-       puts(" done, booting the kernel.\n");
-       return output_ptr;
-}
-#else
-
-char output_buffer[1500*1024];
-
-int main()
-{
-       output_data = output_buffer;
-
-       makecrc();
-       puts("Uncompressing Linux...");
-       gunzip();
-       puts("done.\n");
-       return 0;
-}
-#endif
-       
diff --git a/arch/arm26/boot/compressed/uncompress.h b/arch/arm26/boot/compressed/uncompress.h
deleted file mode 100644 (file)
index 66d9b93..0000000
+++ /dev/null
@@ -1,110 +0,0 @@
-/*
- *
- *  Copyright (C) 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#define VIDMEM ((char *)0x02000000)
-int video_num_columns, video_num_lines, video_size_row;
-int white, bytes_per_char_h;
-extern unsigned long con_charconvtable[256];
-
-struct param_struct {
-       unsigned long page_size;
-       unsigned long nr_pages;
-       unsigned long ramdisk_size;
-       unsigned long mountrootrdonly;
-       unsigned long rootdev;
-       unsigned long video_num_cols;
-       unsigned long video_num_rows;
-       unsigned long video_x;
-       unsigned long video_y;
-       unsigned long memc_control_reg;
-       unsigned char sounddefault;
-       unsigned char adfsdrives;
-       unsigned char bytes_per_char_h;
-       unsigned char bytes_per_char_v;
-       unsigned long unused[256/4-11];
-};
-
-static struct param_struct *params = (struct param_struct *)0x0207c000;
-/*
- * This does not append a newline
- */
-static void puts(const char *s)
-{
-       extern void ll_write_char(char *, unsigned long);
-       int x,y;
-       unsigned char c;
-       char *ptr;
-
-       x = params->video_x;
-       y = params->video_y;
-
-       while ( ( c = *(unsigned char *)s++ ) != '\0' ) {
-               if ( c == '\n' ) {
-                       x = 0;
-                       if ( ++y >= video_num_lines ) {
-                               y--;
-                       }
-               } else {
-                       ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
-                       ll_write_char(ptr, c|(white<<16));
-                       if ( ++x >= video_num_columns ) {
-                               x = 0;
-                               if ( ++y >= video_num_lines ) {
-                                       y--;
-                               }
-                       }
-               }
-       }
-
-       params->video_x = x;
-       params->video_y = y;
-}
-
-static void error(char *x);
-
-/*
- * Setup for decompression
- */
-static void arch_decomp_setup(void)
-{
-       int i;
-       
-       video_num_lines = params->video_num_rows;
-       video_num_columns = params->video_num_cols;
-       bytes_per_char_h = params->bytes_per_char_h;
-       video_size_row = video_num_columns * bytes_per_char_h;
-       if (bytes_per_char_h == 4)
-               for (i = 0; i < 256; i++)
-                       con_charconvtable[i] =
-                               (i & 128 ? 1 << 0  : 0) |
-                               (i & 64  ? 1 << 4  : 0) |
-                               (i & 32  ? 1 << 8  : 0) |
-                               (i & 16  ? 1 << 12 : 0) |
-                               (i & 8   ? 1 << 16 : 0) |
-                               (i & 4   ? 1 << 20 : 0) |
-                               (i & 2   ? 1 << 24 : 0) |
-                               (i & 1   ? 1 << 28 : 0);
-       else
-               for (i = 0; i < 16; i++)
-                       con_charconvtable[i] =
-                               (i & 8   ? 1 << 0  : 0) |
-                               (i & 4   ? 1 << 8  : 0) |
-                               (i & 2   ? 1 << 16 : 0) |
-                               (i & 1   ? 1 << 24 : 0);
-
-       white = bytes_per_char_h == 8 ? 0xfc : 7;
-
-       if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n");
-}
-
-/*
- * nothing to do
- */
-#define arch_decomp_wdog()
diff --git a/arch/arm26/boot/compressed/vmlinux.lds.in b/arch/arm26/boot/compressed/vmlinux.lds.in
deleted file mode 100644 (file)
index 86d821d..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  linux/arch/arm26/boot/compressed/vmlinux.lds.in
- *
- *  Copyright (C) 2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-OUTPUT_ARCH(arm)
-ENTRY(_start)
-SECTIONS
-{
-  . = LOAD_ADDR;
-  _load_addr = .;
-
-  . = TEXT_START;
-  _text = .;
-
-  .text : {
-    _start = .;
-    *(.start)
-    *(.text)
-    *(.fixup)
-    *(.gnu.warning)
-    *(.rodata)
-    *(.rodata.*)
-    *(.glue_7)
-    *(.glue_7t)
-    input_data = .;
-    arch/arm26/boot/compressed/piggy.o
-    input_data_end = .;
-    . = ALIGN(4);
-  }
-
-  _etext = .;
-
-  _got_start = .;
-  .got                 : { *(.got) }
-  _got_end = .;
-  .got.plt             : { *(.got.plt) }
-  .data                        : { *(.data) }
-  _edata = .;
-
-  . = BSS_START;
-  __bss_start = .;
-  .bss                 : { *(.bss) }
-  _end = .;
-
-  .stack (NOLOAD)      : { *(.stack) }
-
-  .stab 0              : { *(.stab) }
-  .stabstr 0           : { *(.stabstr) }
-  .stab.excl 0         : { *(.stab.excl) }
-  .stab.exclstr 0      : { *(.stab.exclstr) }
-  .stab.index 0                : { *(.stab.index) }
-  .stab.indexstr 0     : { *(.stab.indexstr) }
-  .comment 0           : { *(.comment) }
-}
-
diff --git a/arch/arm26/boot/install.sh b/arch/arm26/boot/install.sh
deleted file mode 100644 (file)
index 8a8399b..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-#!/bin/sh
-#
-# arch/arm26/boot/install.sh
-#
-# This file is subject to the terms and conditions of the GNU General Public
-# License.  See the file "COPYING" in the main directory of this archive
-# for more details.
-#
-# Copyright (C) 1995 by Linus Torvalds
-#
-# Adapted from code in arch/i386/boot/Makefile by H. Peter Anvin
-# Adapted from code in arch/i386/boot/install.sh by Russell King
-# Stolen from arm32 by Ian Molton
-#
-# "make install" script for arm architecture
-#
-# Arguments:
-#   $1 - kernel version
-#   $2 - kernel image file
-#   $3 - kernel map file
-#   $4 - default install path (blank if root directory)
-#
-
-# User may have a custom install script
-
-if [ -x /sbin/${CROSS_COMPILE}installkernel ]; then
-  exec /sbin/${CROSS_COMPILE}installkernel "$@"
-fi
-
-if [ "$2" = "zImage" ]; then
-# Compressed install
-  echo "Installing compressed kernel"
-  if [ -f $4/vmlinuz-$1 ]; then
-    mv $4/vmlinuz-$1 $4/vmlinuz.old
-  fi
-
-  if [ -f $4/System.map-$1 ]; then
-    mv $4/System.map-$1 $4/System.old
-  fi
-
-  cat $2 > $4/vmlinuz-$1
-  cp $3 $4/System.map-$1
-else
-# Normal install
-  echo "Installing normal kernel"
-  if [ -f $4/vmlinux-$1 ]; then
-    mv $4/vmlinux-$1 $4/vmlinux.old
-  fi
-
-  if [ -f $4/System.map ]; then
-    mv $4/System.map $4/System.old
-  fi
-
-  cat $2 > $4/vmlinux-$1
-  cp $3 $4/System.map
-fi
-
-if [ -x /sbin/loadmap ]; then
-  /sbin/loadmap --rdev /dev/ima
-else
-  echo "You have to install it yourself"
-fi
diff --git a/arch/arm26/defconfig b/arch/arm26/defconfig
deleted file mode 100644 (file)
index 2b7d44b..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-#
-# Automatically generated by make menuconfig: don't edit
-#
-CONFIG_ARM=y
-# CONFIG_EISA is not set
-# CONFIG_SBUS is not set
-# CONFIG_MCA is not set
-CONFIG_UID16=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_RWSEM_XCHGADD_ALGORITHM is not set
-# CONFIG_GENERIC_BUST_SPINLOCK is not set
-# CONFIG_GENERIC_ISA_DMA is not set
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-
-#
-# General setup
-#
-# CONFIG_NET is not set
-# CONFIG_SYSVIPC is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_SYSCTL is not set
-
-#
-# Loadable module support
-#
-# CONFIG_MODULES is not set
-
-#
-# System Type
-#
-CONFIG_ARCH_ARC=y
-# CONFIG_ARCH_A5K is not set
-CONFIG_ARCH_ACORN=y
-# CONFIG_CPU_32 is not set
-CONFIG_CPU_26=y
-# CONFIG_PAGESIZE_16 is not set
-
-#
-# General setup
-#
-CONFIG_FIQ=y
-# CONFIG_ZBOOT_ROM is not set
-CONFIG_ZBOOT_ROM_TEXT=0
-CONFIG_ZBOOT_ROM_BSS=0
-CONFIG_FPE_NWFPE=y
-CONFIG_KCORE_ELF=y
-# CONFIG_KCORE_AOUT is not set
-# CONFIG_BINFMT_AOUT is not set
-# CONFIG_BINFMT_ELF is not set
-# CONFIG_BINFMT_MISC is not set
-CONFIG_CMDLINE=""
-# CONFIG_ALIGNMENT_TRAP is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play configuration
-#
-# CONFIG_PNP is not set
-# CONFIG_ISAPNP is not set
-# CONFIG_PNPBIOS is not set
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_DEV_XD is not set
-# CONFIG_PARIDE is not set
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_CISS_SCSI_TAPE is not set
-# CONFIG_BLK_DEV_DAC960 is not set
-# CONFIG_BLK_DEV_UMEM is not set
-# CONFIG_BLK_DEV_LOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-# CONFIG_BLK_DEV_MD is not set
-# CONFIG_MD_LINEAR is not set
-# CONFIG_MD_RAID0 is not set
-# CONFIG_MD_RAID1 is not set
-# CONFIG_MD_RAID5 is not set
-# CONFIG_MD_MULTIPATH is not set
-# CONFIG_BLK_DEV_LVM is not set
-
-#
-# Acorn-specific block devices
-#
-# CONFIG_BLK_DEV_FD1772 is not set
-# CONFIG_BLK_DEV_MFM is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI support
-#
-# CONFIG_SCSI is not set
-
-#
-# ISDN subsystem
-#
-
-#
-# Input device support
-#
-# CONFIG_INPUT is not set
-# CONFIG_INPUT_KEYBDEV is not set
-# CONFIG_INPUT_MOUSEDEV is not set
-# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_TSLIBDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
-# CONFIG_INPUT_UINPUT is not set
-# CONFIG_GAMEPORT is not set
-CONFIG_SOUND_GAMEPORT=y
-# CONFIG_GAMEPORT_NS558 is not set
-# CONFIG_GAMEPORT_L4 is not set
-# CONFIG_GAMEPORT_EMU10K1 is not set
-# CONFIG_GAMEPORT_VORTEX is not set
-# CONFIG_GAMEPORT_FM801 is not set
-# CONFIG_GAMEPORT_CS461x is not set
-# CONFIG_SERIO is not set
-# CONFIG_SERIO_I8042 is not set
-# CONFIG_SERIO_SERPORT is not set
-# CONFIG_SERIO_CT82C710 is not set
-# CONFIG_SERIO_PARKBD is not set
-# CONFIG_SERIO_ACORN is not set
-
-#
-# Character devices
-#
-# CONFIG_VT is not set
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-# CONFIG_SERIAL_8250 is not set
-# CONFIG_SERIAL_8250_CONSOLE is not set
-# CONFIG_SERIAL_8250_CS is not set
-# CONFIG_SERIAL_8250_EXTENDED is not set
-# CONFIG_SERIAL_8250_MANY_PORTS is not set
-# CONFIG_SERIAL_8250_SHARE_IRQ is not set
-# CONFIG_SERIAL_8250_DETECT_IRQ is not set
-# CONFIG_SERIAL_8250_MULTIPORT is not set
-# CONFIG_SERIAL_8250_RSA is not set
-# CONFIG_ATOMWIDE_SERIAL is not set
-# CONFIG_DUALSP_SERIAL is not set
-# CONFIG_SERIAL_AMBA is not set
-# CONFIG_SERIAL_AMBA_CONSOLE is not set
-# CONFIG_SERIAL_CLPS711X is not set
-# CONFIG_SERIAL_CLPS711X_CONSOLE is not set
-# CONFIG_SERIAL_CLPS711X_OLD_NAME is not set
-# CONFIG_SERIAL_21285 is not set
-# CONFIG_SERIAL_21285_OLD is not set
-# CONFIG_SERIAL_21285_CONSOLE is not set
-# CONFIG_SERIAL_UART00 is not set
-# CONFIG_SERIAL_UART00_CONSOLE is not set
-# CONFIG_SERIAL_SA1100 is not set
-# CONFIG_SERIAL_SA1100_CONSOLE is not set
-# CONFIG_UNIX98_PTYS is not set
-
-#
-# I2C support
-#
-CONFIG_I2C=y
-CONFIG_I2C_ALGOBIT=y
-CONFIG_I2C_ALGOPCF=y
-# CONFIG_I2C_ELEKTOR is not set
-CONFIG_I2C_CHARDEV=y
-# CONFIG_I2C_PROC is not set
-
-#
-# L3 serial bus support
-#
-# CONFIG_L3 is not set
-# CONFIG_L3_ALGOBIT is not set
-# CONFIG_L3_BIT_SA1100_GPIO is not set
-# CONFIG_L3_SA1111 is not set
-# CONFIG_BIT_SA1100_GPIO is not set
-
-#
-# Mice
-#
-# CONFIG_BUSMOUSE is not set
-# CONFIG_PSMOUSE is not set
-# CONFIG_QIC02_TAPE is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
-# CONFIG_NVRAM is not set
-# CONFIG_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_FTAPE is not set
-# CONFIG_AGP is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# File systems
-#
-# CONFIG_QUOTA is not set
-# CONFIG_QFMT_V1 is not set
-# CONFIG_QFMT_V2 is not set
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_REISERFS_CHECK is not set
-# CONFIG_REISERFS_PROC_INFO is not set
-# CONFIG_ADFS_FS is not set
-# CONFIG_ADFS_FS_RW is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_JBD is not set
-# CONFIG_JBD_DEBUG is not set
-# CONFIG_FAT_FS is not set
-# CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_JFFS_FS is not set
-# CONFIG_JFFS2_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_TMPFS is not set
-CONFIG_RAMFS=y
-# CONFIG_ISO9660_FS is not set
-# CONFIG_JOLIET is not set
-# CONFIG_ZISOFS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_JFS_DEBUG is not set
-# CONFIG_JFS_STATISTICS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_NTFS_FS is not set
-# CONFIG_NTFS_DEBUG is not set
-# CONFIG_HPFS_FS is not set
-CONFIG_PROC_FS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVFS_MOUNT is not set
-# CONFIG_DEVFS_DEBUG is not set
-# CONFIG_DEVPTS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_QNX4FS_RW is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_EXT2_FS=y
-# CONFIG_SYSV_FS is not set
-# CONFIG_UDF_FS is not set
-# CONFIG_UDF_RW is not set
-# CONFIG_UFS_FS is not set
-# CONFIG_UFS_FS_WRITE is not set
-# CONFIG_NCPFS_NLS is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_ZISOFS_FS is not set
-
-#
-# Partition Types
-#
-CONFIG_PARTITION_ADVANCED=y
-CONFIG_ACORN_PARTITION=y
-# CONFIG_ACORN_PARTITION_EESOX is not set
-# CONFIG_ACORN_PARTITION_ICS is not set
-CONFIG_ACORN_PARTITION_ADFS=y
-# CONFIG_ACORN_PARTITION_POWERTEC is not set
-CONFIG_ACORN_PARTITION_RISCIX=y
-# CONFIG_OSF_PARTITION is not set
-# CONFIG_AMIGA_PARTITION is not set
-# CONFIG_ATARI_PARTITION is not set
-# CONFIG_MAC_PARTITION is not set
-# CONFIG_MSDOS_PARTITION is not set
-# CONFIG_LDM_PARTITION is not set
-# CONFIG_SGI_PARTITION is not set
-# CONFIG_ULTRIX_PARTITION is not set
-# CONFIG_SUN_PARTITION is not set
-# CONFIG_EFI_PARTITION is not set
-# CONFIG_SMB_NLS is not set
-# CONFIG_NLS is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# Multimedia Capabilities Port drivers
-#
-# CONFIG_MCP is not set
-# CONFIG_MCP_SA1100 is not set
-# CONFIG_MCP_UCB1200 is not set
-# CONFIG_MCP_UCB1200_AUDIO is not set
-# CONFIG_MCP_UCB1200_TS is not set
-
-#
-# Console Switches
-#
-# CONFIG_SWITCHES is not set
-# CONFIG_SWITCHES_SA1100 is not set
-# CONFIG_SWITCHES_UCB1X00 is not set
-
-#
-# USB support
-#
-# CONFIG_USB is not set
-
-#
-# Kernel hacking
-#
-# CONFIG_NO_FRAME_POINTER is not set
-CONFIG_DEBUG_USER=y
-CONFIG_DEBUG_INFO=y
-CONFIG_DEBUG_KERNEL=y
-CONFIG_DEBUG_SLAB=y
-CONFIG_MAGIC_SYSRQ=y
-CONFIG_DEBUG_SPINLOCK=y
-CONFIG_DEBUG_WAITQ=y
-CONFIG_DEBUG_BUGVERBOSE=y
-CONFIG_DEBUG_ERRORS=y
-CONFIG_DEBUG_LL=y
-
-#
-# Security options
-#
-CONFIG_SECURITY_CAPABILITIES=y
-
-#
-# Library routines
-#
-CONFIG_CRC32=y
-# CONFIG_ZLIB_INFLATE is not set
-# CONFIG_ZLIB_DEFLATE is not set
diff --git a/arch/arm26/kernel/Makefile b/arch/arm26/kernel/Makefile
deleted file mode 100644 (file)
index ee9fb49..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#
-# Makefile for the linux kernel.
-#
-
-# Object file lists.
-
-AFLAGS_head.o           := -DTEXTADDR=$(TEXTADDR)
-
-obj-y          := compat.o dma.o entry.o irq.o process.o ptrace.o       \
-                  semaphore.o setup.o signal.o sys_arm.o time.o traps.o \
-                  ecard.o dma.o ecard.o fiq.o time.o
-
-extra-y                := head.o init_task.o vmlinux.lds
-
-obj-$(CONFIG_FIQ)              += fiq.o
-obj-$(CONFIG_MODULES)          += armksyms.o
-
diff --git a/arch/arm26/kernel/armksyms.c b/arch/arm26/kernel/armksyms.c
deleted file mode 100644 (file)
index fe1e3ce..0000000
+++ /dev/null
@@ -1,204 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/armksyms.c
- *
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/module.h>
-#include <linux/user.h>
-#include <linux/string.h>
-#include <linux/fs.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-#include <linux/delay.h>
-#include <linux/in6.h>
-#include <linux/interrupt.h>
-#include <linux/pm.h>
-#include <linux/tty.h>
-#include <linux/vt_kern.h>
-#include <linux/syscalls.h>
-
-#include <asm/byteorder.h>
-#include <asm/elf.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/processor.h>
-#include <asm/semaphore.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <asm/checksum.h>
-#include <asm/mach-types.h>
-
-extern int dump_fpu(struct pt_regs *, struct user_fp_struct *);
-extern void inswb(unsigned int port, void *to, int len);
-extern void outswb(unsigned int port, const void *to, int len);
-
-extern void __bad_xchg(volatile void *ptr, int size);
-
-/*
- * libgcc functions - functions that are used internally by the
- * compiler...  (prototypes are not correct though, but that
- * doesn't really matter since they're not versioned).
- */
-extern void __ashldi3(void);
-extern void __ashrdi3(void);
-extern void __divsi3(void);
-extern void __lshrdi3(void);
-extern void __modsi3(void);
-extern void __muldi3(void);
-extern void __ucmpdi2(void);
-extern void __udivdi3(void);
-extern void __umoddi3(void);
-extern void __udivmoddi4(void);
-extern void __udivsi3(void);
-extern void __umodsi3(void);
-extern void abort(void);
-
-extern void ret_from_exception(void);
-extern void fpundefinstr(void);
-extern void fp_enter(void);
-
-/*
- * This has a special calling convention; it doesn't
- * modify any of the usual registers, except for LR.
- * FIXME - we used to use our own local version - looks to be in kernel/softirq now
- */
-//extern void __do_softirq(void);
-
-#define EXPORT_SYMBOL_ALIAS(sym,orig)          \
- const char __kstrtab_##sym[]                  \
-  __attribute__((section(".kstrtab"))) =       \
-    __MODULE_STRING(sym);                      \
- const struct module_symbol __ksymtab_##sym    \
-  __attribute__((section("__ksymtab"))) =      \
-    { (unsigned long)&orig, __kstrtab_##sym };
-
-/*
- * floating point math emulator support.
- * These symbols will never change their calling convention...
- */
-EXPORT_SYMBOL_ALIAS(kern_fp_enter,fp_enter);
-EXPORT_SYMBOL_ALIAS(fp_printk,printk);
-EXPORT_SYMBOL_ALIAS(fp_send_sig,send_sig);
-
-EXPORT_SYMBOL(fpundefinstr);
-EXPORT_SYMBOL(ret_from_exception);
-
-#ifdef CONFIG_VT
-EXPORT_SYMBOL(kd_mksound);
-#endif
-
-//EXPORT_SYMBOL(__do_softirq);
-
-       /* platform dependent support */
-EXPORT_SYMBOL(dump_thread);
-EXPORT_SYMBOL(dump_fpu);
-EXPORT_SYMBOL(udelay);
-EXPORT_SYMBOL(kernel_thread);
-EXPORT_SYMBOL(system_rev);
-EXPORT_SYMBOL(system_serial_low);
-EXPORT_SYMBOL(system_serial_high);
-#ifdef CONFIG_DEBUG_BUGVERBOSE
-EXPORT_SYMBOL(__bug);
-#endif
-EXPORT_SYMBOL(__bad_xchg);
-EXPORT_SYMBOL(__readwrite_bug);
-EXPORT_SYMBOL(set_irq_type);
-EXPORT_SYMBOL(pm_idle);
-EXPORT_SYMBOL(pm_power_off);
-
-       /* processor dependencies */
-EXPORT_SYMBOL(__machine_arch_type);
-
-       /* networking */
-EXPORT_SYMBOL(csum_partial_copy_nocheck);
-EXPORT_SYMBOL(__csum_ipv6_magic);
-
-       /* io */
-#ifndef __raw_readsb
-EXPORT_SYMBOL(__raw_readsb);
-#endif
-#ifndef __raw_readsw
-EXPORT_SYMBOL(__raw_readsw);
-#endif
-#ifndef __raw_readsl
-EXPORT_SYMBOL(__raw_readsl);
-#endif
-#ifndef __raw_writesb
-EXPORT_SYMBOL(__raw_writesb);
-#endif
-#ifndef __raw_writesw
-EXPORT_SYMBOL(__raw_writesw);
-#endif
-#ifndef __raw_writesl
-EXPORT_SYMBOL(__raw_writesl);
-#endif
-
-       /* string / mem functions */
-EXPORT_SYMBOL(strcpy);
-EXPORT_SYMBOL(strncpy);
-EXPORT_SYMBOL(strcat);
-EXPORT_SYMBOL(strncat);
-EXPORT_SYMBOL(strcmp);
-EXPORT_SYMBOL(strncmp);
-EXPORT_SYMBOL(strchr);
-EXPORT_SYMBOL(strlen);
-EXPORT_SYMBOL(strnlen);
-EXPORT_SYMBOL(strrchr);
-EXPORT_SYMBOL(strstr);
-EXPORT_SYMBOL(memset);
-EXPORT_SYMBOL(memcpy);
-EXPORT_SYMBOL(memmove);
-EXPORT_SYMBOL(memcmp);
-EXPORT_SYMBOL(memscan);
-EXPORT_SYMBOL(__memzero);
-
-       /* user mem (segment) */
-EXPORT_SYMBOL(uaccess_kernel);
-EXPORT_SYMBOL(uaccess_user);
-
-EXPORT_SYMBOL(__get_user_1);
-EXPORT_SYMBOL(__get_user_2);
-EXPORT_SYMBOL(__get_user_4);
-EXPORT_SYMBOL(__get_user_8);
-
-EXPORT_SYMBOL(__put_user_1);
-EXPORT_SYMBOL(__put_user_2);
-EXPORT_SYMBOL(__put_user_4);
-EXPORT_SYMBOL(__put_user_8);
-
-       /* gcc lib functions */
-EXPORT_SYMBOL(__ashldi3);
-EXPORT_SYMBOL(__ashrdi3);
-EXPORT_SYMBOL(__divsi3);
-EXPORT_SYMBOL(__lshrdi3);
-EXPORT_SYMBOL(__modsi3);
-EXPORT_SYMBOL(__muldi3);
-EXPORT_SYMBOL(__ucmpdi2);
-EXPORT_SYMBOL(__udivdi3);
-EXPORT_SYMBOL(__umoddi3);
-EXPORT_SYMBOL(__udivmoddi4);
-EXPORT_SYMBOL(__udivsi3);
-EXPORT_SYMBOL(__umodsi3);
-
-       /* bitops */
-EXPORT_SYMBOL(_set_bit_le);
-EXPORT_SYMBOL(_test_and_set_bit_le);
-EXPORT_SYMBOL(_clear_bit_le);
-EXPORT_SYMBOL(_test_and_clear_bit_le);
-EXPORT_SYMBOL(_change_bit_le);
-EXPORT_SYMBOL(_test_and_change_bit_le);
-EXPORT_SYMBOL(_find_first_zero_bit_le);
-EXPORT_SYMBOL(_find_next_zero_bit_le);
-
-       /* elf */
-EXPORT_SYMBOL(elf_platform);
-EXPORT_SYMBOL(elf_hwcap);
-
-#ifdef CONFIG_PREEMPT
-EXPORT_SYMBOL(kernel_flag);
-#endif
diff --git a/arch/arm26/kernel/asm-offsets.c b/arch/arm26/kernel/asm-offsets.c
deleted file mode 100644 (file)
index 76d9d7d..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * Copyright (C) 1995-2001 Russell King
- *               2001-2002 Keith Owens
- *               2003      Ian Molton
- *     
- * Generate definitions needed by assembly language modules.
- * This code generates raw asm output which is post-processed to extract
- * and format the required data.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#include <linux/sched.h>
-#include <linux/mm.h>
-
-#include <asm/pgtable.h>
-#include <asm/uaccess.h>
-
-/*
- * Make sure that the compiler and target are compatible.
- */
-#if defined(__APCS_32__) && defined(CONFIG_CPU_26)
-#error Sorry, your compiler targets APCS-32 but this kernel requires APCS-26
-#endif
-
-/* Use marker if you need to separate the values later */
-
-#define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
-
-#define BLANK() asm volatile("\n->" : : )
-
-int main(void)
-{
-  DEFINE(TSK_ACTIVE_MM,                offsetof(struct task_struct, active_mm));
-  BLANK();
-  DEFINE(VMA_VM_MM,            offsetof(struct vm_area_struct, vm_mm));
-  DEFINE(VMA_VM_FLAGS,         offsetof(struct vm_area_struct, vm_flags));
-  BLANK();
-  DEFINE(VM_EXEC,              VM_EXEC);
-  BLANK();
-  BLANK();
-  DEFINE(PAGE_PRESENT,         _PAGE_PRESENT);
-  DEFINE(PAGE_READONLY,                _PAGE_READONLY);
-  DEFINE(PAGE_NOT_USER,                _PAGE_NOT_USER);
-  DEFINE(PAGE_OLD,             _PAGE_OLD);
-  DEFINE(PAGE_CLEAN,           _PAGE_CLEAN);
-  BLANK();
-  DEFINE(PAGE_SZ,              PAGE_SIZE);
-  BLANK();
-  DEFINE(SYS_ERROR0,           0x9f0000);
-  return 0; 
-}
diff --git a/arch/arm26/kernel/calls.S b/arch/arm26/kernel/calls.S
deleted file mode 100644 (file)
index e3d2768..0000000
+++ /dev/null
@@ -1,265 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/calls.S
- *
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  FIXME
- *  This file is included twice in entry.S which may not be necessary
- */
-
-//FIXME - clearly NR_syscalls is never defined here
-
-#ifndef NR_syscalls
-#define NR_syscalls 256
-#else
-
-__syscall_start:
-/* 0 */                .long   sys_ni_syscall
-               .long   sys_exit
-               .long   sys_fork_wrapper
-               .long   sys_read
-               .long   sys_write
-/* 5 */                .long   sys_open
-               .long   sys_close
-               .long   sys_ni_syscall          /* was sys_waitpid */
-               .long   sys_creat
-               .long   sys_link
-/* 10 */       .long   sys_unlink
-               .long   sys_execve_wrapper
-               .long   sys_chdir
-               .long   sys_time                /* used by libc4 */
-               .long   sys_mknod
-/* 15 */       .long   sys_chmod
-               .long   sys_lchown16
-               .long   sys_ni_syscall          /* was sys_break */
-               .long   sys_ni_syscall          /* was sys_stat */
-               .long   sys_lseek
-/* 20 */       .long   sys_getpid
-               .long   sys_mount
-               .long   sys_oldumount           /* used by libc4 */
-               .long   sys_setuid16
-               .long   sys_getuid16
-/* 25 */       .long   sys_stime
-               .long   sys_ptrace
-               .long   sys_alarm               /* used by libc4 */
-               .long   sys_ni_syscall          /* was sys_fstat */
-               .long   sys_pause
-/* 30 */       .long   sys_utime               /* used by libc4 */
-               .long   sys_ni_syscall          /* was sys_stty */
-               .long   sys_ni_syscall          /* was sys_getty */
-               .long   sys_access
-               .long   sys_nice
-/* 35 */       .long   sys_ni_syscall          /* was sys_ftime */
-               .long   sys_sync
-               .long   sys_kill
-               .long   sys_rename
-               .long   sys_mkdir
-/* 40 */       .long   sys_rmdir
-               .long   sys_dup
-               .long   sys_pipe
-               .long   sys_times
-               .long   sys_ni_syscall          /* was sys_prof */
-/* 45 */       .long   sys_brk
-               .long   sys_setgid16
-               .long   sys_getgid16
-               .long   sys_ni_syscall          /* was sys_signal */
-               .long   sys_geteuid16
-/* 50 */       .long   sys_getegid16
-               .long   sys_acct
-               .long   sys_umount
-               .long   sys_ni_syscall          /* was sys_lock */
-               .long   sys_ioctl
-/* 55 */       .long   sys_fcntl
-               .long   sys_ni_syscall          /* was sys_mpx */
-               .long   sys_setpgid
-               .long   sys_ni_syscall          /* was sys_ulimit */
-               .long   sys_ni_syscall          /* was sys_olduname */
-/* 60 */       .long   sys_umask
-               .long   sys_chroot
-               .long   sys_ustat
-               .long   sys_dup2
-               .long   sys_getppid
-/* 65 */       .long   sys_getpgrp
-               .long   sys_setsid
-               .long   sys_sigaction
-               .long   sys_ni_syscall          /* was sys_sgetmask */
-               .long   sys_ni_syscall          /* was sys_ssetmask */
-/* 70 */       .long   sys_setreuid16
-               .long   sys_setregid16
-               .long   sys_sigsuspend_wrapper
-               .long   sys_sigpending
-               .long   sys_sethostname
-/* 75 */       .long   sys_setrlimit
-               .long   sys_old_getrlimit       /* used by libc4 */
-               .long   sys_getrusage
-               .long   sys_gettimeofday
-               .long   sys_settimeofday
-/* 80 */       .long   sys_getgroups16
-               .long   sys_setgroups16
-               .long   old_select              /* used by libc4 */
-               .long   sys_symlink
-               .long   sys_ni_syscall          /* was sys_lstat */
-/* 85 */       .long   sys_readlink
-               .long   sys_uselib
-               .long   sys_swapon
-               .long   sys_reboot
-               .long   old_readdir             /* used by libc4 */
-/* 90 */       .long   old_mmap                /* used by libc4 */
-               .long   sys_munmap
-               .long   sys_truncate
-               .long   sys_ftruncate
-               .long   sys_fchmod
-/* 95 */       .long   sys_fchown16
-               .long   sys_getpriority
-               .long   sys_setpriority
-               .long   sys_ni_syscall          /* was sys_profil */
-               .long   sys_statfs
-/* 100 */      .long   sys_fstatfs
-               .long   sys_ni_syscall
-               .long   sys_socketcall
-               .long   sys_syslog
-               .long   sys_setitimer
-/* 105 */      .long   sys_getitimer
-               .long   sys_newstat
-               .long   sys_newlstat
-               .long   sys_newfstat
-               .long   sys_ni_syscall          /* was sys_uname */
-/* 110 */      .long   sys_ni_syscall          /* was sys_iopl */
-               .long   sys_vhangup
-               .long   sys_ni_syscall
-               .long   sys_syscall             /* call a syscall */
-               .long   sys_wait4
-/* 115 */      .long   sys_swapoff
-               .long   sys_sysinfo
-               .long   sys_ipc
-               .long   sys_fsync
-               .long   sys_sigreturn_wrapper
-/* 120 */      .long   sys_clone_wapper
-               .long   sys_setdomainname
-               .long   sys_newuname
-               .long   sys_ni_syscall
-               .long   sys_adjtimex
-/* 125 */      .long   sys_mprotect
-               .long   sys_sigprocmask
-               .long   sys_ni_syscall  /* WAS: sys_create_module */
-               .long   sys_init_module
-               .long   sys_delete_module
-/* 130 */      .long   sys_ni_syscall  /* WAS: sys_get_kernel_syms */
-               .long   sys_quotactl
-               .long   sys_getpgid
-               .long   sys_fchdir
-               .long   sys_bdflush
-/* 135 */      .long   sys_sysfs
-               .long   sys_personality
-               .long   sys_ni_syscall          /* .long        _sys_afs_syscall */
-               .long   sys_setfsuid16
-               .long   sys_setfsgid16
-/* 140 */      .long   sys_llseek
-               .long   sys_getdents
-               .long   sys_select
-               .long   sys_flock
-               .long   sys_msync
-/* 145 */      .long   sys_readv
-               .long   sys_writev
-               .long   sys_getsid
-               .long   sys_fdatasync
-               .long   sys_sysctl
-/* 150 */      .long   sys_mlock
-               .long   sys_munlock
-               .long   sys_mlockall
-               .long   sys_munlockall
-               .long   sys_sched_setparam
-/* 155 */      .long   sys_sched_getparam
-               .long   sys_sched_setscheduler
-               .long   sys_sched_getscheduler
-               .long   sys_sched_yield
-               .long   sys_sched_get_priority_max
-/* 160 */      .long   sys_sched_get_priority_min
-               .long   sys_sched_rr_get_interval
-               .long   sys_nanosleep
-               .long   sys_arm_mremap
-               .long   sys_setresuid16
-/* 165 */      .long   sys_getresuid16
-               .long   sys_ni_syscall
-               .long   sys_ni_syscall /* WAS: sys_query_module */
-               .long   sys_poll
-               .long   sys_nfsservctl
-/* 170 */      .long   sys_setresgid16
-               .long   sys_getresgid16
-               .long   sys_prctl
-               .long   sys_rt_sigreturn_wrapper
-               .long   sys_rt_sigaction
-/* 175 */      .long   sys_rt_sigprocmask
-               .long   sys_rt_sigpending
-               .long   sys_rt_sigtimedwait
-               .long   sys_rt_sigqueueinfo
-               .long   sys_rt_sigsuspend_wrapper
-/* 180 */      .long   sys_pread64
-               .long   sys_pwrite64
-               .long   sys_chown16
-               .long   sys_getcwd
-               .long   sys_capget
-/* 185 */      .long   sys_capset
-               .long   sys_sigaltstack_wrapper
-               .long   sys_sendfile
-               .long   sys_ni_syscall
-               .long   sys_ni_syscall
-/* 190 */      .long   sys_vfork_wrapper
-               .long   sys_getrlimit
-               .long   sys_mmap2
-               .long   sys_truncate64
-               .long   sys_ftruncate64
-/* 195 */      .long   sys_stat64
-               .long   sys_lstat64
-               .long   sys_fstat64
-               .long   sys_lchown
-               .long   sys_getuid
-/* 200 */      .long   sys_getgid
-               .long   sys_geteuid
-               .long   sys_getegid
-               .long   sys_setreuid
-               .long   sys_setregid
-/* 205 */      .long   sys_getgroups
-               .long   sys_setgroups
-               .long   sys_fchown
-               .long   sys_setresuid
-               .long   sys_getresuid
-/* 210 */      .long   sys_setresgid
-               .long   sys_getresgid
-               .long   sys_chown
-               .long   sys_setuid
-               .long   sys_setgid
-/* 215 */      .long   sys_setfsuid
-               .long   sys_setfsgid
-               .long   sys_getdents64
-               .long   sys_pivot_root
-               .long   sys_mincore
-/* 220 */      .long   sys_madvise
-               .long   sys_fcntl64
-               .long   sys_ni_syscall /* TUX */
-               .long   sys_ni_syscall /* WAS: sys_security */
-               .long   sys_gettid
-/* 225 */      .long   sys_readahead
-               .long   sys_setxattr
-               .long   sys_lsetxattr
-               .long   sys_fsetxattr
-               .long   sys_getxattr
-/* 230 */      .long   sys_lgetxattr
-               .long   sys_fgetxattr
-               .long   sys_listxattr
-               .long   sys_llistxattr
-               .long   sys_flistxattr
-/* 235 */      .long   sys_removexattr
-               .long   sys_lremovexattr
-               .long   sys_fremovexattr
-               .long   sys_tkill
-__syscall_end:
-
-               .rept   NR_syscalls - (__syscall_end - __syscall_start) / 4
-                       .long   sys_ni_syscall
-               .endr
-#endif
diff --git a/arch/arm26/kernel/compat.c b/arch/arm26/kernel/compat.c
deleted file mode 100644 (file)
index 21e966f..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/compat.c
- *
- *  Copyright (C) 2001 Russell King
- *                2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * We keep the old params compatibility cruft in one place (here)
- * so we don't end up with lots of mess around other places.
- *
- * NOTE:
- *  The old struct param_struct is deprecated, but it will be kept in
- *  the kernel for 5 years from now (2001). This will allow boot loaders
- *  to convert to the new struct tag way.
- */
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/string.h>
-#include <linux/init.h>
-
-#include <asm/setup.h>
-#include <asm/mach-types.h>
-#include <asm/page.h>
-
-//#include <asm/arch.h>
-//#include <asm/mach/irq.h>
-
-/*
- * Usage:
- *  - do not go blindly adding fields, add them at the end
- *  - when adding fields, don't rely on the address until
- *    a patch from me has been released
- *  - unused fields should be zero (for future expansion)
- *  - this structure is relatively short-lived - only
- *    guaranteed to contain useful data in setup_arch()
- *
- * This is the old deprecated way to pass parameters to the kernel
- */
-struct param_struct {
-    union {
-       struct {
-           unsigned long page_size;            /*  0 */
-           unsigned long nr_pages;             /*  4 */
-           unsigned long ramdisk_size;         /*  8 */
-           unsigned long flags;                /* 12 */
-#define FLAG_READONLY  1
-#define FLAG_RDLOAD    4
-#define FLAG_RDPROMPT  8
-           unsigned long rootdev;              /* 16 */
-           unsigned long video_num_cols;       /* 20 */
-           unsigned long video_num_rows;       /* 24 */
-           unsigned long video_x;              /* 28 */
-           unsigned long video_y;              /* 32 */
-           unsigned long memc_control_reg;     /* 36 */
-           unsigned char sounddefault;         /* 40 */
-           unsigned char adfsdrives;           /* 41 */
-           unsigned char bytes_per_char_h;     /* 42 */
-           unsigned char bytes_per_char_v;     /* 43 */
-           unsigned long pages_in_bank[4];     /* 44 */
-           unsigned long pages_in_vram;        /* 60 */
-           unsigned long initrd_start;         /* 64 */
-           unsigned long initrd_size;          /* 68 */
-           unsigned long rd_start;             /* 72 */
-           unsigned long system_rev;           /* 76 */
-           unsigned long system_serial_low;    /* 80 */
-           unsigned long system_serial_high;   /* 84 */
-           unsigned long mem_fclk_21285;       /* 88 */
-       } s;
-       char unused[256];
-    } u1;
-    union {
-       char paths[8][128];
-       struct {
-           unsigned long magic;
-           char n[1024 - sizeof(unsigned long)];
-       } s;
-    } u2;
-    char commandline[COMMAND_LINE_SIZE];
-};
-
-static struct tag * __init memtag(struct tag *tag, unsigned long start, unsigned long size)
-{
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_MEM;
-       tag->hdr.size = tag_size(tag_mem32);
-       tag->u.mem.size = size;
-       tag->u.mem.start = start;
-
-       return tag;
-}
-
-static void __init build_tag_list(struct param_struct *params, void *taglist)
-{
-       struct tag *tag = taglist;
-
-       if (params->u1.s.page_size != PAGE_SIZE) {
-               printk(KERN_WARNING "Warning: bad configuration page, "
-                      "trying to continue\n");
-               return;
-       }
-
-       printk(KERN_DEBUG "Converting old-style param struct to taglist\n");
-
-       tag->hdr.tag  = ATAG_CORE;
-       tag->hdr.size = tag_size(tag_core);
-       tag->u.core.flags = params->u1.s.flags & FLAG_READONLY;
-       tag->u.core.pagesize = params->u1.s.page_size;
-       tag->u.core.rootdev = params->u1.s.rootdev;
-
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_RAMDISK;
-       tag->hdr.size = tag_size(tag_ramdisk);
-       tag->u.ramdisk.flags = (params->u1.s.flags & FLAG_RDLOAD ? 1 : 0) |
-                              (params->u1.s.flags & FLAG_RDPROMPT ? 2 : 0);
-       tag->u.ramdisk.size  = params->u1.s.ramdisk_size;
-       tag->u.ramdisk.start = params->u1.s.rd_start;
-
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_INITRD;
-       tag->hdr.size = tag_size(tag_initrd);
-       tag->u.initrd.start = params->u1.s.initrd_start;
-       tag->u.initrd.size  = params->u1.s.initrd_size;
-
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_SERIAL;
-       tag->hdr.size = tag_size(tag_serialnr);
-       tag->u.serialnr.low = params->u1.s.system_serial_low;
-       tag->u.serialnr.high = params->u1.s.system_serial_high;
-
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_REVISION;
-       tag->hdr.size = tag_size(tag_revision);
-       tag->u.revision.rev = params->u1.s.system_rev;
-
-       tag = memtag(tag, PHYS_OFFSET, params->u1.s.nr_pages * PAGE_SIZE);
-
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_ACORN;
-       tag->hdr.size = tag_size(tag_acorn);
-       tag->u.acorn.memc_control_reg = params->u1.s.memc_control_reg;
-       tag->u.acorn.vram_pages       = params->u1.s.pages_in_vram;
-       tag->u.acorn.sounddefault     = params->u1.s.sounddefault;
-       tag->u.acorn.adfsdrives       = params->u1.s.adfsdrives;
-
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_CMDLINE;
-       tag->hdr.size = (strlen(params->commandline) + 3 +
-                        sizeof(struct tag_header)) >> 2;
-       strcpy(tag->u.cmdline.cmdline, params->commandline);
-
-       tag = tag_next(tag);
-       tag->hdr.tag = ATAG_NONE;
-       tag->hdr.size = 0;
-
-       memmove(params, taglist, ((int)tag) - ((int)taglist) +
-                                sizeof(struct tag_header));
-}
-
-void __init convert_to_tag_list(struct tag *tags)
-{
-       struct param_struct *params = (struct param_struct *)tags;
-       build_tag_list(params, &params->u2);
-}
-
-void __init squash_mem_tags(struct tag *tag)
-{
-       for (; tag->hdr.size; tag = tag_next(tag))
-               if (tag->hdr.tag == ATAG_MEM)
-                       tag->hdr.tag = ATAG_NONE;
-}
diff --git a/arch/arm26/kernel/dma.c b/arch/arm26/kernel/dma.c
deleted file mode 100644 (file)
index 80b5a77..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/dma.c
- *
- *  Copyright (C) 1995-2000 Russell King
- *                2003      Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Front-end to the DMA handling.  This handles the allocation/freeing
- *  of DMA channels, and provides a unified interface to the machines
- *  DMA facilities.
- */
-#include <linux/module.h>
-#include <linux/slab.h>
-#include <linux/sched.h>
-#include <linux/mman.h>
-#include <linux/init.h>
-#include <linux/spinlock.h>
-#include <linux/errno.h>
-
-#include <asm/dma.h>
-
-DEFINE_SPINLOCK(dma_spin_lock);
-
-static dma_t dma_chan[MAX_DMA_CHANNELS];
-
-/*
- * Get dma list for /proc/dma
- */
-int get_dma_list(char *buf)
-{
-       dma_t *dma;
-       char *p = buf;
-       int i;
-
-       for (i = 0, dma = dma_chan; i < MAX_DMA_CHANNELS; i++, dma++)
-               if (dma->lock)
-                       p += sprintf(p, "%2d: %14s %s\n", i,
-                                    dma->d_ops->type, dma->device_id);
-
-       return p - buf;
-}
-
-/*
- * Request DMA channel
- *
- * On certain platforms, we have to allocate an interrupt as well...
- */
-int request_dma(dmach_t channel, const char *device_id)
-{
-       dma_t *dma = dma_chan + channel;
-       int ret;
-
-       if (channel >= MAX_DMA_CHANNELS || !dma->d_ops)
-               goto bad_dma;
-
-       if (xchg(&dma->lock, 1) != 0)
-               goto busy;
-
-       dma->device_id = device_id;
-       dma->active    = 0;
-       dma->invalid   = 1;
-
-       ret = 0;
-       if (dma->d_ops->request)
-               ret = dma->d_ops->request(channel, dma);
-
-       if (ret)
-               xchg(&dma->lock, 0);
-
-       return ret;
-
-bad_dma:
-       printk(KERN_ERR "dma: trying to allocate DMA%d\n", channel);
-       return -EINVAL;
-
-busy:
-       return -EBUSY;
-}
-
-/*
- * Free DMA channel
- *
- * On certain platforms, we have to free interrupt as well...
- */
-void free_dma(dmach_t channel)
-{
-       dma_t *dma = dma_chan + channel;
-
-       if (channel >= MAX_DMA_CHANNELS || !dma->d_ops)
-               goto bad_dma;
-
-       if (dma->active) {
-               printk(KERN_ERR "dma%d: freeing active DMA\n", channel);
-               dma->d_ops->disable(channel, dma);
-               dma->active = 0;
-       }
-
-       if (xchg(&dma->lock, 0) != 0) {
-               if (dma->d_ops->free)
-                       dma->d_ops->free(channel, dma);
-               return;
-       }
-
-       printk(KERN_ERR "dma%d: trying to free free DMA\n", channel);
-       return;
-
-bad_dma:
-       printk(KERN_ERR "dma: trying to free DMA%d\n", channel);
-}
-
-/* Set DMA Scatter-Gather list
- */
-void set_dma_sg (dmach_t channel, struct scatterlist *sg, int nr_sg)
-{
-       dma_t *dma = dma_chan + channel;
-
-       if (dma->active)
-               printk(KERN_ERR "dma%d: altering DMA SG while "
-                      "DMA active\n", channel);
-
-       dma->sg = sg;
-       dma->sgcount = nr_sg;
-       dma->using_sg = 1;
-       dma->invalid = 1;
-}
-
-/* Set DMA address
- *
- * Copy address to the structure, and set the invalid bit
- */
-void set_dma_addr (dmach_t channel, unsigned long physaddr)
-{
-       dma_t *dma = dma_chan + channel;
-
-       if (dma->active)
-               printk(KERN_ERR "dma%d: altering DMA address while "
-                      "DMA active\n", channel);
-
-       dma->sg = &dma->buf;
-       dma->sgcount = 1;
-       dma->buf.__address = (char *)physaddr;//FIXME - not pretty
-       dma->using_sg = 0;
-       dma->invalid = 1;
-}
-
-/* Set DMA byte count
- *
- * Copy address to the structure, and set the invalid bit
- */
-void set_dma_count (dmach_t channel, unsigned long count)
-{
-       dma_t *dma = dma_chan + channel;
-
-       if (dma->active)
-               printk(KERN_ERR "dma%d: altering DMA count while "
-                      "DMA active\n", channel);
-
-       dma->sg = &dma->buf;
-       dma->sgcount = 1;
-       dma->buf.length = count;
-       dma->using_sg = 0;
-       dma->invalid = 1;
-}
-
-/* Set DMA direction mode
- */
-void set_dma_mode (dmach_t channel, dmamode_t mode)
-{
-       dma_t *dma = dma_chan + channel;
-
-       if (dma->active)
-               printk(KERN_ERR "dma%d: altering DMA mode while "
-                      "DMA active\n", channel);
-
-       dma->dma_mode = mode;
-       dma->invalid = 1;
-}
-
-/* Enable DMA channel
- */
-void enable_dma (dmach_t channel)
-{
-       dma_t *dma = dma_chan + channel;
-
-       if (!dma->lock)
-               goto free_dma;
-
-       if (dma->active == 0) {
-               dma->active = 1;
-               dma->d_ops->enable(channel, dma);
-       }
-       return;
-
-free_dma:
-       printk(KERN_ERR "dma%d: trying to enable free DMA\n", channel);
-       BUG();
-}
-
-/* Disable DMA channel
- */
-void disable_dma (dmach_t channel)
-{
-       dma_t *dma = dma_chan + channel;
-
-       if (!dma->lock)
-               goto free_dma;
-
-       if (dma->active == 1) {
-               dma->active = 0;
-               dma->d_ops->disable(channel, dma);
-       }
-       return;
-
-free_dma:
-       printk(KERN_ERR "dma%d: trying to disable free DMA\n", channel);
-       BUG();
-}
-
-/*
- * Is the specified DMA channel active?
- */
-int dma_channel_active(dmach_t channel)
-{
-       return dma_chan[channel].active;
-}
-
-void set_dma_page(dmach_t channel, char pagenr)
-{
-       printk(KERN_ERR "dma%d: trying to set_dma_page\n", channel);
-}
-
-void set_dma_speed(dmach_t channel, int cycle_ns)
-{
-       dma_t *dma = dma_chan + channel;
-       int ret = 0;
-
-       if (dma->d_ops->setspeed)
-               ret = dma->d_ops->setspeed(channel, dma, cycle_ns);
-       dma->speed = ret;
-}
-
-int get_dma_residue(dmach_t channel)
-{
-       dma_t *dma = dma_chan + channel;
-       int ret = 0;
-
-       if (dma->d_ops->residue)
-               ret = dma->d_ops->residue(channel, dma);
-
-       return ret;
-}
-
-void __init init_dma(void)
-{
-       arch_dma_init(dma_chan);
-}
-
-EXPORT_SYMBOL(request_dma);
-EXPORT_SYMBOL(free_dma);
-EXPORT_SYMBOL(enable_dma);
-EXPORT_SYMBOL(disable_dma);
-EXPORT_SYMBOL(set_dma_addr);
-EXPORT_SYMBOL(set_dma_count);
-EXPORT_SYMBOL(set_dma_mode);
-EXPORT_SYMBOL(set_dma_page);
-EXPORT_SYMBOL(get_dma_residue);
-EXPORT_SYMBOL(set_dma_sg);
-EXPORT_SYMBOL(set_dma_speed);
-
-EXPORT_SYMBOL(dma_spin_lock);
diff --git a/arch/arm26/kernel/ecard.c b/arch/arm26/kernel/ecard.c
deleted file mode 100644 (file)
index e2bcefc..0000000
+++ /dev/null
@@ -1,847 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/ecard.c
- *
- *  Copyright 1995-2001 Russell King
- *  Copyright 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Find all installed expansion cards, and handle interrupts from them.
- *
- *  Created from information from Acorns RiscOS3 PRMs
- *  15-Jun-2003 IM      Modified from ARM32 (RiscPC capable) version
- *  10-Jan-1999        RMK     Run loaders in a simulated RISC OS environment.
- *  06-May-1997        RMK     Added blacklist for cards whose loader doesn't work.
- *  12-Sep-1997        RMK     Created new handling of interrupt enables/disables
- *                     - cards can now register their own routine to control
- *                     interrupts (recommended).
- *  29-Sep-1997        RMK     Expansion card interrupt hardware not being re-enabled
- *                     on reset from Linux. (Caused cards not to respond
- *                     under RiscOS without hard reset).
- *
- */
-#define ECARD_C
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/sched.h>
-#include <linux/interrupt.h>
-#include <linux/reboot.h>
-#include <linux/mm.h>
-#include <linux/slab.h>
-#include <linux/proc_fs.h>
-#include <linux/device.h>
-#include <linux/init.h>
-
-#include <asm/dma.h>
-#include <asm/ecard.h>
-#include <asm/hardware.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/mmu_context.h>
-#include <asm/irqchip.h>
-#include <asm/tlbflush.h>
-
-enum req {
-       req_readbytes,
-       req_reset
-};
-
-struct ecard_request {
-       enum req        req;
-       ecard_t         *ec;
-       unsigned int    address;
-       unsigned int    length;
-       unsigned int    use_loader;
-       void            *buffer;
-};
-
-struct expcard_blacklist {
-       unsigned short   manufacturer;
-       unsigned short   product;
-       const char      *type;
-};
-
-static ecard_t *cards;
-static ecard_t *slot_to_expcard[MAX_ECARDS];
-static unsigned int ectcr;
-
-/* List of descriptions of cards which don't have an extended
- * identification, or chunk directories containing a description.
- */
-static struct expcard_blacklist __initdata blacklist[] = {
-       { MANU_ACORN, PROD_ACORN_ETHER1, "Acorn Ether1" }
-};
-
-asmlinkage extern int
-ecard_loader_reset(volatile unsigned char *pa, loader_t loader);
-asmlinkage extern int
-ecard_loader_read(int off, volatile unsigned char *pa, loader_t loader);
-
-static const struct ecard_id *
-ecard_match_device(const struct ecard_id *ids, struct expansion_card *ec);
-
-static inline unsigned short
-ecard_getu16(unsigned char *v)
-{
-       return v[0] | v[1] << 8;
-}
-
-static inline signed long
-ecard_gets24(unsigned char *v)
-{
-       return v[0] | v[1] << 8 | v[2] << 16 | ((v[2] & 0x80) ? 0xff000000 : 0);
-}
-
-static inline ecard_t *
-slot_to_ecard(unsigned int slot)
-{
-       return slot < MAX_ECARDS ? slot_to_expcard[slot] : NULL;
-}
-
-/* ===================== Expansion card daemon ======================== */
-/*
- * Since the loader programs on the expansion cards need to be run
- * in a specific environment, create a separate task with this
- * environment up, and pass requests to this task as and when we
- * need to.
- *
- * This should allow 99% of loaders to be called from Linux.
- *
- * From a security standpoint, we trust the card vendors.  This
- * may be a misplaced trust.
- */
-#define BUS_ADDR(x) ((((unsigned long)(x)) << 2) + IO_BASE)
-#define POD_INT_ADDR(x)        ((volatile unsigned char *)\
-                        ((BUS_ADDR((x)) - IO_BASE) + IO_START))
-
-static inline void ecard_task_reset(struct ecard_request *req)
-{
-       struct expansion_card *ec = req->ec;
-       if (ec->loader)
-               ecard_loader_reset(POD_INT_ADDR(ec->podaddr), ec->loader);
-}
-
-static void
-ecard_task_readbytes(struct ecard_request *req)
-{
-       unsigned char *buf = (unsigned char *)req->buffer;
-       volatile unsigned char *base_addr =
-               (volatile unsigned char *)POD_INT_ADDR(req->ec->podaddr);
-       unsigned int len = req->length;
-       unsigned int off = req->address;
-
-       if (!req->use_loader || !req->ec->loader) {
-               off *= 4;
-               while (len--) {
-                       *buf++ = base_addr[off];
-                       off += 4;
-               }
-       } else {
-               while(len--) {
-                       /*
-                        * The following is required by some
-                        * expansion card loader programs.
-                        */
-                       *(unsigned long *)0x108 = 0;
-                       *buf++ = ecard_loader_read(off++, base_addr,
-                                                  req->ec->loader);
-               }
-       }
-}
-
-static void ecard_do_request(struct ecard_request *req)
-{
-       switch (req->req) {
-       case req_readbytes:
-               ecard_task_readbytes(req);
-               break;
-
-       case req_reset:
-               ecard_task_reset(req);
-               break;
-       }
-}
-
-/*
- * On 26-bit processors, we don't need the kcardd thread to access the
- * expansion card loaders.  We do it directly.
- */
-#define ecard_call(req)        ecard_do_request(req)
-
-/* ======================= Mid-level card control ===================== */
-
-static void
-ecard_readbytes(void *addr, ecard_t *ec, int off, int len, int useld)
-{
-       struct ecard_request req;
-
-       req.req         = req_readbytes;
-       req.ec          = ec;
-       req.address     = off;
-       req.length      = len;
-       req.use_loader  = useld;
-       req.buffer      = addr;
-
-       ecard_call(&req);
-}
-
-int ecard_readchunk(struct in_chunk_dir *cd, ecard_t *ec, int id, int num)
-{
-       struct ex_chunk_dir excd;
-       int index = 16;
-       int useld = 0;
-
-       if (!ec->cid.cd)
-               return 0;
-
-       while(1) {
-               ecard_readbytes(&excd, ec, index, 8, useld);
-               index += 8;
-               if (c_id(&excd) == 0) {
-                       if (!useld && ec->loader) {
-                               useld = 1;
-                               index = 0;
-                               continue;
-                       }
-                       return 0;
-               }
-               if (c_id(&excd) == 0xf0) { /* link */
-                       index = c_start(&excd);
-                       continue;
-               }
-               if (c_id(&excd) == 0x80) { /* loader */
-                       if (!ec->loader) {
-                               ec->loader = kmalloc(c_len(&excd),
-                                                              GFP_KERNEL);
-                               if (ec->loader)
-                                       ecard_readbytes(ec->loader, ec,
-                                                       (int)c_start(&excd),
-                                                       c_len(&excd), useld);
-                               else
-                                       return 0;
-                       }
-                       continue;
-               }
-               if (c_id(&excd) == id && num-- == 0)
-                       break;
-       }
-
-       if (c_id(&excd) & 0x80) {
-               switch (c_id(&excd) & 0x70) {
-               case 0x70:
-                       ecard_readbytes((unsigned char *)excd.d.string, ec,
-                                       (int)c_start(&excd), c_len(&excd),
-                                       useld);
-                       break;
-               case 0x00:
-                       break;
-               }
-       }
-       cd->start_offset = c_start(&excd);
-       memcpy(cd->d.string, excd.d.string, 256);
-       return 1;
-}
-
-/* ======================= Interrupt control ============================ */
-
-static void ecard_def_irq_enable(ecard_t *ec, int irqnr)
-{
-}
-
-static void ecard_def_irq_disable(ecard_t *ec, int irqnr)
-{
-}
-
-static int ecard_def_irq_pending(ecard_t *ec)
-{
-       return !ec->irqmask || ec->irqaddr[0] & ec->irqmask;
-}
-
-static void ecard_def_fiq_enable(ecard_t *ec, int fiqnr)
-{
-       panic("ecard_def_fiq_enable called - impossible");
-}
-
-static void ecard_def_fiq_disable(ecard_t *ec, int fiqnr)
-{
-       panic("ecard_def_fiq_disable called - impossible");
-}
-
-static int ecard_def_fiq_pending(ecard_t *ec)
-{
-       return !ec->fiqmask || ec->fiqaddr[0] & ec->fiqmask;
-}
-
-static expansioncard_ops_t ecard_default_ops = {
-       ecard_def_irq_enable,
-       ecard_def_irq_disable,
-       ecard_def_irq_pending,
-       ecard_def_fiq_enable,
-       ecard_def_fiq_disable,
-       ecard_def_fiq_pending
-};
-
-/*
- * Enable and disable interrupts from expansion cards.
- * (interrupts are disabled for these functions).
- *
- * They are not meant to be called directly, but via enable/disable_irq.
- */
-static void ecard_irq_unmask(unsigned int irqnr)
-{
-       ecard_t *ec = slot_to_ecard(irqnr - 32);
-
-       if (ec) {
-               if (!ec->ops)
-                       ec->ops = &ecard_default_ops;
-
-               if (ec->claimed && ec->ops->irqenable)
-                       ec->ops->irqenable(ec, irqnr);
-               else
-                       printk(KERN_ERR "ecard: rejecting request to "
-                               "enable IRQs for %d\n", irqnr);
-       }
-}
-
-static void ecard_irq_mask(unsigned int irqnr)
-{
-       ecard_t *ec = slot_to_ecard(irqnr - 32);
-
-       if (ec) {
-               if (!ec->ops)
-                       ec->ops = &ecard_default_ops;
-
-               if (ec->ops && ec->ops->irqdisable)
-                       ec->ops->irqdisable(ec, irqnr);
-       }
-}
-
-static struct irqchip ecard_chip = {
-       .ack    = ecard_irq_mask,
-       .mask   = ecard_irq_mask,
-       .unmask = ecard_irq_unmask,
-};
-
-void ecard_enablefiq(unsigned int fiqnr)
-{
-       ecard_t *ec = slot_to_ecard(fiqnr);
-
-       if (ec) {
-               if (!ec->ops)
-                       ec->ops = &ecard_default_ops;
-
-               if (ec->claimed && ec->ops->fiqenable)
-                       ec->ops->fiqenable(ec, fiqnr);
-               else
-                       printk(KERN_ERR "ecard: rejecting request to "
-                               "enable FIQs for %d\n", fiqnr);
-       }
-}
-
-void ecard_disablefiq(unsigned int fiqnr)
-{
-       ecard_t *ec = slot_to_ecard(fiqnr);
-
-       if (ec) {
-               if (!ec->ops)
-                       ec->ops = &ecard_default_ops;
-
-               if (ec->ops->fiqdisable)
-                       ec->ops->fiqdisable(ec, fiqnr);
-       }
-}
-
-static void
-ecard_dump_irq_state(ecard_t *ec)
-{
-       printk("  %d: %sclaimed, ",
-              ec->slot_no,
-              ec->claimed ? "" : "not ");
-
-       if (ec->ops && ec->ops->irqpending &&
-           ec->ops != &ecard_default_ops)
-               printk("irq %spending\n",
-                      ec->ops->irqpending(ec) ? "" : "not ");
-       else
-               printk("irqaddr %p, mask = %02X, status = %02X\n",
-                      ec->irqaddr, ec->irqmask, *ec->irqaddr);
-}
-
-static void ecard_check_lockup(struct irqdesc *desc)
-{
-       static int last, lockup;
-       ecard_t *ec;
-
-       /*
-        * If the timer interrupt has not run since the last million
-        * unrecognised expansion card interrupts, then there is
-        * something seriously wrong.  Disable the expansion card
-        * interrupts so at least we can continue.
-        *
-        * Maybe we ought to start a timer to re-enable them some time
-        * later?
-        */
-       if (last == jiffies) {
-               lockup += 1;
-               if (lockup > 1000000) {
-                       printk(KERN_ERR "\nInterrupt lockup detected - "
-                              "disabling all expansion card interrupts\n");
-
-                       desc->chip->mask(IRQ_EXPANSIONCARD);
-
-                       printk("Expansion card IRQ state:\n");
-
-                       for (ec = cards; ec; ec = ec->next)
-                               ecard_dump_irq_state(ec);
-               }
-       } else
-               lockup = 0;
-
-       /*
-        * If we did not recognise the source of this interrupt,
-        * warn the user, but don't flood the user with these messages.
-        */
-       if (!last || time_after(jiffies, (unsigned long)(last + 5*HZ))) {
-               last = jiffies;
-               printk(KERN_WARNING "Unrecognised interrupt from backplane\n");
-       }
-}
-
-static void
-ecard_irq_handler(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
-{
-       ecard_t *ec;
-       int called = 0;
-
-       desc->chip->mask(irq);
-       for (ec = cards; ec; ec = ec->next) {
-               int pending;
-
-               if (!ec->claimed || ec->irq == NO_IRQ)
-                       continue;
-
-               if (ec->ops && ec->ops->irqpending)
-                       pending = ec->ops->irqpending(ec);
-               else
-                       pending = ecard_default_ops.irqpending(ec);
-
-               if (pending) {
-                       struct irqdesc *d = irq_desc + ec->irq;
-                       d->handle(ec->irq, d, regs);
-                       called ++;
-               }
-       }
-       desc->chip->unmask(irq);
-
-       if (called == 0)
-               ecard_check_lockup(desc);
-}
-
-#define ecard_irqexp_handler NULL
-#define ecard_probeirqhw() (0)
-
-unsigned int ecard_address(ecard_t *ec, card_type_t type, card_speed_t speed)
-{
-       unsigned long address = 0;
-       int slot = ec->slot_no;
-
-       ectcr &= ~(1 << slot);
-
-       switch (type) {
-       case ECARD_MEMC:
-               address = IO_EC_MEMC_BASE + (slot << 12);
-               break;
-
-       case ECARD_IOC:
-               address = IO_EC_IOC_BASE + (slot << 12) + (speed << 17);
-               break;
-
-       default:
-               break;
-       }
-
-       return address;
-}
-
-static int ecard_prints(char *buffer, ecard_t *ec)
-{
-       char *start = buffer;
-
-       buffer += sprintf(buffer, "  %d: ", ec->slot_no);
-
-       if (ec->cid.id == 0) {
-               struct in_chunk_dir incd;
-
-               buffer += sprintf(buffer, "[%04X:%04X] ",
-                       ec->cid.manufacturer, ec->cid.product);
-
-               if (!ec->card_desc && ec->cid.cd &&
-                   ecard_readchunk(&incd, ec, 0xf5, 0)) {
-                       ec->card_desc = kmalloc(strlen(incd.d.string)+1, GFP_KERNEL);
-
-                       if (ec->card_desc)
-                               strcpy((char *)ec->card_desc, incd.d.string);
-               }
-
-               buffer += sprintf(buffer, "%s\n", ec->card_desc ? ec->card_desc : "*unknown*");
-       } else
-               buffer += sprintf(buffer, "Simple card %d\n", ec->cid.id);
-
-       return buffer - start;
-}
-
-static int get_ecard_dev_info(char *buf, char **start, off_t pos, int count)
-{
-       ecard_t *ec = cards;
-       off_t at = 0;
-       int len, cnt;
-
-       cnt = 0;
-       while (ec && count > cnt) {
-               len = ecard_prints(buf, ec);
-               at += len;
-               if (at >= pos) {
-                       if (!*start) {
-                               *start = buf + (pos - (at - len));
-                               cnt = at - pos;
-                       } else
-                               cnt += len;
-                       buf += len;
-               }
-               ec = ec->next;
-       }
-       return (count > cnt) ? cnt : count;
-}
-
-static struct proc_dir_entry *proc_bus_ecard_dir = NULL;
-
-static void ecard_proc_init(void)
-{
-       proc_bus_ecard_dir = proc_mkdir("ecard", proc_bus);
-       create_proc_info_entry("devices", 0, proc_bus_ecard_dir,
-               get_ecard_dev_info);
-}
-
-#define ec_set_resource(ec,nr,st,sz,flg)                       \
-       do {                                                    \
-               (ec)->resource[nr].name = ec->dev.bus_id;       \
-               (ec)->resource[nr].start = st;                  \
-               (ec)->resource[nr].end = (st) + (sz) - 1;       \
-               (ec)->resource[nr].flags = flg;                 \
-       } while (0)
-
-static void __init ecard_init_resources(struct expansion_card *ec)
-{
-       unsigned long base = PODSLOT_IOC0_BASE;
-       unsigned int slot = ec->slot_no;
-       int i;
-
-       ec_set_resource(ec, ECARD_RES_MEMC,
-                       PODSLOT_MEMC_BASE + (slot << 14),
-                       PODSLOT_MEMC_SIZE, IORESOURCE_MEM);
-
-       for (i = 0; i < ECARD_RES_IOCSYNC - ECARD_RES_IOCSLOW; i++) {
-               ec_set_resource(ec, i + ECARD_RES_IOCSLOW,
-                               base + (slot << 14) + (i << 19),
-                               PODSLOT_IOC_SIZE, IORESOURCE_MEM);
-       }
-
-       for (i = 0; i < ECARD_NUM_RESOURCES; i++) {
-               if (ec->resource[i].start &&
-                   request_resource(&iomem_resource, &ec->resource[i])) {
-                       printk(KERN_ERR "%s: resource(s) not available\n",
-                               ec->dev.bus_id);
-                       ec->resource[i].end -= ec->resource[i].start;
-                       ec->resource[i].start = 0;
-               }
-       }
-}
-
-static ssize_t ecard_show_irq(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       return sprintf(buf, "%u\n", ec->irq);
-}
-
-static ssize_t ecard_show_vendor(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       return sprintf(buf, "%u\n", ec->cid.manufacturer);
-}
-
-static ssize_t ecard_show_device(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       return sprintf(buf, "%u\n", ec->cid.product);
-}
-
-static ssize_t ecard_show_dma(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       return sprintf(buf, "%u\n", ec->dma);
-}
-
-static ssize_t ecard_show_resources(struct device *dev, struct device_attribute *attr, char *buf)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       char *str = buf;
-       int i;
-
-       for (i = 0; i < ECARD_NUM_RESOURCES; i++)
-               str += sprintf(str, "%08lx %08lx %08lx\n",
-                               ec->resource[i].start,
-                               ec->resource[i].end,
-                               ec->resource[i].flags);
-
-       return str - buf;
-}
-
-static DEVICE_ATTR(irq, S_IRUGO, ecard_show_irq, NULL);
-static DEVICE_ATTR(vendor, S_IRUGO, ecard_show_vendor, NULL);
-static DEVICE_ATTR(device, S_IRUGO, ecard_show_device, NULL);
-static DEVICE_ATTR(dma, S_IRUGO, ecard_show_dma, NULL);
-static DEVICE_ATTR(resource, S_IRUGO, ecard_show_resources, NULL);
-
-/*
- * Probe for an expansion card.
- *
- * If bit 1 of the first byte of the card is set, then the
- * card does not exist.
- */
-static int __init
-ecard_probe(int slot, card_type_t type)
-{
-       ecard_t **ecp;
-       ecard_t *ec;
-       struct ex_ecid cid;
-       int i, rc = -ENOMEM;
-
-       ec = kzalloc(sizeof(ecard_t), GFP_KERNEL);
-       if (!ec)
-               goto nomem;
-
-       ec->slot_no     = slot;
-       ec->type        = type;
-       ec->irq         = NO_IRQ;
-       ec->fiq         = NO_IRQ;
-       ec->dma         = NO_DMA;
-       ec->card_desc   = NULL;
-       ec->ops         = &ecard_default_ops;
-
-       rc = -ENODEV;
-       if ((ec->podaddr = ecard_address(ec, type, ECARD_SYNC)) == 0)
-               goto nodev;
-
-       cid.r_zero = 1;
-       ecard_readbytes(&cid, ec, 0, 16, 0);
-       if (cid.r_zero)
-               goto nodev;
-
-       ec->cid.id      = cid.r_id;
-       ec->cid.cd      = cid.r_cd;
-       ec->cid.is      = cid.r_is;
-       ec->cid.w       = cid.r_w;
-       ec->cid.manufacturer = ecard_getu16(cid.r_manu);
-       ec->cid.product = ecard_getu16(cid.r_prod);
-       ec->cid.country = cid.r_country;
-       ec->cid.irqmask = cid.r_irqmask;
-       ec->cid.irqoff  = ecard_gets24(cid.r_irqoff);
-       ec->cid.fiqmask = cid.r_fiqmask;
-       ec->cid.fiqoff  = ecard_gets24(cid.r_fiqoff);
-       ec->fiqaddr     =
-       ec->irqaddr     = (unsigned char *)ioaddr(ec->podaddr);
-
-       if (ec->cid.is) {
-               ec->irqmask = ec->cid.irqmask;
-               ec->irqaddr += ec->cid.irqoff;
-               ec->fiqmask = ec->cid.fiqmask;
-               ec->fiqaddr += ec->cid.fiqoff;
-       } else {
-               ec->irqmask = 1;
-               ec->fiqmask = 4;
-       }
-
-       for (i = 0; i < ARRAY_SIZE(blacklist); i++)
-               if (blacklist[i].manufacturer == ec->cid.manufacturer &&
-                   blacklist[i].product == ec->cid.product) {
-                       ec->card_desc = blacklist[i].type;
-                       break;
-               }
-
-       snprintf(ec->dev.bus_id, sizeof(ec->dev.bus_id), "ecard%d", slot);
-       ec->dev.parent = NULL;
-       ec->dev.bus    = &ecard_bus_type;
-       ec->dev.dma_mask = &ec->dma_mask;
-       ec->dma_mask = (u64)0xffffffff;
-
-       ecard_init_resources(ec);
-
-       /*
-        * hook the interrupt handlers
-        */
-       ec->irq = 32 + slot;
-       set_irq_chip(ec->irq, &ecard_chip);
-       set_irq_handler(ec->irq, do_level_IRQ);
-       set_irq_flags(ec->irq, IRQF_VALID);
-
-       for (ecp = &cards; *ecp; ecp = &(*ecp)->next);
-
-       *ecp = ec;
-       slot_to_expcard[slot] = ec;
-
-       device_register(&ec->dev);
-       device_create_file(&ec->dev, &dev_attr_dma);
-       device_create_file(&ec->dev, &dev_attr_irq);
-       device_create_file(&ec->dev, &dev_attr_resource);
-       device_create_file(&ec->dev, &dev_attr_vendor);
-       device_create_file(&ec->dev, &dev_attr_device); 
-
-       return 0;
-
-nodev:
-       kfree(ec);
-nomem:
-       return rc;
-}
-
-/*
- * Initialise the expansion card system.
- * Locate all hardware - interrupt management and
- * actual cards.
- */
-static int __init ecard_init(void)
-{
-       int slot, irqhw;
-
-       printk("Probing expansion cards\n");
-
-       for (slot = 0; slot < MAX_ECARDS; slot ++) {
-               ecard_probe(slot, ECARD_IOC);
-       }
-
-       irqhw = ecard_probeirqhw();
-
-       set_irq_chained_handler(IRQ_EXPANSIONCARD,
-                               irqhw ? ecard_irqexp_handler : ecard_irq_handler);
-
-       ecard_proc_init();
-
-       return 0;
-}
-
-subsys_initcall(ecard_init);
-
-/*
- *     ECARD "bus"
- */
-static const struct ecard_id *
-ecard_match_device(const struct ecard_id *ids, struct expansion_card *ec)
-{
-       int i;
-
-       for (i = 0; ids[i].manufacturer != 65535; i++)
-               if (ec->cid.manufacturer == ids[i].manufacturer &&
-                   ec->cid.product == ids[i].product)
-                       return ids + i;
-
-       return NULL;
-}
-
-static int ecard_drv_probe(struct device *dev)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       struct ecard_driver *drv = ECARD_DRV(dev->driver);
-       const struct ecard_id *id;
-       int ret;
-
-       id = ecard_match_device(drv->id_table, ec);
-
-       ecard_claim(ec);
-       ret = drv->probe(ec, id);
-       if (ret)
-               ecard_release(ec);
-       return ret;
-}
-
-static int ecard_drv_remove(struct device *dev)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       struct ecard_driver *drv = ECARD_DRV(dev->driver);
-
-       drv->remove(ec);
-       ecard_release(ec);
-
-       return 0;
-}
-
-/*
- * Before rebooting, we must make sure that the expansion card is in a
- * sensible state, so it can be re-detected.  This means that the first
- * page of the ROM must be visible.  We call the expansion cards reset
- * handler, if any.
- */
-static void ecard_drv_shutdown(struct device *dev)
-{
-       struct expansion_card *ec = ECARD_DEV(dev);
-       struct ecard_driver *drv = ECARD_DRV(dev->driver);
-       struct ecard_request req;
-
-       if (drv->shutdown)
-               drv->shutdown(ec);
-       ecard_release(ec);
-       req.req = req_reset;
-       req.ec = ec;
-       ecard_call(&req);
-}
-
-int ecard_register_driver(struct ecard_driver *drv)
-{
-       drv->drv.bus = &ecard_bus_type;
-       drv->drv.probe = ecard_drv_probe;
-       drv->drv.remove = ecard_drv_remove;
-       drv->drv.shutdown = ecard_drv_shutdown;
-
-       return driver_register(&drv->drv);
-}
-
-void ecard_remove_driver(struct ecard_driver *drv)
-{
-       driver_unregister(&drv->drv);
-}
-
-static int ecard_match(struct device *_dev, struct device_driver *_drv)
-{
-       struct expansion_card *ec = ECARD_DEV(_dev);
-       struct ecard_driver *drv = ECARD_DRV(_drv);
-       int ret;
-
-       if (drv->id_table) {
-               ret = ecard_match_device(drv->id_table, ec) != NULL;
-       } else {
-               ret = ec->cid.id == drv->id;
-       }
-
-       return ret;
-}
-
-struct bus_type ecard_bus_type = {
-       .name   = "ecard",
-       .match  = ecard_match,
-};
-
-static int ecard_bus_init(void)
-{
-       return bus_register(&ecard_bus_type);
-}
-
-postcore_initcall(ecard_bus_init);
-
-EXPORT_SYMBOL(ecard_readchunk);
-EXPORT_SYMBOL(ecard_address);
-EXPORT_SYMBOL(ecard_register_driver);
-EXPORT_SYMBOL(ecard_remove_driver);
-EXPORT_SYMBOL(ecard_bus_type);
diff --git a/arch/arm26/kernel/entry.S b/arch/arm26/kernel/entry.S
deleted file mode 100644 (file)
index 91496cc..0000000
+++ /dev/null
@@ -1,951 +0,0 @@
-/* arch/arm26/kernel/entry.S
- * 
- * Assembled from chunks of code in arch/arm
- *
- * Copyright (C) 2003 Ian Molton
- * Based on the work of RMK.
- *
- */
-
-#include <linux/linkage.h>
-
-#include <asm/assembler.h>
-#include <asm/asm-offsets.h>
-#include <asm/errno.h>
-#include <asm/hardware.h>
-#include <asm/sysirq.h>
-#include <asm/thread_info.h>
-#include <asm/page.h>
-#include <asm/ptrace.h>
-
-       .macro  zero_fp
-#ifndef CONFIG_NO_FRAME_POINTER
-       mov     fp, #0
-#endif
-       .endm
-
-       .text
-
-@ Bad Abort numbers
-@ -----------------
-@
-#define BAD_PREFETCH   0
-#define BAD_DATA       1
-#define BAD_ADDREXCPTN 2
-#define BAD_IRQ                3
-#define BAD_UNDEFINSTR 4
-
-@ OS version number used in SWIs
-@  RISC OS is 0
-@  RISC iX is 8
-@
-#define OS_NUMBER      9
-#define ARMSWI_OFFSET  0x000f0000
-
-@
-@ Stack format (ensured by USER_* and SVC_*)
-@ PSR and PC are comined on arm26
-@
-
-#define S_OFF          8
-
-#define S_OLD_R0       64
-#define S_PC           60
-#define S_LR           56
-#define S_SP           52
-#define S_IP           48
-#define S_FP           44
-#define S_R10          40
-#define S_R9           36
-#define S_R8           32
-#define S_R7           28
-#define S_R6           24
-#define S_R5           20
-#define S_R4           16
-#define S_R3           12
-#define S_R2           8
-#define S_R1           4
-#define S_R0           0
-
-       .macro  save_user_regs
-       str     r0, [sp, #-4]!   @ Store SVC r0
-       str     lr, [sp, #-4]!   @ Store user mode PC
-       sub     sp, sp, #15*4
-       stmia   sp, {r0 - lr}^   @ Store the other user-mode regs
-       mov     r0, r0
-       .endm
-
-       .macro  slow_restore_user_regs
-       ldmia   sp, {r0 - lr}^   @ restore the user regs not including PC
-       mov     r0, r0
-       ldr     lr, [sp, #15*4]  @ get user PC
-       add     sp, sp, #15*4+8  @ free stack
-       movs    pc, lr           @ return
-       .endm
-
-       .macro  fast_restore_user_regs
-       add     sp, sp, #S_OFF
-       ldmib   sp, {r1 - lr}^
-       mov     r0, r0
-       ldr     lr, [sp, #15*4]
-       add     sp, sp, #15*4+8
-       movs    pc, lr
-       .endm
-
-       .macro  save_svc_regs
-       str     sp, [sp, #-16]!
-       str     lr, [sp, #8]
-       str     lr, [sp, #4]
-       stmfd   sp!, {r0 - r12}
-       mov     r0, #-1
-       str     r0, [sp, #S_OLD_R0]
-       zero_fp
-       .endm
-
-       .macro  save_svc_regs_irq
-       str     sp, [sp, #-16]!
-       str     lr, [sp, #4]
-       ldr     lr, .LCirq
-       ldr     lr, [lr]
-       str     lr, [sp, #8]
-       stmfd   sp!, {r0 - r12}
-       mov     r0, #-1
-       str     r0, [sp, #S_OLD_R0]
-       zero_fp
-       .endm
-
-       .macro  restore_svc_regs
-                ldmfd   sp, {r0 - pc}^
-       .endm
-
-       .macro  mask_pc, rd, rm
-       bic     \rd, \rm, #PCMASK
-       .endm
-
-       .macro  disable_irqs, temp
-       mov     \temp, pc
-       orr     \temp, \temp, #PSR_I_BIT
-       teqp    \temp, #0
-       .endm
-
-       .macro  enable_irqs, temp
-       mov     \temp, pc
-       and     \temp, \temp, #~PSR_I_BIT
-       teqp    \temp, #0
-       .endm
-
-       .macro  initialise_traps_extra
-       .endm
-
-       .macro  get_thread_info, rd
-       mov     \rd, sp, lsr #13
-       mov     \rd, \rd, lsl #13
-       .endm
-
-/*
- * These are the registers used in the syscall handler, and allow us to
- * have in theory up to 7 arguments to a function - r0 to r6.
- *
- * Note that tbl == why is intentional.
- *
- * We must set at least "tsk" and "why" when calling ret_with_reschedule.
- */
-scno   .req    r7              @ syscall number
-tbl    .req    r8              @ syscall table pointer
-why    .req    r8              @ Linux syscall (!= 0)
-tsk    .req    r9              @ current thread_info
-
-/*
- * Get the system call number.
- */
-       .macro  get_scno
-       mask_pc lr, lr
-       ldr     scno, [lr, #-4]         @ get SWI instruction
-       .endm
-/*
- *  -----------------------------------------------------------------------
- */
-
-/* 
- * We rely on the fact that R0 is at the bottom of the stack (due to
- * slow/fast restore user regs).
- */
-#if S_R0 != 0
-#error "Please fix"
-#endif
-
-/*
- * This is the fast syscall return path.  We do as little as
- * possible here, and this includes saving r0 back into the SVC
- * stack.
- */
-ret_fast_syscall:
-       disable_irqs r1                         @ disable interrupts
-       ldr     r1, [tsk, #TI_FLAGS]
-       tst     r1, #_TIF_WORK_MASK
-       bne     fast_work_pending
-       fast_restore_user_regs
-
-/*
- * Ok, we need to do extra processing, enter the slow path.
- */
-fast_work_pending:
-       str     r0, [sp, #S_R0+S_OFF]!          @ returned r0
-work_pending:
-       tst     r1, #_TIF_NEED_RESCHED
-       bne     work_resched
-       tst     r1, #_TIF_NOTIFY_RESUME | _TIF_SIGPENDING
-       beq     no_work_pending
-       mov     r0, sp                          @ 'regs'
-       mov     r2, why                         @ 'syscall'
-       bl      do_notify_resume
-       disable_irqs r1                         @ disable interrupts
-       b       no_work_pending
-
-work_resched:
-       bl      schedule
-/*
- * "slow" syscall return path.  "why" tells us if this was a real syscall.
- */
-ENTRY(ret_to_user)
-ret_slow_syscall:
-       disable_irqs r1                         @ disable interrupts
-       ldr     r1, [tsk, #TI_FLAGS]
-       tst     r1, #_TIF_WORK_MASK
-       bne     work_pending
-no_work_pending:
-       slow_restore_user_regs
-
-/*
- * This is how we return from a fork.
- */
-ENTRY(ret_from_fork)
-       bl      schedule_tail
-       get_thread_info tsk
-       ldr     r1, [tsk, #TI_FLAGS]            @ check for syscall tracing
-       mov     why, #1
-       tst     r1, #_TIF_SYSCALL_TRACE         @ are we tracing syscalls?
-       beq     ret_slow_syscall
-       mov     r1, sp
-       mov     r0, #1                          @ trace exit [IP = 1]
-       bl      syscall_trace
-       b       ret_slow_syscall
-       
-// FIXME - is this strictly necessary?
-#include "calls.S"
-
-/*=============================================================================
- * SWI handler
- *-----------------------------------------------------------------------------
- */
-
-       .align  5
-ENTRY(vector_swi)
-       save_user_regs
-       zero_fp
-       get_scno
-
-       enable_irqs ip
-
-       str     r4, [sp, #-S_OFF]!              @ push fifth arg
-
-       get_thread_info tsk
-       ldr     ip, [tsk, #TI_FLAGS]            @ check for syscall tracing
-       bic     scno, scno, #0xff000000         @ mask off SWI op-code
-       eor     scno, scno, #OS_NUMBER << 20    @ check OS number
-       adr     tbl, sys_call_table             @ load syscall table pointer
-       tst     ip, #_TIF_SYSCALL_TRACE         @ are we tracing syscalls?
-       bne     __sys_trace
-
-       adral   lr, ret_fast_syscall            @ set return address
-        orral  lr, lr, #PSR_I_BIT | MODE_SVC26 @ Force SVC mode on return
-       cmp     scno, #NR_syscalls              @ check upper syscall limit
-       ldrcc   pc, [tbl, scno, lsl #2]         @ call sys_* routine
-
-       add     r1, sp, #S_OFF
-2:     mov     why, #0                         @ no longer a real syscall
-       cmp     scno, #ARMSWI_OFFSET
-       eor     r0, scno, #OS_NUMBER << 20      @ put OS number back
-       bcs     arm_syscall     
-       b       sys_ni_syscall                  @ not private func
-
-       /*
-        * This is the really slow path.  We're going to be doing
-        * context switches, and waiting for our parent to respond.
-        */
-__sys_trace:
-       add     r1, sp, #S_OFF
-       mov     r0, #0                          @ trace entry [IP = 0]
-       bl      syscall_trace
-
-       adral   lr, __sys_trace_return          @ set return address
-        orral   lr, lr, #PSR_I_BIT | MODE_SVC26 @ Force SVC mode on return
-       add     r1, sp, #S_R0 + S_OFF           @ pointer to regs
-       cmp     scno, #NR_syscalls              @ check upper syscall limit
-       ldmccia r1, {r0 - r3}                   @ have to reload r0 - r3
-       ldrcc   pc, [tbl, scno, lsl #2]         @ call sys_* routine
-       b       2b
-
-__sys_trace_return:
-       str     r0, [sp, #S_R0 + S_OFF]!        @ save returned r0
-       mov     r1, sp
-       mov     r0, #1                          @ trace exit [IP = 1]
-       bl      syscall_trace
-       b       ret_slow_syscall
-
-       .align  5
-
-       .type   sys_call_table, #object
-ENTRY(sys_call_table)
-#include "calls.S"
-
-/*============================================================================
- * Special system call wrappers
- */
-@ r0 = syscall number
-@ r5 = syscall table
-               .type   sys_syscall, #function
-sys_syscall:
-               eor     scno, r0, #OS_NUMBER << 20
-               cmp     scno, #NR_syscalls      @ check range
-               stmleia sp, {r5, r6}            @ shuffle args
-               movle   r0, r1
-               movle   r1, r2
-               movle   r2, r3
-               movle   r3, r4
-               ldrle   pc, [tbl, scno, lsl #2]
-               b       sys_ni_syscall
-
-sys_fork_wrapper:
-               add     r0, sp, #S_OFF
-               b       sys_fork
-
-sys_vfork_wrapper:
-               add     r0, sp, #S_OFF
-               b       sys_vfork
-
-sys_execve_wrapper:
-               add     r3, sp, #S_OFF
-               b       sys_execve
-
-sys_clone_wapper:
-               add     r2, sp, #S_OFF
-               b       sys_clone
-
-sys_sigsuspend_wrapper:
-               add     r3, sp, #S_OFF
-               b       sys_sigsuspend
-
-sys_rt_sigsuspend_wrapper:
-               add     r2, sp, #S_OFF
-               b       sys_rt_sigsuspend
-
-sys_sigreturn_wrapper:
-               add     r0, sp, #S_OFF
-               b       sys_sigreturn
-
-sys_rt_sigreturn_wrapper:
-               add     r0, sp, #S_OFF
-               b       sys_rt_sigreturn
-
-sys_sigaltstack_wrapper:
-               ldr     r2, [sp, #S_OFF + S_SP]
-               b       do_sigaltstack
-
-/*
- * Note: off_4k (r5) is always units of 4K.  If we can't do the requested
- * offset, we return EINVAL.  FIXME - this lost some stuff from arm32 to
- * ifdefs. check it out.
- */
-sys_mmap2:
-               tst     r5, #((1 << (PAGE_SHIFT - 12)) - 1)
-               moveq   r5, r5, lsr #PAGE_SHIFT - 12
-               streq   r5, [sp, #4]
-               beq     do_mmap2
-               mov     r0, #-EINVAL
-               RETINSTR(mov,pc, lr)
-
-/*
- *  Design issues:
- *   - We have several modes that each vector can be called from,
- *     each with its own set of registers.  On entry to any vector,
- *     we *must* save the registers used in *that* mode.
- *
- *   - This code must be as fast as possible.
- *
- *  There are a few restrictions on the vectors:
- *   - the SWI vector cannot be called from *any* non-user mode
- *
- *   - the FP emulator is *never* called from *any* non-user mode undefined
- *     instruction.
- *
- */
-
-               .text
-
-               .macro handle_irq
-1:             mov     r4, #IOC_BASE
-               ldrb    r6, [r4, #0x24]            @ get high priority first
-               adr     r5, irq_prio_h
-               teq     r6, #0
-               ldreqb  r6, [r4, #0x14]            @ get low priority
-               adreq   r5, irq_prio_l
-
-                teq     r6, #0                     @ If an IRQ happened...
-                ldrneb  r0, [r5, r6]               @ get IRQ number
-                movne   r1, sp                     @ get struct pt_regs
-                adrne   lr, 1b                     @ Set return address to 1b
-                orrne   lr, lr, #PSR_I_BIT | MODE_SVC26  @ (and force SVC mode)
-                bne     asm_do_IRQ                 @ process IRQ (if asserted)
-               .endm
-
-
-/*
- * Interrupt table (incorporates priority)
- */
-               .macro  irq_prio_table
-irq_prio_l:    .byte    0, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
-               .byte    4, 0, 1, 0, 2, 2, 2, 2, 3, 3, 3, 3, 3, 3, 3, 3
-               .byte    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
-               .byte    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
-               .byte    6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
-               .byte    6, 6, 6, 6, 6, 6, 6, 6, 3, 3, 3, 3, 3, 3, 3, 3
-               .byte    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
-               .byte    5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-               .byte    7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7
-irq_prio_h:    .byte    0, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   12, 8, 9, 8,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   14,14,14,14,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   15,15,15,15,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .byte   13,13,13,13,10,10,10,10,11,11,11,11,10,10,10,10
-               .endm
-
-#if 1
-/*
- * Uncomment these if you wish to get more debugging into about data aborts.
- * FIXME - I bet we can find a way to encode these and keep performance.
- */
-#define FAULT_CODE_LDRSTRPOST  0x80
-#define FAULT_CODE_LDRSTRPRE   0x40
-#define FAULT_CODE_LDRSTRREG   0x20
-#define FAULT_CODE_LDMSTM      0x10
-#define FAULT_CODE_LDCSTC      0x08
-#endif
-#define FAULT_CODE_PREFETCH    0x04
-#define FAULT_CODE_WRITE       0x02
-#define FAULT_CODE_FORCECOW    0x01
-
-/*=============================================================================
- * Undefined FIQs
- *-----------------------------------------------------------------------------
- */
-_unexp_fiq:    ldr     sp, .LCfiq
-               mov     r12, #IOC_BASE
-               strb    r12, [r12, #0x38]       @ Disable FIQ register
-               teqp    pc, #PSR_I_BIT | PSR_F_BIT | MODE_SVC26
-               mov     r0, r0
-               stmfd   sp!, {r0 - r3, ip, lr}
-               adr     r0, Lfiqmsg
-               bl      printk
-               ldmfd   sp!, {r0 - r3, ip, lr}
-               teqp    pc, #PSR_I_BIT | PSR_F_BIT | MODE_FIQ26
-               mov     r0, r0
-               movs    pc, lr
-
-Lfiqmsg:       .ascii  "*** Unexpected FIQ\n\0"
-               .align
-
-.LCfiq:                .word   __temp_fiq
-.LCirq:                .word   __temp_irq
-
-/*=============================================================================
- * Undefined instruction handler
- *-----------------------------------------------------------------------------
- * Handles floating point instructions
- */
-vector_undefinstr:
-               tst     lr, #MODE_SVC26          @ did we come from a non-user mode?
-               bne     __und_svc                @ yes - deal with it.
-/* Otherwise, fall through for the user-space (common) case. */
-               save_user_regs
-               zero_fp                                 @ zero frame pointer
-               teqp    pc, #PSR_I_BIT | MODE_SVC26     @ disable IRQs
-.Lbug_undef:
-               ldr     r4, .LC2
-                ldr     pc, [r4]         @ Call FP module entry point
-/* FIXME - should we trap for a null pointer here? */
-
-/* The SVC mode case */
-__und_svc:     save_svc_regs                           @ Non-user mode
-                mask_pc r0, lr
-                and     r2, lr, #3
-                sub     r0, r0, #4
-                mov     r1, sp
-                bl      do_undefinstr
-                restore_svc_regs
-
-/* We get here if the FP emulator doesnt handle the undef instr.
- * If the insn WAS handled, the emulator jumps to ret_from_exception by itself/
- */
-               .globl  fpundefinstr 
-fpundefinstr:
-               mov     r0, lr
-               mov     r1, sp
-               teqp    pc, #MODE_SVC26
-               bl      do_undefinstr
-               b       ret_from_exception              @ Normal FP exit
-
-#if defined CONFIG_FPE_NWFPE || defined CONFIG_FPE_FASTFPE
-               /* The FPE is always present */
-               .equ    fpe_not_present, 0
-#else
-/* We get here if an undefined instruction happens and the floating
- * point emulator is not present.  If the offending instruction was
- * a WFS, we just perform a normal return as if we had emulated the
- * operation.  This is a hack to allow some basic userland binaries
- * to run so that the emulator module proper can be loaded. --philb
- * FIXME - probably a broken useless hack...
- */
-fpe_not_present:
-               adr     r10, wfs_mask_data
-               ldmia   r10, {r4, r5, r6, r7, r8}
-               ldr     r10, [sp, #S_PC]                @ Load PC
-               sub     r10, r10, #4
-               mask_pc r10, r10
-               ldrt    r10, [r10]                      @ get instruction
-               and     r5, r10, r5
-               teq     r5, r4                          @ Is it WFS?
-               beq     ret_from_exception
-               and     r5, r10, r8
-               teq     r5, r6                          @ Is it LDF/STF on sp or fp?
-               teqne   r5, r7
-               bne     fpundefinstr
-               tst     r10, #0x00200000                @ Does it have WB
-               beq     ret_from_exception
-               and     r4, r10, #255                   @ get offset
-               and     r6, r10, #0x000f0000
-               tst     r10, #0x00800000                @ +/-
-               ldr     r5, [sp, r6, lsr #14]           @ Load reg
-               rsbeq   r4, r4, #0
-               add     r5, r5, r4, lsl #2
-               str     r5, [sp, r6, lsr #14]           @ Save reg
-               b       ret_from_exception
-
-wfs_mask_data: .word   0x0e200110                      @ WFS/RFS
-               .word   0x0fef0fff
-               .word   0x0d0d0100                      @ LDF [sp]/STF [sp]
-               .word   0x0d0b0100                      @ LDF [fp]/STF [fp]
-               .word   0x0f0f0f00
-#endif
-
-.LC2:          .word   fp_enter
-
-/*=============================================================================
- * Prefetch abort handler
- *-----------------------------------------------------------------------------
- */
-#define DEBUG_UNDEF
-/* remember: lr = USR pc */
-vector_prefetch:
-               sub     lr, lr, #4
-               tst     lr, #MODE_SVC26
-               bne     __pabt_invalid
-               save_user_regs
-               teqp    pc, #MODE_SVC26         @ Enable IRQs...
-               mask_pc r0, lr                  @ Address of abort
-               mov     r1, sp                  @ Tasks registers
-               bl      do_PrefetchAbort
-               teq     r0, #0                  @ If non-zero, we believe this abort..
-               bne     ret_from_exception
-#ifdef DEBUG_UNDEF
-               adr     r0, t
-               bl      printk
-#endif
-               ldr     lr, [sp,#S_PC]          @ FIXME program to test this on.  I think its
-               b       .Lbug_undef             @ broken at the moment though!)
-
-__pabt_invalid:        save_svc_regs
-               mov     r0, sp                  @ Prefetch aborts are definitely *not*
-               mov     r1, #BAD_PREFETCH       @ allowed in non-user modes.  We cant
-               and     r2, lr, #3              @ recover from this problem.
-               b       bad_mode
-
-#ifdef DEBUG_UNDEF
-t:             .ascii "*** undef ***\r\n\0"
-               .align
-#endif
-
-/*=============================================================================
- * Address exception handler
- *-----------------------------------------------------------------------------
- * These aren't too critical.
- * (they're not supposed to happen).
- * In order to debug the reason for address exceptions in non-user modes,
- * we have to obtain all the registers so that we can see what's going on.
- */
-
-vector_addrexcptn:
-               sub     lr, lr, #8
-               tst     lr, #3
-               bne     Laddrexcptn_not_user
-               save_user_regs
-               teq     pc, #MODE_SVC26
-               mask_pc r0, lr                  @ Point to instruction
-               mov     r1, sp                  @ Point to registers
-               mov     r2, #0x400
-               mov     lr, pc
-               bl      do_excpt
-               b       ret_from_exception
-
-Laddrexcptn_not_user:
-               save_svc_regs
-               and     r2, lr, #3
-               teq     r2, #3
-               bne     Laddrexcptn_illegal_mode
-               teqp    pc, #MODE_SVC26
-               mask_pc r0, lr
-               mov     r1, sp
-               orr     r2, r2, #0x400
-               bl      do_excpt
-               ldmia   sp, {r0 - lr}           @ I cant remember the reason I changed this...
-               add     sp, sp, #15*4
-               movs    pc, lr
-
-Laddrexcptn_illegal_mode:
-               mov     r0, sp
-               str     lr, [sp, #-4]!
-               orr     r1, r2, #PSR_I_BIT | PSR_F_BIT
-               teqp    r1, #0                  @ change into mode (wont be user mode)
-               mov     r0, r0
-               mov     r1, r8                  @ Any register from r8 - r14 can be banked
-               mov     r2, r9
-               mov     r3, r10
-               mov     r4, r11
-               mov     r5, r12
-               mov     r6, r13
-               mov     r7, r14
-               teqp    pc, #PSR_F_BIT | MODE_SVC26 @ back to svc
-               mov     r0, r0
-               stmfd   sp!, {r1-r7}
-               ldmia   r0, {r0-r7}
-               stmfd   sp!, {r0-r7}
-               mov     r0, sp
-               mov     r1, #BAD_ADDREXCPTN
-               b       bad_mode
-
-/*=============================================================================
- * Interrupt (IRQ) handler
- *-----------------------------------------------------------------------------
- * Note: if the IRQ was taken whilst in user mode, then *no* kernel routine
- * is running, so do not have to save svc lr.
- *
- * Entered in IRQ mode.
- */
-
-vector_IRQ:    ldr     sp, .LCirq         @ Setup some temporary stack
-                sub     lr, lr, #4
-                str     lr, [sp]           @ push return address
-
-               tst     lr, #3
-               bne     __irq_non_usr
-
-__irq_usr:     teqp    pc, #PSR_I_BIT | MODE_SVC26     @ Enter SVC mode
-               mov     r0, r0
-
-               ldr     lr, .LCirq
-               ldr     lr, [lr]           @ Restore lr for jump back to USR
-
-               save_user_regs
-
-               handle_irq
-
-               mov     why, #0
-               get_thread_info tsk
-               b       ret_to_user
-
-@ Place the IRQ priority table here so that the handle_irq macros above
-@ and below here can access it.
-
-               irq_prio_table
-
-__irq_non_usr: teqp    pc, #PSR_I_BIT | MODE_SVC26     @ Enter SVC mode
-               mov     r0, r0
-
-               save_svc_regs_irq
-
-                and    r2, lr, #3
-               teq     r2, #3
-               bne     __irq_invalid                @ IRQ not from SVC mode
-
-               handle_irq
-
-               restore_svc_regs
-
-__irq_invalid: mov     r0, sp
-               mov     r1, #BAD_IRQ
-               b       bad_mode
-
-/*=============================================================================
- * Data abort handler code
- *-----------------------------------------------------------------------------
- *
- * This handles both exceptions from user and SVC modes, computes the address
- *  range of the problem, and does any correction that is required.  It then
- *  calls the kernel data abort routine.
- *
- * This is where I wish that the ARM would tell you which address aborted.
- */
-
-vector_data:   sub     lr, lr, #8              @ Correct lr
-               tst     lr, #3
-               bne     Ldata_not_user
-               save_user_regs
-               teqp    pc, #MODE_SVC26
-               mask_pc r0, lr
-               bl      Ldata_do
-               b       ret_from_exception
-
-Ldata_not_user:
-               save_svc_regs
-               and     r2, lr, #3
-               teq     r2, #3
-               bne     Ldata_illegal_mode
-               tst     lr, #PSR_I_BIT
-               teqeqp  pc, #MODE_SVC26
-               mask_pc r0, lr
-               bl      Ldata_do
-               restore_svc_regs
-
-Ldata_illegal_mode:
-               mov     r0, sp
-               mov     r1, #BAD_DATA
-               b       bad_mode
-
-Ldata_do:      mov     r3, sp
-               ldr     r4, [r0]                @ Get instruction
-               mov     r2, #0
-               tst     r4, #1 << 20            @ Check to see if it is a write instruction
-               orreq   r2, r2, #FAULT_CODE_WRITE @ Indicate write instruction
-               mov     r1, r4, lsr #22         @ Now branch to the relevent processing routine
-               and     r1, r1, #15 << 2
-               add     pc, pc, r1
-               movs    pc, lr
-               b       Ldata_unknown
-               b       Ldata_unknown
-               b       Ldata_unknown
-               b       Ldata_unknown
-               b       Ldata_ldrstr_post       @ ldr   rd, [rn], #m
-               b       Ldata_ldrstr_numindex   @ ldr   rd, [rn, #m]    @ RegVal
-               b       Ldata_ldrstr_post       @ ldr   rd, [rn], rm
-               b       Ldata_ldrstr_regindex   @ ldr   rd, [rn, rm]
-               b       Ldata_ldmstm            @ ldm*a rn, <rlist>
-               b       Ldata_ldmstm            @ ldm*b rn, <rlist>
-               b       Ldata_unknown
-               b       Ldata_unknown
-               b       Ldata_ldrstr_post       @ ldc   rd, [rn], #m    @ Same as ldr   rd, [rn], #m
-               b       Ldata_ldcstc_pre        @ ldc   rd, [rn, #m]
-               b       Ldata_unknown
-Ldata_unknown: @ Part of jumptable
-               mov     r0, r1
-               mov     r1, r4
-               mov     r2, r3
-               b       baddataabort
-
-Ldata_ldrstr_post:
-               mov     r0, r4, lsr #14         @ Get Rn
-               and     r0, r0, #15 << 2        @ Mask out reg.
-               teq     r0, #15 << 2
-               ldr     r0, [r3, r0]            @ Get register
-               biceq   r0, r0, #PCMASK
-               mov     r1, r0
-#ifdef FAULT_CODE_LDRSTRPOST
-               orr     r2, r2, #FAULT_CODE_LDRSTRPOST
-#endif
-               b       do_DataAbort
-
-Ldata_ldrstr_numindex:
-               mov     r0, r4, lsr #14         @ Get Rn
-               and     r0, r0, #15 << 2        @ Mask out reg.
-               teq     r0, #15 << 2
-               ldr     r0, [r3, r0]            @ Get register
-               mov     r1, r4, lsl #20
-               biceq   r0, r0, #PCMASK
-               tst     r4, #1 << 23
-               addne   r0, r0, r1, lsr #20
-               subeq   r0, r0, r1, lsr #20
-               mov     r1, r0
-#ifdef FAULT_CODE_LDRSTRPRE
-               orr     r2, r2, #FAULT_CODE_LDRSTRPRE
-#endif
-               b       do_DataAbort
-
-Ldata_ldrstr_regindex:
-               mov     r0, r4, lsr #14         @ Get Rn
-               and     r0, r0, #15 << 2        @ Mask out reg.
-               teq     r0, #15 << 2
-               ldr     r0, [r3, r0]            @ Get register
-               and     r7, r4, #15
-               biceq   r0, r0, #PCMASK
-               teq     r7, #15                 @ Check for PC
-               ldr     r7, [r3, r7, lsl #2]    @ Get Rm
-               and     r8, r4, #0x60           @ Get shift types
-               biceq   r7, r7, #PCMASK
-               mov     r9, r4, lsr #7          @ Get shift amount
-               and     r9, r9, #31
-               teq     r8, #0
-               moveq   r7, r7, lsl r9
-               teq     r8, #0x20               @ LSR shift
-               moveq   r7, r7, lsr r9
-               teq     r8, #0x40               @ ASR shift
-               moveq   r7, r7, asr r9
-               teq     r8, #0x60               @ ROR shift
-               moveq   r7, r7, ror r9
-               tst     r4, #1 << 23
-               addne   r0, r0, r7
-               subeq   r0, r0, r7              @ Apply correction
-               mov     r1, r0
-#ifdef FAULT_CODE_LDRSTRREG
-               orr     r2, r2, #FAULT_CODE_LDRSTRREG
-#endif
-               b       do_DataAbort
-
-Ldata_ldmstm:
-               mov     r7, #0x11
-               orr     r7, r7, r7, lsl #8
-               and     r0, r4, r7
-               and     r1, r4, r7, lsl #1
-               add     r0, r0, r1, lsr #1
-               and     r1, r4, r7, lsl #2
-               add     r0, r0, r1, lsr #2
-               and     r1, r4, r7, lsl #3
-               add     r0, r0, r1, lsr #3
-               add     r0, r0, r0, lsr #8
-               add     r0, r0, r0, lsr #4
-               and     r7, r0, #15             @ r7 = no. of registers to transfer.
-               mov     r5, r4, lsr #14         @ Get Rn
-               and     r5, r5, #15 << 2
-               ldr     r0, [r3, r5]            @ Get reg
-               eor     r6, r4, r4, lsl #2
-               tst     r6, #1 << 23            @ Check inc/dec ^ writeback
-               rsbeq   r7, r7, #0
-               add     r7, r0, r7, lsl #2      @ Do correction (signed)
-               subne   r1, r7, #1
-               subeq   r1, r0, #1
-               moveq   r0, r7
-               tst     r4, #1 << 21            @ Check writeback
-               strne   r7, [r3, r5]
-               eor     r6, r4, r4, lsl #1
-               tst     r6, #1 << 24            @ Check Pre/Post ^ inc/dec
-               addeq   r0, r0, #4
-               addeq   r1, r1, #4
-               teq     r5, #15*4               @ CHECK FOR PC
-               biceq   r1, r1, #PCMASK
-               biceq   r0, r0, #PCMASK
-#ifdef FAULT_CODE_LDMSTM
-               orr     r2, r2, #FAULT_CODE_LDMSTM
-#endif
-               b       do_DataAbort
-
-Ldata_ldcstc_pre:
-               mov     r0, r4, lsr #14         @ Get Rn
-               and     r0, r0, #15 << 2        @ Mask out reg.
-               teq     r0, #15 << 2
-               ldr     r0, [r3, r0]            @ Get register
-               mov     r1, r4, lsl #24         @ Get offset
-               biceq   r0, r0, #PCMASK
-               tst     r4, #1 << 23
-               addne   r0, r0, r1, lsr #24
-               subeq   r0, r0, r1, lsr #24
-               mov     r1, r0
-#ifdef FAULT_CODE_LDCSTC
-               orr     r2, r2, #FAULT_CODE_LDCSTC
-#endif
-               b       do_DataAbort
-
-
-/*
- * This is the return code to user mode for abort handlers
- */
-ENTRY(ret_from_exception)
-               get_thread_info tsk
-               mov     why, #0
-               b       ret_to_user
-
-               .data
-ENTRY(fp_enter)
-               .word   fpe_not_present
-               .text
-/*
- * Register switch for older 26-bit only ARMs
- */
-ENTRY(__switch_to)
-               add     r0, r0, #TI_CPU_SAVE
-               stmia   r0, {r4 - sl, fp, sp, lr}
-               add     r1, r1, #TI_CPU_SAVE
-               ldmia   r1, {r4 - sl, fp, sp, pc}^
-
-/*
- *=============================================================================
- *             Low-level interface code
- *-----------------------------------------------------------------------------
- *             Trap initialisation
- *-----------------------------------------------------------------------------
- *
- * Note - FIQ code has changed.  The default is a couple of words in 0x1c, 0x20
- * that call _unexp_fiq.  Nowever, we now copy the FIQ routine to 0x1c (removes
- * some excess cycles).
- *
- * What we need to put into 0-0x1c are branches to branch to the kernel.
- */
-
-               .section ".init.text",#alloc,#execinstr
-
-.Ljump_addresses:
-               swi     SYS_ERROR0
-               .word   vector_undefinstr       - 12
-               .word   vector_swi              - 16
-               .word   vector_prefetch         - 20
-               .word   vector_data             - 24
-               .word   vector_addrexcptn       - 28
-               .word   vector_IRQ              - 32
-               .word   _unexp_fiq              - 36
-               b       . + 8
-/*
- * initialise the trap system
- */
-ENTRY(__trap_init)
-               stmfd   sp!, {r4 - r7, lr}
-               adr     r1, .Ljump_addresses
-               ldmia   r1, {r1 - r7, ip, lr}
-               orr     r2, lr, r2, lsr #2
-               orr     r3, lr, r3, lsr #2
-               orr     r4, lr, r4, lsr #2
-               orr     r5, lr, r5, lsr #2
-               orr     r6, lr, r6, lsr #2
-               orr     r7, lr, r7, lsr #2
-               orr     ip, lr, ip, lsr #2
-               mov     r0, #0
-               stmia   r0, {r1 - r7, ip}
-               ldmfd   sp!, {r4 - r7, pc}^
-
-               .bss
-__temp_irq:    .space  4                               @ saved lr_irq
-__temp_fiq:    .space  128
diff --git a/arch/arm26/kernel/fiq.c b/arch/arm26/kernel/fiq.c
deleted file mode 100644 (file)
index c4776c9..0000000
+++ /dev/null
@@ -1,201 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/fiq.c
- *
- *  Copyright (C) 1998 Russell King
- *  Copyright (C) 1998, 1999 Phil Blundell
- *  Copyright (C) 2003 Ian Molton
- *
- *  FIQ support written by Philip Blundell <philb@gnu.org>, 1998.
- *
- *  FIQ support re-written by Russell King to be more generic
- *
- * We now properly support a method by which the FIQ handlers can
- * be stacked onto the vector.  We still do not support sharing
- * the FIQ vector itself.
- *
- * Operation is as follows:
- *  1. Owner A claims FIQ:
- *     - default_fiq relinquishes control.
- *  2. Owner A:
- *     - inserts code.
- *     - sets any registers,
- *     - enables FIQ.
- *  3. Owner B claims FIQ:
- *     - if owner A has a relinquish function.
- *       - disable FIQs.
- *       - saves any registers.
- *       - returns zero.
- *  4. Owner B:
- *     - inserts code.
- *     - sets any registers,
- *     - enables FIQ.
- *  5. Owner B releases FIQ:
- *     - Owner A is asked to reacquire FIQ:
- *      - inserts code.
- *      - restores saved registers.
- *      - enables FIQ.
- *  6. Goto 3
- */
-#include <linux/module.h>
-#include <linux/mm.h>
-#include <linux/mman.h>
-#include <linux/init.h>
-#include <linux/seq_file.h>
-
-#include <asm/fiq.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/pgalloc.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-#define FIQ_VECTOR (vectors_base() + 0x1c)
-
-static unsigned long no_fiq_insn;
-
-#define unprotect_page_0()
-#define protect_page_0()
-
-/* Default reacquire function
- * - we always relinquish FIQ control
- * - we always reacquire FIQ control
- */
-static int fiq_def_op(void *ref, int relinquish)
-{
-       if (!relinquish) {
-               unprotect_page_0();
-               *(unsigned long *)FIQ_VECTOR = no_fiq_insn;
-               protect_page_0();
-       }
-
-       return 0;
-}
-
-static struct fiq_handler default_owner = {
-       .name   = "default",
-       .fiq_op = fiq_def_op,
-};
-
-static struct fiq_handler *current_fiq = &default_owner;
-
-int show_fiq_list(struct seq_file *p, void *v)
-{
-       if (current_fiq != &default_owner)
-               seq_printf(p, "FIQ:              %s\n", current_fiq->name);
-
-       return 0;
-}
-
-void set_fiq_handler(void *start, unsigned int length)
-{
-       unprotect_page_0();
-
-       memcpy((void *)FIQ_VECTOR, start, length);
-
-       protect_page_0();
-}
-
-/*
- * Taking an interrupt in FIQ mode is death, so both these functions
- * disable irqs for the duration. 
- */
-void set_fiq_regs(struct pt_regs *regs)
-{
-       register unsigned long tmp, tmp2;
-       __asm__ volatile (
-       "mov    %0, pc                                  \n"
-       "bic    %1, %0, #0x3                            \n"
-       "orr    %1, %1, %3                              \n"
-       "teqp   %1, #0          @ select FIQ mode       \n"
-       "mov    r0, r0                                  \n"
-       "ldmia  %2, {r8 - r14}                          \n"
-       "teqp   %0, #0          @ return to SVC mode    \n"
-       "mov    r0, r0                                  "
-       : "=&r" (tmp), "=&r" (tmp2)
-       : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | MODE_FIQ26)
-       /* These registers aren't modified by the above code in a way
-          visible to the compiler, but we mark them as clobbers anyway
-          so that GCC won't put any of the input or output operands in
-          them.  */
-       : "r8", "r9", "r10", "r11", "r12", "r13", "r14");
-}
-
-void get_fiq_regs(struct pt_regs *regs)
-{
-       register unsigned long tmp, tmp2;
-       __asm__ volatile (
-       "mov    %0, pc                                  \n"
-       "bic    %1, %0, #0x3                            \n"
-       "orr    %1, %1, %3                              \n"
-       "teqp   %1, #0          @ select FIQ mode       \n"
-       "mov    r0, r0                                  \n"
-       "stmia  %2, {r8 - r14}                          \n"
-       "teqp   %0, #0          @ return to SVC mode    \n"
-       "mov    r0, r0                                  "
-       : "=&r" (tmp), "=&r" (tmp2)
-       : "r" (&regs->ARM_r8), "I" (PSR_I_BIT | PSR_F_BIT | MODE_FIQ26)
-       /* These registers aren't modified by the above code in a way
-          visible to the compiler, but we mark them as clobbers anyway
-          so that GCC won't put any of the input or output operands in
-          them.  */
-       : "r8", "r9", "r10", "r11", "r12", "r13", "r14");
-}
-
-int claim_fiq(struct fiq_handler *f)
-{
-       int ret = 0;
-
-       if (current_fiq) {
-               ret = -EBUSY;
-
-               if (current_fiq->fiq_op != NULL)
-                       ret = current_fiq->fiq_op(current_fiq->dev_id, 1);
-       }
-
-       if (!ret) {
-               f->next = current_fiq;
-               current_fiq = f;
-       }
-
-       return ret;
-}
-
-void release_fiq(struct fiq_handler *f)
-{
-       if (current_fiq != f) {
-               printk(KERN_ERR "%s FIQ trying to release %s FIQ\n",
-                      f->name, current_fiq->name);
-#ifdef CONFIG_DEBUG_ERRORS
-               __backtrace();
-#endif
-               return;
-       }
-
-       do
-               current_fiq = current_fiq->next;
-       while (current_fiq->fiq_op(current_fiq->dev_id, 0));
-}
-
-void enable_fiq(int fiq)
-{
-       enable_irq(fiq + FIQ_START);
-}
-
-void disable_fiq(int fiq)
-{
-       disable_irq(fiq + FIQ_START);
-}
-
-EXPORT_SYMBOL(set_fiq_handler);
-EXPORT_SYMBOL(set_fiq_regs);
-EXPORT_SYMBOL(get_fiq_regs);
-EXPORT_SYMBOL(claim_fiq);
-EXPORT_SYMBOL(release_fiq);
-EXPORT_SYMBOL(enable_fiq);
-EXPORT_SYMBOL(disable_fiq);
-
-void __init init_FIQ(void)
-{
-       no_fiq_insn = *(unsigned long *)FIQ_VECTOR;
-       set_fs(get_fs());
-}
diff --git a/arch/arm26/kernel/head.S b/arch/arm26/kernel/head.S
deleted file mode 100644 (file)
index 93575e0..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/head.S
- *
- *  Copyright (C) 1994-2000 Russell King
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  26-bit kernel startup code
- */
-#include <linux/linkage.h>
-#include <asm/mach-types.h>
-
-               .globl  swapper_pg_dir
-               .equ    swapper_pg_dir, 0x0207d000
-
-/*
- * Entry point.
- */
-               .section ".init.text",#alloc,#execinstr
-ENTRY(stext)
-
-__entry:
-               cmp     pc, #0x02000000
-               ldrlt   pc, LC0                 @ if 0x01800000, call at 0x02080000
-               teq     r0, #0                  @ Check for old calling method
-               blne    oldparams               @ Move page if old
-
-               adr     r0, LC0
-               ldmib   r0, {r2-r5, sp}         @ Setup stack (and fetch other values)
-
-               mov     r0, #0                  @ Clear BSS
-1:             cmp     r2, r3
-               strcc   r0, [r2], #4
-               bcc     1b
-
-               bl      detect_proc_type
-               str     r0, [r4]
-               bl      detect_arch_type
-               str     r0, [r5]
-
-#ifdef CONFIG_XIP_KERNEL
-               ldr     r3, ETEXT                       @ data section copy
-               ldr     r4, SDATA
-               ldr     r5, EDATA
-1:
-               ldr     r6, [r3], #4
-               str     r6, [r4], #4
-               cmp     r4, r5
-               blt     1b
-#endif
-               mov     fp, #0
-               b       start_kernel
-
-LC0:           .word   _stext
-               .word   __bss_start             @ r2
-               .word   _end                    @ r3
-               .word   processor_id            @ r4
-               .word   __machine_arch_type     @ r5
-               .word   init_thread_union+8192  @ sp
-#ifdef CONFIG_XIP_KERNEL
-ETEXT:         .word   _endtext
-SDATA:         .word   _sdata
-EDATA:         .word   __bss_start
-#endif
-
-arm2_id:       .long   0x41560200  @ ARM2 and 250 dont have a CPUID
-arm250_id:     .long   0x41560250  @ So we create some after probing for them
-               .align
-
-oldparams:     mov     r4, #0x02000000
-               add     r3, r4, #0x00080000
-               add     r4, r4, #0x0007c000
-1:             ldmia   r0!, {r5 - r12}
-               stmia   r4!, {r5 - r12}
-               cmp     r4, r3
-               blt     1b
-               mov     pc, lr
-
-/*
- * We need some way to automatically detect the difference between
- * these two machines.  Unfortunately, it is not possible to detect
- * the presence of the SuperIO chip, because that will hang the old
- * Archimedes machines solid.
- */
-/* DAG: Outdated, these have been combined !!!!!!! */
-detect_arch_type:
-#if defined(CONFIG_ARCH_ARC)
-               mov     r0, #MACH_TYPE_ARCHIMEDES
-#elif defined(CONFIG_ARCH_A5K)
-               mov     r0, #MACH_TYPE_A5K
-#endif
-               mov     pc, lr
-
-detect_proc_type:
-               mov     ip, lr
-               mov     r2, #0xea000000         @ Point undef instr to continuation
-               adr     r0, continue - 12
-               orr     r0, r2, r0, lsr #2
-               mov     r1, #0
-               str     r0, [r1, #4]
-               ldr     r0, arm2_id
-               swp     r2, r2, [r1]            @ check for swp (ARM2 cant)
-               ldr     r0, arm250_id
-               mrc     15, 0, r3, c0, c0       @ check for CP#15 (ARM250 cant)
-               mov     r0, r3
-continue:      mov     r2, #0xeb000000         @ Make undef vector loop
-               sub     r2, r2, #2
-               str     r2, [r1, #4]
-               mov     pc, ip
diff --git a/arch/arm26/kernel/init_task.c b/arch/arm26/kernel/init_task.c
deleted file mode 100644 (file)
index 4191565..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/init_task.c
- *
- * Copyright (C) 2003 Ian Molton
- *
- */
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-#include <linux/init_task.h>
-#include <linux/mqueue.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-
-static struct fs_struct init_fs = INIT_FS;
-static struct files_struct init_files = INIT_FILES;
-static struct signal_struct init_signals = INIT_SIGNALS(init_signals);
-static struct sighand_struct init_sighand = INIT_SIGHAND(init_sighand);
-struct mm_struct init_mm = INIT_MM(init_mm);
-
-EXPORT_SYMBOL(init_mm);
-
-/*
- * Initial thread structure.
- *
- * We need to make sure that this is 8192-byte aligned due to the
- * way process stacks are handled. This is done by making sure
- * the linker maps this in the .text segment right after head.S,
- * and making the linker scripts ensure the proper alignment.
- *
- * FIXME - should this be 32K alignment on arm26?
- *
- * The things we do for performance...
- */
-union thread_union init_thread_union
-       __attribute__((__section__(".init.task"))) =
-               { INIT_THREAD_INFO(init_task) };
-
-/*
- * Initial task structure.
- *
- * All other task structs will be allocated on slabs in fork.c
- */
-struct task_struct init_task = INIT_TASK(init_task);
-
-EXPORT_SYMBOL(init_task);
diff --git a/arch/arm26/kernel/irq.c b/arch/arm26/kernel/irq.c
deleted file mode 100644 (file)
index 2ffe695..0000000
+++ /dev/null
@@ -1,722 +0,0 @@
-/*
- *  linux/arch/arm/kernel/irq.c
- *
- *  Copyright (C) 1992 Linus Torvalds
- *  Modifications for ARM processor Copyright (C) 1995-2000 Russell King.
- *  'Borrowed' for ARM26 and (C) 2003 Ian Molton.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  This file contains the code used by various IRQ handling routines:
- *  asking for different IRQ's should be done through these routines
- *  instead of just grabbing them. Thus setups with different IRQ numbers
- *  shouldn't result in any weird surprises, and installing new handlers
- *  should be easier.
- *
- *  IRQ's are in fact implemented a bit like signal handlers for the kernel.
- *  Naturally it's not a 1:1 relation, but there are similarities.
- */
-#include <linux/module.h>
-#include <linux/ptrace.h>
-#include <linux/kernel_stat.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/ioport.h>
-#include <linux/interrupt.h>
-#include <linux/slab.h>
-#include <linux/random.h>
-#include <linux/smp.h>
-#include <linux/init.h>
-#include <linux/seq_file.h>
-#include <linux/errno.h>
-
-#include <asm/irq.h>
-#include <asm/system.h>
-#include <asm/irqchip.h>
-
-//FIXME - this ought to be in a header IMO
-void __init arc_init_irq(void);
-
-/*
- * Maximum IRQ count.  Currently, this is arbitary.  However, it should
- * not be set too low to prevent false triggering.  Conversely, if it
- * is set too high, then you could miss a stuck IRQ.
- *
- * FIXME Maybe we ought to set a timer and re-enable the IRQ at a later time?
- */
-#define MAX_IRQ_CNT    100000
-
-static volatile unsigned long irq_err_count;
-static DEFINE_SPINLOCK(irq_controller_lock);
-
-struct irqdesc irq_desc[NR_IRQS];
-
-/*
- * Dummy mask/unmask handler
- */
-void dummy_mask_unmask_irq(unsigned int irq)
-{
-}
-
-void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
-{
-       irq_err_count += 1;
-       printk(KERN_ERR "IRQ: spurious interrupt %d\n", irq);
-}
-
-static struct irqchip bad_chip = {
-       .ack    = dummy_mask_unmask_irq,
-       .mask   = dummy_mask_unmask_irq,
-       .unmask = dummy_mask_unmask_irq,
-};
-
-static struct irqdesc bad_irq_desc = {
-       .chip   = &bad_chip,
-       .handle = do_bad_IRQ,
-       .depth  = 1,
-};
-
-/**
- *     disable_irq - disable an irq and wait for completion
- *     @irq: Interrupt to disable
- *
- *     Disable the selected interrupt line.  We do this lazily.
- *
- *     This function may be called from IRQ context.
- */
-void disable_irq(unsigned int irq)
-{
-       struct irqdesc *desc = irq_desc + irq;
-       unsigned long flags;
-       spin_lock_irqsave(&irq_controller_lock, flags);
-       if (!desc->depth++)
-               desc->enabled = 0;
-       spin_unlock_irqrestore(&irq_controller_lock, flags);
-}
-EXPORT_SYMBOL(disable_irq);
-
-void disable_irq_nosync(unsigned int irq) __attribute__((alias("disable_irq")));
-
-EXPORT_SYMBOL(disable_irq_nosync);
-
-/**
- *     enable_irq - enable interrupt handling on an irq
- *     @irq: Interrupt to enable
- *
- *     Re-enables the processing of interrupts on this IRQ line.
- *     Note that this may call the interrupt handler, so you may
- *     get unexpected results if you hold IRQs disabled.
- *
- *     This function may be called from IRQ context.
- */
-void enable_irq(unsigned int irq)
-{
-       struct irqdesc *desc = irq_desc + irq;
-       unsigned long flags;
-       int pending = 0;
-
-       spin_lock_irqsave(&irq_controller_lock, flags);
-       if (unlikely(!desc->depth)) {
-               printk("enable_irq(%u) unbalanced from %p\n", irq,
-                       __builtin_return_address(0)); //FIXME bum addresses reported - why?
-       } else if (!--desc->depth) {
-               desc->probing = 0;
-               desc->enabled = 1;
-               desc->chip->unmask(irq);
-               pending = desc->pending;
-               desc->pending = 0;
-               /*
-                * If the interrupt was waiting to be processed,
-                * retrigger it.
-                */
-               if (pending)
-                       desc->chip->rerun(irq);
-       }
-       spin_unlock_irqrestore(&irq_controller_lock, flags);
-}
-EXPORT_SYMBOL(enable_irq);
-
-int show_interrupts(struct seq_file *p, void *v)
-{
-       int i = *(loff_t *) v;
-       struct irqaction * action;
-
-       if (i < NR_IRQS) {
-               action = irq_desc[i].action;
-               if (!action)
-                       goto out;
-               seq_printf(p, "%3d: %10u ", i, kstat_irqs(i));
-               seq_printf(p, "  %s", action->name);
-               for (action = action->next; action; action = action->next) {
-                       seq_printf(p, ", %s", action->name);
-               }
-               seq_putc(p, '\n');
-       } else if (i == NR_IRQS) {
-               show_fiq_list(p, v);
-               seq_printf(p, "Err: %10lu\n", irq_err_count);
-       }
-out:
-       return 0;
-}
-
-/*
- * IRQ lock detection.
- *
- * Hopefully, this should get us out of a few locked situations.
- * However, it may take a while for this to happen, since we need
- * a large number if IRQs to appear in the same jiffie with the
- * same instruction pointer (or within 2 instructions).
- */
-static int check_irq_lock(struct irqdesc *desc, int irq, struct pt_regs *regs)
-{
-       unsigned long instr_ptr = instruction_pointer(regs);
-
-       if (desc->lck_jif == jiffies &&
-           desc->lck_pc >= instr_ptr && desc->lck_pc < instr_ptr + 8) {
-               desc->lck_cnt += 1;
-
-               if (desc->lck_cnt > MAX_IRQ_CNT) {
-                       printk(KERN_ERR "IRQ LOCK: IRQ%d is locking the system, disabled\n", irq);
-                       return 1;
-               }
-       } else {
-               desc->lck_cnt = 0;
-               desc->lck_pc  = instruction_pointer(regs);
-               desc->lck_jif = jiffies;
-       }
-       return 0;
-}
-
-static void
-__do_irq(unsigned int irq, struct irqaction *action, struct pt_regs *regs)
-{
-       unsigned int status;
-       int ret;
-
-       spin_unlock(&irq_controller_lock);
-       if (!(action->flags & IRQF_DISABLED))
-               local_irq_enable();
-
-       status = 0;
-       do {
-               ret = action->handler(irq, action->dev_id, regs);
-               if (ret == IRQ_HANDLED)
-                       status |= action->flags;
-               action = action->next;
-       } while (action);
-
-       if (status & IRQF_SAMPLE_RANDOM)
-               add_interrupt_randomness(irq);
-
-       spin_lock_irq(&irq_controller_lock);
-}
-
-/*
- * This is for software-decoded IRQs.  The caller is expected to
- * handle the ack, clear, mask and unmask issues.
- */
-void
-do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
-{
-       struct irqaction *action;
-       const int cpu = smp_processor_id();
-
-       desc->triggered = 1;
-
-       kstat_cpu(cpu).irqs[irq]++;
-
-       action = desc->action;
-       if (action)
-               __do_irq(irq, desc->action, regs);
-}
-
-/*
- * Most edge-triggered IRQ implementations seem to take a broken
- * approach to this.  Hence the complexity.
- */
-void
-do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
-{
-       const int cpu = smp_processor_id();
-
-       desc->triggered = 1;
-
-       /*
-        * If we're currently running this IRQ, or its disabled,
-        * we shouldn't process the IRQ.  Instead, turn on the
-        * hardware masks.
-        */
-       if (unlikely(desc->running || !desc->enabled))
-               goto running;
-
-       /*
-        * Acknowledge and clear the IRQ, but don't mask it.
-        */
-       desc->chip->ack(irq);
-
-       /*
-        * Mark the IRQ currently in progress.
-        */
-       desc->running = 1;
-
-       kstat_cpu(cpu).irqs[irq]++;
-
-       do {
-               struct irqaction *action;
-
-               action = desc->action;
-               if (!action)
-                       break;
-
-               if (desc->pending && desc->enabled) {
-                       desc->pending = 0;
-                       desc->chip->unmask(irq);
-               }
-
-               __do_irq(irq, action, regs);
-       } while (desc->pending);
-
-       desc->running = 0;
-
-       /*
-        * If we were disabled or freed, shut down the handler.
-        */
-       if (likely(desc->action && !check_irq_lock(desc, irq, regs)))
-               return;
-
- running:
-       /*
-        * We got another IRQ while this one was masked or
-        * currently running.  Delay it.
-        */
-       desc->pending = 1;
-       desc->chip->mask(irq);
-       desc->chip->ack(irq);
-}
-
-/*
- * Level-based IRQ handler.  Nice and simple.
- */
-void
-do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs)
-{
-       struct irqaction *action;
-       const int cpu = smp_processor_id();
-
-       desc->triggered = 1;
-
-       /*
-        * Acknowledge, clear _AND_ disable the interrupt.
-        */
-       desc->chip->ack(irq);
-
-       if (likely(desc->enabled)) {
-               kstat_cpu(cpu).irqs[irq]++;
-
-               /*
-                * Return with this interrupt masked if no action
-                */
-               action = desc->action;
-               if (action) {
-                       __do_irq(irq, desc->action, regs);
-
-                       if (likely(desc->enabled &&
-                                  !check_irq_lock(desc, irq, regs)))
-                               desc->chip->unmask(irq);
-               }
-       }
-}
-
-/*
- * do_IRQ handles all hardware IRQ's.  Decoded IRQs should not
- * come via this function.  Instead, they should provide their
- * own 'handler'
- */
-asmlinkage void asm_do_IRQ(int irq, struct pt_regs *regs)
-{
-       struct irqdesc *desc = irq_desc + irq;
-
-       /*
-        * Some hardware gives randomly wrong interrupts.  Rather
-        * than crashing, do something sensible.
-        */
-       if (irq >= NR_IRQS)
-               desc = &bad_irq_desc;
-
-       irq_enter();
-       spin_lock(&irq_controller_lock);
-       desc->handle(irq, desc, regs);
-       spin_unlock(&irq_controller_lock);
-       irq_exit();
-}
-
-void __set_irq_handler(unsigned int irq, irq_handler_t handle, int is_chained)
-{
-       struct irqdesc *desc;
-       unsigned long flags;
-
-       if (irq >= NR_IRQS) {
-               printk(KERN_ERR "Trying to install handler for IRQ%d\n", irq);
-               return;
-       }
-
-       if (handle == NULL)
-               handle = do_bad_IRQ;
-
-       desc = irq_desc + irq;
-
-       if (is_chained && desc->chip == &bad_chip)
-               printk(KERN_WARNING "Trying to install chained handler for IRQ%d\n", irq);
-
-       spin_lock_irqsave(&irq_controller_lock, flags);
-       if (handle == do_bad_IRQ) {
-               desc->chip->mask(irq);
-               desc->chip->ack(irq);
-               desc->depth = 1;
-               desc->enabled = 0;
-       }
-       desc->handle = handle;
-       if (handle != do_bad_IRQ && is_chained) {
-               desc->valid = 0;
-               desc->probe_ok = 0;
-               desc->depth = 0;
-               desc->chip->unmask(irq);
-       }
-       spin_unlock_irqrestore(&irq_controller_lock, flags);
-}
-
-void set_irq_chip(unsigned int irq, struct irqchip *chip)
-{
-       struct irqdesc *desc;
-       unsigned long flags;
-
-       if (irq >= NR_IRQS) {
-               printk(KERN_ERR "Trying to install chip for IRQ%d\n", irq);
-               return;
-       }
-
-       if (chip == NULL)
-               chip = &bad_chip;
-
-       desc = irq_desc + irq;
-       spin_lock_irqsave(&irq_controller_lock, flags);
-       desc->chip = chip;
-       spin_unlock_irqrestore(&irq_controller_lock, flags);
-}
-
-int set_irq_type(unsigned int irq, unsigned int type)
-{
-       struct irqdesc *desc;
-       unsigned long flags;
-       int ret = -ENXIO;
-
-       if (irq >= NR_IRQS) {
-               printk(KERN_ERR "Trying to set irq type for IRQ%d\n", irq);
-               return -ENODEV;
-       }
-
-       desc = irq_desc + irq;
-       if (desc->chip->type) {
-               spin_lock_irqsave(&irq_controller_lock, flags);
-               ret = desc->chip->type(irq, type);
-               spin_unlock_irqrestore(&irq_controller_lock, flags);
-       }
-
-       return ret;
-}
-
-void set_irq_flags(unsigned int irq, unsigned int iflags)
-{
-       struct irqdesc *desc;
-       unsigned long flags;
-
-       if (irq >= NR_IRQS) {
-               printk(KERN_ERR "Trying to set irq flags for IRQ%d\n", irq);
-               return;
-       }
-
-       desc = irq_desc + irq;
-       spin_lock_irqsave(&irq_controller_lock, flags);
-       desc->valid = (iflags & IRQF_VALID) != 0;
-       desc->probe_ok = (iflags & IRQF_PROBE) != 0;
-       desc->noautoenable = (iflags & IRQF_NOAUTOEN) != 0;
-       spin_unlock_irqrestore(&irq_controller_lock, flags);
-}
-
-int setup_irq(unsigned int irq, struct irqaction *new)
-{
-       int shared = 0;
-       struct irqaction *old, **p;
-       unsigned long flags;
-       struct irqdesc *desc;
-
-       /*
-        * Some drivers like serial.c use request_irq() heavily,
-        * so we have to be careful not to interfere with a
-        * running system.
-        */
-       if (new->flags & IRQF_SAMPLE_RANDOM) {
-               /*
-                * This function might sleep, we want to call it first,
-                * outside of the atomic block.
-                * Yes, this might clear the entropy pool if the wrong
-                * driver is attempted to be loaded, without actually
-                * installing a new handler, but is this really a problem,
-                * only the sysadmin is able to do this.
-                */
-               rand_initialize_irq(irq);
-       }
-
-       /*
-        * The following block of code has to be executed atomically
-        */
-       desc = irq_desc + irq;
-       spin_lock_irqsave(&irq_controller_lock, flags);
-       p = &desc->action;
-       if ((old = *p) != NULL) {
-               /* Can't share interrupts unless both agree to */
-               if (!(old->flags & new->flags & IRQF_SHARED)) {
-                       spin_unlock_irqrestore(&irq_controller_lock, flags);
-                       return -EBUSY;
-               }
-
-               /* add new interrupt at end of irq queue */
-               do {
-                       p = &old->next;
-                       old = *p;
-               } while (old);
-               shared = 1;
-       }
-
-       *p = new;
-
-       if (!shared) {
-               desc->probing = 0;
-               desc->running = 0;
-               desc->pending = 0;
-               desc->depth = 1;
-               if (!desc->noautoenable) {
-                       desc->depth = 0;
-                       desc->enabled = 1;
-                       desc->chip->unmask(irq);
-               }
-       }
-
-       spin_unlock_irqrestore(&irq_controller_lock, flags);
-       return 0;
-}
-
-/**
- *     request_irq - allocate an interrupt line
- *     @irq: Interrupt line to allocate
- *     @handler: Function to be called when the IRQ occurs
- *     @irqflags: Interrupt type flags
- *     @devname: An ascii name for the claiming device
- *     @dev_id: A cookie passed back to the handler function
- *
- *     This call allocates interrupt resources and enables the
- *     interrupt line and IRQ handling. From the point this
- *     call is made your handler function may be invoked. Since
- *     your handler function must clear any interrupt the board
- *     raises, you must take care both to initialise your hardware
- *     and to set up the interrupt handler in the right order.
- *
- *     Dev_id must be globally unique. Normally the address of the
- *     device data structure is used as the cookie. Since the handler
- *     receives this value it makes sense to use it.
- *
- *     If your interrupt is shared you must pass a non NULL dev_id
- *     as this is required when freeing the interrupt.
- *
- *     Flags:
- *
- *     IRQF_SHARED             Interrupt is shared
- *
- *     IRQF_DISABLED   Disable local interrupts while processing
- *
- *     IRQF_SAMPLE_RANDOM      The interrupt can be used for entropy
- *
- */
-
-//FIXME - handler used to return void - whats the significance of the change?
-int request_irq(unsigned int irq, irqreturn_t (*handler)(int, void *, struct pt_regs *),
-                unsigned long irq_flags, const char * devname, void *dev_id)
-{
-       unsigned long retval;
-       struct irqaction *action;
-
-       if (irq >= NR_IRQS || !irq_desc[irq].valid || !handler ||
-           (irq_flags & IRQF_SHARED && !dev_id))
-               return -EINVAL;
-
-       action = kmalloc(sizeof(struct irqaction), GFP_KERNEL);
-       if (!action)
-               return -ENOMEM;
-
-       action->handler = handler;
-       action->flags = irq_flags;
-       cpus_clear(action->mask);
-       action->name = devname;
-       action->next = NULL;
-       action->dev_id = dev_id;
-
-       retval = setup_irq(irq, action);
-
-       if (retval)
-               kfree(action);
-       return retval;
-}
-
-EXPORT_SYMBOL(request_irq);
-
-/**
- *     free_irq - free an interrupt
- *     @irq: Interrupt line to free
- *     @dev_id: Device identity to free
- *
- *     Remove an interrupt handler. The handler is removed and if the
- *     interrupt line is no longer in use by any driver it is disabled.
- *     On a shared IRQ the caller must ensure the interrupt is disabled
- *     on the card it drives before calling this function.
- *
- *     This function may be called from interrupt context.
- */
-void free_irq(unsigned int irq, void *dev_id)
-{
-       struct irqaction * action, **p;
-       unsigned long flags;
-
-       if (irq >= NR_IRQS || !irq_desc[irq].valid) {
-               printk(KERN_ERR "Trying to free IRQ%d\n",irq);
-#ifdef CONFIG_DEBUG_ERRORS
-               __backtrace();
-#endif
-               return;
-       }
-
-       spin_lock_irqsave(&irq_controller_lock, flags);
-       for (p = &irq_desc[irq].action; (action = *p) != NULL; p = &action->next) {
-               if (action->dev_id != dev_id)
-                       continue;
-
-               /* Found it - now free it */
-               *p = action->next;
-               kfree(action);
-               goto out;
-       }
-       printk(KERN_ERR "Trying to free free IRQ%d\n",irq);
-#ifdef CONFIG_DEBUG_ERRORS
-       __backtrace();
-#endif
-out:
-       spin_unlock_irqrestore(&irq_controller_lock, flags);
-}
-
-EXPORT_SYMBOL(free_irq);
-
-/* Start the interrupt probing.  Unlike other architectures,
- * we don't return a mask of interrupts from probe_irq_on,
- * but return the number of interrupts enabled for the probe.
- * The interrupts which have been enabled for probing is
- * instead recorded in the irq_desc structure.
- */
-unsigned long probe_irq_on(void)
-{
-       unsigned int i, irqs = 0;
-       unsigned long delay;
-
-       /*
-        * first snaffle up any unassigned but
-        * probe-able interrupts
-        */
-       spin_lock_irq(&irq_controller_lock);
-       for (i = 0; i < NR_IRQS; i++) {
-               if (!irq_desc[i].probe_ok || irq_desc[i].action)
-                       continue;
-
-               irq_desc[i].probing = 1;
-               irq_desc[i].triggered = 0;
-               if (irq_desc[i].chip->type)
-                       irq_desc[i].chip->type(i, IRQT_PROBE);
-               irq_desc[i].chip->unmask(i);
-               irqs += 1;
-       }
-       spin_unlock_irq(&irq_controller_lock);
-
-       /*
-        * wait for spurious interrupts to mask themselves out again
-        */
-       for (delay = jiffies + HZ/10; time_before(jiffies, delay); )
-               /* min 100ms delay */;
-
-       /*
-        * now filter out any obviously spurious interrupts
-        */
-       spin_lock_irq(&irq_controller_lock);
-       for (i = 0; i < NR_IRQS; i++) {
-               if (irq_desc[i].probing && irq_desc[i].triggered) {
-                       irq_desc[i].probing = 0;
-                       irqs -= 1;
-               }
-       }
-       spin_unlock_irq(&irq_controller_lock);
-
-       return irqs;
-}
-
-EXPORT_SYMBOL(probe_irq_on);
-
-/*
- * Possible return values:
- *  >= 0 - interrupt number
- *    -1 - no interrupt/many interrupts
- */
-int probe_irq_off(unsigned long irqs)
-{
-       unsigned int i;
-       int irq_found = NO_IRQ;
-
-       /*
-        * look at the interrupts, and find exactly one
-        * that we were probing has been triggered
-        */
-       spin_lock_irq(&irq_controller_lock);
-       for (i = 0; i < NR_IRQS; i++) {
-               if (irq_desc[i].probing &&
-                   irq_desc[i].triggered) {
-                       if (irq_found != NO_IRQ) {
-                               irq_found = NO_IRQ;
-                               goto out;
-                       }
-                       irq_found = i;
-               }
-       }
-
-       if (irq_found == -1)
-               irq_found = NO_IRQ;
-out:
-       spin_unlock_irq(&irq_controller_lock);
-
-       return irq_found;
-}
-
-EXPORT_SYMBOL(probe_irq_off);
-
-void __init init_irq_proc(void)
-{
-}
-
-void __init init_IRQ(void)
-{
-       struct irqdesc *desc;
-       extern void init_dma(void);
-       int irq;
-
-       for (irq = 0, desc = irq_desc; irq < NR_IRQS; irq++, desc++)
-               *desc = bad_irq_desc;
-
-       arc_init_irq();
-       init_dma();
-}
diff --git a/arch/arm26/kernel/process.c b/arch/arm26/kernel/process.c
deleted file mode 100644 (file)
index dcd81e6..0000000
+++ /dev/null
@@ -1,392 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/process.c
- *
- *  Copyright (C) 2003 Ian Molton - adapted for ARM26
- *  Copyright (C) 1996-2000 Russell King - Converted to ARM.
- *  Origional Copyright (C) 1995  Linus Torvalds
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <stdarg.h>
-
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/mm.h>
-#include <linux/stddef.h>
-#include <linux/unistd.h>
-#include <linux/ptrace.h>
-#include <linux/slab.h>
-#include <linux/user.h>
-#include <linux/a.out.h>
-#include <linux/delay.h>
-#include <linux/reboot.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/leds.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-
-extern const char *processor_modes[];
-extern void setup_mm_for_reboot(char mode);
-
-static volatile int hlt_counter;
-
-void disable_hlt(void)
-{
-       hlt_counter++;
-}
-
-EXPORT_SYMBOL(disable_hlt);
-
-void enable_hlt(void)
-{
-       hlt_counter--;
-}
-
-EXPORT_SYMBOL(enable_hlt);
-
-static int __init nohlt_setup(char *__unused)
-{
-       hlt_counter = 1;
-       return 1;
-}
-
-static int __init hlt_setup(char *__unused)
-{
-       hlt_counter = 0;
-       return 1;
-}
-
-__setup("nohlt", nohlt_setup);
-__setup("hlt", hlt_setup);
-
-/*
- * This is our default idle handler.  We need to disable
- * interrupts here to ensure we don't miss a wakeup call.
- */
-void cpu_idle(void)
-{
-       /* endless idle loop with no priority at all */
-       while (1) {
-               while (!need_resched())
-                       cpu_relax();
-               preempt_enable_no_resched();
-               schedule();
-               preempt_disable();
-       }
-}
-
-static char reboot_mode = 'h';
-
-int __init reboot_setup(char *str)
-{
-       reboot_mode = str[0];
-       return 1;
-}
-
-__setup("reboot=", reboot_setup);
-
-/* ARM26 cant do these but we still need to define them. */
-void machine_halt(void)
-{
-}
-void machine_power_off(void)
-{
-}
-
-void machine_restart(char * __unused)
-{
-       /*
-        * Clean and disable cache, and turn off interrupts
-        */
-       cpu_proc_fin();
-
-       /*
-        * Tell the mm system that we are going to reboot -
-        * we may need it to insert some 1:1 mappings so that
-        * soft boot works.
-        */
-       setup_mm_for_reboot(reboot_mode);
-
-       /*
-         * copy branch instruction to reset location and call it
-         */
-
-        *(unsigned long *)0 = *(unsigned long *)0x03800000;
-        ((void(*)(void))0)();
-
-       /*
-        * Whoops - the architecture was unable to reboot.
-        * Tell the user! Should never happen...
-        */
-       mdelay(1000);
-       printk("Reboot failed -- System halted\n");
-       while (1);
-}
-
-void show_regs(struct pt_regs * regs)
-{
-       unsigned long flags;
-
-       flags = condition_codes(regs);
-
-       printk("pc : [<%08lx>]    lr : [<%08lx>]    %s\n"
-              "sp : %08lx  ip : %08lx  fp : %08lx\n",
-               instruction_pointer(regs),
-               regs->ARM_lr, print_tainted(), regs->ARM_sp,
-               regs->ARM_ip, regs->ARM_fp);
-       printk("r10: %08lx  r9 : %08lx  r8 : %08lx\n",
-               regs->ARM_r10, regs->ARM_r9,
-               regs->ARM_r8);
-       printk("r7 : %08lx  r6 : %08lx  r5 : %08lx  r4 : %08lx\n",
-               regs->ARM_r7, regs->ARM_r6,
-               regs->ARM_r5, regs->ARM_r4);
-       printk("r3 : %08lx  r2 : %08lx  r1 : %08lx  r0 : %08lx\n",
-               regs->ARM_r3, regs->ARM_r2,
-               regs->ARM_r1, regs->ARM_r0);
-       printk("Flags: %c%c%c%c",
-               flags & PSR_N_BIT ? 'N' : 'n',
-               flags & PSR_Z_BIT ? 'Z' : 'z',
-               flags & PSR_C_BIT ? 'C' : 'c',
-               flags & PSR_V_BIT ? 'V' : 'v');
-       printk("  IRQs o%s  FIQs o%s  Mode %s  Segment %s\n",
-               interrupts_enabled(regs) ? "n" : "ff",
-               fast_interrupts_enabled(regs) ? "n" : "ff",
-               processor_modes[processor_mode(regs)],
-               get_fs() == get_ds() ? "kernel" : "user");
-}
-
-void show_fpregs(struct user_fp *regs)
-{
-       int i;
-
-       for (i = 0; i < 8; i++) {
-               unsigned long *p;
-               char type;
-
-               p = (unsigned long *)(regs->fpregs + i);
-
-               switch (regs->ftype[i]) {
-                       case 1: type = 'f'; break;
-                       case 2: type = 'd'; break;
-                       case 3: type = 'e'; break;
-                       default: type = '?'; break;
-               }
-               if (regs->init_flag)
-                       type = '?';
-
-               printk("  f%d(%c): %08lx %08lx %08lx%c",
-                       i, type, p[0], p[1], p[2], i & 1 ? '\n' : ' ');
-       }
-                       
-
-       printk("FPSR: %08lx FPCR: %08lx\n",
-               (unsigned long)regs->fpsr,
-               (unsigned long)regs->fpcr);
-}
-
-/*
- * Task structure and kernel stack allocation.
- */
-static unsigned long *thread_info_head;
-static unsigned int nr_thread_info;
-
-extern unsigned long get_page_8k(int priority);
-extern void free_page_8k(unsigned long page);
-
-// FIXME - is this valid?
-#define EXTRA_TASK_STRUCT      0
-#define ll_alloc_task_struct() ((struct thread_info *)get_page_8k(GFP_KERNEL))
-#define ll_free_task_struct(p)  free_page_8k((unsigned long)(p))
-
-//FIXME - do we use *task param below looks like we dont, which is ok?
-//FIXME - if EXTRA_TASK_STRUCT is zero we can optimise the below away permanently. *IF* its supposed to be zero.
-struct thread_info *alloc_thread_info(struct task_struct *task)
-{
-       struct thread_info *thread = NULL;
-
-       if (EXTRA_TASK_STRUCT) {
-               unsigned long *p = thread_info_head;
-
-               if (p) {
-                       thread_info_head = (unsigned long *)p[0];
-                       nr_thread_info -= 1;
-               }
-               thread = (struct thread_info *)p;
-       }
-
-       if (!thread)
-               thread = ll_alloc_task_struct();
-
-#ifdef CONFIG_MAGIC_SYSRQ
-       /*
-        * The stack must be cleared if you want SYSRQ-T to
-        * give sensible stack usage information
-        */
-       if (thread) {
-               char *p = (char *)thread;
-               memzero(p+KERNEL_STACK_SIZE, KERNEL_STACK_SIZE);
-       }
-#endif
-       return thread;
-}
-
-void free_thread_info(struct thread_info *thread)
-{
-       if (EXTRA_TASK_STRUCT && nr_thread_info < EXTRA_TASK_STRUCT) {
-               unsigned long *p = (unsigned long *)thread;
-               p[0] = (unsigned long)thread_info_head;
-               thread_info_head = p;
-               nr_thread_info += 1;
-       } else
-               ll_free_task_struct(thread);
-}
-
-/*
- * Free current thread data structures etc..
- */
-void exit_thread(void)
-{
-}
-
-void flush_thread(void)
-{
-       struct thread_info *thread = current_thread_info();
-       struct task_struct *tsk = current;
-
-       memset(&tsk->thread.debug, 0, sizeof(struct debug_info));
-       memset(&thread->fpstate, 0, sizeof(union fp_state));
-
-       clear_used_math();
-}
-
-void release_thread(struct task_struct *dead_task)
-{
-}
-
-asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
-
-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 = task_thread_info(p);
-       struct pt_regs *childregs = task_pt_regs(p);
-
-       *childregs = *regs;
-       childregs->ARM_r0 = 0;
-       childregs->ARM_sp = stack_start;
-
-       memset(&thread->cpu_context, 0, sizeof(struct cpu_context_save));
-       thread->cpu_context.sp = (unsigned long)childregs;
-       thread->cpu_context.pc = (unsigned long)ret_from_fork | MODE_SVC26 | PSR_I_BIT;
-
-       return 0;
-}
-
-/*
- * fill in the fpe structure for a core dump...
- */
-int dump_fpu (struct pt_regs *regs, struct user_fp *fp)
-{
-       struct thread_info *thread = current_thread_info();
-       int used_math = !!used_math();
-
-       if (used_math)
-               memcpy(fp, &thread->fpstate.soft, sizeof (*fp));
-
-       return used_math;
-}
-
-/*
- * fill in the user structure for a core dump..
- */
-void dump_thread(struct pt_regs * regs, struct user * dump)
-{
-       struct task_struct *tsk = current;
-
-       dump->magic = CMAGIC;
-       dump->start_code = tsk->mm->start_code;
-       dump->start_stack = regs->ARM_sp & ~(PAGE_SIZE - 1);
-
-       dump->u_tsize = (tsk->mm->end_code - tsk->mm->start_code) >> PAGE_SHIFT;
-       dump->u_dsize = (tsk->mm->brk - tsk->mm->start_data + PAGE_SIZE - 1) >> PAGE_SHIFT;
-       dump->u_ssize = 0;
-
-       dump->u_debugreg[0] = tsk->thread.debug.bp[0].address;
-       dump->u_debugreg[1] = tsk->thread.debug.bp[1].address;
-       dump->u_debugreg[2] = tsk->thread.debug.bp[0].insn;
-       dump->u_debugreg[3] = tsk->thread.debug.bp[1].insn;
-       dump->u_debugreg[4] = tsk->thread.debug.nsaved;
-
-       if (dump->start_stack < 0x04000000)
-               dump->u_ssize = (0x04000000 - dump->start_stack) >> PAGE_SHIFT;
-
-       dump->regs = *regs;
-       dump->u_fpvalid = dump_fpu (regs, &dump->u_fp);
-}
-
-/*
- * Shuffle the argument into the correct register before calling the
- * thread function.  r1 is the thread argument, r2 is the pointer to
- * the thread function, and r3 points to the exit function.
- * FIXME - make sure this is right - the older code used to zero fp
- * and cause the parent to call sys_exit (do_exit in this version)
- */
-extern void kernel_thread_helper(void);
-
-asm(    ".section .text\n"
-"       .align\n"
-"       .type   kernel_thread_helper, #function\n"
-"kernel_thread_helper:\n"
-"       mov     r0, r1\n"
-"       mov     lr, r3\n"
-"       mov     pc, r2\n"
-"       .size   kernel_thread_helper, . - kernel_thread_helper\n"
-"       .previous");
-
-/*
- * Create a kernel thread.
- */
-pid_t kernel_thread(int (*fn)(void *), void *arg, unsigned long flags)
-{
-        struct pt_regs regs;
-
-        memset(&regs, 0, sizeof(regs));
-
-        regs.ARM_r1 = (unsigned long)arg;
-        regs.ARM_r2 = (unsigned long)fn;
-        regs.ARM_r3 = (unsigned long)do_exit;
-        regs.ARM_pc = (unsigned long)kernel_thread_helper | MODE_SVC26;
-
-        return do_fork(flags|CLONE_VM|CLONE_UNTRACED, 0, &regs, 0, NULL, NULL);
-}
-EXPORT_SYMBOL(kernel_thread);
-
-
-unsigned long get_wchan(struct task_struct *p)
-{
-       unsigned long fp, lr;
-       unsigned long stack_page;
-       int count = 0;
-       if (!p || p == current || p->state == TASK_RUNNING)
-               return 0;
-
-       stack_page = 4096 + (unsigned long)p;
-       fp = thread_saved_fp(p);
-       do {
-               if (fp < stack_page || fp > 4092+stack_page)
-                       return 0;
-               lr = pc_pointer (((unsigned long *)fp)[-1]);
-               if (!in_sched_functions(lr))
-                       return lr;
-               fp = *(unsigned long *) (fp - 12);
-       } while (count ++ < 16);
-       return 0;
-}
diff --git a/arch/arm26/kernel/ptrace.c b/arch/arm26/kernel/ptrace.c
deleted file mode 100644 (file)
index 0fefb86..0000000
+++ /dev/null
@@ -1,670 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/ptrace.c
- *
- *  By Ross Biro 1/23/92
- * edited by Linus Torvalds
- * ARM modifications Copyright (C) 2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/ptrace.h>
-#include <linux/user.h>
-#include <linux/security.h>
-#include <linux/signal.h>
-
-#include <asm/uaccess.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-//#include <asm/processor.h>
-
-#include "ptrace.h"
-
-#define REG_PC 15
-#define REG_PSR 15
-/*
- * does not yet catch signals sent when the child dies.
- * in exit.c or in signal.c.
- */
-
-/*
- * Breakpoint SWI instruction: SWI &9F0001
- */
-#define BREAKINST_ARM  0xef9f0001
-
-/*
- * 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.
- * this routine assumes that all the privileged stacks are in our
- * data space.
- */
-static inline long get_user_reg(struct task_struct *task, int offset)
-{
-       return task_pt_regs(task)->uregs[offset];
-}
-
-/*
- * this routine will put a word on the processes privileged stack.
- * the offset is how far from the base addr as stored in the THREAD.
- * this routine assumes that all the privileged stacks are in our
- * data space.
- */
-static inline int
-put_user_reg(struct task_struct *task, int offset, long data)
-{
-       struct pt_regs newregs, *regs = task_pt_regs(task);
-       int ret = -EINVAL;
-
-       newregs = *regs;
-       newregs.uregs[offset] = data;
-
-       if (valid_user_regs(&newregs)) {
-               regs->uregs[offset] = data;
-               ret = 0;
-       }
-
-       return ret;
-}
-
-static inline int
-read_u32(struct task_struct *task, unsigned long addr, u32 *res)
-{
-       int ret;
-
-       ret = access_process_vm(task, addr, res, sizeof(*res), 0);
-
-       return ret == sizeof(*res) ? 0 : -EIO;
-}
-
-static inline int
-read_instr(struct task_struct *task, unsigned long addr, u32 *res)
-{
-       int ret;
-       u32 val;
-       ret = access_process_vm(task, addr & ~3, &val, sizeof(val), 0);
-       ret = ret == sizeof(val) ? 0 : -EIO;
-       *res = val;
-       return ret;
-}
-
-/*
- * Get value of register `rn' (in the instruction)
- */
-static unsigned long
-ptrace_getrn(struct task_struct *child, unsigned long insn)
-{
-       unsigned int reg = (insn >> 16) & 15;
-       unsigned long val;
-
-       val = get_user_reg(child, reg);
-       if (reg == 15)
-               val = pc_pointer(val + 8); //FIXME - correct for arm26?
-
-       return val;
-}
-
-/*
- * Get value of operand 2 (in an ALU instruction)
- */
-static unsigned long
-ptrace_getaluop2(struct task_struct *child, unsigned long insn)
-{
-       unsigned long val;
-       int shift;
-       int type;
-
-       if (insn & 1 << 25) {
-               val = insn & 255;
-               shift = (insn >> 8) & 15;
-               type = 3;
-       } else {
-               val = get_user_reg (child, insn & 15);
-
-               if (insn & (1 << 4))
-                       shift = (int)get_user_reg (child, (insn >> 8) & 15);
-               else
-                       shift = (insn >> 7) & 31;
-
-               type = (insn >> 5) & 3;
-       }
-
-       switch (type) {
-       case 0: val <<= shift;  break;
-       case 1: val >>= shift;  break;
-       case 2:
-               val = (((signed long)val) >> shift);
-               break;
-       case 3:
-               val = (val >> shift) | (val << (32 - shift));
-               break;
-       }
-       return val;
-}
-
-/*
- * Get value of operand 2 (in a LDR instruction)
- */
-static unsigned long
-ptrace_getldrop2(struct task_struct *child, unsigned long insn)
-{
-       unsigned long val;
-       int shift;
-       int type;
-
-       val = get_user_reg(child, insn & 15);
-       shift = (insn >> 7) & 31;
-       type = (insn >> 5) & 3;
-
-       switch (type) {
-       case 0: val <<= shift;  break;
-       case 1: val >>= shift;  break;
-       case 2:
-               val = (((signed long)val) >> shift);
-               break;
-       case 3:
-               val = (val >> shift) | (val << (32 - shift));
-               break;
-       }
-       return val;
-}
-
-#define OP_MASK        0x01e00000
-#define OP_AND 0x00000000
-#define OP_EOR 0x00200000
-#define OP_SUB 0x00400000
-#define OP_RSB 0x00600000
-#define OP_ADD 0x00800000
-#define OP_ADC 0x00a00000
-#define OP_SBC 0x00c00000
-#define OP_RSC 0x00e00000
-#define OP_ORR 0x01800000
-#define OP_MOV 0x01a00000
-#define OP_BIC 0x01c00000
-#define OP_MVN 0x01e00000
-
-static unsigned long
-get_branch_address(struct task_struct *child, unsigned long pc, unsigned long insn)
-{
-       u32 alt = 0;
-
-       switch (insn & 0x0e000000) {
-       case 0x00000000:
-       case 0x02000000: {
-               /*
-                * data processing
-                */
-               long aluop1, aluop2, ccbit;
-
-               if ((insn & 0xf000) != 0xf000)
-                       break;
-
-               aluop1 = ptrace_getrn(child, insn);
-               aluop2 = ptrace_getaluop2(child, insn);
-               ccbit  = get_user_reg(child, REG_PSR) & PSR_C_BIT ? 1 : 0;
-
-               switch (insn & OP_MASK) {
-               case OP_AND: alt = aluop1 & aluop2;             break;
-               case OP_EOR: alt = aluop1 ^ aluop2;             break;
-               case OP_SUB: alt = aluop1 - aluop2;             break;
-               case OP_RSB: alt = aluop2 - aluop1;             break;
-               case OP_ADD: alt = aluop1 + aluop2;             break;
-               case OP_ADC: alt = aluop1 + aluop2 + ccbit;     break;
-               case OP_SBC: alt = aluop1 - aluop2 + ccbit;     break;
-               case OP_RSC: alt = aluop2 - aluop1 + ccbit;     break;
-               case OP_ORR: alt = aluop1 | aluop2;             break;
-               case OP_MOV: alt = aluop2;                      break;
-               case OP_BIC: alt = aluop1 & ~aluop2;            break;
-               case OP_MVN: alt = ~aluop2;                     break;
-               }
-               break;
-       }
-
-       case 0x04000000:
-       case 0x06000000:
-               /*
-                * ldr
-                */
-               if ((insn & 0x0010f000) == 0x0010f000) {
-                       unsigned long base;
-
-                       base = ptrace_getrn(child, insn);
-                       if (insn & 1 << 24) {
-                               long aluop2;
-
-                               if (insn & 0x02000000)
-                                       aluop2 = ptrace_getldrop2(child, insn);
-                               else
-                                       aluop2 = insn & 0xfff;
-
-                               if (insn & 1 << 23)
-                                       base += aluop2;
-                               else
-                                       base -= aluop2;
-                       }
-                       if (read_u32(child, base, &alt) == 0)
-                               alt = pc_pointer(alt);
-               }
-               break;
-
-       case 0x08000000:
-               /*
-                * ldm
-                */
-               if ((insn & 0x00108000) == 0x00108000) {
-                       unsigned long base;
-                       unsigned int nr_regs;
-
-                       if (insn & (1 << 23)) {
-                               nr_regs = hweight16(insn & 65535) << 2;
-
-                               if (!(insn & (1 << 24)))
-                                       nr_regs -= 4;
-                       } else {
-                               if (insn & (1 << 24))
-                                       nr_regs = -4;
-                               else
-                                       nr_regs = 0;
-                       }
-
-                       base = ptrace_getrn(child, insn);
-
-                       if (read_u32(child, base + nr_regs, &alt) == 0)
-                               alt = pc_pointer(alt);
-                       break;
-               }
-               break;
-
-       case 0x0a000000: {
-               /*
-                * bl or b
-                */
-               signed long displ;
-               /* It's a branch/branch link: instead of trying to
-                * figure out whether the branch will be taken or not,
-                * we'll put a breakpoint at both locations.  This is
-                * simpler, more reliable, and probably not a whole lot
-                * slower than the alternative approach of emulating the
-                * branch.
-                */
-               displ = (insn & 0x00ffffff) << 8;
-               displ = (displ >> 6) + 8;
-               if (displ != 0 && displ != 4)
-                       alt = pc + displ;
-           }
-           break;
-       }
-
-       return alt;
-}
-
-static int
-swap_insn(struct task_struct *task, unsigned long addr,
-         void *old_insn, void *new_insn, int size)
-{
-       int ret;
-
-       ret = access_process_vm(task, addr, old_insn, size, 0);
-       if (ret == size)
-               ret = access_process_vm(task, addr, new_insn, size, 1);
-       return ret;
-}
-
-static void
-add_breakpoint(struct task_struct *task, struct debug_info *dbg, unsigned long addr)
-{
-       int nr = dbg->nsaved;
-
-       if (nr < 2) {
-               u32 new_insn = BREAKINST_ARM;
-               int res;
-
-               res = swap_insn(task, addr, &dbg->bp[nr].insn, &new_insn, 4);
-
-               if (res == 4) {
-                       dbg->bp[nr].address = addr;
-                       dbg->nsaved += 1;
-               }
-       } else
-               printk(KERN_ERR "ptrace: too many breakpoints\n");
-}
-
-/*
- * Clear one breakpoint in the user program.  We copy what the hardware
- * does and use bit 0 of the address to indicate whether this is a Thumb
- * breakpoint or an ARM breakpoint.
- */
-static void clear_breakpoint(struct task_struct *task, struct debug_entry *bp)
-{
-       unsigned long addr = bp->address;
-       u32 old_insn;
-       int ret;
-
-       ret = swap_insn(task, addr & ~3, &old_insn,
-                       &bp->insn, 4);
-
-       if (ret != 4 || old_insn != BREAKINST_ARM)
-               printk(KERN_ERR "%s:%d: corrupted ARM breakpoint at "
-                       "0x%08lx (0x%08x)\n", task->comm, task->pid,
-                       addr, old_insn);
-}
-
-void ptrace_set_bpt(struct task_struct *child)
-{
-       struct pt_regs *regs;
-       unsigned long pc;
-       u32 insn;
-       int res;
-
-       regs = task_pt_regs(child);
-       pc = instruction_pointer(regs);
-
-       res = read_instr(child, pc, &insn);
-       if (!res) {
-               struct debug_info *dbg = &child->thread.debug;
-               unsigned long alt;
-
-               dbg->nsaved = 0;
-
-               alt = get_branch_address(child, pc, insn);
-               if (alt)
-                       add_breakpoint(child, dbg, alt);
-
-               /*
-                * Note that we ignore the result of setting the above
-                * breakpoint since it may fail.  When it does, this is
-                * not so much an error, but a forewarning that we may
-                * be receiving a prefetch abort shortly.
-                *
-                * If we don't set this breakpoint here, then we can
-                * lose control of the thread during single stepping.
-                */
-               if (!alt || predicate(insn) != PREDICATE_ALWAYS)
-                       add_breakpoint(child, dbg, pc + 4);
-       }
-}
-
-/*
- * Ensure no single-step breakpoint is pending.  Returns non-zero
- * value if child was being single-stepped.
- */
-void ptrace_cancel_bpt(struct task_struct *child)
-{
-       int i, nsaved = child->thread.debug.nsaved;
-
-       child->thread.debug.nsaved = 0;
-
-       if (nsaved > 2) {
-               printk("ptrace_cancel_bpt: bogus nsaved: %d!\n", nsaved);
-               nsaved = 2;
-       }
-
-       for (i = 0; i < nsaved; i++)
-               clear_breakpoint(child, &child->thread.debug.bp[i]);
-}
-
-/*
- * Called by kernel/ptrace.c when detaching..
- *
- * Make sure the single step bit is not set.
- */
-void ptrace_disable(struct task_struct *child)
-{
-       child->ptrace &= ~PT_SINGLESTEP;
-       ptrace_cancel_bpt(child);
-}
-
-/*
- * Handle hitting a breakpoint.
- */
-void ptrace_break(struct task_struct *tsk, struct pt_regs *regs)
-{
-       siginfo_t info;
-
-       /*
-        * The PC is always left pointing at the next instruction.  Fix this.
-        */
-       regs->ARM_pc -= 4;
-
-       if (tsk->thread.debug.nsaved == 0)
-               printk(KERN_ERR "ptrace: bogus breakpoint trap\n");
-
-       ptrace_cancel_bpt(tsk);
-
-       info.si_signo = SIGTRAP;
-       info.si_errno = 0;
-       info.si_code  = TRAP_BRKPT;
-       info.si_addr  = (void *)instruction_pointer(regs) - 4;
-
-       force_sig_info(SIGTRAP, &info, tsk);
-}
-
-/*
- * Read the word at offset "off" into the "struct user".  We
- * actually access the pt_regs stored on the kernel stack.
- */
-static int ptrace_read_user(struct task_struct *tsk, unsigned long off,
-                           unsigned long *ret)
-{
-       unsigned long tmp;
-
-       if (off & 3 || off >= sizeof(struct user))
-               return -EIO;
-
-       tmp = 0;
-       if (off < sizeof(struct pt_regs))
-               tmp = get_user_reg(tsk, off >> 2);
-
-       return put_user(tmp, ret);
-}
-
-/*
- * Write the word at offset "off" into "struct user".  We
- * actually access the pt_regs stored on the kernel stack.
- */
-static int ptrace_write_user(struct task_struct *tsk, unsigned long off,
-                            unsigned long val)
-{
-       if (off & 3 || off >= sizeof(struct user))
-               return -EIO;
-
-       if (off >= sizeof(struct pt_regs))
-               return 0;
-
-       return put_user_reg(tsk, off >> 2, val);
-}
-
-/*
- * Get all user integer registers.
- */
-static int ptrace_getregs(struct task_struct *tsk, void *uregs)
-{
-       struct pt_regs *regs = task_pt_regs(tsk);
-
-       return copy_to_user(uregs, regs, sizeof(struct pt_regs)) ? -EFAULT : 0;
-}
-
-/*
- * Set all user integer registers.
- */
-static int ptrace_setregs(struct task_struct *tsk, void *uregs)
-{
-       struct pt_regs newregs;
-       int ret;
-
-       ret = -EFAULT;
-       if (copy_from_user(&newregs, uregs, sizeof(struct pt_regs)) == 0) {
-               struct pt_regs *regs = task_pt_regs(tsk);
-
-               ret = -EINVAL;
-               if (valid_user_regs(&newregs)) {
-                       *regs = newregs;
-                       ret = 0;
-               }
-       }
-
-       return ret;
-}
-
-/*
- * Get the child FPU state.
- */
-static int ptrace_getfpregs(struct task_struct *tsk, void *ufp)
-{
-       return copy_to_user(ufp, &task_thread_info(tsk)->fpstate,
-                           sizeof(struct user_fp)) ? -EFAULT : 0;
-}
-
-/*
- * Set the child FPU state.
- */
-static int ptrace_setfpregs(struct task_struct *tsk, void *ufp)
-{
-       set_stopped_child_used_math(tsk);
-       return copy_from_user(&task_thread_info(tsk)->fpstate, ufp,
-                             sizeof(struct user_fp)) ? -EFAULT : 0;
-}
-
-long arch_ptrace(struct task_struct *child, long request, long addr, long data)
-{
-       int ret;
-
-       switch (request) {
-               /*
-                * read word at location "addr" in the child process.
-                */
-               case PTRACE_PEEKTEXT:
-               case PTRACE_PEEKDATA:
-                       ret = generic_ptrace_peekdata(child, addr, data);
-                       break;
-
-               case PTRACE_PEEKUSR:
-                       ret = ptrace_read_user(child, addr, (unsigned long *)data);
-                       break;
-
-               /*
-                * write the word at location addr.
-                */
-               case PTRACE_POKETEXT:
-               case PTRACE_POKEDATA:
-                       ret = generic_ptrace_pokedata(child, addr, data);
-                       break;
-
-               case PTRACE_POKEUSR:
-                       ret = ptrace_write_user(child, addr, data);
-                       break;
-
-               /*
-                * continue/restart and stop at next (return from) syscall
-                */
-               case PTRACE_SYSCALL:
-               case PTRACE_CONT:
-                       ret = -EIO;
-                       if (!valid_signal(data))
-                               break;
-                       if (request == PTRACE_SYSCALL)
-                               set_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-                       else
-                               clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-                       child->exit_code = data;
-                       /* make sure single-step breakpoint is gone. */
-                       child->ptrace &= ~PT_SINGLESTEP;
-                       ptrace_cancel_bpt(child);
-                       wake_up_process(child);
-                       ret = 0;
-                       break;
-
-               /*
-                * make the child exit.  Best I can do is send it a sigkill.
-                * perhaps it should be put in the status that it wants to
-                * exit.
-                */
-               case PTRACE_KILL:
-                       /* make sure single-step breakpoint is gone. */
-                       child->ptrace &= ~PT_SINGLESTEP;
-                       ptrace_cancel_bpt(child);
-                       if (child->exit_state != EXIT_ZOMBIE) {
-                               child->exit_code = SIGKILL;
-                               wake_up_process(child);
-                       }
-                       ret = 0;
-                       break;
-
-               /*
-                * execute single instruction.
-                */
-               case PTRACE_SINGLESTEP:
-                       ret = -EIO;
-                       if (!valid_signal(data))
-                               break;
-                       child->ptrace |= PT_SINGLESTEP;
-                       clear_tsk_thread_flag(child, TIF_SYSCALL_TRACE);
-                       child->exit_code = data;
-                       /* give it a chance to run. */
-                       wake_up_process(child);
-                       ret = 0;
-                       break;
-
-               case PTRACE_DETACH:
-                       ret = ptrace_detach(child, data);
-                       break;
-
-               case PTRACE_GETREGS:
-                       ret = ptrace_getregs(child, (void *)data);
-                       break;
-
-               case PTRACE_SETREGS:
-                       ret = ptrace_setregs(child, (void *)data);
-                       break;
-
-               case PTRACE_GETFPREGS:
-                       ret = ptrace_getfpregs(child, (void *)data);
-                       break;
-               
-               case PTRACE_SETFPREGS:
-                       ret = ptrace_setfpregs(child, (void *)data);
-                       break;
-
-               default:
-                       ret = ptrace_request(child, request, addr, data);
-                       break;
-       }
-
-       return ret;
-}
-
-asmlinkage void syscall_trace(int why, struct pt_regs *regs)
-{
-       unsigned long ip;
-
-       if (!test_thread_flag(TIF_SYSCALL_TRACE))
-               return;
-       if (!(current->ptrace & PT_PTRACED))
-               return;
-
-       /*
-        * Save IP.  IP is used to denote syscall entry/exit:
-        *  IP = 0 -> entry, = 1 -> exit
-        */
-       ip = regs->ARM_ip;
-       regs->ARM_ip = why;
-
-       /* the 0x80 provides a way for the tracing parent to distinguish
-          between a syscall stop and SIGTRAP delivery */
-       ptrace_notify(SIGTRAP | ((current->ptrace & PT_TRACESYSGOOD)
-                                ? 0x80 : 0));
-       /*
-        * this isn't the same as continuing with a signal, but it will do
-        * for normal use.  strace only continues with a signal if the
-        * stopping signal is not SIGTRAP.  -brl
-        */
-       if (current->exit_code) {
-               send_sig(current->exit_code, current, 1);
-               current->exit_code = 0;
-       }
-       regs->ARM_ip = ip;
-}
diff --git a/arch/arm26/kernel/ptrace.h b/arch/arm26/kernel/ptrace.h
deleted file mode 100644 (file)
index 846c9d8..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/ptrace.h
- *
- *  Copyright (C) 2000-2003 Russell King
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-extern void ptrace_cancel_bpt(struct task_struct *);
-extern void ptrace_set_bpt(struct task_struct *);
-extern void ptrace_break(struct task_struct *, struct pt_regs *);
diff --git a/arch/arm26/kernel/semaphore.c b/arch/arm26/kernel/semaphore.c
deleted file mode 100644 (file)
index 5447a06..0000000
+++ /dev/null
@@ -1,222 +0,0 @@
-/*
- *  ARM semaphore implementation, taken from
- *
- *  i386 semaphore implementation.
- *
- *  (C) Copyright 1999 Linus Torvalds
- *  (C) Copyright 2003 Ian Molton (ARM26 mods)
- *
- *  Modified for ARM by Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/sched.h>
-#include <linux/errno.h>
-#include <linux/init.h>
-
-#include <asm/semaphore.h>
-
-/*
- * Semaphores are implemented using a two-way counter:
- * The "count" variable is decremented for each process
- * that tries to acquire the semaphore, while the "sleeping"
- * variable is a count of such acquires.
- *
- * Notably, the inline "up()" and "down()" functions can
- * efficiently test if they need to do any extra work (up
- * needs to do something only if count was negative before
- * the increment operation.
- *
- * "sleeping" and the contention routine ordering is
- * protected by the semaphore spinlock.
- *
- * Note that these functions are only called when there is
- * contention on the lock, and as such all this is the
- * "non-critical" part of the whole semaphore business. The
- * critical part is the inline stuff in <asm/semaphore.h>
- * where we want to avoid any extra jumps and calls.
- */
-
-/*
- * Logic:
- *  - only on a boundary condition do we need to care. When we go
- *    from a negative count to a non-negative, we wake people up.
- *  - when we go from a non-negative count to a negative do we
- *    (a) synchronize with the "sleeper" count and (b) make sure
- *    that we're on the wakeup list before we synchronize so that
- *    we cannot lose wakeup events.
- */
-
-void __up(struct semaphore *sem)
-{
-       wake_up(&sem->wait);
-}
-
-static DEFINE_SPINLOCK(semaphore_lock);
-
-void __sched __down(struct semaphore * sem)
-{
-       struct task_struct *tsk = current;
-       DECLARE_WAITQUEUE(wait, tsk);
-       tsk->state = TASK_UNINTERRUPTIBLE;
-       add_wait_queue_exclusive(&sem->wait, &wait);
-
-       spin_lock_irq(&semaphore_lock);
-       sem->sleepers++;
-       for (;;) {
-               int sleepers = sem->sleepers;
-
-               /*
-                * Add "everybody else" into it. They aren't
-                * playing, because we own the spinlock.
-                */
-               if (!atomic_add_negative(sleepers - 1, &sem->count)) {
-                       sem->sleepers = 0;
-                       break;
-               }
-               sem->sleepers = 1;      /* us - see -1 above */
-               spin_unlock_irq(&semaphore_lock);
-
-               schedule();
-               tsk->state = TASK_UNINTERRUPTIBLE;
-               spin_lock_irq(&semaphore_lock);
-       }
-       spin_unlock_irq(&semaphore_lock);
-       remove_wait_queue(&sem->wait, &wait);
-       tsk->state = TASK_RUNNING;
-       wake_up(&sem->wait);
-}
-
-int __sched __down_interruptible(struct semaphore * sem)
-{
-       int retval = 0;
-       struct task_struct *tsk = current;
-       DECLARE_WAITQUEUE(wait, tsk);
-       tsk->state = TASK_INTERRUPTIBLE;
-       add_wait_queue_exclusive(&sem->wait, &wait);
-
-       spin_lock_irq(&semaphore_lock);
-       sem->sleepers ++;
-       for (;;) {
-               int sleepers = sem->sleepers;
-
-               /*
-                * With signals pending, this turns into
-                * the trylock failure case - we won't be
-                * sleeping, and we* can't get the lock as
-                * it has contention. Just correct the count
-                * and exit.
-                */
-               if (signal_pending(current)) {
-                       retval = -EINTR;
-                       sem->sleepers = 0;
-                       atomic_add(sleepers, &sem->count);
-                       break;
-               }
-
-               /*
-                * Add "everybody else" into it. They aren't
-                * playing, because we own the spinlock. The
-                * "-1" is because we're still hoping to get
-                * the lock.
-                */
-               if (!atomic_add_negative(sleepers - 1, &sem->count)) {
-                       sem->sleepers = 0;
-                       break;
-               }
-               sem->sleepers = 1;      /* us - see -1 above */
-               spin_unlock_irq(&semaphore_lock);
-
-               schedule();
-               tsk->state = TASK_INTERRUPTIBLE;
-               spin_lock_irq(&semaphore_lock);
-       }
-       spin_unlock_irq(&semaphore_lock);
-       tsk->state = TASK_RUNNING;
-       remove_wait_queue(&sem->wait, &wait);
-       wake_up(&sem->wait);
-       return retval;
-}
-
-/*
- * Trylock failed - make sure we correct for
- * having decremented the count.
- *
- * We could have done the trylock with a
- * single "cmpxchg" without failure cases,
- * but then it wouldn't work on a 386.
- */
-int __down_trylock(struct semaphore * sem)
-{
-       int sleepers;
-       unsigned long flags;
-
-       spin_lock_irqsave(&semaphore_lock, flags);
-       sleepers = sem->sleepers + 1;
-       sem->sleepers = 0;
-
-       /*
-        * Add "everybody else" and us into it. They aren't
-        * playing, because we own the spinlock.
-        */
-       if (!atomic_add_negative(sleepers, &sem->count))
-               wake_up(&sem->wait);
-
-       spin_unlock_irqrestore(&semaphore_lock, flags);
-       return 1;
-}
-
-/*
- * The semaphore operations have a special calling sequence that
- * allow us to do a simpler in-line version of them. These routines
- * need to convert that sequence back into the C sequence when
- * there is contention on the semaphore.
- *
- * ip contains the semaphore pointer on entry. Save the C-clobbered
- * registers (r0 to r3 and lr), but not ip, as we use it as a return
- * value in some cases..
- */
-asm("  .section .sched.text , #alloc, #execinstr       \n\
-       .align  5                               \n\
-       .globl  __down_failed                   \n\
-__down_failed:                                 \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
-       mov     r0, ip                          \n\
-       bl      __down                          \n\
-       ldmfd   sp!, {r0 - r3, pc}^             \n\
-                                               \n\
-       .align  5                               \n\
-       .globl  __down_interruptible_failed     \n\
-__down_interruptible_failed:                   \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
-       mov     r0, ip                          \n\
-       bl      __down_interruptible            \n\
-       mov     ip, r0                          \n\
-       ldmfd   sp!, {r0 - r3, pc}^             \n\
-                                               \n\
-       .align  5                               \n\
-       .globl  __down_trylock_failed           \n\
-__down_trylock_failed:                         \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
-       mov     r0, ip                          \n\
-       bl      __down_trylock                  \n\
-       mov     ip, r0                          \n\
-       ldmfd   sp!, {r0 - r3, pc}^             \n\
-                                               \n\
-       .align  5                               \n\
-       .globl  __up_wakeup                     \n\
-__up_wakeup:                                   \n\
-       stmfd   sp!, {r0 - r3, lr}              \n\
-       mov     r0, ip                          \n\
-       bl      __up                            \n\
-       ldmfd   sp!, {r0 - r3, pc}^             \n\
-       ");
-
-EXPORT_SYMBOL(__down_failed);
-EXPORT_SYMBOL(__down_interruptible_failed);
-EXPORT_SYMBOL(__down_trylock_failed);
-EXPORT_SYMBOL(__up_wakeup);
-
diff --git a/arch/arm26/kernel/setup.c b/arch/arm26/kernel/setup.c
deleted file mode 100644 (file)
index 0e006c6..0000000
+++ /dev/null
@@ -1,572 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/setup.c
- *
- *  Copyright (C) 1995-2001 Russell King
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/kernel.h>
-#include <linux/stddef.h>
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/utsname.h>
-#include <linux/blkdev.h>
-#include <linux/console.h>
-#include <linux/bootmem.h>
-#include <linux/seq_file.h>
-#include <linux/screen_info.h>
-#include <linux/init.h>
-#include <linux/root_dev.h>
-
-#include <asm/elf.h>
-#include <asm/hardware.h>
-#include <asm/io.h>
-#include <asm/procinfo.h>
-#include <asm/setup.h>
-#include <asm/mach-types.h>
-#include <asm/tlbflush.h>
-
-#include <asm/irqchip.h>
-
-#ifndef MEM_SIZE
-#define MEM_SIZE       (16*1024*1024)
-#endif
-
-#ifdef CONFIG_PREEMPT
-DEFINE_SPINLOCK(kernel_flag);
-#endif
-
-#if defined(CONFIG_FPE_NWFPE)
-char fpe_type[8];
-
-static int __init fpe_setup(char *line)
-{
-       memcpy(fpe_type, line, 8);
-       return 1;
-}
-
-__setup("fpe=", fpe_setup);
-#endif
-
-extern void paging_init(struct meminfo *);
-extern void convert_to_tag_list(struct tag *tags);
-extern void squash_mem_tags(struct tag *tag);
-extern void bootmem_init(struct meminfo *);
-extern int root_mountflags;
-extern int _stext, _text, _etext, _edata, _end;
-#ifdef CONFIG_XIP_KERNEL
-extern int _endtext, _sdata;
-#endif
-
-
-unsigned int processor_id;
-unsigned int __machine_arch_type;
-unsigned int system_rev;
-unsigned int system_serial_low;
-unsigned int system_serial_high;
-unsigned int elf_hwcap;
-unsigned int memc_ctrl_reg;
-unsigned int number_mfm_drives;
-
-struct processor processor;
-
-char elf_platform[ELF_PLATFORM_SIZE];
-
-unsigned long phys_initrd_start __initdata = 0;
-unsigned long phys_initrd_size __initdata = 0;
-static struct meminfo meminfo __initdata = { 0, };
-static struct proc_info_item proc_info;
-static const char *machine_name;
-static char __initdata command_line[COMMAND_LINE_SIZE];
-
-static char default_command_line[COMMAND_LINE_SIZE] __initdata = CONFIG_CMDLINE;
-
-/*
- * Standard memory resources
- */
-static struct resource mem_res[] = {
-       { "Video RAM",   0,     0,     IORESOURCE_MEM                   },
-       { "Kernel code", 0,     0,     IORESOURCE_MEM                   },
-       { "Kernel data", 0,     0,     IORESOURCE_MEM                   }
-};
-
-#define video_ram   mem_res[0]
-#define kernel_code mem_res[1]
-#define kernel_data mem_res[2]
-
-static struct resource io_res[] = {
-       { "reserved",    0x3bc, 0x3be, IORESOURCE_IO | IORESOURCE_BUSY },
-       { "reserved",    0x378, 0x37f, IORESOURCE_IO | IORESOURCE_BUSY },
-       { "reserved",    0x278, 0x27f, IORESOURCE_IO | IORESOURCE_BUSY }
-};
-
-#define lp0 io_res[0]
-#define lp1 io_res[1]
-#define lp2 io_res[2]
-
-#define dump_cpu_info() do { } while (0)
-
-static void __init setup_processor(void)
-{
-       extern struct proc_info_list __proc_info_begin, __proc_info_end;
-       struct proc_info_list *list;
-
-       /*
-        * locate processor in the list of supported processor
-        * types.  The linker builds this table for us from the
-        * entries in arch/arm26/mm/proc-*.S
-        */
-       for (list = &__proc_info_begin; list < &__proc_info_end ; list++)
-               if ((processor_id & list->cpu_mask) == list->cpu_val)
-                       break;
-
-       /*
-        * If processor type is unrecognised, then we
-        * can do nothing...
-        */
-       if (list >= &__proc_info_end) {
-               printk("CPU configuration botched (ID %08x), unable "
-                      "to continue.\n", processor_id);
-               while (1);
-       }
-
-       proc_info = *list->info;
-       processor = *list->proc;
-
-
-       printk("CPU: %s %s revision %d\n",
-              proc_info.manufacturer, proc_info.cpu_name,
-              (int)processor_id & 15);
-
-       dump_cpu_info();
-
-       sprintf(init_utsname()->machine, "%s", list->arch_name);
-       sprintf(elf_platform, "%s", list->elf_name);
-       elf_hwcap = list->elf_hwcap;
-
-       cpu_proc_init();
-}
-
-/*
- * Initial parsing of the command line.  We need to pick out the
- * memory size.  We look for mem=size@start, where start and size
- * are "size[KkMm]"
- */
-static void __init
-parse_cmdline(struct meminfo *mi, char **cmdline_p, char *from)
-{
-       char c = ' ', *to = command_line;
-       int usermem = 0, len = 0;
-
-       for (;;) {
-               if (c == ' ' && !memcmp(from, "mem=", 4)) {
-                       unsigned long size, start;
-
-                       if (to != command_line)
-                               to -= 1;
-
-                       /*
-                        * If the user specifies memory size, we
-                        * blow away any automatically generated
-                        * size.
-                        */
-                       if (usermem == 0) {
-                               usermem = 1;
-                               mi->nr_banks = 0;
-                       }
-
-                       start = PHYS_OFFSET;
-                       size  = memparse(from + 4, &from);
-                       if (*from == '@')
-                               start = memparse(from + 1, &from);
-
-                       mi->bank[mi->nr_banks].start = start;
-                       mi->bank[mi->nr_banks].size  = size;
-                       mi->bank[mi->nr_banks].node  = PHYS_TO_NID(start);
-                       mi->nr_banks += 1;
-               }
-               c = *from++;
-               if (!c)
-                       break;
-               if (COMMAND_LINE_SIZE <= ++len)
-                       break;
-               *to++ = c;
-       }
-       *to = '\0';
-       *cmdline_p = command_line;
-}
-
-static void __init
-setup_ramdisk(int doload, int prompt, int image_start, unsigned int rd_sz)
-{
-#ifdef CONFIG_BLK_DEV_RAM
-       extern int rd_size, rd_image_start, rd_prompt, rd_doload;
-
-       rd_image_start = image_start;
-       rd_prompt = prompt;
-       rd_doload = doload;
-
-       if (rd_sz)
-               rd_size = rd_sz;
-#endif
-}
-
-static void __init
-request_standard_resources(struct meminfo *mi)
-{
-       struct resource *res;
-       int i;
-
-       kernel_code.start  = init_mm.start_code;
-       kernel_code.end    = init_mm.end_code - 1;
-#ifdef CONFIG_XIP_KERNEL
-       kernel_data.start  = init_mm.start_data;
-#else
-       kernel_data.start  = init_mm.end_code;
-#endif
-       kernel_data.end    = init_mm.brk - 1;
-
-       for (i = 0; i < mi->nr_banks; i++) {
-               unsigned long virt_start, virt_end;
-
-               if (mi->bank[i].size == 0)
-                       continue;
-
-               virt_start = mi->bank[i].start;
-               virt_end   = virt_start + mi->bank[i].size - 1;
-
-               res = alloc_bootmem_low(sizeof(*res));
-               res->name  = "System RAM";
-               res->start = virt_start;
-               res->end   = virt_end;
-               res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-
-               request_resource(&iomem_resource, res);
-
-               if (kernel_code.start >= res->start &&
-                   kernel_code.end <= res->end)
-                       request_resource(res, &kernel_code);
-               if (kernel_data.start >= res->start &&
-                   kernel_data.end <= res->end)
-                       request_resource(res, &kernel_data);
-       }
-
-/*     FIXME - needed? if (mdesc->video_start) {
-               video_ram.start = mdesc->video_start;
-               video_ram.end   = mdesc->video_end;
-               request_resource(&iomem_resource, &video_ram);
-       }*/
-
-       /*
-        * Some machines don't have the possibility of ever
-        * possessing lp1 or lp2
-        */
-       if (0)  /* FIXME - need to do this for A5k at least */
-               request_resource(&ioport_resource, &lp0);
-}
-
-/*
- *  Tag parsing.
- *
- * This is the new way of passing data to the kernel at boot time.  Rather
- * than passing a fixed inflexible structure to the kernel, we pass a list
- * of variable-sized tags to the kernel.  The first tag must be a ATAG_CORE
- * tag for the list to be recognised (to distinguish the tagged list from
- * a param_struct).  The list is terminated with a zero-length tag (this tag
- * is not parsed in any way).
- */
-static int __init parse_tag_core(const struct tag *tag)
-{
-       if (tag->hdr.size > 2) {
-               if ((tag->u.core.flags & 1) == 0)
-                       root_mountflags &= ~MS_RDONLY;
-               ROOT_DEV = old_decode_dev(tag->u.core.rootdev);
-       }
-       return 0;
-}
-
-__tagtable(ATAG_CORE, parse_tag_core);
-
-static int __init parse_tag_mem32(const struct tag *tag)
-{
-       if (meminfo.nr_banks >= NR_BANKS) {
-               printk(KERN_WARNING
-                      "Ignoring memory bank 0x%08x size %dKB\n",
-                       tag->u.mem.start, tag->u.mem.size / 1024);
-               return -EINVAL;
-       }
-       meminfo.bank[meminfo.nr_banks].start = tag->u.mem.start;
-       meminfo.bank[meminfo.nr_banks].size  = tag->u.mem.size;
-       meminfo.bank[meminfo.nr_banks].node  = PHYS_TO_NID(tag->u.mem.start);
-       meminfo.nr_banks += 1;
-
-       return 0;
-}
-
-__tagtable(ATAG_MEM, parse_tag_mem32);
-
-#if defined(CONFIG_DUMMY_CONSOLE)
-struct screen_info screen_info = {
- .orig_video_lines     = 30,
- .orig_video_cols      = 80,
- .orig_video_mode      = 0,
- .orig_video_ega_bx    = 0,
- .orig_video_isVGA     = 1,
- .orig_video_points    = 8
-};
-
-static int __init parse_tag_videotext(const struct tag *tag)
-{
-       screen_info.orig_x            = tag->u.videotext.x;
-       screen_info.orig_y            = tag->u.videotext.y;
-       screen_info.orig_video_page   = tag->u.videotext.video_page;
-       screen_info.orig_video_mode   = tag->u.videotext.video_mode;
-       screen_info.orig_video_cols   = tag->u.videotext.video_cols;
-       screen_info.orig_video_ega_bx = tag->u.videotext.video_ega_bx;
-       screen_info.orig_video_lines  = tag->u.videotext.video_lines;
-       screen_info.orig_video_isVGA  = tag->u.videotext.video_isvga;
-       screen_info.orig_video_points = tag->u.videotext.video_points;
-       return 0;
-}
-
-__tagtable(ATAG_VIDEOTEXT, parse_tag_videotext);
-#endif
-
-static int __init parse_tag_acorn(const struct tag *tag)
-{
-        memc_ctrl_reg = tag->u.acorn.memc_control_reg;
-        number_mfm_drives = tag->u.acorn.adfsdrives;
-        return 0;
-}
-
-__tagtable(ATAG_ACORN, parse_tag_acorn);
-
-static int __init parse_tag_ramdisk(const struct tag *tag)
-{
-       setup_ramdisk((tag->u.ramdisk.flags & 1) == 0,
-                     (tag->u.ramdisk.flags & 2) == 0,
-                     tag->u.ramdisk.start, tag->u.ramdisk.size);
-       return 0;
-}
-
-__tagtable(ATAG_RAMDISK, parse_tag_ramdisk);
-
-static int __init parse_tag_initrd(const struct tag *tag)
-{
-       printk(KERN_WARNING "ATAG_INITRD is deprecated; please update your bootloader. \n");
-        phys_initrd_start = (unsigned long)tag->u.initrd.start;
-        phys_initrd_size = (unsigned long)tag->u.initrd.size;
-       return 0;
-}
-
-__tagtable(ATAG_INITRD, parse_tag_initrd);
-
-static int __init parse_tag_initrd2(const struct tag *tag)
-{
-       printk(KERN_WARNING "ATAG_INITRD is deprecated; please update your bootloader. \n");
-       phys_initrd_start = (unsigned long)tag->u.initrd.start;
-       phys_initrd_size = (unsigned long)tag->u.initrd.size;
-       return 0;
-}
-
-__tagtable(ATAG_INITRD2, parse_tag_initrd2);
-
-static int __init parse_tag_serialnr(const struct tag *tag)
-{
-       system_serial_low = tag->u.serialnr.low;
-       system_serial_high = tag->u.serialnr.high;
-       return 0;
-}
-
-__tagtable(ATAG_SERIAL, parse_tag_serialnr);
-
-static int __init parse_tag_revision(const struct tag *tag)
-{
-       system_rev = tag->u.revision.rev;
-       return 0;
-}
-
-__tagtable(ATAG_REVISION, parse_tag_revision);
-
-static int __init parse_tag_cmdline(const struct tag *tag)
-{
-       strncpy(default_command_line, tag->u.cmdline.cmdline, COMMAND_LINE_SIZE);
-       default_command_line[COMMAND_LINE_SIZE - 1] = '\0';
-       return 0;
-}
-
-__tagtable(ATAG_CMDLINE, parse_tag_cmdline);
-
-/*
- * Scan the tag table for this tag, and call its parse function.
- * The tag table is built by the linker from all the __tagtable
- * declarations.
- */
-static int __init parse_tag(const struct tag *tag)
-{
-       extern struct tagtable __tagtable_begin, __tagtable_end;
-       struct tagtable *t;
-
-       for (t = &__tagtable_begin; t < &__tagtable_end; t++)
-               if (tag->hdr.tag == t->tag) {
-                       t->parse(tag);
-                       break;
-               }
-
-       return t < &__tagtable_end;
-}
-
-/*
- * Parse all tags in the list, checking both the global and architecture
- * specific tag tables.
- */
-static void __init parse_tags(const struct tag *t)
-{
-       for (; t->hdr.size; t = tag_next(t))
-               if (!parse_tag(t))
-                       printk(KERN_WARNING
-                               "Ignoring unrecognised tag 0x%08x\n",
-                               t->hdr.tag);
-}
-
-/*
- * This holds our defaults.
- */
-static struct init_tags {
-       struct tag_header hdr1;
-       struct tag_core   core;
-       struct tag_header hdr2;
-       struct tag_mem32  mem;
-       struct tag_header hdr3;
-} init_tags __initdata = {
-       { tag_size(tag_core), ATAG_CORE },
-       { 1, PAGE_SIZE, 0xff },
-       { tag_size(tag_mem32), ATAG_MEM },
-       { MEM_SIZE, PHYS_OFFSET },
-       { 0, ATAG_NONE }
-};
-
-void __init setup_arch(char **cmdline_p)
-{
-       struct tag *tags = (struct tag *)&init_tags;
-       char *from = default_command_line;
-
-       setup_processor();
-       if(machine_arch_type == MACH_TYPE_A5K)
-               machine_name = "A5000";
-       else if(machine_arch_type == MACH_TYPE_ARCHIMEDES)
-               machine_name = "Archimedes";
-       else
-               machine_name = "UNKNOWN";
-
-       //FIXME - the tag struct is always copied here but this is a block
-       // of RAM that is accidentally reserved along with video RAM. perhaps
-       // it would be a good idea to explicitly reserve this?
-
-       tags = (struct tag *)0x0207c000;
-
-       /*
-        * If we have the old style parameters, convert them to
-        * a tag list.
-        */
-       if (tags->hdr.tag != ATAG_CORE)
-               convert_to_tag_list(tags);
-       if (tags->hdr.tag != ATAG_CORE)
-               tags = (struct tag *)&init_tags;
-       if (tags->hdr.tag == ATAG_CORE) {
-               if (meminfo.nr_banks != 0)
-                       squash_mem_tags(tags);
-               parse_tags(tags);
-       }
-
-       init_mm.start_code = (unsigned long) &_text;
-#ifndef CONFIG_XIP_KERNEL
-       init_mm.end_code   = (unsigned long) &_etext;
-#else
-       init_mm.end_code   = (unsigned long) &_endtext;
-       init_mm.start_data   = (unsigned long) &_sdata;
-#endif
-       init_mm.end_data   = (unsigned long) &_edata;
-       init_mm.brk        = (unsigned long) &_end;
-
-       memcpy(boot_command_line, from, COMMAND_LINE_SIZE);
-       boot_command_line[COMMAND_LINE_SIZE-1] = '\0';
-       parse_cmdline(&meminfo, cmdline_p, from);
-       bootmem_init(&meminfo);
-       paging_init(&meminfo);
-       request_standard_resources(&meminfo);
-
-#ifdef CONFIG_VT
-#if defined(CONFIG_DUMMY_CONSOLE)
-       conswitchp = &dummy_con;
-#endif
-#endif
-}
-
-static const char *hwcap_str[] = {
-       "swp",
-       "half",
-       "thumb",
-       "26bit",
-       "fastmult",
-       "fpa",
-       "vfp",
-       "edsp",
-       NULL
-};
-
-static int c_show(struct seq_file *m, void *v)
-{
-       int i;
-
-       seq_printf(m, "Processor\t: %s %s rev %d (%s)\n",
-                  proc_info.manufacturer, proc_info.cpu_name,
-                  (int)processor_id & 15, elf_platform);
-
-       seq_printf(m, "BogoMIPS\t: %lu.%02lu\n",
-                  loops_per_jiffy / (500000/HZ),
-                  (loops_per_jiffy / (5000/HZ)) % 100);
-
-       /* dump out the processor features */
-       seq_puts(m, "Features\t: ");
-
-       for (i = 0; hwcap_str[i]; i++)
-               if (elf_hwcap & (1 << i))
-                       seq_printf(m, "%s ", hwcap_str[i]);
-
-       seq_puts(m, "\n");
-
-       seq_printf(m, "CPU part\t\t: %07x\n", processor_id >> 4);
-       seq_printf(m, "CPU revision\t: %d\n\n", processor_id & 15);
-       seq_printf(m, "Hardware\t: %s\n", machine_name);
-       seq_printf(m, "Revision\t: %04x\n", system_rev);
-       seq_printf(m, "Serial\t\t: %08x%08x\n",
-                  system_serial_high, system_serial_low);
-
-       return 0;
-}
-
-static void *c_start(struct seq_file *m, loff_t *pos)
-{
-       return *pos < 1 ? (void *)1 : NULL;
-}
-
-static void *c_next(struct seq_file *m, void *v, loff_t *pos)
-{
-       ++*pos;
-       return NULL;
-}
-
-static void c_stop(struct seq_file *m, void *v)
-{
-}
-
-struct seq_operations cpuinfo_op = {
-       .start  = c_start,
-       .next   = c_next,
-       .stop   = c_stop,
-       .show   = c_show
-};
diff --git a/arch/arm26/kernel/signal.c b/arch/arm26/kernel/signal.c
deleted file mode 100644 (file)
index 379b82d..0000000
+++ /dev/null
@@ -1,538 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/signal.c
- *
- *  Copyright (C) 1995-2002 Russell King
- *  Copyright (C) 2003 Ian Molton (ARM26)
- *
- * FIXME!!! This is probably very broken (13/05/2003)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/signal.h>
-#include <linux/wait.h>
-#include <linux/ptrace.h>
-#include <linux/personality.h>
-#include <linux/tty.h>
-#include <linux/binfmts.h>
-#include <linux/elf.h>
-
-#include <asm/pgalloc.h>
-#include <asm/ucontext.h>
-#include <asm/uaccess.h>
-#include <asm/unistd.h>
-
-#include "ptrace.h"
-
-#define _BLOCKABLE (~(sigmask(SIGKILL) | sigmask(SIGSTOP)))
-
-/*
- * For ARM syscalls, we encode the syscall number into the instruction.
- */
-#define SWI_SYS_SIGRETURN      (0xef000000|(__NR_sigreturn))
-#define SWI_SYS_RT_SIGRETURN   (0xef000000|(__NR_rt_sigreturn))
-
-static int do_signal(sigset_t *oldset, struct pt_regs * regs, int syscall);
-
-/*
- * atomically swap in the new signal mask, and wait for a signal.
- */
-asmlinkage int sys_sigsuspend(int restart, unsigned long oldmask, old_sigset_t mask, struct pt_regs *regs)
-{
-       sigset_t saveset;
-
-       mask &= _BLOCKABLE;
-       spin_lock_irq(&current->sighand->siglock);
-       saveset = current->blocked;
-       siginitset(&current->blocked, mask);
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-       regs->ARM_r0 = -EINTR;
-
-       while (1) {
-               current->state = TASK_INTERRUPTIBLE;
-               schedule();
-               if (do_signal(&saveset, regs, 0))
-                       return regs->ARM_r0;
-       }
-}
-
-asmlinkage int
-sys_rt_sigsuspend(sigset_t *unewset, size_t sigsetsize, struct pt_regs *regs)
-{
-       sigset_t saveset, newset;
-
-       /* XXX: Don't preclude handling different sized sigset_t's. */
-       if (sigsetsize != sizeof(sigset_t))
-               return -EINVAL;
-
-       if (copy_from_user(&newset, unewset, sizeof(newset)))
-               return -EFAULT;
-       sigdelsetmask(&newset, ~_BLOCKABLE);
-
-       spin_lock_irq(&current->sighand->siglock);
-       saveset = current->blocked;
-       current->blocked = newset;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-       regs->ARM_r0 = -EINTR;
-
-       while (1) {
-               current->state = TASK_INTERRUPTIBLE;
-               schedule();
-               if (do_signal(&saveset, regs, 0))
-                       return regs->ARM_r0;
-       }
-}
-
-asmlinkage int 
-sys_sigaction(int sig, const struct old_sigaction *act,
-             struct old_sigaction *oact)
-{
-       struct k_sigaction new_ka, old_ka;
-       int ret;
-
-       if (act) {
-               old_sigset_t mask;
-               if (!access_ok(VERIFY_READ, act, sizeof(*act)) ||
-                   __get_user(new_ka.sa.sa_handler, &act->sa_handler) ||
-                   __get_user(new_ka.sa.sa_restorer, &act->sa_restorer))
-                       return -EFAULT;
-               __get_user(new_ka.sa.sa_flags, &act->sa_flags);
-               __get_user(mask, &act->sa_mask);
-               siginitset(&new_ka.sa.sa_mask, mask);
-       }
-
-       ret = do_sigaction(sig, act ? &new_ka : NULL, oact ? &old_ka : NULL);
-
-       if (!ret && oact) {
-               if (!access_ok(VERIFY_WRITE, oact, sizeof(*oact)) ||
-                   __put_user(old_ka.sa.sa_handler, &oact->sa_handler) ||
-                   __put_user(old_ka.sa.sa_restorer, &oact->sa_restorer))
-                       return -EFAULT;
-               __put_user(old_ka.sa.sa_flags, &oact->sa_flags);
-               __put_user(old_ka.sa.sa_mask.sig[0], &oact->sa_mask);
-       }
-
-       return ret;
-}
-
-/*
- * Do a signal return; undo the signal stack.
- */
-struct sigframe
-{
-       struct sigcontext sc;
-       unsigned long extramask[_NSIG_WORDS-1];
-       unsigned long retcode;
-};
-
-struct rt_sigframe
-{
-       struct siginfo *pinfo;
-       void *puc;
-       struct siginfo info;
-       struct ucontext uc;
-       unsigned long retcode;
-};
-
-static int
-restore_sigcontext(struct pt_regs *regs, struct sigcontext *sc)
-{
-       int err = 0;
-
-       __get_user_error(regs->ARM_r0, &sc->arm_r0, err);
-       __get_user_error(regs->ARM_r1, &sc->arm_r1, err);
-       __get_user_error(regs->ARM_r2, &sc->arm_r2, err);
-       __get_user_error(regs->ARM_r3, &sc->arm_r3, err);
-       __get_user_error(regs->ARM_r4, &sc->arm_r4, err);
-       __get_user_error(regs->ARM_r5, &sc->arm_r5, err);
-       __get_user_error(regs->ARM_r6, &sc->arm_r6, err);
-       __get_user_error(regs->ARM_r7, &sc->arm_r7, err);
-       __get_user_error(regs->ARM_r8, &sc->arm_r8, err);
-       __get_user_error(regs->ARM_r9, &sc->arm_r9, err);
-       __get_user_error(regs->ARM_r10, &sc->arm_r10, err);
-       __get_user_error(regs->ARM_fp, &sc->arm_fp, err);
-       __get_user_error(regs->ARM_ip, &sc->arm_ip, err);
-       __get_user_error(regs->ARM_sp, &sc->arm_sp, err);
-       __get_user_error(regs->ARM_lr, &sc->arm_lr, err);
-       __get_user_error(regs->ARM_pc, &sc->arm_pc, err);
-
-       err |= !valid_user_regs(regs);
-
-       return err;
-}
-
-asmlinkage int sys_sigreturn(struct pt_regs *regs)
-{
-       struct sigframe *frame;
-       sigset_t set;
-
-       /*
-        * Since we stacked the signal on a 64-bit boundary,
-        * then 'sp' should be word aligned here.  If it's
-        * not, then the user is trying to mess with us.
-        */
-       if (regs->ARM_sp & 7)
-               goto badframe;
-
-       frame = (struct sigframe *)regs->ARM_sp;
-
-       if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
-               goto badframe;
-       if (__get_user(set.sig[0], &frame->sc.oldmask)
-           || (_NSIG_WORDS > 1
-               && __copy_from_user(&set.sig[1], &frame->extramask,
-                                   sizeof(frame->extramask))))
-               goto badframe;
-
-       sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       if (restore_sigcontext(regs, &frame->sc))
-               goto badframe;
-
-       /* Send SIGTRAP if we're single-stepping */
-       if (current->ptrace & PT_SINGLESTEP) {
-                ptrace_cancel_bpt(current);
-                send_sig(SIGTRAP, current, 1);
-        }
-
-       return regs->ARM_r0;
-
-badframe:
-       force_sig(SIGSEGV, current);
-       return 0;
-}
-
-asmlinkage int sys_rt_sigreturn(struct pt_regs *regs)
-{
-       struct rt_sigframe *frame;
-       sigset_t set;
-
-       /*
-        * Since we stacked the signal on a 64-bit boundary,
-        * then 'sp' should be word aligned here.  If it's
-        * not, then the user is trying to mess with us.
-        */
-       if (regs->ARM_sp & 7)
-               goto badframe;
-
-       frame = (struct rt_sigframe *)regs->ARM_sp;
-
-       if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
-               goto badframe;
-       if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
-               goto badframe;
-
-       sigdelsetmask(&set, ~_BLOCKABLE);
-       spin_lock_irq(&current->sighand->siglock);
-       current->blocked = set;
-       recalc_sigpending();
-       spin_unlock_irq(&current->sighand->siglock);
-
-       if (restore_sigcontext(regs, &frame->uc.uc_mcontext))
-               goto badframe;
-
-       /* Send SIGTRAP if we're single-stepping */
-       if (current->ptrace & PT_SINGLESTEP) {
-                ptrace_cancel_bpt(current);
-                send_sig(SIGTRAP, current, 1);
-        }
-
-       return regs->ARM_r0;
-
-badframe:
-       force_sig(SIGSEGV, current);
-       return 0;
-}
-
-static int
-setup_sigcontext(struct sigcontext *sc, /*struct _fpstate *fpstate,*/
-                struct pt_regs *regs, unsigned long mask)
-{
-       int err = 0;
-
-       __put_user_error(regs->ARM_r0, &sc->arm_r0, err);
-       __put_user_error(regs->ARM_r1, &sc->arm_r1, err);
-       __put_user_error(regs->ARM_r2, &sc->arm_r2, err);
-       __put_user_error(regs->ARM_r3, &sc->arm_r3, err);
-       __put_user_error(regs->ARM_r4, &sc->arm_r4, err);
-       __put_user_error(regs->ARM_r5, &sc->arm_r5, err);
-       __put_user_error(regs->ARM_r6, &sc->arm_r6, err);
-       __put_user_error(regs->ARM_r7, &sc->arm_r7, err);
-       __put_user_error(regs->ARM_r8, &sc->arm_r8, err);
-       __put_user_error(regs->ARM_r9, &sc->arm_r9, err);
-       __put_user_error(regs->ARM_r10, &sc->arm_r10, err);
-       __put_user_error(regs->ARM_fp, &sc->arm_fp, err);
-       __put_user_error(regs->ARM_ip, &sc->arm_ip, err);
-       __put_user_error(regs->ARM_sp, &sc->arm_sp, err);
-       __put_user_error(regs->ARM_lr, &sc->arm_lr, err);
-       __put_user_error(regs->ARM_pc, &sc->arm_pc, err);
-
-       __put_user_error(current->thread.trap_no, &sc->trap_no, err);
-       __put_user_error(current->thread.error_code, &sc->error_code, err);
-       __put_user_error(current->thread.address, &sc->fault_address, err);
-       __put_user_error(mask, &sc->oldmask, err);
-
-       return err;
-}
-
-static inline void *
-get_sigframe(struct k_sigaction *ka, struct pt_regs *regs, int framesize)
-{
-       unsigned long sp = regs->ARM_sp;
-
-       /*
-        * This is the X/Open sanctioned signal stack switching.
-        */
-       if ((ka->sa.sa_flags & SA_ONSTACK) && !sas_ss_flags(sp))
-               sp = current->sas_ss_sp + current->sas_ss_size;
-
-       /*
-        * ATPCS B01 mandates 8-byte alignment
-        */
-       return (void *)((sp - framesize) & ~7);
-}
-
-static int
-setup_return(struct pt_regs *regs, struct k_sigaction *ka,
-            unsigned long *rc, void *frame, int usig)
-{
-       unsigned long handler = (unsigned long)ka->sa.sa_handler;
-       unsigned long retcode;
-
-       if (ka->sa.sa_flags & SA_RESTORER) {
-               retcode = (unsigned long)ka->sa.sa_restorer;
-       } else {
-
-               if (__put_user((ka->sa.sa_flags & SA_SIGINFO)?SWI_SYS_RT_SIGRETURN:SWI_SYS_SIGRETURN, rc))
-                       return 1;
-
-               retcode = ((unsigned long)rc);
-       }
-
-       regs->ARM_r0 = usig;
-       regs->ARM_sp = (unsigned long)frame;
-       regs->ARM_lr = retcode;
-       regs->ARM_pc = handler & ~3;
-
-       return 0;
-}
-
-static int
-setup_frame(int usig, struct k_sigaction *ka, sigset_t *set, struct pt_regs *regs)
-{
-       struct sigframe *frame = get_sigframe(ka, regs, sizeof(*frame));
-       int err = 0;
-
-       if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
-               return 1;
-
-       err |= setup_sigcontext(&frame->sc, /*&frame->fpstate,*/ regs, set->sig[0]);
-
-       if (_NSIG_WORDS > 1) {
-               err |= __copy_to_user(frame->extramask, &set->sig[1],
-                                     sizeof(frame->extramask));
-       }
-
-       if (err == 0)
-               err = setup_return(regs, ka, &frame->retcode, frame, usig);
-
-       return err;
-}
-
-static int
-setup_rt_frame(int usig, struct k_sigaction *ka, siginfo_t *info,
-              sigset_t *set, struct pt_regs *regs)
-{
-       struct rt_sigframe *frame = get_sigframe(ka, regs, sizeof(*frame));
-       int err = 0;
-
-       if (!access_ok(VERIFY_WRITE, frame, sizeof (*frame)))
-               return 1;
-
-       __put_user_error(&frame->info, &frame->pinfo, err);
-       __put_user_error(&frame->uc, &frame->puc, err);
-       err |= copy_siginfo_to_user(&frame->info, info);
-
-       /* Clear all the bits of the ucontext we don't use.  */
-       err |= __clear_user(&frame->uc, offsetof(struct ucontext, uc_mcontext));
-
-       err |= setup_sigcontext(&frame->uc.uc_mcontext, /*&frame->fpstate,*/
-                               regs, set->sig[0]);
-       err |= __copy_to_user(&frame->uc.uc_sigmask, set, sizeof(*set));
-
-       if (err == 0)
-               err = setup_return(regs, ka, &frame->retcode, frame, usig);
-
-       if (err == 0) {
-               /*
-                * For realtime signals we must also set the second and third
-                * arguments for the signal handler.
-                *   -- Peter Maydell <pmaydell@chiark.greenend.org.uk> 2000-12-06
-                */
-               regs->ARM_r1 = (unsigned long)frame->pinfo;
-               regs->ARM_r2 = (unsigned long)frame->puc;
-       }
-
-       return err;
-}
-
-static inline void restart_syscall(struct pt_regs *regs)
-{
-        regs->ARM_r0 = regs->ARM_ORIG_r0;
-        regs->ARM_pc -= 4;
-}
-
-/*
- * OK, we're invoking a handler
- */    
-static void
-handle_signal(unsigned long sig, siginfo_t *info, sigset_t *oldset,
-             struct pt_regs * regs, int syscall)
-{
-       struct thread_info *thread = current_thread_info();
-       struct task_struct *tsk = current;
-       struct k_sigaction *ka = &tsk->sighand->action[sig-1];
-       int usig = sig;
-       int ret;
-
-        /*
-         * If we were from a system call, check for system call restarting...
-         */
-        if (syscall) {
-                switch (regs->ARM_r0) {
-                case -ERESTART_RESTARTBLOCK:
-                        current_thread_info()->restart_block.fn =
-                                do_no_restart_syscall;
-                case -ERESTARTNOHAND:
-                        regs->ARM_r0 = -EINTR;
-                        break;
-                case -ERESTARTSYS:
-                        if (!(ka->sa.sa_flags & SA_RESTART)) {
-                                regs->ARM_r0 = -EINTR;
-                                break;
-                        }
-                        /* fallthrough */
-                case -ERESTARTNOINTR:
-                        restart_syscall(regs);
-                }
-        }
-
-       /*
-        * translate the signal
-        */
-       if (usig < 32 && thread->exec_domain && thread->exec_domain->signal_invmap)
-               usig = thread->exec_domain->signal_invmap[usig];
-
-       /*
-        * Set up the stack frame
-        */
-       if (ka->sa.sa_flags & SA_SIGINFO)
-               ret = setup_rt_frame(usig, ka, info, oldset, regs);
-       else
-               ret = setup_frame(usig, ka, oldset, regs);
-
-       /*
-        * Check that the resulting registers are actually sane.
-        */
-       ret |= !valid_user_regs(regs);
-
-       if (ret == 0) {
-               if (ka->sa.sa_flags & SA_ONESHOT)
-                       ka->sa.sa_handler = SIG_DFL;
-
-               spin_lock_irq(&tsk->sighand->siglock);
-               sigorsets(&tsk->blocked, &tsk->blocked,
-                         &ka->sa.sa_mask);
-               if (!(ka->sa.sa_flags & SA_NODEFER))
-                       sigaddset(&tsk->blocked, sig);
-               recalc_sigpending();
-               spin_unlock_irq(&tsk->sighand->siglock);
-               return;
-       }
-
-       force_sigsegv(sig, tsk);
-}
-
-/*
- * Note that 'init' is a special process: it doesn't get signals it doesn't
- * want to handle. Thus you cannot kill init even with a SIGKILL even by
- * mistake.
- *
- * Note that we go through the signals twice: once to check the signals that
- * the kernel can handle, and then we build all the user-level signal handling
- * stack-frames in one go after that.
- */
-static int do_signal(sigset_t *oldset, struct pt_regs *regs, int syscall)
-{
-       siginfo_t info;
-       int signr;
-       struct k_sigaction ka;
-
-       /*
-        * We want the common case to go fast, which
-        * is why we may in certain cases get here from
-        * kernel mode. Just return without doing anything
-        * if so.
-        */
-       if (!user_mode(regs))
-               return 0;
-
-        if (current->ptrace & PT_SINGLESTEP)
-                ptrace_cancel_bpt(current);
-       
-        signr = get_signal_to_deliver(&info, &ka, regs, NULL);
-        if (signr > 0) {
-                handle_signal(signr, &info, oldset, regs, syscall);
-                if (current->ptrace & PT_SINGLESTEP)
-                        ptrace_set_bpt(current);
-                return 1;
-        }
-
-        /*
-         * No signal to deliver to the process - restart the syscall.
-         */
-        if (syscall) {
-                if (regs->ARM_r0 == -ERESTART_RESTARTBLOCK) {
-                        u32 *usp;
-
-                        regs->ARM_sp -= 12;
-                        usp = (u32 *)regs->ARM_sp;
-
-                        put_user(regs->ARM_pc, &usp[0]);
-                        /* swi __NR_restart_syscall */
-                        put_user(0xef000000 | __NR_restart_syscall, &usp[1]);
-                        /* ldr  pc, [sp], #12 */
-// FIXME!!! is #12 correct there?
-                        put_user(0xe49df00c, &usp[2]);
-
-                        regs->ARM_pc = regs->ARM_sp + 4;
-                }
-                if (regs->ARM_r0 == -ERESTARTNOHAND ||
-                    regs->ARM_r0 == -ERESTARTSYS ||
-                    regs->ARM_r0 == -ERESTARTNOINTR) {
-                        restart_syscall(regs);
-                }
-        }
-        if (current->ptrace & PT_SINGLESTEP)
-                ptrace_set_bpt(current);
-        return 0;
-}
-
-asmlinkage void
-do_notify_resume(struct pt_regs *regs, unsigned int thread_flags, int syscall)
-{
-       if (thread_flags & _TIF_SIGPENDING)
-               do_signal(&current->blocked, regs, syscall);
-}
diff --git a/arch/arm26/kernel/sys_arm.c b/arch/arm26/kernel/sys_arm.c
deleted file mode 100644 (file)
index dc05aba..0000000
+++ /dev/null
@@ -1,323 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/sys_arm.c
- *
- *  Copyright (C) People who wrote linux/arch/i386/kernel/sys_i386.c
- *  Copyright (C) 1995, 1996 Russell King.
- *  Copyright (C) 2003 Ian Molton.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  This file contains various random system calls that
- *  have a non-standard calling sequence on the Linux/arm
- *  platform.
- */
-#include <linux/module.h>
-#include <linux/errno.h>
-#include <linux/sched.h>
-#include <linux/slab.h>
-#include <linux/mm.h>
-#include <linux/sem.h>
-#include <linux/msg.h>
-#include <linux/shm.h>
-#include <linux/stat.h>
-#include <linux/syscalls.h>
-#include <linux/mman.h>
-#include <linux/fs.h>
-#include <linux/file.h>
-#include <linux/utsname.h>
-
-#include <asm/uaccess.h>
-#include <asm/ipc.h>
-
-extern unsigned long do_mremap(unsigned long addr, unsigned long old_len,
-                              unsigned long new_len, unsigned long flags,
-                              unsigned long new_addr);
-
-/*
- * 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)
-{
-       int fd[2];
-       int error;
-
-       error = do_pipe(fd);
-       if (!error) {
-               if (copy_to_user(fildes, fd, 2*sizeof(int)))
-                       error = -EFAULT;
-       }
-       return error;
-}
-
-/* common code for old and new mmaps */
-inline long do_mmap2(
-       unsigned long addr, unsigned long len,
-       unsigned long prot, unsigned long flags,
-       unsigned long fd, unsigned long pgoff)
-{
-       int error = -EINVAL;
-       struct file * file = NULL;
-
-       flags &= ~(MAP_EXECUTABLE | MAP_DENYWRITE);
-
-       /*
-        * If we are doing a fixed mapping, and address < FIRST_USER_ADDRESS,
-        * then deny it.
-        */
-       if (flags & MAP_FIXED && addr < FIRST_USER_ADDRESS)
-               goto out;
-
-       error = -EBADF;
-       if (!(flags & MAP_ANONYMOUS)) {
-               file = fget(fd);
-               if (!file)
-                       goto out;
-       }
-
-       down_write(&current->mm->mmap_sem);
-       error = do_mmap_pgoff(file, addr, len, prot, flags, pgoff);
-       up_write(&current->mm->mmap_sem);
-
-       if (file)
-               fput(file);
-out:
-       return error;
-}
-
-struct mmap_arg_struct {
-       unsigned long addr;
-       unsigned long len;
-       unsigned long prot;
-       unsigned long flags;
-       unsigned long fd;
-       unsigned long offset;
-};
-
-asmlinkage int old_mmap(struct mmap_arg_struct *arg)
-{
-       int error = -EFAULT;
-       struct mmap_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               goto out;
-
-       error = -EINVAL;
-       if (a.offset & ~PAGE_MASK)
-               goto out;
-
-       error = do_mmap2(a.addr, a.len, a.prot, a.flags, a.fd, a.offset >> PAGE_SHIFT);
-out:
-       return error;
-}
-
-asmlinkage unsigned long
-sys_arm_mremap(unsigned long addr, unsigned long old_len,
-              unsigned long new_len, unsigned long flags,
-              unsigned long new_addr)
-{
-       unsigned long ret = -EINVAL;
-
-       /*
-        * If we are doing a fixed mapping, and address < FIRST_USER_ADDRESS,
-        * then deny it.
-        */
-       if (flags & MREMAP_FIXED && new_addr < FIRST_USER_ADDRESS)
-               goto out;
-
-       down_write(&current->mm->mmap_sem);
-       ret = do_mremap(addr, old_len, new_len, flags, new_addr);
-       up_write(&current->mm->mmap_sem);
-
-out:
-       return ret;
-}
-
-/*
- * Perform the select(nd, in, out, ex, tv) and mmap() system
- * calls.
- */
-
-struct sel_arg_struct {
-       unsigned long n;
-       fd_set *inp, *outp, *exp;
-       struct timeval *tvp;
-};
-
-asmlinkage int old_select(struct sel_arg_struct *arg)
-{
-       struct sel_arg_struct a;
-
-       if (copy_from_user(&a, arg, sizeof(a)))
-               return -EFAULT;
-       /* sys_select() does the appropriate kernel locking */
-       return sys_select(a.n, a.inp, a.outp, a.exp, a.tvp);
-}
-
-/*
- * sys_ipc() is the de-multiplexer for the SysV IPC calls..
- *
- * This is really horribly ugly.
- */
-asmlinkage int sys_ipc (uint call, int first, int second, int third, void *ptr, long fifth)
-{
-       int version, ret;
-
-       version = call >> 16; /* hack for backward compatibility */
-       call &= 0xffff;
-
-       switch (call) {
-       case SEMOP:
-               return sys_semop (first, (struct sembuf *)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))
-                       return -EFAULT;
-               return sys_semctl (first, second, third, fourth);
-       }
-
-       case MSGSND:
-               return sys_msgsnd (first, (struct msgbuf *) 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)))
-                               return -EFAULT;
-                       return sys_msgrcv (first, tmp.msgp, second,
-                                          tmp.msgtyp, third);
-               }
-               default:
-                       return sys_msgrcv (first,
-                                          (struct msgbuf *) ptr,
-                                          second, fifth, third);
-               }
-       case MSGGET:
-               return sys_msgget ((key_t) first, second);
-       case MSGCTL:
-               return sys_msgctl (first, second, (struct msqid_ds *) ptr);
-
-       case SHMAT:
-               switch (version) {
-               default: {
-                       ulong raddr;
-                       ret = do_shmat (first, (char *) ptr, second, &raddr);
-                       if (ret)
-                               return ret;
-                       return put_user (raddr, (ulong *) third);
-               }
-               case 1: /* iBCS2 emulator entry point */
-                       if (!segment_eq(get_fs(), get_ds()))
-                               return -EINVAL;
-                       return do_shmat (first, (char *) ptr,
-                                         second, (ulong *) third);
-               }
-       case SHMDT: 
-               return sys_shmdt ((char *)ptr);
-       case SHMGET:
-               return sys_shmget (first, second, third);
-       case SHMCTL:
-               return sys_shmctl (first, second,
-                                  (struct shmid_ds *) ptr);
-       default:
-               return -EINVAL;
-       }
-}
-
-/* Fork a new task - this creates a new program thread.
- * This is called indirectly via a small wrapper
- */
-asmlinkage int sys_fork(struct pt_regs *regs)
-{
-       return do_fork(SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
-}
-
-/* Clone a task - this clones the calling program thread.
- * This is called indirectly via a small wrapper
- */
-asmlinkage int sys_clone(unsigned long clone_flags, unsigned long newsp, struct pt_regs *regs)
-{
-       /*
-         * We don't support SETTID / CLEARTID  (FIXME!!! (nicked from arm32))
-         */
-        if (clone_flags & (CLONE_PARENT_SETTID | CLONE_CHILD_CLEARTID))
-                return -EINVAL;
-       
-       if (!newsp)
-               newsp = regs->ARM_sp;
-
-       return do_fork(clone_flags, newsp, regs, 0, NULL, NULL);
-}
-
-asmlinkage int sys_vfork(struct pt_regs *regs)
-{
-       return do_fork(CLONE_VFORK | CLONE_VM | SIGCHLD, regs->ARM_sp, regs, 0, NULL, NULL);
-}
-
-/* sys_execve() executes a new program.
- * This is called indirectly via a small wrapper
- */
-asmlinkage int sys_execve(char *filenamei, char **argv, char **envp, struct pt_regs *regs)
-{
-       int error;
-       char * filename;
-
-       filename = getname(filenamei);
-       error = PTR_ERR(filename);
-       if (IS_ERR(filename))
-               goto out;
-       error = do_execve(filename, argv, envp, regs);
-       putname(filename);
-out:
-       return error;
-}
-
-/* FIXME - see if this is correct for arm26 */
-int kernel_execve(const char *filename, char *const argv[], char *const envp[])
-{
-       struct pt_regs regs;
-        int ret;
-         memset(&regs, 0, sizeof(struct pt_regs));
-        ret = do_execve((char *)filename, (char __user * __user *)argv,                         (char __user * __user *)envp, &regs);
-        if (ret < 0)
-                goto out;
-
-        /*
-         * Save argc to the register structure for userspace.
-         */
-        regs.ARM_r0 = ret;
-
-        /*
-         * We were successful.  We won't be returning to our caller, but
-         * instead to user space by manipulating the kernel stack.
-         */
-        asm(    "add    r0, %0, %1\n\t"
-                "mov    r1, %2\n\t"
-                "mov    r2, %3\n\t"
-                "bl     memmove\n\t"    /* copy regs to top of stack */
-                "mov    r8, #0\n\t"     /* not a syscall */
-                "mov    r9, %0\n\t"     /* thread structure */
-                "mov    sp, r0\n\t"     /* reposition stack pointer */
-                "b      ret_to_user"
-                :
-                : "r" (current_thread_info()),
-                  "Ir" (THREAD_SIZE - 8 - sizeof(regs)),
-                  "r" (&regs),
-                  "Ir" (sizeof(regs))
-                : "r0", "r1", "r2", "r3", "ip", "memory");
-
- out:
-        return ret;
-}
-
-EXPORT_SYMBOL(kernel_execve);
diff --git a/arch/arm26/kernel/time.c b/arch/arm26/kernel/time.c
deleted file mode 100644 (file)
index 0f1d57f..0000000
+++ /dev/null
@@ -1,210 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/time.c
- *
- *  Copyright (C) 1991, 1992, 1995  Linus Torvalds
- *  Modifications for ARM (C) 1994-2001 Russell King
- *  Mods for ARM26 (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  This file contains the ARM-specific time handling details:
- *  reading the RTC at bootup, etc...
- *
- *  1994-07-02  Alan Modra
- *              fixed set_rtc_mmss, fixed time.year for >= 2000, new mktime
- *  1998-12-20  Updated NTP code according to technical memorandum Jan '96
- *              "A Kernel Model for Precision Timekeeping" by Dave Mills
- */
-
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/time.h>
-#include <linux/init.h>
-#include <linux/smp.h>
-#include <linux/timex.h>
-#include <linux/errno.h>
-#include <linux/profile.h>
-
-#include <asm/hardware.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/ioc.h>
-
-/* this needs a better home */
-DEFINE_SPINLOCK(rtc_lock);
-
-/* change this if you have some constant time drift */
-#define USECS_PER_JIFFY        (1000000/HZ)
-
-static int dummy_set_rtc(void)
-{
-       return 0;
-}
-
-/*
- * hook for setting the RTC's idea of the current time.
- */
-int (*set_rtc)(void) = dummy_set_rtc;
-
-/*
- * Get time offset based on IOCs timer.
- * FIXME - if this is called with interrutps off, why the shennanigans
- * below ?
- */
-static unsigned long gettimeoffset(void)
-{
-        unsigned int count1, count2, status;
-        long offset;
-
-        ioc_writeb (0, IOC_T0LATCH);
-        barrier ();
-        count1 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
-        barrier ();
-        status = ioc_readb(IOC_IRQREQA);
-        barrier ();
-        ioc_writeb (0, IOC_T0LATCH);
-        barrier ();
-        count2 = ioc_readb(IOC_T0CNTL) | (ioc_readb(IOC_T0CNTH) << 8);
-
-        offset = count2;
-        if (count2 < count1) {
-                /*
-                 * We have not had an interrupt between reading count1
-                 * and count2.
-                 */
-                if (status & (1 << 5))
-                        offset -= LATCH;
-        } else if (count2 > count1) {
-                /*
-                 * We have just had another interrupt between reading
-                 * count1 and count2.
-                 */
-                offset -= LATCH;
-        }
-
-        offset = (LATCH - offset) * (tick_nsec / 1000);
-        return (offset + LATCH/2) / LATCH;
-}
-
-static unsigned long next_rtc_update;
-
-/*
- * If we have an externally synchronized linux clock, then update
- * CMOS clock accordingly every ~11 minutes.  set_rtc() has to be
- * called as close as possible to 500 ms before the new second
- * starts.
- */
-static inline void do_set_rtc(void)
-{
-       if (!ntp_synced() || set_rtc == NULL)
-               return;
-
-//FIXME - timespec.tv_sec is a time_t not unsigned long
-       if (next_rtc_update &&
-           time_before((unsigned long)xtime.tv_sec, next_rtc_update))
-               return;
-
-       if (xtime.tv_nsec < 500000000 - ((unsigned) tick_nsec >> 1) &&
-           xtime.tv_nsec >= 500000000 + ((unsigned) tick_nsec >> 1))
-               return;
-
-       if (set_rtc())
-               /*
-                * rtc update failed.  Try again in 60s
-                */
-               next_rtc_update = xtime.tv_sec + 60;
-       else
-               next_rtc_update = xtime.tv_sec + 660;
-}
-
-#define do_leds()
-
-void do_gettimeofday(struct timeval *tv)
-{
-       unsigned long flags;
-       unsigned long seq;
-       unsigned long usec, sec;
-
-       do {
-               seq = read_seqbegin_irqsave(&xtime_lock, flags);
-               usec = gettimeoffset();
-               sec = xtime.tv_sec;
-               usec += xtime.tv_nsec / 1000;
-       } while (read_seqretry_irqrestore(&xtime_lock, seq, flags));
-
-       /* usec may have gone up a lot: be safe */
-       while (usec >= 1000000) {
-               usec -= 1000000;
-               sec++;
-       }
-
-       tv->tv_sec = sec;
-       tv->tv_usec = usec;
-}
-
-EXPORT_SYMBOL(do_gettimeofday);
-
-int do_settimeofday(struct timespec *tv)
-{
-       if ((unsigned long)tv->tv_nsec >= NSEC_PER_SEC)
-               return -EINVAL;
-
-       write_seqlock_irq(&xtime_lock);
-       /*
-        * This is revolting. We need to set "xtime" correctly. However, the
-        * value in this location is the value at the most recent update of
-        * wall time.  Discover what correction gettimeofday() would have
-        * done, and then undo it!
-        */
-       tv->tv_nsec -= 1000 * gettimeoffset();
-
-       while (tv->tv_nsec < 0) {
-               tv->tv_nsec += NSEC_PER_SEC;
-               tv->tv_sec--;
-       }
-
-       xtime.tv_sec = tv->tv_sec;
-       xtime.tv_nsec = tv->tv_nsec;
-       ntp_clear();
-       write_sequnlock_irq(&xtime_lock);
-       clock_was_set();
-       return 0;
-}
-
-EXPORT_SYMBOL(do_settimeofday);
-
-static irqreturn_t timer_interrupt(int irq, void *dev_id, struct pt_regs *regs)
-{
-        do_timer(1);
-#ifndef CONFIG_SMP
-       update_process_times(user_mode(regs));
-#endif
-        do_set_rtc(); //FIME - EVERY timer IRQ?
-        profile_tick(CPU_PROFILING, regs);
-       return IRQ_HANDLED; //FIXME - is this right?
-}
-
-static struct irqaction timer_irq = {
-       .name   = "timer",
-       .flags  = IRQF_DISABLED,
-       .handler = timer_interrupt,
-};
-
-extern void ioctime_init(void);
-
-/*
- * Set up timer interrupt.
- */
-void __init time_init(void)
-{
-       ioc_writeb(LATCH & 255, IOC_T0LTCHL);
-        ioc_writeb(LATCH >> 8, IOC_T0LTCHH);
-        ioc_writeb(0, IOC_T0GO);
-
-
-        setup_irq(IRQ_TIMER, &timer_irq);
-}
-
diff --git a/arch/arm26/kernel/traps.c b/arch/arm26/kernel/traps.c
deleted file mode 100644 (file)
index 2911e2e..0000000
+++ /dev/null
@@ -1,548 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/traps.c
- *
- *  Copyright (C) 1995-2002 Russell King
- *  Fragments that appear the same as linux/arch/i386/kernel/traps.c (C) Linus Torvalds
- *  Copyright (C) 2003 Ian Molton (ARM26)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  'traps.c' handles hardware exceptions after we have saved some state in
- *  'linux/arch/arm26/lib/traps.S'.  Mostly a debugging aid, but will probably
- *  kill the offending process.
- */
-
-#include <linux/module.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/spinlock.h>
-#include <linux/personality.h>
-#include <linux/ptrace.h>
-#include <linux/elf.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-
-#include <asm/atomic.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-#include <asm/unistd.h>
-#include <linux/mutex.h>
-
-#include "ptrace.h"
-
-extern void c_backtrace (unsigned long fp, int pmode);
-extern void show_pte(struct mm_struct *mm, unsigned long addr);
-
-const char *processor_modes[] = { "USER_26", "FIQ_26" , "IRQ_26" , "SVC_26" };
-
-static const char *handler[]= { "prefetch abort", "data abort", "address exception", "interrupt" "*bad reason*"};
-
-/*
- * Stack pointers should always be within the kernels view of
- * physical memory.  If it is not there, then we can't dump
- * out any information relating to the stack.
- */
-static int verify_stack(unsigned long sp)
-{
-       if (sp < PAGE_OFFSET || (sp > (unsigned long)high_memory && high_memory != 0))
-               return -EFAULT;
-
-       return 0;
-}
-
-/*
- * Dump out the contents of some memory nicely...
- */
-static void dump_mem(const char *str, unsigned long bottom, unsigned long top)
-{
-       unsigned long p = bottom & ~31;
-       mm_segment_t fs;
-       int i;
-
-       /*
-        * We need to switch to kernel mode so that we can use __get_user
-        * to safely read from kernel space.  Note that we now dump the
-        * code first, just in case the backtrace kills us.
-        */
-       fs = get_fs();
-       set_fs(KERNEL_DS);
-
-       printk("%s", str);
-       printk("(0x%08lx to 0x%08lx)\n", bottom, top);
-
-       for (p = bottom & ~31; p < top;) {
-               printk("%04lx: ", p & 0xffff);
-
-               for (i = 0; i < 8; i++, p += 4) {
-                       unsigned int val;
-
-                       if (p < bottom || p >= top)
-                               printk("         ");
-                       else {
-                               __get_user(val, (unsigned long *)p);
-                               printk("%08x ", val);
-                       }
-               }
-               printk ("\n");
-       }
-
-       set_fs(fs);
-}
-
-static void dump_instr(struct pt_regs *regs)
-{
-       unsigned long addr = instruction_pointer(regs);
-       const int width = 8;
-       mm_segment_t fs;
-       int i;
-
-       /*
-        * We need to switch to kernel mode so that we can use __get_user
-        * to safely read from kernel space.  Note that we now dump the
-        * code first, just in case the backtrace kills us.
-        */
-       fs = get_fs();
-       set_fs(KERNEL_DS);
-
-       printk("Code: ");
-       for (i = -4; i < 1; i++) {
-               unsigned int val, bad;
-
-               bad = __get_user(val, &((u32 *)addr)[i]);
-
-               if (!bad)
-                       printk(i == 0 ? "(%0*x) " : "%0*x ", width, val);
-               else {
-                       printk("bad PC value.");
-                       break;
-               }
-       }
-       printk("\n");
-
-       set_fs(fs);
-}
-
-/*static*/ void __dump_stack(struct task_struct *tsk, unsigned long sp)
-{
-       dump_mem("Stack: ", sp, 8192+(unsigned long)task_stack_page(tsk));
-}
-
-void dump_stack(void)
-{
-#ifdef CONFIG_DEBUG_ERRORS
-        __backtrace();
-#endif
-}
-
-EXPORT_SYMBOL(dump_stack);
-
-//FIXME - was a static fn
-void dump_backtrace(struct pt_regs *regs, struct task_struct *tsk)
-{
-       unsigned int fp;
-       int ok = 1;
-
-       printk("Backtrace: ");
-       fp = regs->ARM_fp;
-       if (!fp) {
-               printk("no frame pointer");
-               ok = 0;
-       } else if (verify_stack(fp)) {
-               printk("invalid frame pointer 0x%08x", fp);
-               ok = 0;
-       } else if (fp < (unsigned long)end_of_stack(tsk))
-               printk("frame pointer underflow");
-       printk("\n");
-
-       if (ok)
-               c_backtrace(fp, processor_mode(regs));
-}
-
-/* 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_stack_page(task));
-}
-
-DEFINE_SPINLOCK(die_lock);
-
-/*
- * This function is protected against re-entrancy.
- */
-NORET_TYPE void die(const char *str, struct pt_regs *regs, int err)
-{
-       struct task_struct *tsk = current;
-
-       console_verbose();
-       spin_lock_irq(&die_lock);
-
-       printk("Internal error: %s: %x\n", str, err);
-       printk("CPU: %d\n", smp_processor_id());
-       show_regs(regs);
-       add_taint(TAINT_DIE);
-       printk("Process %s (pid: %d, stack limit = 0x%p)\n",
-               current->comm, current->pid, end_of_stack(tsk));
-
-       if (!user_mode(regs) || in_interrupt()) {
-               __dump_stack(tsk, (unsigned long)(regs + 1));
-               dump_backtrace(regs, tsk);
-               dump_instr(regs);
-       }
-while(1);
-       spin_unlock_irq(&die_lock);
-       do_exit(SIGSEGV);
-}
-
-void die_if_kernel(const char *str, struct pt_regs *regs, int err)
-{
-       if (user_mode(regs))
-               return;
-
-       die(str, regs, err);
-}
-
-static DEFINE_MUTEX(undef_mutex);
-static int (*undef_hook)(struct pt_regs *);
-
-int request_undef_hook(int (*fn)(struct pt_regs *))
-{
-       int ret = -EBUSY;
-
-       mutex_lock(&undef_mutex);
-       if (undef_hook == NULL) {
-               undef_hook = fn;
-               ret = 0;
-       }
-       mutex_unlock(&undef_mutex);
-
-       return ret;
-}
-
-int release_undef_hook(int (*fn)(struct pt_regs *))
-{
-       int ret = -EINVAL;
-
-       mutex_lock(&undef_mutex);
-       if (undef_hook == fn) {
-               undef_hook = NULL;
-               ret = 0;
-       }
-       mutex_unlock(&undef_mutex);
-
-       return ret;
-}
-
-static int undefined_extension(struct pt_regs *regs, unsigned int op)
-{
-       switch (op) {
-       case 1: /* 0xde01 / 0x?7f001f0 */
-               ptrace_break(current, regs);
-               return 0;
-       }
-       return 1;
-}
-
-asmlinkage void do_undefinstr(struct pt_regs *regs)
-{
-       siginfo_t info;
-       void *pc;
-
-       regs->ARM_pc -= 4;
-
-       pc = (unsigned long *)instruction_pointer(regs); /* strip PSR */
-
-       if (user_mode(regs)) {
-               u32 instr;
-
-               get_user(instr, (u32 *)pc);
-
-               if ((instr & 0x0fff00ff) == 0x07f000f0 &&
-                   undefined_extension(regs, (instr >> 8) & 255) == 0) {
-                       regs->ARM_pc += 4;
-                       return;
-               }
-       } else {
-               if (undef_hook && undef_hook(regs) == 0) {
-                       regs->ARM_pc += 4;
-                       return;
-               }
-       }
-
-#ifdef CONFIG_DEBUG_USER
-       printk(KERN_INFO "%s (%d): undefined instruction: pc=%p\n",
-               current->comm, current->pid, pc);
-       dump_instr(regs);
-#endif
-
-       current->thread.error_code = 0;
-       current->thread.trap_no = 6;
-
-       info.si_signo = SIGILL;
-       info.si_errno = 0;
-       info.si_code  = ILL_ILLOPC;
-       info.si_addr  = pc;
-
-       force_sig_info(SIGILL, &info, current);
-
-       die_if_kernel("Oops - undefined instruction", regs, 0);
-}
-
-asmlinkage void do_excpt(unsigned long address, struct pt_regs *regs, int mode)
-{
-       siginfo_t info;
-
-#ifdef CONFIG_DEBUG_USER
-       printk(KERN_INFO "%s (%d): address exception: pc=%08lx\n",
-               current->comm, current->pid, instruction_pointer(regs));
-       dump_instr(regs);
-#endif
-
-       current->thread.error_code = 0;
-       current->thread.trap_no = 11;
-
-       info.si_signo = SIGBUS;
-       info.si_errno = 0;
-       info.si_code  = BUS_ADRERR;
-       info.si_addr  = (void *)address;
-
-       force_sig_info(SIGBUS, &info, current);
-
-       die_if_kernel("Oops - address exception", regs, mode);
-}
-
-asmlinkage void do_unexp_fiq (struct pt_regs *regs)
-{
-#ifndef CONFIG_IGNORE_FIQ
-       printk("Hmm.  Unexpected FIQ received, but trying to continue\n");
-       printk("You may have a hardware problem...\n");
-#endif
-}
-
-/*
- * bad_mode handles the impossible case in the vectors.  If you see one of
- * these, then it's extremely serious, and could mean you have buggy hardware.
- * It never returns, and never tries to sync.  We hope that we can at least
- * dump out some state information...
- */
-asmlinkage void bad_mode(struct pt_regs *regs, int reason, int proc_mode)
-{
-       unsigned int vectors = vectors_base();
-
-       console_verbose();
-
-       printk(KERN_CRIT "Bad mode in %s handler detected: mode %s\n",
-               handler[reason<5?reason:4], processor_modes[proc_mode]);
-
-       /*
-        * Dump out the vectors and stub routines.  Maybe a better solution
-        * would be to dump them out only if we detect that they are corrupted.
-        */
-       dump_mem(KERN_CRIT "Vectors: ", vectors, vectors + 0x40);
-       dump_mem(KERN_CRIT "Stubs: ", vectors + 0x200, vectors + 0x4b8);
-
-       die("Oops", regs, 0);
-       local_irq_disable();
-       panic("bad mode");
-}
-
-static int bad_syscall(int n, struct pt_regs *regs)
-{
-       struct thread_info *thread = current_thread_info();
-       siginfo_t info;
-
-       if (current->personality != PER_LINUX && thread->exec_domain->handler) {
-               thread->exec_domain->handler(n, regs);
-               return regs->ARM_r0;
-       }
-
-#ifdef CONFIG_DEBUG_USER
-       printk(KERN_ERR "[%d] %s: obsolete system call %08x.\n",
-               current->pid, current->comm, n);
-       dump_instr(regs);
-#endif
-
-       info.si_signo = SIGILL;
-       info.si_errno = 0;
-       info.si_code  = ILL_ILLTRP;
-       info.si_addr  = (void *)instruction_pointer(regs) - 4;
-
-       force_sig_info(SIGILL, &info, current);
-       die_if_kernel("Oops", regs, n);
-       return regs->ARM_r0;
-}
-
-static inline void
-do_cache_op(unsigned long start, unsigned long end, int flags)
-{
-       struct vm_area_struct *vma;
-
-       if (end < start)
-               return;
-
-       vma = find_vma(current->active_mm, start);
-       if (vma && vma->vm_start < end) {
-               if (start < vma->vm_start)
-                       start = vma->vm_start;
-               if (end > vma->vm_end)
-                       end = vma->vm_end;
-       }
-}
-
-/*
- * Handle all unrecognised system calls.
- *  0x9f0000 - 0x9fffff are some more esoteric system calls
- */
-#define NR(x) ((__ARM_NR_##x) - __ARM_NR_BASE)
-asmlinkage int arm_syscall(int no, struct pt_regs *regs)
-{
-       siginfo_t info;
-
-       if ((no >> 16) != 0x9f)
-               return bad_syscall(no, regs);
-
-       switch (no & 0xffff) {
-       case 0: /* branch through 0 */
-               info.si_signo = SIGSEGV;
-               info.si_errno = 0;
-               info.si_code  = SEGV_MAPERR;
-               info.si_addr  = NULL;
-
-               force_sig_info(SIGSEGV, &info, current);
-
-               die_if_kernel("branch through zero", regs, 0);
-               return 0;
-
-       case NR(breakpoint): /* SWI BREAK_POINT */
-               ptrace_break(current, regs);
-               return regs->ARM_r0;
-
-       case NR(cacheflush):
-               return 0;
-
-       case NR(usr26):
-               break;
-
-       default:
-               /* Calls 9f00xx..9f07ff are defined to return -ENOSYS
-                  if not implemented, rather than raising SIGILL.  This
-                  way the calling program can gracefully determine whether
-                  a feature is supported.  */
-               if (no <= 0x7ff)
-                       return -ENOSYS;
-               break;
-       }
-#ifdef CONFIG_DEBUG_USER
-       /*
-        * experience shows that these seem to indicate that
-        * something catastrophic has happened
-        */
-       printk("[%d] %s: arm syscall %d\n", current->pid, current->comm, no);
-       dump_instr(regs);
-       if (user_mode(regs)) {
-               show_regs(regs);
-               c_backtrace(regs->ARM_fp, processor_mode(regs));
-       }
-#endif
-       info.si_signo = SIGILL;
-       info.si_errno = 0;
-       info.si_code  = ILL_ILLTRP;
-       info.si_addr  = (void *)instruction_pointer(regs) - 4;
-
-       force_sig_info(SIGILL, &info, current);
-       die_if_kernel("Oops", regs, no);
-       return 0;
-}
-
-void __bad_xchg(volatile void *ptr, int size)
-{
-       printk("xchg: bad data size: pc 0x%p, ptr 0x%p, size %d\n",
-               __builtin_return_address(0), ptr, size);
-       BUG();
-}
-
-/*
- * A data abort trap was taken, but we did not handle the instruction.
- * Try to abort the user program, or panic if it was the kernel.
- */
-asmlinkage void
-baddataabort(int code, unsigned long instr, struct pt_regs *regs)
-{
-       unsigned long addr = instruction_pointer(regs);
-       siginfo_t info;
-
-#ifdef CONFIG_DEBUG_USER
-       printk(KERN_ERR "[%d] %s: bad data abort: code %d instr 0x%08lx\n",
-               current->pid, current->comm, code, instr);
-       dump_instr(regs);
-       show_pte(current->mm, addr);
-#endif
-
-       info.si_signo = SIGILL;
-       info.si_errno = 0;
-       info.si_code  = ILL_ILLOPC;
-       info.si_addr  = (void *)addr;
-
-       force_sig_info(SIGILL, &info, current);
-       die_if_kernel("unknown data abort code", regs, instr);
-}
-
-volatile void __bug(const char *file, int line, void *data)
-{
-       printk(KERN_CRIT"kernel BUG at %s:%d!", file, line);
-       if (data)
-               printk(KERN_CRIT" - extra data = %p", data);
-       printk("\n");
-       *(int *)0 = 0;
-}
-
-void __readwrite_bug(const char *fn)
-{
-       printk("%s called, but not implemented", fn);
-       BUG();
-}
-
-void __pte_error(const char *file, int line, unsigned long val)
-{
-       printk("%s:%d: bad pte %08lx.\n", file, line, val);
-}
-
-void __pmd_error(const char *file, int line, unsigned long val)
-{
-       printk("%s:%d: bad pmd %08lx.\n", file, line, val);
-}
-
-void __pgd_error(const char *file, int line, unsigned long val)
-{
-       printk("%s:%d: bad pgd %08lx.\n", file, line, val);
-}
-
-asmlinkage void __div0(void)
-{
-       printk("Division by zero in kernel.\n");
-       dump_stack();
-}
-
-void abort(void)
-{
-       BUG();
-
-       /* if that doesn't kill us, halt */
-       panic("Oops failed to kill thread");
-}
-
-void __init trap_init(void)
-{
-       extern void __trap_init(unsigned long);
-       unsigned long base = vectors_base();
-
-       __trap_init(base);
-       if (base != 0)
-               printk(KERN_DEBUG "Relocating machine vectors to 0x%08lx\n",
-                       base);
-}
diff --git a/arch/arm26/kernel/vmlinux-arm26-xip.lds.in b/arch/arm26/kernel/vmlinux-arm26-xip.lds.in
deleted file mode 100644 (file)
index 4ec715c..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/* ld script to make ARM Linux kernel
- * taken from the i386 version by Russell King
- * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
- * borrowed from Russels ARM port by Ian Molton
- */
-
-#include <asm-generic/vmlinux.lds.h>
-
-OUTPUT_ARCH(arm)
-ENTRY(stext)
-jiffies = jiffies_64;
-SECTIONS
-{
-       . = TEXTADDR;
-       .init : {                       /* Init code and data           */
-               _stext = .;
-               __init_begin = .;
-                       _sinittext = .;
-                       *(.init.text)
-                       _einittext = .;
-               __proc_info_begin = .;
-                       *(.proc.info)
-               __proc_info_end = .;
-               __arch_info_begin = .;
-                       *(.arch.info)
-               __arch_info_end = .;
-               __tagtable_begin = .;
-                       *(.taglist)
-               __tagtable_end = .;
-               . = ALIGN(16);
-               __setup_start = .;
-                       *(.init.setup)
-               __setup_end = .;
-               __early_begin = .;
-                       *(__early_param)
-               __early_end = .;
-               __initcall_start = .;
-                       *(.initcall1.init)
-                       *(.initcall2.init)
-                       *(.initcall3.init)
-                       *(.initcall4.init)
-                       *(.initcall5.init)
-                       *(.initcall6.init)
-                       *(.initcall7.init)
-               __initcall_end = .;
-               __con_initcall_start = .;
-                       *(.con_initcall.init)
-               __con_initcall_end = .;
-#ifdef CONFIG_BLK_DEV_INITRD
-               . = ALIGN(32);
-               __initramfs_start = .;
-                       usr/built-in.o(.init.ramfs)
-               __initramfs_end = .;
-#endif
-               . = ALIGN(32768);
-               __init_end = .;
-       }
-
-       /DISCARD/ : {                   /* Exit code and data           */
-               *(.exit.text)
-               *(.exit.data)
-               *(.exitcall.exit)
-       }
-
-       .text : {                       /* Real text segment            */
-               _text = .;              /* Text and read-only data      */
-                       TEXT_TEXT
-                       SCHED_TEXT
-                       LOCK_TEXT       /* FIXME - borrowed from arm32 - check*/
-                       *(.fixup)
-                       *(.gnu.warning)
-                       *(.rodata)
-                       *(.rodata.*)
-                       *(.glue_7)
-                       *(.glue_7t)
-               *(.got)                 /* Global offset table          */
-
-               _etext = .;             /* End of text section          */
-       }
-
-       . = ALIGN(16);
-       __ex_table : {                  /* Exception table              */
-               __start___ex_table = .;
-                       *(__ex_table)
-               __stop___ex_table = .;
-       }
-
-       RODATA
-
-       _endtext = .;
-
-       . = DATAADDR;
-
-       _sdata = .;
-
-       .data : {
-               . = ALIGN(8192);
-               /*
-                * first, the init thread union, aligned
-                * to an 8192 byte boundary. (see arm26/kernel/init_task.c)
-                * FIXME - sould this be 32K aligned on arm26?
-                */
-               *(.init.task)
-
-               /*
-                * The cacheline aligned data
-                */
-               . = ALIGN(32);
-               *(.data.cacheline_aligned)
-
-               /*
-                * and the usual data section
-                */
-               DATA_DATA
-               CONSTRUCTORS
-
-               *(.init.data)
-
-               _edata = .;
-       }
-
-       .bss : {
-               __bss_start = .;        /* BSS                          */
-               *(.bss)
-               *(COMMON)
-               _end = . ;
-       }
-                                       /* Stabs debugging sections.    */
-       .stab 0 : { *(.stab) }
-       .stabstr 0 : { *(.stabstr) }
-       .stab.excl 0 : { *(.stab.excl) }
-       .stab.exclstr 0 : { *(.stab.exclstr) }
-       .stab.index 0 : { *(.stab.index) }
-       .stab.indexstr 0 : { *(.stab.indexstr) }
-       .comment 0 : { *(.comment) }
-}
diff --git a/arch/arm26/kernel/vmlinux-arm26.lds.in b/arch/arm26/kernel/vmlinux-arm26.lds.in
deleted file mode 100644 (file)
index 6c44f6a..0000000
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ld script to make ARM Linux kernel
- * taken from the i386 version by Russell King
- * Written by Martin Mares <mj@atrey.karlin.mff.cuni.cz>
- * borrowed from Russels ARM port by Ian Molton and subsequently modified.
- */
-
-#include <asm-generic/vmlinux.lds.h>
-
-OUTPUT_ARCH(arm)
-ENTRY(stext)
-jiffies = jiffies_64;
-SECTIONS
-{
-       . = TEXTADDR;
-       .init : {                       /* Init code and data           */
-               _stext = .;
-               __init_begin = .;
-                       _sinittext = .;
-                       *(.init.text)
-                       _einittext = .;
-               __proc_info_begin = .;
-                       *(.proc.info)
-               __proc_info_end = .;
-               __arch_info_begin = .;
-                       *(.arch.info)
-               __arch_info_end = .;
-               __tagtable_begin = .;
-                       *(.taglist)
-               __tagtable_end = .;
-                       *(.init.data)
-               . = ALIGN(16);
-               __setup_start = .;
-                       *(.init.setup)
-               __setup_end = .;
-               __early_begin = .;
-                       *(__early_param)
-               __early_end = .;
-               __initcall_start = .;
-                       *(.initcall1.init)
-                       *(.initcall2.init)
-                       *(.initcall3.init)
-                       *(.initcall4.init)
-                       *(.initcall5.init)
-                       *(.initcall6.init)
-                       *(.initcall7.init)
-               __initcall_end = .;
-               __con_initcall_start = .;
-                       *(.con_initcall.init)
-               __con_initcall_end = .;
-#ifdef CONFIG_BLK_DEV_INITRD
-               . = ALIGN(32);
-               __initramfs_start = .;
-                       usr/built-in.o(.init.ramfs)
-               __initramfs_end = .;
-#endif
-               . = ALIGN(32768);
-               __init_end = .;
-       }
-
-       /DISCARD/ : {                   /* Exit code and data           */
-               *(.exit.text)
-               *(.exit.data)
-               *(.exitcall.exit)
-       }
-
-       .text : {                       /* Real text segment            */
-               _text = .;              /* Text and read-only data      */
-                       TEXT_TEXT
-                       SCHED_TEXT
-                       LOCK_TEXT
-                       *(.fixup)
-                       *(.gnu.warning)
-                       *(.rodata)
-                       *(.rodata.*)
-                       *(.glue_7)
-                       *(.glue_7t)
-               *(.got)                 /* Global offset table          */
-
-               _etext = .;             /* End of text section          */
-       }
-
-       . = ALIGN(16);
-       __ex_table : {                  /* Exception table              */
-               __start___ex_table = .;
-                       *(__ex_table)
-               __stop___ex_table = .;
-       }
-
-       RODATA
-
-       . = ALIGN(8192);
-
-       .data : {
-               /*
-                * first, the init task union, aligned
-                * to an 8192 byte boundary. (see arm26/kernel/init_task.c)
-                */
-               *(.init.task)
-
-               /*
-                * The cacheline aligned data
-                */
-               . = ALIGN(32);
-               *(.data.cacheline_aligned)
-
-               /*
-                * and the usual data section
-                */
-               DATA_DATA
-               CONSTRUCTORS
-
-               _edata = .;
-       }
-
-       .bss : {
-               __bss_start = .;        /* BSS                          */
-               *(.bss)
-               *(COMMON)
-               _end = . ;
-       }
-                                       /* Stabs debugging sections.    */
-       .stab 0 : { *(.stab) }
-       .stabstr 0 : { *(.stabstr) }
-       .stab.excl 0 : { *(.stab.excl) }
-       .stab.exclstr 0 : { *(.stab.exclstr) }
-       .stab.index 0 : { *(.stab.index) }
-       .stab.indexstr 0 : { *(.stab.indexstr) }
-       .comment 0 : { *(.comment) }
-}
diff --git a/arch/arm26/kernel/vmlinux.lds.S b/arch/arm26/kernel/vmlinux.lds.S
deleted file mode 100644 (file)
index 1fa39f0..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-
-#ifdef CONFIG_XIP_KERNEL
-
-#include "vmlinux-arm26-xip.lds.in"
-
-#else
-
-#include "vmlinux-arm26.lds.in"
-
-#endif
-
diff --git a/arch/arm26/lib/Makefile b/arch/arm26/lib/Makefile
deleted file mode 100644 (file)
index 6df2b79..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#
-# linux/arch/arm26/lib/Makefile
-#
-# Copyright (C) 1995-2000 Russell King
-#
-
-lib-y          := backtrace.o changebit.o csumipv6.o csumpartial.o   \
-                  csumpartialcopy.o csumpartialcopyuser.o clearbit.o \
-                  copy_page.o delay.o findbit.o memchr.o memcpy.o    \
-                  memset.o memzero.o setbit.o                        \
-                  strchr.o strrchr.o testchangebit.o                 \
-                  testclearbit.o testsetbit.o getuser.o              \
-                  putuser.o ashldi3.o ashrdi3.o lshrdi3.o muldi3.o   \
-                  ucmpdi2.o udivdi3.o lib1funcs.o ecard.o io-acorn.o \
-                  floppydma.o io-readsb.o io-writesb.o io-writesl.o  \
-                  uaccess-kernel.o uaccess-user.o io-readsw.o        \
-                  io-writesw.o io-readsl.o ecard.o io-acorn.o        \
-                  floppydma.o
-
-lib-n          :=
-
-lib-$(CONFIG_VT)+= kbd.o
-
-csumpartialcopy.o: csumpartialcopygeneric.S
-csumpartialcopyuser.o: csumpartialcopygeneric.S
-
diff --git a/arch/arm26/lib/ashldi3.c b/arch/arm26/lib/ashldi3.c
deleted file mode 100644 (file)
index 130f5a8..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* More subroutines needed by GCC output code on some machines.  */
-/* Compile this one with gcc.  */
-/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.
- */
-/* support functions required by the kernel. based on code from gcc-2.95.3 */
-/* I Molton    29/07/01 */
-
-#include "gcclib.h"
-
-DItype
-__ashldi3 (DItype u, word_type b)
-{
-  DIunion w;
-  word_type bm;
-  DIunion uu;
-
-  if (b == 0)
-    return u;
-
-  uu.ll = u;
-
-  bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
-  if (bm <= 0)
-    {
-      w.s.low = 0;
-      w.s.high = (USItype)uu.s.low << -bm;
-    }
-  else
-    {
-      USItype carries = (USItype)uu.s.low >> bm;
-      w.s.low = (USItype)uu.s.low << b;
-      w.s.high = ((USItype)uu.s.high << b) | carries;
-    }
-
-  return w.ll;
-}
-
diff --git a/arch/arm26/lib/ashrdi3.c b/arch/arm26/lib/ashrdi3.c
deleted file mode 100644 (file)
index 71625d2..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* More subroutines needed by GCC output code on some machines.  */
-/* Compile this one with gcc.  */
-/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.
- */
-/* support functions required by the kernel. based on code from gcc-2.95.3 */
-/* I Molton     29/07/01 */
-
-#include "gcclib.h"
-
-DItype
-__ashrdi3 (DItype u, word_type b)
-{
-  DIunion w;
-  word_type bm;
-  DIunion uu;
-
-  if (b == 0)
-    return u;
-
-  uu.ll = u;
-
-  bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
-  if (bm <= 0)
-    {
-      /* w.s.high = 1..1 or 0..0 */
-      w.s.high = uu.s.high >> (sizeof (SItype) * BITS_PER_UNIT - 1);
-      w.s.low = uu.s.high >> -bm;
-    }
-  else
-    {
-      USItype carries = (USItype)uu.s.high << bm;
-      w.s.high = uu.s.high >> b;
-      w.s.low = ((USItype)uu.s.low >> b) | carries;
-    }
-
-  return w.ll;
-}
diff --git a/arch/arm26/lib/backtrace.S b/arch/arm26/lib/backtrace.S
deleted file mode 100644 (file)
index e27feb1..0000000
+++ /dev/null
@@ -1,144 +0,0 @@
-/*
- *  linux/arch/arm26/lib/backtrace.S
- *
- *  Copyright (C) 1995, 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-               .text
-
-@ fp is 0 or stack frame
-
-#define frame  r4
-#define next   r5
-#define save   r6
-#define mask   r7
-#define offset r8
-
-ENTRY(__backtrace)
-               mov     r1, #0x10
-               mov     r0, fp
-
-ENTRY(c_backtrace)
-
-#ifdef CONFIG_NO_FRAME_POINTER
-               mov     pc, lr
-#else
-
-               stmfd   sp!, {r4 - r8, lr}      @ Save an extra register so we have a location...
-               mov     mask, #0xfc000003
-               tst     mask, r0
-               movne   r0, #0
-               movs    frame, r0
-1:             moveq   r0, #-2
-               LOADREGS(eqfd, sp!, {r4 - r8, pc})
-
-2:             stmfd   sp!, {pc}               @ calculate offset of PC in STMIA instruction
-               ldr     r0, [sp], #4
-               adr     r1, 2b - 4
-               sub     offset, r0, r1
-
-3:             tst     frame, mask             @ Check for address exceptions...
-               bne     1b
-
-1001:          ldr     next, [frame, #-12]     @ get fp
-1002:          ldr     r2, [frame, #-4]        @ get lr
-1003:          ldr     r3, [frame, #0]         @ get pc
-               sub     save, r3, offset        @ Correct PC for prefetching
-               bic     save, save, mask
-1004:          ldr     r1, [save, #0]          @ get instruction at function
-               mov     r1, r1, lsr #10
-               ldr     r3, .Ldsi+4
-               teq     r1, r3
-               subeq   save, save, #4
-               adr     r0, .Lfe
-               mov     r1, save
-               bic     r2, r2, mask
-               bl      printk                  @ print pc and link register
-
-               ldr     r0, [frame, #-8]        @ get sp
-               sub     r0, r0, #4
-1005:          ldr     r1, [save, #4]          @ get instruction at function+4
-               mov     r3, r1, lsr #10
-               ldr     r2, .Ldsi+4
-               teq     r3, r2                  @ Check for stmia sp!, {args}
-               addeq   save, save, #4          @ next instruction
-               bleq    .Ldumpstm
-
-               sub     r0, frame, #16
-1006:          ldr     r1, [save, #4]          @ Get 'stmia sp!, {rlist, fp, ip, lr, pc}' instruction
-               mov     r3, r1, lsr #10
-               ldr     r2, .Ldsi
-               teq     r3, r2
-               bleq    .Ldumpstm
-
-               teq     frame, next
-               movne   frame, next
-               teqne   frame, #0
-               bne     3b
-               LOADREGS(fd, sp!, {r4 - r8, pc})
-
-/*
- * Fixup for LDMDB
- */
-               .section .fixup,"ax"
-               .align  0
-1007:          ldr     r0, =.Lbad
-               mov     r1, frame
-               bl      printk
-               LOADREGS(fd, sp!, {r4 - r8, pc})
-               .ltorg
-               .previous
-               
-               .section __ex_table,"a"
-               .align  3
-               .long   1001b, 1007b
-               .long   1002b, 1007b
-               .long   1003b, 1007b
-               .long   1004b, 1007b
-               .long   1005b, 1007b
-               .long   1006b, 1007b
-               .previous
-
-#define instr r4
-#define reg   r5
-#define stack r6
-
-.Ldumpstm:     stmfd   sp!, {instr, reg, stack, r7, lr}
-               mov     stack, r0
-               mov     instr, r1
-               mov     reg, #9
-               mov     r7, #0
-1:             mov     r3, #1
-               tst     instr, r3, lsl reg
-               beq     2f
-               add     r7, r7, #1
-               teq     r7, #4
-               moveq   r7, #0
-               moveq   r3, #'\n'
-               movne   r3, #' '
-               ldr     r2, [stack], #-4
-               mov     r1, reg
-               adr     r0, .Lfp
-               bl      printk
-2:             subs    reg, reg, #1
-               bpl     1b
-               teq     r7, #0
-               adrne   r0, .Lcr
-               blne    printk
-               mov     r0, stack
-               LOADREGS(fd, sp!, {instr, reg, stack, r7, pc})
-
-.Lfe:          .asciz  "Function entered at [<%p>] from [<%p>]\n"
-.Lfp:          .asciz  " r%d = %08X%c"
-.Lcr:          .asciz  "\n"
-.Lbad:         .asciz  "Backtrace aborted due to bad frame pointer <%p>\n"
-               .align
-.Ldsi:         .word   0x00e92dd8 >> 2
-               .word   0x00e92d00 >> 2
-
-#endif
diff --git a/arch/arm26/lib/changebit.S b/arch/arm26/lib/changebit.S
deleted file mode 100644 (file)
index 1b6a077..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- *  linux/arch/arm26/lib/changebit.S
- *
- *  Copyright (C) 1995-1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-                .text
-
-/* Purpose  : Function to change a bit
- * Prototype: int change_bit(int bit, void *addr)
- */
-ENTRY(_change_bit_be)
-               eor     r0, r0, #0x18           @ big endian byte ordering
-ENTRY(_change_bit_le)
-               and     r2, r0, #7
-               mov     r3, #1
-               mov     r3, r3, lsl r2
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1, r0, lsr #3]
-               eor     r2, r2, r3
-               strb    r2, [r1, r0, lsr #3]
-               restore_irqs ip
-               RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/clearbit.S b/arch/arm26/lib/clearbit.S
deleted file mode 100644 (file)
index 0a895b0..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-/*
- *  linux/arch/arm26/lib/clearbit.S
- *
- *  Copyright (C) 1995-1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-                .text
-
-/*
- * Purpose  : Function to clear a bit
- * Prototype: int clear_bit(int bit, void *addr)
- */
-ENTRY(_clear_bit_be)
-               eor     r0, r0, #0x18           @ big endian byte ordering
-ENTRY(_clear_bit_le)
-               and     r2, r0, #7
-               mov     r3, #1
-               mov     r3, r3, lsl r2
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1, r0, lsr #3]
-               bic     r2, r2, r3
-               strb    r2, [r1, r0, lsr #3]
-               restore_irqs ip
-               RETINSTR(mov,pc,lr)
-
-
diff --git a/arch/arm26/lib/copy_page.S b/arch/arm26/lib/copy_page.S
deleted file mode 100644 (file)
index c7511a2..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- *  linux/arch/arm26/lib/copypage.S
- *
- *  Copyright (C) 1995-1999 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  ASM optimised string functions
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/asm-offsets.h>
-
-               .text
-               .align  5
-/*
- * ARMv3 optimised copy_user_page
- *
- * FIXME: rmk do we need to handle cache stuff...
- * FIXME: im is this right on ARM26?
- */
-ENTRY(__copy_user_page)
-       stmfd   sp!, {r4, lr}                   @       2
-       mov     r2, #PAGE_SZ/64                 @       1
-       ldmia   r1!, {r3, r4, ip, lr}           @       4+1
-1:     stmia   r0!, {r3, r4, ip, lr}           @       4
-       ldmia   r1!, {r3, r4, ip, lr}           @       4+1
-       stmia   r0!, {r3, r4, ip, lr}           @       4
-       ldmia   r1!, {r3, r4, ip, lr}           @       4+1
-       stmia   r0!, {r3, r4, ip, lr}           @       4
-       ldmia   r1!, {r3, r4, ip, lr}           @       4
-       subs    r2, r2, #1                      @       1
-       stmia   r0!, {r3, r4, ip, lr}           @       4
-       ldmneia r1!, {r3, r4, ip, lr}           @       4
-       bne     1b                              @       1
-       LOADREGS(fd, sp!, {r4, pc})             @       3
-
-       .align  5
-/*
- * ARMv3 optimised clear_user_page
- *
- * FIXME: rmk do we need to handle cache stuff...
- */
-ENTRY(__clear_user_page)
-       str     lr, [sp, #-4]!
-       mov     r1, #PAGE_SZ/64                 @ 1
-       mov     r2, #0                          @ 1
-       mov     r3, #0                          @ 1
-       mov     ip, #0                          @ 1
-       mov     lr, #0                          @ 1
-1:     stmia   r0!, {r2, r3, ip, lr}           @ 4
-       stmia   r0!, {r2, r3, ip, lr}           @ 4
-       stmia   r0!, {r2, r3, ip, lr}           @ 4
-       stmia   r0!, {r2, r3, ip, lr}           @ 4
-       subs    r1, r1, #1                      @ 1
-       bne     1b                              @ 1
-       ldr     pc, [sp], #4
-
-       .section ".init.text", #alloc, #execinstr
-
diff --git a/arch/arm26/lib/csumipv6.S b/arch/arm26/lib/csumipv6.S
deleted file mode 100644 (file)
index 6283115..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  linux/arch/arm26/lib/csumipv6.S
- *
- *  Copyright (C) 1995-1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-               .text
-
-ENTRY(__csum_ipv6_magic)
-               str     lr, [sp, #-4]!
-               adds    ip, r2, r3
-               ldmia   r1, {r1 - r3, lr}
-               adcs    ip, ip, r1
-               adcs    ip, ip, r2
-               adcs    ip, ip, r3
-               adcs    ip, ip, lr
-               ldmia   r0, {r0 - r3}
-               adcs    r0, ip, r0
-               adcs    r0, r0, r1
-               adcs    r0, r0, r2
-               ldr     r2, [sp, #4]
-               adcs    r0, r0, r3
-               adcs    r0, r0, r2
-               adcs    r0, r0, #0
-               LOADREGS(fd, sp!, {pc})
-
diff --git a/arch/arm26/lib/csumpartial.S b/arch/arm26/lib/csumpartial.S
deleted file mode 100644 (file)
index e53e710..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *  linux/arch/arm26/lib/csumpartial.S
- *
- *  Copyright (C) 1995-1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-               .text
-
-/*
- * Function: __u32 csum_partial(const char *src, int len, __u32 sum)
- * Params  : r0 = buffer, r1 = len, r2 = checksum
- * Returns : r0 = new checksum
- */
-
-buf    .req    r0
-len    .req    r1
-sum    .req    r2
-td0    .req    r3
-td1    .req    r4      @ save before use
-td2    .req    r5      @ save before use
-td3    .req    lr
-
-.zero:         mov     r0, sum
-               add     sp, sp, #4
-               ldr     pc, [sp], #4
-
-               /*
-                * Handle 0 to 7 bytes, with any alignment of source and
-                * destination pointers.  Note that when we get here, C = 0
-                */
-.less8:                teq     len, #0                 @ check for zero count
-               beq     .zero
-
-               /* we must have at least one byte. */
-               tst     buf, #1                 @ odd address?
-               ldrneb  td0, [buf], #1
-               subne   len, len, #1
-               adcnes  sum, sum, td0, lsl #byte(1)
-
-.less4:                tst     len, #6
-               beq     .less8_byte
-
-               /* we are now half-word aligned */
-
-.less8_wordlp:
-#if __LINUX_ARM_ARCH__ >= 4
-               ldrh    td0, [buf], #2
-               sub     len, len, #2
-#else
-               ldrb    td0, [buf], #1
-               ldrb    td3, [buf], #1
-               sub     len, len, #2
-               orr     td0, td0, td3, lsl #8
-#endif
-               adcs    sum, sum, td0
-               tst     len, #6
-               bne     .less8_wordlp
-
-.less8_byte:   tst     len, #1                 @ odd number of bytes
-               ldrneb  td0, [buf], #1          @ include last byte
-               adcnes  sum, sum, td0, lsl #byte(0)     @ update checksum
-
-.done:         adc     r0, sum, #0             @ collect up the last carry
-               ldr     td0, [sp], #4
-               tst     td0, #1                 @ check buffer alignment
-               movne   td0, r0, lsl #8         @ rotate checksum by 8 bits
-               orrne   r0, td0, r0, lsr #24
-               ldr     pc, [sp], #4            @ return
-
-.not_aligned:  tst     buf, #1                 @ odd address
-               ldrneb  td0, [buf], #1          @ make even
-               subne   len, len, #1
-               adcnes  sum, sum, td0, lsl #byte(1)     @ update checksum
-
-               tst     buf, #2                 @ 32-bit aligned?
-#if __LINUX_ARM_ARCH__ >= 4
-               ldrneh  td0, [buf], #2          @ make 32-bit aligned
-               subne   len, len, #2
-#else
-               ldrneb  td0, [buf], #1
-               ldrneb  ip, [buf], #1
-               subne   len, len, #2
-               orrne   td0, td0, ip, lsl #8
-#endif
-               adcnes  sum, sum, td0           @ update checksum
-               mov     pc, lr
-
-ENTRY(csum_partial)
-               stmfd   sp!, {buf, lr}
-               cmp     len, #8                 @ Ensure that we have at least
-               blo     .less8                  @ 8 bytes to copy.
-
-               adds    sum, sum, #0            @ C = 0
-               tst     buf, #3                 @ Test destination alignment
-               blne    .not_aligned            @ aligh destination, return here
-
-1:             bics    ip, len, #31
-               beq     3f
-
-               stmfd   sp!, {r4 - r5}
-2:             ldmia   buf!, {td0, td1, td2, td3}
-               adcs    sum, sum, td0
-               adcs    sum, sum, td1
-               adcs    sum, sum, td2
-               adcs    sum, sum, td3
-               ldmia   buf!, {td0, td1, td2, td3}
-               adcs    sum, sum, td0
-               adcs    sum, sum, td1
-               adcs    sum, sum, td2
-               adcs    sum, sum, td3
-               sub     ip, ip, #32
-               teq     ip, #0
-               bne     2b
-               ldmfd   sp!, {r4 - r5}
-
-3:             tst     len, #0x1c              @ should not change C
-               beq     .less4
-
-4:             ldr     td0, [buf], #4
-               sub     len, len, #4
-               adcs    sum, sum, td0
-               tst     len, #0x1c
-               bne     4b
-               b       .less4
diff --git a/arch/arm26/lib/csumpartialcopy.S b/arch/arm26/lib/csumpartialcopy.S
deleted file mode 100644 (file)
index a1c4b5f..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- *  linux/arch/arm26/lib/csumpartialcopy.S
- *
- *  Copyright (C) 1995-1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-               .text
-
-/* Function: __u32 csum_partial_copy_nocheck(const char *src, char *dst, int len, __u32 sum)
- * Params  : r0 = src, r1 = dst, r2 = len, r3 = checksum
- * Returns : r0 = new checksum
- */
-
-               .macro  save_regs
-               stmfd   sp!, {r1, r4 - r8, fp, ip, lr, pc}
-               .endm
-
-               .macro  load_regs,flags
-               LOADREGS(\flags,fp,{r1, r4 - r8, fp, sp, pc})
-               .endm
-
-               .macro  load1b, reg1
-               ldrb    \reg1, [r0], #1
-               .endm
-
-               .macro  load2b, reg1, reg2
-               ldrb    \reg1, [r0], #1
-               ldrb    \reg2, [r0], #1
-               .endm
-
-               .macro  load1l, reg1
-               ldr     \reg1, [r0], #4
-               .endm
-
-               .macro  load2l, reg1, reg2
-               ldr     \reg1, [r0], #4
-               ldr     \reg2, [r0], #4
-               .endm
-
-               .macro  load4l, reg1, reg2, reg3, reg4
-               ldmia   r0!, {\reg1, \reg2, \reg3, \reg4}
-               .endm
-
-#define FN_ENTRY       ENTRY(csum_partial_copy_nocheck)
-
-#include "csumpartialcopygeneric.S"
diff --git a/arch/arm26/lib/csumpartialcopygeneric.S b/arch/arm26/lib/csumpartialcopygeneric.S
deleted file mode 100644 (file)
index 5249c3a..0000000
+++ /dev/null
@@ -1,352 +0,0 @@
-/*
- *  linux/arch/arm26/lib/csumpartialcopygeneric.S
- *
- *  Copyright (C) 1995-2001 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * JMA 01/06/03 Commented out some shl0s; probobly irrelevant to arm26 
- *
- */
-
-/*
- * unsigned int
- * csum_partial_copy_xxx(const char *src, char *dst, int len, int sum, )
- *  r0 = src, r1 = dst, r2 = len, r3 = sum
- *  Returns : r0 = checksum
- *
- * Note that 'tst' and 'teq' preserve the carry flag.
- */
-
-/* Quick hack */
-                .macro  save_regs
-                stmfd   sp!, {r1, r4 - r8, fp, ip, lr, pc}
-                .endm
-
-/* end Quick Hack */
-
-src    .req    r0
-dst    .req    r1
-len    .req    r2
-sum    .req    r3
-
-.zero:         mov     r0, sum
-               load_regs       ea
-
-               /*
-                * Align an unaligned destination pointer.  We know that
-                * we have >= 8 bytes here, so we don't need to check
-                * the length.  Note that the source pointer hasn't been
-                * aligned yet.
-                */
-.dst_unaligned:        tst     dst, #1
-               beq     .dst_16bit
-
-               load1b  ip
-               sub     len, len, #1
-               adcs    sum, sum, ip, lsl #byte(1)      @ update checksum
-               strb    ip, [dst], #1
-               tst     dst, #2
-               moveq   pc, lr                  @ dst is now 32bit aligned
-
-.dst_16bit:    load2b  r8, ip
-               sub     len, len, #2
-               adcs    sum, sum, r8, lsl #byte(0)
-               strb    r8, [dst], #1
-               adcs    sum, sum, ip, lsl #byte(1)
-               strb    ip, [dst], #1
-               mov     pc, lr                  @ dst is now 32bit aligned
-
-               /*
-                * Handle 0 to 7 bytes, with any alignment of source and
-                * destination pointers.  Note that when we get here, C = 0
-                */
-.less8:                teq     len, #0                 @ check for zero count
-               beq     .zero
-
-               /* we must have at least one byte. */
-               tst     dst, #1                 @ dst 16-bit aligned
-               beq     .less8_aligned
-
-               /* Align dst */
-               load1b  ip
-               sub     len, len, #1
-               adcs    sum, sum, ip, lsl #byte(1)      @ update checksum
-               strb    ip, [dst], #1
-               tst     len, #6
-               beq     .less8_byteonly
-
-1:             load2b  r8, ip
-               sub     len, len, #2
-               adcs    sum, sum, r8, lsl #byte(0)
-               strb    r8, [dst], #1
-               adcs    sum, sum, ip, lsl #byte(1)
-               strb    ip, [dst], #1
-.less8_aligned:        tst     len, #6
-               bne     1b
-.less8_byteonly:
-               tst     len, #1
-               beq     .done
-               load1b  r8
-               adcs    sum, sum, r8, lsl #byte(0)      @ update checksum
-               strb    r8, [dst], #1
-               b       .done
-
-FN_ENTRY
-               mov     ip, sp
-               save_regs
-               sub     fp, ip, #4
-
-               cmp     len, #8                 @ Ensure that we have at least
-               blo     .less8                  @ 8 bytes to copy.
-
-               adds    sum, sum, #0            @ C = 0
-               tst     dst, #3                 @ Test destination alignment
-               blne    .dst_unaligned          @ align destination, return here
-
-               /*
-                * Ok, the dst pointer is now 32bit aligned, and we know
-                * that we must have more than 4 bytes to copy.  Note
-                * that C contains the carry from the dst alignment above.
-                */
-
-               tst     src, #3                 @ Test source alignment
-               bne     .src_not_aligned
-
-               /* Routine for src & dst aligned */
-
-               bics    ip, len, #15
-               beq     2f
-
-1:             load4l  r4, r5, r6, r7
-               stmia   dst!, {r4, r5, r6, r7}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               adcs    sum, sum, r6
-               adcs    sum, sum, r7
-               sub     ip, ip, #16
-               teq     ip, #0
-               bne     1b
-
-2:             ands    ip, len, #12
-               beq     4f
-               tst     ip, #8
-               beq     3f
-               load2l  r4, r5
-               stmia   dst!, {r4, r5}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               tst     ip, #4
-               beq     4f
-
-3:             load1l  r4
-               str     r4, [dst], #4
-               adcs    sum, sum, r4
-
-4:             ands    len, len, #3
-               beq     .done
-               load1l  r4
-               tst     len, #2
-/*             mov     r5, r4, lsr #byte(0)
-FIXME? 0 Shift anyhow!
-*/
-               beq     .exit
-               adcs    sum, sum, r4, push #16
-               strb    r5, [dst], #1
-               mov     r5, r4, lsr #byte(1)
-               strb    r5, [dst], #1
-               mov     r5, r4, lsr #byte(2)
-.exit:         tst     len, #1
-               strneb  r5, [dst], #1
-               andne   r5, r5, #255
-               adcnes  sum, sum, r5, lsl #byte(0)
-
-               /*
-                * If the dst pointer was not 16-bit aligned, we
-                * need to rotate the checksum here to get around
-                * the inefficient byte manipulations in the
-                * architecture independent code.
-                */
-.done:         adc     r0, sum, #0
-               ldr     sum, [sp, #0]           @ dst
-               tst     sum, #1
-               movne   sum, r0, lsl #8
-               orrne   r0, sum, r0, lsr #24
-               load_regs       ea
-
-.src_not_aligned:
-               adc     sum, sum, #0            @ include C from dst alignment
-               and     ip, src, #3
-               bic     src, src, #3
-               load1l  r5
-               cmp     ip, #2
-               beq     .src2_aligned
-               bhi     .src3_aligned
-               mov     r4, r5, pull #8         @ C = 0
-               bics    ip, len, #15
-               beq     2f
-1:             load4l  r5, r6, r7, r8
-               orr     r4, r4, r5, push #24
-               mov     r5, r5, pull #8
-               orr     r5, r5, r6, push #24
-               mov     r6, r6, pull #8
-               orr     r6, r6, r7, push #24
-               mov     r7, r7, pull #8
-               orr     r7, r7, r8, push #24
-               stmia   dst!, {r4, r5, r6, r7}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               adcs    sum, sum, r6
-               adcs    sum, sum, r7
-               mov     r4, r8, pull #8
-               sub     ip, ip, #16
-               teq     ip, #0
-               bne     1b
-2:             ands    ip, len, #12
-               beq     4f
-               tst     ip, #8
-               beq     3f
-               load2l  r5, r6
-               orr     r4, r4, r5, push #24
-               mov     r5, r5, pull #8
-               orr     r5, r5, r6, push #24
-               stmia   dst!, {r4, r5}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               mov     r4, r6, pull #8
-               tst     ip, #4
-               beq     4f
-3:             load1l  r5
-               orr     r4, r4, r5, push #24
-               str     r4, [dst], #4
-               adcs    sum, sum, r4
-               mov     r4, r5, pull #8
-4:             ands    len, len, #3
-               beq     .done
-/*             mov     r5, r4, lsr #byte(0)
-FIXME? 0 Shift anyhow
-*/
-               tst     len, #2
-               beq     .exit
-               adcs    sum, sum, r4, push #16
-               strb    r5, [dst], #1
-               mov     r5, r4, lsr #byte(1)
-               strb    r5, [dst], #1
-               mov     r5, r4, lsr #byte(2)
-               b       .exit
-
-.src2_aligned: mov     r4, r5, pull #16
-               adds    sum, sum, #0
-               bics    ip, len, #15
-               beq     2f
-1:             load4l  r5, r6, r7, r8
-               orr     r4, r4, r5, push #16
-               mov     r5, r5, pull #16
-               orr     r5, r5, r6, push #16
-               mov     r6, r6, pull #16
-               orr     r6, r6, r7, push #16
-               mov     r7, r7, pull #16
-               orr     r7, r7, r8, push #16
-               stmia   dst!, {r4, r5, r6, r7}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               adcs    sum, sum, r6
-               adcs    sum, sum, r7
-               mov     r4, r8, pull #16
-               sub     ip, ip, #16
-               teq     ip, #0
-               bne     1b
-2:             ands    ip, len, #12
-               beq     4f
-               tst     ip, #8
-               beq     3f
-               load2l  r5, r6
-               orr     r4, r4, r5, push #16
-               mov     r5, r5, pull #16
-               orr     r5, r5, r6, push #16
-               stmia   dst!, {r4, r5}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               mov     r4, r6, pull #16
-               tst     ip, #4
-               beq     4f
-3:             load1l  r5
-               orr     r4, r4, r5, push #16
-               str     r4, [dst], #4
-               adcs    sum, sum, r4
-               mov     r4, r5, pull #16
-4:             ands    len, len, #3
-               beq     .done
-/*             mov     r5, r4, lsr #byte(0)
-FIXME? 0 Shift anyhow
-*/
-               tst     len, #2
-               beq     .exit
-               adcs    sum, sum, r4
-               strb    r5, [dst], #1
-               mov     r5, r4, lsr #byte(1)
-               strb    r5, [dst], #1
-               tst     len, #1
-               beq     .done
-               load1b  r5
-               b       .exit
-
-.src3_aligned: mov     r4, r5, pull #24
-               adds    sum, sum, #0
-               bics    ip, len, #15
-               beq     2f
-1:             load4l  r5, r6, r7, r8
-               orr     r4, r4, r5, push #8
-               mov     r5, r5, pull #24
-               orr     r5, r5, r6, push #8
-               mov     r6, r6, pull #24
-               orr     r6, r6, r7, push #8
-               mov     r7, r7, pull #24
-               orr     r7, r7, r8, push #8
-               stmia   dst!, {r4, r5, r6, r7}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               adcs    sum, sum, r6
-               adcs    sum, sum, r7
-               mov     r4, r8, pull #24
-               sub     ip, ip, #16
-               teq     ip, #0
-               bne     1b
-2:             ands    ip, len, #12
-               beq     4f
-               tst     ip, #8
-               beq     3f
-               load2l  r5, r6
-               orr     r4, r4, r5, push #8
-               mov     r5, r5, pull #24
-               orr     r5, r5, r6, push #8
-               stmia   dst!, {r4, r5}
-               adcs    sum, sum, r4
-               adcs    sum, sum, r5
-               mov     r4, r6, pull #24
-               tst     ip, #4
-               beq     4f
-3:             load1l  r5
-               orr     r4, r4, r5, push #8
-               str     r4, [dst], #4
-               adcs    sum, sum, r4
-               mov     r4, r5, pull #24
-4:             ands    len, len, #3
-               beq     .done
-/*             mov     r5, r4, lsr #byte(0)
-FIXME? 0 Shift anyhow
-*/
-               tst     len, #2
-               beq     .exit
-               strb    r5, [dst], #1
-               adcs    sum, sum, r4
-               load1l  r4
-/*             mov     r5, r4, lsr #byte(0)
-FIXME? 0 Shift anyhow
-*/
-               strb    r5, [dst], #1
-               adcs    sum, sum, r4, push #24
-               mov     r5, r4, lsr #byte(1)
-               b       .exit
diff --git a/arch/arm26/lib/csumpartialcopyuser.S b/arch/arm26/lib/csumpartialcopyuser.S
deleted file mode 100644 (file)
index a98eea7..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
- *  linux/arch/arm26/lib/csumpartialcopyuser.S
- *
- *  Copyright (C) 1995-1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/errno.h>
-#include <asm/asm-offsets.h>
-
-               .text
-
-               .macro  save_regs
-               stmfd   sp!, {r1 - r2, r4 - r9, fp, ip, lr, pc}
-               mov     r9, sp, lsr #13
-               mov     r9, r9, lsl #13
-               ldr     r9, [r9, #TSK_ADDR_LIMIT]
-               mov     r9, r9, lsr #24
-               .endm
-
-               .macro  load_regs,flags
-               ldm\flags       fp, {r1, r2, r4-r9, fp, sp, pc}^
-               .endm
-
-               .macro  load1b, reg1
-               tst     r9, #0x01
-9999:          ldreqbt \reg1, [r0], #1
-               ldrneb  \reg1, [r0], #1
-               .section __ex_table, "a"
-               .align  3
-               .long   9999b, 6001f
-               .previous
-               .endm
-
-               .macro  load2b, reg1, reg2
-               tst     r9, #0x01
-9999:          ldreqbt \reg1, [r0], #1
-               ldrneb  \reg1, [r0], #1
-9998:          ldreqbt \reg2, [r0], #1
-               ldrneb  \reg2, [r0], #1
-               .section __ex_table, "a"
-               .long   9999b, 6001f
-               .long   9998b, 6001f
-               .previous
-               .endm
-
-               .macro  load1l, reg1
-               tst     r9, #0x01
-9999:          ldreqt  \reg1, [r0], #4
-               ldrne   \reg1, [r0], #4
-               .section __ex_table, "a"
-               .align  3
-               .long   9999b, 6001f
-               .previous
-               .endm
-
-               .macro  load2l, reg1, reg2
-               tst     r9, #0x01
-               ldmneia r0!, {\reg1, \reg2}
-9999:          ldreqt  \reg1, [r0], #4
-9998:          ldreqt  \reg2, [r0], #4
-               .section __ex_table, "a"
-               .long   9999b, 6001f
-               .long   9998b, 6001f
-               .previous
-               .endm
-
-               .macro  load4l, reg1, reg2, reg3, reg4
-               tst     r9, #0x01
-               ldmneia r0!, {\reg1, \reg2, \reg3, \reg4}
-9999:          ldreqt  \reg1, [r0], #4
-9998:          ldreqt  \reg2, [r0], #4
-9997:          ldreqt  \reg3, [r0], #4
-9996:          ldreqt  \reg4, [r0], #4
-               .section __ex_table, "a"
-               .long   9999b, 6001f
-               .long   9998b, 6001f
-               .long   9997b, 6001f
-               .long   9996b, 6001f
-               .previous
-               .endm
-
-/*
- * unsigned int
- * csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *err_ptr)
- *  r0 = src, r1 = dst, r2 = len, r3 = sum, [sp] = *err_ptr
- *  Returns : r0 = checksum, [[sp, #0], #0] = 0 or -EFAULT
- */
-
-#define FN_ENTRY       ENTRY(csum_partial_copy_from_user)
-
-#include "csumpartialcopygeneric.S"
-
-/*
- * FIXME: minor buglet here
- * We don't return the checksum for the data present in the buffer.  To do
- * so properly, we would have to add in whatever registers were loaded before
- * the fault, which, with the current asm above is not predictable.
- */
-               .align  4
-6001:          mov     r4, #-EFAULT
-               ldr     r5, [fp, #4]            @ *err_ptr
-               str     r4, [r5]
-               ldmia   sp, {r1, r2}            @ retrieve dst, len
-               add     r2, r2, r1
-               mov     r0, #0                  @ zero the buffer
-6002:          teq     r2, r1
-               strneb  r0, [r1], #1
-               bne     6002b
-               load_regs       ea
diff --git a/arch/arm26/lib/delay.S b/arch/arm26/lib/delay.S
deleted file mode 100644 (file)
index 66f2b68..0000000
+++ /dev/null
@@ -1,57 +0,0 @@
-/*
- *  linux/arch/arm26/lib/delay.S
- *
- *  Copyright (C) 1995, 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-               .text
-
-LC0:           .word   loops_per_jiffy
-
-/*
- * 0 <= r0 <= 2000
- */
-ENTRY(udelay)
-               mov     r2,     #0x6800
-               orr     r2, r2, #0x00db
-               mul     r1, r0, r2
-               ldr     r2, LC0
-               ldr     r2, [r2]
-               mov     r1, r1, lsr #11
-               mov     r2, r2, lsr #11
-               mul     r0, r1, r2
-               movs    r0, r0, lsr #6
-               RETINSTR(moveq,pc,lr)
-
-/*
- * loops = (r0 * 0x10c6 * 100 * loops_per_jiffy) / 2^32
- *
- * Oh, if only we had a cycle counter...
- */
-
-@ Delay routine
-ENTRY(__delay)
-               subs    r0, r0, #1
-#if 0
-               RETINSTR(movls,pc,lr)
-               subs    r0, r0, #1
-               RETINSTR(movls,pc,lr)
-               subs    r0, r0, #1
-               RETINSTR(movls,pc,lr)
-               subs    r0, r0, #1
-               RETINSTR(movls,pc,lr)
-               subs    r0, r0, #1
-               RETINSTR(movls,pc,lr)
-               subs    r0, r0, #1
-               RETINSTR(movls,pc,lr)
-               subs    r0, r0, #1
-               RETINSTR(movls,pc,lr)
-               subs    r0, r0, #1
-#endif
-               bhi     __delay
-               RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/ecard.S b/arch/arm26/lib/ecard.S
deleted file mode 100644 (file)
index 658bc45..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- *  linux/arch/arm26/lib/ecard.S
- *
- *  Copyright (C) 1995, 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-#define CPSR2SPSR(rt)
-
-@ Purpose: call an expansion card loader to read bytes.
-@ Proto  : char read_loader(int offset, char *card_base, char *loader);
-@ Returns: byte read
-
-ENTRY(ecard_loader_read)
-               stmfd   sp!, {r4 - r12, lr}
-               mov     r11, r1
-               mov     r1, r0
-               CPSR2SPSR(r0)
-               mov     lr, pc
-               mov     pc, r2
-               LOADREGS(fd, sp!, {r4 - r12, pc})
-
-@ Purpose: call an expansion card loader to reset the card
-@ Proto  : void read_loader(int card_base, char *loader);
-@ Returns: byte read
-
-ENTRY(ecard_loader_reset)
-               stmfd   sp!, {r4 - r12, lr}
-               mov     r11, r0
-               CPSR2SPSR(r0)
-               mov     lr, pc
-               add     pc, r1, #8
-               LOADREGS(fd, sp!, {r4 - r12, pc})
-
diff --git a/arch/arm26/lib/findbit.S b/arch/arm26/lib/findbit.S
deleted file mode 100644 (file)
index 26f67cc..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- *  linux/arch/arm/lib/findbit.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * 16th March 2001 - John Ripley <jripley@sonicblue.com>
- *   Fixed so that "size" is an exclusive not an inclusive quantity.
- *   All users of these functions expect exclusive sizes, and may
- *   also call with zero size.
- * Reworked by rmk.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-                .text
-
-/*
- * Purpose  : Find a 'zero' bit
- * Prototype: int find_first_zero_bit(void *addr, unsigned int maxbit);
- */
-ENTRY(_find_first_zero_bit_le)
-               teq     r1, #0  
-               beq     3f
-               mov     r2, #0
-1:             ldrb    r3, [r0, r2, lsr #3]
-               eors    r3, r3, #0xff           @ invert bits
-               bne     .found                  @ any now set - found zero bit
-               add     r2, r2, #8              @ next bit pointer
-2:             cmp     r2, r1                  @ any more?
-               blo     1b
-3:             mov     r0, r1                  @ no free bits
-               RETINSTR(mov,pc,lr)
-
-/*
- * Purpose  : Find next 'zero' bit
- * Prototype: int find_next_zero_bit(void *addr, unsigned int maxbit, int offset)
- */
-ENTRY(_find_next_zero_bit_le)
-               teq     r1, #0
-               beq     2b
-               ands    ip, r2, #7
-               beq     1b                      @ If new byte, goto old routine
-               ldrb    r3, [r0, r2, lsr #3]
-               eor     r3, r3, #0xff           @ now looking for a 1 bit
-               movs    r3, r3, lsr ip          @ shift off unused bits
-               bne     .found
-               orr     r2, r2, #7              @ if zero, then no bits here
-               add     r2, r2, #1              @ align bit pointer
-               b       2b                      @ loop for next bit
-
-/*
- * One or more bits in the LSB of r3 are assumed to be set.
- */
-.found:                tst     r3, #0x0f
-               addeq   r2, r2, #4
-               movne   r3, r3, lsl #4
-               tst     r3, #0x30
-               addeq   r2, r2, #2
-               movne   r3, r3, lsl #2
-               tst     r3, #0x40
-               addeq   r2, r2, #1
-               mov     r0, r2
-               RETINSTR(mov,pc,lr)
-
diff --git a/arch/arm26/lib/floppydma.S b/arch/arm26/lib/floppydma.S
deleted file mode 100644 (file)
index e99ebbb..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*
- *  linux/arch/arm26/lib/floppydma.S
- *
- *  Copyright (C) 1995, 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-               .text
-
-               .global floppy_fiqin_end
-ENTRY(floppy_fiqin_start)
-               subs    r9, r9, #1
-               ldrgtb  r12, [r11, #-4]
-               ldrleb  r12, [r11], #0
-               strb    r12, [r10], #1
-               subs    pc, lr, #4
-floppy_fiqin_end:
-
-               .global floppy_fiqout_end
-ENTRY(floppy_fiqout_start)
-               subs    r9, r9, #1
-               ldrgeb  r12, [r10], #1
-               movlt   r12, #0
-               strleb  r12, [r11], #0
-               subles  pc, lr, #4
-               strb    r12, [r11, #-4]
-               subs    pc, lr, #4
-floppy_fiqout_end:
diff --git a/arch/arm26/lib/gcclib.h b/arch/arm26/lib/gcclib.h
deleted file mode 100644 (file)
index 9895e78..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/* gcclib.h -- definitions for various functions 'borrowed' from gcc-2.95.3 */
-/* I Molton     29/07/01 */
-
-#define BITS_PER_UNIT  8
-#define SI_TYPE_SIZE (sizeof (SItype) * BITS_PER_UNIT)
-
-typedef unsigned int UQItype    __attribute__ ((mode (QI)));
-typedef          int SItype     __attribute__ ((mode (SI)));
-typedef unsigned int USItype    __attribute__ ((mode (SI)));
-typedef          int DItype     __attribute__ ((mode (DI)));
-typedef          int word_type         __attribute__ ((mode (__word__)));
-typedef unsigned int UDItype    __attribute__ ((mode (DI)));
-
-struct DIstruct {SItype low, high;};
-
-typedef union
-{
-  struct DIstruct s;
-  DItype ll;
-} DIunion;
-
diff --git a/arch/arm26/lib/getuser.S b/arch/arm26/lib/getuser.S
deleted file mode 100644 (file)
index 2b1de7f..0000000
+++ /dev/null
@@ -1,112 +0,0 @@
-/*
- *  linux/arch/arm26/lib/getuser.S
- *
- *  Copyright (C) 2001 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Idea from x86 version, (C) Copyright 1998 Linus Torvalds
- *
- * These functions have a non-standard call interface to make them more
- * efficient, especially as they return an error value in addition to
- * the "real" return value.
- *
- * __get_user_X
- *
- * Inputs:     r0 contains the address
- * Outputs:    r0 is the error code
- *             r1, r2 contains the zero-extended value
- *             lr corrupted
- *
- * No other registers must be altered.  (see include/asm-arm/uaccess.h
- * for specific ASM register usage).
- *
- * Note that ADDR_LIMIT is either 0 or 0xc0000000.
- * Note also that it is intended that __get_user_bad is not global.
- */
-#include <asm/asm-offsets.h>
-#include <asm/thread_info.h>
-#include <asm/errno.h>
-
-        .global __get_user_1
-__get_user_1:
-        bic     r1, sp, #0x1f00
-        bic     r1, r1, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     r1, [r1, #TI_ADDR_LIMIT]
-        sub     r1, r1, #1
-        cmp     r0, r1
-        bge     __get_user_bad
-        cmp     r0, #0x02000000
-1:      ldrlsbt r1, [r0]
-        ldrgeb  r1, [r0]
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-        .global __get_user_2
-__get_user_2:
-        bic     r2, sp, #0x1f00
-        bic     r2, r2, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     r2, [r2, #TI_ADDR_LIMIT]
-        sub     r2, r2, #2
-        cmp     r0, r2
-        bge     __get_user_bad
-        cmp     r0, #0x02000000
-2:      ldrlsbt r1, [r0], #1
-3:      ldrlsbt r2, [r0]
-        ldrgeb  r1, [r0], #1
-        ldrgeb  r2, [r0]
-        orr     r1, r1, r2, lsl #8
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-        .global __get_user_4
-__get_user_4:
-        bic     r1, sp, #0x1f00
-        bic     r1, r1, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     r1, [r1, #TI_ADDR_LIMIT]
-        sub     r1, r1, #4
-        cmp     r0, r1
-        bge     __get_user_bad
-        cmp     r0, #0x02000000
-4:      ldrlst  r1, [r0]
-        ldrge   r1, [r0]
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-        .global __get_user_8
-__get_user_8:
-        bic     r2, sp, #0x1f00
-        bic     r2, r2, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     r2, [r2, #TI_ADDR_LIMIT]
-        sub     r2, r2, #8
-        cmp     r0, r2
-        bge     __get_user_bad_8
-        cmp     r0, #0x02000000
-5:      ldrlst  r1, [r0], #4
-6:      ldrlst  r2, [r0]
-        ldrge   r1, [r0], #4
-        ldrge   r2, [r0]
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-__get_user_bad_8:
-        mov     r2, #0
-__get_user_bad:
-        mov     r1, #0
-        mov     r0, #-EFAULT
-        ldmfd   sp!, {pc}^
-
-.section __ex_table, "a"
-       .long   1b, __get_user_bad
-       .long   2b, __get_user_bad
-       .long   3b, __get_user_bad
-       .long   4b, __get_user_bad
-       .long   5b, __get_user_bad_8
-       .long   6b, __get_user_bad_8
-.previous
diff --git a/arch/arm26/lib/io-acorn.S b/arch/arm26/lib/io-acorn.S
deleted file mode 100644 (file)
index 5f62ade..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  linux/arch/arm26/lib/io-acorn.S
- *
- *  Copyright (C) 1995, 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-               .text
-               .align
-
-               .equ    diff_pcio_base, PCIO_BASE - IO_BASE
-
-               .macro  outw2   rd
-               mov     r8, \rd, lsl #16
-               orr     r8, r8, r8, lsr #16
-               str     r8, [r3, r0, lsl #2]
-               mov     r8, \rd, lsr #16
-               orr     r8, r8, r8, lsl #16
-               str     r8, [r3, r0, lsl #2]
-               .endm
-
-               .macro  inw2    rd, mask, temp
-               ldr     \rd, [r0]
-               and     \rd, \rd, \mask
-               ldr     \temp, [r0]
-               orr     \rd, \rd, \temp, lsl #16
-               .endm
-
-               .macro  addr    rd
-               tst     \rd, #0x80000000
-               mov     \rd, \rd, lsl #2
-               add     \rd, \rd, #IO_BASE
-               addeq   \rd, \rd, #diff_pcio_base
-               .endm
-
-.iosl_warning:
-               .ascii  "<4>insl/outsl not implemented, called from %08lX\0"
-               .align
-
-/*
- * These make no sense on Acorn machines.
- * Print a warning message.
- */
-ENTRY(insl)
-ENTRY(outsl)
-               adr     r0, .iosl_warning
-               mov     r1, lr
-               b       printk
-
-@ Purpose: write a memc register
-@ Proto  : void memc_write(int register, int value);
-@ Returns: nothing
-
-ENTRY(memc_write)
-               cmp     r0, #7
-               RETINSTR(movgt,pc,lr)
-               mov     r0, r0, lsl #17
-               mov     r1, r1, lsl #15
-               mov     r1, r1, lsr #17
-               orr     r0, r0, r1, lsl #2
-               add     r0, r0, #0x03600000
-               strb    r0, [r0]
-               RETINSTR(mov,pc,lr)
-
diff --git a/arch/arm26/lib/io-readsb.S b/arch/arm26/lib/io-readsb.S
deleted file mode 100644 (file)
index 4c4d99c..0000000
+++ /dev/null
@@ -1,116 +0,0 @@
-/*
- *  linux/arch/arm26/lib/io-readsb.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-.insb_align:   rsb     ip, ip, #4
-               cmp     ip, r2
-               movgt   ip, r2
-               cmp     ip, #2
-               ldrb    r3, [r0]
-               strb    r3, [r1], #1
-               ldrgeb  r3, [r0]
-               strgeb  r3, [r1], #1
-               ldrgtb  r3, [r0]
-               strgtb  r3, [r1], #1
-               subs    r2, r2, ip
-               bne     .insb_aligned
-
-ENTRY(__raw_readsb)
-               teq     r2, #0          @ do we have to check for the zero len?
-               moveq   pc, lr
-               ands    ip, r1, #3
-               bne     .insb_align
-
-.insb_aligned: stmfd   sp!, {r4 - r6, lr}
-
-               subs    r2, r2, #16
-               bmi     .insb_no_16
-
-.insb_16_lp:   ldrb    r3, [r0]
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #8
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #16
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #24
-               ldrb    r4, [r0]
-               ldrb    r5, [r0]
-               orr     r4, r4, r5, lsl #8
-               ldrb    r5, [r0]
-               orr     r4, r4, r5, lsl #16
-               ldrb    r5, [r0]
-               orr     r4, r4, r5, lsl #24
-               ldrb    r5, [r0]
-               ldrb    r6, [r0]
-               orr     r5, r5, r6, lsl #8
-               ldrb    r6, [r0]
-               orr     r5, r5, r6, lsl #16
-               ldrb    r6, [r0]
-               orr     r5, r5, r6, lsl #24
-               ldrb    r6, [r0]
-               ldrb    ip, [r0]
-               orr     r6, r6, ip, lsl #8
-               ldrb    ip, [r0]
-               orr     r6, r6, ip, lsl #16
-               ldrb    ip, [r0]
-               orr     r6, r6, ip, lsl #24
-               stmia   r1!, {r3 - r6}
-
-               subs    r2, r2, #16
-               bpl     .insb_16_lp
-
-               tst     r2, #15
-               LOADREGS(eqfd, sp!, {r4 - r6, pc})
-
-.insb_no_16:   tst     r2, #8
-               beq     .insb_no_8
-
-               ldrb    r3, [r0]
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #8
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #16
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #24
-               ldrb    r4, [r0]
-               ldrb    r5, [r0]
-               orr     r4, r4, r5, lsl #8
-               ldrb    r5, [r0]
-               orr     r4, r4, r5, lsl #16
-               ldrb    r5, [r0]
-               orr     r4, r4, r5, lsl #24
-               stmia   r1!, {r3, r4}
-
-.insb_no_8:    tst     r2, #4
-               beq     .insb_no_4
-
-               ldrb    r3, [r0]
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #8
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #16
-               ldrb    r4, [r0]
-               orr     r3, r3, r4, lsl #24
-               str     r3, [r1], #4
-
-.insb_no_4:    ands    r2, r2, #3
-               LOADREGS(eqfd, sp!, {r4 - r6, pc})
-
-               cmp     r2, #2
-               ldrb    r3, [r0]
-               strb    r3, [r1], #1
-               ldrgeb  r3, [r0]
-               strgeb  r3, [r1], #1
-               ldrgtb  r3, [r0]
-               strgtb  r3, [r1]
-
-               LOADREGS(fd, sp!, {r4 - r6, pc})
diff --git a/arch/arm26/lib/io-readsl.S b/arch/arm26/lib/io-readsl.S
deleted file mode 100644 (file)
index 7be208b..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *  linux/arch/arm26/lib/io-readsl.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-/*
- * Note that some reads can be aligned on half-word boundaries.
- */
-ENTRY(__raw_readsl)
-               teq     r2, #0          @ do we have to check for the zero len?
-               moveq   pc, lr
-               ands    ip, r1, #3
-               bne     2f
-
-1:             ldr     r3, [r0]
-               str     r3, [r1], #4
-               subs    r2, r2, #1
-               bne     1b
-               mov     pc, lr
-
-2:             cmp     ip, #2
-               ldr     ip, [r0]
-               blt     4f
-               bgt     6f
-
-               strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-               strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-3:             subs    r2, r2, #1
-               ldrne   r3, [r0]
-               orrne   ip, ip, r3, lsl #16
-               strne   ip, [r1], #4
-               movne   ip, r3, lsr #16
-               bne     3b
-               strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-               strb    ip, [r1], #1
-               mov     pc, lr
-
-4:             strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-               strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-               strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-5:             subs    r2, r2, #1
-               ldrne   r3, [r0]
-               orrne   ip, ip, r3, lsl #8
-               strne   ip, [r1], #4
-               movne   ip, r3, lsr #24
-               bne     5b
-               strb    ip, [r1], #1
-               mov     pc, lr
-
-6:             strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-7:             subs    r2, r2, #1
-               ldrne   r3, [r0]
-               orrne   ip, ip, r3, lsl #24
-               strne   ip, [r1], #4
-               movne   ip, r3, lsr #8
-               bne     7b
-               strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-               strb    ip, [r1], #1
-               mov     ip, ip, lsr #8
-               strb    ip, [r1], #1
-               mov     pc, lr
-
diff --git a/arch/arm26/lib/io-readsw.S b/arch/arm26/lib/io-readsw.S
deleted file mode 100644 (file)
index c65c1f2..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- *  linux/arch/arm26/lib/io-readsw.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-.insw_bad_alignment:
-               adr     r0, .insw_bad_align_msg
-               mov     r2, lr
-               b       panic
-.insw_bad_align_msg:
-               .asciz  "insw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
-               .align
-
-.insw_align:   tst     r1, #1
-               bne     .insw_bad_alignment
-
-               ldr     r3, [r0]
-               strb    r3, [r1], #1
-               mov     r3, r3, lsr #8
-               strb    r3, [r1], #1
-
-               subs    r2, r2, #1
-               RETINSTR(moveq, pc, lr)
-
-ENTRY(__raw_readsw)
-               teq     r2, #0          @ do we have to check for the zero len?
-               moveq   pc, lr
-               tst     r1, #3
-               bne     .insw_align
-
-.insw_aligned: mov     ip, #0xff
-               orr     ip, ip, ip, lsl #8
-               stmfd   sp!, {r4, r5, r6, lr}
-
-               subs    r2, r2, #8
-               bmi     .no_insw_8
-
-.insw_8_lp:    ldr     r3, [r0]
-               and     r3, r3, ip
-               ldr     r4, [r0]
-               orr     r3, r3, r4, lsl #16
-
-               ldr     r4, [r0]
-               and     r4, r4, ip
-               ldr     r5, [r0]
-               orr     r4, r4, r5, lsl #16
-
-               ldr     r5, [r0]
-               and     r5, r5, ip
-               ldr     r6, [r0]
-               orr     r5, r5, r6, lsl #16
-
-               ldr     r6, [r0]
-               and     r6, r6, ip
-               ldr     lr, [r0]
-               orr     r6, r6, lr, lsl #16
-
-               stmia   r1!, {r3 - r6}
-
-               subs    r2, r2, #8
-               bpl     .insw_8_lp
-
-               tst     r2, #7
-               LOADREGS(eqfd, sp!, {r4, r5, r6, pc})
-
-.no_insw_8:    tst     r2, #4
-               beq     .no_insw_4
-
-               ldr     r3, [r0]
-               and     r3, r3, ip
-               ldr     r4, [r0]
-               orr     r3, r3, r4, lsl #16
-
-               ldr     r4, [r0]
-               and     r4, r4, ip
-               ldr     r5, [r0]
-               orr     r4, r4, r5, lsl #16
-
-               stmia   r1!, {r3, r4}
-
-.no_insw_4:    tst     r2, #2
-               beq     .no_insw_2
-
-               ldr     r3, [r0]
-               and     r3, r3, ip
-               ldr     r4, [r0]
-               orr     r3, r3, r4, lsl #16
-
-               str     r3, [r1], #4
-
-.no_insw_2:    tst     r2, #1
-               ldrne   r3, [r0]
-               strneb  r3, [r1], #1
-               movne   r3, r3, lsr #8
-               strneb  r3, [r1]
-
-               LOADREGS(fd, sp!, {r4, r5, r6, pc})
-
-
diff --git a/arch/arm26/lib/io-writesb.S b/arch/arm26/lib/io-writesb.S
deleted file mode 100644 (file)
index 16251b4..0000000
+++ /dev/null
@@ -1,122 +0,0 @@
-/*
- *  linux/arch/arm26/lib/io-writesb.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-.outsb_align:  rsb     ip, ip, #4
-               cmp     ip, r2
-               movgt   ip, r2
-               cmp     ip, #2
-               ldrb    r3, [r1], #1
-               strb    r3, [r0]
-               ldrgeb  r3, [r1], #1
-               strgeb  r3, [r0]
-               ldrgtb  r3, [r1], #1
-               strgtb  r3, [r0]
-               subs    r2, r2, ip
-               bne     .outsb_aligned
-
-ENTRY(__raw_writesb)
-               teq     r2, #0          @ do we have to check for the zero len?
-               moveq   pc, lr
-               ands    ip, r1, #3
-               bne     .outsb_align
-
-.outsb_aligned:        stmfd   sp!, {r4 - r6, lr}
-
-               subs    r2, r2, #16
-               bmi     .outsb_no_16
-
-.outsb_16_lp:  ldmia   r1!, {r3 - r6}
-
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-
-               strb    r4, [r0]
-               mov     r4, r4, lsr #8
-               strb    r4, [r0]
-               mov     r4, r4, lsr #8
-               strb    r4, [r0]
-               mov     r4, r4, lsr #8
-               strb    r4, [r0]
-
-               strb    r5, [r0]
-               mov     r5, r5, lsr #8
-               strb    r5, [r0]
-               mov     r5, r5, lsr #8
-               strb    r5, [r0]
-               mov     r5, r5, lsr #8
-               strb    r5, [r0]
-
-               strb    r6, [r0]
-               mov     r6, r6, lsr #8
-               strb    r6, [r0]
-               mov     r6, r6, lsr #8
-               strb    r6, [r0]
-               mov     r6, r6, lsr #8
-               strb    r6, [r0]
-
-               subs    r2, r2, #16
-               bpl     .outsb_16_lp
-
-               tst     r2, #15
-               LOADREGS(eqfd, sp!, {r4 - r6, pc})
-
-.outsb_no_16:  tst     r2, #8
-               beq     .outsb_no_8
-
-               ldmia   r1!, {r3, r4}
-
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-
-               strb    r4, [r0]
-               mov     r4, r4, lsr #8
-               strb    r4, [r0]
-               mov     r4, r4, lsr #8
-               strb    r4, [r0]
-               mov     r4, r4, lsr #8
-               strb    r4, [r0]
-
-.outsb_no_8:   tst     r2, #4
-               beq     .outsb_no_4
-
-               ldr     r3, [r1], #4
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-               mov     r3, r3, lsr #8
-               strb    r3, [r0]
-
-.outsb_no_4:   ands    r2, r2, #3
-               LOADREGS(eqfd, sp!, {r4 - r6, pc})
-
-               cmp     r2, #2
-               ldrb    r3, [r1], #1
-               strb    r3, [r0]
-               ldrgeb  r3, [r1], #1
-               strgeb  r3, [r0]
-               ldrgtb  r3, [r1]
-               strgtb  r3, [r0]
-
-               LOADREGS(fd, sp!, {r4 - r6, pc})
diff --git a/arch/arm26/lib/io-writesl.S b/arch/arm26/lib/io-writesl.S
deleted file mode 100644 (file)
index 4d6049b..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  linux/arch/arm26/lib/io-writesl.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-ENTRY(__raw_writesl)
-               teq     r2, #0          @ do we have to check for the zero len?
-               moveq   pc, lr
-               ands    ip, r1, #3
-               bne     2f
-
-1:             ldr     r3, [r1], #4
-               str     r3, [r0]
-               subs    r2, r2, #1
-               bne     1b
-               mov     pc, lr
-
-2:             bic     r1, r1, #3
-               cmp     ip, #2
-               ldr     r3, [r1], #4
-               bgt     4f
-               blt     5f
-
-3:             mov     ip, r3, lsr #16
-               ldr     r3, [r1], #4
-               orr     ip, ip, r3, lsl #16
-               str     ip, [r0]
-               subs    r2, r2, #1
-               bne     3b
-               mov     pc, lr
-
-4:             mov     ip, r3, lsr #24
-               ldr     r3, [r1], #4
-               orr     ip, ip, r3, lsl #8
-               str     ip, [r0]
-               subs    r2, r2, #1
-               bne     4b
-               mov     pc, lr
-
-5:             mov     ip, r3, lsr #8
-               ldr     r3, [r1], #4
-               orr     ip, ip, r3, lsl #24
-               str     ip, [r0]
-               subs    r2, r2, #1
-               bne     5b
-               mov     pc, lr
-
-
diff --git a/arch/arm26/lib/io-writesw.S b/arch/arm26/lib/io-writesw.S
deleted file mode 100644 (file)
index a24f891..0000000
+++ /dev/null
@@ -1,127 +0,0 @@
-/*
- *  linux/arch/arm26/lib/io-writesw.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-.outsw_bad_alignment:
-               adr     r0, .outsw_bad_align_msg
-               mov     r2, lr
-               b       panic
-.outsw_bad_align_msg:
-               .asciz  "outsw: bad buffer alignment (0x%p, lr=0x%08lX)\n"
-               .align
-
-.outsw_align:  tst     r1, #1
-               bne     .outsw_bad_alignment
-
-               add     r1, r1, #2
-
-               ldr     r3, [r1, #-4]
-               mov     r3, r3, lsr #16
-               orr     r3, r3, r3, lsl #16
-               str     r3, [r0]
-               subs    r2, r2, #1
-               RETINSTR(moveq, pc, lr)
-
-ENTRY(__raw_writesw)
-               teq     r2, #0          @ do we have to check for the zero len?
-               moveq   pc, lr
-               tst     r1, #3
-               bne     .outsw_align
-
-.outsw_aligned:        stmfd   sp!, {r4, r5, r6, lr}
-
-               subs    r2, r2, #8
-               bmi     .no_outsw_8
-
-.outsw_8_lp:   ldmia   r1!, {r3, r4, r5, r6}
-
-               mov     ip, r3, lsl #16
-               orr     ip, ip, ip, lsr #16
-               str     ip, [r0]
-
-               mov     ip, r3, lsr #16
-               orr     ip, ip, ip, lsl #16
-               str     ip, [r0]
-
-               mov     ip, r4, lsl #16
-               orr     ip, ip, ip, lsr #16
-               str     ip, [r0]
-
-               mov     ip, r4, lsr #16
-               orr     ip, ip, ip, lsl #16
-               str     ip, [r0]
-
-               mov     ip, r5, lsl #16
-               orr     ip, ip, ip, lsr #16
-               str     ip, [r0]
-
-               mov     ip, r5, lsr #16
-               orr     ip, ip, ip, lsl #16
-               str     ip, [r0]
-
-               mov     ip, r6, lsl #16
-               orr     ip, ip, ip, lsr #16
-               str     ip, [r0]
-
-               mov     ip, r6, lsr #16
-               orr     ip, ip, ip, lsl #16
-               str     ip, [r0]
-
-               subs    r2, r2, #8
-               bpl     .outsw_8_lp
-
-               tst     r2, #7
-               LOADREGS(eqfd, sp!, {r4, r5, r6, pc})
-
-.no_outsw_8:   tst     r2, #4
-               beq     .no_outsw_4
-
-               ldmia   r1!, {r3, r4}
-
-               mov     ip, r3, lsl #16
-               orr     ip, ip, ip, lsr #16
-               str     ip, [r0]
-
-               mov     ip, r3, lsr #16
-               orr     ip, ip, ip, lsl #16
-               str     ip, [r0]
-
-               mov     ip, r4, lsl #16
-               orr     ip, ip, ip, lsr #16
-               str     ip, [r0]
-
-               mov     ip, r4, lsr #16
-               orr     ip, ip, ip, lsl #16
-               str     ip, [r0]
-
-.no_outsw_4:   tst     r2, #2
-               beq     .no_outsw_2
-
-               ldr     r3, [r1], #4
-
-               mov     ip, r3, lsl #16
-               orr     ip, ip, ip, lsr #16
-               str     ip, [r0]
-
-               mov     ip, r3, lsr #16
-               orr     ip, ip, ip, lsl #16
-               str     ip, [r0]
-
-.no_outsw_2:   tst     r2, #1
-
-               ldrne   r3, [r1]
-
-               movne   ip, r3, lsl #16
-               orrne   ip, ip, ip, lsr #16
-               strne   ip, [r0]
-
-               LOADREGS(fd, sp!, {r4, r5, r6, pc})
diff --git a/arch/arm26/lib/kbd.c b/arch/arm26/lib/kbd.c
deleted file mode 100644 (file)
index cb56e94..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-#include <linux/kd.h>
-//#include <linux/kbd_ll.h>
-#include <linux/kbd_kern.h>
-
-/*
- * Translation of escaped scancodes to keycodes.
- * This is now user-settable.
- * The keycodes 1-88,96-111,119 are fairly standard, and
- * should probably not be changed - changing might confuse X.
- * X also interprets scancode 0x5d (KEY_Begin).
- *
- * For 1-88 keycode equals scancode.
- */
-
-#define E0_KPENTER 96
-#define E0_RCTRL   97
-#define E0_KPSLASH 98
-#define E0_PRSCR   99
-#define E0_RALT    100
-#define E0_BREAK   101         /* (control-pause) */
-#define E0_HOME    102
-#define E0_UP      103
-#define E0_PGUP    104
-#define E0_LEFT    105
-#define E0_RIGHT   106
-#define E0_END     107
-#define E0_DOWN    108
-#define E0_PGDN    109
-#define E0_INS     110
-#define E0_DEL     111
-
-/* for USB 106 keyboard */
-#define E0_YEN         124
-#define E0_BACKSLASH   89
-
-
-#define E1_PAUSE   119
-
-/*
- * The keycodes below are randomly located in 89-95,112-118,120-127.
- * They could be thrown away (and all occurrences below replaced by 0),
- * but that would force many users to use the `setkeycodes' utility, where
- * they needed not before. It does not matter that there are duplicates, as
- * long as no duplication occurs for any single keyboard.
- */
-#define SC_LIM 89
-
-#define FOCUS_PF1 85           /* actual code! */
-#define FOCUS_PF2 89
-#define FOCUS_PF3 90
-#define FOCUS_PF4 91
-#define FOCUS_PF5 92
-#define FOCUS_PF6 93
-#define FOCUS_PF7 94
-#define FOCUS_PF8 95
-#define FOCUS_PF9 120
-#define FOCUS_PF10 121
-#define FOCUS_PF11 122
-#define FOCUS_PF12 123
-
-#define JAP_86     124
-/* tfj@olivia.ping.dk:
- * The four keys are located over the numeric keypad, and are
- * labelled A1-A4. It's an rc930 keyboard, from
- * Regnecentralen/RC International, Now ICL.
- * Scancodes: 59, 5a, 5b, 5c.
- */
-#define RGN1 124
-#define RGN2 125
-#define RGN3 126
-#define RGN4 127
-
-static unsigned char high_keys[128 - SC_LIM] = {
-       RGN1, RGN2, RGN3, RGN4, 0, 0, 0,        /* 0x59-0x5f */
-       0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
-       0, 0, 0, 0, 0, FOCUS_PF11, 0, FOCUS_PF12,       /* 0x68-0x6f */
-       0, 0, 0, FOCUS_PF2, FOCUS_PF9, 0, 0, FOCUS_PF3, /* 0x70-0x77 */
-       FOCUS_PF4, FOCUS_PF5, FOCUS_PF6, FOCUS_PF7,     /* 0x78-0x7b */
-       FOCUS_PF8, JAP_86, FOCUS_PF10, 0        /* 0x7c-0x7f */
-};
-
-/* BTC */
-#define E0_MACRO   112
-/* LK450 */
-#define E0_F13     113
-#define E0_F14     114
-#define E0_HELP    115
-#define E0_DO      116
-#define E0_F17     117
-#define E0_KPMINPLUS 118
-/*
- * My OmniKey generates e0 4c for  the "OMNI" key and the
- * right alt key does nada. [kkoller@nyx10.cs.du.edu]
- */
-#define E0_OK  124
-/*
- * New microsoft keyboard is rumoured to have
- * e0 5b (left window button), e0 5c (right window button),
- * e0 5d (menu button). [or: LBANNER, RBANNER, RMENU]
- * [or: Windows_L, Windows_R, TaskMan]
- */
-#define E0_MSLW        125
-#define E0_MSRW        126
-#define E0_MSTM        127
-
-static unsigned char e0_keys[128] = {
-       0, 0, 0, 0, 0, 0, 0, 0, /* 0x00-0x07 */
-       0, 0, 0, 0, 0, 0, 0, 0, /* 0x08-0x0f */
-       0, 0, 0, 0, 0, 0, 0, 0, /* 0x10-0x17 */
-       0, 0, 0, 0, E0_KPENTER, E0_RCTRL, 0, 0, /* 0x18-0x1f */
-       0, 0, 0, 0, 0, 0, 0, 0, /* 0x20-0x27 */
-       0, 0, 0, 0, 0, 0, 0, 0, /* 0x28-0x2f */
-       0, 0, 0, 0, 0, E0_KPSLASH, 0, E0_PRSCR, /* 0x30-0x37 */
-       E0_RALT, 0, 0, 0, 0, E0_F13, E0_F14, E0_HELP,   /* 0x38-0x3f */
-       E0_DO, E0_F17, 0, 0, 0, 0, E0_BREAK, E0_HOME,   /* 0x40-0x47 */
-       E0_UP, E0_PGUP, 0, E0_LEFT, E0_OK, E0_RIGHT, E0_KPMINPLUS, E0_END,      /* 0x48-0x4f */
-       E0_DOWN, E0_PGDN, E0_INS, E0_DEL, 0, 0, 0, 0,   /* 0x50-0x57 */
-       0, 0, 0, E0_MSLW, E0_MSRW, E0_MSTM, 0, 0,       /* 0x58-0x5f */
-       0, 0, 0, 0, 0, 0, 0, 0, /* 0x60-0x67 */
-       0, 0, 0, 0, 0, 0, 0, E0_MACRO,  /* 0x68-0x6f */
-       //0, 0, 0, 0, 0, 0, 0, 0,                          /* 0x70-0x77 */
-       0, 0, 0, 0, 0, E0_BACKSLASH, 0, 0,      /* 0x70-0x77 */
-       0, 0, 0, E0_YEN, 0, 0, 0, 0     /* 0x78-0x7f */
-};
-
-static int gen_setkeycode(unsigned int scancode, unsigned int keycode)
-{
-       if (scancode < SC_LIM || scancode > 255 || keycode > 127)
-               return -EINVAL;
-       if (scancode < 128)
-               high_keys[scancode - SC_LIM] = keycode;
-       else
-               e0_keys[scancode - 128] = keycode;
-       return 0;
-}
-
-static int gen_getkeycode(unsigned int scancode)
-{
-       return
-           (scancode < SC_LIM || scancode > 255) ? -EINVAL :
-           (scancode <
-            128) ? high_keys[scancode - SC_LIM] : e0_keys[scancode - 128];
-}
-
-static int
-gen_translate(unsigned char scancode, unsigned char *keycode, char raw_mode)
-{
-       static int prev_scancode;
-
-       /* special prefix scancodes.. */
-       if (scancode == 0xe0 || scancode == 0xe1) {
-               prev_scancode = scancode;
-               return 0;
-       }
-
-       /* 0xFF is sent by a few keyboards, ignore it. 0x00 is error */
-       if (scancode == 0x00 || scancode == 0xff) {
-               prev_scancode = 0;
-               return 0;
-       }
-
-       scancode &= 0x7f;
-
-       if (prev_scancode) {
-               /*
-                * usually it will be 0xe0, but a Pause key generates
-                * e1 1d 45 e1 9d c5 when pressed, and nothing when released
-                */
-               if (prev_scancode != 0xe0) {
-                       if (prev_scancode == 0xe1 && scancode == 0x1d) {
-                               prev_scancode = 0x100;
-                               return 0;
-                       }
-                               else if (prev_scancode == 0x100
-                                        && scancode == 0x45) {
-                               *keycode = E1_PAUSE;
-                               prev_scancode = 0;
-                       } else {
-#ifdef KBD_REPORT_UNKN
-                               if (!raw_mode)
-                                       printk(KERN_INFO
-                                              "keyboard: unknown e1 escape sequence\n");
-#endif
-                               prev_scancode = 0;
-                               return 0;
-                       }
-               } else {
-                       prev_scancode = 0;
-                       /*
-                        *  The keyboard maintains its own internal caps lock and
-                        *  num lock statuses. In caps lock mode E0 AA precedes make
-                        *  code and E0 2A follows break code. In num lock mode,
-                        *  E0 2A precedes make code and E0 AA follows break code.
-                        *  We do our own book-keeping, so we will just ignore these.
-                        */
-                       /*
-                        *  For my keyboard there is no caps lock mode, but there are
-                        *  both Shift-L and Shift-R modes. The former mode generates
-                        *  E0 2A / E0 AA pairs, the latter E0 B6 / E0 36 pairs.
-                        *  So, we should also ignore the latter. - aeb@cwi.nl
-                        */
-                       if (scancode == 0x2a || scancode == 0x36)
-                               return 0;
-
-                       if (e0_keys[scancode])
-                               *keycode = e0_keys[scancode];
-                       else {
-#ifdef KBD_REPORT_UNKN
-                               if (!raw_mode)
-                                       printk(KERN_INFO
-                                              "keyboard: unknown scancode e0 %02x\n",
-                                              scancode);
-#endif
-                               return 0;
-                       }
-               }
-       } else if (scancode >= SC_LIM) {
-               /* This happens with the FOCUS 9000 keyboard
-                  Its keys PF1..PF12 are reported to generate
-                  55 73 77 78 79 7a 7b 7c 74 7e 6d 6f
-                  Moreover, unless repeated, they do not generate
-                  key-down events, so we have to zero up_flag below */
-               /* Also, Japanese 86/106 keyboards are reported to
-                  generate 0x73 and 0x7d for \ - and \ | respectively. */
-               /* Also, some Brazilian keyboard is reported to produce
-                  0x73 and 0x7e for \ ? and KP-dot, respectively. */
-
-               *keycode = high_keys[scancode - SC_LIM];
-
-               if (!*keycode) {
-                       if (!raw_mode) {
-#ifdef KBD_REPORT_UNKN
-                               printk(KERN_INFO
-                                      "keyboard: unrecognized scancode (%02x)"
-                                      " - ignored\n", scancode);
-#endif
-                       }
-                       return 0;
-               }
-       } else
-               *keycode = scancode;
-       return 1;
-}
-
-static char gen_unexpected_up(unsigned char keycode)
-{
-       /* unexpected, but this can happen: maybe this was a key release for a
-          FOCUS 9000 PF key; if we want to see it, we have to clear up_flag */
-       if (keycode >= SC_LIM || keycode == 85)
-               return 0;
-       else
-               return 0200;
-}
-
-/*
- * These are the default mappings
- */
-int  (*k_setkeycode)(unsigned int, unsigned int) = gen_setkeycode;
-int  (*k_getkeycode)(unsigned int) = gen_getkeycode;
-int  (*k_translate)(unsigned char, unsigned char *, char) = gen_translate;
-char (*k_unexpected_up)(unsigned char) = gen_unexpected_up;
-void (*k_leds)(unsigned char);
-
-/* Simple translation table for the SysRq keys */
-
-#ifdef CONFIG_MAGIC_SYSRQ
-static unsigned char gen_sysrq_xlate[128] =
-       "\000\0331234567890-=\177\t"    /* 0x00 - 0x0f */
-       "qwertyuiop[]\r\000as"  /* 0x10 - 0x1f */
-       "dfghjkl;'`\000\\zxcv"  /* 0x20 - 0x2f */
-       "bnm,./\000*\000 \000\201\202\203\204\205"      /* 0x30 - 0x3f */
-       "\206\207\210\211\212\000\000789-456+1" /* 0x40 - 0x4f */
-       "230\177\000\000\213\214\000\000\000\000\000\000\000\000\000\000"       /* 0x50 - 0x5f */
-       "\r\000/";                      /* 0x60 - 0x6f */
-
-unsigned char *k_sysrq_xlate = gen_sysrq_xlate;
-int k_sysrq_key = 0x54;
-#endif
diff --git a/arch/arm26/lib/lib1funcs.S b/arch/arm26/lib/lib1funcs.S
deleted file mode 100644 (file)
index 0e29970..0000000
+++ /dev/null
@@ -1,313 +0,0 @@
-@ libgcc1 routines for ARM cpu.
-@ Division routines, written by Richard Earnshaw, (rearnsha@armltd.co.uk)
-
-/* Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
-
-This file is free software; you can redistribute it and/or modify it
-under the terms of the GNU General Public License as published by the
-Free Software Foundation; either version 2, or (at your option) any
-later version.
-
-In addition to the permissions in the GNU General Public License, the
-Free Software Foundation gives you unlimited permission to link the
-compiled version of this file with other programs, and to distribute
-those programs without any restriction coming from the use of this
-file.  (The General Public License restrictions do apply in other
-respects; for example, they cover modification of the file, and
-distribution when not linked into another program.)
-
-This file is distributed in the hope that it will be useful, but
-WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
-General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with this program; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.
- */
-/* This code is derived from gcc 2.95.3 */
-/* I Molton     29/07/01 */
-
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/hardware.h>
-
-#define RET    movs
-#define RETc(x)        mov##x##s
-#define RETCOND ^
-
-dividend       .req    r0
-divisor                .req    r1
-result         .req    r2
-overdone        .req    r2
-curbit         .req    r3
-ip             .req    r12
-sp             .req    r13
-lr             .req    r14
-pc             .req    r15
-       
-ENTRY(__udivsi3)
-       cmp     divisor, #0
-       beq     Ldiv0
-       mov     curbit, #1
-       mov     result, #0
-       cmp     dividend, divisor
-       bcc     Lgot_result_udivsi3
-1:
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is 
-       @ larger than the dividend.
-       cmp     divisor, #0x10000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #4
-       movcc   curbit, curbit, lsl #4
-       bcc     1b
-
-2:
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-       cmp     divisor, #0x80000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #1
-       movcc   curbit, curbit, lsl #1
-       bcc     2b
-
-3:
-       @ Test for possible subtractions, and note which bits
-       @ are done in the result.  On the final pass, this may subtract
-       @ too much from the dividend, but the result will be ok, since the
-       @ "bit" will have been shifted out at the bottom.
-       cmp     dividend, divisor
-       subcs   dividend, dividend, divisor
-       orrcs   result, result, curbit
-       cmp     dividend, divisor, lsr #1
-       subcs   dividend, dividend, divisor, lsr #1
-       orrcs   result, result, curbit, lsr #1
-       cmp     dividend, divisor, lsr #2
-       subcs   dividend, dividend, divisor, lsr #2
-       orrcs   result, result, curbit, lsr #2
-       cmp     dividend, divisor, lsr #3
-       subcs   dividend, dividend, divisor, lsr #3
-       orrcs   result, result, curbit, lsr #3
-       cmp     dividend, #0                    @ Early termination?
-       movnes  curbit, curbit, lsr #4          @ No, any more bits to do?
-       movne   divisor, divisor, lsr #4
-       bne     3b
-Lgot_result_udivsi3:
-       mov     r0, result
-       RET     pc, lr
-
-Ldiv0:
-       str     lr, [sp, #-4]!
-       bl      __div0
-       mov     r0, #0                  @ about as wrong as it could be
-       ldmia   sp!, {pc}RETCOND
-
-/* __umodsi3 ----------------------- */
-
-ENTRY(__umodsi3)
-       cmp     divisor, #0
-       beq     Ldiv0
-       mov     curbit, #1
-       cmp     dividend, divisor
-       RETc(cc)        pc, lr
-1:
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is 
-       @ larger than the dividend.
-       cmp     divisor, #0x10000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #4
-       movcc   curbit, curbit, lsl #4
-       bcc     1b
-
-2:
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-       cmp     divisor, #0x80000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #1
-       movcc   curbit, curbit, lsl #1
-       bcc     2b
-
-3:
-       @ Test for possible subtractions.  On the final pass, this may 
-       @ subtract too much from the dividend, so keep track of which
-       @ subtractions are done, we can fix them up afterwards...
-       mov     overdone, #0
-       cmp     dividend, divisor
-       subcs   dividend, dividend, divisor
-       cmp     dividend, divisor, lsr #1
-       subcs   dividend, dividend, divisor, lsr #1
-       orrcs   overdone, overdone, curbit, ror #1
-       cmp     dividend, divisor, lsr #2
-       subcs   dividend, dividend, divisor, lsr #2
-       orrcs   overdone, overdone, curbit, ror #2
-       cmp     dividend, divisor, lsr #3
-       subcs   dividend, dividend, divisor, lsr #3
-       orrcs   overdone, overdone, curbit, ror #3
-       mov     ip, curbit
-       cmp     dividend, #0                    @ Early termination?
-       movnes  curbit, curbit, lsr #4          @ No, any more bits to do?
-       movne   divisor, divisor, lsr #4
-       bne     3b
-
-       @ Any subtractions that we should not have done will be recorded in
-       @ the top three bits of "overdone".  Exactly which were not needed
-       @ are governed by the position of the bit, stored in ip.
-       @ If we terminated early, because dividend became zero,
-       @ then none of the below will match, since the bit in ip will not be
-       @ in the bottom nibble.
-       ands    overdone, overdone, #0xe0000000
-       RETc(eq)        pc, lr                          @ No fixups needed
-       tst     overdone, ip, ror #3
-       addne   dividend, dividend, divisor, lsr #3
-       tst     overdone, ip, ror #2
-       addne   dividend, dividend, divisor, lsr #2
-       tst     overdone, ip, ror #1
-       addne   dividend, dividend, divisor, lsr #1
-       RET     pc, lr
-
-ENTRY(__divsi3)
-       eor     ip, dividend, divisor           @ Save the sign of the result.
-       mov     curbit, #1
-       mov     result, #0
-       cmp     divisor, #0
-       rsbmi   divisor, divisor, #0            @ Loops below use unsigned.
-       beq     Ldiv0
-       cmp     dividend, #0
-       rsbmi   dividend, dividend, #0
-       cmp     dividend, divisor
-       bcc     Lgot_result_divsi3
-
-1:
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is 
-       @ larger than the dividend.
-       cmp     divisor, #0x10000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #4
-       movcc   curbit, curbit, lsl #4
-       bcc     1b
-
-2:
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-       cmp     divisor, #0x80000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #1
-       movcc   curbit, curbit, lsl #1
-       bcc     2b
-
-3:
-       @ Test for possible subtractions, and note which bits
-       @ are done in the result.  On the final pass, this may subtract
-       @ too much from the dividend, but the result will be ok, since the
-       @ "bit" will have been shifted out at the bottom.
-       cmp     dividend, divisor
-       subcs   dividend, dividend, divisor
-       orrcs   result, result, curbit
-       cmp     dividend, divisor, lsr #1
-       subcs   dividend, dividend, divisor, lsr #1
-       orrcs   result, result, curbit, lsr #1
-       cmp     dividend, divisor, lsr #2
-       subcs   dividend, dividend, divisor, lsr #2
-       orrcs   result, result, curbit, lsr #2
-       cmp     dividend, divisor, lsr #3
-       subcs   dividend, dividend, divisor, lsr #3
-       orrcs   result, result, curbit, lsr #3
-       cmp     dividend, #0                    @ Early termination?
-       movnes  curbit, curbit, lsr #4          @ No, any more bits to do?
-       movne   divisor, divisor, lsr #4
-       bne     3b
-Lgot_result_divsi3:
-       mov     r0, result
-       cmp     ip, #0
-       rsbmi   r0, r0, #0
-       RET     pc, lr
-
-ENTRY(__modsi3)
-       mov     curbit, #1
-       cmp     divisor, #0
-       rsbmi   divisor, divisor, #0            @ Loops below use unsigned.
-       beq     Ldiv0
-       @ Need to save the sign of the dividend, unfortunately, we need
-       @ ip later on; this is faster than pushing lr and using that.
-       str     dividend, [sp, #-4]!
-       cmp     dividend, #0
-       rsbmi   dividend, dividend, #0
-       cmp     dividend, divisor
-       bcc     Lgot_result_modsi3
-
-1:
-       @ Unless the divisor is very big, shift it up in multiples of
-       @ four bits, since this is the amount of unwinding in the main
-       @ division loop.  Continue shifting until the divisor is 
-       @ larger than the dividend.
-       cmp     divisor, #0x10000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #4
-       movcc   curbit, curbit, lsl #4
-       bcc     1b
-
-2:
-       @ For very big divisors, we must shift it a bit at a time, or
-       @ we will be in danger of overflowing.
-       cmp     divisor, #0x80000000
-       cmpcc   divisor, dividend
-       movcc   divisor, divisor, lsl #1
-       movcc   curbit, curbit, lsl #1
-       bcc     2b
-
-3:
-       @ Test for possible subtractions.  On the final pass, this may 
-       @ subtract too much from the dividend, so keep track of which
-       @ subtractions are done, we can fix them up afterwards...
-       mov     overdone, #0
-       cmp     dividend, divisor
-       subcs   dividend, dividend, divisor
-       cmp     dividend, divisor, lsr #1
-       subcs   dividend, dividend, divisor, lsr #1
-       orrcs   overdone, overdone, curbit, ror #1
-       cmp     dividend, divisor, lsr #2
-       subcs   dividend, dividend, divisor, lsr #2
-       orrcs   overdone, overdone, curbit, ror #2
-       cmp     dividend, divisor, lsr #3
-       subcs   dividend, dividend, divisor, lsr #3
-       orrcs   overdone, overdone, curbit, ror #3
-       mov     ip, curbit
-       cmp     dividend, #0                    @ Early termination?
-       movnes  curbit, curbit, lsr #4          @ No, any more bits to do?
-       movne   divisor, divisor, lsr #4
-       bne     3b
-
-       @ Any subtractions that we should not have done will be recorded in
-       @ the top three bits of "overdone".  Exactly which were not needed
-       @ are governed by the position of the bit, stored in ip.
-       @ If we terminated early, because dividend became zero,
-       @ then none of the below will match, since the bit in ip will not be
-       @ in the bottom nibble.
-       ands    overdone, overdone, #0xe0000000
-       beq     Lgot_result_modsi3
-       tst     overdone, ip, ror #3
-       addne   dividend, dividend, divisor, lsr #3
-       tst     overdone, ip, ror #2
-       addne   dividend, dividend, divisor, lsr #2
-       tst     overdone, ip, ror #1
-       addne   dividend, dividend, divisor, lsr #1
-Lgot_result_modsi3:
-       ldr     ip, [sp], #4
-       cmp     ip, #0
-       rsbmi   dividend, dividend, #0
-       RET     pc, lr
diff --git a/arch/arm26/lib/longlong.h b/arch/arm26/lib/longlong.h
deleted file mode 100644 (file)
index 05ec1ab..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/* longlong.h -- based on code from gcc-2.95.3
-
-   definitions for mixed size 32/64 bit arithmetic.
-   Copyright (C) 1991, 92, 94, 95, 96, 1997, 1998 Free Software Foundation, Inc.
-
-   This definition file is free software; you can redistribute it
-   and/or modify it under the terms of the GNU General Public
-   License as published by the Free Software Foundation; either
-   version 2, or (at your option) any later version.
-
-   This definition file is distributed in the hope that it will be
-   useful, but WITHOUT ANY WARRANTY; without even the implied
-   warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
-   See the GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 59 Temple Place - Suite 330,
-   Boston, MA 02111-1307, USA.  */
-
-/* Borrowed from GCC 2.95.3, I Molton 29/07/01 */
-
-#ifndef SI_TYPE_SIZE
-#define SI_TYPE_SIZE 32
-#endif
-
-#define __BITS4 (SI_TYPE_SIZE / 4)
-#define __ll_B (1L << (SI_TYPE_SIZE / 2))
-#define __ll_lowpart(t) ((USItype) (t) % __ll_B)
-#define __ll_highpart(t) ((USItype) (t) / __ll_B)
-
-/* Define auxiliary asm macros.
-
-   1) umul_ppmm(high_prod, low_prod, multipler, multiplicand)
-   multiplies two USItype integers MULTIPLER and MULTIPLICAND,
-   and generates a two-part USItype product in HIGH_PROD and
-   LOW_PROD.
-
-   2) __umulsidi3(a,b) multiplies two USItype integers A and B,
-   and returns a UDItype product.  This is just a variant of umul_ppmm.
-
-   3) udiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
-   denominator) divides a two-word unsigned integer, composed by the
-   integers HIGH_NUMERATOR and LOW_NUMERATOR, by DENOMINATOR and
-   places the quotient in QUOTIENT and the remainder in REMAINDER.
-   HIGH_NUMERATOR must be less than DENOMINATOR for correct operation.
-   If, in addition, the most significant bit of DENOMINATOR must be 1,
-   then the pre-processor symbol UDIV_NEEDS_NORMALIZATION is defined to 1.
-
-   4) sdiv_qrnnd(quotient, remainder, high_numerator, low_numerator,
-   denominator).  Like udiv_qrnnd but the numbers are signed.  The
-   quotient is rounded towards 0.
-
-   5) count_leading_zeros(count, x) counts the number of zero-bits from
-   the msb to the first non-zero bit.  This is the number of steps X
-   needs to be shifted left to set the msb.  Undefined for X == 0.
-
-   6) add_ssaaaa(high_sum, low_sum, high_addend_1, low_addend_1,
-   high_addend_2, low_addend_2) adds two two-word unsigned integers,
-   composed by HIGH_ADDEND_1 and LOW_ADDEND_1, and HIGH_ADDEND_2 and
-   LOW_ADDEND_2 respectively.  The result is placed in HIGH_SUM and
-   LOW_SUM.  Overflow (i.e. carry out) is not stored anywhere, and is
-   lost.
-
-   7) sub_ddmmss(high_difference, low_difference, high_minuend,
-   low_minuend, high_subtrahend, low_subtrahend) subtracts two
-   two-word unsigned integers, composed by HIGH_MINUEND_1 and
-   LOW_MINUEND_1, and HIGH_SUBTRAHEND_2 and LOW_SUBTRAHEND_2
-   respectively.  The result is placed in HIGH_DIFFERENCE and
-   LOW_DIFFERENCE.  Overflow (i.e. carry out) is not stored anywhere,
-   and is lost.
-
-   If any of these macros are left undefined for a particular CPU,
-   C macros are used.  */
-
-#if defined (__arm__)
-#define add_ssaaaa(sh, sl, ah, al, bh, bl) \
-  __asm__ ("adds       %1, %4, %5                                      \n\
-       adc     %0, %2, %3"                                             \
-          : "=r" ((USItype) (sh)),                                     \
-            "=&r" ((USItype) (sl))                                     \
-          : "%r" ((USItype) (ah)),                                     \
-            "rI" ((USItype) (bh)),                                     \
-            "%r" ((USItype) (al)),                                     \
-            "rI" ((USItype) (bl)))
-#define sub_ddmmss(sh, sl, ah, al, bh, bl) \
-  __asm__ ("subs       %1, %4, %5                                      \n\
-       sbc     %0, %2, %3"                                             \
-          : "=r" ((USItype) (sh)),                                     \
-            "=&r" ((USItype) (sl))                                     \
-          : "r" ((USItype) (ah)),                                      \
-            "rI" ((USItype) (bh)),                                     \
-            "r" ((USItype) (al)),                                      \
-            "rI" ((USItype) (bl)))
-#define umul_ppmm(xh, xl, a, b) \
-{register USItype __t0, __t1, __t2;                                    \
-  __asm__ ("%@ Inlined umul_ppmm                                       \n\
-       mov     %2, %5, lsr #16                                         \n\
-       mov     %0, %6, lsr #16                                         \n\
-       bic     %3, %5, %2, lsl #16                                     \n\
-       bic     %4, %6, %0, lsl #16                                     \n\
-       mul     %1, %3, %4                                              \n\
-       mul     %4, %2, %4                                              \n\
-       mul     %3, %0, %3                                              \n\
-       mul     %0, %2, %0                                              \n\
-       adds    %3, %4, %3                                              \n\
-       addcs   %0, %0, #65536                                          \n\
-       adds    %1, %1, %3, lsl #16                                     \n\
-       adc     %0, %0, %3, lsr #16"                                    \
-          : "=&r" ((USItype) (xh)),                                    \
-            "=r" ((USItype) (xl)),                                     \
-            "=&r" (__t0), "=&r" (__t1), "=r" (__t2)                    \
-          : "r" ((USItype) (a)),                                       \
-            "r" ((USItype) (b)));}
-#define UMUL_TIME 20
-#define UDIV_TIME 100
-#endif /* __arm__ */
-
-#define __umulsidi3(u, v) \
-  ({DIunion __w;                                                       \
-    umul_ppmm (__w.s.high, __w.s.low, u, v);                           \
-    __w.ll; })
-
-#define __udiv_qrnnd_c(q, r, n1, n0, d) \
-  do {                                                                 \
-    USItype __d1, __d0, __q1, __q0;                                    \
-    USItype __r1, __r0, __m;                                           \
-    __d1 = __ll_highpart (d);                                          \
-    __d0 = __ll_lowpart (d);                                           \
-                                                                       \
-    __r1 = (n1) % __d1;                                                        \
-    __q1 = (n1) / __d1;                                                        \
-    __m = (USItype) __q1 * __d0;                                       \
-    __r1 = __r1 * __ll_B | __ll_highpart (n0);                         \
-    if (__r1 < __m)                                                    \
-      {                                                                        \
-       __q1--, __r1 += (d);                                            \
-       if (__r1 >= (d)) /* i.e. we didn't get carry when adding to __r1 */\
-         if (__r1 < __m)                                               \
-           __q1--, __r1 += (d);                                        \
-      }                                                                        \
-    __r1 -= __m;                                                       \
-                                                                       \
-    __r0 = __r1 % __d1;                                                        \
-    __q0 = __r1 / __d1;                                                        \
-    __m = (USItype) __q0 * __d0;                                       \
-    __r0 = __r0 * __ll_B | __ll_lowpart (n0);                          \
-    if (__r0 < __m)                                                    \
-      {                                                                        \
-       __q0--, __r0 += (d);                                            \
-       if (__r0 >= (d))                                                \
-         if (__r0 < __m)                                               \
-           __q0--, __r0 += (d);                                        \
-      }                                                                        \
-    __r0 -= __m;                                                       \
-                                                                       \
-    (q) = (USItype) __q1 * __ll_B | __q0;                              \
-    (r) = __r0;                                                                \
-  } while (0)
-
-#define UDIV_NEEDS_NORMALIZATION 1
-#define udiv_qrnnd __udiv_qrnnd_c
-
-extern const UQItype __clz_tab[];
-#define count_leading_zeros(count, x) \
-  do {                                                                 \
-    USItype __xr = (x);                                                        \
-    USItype __a;                                                       \
-                                                                       \
-    if (SI_TYPE_SIZE <= 32)                                            \
-      {                                                                        \
-       __a = __xr < ((USItype)1<<2*__BITS4)                            \
-         ? (__xr < ((USItype)1<<__BITS4) ? 0 : __BITS4)                \
-         : (__xr < ((USItype)1<<3*__BITS4) ?  2*__BITS4 : 3*__BITS4);  \
-      }                                                                        \
-    else                                                               \
-      {                                                                        \
-       for (__a = SI_TYPE_SIZE - 8; __a > 0; __a -= 8)                 \
-         if (((__xr >> __a) & 0xff) != 0)                              \
-           break;                                                      \
-      }                                                                        \
-                                                                       \
-    (count) = SI_TYPE_SIZE - (__clz_tab[__xr >> __a] + __a);           \
-  } while (0)
diff --git a/arch/arm26/lib/lshrdi3.c b/arch/arm26/lib/lshrdi3.c
deleted file mode 100644 (file)
index b666f1b..0000000
+++ /dev/null
@@ -1,61 +0,0 @@
-/* More subroutines needed by GCC output code on some machines.  */
-/* Compile this one with gcc.  */
-/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.
- */
-/* support functions required by the kernel. based on code from gcc-2.95.3 */
-/* I Molton     29/07/01 */
-
-#include "gcclib.h"
-
-DItype
-__lshrdi3 (DItype u, word_type b)
-{
-  DIunion w;
-  word_type bm;
-  DIunion uu;
-
-  if (b == 0)
-    return u;
-
-  uu.ll = u;
-
-  bm = (sizeof (SItype) * BITS_PER_UNIT) - b;
-  if (bm <= 0)
-    {
-      w.s.high = 0;
-      w.s.low = (USItype)uu.s.high >> -bm;
-    }
-  else
-    {
-      USItype carries = (USItype)uu.s.high << bm;
-      w.s.high = (USItype)uu.s.high >> b;
-      w.s.low = ((USItype)uu.s.low >> b) | carries;
-    }
-
-  return w.ll;
-}
-
diff --git a/arch/arm26/lib/memchr.S b/arch/arm26/lib/memchr.S
deleted file mode 100644 (file)
index 34e7c14..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  linux/arch/arm26/lib/memchr.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  ASM optimised string functions
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-       .text
-       .align  5
-ENTRY(memchr)
-1:     subs    r2, r2, #1
-       bmi     2f
-       ldrb    r3, [r0], #1
-       teq     r3, r1
-       bne     1b
-       sub     r0, r0, #1
-2:     movne   r0, #0
-       RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/memcpy.S b/arch/arm26/lib/memcpy.S
deleted file mode 100644 (file)
index 3f719e4..0000000
+++ /dev/null
@@ -1,318 +0,0 @@
-/*
- *  linux/arch/arm26/lib/memcpy.S
- *
- *  Copyright (C) 1995-1999 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  ASM optimised string functions
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-               .text
-
-#define ENTER  \
-               mov     ip,sp   ;\
-               stmfd   sp!,{r4-r9,fp,ip,lr,pc} ;\
-               sub     fp,ip,#4
-
-#define EXIT   \
-               LOADREGS(ea, fp, {r4 - r9, fp, sp, pc})
-
-#define EXITEQ \
-               LOADREGS(eqea, fp, {r4 - r9, fp, sp, pc})
-
-/*
- * Prototype: void memcpy(void *to,const void *from,unsigned long n);
- * ARM3: cant use memcopy here!!!
- */
-ENTRY(memcpy)
-ENTRY(memmove)
-               ENTER
-               cmp     r1, r0
-               bcc     19f
-               subs    r2, r2, #4
-               blt     6f
-               ands    ip, r0, #3
-               bne     7f
-               ands    ip, r1, #3
-               bne     8f
-
-1:             subs    r2, r2, #8
-               blt     5f
-               subs    r2, r2, #0x14
-               blt     3f
-2:             ldmia   r1!,{r3 - r9, ip}
-               stmia   r0!,{r3 - r9, ip}
-               subs    r2, r2, #32
-               bge     2b
-               cmn     r2, #16
-               ldmgeia r1!, {r3 - r6}
-               stmgeia r0!, {r3 - r6}
-               subge   r2, r2, #0x10
-3:             adds    r2, r2, #0x14
-4:             ldmgeia r1!, {r3 - r5}
-               stmgeia r0!, {r3 - r5}
-               subges  r2, r2, #12
-               bge     4b
-5:             adds    r2, r2, #8
-               blt     6f
-               subs    r2, r2, #4
-               ldrlt   r3, [r1], #4
-               ldmgeia r1!, {r4, r5}
-               strlt   r3, [r0], #4
-               stmgeia r0!, {r4, r5}
-               subge   r2, r2, #4
-
-6:             adds    r2, r2, #4
-               EXITEQ
-               cmp     r2, #2
-               ldrb    r3, [r1], #1
-               ldrgeb  r4, [r1], #1
-               ldrgtb  r5, [r1], #1
-               strb    r3, [r0], #1
-               strgeb  r4, [r0], #1
-               strgtb  r5, [r0], #1
-               EXIT
-
-7:             rsb     ip, ip, #4
-               cmp     ip, #2
-               ldrb    r3, [r1], #1
-               ldrgeb  r4, [r1], #1
-               ldrgtb  r5, [r1], #1
-               strb    r3, [r0], #1
-               strgeb  r4, [r0], #1
-               strgtb  r5, [r0], #1
-               subs    r2, r2, ip
-               blt     6b
-               ands    ip, r1, #3
-               beq     1b
-
-8:             bic     r1, r1, #3
-               ldr     r7, [r1], #4
-               cmp     ip, #2
-               bgt     15f
-               beq     11f
-               cmp     r2, #12
-               blt     10f
-               sub     r2, r2, #12
-9:             mov     r3, r7, pull #8
-               ldmia   r1!, {r4 - r7}
-               orr     r3, r3, r4, push #24
-               mov     r4, r4, pull #8
-               orr     r4, r4, r5, push #24
-               mov     r5, r5, pull #8
-               orr     r5, r5, r6, push #24
-               mov     r6, r6, pull #8
-               orr     r6, r6, r7, push #24
-               stmia   r0!, {r3 - r6}
-               subs    r2, r2, #16
-               bge     9b
-               adds    r2, r2, #12
-               blt     100f
-10:            mov     r3, r7, pull #8
-               ldr     r7, [r1], #4
-               subs    r2, r2, #4
-               orr     r3, r3, r7, push #24
-               str     r3, [r0], #4
-               bge     10b
-100:           sub     r1, r1, #3
-               b       6b
-
-11:            cmp     r2, #12
-               blt     13f             /* */
-               sub     r2, r2, #12
-12:            mov     r3, r7, pull #16
-               ldmia   r1!, {r4 - r7}
-               orr     r3, r3, r4, push #16
-               mov     r4, r4, pull #16
-               orr     r4, r4, r5, push #16
-               mov     r5, r5, pull #16
-               orr     r5, r5, r6, push #16
-               mov     r6, r6, pull #16
-               orr     r6, r6, r7, push #16
-               stmia   r0!, {r3 - r6}
-               subs    r2, r2, #16
-               bge     12b
-               adds    r2, r2, #12
-               blt     14f
-13:            mov     r3, r7, pull #16
-               ldr     r7, [r1], #4
-               subs    r2, r2, #4
-               orr     r3, r3, r7, push #16
-               str     r3, [r0], #4
-               bge     13b
-14:            sub     r1, r1, #2
-               b       6b
-
-15:            cmp     r2, #12
-               blt     17f
-               sub     r2, r2, #12
-16:            mov     r3, r7, pull #24
-               ldmia   r1!, {r4 - r7}
-               orr     r3, r3, r4, push #8
-               mov     r4, r4, pull #24
-               orr     r4, r4, r5, push #8
-               mov     r5, r5, pull #24
-               orr     r5, r5, r6, push #8
-               mov     r6, r6, pull #24
-               orr     r6, r6, r7, push #8
-               stmia   r0!, {r3 - r6}
-               subs    r2, r2, #16
-               bge     16b
-               adds    r2, r2, #12
-               blt     18f
-17:            mov     r3, r7, pull #24
-               ldr     r7, [r1], #4
-               subs    r2, r2, #4
-               orr     r3, r3, r7, push #8
-               str     r3, [r0], #4
-               bge     17b
-18:            sub     r1, r1, #1
-               b       6b
-
-
-19:            add     r1, r1, r2
-               add     r0, r0, r2
-               subs    r2, r2, #4
-               blt     24f
-               ands    ip, r0, #3
-               bne     25f
-               ands    ip, r1, #3
-               bne     26f
-
-20:            subs    r2, r2, #8
-               blt     23f
-               subs    r2, r2, #0x14
-               blt     22f
-21:            ldmdb   r1!, {r3 - r9, ip}
-               stmdb   r0!, {r3 - r9, ip}
-               subs    r2, r2, #32
-               bge     21b
-22:            cmn     r2, #16
-               ldmgedb r1!, {r3 - r6}
-               stmgedb r0!, {r3 - r6}
-               subge   r2, r2, #16
-               adds    r2, r2, #20
-               ldmgedb r1!, {r3 - r5}
-               stmgedb r0!, {r3 - r5}
-               subge   r2, r2, #12
-23:            adds    r2, r2, #8
-               blt     24f
-               subs    r2, r2, #4
-               ldrlt   r3, [r1, #-4]!
-               ldmgedb r1!, {r4, r5}
-               strlt   r3, [r0, #-4]!
-               stmgedb r0!, {r4, r5}
-               subge   r2, r2, #4
-
-24:            adds    r2, r2, #4
-               EXITEQ
-               cmp     r2, #2
-               ldrb    r3, [r1, #-1]!
-               ldrgeb  r4, [r1, #-1]!
-               ldrgtb  r5, [r1, #-1]!
-               strb    r3, [r0, #-1]!
-               strgeb  r4, [r0, #-1]!
-               strgtb  r5, [r0, #-1]!
-               EXIT
-
-25:            cmp     ip, #2
-               ldrb    r3, [r1, #-1]!
-               ldrgeb  r4, [r1, #-1]!
-               ldrgtb  r5, [r1, #-1]!
-               strb    r3, [r0, #-1]!
-               strgeb  r4, [r0, #-1]!
-               strgtb  r5, [r0, #-1]!
-               subs    r2, r2, ip
-               blt     24b
-               ands    ip, r1, #3
-               beq     20b
-
-26:            bic     r1, r1, #3
-               ldr     r3, [r1], #0
-               cmp     ip, #2
-               blt     34f
-               beq     30f
-               cmp     r2, #12
-               blt     28f
-               sub     r2, r2, #12
-27:            mov     r7, r3, push #8
-               ldmdb   r1!, {r3, r4, r5, r6}
-               orr     r7, r7, r6, pull #24
-               mov     r6, r6, push #8
-               orr     r6, r6, r5, pull #24
-               mov     r5, r5, push #8
-               orr     r5, r5, r4, pull #24
-               mov     r4, r4, push #8
-               orr     r4, r4, r3, pull #24
-               stmdb   r0!, {r4, r5, r6, r7}
-               subs    r2, r2, #16
-               bge     27b
-               adds    r2, r2, #12
-               blt     29f
-28:            mov     ip, r3, push #8
-               ldr     r3, [r1, #-4]!
-               subs    r2, r2, #4
-               orr     ip, ip, r3, pull #24
-               str     ip, [r0, #-4]!
-               bge     28b
-29:            add     r1, r1, #3
-               b       24b
-
-30:            cmp     r2, #12
-               blt     32f
-               sub     r2, r2, #12
-31:            mov     r7, r3, push #16
-               ldmdb   r1!, {r3, r4, r5, r6}
-               orr     r7, r7, r6, pull #16
-               mov     r6, r6, push #16
-               orr     r6, r6, r5, pull #16
-               mov     r5, r5, push #16
-               orr     r5, r5, r4, pull #16
-               mov     r4, r4, push #16
-               orr     r4, r4, r3, pull #16
-               stmdb   r0!, {r4, r5, r6, r7}
-               subs    r2, r2, #16
-               bge     31b
-               adds    r2, r2, #12
-               blt     33f
-32:            mov     ip, r3, push #16
-               ldr     r3, [r1, #-4]!
-               subs    r2, r2, #4
-               orr     ip, ip, r3, pull #16
-               str     ip, [r0, #-4]!
-               bge     32b
-33:            add     r1, r1, #2
-               b       24b
-
-34:            cmp     r2, #12
-               blt     36f
-               sub     r2, r2, #12
-35:            mov     r7, r3, push #24
-               ldmdb   r1!, {r3, r4, r5, r6}
-               orr     r7, r7, r6, pull #8
-               mov     r6, r6, push #24
-               orr     r6, r6, r5, pull #8
-               mov     r5, r5, push #24
-               orr     r5, r5, r4, pull #8
-               mov     r4, r4, push #24
-               orr     r4, r4, r3, pull #8
-               stmdb   r0!, {r4, r5, r6, r7}
-               subs    r2, r2, #16
-               bge     35b
-               adds    r2, r2, #12
-               blt     37f
-36:            mov     ip, r3, push #24
-               ldr     r3, [r1, #-4]!
-               subs    r2, r2, #4
-               orr     ip, ip, r3, pull #8
-               str     ip, [r0, #-4]!
-               bge     36b
-37:            add     r1, r1, #1
-               b       24b
-
-               .align
diff --git a/arch/arm26/lib/memset.S b/arch/arm26/lib/memset.S
deleted file mode 100644 (file)
index aedec10..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  linux/arch/arm26/lib/memset.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  ASM optimised string functions
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-       .text
-       .align  5
-       .word   0
-
-1:     subs    r2, r2, #4              @ 1 do we have enough
-       blt     5f                      @ 1 bytes to align with?
-       cmp     r3, #2                  @ 1
-       strltb  r1, [r0], #1            @ 1
-       strleb  r1, [r0], #1            @ 1
-       strb    r1, [r0], #1            @ 1
-       add     r2, r2, r3              @ 1 (r2 = r2 - (4 - r3))
-/*
- * The pointer is now aligned and the length is adjusted.  Try doing the
- * memzero again.
- */
-
-ENTRY(memset)
-       ands    r3, r0, #3              @ 1 unaligned?
-       bne     1b                      @ 1
-/*
- * we know that the pointer in r0 is aligned to a word boundary.
- */
-       orr     r1, r1, r1, lsl #8
-       orr     r1, r1, r1, lsl #16
-       mov     r3, r1
-       cmp     r2, #16
-       blt     4f
-/*
- * We need an extra register for this loop - save the return address and
- * use the LR
- */
-       str     lr, [sp, #-4]!
-       mov     ip, r1
-       mov     lr, r1
-
-2:     subs    r2, r2, #64
-       stmgeia r0!, {r1, r3, ip, lr}   @ 64 bytes at a time.
-       stmgeia r0!, {r1, r3, ip, lr}
-       stmgeia r0!, {r1, r3, ip, lr}
-       stmgeia r0!, {r1, r3, ip, lr}
-       bgt     2b
-       LOADREGS(eqfd, sp!, {pc})       @ Now <64 bytes to go.
-/*
- * No need to correct the count; we're only testing bits from now on
- */
-       tst     r2, #32
-       stmneia r0!, {r1, r3, ip, lr}
-       stmneia r0!, {r1, r3, ip, lr}
-       tst     r2, #16
-       stmneia r0!, {r1, r3, ip, lr}
-       ldr     lr, [sp], #4
-
-4:     tst     r2, #8
-       stmneia r0!, {r1, r3}
-       tst     r2, #4
-       strne   r1, [r0], #4
-/*
- * When we get here, we've got less than 4 bytes to zero.  We
- * may have an unaligned pointer as well.
- */
-5:     tst     r2, #2
-       strneb  r1, [r0], #1
-       strneb  r1, [r0], #1
-       tst     r2, #1
-       strneb  r1, [r0], #1
-       RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/memzero.S b/arch/arm26/lib/memzero.S
deleted file mode 100644 (file)
index cc5bf68..0000000
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *  linux/arch/arm26/lib/memzero.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-       .text
-       .align  5
-       .word   0
-/*
- * Align the pointer in r0.  r3 contains the number of bytes that we are
- * mis-aligned by, and r1 is the number of bytes.  If r1 < 4, then we
- * don't bother; we use byte stores instead.
- */
-1:     subs    r1, r1, #4              @ 1 do we have enough
-       blt     5f                      @ 1 bytes to align with?
-       cmp     r3, #2                  @ 1
-       strltb  r2, [r0], #1            @ 1
-       strleb  r2, [r0], #1            @ 1
-       strb    r2, [r0], #1            @ 1
-       add     r1, r1, r3              @ 1 (r1 = r1 - (4 - r3))
-/*
- * The pointer is now aligned and the length is adjusted.  Try doing the
- * memzero again.
- */
-
-ENTRY(__memzero)
-       mov     r2, #0                  @ 1
-       ands    r3, r0, #3              @ 1 unaligned?
-       bne     1b                      @ 1
-/*
- * r3 = 0, and we know that the pointer in r0 is aligned to a word boundary.
- */
-       cmp     r1, #16                 @ 1 we can skip this chunk if we
-       blt     4f                      @ 1 have < 16 bytes
-/*
- * We need an extra register for this loop - save the return address and
- * use the LR
- */
-       str     lr, [sp, #-4]!          @ 1
-       mov     ip, r2                  @ 1
-       mov     lr, r2                  @ 1
-
-3:     subs    r1, r1, #64             @ 1 write 32 bytes out per loop
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       stmgeia r0!, {r2, r3, ip, lr}   @ 4
-       bgt     3b                      @ 1
-       LOADREGS(eqfd, sp!, {pc})       @ 1/2 quick exit
-/*
- * No need to correct the count; we're only testing bits from now on
- */
-       tst     r1, #32                 @ 1
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       tst     r1, #16                 @ 1 16 bytes or more?
-       stmneia r0!, {r2, r3, ip, lr}   @ 4
-       ldr     lr, [sp], #4            @ 1
-
-4:     tst     r1, #8                  @ 1 8 bytes or more?
-       stmneia r0!, {r2, r3}           @ 2
-       tst     r1, #4                  @ 1 4 bytes or more?
-       strne   r2, [r0], #4            @ 1
-/*
- * When we get here, we've got less than 4 bytes to zero.  We
- * may have an unaligned pointer as well.
- */
-5:     tst     r1, #2                  @ 1 2 bytes or more?
-       strneb  r2, [r0], #1            @ 1
-       strneb  r2, [r0], #1            @ 1
-       tst     r1, #1                  @ 1 a byte left over
-       strneb  r2, [r0], #1            @ 1
-       RETINSTR(mov,pc,lr)             @ 1
diff --git a/arch/arm26/lib/muldi3.c b/arch/arm26/lib/muldi3.c
deleted file mode 100644 (file)
index 44d611b..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-/* More subroutines needed by GCC output code on some machines.  */
-/* Compile this one with gcc.  */
-/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.
- */
-/* support functions required by the kernel. based on code from gcc-2.95.3 */
-/* I Molton     29/07/01 */
-
-#include "gcclib.h"
-
-#define umul_ppmm(xh, xl, a, b) \
-{register USItype __t0, __t1, __t2;                                     \
-  __asm__ ("%@ Inlined umul_ppmm                                       \n\
-        mov     %2, %5, lsr #16                                                \n\
-        mov     %0, %6, lsr #16                                                \n\
-        bic     %3, %5, %2, lsl #16                                    \n\
-        bic     %4, %6, %0, lsl #16                                    \n\
-        mul     %1, %3, %4                                             \n\
-        mul     %4, %2, %4                                             \n\
-        mul     %3, %0, %3                                             \n\
-        mul     %0, %2, %0                                             \n\
-        adds    %3, %4, %3                                             \n\
-        addcs   %0, %0, #65536                                         \n\
-        adds    %1, %1, %3, lsl #16                                    \n\
-        adc     %0, %0, %3, lsr #16"                                    \
-           : "=&r" ((USItype) (xh)),                                    \
-             "=r" ((USItype) (xl)),                                     \
-             "=&r" (__t0), "=&r" (__t1), "=r" (__t2)                    \
-           : "r" ((USItype) (a)),                                       \
-             "r" ((USItype) (b)));}
-
-
-#define __umulsidi3(u, v) \
-  ({DIunion __w;                                                        \
-    umul_ppmm (__w.s.high, __w.s.low, u, v);                            \
-    __w.ll; })
-
-
-DItype
-__muldi3 (DItype u, DItype v)
-{
-  DIunion w;
-  DIunion uu, vv;
-
-  uu.ll = u,
-  vv.ll = v;
-
-  w.ll = __umulsidi3 (uu.s.low, vv.s.low);
-  w.s.high += ((USItype) uu.s.low * (USItype) vv.s.high
-               + (USItype) uu.s.high * (USItype) vv.s.low);
-
-  return w.ll;
-}
-
diff --git a/arch/arm26/lib/putuser.S b/arch/arm26/lib/putuser.S
deleted file mode 100644 (file)
index 46c7f15..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  linux/arch/arm26/lib/putuser.S
- *
- *  Copyright (C) 2001 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Idea from x86 version, (C) Copyright 1998 Linus Torvalds
- *
- * These functions have a non-standard call interface to make
- * them more efficient, especially as they return an error
- * value in addition to the "real" return value.
- *
- * __put_user_X
- *
- * Inputs:     r0 contains the address
- *             r1, r2 contains the value
- * Outputs:    r0 is the error code
- *             lr corrupted
- *
- * No other registers must be altered.  (see include/asm-arm/uaccess.h
- * for specific ASM register usage).
- *
- * Note that ADDR_LIMIT is either 0 or 0xc0000000
- * Note also that it is intended that __put_user_bad is not global.
- */
-#include <asm/asm-offsets.h>
-#include <asm/thread_info.h>
-#include <asm/errno.h>
-
-        .global __put_user_1
-__put_user_1:
-        bic     r2, sp, #0x1f00
-        bic     r2, r2, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     r2, [r2, #TI_ADDR_LIMIT]
-        sub     r2, r2, #1
-        cmp     r0, r2
-        bge     __put_user_bad
-1:      cmp     r0, #0x02000000
-        strlsbt r1, [r0]
-        strgeb  r1, [r0]
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-        .global __put_user_2
-__put_user_2:
-        bic     r2, sp, #0x1f00
-        bic     r2, r2, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     r2, [r2, #TI_ADDR_LIMIT]
-        sub     r2, r2, #2
-        cmp     r0, r2
-        bge     __put_user_bad
-2:      cmp     r0, #0x02000000
-        strlsbt r1, [r0], #1
-        strgeb  r1, [r0], #1
-        mov     r1, r1, lsr #8
-3:      strlsbt r1, [r0]
-        strgeb  r1, [r0]
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-        .global __put_user_4
-__put_user_4:
-        bic     r2, sp, #0x1f00
-        bic     r2, r2, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     r2, [r2, #TI_ADDR_LIMIT]
-        sub     r2, r2, #4
-        cmp     r0, r2
-4:      bge     __put_user_bad
-        cmp     r0, #0x02000000
-        strlst  r1, [r0]
-        strge   r1, [r0]
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-        .global __put_user_8
-__put_user_8:
-        bic     ip, sp, #0x1f00
-        bic     ip, ip, #0x00ff
-        str     lr, [sp, #-4]!
-        ldr     ip, [ip, #TI_ADDR_LIMIT]
-        sub     ip, ip, #8
-        cmp     r0, ip
-        bge     __put_user_bad
-        cmp     r0, #0x02000000
-5:      strlst  r1, [r0], #4
-6:      strlst  r2, [r0]
-        strge   r1, [r0], #4
-        strge   r2, [r0]
-        mov     r0, #0
-        ldmfd   sp!, {pc}^
-
-__put_user_bad:
-       mov     r0, #-EFAULT
-       mov     pc, lr
-
-.section __ex_table, "a"
-       .long   1b, __put_user_bad
-       .long   2b, __put_user_bad
-       .long   3b, __put_user_bad
-       .long   4b, __put_user_bad
-       .long   5b, __put_user_bad
-       .long   6b, __put_user_bad
-.previous
diff --git a/arch/arm26/lib/setbit.S b/arch/arm26/lib/setbit.S
deleted file mode 100644 (file)
index e180c1a..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  linux/arch/arm26/lib/setbit.S
- *
- *  Copyright (C) 1995-1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-               .text
-
-/*
- * Purpose  : Function to set a bit
- * Prototype: int set_bit(int bit, void *addr)
- */
-ENTRY(_set_bit_be)
-               eor     r0, r0, #0x18           @ big endian byte ordering
-ENTRY(_set_bit_le)
-               and     r2, r0, #7
-               mov     r3, #1
-               mov     r3, r3, lsl r2
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1, r0, lsr #3]
-               orr     r2, r2, r3
-               strb    r2, [r1, r0, lsr #3]
-               restore_irqs ip
-               RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/strchr.S b/arch/arm26/lib/strchr.S
deleted file mode 100644 (file)
index ecfff21..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  linux/arch/arm26/lib/strchr.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  ASM optimised string functions
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-               .text
-               .align  5
-ENTRY(strchr)
-1:             ldrb    r2, [r0], #1
-               teq     r2, r1
-               teqne   r2, #0
-               bne     1b
-               teq     r2, #0
-               moveq   r0, #0
-               subne   r0, r0, #1
-               RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/strrchr.S b/arch/arm26/lib/strrchr.S
deleted file mode 100644 (file)
index db43b28..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/*
- *  linux/arch/arm26/lib/strrchr.S
- *
- *  Copyright (C) 1995-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  ASM optimised string functions
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-               .text
-               .align  5
-ENTRY(strrchr)
-               mov     r3, #0
-1:             ldrb    r2, [r0], #1
-               teq     r2, r1
-               subeq   r3, r0, #1
-               teq     r2, #0
-               bne     1b
-               mov     r0, r3
-               RETINSTR(mov,pc,lr)
diff --git a/arch/arm26/lib/testchangebit.S b/arch/arm26/lib/testchangebit.S
deleted file mode 100644 (file)
index 17049a2..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  linux/arch/arm26/lib/testchangebit.S
- *
- *  Copyright (C) 1995-1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-                .text
-
-ENTRY(_test_and_change_bit_be)
-               eor     r0, r0, #0x18           @ big endian byte ordering
-ENTRY(_test_and_change_bit_le)
-               add     r1, r1, r0, lsr #3
-               and     r3, r0, #7
-               mov     r0, #1
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1]
-               tst     r2, r0, lsl r3
-               eor     r2, r2, r0, lsl r3
-               strb    r2, [r1]
-               restore_irqs ip
-               moveq   r0, #0
-               RETINSTR(mov,pc,lr)
-
-
diff --git a/arch/arm26/lib/testclearbit.S b/arch/arm26/lib/testclearbit.S
deleted file mode 100644 (file)
index 2506bd7..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  linux/arch/arm26/lib/testclearbit.S
- *
- *  Copyright (C) 1995-1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-                .text
-
-ENTRY(_test_and_clear_bit_be)
-               eor     r0, r0, #0x18           @ big endian byte ordering
-ENTRY(_test_and_clear_bit_le)
-               add     r1, r1, r0, lsr #3      @ Get byte offset
-               and     r3, r0, #7              @ Get bit offset
-               mov     r0, #1
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1]
-               tst     r2, r0, lsl r3
-               bic     r2, r2, r0, lsl r3
-               strb    r2, [r1]
-               restore_irqs ip
-               moveq   r0, #0
-               RETINSTR(mov,pc,lr)
-
-
diff --git a/arch/arm26/lib/testsetbit.S b/arch/arm26/lib/testsetbit.S
deleted file mode 100644 (file)
index f827de6..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  linux/arch/arm26/lib/testsetbit.S
- *
- *  Copyright (C) 1995-1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-                .text
-
-ENTRY(_test_and_set_bit_be)
-               eor     r0, r0, #0x18           @ big endian byte ordering
-ENTRY(_test_and_set_bit_le)
-               add     r1, r1, r0, lsr #3      @ Get byte offset
-               and     r3, r0, #7              @ Get bit offset
-               mov     r0, #1
-               save_and_disable_irqs ip, r2
-               ldrb    r2, [r1]
-               tst     r2, r0, lsl r3
-               orr     r2, r2, r0, lsl r3
-               strb    r2, [r1]
-               restore_irqs ip
-               moveq   r0, #0
-               RETINSTR(mov,pc,lr)
-
-
diff --git a/arch/arm26/lib/uaccess-kernel.S b/arch/arm26/lib/uaccess-kernel.S
deleted file mode 100644 (file)
index 3950a1f..0000000
+++ /dev/null
@@ -1,173 +0,0 @@
-/*
- *  linux/arch/arm26/lib/uaccess-kernel.S
- *
- *  Copyright (C) 1998 Russell King
- *
- *  Note!  Some code fragments found in here have a special calling
- *  convention - they are not APCS compliant!
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-
-               .text
-
-//FIXME - surely this can be done in C not asm, removing the problem of keeping C and asm in sync? (this is a struct uaccess_t)
-
-               .globl  uaccess_kernel
-uaccess_kernel:
-               .word   uaccess_kernel_put_byte
-               .word   uaccess_kernel_get_byte
-               .word   uaccess_kernel_put_half
-               .word   uaccess_kernel_get_half
-               .word   uaccess_kernel_put_word
-               .word   uaccess_kernel_get_word
-               .word   uaccess_kernel_put_dword
-               .word   uaccess_kernel_copy
-               .word   uaccess_kernel_copy
-               .word   uaccess_kernel_clear
-               .word   uaccess_kernel_strncpy
-               .word   uaccess_kernel_strnlen
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_kernel_put_byte:
-               stmfd   sp!, {lr}
-               strb    r0, [r1]
-               ldmfd   sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_kernel_put_half:
-               stmfd   sp!, {lr}
-               strb    r0, [r1]
-               mov     r0, r0, lsr #8
-               strb    r0, [r1, #1]
-               ldmfd   sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_kernel_put_word:
-               stmfd   sp!, {lr}
-               str     r0, [r1]
-               ldmfd   sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_kernel_put_dword:
-                stmfd   sp!, {lr}
-                str     r0, [r1], #4
-               str     r0, [r1], #0
-                ldmfd   sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_kernel_get_byte:
-               stmfd   sp!, {lr}
-               ldrb    r0, [r0]
-               ldmfd   sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_kernel_get_half:
-               stmfd   sp!, {lr}
-               ldr     r0, [r0]
-               mov     r0, r0, lsl #16
-               mov     r0, r0, lsr #16
-               ldmfd   sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_kernel_get_word:
-               stmfd   sp!, {lr}
-               ldr     r0, [r0]
-               ldmfd   sp!, {pc}^
-
-
-/* Prototype: int uaccess_kernel_copy(void *to, const char *from, size_t n)
- * Purpose  : copy a block to kernel memory from kernel memory
- * Params   : to   - kernel memory
- *          : from - kernel memory
- *          : n    - number of bytes to copy
- * Returns  : Number of bytes NOT copied.
- */
-uaccess_kernel_copy:
-               stmfd   sp!, {lr}
-               bl      memcpy
-               mov     r0, #0
-               ldmfd   sp!, {pc}^
-
-/* Prototype: int uaccess_kernel_clear(void *addr, size_t sz)
- * Purpose  : clear some kernel memory
- * Params   : addr - kernel memory address to clear
- *          : sz   - number of bytes to clear
- * Returns  : number of bytes NOT cleared
- */
-uaccess_kernel_clear:
-               stmfd   sp!, {lr}
-               mov     r2, #0
-               cmp     r1, #4
-               blt     2f
-               ands    ip, r0, #3
-               beq     1f
-               cmp     ip, #1
-               strb    r2, [r0], #1
-               strleb  r2, [r0], #1
-               strltb  r2, [r0], #1
-               rsb     ip, ip, #4
-               sub     r1, r1, ip              @  7  6  5  4  3  2  1
-1:             subs    r1, r1, #8              @ -1 -2 -3 -4 -5 -6 -7
-               bmi     2f
-               str     r2, [r0], #4
-               str     r2, [r0], #4
-               b       1b
-2:             adds    r1, r1, #4              @  3  2  1  0 -1 -2 -3
-               strpl   r2, [r0], #4
-               tst     r1, #2                  @ 1x 1x 0x 0x 1x 1x 0x
-               strneb  r2, [r0], #1
-               strneb  r2, [r0], #1
-               tst     r1, #1                  @ x1 x0 x1 x0 x1 x0 x1
-               strneb  r2, [r0], #1
-               mov     r0, #0
-               ldmfd   sp!, {pc}^
-
-/* Prototype: size_t uaccess_kernel_strncpy(char *dst, char *src, size_t len)
- * Purpose  : copy a string from kernel memory to kernel memory
- * Params   : dst - kernel memory destination
- *          : src - kernel memory source
- *          : len - maximum length of string
- * Returns  : number of characters copied
- */
-uaccess_kernel_strncpy:
-               stmfd   sp!, {lr}
-               mov     ip, r2
-1:             subs    r2, r2, #1
-               bmi     2f
-               ldrb    r3, [r1], #1
-               strb    r3, [r0], #1
-               teq     r3, #0
-               bne     1b
-2:             subs    r0, ip, r2
-               ldmfd   sp!, {pc}^
-
-/* Prototype: int uaccess_kernel_strlen(char *str, long n)
- * Purpose  : get length of a string in kernel memory
- * Params   : str - address of string in kernel memory
- * Returns  : length of string *including terminator*,
- *            or zero on exception, or n + 1 if too long
- */
-uaccess_kernel_strnlen:
-               stmfd   sp!, {lr}
-               mov     r2, r0
-1:             ldrb    r1, [r0], #1
-               teq     r1, #0
-               beq     2f
-               subs    r1, r1, #1
-               bne     1b
-               add     r0, r0, #1
-2:             sub     r0, r0, r2
-               ldmfd   sp!, {pc}^
-
diff --git a/arch/arm26/lib/uaccess-user.S b/arch/arm26/lib/uaccess-user.S
deleted file mode 100644 (file)
index 130b8f2..0000000
+++ /dev/null
@@ -1,718 +0,0 @@
-/*
- *  linux/arch/arm26/lib/uaccess-user.S
- *
- *  Copyright (C) 1995, 1996,1997,1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Routines to block copy data to/from user memory
- *   These are highly optimised both for the 4k page size
- *   and for various alignments.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/errno.h>
-#include <asm/page.h>
-
-               .text
-
-//FIXME - surely this can be done in C not asm, removing the problem of keeping C and asm in sync? (this is a struct uaccess_t)
-                .globl  uaccess_user
-uaccess_user:
-                .word   uaccess_user_put_byte
-                .word   uaccess_user_get_byte
-                .word   uaccess_user_put_half
-                .word   uaccess_user_get_half
-                .word   uaccess_user_put_word
-                .word   uaccess_user_get_word
-               .word   uaccess_user_put_dword
-                .word   uaccess_user_copy_from_user
-                .word   uaccess_user_copy_to_user
-                .word   uaccess_user_clear_user
-                .word   uaccess_user_strncpy_from_user
-                .word   uaccess_user_strnlen_user
-
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_user_put_byte:
-                stmfd   sp!, {lr}
-USER(           strbt   r0, [r1])
-                ldmfd   sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_user_put_half:
-                stmfd   sp!, {lr}
-USER(           strbt   r0, [r1], #1)
-                mov     r0, r0, lsr #8
-USER(           strbt   r0, [r1])
-                ldmfd   sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_user_put_word:
-                stmfd   sp!, {lr}
-USER(           strt    r0, [r1])
-                ldmfd   sp!, {pc}^
-
-@ In : r0 = x, r1 = addr, r2 = error
-@ Out: r2 = error
-uaccess_user_put_dword:
-                stmfd   sp!, {lr}
-USER(           strt    r0, [r1], #4)
-USER(           strt    r0, [r1], #0)
-                ldmfd   sp!, {pc}^
-
-9001:           mov     r2, #-EFAULT
-                ldmfd   sp!, {pc}^
-
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_user_get_byte:
-                stmfd   sp!, {lr}
-USER(           ldrbt   r0, [r0])
-                ldmfd   sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_user_get_half:
-                stmfd   sp!, {lr}
-USER(           ldrt    r0, [r0])
-                mov     r0, r0, lsl #16
-                mov     r0, r0, lsr #16
-                ldmfd   sp!, {pc}^
-
-@ In : r0 = addr, r1 = error
-@ Out: r0 = x, r1 = error
-uaccess_user_get_word:
-                stmfd   sp!, {lr}
-USER(           ldrt    r0, [r0])
-                ldmfd   sp!, {pc}^
-
-9001:           mov     r1, #-EFAULT
-                ldmfd   sp!, {pc}^
-
-/* Prototype: int uaccess_user_copy_to_user(void *to, const char *from, size_t n)
- * Purpose  : copy a block to user memory from kernel memory
- * Params   : to   - user memory
- *          : from - kernel memory
- *          : n    - number of bytes to copy
- * Returns  : Number of bytes NOT copied.
- */
-
-.c2u_dest_not_aligned:
-               rsb     ip, ip, #4
-               cmp     ip, #2
-               ldrb    r3, [r1], #1
-USER(          strbt   r3, [r0], #1)                   @ May fault
-               ldrgeb  r3, [r1], #1
-USER(          strgebt r3, [r0], #1)                   @ May fault
-               ldrgtb  r3, [r1], #1
-USER(          strgtbt r3, [r0], #1)                   @ May fault
-               sub     r2, r2, ip
-               b       .c2u_dest_aligned
-
-ENTRY(uaccess_user_copy_to_user)
-               stmfd   sp!, {r2, r4 - r7, lr}
-               cmp     r2, #4
-               blt     .c2u_not_enough
-               ands    ip, r0, #3
-               bne     .c2u_dest_not_aligned
-.c2u_dest_aligned:
-
-               ands    ip, r1, #3
-               bne     .c2u_src_not_aligned
-/*
- * Seeing as there has to be at least 8 bytes to copy, we can
- * copy one word, and force a user-mode page fault...
- */
-
-.c2u_0fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .c2u_0nowords
-               ldr     r3, [r1], #4
-USER(          strt    r3, [r0], #4)                   @ May fault
-               mov     ip, r0, lsl #32 - PAGE_SHIFT    @ On each page, use a ld/st??t instruction
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .c2u_0fupi
-/*
- * ip = max no. of bytes to copy before needing another "strt" insn
- */
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #32
-               blt     .c2u_0rem8lp
-
-.c2u_0cpy8lp:  ldmia   r1!, {r3 - r6}
-               stmia   r0!, {r3 - r6}                  @ Shouldnt fault
-               ldmia   r1!, {r3 - r6}
-               stmia   r0!, {r3 - r6}                  @ Shouldnt fault
-               subs    ip, ip, #32
-               bpl     .c2u_0cpy8lp
-.c2u_0rem8lp:  cmn     ip, #16
-               ldmgeia r1!, {r3 - r6}
-               stmgeia r0!, {r3 - r6}                  @ Shouldnt fault
-               tst     ip, #8
-               ldmneia r1!, {r3 - r4}
-               stmneia r0!, {r3 - r4}                  @ Shouldnt fault
-               tst     ip, #4
-               ldrne   r3, [r1], #4
-               strnet  r3, [r0], #4                    @ Shouldnt fault
-               ands    ip, ip, #3
-               beq     .c2u_0fupi
-.c2u_0nowords: teq     ip, #0
-               beq     .c2u_finished
-.c2u_nowords:  cmp     ip, #2
-               ldrb    r3, [r1], #1
-USER(          strbt   r3, [r0], #1)                   @ May fault
-               ldrgeb  r3, [r1], #1
-USER(          strgebt r3, [r0], #1)                   @ May fault
-               ldrgtb  r3, [r1], #1
-USER(          strgtbt r3, [r0], #1)                   @ May fault
-               b       .c2u_finished
-
-.c2u_not_enough:
-               movs    ip, r2
-               bne     .c2u_nowords
-.c2u_finished: mov     r0, #0
-               LOADREGS(fd,sp!,{r2, r4 - r7, pc})
-
-.c2u_src_not_aligned:
-               bic     r1, r1, #3
-               ldr     r7, [r1], #4
-               cmp     ip, #2
-               bgt     .c2u_3fupi
-               beq     .c2u_2fupi
-.c2u_1fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .c2u_1nowords
-               mov     r3, r7, pull #8
-               ldr     r7, [r1], #4
-               orr     r3, r3, r7, push #24
-USER(          strt    r3, [r0], #4)                   @ May fault
-               mov     ip, r0, lsl #32 - PAGE_SHIFT
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .c2u_1fupi
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #16
-               blt     .c2u_1rem8lp
-
-.c2u_1cpy8lp:  mov     r3, r7, pull #8
-               ldmia   r1!, {r4 - r7}
-               orr     r3, r3, r4, push #24
-               mov     r4, r4, pull #8
-               orr     r4, r4, r5, push #24
-               mov     r5, r5, pull #8
-               orr     r5, r5, r6, push #24
-               mov     r6, r6, pull #8
-               orr     r6, r6, r7, push #24
-               stmia   r0!, {r3 - r6}                  @ Shouldnt fault
-               subs    ip, ip, #16
-               bpl     .c2u_1cpy8lp
-.c2u_1rem8lp:  tst     ip, #8
-               movne   r3, r7, pull #8
-               ldmneia r1!, {r4, r7}
-               orrne   r3, r3, r4, push #24
-               movne   r4, r4, pull #8
-               orrne   r4, r4, r7, push #24
-               stmneia r0!, {r3 - r4}                  @ Shouldnt fault
-               tst     ip, #4
-               movne   r3, r7, pull #8
-               ldrne   r7, [r1], #4
-               orrne   r3, r3, r7, push #24
-               strnet  r3, [r0], #4                    @ Shouldnt fault
-               ands    ip, ip, #3
-               beq     .c2u_1fupi
-.c2u_1nowords: mov     r3, r7, lsr #byte(1)
-               teq     ip, #0
-               beq     .c2u_finished
-               cmp     ip, #2
-USER(          strbt   r3, [r0], #1)                   @ May fault
-               movge   r3, r7, lsr #byte(2)
-USER(          strgebt r3, [r0], #1)                   @ May fault
-               movgt   r3, r7, lsr #byte(3)
-USER(          strgtbt r3, [r0], #1)                   @ May fault
-               b       .c2u_finished
-
-.c2u_2fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .c2u_2nowords
-               mov     r3, r7, pull #16
-               ldr     r7, [r1], #4
-               orr     r3, r3, r7, push #16
-USER(          strt    r3, [r0], #4)                   @ May fault
-               mov     ip, r0, lsl #32 - PAGE_SHIFT
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .c2u_2fupi
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #16
-               blt     .c2u_2rem8lp
-
-.c2u_2cpy8lp:  mov     r3, r7, pull #16
-               ldmia   r1!, {r4 - r7}
-               orr     r3, r3, r4, push #16
-               mov     r4, r4, pull #16
-               orr     r4, r4, r5, push #16
-               mov     r5, r5, pull #16
-               orr     r5, r5, r6, push #16
-               mov     r6, r6, pull #16
-               orr     r6, r6, r7, push #16
-               stmia   r0!, {r3 - r6}                  @ Shouldnt fault
-               subs    ip, ip, #16
-               bpl     .c2u_2cpy8lp
-.c2u_2rem8lp:  tst     ip, #8
-               movne   r3, r7, pull #16
-               ldmneia r1!, {r4, r7}
-               orrne   r3, r3, r4, push #16
-               movne   r4, r4, pull #16
-               orrne   r4, r4, r7, push #16
-               stmneia r0!, {r3 - r4}                  @ Shouldnt fault
-               tst     ip, #4
-               movne   r3, r7, pull #16
-               ldrne   r7, [r1], #4
-               orrne   r3, r3, r7, push #16
-               strnet  r3, [r0], #4                    @ Shouldnt fault
-               ands    ip, ip, #3
-               beq     .c2u_2fupi
-.c2u_2nowords: mov     r3, r7, lsr #byte(2)
-               teq     ip, #0
-               beq     .c2u_finished
-               cmp     ip, #2
-USER(          strbt   r3, [r0], #1)                   @ May fault
-               movge   r3, r7, lsr #byte(3)
-USER(          strgebt r3, [r0], #1)                   @ May fault
-               ldrgtb  r3, [r1], #0
-USER(          strgtbt r3, [r0], #1)                   @ May fault
-               b       .c2u_finished
-
-.c2u_3fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .c2u_3nowords
-               mov     r3, r7, pull #24
-               ldr     r7, [r1], #4
-               orr     r3, r3, r7, push #8
-USER(          strt    r3, [r0], #4)                   @ May fault
-               mov     ip, r0, lsl #32 - PAGE_SHIFT
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .c2u_3fupi
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #16
-               blt     .c2u_3rem8lp
-
-.c2u_3cpy8lp:  mov     r3, r7, pull #24
-               ldmia   r1!, {r4 - r7}
-               orr     r3, r3, r4, push #8
-               mov     r4, r4, pull #24
-               orr     r4, r4, r5, push #8
-               mov     r5, r5, pull #24
-               orr     r5, r5, r6, push #8
-               mov     r6, r6, pull #24
-               orr     r6, r6, r7, push #8
-               stmia   r0!, {r3 - r6}                  @ Shouldnt fault
-               subs    ip, ip, #16
-               bpl     .c2u_3cpy8lp
-.c2u_3rem8lp:  tst     ip, #8
-               movne   r3, r7, pull #24
-               ldmneia r1!, {r4, r7}
-               orrne   r3, r3, r4, push #8
-               movne   r4, r4, pull #24
-               orrne   r4, r4, r7, push #8
-               stmneia r0!, {r3 - r4}                  @ Shouldnt fault
-               tst     ip, #4
-               movne   r3, r7, pull #24
-               ldrne   r7, [r1], #4
-               orrne   r3, r3, r7, push #8
-               strnet  r3, [r0], #4                    @ Shouldnt fault
-               ands    ip, ip, #3
-               beq     .c2u_3fupi
-.c2u_3nowords: mov     r3, r7, lsr #byte(3)
-               teq     ip, #0
-               beq     .c2u_finished
-               cmp     ip, #2
-USER(          strbt   r3, [r0], #1)                   @ May fault
-               ldrgeb  r3, [r1], #1
-USER(          strgebt r3, [r0], #1)                   @ May fault
-               ldrgtb  r3, [r1], #0
-USER(          strgtbt r3, [r0], #1)                   @ May fault
-               b       .c2u_finished
-
-               .section .fixup,"ax"
-               .align  0
-9001:          LOADREGS(fd,sp!, {r0, r4 - r7, pc})
-               .previous
-
-/* Prototype: unsigned long uaccess_user_copy_from_user(void *to,const void *from,unsigned long n);
- * Purpose  : copy a block from user memory to kernel memory
- * Params   : to   - kernel memory
- *          : from - user memory
- *          : n    - number of bytes to copy
- * Returns  : Number of bytes NOT copied.
- */
-.cfu_dest_not_aligned:
-               rsb     ip, ip, #4
-               cmp     ip, #2
-USER(          ldrbt   r3, [r1], #1)                   @ May fault
-               strb    r3, [r0], #1
-USER(          ldrgebt r3, [r1], #1)                   @ May fault
-               strgeb  r3, [r0], #1
-USER(          ldrgtbt r3, [r1], #1)                   @ May fault
-               strgtb  r3, [r0], #1
-               sub     r2, r2, ip
-               b       .cfu_dest_aligned
-
-ENTRY(uaccess_user_copy_from_user)
-               stmfd   sp!, {r0, r2, r4 - r7, lr}
-               cmp     r2, #4
-               blt     .cfu_not_enough
-               ands    ip, r0, #3
-               bne     .cfu_dest_not_aligned
-.cfu_dest_aligned:
-               ands    ip, r1, #3
-               bne     .cfu_src_not_aligned
-/*
- * Seeing as there has to be at least 8 bytes to copy, we can
- * copy one word, and force a user-mode page fault...
- */
-
-.cfu_0fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .cfu_0nowords
-USER(          ldrt    r3, [r1], #4)
-               str     r3, [r0], #4
-               mov     ip, r1, lsl #32 - PAGE_SHIFT    @ On each page, use a ld/st??t instruction
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .cfu_0fupi
-/*
- * ip = max no. of bytes to copy before needing another "strt" insn
- */
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #32
-               blt     .cfu_0rem8lp
-
-.cfu_0cpy8lp:  ldmia   r1!, {r3 - r6}                  @ Shouldnt fault
-               stmia   r0!, {r3 - r6}
-               ldmia   r1!, {r3 - r6}                  @ Shouldnt fault
-               stmia   r0!, {r3 - r6}
-               subs    ip, ip, #32
-               bpl     .cfu_0cpy8lp
-.cfu_0rem8lp:  cmn     ip, #16
-               ldmgeia r1!, {r3 - r6}                  @ Shouldnt fault
-               stmgeia r0!, {r3 - r6}
-               tst     ip, #8
-               ldmneia r1!, {r3 - r4}                  @ Shouldnt fault
-               stmneia r0!, {r3 - r4}
-               tst     ip, #4
-               ldrnet  r3, [r1], #4                    @ Shouldnt fault
-               strne   r3, [r0], #4
-               ands    ip, ip, #3
-               beq     .cfu_0fupi
-.cfu_0nowords: teq     ip, #0
-               beq     .cfu_finished
-.cfu_nowords:  cmp     ip, #2
-USER(          ldrbt   r3, [r1], #1)                   @ May fault
-               strb    r3, [r0], #1
-USER(          ldrgebt r3, [r1], #1)                   @ May fault
-               strgeb  r3, [r0], #1
-USER(          ldrgtbt r3, [r1], #1)                   @ May fault
-               strgtb  r3, [r0], #1
-               b       .cfu_finished
-
-.cfu_not_enough:
-               movs    ip, r2
-               bne     .cfu_nowords
-.cfu_finished: mov     r0, #0
-               add     sp, sp, #8
-               LOADREGS(fd,sp!,{r4 - r7, pc})
-
-.cfu_src_not_aligned:
-               bic     r1, r1, #3
-USER(          ldrt    r7, [r1], #4)                   @ May fault
-               cmp     ip, #2
-               bgt     .cfu_3fupi
-               beq     .cfu_2fupi
-.cfu_1fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .cfu_1nowords
-               mov     r3, r7, pull #8
-USER(          ldrt    r7, [r1], #4)                   @ May fault
-               orr     r3, r3, r7, push #24
-               str     r3, [r0], #4
-               mov     ip, r1, lsl #32 - PAGE_SHIFT
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .cfu_1fupi
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #16
-               blt     .cfu_1rem8lp
-
-.cfu_1cpy8lp:  mov     r3, r7, pull #8
-               ldmia   r1!, {r4 - r7}                  @ Shouldnt fault
-               orr     r3, r3, r4, push #24
-               mov     r4, r4, pull #8
-               orr     r4, r4, r5, push #24
-               mov     r5, r5, pull #8
-               orr     r5, r5, r6, push #24
-               mov     r6, r6, pull #8
-               orr     r6, r6, r7, push #24
-               stmia   r0!, {r3 - r6}
-               subs    ip, ip, #16
-               bpl     .cfu_1cpy8lp
-.cfu_1rem8lp:  tst     ip, #8
-               movne   r3, r7, pull #8
-               ldmneia r1!, {r4, r7}                   @ Shouldnt fault
-               orrne   r3, r3, r4, push #24
-               movne   r4, r4, pull #8
-               orrne   r4, r4, r7, push #24
-               stmneia r0!, {r3 - r4}
-               tst     ip, #4
-               movne   r3, r7, pull #8
-USER(          ldrnet  r7, [r1], #4)                   @ May fault
-               orrne   r3, r3, r7, push #24
-               strne   r3, [r0], #4
-               ands    ip, ip, #3
-               beq     .cfu_1fupi
-.cfu_1nowords: mov     r3, r7, lsr #byte(1)
-               teq     ip, #0
-               beq     .cfu_finished
-               cmp     ip, #2
-               strb    r3, [r0], #1
-               movge   r3, r7, lsr #byte(2)
-               strgeb  r3, [r0], #1
-               movgt   r3, r7, lsr #byte(3)
-               strgtb  r3, [r0], #1
-               b       .cfu_finished
-
-.cfu_2fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .cfu_2nowords
-               mov     r3, r7, pull #16
-USER(          ldrt    r7, [r1], #4)                   @ May fault
-               orr     r3, r3, r7, push #16
-               str     r3, [r0], #4
-               mov     ip, r1, lsl #32 - PAGE_SHIFT
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .cfu_2fupi
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #16
-               blt     .cfu_2rem8lp
-
-.cfu_2cpy8lp:  mov     r3, r7, pull #16
-               ldmia   r1!, {r4 - r7}                  @ Shouldnt fault
-               orr     r3, r3, r4, push #16
-               mov     r4, r4, pull #16
-               orr     r4, r4, r5, push #16
-               mov     r5, r5, pull #16
-               orr     r5, r5, r6, push #16
-               mov     r6, r6, pull #16
-               orr     r6, r6, r7, push #16
-               stmia   r0!, {r3 - r6}
-               subs    ip, ip, #16
-               bpl     .cfu_2cpy8lp
-.cfu_2rem8lp:  tst     ip, #8
-               movne   r3, r7, pull #16
-               ldmneia r1!, {r4, r7}                   @ Shouldnt fault
-               orrne   r3, r3, r4, push #16
-               movne   r4, r4, pull #16
-               orrne   r4, r4, r7, push #16
-               stmneia r0!, {r3 - r4}
-               tst     ip, #4
-               movne   r3, r7, pull #16
-USER(          ldrnet  r7, [r1], #4)                   @ May fault
-               orrne   r3, r3, r7, push #16
-               strne   r3, [r0], #4
-               ands    ip, ip, #3
-               beq     .cfu_2fupi
-.cfu_2nowords: mov     r3, r7, lsr #byte(2)
-               teq     ip, #0
-               beq     .cfu_finished
-               cmp     ip, #2
-               strb    r3, [r0], #1
-               movge   r3, r7, lsr #byte(3)
-               strgeb  r3, [r0], #1
-USER(          ldrgtbt r3, [r1], #0)                   @ May fault
-               strgtb  r3, [r0], #1
-               b       .cfu_finished
-
-.cfu_3fupi:    subs    r2, r2, #4
-               addmi   ip, r2, #4
-               bmi     .cfu_3nowords
-               mov     r3, r7, pull #24
-USER(          ldrt    r7, [r1], #4)                   @ May fault
-               orr     r3, r3, r7, push #8
-               str     r3, [r0], #4
-               mov     ip, r1, lsl #32 - PAGE_SHIFT
-               rsb     ip, ip, #0
-               movs    ip, ip, lsr #32 - PAGE_SHIFT
-               beq     .cfu_3fupi
-               cmp     r2, ip
-               movlt   ip, r2
-               sub     r2, r2, ip
-               subs    ip, ip, #16
-               blt     .cfu_3rem8lp
-
-.cfu_3cpy8lp:  mov     r3, r7, pull #24
-               ldmia   r1!, {r4 - r7}                  @ Shouldnt fault
-               orr     r3, r3, r4, push #8
-               mov     r4, r4, pull #24
-               orr     r4, r4, r5, push #8
-               mov     r5, r5, pull #24
-               orr     r5, r5, r6, push #8
-               mov     r6, r6, pull #24
-               orr     r6, r6, r7, push #8
-               stmia   r0!, {r3 - r6}
-               subs    ip, ip, #16
-               bpl     .cfu_3cpy8lp
-.cfu_3rem8lp:  tst     ip, #8
-               movne   r3, r7, pull #24
-               ldmneia r1!, {r4, r7}                   @ Shouldnt fault
-               orrne   r3, r3, r4, push #8
-               movne   r4, r4, pull #24
-               orrne   r4, r4, r7, push #8
-               stmneia r0!, {r3 - r4}
-               tst     ip, #4
-               movne   r3, r7, pull #24
-USER(          ldrnet  r7, [r1], #4)                   @ May fault
-               orrne   r3, r3, r7, push #8
-               strne   r3, [r0], #4
-               ands    ip, ip, #3
-               beq     .cfu_3fupi
-.cfu_3nowords: mov     r3, r7, lsr #byte(3)
-               teq     ip, #0
-               beq     .cfu_finished
-               cmp     ip, #2
-               strb    r3, [r0], #1
-USER(          ldrgebt r3, [r1], #1)                   @ May fault
-               strgeb  r3, [r0], #1
-USER(          ldrgtbt r3, [r1], #1)                   @ May fault
-               strgtb  r3, [r0], #1
-               b       .cfu_finished
-
-               .section .fixup,"ax"
-               .align  0
-               /*
-                * We took an exception.  r0 contains a pointer to
-                * the byte not copied.
-                */
-9001:          ldr     r2, [sp], #4                    @ void *to
-               sub     r2, r0, r2                      @ bytes copied
-               ldr     r1, [sp], #4                    @ unsigned long count
-               subs    r4, r1, r2                      @ bytes left to copy
-               movne   r1, r4
-               blne    __memzero
-               mov     r0, r4
-               LOADREGS(fd,sp!, {r4 - r7, pc})
-               .previous
-
-/* Prototype: int uaccess_user_clear_user(void *addr, size_t sz)
- * Purpose  : clear some user memory
- * Params   : addr - user memory address to clear
- *          : sz   - number of bytes to clear
- * Returns  : number of bytes NOT cleared
- */
-ENTRY(uaccess_user_clear_user)
-               stmfd   sp!, {r1, lr}
-               mov     r2, #0
-               cmp     r1, #4
-               blt     2f
-               ands    ip, r0, #3
-               beq     1f
-               cmp     ip, #2
-USER(          strbt   r2, [r0], #1)
-USER(          strlebt r2, [r0], #1)
-USER(          strltbt r2, [r0], #1)
-               rsb     ip, ip, #4
-               sub     r1, r1, ip              @  7  6  5  4  3  2  1
-1:             subs    r1, r1, #8              @ -1 -2 -3 -4 -5 -6 -7
-USER(          strplt  r2, [r0], #4)
-USER(          strplt  r2, [r0], #4)
-               bpl     1b
-               adds    r1, r1, #4              @  3  2  1  0 -1 -2 -3
-USER(          strplt  r2, [r0], #4)
-2:             tst     r1, #2                  @ 1x 1x 0x 0x 1x 1x 0x
-USER(          strnebt r2, [r0], #1)
-USER(          strnebt r2, [r0], #1)
-               tst     r1, #1                  @ x1 x0 x1 x0 x1 x0 x1
-USER(          strnebt r2, [r0], #1)
-               mov     r0, #0
-               LOADREGS(fd,sp!, {r1, pc})
-
-               .section .fixup,"ax"
-               .align  0
-9001:          LOADREGS(fd,sp!, {r0, pc})
-               .previous
-
-/*
- * Copy a string from user space to kernel space.
- *  r0 = dst, r1 = src, r2 = byte length
- * returns the number of characters copied (strlen of copied string),
- *  -EFAULT on exception, or "len" if we fill the whole buffer
- */
-ENTRY(uaccess_user_strncpy_from_user)
-        save_lr
-        mov     ip, r1
-1:      subs    r2, r2, #1
-USER(   ldrplbt r3, [r1], #1)
-        bmi     2f
-        strb    r3, [r0], #1
-        teq     r3, #0
-        bne     1b
-        sub     r1, r1, #1      @ take NUL character out of count
-2:      sub     r0, r1, ip
-        restore_pc
-
-        .section .fixup,"ax"
-        .align  0
-9001:   mov     r3, #0
-        strb    r3, [r0, #0]    @ null terminate
-        mov     r0, #-EFAULT
-        restore_pc
-        .previous
-
-/* Prototype: unsigned long uaccess_user_strnlen_user(const char *str, long n)
- * Purpose  : get length of a string in user memory
- * Params   : str - address of string in user memory
- * Returns  : length of string *including terminator*
- *            or zero on exception, or n + 1 if too long
- */
-ENTRY(uaccess_user_strnlen_user)
-        save_lr
-        mov     r2, r0
-1:
-USER(   ldrbt   r3, [r0], #1)
-        teq     r3, #0
-        beq     2f
-        subs    r1, r1, #1
-        bne     1b
-        add     r0, r0, #1
-2:      sub     r0, r0, r2
-        restore_pc
-
-        .section .fixup,"ax"
-        .align  0
-9001:   mov     r0, #0
-        restore_pc
-        .previous
-
diff --git a/arch/arm26/lib/ucmpdi2.c b/arch/arm26/lib/ucmpdi2.c
deleted file mode 100644 (file)
index 6c6ae63..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/* More subroutines needed by GCC output code on some machines.  */
-/* Compile this one with gcc.  */
-/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.
- */
-/* support functions required by the kernel. based on code from gcc-2.95.3 */
-/* I Molton     29/07/01 */
-
-#include "gcclib.h"
-
-word_type
-__ucmpdi2 (DItype a, DItype b)
-{
-  DIunion au, bu;
-
-  au.ll = a, bu.ll = b;
-
-  if ((USItype) au.s.high < (USItype) bu.s.high)
-    return 0;
-  else if ((USItype) au.s.high > (USItype) bu.s.high)
-    return 2;
-  if ((USItype) au.s.low < (USItype) bu.s.low)
-    return 0;
-  else if ((USItype) au.s.low > (USItype) bu.s.low)
-    return 2;
-  return 1;
-}
-
diff --git a/arch/arm26/lib/udivdi3.c b/arch/arm26/lib/udivdi3.c
deleted file mode 100644 (file)
index d25195f..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-/* More subroutines needed by GCC output code on some machines.  */
-/* Compile this one with gcc.  */
-/* Copyright (C) 1989, 92-98, 1999 Free Software Foundation, Inc.
-
-This file is part of GNU CC.
-
-GNU CC is free software; you can redistribute it and/or modify
-it under the terms of the GNU General Public License as published by
-the Free Software Foundation; either version 2, or (at your option)
-any later version.
-
-GNU CC is distributed in the hope that it will be useful,
-but WITHOUT ANY WARRANTY; without even the implied warranty of
-MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-GNU General Public License for more details.
-
-You should have received a copy of the GNU General Public License
-along with GNU CC; see the file COPYING.  If not, write to
-the Free Software Foundation, 59 Temple Place - Suite 330,
-Boston, MA 02111-1307, USA.  */
-
-/* As a special exception, if you link this library with other files,
-   some of which are compiled with GCC, to produce an executable,
-   this library does not by itself cause the resulting executable
-   to be covered by the GNU General Public License.
-   This exception does not however invalidate any other reasons why
-   the executable file might be covered by the GNU General Public License.
- */
-/* support functions required by the kernel. based on code from gcc-2.95.3 */
-/* I Molton     29/07/01 */
-
-#include "gcclib.h"
-#include "longlong.h"
-
-static const UQItype __clz_tab[] =
-{
-  0,1,2,2,3,3,3,3,4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,5,
-  6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,6,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,7,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-  8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,8,
-};
-
-UDItype
-__udivmoddi4 (UDItype n, UDItype d, UDItype *rp)
-{
-  DIunion ww;
-  DIunion nn, dd;
-  DIunion rr;
-  USItype d0, d1, n0, n1, n2;
-  USItype q0, q1;
-  USItype b, bm;
-
-  nn.ll = n;
-  dd.ll = d;
-
-  d0 = dd.s.low;
-  d1 = dd.s.high;
-  n0 = nn.s.low;
-  n1 = nn.s.high;
-
-  if (d1 == 0)
-    {
-      if (d0 > n1)
-        {
-          /* 0q = nn / 0D */
-
-          count_leading_zeros (bm, d0);
-
-          if (bm != 0)
-            {
-              /* Normalize, i.e. make the most significant bit of the
-                 denominator set.  */
-
-              d0 = d0 << bm;
-              n1 = (n1 << bm) | (n0 >> (SI_TYPE_SIZE - bm));
-              n0 = n0 << bm;
-            }
-
-          udiv_qrnnd (q0, n0, n1, n0, d0);
-          q1 = 0;
-
-          /* Remainder in n0 >> bm.  */
-        }
-      else
-        {
-          /* qq = NN / 0d */
-
-          if (d0 == 0)
-            d0 = 1 / d0;        /* Divide intentionally by zero.  */
-
-          count_leading_zeros (bm, d0);
-
-          if (bm == 0)
-            {
-              /* From (n1 >= d0) /\ (the most significant bit of d0 is set),
-                 conclude (the most significant bit of n1 is set) /\ (the
-                 leading quotient digit q1 = 1).
-
-                 This special case is necessary, not an optimization.
-                 (Shifts counts of SI_TYPE_SIZE are undefined.)  */
-
-              n1 -= d0;
-              q1 = 1;
-            }
-          else
-            {
-              /* Normalize.  */
-
-              b = SI_TYPE_SIZE - bm;
-
-              d0 = d0 << bm;
-              n2 = n1 >> b;
-              n1 = (n1 << bm) | (n0 >> b);
-              n0 = n0 << bm;
-
-              udiv_qrnnd (q1, n1, n2, n1, d0);
-            }
-
-          /* n1 != d0...  */
-
-          udiv_qrnnd (q0, n0, n1, n0, d0);
-
-          /* Remainder in n0 >> bm.  */
-        }
-
-      if (rp != 0)
-        {
-          rr.s.low = n0 >> bm;
-          rr.s.high = 0;
-          *rp = rr.ll;
-        }
-    }
-  else
-    {
-      if (d1 > n1)
-        {
-          /* 00 = nn / DD */
-
-          q0 = 0;
-          q1 = 0;
-
-          /* Remainder in n1n0.  */
-          if (rp != 0)
-            {
-              rr.s.low = n0;
-              rr.s.high = n1;
-              *rp = rr.ll;
-            }
-        }
-      else
-        {
-          /* 0q = NN / dd */
-
-          count_leading_zeros (bm, d1);
-          if (bm == 0)
-            {
-              /* From (n1 >= d1) /\ (the most significant bit of d1 is set),
-                 conclude (the most significant bit of n1 is set) /\ (the
-                 quotient digit q0 = 0 or 1).
-
-                 This special case is necessary, not an optimization.  */
-
-              /* The condition on the next line takes advantage of that
-                 n1 >= d1 (true due to program flow).  */
-              if (n1 > d1 || n0 >= d0)
-                {
-                  q0 = 1;
-                  sub_ddmmss (n1, n0, n1, n0, d1, d0);
-                }
-              else
-                q0 = 0;
-
-              q1 = 0;
-
-              if (rp != 0)
-                {
-                  rr.s.low = n0;
-                  rr.s.high = n1;
-                  *rp = rr.ll;
-                }
-            }
-          else
-            {
-              USItype m1, m0;
-              /* Normalize.  */
-
-              b = SI_TYPE_SIZE - bm;
-
-              d1 = (d1 << bm) | (d0 >> b);
-              d0 = d0 << bm;
-              n2 = n1 >> b;
-              n1 = (n1 << bm) | (n0 >> b);
-              n0 = n0 << bm;
-
-              udiv_qrnnd (q0, n1, n2, n1, d1);
-              umul_ppmm (m1, m0, q0, d0);
-
-              if (m1 > n1 || (m1 == n1 && m0 > n0))
-                {
-                  q0--;
-                  sub_ddmmss (m1, m0, m1, m0, d1, d0);
-                }
-
-              q1 = 0;
-
-              /* Remainder in (n1n0 - m1m0) >> bm.  */
-              if (rp != 0)
-                {
-                  sub_ddmmss (n1, n0, n1, n0, m1, m0);
-                  rr.s.low = (n1 << b) | (n0 >> bm);
-                  rr.s.high = n1 >> bm;
-                  *rp = rr.ll;
-                }
-            }
-        }
-    }
-
-  ww.s.low = q0;
-  ww.s.high = q1;
-  return ww.ll;
-}
-
-UDItype
-__udivdi3 (UDItype n, UDItype d)
-{
-  return __udivmoddi4 (n, d, (UDItype *) 0);
-}
-
-UDItype
-__umoddi3 (UDItype u, UDItype v)
-{
-  UDItype w;
-
-  (void) __udivmoddi4 (u ,v, &w);
-
-  return w;
-}
-
diff --git a/arch/arm26/machine/Makefile b/arch/arm26/machine/Makefile
deleted file mode 100644 (file)
index 86ea97c..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#
-# Makefile for the linux kernel.
-#
-
-# Object file lists.
-
-obj-y                  := dma.o irq.o latches.o
-
diff --git a/arch/arm26/machine/dma.c b/arch/arm26/machine/dma.c
deleted file mode 100644 (file)
index 4402a5a..0000000
+++ /dev/null
@@ -1,214 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/dma.c
- *
- *  Copyright (C) 1998-1999 Dave Gilbert / Russell King
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  DMA functions specific to Archimedes and A5000 architecture
- */
-#include <linux/sched.h>
-#include <linux/init.h>
-
-#include <asm/dma.h>
-#include <asm/fiq.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/hardware.h>
-#include <asm/mach-types.h>
-
-#define DPRINTK(x...) printk(KERN_DEBUG x)
-
-#if defined(CONFIG_BLK_DEV_FD1772) || defined(CONFIG_BLK_DEV_FD1772_MODULE)
-
-extern unsigned char fdc1772_dma_read, fdc1772_dma_read_end;
-extern unsigned char fdc1772_dma_write, fdc1772_dma_write_end;
-extern void fdc1772_setupdma(unsigned int count,unsigned int addr);
-
-static void arc_floppy_data_enable_dma(dmach_t channel, dma_t *dma)
-{
-       DPRINTK("arc_floppy_data_enable_dma\n");
-
-       if (dma->using_sg)
-               BUG();
-
-       switch (dma->dma_mode) {
-       case DMA_MODE_READ: { /* read */
-               unsigned long flags;
-               DPRINTK("enable_dma fdc1772 data read\n");
-               local_save_flags_cli(flags);
-               clf();
-                       
-               memcpy ((void *)0x1c, (void *)&fdc1772_dma_read,
-                       &fdc1772_dma_read_end - &fdc1772_dma_read);
-               fdc1772_setupdma(dma->buf.length, dma->buf.__address); /* Sets data pointer up */
-               enable_fiq(FIQ_FLOPPYDATA);
-               local_irq_restore(flags);
-          }
-          break;
-
-       case DMA_MODE_WRITE: { /* write */
-               unsigned long flags;
-               DPRINTK("enable_dma fdc1772 data write\n");
-               local_save_flags_cli(flags);
-               clf();
-               memcpy ((void *)0x1c, (void *)&fdc1772_dma_write,
-                       &fdc1772_dma_write_end - &fdc1772_dma_write);
-               fdc1772_setupdma(dma->buf.length, dma->buf.__address); /* Sets data pointer up */
-               enable_fiq(FIQ_FLOPPYDATA);
-
-               local_irq_restore(flags);
-           }
-           break;
-       default:
-               printk ("enable_dma: dma%d not initialised\n", channel);
-       }
-}
-
-static int arc_floppy_data_get_dma_residue(dmach_t channel, dma_t *dma)
-{
-       extern unsigned int fdc1772_bytestogo;
-
-       /* 10/1/1999 DAG - I presume its the number of bytes left? */
-       return fdc1772_bytestogo;
-}
-
-static void arc_floppy_cmdend_enable_dma(dmach_t channel, dma_t *dma)
-{
-       /* Need to build a branch at the FIQ address */
-       extern void fdc1772_comendhandler(void);
-       unsigned long flags;
-
-       DPRINTK("arc_floppy_cmdend_enable_dma\n");
-       /*printk("enable_dma fdc1772 command end FIQ\n");*/
-       save_flags(flags);
-       clf();
-       
-       /* B fdc1772_comendhandler */
-       *((unsigned int *)0x1c)=0xea000000 |
-                       (((unsigned int)fdc1772_comendhandler-(0x1c+8))/4);
-
-       local_irq_restore(flags);
-}
-
-static int arc_floppy_cmdend_get_dma_residue(dmach_t channel, dma_t *dma)
-{
-       /* 10/1/1999 DAG - Presume whether there is an outstanding command? */
-       extern unsigned int fdc1772_fdc_int_done;
-
-       /* Explicit! If the int done is 0 then 1 int to go */
-       return (fdc1772_fdc_int_done==0)?1:0;
-}
-
-static void arc_disable_dma(dmach_t channel, dma_t *dma)
-{
-       disable_fiq(dma->dma_irq);
-}
-
-static struct dma_ops arc_floppy_data_dma_ops = {
-       .type           = "FIQDMA",
-       .enable         = arc_floppy_data_enable_dma,
-       .disable        = arc_disable_dma,
-       .residue        = arc_floppy_data_get_dma_residue,
-};
-
-static struct dma_ops arc_floppy_cmdend_dma_ops = {
-       .type           = "FIQCMD",
-       .enable         = arc_floppy_cmdend_enable_dma,
-       .disable        = arc_disable_dma,
-       .residue        = arc_floppy_cmdend_get_dma_residue,
-};
-#endif
-
-#ifdef CONFIG_ARCH_A5K
-static struct fiq_handler fh = {
-       .name   = "floppydata"
-};
-
-static int a5k_floppy_get_dma_residue(dmach_t channel, dma_t *dma)
-{
-       struct pt_regs regs;
-       get_fiq_regs(&regs);
-       return regs.ARM_r9;
-}
-
-static void a5k_floppy_enable_dma(dmach_t channel, dma_t *dma)
-{
-       struct pt_regs regs;
-       void *fiqhandler_start;
-       unsigned int fiqhandler_length;
-       extern void floppy_fiqsetup(unsigned long len, unsigned long addr,
-                                    unsigned long port);
-
-       if (dma->using_sg)
-               BUG();
-
-       if (dma->dma_mode == DMA_MODE_READ) {
-               extern unsigned char floppy_fiqin_start, floppy_fiqin_end;
-               fiqhandler_start = &floppy_fiqin_start;
-               fiqhandler_length = &floppy_fiqin_end - &floppy_fiqin_start;
-       } else {
-               extern unsigned char floppy_fiqout_start, floppy_fiqout_end;
-               fiqhandler_start = &floppy_fiqout_start;
-               fiqhandler_length = &floppy_fiqout_end - &floppy_fiqout_start;
-       }
-       if (claim_fiq(&fh)) {
-               printk("floppydma: couldn't claim FIQ.\n");
-               return;
-       }
-       memcpy((void *)0x1c, fiqhandler_start, fiqhandler_length);
-       regs.ARM_r9 = dma->buf.length;
-       regs.ARM_r10 = (unsigned long)dma->buf.__address;
-       regs.ARM_fp = FLOPPYDMA_BASE;
-       set_fiq_regs(&regs);
-       enable_fiq(dma->dma_irq);
-}
-
-static void a5k_floppy_disable_dma(dmach_t channel, dma_t *dma)
-{
-       disable_fiq(dma->dma_irq);
-       release_fiq(&fh);
-}
-
-static struct dma_ops a5k_floppy_dma_ops = {
-       .type           = "FIQDMA",
-       .enable         = a5k_floppy_enable_dma,
-       .disable        = a5k_floppy_disable_dma,
-       .residue        = a5k_floppy_get_dma_residue,
-};
-#endif
-
-/*
- * This is virtual DMA - we don't need anything here
- */
-static void sound_enable_disable_dma(dmach_t channel, dma_t *dma)
-{
-}
-
-static struct dma_ops sound_dma_ops = {
-       .type           = "VIRTUAL",
-       .enable         = sound_enable_disable_dma,
-       .disable        = sound_enable_disable_dma,
-};
-
-void __init arch_dma_init(dma_t *dma)
-{
-#if defined(CONFIG_BLK_DEV_FD1772) || defined(CONFIG_BLK_DEV_FD1772_MODULE)
-       if (machine_is_archimedes()) {
-               dma[DMA_VIRTUAL_FLOPPY0].dma_irq = FIQ_FLOPPYDATA;
-               dma[DMA_VIRTUAL_FLOPPY0].d_ops   = &arc_floppy_data_dma_ops;
-               dma[DMA_VIRTUAL_FLOPPY1].dma_irq = 1;
-               dma[DMA_VIRTUAL_FLOPPY1].d_ops   = &arc_floppy_cmdend_dma_ops;
-       }
-#endif
-#ifdef CONFIG_ARCH_A5K
-       if (machine_is_a5k()) {
-               dma[DMA_VIRTUAL_FLOPPY0].dma_irq = FIQ_FLOPPYDATA;
-               dma[DMA_VIRTUAL_FLOPPY0].d_ops   = &a5k_floppy_dma_ops;
-       }
-#endif
-       dma[DMA_VIRTUAL_SOUND].d_ops = &sound_dma_ops;
-}
diff --git a/arch/arm26/machine/irq.c b/arch/arm26/machine/irq.c
deleted file mode 100644 (file)
index a60d543..0000000
+++ /dev/null
@@ -1,164 +0,0 @@
-/*
- *  linux/arch/arm26/mach-arc/irq.c
- *
- *  Copyright (C) 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Changelog:
- *   24-09-1996        RMK     Created
- *   10-10-1996        RMK     Brought up to date with arch-sa110eval
- *   22-10-1996        RMK     Changed interrupt numbers & uses new inb/outb macros
- *   11-01-1998        RMK     Added mask_and_ack_irq
- *   22-08-1998        RMK     Restructured IRQ routines
- *   08-09-2002 IM     Brought up to date for 2.5
- *   01-06-2003 JMA     Removed arc_fiq_chip
- */
-#include <linux/init.h>
-
-#include <asm/irq.h>
-#include <asm/irqchip.h>
-#include <asm/ioc.h>
-#include <asm/io.h>
-#include <asm/system.h>
-
-extern void init_FIQ(void);
-
-#define a_clf()        clf()
-#define a_stf()        stf()
-
-static void arc_ack_irq_a(unsigned int irq)
-{
-       unsigned int val, mask;
-
-       mask = 1 << irq;
-       a_clf();
-       val = ioc_readb(IOC_IRQMASKA);
-       ioc_writeb(val & ~mask, IOC_IRQMASKA);
-       ioc_writeb(mask, IOC_IRQCLRA);
-       a_stf();
-}
-
-static void arc_mask_irq_a(unsigned int irq)
-{
-       unsigned int val, mask;
-
-       mask = 1 << irq;
-       a_clf();
-       val = ioc_readb(IOC_IRQMASKA);
-       ioc_writeb(val & ~mask, IOC_IRQMASKA);
-       a_stf();
-}
-
-static void arc_unmask_irq_a(unsigned int irq)
-{
-       unsigned int val, mask;
-
-       mask = 1 << irq;
-       a_clf();
-       val = ioc_readb(IOC_IRQMASKA);
-       ioc_writeb(val | mask, IOC_IRQMASKA);
-       a_stf();
-}
-
-static struct irqchip arc_a_chip = {
-        .ack    = arc_ack_irq_a,
-        .mask   = arc_mask_irq_a,
-        .unmask = arc_unmask_irq_a,
-};
-
-static void arc_mask_irq_b(unsigned int irq)
-{
-       unsigned int val, mask;
-       mask = 1 << (irq & 7);
-       val = ioc_readb(IOC_IRQMASKB);
-       ioc_writeb(val & ~mask, IOC_IRQMASKB);
-}
-
-static void arc_unmask_irq_b(unsigned int irq)
-{
-       unsigned int val, mask;
-
-       mask = 1 << (irq & 7);
-       val = ioc_readb(IOC_IRQMASKB);
-       ioc_writeb(val | mask, IOC_IRQMASKB);
-}
-
-static struct irqchip arc_b_chip = {
-        .ack    = arc_mask_irq_b,
-        .mask   = arc_mask_irq_b,
-        .unmask = arc_unmask_irq_b,
-};
-
-/* FIXME - JMA none of these functions are used in arm26 currently
-static void arc_mask_irq_fiq(unsigned int irq)
-{
-       unsigned int val, mask;
-
-       mask = 1 << (irq & 7);
-       val = ioc_readb(IOC_FIQMASK);
-       ioc_writeb(val & ~mask, IOC_FIQMASK);
-}
-
-static void arc_unmask_irq_fiq(unsigned int irq)
-{
-       unsigned int val, mask;
-
-       mask = 1 << (irq & 7);
-       val = ioc_readb(IOC_FIQMASK);
-       ioc_writeb(val | mask, IOC_FIQMASK);
-}
-
-static struct irqchip arc_fiq_chip = {
-        .ack    = arc_mask_irq_fiq,
-        .mask   = arc_mask_irq_fiq,
-        .unmask = arc_unmask_irq_fiq,
-};
-*/
-
-void __init arc_init_irq(void)
-{
-       unsigned int irq, flags;
-
-       /* Disable all IOC interrupt sources */
-       ioc_writeb(0, IOC_IRQMASKA);
-       ioc_writeb(0, IOC_IRQMASKB);
-       ioc_writeb(0, IOC_FIQMASK);
-
-       for (irq = 0; irq < NR_IRQS; irq++) {
-               flags = IRQF_VALID;
-               
-               if (irq <= 6 || (irq >= 9 && irq <= 15))
-                        flags |= IRQF_PROBE;
-       
-               if (irq == IRQ_KEYBOARDTX)
-                        flags |= IRQF_NOAUTOEN;        
-               
-               switch (irq) {
-               case 0 ... 7:
-                       set_irq_chip(irq, &arc_a_chip);
-                        set_irq_handler(irq, do_level_IRQ);
-                        set_irq_flags(irq, flags);
-                       break;
-
-               case 8 ... 15:
-                       set_irq_chip(irq, &arc_b_chip);
-                        set_irq_handler(irq, do_level_IRQ);
-                        set_irq_flags(irq, flags);
-
-/*             case 64 ... 72:
-                       set_irq_chip(irq, &arc_fiq_chip);
-                        set_irq_flags(irq, flags);
-                       break;
-*/
-
-               }
-       }
-
-       irq_desc[IRQ_KEYBOARDTX].noautoenable = 1;
-
-       init_FIQ();
-}
-
diff --git a/arch/arm26/machine/latches.c b/arch/arm26/machine/latches.c
deleted file mode 100644 (file)
index 94f05d2..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  linux/arch/arm26/kernel/latches.c
- *
- *  Copyright (C) David Alan Gilbert 1995/1996,2000
- *  Copyright (C) Ian Molton 2003
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Support for the latches on the old Archimedes which control the floppy,
- *  hard disc and printer
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/sched.h>
-
-#include <asm/io.h>
-#include <asm/hardware.h>
-#include <asm/mach-types.h>
-#include <asm/oldlatches.h>
-
-static unsigned char latch_a_copy;
-static unsigned char latch_b_copy;
-
-/* newval=(oldval & ~mask)|newdata */
-void oldlatch_aupdate(unsigned char mask,unsigned char newdata)
-{
-       unsigned long flags;
-
-       BUG_ON(!machine_is_archimedes());
-
-       local_irq_save(flags); //FIXME: was local_save_flags
-       latch_a_copy = (latch_a_copy & ~mask) | newdata;
-       __raw_writeb(latch_a_copy, LATCHA_BASE);
-       local_irq_restore(flags);
-
-       printk("Latch: A = 0x%02x\n", latch_a_copy);
-}
-
-
-/* newval=(oldval & ~mask)|newdata */
-void oldlatch_bupdate(unsigned char mask,unsigned char newdata)
-{
-       unsigned long flags;
-
-       BUG_ON(!machine_is_archimedes());
-
-
-       local_irq_save(flags);//FIXME: was local_save_flags
-       latch_b_copy = (latch_b_copy & ~mask) | newdata;
-       __raw_writeb(latch_b_copy, LATCHB_BASE);
-       local_irq_restore(flags);
-
-       printk("Latch: B = 0x%02x\n", latch_b_copy);
-}
-
-static int __init oldlatch_init(void)
-{
-       if (machine_is_archimedes()) {
-               oldlatch_aupdate(0xff, 0xff);
-               /* Thats no FDC reset...*/
-               oldlatch_bupdate(0xff, LATCHB_FDCRESET);
-       }
-       return 0;
-}
-
-arch_initcall(oldlatch_init);
-
-EXPORT_SYMBOL(oldlatch_aupdate);
-EXPORT_SYMBOL(oldlatch_bupdate);
diff --git a/arch/arm26/mm/Makefile b/arch/arm26/mm/Makefile
deleted file mode 100644 (file)
index a8fb166..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#
-# Makefile for the linux arm26-specific parts of the memory manager.
-#
-
-obj-y          := init.o extable.o proc-funcs.o memc.o fault.o \
-                  small_page.o
diff --git a/arch/arm26/mm/extable.c b/arch/arm26/mm/extable.c
deleted file mode 100644 (file)
index 38e1958..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  linux/arch/arm26/mm/extable.c
- */
-
-#include <linux/module.h>
-#include <asm/uaccess.h>
-
-int fixup_exception(struct pt_regs *regs)
-{
-        const struct exception_table_entry *fixup;
-
-        fixup = search_exception_tables(instruction_pointer(regs));
-
-       /*
-        * The kernel runs in SVC mode - make sure we keep running in SVC mode
-        * by frobbing the PSR appropriately (PSR and PC are in the same reg.
-        * on ARM26)
-        */
-        if (fixup)
-                regs->ARM_pc = fixup->fixup | PSR_I_BIT | MODE_SVC26;
-
-        return fixup != NULL;
-}
-
diff --git a/arch/arm26/mm/fault.c b/arch/arm26/mm/fault.c
deleted file mode 100644 (file)
index dec638a..0000000
+++ /dev/null
@@ -1,312 +0,0 @@
-/*
- *  linux/arch/arm26/mm/fault.c
- *
- *  Copyright (C) 1995  Linus Torvalds
- *  Modifications for ARM processor (c) 1995-2001 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/ptrace.h>
-#include <linux/mman.h>
-#include <linux/mm.h>
-#include <linux/interrupt.h>
-#include <linux/proc_fs.h>
-#include <linux/init.h>
-
-#include <asm/system.h>
-#include <asm/pgtable.h>
-#include <asm/uaccess.h> //FIXME this header may be bogusly included
-
-#include "fault.h"
-
-#define FAULT_CODE_LDRSTRPOST   0x80
-#define FAULT_CODE_LDRSTRPRE    0x40
-#define FAULT_CODE_LDRSTRREG    0x20
-#define FAULT_CODE_LDMSTM       0x10
-#define FAULT_CODE_LDCSTC       0x08
-#define FAULT_CODE_PREFETCH     0x04
-#define FAULT_CODE_WRITE        0x02
-#define FAULT_CODE_FORCECOW     0x01
-
-#define DO_COW(m)               ((m) & (FAULT_CODE_WRITE|FAULT_CODE_FORCECOW))
-#define READ_FAULT(m)           (!((m) & FAULT_CODE_WRITE))
-#define DEBUG
-/*
- * This is useful to dump out the page tables associated with
- * 'addr' in mm 'mm'.
- */
-void show_pte(struct mm_struct *mm, unsigned long addr)
-{
-       pgd_t *pgd;
-
-       if (!mm)
-               mm = &init_mm;
-
-       printk(KERN_ALERT "pgd = %p\n", mm->pgd);
-       pgd = pgd_offset(mm, addr);
-       printk(KERN_ALERT "[%08lx] *pgd=%08lx", addr, pgd_val(*pgd));
-
-       do {
-               pmd_t *pmd;
-               pte_t *pte;
-
-               pmd = pmd_offset(pgd, addr);
-
-               if (pmd_none(*pmd))
-                       break;
-
-               if (pmd_bad(*pmd)) {
-                       printk("(bad)");
-                       break;
-               }
-
-               /* We must not map this if we have highmem enabled */
-               /* FIXME */
-               pte = pte_offset_map(pmd, addr);
-               printk(", *pte=%08lx", pte_val(*pte));
-               pte_unmap(pte);
-       } while(0);
-
-       printk("\n");
-}
-
-/*
- * Oops.  The kernel tried to access some page that wasn't present.
- */
-static void
-__do_kernel_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
-                 struct pt_regs *regs)
-{
-       /*
-         * Are we prepared to handle this kernel fault?
-         */
-        if (fixup_exception(regs))
-                return;
-
-       /*
-        * No handler, we'll have to terminate things with extreme prejudice.
-        */
-       bust_spinlocks(1);
-       printk(KERN_ALERT
-               "Unable to handle kernel %s at virtual address %08lx\n",
-               (addr < PAGE_SIZE) ? "NULL pointer dereference" :
-               "paging request", addr);
-
-       show_pte(mm, addr);
-       die("Oops", regs, fsr);
-       bust_spinlocks(0);
-       do_exit(SIGKILL);
-}
-
-/*
- * Something tried to access memory that isn't in our memory map..
- * User mode accesses just cause a SIGSEGV
- */
-static void
-__do_user_fault(struct task_struct *tsk, unsigned long addr,
-               unsigned int fsr, int code, struct pt_regs *regs)
-{
-       struct siginfo si;
-
-#ifdef CONFIG_DEBUG_USER
-       printk("%s: unhandled page fault at 0x%08lx, code 0x%03x\n",
-              tsk->comm, addr, fsr);
-       show_pte(tsk->mm, addr);
-       show_regs(regs);
-       //dump_backtrace(regs, tsk); // FIXME ARM32 dropped this - why?
-       while(1); //FIXME - hack to stop debug going nutso
-#endif
-
-       tsk->thread.address = addr;
-       tsk->thread.error_code = fsr;
-       tsk->thread.trap_no = 14;
-       si.si_signo = SIGSEGV;
-       si.si_errno = 0;
-       si.si_code = code;
-       si.si_addr = (void *)addr;
-       force_sig_info(SIGSEGV, &si, tsk);
-}
-
-static int
-__do_page_fault(struct mm_struct *mm, unsigned long addr, unsigned int fsr,
-               struct task_struct *tsk)
-{
-       struct vm_area_struct *vma;
-       int fault, mask;
-
-       vma = find_vma(mm, addr);
-       fault = -2; /* bad map area */
-       if (!vma)
-               goto out;
-       if (vma->vm_start > addr)
-               goto check_stack;
-
-       /*
-        * Ok, we have a good vm_area for this
-        * memory access, so we can handle it.
-        */
-good_area:
-       if (READ_FAULT(fsr)) /* read? */
-               mask = VM_READ|VM_EXEC|VM_WRITE;
-       else
-               mask = VM_WRITE;
-
-       fault = -1; /* bad access type */
-       if (!(vma->vm_flags & mask))
-               goto out;
-
-       /*
-        * If for any reason at all we couldn't handle
-        * the fault, make sure we exit gracefully rather
-        * than endlessly redo the fault.
-        */
-survive:
-       fault = handle_mm_fault(mm, vma, addr & PAGE_MASK, DO_COW(fsr));
-       if (unlikely(fault & VM_FAULT_ERROR)) {
-               if (fault & VM_FAULT_OOM)
-                       goto out_of_memory;
-               else if (fault & VM_FAULT_SIGBUS)
-                       return fault;
-               BUG();
-       }
-       if (fault & VM_FAULT_MAJOR)
-               tsk->maj_flt++;
-       else
-               tsk->min_flt++;
-       return fault;
-
-out_of_memory:
-       fault = -3; /* out of memory */
-       if (!is_init(tsk))
-               goto out;
-
-       /*
-        * If we are out of memory for pid1,
-        * sleep for a while and retry
-        */
-       yield();
-       goto survive;
-
-check_stack:
-       if (vma->vm_flags & VM_GROWSDOWN && !expand_stack(vma, addr))
-               goto good_area;
-out:
-       return fault;
-}
-
-int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs)
-{
-       struct task_struct *tsk;
-       struct mm_struct *mm;
-       int fault;
-
-       tsk = current;
-       mm  = tsk->mm;
-
-       /*
-        * If we're in an interrupt or have no user
-        * context, we must not take the fault..
-        */
-       if (in_atomic() || !mm)
-               goto no_context;
-
-       down_read(&mm->mmap_sem);
-       fault = __do_page_fault(mm, addr, fsr, tsk);
-       up_read(&mm->mmap_sem);
-
-       /*
-        * Handle the "normal" case first
-        */
-       if (likely(!(fault & VM_FAULT_ERROR)))
-               return 0;
-       if (fault & VM_FAULT_SIGBUS)
-               goto do_sigbus;
-       /* else VM_FAULT_OOM */
-
-       /*
-        * If we are in kernel mode at this point, we
-        * have no context to handle this fault with.
-         * FIXME - is this test right?
-        */
-       if (!user_mode(regs)){
-               goto no_context;
-       }
-
-       if (fault == -3) {
-               /*
-                * We ran out of memory, or some other thing happened to
-                * us that made us unable to handle the page fault gracefully.
-                */
-               printk("VM: killing process %s\n", tsk->comm);
-               do_exit(SIGKILL);
-       }
-       else{
-               __do_user_fault(tsk, addr, fsr, fault == -1 ? SEGV_ACCERR : SEGV_MAPERR, regs);
-       }
-
-       return 0;
-
-
-/*
- * We ran out of memory, or some other thing happened to us that made
- * us unable to handle the page fault gracefully.
- */
-do_sigbus:
-       /*
-        * Send a sigbus, regardless of whether we were in kernel
-        * or user mode.
-        */
-       tsk->thread.address = addr;  //FIXME - need other bits setting?
-       tsk->thread.error_code = fsr;
-       tsk->thread.trap_no = 14;
-       force_sig(SIGBUS, tsk);
-#ifdef CONFIG_DEBUG_USER
-       printk(KERN_DEBUG "%s: sigbus at 0x%08lx, pc=0x%08lx\n",
-               current->comm, addr, instruction_pointer(regs));
-#endif
-
-       /* Kernel mode? Handle exceptions or die */
-       if (user_mode(regs))
-               return 0;
-
-no_context:
-       __do_kernel_fault(mm, addr, fsr, regs);
-       return 0;
-}
-
-/*
- * Handle a data abort.  Note that we have to handle a range of addresses
- * on ARM2/3 for ldm.  If both pages are zero-mapped, then we have to force
- * a copy-on-write.  However, on the second page, we always force COW.
- */
-asmlinkage void
-do_DataAbort(unsigned long min_addr, unsigned long max_addr, int mode, struct pt_regs *regs)
-{
-        do_page_fault(min_addr, mode, regs);
-
-        if ((min_addr ^ max_addr) >> PAGE_SHIFT){
-               do_page_fault(max_addr, mode | FAULT_CODE_FORCECOW, regs);
-       }
-}
-
-asmlinkage int
-do_PrefetchAbort(unsigned long addr, struct pt_regs *regs)
-{
-#if 0
-        if (the memc mapping for this page exists) {
-                printk ("Page in, but got abort (undefined instruction?)\n");
-                return 0;
-        }
-#endif
-        do_page_fault(addr, FAULT_CODE_PREFETCH, regs);
-        return 1;
-}
-
diff --git a/arch/arm26/mm/fault.h b/arch/arm26/mm/fault.h
deleted file mode 100644 (file)
index 4442d00..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-void show_pte(struct mm_struct *mm, unsigned long addr);
-
-int do_page_fault(unsigned long addr, unsigned int fsr, struct pt_regs *regs);
-
-unsigned long search_extable(unsigned long addr); //FIXME - is it right?
diff --git a/arch/arm26/mm/init.c b/arch/arm26/mm/init.c
deleted file mode 100644 (file)
index 36e7ee3..0000000
+++ /dev/null
@@ -1,403 +0,0 @@
-/*
- *  linux/arch/arm26/mm/init.c
- *
- *  Copyright (C) 1995-2002 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/ptrace.h>
-#include <linux/mman.h>
-#include <linux/mm.h>
-#include <linux/swap.h>
-#include <linux/smp.h>
-#include <linux/init.h>
-#include <linux/initrd.h>
-#include <linux/bootmem.h>
-#include <linux/blkdev.h>
-#include <linux/pfn.h>
-
-#include <asm/segment.h>
-#include <asm/mach-types.h>
-#include <asm/dma.h>
-#include <asm/hardware.h>
-#include <asm/setup.h>
-#include <asm/tlb.h>
-
-#include <asm/map.h>
-
-struct mmu_gather mmu_gathers[NR_CPUS];
-
-extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
-extern char _stext, _text, _etext, _end, __init_begin, __init_end;
-#ifdef CONFIG_XIP_KERNEL
-extern char _endtext, _sdata;
-#endif
-extern unsigned long phys_initrd_start;
-extern unsigned long phys_initrd_size;
-
-/*
- * The sole use of this is to pass memory configuration
- * data from paging_init to mem_init.
- */
-static struct meminfo meminfo __initdata = { 0, };
-
-/*
- * empty_zero_page is a special page that is used for
- * zero-initialized data and COW.
- */
-struct page *empty_zero_page;
-
-void show_mem(void)
-{
-       int free = 0, total = 0, reserved = 0;
-       int shared = 0, cached = 0, slab = 0;
-       struct page *page, *end;
-
-       printk("Mem-info:\n");
-       show_free_areas();
-       printk("Free swap:       %6ldkB\n", nr_swap_pages<<(PAGE_SHIFT-10));
-
-
-       page = NODE_MEM_MAP(0);
-       end  = page + NODE_DATA(0)->node_spanned_pages;
-
-       do {
-               total++;
-               if (PageReserved(page))
-                       reserved++;
-               else if (PageSwapCache(page))
-                       cached++;
-               else if (PageSlab(page))
-                       slab++;
-               else if (!page_count(page))
-                       free++;
-               else
-                       shared += page_count(page) - 1;
-               page++;
-       } while (page < end);
-
-       printk("%d pages of RAM\n", total);
-       printk("%d free pages\n", free);
-       printk("%d reserved pages\n", reserved);
-       printk("%d slab pages\n", slab);
-       printk("%d pages shared\n", shared);
-       printk("%d pages swap cached\n", cached);
-}
-
-struct node_info {
-       unsigned int start;
-       unsigned int end;
-       int bootmap_pages;
-};
-
-/*
- * FIXME: We really want to avoid allocating the bootmap bitmap
- * over the top of the initrd.  Hopefully, this is located towards
- * the start of a bank, so if we allocate the bootmap bitmap at
- * the end, we won't clash.
- */
-static unsigned int __init
-find_bootmap_pfn(struct meminfo *mi, unsigned int bootmap_pages)
-{
-       unsigned int start_pfn, bootmap_pfn;
-       unsigned int start, end;
-
-       start_pfn   = PFN_UP((unsigned long)&_end);
-       bootmap_pfn = 0;
-
-       /* ARM26 machines only have one node */
-       if (mi->bank->node != 0)
-               BUG();
-
-       start = PFN_UP(mi->bank->start);
-       end   = PFN_DOWN(mi->bank->size + mi->bank->start);
-
-       if (start < start_pfn)
-               start = start_pfn;
-
-       if (end <= start)
-               BUG();
-
-       if (end - start >= bootmap_pages) 
-               bootmap_pfn = start;
-       else
-               BUG();
-
-       return bootmap_pfn;
-}
-
-/*
- * Scan the memory info structure and pull out:
- *  - the end of memory
- *  - the number of nodes
- *  - the pfn range of each node
- *  - the number of bootmem bitmap pages
- */
-static void __init
-find_memend_and_nodes(struct meminfo *mi, struct node_info *np)
-{
-       unsigned int memend_pfn = 0;
-
-       nodes_clear(node_online_map);
-       node_set_online(0);
-
-       np->bootmap_pages = 0;
-
-       if (mi->bank->size == 0) {
-               BUG();
-       }
-
-       /*
-        * Get the start and end pfns for this bank
-        */
-       np->start = PFN_UP(mi->bank->start);
-       np->end   = PFN_DOWN(mi->bank->start + mi->bank->size);
-
-       if (memend_pfn < np->end)
-               memend_pfn = np->end;
-
-       /*
-        * Calculate the number of pages we require to
-        * store the bootmem bitmaps.
-        */
-       np->bootmap_pages = bootmem_bootmap_pages(np->end - np->start);
-
-       /*
-        * This doesn't seem to be used by the Linux memory
-        * manager any more.  If we can get rid of it, we
-        * also get rid of some of the stuff above as well.
-        */
-       max_low_pfn = memend_pfn - PFN_DOWN(PHYS_OFFSET);
-       max_pfn = memend_pfn - PFN_DOWN(PHYS_OFFSET);
-       mi->end = memend_pfn << PAGE_SHIFT;
-
-}
-
-/*
- * Initialise the bootmem allocator for all nodes.  This is called
- * early during the architecture specific initialisation.
- */
-void __init bootmem_init(struct meminfo *mi)
-{
-       struct node_info node_info;
-       unsigned int bootmap_pfn;
-       pg_data_t *pgdat = NODE_DATA(0);
-
-       find_memend_and_nodes(mi, &node_info);
-
-       bootmap_pfn   = find_bootmap_pfn(mi, node_info.bootmap_pages);
-
-       /*
-        * Note that node 0 must always have some pages.
-        */
-       if (node_info.end == 0)
-               BUG();
-
-       /*
-        * Initialise the bootmem allocator.
-        */
-       init_bootmem_node(pgdat, bootmap_pfn, node_info.start, node_info.end);
-
-       /*
-        * Register all available RAM in this node with the bootmem allocator. 
-        */
-       free_bootmem_node(pgdat, mi->bank->start, mi->bank->size);
-
-        /*
-         * Register the kernel text and data with bootmem.
-         * Note: with XIP we dont register .text since
-         * its in ROM.
-         */
-#ifdef CONFIG_XIP_KERNEL
-        reserve_bootmem_node(pgdat, __pa(&_sdata), &_end - &_sdata);
-#else
-        reserve_bootmem_node(pgdat, __pa(&_stext), &_end - &_stext);
-#endif
-
-        /*
-         * And don't forget to reserve the allocator bitmap,
-         * which will be freed later.
-         */
-        reserve_bootmem_node(pgdat, bootmap_pfn << PAGE_SHIFT,
-                             node_info.bootmap_pages << PAGE_SHIFT);
-
-        /*
-         * These should likewise go elsewhere.  They pre-reserve
-         * the screen memory region at the start of main system
-         * memory. FIXME - screen RAM is not 512K!
-         */
-        reserve_bootmem_node(pgdat, 0x02000000, 0x00080000);
-
-#ifdef CONFIG_BLK_DEV_INITRD
-        initrd_start = phys_initrd_start;
-        initrd_end = initrd_start + phys_initrd_size;
-
-        /* Achimedes machines only have one node, so initrd is in node 0 */
-#ifdef CONFIG_XIP_KERNEL
-       /* Only reserve initrd space if it is in RAM */
-        if(initrd_start && initrd_start < 0x03000000){
-#else
-        if(initrd_start){
-#endif
-                reserve_bootmem_node(pgdat, __pa(initrd_start),
-                                             initrd_end - initrd_start);
-       }
-#endif   /* CONFIG_BLK_DEV_INITRD */
-
-
-}
-
-/*
- * paging_init() sets up the page tables, initialises the zone memory
- * maps, and sets up the zero page, bad page and bad page tables.
- */
-void __init paging_init(struct meminfo *mi)
-{
-       void *zero_page;
-       unsigned long zone_size[MAX_NR_ZONES];
-        unsigned long zhole_size[MAX_NR_ZONES];
-        struct bootmem_data *bdata;
-        pg_data_t *pgdat;
-       int i;
-
-       memcpy(&meminfo, mi, sizeof(meminfo));
-
-       /*
-        * allocate the zero page.  Note that we count on this going ok.
-        */
-       zero_page = alloc_bootmem_low_pages(PAGE_SIZE);
-
-       /*
-        * initialise the page tables.
-        */
-       memtable_init(mi);
-       flush_tlb_all();
-
-       /*
-        * initialise the zones in node 0 (archimedes have only 1 node)
-        */
-
-       for (i = 0; i < MAX_NR_ZONES; i++) {
-               zone_size[i]  = 0;
-               zhole_size[i] = 0;
-       }
-
-       pgdat = NODE_DATA(0);
-       bdata = pgdat->bdata;
-       zone_size[0] = bdata->node_low_pfn -
-                       (bdata->node_boot_start >> PAGE_SHIFT);
-       if (!zone_size[0])
-               BUG();
-       pgdat->node_mem_map = NULL;
-       free_area_init_node(0, pgdat, zone_size,
-                       bdata->node_boot_start >> PAGE_SHIFT, zhole_size);
-
-       /*
-        * finish off the bad pages once
-        * the mem_map is initialised
-        */
-       memzero(zero_page, PAGE_SIZE);
-       empty_zero_page = virt_to_page(zero_page);
-}
-
-static inline void free_area(unsigned long addr, unsigned long end, char *s)
-{
-       unsigned int size = (end - addr) >> 10;
-
-       for (; addr < end; addr += PAGE_SIZE) {
-               struct page *page = virt_to_page(addr);
-               ClearPageReserved(page);
-               init_page_count(page);
-               free_page(addr);
-               totalram_pages++;
-       }
-
-       if (size && s)
-               printk(KERN_INFO "Freeing %s memory: %dK\n", s, size);
-}
-
-/*
- * mem_init() marks the free areas in the mem_map and tells us how much
- * memory is free.  This is done after various parts of the system have
- * claimed their memory after the kernel image.
- */
-void __init mem_init(void)
-{
-       unsigned int codepages, datapages, initpages;
-       pg_data_t *pgdat = NODE_DATA(0);
-       extern int sysctl_overcommit_memory;
-
-
-       /* Note: data pages includes BSS */
-#ifdef CONFIG_XIP_KERNEL
-       codepages = &_endtext - &_text;
-       datapages = &_end - &_sdata;
-#else
-       codepages = &_etext - &_text;
-       datapages = &_end - &_etext;
-#endif
-       initpages = &__init_end - &__init_begin;
-
-       high_memory = (void *)__va(meminfo.end);
-       max_mapnr   = virt_to_page(high_memory) - mem_map;
-
-       /* this will put all unused low memory onto the freelists */
-       if (pgdat->node_spanned_pages != 0)
-               totalram_pages += free_all_bootmem_node(pgdat);
-
-       num_physpages = meminfo.bank[0].size >> PAGE_SHIFT;
-
-       printk(KERN_INFO "Memory: %luMB total\n", num_physpages >> (20 - PAGE_SHIFT));
-       printk(KERN_NOTICE "Memory: %luKB available (%dK code, "
-               "%dK data, %dK init)\n",
-               (unsigned long) nr_free_pages() << (PAGE_SHIFT-10),
-               codepages >> 10, datapages >> 10, initpages >> 10);
-
-       /*
-        * Turn on overcommit on tiny machines
-        */
-       if (PAGE_SIZE >= 16384 && num_physpages <= 128) {
-               sysctl_overcommit_memory = OVERCOMMIT_ALWAYS;
-               printk("Turning on overcommit\n");
-       }
-}
-
-void free_initmem(void){
-#ifndef CONFIG_XIP_KERNEL
-       free_area((unsigned long)(&__init_begin),
-                 (unsigned long)(&__init_end),
-                 "init");
-#endif
-}
-
-#ifdef CONFIG_BLK_DEV_INITRD
-
-static int keep_initrd;
-
-void free_initrd_mem(unsigned long start, unsigned long end)
-{
-#ifdef CONFIG_XIP_KERNEL
-       /* Only bin initrd if it is in RAM... */
-       if(!keep_initrd && start < 0x03000000)
-#else
-       if (!keep_initrd)
-#endif
-               free_area(start, end, "initrd");
-}
-
-static int __init keepinitrd_setup(char *__unused)
-{
-       keep_initrd = 1;
-       return 1;
-}
-
-__setup("keepinitrd", keepinitrd_setup);
-#endif
diff --git a/arch/arm26/mm/memc.c b/arch/arm26/mm/memc.c
deleted file mode 100644 (file)
index ffecd85..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*
- *  linux/arch/arm26/mm/memc.c
- *
- *  Copyright (C) 1998-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Page table sludge for older ARM processor architectures.
- */
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <linux/init.h>
-#include <linux/bootmem.h>
-
-#include <asm/pgtable.h>
-#include <asm/pgalloc.h>
-#include <asm/page.h>
-#include <asm/memory.h>
-#include <asm/hardware.h>
-
-#include <asm/map.h>
-
-#define MEMC_TABLE_SIZE (256*sizeof(unsigned long))
-
-struct kmem_cache *pte_cache, *pgd_cache;
-int page_nr;
-
-/*
- * Allocate space for a page table and a MEMC table.
- * Note that we place the MEMC
- * table before the page directory.  This means we can
- * easily get to both tightly-associated data structures
- * with a single pointer.
- */
-static inline pgd_t *alloc_pgd_table(void)
-{
-       void *pg2k = kmem_cache_alloc(pgd_cache, GFP_KERNEL);
-
-       if (pg2k)
-               pg2k += MEMC_TABLE_SIZE;
-
-       return (pgd_t *)pg2k;
-}
-
-/*
- * Free a page table. this function is the counterpart to get_pgd_slow
- * below, not alloc_pgd_table above.
- */
-void free_pgd_slow(pgd_t *pgd)
-{
-       unsigned long tbl = (unsigned long)pgd;
-
-       tbl -= MEMC_TABLE_SIZE;
-
-       kmem_cache_free(pgd_cache, (void *)tbl);
-}
-
-/*
- * Allocate a new pgd and fill it in ready for use
- *
- * A new tasks pgd is completely empty (all pages !present) except for:
- *
- * o The machine vectors at virtual address 0x0
- * o The vmalloc region at the top of address space
- *
- */
-#define FIRST_KERNEL_PGD_NR     (FIRST_USER_PGD_NR + USER_PTRS_PER_PGD)
-
-pgd_t *get_pgd_slow(struct mm_struct *mm)
-{
-       pgd_t *new_pgd, *init_pgd;
-       pmd_t *new_pmd, *init_pmd;
-       pte_t *new_pte, *init_pte;
-
-       new_pgd = alloc_pgd_table();
-       if (!new_pgd)
-               goto no_pgd;
-
-       /*
-        * On ARM, first page must always be allocated since it contains
-        * the machine vectors.
-        */
-       new_pmd = pmd_alloc(mm, new_pgd, 0);
-       if (!new_pmd)
-               goto no_pmd;
-
-       new_pte = pte_alloc_map(mm, new_pmd, 0);
-       if (!new_pte)
-               goto no_pte;
-
-       init_pgd = pgd_offset(&init_mm, 0);
-       init_pmd = pmd_offset(init_pgd, 0);
-       init_pte = pte_offset(init_pmd, 0);
-
-       set_pte(new_pte, *init_pte);
-       pte_unmap(new_pte);
-
-       /*
-        * the page table entries are zeroed
-        * when the table is created. (see the cache_ctor functions below)
-        * Now we need to plonk the kernel (vmalloc) area at the end of
-        * the address space. We copy this from the init thread, just like
-        * the init_pte we copied above...
-        */
-       memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
-               (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
-
-       /* update MEMC tables */
-       cpu_memc_update_all(new_pgd);
-       return new_pgd;
-
-no_pte:
-       pmd_free(new_pmd);
-no_pmd:
-       free_pgd_slow(new_pgd);
-no_pgd:
-       return NULL;
-}
-
-/*
- * No special code is required here.
- */
-void setup_mm_for_reboot(char mode)
-{
-}
-
-/*
- * This contains the code to setup the memory map on an ARM2/ARM250/ARM3
- *  o swapper_pg_dir = 0x0207d000
- *  o kernel proper starts at 0x0208000
- *  o create (allocate) a pte to contain the machine vectors
- *  o populate the pte (points to 0x02078000) (FIXME - is it zeroed?)
- *  o populate the init tasks page directory (pgd) with the new pte
- *  o zero the rest of the init tasks pgdir (FIXME - what about vmalloc?!)
- */
-void __init memtable_init(struct meminfo *mi)
-{
-       pte_t *pte;
-       int i;
-
-       page_nr = max_low_pfn;
-
-       pte = alloc_bootmem_low_pages(PTRS_PER_PTE * sizeof(pte_t));
-       pte[0] = mk_pte_phys(PAGE_OFFSET + SCREEN_SIZE, PAGE_READONLY);
-       pmd_populate(&init_mm, pmd_offset(swapper_pg_dir, 0), pte);
-
-       for (i = 1; i < PTRS_PER_PGD; i++)
-               pgd_val(swapper_pg_dir[i]) = 0;
-}
-
-void __init iotable_init(struct map_desc *io_desc)
-{
-       /* nothing to do */
-}
-
-/*
- * We never have holes in the memmap
- */
-void __init create_memmap_holes(struct meminfo *mi)
-{
-}
-
-static void pte_cache_ctor(void *pte, struct kmem_cache *cache, unsigned long flags)
-{
-       memzero(pte, sizeof(pte_t) * PTRS_PER_PTE);
-}
-
-static void pgd_cache_ctor(void *pgd, struct kmem_cache *cache, unsigned long flags)
-{
-       memzero(pgd + MEMC_TABLE_SIZE, USER_PTRS_PER_PGD * sizeof(pgd_t));
-}
-
-void __init pgtable_cache_init(void)
-{
-       pte_cache = kmem_cache_create("pte-cache",
-                               sizeof(pte_t) * PTRS_PER_PTE,
-                               0, SLAB_PANIC, pte_cache_ctor);
-
-       pgd_cache = kmem_cache_create("pgd-cache", MEMC_TABLE_SIZE +
-                               sizeof(pgd_t) * PTRS_PER_PGD,
-                               0, SLAB_PANIC, pgd_cache_ctor);
-}
diff --git a/arch/arm26/mm/proc-funcs.S b/arch/arm26/mm/proc-funcs.S
deleted file mode 100644 (file)
index f9fca52..0000000
+++ /dev/null
@@ -1,359 +0,0 @@
-/*
- *  linux/arch/arm26/mm/proc-arm2,3.S
- *
- *  Copyright (C) 1997-1999 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  MMU functions for ARM2,3
- *
- *  These are the low level assembler for performing cache
- *  and memory functions on ARM2, ARM250 and ARM3 processors.
- */
-#include <linux/linkage.h>
-#include <asm/assembler.h>
-#include <asm/asm-offsets.h>
-#include <asm/procinfo.h>
-#include <asm/ptrace.h>
-
-/*
- * MEMC workhorse code.  It's both a horse which things it's a pig.
- */
-/*
- * Function: cpu_memc_update_entry(pgd_t *pgd, unsigned long phys_pte, unsigned long addr)
- * Params  : pgd       Page tables/MEMC mapping
- *         : phys_pte  physical address, or PTE
- *         : addr      virtual address
- */
-ENTRY(cpu_memc_update_entry)
-               tst     r1, #PAGE_PRESENT               @ is the page present
-               orreq   r1, r1, #PAGE_OLD | PAGE_CLEAN
-               moveq   r2, #0x01f00000
-               mov     r3, r1, lsr #13                 @ convert to physical page nr
-               and     r3, r3, #0x3fc
-               adr     ip, memc_phys_table_32
-               ldr     r3, [ip, r3]
-               tst     r1, #PAGE_OLD | PAGE_NOT_USER
-               biceq   r3, r3, #0x200
-               tsteq   r1, #PAGE_READONLY | PAGE_CLEAN
-               biceq   r3, r3, #0x300
-               mov     r2, r2, lsr #15                 @ virtual -> nr
-               orr     r3, r3, r2, lsl #15
-               and     r2, r2, #0x300
-               orr     r3, r3, r2, lsl #2
-               and     r2, r3, #255
-               sub     r0, r0, #256 * 4
-               str     r3, [r0, r2, lsl #2]
-               strb    r3, [r3]
-               movs    pc, lr
-/*
- * Params  : r0 = preserved
- *         : r1 = memc table base (preserved)
- *         : r2 = page table entry
- *         : r3 = preserved
- *         : r4 = unused
- *         : r5 = memc physical address translation table
- *         : ip = virtual address (preserved)
- */
-update_pte:
-               mov     r4, r2, lsr #13
-               and     r4, r4, #0x3fc
-               ldr     r4, [r5, r4]                    @ covert to MEMC page
-
-               tst     r2, #PAGE_OLD | PAGE_NOT_USER   @ check for MEMC read
-               biceq   r4, r4, #0x200
-               tsteq   r2, #PAGE_READONLY | PAGE_CLEAN @ check for MEMC write
-               biceq   r4, r4, #0x300
-
-               orr     r4, r4, ip
-               and     r2, ip, #0x01800000
-               orr     r4, r4, r2, lsr #13
-
-               and     r2, r4, #255
-               str     r4, [r1, r2, lsl #2]
-               movs    pc, lr
-
-/*
- * Params  : r0 = preserved
- *         : r1 = memc table base (preserved)
- *         : r2 = page table base
- *         : r3 = preserved
- *         : r4 = unused
- *         : r5 = memc physical address translation table
- *         : ip = virtual address (updated)
- */
-update_pte_table:
-               stmfd   sp!, {r0, lr}
-               bic     r0, r2, #3
-1:             ldr     r2, [r0], #4                    @ get entry
-               tst     r2, #PAGE_PRESENT               @ page present
-               blne    update_pte                      @ process pte
-               add     ip, ip, #32768                  @ increment virt addr
-               ldr     r2, [r0], #4                    @ get entry
-               tst     r2, #PAGE_PRESENT               @ page present
-               blne    update_pte                      @ process pte
-               add     ip, ip, #32768                  @ increment virt addr
-               ldr     r2, [r0], #4                    @ get entry
-               tst     r2, #PAGE_PRESENT               @ page present
-               blne    update_pte                      @ process pte
-               add     ip, ip, #32768                  @ increment virt addr
-               ldr     r2, [r0], #4                    @ get entry
-               tst     r2, #PAGE_PRESENT               @ page present
-               blne    update_pte                      @ process pte
-               add     ip, ip, #32768                  @ increment virt addr
-               tst     ip, #32768 * 31                 @ finished?
-               bne     1b
-               ldmfd   sp!, {r0, pc}^
-
-/*
- * Function: cpu_memc_update_all(pgd_t *pgd)
- * Params  : pgd       Page tables/MEMC mapping
- * Notes   : this is optimised for 32k pages
- */
-ENTRY(cpu_memc_update_all)
-               stmfd   sp!, {r4, r5, lr}
-               bl      clear_tables
-               sub     r1, r0, #256 * 4                @ start of MEMC tables
-               adr     r5, memc_phys_table_32          @ Convert to logical page number
-               mov     ip, #0                          @ virtual address
-1:             ldmia   r0!, {r2, r3}                   @ load two pgd entries
-               tst     r2, #PAGE_PRESENT               @ is pgd entry present?
-               addeq   ip, ip, #1048576        @FIXME - PAGE_PRESENT is for PTEs technically...
-               blne    update_pte_table
-               mov     r2, r3
-               tst     r2, #PAGE_PRESENT               @ is pgd entry present?
-               addeq   ip, ip, #1048576
-               blne    update_pte_table
-               teq     ip, #32 * 1048576
-               bne     1b
-               ldmfd   sp!, {r4, r5, pc}^
-
-/*
- * Build the table to map from physical page number to memc page number
- */
-               .type   memc_phys_table_32, #object
-memc_phys_table_32:
-               .irp    b7, 0x00, 0x80
-               .irp    b6, 0x00, 0x02
-               .irp    b5, 0x00, 0x04
-               .irp    b4, 0x00, 0x01
-
-               .irp    b3, 0x00, 0x40
-               .irp    b2, 0x00, 0x20
-               .irp    b1, 0x00, 0x10
-               .irp    b0, 0x00, 0x08
-               .long   0x03800300 + \b7 + \b6 + \b5 + \b4 + \b3 + \b2 + \b1 + \b0
-               .endr
-               .endr
-               .endr
-               .endr
-
-               .endr
-               .endr
-               .endr
-               .endr
-               .size   memc_phys_table_32, . - memc_phys_table_32
-
-/*
- * helper for cpu_memc_update_all, this clears out all
- * mappings, setting them close to the top of memory,
- * and inaccessible (0x01f00000).
- * Params  : r0 = page table pointer
- */
-clear_tables:  ldr     r1, _arm3_set_pgd - 4
-               ldr     r2, [r1]
-               sub     r1, r0, #256 * 4                @ start of MEMC tables
-               add     r2, r1, r2, lsl #2              @ end of tables
-               mov     r3, #0x03f00000                 @ Default mapping (null mapping)
-               orr     r3, r3, #0x00000f00
-               orr     r4, r3, #1
-               orr     r5, r3, #2
-               orr     ip, r3, #3
-1:             stmia   r1!, {r3, r4, r5, ip}
-               add     r3, r3, #4
-               add     r4, r4, #4
-               add     r5, r5, #4
-               add     ip, ip, #4
-               stmia   r1!, {r3, r4, r5, ip}
-               add     r3, r3, #4
-               add     r4, r4, #4
-               add     r5, r5, #4
-               add     ip, ip, #4
-               teq     r1, r2
-               bne     1b
-               mov     pc, lr
-
-/*
- * Function: *_set_pgd(pgd_t *pgd)
- * Params  : pgd       New page tables/MEMC mapping
- * Purpose : update MEMC hardware with new mapping
- */
-               .word   page_nr   @ extern - declared in mm-memc.c
-_arm3_set_pgd: mcr     p15, 0, r1, c1, c0, 0           @ flush cache
-_arm2_set_pgd: stmfd   sp!, {lr}
-               ldr     r1, _arm3_set_pgd - 4
-               ldr     r2, [r1]
-               sub     r0, r0, #256 * 4                @ start of MEMC tables
-               add     r1, r0, r2, lsl #2              @ end of tables
-1:             ldmia   r0!, {r2, r3, ip, lr}
-               strb    r2, [r2]
-               strb    r3, [r3]
-               strb    ip, [ip]
-               strb    lr, [lr]
-               ldmia   r0!, {r2, r3, ip, lr}
-               strb    r2, [r2]
-               strb    r3, [r3]
-               strb    ip, [ip]
-               strb    lr, [lr]
-               teq     r0, r1
-               bne     1b
-               ldmfd   sp!, {pc}^
-
-/*
- * Function: *_proc_init (void)
- * Purpose : Initialise the cache control registers
- */
-_arm3_proc_init:
-               mov     r0, #0x001f0000
-               orr     r0, r0, #0x0000ff00
-               orr     r0, r0, #0x000000ff
-               mcr     p15, 0, r0, c3, c0              @ ARM3 Cacheable
-               mcr     p15, 0, r0, c4, c0              @ ARM3 Updateable
-               mov     r0, #0
-               mcr     p15, 0, r0, c5, c0              @ ARM3 Disruptive
-               mcr     p15, 0, r0, c1, c0              @ ARM3 Flush
-               mov     r0, #3
-               mcr     p15, 0, r0, c2, c0              @ ARM3 Control
-_arm2_proc_init:
-               movs    pc, lr
-
-/*
- * Function: *_proc_fin (void)
- * Purpose : Finalise processor (disable caches)
- */
-_arm3_proc_fin:        mov     r0, #2
-               mcr     p15, 0, r0, c2, c0
-_arm2_proc_fin:        orrs    pc, lr, #PSR_I_BIT|PSR_F_BIT
-
-/*
- * Function: *_xchg_1 (int new, volatile void *ptr)
- * Params  : new       New value to store at...
- *        : ptr        pointer to byte-wide location
- * Purpose : Performs an exchange operation
- * Returns : Original byte data at 'ptr'
- */
-_arm2_xchg_1:  mov     r2, pc
-               orr     r2, r2, #PSR_I_BIT
-               teqp    r2, #0
-               ldrb    r2, [r1]
-               strb    r0, [r1]
-               mov     r0, r2
-               movs    pc, lr
-
-_arm3_xchg_1:  swpb    r0, r0, [r1]
-               movs    pc, lr
-
-/*
- * Function: *_xchg_4 (int new, volatile void *ptr)
- * Params  : new       New value to store at...
- *        : ptr        pointer to word-wide location
- * Purpose : Performs an exchange operation
- * Returns : Original word data at 'ptr'
- */
-_arm2_xchg_4:  mov     r2, pc
-               orr     r2, r2, #PSR_I_BIT
-               teqp    r2, #0
-               ldr     r2, [r1]
-               str     r0, [r1]
-               mov     r0, r2
-               movs    pc, lr
-
-_arm3_xchg_4:  swp     r0, r0, [r1]
-               movs    pc, lr
-
-_arm2_3_check_bugs:
-               bics    pc, lr, #PSR_F_BIT              @ Clear FIQ disable bit
-
-armvlsi_name:  .asciz  "ARM/VLSI"
-_arm2_name:    .asciz  "ARM 2"
-_arm250_name:  .asciz  "ARM 250"
-_arm3_name:    .asciz  "ARM 3"
-
-               .section ".init.text", #alloc, #execinstr
-/*
- * Purpose : Function pointers used to access above functions - all calls
- *          come through these
- */
-               .globl  arm2_processor_functions
-arm2_processor_functions:
-               .word   _arm2_3_check_bugs
-               .word   _arm2_proc_init
-               .word   _arm2_proc_fin
-               .word   _arm2_set_pgd
-               .word   _arm2_xchg_1
-               .word   _arm2_xchg_4
-
-cpu_arm2_info:
-               .long   armvlsi_name
-               .long   _arm2_name
-
-               .globl  arm250_processor_functions
-arm250_processor_functions:
-               .word   _arm2_3_check_bugs
-               .word   _arm2_proc_init
-               .word   _arm2_proc_fin
-               .word   _arm2_set_pgd
-               .word   _arm3_xchg_1
-               .word   _arm3_xchg_4
-
-cpu_arm250_info:
-               .long   armvlsi_name
-               .long   _arm250_name
-
-               .globl  arm3_processor_functions
-arm3_processor_functions:
-               .word   _arm2_3_check_bugs
-               .word   _arm3_proc_init
-               .word   _arm3_proc_fin
-               .word   _arm3_set_pgd
-               .word   _arm3_xchg_1
-               .word   _arm3_xchg_4
-
-cpu_arm3_info:
-               .long   armvlsi_name
-               .long   _arm3_name
-
-arm2_arch_name:        .asciz  "armv1"
-arm3_arch_name:        .asciz  "armv2"
-arm2_elf_name: .asciz  "v1"
-arm3_elf_name: .asciz  "v2"
-               .align
-
-               .section ".proc.info", #alloc, #execinstr
-
-               .long   0x41560200
-               .long   0xfffffff0
-               .long   arm2_arch_name
-               .long   arm2_elf_name
-               .long   0
-               .long   cpu_arm2_info
-               .long   arm2_processor_functions
-
-               .long   0x41560250
-               .long   0xfffffff0
-               .long   arm3_arch_name
-               .long   arm3_elf_name
-               .long   0
-               .long   cpu_arm250_info
-               .long   arm250_processor_functions
-
-               .long   0x41560300
-               .long   0xfffffff0
-               .long   arm3_arch_name
-               .long   arm3_elf_name
-               .long   0
-               .long   cpu_arm3_info
-               .long   arm3_processor_functions
-
diff --git a/arch/arm26/mm/small_page.c b/arch/arm26/mm/small_page.c
deleted file mode 100644 (file)
index 3044710..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-/*
- *  linux/arch/arm26/mm/small_page.c
- *
- *  Copyright (C) 1996  Russell King
- *  Copyright (C) 2003  Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Changelog:
- *   26/01/1996        RMK     Cleaned up various areas to make little more generic
- *   07/02/1999        RMK     Support added for 16K and 32K page sizes
- *                     containing 8K blocks
- *   23/05/2004 IM     Fixed to use struct page->lru (thanks wli)
- *
- */
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/ptrace.h>
-#include <linux/mman.h>
-#include <linux/mm.h>
-#include <linux/swap.h>
-#include <linux/smp.h>
-#include <linux/bitops.h>
-
-#include <asm/pgtable.h>
-
-#define PEDANTIC
-
-/*
- * Requirement:
- *  We need to be able to allocate naturally aligned memory of finer
- *  granularity than the page size.  This is typically used for the
- *  second level page tables on 32-bit ARMs.
- *
- * FIXME - this comment is *out of date*
- * Theory:
- *  We "misuse" the Linux memory management system.  We use alloc_page
- *  to allocate a page and then mark it as reserved.  The Linux memory
- *  management system will then ignore the "offset", "next_hash" and
- *  "pprev_hash" entries in the mem_map for this page.
- *
- *  We then use a bitstring in the "offset" field to mark which segments
- *  of the page are in use, and manipulate this as required during the
- *  allocation and freeing of these small pages.
- *
- *  We also maintain a queue of pages being used for this purpose using
- *  the "next_hash" and "pprev_hash" entries of mem_map;
- */
-
-struct order {
-       struct list_head queue;
-       unsigned int mask;              /* (1 << shift) - 1             */
-       unsigned int shift;             /* (1 << shift) size of page    */
-       unsigned int block_mask;        /* nr_blocks - 1                */
-       unsigned int all_used;          /* (1 << nr_blocks) - 1         */
-};
-
-
-static struct order orders[] = {
-#if PAGE_SIZE == 32768
-       { LIST_HEAD_INIT(orders[0].queue), 2047, 11, 15, 0x0000ffff },
-       { LIST_HEAD_INIT(orders[1].queue), 8191, 13,  3, 0x0000000f }
-#else
-#error unsupported page size (ARGH!)
-#endif
-};
-
-#define USED_MAP(pg)                   ((pg)->index)
-#define TEST_AND_CLEAR_USED(pg,off)    (test_and_clear_bit(off, &USED_MAP(pg)))
-#define SET_USED(pg,off)               (set_bit(off, &USED_MAP(pg)))
-
-static DEFINE_SPINLOCK(small_page_lock);
-
-static unsigned long __get_small_page(int priority, struct order *order)
-{
-       unsigned long flags;
-       struct page *page;
-       int offset;
-
-       do {
-               spin_lock_irqsave(&small_page_lock, flags);
-
-               if (list_empty(&order->queue))
-                       goto need_new_page;
-
-               page = list_entry(order->queue.next, struct page, lru);
-again:
-#ifdef PEDANTIC
-               BUG_ON(USED_MAP(page) & ~order->all_used);
-#endif
-               offset = ffz(USED_MAP(page));
-               SET_USED(page, offset);
-               if (USED_MAP(page) == order->all_used)
-                       list_del_init(&page->lru);
-               spin_unlock_irqrestore(&small_page_lock, flags);
-
-               return (unsigned long) page_address(page) + (offset << order->shift);
-
-need_new_page:
-               spin_unlock_irqrestore(&small_page_lock, flags);
-               page = alloc_page(priority);
-               spin_lock_irqsave(&small_page_lock, flags);
-
-               if (list_empty(&order->queue)) {
-                       if (!page)
-                               goto no_page;
-                       SetPageReserved(page);
-                       USED_MAP(page) = 0;
-                       list_add(&page->lru, &order->queue);
-                       goto again;
-               }
-
-               spin_unlock_irqrestore(&small_page_lock, flags);
-               __free_page(page);
-       } while (1);
-
-no_page:
-       spin_unlock_irqrestore(&small_page_lock, flags);
-       return 0;
-}
-
-static void __free_small_page(unsigned long spage, struct order *order)
-{
-       unsigned long flags;
-       struct page *page;
-
-       if (virt_addr_valid(spage)) {
-               page = virt_to_page(spage);
-
-               /*
-                * The container-page must be marked Reserved
-                */
-               if (!PageReserved(page) || spage & order->mask)
-                       goto non_small;
-
-#ifdef PEDANTIC
-               BUG_ON(USED_MAP(page) & ~order->all_used);
-#endif
-
-               spage = spage >> order->shift;
-               spage &= order->block_mask;
-
-               /*
-                * the following must be atomic wrt get_page
-                */
-               spin_lock_irqsave(&small_page_lock, flags);
-
-               if (USED_MAP(page) == order->all_used)
-                       list_add(&page->lru, &order->queue);
-
-               if (!TEST_AND_CLEAR_USED(page, spage))
-                       goto already_free;
-
-               if (USED_MAP(page) == 0)
-                       goto free_page;
-
-               spin_unlock_irqrestore(&small_page_lock, flags);
-       }
-       return;
-
-free_page:
-       /*
-        * unlink the page from the small page queue and free it
-        */
-       list_del_init(&page->lru);
-       spin_unlock_irqrestore(&small_page_lock, flags);
-       ClearPageReserved(page);
-       __free_page(page);
-       return;
-
-non_small:
-       printk("Trying to free non-small page from %p\n", __builtin_return_address(0));
-       return;
-already_free:
-       printk("Trying to free free small page from %p\n", __builtin_return_address(0));
-}
-
-unsigned long get_page_8k(int priority)
-{
-       return __get_small_page(priority, orders+1);
-}
-
-void free_page_8k(unsigned long spage)
-{
-       __free_small_page(spage, orders+1);
-}
diff --git a/arch/arm26/nwfpe/ARM-gcc.h b/arch/arm26/nwfpe/ARM-gcc.h
deleted file mode 100644 (file)
index e659847..0000000
+++ /dev/null
@@ -1,120 +0,0 @@
-/*
--------------------------------------------------------------------------------
-The macro `BITS64' can be defined to indicate that 64-bit integer types are
-supported by the compiler.
--------------------------------------------------------------------------------
-*/
-#define BITS64
-
-/*
--------------------------------------------------------------------------------
-Each of the following `typedef's defines the most convenient type that holds
-integers of at least as many bits as specified.  For example, `uint8' should
-be the most convenient type that can hold unsigned integers of as many as
-8 bits.  The `flag' type must be able to hold either a 0 or 1.  For most
-implementations of C, `flag', `uint8', and `int8' should all be `typedef'ed
-to the same as `int'.
--------------------------------------------------------------------------------
-*/
-typedef char flag;
-typedef unsigned char uint8;
-typedef signed char int8;
-typedef int uint16;
-typedef int int16;
-typedef unsigned int uint32;
-typedef signed int int32;
-#ifdef BITS64
-typedef unsigned long long int bits64;
-typedef signed long long int sbits64;
-#endif
-
-/*
--------------------------------------------------------------------------------
-Each of the following `typedef's defines a type that holds integers
-of _exactly_ the number of bits specified.  For instance, for most
-implementation of C, `bits16' and `sbits16' should be `typedef'ed to
-`unsigned short int' and `signed short int' (or `short int'), respectively.
--------------------------------------------------------------------------------
-*/
-typedef unsigned char bits8;
-typedef signed char sbits8;
-typedef unsigned short int bits16;
-typedef signed short int sbits16;
-typedef unsigned int bits32;
-typedef signed int sbits32;
-#ifdef BITS64
-typedef unsigned long long int uint64;
-typedef signed long long int int64;
-#endif
-
-#ifdef BITS64
-/*
--------------------------------------------------------------------------------
-The `LIT64' macro takes as its argument a textual integer literal and if
-necessary ``marks'' the literal as having a 64-bit integer type.  For
-example, the Gnu C Compiler (`gcc') requires that 64-bit literals be
-appended with the letters `LL' standing for `long long', which is `gcc's
-name for the 64-bit integer type.  Some compilers may allow `LIT64' to be
-defined as the identity macro:  `#define LIT64( a ) a'.
--------------------------------------------------------------------------------
-*/
-#define LIT64( a ) a##LL
-#endif
-
-/*
--------------------------------------------------------------------------------
-The macro `INLINE' can be used before functions that should be inlined.  If
-a compiler does not support explicit inlining, this macro should be defined
-to be `static'.
--------------------------------------------------------------------------------
-*/
-#define INLINE extern __inline__
-
-
-/* For use as a GCC soft-float library we need some special function names. */
-
-#ifdef __LIBFLOAT__
-
-/* Some 32-bit ops can be mapped straight across by just changing the name. */
-#define float32_add                    __addsf3
-#define float32_sub                    __subsf3
-#define float32_mul                    __mulsf3
-#define float32_div                    __divsf3
-#define int32_to_float32               __floatsisf
-#define float32_to_int32_round_to_zero __fixsfsi
-#define float32_to_uint32_round_to_zero        __fixunssfsi
-
-/* These ones go through the glue code.  To avoid namespace pollution
-   we rename the internal functions too.  */
-#define float32_eq                     ___float32_eq
-#define float32_le                     ___float32_le
-#define float32_lt                     ___float32_lt
-
-/* All the 64-bit ops have to go through the glue, so we pull the same
-   trick.  */
-#define float64_add                    ___float64_add
-#define float64_sub                    ___float64_sub
-#define float64_mul                    ___float64_mul
-#define float64_div                    ___float64_div
-#define int32_to_float64               ___int32_to_float64
-#define float64_to_int32_round_to_zero ___float64_to_int32_round_to_zero
-#define float64_to_uint32_round_to_zero        ___float64_to_uint32_round_to_zero
-#define float64_to_float32             ___float64_to_float32
-#define float32_to_float64             ___float32_to_float64
-#define float64_eq                     ___float64_eq
-#define float64_le                     ___float64_le
-#define float64_lt                     ___float64_lt
-
-#if 0
-#define float64_add                    __adddf3
-#define float64_sub                    __subdf3
-#define float64_mul                    __muldf3
-#define float64_div                    __divdf3
-#define int32_to_float64               __floatsidf
-#define float64_to_int32_round_to_zero __fixdfsi
-#define float64_to_uint32_round_to_zero        __fixunsdfsi
-#define float64_to_float32             __truncdfsf2
-#define float32_to_float64             __extendsfdf2
-#endif
-
-#endif
diff --git a/arch/arm26/nwfpe/ChangeLog b/arch/arm26/nwfpe/ChangeLog
deleted file mode 100644 (file)
index 0c580f7..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-2002-01-19  Russell King <rmk@arm.linux.org.uk>
-
-       * fpa11.h - Add documentation
-                 - remove userRegisters pointer from this structure.
-                 - add new method to obtain integer register values.
-       * softfloat.c - Remove float128
-       * softfloat.h - Remove float128
-       * softfloat-specialize - Remove float128
-
-       * The FPA11 structure is not a kernel-specific data structure.
-         It is used by users of ptrace to examine the values of the
-         floating point registers.  Therefore, any changes to the
-         FPA11 structure (size or position of elements contained
-         within) have to be well thought out.
-
-       * Since 128-bit float requires the FPA11 structure to change
-         size, it has been removed.  128-bit float is currently unused,
-         and needs various things to be re-worked so that we won't
-         overflow the available space in the task structure.
-
-       * The changes are designed to break any patch that goes on top
-         of this code, so that the authors properly review their changes.
-
-1999-08-19  Scott Bambrough  <scottb@netwinder.org>
-
-       * fpmodule.c - Changed version number to 0.95
-       * fpa11.h - modified FPA11, FPREG structures
-       * fpa11.c - Changes due to FPA11, FPREG structure alterations.
-       * fpa11_cpdo.c - Changes due to FPA11, FPREG structure alterations.
-       * fpa11_cpdt.c - Changes due to FPA11, FPREG structure alterations.
-       * fpa11_cprt.c - Changes due to FPA11, FPREG structure alterations.
-       * single_cpdo.c - Changes due to FPA11, FPREG structure alterations.
-       * double_cpdo.c - Changes due to FPA11, FPREG structure alterations.
-       * extended_cpdo.c - Changes due to FPA11, FPREG structure alterations.
-
-       * I discovered several bugs.  First and worst is that the kernel
-         passes in a pointer to the FPE's state area.  This is defined
-         as a struct user_fp (see user.h).  This pointer was cast to a
-         FPA11*.  Unfortunately FPA11 and user_fp are of different sizes;
-         user_fp is smaller.  This meant that the FPE scribbled on things
-         below its area, which is bad, as the area is in the thread_struct
-         embedded in the process task structure.  Thus we were scribbling
-         over one of the most important structures in the entire OS.
-
-       * user_fp and FPA11 have now been harmonized.  Most of the changes
-         in the above code were dereferencing problems due to moving the
-         register type out of FPREG, and getting rid of the union variable
-         fpvalue.
-
-       * Second I noticed resetFPA11 was not always being called for a
-         task.  This should happen on the first floating point exception
-         that occurs.  It is controlled by init_flag in FPA11.  The
-         comment in the code beside init_flag state the kernel guarantees
-         this to be zero.  Not so.  I found that the kernel recycles task
-         structures, and that recycled ones may not have init_flag zeroed.
-         I couldn't even find anything that guarantees it is zeroed when
-         when the task structure is initially allocated.  In any case
-         I now initialize the entire FPE state in the thread structure to
-         zero when allocated and recycled.  See alloc_task_struct() and
-         flush_thread() in arch/arm/process.c.  The change to
-         alloc_task_struct() may not be necessary, but I left it in for
-         completeness (better safe than sorry).
-
-1998-11-23  Scott Bambrough  <scottb@netwinder.org>
-
-       * README.FPE - fix typo in description of lfm/sfm instructions
-       * NOTES - Added file to describe known bugs/problems 
-       * fpmodule.c - Changed version number to 0.94
-
-1998-11-20  Scott Bambrough  <scottb@netwinder.org>
-
-       * README.FPE - fix description of URD, NRM instructions
-       * TODO - remove URD, NRM instructions from TODO list
-       * single_cpdo.c - implement URD, NRM
-       * double_cpdo.c - implement URD, NRM
-       * extended_cpdo.c - implement URD, NRM
-
-1998-11-19  Scott Bambrough  <scottb@netwinder.org>
-
-       * ChangeLog - Added this file to track changes made.
-       * fpa11.c - added code to initialize register types to typeNone
-       * fpa11_cpdt.c - fixed bug in storeExtended (typeExtended changed to
-         typeDouble in switch statement)
diff --git a/arch/arm26/nwfpe/Makefile b/arch/arm26/nwfpe/Makefile
deleted file mode 100644 (file)
index b39d34d..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#
-# Copyright (C) 1998, 1999, 2001 Philip Blundell
-#
-
-obj-y                  :=
-obj-m                  :=
-obj-n                  :=
-
-obj-$(CONFIG_FPE_NWFPE)        += nwfpe.o
-
-nwfpe-objs             := fpa11.o fpa11_cpdo.o fpa11_cpdt.o fpa11_cprt.o \
-                          fpmodule.o fpopcode.o softfloat.o \
-                          single_cpdo.o double_cpdo.o extended_cpdo.o \
-                          entry.o
-
diff --git a/arch/arm26/nwfpe/double_cpdo.c b/arch/arm26/nwfpe/double_cpdo.c
deleted file mode 100644 (file)
index 7f4fef0..0000000
+++ /dev/null
@@ -1,288 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "softfloat.h"
-#include "fpopcode.h"
-
-float64 float64_exp(float64 Fm);
-float64 float64_ln(float64 Fm);
-float64 float64_sin(float64 rFm);
-float64 float64_cos(float64 rFm);
-float64 float64_arcsin(float64 rFm);
-float64 float64_arctan(float64 rFm);
-float64 float64_log(float64 rFm);
-float64 float64_tan(float64 rFm);
-float64 float64_arccos(float64 rFm);
-float64 float64_pow(float64 rFn,float64 rFm);
-float64 float64_pol(float64 rFn,float64 rFm);
-
-unsigned int DoubleCPDO(const unsigned int opcode)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   float64 rFm, rFn = 0; //FIXME - should be zero?
-   unsigned int Fd, Fm, Fn, nRc = 1;
-
-   //printk("DoubleCPDO(0x%08x)\n",opcode);
-   
-   Fm = getFm(opcode);
-   if (CONSTANT_FM(opcode))
-   {
-     rFm = getDoubleConstant(Fm);
-   }
-   else
-   {  
-     switch (fpa11->fType[Fm])
-     {
-        case typeSingle:
-          rFm = float32_to_float64(fpa11->fpreg[Fm].fSingle);
-        break;
-
-        case typeDouble:
-          rFm = fpa11->fpreg[Fm].fDouble;
-          break;
-
-        case typeExtended:
-            // !! patb
-           //printk("not implemented! why not?\n");
-            //!! ScottB
-            // should never get here, if extended involved
-            // then other operand should be promoted then
-            // ExtendedCPDO called.
-            break;
-
-        default: return 0;
-     }
-   }
-
-   if (!MONADIC_INSTRUCTION(opcode))
-   {
-      Fn = getFn(opcode);
-      switch (fpa11->fType[Fn])
-      {
-        case typeSingle:
-          rFn = float32_to_float64(fpa11->fpreg[Fn].fSingle);
-        break;
-
-        case typeDouble:
-          rFn = fpa11->fpreg[Fn].fDouble;
-        break;
-        
-        default: return 0;
-      }
-   }
-
-   Fd = getFd(opcode);
-   /* !! this switch isn't optimized; better (opcode & MASK_ARITHMETIC_OPCODE)>>24, sort of */
-   switch (opcode & MASK_ARITHMETIC_OPCODE)
-   {
-      /* dyadic opcodes */
-      case ADF_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_add(rFn,rFm);
-      break;
-
-      case MUF_CODE:
-      case FML_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_mul(rFn,rFm);
-      break;
-
-      case SUF_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_sub(rFn,rFm);
-      break;
-
-      case RSF_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_sub(rFm,rFn);
-      break;
-
-      case DVF_CODE:
-      case FDV_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_div(rFn,rFm);
-      break;
-
-      case RDF_CODE:
-      case FRD_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_div(rFm,rFn);
-      break;
-
-#if 0
-      case POW_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_pow(rFn,rFm);
-      break;
-
-      case RPW_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_pow(rFm,rFn);
-      break;
-#endif
-
-      case RMF_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_rem(rFn,rFm);
-      break;
-
-#if 0
-      case POL_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_pol(rFn,rFm);
-      break;
-#endif
-
-      /* monadic opcodes */
-      case MVF_CODE:
-         fpa11->fpreg[Fd].fDouble = rFm;
-      break;
-
-      case MNF_CODE:
-      {
-         unsigned int *p = (unsigned int*)&rFm;
-         p[1] ^= 0x80000000;
-         fpa11->fpreg[Fd].fDouble = rFm;
-      }
-      break;
-
-      case ABS_CODE:
-      {
-         unsigned int *p = (unsigned int*)&rFm;
-         p[1] &= 0x7fffffff;
-         fpa11->fpreg[Fd].fDouble = rFm;
-      }
-      break;
-
-      case RND_CODE:
-      case URD_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_round_to_int(rFm);
-      break;
-
-      case SQT_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_sqrt(rFm);
-      break;
-
-#if 0
-      case LOG_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_log(rFm);
-      break;
-
-      case LGN_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_ln(rFm);
-      break;
-
-      case EXP_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_exp(rFm);
-      break;
-
-      case SIN_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_sin(rFm);
-      break;
-
-      case COS_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_cos(rFm);
-      break;
-
-      case TAN_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_tan(rFm);
-      break;
-
-      case ASN_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_arcsin(rFm);
-      break;
-
-      case ACS_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_arccos(rFm);
-      break;
-
-      case ATN_CODE:
-         fpa11->fpreg[Fd].fDouble = float64_arctan(rFm);
-      break;
-#endif
-
-      case NRM_CODE:
-      break;
-      
-      default:
-      {
-        nRc = 0;
-      }
-   }
-
-   if (0 != nRc) fpa11->fType[Fd] = typeDouble;
-   return nRc;
-}
-
-#if 0
-float64 float64_exp(float64 rFm)
-{
-  return rFm;
-//series
-}
-
-float64 float64_ln(float64 rFm)
-{
-  return rFm;
-//series
-}
-
-float64 float64_sin(float64 rFm)
-{
-  return rFm;
-//series
-}
-
-float64 float64_cos(float64 rFm)
-{
-   return rFm;
-   //series
-}
-
-#if 0
-float64 float64_arcsin(float64 rFm)
-{
-//series
-}
-
-float64 float64_arctan(float64 rFm)
-{
-  //series
-}
-#endif
-
-float64 float64_log(float64 rFm)
-{
-  return float64_div(float64_ln(rFm),getDoubleConstant(7));
-}
-
-float64 float64_tan(float64 rFm)
-{
-  return float64_div(float64_sin(rFm),float64_cos(rFm));
-}
-
-float64 float64_arccos(float64 rFm)
-{
-return rFm;
-   //return float64_sub(halfPi,float64_arcsin(rFm));
-}
-
-float64 float64_pow(float64 rFn,float64 rFm)
-{
-  return float64_exp(float64_mul(rFm,float64_ln(rFn))); 
-}
-
-float64 float64_pol(float64 rFn,float64 rFm)
-{
-  return float64_arctan(float64_div(rFn,rFm)); 
-}
-#endif
diff --git a/arch/arm26/nwfpe/entry.S b/arch/arm26/nwfpe/entry.S
deleted file mode 100644 (file)
index e631200..0000000
+++ /dev/null
@@ -1,114 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998
-    (c) Philip Blundell 1998-1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include <asm/asm-offsets.h>
-
-/* This is the kernel's entry point into the floating point emulator.
-It is called from the kernel with code similar to this:
-
-       mov     fp, #0
-       teqp    pc, #PSR_I_BIT | MODE_SVC
-       ldr     r4, .LC2
-       ldr     pc, [r4]                @ Call FP module USR entry point
-
-The kernel expects the emulator to return via one of two possible
-points of return it passes to the emulator.  The emulator, if
-successful in its emulation, jumps to ret_from_exception and the
-kernel takes care of returning control from the trap to the user code.
-If the emulator is unable to emulate the instruction, it returns to
-fpundefinstr and the kernel halts the user program with a core dump.
-
-This routine does four things:
-
-1) It saves SP into a variable called userRegisters.  The kernel has
-created a struct pt_regs on the stack and saved the user registers
-into it.  See /usr/include/asm/proc/ptrace.h for details.  The
-emulator code uses userRegisters as the base of an array of words from
-which the contents of the registers can be extracted.
-
-2) It locates the FP emulator work area within the TSS structure and
-points `fpa11' to it.
-
-3) It calls EmulateAll to emulate a floating point instruction.
-EmulateAll returns 1 if the emulation was successful, or 0 if not.
-
-4) If an instruction has been emulated successfully, it looks ahead at
-the next instruction.  If it is a floating point instruction, it
-executes the instruction, without returning to user space.  In this
-way it repeatedly looks ahead and executes floating point instructions
-until it encounters a non floating point instruction, at which time it
-returns via _fpreturn.
-
-This is done to reduce the effect of the trap overhead on each
-floating point instructions.  GCC attempts to group floating point
-instructions to allow the emulator to spread the cost of the trap over
-several floating point instructions.  */
-
-       .globl  nwfpe_enter
-nwfpe_enter:
-       mov     sl, sp
-       bl      FPA11_CheckInit         @ check to see if we are initialised
-
-       ldr     r5, [sp, #60]           @ get contents of PC
-       bic     r5, r5, #0xfc000003
-       ldr     r0, [r5, #-4]           @ get actual instruction into r0
-       bl      EmulateAll              @ emulate the instruction
-1:     cmp     r0, #0                  @ was emulation successful
-       beq     fpundefinstr            @ no, return failure
-
-next:
-.Lx1:  ldrt    r6, [r5], #4            @ get the next instruction and
-                                       @ increment PC
-
-       and     r2, r6, #0x0F000000     @ test for FP insns
-       teq     r2, #0x0C000000
-       teqne   r2, #0x0D000000
-       teqne   r2, #0x0E000000
-       bne     ret_from_exception      @ return ok if not a fp insn
-
-       ldr     r9, [sp, #60]           @ get new condition codes
-       and     r9, r9, #0xfc000003
-       orr     r7, r5, r9
-       str     r7, [sp, #60]           @ update PC copy in regs
-
-       mov     r0, r6                  @ save a copy
-       mov     r1, r9                  @ fetch the condition codes
-       bl      checkCondition          @ check the condition
-       cmp     r0, #0                  @ r0 = 0 ==> condition failed
-
-       @ if condition code failed to match, next insn
-       beq     next                    @ get the next instruction;
-           
-       mov     r0, r6                  @ prepare for EmulateAll()
-       adr     lr, 1b
-       orr     lr, lr, #3
-       b       EmulateAll              @ if r0 != 0, goto EmulateAll
-
-.Lret: b       ret_from_exception      @ let the user eat segfaults
-       
-       @ We need to be prepared for the instruction at .Lx1 to fault.
-       @ Emit the appropriate exception gunk to fix things up.
-       .section __ex_table,"a"
-       .align  3
-       .long   .Lx1
-       ldr     lr, [lr, $(.Lret - .Lx1)/4]
-       .previous
diff --git a/arch/arm26/nwfpe/extended_cpdo.c b/arch/arm26/nwfpe/extended_cpdo.c
deleted file mode 100644 (file)
index 3314075..0000000
+++ /dev/null
@@ -1,273 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "softfloat.h"
-#include "fpopcode.h"
-
-floatx80 floatx80_exp(floatx80 Fm);
-floatx80 floatx80_ln(floatx80 Fm);
-floatx80 floatx80_sin(floatx80 rFm);
-floatx80 floatx80_cos(floatx80 rFm);
-floatx80 floatx80_arcsin(floatx80 rFm);
-floatx80 floatx80_arctan(floatx80 rFm);
-floatx80 floatx80_log(floatx80 rFm);
-floatx80 floatx80_tan(floatx80 rFm);
-floatx80 floatx80_arccos(floatx80 rFm);
-floatx80 floatx80_pow(floatx80 rFn,floatx80 rFm);
-floatx80 floatx80_pol(floatx80 rFn,floatx80 rFm);
-
-unsigned int ExtendedCPDO(const unsigned int opcode)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   floatx80 rFm, rFn;
-   unsigned int Fd, Fm, Fn, nRc = 1;
-
-   //printk("ExtendedCPDO(0x%08x)\n",opcode);
-   
-   Fm = getFm(opcode);
-   if (CONSTANT_FM(opcode))
-   {
-     rFm = getExtendedConstant(Fm);
-   }
-   else
-   {  
-     switch (fpa11->fType[Fm])
-     {
-        case typeSingle:
-          rFm = float32_to_floatx80(fpa11->fpreg[Fm].fSingle);
-        break;
-
-        case typeDouble:
-          rFm = float64_to_floatx80(fpa11->fpreg[Fm].fDouble);
-        break;
-        
-        case typeExtended:
-          rFm = fpa11->fpreg[Fm].fExtended;
-        break;
-        
-        default: return 0;
-     }
-   }
-   
-   if (!MONADIC_INSTRUCTION(opcode))
-   {
-      Fn = getFn(opcode);
-      switch (fpa11->fType[Fn])
-      {
-        case typeSingle:
-          rFn = float32_to_floatx80(fpa11->fpreg[Fn].fSingle);
-        break;
-
-        case typeDouble:
-          rFn = float64_to_floatx80(fpa11->fpreg[Fn].fDouble);
-        break;
-        
-        case typeExtended:
-          rFn = fpa11->fpreg[Fn].fExtended;
-        break;
-        
-        default: return 0;
-      }
-   }
-
-   Fd = getFd(opcode);
-   switch (opcode & MASK_ARITHMETIC_OPCODE)
-   {
-      /* dyadic opcodes */
-      case ADF_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_add(rFn,rFm);
-      break;
-
-      case MUF_CODE:
-      case FML_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_mul(rFn,rFm);
-      break;
-
-      case SUF_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_sub(rFn,rFm);
-      break;
-
-      case RSF_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_sub(rFm,rFn);
-      break;
-
-      case DVF_CODE:
-      case FDV_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_div(rFn,rFm);
-      break;
-
-      case RDF_CODE:
-      case FRD_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_div(rFm,rFn);
-      break;
-
-#if 0
-      case POW_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_pow(rFn,rFm);
-      break;
-
-      case RPW_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_pow(rFm,rFn);
-      break;
-#endif
-
-      case RMF_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_rem(rFn,rFm);
-      break;
-
-#if 0
-      case POL_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_pol(rFn,rFm);
-      break;
-#endif
-
-      /* monadic opcodes */
-      case MVF_CODE:
-         fpa11->fpreg[Fd].fExtended = rFm;
-      break;
-
-      case MNF_CODE:
-         rFm.high ^= 0x8000;
-         fpa11->fpreg[Fd].fExtended = rFm;
-      break;
-
-      case ABS_CODE:
-         rFm.high &= 0x7fff;
-         fpa11->fpreg[Fd].fExtended = rFm;
-      break;
-
-      case RND_CODE:
-      case URD_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_round_to_int(rFm);
-      break;
-
-      case SQT_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_sqrt(rFm);
-      break;
-
-#if 0
-      case LOG_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_log(rFm);
-      break;
-
-      case LGN_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_ln(rFm);
-      break;
-
-      case EXP_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_exp(rFm);
-      break;
-
-      case SIN_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_sin(rFm);
-      break;
-
-      case COS_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_cos(rFm);
-      break;
-
-      case TAN_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_tan(rFm);
-      break;
-
-      case ASN_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_arcsin(rFm);
-      break;
-
-      case ACS_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_arccos(rFm);
-      break;
-
-      case ATN_CODE:
-         fpa11->fpreg[Fd].fExtended = floatx80_arctan(rFm);
-      break;
-#endif
-
-      case NRM_CODE:
-      break;
-      
-      default:
-      {
-        nRc = 0;
-      }
-   }
-   
-   if (0 != nRc) fpa11->fType[Fd] = typeExtended;
-   return nRc;
-}
-
-#if 0
-floatx80 floatx80_exp(floatx80 Fm)
-{
-//series
-}
-
-floatx80 floatx80_ln(floatx80 Fm)
-{
-//series
-}
-
-floatx80 floatx80_sin(floatx80 rFm)
-{
-//series
-}
-
-floatx80 floatx80_cos(floatx80 rFm)
-{
-//series
-}
-
-floatx80 floatx80_arcsin(floatx80 rFm)
-{
-//series
-}
-
-floatx80 floatx80_arctan(floatx80 rFm)
-{
-  //series
-}
-
-floatx80 floatx80_log(floatx80 rFm)
-{
-  return floatx80_div(floatx80_ln(rFm),getExtendedConstant(7));
-}
-
-floatx80 floatx80_tan(floatx80 rFm)
-{
-  return floatx80_div(floatx80_sin(rFm),floatx80_cos(rFm));
-}
-
-floatx80 floatx80_arccos(floatx80 rFm)
-{
-   //return floatx80_sub(halfPi,floatx80_arcsin(rFm));
-}
-
-floatx80 floatx80_pow(floatx80 rFn,floatx80 rFm)
-{
-  return floatx80_exp(floatx80_mul(rFm,floatx80_ln(rFn))); 
-}
-
-floatx80 floatx80_pol(floatx80 rFn,floatx80 rFm)
-{
-  return floatx80_arctan(floatx80_div(rFn,rFm)); 
-}
-#endif
diff --git a/arch/arm26/nwfpe/fpa11.c b/arch/arm26/nwfpe/fpa11.c
deleted file mode 100644 (file)
index e954540..0000000
+++ /dev/null
@@ -1,221 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "fpopcode.h"
-
-#include "fpmodule.h"
-#include "fpmodule.inl"
-
-#include <linux/compiler.h>
-#include <asm/system.h>
-
-/* forward declarations */
-unsigned int EmulateCPDO(const unsigned int);
-unsigned int EmulateCPDT(const unsigned int);
-unsigned int EmulateCPRT(const unsigned int);
-
-/* Reset the FPA11 chip.  Called to initialize and reset the emulator. */
-void resetFPA11(void)
-{
-  int i;
-  FPA11 *fpa11 = GET_FPA11();
-  
-  /* initialize the register type array */
-  for (i=0;i<=7;i++)
-  {
-    fpa11->fType[i] = typeNone;
-  }
-  
-  /* FPSR: set system id to FP_EMULATOR, set AC, clear all other bits */
-  fpa11->fpsr = FP_EMULATOR | BIT_AC;
-  
-  /* FPCR: set SB, AB and DA bits, clear all others */
-#if MAINTAIN_FPCR
-  fpa11->fpcr = MASK_RESET;
-#endif
-}
-
-void SetRoundingMode(const unsigned int opcode)
-{
-#if MAINTAIN_FPCR
-   FPA11 *fpa11 = GET_FPA11();
-   fpa11->fpcr &= ~MASK_ROUNDING_MODE;
-#endif   
-   switch (opcode & MASK_ROUNDING_MODE)
-   {
-      default:
-      case ROUND_TO_NEAREST:
-         float_rounding_mode = float_round_nearest_even;
-#if MAINTAIN_FPCR         
-         fpa11->fpcr |= ROUND_TO_NEAREST;
-#endif         
-      break;
-      
-      case ROUND_TO_PLUS_INFINITY:
-         float_rounding_mode = float_round_up;
-#if MAINTAIN_FPCR         
-         fpa11->fpcr |= ROUND_TO_PLUS_INFINITY;
-#endif         
-      break;
-      
-      case ROUND_TO_MINUS_INFINITY:
-         float_rounding_mode = float_round_down;
-#if MAINTAIN_FPCR         
-         fpa11->fpcr |= ROUND_TO_MINUS_INFINITY;
-#endif         
-      break;
-      
-      case ROUND_TO_ZERO:
-         float_rounding_mode = float_round_to_zero;
-#if MAINTAIN_FPCR         
-         fpa11->fpcr |= ROUND_TO_ZERO;
-#endif         
-      break;
-  }
-}
-
-void SetRoundingPrecision(const unsigned int opcode)
-{
-#if MAINTAIN_FPCR
-   FPA11 *fpa11 = GET_FPA11();
-   fpa11->fpcr &= ~MASK_ROUNDING_PRECISION;
-#endif   
-   switch (opcode & MASK_ROUNDING_PRECISION)
-   {
-      case ROUND_SINGLE:
-         floatx80_rounding_precision = 32;
-#if MAINTAIN_FPCR         
-         fpa11->fpcr |= ROUND_SINGLE;
-#endif         
-      break;
-      
-      case ROUND_DOUBLE:
-         floatx80_rounding_precision = 64;
-#if MAINTAIN_FPCR         
-         fpa11->fpcr |= ROUND_DOUBLE;
-#endif         
-      break;
-      
-      case ROUND_EXTENDED:
-         floatx80_rounding_precision = 80;
-#if MAINTAIN_FPCR         
-         fpa11->fpcr |= ROUND_EXTENDED;
-#endif         
-      break;
-      
-      default: floatx80_rounding_precision = 80;
-  }
-}
-
-void FPA11_CheckInit(void)
-{
-  FPA11 *fpa11 = GET_FPA11();
-  if (unlikely(fpa11->initflag == 0))
-  {
-    resetFPA11();
-    SetRoundingMode(ROUND_TO_NEAREST);
-    SetRoundingPrecision(ROUND_EXTENDED);
-    fpa11->initflag = 1;
-  }
-}
-
-/* Emulate the instruction in the opcode. */
-unsigned int EmulateAll(unsigned int opcode)
-{
-  unsigned int nRc = 1, code;
-
-  code = opcode & 0x00000f00;
-  if (code == 0x00000100 || code == 0x00000200)
-  {
-    /* For coprocessor 1 or 2 (FPA11) */
-    code = opcode & 0x0e000000;
-    if (code == 0x0e000000)
-    {
-      if (opcode & 0x00000010)
-      {
-        /* Emulate conversion opcodes. */
-        /* Emulate register transfer opcodes. */
-        /* Emulate comparison opcodes. */
-        nRc = EmulateCPRT(opcode);
-      }
-      else
-      {
-        /* Emulate monadic arithmetic opcodes. */
-        /* Emulate dyadic arithmetic opcodes. */
-        nRc = EmulateCPDO(opcode);
-      }
-    }
-    else if (code == 0x0c000000)
-    {
-      /* Emulate load/store opcodes. */
-      /* Emulate load/store multiple opcodes. */
-      nRc = EmulateCPDT(opcode);
-    }
-    else
-    {
-      /* Invalid instruction detected.  Return FALSE. */
-      nRc = 0;
-    }
-  }
-
-  return(nRc);
-}
-
-#if 0
-unsigned int EmulateAll1(unsigned int opcode)
-{
-  switch ((opcode >> 24) & 0xf)
-  {
-     case 0xc:
-     case 0xd:
-       if ((opcode >> 20) & 0x1)
-       {
-          switch ((opcode >> 8) & 0xf)
-          {
-             case 0x1: return PerformLDF(opcode); break;
-             case 0x2: return PerformLFM(opcode); break;
-             default: return 0;
-          }
-       }
-       else
-       {
-          switch ((opcode >> 8) & 0xf)
-          {
-             case 0x1: return PerformSTF(opcode); break;
-             case 0x2: return PerformSFM(opcode); break;
-             default: return 0;
-          }
-      }
-     break;
-     
-     case 0xe: 
-       if (opcode & 0x10)
-         return EmulateCPDO(opcode);
-       else
-         return EmulateCPRT(opcode);
-     break;
-  
-     default: return 0;
-  }
-}
-#endif
-
diff --git a/arch/arm26/nwfpe/fpa11.h b/arch/arm26/nwfpe/fpa11.h
deleted file mode 100644 (file)
index be09902..0000000
+++ /dev/null
@@ -1,87 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.com, 1998-1999
-    
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __FPA11_H__
-#define __FPA11_H__
-
-#define GET_FPA11() ((FPA11 *)(&current_thread_info()->fpstate))
-
-/*
- * The processes registers are always at the very top of the 8K
- * stack+task struct.  Use the same method as 'current' uses to
- * reach them.
- */
-register unsigned int *user_registers asm("sl");
-
-#define GET_USERREG() (user_registers)
-
-#include <linux/thread_info.h>
-
-/* includes */
-#include "fpsr.h"              /* FP control and status register definitions */
-#include "softfloat.h"
-
-#define                typeNone                0x00
-#define                typeSingle              0x01
-#define                typeDouble              0x02
-#define                typeExtended            0x03
-
-/*
- * This must be no more and no less than 12 bytes.
- */
-typedef union tagFPREG {
-   floatx80 fExtended;
-   float64  fDouble;
-   float32  fSingle;
-} FPREG;
-
-/*
- * FPA11 device model.
- *
- * This structure is exported to user space.  Do not re-order.
- * Only add new stuff to the end, and do not change the size of
- * any element.  Elements of this structure are used by user
- * space, and must match struct user_fp in include/asm-arm/user.h.
- * We include the byte offsets below for documentation purposes.
- *
- * The size of this structure and FPREG are checked by fpmodule.c
- * on initialisation.  If the rules have been broken, NWFPE will
- * not initialise.
- */
-typedef struct tagFPA11 {
-/*   0 */  FPREG fpreg[8];             /* 8 floating point registers */
-/*  96 */  FPSR fpsr;                  /* floating point status register */
-/* 100 */  FPCR fpcr;                  /* floating point control register */
-/* 104 */  unsigned char fType[8];     /* type of floating point value held in
-                                          floating point registers.  One of none
-                                          single, double or extended. */
-/* 112 */  int initflag;               /* this is special.  The kernel guarantees
-                                          to set it to 0 when a thread is launched,
-                                          so we can use it to detect whether this
-                                          instance of the emulator needs to be
-                                          initialised. */
-} FPA11;
-
-extern void resetFPA11(void);
-extern void SetRoundingMode(const unsigned int);
-extern void SetRoundingPrecision(const unsigned int);
-
-#endif
diff --git a/arch/arm26/nwfpe/fpa11.inl b/arch/arm26/nwfpe/fpa11.inl
deleted file mode 100644 (file)
index 1c45cba..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-
-/* Read and write floating point status register */
-extern __inline__ unsigned int readFPSR(void)
-{
-  FPA11 *fpa11 = GET_FPA11();
-  return(fpa11->fpsr);
-}
-
-extern __inline__ void writeFPSR(FPSR reg)
-{
-  FPA11 *fpa11 = GET_FPA11();
-  /* the sysid byte in the status register is readonly */
-  fpa11->fpsr = (fpa11->fpsr & MASK_SYSID) | (reg & ~MASK_SYSID);
-}
-
-/* Read and write floating point control register */
-extern __inline__ FPCR readFPCR(void)
-{
-  FPA11 *fpa11 = GET_FPA11();
-  /* clear SB, AB and DA bits before returning FPCR */
-  return(fpa11->fpcr & ~MASK_RFC);
-}
-
-extern __inline__ void writeFPCR(FPCR reg)
-{
-  FPA11 *fpa11 = GET_FPA11();
-  fpa11->fpcr &= ~MASK_WFC;            /* clear SB, AB and DA bits */
-  fpa11->fpcr |= (reg & MASK_WFC);     /* write SB, AB and DA bits */
-}
diff --git a/arch/arm26/nwfpe/fpa11_cpdo.c b/arch/arm26/nwfpe/fpa11_cpdo.c
deleted file mode 100644 (file)
index 343a6b9..0000000
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "fpopcode.h"
-
-unsigned int SingleCPDO(const unsigned int opcode);
-unsigned int DoubleCPDO(const unsigned int opcode);
-unsigned int ExtendedCPDO(const unsigned int opcode);
-
-unsigned int EmulateCPDO(const unsigned int opcode)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   unsigned int Fd, nType, nDest, nRc = 1;
-   
-   //printk("EmulateCPDO(0x%08x)\n",opcode);
-
-   /* Get the destination size.  If not valid let Linux perform
-      an invalid instruction trap. */
-   nDest = getDestinationSize(opcode);
-   if (typeNone == nDest) return 0;
-   
-   SetRoundingMode(opcode);
-     
-   /* Compare the size of the operands in Fn and Fm.
-      Choose the largest size and perform operations in that size,
-      in order to make use of all the precision of the operands. 
-      If Fm is a constant, we just grab a constant of a size 
-      matching the size of the operand in Fn. */
-   if (MONADIC_INSTRUCTION(opcode))
-     nType = nDest;
-   else
-     nType = fpa11->fType[getFn(opcode)];
-   
-   if (!CONSTANT_FM(opcode))
-   {
-     register unsigned int Fm = getFm(opcode);
-     if (nType < fpa11->fType[Fm])
-     {
-        nType = fpa11->fType[Fm];
-     }
-   }
-
-   switch (nType)
-   {
-      case typeSingle   : nRc = SingleCPDO(opcode);   break;
-      case typeDouble   : nRc = DoubleCPDO(opcode);   break;
-      case typeExtended : nRc = ExtendedCPDO(opcode); break;
-      default           : nRc = 0;
-   }
-
-   /* If the operation succeeded, check to see if the result in the
-      destination register is the correct size.  If not force it
-      to be. */
-   Fd = getFd(opcode);
-   nType = fpa11->fType[Fd];
-   if ((0 != nRc) && (nDest != nType))
-   {
-     switch (nDest)
-     {
-       case typeSingle:
-       {
-         if (typeDouble == nType)
-           fpa11->fpreg[Fd].fSingle = 
-              float64_to_float32(fpa11->fpreg[Fd].fDouble);
-         else
-           fpa11->fpreg[Fd].fSingle = 
-              floatx80_to_float32(fpa11->fpreg[Fd].fExtended);
-       }
-       break;
-          
-       case typeDouble:
-       {
-         if (typeSingle == nType)
-           fpa11->fpreg[Fd].fDouble = 
-              float32_to_float64(fpa11->fpreg[Fd].fSingle);
-         else
-           fpa11->fpreg[Fd].fDouble = 
-              floatx80_to_float64(fpa11->fpreg[Fd].fExtended);
-       }
-       break;
-          
-       case typeExtended:
-       {
-         if (typeSingle == nType)
-           fpa11->fpreg[Fd].fExtended = 
-              float32_to_floatx80(fpa11->fpreg[Fd].fSingle);
-         else
-           fpa11->fpreg[Fd].fExtended = 
-              float64_to_floatx80(fpa11->fpreg[Fd].fDouble);
-       }
-       break;
-     }
-     
-     fpa11->fType[Fd] = nDest;
-   }
-   
-   return nRc;
-}
diff --git a/arch/arm26/nwfpe/fpa11_cpdt.c b/arch/arm26/nwfpe/fpa11_cpdt.c
deleted file mode 100644 (file)
index e12db7c..0000000
+++ /dev/null
@@ -1,368 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.com, 1998-1999
-    (c) Philip Blundell, 1998
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "softfloat.h"
-#include "fpopcode.h"
-#include "fpmodule.h"
-#include "fpmodule.inl"
-
-#include <asm/uaccess.h>
-
-static inline
-void loadSingle(const unsigned int Fn,const unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   fpa11->fType[Fn] = typeSingle;
-   get_user(fpa11->fpreg[Fn].fSingle, pMem);
-}
-
-static inline
-void loadDouble(const unsigned int Fn,const unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   unsigned int *p;
-   p = (unsigned int*)&fpa11->fpreg[Fn].fDouble;
-   fpa11->fType[Fn] = typeDouble;
-   get_user(p[0], &pMem[1]);
-   get_user(p[1], &pMem[0]); /* sign & exponent */
-}
-
-static inline
-void loadExtended(const unsigned int Fn,const unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   unsigned int *p;
-   p = (unsigned int*)&fpa11->fpreg[Fn].fExtended;
-   fpa11->fType[Fn] = typeExtended;
-   get_user(p[0], &pMem[0]);  /* sign & exponent */
-   get_user(p[1], &pMem[2]);  /* ls bits */
-   get_user(p[2], &pMem[1]);  /* ms bits */
-}
-
-static inline
-void loadMultiple(const unsigned int Fn,const unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   register unsigned int *p;
-   unsigned long x;
-
-   p = (unsigned int*)&(fpa11->fpreg[Fn]);
-   get_user(x, &pMem[0]);
-   fpa11->fType[Fn] = (x >> 14) & 0x00000003;
-
-   switch (fpa11->fType[Fn])
-   {
-      case typeSingle:
-      case typeDouble:
-      {
-         get_user(p[0], &pMem[2]);  /* Single */
-         get_user(p[1], &pMem[1]);  /* double msw */
-         p[2] = 0;        /* empty */
-      }
-      break;
-
-      case typeExtended:
-      {
-         get_user(p[1], &pMem[2]);
-         get_user(p[2], &pMem[1]);  /* msw */
-         p[0] = (x & 0x80003fff);
-      }
-      break;
-   }
-}
-
-static inline
-void storeSingle(const unsigned int Fn,unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   union
-   {
-     float32 f;
-     unsigned int i[1];
-   } val;
-
-   switch (fpa11->fType[Fn])
-   {
-      case typeDouble:
-         val.f = float64_to_float32(fpa11->fpreg[Fn].fDouble);
-      break;
-
-      case typeExtended:
-         val.f = floatx80_to_float32(fpa11->fpreg[Fn].fExtended);
-      break;
-
-      default: val.f = fpa11->fpreg[Fn].fSingle;
-   }
-
-   put_user(val.i[0], pMem);
-}
-
-static inline
-void storeDouble(const unsigned int Fn,unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   union
-   {
-     float64 f;
-     unsigned int i[2];
-   } val;
-
-   switch (fpa11->fType[Fn])
-   {
-      case typeSingle:
-         val.f = float32_to_float64(fpa11->fpreg[Fn].fSingle);
-      break;
-
-      case typeExtended:
-         val.f = floatx80_to_float64(fpa11->fpreg[Fn].fExtended);
-      break;
-
-      default: val.f = fpa11->fpreg[Fn].fDouble;
-   }
-
-   put_user(val.i[1], &pMem[0]);       /* msw */
-   put_user(val.i[0], &pMem[1]);       /* lsw */
-}
-
-static inline
-void storeExtended(const unsigned int Fn,unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   union
-   {
-     floatx80 f;
-     unsigned int i[3];
-   } val;
-
-   switch (fpa11->fType[Fn])
-   {
-      case typeSingle:
-         val.f = float32_to_floatx80(fpa11->fpreg[Fn].fSingle);
-      break;
-
-      case typeDouble:
-         val.f = float64_to_floatx80(fpa11->fpreg[Fn].fDouble);
-      break;
-
-      default: val.f = fpa11->fpreg[Fn].fExtended;
-   }
-
-   put_user(val.i[0], &pMem[0]); /* sign & exp */
-   put_user(val.i[1], &pMem[2]);
-   put_user(val.i[2], &pMem[1]); /* msw */
-}
-
-static inline
-void storeMultiple(const unsigned int Fn,unsigned int *pMem)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   register unsigned int nType, *p;
-
-   p = (unsigned int*)&(fpa11->fpreg[Fn]);
-   nType = fpa11->fType[Fn];
-
-   switch (nType)
-   {
-      case typeSingle:
-      case typeDouble:
-      {
-        put_user(p[0], &pMem[2]); /* single */
-        put_user(p[1], &pMem[1]); /* double msw */
-        put_user(nType << 14, &pMem[0]);
-      }
-      break;
-
-      case typeExtended:
-      {
-        put_user(p[2], &pMem[1]); /* msw */
-        put_user(p[1], &pMem[2]);
-        put_user((p[0] & 0x80003fff) | (nType << 14), &pMem[0]);
-      }
-      break;
-   }
-}
-
-unsigned int PerformLDF(const unsigned int opcode)
-{
-   unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
-     write_back = WRITE_BACK(opcode);
-
-   //printk("PerformLDF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode));
-
-   pBase = (unsigned int*)readRegister(getRn(opcode));
-   if (REG_PC == getRn(opcode))
-   {
-     pBase += 2;
-     write_back = 0;
-   }
-
-   pFinal = pBase;
-   if (BIT_UP_SET(opcode))
-     pFinal += getOffset(opcode);
-   else
-     pFinal -= getOffset(opcode);
-
-   if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
-
-   switch (opcode & MASK_TRANSFER_LENGTH)
-   {
-      case TRANSFER_SINGLE  : loadSingle(getFd(opcode),pAddress);   break;
-      case TRANSFER_DOUBLE  : loadDouble(getFd(opcode),pAddress);   break;
-      case TRANSFER_EXTENDED: loadExtended(getFd(opcode),pAddress); break;
-      default: nRc = 0;
-   }
-
-   if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
-   return nRc;
-}
-
-unsigned int PerformSTF(const unsigned int opcode)
-{
-   unsigned int *pBase, *pAddress, *pFinal, nRc = 1,
-     write_back = WRITE_BACK(opcode);
-
-   //printk("PerformSTF(0x%08x), Fd = 0x%08x\n",opcode,getFd(opcode));
-   SetRoundingMode(ROUND_TO_NEAREST);
-
-   pBase = (unsigned int*)readRegister(getRn(opcode));
-   if (REG_PC == getRn(opcode))
-   {
-     pBase += 2;
-     write_back = 0;
-   }
-
-   pFinal = pBase;
-   if (BIT_UP_SET(opcode))
-     pFinal += getOffset(opcode);
-   else
-     pFinal -= getOffset(opcode);
-
-   if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
-
-   switch (opcode & MASK_TRANSFER_LENGTH)
-   {
-      case TRANSFER_SINGLE  : storeSingle(getFd(opcode),pAddress);   break;
-      case TRANSFER_DOUBLE  : storeDouble(getFd(opcode),pAddress);   break;
-      case TRANSFER_EXTENDED: storeExtended(getFd(opcode),pAddress); break;
-      default: nRc = 0;
-   }
-
-   if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
-   return nRc;
-}
-
-unsigned int PerformLFM(const unsigned int opcode)
-{
-   unsigned int i, Fd, *pBase, *pAddress, *pFinal,
-     write_back = WRITE_BACK(opcode);
-
-   pBase = (unsigned int*)readRegister(getRn(opcode));
-   if (REG_PC == getRn(opcode))
-   {
-     pBase += 2;
-     write_back = 0;
-   }
-
-   pFinal = pBase;
-   if (BIT_UP_SET(opcode))
-     pFinal += getOffset(opcode);
-   else
-     pFinal -= getOffset(opcode);
-
-   if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
-
-   Fd = getFd(opcode);
-   for (i=getRegisterCount(opcode);i>0;i--)
-   {
-     loadMultiple(Fd,pAddress);
-     pAddress += 3; Fd++;
-     if (Fd == 8) Fd = 0;
-   }
-
-   if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
-   return 1;
-}
-
-unsigned int PerformSFM(const unsigned int opcode)
-{
-   unsigned int i, Fd, *pBase, *pAddress, *pFinal,
-     write_back = WRITE_BACK(opcode);
-
-   pBase = (unsigned int*)readRegister(getRn(opcode));
-   if (REG_PC == getRn(opcode))
-   {
-     pBase += 2;
-     write_back = 0;
-   }
-
-   pFinal = pBase;
-   if (BIT_UP_SET(opcode))
-     pFinal += getOffset(opcode);
-   else
-     pFinal -= getOffset(opcode);
-
-   if (PREINDEXED(opcode)) pAddress = pFinal; else pAddress = pBase;
-
-   Fd = getFd(opcode);
-   for (i=getRegisterCount(opcode);i>0;i--)
-   {
-     storeMultiple(Fd,pAddress);
-     pAddress += 3; Fd++;
-     if (Fd == 8) Fd = 0;
-   }
-
-   if (write_back) writeRegister(getRn(opcode),(unsigned int)pFinal);
-   return 1;
-}
-
-#if 1
-unsigned int EmulateCPDT(const unsigned int opcode)
-{
-  unsigned int nRc = 0;
-
-  //printk("EmulateCPDT(0x%08x)\n",opcode);
-
-  if (LDF_OP(opcode))
-  {
-    nRc = PerformLDF(opcode);
-  }
-  else if (LFM_OP(opcode))
-  {
-    nRc = PerformLFM(opcode);
-  }
-  else if (STF_OP(opcode))
-  {
-    nRc = PerformSTF(opcode);
-  }
-  else if (SFM_OP(opcode))
-  {
-    nRc = PerformSFM(opcode);
-  }
-  else
-  {
-    nRc = 0;
-  }
-
-  return nRc;
-}
-#endif
diff --git a/arch/arm26/nwfpe/fpa11_cprt.c b/arch/arm26/nwfpe/fpa11_cprt.c
deleted file mode 100644 (file)
index a201076..0000000
+++ /dev/null
@@ -1,289 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-    (c) Philip Blundell, 1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "milieu.h"
-#include "softfloat.h"
-#include "fpopcode.h"
-#include "fpa11.inl"
-#include "fpmodule.h"
-#include "fpmodule.inl"
-
-extern flag floatx80_is_nan(floatx80);
-extern flag float64_is_nan( float64);
-extern flag float32_is_nan( float32);
-
-void SetRoundingMode(const unsigned int opcode);
-
-unsigned int PerformFLT(const unsigned int opcode);
-unsigned int PerformFIX(const unsigned int opcode);
-
-static unsigned int
-PerformComparison(const unsigned int opcode);
-
-unsigned int EmulateCPRT(const unsigned int opcode)
-{
-  unsigned int nRc = 1;
-
-  //printk("EmulateCPRT(0x%08x)\n",opcode);
-
-  if (opcode & 0x800000)
-  {
-     /* This is some variant of a comparison (PerformComparison will
-       sort out which one).  Since most of the other CPRT
-       instructions are oddball cases of some sort or other it makes
-       sense to pull this out into a fast path.  */
-     return PerformComparison(opcode);
-  }
-
-  /* Hint to GCC that we'd like a jump table rather than a load of CMPs */
-  switch ((opcode & 0x700000) >> 20)
-  {
-    case  FLT_CODE >> 20: nRc = PerformFLT(opcode); break;
-    case  FIX_CODE >> 20: nRc = PerformFIX(opcode); break;
-    
-    case  WFS_CODE >> 20: writeFPSR(readRegister(getRd(opcode))); break;
-    case  RFS_CODE >> 20: writeRegister(getRd(opcode),readFPSR()); break;
-
-#if 0    /* We currently have no use for the FPCR, so there's no point
-           in emulating it. */
-    case  WFC_CODE >> 20: writeFPCR(readRegister(getRd(opcode)));
-    case  RFC_CODE >> 20: writeRegister(getRd(opcode),readFPCR()); break;
-#endif
-
-    default: nRc = 0;
-  }
-  
-  return nRc;
-}
-
-unsigned int PerformFLT(const unsigned int opcode)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   
-   unsigned int nRc = 1;
-   SetRoundingMode(opcode);
-
-   switch (opcode & MASK_ROUNDING_PRECISION)
-   {
-      case ROUND_SINGLE:
-      {
-        fpa11->fType[getFn(opcode)] = typeSingle;
-        fpa11->fpreg[getFn(opcode)].fSingle =
-          int32_to_float32(readRegister(getRd(opcode)));
-      }
-      break;
-
-      case ROUND_DOUBLE:
-      {
-        fpa11->fType[getFn(opcode)] = typeDouble;
-        fpa11->fpreg[getFn(opcode)].fDouble =
-            int32_to_float64(readRegister(getRd(opcode)));
-      }
-      break;
-        
-      case ROUND_EXTENDED:
-      {
-        fpa11->fType[getFn(opcode)] = typeExtended;
-        fpa11->fpreg[getFn(opcode)].fExtended =
-          int32_to_floatx80(readRegister(getRd(opcode)));
-      }
-      break;
-      
-      default: nRc = 0;
-  }
-  
-  return nRc;
-}
-
-unsigned int PerformFIX(const unsigned int opcode)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   unsigned int nRc = 1;
-   unsigned int Fn = getFm(opcode);
-   
-   SetRoundingMode(opcode);
-
-   switch (fpa11->fType[Fn])
-   {
-      case typeSingle:
-      {
-         writeRegister(getRd(opcode),
-                      float32_to_int32(fpa11->fpreg[Fn].fSingle));
-      }
-      break;
-
-      case typeDouble:
-      {
-         writeRegister(getRd(opcode),
-                      float64_to_int32(fpa11->fpreg[Fn].fDouble));
-      }
-      break;
-                      
-      case typeExtended:
-      {
-         writeRegister(getRd(opcode),
-                      floatx80_to_int32(fpa11->fpreg[Fn].fExtended));
-      }
-      break;
-      
-      default: nRc = 0;
-  }
-  
-  return nRc;
-}
-
-   
-static unsigned int __inline__
-PerformComparisonOperation(floatx80 Fn, floatx80 Fm)
-{
-   unsigned int flags = 0;
-
-   /* test for less than condition */
-   if (floatx80_lt(Fn,Fm))
-   {
-      flags |= CC_NEGATIVE;
-   }
-  
-   /* test for equal condition */
-   if (floatx80_eq(Fn,Fm))
-   {
-      flags |= CC_ZERO;
-   }
-
-   /* test for greater than or equal condition */
-   if (floatx80_lt(Fm,Fn))
-   {
-      flags |= CC_CARRY;
-   }
-   
-   writeConditionCodes(flags);
-   return 1;
-}
-
-/* This instruction sets the flags N, Z, C, V in the FPSR. */
-   
-static unsigned int PerformComparison(const unsigned int opcode)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   unsigned int Fn, Fm;
-   floatx80 rFn, rFm;
-   int e_flag = opcode & 0x400000;     /* 1 if CxFE */
-   int n_flag = opcode & 0x200000;     /* 1 if CNxx */
-   unsigned int flags = 0;
-
-   //printk("PerformComparison(0x%08x)\n",opcode);
-
-   Fn = getFn(opcode);
-   Fm = getFm(opcode);
-
-   /* Check for unordered condition and convert all operands to 80-bit
-      format.
-      ?? Might be some mileage in avoiding this conversion if possible.
-      Eg, if both operands are 32-bit, detect this and do a 32-bit
-      comparison (cheaper than an 80-bit one).  */
-   switch (fpa11->fType[Fn])
-   {
-      case typeSingle: 
-        //printk("single.\n");
-       if (float32_is_nan(fpa11->fpreg[Fn].fSingle))
-          goto unordered;
-        rFn = float32_to_floatx80(fpa11->fpreg[Fn].fSingle);
-      break;
-
-      case typeDouble: 
-        //printk("double.\n");
-       if (float64_is_nan(fpa11->fpreg[Fn].fDouble))
-          goto unordered;
-        rFn = float64_to_floatx80(fpa11->fpreg[Fn].fDouble);
-      break;
-      
-      case typeExtended: 
-        //printk("extended.\n");
-       if (floatx80_is_nan(fpa11->fpreg[Fn].fExtended))
-          goto unordered;
-        rFn = fpa11->fpreg[Fn].fExtended;
-      break;
-      
-      default: return 0;
-   }
-
-   if (CONSTANT_FM(opcode))
-   {
-     //printk("Fm is a constant: #%d.\n",Fm);
-     rFm = getExtendedConstant(Fm);
-     if (floatx80_is_nan(rFm))
-        goto unordered;
-   }
-   else
-   {
-     //printk("Fm = r%d which contains a ",Fm);
-      switch (fpa11->fType[Fm])
-      {
-         case typeSingle: 
-           //printk("single.\n");
-          if (float32_is_nan(fpa11->fpreg[Fm].fSingle))
-             goto unordered;
-           rFm = float32_to_floatx80(fpa11->fpreg[Fm].fSingle);
-         break;
-
-         case typeDouble: 
-           //printk("double.\n");
-          if (float64_is_nan(fpa11->fpreg[Fm].fDouble))
-             goto unordered;
-           rFm = float64_to_floatx80(fpa11->fpreg[Fm].fDouble);
-         break;
-      
-         case typeExtended: 
-           //printk("extended.\n");
-          if (floatx80_is_nan(fpa11->fpreg[Fm].fExtended))
-             goto unordered;
-           rFm = fpa11->fpreg[Fm].fExtended;
-         break;
-      
-         default: return 0;
-      }
-   }
-
-   if (n_flag)
-   {
-      rFm.high ^= 0x8000;
-   }
-
-   return PerformComparisonOperation(rFn,rFm);
-
- unordered:
-   /* ?? The FPA data sheet is pretty vague about this, in particular
-      about whether the non-E comparisons can ever raise exceptions.
-      This implementation is based on a combination of what it says in
-      the data sheet, observation of how the Acorn emulator actually
-      behaves (and how programs expect it to) and guesswork.  */
-   flags |= CC_OVERFLOW;
-   flags &= ~(CC_ZERO | CC_NEGATIVE);
-
-   if (BIT_AC & readFPSR()) flags |= CC_CARRY;
-
-   if (e_flag) float_raise(float_flag_invalid);
-
-   writeConditionCodes(flags);
-   return 1;
-}
diff --git a/arch/arm26/nwfpe/fpmodule.c b/arch/arm26/nwfpe/fpmodule.c
deleted file mode 100644 (file)
index a8fad92..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.com, 1998-1999
-    (c) Philip Blundell, 1998-1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-
-#include <linux/module.h>
-#include <linux/version.h>
-
-/* XXX */
-#include <linux/errno.h>
-#include <linux/types.h>
-#include <linux/kernel.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/init.h>
-/* XXX */
-
-#include "softfloat.h"
-#include "fpopcode.h"
-#include "fpmodule.h"
-#include "fpa11.inl"
-
-/* kernel symbols required for signal handling */
-typedef struct task_struct*    PTASK;
-
-#ifdef MODULE
-void fp_send_sig(unsigned long sig, PTASK p, int priv);
-
-MODULE_AUTHOR("Scott Bambrough <scottb@rebel.com>");
-MODULE_DESCRIPTION("NWFPE floating point emulator");
-
-#else
-#define fp_send_sig    send_sig
-#define kern_fp_enter  fp_enter
-
-extern char fpe_type[];
-#endif
-
-/* kernel function prototypes required */
-void fp_setup(void);
-
-/* external declarations for saved kernel symbols */
-extern void (*kern_fp_enter)(void);
-
-/* Original value of fp_enter from kernel before patched by fpe_init. */ 
-static void (*orig_fp_enter)(void);
-
-/* forward declarations */
-extern void nwfpe_enter(void);
-
-#ifdef MODULE
-/*
- * Return 0 if we can be unloaded.  This can only happen if
- * kern_fp_enter is still pointing at nwfpe_enter
- */
-static int fpe_unload(void)
-{
-  return (kern_fp_enter == nwfpe_enter) ? 0 : 1;
-}
-#endif
-
-static int __init fpe_init(void)
-{
-  if (sizeof(FPA11) > sizeof(union fp_state)) {
-    printk(KERN_ERR "nwfpe: bad structure size\n");
-    return -EINVAL;
-  }
-
-  if (sizeof(FPREG) != 12) {
-    printk(KERN_ERR "nwfpe: bad register size\n");
-    return -EINVAL;
-  }
-
-#ifdef MODULE
-  if (!mod_member_present(&__this_module, can_unload))
-    return -EINVAL;
-  __this_module.can_unload = fpe_unload;
-#else
-  if (fpe_type[0] && strcmp(fpe_type, "nwfpe"))
-    return 0;
-#endif
-
-  /* Display title, version and copyright information. */
-  printk(KERN_WARNING "NetWinder Floating Point Emulator V0.95 "
-        "(c) 1998-1999 Rebel.com\n");
-
-  /* Save pointer to the old FP handler and then patch ourselves in */
-  orig_fp_enter = kern_fp_enter;
-  kern_fp_enter = nwfpe_enter;
-
-  return 0;
-}
-
-static void __exit fpe_exit(void)
-{
-  /* Restore the values we saved earlier. */
-  kern_fp_enter = orig_fp_enter;
-}
-
-/*
-ScottB:  November 4, 1998
-
-Moved this function out of softfloat-specialize into fpmodule.c.
-This effectively isolates all the changes required for integrating with the
-Linux kernel into fpmodule.c.  Porting to NetBSD should only require modifying
-fpmodule.c to integrate with the NetBSD kernel (I hope!).
-
-[1/1/99: Not quite true any more unfortunately.  There is Linux-specific
-code to access data in user space in some other source files at the 
-moment (grep for get_user / put_user calls).  --philb]
-
-float_exception_flags is a global variable in SoftFloat.
-
-This function is called by the SoftFloat routines to raise a floating
-point exception.  We check the trap enable byte in the FPSR, and raise
-a SIGFPE exception if necessary.  If not the relevant bits in the 
-cumulative exceptions flag byte are set and we return.
-*/
-
-void float_raise(signed char flags)
-{
-  register unsigned int fpsr, cumulativeTraps;
-  
-#ifdef CONFIG_DEBUG_USER
-  printk(KERN_DEBUG "NWFPE: %s[%d] takes exception %08x at %p from %08x\n",
-        current->comm, current->pid, flags,
-        __builtin_return_address(0), GET_USERREG()[15]);
-#endif
-
-  /* Keep SoftFloat exception flags up to date.  */
-  float_exception_flags |= flags;
-
-  /* Read fpsr and initialize the cumulativeTraps.  */
-  fpsr = readFPSR();
-  cumulativeTraps = 0;
-  
-  /* For each type of exception, the cumulative trap exception bit is only
-     set if the corresponding trap enable bit is not set.  */
-  if ((!(fpsr & BIT_IXE)) && (flags & BIT_IXC))
-     cumulativeTraps |= BIT_IXC;  
-  if ((!(fpsr & BIT_UFE)) && (flags & BIT_UFC))
-     cumulativeTraps |= BIT_UFC;  
-  if ((!(fpsr & BIT_OFE)) && (flags & BIT_OFC))
-     cumulativeTraps |= BIT_OFC;  
-  if ((!(fpsr & BIT_DZE)) && (flags & BIT_DZC))
-     cumulativeTraps |= BIT_DZC;  
-  if ((!(fpsr & BIT_IOE)) && (flags & BIT_IOC))
-     cumulativeTraps |= BIT_IOC;  
-
-  /* Set the cumulative exceptions flags.  */
-  if (cumulativeTraps)
-    writeFPSR(fpsr | cumulativeTraps);
-
-  /* Raise an exception if necessary.  */
-  if (fpsr & (flags << 16))
-    fp_send_sig(SIGFPE, current, 1);
-}
-
-module_init(fpe_init);
-module_exit(fpe_exit);
diff --git a/arch/arm26/nwfpe/fpmodule.h b/arch/arm26/nwfpe/fpmodule.h
deleted file mode 100644 (file)
index f971ddd..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.com, 1998-1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __FPMODULE_H__
-#define __FPMODULE_H__
-
-
-#define REG_ORIG_R0    16
-#define REG_CPSR       15
-#define REG_PC         15
-#define REG_LR         14
-#define REG_SP         13
-#define REG_IP         12
-#define REG_FP         11
-#define REG_R10                10
-#define REG_R9         9
-#define REG_R9         9
-#define REG_R8         8
-#define REG_R7         7
-#define REG_R6         6
-#define REG_R5         5
-#define REG_R4         4
-#define REG_R3         3
-#define REG_R2         2
-#define REG_R1         1
-#define REG_R0         0
-
-#endif
diff --git a/arch/arm26/nwfpe/fpmodule.inl b/arch/arm26/nwfpe/fpmodule.inl
deleted file mode 100644 (file)
index ef22837..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-extern __inline__
-unsigned int readRegister(const unsigned int nReg)
-{
-  /* Note: The CPU thinks it has dealt with the current instruction.  As
-           a result the program counter has been advanced to the next
-           instruction, and points 4 bytes beyond the actual instruction
-           that caused the invalid instruction trap to occur.  We adjust
-           for this in this routine.  LDF/STF instructions with Rn = PC
-           depend on the PC being correct, as they use PC+8 in their 
-           address calculations. */
-  unsigned int *userRegisters = GET_USERREG();
-  unsigned int val = userRegisters[nReg];
-  if (REG_PC == nReg) val -= 4;
-  return val;
-}
-
-extern __inline__
-void writeRegister(const unsigned int nReg, const unsigned int val)
-{
-  unsigned int *userRegisters = GET_USERREG();
-  userRegisters[nReg] = val;
-}
-
-extern __inline__
-unsigned int readCPSR(void)
-{
-  return(readRegister(REG_CPSR));
-}
-
-extern __inline__
-void writeCPSR(const unsigned int val)
-{
-  writeRegister(REG_CPSR,val);
-}
-
-extern __inline__
-unsigned int readConditionCodes(void)
-{
-#ifdef __FPEM_TEST__
-   return(0);
-#else
-   return(readCPSR() & CC_MASK);
-#endif
-}
-
-extern __inline__
-void writeConditionCodes(const unsigned int val)
-{
-  unsigned int *userRegisters = GET_USERREG();
-  unsigned int rval;
-  /*
-   * Operate directly on userRegisters since
-   * the CPSR may be the PC register itself.
-   */
-  rval = userRegisters[REG_CPSR] & ~CC_MASK;
-  userRegisters[REG_CPSR] = rval | (val & CC_MASK);
-}
-
-extern __inline__
-unsigned int readMemoryInt(unsigned int *pMem)
-{
-  return *pMem;
-}
diff --git a/arch/arm26/nwfpe/fpopcode.c b/arch/arm26/nwfpe/fpopcode.c
deleted file mode 100644 (file)
index d81ddd1..0000000
+++ /dev/null
@@ -1,148 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "softfloat.h"
-#include "fpopcode.h"
-#include "fpsr.h"
-#include "fpmodule.h"
-#include "fpmodule.inl"
-
-const floatx80 floatx80Constant[] = {
-  { 0x0000, 0x0000000000000000ULL},    /* extended 0.0 */
-  { 0x3fff, 0x8000000000000000ULL},    /* extended 1.0 */
-  { 0x4000, 0x8000000000000000ULL},    /* extended 2.0 */
-  { 0x4000, 0xc000000000000000ULL},    /* extended 3.0 */
-  { 0x4001, 0x8000000000000000ULL},    /* extended 4.0 */
-  { 0x4001, 0xa000000000000000ULL},    /* extended 5.0 */
-  { 0x3ffe, 0x8000000000000000ULL},    /* extended 0.5 */
-  { 0x4002, 0xa000000000000000ULL}     /* extended 10.0 */
-};  
-
-const float64 float64Constant[] = {
-  0x0000000000000000ULL,               /* double 0.0 */
-  0x3ff0000000000000ULL,               /* double 1.0 */
-  0x4000000000000000ULL,               /* double 2.0 */
-  0x4008000000000000ULL,               /* double 3.0 */
-  0x4010000000000000ULL,               /* double 4.0 */
-  0x4014000000000000ULL,               /* double 5.0 */
-  0x3fe0000000000000ULL,               /* double 0.5 */
-  0x4024000000000000ULL                        /* double 10.0 */
-};  
-
-const float32 float32Constant[] = {
-  0x00000000,                          /* single 0.0 */
-  0x3f800000,                          /* single 1.0 */
-  0x40000000,                          /* single 2.0 */
-  0x40400000,                          /* single 3.0 */
-  0x40800000,                          /* single 4.0 */
-  0x40a00000,                          /* single 5.0 */
-  0x3f000000,                          /* single 0.5 */
-  0x41200000                           /* single 10.0 */
-};  
-
-unsigned int getTransferLength(const unsigned int opcode)
-{
-  unsigned int nRc;
-  
-  switch (opcode & MASK_TRANSFER_LENGTH)
-  {
-    case 0x00000000: nRc = 1; break; /* single precision */
-    case 0x00008000: nRc = 2; break; /* double precision */
-    case 0x00400000: nRc = 3; break; /* extended precision */
-    default: nRc = 0;
-  }
-  
-  return(nRc);
-}
-
-unsigned int getRegisterCount(const unsigned int opcode)
-{
-  unsigned int nRc;
-  
-  switch (opcode & MASK_REGISTER_COUNT)
-  {
-    case 0x00000000: nRc = 4; break;
-    case 0x00008000: nRc = 1; break;
-    case 0x00400000: nRc = 2; break;
-    case 0x00408000: nRc = 3; break;
-    default: nRc = 0;
-  }
-  
-  return(nRc);
-}
-
-unsigned int getRoundingPrecision(const unsigned int opcode)
-{
-  unsigned int nRc;
-  
-  switch (opcode & MASK_ROUNDING_PRECISION)
-  {
-    case 0x00000000: nRc = 1; break;
-    case 0x00000080: nRc = 2; break;
-    case 0x00080000: nRc = 3; break;
-    default: nRc = 0;
-  }
-  
-  return(nRc);
-}
-
-unsigned int getDestinationSize(const unsigned int opcode)
-{
-  unsigned int nRc;
-  
-  switch (opcode & MASK_DESTINATION_SIZE)
-  {
-    case 0x00000000: nRc = typeSingle; break;
-    case 0x00000080: nRc = typeDouble; break;
-    case 0x00080000: nRc = typeExtended; break;
-    default: nRc = typeNone;
-  }
-  
-  return(nRc);
-}
-
-/* condition code lookup table
- index into the table is test code: EQ, NE, ... LT, GT, AL, NV
- bit position in short is condition code: NZCV */
-static const unsigned short aCC[16] = {
-    0xF0F0, // EQ == Z set
-    0x0F0F, // NE
-    0xCCCC, // CS == C set
-    0x3333, // CC
-    0xFF00, // MI == N set
-    0x00FF, // PL
-    0xAAAA, // VS == V set
-    0x5555, // VC
-    0x0C0C, // HI == C set && Z clear
-    0xF3F3, // LS == C clear || Z set
-    0xAA55, // GE == (N==V)
-    0x55AA, // LT == (N!=V)
-    0x0A05, // GT == (!Z && (N==V))
-    0xF5FA, // LE == (Z || (N!=V))
-    0xFFFF, // AL always
-    0 // NV
-};
-
-unsigned int checkCondition(const unsigned int opcode, const unsigned int ccodes)
-{
-  return (aCC[opcode>>28] >> (ccodes>>28)) & 1;
-}
diff --git a/arch/arm26/nwfpe/fpopcode.h b/arch/arm26/nwfpe/fpopcode.h
deleted file mode 100644 (file)
index 13c7419..0000000
+++ /dev/null
@@ -1,390 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __FPOPCODE_H__
-#define __FPOPCODE_H__
-
-/*
-ARM Floating Point Instruction Classes
-| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
-|c o n d|1 1 0 P|U|u|W|L|   Rn  |v|  Fd |0|0|0|1|  o f f s e t  | CPDT
-|c o n d|1 1 0 P|U|w|W|L|   Rn  |x|  Fd |0|0|0|1|  o f f s e t  | CPDT
-| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
-|c o n d|1 1 1 0|a|b|c|d|e|  Fn |j|  Fd |0|0|0|1|f|g|h|0|i|  Fm | CPDO
-|c o n d|1 1 1 0|a|b|c|L|e|  Fn |   Rd  |0|0|0|1|f|g|h|1|i|  Fm | CPRT
-|c o n d|1 1 1 0|a|b|c|1|e|  Fn |1|1|1|1|0|0|0|1|f|g|h|1|i|  Fm | comparisons
-| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 
-
-CPDT           data transfer instructions
-               LDF, STF, LFM, SFM
-               
-CPDO           dyadic arithmetic instructions
-               ADF, MUF, SUF, RSF, DVF, RDF,
-               POW, RPW, RMF, FML, FDV, FRD, POL
-
-CPDO           monadic arithmetic instructions
-               MVF, MNF, ABS, RND, SQT, LOG, LGN, EXP,
-               SIN, COS, TAN, ASN, ACS, ATN, URD, NRM
-               
-CPRT           joint arithmetic/data transfer instructions
-               FIX (arithmetic followed by load/store)
-               FLT (load/store followed by arithmetic)
-               CMF, CNF CMFE, CNFE (comparisons)
-               WFS, RFS (write/read floating point status register)
-               WFC, RFC (write/read floating point control register)
-
-cond           condition codes
-P              pre/post index bit: 0 = postindex, 1 = preindex
-U              up/down bit: 0 = stack grows down, 1 = stack grows up
-W              write back bit: 1 = update base register (Rn)
-L              load/store bit: 0 = store, 1 = load
-Rn             base register
-Rd             destination/source register             
-Fd             floating point destination register
-Fn             floating point source register
-Fm             floating point source register or floating point constant
-
-uv             transfer length (TABLE 1)
-wx             register count (TABLE 2)
-abcd           arithmetic opcode (TABLES 3 & 4)
-ef             destination size (rounding precision) (TABLE 5)
-gh             rounding mode (TABLE 6)
-j              dyadic/monadic bit: 0 = dyadic, 1 = monadic
-i              constant bit: 1 = constant (TABLE 6)
-*/
-
-/*
-TABLE 1
-+-------------------------+---+---+---------+---------+
-|  Precision              | u | v | FPSR.EP | length  |
-+-------------------------+---+---+---------+---------+
-| Single                  | 0 ü 0 |    x    | 1 words |
-| Double                  | 1 ü 1 |    x    | 2 words |
-| Extended                | 1 ü 1 |    x    | 3 words |
-| Packed decimal          | 1 ü 1 |    0    | 3 words |
-| Expanded packed decimal | 1 ü 1 |    1    | 4 words |
-+-------------------------+---+---+---------+---------+
-Note: x = don't care
-*/
-
-/*
-TABLE 2
-+---+---+---------------------------------+
-| w | x | Number of registers to transfer |
-+---+---+---------------------------------+
-| 0 ü 1 |  1                              |
-| 1 ü 0 |  2                              |
-| 1 ü 1 |  3                              |
-| 0 ü 0 |  4                              |
-+---+---+---------------------------------+
-*/
-
-/*
-TABLE 3: Dyadic Floating Point Opcodes
-+---+---+---+---+----------+-----------------------+-----------------------+
-| a | b | c | d | Mnemonic | Description           | Operation             |
-+---+---+---+---+----------+-----------------------+-----------------------+
-| 0 | 0 | 0 | 0 | ADF      | Add                   | Fd := Fn + Fm         |
-| 0 | 0 | 0 | 1 | MUF      | Multiply              | Fd := Fn * Fm         |
-| 0 | 0 | 1 | 0 | SUF      | Subtract              | Fd := Fn - Fm         |
-| 0 | 0 | 1 | 1 | RSF      | Reverse subtract      | Fd := Fm - Fn         |
-| 0 | 1 | 0 | 0 | DVF      | Divide                | Fd := Fn / Fm         |
-| 0 | 1 | 0 | 1 | RDF      | Reverse divide        | Fd := Fm / Fn         |
-| 0 | 1 | 1 | 0 | POW      | Power                 | Fd := Fn ^ Fm         |
-| 0 | 1 | 1 | 1 | RPW      | Reverse power         | Fd := Fm ^ Fn         |
-| 1 | 0 | 0 | 0 | RMF      | Remainder             | Fd := IEEE rem(Fn/Fm) |
-| 1 | 0 | 0 | 1 | FML      | Fast Multiply         | Fd := Fn * Fm         |
-| 1 | 0 | 1 | 0 | FDV      | Fast Divide           | Fd := Fn / Fm         |
-| 1 | 0 | 1 | 1 | FRD      | Fast reverse divide   | Fd := Fm / Fn         |
-| 1 | 1 | 0 | 0 | POL      | Polar angle (ArcTan2) | Fd := arctan2(Fn,Fm)  |
-| 1 | 1 | 0 | 1 |          | undefined instruction | trap                  |
-| 1 | 1 | 1 | 0 |          | undefined instruction | trap                  |
-| 1 | 1 | 1 | 1 |          | undefined instruction | trap                  |
-+---+---+---+---+----------+-----------------------+-----------------------+
-Note: POW, RPW, POL are deprecated, and are available for backwards
-      compatibility only.
-*/
-
-/*
-TABLE 4: Monadic Floating Point Opcodes
-+---+---+---+---+----------+-----------------------+-----------------------+
-| a | b | c | d | Mnemonic | Description           | Operation             |
-+---+---+---+---+----------+-----------------------+-----------------------+
-| 0 | 0 | 0 | 0 | MVF      | Move                  | Fd := Fm              |
-| 0 | 0 | 0 | 1 | MNF      | Move negated          | Fd := - Fm            |
-| 0 | 0 | 1 | 0 | ABS      | Absolute value        | Fd := abs(Fm)         |
-| 0 | 0 | 1 | 1 | RND      | Round to integer      | Fd := int(Fm)         |
-| 0 | 1 | 0 | 0 | SQT      | Square root           | Fd := sqrt(Fm)        |
-| 0 | 1 | 0 | 1 | LOG      | Log base 10           | Fd := log10(Fm)       |
-| 0 | 1 | 1 | 0 | LGN      | Log base e            | Fd := ln(Fm)          |
-| 0 | 1 | 1 | 1 | EXP      | Exponent              | Fd := e ^ Fm          |
-| 1 | 0 | 0 | 0 | SIN      | Sine                  | Fd := sin(Fm)         |
-| 1 | 0 | 0 | 1 | COS      | Cosine                | Fd := cos(Fm)         |
-| 1 | 0 | 1 | 0 | TAN      | Tangent               | Fd := tan(Fm)         |
-| 1 | 0 | 1 | 1 | ASN      | Arc Sine              | Fd := arcsin(Fm)      |
-| 1 | 1 | 0 | 0 | ACS      | Arc Cosine            | Fd := arccos(Fm)      |
-| 1 | 1 | 0 | 1 | ATN      | Arc Tangent           | Fd := arctan(Fm)      |
-| 1 | 1 | 1 | 0 | URD      | Unnormalized round    | Fd := int(Fm)         |
-| 1 | 1 | 1 | 1 | NRM      | Normalize             | Fd := norm(Fm)        |
-+---+---+---+---+----------+-----------------------+-----------------------+
-Note: LOG, LGN, EXP, SIN, COS, TAN, ASN, ACS, ATN are deprecated, and are
-      available for backwards compatibility only.
-*/
-
-/*
-TABLE 5
-+-------------------------+---+---+
-|  Rounding Precision     | e | f |
-+-------------------------+---+---+
-| IEEE Single precision   | 0 ü 0 |
-| IEEE Double precision   | 0 ü 1 |
-| IEEE Extended precision | 1 ü 0 |
-| undefined (trap)        | 1 ü 1 |
-+-------------------------+---+---+
-*/
-
-/*
-TABLE 5
-+---------------------------------+---+---+
-|  Rounding Mode                  | g | h |
-+---------------------------------+---+---+
-| Round to nearest (default)      | 0 ü 0 |
-| Round toward plus infinity      | 0 ü 1 |
-| Round toward negative infinity  | 1 ü 0 |
-| Round toward zero               | 1 ü 1 |
-+---------------------------------+---+---+
-*/
-
-/*
-===
-=== Definitions for load and store instructions
-===
-*/
-
-/* bit masks */
-#define BIT_PREINDEX   0x01000000
-#define BIT_UP         0x00800000
-#define BIT_WRITE_BACK 0x00200000
-#define BIT_LOAD       0x00100000
-
-/* masks for load/store */
-#define MASK_CPDT              0x0c000000  /* data processing opcode */
-#define MASK_OFFSET            0x000000ff
-#define MASK_TRANSFER_LENGTH   0x00408000
-#define MASK_REGISTER_COUNT    MASK_TRANSFER_LENGTH
-#define MASK_COPROCESSOR       0x00000f00
-
-/* Tests for transfer length */
-#define TRANSFER_SINGLE                0x00000000
-#define TRANSFER_DOUBLE                0x00008000
-#define TRANSFER_EXTENDED      0x00400000
-#define TRANSFER_PACKED                MASK_TRANSFER_LENGTH
-
-/* Get the coprocessor number from the opcode. */
-#define getCoprocessorNumber(opcode)   ((opcode & MASK_COPROCESSOR) >> 8)
-
-/* Get the offset from the opcode. */
-#define getOffset(opcode)              (opcode & MASK_OFFSET)
-
-/* Tests for specific data transfer load/store opcodes. */
-#define TEST_OPCODE(opcode,mask)       (((opcode) & (mask)) == (mask))
-
-#define LOAD_OP(opcode)   TEST_OPCODE((opcode),MASK_CPDT | BIT_LOAD)
-#define STORE_OP(opcode)  ((opcode & (MASK_CPDT | BIT_LOAD)) == MASK_CPDT)
-
-#define LDF_OP(opcode) (LOAD_OP(opcode) && (getCoprocessorNumber(opcode) == 1))
-#define LFM_OP(opcode) (LOAD_OP(opcode) && (getCoprocessorNumber(opcode) == 2))
-#define STF_OP(opcode) (STORE_OP(opcode) && (getCoprocessorNumber(opcode) == 1))
-#define SFM_OP(opcode) (STORE_OP(opcode) && (getCoprocessorNumber(opcode) == 2))
-
-#define PREINDEXED(opcode)             ((opcode & BIT_PREINDEX) != 0)
-#define POSTINDEXED(opcode)            ((opcode & BIT_PREINDEX) == 0)
-#define BIT_UP_SET(opcode)             ((opcode & BIT_UP) != 0)
-#define BIT_UP_CLEAR(opcode)           ((opcode & BIT_DOWN) == 0)
-#define WRITE_BACK(opcode)             ((opcode & BIT_WRITE_BACK) != 0)
-#define LOAD(opcode)                   ((opcode & BIT_LOAD) != 0)
-#define STORE(opcode)                  ((opcode & BIT_LOAD) == 0)
-
-/*
-===
-=== Definitions for arithmetic instructions
-===
-*/
-/* bit masks */
-#define BIT_MONADIC    0x00008000
-#define BIT_CONSTANT   0x00000008
-
-#define CONSTANT_FM(opcode)            ((opcode & BIT_CONSTANT) != 0)
-#define MONADIC_INSTRUCTION(opcode)    ((opcode & BIT_MONADIC) != 0)
-
-/* instruction identification masks */
-#define MASK_CPDO              0x0e000000  /* arithmetic opcode */
-#define MASK_ARITHMETIC_OPCODE 0x00f08000
-#define MASK_DESTINATION_SIZE  0x00080080
-
-/* dyadic arithmetic opcodes. */
-#define ADF_CODE       0x00000000
-#define MUF_CODE       0x00100000
-#define SUF_CODE       0x00200000
-#define RSF_CODE       0x00300000
-#define DVF_CODE       0x00400000
-#define RDF_CODE       0x00500000
-#define POW_CODE       0x00600000
-#define RPW_CODE       0x00700000
-#define RMF_CODE       0x00800000
-#define FML_CODE       0x00900000
-#define FDV_CODE       0x00a00000
-#define FRD_CODE       0x00b00000
-#define POL_CODE       0x00c00000
-/* 0x00d00000 is an invalid dyadic arithmetic opcode */
-/* 0x00e00000 is an invalid dyadic arithmetic opcode */
-/* 0x00f00000 is an invalid dyadic arithmetic opcode */
-
-/* monadic arithmetic opcodes. */
-#define MVF_CODE       0x00008000
-#define MNF_CODE       0x00108000
-#define ABS_CODE       0x00208000
-#define RND_CODE       0x00308000
-#define SQT_CODE       0x00408000
-#define LOG_CODE       0x00508000
-#define LGN_CODE       0x00608000
-#define EXP_CODE       0x00708000
-#define SIN_CODE       0x00808000
-#define COS_CODE       0x00908000
-#define TAN_CODE       0x00a08000
-#define ASN_CODE       0x00b08000
-#define ACS_CODE       0x00c08000
-#define ATN_CODE       0x00d08000
-#define URD_CODE       0x00e08000
-#define NRM_CODE       0x00f08000
-
-/*
-===
-=== Definitions for register transfer and comparison instructions
-===
-*/
-
-#define MASK_CPRT              0x0e000010  /* register transfer opcode */
-#define MASK_CPRT_CODE         0x00f00000
-#define FLT_CODE               0x00000000
-#define FIX_CODE               0x00100000
-#define WFS_CODE               0x00200000
-#define RFS_CODE               0x00300000
-#define WFC_CODE               0x00400000
-#define RFC_CODE               0x00500000
-#define CMF_CODE               0x00900000
-#define CNF_CODE               0x00b00000
-#define CMFE_CODE              0x00d00000
-#define CNFE_CODE              0x00f00000
-
-/*
-===
-=== Common definitions
-===
-*/
-
-/* register masks */
-#define MASK_Rd                0x0000f000
-#define MASK_Rn                0x000f0000
-#define MASK_Fd                0x00007000
-#define MASK_Fm                0x00000007
-#define MASK_Fn                0x00070000
-
-/* condition code masks */
-#define CC_MASK                0xf0000000
-#define CC_NEGATIVE    0x80000000
-#define CC_ZERO                0x40000000
-#define CC_CARRY       0x20000000
-#define CC_OVERFLOW    0x10000000
-#define CC_EQ          0x00000000
-#define CC_NE          0x10000000
-#define CC_CS          0x20000000
-#define CC_HS          CC_CS
-#define CC_CC          0x30000000
-#define CC_LO          CC_CC
-#define CC_MI          0x40000000
-#define CC_PL          0x50000000
-#define CC_VS          0x60000000
-#define CC_VC          0x70000000
-#define CC_HI          0x80000000
-#define CC_LS          0x90000000
-#define CC_GE          0xa0000000
-#define CC_LT          0xb0000000
-#define CC_GT          0xc0000000
-#define CC_LE          0xd0000000
-#define CC_AL          0xe0000000
-#define CC_NV          0xf0000000
-
-/* rounding masks/values */
-#define MASK_ROUNDING_MODE     0x00000060
-#define ROUND_TO_NEAREST       0x00000000
-#define ROUND_TO_PLUS_INFINITY 0x00000020
-#define ROUND_TO_MINUS_INFINITY        0x00000040
-#define ROUND_TO_ZERO          0x00000060
-
-#define MASK_ROUNDING_PRECISION        0x00080080
-#define ROUND_SINGLE           0x00000000
-#define ROUND_DOUBLE           0x00000080
-#define ROUND_EXTENDED         0x00080000
-
-/* Get the condition code from the opcode. */
-#define getCondition(opcode)           (opcode >> 28)
-
-/* Get the source register from the opcode. */
-#define getRn(opcode)                  ((opcode & MASK_Rn) >> 16)
-
-/* Get the destination floating point register from the opcode. */
-#define getFd(opcode)                  ((opcode & MASK_Fd) >> 12)
-
-/* Get the first source floating point register from the opcode. */
-#define getFn(opcode)          ((opcode & MASK_Fn) >> 16)
-
-/* Get the second source floating point register from the opcode. */
-#define getFm(opcode)          (opcode & MASK_Fm)
-
-/* Get the destination register from the opcode. */
-#define getRd(opcode)          ((opcode & MASK_Rd) >> 12)
-
-/* Get the rounding mode from the opcode. */
-#define getRoundingMode(opcode)                ((opcode & MASK_ROUNDING_MODE) >> 5)
-
-static inline const floatx80 getExtendedConstant(const unsigned int nIndex)
-{
-   extern const floatx80 floatx80Constant[];
-   return floatx80Constant[nIndex];
-} 
-
-static inline const float64 getDoubleConstant(const unsigned int nIndex)
-{
-   extern const float64 float64Constant[];
-   return float64Constant[nIndex];
-} 
-
-static inline const float32 getSingleConstant(const unsigned int nIndex)
-{
-   extern const float32 float32Constant[];
-   return float32Constant[nIndex];
-} 
-
-extern unsigned int getRegisterCount(const unsigned int opcode);
-extern unsigned int getDestinationSize(const unsigned int opcode);
-
-#endif
diff --git a/arch/arm26/nwfpe/fpsr.h b/arch/arm26/nwfpe/fpsr.h
deleted file mode 100644 (file)
index 6dafb0f..0000000
+++ /dev/null
@@ -1,108 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.com, 1998-1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#ifndef __FPSR_H__
-#define __FPSR_H__
-
-/*
-The FPSR is a 32 bit register consisting of 4 parts, each exactly
-one byte.
-
-       SYSTEM ID
-       EXCEPTION TRAP ENABLE BYTE
-       SYSTEM CONTROL BYTE
-       CUMULATIVE EXCEPTION FLAGS BYTE
-       
-The FPCR is a 32 bit register consisting of bit flags.
-*/
-
-/* SYSTEM ID
-------------
-Note: the system id byte is read only  */
-
-typedef unsigned int FPSR;  /* type for floating point status register */
-typedef unsigned int FPCR;  /* type for floating point control register */
-
-#define MASK_SYSID             0xff000000
-#define BIT_HARDWARE           0x80000000
-#define FP_EMULATOR            0x01000000      /* System ID for emulator */ 
-#define FP_ACCELERATOR         0x81000000      /* System ID for FPA11 */
-
-/* EXCEPTION TRAP ENABLE BYTE
------------------------------ */
-
-#define MASK_TRAP_ENABLE       0x00ff0000
-#define MASK_TRAP_ENABLE_STRICT        0x001f0000
-#define BIT_IXE                0x00100000   /* inexact exception enable */
-#define BIT_UFE                0x00080000   /* underflow exception enable */
-#define BIT_OFE                0x00040000   /* overflow exception enable */
-#define BIT_DZE                0x00020000   /* divide by zero exception enable */
-#define BIT_IOE                0x00010000   /* invalid operation exception enable */
-
-/* SYSTEM CONTROL BYTE
----------------------- */
-
-#define MASK_SYSTEM_CONTROL    0x0000ff00
-#define MASK_TRAP_STRICT       0x00001f00
-
-#define BIT_AC 0x00001000      /* use alternative C-flag definition
-                                  for compares */
-#define BIT_EP 0x00000800      /* use expanded packed decimal format */
-#define BIT_SO 0x00000400      /* select synchronous operation of FPA */
-#define BIT_NE 0x00000200      /* NaN exception bit */
-#define BIT_ND 0x00000100      /* no denormalized numbers bit */
-
-/* CUMULATIVE EXCEPTION FLAGS BYTE
----------------------------------- */
-
-#define MASK_EXCEPTION_FLAGS           0x000000ff
-#define MASK_EXCEPTION_FLAGS_STRICT    0x0000001f
-
-#define BIT_IXC                0x00000010      /* inexact exception flag */
-#define BIT_UFC                0x00000008      /* underflow exception flag */
-#define BIT_OFC                0x00000004      /* overfloat exception flag */
-#define BIT_DZC                0x00000002      /* divide by zero exception flag */
-#define BIT_IOC                0x00000001      /* invalid operation exception flag */
-
-/* Floating Point Control Register
-----------------------------------*/
-
-#define BIT_RU         0x80000000      /* rounded up bit */
-#define BIT_IE         0x10000000      /* inexact bit */
-#define BIT_MO         0x08000000      /* mantissa overflow bit */
-#define BIT_EO         0x04000000      /* exponent overflow bit */
-#define BIT_SB         0x00000800      /* store bounce */
-#define BIT_AB         0x00000400      /* arithmetic bounce */
-#define BIT_RE         0x00000200      /* rounding exception */
-#define BIT_DA         0x00000100      /* disable FPA */
-
-#define MASK_OP                0x00f08010      /* AU operation code */
-#define MASK_PR                0x00080080      /* AU precision */
-#define MASK_S1                0x00070000      /* AU source register 1 */
-#define MASK_S2                0x00000007      /* AU source register 2 */
-#define MASK_DS                0x00007000      /* AU destination register */
-#define MASK_RM                0x00000060      /* AU rounding mode */
-#define MASK_ALU       0x9cfff2ff      /* only ALU can write these bits */
-#define MASK_RESET     0x00000d00      /* bits set on reset, all others cleared */
-#define MASK_WFC       MASK_RESET
-#define MASK_RFC       ~MASK_RESET
-
-#endif
diff --git a/arch/arm26/nwfpe/milieu.h b/arch/arm26/nwfpe/milieu.h
deleted file mode 100644 (file)
index a3892ab..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-
-/*
-===============================================================================
-
-This C header file is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2.
-
-Written by John R. Hauser.  This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704.  Funding was partially provided by the
-National Science Foundation under grant MIP-9311980.  The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/softfloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these three paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-/*
--------------------------------------------------------------------------------
-Include common integer types and flags.
--------------------------------------------------------------------------------
-*/
-#include "ARM-gcc.h"
-
-/*
--------------------------------------------------------------------------------
-Symbolic Boolean literals.
--------------------------------------------------------------------------------
-*/
-enum {
-    FALSE = 0,
-    TRUE  = 1
-};
-
diff --git a/arch/arm26/nwfpe/single_cpdo.c b/arch/arm26/nwfpe/single_cpdo.c
deleted file mode 100644 (file)
index 5cdcddb..0000000
+++ /dev/null
@@ -1,255 +0,0 @@
-/*
-    NetWinder Floating Point Emulator
-    (c) Rebel.COM, 1998,1999
-
-    Direct questions, comments to Scott Bambrough <scottb@netwinder.org>
-
-    This program is free software; you can redistribute it and/or modify
-    it under the terms of the GNU General Public License as published by
-    the Free Software Foundation; either version 2 of the License, or
-    (at your option) any later version.
-
-    This program is distributed in the hope that it will be useful,
-    but WITHOUT ANY WARRANTY; without even the implied warranty of
-    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-    GNU General Public License for more details.
-
-    You should have received a copy of the GNU General Public License
-    along with this program; if not, write to the Free Software
-    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
-*/
-
-#include "fpa11.h"
-#include "softfloat.h"
-#include "fpopcode.h"
-
-float32 float32_exp(float32 Fm);
-float32 float32_ln(float32 Fm);
-float32 float32_sin(float32 rFm);
-float32 float32_cos(float32 rFm);
-float32 float32_arcsin(float32 rFm);
-float32 float32_arctan(float32 rFm);
-float32 float32_log(float32 rFm);
-float32 float32_tan(float32 rFm);
-float32 float32_arccos(float32 rFm);
-float32 float32_pow(float32 rFn,float32 rFm);
-float32 float32_pol(float32 rFn,float32 rFm);
-
-unsigned int SingleCPDO(const unsigned int opcode)
-{
-   FPA11 *fpa11 = GET_FPA11();
-   float32 rFm, rFn = 0; //FIXME - should be zero?
-   unsigned int Fd, Fm, Fn, nRc = 1;
-
-   Fm = getFm(opcode);
-   if (CONSTANT_FM(opcode))
-   {
-     rFm = getSingleConstant(Fm);
-   }
-   else
-   {  
-     switch (fpa11->fType[Fm])
-     {
-        case typeSingle:
-          rFm = fpa11->fpreg[Fm].fSingle;
-        break;
-        
-        default: return 0;
-     }
-   }
-
-   if (!MONADIC_INSTRUCTION(opcode))
-   {
-      Fn = getFn(opcode);
-      switch (fpa11->fType[Fn])
-      {
-        case typeSingle:
-          rFn = fpa11->fpreg[Fn].fSingle;
-        break;
-
-        default: return 0;
-      }
-   }
-
-   Fd = getFd(opcode);
-   switch (opcode & MASK_ARITHMETIC_OPCODE)
-   {
-      /* dyadic opcodes */
-      case ADF_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_add(rFn,rFm);
-      break;
-
-      case MUF_CODE:
-      case FML_CODE:
-        fpa11->fpreg[Fd].fSingle = float32_mul(rFn,rFm);
-      break;
-
-      case SUF_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_sub(rFn,rFm);
-      break;
-
-      case RSF_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_sub(rFm,rFn);
-      break;
-
-      case DVF_CODE:
-      case FDV_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_div(rFn,rFm);
-      break;
-
-      case RDF_CODE:
-      case FRD_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_div(rFm,rFn);
-      break;
-
-#if 0
-      case POW_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_pow(rFn,rFm);
-      break;
-
-      case RPW_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_pow(rFm,rFn);
-      break;
-#endif
-
-      case RMF_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_rem(rFn,rFm);
-      break;
-
-#if 0
-      case POL_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_pol(rFn,rFm);
-      break;
-#endif
-
-      /* monadic opcodes */
-      case MVF_CODE:
-         fpa11->fpreg[Fd].fSingle = rFm;
-      break;
-
-      case MNF_CODE:
-         rFm ^= 0x80000000;
-         fpa11->fpreg[Fd].fSingle = rFm;
-      break;
-
-      case ABS_CODE:
-         rFm &= 0x7fffffff;
-         fpa11->fpreg[Fd].fSingle = rFm;
-      break;
-
-      case RND_CODE:
-      case URD_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_round_to_int(rFm);
-      break;
-
-      case SQT_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_sqrt(rFm);
-      break;
-
-#if 0
-      case LOG_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_log(rFm);
-      break;
-
-      case LGN_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_ln(rFm);
-      break;
-
-      case EXP_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_exp(rFm);
-      break;
-
-      case SIN_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_sin(rFm);
-      break;
-
-      case COS_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_cos(rFm);
-      break;
-
-      case TAN_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_tan(rFm);
-      break;
-
-      case ASN_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_arcsin(rFm);
-      break;
-
-      case ACS_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_arccos(rFm);
-      break;
-
-      case ATN_CODE:
-         fpa11->fpreg[Fd].fSingle = float32_arctan(rFm);
-      break;
-#endif
-
-      case NRM_CODE:
-      break;
-      
-      default:
-      {
-        nRc = 0;
-      }
-   }
-
-   if (0 != nRc) fpa11->fType[Fd] = typeSingle;
-   return nRc;
-}
-
-#if 0
-float32 float32_exp(float32 Fm)
-{
-//series
-}
-
-float32 float32_ln(float32 Fm)
-{
-//series
-}
-
-float32 float32_sin(float32 rFm)
-{
-//series
-}
-
-float32 float32_cos(float32 rFm)
-{
-//series
-}
-
-float32 float32_arcsin(float32 rFm)
-{
-//series
-}
-
-float32 float32_arctan(float32 rFm)
-{
-  //series
-}
-
-float32 float32_arccos(float32 rFm)
-{
-   //return float32_sub(halfPi,float32_arcsin(rFm));
-}
-
-float32 float32_log(float32 rFm)
-{
-  return float32_div(float32_ln(rFm),getSingleConstant(7));
-}
-
-float32 float32_tan(float32 rFm)
-{
-  return float32_div(float32_sin(rFm),float32_cos(rFm));
-}
-
-float32 float32_pow(float32 rFn,float32 rFm)
-{
-  return float32_exp(float32_mul(rFm,float32_ln(rFn))); 
-}
-
-float32 float32_pol(float32 rFn,float32 rFm)
-{
-  return float32_arctan(float32_div(rFn,rFm)); 
-}
-#endif
diff --git a/arch/arm26/nwfpe/softfloat-macros b/arch/arm26/nwfpe/softfloat-macros
deleted file mode 100644 (file)
index 5469989..0000000
+++ /dev/null
@@ -1,740 +0,0 @@
-
-/*
-===============================================================================
-
-This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2.
-
-Written by John R. Hauser.  This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704.  Funding was partially provided by the
-National Science Foundation under grant MIP-9311980.  The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/softfloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these three paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-/*
--------------------------------------------------------------------------------
-Shifts `a' right by the number of bits given in `count'.  If any nonzero
-bits are shifted off, they are ``jammed'' into the least significant bit of
-the result by setting the least significant bit to 1.  The value of `count'
-can be arbitrarily large; in particular, if `count' is greater than 32, the
-result will be either 0 or 1, depending on whether `a' is zero or nonzero.
-The result is stored in the location pointed to by `zPtr'.
--------------------------------------------------------------------------------
-*/
-INLINE void shift32RightJamming( bits32 a, int16 count, bits32 *zPtr )
-{
-    bits32 z;
-    if ( count == 0 ) {
-        z = a;
-    }
-    else if ( count < 32 ) {
-        z = ( a>>count ) | ( ( a<<( ( - count ) & 31 ) ) != 0 );
-    }
-    else {
-        z = ( a != 0 );
-    }
-    *zPtr = z;
-}
-
-/*
--------------------------------------------------------------------------------
-Shifts `a' right by the number of bits given in `count'.  If any nonzero
-bits are shifted off, they are ``jammed'' into the least significant bit of
-the result by setting the least significant bit to 1.  The value of `count'
-can be arbitrarily large; in particular, if `count' is greater than 64, the
-result will be either 0 or 1, depending on whether `a' is zero or nonzero.
-The result is stored in the location pointed to by `zPtr'.
--------------------------------------------------------------------------------
-*/
-INLINE void shift64RightJamming( bits64 a, int16 count, bits64 *zPtr )
-{
-    bits64 z;
-
- __asm__("@shift64RightJamming -- start");   
-    if ( count == 0 ) {
-        z = a;
-    }
-    else if ( count < 64 ) {
-        z = ( a>>count ) | ( ( a<<( ( - count ) & 63 ) ) != 0 );
-    }
-    else {
-        z = ( a != 0 );
-    }
- __asm__("@shift64RightJamming -- end");   
-    *zPtr = z;
-}
-
-/*
--------------------------------------------------------------------------------
-Shifts the 128-bit value formed by concatenating `a0' and `a1' right by 64
-_plus_ the number of bits given in `count'.  The shifted result is at most
-64 nonzero bits; this is stored at the location pointed to by `z0Ptr'.  The
-bits shifted off form a second 64-bit result as follows:  The _last_ bit
-shifted off is the most-significant bit of the extra result, and the other
-63 bits of the extra result are all zero if and only if _all_but_the_last_
-bits shifted off were all zero.  This extra result is stored in the location
-pointed to by `z1Ptr'.  The value of `count' can be arbitrarily large.
-    (This routine makes more sense if `a0' and `a1' are considered to form a
-fixed-point value with binary point between `a0' and `a1'.  This fixed-point
-value is shifted right by the number of bits given in `count', and the
-integer part of the result is returned at the location pointed to by
-`z0Ptr'.  The fractional part of the result may be slightly corrupted as
-described above, and is returned at the location pointed to by `z1Ptr'.)
--------------------------------------------------------------------------------
-*/
-INLINE void
- shift64ExtraRightJamming(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
-{
-    bits64 z0, z1;
-    int8 negCount = ( - count ) & 63;
-
-    if ( count == 0 ) {
-        z1 = a1;
-        z0 = a0;
-    }
-    else if ( count < 64 ) {
-        z1 = ( a0<<negCount ) | ( a1 != 0 );
-        z0 = a0>>count;
-    }
-    else {
-        if ( count == 64 ) {
-            z1 = a0 | ( a1 != 0 );
-        }
-        else {
-            z1 = ( ( a0 | a1 ) != 0 );
-        }
-        z0 = 0;
-    }
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Shifts the 128-bit value formed by concatenating `a0' and `a1' right by the
-number of bits given in `count'.  Any bits shifted off are lost.  The value
-of `count' can be arbitrarily large; in particular, if `count' is greater
-than 128, the result will be 0.  The result is broken into two 64-bit pieces
-which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- shift128Right(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
-{
-    bits64 z0, z1;
-    int8 negCount = ( - count ) & 63;
-
-    if ( count == 0 ) {
-        z1 = a1;
-        z0 = a0;
-    }
-    else if ( count < 64 ) {
-        z1 = ( a0<<negCount ) | ( a1>>count );
-        z0 = a0>>count;
-    }
-    else {
-        z1 = ( count < 64 ) ? ( a0>>( count & 63 ) ) : 0;
-        z0 = 0;
-    }
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Shifts the 128-bit value formed by concatenating `a0' and `a1' right by the
-number of bits given in `count'.  If any nonzero bits are shifted off, they
-are ``jammed'' into the least significant bit of the result by setting the
-least significant bit to 1.  The value of `count' can be arbitrarily large;
-in particular, if `count' is greater than 128, the result will be either 0
-or 1, depending on whether the concatenation of `a0' and `a1' is zero or
-nonzero.  The result is broken into two 64-bit pieces which are stored at
-the locations pointed to by `z0Ptr' and `z1Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- shift128RightJamming(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
-{
-    bits64 z0, z1;
-    int8 negCount = ( - count ) & 63;
-
-    if ( count == 0 ) {
-        z1 = a1;
-        z0 = a0;
-    }
-    else if ( count < 64 ) {
-        z1 = ( a0<<negCount ) | ( a1>>count ) | ( ( a1<<negCount ) != 0 );
-        z0 = a0>>count;
-    }
-    else {
-        if ( count == 64 ) {
-            z1 = a0 | ( a1 != 0 );
-        }
-        else if ( count < 128 ) {
-            z1 = ( a0>>( count & 63 ) ) | ( ( ( a0<<negCount ) | a1 ) != 0 );
-        }
-        else {
-            z1 = ( ( a0 | a1 ) != 0 );
-        }
-        z0 = 0;
-    }
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Shifts the 192-bit value formed by concatenating `a0', `a1', and `a2' right
-by 64 _plus_ the number of bits given in `count'.  The shifted result is
-at most 128 nonzero bits; these are broken into two 64-bit pieces which are
-stored at the locations pointed to by `z0Ptr' and `z1Ptr'.  The bits shifted
-off form a third 64-bit result as follows:  The _last_ bit shifted off is
-the most-significant bit of the extra result, and the other 63 bits of the
-extra result are all zero if and only if _all_but_the_last_ bits shifted off
-were all zero.  This extra result is stored in the location pointed to by
-`z2Ptr'.  The value of `count' can be arbitrarily large.
-    (This routine makes more sense if `a0', `a1', and `a2' are considered
-to form a fixed-point value with binary point between `a1' and `a2'.  This
-fixed-point value is shifted right by the number of bits given in `count',
-and the integer part of the result is returned at the locations pointed to
-by `z0Ptr' and `z1Ptr'.  The fractional part of the result may be slightly
-corrupted as described above, and is returned at the location pointed to by
-`z2Ptr'.)
--------------------------------------------------------------------------------
-*/
-INLINE void
- shift128ExtraRightJamming(
-     bits64 a0,
-     bits64 a1,
-     bits64 a2,
-     int16 count,
-     bits64 *z0Ptr,
-     bits64 *z1Ptr,
-     bits64 *z2Ptr
- )
-{
-    bits64 z0, z1, z2;
-    int8 negCount = ( - count ) & 63;
-
-    if ( count == 0 ) {
-        z2 = a2;
-        z1 = a1;
-        z0 = a0;
-    }
-    else {
-        if ( count < 64 ) {
-            z2 = a1<<negCount;
-            z1 = ( a0<<negCount ) | ( a1>>count );
-            z0 = a0>>count;
-        }
-        else {
-            if ( count == 64 ) {
-                z2 = a1;
-                z1 = a0;
-            }
-            else {
-                a2 |= a1;
-                if ( count < 128 ) {
-                    z2 = a0<<negCount;
-                    z1 = a0>>( count & 63 );
-                }
-                else {
-                    z2 = ( count == 128 ) ? a0 : ( a0 != 0 );
-                    z1 = 0;
-                }
-            }
-            z0 = 0;
-        }
-        z2 |= ( a2 != 0 );
-    }
-    *z2Ptr = z2;
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Shifts the 128-bit value formed by concatenating `a0' and `a1' left by the
-number of bits given in `count'.  Any bits shifted off are lost.  The value
-of `count' must be less than 64.  The result is broken into two 64-bit
-pieces which are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- shortShift128Left(
-     bits64 a0, bits64 a1, int16 count, bits64 *z0Ptr, bits64 *z1Ptr )
-{
-
-    *z1Ptr = a1<<count;
-    *z0Ptr =
-        ( count == 0 ) ? a0 : ( a0<<count ) | ( a1>>( ( - count ) & 63 ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Shifts the 192-bit value formed by concatenating `a0', `a1', and `a2' left
-by the number of bits given in `count'.  Any bits shifted off are lost.
-The value of `count' must be less than 64.  The result is broken into three
-64-bit pieces which are stored at the locations pointed to by `z0Ptr',
-`z1Ptr', and `z2Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- shortShift192Left(
-     bits64 a0,
-     bits64 a1,
-     bits64 a2,
-     int16 count,
-     bits64 *z0Ptr,
-     bits64 *z1Ptr,
-     bits64 *z2Ptr
- )
-{
-    bits64 z0, z1, z2;
-    int8 negCount;
-
-    z2 = a2<<count;
-    z1 = a1<<count;
-    z0 = a0<<count;
-    if ( 0 < count ) {
-        negCount = ( ( - count ) & 63 );
-        z1 |= a2>>negCount;
-        z0 |= a1>>negCount;
-    }
-    *z2Ptr = z2;
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Adds the 128-bit value formed by concatenating `a0' and `a1' to the 128-bit
-value formed by concatenating `b0' and `b1'.  Addition is modulo 2^128, so
-any carry out is lost.  The result is broken into two 64-bit pieces which
-are stored at the locations pointed to by `z0Ptr' and `z1Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- add128(
-     bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 *z0Ptr, bits64 *z1Ptr )
-{
-    bits64 z1;
-
-    z1 = a1 + b1;
-    *z1Ptr = z1;
-    *z0Ptr = a0 + b0 + ( z1 < a1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Adds the 192-bit value formed by concatenating `a0', `a1', and `a2' to the
-192-bit value formed by concatenating `b0', `b1', and `b2'.  Addition is
-modulo 2^192, so any carry out is lost.  The result is broken into three
-64-bit pieces which are stored at the locations pointed to by `z0Ptr',
-`z1Ptr', and `z2Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- add192(
-     bits64 a0,
-     bits64 a1,
-     bits64 a2,
-     bits64 b0,
-     bits64 b1,
-     bits64 b2,
-     bits64 *z0Ptr,
-     bits64 *z1Ptr,
-     bits64 *z2Ptr
- )
-{
-    bits64 z0, z1, z2;
-    int8 carry0, carry1;
-
-    z2 = a2 + b2;
-    carry1 = ( z2 < a2 );
-    z1 = a1 + b1;
-    carry0 = ( z1 < a1 );
-    z0 = a0 + b0;
-    z1 += carry1;
-    z0 += ( z1 < carry1 );
-    z0 += carry0;
-    *z2Ptr = z2;
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Subtracts the 128-bit value formed by concatenating `b0' and `b1' from the
-128-bit value formed by concatenating `a0' and `a1'.  Subtraction is modulo
-2^128, so any borrow out (carry out) is lost.  The result is broken into two
-64-bit pieces which are stored at the locations pointed to by `z0Ptr' and
-`z1Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- sub128(
-     bits64 a0, bits64 a1, bits64 b0, bits64 b1, bits64 *z0Ptr, bits64 *z1Ptr )
-{
-
-    *z1Ptr = a1 - b1;
-    *z0Ptr = a0 - b0 - ( a1 < b1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Subtracts the 192-bit value formed by concatenating `b0', `b1', and `b2'
-from the 192-bit value formed by concatenating `a0', `a1', and `a2'.
-Subtraction is modulo 2^192, so any borrow out (carry out) is lost.  The
-result is broken into three 64-bit pieces which are stored at the locations
-pointed to by `z0Ptr', `z1Ptr', and `z2Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- sub192(
-     bits64 a0,
-     bits64 a1,
-     bits64 a2,
-     bits64 b0,
-     bits64 b1,
-     bits64 b2,
-     bits64 *z0Ptr,
-     bits64 *z1Ptr,
-     bits64 *z2Ptr
- )
-{
-    bits64 z0, z1, z2;
-    int8 borrow0, borrow1;
-
-    z2 = a2 - b2;
-    borrow1 = ( a2 < b2 );
-    z1 = a1 - b1;
-    borrow0 = ( a1 < b1 );
-    z0 = a0 - b0;
-    z0 -= ( z1 < borrow1 );
-    z1 -= borrow1;
-    z0 -= borrow0;
-    *z2Ptr = z2;
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Multiplies `a' by `b' to obtain a 128-bit product.  The product is broken
-into two 64-bit pieces which are stored at the locations pointed to by
-`z0Ptr' and `z1Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void mul64To128( bits64 a, bits64 b, bits64 *z0Ptr, bits64 *z1Ptr )
-{
-    bits32 aHigh, aLow, bHigh, bLow;
-    bits64 z0, zMiddleA, zMiddleB, z1;
-
-    aLow = a;
-    aHigh = a>>32;
-    bLow = b;
-    bHigh = b>>32;
-    z1 = ( (bits64) aLow ) * bLow;
-    zMiddleA = ( (bits64) aLow ) * bHigh;
-    zMiddleB = ( (bits64) aHigh ) * bLow;
-    z0 = ( (bits64) aHigh ) * bHigh;
-    zMiddleA += zMiddleB;
-    z0 += ( ( (bits64) ( zMiddleA < zMiddleB ) )<<32 ) + ( zMiddleA>>32 );
-    zMiddleA <<= 32;
-    z1 += zMiddleA;
-    z0 += ( z1 < zMiddleA );
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Multiplies the 128-bit value formed by concatenating `a0' and `a1' by `b' to
-obtain a 192-bit product.  The product is broken into three 64-bit pieces
-which are stored at the locations pointed to by `z0Ptr', `z1Ptr', and
-`z2Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- mul128By64To192(
-     bits64 a0,
-     bits64 a1,
-     bits64 b,
-     bits64 *z0Ptr,
-     bits64 *z1Ptr,
-     bits64 *z2Ptr
- )
-{
-    bits64 z0, z1, z2, more1;
-
-    mul64To128( a1, b, &z1, &z2 );
-    mul64To128( a0, b, &z0, &more1 );
-    add128( z0, more1, 0, z1, &z0, &z1 );
-    *z2Ptr = z2;
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Multiplies the 128-bit value formed by concatenating `a0' and `a1' to the
-128-bit value formed by concatenating `b0' and `b1' to obtain a 256-bit
-product.  The product is broken into four 64-bit pieces which are stored at
-the locations pointed to by `z0Ptr', `z1Ptr', `z2Ptr', and `z3Ptr'.
--------------------------------------------------------------------------------
-*/
-INLINE void
- mul128To256(
-     bits64 a0,
-     bits64 a1,
-     bits64 b0,
-     bits64 b1,
-     bits64 *z0Ptr,
-     bits64 *z1Ptr,
-     bits64 *z2Ptr,
-     bits64 *z3Ptr
- )
-{
-    bits64 z0, z1, z2, z3;
-    bits64 more1, more2;
-
-    mul64To128( a1, b1, &z2, &z3 );
-    mul64To128( a1, b0, &z1, &more2 );
-    add128( z1, more2, 0, z2, &z1, &z2 );
-    mul64To128( a0, b0, &z0, &more1 );
-    add128( z0, more1, 0, z1, &z0, &z1 );
-    mul64To128( a0, b1, &more1, &more2 );
-    add128( more1, more2, 0, z2, &more1, &z2 );
-    add128( z0, z1, 0, more1, &z0, &z1 );
-    *z3Ptr = z3;
-    *z2Ptr = z2;
-    *z1Ptr = z1;
-    *z0Ptr = z0;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns an approximation to the 64-bit integer quotient obtained by dividing
-`b' into the 128-bit value formed by concatenating `a0' and `a1'.  The
-divisor `b' must be at least 2^63.  If q is the exact quotient truncated
-toward zero, the approximation returned lies between q and q + 2 inclusive.
-If the exact quotient q is larger than 64 bits, the maximum positive 64-bit
-unsigned integer is returned.
--------------------------------------------------------------------------------
-*/
-static bits64 estimateDiv128To64( bits64 a0, bits64 a1, bits64 b )
-{
-    bits64 b0, b1;
-    bits64 rem0, rem1, term0, term1;
-    bits64 z;
-    if ( b <= a0 ) return LIT64( 0xFFFFFFFFFFFFFFFF );
-    b0 = b>>32;
-    z = ( b0<<32 <= a0 ) ? LIT64( 0xFFFFFFFF00000000 ) : ( a0 / b0 )<<32;
-    mul64To128( b, z, &term0, &term1 );
-    sub128( a0, a1, term0, term1, &rem0, &rem1 );
-    while ( ( (sbits64) rem0 ) < 0 ) {
-        z -= LIT64( 0x100000000 );
-        b1 = b<<32;
-        add128( rem0, rem1, b0, b1, &rem0, &rem1 );
-    }
-    rem0 = ( rem0<<32 ) | ( rem1>>32 );
-    z |= ( b0<<32 <= rem0 ) ? 0xFFFFFFFF : rem0 / b0;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns an approximation to the square root of the 32-bit significand given
-by `a'.  Considered as an integer, `a' must be at least 2^31.  If bit 0 of
-`aExp' (the least significant bit) is 1, the integer returned approximates
-2^31*sqrt(`a'/2^31), where `a' is considered an integer.  If bit 0 of `aExp'
-is 0, the integer returned approximates 2^31*sqrt(`a'/2^30).  In either
-case, the approximation returned lies strictly within +/-2 of the exact
-value.
--------------------------------------------------------------------------------
-*/
-static bits32 estimateSqrt32( int16 aExp, bits32 a )
-{
-    static const bits16 sqrtOddAdjustments[] = {
-        0x0004, 0x0022, 0x005D, 0x00B1, 0x011D, 0x019F, 0x0236, 0x02E0,
-        0x039C, 0x0468, 0x0545, 0x0631, 0x072B, 0x0832, 0x0946, 0x0A67
-    };
-    static const bits16 sqrtEvenAdjustments[] = {
-        0x0A2D, 0x08AF, 0x075A, 0x0629, 0x051A, 0x0429, 0x0356, 0x029E,
-        0x0200, 0x0179, 0x0109, 0x00AF, 0x0068, 0x0034, 0x0012, 0x0002
-    };
-    int8 index;
-    bits32 z;
-
-    index = ( a>>27 ) & 15;
-    if ( aExp & 1 ) {
-        z = 0x4000 + ( a>>17 ) - sqrtOddAdjustments[ index ];
-        z = ( ( a / z )<<14 ) + ( z<<15 );
-        a >>= 1;
-    }
-    else {
-        z = 0x8000 + ( a>>17 ) - sqrtEvenAdjustments[ index ];
-        z = a / z + z;
-        z = ( 0x20000 <= z ) ? 0xFFFF8000 : ( z<<15 );
-        if ( z <= a ) return (bits32) ( ( (sbits32) a )>>1 );
-    }
-    return ( (bits32) ( ( ( (bits64) a )<<31 ) / z ) ) + ( z>>1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the number of leading 0 bits before the most-significant 1 bit
-of `a'.  If `a' is zero, 32 is returned.
--------------------------------------------------------------------------------
-*/
-static int8 countLeadingZeros32( bits32 a )
-{
-    static const int8 countLeadingZerosHigh[] = {
-        8, 7, 6, 6, 5, 5, 5, 5, 4, 4, 4, 4, 4, 4, 4, 4,
-        3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3, 3,
-        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-        2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2, 2,
-        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-        1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
-        0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
-    };
-    int8 shiftCount;
-
-    shiftCount = 0;
-    if ( a < 0x10000 ) {
-        shiftCount += 16;
-        a <<= 16;
-    }
-    if ( a < 0x1000000 ) {
-        shiftCount += 8;
-        a <<= 8;
-    }
-    shiftCount += countLeadingZerosHigh[ a>>24 ];
-    return shiftCount;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the number of leading 0 bits before the most-significant 1 bit
-of `a'.  If `a' is zero, 64 is returned.
--------------------------------------------------------------------------------
-*/
-static int8 countLeadingZeros64( bits64 a )
-{
-    int8 shiftCount;
-
-    shiftCount = 0;
-    if ( a < ( (bits64) 1 )<<32 ) {
-        shiftCount += 32;
-    }
-    else {
-        a >>= 32;
-    }
-    shiftCount += countLeadingZeros32( a );
-    return shiftCount;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the 128-bit value formed by concatenating `a0' and `a1'
-is equal to the 128-bit value formed by concatenating `b0' and `b1'.
-Otherwise, returns 0.
--------------------------------------------------------------------------------
-*/
-INLINE flag eq128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
-{
-
-    return ( a0 == b0 ) && ( a1 == b1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is less
-than or equal to the 128-bit value formed by concatenating `b0' and `b1'.
-Otherwise, returns 0.
--------------------------------------------------------------------------------
-*/
-INLINE flag le128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
-{
-
-    return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 <= b1 ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is less
-than the 128-bit value formed by concatenating `b0' and `b1'.  Otherwise,
-returns 0.
--------------------------------------------------------------------------------
-*/
-INLINE flag lt128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
-{
-
-    return ( a0 < b0 ) || ( ( a0 == b0 ) && ( a1 < b1 ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the 128-bit value formed by concatenating `a0' and `a1' is
-not equal to the 128-bit value formed by concatenating `b0' and `b1'.
-Otherwise, returns 0.
--------------------------------------------------------------------------------
-*/
-INLINE flag ne128( bits64 a0, bits64 a1, bits64 b0, bits64 b1 )
-{
-
-    return ( a0 != b0 ) || ( a1 != b1 );
-
-}
-
diff --git a/arch/arm26/nwfpe/softfloat-specialize b/arch/arm26/nwfpe/softfloat-specialize
deleted file mode 100644 (file)
index acf4091..0000000
+++ /dev/null
@@ -1,366 +0,0 @@
-
-/*
-===============================================================================
-
-This C source fragment is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2.
-
-Written by John R. Hauser.  This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704.  Funding was partially provided by the
-National Science Foundation under grant MIP-9311980.  The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/softfloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these three paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-/*
--------------------------------------------------------------------------------
-Underflow tininess-detection mode, statically initialized to default value.
-(The declaration in `softfloat.h' must match the `int8' type here.)
--------------------------------------------------------------------------------
-*/
-int8 float_detect_tininess = float_tininess_after_rounding;
-
-/*
--------------------------------------------------------------------------------
-Raises the exceptions specified by `flags'.  Floating-point traps can be
-defined here if desired.  It is currently not possible for such a trap to
-substitute a result value.  If traps are not implemented, this routine
-should be simply `float_exception_flags |= flags;'.
-
-ScottB:  November 4, 1998
-Moved this function out of softfloat-specialize into fpmodule.c.
-This effectively isolates all the changes required for integrating with the
-Linux kernel into fpmodule.c.  Porting to NetBSD should only require modifying
-fpmodule.c to integrate with the NetBSD kernel (I hope!).
--------------------------------------------------------------------------------
-void float_raise( int8 flags )
-{
-    float_exception_flags |= flags;
-}
-*/
-
-/*
--------------------------------------------------------------------------------
-Internal canonical NaN format.
--------------------------------------------------------------------------------
-*/
-typedef struct {
-    flag sign;
-    bits64 high, low;
-} commonNaNT;
-
-/*
--------------------------------------------------------------------------------
-The pattern for a default generated single-precision NaN.
--------------------------------------------------------------------------------
-*/
-#define float32_default_nan 0xFFFFFFFF
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is a NaN;
-otherwise returns 0.
--------------------------------------------------------------------------------
-*/
-flag float32_is_nan( float32 a )
-{
-
-    return ( 0xFF000000 < (bits32) ( a<<1 ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is a signaling
-NaN; otherwise returns 0.
--------------------------------------------------------------------------------
-*/
-flag float32_is_signaling_nan( float32 a )
-{
-
-    return ( ( ( a>>22 ) & 0x1FF ) == 0x1FE ) && ( a & 0x003FFFFF );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the single-precision floating-point NaN
-`a' to the canonical NaN format.  If `a' is a signaling NaN, the invalid
-exception is raised.
--------------------------------------------------------------------------------
-*/
-static commonNaNT float32ToCommonNaN( float32 a )
-{
-    commonNaNT z;
-
-    if ( float32_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
-    z.sign = a>>31;
-    z.low = 0;
-    z.high = ( (bits64) a )<<41;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the canonical NaN `a' to the single-
-precision floating-point format.
--------------------------------------------------------------------------------
-*/
-static float32 commonNaNToFloat32( commonNaNT a )
-{
-
-    return ( ( (bits32) a.sign )<<31 ) | 0x7FC00000 | ( a.high>>41 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Takes two single-precision floating-point values `a' and `b', one of which
-is a NaN, and returns the appropriate NaN result.  If either `a' or `b' is a
-signaling NaN, the invalid exception is raised.
--------------------------------------------------------------------------------
-*/
-static float32 propagateFloat32NaN( float32 a, float32 b )
-{
-    flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
-
-    aIsNaN = float32_is_nan( a );
-    aIsSignalingNaN = float32_is_signaling_nan( a );
-    bIsNaN = float32_is_nan( b );
-    bIsSignalingNaN = float32_is_signaling_nan( b );
-    a |= 0x00400000;
-    b |= 0x00400000;
-    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
-    if ( aIsNaN ) {
-        return ( aIsSignalingNaN & bIsNaN ) ? b : a;
-    }
-    else {
-        return b;
-    }
-
-}
-
-/*
--------------------------------------------------------------------------------
-The pattern for a default generated double-precision NaN.
--------------------------------------------------------------------------------
-*/
-#define float64_default_nan LIT64( 0xFFFFFFFFFFFFFFFF )
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is a NaN;
-otherwise returns 0.
--------------------------------------------------------------------------------
-*/
-flag float64_is_nan( float64 a )
-{
-
-    return ( LIT64( 0xFFE0000000000000 ) < (bits64) ( a<<1 ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is a signaling
-NaN; otherwise returns 0.
--------------------------------------------------------------------------------
-*/
-flag float64_is_signaling_nan( float64 a )
-{
-
-    return
-           ( ( ( a>>51 ) & 0xFFF ) == 0xFFE )
-        && ( a & LIT64( 0x0007FFFFFFFFFFFF ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the double-precision floating-point NaN
-`a' to the canonical NaN format.  If `a' is a signaling NaN, the invalid
-exception is raised.
--------------------------------------------------------------------------------
-*/
-static commonNaNT float64ToCommonNaN( float64 a )
-{
-    commonNaNT z;
-
-    if ( float64_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
-    z.sign = a>>63;
-    z.low = 0;
-    z.high = a<<12;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the canonical NaN `a' to the double-
-precision floating-point format.
--------------------------------------------------------------------------------
-*/
-static float64 commonNaNToFloat64( commonNaNT a )
-{
-
-    return
-          ( ( (bits64) a.sign )<<63 )
-        | LIT64( 0x7FF8000000000000 )
-        | ( a.high>>12 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Takes two double-precision floating-point values `a' and `b', one of which
-is a NaN, and returns the appropriate NaN result.  If either `a' or `b' is a
-signaling NaN, the invalid exception is raised.
--------------------------------------------------------------------------------
-*/
-static float64 propagateFloat64NaN( float64 a, float64 b )
-{
-    flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
-
-    aIsNaN = float64_is_nan( a );
-    aIsSignalingNaN = float64_is_signaling_nan( a );
-    bIsNaN = float64_is_nan( b );
-    bIsSignalingNaN = float64_is_signaling_nan( b );
-    a |= LIT64( 0x0008000000000000 );
-    b |= LIT64( 0x0008000000000000 );
-    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
-    if ( aIsNaN ) {
-        return ( aIsSignalingNaN & bIsNaN ) ? b : a;
-    }
-    else {
-        return b;
-    }
-
-}
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-The pattern for a default generated extended double-precision NaN.  The
-`high' and `low' values hold the most- and least-significant bits,
-respectively.
--------------------------------------------------------------------------------
-*/
-#define floatx80_default_nan_high 0xFFFF
-#define floatx80_default_nan_low  LIT64( 0xFFFFFFFFFFFFFFFF )
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is a
-NaN; otherwise returns 0.
--------------------------------------------------------------------------------
-*/
-flag floatx80_is_nan( floatx80 a )
-{
-
-    return ( ( a.high & 0x7FFF ) == 0x7FFF ) && (bits64) ( a.low<<1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is a
-signaling NaN; otherwise returns 0.
--------------------------------------------------------------------------------
-*/
-flag floatx80_is_signaling_nan( floatx80 a )
-{
-    //register int lr;
-    bits64 aLow;
-
-    //__asm__("mov %0, lr" : : "g" (lr));
-    //fp_printk("floatx80_is_signalling_nan() called from 0x%08x\n",lr);
-    aLow = a.low & ~ LIT64( 0x4000000000000000 );
-    return
-           ( ( a.high & 0x7FFF ) == 0x7FFF )
-        && (bits64) ( aLow<<1 )
-        && ( a.low == aLow );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the extended double-precision floating-
-point NaN `a' to the canonical NaN format.  If `a' is a signaling NaN, the
-invalid exception is raised.
--------------------------------------------------------------------------------
-*/
-static commonNaNT floatx80ToCommonNaN( floatx80 a )
-{
-    commonNaNT z;
-
-    if ( floatx80_is_signaling_nan( a ) ) float_raise( float_flag_invalid );
-    z.sign = a.high>>15;
-    z.low = 0;
-    z.high = a.low<<1;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the canonical NaN `a' to the extended
-double-precision floating-point format.
--------------------------------------------------------------------------------
-*/
-static floatx80 commonNaNToFloatx80( commonNaNT a )
-{
-    floatx80 z;
-
-    z.low = LIT64( 0xC000000000000000 ) | ( a.high>>1 );
-    z.high = ( ( (bits16) a.sign )<<15 ) | 0x7FFF;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Takes two extended double-precision floating-point values `a' and `b', one
-of which is a NaN, and returns the appropriate NaN result.  If either `a' or
-`b' is a signaling NaN, the invalid exception is raised.
--------------------------------------------------------------------------------
-*/
-static floatx80 propagateFloatx80NaN( floatx80 a, floatx80 b )
-{
-    flag aIsNaN, aIsSignalingNaN, bIsNaN, bIsSignalingNaN;
-
-    aIsNaN = floatx80_is_nan( a );
-    aIsSignalingNaN = floatx80_is_signaling_nan( a );
-    bIsNaN = floatx80_is_nan( b );
-    bIsSignalingNaN = floatx80_is_signaling_nan( b );
-    a.low |= LIT64( 0xC000000000000000 );
-    b.low |= LIT64( 0xC000000000000000 );
-    if ( aIsSignalingNaN | bIsSignalingNaN ) float_raise( float_flag_invalid );
-    if ( aIsNaN ) {
-        return ( aIsSignalingNaN & bIsNaN ) ? b : a;
-    }
-    else {
-        return b;
-    }
-
-}
-
-#endif
diff --git a/arch/arm26/nwfpe/softfloat.c b/arch/arm26/nwfpe/softfloat.c
deleted file mode 100644 (file)
index 26c1b91..0000000
+++ /dev/null
@@ -1,3439 +0,0 @@
-/*
-===============================================================================
-
-This C source file is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2.
-
-Written by John R. Hauser.  This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704.  Funding was partially provided by the
-National Science Foundation under grant MIP-9311980.  The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/softfloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these three paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-#include "fpa11.h"
-#include "milieu.h"
-#include "softfloat.h"
-
-/*
--------------------------------------------------------------------------------
-Floating-point rounding mode, extended double-precision rounding precision,
-and exception flags.
--------------------------------------------------------------------------------
-*/
-int8 float_rounding_mode = float_round_nearest_even;
-int8 floatx80_rounding_precision = 80;
-int8 float_exception_flags;
-
-/*
--------------------------------------------------------------------------------
-Primitive arithmetic functions, including multi-word arithmetic, and
-division and square root approximations.  (Can be specialized to target if
-desired.)
--------------------------------------------------------------------------------
-*/
-#include "softfloat-macros"
-
-/*
--------------------------------------------------------------------------------
-Functions and definitions to determine:  (1) whether tininess for underflow
-is detected before or after rounding by default, (2) what (if anything)
-happens when exceptions are raised, (3) how signaling NaNs are distinguished
-from quiet NaNs, (4) the default generated quiet NaNs, and (5) how NaNs
-are propagated from function inputs to output.  These details are target-
-specific.
--------------------------------------------------------------------------------
-*/
-#include "softfloat-specialize"
-
-/*
--------------------------------------------------------------------------------
-Takes a 64-bit fixed-point value `absZ' with binary point between bits 6
-and 7, and returns the properly rounded 32-bit integer corresponding to the
-input.  If `zSign' is nonzero, the input is negated before being converted
-to an integer.  Bit 63 of `absZ' must be zero.  Ordinarily, the fixed-point
-input is simply rounded to an integer, with the inexact exception raised if
-the input cannot be represented exactly as an integer.  If the fixed-point
-input is too large, however, the invalid exception is raised and the largest
-positive or negative integer is returned.
--------------------------------------------------------------------------------
-*/
-static int32 roundAndPackInt32( flag zSign, bits64 absZ )
-{
-    int8 roundingMode;
-    flag roundNearestEven;
-    int8 roundIncrement, roundBits;
-    int32 z;
-
-    roundingMode = float_rounding_mode;
-    roundNearestEven = ( roundingMode == float_round_nearest_even );
-    roundIncrement = 0x40;
-    if ( ! roundNearestEven ) {
-        if ( roundingMode == float_round_to_zero ) {
-            roundIncrement = 0;
-        }
-        else {
-            roundIncrement = 0x7F;
-            if ( zSign ) {
-                if ( roundingMode == float_round_up ) roundIncrement = 0;
-            }
-            else {
-                if ( roundingMode == float_round_down ) roundIncrement = 0;
-            }
-        }
-    }
-    roundBits = absZ & 0x7F;
-    absZ = ( absZ + roundIncrement )>>7;
-    absZ &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
-    z = absZ;
-    if ( zSign ) z = - z;
-    if ( ( absZ>>32 ) || ( z && ( ( z < 0 ) ^ zSign ) ) ) {
-        float_exception_flags |= float_flag_invalid;
-        return zSign ? 0x80000000 : 0x7FFFFFFF;
-    }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the fraction bits of the single-precision floating-point value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE bits32 extractFloat32Frac( float32 a )
-{
-
-    return a & 0x007FFFFF;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the exponent bits of the single-precision floating-point value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE int16 extractFloat32Exp( float32 a )
-{
-
-    return ( a>>23 ) & 0xFF;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the sign bit of the single-precision floating-point value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE flag extractFloat32Sign( float32 a )
-{
-
-    return a>>31;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Normalizes the subnormal single-precision floating-point value represented
-by the denormalized significand `aSig'.  The normalized exponent and
-significand are stored at the locations pointed to by `zExpPtr' and
-`zSigPtr', respectively.
--------------------------------------------------------------------------------
-*/
-static void
- normalizeFloat32Subnormal( bits32 aSig, int16 *zExpPtr, bits32 *zSigPtr )
-{
-    int8 shiftCount;
-
-    shiftCount = countLeadingZeros32( aSig ) - 8;
-    *zSigPtr = aSig<<shiftCount;
-    *zExpPtr = 1 - shiftCount;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Packs the sign `zSign', exponent `zExp', and significand `zSig' into a
-single-precision floating-point value, returning the result.  After being
-shifted into the proper positions, the three fields are simply added
-together to form the result.  This means that any integer portion of `zSig'
-will be added into the exponent.  Since a properly normalized significand
-will have an integer portion equal to 1, the `zExp' input should be 1 less
-than the desired result exponent whenever `zSig' is a complete, normalized
-significand.
--------------------------------------------------------------------------------
-*/
-INLINE float32 packFloat32( flag zSign, int16 zExp, bits32 zSig )
-{
-#if 0
-   float32 f;
-   __asm__("@ packFloat32;             \n\
-           mov %0, %1, asl #31;        \n\
-           orr %0, %2, asl #23;        \n\
-           orr %0, %3"
-           : /* no outputs */
-           : "g" (f), "g" (zSign), "g" (zExp), "g" (zSig)
-           : "cc");
-   return f;
-#else
-    return ( ( (bits32) zSign )<<31 ) + ( ( (bits32) zExp )<<23 ) + zSig;
-#endif 
-}
-
-/*
--------------------------------------------------------------------------------
-Takes an abstract floating-point value having sign `zSign', exponent `zExp',
-and significand `zSig', and returns the proper single-precision floating-
-point value corresponding to the abstract input.  Ordinarily, the abstract
-value is simply rounded and packed into the single-precision format, with
-the inexact exception raised if the abstract input cannot be represented
-exactly.  If the abstract value is too large, however, the overflow and
-inexact exceptions are raised and an infinity or maximal finite value is
-returned.  If the abstract value is too small, the input value is rounded to
-a subnormal number, and the underflow and inexact exceptions are raised if
-the abstract input cannot be represented exactly as a subnormal single-
-precision floating-point number.
-    The input significand `zSig' has its binary point between bits 30
-and 29, which is 7 bits to the left of the usual location.  This shifted
-significand must be normalized or smaller.  If `zSig' is not normalized,
-`zExp' must be 0; in that case, the result returned is a subnormal number,
-and it must not require rounding.  In the usual case that `zSig' is
-normalized, `zExp' must be 1 less than the ``true'' floating-point exponent.
-The handling of underflow and overflow follows the IEC/IEEE Standard for
-Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static float32 roundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig )
-{
-    int8 roundingMode;
-    flag roundNearestEven;
-    int8 roundIncrement, roundBits;
-    flag isTiny;
-
-    roundingMode = float_rounding_mode;
-    roundNearestEven = ( roundingMode == float_round_nearest_even );
-    roundIncrement = 0x40;
-    if ( ! roundNearestEven ) {
-        if ( roundingMode == float_round_to_zero ) {
-            roundIncrement = 0;
-        }
-        else {
-            roundIncrement = 0x7F;
-            if ( zSign ) {
-                if ( roundingMode == float_round_up ) roundIncrement = 0;
-            }
-            else {
-                if ( roundingMode == float_round_down ) roundIncrement = 0;
-            }
-        }
-    }
-    roundBits = zSig & 0x7F;
-    if ( 0xFD <= (bits16) zExp ) {
-        if (    ( 0xFD < zExp )
-             || (    ( zExp == 0xFD )
-                  && ( (sbits32) ( zSig + roundIncrement ) < 0 ) )
-           ) {
-            float_raise( float_flag_overflow | float_flag_inexact );
-            return packFloat32( zSign, 0xFF, 0 ) - ( roundIncrement == 0 );
-        }
-        if ( zExp < 0 ) {
-            isTiny =
-                   ( float_detect_tininess == float_tininess_before_rounding )
-                || ( zExp < -1 )
-                || ( zSig + roundIncrement < 0x80000000 );
-            shift32RightJamming( zSig, - zExp, &zSig );
-            zExp = 0;
-            roundBits = zSig & 0x7F;
-            if ( isTiny && roundBits ) float_raise( float_flag_underflow );
-        }
-    }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
-    zSig = ( zSig + roundIncrement )>>7;
-    zSig &= ~ ( ( ( roundBits ^ 0x40 ) == 0 ) & roundNearestEven );
-    if ( zSig == 0 ) zExp = 0;
-    return packFloat32( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Takes an abstract floating-point value having sign `zSign', exponent `zExp',
-and significand `zSig', and returns the proper single-precision floating-
-point value corresponding to the abstract input.  This routine is just like
-`roundAndPackFloat32' except that `zSig' does not have to be normalized in
-any way.  In all cases, `zExp' must be 1 less than the ``true'' floating-
-point exponent.
--------------------------------------------------------------------------------
-*/
-static float32
- normalizeRoundAndPackFloat32( flag zSign, int16 zExp, bits32 zSig )
-{
-    int8 shiftCount;
-
-    shiftCount = countLeadingZeros32( zSig ) - 1;
-    return roundAndPackFloat32( zSign, zExp - shiftCount, zSig<<shiftCount );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the fraction bits of the double-precision floating-point value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE bits64 extractFloat64Frac( float64 a )
-{
-
-    return a & LIT64( 0x000FFFFFFFFFFFFF );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the exponent bits of the double-precision floating-point value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE int16 extractFloat64Exp( float64 a )
-{
-
-    return ( a>>52 ) & 0x7FF;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the sign bit of the double-precision floating-point value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE flag extractFloat64Sign( float64 a )
-{
-
-    return a>>63;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Normalizes the subnormal double-precision floating-point value represented
-by the denormalized significand `aSig'.  The normalized exponent and
-significand are stored at the locations pointed to by `zExpPtr' and
-`zSigPtr', respectively.
--------------------------------------------------------------------------------
-*/
-static void
- normalizeFloat64Subnormal( bits64 aSig, int16 *zExpPtr, bits64 *zSigPtr )
-{
-    int8 shiftCount;
-
-    shiftCount = countLeadingZeros64( aSig ) - 11;
-    *zSigPtr = aSig<<shiftCount;
-    *zExpPtr = 1 - shiftCount;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Packs the sign `zSign', exponent `zExp', and significand `zSig' into a
-double-precision floating-point value, returning the result.  After being
-shifted into the proper positions, the three fields are simply added
-together to form the result.  This means that any integer portion of `zSig'
-will be added into the exponent.  Since a properly normalized significand
-will have an integer portion equal to 1, the `zExp' input should be 1 less
-than the desired result exponent whenever `zSig' is a complete, normalized
-significand.
--------------------------------------------------------------------------------
-*/
-INLINE float64 packFloat64( flag zSign, int16 zExp, bits64 zSig )
-{
-
-    return ( ( (bits64) zSign )<<63 ) + ( ( (bits64) zExp )<<52 ) + zSig;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Takes an abstract floating-point value having sign `zSign', exponent `zExp',
-and significand `zSig', and returns the proper double-precision floating-
-point value corresponding to the abstract input.  Ordinarily, the abstract
-value is simply rounded and packed into the double-precision format, with
-the inexact exception raised if the abstract input cannot be represented
-exactly.  If the abstract value is too large, however, the overflow and
-inexact exceptions are raised and an infinity or maximal finite value is
-returned.  If the abstract value is too small, the input value is rounded to
-a subnormal number, and the underflow and inexact exceptions are raised if
-the abstract input cannot be represented exactly as a subnormal double-
-precision floating-point number.
-    The input significand `zSig' has its binary point between bits 62
-and 61, which is 10 bits to the left of the usual location.  This shifted
-significand must be normalized or smaller.  If `zSig' is not normalized,
-`zExp' must be 0; in that case, the result returned is a subnormal number,
-and it must not require rounding.  In the usual case that `zSig' is
-normalized, `zExp' must be 1 less than the ``true'' floating-point exponent.
-The handling of underflow and overflow follows the IEC/IEEE Standard for
-Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static float64 roundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig )
-{
-    int8 roundingMode;
-    flag roundNearestEven;
-    int16 roundIncrement, roundBits;
-    flag isTiny;
-
-    roundingMode = float_rounding_mode;
-    roundNearestEven = ( roundingMode == float_round_nearest_even );
-    roundIncrement = 0x200;
-    if ( ! roundNearestEven ) {
-        if ( roundingMode == float_round_to_zero ) {
-            roundIncrement = 0;
-        }
-        else {
-            roundIncrement = 0x3FF;
-            if ( zSign ) {
-                if ( roundingMode == float_round_up ) roundIncrement = 0;
-            }
-            else {
-                if ( roundingMode == float_round_down ) roundIncrement = 0;
-            }
-        }
-    }
-    roundBits = zSig & 0x3FF;
-    if ( 0x7FD <= (bits16) zExp ) {
-        if (    ( 0x7FD < zExp )
-             || (    ( zExp == 0x7FD )
-                  && ( (sbits64) ( zSig + roundIncrement ) < 0 ) )
-           ) {
-            //register int lr = __builtin_return_address(0);
-            //printk("roundAndPackFloat64 called from 0x%08x\n",lr);
-            float_raise( float_flag_overflow | float_flag_inexact );
-            return packFloat64( zSign, 0x7FF, 0 ) - ( roundIncrement == 0 );
-        }
-        if ( zExp < 0 ) {
-            isTiny =
-                   ( float_detect_tininess == float_tininess_before_rounding )
-                || ( zExp < -1 )
-                || ( zSig + roundIncrement < LIT64( 0x8000000000000000 ) );
-            shift64RightJamming( zSig, - zExp, &zSig );
-            zExp = 0;
-            roundBits = zSig & 0x3FF;
-            if ( isTiny && roundBits ) float_raise( float_flag_underflow );
-        }
-    }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
-    zSig = ( zSig + roundIncrement )>>10;
-    zSig &= ~ ( ( ( roundBits ^ 0x200 ) == 0 ) & roundNearestEven );
-    if ( zSig == 0 ) zExp = 0;
-    return packFloat64( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Takes an abstract floating-point value having sign `zSign', exponent `zExp',
-and significand `zSig', and returns the proper double-precision floating-
-point value corresponding to the abstract input.  This routine is just like
-`roundAndPackFloat64' except that `zSig' does not have to be normalized in
-any way.  In all cases, `zExp' must be 1 less than the ``true'' floating-
-point exponent.
--------------------------------------------------------------------------------
-*/
-static float64
- normalizeRoundAndPackFloat64( flag zSign, int16 zExp, bits64 zSig )
-{
-    int8 shiftCount;
-
-    shiftCount = countLeadingZeros64( zSig ) - 1;
-    return roundAndPackFloat64( zSign, zExp - shiftCount, zSig<<shiftCount );
-
-}
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Returns the fraction bits of the extended double-precision floating-point
-value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE bits64 extractFloatx80Frac( floatx80 a )
-{
-
-    return a.low;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the exponent bits of the extended double-precision floating-point
-value `a'.
--------------------------------------------------------------------------------
-*/
-INLINE int32 extractFloatx80Exp( floatx80 a )
-{
-
-    return a.high & 0x7FFF;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the sign bit of the extended double-precision floating-point value
-`a'.
--------------------------------------------------------------------------------
-*/
-INLINE flag extractFloatx80Sign( floatx80 a )
-{
-
-    return a.high>>15;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Normalizes the subnormal extended double-precision floating-point value
-represented by the denormalized significand `aSig'.  The normalized exponent
-and significand are stored at the locations pointed to by `zExpPtr' and
-`zSigPtr', respectively.
--------------------------------------------------------------------------------
-*/
-static void
- normalizeFloatx80Subnormal( bits64 aSig, int32 *zExpPtr, bits64 *zSigPtr )
-{
-    int8 shiftCount;
-
-    shiftCount = countLeadingZeros64( aSig );
-    *zSigPtr = aSig<<shiftCount;
-    *zExpPtr = 1 - shiftCount;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Packs the sign `zSign', exponent `zExp', and significand `zSig' into an
-extended double-precision floating-point value, returning the result.
--------------------------------------------------------------------------------
-*/
-INLINE floatx80 packFloatx80( flag zSign, int32 zExp, bits64 zSig )
-{
-    floatx80 z;
-
-    z.low = zSig;
-    z.high = ( ( (bits16) zSign )<<15 ) + zExp;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Takes an abstract floating-point value having sign `zSign', exponent `zExp',
-and extended significand formed by the concatenation of `zSig0' and `zSig1',
-and returns the proper extended double-precision floating-point value
-corresponding to the abstract input.  Ordinarily, the abstract value is
-rounded and packed into the extended double-precision format, with the
-inexact exception raised if the abstract input cannot be represented
-exactly.  If the abstract value is too large, however, the overflow and
-inexact exceptions are raised and an infinity or maximal finite value is
-returned.  If the abstract value is too small, the input value is rounded to
-a subnormal number, and the underflow and inexact exceptions are raised if
-the abstract input cannot be represented exactly as a subnormal extended
-double-precision floating-point number.
-    If `roundingPrecision' is 32 or 64, the result is rounded to the same
-number of bits as single or double precision, respectively.  Otherwise, the
-result is rounded to the full precision of the extended double-precision
-format.
-    The input significand must be normalized or smaller.  If the input
-significand is not normalized, `zExp' must be 0; in that case, the result
-returned is a subnormal number, and it must not require rounding.  The
-handling of underflow and overflow follows the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static floatx80
- roundAndPackFloatx80(
-     int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
- )
-{
-    int8 roundingMode;
-    flag roundNearestEven, increment, isTiny;
-    int64 roundIncrement, roundMask, roundBits;
-
-    roundingMode = float_rounding_mode;
-    roundNearestEven = ( roundingMode == float_round_nearest_even );
-    if ( roundingPrecision == 80 ) goto precision80;
-    if ( roundingPrecision == 64 ) {
-        roundIncrement = LIT64( 0x0000000000000400 );
-        roundMask = LIT64( 0x00000000000007FF );
-    }
-    else if ( roundingPrecision == 32 ) {
-        roundIncrement = LIT64( 0x0000008000000000 );
-        roundMask = LIT64( 0x000000FFFFFFFFFF );
-    }
-    else {
-        goto precision80;
-    }
-    zSig0 |= ( zSig1 != 0 );
-    if ( ! roundNearestEven ) {
-        if ( roundingMode == float_round_to_zero ) {
-            roundIncrement = 0;
-        }
-        else {
-            roundIncrement = roundMask;
-            if ( zSign ) {
-                if ( roundingMode == float_round_up ) roundIncrement = 0;
-            }
-            else {
-                if ( roundingMode == float_round_down ) roundIncrement = 0;
-            }
-        }
-    }
-    roundBits = zSig0 & roundMask;
-    if ( 0x7FFD <= (bits32) ( zExp - 1 ) ) {
-        if (    ( 0x7FFE < zExp )
-             || ( ( zExp == 0x7FFE ) && ( zSig0 + roundIncrement < zSig0 ) )
-           ) {
-            goto overflow;
-        }
-        if ( zExp <= 0 ) {
-            isTiny =
-                   ( float_detect_tininess == float_tininess_before_rounding )
-                || ( zExp < 0 )
-                || ( zSig0 <= zSig0 + roundIncrement );
-            shift64RightJamming( zSig0, 1 - zExp, &zSig0 );
-            zExp = 0;
-            roundBits = zSig0 & roundMask;
-            if ( isTiny && roundBits ) float_raise( float_flag_underflow );
-            if ( roundBits ) float_exception_flags |= float_flag_inexact;
-            zSig0 += roundIncrement;
-            if ( (sbits64) zSig0 < 0 ) zExp = 1;
-            roundIncrement = roundMask + 1;
-            if ( roundNearestEven && ( roundBits<<1 == roundIncrement ) ) {
-                roundMask |= roundIncrement;
-            }
-            zSig0 &= ~ roundMask;
-            return packFloatx80( zSign, zExp, zSig0 );
-        }
-    }
-    if ( roundBits ) float_exception_flags |= float_flag_inexact;
-    zSig0 += roundIncrement;
-    if ( zSig0 < roundIncrement ) {
-        ++zExp;
-        zSig0 = LIT64( 0x8000000000000000 );
-    }
-    roundIncrement = roundMask + 1;
-    if ( roundNearestEven && ( roundBits<<1 == roundIncrement ) ) {
-        roundMask |= roundIncrement;
-    }
-    zSig0 &= ~ roundMask;
-    if ( zSig0 == 0 ) zExp = 0;
-    return packFloatx80( zSign, zExp, zSig0 );
- precision80:
-    increment = ( (sbits64) zSig1 < 0 );
-    if ( ! roundNearestEven ) {
-        if ( roundingMode == float_round_to_zero ) {
-            increment = 0;
-        }
-        else {
-            if ( zSign ) {
-                increment = ( roundingMode == float_round_down ) && zSig1;
-            }
-            else {
-                increment = ( roundingMode == float_round_up ) && zSig1;
-            }
-        }
-    }
-    if ( 0x7FFD <= (bits32) ( zExp - 1 ) ) {
-        if (    ( 0x7FFE < zExp )
-             || (    ( zExp == 0x7FFE )
-                  && ( zSig0 == LIT64( 0xFFFFFFFFFFFFFFFF ) )
-                  && increment
-                )
-           ) {
-            roundMask = 0;
- overflow:
-            float_raise( float_flag_overflow | float_flag_inexact );
-            if (    ( roundingMode == float_round_to_zero )
-                 || ( zSign && ( roundingMode == float_round_up ) )
-                 || ( ! zSign && ( roundingMode == float_round_down ) )
-               ) {
-                return packFloatx80( zSign, 0x7FFE, ~ roundMask );
-            }
-            return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-        }
-        if ( zExp <= 0 ) {
-            isTiny =
-                   ( float_detect_tininess == float_tininess_before_rounding )
-                || ( zExp < 0 )
-                || ! increment
-                || ( zSig0 < LIT64( 0xFFFFFFFFFFFFFFFF ) );
-            shift64ExtraRightJamming( zSig0, zSig1, 1 - zExp, &zSig0, &zSig1 );
-            zExp = 0;
-            if ( isTiny && zSig1 ) float_raise( float_flag_underflow );
-            if ( zSig1 ) float_exception_flags |= float_flag_inexact;
-            if ( roundNearestEven ) {
-                increment = ( (sbits64) zSig1 < 0 );
-            }
-            else {
-                if ( zSign ) {
-                    increment = ( roundingMode == float_round_down ) && zSig1;
-                }
-                else {
-                    increment = ( roundingMode == float_round_up ) && zSig1;
-                }
-            }
-            if ( increment ) {
-                ++zSig0;
-                zSig0 &= ~ ( ( zSig1 + zSig1 == 0 ) & roundNearestEven );
-                if ( (sbits64) zSig0 < 0 ) zExp = 1;
-            }
-            return packFloatx80( zSign, zExp, zSig0 );
-        }
-    }
-    if ( zSig1 ) float_exception_flags |= float_flag_inexact;
-    if ( increment ) {
-        ++zSig0;
-        if ( zSig0 == 0 ) {
-            ++zExp;
-            zSig0 = LIT64( 0x8000000000000000 );
-        }
-        else {
-            zSig0 &= ~ ( ( zSig1 + zSig1 == 0 ) & roundNearestEven );
-        }
-    }
-    else {
-        if ( zSig0 == 0 ) zExp = 0;
-    }
-    
-    return packFloatx80( zSign, zExp, zSig0 );
-}
-
-/*
--------------------------------------------------------------------------------
-Takes an abstract floating-point value having sign `zSign', exponent
-`zExp', and significand formed by the concatenation of `zSig0' and `zSig1',
-and returns the proper extended double-precision floating-point value
-corresponding to the abstract input.  This routine is just like
-`roundAndPackFloatx80' except that the input significand does not have to be
-normalized.
--------------------------------------------------------------------------------
-*/
-static floatx80
- normalizeRoundAndPackFloatx80(
-     int8 roundingPrecision, flag zSign, int32 zExp, bits64 zSig0, bits64 zSig1
- )
-{
-    int8 shiftCount;
-
-    if ( zSig0 == 0 ) {
-        zSig0 = zSig1;
-        zSig1 = 0;
-        zExp -= 64;
-    }
-    shiftCount = countLeadingZeros64( zSig0 );
-    shortShift128Left( zSig0, zSig1, shiftCount, &zSig0, &zSig1 );
-    zExp -= shiftCount;
-    return
-        roundAndPackFloatx80( roundingPrecision, zSign, zExp, zSig0, zSig1 );
-
-}
-
-#endif
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the 32-bit two's complement integer `a' to
-the single-precision floating-point format.  The conversion is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 int32_to_float32( int32 a )
-{
-    flag zSign;
-
-    if ( a == 0 ) return 0;
-    if ( a == 0x80000000 ) return packFloat32( 1, 0x9E, 0 );
-    zSign = ( a < 0 );
-    return normalizeRoundAndPackFloat32( zSign, 0x9C, zSign ? - a : a );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the 32-bit two's complement integer `a' to
-the double-precision floating-point format.  The conversion is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 int32_to_float64( int32 a )
-{
-    flag aSign;
-    uint32 absA;
-    int8 shiftCount;
-    bits64 zSig;
-
-    if ( a == 0 ) return 0;
-    aSign = ( a < 0 );
-    absA = aSign ? - a : a;
-    shiftCount = countLeadingZeros32( absA ) + 21;
-    zSig = absA;
-    return packFloat64( aSign, 0x432 - shiftCount, zSig<<shiftCount );
-
-}
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the 32-bit two's complement integer `a'
-to the extended double-precision floating-point format.  The conversion
-is performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 int32_to_floatx80( int32 a )
-{
-    flag zSign;
-    uint32 absA;
-    int8 shiftCount;
-    bits64 zSig;
-
-    if ( a == 0 ) return packFloatx80( 0, 0, 0 );
-    zSign = ( a < 0 );
-    absA = zSign ? - a : a;
-    shiftCount = countLeadingZeros32( absA ) + 32;
-    zSig = absA;
-    return packFloatx80( zSign, 0x403E - shiftCount, zSig<<shiftCount );
-
-}
-
-#endif
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the single-precision floating-point value
-`a' to the 32-bit two's complement integer format.  The conversion is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic---which means in particular that the conversion is rounded
-according to the current rounding mode.  If `a' is a NaN, the largest
-positive integer is returned.  Otherwise, if the conversion overflows, the
-largest integer with the same sign as `a' is returned.
--------------------------------------------------------------------------------
-*/
-int32 float32_to_int32( float32 a )
-{
-    flag aSign;
-    int16 aExp, shiftCount;
-    bits32 aSig;
-    bits64 zSig;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
-    if ( aExp ) aSig |= 0x00800000;
-    shiftCount = 0xAF - aExp;
-    zSig = aSig;
-    zSig <<= 32;
-    if ( 0 < shiftCount ) shift64RightJamming( zSig, shiftCount, &zSig );
-    return roundAndPackInt32( aSign, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the single-precision floating-point value
-`a' to the 32-bit two's complement integer format.  The conversion is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic, except that the conversion is always rounded toward zero.  If
-`a' is a NaN, the largest positive integer is returned.  Otherwise, if the
-conversion overflows, the largest integer with the same sign as `a' is
-returned.
--------------------------------------------------------------------------------
-*/
-int32 float32_to_int32_round_to_zero( float32 a )
-{
-    flag aSign;
-    int16 aExp, shiftCount;
-    bits32 aSig;
-    int32 z;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    shiftCount = aExp - 0x9E;
-    if ( 0 <= shiftCount ) {
-        if ( a == 0xCF000000 ) return 0x80000000;
-        float_raise( float_flag_invalid );
-        if ( ! aSign || ( ( aExp == 0xFF ) && aSig ) ) return 0x7FFFFFFF;
-        return 0x80000000;
-    }
-    else if ( aExp <= 0x7E ) {
-        if ( aExp | aSig ) float_exception_flags |= float_flag_inexact;
-        return 0;
-    }
-    aSig = ( aSig | 0x00800000 )<<8;
-    z = aSig>>( - shiftCount );
-    if ( (bits32) ( aSig<<( shiftCount & 31 ) ) ) {
-        float_exception_flags |= float_flag_inexact;
-    }
-    return aSign ? - z : z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the single-precision floating-point value
-`a' to the double-precision floating-point format.  The conversion is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float32_to_float64( float32 a )
-{
-    flag aSign;
-    int16 aExp;
-    bits32 aSig;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    if ( aExp == 0xFF ) {
-        if ( aSig ) return commonNaNToFloat64( float32ToCommonNaN( a ) );
-        return packFloat64( aSign, 0x7FF, 0 );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloat64( aSign, 0, 0 );
-        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
-        --aExp;
-    }
-    return packFloat64( aSign, aExp + 0x380, ( (bits64) aSig )<<29 );
-
-}
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the single-precision floating-point value
-`a' to the extended double-precision floating-point format.  The conversion
-is performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 float32_to_floatx80( float32 a )
-{
-    flag aSign;
-    int16 aExp;
-    bits32 aSig;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    if ( aExp == 0xFF ) {
-        if ( aSig ) return commonNaNToFloatx80( float32ToCommonNaN( a ) );
-        return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
-        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
-    }
-    aSig |= 0x00800000;
-    return packFloatx80( aSign, aExp + 0x3F80, ( (bits64) aSig )<<40 );
-
-}
-
-#endif
-
-/*
--------------------------------------------------------------------------------
-Rounds the single-precision floating-point value `a' to an integer, and
-returns the result as a single-precision floating-point value.  The
-operation is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float32_round_to_int( float32 a )
-{
-    flag aSign;
-    int16 aExp;
-    bits32 lastBitMask, roundBitsMask;
-    int8 roundingMode;
-    float32 z;
-
-    aExp = extractFloat32Exp( a );
-    if ( 0x96 <= aExp ) {
-        if ( ( aExp == 0xFF ) && extractFloat32Frac( a ) ) {
-            return propagateFloat32NaN( a, a );
-        }
-        return a;
-    }
-    if ( aExp <= 0x7E ) {
-        if ( (bits32) ( a<<1 ) == 0 ) return a;
-        float_exception_flags |= float_flag_inexact;
-        aSign = extractFloat32Sign( a );
-        switch ( float_rounding_mode ) {
-         case float_round_nearest_even:
-            if ( ( aExp == 0x7E ) && extractFloat32Frac( a ) ) {
-                return packFloat32( aSign, 0x7F, 0 );
-            }
-            break;
-         case float_round_down:
-            return aSign ? 0xBF800000 : 0;
-         case float_round_up:
-            return aSign ? 0x80000000 : 0x3F800000;
-        }
-        return packFloat32( aSign, 0, 0 );
-    }
-    lastBitMask = 1;
-    lastBitMask <<= 0x96 - aExp;
-    roundBitsMask = lastBitMask - 1;
-    z = a;
-    roundingMode = float_rounding_mode;
-    if ( roundingMode == float_round_nearest_even ) {
-        z += lastBitMask>>1;
-        if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask;
-    }
-    else if ( roundingMode != float_round_to_zero ) {
-        if ( extractFloat32Sign( z ) ^ ( roundingMode == float_round_up ) ) {
-            z += roundBitsMask;
-        }
-    }
-    z &= ~ roundBitsMask;
-    if ( z != a ) float_exception_flags |= float_flag_inexact;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of adding the absolute values of the single-precision
-floating-point values `a' and `b'.  If `zSign' is true, the sum is negated
-before being returned.  `zSign' is ignored if the result is a NaN.  The
-addition is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static float32 addFloat32Sigs( float32 a, float32 b, flag zSign )
-{
-    int16 aExp, bExp, zExp;
-    bits32 aSig, bSig, zSig;
-    int16 expDiff;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    bSig = extractFloat32Frac( b );
-    bExp = extractFloat32Exp( b );
-    expDiff = aExp - bExp;
-    aSig <<= 6;
-    bSig <<= 6;
-    if ( 0 < expDiff ) {
-        if ( aExp == 0xFF ) {
-            if ( aSig ) return propagateFloat32NaN( a, b );
-            return a;
-        }
-        if ( bExp == 0 ) {
-            --expDiff;
-        }
-        else {
-            bSig |= 0x20000000;
-        }
-        shift32RightJamming( bSig, expDiff, &bSig );
-        zExp = aExp;
-    }
-    else if ( expDiff < 0 ) {
-        if ( bExp == 0xFF ) {
-            if ( bSig ) return propagateFloat32NaN( a, b );
-            return packFloat32( zSign, 0xFF, 0 );
-        }
-        if ( aExp == 0 ) {
-            ++expDiff;
-        }
-        else {
-            aSig |= 0x20000000;
-        }
-        shift32RightJamming( aSig, - expDiff, &aSig );
-        zExp = bExp;
-    }
-    else {
-        if ( aExp == 0xFF ) {
-            if ( aSig | bSig ) return propagateFloat32NaN( a, b );
-            return a;
-        }
-        if ( aExp == 0 ) return packFloat32( zSign, 0, ( aSig + bSig )>>6 );
-        zSig = 0x40000000 + aSig + bSig;
-        zExp = aExp;
-        goto roundAndPack;
-    }
-    aSig |= 0x20000000;
-    zSig = ( aSig + bSig )<<1;
-    --zExp;
-    if ( (sbits32) zSig < 0 ) {
-        zSig = aSig + bSig;
-        ++zExp;
-    }
- roundAndPack:
-    return roundAndPackFloat32( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of subtracting the absolute values of the single-
-precision floating-point values `a' and `b'.  If `zSign' is true, the
-difference is negated before being returned.  `zSign' is ignored if the
-result is a NaN.  The subtraction is performed according to the IEC/IEEE
-Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static float32 subFloat32Sigs( float32 a, float32 b, flag zSign )
-{
-    int16 aExp, bExp, zExp;
-    bits32 aSig, bSig, zSig;
-    int16 expDiff;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    bSig = extractFloat32Frac( b );
-    bExp = extractFloat32Exp( b );
-    expDiff = aExp - bExp;
-    aSig <<= 7;
-    bSig <<= 7;
-    if ( 0 < expDiff ) goto aExpBigger;
-    if ( expDiff < 0 ) goto bExpBigger;
-    if ( aExp == 0xFF ) {
-        if ( aSig | bSig ) return propagateFloat32NaN( a, b );
-        float_raise( float_flag_invalid );
-        return float32_default_nan;
-    }
-    if ( aExp == 0 ) {
-        aExp = 1;
-        bExp = 1;
-    }
-    if ( bSig < aSig ) goto aBigger;
-    if ( aSig < bSig ) goto bBigger;
-    return packFloat32( float_rounding_mode == float_round_down, 0, 0 );
- bExpBigger:
-    if ( bExp == 0xFF ) {
-        if ( bSig ) return propagateFloat32NaN( a, b );
-        return packFloat32( zSign ^ 1, 0xFF, 0 );
-    }
-    if ( aExp == 0 ) {
-        ++expDiff;
-    }
-    else {
-        aSig |= 0x40000000;
-    }
-    shift32RightJamming( aSig, - expDiff, &aSig );
-    bSig |= 0x40000000;
- bBigger:
-    zSig = bSig - aSig;
-    zExp = bExp;
-    zSign ^= 1;
-    goto normalizeRoundAndPack;
- aExpBigger:
-    if ( aExp == 0xFF ) {
-        if ( aSig ) return propagateFloat32NaN( a, b );
-        return a;
-    }
-    if ( bExp == 0 ) {
-        --expDiff;
-    }
-    else {
-        bSig |= 0x40000000;
-    }
-    shift32RightJamming( bSig, expDiff, &bSig );
-    aSig |= 0x40000000;
- aBigger:
-    zSig = aSig - bSig;
-    zExp = aExp;
- normalizeRoundAndPack:
-    --zExp;
-    return normalizeRoundAndPackFloat32( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of adding the single-precision floating-point values `a'
-and `b'.  The operation is performed according to the IEC/IEEE Standard for
-Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float32_add( float32 a, float32 b )
-{
-    flag aSign, bSign;
-
-    aSign = extractFloat32Sign( a );
-    bSign = extractFloat32Sign( b );
-    if ( aSign == bSign ) {
-        return addFloat32Sigs( a, b, aSign );
-    }
-    else {
-        return subFloat32Sigs( a, b, aSign );
-    }
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of subtracting the single-precision floating-point values
-`a' and `b'.  The operation is performed according to the IEC/IEEE Standard
-for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float32_sub( float32 a, float32 b )
-{
-    flag aSign, bSign;
-
-    aSign = extractFloat32Sign( a );
-    bSign = extractFloat32Sign( b );
-    if ( aSign == bSign ) {
-        return subFloat32Sigs( a, b, aSign );
-    }
-    else {
-        return addFloat32Sigs( a, b, aSign );
-    }
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of multiplying the single-precision floating-point values
-`a' and `b'.  The operation is performed according to the IEC/IEEE Standard
-for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float32_mul( float32 a, float32 b )
-{
-    flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
-    bits32 aSig, bSig;
-    bits64 zSig64;
-    bits32 zSig;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    bSig = extractFloat32Frac( b );
-    bExp = extractFloat32Exp( b );
-    bSign = extractFloat32Sign( b );
-    zSign = aSign ^ bSign;
-    if ( aExp == 0xFF ) {
-        if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) {
-            return propagateFloat32NaN( a, b );
-        }
-        if ( ( bExp | bSig ) == 0 ) {
-            float_raise( float_flag_invalid );
-            return float32_default_nan;
-        }
-        return packFloat32( zSign, 0xFF, 0 );
-    }
-    if ( bExp == 0xFF ) {
-        if ( bSig ) return propagateFloat32NaN( a, b );
-        if ( ( aExp | aSig ) == 0 ) {
-            float_raise( float_flag_invalid );
-            return float32_default_nan;
-        }
-        return packFloat32( zSign, 0xFF, 0 );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloat32( zSign, 0, 0 );
-        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) return packFloat32( zSign, 0, 0 );
-        normalizeFloat32Subnormal( bSig, &bExp, &bSig );
-    }
-    zExp = aExp + bExp - 0x7F;
-    aSig = ( aSig | 0x00800000 )<<7;
-    bSig = ( bSig | 0x00800000 )<<8;
-    shift64RightJamming( ( (bits64) aSig ) * bSig, 32, &zSig64 );
-    zSig = zSig64;
-    if ( 0 <= (sbits32) ( zSig<<1 ) ) {
-        zSig <<= 1;
-        --zExp;
-    }
-    return roundAndPackFloat32( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of dividing the single-precision floating-point value `a'
-by the corresponding value `b'.  The operation is performed according to the
-IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float32_div( float32 a, float32 b )
-{
-    flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
-    bits32 aSig, bSig, zSig;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    bSig = extractFloat32Frac( b );
-    bExp = extractFloat32Exp( b );
-    bSign = extractFloat32Sign( b );
-    zSign = aSign ^ bSign;
-    if ( aExp == 0xFF ) {
-        if ( aSig ) return propagateFloat32NaN( a, b );
-        if ( bExp == 0xFF ) {
-            if ( bSig ) return propagateFloat32NaN( a, b );
-            float_raise( float_flag_invalid );
-            return float32_default_nan;
-        }
-        return packFloat32( zSign, 0xFF, 0 );
-    }
-    if ( bExp == 0xFF ) {
-        if ( bSig ) return propagateFloat32NaN( a, b );
-        return packFloat32( zSign, 0, 0 );
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) {
-            if ( ( aExp | aSig ) == 0 ) {
-                float_raise( float_flag_invalid );
-                return float32_default_nan;
-            }
-            float_raise( float_flag_divbyzero );
-            return packFloat32( zSign, 0xFF, 0 );
-        }
-        normalizeFloat32Subnormal( bSig, &bExp, &bSig );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloat32( zSign, 0, 0 );
-        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
-    }
-    zExp = aExp - bExp + 0x7D;
-    aSig = ( aSig | 0x00800000 )<<7;
-    bSig = ( bSig | 0x00800000 )<<8;
-    if ( bSig <= ( aSig + aSig ) ) {
-        aSig >>= 1;
-        ++zExp;
-    }
-    zSig = ( ( (bits64) aSig )<<32 ) / bSig;
-    if ( ( zSig & 0x3F ) == 0 ) {
-        zSig |= ( ( (bits64) bSig ) * zSig != ( (bits64) aSig )<<32 );
-    }
-    return roundAndPackFloat32( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the remainder of the single-precision floating-point value `a'
-with respect to the corresponding value `b'.  The operation is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float32_rem( float32 a, float32 b )
-{
-    flag aSign, bSign, zSign;
-    int16 aExp, bExp, expDiff;
-    bits32 aSig, bSig;
-    bits32 q;
-    bits64 aSig64, bSig64, q64;
-    bits32 alternateASig;
-    sbits32 sigMean;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    bSig = extractFloat32Frac( b );
-    bExp = extractFloat32Exp( b );
-    bSign = extractFloat32Sign( b );
-    if ( aExp == 0xFF ) {
-        if ( aSig || ( ( bExp == 0xFF ) && bSig ) ) {
-            return propagateFloat32NaN( a, b );
-        }
-        float_raise( float_flag_invalid );
-        return float32_default_nan;
-    }
-    if ( bExp == 0xFF ) {
-        if ( bSig ) return propagateFloat32NaN( a, b );
-        return a;
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) {
-            float_raise( float_flag_invalid );
-            return float32_default_nan;
-        }
-        normalizeFloat32Subnormal( bSig, &bExp, &bSig );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return a;
-        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
-    }
-    expDiff = aExp - bExp;
-    aSig |= 0x00800000;
-    bSig |= 0x00800000;
-    if ( expDiff < 32 ) {
-        aSig <<= 8;
-        bSig <<= 8;
-        if ( expDiff < 0 ) {
-            if ( expDiff < -1 ) return a;
-            aSig >>= 1;
-        }
-        q = ( bSig <= aSig );
-        if ( q ) aSig -= bSig;
-        if ( 0 < expDiff ) {
-            q = ( ( (bits64) aSig )<<32 ) / bSig;
-            q >>= 32 - expDiff;
-            bSig >>= 2;
-            aSig = ( ( aSig>>1 )<<( expDiff - 1 ) ) - bSig * q;
-        }
-        else {
-            aSig >>= 2;
-            bSig >>= 2;
-        }
-    }
-    else {
-        if ( bSig <= aSig ) aSig -= bSig;
-        aSig64 = ( (bits64) aSig )<<40;
-        bSig64 = ( (bits64) bSig )<<40;
-        expDiff -= 64;
-        while ( 0 < expDiff ) {
-            q64 = estimateDiv128To64( aSig64, 0, bSig64 );
-            q64 = ( 2 < q64 ) ? q64 - 2 : 0;
-            aSig64 = - ( ( bSig * q64 )<<38 );
-            expDiff -= 62;
-        }
-        expDiff += 64;
-        q64 = estimateDiv128To64( aSig64, 0, bSig64 );
-        q64 = ( 2 < q64 ) ? q64 - 2 : 0;
-        q = q64>>( 64 - expDiff );
-        bSig <<= 6;
-        aSig = ( ( aSig64>>33 )<<( expDiff - 1 ) ) - bSig * q;
-    }
-    do {
-        alternateASig = aSig;
-        ++q;
-        aSig -= bSig;
-    } while ( 0 <= (sbits32) aSig );
-    sigMean = aSig + alternateASig;
-    if ( ( sigMean < 0 ) || ( ( sigMean == 0 ) && ( q & 1 ) ) ) {
-        aSig = alternateASig;
-    }
-    zSign = ( (sbits32) aSig < 0 );
-    if ( zSign ) aSig = - aSig;
-    return normalizeRoundAndPackFloat32( aSign ^ zSign, bExp, aSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the square root of the single-precision floating-point value `a'.
-The operation is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float32_sqrt( float32 a )
-{
-    flag aSign;
-    int16 aExp, zExp;
-    bits32 aSig, zSig;
-    bits64 rem, term;
-
-    aSig = extractFloat32Frac( a );
-    aExp = extractFloat32Exp( a );
-    aSign = extractFloat32Sign( a );
-    if ( aExp == 0xFF ) {
-        if ( aSig ) return propagateFloat32NaN( a, 0 );
-        if ( ! aSign ) return a;
-        float_raise( float_flag_invalid );
-        return float32_default_nan;
-    }
-    if ( aSign ) {
-        if ( ( aExp | aSig ) == 0 ) return a;
-        float_raise( float_flag_invalid );
-        return float32_default_nan;
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return 0;
-        normalizeFloat32Subnormal( aSig, &aExp, &aSig );
-    }
-    zExp = ( ( aExp - 0x7F )>>1 ) + 0x7E;
-    aSig = ( aSig | 0x00800000 )<<8;
-    zSig = estimateSqrt32( aExp, aSig ) + 2;
-    if ( ( zSig & 0x7F ) <= 5 ) {
-        if ( zSig < 2 ) {
-            zSig = 0xFFFFFFFF;
-        }
-        else {
-            aSig >>= aExp & 1;
-            term = ( (bits64) zSig ) * zSig;
-            rem = ( ( (bits64) aSig )<<32 ) - term;
-            while ( (sbits64) rem < 0 ) {
-                --zSig;
-                rem += ( ( (bits64) zSig )<<1 ) | 1;
-            }
-            zSig |= ( rem != 0 );
-        }
-    }
-    shift32RightJamming( zSig, 1, &zSig );
-    return roundAndPackFloat32( 0, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is equal to the
-corresponding value `b', and 0 otherwise.  The comparison is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float32_eq( float32 a, float32 b )
-{
-
-    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
-         || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
-       ) {
-        if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    return ( a == b ) || ( (bits32) ( ( a | b )<<1 ) == 0 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is less than or
-equal to the corresponding value `b', and 0 otherwise.  The comparison is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float32_le( float32 a, float32 b )
-{
-    flag aSign, bSign;
-
-    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
-         || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    aSign = extractFloat32Sign( a );
-    bSign = extractFloat32Sign( b );
-    if ( aSign != bSign ) return aSign || ( (bits32) ( ( a | b )<<1 ) == 0 );
-    return ( a == b ) || ( aSign ^ ( a < b ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is less than
-the corresponding value `b', and 0 otherwise.  The comparison is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float32_lt( float32 a, float32 b )
-{
-    flag aSign, bSign;
-
-    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
-         || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    aSign = extractFloat32Sign( a );
-    bSign = extractFloat32Sign( b );
-    if ( aSign != bSign ) return aSign && ( (bits32) ( ( a | b )<<1 ) != 0 );
-    return ( a != b ) && ( aSign ^ ( a < b ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is equal to the
-corresponding value `b', and 0 otherwise.  The invalid exception is raised
-if either operand is a NaN.  Otherwise, the comparison is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float32_eq_signaling( float32 a, float32 b )
-{
-
-    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
-         || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    return ( a == b ) || ( (bits32) ( ( a | b )<<1 ) == 0 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is less than or
-equal to the corresponding value `b', and 0 otherwise.  Quiet NaNs do not
-cause an exception.  Otherwise, the comparison is performed according to the
-IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float32_le_quiet( float32 a, float32 b )
-{
-    flag aSign, bSign;
-    //int16 aExp, bExp;
-
-    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
-         || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
-       ) {
-        if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    aSign = extractFloat32Sign( a );
-    bSign = extractFloat32Sign( b );
-    if ( aSign != bSign ) return aSign || ( (bits32) ( ( a | b )<<1 ) == 0 );
-    return ( a == b ) || ( aSign ^ ( a < b ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the single-precision floating-point value `a' is less than
-the corresponding value `b', and 0 otherwise.  Quiet NaNs do not cause an
-exception.  Otherwise, the comparison is performed according to the IEC/IEEE
-Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float32_lt_quiet( float32 a, float32 b )
-{
-    flag aSign, bSign;
-
-    if (    ( ( extractFloat32Exp( a ) == 0xFF ) && extractFloat32Frac( a ) )
-         || ( ( extractFloat32Exp( b ) == 0xFF ) && extractFloat32Frac( b ) )
-       ) {
-        if ( float32_is_signaling_nan( a ) || float32_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    aSign = extractFloat32Sign( a );
-    bSign = extractFloat32Sign( b );
-    if ( aSign != bSign ) return aSign && ( (bits32) ( ( a | b )<<1 ) != 0 );
-    return ( a != b ) && ( aSign ^ ( a < b ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the double-precision floating-point value
-`a' to the 32-bit two's complement integer format.  The conversion is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic---which means in particular that the conversion is rounded
-according to the current rounding mode.  If `a' is a NaN, the largest
-positive integer is returned.  Otherwise, if the conversion overflows, the
-largest integer with the same sign as `a' is returned.
--------------------------------------------------------------------------------
-*/
-int32 float64_to_int32( float64 a )
-{
-    flag aSign;
-    int16 aExp, shiftCount;
-    bits64 aSig;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
-    if ( aExp ) aSig |= LIT64( 0x0010000000000000 );
-    shiftCount = 0x42C - aExp;
-    if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig );
-    return roundAndPackInt32( aSign, aSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the double-precision floating-point value
-`a' to the 32-bit two's complement integer format.  The conversion is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic, except that the conversion is always rounded toward zero.  If
-`a' is a NaN, the largest positive integer is returned.  Otherwise, if the
-conversion overflows, the largest integer with the same sign as `a' is
-returned.
--------------------------------------------------------------------------------
-*/
-int32 float64_to_int32_round_to_zero( float64 a )
-{
-    flag aSign;
-    int16 aExp, shiftCount;
-    bits64 aSig, savedASig;
-    int32 z;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    shiftCount = 0x433 - aExp;
-    if ( shiftCount < 21 ) {
-        if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
-        goto invalid;
-    }
-    else if ( 52 < shiftCount ) {
-        if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
-        return 0;
-    }
-    aSig |= LIT64( 0x0010000000000000 );
-    savedASig = aSig;
-    aSig >>= shiftCount;
-    z = aSig;
-    if ( aSign ) z = - z;
-    if ( ( z < 0 ) ^ aSign ) {
- invalid:
-        float_exception_flags |= float_flag_invalid;
-        return aSign ? 0x80000000 : 0x7FFFFFFF;
-    }
-    if ( ( aSig<<shiftCount ) != savedASig ) {
-        float_exception_flags |= float_flag_inexact;
-    }
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the double-precision floating-point value
-`a' to the 32-bit two's complement unsigned integer format.  The conversion
-is performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic---which means in particular that the conversion is rounded
-according to the current rounding mode.  If `a' is a NaN, the largest
-positive integer is returned.  Otherwise, if the conversion overflows, the
-largest positive integer is returned.
--------------------------------------------------------------------------------
-*/
-int32 float64_to_uint32( float64 a )
-{
-    flag aSign;
-    int16 aExp, shiftCount;
-    bits64 aSig;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = 0; //extractFloat64Sign( a );
-    //if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
-    if ( aExp ) aSig |= LIT64( 0x0010000000000000 );
-    shiftCount = 0x42C - aExp;
-    if ( 0 < shiftCount ) shift64RightJamming( aSig, shiftCount, &aSig );
-    return roundAndPackInt32( aSign, aSig );
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the double-precision floating-point value
-`a' to the 32-bit two's complement integer format.  The conversion is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic, except that the conversion is always rounded toward zero.  If
-`a' is a NaN, the largest positive integer is returned.  Otherwise, if the
-conversion overflows, the largest positive integer is returned.
--------------------------------------------------------------------------------
-*/
-int32 float64_to_uint32_round_to_zero( float64 a )
-{
-    flag aSign;
-    int16 aExp, shiftCount;
-    bits64 aSig, savedASig;
-    int32 z;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    shiftCount = 0x433 - aExp;
-    if ( shiftCount < 21 ) {
-        if ( ( aExp == 0x7FF ) && aSig ) aSign = 0;
-        goto invalid;
-    }
-    else if ( 52 < shiftCount ) {
-        if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
-        return 0;
-    }
-    aSig |= LIT64( 0x0010000000000000 );
-    savedASig = aSig;
-    aSig >>= shiftCount;
-    z = aSig;
-    if ( aSign ) z = - z;
-    if ( ( z < 0 ) ^ aSign ) {
- invalid:
-        float_exception_flags |= float_flag_invalid;
-        return aSign ? 0x80000000 : 0x7FFFFFFF;
-    }
-    if ( ( aSig<<shiftCount ) != savedASig ) {
-        float_exception_flags |= float_flag_inexact;
-    }
-    return z;
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the double-precision floating-point value
-`a' to the single-precision floating-point format.  The conversion is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 float64_to_float32( float64 a )
-{
-    flag aSign;
-    int16 aExp;
-    bits64 aSig;
-    bits32 zSig;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    if ( aExp == 0x7FF ) {
-        if ( aSig ) return commonNaNToFloat32( float64ToCommonNaN( a ) );
-        return packFloat32( aSign, 0xFF, 0 );
-    }
-    shift64RightJamming( aSig, 22, &aSig );
-    zSig = aSig;
-    if ( aExp || zSig ) {
-        zSig |= 0x40000000;
-        aExp -= 0x381;
-    }
-    return roundAndPackFloat32( aSign, aExp, zSig );
-
-}
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the double-precision floating-point value
-`a' to the extended double-precision floating-point format.  The conversion
-is performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 float64_to_floatx80( float64 a )
-{
-    flag aSign;
-    int16 aExp;
-    bits64 aSig;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    if ( aExp == 0x7FF ) {
-        if ( aSig ) return commonNaNToFloatx80( float64ToCommonNaN( a ) );
-        return packFloatx80( aSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloatx80( aSign, 0, 0 );
-        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
-    }
-    return
-        packFloatx80(
-            aSign, aExp + 0x3C00, ( aSig | LIT64( 0x0010000000000000 ) )<<11 );
-
-}
-
-#endif
-
-/*
--------------------------------------------------------------------------------
-Rounds the double-precision floating-point value `a' to an integer, and
-returns the result as a double-precision floating-point value.  The
-operation is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float64_round_to_int( float64 a )
-{
-    flag aSign;
-    int16 aExp;
-    bits64 lastBitMask, roundBitsMask;
-    int8 roundingMode;
-    float64 z;
-
-    aExp = extractFloat64Exp( a );
-    if ( 0x433 <= aExp ) {
-        if ( ( aExp == 0x7FF ) && extractFloat64Frac( a ) ) {
-            return propagateFloat64NaN( a, a );
-        }
-        return a;
-    }
-    if ( aExp <= 0x3FE ) {
-        if ( (bits64) ( a<<1 ) == 0 ) return a;
-        float_exception_flags |= float_flag_inexact;
-        aSign = extractFloat64Sign( a );
-        switch ( float_rounding_mode ) {
-         case float_round_nearest_even:
-            if ( ( aExp == 0x3FE ) && extractFloat64Frac( a ) ) {
-                return packFloat64( aSign, 0x3FF, 0 );
-            }
-            break;
-         case float_round_down:
-            return aSign ? LIT64( 0xBFF0000000000000 ) : 0;
-         case float_round_up:
-            return
-            aSign ? LIT64( 0x8000000000000000 ) : LIT64( 0x3FF0000000000000 );
-        }
-        return packFloat64( aSign, 0, 0 );
-    }
-    lastBitMask = 1;
-    lastBitMask <<= 0x433 - aExp;
-    roundBitsMask = lastBitMask - 1;
-    z = a;
-    roundingMode = float_rounding_mode;
-    if ( roundingMode == float_round_nearest_even ) {
-        z += lastBitMask>>1;
-        if ( ( z & roundBitsMask ) == 0 ) z &= ~ lastBitMask;
-    }
-    else if ( roundingMode != float_round_to_zero ) {
-        if ( extractFloat64Sign( z ) ^ ( roundingMode == float_round_up ) ) {
-            z += roundBitsMask;
-        }
-    }
-    z &= ~ roundBitsMask;
-    if ( z != a ) float_exception_flags |= float_flag_inexact;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of adding the absolute values of the double-precision
-floating-point values `a' and `b'.  If `zSign' is true, the sum is negated
-before being returned.  `zSign' is ignored if the result is a NaN.  The
-addition is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static float64 addFloat64Sigs( float64 a, float64 b, flag zSign )
-{
-    int16 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig;
-    int16 expDiff;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    bSig = extractFloat64Frac( b );
-    bExp = extractFloat64Exp( b );
-    expDiff = aExp - bExp;
-    aSig <<= 9;
-    bSig <<= 9;
-    if ( 0 < expDiff ) {
-        if ( aExp == 0x7FF ) {
-            if ( aSig ) return propagateFloat64NaN( a, b );
-            return a;
-        }
-        if ( bExp == 0 ) {
-            --expDiff;
-        }
-        else {
-            bSig |= LIT64( 0x2000000000000000 );
-        }
-        shift64RightJamming( bSig, expDiff, &bSig );
-        zExp = aExp;
-    }
-    else if ( expDiff < 0 ) {
-        if ( bExp == 0x7FF ) {
-            if ( bSig ) return propagateFloat64NaN( a, b );
-            return packFloat64( zSign, 0x7FF, 0 );
-        }
-        if ( aExp == 0 ) {
-            ++expDiff;
-        }
-        else {
-            aSig |= LIT64( 0x2000000000000000 );
-        }
-        shift64RightJamming( aSig, - expDiff, &aSig );
-        zExp = bExp;
-    }
-    else {
-        if ( aExp == 0x7FF ) {
-            if ( aSig | bSig ) return propagateFloat64NaN( a, b );
-            return a;
-        }
-        if ( aExp == 0 ) return packFloat64( zSign, 0, ( aSig + bSig )>>9 );
-        zSig = LIT64( 0x4000000000000000 ) + aSig + bSig;
-        zExp = aExp;
-        goto roundAndPack;
-    }
-    aSig |= LIT64( 0x2000000000000000 );
-    zSig = ( aSig + bSig )<<1;
-    --zExp;
-    if ( (sbits64) zSig < 0 ) {
-        zSig = aSig + bSig;
-        ++zExp;
-    }
- roundAndPack:
-    return roundAndPackFloat64( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of subtracting the absolute values of the double-
-precision floating-point values `a' and `b'.  If `zSign' is true, the
-difference is negated before being returned.  `zSign' is ignored if the
-result is a NaN.  The subtraction is performed according to the IEC/IEEE
-Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static float64 subFloat64Sigs( float64 a, float64 b, flag zSign )
-{
-    int16 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig;
-    int16 expDiff;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    bSig = extractFloat64Frac( b );
-    bExp = extractFloat64Exp( b );
-    expDiff = aExp - bExp;
-    aSig <<= 10;
-    bSig <<= 10;
-    if ( 0 < expDiff ) goto aExpBigger;
-    if ( expDiff < 0 ) goto bExpBigger;
-    if ( aExp == 0x7FF ) {
-        if ( aSig | bSig ) return propagateFloat64NaN( a, b );
-        float_raise( float_flag_invalid );
-        return float64_default_nan;
-    }
-    if ( aExp == 0 ) {
-        aExp = 1;
-        bExp = 1;
-    }
-    if ( bSig < aSig ) goto aBigger;
-    if ( aSig < bSig ) goto bBigger;
-    return packFloat64( float_rounding_mode == float_round_down, 0, 0 );
- bExpBigger:
-    if ( bExp == 0x7FF ) {
-        if ( bSig ) return propagateFloat64NaN( a, b );
-        return packFloat64( zSign ^ 1, 0x7FF, 0 );
-    }
-    if ( aExp == 0 ) {
-        ++expDiff;
-    }
-    else {
-        aSig |= LIT64( 0x4000000000000000 );
-    }
-    shift64RightJamming( aSig, - expDiff, &aSig );
-    bSig |= LIT64( 0x4000000000000000 );
- bBigger:
-    zSig = bSig - aSig;
-    zExp = bExp;
-    zSign ^= 1;
-    goto normalizeRoundAndPack;
- aExpBigger:
-    if ( aExp == 0x7FF ) {
-        if ( aSig ) return propagateFloat64NaN( a, b );
-        return a;
-    }
-    if ( bExp == 0 ) {
-        --expDiff;
-    }
-    else {
-        bSig |= LIT64( 0x4000000000000000 );
-    }
-    shift64RightJamming( bSig, expDiff, &bSig );
-    aSig |= LIT64( 0x4000000000000000 );
- aBigger:
-    zSig = aSig - bSig;
-    zExp = aExp;
- normalizeRoundAndPack:
-    --zExp;
-    return normalizeRoundAndPackFloat64( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of adding the double-precision floating-point values `a'
-and `b'.  The operation is performed according to the IEC/IEEE Standard for
-Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float64_add( float64 a, float64 b )
-{
-    flag aSign, bSign;
-
-    aSign = extractFloat64Sign( a );
-    bSign = extractFloat64Sign( b );
-    if ( aSign == bSign ) {
-        return addFloat64Sigs( a, b, aSign );
-    }
-    else {
-        return subFloat64Sigs( a, b, aSign );
-    }
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of subtracting the double-precision floating-point values
-`a' and `b'.  The operation is performed according to the IEC/IEEE Standard
-for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float64_sub( float64 a, float64 b )
-{
-    flag aSign, bSign;
-
-    aSign = extractFloat64Sign( a );
-    bSign = extractFloat64Sign( b );
-    if ( aSign == bSign ) {
-        return subFloat64Sigs( a, b, aSign );
-    }
-    else {
-        return addFloat64Sigs( a, b, aSign );
-    }
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of multiplying the double-precision floating-point values
-`a' and `b'.  The operation is performed according to the IEC/IEEE Standard
-for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float64_mul( float64 a, float64 b )
-{
-    flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig0, zSig1;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    bSig = extractFloat64Frac( b );
-    bExp = extractFloat64Exp( b );
-    bSign = extractFloat64Sign( b );
-    zSign = aSign ^ bSign;
-    if ( aExp == 0x7FF ) {
-        if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) {
-            return propagateFloat64NaN( a, b );
-        }
-        if ( ( bExp | bSig ) == 0 ) {
-            float_raise( float_flag_invalid );
-            return float64_default_nan;
-        }
-        return packFloat64( zSign, 0x7FF, 0 );
-    }
-    if ( bExp == 0x7FF ) {
-        if ( bSig ) return propagateFloat64NaN( a, b );
-        if ( ( aExp | aSig ) == 0 ) {
-            float_raise( float_flag_invalid );
-            return float64_default_nan;
-        }
-        return packFloat64( zSign, 0x7FF, 0 );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloat64( zSign, 0, 0 );
-        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) return packFloat64( zSign, 0, 0 );
-        normalizeFloat64Subnormal( bSig, &bExp, &bSig );
-    }
-    zExp = aExp + bExp - 0x3FF;
-    aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<10;
-    bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
-    mul64To128( aSig, bSig, &zSig0, &zSig1 );
-    zSig0 |= ( zSig1 != 0 );
-    if ( 0 <= (sbits64) ( zSig0<<1 ) ) {
-        zSig0 <<= 1;
-        --zExp;
-    }
-    return roundAndPackFloat64( zSign, zExp, zSig0 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of dividing the double-precision floating-point value `a'
-by the corresponding value `b'.  The operation is performed according to
-the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float64_div( float64 a, float64 b )
-{
-    flag aSign, bSign, zSign;
-    int16 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig;
-    bits64 rem0, rem1;
-    bits64 term0, term1;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    bSig = extractFloat64Frac( b );
-    bExp = extractFloat64Exp( b );
-    bSign = extractFloat64Sign( b );
-    zSign = aSign ^ bSign;
-    if ( aExp == 0x7FF ) {
-        if ( aSig ) return propagateFloat64NaN( a, b );
-        if ( bExp == 0x7FF ) {
-            if ( bSig ) return propagateFloat64NaN( a, b );
-            float_raise( float_flag_invalid );
-            return float64_default_nan;
-        }
-        return packFloat64( zSign, 0x7FF, 0 );
-    }
-    if ( bExp == 0x7FF ) {
-        if ( bSig ) return propagateFloat64NaN( a, b );
-        return packFloat64( zSign, 0, 0 );
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) {
-            if ( ( aExp | aSig ) == 0 ) {
-                float_raise( float_flag_invalid );
-                return float64_default_nan;
-            }
-            float_raise( float_flag_divbyzero );
-            return packFloat64( zSign, 0x7FF, 0 );
-        }
-        normalizeFloat64Subnormal( bSig, &bExp, &bSig );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloat64( zSign, 0, 0 );
-        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
-    }
-    zExp = aExp - bExp + 0x3FD;
-    aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<10;
-    bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
-    if ( bSig <= ( aSig + aSig ) ) {
-        aSig >>= 1;
-        ++zExp;
-    }
-    zSig = estimateDiv128To64( aSig, 0, bSig );
-    if ( ( zSig & 0x1FF ) <= 2 ) {
-        mul64To128( bSig, zSig, &term0, &term1 );
-        sub128( aSig, 0, term0, term1, &rem0, &rem1 );
-        while ( (sbits64) rem0 < 0 ) {
-            --zSig;
-            add128( rem0, rem1, 0, bSig, &rem0, &rem1 );
-        }
-        zSig |= ( rem1 != 0 );
-    }
-    return roundAndPackFloat64( zSign, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the remainder of the double-precision floating-point value `a'
-with respect to the corresponding value `b'.  The operation is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float64_rem( float64 a, float64 b )
-{
-    flag aSign, bSign, zSign;
-    int16 aExp, bExp, expDiff;
-    bits64 aSig, bSig;
-    bits64 q, alternateASig;
-    sbits64 sigMean;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    bSig = extractFloat64Frac( b );
-    bExp = extractFloat64Exp( b );
-    bSign = extractFloat64Sign( b );
-    if ( aExp == 0x7FF ) {
-        if ( aSig || ( ( bExp == 0x7FF ) && bSig ) ) {
-            return propagateFloat64NaN( a, b );
-        }
-        float_raise( float_flag_invalid );
-        return float64_default_nan;
-    }
-    if ( bExp == 0x7FF ) {
-        if ( bSig ) return propagateFloat64NaN( a, b );
-        return a;
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) {
-            float_raise( float_flag_invalid );
-            return float64_default_nan;
-        }
-        normalizeFloat64Subnormal( bSig, &bExp, &bSig );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return a;
-        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
-    }
-    expDiff = aExp - bExp;
-    aSig = ( aSig | LIT64( 0x0010000000000000 ) )<<11;
-    bSig = ( bSig | LIT64( 0x0010000000000000 ) )<<11;
-    if ( expDiff < 0 ) {
-        if ( expDiff < -1 ) return a;
-        aSig >>= 1;
-    }
-    q = ( bSig <= aSig );
-    if ( q ) aSig -= bSig;
-    expDiff -= 64;
-    while ( 0 < expDiff ) {
-        q = estimateDiv128To64( aSig, 0, bSig );
-        q = ( 2 < q ) ? q - 2 : 0;
-        aSig = - ( ( bSig>>2 ) * q );
-        expDiff -= 62;
-    }
-    expDiff += 64;
-    if ( 0 < expDiff ) {
-        q = estimateDiv128To64( aSig, 0, bSig );
-        q = ( 2 < q ) ? q - 2 : 0;
-        q >>= 64 - expDiff;
-        bSig >>= 2;
-        aSig = ( ( aSig>>1 )<<( expDiff - 1 ) ) - bSig * q;
-    }
-    else {
-        aSig >>= 2;
-        bSig >>= 2;
-    }
-    do {
-        alternateASig = aSig;
-        ++q;
-        aSig -= bSig;
-    } while ( 0 <= (sbits64) aSig );
-    sigMean = aSig + alternateASig;
-    if ( ( sigMean < 0 ) || ( ( sigMean == 0 ) && ( q & 1 ) ) ) {
-        aSig = alternateASig;
-    }
-    zSign = ( (sbits64) aSig < 0 );
-    if ( zSign ) aSig = - aSig;
-    return normalizeRoundAndPackFloat64( aSign ^ zSign, bExp, aSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the square root of the double-precision floating-point value `a'.
-The operation is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 float64_sqrt( float64 a )
-{
-    flag aSign;
-    int16 aExp, zExp;
-    bits64 aSig, zSig;
-    bits64 rem0, rem1, term0, term1; //, shiftedRem;
-    //float64 z;
-
-    aSig = extractFloat64Frac( a );
-    aExp = extractFloat64Exp( a );
-    aSign = extractFloat64Sign( a );
-    if ( aExp == 0x7FF ) {
-        if ( aSig ) return propagateFloat64NaN( a, a );
-        if ( ! aSign ) return a;
-        float_raise( float_flag_invalid );
-        return float64_default_nan;
-    }
-    if ( aSign ) {
-        if ( ( aExp | aSig ) == 0 ) return a;
-        float_raise( float_flag_invalid );
-        return float64_default_nan;
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return 0;
-        normalizeFloat64Subnormal( aSig, &aExp, &aSig );
-    }
-    zExp = ( ( aExp - 0x3FF )>>1 ) + 0x3FE;
-    aSig |= LIT64( 0x0010000000000000 );
-    zSig = estimateSqrt32( aExp, aSig>>21 );
-    zSig <<= 31;
-    aSig <<= 9 - ( aExp & 1 );
-    zSig = estimateDiv128To64( aSig, 0, zSig ) + zSig + 2;
-    if ( ( zSig & 0x3FF ) <= 5 ) {
-        if ( zSig < 2 ) {
-            zSig = LIT64( 0xFFFFFFFFFFFFFFFF );
-        }
-        else {
-            aSig <<= 2;
-            mul64To128( zSig, zSig, &term0, &term1 );
-            sub128( aSig, 0, term0, term1, &rem0, &rem1 );
-            while ( (sbits64) rem0 < 0 ) {
-                --zSig;
-                shortShift128Left( 0, zSig, 1, &term0, &term1 );
-                term1 |= 1;
-                add128( rem0, rem1, term0, term1, &rem0, &rem1 );
-            }
-            zSig |= ( ( rem0 | rem1 ) != 0 );
-        }
-    }
-    shift64RightJamming( zSig, 1, &zSig );
-    return roundAndPackFloat64( 0, zExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is equal to the
-corresponding value `b', and 0 otherwise.  The comparison is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float64_eq( float64 a, float64 b )
-{
-
-    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
-         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
-       ) {
-        if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    return ( a == b ) || ( (bits64) ( ( a | b )<<1 ) == 0 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is less than or
-equal to the corresponding value `b', and 0 otherwise.  The comparison is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float64_le( float64 a, float64 b )
-{
-    flag aSign, bSign;
-
-    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
-         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    aSign = extractFloat64Sign( a );
-    bSign = extractFloat64Sign( b );
-    if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 );
-    return ( a == b ) || ( aSign ^ ( a < b ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is less than
-the corresponding value `b', and 0 otherwise.  The comparison is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float64_lt( float64 a, float64 b )
-{
-    flag aSign, bSign;
-
-    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
-         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    aSign = extractFloat64Sign( a );
-    bSign = extractFloat64Sign( b );
-    if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 );
-    return ( a != b ) && ( aSign ^ ( a < b ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is equal to the
-corresponding value `b', and 0 otherwise.  The invalid exception is raised
-if either operand is a NaN.  Otherwise, the comparison is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float64_eq_signaling( float64 a, float64 b )
-{
-
-    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
-         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    return ( a == b ) || ( (bits64) ( ( a | b )<<1 ) == 0 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is less than or
-equal to the corresponding value `b', and 0 otherwise.  Quiet NaNs do not
-cause an exception.  Otherwise, the comparison is performed according to the
-IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float64_le_quiet( float64 a, float64 b )
-{
-    flag aSign, bSign;
-    //int16 aExp, bExp;
-
-    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
-         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
-       ) {
-        if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    aSign = extractFloat64Sign( a );
-    bSign = extractFloat64Sign( b );
-    if ( aSign != bSign ) return aSign || ( (bits64) ( ( a | b )<<1 ) == 0 );
-    return ( a == b ) || ( aSign ^ ( a < b ) );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the double-precision floating-point value `a' is less than
-the corresponding value `b', and 0 otherwise.  Quiet NaNs do not cause an
-exception.  Otherwise, the comparison is performed according to the IEC/IEEE
-Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag float64_lt_quiet( float64 a, float64 b )
-{
-    flag aSign, bSign;
-
-    if (    ( ( extractFloat64Exp( a ) == 0x7FF ) && extractFloat64Frac( a ) )
-         || ( ( extractFloat64Exp( b ) == 0x7FF ) && extractFloat64Frac( b ) )
-       ) {
-        if ( float64_is_signaling_nan( a ) || float64_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    aSign = extractFloat64Sign( a );
-    bSign = extractFloat64Sign( b );
-    if ( aSign != bSign ) return aSign && ( (bits64) ( ( a | b )<<1 ) != 0 );
-    return ( a != b ) && ( aSign ^ ( a < b ) );
-
-}
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the extended double-precision floating-
-point value `a' to the 32-bit two's complement integer format.  The
-conversion is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic---which means in particular that the conversion
-is rounded according to the current rounding mode.  If `a' is a NaN, the
-largest positive integer is returned.  Otherwise, if the conversion
-overflows, the largest integer with the same sign as `a' is returned.
--------------------------------------------------------------------------------
-*/
-int32 floatx80_to_int32( floatx80 a )
-{
-    flag aSign;
-    int32 aExp, shiftCount;
-    bits64 aSig;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    if ( ( aExp == 0x7FFF ) && (bits64) ( aSig<<1 ) ) aSign = 0;
-    shiftCount = 0x4037 - aExp;
-    if ( shiftCount <= 0 ) shiftCount = 1;
-    shift64RightJamming( aSig, shiftCount, &aSig );
-    return roundAndPackInt32( aSign, aSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the extended double-precision floating-
-point value `a' to the 32-bit two's complement integer format.  The
-conversion is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic, except that the conversion is always rounded
-toward zero.  If `a' is a NaN, the largest positive integer is returned.
-Otherwise, if the conversion overflows, the largest integer with the same
-sign as `a' is returned.
--------------------------------------------------------------------------------
-*/
-int32 floatx80_to_int32_round_to_zero( floatx80 a )
-{
-    flag aSign;
-    int32 aExp, shiftCount;
-    bits64 aSig, savedASig;
-    int32 z;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    shiftCount = 0x403E - aExp;
-    if ( shiftCount < 32 ) {
-        if ( ( aExp == 0x7FFF ) && (bits64) ( aSig<<1 ) ) aSign = 0;
-        goto invalid;
-    }
-    else if ( 63 < shiftCount ) {
-        if ( aExp || aSig ) float_exception_flags |= float_flag_inexact;
-        return 0;
-    }
-    savedASig = aSig;
-    aSig >>= shiftCount;
-    z = aSig;
-    if ( aSign ) z = - z;
-    if ( ( z < 0 ) ^ aSign ) {
- invalid:
-        float_exception_flags |= float_flag_invalid;
-        return aSign ? 0x80000000 : 0x7FFFFFFF;
-    }
-    if ( ( aSig<<shiftCount ) != savedASig ) {
-        float_exception_flags |= float_flag_inexact;
-    }
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the extended double-precision floating-
-point value `a' to the single-precision floating-point format.  The
-conversion is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float32 floatx80_to_float32( floatx80 a )
-{
-    flag aSign;
-    int32 aExp;
-    bits64 aSig;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    if ( aExp == 0x7FFF ) {
-        if ( (bits64) ( aSig<<1 ) ) {
-            return commonNaNToFloat32( floatx80ToCommonNaN( a ) );
-        }
-        return packFloat32( aSign, 0xFF, 0 );
-    }
-    shift64RightJamming( aSig, 33, &aSig );
-    if ( aExp || aSig ) aExp -= 0x3F81;
-    return roundAndPackFloat32( aSign, aExp, aSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of converting the extended double-precision floating-
-point value `a' to the double-precision floating-point format.  The
-conversion is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-float64 floatx80_to_float64( floatx80 a )
-{
-    flag aSign;
-    int32 aExp;
-    bits64 aSig, zSig;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    if ( aExp == 0x7FFF ) {
-        if ( (bits64) ( aSig<<1 ) ) {
-            return commonNaNToFloat64( floatx80ToCommonNaN( a ) );
-        }
-        return packFloat64( aSign, 0x7FF, 0 );
-    }
-    shift64RightJamming( aSig, 1, &zSig );
-    if ( aExp || aSig ) aExp -= 0x3C01;
-    return roundAndPackFloat64( aSign, aExp, zSig );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Rounds the extended double-precision floating-point value `a' to an integer,
-and returns the result as an extended quadruple-precision floating-point
-value.  The operation is performed according to the IEC/IEEE Standard for
-Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_round_to_int( floatx80 a )
-{
-    flag aSign;
-    int32 aExp;
-    bits64 lastBitMask, roundBitsMask;
-    int8 roundingMode;
-    floatx80 z;
-
-    aExp = extractFloatx80Exp( a );
-    if ( 0x403E <= aExp ) {
-        if ( ( aExp == 0x7FFF ) && (bits64) ( extractFloatx80Frac( a )<<1 ) ) {
-            return propagateFloatx80NaN( a, a );
-        }
-        return a;
-    }
-    if ( aExp <= 0x3FFE ) {
-        if (    ( aExp == 0 )
-             && ( (bits64) ( extractFloatx80Frac( a )<<1 ) == 0 ) ) {
-            return a;
-        }
-        float_exception_flags |= float_flag_inexact;
-        aSign = extractFloatx80Sign( a );
-        switch ( float_rounding_mode ) {
-         case float_round_nearest_even:
-            if ( ( aExp == 0x3FFE ) && (bits64) ( extractFloatx80Frac( a )<<1 )
-               ) {
-                return
-                    packFloatx80( aSign, 0x3FFF, LIT64( 0x8000000000000000 ) );
-            }
-            break;
-         case float_round_down:
-            return
-                  aSign ?
-                      packFloatx80( 1, 0x3FFF, LIT64( 0x8000000000000000 ) )
-                : packFloatx80( 0, 0, 0 );
-         case float_round_up:
-            return
-                  aSign ? packFloatx80( 1, 0, 0 )
-                : packFloatx80( 0, 0x3FFF, LIT64( 0x8000000000000000 ) );
-        }
-        return packFloatx80( aSign, 0, 0 );
-    }
-    lastBitMask = 1;
-    lastBitMask <<= 0x403E - aExp;
-    roundBitsMask = lastBitMask - 1;
-    z = a;
-    roundingMode = float_rounding_mode;
-    if ( roundingMode == float_round_nearest_even ) {
-        z.low += lastBitMask>>1;
-        if ( ( z.low & roundBitsMask ) == 0 ) z.low &= ~ lastBitMask;
-    }
-    else if ( roundingMode != float_round_to_zero ) {
-        if ( extractFloatx80Sign( z ) ^ ( roundingMode == float_round_up ) ) {
-            z.low += roundBitsMask;
-        }
-    }
-    z.low &= ~ roundBitsMask;
-    if ( z.low == 0 ) {
-        ++z.high;
-        z.low = LIT64( 0x8000000000000000 );
-    }
-    if ( z.low != a.low ) float_exception_flags |= float_flag_inexact;
-    return z;
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of adding the absolute values of the extended double-
-precision floating-point values `a' and `b'.  If `zSign' is true, the sum is
-negated before being returned.  `zSign' is ignored if the result is a NaN.
-The addition is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static floatx80 addFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
-{
-    int32 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig0, zSig1;
-    int32 expDiff;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    bSig = extractFloatx80Frac( b );
-    bExp = extractFloatx80Exp( b );
-    expDiff = aExp - bExp;
-    if ( 0 < expDiff ) {
-        if ( aExp == 0x7FFF ) {
-            if ( (bits64) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b );
-            return a;
-        }
-        if ( bExp == 0 ) --expDiff;
-        shift64ExtraRightJamming( bSig, 0, expDiff, &bSig, &zSig1 );
-        zExp = aExp;
-    }
-    else if ( expDiff < 0 ) {
-        if ( bExp == 0x7FFF ) {
-            if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
-            return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-        }
-        if ( aExp == 0 ) ++expDiff;
-        shift64ExtraRightJamming( aSig, 0, - expDiff, &aSig, &zSig1 );
-        zExp = bExp;
-    }
-    else {
-        if ( aExp == 0x7FFF ) {
-            if ( (bits64) ( ( aSig | bSig )<<1 ) ) {
-                return propagateFloatx80NaN( a, b );
-            }
-            return a;
-        }
-        zSig1 = 0;
-        zSig0 = aSig + bSig;
-        if ( aExp == 0 ) {
-            normalizeFloatx80Subnormal( zSig0, &zExp, &zSig0 );
-            goto roundAndPack;
-        }
-        zExp = aExp;
-        goto shiftRight1;
-    }
-    
-    zSig0 = aSig + bSig;
-
-    if ( (sbits64) zSig0 < 0 ) goto roundAndPack; 
- shiftRight1:
-    shift64ExtraRightJamming( zSig0, zSig1, 1, &zSig0, &zSig1 );
-    zSig0 |= LIT64( 0x8000000000000000 );
-    ++zExp;
- roundAndPack:
-    return
-        roundAndPackFloatx80(
-            floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of subtracting the absolute values of the extended
-double-precision floating-point values `a' and `b'.  If `zSign' is true,
-the difference is negated before being returned.  `zSign' is ignored if the
-result is a NaN.  The subtraction is performed according to the IEC/IEEE
-Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-static floatx80 subFloatx80Sigs( floatx80 a, floatx80 b, flag zSign )
-{
-    int32 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig0, zSig1;
-    int32 expDiff;
-    floatx80 z;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    bSig = extractFloatx80Frac( b );
-    bExp = extractFloatx80Exp( b );
-    expDiff = aExp - bExp;
-    if ( 0 < expDiff ) goto aExpBigger;
-    if ( expDiff < 0 ) goto bExpBigger;
-    if ( aExp == 0x7FFF ) {
-        if ( (bits64) ( ( aSig | bSig )<<1 ) ) {
-            return propagateFloatx80NaN( a, b );
-        }
-        float_raise( float_flag_invalid );
-        z.low = floatx80_default_nan_low;
-        z.high = floatx80_default_nan_high;
-        return z;
-    }
-    if ( aExp == 0 ) {
-        aExp = 1;
-        bExp = 1;
-    }
-    zSig1 = 0;
-    if ( bSig < aSig ) goto aBigger;
-    if ( aSig < bSig ) goto bBigger;
-    return packFloatx80( float_rounding_mode == float_round_down, 0, 0 );
- bExpBigger:
-    if ( bExp == 0x7FFF ) {
-        if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
-        return packFloatx80( zSign ^ 1, 0x7FFF, LIT64( 0x8000000000000000 ) );
-    }
-    if ( aExp == 0 ) ++expDiff;
-    shift128RightJamming( aSig, 0, - expDiff, &aSig, &zSig1 );
- bBigger:
-    sub128( bSig, 0, aSig, zSig1, &zSig0, &zSig1 );
-    zExp = bExp;
-    zSign ^= 1;
-    goto normalizeRoundAndPack;
- aExpBigger:
-    if ( aExp == 0x7FFF ) {
-        if ( (bits64) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b );
-        return a;
-    }
-    if ( bExp == 0 ) --expDiff;
-    shift128RightJamming( bSig, 0, expDiff, &bSig, &zSig1 );
- aBigger:
-    sub128( aSig, 0, bSig, zSig1, &zSig0, &zSig1 );
-    zExp = aExp;
- normalizeRoundAndPack:
-    return
-        normalizeRoundAndPackFloatx80(
-            floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of adding the extended double-precision floating-point
-values `a' and `b'.  The operation is performed according to the IEC/IEEE
-Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_add( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign;
-    
-    aSign = extractFloatx80Sign( a );
-    bSign = extractFloatx80Sign( b );
-    if ( aSign == bSign ) {
-        return addFloatx80Sigs( a, b, aSign );
-    }
-    else {
-        return subFloatx80Sigs( a, b, aSign );
-    }
-    
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of subtracting the extended double-precision floating-
-point values `a' and `b'.  The operation is performed according to the
-IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_sub( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign;
-
-    aSign = extractFloatx80Sign( a );
-    bSign = extractFloatx80Sign( b );
-    if ( aSign == bSign ) {
-        return subFloatx80Sigs( a, b, aSign );
-    }
-    else {
-        return addFloatx80Sigs( a, b, aSign );
-    }
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of multiplying the extended double-precision floating-
-point values `a' and `b'.  The operation is performed according to the
-IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_mul( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig0, zSig1;
-    floatx80 z;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    bSig = extractFloatx80Frac( b );
-    bExp = extractFloatx80Exp( b );
-    bSign = extractFloatx80Sign( b );
-    zSign = aSign ^ bSign;
-    if ( aExp == 0x7FFF ) {
-        if (    (bits64) ( aSig<<1 )
-             || ( ( bExp == 0x7FFF ) && (bits64) ( bSig<<1 ) ) ) {
-            return propagateFloatx80NaN( a, b );
-        }
-        if ( ( bExp | bSig ) == 0 ) goto invalid;
-        return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-    }
-    if ( bExp == 0x7FFF ) {
-        if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
-        if ( ( aExp | aSig ) == 0 ) {
- invalid:
-            float_raise( float_flag_invalid );
-            z.low = floatx80_default_nan_low;
-            z.high = floatx80_default_nan_high;
-            return z;
-        }
-        return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 );
-        normalizeFloatx80Subnormal( aSig, &aExp, &aSig );
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) return packFloatx80( zSign, 0, 0 );
-        normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
-    }
-    zExp = aExp + bExp - 0x3FFE;
-    mul64To128( aSig, bSig, &zSig0, &zSig1 );
-    if ( 0 < (sbits64) zSig0 ) {
-        shortShift128Left( zSig0, zSig1, 1, &zSig0, &zSig1 );
-        --zExp;
-    }
-    return
-        roundAndPackFloatx80(
-            floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the result of dividing the extended double-precision floating-point
-value `a' by the corresponding value `b'.  The operation is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_div( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign, zSign;
-    int32 aExp, bExp, zExp;
-    bits64 aSig, bSig, zSig0, zSig1;
-    bits64 rem0, rem1, rem2, term0, term1, term2;
-    floatx80 z;
-
-    aSig = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    bSig = extractFloatx80Frac( b );
-    bExp = extractFloatx80Exp( b );
-    bSign = extractFloatx80Sign( b );
-    zSign = aSign ^ bSign;
-    if ( aExp == 0x7FFF ) {
-        if ( (bits64) ( aSig<<1 ) ) return propagateFloatx80NaN( a, b );
-        if ( bExp == 0x7FFF ) {
-            if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
-            goto invalid;
-        }
-        return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-    }
-    if ( bExp == 0x7FFF ) {
-        if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
-        return packFloatx80( zSign, 0, 0 );
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) {
-            if ( ( aExp | aSig ) == 0 ) {
- invalid:
-                float_raise( float_flag_invalid );
-                z.low = floatx80_default_nan_low;
-                z.high = floatx80_default_nan_high;
-                return z;
-            }
-            float_raise( float_flag_divbyzero );
-            return packFloatx80( zSign, 0x7FFF, LIT64( 0x8000000000000000 ) );
-        }
-        normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
-    }
-    if ( aExp == 0 ) {
-        if ( aSig == 0 ) return packFloatx80( zSign, 0, 0 );
-        normalizeFloatx80Subnormal( aSig, &aExp, &aSig );
-    }
-    zExp = aExp - bExp + 0x3FFE;
-    rem1 = 0;
-    if ( bSig <= aSig ) {
-        shift128Right( aSig, 0, 1, &aSig, &rem1 );
-        ++zExp;
-    }
-    zSig0 = estimateDiv128To64( aSig, rem1, bSig );
-    mul64To128( bSig, zSig0, &term0, &term1 );
-    sub128( aSig, rem1, term0, term1, &rem0, &rem1 );
-    while ( (sbits64) rem0 < 0 ) {
-        --zSig0;
-        add128( rem0, rem1, 0, bSig, &rem0, &rem1 );
-    }
-    zSig1 = estimateDiv128To64( rem1, 0, bSig );
-    if ( (bits64) ( zSig1<<1 ) <= 8 ) {
-        mul64To128( bSig, zSig1, &term1, &term2 );
-        sub128( rem1, 0, term1, term2, &rem1, &rem2 );
-        while ( (sbits64) rem1 < 0 ) {
-            --zSig1;
-            add128( rem1, rem2, 0, bSig, &rem1, &rem2 );
-        }
-        zSig1 |= ( ( rem1 | rem2 ) != 0 );
-    }
-    return
-        roundAndPackFloatx80(
-            floatx80_rounding_precision, zSign, zExp, zSig0, zSig1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the remainder of the extended double-precision floating-point value
-`a' with respect to the corresponding value `b'.  The operation is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_rem( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign, zSign;
-    int32 aExp, bExp, expDiff;
-    bits64 aSig0, aSig1, bSig;
-    bits64 q, term0, term1, alternateASig0, alternateASig1;
-    floatx80 z;
-
-    aSig0 = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    bSig = extractFloatx80Frac( b );
-    bExp = extractFloatx80Exp( b );
-    bSign = extractFloatx80Sign( b );
-    if ( aExp == 0x7FFF ) {
-        if (    (bits64) ( aSig0<<1 )
-             || ( ( bExp == 0x7FFF ) && (bits64) ( bSig<<1 ) ) ) {
-            return propagateFloatx80NaN( a, b );
-        }
-        goto invalid;
-    }
-    if ( bExp == 0x7FFF ) {
-        if ( (bits64) ( bSig<<1 ) ) return propagateFloatx80NaN( a, b );
-        return a;
-    }
-    if ( bExp == 0 ) {
-        if ( bSig == 0 ) {
- invalid:
-            float_raise( float_flag_invalid );
-            z.low = floatx80_default_nan_low;
-            z.high = floatx80_default_nan_high;
-            return z;
-        }
-        normalizeFloatx80Subnormal( bSig, &bExp, &bSig );
-    }
-    if ( aExp == 0 ) {
-        if ( (bits64) ( aSig0<<1 ) == 0 ) return a;
-        normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 );
-    }
-    bSig |= LIT64( 0x8000000000000000 );
-    zSign = aSign;
-    expDiff = aExp - bExp;
-    aSig1 = 0;
-    if ( expDiff < 0 ) {
-        if ( expDiff < -1 ) return a;
-        shift128Right( aSig0, 0, 1, &aSig0, &aSig1 );
-        expDiff = 0;
-    }
-    q = ( bSig <= aSig0 );
-    if ( q ) aSig0 -= bSig;
-    expDiff -= 64;
-    while ( 0 < expDiff ) {
-        q = estimateDiv128To64( aSig0, aSig1, bSig );
-        q = ( 2 < q ) ? q - 2 : 0;
-        mul64To128( bSig, q, &term0, &term1 );
-        sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
-        shortShift128Left( aSig0, aSig1, 62, &aSig0, &aSig1 );
-        expDiff -= 62;
-    }
-    expDiff += 64;
-    if ( 0 < expDiff ) {
-        q = estimateDiv128To64( aSig0, aSig1, bSig );
-        q = ( 2 < q ) ? q - 2 : 0;
-        q >>= 64 - expDiff;
-        mul64To128( bSig, q<<( 64 - expDiff ), &term0, &term1 );
-        sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
-        shortShift128Left( 0, bSig, 64 - expDiff, &term0, &term1 );
-        while ( le128( term0, term1, aSig0, aSig1 ) ) {
-            ++q;
-            sub128( aSig0, aSig1, term0, term1, &aSig0, &aSig1 );
-        }
-    }
-    else {
-        term1 = 0;
-        term0 = bSig;
-    }
-    sub128( term0, term1, aSig0, aSig1, &alternateASig0, &alternateASig1 );
-    if (    lt128( alternateASig0, alternateASig1, aSig0, aSig1 )
-         || (    eq128( alternateASig0, alternateASig1, aSig0, aSig1 )
-              && ( q & 1 ) )
-       ) {
-        aSig0 = alternateASig0;
-        aSig1 = alternateASig1;
-        zSign = ! zSign;
-    }
-    return
-        normalizeRoundAndPackFloatx80(
-            80, zSign, bExp + expDiff, aSig0, aSig1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns the square root of the extended double-precision floating-point
-value `a'.  The operation is performed according to the IEC/IEEE Standard
-for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_sqrt( floatx80 a )
-{
-    flag aSign;
-    int32 aExp, zExp;
-    bits64 aSig0, aSig1, zSig0, zSig1;
-    bits64 rem0, rem1, rem2, rem3, term0, term1, term2, term3;
-    bits64 shiftedRem0, shiftedRem1;
-    floatx80 z;
-
-    aSig0 = extractFloatx80Frac( a );
-    aExp = extractFloatx80Exp( a );
-    aSign = extractFloatx80Sign( a );
-    if ( aExp == 0x7FFF ) {
-        if ( (bits64) ( aSig0<<1 ) ) return propagateFloatx80NaN( a, a );
-        if ( ! aSign ) return a;
-        goto invalid;
-    }
-    if ( aSign ) {
-        if ( ( aExp | aSig0 ) == 0 ) return a;
- invalid:
-        float_raise( float_flag_invalid );
-        z.low = floatx80_default_nan_low;
-        z.high = floatx80_default_nan_high;
-        return z;
-    }
-    if ( aExp == 0 ) {
-        if ( aSig0 == 0 ) return packFloatx80( 0, 0, 0 );
-        normalizeFloatx80Subnormal( aSig0, &aExp, &aSig0 );
-    }
-    zExp = ( ( aExp - 0x3FFF )>>1 ) + 0x3FFF;
-    zSig0 = estimateSqrt32( aExp, aSig0>>32 );
-    zSig0 <<= 31;
-    aSig1 = 0;
-    shift128Right( aSig0, 0, ( aExp & 1 ) + 2, &aSig0, &aSig1 );
-    zSig0 = estimateDiv128To64( aSig0, aSig1, zSig0 ) + zSig0 + 4;
-    if ( 0 <= (sbits64) zSig0 ) zSig0 = LIT64( 0xFFFFFFFFFFFFFFFF );
-    shortShift128Left( aSig0, aSig1, 2, &aSig0, &aSig1 );
-    mul64To128( zSig0, zSig0, &term0, &term1 );
-    sub128( aSig0, aSig1, term0, term1, &rem0, &rem1 );
-    while ( (sbits64) rem0 < 0 ) {
-        --zSig0;
-        shortShift128Left( 0, zSig0, 1, &term0, &term1 );
-        term1 |= 1;
-        add128( rem0, rem1, term0, term1, &rem0, &rem1 );
-    }
-    shortShift128Left( rem0, rem1, 63, &shiftedRem0, &shiftedRem1 );
-    zSig1 = estimateDiv128To64( shiftedRem0, shiftedRem1, zSig0 );
-    if ( (bits64) ( zSig1<<1 ) <= 10 ) {
-        if ( zSig1 == 0 ) zSig1 = 1;
-        mul64To128( zSig0, zSig1, &term1, &term2 );
-        shortShift128Left( term1, term2, 1, &term1, &term2 );
-        sub128( rem1, 0, term1, term2, &rem1, &rem2 );
-        mul64To128( zSig1, zSig1, &term2, &term3 );
-        sub192( rem1, rem2, 0, 0, term2, term3, &rem1, &rem2, &rem3 );
-        while ( (sbits64) rem1 < 0 ) {
-            --zSig1;
-            shortShift192Left( 0, zSig0, zSig1, 1, &term1, &term2, &term3 );
-            term3 |= 1;
-            add192(
-                rem1, rem2, rem3, term1, term2, term3, &rem1, &rem2, &rem3 );
-        }
-        zSig1 |= ( ( rem1 | rem2 | rem3 ) != 0 );
-    }
-    return
-        roundAndPackFloatx80(
-            floatx80_rounding_precision, 0, zExp, zSig0, zSig1 );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is
-equal to the corresponding value `b', and 0 otherwise.  The comparison is
-performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag floatx80_eq( floatx80 a, floatx80 b )
-{
-
-    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( a )<<1 ) )
-         || (    ( extractFloatx80Exp( b ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( b )<<1 ) )
-       ) {
-        if (    floatx80_is_signaling_nan( a )
-             || floatx80_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    return
-           ( a.low == b.low )
-        && (    ( a.high == b.high )
-             || (    ( a.low == 0 )
-                  && ( (bits16) ( ( a.high | b.high )<<1 ) == 0 ) )
-           );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is
-less than or equal to the corresponding value `b', and 0 otherwise.  The
-comparison is performed according to the IEC/IEEE Standard for Binary
-Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag floatx80_le( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign;
-
-    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( a )<<1 ) )
-         || (    ( extractFloatx80Exp( b ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( b )<<1 ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    aSign = extractFloatx80Sign( a );
-    bSign = extractFloatx80Sign( b );
-    if ( aSign != bSign ) {
-        return
-               aSign
-            || (    ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
-                 == 0 );
-    }
-    return
-          aSign ? le128( b.high, b.low, a.high, a.low )
-        : le128( a.high, a.low, b.high, b.low );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is
-less than the corresponding value `b', and 0 otherwise.  The comparison
-is performed according to the IEC/IEEE Standard for Binary Floating-point
-Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag floatx80_lt( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign;
-
-    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( a )<<1 ) )
-         || (    ( extractFloatx80Exp( b ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( b )<<1 ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    aSign = extractFloatx80Sign( a );
-    bSign = extractFloatx80Sign( b );
-    if ( aSign != bSign ) {
-        return
-               aSign
-            && (    ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
-                 != 0 );
-    }
-    return
-          aSign ? lt128( b.high, b.low, a.high, a.low )
-        : lt128( a.high, a.low, b.high, b.low );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is equal
-to the corresponding value `b', and 0 otherwise.  The invalid exception is
-raised if either operand is a NaN.  Otherwise, the comparison is performed
-according to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag floatx80_eq_signaling( floatx80 a, floatx80 b )
-{
-
-    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( a )<<1 ) )
-         || (    ( extractFloatx80Exp( b ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( b )<<1 ) )
-       ) {
-        float_raise( float_flag_invalid );
-        return 0;
-    }
-    return
-           ( a.low == b.low )
-        && (    ( a.high == b.high )
-             || (    ( a.low == 0 )
-                  && ( (bits16) ( ( a.high | b.high )<<1 ) == 0 ) )
-           );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is less
-than or equal to the corresponding value `b', and 0 otherwise.  Quiet NaNs
-do not cause an exception.  Otherwise, the comparison is performed according
-to the IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag floatx80_le_quiet( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign;
-
-    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( a )<<1 ) )
-         || (    ( extractFloatx80Exp( b ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( b )<<1 ) )
-       ) {
-        if (    floatx80_is_signaling_nan( a )
-             || floatx80_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    aSign = extractFloatx80Sign( a );
-    bSign = extractFloatx80Sign( b );
-    if ( aSign != bSign ) {
-        return
-               aSign
-            || (    ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
-                 == 0 );
-    }
-    return
-          aSign ? le128( b.high, b.low, a.high, a.low )
-        : le128( a.high, a.low, b.high, b.low );
-
-}
-
-/*
--------------------------------------------------------------------------------
-Returns 1 if the extended double-precision floating-point value `a' is less
-than the corresponding value `b', and 0 otherwise.  Quiet NaNs do not cause
-an exception.  Otherwise, the comparison is performed according to the
-IEC/IEEE Standard for Binary Floating-point Arithmetic.
--------------------------------------------------------------------------------
-*/
-flag floatx80_lt_quiet( floatx80 a, floatx80 b )
-{
-    flag aSign, bSign;
-
-    if (    (    ( extractFloatx80Exp( a ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( a )<<1 ) )
-         || (    ( extractFloatx80Exp( b ) == 0x7FFF )
-              && (bits64) ( extractFloatx80Frac( b )<<1 ) )
-       ) {
-        if (    floatx80_is_signaling_nan( a )
-             || floatx80_is_signaling_nan( b ) ) {
-            float_raise( float_flag_invalid );
-        }
-        return 0;
-    }
-    aSign = extractFloatx80Sign( a );
-    bSign = extractFloatx80Sign( b );
-    if ( aSign != bSign ) {
-        return
-               aSign
-            && (    ( ( (bits16) ( ( a.high | b.high )<<1 ) ) | a.low | b.low )
-                 != 0 );
-    }
-    return
-          aSign ? lt128( b.high, b.low, a.high, a.low )
-        : lt128( a.high, a.low, b.high, b.low );
-
-}
-
-#endif
-
diff --git a/arch/arm26/nwfpe/softfloat.h b/arch/arm26/nwfpe/softfloat.h
deleted file mode 100644 (file)
index 22c2193..0000000
+++ /dev/null
@@ -1,232 +0,0 @@
-
-/*
-===============================================================================
-
-This C header file is part of the SoftFloat IEC/IEEE Floating-point
-Arithmetic Package, Release 2.
-
-Written by John R. Hauser.  This work was made possible in part by the
-International Computer Science Institute, located at Suite 600, 1947 Center
-Street, Berkeley, California 94704.  Funding was partially provided by the
-National Science Foundation under grant MIP-9311980.  The original version
-of this code was written as part of a project to build a fixed-point vector
-processor in collaboration with the University of California at Berkeley,
-overseen by Profs. Nelson Morgan and John Wawrzynek.  More information
-is available through the Web page `http://HTTP.CS.Berkeley.EDU/~jhauser/
-arithmetic/softfloat.html'.
-
-THIS SOFTWARE IS DISTRIBUTED AS IS, FOR FREE.  Although reasonable effort
-has been made to avoid it, THIS SOFTWARE MAY CONTAIN FAULTS THAT WILL AT
-TIMES RESULT IN INCORRECT BEHAVIOR.  USE OF THIS SOFTWARE IS RESTRICTED TO
-PERSONS AND ORGANIZATIONS WHO CAN AND WILL TAKE FULL RESPONSIBILITY FOR ANY
-AND ALL LOSSES, COSTS, OR OTHER PROBLEMS ARISING FROM ITS USE.
-
-Derivative works are acceptable, even for commercial purposes, so long as
-(1) they include prominent notice that the work is derivative, and (2) they
-include prominent notice akin to these three paragraphs for those parts of
-this code that are retained.
-
-===============================================================================
-*/
-
-#ifndef __SOFTFLOAT_H__
-#define __SOFTFLOAT_H__
-
-/*
--------------------------------------------------------------------------------
-The macro `FLOATX80' must be defined to enable the extended double-precision
-floating-point format `floatx80'.  If this macro is not defined, the
-`floatx80' type will not be defined, and none of the functions that either
-input or output the `floatx80' type will be defined.
--------------------------------------------------------------------------------
-*/
-#define FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point types.
--------------------------------------------------------------------------------
-*/
-typedef unsigned long int float32;
-typedef unsigned long long float64;
-typedef struct {
-    unsigned short high;
-    unsigned long long low;
-} floatx80;
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point underflow tininess-detection mode.
--------------------------------------------------------------------------------
-*/
-extern signed char float_detect_tininess;
-enum {
-    float_tininess_after_rounding  = 0,
-    float_tininess_before_rounding = 1
-};
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point rounding mode.
--------------------------------------------------------------------------------
-*/
-extern signed char float_rounding_mode;
-enum {
-    float_round_nearest_even = 0,
-    float_round_to_zero      = 1,
-    float_round_down         = 2,
-    float_round_up           = 3
-};
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE floating-point exception flags.
--------------------------------------------------------------------------------
-extern signed char float_exception_flags;
-enum {
-    float_flag_inexact   =  1,
-    float_flag_underflow =  2,
-    float_flag_overflow  =  4,
-    float_flag_divbyzero =  8,
-    float_flag_invalid   = 16
-};
-
-ScottB: November 4, 1998
-Changed the enumeration to match the bit order in the FPA11.
-*/
-
-extern signed char float_exception_flags;
-enum {
-    float_flag_invalid   =  1,
-    float_flag_divbyzero =  2,
-    float_flag_overflow  =  4,
-    float_flag_underflow =  8,
-    float_flag_inexact   = 16
-};
-
-/*
--------------------------------------------------------------------------------
-Routine to raise any or all of the software IEC/IEEE floating-point
-exception flags.
--------------------------------------------------------------------------------
-*/
-void float_raise( signed char );
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE integer-to-floating-point conversion routines.
--------------------------------------------------------------------------------
-*/
-float32 int32_to_float32( signed int );
-float64 int32_to_float64( signed int );
-#ifdef FLOATX80
-floatx80 int32_to_floatx80( signed int );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE single-precision conversion routines.
--------------------------------------------------------------------------------
-*/
-signed int float32_to_int32( float32 );
-signed int float32_to_int32_round_to_zero( float32 );
-float64 float32_to_float64( float32 );
-#ifdef FLOATX80
-floatx80 float32_to_floatx80( float32 );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE single-precision operations.
--------------------------------------------------------------------------------
-*/
-float32 float32_round_to_int( float32 );
-float32 float32_add( float32, float32 );
-float32 float32_sub( float32, float32 );
-float32 float32_mul( float32, float32 );
-float32 float32_div( float32, float32 );
-float32 float32_rem( float32, float32 );
-float32 float32_sqrt( float32 );
-char float32_eq( float32, float32 );
-char float32_le( float32, float32 );
-char float32_lt( float32, float32 );
-char float32_eq_signaling( float32, float32 );
-char float32_le_quiet( float32, float32 );
-char float32_lt_quiet( float32, float32 );
-char float32_is_signaling_nan( float32 );
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE double-precision conversion routines.
--------------------------------------------------------------------------------
-*/
-signed int float64_to_int32( float64 );
-signed int float64_to_int32_round_to_zero( float64 );
-float32 float64_to_float32( float64 );
-#ifdef FLOATX80
-floatx80 float64_to_floatx80( float64 );
-#endif
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE double-precision operations.
--------------------------------------------------------------------------------
-*/
-float64 float64_round_to_int( float64 );
-float64 float64_add( float64, float64 );
-float64 float64_sub( float64, float64 );
-float64 float64_mul( float64, float64 );
-float64 float64_div( float64, float64 );
-float64 float64_rem( float64, float64 );
-float64 float64_sqrt( float64 );
-char float64_eq( float64, float64 );
-char float64_le( float64, float64 );
-char float64_lt( float64, float64 );
-char float64_eq_signaling( float64, float64 );
-char float64_le_quiet( float64, float64 );
-char float64_lt_quiet( float64, float64 );
-char float64_is_signaling_nan( float64 );
-
-#ifdef FLOATX80
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE extended double-precision conversion routines.
--------------------------------------------------------------------------------
-*/
-signed int floatx80_to_int32( floatx80 );
-signed int floatx80_to_int32_round_to_zero( floatx80 );
-float32 floatx80_to_float32( floatx80 );
-float64 floatx80_to_float64( floatx80 );
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE extended double-precision rounding precision.  Valid
-values are 32, 64, and 80.
--------------------------------------------------------------------------------
-*/
-extern signed char floatx80_rounding_precision;
-
-/*
--------------------------------------------------------------------------------
-Software IEC/IEEE extended double-precision operations.
--------------------------------------------------------------------------------
-*/
-floatx80 floatx80_round_to_int( floatx80 );
-floatx80 floatx80_add( floatx80, floatx80 );
-floatx80 floatx80_sub( floatx80, floatx80 );
-floatx80 floatx80_mul( floatx80, floatx80 );
-floatx80 floatx80_div( floatx80, floatx80 );
-floatx80 floatx80_rem( floatx80, floatx80 );
-floatx80 floatx80_sqrt( floatx80 );
-char floatx80_eq( floatx80, floatx80 );
-char floatx80_le( floatx80, floatx80 );
-char floatx80_lt( floatx80, floatx80 );
-char floatx80_eq_signaling( floatx80, floatx80 );
-char floatx80_le_quiet( floatx80, floatx80 );
-char floatx80_lt_quiet( floatx80, floatx80 );
-char floatx80_is_signaling_nan( floatx80 );
-
-#endif
-
-#endif
index 1b75672dfc8f8800484463b326f623d6b8bde412..20841663270fa50694669b90c4e54a55eb250bf1 100644 (file)
@@ -24,6 +24,8 @@ machine-$(CONFIG_BF533) := bf533
 machine-$(CONFIG_BF534) := bf537
 machine-$(CONFIG_BF536) := bf537
 machine-$(CONFIG_BF537) := bf537
+machine-$(CONFIG_BF542) := bf548
+machine-$(CONFIG_BF544) := bf548
 machine-$(CONFIG_BF548) := bf548
 machine-$(CONFIG_BF549) := bf548
 machine-$(CONFIG_BF561) := bf561
@@ -36,6 +38,8 @@ cpu-$(CONFIG_BF533) := bf533
 cpu-$(CONFIG_BF534) := bf534
 cpu-$(CONFIG_BF536) := bf536
 cpu-$(CONFIG_BF537) := bf537
+cpu-$(CONFIG_BF542) := bf542
+cpu-$(CONFIG_BF544) := bf544
 cpu-$(CONFIG_BF548) := bf548
 cpu-$(CONFIG_BF549) := bf549
 cpu-$(CONFIG_BF561) := bf561
index ea48d5b13f11469a18faebbd15461def98ef5d23..94d7b119b71ec6637e8b49a23d4f10b98f723a02 100644 (file)
@@ -160,7 +160,8 @@ dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
        BUG_ON(direction == DMA_NONE);
 
        for (i = 0; i < nents; i++, sg++) {
-               sg->dma_address = page_address(sg->page) + sg->offset;
+               sg->dma_address = (dma_addr_t)(page_address(sg->page) +
+                                       sg->offset);
 
                invalidate_dcache_range(sg_dma_address(sg),
                                        sg_dma_address(sg) +
index b45188f8512e380e18eb5afd5ff196a11d59af58..673c860ffc239f4a5655eb22940839d16f73c255 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/module.h>
 #include <linux/init_task.h>
 #include <linux/mqueue.h>
+#include <linux/fs.h>
 
 static struct fs_struct init_fs = INIT_FS;
 static struct files_struct init_files = INIT_FILES;
index 5a51dd6ab28095966fac101dc229fb600934765f..6a7aefe4834639cd39b42b8d055187f4ad7e0d77 100644 (file)
@@ -33,6 +33,8 @@
 #include <linux/user.h>
 #include <linux/a.out.h>
 #include <linux/uaccess.h>
+#include <linux/fs.h>
+#include <linux/err.h>
 
 #include <asm/blackfin.h>
 #include <asm/fixed_code.h>
index f59dcee7bae3da76723a3432866fa08d8b7d9f0a..88f221b89b33341192aa7d2099495e10351a99aa 100644 (file)
@@ -402,11 +402,7 @@ void __init setup_arch(char **cmdline_p)
        if (l1_length > L1_DATA_A_LENGTH)
                panic("L1 data memory overflow\n");
 
-#ifdef BF561_FAMILY
-       _bfin_swrst = bfin_read_SICA_SWRST();
-#else
        _bfin_swrst = bfin_read_SWRST();
-#endif
 
        /* Copy atomic sequences to their fixed location, and sanity check that
           these locations are the ones that we advertise to userspace.  */
@@ -429,6 +425,7 @@ void __init setup_arch(char **cmdline_p)
        BUG_ON((char *)&atomic_xor32 - (char *)&fixed_code_start
               != ATOMIC_XOR32 - FIXED_CODE_START);
 
+       init_exception_vectors();
        bf53x_cache_init();
 }
 
index f5e1ae3d1705958dceb302addac289613e489120..abcd14817d0e4f1291f115e9bf12df16982397a9 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/syscalls.h>
 #include <linux/mman.h>
 #include <linux/file.h>
+#include <linux/fs.h>
 #include <linux/uaccess.h>
 #include <linux/ipc.h>
 #include <linux/unistd.h>
index 3909f5b3553679ac1b6215b95e31f856aa34b2dd..792a8416fe10160cc81e2660c553bba5c3db92a0 100644 (file)
@@ -31,6 +31,7 @@
 #include <linux/interrupt.h>
 #include <linux/module.h>
 #include <linux/kallsyms.h>
+#include <linux/fs.h>
 #include <asm/traps.h>
 #include <asm/cacheflush.h>
 #include <asm/blackfin.h>
@@ -140,7 +141,7 @@ asmlinkage void trap_c(struct pt_regs *fp)
 #ifdef CONFIG_KGDB
 # define CHK_DEBUGGER_TRAP() \
        do { \
-               CHK_DEBUGGER(trapnr, sig, info.si_code, fp); \
+               CHK_DEBUGGER(trapnr, sig, info.si_code, fp); \
        } while (0)
 # define CHK_DEBUGGER_TRAP_MAYBE() \
        do { \
index d06f860f47900a5b6e09edf4b6629b6c9908c9e7..fb53780247bc94bf5c1ce393f54cab5620e43db4 100644 (file)
@@ -32,6 +32,7 @@
 #include <asm-generic/vmlinux.lds.h>
 #include <asm/mem_map.h>
 #include <asm/page.h>
+#include <asm/thread_info.h>
 
 OUTPUT_FORMAT("elf32-bfin")
 ENTRY(__start)
@@ -64,8 +65,12 @@ SECTIONS
 
        .data :
        {
-               . = ALIGN(PAGE_SIZE);
+               /* make sure the init_task is aligned to the
+                * kernel thread size so we can locate the kernel
+                * stack properly and quickly.
+                */
                __sdata = .;
+               . = ALIGN(THREAD_SIZE);
                *(.data.init_task)
                DATA_DATA
                CONSTRUCTORS
@@ -73,14 +78,14 @@ SECTIONS
                . = ALIGN(32);
                *(.data.cacheline_aligned)
 
-               . = ALIGN(PAGE_SIZE);
+               . = ALIGN(THREAD_SIZE);
                __edata = .;
        }
 
-       . = ALIGN(PAGE_SIZE);
        ___init_begin = .;
        .init :
        {
+               . = ALIGN(PAGE_SIZE);
                __sinittext = .;
                *(.init.text)
                __einittext = .;
@@ -153,10 +158,9 @@ SECTIONS
                __ebss_b_l1 = .;
        }
 
-       . = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1);
-       ___init_end = ALIGN(PAGE_SIZE);
+       ___init_end = LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1);
 
-       .bss ___init_end :
+       .bss LOADADDR(.data_b_l1) + SIZEOF(.data_b_l1) :
        {
                . = ALIGN(4);
                ___bss_start = .;
index 2f08bcb2dded5158cd0270011ebab21415390496..38650a628980fec47626a20c4aad07ccb1319d1f 100644 (file)
@@ -440,15 +440,15 @@ ENTRY(_bfin_reset)
        SSYNC;
 
        /* make sure SYSCR is set to use BMODE */
-       P0.h = hi(SICA_SYSCR);
-       P0.l = lo(SICA_SYSCR);
-       R0.l = 0x20;
+       P0.h = hi(SYSCR);
+       P0.l = lo(SYSCR);
+       R0.l = 0x20;            /* on BF561, disable core b */
        W[P0] = R0.l;
        SSYNC;
 
        /* issue a system soft reset */
-       P1.h = hi(SICA_SWRST);
-       P1.l = lo(SICA_SWRST);
+       P1.h = hi(SWRST);
+       P1.l = lo(SWRST);
        R1.l = 0x0007;
        W[P1] = R1;
        SSYNC;
index 9d475623b7243f2069528de67cc291cda01ae9fb..5be6b975ae4a0fc88c65d0186652691d42658497 100644 (file)
@@ -60,6 +60,9 @@ ENDPROC(_bfin_write_IMEM_CONTROL)
 
 #if defined(CONFIG_BLKFIN_DCACHE)
 ENTRY(_bfin_write_DMEM_CONTROL)
+       P0.l = (DMEM_CONTROL & 0xFFFF);
+       P0.h = (DMEM_CONTROL >> 16);
+
        CLI R1;
        SSYNC;          /* SSYNC required before writing to DMEM_CONTROL. */
        .align 8;
index 6b9fd03ce8355135b7227b9073d2249690aff766..660f881b620a3591ee54474c041bff0545a7a705 100644 (file)
@@ -358,26 +358,10 @@ static void bf561_demux_gpio_irq(unsigned int inta_irq,
 
 #endif                         /* CONFIG_IRQCHIP_DEMUX_GPIO */
 
-/*
- * This function should be called during kernel startup to initialize
- * the BFin IRQ handling routines.
- */
-int __init init_arch_irq(void)
+void __init init_exception_vectors(void)
 {
-       int irq;
-       unsigned long ilat = 0;
-       /*  Disable all the peripheral intrs  - page 4-29 HW Ref manual */
-       bfin_write_SICA_IMASK0(SIC_UNMASK_ALL);
-       bfin_write_SICA_IMASK1(SIC_UNMASK_ALL);
        SSYNC();
 
-       bfin_write_SICA_IWR0(IWR_ENABLE_ALL);
-       bfin_write_SICA_IWR1(IWR_ENABLE_ALL);
-
-       local_irq_disable();
-
-       init_exception_buff();
-
 #ifndef CONFIG_KGDB
        bfin_write_EVT0(evt_emulation);
 #endif
@@ -395,6 +379,27 @@ int __init init_arch_irq(void)
        bfin_write_EVT14(evt14_softirq);
        bfin_write_EVT15(evt_system_call);
        CSYNC();
+}
+
+/*
+ * This function should be called during kernel startup to initialize
+ * the BFin IRQ handling routines.
+ */
+int __init init_arch_irq(void)
+{
+       int irq;
+       unsigned long ilat = 0;
+       /*  Disable all the peripheral intrs  - page 4-29 HW Ref manual */
+       bfin_write_SICA_IMASK0(SIC_UNMASK_ALL);
+       bfin_write_SICA_IMASK1(SIC_UNMASK_ALL);
+       SSYNC();
+
+       bfin_write_SICA_IWR0(IWR_ENABLE_ALL);
+       bfin_write_SICA_IWR1(IWR_ENABLE_ALL);
+
+       local_irq_disable();
+
+       init_exception_buff();
 
        for (irq = 0; irq <= SYS_IRQS; irq++) {
                if (irq <= IRQ_CORETMR)
index 28a878c3577a00d78e280b137e09be5124c4351d..4708023fe716e2c11d1f63d369c33b8870393177 100644 (file)
@@ -579,8 +579,12 @@ static unsigned int bfin_gpio_irq_startup(unsigned int irq)
        u16 gpionr = irq - IRQ_PA0;
        u8 pint_val = irq2pint_lut[irq - SYS_IRQS];
 
-       if (pint_val == IRQ_NOT_AVAIL)
+       if (pint_val == IRQ_NOT_AVAIL) {
+               printk(KERN_ERR
+               "GPIO IRQ %d :Not in PINT Assign table "
+               "Reconfigure Interrupt to Port Assignemt\n", irq);
                return -ENODEV;
+       }
 
        if (!(gpio_enabled[gpio_bank(gpionr)] & gpio_bit(gpionr))) {
                ret = gpio_request(gpionr, NULL);
@@ -713,6 +717,29 @@ static void bfin_demux_gpio_irq(unsigned int intb_irq,
 }
 #endif                         /* CONFIG_IRQCHIP_DEMUX_GPIO */
 
+void __init init_exception_vectors(void)
+{
+       SSYNC();
+
+#ifndef CONFIG_KGDB
+       bfin_write_EVT0(evt_emulation);
+#endif
+       bfin_write_EVT2(evt_evt2);
+       bfin_write_EVT3(trap);
+       bfin_write_EVT5(evt_ivhw);
+       bfin_write_EVT6(evt_timer);
+       bfin_write_EVT7(evt_evt7);
+       bfin_write_EVT8(evt_evt8);
+       bfin_write_EVT9(evt_evt9);
+       bfin_write_EVT10(evt_evt10);
+       bfin_write_EVT11(evt_evt11);
+       bfin_write_EVT12(evt_evt12);
+       bfin_write_EVT13(evt_evt13);
+       bfin_write_EVT14(evt14_softirq);
+       bfin_write_EVT15(evt_system_call);
+       CSYNC();
+}
+
 /*
  * This function should be called during kernel startup to initialize
  * the BFin IRQ handling routines.
@@ -733,29 +760,10 @@ int __init init_arch_irq(void)
        bfin_write_SIC_IMASK(SIC_UNMASK_ALL);
        bfin_write_SIC_IWR(IWR_ENABLE_ALL);
 #endif
-
        SSYNC();
 
        local_irq_disable();
 
-#ifndef CONFIG_KGDB
-       bfin_write_EVT0(evt_emulation);
-#endif
-       bfin_write_EVT2(evt_evt2);
-       bfin_write_EVT3(trap);
-       bfin_write_EVT5(evt_ivhw);
-       bfin_write_EVT6(evt_timer);
-       bfin_write_EVT7(evt_evt7);
-       bfin_write_EVT8(evt_evt8);
-       bfin_write_EVT9(evt_evt9);
-       bfin_write_EVT10(evt_evt10);
-       bfin_write_EVT11(evt_evt11);
-       bfin_write_EVT12(evt_evt12);
-       bfin_write_EVT13(evt_evt13);
-       bfin_write_EVT14(evt14_softirq);
-       bfin_write_EVT15(evt_system_call);
-       CSYNC();
-
 #if defined(CONFIG_IRQCHIP_DEMUX_GPIO) && defined(CONFIG_BF54x)
 #ifdef CONFIG_PINTx_REASSIGN
        pint[0]->assign = CONFIG_PINT0_ASSIGN;
index 4b41248b61ad8b6922df5b31c3ebdfa98d52945d..6b4d026a00a120e5728d8930bb6d4ad43a6b4006 100644 (file)
@@ -180,8 +180,6 @@ source "drivers/isdn/Kconfig"
 
 source "drivers/telephony/Kconfig"
 
-source "drivers/cdrom/Kconfig"
-
 #
 # input before char - char/joystick depends on it. As does USB.
 #
index 275673c192aad94632ef32a885ba3e0dbd37a304..1e74f3c5cee27d014d907c269778b018b828b563 100644 (file)
@@ -1496,6 +1496,7 @@ sys_call_table:
        .long sys_signalfd
        .long sys_timerfd
        .long sys_eventfd
+       .long sys_fallocate
 
 
 syscall_table_size = (. - sys_call_table)
index 26b3df32b9a7476a89dd2ee238f642a4bc2e73fa..6fbe2665c5776d794f2594dbe2a51784585dcae9 100644 (file)
@@ -13,6 +13,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index 0b581e3cf7c75602cfc122d9f58098620dccecdc..6d51f133fb23285793adc4bebb0f2adbb3c105bd 100644 (file)
@@ -400,7 +400,8 @@ int __init pcibios_init(void)
        __reg_MB86943_pci_sl_mem_base   = __region_CS2 + 0x08000000;
        mb();
 
-       *(volatile unsigned long *)(__region_CS2+0x01300014) == 1;
+       /* enable PCI arbitration */
+       __reg_MB86943_pci_arbiter       = MB86943_PCIARB_EN;
 
        ioport_resource.start   = (__reg_MB86943_sl_pci_io_base << 9) & 0xfffffc00;
        ioport_resource.end     = (__reg_MB86943_sl_pci_io_range << 9) | 0x3ff;
index abb582bc218fdf4207d3fa3ce92d753fffa35f40..f9524933258a47601a6838b4a3768fb296b9fbce 100644 (file)
@@ -458,8 +458,7 @@ config MICROCODE
        tristate "/dev/cpu/microcode - Intel IA32 CPU microcode support"
        select FW_LOADER
        ---help---
-         If you say Y here and also to "/dev file system support" in the
-         'File systems' section, you will be able to update the microcode on
+         If you say Y here, you will be able to update the microcode on
          Intel processors in the IA32 family, e.g. Pentium Pro, Pentium II,
          Pentium III, Pentium 4, Xeon etc.  You will obviously need the
          actual microcode binary data itself which is not shipped with the
@@ -938,7 +937,7 @@ source "drivers/acpi/Kconfig"
 
 menuconfig APM
        tristate "APM (Advanced Power Management) BIOS support"
-       depends on PM && !X86_VISWS
+       depends on PM_SLEEP && !X86_VISWS
        ---help---
          APM is a BIOS specification for saving power using several different
          techniques. This is mostly useful for battery powered laptops with
index b31c0802e1ccf53f1e5a677e802c5e34166ebc54..f03531eacdfbe6936e2a4f8808babcd6f29411e4 100644 (file)
@@ -36,11 +36,11 @@ config DEBUG_STACK_USAGE
          This option will slow down process creation somewhat.
 
 comment "Page alloc debug is incompatible with Software Suspend on i386"
-       depends on DEBUG_KERNEL && SOFTWARE_SUSPEND
+       depends on DEBUG_KERNEL && HIBERNATION
 
 config DEBUG_PAGEALLOC
        bool "Debug page memory allocations"
-       depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND && !HUGETLBFS
+       depends on DEBUG_KERNEL && !HIBERNATION && !HUGETLBFS
        help
          Unmap pages from the kernel linear mapping after free_pages().
          This results in a large slowdown, but helps to find certain types
index 3bd848093b9d72b2cc4459c50017f24dd02e06d9..d93e48010b619e52006b13c068f7ffc82c5a96de 100644 (file)
@@ -2,7 +2,7 @@
  * code16gcc.h
  *
  * This file is -include'd when compiling 16-bit C code.
- * Note: this asm() needs to be emitted before gcc omits any code.
+ * Note: this asm() needs to be emitted before gcc emits any code.
  * Depending on gcc version, this requires -fno-unit-at-a-time or
  * -fno-toplevel-reorder.
  *
index 25a282494f4c91afde98fef701d19c1701d6bbb2..658834d9f92a098acc2de75a1a5e9c028540b254 100644 (file)
@@ -72,17 +72,18 @@ static u32 read_mbr_sig(u8 devno, struct edd_info *ei)
        u32 mbrsig;
        u32 buf_base, mbr_base;
        extern char _end[];
-       static char mbr_buf[1024];
 
        sector_size = ei->params.bytes_per_sector;
        if (!sector_size)
                sector_size = 512; /* Best available guess */
 
+       /* Produce a naturally aligned buffer on the heap */
        buf_base = (ds() << 4) + (u32)&_end;
        mbr_base = (buf_base+sector_size-1) & ~(sector_size-1);
-       mbrbuf_ptr = mbr_buf + (mbr_base-buf_base);
+       mbrbuf_ptr = _end + (mbr_base-buf_base);
        mbrbuf_end = mbrbuf_ptr + sector_size;
 
+       /* Make sure we actually have space on the heap... */
        if (!(boot_params.hdr.loadflags & CAN_USE_HEAP))
                return 0;
        if (mbrbuf_end > (char *)(size_t)boot_params.hdr.heap_end_ptr)
@@ -126,7 +127,7 @@ static int get_edd_info(u8 devno, struct edd_info *ei)
        ax = 0x4800;
        dx = devno;
        asm("pushfl; int $0x13; popfl"
-           : "+a" (ax), "+d" (dx)
+           : "+a" (ax), "+d" (dx), "=m" (ei->params)
            : "S" (&ei->params)
            : "ebx", "ecx", "edi");
 
index 6b9923fb6eae466f8da8a843d6a81a190cc91ee1..7f4a2c53bd762b91746216ac44cbe957d938fa33 100644 (file)
@@ -225,7 +225,7 @@ start_of_setup:
        int     $0x13
 #endif
 
-# We will have entired with %cs = %ds+0x20, normalize %cs so
+# We will have entered with %cs = %ds+0x20, normalize %cs so
 # it is on par with the other segments.
        pushw   %ds
        pushw   $setup2
@@ -280,4 +280,4 @@ die:
        .section ".initdata", "a"
 setup_corrupt:
        .byte   7
-       .string "No setup signature found..."
+       .string "No setup signature found...\n"
index 5e44c736eea81700dc7559c97462b21514e25850..88d77761d01bfbccba3dc9d970ede616b0900d52 100644 (file)
@@ -51,4 +51,11 @@ fi
 cat $2 > $4/vmlinuz
 cp $3 $4/System.map
 
-if [ -x /sbin/lilo ]; then /sbin/lilo; else /etc/lilo/install; fi
+if [ -x /sbin/lilo ]; then
+       /sbin/lilo
+elif [ -x /etc/lilo/install ]; then
+       /etc/lilo/install
+else
+       sync
+       echo "Cannot find LILO."
+fi
index 1df025c732613fde1b8f79e20e740103e8433e1b..6be9ca811d177d936b328987992664eac232cd49 100644 (file)
@@ -80,7 +80,7 @@ static void move_kernel_around(void)
  */
 static void mask_all_interrupts(void)
 {
-       outb(0xff, 0xa1);       /* Mask all interrupts on the seconday PIC */
+       outb(0xff, 0xa1);       /* Mask all interrupts on the secondary PIC */
        io_delay();
        outb(0xfb, 0x21);       /* Mask all but cascade on the primary PIC */
        io_delay();
index afea46c500cc80a28d0255e10446cdc21047ab53..68e65d95cdfd8627a69df2ed1ec7cf33cd392ca4 100644 (file)
@@ -44,7 +44,7 @@ static int set_bios_mode(u8 mode)
                     : "+a" (ax)
                     : : "ebx", "ecx", "edx", "esi", "edi");
 
-       do_restore = 1;         /* Assume video contents was lost */
+       do_restore = 1;         /* Assume video contents were lost */
        new_mode = ax & 0x7f;   /* Not all BIOSes are clean with the top bit */
 
        if (new_mode == mode)
index e6aa9eb8d93a4cb13fe413595ace527105e0986d..f1bc71e948cfebbd7b5339eade1a4197d6c624ca 100644 (file)
@@ -268,7 +268,7 @@ void vesa_store_edid(void)
        dx = 0;                 /* EDID block number */
        di =(size_t) &boot_params.edid_info; /* (ES:)Pointer to block */
        asm(INT10
-           : "+a" (ax), "+b" (bx), "+d" (dx)
+           : "+a" (ax), "+b" (bx), "+d" (dx), "=m" (boot_params.edid_info)
            : "c" (cx), "D" (di)
            : "esi");
 #endif /* CONFIG_FIRMWARE_EDID */
index dbe5e87e0d66fd02064843aee01a04a0fe3eb09e..9d33b00de659af6b96e0899cae5394927d25cda7 100644 (file)
@@ -35,7 +35,6 @@ obj-y                         += sysenter.o vsyscall.o
 obj-$(CONFIG_ACPI_SRAT)        += srat.o
 obj-$(CONFIG_EFI)              += efi.o efi_stub.o
 obj-$(CONFIG_DOUBLEFAULT)      += doublefault.o
-obj-$(CONFIG_SERIAL_8250)      += legacy_serial.o
 obj-$(CONFIG_VM86)             += vm86.o
 obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
 obj-$(CONFIG_HPET_TIMER)       += hpet.o
index 223f58fc9f46f32cff0d6e51bfe2438fb4072a34..7f7be01f44e66cd27257870d540ed38d3f1e1661 100644 (file)
@@ -2,7 +2,7 @@ obj-$(CONFIG_ACPI)              += boot.o
 ifneq ($(CONFIG_PCI),)
 obj-$(CONFIG_X86_IO_APIC)      += earlyquirk.o
 endif
-obj-$(CONFIG_ACPI)             += sleep.o wakeup.o
+obj-$(CONFIG_ACPI_SLEEP)       += sleep.o wakeup.o
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
 obj-y                          += cstate.o processor.o
index c3750c2c41137a694be9570443f59b379cc4cc4d..1b66d5c70eaf65fc88fa1146313071843a069993 100644 (file)
@@ -11,6 +11,8 @@
 #include <asm/mce.h>
 #include <asm/nmi.h>
 
+#define MAX_PATCH_LEN (255-1)
+
 #ifdef CONFIG_HOTPLUG_CPU
 static int smp_alt_once;
 
@@ -148,7 +150,8 @@ static unsigned char** find_nop_table(void)
 
 #endif /* CONFIG_X86_64 */
 
-static void nop_out(void *insns, unsigned int len)
+/* Use this to add nops to a buffer, then text_poke the whole buffer. */
+static void add_nops(void *insns, unsigned int len)
 {
        unsigned char **noptable = find_nop_table();
 
@@ -156,7 +159,7 @@ static void nop_out(void *insns, unsigned int len)
                unsigned int noplen = len;
                if (noplen > ASM_NOP_MAX)
                        noplen = ASM_NOP_MAX;
-               text_poke(insns, noptable[noplen], noplen);
+               memcpy(insns, noptable[noplen], noplen);
                insns += noplen;
                len -= noplen;
        }
@@ -174,15 +177,15 @@ extern u8 *__smp_locks[], *__smp_locks_end[];
 void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
 {
        struct alt_instr *a;
-       u8 *instr;
-       int diff;
+       char insnbuf[MAX_PATCH_LEN];
 
        DPRINTK("%s: alt table %p -> %p\n", __FUNCTION__, start, end);
        for (a = start; a < end; a++) {
+               u8 *instr = a->instr;
                BUG_ON(a->replacementlen > a->instrlen);
+               BUG_ON(a->instrlen > sizeof(insnbuf));
                if (!boot_cpu_has(a->cpuid))
                        continue;
-               instr = a->instr;
 #ifdef CONFIG_X86_64
                /* vsyscall code is not mapped yet. resolve it manually. */
                if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END) {
@@ -191,9 +194,10 @@ void apply_alternatives(struct alt_instr *start, struct alt_instr *end)
                                __FUNCTION__, a->instr, instr);
                }
 #endif
-               memcpy(instr, a->replacement, a->replacementlen);
-               diff = a->instrlen - a->replacementlen;
-               nop_out(instr + a->replacementlen, diff);
+               memcpy(insnbuf, a->replacement, a->replacementlen);
+               add_nops(insnbuf + a->replacementlen,
+                        a->instrlen - a->replacementlen);
+               text_poke(instr, insnbuf, a->instrlen);
        }
 }
 
@@ -215,16 +219,18 @@ static void alternatives_smp_lock(u8 **start, u8 **end, u8 *text, u8 *text_end)
 static void alternatives_smp_unlock(u8 **start, u8 **end, u8 *text, u8 *text_end)
 {
        u8 **ptr;
+       char insn[1];
 
        if (noreplace_smp)
                return;
 
+       add_nops(insn, 1);
        for (ptr = start; ptr < end; ptr++) {
                if (*ptr < text)
                        continue;
                if (*ptr > text_end)
                        continue;
-               nop_out(*ptr, 1);
+               text_poke(*ptr, insn, 1);
        };
 }
 
@@ -351,6 +357,7 @@ void apply_paravirt(struct paravirt_patch_site *start,
                    struct paravirt_patch_site *end)
 {
        struct paravirt_patch_site *p;
+       char insnbuf[MAX_PATCH_LEN];
 
        if (noreplace_paravirt)
                return;
@@ -358,13 +365,15 @@ void apply_paravirt(struct paravirt_patch_site *start,
        for (p = start; p < end; p++) {
                unsigned int used;
 
-               used = paravirt_ops.patch(p->instrtype, p->clobbers, p->instr,
-                                         p->len);
+               BUG_ON(p->len > MAX_PATCH_LEN);
+               used = paravirt_ops.patch(p->instrtype, p->clobbers, insnbuf,
+                                         (unsigned long)p->instr, p->len);
 
                BUG_ON(used > p->len);
 
                /* Pad the rest with nops */
-               nop_out(p->instr + used, p->len - used);
+               add_nops(insnbuf + used, p->len - used);
+               text_poke(p->instr, insnbuf, p->len);
        }
 }
 extern struct paravirt_patch_site __start_parainstructions[],
@@ -379,7 +388,7 @@ void __init alternative_instructions(void)
           that might execute the to be patched code.
           Other CPUs are not running. */
        stop_nmi();
-#ifdef CONFIG_MCE
+#ifdef CONFIG_X86_MCE
        stop_mce();
 #endif
 
@@ -417,7 +426,7 @@ void __init alternative_instructions(void)
        local_irq_restore(flags);
 
        restart_nmi();
-#ifdef CONFIG_MCE
+#ifdef CONFIG_X86_MCE
        restart_mce();
 #endif
 }
@@ -430,22 +439,12 @@ void __init alternative_instructions(void)
  * And on the local CPU you need to be protected again NMI or MCE handlers
  * seeing an inconsistent instruction while you patch.
  */
-void __kprobes text_poke(void *oaddr, unsigned char *opcode, int len)
+void __kprobes text_poke(void *addr, unsigned char *opcode, int len)
 {
-        u8 *addr = oaddr;
-       if (!pte_write(*lookup_address((unsigned long)addr))) {
-               struct page *p[2] = { virt_to_page(addr), virt_to_page(addr+PAGE_SIZE) };
-               addr = vmap(p, 2, VM_MAP, PAGE_KERNEL);
-               if (!addr)
-                       return;
-               addr += ((unsigned long)oaddr) % PAGE_SIZE;
-       }
        memcpy(addr, opcode, len);
        sync_core();
        /* Not strictly needed, but can speed CPU recovery up. Ignore cross cacheline
           case. */
        if (cpu_has_clflush)
-               asm("clflush (%0) " :: "r" (oaddr) : "memory");
-       if (addr != oaddr)
-               vunmap(addr);
+               asm("clflush (%0) " :: "r" (addr) : "memory");
 }
index bfc6cb7df7e7ff0a3d00f48bc8221e37e3e54e0d..f9fff29e01a9a3fecbf6f5a59936120416f23713 100644 (file)
@@ -61,8 +61,9 @@ static int enable_local_apic __initdata = 0;
 
 /* Local APIC timer verification ok */
 static int local_apic_timer_verify_ok;
-/* Disable local APIC timer from the kernel commandline or via dmi quirk */
-static int local_apic_timer_disabled;
+/* Disable local APIC timer from the kernel commandline or via dmi quirk
+   or using CPU MSR check */
+int local_apic_timer_disabled;
 /* Local APIC timer works in C2 */
 int local_apic_timer_c2_ok;
 EXPORT_SYMBOL_GPL(local_apic_timer_c2_ok);
@@ -370,12 +371,9 @@ void __init setup_boot_APIC_clock(void)
        long delta, deltapm;
        int pm_referenced = 0;
 
-       if (boot_cpu_has(X86_FEATURE_LAPIC_TIMER_BROKEN))
-               local_apic_timer_disabled = 1;
-
        /*
         * The local apic timer can be disabled via the kernel
-        * commandline or from the test above. Register the lapic
+        * commandline or from the CPU detection code. Register the lapic
         * timer as a dummy clock event source on SMP systems, so the
         * broadcast mechanism is used. On UP systems simply ignore it.
         */
index 47001d50a083da27f3b3a0151949ff262a0cad1e..f02a8aca826be21abc18ac3e31fe8a59caeebb9e 100644 (file)
@@ -2235,7 +2235,7 @@ static int __init apm_init(void)
                apm_info.bios.cseg_16_len = 0; /* 64k */
 
        if (debug) {
-               printk(KERN_INFO "apm: entry %x:%lx cseg16 %x dseg %x",
+               printk(KERN_INFO "apm: entry %x:%x cseg16 %x dseg %x",
                        apm_info.bios.cseg, apm_info.bios.offset,
                        apm_info.bios.cseg_16, apm_info.bios.dseg);
                if (apm_info.bios.version > 0x100)
index c7ba455d5ac77d97747f1c13a4f5ac6737bfb48d..dcf6bbb1c7c0011d3a91f2e722f7d1abf25c8364 100644 (file)
@@ -3,6 +3,7 @@
 #include <linux/mm.h>
 #include <asm/io.h>
 #include <asm/processor.h>
+#include <asm/apic.h>
 
 #include "cpu.h"
 
@@ -22,6 +23,7 @@
 extern void vide(void);
 __asm__(".align 4\nvide: ret");
 
+#ifdef CONFIG_X86_LOCAL_APIC
 #define ENABLE_C1E_MASK         0x18000000
 #define CPUID_PROCESSOR_SIGNATURE       1
 #define CPUID_XFAM              0x0ff00000
@@ -52,6 +54,7 @@ static __cpuinit int amd_apic_timer_broken(void)
         }
        return 0;
 }
+#endif
 
 int force_mwait __cpuinitdata;
 
@@ -282,8 +285,10 @@ static void __cpuinit init_amd(struct cpuinfo_x86 *c)
                        num_cache_leaves = 3;
        }
 
+#ifdef CONFIG_X86_LOCAL_APIC
        if (amd_apic_timer_broken())
-               set_bit(X86_FEATURE_LAPIC_TIMER_BROKEN, c->x86_capability);
+               local_apic_timer_disabled = 1;
+#endif
 
        if (c->x86 == 0x10 && !force_mwait)
                clear_bit(X86_FEATURE_MWAIT, c->x86_capability);
index 54428a2500f39fe111ff4bf4d36d547d34dcc595..59266f03d1cd021b3a51f9875cdb95fc62094211 100644 (file)
@@ -11,6 +11,7 @@
  */
 #include <linux/init.h>
 #include <linux/utsname.h>
+#include <asm/bugs.h>
 #include <asm/processor.h>
 #include <asm/i387.h>
 #include <asm/msr.h>
index 094118ba00da8ee85c5e108db1d0a715564a5b1c..d8c6f132dc7a1f7ca95306e2e15ab2536f5966f1 100644 (file)
@@ -92,7 +92,7 @@ config X86_POWERNOW_K8
 config X86_POWERNOW_K8_ACPI
        bool "ACPI Support"
        select ACPI_PROCESSOR
-       depends on X86_POWERNOW_K8
+       depends on ACPI && X86_POWERNOW_K8
        default y
        help
          This provides access to the K8s Processor Performance States via ACPI.
index 6f846bee2103d4b17eec817d4a6e4501b675194c..705e13a3078136df5bd9700ca344ac643cd145df 100644 (file)
@@ -68,7 +68,8 @@ struct acpi_cpufreq_data {
 };
 
 static struct acpi_cpufreq_data *drv_data[NR_CPUS];
-static struct acpi_processor_performance *acpi_perf_data[NR_CPUS];
+/* acpi_perf_data is a pointer to percpu data. */
+static struct acpi_processor_performance *acpi_perf_data;
 
 static struct cpufreq_driver acpi_cpufreq_driver;
 
@@ -508,26 +509,14 @@ acpi_cpufreq_guess_freq(struct acpi_cpufreq_data *data, unsigned int cpu)
  * do _PDC and _PSD and find out the processor dependency for the
  * actual init that will happen later...
  */
-static int acpi_cpufreq_early_init(void)
+static int __init acpi_cpufreq_early_init(void)
 {
-       struct acpi_processor_performance *data;
-       cpumask_t covered;
-       unsigned int i, j;
-
        dprintk("acpi_cpufreq_early_init\n");
 
-       for_each_possible_cpu(i) {
-               data = kzalloc(sizeof(struct acpi_processor_performance),
-                              GFP_KERNEL);
-               if (!data) {
-                       for_each_cpu_mask(j, covered) {
-                               kfree(acpi_perf_data[j]);
-                               acpi_perf_data[j] = NULL;
-                       }
-                       return -ENOMEM;
-               }
-               acpi_perf_data[i] = data;
-               cpu_set(i, covered);
+       acpi_perf_data = alloc_percpu(struct acpi_processor_performance);
+       if (!acpi_perf_data) {
+               dprintk("Memory allocation error for acpi_perf_data.\n");
+               return -ENOMEM;
        }
 
        /* Do initialization in ACPI core */
@@ -576,14 +565,11 @@ static int acpi_cpufreq_cpu_init(struct cpufreq_policy *policy)
 
        dprintk("acpi_cpufreq_cpu_init\n");
 
-       if (!acpi_perf_data[cpu])
-               return -ENODEV;
-
        data = kzalloc(sizeof(struct acpi_cpufreq_data), GFP_KERNEL);
        if (!data)
                return -ENOMEM;
 
-       data->acpi_data = acpi_perf_data[cpu];
+       data->acpi_data = percpu_ptr(acpi_perf_data, cpu);
        drv_data[cpu] = data;
 
        if (cpu_has(c, X86_FEATURE_CONSTANT_TSC))
@@ -780,24 +766,25 @@ static struct cpufreq_driver acpi_cpufreq_driver = {
 
 static int __init acpi_cpufreq_init(void)
 {
+       int ret;
+
        dprintk("acpi_cpufreq_init\n");
 
-       acpi_cpufreq_early_init();
+       ret = acpi_cpufreq_early_init();
+       if (ret)
+               return ret;
 
        return cpufreq_register_driver(&acpi_cpufreq_driver);
 }
 
 static void __exit acpi_cpufreq_exit(void)
 {
-       unsigned int i;
        dprintk("acpi_cpufreq_exit\n");
 
        cpufreq_unregister_driver(&acpi_cpufreq_driver);
 
-       for_each_possible_cpu(i) {
-               kfree(acpi_perf_data[i]);
-               acpi_perf_data[i] = NULL;
-       }
+       free_percpu(acpi_perf_data);
+
        return;
 }
 
index 265c5597efb01a13d0f605af3245c1f5968af7b6..40978af630e7f2a61d0170add5fbe0506052b6da 100644 (file)
@@ -13,7 +13,7 @@
 static unsigned long doublefault_stack[DOUBLEFAULT_STACKSIZE];
 #define STACK_START (unsigned long)(doublefault_stack+DOUBLEFAULT_STACKSIZE)
 
-#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + 0x1000000)
+#define ptr_ok(x) ((x) > PAGE_OFFSET && (x) < PAGE_OFFSET + MAXMEM)
 
 static void doublefault_fn(void)
 {
@@ -23,23 +23,23 @@ static void doublefault_fn(void)
        store_gdt(&gdt_desc);
        gdt = gdt_desc.address;
 
-       printk("double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
+       printk(KERN_EMERG "PANIC: double fault, gdt at %08lx [%d bytes]\n", gdt, gdt_desc.size);
 
        if (ptr_ok(gdt)) {
                gdt += GDT_ENTRY_TSS << 3;
                tss = *(u16 *)(gdt+2);
                tss += *(u8 *)(gdt+4) << 16;
                tss += *(u8 *)(gdt+7) << 24;
-               printk("double fault, tss at %08lx\n", tss);
+               printk(KERN_EMERG "double fault, tss at %08lx\n", tss);
 
                if (ptr_ok(tss)) {
                        struct i386_hw_tss *t = (struct i386_hw_tss *)tss;
 
-                       printk("eip = %08lx, esp = %08lx\n", t->eip, t->esp);
+                       printk(KERN_EMERG "eip = %08lx, esp = %08lx\n", t->eip, t->esp);
 
-                       printk("eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n",
+                       printk(KERN_EMERG "eax = %08lx, ebx = %08lx, ecx = %08lx, edx = %08lx\n",
                                t->eax, t->ebx, t->ecx, t->edx);
-                       printk("esi = %08lx, edi = %08lx\n",
+                       printk(KERN_EMERG "esi = %08lx, edi = %08lx\n",
                                t->esi, t->edi);
                }
        }
@@ -63,6 +63,7 @@ struct tss_struct doublefault_tss __cacheline_aligned = {
                .cs             = __KERNEL_CS,
                .ss             = __KERNEL_DS,
                .ds             = __USER_DS,
+               .fs             = __KERNEL_PERCPU,
 
                .__cr3          = __pa(swapper_pg_dir)
        }
index e60cddbc4cfbc39380c751f0d5793851ff25c96b..3c86b979a40aed829b52797cd8e90c88a6c8ed81 100644 (file)
@@ -321,7 +321,7 @@ static int __init request_standard_resources(void)
 
 subsys_initcall(request_standard_resources);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 /**
  * e820_mark_nosave_regions - Find the ranges of physical addresses that do not
  * correspond to e820 RAM areas and mark the corresponding pages as nosave for
index 7c52b222207ed80ffbaa06cbf6f9c06dd73d7229..8f0382161c91ec8e0a1c4f75b8ed22824c35eb90 100644 (file)
@@ -162,9 +162,7 @@ page_pde_offset = (__PAGE_OFFSET >> 20);
  * which will be freed later
  */
 
-#ifdef CONFIG_HOTPLUG_CPU
-.section .text,"ax",@progbits
-#else
+#ifndef CONFIG_HOTPLUG_CPU
 .section .init.text,"ax",@progbits
 #endif
 
index 893df8280756194b68bb844852f1b69955985c5c..4b8a8da4b2e0345b2b1a8d4ba46f4d2f0e9bb2d0 100644 (file)
@@ -1256,12 +1256,15 @@ static struct irq_chip ioapic_chip;
 static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 {
        if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-                       trigger == IOAPIC_LEVEL)
+           trigger == IOAPIC_LEVEL) {
+               irq_desc[irq].status |= IRQ_LEVEL;
                set_irq_chip_and_handler_name(irq, &ioapic_chip,
                                         handle_fasteoi_irq, "fasteoi");
-       else
+       } else {
+               irq_desc[irq].status &= ~IRQ_LEVEL;
                set_irq_chip_and_handler_name(irq, &ioapic_chip,
                                         handle_edge_irq, "edge");
+       }
        set_intr_gate(vector, interrupt[irq]);
 }
 
diff --git a/arch/i386/kernel/legacy_serial.c b/arch/i386/kernel/legacy_serial.c
deleted file mode 100644 (file)
index 2151011..0000000
+++ /dev/null
@@ -1,67 +0,0 @@
-/*
- * Legacy COM port devices for x86 platforms without PNPBIOS or ACPI.
- * Data taken from include/asm-i386/serial.h.
- *
- * (c) Copyright 2007 Hewlett-Packard Development Company, L.P.
- *     Bjorn Helgaas <bjorn.helgaas@hp.com>
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/pnp.h>
-#include <linux/serial_8250.h>
-
-/* Standard COM flags (except for COM4, because of the 8514 problem) */
-#ifdef CONFIG_SERIAL_DETECT_IRQ
-#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_AUTO_IRQ)
-#define COM4_FLAGS (UPF_BOOT_AUTOCONF | UPF_AUTO_IRQ)
-#else
-#define COM_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST)
-#define COM4_FLAGS UPF_BOOT_AUTOCONF
-#endif
-
-#define PORT(_base,_irq,_flags)                                \
-       {                                               \
-               .iobase         = _base,                \
-               .irq            = _irq,                 \
-               .uartclk        = 1843200,              \
-               .iotype         = UPIO_PORT,            \
-               .flags          = _flags,               \
-       }
-
-static struct plat_serial8250_port x86_com_data[] = {
-       PORT(0x3F8, 4, COM_FLAGS),
-       PORT(0x2F8, 3, COM_FLAGS),
-       PORT(0x3E8, 4, COM_FLAGS),
-       PORT(0x2E8, 3, COM4_FLAGS),
-       { },
-};
-
-static struct platform_device x86_com_device = {
-       .name                   = "serial8250",
-       .id                     = PLAT8250_DEV_PLATFORM,
-       .dev                    = {
-               .platform_data  = x86_com_data,
-       },
-};
-
-static int force_legacy_probe;
-module_param_named(force, force_legacy_probe, bool, 0);
-MODULE_PARM_DESC(force, "Force legacy serial port probe");
-
-static int __init serial8250_x86_com_init(void)
-{
-       if (pnp_platform_devices && !force_legacy_probe)
-               return -ENODEV;
-
-       return platform_device_register(&x86_com_device);
-}
-
-module_init(serial8250_x86_com_init);
-
-MODULE_AUTHOR("Bjorn Helgaas");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("Generic 8250/16x50 legacy probe module");
index d865d041bea1dc7c25d9a8e1eaa63f54c6812ea0..09cf78110358fadc78bbc704349b8283737f5f90 100644 (file)
@@ -82,6 +82,7 @@
 #include <linux/miscdevice.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/mutex.h>
 #include <linux/cpu.h>
 #include <linux/firmware.h>
index ea962c0667d50edb07df04e43a3ab1884dd7df1d..739cfb207dd7800503afebe58e9ccbff893ea8bb 100644 (file)
@@ -69,7 +69,8 @@ DEF_NATIVE(read_tsc, "rdtsc");
 
 DEF_NATIVE(ud2a, "ud2a");
 
-static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
+static unsigned native_patch(u8 type, u16 clobbers, void *ibuf,
+                            unsigned long addr, unsigned len)
 {
        const unsigned char *start, *end;
        unsigned ret;
@@ -90,7 +91,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
 #undef SITE
 
        patch_site:
-               ret = paravirt_patch_insns(insns, len, start, end);
+               ret = paravirt_patch_insns(ibuf, len, start, end);
                break;
 
        case PARAVIRT_PATCH(make_pgd):
@@ -107,7 +108,7 @@ static unsigned native_patch(u8 type, u16 clobbers, void *insns, unsigned len)
                break;
 
        default:
-               ret = paravirt_patch_default(type, clobbers, insns, len);
+               ret = paravirt_patch_default(type, clobbers, ibuf, addr, len);
                break;
        }
 
@@ -129,68 +130,67 @@ struct branch {
        u32 delta;
 } __attribute__((packed));
 
-unsigned paravirt_patch_call(void *target, u16 tgt_clobbers,
-                            void *site, u16 site_clobbers,
+unsigned paravirt_patch_call(void *insnbuf,
+                            const void *target, u16 tgt_clobbers,
+                            unsigned long addr, u16 site_clobbers,
                             unsigned len)
 {
-       unsigned char *call = site;
-       unsigned long delta = (unsigned long)target - (unsigned long)(call+5);
-       struct branch b;
+       struct branch *b = insnbuf;
+       unsigned long delta = (unsigned long)target - (addr+5);
 
        if (tgt_clobbers & ~site_clobbers)
                return len;     /* target would clobber too much for this site */
        if (len < 5)
                return len;     /* call too long for patch site */
 
-       b.opcode = 0xe8; /* call */
-       b.delta = delta;
-       BUILD_BUG_ON(sizeof(b) != 5);
-       text_poke(call, (unsigned char *)&b, 5);
+       b->opcode = 0xe8; /* call */
+       b->delta = delta;
+       BUILD_BUG_ON(sizeof(*b) != 5);
 
        return 5;
 }
 
-unsigned paravirt_patch_jmp(void *target, void *site, unsigned len)
+unsigned paravirt_patch_jmp(const void *target, void *insnbuf,
+                           unsigned long addr, unsigned len)
 {
-       unsigned char *jmp = site;
-       unsigned long delta = (unsigned long)target - (unsigned long)(jmp+5);
-       struct branch b;
+       struct branch *b = insnbuf;
+       unsigned long delta = (unsigned long)target - (addr+5);
 
        if (len < 5)
                return len;     /* call too long for patch site */
 
-       b.opcode = 0xe9;        /* jmp */
-       b.delta = delta;
-       text_poke(jmp, (unsigned char *)&b, 5);
+       b->opcode = 0xe9;       /* jmp */
+       b->delta = delta;
 
        return 5;
 }
 
-unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len)
+unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
+                               unsigned long addr, unsigned len)
 {
        void *opfunc = *((void **)&paravirt_ops + type);
        unsigned ret;
 
        if (opfunc == NULL)
                /* If there's no function, patch it with a ud2a (BUG) */
-               ret = paravirt_patch_insns(site, len, start_ud2a, end_ud2a);
+               ret = paravirt_patch_insns(insnbuf, len, start_ud2a, end_ud2a);
        else if (opfunc == paravirt_nop)
                /* If the operation is a nop, then nop the callsite */
                ret = paravirt_patch_nop();
        else if (type == PARAVIRT_PATCH(iret) ||
                 type == PARAVIRT_PATCH(irq_enable_sysexit))
                /* If operation requires a jmp, then jmp */
-               ret = paravirt_patch_jmp(opfunc, site, len);
+               ret = paravirt_patch_jmp(opfunc, insnbuf, addr, len);
        else
                /* Otherwise call the function; assume target could
                   clobber any caller-save reg */
-               ret = paravirt_patch_call(opfunc, CLBR_ANY,
-                                         site, clobbers, len);
+               ret = paravirt_patch_call(insnbuf, opfunc, CLBR_ANY,
+                                         addr, clobbers, len);
 
        return ret;
 }
 
-unsigned paravirt_patch_insns(void *site, unsigned len,
+unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
                              const char *start, const char *end)
 {
        unsigned insn_len = end - start;
@@ -198,7 +198,7 @@ unsigned paravirt_patch_insns(void *site, unsigned len,
        if (insn_len > len || start == NULL)
                insn_len = len;
        else
-               memcpy(site, start, insn_len);
+               memcpy(insnbuf, start, insn_len);
 
        return insn_len;
 }
index 7fe5da3c932e270f742290af4c35536a0ef29291..d474cd639bcb8ece22f706d285950926a50541ac 100644 (file)
@@ -422,7 +422,7 @@ void __init setup_bootmem_allocator(void)
         */
        reserve_bootmem(PAGE_SIZE, PAGE_SIZE);
 #endif
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_SLEEP
        /*
         * Reserve low memory region for sleep support.
         */
index e5dcb9379018b6cda96460f8bd2856cf0365cfaf..42147304de8855e8d0667249ba43f76bcb7efcde 100644 (file)
@@ -9,6 +9,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index 6deb159d08e0cf761fe402ed5ab355bcfc9e3d4b..4eb2e408764f7bab8e81a7310616e3366cb1a29c 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/string.h>
 #include <linux/elf.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/module.h>
 
 #include <asm/cpufeature.h>
index 72042bb7ec941a0537670136e105954331caa5d5..18673e0f193b9237910b33645f26c0bcb64dd99b 100644 (file)
@@ -87,12 +87,14 @@ struct vmi_timer_ops vmi_timer_ops;
 #define IRQ_PATCH_INT_MASK 0
 #define IRQ_PATCH_DISABLE  5
 
-static inline void patch_offset(unsigned char *eip, unsigned char *dest)
+static inline void patch_offset(void *insnbuf,
+                               unsigned long eip, unsigned long dest)
 {
-        *(unsigned long *)(eip+1) = dest-eip-5;
+        *(unsigned long *)(insnbuf+1) = dest-eip-5;
 }
 
-static unsigned patch_internal(int call, unsigned len, void *insns)
+static unsigned patch_internal(int call, unsigned len, void *insnbuf,
+                              unsigned long eip)
 {
        u64 reloc;
        struct vmi_relocation_info *const rel = (struct vmi_relocation_info *)&reloc;
@@ -100,14 +102,14 @@ static unsigned patch_internal(int call, unsigned len, void *insns)
        switch(rel->type) {
                case VMI_RELOCATION_CALL_REL:
                        BUG_ON(len < 5);
-                       *(char *)insns = MNEM_CALL;
-                       patch_offset(insns, rel->eip);
+                       *(char *)insnbuf = MNEM_CALL;
+                       patch_offset(insnbuf, eip, (unsigned long)rel->eip);
                        return 5;
 
                case VMI_RELOCATION_JUMP_REL:
                        BUG_ON(len < 5);
-                       *(char *)insns = MNEM_JMP;
-                       patch_offset(insns, rel->eip);
+                       *(char *)insnbuf = MNEM_JMP;
+                       patch_offset(insnbuf, eip, (unsigned long)rel->eip);
                        return 5;
 
                case VMI_RELOCATION_NOP:
@@ -128,21 +130,26 @@ static unsigned patch_internal(int call, unsigned len, void *insns)
  * Apply patch if appropriate, return length of new instruction
  * sequence.  The callee does nop padding for us.
  */
-static unsigned vmi_patch(u8 type, u16 clobbers, void *insns, unsigned len)
+static unsigned vmi_patch(u8 type, u16 clobbers, void *insns,
+                         unsigned long eip, unsigned len)
 {
        switch (type) {
                case PARAVIRT_PATCH(irq_disable):
-                       return patch_internal(VMI_CALL_DisableInterrupts, len, insns);
+                       return patch_internal(VMI_CALL_DisableInterrupts, len,
+                                             insns, eip);
                case PARAVIRT_PATCH(irq_enable):
-                       return patch_internal(VMI_CALL_EnableInterrupts, len, insns);
+                       return patch_internal(VMI_CALL_EnableInterrupts, len,
+                                             insns, eip);
                case PARAVIRT_PATCH(restore_fl):
-                       return patch_internal(VMI_CALL_SetInterruptMask, len, insns);
+                       return patch_internal(VMI_CALL_SetInterruptMask, len,
+                                             insns, eip);
                case PARAVIRT_PATCH(save_fl):
-                       return patch_internal(VMI_CALL_GetInterruptMask, len, insns);
+                       return patch_internal(VMI_CALL_GetInterruptMask, len,
+                                             insns, eip);
                case PARAVIRT_PATCH(iret):
-                       return patch_internal(VMI_CALL_IRET, len, insns);
+                       return patch_internal(VMI_CALL_IRET, len, insns, eip);
                case PARAVIRT_PATCH(irq_enable_sysexit):
-                       return patch_internal(VMI_CALL_SYSEXIT, len, insns);
+                       return patch_internal(VMI_CALL_SYSEXIT, len, insns, eip);
                default:
                        break;
        }
index 1b1a1e66d099b7c5df78d91d7c4244eb51f06d4b..730a5b177b1fa2237a08d3c465a009bbef4e4734 100644 (file)
@@ -432,7 +432,7 @@ static void __init pagetable_init (void)
        paravirt_pagetable_setup_done(pgd_base);
 }
 
-#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI)
+#if defined(CONFIG_HIBERNATION) || defined(CONFIG_ACPI)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
@@ -800,9 +800,17 @@ void mark_rodata_ro(void)
        unsigned long start = PFN_ALIGN(_text);
        unsigned long size = PFN_ALIGN(_etext) - start;
 
-       change_page_attr(virt_to_page(start),
-                        size >> PAGE_SHIFT, PAGE_KERNEL_RX);
-       printk("Write protecting the kernel text: %luk\n", size >> 10);
+#ifndef CONFIG_KPROBES
+#ifdef CONFIG_HOTPLUG_CPU
+       /* It must still be possible to apply SMP alternatives. */
+       if (num_possible_cpus() <= 1)
+#endif
+       {
+               change_page_attr(virt_to_page(start),
+                                size >> PAGE_SHIFT, PAGE_KERNEL_RX);
+               printk("Write protecting the kernel text: %luk\n", size >> 10);
+       }
+#endif
        start += size;
        size = (unsigned long)__end_rodata - start;
        change_page_attr(virt_to_page(start),
index 8927222b3ab2595202afcbb5f88810a8f8716a02..4241a74d16c8d3181256b9ed7b0c688edb2bfe85 100644 (file)
@@ -82,7 +82,7 @@ static void flush_kernel_map(void *arg)
        struct page *p;
 
        /* High level code is not ready for clflush yet */
-       if (cpu_has_clflush) {
+       if (0 && cpu_has_clflush) {
                list_for_each_entry (p, lh, lru)
                        cache_flush_page(p);
        } else if (boot_cpu_data.x86_model >= 4)
index 85503deeda46cbd336c5cf3e15bcb6a4998b8d10..ebc6f3c66340ccb319be52002283c53a2545312b 100644 (file)
@@ -455,3 +455,26 @@ void pcibios_disable_device (struct pci_dev *dev)
        if (!dev->msi_enabled && pcibios_disable_irq)
                pcibios_disable_irq(dev);
 }
+
+struct pci_bus *pci_scan_bus_with_sysdata(int busno)
+{
+       struct pci_bus *bus = NULL;
+       struct pci_sysdata *sd;
+
+       /*
+        * Allocate per-root-bus (not per bus) arch-specific data.
+        * TODO: leak; this memory is never freed.
+        * It's arguable whether it's worth the trouble to care.
+        */
+       sd = kzalloc(sizeof(*sd), GFP_KERNEL);
+       if (!sd) {
+               printk(KERN_ERR "PCI: OOM, skipping PCI bus %02x\n", busno);
+               return NULL;
+       }
+       sd->node = -1;
+       bus = pci_scan_bus(busno, &pci_root_ops, sd);
+       if (!bus)
+               kfree(sd);
+
+       return bus;
+}
index e7306dbf6c4273be26008c28cfc0c2fe5a7bc7bd..c82cbf4c7226ec65a4acd21c68669279dc761c33 100644 (file)
@@ -25,9 +25,9 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
                pci_read_config_byte(d, reg++, &subb);
                DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
                if (busno)
-                       pci_scan_bus(busno, &pci_root_ops, NULL);       /* Bus A */
+                       pci_scan_bus_with_sysdata(busno);       /* Bus A */
                if (suba < subb)
-                       pci_scan_bus(suba+1, &pci_root_ops, NULL);      /* Bus B */
+                       pci_scan_bus_with_sysdata(suba+1);      /* Bus B */
        }
        pcibios_last_bus = -1;
 }
@@ -42,7 +42,7 @@ static void __devinit pci_fixup_i450gx(struct pci_dev *d)
        u8 busno;
        pci_read_config_byte(d, 0x4a, &busno);
        printk(KERN_INFO "PCI: i440KX/GX host bridge %s: secondary bus %02x\n", pci_name(d), busno);
-       pci_scan_bus(busno, &pci_root_ops, NULL);
+       pci_scan_bus_with_sysdata(busno);
        pcibios_last_bus = -1;
 }
 DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82454GX, pci_fixup_i450gx);
index f2cb942f828197ae61b36c2314cc8b2fcee75446..665db063a40a4da9630c66ad12511d335fc60bc7 100644 (file)
@@ -138,8 +138,9 @@ static void __init pirq_peer_trick(void)
        for(i = 1; i < 256; i++) {
                if (!busmap[i] || pci_find_bus(0, i))
                        continue;
-               if (pci_scan_bus(i, &pci_root_ops, NULL))
-                       printk(KERN_INFO "PCI: Discovered primary peer bus %02x [IRQ]\n", i);
+               if (pci_scan_bus_with_sysdata(i))
+                       printk(KERN_INFO "PCI: Discovered primary peer "
+                              "bus %02x [IRQ]\n", i);
        }
        pcibios_last_bus = -1;
 }
index 149a9588c256797c1032c6f6cc1b1fa9645b2b3b..5565d7016b754d340c4f82aceec44f781b964d63 100644 (file)
@@ -26,7 +26,7 @@ static void __devinit pcibios_fixup_peer_bridges(void)
                            l != 0x0000 && l != 0xffff) {
                                DBG("Found device at %02x:%02x [%04x]\n", n, devfn, l);
                                printk(KERN_INFO "PCI: Discovered peer bus %02x\n", n);
-                               pci_scan_bus(n, &pci_root_ops, NULL);
+                               pci_scan_bus_with_sysdata(n);
                                break;
                        }
                }
index bb1afd9e589d5bdf27a5bfe91b2c4cd78107e8f1..1bf5816d34c85e294717fecf082bdd90baf26f38 100644 (file)
@@ -82,16 +82,15 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
 
        switch (len) {
        case 1:
-               *value = readb(mmcfg_virt_addr + reg);
+               *value = mmio_config_readb(mmcfg_virt_addr + reg);
                break;
        case 2:
-               *value = readw(mmcfg_virt_addr + reg);
+               *value = mmio_config_readw(mmcfg_virt_addr + reg);
                break;
        case 4:
-               *value = readl(mmcfg_virt_addr + reg);
+               *value = mmio_config_readl(mmcfg_virt_addr + reg);
                break;
        }
-
        spin_unlock_irqrestore(&pci_config_lock, flags);
 
        return 0;
@@ -116,16 +115,15 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
 
        switch (len) {
        case 1:
-               writeb(value, mmcfg_virt_addr + reg);
+               mmio_config_writeb(mmcfg_virt_addr + reg, value);
                break;
        case 2:
-               writew(value, mmcfg_virt_addr + reg);
+               mmio_config_writew(mmcfg_virt_addr + reg, value);
                break;
        case 4:
-               writel(value, mmcfg_virt_addr + reg);
+               mmio_config_writel(mmcfg_virt_addr + reg, value);
                break;
        }
-
        spin_unlock_irqrestore(&pci_config_lock, flags);
 
        return 0;
index adbe17a38f6f932cb8e238767f85eab12632a2d6..f5f165f69e0c602b9a7619c5d4e316e5ff1839ca 100644 (file)
@@ -96,10 +96,14 @@ static void __devinit pci_fixup_i450nx(struct pci_dev *d)
                pci_read_config_byte(d, reg++, &suba);
                pci_read_config_byte(d, reg++, &subb);
                DBG("i450NX PXB %d: %02x/%02x/%02x\n", pxb, busno, suba, subb);
-               if (busno)
-                       pci_scan_bus(QUADLOCAL2BUS(quad,busno), &pci_root_ops, NULL);   /* Bus A */
-               if (suba < subb)
-                       pci_scan_bus(QUADLOCAL2BUS(quad,suba+1), &pci_root_ops, NULL);  /* Bus B */
+               if (busno) {
+                       /* Bus A */
+                       pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, busno));
+               }
+               if (suba < subb) {
+                       /* Bus B */
+                       pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, suba+1));
+               }
        }
        pcibios_last_bus = -1;
 }
@@ -123,8 +127,7 @@ static int __init pci_numa_init(void)
                                continue;
                        printk("Scanning PCI bus %d for quad %d\n", 
                                QUADLOCAL2BUS(quad,0), quad);
-                       pci_scan_bus(QUADLOCAL2BUS(quad,0), 
-                               &pci_root_ops, NULL);
+                       pci_scan_bus_with_sysdata(QUADLOCAL2BUS(quad, 0));
                }
        return 0;
 }
index e58bae2076ad50b96a0e2fb78493e198e44816ec..8c66f275756f9f9ac4dc0d1177b396307fb3a7fc 100644 (file)
@@ -104,3 +104,46 @@ extern DECLARE_BITMAP(pci_mmcfg_fallback_slots, 32*PCI_MMCFG_MAX_CHECK_BUS);
 extern int __init pci_mmcfg_arch_reachable(unsigned int seg, unsigned int bus,
                                           unsigned int devfn);
 extern int __init pci_mmcfg_arch_init(void);
+
+/*
+ * AMD Fam10h CPUs are buggy, and cannot access MMIO config space
+ * on their northbrige except through the * %eax register. As such, you MUST
+ * NOT use normal IOMEM accesses, you need to only use the magic mmio-config
+ * accessor functions.
+ * In fact just use pci_config_*, nothing else please.
+ */
+static inline unsigned char mmio_config_readb(void __iomem *pos)
+{
+       u8 val;
+       asm volatile("movb (%1),%%al" : "=a" (val) : "r" (pos));
+       return val;
+}
+
+static inline unsigned short mmio_config_readw(void __iomem *pos)
+{
+       u16 val;
+       asm volatile("movw (%1),%%ax" : "=a" (val) : "r" (pos));
+       return val;
+}
+
+static inline unsigned int mmio_config_readl(void __iomem *pos)
+{
+       u32 val;
+       asm volatile("movl (%1),%%eax" : "=a" (val) : "r" (pos));
+       return val;
+}
+
+static inline void mmio_config_writeb(void __iomem *pos, u8 val)
+{
+       asm volatile("movb %%al,(%1)" :: "a" (val), "r" (pos) : "memory");
+}
+
+static inline void mmio_config_writew(void __iomem *pos, u16 val)
+{
+       asm volatile("movw %%ax,(%1)" :: "a" (val), "r" (pos) : "memory");
+}
+
+static inline void mmio_config_writel(void __iomem *pos, u32 val)
+{
+       asm volatile("movl %%eax,(%1)" :: "a" (val), "r" (pos) : "memory");
+}
index f1b486d4190b0c38411eac8c76d95dbaf3d67721..8ecb1c72259497348be3c5c899655516a255697c 100644 (file)
@@ -101,8 +101,8 @@ static int __init pcibios_init(void)
                "bridge B (PIIX4) bus: %u\n", pci_bus1, pci_bus0);
 
        raw_pci_ops = &pci_direct_conf1;
-       pci_scan_bus(pci_bus0, &pci_root_ops, NULL);
-       pci_scan_bus(pci_bus1, &pci_root_ops, NULL);
+       pci_scan_bus_with_sysdata(pci_bus0);
+       pci_scan_bus_with_sysdata(pci_bus1);
        pci_fixup_irqs(visws_swizzle, visws_map_irq);
        pcibios_resource_survey();
        return 0;
index 2de7bbf03cd7f0d35a93aa5e7b778127699367ef..d764ec950065686d96bbd92e49440de08e538270 100644 (file)
@@ -1,2 +1,2 @@
 obj-$(CONFIG_PM)               += cpu.o
-obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o suspend.o
+obj-$(CONFIG_HIBERNATION)      += swsusp.o suspend.o
index 9a8c1181c001cec6c6105bd40dd2875e9e312074..f0c37511d8da82d6e30650a6d7f0cc6cbd6dd368 100644 (file)
@@ -842,7 +842,8 @@ void __init xen_setup_vcpu_info_placement(void)
        }
 }
 
-static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
+static unsigned xen_patch(u8 type, u16 clobbers, void *insnbuf,
+                         unsigned long addr, unsigned len)
 {
        char *start, *end, *reloc;
        unsigned ret;
@@ -869,7 +870,7 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
                if (start == NULL || (end-start) > len)
                        goto default_patch;
 
-               ret = paravirt_patch_insns(insns, len, start, end);
+               ret = paravirt_patch_insns(insnbuf, len, start, end);
 
                /* Note: because reloc is assigned from something that
                   appears to be an array, gcc assumes it's non-null,
@@ -877,8 +878,8 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
                   end. */
                if (reloc > start && reloc < end) {
                        int reloc_off = reloc - start;
-                       long *relocp = (long *)(insns + reloc_off);
-                       long delta = start - (char *)insns;
+                       long *relocp = (long *)(insnbuf + reloc_off);
+                       long delta = start - (char *)addr;
 
                        *relocp += delta;
                }
@@ -886,7 +887,8 @@ static unsigned xen_patch(u8 type, u16 clobbers, void *insns, unsigned len)
 
        default_patch:
        default:
-               ret = paravirt_patch_default(type, clobbers, insns, len);
+               ret = paravirt_patch_default(type, clobbers, insnbuf,
+                                            addr, len);
                break;
        }
 
index 36c7b9682aa6f923a6e47ad364512dcf890f64c7..21aa4fc5f8efc64347d4518afec33d9dda000eb6 100644 (file)
@@ -425,6 +425,9 @@ config COMPAT
        depends on IA32_SUPPORT
        default y
 
+config COMPAT_FOR_U64_ALIGNMENT
+       def_bool COMPAT
+
 config IA64_MCA_RECOVERY
        tristate "MCA recovery from errors other than TLB."
 
index cd4adf52f174ece99c323b0804f839391b020d61..e980e7aa2306eb52ddc51632b48d97d892157704 100644 (file)
@@ -2015,9 +2015,14 @@ acpi_sba_ioc_add(struct acpi_device *device)
        return 0;
 }
 
+static const struct acpi_device_id hp_ioc_iommu_device_ids[] = {
+       {"HWP0001", 0},
+       {"HWP0004", 0},
+       {"", 0},
+};
 static struct acpi_driver acpi_sba_ioc_driver = {
        .name           = "IOC IOMMU Driver",
-       .ids            = "HWP0001,HWP0004",
+       .ids            = hp_ioc_iommu_device_ids,
        .ops            = {
                .add    = acpi_sba_ioc_add,
        },
index bb87682bbb1be5862ec767e6088fd0de21f1f068..e62694f8ef75d8b6b46605e6c9924d4ba7bcf898 100644 (file)
@@ -101,7 +101,7 @@ simscsi_interrupt (unsigned long val)
 {
        struct scsi_cmnd *sc;
 
-       while ((sc = queue[rd].sc) != 0) {
+       while ((sc = queue[rd].sc) != NULL) {
                atomic_dec(&num_reqs);
                queue[rd].sc = NULL;
                if (DBG)
@@ -121,49 +121,23 @@ simscsi_biosparam (struct scsi_device *sdev, struct block_device *n,
        return 0;
 }
 
-static void
-simscsi_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset, unsigned long len)
-{
-       struct disk_stat stat;
-       struct disk_req req;
-
-       req.addr = __pa(sc->request_buffer);
-       req.len  = len;                 /* # of bytes to transfer */
-
-       if (sc->request_bufflen < req.len)
-               return;
-
-       stat.fd = desc[sc->device->id];
-       if (DBG)
-               printk("simscsi_%s @ %lx (off %lx)\n",
-                      mode == SSC_READ ? "read":"write", req.addr, offset);
-       ia64_ssc(stat.fd, 1, __pa(&req), offset, mode);
-       ia64_ssc(__pa(&stat), 0, 0, 0, SSC_WAIT_COMPLETION);
-
-       if (stat.count == req.len) {
-               sc->result = GOOD;
-       } else {
-               sc->result = DID_ERROR << 16;
-       }
-}
-
 static void
 simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset)
 {
-       int list_len = sc->use_sg;
-       struct scatterlist *sl = (struct scatterlist *)sc->request_buffer;
+       int i;
+       struct scatterlist *sl;
        struct disk_stat stat;
        struct disk_req req;
 
        stat.fd = desc[sc->device->id];
 
-       while (list_len) {
+       scsi_for_each_sg(sc, sl, scsi_sg_count(sc), i) {
                req.addr = __pa(page_address(sl->page) + sl->offset);
                req.len  = sl->length;
                if (DBG)
                        printk("simscsi_sg_%s @ %lx (off %lx) use_sg=%d len=%d\n",
                               mode == SSC_READ ? "read":"write", req.addr, offset,
-                              list_len, sl->length);
+                              scsi_sg_count(sc) - i, sl->length);
                ia64_ssc(stat.fd, 1, __pa(&req), offset, mode);
                ia64_ssc(__pa(&stat), 0, 0, 0, SSC_WAIT_COMPLETION);
 
@@ -173,8 +147,6 @@ simscsi_sg_readwrite (struct scsi_cmnd *sc, int mode, unsigned long offset)
                        return;
                }
                offset +=  sl->length;
-               sl++;
-               list_len--;
        }
        sc->result = GOOD;
 }
@@ -190,10 +162,7 @@ simscsi_readwrite6 (struct scsi_cmnd *sc, int mode)
        unsigned long offset;
 
        offset = (((sc->cmnd[1] & 0x1f) << 16) | (sc->cmnd[2] << 8) | sc->cmnd[3])*512;
-       if (sc->use_sg > 0)
-               simscsi_sg_readwrite(sc, mode, offset);
-       else
-               simscsi_readwrite(sc, mode, offset, sc->cmnd[4]*512);
+       simscsi_sg_readwrite(sc, mode, offset);
 }
 
 static size_t
@@ -230,26 +199,21 @@ simscsi_readwrite10 (struct scsi_cmnd *sc, int mode)
                | ((unsigned long)sc->cmnd[3] << 16)
                | ((unsigned long)sc->cmnd[4] <<  8) 
                | ((unsigned long)sc->cmnd[5] <<  0))*512UL;
-       if (sc->use_sg > 0)
-               simscsi_sg_readwrite(sc, mode, offset);
-       else
-               simscsi_readwrite(sc, mode, offset, ((sc->cmnd[7] << 8) | sc->cmnd[8])*512);
+       simscsi_sg_readwrite(sc, mode, offset);
 }
 
 static void simscsi_fillresult(struct scsi_cmnd *sc, char *buf, unsigned len)
 {
 
-       int scatterlen = sc->use_sg;
+       int i;
+       unsigned thislen;
        struct scatterlist *slp;
 
-       if (scatterlen == 0)
-               memcpy(sc->request_buffer, buf, len);
-       else for (slp = (struct scatterlist *)sc->request_buffer;
-                 scatterlen-- > 0 && len > 0; slp++) {
-               unsigned thislen = min(len, slp->length);
-
+       scsi_for_each_sg(sc, slp, scsi_sg_count(sc), i) {
+               if (!len)
+                       break;
+               thislen = min(len, slp->length);
                memcpy(page_address(slp->page) + slp->offset, buf, thislen);
-               slp++;
                len -= thislen;
        }
 }
@@ -275,7 +239,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
        if (target_id <= 15 && sc->device->lun == 0) {
                switch (sc->cmnd[0]) {
                      case INQUIRY:
-                       if (sc->request_bufflen < 35) {
+                       if (scsi_bufflen(sc) < 35) {
                                break;
                        }
                        sprintf (fname, "%s%c", simscsi_root, 'a' + target_id);
@@ -328,7 +292,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
                        break;
 
                      case READ_CAPACITY:
-                       if (desc[target_id] < 0 || sc->request_bufflen < 8) {
+                       if (desc[target_id] < 0 || scsi_bufflen(sc) < 8) {
                                break;
                        }
                        buf = localbuf;
@@ -350,7 +314,7 @@ simscsi_queuecommand (struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
                      case MODE_SENSE:
                      case MODE_SENSE_10:
                        /* sd.c uses this to determine whether disk does write-caching. */
-                       simscsi_fillresult(sc, (char *)empty_zero_page, sc->request_bufflen);
+                       simscsi_fillresult(sc, (char *)empty_zero_page, scsi_bufflen(sc));
                        sc->result = GOOD;
                        break;
 
index af10462d44d48b10f48ad3d600b6cf8d85a9dc2f..a3405b3c1eefba2a0ba94ac0e4ecd9b647992d84 100644 (file)
@@ -34,7 +34,6 @@
 #include <linux/uio.h>
 #include <linux/nfs_fs.h>
 #include <linux/quota.h>
-#include <linux/syscalls.h>
 #include <linux/sunrpc/svc.h>
 #include <linux/nfsd/nfsd.h>
 #include <linux/nfsd/cache.h>
index c6ede8780dedc0afdf2489a55b7f9d262ca653d1..3d45d24a9d613ce66215c5399d513dd24239e3c2 100644 (file)
@@ -741,16 +741,15 @@ int __init acpi_boot_init(void)
 
 int acpi_gsi_to_irq(u32 gsi, unsigned int *irq)
 {
-       int vector;
+       int tmp;
 
        if (has_8259 && gsi < 16)
                *irq = isa_irq_to_vector(gsi);
        else {
-               vector = gsi_to_vector(gsi);
-               if (vector == -1)
+               tmp = gsi_to_irq(gsi);
+               if (tmp == -1)
                        return -1;
-
-               *irq = vector;
+               *irq = tmp;
        }
        return 0;
 }
index 2fd96d9062a1359b41964c3b4e3d90c8879034a3..790ef0d87e129f90b5cd83b617dc2b23000a7219 100644 (file)
@@ -38,11 +38,11 @@ static struct clocksource clocksource_cyclone = {
 
 int __init init_cyclone_clock(void)
 {
-       u64reg;
+       u64 __iomem *reg;
        u64 base;       /* saved cyclone base address */
        u64 offset;     /* offset from pageaddr to cyclone_timer register */
        int i;
-       u32* volatile cyclone_timer;    /* Cyclone MPMC0 register */
+       u32 __iomem *cyclone_timer;     /* Cyclone MPMC0 register */
 
        if (!use_cyclone)
                return 0;
@@ -51,7 +51,7 @@ int __init init_cyclone_clock(void)
 
        /* find base address */
        offset = (CYCLONE_CBAR_ADDR);
-       reg = (u64*)ioremap_nocache(offset, sizeof(u64));
+       reg = ioremap_nocache(offset, sizeof(u64));
        if(!reg){
                printk(KERN_ERR "Summit chipset: Could not find valid CBAR"
                                " register.\n");
@@ -69,7 +69,7 @@ int __init init_cyclone_clock(void)
 
        /* setup PMCC */
        offset = (base + CYCLONE_PMCC_OFFSET);
-       reg = (u64*)ioremap_nocache(offset, sizeof(u64));
+       reg = ioremap_nocache(offset, sizeof(u64));
        if(!reg){
                printk(KERN_ERR "Summit chipset: Could not find valid PMCC"
                                " register.\n");
@@ -81,7 +81,7 @@ int __init init_cyclone_clock(void)
 
        /* setup MPCS */
        offset = (base + CYCLONE_MPCS_OFFSET);
-       reg = (u64*)ioremap_nocache(offset, sizeof(u64));
+       reg = ioremap_nocache(offset, sizeof(u64));
        if(!reg){
                printk(KERN_ERR "Summit chipset: Could not find valid MPCS"
                                " register.\n");
@@ -93,7 +93,7 @@ int __init init_cyclone_clock(void)
 
        /* map in cyclone_timer */
        offset = (base + CYCLONE_MPMC_OFFSET);
-       cyclone_timer = (u32*)ioremap_nocache(offset, sizeof(u32));
+       cyclone_timer = ioremap_nocache(offset, sizeof(u32));
        if(!cyclone_timer){
                printk(KERN_ERR "Summit chipset: Could not find valid MPMC"
                                " register.\n");
@@ -110,7 +110,7 @@ int __init init_cyclone_clock(void)
                        printk(KERN_ERR "Summit chipset: Counter not counting!"
                                        " DISABLED\n");
                        iounmap(cyclone_timer);
-                       cyclone_timer = 0;
+                       cyclone_timer = NULL;
                        use_cyclone = 0;
                        return -ENODEV;
                }
index b69c397ed1bf1eef6537e5fd336e3086539c9934..bc8efcad28b877c046c589a4a7514129b5aed010 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/init.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
index 91e6dc1e7baf8d37ddd91c340c0b8c753cfed16d..cfe4654838f445423455979bca494d0e8fd1394a 100644 (file)
@@ -142,7 +142,7 @@ struct iosapic_rte_info {
 static struct iosapic_intr_info {
        struct list_head rtes;          /* RTEs using this vector (empty =>
                                         * not an IOSAPIC interrupt) */
-       int             count;          /* # of RTEs that shares this vector */
+       int             count;          /* # of registered RTEs */
        u32             low32;          /* current value of low word of
                                         * Redirection table entry */
        unsigned int    dest;           /* destination CPU physical ID */
@@ -313,7 +313,7 @@ mask_irq (unsigned int irq)
        int rte_index;
        struct iosapic_rte_info *rte;
 
-       if (list_empty(&iosapic_intr_info[irq].rtes))
+       if (!iosapic_intr_info[irq].count)
                return;                 /* not an IOSAPIC interrupt! */
 
        /* set only the mask bit */
@@ -331,7 +331,7 @@ unmask_irq (unsigned int irq)
        int rte_index;
        struct iosapic_rte_info *rte;
 
-       if (list_empty(&iosapic_intr_info[irq].rtes))
+       if (!iosapic_intr_info[irq].count)
                return;                 /* not an IOSAPIC interrupt! */
 
        low32 = iosapic_intr_info[irq].low32 &= ~IOSAPIC_MASK;
@@ -363,7 +363,7 @@ iosapic_set_affinity (unsigned int irq, cpumask_t mask)
 
        dest = cpu_physical_id(first_cpu(mask));
 
-       if (list_empty(&iosapic_intr_info[irq].rtes))
+       if (!iosapic_intr_info[irq].count)
                return;                 /* not an IOSAPIC interrupt */
 
        set_irq_affinity_info(irq, dest, redir);
@@ -542,7 +542,7 @@ iosapic_reassign_vector (int irq)
 {
        int new_irq;
 
-       if (!list_empty(&iosapic_intr_info[irq].rtes)) {
+       if (iosapic_intr_info[irq].count) {
                new_irq = create_irq();
                if (new_irq < 0)
                        panic("%s: out of interrupt vectors!\n", __FUNCTION__);
@@ -560,7 +560,7 @@ iosapic_reassign_vector (int irq)
        }
 }
 
-static struct iosapic_rte_info *iosapic_alloc_rte (void)
+static struct iosapic_rte_info * __init_refok iosapic_alloc_rte (void)
 {
        int i;
        struct iosapic_rte_info *rte;
@@ -677,7 +677,7 @@ get_target_cpu (unsigned int gsi, int irq)
         * In case of vector shared by multiple RTEs, all RTEs that
         * share the vector need to use the same destination CPU.
         */
-       if (!list_empty(&iosapic_intr_info[irq].rtes))
+       if (iosapic_intr_info[irq].count)
                return iosapic_intr_info[irq].dest;
 
        /*
@@ -794,8 +794,9 @@ iosapic_register_intr (unsigned int gsi,
        err = register_intr(gsi, irq, IOSAPIC_LOWEST_PRIORITY,
                            polarity, trigger);
        if (err < 0) {
+               spin_unlock(&irq_desc[irq].lock);
                irq = err;
-               goto unlock_all;
+               goto unlock_iosapic_lock;
        }
 
        /*
@@ -811,7 +812,7 @@ iosapic_register_intr (unsigned int gsi,
               gsi, (trigger == IOSAPIC_EDGE ? "edge" : "level"),
               (polarity == IOSAPIC_POL_HIGH ? "high" : "low"),
               cpu_logical_id(dest), dest, irq_to_vector(irq));
- unlock_all:
+
        spin_unlock(&irq_desc[irq].lock);
  unlock_iosapic_lock:
        spin_unlock_irqrestore(&iosapic_lock, flags);
index fcb77338cc09aaadefbe65b735f3a426d313c4ab..c47c8acc96e37a270eeb8198fc8cf11b80cf9b09 100644 (file)
@@ -101,15 +101,6 @@ int check_irq_used(int irq)
        return -1;
 }
 
-static void reserve_irq(unsigned int irq)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&vector_lock, flags);
-       irq_status[irq] = IRQ_RSVD;
-       spin_unlock_irqrestore(&vector_lock, flags);
-}
-
 static inline int find_unassigned_irq(void)
 {
        int irq;
@@ -145,6 +136,9 @@ static int __bind_irq_vector(int irq, int vector, cpumask_t domain)
        int cpu;
        struct irq_cfg *cfg = &irq_cfg[irq];
 
+       BUG_ON((unsigned)irq >= NR_IRQS);
+       BUG_ON((unsigned)vector >= IA64_NUM_VECTORS);
+
        cpus_and(mask, domain, cpu_online_map);
        if (cpus_empty(mask))
                return -EINVAL;
@@ -286,7 +280,7 @@ static int __init parse_vector_domain(char *arg)
                vector_domain_type = VECTOR_DOMAIN_PERCPU;
                no_int_routing = 1;
        }
-       return 1;
+       return 0;
 }
 early_param("vector", parse_vector_domain);
 #else
@@ -299,10 +293,14 @@ static cpumask_t vector_allocation_domain(int cpu)
 
 void destroy_and_reserve_irq(unsigned int irq)
 {
+       unsigned long flags;
+
        dynamic_irq_cleanup(irq);
 
-       clear_irq_vector(irq);
-       reserve_irq(irq);
+       spin_lock_irqsave(&vector_lock, flags);
+       __clear_irq_vector(irq);
+       irq_status[irq] = IRQ_RSVD;
+       spin_unlock_irqrestore(&vector_lock, flags);
 }
 
 static int __reassign_irq_vector(int irq, int cpu)
index 4b5daa3cc0feab6723764d67a7c221e74e5b3eb3..ff28620cb992c7eb846f6ab2628b095d2ad41fca 100644 (file)
@@ -1750,8 +1750,17 @@ format_mca_init_stack(void *mca_data, unsigned long offset,
        strncpy(p->comm, type, sizeof(p->comm)-1);
 }
 
-/* Do per-CPU MCA-related initialization.  */
+/* Caller prevents this from being called after init */
+static void * __init_refok mca_bootmem(void)
+{
+       void *p;
 
+       p = alloc_bootmem(sizeof(struct ia64_mca_cpu) * NR_CPUS +
+                         KERNEL_STACK_SIZE);
+       return (void *)ALIGN((unsigned long)p, KERNEL_STACK_SIZE);
+}
+
+/* Do per-CPU MCA-related initialization.  */
 void __cpuinit
 ia64_mca_cpu_init(void *cpu_data)
 {
@@ -1763,11 +1772,7 @@ ia64_mca_cpu_init(void *cpu_data)
                int cpu;
 
                first_time = 0;
-               mca_data = alloc_bootmem(sizeof(struct ia64_mca_cpu)
-                                        * NR_CPUS + KERNEL_STACK_SIZE);
-               mca_data = (void *)(((unsigned long)mca_data +
-                                       KERNEL_STACK_SIZE - 1) &
-                               (-KERNEL_STACK_SIZE));
+               mca_data = mca_bootmem();
                for (cpu = 0; cpu < NR_CPUS; cpu++) {
                        format_mca_init_stack(mca_data,
                                        offsetof(struct ia64_mca_cpu, mca_stack),
index b7133cabdbea98db50b6e348ca6173fc1a790239..14b8e5a6222bca9f0ab18f15e3b78c28a4c7e104 100644 (file)
@@ -591,13 +591,13 @@ pfm_set_task_notify(struct task_struct *task)
        struct thread_info *info;
 
        info = (struct thread_info *) ((char *) task + IA64_TASK_SIZE);
-       set_bit(TIF_NOTIFY_RESUME, &info->flags);
+       set_bit(TIF_PERFMON_WORK, &info->flags);
 }
 
 static inline void
 pfm_clear_task_notify(void)
 {
-       clear_thread_flag(TIF_NOTIFY_RESUME);
+       clear_thread_flag(TIF_PERFMON_WORK);
 }
 
 static inline void
index 7cecd2964200dceb63ff6273e55f7aba26b2240e..cd9a37a552c3099a2de603d923e9d23984b3c347 100644 (file)
@@ -60,7 +60,6 @@
 #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!"
index 0982882bfb80ae6cd2390045eaad15f468a94890..4e446aa5f4ac98c0011552a68db633fcb68a3324 100644 (file)
@@ -346,7 +346,7 @@ smp_flush_tlb_mm (struct mm_struct *mm)
 }
 
 /*
- * Run a function on another CPU
+ * Run a function on a specific CPU
  *  <func>     The function to run. This must be fast and non-blocking.
  *  <info>     An arbitrary pointer to pass to the function.
  *  <nonatomic>        Currently unused.
@@ -366,9 +366,11 @@ smp_call_function_single (int cpuid, void (*func) (void *info), void *info, int
        int me = get_cpu(); /* prevent preemption and reschedule on another processor */
 
        if (cpuid == me) {
-               printk(KERN_INFO "%s: trying to call self\n", __FUNCTION__);
+               local_irq_disable();
+               func(info);
+               local_irq_enable();
                put_cpu();
-               return -EBUSY;
+               return 0;
        }
 
        data.func = func;
index 627785c48ea95e495389653b5bfdc320967247df..98cfc90cab1d4916e9664fa01cca00bb41801662 100644 (file)
@@ -52,7 +52,7 @@ static struct clocksource clocksource_itc = {
         .name           = "itc",
         .rating         = 350,
         .read           = itc_get_cycles,
-        .mask           = 0xffffffffffffffff,
+        .mask           = CLOCKSOURCE_MASK(64),
         .mult           = 0, /*to be caluclated*/
         .shift          = 16,
         .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
@@ -240,7 +240,21 @@ ia64_init_itm (void)
                if (!nojitter)
                        itc_jitter_data.itc_jitter = 1;
 #endif
-       }
+       } else
+               /*
+                * ITC is drifty and we have not synchronized the ITCs in smpboot.c.
+                * ITC values may fluctuate significantly between processors.
+                * Clock should not be used for hrtimers. Mark itc as only
+                * useful for boot and testing.
+                *
+                * Note that jitter compensation is off! There is no point of
+                * synchronizing ITCs since they may be large differentials
+                * that change over time.
+                *
+                * The only way to fix this would be to repeatedly sync the
+                * ITCs. Until that time we have to avoid ITC.
+                */
+               clocksource_itc.rating = 50;
 
        /* Setup the CPU local timer tick */
        ia64_cpu_local_tick();
@@ -255,7 +269,7 @@ ia64_init_itm (void)
        }
 }
 
-static cycle_t itc_get_cycles()
+static cycle_t itc_get_cycles(void)
 {
        u64 lcycle, now, ret;
 
index 787ed642dd49a876607fa5e0f34d58bf50ddc281..4594770e685a300dbb2ce3e85ab845829a1cf289 100644 (file)
@@ -391,7 +391,7 @@ void sn_bus_free_sysdata(void)
  * hubdev_init_node() - Creates the HUB data structure and link them to it's
  *                     own NODE specific data area.
  */
-void hubdev_init_node(nodepda_t * npda, cnodeid_t node)
+void __init hubdev_init_node(nodepda_t * npda, cnodeid_t node)
 {
        struct hubdev_info *hubdev_info;
        int size;
index 684b1c984a445e3ba5a818aef22cb8f6d8437979..1f38a3a68390f0502a04c2a3fca273b37e7d3a7d 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/interrupt.h>
 #include <linux/acpi.h>
 #include <linux/compiler.h>
-#include <linux/sched.h>
 #include <linux/root_dev.h>
 #include <linux/nodemask.h>
 #include <linux/pm.h>
index 19e25d2b64fcabdd003c7e239cf8938cc8200383..cf67fc562054980116484e3dadf9ec6622d6c823 100644 (file)
 
 extern unsigned long sn_rtc_cycles_per_second;
 
-static void __iomem *sn2_mc;
-
 static cycle_t read_sn2(void)
 {
-       return (cycle_t)readq(sn2_mc);
+       return (cycle_t)readq(RTC_COUNTER_ADDR);
 }
 
 static struct clocksource clocksource_sn2 = {
         .name           = "sn2_rtc",
-        .rating         = 300,
+        .rating         = 450,
         .read           = read_sn2,
         .mask           = (1LL << 55) - 1,
         .mult           = 0,
@@ -58,7 +56,6 @@ ia64_sn_udelay (unsigned long usecs)
 
 void __init sn_timer_init(void)
 {
-       sn2_mc = RTC_COUNTER_ADDR;
        clocksource_sn2.fsys_mmio = RTC_COUNTER_ADDR;
        clocksource_sn2.mult = clocksource_hz2mult(sn_rtc_cycles_per_second,
                                                        clocksource_sn2.shift);
index 57a92ef31a903ea7f4fd156a3097aa3d3a903a00..62a51429306eb92269bb80817d5f4e3cb389f4db 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/errno.h>
index 6b2d77da06830c734c01d588881694c115e84c53..fe73c9ec611f33fbee6b2e79a554c62205be00b8 100644 (file)
@@ -45,7 +45,8 @@ static void mask_and_ack_mappi(unsigned int irq)
 
 static void end_mappi_irq(unsigned int irq)
 {
-       enable_mappi_irq(irq);
+       if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
+               enable_mappi_irq(irq);
 }
 
 static unsigned int startup_mappi_irq(unsigned int irq)
@@ -88,7 +89,7 @@ void __init init_IRQ(void)
        irq_desc[M32R_IRQ_INT0].chip = &mappi_irq_type;
        irq_desc[M32R_IRQ_INT0].action = NULL;
        irq_desc[M32R_IRQ_INT0].depth = 1;
-       icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD10;
+       icu_data[M32R_IRQ_INT0].icucr = M32R_ICUCR_IEN|M32R_ICUCR_ISMOD11;
        disable_mappi_irq(M32R_IRQ_INT0);
 #endif /* CONFIG_M32R_NE2000 */
 
index 3eb3059534972c07aeaa7935aa57d5814675e5c2..9dae410014d821c7d773ea65ba2441387538b1a3 100644 (file)
@@ -43,6 +43,7 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/irq.h>
 #include <linux/bootmem.h>
 #include <linux/delay.h>
index bda85548de6c79c0dceb81279257112443b2becd..b13dbbeaeafa0b6c3c0c77bd240e53a282315ea9 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index 99fc1226f7f804ed40cf875fca1118d78347e8ac..3ee918695215791b10f01ca19e9095b094cf35f5 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/stddef.h>
index 90238a8c9e14996cf48daca92b083390c703e6a4..36d78cf1a7bc14ea5c86550a8a209846829d6f41 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/smp_lock.h>
 #include <linux/sem.h>
index a5ac0d40fbec4c83a309b37af115512ca462b93e..3f86ade3a22af15a152d444579858197ddeaaab3 100644 (file)
@@ -42,8 +42,6 @@ EXPORT_SYMBOL(memory_end);
 
 char __initdata command_line[COMMAND_LINE_SIZE];
 
-void (*mach_trap_init)(void);
-
 /* machine dependent timer functions */
 void (*mach_sched_init)(irq_handler_t handler);
 void (*mach_tick)(void);
index d265ed4e5afccdee7a5c389917ac842db089d031..d0f2dc5cb5a17f833f1008c781159f37c18adb0a 100644 (file)
@@ -28,7 +28,6 @@
 void coldfire_tick(void);
 void coldfire_timer_init(irq_handler_t handler);
 unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 /***************************************************************************/
@@ -101,7 +100,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_timer_init;
        mach_tick = coldfire_tick;
        mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index 7fa5e8254c313e83cbe6071b30609589f7f96674..425703fb6cee70c84e5a82ddd52ab2917a2baaa0 100644 (file)
 #include <asm/mcftimer.h>
 #include <asm/mcfsim.h>
 #include <asm/mcfdma.h>
-#include <asm/irq.h>
 
 /***************************************************************************/
 
 void coldfire_tick(void);
 void coldfire_timer_init(irq_handler_t handler);
 unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 /***************************************************************************/
@@ -107,7 +105,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_timer_init;
        mach_tick = coldfire_tick;
        mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index 85830f9882f3bfde4e7496fd7ba9701d000b3ab8..a2c95bebd004cf24b25f18d8fed75524b3de9059 100644 (file)
@@ -30,7 +30,6 @@ unsigned int dma_device_address[MAX_M68K_DMA_CHANNELS];
 void coldfire_pit_tick(void);
 void coldfire_pit_init(irq_handler_t handler);
 unsigned long coldfire_pit_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 /***************************************************************************/
@@ -51,7 +50,6 @@ void config_BSP(char *commandp, int size)
     mach_sched_init = coldfire_pit_init;
     mach_tick = coldfire_pit_tick;
     mach_gettimeoffset = coldfire_pit_offset;
-    mach_trap_init = coldfire_trap_init;
     mach_reset = coldfire_reset;
 }
 
index c0157e1100356abc0b994bd35a9a8cbf60bf5407..0a3af05a434b415759621b0fc81e7e657b056f46 100644 (file)
@@ -29,7 +29,6 @@
 void coldfire_pit_tick(void);
 void coldfire_pit_init(irq_handler_t handler);
 unsigned long coldfire_pit_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 /***************************************************************************/
@@ -66,7 +65,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_pit_init;
        mach_tick = coldfire_pit_tick;
        mach_gettimeoffset = coldfire_pit_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index 4cdeb719512df8c4e2f5c23f6ac6f8b0740471b3..dc2c362590c229a29a3003b709d2ef75ee53a2e5 100644 (file)
@@ -27,7 +27,6 @@
 void coldfire_tick(void);
 void coldfire_timer_init(irq_handler_t handler);
 unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 /***************************************************************************/
@@ -99,7 +98,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_timer_init;
        mach_tick = coldfire_tick;
        mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index 609b10e4b9b9a049a842147438ba7251330ee6c0..1365a8300d5defbe39be9cc32c89b2ad0689022e 100644 (file)
@@ -28,7 +28,6 @@
 void coldfire_tick(void);
 void coldfire_timer_init(irq_handler_t handler);
 unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 extern unsigned int mcf_timervector;
@@ -132,7 +131,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_timer_init;
        mach_tick = coldfire_tick;
        mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index 126dac06648200c0c38d496a367d51afa35ca2fd..1b820441419aacea972433f166dfeff8b6a9c5a1 100644 (file)
@@ -29,7 +29,6 @@
 void coldfire_pit_tick(void);
 void coldfire_pit_init(irq_handler_t handler);
 unsigned long coldfire_pit_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 /***************************************************************************/
@@ -66,7 +65,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_pit_init;
        mach_tick = coldfire_pit_tick;
        mach_gettimeoffset = coldfire_pit_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index aab1ef0c1f7837f6dbd4fb99becded00c630af07..a089e9513699c1e82c0066576178564eb830ce73 100644 (file)
@@ -29,7 +29,6 @@
 void coldfire_pit_tick(void);
 void coldfire_pit_init(irq_handler_t handler);
 unsigned long coldfire_pit_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 /***************************************************************************/
@@ -66,7 +65,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_pit_init;
        mach_tick = coldfire_pit_tick;
        mach_gettimeoffset = coldfire_pit_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index 1f10e941b87c993babacdb886610e5b3e63b200e..e3461619fd65cb5c23ada8aa109eaa5b1f880caf 100644 (file)
@@ -29,7 +29,6 @@
 void coldfire_tick(void);
 void coldfire_timer_init(irq_handler_t handler);
 unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 extern unsigned int mcf_timervector;
@@ -126,7 +125,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_timer_init;
        mach_tick = coldfire_tick;
        mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 
 #ifdef MCF_BDM_DISABLE
index aa15beeb36ca8b7676a49894860f66baee32c7e1..e53c446d10e4d9cd2343293b82f0017756a23f58 100644 (file)
@@ -5,9 +5,8 @@
  *              hardware timer only exists in the Freescale ColdFire
  *              5270/5271, 5282 and other CPUs.
  *
- *     Copyright (C) 1999-2006, Greg Ungerer (gerg@snapgear.com)
+ *     Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com)
  *     Copyright (C) 2001-2004, SnapGear Inc. (www.snapgear.com)
- *
  */
 
 /***************************************************************************/
@@ -17,8 +16,8 @@
 #include <linux/param.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <asm/io.h>
-#include <asm/irq.h>
 #include <asm/coldfire.h>
 #include <asm/mcfpit.h>
 #include <asm/mcfsim.h>
@@ -43,13 +42,18 @@ void coldfire_pit_tick(void)
 
 /***************************************************************************/
 
+static struct irqaction coldfire_pit_irq = {
+       .name    = "timer",
+       .flags   = IRQF_DISABLED | IRQF_TIMER,
+};
+
 void coldfire_pit_init(irq_handler_t handler)
 {
        volatile unsigned char *icrp;
        volatile unsigned long *imrp;
 
-       request_irq(MCFINT_VECBASE + MCFINT_PIT1, handler, IRQF_DISABLED,
-               "ColdFire Timer", NULL);
+       coldfire_pit_irq.handler = handler;
+       setup_irq(MCFINT_VECBASE + MCFINT_PIT1, &coldfire_pit_irq);
 
        icrp = (volatile unsigned char *) (MCF_IPSBAR + MCFICM_INTC0 +
                MCFINTC_ICR0 + MCFINT_PIT1);
index fb66eadd589633cf02ecc9e9f89dffe395a808ef..64bd0ff9029e2922dc92b6bde566404c3e0eed79 100644 (file)
@@ -3,7 +3,7 @@
 /*
  *     timers.c -- generic ColdFire hardware timer support.
  *
- *     Copyright (C) 1999-2006, Greg Ungerer (gerg@snapgear.com)
+ *     Copyright (C) 1999-2007, Greg Ungerer (gerg@snapgear.com)
  */
 
 /***************************************************************************/
@@ -13,8 +13,8 @@
 #include <linux/param.h>
 #include <linux/interrupt.h>
 #include <linux/init.h>
+#include <linux/irq.h>
 #include <asm/io.h>
-#include <asm/irq.h>
 #include <asm/traps.h>
 #include <asm/machdep.h>
 #include <asm/coldfire.h>
@@ -62,17 +62,24 @@ void coldfire_tick(void)
 
 /***************************************************************************/
 
+static struct irqaction coldfire_timer_irq = {
+        .name    = "timer",
+        .flags   = IRQF_DISABLED | IRQF_TIMER,
+};
+
 static int ticks_per_intr;
 
 void coldfire_timer_init(irq_handler_t handler)
 {
+       coldfire_timer_irq.handler = handler;
+       setup_irq(mcf_timervector, &coldfire_timer_irq);
+
        __raw_writew(MCFTIMER_TMR_DISABLE, TA(MCFTIMER_TMR));
        ticks_per_intr = (MCF_BUSCLK / 16) / HZ;
        __raw_writetrr(ticks_per_intr - 1, TA(MCFTIMER_TRR));
        __raw_writew(MCFTIMER_TMR_ENORI | MCFTIMER_TMR_CLK16 |
                MCFTIMER_TMR_RESTART | MCFTIMER_TMR_ENABLE, TA(MCFTIMER_TMR));
 
-       request_irq(mcf_timervector, handler, IRQF_DISABLED, "timer", NULL);
        mcf_settimericr(1, mcf_timerlevel);
 
 #ifdef CONFIG_HIGHPROFILE
index dc39c466e33f69c7309048a53e78e94f502a4730..b32c6425f8219ea0430de1a8ef3f23c506584648 100644 (file)
@@ -37,7 +37,6 @@
 void coldfire_tick(void);
 void coldfire_timer_init(irq_handler_t handler);
 unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 extern unsigned int mcf_timervector;
@@ -108,7 +107,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_timer_init;
        mach_tick = coldfire_tick;
        mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 
 #ifdef MCF_BDM_DISABLE
index fde417fdd6504209b108703a5e1a40c6e534719e..e692536817d84fc22f9233360e3f33fd1785eea2 100644 (file)
@@ -28,7 +28,6 @@
 void coldfire_tick(void);
 void coldfire_timer_init(irq_handler_t handler);
 unsigned long coldfire_timer_offset(void);
-void coldfire_trap_init(void);
 void coldfire_reset(void);
 
 extern unsigned int mcf_timervector;
@@ -112,7 +111,6 @@ void config_BSP(char *commandp, int size)
        mach_sched_init = coldfire_timer_init;
        mach_tick = coldfire_tick;
        mach_gettimeoffset = coldfire_timer_offset;
-       mach_trap_init = coldfire_trap_init;
        mach_reset = coldfire_reset;
 }
 
index ef067f4c3cd47b8a241ea364869eda661a469ffc..0396476f955d6de405ba7a62d5c9edb35f3d113a 100644 (file)
 #include <linux/kernel.h>
 #include <linux/mm.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 #include <asm/setup.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
-#include <asm/irq.h>
 #include <asm/machdep.h>
 #include <asm/MC68VZ328.h>
 
 
 /***************************************************************************/
 
+static struct irqaction m68328_timer_irq = {
+       .name    = "timer",
+       .flags   = IRQF_DISABLED | IRQF_TIMER,
+};
+
 void m68328_timer_init(irq_handler_t timer_routine)
 {
        /* disable timer 1 */
        TCTL = 0;
 
        /* set ISR */
-       if (request_irq(TMR_IRQ_NUM, timer_routine, IRQ_FLG_LOCK, "timer", NULL)) 
-               panic("Unable to attach timer interrupt\n");
+       m68328_timer_irq.handler = timer_routine;
+       setup_irq(TMR_IRQ_NUM, &m68328_timer_irq);
 
        /* Restart mode, Enable int, Set clock source */
        TCTL = TCTL_OM | TCTL_IRQEN | CLOCK_SOURCE;
index 4ff13bd51ffd0e536e06e3f176ad9a18b5c7d2e4..155b72fe2607ac5f179be1c59b734332e4f2b0c0 100644 (file)
 #include <linux/tty.h>
 #include <linux/console.h>
 #include <linux/interrupt.h>
+#include <linux/irq.h>
 
 #include <asm/setup.h>
 #include <asm/system.h>
 #include <asm/pgtable.h>
-#include <asm/irq.h>
 #include <asm/machdep.h>
 #include <asm/m68360.h>
 
@@ -51,11 +51,15 @@ extern unsigned long int system_clock; //In kernel setup.c
 
 extern void config_M68360_irq(void);
 
+static struct irqaction m68360_timer_irq = {
+       .name    = "timer",
+       .flags   = IRQF_DISABLED | IRQF_TIMER,
+};
+
 void BSP_sched_init(irq_handler_t timer_routine)
 {
   unsigned char prescaler;
   unsigned short tgcr_save;
-  int return_value;
 
 #if 0
   /* Restart mode, Enable int, 32KHz, Enable timer */
@@ -86,10 +90,8 @@ void BSP_sched_init(irq_handler_t timer_routine)
   pquicc->timer_ter1 = 0x0003; /* clear timer events */
 
   /* enable timer 1 interrupt in CIMR */
-//  request_irq(IRQ_MACHSPEC | CPMVEC_TIMER1, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
-  //return_value = request_irq( CPMVEC_TIMER1, timer_routine, IRQ_FLG_LOCK, "timer", NULL);
-  return_value = request_irq(CPMVEC_TIMER1 , timer_routine, IRQ_FLG_LOCK,
-          "Timer", NULL);
+  m68360_timer_irq.handler = timer_routine;
+  setup_irq(CPMVEC_TIMER1, &m68360_timer_irq);
 
   /* Start timer 1: */
   tgcr_save = (pquicc->timer_tgcr & 0xfff0) | 0x0001;
index 1e3aeccd7322cfdc06067c46dea49950687a22f0..3b404b7dfa3925d7ca3c8ee62ed7a37377bae288 100644 (file)
@@ -15,29 +15,6 @@ choice
        prompt "System type"
        default SGI_IP22
 
-config LEMOTE_FULONG
-       bool "Lemote Fulong mini-PC"
-       select ARCH_SPARSEMEM_ENABLE
-       select SYS_HAS_CPU_LOONGSON2
-       select DMA_NONCOHERENT
-       select BOOT_ELF32
-       select BOARD_SCACHE
-       select HAVE_STD_PC_SERIAL_PORT
-       select HW_HAS_PCI
-       select I8259
-       select ISA
-       select IRQ_CPU
-       select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_64BIT_KERNEL
-       select SYS_SUPPORTS_LITTLE_ENDIAN
-       select SYS_SUPPORTS_HIGHMEM
-       select SYS_HAS_EARLY_PRINTK
-       select GENERIC_HARDIRQS_NO__DO_IRQ
-       select CPU_HAS_WB
-       help
-         Lemote Fulong mini-PC board based on the Chinese Loongson-2E CPU and
-         an FPGA northbridge
-
 config MACH_ALCHEMY
        bool "Alchemy processor based machines"
 
@@ -131,6 +108,29 @@ config MACH_JAZZ
         Members include the Acer PICA, MIPS Magnum 4000, MIPS Millenium and
         Olivetti M700-10 workstations.
 
+config LEMOTE_FULONG
+       bool "Lemote Fulong mini-PC"
+       select ARCH_SPARSEMEM_ENABLE
+       select SYS_HAS_CPU_LOONGSON2
+       select DMA_NONCOHERENT
+       select BOOT_ELF32
+       select BOARD_SCACHE
+       select HAVE_STD_PC_SERIAL_PORT
+       select HW_HAS_PCI
+       select I8259
+       select ISA
+       select IRQ_CPU
+       select SYS_SUPPORTS_32BIT_KERNEL
+       select SYS_SUPPORTS_64BIT_KERNEL
+       select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_SUPPORTS_HIGHMEM
+       select SYS_HAS_EARLY_PRINTK
+       select GENERIC_HARDIRQS_NO__DO_IRQ
+       select CPU_HAS_WB
+       help
+         Lemote Fulong mini-PC board based on the Chinese Loongson-2E CPU and
+         an FPGA northbridge
+
 config MIPS_ATLAS
        bool "MIPS Atlas board"
        select BOOT_ELF32
@@ -210,27 +210,6 @@ config MIPS_SEAD
          This enables support for the MIPS Technologies SEAD evaluation
          board.
 
-config WR_PPMC
-       bool "Wind River PPMC board"
-       select IRQ_CPU
-       select BOOT_ELF32
-       select DMA_NONCOHERENT
-       select HW_HAS_PCI
-       select PCI_GT64XXX_PCI0
-       select SWAP_IO_SPACE
-       select SYS_HAS_CPU_MIPS32_R1
-       select SYS_HAS_CPU_MIPS32_R2
-       select SYS_HAS_CPU_MIPS64_R1
-       select SYS_HAS_CPU_NEVADA
-       select SYS_HAS_CPU_RM7000
-       select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_64BIT_KERNEL
-       select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_LITTLE_ENDIAN
-       help
-         This enables support for the Wind River MIPS32 4KC PPMC evaluation
-         board, which is based on GT64120 bridge chip.
-
 config MIPS_SIM
        bool 'MIPS simulator (MIPSsim)'
        select DMA_NONCOHERENT
@@ -248,23 +227,24 @@ config MIPS_SIM
          This option enables support for MIPS Technologies MIPSsim software
          emulator.
 
-config MOMENCO_OCELOT
-       bool "Momentum Ocelot board"
+config MARKEINS
+       bool "NEC EMMA2RH Mark-eins"
        select DMA_NONCOHERENT
        select HW_HAS_PCI
        select IRQ_CPU
-       select IRQ_CPU_RM7K
-       select PCI_GT64XXX_PCI0
-       select RM7000_CPU_SCACHE
        select SWAP_IO_SPACE
-       select SYS_HAS_CPU_RM7000
        select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_64BIT_KERNEL
        select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_KGDB
+       select SYS_SUPPORTS_LITTLE_ENDIAN
+       select SYS_HAS_CPU_R5000
        help
-         The Ocelot is a MIPS-based Single Board Computer (SBC) made by
-         Momentum Computer <http://www.momenco.com/>.
+         This enables support for the R5432-based NEC Mark-eins
+         boards with R5500 CPU.
+
+config MACH_VR41XX
+       bool "NEC VR4100 series based machines"
+       select SYS_HAS_CPU_VR41XX
+       select GENERIC_HARDIRQS_NO__DO_IRQ
 
 config PNX8550_JBS
        bool "Philips PNX8550 based JBS board"
@@ -276,31 +256,6 @@ config PNX8550_STB810
        select PNX8550
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config DDB5477
-       bool "NEC DDB Vrc-5477"
-       select DDB5XXX_COMMON
-       select DMA_NONCOHERENT
-       select HW_HAS_PCI
-       select I8259
-       select IRQ_CPU
-       select SYS_HAS_CPU_R5432
-       select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_64BIT_KERNEL if EXPERIMENTAL
-       select SYS_SUPPORTS_KGDB
-       select SYS_SUPPORTS_KGDB
-       select SYS_SUPPORTS_LITTLE_ENDIAN
-       help
-         This enables support for the R5432-based NEC DDB Vrc-5477,
-         or Rockhopper/SolutionGear boards with R5432/R5500 CPUs.
-
-         Features : kernel debugging, serial terminal, NFS root fs, on-board
-         ether port USB, AC97, PCI, etc.
-
-config MACH_VR41XX
-       bool "NEC VR4100 series based machines"
-       select SYS_HAS_CPU_VR41XX
-       select GENERIC_HARDIRQS_NO__DO_IRQ
-
 config PMC_MSP
        bool "PMC-Sierra MSP chipsets"
        depends on EXPERIMENTAL
@@ -367,20 +322,6 @@ config QEMU
          simulate actual MIPS hardware platforms.  More information on Qemu
          can be found at http://www.linux-mips.org/wiki/Qemu.
 
-config MARKEINS
-       bool "NEC EMMA2RH Mark-eins"
-       select DMA_NONCOHERENT
-       select HW_HAS_PCI
-       select IRQ_CPU
-       select SWAP_IO_SPACE
-       select SYS_SUPPORTS_32BIT_KERNEL
-       select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_LITTLE_ENDIAN
-       select SYS_HAS_CPU_R5000
-       help
-         This enables support for the R5432-based NEC Mark-eins
-         boards with R5500 CPU.
-
 config SGI_IP22
        bool "SGI IP22 (Indy/Indigo2)"
        select ARC
@@ -443,41 +384,38 @@ config SGI_IP32
        help
          If you want this kernel to run on SGI O2 workstation, say Y here.
 
-config SIBYTE_BIGSUR
-       bool "Sibyte BCM91480B-BigSur"
+config SIBYTE_CRHINE
+       bool "Sibyte BCM91120C-CRhine"
+       depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
-       select NR_CPUS_DEFAULT_4
-       select PCI_DOMAINS
-       select SIBYTE_BCM1x80
+       select SIBYTE_BCM1120
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config SIBYTE_SWARM
-       bool "Sibyte BCM91250A-SWARM"
+config SIBYTE_CARMEL
+       bool "Sibyte BCM91120x-Carmel"
+       depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
-       select NR_CPUS_DEFAULT_2
-       select SIBYTE_SB1250
+       select SIBYTE_BCM1120
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_HIGHMEM
-       select SYS_SUPPORTS_KGDB
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config SIBYTE_SENTOSA
-       bool "Sibyte BCM91250E-Sentosa"
+config SIBYTE_CRHONE
+       bool "Sibyte BCM91125C-CRhone"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
-       select NR_CPUS_DEFAULT_2
-       select SIBYTE_SB1250
+       select SIBYTE_BCM1125
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
+       select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SIBYTE_RHONE
@@ -491,19 +429,21 @@ config SIBYTE_RHONE
        select SYS_SUPPORTS_BIG_ENDIAN
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config SIBYTE_CARMEL
-       bool "Sibyte BCM91120x-Carmel"
-       depends on EXPERIMENTAL
+config SIBYTE_SWARM
+       bool "Sibyte BCM91250A-SWARM"
        select BOOT_ELF32
        select DMA_COHERENT
-       select SIBYTE_BCM1120
+       select NR_CPUS_DEFAULT_2
+       select SIBYTE_SB1250
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
+       select SYS_SUPPORTS_HIGHMEM
+       select SYS_SUPPORTS_KGDB
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config SIBYTE_PTSWARM
-       bool "Sibyte BCM91250PT-PTSWARM"
+config SIBYTE_LITTLESUR
+       bool "Sibyte BCM91250C2-LittleSur"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -515,8 +455,8 @@ config SIBYTE_PTSWARM
        select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config SIBYTE_LITTLESUR
-       bool "Sibyte BCM91250C2-LittleSur"
+config SIBYTE_SENTOSA
+       bool "Sibyte BCM91250E-Sentosa"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
@@ -525,30 +465,31 @@ config SIBYTE_LITTLESUR
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config SIBYTE_CRHINE
-       bool "Sibyte BCM91120C-CRhine"
+config SIBYTE_PTSWARM
+       bool "Sibyte BCM91250PT-PTSWARM"
        depends on EXPERIMENTAL
        select BOOT_ELF32
        select DMA_COHERENT
-       select SIBYTE_BCM1120
+       select NR_CPUS_DEFAULT_2
+       select SIBYTE_SB1250
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
+       select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
-config SIBYTE_CRHONE
-       bool "Sibyte BCM91125C-CRhone"
-       depends on EXPERIMENTAL
+config SIBYTE_BIGSUR
+       bool "Sibyte BCM91480B-BigSur"
        select BOOT_ELF32
        select DMA_COHERENT
-       select SIBYTE_BCM1125
+       select NR_CPUS_DEFAULT_4
+       select PCI_DOMAINS
+       select SIBYTE_BCM1x80
        select SWAP_IO_SPACE
        select SYS_HAS_CPU_SB1
        select SYS_SUPPORTS_BIG_ENDIAN
-       select SYS_SUPPORTS_HIGHMEM
        select SYS_SUPPORTS_LITTLE_ENDIAN
 
 config SNI_RM
@@ -595,7 +536,7 @@ config TOSHIBA_JMR3927
        select GENERIC_HARDIRQS_NO__DO_IRQ
 
 config TOSHIBA_RBTX4927
-       bool "Toshiba TBTX49[23]7 board"
+       bool "Toshiba RBTX49[23]7 board"
        select DMA_NONCOHERENT
        select HAS_TXX9_SERIAL
        select HW_HAS_PCI
@@ -632,10 +573,30 @@ config TOSHIBA_RBTX4938
          This Toshiba board is based on the TX4938 processor. Say Y here to
          support this machine type
 
+config WR_PPMC
+       bool "Wind River PPMC board"
+       select IRQ_CPU
+       select BOOT_ELF32
+       select DMA_NONCOHERENT
+       select HW_HAS_PCI
+       select PCI_GT64XXX_PCI0
+       select SWAP_IO_SPACE
+       select SYS_HAS_CPU_MIPS32_R1
+       select SYS_HAS_CPU_MIPS32_R2
+       select SYS_HAS_CPU_MIPS64_R1
+       select SYS_HAS_CPU_NEVADA
+       select SYS_HAS_CPU_RM7000
+       select SYS_SUPPORTS_32BIT_KERNEL
+       select SYS_SUPPORTS_64BIT_KERNEL
+       select SYS_SUPPORTS_BIG_ENDIAN
+       select SYS_SUPPORTS_LITTLE_ENDIAN
+       help
+         This enables support for the Wind River MIPS32 4KC PPMC evaluation
+         board, which is based on GT64120 bridge chip.
+
 endchoice
 
 source "arch/mips/au1000/Kconfig"
-source "arch/mips/ddb5xxx/Kconfig"
 source "arch/mips/jazz/Kconfig"
 source "arch/mips/pmc-sierra/Kconfig"
 source "arch/mips/sgi-ip27/Kconfig"
@@ -807,10 +768,6 @@ config IRQ_MSP_SLP
 config IRQ_MSP_CIC
        bool
 
-config DDB5XXX_COMMON
-       bool
-       select SYS_SUPPORTS_KGDB
-
 config MIPS_BOARDS_GEN
        bool
 
@@ -1377,17 +1334,6 @@ config MIPS_MT_SMTC
          This is a kernel model which is known a SMTC or lately has been
          marketesed into SMVP.
 
-config MIPS_VPE_LOADER
-       bool "VPE loader support."
-       depends on SYS_SUPPORTS_MULTITHREADING
-       select CPU_MIPSR2_IRQ_VI
-       select CPU_MIPSR2_IRQ_EI
-       select CPU_MIPSR2_SRS
-       select MIPS_MT
-       help
-         Includes a loader for loading an elf relocatable object
-         onto another VPE and running it.
-
 endchoice
 
 config MIPS_MT
@@ -1398,8 +1344,19 @@ config SYS_SUPPORTS_MULTITHREADING
 
 config MIPS_MT_FPAFF
        bool "Dynamic FPU affinity for FP-intensive threads"
-       depends on MIPS_MT
        default y
+       depends on MIPS_MT_SMP || MIPS_MT_SMTC
+
+config MIPS_VPE_LOADER
+       bool "VPE loader support."
+       depends on SYS_SUPPORTS_MULTITHREADING
+       select CPU_MIPSR2_IRQ_VI
+       select CPU_MIPSR2_IRQ_EI
+       select CPU_MIPSR2_SRS
+       select MIPS_MT
+       help
+         Includes a loader for loading an elf relocatable object
+         onto another VPE and running it.
 
 config MIPS_MT_SMTC_INSTANT_REPLAY
        bool "Low-latency Dispatch of Deferred SMTC IPIs"
@@ -1772,7 +1729,7 @@ config KEXEC
 
 config SECCOMP
        bool "Enable seccomp to safely compute untrusted bytecode"
-       depends on PROC_FS && BROKEN
+       depends on PROC_FS
        default y
        help
          This kernel feature is useful for number crunching applications
index a9a987a06dafb3344085dd5f703c1ee7cad65f32..32c1c8fb6f98375f997e254c445c3e8e18f8e98f 100644 (file)
@@ -67,6 +67,8 @@ cflags-y              += $(call cc-option,-msym32)
 endif
 endif
 
+all-$(CONFIG_BOOT_ELF32)       := $(vmlinux-32)
+all-$(CONFIG_BOOT_ELF64)       := $(vmlinux-64)
 
 #
 # GCC uses -G 0 -mabicalls -fpic as default.  We don't want PIC in the kernel
@@ -309,6 +311,7 @@ core-$(CONFIG_MIPS_ATLAS)   += arch/mips/mips-boards/atlas/
 cflags-$(CONFIG_MIPS_ATLAS)    += -Iinclude/asm-mips/mach-atlas
 cflags-$(CONFIG_MIPS_ATLAS)    += -Iinclude/asm-mips/mach-mips
 load-$(CONFIG_MIPS_ATLAS)      += 0xffffffff80100000
+all-$(CONFIG_MIPS_ATLAS)       := vmlinux.srec
 
 #
 # MIPS Malta board
@@ -316,6 +319,7 @@ load-$(CONFIG_MIPS_ATLAS)   += 0xffffffff80100000
 core-$(CONFIG_MIPS_MALTA)      += arch/mips/mips-boards/malta/
 cflags-$(CONFIG_MIPS_MALTA)    += -Iinclude/asm-mips/mach-mips
 load-$(CONFIG_MIPS_MALTA)      += 0xffffffff80100000
+all-$(CONFIG_MIPS_MALTA)       := vmlinux.srec
 
 #
 # MIPS SEAD board
@@ -323,6 +327,7 @@ load-$(CONFIG_MIPS_MALTA)   += 0xffffffff80100000
 core-$(CONFIG_MIPS_SEAD)       += arch/mips/mips-boards/sead/
 cflags-$(CONFIG_MIPS_SEAD)     += -Iinclude/asm-mips/mach-mips
 load-$(CONFIG_MIPS_SEAD)       += 0xffffffff80100000
+all-$(CONFIG_MIPS_SEAD)                := vmlinux.srec
 
 #
 # MIPS SIM
@@ -331,17 +336,6 @@ core-$(CONFIG_MIPS_SIM)            += arch/mips/mipssim/
 cflags-$(CONFIG_MIPS_SIM)      += -Iinclude/asm-mips/mach-mipssim
 load-$(CONFIG_MIPS_SIM)                += 0x80100000
 
-#
-# Momentum Ocelot board
-#
-# The Ocelot setup.o must be linked early - it does the ioremap() for the
-# mips_io_port_base.
-#
-core-$(CONFIG_MOMENCO_OCELOT)  += arch/mips/gt64120/common/ \
-                                  arch/mips/gt64120/momenco_ocelot/
-cflags-$(CONFIG_MOMENCO_OCELOT)        += -Iinclude/asm-mips/mach-ocelot
-load-$(CONFIG_MOMENCO_OCELOT)  += 0xffffffff80100000
-
 #
 # PMC-Sierra MSP SOCs
 #
@@ -363,6 +357,7 @@ load-$(CONFIG_PMC_YOSEMITE) += 0xffffffff80100000
 core-$(CONFIG_QEMU)            += arch/mips/qemu/
 cflags-$(CONFIG_QEMU)          += -Iinclude/asm-mips/mach-qemu
 load-$(CONFIG_QEMU)            += 0xffffffff80010000
+all-$(CONFIG_QEMU)             := vmlinux.bin
 
 #
 # Basler eXcite
@@ -371,17 +366,6 @@ core-$(CONFIG_BASLER_EXCITE)       += arch/mips/basler/excite/
 cflags-$(CONFIG_BASLER_EXCITE) += -Iinclude/asm-mips/mach-excite
 load-$(CONFIG_BASLER_EXCITE)   += 0x80100000
 
-#
-# NEC DDB
-#
-core-$(CONFIG_DDB5XXX_COMMON)  += arch/mips/ddb5xxx/common/
-
-#
-# NEC DDB Vrc-5477
-#
-core-$(CONFIG_DDB5477)         += arch/mips/ddb5xxx/ddb5477/
-load-$(CONFIG_DDB5477)         += 0xffffffff80100000
-
 #
 # Common VR41xx
 #
@@ -554,6 +538,7 @@ load-$(CONFIG_SIBYTE_BIGSUR)        := 0xffffffff80100000
 core-$(CONFIG_SNI_RM)          += arch/mips/sni/
 cflags-$(CONFIG_SNI_RM)                += -Iinclude/asm-mips/mach-rm
 load-$(CONFIG_SNI_RM)          += 0xffffffff80600000
+all-$(CONFIG_SNI_RM)           := vmlinux.ecoff
 
 #
 # Toshiba JMR-TX3927 board
@@ -647,33 +632,7 @@ vmlinux.64: vmlinux
 
 makeboot =$(Q)$(MAKE) $(build)=arch/mips/boot VMLINUX=$(vmlinux-32) $(1)
 
-ifdef CONFIG_BOOT_ELF32
-all:   $(vmlinux-32)
-endif
-
-ifdef CONFIG_BOOT_ELF64
-all:   $(vmlinux-64)
-endif
-
-ifdef CONFIG_MIPS_ATLAS
-all:   vmlinux.srec
-endif
-
-ifdef CONFIG_MIPS_MALTA
-all:   vmlinux.srec
-endif
-
-ifdef CONFIG_MIPS_SEAD
-all:   vmlinux.srec
-endif
-
-ifdef CONFIG_QEMU
-all:   vmlinux.bin
-endif
-
-ifdef CONFIG_SNI_RM
-all:   vmlinux.ecoff
-endif
+all:   $(all-y)
 
 vmlinux.bin: $(vmlinux-32)
        +@$(call makeboot,$@)
@@ -700,6 +659,14 @@ endif
 archclean:
        @$(MAKE) $(clean)=arch/mips/boot
 
+define archhelp
+       echo '  vmlinux.ecoff        - ECOFF boot image'
+       echo '  vmlinux.bin          - Raw binary boot image'
+       echo '  vmlinux.srec         - SREC boot image'
+       echo
+       echo '  These will be default as apropriate for a configured platform.'
+endef
+
 CLEAN_FILES += vmlinux.32 \
               vmlinux.64 \
               vmlinux.ecoff
index a43425b3c838f9741d55166dc24121e992d738ef..cb0127cf5bc155a029495272134975e2a81fa69b 100644 (file)
 #include <asm/arc/types.h>
 #include <asm/sgialib.h>
 
-LONG __init
+LONG
 ArcGetDirectoryEntry(ULONG FileID, struct linux_vdirent *Buffer,
                      ULONG N, ULONG *Count)
 {
        return ARC_CALL4(get_vdirent, FileID, Buffer, N, Count);
 }
 
-LONG __init
+LONG
 ArcOpen(CHAR *Path, enum linux_omode OpenMode, ULONG *FileID)
 {
        return ARC_CALL3(open, Path, OpenMode, FileID);
 }
 
-LONG __init
+LONG
 ArcClose(ULONG FileID)
 {
        return ARC_CALL1(close, FileID);
 }
 
-LONG __init
+LONG
 ArcRead(ULONG FileID, VOID *Buffer, ULONG N, ULONG *Count)
 {
        return ARC_CALL4(read, FileID, Buffer, N, Count);
 }
 
-LONG __init
+LONG
 ArcGetReadStatus(ULONG FileID)
 {
        return ARC_CALL1(get_rstatus, FileID);
 }
 
-LONG __init
+LONG
 ArcWrite(ULONG FileID, PVOID Buffer, ULONG N, PULONG Count)
 {
        return ARC_CALL4(write, FileID, Buffer, N, Count);
 }
 
-LONG __init
+LONG
 ArcSeek(ULONG FileID, struct linux_bigint *Position, enum linux_seekmode SeekMode)
 {
        return ARC_CALL3(seek, FileID, Position, SeekMode);
 }
 
-LONG __init
+LONG
 ArcMount(char *name, enum linux_mountops op)
 {
        return ARC_CALL2(mount, name, op);
 }
 
-LONG __init
+LONG
 ArcGetFileInformation(ULONG FileID, struct linux_finfo *Information)
 {
        return ARC_CALL2(get_finfo, FileID, Information);
 }
 
-LONG __init ArcSetFileInformation(ULONG FileID, ULONG AttributeFlags,
-                                  ULONG AttributeMask)
+LONG ArcSetFileInformation(ULONG FileID, ULONG AttributeFlags,
+                           ULONG AttributeMask)
 {
        return ARC_CALL3(set_finfo, FileID, AttributeFlags, AttributeMask);
 }
index 4c35525edb4f443b18e107b9a577a74f26a9f5ff..90e2d7a46e8e2c7d96a86fb61500b11c9ddad4f5 100644 (file)
@@ -12,3 +12,5 @@ obj-y += prom.o irq.o puts.o time.o reset.o \
 
 obj-$(CONFIG_KGDB)             += dbg_io.o
 obj-$(CONFIG_PCI)              += pci.o
+
+EXTRA_CFLAGS += -Werror
index 0dc84417bf49367e37c9ef63306230c2658ebcf1..2a209d74f0b4fa70993075e39073649b5d1abd38 100644 (file)
@@ -42,10 +42,6 @@ vmlinux.srec: $(VMLINUX)
 $(obj)/addinitrd: $(obj)/addinitrd.c
        $(HOSTCC) -o $@ $^
 
-archhelp:
-       @echo   '* vmlinux.ecoff        - ECOFF boot image'
-       @echo   '* vmlinux.srec         - SREC boot image'
-
 clean-files += addinitrd \
               elf2ecoff \
               vmlinux.bin \
index c292f80a8c74d44db80e97943210ebf08220e3ba..a043f93f7d0884d7fb7364fafad5d423b29574d2 100644 (file)
@@ -7,3 +7,5 @@ obj-y := buttons.o irq.o reset.o rtc.o serial.o setup.o
 obj-$(CONFIG_PCI)              += pci.o
 obj-$(CONFIG_EARLY_PRINTK)     += console.o
 obj-$(CONFIG_MTD_PHYSMAP)      += mtd.o
+
+EXTRA_CFLAGS += -Werror
index c27116599a5f3616225ece8188837aa3f10f3150..08e739704cc90079fd666926fee24e8cc8cd5bab 100644 (file)
@@ -55,9 +55,9 @@ static __init int cobalt_uart_add(void)
        int retval;
 
        /*
-        * Cobalt Qube1 and RAQ1 have no UART.
+        * Cobalt Qube1 has no UART.
         */
-       if (cobalt_board_id <= COBALT_BRD_ID_RAQ1)
+       if (cobalt_board_id == COBALT_BRD_ID_QUBE1)
                return 0;
 
        pdev = platform_device_alloc("serial8250", -1);
index 129e2c961fecdfeac1c42b1a48462dabf627d57c..62bcc887f2caca0f4bfda4b1aa216ce4774a9140 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_MIPS_ATLAS=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index dc3e1bf4e42edbf04af8015503c2091cf1017a85..67a80f4c7d87d7768021ce29ecde069af4f3643a 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 4c7031222e64d42b440557a0212048d9a6e05e0d..4dc3197e2e9f6bff26f325e68d5235cd3c2b81ba 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 CONFIG_MACH_VR41XX=y
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index c8c05785a86d19a605e306b661a360a6f77b2331..6d6a01b9a81741a90df68b9bcfdc260e70658a1b 100644 (file)
@@ -18,10 +18,8 @@ CONFIG_MIPS_COBALT=y
 # CONFIG_MIPS_SEAD is not set
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_OCELOT is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index ec60beb888b2baa820d8172d4219b331654e6833..885b633647e96e34be965243da16bd52f989835b 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1000=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index f3c25f08bfad1ba352d46fe83bc94a43fafccc65..e3c3a07e8a7c54d2d0eeeee731d850ac27aa270e 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1100=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 6d400befbaccd1d696c9f0dca2e1a5a6e55276d1..9aa7c3ebfa3f775ea2d481ab13c47fcb3ce6cc98 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1200=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 82aea6e088239885fdd32db7fdf6cdf5ef10ddbf..99240668bca1d088e7e3113981599f21e841504f 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1500=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 82697714a9e3e4beaa48023ea37ae1e802a148f8..19992f76c60d5956c179df13bb1ec4bc4caa3d54 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_DB1550=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
diff --git a/arch/mips/configs/ddb5477_defconfig b/arch/mips/configs/ddb5477_defconfig
deleted file mode 100644 (file)
index a42ab9a..0000000
+++ /dev/null
@@ -1,990 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:28 2007
-#
-CONFIG_MIPS=y
-
-#
-# Machine selection
-#
-CONFIG_ZONE_DMA=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
-# CONFIG_MIPS_COBALT is not set
-# CONFIG_MACH_DECSTATION is not set
-# CONFIG_MACH_JAZZ is not set
-# CONFIG_MIPS_ATLAS is not set
-# CONFIG_MIPS_MALTA is not set
-# CONFIG_MIPS_SEAD is not set
-# CONFIG_WR_PPMC is not set
-# CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
-# CONFIG_MIPS_XXS1500 is not set
-# CONFIG_PNX8550_JBS is not set
-# CONFIG_PNX8550_STB810 is not set
-CONFIG_DDB5477=y
-# CONFIG_MACH_VR41XX is not set
-# CONFIG_PMC_YOSEMITE is not set
-# CONFIG_QEMU is not set
-# CONFIG_MARKEINS is not set
-# CONFIG_SGI_IP22 is not set
-# CONFIG_SGI_IP27 is not set
-# CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_PTSWARM is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
-# CONFIG_SIBYTE_CRHINE is not set
-# CONFIG_SIBYTE_CRHONE is not set
-# CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
-CONFIG_DDB5477_BUS_FREQUENCY=0
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_ARCH_HAS_ILOG2_U32 is not set
-# CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_DMA_NEED_PCI_MAP_STATE=y
-CONFIG_I8259=y
-# CONFIG_CPU_BIG_ENDIAN is not set
-CONFIG_CPU_LITTLE_ENDIAN=y
-CONFIG_SYS_SUPPORTS_LITTLE_ENDIAN=y
-CONFIG_IRQ_CPU=y
-CONFIG_DDB5XXX_COMMON=y
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-
-#
-# CPU selection
-#
-# CONFIG_CPU_MIPS32_R1 is not set
-# CONFIG_CPU_MIPS32_R2 is not set
-# CONFIG_CPU_MIPS64_R1 is not set
-# CONFIG_CPU_MIPS64_R2 is not set
-# CONFIG_CPU_R3000 is not set
-# CONFIG_CPU_TX39XX is not set
-# CONFIG_CPU_VR41XX is not set
-# CONFIG_CPU_R4300 is not set
-# CONFIG_CPU_R4X00 is not set
-# CONFIG_CPU_TX49XX is not set
-# CONFIG_CPU_R5000 is not set
-CONFIG_CPU_R5432=y
-# CONFIG_CPU_R6000 is not set
-# CONFIG_CPU_NEVADA is not set
-# CONFIG_CPU_R8000 is not set
-# CONFIG_CPU_R10000 is not set
-# CONFIG_CPU_RM7000 is not set
-# CONFIG_CPU_RM9000 is not set
-# CONFIG_CPU_SB1 is not set
-CONFIG_SYS_HAS_CPU_R5432=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
-
-#
-# Kernel type
-#
-CONFIG_32BIT=y
-# CONFIG_64BIT is not set
-CONFIG_PAGE_SIZE_4KB=y
-# CONFIG_PAGE_SIZE_8KB is not set
-# CONFIG_PAGE_SIZE_16KB is not set
-# CONFIG_PAGE_SIZE_64KB is not set
-CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_MT_SMP is not set
-# CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
-CONFIG_CPU_HAS_LLSC=y
-CONFIG_CPU_HAS_SYNC=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_PROBE=y
-CONFIG_ARCH_FLATMEM_ENABLE=y
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=1
-# CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
-# CONFIG_HZ_128 is not set
-# CONFIG_HZ_250 is not set
-# CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
-# CONFIG_HZ_1024 is not set
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
-CONFIG_PREEMPT_NONE=y
-# CONFIG_PREEMPT_VOLUNTARY is not set
-# CONFIG_PREEMPT is not set
-# CONFIG_KEXEC is not set
-CONFIG_LOCKDEP_SUPPORT=y
-CONFIG_STACKTRACE_SUPPORT=y
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
-CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
-# CONFIG_AUDIT is not set
-# CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-CONFIG_SYSCTL=y
-CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=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
-CONFIG_SHMEM=y
-CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-# CONFIG_MODULES is not set
-
-#
-# Block layer
-#
-CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
-# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-
-#
-# Bus options (PCI, PCMCIA, EISA, ISA, TC)
-#
-CONFIG_HW_HAS_PCI=y
-CONFIG_PCI=y
-CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-# CONFIG_PCCARD is not set
-
-#
-# PCI Hotplug Support
-#
-# CONFIG_HOTPLUG_PCI is not set
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_MISC is not set
-CONFIG_TRAD_SIGNALS=y
-
-#
-# Power management options
-#
-CONFIG_PM=y
-# CONFIG_PM_LEGACY is not set
-# CONFIG_PM_DEBUG is not set
-# CONFIG_PM_SYSFS_DEPRECATED is not set
-
-#
-# Networking
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-# CONFIG_NETDEBUG is not set
-CONFIG_PACKET=y
-# CONFIG_PACKET_MMAP is not set
-CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=y
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
-CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_FIB_HASH=y
-CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
-CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_XFRM_TUNNEL is not set
-# CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=y
-CONFIG_INET_XFRM_MODE_TUNNEL=y
-CONFIG_INET_XFRM_MODE_BEET=y
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
-# CONFIG_TCP_CONG_ADVANCED is not set
-CONFIG_TCP_CONG_CUBIC=y
-CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-# CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-# CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
-# CONFIG_TIPC is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB 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
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
-CONFIG_IEEE80211=y
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=y
-CONFIG_IEEE80211_CRYPT_CCMP=y
-CONFIG_IEEE80211_SOFTMAC=y
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-CONFIG_FW_LOADER=y
-# CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=y
-CONFIG_PROC_EVENTS=y
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
-#
-# CONFIG_BLK_CPQ_DA is not set
-# CONFIG_BLK_CPQ_CISS_DA is not set
-# CONFIG_BLK_DEV_DAC960 is not set
-# CONFIG_BLK_DEV_UMEM is not set
-# CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_SX8 is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CDROM_PKTCDVD=y
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=y
-
-#
-# Misc devices
-#
-CONFIG_SGI_IOC4=y
-# CONFIG_TIFM_CORE is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-CONFIG_RAID_ATTRS=y
-# CONFIG_SCSI is not set
-# CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
-# CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-# CONFIG_FUSION is not set
-
-#
-# IEEE 1394 (FireWire) support
-#
-# CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
-# CONFIG_I2O is not set
-
-#
-# Network device support
-#
-CONFIG_NETDEVICES=y
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
-# CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
-CONFIG_PHYLIB=y
-
-#
-# MII PHY device drivers
-#
-CONFIG_MARVELL_PHY=y
-CONFIG_DAVICOM_PHY=y
-CONFIG_QSEMI_PHY=y
-CONFIG_LXT_PHY=y
-CONFIG_CICADA_PHY=y
-CONFIG_VITESSE_PHY=y
-CONFIG_SMSC_PHY=y
-# CONFIG_BROADCOM_PHY is not set
-# CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-CONFIG_MII=y
-# CONFIG_HAPPYMEAL is not set
-# CONFIG_SUNGEM is not set
-# CONFIG_CASSINI is not set
-# CONFIG_NET_VENDOR_3COM is not set
-# CONFIG_DM9000 is not set
-
-#
-# Tulip family network device support
-#
-# CONFIG_NET_TULIP is not set
-# CONFIG_HP100 is not set
-CONFIG_NET_PCI=y
-CONFIG_PCNET32=y
-# CONFIG_PCNET32_NAPI is not set
-# CONFIG_AMD8111_ETH is not set
-# CONFIG_ADAPTEC_STARFIRE is not set
-# CONFIG_B44 is not set
-# CONFIG_FORCEDETH is not set
-# CONFIG_DGRS is not set
-# CONFIG_EEPRO100 is not set
-# CONFIG_E100 is not set
-# CONFIG_FEALNX is not set
-# CONFIG_NATSEMI is not set
-# CONFIG_NE2K_PCI is not set
-# CONFIG_8139CP is not set
-# CONFIG_8139TOO is not set
-# CONFIG_SIS900 is not set
-# CONFIG_EPIC100 is not set
-# CONFIG_SUNDANCE is not set
-# CONFIG_TLAN is not set
-# CONFIG_VIA_RHINE is not set
-# CONFIG_SC92031 is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# 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 is not set
-# CONFIG_BNX2 is not set
-CONFIG_QLA3XXX=y
-# CONFIG_ATL1 is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_CHELSIO_T1 is not set
-CONFIG_CHELSIO_T3=y
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-CONFIG_NETXEN_NIC=y
-
-#
-# Token Ring devices
-#
-# CONFIG_TR is not set
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-# CONFIG_FDDI is not set
-# CONFIG_HIPPI is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
-# CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-# CONFIG_INPUT_FF_MEMLESS is not set
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input Device Drivers
-#
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Hardware I/O ports
-#
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=y
-# CONFIG_GAMEPORT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-CONFIG_VT_HW_CONSOLE_BINDING=y
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_PCI=y
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
-# CONFIG_SERIAL_8250_EXTENDED is not set
-
-#
-# Non-8250 serial port support
-#
-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
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
-# CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
-# CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
-# CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# SPI support
-#
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
-# CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
-# CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-
-#
-# Graphics support
-#
-# CONFIG_FIRMWARE_EDID is not set
-# CONFIG_FB is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
-# CONFIG_HID is not set
-
-#
-# USB support
-#
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-CONFIG_USB_ARCH_HAS_EHCI=y
-# CONFIG_USB is not set
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
-# CONFIG_MMC is not set
-
-#
-# LED devices
-#
-# CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-# CONFIG_INFINIBAND is not set
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
-# CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Auxiliary Display support
-#
-
-#
-# Virtualization
-#
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_EXT4DEV_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_FS_POSIX_ACL is not set
-# CONFIG_XFS_FS is not set
-# CONFIG_GFS2_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
-CONFIG_INOTIFY_USER=y
-# CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-CONFIG_AUTOFS_FS=y
-CONFIG_AUTOFS4_FS=y
-CONFIG_FUSE_FS=y
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-# CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_PROC_SYSCTL=y
-CONFIG_SYSFS=y
-# CONFIG_TMPFS is not set
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
-CONFIG_NFSD=y
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
-CONFIG_ROOT_NFS=y
-CONFIG_LOCKD=y
-CONFIG_EXPORTFS=y
-CONFIG_NFS_COMMON=y
-CONFIG_SUNRPC=y
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_CIFS is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-# CONFIG_NLS is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=y
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-CONFIG_TRACE_IRQFLAGS_SUPPORT=y
-# CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_FS is not set
-# CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
-CONFIG_CMDLINE="ip=any"
-CONFIG_SYS_SUPPORTS_KGDB=y
-
-#
-# Security options
-#
-CONFIG_KEYS=y
-CONFIG_KEYS_DEBUG_PROC_KEYS=y
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=y
-CONFIG_CRYPTO_NULL=y
-CONFIG_CRYPTO_MD4=y
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=y
-CONFIG_CRYPTO_SHA256=y
-CONFIG_CRYPTO_SHA512=y
-CONFIG_CRYPTO_WP512=y
-CONFIG_CRYPTO_TGR192=y
-CONFIG_CRYPTO_GF128MUL=y
-CONFIG_CRYPTO_ECB=y
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_PCBC=y
-CONFIG_CRYPTO_LRW=y
-CONFIG_CRYPTO_DES=y
-CONFIG_CRYPTO_FCRYPT=y
-CONFIG_CRYPTO_BLOWFISH=y
-CONFIG_CRYPTO_TWOFISH=y
-CONFIG_CRYPTO_TWOFISH_COMMON=y
-CONFIG_CRYPTO_SERPENT=y
-CONFIG_CRYPTO_AES=y
-CONFIG_CRYPTO_CAST5=y
-CONFIG_CRYPTO_CAST6=y
-CONFIG_CRYPTO_TEA=y
-CONFIG_CRYPTO_ARC4=y
-CONFIG_CRYPTO_KHAZAD=y
-CONFIG_CRYPTO_ANUBIS=y
-CONFIG_CRYPTO_DEFLATE=y
-CONFIG_CRYPTO_MICHAEL_MIC=y
-CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_CAMELLIA=y
-
-#
-# Hardware crypto devices
-#
-
-#
-# Library routines
-#
-CONFIG_BITREVERSE=y
-# CONFIG_CRC_CCITT is not set
-CONFIG_CRC16=y
-CONFIG_CRC32=y
-CONFIG_LIBCRC32C=y
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_PLIST=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
index d6e3fffbc80da3c67ebaca1462532cd7e02b5921..2fb350432669e0d8aa667c5e6995dd6acde617d1 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_MACH_DECSTATION=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 78f5004fb721fe916cbe5711b5a971496a3e3781..5467d750b6ebe1a48ba00d0173e2684c4bbdf6d0 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 CONFIG_MACH_VR41XX=y
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index b29bff0f56c39737088a341c4fdf9db0b9459e8f..d73d965f7615021f50e2af1d6e67128f3d4eae12 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 69810592aa6b28e4870eeeeb3fbdbf2c63b4602b..17a866057fd49a888f077851cd70294b3656d97f 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_BASLER_EXCITE=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 6ab94d8cf08beeffe68afca6b2ef3a7312e09877..4ef39a0527cc2a92e1ac8c432f8f10dc5bc6bc16 100644 (file)
@@ -19,10 +19,8 @@ CONFIG_LEMOTE_FULONG=y
 # CONFIG_MIPS_SEAD is not set
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_OCELOT is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 405c9f505a77cea181ab644806eba8f0516b7d85..934d8a0089365079eb90f31ceff1144c8422330f 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index a9dcbcf563cb6d89a44eaedc449de3ad288f0c33..eb35f7518d06a5cc080d5327e88fbe52ca7e892e 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index a040459bec11f04d75b70767888b2ce3ab8194dd..47f49b60c5d631fe738407b324c7a76c4de761e9 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 8a0b4ac5283df2c9c0e951db2b3385e3c06e0300..fa655e247eccfde5af1c18d65821d798d2d3dfc3 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_MACH_JAZZ=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 9a25e770abd82810db718eaf88d6fa70fb04c7c3..95a72d2750ef36ce0d246553aa9d2c3af87ce492 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 546cb243fd09af64255ca9ea51db2b9d9f86ffb4..fbfa5685887cfa31b9b0065a1f2bfaf5edaa347c 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_MIPS_MALTA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 6abad6f883132511646012b577c384bd2918ea2a..86dcb74643539efc13445768d398a0b146422a8d 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 CONFIG_MIPS_SIM=y
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 4981ce425d82c60159b4a93c095b2b81044b4fb9..239810b6c88d9bd1305ce5e591ac0f191ae17b8a 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 CONFIG_MACH_VR41XX=y
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index adca5f7ba533976c2d16b9868017844158e61af8..69278999c9a20eb897d0996fe2c2b864f738bf30 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 CONFIG_PMC_MSP=y
 # CONFIG_PMC_YOSEMITE is not set
diff --git a/arch/mips/configs/ocelot_defconfig b/arch/mips/configs/ocelot_defconfig
deleted file mode 100644 (file)
index e1db1fb..0000000
+++ /dev/null
@@ -1,919 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.20
-# Tue Feb 20 21:47:36 2007
-#
-CONFIG_MIPS=y
-
-#
-# Machine selection
-#
-CONFIG_ZONE_DMA=y
-# CONFIG_MIPS_MTX1 is not set
-# CONFIG_MIPS_BOSPORUS is not set
-# CONFIG_MIPS_PB1000 is not set
-# CONFIG_MIPS_PB1100 is not set
-# CONFIG_MIPS_PB1500 is not set
-# CONFIG_MIPS_PB1550 is not set
-# CONFIG_MIPS_PB1200 is not set
-# CONFIG_MIPS_DB1000 is not set
-# CONFIG_MIPS_DB1100 is not set
-# CONFIG_MIPS_DB1500 is not set
-# CONFIG_MIPS_DB1550 is not set
-# CONFIG_MIPS_DB1200 is not set
-# CONFIG_MIPS_MIRAGE is not set
-# CONFIG_BASLER_EXCITE is not set
-# CONFIG_MIPS_COBALT is not set
-# CONFIG_MACH_DECSTATION is not set
-# CONFIG_MACH_JAZZ is not set
-# CONFIG_MIPS_ATLAS is not set
-# CONFIG_MIPS_MALTA is not set
-# CONFIG_MIPS_SEAD is not set
-# CONFIG_WR_PPMC is not set
-# CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_JAGUAR_ATX is not set
-CONFIG_MOMENCO_OCELOT=y
-# CONFIG_MOMENCO_OCELOT_G is not set
-# CONFIG_MIPS_XXS1500 is not set
-# CONFIG_PNX8550_JBS is not set
-# CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
-# CONFIG_MACH_VR41XX is not set
-# CONFIG_PMC_YOSEMITE is not set
-# CONFIG_QEMU is not set
-# CONFIG_MARKEINS is not set
-# CONFIG_SGI_IP22 is not set
-# CONFIG_SGI_IP27 is not set
-# CONFIG_SGI_IP32 is not set
-# CONFIG_SIBYTE_BIGSUR is not set
-# CONFIG_SIBYTE_SWARM is not set
-# CONFIG_SIBYTE_SENTOSA is not set
-# CONFIG_SIBYTE_RHONE is not set
-# CONFIG_SIBYTE_CARMEL is not set
-# CONFIG_SIBYTE_PTSWARM is not set
-# CONFIG_SIBYTE_LITTLESUR is not set
-# CONFIG_SIBYTE_CRHINE is not set
-# CONFIG_SIBYTE_CRHONE is not set
-# CONFIG_SNI_RM is not set
-# CONFIG_TOSHIBA_JMR3927 is not set
-# CONFIG_TOSHIBA_RBTX4927 is not set
-# CONFIG_TOSHIBA_RBTX4938 is not set
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-# CONFIG_ARCH_HAS_ILOG2_U32 is not set
-# CONFIG_ARCH_HAS_ILOG2_U64 is not set
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_TIME=y
-CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
-# CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ is not set
-CONFIG_DMA_NONCOHERENT=y
-CONFIG_DMA_NEED_PCI_MAP_STATE=y
-CONFIG_CPU_BIG_ENDIAN=y
-# CONFIG_CPU_LITTLE_ENDIAN is not set
-CONFIG_SYS_SUPPORTS_BIG_ENDIAN=y
-CONFIG_IRQ_CPU=y
-CONFIG_IRQ_CPU_RM7K=y
-CONFIG_MIPS_GT64120=y
-CONFIG_SWAP_IO_SPACE=y
-# CONFIG_SYSCLK_75 is not set
-# CONFIG_SYSCLK_83 is not set
-CONFIG_SYSCLK_100=y
-CONFIG_MIPS_L1_CACHE_SHIFT=5
-
-#
-# CPU selection
-#
-# CONFIG_CPU_MIPS32_R1 is not set
-# CONFIG_CPU_MIPS32_R2 is not set
-# CONFIG_CPU_MIPS64_R1 is not set
-# CONFIG_CPU_MIPS64_R2 is not set
-# CONFIG_CPU_R3000 is not set
-# CONFIG_CPU_TX39XX is not set
-# CONFIG_CPU_VR41XX is not set
-# CONFIG_CPU_R4300 is not set
-# CONFIG_CPU_R4X00 is not set
-# CONFIG_CPU_TX49XX is not set
-# CONFIG_CPU_R5000 is not set
-# CONFIG_CPU_R5432 is not set
-# CONFIG_CPU_R6000 is not set
-# CONFIG_CPU_NEVADA is not set
-# CONFIG_CPU_R8000 is not set
-# CONFIG_CPU_R10000 is not set
-CONFIG_CPU_RM7000=y
-# CONFIG_CPU_RM9000 is not set
-# CONFIG_CPU_SB1 is not set
-CONFIG_SYS_HAS_CPU_RM7000=y
-CONFIG_SYS_SUPPORTS_32BIT_KERNEL=y
-CONFIG_SYS_SUPPORTS_64BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_32BIT_KERNEL=y
-CONFIG_CPU_SUPPORTS_64BIT_KERNEL=y
-
-#
-# Kernel type
-#
-CONFIG_32BIT=y
-# CONFIG_64BIT is not set
-CONFIG_PAGE_SIZE_4KB=y
-# CONFIG_PAGE_SIZE_8KB is not set
-# CONFIG_PAGE_SIZE_16KB is not set
-# CONFIG_PAGE_SIZE_64KB is not set
-CONFIG_BOARD_SCACHE=y
-CONFIG_RM7000_CPU_SCACHE=y
-CONFIG_CPU_HAS_PREFETCH=y
-CONFIG_MIPS_MT_DISABLED=y
-# CONFIG_MIPS_MT_SMP is not set
-# CONFIG_MIPS_MT_SMTC is not set
-# CONFIG_MIPS_VPE_LOADER is not set
-# CONFIG_64BIT_PHYS_ADDR is not set
-CONFIG_CPU_HAS_LLSC=y
-CONFIG_CPU_HAS_SYNC=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_PROBE=y
-CONFIG_CPU_SUPPORTS_HIGHMEM=y
-CONFIG_ARCH_FLATMEM_ENABLE=y
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-CONFIG_ZONE_DMA_FLAG=1
-# CONFIG_HZ_48 is not set
-# CONFIG_HZ_100 is not set
-# CONFIG_HZ_128 is not set
-# CONFIG_HZ_250 is not set
-# CONFIG_HZ_256 is not set
-CONFIG_HZ_1000=y
-# CONFIG_HZ_1024 is not set
-CONFIG_SYS_SUPPORTS_ARBIT_HZ=y
-CONFIG_HZ=1000
-CONFIG_PREEMPT_NONE=y
-# CONFIG_PREEMPT_VOLUNTARY is not set
-# CONFIG_PREEMPT is not set
-# CONFIG_KEXEC is not set
-CONFIG_LOCKDEP_SUPPORT=y
-CONFIG_STACKTRACE_SUPPORT=y
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_SWAP=y
-CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
-CONFIG_SYSVIPC_SYSCTL=y
-# CONFIG_POSIX_MQUEUE is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
-# CONFIG_AUDIT is not set
-# CONFIG_IKCONFIG is not set
-CONFIG_SYSFS_DEPRECATED=y
-CONFIG_RELAY=y
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-CONFIG_SYSCTL=y
-CONFIG_EMBEDDED=y
-CONFIG_SYSCTL_SYSCALL=y
-CONFIG_KALLSYMS=y
-# CONFIG_KALLSYMS_EXTRA_PASS is not set
-# CONFIG_HOTPLUG is not set
-CONFIG_PRINTK=y
-CONFIG_BUG=y
-CONFIG_ELF_CORE=y
-CONFIG_BASE_FULL=y
-CONFIG_FUTEX=y
-CONFIG_EPOLL=y
-CONFIG_SHMEM=y
-CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-CONFIG_RT_MUTEXES=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-# CONFIG_MODULES is not set
-
-#
-# Block layer
-#
-CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-CONFIG_IOSCHED_AS=y
-CONFIG_IOSCHED_DEADLINE=y
-CONFIG_IOSCHED_CFQ=y
-CONFIG_DEFAULT_AS=y
-# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
-# CONFIG_DEFAULT_NOOP is not set
-CONFIG_DEFAULT_IOSCHED="anticipatory"
-
-#
-# Bus options (PCI, PCMCIA, EISA, ISA, TC)
-#
-CONFIG_HW_HAS_PCI=y
-# CONFIG_PCI is not set
-CONFIG_MMU=y
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-
-#
-# PCI Hotplug Support
-#
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_MISC is not set
-CONFIG_TRAD_SIGNALS=y
-
-#
-# Power management options
-#
-CONFIG_PM=y
-# CONFIG_PM_LEGACY is not set
-# CONFIG_PM_DEBUG is not set
-# CONFIG_PM_SYSFS_DEPRECATED is not set
-
-#
-# Networking
-#
-CONFIG_NET=y
-
-#
-# Networking options
-#
-# CONFIG_NETDEBUG is not set
-# CONFIG_PACKET is not set
-CONFIG_UNIX=y
-CONFIG_XFRM=y
-CONFIG_XFRM_USER=y
-# CONFIG_XFRM_SUB_POLICY is not set
-CONFIG_XFRM_MIGRATE=y
-CONFIG_NET_KEY=y
-CONFIG_NET_KEY_MIGRATE=y
-CONFIG_INET=y
-# CONFIG_IP_MULTICAST is not set
-# CONFIG_IP_ADVANCED_ROUTER is not set
-CONFIG_IP_FIB_HASH=y
-CONFIG_IP_PNP=y
-# CONFIG_IP_PNP_DHCP is not set
-CONFIG_IP_PNP_BOOTP=y
-# CONFIG_IP_PNP_RARP is not set
-# CONFIG_NET_IPIP is not set
-# CONFIG_NET_IPGRE is not set
-# CONFIG_ARPD is not set
-# CONFIG_SYN_COOKIES is not set
-# CONFIG_INET_AH is not set
-# CONFIG_INET_ESP is not set
-# CONFIG_INET_IPCOMP is not set
-# CONFIG_INET_XFRM_TUNNEL is not set
-# CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=y
-CONFIG_INET_XFRM_MODE_TUNNEL=y
-CONFIG_INET_XFRM_MODE_BEET=y
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
-# CONFIG_TCP_CONG_ADVANCED is not set
-CONFIG_TCP_CONG_CUBIC=y
-CONFIG_DEFAULT_TCP_CONG="cubic"
-CONFIG_TCP_MD5SIG=y
-# CONFIG_IPV6 is not set
-# CONFIG_INET6_XFRM_TUNNEL is not set
-# CONFIG_INET6_TUNNEL is not set
-CONFIG_NETWORK_SECMARK=y
-# CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
-# CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
-# CONFIG_TIPC is not set
-# CONFIG_ATM is not set
-# CONFIG_BRIDGE is not set
-# CONFIG_VLAN_8021Q is not set
-# CONFIG_DECNET is not set
-# CONFIG_LLC2 is not set
-# CONFIG_IPX is not set
-# CONFIG_ATALK is not set
-# CONFIG_X25 is not set
-# CONFIG_LAPB 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
-
-#
-# Network testing
-#
-# CONFIG_NET_PKTGEN is not set
-# CONFIG_HAMRADIO is not set
-# CONFIG_IRDA is not set
-# CONFIG_BT is not set
-CONFIG_IEEE80211=y
-# CONFIG_IEEE80211_DEBUG is not set
-CONFIG_IEEE80211_CRYPT_WEP=y
-CONFIG_IEEE80211_CRYPT_CCMP=y
-CONFIG_IEEE80211_SOFTMAC=y
-# CONFIG_IEEE80211_SOFTMAC_DEBUG is not set
-CONFIG_WIRELESS_EXT=y
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-CONFIG_CONNECTOR=y
-CONFIG_PROC_EVENTS=y
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_RAM is not set
-# CONFIG_BLK_DEV_INITRD is not set
-CONFIG_CDROM_PKTCDVD=y
-CONFIG_CDROM_PKTCDVD_BUFFERS=8
-# CONFIG_CDROM_PKTCDVD_WCACHE is not set
-CONFIG_ATA_OVER_ETH=y
-
-#
-# Misc devices
-#
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-CONFIG_RAID_ATTRS=y
-# CONFIG_SCSI is not set
-# CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
-# CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-# CONFIG_FUSION is not set
-
-#
-# IEEE 1394 (FireWire) support
-#
-
-#
-# I2O device support
-#
-
-#
-# Network device support
-#
-CONFIG_NETDEVICES=y
-# CONFIG_DUMMY is not set
-# CONFIG_BONDING is not set
-# CONFIG_EQUALIZER is not set
-# CONFIG_TUN is not set
-
-#
-# PHY device support
-#
-CONFIG_PHYLIB=y
-
-#
-# MII PHY device drivers
-#
-CONFIG_MARVELL_PHY=y
-CONFIG_DAVICOM_PHY=y
-CONFIG_QSEMI_PHY=y
-CONFIG_LXT_PHY=y
-CONFIG_CICADA_PHY=y
-CONFIG_VITESSE_PHY=y
-CONFIG_SMSC_PHY=y
-# CONFIG_BROADCOM_PHY is not set
-# CONFIG_FIXED_PHY is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
-CONFIG_NET_ETHERNET=y
-# CONFIG_MII is not set
-# CONFIG_DM9000 is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-
-#
-# Ethernet (10000 Mbit)
-#
-
-#
-# Token Ring devices
-#
-
-#
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
-#
-# CONFIG_WAN is not set
-# CONFIG_PPP is not set
-# CONFIG_SLIP is not set
-# CONFIG_SHAPER is not set
-# CONFIG_NETCONSOLE is not set
-# CONFIG_NETPOLL is not set
-# CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
-# CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-# CONFIG_INPUT_FF_MEMLESS is not set
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input Device Drivers
-#
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Hardware I/O ports
-#
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_LIBPS2 is not set
-CONFIG_SERIO_RAW=y
-# CONFIG_GAMEPORT is not set
-
-#
-# Character devices
-#
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-CONFIG_VT_HW_CONSOLE_BINDING=y
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-CONFIG_SERIAL_8250=y
-CONFIG_SERIAL_8250_CONSOLE=y
-CONFIG_SERIAL_8250_NR_UARTS=4
-CONFIG_SERIAL_8250_RUNTIME_UARTS=4
-# CONFIG_SERIAL_8250_EXTENDED is not set
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-CONFIG_UNIX98_PTYS=y
-CONFIG_LEGACY_PTYS=y
-CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-# CONFIG_WATCHDOG is not set
-# CONFIG_HW_RANDOM is not set
-# CONFIG_RTC is not set
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-# CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
-# CONFIG_TCG_TPM is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# SPI support
-#
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
-# CONFIG_W1 is not set
-
-#
-# Hardware Monitoring support
-#
-# CONFIG_HWMON is not set
-# CONFIG_HWMON_VID is not set
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
-
-#
-# Graphics support
-#
-# CONFIG_FIRMWARE_EDID is not set
-# CONFIG_FB is not set
-
-#
-# Console display driver support
-#
-# CONFIG_VGA_CONSOLE is not set
-CONFIG_DUMMY_CONSOLE=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
-# CONFIG_HID is not set
-
-#
-# USB support
-#
-# CONFIG_USB_ARCH_HAS_HCD is not set
-# CONFIG_USB_ARCH_HAS_OHCI is not set
-# CONFIG_USB_ARCH_HAS_EHCI is not set
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
-# CONFIG_MMC is not set
-
-#
-# LED devices
-#
-# CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
-# CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# Auxiliary Display support
-#
-
-#
-# Virtualization
-#
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_EXT4DEV_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-CONFIG_FS_POSIX_ACL=y
-# CONFIG_XFS_FS is not set
-# CONFIG_GFS2_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
-CONFIG_INOTIFY_USER=y
-# CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-CONFIG_FUSE_FS=y
-CONFIG_GENERIC_ACL=y
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-# CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_PROC_SYSCTL=y
-CONFIG_SYSFS=y
-CONFIG_TMPFS=y
-CONFIG_TMPFS_POSIX_ACL=y
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-CONFIG_CONFIGFS_FS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_ECRYPT_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Network File Systems
-#
-CONFIG_NFS_FS=y
-# CONFIG_NFS_V3 is not set
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
-CONFIG_NFSD=y
-# CONFIG_NFSD_V3 is not set
-# CONFIG_NFSD_TCP is not set
-CONFIG_ROOT_NFS=y
-CONFIG_LOCKD=y
-CONFIG_EXPORTFS=y
-CONFIG_NFS_COMMON=y
-CONFIG_SUNRPC=y
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
-# CONFIG_SMB_FS is not set
-# CONFIG_CIFS is not set
-# CONFIG_NCP_FS is not set
-# CONFIG_CODA_FS is not set
-# CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-# CONFIG_NLS is not set
-
-#
-# Distributed Lock Manager
-#
-CONFIG_DLM=y
-CONFIG_DLM_TCP=y
-# CONFIG_DLM_SCTP is not set
-# CONFIG_DLM_DEBUG is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-CONFIG_TRACE_IRQFLAGS_SUPPORT=y
-# CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_FS is not set
-# CONFIG_HEADERS_CHECK is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-CONFIG_CROSSCOMPILE=y
-CONFIG_CMDLINE=""
-CONFIG_SYS_SUPPORTS_KGDB=y
-
-#
-# Security options
-#
-CONFIG_KEYS=y
-CONFIG_KEYS_DEBUG_PROC_KEYS=y
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-CONFIG_CRYPTO=y
-CONFIG_CRYPTO_ALGAPI=y
-CONFIG_CRYPTO_BLKCIPHER=y
-CONFIG_CRYPTO_HASH=y
-CONFIG_CRYPTO_MANAGER=y
-CONFIG_CRYPTO_HMAC=y
-CONFIG_CRYPTO_XCBC=y
-CONFIG_CRYPTO_NULL=y
-CONFIG_CRYPTO_MD4=y
-CONFIG_CRYPTO_MD5=y
-CONFIG_CRYPTO_SHA1=y
-CONFIG_CRYPTO_SHA256=y
-CONFIG_CRYPTO_SHA512=y
-CONFIG_CRYPTO_WP512=y
-CONFIG_CRYPTO_TGR192=y
-CONFIG_CRYPTO_GF128MUL=y
-CONFIG_CRYPTO_ECB=y
-CONFIG_CRYPTO_CBC=y
-CONFIG_CRYPTO_PCBC=y
-CONFIG_CRYPTO_LRW=y
-CONFIG_CRYPTO_DES=y
-CONFIG_CRYPTO_FCRYPT=y
-CONFIG_CRYPTO_BLOWFISH=y
-CONFIG_CRYPTO_TWOFISH=y
-CONFIG_CRYPTO_TWOFISH_COMMON=y
-CONFIG_CRYPTO_SERPENT=y
-CONFIG_CRYPTO_AES=y
-CONFIG_CRYPTO_CAST5=y
-CONFIG_CRYPTO_CAST6=y
-CONFIG_CRYPTO_TEA=y
-CONFIG_CRYPTO_ARC4=y
-CONFIG_CRYPTO_KHAZAD=y
-CONFIG_CRYPTO_ANUBIS=y
-CONFIG_CRYPTO_DEFLATE=y
-CONFIG_CRYPTO_MICHAEL_MIC=y
-CONFIG_CRYPTO_CRC32C=y
-CONFIG_CRYPTO_CAMELLIA=y
-
-#
-# Hardware crypto devices
-#
-
-#
-# Library routines
-#
-CONFIG_BITREVERSE=y
-# CONFIG_CRC_CCITT is not set
-CONFIG_CRC16=y
-CONFIG_CRC32=y
-CONFIG_LIBCRC32C=y
-CONFIG_ZLIB_INFLATE=y
-CONFIG_ZLIB_DEFLATE=y
-CONFIG_PLIST=y
-CONFIG_HAS_IOMEM=y
-CONFIG_HAS_IOPORT=y
index 0028aef0af9d06992e2a64bc4e5f0122e547ddd7..d53fa8f8e099ef507e30018a74047954365665e7 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_PB1100=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 8a1d5888739c8c90363936a6e98d86d1e1a3279a..dc4aa0c6684795e3a36e199f205a56ebd095445d 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_PB1500=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 5581ad2ca411b6fac7e06c7014726239e184b24c..24428e13002b09da34b9c1312231387bb3f7a43a 100644 (file)
@@ -33,12 +33,9 @@ CONFIG_MIPS_PB1550=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 821c1cee5639a83c0966a5227af3617d342b11e3..f6906b069e0499f4e14fd8287320b772f72b6032 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 CONFIG_PNX8550_JBS=y
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 0e8bd92b38cf27af12e6bb1863f4b337d58641d6..b741f81696fbb2d58722ea2c2c4f60ecba3509bc 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 CONFIG_PNX8550_STB810=y
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 703de002e37213eb0cb62dcdec353fb55e272d55..b3caf5125c1504616771f110178d0f44f8667cbd 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 CONFIG_QEMU=y
index 20a38526d4830ce949d283de9cf43bc53bdfeef8..9913980add214f5eb25b3177a94d2efec2b831fa 100644 (file)
@@ -30,11 +30,9 @@ CONFIG_MIPS=y
 # CONFIG_MIPS_SEAD is not set
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_OCELOT is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 5dbb250f71c7e2ed1b0ef10fab93b19c0c586e23..40453cd7c70efc39acb8cdf4f4da7f9dd968e8d3 100644 (file)
@@ -20,10 +20,8 @@ CONFIG_ZONE_DMA=y
 # CONFIG_MIPS_SEAD is not set
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
-# CONFIG_MOMENCO_OCELOT is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_MSP is not set
 # CONFIG_PMC_YOSEMITE is not set
index a5dc5cb97aae69d92f70a699761cbed4d78578b9..fc388118b1140af7efb0a2f04eaf7f2874f7faa5 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 98a91409225811b25486540f121421c896435cfc..e72fdf36b3fe82c8095e6e2878405c2426313176 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 69c08b24c82af37b9d443f56591a8c9e293ad1e9..2b6282d132a857715bbdd6f0aa830a3c6b7644c3 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_MIPS_SEAD=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 5d4fc0e4f72916e633473a784662920cc773639f..e9f2cef4c716b8f93da0991bbffbbe051eb3a91c 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 CONFIG_MACH_VR41XX=y
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 1b92b48de0511dfaf120e86b711bec728c88fda7..aea67568842a65a8aa27764f32ef7f10c965b7be 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 CONFIG_MACH_VR41XX=y
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 5b77c7a5d83aec7f1e24d00505bcd3bd61e1f232..66383ecff20034eb2baf9b0bfb2b7b6b684c3280 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 CONFIG_MACH_VR41XX=y
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index 94a4f94a8b244f4c64818454f1b1cf10af6bd817..db6fd4f157190435d390348314faa435cc5fd41a 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 CONFIG_MACH_VR41XX=y
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index e38bd9b0eadc2dd909240114605915f4fa9daa41..7e410e10fed77ff5f7283608bfe8e29815b2d099 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 CONFIG_WR_PPMC=y
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
index f342d8c887b800729fd5b6f4bb301798c593f7c9..acaf0e21bb00b5817b57036d79a2047f33c7a08d 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 CONFIG_PMC_YOSEMITE=y
 # CONFIG_QEMU is not set
diff --git a/arch/mips/ddb5xxx/Kconfig b/arch/mips/ddb5xxx/Kconfig
deleted file mode 100644 (file)
index e9b5de4..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-config DDB5477_BUS_FREQUENCY
-       int "bus frequency (in kHZ, 0 for auto-detect)"
-       depends on DDB5477
-       default 0
diff --git a/arch/mips/ddb5xxx/common/Makefile b/arch/mips/ddb5xxx/common/Makefile
deleted file mode 100644 (file)
index bc44e30..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the common code of NEC DDB-Vrc5xxx board
-#
-
-obj-y   += nile4.o prom.o rtc_ds1386.o
diff --git a/arch/mips/ddb5xxx/common/nile4.c b/arch/mips/ddb5xxx/common/nile4.c
deleted file mode 100644 (file)
index 7ec7d90..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-/*
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * arch/mips/ddb5xxx/common/nile4.c
- *     misc low-level routines for vrc-5xxx controllers.
- *
- * derived from original code by Geert Uytterhoeven <geert@sonycom.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#include <linux/types.h>
-#include <linux/kernel.h>
-
-#include <asm/ddb5xxx/ddb5xxx.h>
-
-u32
-ddb_calc_pdar(u32 phys, u32 size, int width,
-             int on_memory_bus, int pci_visible)
-{
-        u32 maskbits;
-        u32 widthbits;
-
-        switch (size) {
-#if 0                           /* We don't support 4 GB yet */
-        case 0x100000000:       /* 4 GB */
-                maskbits = 4;
-                break;
-#endif
-        case 0x80000000:        /* 2 GB */
-                maskbits = 5;
-                break;
-        case 0x40000000:        /* 1 GB */
-                maskbits = 6;
-                break;
-        case 0x20000000:        /* 512 MB */
-                maskbits = 7;
-                break;
-        case 0x10000000:        /* 256 MB */
-                maskbits = 8;
-                break;
-        case 0x08000000:        /* 128 MB */
-                maskbits = 9;
-                break;
-        case 0x04000000:        /* 64 MB */
-                maskbits = 10;
-                break;
-        case 0x02000000:        /* 32 MB */
-                maskbits = 11;
-                break;
-        case 0x01000000:        /* 16 MB */
-                maskbits = 12;
-                break;
-        case 0x00800000:        /* 8 MB */
-                maskbits = 13;
-                break;
-        case 0x00400000:        /* 4 MB */
-                maskbits = 14;
-                break;
-        case 0x00200000:        /* 2 MB */
-                maskbits = 15;
-                break;
-        case 0:         /* OFF */
-                maskbits = 0;
-                break;
-        default:
-                panic("nile4_set_pdar: unsupported size %p", (void *) size);
-        }
-        switch (width) {
-        case 8:
-                widthbits = 0;
-                break;
-        case 16:
-                widthbits = 1;
-                break;
-        case 32:
-                widthbits = 2;
-                break;
-        case 64:
-                widthbits = 3;
-                break;
-        default:
-                panic("nile4_set_pdar: unsupported width %d", width);
-        }
-
-       return maskbits | (on_memory_bus ? 0x10 : 0) |
-               (pci_visible ? 0x20 : 0) | (widthbits << 6) |
-               (phys & 0xffe00000);
-}
-
-void
-ddb_set_pdar(u32 pdar, u32 phys, u32 size, int width,
-            int on_memory_bus, int pci_visible)
-{
-       u32 temp= ddb_calc_pdar(phys, size, width, on_memory_bus, pci_visible);
-       ddb_out32(pdar, temp);
-       ddb_out32(pdar + 4, 0);
-
-        /*
-         * When programming a PDAR, the register should be read immediately
-         * after writing it. This ensures that address decoders are properly
-         * configured.
-        * [jsun] is this really necessary?
-         */
-        ddb_in32(pdar);
-        ddb_in32(pdar + 4);
-}
-
-/*
- * routines that mess with PCIINITx registers
- */
-
-void ddb_set_pmr(u32 pmr, u32 type, u32 addr, u32 options)
-{
-        switch (type) {
-        case DDB_PCICMD_IACK: /* PCI Interrupt Acknowledge */
-        case DDB_PCICMD_IO:   /* PCI I/O Space */
-        case DDB_PCICMD_MEM:  /* PCI Memory Space */
-        case DDB_PCICMD_CFG:  /* PCI Configuration Space */
-                break;
-        default:
-                panic("nile4_set_pmr: invalid type %d", type);
-        }
-        ddb_out32(pmr, (type << 1) | (addr & 0xffe00000) | options );
-        ddb_out32(pmr + 4, 0);
-}
diff --git a/arch/mips/ddb5xxx/common/prom.c b/arch/mips/ddb5xxx/common/prom.c
deleted file mode 100644 (file)
index 54a857b..0000000
+++ /dev/null
@@ -1,132 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#include <linux/init.h>
-#include <linux/mm.h>
-#include <linux/sched.h>
-#include <linux/bootmem.h>
-
-#include <asm/addrspace.h>
-#include <asm/bootinfo.h>
-#include <asm/ddb5xxx/ddb5xxx.h>
-#include <asm/debug.h>
-
-const char *get_system_type(void)
-{
-       switch (mips_machtype) {
-       case MACH_NEC_DDB5477:          return "NEC DDB Vrc-5477";
-       case MACH_NEC_ROCKHOPPER:       return "NEC Rockhopper";
-       case MACH_NEC_ROCKHOPPERII:     return "NEC RockhopperII";
-       default:                        return "Unknown NEC board";
-       }
-}
-
-#if defined(CONFIG_DDB5477)
-void ddb5477_runtime_detection(void);
-#endif
-
-/* [jsun@junsun.net] PMON passes arguments in C main() style */
-void __init prom_init(void)
-{
-       int argc = fw_arg0;
-       char **arg = (char**) fw_arg1;
-       int i;
-
-       /* if user passes kernel args, ignore the default one */
-       if (argc > 1)
-               arcs_cmdline[0] = '\0';
-
-       /* arg[0] is "g", the rest is boot parameters */
-       for (i = 1; i < argc; i++) {
-               if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
-                   >= sizeof(arcs_cmdline))
-                       break;
-               strcat(arcs_cmdline, arg[i]);
-               strcat(arcs_cmdline, " ");
-       }
-
-       mips_machgroup = MACH_GROUP_NEC_DDB;
-
-#if defined(CONFIG_DDB5477)
-       ddb5477_runtime_detection();
-       add_memory_region(0, board_ram_size, BOOT_MEM_RAM);
-#endif
-}
-
-void __init prom_free_prom_memory(void)
-{
-}
-
-#if defined(CONFIG_DDB5477)
-
-#define DEFAULT_LCS1_BASE 0x19000000
-#define TESTVAL1 'K'
-#define TESTVAL2 'S'
-
-int board_ram_size;
-void ddb5477_runtime_detection(void)
-{
-       volatile char *test_offset;
-       char saved_test_byte;
-
-        /* Determine if this is a DDB5477 board, or a BSB-VR0300
-           base board.  We can tell by checking for the location of
-           the NVRAM.  It lives at the beginning of LCS1 on the DDB5477,
-           and the beginning of LCS1 on the BSB-VR0300 is flash memory.
-           The first 2K of the NVRAM are reserved, so don't we'll poke
-           around just after that.
-         */
-
-       /* We can only use the PCI bus to distinquish between
-          the Rockhopper and RockhopperII backplanes and this must
-          wait until ddb5477_board_init() in setup.c after the 5477
-          is initialized.  So, until then handle
-          both Rockhopper and RockhopperII backplanes as Rockhopper 1
-        */
-
-        test_offset = (char *)KSEG1ADDR(DEFAULT_LCS1_BASE + 0x800);
-        saved_test_byte = *test_offset;
-
-        *test_offset = TESTVAL1;
-        if (*test_offset != TESTVAL1) {
-                /* We couldn't set our test value, so it must not be NVRAM,
-                   so it's a BSB_VR0300 */
-               mips_machtype = MACH_NEC_ROCKHOPPER;
-        } else {
-                /* We may have gotten lucky, and the TESTVAL1 was already
-                   stored at the test location, so we must check a second
-                   test value */
-                *test_offset = TESTVAL2;
-                if (*test_offset != TESTVAL2) {
-                        /* OK, we couldn't set this value either, so it must
-                           definately be a BSB_VR0300 */
-                       mips_machtype = MACH_NEC_ROCKHOPPER;
-                } else {
-                        /* We could change the value twice, so it must be
-                        NVRAM, so it's a DDB_VRC5477 */
-                       mips_machtype = MACH_NEC_DDB5477;
-                }
-        }
-        /* Restore the original byte */
-        *test_offset = saved_test_byte;
-
-       /* before we know a better way, we will trust PMON for getting
-        * RAM size
-        */
-       board_ram_size = 1 << (36 - (ddb_in32(DDB_SDRAM0) & 0xf));
-
-       db_run(printk("DDB run-time detection : %s, %d MB RAM\n",
-                               mips_machtype == MACH_NEC_DDB5477 ?
-                               "DDB5477" : "Rockhopper",
-                               board_ram_size >> 20));
-
-       /* we can't handle ram size > 128 MB */
-       db_assert(board_ram_size <= (128 << 20));
-}
-#endif
diff --git a/arch/mips/ddb5xxx/common/rtc_ds1386.c b/arch/mips/ddb5xxx/common/rtc_ds1386.c
deleted file mode 100644 (file)
index 5dc34da..0000000
+++ /dev/null
@@ -1,170 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * arch/mips/ddb5xxx/common/rtc_ds1386.c
- *     low-level RTC hookups for s for Dallas 1396 chip.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-
-
-/*
- * This file exports a function, rtc_ds1386_init(), which expects an
- * uncached base address as the argument.  It will set the two function
- * pointers expected by the MIPS generic timer code.
- */
-
-#include <linux/types.h>
-#include <linux/time.h>
-#include <linux/bcd.h>
-
-#include <asm/time.h>
-#include <asm/addrspace.h>
-
-#include <asm/mc146818rtc.h>
-#include <asm/debug.h>
-
-#define        EPOCH           2000
-
-#define        READ_RTC(x)     *(volatile unsigned char*)(rtc_base+x)
-#define        WRITE_RTC(x, y) *(volatile unsigned char*)(rtc_base+x) = y
-
-static unsigned long rtc_base;
-
-static unsigned long
-rtc_ds1386_get_time(void)
-{
-       u8 byte;
-       u8 temp;
-       unsigned int year, month, day, hour, minute, second;
-       unsigned long flags;
-
-       spin_lock_irqsave(&rtc_lock, flags);
-       /* let us freeze external registers */
-       byte = READ_RTC(0xB);
-       byte &= 0x3f;
-       WRITE_RTC(0xB, byte);
-
-       /* read time data */
-       year = BCD2BIN(READ_RTC(0xA)) + EPOCH;
-       month = BCD2BIN(READ_RTC(0x9) & 0x1f);
-       day = BCD2BIN(READ_RTC(0x8));
-       minute = BCD2BIN(READ_RTC(0x2));
-       second = BCD2BIN(READ_RTC(0x1));
-
-       /* hour is special - deal with it later */
-       temp = READ_RTC(0x4);
-
-       /* enable time transfer */
-       byte |= 0x80;
-       WRITE_RTC(0xB, byte);
-       spin_unlock_irqrestore(&rtc_lock, flags);
-
-       /* calc hour */
-       if (temp & 0x40) {
-               /* 12 hour format */
-               hour = BCD2BIN(temp & 0x1f);
-               if (temp & 0x20) hour += 12;            /* PM */
-       } else {
-               /* 24 hour format */
-               hour = BCD2BIN(temp & 0x3f);
-       }
-
-       return mktime(year, month, day, hour, minute, second);
-}
-
-static int
-rtc_ds1386_set_time(unsigned long t)
-{
-       struct rtc_time tm;
-       u8 byte;
-       u8 temp;
-       u8 year, month, day, hour, minute, second;
-       unsigned long flags;
-
-       spin_lock_irqsave(&rtc_lock, flags);
-       /* let us freeze external registers */
-       byte = READ_RTC(0xB);
-       byte &= 0x3f;
-       WRITE_RTC(0xB, byte);
-
-       /* convert */
-       to_tm(t, &tm);
-
-
-       /* check each field one by one */
-       year = BIN2BCD(tm.tm_year - EPOCH);
-       if (year != READ_RTC(0xA)) {
-               WRITE_RTC(0xA, year);
-       }
-
-       temp = READ_RTC(0x9);
-       month = BIN2BCD(tm.tm_mon+1);   /* tm_mon starts from 0 to 11 */
-       if (month != (temp & 0x1f)) {
-               WRITE_RTC( 0x9,
-                          (month & 0x1f) | (temp & ~0x1f) );
-       }
-
-       day = BIN2BCD(tm.tm_mday);
-       if (day != READ_RTC(0x8)) {
-               WRITE_RTC(0x8, day);
-       }
-
-       temp = READ_RTC(0x4);
-       if (temp & 0x40) {
-               /* 12 hour format */
-               hour = 0x40;
-               if (tm.tm_hour > 12) {
-                       hour |= 0x20 | (BIN2BCD(hour-12) & 0x1f);
-               } else {
-                       hour |= BIN2BCD(tm.tm_hour);
-               }
-       } else {
-               /* 24 hour format */
-               hour = BIN2BCD(tm.tm_hour) & 0x3f;
-       }
-       if (hour != temp) WRITE_RTC(0x4, hour);
-
-       minute = BIN2BCD(tm.tm_min);
-       if (minute != READ_RTC(0x2)) {
-               WRITE_RTC(0x2, minute);
-       }
-
-       second = BIN2BCD(tm.tm_sec);
-       if (second != READ_RTC(0x1)) {
-               WRITE_RTC(0x1, second);
-       }
-       spin_unlock_irqrestore(&rtc_lock, flags);
-
-       return 0;
-}
-
-void
-rtc_ds1386_init(unsigned long base)
-{
-       unsigned char byte;
-
-       /* remember the base */
-       rtc_base = base;
-       db_assert((rtc_base & 0xe0000000) == KSEG1);
-
-       /* turn on RTC if it is not on */
-       byte = READ_RTC(0x9);
-       if (byte & 0x80) {
-               byte &= 0x7f;
-               WRITE_RTC(0x9, byte);
-       }
-
-       /* enable time transfer */
-       byte = READ_RTC(0xB);
-       byte |= 0x80;
-       WRITE_RTC(0xB, byte);
-
-       /* set the function pointers */
-       rtc_mips_get_time = rtc_ds1386_get_time;
-       rtc_mips_set_time = rtc_ds1386_set_time;
-}
diff --git a/arch/mips/ddb5xxx/ddb5477/Makefile b/arch/mips/ddb5xxx/ddb5477/Makefile
deleted file mode 100644 (file)
index 4864b8a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Makefile for NEC DDB-Vrc5477 board
-#
-
-obj-y                  += ddb5477-platform.o irq.o irq_5477.o setup.o \
-                          lcd44780.o
-
-obj-$(CONFIG_RUNTIME_DEBUG)    += debug.o
-obj-$(CONFIG_KGDB)             += kgdb_io.o
diff --git a/arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c b/arch/mips/ddb5xxx/ddb5477/ddb5477-platform.c
deleted file mode 100644 (file)
index c16020a..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
- */
-#include <linux/init.h>
-#include <linux/module.h>
-#include <linux/serial_8250.h>
-
-#include <asm/ddb5xxx/ddb5477.h>
-
-#define DDB_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
-
-#define DDB5477_PORT(base, int)                                                \
-{                                                                      \
-       .mapbase        = base,                                         \
-       .irq            = int,                                          \
-       .uartclk        = 1843200,                                      \
-       .iotype         = UPIO_MEM,                                     \
-       .flags          = DDB_UART_FLAGS,                               \
-       .regshift       = 3,                                            \
-}
-
-static struct plat_serial8250_port uart8250_data[] = {
-       DDB5477_PORT(0xbfa04200, VRC5477_IRQ_UART0),
-       DDB5477_PORT(0xbfa04240, VRC5477_IRQ_UART1),
-       { },
-};
-
-static struct platform_device uart8250_device = {
-       .name                   = "serial8250",
-       .id                     = PLAT8250_DEV_PLATFORM,
-       .dev                    = {
-               .platform_data  = uart8250_data,
-       },
-};
-
-static int __init uart8250_init(void)
-{
-       return platform_device_register(&uart8250_device);
-}
-
-module_init(uart8250_init);
-
-MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("8250 UART probe driver for the NEC DDB5477");
diff --git a/arch/mips/ddb5xxx/ddb5477/debug.c b/arch/mips/ddb5xxx/ddb5477/debug.c
deleted file mode 100644 (file)
index 68919d5..0000000
+++ /dev/null
@@ -1,160 +0,0 @@
-/***********************************************************************
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * arch/mips/ddb5xxx/ddb5477/debug.c
- *     vrc5477 specific debug routines.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- ***********************************************************************
- */
-
-#include <linux/kernel.h>
-
-#include <asm/mipsregs.h>
-#include <asm/ddb5xxx/ddb5xxx.h>
-
-typedef struct {
-       const char *regname;
-       unsigned regaddr;
-} Register;
-
-void jsun_show_regs(char *name, Register *regs)
-{
-       int i;
-
-       printk("\nshow regs: %s\n", name);
-       for(i=0;regs[i].regname!= NULL; i++) {
-               printk("%-16s= %08x\t\t(@%08x)\n",
-                      regs[i].regname,
-                      *(unsigned *)(regs[i].regaddr),
-                      regs[i].regaddr);
-       }
-}
-
-static Register int_regs[] = {
-       {"DDB_INTCTRL0", DDB_BASE + DDB_INTCTRL0},
-       {"DDB_INTCTRL1", DDB_BASE + DDB_INTCTRL1},
-       {"DDB_INTCTRL2", DDB_BASE + DDB_INTCTRL2},
-       {"DDB_INTCTRL3", DDB_BASE + DDB_INTCTRL3},
-       {"DDB_INT0STAT", DDB_BASE + DDB_INT0STAT},
-       {"DDB_INT1STAT", DDB_BASE + DDB_INT1STAT},
-       {"DDB_INT2STAT", DDB_BASE + DDB_INT2STAT},
-       {"DDB_INT3STAT", DDB_BASE + DDB_INT3STAT},
-       {"DDB_INT4STAT", DDB_BASE + DDB_INT4STAT},
-       {"DDB_NMISTAT", DDB_BASE + DDB_NMISTAT},
-       {"DDB_INTPPES0", DDB_BASE + DDB_INTPPES0},
-       {"DDB_INTPPES1", DDB_BASE + DDB_INTPPES1},
-       {NULL, 0x0}
-};
-
-void vrc5477_show_int_regs()
-{
-       jsun_show_regs("interrupt registers", int_regs);
-       printk("CPU CAUSE = %08x\n", read_c0_cause());
-       printk("CPU STATUS = %08x\n", read_c0_status());
-}
-static Register pdar_regs[] = {
-        {"DDB_SDRAM0", DDB_BASE + DDB_SDRAM0},
-        {"DDB_SDRAM1", DDB_BASE + DDB_SDRAM1},
-        {"DDB_LCS0", DDB_BASE + DDB_LCS0},
-        {"DDB_LCS1", DDB_BASE + DDB_LCS1},
-        {"DDB_LCS2", DDB_BASE + DDB_LCS2},
-        {"DDB_INTCS", DDB_BASE + DDB_INTCS},
-        {"DDB_BOOTCS", DDB_BASE + DDB_BOOTCS},
-        {"DDB_PCIW0", DDB_BASE + DDB_PCIW0},
-        {"DDB_PCIW1", DDB_BASE + DDB_PCIW1},
-        {"DDB_IOPCIW0", DDB_BASE + DDB_IOPCIW0},
-        {"DDB_IOPCIW1", DDB_BASE + DDB_IOPCIW1},
-        {NULL, 0x0}
-};
-void vrc5477_show_pdar_regs(void)
-{
-        jsun_show_regs("PDAR regs", pdar_regs);
-}
-
-static Register bar_regs[] = {
-        {"DDB_BARC0", DDB_BASE + DDB_BARC0},
-        {"DDB_BARM010", DDB_BASE + DDB_BARM010},
-        {"DDB_BARM230", DDB_BASE + DDB_BARM230},
-        {"DDB_BAR00", DDB_BASE + DDB_BAR00},
-        {"DDB_BAR10", DDB_BASE + DDB_BAR10},
-        {"DDB_BAR20", DDB_BASE + DDB_BAR20},
-        {"DDB_BAR30", DDB_BASE + DDB_BAR30},
-        {"DDB_BAR40", DDB_BASE + DDB_BAR40},
-        {"DDB_BAR50", DDB_BASE + DDB_BAR50},
-        {"DDB_BARB0", DDB_BASE + DDB_BARB0},
-        {"DDB_BARC1", DDB_BASE + DDB_BARC1},
-        {"DDB_BARM011", DDB_BASE + DDB_BARM011},
-        {"DDB_BARM231", DDB_BASE + DDB_BARM231},
-        {"DDB_BAR01", DDB_BASE + DDB_BAR01},
-        {"DDB_BAR11", DDB_BASE + DDB_BAR11},
-        {"DDB_BAR21", DDB_BASE + DDB_BAR21},
-        {"DDB_BAR31", DDB_BASE + DDB_BAR31},
-        {"DDB_BAR41", DDB_BASE + DDB_BAR41},
-        {"DDB_BAR51", DDB_BASE + DDB_BAR51},
-        {"DDB_BARB1", DDB_BASE + DDB_BARB1},
-        {NULL, 0x0}
-};
-void vrc5477_show_bar_regs(void)
-{
-        jsun_show_regs("BAR regs", bar_regs);
-}
-
-static Register pci_regs[] = {
-        {"DDB_PCIW0", DDB_BASE + DDB_PCIW0},
-        {"DDB_PCIW1", DDB_BASE + DDB_PCIW1},
-        {"DDB_PCIINIT00", DDB_BASE + DDB_PCIINIT00},
-        {"DDB_PCIINIT10", DDB_BASE + DDB_PCIINIT10},
-        {"DDB_PCICTL0_L", DDB_BASE + DDB_PCICTL0_L},
-        {"DDB_PCICTL0_H", DDB_BASE + DDB_PCICTL0_H},
-        {"DDB_PCIARB0_L", DDB_BASE + DDB_PCIARB0_L},
-        {"DDB_PCIARB0_H", DDB_BASE + DDB_PCIARB0_H},
-        {"DDB_PCISWP0", DDB_BASE + DDB_PCISWP0},
-        {"DDB_PCIERR0", DDB_BASE + DDB_PCIERR0},
-        {"DDB_IOPCIW0", DDB_BASE + DDB_IOPCIW0},
-        {"DDB_IOPCIW1", DDB_BASE + DDB_IOPCIW1},
-        {"DDB_PCIINIT01", DDB_BASE + DDB_PCIINIT01},
-        {"DDB_PCIINIT11", DDB_BASE + DDB_PCIINIT11},
-        {"DDB_PCICTL1_L", DDB_BASE + DDB_PCICTL1_L},
-        {"DDB_PCICTL1_H", DDB_BASE + DDB_PCICTL1_H},
-        {"DDB_PCIARB1_L", DDB_BASE + DDB_PCIARB1_L},
-        {"DDB_PCIARB1_H", DDB_BASE + DDB_PCIARB1_H},
-        {"DDB_PCISWP1", DDB_BASE + DDB_PCISWP1},
-        {"DDB_PCIERR1", DDB_BASE + DDB_PCIERR1},
-        {NULL, 0x0}
-};
-void vrc5477_show_pci_regs(void)
-{
-        jsun_show_regs("PCI regs", pci_regs);
-}
-
-static Register lb_regs[] = {
-        {"DDB_LCNFG", DDB_BASE + DDB_LCNFG},
-        {"DDB_LCST0", DDB_BASE + DDB_LCST0},
-        {"DDB_LCST1", DDB_BASE + DDB_LCST1},
-        {"DDB_LCST2", DDB_BASE + DDB_LCST2},
-        {"DDB_ERRADR", DDB_BASE + DDB_ERRADR},
-        {"DDB_ERRCS", DDB_BASE + DDB_ERRCS},
-        {"DDB_BTM", DDB_BASE + DDB_BTM},
-        {"DDB_BCST", DDB_BASE + DDB_BCST},
-        {NULL, 0x0}
-};
-void vrc5477_show_lb_regs(void)
-{
-        jsun_show_regs("Local Bus regs", lb_regs);
-}
-
-void vrc5477_show_all_regs(void)
-{
-       vrc5477_show_pdar_regs();
-       vrc5477_show_pci_regs();
-       vrc5477_show_bar_regs();
-       vrc5477_show_int_regs();
-       vrc5477_show_lb_regs();
-}
diff --git a/arch/mips/ddb5xxx/ddb5477/irq.c b/arch/mips/ddb5xxx/ddb5477/irq.c
deleted file mode 100644 (file)
index faa4a50..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- *  arch/mips/ddb5xxx/ddb5477/irq.c
- *     The irq setup and misc routines for DDB5476.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#include <linux/init.h>
-#include <linux/interrupt.h>
-#include <linux/irq.h>
-#include <linux/types.h>
-#include <linux/ptrace.h>
-
-#include <asm/i8259.h>
-#include <asm/irq_cpu.h>
-#include <asm/system.h>
-#include <asm/mipsregs.h>
-#include <asm/debug.h>
-#include <asm/addrspace.h>
-#include <asm/bootinfo.h>
-
-#include <asm/ddb5xxx/ddb5xxx.h>
-
-
-/*
- * IRQ mapping
- *
- *  0-7: 8 CPU interrupts
- *     0 -     software interrupt 0
- *     1 -     software interrupt 1
- *     2 -     most Vrc5477 interrupts are routed to this pin
- *     3 -     (optional) some other interrupts routed to this pin for debugg
- *     4 -     not used
- *     5 -     not used
- *     6 -     not used
- *     7 -     cpu timer (used by default)
- *
- *  8-39: 32 Vrc5477 interrupt sources
- *     (refer to the Vrc5477 manual)
- */
-
-#define        PCI0                    DDB_INTPPES0
-#define        PCI1                    DDB_INTPPES1
-
-#define        ACTIVE_LOW              1
-#define        ACTIVE_HIGH             0
-
-#define        LEVEL_SENSE             2
-#define        EDGE_TRIGGER            0
-
-#define        INTA                    0
-#define        INTB                    1
-#define        INTC                    2
-#define        INTD                    3
-#define        INTE                    4
-
-static inline void
-set_pci_int_attr(u32 pci, u32 intn, u32 active, u32 trigger)
-{
-       u32 reg_value;
-       u32 reg_bitmask;
-
-       reg_value = ddb_in32(pci);
-       reg_bitmask = 0x3 << (intn * 2);
-
-       reg_value &= ~reg_bitmask;
-       reg_value |= (active | trigger) << (intn * 2);
-       ddb_out32(pci, reg_value);
-}
-
-extern void vrc5477_irq_init(u32 base);
-static struct irqaction irq_cascade = { no_action, 0, CPU_MASK_NONE, "cascade", NULL, NULL };
-
-void __init arch_init_irq(void)
-{
-       /* by default, we disable all interrupts and route all vrc5477
-        * interrupts to pin 0 (irq 2) */
-       ddb_out32(DDB_INTCTRL0, 0);
-       ddb_out32(DDB_INTCTRL1, 0);
-       ddb_out32(DDB_INTCTRL2, 0);
-       ddb_out32(DDB_INTCTRL3, 0);
-
-       clear_c0_status(0xff00);
-       set_c0_status(0x0400);
-
-       /* setup PCI interrupt attributes */
-       set_pci_int_attr(PCI0, INTA, ACTIVE_LOW, LEVEL_SENSE);
-       set_pci_int_attr(PCI0, INTB, ACTIVE_LOW, LEVEL_SENSE);
-       if (mips_machtype == MACH_NEC_ROCKHOPPERII)
-               set_pci_int_attr(PCI0, INTC, ACTIVE_HIGH, LEVEL_SENSE);
-       else
-               set_pci_int_attr(PCI0, INTC, ACTIVE_LOW, LEVEL_SENSE);
-       set_pci_int_attr(PCI0, INTD, ACTIVE_LOW, LEVEL_SENSE);
-       set_pci_int_attr(PCI0, INTE, ACTIVE_LOW, LEVEL_SENSE);
-
-       set_pci_int_attr(PCI1, INTA, ACTIVE_LOW, LEVEL_SENSE);
-       set_pci_int_attr(PCI1, INTB, ACTIVE_LOW, LEVEL_SENSE);
-       set_pci_int_attr(PCI1, INTC, ACTIVE_LOW, LEVEL_SENSE);
-       set_pci_int_attr(PCI1, INTD, ACTIVE_LOW, LEVEL_SENSE);
-       set_pci_int_attr(PCI1, INTE, ACTIVE_LOW, LEVEL_SENSE);
-
-       /*
-        * for debugging purpose, we enable several error interrupts
-        * and route them to pin 1. (IP3)
-        */
-       /* cpu parity check - 0 */
-       ll_vrc5477_irq_route(0, 1); ll_vrc5477_irq_enable(0);
-       /* cpu no-target decode - 1 */
-       ll_vrc5477_irq_route(1, 1); ll_vrc5477_irq_enable(1);
-       /* local bus read time-out - 7 */
-       ll_vrc5477_irq_route(7, 1); ll_vrc5477_irq_enable(7);
-       /* PCI SERR# - 14 */
-       ll_vrc5477_irq_route(14, 1); ll_vrc5477_irq_enable(14);
-       /* PCI internal error - 15 */
-       ll_vrc5477_irq_route(15, 1); ll_vrc5477_irq_enable(15);
-       /* IOPCI SERR# - 30 */
-       ll_vrc5477_irq_route(30, 1); ll_vrc5477_irq_enable(30);
-       /* IOPCI internal error - 31 */
-       ll_vrc5477_irq_route(31, 1); ll_vrc5477_irq_enable(31);
-
-       /* init all controllers */
-       init_i8259_irqs();
-       mips_cpu_irq_init();
-       vrc5477_irq_init(VRC5477_IRQ_BASE);
-
-
-       /* setup cascade interrupts */
-       setup_irq(VRC5477_IRQ_BASE + VRC5477_I8259_CASCADE, &irq_cascade);
-       setup_irq(CPU_IRQ_BASE + CPU_VRC5477_CASCADE, &irq_cascade);
-}
-
-u8 i8259_interrupt_ack(void)
-{
-       u8 irq;
-       u32 reg;
-
-       /* Set window 0 for interrupt acknowledge */
-       reg = ddb_in32(DDB_PCIINIT10);
-
-       ddb_set_pmr(DDB_PCIINIT10, DDB_PCICMD_IACK, 0, DDB_PCI_ACCESS_32);
-       irq = *(volatile u8 *) KSEG1ADDR(DDB_PCI_IACK_BASE);
-       ddb_out32(DDB_PCIINIT10, reg);
-
-       return irq;
-}
-/*
- * the first level int-handler will jump here if it is a vrc5477 irq
- */
-#define        NUM_5477_IRQS   32
-static void vrc5477_irq_dispatch(void)
-{
-       u32 intStatus;
-       u32 bitmask;
-       u32 i;
-
-       db_assert(ddb_in32(DDB_INT2STAT) == 0);
-       db_assert(ddb_in32(DDB_INT3STAT) == 0);
-       db_assert(ddb_in32(DDB_INT4STAT) == 0);
-       db_assert(ddb_in32(DDB_NMISTAT) == 0);
-
-       if (ddb_in32(DDB_INT1STAT) != 0) {
-#if defined(CONFIG_RUNTIME_DEBUG)
-               vrc5477_show_int_regs();
-#endif
-               panic("error interrupt has happened.");
-       }
-
-       intStatus = ddb_in32(DDB_INT0STAT);
-
-       if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
-               /* check for i8259 interrupts */
-               if (intStatus & (1 << VRC5477_I8259_CASCADE)) {
-                       int i8259_irq = i8259_interrupt_ack();
-                       do_IRQ(i8259_irq);
-                       return;
-               }
-       }
-
-       for (i=0, bitmask=1; i<= NUM_5477_IRQS; bitmask <<=1, i++) {
-               /* do we need to "and" with the int mask? */
-               if (intStatus & bitmask) {
-                       do_IRQ(VRC5477_IRQ_BASE + i);
-                       return;
-               }
-       }
-}
-
-#define VR5477INTS (STATUSF_IP2|STATUSF_IP3|STATUSF_IP4|STATUSF_IP5|STATUSF_IP6)
-
-asmlinkage void plat_irq_dispatch(void)
-{
-       unsigned int pending = read_c0_cause() & read_c0_status() & ST0_IM;
-
-       if (pending & STATUSF_IP7)
-               do_IRQ(CPU_IRQ_BASE + 7);
-       else if (pending & VR5477INTS)
-               vrc5477_irq_dispatch();
-       else if (pending & STATUSF_IP0)
-               do_IRQ(CPU_IRQ_BASE);
-       else if (pending & STATUSF_IP1)
-               do_IRQ(CPU_IRQ_BASE + 1);
-       else
-               spurious_interrupt();
-}
diff --git a/arch/mips/ddb5xxx/ddb5477/irq_5477.c b/arch/mips/ddb5xxx/ddb5477/irq_5477.c
deleted file mode 100644 (file)
index 98c3b15..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- *  arch/mips/ddb5xxx/ddb5477/irq_5477.c
- *     This file defines the irq handler for Vrc5477.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-/*
- * Vrc5477 defines 32 IRQs.
- *
- * This file exports one function:
- *     vrc5477_irq_init(u32 irq_base);
- */
-
-#include <linux/interrupt.h>
-#include <linux/types.h>
-#include <linux/ptrace.h>
-
-#include <asm/debug.h>
-
-#include <asm/ddb5xxx/ddb5xxx.h>
-
-/* number of total irqs supported by Vrc5477 */
-#define        NUM_5477_IRQ            32
-
-static int vrc5477_irq_base = -1;
-
-
-static void
-vrc5477_irq_enable(unsigned int irq)
-{
-       db_assert(vrc5477_irq_base != -1);
-       db_assert(irq >= vrc5477_irq_base);
-       db_assert(irq < vrc5477_irq_base+ NUM_5477_IRQ);
-
-       ll_vrc5477_irq_enable(irq - vrc5477_irq_base);
-}
-
-static void
-vrc5477_irq_disable(unsigned int irq)
-{
-       db_assert(vrc5477_irq_base != -1);
-       db_assert(irq >= vrc5477_irq_base);
-       db_assert(irq < vrc5477_irq_base + NUM_5477_IRQ);
-
-       ll_vrc5477_irq_disable(irq - vrc5477_irq_base);
-}
-
-static void
-vrc5477_irq_ack(unsigned int irq)
-{
-       db_assert(vrc5477_irq_base != -1);
-       db_assert(irq >= vrc5477_irq_base);
-       db_assert(irq < vrc5477_irq_base+ NUM_5477_IRQ);
-
-       /* clear the interrupt bit */
-       /* some irqs require the driver to clear the sources */
-       ddb_out32(DDB_INTCLR32, 1 << (irq - vrc5477_irq_base));
-
-       /* disable interrupt - some handler will re-enable the irq
-        * and if the interrupt is leveled, we will have infinite loop
-        */
-       ll_vrc5477_irq_disable(irq - vrc5477_irq_base);
-}
-
-static void
-vrc5477_irq_end(unsigned int irq)
-{
-       db_assert(vrc5477_irq_base != -1);
-       db_assert(irq >= vrc5477_irq_base);
-       db_assert(irq < vrc5477_irq_base + NUM_5477_IRQ);
-
-       if(!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-               ll_vrc5477_irq_enable( irq - vrc5477_irq_base);
-}
-
-struct irq_chip vrc5477_irq_controller = {
-       .name = "vrc5477_irq",
-       .ack = vrc5477_irq_ack,
-       .mask = vrc5477_irq_disable,
-       .mask_ack = vrc5477_irq_ack,
-       .unmask = vrc5477_irq_enable,
-       .end = vrc5477_irq_end
-};
-
-void __init vrc5477_irq_init(u32 irq_base)
-{
-       u32 i;
-
-       for (i= irq_base; i< irq_base+ NUM_5477_IRQ; i++)
-               set_irq_chip(i, &vrc5477_irq_controller);
-
-       vrc5477_irq_base = irq_base;
-}
-
-void ll_vrc5477_irq_route(int vrc5477_irq, int ip)
-{
-       u32 reg_value;
-       u32 reg_bitmask;
-       u32 reg_index;
-
-       db_assert(vrc5477_irq >= 0);
-       db_assert(vrc5477_irq < NUM_5477_IRQ);
-       db_assert(ip >= 0);
-       db_assert((ip < 5) || (ip == 6));
-
-       reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
-       reg_value = ddb_in32(reg_index);
-       reg_bitmask = 7 << (vrc5477_irq % 8 * 4);
-       reg_value &= ~reg_bitmask;
-       reg_value |= ip << (vrc5477_irq % 8 * 4);
-       ddb_out32(reg_index, reg_value);
-}
-
-void ll_vrc5477_irq_enable(int vrc5477_irq)
-{
-       u32 reg_value;
-       u32 reg_bitmask;
-       u32 reg_index;
-
-       db_assert(vrc5477_irq >= 0);
-       db_assert(vrc5477_irq < NUM_5477_IRQ);
-
-       reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
-       reg_value = ddb_in32(reg_index);
-       reg_bitmask = 8 << (vrc5477_irq % 8 * 4);
-       db_assert((reg_value & reg_bitmask) == 0);
-       ddb_out32(reg_index, reg_value | reg_bitmask);
-}
-
-void ll_vrc5477_irq_disable(int vrc5477_irq)
-{
-       u32 reg_value;
-       u32 reg_bitmask;
-       u32 reg_index;
-
-       db_assert(vrc5477_irq >= 0);
-       db_assert(vrc5477_irq < NUM_5477_IRQ);
-
-       reg_index = DDB_INTCTRL0 + vrc5477_irq/8*4;
-       reg_value = ddb_in32(reg_index);
-       reg_bitmask = 8 << (vrc5477_irq % 8 * 4);
-
-       /* we assert that the interrupt is enabled (perhaps over-zealous) */
-       db_assert( (reg_value & reg_bitmask) != 0);
-       ddb_out32(reg_index, reg_value & ~reg_bitmask);
-}
diff --git a/arch/mips/ddb5xxx/ddb5477/kgdb_io.c b/arch/mips/ddb5xxx/ddb5477/kgdb_io.c
deleted file mode 100644 (file)
index 385bbdb..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * kgdb io functions for DDB5477.  We use the second serial port (upper one).
- *
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-/* ======================= CONFIG ======================== */
-
-/* [jsun] we use the second serial port for kdb */
-#define         BASE                    0xbfa04240
-#define         MAX_BAUD                115200
-
-/* distance in bytes between two serial registers */
-#define         REG_OFFSET              8
-
-/*
- * 0 - kgdb does serial init
- * 1 - kgdb skip serial init
- */
-static int remoteDebugInitialized = 0;
-
-/*
- * the default baud rate *if* kgdb does serial init
- */
-#define                BAUD_DEFAULT            UART16550_BAUD_38400
-
-/* ======================= END OF CONFIG ======================== */
-
-typedef unsigned char uint8;
-typedef unsigned int uint32;
-
-#define         UART16550_BAUD_2400             2400
-#define         UART16550_BAUD_4800             4800
-#define         UART16550_BAUD_9600             9600
-#define         UART16550_BAUD_19200            19200
-#define         UART16550_BAUD_38400            38400
-#define         UART16550_BAUD_57600            57600
-#define         UART16550_BAUD_115200           115200
-
-#define         UART16550_PARITY_NONE           0
-#define         UART16550_PARITY_ODD            0x08
-#define         UART16550_PARITY_EVEN           0x18
-#define         UART16550_PARITY_MARK           0x28
-#define         UART16550_PARITY_SPACE          0x38
-
-#define         UART16550_DATA_5BIT             0x0
-#define         UART16550_DATA_6BIT             0x1
-#define         UART16550_DATA_7BIT             0x2
-#define         UART16550_DATA_8BIT             0x3
-
-#define         UART16550_STOP_1BIT             0x0
-#define         UART16550_STOP_2BIT             0x4
-
-/* register offset */
-#define         OFS_RCV_BUFFER          0
-#define         OFS_TRANS_HOLD          0
-#define         OFS_SEND_BUFFER         0
-#define         OFS_INTR_ENABLE         (1*REG_OFFSET)
-#define         OFS_INTR_ID             (2*REG_OFFSET)
-#define         OFS_DATA_FORMAT         (3*REG_OFFSET)
-#define         OFS_LINE_CONTROL        (3*REG_OFFSET)
-#define         OFS_MODEM_CONTROL       (4*REG_OFFSET)
-#define         OFS_RS232_OUTPUT        (4*REG_OFFSET)
-#define         OFS_LINE_STATUS         (5*REG_OFFSET)
-#define         OFS_MODEM_STATUS        (6*REG_OFFSET)
-#define         OFS_RS232_INPUT         (6*REG_OFFSET)
-#define         OFS_SCRATCH_PAD         (7*REG_OFFSET)
-
-#define         OFS_DIVISOR_LSB         (0*REG_OFFSET)
-#define         OFS_DIVISOR_MSB         (1*REG_OFFSET)
-
-
-/* memory-mapped read/write of the port */
-#define         UART16550_READ(y)    (*((volatile uint8*)(BASE + y)))
-#define         UART16550_WRITE(y, z)  ((*((volatile uint8*)(BASE + y))) = z)
-
-void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
-{
-        /* disable interrupts */
-        UART16550_WRITE(OFS_INTR_ENABLE, 0);
-
-        /* set up baud rate */
-        {
-                uint32 divisor;
-
-                /* set DIAB bit */
-                UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
-
-                /* set divisor */
-                divisor = MAX_BAUD / baud;
-                UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
-                UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
-
-                /* clear DIAB bit */
-                UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
-        }
-
-        /* set data format */
-        UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
-}
-
-
-uint8 getDebugChar(void)
-{
-        if (!remoteDebugInitialized) {
-                remoteDebugInitialized = 1;
-                debugInit(BAUD_DEFAULT,
-                          UART16550_DATA_8BIT,
-                          UART16550_PARITY_NONE, UART16550_STOP_1BIT);
-        }
-
-        while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
-        return UART16550_READ(OFS_RCV_BUFFER);
-}
-
-
-int putDebugChar(uint8 byte)
-{
-        if (!remoteDebugInitialized) {
-                remoteDebugInitialized = 1;
-                debugInit(BAUD_DEFAULT,
-                          UART16550_DATA_8BIT,
-                          UART16550_PARITY_NONE, UART16550_STOP_1BIT);
-        }
-
-        while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
-        UART16550_WRITE(OFS_SEND_BUFFER, byte);
-        return 1;
-}
diff --git a/arch/mips/ddb5xxx/ddb5477/lcd44780.c b/arch/mips/ddb5xxx/ddb5477/lcd44780.c
deleted file mode 100644 (file)
index 9510b9a..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- * lcd44780.c
- * Simple "driver" for a memory-mapped 44780-style LCD display.
- *
- * Copyright 2001 Bradley D. LaRonde <brad@ltc.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#define LCD44780_COMMAND   ((volatile unsigned char *)0xbe020000)
-#define LCD44780_DATA      ((volatile unsigned char *)0xbe020001)
-
-#define LCD44780_4BIT_1LINE        0x20
-#define LCD44780_4BIT_2LINE        0x28
-#define LCD44780_8BIT_1LINE        0x30
-#define LCD44780_8BIT_2LINE        0x38
-#define LCD44780_MODE_DEC          0x04
-#define LCD44780_MODE_DEC_SHIFT    0x05
-#define LCD44780_MODE_INC          0x06
-#define LCD44780_MODE_INC_SHIFT    0x07
-#define LCD44780_SCROLL_LEFT       0x18
-#define LCD44780_SCROLL_RIGHT      0x1e
-#define LCD44780_CURSOR_UNDERLINE  0x0e
-#define LCD44780_CURSOR_BLOCK      0x0f
-#define LCD44780_CURSOR_OFF        0x0c
-#define LCD44780_CLEAR             0x01
-#define LCD44780_BLANK             0x08
-#define LCD44780_RESTORE           0x0c  // Same as CURSOR_OFF
-#define LCD44780_HOME              0x02
-#define LCD44780_LEFT              0x10
-#define LCD44780_RIGHT             0x14
-
-void lcd44780_wait(void)
-{
-       int i, j;
-       for(i=0; i < 400; i++)
-               for(j=0; j < 10000; j++);
-}
-
-void lcd44780_command(unsigned char c)
-{
-       *LCD44780_COMMAND = c;
-       lcd44780_wait();
-}
-
-void lcd44780_data(unsigned char c)
-{
-       *LCD44780_DATA = c;
-       lcd44780_wait();
-}
-
-void lcd44780_puts(const char* s)
-{
-       int j;
-       int pos = 0;
-
-       lcd44780_command(LCD44780_CLEAR);
-       while(*s) {
-               lcd44780_data(*s);
-               s++;
-               pos++;
-               if (pos == 8) {
-                 /* We must write 32 of spaces to get cursor to 2nd line */
-                 for (j=0; j<32; j++) {
-                   lcd44780_data(' ');
-                 }
-               }
-               if (pos == 16) {
-                 /* We have filled all 16 character positions, so stop
-                    outputing data */
-                 break;
-               }
-       }
-#ifdef LCD44780_PUTS_PAUSE
-       {
-               int i;
-
-               for(i = 1; i < 2000; i++)
-                       lcd44780_wait();
-       }
-#endif
-}
-
-void lcd44780_init(void)
-{
-       // The display on the RockHopper is physically a single
-       // 16 char line (two 8 char lines concatenated).  bdl
-       lcd44780_command(LCD44780_8BIT_2LINE);
-       lcd44780_command(LCD44780_MODE_INC);
-       lcd44780_command(LCD44780_CURSOR_BLOCK);
-       lcd44780_command(LCD44780_CLEAR);
-}
diff --git a/arch/mips/ddb5xxx/ddb5477/lcd44780.h b/arch/mips/ddb5xxx/ddb5477/lcd44780.h
deleted file mode 100644 (file)
index cf2f0f7..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- * lcd44780.h
- * Simple "driver" for a memory-mapped 44780-style LCD display.
- *
- * Copyright 2001 Bradley D. LaRonde <brad@ltc.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-void lcd44780_puts(const char* s);
-void lcd44780_init(void);
diff --git a/arch/mips/ddb5xxx/ddb5477/setup.c b/arch/mips/ddb5xxx/ddb5477/setup.c
deleted file mode 100644 (file)
index f0cc0e8..0000000
+++ /dev/null
@@ -1,399 +0,0 @@
-/*
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
- *
- * arch/mips/ddb5xxx/ddb5477/setup.c
- *     Setup file for DDB5477.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/sched.h>
-#include <linux/pci.h>
-#include <linux/ide.h>
-#include <linux/irq.h>
-#include <linux/fs.h>
-#include <linux/ioport.h>
-#include <linux/param.h>       /* for HZ */
-#include <linux/major.h>
-#include <linux/kdev_t.h>
-#include <linux/root_dev.h>
-#include <linux/pm.h>
-
-#include <asm/cpu.h>
-#include <asm/bootinfo.h>
-#include <asm/addrspace.h>
-#include <asm/time.h>
-#include <asm/bcache.h>
-#include <asm/irq.h>
-#include <asm/reboot.h>
-#include <asm/gdb-stub.h>
-#include <asm/traps.h>
-#include <asm/debug.h>
-
-#include <asm/ddb5xxx/ddb5xxx.h>
-
-#include "lcd44780.h"
-
-
-#define        USE_CPU_COUNTER_TIMER   /* whether we use cpu counter */
-
-#define        SP_TIMER_BASE                   DDB_SPT1CTRL_L
-#define        SP_TIMER_IRQ                    VRC5477_IRQ_SPT1
-
-static int bus_frequency = CONFIG_DDB5477_BUS_FREQUENCY*1000;
-
-static void ddb_machine_restart(char *command)
-{
-       static void (*back_to_prom) (void) = (void (*)(void)) 0xbfc00000;
-
-       u32 t;
-
-       /* PCI cold reset */
-       ddb_pci_reset_bus();
-
-       /* CPU cold reset */
-       t = ddb_in32(DDB_CPUSTAT);
-       db_assert((t&1));
-       ddb_out32(DDB_CPUSTAT, t);
-
-       /* Call the PROM */
-       back_to_prom();
-}
-
-static void ddb_machine_halt(void)
-{
-       printk("DDB Vrc-5477 halted.\n");
-       while (1);
-}
-
-static void ddb_machine_power_off(void)
-{
-       printk("DDB Vrc-5477 halted. Please turn off the power.\n");
-       while (1);
-}
-
-extern void rtc_ds1386_init(unsigned long base);
-
-static unsigned int __init detect_bus_frequency(unsigned long rtc_base)
-{
-       unsigned int freq;
-       unsigned char c;
-       unsigned int t1, t2;
-       unsigned i;
-
-       ddb_out32(SP_TIMER_BASE, 0xffffffff);
-       ddb_out32(SP_TIMER_BASE+4, 0x1);
-       ddb_out32(SP_TIMER_BASE+8, 0xffffffff);
-
-       /* check if rtc is running */
-       c= *(volatile unsigned char*)rtc_base;
-       for(i=0; (c == *(volatile unsigned char*)rtc_base) && (i<100000000); i++);
-       if (c == *(volatile unsigned char*)rtc_base) {
-               printk("Failed to detect bus frequency.  Use default 83.3MHz.\n");
-               return 83333000;
-       }
-
-       c= *(volatile unsigned char*)rtc_base;
-       while (c == *(volatile unsigned char*)rtc_base);
-       /* we are now at the turn of 1/100th second, if no error. */
-       t1 = ddb_in32(SP_TIMER_BASE+8);
-
-       for (i=0; i< 10; i++) {
-               c= *(volatile unsigned char*)rtc_base;
-               while (c == *(volatile unsigned char*)rtc_base);
-               /* we are now at the turn of another 1/100th second */
-               t2 = ddb_in32(SP_TIMER_BASE+8);
-       }
-
-       ddb_out32(SP_TIMER_BASE+4, 0x0);        /* disable it again */
-
-       freq = (t1 - t2)*10;
-       printk("DDB bus frequency detection : %u \n", freq);
-       return freq;
-}
-
-static void __init ddb_time_init(void)
-{
-       unsigned long rtc_base;
-       unsigned int i;
-
-       /* we have ds1396 RTC chip */
-       if (mips_machtype == MACH_NEC_ROCKHOPPER
-               ||  mips_machtype == MACH_NEC_ROCKHOPPERII) {
-               rtc_base = KSEG1ADDR(DDB_LCS2_BASE);
-       } else {
-               rtc_base = KSEG1ADDR(DDB_LCS1_BASE);
-       }
-       rtc_ds1386_init(rtc_base);
-
-       /* do we need to do run-time detection of bus speed? */
-       if (bus_frequency == 0) {
-               bus_frequency = detect_bus_frequency(rtc_base);
-       }
-
-       /* mips_hpt_frequency is 1/2 of the cpu core freq */
-       i =  (read_c0_config() >> 28 ) & 7;
-       if ((current_cpu_data.cputype == CPU_R5432) && (i == 3))
-               i = 4;
-       mips_hpt_frequency = bus_frequency*(i+4)/4;
-}
-
-void __init plat_timer_setup(struct irqaction *irq)
-{
-#if defined(USE_CPU_COUNTER_TIMER)
-
-        /* we are using the cpu counter for timer interrupts */
-       setup_irq(CPU_IRQ_BASE + 7, irq);
-
-#else
-
-       /* if we use Special purpose timer 1 */
-       ddb_out32(SP_TIMER_BASE, bus_frequency/HZ);
-       ddb_out32(SP_TIMER_BASE+4, 0x1);
-       setup_irq(SP_TIMER_IRQ, irq);
-
-#endif
-}
-
-static void ddb5477_board_init(void);
-
-extern struct pci_controller ddb5477_ext_controller;
-extern struct pci_controller ddb5477_io_controller;
-
-void __init plat_mem_setup(void)
-{
-       /* initialize board - we don't trust the loader */
-        ddb5477_board_init();
-
-       set_io_port_base(KSEG1ADDR(DDB_PCI_IO_BASE));
-
-       board_time_init = ddb_time_init;
-
-       _machine_restart = ddb_machine_restart;
-       _machine_halt = ddb_machine_halt;
-       pm_power_off = ddb_machine_power_off;
-
-       /* setup resource limits */
-       ioport_resource.end = DDB_PCI0_IO_SIZE + DDB_PCI1_IO_SIZE - 1;
-       iomem_resource.end = 0xffffffff;
-
-       /* Reboot on panic */
-       panic_timeout = 180;
-
-       register_pci_controller (&ddb5477_ext_controller);
-       register_pci_controller (&ddb5477_io_controller);
-}
-
-static void __init ddb5477_board_init(void)
-{
-       /* ----------- setup PDARs ------------ */
-
-       /* SDRAM should have been set */
-       db_assert(ddb_in32(DDB_SDRAM0) ==
-                   ddb_calc_pdar(DDB_SDRAM_BASE, board_ram_size, 32, 0, 1));
-
-       /* SDRAM1 should be turned off.  What is this for anyway ? */
-       db_assert( (ddb_in32(DDB_SDRAM1) & 0xf) == 0);
-
-       /* Setup local bus. */
-
-       /* Flash U12 PDAR and timing. */
-       ddb_set_pdar(DDB_LCS0, DDB_LCS0_BASE, DDB_LCS0_SIZE, 16, 0, 0);
-       ddb_out32(DDB_LCST0, 0x00090842);
-
-       /* We need to setup LCS1 and LCS2 differently based on the
-          board_version */
-       if (mips_machtype == MACH_NEC_ROCKHOPPER) {
-               /* Flash U13 PDAR and timing. */
-               ddb_set_pdar(DDB_LCS1, DDB_LCS1_BASE, DDB_LCS1_SIZE, 16, 0, 0);
-               ddb_out32(DDB_LCST1, 0x00090842);
-
-               /* EPLD (NVRAM, switch, LCD, and mezzanie). */
-               ddb_set_pdar(DDB_LCS2, DDB_LCS2_BASE, DDB_LCS2_SIZE, 8, 0, 0);
-       } else {
-               /* misc */
-               ddb_set_pdar(DDB_LCS1, DDB_LCS1_BASE, DDB_LCS1_SIZE, 8, 0, 0);
-               /* mezzanie (?) */
-               ddb_set_pdar(DDB_LCS2, DDB_LCS2_BASE, DDB_LCS2_SIZE, 16, 0, 0);
-       }
-
-       /* verify VRC5477 base addr */
-       db_assert(ddb_in32(DDB_VRC5477) ==
-                 ddb_calc_pdar(DDB_VRC5477_BASE, DDB_VRC5477_SIZE, 32, 0, 1));
-
-       /* verify BOOT ROM addr */
-       db_assert(ddb_in32(DDB_BOOTCS) ==
-                 ddb_calc_pdar(DDB_BOOTCS_BASE, DDB_BOOTCS_SIZE, 8, 0, 0));
-
-       /* setup PCI windows - window0 for MEM/config, window1 for IO */
-       ddb_set_pdar(DDB_PCIW0, DDB_PCI0_MEM_BASE, DDB_PCI0_MEM_SIZE, 32, 0, 1);
-       ddb_set_pdar(DDB_PCIW1, DDB_PCI0_IO_BASE, DDB_PCI0_IO_SIZE, 32, 0, 1);
-       ddb_set_pdar(DDB_IOPCIW0, DDB_PCI1_MEM_BASE, DDB_PCI1_MEM_SIZE, 32, 0, 1);
-       ddb_set_pdar(DDB_IOPCIW1, DDB_PCI1_IO_BASE, DDB_PCI1_IO_SIZE, 32, 0, 1);
-
-       /* ------------ reset PCI bus and BARs ----------------- */
-       ddb_pci_reset_bus();
-
-       ddb_out32(DDB_BARM010, 0x00000008);
-       ddb_out32(DDB_BARM011, 0x00000008);
-
-       ddb_out32(DDB_BARC0, 0xffffffff);
-       ddb_out32(DDB_BARM230, 0xffffffff);
-       ddb_out32(DDB_BAR00, 0xffffffff);
-       ddb_out32(DDB_BAR10, 0xffffffff);
-       ddb_out32(DDB_BAR20, 0xffffffff);
-       ddb_out32(DDB_BAR30, 0xffffffff);
-       ddb_out32(DDB_BAR40, 0xffffffff);
-       ddb_out32(DDB_BAR50, 0xffffffff);
-       ddb_out32(DDB_BARB0, 0xffffffff);
-
-       ddb_out32(DDB_BARC1, 0xffffffff);
-       ddb_out32(DDB_BARM231, 0xffffffff);
-       ddb_out32(DDB_BAR01, 0xffffffff);
-       ddb_out32(DDB_BAR11, 0xffffffff);
-       ddb_out32(DDB_BAR21, 0xffffffff);
-       ddb_out32(DDB_BAR31, 0xffffffff);
-       ddb_out32(DDB_BAR41, 0xffffffff);
-       ddb_out32(DDB_BAR51, 0xffffffff);
-       ddb_out32(DDB_BARB1, 0xffffffff);
-
-       /*
-        * We use pci master register 0  for memory space / config space
-        * And we use register 1 for IO space.
-        * Note that for memory space, we bump up the pci base address
-        * so that we have 1:1 mapping between PCI memory and cpu physical.
-        * For PCI IO space, it starts from 0 in PCI IO space but with
-        * DDB_xx_IO_BASE in CPU physical address space.
-        */
-       ddb_set_pmr(DDB_PCIINIT00, DDB_PCICMD_MEM, DDB_PCI0_MEM_BASE,
-                   DDB_PCI_ACCESS_32);
-       ddb_set_pmr(DDB_PCIINIT10, DDB_PCICMD_IO, 0, DDB_PCI_ACCESS_32);
-
-       ddb_set_pmr(DDB_PCIINIT01, DDB_PCICMD_MEM, DDB_PCI1_MEM_BASE,
-                   DDB_PCI_ACCESS_32);
-       ddb_set_pmr(DDB_PCIINIT11, DDB_PCICMD_IO, DDB_PCI0_IO_SIZE,
-                    DDB_PCI_ACCESS_32);
-
-
-       /* PCI cross window should be set properly */
-       ddb_set_pdar(DDB_BARP00, DDB_PCI1_MEM_BASE, DDB_PCI1_MEM_SIZE, 32, 0, 1);
-       ddb_set_pdar(DDB_BARP10, DDB_PCI1_IO_BASE, DDB_PCI1_IO_SIZE, 32, 0, 1);
-       ddb_set_pdar(DDB_BARP01, DDB_PCI0_MEM_BASE, DDB_PCI0_MEM_SIZE, 32, 0, 1);
-       ddb_set_pdar(DDB_BARP11, DDB_PCI0_IO_BASE, DDB_PCI0_IO_SIZE, 32, 0, 1);
-
-       if (mips_machtype == MACH_NEC_ROCKHOPPER
-          ||  mips_machtype == MACH_NEC_ROCKHOPPERII) {
-               /* Disable bus diagnostics. */
-               ddb_out32(DDB_PCICTL0_L, 0);
-               ddb_out32(DDB_PCICTL0_H, 0);
-               ddb_out32(DDB_PCICTL1_L, 0);
-               ddb_out32(DDB_PCICTL1_H, 0);
-       }
-
-       if (mips_machtype == MACH_NEC_ROCKHOPPER) {
-               u16                     vid;
-               struct pci_bus          bus;
-               struct pci_dev          dev_m1533;
-               extern struct pci_ops   ddb5477_ext_pci_ops;
-
-               bus.parent      = NULL;    /* we scan the top level only */
-               bus.ops         = &ddb5477_ext_pci_ops;
-               dev_m1533.bus         = &bus;
-               dev_m1533.sysdata     = NULL;
-               dev_m1533.devfn       = 7*8;     // slot 7: M1533 SouthBridge.
-               pci_read_config_word(&dev_m1533, 0, &vid);
-               if (vid == PCI_VENDOR_ID_AL) {
-                       printk("Changing mips_machtype to MACH_NEC_ROCKHOPPERII\n");
-                       mips_machtype = MACH_NEC_ROCKHOPPERII;
-               }
-       }
-
-       /* enable USB input buffers */
-       ddb_out32(DDB_PIBMISC, 0x00000007);
-
-       /* For dual-function pins, make them all non-GPIO */
-       ddb_out32(DDB_GIUFUNSEL, 0x0);
-       // ddb_out32(DDB_GIUFUNSEL, 0xfe0fcfff);  /* NEC recommanded value */
-
-       if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
-
-               /* enable IDE controller on Ali chip (south bridge) */
-               u8                      temp8;
-               struct pci_bus          bus;
-               struct pci_dev          dev_m1533;
-               struct pci_dev          dev_m5229;
-               extern struct pci_ops   ddb5477_ext_pci_ops;
-
-               /* Setup M1535 registers */
-               bus.parent      = NULL;    /* we scan the top level only */
-               bus.ops         = &ddb5477_ext_pci_ops;
-               dev_m1533.bus         = &bus;
-               dev_m1533.sysdata     = NULL;
-               dev_m1533.devfn       = 7*8;     // slot 7: M1533 SouthBridge.
-
-               /* setup IDE controller
-                * enable IDE controller (bit 6 - 1)
-                * IDE IDSEL to be addr:A15 (bit 4:5 - 11)
-                * disable IDE ATA Secondary Bus Signal Pad Control (bit 3 - 0)
-                * enable IDE ATA Primary Bus Signal Pad Control (bit 2 - 1)
-                */
-               pci_write_config_byte(&dev_m1533, 0x58, 0x74);
-
-               /*
-                * positive decode (bit6 -0)
-                * enable IDE controler interrupt (bit 4 -1)
-                * setup SIRQ to point to IRQ 14 (bit 3:0 - 1101)
-                */
-               pci_write_config_byte(&dev_m1533, 0x44, 0x1d);
-
-               /* Setup M5229 registers */
-               dev_m5229.bus = &bus;
-               dev_m5229.sysdata = NULL;
-               dev_m5229.devfn = 4*8;          // slot 4 (AD15): M5229 IDE
-
-               /*
-                * enable IDE in the M5229 config register 0x50 (bit 0 - 1)
-                * M5229 IDSEL is addr:15; see above setting
-                */
-               pci_read_config_byte(&dev_m5229, 0x50, &temp8);
-               pci_write_config_byte(&dev_m5229, 0x50, temp8 | 0x1);
-
-               /*
-                * enable bus master (bit 2)  and IO decoding  (bit 0)
-                */
-               pci_read_config_byte(&dev_m5229, 0x04, &temp8);
-               pci_write_config_byte(&dev_m5229, 0x04, temp8 | 0x5);
-
-               /*
-                * enable native, copied from arch/ppc/k2boot/head.S
-                * TODO - need volatile, need to be portable
-                */
-               pci_write_config_byte(&dev_m5229, 0x09, 0xef);
-
-               /* Set Primary Channel Command Block Timing */
-               pci_write_config_byte(&dev_m5229, 0x59, 0x31);
-
-               /*
-                * Enable primary channel 40-pin cable
-                * M5229 register 0x4a (bit 0)
-                */
-               pci_read_config_byte(&dev_m5229, 0x4a, &temp8);
-               pci_write_config_byte(&dev_m5229, 0x4a, temp8 | 0x1);
-       }
-
-       if (mips_machtype == MACH_NEC_ROCKHOPPER
-          ||  mips_machtype == MACH_NEC_ROCKHOPPERII) {
-               printk("lcd44780: initializing\n");
-               lcd44780_init();
-               lcd44780_puts("MontaVista Linux");
-       }
-}
index 9eb2f9c036aad596584427a5512255aab1769f8b..c530208ee15494ce22c09ca247ed1ba32b70ce1d 100644 (file)
@@ -8,3 +8,5 @@ obj-y           := ecc-berr.o int-handler.o ioasic-irq.o kn01-berr.o \
 obj-$(CONFIG_PROM_CONSOLE)     += promcon.o
 obj-$(CONFIG_TC)               += tc.o
 obj-$(CONFIG_CPU_HAS_WB)       += wbflush.o
+
+EXTRA_CFLAGS += -Werror
index b3b6e58058f680bd9c72ed7c0234830b0fa2527a..d3d81fb2765a8683b098d7ba7e6d8c2d6aaf53a4 100644 (file)
@@ -32,12 +32,9 @@ CONFIG_ZONE_DMA=y
 # CONFIG_WR_PPMC is not set
 # CONFIG_MIPS_SIM is not set
 # CONFIG_MOMENCO_JAGUAR_ATX is not set
-# CONFIG_MOMENCO_OCELOT is not set
-# CONFIG_MOMENCO_OCELOT_G is not set
 # CONFIG_MIPS_XXS1500 is not set
 # CONFIG_PNX8550_JBS is not set
 # CONFIG_PNX8550_STB810 is not set
-# CONFIG_DDB5477 is not set
 # CONFIG_MACH_VR41XX is not set
 # CONFIG_PMC_YOSEMITE is not set
 # CONFIG_QEMU is not set
diff --git a/arch/mips/gt64120/common/Makefile b/arch/mips/gt64120/common/Makefile
deleted file mode 100644 (file)
index 1ef676e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for common code of gt64120-based boards.
-#
-
-obj-y                  += time.o
diff --git a/arch/mips/gt64120/common/time.c b/arch/mips/gt64120/common/time.c
deleted file mode 100644 (file)
index c47eeb7..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * Galileo Technology chip interrupt handler
- */
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/kernel_stat.h>
-#include <asm/irq_regs.h>
-#include <asm/gt64120.h>
-
-/*
- * These are interrupt handlers for the GT on-chip interrupts.  They all come
- * in to the MIPS on a single interrupt line, and have to be handled and ack'ed
- * differently than other MIPS interrupts.
- */
-
-static irqreturn_t gt64120_irq(int irq, void *dev_id)
-{
-       unsigned int irq_src, int_high_src, irq_src_mask, int_high_src_mask;
-       int handled = 0;
-
-       irq_src = GT_READ(GT_INTRCAUSE_OFS);
-       irq_src_mask = GT_READ(GT_INTRMASK_OFS);
-       int_high_src = GT_READ(GT_HINTRCAUSE_OFS);
-       int_high_src_mask = GT_READ(GT_HINTRMASK_OFS);
-       irq_src = irq_src & irq_src_mask;
-       int_high_src = int_high_src & int_high_src_mask;
-
-       if (irq_src & 0x00000800) {     /* Check for timer interrupt */
-               handled = 1;
-               irq_src &= ~0x00000800;
-               do_timer(1);
-#ifndef CONFIG_SMP
-               update_process_times(user_mode(get_irq_regs()));
-#endif
-       }
-
-       GT_WRITE(GT_INTRCAUSE_OFS, 0);
-       GT_WRITE(GT_HINTRCAUSE_OFS, 0);
-
-       return IRQ_HANDLED;
-}
-
-/*
- * Initializes timer using galileo's built in timer.
- */
-#ifdef CONFIG_SYSCLK_100
-#define Sys_clock (100 * 1000000)      // 100 MHz
-#endif
-#ifdef CONFIG_SYSCLK_83
-#define Sys_clock (83.333 * 1000000)   // 83.333 MHz
-#endif
-#ifdef CONFIG_SYSCLK_75
-#define Sys_clock (75 * 1000000)       // 75 MHz
-#endif
-
-/*
- * This will ignore the standard MIPS timer interrupt handler that is passed in
- * as *irq (=irq0 in ../kernel/time.c).  We will do our own timer interrupt
- * handling.
- */
-void __init plat_timer_setup(struct irqaction *irq)
-{
-       static struct irqaction timer;
-
-       /* Disable timer first */
-       GT_WRITE(GT_TC_CONTROL_OFS, 0);
-       /* Load timer value for 100 Hz */
-       GT_WRITE(GT_TC3_OFS, Sys_clock / HZ);
-
-       /*
-        * Create the IRQ structure entry for the timer.  Since we're too early
-        * in the boot process to use the "request_irq()" call, we'll hard-code
-        * the values to the correct interrupt line.
-        */
-       timer.handler = gt64120_irq;
-       timer.flags = IRQF_SHARED | IRQF_DISABLED;
-       timer.name = "timer";
-       timer.dev_id = NULL;
-       timer.next = NULL;
-       timer.mask = CPU_MASK_NONE;
-       irq_desc[GT_TIMER].action = &timer;
-
-       enable_irq(GT_TIMER);
-
-       /* Enable timer ints */
-       GT_WRITE(GT_TC_CONTROL_OFS, 0xc0);
-       /* clear Cause register first */
-       GT_WRITE(GT_INTRCAUSE_OFS, 0x0);
-       /* Unmask timer int */
-       GT_WRITE(GT_INTRMASK_OFS, 0x800);
-       /* Clear High int register */
-       GT_WRITE(GT_HINTRCAUSE_OFS, 0x0);
-       /* Mask All interrupts at High cause interrupt */
-       GT_WRITE(GT_HINTRMASK_OFS, 0x0);
-}
diff --git a/arch/mips/gt64120/momenco_ocelot/Makefile b/arch/mips/gt64120/momenco_ocelot/Makefile
deleted file mode 100644 (file)
index 1df5fe2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#
-# Makefile for Momentum's Ocelot board.
-#
-
-obj-y                  += irq.o ocelot-platform.o prom.o reset.o setup.o
-
-obj-$(CONFIG_KGDB)     += dbg_io.o
diff --git a/arch/mips/gt64120/momenco_ocelot/dbg_io.c b/arch/mips/gt64120/momenco_ocelot/dbg_io.c
deleted file mode 100644 (file)
index 32d6fb4..0000000
+++ /dev/null
@@ -1,121 +0,0 @@
-
-#include <asm/serial.h> /* For the serial port location and base baud */
-
-/* --- CONFIG --- */
-
-typedef unsigned char uint8;
-typedef unsigned int uint32;
-
-/* --- END OF CONFIG --- */
-
-#define         UART16550_BAUD_2400             2400
-#define         UART16550_BAUD_4800             4800
-#define         UART16550_BAUD_9600             9600
-#define         UART16550_BAUD_19200            19200
-#define         UART16550_BAUD_38400            38400
-#define         UART16550_BAUD_57600            57600
-#define         UART16550_BAUD_115200           115200
-
-#define         UART16550_PARITY_NONE           0
-#define         UART16550_PARITY_ODD            0x08
-#define         UART16550_PARITY_EVEN           0x18
-#define         UART16550_PARITY_MARK           0x28
-#define         UART16550_PARITY_SPACE          0x38
-
-#define         UART16550_DATA_5BIT             0x0
-#define         UART16550_DATA_6BIT             0x1
-#define         UART16550_DATA_7BIT             0x2
-#define         UART16550_DATA_8BIT             0x3
-
-#define         UART16550_STOP_1BIT             0x0
-#define         UART16550_STOP_2BIT             0x4
-
-/* ----------------------------------------------------- */
-
-/* === CONFIG === */
-
-/* [jsun] we use the second serial port for kdb */
-#define         BASE                    OCELOT_SERIAL1_BASE
-#define         MAX_BAUD                OCELOT_BASE_BAUD
-
-/* === END OF CONFIG === */
-
-#define         REG_OFFSET              4
-
-/* register offset */
-#define         OFS_RCV_BUFFER          0
-#define         OFS_TRANS_HOLD          0
-#define         OFS_SEND_BUFFER         0
-#define         OFS_INTR_ENABLE         (1*REG_OFFSET)
-#define         OFS_INTR_ID             (2*REG_OFFSET)
-#define         OFS_DATA_FORMAT         (3*REG_OFFSET)
-#define         OFS_LINE_CONTROL        (3*REG_OFFSET)
-#define         OFS_MODEM_CONTROL       (4*REG_OFFSET)
-#define         OFS_RS232_OUTPUT        (4*REG_OFFSET)
-#define         OFS_LINE_STATUS         (5*REG_OFFSET)
-#define         OFS_MODEM_STATUS        (6*REG_OFFSET)
-#define         OFS_RS232_INPUT         (6*REG_OFFSET)
-#define         OFS_SCRATCH_PAD         (7*REG_OFFSET)
-
-#define         OFS_DIVISOR_LSB         (0*REG_OFFSET)
-#define         OFS_DIVISOR_MSB         (1*REG_OFFSET)
-
-
-/* memory-mapped read/write of the port */
-#define         UART16550_READ(y)    (*((volatile uint8*)(BASE + y)))
-#define         UART16550_WRITE(y, z)  ((*((volatile uint8*)(BASE + y))) = z)
-
-void debugInit(uint32 baud, uint8 data, uint8 parity, uint8 stop)
-{
-       /* disable interrupts */
-       UART16550_WRITE(OFS_INTR_ENABLE, 0);
-
-       /* set up baud rate */
-       {
-               uint32 divisor;
-
-               /* set DIAB bit */
-               UART16550_WRITE(OFS_LINE_CONTROL, 0x80);
-
-               /* set divisor */
-               divisor = MAX_BAUD / baud;
-               UART16550_WRITE(OFS_DIVISOR_LSB, divisor & 0xff);
-               UART16550_WRITE(OFS_DIVISOR_MSB, (divisor & 0xff00) >> 8);
-
-               /* clear DIAB bit */
-               UART16550_WRITE(OFS_LINE_CONTROL, 0x0);
-       }
-
-       /* set data format */
-       UART16550_WRITE(OFS_DATA_FORMAT, data | parity | stop);
-}
-
-static int remoteDebugInitialized = 0;
-
-uint8 getDebugChar(void)
-{
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(UART16550_BAUD_38400,
-                         UART16550_DATA_8BIT,
-                         UART16550_PARITY_NONE, UART16550_STOP_1BIT);
-       }
-
-       while ((UART16550_READ(OFS_LINE_STATUS) & 0x1) == 0);
-       return UART16550_READ(OFS_RCV_BUFFER);
-}
-
-
-int putDebugChar(uint8 byte)
-{
-       if (!remoteDebugInitialized) {
-               remoteDebugInitialized = 1;
-               debugInit(UART16550_BAUD_38400,
-                         UART16550_DATA_8BIT,
-                         UART16550_PARITY_NONE, UART16550_STOP_1BIT);
-       }
-
-       while ((UART16550_READ(OFS_LINE_STATUS) & 0x20) == 0);
-       UART16550_WRITE(OFS_SEND_BUFFER, byte);
-       return 1;
-}
diff --git a/arch/mips/gt64120/momenco_ocelot/irq.c b/arch/mips/gt64120/momenco_ocelot/irq.c
deleted file mode 100644 (file)
index 2585d9d..0000000
+++ /dev/null
@@ -1,95 +0,0 @@
-/*
- * Copyright (C) 2000 RidgeRun, Inc.
- * Author: RidgeRun, Inc.
- *   glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- * Copyright (C) 2000, 2001, 2003 Ralf Baechle (ralf@gnu.org)
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-#include <linux/errno.h>
-#include <linux/init.h>
-#include <linux/kernel_stat.h>
-#include <linux/module.h>
-#include <linux/signal.h>
-#include <linux/sched.h>
-#include <linux/types.h>
-#include <linux/interrupt.h>
-#include <linux/ioport.h>
-#include <linux/timex.h>
-#include <linux/slab.h>
-#include <linux/random.h>
-#include <linux/bitops.h>
-#include <asm/bootinfo.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/irq_cpu.h>
-#include <asm/mipsregs.h>
-#include <asm/system.h>
-
-asmlinkage void plat_irq_dispatch(void)
-{
-       unsigned int pending = read_c0_status() & read_c0_cause();
-
-       if (pending & STATUSF_IP2)              /* int0 hardware line */
-               do_IRQ(2);
-       else if (pending & STATUSF_IP3)         /* int1 hardware line */
-               do_IRQ(3);
-       else if (pending & STATUSF_IP4)         /* int2 hardware line */
-               do_IRQ(4);
-       else if (pending & STATUSF_IP5)         /* int3 hardware line */
-               do_IRQ(5);
-       else if (pending & STATUSF_IP6)         /* int4 hardware line */
-               do_IRQ(6);
-       else if (pending & STATUSF_IP7)         /* cpu timer */
-               do_IRQ(7);
-       else {
-               /*
-                * Now look at the extended interrupts
-                */
-               pending = (read_c0_cause() & (read_c0_intcontrol() << 8)) >> 16;
-
-               if (pending & STATUSF_IP8)              /* int6 hardware line */
-                       do_IRQ(8);
-               else if (pending & STATUSF_IP9)         /* int7 hardware line */
-                       do_IRQ(9);
-               else if (pending & STATUSF_IP10)        /* int8 hardware line */
-                       do_IRQ(10);
-               else if (pending & STATUSF_IP11)        /* int9 hardware line */
-                       do_IRQ(11);
-       }
-}
-
-void __init arch_init_irq(void)
-{
-       /*
-        * Clear all of the interrupts while we change the able around a bit.
-        * int-handler is not on bootstrap
-        */
-       clear_c0_status(ST0_IM);
-       local_irq_disable();
-
-       mips_cpu_irq_init();
-       rm7k_cpu_irq_init();
-}
diff --git a/arch/mips/gt64120/momenco_ocelot/ocelot-platform.c b/arch/mips/gt64120/momenco_ocelot/ocelot-platform.c
deleted file mode 100644 (file)
index 81d9031..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- *
- * Copyright (C) 2007 Ralf Baechle (ralf@linux-mips.org)
- *
- * A NS16552 DUART with a 20MHz crystal.
- *
- */
-#include <linux/module.h>
-#include <linux/init.h>
-#include <linux/serial_8250.h>
-
-#define OCELOT_UART_FLAGS (UPF_BOOT_AUTOCONF | UPF_SKIP_TEST | UPF_IOREMAP)
-
-static struct plat_serial8250_port uart8250_data[] = {
-       {
-               .mapbase        = 0xe0001020,
-               .irq            = 4,
-               .uartclk        = 20000000,
-               .iotype         = UPIO_MEM,
-               .flags          = OCELOT_UART_FLAGS,
-               .regshift       = 2,
-       },
-       { },
-};
-
-static struct platform_device uart8250_device = {
-       .name                   = "serial8250",
-       .id                     = PLAT8250_DEV_PLATFORM,
-       .dev                    = {
-               .platform_data  = uart8250_data,
-       },
-};
-
-static int __init uart8250_init(void)
-{
-       return platform_device_register(&uart8250_device);
-}
-
-module_init(uart8250_init);
-
-MODULE_AUTHOR("Ralf Baechle <ralf@linux-mips.org>");
-MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("8250 UART probe driver for the Momenco Ocelot");
diff --git a/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h b/arch/mips/gt64120/momenco_ocelot/ocelot_pld.h
deleted file mode 100644 (file)
index 11f02c4..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-/*
- * Ocelot Board Register Definitions
- *
- * (C) 2001 Red Hat, Inc.
- *
- * GPL'd
- */
-#ifndef __MOMENCO_OCELOT_PLD_H__
-#define __MOMENCO_OCELOT_PLD_H__
-
-#define OCELOT_CS0_ADDR (0xe0020000)
-
-#define OCELOT_REG_BOARDREV (0)
-#define OCELOT_REG_PLD1_ID (1)
-#define OCELOT_REG_PLD2_ID (2)
-#define OCELOT_REG_RESET_STATUS (3)
-#define OCELOT_REG_BOARD_STATUS (4)
-#define OCELOT_REG_CPCI_ID (5)
-#define OCELOT_REG_I2C_CTRL (8)
-#define OCELOT_REG_EEPROM_MODE (9)
-#define OCELOT_REG_INTMASK (10)
-#define OCELOT_REG_INTSTATUS (11)
-#define OCELOT_REG_INTSET (12)
-#define OCELOT_REG_INTCLR (13)
-
-#define OCELOT_PLD_WRITE(x, y) writeb(x, OCELOT_CS0_ADDR + OCELOT_REG_##y)
-#define OCELOT_PLD_READ(x) readb(OCELOT_CS0_ADDR + OCELOT_REG_##x)
-
-
-#endif /* __MOMENCO_OCELOT_PLD_H__ */
diff --git a/arch/mips/gt64120/momenco_ocelot/prom.c b/arch/mips/gt64120/momenco_ocelot/prom.c
deleted file mode 100644 (file)
index c71c852..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#include <linux/init.h>
-#include <linux/mm.h>
-#include <linux/sched.h>
-#include <linux/bootmem.h>
-
-#include <asm/addrspace.h>
-#include <asm/bootinfo.h>
-#include <asm/pmon.h>
-
-struct callvectors* debug_vectors;
-
-extern unsigned long gt64120_base;
-
-const char *get_system_type(void)
-{
-       return "Momentum Ocelot";
-}
-
-/* [jsun@junsun.net] PMON passes arguments in C main() style */
-void __init prom_init(void)
-{
-       int argc = fw_arg0;
-       char **arg = (char **) fw_arg1;
-       char **env = (char **) fw_arg2;
-       struct callvectors *cv = (struct callvectors *) fw_arg3;
-       int i;
-
-       /* save the PROM vectors for debugging use */
-       debug_vectors = cv;
-
-       /* arg[0] is "g", the rest is boot parameters */
-       arcs_cmdline[0] = '\0';
-       for (i = 1; i < argc; i++) {
-               if (strlen(arcs_cmdline) + strlen(arg[i] + 1)
-                   >= sizeof(arcs_cmdline))
-                       break;
-               strcat(arcs_cmdline, arg[i]);
-               strcat(arcs_cmdline, " ");
-       }
-
-       mips_machgroup = MACH_GROUP_MOMENCO;
-       mips_machtype = MACH_MOMENCO_OCELOT;
-
-       while (*env) {
-               if (strncmp("gtbase", *env, 6) == 0) {
-                       gt64120_base = simple_strtol(*env + strlen("gtbase="),
-                                                       NULL, 16);
-                       break;
-               }
-               *env++;
-       }
-
-       debug_vectors->printf("Booting Linux kernel...\n");
-
-       /* All the boards have at least 64MiB. If there's more, we
-          detect and register it later */
-       add_memory_region(0, 64 << 20, BOOT_MEM_RAM);
-}
-
-void __init prom_free_prom_memory(void)
-{
-}
diff --git a/arch/mips/gt64120/momenco_ocelot/reset.c b/arch/mips/gt64120/momenco_ocelot/reset.c
deleted file mode 100644 (file)
index 3fd499a..0000000
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- * Copyright (C) 1997, 2001 Ralf Baechle
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- */
-#include <linux/sched.h>
-#include <linux/mm.h>
-#include <asm/io.h>
-#include <asm/pgtable.h>
-#include <asm/processor.h>
-#include <asm/reboot.h>
-#include <asm/system.h>
-#include <linux/delay.h>
-
-void momenco_ocelot_restart(char *command)
-{
-       void *nvram = ioremap_nocache(0x2c807000, 0x1000);
-
-       if (!nvram) {
-               printk(KERN_NOTICE "ioremap of reset register failed\n");
-               return;
-       }
-       writeb(0x84, nvram + 0xff7); /* Ask the NVRAM/RTC/watchdog chip to
-                                       assert reset in 1/16 second */
-       mdelay(10+(1000/16));
-       iounmap(nvram);
-       printk(KERN_NOTICE "Watchdog reset failed\n");
-}
-
-void momenco_ocelot_halt(void)
-{
-       printk(KERN_NOTICE "\n** You can safely turn off the power\n");
-       while (1)
-               __asm__(".set\tmips3\n\t"
-                       "wait\n\t"
-                       ".set\tmips0");
-}
-
-void momenco_ocelot_power_off(void)
-{
-       momenco_ocelot_halt();
-}
diff --git a/arch/mips/gt64120/momenco_ocelot/setup.c b/arch/mips/gt64120/momenco_ocelot/setup.c
deleted file mode 100644 (file)
index 98b6fb3..0000000
+++ /dev/null
@@ -1,365 +0,0 @@
-/*
- * setup.c
- *
- * BRIEF MODULE DESCRIPTION
- * Momentum Computer Ocelot (CP7000) - board dependent boot routines
- *
- * Copyright (C) 1996, 1997, 2001, 06  Ralf Baechle (ralf@linux-mips.org)
- * Copyright (C) 2000 RidgeRun, Inc.
- * Copyright (C) 2001 Red Hat, Inc.
- * Copyright (C) 2002 Momentum Computer
- *
- * Author: RidgeRun, Inc.
- *   glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- *
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-#include <linux/mm.h>
-#include <linux/swap.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/interrupt.h>
-#include <linux/pci.h>
-#include <linux/timex.h>
-#include <linux/vmalloc.h>
-#include <linux/pm.h>
-
-#include <asm/time.h>
-#include <asm/bootinfo.h>
-#include <asm/page.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/pci.h>
-#include <asm/processor.h>
-#include <asm/reboot.h>
-#include <asm/traps.h>
-#include <linux/bootmem.h>
-#include <linux/initrd.h>
-#include <asm/gt64120.h>
-#include "ocelot_pld.h"
-
-unsigned long gt64120_base = KSEG1ADDR(GT_DEF_BASE);
-
-/* These functions are used for rebooting or halting the machine*/
-extern void momenco_ocelot_restart(char *command);
-extern void momenco_ocelot_halt(void);
-extern void momenco_ocelot_power_off(void);
-
-extern void momenco_ocelot_irq_setup(void);
-
-static char reset_reason;
-
-#define ENTRYLO(x) ((pte_val(pfn_pte((x) >> PAGE_SHIFT, PAGE_KERNEL_UNCACHED)) >> 6)|1)
-
-static void __init setup_l3cache(unsigned long size);
-
-/* setup code for a handoff from a version 1 PMON 2000 PROM */
-static void PMON_v1_setup(void)
-{
-       /* A wired TLB entry for the GT64120A and the serial port. The
-          GT64120A is going to be hit on every IRQ anyway - there's
-          absolutely no point in letting it be a random TLB entry, as
-          it'll just cause needless churning of the TLB. And we use
-          the other half for the serial port, which is just a PITA
-          otherwise :)
-
-               Device                  Physical        Virtual
-               GT64120 Internal Regs   0x24000000      0xe0000000
-               UARTs (CS2)             0x2d000000      0xe0001000
-       */
-       add_wired_entry(ENTRYLO(0x24000000), ENTRYLO(0x2D000000), 0xe0000000, PM_4K);
-
-       /* Also a temporary entry to let us talk to the Ocelot PLD and NVRAM
-          in the CS[012] region. We can't use ioremap() yet. The NVRAM
-          is a ST M48T37Y, which includes NVRAM, RTC, and Watchdog functions.
-
-               Ocelot PLD (CS0)        0x2c000000      0xe0020000
-               NVRAM                   0x2c800000      0xe0030000
-       */
-
-       add_temporary_entry(ENTRYLO(0x2C000000), ENTRYLO(0x2d000000), 0xe0020000, PM_64K);
-
-       /* Relocate the CS3/BootCS region */
-       GT_WRITE(GT_CS3BOOTLD_OFS, 0x2f000000 >> 21);
-
-       /* Relocate CS[012] */
-       GT_WRITE(GT_CS20LD_OFS, 0x2c000000 >> 21);
-
-       /* Relocate the GT64120A itself... */
-       GT_WRITE(GT_ISD_OFS, 0x24000000 >> 21);
-       mb();
-       gt64120_base = 0xe0000000;
-
-       /* ...and the PCI0 view of it. */
-       GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000020);
-       GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x24000000);
-       GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000024);
-       GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x24000001);
-}
-
-/* setup code for a handoff from a version 2 PMON 2000 PROM */
-void PMON_v2_setup()
-{
-       /* A wired TLB entry for the GT64120A and the serial port. The
-          GT64120A is going to be hit on every IRQ anyway - there's
-          absolutely no point in letting it be a random TLB entry, as
-          it'll just cause needless churning of the TLB. And we use
-          the other half for the serial port, which is just a PITA
-          otherwise :)
-
-               Device                  Physical        Virtual
-               GT64120 Internal Regs   0xf4000000      0xe0000000
-               UARTs (CS2)             0xfd000000      0xe0001000
-       */
-       add_wired_entry(ENTRYLO(0xf4000000), ENTRYLO(0xfD000000), 0xe0000000, PM_4K);
-
-       /* Also a temporary entry to let us talk to the Ocelot PLD and NVRAM
-          in the CS[012] region. We can't use ioremap() yet. The NVRAM
-          is a ST M48T37Y, which includes NVRAM, RTC, and Watchdog functions.
-
-               Ocelot PLD (CS0)        0xfc000000      0xe0020000
-               NVRAM                   0xfc800000      0xe0030000
-       */
-       add_temporary_entry(ENTRYLO(0xfC000000), ENTRYLO(0xfd000000), 0xe0020000, PM_64K);
-
-       gt64120_base = 0xe0000000;
-}
-
-void __init plat_mem_setup(void)
-{
-       void (*l3func)(unsigned long)=KSEG1ADDR(&setup_l3cache);
-       unsigned int tmpword;
-
-       _machine_restart = momenco_ocelot_restart;
-       _machine_halt = momenco_ocelot_halt;
-       pm_power_off = momenco_ocelot_power_off;
-
-       /*
-        * initrd_start = (unsigned long)ocelot_initrd_start;
-        * initrd_end = (unsigned long)ocelot_initrd_start + (ulong)ocelot_initrd_size;
-        * initrd_below_start_ok = 1;
-        */
-
-       /* do handoff reconfiguration */
-       if (gt64120_base == KSEG1ADDR(GT_DEF_BASE))
-               PMON_v1_setup();
-       else
-               PMON_v2_setup();
-
-       /* Turn off the Bit-Error LED */
-       OCELOT_PLD_WRITE(0x80, INTCLR);
-
-       /* Relocate all the PCI1 stuff, not that we use it */
-       GT_WRITE(GT_PCI1IOLD_OFS, 0x30000000 >> 21);
-       GT_WRITE(GT_PCI1M0LD_OFS, 0x32000000 >> 21);
-       GT_WRITE(GT_PCI1M1LD_OFS, 0x34000000 >> 21);
-
-       /* Relocate PCI0 I/O and Mem0 */
-       GT_WRITE(GT_PCI0IOLD_OFS, 0x20000000 >> 21);
-       GT_WRITE(GT_PCI0M0LD_OFS, 0x22000000 >> 21);
-
-       /* Relocate PCI0 Mem1 */
-       GT_WRITE(GT_PCI0M1LD_OFS, 0x36000000 >> 21);
-
-       /* For the initial programming, we assume 512MB configuration */
-       /* Relocate the CPU's view of the RAM... */
-       GT_WRITE(GT_SCS10LD_OFS, 0);
-       GT_WRITE(GT_SCS10HD_OFS, 0x0fe00000 >> 21);
-       GT_WRITE(GT_SCS32LD_OFS, 0x10000000 >> 21);
-       GT_WRITE(GT_SCS32HD_OFS, 0x0fe00000 >> 21);
-
-       GT_WRITE(GT_SCS1LD_OFS, 0xff);
-       GT_WRITE(GT_SCS1HD_OFS, 0x00);
-       GT_WRITE(GT_SCS0LD_OFS, 0);
-       GT_WRITE(GT_SCS0HD_OFS, 0xff);
-       GT_WRITE(GT_SCS3LD_OFS, 0xff);
-       GT_WRITE(GT_SCS3HD_OFS, 0x00);
-       GT_WRITE(GT_SCS2LD_OFS, 0);
-       GT_WRITE(GT_SCS2HD_OFS, 0xff);
-
-       /* ...and the PCI0 view of it. */
-       GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000010);
-       GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x00000000);
-       GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
-       GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x10000000);
-       GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x0ffff000);
-       GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x0ffff000);
-
-       tmpword = OCELOT_PLD_READ(BOARDREV);
-       if (tmpword < 26)
-               printk("Momenco Ocelot: Board Assembly Rev. %c\n", 'A'+tmpword);
-       else
-               printk("Momenco Ocelot: Board Assembly Revision #0x%x\n", tmpword);
-
-       tmpword = OCELOT_PLD_READ(PLD1_ID);
-       printk("PLD 1 ID: %d.%d\n", tmpword>>4, tmpword&15);
-       tmpword = OCELOT_PLD_READ(PLD2_ID);
-       printk("PLD 2 ID: %d.%d\n", tmpword>>4, tmpword&15);
-       tmpword = OCELOT_PLD_READ(RESET_STATUS);
-       printk("Reset reason: 0x%x\n", tmpword);
-       reset_reason = tmpword;
-       OCELOT_PLD_WRITE(0xff, RESET_STATUS);
-
-       tmpword = OCELOT_PLD_READ(BOARD_STATUS);
-       printk("Board Status register: 0x%02x\n", tmpword);
-       printk("  - User jumper: %s\n", (tmpword & 0x80)?"installed":"absent");
-       printk("  - Boot flash write jumper: %s\n", (tmpword&0x40)?"installed":"absent");
-       printk("  - Tulip PHY %s connected\n", (tmpword&0x10)?"is":"not");
-       printk("  - L3 Cache size: %d MiB\n", (1<<((tmpword&12) >> 2))&~1);
-       printk("  - SDRAM size: %d MiB\n", 1<<(6+(tmpword&3)));
-
-       if (tmpword&12)
-               l3func((1<<(((tmpword&12) >> 2)+20)));
-
-       switch(tmpword &3) {
-       case 3:
-               /* 512MiB */
-               /* Decoders are allready set -- just add the
-                * appropriate region */
-               add_memory_region( 0x40<<20,  0xC0<<20, BOOT_MEM_RAM);
-               add_memory_region(0x100<<20, 0x100<<20, BOOT_MEM_RAM);
-               break;
-       case 2:
-               /* 256MiB -- two banks of 128MiB */
-               GT_WRITE(GT_SCS10HD_OFS, 0x07e00000 >> 21);
-               GT_WRITE(GT_SCS32LD_OFS, 0x08000000 >> 21);
-               GT_WRITE(GT_SCS32HD_OFS, 0x0fe00000 >> 21);
-
-               GT_WRITE(GT_SCS0HD_OFS, 0x7f);
-               GT_WRITE(GT_SCS2LD_OFS, 0x80);
-               GT_WRITE(GT_SCS2HD_OFS, 0xff);
-
-               /* reconfigure the PCI0 interface view of memory */
-               GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
-               GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x08000000);
-               GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x0ffff000);
-               GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x0ffff000);
-
-               add_memory_region(0x40<<20, 0x40<<20, BOOT_MEM_RAM);
-               add_memory_region(0x80<<20, 0x80<<20, BOOT_MEM_RAM);
-               break;
-       case 1:
-               /* 128MiB -- 64MiB per bank */
-               GT_WRITE(GT_SCS10HD_OFS, 0x03e00000 >> 21);
-               GT_WRITE(GT_SCS32LD_OFS, 0x04000000 >> 21);
-               GT_WRITE(GT_SCS32HD_OFS, 0x07e00000 >> 21);
-
-               GT_WRITE(GT_SCS0HD_OFS, 0x3f);
-               GT_WRITE(GT_SCS2LD_OFS, 0x40);
-               GT_WRITE(GT_SCS2HD_OFS, 0x7f);
-
-               /* reconfigure the PCI0 interface view of memory */
-               GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
-               GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x04000000);
-               GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x03fff000);
-               GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x03fff000);
-
-               /* add the appropriate region */
-               add_memory_region(0x40<<20, 0x40<<20, BOOT_MEM_RAM);
-               break;
-       case 0:
-               /* 64MiB */
-               GT_WRITE(GT_SCS10HD_OFS, 0x01e00000 >> 21);
-               GT_WRITE(GT_SCS32LD_OFS, 0x02000000 >> 21);
-               GT_WRITE(GT_SCS32HD_OFS, 0x03e00000 >> 21);
-
-               GT_WRITE(GT_SCS0HD_OFS, 0x1f);
-               GT_WRITE(GT_SCS2LD_OFS, 0x20);
-               GT_WRITE(GT_SCS2HD_OFS, 0x3f);
-
-               /* reconfigure the PCI0 interface view of memory */
-               GT_WRITE(GT_PCI0_CFGADDR_OFS, 0x80000014);
-               GT_WRITE(GT_PCI0_CFGDATA_OFS, 0x04000000);
-               GT_WRITE(GT_PCI0_BS_SCS10_OFS, 0x01fff000);
-               GT_WRITE(GT_PCI0_BS_SCS32_OFS, 0x01fff000);
-
-               break;
-       }
-
-       /* Fix up the DiskOnChip mapping */
-       GT_WRITE(GT_DEV_B3_OFS, 0xfef73);
-}
-
-extern int rm7k_tcache_enabled;
-/*
- * This runs in KSEG1. See the verbiage in rm7k.c::probe_scache()
- */
-#define Page_Invalidate_T 0x16
-static void __init setup_l3cache(unsigned long size)
-{
-       int register i;
-       unsigned long tmp;
-
-       printk("Enabling L3 cache...");
-
-       /* Enable the L3 cache in the GT64120A's CPU Configuration register */
-       tmp = GT_READ(GT_CPU_OFS);
-       GT_WRITE(GT_CPU_OFS, tmp | (1<<14));
-
-       /* Enable the L3 cache in the CPU */
-       set_c0_config(1<<12 /* CONF_TE */);
-
-       /* Clear the cache */
-       write_c0_taglo(0);
-       write_c0_taghi(0);
-
-       for (i=0; i < size; i+= 4096) {
-               __asm__ __volatile__ (
-                       ".set noreorder\n\t"
-                       ".set mips3\n\t"
-                       "cache %1, (%0)\n\t"
-                       ".set mips0\n\t"
-                       ".set reorder"
-                       :
-                       : "r" (KSEG0ADDR(i)),
-                         "i" (Page_Invalidate_T));
-       }
-
-       /* Let the RM7000 MM code know that the tertiary cache is enabled */
-       rm7k_tcache_enabled = 1;
-
-       printk("Done\n");
-}
-
-
-/* This needs to be one of the first initcalls, because no I/O port access
-   can work before this */
-
-static int io_base_ioremap(void)
-{
-       void *io_remap_range = ioremap(GT_PCI_IO_BASE, GT_PCI_IO_SIZE);
-
-       if (!io_remap_range) {
-               panic("Could not ioremap I/O port range");
-       }
-       set_io_port_base(io_remap_range - GT_PCI_IO_BASE);
-
-       return 0;
-}
-
-module_init(io_base_ioremap);
index e4250435ad893b5823dc4bbd9f22c1cdd10cbf39..bef15c90ae15c096b06a124284db79e4edbca57b 100644 (file)
@@ -10,3 +10,5 @@
 #
 
 obj-y += irq.o reset.o setup.o time.o pci.o
+
+EXTRA_CFLAGS += -Werror
index ae4c402b500421f4877d22aae1249dc4e22fa07d..575a9442bc82eafb9dc05ede805258e6f3ac517f 100644 (file)
@@ -3,3 +3,5 @@
 #
 
 obj-y          := irq.o jazzdma.o jazz-platform.o reset.o setup.o
+
+EXTRA_CFLAGS += -Werror
index 01e7db19bcbe23a02a151349c54374eedbfd9d64..8fd4fcccf10eb0afe1c73ae97ad7f43e4154b9d7 100644 (file)
@@ -3,3 +3,5 @@
 #
 
 obj-y   += prom.o puts.o
+
+EXTRA_CFLAGS += -Werror
index 8d00ba460cef9de3ab8eec142f30e272de93729d..d86e30dca8f37f22dbab4cb2c92176689c129e21 100644 (file)
@@ -4,3 +4,5 @@
 
 obj-y                          += init.o irq.o setup.o
 obj-$(CONFIG_KGDB)             += kgdb_io.o
+
+EXTRA_CFLAGS += -Werror
index 5c8085b6d7ab944d1e0efbcc70ba270eaa2bafe4..07344cb375969c2d8ac4b6d2128ce3c9e382f9ab 100644 (file)
@@ -71,3 +71,5 @@ obj-$(CONFIG_EARLY_PRINTK)    += early_printk.o
 CFLAGS_cpu-bugs64.o    = $(shell if $(CC) $(CFLAGS) -Wa,-mdaddi -c -o /dev/null -xc /dev/null >/dev/null 2>&1; then echo "-DHAVE_AS_SET_DADDI"; fi)
 
 obj-$(CONFIG_HAVE_STD_PC_SERIAL_PORT)  += 8250-platform.o
+
+EXTRA_CFLAGS += -Werror
index 3b27309d54b18542b51e601780c32fefa513901b..013327286c26bf964f1bea967adff51ce7f2ac75 100644 (file)
@@ -132,7 +132,6 @@ void output_thread_defines(void)
        offset("#define THREAD_ECODE   ", struct task_struct, \
               thread.error_code);
        offset("#define THREAD_TRAPNO  ", struct task_struct, thread.trap_no);
-       offset("#define THREAD_MFLAGS  ", struct task_struct, thread.mflags);
        offset("#define THREAD_TRAMP   ", struct task_struct, \
               thread.irix_trampoline);
        offset("#define THREAD_OLDCTX  ", struct task_struct, \
index c15bbc436bbd89a27fb64c65645fb6e4c847ccdb..e46782b0ebc8cff3c293fecbd5b0f0a5ed8e833c 100644 (file)
        .fill   0x400
 #endif
 
-EXPORT(stext)                                  # used for profiling
 EXPORT(_stext)
 
 #ifndef CONFIG_BOOT_RAW
index c6580018c94b3b5a7bf690046bc58ee86a29ee41..cb9a14a1ca5bba1039953f536d7a3834198c789e 100644 (file)
@@ -89,7 +89,7 @@ static int sp_stopping = 0;
 #define MTSP_O_EXCL            0x0800
 #define MTSP_O_BINARY          0x8000
 
-#define SP_VPE 1
+extern int tclimit;
 
 struct apsp_table  {
        int sp;
@@ -225,8 +225,8 @@ void sp_work_handle_request(void)
        /* Run the syscall at the priviledge of the user who loaded the
           SP program */
 
-       if (vpe_getuid(SP_VPE))
-               sp_setfsuidgid( vpe_getuid(SP_VPE), vpe_getgid(SP_VPE));
+       if (vpe_getuid(tclimit))
+               sp_setfsuidgid(vpe_getuid(tclimit), vpe_getgid(tclimit));
 
        switch (sc.cmd) {
        /* needs the flags argument translating from SDE kit to
@@ -245,7 +245,7 @@ void sp_work_handle_request(void)
 
        case MTSP_SYSCALL_EXIT:
                list_for_each_entry(n, &kspd_notifylist, list)
-                       n->kspd_sp_exit(SP_VPE);
+                       n->kspd_sp_exit(tclimit);
                sp_stopping = 1;
 
                printk(KERN_DEBUG "KSPD got exit syscall from SP exitcode %d\n",
@@ -255,7 +255,7 @@ void sp_work_handle_request(void)
        case MTSP_SYSCALL_OPEN:
                generic.arg1 = translate_open_flags(generic.arg1);
 
-               vcwd = vpe_getcwd(SP_VPE);
+               vcwd = vpe_getcwd(tclimit);
 
                /* change to the cwd of the process that loaded the SP program */
                old_fs = get_fs();
@@ -283,7 +283,7 @@ void sp_work_handle_request(void)
                break;
        } /* switch */
 
-       if (vpe_getuid(SP_VPE))
+       if (vpe_getuid(tclimit))
                sp_setfsuidgid( 0, 0);
 
        old_fs = get_fs();
@@ -364,10 +364,9 @@ static void startwork(int vpe)
                }
 
                INIT_WORK(&work, sp_work);
-               queue_work(workqueue, &work);
-       } else
-               queue_work(workqueue, &work);
+       }
 
+       queue_work(workqueue, &work);
 }
 
 static void stopwork(int vpe)
@@ -389,7 +388,7 @@ static int kspd_module_init(void)
 
        notify.start = startwork;
        notify.stop = stopwork;
-       vpe_notify(SP_VPE, &notify);
+       vpe_notify(tclimit, &notify);
 
        return 0;
 }
index c37568d6fb55d7133550dfc1e53a577288808933..135d9a5fe337c9f232eb39704ac6cef4c104ccb1 100644 (file)
@@ -566,6 +566,13 @@ asmlinkage long sys32_fadvise64_64(int fd, int __pad,
                        flags);
 }
 
+asmlinkage long sys32_fallocate(int fd, int mode, unsigned offset_a2,
+       unsigned offset_a3, unsigned len_a4, unsigned len_a5)
+{
+       return sys_fallocate(fd, mode, merge_64(offset_a2, offset_a3),
+                            merge_64(len_a4, len_a5));
+}
+
 save_static_function(sys32_clone);
 static int noinline __used
 _sys32_clone(nabi_no_regargs struct pt_regs regs)
index 8f42fa85ac9e4e274ae46aaf9b22b14f8303fe3c..22960d67cf07c29a6340be7c542b31b98f7ca2aa 100644 (file)
@@ -14,7 +14,7 @@
 #include <asm/page.h>
 
 extern const unsigned char relocate_new_kernel[];
-extern const unsigned int relocate_new_kernel_size;
+extern const size_t relocate_new_kernel_size;
 
 extern unsigned long kexec_start_address;
 extern unsigned long kexec_indirection_page;
@@ -40,6 +40,8 @@ machine_crash_shutdown(struct pt_regs *regs)
 {
 }
 
+typedef void (*noretfun_t)(void) __attribute__((noreturn));
+
 void
 machine_kexec(struct kimage *image)
 {
@@ -51,7 +53,8 @@ machine_kexec(struct kimage *image)
          (unsigned long)page_address(image->control_code_page);
 
        kexec_start_address = image->start;
-       kexec_indirection_page = phys_to_virt(image->head & PAGE_MASK);
+       kexec_indirection_page =
+               (unsigned long) phys_to_virt(image->head & PAGE_MASK);
 
        memcpy((void*)reboot_code_buffer, relocate_new_kernel,
               relocate_new_kernel_size);
@@ -67,7 +70,7 @@ machine_kexec(struct kimage *image)
               phys_to_virt(entry & PAGE_MASK) : ptr + 1) {
                if (*ptr & IND_SOURCE || *ptr & IND_INDIRECTION ||
                    *ptr & IND_DESTINATION)
-                       *ptr = phys_to_virt(*ptr);
+                       *ptr = (unsigned long) phys_to_virt(*ptr);
        }
 
        /*
@@ -78,8 +81,8 @@ machine_kexec(struct kimage *image)
        flush_icache_range(reboot_code_buffer,
                           reboot_code_buffer + KEXEC_CONTROL_CODE_SIZE);
 
-       printk("Will call new kernel at %08x\n", image->start);
+       printk("Will call new kernel at %08lx\n", image->start);
        printk("Bye ...\n");
        flush_cache_all();
-       ((void (*)(void))reboot_code_buffer)();
+       ((noretfun_t) reboot_code_buffer)();
 }
index ede5d73d652e3d47c280c035aa52ad18def60539..892665bb12b1ec766491222ac67c2f9103c12ef4 100644 (file)
@@ -50,6 +50,7 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
        cpumask_t effective_mask;
        int retval;
        struct task_struct *p;
+       struct thread_info *ti;
 
        if (len < sizeof(new_mask))
                return -EINVAL;
@@ -93,16 +94,16 @@ asmlinkage long mipsmt_sys_sched_setaffinity(pid_t pid, unsigned int len,
        read_unlock(&tasklist_lock);
 
        /* Compute new global allowed CPU set if necessary */
-       if ((p->thread.mflags & MF_FPUBOUND)
-       && cpus_intersects(new_mask, mt_fpu_cpumask)) {
+       ti = task_thread_info(p);
+       if (test_ti_thread_flag(ti, TIF_FPUBOUND) &&
+           cpus_intersects(new_mask, mt_fpu_cpumask)) {
                cpus_and(effective_mask, new_mask, mt_fpu_cpumask);
                retval = set_cpus_allowed(p, effective_mask);
        } else {
-               p->thread.mflags &= ~MF_FPUBOUND;
+               clear_ti_thread_flag(ti, TIF_FPUBOUND);
                retval = set_cpus_allowed(p, new_mask);
        }
 
-
 out_unlock:
        put_task_struct(p);
        unlock_cpu_hotplug();
index 1a7d89231299f23dc6aaffff47e8fdbe86b3a42e..7169a4db37b8d6f3ab0742ae2053ef047245b6f7 100644 (file)
 #include <asm/r4kcache.h>
 #include <asm/cacheflush.h>
 
+int vpelimit;
+
+static int __init maxvpes(char *str)
+{
+       get_option(&str, &vpelimit);
+
+       return 1;
+}
+
+__setup("maxvpes=", maxvpes);
+
+int tclimit;
+
+static int __init maxtcs(char *str)
+{
+       get_option(&str, &tclimit);
+
+       return 1;
+}
+
+__setup("maxtcs=", maxtcs);
+
 /*
  * Dump new MIPS MT state for the core. Does not leave TCs halted.
  * Takes an argument which taken to be a pre-call MVPControl value.
index bd05f5a927eaac4c7983f19100353876cc34aed9..e6ce943099a040d06d466adb3470a7454d320f60 100644 (file)
@@ -77,7 +77,7 @@ void start_thread(struct pt_regs * regs, unsigned long pc, unsigned long sp)
        status = regs->cp0_status & ~(ST0_CU0|ST0_CU1|KU_MASK);
 #ifdef CONFIG_64BIT
        status &= ~ST0_FR;
-       status |= (current->thread.mflags & MF_32BIT_REGS) ? 0 : ST0_FR;
+       status |= test_thread_flag(TIF_32BIT_REGS) ? 0 : ST0_FR;
 #endif
        status |= KU_USER;
        regs->cp0_status = status;
index 893e7bccf2265c58ceea847db33824c393d502c5..bbd57b20b43ef400da5334deecdd88611a16e8b2 100644 (file)
 #include <linux/mm.h>
 #include <linux/errno.h>
 #include <linux/ptrace.h>
-#include <linux/audit.h>
 #include <linux/smp.h>
 #include <linux/user.h>
 #include <linux/security.h>
-#include <linux/signal.h>
+#include <linux/audit.h>
+#include <linux/seccomp.h>
 
 #include <asm/byteorder.h>
 #include <asm/cpu.h>
@@ -470,12 +470,17 @@ static inline int audit_arch(void)
  */
 asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
 {
+       /* do the secure computing check first */
+       if (!entryexit)
+               secure_computing(regs->regs[0]);
+
        if (unlikely(current->audit_context) && entryexit)
                audit_syscall_exit(AUDITSC_RESULT(regs->regs[2]),
                                   regs->regs[2]);
 
        if (!(current->ptrace & PT_PTRACED))
                goto out;
+
        if (!test_thread_flag(TIF_SYSCALL_TRACE))
                goto out;
 
@@ -493,9 +498,10 @@ asmlinkage void do_syscall_trace(struct pt_regs *regs, int entryexit)
                send_sig(current->exit_code, current, 1);
                current->exit_code = 0;
        }
- out:
+
+out:
        if (unlikely(current->audit_context) && !entryexit)
-               audit_syscall_entry(audit_arch(), regs->regs[2],
+               audit_syscall_entry(audit_arch(), regs->regs[0],
                                    regs->regs[4], regs->regs[5],
                                    regs->regs[6], regs->regs[7]);
 }
index a3f0d00c13349aecae7997c97b530c5ea417c070..87481f916a61bb4ed8743a5d1b2b5b3778639daa 100644 (file)
 #include <asm/stackframe.h>
 #include <asm/addrspace.h>
 
-       .globl relocate_new_kernel
-relocate_new_kernel:
-
-       PTR_L   s0, kexec_indirection_page
-       PTR_L   s1, kexec_start_address
+LEAF(relocate_new_kernel)
+       PTR_L           s0, kexec_indirection_page
+       PTR_L           s1, kexec_start_address
 
 process_entry:
-       PTR_L   s2, (s0)
-       PTR_ADD s0, s0, SZREG
+       PTR_L           s2, (s0)
+       PTR_ADD         s0, s0, SZREG
 
        /* destination page */
-       and     s3, s2, 0x1
-       beq     s3, zero, 1f
-       and     s4, s2, ~0x1    /* store destination addr in s4 */
-       move    a0, s4
-       b       process_entry
+       and             s3, s2, 0x1
+       beq             s3, zero, 1f
+       and             s4, s2, ~0x1    /* store destination addr in s4 */
+       move            a0, s4
+       b               process_entry
 
 1:
        /* indirection page, update s0  */
-       and     s3, s2, 0x2
-       beq     s3, zero, 1f
-       and     s0, s2, ~0x2
-       b       process_entry
+       and             s3, s2, 0x2
+       beq             s3, zero, 1f
+       and             s0, s2, ~0x2
+       b               process_entry
 
 1:
        /* done page */
-       and     s3, s2, 0x4
-       beq     s3, zero, 1f
-       b       done
+       and             s3, s2, 0x4
+       beq             s3, zero, 1f
+       b               done
 1:
        /* source page */
-       and     s3, s2, 0x8
-       beq     s3, zero, process_entry
-       and     s2, s2, ~0x8
-       li      s6, (1 << PAGE_SHIFT) / SZREG
+       and             s3, s2, 0x8
+       beq             s3, zero, process_entry
+       and             s2, s2, ~0x8
+       li              s6, (1 << PAGE_SHIFT) / SZREG
 
 copy_word:
        /* copy page word by word */
-       REG_L   s5, (s2)
-       REG_S   s5, (s4)
-       INT_ADD s4, s4, SZREG
-       INT_ADD s2, s2, SZREG
-       INT_SUB s6, s6, 1
-       beq     s6, zero, process_entry
-       b       copy_word
-       b       process_entry
+       REG_L           s5, (s2)
+       REG_S           s5, (s4)
+       PTR_ADD         s4, s4, SZREG
+       PTR_ADD         s2, s2, SZREG
+       LONG_SUB        s6, s6, 1
+       beq             s6, zero, process_entry
+       b               copy_word
+       b               process_entry
 
 done:
        /* jump to kexec_start_address */
-       j       s1
+       j               s1
+       END(relocate_new_kernel)
 
-       .globl kexec_start_address
 kexec_start_address:
-       .long   0x0
+       EXPORT(kexec_start_address)
+       PTR             0x0
+       .size           kexec_start_address, PTRSIZE
 
-       .globl kexec_indirection_page
 kexec_indirection_page:
-       .long   0x0
+       EXPORT(kexec_indirection_page)
+       PTR             0
+       .size           kexec_indirection_page, PTRSIZE
 
 relocate_new_kernel_end:
 
-       .globl relocate_new_kernel_size
 relocate_new_kernel_size:
-       .long relocate_new_kernel_end - relocate_new_kernel
+       EXPORT(relocate_new_kernel_size)
+       PTR             relocate_new_kernel_end - relocate_new_kernel
+       .size           relocate_new_kernel_size, PTRSIZE
index 8cf24d716d418f56c1221de16154fa242724c4d8..aab89e97abb530a109025e8fb039caca8375d97a 100644 (file)
 #include <asm/atomic.h>
 #include <asm/cpu.h>
 #include <asm/processor.h>
+#include <asm/mips_mt.h>
 #include <asm/system.h>
 #include <asm/vpe.h>
 #include <asm/rtlx.h>
 
-#define RTLX_TARG_VPE 1
-
 static struct rtlx_info *rtlx;
 static int major;
 static char module_name[] = "rtlx";
@@ -165,10 +164,10 @@ int rtlx_open(int index, int can_sleep)
        }
 
        if (rtlx == NULL) {
-               if( (p = vpe_get_shared(RTLX_TARG_VPE)) == NULL) {
+               if( (p = vpe_get_shared(tclimit)) == NULL) {
                        if (can_sleep) {
                                __wait_event_interruptible(channel_wqs[index].lx_queue,
-                                                          (p = vpe_get_shared(RTLX_TARG_VPE)),
+                                                          (p = vpe_get_shared(tclimit)),
                                                           ret);
                                if (ret)
                                        goto out_fail;
@@ -472,11 +471,24 @@ static int rtlx_irq_num = MIPS_CPU_IRQ_BASE + MIPS_CPU_RTLX_IRQ;
 static char register_chrdev_failed[] __initdata =
        KERN_ERR "rtlx_module_init: unable to register device\n";
 
-static int rtlx_module_init(void)
+static int __init rtlx_module_init(void)
 {
        struct device *dev;
        int i, err;
 
+       if (!cpu_has_mipsmt) {
+               printk("VPE loader: not a MIPS MT capable processor\n");
+               return -ENODEV;
+       }
+
+       if (tclimit == 0) {
+               printk(KERN_WARNING "No TCs reserved for AP/SP, not "
+                      "initializing RTLX.\nPass maxtcs=<n> argument as kernel "
+                      "argument\n");
+
+               return -ENODEV;
+       }
+
        major = register_chrdev(0, module_name, &rtlx_fops);
        if (major < 0) {
                printk(register_chrdev_failed);
@@ -501,7 +513,7 @@ static int rtlx_module_init(void)
        /* set up notifiers */
        notify.start = starting;
        notify.stop = stopping;
-       vpe_notify(RTLX_TARG_VPE, &notify);
+       vpe_notify(tclimit, &notify);
 
        if (cpu_has_vint)
                set_vi_handler(MIPS_CPU_RTLX_IRQ, rtlx_dispatch);
index ae985d1fcca12cb6722fc371f681ff3bce9000a1..82480a1717d892eb6b07db692055c643851c0e44 100644 (file)
@@ -662,6 +662,7 @@ einval:     li      v0, -EINVAL
        sys     sys_signalfd            3
        sys     sys_timerfd             4
        sys     sys_eventfd             1
+       sys     sys_fallocate           6       /* 4320 */
        .endm
 
        /* We pre-compute the number of _instruction_ bytes needed to
index 7bcd5a1a85f593ad818abe3e763b08ab1f705db3..c2c10876da2e2a85d4ad9299111bddf004fb58f6 100644 (file)
@@ -477,4 +477,5 @@ sys_call_table:
        PTR     sys_signalfd
        PTR     sys_timerfd
        PTR     sys_eventfd
+       PTR     sys_fallocate
        .size   sys_call_table,.-sys_call_table
index 532a2f3b42fc53c1498abfae16ca6289649b3eee..53d7a977193c6172d581cab48e43f4551ec8e5af 100644 (file)
@@ -403,4 +403,5 @@ EXPORT(sysn32_call_table)
        PTR     compat_sys_signalfd             /* 5280 */
        PTR     compat_sys_timerfd
        PTR     sys_eventfd
+       PTR     sys_fallocate
        .size   sysn32_call_table,.-sysn32_call_table
index 6bbe0f4ed8ba757dc6c3c897c6ab5618a6ec3aac..b3ed731a24c6ad41c293101826f56958a8d4d7ca 100644 (file)
@@ -525,4 +525,5 @@ sys_call_table:
        PTR     compat_sys_signalfd
        PTR     compat_sys_timerfd
        PTR     sys_eventfd
+       PTR     sys_fallocate                   /* 4320 */
        .size   sys_call_table,.-sys_call_table
index 486b8e5f52d0b5e3f21e17b82f5a70f5cb3a3c17..64b612a0a6220041cf37d67d7fece79f878c4f94 100644 (file)
@@ -18,7 +18,6 @@
 #include <linux/errno.h>
 #include <linux/wait.h>
 #include <linux/ptrace.h>
-#include <linux/compat.h>
 #include <linux/suspend.h>
 #include <linux/compiler.h>
 #include <linux/uaccess.h>
index be7362bc2c9a6ef7340bf811d1260dd09cd5cef4..73b0dab026687751266bd16bc15a276037d9d5b8 100644 (file)
@@ -30,6 +30,7 @@
 #include <linux/sched.h>
 #include <linux/cpumask.h>
 #include <linux/cpu.h>
+#include <linux/err.h>
 
 #include <asm/atomic.h>
 #include <asm/cpu.h>
@@ -193,6 +194,61 @@ void smp_call_function_interrupt(void)
        }
 }
 
+int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
+                            int retry, int wait)
+{
+       struct call_data_struct data;
+       int me;
+
+       /*
+        * Can die spectacularly if this CPU isn't yet marked online
+        */
+       if (!cpu_online(cpu))
+               return 0;
+
+       me = get_cpu();
+       BUG_ON(!cpu_online(me));
+
+       if (cpu == me) {
+               local_irq_disable();
+               func(info);
+               local_irq_enable();
+               put_cpu();
+               return 0;
+       }
+
+       /* Can deadlock when called with interrupts disabled */
+       WARN_ON(irqs_disabled());
+
+       data.func = func;
+       data.info = info;
+       atomic_set(&data.started, 0);
+       data.wait = wait;
+       if (wait)
+               atomic_set(&data.finished, 0);
+
+       spin_lock(&smp_call_lock);
+       call_data = &data;
+       smp_mb();
+
+       /* Send a message to the other CPU */
+       core_send_ipi(cpu, SMP_CALL_FUNCTION);
+
+       /* Wait for response */
+       /* FIXME: lock-up detection, backtrace on lock-up */
+       while (atomic_read(&data.started) != 1)
+               barrier();
+
+       if (wait)
+               while (atomic_read(&data.finished) != 1)
+                       barrier();
+       call_data = NULL;
+       spin_unlock(&smp_call_lock);
+
+       put_cpu();
+       return 0;
+}
+
 static void stop_this_cpu(void *dummy)
 {
        /*
index 342d873b2ecc8bf6185a1137777408af54a42cc2..16aa5d37117c03049034d3c52755548015e2d55a 100644 (file)
@@ -86,25 +86,11 @@ unsigned int smtc_status = 0;
 
 /* Boot command line configuration overrides */
 
-static int vpelimit = 0;
-static int tclimit = 0;
 static int ipibuffers = 0;
 static int nostlb = 0;
 static int asidmask = 0;
 unsigned long smtc_asid_mask = 0xff;
 
-static int __init maxvpes(char *str)
-{
-       get_option(&str, &vpelimit);
-       return 1;
-}
-
-static int __init maxtcs(char *str)
-{
-       get_option(&str, &tclimit);
-       return 1;
-}
-
 static int __init ipibufs(char *str)
 {
        get_option(&str, &ipibuffers);
@@ -137,8 +123,6 @@ static int __init asidmask_set(char *str)
        return 1;
 }
 
-__setup("maxvpes=", maxvpes);
-__setup("maxtcs=", maxtcs);
 __setup("ipibufs=", ipibufs);
 __setup("nostlb", stlb_disable);
 __setup("asidmask=", asidmask_set);
@@ -168,9 +152,9 @@ static int __init tintq(char *str)
 
 __setup("tintq=", tintq);
 
-int imstuckcount[2][8];
+static int imstuckcount[2][8];
 /* vpemask represents IM/IE bits of per-VPE Status registers, low-to-high */
-int vpemask[2][8] = {
+static int vpemask[2][8] = {
        {0, 0, 1, 0, 0, 0, 0, 1},
        {0, 0, 0, 0, 0, 0, 0, 1}
 };
@@ -540,7 +524,7 @@ void mipsmt_prepare_cpus(void)
  * (unsigned long)idle->thread_info the gp
  *
  */
-void smtc_boot_secondary(int cpu, struct task_struct *idle)
+void __cpuinit smtc_boot_secondary(int cpu, struct task_struct *idle)
 {
        extern u32 kernelsp[NR_CPUS];
        long flags;
@@ -876,7 +860,7 @@ void deferred_smtc_ipi(void)
  * Send clock tick to all TCs except the one executing the funtion
  */
 
-void smtc_timer_broadcast(int vpe)
+void smtc_timer_broadcast(void)
 {
        int cpu;
        int myTC = cpu_data[smp_processor_id()].tc_id;
@@ -975,7 +959,12 @@ static void ipi_irq_dispatch(void)
        do_IRQ(cpu_ipi_irq);
 }
 
-static struct irqaction irq_ipi;
+static struct irqaction irq_ipi = {
+       .handler        = ipi_interrupt,
+       .flags          = IRQF_DISABLED,
+       .name           = "SMTC_IPI",
+       .flags          = IRQF_PERCPU
+};
 
 static void setup_cross_vpe_interrupts(unsigned int nvpe)
 {
@@ -987,13 +976,8 @@ static void setup_cross_vpe_interrupts(unsigned int nvpe)
 
        set_vi_handler(MIPS_CPU_IPI_IRQ, ipi_irq_dispatch);
 
-       irq_ipi.handler = ipi_interrupt;
-       irq_ipi.flags = IRQF_DISABLED;
-       irq_ipi.name = "SMTC_IPI";
-
        setup_irq_smtc(cpu_ipi_irq, &irq_ipi, (0x100 << MIPS_CPU_IPI_IRQ));
 
-       irq_desc[cpu_ipi_irq].status |= IRQ_PER_CPU;
        set_irq_handler(cpu_ipi_irq, handle_percpu_irq);
 }
 
index b53f7edbc159dffbb111c4863dfdabedbe58c95a..7c800ec3ff557791ac571c82dbc454bd8b134c17 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/errno.h>
 #include <linux/linkage.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/mman.h>
 #include <linux/ptrace.h>
@@ -280,16 +281,24 @@ asmlinkage int sys_set_thread_area(unsigned long addr)
 
 asmlinkage int _sys_sysmips(int cmd, long arg1, int arg2, int arg3)
 {
-       int     tmp;
-
-       switch(cmd) {
+       switch (cmd) {
        case MIPS_ATOMIC_SET:
                printk(KERN_CRIT "How did I get here?\n");
                return -EINVAL;
 
        case MIPS_FIXADE:
-               tmp = current->thread.mflags & ~3;
-               current->thread.mflags = tmp | (arg1 & 3);
+               if (arg1 & ~3)
+                       return -EINVAL;
+
+               if (arg1 & 1)
+                       set_thread_flag(TIF_FIXADE);
+               else
+                       clear_thread_flag(TIF_FIXADE);
+               if (arg1 & 2)
+                       set_thread_flag(TIF_LOGADE);
+               else
+                       clear_thread_flag(TIF_FIXADE);
+
                return 0;
 
        case FLUSH_CACHE:
index ce277cb34dd0dab366a8ab3cc608fbbb8514c4ff..c8e291c83057bb1020b01092c5a7f64b2e96c521 100644 (file)
@@ -775,7 +775,7 @@ static void mt_ase_fp_affinity(void)
                        cpus_and(tmask, current->thread.user_cpus_allowed,
                                 mt_fpu_cpumask);
                        set_cpus_allowed(current, tmask);
-                       current->thread.mflags |= MF_FPUBOUND;
+                       set_thread_flag(TIF_FPUBOUND);
                }
        }
 #endif /* CONFIG_MIPS_MT_FPAFF */
index 8b9c34ffae184fecf7fe720eaa0b596305194fe9..d34b1fb3665d01507b2eb94f470f4d4300cb4cca 100644 (file)
@@ -101,16 +101,14 @@ static u32 unaligned_action;
 #endif
 extern void show_registers(struct pt_regs *regs);
 
-static inline int emulate_load_store_insn(struct pt_regs *regs,
-       void __user *addr, unsigned int __user *pc,
-       unsigned long **regptr, unsigned long *newvalue)
+static void emulate_load_store_insn(struct pt_regs *regs,
+       void __user *addr, unsigned int __user *pc)
 {
        union mips_instruction insn;
        unsigned long value;
        unsigned int res;
 
        regs->regs[0] = 0;
-       *regptr=NULL;
 
        /*
         * This load never faults.
@@ -179,8 +177,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                        : "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
-               *newvalue = value;
-               *regptr = &regs->regs[insn.i_format.rt];
+               compute_return_epc(regs);
+               regs->regs[insn.i_format.rt] = value;
                break;
 
        case lw_op:
@@ -209,8 +207,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                        : "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
-               *newvalue = value;
-               *regptr = &regs->regs[insn.i_format.rt];
+               compute_return_epc(regs);
+               regs->regs[insn.i_format.rt] = value;
                break;
 
        case lhu_op:
@@ -243,8 +241,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                        : "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
-               *newvalue = value;
-               *regptr = &regs->regs[insn.i_format.rt];
+               compute_return_epc(regs);
+               regs->regs[insn.i_format.rt] = value;
                break;
 
        case lwu_op:
@@ -283,8 +281,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                        : "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
-               *newvalue = value;
-               *regptr = &regs->regs[insn.i_format.rt];
+               compute_return_epc(regs);
+               regs->regs[insn.i_format.rt] = value;
                break;
 #endif /* CONFIG_64BIT */
 
@@ -325,8 +323,8 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                        : "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
-               *newvalue = value;
-               *regptr = &regs->regs[insn.i_format.rt];
+               compute_return_epc(regs);
+               regs->regs[insn.i_format.rt] = value;
                break;
 #endif /* CONFIG_64BIT */
 
@@ -367,6 +365,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                        : "r" (value), "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
+               compute_return_epc(regs);
                break;
 
        case sw_op:
@@ -397,6 +396,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                : "r" (value), "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
+               compute_return_epc(regs);
                break;
 
        case sd_op:
@@ -435,6 +435,7 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
                : "r" (value), "r" (addr), "i" (-EFAULT));
                if (res)
                        goto fault;
+               compute_return_epc(regs);
                break;
 #endif /* CONFIG_64BIT */
 
@@ -473,34 +474,31 @@ static inline int emulate_load_store_insn(struct pt_regs *regs,
        unaligned_instructions++;
 #endif
 
-       return 0;
+       return;
 
 fault:
        /* Did we have an exception handler installed? */
        if (fixup_exception(regs))
-               return 1;
+               return;
 
        die_if_kernel ("Unhandled kernel unaligned access", regs);
        send_sig(SIGSEGV, current, 1);
 
-       return 0;
+       return;
 
 sigbus:
        die_if_kernel("Unhandled kernel unaligned access", regs);
        send_sig(SIGBUS, current, 1);
 
-       return 0;
+       return;
 
 sigill:
        die_if_kernel("Unhandled kernel unaligned access or invalid instruction", regs);
        send_sig(SIGILL, current, 1);
-
-       return 0;
 }
 
 asmlinkage void do_ade(struct pt_regs *regs)
 {
-       unsigned long *regptr, newval;
        extern int do_dsemulret(struct pt_regs *);
        unsigned int __user *pc;
        mm_segment_t seg;
@@ -524,7 +522,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
                goto sigbus;
 
        pc = (unsigned int __user *) exception_epc(regs);
-       if (user_mode(regs) && (current->thread.mflags & MF_FIXADE) == 0)
+       if (user_mode(regs) && !test_thread_flag(TIF_FIXADE))
                goto sigbus;
        if (unaligned_action == UNALIGNED_ACTION_SIGNAL)
                goto sigbus;
@@ -538,16 +536,7 @@ asmlinkage void do_ade(struct pt_regs *regs)
        seg = get_fs();
        if (!user_mode(regs))
                set_fs(KERNEL_DS);
-       if (!emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc,
-                                    &regptr, &newval)) {
-               compute_return_epc(regs);
-               /*
-                * Now that branch is evaluated, update the dest
-                * register if necessary
-                */
-               if (regptr)
-                       *regptr = newval;
-       }
+       emulate_load_store_insn(regs, (void __user *)regs->cp0_badvaddr, pc);
        set_fs(seg);
 
        return;
index a2bee10f04cf6ae3441b5b0f71e331383209cc1a..3c09b9785f4cbfe8708bcc51bb8026648126f34e 100644 (file)
@@ -27,7 +27,6 @@
  * To load and run, simply cat a SP 'program file' to /dev/vpe1.
  * i.e cat spapp >/dev/vpe1.
  */
-
 #include <linux/kernel.h>
 #include <linux/device.h>
 #include <linux/module.h>
@@ -54,6 +53,7 @@
 #include <asm/system.h>
 #include <asm/vpe.h>
 #include <asm/kspd.h>
+#include <asm/mips_mt.h>
 
 typedef void *vpe_handle;
 
@@ -64,6 +64,10 @@ typedef void *vpe_handle;
 /* If this is set, the section belongs in the init part of the module */
 #define INIT_OFFSET_MASK (1UL << (BITS_PER_LONG-1))
 
+/*
+ * The number of TCs and VPEs physically available on the core
+ */
+static int hw_tcs, hw_vpes;
 static char module_name[] = "vpe";
 static int major;
 static const int minor = 1;    /* fixed for now  */
@@ -126,20 +130,17 @@ struct vpe {
 
        /* the list of who wants to know when something major happens */
        struct list_head notify;
+
+       unsigned int ntcs;
 };
 
 struct tc {
        enum tc_state state;
        int index;
 
-       /* parent VPE */
-       struct vpe *pvpe;
-
-       /* The list of TC's with this VPE */
-       struct list_head tc;
-
-       /* The global list of tc's */
-       struct list_head list;
+       struct vpe *pvpe;       /* parent VPE */
+       struct list_head tc;    /* The list of TC's with this VPE */
+       struct list_head list;  /* The global list of tc's */
 };
 
 struct {
@@ -217,18 +218,17 @@ struct vpe *alloc_vpe(int minor)
 /* allocate a tc. At startup only tc0 is running, all other can be halted. */
 struct tc *alloc_tc(int index)
 {
-       struct tc *t;
+       struct tc *tc;
 
-       if ((t = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL) {
-               return NULL;
-       }
-
-       INIT_LIST_HEAD(&t->tc);
-       list_add_tail(&t->list, &vpecontrol.tc_list);
+       if ((tc = kzalloc(sizeof(struct tc), GFP_KERNEL)) == NULL)
+               goto out;
 
-       t->index = index;
+       INIT_LIST_HEAD(&tc->tc);
+       tc->index = index;
+       list_add_tail(&tc->list, &vpecontrol.tc_list);
 
-       return t;
+out:
+       return tc;
 }
 
 /* clean up and free everything */
@@ -663,66 +663,48 @@ static void dump_elfsymbols(Elf_Shdr * sechdrs, unsigned int symindex,
 }
 #endif
 
-static void dump_tc(struct tc *t)
-{
-       unsigned long val;
-
-       settc(t->index);
-       printk(KERN_DEBUG "VPE loader: TC index %d targtc %ld "
-              "TCStatus 0x%lx halt 0x%lx\n",
-              t->index, read_c0_vpecontrol() & VPECONTROL_TARGTC,
-              read_tc_c0_tcstatus(), read_tc_c0_tchalt());
-
-       printk(KERN_DEBUG " tcrestart 0x%lx\n", read_tc_c0_tcrestart());
-       printk(KERN_DEBUG " tcbind 0x%lx\n", read_tc_c0_tcbind());
-
-       val = read_c0_vpeconf0();
-       printk(KERN_DEBUG " VPEConf0 0x%lx MVP %ld\n", val,
-              (val & VPECONF0_MVP) >> VPECONF0_MVP_SHIFT);
-
-       printk(KERN_DEBUG " c0 status 0x%lx\n", read_vpe_c0_status());
-       printk(KERN_DEBUG " c0 cause 0x%lx\n", read_vpe_c0_cause());
-
-       printk(KERN_DEBUG " c0 badvaddr 0x%lx\n", read_vpe_c0_badvaddr());
-       printk(KERN_DEBUG " c0 epc 0x%lx\n", read_vpe_c0_epc());
-}
-
-static void dump_tclist(void)
-{
-       struct tc *t;
-
-       list_for_each_entry(t, &vpecontrol.tc_list, list) {
-               dump_tc(t);
-       }
-}
-
 /* We are prepared so configure and start the VPE... */
 static int vpe_run(struct vpe * v)
 {
+       unsigned long flags, val, dmt_flag;
        struct vpe_notifications *n;
-       unsigned long val, dmt_flag;
+       unsigned int vpeflags;
        struct tc *t;
 
        /* check we are the Master VPE */
+       local_irq_save(flags);
        val = read_c0_vpeconf0();
        if (!(val & VPECONF0_MVP)) {
                printk(KERN_WARNING
                       "VPE loader: only Master VPE's are allowed to configure MT\n");
+               local_irq_restore(flags);
+
                return -1;
        }
 
-       /* disable MT (using dvpe) */
-       dvpe();
+       dmt_flag = dmt();
+       vpeflags = dvpe();
 
        if (!list_empty(&v->tc)) {
                if ((t = list_entry(v->tc.next, struct tc, tc)) == NULL) {
-                       printk(KERN_WARNING "VPE loader: TC %d is already in use.\n",
-                              t->index);
+                       evpe(vpeflags);
+                       emt(dmt_flag);
+                       local_irq_restore(flags);
+
+                       printk(KERN_WARNING
+                              "VPE loader: TC %d is already in use.\n",
+                               t->index);
                        return -ENOEXEC;
                }
        } else {
-               printk(KERN_WARNING "VPE loader: No TC's associated with VPE %d\n",
+               evpe(vpeflags);
+               emt(dmt_flag);
+               local_irq_restore(flags);
+
+               printk(KERN_WARNING
+                      "VPE loader: No TC's associated with VPE %d\n",
                       v->minor);
+
                return -ENOEXEC;
        }
 
@@ -733,21 +715,20 @@ static int vpe_run(struct vpe * v)
 
        /* should check it is halted, and not activated */
        if ((read_tc_c0_tcstatus() & TCSTATUS_A) || !(read_tc_c0_tchalt() & TCHALT_H)) {
-               printk(KERN_WARNING "VPE loader: TC %d is already doing something!\n",
+               evpe(vpeflags);
+               emt(dmt_flag);
+               local_irq_restore(flags);
+
+               printk(KERN_WARNING "VPE loader: TC %d is already active!\n",
                       t->index);
-               dump_tclist();
+
                return -ENOEXEC;
        }
 
-       /*
-        * Disable multi-threaded execution whilst we activate, clear the
-        * halt bit and bound the tc to the other VPE...
-        */
-       dmt_flag = dmt();
-
        /* Write the address we want it to start running from in the TCPC register. */
        write_tc_c0_tcrestart((unsigned long)v->__start);
        write_tc_c0_tccontext((unsigned long)0);
+
        /*
         * Mark the TC as activated, not interrupt exempt and not dynamically
         * allocatable
@@ -763,15 +744,15 @@ static int vpe_run(struct vpe * v)
         * here...  Or set $a3 to zero and define DFLT_STACK_SIZE and
         * DFLT_HEAP_SIZE when you compile your program
         */
-       mttgpr(7, physical_memsize);
-
+       mttgpr(6, v->ntcs);
+       mttgpr(7, physical_memsize);
 
        /* set up VPE1 */
        /*
         * bind the TC to VPE 1 as late as possible so we only have the final
         * VPE registers to set up, and so an EJTAG probe can trigger on it
         */
-       write_tc_c0_tcbind((read_tc_c0_tcbind() & ~TCBIND_CURVPE) | v->minor);
+       write_tc_c0_tcbind((read_tc_c0_tcbind() & ~TCBIND_CURVPE) | 1);
 
        write_vpe_c0_vpeconf0(read_vpe_c0_vpeconf0() & ~(VPECONF0_VPA));
 
@@ -793,15 +774,16 @@ static int vpe_run(struct vpe * v)
        /* take system out of configuration state */
        clear_c0_mvpcontrol(MVPCONTROL_VPC);
 
-       /* now safe to re-enable multi-threading */
-       emt(dmt_flag);
-
-       /* set it running */
+#ifdef CONFIG_SMP
        evpe(EVPE_ENABLE);
+#else
+       evpe(vpeflags);
+#endif
+       emt(dmt_flag);
+       local_irq_restore(flags);
 
-       list_for_each_entry(n, &v->notify, list) {
-               n->start(v->minor);
-       }
+       list_for_each_entry(n, &v->notify, list)
+               n->start(minor);
 
        return 0;
 }
@@ -1023,23 +1005,15 @@ static int vpe_elfload(struct vpe * v)
        return 0;
 }
 
-void __used dump_vpe(struct vpe * v)
-{
-       struct tc *t;
-
-       settc(v->minor);
-
-       printk(KERN_DEBUG "VPEControl 0x%lx\n", read_vpe_c0_vpecontrol());
-       printk(KERN_DEBUG "VPEConf0 0x%lx\n", read_vpe_c0_vpeconf0());
-
-       list_for_each_entry(t, &vpecontrol.tc_list, list)
-               dump_tc(t);
-}
-
 static void cleanup_tc(struct tc *tc)
 {
+       unsigned long flags;
+       unsigned int mtflags, vpflags;
        int tmp;
 
+       local_irq_save(flags);
+       mtflags = dmt();
+       vpflags = dvpe();
        /* Put MVPE's into 'configuration state' */
        set_c0_mvpcontrol(MVPCONTROL_VPC);
 
@@ -1054,9 +1028,12 @@ static void cleanup_tc(struct tc *tc)
        write_tc_c0_tchalt(TCHALT_H);
 
        /* bind it to anything other than VPE1 */
-       write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE
+//     write_tc_c0_tcbind(read_tc_c0_tcbind() & ~TCBIND_CURVPE); // | TCBIND_CURVPE
 
        clear_c0_mvpcontrol(MVPCONTROL_VPC);
+       evpe(vpflags);
+       emt(mtflags);
+       local_irq_restore(flags);
 }
 
 static int getcwd(char *buff, int size)
@@ -1077,36 +1054,32 @@ static int getcwd(char *buff, int size)
 /* checks VPE is unused and gets ready to load program  */
 static int vpe_open(struct inode *inode, struct file *filp)
 {
-       int minor, ret;
        enum vpe_state state;
-       struct vpe *v;
        struct vpe_notifications *not;
+       struct vpe *v;
+       int ret;
 
-       /* assume only 1 device at the mo. */
-       if ((minor = iminor(inode)) != 1) {
+       if (minor != iminor(inode)) {
+               /* assume only 1 device at the moment. */
                printk(KERN_WARNING "VPE loader: only vpe1 is supported\n");
                return -ENODEV;
        }
 
-       if ((v = get_vpe(minor)) == NULL) {
+       if ((v = get_vpe(tclimit)) == NULL) {
                printk(KERN_WARNING "VPE loader: unable to get vpe\n");
                return -ENODEV;
        }
 
        state = xchg(&v->state, VPE_STATE_INUSE);
        if (state != VPE_STATE_UNUSED) {
-               dvpe();
-
                printk(KERN_DEBUG "VPE loader: tc in use dumping regs\n");
 
-               dump_tc(get_tc(minor));
-
                list_for_each_entry(not, &v->notify, list) {
-                       not->stop(minor);
+                       not->stop(tclimit);
                }
 
                release_progmem(v->load_addr);
-               cleanup_tc(get_tc(minor));
+               cleanup_tc(get_tc(tclimit));
        }
 
        /* this of-course trashes what was there before... */
@@ -1133,26 +1106,25 @@ static int vpe_open(struct inode *inode, struct file *filp)
 
        v->shared_ptr = NULL;
        v->__start = 0;
+
        return 0;
 }
 
 static int vpe_release(struct inode *inode, struct file *filp)
 {
-       int minor, ret = 0;
        struct vpe *v;
        Elf_Ehdr *hdr;
+       int ret = 0;
 
-       minor = iminor(inode);
-       if ((v = get_vpe(minor)) == NULL)
+       v = get_vpe(tclimit);
+       if (v == NULL)
                return -ENODEV;
 
-       // simple case of fire and forget, so tell the VPE to run...
-
        hdr = (Elf_Ehdr *) v->pbuffer;
        if (memcmp(hdr->e_ident, ELFMAG, 4) == 0) {
-               if (vpe_elfload(v) >= 0)
+               if (vpe_elfload(v) >= 0) {
                        vpe_run(v);
-               else {
+               else {
                        printk(KERN_WARNING "VPE loader: ELF load failed.\n");
                        ret = -ENOEXEC;
                }
@@ -1179,12 +1151,14 @@ static int vpe_release(struct inode *inode, struct file *filp)
 static ssize_t vpe_write(struct file *file, const char __user * buffer,
                         size_t count, loff_t * ppos)
 {
-       int minor;
        size_t ret = count;
        struct vpe *v;
 
-       minor = iminor(file->f_path.dentry->d_inode);
-       if ((v = get_vpe(minor)) == NULL)
+       if (iminor(file->f_path.dentry->d_inode) != minor)
+               return -ENODEV;
+
+       v = get_vpe(tclimit);
+       if (v == NULL)
                return -ENODEV;
 
        if (v->pbuffer == NULL) {
@@ -1366,62 +1340,173 @@ static void kspd_sp_exit( int sp_id)
 }
 #endif
 
-static struct device *vpe_dev;
+static ssize_t store_kill(struct class_device *dev, const char *buf, size_t len)
+{
+       struct vpe *vpe = get_vpe(tclimit);
+       struct vpe_notifications *not;
+
+       list_for_each_entry(not, &vpe->notify, list) {
+               not->stop(tclimit);
+       }
+
+       release_progmem(vpe->load_addr);
+       cleanup_tc(get_tc(tclimit));
+       vpe_stop(vpe);
+       vpe_free(vpe);
+
+       return len;
+}
+
+static ssize_t show_ntcs(struct class_device *cd, char *buf)
+{
+       struct vpe *vpe = get_vpe(tclimit);
+
+       return sprintf(buf, "%d\n", vpe->ntcs);
+}
+
+static ssize_t store_ntcs(struct class_device *dev, const char *buf, size_t len)
+{
+       struct vpe *vpe = get_vpe(tclimit);
+       unsigned long new;
+       char *endp;
+
+       new = simple_strtoul(buf, &endp, 0);
+       if (endp == buf)
+               goto out_einval;
+
+       if (new == 0 || new > (hw_tcs - tclimit))
+               goto out_einval;
+
+       vpe->ntcs = new;
+
+       return len;
+
+out_einval:
+       return -EINVAL;;
+}
+
+static struct class_device_attribute vpe_class_attributes[] = {
+       __ATTR(kill, S_IWUSR, NULL, store_kill),
+       __ATTR(ntcs, S_IRUGO | S_IWUSR, show_ntcs, store_ntcs),
+       {}
+};
+
+static void vpe_class_device_release(struct class_device *cd)
+{
+       kfree(cd);
+}
+
+struct class vpe_class = {
+       .name = "vpe",
+       .owner = THIS_MODULE,
+       .release = vpe_class_device_release,
+       .class_dev_attrs = vpe_class_attributes,
+};
+
+struct class_device vpe_device;
 
 static int __init vpe_module_init(void)
 {
+       unsigned int mtflags, vpflags;
+       unsigned long flags, val;
        struct vpe *v = NULL;
-       struct device *dev;
        struct tc *t;
-       unsigned long val;
-       int i, err;
+       int tc, err;
 
        if (!cpu_has_mipsmt) {
                printk("VPE loader: not a MIPS MT capable processor\n");
                return -ENODEV;
        }
 
+       if (vpelimit == 0) {
+               printk(KERN_WARNING "No VPEs reserved for AP/SP, not "
+                      "initializing VPE loader.\nPass maxvpes=<n> argument as "
+                      "kernel argument\n");
+
+               return -ENODEV;
+       }
+
+       if (tclimit == 0) {
+               printk(KERN_WARNING "No TCs reserved for AP/SP, not "
+                      "initializing VPE loader.\nPass maxtcs=<n> argument as "
+                      "kernel argument\n");
+
+               return -ENODEV;
+       }
+
        major = register_chrdev(0, module_name, &vpe_fops);
        if (major < 0) {
                printk("VPE loader: unable to register character device\n");
                return major;
        }
 
-       dev = device_create(mt_class, NULL, MKDEV(major, minor),
-                           "tc%d", minor);
-       if (IS_ERR(dev)) {
-               err = PTR_ERR(dev);
+       err = class_register(&vpe_class);
+       if (err) {
+               printk(KERN_ERR "vpe_class registration failed\n");
                goto out_chrdev;
        }
-       vpe_dev = dev;
 
-       dmt();
-       dvpe();
+       class_device_initialize(&vpe_device);
+       vpe_device.class        = &vpe_class,
+       vpe_device.parent       = NULL,
+       strlcpy(vpe_device.class_id, "vpe1", BUS_ID_SIZE);
+       vpe_device.devt = MKDEV(major, minor);
+       err = class_device_add(&vpe_device);
+       if (err) {
+               printk(KERN_ERR "Adding vpe_device failed\n");
+               goto out_class;
+       }
+
+       local_irq_save(flags);
+       mtflags = dmt();
+       vpflags = dvpe();
 
        /* Put MVPE's into 'configuration state' */
        set_c0_mvpcontrol(MVPCONTROL_VPC);
 
        /* dump_mtregs(); */
 
-
        val = read_c0_mvpconf0();
-       for (i = 0; i < ((val & MVPCONF0_PTC) + 1); i++) {
-               t = alloc_tc(i);
+       hw_tcs = (val & MVPCONF0_PTC) + 1;
+       hw_vpes = ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1;
+
+       for (tc = tclimit; tc < hw_tcs; tc++) {
+               /*
+                * Must re-enable multithreading temporarily or in case we
+                * reschedule send IPIs or similar we might hang.
+                */
+               clear_c0_mvpcontrol(MVPCONTROL_VPC);
+               evpe(vpflags);
+               emt(mtflags);
+               local_irq_restore(flags);
+               t = alloc_tc(tc);
+               if (!t) {
+                       err = -ENOMEM;
+                       goto out;
+               }
+
+               local_irq_save(flags);
+               mtflags = dmt();
+               vpflags = dvpe();
+               set_c0_mvpcontrol(MVPCONTROL_VPC);
 
                /* VPE's */
-               if (i < ((val & MVPCONF0_PVPE) >> MVPCONF0_PVPE_SHIFT) + 1) {
-                       settc(i);
+               if (tc < hw_tcs) {
+                       settc(tc);
 
-                       if ((v = alloc_vpe(i)) == NULL) {
+                       if ((v = alloc_vpe(tc)) == NULL) {
                                printk(KERN_WARNING "VPE: unable to allocate VPE\n");
-                               return -ENODEV;
+
+                               goto out_reenable;
                        }
 
+                       v->ntcs = hw_tcs - tclimit;
+
                        /* add the tc to the list of this vpe's tc's. */
                        list_add(&t->tc, &v->tc);
 
                        /* deactivate all but vpe0 */
-                       if (i != 0) {
+                       if (tc >= tclimit) {
                                unsigned long tmp = read_vpe_c0_vpeconf0();
 
                                tmp &= ~VPECONF0_VPA;
@@ -1434,7 +1519,7 @@ static int __init vpe_module_init(void)
                        /* disable multi-threading with TC's */
                        write_vpe_c0_vpecontrol(read_vpe_c0_vpecontrol() & ~VPECONTROL_TE);
 
-                       if (i != 0) {
+                       if (tc >= vpelimit) {
                                /*
                                 * Set config to be the same as vpe0,
                                 * particularly kseg0 coherency alg
@@ -1446,10 +1531,10 @@ static int __init vpe_module_init(void)
                /* TC's */
                t->pvpe = v;    /* set the parent vpe */
 
-               if (i != 0) {
+               if (tc >= tclimit) {
                        unsigned long tmp;
 
-                       settc(i);
+                       settc(tc);
 
                        /* Any TC that is bound to VPE0 gets left as is - in case
                           we are running SMTC on VPE0. A TC that is bound to any
@@ -1479,17 +1564,25 @@ static int __init vpe_module_init(void)
                }
        }
 
+out_reenable:
        /* release config state */
        clear_c0_mvpcontrol(MVPCONTROL_VPC);
 
+       evpe(vpflags);
+       emt(mtflags);
+       local_irq_restore(flags);
+
 #ifdef CONFIG_MIPS_APSP_KSPD
        kspd_events.kspd_sp_exit = kspd_sp_exit;
 #endif
        return 0;
 
+out_class:
+       class_unregister(&vpe_class);
 out_chrdev:
        unregister_chrdev(major, module_name);
 
+out:
        return err;
 }
 
@@ -1503,7 +1596,7 @@ static void __exit vpe_module_exit(void)
                }
        }
 
-       device_destroy(mt_class, MKDEV(major, minor));
+       class_device_del(&vpe_device);
        unregister_chrdev(major, module_name);
 }
 
index fb1b48c48cb363a87f9e83368215b66e9d0b6e75..dcaf6f4c3a3713d63c53b7d1db9bdea648fba0ec 100644 (file)
@@ -3,5 +3,6 @@
 #
 
 obj-y += setup.o prom.o reset.o irq.o pci.o bonito-irq.o dbg_io.o mem.o
-EXTRA_AFLAGS := $(CFLAGS)
 
+EXTRA_AFLAGS := $(CFLAGS)
+EXTRA_CFLAGS += -Werror
index 05693bceaeaf23de5eb38db6eea43e5567a55198..3e0b7beb1009b336c0eee30f2da22428d6196db2 100644 (file)
@@ -25,7 +25,6 @@
  */
 #include <linux/delay.h>
 #include <linux/io.h>
-#include <linux/irq.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
 #include <linux/irq.h>
index 67312d7acf2af786ca57cc36895d5993cd0bc641..3efb1cf111f2e0838d745a94a2b56f949eb14946 100644 (file)
  * option) any later version.
  */
 #include <linux/init.h>
-#include <linux/mm.h>
-#include <linux/sched.h>
 #include <linux/bootmem.h>
-
-#include <asm/addrspace.h>
 #include <asm/bootinfo.h>
 
 extern unsigned long bus_clock;
-extern unsigned long cpu_clock;
+extern unsigned long cpu_clock_freq;
 extern unsigned int memsize, highmemsize;
 extern int putDebugChar(unsigned char byte);
 
@@ -81,7 +77,7 @@ do {                                                                  \
        l = (long)*env;
        while (l != 0) {
                parse_even_earlier(bus_clock, "busclock", l);
-               parse_even_earlier(cpu_clock, "cpuclock", l);
+               parse_even_earlier(cpu_clock_freq, "cpuclock", l);
                parse_even_earlier(memsize, "memsize", l);
                parse_even_earlier(highmemsize, "highmemsize", l);
                env++;
@@ -91,7 +87,7 @@ do {                                                                  \
                memsize = 256;
 
        pr_info("busclock=%ld, cpuclock=%ld,memsize=%d,highmemsize=%d\n",
-              bus_clock, cpu_clock, memsize, highmemsize);
+              bus_clock, cpu_clock_freq, memsize, highmemsize);
 }
 
 void __init prom_free_prom_memory(void)
index 0e4d1fa572b56c010e534be5dfb17a4f59e64665..f34350a4f271aa5bd320f597b2f61b504e77a8e8 100644 (file)
  */
 #include <linux/bootmem.h>
 #include <linux/init.h>
-#include <linux/io.h>
-#include <linux/ioport.h>
-#include <linux/interrupt.h>
 #include <linux/irq.h>
-#include <linux/kernel.h>
-#include <linux/mc146818rtc.h>
-#include <linux/mm.h>
-#include <linux/module.h>
-#include <linux/pci.h>
-#include <linux/tty.h>
-#include <linux/types.h>
 
 #include <asm/bootinfo.h>
 #include <asm/mc146818-time.h>
@@ -58,7 +48,7 @@ extern void mips_reboot_setup(void);
 #define PTR_PAD(p) (p)
 #endif
 
-unsigned long cpu_clock;
+unsigned long cpu_clock_freq;
 unsigned long bus_clock;
 unsigned int memsize;
 unsigned int highmemsize = 0;
@@ -71,7 +61,7 @@ void __init plat_timer_setup(struct irqaction *irq)
 static void __init loongson2e_time_init(void)
 {
        /* setup mips r4k timer */
-       mips_hpt_frequency = cpu_clock / 2;
+       mips_hpt_frequency = cpu_clock_freq / 2;
 }
 
 static unsigned long __init mips_rtc_get_time(void)
index 121a848a35945d57292c072d45c4cfe7cc0cc12f..d547efdeedc2b105fda8bf34a6aa023898d371d2 100644 (file)
@@ -9,3 +9,5 @@ obj-y   := cp1emu.o ieee754m.o ieee754d.o ieee754dp.o ieee754sp.o ieee754.o \
           sp_div.o sp_mul.o sp_sub.o sp_add.o sp_fdp.o sp_cmp.o sp_logb.o \
           sp_scalb.o sp_simple.o sp_tint.o sp_fint.o sp_tlong.o sp_flong.o \
           dp_sqrt.o sp_sqrt.o kernel_linkage.o dsemul.o
+
+EXTRA_CFLAGS += -Werror
index d8dab75906bf319d63dfc2edd9914b44c194185d..f71c2dd1041abda06dd9ce8baea3a101c20edb5a 100644 (file)
@@ -18,3 +18,5 @@
 
 obj-y                  := atlas_int.o atlas_setup.o
 obj-$(CONFIG_KGDB)     += atlas_gdb.o
+
+EXTRA_CFLAGS += -Werror
index 6c8f0255e85de2812ebe87b4e2f7e5e9babc5c6d..3c692abc2553c41cfce655e2848afff9affb12c5 100644 (file)
@@ -245,6 +245,7 @@ void __init arch_init_irq(void)
        case MIPS_REVISION_CORID_CORE_MSC:
        case MIPS_REVISION_CORID_CORE_FPGA2:
        case MIPS_REVISION_CORID_CORE_FPGA3:
+       case MIPS_REVISION_CORID_CORE_FPGA4:
        case MIPS_REVISION_CORID_CORE_24K:
        case MIPS_REVISION_CORID_CORE_EMUL_MSC:
                if (cpu_has_veic)
index aade36d7878777ef3a2289b844b718818a8c9b5a..b31d8dfed1bec138967d8caf011d85a249094c3f 100644 (file)
@@ -24,3 +24,5 @@ obj-y                         := reset.o display.o init.o memory.o \
 obj-$(CONFIG_EARLY_PRINTK)     += console.o
 obj-$(CONFIG_PCI)              += pci.o
 obj-$(CONFIG_KGDB)             += gdb_hook.o
+
+EXTRA_CFLAGS += -Werror
index 4eabc1eadd2327d012a32f42e0cd06060339a011..e2c7147fedf79b159ce1b15bdcc74e4c6759e5a3 100644 (file)
@@ -294,6 +294,7 @@ void __init prom_init(void)
                case MIPS_REVISION_CORID_CORE_MSC:
                case MIPS_REVISION_CORID_CORE_FPGA2:
                case MIPS_REVISION_CORID_CORE_FPGA3:
+               case MIPS_REVISION_CORID_CORE_FPGA4:
                case MIPS_REVISION_CORID_CORE_24K:
                case MIPS_REVISION_CORID_CORE_EMUL_MSC:
                        mips_revision_sconid = MIPS_REVISION_SCON_SOCIT;
index c45d556aa96bd3553e1accbe115521391efc9b22..d7bff9ca5356a43240d50643fc87f18bebc007b2 100644 (file)
@@ -55,7 +55,7 @@ unsigned long cpu_khz;
 
 static int mips_cpu_timer_irq;
 extern int cp0_perfcount_irq;
-extern void smtc_timer_broadcast(int);
+extern void smtc_timer_broadcast(void);
 
 static void mips_timer_dispatch(void)
 {
@@ -131,7 +131,7 @@ irqreturn_t mips_timer_interrupt(int irq, void *dev_id)
                                         (mips_hpt_frequency/HZ));
                        local_timer_interrupt(irq, dev_id);
                }
-               smtc_timer_broadcast(cpu_data[cpu].vpe_id);
+               smtc_timer_broadcast();
        }
 #else /* CONFIG_MIPS_MT_SMTC */
        int r2 = cpu_has_mips_r2;
index a242b0fc377d07d18de9868e608917be9aa6736b..931ca4600a63ec97ca507d4e1d969d7ee070cc86 100644 (file)
@@ -23,3 +23,5 @@ obj-y := malta_int.o malta_platform.o malta_setup.o
 
 obj-$(CONFIG_MTD) += malta_mtd.o
 obj-$(CONFIG_MIPS_MT_SMTC) += malta_smtc.o
+
+EXTRA_CFLAGS += -Werror
index c78d48349600872d87f721b8420f13d96cbe5e8b..97aeb8c4e6010aae5adbb86c8788f3f5e810f816 100644 (file)
@@ -330,6 +330,18 @@ void __init arch_init_irq(void)
                        (0x100 << MIPSCPU_INT_I8259A));
                setup_irq_smtc (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI,
                        &corehi_irqaction, (0x100 << MIPSCPU_INT_COREHI));
+               /*
+                * Temporary hack to ensure that the subsidiary device
+                * interrupts coing in via the i8259A, but associated
+                * with low IRQ numbers, will restore the Status.IM
+                * value associated with the i8259A.
+                */
+               {
+                       int i;
+
+                       for (i = 0; i < 16; i++)
+                               irq_hwmask[i] = (0x100 << MIPSCPU_INT_I8259A);
+               }
 #else /* Not SMTC */
                setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_I8259A, &i8259irq);
                setup_irq (MIPS_CPU_IRQ_BASE+MIPSCPU_INT_COREHI, &corehi_irqaction);
index d1c80f6311005e7b48d7192698cb236dcd7b2936..0fb4c269901ce7ad44b160b4956aa706cfde6151 100644 (file)
@@ -58,7 +58,7 @@ void prom_init_secondary(void)
  * but it may be multithreaded.
  */
 
-void plat_smp_setup(void)
+void __cpuinit plat_smp_setup(void)
 {
        if (read_c0_config3() & (1<<2))
                mipsmt_build_cpu_map(0);
index 224bb848f16b87867089ca3a12c3ee433dbe8f2a..3682fe217bd51f9e44c1e9fb25dd4b56042a5eb4 100644 (file)
@@ -24,3 +24,5 @@
 #
 
 obj-y          := sead_int.o sead_setup.o
+
+EXTRA_CFLAGS += -Werror
index dc0bfda114277fa17a32d4f5280e345cb6b22a2f..75568b584df451a6b651b22d7995720d92f71709 100644 (file)
@@ -22,3 +22,5 @@ obj-y := sim_platform.o sim_setup.o sim_mem.o sim_time.o sim_int.o \
 
 obj-$(CONFIG_EARLY_PRINTK) += sim_console.o
 obj-$(CONFIG_SMP) += sim_smp.o
+
+EXTRA_CFLAGS += -Werror
index 17819b59410542aea42ead3ed9873e344ff3f36e..d012719c4d240ff1d0c0522c013304a954ccbbb5 100644 (file)
@@ -22,7 +22,6 @@
 #include <linux/io.h>
 #include <linux/irq.h>
 #include <linux/ioport.h>
-#include <linux/serial.h>
 #include <linux/tty.h>
 #include <linux/serial.h>
 #include <linux/serial_core.h>
index 19a0e544c4e97e8bad041ffa68088ec565bbb30c..43e4810dcaa80c99618b4aec1f0607ea8f71899a 100644 (file)
@@ -32,3 +32,5 @@ obj-$(CONFIG_IP22_CPU_SCACHE) += sc-ip22.o
 obj-$(CONFIG_R5000_CPU_SCACHE)  += sc-r5k.o
 obj-$(CONFIG_RM7000_CPU_SCACHE)        += sc-rm7k.o
 obj-$(CONFIG_MIPS_CPU_SCACHE)  += sc-mips.o
+
+EXTRA_CFLAGS += -Werror
index be96231dccb60508ba6a6cda2f1b5479625434a6..bad571971bf69f99bb8a64824309505fd479da84 100644 (file)
@@ -23,6 +23,7 @@
 #include <asm/page.h>
 #include <asm/pgtable.h>
 #include <asm/r4kcache.h>
+#include <asm/sections.h>
 #include <asm/system.h>
 #include <asm/mmu_context.h>
 #include <asm/war.h>
@@ -1010,7 +1011,6 @@ static void __init probe_pcache(void)
  */
 static int __init probe_scache(void)
 {
-       extern unsigned long stext;
        unsigned long flags, addr, begin, end, pow2;
        unsigned int config = read_c0_config();
        struct cpuinfo_mips *c = &current_cpu_data;
@@ -1019,7 +1019,7 @@ static int __init probe_scache(void)
        if (config & CONF_SC)
                return 0;
 
-       begin = (unsigned long) &stext;
+       begin = (unsigned long) &_stext;
        begin &= ~((4 * 1024 * 1024) - 1);
        end = begin + (4 * 1024 * 1024);
 
index 7dc9bf6f132183ede615e84742bff4c41fe84fe0..d29040a56aeaf39573c312389a7c98e77e7cce1b 100644 (file)
@@ -83,6 +83,7 @@ static void rm9000_cpu_stop(void *args)
 static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id)
 {
        unsigned int control = read_c0_perfcontrol();
+       struct pt_regs *regs = get_irq_regs();
        uint32_t counter1, counter2;
        uint64_t counters;
 
index c58bd3d036f4528e5f379844932aa1e6f84cb6f1..4ee6800e67e6ee202d334eff1ddce2222cd6464c 100644 (file)
@@ -19,7 +19,6 @@ obj-$(CONFIG_MARKEINS)                += ops-emma2rh.o pci-emma2rh.o fixup-emma2rh.o
 # These are still pretty much in the old state, watch, go blind.
 #
 obj-$(CONFIG_BASLER_EXCITE)    += ops-titan.o pci-excite.o fixup-excite.o
-obj-$(CONFIG_DDB5477)          += fixup-ddb5477.o pci-ddb5477.o ops-ddb5477.o
 obj-$(CONFIG_MIPS_ATLAS)       += fixup-atlas.o
 obj-$(CONFIG_MIPS_COBALT)      += fixup-cobalt.o
 obj-$(CONFIG_SOC_AU1500)       += fixup-au1000.o ops-au1000.o
@@ -27,7 +26,6 @@ obj-$(CONFIG_SOC_AU1550)      += fixup-au1000.o ops-au1000.o
 obj-$(CONFIG_SOC_PNX8550)      += fixup-pnx8550.o ops-pnx8550.o
 obj-$(CONFIG_LEMOTE_FULONG)    += fixup-lm2e.o ops-bonito64.o
 obj-$(CONFIG_MIPS_MALTA)       += fixup-malta.o
-obj-$(CONFIG_MOMENCO_OCELOT)   += fixup-ocelot.o pci-ocelot.o
 obj-$(CONFIG_PMC_MSP7120_GW)   += fixup-pmcmsp.o ops-pmcmsp.o
 obj-$(CONFIG_PMC_MSP7120_EVAL) += fixup-pmcmsp.o ops-pmcmsp.o
 obj-$(CONFIG_PMC_MSP7120_FPGA) += fixup-pmcmsp.o ops-pmcmsp.o
diff --git a/arch/mips/pci/fixup-ddb5477.c b/arch/mips/pci/fixup-ddb5477.c
deleted file mode 100644 (file)
index 2f1444e..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- *
- * BRIEF MODULE DESCRIPTION
- *     Board specific pci fixups.
- *
- * Copyright 2001, 2002, 2003 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-#include <linux/types.h>
-#include <linux/pci.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-
-static void ddb5477_fixup(struct pci_dev *dev)
-{
-       u8 old;
-
-       printk(KERN_NOTICE "Enabling ALI M1533/35 PS2 keyboard/mouse.\n");
-       pci_read_config_byte(dev, 0x41, &old);
-       pci_write_config_byte(dev, 0x41, old | 0xd0);
-}
-
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1533,
-         ddb5477_fixup);
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AL, PCI_DEVICE_ID_AL_M1535,
-         ddb5477_fixup);
-
-/*
- * Fixup baseboard AMD chip so that tx does not underflow.
- *      bcr_18 |= 0x0800
- * This sets NOUFLO bit which makes tx not start until whole pkt
- * is fetched to the chip.
- */
-#define PCNET32_WIO_RDP                0x10
-#define PCNET32_WIO_RAP                0x12
-#define PCNET32_WIO_RESET      0x14
-#define PCNET32_WIO_BDP                0x16
-
-static void ddb5477_amd_lance_fixup(struct pci_dev *dev)
-{
-       unsigned long ioaddr;
-       u16 temp;
-
-       ioaddr = pci_resource_start(dev, 0);
-
-       inw(ioaddr + PCNET32_WIO_RESET);        /* reset chip */
-
-       /* bcr_18 |= 0x0800 */
-       outw(18, ioaddr + PCNET32_WIO_RAP);
-       temp = inw(ioaddr + PCNET32_WIO_BDP);
-       temp |= 0x0800;
-       outw(18, ioaddr + PCNET32_WIO_RAP);
-       outw(temp, ioaddr + PCNET32_WIO_BDP);
-}
-
-DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LANCE,
-         ddb5477_amd_lance_fixup);
diff --git a/arch/mips/pci/fixup-ocelot.c b/arch/mips/pci/fixup-ocelot.c
deleted file mode 100644 (file)
index 99629bd..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * arch/mips/gt64120/momenco_ocelot/pci.c
- *     Board-specific PCI routines for gt64120 controller.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#include <linux/types.h>
-#include <linux/pci.h>
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <asm/pci.h>
-
-
-void __devinit pcibios_fixup_bus(struct pci_bus *bus)
-{
-       struct pci_bus *current_bus = bus;
-       struct pci_dev *devices;
-       struct list_head *devices_link;
-       u16 cmd;
-
-       list_for_each(devices_link, &(current_bus->devices)) {
-
-               devices = pci_dev_b(devices_link);
-               if (devices == NULL)
-                       continue;
-
-               if (PCI_SLOT(devices->devfn) == 1) {
-                       /*
-                        * Slot 1 is primary ether port, i82559
-                        * we double-check against that assumption
-                        */
-                       if ((devices->vendor != 0x8086) ||
-                           (devices->device != 0x1209)) {
-                               panic("pcibios_fixup_bus: found "
-                                    "unexpected PCI device in slot 1.");
-                       }
-                       devices->irq = 2;       /* irq_nr is 2 for INT0 */
-               } else if (PCI_SLOT(devices->devfn) == 2) {
-                       /*
-                        * Slot 2 is secondary ether port, i21143
-                        * we double-check against that assumption
-                        */
-                       if ((devices->vendor != 0x1011) ||
-                           (devices->device != 0x19)) {
-                               panic("galileo_pcibios_fixup_bus: "
-                                     "found unexpected PCI device in slot 2.");
-                       }
-                       devices->irq = 3;       /* irq_nr is 3 for INT1 */
-               } else if (PCI_SLOT(devices->devfn) == 4) {
-                       /* PMC Slot 1 */
-                       devices->irq = 8;       /* irq_nr is 8 for INT6 */
-               } else if (PCI_SLOT(devices->devfn) == 5) {
-                       /* PMC Slot 1 */
-                       devices->irq = 9;       /* irq_nr is 9 for INT7 */
-               } else {
-                       /* We don't have assign interrupts for other devices. */
-                       devices->irq = 0xff;
-               }
-
-               /* Assign an interrupt number for the device */
-               bus->ops->write_byte(devices, PCI_INTERRUPT_LINE,
-                                    devices->irq);
-
-               /* enable master */
-               bus->ops->read_word(devices, PCI_COMMAND, &cmd);
-               cmd |= PCI_COMMAND_MASTER;
-               bus->ops->write_word(devices, PCI_COMMAND, cmd);
-       }
-}
index 3cdbecb8e7144cb8a1ba5997076251c9a05f9139..7450c335b387529d16d7c388d88e207629f3dbfd 100644 (file)
@@ -79,7 +79,7 @@ static unsigned char backplane_pci_irq[4][4] = {
                                     TX4927_IRQ_IOC_PCIC}
 };
 
-int pci_get_irq(struct pci_dev *dev, int pin)
+static int pci_get_irq(const struct pci_dev *dev, int pin)
 {
        unsigned char irq = pin;
 
index 2485f47dfe6fec88fee4829389c6ed3805f778a4..f2ba06ee0c10f8d71897de805e8c2d682f45ea20 100644 (file)
@@ -18,7 +18,7 @@
 
 extern struct pci_controller tx4938_pci_controller[];
 
-int pci_get_irq(struct pci_dev *dev, int pin)
+static int pci_get_irq(const struct pci_dev *dev, int pin)
 {
        int irq = pin;
        u8 slot = PCI_SLOT(dev->devfn);
diff --git a/arch/mips/pci/ops-ddb5477.c b/arch/mips/pci/ops-ddb5477.c
deleted file mode 100644 (file)
index 8e57d4c..0000000
+++ /dev/null
@@ -1,278 +0,0 @@
-/***********************************************************************
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * arch/mips/ddb5xxx/ddb5477/pci_ops.c
- *     Define the pci_ops for DB5477.
- *
- * Much of the code is derived from the original DDB5074 port by
- * Geert Uytterhoeven <geert@sonycom.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- ***********************************************************************
- */
-
-/*
- * DDB5477 has two PCI channels, external PCI and IOPIC (internal)
- * Therefore we provide two sets of pci_ops.
- */
-#include <linux/pci.h>
-#include <linux/kernel.h>
-#include <linux/types.h>
-
-#include <asm/addrspace.h>
-#include <asm/debug.h>
-
-#include <asm/ddb5xxx/ddb5xxx.h>
-
-/*
- * config_swap structure records what set of pdar/pmr are used
- * to access pci config space.  It also provides a place hold the
- * original values for future restoring.
- */
-struct pci_config_swap {
-       u32 pdar;
-       u32 pmr;
-       u32 config_base;
-       u32 config_size;
-       u32 pdar_backup;
-       u32 pmr_backup;
-};
-
-/*
- * On DDB5477, we have two sets of swap registers, for ext PCI and IOPCI.
- */
-struct pci_config_swap ext_pci_swap = {
-       DDB_PCIW0,
-       DDB_PCIINIT00,
-       DDB_PCI0_CONFIG_BASE,
-       DDB_PCI0_CONFIG_SIZE
-};
-struct pci_config_swap io_pci_swap = {
-       DDB_IOPCIW0,
-       DDB_PCIINIT01,
-       DDB_PCI1_CONFIG_BASE,
-       DDB_PCI1_CONFIG_SIZE
-};
-
-
-/*
- * access config space
- */
-static inline u32 ddb_access_config_base(struct pci_config_swap *swap, u32 bus,        /* 0 means top level bus */
-                                        u32 slot_num)
-{
-       u32 pci_addr = 0;
-       u32 pciinit_offset = 0;
-       u32 virt_addr;
-       u32 option;
-
-       /* minimum pdar (window) size is 2MB */
-       db_assert(swap->config_size >= (2 << 20));
-
-       db_assert(slot_num < (1 << 5));
-       db_assert(bus < (1 << 8));
-
-       /* backup registers */
-       swap->pdar_backup = ddb_in32(swap->pdar);
-       swap->pmr_backup = ddb_in32(swap->pmr);
-
-       /* set the pdar (pci window) register */
-       ddb_set_pdar(swap->pdar, swap->config_base, swap->config_size, 32,      /* 32 bit wide */
-                    0,         /* not on local memory bus */
-                    0);        /* not visible from PCI bus (N/A) */
-
-       /*
-        * calcuate the absolute pci config addr;
-        * according to the spec, we start scanning from adr:11 (0x800)
-        */
-       if (bus == 0) {
-               /* type 0 config */
-               pci_addr = 0x800 << slot_num;
-       } else {
-               /* type 1 config */
-               pci_addr = (bus << 16) | (slot_num << 11);
-       }
-
-       /*
-        * if pci_addr is less than pci config window size,  we set
-        * pciinit_offset to 0 and adjust the virt_address.
-        * Otherwise we will try to adjust pciinit_offset.
-        */
-       if (pci_addr < swap->config_size) {
-               virt_addr = KSEG1ADDR(swap->config_base + pci_addr);
-               pciinit_offset = 0;
-       } else {
-               db_assert((pci_addr & (swap->config_size - 1)) == 0);
-               virt_addr = KSEG1ADDR(swap->config_base);
-               pciinit_offset = pci_addr;
-       }
-
-       /* set the pmr register */
-       option = DDB_PCI_ACCESS_32;
-       if (bus != 0)
-               option |= DDB_PCI_CFGTYPE1;
-       ddb_set_pmr(swap->pmr, DDB_PCICMD_CFG, pciinit_offset, option);
-
-       return virt_addr;
-}
-
-static inline void ddb_close_config_base(struct pci_config_swap *swap)
-{
-       ddb_out32(swap->pdar, swap->pdar_backup);
-       ddb_out32(swap->pmr, swap->pmr_backup);
-}
-
-static int read_config_dword(struct pci_config_swap *swap,
-                            struct pci_bus *bus, u32 devfn, u32 where,
-                            u32 * val)
-{
-       u32 bus_num, slot_num, func_num;
-       u32 base;
-
-       db_assert((where & 3) == 0);
-       db_assert(where < (1 << 8));
-
-       /* check if the bus is top-level */
-       if (bus->parent != NULL) {
-               bus_num = bus->number;
-               db_assert(bus_num != 0);
-       } else {
-               bus_num = 0;
-       }
-
-       slot_num = PCI_SLOT(devfn);
-       func_num = PCI_FUNC(devfn);
-       base = ddb_access_config_base(swap, bus_num, slot_num);
-       *val = *(volatile u32 *) (base + (func_num << 8) + where);
-       ddb_close_config_base(swap);
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int read_config_word(struct pci_config_swap *swap,
-                           struct pci_bus *bus, u32 devfn, u32 where,
-                           u16 * val)
-{
-       int status;
-       u32 result;
-
-       db_assert((where & 1) == 0);
-
-       status = read_config_dword(swap, bus, devfn, where & ~3, &result);
-       if (where & 2)
-               result >>= 16;
-       *val = result & 0xffff;
-       return status;
-}
-
-static int read_config_byte(struct pci_config_swap *swap,
-                           struct pci_bus *bus, u32 devfn, u32 where,
-                           u8 * val)
-{
-       int status;
-       u32 result;
-
-       status = read_config_dword(swap, bus, devfn, where & ~3, &result);
-       if (where & 1)
-               result >>= 8;
-       if (where & 2)
-               result >>= 16;
-       *val = result & 0xff;
-
-       return status;
-}
-
-static int write_config_dword(struct pci_config_swap *swap,
-                             struct pci_bus *bus, u32 devfn, u32 where,
-                             u32 val)
-{
-       u32 bus_num, slot_num, func_num;
-       u32 base;
-
-       db_assert((where & 3) == 0);
-       db_assert(where < (1 << 8));
-
-       /* check if the bus is top-level */
-       if (bus->parent != NULL) {
-               bus_num = bus->number;
-               db_assert(bus_num != 0);
-       } else {
-               bus_num = 0;
-       }
-
-       slot_num = PCI_SLOT(devfn);
-       func_num = PCI_FUNC(devfn);
-       base = ddb_access_config_base(swap, bus_num, slot_num);
-       *(volatile u32 *) (base + (func_num << 8) + where) = val;
-       ddb_close_config_base(swap);
-       return PCIBIOS_SUCCESSFUL;
-}
-
-static int write_config_word(struct pci_config_swap *swap,
-                            struct pci_bus *bus, u32 devfn, u32 where, u16 val)
-{
-       int status, shift = 0;
-       u32 result;
-
-       db_assert((where & 1) == 0);
-
-       status = read_config_dword(swap, bus, devfn, where & ~3, &result);
-       if (status != PCIBIOS_SUCCESSFUL)
-               return status;
-
-       if (where & 2)
-               shift += 16;
-       result &= ~(0xffff << shift);
-       result |= val << shift;
-       return write_config_dword(swap, bus, devfn, where & ~3, result);
-}
-
-static int write_config_byte(struct pci_config_swap *swap,
-                            struct pci_bus *bus, u32 devfn, u32 where, u8 val)
-{
-       int status, shift = 0;
-       u32 result;
-
-       status = read_config_dword(swap, bus, devfn, where & ~3, &result);
-       if (status != PCIBIOS_SUCCESSFUL)
-               return status;
-
-       if (where & 2)
-               shift += 16;
-       if (where & 1)
-               shift += 8;
-       result &= ~(0xff << shift);
-       result |= val << shift;
-       return write_config_dword(swap, bus, devfn, where & ~3, result);
-}
-
-#define        MAKE_PCI_OPS(prefix, rw, pciswap, star) \
-static int prefix##_##rw##_config(struct pci_bus *bus, unsigned int devfn, int where, int size, u32 star val) \
-{ \
-       if (size == 1) \
-               return rw##_config_byte(pciswap, bus, devfn, where, (u8 star)val); \
-       else if (size == 2) \
-               return rw##_config_word(pciswap, bus, devfn, where, (u16 star)val); \
-       /* Size must be 4 */ \
-       return rw##_config_dword(pciswap, bus, devfn, where, val); \
-}
-
-MAKE_PCI_OPS(extpci, read, &ext_pci_swap, *)
-MAKE_PCI_OPS(extpci, write, &ext_pci_swap,)
-
-MAKE_PCI_OPS(iopci, read, &io_pci_swap, *)
-MAKE_PCI_OPS(iopci, write, &io_pci_swap,)
-
-struct pci_ops ddb5477_ext_pci_ops = {
-       .read = extpci_read_config,
-       .write = extpci_write_config
-};
-
-
-struct pci_ops ddb5477_io_pci_ops = {
-       .read = iopci_read_config,
-       .write = iopci_write_config
-};
index 38f181625e109715bc1fed265a23de95ae8d4577..d31bfc6d4150fd43195345d258147e3f5f6c849e 100644 (file)
@@ -45,7 +45,7 @@ static int check_args(struct pci_bus *bus, u32 devfn, u32 * bus_num)
        /* check if the bus is top-level */
        if (bus->parent != NULL) {
                *bus_num = bus->number;
-               db_assert(bus_num != 0);
+               db_assert(bus_num != NULL);
        } else
                *bus_num = 0;
 
index f556b7a8dccdd29318aaaedf855f2704a7ca90bf..d6106465249830907fdff82239f25dc388b9ba8e 100644 (file)
@@ -117,7 +117,7 @@ read_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 * val)
        unsigned int data = 0;
        int err;
 
-       if (bus == 0)
+       if (bus == NULL)
                return -1;
 
        err = config_access(PCI_CMD_CONFIG_READ, bus, devfn, where, ~(1 << (where & 3)), &data);
@@ -145,7 +145,7 @@ read_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 * val)
        unsigned int data = 0;
        int err;
 
-       if (bus == 0)
+       if (bus == NULL)
                return -1;
 
        if (where & 0x01)
@@ -168,7 +168,7 @@ static int
 read_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 * val)
 {
        int err;
-       if (bus == 0)
+       if (bus == NULL)
                return -1;
 
        if (where & 0x03)
@@ -185,7 +185,7 @@ write_config_byte(struct pci_bus *bus, unsigned int devfn, int where, u8 val)
        unsigned int data = (unsigned int)val;
        int err;
 
-       if (bus == 0)
+       if (bus == NULL)
                return -1;
 
        switch (where & 0x03) {
@@ -213,7 +213,7 @@ write_config_word(struct pci_bus *bus, unsigned int devfn, int where, u16 val)
        unsigned int data = (unsigned int)val;
        int err;
 
-       if (bus == 0)
+       if (bus == NULL)
                return -1;
 
        if (where & 0x01)
@@ -235,7 +235,7 @@ static int
 write_config_dword(struct pci_bus *bus, unsigned int devfn, int where, u32 val)
 {
        int err;
-       if (bus == 0)
+       if (bus == NULL)
                return -1;
 
        if (where & 0x03)
diff --git a/arch/mips/pci/pci-ddb5477.c b/arch/mips/pci/pci-ddb5477.c
deleted file mode 100644 (file)
index 7363e18..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * PCI code for DDB5477.
- *
- * Copyright (C) 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * Copyright (C) 2004 by Ralf Baechle (ralf@linux-mips.org)
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- */
-#include <linux/kernel.h>
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/pci.h>
-
-#include <asm/bootinfo.h>
-#include <asm/debug.h>
-
-#include <asm/ddb5xxx/ddb5xxx.h>
-
-static struct resource extpci_io_resource = {
-       .start  = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + 0x4000,
-       .end    = DDB_PCI0_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI0_IO_SIZE - 1,
-       .name   = "ext pci IO space",
-       .flags  = IORESOURCE_IO
-};
-
-static struct resource extpci_mem_resource = {
-       .start  = DDB_PCI0_MEM_BASE + 0x100000,
-       .end    = DDB_PCI0_MEM_BASE + DDB_PCI0_MEM_SIZE - 1,
-       .name   = "ext pci memory space",
-       .flags  = IORESOURCE_MEM
-};
-
-static struct resource iopci_io_resource = {
-       .start  = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE,
-       .end    = DDB_PCI1_IO_BASE - DDB_PCI_IO_BASE + DDB_PCI1_IO_SIZE - 1,
-       .name   = "io pci IO space",
-       .flags  = IORESOURCE_IO
-};
-
-static struct resource iopci_mem_resource = {
-       .start  = DDB_PCI1_MEM_BASE,
-       .end    = DDB_PCI1_MEM_BASE + DDB_PCI1_MEM_SIZE - 1,
-       .name   = "ext pci memory space",
-       .flags  = IORESOURCE_MEM
-};
-
-extern struct pci_ops ddb5477_ext_pci_ops;
-extern struct pci_ops ddb5477_io_pci_ops;
-
-struct pci_controller ddb5477_ext_controller = {
-       .pci_ops        = &ddb5477_ext_pci_ops,
-       .io_resource    = &extpci_io_resource,
-       .mem_resource   = &extpci_mem_resource
-};
-
-struct pci_controller ddb5477_io_controller = {
-       .pci_ops        = &ddb5477_io_pci_ops,
-       .io_resource    = &iopci_io_resource,
-       .mem_resource   = &iopci_mem_resource
-};
-
-
-
-/*
- * we fix up irqs based on the slot number.
- * The first entry is at AD:11.
- * Fortunately this works because, although we have two pci buses,
- * they all have different slot numbers (except for rockhopper slot 20
- * which is handled below).
- *
- */
-
-/*
- * irq mapping : device -> pci int # -> vrc4377 irq# ,
- * ddb5477 board manual page 4  and vrc5477 manual page 46
- */
-
-/*
- * based on ddb5477 manual page 11
- */
-#define                MAX_SLOT_NUM            21
-static unsigned char irq_map[MAX_SLOT_NUM] = {
-       /* SLOT:  0, AD:11 */ 0xff,
-       /* SLOT:  1, AD:12 */ 0xff,
-       /* SLOT:  2, AD:13 */ 0xff,
-       /* SLOT:  3, AD:14 */ 0xff,
-       /* SLOT:  4, AD:15 */ VRC5477_IRQ_INTA, /* onboard tulip */
-       /* SLOT:  5, AD:16 */ VRC5477_IRQ_INTB, /* slot 1 */
-       /* SLOT:  6, AD:17 */ VRC5477_IRQ_INTC, /* slot 2 */
-       /* SLOT:  7, AD:18 */ VRC5477_IRQ_INTD, /* slot 3 */
-       /* SLOT:  8, AD:19 */ VRC5477_IRQ_INTE, /* slot 4 */
-       /* SLOT:  9, AD:20 */ 0xff,
-       /* SLOT: 10, AD:21 */ 0xff,
-       /* SLOT: 11, AD:22 */ 0xff,
-       /* SLOT: 12, AD:23 */ 0xff,
-       /* SLOT: 13, AD:24 */ 0xff,
-       /* SLOT: 14, AD:25 */ 0xff,
-       /* SLOT: 15, AD:26 */ 0xff,
-       /* SLOT: 16, AD:27 */ 0xff,
-       /* SLOT: 17, AD:28 */ 0xff,
-       /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */
-       /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */
-       /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */
-};
-static unsigned char rockhopperII_irq_map[MAX_SLOT_NUM] = {
-       /* SLOT:  0, AD:11 */ 0xff,
-       /* SLOT:  1, AD:12 */ VRC5477_IRQ_INTB, /* onboard AMD PCNET */
-       /* SLOT:  2, AD:13 */ 0xff,
-       /* SLOT:  3, AD:14 */ 0xff,
-       /* SLOT:  4, AD:15 */ 14, /* M5229 ide ISA irq */
-       /* SLOT:  5, AD:16 */ VRC5477_IRQ_INTD, /* slot 3 */
-       /* SLOT:  6, AD:17 */ VRC5477_IRQ_INTA, /* slot 4 */
-       /* SLOT:  7, AD:18 */ VRC5477_IRQ_INTD, /* slot 5 */
-       /* SLOT:  8, AD:19 */ 0, /* M5457 modem nop */
-       /* SLOT:  9, AD:20 */ VRC5477_IRQ_INTA, /* slot 2 */
-       /* SLOT: 10, AD:21 */ 0xff,
-       /* SLOT: 11, AD:22 */ 0xff,
-       /* SLOT: 12, AD:23 */ 0xff,
-       /* SLOT: 13, AD:24 */ 0xff,
-       /* SLOT: 14, AD:25 */ 0xff,
-       /* SLOT: 15, AD:26 */ 0xff,
-       /* SLOT: 16, AD:27 */ 0xff,
-       /* SLOT: 17, AD:28 */ 0, /* M7101 PMU nop */
-       /* SLOT: 18, AD:29 */ VRC5477_IRQ_IOPCI_INTC, /* vrc5477 ac97 */
-       /* SLOT: 19, AD:30 */ VRC5477_IRQ_IOPCI_INTB, /* vrc5477 usb peri */
-       /* SLOT: 20, AD:31 */ VRC5477_IRQ_IOPCI_INTA, /* vrc5477 usb host */
-};
-
-int __init pcibios_map_irq(const struct pci_dev *dev, u8 slot, u8 pin)
-{
-       int slot_num;
-       unsigned char *slot_irq_map;
-       unsigned char irq;
-
-       /*
-        * We ignore the swizzled slot and pin values.  The original
-        * pci_fixup_irq() codes largely base irq number on the dev slot
-        * numbers because except for one case they are unique even
-        * though there are multiple pci buses.
-        */
-
-       if (mips_machtype == MACH_NEC_ROCKHOPPERII)
-               slot_irq_map = rockhopperII_irq_map;
-       else
-               slot_irq_map = irq_map;
-
-       slot_num = PCI_SLOT(dev->devfn);
-       irq = slot_irq_map[slot_num];
-
-       db_assert(slot_num < MAX_SLOT_NUM);
-
-       db_assert(irq != 0xff);
-
-       pci_write_config_byte(dev, PCI_INTERRUPT_LINE, irq);
-
-       if (mips_machtype == MACH_NEC_ROCKHOPPERII) {
-               /* hack to distinquish overlapping slot 20s, one
-                * on bus 0 (ALI USB on the M1535 on the backplane),
-                * and one on bus 2 (NEC USB controller on the CPU board)
-                * Make the M1535 USB - ISA IRQ number 9.
-                */
-               if (slot_num == 20 && dev->bus->number == 0) {
-                       pci_write_config_byte(dev,
-                                             PCI_INTERRUPT_LINE,
-                                             9);
-                       irq = 9;
-               }
-
-       }
-
-       return irq;
-}
-
-/* Do platform specific device initialization at pci_enable_device() time */
-int pcibios_plat_dev_init(struct pci_dev *dev)
-{
-       return 0;
-}
-
-void ddb_pci_reset_bus(void)
-{
-       u32 temp;
-
-       /*
-        * I am not sure about the "official" procedure, the following
-        * steps work as far as I know:
-        * We first set PCI cold reset bit (bit 31) in PCICTRL-H.
-        * Then we clear the PCI warm reset bit (bit 30) to 0 in PCICTRL-H.
-        * The same is true for both PCI channels.
-        */
-       temp = ddb_in32(DDB_PCICTL0_H);
-       temp |= 0x80000000;
-       ddb_out32(DDB_PCICTL0_H, temp);
-       temp &= ~0xc0000000;
-       ddb_out32(DDB_PCICTL0_H, temp);
-
-       temp = ddb_in32(DDB_PCICTL1_H);
-       temp |= 0x80000000;
-       ddb_out32(DDB_PCICTL1_H, temp);
-       temp &= ~0xc0000000;
-       ddb_out32(DDB_PCICTL1_H, temp);
-}
diff --git a/arch/mips/pci/pci-ocelot.c b/arch/mips/pci/pci-ocelot.c
deleted file mode 100644 (file)
index 1421d34..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/*
- * BRIEF MODULE DESCRIPTION
- * Galileo Evaluation Boards PCI support.
- *
- * The general-purpose functions to read/write and configure the GT64120A's
- * PCI registers (function names start with pci0 or pci1) are either direct
- * copies of functions written by Galileo Technology, or are modifications
- * of their functions to work with Linux 2.4 vs Linux 2.2.  These functions
- * are Copyright - Galileo Technology.
- *
- * Other functions are derived from other MIPS PCI implementations, or were
- * written by RidgeRun, Inc,  Copyright (C) 2000 RidgeRun, Inc.
- *   glonnon@ridgerun.com, skranz@ridgerun.com, stevej@ridgerun.com
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-#include <linux/init.h>
-#include <linux/types.h>
-#include <linux/pci.h>
-#include <linux/kernel.h>
-#include <linux/slab.h>
-#include <linux/cache.h>
-#include <asm/pci.h>
-#include <asm/io.h>
-#include <asm/gt64120.h>
-
-static inline unsigned int pci0ReadConfigReg(unsigned int offset)
-{
-       unsigned int DataForRegCf8;
-       unsigned int data;
-
-       DataForRegCf8 = ((PCI_SLOT(device->devfn) << 11) |
-                        (PCI_FUNC(device->devfn) << 8) |
-                        (offset & ~0x3)) | 0x80000000;
-       GT_WRITE(GT_PCI0_CFGADDR_OFS, DataForRegCf8);
-       GT_READ(GT_PCI0_CFGDATA_OFS, &data);
-
-       return data;
-}
-
-static inline void pci0WriteConfigReg(unsigned int offset, unsigned int data)
-{
-       unsigned int DataForRegCf8;
-
-       DataForRegCf8 = ((PCI_SLOT(device->devfn) << 11) |
-                        (PCI_FUNC(device->devfn) << 8) |
-                        (offset & ~0x3)) | 0x80000000;
-       GT_WRITE(GT_PCI0_CFGADDR_OFS, DataForRegCf8);
-       GT_WRITE(GT_PCI0_CFGDATA_OFS, data);
-}
-
-static struct resource ocelot_mem_resource = {
-       .start  = GT_PCI_MEM_BASE,
-       .end    = GT_PCI_MEM_BASE + GT_PCI_MEM_BASE - 1,
-};
-
-static struct resource ocelot_io_resource = {
-       .start  = GT_PCI_IO_BASE,
-       .end    = GT_PCI_IO_BASE + GT_PCI_IO_SIZE - 1,
-};
-
-static struct pci_controller ocelot_pci_controller = {
-       .pci_ops        = gt64xxx_pci0_ops,
-       .mem_resource   = &ocelot_mem_resource,
-       .io_resource    = &ocelot_io_resource,
-};
-
-static int __init ocelot_pcibios_init(void)
-{
-       u32 tmp;
-
-       GT_READ(GT_PCI0_CMD_OFS, &tmp);
-       GT_READ(GT_PCI0_BARE_OFS, &tmp);
-
-       /*
-        * You have to enable bus mastering to configure any other
-        * card on the bus.
-        */
-       tmp = pci0ReadConfigReg(PCI_COMMAND);
-       tmp |= PCI_COMMAND_MEMORY | PCI_COMMAND_MASTER | PCI_COMMAND_SERR;
-       pci0WriteConfigReg(PCI_COMMAND, tmp);
-
-       register_pci_controller(&ocelot_pci_controller);
-}
-
-arch_initcall(ocelot_pcibios_init);
index b7c638166e9f3a9927239f495e67a8429223c569..31cc1a5cec3b165379d34b0514ea9ba8056c376b 100644 (file)
@@ -25,3 +25,5 @@
 obj-y := setup.o prom.o int.o reset.o time.o proc.o platform.o
 obj-$(CONFIG_PCI) += pci.o
 obj-$(CONFIG_KGDB) += gdb_hook.o
+
+EXTRA_CFLAGS += -Werror
index e931e0d44229eee58b16b2cdc17c33965d9665ed..8fd9a04e353487bed0942e40fbc6cccf3fbc6c9b 100644 (file)
@@ -2,7 +2,9 @@
 # Makefile for the PMC-Sierra Titan
 #
 
-obj-y    += irq.o i2c-yosemite.o prom.o py-console.o setup.o
+obj-y    += irq.o prom.o py-console.o setup.o
 
 obj-$(CONFIG_KGDB)             += dbg_io.o
 obj-$(CONFIG_SMP)              += smp.o
+
+EXTRA_CFLAGS += -Werror
diff --git a/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c b/arch/mips/pmc-sierra/yosemite/i2c-yosemite.c
deleted file mode 100644 (file)
index 85b14c7..0000000
+++ /dev/null
@@ -1,188 +0,0 @@
-/*
- *  Copyright (C) 2003 PMC-Sierra Inc.
- *  Author: Manish Lachwani (lachwani@pmc-sierra.com)
- *
- *  This program is free software; you can redistribute  it and/or modify it
- *  under  the terms of  the GNU General  Public License as published by the
- *  Free Software Foundation;  either version 2 of the  License, or (at your
- *  option) any later version.
- *
- *  THIS  SOFTWARE  IS PROVIDED   ``AS  IS'' AND   ANY  EXPRESS OR IMPLIED
- *  WARRANTIES,   INCLUDING, BUT NOT  LIMITED  TO, THE IMPLIED WARRANTIES OF
- *  MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.  IN
- *  NO  EVENT  SHALL   THE AUTHOR  BE    LIABLE FOR ANY   DIRECT, INDIRECT,
- *  INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
- *  NOT LIMITED   TO, PROCUREMENT OF  SUBSTITUTE GOODS  OR SERVICES; LOSS OF
- *  USE, DATA,  OR PROFITS; OR  BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
- *  ANY THEORY OF LIABILITY, WHETHER IN  CONTRACT, STRICT LIABILITY, OR TORT
- *  (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
- *  THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
- *
- *  You should have received a copy of the  GNU General Public License along
- *  with this program; if not, write  to the Free Software Foundation, Inc.,
- *  675 Mass Ave, Cambridge, MA 02139, USA.
- */
-
-/*
- * Detailed Description:
- *
- * This block implements the I2C interface to the slave devices like the
- * Atmel 24C32 EEPROM and the MAX 1619 Sensors device. The I2C Master interface
- * can be controlled by the SCMB block. And the SCMB block kicks in only when
- * using the Ethernet Mode of operation and __not__ the SysAD mode
- *
- * The SCMB controls the two modes: MDIO and the I2C. The MDIO mode is used to
- * communicate with the Quad-PHY from Marvel. The I2C is used to communicate
- * with the I2C slave devices.  It seems that the driver does not explicitly
- * deal with the control of SDA and SCL serial lines. So, the driver will set
- * the slave address, drive the command and then the data.  The SCMB will then
- * control the two serial lines as required.
- *
- * It seems the documents are very unclear abt this. Hence, I took some time
- * out to write the desciption to have an idea of how the I2C can actually
- * work. Currently, this Linux driver wont be integrated into the generic Linux
- * I2C framework. And finally, the I2C interface is also known as the 2BI
- * interface. 2BI means 2-bit interface referring to SDA and SCL serial lines
- * respectively.
- *
- * - Manish Lachwani (12/09/2003)
- */
-
-#include "i2c-yosemite.h"
-
-/*
- * Poll the I2C interface for the BUSY bit.
- */
-static int titan_i2c_poll(void)
-{
-       int i = 0;
-       unsigned long val = 0;
-
-       for (i = 0; i < TITAN_I2C_MAX_POLL; i++) {
-               val = TITAN_I2C_READ(TITAN_I2C_COMMAND);
-
-               if (!(val & 0x8000))
-                       return 0;
-       }
-
-       return TITAN_I2C_ERR_TIMEOUT;
-}
-
-/*
- * Execute the I2C command
- */
-int titan_i2c_xfer(unsigned int slave_addr, titan_i2c_command * cmd,
-                  int size, unsigned int *addr)
-{
-       int loop, bytes = 0, i;
-       unsigned int *write_data, data, *read_data;
-       unsigned long reg_val, val;
-
-       write_data = cmd->data;
-       read_data = addr;
-
-       TITAN_I2C_WRITE(TITAN_I2C_SLAVE_ADDRESS, slave_addr);
-
-       if (cmd->type == TITAN_I2C_CMD_WRITE)
-               loop = cmd->write_size;
-       else
-               loop = size;
-
-       while (loop > 0) {
-               if ((cmd->type == TITAN_I2C_CMD_WRITE) ||
-                   (cmd->type == TITAN_I2C_CMD_READ_WRITE)) {
-
-                       reg_val = TITAN_I2C_DATA;
-                       for (i = 0; i < TITAN_I2C_MAX_WORDS_PER_RW;
-                            ++i, write_data += 2, reg_val += 4) {
-                               if (bytes < cmd->write_size) {
-                                       data = write_data[0];
-                                       ++data;
-                               }
-
-                               if (bytes < cmd->write_size) {
-                                       data = write_data[1];
-                                       ++data;
-                               }
-
-                               TITAN_I2C_WRITE(reg_val, data);
-                       }
-               }
-
-               TITAN_I2C_WRITE(TITAN_I2C_COMMAND,
-                               (unsigned int) (cmd->type << 13));
-               if (titan_i2c_poll() != TITAN_I2C_ERR_OK)
-                       return TITAN_I2C_ERR_TIMEOUT;
-
-               if ((cmd->type == TITAN_I2C_CMD_READ) ||
-                   (cmd->type == TITAN_I2C_CMD_READ_WRITE)) {
-
-                       reg_val = TITAN_I2C_DATA;
-                       for (i = 0; i < TITAN_I2C_MAX_WORDS_PER_RW;
-                            ++i, read_data += 2, reg_val += 4) {
-                               data = TITAN_I2C_READ(reg_val);
-
-                               if (bytes < size) {
-                                       read_data[0] = data & 0xff;
-                                       ++bytes;
-                               }
-
-                               if (bytes < size) {
-                                       read_data[1] =
-                                           ((data >> 8) & 0xff);
-                                       ++bytes;
-                               }
-                       }
-               }
-
-               loop -= (TITAN_I2C_MAX_WORDS_PER_RW * 2);
-       }
-
-       /*
-        * Read the Interrupt status and then return the appropriate error code
-        */
-
-       val = TITAN_I2C_READ(TITAN_I2C_INTERRUPTS);
-       if (val & 0x0020)
-               return TITAN_I2C_ERR_ARB_LOST;
-
-       if (val & 0x0040)
-               return TITAN_I2C_ERR_NO_RESP;
-
-       if (val & 0x0080)
-               return TITAN_I2C_ERR_DATA_COLLISION;
-
-       return TITAN_I2C_ERR_OK;
-}
-
-/*
- * Init the I2C subsystem of the PMC-Sierra Yosemite board
- */
-int titan_i2c_init(titan_i2c_config * config)
-{
-       unsigned int val;
-
-       /*
-        * Reset the SCMB and program into the I2C mode
-        */
-       TITAN_I2C_WRITE(TITAN_I2C_SCMB_CONTROL, 0xA000);
-       TITAN_I2C_WRITE(TITAN_I2C_SCMB_CONTROL, 0x2000);
-
-       /*
-        * Configure the filtera and clka values
-        */
-       val = TITAN_I2C_READ(TITAN_I2C_SCMB_CLOCK_A);
-       val |= ((val & ~(0xF000)) | ((config->filtera << 12) & 0xF000));
-       val |= ((val & ~(0x03FF)) | (config->clka & 0x03FF));
-       TITAN_I2C_WRITE(TITAN_I2C_SCMB_CLOCK_A, val);
-
-       /*
-        * Configure the filterb and clkb values
-        */
-       val = TITAN_I2C_READ(TITAN_I2C_SCMB_CLOCK_B);
-       val |= ((val & ~(0xF000)) | ((config->filterb << 12) & 0xF000));
-       val |= ((val & ~(0x03FF)) | (config->clkb & 0x03FF));
-       TITAN_I2C_WRITE(TITAN_I2C_SCMB_CLOCK_B, val);
-
-       return TITAN_I2C_ERR_OK;
-}
index 428d1f45a2872fc2289149ec1d4b0f1de1b17e31..4decc28078673203a4355c9d7c64950a25c6d6c7 100644 (file)
@@ -56,6 +56,9 @@
 #define HYPERTRANSPORT_INTC     0x7a           /* INTC# */
 #define HYPERTRANSPORT_INTD     0x7b           /* INTD# */
 
+extern void titan_mailbox_irq(void);
+
+#ifdef CONFIG_HYPERTRANSPORT
 /*
  * Handle hypertransport & SMP interrupts. The interrupt lines are scarce.
  * For interprocessor interrupts, the best thing to do is to use the INTMSG
@@ -107,6 +110,7 @@ static void ll_ht_smp_irq_handler(int irq)
 
        do_IRQ(irq);
 }
+#endif
 
 asmlinkage void plat_irq_dispatch(void)
 {
index 1e1685e415a4504d0c94d9ea0470befdb42ccf82..0cd78f0f5f2d2fcef04953fe26b24541b8448289 100644 (file)
@@ -34,7 +34,7 @@ extern void prom_grab_secondary(void);
 struct callvectors *debug_vectors;
 
 extern unsigned long yosemite_base;
-extern unsigned long cpu_clock;
+extern unsigned long cpu_clock_freq;
 
 const char *get_system_type(void)
 {
@@ -119,7 +119,7 @@ void __init prom_init(void)
                                          16);
 
                if (strncmp("cpuclock", *env, strlen("cpuclock")) == 0)
-                       cpu_clock =
+                       cpu_clock_freq =
                            simple_strtol(*env + strlen("cpuclock="), NULL,
                                          10);
 
index f7f93ae24c3491ce33b4b10da46fda2931ce131a..58862c8d1d001061c7110a5bbe8567b3c42b77b4 100644 (file)
@@ -59,7 +59,7 @@ unsigned char titan_ge_mac_addr_base[6] = {
        0x00, 0xe0, 0x04, 0x00, 0x00, 0x21
 };
 
-unsigned long cpu_clock;
+unsigned long cpu_clock_freq;
 unsigned long yosemite_base;
 
 static struct m48t37_rtc *m48t37_base;
@@ -140,7 +140,7 @@ void __init plat_timer_setup(struct irqaction *irq)
 
 void yosemite_time_init(void)
 {
-       mips_hpt_frequency = cpu_clock / 2;
+       mips_hpt_frequency = cpu_clock_freq / 2;
 mips_hpt_frequency = 33000000 * 3 * 5;
 }
 
index d83c4ada14f33565833bbb3603b40e502920ef0c..1c852d6a7654174c1462f60bc4575c8e92e362c0 100644 (file)
@@ -106,23 +106,28 @@ void prom_smp_finish(void)
 {
 }
 
-asmlinkage void titan_mailbox_irq(void)
+void titan_mailbox_irq(void)
 {
        int cpu = smp_processor_id();
        unsigned long status;
 
-       if (cpu == 0) {
+       switch (cpu) {
+       case 0:
                status = OCD_READ(RM9000x2_OCD_INTP0STATUS3);
                OCD_WRITE(RM9000x2_OCD_INTP0CLEAR3, status);
-       }
 
-       if (cpu == 1) {
+               if (status & 0x2)
+                       smp_call_function_interrupt();
+               break;
+
+       case 1:
                status = OCD_READ(RM9000x2_OCD_INTP1STATUS3);
                OCD_WRITE(RM9000x2_OCD_INTP1CLEAR3, status);
-       }
 
-       if (status & 0x2)
-               smp_call_function_interrupt();
+               if (status & 0x2)
+                       smp_call_function_interrupt();
+               break;
+       }
 }
 
 /*
index 078cd3029c9ff9228b561e59690b6ef631727db6..cec24c117f6e21448d42a4867f63699c57459e6a 100644 (file)
@@ -5,3 +5,5 @@
 obj-y          = q-firmware.o q-irq.o q-mem.o q-setup.o q-reset.o
 
 obj-$(CONFIG_SMP) += q-smp.o
+
+EXTRA_CFLAGS += -Werror
index 7ce76e20beb963baa8a62bef1707bbd9c18a483d..e0a6871d56e4501f947c662d19ba2267bad07d20 100644 (file)
@@ -9,3 +9,5 @@ obj-y   := ip27-berr.o ip27-irq.o ip27-init.o ip27-klconfig.o ip27-klnuma.o \
 obj-$(CONFIG_EARLY_PRINTK)     += ip27-console.o
 obj-$(CONFIG_KGDB)             += ip27-dbgio.o
 obj-$(CONFIG_SMP)              += ip27-smp.o
+
+EXTRA_CFLAGS += -Werror
index f9f404a8ddad625348975d4678ee4183b21de102..f10d9839006dcad55b0e4346664f4d9773678e6d 100644 (file)
@@ -28,8 +28,6 @@ static cpumask_t ktext_repmask;
  */
 void __init setup_replication_mask(void)
 {
-       cnodeid_t       cnode;
-
        /* Set only the master cnode's bit.  The master cnode is always 0. */
        cpus_clear(ktext_repmask);
        cpu_set(0, ktext_repmask);
@@ -38,11 +36,15 @@ void __init setup_replication_mask(void)
 #ifndef CONFIG_MAPPED_KERNEL
 #error Kernel replication works with mapped kernel support. No calias support.
 #endif
-       for_each_online_node(cnode) {
-               if (cnode == 0)
-                       continue;
-               /* Advertise that we have a copy of the kernel */
-               cpu_set(cnode, ktext_repmask);
+       {
+               cnodeid_t       cnode;
+
+               for_each_online_node(cnode) {
+                       if (cnode == 0)
+                               continue;
+                       /* Advertise that we have a copy of the kernel */
+                       cpu_set(cnode, ktext_repmask);
+               }
        }
 #endif
        /* Set up a GDA pointer to the replication mask. */
index 09fa7f5216f0f294217e368fcb6e7f0dc91e3d6e..08e79141b47c9ecb0e2c4d9b6122dc832333022d 100644 (file)
@@ -181,7 +181,7 @@ void __init prom_boot_secondary(int cpu, struct task_struct *idle)
                0, (void *) sp, (void *) gp);
 }
 
-void prom_init_secondary(void)
+void __cpuinit prom_init_secondary(void)
 {
        per_cpu_init();
        local_irq_enable();
index 60f0227425e709ba82a9a882158a1b2e5ecb4e49..31c9aa1bcb40b4fe389c9b7a72badc156a848092 100644 (file)
@@ -5,3 +5,5 @@
 
 obj-y  += ip32-berr.o ip32-irq.o ip32-platform.o ip32-setup.o ip32-reset.o \
           crime.o ip32-memory.o
+
+EXTRA_CFLAGS += -Werror
index db8084411538bc3bcdfa6ef047eca8f1d835c2ed..624bbdbff2a8bf40d47ae412d5361b43369b9b36 100644 (file)
@@ -195,7 +195,8 @@ static __init int ip32_reboot_setup(void)
        blink_timer.function = blink_timeout;
        atomic_notifier_chain_register(&panic_notifier_list, &panic_block);
 
-       request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL);
+       if (request_irq(MACEISA_RTC_IRQ, ip32_rtc_int, 0, "rtc", NULL))
+               panic("Can't allocate MACEISA RTC IRQ");
 
        return 0;
 }
index cdc4c56c3e29238158cafa0e09422780e46af1ac..f292f7df0cfb115043c9e250a8be5b493c1aa5b7 100644 (file)
@@ -1,3 +1,5 @@
 obj-y := setup.o irq.o time.o
 
 obj-$(CONFIG_SMP)                      += smp.o
+
+EXTRA_CFLAGS += -Werror
index 89f29233cae190aac61e380e9bdb5bfdaf8423fb..bb28f28e8042254da6c19bbd6ece9da20bba8de8 100644 (file)
@@ -16,6 +16,7 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 #include <linux/kernel.h>
+#include <linux/module.h>
 #include <linux/reboot.h>
 #include <linux/string.h>
 
index 8a06a4fb52123e6c1525140e85db62dbf7cdfea6..f8ae30066a056ea24c509ac92b2adaeefb40b3fd 100644 (file)
@@ -3,3 +3,4 @@ obj-y :=
 obj-$(CONFIG_SIBYTE_TBPROF)            += sb_tbprof.o
 
 EXTRA_AFLAGS := $(CFLAGS)
+EXTRA_CFLAGS += -Werror
index df662c61473aa599cefabf87b1d16ce57c29c5a7..697793783a256a436782aebb26be847d6dee5570 100644 (file)
@@ -3,3 +3,5 @@ obj-y := setup.o irq.o time.o
 obj-$(CONFIG_SMP)                      += smp.o
 obj-$(CONFIG_SIBYTE_STANDALONE)                += prom.o
 obj-$(CONFIG_SIBYTE_BUS_WATCHER)       += bus_watcher.o
+
+EXTRA_CFLAGS += -Werror
index 471418e4f446a4abc77dcd906bc93f52b554e66d..3a99cd62c0bd5cca18709fd93e36afeb1ff9261a 100644 (file)
@@ -4,3 +4,5 @@
 
 obj-y += irq.o reset.o setup.o a20r.o rm200.o pcimt.o pcit.o time.o
 obj-$(CONFIG_CPU_BIG_ENDIAN) += sniprom.o
+
+EXTRA_CFLAGS += -Werror
index 3d25d010f3d5bcaf1fc45272ba0256aad1363c1f..00b0b975f34910a12c8bc70a6c350e4aec8ef56e 100644 (file)
@@ -43,6 +43,9 @@
 #include <asm/mipsregs.h>
 #include <asm/system.h>
 #include <asm/tx4927/tx4927.h>
+#ifdef CONFIG_TOSHIBA_RBTX4927
+#include <asm/tx4927/toshiba_rbtx4927.h>
+#endif
 
 /*
  * DEBUG
index 5cc30c10e746128f5e544e0a06dfd9f57c747885..e265fcd31b600922bfa92634a0d24ef70f2443d1 100644 (file)
@@ -262,8 +262,6 @@ u32 bit2num(u32 num)
 int toshiba_rbtx4927_irq_nested(int sw_irq)
 {
        u32 level3;
-       u32 level4;
-       u32 level5;
 
        level3 = reg_rd08(TOSHIBA_RBTX4927_IOC_INTR_STAT) & 0x1f;
        if (level3) {
@@ -275,6 +273,8 @@ int toshiba_rbtx4927_irq_nested(int sw_irq)
 #ifdef CONFIG_TOSHIBA_FPCIB0
        {
                if (tx4927_using_backplane) {
+                       u32 level4;
+                       u32 level5;
                        outb(0x0A, 0x20);
                        level4 = inb(0x20) & 0xff;
                        if (level4) {
index ab72292a172e65bd7639e4cf1aa8649b8de6584a..ea5a70b252a09c34a55ff6bb19131b115a9c7a03 100644 (file)
@@ -159,58 +159,6 @@ int tx4927_pci66 = 0;              /* 0:auto */
 char *toshiba_name = "";
 
 #ifdef CONFIG_PCI
-static void tx4927_pcierr_interrupt(int irq, void *dev_id)
-{
-#ifdef CONFIG_BLK_DEV_IDEPCI
-       /* ignore MasterAbort for ide probing... */
-       if (irq == TX4927_IRQ_IRC_PCIERR &&
-           ((tx4927_pcicptr->pcistatus >> 16) & 0xf900) ==
-           PCI_STATUS_REC_MASTER_ABORT) {
-               tx4927_pcicptr->pcistatus =
-                   (tx4927_pcicptr->
-                    pcistatus & 0x0000ffff) | (PCI_STATUS_REC_MASTER_ABORT
-                                               << 16);
-
-               return;
-       }
-#endif
-       printk("PCI error interrupt (irq 0x%x).\n", irq);
-
-       printk("pcistat:%04x, g2pstatus:%08lx, pcicstatus:%08lx\n",
-              (unsigned short) (tx4927_pcicptr->pcistatus >> 16),
-              tx4927_pcicptr->g2pstatus, tx4927_pcicptr->pcicstatus);
-       printk("ccfg:%08lx, tear:%02lx_%08lx\n",
-              (unsigned long) tx4927_ccfgptr->ccfg,
-              (unsigned long) (tx4927_ccfgptr->tear >> 32),
-              (unsigned long) tx4927_ccfgptr->tear);
-       show_regs(get_irq_regs());
-}
-
-void __init toshiba_rbtx4927_pci_irq_init(void)
-{
-       return;
-}
-
-void tx4927_reset_pci_pcic(void)
-{
-       /* Reset PCI Bus */
-       *tx4927_pcireset_ptr = 1;
-       /* Reset PCIC */
-       tx4927_ccfgptr->clkctr |= TX4927_CLKCTR_PCIRST;
-       udelay(10000);
-       /* clear PCIC reset */
-       tx4927_ccfgptr->clkctr &= ~TX4927_CLKCTR_PCIRST;
-       *tx4927_pcireset_ptr = 0;
-}
-#endif /* CONFIG_PCI */
-
-#ifdef CONFIG_PCI
-void print_pci_status(void)
-{
-       printk("PCI STATUS %lx\n", tx4927_pcicptr->pcistatus);
-       printk("PCIC STATUS %lx\n", tx4927_pcicptr->pcicstatus);
-}
-
 extern struct pci_controller tx4927_controller;
 
 static struct pci_dev *fake_pci_dev(struct pci_controller *hose,
@@ -239,10 +187,8 @@ static int early_##rw##_config_##size(struct pci_controller *hose,      \
 }
 
 EARLY_PCI_OP(read, byte, u8 *)
-EARLY_PCI_OP(read, word, u16 *)
 EARLY_PCI_OP(read, dword, u32 *)
 EARLY_PCI_OP(write, byte, u8)
-EARLY_PCI_OP(write, word, u16)
 EARLY_PCI_OP(write, dword, u32)
 
 static int __init tx4927_pcibios_init(void)
@@ -269,7 +215,9 @@ static int __init tx4927_pcibios_init(void)
                        u8 v08_64;
                        u32 v32_b0;
                        u8 v08_e1;
+#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
                        char *s = " sb/isa --";
+#endif
 
                        TOSHIBA_RBTX4927_SETUP_DPRINTK
                            (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
@@ -354,7 +302,9 @@ static int __init tx4927_pcibios_init(void)
                        u8 v08_41;
                        u8 v08_43;
                        u8 v08_5c;
+#ifdef TOSHIBA_RBTX4927_SETUP_DEBUG
                        char *s = " sb/ide --";
+#endif
 
                        TOSHIBA_RBTX4927_SETUP_DPRINTK
                            (TOSHIBA_RBTX4927_SETUP_PCIBIOS, ":%s beg\n",
index 6ed39a5aea7262b0e9941818234e0b7cfc712771..f9ad482749e4b995ce4dc88476d9379ff800e9ff 100644 (file)
@@ -657,7 +657,7 @@ void __init tx4938_board_setup(void)
 
        /* clocks */
        if (txx9_master_clock) {
-               /* calculate gbus_clock and cpu_clock from master_clock */
+               /* calculate gbus_clock and cpu_clock_freq from master_clock */
                divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK;
                switch (divmode) {
                case TX4938_CCFG_DIVMODE_8:
@@ -691,7 +691,7 @@ void __init tx4938_board_setup(void)
                if (txx9_cpu_clock == 0) {
                        txx9_cpu_clock = 300000000;     /* 300MHz */
                }
-               /* calculate gbus_clock and master_clock from cpu_clock */
+               /* calculate gbus_clock and master_clock from cpu_clock_freq */
                cpuclk = txx9_cpu_clock;
                divmode = (unsigned long)tx4938_ccfgptr->ccfg & TX4938_CCFG_DIVMODE_MASK;
                switch (divmode) {
index d0d84ec8d63de98428e612484b651a3c2211e554..7d5d83b8c582b81c5428a7a0728facf5ca6bed4a 100644 (file)
@@ -3,3 +3,5 @@
 #
 
 obj-y  += bcu.o cmu.o giu.o icu.o init.o irq.o pmu.o rtc.o siu.o type.o
+
+EXTRA_CFLAGS += -Werror
index f2042e6466a4086e8845759bf70639572d9575c6..1263f00dc35d568a63605890b2edcbb544facb5a 100644 (file)
@@ -23,6 +23,7 @@
 
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/sched.h>
 #include <linux/file.h>
 #include <linux/slab.h>
index 8384bf9cecd240c77ae5f2b9f4ec6c2e1ced5eab..446f98d3fd7bd025018bac31b36034b9e0753a96 100644 (file)
@@ -23,6 +23,7 @@
  */
 
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init.h>
index 355664812b8319e1d0c9b01115fd4dbe162f8dc2..b80e02a4d81de3d193ec1faae269b7614a783cf1 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/personality.h>
 #include <linux/ptrace.h>
index 04c7e1d36cea781713e979f5e2e0755a5c961e65..d7bc7bb42c94e11baf1da17597b9bf0017b50608 100644 (file)
@@ -28,6 +28,7 @@
 #include <linux/smp.h>
 #include <linux/kernel_stat.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/delay.h>
 #include <linux/bitops.h>
 
index 346cd3befe1e2252bb0c132e20d3b9f33aefd8ad..22acece95b118d5c6055fed0f72ff7c5a1cbe18b 100644 (file)
@@ -20,7 +20,7 @@ config DEBUG_STACK_USAGE
 
 config DEBUG_PAGEALLOC
         bool "Debug page memory allocations"
-        depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+        depends on DEBUG_KERNEL && !HIBERNATION
         help
           Unmap pages from the kernel linear mapping after free_pages().
           This results in a large slowdown, but helps to find certain types
@@ -134,7 +134,7 @@ config BDI_SWITCH
 
 config BOOTX_TEXT
        bool "Support for early boot text console (BootX or OpenFirmware only)"
-       depends PPC_OF
+       depends PPC_OF && PPC_MULTIPLATFORM
        help
          Say Y here to see progress messages from the boot firmware in text
          mode. Requires either BootX or Open Firmware.
index a983680c326384d3125ba1d39a65163b7455bada..122537419d9f75d9f99cde8fb25c9ff35f69bc0b 100644 (file)
@@ -33,12 +33,10 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHD.dtb -V 16 kuroboxHD.dts"
                PowerPC,603e { /* Really 8241 */
                        device_type = "cpu";
                        reg = <0>;
-                       clock-frequency = <bebc200>;    /* Fixed by bootwrapper */
-                       timebase-frequency = <1743000>; /* Fixed by bootwrapper */
-                       bus-frequency = <0>;            /* From bootloader */
+                       clock-frequency = <bebc200>;    /* Fixed by bootloader */
+                       timebase-frequency = <1743000>; /* Fixed by bootloader */
+                       bus-frequency = <0>;            /* Fixed by bootloader */
                        /* Following required by dtc but not used */
-                       i-cache-line-size = <0>;
-                       d-cache-line-size = <0>;
                        i-cache-size = <4000>;
                        d-cache-size = <4000>;
                };
@@ -64,11 +62,19 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHD.dtb -V 16 kuroboxHD.dts"
                          fef00000 fef00000 00100000>;  /* pci iack */
 
                i2c@80003000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        device_type = "i2c";
                        compatible = "fsl-i2c";
                        reg = <80003000 1000>;
                        interrupts = <5 2>;
                        interrupt-parent = <&mpic>;
+
+                       rtc@32 {
+                               device_type = "rtc";
+                               compatible = "ricoh,rs5c372b";
+                               reg = <32>;
+                       };
                };
 
                serial@80004500 {
@@ -91,7 +97,7 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHD.dtb -V 16 kuroboxHD.dts"
                        interrupt-parent = <&mpic>;
                };
 
-               mpic: pic@80040000 {
+               mpic: interrupt-controller@80040000 {
                        #interrupt-cells = <2>;
                        #address-cells = <0>;
                        device_type = "open-pic";
index 5cf42dc022dfa816985eb37033b2b1427a0b1e27..579aa8b967d94be8c6b28a7aa7530ec143f6b8e2 100644 (file)
@@ -33,12 +33,10 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts"
                PowerPC,603e { /* Really 8241 */
                        device_type = "cpu";
                        reg = <0>;
-                       clock-frequency = <fdad680>;    /* Fixed by bootwrapper */
-                       timebase-frequency = <1F04000>; /* Fixed by bootwrapper */
-                       bus-frequency = <0>;            /* From bootloader */
+                       clock-frequency = <fdad680>;    /* Fixed by bootloader */
+                       timebase-frequency = <1F04000>; /* Fixed by bootloader */
+                       bus-frequency = <0>;            /* Fixed by bootloader */
                        /* Following required by dtc but not used */
-                       i-cache-line-size = <0>;
-                       d-cache-line-size = <0>;
                        i-cache-size = <4000>;
                        d-cache-size = <4000>;
                };
@@ -64,11 +62,19 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts"
                          fef00000 fef00000 00100000>;  /* pci iack */
 
                i2c@80003000 {
+                       #address-cells = <1>;
+                       #size-cells = <0>;
                        device_type = "i2c";
                        compatible = "fsl-i2c";
                        reg = <80003000 1000>;
                        interrupts = <5 2>;
                        interrupt-parent = <&mpic>;
+
+                       rtc@32 {
+                               device_type = "rtc";
+                               compatible = "ricoh,rs5c372b";
+                               reg = <32>;
+                       };
                };
 
                serial@80004500 {
@@ -91,8 +97,7 @@ build with: "dtc -f -I dts -O dtb -o kuroboxHG.dtb -V 16 kuroboxHG.dts"
                        interrupt-parent = <&mpic>;
                };
 
-               mpic: pic@80040000 {
-                       interrupt-parent = <&mpic>;
+               mpic: interrupt-controller@80040000 {
                        #interrupt-cells = <2>;
                        #address-cells = <0>;
                        device_type = "open-pic";
index 0e3d314a7158116351d5dccd4d6395eefd47e22b..b9158eb2797ea4e3e42b07b042a2e916227c5320 100644 (file)
@@ -45,7 +45,7 @@
                #address-cells = <1>;
                #size-cells = <1>;
                #interrupt-cells = <2>;
-               device_type = "tsi108-bridge";
+               device_type = "tsi-bridge";
                ranges = <00000000 c0000000 00010000>;
                reg = <c0000000 00010000>;
                bus-frequency = <0>;
index 4a900c6df762562b9f330d367af58de4f7ceb57c..4680e2010887e468d4fb4824f9fc795428943a31 100644 (file)
                        interrupts = <1d 2 1e 2 22 2>;
                        interrupt-parent = <&mpic>;
                        phy-handle = <&phy0>;
+                       phy-connection-type = "rgmii-id";
                };
 
                ethernet@26000 {
                        interrupts = <1f 2 20 2 21 2>;
                        interrupt-parent = <&mpic>;
                        phy-handle = <&phy1>;
+                       phy-connection-type = "rgmii-id";
                };
 
                serial@4500 {
 
                };
 
+               global-utilities@e0000 {        //global utilities block
+                       compatible = "fsl,mpc8548-guts";
+                       reg = <e0000 1000>;
+                       fsl,has-rstcr;
+               };
+
                mpic: pic@40000 {
                        clock-frequency = <0>;
                        interrupt-controller;
index 99fa5a0ea4255f9efff808d016828ddd0b774661..b1dcfbe8c1f8632b636ea1fe89215bc551862646 100644 (file)
                        interrupt-parent = <&mpic>;
                };
 
+               global-utilities@e0000 {        //global utilities block
+                       compatible = "fsl,mpc8548-guts";
+                       reg = <e0000 1000>;
+                       fsl,has-rstcr;
+               };
+
                pci@8000 {
                        interrupt-map-mask = <f800 0 0 7>;
                        interrupt-map = <
index 699d0df574d5b0bdc422b21be6192cc1dbf39296..5300b50cdc2f8ce2bddf32d17e67ffe34d787b1b 100644 (file)
                        interrupt-parent = <&/mv64x60/pic>;
                };
 
+               wdt@b410 {                      /* watchdog timer */
+                       compatible = "marvell,mv64x60-wdt";
+                       reg = <b410 8>;
+                       timeout = <a>;          /* wdt timeout in seconds */
+               };
+
                i2c@c000 {
                        device_type = "i2c";
                        compatible = "marvell,mv64x60-i2c";
index d12a981398b81b8e7fec19c4f600d89494d4402e..9c30ca451617fd519293a61ef703498089e10ede 100644 (file)
@@ -196,7 +196,7 @@ CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
 # CONFIG_PM_SYSFS_DEPRECATED is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 # CONFIG_WANT_DEVICE_TREE is not set
 CONFIG_ISA_DMA_API=y
index 0d8ba623e29a4c78369386c13f447d684799078e..08525d6fb1f1b9a61b27e218a864b37584f5a86d 100644 (file)
@@ -218,7 +218,7 @@ CONFIG_PM=y
 CONFIG_PM_DEBUG=y
 # CONFIG_DISABLE_CONSOLE_SUSPEND is not set
 CONFIG_PM_SYSFS_DEPRECATED=y
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_APM_EMULATION=y
 CONFIG_SECCOMP=y
index d0b43df444267a7696d7a0e9206461db66e4a8e2..ca7a197998ee5429a450802b7e7b756d1ce3d281 100644 (file)
@@ -1,9 +1,23 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.22-rc6
-# Tue Jun 26 14:15:19 2007
+# Linux kernel version: 2.6.23-rc2
+# Tue Aug  7 19:17:26 2007
 #
 CONFIG_PPC64=y
+
+#
+# Processor support
+#
+# CONFIG_POWER4_ONLY is not set
+CONFIG_POWER3=y
+CONFIG_POWER4=y
+CONFIG_PPC_FPU=y
+CONFIG_ALTIVEC=y
+CONFIG_PPC_STD_MMU=y
+# CONFIG_PPC_MM_SLICES is not set
+CONFIG_VIRT_CPU_ACCOUNTING=y
+CONFIG_SMP=y
+CONFIG_NR_CPUS=2
 CONFIG_64BIT=y
 CONFIG_PPC_MERGE=y
 CONFIG_MMU=y
@@ -15,6 +29,7 @@ CONFIG_ARCH_HAS_ILOG2_U64=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
+CONFIG_ARCH_NO_VIRT_TO_BUS=y
 CONFIG_PPC=y
 CONFIG_EARLY_PRINTK=y
 CONFIG_COMPAT=y
@@ -22,50 +37,32 @@ CONFIG_SYSVIPC_COMPAT=y
 CONFIG_SCHED_NO_NO_OMIT_FRAME_POINTER=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 CONFIG_PPC_OF=y
+CONFIG_OF=y
 # CONFIG_PPC_UDBG_16550 is not set
 # CONFIG_GENERIC_TBSYNC is not set
 CONFIG_AUDIT_ARCH=y
 CONFIG_GENERIC_BUG=y
 # CONFIG_DEFAULT_UIMAGE is not set
-
-#
-# Processor support
-#
-# CONFIG_POWER4_ONLY is not set
-CONFIG_POWER3=y
-CONFIG_POWER4=y
-CONFIG_PPC_FPU=y
 # CONFIG_PPC_DCR_NATIVE is not set
 # CONFIG_PPC_DCR_MMIO is not set
 # CONFIG_PPC_OF_PLATFORM_PCI is not set
-CONFIG_ALTIVEC=y
-CONFIG_PPC_STD_MMU=y
-# CONFIG_PPC_MM_SLICES is not set
-CONFIG_VIRT_CPU_ACCOUNTING=y
-CONFIG_SMP=y
-CONFIG_NR_CPUS=2
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
-# Code maturity level options
+# General setup
 #
 CONFIG_EXPERIMENTAL=y
 CONFIG_LOCK_KERNEL=y
 CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
 CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=17
@@ -100,10 +97,6 @@ CONFIG_SLAB=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
@@ -111,12 +104,9 @@ CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_BLK_DEV_IO_TRACE is not set
+CONFIG_BLK_DEV_BSG=y
 
 #
 # IO Schedulers
@@ -136,7 +126,9 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 #
 CONFIG_PPC_MULTIPLATFORM=y
 # CONFIG_EMBEDDED6xx is not set
-# CONFIG_APUS is not set
+# CONFIG_PPC_82xx is not set
+# CONFIG_PPC_83xx is not set
+# CONFIG_PPC_86xx is not set
 # CONFIG_PPC_PSERIES is not set
 # CONFIG_PPC_ISERIES is not set
 # CONFIG_PPC_MPC52xx is not set
@@ -223,6 +215,7 @@ CONFIG_MEMORY_HOTPLUG_SPARSE=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_RESOURCES_64BIT=y
 CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
 CONFIG_ARCH_MEMORY_PROBE=y
 # CONFIG_PPC_HAS_HASH_64K is not set
 # CONFIG_PPC_64K_PAGES is not set
@@ -241,6 +234,7 @@ CONFIG_ZONE_DMA=y
 CONFIG_GENERIC_ISA_DMA=y
 # CONFIG_PCI is not set
 # CONFIG_PCI_DOMAINS is not set
+# CONFIG_PCI_SYSCALL is not set
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 
 #
@@ -365,6 +359,7 @@ CONFIG_WIRELESS_EXT=y
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -379,26 +374,11 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_DEBUG_DRIVER is not set
 # CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
 # CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
+CONFIG_OF_DEVICE=y
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
-#
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_FD is not set
 # CONFIG_BLK_DEV_COW_COMMON is not set
 CONFIG_BLK_DEV_LOOP=y
@@ -411,11 +391,8 @@ CONFIG_BLK_DEV_RAM_SIZE=65535
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# Misc devices
-#
-# CONFIG_BLINK is not set
+CONFIG_MISC_DEVICES=y
+# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_IDE is not set
 
 #
@@ -423,6 +400,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 #
 # CONFIG_RAID_ATTRS is not set
 CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
 # CONFIG_SCSI_TGT is not set
 # CONFIG_SCSI_NETLINK is not set
 CONFIG_SCSI_PROC_FS=y
@@ -455,37 +433,22 @@ CONFIG_SCSI_WAIT_SCAN=m
 # CONFIG_SCSI_ISCSI_ATTRS is not set
 # CONFIG_SCSI_SAS_ATTRS is not set
 # CONFIG_SCSI_SAS_LIBSAS is not set
-
-#
-# SCSI low-level drivers
-#
-# CONFIG_ISCSI_TCP is not set
-# CONFIG_SCSI_DEBUG is not set
+# CONFIG_SCSI_LOWLEVEL is not set
 # CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
 # CONFIG_MD is not set
 # CONFIG_MACINTOSH_DRIVERS is not set
-
-#
-# Network device support
-#
 CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 # CONFIG_NET_ETHERNET is not set
 CONFIG_MII=m
 CONFIG_NETDEV_1000=y
-CONFIG_NETDEV_10000=y
 CONFIG_GELIC_NET=y
+# CONFIG_NETDEV_10000 is not set
 
 #
 # Wireless LAN
@@ -518,15 +481,7 @@ CONFIG_USB_NET_MCS7830=m
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -604,10 +559,6 @@ CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=16
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_WATCHDOG is not set
 # CONFIG_HW_RANDOM is not set
@@ -616,10 +567,6 @@ CONFIG_GEN_RTC=y
 # CONFIG_R3964 is not set
 # CONFIG_RAW_DRIVER is not set
 # CONFIG_HANGCHECK_TIMER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
 # CONFIG_I2C is not set
 
@@ -628,11 +575,8 @@ CONFIG_GEN_RTC=y
 #
 # CONFIG_SPI is not set
 # CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
 # CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
 # CONFIG_HWMON is not set
 
 #
@@ -657,6 +601,7 @@ CONFIG_GEN_RTC=y
 #
 # CONFIG_DISPLAY_SUPPORT is not set
 # CONFIG_VGASTATE is not set
+CONFIG_VIDEO_OUTPUT_CONTROL=m
 CONFIG_FB=y
 # CONFIG_FIRMWARE_EDID is not set
 # CONFIG_FB_DDC is not set
@@ -691,11 +636,13 @@ CONFIG_FB_PS3_DEFAULT_SIZE_M=18
 # CONFIG_VGA_CONSOLE is not set
 CONFIG_DUMMY_CONSOLE=y
 CONFIG_FRAMEBUFFER_CONSOLE=y
+CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY=y
 CONFIG_FRAMEBUFFER_CONSOLE_ROTATION=y
 # CONFIG_FONTS is not set
 CONFIG_FONT_8x8=y
 CONFIG_FONT_8x16=y
 CONFIG_LOGO=y
+CONFIG_FB_LOGO_EXTRA=y
 # CONFIG_LOGO_LINUX_MONO is not set
 # CONFIG_LOGO_LINUX_VGA16 is not set
 CONFIG_LOGO_LINUX_CLUT224=y
@@ -709,6 +656,8 @@ CONFIG_SOUND=y
 # Advanced Linux Sound Architecture
 #
 CONFIG_SND=y
+CONFIG_SND_TIMER=y
+CONFIG_SND_PCM=y
 # CONFIG_SND_SEQUENCER is not set
 # CONFIG_SND_MIXER_OSS is not set
 # CONFIG_SND_PCM_OSS is not set
@@ -734,6 +683,12 @@ CONFIG_SND_VERBOSE_PROCFS=y
 # ALSA PowerMac requires I2C
 #
 
+#
+# ALSA PowerPC devices
+#
+CONFIG_SND_PS3=y
+CONFIG_SND_PS3_DEFAULT_START_DELAY=2000
+
 #
 # USB devices
 #
@@ -747,13 +702,14 @@ CONFIG_SND_VERBOSE_PROCFS=y
 # CONFIG_SND_SOC is not set
 
 #
-# Open Sound System
+# SoC Audio support for SuperH
 #
-# CONFIG_SOUND_PRIME is not set
 
 #
-# HID Devices
+# Open Sound System
 #
+# CONFIG_SOUND_PRIME is not set
+CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
 
@@ -770,10 +726,7 @@ CONFIG_USB_HID=m
 #
 # CONFIG_USB_KBD is not set
 # CONFIG_USB_MOUSE is not set
-
-#
-# USB support
-#
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
@@ -803,6 +756,7 @@ CONFIG_USB_OHCI_HCD=y
 CONFIG_USB_OHCI_BIG_ENDIAN_MMIO=y
 CONFIG_USB_OHCI_LITTLE_ENDIAN=y
 # CONFIG_USB_SL811_HCD is not set
+# CONFIG_USB_R8A66597_HCD is not set
 
 #
 # USB Device Class drivers
@@ -879,31 +833,8 @@ CONFIG_USB_MON=y
 #
 # CONFIG_USB_GADGET is not set
 # CONFIG_MMC is not set
-
-#
-# LED devices
-#
 # CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
+# CONFIG_EDAC is not set
 # CONFIG_RTC_CLASS is not set
 
 #
@@ -919,6 +850,11 @@ CONFIG_USB_MON=y
 # DMA Devices
 #
 
+#
+# Userspace I/O
+#
+# CONFIG_UIO is not set
+
 #
 # File systems
 #
@@ -948,8 +884,8 @@ CONFIG_QUOTA=y
 CONFIG_QFMT_V2=y
 CONFIG_QUOTACTL=y
 CONFIG_DNOTIFY=y
-# CONFIG_AUTOFS_FS is not set
-CONFIG_AUTOFS4_FS=y
+CONFIG_AUTOFS_FS=m
+CONFIG_AUTOFS4_FS=m
 # CONFIG_FUSE_FS is not set
 
 #
@@ -1030,7 +966,6 @@ CONFIG_CIFS=m
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
@@ -1096,6 +1031,7 @@ CONFIG_BITREVERSE=y
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_PLIST=y
 CONFIG_HAS_IOMEM=y
@@ -1120,6 +1056,7 @@ CONFIG_MAGIC_SYSRQ=y
 CONFIG_DEBUG_KERNEL=y
 # CONFIG_DEBUG_SHIRQ is not set
 CONFIG_DETECT_SOFTLOCKUP=y
+CONFIG_SCHED_DEBUG=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_SLAB is not set
@@ -1150,10 +1087,6 @@ CONFIG_IRQSTACKS=y
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
 CONFIG_CRYPTO=y
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
@@ -1191,7 +1124,4 @@ CONFIG_CRYPTO_DES=y
 # CONFIG_CRYPTO_CRC32C is not set
 # CONFIG_CRYPTO_CAMELLIA is not set
 # CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+CONFIG_CRYPTO_HW=y
index 42c42ecad00c16bb82c6e4a325bc92230c1a909a..f39a72f30aadb81543fd3873491ccf94689b4d85 100644 (file)
@@ -37,9 +37,9 @@ obj-$(CONFIG_GENERIC_TBSYNC)  += smp-tbsync.o
 obj-$(CONFIG_CRASH_DUMP)       += crash_dump.o
 obj-$(CONFIG_6xx)              += idle_6xx.o l2cr_6xx.o cpu_setup_6xx.o
 obj-$(CONFIG_TAU)              += tau_6xx.o
-obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o suspend.o
-obj32-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_32.o
-obj64-$(CONFIG_SOFTWARE_SUSPEND) += swsusp_64.o swsusp_asm64.o
+obj-$(CONFIG_HIBERNATION)      += swsusp.o suspend.o
+obj32-$(CONFIG_HIBERNATION) += swsusp_32.o
+obj64-$(CONFIG_HIBERNATION) += swsusp_64.o swsusp_asm64.o
 obj32-$(CONFIG_MODULES)                += module_32.o
 
 ifeq ($(CONFIG_PPC_MERGE),y)
index 2b66d53dcc55fbf5f7d4d52d7ba0d3c1bbc8bc8d..952eba6701f404c2d8ec1a69b2a6595d26250f94 100644 (file)
@@ -389,8 +389,11 @@ BEGIN_FTR_SECTION
        ld      r9,PACA_SLBSHADOWPTR(r13)
        li      r12,0
        std     r12,SLBSHADOW_STACKESID(r9) /* Clear ESID */
+       eieio
        std     r7,SLBSHADOW_STACKVSID(r9)  /* Save VSID */
+       eieio
        std     r0,SLBSHADOW_STACKESID(r9)  /* Save ESID */
+       eieio
 
        slbie   r6
        slbie   r6              /* Workaround POWER5 < DD2.1 issue */
@@ -546,7 +549,6 @@ END_FW_FTR_SECTION_IFSET(FW_FEATURE_ISERIES)
        rfid
        b       .       /* prevent speculative execution */
 
-/* Note: this must change if we start using the TIF_NOTIFY_RESUME bit */
 do_work:
 #ifdef CONFIG_PREEMPT
        andi.   r0,r3,MSR_PR    /* Returning to user mode? */
index 8cdd48ea43912d7a39c5d82c34432787a67f30b2..171800002ede558df462e60a6c346c8442f74f9f 100644 (file)
@@ -809,8 +809,9 @@ system_reset_iSeries:
        mtmsrd  r24                     /* RI on */
        lhz     r24,PACAPACAINDEX(r13)  /* Get processor # */
        cmpwi   0,r24,0                 /* Are we processor 0? */
-       beq     .__start_initialization_iSeries /* Start up the first processor */
-       mfspr   r4,SPRN_CTRLF
+       bne     1f
+       b       .__start_initialization_iSeries /* Start up the first processor */
+1:     mfspr   r4,SPRN_CTRLF
        li      r5,CTRL_RUNLATCH        /* Turn off the run light */
        andc    r4,r4,r5
        mtspr   SPRN_CTRLT,r4
@@ -1611,7 +1612,7 @@ _GLOBAL(generic_secondary_smp_init)
 #endif
 
 #ifdef CONFIG_PPC_ISERIES
-_STATIC(__start_initialization_iSeries)
+_INIT_STATIC(__start_initialization_iSeries)
        /* Clear out the BSS */
        LOAD_REG_IMMEDIATE(r11,__bss_stop)
        LOAD_REG_IMMEDIATE(r8,__bss_start)
@@ -1671,8 +1672,9 @@ _GLOBAL(__start_initialization_multiplatform)
         * Are we booted from a PROM Of-type client-interface ?
         */
        cmpldi  cr0,r5,0
-       bne     .__boot_from_prom               /* yes -> prom */
-
+       beq     1f
+       b       .__boot_from_prom               /* yes -> prom */
+1:
        /* Save parameters */
        mr      r31,r3
        mr      r30,r4
@@ -1700,7 +1702,7 @@ _GLOBAL(__start_initialization_multiplatform)
        bl      .__mmu_off
        b       .__after_prom_start
 
-_STATIC(__boot_from_prom)
+_INIT_STATIC(__boot_from_prom)
        /* Save parameters */
        mr      r31,r3
        mr      r30,r4
@@ -1767,9 +1769,10 @@ _STATIC(__after_prom_start)
                                        /*      the source addr          */
 
        cmpdi   r4,0                    /* In some cases the loader may  */
-       beq     .start_here_multiplatform /* have already put us at zero */
+       bne     1f
+       b       .start_here_multiplatform /* have already put us at zero */
                                        /* so we can skip the copy.      */
-       LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
+1:     LOAD_REG_IMMEDIATE(r5,copy_to_here) /* # bytes of memory to copy */
        sub     r5,r5,r27
 
        li      r6,0x100                /* Start offset, the first 0x100 */
@@ -1956,7 +1959,7 @@ _GLOBAL(enable_64b_mode)
 /*
  * This is where the main kernel code starts.
  */
-_STATIC(start_here_multiplatform)
+_INIT_STATIC(start_here_multiplatform)
        /* get a new offset, now that the kernel has moved. */
        bl      .reloc_offset
        mr      r26,r3
@@ -2018,7 +2021,7 @@ _STATIC(start_here_multiplatform)
        b       .       /* prevent speculative execution */
        
        /* This is where all platforms converge execution */
-_STATIC(start_here_common)
+_INIT_STATIC(start_here_common)
        /* relocation is on at this point */
 
        /* The following code sets up the SP and TOC now that we are */
index 601ef79a591618d75d1e0d2c919c993e6b4dc2fc..2a5cf868037083b6695670f5d99d1d6100daa5a4 100644 (file)
@@ -7,6 +7,7 @@
 #include <linux/pci.h>
 #include <linux/mm.h>
 #include <asm/io.h>
+#include <asm/pci-bridge.h>
 
 /*
  * Here comes the ppc64 implementation of the IOMAP 
@@ -136,7 +137,12 @@ void __iomem *pci_iomap(struct pci_dev *dev, int bar, unsigned long max)
 
 void pci_iounmap(struct pci_dev *dev, void __iomem *addr)
 {
-       /* Nothing to do */
+       if (isa_vaddr_is_ioport(addr))
+               return;
+       if (pcibios_vaddr_is_ioport(addr))
+               return;
+       iounmap(addr);
 }
+
 EXPORT_SYMBOL(pci_iomap);
 EXPORT_SYMBOL(pci_iounmap);
index 2fc87862146cbd68048c0d2307a5eb6b626de086..24bea97c736c75ca59f3ceed5e48443dd6d14daf 100644 (file)
@@ -418,10 +418,10 @@ irq_hw_number_t virq_to_hw(unsigned int virq)
 }
 EXPORT_SYMBOL_GPL(virq_to_hw);
 
-struct irq_host *irq_alloc_host(unsigned int revmap_type,
-                               unsigned int revmap_arg,
-                               struct irq_host_ops *ops,
-                               irq_hw_number_t inval_irq)
+__init_refok struct irq_host *irq_alloc_host(unsigned int revmap_type,
+                                               unsigned int revmap_arg,
+                                               struct irq_host_ops *ops,
+                                               irq_hw_number_t inval_irq)
 {
        struct irq_host *host;
        unsigned int size = sizeof(struct irq_host);
index fe7d1255e11ea903dbd01f41e56c839ccb04f703..083cfbdbe0b2d7ed86edeb2ab55d5a7284fd8a91 100644 (file)
@@ -65,7 +65,7 @@ static void __devinit pci_setup_pci_controller(struct pci_controller *hose)
        spin_unlock(&hose_spinlock);
 }
 
-struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
+__init_refok struct pci_controller * pcibios_alloc_controller(struct device_node *dev)
 {
        struct pci_controller *phb;
 
@@ -101,6 +101,29 @@ void pcibios_free_controller(struct pci_controller *phb)
                kfree(phb);
 }
 
+int pcibios_vaddr_is_ioport(void __iomem *address)
+{
+       int ret = 0;
+       struct pci_controller *hose;
+       unsigned long size;
+
+       spin_lock(&hose_spinlock);
+       list_for_each_entry(hose, &hose_list, list_node) {
+#ifdef CONFIG_PPC64
+               size = hose->pci_io_size;
+#else
+               size = hose->io_resource.end - hose->io_resource.start + 1;
+#endif
+               if (address >= hose->io_base_virt &&
+                   address < (hose->io_base_virt + size)) {
+                       ret = 1;
+                       break;
+               }
+       }
+       spin_unlock(&hose_spinlock);
+       return ret;
+}
+
 /*
  * Return the domain number for this bus.
  */
index 721a69400d6557c86fe2c3cc46705130c80df95d..04a3109ae3c61e56a7ac0a815774932855484256 100644 (file)
@@ -59,6 +59,24 @@ LIST_HEAD(hose_list);
 
 static int pci_bus_count;
 
+static void
+fixup_hide_host_resource_fsl(struct pci_dev* dev)
+{
+       int i, class = dev->class >> 8;
+
+       if ((class == PCI_CLASS_PROCESSOR_POWERPC) &&
+               (dev->hdr_type == PCI_HEADER_TYPE_NORMAL) &&
+               (dev->bus->parent == NULL)) {
+               for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) {
+                       dev->resource[i].start = 0;
+                       dev->resource[i].end = 0;
+                       dev->resource[i].flags = 0;
+               }
+       }
+}
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_MOTOROLA, PCI_ANY_ID, fixup_hide_host_resource_fsl); 
+DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_FREESCALE, PCI_ANY_ID, fixup_hide_host_resource_fsl); 
+
 static void
 fixup_broken_pcnet32(struct pci_dev* dev)
 {
@@ -563,8 +581,11 @@ pcibios_assign_resources(void)
                        if ((r->flags & IORESOURCE_UNSET) && r->end &&
                            (!ppc_md.pcibios_enable_device_hook ||
                             !ppc_md.pcibios_enable_device_hook(dev, 1))) {
+                               int rc;
+
                                r->flags &= ~IORESOURCE_UNSET;
-                               pci_assign_resource(dev, idx);
+                               rc = pci_assign_resource(dev, idx);
+                               BUG_ON(rc);
                        }
                }
 
@@ -1229,7 +1250,7 @@ pcibios_init(void)
 
 subsys_initcall(pcibios_init);
 
-void __init pcibios_fixup_bus(struct pci_bus *bus)
+void pcibios_fixup_bus(struct pci_bus *bus)
 {
        struct pci_controller *hose = (struct pci_controller *) bus->sysdata;
        unsigned long io_offset;
index a97e23ac197639bd17eda467be127214f863af38..291ffbc360c9a023f30a6b40b4c77b9d272ebb31 100644 (file)
@@ -313,6 +313,7 @@ struct pci_dev *of_create_pci_dev(struct device_node *node,
 
        dev->current_state = 4;         /* unknown power state */
        dev->error_state = pci_channel_io_normal;
+       dev->dma_mask = 0xffffffff;
 
        if (!strcmp(type, "pci") || !strcmp(type, "pciex")) {
                /* a PCI-PCI bridge */
index 84f000a45e3678cf4d18fa8b194681bc6cdbaf00..a83727b308a0186e8a5dfadc06fd2be687029834 100644 (file)
@@ -423,7 +423,11 @@ void show_regs(struct pt_regs * regs)
        printk("  CR: %08lx  XER: %08lx\n", regs->ccr, regs->xer);
        trap = TRAP(regs);
        if (trap == 0x300 || trap == 0x600)
+#if defined(CONFIG_4xx) || defined(CONFIG_BOOKE)
+               printk("DEAR: "REG", ESR: "REG"\n", regs->dar, regs->dsisr);
+#else
                printk("DAR: "REG", DSISR: "REG"\n", regs->dar, regs->dsisr);
+#endif
        printk("TASK = %p[%d] '%s' THREAD: %p",
               current, current->pid, current->comm, task_thread_info(current));
 
index 3786dcc8a7b62752cc51ddd3fae9dd085a2b3726..b5c96af955c639ce43ea1532423bebebf0a6b177 100644 (file)
@@ -24,7 +24,7 @@
 /* Max address size we deal with */
 #define OF_MAX_ADDR_CELLS      4
 #define OF_CHECK_COUNTS(na, ns)        ((na) > 0 && (na) <= OF_MAX_ADDR_CELLS && \
-                       (ns) >= 0)
+                       (ns) > 0)
 
 static struct of_bus *of_match_bus(struct device_node *np);
 static int __of_address_to_resource(struct device_node *dev,
index 4924c48cb1ffc64df621b6d2dd6790c2b0683100..50ef38cffdbfc3db60df3b3a90827daac12aef47 100644 (file)
@@ -496,6 +496,10 @@ int check_legacy_ioport(unsigned long base_port)
                        break;
                }
                np = of_find_node_by_type(NULL, "8042");
+               /* Pegasos has no device_type on its 8042 node, look for the
+                * name instead */
+               if (!np)
+                       np = of_find_node_by_name(NULL, "8042");
                break;
        case FDC_BASE: /* FDC1 */
                np = of_find_node_by_type(NULL, "fdc");
index 087c92f2a3ebd75bac059df639c9bd1d75d92081..1ea43160f543ea1018d99cdd88d324536c989b09 100644 (file)
@@ -212,11 +212,6 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
                atomic_set(&data.finished, 0);
 
        spin_lock(&call_lock);
-       /* Must grab online cpu count with preempt disabled, otherwise
-        * it can change. */
-       num_cpus = num_online_cpus() - 1;
-       if (!num_cpus)
-               goto done;
 
        /* remove 'self' from the map */
        if (cpu_isset(smp_processor_id(), map))
@@ -224,7 +219,9 @@ int smp_call_function_map(void (*func) (void *info), void *info, int nonatomic,
 
        /* sanity check the map, remove any non-online processors. */
        cpus_and(map, map, cpu_online_map);
-       if (cpus_empty(map))
+
+       num_cpus = cpus_weight(map);
+       if (!num_cpus)
                goto done;
 
        call_data = &data;
index fc6647d332cbf18160e4f62865bf06a61cd75d65..f85f402ceaefea89461e4e558efed352e91b272e 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/sched.h>
 #include <linux/syscalls.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index cbca1df8bc60f996edb343bf86a6944ecfdae108..0f9b4eadfbcbebaa27a60d369730f8b972284aa5 100644 (file)
@@ -155,7 +155,7 @@ static int early_console_initialized;
  * Called by setup_system after ppc_md->probe and ppc_md->early_init.
  * Call it again after setting udbg_putc in ppc_md->setup_arch.
  */
-void register_early_udbg_console(void)
+void __init register_early_udbg_console(void)
 {
        if (early_console_initialized)
                return;
index 2f24ea0d723afdb4f4b96916f72bf33d2d91639f..ada5b42dd231635205bccdbc3cedd6c72f80f0cd 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/errno.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/slab.h>
 
 #include <asm/rheap.h>
index 4762ff7c14df22fd2c4c5bdcc6a1e234665c917a..35eabfb507231ae92e549ffa771424c31d42d9c8 100644 (file)
@@ -472,10 +472,12 @@ _GLOBAL(htab_call_hpte_insert1)
        /* Now try secondary slot */
 
        /* real page number in r5, PTE RPN value + index */
-       rldicl  r5,r31,64-PTE_RPN_SHIFT,PTE_RPN_SHIFT
+       andis.  r0,r31,_PAGE_4K_PFN@h
+       srdi    r5,r31,PTE_RPN_SHIFT
+       bne-    3f
        sldi    r5,r5,PAGE_SHIFT-HW_PAGE_SHIFT
        add     r5,r5,r25
-       sldi    r5,r5,HW_PAGE_SHIFT
+3:     sldi    r5,r5,HW_PAGE_SHIFT
 
        /* Calculate secondary group hash */
        andc    r0,r27,r28
index bc7b0cedae5e555ab711d2d5099059070766de17..f1789578747aa340c7cf3cc7cc006f3f8ef39a98 100644 (file)
@@ -759,7 +759,7 @@ int hash_page(unsigned long ea, unsigned long access, unsigned long trap)
                   mmu_psize_defs[mmu_vmalloc_psize].sllp) {
                get_paca()->vmalloc_sllp =
                        mmu_psize_defs[mmu_vmalloc_psize].sllp;
-               slb_flush_and_rebolt();
+               slb_vmalloc_update();
        }
 #endif /* CONFIG_PPC_64K_PAGES */
 
index e3a1e8dc536a5bab3ea4c48f99e530cde5971e0b..8f4d2dc4cafb0e832039799c364d8bccfc67d51b 100644 (file)
@@ -138,8 +138,8 @@ void __init lmb_analyze(void)
 static long __init lmb_add_region(struct lmb_region *rgn, unsigned long base,
                                  unsigned long size)
 {
-       unsigned long i, coalesced = 0;
-       long adjacent;
+       unsigned long coalesced = 0;
+       long adjacent, i;
 
        /* First try and coalesce this LMB with another. */
        for (i=0; i < rgn->cnt; i++) {
index de45aa82d97b11c133fb14ccab6fbdf2e2bce450..c12adc3ddffd892b3238025873afc7764eb20831 100644 (file)
@@ -307,9 +307,9 @@ static void __init parse_drconf_memory(struct device_node *memory)
        const unsigned int *lm, *dm, *aa;
        unsigned int ls, ld, la;
        unsigned int n, aam, aalen;
-       unsigned long lmb_size, size;
+       unsigned long lmb_size, size, start;
        int nid, default_nid = 0;
-       unsigned int start, ai, flags;
+       unsigned int ai, flags;
 
        lm = of_get_property(memory, "ibm,lmb-size", &ls);
        dm = of_get_property(memory, "ibm,dynamic-memory", &ld);
index 304375a735747cfc868f67cfba4fc6715809b6c2..a73d2d700973e4cd14cda75800484de3979cf639 100644 (file)
@@ -53,7 +53,8 @@ static inline unsigned long mk_vsid_data(unsigned long ea, unsigned long flags)
        return (get_kernel_vsid(ea) << SLB_VSID_SHIFT) | flags;
 }
 
-static inline void slb_shadow_update(unsigned long esid, unsigned long vsid,
+static inline void slb_shadow_update(unsigned long ea,
+                                    unsigned long flags,
                                     unsigned long entry)
 {
        /*
@@ -61,28 +62,16 @@ static inline void slb_shadow_update(unsigned long esid, unsigned long vsid,
         * updating it.
         */
        get_slb_shadow()->save_area[entry].esid = 0;
-       barrier();
-       get_slb_shadow()->save_area[entry].vsid = vsid;
-       barrier();
-       get_slb_shadow()->save_area[entry].esid = esid;
-
+       smp_wmb();
+       get_slb_shadow()->save_area[entry].vsid = mk_vsid_data(ea, flags);
+       smp_wmb();
+       get_slb_shadow()->save_area[entry].esid = mk_esid_data(ea, entry);
+       smp_wmb();
 }
 
-static inline void create_shadowed_slbe(unsigned long ea, unsigned long flags,
-                                       unsigned long entry)
+static inline void slb_shadow_clear(unsigned long entry)
 {
-       /*
-        * Updating the shadow buffer before writing the SLB ensures
-        * we don't get a stale entry here if we get preempted by PHYP
-        * between these two statements.
-        */
-       slb_shadow_update(mk_esid_data(ea, entry), mk_vsid_data(ea, flags),
-                         entry);
-
-       asm volatile("slbmte  %0,%1" :
-                    : "r" (mk_vsid_data(ea, flags)),
-                      "r" (mk_esid_data(ea, entry))
-                    : "memory" );
+       get_slb_shadow()->save_area[entry].esid = 0;
 }
 
 void slb_flush_and_rebolt(void)
@@ -100,12 +89,13 @@ void slb_flush_and_rebolt(void)
        vflags = SLB_VSID_KERNEL | vmalloc_llp;
 
        ksp_esid_data = mk_esid_data(get_paca()->kstack, 2);
-       if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET)
+       if ((ksp_esid_data & ESID_MASK) == PAGE_OFFSET) {
                ksp_esid_data &= ~SLB_ESID_V;
-
-       /* Only third entry (stack) may change here so only resave that */
-       slb_shadow_update(ksp_esid_data,
-                         mk_vsid_data(ksp_esid_data, lflags), 2);
+               slb_shadow_clear(2);
+       } else {
+               /* Update stack entry; others don't change */
+               slb_shadow_update(get_paca()->kstack, lflags, 2);
+       }
 
        /* We need to do this all in asm, so we're sure we don't touch
         * the stack between the slbia and rebolting it. */
@@ -123,6 +113,15 @@ void slb_flush_and_rebolt(void)
                     : "memory");
 }
 
+void slb_vmalloc_update(void)
+{
+       unsigned long vflags;
+
+       vflags = SLB_VSID_KERNEL | mmu_psize_defs[mmu_vmalloc_psize].sllp;
+       slb_shadow_update(VMALLOC_START, vflags, 1);
+       slb_flush_and_rebolt();
+}
+
 /* Flush all user entries from the segment table of the current processor. */
 void switch_slb(struct task_struct *tsk, struct mm_struct *mm)
 {
@@ -227,16 +226,12 @@ void slb_initialize(void)
        vflags = SLB_VSID_KERNEL | vmalloc_llp;
 
        /* Invalidate the entire SLB (even slot 0) & all the ERATS */
-       asm volatile("isync":::"memory");
-       asm volatile("slbmte  %0,%0"::"r" (0) : "memory");
-       asm volatile("isync; slbia; isync":::"memory");
-       create_shadowed_slbe(PAGE_OFFSET, lflags, 0);
-
-       create_shadowed_slbe(VMALLOC_START, vflags, 1);
-
-       /* We don't bolt the stack for the time being - we're in boot,
-        * so the stack is in the bolted segment.  By the time it goes
-        * elsewhere, we'll call _switch() which will bolt in the new
-        * one. */
-       asm volatile("isync":::"memory");
+       slb_shadow_update(PAGE_OFFSET, lflags, 0);
+       asm volatile("isync; slbia; sync; slbmte  %0,%1; isync" ::
+                    "r" (get_slb_shadow()->save_area[0].vsid),
+                    "r" (get_slb_shadow()->save_area[0].esid) : "memory");
+
+       slb_shadow_update(VMALLOC_START, vflags, 1);
+
+       slb_flush_and_rebolt();
 }
index f833dba2a0287ea06218f180620b8634300a58e7..d5fd3909d13a2cb45c01b2c56d236b67ea39b9a5 100644 (file)
@@ -405,6 +405,8 @@ unsigned long slice_get_unmapped_area(unsigned long addr, unsigned long len,
 
        if (len > mm->task_size)
                return -ENOMEM;
+       if (len & ((1ul << pshift) - 1))
+               return -EINVAL;
        if (fixed && (addr & ((1ul << pshift) - 1)))
                return -EINVAL;
        if (fixed && addr > (mm->task_size - len))
index 133665754a75cc34e34b18cfe83d611fc2611fd5..4a890cb42b98e7a7a2b23a7f2599efe1cc1a5f55 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/dcookies.h>
 #include <linux/kref.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/notifier.h>
 #include <linux/numa.h>
index b39cb52c6fb90290c2c6ca368f22f88dc331ddf4..2c8e641a739b5ac4ef3f66a0f2f48025d27332eb 100644 (file)
@@ -106,7 +106,6 @@ static struct of_device_id mpc832x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
        { .type = "qe", },
-       { .type = "mdio", },
        {},
 };
 
index b2b28a44738c901a0faf6f4efbf762dee4b03f57..090906170a41ebed91c8c38c06da1d0b51456ac5 100644 (file)
@@ -70,7 +70,6 @@ static struct of_device_id mpc832x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
        { .type = "qe", },
-       { .type = "mdio", },
        {},
 };
 
index 0e615fd65c1fd1050c91a833a920fa03945f834d..84b58934aafde7580cc15a118d333ec8efbfd3e1 100644 (file)
@@ -113,7 +113,6 @@ static struct of_device_id mpc836x_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
        { .type = "qe", },
-       { .type = "mdio", },
        {},
 };
 
index e8003bf00c9a2d87fe0784260abdfd251399eeb5..be25ecd911ba05263060d86c7751822c6d8bbf4e 100644 (file)
@@ -142,7 +142,6 @@ static struct of_device_id mpc85xx_ids[] = {
        { .type = "soc", },
        { .compatible = "soc", },
        { .type = "qe", },
-       { .type = "mdio", },
        {},
 };
 
index 90124228b8f43c37bd02f06e927402d29a5c058c..095a30304c56861b8259cf776a9870907238083d 100644 (file)
@@ -36,7 +36,6 @@
 #include <asm/spu_priv1.h>
 #include <asm/xmon.h>
 #include <asm/prom.h>
-#include "spu_priv1_mmio.h"
 
 const struct spu_management_ops *spu_management_ops;
 EXPORT_SYMBOL_GPL(spu_management_ops);
@@ -636,138 +635,6 @@ static ssize_t spu_stat_show(struct sys_device *sysdev, char *buf)
 
 static SYSDEV_ATTR(stat, 0644, spu_stat_show, NULL);
 
-/* Hardcoded affinity idxs for QS20 */
-#define SPES_PER_BE 8
-static int QS20_reg_idxs[SPES_PER_BE] =   { 0, 2, 4, 6, 7, 5, 3, 1 };
-static int QS20_reg_memory[SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 };
-
-static struct spu *spu_lookup_reg(int node, u32 reg)
-{
-       struct spu *spu;
-
-       list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
-               if (*(u32 *)get_property(spu_devnode(spu), "reg", NULL) == reg)
-                       return spu;
-       }
-       return NULL;
-}
-
-static void init_aff_QS20_harcoded(void)
-{
-       int node, i;
-       struct spu *last_spu, *spu;
-       u32 reg;
-
-       for (node = 0; node < MAX_NUMNODES; node++) {
-               last_spu = NULL;
-               for (i = 0; i < SPES_PER_BE; i++) {
-                       reg = QS20_reg_idxs[i];
-                       spu = spu_lookup_reg(node, reg);
-                       if (!spu)
-                               continue;
-                       spu->has_mem_affinity = QS20_reg_memory[reg];
-                       if (last_spu)
-                               list_add_tail(&spu->aff_list,
-                                               &last_spu->aff_list);
-                       last_spu = spu;
-               }
-       }
-}
-
-static int of_has_vicinity(void)
-{
-       struct spu* spu;
-
-       spu = list_entry(cbe_spu_info[0].spus.next, struct spu, cbe_list);
-       return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
-}
-
-static struct spu *aff_devnode_spu(int cbe, struct device_node *dn)
-{
-       struct spu *spu;
-
-       list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list)
-               if (spu_devnode(spu) == dn)
-                       return spu;
-       return NULL;
-}
-
-static struct spu *
-aff_node_next_to(int cbe, struct device_node *target, struct device_node *avoid)
-{
-       struct spu *spu;
-       const phandle *vic_handles;
-       int lenp, i;
-
-       list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) {
-               if (spu_devnode(spu) == avoid)
-                       continue;
-               vic_handles = get_property(spu_devnode(spu), "vicinity", &lenp);
-               for (i=0; i < (lenp / sizeof(phandle)); i++) {
-                       if (vic_handles[i] == target->linux_phandle)
-                               return spu;
-               }
-       }
-       return NULL;
-}
-
-static void init_aff_fw_vicinity_node(int cbe)
-{
-       struct spu *spu, *last_spu;
-       struct device_node *vic_dn, *last_spu_dn;
-       phandle avoid_ph;
-       const phandle *vic_handles;
-       const char *name;
-       int lenp, i, added, mem_aff;
-
-       last_spu = list_entry(cbe_spu_info[cbe].spus.next, struct spu, cbe_list);
-       avoid_ph = 0;
-       for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) {
-               last_spu_dn = spu_devnode(last_spu);
-               vic_handles = get_property(last_spu_dn, "vicinity", &lenp);
-
-               for (i = 0; i < (lenp / sizeof(phandle)); i++) {
-                       if (vic_handles[i] == avoid_ph)
-                               continue;
-
-                       vic_dn = of_find_node_by_phandle(vic_handles[i]);
-                       if (!vic_dn)
-                               continue;
-
-                       name = get_property(vic_dn, "name", NULL);
-                       if (strcmp(name, "spe") == 0) {
-                               spu = aff_devnode_spu(cbe, vic_dn);
-                               avoid_ph = last_spu_dn->linux_phandle;
-                       }
-                       else {
-                               mem_aff = strcmp(name, "mic-tm") == 0;
-                               spu = aff_node_next_to(cbe, vic_dn, last_spu_dn);
-                               if (!spu)
-                                       continue;
-                               if (mem_aff) {
-                                       last_spu->has_mem_affinity = 1;
-                                       spu->has_mem_affinity = 1;
-                               }
-                               avoid_ph = vic_dn->linux_phandle;
-                       }
-                       list_add_tail(&spu->aff_list, &last_spu->aff_list);
-                       last_spu = spu;
-                       break;
-               }
-       }
-}
-
-static void init_aff_fw_vicinity(void)
-{
-       int cbe;
-
-       /* sets has_mem_affinity for each spu, as long as the
-        * spu->aff_list list, linking each spu to its neighbors
-        */
-       for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
-               init_aff_fw_vicinity_node(cbe);
-}
-
 static int __init init_spu_base(void)
 {
        int i, ret = 0;
@@ -811,13 +678,7 @@ static int __init init_spu_base(void)
        mutex_unlock(&spu_full_list_mutex);
        spu_add_sysdev_attr(&attr_stat);
 
-       if (of_has_vicinity()) {
-               init_aff_fw_vicinity();
-       } else {
-               long root = of_get_flat_dt_root();
-               if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
-                       init_aff_QS20_harcoded();
-       }
+       spu_init_affinity();
 
        return 0;
 
index 75ed50fcc3dbaf70903fc74b00ab75b3e7d99ad3..5eb88346181acd58fac6742ff895315894a4759a 100644 (file)
@@ -361,8 +361,171 @@ static int of_destroy_spu(struct spu *spu)
        return 0;
 }
 
+/* Hardcoded affinity idxs for qs20 */
+#define QS20_SPES_PER_BE 8
+static int qs20_reg_idxs[QS20_SPES_PER_BE] =   { 0, 2, 4, 6, 7, 5, 3, 1 };
+static int qs20_reg_memory[QS20_SPES_PER_BE] = { 1, 1, 0, 0, 0, 0, 0, 0 };
+
+static struct spu *spu_lookup_reg(int node, u32 reg)
+{
+       struct spu *spu;
+       u32 *spu_reg;
+
+       list_for_each_entry(spu, &cbe_spu_info[node].spus, cbe_list) {
+               spu_reg = (u32*)of_get_property(spu_devnode(spu), "reg", NULL);
+               if (*spu_reg == reg)
+                       return spu;
+       }
+       return NULL;
+}
+
+static void init_affinity_qs20_harcoded(void)
+{
+       int node, i;
+       struct spu *last_spu, *spu;
+       u32 reg;
+
+       for (node = 0; node < MAX_NUMNODES; node++) {
+               last_spu = NULL;
+               for (i = 0; i < QS20_SPES_PER_BE; i++) {
+                       reg = qs20_reg_idxs[i];
+                       spu = spu_lookup_reg(node, reg);
+                       if (!spu)
+                               continue;
+                       spu->has_mem_affinity = qs20_reg_memory[reg];
+                       if (last_spu)
+                               list_add_tail(&spu->aff_list,
+                                               &last_spu->aff_list);
+                       last_spu = spu;
+               }
+       }
+}
+
+static int of_has_vicinity(void)
+{
+       struct spu* spu;
+
+       spu = list_first_entry(&cbe_spu_info[0].spus, struct spu, cbe_list);
+       return of_find_property(spu_devnode(spu), "vicinity", NULL) != NULL;
+}
+
+static struct spu *devnode_spu(int cbe, struct device_node *dn)
+{
+       struct spu *spu;
+
+       list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list)
+               if (spu_devnode(spu) == dn)
+                       return spu;
+       return NULL;
+}
+
+static struct spu *
+neighbour_spu(int cbe, struct device_node *target, struct device_node *avoid)
+{
+       struct spu *spu;
+       struct device_node *spu_dn;
+       const phandle *vic_handles;
+       int lenp, i;
+
+       list_for_each_entry(spu, &cbe_spu_info[cbe].spus, cbe_list) {
+               spu_dn = spu_devnode(spu);
+               if (spu_dn == avoid)
+                       continue;
+               vic_handles = of_get_property(spu_dn, "vicinity", &lenp);
+               for (i=0; i < (lenp / sizeof(phandle)); i++) {
+                       if (vic_handles[i] == target->linux_phandle)
+                               return spu;
+               }
+       }
+       return NULL;
+}
+
+static void init_affinity_node(int cbe)
+{
+       struct spu *spu, *last_spu;
+       struct device_node *vic_dn, *last_spu_dn;
+       phandle avoid_ph;
+       const phandle *vic_handles;
+       const char *name;
+       int lenp, i, added;
+
+       last_spu = list_first_entry(&cbe_spu_info[cbe].spus, struct spu,
+                                                               cbe_list);
+       avoid_ph = 0;
+       for (added = 1; added < cbe_spu_info[cbe].n_spus; added++) {
+               last_spu_dn = spu_devnode(last_spu);
+               vic_handles = of_get_property(last_spu_dn, "vicinity", &lenp);
+
+               /*
+                * Walk through each phandle in vicinity property of the spu
+                * (tipically two vicinity phandles per spe node)
+                */
+               for (i = 0; i < (lenp / sizeof(phandle)); i++) {
+                       if (vic_handles[i] == avoid_ph)
+                               continue;
+
+                       vic_dn = of_find_node_by_phandle(vic_handles[i]);
+                       if (!vic_dn)
+                               continue;
+
+                       /* a neighbour might be spe, mic-tm, or bif0 */
+                       name = of_get_property(vic_dn, "name", NULL);
+                       if (!name)
+                               continue;
+
+                       if (strcmp(name, "spe") == 0) {
+                               spu = devnode_spu(cbe, vic_dn);
+                               avoid_ph = last_spu_dn->linux_phandle;
+                       } else {
+                               /*
+                                * "mic-tm" and "bif0" nodes do not have
+                                * vicinity property. So we need to find the
+                                * spe which has vic_dn as neighbour, but
+                                * skipping the one we came from (last_spu_dn)
+                                */
+                               spu = neighbour_spu(cbe, vic_dn, last_spu_dn);
+                               if (!spu)
+                                       continue;
+                               if (!strcmp(name, "mic-tm")) {
+                                       last_spu->has_mem_affinity = 1;
+                                       spu->has_mem_affinity = 1;
+                               }
+                               avoid_ph = vic_dn->linux_phandle;
+                       }
+
+                       list_add_tail(&spu->aff_list, &last_spu->aff_list);
+                       last_spu = spu;
+                       break;
+               }
+       }
+}
+
+static void init_affinity_fw(void)
+{
+       int cbe;
+
+       for (cbe = 0; cbe < MAX_NUMNODES; cbe++)
+               init_affinity_node(cbe);
+}
+
+static int __init init_affinity(void)
+{
+       if (of_has_vicinity()) {
+               init_affinity_fw();
+       } else {
+               long root = of_get_flat_dt_root();
+               if (of_flat_dt_is_compatible(root, "IBM,CPBW-1.0"))
+                       init_affinity_qs20_harcoded();
+               else
+                       printk("No affinity configuration found");
+       }
+
+       return 0;
+}
+
 const struct spu_management_ops spu_management_of_ops = {
        .enumerate_spus = of_enumerate_spus,
        .create_spu = of_create_spu,
        .destroy_spu = of_destroy_spu,
+       .init_affinity = init_affinity,
 };
index 6694f86d7000899d6bb67080cc80cd93557f4d04..9cb081c26e7120f5ca84c8ecb2e7ff7ae7814df4 100644 (file)
@@ -59,7 +59,8 @@ struct spu_context *alloc_spu_context(struct spu_gang *gang)
        INIT_LIST_HEAD(&ctx->aff_list);
        if (gang)
                spu_gang_add_ctx(gang, ctx);
-       ctx->cpus_allowed = current->cpus_allowed;
+
+       __spu_update_sched_info(ctx);
        spu_set_timeslice(ctx);
        ctx->stats.util_state = SPU_UTIL_IDLE_LOADED;
 
index 0b50fa5cb39d5af406047391ad7914eafd31d9be..6abdd8fe2098f29591a31ebd65a14952899067d4 100644 (file)
@@ -312,6 +312,7 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event)
        spu_acquire(ctx);
        if (ctx->state == SPU_STATE_SAVED) {
                __spu_update_sched_info(ctx);
+               spu_set_timeslice(ctx);
 
                ret = spu_activate(ctx, 0);
                if (ret) {
@@ -322,6 +323,9 @@ long spufs_run_spu(struct spu_context *ctx, u32 *npc, u32 *event)
                /*
                 * We have to update the scheduling priority under active_mutex
                 * to protect against find_victim().
+                *
+                * No need to update the timeslice ASAP, it will get updated
+                * once the current one has expired.
                 */
                spu_update_sched_info(ctx);
        }
index 227968b4779d3adc531fac2a71ef68dd1f18c386..c784edd40ea748c74518d0d4bf9d7e4ac1ce4636 100644 (file)
@@ -351,7 +351,8 @@ static void aff_set_ref_point_location(struct spu_gang *gang)
                lowest_offset = ctx->aff_offset;
        }
 
-       gang->aff_ref_spu = aff_ref_location(ctx, mem_aff, gs, lowest_offset);
+       gang->aff_ref_spu = aff_ref_location(gang->aff_ref_ctx, mem_aff, gs,
+                                                       lowest_offset);
 }
 
 static struct spu *ctx_location(struct spu *ref, int offset, int node)
@@ -927,10 +928,6 @@ int __init spu_sched_init(void)
                INIT_LIST_HEAD(&spu_prio->runq[i]);
                __clear_bit(i, spu_prio->bitmap);
        }
-       for (i = 0; i < MAX_NUMNODES; i++) {
-               mutex_init(&cbe_spu_info[i].list_mutex);
-               INIT_LIST_HEAD(&cbe_spu_info[i].spus);
-       }
        spin_lock_init(&spu_prio->runq_lock);
 
        setup_timer(&spusched_timer, spusched_wake, 0);
index 91df52a1899addd4aeaec8b39d1d5f9809cccc19..34bdbbe3ce590a73a70d04e5d91732189f1b43cb 100644 (file)
@@ -182,7 +182,7 @@ static int set_spread_lpevents(char *str)
 }
 __setup("spread_lpevents=", set_spread_lpevents);
 
-void setup_hvlpevent_queue(void)
+void __init setup_hvlpevent_queue(void)
 {
        void *eventStack;
 
index fceaae40fe7033c70947f3c9f65680d2b0671c0a..2542403288f92dd769e0e6d2b28d4228e649e894 100644 (file)
@@ -490,6 +490,9 @@ static int __init maple_add_bridge(struct device_node *dev)
        /* Fixup "bus-range" OF property */
        fixup_bus_range(dev);
 
+       /* Check for legacy IOs */
+       isa_bridge_find_early(hose);
+
        return 0;
 }
 
index f29705f8047de2be29b70e302be880ea694408fd..ba931be2175c89addaa3c488d465de37a29fca10 100644 (file)
@@ -826,13 +826,15 @@ core99_ata100_enable(struct device_node *node, long value)
 
        if (value) {
                if (pci_device_from_OF_node(node, &pbus, &pid) == 0)
-                       pdev = pci_find_slot(pbus, pid);
+                       pdev = pci_get_bus_and_slot(pbus, pid);
                if (pdev == NULL)
                        return 0;
                rc = pci_enable_device(pdev);
+               if (rc == 0)
+                       pci_set_master(pdev);
+               pci_dev_put(pdev);
                if (rc)
                        return rc;
-               pci_set_master(pdev);
        }
        return 0;
 }
index d4fc74f7bb15a09eb6d2f4b357ac574c9def5e7b..67144d1d14056de4a88076830cc40a274ce5980d 100644 (file)
@@ -1,5 +1,5 @@
 config PPC_PS3
-       bool "Sony PS3 (incomplete)"
+       bool "Sony PS3"
        depends on PPC_MULTIPLATFORM && PPC64
        select PPC_CELL
        select USB_ARCH_HAS_OHCI
@@ -10,10 +10,10 @@ config PPC_PS3
        select MEMORY_HOTPLUG
        help
          This option enables support for the Sony PS3 game console
-         and other platforms using the PS3 hypervisor.
-         Support for this platform is not yet complete, so
-         enabling this will not result in a bootable kernel on a
-         PS3 system.
+         and other platforms using the PS3 hypervisor.  Enabling this
+         option will allow building otheros.bld, a kernel image suitable
+         for programming into flash memory, and vmlinux, a kernel image
+         suitable for loading via kexec.
 
 menu "PS3 Platform Options"
        depends on PPC_PS3
index 825ebb2cbc2adbb014d31a4172358b5751d2dec8..e23a5a874ad39ae436152ad0475df49a1f48ae8d 100644 (file)
@@ -273,55 +273,58 @@ static int ps3stor_wait_for_completion(u64 dev_id, u64 tag,
 
 static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
 {
+       int error = -ENODEV;
        int result;
        const u64 notification_dev_id = (u64)-1LL;
        const unsigned int timeout = HZ;
        u64 lpar;
        u64 tag;
+       void *buf;
+       enum ps3_notify_type {
+               notify_device_ready = 0,
+               notify_region_probe = 1,
+               notify_region_update = 2,
+       };
        struct {
                u64 operation_code;     /* must be zero */
-               u64 event_mask;         /* 1 = device ready */
+               u64 event_mask;         /* OR of 1UL << enum ps3_notify_type */
        } *notify_cmd;
        struct {
-               u64 event_type;         /* notify_device_ready */
+               u64 event_type;         /* enum ps3_notify_type */
                u64 bus_id;
                u64 dev_id;
                u64 dev_type;
                u64 dev_port;
        } *notify_event;
-       enum {
-               notify_device_ready = 1
-       };
 
        pr_debug(" -> %s:%u: bus_id %u, dev_id %u, dev_type %u\n", __func__,
                 __LINE__, repo->bus_id, repo->dev_id, repo->dev_type);
 
-       notify_cmd = kzalloc(512, GFP_KERNEL);
-       notify_event = (void *)notify_cmd;
-       if (!notify_cmd)
+       buf = kzalloc(512, GFP_KERNEL);
+       if (!buf)
                return -ENOMEM;
 
-       lpar = ps3_mm_phys_to_lpar(__pa(notify_cmd));
+       lpar = ps3_mm_phys_to_lpar(__pa(buf));
+       notify_cmd = buf;
+       notify_event = buf;
 
        result = lv1_open_device(repo->bus_id, notification_dev_id, 0);
        if (result) {
                printk(KERN_ERR "%s:%u: lv1_open_device %s\n", __func__,
                       __LINE__, ps3_result(result));
-               result = -ENODEV;
                goto fail_free;
        }
 
        /* Setup and write the request for device notification. */
 
-       notify_cmd->operation_code = 0; /* must be zero */
-       notify_cmd->event_mask = 0x01;  /* device ready */
+       notify_cmd->operation_code = 0; /* must be zero */
+       notify_cmd->event_mask = 1UL << notify_region_probe;
 
        result = lv1_storage_write(notification_dev_id, 0, 0, 1, 0, lpar,
                                   &tag);
        if (result) {
                printk(KERN_ERR "%s:%u: write failed %s\n", __func__, __LINE__,
                       ps3_result(result));
-               result = -ENODEV;
                goto fail_close;
        }
 
@@ -332,13 +335,11 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
        if (result) {
                printk(KERN_ERR "%s:%u: write not completed %s\n", __func__,
                       __LINE__, ps3_result(result));
-               result = -ENODEV;
                goto fail_close;
        }
 
        /* Loop here processing the requested notification events. */
 
-       result = -ENODEV;
        while (1) {
                memset(notify_event, 0, sizeof(*notify_event));
 
@@ -358,7 +359,7 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
                        break;
                }
 
-               if (notify_event->event_type != notify_device_ready ||
+               if (notify_event->event_type != notify_region_probe ||
                    notify_event->bus_id != repo->bus_id) {
                        pr_debug("%s:%u: bad notify_event: event %lu, "
                                 "dev_id %lu, dev_type %lu\n",
@@ -386,9 +387,9 @@ static int ps3_storage_wait_for_device(const struct ps3_repository_device *repo)
 fail_close:
        lv1_close_device(repo->bus_id, notification_dev_id);
 fail_free:
-       kfree(notify_cmd);
+       kfree(buf);
        pr_debug(" <- %s:%u\n", __func__, __LINE__);
-       return result;
+       return error;
 }
 
 static int ps3_setup_storage_dev(const struct ps3_repository_device *repo,
index aa05288de64e13b89aadecc06191ea08b474c7bc..2952b22f1c8489945d1607487fe14211c59d85c5 100644 (file)
@@ -109,7 +109,7 @@ static void ps3_panic(char *str)
 
 #if defined(CONFIG_FB_PS3) || defined(CONFIG_FB_PS3_MODULE) || \
     defined(CONFIG_PS3_FLASH) || defined(CONFIG_PS3_FLASH_MODULE)
-static void prealloc(struct ps3_prealloc *p)
+static void __init prealloc(struct ps3_prealloc *p)
 {
        if (!p->size)
                return;
index 502d80ed982bf657b6e08cc2ba511ef3baade432..ac2a4b8a4c1424270954c51b96b7e1d687140384 100644 (file)
@@ -414,10 +414,16 @@ static int __init ps3_enumerate_spus(int (*fn)(void *data))
        return num_resource_id;
 }
 
+static int ps3_init_affinity(void)
+{
+       return 0;
+}
+
 const struct spu_management_ops spu_management_ps3_ops = {
        .enumerate_spus = ps3_enumerate_spus,
        .create_spu = ps3_create_spu,
        .destroy_spu = ps3_destroy_spu,
+       .init_affinity = ps3_init_affinity,
 };
 
 /* spu_priv1_ops */
index 51c223385feb23c897013079b15007401396e89e..9fb0ce5c71766c5807467ad76a906fe9a15744d4 100644 (file)
@@ -107,7 +107,7 @@ void __init setup_pci_cmd(struct pci_controller *hose)
        }
 }
 
-static void __devinit quirk_fsl_pcie_transparent(struct pci_dev *dev)
+static void __init quirk_fsl_pcie_transparent(struct pci_dev *dev)
 {
        struct resource *res;
        int i, res_idx = PCI_BRIDGE_RESOURCES;
@@ -216,7 +216,7 @@ int __init fsl_add_bridge(struct device_node *dev, int is_primary)
 
        /* check PCI express link status */
        if (early_find_capability(hose, 0, 0, PCI_CAP_ID_EXP)) {
-               hose->indirect_type = PPC_INDIRECT_TYPE_EXT_REG |
+               hose->indirect_type |= PPC_INDIRECT_TYPE_EXT_REG |
                        PPC_INDIRECT_TYPE_SURPRESS_PRIMARY_BUS;
                if (fsl_pcie_check_link(hose))
                        hose->indirect_type |= PPC_INDIRECT_TYPE_NO_PCIE_LINK;
index 3289fab01e9245a49919a61d5ecdc285a2a49810..727453d3e8b919cac9d5d435a5980842abc46cbd 100644 (file)
@@ -305,6 +305,64 @@ err:
 
 arch_initcall(gfar_of_init);
 
+#ifdef CONFIG_I2C_BOARDINFO
+#include <linux/i2c.h>
+struct i2c_driver_device {
+       char    *of_device;
+       char    *i2c_driver;
+       char    *i2c_type;
+};
+
+static struct i2c_driver_device i2c_devices[] __initdata = {
+       {"ricoh,rs5c372a", "rtc-rs5c372", "rs5c372a",},
+       {"ricoh,rs5c372b", "rtc-rs5c372", "rs5c372b",},
+       {"ricoh,rv5c386",  "rtc-rs5c372", "rv5c386",},
+       {"ricoh,rv5c387a", "rtc-rs5c372", "rv5c387a",},
+};
+
+static int __init of_find_i2c_driver(struct device_node *node, struct i2c_board_info *info)
+{
+       int i;
+
+       for (i = 0; i < ARRAY_SIZE(i2c_devices); i++) {
+               if (!of_device_is_compatible(node, i2c_devices[i].of_device))
+                       continue;
+               strncpy(info->driver_name, i2c_devices[i].i2c_driver, KOBJ_NAME_LEN);
+               strncpy(info->type, i2c_devices[i].i2c_type, I2C_NAME_SIZE);
+               return 0;
+       }
+       return -ENODEV;
+}
+
+static void __init of_register_i2c_devices(struct device_node *adap_node, int bus_num)
+{
+       struct device_node *node = NULL;
+
+       while ((node = of_get_next_child(adap_node, node))) {
+               struct i2c_board_info info;
+               const u32 *addr;
+               int len;
+
+               addr = of_get_property(node, "reg", &len);
+               if (!addr || len < sizeof(int) || *addr > (1 << 10) - 1) {
+                       printk(KERN_WARNING "fsl_ioc.c: invalid i2c device entry\n");
+                       continue;
+               }
+
+               info.irq = irq_of_parse_and_map(node, 0);
+               if (info.irq == NO_IRQ)
+                       info.irq = -1;
+
+               if (of_find_i2c_driver(node, &info) < 0)
+                       continue;
+
+               info.platform_data = NULL;
+               info.addr = *addr;
+
+               i2c_register_board_info(bus_num, &info, 1);
+       }
+}
+
 static int __init fsl_i2c_of_init(void)
 {
        struct device_node *np;
@@ -349,6 +407,8 @@ static int __init fsl_i2c_of_init(void)
                                                    fsl_i2c_platform_data));
                if (ret)
                        goto unreg;
+
+               of_register_i2c_devices(np, i);
        }
 
        return 0;
@@ -360,6 +420,7 @@ err:
 }
 
 arch_initcall(fsl_i2c_of_init);
+#endif
 
 #ifdef CONFIG_PPC_83xx
 static int __init mpc83xx_wdt_init(void)
index a8ac2dfdd3d477975db3e121148cd668cc2b1f0f..5294560c7b00b5d65876995e8a96c10d047e3b08 100644 (file)
@@ -160,4 +160,5 @@ setup_indirect_pci(struct pci_controller* hose, u32 cfg_addr, u32 cfg_data, u32
                mbase = ioremap(cfg_data & PAGE_MASK, PAGE_SIZE);
        hose->cfg_data = mbase + (cfg_data & ~PAGE_MASK);
        hose->ops = &indirect_pci_ops;
+       hose->indirect_type = flags;
 }
index b618fa60aef342f42dad4e845f1d9a73718cfee3..548a32082e4a2f65dd5173b47ad2ded12e1f1573 100644 (file)
@@ -390,6 +390,61 @@ error:
        return err;
 }
 
+/*
+ * Create mv64x60_wdt platform devices
+ */
+static int __init mv64x60_wdt_device_setup(struct device_node *np, int id)
+{
+       struct resource r;
+       struct platform_device *pdev;
+       struct mv64x60_wdt_pdata pdata;
+       const unsigned int *prop;
+       int err;
+
+       err = of_address_to_resource(np, 0, &r);
+       if (err)
+               return err;
+
+       memset(&pdata, 0, sizeof(pdata));
+
+       prop = of_get_property(np, "timeout", NULL);
+       if (!prop)
+               return -ENODEV;
+       pdata.timeout = *prop;
+
+       np = of_get_parent(np);
+       if (!np)
+               return -ENODEV;
+
+       prop = of_get_property(np, "clock-frequency", NULL);
+       of_node_put(np);
+       if (!prop)
+               return -ENODEV;
+       pdata.bus_clk = *prop / 1000000; /* wdt driver wants freq in MHz */
+
+       pdev = platform_device_alloc(MV64x60_WDT_NAME, id);
+       if (!pdev)
+               return -ENOMEM;
+
+       err = platform_device_add_resources(pdev, &r, 1);
+       if (err)
+               goto error;
+
+       err = platform_device_add_data(pdev, &pdata, sizeof(pdata));
+       if (err)
+               goto error;
+
+       err = platform_device_add(pdev);
+       if (err)
+               goto error;
+
+       return 0;
+
+error:
+       platform_device_put(pdev);
+       return err;
+}
+
 static int __init mv64x60_device_setup(void)
 {
        struct device_node *np = NULL;
@@ -414,6 +469,15 @@ static int __init mv64x60_device_setup(void)
                if ((err = mv64x60_i2c_device_setup(np, id)))
                        goto error;
 
+       /* support up to one watchdog timer */
+       np = of_find_compatible_node(np, NULL, "marvell,mv64x60-wdt");
+       if (np) {
+               if ((err = mv64x60_wdt_device_setup(np, id)))
+                       goto error;
+               of_node_put(np);
+       }
+
+
        return 0;
 
 error:
index 99bf3b7a27629a4eb278d32a9ebfc218a0e9c5a9..f33f0e772dcb0f263c3eea9b37fc8830c68af50e 100644 (file)
@@ -136,7 +136,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index 0ff56695d349f3d495f46a8a6f2b82322d8ec7d7..e00cd62daa3f2c033b99472aa9dcf5fa65d635d7 100644 (file)
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index 730b3db2e47a5d0dd727cb417e8d830a4ebe191b..43a0d9df1e23a7b89452f63cacb269546df7c31a 100644 (file)
@@ -138,7 +138,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index 1d902072825e99a9beaf8381eb368d9e6c90ef18..a814d17a2be98346461e9c0ae54f6d04758463db 100644 (file)
@@ -137,7 +137,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index d471e578dcb58b0664acdf2765531da42c8b8a4b..f297c4bb632b40e417bc11264b7c9dcbcad15554 100644 (file)
@@ -142,7 +142,7 @@ CONFIG_BINFMT_MISC=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyMM0,115200 root=/dev/mtdblock1 rw rootfstype=jffs2"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index 4a33aca948cc7020d662522f188187c6eb496670..69bad91a6b656d5504f112147fa7d43d4054b46c 100644 (file)
@@ -148,7 +148,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index fafd2516fa5132ad243868d9fac92cdc0b783bf6..a78896ea456066ecbfea77d066a99cbf99f4e311 100644 (file)
@@ -149,7 +149,7 @@ CONFIG_BINFMT_ELF=y
 CONFIG_CMDLINE_BOOL=y
 CONFIG_CMDLINE="console=ttyS0,9600"
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index b96a6d6dad0e109c58ae5a2e5c987a52c35da39b..d90c8a7e060ccb49cd65a3df9034c72c25ca5d5a 100644 (file)
@@ -130,7 +130,7 @@ CONFIG_BINFMT_ELF=y
 # CONFIG_BINFMT_MISC is not set
 # CONFIG_CMDLINE_BOOL is not set
 # CONFIG_PM is not set
-# CONFIG_SOFTWARE_SUSPEND is not set
+# CONFIG_HIBERNATION is not set
 CONFIG_SECCOMP=y
 CONFIG_ISA_DMA_API=y
 
index 0aa333178b2affade3c6852ecbf76636beb03e8f..b7cee2d714053622a64ae50ee8931136f47b804a 100644 (file)
@@ -166,7 +166,7 @@ CONFIG_PROC_PREPRESIDUAL=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 # CONFIG_SECCOMP is not set
 CONFIG_ISA_DMA_API=y
index d212b1c418a99cef263e33d6125d5b150a33c0fd..2744b8a6f66aee66daa87d9f97332f54afd2e6f2 100644 (file)
@@ -441,6 +441,32 @@ static struct platform_device i2c_device = {
 };
 #endif
 
+#ifdef CONFIG_WATCHDOG
+static struct mv64x60_wdt_pdata mv64x60_wdt_pdata = {
+       .timeout                = 10,  /* default watchdog expiry in seconds */
+       .bus_clk                = 133, /* default bus clock in MHz */
+};
+
+static struct resource mv64x60_wdt_resources[] = {
+       [0] = {
+               .name   = "mv64x60 wdt base",
+               .start  = MV64x60_WDT_WDC,
+               .end    = MV64x60_WDT_WDC + 8 - 1, /* two 32-bit registers */
+               .flags  = IORESOURCE_MEM,
+       },
+};
+
+static struct platform_device wdt_device = {
+       .name           = MV64x60_WDT_NAME,
+       .id             = 0,
+       .num_resources  = ARRAY_SIZE(mv64x60_wdt_resources),
+       .resource       = mv64x60_wdt_resources,
+       .dev = {
+               .platform_data = &mv64x60_wdt_pdata,
+       },
+};
+#endif
+
 #if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
 static struct mv64xxx_pdata mv64xxx_pdata = {
        .hs_reg_valid   = 0,
@@ -476,6 +502,9 @@ static struct platform_device *mv64x60_pd_devs[] __initdata = {
 #ifdef CONFIG_I2C_MV64XXX
        &i2c_device,
 #endif
+#ifdef CONFIG_MV64X60_WDT
+       &wdt_device,
+#endif
 #if defined(CONFIG_SYSFS) && !defined(CONFIG_GT64260)
        &mv64xxx_device,
 #endif
index 098c62c29f9c3cda9b4292da5790ae1265be259d..b71132166f606343f810e47387c7a26b4918fced 100644 (file)
@@ -109,10 +109,6 @@ config HOTPLUG_CPU
          can be controlled through /sys/devices/system/cpu/cpu#.
          Say N if you want to disable CPU hotplug.
 
-config DEFAULT_MIGRATION_COST
-       int
-       default "1000000"
-
 config MATHEMU
        bool "IEEE FPU emulation"
        depends on MARCH_G5
index 6ffbab77ae4dd5e6f1310e74a33673ce7968ac3c..62391fb1f61f0ed158c304bd0c939e77595d5191 100644 (file)
@@ -173,7 +173,7 @@ int appldata_diag(char record_nr, u16 function, unsigned long buffer,
 /*
  * appldata_mod_vtimer_wrap()
  *
- * wrapper function for mod_virt_timer(), because smp_call_function_on()
+ * wrapper function for mod_virt_timer(), because smp_call_function_single()
  * accepts only one parameter.
  */
 static void __appldata_mod_vtimer_wrap(void *p) {
@@ -208,9 +208,9 @@ __appldata_vtimer_setup(int cmd)
                                          num_online_cpus()) * TOD_MICRO;
                for_each_online_cpu(i) {
                        per_cpu(appldata_timer, i).expires = per_cpu_interval;
-                       smp_call_function_on(add_virt_timer_periodic,
-                                            &per_cpu(appldata_timer, i),
-                                            0, 1, i);
+                       smp_call_function_single(i, add_virt_timer_periodic,
+                                                &per_cpu(appldata_timer, i),
+                                                0, 1);
                }
                appldata_timer_active = 1;
                P_INFO("Monitoring timer started.\n");
@@ -236,8 +236,8 @@ __appldata_vtimer_setup(int cmd)
                        } args;
                        args.timer = &per_cpu(appldata_timer, i);
                        args.expires = per_cpu_interval;
-                       smp_call_function_on(__appldata_mod_vtimer_wrap,
-                                            &args, 0, 1, i);
+                       smp_call_function_single(i, __appldata_mod_vtimer_wrap,
+                                                &args, 0, 1);
                }
        }
 }
index 8e1ea1c4012846a8a8d2f31f45f289ceabf39e6f..ad4ca75c0f044dd66b7fdbbfc502f5cd4d0a7adb 100644 (file)
@@ -17,6 +17,8 @@
 #include <linux/parser.h>
 #include <linux/sysfs.h>
 #include <linux/module.h>
+#include <linux/seq_file.h>
+#include <linux/mount.h>
 #include <asm/ebcdic.h>
 #include "hypfs.h"
 
@@ -256,6 +258,15 @@ static int hypfs_parse_options(char *options, struct super_block *sb)
        return 0;
 }
 
+static int hypfs_show_options(struct seq_file *s, struct vfsmount *mnt)
+{
+       struct hypfs_sb_info *hypfs_info = mnt->mnt_sb->s_fs_info;
+
+       seq_printf(s, ",uid=%u", hypfs_info->uid);
+       seq_printf(s, ",gid=%u", hypfs_info->gid);
+       return 0;
+}
+
 static int hypfs_fill_super(struct super_block *sb, void *data, int silent)
 {
        struct inode *root_inode;
@@ -459,6 +470,7 @@ static struct file_system_type hypfs_type = {
 static struct super_operations hypfs_s_ops = {
        .statfs         = simple_statfs,
        .drop_inode     = hypfs_drop_inode,
+       .show_options   = hypfs_show_options,
 };
 
 static decl_subsys(s390, NULL, NULL);
index acc415457b45ac0f05ec565a00c637569231564f..6ee1bedbd1bf85f020edfcf9b2c37457208ba1b7 100644 (file)
@@ -1710,3 +1710,13 @@ compat_sys_timerfd_wrapper:
 sys_eventfd_wrapper:
        llgfr   %r2,%r2                 # unsigned int
        jg      sys_eventfd
+
+       .globl  sys_fallocate_wrapper
+sys_fallocate_wrapper:
+       lgfr    %r2,%r2                 # int
+       lgfr    %r3,%r3                 # int
+       sllg    %r4,%r4,32              # get high word of 64bit loff_t
+       lr      %r4,%r5                 # get low word of 64bit loff_t
+       sllg    %r5,%r6,32              # get high word of 64bit loff_t
+       l       %r5,164(%r15)           # get low word of 64bit loff_t
+       jg      sys_fallocate
index bc7ff3658c3d4a4bb5bcf2db392abeecc7191d74..f3bceb165321e2bb3d57430a1b5fd8c90e7fbd9e 100644 (file)
@@ -624,9 +624,11 @@ io_work_loop:
 # _TIF_MCCK_PENDING is set, call handler
 #
 io_mcck_pending:
+       TRACE_IRQS_OFF
        l       %r1,BASED(.Ls390_handle_mcck)
-       la      %r14,BASED(io_work_loop)
-       br      %r1                     # TIF bit will be cleared by handler
+       basr    %r14,%r1                # TIF bit will be cleared by handler
+       TRACE_IRQS_ON
+       b       BASED(io_work_loop)
 
 #
 # _TIF_NEED_RESCHED is set, call schedule
index 2a7b1304418ba6ab8da72e923b8c99abb004d84f..9c0d5cc8269dd321a17da58a8046f2a20a2621ce 100644 (file)
@@ -611,8 +611,10 @@ io_work_loop:
 # _TIF_MCCK_PENDING is set, call handler
 #
 io_mcck_pending:
-       larl    %r14,io_work_loop
-       jg      s390_handle_mcck        # TIF bit will be cleared by handler
+       TRACE_IRQS_OFF
+       brasl   %r14,s390_handle_mcck   # TIF bit will be cleared by handler
+       TRACE_IRQS_ON
+       j       io_work_loop
 
 #
 # _TIF_NEED_RESCHED is set, call schedule
index 8f8c802f1bcfd86a07660a1b2e7dbd1d3cf80a06..83477c7dc743e39bcf79941f0f04a083ad265348 100644 (file)
@@ -35,6 +35,7 @@
 #define ARCH_OFFSET    0
 #endif
 
+.section ".text.head","ax"
 #ifndef CONFIG_IPL
        .org   0
        .long  0x00080000,0x80000000+startup    # Just a restart PSW
index d73a74013e73e0897c984fab7aabc44437fa3d6b..d494161b05b40125668709c893d3407432dbb971 100644 (file)
@@ -7,6 +7,7 @@
  */
 
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
index 441975b796fb03d901cef8a63dc3414a3a2b508c..abb447a3e472443b6925b1a60f08909a28d067f0 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/stddef.h>
 #include <linux/unistd.h>
index 182c085ae4ddd94e11d462d9b918152669bb6f1d..35edbef1d2228b021b8e677f22a9bcf7a66d0eeb 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/spinlock.h>
 #include <linux/kernel_stat.h>
 #include <linux/delay.h>
@@ -120,7 +121,7 @@ static void __smp_call_function_map(void (*func) (void *info), void *info,
        if (wait)
                data.finished = CPU_MASK_NONE;
 
-       spin_lock_bh(&call_lock);
+       spin_lock(&call_lock);
        call_data = &data;
 
        for_each_cpu_mask(cpu, map)
@@ -129,18 +130,16 @@ static void __smp_call_function_map(void (*func) (void *info), void *info,
        /* Wait for response */
        while (!cpus_equal(map, data.started))
                cpu_relax();
-
        if (wait)
                while (!cpus_equal(map, data.finished))
                        cpu_relax();
-
-       spin_unlock_bh(&call_lock);
-
+       spin_unlock(&call_lock);
 out:
-       local_irq_disable();
-       if (local)
+       if (local) {
+               local_irq_disable();
                func(info);
-       local_irq_enable();
+               local_irq_enable();
+       }
 }
 
 /*
@@ -170,30 +169,28 @@ int smp_call_function(void (*func) (void *info), void *info, int nonatomic,
 EXPORT_SYMBOL(smp_call_function);
 
 /*
- * smp_call_function_on:
+ * smp_call_function_single:
+ * @cpu: the CPU where func should run
  * @func: the function to run; this must be fast and non-blocking
  * @info: an arbitrary pointer to pass to the function
  * @nonatomic: unused
  * @wait: if true, wait (atomically) until function has completed on other CPUs
- * @cpu: the CPU where func should run
  *
  * Run a function on one processor.
  *
  * You must not call this function with disabled interrupts, from a
  * hardware interrupt handler or from a bottom half.
  */
-int smp_call_function_on(void (*func) (void *info), void *info, int nonatomic,
-                        int wait, int cpu)
+int smp_call_function_single(int cpu, void (*func) (void *info), void *info,
+                            int nonatomic, int wait)
 {
-       cpumask_t map = CPU_MASK_NONE;
-
        preempt_disable();
-       cpu_set(cpu, map);
-       __smp_call_function_map(func, info, nonatomic, wait, map);
+       __smp_call_function_map(func, info, nonatomic, wait,
+                               cpumask_of_cpu(cpu));
        preempt_enable();
        return 0;
 }
-EXPORT_SYMBOL(smp_call_function_on);
+EXPORT_SYMBOL(smp_call_function_single);
 
 static void do_send_stop(void)
 {
index 1c90c7e999782949ddf6efeda76f4c71fbead09e..1eaff84a1eb652191611d5c7a47a713995342973 100644 (file)
@@ -16,6 +16,7 @@
 #include <linux/errno.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
@@ -265,3 +266,23 @@ s390_fadvise64_64(struct fadvise64_64_args __user *args)
                return -EFAULT;
        return sys_fadvise64_64(a.fd, a.offset, a.len, a.advice);
 }
+
+#ifndef CONFIG_64BIT
+/*
+ * This is a wrapper to call sys_fallocate(). For 31 bit s390 the last
+ * 64 bit argument "len" is split into the upper and lower 32 bits. The
+ * system call wrapper in the user space loads the value to %r6/%r7.
+ * The code in entry.S keeps the values in %r2 - %r6 where they are and
+ * stores %r7 to 96(%r15). But the standard C linkage requires that
+ * the whole 64 bit value for len is stored on the stack and doesn't
+ * use %r6 at all. So s390_fallocate has to convert the arguments from
+ *   %r2: fd, %r3: mode, %r4/%r5: offset, %r6/96(%r15)-99(%r15): len
+ * to
+ *   %r2: fd, %r3: mode, %r4/%r5: offset, 96(%r15)-103(%r15): len
+ */
+asmlinkage long s390_fallocate(int fd, int mode, loff_t offset,
+                              u32 len_high, u32 len_low)
+{
+       return sys_fallocate(fd, mode, offset, ((u64)len_high << 32) | len_low);
+}
+#endif
index 738feb4a0aadf4e575aa9cacee96b32c069ad7b2..9e26ed9fe4e73ee5301519ada6c2a602efdef2b6 100644 (file)
@@ -322,7 +322,7 @@ NI_SYSCALL                                                  /* 310 sys_move_pages */
 SYSCALL(sys_getcpu,sys_getcpu,sys_getcpu_wrapper)
 SYSCALL(sys_epoll_pwait,sys_epoll_pwait,compat_sys_epoll_pwait_wrapper)
 SYSCALL(sys_utimes,sys_utimes,compat_sys_utimes_wrapper)
-NI_SYSCALL                                                     /* 314 sys_fallocate */
+SYSCALL(s390_fallocate,sys_fallocate,sys_fallocate_wrapper)
 SYSCALL(sys_utimensat,sys_utimensat,compat_sys_utimensat_wrapper)      /* 315 */
 SYSCALL(sys_signalfd,sys_signalfd,compat_sys_signalfd_wrapper)
 SYSCALL(sys_timerfd,sys_timerfd,compat_sys_timerfd_wrapper)
index 6ab7d4ee13a47365f7454c85f019af64056fb4e9..b4622a3889b0575f86dea86ccf6ffa96bd25ec2d 100644 (file)
@@ -21,6 +21,7 @@ SECTIONS
   . = 0x00000000;
   _text = .;                   /* Text and read-only data */
   .text : {
+       *(.text.head)
        TEXT_TEXT
        SCHED_TEXT
        LOCK_TEXT
index b6ed143e8597156d181437cab5519afe2062012d..84ff78de6bacdeec58a16261e58fdaea24a0932e 100644 (file)
@@ -415,7 +415,7 @@ EXPORT_SYMBOL(add_virt_timer_periodic);
 
 /*
  * If we change a pending timer the function must be called on the CPU
- * where the timer is running on, e.g. by smp_call_function_on()
+ * where the timer is running on, e.g. by smp_call_function_single()
  *
  * The original mod_timer adds the timer if it is not pending. For compatibility
  * we do the same. The timer will be added on the current CPU as a oneshot timer.
index 92a565190028618e603a067802faa4c7a4caabe3..fd594d5fe142bed0d1f1f17256ee4f98d617ce14 100644 (file)
@@ -29,8 +29,8 @@ struct memory_segment {
 
 static LIST_HEAD(mem_segs);
 
-void memmap_init(unsigned long size, int nid, unsigned long zone,
-                unsigned long start_pfn)
+void __meminit memmap_init(unsigned long size, int nid, unsigned long zone,
+                          unsigned long start_pfn)
 {
        struct page *start, *end;
        struct page *map_start, *map_end;
@@ -66,7 +66,7 @@ void memmap_init(unsigned long size, int nid, unsigned long zone,
        }
 }
 
-static inline void *vmem_alloc_pages(unsigned int order)
+static void __init_refok *vmem_alloc_pages(unsigned int order)
 {
        if (slab_is_available())
                return (void *)__get_free_pages(GFP_KERNEL, order);
index f87f429e0b24015565f1090616e074cf8dbc402f..54878f07cf0c0f05615af30a3e99e7fc21e0e1be 100644 (file)
@@ -90,6 +90,9 @@ config ARCH_HAS_ILOG2_U64
        bool
        default n
 
+config ARCH_NO_VIRT_TO_BUS
+       def_bool y
+
 source "init/Kconfig"
 
 menu "System type"
@@ -134,8 +137,8 @@ config SH_FPU_EMU
 
 config SH_DSP
        bool "DSP support"
-       default y if SH4AL_DSP || !CPU_SH4
-       default n
+       depends on CPU_HAS_DSP
+       default y
        help
          Selecting this option will enable support for SH processors that
          have DSP units (ie, SH2-DSP, SH3-DSP, and SH4AL-DSP).
@@ -172,9 +175,6 @@ config SPECULATIVE_EXECUTION
 config CPU_HAS_INTEVT
        bool
 
-config CPU_HAS_PINT_IRQ
-       bool
-
 config CPU_HAS_MASKREG_IRQ
        bool
 
@@ -202,6 +202,9 @@ config CPU_HAS_SR_RB
 config CPU_HAS_PTEA
        bool
 
+config CPU_HAS_DSP
+       bool
+
 endmenu
 
 menu "Board support"
@@ -261,14 +264,6 @@ config SH_7780_SOLUTION_ENGINE
          Select 7780 SolutionEngine if configuring for a Renesas SH7780
          evaluation board.
 
-config SH_7300_SOLUTION_ENGINE
-       bool "SolutionEngine7300"
-       select SOLUTION_ENGINE
-       depends on CPU_SUBTYPE_SH7300
-       help
-         Select 7300 SolutionEngine if configuring for a Hitachi
-         SH7300(SH-Mobile V) evaluation board.
-
 config SH_7343_SOLUTION_ENGINE
        bool "SolutionEngine7343"
        select SOLUTION_ENGINE
@@ -277,14 +272,6 @@ config SH_7343_SOLUTION_ENGINE
          Select 7343 SolutionEngine if configuring for a Hitachi
          SH7343 (SH-Mobile 3AS) evaluation board.
 
-config SH_73180_SOLUTION_ENGINE
-       bool "SolutionEngine73180"
-       select SOLUTION_ENGINE
-       depends on CPU_SUBTYPE_SH73180
-       help
-         Select 73180 SolutionEngine if configuring for a Hitachi
-         SH73180(SH-Mobile 3) evaluation board.
-
 config SH_7751_SYSTEMH
        bool "SystemH7751R"
        depends on CPU_SUBTYPE_SH7751R
@@ -448,10 +435,10 @@ config SH_TIMER_IRQ
 
 config SH_PCLK_FREQ
        int "Peripheral clock frequency (in Hz)"
-       default "27000000" if CPU_SUBTYPE_SH73180 || CPU_SUBTYPE_SH7343
+       default "27000000" if CPU_SUBTYPE_SH7343
        default "31250000" if CPU_SUBTYPE_SH7619
        default "32000000" if CPU_SUBTYPE_SH7722
-       default "33333333" if CPU_SUBTYPE_SH7300 || CPU_SUBTYPE_SH7770 || \
+       default "33333333" if CPU_SUBTYPE_SH7770 || \
                              CPU_SUBTYPE_SH7760 || CPU_SUBTYPE_SH7705 || \
                              CPU_SUBTYPE_SH7206
        default "60000000" if CPU_SUBTYPE_SH7751 || CPU_SUBTYPE_SH7751R
index 0016609d1ebaac288b7541e91c46aacdb213c948..3d211aa33cd8066efe02b9ffb4dd2ac9b48e5569 100644 (file)
@@ -91,9 +91,7 @@ machdir-$(CONFIG_SH_SOLUTION_ENGINE)          += se/770x
 machdir-$(CONFIG_SH_7722_SOLUTION_ENGINE)      += se/7722
 machdir-$(CONFIG_SH_7751_SOLUTION_ENGINE)      += se/7751
 machdir-$(CONFIG_SH_7780_SOLUTION_ENGINE)      += se/7780
-machdir-$(CONFIG_SH_7300_SOLUTION_ENGINE)      += se/7300
 machdir-$(CONFIG_SH_7343_SOLUTION_ENGINE)      += se/7343
-machdir-$(CONFIG_SH_73180_SOLUTION_ENGINE)     += se/73180
 machdir-$(CONFIG_SH_HP6XX)                     += hp6xx
 machdir-$(CONFIG_SH_DREAMCAST)                 += dreamcast
 machdir-$(CONFIG_SH_MPC1211)                   += mpc1211
index e165d85c03b5543050d721bd98ef2b5c7b4f9166..6f7029d33241db4beeb46395968c24b81e0403e0 100644 (file)
@@ -140,12 +140,19 @@ static struct platform_device sm501_device = {
 static struct platform_device *rts7751r2d_devices[] __initdata = {
        &uart_device,
        &heartbeat_device,
-       &cf_ide_device,
        &sm501_device,
 };
 
 static int __init rts7751r2d_devices_setup(void)
 {
+       int ret;
+
+       if (ctrl_inw(PA_BVERREG) == 0x10) { /* only working on R2D-PLUS */
+               ret = platform_device_register(&cf_ide_device);
+               if (ret)
+                       return ret;
+       }
+
        return platform_add_devices(rts7751r2d_devices,
                                    ARRAY_SIZE(rts7751r2d_devices));
 }
diff --git a/arch/sh/boards/se/7300/Makefile b/arch/sh/boards/se/7300/Makefile
deleted file mode 100644 (file)
index 4624736..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the 7300 SolutionEngine specific parts of the kernel
-#
-
-obj-y   := setup.o io.o irq.o
diff --git a/arch/sh/boards/se/7300/io.c b/arch/sh/boards/se/7300/io.c
deleted file mode 100644 (file)
index 8a03d7a..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * arch/sh/boards/se/7300/io.c
- *
- * Copyright (C) 2003 YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
- * Based on arch/sh/kernel/io_shmse.c
- *
- * I/O routine for SH-Mobile3 73180 SolutionEngine.
- *
- */
-
-#include <linux/kernel.h>
-#include <asm/io.h>
-#include <asm/se7300.h>
-
-#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
-
-struct iop {
-       unsigned long start, end;
-       unsigned long base;
-       struct iop *(*check) (struct iop * p, unsigned long port);
-       unsigned char (*inb) (struct iop * p, unsigned long port);
-       unsigned short (*inw) (struct iop * p, unsigned long port);
-       void (*outb) (struct iop * p, unsigned char value, unsigned long port);
-       void (*outw) (struct iop * p, unsigned short value, unsigned long port);
-};
-
-struct iop *
-simple_check(struct iop *p, unsigned long port)
-{
-       if ((p->start <= port) && (port <= p->end))
-               return p;
-       else
-               badio(check, port);
-}
-
-struct iop *
-ide_check(struct iop *p, unsigned long port)
-{
-       if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7))
-               return p;
-       return NULL;
-}
-
-unsigned char
-simple_inb(struct iop *p, unsigned long port)
-{
-       return *(unsigned char *) (p->base + port);
-}
-
-unsigned short
-simple_inw(struct iop *p, unsigned long port)
-{
-       return *(unsigned short *) (p->base + port);
-}
-
-void
-simple_outb(struct iop *p, unsigned char value, unsigned long port)
-{
-       *(unsigned char *) (p->base + port) = value;
-}
-
-void
-simple_outw(struct iop *p, unsigned short value, unsigned long port)
-{
-       *(unsigned short *) (p->base + port) = value;
-}
-
-unsigned char
-pcc_inb(struct iop *p, unsigned long port)
-{
-       unsigned long addr = p->base + port + 0x40000;
-       unsigned long v;
-
-       if (port & 1)
-               addr += 0x00400000;
-       v = *(volatile unsigned char *) addr;
-       return v;
-}
-
-void
-pcc_outb(struct iop *p, unsigned char value, unsigned long port)
-{
-       unsigned long addr = p->base + port + 0x40000;
-
-       if (port & 1)
-               addr += 0x00400000;
-       *(volatile unsigned char *) addr = value;
-}
-
-unsigned char
-bad_inb(struct iop *p, unsigned long port)
-{
-       badio(inb, port);
-}
-
-void
-bad_outb(struct iop *p, unsigned char value, unsigned long port)
-{
-       badio(inw, port);
-}
-
-#ifdef CONFIG_SMC91X
-/* MSTLANEX01 LAN at 0xb400:0000 */
-static struct iop laniop = {
-       .start = 0x300,
-       .end = 0x30f,
-       .base = 0xb4000000,
-       .check = simple_check,
-       .inb = simple_inb,
-       .inw = simple_inw,
-       .outb = simple_outb,
-       .outw = simple_outw,
-};
-#endif
-
-/* NE2000 pc card NIC */
-static struct iop neiop = {
-       .start = 0x280,
-       .end = 0x29f,
-       .base = 0xb0600000 + 0x80,      /* soft 0x280 -> hard 0x300 */
-       .check = simple_check,
-       .inb = pcc_inb,
-       .inw = simple_inw,
-       .outb = pcc_outb,
-       .outw = simple_outw,
-};
-
-#ifdef CONFIG_IDE
-/* CF in CF slot */
-static struct iop cfiop = {
-       .base = 0xb0600000,
-       .check = ide_check,
-       .inb = pcc_inb,
-       .inw = simple_inw,
-       .outb = pcc_outb,
-       .outw = simple_outw,
-};
-#endif
-
-static __inline__ struct iop *
-port2iop(unsigned long port)
-{
-       if (0) ;
-#if defined(CONFIG_SMC91X)
-       else if (laniop.check(&laniop, port))
-               return &laniop;
-#endif
-#if defined(CONFIG_NE2000)
-       else if (neiop.check(&neiop, port))
-               return &neiop;
-#endif
-#if defined(CONFIG_IDE)
-       else if (cfiop.check(&cfiop, port))
-               return &cfiop;
-#endif
-       else
-               return &neiop;  /* fallback */
-}
-
-static inline void
-delay(void)
-{
-       ctrl_inw(0xac000000);
-       ctrl_inw(0xac000000);
-}
-
-unsigned char
-sh7300se_inb(unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       return (p->inb) (p, port);
-}
-
-unsigned char
-sh7300se_inb_p(unsigned long port)
-{
-       unsigned char v = sh7300se_inb(port);
-       delay();
-       return v;
-}
-
-unsigned short
-sh7300se_inw(unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       return (p->inw) (p, port);
-}
-
-unsigned int
-sh7300se_inl(unsigned long port)
-{
-       badio(inl, port);
-}
-
-void
-sh7300se_outb(unsigned char value, unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       (p->outb) (p, value, port);
-}
-
-void
-sh7300se_outb_p(unsigned char value, unsigned long port)
-{
-       sh7300se_outb(value, port);
-       delay();
-}
-
-void
-sh7300se_outw(unsigned short value, unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       (p->outw) (p, value, port);
-}
-
-void
-sh7300se_outl(unsigned int value, unsigned long port)
-{
-       badio(outl, port);
-}
-
-void
-sh7300se_insb(unsigned long port, void *addr, unsigned long count)
-{
-       unsigned char *a = addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               *a++ = (p->inb) (p, port);
-}
-
-void
-sh7300se_insw(unsigned long port, void *addr, unsigned long count)
-{
-       unsigned short *a = addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               *a++ = (p->inw) (p, port);
-}
-
-void
-sh7300se_insl(unsigned long port, void *addr, unsigned long count)
-{
-       badio(insl, port);
-}
-
-void
-sh7300se_outsb(unsigned long port, const void *addr, unsigned long count)
-{
-       unsigned char *a = (unsigned char *) addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               (p->outb) (p, *a++, port);
-}
-
-void
-sh7300se_outsw(unsigned long port, const void *addr, unsigned long count)
-{
-       unsigned short *a = (unsigned short *) addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               (p->outw) (p, *a++, port);
-}
-
-void
-sh7300se_outsl(unsigned long port, const void *addr, unsigned long count)
-{
-       badio(outsw, port);
-}
diff --git a/arch/sh/boards/se/7300/irq.c b/arch/sh/boards/se/7300/irq.c
deleted file mode 100644 (file)
index 1279d77..0000000
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * linux/arch/sh/boards/se/7300/irq.c
- *
- * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
- *
- * SH-Mobile SolutionEngine 7300 Support.
- *
- */
-
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/se7300.h>
-
-static struct ipr_data se7300_ipr_map[] = {
-       /* PC_IRQ[0-3] -> IRQ0 (32) */
-       { IRQ0_IRQ, IRQ0_IPR_ADDR, IRQ0_IPR_POS, 0x0f - IRQ0_IRQ },
-       /* A_IRQ[0-3] -> IRQ1 (33) */
-       { IRQ1_IRQ, IRQ1_IPR_ADDR, IRQ1_IPR_POS, 0x0f - IRQ1_IRQ },
-       { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
-       { DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
-       { DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
-       { VIO_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
-};
-
-/*
- * Initialize IRQ setting
- */
-void __init
-init_7300se_IRQ(void)
-{
-       ctrl_outw(0x0028, PA_EPLD_MODESET);     /* mode set IRQ0,1 active low. */
-       ctrl_outw(0xa000, INTC_ICR1);           /* IRQ mode; IRQ0,1 enable.    */
-       ctrl_outw(0x0000, PORT_PFCR);           /* use F for IRQ[3:0] and SIU. */
-
-       make_ipr_irq(se7300_ipr_map, ARRAY_SIZE(se7300_ipr_map));
-
-       ctrl_outw(0x2000, PA_MRSHPC + 0x0c);    /* mrshpc irq enable */
-}
diff --git a/arch/sh/boards/se/7300/setup.c b/arch/sh/boards/se/7300/setup.c
deleted file mode 100644 (file)
index eb469f5..0000000
+++ /dev/null
@@ -1,74 +0,0 @@
-/*
- * linux/arch/sh/boards/se/7300/setup.c
- *
- * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
- *
- * SH-Mobile SolutionEngine 7300 Support.
- *
- */
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <asm/machvec.h>
-#include <asm/se7300.h>
-
-void init_7300se_IRQ(void);
-
-static unsigned char heartbeat_bit_pos[] = { 8, 9, 10, 11, 12, 13, 14, 15 };
-
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED + ARRAY_SIZE(heartbeat_bit_pos) - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct platform_device heartbeat_device = {
-       .name           = "heartbeat",
-       .id             = -1,
-       .dev    = {
-               .platform_data  = heartbeat_bit_pos,
-       },
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
-};
-
-static struct platform_device *se7300_devices[] __initdata = {
-       &heartbeat_device,
-};
-
-static int __init se7300_devices_setup(void)
-{
-       return platform_add_devices(se7300_devices, ARRAY_SIZE(se7300_devices));
-}
-__initcall(se7300_devices_setup);
-
-/*
- * The Machine Vector
- */
-static struct sh_machine_vector mv_7300se __initmv = {
-       .mv_name = "SolutionEngine 7300",
-       .mv_nr_irqs = 109,
-       .mv_inb = sh7300se_inb,
-       .mv_inw = sh7300se_inw,
-       .mv_inl = sh7300se_inl,
-       .mv_outb = sh7300se_outb,
-       .mv_outw = sh7300se_outw,
-       .mv_outl = sh7300se_outl,
-
-       .mv_inb_p = sh7300se_inb_p,
-       .mv_inw_p = sh7300se_inw,
-       .mv_inl_p = sh7300se_inl,
-       .mv_outb_p = sh7300se_outb_p,
-       .mv_outw_p = sh7300se_outw,
-       .mv_outl_p = sh7300se_outl,
-
-       .mv_insb = sh7300se_insb,
-       .mv_insw = sh7300se_insw,
-       .mv_insl = sh7300se_insl,
-       .mv_outsb = sh7300se_outsb,
-       .mv_outsw = sh7300se_outsw,
-       .mv_outsl = sh7300se_outsl,
-
-       .mv_init_irq = init_7300se_IRQ,
-};
diff --git a/arch/sh/boards/se/73180/Makefile b/arch/sh/boards/se/73180/Makefile
deleted file mode 100644 (file)
index e7c0996..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-#
-# Makefile for the 73180 SolutionEngine specific parts of the kernel
-#
-
-obj-y   := setup.o io.o irq.o
diff --git a/arch/sh/boards/se/73180/io.c b/arch/sh/boards/se/73180/io.c
deleted file mode 100644 (file)
index 7271557..0000000
+++ /dev/null
@@ -1,268 +0,0 @@
-/*
- * arch/sh/boards/se/73180/io.c
- *
- * Copyright (C) 2003 YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
- * Based on arch/sh/boards/se/7300/io.c
- *
- * I/O routine for SH-Mobile3 73180 SolutionEngine.
- *
- */
-
-#include <linux/kernel.h>
-#include <asm/mach/se73180.h>
-#include <asm/io.h>
-
-#define badio(fn, a) panic("bad i/o operation %s for %08lx.", #fn, a)
-
-struct iop {
-       unsigned long start, end;
-       unsigned long base;
-       struct iop *(*check) (struct iop * p, unsigned long port);
-       unsigned char (*inb) (struct iop * p, unsigned long port);
-       unsigned short (*inw) (struct iop * p, unsigned long port);
-       void (*outb) (struct iop * p, unsigned char value, unsigned long port);
-       void (*outw) (struct iop * p, unsigned short value, unsigned long port);
-};
-
-struct iop *
-simple_check(struct iop *p, unsigned long port)
-{
-       if ((p->start <= port) && (port <= p->end))
-               return p;
-       else
-               badio(check, port);
-}
-
-struct iop *
-ide_check(struct iop *p, unsigned long port)
-{
-       if (((0x1f0 <= port) && (port <= 0x1f7)) || (port == 0x3f7))
-               return p;
-       return NULL;
-}
-
-unsigned char
-simple_inb(struct iop *p, unsigned long port)
-{
-       return *(unsigned char *) (p->base + port);
-}
-
-unsigned short
-simple_inw(struct iop *p, unsigned long port)
-{
-       return *(unsigned short *) (p->base + port);
-}
-
-void
-simple_outb(struct iop *p, unsigned char value, unsigned long port)
-{
-       *(unsigned char *) (p->base + port) = value;
-}
-
-void
-simple_outw(struct iop *p, unsigned short value, unsigned long port)
-{
-       *(unsigned short *) (p->base + port) = value;
-}
-
-unsigned char
-pcc_inb(struct iop *p, unsigned long port)
-{
-       unsigned long addr = p->base + port + 0x40000;
-       unsigned long v;
-
-       if (port & 1)
-               addr += 0x00400000;
-       v = *(volatile unsigned char *) addr;
-       return v;
-}
-
-void
-pcc_outb(struct iop *p, unsigned char value, unsigned long port)
-{
-       unsigned long addr = p->base + port + 0x40000;
-
-       if (port & 1)
-               addr += 0x00400000;
-       *(volatile unsigned char *) addr = value;
-}
-
-unsigned char
-bad_inb(struct iop *p, unsigned long port)
-{
-       badio(inb, port);
-}
-
-void
-bad_outb(struct iop *p, unsigned char value, unsigned long port)
-{
-       badio(inw, port);
-}
-
-#ifdef CONFIG_SMC91X
-/* MSTLANEX01 LAN at 0xb400:0000 */
-static struct iop laniop = {
-       .start = 0x300,
-       .end = 0x30f,
-       .base = 0xb4000000,
-       .check = simple_check,
-       .inb = simple_inb,
-       .inw = simple_inw,
-       .outb = simple_outb,
-       .outw = simple_outw,
-};
-#endif
-
-/* NE2000 pc card NIC */
-static struct iop neiop = {
-       .start = 0x280,
-       .end = 0x29f,
-       .base = 0xb0600000 + 0x80,      /* soft 0x280 -> hard 0x300 */
-       .check = simple_check,
-       .inb = pcc_inb,
-       .inw = simple_inw,
-       .outb = pcc_outb,
-       .outw = simple_outw,
-};
-
-#ifdef CONFIG_IDE
-/* CF in CF slot */
-static struct iop cfiop = {
-       .base = 0xb0600000,
-       .check = ide_check,
-       .inb = pcc_inb,
-       .inw = simple_inw,
-       .outb = pcc_outb,
-       .outw = simple_outw,
-};
-#endif
-
-static __inline__ struct iop *
-port2iop(unsigned long port)
-{
-       if (0) ;
-#if defined(CONFIG_SMC91X)
-       else if (laniop.check(&laniop, port))
-               return &laniop;
-#endif
-#if defined(CONFIG_NE2000)
-       else if (neiop.check(&neiop, port))
-               return &neiop;
-#endif
-#if defined(CONFIG_IDE)
-       else if (cfiop.check(&cfiop, port))
-               return &cfiop;
-#endif
-       else
-               return &neiop;  /* fallback */
-}
-
-static inline void
-delay(void)
-{
-       ctrl_inw(0xac000000);
-       ctrl_inw(0xac000000);
-}
-
-unsigned char
-sh73180se_inb(unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       return (p->inb) (p, port);
-}
-
-unsigned char
-sh73180se_inb_p(unsigned long port)
-{
-       unsigned char v = sh73180se_inb(port);
-       delay();
-       return v;
-}
-
-unsigned short
-sh73180se_inw(unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       return (p->inw) (p, port);
-}
-
-unsigned int
-sh73180se_inl(unsigned long port)
-{
-       badio(inl, port);
-}
-
-void
-sh73180se_outb(unsigned char value, unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       (p->outb) (p, value, port);
-}
-
-void
-sh73180se_outb_p(unsigned char value, unsigned long port)
-{
-       sh73180se_outb(value, port);
-       delay();
-}
-
-void
-sh73180se_outw(unsigned short value, unsigned long port)
-{
-       struct iop *p = port2iop(port);
-       (p->outw) (p, value, port);
-}
-
-void
-sh73180se_outl(unsigned int value, unsigned long port)
-{
-       badio(outl, port);
-}
-
-void
-sh73180se_insb(unsigned long port, void *addr, unsigned long count)
-{
-       unsigned char *a = addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               *a++ = (p->inb) (p, port);
-}
-
-void
-sh73180se_insw(unsigned long port, void *addr, unsigned long count)
-{
-       unsigned short *a = addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               *a++ = (p->inw) (p, port);
-}
-
-void
-sh73180se_insl(unsigned long port, void *addr, unsigned long count)
-{
-       badio(insl, port);
-}
-
-void
-sh73180se_outsb(unsigned long port, const void *addr, unsigned long count)
-{
-       unsigned char *a = (unsigned char *) addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               (p->outb) (p, *a++, port);
-}
-
-void
-sh73180se_outsw(unsigned long port, const void *addr, unsigned long count)
-{
-       unsigned short *a = (unsigned short *) addr;
-       struct iop *p = port2iop(port);
-       while (count--)
-               (p->outw) (p, *a++, port);
-}
-
-void
-sh73180se_outsl(unsigned long port, const void *addr, unsigned long count)
-{
-       badio(outsw, port);
-}
diff --git a/arch/sh/boards/se/73180/irq.c b/arch/sh/boards/se/73180/irq.c
deleted file mode 100644 (file)
index e7200c5..0000000
+++ /dev/null
@@ -1,136 +0,0 @@
-/*
- * arch/sh/boards/se/73180/irq.c
- *
- * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
- * Based on arch/sh/boards/se/7300/irq.c
- *
- * Modified for SH-Mobile SolutionEngine 73180 Support
- *              by YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
- *
- */
-
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <asm/irq.h>
-#include <asm/io.h>
-#include <asm/mach/se73180.h>
-
-static int
-irq2intreq(int irq)
-{
-       if (irq == 10)
-               return 5;
-       return 7 - (irq - 32);
-}
-
-static void
-disable_intreq_irq(unsigned int irq)
-{
-       ctrl_outb(1 << (7 - irq2intreq(irq)), INTMSK0);
-}
-
-static void
-enable_intreq_irq(unsigned int irq)
-{
-       ctrl_outb(1 << (7 - irq2intreq(irq)), INTMSKCLR0);
-}
-
-static void
-mask_and_ack_intreq_irq(unsigned int irq)
-{
-       disable_intreq_irq(irq);
-}
-
-static unsigned int
-startup_intreq_irq(unsigned int irq)
-{
-       enable_intreq_irq(irq);
-       return 0;
-}
-
-static void
-shutdown_intreq_irq(unsigned int irq)
-{
-       disable_intreq_irq(irq);
-}
-
-static void
-end_intreq_irq(unsigned int irq)
-{
-       if (!(irq_desc[irq].status & (IRQ_DISABLED | IRQ_INPROGRESS)))
-               enable_intreq_irq(irq);
-}
-
-static struct hw_interrupt_type intreq_irq_type = {
-       .typename = "intreq",
-       .startup = startup_intreq_irq,
-       .shutdown = shutdown_intreq_irq,
-       .enable = enable_intreq_irq,
-       .disable = disable_intreq_irq,
-       .ack = mask_and_ack_intreq_irq,
-       .end = end_intreq_irq
-};
-
-void
-make_intreq_irq(unsigned int irq)
-{
-       disable_irq_nosync(irq);
-       irq_desc[irq].chip = &intreq_irq_type;
-       disable_intreq_irq(irq);
-}
-
-int
-shmse_irq_demux(int irq)
-{
-       if (irq == IRQ5_IRQ)
-               return 10;
-       return irq;
-}
-
-static struct ipr_data se73180_siof0_ipr_map[] = {
-       { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
-};
-static struct ipr_data se73180_vpu_ipr_map[] = {
-       { VPU_IRQ, VPU_IPR_ADDR, VPU_IPR_POS, 8 },
-};
-static struct ipr_data se73180_other_ipr_map[] = {
-       { DMTE2_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
-       { DMTE3_IRQ, DMA1_IPR_ADDR, DMA1_IPR_POS, DMA1_PRIORITY },
-       { DMTE4_IRQ, DMA2_IPR_ADDR, DMA2_IPR_POS, DMA2_PRIORITY },
-       { IIC0_ALI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
-       { IIC0_TACKI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
-       { IIC0_WAITI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
-       { IIC0_DTEI_IRQ, IIC0_IPR_ADDR, IIC0_IPR_POS, IIC0_PRIORITY },
-       { SIOF0_IRQ, SIOF0_IPR_ADDR, SIOF0_IPR_POS, SIOF0_PRIORITY },
-       { SIU_IRQ, SIU_IPR_ADDR, SIU_IPR_POS, SIU_PRIORITY },
-
-       /* VIO interrupt */
-       { CEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
-       { BEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
-       { VEU_IRQ, VIO_IPR_ADDR, VIO_IPR_POS, VIO_PRIORITY },
-
-       { LCDC_IRQ, LCDC_IPR_ADDR, LCDC_IPR_POS, LCDC_PRIORITY },
-};
-
-/*
- * Initialize IRQ setting
- */
-void __init
-init_73180se_IRQ(void)
-{
-       make_ipr_irq(se73180_siof0_ipr_map, ARRAY_SIZE(se73180_siof0_ipr_map));
-
-       ctrl_outw(0x2000, 0xb03fffec);  /* mrshpc irq enable */
-       ctrl_outw(0x2000, 0xb07fffec);  /* mrshpc irq enable */
-       ctrl_outl(3 << ((7 - 5) * 4), INTC_INTPRI0);    /* irq5 pri=3 */
-       ctrl_outw(2 << ((7 - 5) * 2), INTC_ICR1);       /* low-level irq */
-       make_intreq_irq(10);
-
-       make_ipr_irq(se73180_vpu_ipr_map, ARRAY_SIZE(se73180_vpu_ipr_map));
-
-       ctrl_outb(0x0f, INTC_IMCR5);    /* enable SCIF IRQ */
-
-       make_ipr_irq(se73180_other_ipr_map, ARRAY_SIZE(se73180_other_ipr_map));
-
-       ctrl_outw(0x2000, PA_MRSHPC + 0x0c);    /* mrshpc irq enable */
-}
diff --git a/arch/sh/boards/se/73180/setup.c b/arch/sh/boards/se/73180/setup.c
deleted file mode 100644 (file)
index 1deee85..0000000
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * arch/sh/boards/se/73180/setup.c
- *
- * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
- * Based on arch/sh/setup_shmse.c
- *
- * Modified for 73180 SolutionEngine
- *           by YOSHII Takashi <yoshii-takashi@hitachi-ul.co.jp>
- *
- */
-
-#include <linux/init.h>
-#include <linux/platform_device.h>
-#include <asm/machvec.h>
-#include <asm/se73180.h>
-#include <asm/irq.h>
-
-void init_73180se_IRQ(void);
-
-static struct resource heartbeat_resources[] = {
-       [0] = {
-               .start  = PA_LED,
-               .end    = PA_LED + 8 - 1,
-               .flags  = IORESOURCE_MEM,
-       },
-};
-
-static struct platform_device heartbeat_device = {
-       .name           = "heartbeat",
-       .id             = -1,
-       .num_resources  = ARRAY_SIZE(heartbeat_resources),
-       .resource       = heartbeat_resources,
-};
-
-static struct platform_device *se73180_devices[] __initdata = {
-       &heartbeat_device,
-};
-
-static int __init se73180_devices_setup(void)
-{
-       return platform_add_devices(se73180_devices,
-                                   ARRAY_SIZE(se73180_devices));
-}
-__initcall(se73180_devices_setup);
-
-/*
- * The Machine Vector
- */
-static struct sh_machine_vector mv_73180se __initmv = {
-       .mv_name = "SolutionEngine 73180",
-       .mv_nr_irqs = 108,
-       .mv_inb = sh73180se_inb,
-       .mv_inw = sh73180se_inw,
-       .mv_inl = sh73180se_inl,
-       .mv_outb = sh73180se_outb,
-       .mv_outw = sh73180se_outw,
-       .mv_outl = sh73180se_outl,
-
-       .mv_inb_p = sh73180se_inb_p,
-       .mv_inw_p = sh73180se_inw,
-       .mv_inl_p = sh73180se_inl,
-       .mv_outb_p = sh73180se_outb_p,
-       .mv_outw_p = sh73180se_outw,
-       .mv_outl_p = sh73180se_outl,
-
-       .mv_insb = sh73180se_insb,
-       .mv_insw = sh73180se_insw,
-       .mv_insl = sh73180se_insl,
-       .mv_outsb = sh73180se_outsb,
-       .mv_outsw = sh73180se_outsw,
-       .mv_outsl = sh73180se_outsl,
-
-       .mv_init_irq = init_73180se_IRQ,
-       .mv_irq_demux = shmse_irq_demux,
-};
index 11dc272c618ef0f559fd12568a893047179f0cf1..4c5ffdcd55b675aead50a32aaffe86c095ce8456 100644 (file)
@@ -32,9 +32,10 @@ $(obj)/zImage: $(obj)/compressed/vmlinux FORCE
 $(obj)/compressed/vmlinux: FORCE
        $(Q)$(MAKE) $(build)=$(obj)/compressed $@
 
-KERNEL_LOAD    := $(shell printf "0x%8x" $$[$(CONFIG_PAGE_OFFSET)  + \
-                                            $(CONFIG_MEMORY_START) + \
-                                            $(CONFIG_ZERO_PAGE_OFFSET)+0x1000])
+KERNEL_LOAD    := $(shell /bin/bash -c 'printf "0x%8x" \
+                    $$[$(CONFIG_PAGE_OFFSET)  + \
+                       $(CONFIG_MEMORY_START) + \
+                       $(CONFIG_ZERO_PAGE_OFFSET)+0x1000]')
 
 quiet_cmd_uimage = UIMAGE  $@
       cmd_uimage = $(CONFIG_SHELL) $(MKIMAGE) -A sh -O linux -T kernel \
index d9512416f88500847acff0eae59a90a8c3a092e1..013504ae112295c8aea032df4eb962cbd84aa7d6 100644 (file)
@@ -16,9 +16,10 @@ endif
 #
 # IMAGE_OFFSET is the load offset of the compression loader
 #
-IMAGE_OFFSET   := $(shell printf "0x%08x" $$[$(CONFIG_PAGE_OFFSET)  + \
-                                             $(CONFIG_MEMORY_START) + \
-                                             $(CONFIG_BOOT_LINK_OFFSET)])
+IMAGE_OFFSET   := $(shell /bin/bash -c 'printf "0x%08x" \
+                    $$[$(CONFIG_PAGE_OFFSET)  + \
+                       $(CONFIG_MEMORY_START) + \
+                       $(CONFIG_BOOT_LINK_OFFSET)]')
 
 LIBGCC := $(shell $(CC) $(CFLAGS) -print-libgcc-file-name)
 
index e1a886d621dbd8fe7d34a0295b645dabb9a8b37d..5d9da5a0275924a5eb062654a4674458c8283c73 100644 (file)
@@ -145,7 +145,7 @@ CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7091 is not set
 # CONFIG_CPU_SUBTYPE_SH7750R is not set
 # CONFIG_CPU_SUBTYPE_SH7750S is not set
-CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
index 07310fa03250b475dc6c73ddd78b86c37506176e..f52db125432f6c6bf0b7fd2d47be88d398dcbc8a 100644 (file)
@@ -156,7 +156,7 @@ CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7091 is not set
 # CONFIG_CPU_SUBTYPE_SH7750R is not set
 # CONFIG_CPU_SUBTYPE_SH7750S is not set
-CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
index fa09d68d057a2a23e78afac25f00f438e32d83e1..9fa66d92a4e75db47a6432cacac5e5b524818f55 100644 (file)
@@ -159,7 +159,7 @@ CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7091 is not set
 # CONFIG_CPU_SUBTYPE_SH7750R is not set
 # CONFIG_CPU_SUBTYPE_SH7750S is not set
-CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
index f1e979b1e4952f2d499296cc5199c5739d737d93..b64f73b704d615f19cf0f4af204d9ef104f06e19 100644 (file)
@@ -243,8 +243,8 @@ CONFIG_SH_PCLK_FREQ=60000000
 #
 # DMA support
 #
-CONFIG_SH_DMA=y
-CONFIG_NR_ONCHIP_DMA_CHANNELS=8
+# CONFIG_SH_DMA is not set
+# CONFIG_NR_ONCHIP_DMA_CHANNELS is not set
 # CONFIG_NR_DMA_CHANNELS_BOOL is not set
 
 #
@@ -280,7 +280,7 @@ CONFIG_ZERO_PAGE_OFFSET=0x00010000
 CONFIG_BOOT_LINK_OFFSET=0x00800000
 # CONFIG_UBC_WAKEUP is not set
 CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1 earlyprintk=bios"
+CONFIG_CMDLINE="console=tty0 console=ttySC0,115200 root=/dev/sda1 earlyprintk=serial"
 
 #
 # Bus options
@@ -1323,7 +1323,7 @@ CONFIG_ENABLE_MUST_CHECK=y
 # CONFIG_DEBUG_KERNEL is not set
 CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_SH_STANDARD_BIOS=y
+# CONFIG_SH_STANDARD_BIOS is not set
 CONFIG_EARLY_SCIF_CONSOLE=y
 CONFIG_EARLY_SCIF_CONSOLE_PORT=0xffe80000
 CONFIG_EARLY_PRINTK=y
diff --git a/arch/sh/configs/se7300_defconfig b/arch/sh/configs/se7300_defconfig
deleted file mode 100644 (file)
index 8a21790..0000000
+++ /dev/null
@@ -1,696 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18
-# Tue Oct  3 11:43:22 2006
-#
-CONFIG_SUPERH=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_PROBE=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-# CONFIG_SWAP is not set
-# CONFIG_SYSVIPC is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_UTS_NS is not set
-# CONFIG_IKCONFIG is not set
-# CONFIG_RELAY is not set
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-CONFIG_SYSCTL=y
-CONFIG_EMBEDDED=y
-CONFIG_UID16=y
-# CONFIG_SYSCTL_SYSCALL is not set
-# CONFIG_KALLSYMS is not set
-# CONFIG_HOTPLUG is not set
-CONFIG_PRINTK=y
-CONFIG_BUG=y
-CONFIG_ELF_CORE=y
-CONFIG_BASE_FULL=y
-# CONFIG_FUTEX is not set
-# CONFIG_EPOLL is not set
-CONFIG_SHMEM=y
-CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-# CONFIG_MODULES is not set
-
-#
-# Block layer
-#
-CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_BLK_DEV_IO_TRACE is not set
-# CONFIG_LSF is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
-# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
-CONFIG_DEFAULT_NOOP=y
-CONFIG_DEFAULT_IOSCHED="noop"
-
-#
-# System type
-#
-CONFIG_SOLUTION_ENGINE=y
-# CONFIG_SH_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SOLUTION_ENGINE is not set
-CONFIG_SH_7300_SOLUTION_ENGINE=y
-# CONFIG_SH_7343_SOLUTION_ENGINE is not set
-# CONFIG_SH_73180_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SYSTEMH is not set
-# CONFIG_SH_HP6XX is not set
-# CONFIG_SH_EC3104 is not set
-# CONFIG_SH_SATURN is not set
-# CONFIG_SH_DREAMCAST is not set
-# CONFIG_SH_BIGSUR is not set
-# CONFIG_SH_MPC1211 is not set
-# CONFIG_SH_SH03 is not set
-# CONFIG_SH_SECUREEDGE5410 is not set
-# CONFIG_SH_HS7751RVOIP is not set
-# CONFIG_SH_7710VOIPGW is not set
-# CONFIG_SH_RTS7751R2D is not set
-# CONFIG_SH_R7780RP is not set
-# CONFIG_SH_EDOSK7705 is not set
-# CONFIG_SH_SH4202_MICRODEV is not set
-# CONFIG_SH_LANDISK is not set
-# CONFIG_SH_TITAN is not set
-# CONFIG_SH_SHMIN is not set
-# CONFIG_SH_UNKNOWN is not set
-
-#
-# Processor selection
-#
-CONFIG_CPU_SH3=y
-
-#
-# SH-2 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7604 is not set
-
-#
-# SH-3 Processor Support
-#
-CONFIG_CPU_SUBTYPE_SH7300=y
-# CONFIG_CPU_SUBTYPE_SH7705 is not set
-# CONFIG_CPU_SUBTYPE_SH7706 is not set
-# CONFIG_CPU_SUBTYPE_SH7707 is not set
-# CONFIG_CPU_SUBTYPE_SH7708 is not set
-# CONFIG_CPU_SUBTYPE_SH7709 is not set
-# CONFIG_CPU_SUBTYPE_SH7710 is not set
-
-#
-# SH-4 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7750 is not set
-# CONFIG_CPU_SUBTYPE_SH7091 is not set
-# CONFIG_CPU_SUBTYPE_SH7750R is not set
-# CONFIG_CPU_SUBTYPE_SH7750S is not set
-# CONFIG_CPU_SUBTYPE_SH7751 is not set
-# CONFIG_CPU_SUBTYPE_SH7751R is not set
-# CONFIG_CPU_SUBTYPE_SH7760 is not set
-# CONFIG_CPU_SUBTYPE_SH4_202 is not set
-
-#
-# ST40 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
-
-#
-# SH-4A Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7770 is not set
-# CONFIG_CPU_SUBTYPE_SH7780 is not set
-
-#
-# SH4AL-DSP Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH73180 is not set
-# CONFIG_CPU_SUBTYPE_SH7343 is not set
-
-#
-# Memory management options
-#
-CONFIG_MMU=y
-CONFIG_PAGE_OFFSET=0x80000000
-CONFIG_MEMORY_START=0x0c000000
-CONFIG_MEMORY_SIZE=0x04000000
-CONFIG_VSYSCALL=y
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-
-#
-# Cache configuration
-#
-# CONFIG_SH_DIRECT_MAPPED is not set
-# CONFIG_SH_WRITETHROUGH is not set
-# CONFIG_SH_OCRAM is not set
-
-#
-# Processor features
-#
-CONFIG_CPU_LITTLE_ENDIAN=y
-# CONFIG_SH_FPU_EMU is not set
-CONFIG_SH_DSP=y
-# CONFIG_SH_ADC is not set
-CONFIG_CPU_HAS_INTEVT=y
-CONFIG_CPU_HAS_SR_RB=y
-
-#
-# Timer support
-#
-CONFIG_SH_TMU=y
-CONFIG_SH_PCLK_FREQ=33333333
-
-#
-# CPU Frequency scaling
-#
-# CONFIG_CPU_FREQ is not set
-
-#
-# DMA support
-#
-# CONFIG_SH_DMA is not set
-
-#
-# Companion Chips
-#
-# CONFIG_HD6446X_SERIES is not set
-CONFIG_HEARTBEAT=y
-
-#
-# Kernel features
-#
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
-# CONFIG_KEXEC is not set
-# CONFIG_SMP is not set
-CONFIG_PREEMPT_NONE=y
-# CONFIG_PREEMPT_VOLUNTARY is not set
-# CONFIG_PREEMPT is not set
-
-#
-# Boot options
-#
-CONFIG_ZERO_PAGE_OFFSET=0x00001000
-CONFIG_BOOT_LINK_OFFSET=0x00210000
-# CONFIG_UBC_WAKEUP is not set
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttySC0,38400 root=/dev/ram0"
-
-#
-# Bus options
-#
-# CONFIG_PCI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-
-#
-# PCI Hotplug Support
-#
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
-# CONFIG_BINFMT_MISC is not set
-
-#
-# Power management options (EXPERIMENTAL)
-#
-# CONFIG_PM is not set
-
-#
-# Networking
-#
-# CONFIG_NET is not set
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_COW_COMMON is not set
-# CONFIG_BLK_DEV_LOOP is not set
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_COUNT=16
-CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-CONFIG_BLK_DEV_INITRD=y
-# CONFIG_CDROM_PKTCDVD is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-# CONFIG_RAID_ATTRS is not set
-# CONFIG_SCSI is not set
-# CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
-# CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-# CONFIG_FUSION is not set
-
-#
-# IEEE 1394 (FireWire) support
-#
-
-#
-# I2O device support
-#
-
-#
-# ISDN subsystem
-#
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-CONFIG_INPUT=y
-# CONFIG_INPUT_FF_MEMLESS is not set
-
-#
-# Userland interfaces
-#
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
-# CONFIG_INPUT_JOYDEV is not set
-# CONFIG_INPUT_TSDEV is not set
-# CONFIG_INPUT_EVDEV is not set
-# CONFIG_INPUT_EVBUG is not set
-
-#
-# Input Device Drivers
-#
-# CONFIG_INPUT_KEYBOARD is not set
-# CONFIG_INPUT_MOUSE is not set
-# CONFIG_INPUT_JOYSTICK is not set
-# CONFIG_INPUT_TOUCHSCREEN is not set
-# CONFIG_INPUT_MISC is not set
-
-#
-# Hardware I/O ports
-#
-CONFIG_SERIO=y
-# CONFIG_SERIO_I8042 is not set
-# CONFIG_SERIO_SERPORT is not set
-# CONFIG_SERIO_LIBPS2 is not set
-# CONFIG_SERIO_RAW is not set
-# CONFIG_GAMEPORT is not set
-
-#
-# Character devices
-#
-# CONFIG_VT is not set
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-# CONFIG_SERIAL_8250 is not set
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_SH_SCI=y
-CONFIG_SERIAL_SH_SCI_NR_UARTS=2
-CONFIG_SERIAL_SH_SCI_CONSOLE=y
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-# CONFIG_UNIX98_PTYS is not set
-# CONFIG_LEGACY_PTYS is not set
-
-#
-# IPMI
-#
-CONFIG_IPMI_HANDLER=y
-# CONFIG_IPMI_PANIC_EVENT is not set
-CONFIG_IPMI_DEVICE_INTERFACE=y
-# CONFIG_IPMI_SI is not set
-CONFIG_IPMI_WATCHDOG=y
-# CONFIG_IPMI_POWEROFF is not set
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-CONFIG_SOFT_WATCHDOG=y
-# CONFIG_SH_WDT is not set
-CONFIG_HW_RANDOM=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
-# CONFIG_TCG_TPM is not set
-# CONFIG_TELCLOCK is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# SPI support
-#
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
-
-#
-# Hardware Monitoring support
-#
-CONFIG_HWMON=y
-# CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
-# CONFIG_SENSORS_F71805F is not set
-# CONFIG_SENSORS_VT1211 is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
-
-#
-# Misc devices
-#
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
-
-#
-# Digital Video Broadcasting Devices
-#
-
-#
-# Graphics support
-#
-CONFIG_FIRMWARE_EDID=y
-# CONFIG_FB is not set
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB_ARCH_HAS_HCD is not set
-# CONFIG_USB_ARCH_HAS_OHCI is not set
-# CONFIG_USB_ARCH_HAS_EHCI is not set
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
-# CONFIG_MMC is not set
-
-#
-# LED devices
-#
-# CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
-# CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_FS_POSIX_ACL is not set
-# CONFIG_XFS_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
-# CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-# CONFIG_FUSE_FS is not set
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-# CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_PROC_SYSCTL=y
-CONFIG_SYSFS=y
-# CONFIG_TMPFS is not set
-# CONFIG_HUGETLBFS is not set
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-# CONFIG_CONFIGFS_FS is not set
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-# CONFIG_NLS is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-# CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_DEBUG_BUGVERBOSE is not set
-# CONFIG_DEBUG_FS is not set
-CONFIG_FRAME_POINTER=y
-# CONFIG_UNWIND_INFO is not set
-CONFIG_SH_STANDARD_BIOS=y
-CONFIG_EARLY_PRINTK=y
-CONFIG_KGDB=y
-
-#
-# KGDB configuration options
-#
-# CONFIG_MORE_COMPILE_OPTIONS is not set
-# CONFIG_KGDB_NMI is not set
-# CONFIG_KGDB_THREAD is not set
-# CONFIG_SH_KGDB_CONSOLE is not set
-# CONFIG_KGDB_SYSRQ is not set
-# CONFIG_KGDB_KERNEL_ASSERTS is not set
-
-#
-# Serial port setup
-#
-CONFIG_KGDB_DEFPORT=1
-CONFIG_KGDB_DEFBAUD=115200
-CONFIG_KGDB_DEFPARITY_N=y
-# CONFIG_KGDB_DEFPARITY_E is not set
-# CONFIG_KGDB_DEFPARITY_O is not set
-CONFIG_KGDB_DEFBITS_8=y
-# CONFIG_KGDB_DEFBITS_7 is not set
-
-#
-# Security options
-#
-# CONFIG_KEYS is not set
-# CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
-# CONFIG_CRYPTO is not set
-
-#
-# Library routines
-#
-# CONFIG_CRC_CCITT is not set
-# CONFIG_CRC16 is not set
-CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
diff --git a/arch/sh/configs/se73180_defconfig b/arch/sh/configs/se73180_defconfig
deleted file mode 100644 (file)
index 1a76615..0000000
+++ /dev/null
@@ -1,648 +0,0 @@
-#
-# Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18
-# Tue Oct  3 11:44:45 2006
-#
-CONFIG_SUPERH=y
-CONFIG_RWSEM_GENERIC_SPINLOCK=y
-CONFIG_GENERIC_FIND_NEXT_BIT=y
-CONFIG_GENERIC_HWEIGHT=y
-CONFIG_GENERIC_HARDIRQS=y
-CONFIG_GENERIC_IRQ_PROBE=y
-CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
-
-#
-# Code maturity level options
-#
-CONFIG_EXPERIMENTAL=y
-CONFIG_BROKEN_ON_SMP=y
-CONFIG_INIT_ENV_ARG_LIMIT=32
-
-#
-# General setup
-#
-CONFIG_LOCALVERSION=""
-CONFIG_LOCALVERSION_AUTO=y
-CONFIG_SWAP=y
-# CONFIG_SYSVIPC is not set
-# CONFIG_BSD_PROCESS_ACCT is not set
-# CONFIG_UTS_NS is not set
-# CONFIG_IKCONFIG is not set
-# CONFIG_RELAY is not set
-CONFIG_INITRAMFS_SOURCE=""
-# CONFIG_CC_OPTIMIZE_FOR_SIZE is not set
-CONFIG_SYSCTL=y
-CONFIG_EMBEDDED=y
-CONFIG_UID16=y
-# CONFIG_SYSCTL_SYSCALL is not set
-# CONFIG_KALLSYMS is not set
-# CONFIG_HOTPLUG is not set
-CONFIG_PRINTK=y
-CONFIG_BUG=y
-CONFIG_ELF_CORE=y
-CONFIG_BASE_FULL=y
-# CONFIG_FUTEX is not set
-# CONFIG_EPOLL is not set
-CONFIG_SHMEM=y
-CONFIG_SLAB=y
-CONFIG_VM_EVENT_COUNTERS=y
-# CONFIG_TINY_SHMEM is not set
-CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
-CONFIG_MODULES=y
-# CONFIG_MODULE_UNLOAD is not set
-# CONFIG_MODVERSIONS is not set
-# CONFIG_MODULE_SRCVERSION_ALL is not set
-# CONFIG_KMOD is not set
-
-#
-# Block layer
-#
-CONFIG_BLOCK=y
-# CONFIG_LBD is not set
-# CONFIG_LSF is not set
-
-#
-# IO Schedulers
-#
-CONFIG_IOSCHED_NOOP=y
-# CONFIG_IOSCHED_AS is not set
-# CONFIG_IOSCHED_DEADLINE is not set
-# CONFIG_IOSCHED_CFQ is not set
-# CONFIG_DEFAULT_AS is not set
-# CONFIG_DEFAULT_DEADLINE is not set
-# CONFIG_DEFAULT_CFQ is not set
-CONFIG_DEFAULT_NOOP=y
-CONFIG_DEFAULT_IOSCHED="noop"
-
-#
-# System type
-#
-CONFIG_SOLUTION_ENGINE=y
-# CONFIG_SH_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SOLUTION_ENGINE is not set
-# CONFIG_SH_7300_SOLUTION_ENGINE is not set
-# CONFIG_SH_7343_SOLUTION_ENGINE is not set
-CONFIG_SH_73180_SOLUTION_ENGINE=y
-# CONFIG_SH_7751_SYSTEMH is not set
-# CONFIG_SH_HP6XX is not set
-# CONFIG_SH_EC3104 is not set
-# CONFIG_SH_SATURN is not set
-# CONFIG_SH_DREAMCAST is not set
-# CONFIG_SH_BIGSUR is not set
-# CONFIG_SH_MPC1211 is not set
-# CONFIG_SH_SH03 is not set
-# CONFIG_SH_SECUREEDGE5410 is not set
-# CONFIG_SH_HS7751RVOIP is not set
-# CONFIG_SH_7710VOIPGW is not set
-# CONFIG_SH_RTS7751R2D is not set
-# CONFIG_SH_R7780RP is not set
-# CONFIG_SH_EDOSK7705 is not set
-# CONFIG_SH_SH4202_MICRODEV is not set
-# CONFIG_SH_LANDISK is not set
-# CONFIG_SH_TITAN is not set
-# CONFIG_SH_SHMIN is not set
-# CONFIG_SH_UNKNOWN is not set
-
-#
-# Processor selection
-#
-CONFIG_CPU_SH4=y
-CONFIG_CPU_SH4A=y
-CONFIG_CPU_SH4AL_DSP=y
-
-#
-# SH-2 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7604 is not set
-
-#
-# SH-3 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7300 is not set
-# CONFIG_CPU_SUBTYPE_SH7705 is not set
-# CONFIG_CPU_SUBTYPE_SH7706 is not set
-# CONFIG_CPU_SUBTYPE_SH7707 is not set
-# CONFIG_CPU_SUBTYPE_SH7708 is not set
-# CONFIG_CPU_SUBTYPE_SH7709 is not set
-# CONFIG_CPU_SUBTYPE_SH7710 is not set
-
-#
-# SH-4 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7750 is not set
-# CONFIG_CPU_SUBTYPE_SH7091 is not set
-# CONFIG_CPU_SUBTYPE_SH7750R is not set
-# CONFIG_CPU_SUBTYPE_SH7750S is not set
-# CONFIG_CPU_SUBTYPE_SH7751 is not set
-# CONFIG_CPU_SUBTYPE_SH7751R is not set
-# CONFIG_CPU_SUBTYPE_SH7760 is not set
-# CONFIG_CPU_SUBTYPE_SH4_202 is not set
-
-#
-# ST40 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_ST40STB1 is not set
-# CONFIG_CPU_SUBTYPE_ST40GX1 is not set
-
-#
-# SH-4A Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7770 is not set
-# CONFIG_CPU_SUBTYPE_SH7780 is not set
-
-#
-# SH4AL-DSP Processor Support
-#
-CONFIG_CPU_SUBTYPE_SH73180=y
-# CONFIG_CPU_SUBTYPE_SH7343 is not set
-
-#
-# Memory management options
-#
-CONFIG_MMU=y
-CONFIG_PAGE_OFFSET=0x80000000
-CONFIG_MEMORY_START=0x0c000000
-CONFIG_MEMORY_SIZE=0x02000000
-CONFIG_32BIT=y
-CONFIG_VSYSCALL=y
-CONFIG_SELECT_MEMORY_MODEL=y
-CONFIG_FLATMEM_MANUAL=y
-# CONFIG_DISCONTIGMEM_MANUAL is not set
-# CONFIG_SPARSEMEM_MANUAL is not set
-CONFIG_FLATMEM=y
-CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
-CONFIG_SPLIT_PTLOCK_CPUS=4
-# CONFIG_RESOURCES_64BIT is not set
-
-#
-# Cache configuration
-#
-# CONFIG_SH_DIRECT_MAPPED is not set
-# CONFIG_SH_WRITETHROUGH is not set
-# CONFIG_SH_OCRAM is not set
-
-#
-# Processor features
-#
-CONFIG_CPU_LITTLE_ENDIAN=y
-# CONFIG_SH_FPU is not set
-# CONFIG_SH_FPU_EMU is not set
-CONFIG_SH_DSP=y
-# CONFIG_SH_STORE_QUEUES is not set
-CONFIG_CPU_HAS_INTEVT=y
-CONFIG_CPU_HAS_SR_RB=y
-
-#
-# Timer support
-#
-CONFIG_SH_TMU=y
-CONFIG_SH_PCLK_FREQ=27000000
-
-#
-# CPU Frequency scaling
-#
-# CONFIG_CPU_FREQ is not set
-
-#
-# DMA support
-#
-# CONFIG_SH_DMA is not set
-
-#
-# Companion Chips
-#
-# CONFIG_HD6446X_SERIES is not set
-CONFIG_HEARTBEAT=y
-
-#
-# Kernel features
-#
-# CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
-# CONFIG_KEXEC is not set
-# CONFIG_SMP is not set
-CONFIG_PREEMPT_NONE=y
-# CONFIG_PREEMPT_VOLUNTARY is not set
-# CONFIG_PREEMPT is not set
-
-#
-# Boot options
-#
-CONFIG_ZERO_PAGE_OFFSET=0x00010000
-CONFIG_BOOT_LINK_OFFSET=0x00800000
-# CONFIG_UBC_WAKEUP is not set
-CONFIG_CMDLINE_BOOL=y
-CONFIG_CMDLINE="console=ttySC0,38400 root=/dev/ram"
-
-#
-# Bus options
-#
-# CONFIG_PCI is not set
-
-#
-# PCCARD (PCMCIA/CardBus) support
-#
-
-#
-# PCI Hotplug Support
-#
-
-#
-# Executable file formats
-#
-CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
-# CONFIG_BINFMT_MISC is not set
-
-#
-# Power management options (EXPERIMENTAL)
-#
-# CONFIG_PM is not set
-
-#
-# Networking
-#
-# CONFIG_NET is not set
-
-#
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# CONFIG_BLK_DEV_COW_COMMON is not set
-CONFIG_BLK_DEV_LOOP=y
-# CONFIG_BLK_DEV_CRYPTOLOOP is not set
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_COUNT=16
-CONFIG_BLK_DEV_RAM_SIZE=4096
-CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-CONFIG_BLK_DEV_INITRD=y
-# CONFIG_CDROM_PKTCDVD is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
-# CONFIG_IDE is not set
-
-#
-# SCSI device support
-#
-# CONFIG_RAID_ATTRS is not set
-# CONFIG_SCSI is not set
-# CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
-# CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-# CONFIG_FUSION is not set
-
-#
-# IEEE 1394 (FireWire) support
-#
-
-#
-# I2O device support
-#
-
-#
-# ISDN subsystem
-#
-
-#
-# Telephony Support
-#
-# CONFIG_PHONE is not set
-
-#
-# Input device support
-#
-# CONFIG_INPUT is not set
-
-#
-# Hardware I/O ports
-#
-# CONFIG_SERIO is not set
-# CONFIG_GAMEPORT is not set
-
-#
-# Character devices
-#
-# CONFIG_VT is not set
-# CONFIG_SERIAL_NONSTANDARD is not set
-
-#
-# Serial drivers
-#
-# CONFIG_SERIAL_8250 is not set
-
-#
-# Non-8250 serial port support
-#
-CONFIG_SERIAL_SH_SCI=y
-CONFIG_SERIAL_SH_SCI_NR_UARTS=2
-CONFIG_SERIAL_SH_SCI_CONSOLE=y
-CONFIG_SERIAL_CORE=y
-CONFIG_SERIAL_CORE_CONSOLE=y
-# CONFIG_UNIX98_PTYS is not set
-# CONFIG_LEGACY_PTYS is not set
-
-#
-# IPMI
-#
-# CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
-CONFIG_WATCHDOG=y
-# CONFIG_WATCHDOG_NOWAYOUT is not set
-
-#
-# Watchdog Device Drivers
-#
-# CONFIG_SOFT_WATCHDOG is not set
-# CONFIG_SH_WDT is not set
-CONFIG_HW_RANDOM=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
-# CONFIG_R3964 is not set
-
-#
-# Ftape, the floppy tape device driver
-#
-# CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
-# CONFIG_TCG_TPM is not set
-# CONFIG_TELCLOCK is not set
-
-#
-# I2C support
-#
-# CONFIG_I2C is not set
-
-#
-# SPI support
-#
-# CONFIG_SPI is not set
-# CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
-
-#
-# Hardware Monitoring support
-#
-CONFIG_HWMON=y
-# CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
-# CONFIG_SENSORS_F71805F is not set
-# CONFIG_SENSORS_VT1211 is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
-
-#
-# Misc devices
-#
-
-#
-# Multimedia devices
-#
-# CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
-
-#
-# Digital Video Broadcasting Devices
-#
-
-#
-# Graphics support
-#
-CONFIG_FIRMWARE_EDID=y
-# CONFIG_FB is not set
-
-#
-# Sound
-#
-# CONFIG_SOUND is not set
-
-#
-# USB support
-#
-# CONFIG_USB_ARCH_HAS_HCD is not set
-# CONFIG_USB_ARCH_HAS_OHCI is not set
-# CONFIG_USB_ARCH_HAS_EHCI is not set
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
-# CONFIG_MMC is not set
-
-#
-# LED devices
-#
-# CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
-
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
-#
-# Real Time Clock
-#
-# CONFIG_RTC_CLASS is not set
-
-#
-# DMA Engine support
-#
-# CONFIG_DMA_ENGINE is not set
-
-#
-# DMA Clients
-#
-
-#
-# DMA Devices
-#
-
-#
-# File systems
-#
-CONFIG_EXT2_FS=y
-# CONFIG_EXT2_FS_XATTR is not set
-# CONFIG_EXT2_FS_XIP is not set
-# CONFIG_EXT3_FS is not set
-# CONFIG_REISERFS_FS is not set
-# CONFIG_JFS_FS is not set
-# CONFIG_FS_POSIX_ACL is not set
-# CONFIG_XFS_FS is not set
-# CONFIG_MINIX_FS is not set
-# CONFIG_ROMFS_FS is not set
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
-# CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
-# CONFIG_AUTOFS_FS is not set
-# CONFIG_AUTOFS4_FS is not set
-# CONFIG_FUSE_FS is not set
-
-#
-# CD-ROM/DVD Filesystems
-#
-# CONFIG_ISO9660_FS is not set
-# CONFIG_UDF_FS is not set
-
-#
-# DOS/FAT/NT Filesystems
-#
-# CONFIG_MSDOS_FS is not set
-# CONFIG_VFAT_FS is not set
-# CONFIG_NTFS_FS is not set
-
-#
-# Pseudo filesystems
-#
-CONFIG_PROC_FS=y
-CONFIG_PROC_KCORE=y
-CONFIG_PROC_SYSCTL=y
-# CONFIG_SYSFS is not set
-CONFIG_TMPFS=y
-# CONFIG_TMPFS_POSIX_ACL is not set
-# CONFIG_HUGETLBFS is not set
-# CONFIG_HUGETLB_PAGE is not set
-CONFIG_RAMFS=y
-
-#
-# Miscellaneous filesystems
-#
-# CONFIG_ADFS_FS is not set
-# CONFIG_AFFS_FS is not set
-# CONFIG_HFS_FS is not set
-# CONFIG_HFSPLUS_FS is not set
-# CONFIG_BEFS_FS is not set
-# CONFIG_BFS_FS is not set
-# CONFIG_EFS_FS is not set
-# CONFIG_CRAMFS is not set
-# CONFIG_VXFS_FS is not set
-# CONFIG_HPFS_FS is not set
-# CONFIG_QNX4FS_FS is not set
-# CONFIG_SYSV_FS is not set
-# CONFIG_UFS_FS is not set
-
-#
-# Partition Types
-#
-# CONFIG_PARTITION_ADVANCED is not set
-CONFIG_MSDOS_PARTITION=y
-
-#
-# Native Language Support
-#
-# CONFIG_NLS is not set
-
-#
-# Profiling support
-#
-# CONFIG_PROFILING is not set
-
-#
-# Kernel hacking
-#
-# CONFIG_PRINTK_TIME is not set
-CONFIG_ENABLE_MUST_CHECK=y
-# CONFIG_MAGIC_SYSRQ is not set
-# CONFIG_UNUSED_SYMBOLS is not set
-# CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
-# CONFIG_DEBUG_BUGVERBOSE is not set
-CONFIG_SH_STANDARD_BIOS=y
-# CONFIG_EARLY_SCIF_CONSOLE is not set
-# CONFIG_EARLY_PRINTK is not set
-# CONFIG_KGDB is not set
-
-#
-# Security options
-#
-# CONFIG_KEYS is not set
-
-#
-# Cryptographic options
-#
-# CONFIG_CRYPTO is not set
-
-#
-# Library routines
-#
-# CONFIG_CRC_CCITT is not set
-# CONFIG_CRC16 is not set
-CONFIG_CRC32=y
-# CONFIG_LIBCRC32C is not set
index 98503f16f3f5da1749c0632d4e0ce70f7d02fdc2..e4e5d21781313fc5bb05a07c9af095f44ab00011 100644 (file)
@@ -1,15 +1,24 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18
-# Tue Oct  3 12:55:47 2006
+# Linux kernel version: 2.6.23-rc1
+# Thu Jul 26 11:49:11 2007
 #
 CONFIG_SUPERH=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
+CONFIG_GENERIC_BUG=y
 CONFIG_GENERIC_FIND_NEXT_BIT=y
 CONFIG_GENERIC_HWEIGHT=y
 CONFIG_GENERIC_HARDIRQS=y
 CONFIG_GENERIC_IRQ_PROBE=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
+CONFIG_GENERIC_TIME=y
+CONFIG_GENERIC_CLOCKEVENTS=y
+CONFIG_SYS_SUPPORTS_PCI=y
+CONFIG_STACKTRACE_SUPPORT=y
+CONFIG_LOCKDEP_SUPPORT=y
+# CONFIG_ARCH_HAS_ILOG2_U32 is not set
+# CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_ARCH_NO_VIRT_TO_BUS=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -24,15 +33,18 @@ CONFIG_INIT_ENV_ARG_LIMIT=32
 #
 CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
-CONFIG_SWAP=y
+# CONFIG_SWAP is not set
 # CONFIG_SYSVIPC is not set
 # CONFIG_POSIX_MQUEUE is not set
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
+CONFIG_LOG_BUF_SHIFT=14
+# CONFIG_SYSFS_DEPRECATED is not set
 # CONFIG_RELAY is not set
+CONFIG_BLK_DEV_INITRD=y
 CONFIG_INITRAMFS_SOURCE=""
 CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SYSCTL=y
@@ -47,27 +59,25 @@ CONFIG_BUG=y
 CONFIG_ELF_CORE=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
+CONFIG_ANON_INODES=y
 CONFIG_EPOLL=y
+CONFIG_SIGNALFD=y
+CONFIG_TIMERFD=y
+CONFIG_EVENTFD=y
 CONFIG_SHMEM=y
-CONFIG_SLAB=y
 CONFIG_VM_EVENT_COUNTERS=y
+CONFIG_SLAB=y
+# CONFIG_SLUB is not set
+# CONFIG_SLOB is not set
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-# CONFIG_SLOB is not set
-
-#
-# Loadable module support
-#
 # CONFIG_MODULES is not set
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
 
 #
 # IO Schedulers
@@ -85,122 +95,103 @@ CONFIG_DEFAULT_IOSCHED="anticipatory"
 #
 # System type
 #
-# CONFIG_SH_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SOLUTION_ENGINE is not set
-# CONFIG_SH_7300_SOLUTION_ENGINE is not set
-# CONFIG_SH_7343_SOLUTION_ENGINE is not set
-# CONFIG_SH_73180_SOLUTION_ENGINE is not set
-# CONFIG_SH_7751_SYSTEMH is not set
-# CONFIG_SH_HP6XX is not set
-# CONFIG_SH_EC3104 is not set
-# CONFIG_SH_SATURN is not set
-# CONFIG_SH_DREAMCAST is not set
-# CONFIG_SH_BIGSUR is not set
-# CONFIG_SH_MPC1211 is not set
-# CONFIG_SH_SH03 is not set
-CONFIG_SH_SECUREEDGE5410=y
-# CONFIG_SH_HS7751RVOIP is not set
-# CONFIG_SH_7710VOIPGW is not set
-# CONFIG_SH_RTS7751R2D is not set
-# CONFIG_SH_R7780RP is not set
-# CONFIG_SH_EDOSK7705 is not set
-# CONFIG_SH_SH4202_MICRODEV is not set
-# CONFIG_SH_LANDISK is not set
-# CONFIG_SH_TITAN is not set
-# CONFIG_SH_SHMIN is not set
-# CONFIG_SH_UNKNOWN is not set
-
-#
-# Processor selection
-#
 CONFIG_CPU_SH4=y
-
-#
-# SH-2 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7604 is not set
-
-#
-# SH-3 Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH7300 is not set
+# CONFIG_CPU_SUBTYPE_SH7619 is not set
+# CONFIG_CPU_SUBTYPE_SH7206 is not set
 # CONFIG_CPU_SUBTYPE_SH7705 is not set
 # CONFIG_CPU_SUBTYPE_SH7706 is not set
 # CONFIG_CPU_SUBTYPE_SH7707 is not set
 # CONFIG_CPU_SUBTYPE_SH7708 is not set
 # CONFIG_CPU_SUBTYPE_SH7709 is not set
 # CONFIG_CPU_SUBTYPE_SH7710 is not set
-
-#
-# SH-4 Processor Support
-#
+# CONFIG_CPU_SUBTYPE_SH7712 is not set
 # CONFIG_CPU_SUBTYPE_SH7750 is not set
 # CONFIG_CPU_SUBTYPE_SH7091 is not set
 # CONFIG_CPU_SUBTYPE_SH7750R is not set
 # CONFIG_CPU_SUBTYPE_SH7750S is not set
-CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
-
-#
-# ST40 Processor Support
-#
 # CONFIG_CPU_SUBTYPE_ST40STB1 is not set
 # CONFIG_CPU_SUBTYPE_ST40GX1 is not set
-
-#
-# SH-4A Processor Support
-#
 # CONFIG_CPU_SUBTYPE_SH7770 is not set
 # CONFIG_CPU_SUBTYPE_SH7780 is not set
-
-#
-# SH4AL-DSP Processor Support
-#
-# CONFIG_CPU_SUBTYPE_SH73180 is not set
+# CONFIG_CPU_SUBTYPE_SH7785 is not set
+# CONFIG_CPU_SUBTYPE_SHX3 is not set
 # CONFIG_CPU_SUBTYPE_SH7343 is not set
+# CONFIG_CPU_SUBTYPE_SH7722 is not set
 
 #
 # Memory management options
 #
+CONFIG_QUICKLIST=y
 CONFIG_MMU=y
 CONFIG_PAGE_OFFSET=0x80000000
 CONFIG_MEMORY_START=0x08000000
 CONFIG_MEMORY_SIZE=0x01000000
 CONFIG_VSYSCALL=y
+CONFIG_ARCH_FLATMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_ENABLE=y
+CONFIG_ARCH_SPARSEMEM_DEFAULT=y
+CONFIG_MAX_ACTIVE_REGIONS=1
+CONFIG_ARCH_POPULATES_NODE_MAP=y
+CONFIG_ARCH_SELECT_MEMORY_MODEL=y
+CONFIG_PAGE_SIZE_4KB=y
+# CONFIG_PAGE_SIZE_8KB is not set
+# CONFIG_PAGE_SIZE_64KB is not set
 CONFIG_SELECT_MEMORY_MODEL=y
 CONFIG_FLATMEM_MANUAL=y
 # CONFIG_DISCONTIGMEM_MANUAL is not set
 # CONFIG_SPARSEMEM_MANUAL is not set
 CONFIG_FLATMEM=y
 CONFIG_FLAT_NODE_MEM_MAP=y
-# CONFIG_SPARSEMEM_STATIC is not set
+CONFIG_SPARSEMEM_STATIC=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
+CONFIG_ZONE_DMA_FLAG=0
+CONFIG_NR_QUICK=2
 
 #
 # Cache configuration
 #
 # CONFIG_SH_DIRECT_MAPPED is not set
 # CONFIG_SH_WRITETHROUGH is not set
-# CONFIG_SH_OCRAM is not set
 
 #
 # Processor features
 #
 CONFIG_CPU_LITTLE_ENDIAN=y
+# CONFIG_CPU_BIG_ENDIAN is not set
 CONFIG_SH_FPU=y
 # CONFIG_SH_DSP is not set
 # CONFIG_SH_STORE_QUEUES is not set
 CONFIG_CPU_HAS_INTEVT=y
+CONFIG_CPU_HAS_INTC_IRQ=y
+CONFIG_CPU_HAS_IPR_IRQ=y
 CONFIG_CPU_HAS_SR_RB=y
+CONFIG_CPU_HAS_PTEA=y
+
+#
+# Board support
+#
+# CONFIG_SH_7751_SYSTEMH is not set
+CONFIG_SH_SECUREEDGE5410=y
+# CONFIG_SH_HS7751RVOIP is not set
+# CONFIG_SH_RTS7751R2D is not set
+# CONFIG_SH_LANDISK is not set
+# CONFIG_SH_TITAN is not set
+# CONFIG_SH_LBOX_RE2 is not set
 
 #
-# Timer support
+# Timer and clock configuration
 #
 CONFIG_SH_TMU=y
+CONFIG_SH_TIMER_IRQ=16
 CONFIG_SH_PCLK_FREQ=60000000
+# CONFIG_TICK_ONESHOT is not set
+# CONFIG_NO_HZ is not set
+# CONFIG_HIGH_RES_TIMERS is not set
 
 #
 # CPU Frequency scaling
@@ -210,24 +201,31 @@ CONFIG_SH_PCLK_FREQ=60000000
 #
 # DMA support
 #
+CONFIG_SH_DMA_API=y
 CONFIG_SH_DMA=y
-CONFIG_NR_ONCHIP_DMA_CHANNELS=4
+CONFIG_NR_ONCHIP_DMA_CHANNELS=8
 # CONFIG_NR_DMA_CHANNELS_BOOL is not set
 
 #
 # Companion Chips
 #
-# CONFIG_HD6446X_SERIES is not set
+
+#
+# Additional SuperH Device Drivers
+#
+# CONFIG_HEARTBEAT is not set
+# CONFIG_PUSH_SWITCH is not set
 
 #
 # Kernel features
 #
 # CONFIG_HZ_100 is not set
 CONFIG_HZ_250=y
+# CONFIG_HZ_300 is not set
 # CONFIG_HZ_1000 is not set
 CONFIG_HZ=250
 # CONFIG_KEXEC is not set
-# CONFIG_SMP is not set
+# CONFIG_CRASH_DUMP is not set
 CONFIG_PREEMPT_NONE=y
 # CONFIG_PREEMPT_VOLUNTARY is not set
 # CONFIG_PREEMPT is not set
@@ -243,32 +241,23 @@ CONFIG_BOOT_LINK_OFFSET=0x00800000
 #
 # Bus options
 #
+CONFIG_SH_CONCAT_FS=y
 CONFIG_PCI=y
-# CONFIG_SH_PCIDMA_NONCOHERENT is not set
+CONFIG_SH_PCIDMA_NONCOHERENT=y
 CONFIG_PCI_AUTO=y
 CONFIG_PCI_AUTO_UPDATE_RESOURCES=y
-# CONFIG_PCI_MULTITHREAD_PROBE is not set
+# CONFIG_ARCH_SUPPORTS_MSI is not set
 
 #
 # PCCARD (PCMCIA/CardBus) support
 #
 
-#
-# PCI Hotplug Support
-#
-
 #
 # Executable file formats
 #
 CONFIG_BINFMT_ELF=y
-# CONFIG_BINFMT_FLAT is not set
 # CONFIG_BINFMT_MISC is not set
 
-#
-# Power management options (EXPERIMENTAL)
-#
-# CONFIG_PM is not set
-
 #
 # Networking
 #
@@ -277,21 +266,14 @@ CONFIG_NET=y
 #
 # Networking options
 #
-# CONFIG_NETDEBUG is not set
 # CONFIG_PACKET is not set
 # CONFIG_UNIX is not set
-CONFIG_XFRM=y
-# CONFIG_XFRM_USER is not set
-# CONFIG_XFRM_SUB_POLICY is not set
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
 # CONFIG_IP_MULTICAST is not set
 # CONFIG_IP_ADVANCED_ROUTER is not set
 CONFIG_IP_FIB_HASH=y
-CONFIG_IP_PNP=y
-CONFIG_IP_PNP_DHCP=y
-# CONFIG_IP_PNP_BOOTP is not set
-# CONFIG_IP_PNP_RARP is not set
+# CONFIG_IP_PNP is not set
 # CONFIG_NET_IPIP is not set
 # CONFIG_NET_IPGRE is not set
 # CONFIG_ARPD is not set
@@ -301,32 +283,21 @@ CONFIG_IP_PNP_DHCP=y
 # CONFIG_INET_IPCOMP is not set
 # CONFIG_INET_XFRM_TUNNEL is not set
 # CONFIG_INET_TUNNEL is not set
-CONFIG_INET_XFRM_MODE_TRANSPORT=y
-CONFIG_INET_XFRM_MODE_TUNNEL=y
-CONFIG_INET_DIAG=y
-CONFIG_INET_TCP_DIAG=y
+# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
+# CONFIG_INET_XFRM_MODE_TUNNEL is not set
+# CONFIG_INET_XFRM_MODE_BEET is not set
+# CONFIG_INET_DIAG is not set
 # CONFIG_TCP_CONG_ADVANCED is not set
 CONFIG_TCP_CONG_CUBIC=y
 CONFIG_DEFAULT_TCP_CONG="cubic"
+# CONFIG_TCP_MD5SIG is not set
 # CONFIG_IPV6 is not set
 # CONFIG_INET6_XFRM_TUNNEL is not set
 # CONFIG_INET6_TUNNEL is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_SCTP is not set
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -352,7 +323,17 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 # CONFIG_HAMRADIO is not set
 # CONFIG_IRDA is not set
 # CONFIG_BT is not set
+# CONFIG_AF_RXRPC is not set
+
+#
+# Wireless
+#
+# CONFIG_CFG80211 is not set
+# CONFIG_WIRELESS_EXT is not set
+# CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
+# CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -364,30 +345,88 @@ CONFIG_DEFAULT_TCP_CONG="cubic"
 CONFIG_STANDALONE=y
 CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-# CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
+CONFIG_MTD=y
+# CONFIG_MTD_DEBUG is not set
+# CONFIG_MTD_CONCAT is not set
+CONFIG_MTD_PARTITIONS=y
+# CONFIG_MTD_REDBOOT_PARTS is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLKDEVS=y
+# CONFIG_MTD_BLOCK is not set
+CONFIG_MTD_BLOCK_RO=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL is not set
+# CONFIG_SSFDC is not set
+
+#
+# RAM/ROM/Flash chip drivers
+#
+CONFIG_MTD_CFI=y
+# CONFIG_MTD_JEDECPROBE is not set
+CONFIG_MTD_GEN_PROBE=y
+CONFIG_MTD_CFI_ADV_OPTIONS=y
+CONFIG_MTD_CFI_NOSWAP=y
+# CONFIG_MTD_CFI_BE_BYTE_SWAP is not set
+# CONFIG_MTD_CFI_LE_BYTE_SWAP is not set
+CONFIG_MTD_CFI_GEOMETRY=y
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+# CONFIG_MTD_MAP_BANK_WIDTH_2 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_4 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
+# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
+CONFIG_MTD_CFI_I1=y
+# CONFIG_MTD_CFI_I2 is not set
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 is not set
+# CONFIG_MTD_OTP is not set
+CONFIG_MTD_CFI_INTELEXT=y
+# CONFIG_MTD_CFI_AMDSTD is not set
+# CONFIG_MTD_CFI_STAA is not set
+CONFIG_MTD_CFI_UTIL=y
+CONFIG_MTD_RAM=y
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+
+#
+# Mapping drivers for chip access
+#
+# CONFIG_MTD_COMPLEX_MAPPINGS is not set
+# CONFIG_MTD_PHYSMAP is not set
+CONFIG_MTD_PLATRAM=y
+
+#
+# Self-contained MTD device drivers
+#
+# CONFIG_MTD_PMC551 is not set
+# CONFIG_MTD_SLRAM is not set
+# CONFIG_MTD_PHRAM is not set
+# CONFIG_MTD_MTDRAM is not set
+# CONFIG_MTD_BLOCK2MTD is not set
+
+#
+# Disk-On-Chip Device Drivers
+#
+# CONFIG_MTD_DOC2000 is not set
+# CONFIG_MTD_DOC2001 is not set
+# CONFIG_MTD_DOC2001PLUS is not set
+# CONFIG_MTD_NAND is not set
+# CONFIG_MTD_ONENAND is not set
+
+#
+# UBI - Unsorted block images
+#
+# CONFIG_MTD_UBI is not set
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# CONFIG_BLK_CPQ_DA is not set
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
@@ -399,13 +438,9 @@ CONFIG_BLK_DEV_RAM=y
 CONFIG_BLK_DEV_RAM_COUNT=16
 CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
-CONFIG_BLK_DEV_INITRD=y
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
+# CONFIG_MISC_DEVICES is not set
 # CONFIG_IDE is not set
 
 #
@@ -413,16 +448,9 @@ CONFIG_BLK_DEV_INITRD=y
 #
 # CONFIG_RAID_ATTRS is not set
 # CONFIG_SCSI is not set
+# CONFIG_SCSI_DMA is not set
 # CONFIG_SCSI_NETLINK is not set
-
-#
-# Serial ATA (prod) and Parallel ATA (experimental) drivers
-#
 # CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
 # CONFIG_MD is not set
 
 #
@@ -433,35 +461,18 @@ CONFIG_BLK_DEV_INITRD=y
 #
 # IEEE 1394 (FireWire) support
 #
+# CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
 # CONFIG_I2O is not set
-
-#
-# Network device support
-#
 CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
 # CONFIG_DUMMY is not set
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-
-#
-# ARCnet devices
-#
 # CONFIG_ARCNET is not set
-
-#
-# PHY device support
-#
 # CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=y
 # CONFIG_STNIC is not set
@@ -470,10 +481,6 @@ CONFIG_MII=y
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
 # CONFIG_SMC91X is not set
-
-#
-# Tulip family network device support
-#
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 CONFIG_NET_PCI=y
@@ -488,9 +495,9 @@ CONFIG_NET_PCI=y
 # CONFIG_FEALNX is not set
 # CONFIG_NATSEMI is not set
 # CONFIG_NE2K_PCI is not set
-# CONFIG_8139CP is not set
+CONFIG_8139CP=y
 CONFIG_8139TOO=y
-# CONFIG_8139TOO_PIO is not set
+CONFIG_8139TOO_PIO=y
 # CONFIG_8139TOO_TUNE_TWISTER is not set
 # CONFIG_8139TOO_8129 is not set
 # CONFIG_8139_OLD_RX_RESET is not set
@@ -499,47 +506,16 @@ CONFIG_8139TOO=y
 # CONFIG_SUNDANCE is not set
 # CONFIG_TLAN is not set
 # CONFIG_VIA_RHINE is not set
-
-#
-# Ethernet (1000 Mbit)
-#
-# CONFIG_ACENIC is not set
-# CONFIG_DL2K is not set
-# CONFIG_E1000 is not set
-# CONFIG_NS83820 is not set
-# CONFIG_HAMACHI is not set
-# CONFIG_YELLOWFIN is not set
-# 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 is not set
-# CONFIG_BNX2 is not set
-# CONFIG_QLA3XXX is not set
-
-#
-# Ethernet (10000 Mbit)
-#
-# CONFIG_CHELSIO_T1 is not set
-# CONFIG_IXGB is not set
-# CONFIG_S2IO is not set
-# CONFIG_MYRI10GE is not set
-
-#
-# Token Ring devices
-#
+# CONFIG_SC92031 is not set
+# CONFIG_NETDEV_1000 is not set
+# CONFIG_NETDEV_10000 is not set
 # CONFIG_TR is not set
 
 #
-# Wireless LAN (non-hamradio)
-#
-# CONFIG_NET_RADIO is not set
-
-#
-# Wan interfaces
+# Wireless LAN
 #
+# CONFIG_WLAN_PRE80211 is not set
+# CONFIG_WLAN_80211 is not set
 # CONFIG_WAN is not set
 # CONFIG_FDDI is not set
 # CONFIG_HIPPI is not set
@@ -549,15 +525,7 @@ CONFIG_8139TOO=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -565,14 +533,12 @@ CONFIG_8139TOO=y
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
 #
-CONFIG_INPUT_MOUSEDEV=y
-CONFIG_INPUT_MOUSEDEV_PSAUX=y
-CONFIG_INPUT_MOUSEDEV_SCREEN_X=1024
-CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
+# CONFIG_INPUT_MOUSEDEV is not set
 # CONFIG_INPUT_JOYDEV is not set
 # CONFIG_INPUT_TSDEV is not set
 # CONFIG_INPUT_EVDEV is not set
@@ -584,27 +550,20 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 # CONFIG_INPUT_KEYBOARD is not set
 # CONFIG_INPUT_MOUSE is not set
 # CONFIG_INPUT_JOYSTICK is not set
+# CONFIG_INPUT_TABLET is not set
 # CONFIG_INPUT_TOUCHSCREEN is not set
 # CONFIG_INPUT_MISC is not set
 
 #
 # Hardware I/O ports
 #
-CONFIG_SERIO=y
-CONFIG_SERIO_I8042=y
-CONFIG_SERIO_SERPORT=y
-# CONFIG_SERIO_PCIPS2 is not set
-# CONFIG_SERIO_LIBPS2 is not set
-# CONFIG_SERIO_RAW is not set
+# CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
 
 #
 # Character devices
 #
-CONFIG_VT=y
-CONFIG_VT_CONSOLE=y
-CONFIG_HW_CONSOLE=y
-# CONFIG_VT_HW_CONSOLE_BINDING is not set
+# CONFIG_VT is not set
 # CONFIG_SERIAL_NONSTANDARD is not set
 
 #
@@ -615,42 +574,24 @@ CONFIG_HW_CONSOLE=y
 #
 # Non-8250 serial port support
 #
-# CONFIG_SERIAL_SH_SCI is not set
+CONFIG_SERIAL_SH_SCI=y
+CONFIG_SERIAL_SH_SCI_NR_UARTS=2
+CONFIG_SERIAL_SH_SCI_CONSOLE=y
+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
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
-
-#
-# Watchdog Cards
-#
 # CONFIG_WATCHDOG is not set
-CONFIG_HW_RANDOM=y
-# CONFIG_GEN_RTC is not set
-# CONFIG_DTLK is not set
+# CONFIG_HW_RANDOM is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-
-#
-# Ftape, the floppy tape device driver
-#
 # CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
-# CONFIG_TELCLOCK is not set
-
-#
-# I2C support
-#
+CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
 
 #
@@ -658,97 +599,45 @@ CONFIG_HW_RANDOM=y
 #
 # CONFIG_SPI is not set
 # CONFIG_SPI_MASTER is not set
+# CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
+# CONFIG_HWMON is not set
 
 #
-# Dallas's 1-wire bus
-#
-
-#
-# Hardware Monitoring support
-#
-CONFIG_HWMON=y
-# CONFIG_HWMON_VID is not set
-# CONFIG_SENSORS_ABITUGURU is not set
-# CONFIG_SENSORS_F71805F is not set
-# CONFIG_SENSORS_VT1211 is not set
-# CONFIG_HWMON_DEBUG_CHIP is not set
-
-#
-# Misc devices
+# Multifunction device drivers
 #
+# CONFIG_MFD_SM501 is not set
 
 #
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
-
-#
-# Digital Video Broadcasting Devices
-#
-# CONFIG_DVB is not set
+# CONFIG_DVB_CORE is not set
+# CONFIG_DAB is not set
 
 #
 # Graphics support
 #
-CONFIG_FIRMWARE_EDID=y
-# CONFIG_FB is not set
+# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
 
 #
-# Console display driver support
+# Display device support
 #
-CONFIG_DUMMY_CONSOLE=y
-# CONFIG_BACKLIGHT_LCD_SUPPORT is not set
+# CONFIG_DISPLAY_SUPPORT is not set
+# CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
+# CONFIG_FB is not set
 
 #
 # Sound
 #
 # CONFIG_SOUND is not set
-
-#
-# USB support
-#
-CONFIG_USB_ARCH_HAS_HCD=y
-CONFIG_USB_ARCH_HAS_OHCI=y
-CONFIG_USB_ARCH_HAS_EHCI=y
-# CONFIG_USB is not set
-
-#
-# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
-#
-
-#
-# USB Gadget Support
-#
-# CONFIG_USB_GADGET is not set
-
-#
-# MMC/SD Card support
-#
+# CONFIG_HID_SUPPORT is not set
+# CONFIG_USB_SUPPORT is not set
 # CONFIG_MMC is not set
-
-#
-# LED devices
-#
 # CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
 # CONFIG_INFINIBAND is not set
 
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
 #
 # Real Time Clock
 #
@@ -767,6 +656,11 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # DMA Devices
 #
 
+#
+# Userspace I/O
+#
+# CONFIG_UIO is not set
+
 #
 # File systems
 #
@@ -774,17 +668,18 @@ CONFIG_EXT2_FS=y
 # CONFIG_EXT2_FS_XATTR is not set
 # CONFIG_EXT2_FS_XIP is not set
 # CONFIG_EXT3_FS is not set
+# CONFIG_EXT4DEV_FS is not set
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 # CONFIG_FS_POSIX_ACL is not set
 # CONFIG_XFS_FS is not set
+# CONFIG_GFS2_FS is not set
 # CONFIG_OCFS2_FS is not set
 # CONFIG_MINIX_FS is not set
 CONFIG_ROMFS_FS=y
-CONFIG_INOTIFY=y
-CONFIG_INOTIFY_USER=y
+# CONFIG_INOTIFY is not set
 # CONFIG_QUOTA is not set
-CONFIG_DNOTIFY=y
+# CONFIG_DNOTIFY is not set
 # CONFIG_AUTOFS_FS is not set
 # CONFIG_AUTOFS4_FS is not set
 # CONFIG_FUSE_FS is not set
@@ -826,6 +721,7 @@ CONFIG_RAMFS=y
 # CONFIG_BEFS_FS is not set
 # CONFIG_BFS_FS is not set
 # CONFIG_EFS_FS is not set
+# CONFIG_JFFS2_FS is not set
 CONFIG_CRAMFS=y
 # CONFIG_VXFS_FS is not set
 # CONFIG_HPFS_FS is not set
@@ -836,25 +732,13 @@ CONFIG_CRAMFS=y
 #
 # Network File Systems
 #
-CONFIG_NFS_FS=y
-CONFIG_NFS_V3=y
-# CONFIG_NFS_V3_ACL is not set
-# CONFIG_NFS_V4 is not set
-# CONFIG_NFS_DIRECTIO is not set
+# CONFIG_NFS_FS is not set
 # CONFIG_NFSD is not set
-CONFIG_ROOT_NFS=y
-CONFIG_LOCKD=y
-CONFIG_LOCKD_V4=y
-CONFIG_NFS_COMMON=y
-CONFIG_SUNRPC=y
-# CONFIG_RPCSEC_GSS_KRB5 is not set
-# CONFIG_RPCSEC_GSS_SPKM3 is not set
 # CONFIG_SMB_FS is not set
 # CONFIG_CIFS is not set
 # CONFIG_NCP_FS is not set
 # CONFIG_CODA_FS is not set
 # CONFIG_AFS_FS is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
@@ -867,6 +751,11 @@ CONFIG_MSDOS_PARTITION=y
 #
 # CONFIG_NLS is not set
 
+#
+# Distributed Lock Manager
+#
+# CONFIG_DLM is not set
+
 #
 # Profiling support
 #
@@ -875,36 +764,38 @@ CONFIG_MSDOS_PARTITION=y
 #
 # Kernel hacking
 #
+CONFIG_TRACE_IRQFLAGS_SUPPORT=y
 # CONFIG_PRINTK_TIME is not set
 CONFIG_ENABLE_MUST_CHECK=y
 # CONFIG_MAGIC_SYSRQ is not set
 # CONFIG_UNUSED_SYMBOLS is not set
+# CONFIG_DEBUG_FS is not set
+# CONFIG_HEADERS_CHECK is not set
 # CONFIG_DEBUG_KERNEL is not set
-CONFIG_LOG_BUF_SHIFT=14
 # CONFIG_DEBUG_BUGVERBOSE is not set
-# CONFIG_DEBUG_FS is not set
-# CONFIG_UNWIND_INFO is not set
 # CONFIG_SH_STANDARD_BIOS is not set
 # CONFIG_EARLY_SCIF_CONSOLE is not set
-# CONFIG_KGDB is not set
+# CONFIG_SH_KGDB is not set
 
 #
 # Security options
 #
 # CONFIG_KEYS is not set
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
 # CONFIG_CRYPTO is not set
 
 #
 # Library routines
 #
+CONFIG_BITREVERSE=y
 # CONFIG_CRC_CCITT is not set
 # CONFIG_CRC16 is not set
+# CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
 CONFIG_PLIST=y
+CONFIG_HAS_IOMEM=y
+CONFIG_HAS_IOPORT=y
+CONFIG_HAS_DMA=y
index c16350dac01bf8ebc854566d9e937ff888201126..af921b5a9d4638e368a9a0cc54d0e38ecd5bd21f 100644 (file)
@@ -141,7 +141,7 @@ CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7091 is not set
 # CONFIG_CPU_SUBTYPE_SH7750R is not set
 # CONFIG_CPU_SUBTYPE_SH7750S is not set
-CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
index 41049cf14b791100cfe2c8e2013f30d7044e0597..0686ed6fe17a8a5abf5038989711d781565ba08b 100644 (file)
@@ -147,7 +147,7 @@ CONFIG_CPU_SH4=y
 # CONFIG_CPU_SUBTYPE_SH7091 is not set
 # CONFIG_CPU_SUBTYPE_SH7750R is not set
 # CONFIG_CPU_SUBTYPE_SH7750S is not set
-CONFIG_CPU_SUBTYPE_SH7751=y
+# CONFIG_CPU_SUBTYPE_SH7751 is not set
 CONFIG_CPU_SUBTYPE_SH7751R=y
 # CONFIG_CPU_SUBTYPE_SH7760 is not set
 # CONFIG_CPU_SUBTYPE_SH4_202 is not set
index cf8e119943306abd598cd1c761c7ce118891cb14..76ed816d9a24bd56966790f04bc0c74e2361da94 100644 (file)
@@ -31,8 +31,8 @@ struct dma_info *get_dma_info(unsigned int chan)
         * the channel is.
         */
        list_for_each_entry(info, &registered_dmac_list, list) {
-               if ((chan <  info->first_channel_nr) ||
-                   (chan >= info->first_channel_nr + info->nr_channels))
+               if ((chan <  info->first_vchannel_nr) ||
+                   (chan >= info->first_vchannel_nr + info->nr_channels))
                        continue;
 
                return info;
@@ -82,7 +82,7 @@ struct dma_channel *get_dma_channel(unsigned int chan)
 
        for (i = 0; i < info->nr_channels; i++) {
                channel = &info->channels[i];
-               if (channel->chan == chan)
+               if (channel->vchan == chan)
                        return channel;
        }
 
@@ -369,6 +369,7 @@ int register_dmac(struct dma_info *info)
        }
 
        total_channels = get_nr_channels();
+       info->first_vchannel_nr = total_channels;
        for (i = 0; i < info->nr_channels; i++) {
                struct dma_channel *chan = &info->channels[i];
 
index 9ddb446ac930107b973ae8d8a63579e6b3133fad..60bfc05cf3549b42d214645c33adc6b1e29b2c80 100644 (file)
@@ -4,7 +4,6 @@
 obj-y  += imask.o
 
 obj-$(CONFIG_CPU_HAS_IPR_IRQ)          += ipr.o
-obj-$(CONFIG_CPU_HAS_PINT_IRQ)         += pint.o 
 obj-$(CONFIG_CPU_HAS_MASKREG_IRQ)      += maskreg.o
 obj-$(CONFIG_CPU_HAS_INTC_IRQ)         += intc.o
 obj-$(CONFIG_CPU_HAS_INTC2_IRQ)                += intc2.o
index 98e84f40c713bf39bdd9e8599aab7fa92fb0570d..5da325414880abb50f68231cb001a80888cf7517 100644 (file)
@@ -8,7 +8,7 @@
  *
  * Supported system:
  *     On-chip supporting modules (TMU, RTC, etc.).
- *     On-chip supporting modules for SH7709/SH7709A/SH7729/SH7300.
+ *     On-chip supporting modules for SH7709/SH7709A/SH7729.
  *     Hitachi SolutionEngine external I/O:
  *             MS7709SE01, MS7709ASE01, and MS7750SE01
  *
diff --git a/arch/sh/kernel/cpu/irq/pint.c b/arch/sh/kernel/cpu/irq/pint.c
deleted file mode 100644 (file)
index 6760268..0000000
+++ /dev/null
@@ -1,220 +0,0 @@
-/*
- * arch/sh/kernel/cpu/irq/pint.c - Interrupt handling for PINT-based IRQs.
- *
- * Copyright (C) 1999  Niibe Yutaka & Takeshi Yaegashi
- * Copyright (C) 2000  Kazumoto Kojima
- * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-
-#include <linux/init.h>
-#include <linux/irq.h>
-#include <linux/module.h>
-
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/machvec.h>
-
-#if defined(CONFIG_CPU_SUBTYPE_SH7705)
-#define INTC_INTER      0xA4000014UL
-#define INTC_IPRD       0xA4000018UL
-#define INTC_ICR2       0xA4000012UL
-
-/* PFC */
-#define PORT_PACR       0xA4000100UL
-#define PORT_PBCR       0xA4000102UL
-#define PORT_PCCR       0xA4000104UL
-#define PORT_PDCR       0xA4000106UL
-#define PORT_PECR       0xA4000108UL
-#define PORT_PFCR       0xA400010AUL
-#define PORT_PGCR       0xA400010CUL
-#define PORT_PHCR       0xA400010EUL
-#define PORT_PJCR       0xA4000110UL
-#define PORT_PKCR       0xA4000112UL
-#define PORT_PLCR       0xA4000114UL
-#define PORT_PMCR       0xA4000118UL
-#define PORT_PNCR       0xA400011AUL
-#define PORT_PECR2      0xA4050148UL
-#define PORT_PFCR2      0xA405014AUL
-#define PORT_PNCR2      0xA405015AUL
-
-/* I/O port */
-#define PORT_PADR       0xA4000120UL
-#define PORT_PBDR       0xA4000122UL
-#define PORT_PCDR       0xA4000124UL
-#define PORT_PDDR       0xA4000126UL
-#define PORT_PEDR       0xA4000128UL
-#define PORT_PFDR       0xA400012AUL
-#define PORT_PGDR       0xA400012CUL
-#define PORT_PHDR       0xA400012EUL
-#define PORT_PJDR       0xA4000130UL
-#define PORT_PKDR       0xA4000132UL
-#define PORT_PLDR       0xA4000134UL
-#define PORT_PMDR       0xA4000138UL
-#define PORT_PNDR       0xA400013AUL
-
-#define PINT0_IRQ       40
-#define PINT8_IRQ       41
-#define PINT_IRQ_BASE   86
-
-#define PINT0_IPR_ADDR          INTC_IPRD
-#define PINT0_IPR_POS           3
-#define PINT0_PRIORITY      2
-
-#define PINT8_IPR_ADDR          INTC_IPRD
-#define PINT8_IPR_POS           2
-#define PINT8_PRIORITY      2
-
-#endif /* CONFIG_CPU_SUBTYPE_SH7705 */
-
-static unsigned char pint_map[256];
-static unsigned long portcr_mask;
-
-static void enable_pint_irq(unsigned int irq);
-static void disable_pint_irq(unsigned int irq);
-
-/* shutdown is same as "disable" */
-#define shutdown_pint_irq disable_pint_irq
-
-static void mask_and_ack_pint(unsigned int);
-static void end_pint_irq(unsigned int irq);
-
-static unsigned int startup_pint_irq(unsigned int irq)
-{
-       enable_pint_irq(irq);
-       return 0; /* never anything pending */
-}
-
-static struct hw_interrupt_type pint_irq_type = {
-       .typename = "PINT-IRQ",
-       .startup = startup_pint_irq,
-       .shutdown = shutdown_pint_irq,
-       .enable = enable_pint_irq,
-       .disable = disable_pint_irq,
-       .ack = mask_and_ack_pint,
-       .end = end_pint_irq
-};
-
-static void disable_pint_irq(unsigned int irq)
-{
-       unsigned long val;
-
-       val = ctrl_inw(INTC_INTER);
-       val &= ~(1 << (irq - PINT_IRQ_BASE));
-       ctrl_outw(val, INTC_INTER);     /* disable PINTn */
-       portcr_mask &= ~(3 << (irq - PINT_IRQ_BASE)*2);
-}
-
-static void enable_pint_irq(unsigned int irq)
-{
-       unsigned long val;
-
-       val = ctrl_inw(INTC_INTER);
-       val |= 1 << (irq - PINT_IRQ_BASE);
-       ctrl_outw(val, INTC_INTER);     /* enable PINTn */
-       portcr_mask |= 3 << (irq - PINT_IRQ_BASE)*2;
-}
-
-static void mask_and_ack_pint(unsigned int irq)
-{
-       disable_pint_irq(irq);
-}
-
-static void end_pint_irq(unsigned int irq)
-{
-       if (!(irq_desc[irq].status & (IRQ_DISABLED|IRQ_INPROGRESS)))
-               enable_pint_irq(irq);
-}
-
-void make_pint_irq(unsigned int irq)
-{
-       disable_irq_nosync(irq);
-       irq_desc[irq].chip = &pint_irq_type;
-       disable_pint_irq(irq);
-}
-
-static struct ipr_data pint_ipr_map[] = {
-       { PINT0_IRQ, PINT0_IPR_ADDR, PINT0_IPR_POS, PINT0_PRIORITY },
-       { PINT8_IRQ, PINT8_IPR_ADDR, PINT8_IPR_POS, PINT8_PRIORITY },
-};
-
-void __init init_IRQ_pint(void)
-{
-       int i;
-
-       make_ipr_irq(pint_ipr_map, ARRAY_SIZE(pint_ipr_map));
-
-       enable_irq(PINT0_IRQ);
-       enable_irq(PINT8_IRQ);
-
-       for(i = 0; i < 16; i++)
-               make_pint_irq(PINT_IRQ_BASE + i);
-
-       for(i = 0; i < 256; i++) {
-               if (i & 1)
-                       pint_map[i] = 0;
-               else if (i & 2)
-                       pint_map[i] = 1;
-               else if (i & 4)
-                       pint_map[i] = 2;
-               else if (i & 8)
-                       pint_map[i] = 3;
-               else if (i & 0x10)
-                       pint_map[i] = 4;
-               else if (i & 0x20)
-                       pint_map[i] = 5;
-               else if (i & 0x40)
-                       pint_map[i] = 6;
-               else if (i & 0x80)
-                       pint_map[i] = 7;
-       }
-}
-
-int ipr_irq_demux(int irq)
-{
-       unsigned long creg, dreg, d, sav;
-
-       if (irq == PINT0_IRQ) {
-#if defined(CONFIG_CPU_SUBTYPE_SH7705) || defined(CONFIG_CPU_SUBTYPE_SH7707)
-               creg = PORT_PACR;
-               dreg = PORT_PADR;
-#else
-               creg = PORT_PCCR;
-               dreg = PORT_PCDR;
-#endif
-               sav = ctrl_inw(creg);
-               ctrl_outw(sav | portcr_mask, creg);
-               d = (~ctrl_inb(dreg) ^ ctrl_inw(INTC_ICR2)) &
-                       ctrl_inw(INTC_INTER) & 0xff;
-               ctrl_outw(sav, creg);
-
-               if (d == 0)
-                       return irq;
-
-               return PINT_IRQ_BASE + pint_map[d];
-       } else if (irq == PINT8_IRQ) {
-#if defined(CONFIG_CPU_SUBTYPE_SH7705) || defined(CONFIG_CPU_SUBTYPE_SH7707)
-               creg = PORT_PBCR;
-               dreg = PORT_PBDR;
-#else
-               creg = PORT_PFCR;
-               dreg = PORT_PFDR;
-#endif
-               sav = ctrl_inw(creg);
-               ctrl_outw(sav | (portcr_mask >> 16), creg);
-               d = (~ctrl_inb(dreg) ^ (ctrl_inw(INTC_ICR2) >> 8)) &
-                       (ctrl_inw(INTC_INTER) >> 8) & 0xff;
-               ctrl_outw(sav, creg);
-
-               if (d == 0)
-                       return irq;
-
-               return PINT_IRQ_BASE + 8 + pint_map[d];
-       }
-
-       return irq;
-}
-
index 09faa056cd43b0eec5cc45673b9d1904142097e2..55b750763f66765729c024abeee4d0499b6f6a3e 100644 (file)
@@ -10,16 +10,14 @@ obj-$(CONFIG_CPU_SUBTYPE_SH7706)    += setup-sh7709.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7707)       += setup-sh7709.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7708)       += setup-sh7708.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7709)       += setup-sh7709.o
-obj-$(CONFIG_CPU_SUBTYPE_SH7300)       += setup-sh7300.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7710)       += setup-sh7710.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7712)       += setup-sh7710.o
 
 # Primary on-chip clocks (common)
 clock-$(CONFIG_CPU_SH3)                        := clock-sh3.o
-clock-$(CONFIG_CPU_SUBTYPE_SH7300)     := clock-sh7300.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7705)     := clock-sh7705.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7706)     := clock-sh7706.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7709)     := clock-sh7709.o
-clock-$(CONFIG_CPU_SUBTYPE_SH7710)     := clock-sh7300.o
+clock-$(CONFIG_CPU_SUBTYPE_SH7710)     := clock-sh7710.o
 
 obj-y  += $(clock-y)
similarity index 74%
rename from arch/sh/kernel/cpu/sh3/clock-sh7300.c
rename to arch/sh/kernel/cpu/sh3/clock-sh7710.c
index e804174b96253d9ac6aa81b0d7f8f30c8a9041c3..4744c50ec449cd61a97d04e725bfe5662b7209b2 100644 (file)
@@ -1,7 +1,7 @@
 /*
- * arch/sh/kernel/cpu/sh3/clock-sh7300.c
+ * arch/sh/kernel/cpu/sh3/clock-sh7710.c
  *
- * SH7300 support for the clock framework
+ * SH7710 support for the clock framework
  *
  *  Copyright (C) 2005  Paul Mundt
  *
@@ -29,7 +29,7 @@ static void master_clk_init(struct clk *clk)
        clk->rate *= md_table[ctrl_inw(FRQCR) & 0x0007];
 }
 
-static struct clk_ops sh7300_master_clk_ops = {
+static struct clk_ops sh7710_master_clk_ops = {
        .init           = master_clk_init,
 };
 
@@ -39,7 +39,7 @@ static void module_clk_recalc(struct clk *clk)
        clk->rate = clk->parent->rate / md_table[idx];
 }
 
-static struct clk_ops sh7300_module_clk_ops = {
+static struct clk_ops sh7710_module_clk_ops = {
        .recalc         = module_clk_recalc,
 };
 
@@ -49,7 +49,7 @@ static void bus_clk_recalc(struct clk *clk)
        clk->rate = clk->parent->rate / md_table[idx];
 }
 
-static struct clk_ops sh7300_bus_clk_ops = {
+static struct clk_ops sh7710_bus_clk_ops = {
        .recalc         = bus_clk_recalc,
 };
 
@@ -59,20 +59,20 @@ static void cpu_clk_recalc(struct clk *clk)
        clk->rate = clk->parent->rate / md_table[idx];
 }
 
-static struct clk_ops sh7300_cpu_clk_ops = {
+static struct clk_ops sh7710_cpu_clk_ops = {
        .recalc         = cpu_clk_recalc,
 };
 
-static struct clk_ops *sh7300_clk_ops[] = {
-       &sh7300_master_clk_ops,
-       &sh7300_module_clk_ops,
-       &sh7300_bus_clk_ops,
-       &sh7300_cpu_clk_ops,
+static struct clk_ops *sh7710_clk_ops[] = {
+       &sh7710_master_clk_ops,
+       &sh7710_module_clk_ops,
+       &sh7710_bus_clk_ops,
+       &sh7710_cpu_clk_ops,
 };
 
 void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
 {
-       if (idx < ARRAY_SIZE(sh7300_clk_ops))
-               *ops = sh7300_clk_ops[idx];
+       if (idx < ARRAY_SIZE(sh7710_clk_ops))
+               *ops = sh7710_clk_ops[idx];
 }
 
index d8e122971c3e2caaa78028513b8f3a61d78de425..0d12a124055ca7d4a31ffaee1e955dc654cb7bc4 100644 (file)
@@ -149,8 +149,7 @@ call_dpf:
         lds    r10, pr
        rts
         nop
-0:     sti
-       mov.l   3f, r0
+0:     mov.l   3f, r0
        mov     r9, r6
        mov     r8, r5
        jmp     @r0
diff --git a/arch/sh/kernel/cpu/sh3/setup-sh7300.c b/arch/sh/kernel/cpu/sh3/setup-sh7300.c
deleted file mode 100644 (file)
index ab4d204..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SH7300 Setup
- *
- *  Copyright (C) 2006  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/platform_device.h>
-#include <linux/init.h>
-#include <linux/serial.h>
-#include <asm/sci.h>
-
-static struct plat_sci_port sci_platform_data[] = {
-       {
-               .mapbase        = 0xa4430000,
-               .flags          = UPF_BOOT_AUTOCONF,
-               .type           = PORT_SCI,
-               .irqs           = { 80, 80, 80, 80 },
-       }, {
-               .flags = 0,
-       }
-};
-
-static struct platform_device sci_device = {
-       .name           = "sh-sci",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = sci_platform_data,
-       },
-};
-
-static struct platform_device *sh7300_devices[] __initdata = {
-       &sci_device,
-};
-
-static int __init sh7300_devices_setup(void)
-{
-       return platform_add_devices(sh7300_devices,
-                                   ARRAY_SIZE(sh7300_devices));
-}
-__initcall(sh7300_devices_setup);
index 66c3f75647b2b35f504183db13eba216ad2258c3..98d28fb1ce167a47769536163c68e31ee4c6bdc4 100644 (file)
@@ -90,12 +90,6 @@ int __init detect_cpu_and_cache_system(void)
                current_cpu_data.type = CPU_SH7751;
                current_cpu_data.flags |= CPU_HAS_FPU;
                break;
-       case 0x2000:
-               current_cpu_data.type = CPU_SH73180;
-               current_cpu_data.icache.ways = 4;
-               current_cpu_data.dcache.ways = 4;
-               current_cpu_data.flags |= CPU_HAS_LLSC;
-               break;
        case 0x2001:
        case 0x2004:
                current_cpu_data.type = CPU_SH7770;
index b98d6c3e6f36c3edb9b70a2e3ae07a1ac802be0a..c21512c6044e790a815458b7833d48a7b7ce9639 100644 (file)
@@ -208,7 +208,6 @@ EXPORT_SYMBOL(sq_remap);
 void sq_unmap(unsigned long vaddr)
 {
        struct sq_mapping **p, *map;
-       struct vm_struct *vma;
        int page;
 
        for (p = &sq_mapping_list; (map = *p); p = &map->next)
@@ -225,11 +224,18 @@ void sq_unmap(unsigned long vaddr)
        bitmap_release_region(sq_bitmap, page, get_order(map->size));
 
 #ifdef CONFIG_MMU
-       vma = remove_vm_area((void *)(map->sq_addr & PAGE_MASK));
-       if (!vma) {
-               printk(KERN_ERR "%s: bad address 0x%08lx\n",
-                      __FUNCTION__, map->sq_addr);
-               return;
+       {
+               /*
+                * Tear down the VMA in the MMU case.
+                */
+               struct vm_struct *vma;
+
+               vma = remove_vm_area((void *)(map->sq_addr & PAGE_MASK));
+               if (!vma) {
+                       printk(KERN_ERR "%s: bad address 0x%08lx\n",
+                              __FUNCTION__, map->sq_addr);
+                       return;
+               }
        }
 #endif
 
index 400623286487b3b58ae81b74404f2a4fb9b6957e..e6a1fb5f8484f91351fecf19bb02ee672d754162 100644 (file)
@@ -6,13 +6,11 @@
 obj-$(CONFIG_CPU_SUBTYPE_SH7770)       += setup-sh7770.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7780)       += setup-sh7780.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7785)       += setup-sh7785.o
-obj-$(CONFIG_CPU_SUBTYPE_SH73180)      += setup-sh73180.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7343)       += setup-sh7343.o
 obj-$(CONFIG_CPU_SUBTYPE_SH7722)       += setup-sh7722.o
 obj-$(CONFIG_CPU_SUBTYPE_SHX3)         += setup-shx3.o
 
 # Primary on-chip clocks (common)
-clock-$(CONFIG_CPU_SUBTYPE_SH73180)    := clock-sh73180.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7770)     := clock-sh7770.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7780)     := clock-sh7780.o
 clock-$(CONFIG_CPU_SUBTYPE_SH7785)     := clock-sh7785.o
diff --git a/arch/sh/kernel/cpu/sh4a/clock-sh73180.c b/arch/sh/kernel/cpu/sh4a/clock-sh73180.c
deleted file mode 100644 (file)
index 6d5ba37..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- * arch/sh/kernel/cpu/sh4a/clock-sh73180.c
- *
- * SH73180 support for the clock framework
- *
- *  Copyright (C) 2005  Paul Mundt
- *
- * FRQCR parsing hacked out of arch/sh/kernel/time.c
- *
- *  Copyright (C) 1999  Tetsuya Okada & Niibe Yutaka
- *  Copyright (C) 2000  Philipp Rumpf <prumpf@tux.org>
- *  Copyright (C) 2002, 2003, 2004  Paul Mundt
- *  Copyright (C) 2002  M. R. Brown  <mrbrown@linux-sh.org>
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/init.h>
-#include <linux/kernel.h>
-#include <asm/clock.h>
-#include <asm/freq.h>
-#include <asm/io.h>
-
-/*
- * SH73180 uses a common set of divisors, so this is quite simple..
- */
-static int divisors[] = { 1, 2, 3, 4, 6, 8, 12, 16 };
-
-static void master_clk_init(struct clk *clk)
-{
-       clk->rate *= divisors[ctrl_inl(FRQCR) & 0x0007];
-}
-
-static struct clk_ops sh73180_master_clk_ops = {
-       .init           = master_clk_init,
-};
-
-static void module_clk_recalc(struct clk *clk)
-{
-       int idx = (ctrl_inl(FRQCR) & 0x0007);
-       clk->rate = clk->parent->rate / divisors[idx];
-}
-
-static struct clk_ops sh73180_module_clk_ops = {
-       .recalc         = module_clk_recalc,
-};
-
-static void bus_clk_recalc(struct clk *clk)
-{
-       int idx = (ctrl_inl(FRQCR) >> 12) & 0x0007;
-       clk->rate = clk->parent->rate / divisors[idx];
-}
-
-static struct clk_ops sh73180_bus_clk_ops = {
-       .recalc         = bus_clk_recalc,
-};
-
-static void cpu_clk_recalc(struct clk *clk)
-{
-       int idx = (ctrl_inl(FRQCR) >> 20) & 0x0007;
-       clk->rate = clk->parent->rate / divisors[idx];
-}
-
-static struct clk_ops sh73180_cpu_clk_ops = {
-       .recalc         = cpu_clk_recalc,
-};
-
-static struct clk_ops *sh73180_clk_ops[] = {
-       &sh73180_master_clk_ops,
-       &sh73180_module_clk_ops,
-       &sh73180_bus_clk_ops,
-       &sh73180_cpu_clk_ops,
-};
-
-void __init arch_init_clk_ops(struct clk_ops **ops, int idx)
-{
-       if (idx < ARRAY_SIZE(sh73180_clk_ops))
-               *ops = sh73180_clk_ops[idx];
-}
-
diff --git a/arch/sh/kernel/cpu/sh4a/setup-sh73180.c b/arch/sh/kernel/cpu/sh4a/setup-sh73180.c
deleted file mode 100644 (file)
index cc9ea1e..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-/*
- * SH73180 Setup
- *
- *  Copyright (C) 2006  Paul Mundt
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License.  See the file "COPYING" in the main directory of this archive
- * for more details.
- */
-#include <linux/platform_device.h>
-#include <linux/init.h>
-#include <linux/serial.h>
-#include <asm/sci.h>
-
-static struct plat_sci_port sci_platform_data[] = {
-       {
-               .mapbase        = 0xffe80000,
-               .flags          = UPF_BOOT_AUTOCONF,
-               .type           = PORT_SCIF,
-               .irqs           = { 80, 81, 83, 82 },
-       }, {
-               .flags = 0,
-       }
-};
-
-static struct platform_device sci_device = {
-       .name           = "sh-sci",
-       .id             = -1,
-       .dev            = {
-               .platform_data  = sci_platform_data,
-       },
-};
-
-static struct platform_device *sh73180_devices[] __initdata = {
-       &sci_device,
-};
-
-static int __init sh73180_devices_setup(void)
-{
-       return platform_add_devices(sh73180_devices,
-                                   ARRAY_SIZE(sh73180_devices));
-}
-__initcall(sh73180_devices_setup);
index 44053ea92936acd7c16ebfda621921a00b0deb9b..4b449c4a6bad72163786963177c67f5295c6235c 100644 (file)
@@ -3,7 +3,7 @@
 #include <linux/sched.h>
 #include <linux/init_task.h>
 #include <linux/mqueue.h>
-
+#include <linux/fs.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 
index 6334a4c54c7cefeff3a5f2e7b03a37c81839b805..15ae322dbd741a594529835c2c543987125d37f9 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/kdebug.h>
 #include <linux/tick.h>
 #include <linux/reboot.h>
+#include <linux/fs.h>
 #include <asm/uaccess.h>
 #include <asm/mmu_context.h>
 #include <asm/pgalloc.h>
@@ -474,7 +475,6 @@ out:
 
 unsigned long get_wchan(struct task_struct *p)
 {
-       unsigned long schedule_frame;
        unsigned long pc;
 
        if (!p || p == current || p->state == TASK_RUNNING)
@@ -484,10 +484,13 @@ unsigned long get_wchan(struct task_struct *p)
         * The same comment as on the Alpha applies here, too ...
         */
        pc = thread_saved_pc(p);
+
+#ifdef CONFIG_FRAME_POINTER
        if (in_sched_functions(pc)) {
-               schedule_frame = (unsigned long)p->thread.sp;
+               unsigned long schedule_frame = (unsigned long)p->thread.sp;
                return ((unsigned long *)schedule_frame)[21];
        }
+#endif
 
        return pc;
 }
index c14a3e95d0b18c52e261a1d93ae8095d06640168..2cf7dec0d6904fbe94317e2223e003106b938551 100644 (file)
@@ -276,7 +276,6 @@ void __init setup_arch(char **cmdline_p)
 
 static const char *cpu_name[] = {
        [CPU_SH7206]    = "SH7206",     [CPU_SH7619]    = "SH7619",
-       [CPU_SH7300]    = "SH7300",
        [CPU_SH7705]    = "SH7705",     [CPU_SH7706]    = "SH7706",
        [CPU_SH7707]    = "SH7707",     [CPU_SH7708]    = "SH7708",
        [CPU_SH7709]    = "SH7709",     [CPU_SH7710]    = "SH7710",
@@ -284,7 +283,7 @@ static const char *cpu_name[] = {
        [CPU_SH7729]    = "SH7729",     [CPU_SH7750]    = "SH7750",
        [CPU_SH7750S]   = "SH7750S",    [CPU_SH7750R]   = "SH7750R",
        [CPU_SH7751]    = "SH7751",     [CPU_SH7751R]   = "SH7751R",
-       [CPU_SH7760]    = "SH7760",     [CPU_SH73180]   = "SH73180",
+       [CPU_SH7760]    = "SH7760",
        [CPU_ST40RA]    = "ST40RA",     [CPU_ST40GX1]   = "ST40GX1",
        [CPU_SH4_202]   = "SH4-202",    [CPU_SH4_501]   = "SH4-501",
        [CPU_SH7770]    = "SH7770",     [CPU_SH7780]    = "SH7780",
index 76b1bc7f70297adc324ad84c8aedfbdb2004acca..024ce5dedd8c12d682b3c7f73de7caf769bbd46c 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/file.h>
 #include <linux/utsname.h>
 #include <linux/module.h>
+#include <linux/fs.h>
 #include <asm/cacheflush.h>
 #include <asm/uaccess.h>
 #include <asm/ipc.h>
index 7aca37d79766f5c19dae8cc0af9cd43269eeed3d..8a545d54e2d3f4b795167ebf350a808fcee11ec0 100644 (file)
@@ -173,8 +173,7 @@ static int tmu_timer_init(void)
 
        tmu_timer_stop();
 
-#if !defined(CONFIG_CPU_SUBTYPE_SH7300) && \
-    !defined(CONFIG_CPU_SUBTYPE_SH7760) && \
+#if !defined(CONFIG_CPU_SUBTYPE_SH7760) && \
     !defined(CONFIG_CPU_SUBTYPE_SH7785) && \
     !defined(CONFIG_CPU_SUBTYPE_SHX3)
        ctrl_outb(TMU_TOCR_INIT, TMU_TOCR);
index 502d43e4785c200bf557bdcca552caaa7df5273a..67015044d74a935f75bff8c86e58dce737faeaf0 100644 (file)
@@ -854,9 +854,14 @@ void __init trap_init(void)
        set_exception_table_evt(0x800, do_reserved_inst);
        set_exception_table_evt(0x820, do_illegal_slot_inst);
 #elif defined(CONFIG_SH_FPU)
+#ifdef CONFIG_CPU_SUBTYPE_SHX3
+       set_exception_table_evt(0xd80, do_fpu_state_restore);
+       set_exception_table_evt(0xda0, do_fpu_state_restore);
+#else
        set_exception_table_evt(0x800, do_fpu_state_restore);
        set_exception_table_evt(0x820, do_fpu_state_restore);
 #endif
+#endif
 
 #ifdef CONFIG_CPU_SH2
        set_exception_table_vec(TRAP_ADDRESS_ERROR, address_error_handler);
index 2aa9438361bcb99a75ac7369dd0c1c2ea8ba5997..95f4de0800ec71ceaf167d7801168d5011d95d4e 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/module.h>
 #include <linux/elf.h>
 #include <linux/sched.h>
+#include <linux/err.h>
 
 /*
  * Should the kernel map a VDSO page into processes and pass its
index 70da1c8d407e87c73ffe415a27ffa6206cc884da..43f3972a5fb97264736ffb6c21cb0937529b9d78 100644 (file)
@@ -27,6 +27,7 @@ config CPU_SH4A
 config CPU_SH4AL_DSP
        bool
        select CPU_SH4A
+       select CPU_HAS_DSP
 
 config CPU_SUBTYPE_ST40
        bool
@@ -62,15 +63,10 @@ config CPU_SUBTYPE_SH7206
 
 # SH-3 Processor Support
 
-config CPU_SUBTYPE_SH7300
-       bool "Support SH7300 processor"
-       select CPU_SH3
-
 config CPU_SUBTYPE_SH7705
        bool "Support SH7705 processor"
        select CPU_SH3
        select CPU_HAS_IPR_IRQ
-       select CPU_HAS_PINT_IRQ
 
 config CPU_SUBTYPE_SH7706
        bool "Support SH7706 processor"
@@ -82,7 +78,6 @@ config CPU_SUBTYPE_SH7706
 config CPU_SUBTYPE_SH7707
        bool "Support SH7707 processor"
        select CPU_SH3
-       select CPU_HAS_PINT_IRQ
        help
          Select SH7707 if you have a  60 Mhz SH-3 HD6417707 CPU.
 
@@ -97,7 +92,6 @@ config CPU_SUBTYPE_SH7709
        bool "Support SH7709 processor"
        select CPU_SH3
        select CPU_HAS_IPR_IRQ
-       select CPU_HAS_PINT_IRQ
        help
          Select SH7709 if you have a  80 Mhz SH-3 HD6417709 CPU.
 
@@ -105,6 +99,7 @@ config CPU_SUBTYPE_SH7710
        bool "Support SH7710 processor"
        select CPU_SH3
        select CPU_HAS_IPR_IRQ
+       select CPU_HAS_DSP
        help
          Select SH7710 if you have a SH3-DSP SH7710 CPU.
 
@@ -112,6 +107,7 @@ config CPU_SUBTYPE_SH7712
        bool "Support SH7712 processor"
        select CPU_SH3
        select CPU_HAS_IPR_IRQ
+       select CPU_HAS_DSP
        help
          Select SH7712 if you have a SH3-DSP SH7712 CPU.
 
@@ -205,10 +201,6 @@ config CPU_SUBTYPE_SHX3
 
 # SH4AL-DSP Processor Support
 
-config CPU_SUBTYPE_SH73180
-       bool "Support SH73180 processor"
-       select CPU_SH4AL_DSP
-
 config CPU_SUBTYPE_SH7343
        bool "Support SH7343 processor"
        select CPU_SH4AL_DSP
index d677d7f3afc1d03e892eb2959f9130a71706a07c..4061e89d84d09fff645297747e28482f5364a76b 100644 (file)
@@ -8,7 +8,9 @@ obj-$(CONFIG_CPU_SH2)   += cache-sh2.o
 obj-$(CONFIG_CPU_SH3)  += cache-sh3.o
 obj-$(CONFIG_CPU_SH4)  += cache-sh4.o
 
-mmu-y                  := fault-nommu.o tlb-nommu.o pg-nommu.o
+mmu-y                  := tlb-nommu.o pg-nommu.o
+mmu-$(CONFIG_CPU_SH3)  += fault-nommu.o
+mmu-$(CONFIG_CPU_SH4)  += fault-nommu.o
 mmu-$(CONFIG_MMU)      := fault.o clear_page.o copy_page.o tlb-flush.o \
                           ioremap.o
 
index 981b04089055cf9fc0987eb3a0f83d38f98346d1..86486326ef1d5fbc465d47b6542c867edb688fa2 100644 (file)
@@ -77,16 +77,8 @@ static void __init emit_cache_params(void)
 /*
  * SH-4 has virtually indexed and physically tagged cache.
  */
-
-/* Worst case assumed to be 64k cache, direct-mapped i.e. 4 synonym bits. */
-#define MAX_P3_MUTEXES 16
-
-struct mutex p3map_mutex[MAX_P3_MUTEXES];
-
 void __init p3_cache_init(void)
 {
-       int i;
-
        compute_alias(&current_cpu_data.icache);
        compute_alias(&current_cpu_data.dcache);
 
@@ -106,12 +98,6 @@ void __init p3_cache_init(void)
        }
 
        emit_cache_params();
-
-       if (ioremap_page_range(P3SEG, P3SEG + (PAGE_SIZE * 4), 0, PAGE_KERNEL))
-               panic("%s failed.", __FUNCTION__);
-
-       for (i = 0; i < current_cpu_data.dcache.n_aliases; i++)
-               mutex_init(&p3map_mutex[i]);
 }
 
 /*
index 923cb456819b0ceb79f3c66139602a45ae4f8232..c6f5b51ec2c744b7ef941f8eaa2a36a2a673a3c3 100644 (file)
@@ -1,47 +1,33 @@
-/* 
+/*
  * arch/sh/mm/fault-nommu.c
  *
- * Copyright (C) 2002 Paul Mundt
+ * Copyright (C) 2002 - 2007 Paul Mundt
  *
  * Based on linux/arch/sh/mm/fault.c:
  *  Copyright (C) 1999  Niibe Yutaka
  *
  * Released under the terms of the GNU GPL v2.0.
  */
-
-#include <linux/signal.h>
-#include <linux/sched.h>
 #include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/types.h>
-#include <linux/ptrace.h>
-#include <linux/mman.h>
 #include <linux/mm.h>
-#include <linux/smp.h>
-#include <linux/interrupt.h>
-
+#include <linux/hardirq.h>
+#include <linux/kprobes.h>
 #include <asm/system.h>
-#include <asm/io.h>
-#include <asm/uaccess.h>
-#include <asm/pgalloc.h>
-#include <asm/mmu_context.h>
-#include <asm/cacheflush.h>
-
-#if defined(CONFIG_SH_KGDB)
+#include <asm/ptrace.h>
 #include <asm/kgdb.h>
-#endif
-
-extern void die(const char *,struct pt_regs *,long);
 
 /*
  * This routine handles page faults.  It determines the address,
  * and the problem, and then passes it off to one of the appropriate
  * routines.
  */
-asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
-                             unsigned long address)
+asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
+                                       unsigned long writeaccess,
+                                       unsigned long address)
 {
+       trace_hardirqs_on();
+       local_irq_enable();
+
 #if defined(CONFIG_SH_KGDB)
        if (kgdb_nofault && kgdb_bus_err_hook)
                kgdb_bus_err_hook();
@@ -65,17 +51,14 @@ asmlinkage void do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
        do_exit(SIGKILL);
 }
 
-asmlinkage int __do_page_fault(struct pt_regs *regs, unsigned long writeaccess,
-                              unsigned long address)
+asmlinkage int __kprobes __do_page_fault(struct pt_regs *regs,
+                                        unsigned long writeaccess,
+                                        unsigned long address)
 {
 #if defined(CONFIG_SH_KGDB)
        if (kgdb_nofault && kgdb_bus_err_hook)
                kgdb_bus_err_hook();
 #endif
 
-       if (address >= TASK_SIZE)
-               return 1;
-
-       return 0;
+       return (address >= TASK_SIZE);
 }
-
index 964c6767dc737e0dd0cd3ff361efa8e5415d8715..04a39aa7f1f97029a8c182b93077c9f2a7a67e57 100644 (file)
@@ -184,8 +184,7 @@ no_context:
                printk(KERN_ALERT "pc = %08lx\n", regs->pc);
                page = (unsigned long)get_TTB();
                if (page) {
-                       page = ((__typeof__(page) *) __va(page))[address >>
-                                                                PGDIR_SHIFT];
+                       page = ((__typeof__(page) *)page)[address >> PGDIR_SHIFT];
                        printk(KERN_ALERT "*pde = %08lx\n", page);
                        if (page & _PAGE_PRESENT) {
                                page &= PAGE_MASK;
index df69da9ca69c7685e48a709924e58c175836ebe3..25f5c6f6821def36b1f796a66bb969f62044daa3 100644 (file)
@@ -2,19 +2,45 @@
  * arch/sh/mm/pg-sh4.c
  *
  * Copyright (C) 1999, 2000, 2002  Niibe Yutaka
- * Copyright (C) 2002 - 2005  Paul Mundt
+ * Copyright (C) 2002 - 2007  Paul Mundt
  *
  * Released under the terms of the GNU GPL v2.0.
  */
 #include <linux/mm.h>
 #include <linux/mutex.h>
+#include <linux/fs.h>
 #include <asm/mmu_context.h>
 #include <asm/cacheflush.h>
 
-extern struct mutex p3map_mutex[];
-
 #define CACHE_ALIAS (current_cpu_data.dcache.alias_mask)
 
+static inline void *kmap_coherent(struct page *page, unsigned long addr)
+{
+       enum fixed_addresses idx;
+       unsigned long vaddr, flags;
+       pte_t pte;
+
+       inc_preempt_count();
+
+       idx = (addr & current_cpu_data.dcache.alias_mask) >> PAGE_SHIFT;
+       vaddr = __fix_to_virt(FIX_CMAP_END - idx);
+       pte = mk_pte(page, PAGE_KERNEL);
+
+       local_irq_save(flags);
+       flush_tlb_one(get_asid(), vaddr);
+       local_irq_restore(flags);
+
+       update_mmu_cache(NULL, vaddr, pte);
+
+       return (void *)vaddr;
+}
+
+static inline void kunmap_coherent(struct page *page)
+{
+       dec_preempt_count();
+       preempt_check_resched();
+}
+
 /*
  * clear_user_page
  * @to: P1 address
@@ -27,25 +53,9 @@ void clear_user_page(void *to, unsigned long address, struct page *page)
        if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
                clear_page(to);
        else {
-               unsigned long phys_addr = PHYSADDR(to);
-               unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS);
-               pgd_t *pgd = pgd_offset_k(p3_addr);
-               pud_t *pud = pud_offset(pgd, p3_addr);
-               pmd_t *pmd = pmd_offset(pud, p3_addr);
-               pte_t *pte = pte_offset_kernel(pmd, p3_addr);
-               pte_t entry;
-               unsigned long flags;
-
-               entry = pfn_pte(phys_addr >> PAGE_SHIFT, PAGE_KERNEL);
-               mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
-               set_pte(pte, entry);
-               local_irq_save(flags);
-               flush_tlb_one(get_asid(), p3_addr);
-               local_irq_restore(flags);
-               update_mmu_cache(NULL, p3_addr, entry);
-               __clear_user_page((void *)p3_addr, to);
-               pte_clear(&init_mm, p3_addr, pte);
-               mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
+               void *vto = kmap_coherent(page, address);
+               __clear_user_page(vto, to);
+               kunmap_coherent(vto);
        }
 }
 
@@ -63,25 +73,9 @@ void copy_user_page(void *to, void *from, unsigned long address,
        if (((address ^ (unsigned long)to) & CACHE_ALIAS) == 0)
                copy_page(to, from);
        else {
-               unsigned long phys_addr = PHYSADDR(to);
-               unsigned long p3_addr = P3SEG + (address & CACHE_ALIAS);
-               pgd_t *pgd = pgd_offset_k(p3_addr);
-               pud_t *pud = pud_offset(pgd, p3_addr);
-               pmd_t *pmd = pmd_offset(pud, p3_addr);
-               pte_t *pte = pte_offset_kernel(pmd, p3_addr);
-               pte_t entry;
-               unsigned long flags;
-
-               entry = pfn_pte(phys_addr >> PAGE_SHIFT, PAGE_KERNEL);
-               mutex_lock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
-               set_pte(pte, entry);
-               local_irq_save(flags);
-               flush_tlb_one(get_asid(), p3_addr);
-               local_irq_restore(flags);
-               update_mmu_cache(NULL, p3_addr, entry);
-               __copy_user_page((void *)p3_addr, from, to);
-               pte_clear(&init_mm, p3_addr, pte);
-               mutex_unlock(&p3map_mutex[(address & CACHE_ALIAS)>>12]);
+               void *vfrom = kmap_coherent(page, address);
+               __copy_user_page(vfrom, from, to);
+               kunmap_coherent(vfrom);
        }
 }
 
index 4b5e9305092eaf32494c5ecaf477c64ce35782dd..439bfe3d29af6a5362e4172c3826035b0d74fb22 100644 (file)
@@ -8,12 +8,10 @@
 SE                     SH_SOLUTION_ENGINE
 7751SE                 SH_7751_SOLUTION_ENGINE         
 7722SE                 SH_7722_SOLUTION_ENGINE         
-7300SE                 SH_7300_SOLUTION_ENGINE
 7343SE                 SH_7343_SOLUTION_ENGINE
 7206SE                 SH_7206_SOLUTION_ENGINE
 7619SE                 SH_7619_SOLUTION_ENGINE
 7780SE                 SH_7780_SOLUTION_ENGINE
-73180SE                        SH_73180_SOLUTION_ENGINE
 7751SYSTEMH            SH_7751_SYSTEMH
 HP6XX                  SH_HP6XX
 HD64461                        HD64461
index ff654204b7d489343855e32ec297dc6e47f02605..5664631d8ae5af2ae76d6091e9d4d6bb1459134a 100644 (file)
@@ -47,6 +47,9 @@ config ARCH_HAS_ILOG2_U64
        bool
        default n
 
+config ARCH_NO_VIRT_TO_BUS
+       def_bool y
+
 source init/Kconfig
 
 menu "System type"
index de2d07db1f88362fe1a17a48e40918daab43bd00..deee8bfd3270a88d65344d1fcb608ddd638b708b 100644 (file)
@@ -14,7 +14,7 @@
 #include <linux/sched.h>
 #include <linux/init_task.h>
 #include <linux/mqueue.h>
-
+#include <linux/fs.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
 
index 42c07d2e71d932cce95538fb1edae1cd30e8b035..3b63a93198f24fd8919a88d974818c96c645de74 100644 (file)
@@ -16,6 +16,7 @@
  */
 
 #include <linux/init.h>
+#include <linux/interrupt.h>
 #include <linux/irq.h>
 #include <linux/kernel.h>
 #include <linux/stddef.h>
index a36c3d71a3fe1339f567eb6bde200df497d31d8a..a9328f894755f57069cad1f6a73479686deae1e8 100644 (file)
@@ -30,7 +30,7 @@ void *consistent_alloc(struct pci_dev *hwdev, size_t size,
 
        if (vp != NULL) {
                memset(vp, 0, size);
-               *dma_handle = virt_to_bus(ret);
+               *dma_handle = virt_to_phys(ret);
                dma_cache_wback_inv((unsigned long)ret, size);
        }
 
@@ -42,7 +42,7 @@ void consistent_free(struct pci_dev *hwdev, size_t size,
 {
        void *alloc;
 
-       alloc = bus_to_virt((unsigned long)dma_handle);
+       alloc = phys_to_virt((unsigned long)dma_handle);
        free_pages((unsigned long)alloc, get_order(size));
 
        iounmap(vaddr);
index 1b89c9dfb93deb71e854d4a0fc43c39b412007c8..ceb9458abda4bdec2415eda4925dcd618a33c32b 100644 (file)
@@ -21,6 +21,7 @@
  * This file handles the architecture-dependent parts of process handling..
  */
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/ptrace.h>
 #include <linux/reboot.h>
 #include <linux/init.h>
index 19126daf9f4c86f7f5521c82fecc935eb4d9dbd0..b7f18e298a208e9a6b593200aa7c8d72f928eda0 100644 (file)
@@ -19,6 +19,7 @@
 #include <linux/rwsem.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index 4310fc87444e9e703ef7fe0ef4f9b3838fc0ecdb..97816e0baf19ed41280b63343f0424a33ee0fb48 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/kernel.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <asm/mmu_context.h>
 
 typedef u64 regType_t;
index fdc67238408aaeed2822d129be55e7d2c9cade83..f7a509149199f06a46f3d3b4860ca4dc9c92feb9 100644 (file)
@@ -1,12 +1,14 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.22-rc1
-# Mon May 14 03:25:14 2007
+# Linux kernel version: 2.6.23-rc1
+# Wed Jul 25 15:30:21 2007
 #
 CONFIG_MMU=y
 CONFIG_HIGHMEM=y
 CONFIG_ZONE_DMA=y
 CONFIG_GENERIC_ISA_DMA=y
+CONFIG_ARCH_NO_VIRT_TO_BUS=y
+CONFIG_OF=y
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
 #
@@ -23,12 +25,11 @@ CONFIG_LOCALVERSION=""
 CONFIG_LOCALVERSION_AUTO=y
 CONFIG_SWAP=y
 CONFIG_SYSVIPC=y
-# CONFIG_IPC_NS is not set
 CONFIG_SYSVIPC_SYSCTL=y
 CONFIG_POSIX_MQUEUE=y
 # CONFIG_BSD_PROCESS_ACCT is not set
 # CONFIG_TASKSTATS is not set
-# CONFIG_UTS_NS is not set
+# CONFIG_USER_NS is not set
 # CONFIG_AUDIT is not set
 # CONFIG_IKCONFIG is not set
 CONFIG_LOG_BUF_SHIFT=14
@@ -63,24 +64,17 @@ CONFIG_SLAB=y
 CONFIG_RT_MUTEXES=y
 # CONFIG_TINY_SHMEM is not set
 CONFIG_BASE_SMALL=0
-
-#
-# Loadable module support
-#
 CONFIG_MODULES=y
 CONFIG_MODULE_UNLOAD=y
 # CONFIG_MODULE_FORCE_UNLOAD is not set
 # CONFIG_MODVERSIONS is not set
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
-
-#
-# Block layer
-#
 CONFIG_BLOCK=y
 # CONFIG_LBD is not set
 # CONFIG_BLK_DEV_IO_TRACE is not set
 # CONFIG_LSF is not set
+# CONFIG_BLK_DEV_BSG is not set
 
 #
 # IO Schedulers
@@ -113,11 +107,14 @@ CONFIG_GENERIC_CALIBRATE_DELAY=y
 CONFIG_ARCH_MAY_HAVE_PC_FDC=y
 # CONFIG_ARCH_HAS_ILOG2_U32 is not set
 # CONFIG_ARCH_HAS_ILOG2_U64 is not set
+CONFIG_EMULATED_CMPXCHG=y
 CONFIG_SUN_PM=y
 # CONFIG_SUN4 is not set
 CONFIG_PCI=y
+CONFIG_PCI_SYSCALL=y
 # CONFIG_ARCH_SUPPORTS_MSI is not set
 # CONFIG_PCI_DEBUG is not set
+# CONFIG_NO_DMA is not set
 CONFIG_SUN_OPENPROMFS=m
 # CONFIG_SPARC_LED is not set
 CONFIG_BINFMT_ELF=y
@@ -134,6 +131,7 @@ CONFIG_FLAT_NODE_MEM_MAP=y
 CONFIG_SPLIT_PTLOCK_CPUS=4
 # CONFIG_RESOURCES_64BIT is not set
 CONFIG_ZONE_DMA_FLAG=1
+CONFIG_BOUNCE=y
 
 #
 # Networking
@@ -197,25 +195,13 @@ CONFIG_IPV6_TUNNEL=m
 # CONFIG_IPV6_MULTIPLE_TABLES is not set
 # CONFIG_NETWORK_SECMARK is not set
 # CONFIG_NETFILTER is not set
-
-#
-# DCCP Configuration (EXPERIMENTAL)
-#
 # CONFIG_IP_DCCP is not set
-
-#
-# SCTP Configuration (EXPERIMENTAL)
-#
 CONFIG_IP_SCTP=m
 # CONFIG_SCTP_DBG_MSG is not set
 CONFIG_SCTP_DBG_OBJCNT=y
 # CONFIG_SCTP_HMAC_NONE is not set
 # CONFIG_SCTP_HMAC_SHA1 is not set
 CONFIG_SCTP_HMAC_MD5=y
-
-#
-# TIPC Configuration (EXPERIMENTAL)
-#
 # CONFIG_TIPC is not set
 # CONFIG_ATM is not set
 # CONFIG_BRIDGE is not set
@@ -253,6 +239,7 @@ CONFIG_AF_RXRPC=m
 # CONFIG_MAC80211 is not set
 # CONFIG_IEEE80211 is not set
 # CONFIG_RFKILL is not set
+# CONFIG_NET_9P is not set
 
 #
 # Device Drivers
@@ -267,28 +254,12 @@ CONFIG_PREVENT_FIRMWARE_BUILD=y
 # CONFIG_DEBUG_DRIVER is not set
 # CONFIG_DEBUG_DEVRES is not set
 # CONFIG_SYS_HYPERVISOR is not set
-
-#
-# Connector - unified userspace <-> kernelspace linker
-#
 # CONFIG_CONNECTOR is not set
 # CONFIG_MTD is not set
-
-#
-# Parallel port support
-#
+CONFIG_OF_DEVICE=y
 # CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-# CONFIG_PNPACPI is not set
-
-#
-# Block devices
-#
+CONFIG_BLK_DEV=y
 # CONFIG_BLK_DEV_FD is not set
-# CONFIG_BLK_CPQ_DA is not set
 # CONFIG_BLK_CPQ_CISS_DA is not set
 # CONFIG_BLK_DEV_DAC960 is not set
 # CONFIG_BLK_DEV_UMEM is not set
@@ -303,18 +274,11 @@ CONFIG_BLK_DEV_RAM_SIZE=4096
 CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 # CONFIG_CDROM_PKTCDVD is not set
 # CONFIG_ATA_OVER_ETH is not set
-
-#
-# Misc devices
-#
+CONFIG_MISC_DEVICES=y
 # CONFIG_PHANTOM is not set
+# CONFIG_EEPROM_93CX6 is not set
 # CONFIG_SGI_IOC4 is not set
 # CONFIG_TIFM_CORE is not set
-# CONFIG_BLINK is not set
-
-#
-# ATA/ATAPI/MFM/RLL support
-#
 # CONFIG_IDE is not set
 
 #
@@ -322,6 +286,7 @@ CONFIG_BLK_DEV_RAM_BLOCKSIZE=1024
 #
 # CONFIG_RAID_ATTRS is not set
 CONFIG_SCSI=y
+CONFIG_SCSI_DMA=y
 # CONFIG_SCSI_TGT is not set
 # CONFIG_SCSI_NETLINK is not set
 CONFIG_SCSI_PROC_FS=y
@@ -352,12 +317,8 @@ CONFIG_SCSI_WAIT_SCAN=m
 CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_SCSI_FC_ATTRS is not set
 # CONFIG_SCSI_ISCSI_ATTRS is not set
-# CONFIG_SCSI_SAS_ATTRS is not set
 # CONFIG_SCSI_SAS_LIBSAS is not set
-
-#
-# SCSI low-level drivers
-#
+CONFIG_SCSI_LOWLEVEL=y
 # CONFIG_ISCSI_TCP is not set
 # CONFIG_BLK_DEV_3W_XXXX_RAID is not set
 # CONFIG_SCSI_3W_9XXX is not set
@@ -367,7 +328,6 @@ CONFIG_SCSI_SPI_ATTRS=y
 # CONFIG_SCSI_AIC7XXX_OLD is not set
 # CONFIG_SCSI_AIC79XX is not set
 # CONFIG_SCSI_AIC94XX is not set
-# CONFIG_SCSI_DPT_I2O is not set
 # CONFIG_SCSI_ARCMSR is not set
 # CONFIG_MEGARAID_NEWGEN is not set
 # CONFIG_MEGARAID_LEGACY is not set
@@ -389,14 +349,9 @@ CONFIG_SCSI_QLOGICPTI=m
 # CONFIG_SCSI_DC390T is not set
 # CONFIG_SCSI_NSP32 is not set
 # CONFIG_SCSI_DEBUG is not set
-CONFIG_SCSI_ESP_CORE=y
 CONFIG_SCSI_SUNESP=y
 # CONFIG_SCSI_SRP is not set
 # CONFIG_ATA is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
 # CONFIG_MD is not set
 
 #
@@ -412,30 +367,16 @@ CONFIG_SCSI_SUNESP=y
 #
 # CONFIG_FIREWIRE is not set
 # CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
 # CONFIG_I2O is not set
-
-#
-# Network device support
-#
 CONFIG_NETDEVICES=y
+# CONFIG_NETDEVICES_MULTIQUEUE is not set
 CONFIG_DUMMY=m
 # CONFIG_BONDING is not set
+# CONFIG_MACVLAN is not set
 # CONFIG_EQUALIZER is not set
 CONFIG_TUN=m
-
-#
-# ARCnet devices
-#
 # CONFIG_ARCNET is not set
 # CONFIG_PHYLIB is not set
-
-#
-# Ethernet (10 or 100Mbit)
-#
 CONFIG_NET_ETHERNET=y
 CONFIG_MII=m
 CONFIG_SUNLANCE=y
@@ -445,10 +386,6 @@ CONFIG_SUNQE=m
 # CONFIG_SUNGEM is not set
 # CONFIG_CASSINI is not set
 # CONFIG_NET_VENDOR_3COM is not set
-
-#
-# Tulip family network device support
-#
 # CONFIG_NET_TULIP is not set
 # CONFIG_HP100 is not set
 # CONFIG_NET_PCI is not set
@@ -464,7 +401,7 @@ CONFIG_NETDEV_1000=y
 # 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 is not set
 # CONFIG_BNX2 is not set
 # CONFIG_QLA3XXX is not set
@@ -477,11 +414,6 @@ CONFIG_NETDEV_10000=y
 # CONFIG_MYRI10GE is not set
 # CONFIG_NETXEN_NIC is not set
 # CONFIG_MLX4_CORE is not set
-CONFIG_MLX4_DEBUG=y
-
-#
-# Token Ring devices
-#
 # CONFIG_TR is not set
 
 #
@@ -499,15 +431,7 @@ CONFIG_MLX4_DEBUG=y
 # CONFIG_NETCONSOLE is not set
 # CONFIG_NETPOLL is not set
 # CONFIG_NET_POLL_CONTROLLER is not set
-
-#
-# ISDN subsystem
-#
 # CONFIG_ISDN is not set
-
-#
-# Telephony Support
-#
 # CONFIG_PHONE is not set
 
 #
@@ -515,6 +439,7 @@ CONFIG_MLX4_DEBUG=y
 #
 CONFIG_INPUT=y
 # CONFIG_INPUT_FF_MEMLESS is not set
+# CONFIG_INPUT_POLLDEV is not set
 
 #
 # Userland interfaces
@@ -593,22 +518,13 @@ CONFIG_SERIAL_CORE_CONSOLE=y
 CONFIG_UNIX98_PTYS=y
 CONFIG_LEGACY_PTYS=y
 CONFIG_LEGACY_PTY_COUNT=256
-
-#
-# IPMI
-#
 # CONFIG_IPMI_HANDLER is not set
 # CONFIG_WATCHDOG is not set
 CONFIG_HW_RANDOM=m
 CONFIG_JS_RTC=m
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-# CONFIG_DRM is not set
 # CONFIG_RAW_DRIVER is not set
-
-#
-# TPM devices
-#
 # CONFIG_TCG_TPM is not set
 CONFIG_DEVPORT=y
 # CONFIG_I2C is not set
@@ -618,20 +534,24 @@ CONFIG_DEVPORT=y
 #
 # CONFIG_SPI is not set
 # CONFIG_SPI_MASTER is not set
-
-#
-# Dallas's 1-wire bus
-#
 # CONFIG_W1 is not set
+# CONFIG_POWER_SUPPLY is not set
 CONFIG_HWMON=y
 # CONFIG_HWMON_VID is not set
 # CONFIG_SENSORS_ABITUGURU is not set
+# CONFIG_SENSORS_ABITUGURU3 is not set
 # CONFIG_SENSORS_F71805F is not set
+# CONFIG_SENSORS_IT87 is not set
+# CONFIG_SENSORS_PC87360 is not set
 # CONFIG_SENSORS_PC87427 is not set
+# CONFIG_SENSORS_SIS5595 is not set
 # CONFIG_SENSORS_SMSC47M1 is not set
 # CONFIG_SENSORS_SMSC47B397 is not set
+# CONFIG_SENSORS_VIA686A is not set
 # CONFIG_SENSORS_VT1211 is not set
+# CONFIG_SENSORS_VT8231 is not set
 # CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
 # CONFIG_HWMON_DEBUG_CHIP is not set
 
 #
@@ -656,6 +576,7 @@ CONFIG_HWMON=y
 #
 # CONFIG_DISPLAY_SUPPORT is not set
 # CONFIG_VGASTATE is not set
+# CONFIG_VIDEO_OUTPUT_CONTROL is not set
 # CONFIG_FB is not set
 
 #
@@ -668,16 +589,10 @@ CONFIG_DUMMY_CONSOLE=y
 # Sound
 #
 # CONFIG_SOUND is not set
-
-#
-# HID Devices
-#
+CONFIG_HID_SUPPORT=y
 CONFIG_HID=y
 # CONFIG_HID_DEBUG is not set
-
-#
-# USB support
-#
+CONFIG_USB_SUPPORT=y
 CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 CONFIG_USB_ARCH_HAS_EHCI=y
@@ -692,29 +607,9 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 #
 # CONFIG_USB_GADGET is not set
 # CONFIG_MMC is not set
-
-#
-# LED devices
-#
 # CONFIG_NEW_LEDS is not set
-
-#
-# LED drivers
-#
-
-#
-# LED Triggers
-#
-
-#
-# InfiniBand support
-#
 # CONFIG_INFINIBAND is not set
 
-#
-# EDAC - error detection and reporting (RAS) (EXPERIMENTAL)
-#
-
 #
 # Real Time Clock
 #
@@ -733,6 +628,11 @@ CONFIG_USB_ARCH_HAS_EHCI=y
 # DMA Devices
 #
 
+#
+# Userspace I/O
+#
+# CONFIG_UIO is not set
+
 #
 # Misc Linux/SPARC drivers
 #
@@ -853,7 +753,6 @@ CONFIG_CIFS=m
 # CONFIG_CODA_FS is not set
 CONFIG_AFS_FS=m
 # CONFIG_AFS_DEBUG is not set
-# CONFIG_9P_FS is not set
 
 #
 # Partition Types
@@ -927,6 +826,7 @@ CONFIG_MAGIC_SYSRQ=y
 # CONFIG_HEADERS_CHECK is not set
 CONFIG_DEBUG_KERNEL=y
 CONFIG_DETECT_SOFTLOCKUP=y
+# CONFIG_SCHED_DEBUG is not set
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_TIMER_STATS is not set
 # CONFIG_DEBUG_SLAB is not set
@@ -953,10 +853,6 @@ CONFIG_FORCED_INLINING=y
 CONFIG_KEYS=y
 # CONFIG_KEYS_DEBUG_PROC_KEYS is not set
 # CONFIG_SECURITY is not set
-
-#
-# Cryptographic options
-#
 CONFIG_CRYPTO=y
 CONFIG_CRYPTO_ALGAPI=y
 CONFIG_CRYPTO_BLKCIPHER=y
@@ -996,10 +892,7 @@ CONFIG_CRYPTO_MICHAEL_MIC=m
 CONFIG_CRYPTO_CRC32C=m
 # CONFIG_CRYPTO_CAMELLIA is not set
 # CONFIG_CRYPTO_TEST is not set
-
-#
-# Hardware crypto devices
-#
+# CONFIG_CRYPTO_HW is not set
 
 #
 # Library routines
@@ -1009,6 +902,7 @@ CONFIG_BITREVERSE=y
 # CONFIG_CRC16 is not set
 # CONFIG_CRC_ITU_T is not set
 CONFIG_CRC32=y
+# CONFIG_CRC7 is not set
 CONFIG_LIBCRC32C=m
 CONFIG_ZLIB_INFLATE=y
 CONFIG_ZLIB_DEFLATE=y
index eac38388f5fd354bf35681e97534ba14368a27e5..88d2cefd01bee1bc25d9f8ae85413bd80dc38a17 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: entry.S,v 1.170 2001/11/13 00:57:05 davem Exp $
- * arch/sparc/kernel/entry.S:  Sparc trap low-level entry points.
+/* arch/sparc/kernel/entry.S:  Sparc trap low-level entry points.
  *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
  * Copyright (C) 1996 Eddie C. Dost   (ecd@skynet.be)
  * Copyright (C) 1996 Miguel de Icaza (miguel@nuclecu.unam.mx)
  * Copyright (C) 1996-1999 Jakub Jelinek   (jj@sunsite.mff.cuni.cz)
@@ -129,7 +128,7 @@ trap_low:
        RESTORE_ALL
 #endif
 
-#ifdef CONFIG_BLK_DEV_FD
+#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
        .text
        .align  4
        .globl  floppy_hardint
index fc31de66b1c227f68c945715f6f5e7673f594379..d9d4f96360c7bff691836f3683d7fce954b5311f 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
index 75b2240ad0f9efe1bd73290a3ed076a700de0186..b76dc03fc3187fa50c6d80213bc8609e28fc72a3 100644 (file)
@@ -351,34 +351,14 @@ void handler_irq(int irq, struct pt_regs * regs)
        set_irq_regs(old_regs);
 }
 
-#ifdef CONFIG_BLK_DEV_FD
-extern void floppy_interrupt(int irq, void *dev_id);
-
-void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
-{
-       struct pt_regs *old_regs;
-       int cpu = smp_processor_id();
-
-       old_regs = set_irq_regs(regs);
-       disable_pil_irq(irq);
-       irq_enter();
-       kstat_cpu(cpu).irqs[irq]++;
-       floppy_interrupt(irq, dev_id);
-       irq_exit();
-       enable_pil_irq(irq);
-       set_irq_regs(old_regs);
-       // XXX Eek, it's totally changed with preempt_count() and such
-       // if (softirq_pending(cpu))
-       //      do_softirq();
-}
-#endif
+#if defined(CONFIG_BLK_DEV_FD) || defined(CONFIG_BLK_DEV_FD_MODULE)
 
 /* Fast IRQs on the Sparc can only have one routine attached to them,
  * thus no sharing possible.
  */
-int request_fast_irq(unsigned int irq,
-                    irq_handler_t handler,
-                    unsigned long irqflags, const char *devname)
+static int request_fast_irq(unsigned int irq,
+                           void (*handler)(void),
+                           unsigned long irqflags, const char *devname)
 {
        struct irqaction *action;
        unsigned long flags;
@@ -457,7 +437,6 @@ int request_fast_irq(unsigned int irq,
         */
        flush_cache_all();
 
-       action->handler = handler;
        action->flags = irqflags;
        cpus_clear(action->mask);
        action->name = devname;
@@ -475,6 +454,61 @@ out:
        return ret;
 }
 
+/* These variables are used to access state from the assembler
+ * interrupt handler, floppy_hardint, so we cannot put these in
+ * the floppy driver image because that would not work in the
+ * modular case.
+ */
+volatile unsigned char *fdc_status;
+EXPORT_SYMBOL(fdc_status);
+
+char *pdma_vaddr;
+EXPORT_SYMBOL(pdma_vaddr);
+
+unsigned long pdma_size;
+EXPORT_SYMBOL(pdma_size);
+
+volatile int doing_pdma;
+EXPORT_SYMBOL(doing_pdma);
+
+char *pdma_base;
+EXPORT_SYMBOL(pdma_base);
+
+unsigned long pdma_areasize;
+EXPORT_SYMBOL(pdma_areasize);
+
+extern void floppy_hardint(void);
+
+static irqreturn_t (*floppy_irq_handler)(int irq, void *dev_id);
+
+void sparc_floppy_irq(int irq, void *dev_id, struct pt_regs *regs)
+{
+       struct pt_regs *old_regs;
+       int cpu = smp_processor_id();
+
+       old_regs = set_irq_regs(regs);
+       disable_pil_irq(irq);
+       irq_enter();
+       kstat_cpu(cpu).irqs[irq]++;
+       floppy_irq_handler(irq, dev_id);
+       irq_exit();
+       enable_pil_irq(irq);
+       set_irq_regs(old_regs);
+       // XXX Eek, it's totally changed with preempt_count() and such
+       // if (softirq_pending(cpu))
+       //      do_softirq();
+}
+
+int sparc_floppy_request_irq(int irq, unsigned long flags,
+                            irqreturn_t (*irq_handler)(int irq, void *))
+{
+       floppy_irq_handler = irq_handler;
+       return request_fast_irq(irq, floppy_hardint, flags, "floppy");
+}
+EXPORT_SYMBOL(sparc_floppy_request_irq);
+
+#endif
+
 int request_irq(unsigned int irq,
                irq_handler_t handler,
                unsigned long irqflags, const char * devname, void *dev_id)
index e3a537650db1e8792c0d7a7978b0e52ab3e7fe2e..cd4fb79aa3a8e185f12d8bfcd8ec90960e2a40ff 100644 (file)
@@ -102,6 +102,21 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
 }
 EXPORT_SYMBOL(of_set_property);
 
+int of_find_in_proplist(const char *list, const char *match, int len)
+{
+       while (len > 0) {
+               int l;
+
+               if (!strcmp(list, match))
+                       return 1;
+               l = strlen(list) + 1;
+               list += l;
+               len -= l;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(of_find_in_proplist);
+
 static unsigned int prom_early_allocated;
 
 static void * __init prom_early_alloc(unsigned long size)
@@ -415,7 +430,7 @@ static void __init of_console_init(void)
        unsigned long flags;
        const char *type;
        phandle node;
-       int skip, fd;
+       int skip, tmp, fd;
 
        of_console_path = prom_early_alloc(256);
 
@@ -442,8 +457,9 @@ static void __init of_console_init(void)
                        prom_halt();
                }
 
+               tmp = skip;
                for_each_node_by_type(dp, type) {
-                       if (!skip--)
+                       if (!tmp--)
                                break;
                }
                if (!dp) {
index 7b4abde43028a259282c398bb88b889894ddd734..ef647acc479e4cdc00cf5f3009667454ed47a0fc 100644 (file)
@@ -143,7 +143,6 @@ EXPORT_SYMBOL(mstk48t02_regs);
 EXPORT_SYMBOL(set_auxio);
 EXPORT_SYMBOL(get_auxio);
 #endif
-EXPORT_SYMBOL(request_fast_irq);
 EXPORT_SYMBOL(io_remap_pfn_range);
   /* P3: iounit_xxx may be needed, sun4d users */
 /* EXPORT_SYMBOL(iounit_map_dma_init); */
index a57a366e339ac6cb3796357087ca20c088f90558..79d60d86f6f8785b11dbf09c75bb8ef6ecc5f3ae 100644 (file)
@@ -1999,6 +1999,9 @@ void sun4c_update_mmu_cache(struct vm_area_struct *vma, unsigned long address, p
        unsigned long flags;
        int pseg;
 
+       if (vma->vm_mm->context == NO_CONTEXT)
+               return;
+
        local_irq_save(flags);
        address &= PAGE_MASK;
        if ((pseg = sun4c_get_segmap(address)) == invalid_segment) {
index 1f130f3b6c24affc675d29425e7a21d9e8cd2ef7..a5faa3683bd6142fced745574163df555a63e2f5 100644 (file)
@@ -29,7 +29,7 @@ config DEBUG_BOOTMEM
 
 config DEBUG_PAGEALLOC
        bool "Debug page memory allocations"
-       depends on DEBUG_KERNEL && !SOFTWARE_SUSPEND
+       depends on DEBUG_KERNEL && !HIBERNATION
        help
          Unmap pages from the kernel linear mapping after free_pages().
          This results in a large slowdown, but helps to find certain types
index b66876bf410c489391f20251daa4401843465f9e..40d2f3aae91eb48b3443731a6987f78516279786 100644 (file)
@@ -8,14 +8,14 @@ EXTRA_CFLAGS := -Werror
 extra-y                := head.o init_task.o vmlinux.lds
 
 obj-y          := process.o setup.o cpu.o idprom.o \
-                  traps.o auxio.o una_asm.o sysfs.o \
+                  traps.o auxio.o una_asm.o sysfs.o iommu.o \
                   irq.o ptrace.o time.o sys_sparc.o signal.o \
                   unaligned.o central.o pci.o starfire.o semaphore.o \
                   power.o sbus.o iommu_common.o sparc64_ksyms.o chmc.o \
                   visemul.o prom.o of_device.o hvapi.o sstate.o mdesc.o
 
 obj-$(CONFIG_STACKTRACE) += stacktrace.o
-obj-$(CONFIG_PCI)       += ebus.o isa.o pci_common.o pci_iommu.o \
+obj-$(CONFIG_PCI)       += ebus.o isa.o pci_common.o \
                            pci_psycho.o pci_sabre.o pci_schizo.o \
                            pci_sun4v.o pci_sun4v_asm.o pci_fire.o
 obj-$(CONFIG_SMP)       += smp.o trampoline.o hvtramp.o
index 7eb81d3954d9a96f4cccb078efcd23f38174aacf..e43db73f2b911151b1e0194b5a7595c8945474b9 100644 (file)
@@ -1,7 +1,7 @@
 /* cpu.c: Dinky routines to look for the kind of Sparc cpu
  *        we are on.
  *
- * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net)
  */
 
 #include <linux/kernel.h>
@@ -13,6 +13,7 @@
 #include <asm/fpumacro.h>
 #include <asm/cpudata.h>
 #include <asm/spitfire.h>
+#include <asm/oplib.h>
 
 DEFINE_PER_CPU(cpuinfo_sparc, __cpu_data) = { 0 };
 
@@ -61,21 +62,40 @@ struct cpu_iu_info linux_sparc_chips[] = {
 
 #define NSPARCCHIPS  ARRAY_SIZE(linux_sparc_chips)
 
-char *sparc_cpu_type = "cpu-oops";
-char *sparc_fpu_type = "fpu-oops";
+char *sparc_cpu_type;
+char *sparc_fpu_type;
 
 unsigned int fsr_storage;
 
+static void __init sun4v_cpu_probe(void)
+{
+       switch (sun4v_chip_type) {
+       case SUN4V_CHIP_NIAGARA1:
+               sparc_cpu_type = "UltraSparc T1 (Niagara)";
+               sparc_fpu_type = "UltraSparc T1 integrated FPU";
+               break;
+
+       case SUN4V_CHIP_NIAGARA2:
+               sparc_cpu_type = "UltraSparc T2 (Niagara2)";
+               sparc_fpu_type = "UltraSparc T2 integrated FPU";
+               break;
+
+       default:
+               printk(KERN_WARNING "CPU: Unknown sun4v cpu type [%s]\n",
+                      prom_cpu_compatible);
+               sparc_cpu_type = "Unknown SUN4V CPU";
+               sparc_fpu_type = "Unknown SUN4V FPU";
+               break;
+       }
+}
+
 void __init cpu_probe(void)
 {
        unsigned long ver, fpu_vers, manuf, impl, fprs;
        int i;
        
-       if (tlb_type == hypervisor) {
-               sparc_cpu_type = "UltraSparc T1 (Niagara)";
-               sparc_fpu_type = "UltraSparc T1 integrated FPU";
-               return;
-       }
+       if (tlb_type == hypervisor)
+               return sun4v_cpu_probe();
 
        fprs = fprs_read();
        fprs_write(FPRS_FEF);
index 6d2956179cde796006f767d6529cc80ab0694e73..bc9ae36f7a43cd1de77cf6469762f21fc4ce6bd3 100644 (file)
@@ -391,6 +391,8 @@ static void __init fill_ebus_device(struct device_node *dp, struct linux_ebus_de
        sd = &dev->ofdev.dev.archdata;
        sd->prom_node = dp;
        sd->op = &dev->ofdev;
+       sd->iommu = dev->bus->ofdev.dev.parent->archdata.iommu;
+       sd->stc = dev->bus->ofdev.dev.parent->archdata.stc;
 
        dev->ofdev.node = dp;
        dev->ofdev.dev.parent = &dev->bus->ofdev.dev;
index 9dbd833d79d6296af243cfcca0536e393a5c9155..ac18bd8e273f5badb0df5bcd5d467f5349e50568 100644 (file)
@@ -97,7 +97,8 @@ sparc64_boot:
        .globl  prom_map_name, prom_unmap_name, prom_mmu_ihandle_cache
        .globl  prom_boot_mapped_pc, prom_boot_mapping_mode
        .globl  prom_boot_mapping_phys_high, prom_boot_mapping_phys_low
-       .globl  is_sun4v
+       .globl  prom_compatible_name, prom_cpu_path, prom_cpu_compatible
+       .globl  is_sun4v, sun4v_chip_type
 prom_peer_name:
        .asciz  "peer"
 prom_compatible_name:
@@ -106,6 +107,8 @@ prom_finddev_name:
        .asciz  "finddevice"
 prom_chosen_path:
        .asciz  "/chosen"
+prom_cpu_path:
+       .asciz  "/cpu"
 prom_getprop_name:
        .asciz  "getprop"
 prom_mmu_name:
@@ -120,9 +123,13 @@ prom_unmap_name:
        .asciz  "unmap"
 prom_sun4v_name:
        .asciz  "sun4v"
+prom_niagara_prefix:
+       .asciz  "SUNW,UltraSPARC-T"
        .align  4
 prom_root_compatible:
        .skip   64
+prom_cpu_compatible:
+       .skip   64
 prom_root_node:
        .word   0
 prom_mmu_ihandle_cache:
@@ -138,6 +145,8 @@ prom_boot_mapping_phys_low:
        .xword  0
 is_sun4v:
        .word   0
+sun4v_chip_type:
+       .word   SUN4V_CHIP_INVALID
 1:
        rd      %pc, %l0
 
@@ -296,13 +305,13 @@ is_sun4v:
        sethi   %hi(prom_sun4v_name), %g7
        or      %g7, %lo(prom_sun4v_name), %g7
        mov     5, %g3
-1:     ldub    [%g7], %g2
+90:    ldub    [%g7], %g2
        ldub    [%g1], %g4
        cmp     %g2, %g4
-       bne,pn  %icc, 2f
+       bne,pn  %icc, 80f
         add    %g7, 1, %g7
        subcc   %g3, 1, %g3
-       bne,pt  %xcc, 1b
+       bne,pt  %xcc, 90b
         add    %g1, 1, %g1
 
        sethi   %hi(is_sun4v), %g1
@@ -310,7 +319,80 @@ is_sun4v:
        mov     1, %g7
        stw     %g7, [%g1]
 
-2:
+       /* cpu_node = prom_finddevice("/cpu") */
+       mov     (1b - prom_finddev_name), %l1
+       mov     (1b - prom_cpu_path), %l2
+       sub     %l0, %l1, %l1
+       sub     %l0, %l2, %l2
+       sub     %sp, (192 + 128), %sp
+
+       stx     %l1, [%sp + 2047 + 128 + 0x00]  ! service, "finddevice"
+       mov     1, %l3
+       stx     %l3, [%sp + 2047 + 128 + 0x08]  ! num_args, 1
+       stx     %l3, [%sp + 2047 + 128 + 0x10]  ! num_rets, 1
+       stx     %l2, [%sp + 2047 + 128 + 0x18]  ! arg1, "/cpu"
+       stx     %g0, [%sp + 2047 + 128 + 0x20]  ! ret1
+       call    %l7
+        add    %sp, (2047 + 128), %o0          ! argument array
+
+       ldx     [%sp + 2047 + 128 + 0x20], %l4  ! cpu device node
+
+       mov     (1b - prom_getprop_name), %l1
+       mov     (1b - prom_compatible_name), %l2
+       mov     (1b - prom_cpu_compatible), %l5
+       sub     %l0, %l1, %l1
+       sub     %l0, %l2, %l2
+       sub     %l0, %l5, %l5
+
+       /* prom_getproperty(cpu_node, "compatible",
+        *                  &prom_cpu_compatible, 64)
+        */
+       stx     %l1, [%sp + 2047 + 128 + 0x00]  ! service, "getprop"
+       mov     4, %l3
+       stx     %l3, [%sp + 2047 + 128 + 0x08]  ! num_args, 4
+       mov     1, %l3
+       stx     %l3, [%sp + 2047 + 128 + 0x10]  ! num_rets, 1
+       stx     %l4, [%sp + 2047 + 128 + 0x18]  ! arg1, cpu_node
+       stx     %l2, [%sp + 2047 + 128 + 0x20]  ! arg2, "compatible"
+       stx     %l5, [%sp + 2047 + 128 + 0x28]  ! arg3, &prom_cpu_compatible
+       mov     64, %l3
+       stx     %l3, [%sp + 2047 + 128 + 0x30]  ! arg4, size
+       stx     %g0, [%sp + 2047 + 128 + 0x38]  ! ret1
+       call    %l7
+        add    %sp, (2047 + 128), %o0          ! argument array
+
+       add     %sp, (192 + 128), %sp
+
+       sethi   %hi(prom_cpu_compatible), %g1
+       or      %g1, %lo(prom_cpu_compatible), %g1
+       sethi   %hi(prom_niagara_prefix), %g7
+       or      %g7, %lo(prom_niagara_prefix), %g7
+       mov     17, %g3
+90:    ldub    [%g7], %g2
+       ldub    [%g1], %g4
+       cmp     %g2, %g4
+       bne,pn  %icc, 4f
+        add    %g7, 1, %g7
+       subcc   %g3, 1, %g3
+       bne,pt  %xcc, 90b
+        add    %g1, 1, %g1
+
+       sethi   %hi(prom_cpu_compatible), %g1
+       or      %g1, %lo(prom_cpu_compatible), %g1
+       ldub    [%g1 + 17], %g2
+       cmp     %g2, '1'
+       be,pt   %xcc, 5f
+        mov    SUN4V_CHIP_NIAGARA1, %g4
+       cmp     %g2, '2'
+       be,pt   %xcc, 5f
+        mov    SUN4V_CHIP_NIAGARA2, %g4
+4:
+       mov     SUN4V_CHIP_UNKNOWN, %g4
+5:     sethi   %hi(sun4v_chip_type), %g2
+       or      %g2, %lo(sun4v_chip_type), %g2
+       stw     %g4, [%g2]
+
+80:
        BRANCH_IF_SUN4V(g1, jump_to_sun4u_init)
        BRANCH_IF_CHEETAH_BASE(g1,g7,cheetah_boot)
        BRANCH_IF_CHEETAH_PLUS_OR_FOLLOWON(g1,g7,cheetah_plus_boot)
@@ -414,6 +496,24 @@ niagara_tlb_fixup:
        stw     %g2, [%g1 + %lo(tlb_type)]
 
        /* Patch copy/clear ops.  */
+       sethi   %hi(sun4v_chip_type), %g1
+       lduw    [%g1 + %lo(sun4v_chip_type)], %g1
+       cmp     %g1, SUN4V_CHIP_NIAGARA1
+       be,pt   %xcc, niagara_patch
+        cmp    %g1, SUN4V_CHIP_NIAGARA2
+       be,pt   %xcc, niagara_patch
+        nop
+
+       call    generic_patch_copyops
+        nop
+       call    generic_patch_bzero
+        nop
+       call    generic_patch_pageops
+        nop
+
+       ba,a,pt %xcc, 80f
+
+niagara_patch:
        call    niagara_patch_copyops
         nop
        call    niagara_patch_bzero
@@ -421,6 +521,7 @@ niagara_tlb_fixup:
        call    niagara_patch_pageops
         nop
 
+80:
        /* Patch TLB/cache ops.  */
        call    hypervisor_patch_cachetlbops
         nop
index a55c252e18ccd6df64a2d0bc144ffe25cc36a99a..b692e044a463420327862689d51097a60b129119 100644 (file)
@@ -115,11 +115,8 @@ hv_cpu_startup:
        call            hard_smp_processor_id
         nop
 
-       mov             %o0, %o1
-       mov             0, %o0
-       mov             0, %o2
-       call            sun4v_init_mondo_queues
-        mov            1, %o3
+       call            sun4v_register_mondo_queues
+        nop
 
        call            init_cur_cpu_trap
         mov            %g6, %o0
index 329b38fa5c89e81fb995651f257417e4bfd04589..90007cf88bac650517c67951f81aa056ca7ae71f 100644 (file)
@@ -1,4 +1,5 @@
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/init_task.h>
similarity index 68%
rename from arch/sparc64/kernel/pci_iommu.c
rename to arch/sparc64/kernel/iommu.c
index 70d2364fdfe0b6910be668dd9e5a032752c25e4b..b35a62167e9ce31af6f957b28902ca0259bf3b5d 100644 (file)
@@ -1,28 +1,32 @@
-/* pci_iommu.c: UltraSparc PCI controller IOM/STC support.
+/* iommu.c: Generic sparc64 IOMMU support.
  *
  * Copyright (C) 1999, 2007 David S. Miller (davem@davemloft.net)
  * Copyright (C) 1999, 2000 Jakub Jelinek (jakub@redhat.com)
  */
 
 #include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/mm.h>
+#include <linux/module.h>
 #include <linux/delay.h>
+#include <linux/device.h>
+#include <linux/dma-mapping.h>
+#include <linux/errno.h>
+
+#ifdef CONFIG_PCI
 #include <linux/pci.h>
+#endif
 
-#include <asm/oplib.h>
+#include <asm/iommu.h>
 
 #include "iommu_common.h"
-#include "pci_impl.h"
 
-#define PCI_STC_CTXMATCH_ADDR(STC, CTX)        \
+#define STC_CTXMATCH_ADDR(STC, CTX)    \
        ((STC)->strbuf_ctxmatch_base + ((CTX) << 3))
+#define STC_FLUSHFLAG_INIT(STC) \
+       (*((STC)->strbuf_flushflag) = 0UL)
+#define STC_FLUSHFLAG_SET(STC) \
+       (*((STC)->strbuf_flushflag) != 0UL)
 
-/* Accessing IOMMU and Streaming Buffer registers.
- * REG parameter is a physical address.  All registers
- * are 64-bits in size.
- */
-#define pci_iommu_read(__reg) \
+#define iommu_read(__reg) \
 ({     u64 __ret; \
        __asm__ __volatile__("ldxa [%1] %2, %0" \
                             : "=r" (__ret) \
@@ -30,7 +34,7 @@
                             : "memory"); \
        __ret; \
 })
-#define pci_iommu_write(__reg, __val) \
+#define iommu_write(__reg, __val) \
        __asm__ __volatile__("stxa %0, [%1] %2" \
                             : /* no outputs */ \
                             : "r" (__val), "r" (__reg), \
 static void __iommu_flushall(struct iommu *iommu)
 {
        if (iommu->iommu_flushinv) {
-               pci_iommu_write(iommu->iommu_flushinv, ~(u64)0);
+               iommu_write(iommu->iommu_flushinv, ~(u64)0);
        } else {
                unsigned long tag;
                int entry;
 
-               tag = iommu->iommu_flush + (0xa580UL - 0x0210UL);
+               tag = iommu->iommu_tags;
                for (entry = 0; entry < 16; entry++) {
-                       pci_iommu_write(tag, 0);
+                       iommu_write(tag, 0);
                        tag += 8;
                }
 
                /* Ensure completion of previous PIO writes. */
-               (void) pci_iommu_read(iommu->write_complete_reg);
+               (void) iommu_read(iommu->write_complete_reg);
        }
 }
 
@@ -80,7 +84,7 @@ static inline void iopte_make_dummy(struct iommu *iommu, iopte_t *iopte)
 }
 
 /* Based largely upon the ppc64 iommu allocator.  */
-static long pci_arena_alloc(struct iommu *iommu, unsigned long npages)
+static long arena_alloc(struct iommu *iommu, unsigned long npages)
 {
        struct iommu_arena *arena = &iommu->arena;
        unsigned long n, i, start, end, limit;
@@ -121,7 +125,7 @@ again:
        return n;
 }
 
-static void pci_arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages)
+static void arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages)
 {
        unsigned long i;
 
@@ -129,7 +133,8 @@ static void pci_arena_free(struct iommu_arena *arena, unsigned long base, unsign
                __clear_bit(i, arena->map);
 }
 
-void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32 dma_addr_mask)
+int iommu_table_init(struct iommu *iommu, int tsbsize,
+                    u32 dma_offset, u32 dma_addr_mask)
 {
        unsigned long i, tsbbase, order, sz, num_tsb_entries;
 
@@ -146,8 +151,8 @@ void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32
        sz = (sz + 7UL) & ~7UL;
        iommu->arena.map = kzalloc(sz, GFP_KERNEL);
        if (!iommu->arena.map) {
-               prom_printf("PCI_IOMMU: Error, kmalloc(arena.map) failed.\n");
-               prom_halt();
+               printk(KERN_ERR "IOMMU: Error, kmalloc(arena.map) failed.\n");
+               return -ENOMEM;
        }
        iommu->arena.limit = num_tsb_entries;
 
@@ -156,8 +161,8 @@ void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32
         */
        iommu->dummy_page = __get_free_pages(GFP_KERNEL, 0);
        if (!iommu->dummy_page) {
-               prom_printf("PCI_IOMMU: Error, gfp(dummy_page) failed.\n");
-               prom_halt();
+               printk(KERN_ERR "IOMMU: Error, gfp(dummy_page) failed.\n");
+               goto out_free_map;
        }
        memset((void *)iommu->dummy_page, 0, PAGE_SIZE);
        iommu->dummy_page_pa = (unsigned long) __pa(iommu->dummy_page);
@@ -166,20 +171,32 @@ void pci_iommu_table_init(struct iommu *iommu, int tsbsize, u32 dma_offset, u32
        order = get_order(tsbsize);
        tsbbase = __get_free_pages(GFP_KERNEL, order);
        if (!tsbbase) {
-               prom_printf("PCI_IOMMU: Error, gfp(tsb) failed.\n");
-               prom_halt();
+               printk(KERN_ERR "IOMMU: Error, gfp(tsb) failed.\n");
+               goto out_free_dummy_page;
        }
        iommu->page_table = (iopte_t *)tsbbase;
 
        for (i = 0; i < num_tsb_entries; i++)
                iopte_make_dummy(iommu, &iommu->page_table[i]);
+
+       return 0;
+
+out_free_dummy_page:
+       free_page(iommu->dummy_page);
+       iommu->dummy_page = 0UL;
+
+out_free_map:
+       kfree(iommu->arena.map);
+       iommu->arena.map = NULL;
+
+       return -ENOMEM;
 }
 
 static inline iopte_t *alloc_npages(struct iommu *iommu, unsigned long npages)
 {
        long entry;
 
-       entry = pci_arena_alloc(iommu, npages);
+       entry = arena_alloc(iommu, npages);
        if (unlikely(entry < 0))
                return NULL;
 
@@ -188,7 +205,7 @@ static inline iopte_t *alloc_npages(struct iommu *iommu, unsigned long npages)
 
 static inline void free_npages(struct iommu *iommu, dma_addr_t base, unsigned long npages)
 {
-       pci_arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages);
+       arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages);
 }
 
 static int iommu_alloc_ctx(struct iommu *iommu)
@@ -219,11 +236,8 @@ static inline void iommu_free_ctx(struct iommu *iommu, int ctx)
        }
 }
 
-/* Allocate and map kernel buffer of size SIZE using consistent mode
- * DMA for PCI device PDEV.  Return non-NULL cpu-side address if
- * successful and set *DMA_ADDRP to the PCI side dma address.
- */
-static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp)
+static void *dma_4u_alloc_coherent(struct device *dev, size_t size,
+                                  dma_addr_t *dma_addrp, gfp_t gfp)
 {
        struct iommu *iommu;
        iopte_t *iopte;
@@ -241,7 +255,7 @@ static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
                return NULL;
        memset((char *)first_page, 0, PAGE_SIZE << order);
 
-       iommu = pdev->dev.archdata.iommu;
+       iommu = dev->archdata.iommu;
 
        spin_lock_irqsave(&iommu->lock, flags);
        iopte = alloc_npages(iommu, size >> IO_PAGE_SHIFT);
@@ -268,15 +282,15 @@ static void *pci_4u_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
        return ret;
 }
 
-/* Free and unmap a consistent DMA translation. */
-static void pci_4u_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_t dvma)
+static void dma_4u_free_coherent(struct device *dev, size_t size,
+                                void *cpu, dma_addr_t dvma)
 {
        struct iommu *iommu;
        iopte_t *iopte;
        unsigned long flags, order, npages;
 
        npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT;
-       iommu = pdev->dev.archdata.iommu;
+       iommu = dev->archdata.iommu;
        iopte = iommu->page_table +
                ((dvma - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
 
@@ -291,10 +305,8 @@ static void pci_4u_free_consistent(struct pci_dev *pdev, size_t size, void *cpu,
                free_pages((unsigned long)cpu, order);
 }
 
-/* Map a single buffer at PTR of SZ bytes for PCI DMA
- * in streaming mode.
- */
-static dma_addr_t pci_4u_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction)
+static dma_addr_t dma_4u_map_single(struct device *dev, void *ptr, size_t sz,
+                                   enum dma_data_direction direction)
 {
        struct iommu *iommu;
        struct strbuf *strbuf;
@@ -304,10 +316,10 @@ static dma_addr_t pci_4u_map_single(struct pci_dev *pdev, void *ptr, size_t sz,
        u32 bus_addr, ret;
        unsigned long iopte_protection;
 
-       iommu = pdev->dev.archdata.iommu;
-       strbuf = pdev->dev.archdata.stc;
+       iommu = dev->archdata.iommu;
+       strbuf = dev->archdata.stc;
 
-       if (unlikely(direction == PCI_DMA_NONE))
+       if (unlikely(direction == DMA_NONE))
                goto bad_no_ctx;
 
        oaddr = (unsigned long)ptr;
@@ -332,7 +344,7 @@ static dma_addr_t pci_4u_map_single(struct pci_dev *pdev, void *ptr, size_t sz,
                iopte_protection = IOPTE_STREAMING(ctx);
        else
                iopte_protection = IOPTE_CONSISTENT(ctx);
-       if (direction != PCI_DMA_TODEVICE)
+       if (direction != DMA_TO_DEVICE)
                iopte_protection |= IOPTE_WRITE;
 
        for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE)
@@ -345,10 +357,12 @@ bad:
 bad_no_ctx:
        if (printk_ratelimit())
                WARN_ON(1);
-       return PCI_DMA_ERROR_CODE;
+       return DMA_ERROR_CODE;
 }
 
-static void pci_strbuf_flush(struct strbuf *strbuf, struct iommu *iommu, u32 vaddr, unsigned long ctx, unsigned long npages, int direction)
+static void strbuf_flush(struct strbuf *strbuf, struct iommu *iommu,
+                        u32 vaddr, unsigned long ctx, unsigned long npages,
+                        enum dma_data_direction direction)
 {
        int limit;
 
@@ -358,22 +372,22 @@ static void pci_strbuf_flush(struct strbuf *strbuf, struct iommu *iommu, u32 vad
                u64 val;
 
                flushreg = strbuf->strbuf_ctxflush;
-               matchreg = PCI_STC_CTXMATCH_ADDR(strbuf, ctx);
+               matchreg = STC_CTXMATCH_ADDR(strbuf, ctx);
 
-               pci_iommu_write(flushreg, ctx);
-               val = pci_iommu_read(matchreg);
+               iommu_write(flushreg, ctx);
+               val = iommu_read(matchreg);
                val &= 0xffff;
                if (!val)
                        goto do_flush_sync;
 
                while (val) {
                        if (val & 0x1)
-                               pci_iommu_write(flushreg, ctx);
+                               iommu_write(flushreg, ctx);
                        val >>= 1;
                }
-               val = pci_iommu_read(matchreg);
+               val = iommu_read(matchreg);
                if (unlikely(val)) {
-                       printk(KERN_WARNING "pci_strbuf_flush: ctx flush "
+                       printk(KERN_WARNING "strbuf_flush: ctx flush "
                               "timeout matchreg[%lx] ctx[%lx]\n",
                               val, ctx);
                        goto do_page_flush;
@@ -383,7 +397,7 @@ static void pci_strbuf_flush(struct strbuf *strbuf, struct iommu *iommu, u32 vad
 
        do_page_flush:
                for (i = 0; i < npages; i++, vaddr += IO_PAGE_SIZE)
-                       pci_iommu_write(strbuf->strbuf_pflush, vaddr);
+                       iommu_write(strbuf->strbuf_pflush, vaddr);
        }
 
 do_flush_sync:
@@ -391,15 +405,15 @@ do_flush_sync:
         * the streaming cache, no flush-flag synchronization needs
         * to be performed.
         */
-       if (direction == PCI_DMA_TODEVICE)
+       if (direction == DMA_TO_DEVICE)
                return;
 
-       PCI_STC_FLUSHFLAG_INIT(strbuf);
-       pci_iommu_write(strbuf->strbuf_fsync, strbuf->strbuf_flushflag_pa);
-       (void) pci_iommu_read(iommu->write_complete_reg);
+       STC_FLUSHFLAG_INIT(strbuf);
+       iommu_write(strbuf->strbuf_fsync, strbuf->strbuf_flushflag_pa);
+       (void) iommu_read(iommu->write_complete_reg);
 
        limit = 100000;
-       while (!PCI_STC_FLUSHFLAG_SET(strbuf)) {
+       while (!STC_FLUSHFLAG_SET(strbuf)) {
                limit--;
                if (!limit)
                        break;
@@ -407,37 +421,32 @@ do_flush_sync:
                rmb();
        }
        if (!limit)
-               printk(KERN_WARNING "pci_strbuf_flush: flushflag timeout "
+               printk(KERN_WARNING "strbuf_flush: flushflag timeout "
                       "vaddr[%08x] ctx[%lx] npages[%ld]\n",
                       vaddr, ctx, npages);
 }
 
-/* Unmap a single streaming mode DMA translation. */
-static void pci_4u_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction)
+static void dma_4u_unmap_single(struct device *dev, dma_addr_t bus_addr,
+                               size_t sz, enum dma_data_direction direction)
 {
        struct iommu *iommu;
        struct strbuf *strbuf;
        iopte_t *base;
        unsigned long flags, npages, ctx, i;
 
-       if (unlikely(direction == PCI_DMA_NONE)) {
+       if (unlikely(direction == DMA_NONE)) {
                if (printk_ratelimit())
                        WARN_ON(1);
                return;
        }
 
-       iommu = pdev->dev.archdata.iommu;
-       strbuf = pdev->dev.archdata.stc;
+       iommu = dev->archdata.iommu;
+       strbuf = dev->archdata.stc;
 
        npages = IO_PAGE_ALIGN(bus_addr + sz) - (bus_addr & IO_PAGE_MASK);
        npages >>= IO_PAGE_SHIFT;
        base = iommu->page_table +
                ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
-#ifdef DEBUG_PCI_IOMMU
-       if (IOPTE_IS_DUMMY(iommu, base))
-               printk("pci_unmap_single called on non-mapped region %08x,%08x from %016lx\n",
-                      bus_addr, sz, __builtin_return_address(0));
-#endif
        bus_addr &= IO_PAGE_MASK;
 
        spin_lock_irqsave(&iommu->lock, flags);
@@ -449,8 +458,8 @@ static void pci_4u_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_
 
        /* Step 1: Kick data out of streaming buffers if necessary. */
        if (strbuf->strbuf_enabled)
-               pci_strbuf_flush(strbuf, iommu, bus_addr, ctx,
-                                npages, direction);
+               strbuf_flush(strbuf, iommu, bus_addr, ctx,
+                            npages, direction);
 
        /* Step 2: Clear out TSB entries. */
        for (i = 0; i < npages; i++)
@@ -467,7 +476,8 @@ static void pci_4u_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_
        (__pa(page_address((SG)->page)) + (SG)->offset)
 
 static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg,
-                          int nused, int nelems, unsigned long iopte_protection)
+                          int nused, int nelems,
+                          unsigned long iopte_protection)
 {
        struct scatterlist *dma_sg = sg;
        struct scatterlist *sg_end = sg + nelems;
@@ -539,12 +549,8 @@ static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg,
        }
 }
 
-/* Map a set of buffers described by SGLIST with NELEMS array
- * elements in streaming mode for PCI DMA.
- * When making changes here, inspect the assembly output. I was having
- * hard time to keep this routine out of using stack slots for holding variables.
- */
-static int pci_4u_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
+static int dma_4u_map_sg(struct device *dev, struct scatterlist *sglist,
+                        int nelems, enum dma_data_direction direction)
 {
        struct iommu *iommu;
        struct strbuf *strbuf;
@@ -557,19 +563,20 @@ static int pci_4u_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int n
        /* Fast path single entry scatterlists. */
        if (nelems == 1) {
                sglist->dma_address =
-                       pci_4u_map_single(pdev,
-                                         (page_address(sglist->page) + sglist->offset),
+                       dma_4u_map_single(dev,
+                                         (page_address(sglist->page) +
+                                          sglist->offset),
                                          sglist->length, direction);
-               if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE))
+               if (unlikely(sglist->dma_address == DMA_ERROR_CODE))
                        return 0;
                sglist->dma_length = sglist->length;
                return 1;
        }
 
-       iommu = pdev->dev.archdata.iommu;
-       strbuf = pdev->dev.archdata.stc;
-       
-       if (unlikely(direction == PCI_DMA_NONE))
+       iommu = dev->archdata.iommu;
+       strbuf = dev->archdata.stc;
+
+       if (unlikely(direction == DMA_NONE))
                goto bad_no_ctx;
 
        /* Step 1: Prepare scatter list. */
@@ -609,7 +616,7 @@ static int pci_4u_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int n
                iopte_protection = IOPTE_STREAMING(ctx);
        else
                iopte_protection = IOPTE_CONSISTENT(ctx);
-       if (direction != PCI_DMA_TODEVICE)
+       if (direction != DMA_TO_DEVICE)
                iopte_protection |= IOPTE_WRITE;
 
        fill_sg(base, sglist, used, nelems, iopte_protection);
@@ -628,8 +635,8 @@ bad_no_ctx:
        return 0;
 }
 
-/* Unmap a set of streaming mode DMA translations. */
-static void pci_4u_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
+static void dma_4u_unmap_sg(struct device *dev, struct scatterlist *sglist,
+                           int nelems, enum dma_data_direction direction)
 {
        struct iommu *iommu;
        struct strbuf *strbuf;
@@ -637,14 +644,14 @@ static void pci_4u_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, in
        unsigned long flags, ctx, i, npages;
        u32 bus_addr;
 
-       if (unlikely(direction == PCI_DMA_NONE)) {
+       if (unlikely(direction == DMA_NONE)) {
                if (printk_ratelimit())
                        WARN_ON(1);
        }
 
-       iommu = pdev->dev.archdata.iommu;
-       strbuf = pdev->dev.archdata.stc;
-       
+       iommu = dev->archdata.iommu;
+       strbuf = dev->archdata.stc;
+
        bus_addr = sglist->dma_address & IO_PAGE_MASK;
 
        for (i = 1; i < nelems; i++)
@@ -657,11 +664,6 @@ static void pci_4u_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, in
        base = iommu->page_table +
                ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
 
-#ifdef DEBUG_PCI_IOMMU
-       if (IOPTE_IS_DUMMY(iommu, base))
-               printk("pci_unmap_sg called on non-mapped region %016lx,%d from %016lx\n", sglist->dma_address, nelems, __builtin_return_address(0));
-#endif
-
        spin_lock_irqsave(&iommu->lock, flags);
 
        /* Record the context, if any. */
@@ -671,7 +673,7 @@ static void pci_4u_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, in
 
        /* Step 1: Kick data out of streaming buffers if necessary. */
        if (strbuf->strbuf_enabled)
-               pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
+               strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
 
        /* Step 2: Clear out the TSB entries. */
        for (i = 0; i < npages; i++)
@@ -684,17 +686,16 @@ static void pci_4u_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, in
        spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation after a transfer.
- */
-static void pci_4u_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction)
+static void dma_4u_sync_single_for_cpu(struct device *dev,
+                                      dma_addr_t bus_addr, size_t sz,
+                                      enum dma_data_direction direction)
 {
        struct iommu *iommu;
        struct strbuf *strbuf;
        unsigned long flags, ctx, npages;
 
-       iommu = pdev->dev.archdata.iommu;
-       strbuf = pdev->dev.archdata.stc;
+       iommu = dev->archdata.iommu;
+       strbuf = dev->archdata.stc;
 
        if (!strbuf->strbuf_enabled)
                return;
@@ -717,23 +718,22 @@ static void pci_4u_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_
        }
 
        /* Step 2: Kick data out of streaming buffers. */
-       pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
+       strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
 
        spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- */
-static void pci_4u_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
+static void dma_4u_sync_sg_for_cpu(struct device *dev,
+                                  struct scatterlist *sglist, int nelems,
+                                  enum dma_data_direction direction)
 {
        struct iommu *iommu;
        struct strbuf *strbuf;
        unsigned long flags, ctx, npages, i;
        u32 bus_addr;
 
-       iommu = pdev->dev.archdata.iommu;
-       strbuf = pdev->dev.archdata.stc;
+       iommu = dev->archdata.iommu;
+       strbuf = dev->archdata.stc;
 
        if (!strbuf->strbuf_enabled)
                return;
@@ -759,65 +759,51 @@ static void pci_4u_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist
        i--;
        npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length)
                  - bus_addr) >> IO_PAGE_SHIFT;
-       pci_strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
+       strbuf_flush(strbuf, iommu, bus_addr, ctx, npages, direction);
 
        spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-const struct pci_iommu_ops pci_sun4u_iommu_ops = {
-       .alloc_consistent               = pci_4u_alloc_consistent,
-       .free_consistent                = pci_4u_free_consistent,
-       .map_single                     = pci_4u_map_single,
-       .unmap_single                   = pci_4u_unmap_single,
-       .map_sg                         = pci_4u_map_sg,
-       .unmap_sg                       = pci_4u_unmap_sg,
-       .dma_sync_single_for_cpu        = pci_4u_dma_sync_single_for_cpu,
-       .dma_sync_sg_for_cpu            = pci_4u_dma_sync_sg_for_cpu,
+const struct dma_ops sun4u_dma_ops = {
+       .alloc_coherent         = dma_4u_alloc_coherent,
+       .free_coherent          = dma_4u_free_coherent,
+       .map_single             = dma_4u_map_single,
+       .unmap_single           = dma_4u_unmap_single,
+       .map_sg                 = dma_4u_map_sg,
+       .unmap_sg               = dma_4u_unmap_sg,
+       .sync_single_for_cpu    = dma_4u_sync_single_for_cpu,
+       .sync_sg_for_cpu        = dma_4u_sync_sg_for_cpu,
 };
 
-static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit)
-{
-       struct pci_dev *ali_isa_bridge;
-       u8 val;
+const struct dma_ops *dma_ops = &sun4u_dma_ops;
+EXPORT_SYMBOL(dma_ops);
 
-       /* ALI sound chips generate 31-bits of DMA, a special register
-        * determines what bit 31 is emitted as.
-        */
-       ali_isa_bridge = pci_get_device(PCI_VENDOR_ID_AL,
-                                        PCI_DEVICE_ID_AL_M1533,
-                                        NULL);
-
-       pci_read_config_byte(ali_isa_bridge, 0x7e, &val);
-       if (set_bit)
-               val |= 0x01;
-       else
-               val &= ~0x01;
-       pci_write_config_byte(ali_isa_bridge, 0x7e, val);
-       pci_dev_put(ali_isa_bridge);
-}
-
-int pci_dma_supported(struct pci_dev *pdev, u64 device_mask)
+int dma_supported(struct device *dev, u64 device_mask)
 {
-       u64 dma_addr_mask;
+       struct iommu *iommu = dev->archdata.iommu;
+       u64 dma_addr_mask = iommu->dma_addr_mask;
 
-       if (pdev == NULL) {
-               dma_addr_mask = 0xffffffff;
-       } else {
-               struct iommu *iommu = pdev->dev.archdata.iommu;
+       if (device_mask >= (1UL << 32UL))
+               return 0;
 
-               dma_addr_mask = iommu->dma_addr_mask;
+       if ((device_mask & dma_addr_mask) == dma_addr_mask)
+               return 1;
 
-               if (pdev->vendor == PCI_VENDOR_ID_AL &&
-                   pdev->device == PCI_DEVICE_ID_AL_M5451 &&
-                   device_mask == 0x7fffffff) {
-                       ali_sound_dma_hack(pdev,
-                                          (dma_addr_mask & 0x80000000) != 0);
-                       return 1;
-               }
-       }
+#ifdef CONFIG_PCI
+       if (dev->bus == &pci_bus_type)
+               return pci_dma_supported(to_pci_dev(dev), device_mask);
+#endif
 
-       if (device_mask >= (1UL << 32UL))
-               return 0;
+       return 0;
+}
+EXPORT_SYMBOL(dma_supported);
 
-       return (device_mask & dma_addr_mask) == dma_addr_mask;
+int dma_set_mask(struct device *dev, u64 dma_mask)
+{
+#ifdef CONFIG_PCI
+       if (dev->bus == &pci_bus_type)
+               return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
+#endif
+       return -EINVAL;
 }
+EXPORT_SYMBOL(dma_set_mask);
index db31bf6b42dbfa569871e9c9d49aec3d0e3f6a9d..384abf410cf03c0e5f57f823dffd27c7859dc9fa 100644 (file)
@@ -929,7 +929,7 @@ static void __cpuinit register_one_mondo(unsigned long paddr, unsigned long type
        }
 }
 
-static void __cpuinit sun4v_register_mondo_queues(int this_cpu)
+void __cpuinit sun4v_register_mondo_queues(int this_cpu)
 {
        struct trap_per_cpu *tb = &trap_block[this_cpu];
 
@@ -943,20 +943,10 @@ static void __cpuinit sun4v_register_mondo_queues(int this_cpu)
                           tb->nonresum_qmask);
 }
 
-static void __cpuinit alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask, int use_bootmem)
+static void __init alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask)
 {
        unsigned long size = PAGE_ALIGN(qmask + 1);
-       unsigned long order = get_order(size);
-       void *p = NULL;
-
-       if (use_bootmem) {
-               p = __alloc_bootmem_low(size, size, 0);
-       } else {
-               struct page *page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, order);
-               if (page)
-                       p = page_address(page);
-       }
-
+       void *p = __alloc_bootmem_low(size, size, 0);
        if (!p) {
                prom_printf("SUN4V: Error, cannot allocate mondo queue.\n");
                prom_halt();
@@ -965,19 +955,10 @@ static void __cpuinit alloc_one_mondo(unsigned long *pa_ptr, unsigned long qmask
        *pa_ptr = __pa(p);
 }
 
-static void __cpuinit alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask, int use_bootmem)
+static void __init alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask)
 {
        unsigned long size = PAGE_ALIGN(qmask + 1);
-       unsigned long order = get_order(size);
-       void *p = NULL;
-
-       if (use_bootmem) {
-               p = __alloc_bootmem_low(size, size, 0);
-       } else {
-               struct page *page = alloc_pages(GFP_ATOMIC | __GFP_ZERO, order);
-               if (page)
-                       p = page_address(page);
-       }
+       void *p = __alloc_bootmem_low(size, size, 0);
 
        if (!p) {
                prom_printf("SUN4V: Error, cannot allocate kbuf page.\n");
@@ -987,18 +968,14 @@ static void __cpuinit alloc_one_kbuf(unsigned long *pa_ptr, unsigned long qmask,
        *pa_ptr = __pa(p);
 }
 
-static void __cpuinit init_cpu_send_mondo_info(struct trap_per_cpu *tb, int use_bootmem)
+static void __init init_cpu_send_mondo_info(struct trap_per_cpu *tb)
 {
 #ifdef CONFIG_SMP
        void *page;
 
        BUILD_BUG_ON((NR_CPUS * sizeof(u16)) > (PAGE_SIZE - 64));
 
-       if (use_bootmem)
-               page = alloc_bootmem_low_pages(PAGE_SIZE);
-       else
-               page = (void *) get_zeroed_page(GFP_ATOMIC);
-
+       page = alloc_bootmem_low_pages(PAGE_SIZE);
        if (!page) {
                prom_printf("SUN4V: Error, cannot allocate cpu mondo page.\n");
                prom_halt();
@@ -1009,30 +986,27 @@ static void __cpuinit init_cpu_send_mondo_info(struct trap_per_cpu *tb, int use_
 #endif
 }
 
-/* Allocate and register the mondo and error queues for this cpu.  */
-void __cpuinit sun4v_init_mondo_queues(int use_bootmem, int cpu, int alloc, int load)
+/* Allocate mondo and error queues for all possible cpus.  */
+static void __init sun4v_init_mondo_queues(void)
 {
-       struct trap_per_cpu *tb = &trap_block[cpu];
+       int cpu;
 
-       if (alloc) {
-               alloc_one_mondo(&tb->cpu_mondo_pa, tb->cpu_mondo_qmask, use_bootmem);
-               alloc_one_mondo(&tb->dev_mondo_pa, tb->dev_mondo_qmask, use_bootmem);
-               alloc_one_mondo(&tb->resum_mondo_pa, tb->resum_qmask, use_bootmem);
-               alloc_one_kbuf(&tb->resum_kernel_buf_pa, tb->resum_qmask, use_bootmem);
-               alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask, use_bootmem);
-               alloc_one_kbuf(&tb->nonresum_kernel_buf_pa, tb->nonresum_qmask, use_bootmem);
+       for_each_possible_cpu(cpu) {
+               struct trap_per_cpu *tb = &trap_block[cpu];
 
-               init_cpu_send_mondo_info(tb, use_bootmem);
-       }
+               alloc_one_mondo(&tb->cpu_mondo_pa, tb->cpu_mondo_qmask);
+               alloc_one_mondo(&tb->dev_mondo_pa, tb->dev_mondo_qmask);
+               alloc_one_mondo(&tb->resum_mondo_pa, tb->resum_qmask);
+               alloc_one_kbuf(&tb->resum_kernel_buf_pa, tb->resum_qmask);
+               alloc_one_mondo(&tb->nonresum_mondo_pa, tb->nonresum_qmask);
+               alloc_one_kbuf(&tb->nonresum_kernel_buf_pa,
+                              tb->nonresum_qmask);
 
-       if (load) {
-               if (cpu != hard_smp_processor_id()) {
-                       prom_printf("SUN4V: init mondo on cpu %d not %d\n",
-                                   cpu, hard_smp_processor_id());
-                       prom_halt();
-               }
-               sun4v_register_mondo_queues(cpu);
+               init_cpu_send_mondo_info(tb);
        }
+
+       /* Load up the boot cpu's entries.  */
+       sun4v_register_mondo_queues(hard_smp_processor_id());
 }
 
 static struct irqaction timer_irq_action = {
@@ -1047,7 +1021,7 @@ void __init init_IRQ(void)
        memset(&ivector_table[0], 0, sizeof(ivector_table));
 
        if (tlb_type == hypervisor)
-               sun4v_init_mondo_queues(1, hard_smp_processor_id(), 1, 1);
+               sun4v_init_mondo_queues();
 
        /* We need to clear any IRQ's pending in the soft interrupt
         * registers, a spurious one could be left around from the
index 1a1043fcf97dda26866182a97acd2739e94df3ee..0f19dce1c905c699e30361a7f6c6397cffc5c3c7 100644 (file)
@@ -90,6 +90,8 @@ static void __init isa_fill_devices(struct sparc_isa_bridge *isa_br)
                sd = &isa_dev->ofdev.dev.archdata;
                sd->prom_node = dp;
                sd->op = &isa_dev->ofdev;
+               sd->iommu = isa_br->ofdev.dev.parent->archdata.iommu;
+               sd->stc = isa_br->ofdev.dev.parent->archdata.stc;
 
                isa_dev->ofdev.node = dp;
                isa_dev->ofdev.dev.parent = &isa_br->ofdev.dev;
index cce4d0ddf5d5d1c0677544805a042a8acca898ad..95059c2ec414804e50d63681b60ddd2ccfaa4be4 100644 (file)
@@ -568,20 +568,6 @@ static void __init report_platform_properties(void)
        mdesc_release(hp);
 }
 
-static int inline find_in_proplist(const char *list, const char *match, int len)
-{
-       while (len > 0) {
-               int l;
-
-               if (!strcmp(list, match))
-                       return 1;
-               l = strlen(list) + 1;
-               list += l;
-               len -= l;
-       }
-       return 0;
-}
-
 static void __devinit fill_in_one_cache(cpuinfo_sparc *c,
                                        struct mdesc_handle *hp,
                                        u64 mp)
@@ -596,10 +582,10 @@ static void __devinit fill_in_one_cache(cpuinfo_sparc *c,
 
        switch (*level) {
        case 1:
-               if (find_in_proplist(type, "instn", type_len)) {
+               if (of_find_in_proplist(type, "instn", type_len)) {
                        c->icache_size = *size;
                        c->icache_line_size = *line_size;
-               } else if (find_in_proplist(type, "data", type_len)) {
+               } else if (of_find_in_proplist(type, "data", type_len)) {
                        c->dcache_size = *size;
                        c->dcache_line_size = *line_size;
                }
@@ -677,7 +663,7 @@ static void __devinit set_core_ids(struct mdesc_handle *hp)
                        continue;
 
                type = mdesc_get_property(hp, mp, "type", &len);
-               if (!find_in_proplist(type, "instn", len))
+               if (!of_find_in_proplist(type, "instn", len))
                        continue;
 
                mark_core_ids(hp, mp, idx);
@@ -718,8 +704,8 @@ static void __devinit __set_proc_ids(struct mdesc_handle *hp,
                int len;
 
                type = mdesc_get_property(hp, mp, "type", &len);
-               if (!find_in_proplist(type, "int", len) &&
-                   !find_in_proplist(type, "integer", len))
+               if (!of_find_in_proplist(type, "int", len) &&
+                   !of_find_in_proplist(type, "integer", len))
                        continue;
 
                mark_proc_ids(hp, mp, idx);
index 55ad1b899bb8e945a3e049d09ef13e5e1fd167a5..3d93e9203ba2d412ccb6b0e71b5c1432ca9a06d3 100644 (file)
@@ -283,12 +283,6 @@ int __init pcic_present(void)
        return pci_controller_scan(pci_is_controller);
 }
 
-const struct pci_iommu_ops *pci_iommu_ops;
-EXPORT_SYMBOL(pci_iommu_ops);
-
-extern const struct pci_iommu_ops pci_sun4u_iommu_ops,
-       pci_sun4v_iommu_ops;
-
 /* Find each controller in the system, attach and initialize
  * software state structure for each and link into the
  * pci_pbm_root.  Setup the controller enough such
@@ -296,11 +290,6 @@ extern const struct pci_iommu_ops pci_sun4u_iommu_ops,
  */
 static void __init pci_controller_probe(void)
 {
-       if (tlb_type == hypervisor)
-               pci_iommu_ops = &pci_sun4v_iommu_ops;
-       else
-               pci_iommu_ops = &pci_sun4u_iommu_ops;
-
        printk("PCI: Probing for controllers.\n");
 
        pci_controller_scan(pci_controller_init);
@@ -406,6 +395,10 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        sd->op = of_find_device_by_node(node);
        sd->msi_num = 0xffffffff;
 
+       sd = &sd->op->dev.archdata;
+       sd->iommu = pbm->iommu;
+       sd->stc = &pbm->stc;
+
        type = of_get_property(node, "device_type", NULL);
        if (type == NULL)
                type = "";
@@ -422,10 +415,15 @@ struct pci_dev *of_create_pci_dev(struct pci_pbm_info *pbm,
        dev->multifunction = 0;         /* maybe a lie? */
 
        if (host_controller) {
-               dev->vendor = 0x108e;
-               dev->device = 0x8000;
-               dev->subsystem_vendor = 0x0000;
-               dev->subsystem_device = 0x0000;
+               if (tlb_type != hypervisor) {
+                       pci_read_config_word(dev, PCI_VENDOR_ID,
+                                            &dev->vendor);
+                       pci_read_config_word(dev, PCI_DEVICE_ID,
+                                            &dev->device);
+               } else {
+                       dev->vendor = PCI_VENDOR_ID_SUN;
+                       dev->device = 0x80f0;
+               }
                dev->cfg_size = 256;
                dev->class = PCI_CLASS_BRIDGE_HOST << 8;
                sprintf(pci_name(dev), "%04x:%02x:%02x.%d", pci_domain_nr(bus),
@@ -818,7 +816,7 @@ int pci_host_bridge_read_pci_cfg(struct pci_bus *bus_dev,
 {
        static u8 fake_pci_config[] = {
                0x8e, 0x10, /* Vendor: 0x108e (Sun) */
-               0x00, 0x80, /* Device: 0x8000 (PBM) */
+               0xf0, 0x80, /* Device: 0x80f0 (Fire) */
                0x46, 0x01, /* Command: 0x0146 (SERR, PARITY, MASTER, MEM) */
                0xa0, 0x22, /* Status: 0x02a0 (DEVSEL_MED, FB2B, 66MHZ) */
                0x00, 0x00, 0x00, 0x06, /* Class: 0x06000000 host bridge */
@@ -1221,4 +1219,51 @@ struct device_node *pci_device_to_OF_node(struct pci_dev *pdev)
 }
 EXPORT_SYMBOL(pci_device_to_OF_node);
 
+static void ali_sound_dma_hack(struct pci_dev *pdev, int set_bit)
+{
+       struct pci_dev *ali_isa_bridge;
+       u8 val;
+
+       /* ALI sound chips generate 31-bits of DMA, a special register
+        * determines what bit 31 is emitted as.
+        */
+       ali_isa_bridge = pci_get_device(PCI_VENDOR_ID_AL,
+                                        PCI_DEVICE_ID_AL_M1533,
+                                        NULL);
+
+       pci_read_config_byte(ali_isa_bridge, 0x7e, &val);
+       if (set_bit)
+               val |= 0x01;
+       else
+               val &= ~0x01;
+       pci_write_config_byte(ali_isa_bridge, 0x7e, val);
+       pci_dev_put(ali_isa_bridge);
+}
+
+int pci_dma_supported(struct pci_dev *pdev, u64 device_mask)
+{
+       u64 dma_addr_mask;
+
+       if (pdev == NULL) {
+               dma_addr_mask = 0xffffffff;
+       } else {
+               struct iommu *iommu = pdev->dev.archdata.iommu;
+
+               dma_addr_mask = iommu->dma_addr_mask;
+
+               if (pdev->vendor == PCI_VENDOR_ID_AL &&
+                   pdev->device == PCI_DEVICE_ID_AL_M5451 &&
+                   device_mask == 0x7fffffff) {
+                       ali_sound_dma_hack(pdev,
+                                          (dma_addr_mask & 0x80000000) != 0);
+                       return 1;
+               }
+       }
+
+       if (device_mask >= (1UL << 32UL))
+               return 0;
+
+       return (device_mask & dma_addr_mask) == dma_addr_mask;
+}
+
 #endif /* !(CONFIG_PCI) */
index 4249214608af63116aea1d2db4fd176b201a1e8a..2f61c4b1259606ee45ab004cd8e10d91bcb3b5ae 100644 (file)
@@ -44,6 +44,67 @@ static void *sun4u_config_mkaddr(struct pci_pbm_info *pbm,
        return (void *) (pbm->config_space | bus | devfn | reg);
 }
 
+/* At least on Sabre, it is necessary to access all PCI host controller
+ * registers at their natural size, otherwise zeros are returned.
+ * Strange but true, and I see no language in the UltraSPARC-IIi
+ * programmer's manual that mentions this even indirectly.
+ */
+static int sun4u_read_pci_cfg_host(struct pci_pbm_info *pbm,
+                                  unsigned char bus, unsigned int devfn,
+                                  int where, int size, u32 *value)
+{
+       u32 tmp32, *addr;
+       u16 tmp16;
+       u8 tmp8;
+
+       addr = sun4u_config_mkaddr(pbm, bus, devfn, where);
+       if (!addr)
+               return PCIBIOS_SUCCESSFUL;
+
+       switch (size) {
+       case 1:
+               if (where < 8) {
+                       unsigned long align = (unsigned long) addr;
+
+                       align &= ~1;
+                       pci_config_read16((u16 *)align, &tmp16);
+                       if (where & 1)
+                               *value = tmp16 >> 8;
+                       else
+                               *value = tmp16 & 0xff;
+               } else {
+                       pci_config_read8((u8 *)addr, &tmp8);
+                       *value = (u32) tmp8;
+               }
+               break;
+
+       case 2:
+               if (where < 8) {
+                       pci_config_read16((u16 *)addr, &tmp16);
+                       *value = (u32) tmp16;
+               } else {
+                       pci_config_read8((u8 *)addr, &tmp8);
+                       *value = (u32) tmp8;
+                       pci_config_read8(((u8 *)addr) + 1, &tmp8);
+                       *value |= ((u32) tmp8) << 8;
+               }
+               break;
+
+       case 4:
+               tmp32 = 0xffffffff;
+               sun4u_read_pci_cfg_host(pbm, bus, devfn,
+                                       where, 2, &tmp32);
+               *value = tmp32;
+
+               tmp32 = 0xffffffff;
+               sun4u_read_pci_cfg_host(pbm, bus, devfn,
+                                       where + 2, 2, &tmp32);
+               *value |= tmp32 << 16;
+               break;
+       }
+       return PCIBIOS_SUCCESSFUL;
+}
+
 static int sun4u_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
                              int where, int size, u32 *value)
 {
@@ -53,10 +114,6 @@ static int sun4u_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
        u16 tmp16;
        u8 tmp8;
 
-       if (bus_dev == pbm->pci_bus && devfn == 0x00)
-               return pci_host_bridge_read_pci_cfg(bus_dev, devfn, where,
-                                                   size, value);
-
        switch (size) {
        case 1:
                *value = 0xff;
@@ -69,6 +126,10 @@ static int sun4u_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
                break;
        }
 
+       if (!bus_dev->number && !PCI_SLOT(devfn))
+               return sun4u_read_pci_cfg_host(pbm, bus, devfn, where,
+                                              size, value);
+
        addr = sun4u_config_mkaddr(pbm, bus, devfn, where);
        if (!addr)
                return PCIBIOS_SUCCESSFUL;
@@ -101,6 +162,53 @@ static int sun4u_read_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
        return PCIBIOS_SUCCESSFUL;
 }
 
+static int sun4u_write_pci_cfg_host(struct pci_pbm_info *pbm,
+                                   unsigned char bus, unsigned int devfn,
+                                   int where, int size, u32 value)
+{
+       u32 *addr;
+
+       addr = sun4u_config_mkaddr(pbm, bus, devfn, where);
+       if (!addr)
+               return PCIBIOS_SUCCESSFUL;
+
+       switch (size) {
+       case 1:
+               if (where < 8) {
+                       unsigned long align = (unsigned long) addr;
+                       u16 tmp16;
+
+                       align &= ~1;
+                       pci_config_read16((u16 *)align, &tmp16);
+                       if (where & 1) {
+                               tmp16 &= 0x00ff;
+                               tmp16 |= value << 8;
+                       } else {
+                               tmp16 &= 0xff00;
+                               tmp16 |= value;
+                       }
+                       pci_config_write16((u16 *)align, tmp16);
+               } else
+                       pci_config_write8((u8 *)addr, value);
+               break;
+       case 2:
+               if (where < 8) {
+                       pci_config_write16((u16 *)addr, value);
+               } else {
+                       pci_config_write8((u8 *)addr, value & 0xff);
+                       pci_config_write8(((u8 *)addr) + 1, value >> 8);
+               }
+               break;
+       case 4:
+               sun4u_write_pci_cfg_host(pbm, bus, devfn,
+                                        where, 2, value & 0xffff);
+               sun4u_write_pci_cfg_host(pbm, bus, devfn,
+                                        where + 2, 2, value >> 16);
+               break;
+       }
+       return PCIBIOS_SUCCESSFUL;
+}
+
 static int sun4u_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
                               int where, int size, u32 value)
 {
@@ -108,9 +216,10 @@ static int sun4u_write_pci_cfg(struct pci_bus *bus_dev, unsigned int devfn,
        unsigned char bus = bus_dev->number;
        u32 *addr;
 
-       if (bus_dev == pbm->pci_bus && devfn == 0x00)
-               return pci_host_bridge_write_pci_cfg(bus_dev, devfn, where,
-                                                    size, value);
+       if (!bus_dev->number && !PCI_SLOT(devfn))
+               return sun4u_write_pci_cfg_host(pbm, bus, devfn, where,
+                                               size, value);
+
        addr = sun4u_config_mkaddr(pbm, bus, devfn, where);
        if (!addr)
                return PCIBIOS_SUCCESSFUL;
index 7f5d473901c49ac8229e9062d388dede7d6d1a6f..14d67fe21ab2c1a4aa8343a97352e0ab7573f0c7 100644 (file)
@@ -39,12 +39,12 @@ static void pci_fire_scan_bus(struct pci_pbm_info *pbm)
 #define FIRE_IOMMU_FLUSH       0x40100UL
 #define FIRE_IOMMU_FLUSHINV    0x40108UL
 
-static void pci_fire_pbm_iommu_init(struct pci_pbm_info *pbm)
+static int pci_fire_pbm_iommu_init(struct pci_pbm_info *pbm)
 {
        struct iommu *iommu = pbm->iommu;
        u32 vdma[2], dma_mask;
        u64 control;
-       int tsbsize;
+       int tsbsize, err;
 
        /* No virtual-dma property on these guys, use largest size.  */
        vdma[0] = 0xc0000000; /* base */
@@ -68,7 +68,9 @@ static void pci_fire_pbm_iommu_init(struct pci_pbm_info *pbm)
         */
        fire_write(iommu->iommu_flushinv, ~(u64)0);
 
-       pci_iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask);
+       err = iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask);
+       if (err)
+               return err;
 
        fire_write(iommu->iommu_tsbbase, __pa(iommu->page_table) | 0x7UL);
 
@@ -78,6 +80,8 @@ static void pci_fire_pbm_iommu_init(struct pci_pbm_info *pbm)
                    0x00000002 /* Bypass enable */              |
                    0x00000001 /* Translation enable */);
        fire_write(iommu->iommu_control, control);
+
+       return 0;
 }
 
 /* Based at pbm->controller_regs */
@@ -167,8 +171,8 @@ static void pci_fire_hw_init(struct pci_pbm_info *pbm)
        fire_write(pbm->pbm_regs + FIRE_PEC_IENAB, ~(u64)0);
 }
 
-static void pci_fire_pbm_init(struct pci_controller_info *p,
-                             struct device_node *dp, u32 portid)
+static int pci_fire_pbm_init(struct pci_controller_info *p,
+                            struct device_node *dp, u32 portid)
 {
        const struct linux_prom64_registers *regs;
        struct pci_pbm_info *pbm;
@@ -203,7 +207,8 @@ static void pci_fire_pbm_init(struct pci_controller_info *p,
        pci_get_pbm_props(pbm);
 
        pci_fire_hw_init(pbm);
-       pci_fire_pbm_iommu_init(pbm);
+
+       return pci_fire_pbm_iommu_init(pbm);
 }
 
 static inline int portid_compare(u32 x, u32 y)
@@ -222,7 +227,8 @@ void fire_pci_init(struct device_node *dp, const char *model_name)
 
        for (pbm = pci_pbm_root; pbm; pbm = pbm->next) {
                if (portid_compare(pbm->portid, portid)) {
-                       pci_fire_pbm_init(pbm->parent, dp, portid);
+                       if (pci_fire_pbm_init(pbm->parent, dp, portid))
+                               goto fatal_memory_error;
                        return;
                }
        }
@@ -250,7 +256,9 @@ void fire_pci_init(struct device_node *dp, const char *model_name)
         */
        pci_memspace_mask = 0x7fffffffUL;
 
-       pci_fire_pbm_init(p, dp, portid);
+       if (pci_fire_pbm_init(p, dp, portid))
+               goto fatal_memory_error;
+
        return;
 
 fatal_memory_error:
index 598393a2df168d1e92910cc9bc2a6866bb933013..b6b4cfea5b5f55bdc7f23e87b1ddd577a8a25f64 100644 (file)
@@ -813,16 +813,19 @@ static void psycho_scan_bus(struct pci_pbm_info *pbm)
        psycho_register_error_handlers(pbm);
 }
 
-static void psycho_iommu_init(struct pci_pbm_info *pbm)
+static int psycho_iommu_init(struct pci_pbm_info *pbm)
 {
        struct iommu *iommu = pbm->iommu;
        unsigned long i;
        u64 control;
+       int err;
 
        /* Register addresses. */
        iommu->iommu_control  = pbm->controller_regs + PSYCHO_IOMMU_CONTROL;
        iommu->iommu_tsbbase  = pbm->controller_regs + PSYCHO_IOMMU_TSBBASE;
        iommu->iommu_flush    = pbm->controller_regs + PSYCHO_IOMMU_FLUSH;
+       iommu->iommu_tags     = iommu->iommu_flush + (0xa580UL - 0x0210UL);
+
        /* PSYCHO's IOMMU lacks ctx flushing. */
        iommu->iommu_ctxflush = 0;
 
@@ -845,7 +848,9 @@ static void psycho_iommu_init(struct pci_pbm_info *pbm)
        /* Leave diag mode enabled for full-flushing done
         * in pci_iommu.c
         */
-       pci_iommu_table_init(iommu, IO_TSB_SIZE, 0xc0000000, 0xffffffff);
+       err = iommu_table_init(iommu, IO_TSB_SIZE, 0xc0000000, 0xffffffff);
+       if (err)
+               return err;
 
        psycho_write(pbm->controller_regs + PSYCHO_IOMMU_TSBBASE,
                     __pa(iommu->page_table));
@@ -858,6 +863,8 @@ static void psycho_iommu_init(struct pci_pbm_info *pbm)
        /* If necessary, hook us up for starfire IRQ translations. */
        if (this_is_starfire)
                starfire_hookup(pbm->portid);
+
+       return 0;
 }
 
 #define PSYCHO_IRQ_RETRY       0x1a00UL
@@ -1031,15 +1038,12 @@ void psycho_init(struct device_node *dp, char *model_name)
        }
 
        p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
-       if (!p) {
-               prom_printf("PSYCHO: Fatal memory allocation error.\n");
-               prom_halt();
-       }
+       if (!p)
+               goto fatal_memory_error;
        iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
-       if (!iommu) {
-               prom_printf("PSYCHO: Fatal memory allocation error.\n");
-               prom_halt();
-       }
+       if (!iommu)
+               goto fatal_memory_error;
+
        p->pbm_A.iommu = p->pbm_B.iommu = iommu;
 
        p->pbm_A.portid = upa_portid;
@@ -1062,8 +1066,14 @@ void psycho_init(struct device_node *dp, char *model_name)
 
        psycho_controller_hwinit(&p->pbm_A);
 
-       psycho_iommu_init(&p->pbm_A);
+       if (psycho_iommu_init(&p->pbm_A))
+               goto fatal_memory_error;
 
        is_pbm_a = ((pr_regs[0].phys_addr & 0x6000) == 0x2000);
        psycho_pbm_init(p, dp, is_pbm_a);
+       return;
+
+fatal_memory_error:
+       prom_printf("PSYCHO: Fatal memory allocation error.\n");
+       prom_halt();
 }
index 22e1be5c7489aaf1420da8fb1c4becf437c2eb49..fba67c3d880928e00d9332e9f1e5099f26d5171b 100644 (file)
@@ -672,18 +672,20 @@ static void sabre_scan_bus(struct pci_pbm_info *pbm)
        sabre_register_error_handlers(pbm);
 }
 
-static void sabre_iommu_init(struct pci_pbm_info *pbm,
-                            int tsbsize, unsigned long dvma_offset,
-                            u32 dma_mask)
+static int sabre_iommu_init(struct pci_pbm_info *pbm,
+                           int tsbsize, unsigned long dvma_offset,
+                           u32 dma_mask)
 {
        struct iommu *iommu = pbm->iommu;
        unsigned long i;
        u64 control;
+       int err;
 
        /* Register addresses. */
        iommu->iommu_control  = pbm->controller_regs + SABRE_IOMMU_CONTROL;
        iommu->iommu_tsbbase  = pbm->controller_regs + SABRE_IOMMU_TSBBASE;
        iommu->iommu_flush    = pbm->controller_regs + SABRE_IOMMU_FLUSH;
+       iommu->iommu_tags     = iommu->iommu_flush + (0xa580UL - 0x0210UL);
        iommu->write_complete_reg = pbm->controller_regs + SABRE_WRSYNC;
        /* Sabre's IOMMU lacks ctx flushing. */
        iommu->iommu_ctxflush = 0;
@@ -701,7 +703,10 @@ static void sabre_iommu_init(struct pci_pbm_info *pbm,
        /* Leave diag mode enabled for full-flushing done
         * in pci_iommu.c
         */
-       pci_iommu_table_init(iommu, tsbsize * 1024 * 8, dvma_offset, dma_mask);
+       err = iommu_table_init(iommu, tsbsize * 1024 * 8,
+                              dvma_offset, dma_mask);
+       if (err)
+               return err;
 
        sabre_write(pbm->controller_regs + SABRE_IOMMU_TSBBASE,
                    __pa(iommu->page_table));
@@ -722,6 +727,8 @@ static void sabre_iommu_init(struct pci_pbm_info *pbm,
                break;
        }
        sabre_write(pbm->controller_regs + SABRE_IOMMU_CONTROL, control);
+
+       return 0;
 }
 
 static void sabre_pbm_init(struct pci_controller_info *p, struct pci_pbm_info *pbm, struct device_node *dp)
@@ -775,16 +782,12 @@ void sabre_init(struct device_node *dp, char *model_name)
        }
 
        p = kzalloc(sizeof(*p), GFP_ATOMIC);
-       if (!p) {
-               prom_printf("SABRE: Error, kmalloc(pci_controller_info) failed.\n");
-               prom_halt();
-       }
+       if (!p)
+               goto fatal_memory_error;
 
        iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC);
-       if (!iommu) {
-               prom_printf("SABRE: Error, kmalloc(pci_iommu) failed.\n");
-               prom_halt();
-       }
+       if (!iommu)
+               goto fatal_memory_error;
        pbm = &p->pbm_A;
        pbm->iommu = iommu;
 
@@ -847,10 +850,16 @@ void sabre_init(struct device_node *dp, char *model_name)
                        prom_halt();
        }
 
-       sabre_iommu_init(pbm, tsbsize, vdma[0], dma_mask);
+       if (sabre_iommu_init(pbm, tsbsize, vdma[0], dma_mask))
+               goto fatal_memory_error;
 
        /*
         * Look for APB underneath.
         */
        sabre_pbm_init(p, pbm, dp);
+       return;
+
+fatal_memory_error:
+       prom_printf("SABRE: Fatal memory allocation error.\n");
+       prom_halt();
 }
index ae76898bbe2b0fcfa239669f31a794eb56191935..3c30bfa1f3a37a9c0d7be4c6a43d7501a5ed26cd 100644 (file)
@@ -1148,14 +1148,14 @@ static void schizo_pbm_strbuf_init(struct pci_pbm_info *pbm)
 #define SCHIZO_IOMMU_FLUSH             (0x00210UL)
 #define SCHIZO_IOMMU_CTXFLUSH          (0x00218UL)
 
-static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
+static int schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
 {
        struct iommu *iommu = pbm->iommu;
        unsigned long i, tagbase, database;
        struct property *prop;
        u32 vdma[2], dma_mask;
+       int tsbsize, err;
        u64 control;
-       int tsbsize;
 
        prop = of_find_property(pbm->prom_node, "virtual-dma", NULL);
        if (prop) {
@@ -1195,6 +1195,7 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
        iommu->iommu_control  = pbm->pbm_regs + SCHIZO_IOMMU_CONTROL;
        iommu->iommu_tsbbase  = pbm->pbm_regs + SCHIZO_IOMMU_TSBBASE;
        iommu->iommu_flush    = pbm->pbm_regs + SCHIZO_IOMMU_FLUSH;
+       iommu->iommu_tags     = iommu->iommu_flush + (0xa580UL - 0x0210UL);
        iommu->iommu_ctxflush = pbm->pbm_regs + SCHIZO_IOMMU_CTXFLUSH;
 
        /* We use the main control/status register of SCHIZO as the write
@@ -1219,7 +1220,9 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
        /* Leave diag mode enabled for full-flushing done
         * in pci_iommu.c
         */
-       pci_iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask);
+       err = iommu_table_init(iommu, tsbsize * 8 * 1024, vdma[0], dma_mask);
+       if (err)
+               return err;
 
        schizo_write(iommu->iommu_tsbbase, __pa(iommu->page_table));
 
@@ -1236,6 +1239,8 @@ static void schizo_pbm_iommu_init(struct pci_pbm_info *pbm)
 
        control |= SCHIZO_IOMMU_CTRL_ENAB;
        schizo_write(iommu->iommu_control, control);
+
+       return 0;
 }
 
 #define SCHIZO_PCI_IRQ_RETRY   (0x1a00UL)
@@ -1328,14 +1333,14 @@ static void schizo_pbm_hw_init(struct pci_pbm_info *pbm)
        }
 }
 
-static void schizo_pbm_init(struct pci_controller_info *p,
-                           struct device_node *dp, u32 portid,
-                           int chip_type)
+static int schizo_pbm_init(struct pci_controller_info *p,
+                          struct device_node *dp, u32 portid,
+                          int chip_type)
 {
        const struct linux_prom64_registers *regs;
        struct pci_pbm_info *pbm;
        const char *chipset_name;
-       int is_pbm_a;
+       int is_pbm_a, err;
 
        switch (chip_type) {
        case PBM_CHIP_TYPE_TOMATILLO:
@@ -1406,8 +1411,13 @@ static void schizo_pbm_init(struct pci_controller_info *p,
 
        pci_get_pbm_props(pbm);
 
-       schizo_pbm_iommu_init(pbm);
+       err = schizo_pbm_iommu_init(pbm);
+       if (err)
+               return err;
+
        schizo_pbm_strbuf_init(pbm);
+
+       return 0;
 }
 
 static inline int portid_compare(u32 x, u32 y, int chip_type)
@@ -1431,34 +1441,38 @@ static void __schizo_init(struct device_node *dp, char *model_name, int chip_typ
 
        for (pbm = pci_pbm_root; pbm; pbm = pbm->next) {
                if (portid_compare(pbm->portid, portid, chip_type)) {
-                       schizo_pbm_init(pbm->parent, dp, portid, chip_type);
+                       if (schizo_pbm_init(pbm->parent, dp,
+                                           portid, chip_type))
+                               goto fatal_memory_error;
                        return;
                }
        }
 
        p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
        if (!p)
-               goto memfail;
+               goto fatal_memory_error;
 
        iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
        if (!iommu)
-               goto memfail;
+               goto fatal_memory_error;
 
        p->pbm_A.iommu = iommu;
 
        iommu = kzalloc(sizeof(struct iommu), GFP_ATOMIC);
        if (!iommu)
-               goto memfail;
+               goto fatal_memory_error;
 
        p->pbm_B.iommu = iommu;
 
        /* Like PSYCHO we have a 2GB aligned area for memory space. */
        pci_memspace_mask = 0x7fffffffUL;
 
-       schizo_pbm_init(p, dp, portid, chip_type);
+       if (schizo_pbm_init(p, dp, portid, chip_type))
+               goto fatal_memory_error;
+
        return;
 
-memfail:
+fatal_memory_error:
        prom_printf("SCHIZO: Fatal memory allocation error.\n");
        prom_halt();
 }
index 639cf06ca37280f3fbe98b97d4f267e23eaaed69..466f4aa8fc82236549567ba47007fa193cf24857 100644 (file)
@@ -33,30 +33,30 @@ static unsigned long vpci_minor = 1;
 #define PGLIST_NENTS   (PAGE_SIZE / sizeof(u64))
 
 struct iommu_batch {
-       struct pci_dev  *pdev;          /* Device mapping is for.       */
+       struct device   *dev;           /* Device mapping is for.       */
        unsigned long   prot;           /* IOMMU page protections       */
        unsigned long   entry;          /* Index into IOTSB.            */
        u64             *pglist;        /* List of physical pages       */
        unsigned long   npages;         /* Number of pages in list.     */
 };
 
-static DEFINE_PER_CPU(struct iommu_batch, pci_iommu_batch);
+static DEFINE_PER_CPU(struct iommu_batch, iommu_batch);
 
 /* Interrupts must be disabled.  */
-static inline void pci_iommu_batch_start(struct pci_dev *pdev, unsigned long prot, unsigned long entry)
+static inline void iommu_batch_start(struct device *dev, unsigned long prot, unsigned long entry)
 {
-       struct iommu_batch *p = &__get_cpu_var(pci_iommu_batch);
+       struct iommu_batch *p = &__get_cpu_var(iommu_batch);
 
-       p->pdev         = pdev;
+       p->dev          = dev;
        p->prot         = prot;
        p->entry        = entry;
        p->npages       = 0;
 }
 
 /* Interrupts must be disabled.  */
-static long pci_iommu_batch_flush(struct iommu_batch *p)
+static long iommu_batch_flush(struct iommu_batch *p)
 {
-       struct pci_pbm_info *pbm = p->pdev->dev.archdata.host_controller;
+       struct pci_pbm_info *pbm = p->dev->archdata.host_controller;
        unsigned long devhandle = pbm->devhandle;
        unsigned long prot = p->prot;
        unsigned long entry = p->entry;
@@ -70,7 +70,7 @@ static long pci_iommu_batch_flush(struct iommu_batch *p)
                                          npages, prot, __pa(pglist));
                if (unlikely(num < 0)) {
                        if (printk_ratelimit())
-                               printk("pci_iommu_batch_flush: IOMMU map of "
+                               printk("iommu_batch_flush: IOMMU map of "
                                       "[%08lx:%08lx:%lx:%lx:%lx] failed with "
                                       "status %ld\n",
                                       devhandle, HV_PCI_TSBID(0, entry),
@@ -90,30 +90,30 @@ static long pci_iommu_batch_flush(struct iommu_batch *p)
 }
 
 /* Interrupts must be disabled.  */
-static inline long pci_iommu_batch_add(u64 phys_page)
+static inline long iommu_batch_add(u64 phys_page)
 {
-       struct iommu_batch *p = &__get_cpu_var(pci_iommu_batch);
+       struct iommu_batch *p = &__get_cpu_var(iommu_batch);
 
        BUG_ON(p->npages >= PGLIST_NENTS);
 
        p->pglist[p->npages++] = phys_page;
        if (p->npages == PGLIST_NENTS)
-               return pci_iommu_batch_flush(p);
+               return iommu_batch_flush(p);
 
        return 0;
 }
 
 /* Interrupts must be disabled.  */
-static inline long pci_iommu_batch_end(void)
+static inline long iommu_batch_end(void)
 {
-       struct iommu_batch *p = &__get_cpu_var(pci_iommu_batch);
+       struct iommu_batch *p = &__get_cpu_var(iommu_batch);
 
        BUG_ON(p->npages >= PGLIST_NENTS);
 
-       return pci_iommu_batch_flush(p);
+       return iommu_batch_flush(p);
 }
 
-static long pci_arena_alloc(struct iommu_arena *arena, unsigned long npages)
+static long arena_alloc(struct iommu_arena *arena, unsigned long npages)
 {
        unsigned long n, i, start, end, limit;
        int pass;
@@ -152,7 +152,8 @@ again:
        return n;
 }
 
-static void pci_arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages)
+static void arena_free(struct iommu_arena *arena, unsigned long base,
+                      unsigned long npages)
 {
        unsigned long i;
 
@@ -160,7 +161,8 @@ static void pci_arena_free(struct iommu_arena *arena, unsigned long base, unsign
                __clear_bit(i, arena->map);
 }
 
-static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr_t *dma_addrp, gfp_t gfp)
+static void *dma_4v_alloc_coherent(struct device *dev, size_t size,
+                                  dma_addr_t *dma_addrp, gfp_t gfp)
 {
        struct iommu *iommu;
        unsigned long flags, order, first_page, npages, n;
@@ -180,10 +182,10 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
 
        memset((char *)first_page, 0, PAGE_SIZE << order);
 
-       iommu = pdev->dev.archdata.iommu;
+       iommu = dev->archdata.iommu;
 
        spin_lock_irqsave(&iommu->lock, flags);
-       entry = pci_arena_alloc(&iommu->arena, npages);
+       entry = arena_alloc(&iommu->arena, npages);
        spin_unlock_irqrestore(&iommu->lock, flags);
 
        if (unlikely(entry < 0L))
@@ -196,18 +198,18 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
 
        local_irq_save(flags);
 
-       pci_iommu_batch_start(pdev,
-                             (HV_PCI_MAP_ATTR_READ |
-                              HV_PCI_MAP_ATTR_WRITE),
-                             entry);
+       iommu_batch_start(dev,
+                         (HV_PCI_MAP_ATTR_READ |
+                          HV_PCI_MAP_ATTR_WRITE),
+                         entry);
 
        for (n = 0; n < npages; n++) {
-               long err = pci_iommu_batch_add(first_page + (n * PAGE_SIZE));
+               long err = iommu_batch_add(first_page + (n * PAGE_SIZE));
                if (unlikely(err < 0L))
                        goto iommu_map_fail;
        }
 
-       if (unlikely(pci_iommu_batch_end() < 0L))
+       if (unlikely(iommu_batch_end() < 0L))
                goto iommu_map_fail;
 
        local_irq_restore(flags);
@@ -217,7 +219,7 @@ static void *pci_4v_alloc_consistent(struct pci_dev *pdev, size_t size, dma_addr
 iommu_map_fail:
        /* Interrupts are disabled.  */
        spin_lock(&iommu->lock);
-       pci_arena_free(&iommu->arena, entry, npages);
+       arena_free(&iommu->arena, entry, npages);
        spin_unlock_irqrestore(&iommu->lock, flags);
 
 arena_alloc_fail:
@@ -225,7 +227,8 @@ arena_alloc_fail:
        return NULL;
 }
 
-static void pci_4v_free_consistent(struct pci_dev *pdev, size_t size, void *cpu, dma_addr_t dvma)
+static void dma_4v_free_coherent(struct device *dev, size_t size, void *cpu,
+                                dma_addr_t dvma)
 {
        struct pci_pbm_info *pbm;
        struct iommu *iommu;
@@ -233,14 +236,14 @@ static void pci_4v_free_consistent(struct pci_dev *pdev, size_t size, void *cpu,
        u32 devhandle;
 
        npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT;
-       iommu = pdev->dev.archdata.iommu;
-       pbm = pdev->dev.archdata.host_controller;
+       iommu = dev->archdata.iommu;
+       pbm = dev->archdata.host_controller;
        devhandle = pbm->devhandle;
        entry = ((dvma - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
 
        spin_lock_irqsave(&iommu->lock, flags);
 
-       pci_arena_free(&iommu->arena, entry, npages);
+       arena_free(&iommu->arena, entry, npages);
 
        do {
                unsigned long num;
@@ -258,7 +261,8 @@ static void pci_4v_free_consistent(struct pci_dev *pdev, size_t size, void *cpu,
                free_pages((unsigned long)cpu, order);
 }
 
-static dma_addr_t pci_4v_map_single(struct pci_dev *pdev, void *ptr, size_t sz, int direction)
+static dma_addr_t dma_4v_map_single(struct device *dev, void *ptr, size_t sz,
+                                   enum dma_data_direction direction)
 {
        struct iommu *iommu;
        unsigned long flags, npages, oaddr;
@@ -267,9 +271,9 @@ static dma_addr_t pci_4v_map_single(struct pci_dev *pdev, void *ptr, size_t sz,
        unsigned long prot;
        long entry;
 
-       iommu = pdev->dev.archdata.iommu;
+       iommu = dev->archdata.iommu;
 
-       if (unlikely(direction == PCI_DMA_NONE))
+       if (unlikely(direction == DMA_NONE))
                goto bad;
 
        oaddr = (unsigned long)ptr;
@@ -277,7 +281,7 @@ static dma_addr_t pci_4v_map_single(struct pci_dev *pdev, void *ptr, size_t sz,
        npages >>= IO_PAGE_SHIFT;
 
        spin_lock_irqsave(&iommu->lock, flags);
-       entry = pci_arena_alloc(&iommu->arena, npages);
+       entry = arena_alloc(&iommu->arena, npages);
        spin_unlock_irqrestore(&iommu->lock, flags);
 
        if (unlikely(entry < 0L))
@@ -288,19 +292,19 @@ static dma_addr_t pci_4v_map_single(struct pci_dev *pdev, void *ptr, size_t sz,
        ret = bus_addr | (oaddr & ~IO_PAGE_MASK);
        base_paddr = __pa(oaddr & IO_PAGE_MASK);
        prot = HV_PCI_MAP_ATTR_READ;
-       if (direction != PCI_DMA_TODEVICE)
+       if (direction != DMA_TO_DEVICE)
                prot |= HV_PCI_MAP_ATTR_WRITE;
 
        local_irq_save(flags);
 
-       pci_iommu_batch_start(pdev, prot, entry);
+       iommu_batch_start(dev, prot, entry);
 
        for (i = 0; i < npages; i++, base_paddr += IO_PAGE_SIZE) {
-               long err = pci_iommu_batch_add(base_paddr);
+               long err = iommu_batch_add(base_paddr);
                if (unlikely(err < 0L))
                        goto iommu_map_fail;
        }
-       if (unlikely(pci_iommu_batch_end() < 0L))
+       if (unlikely(iommu_batch_end() < 0L))
                goto iommu_map_fail;
 
        local_irq_restore(flags);
@@ -310,18 +314,19 @@ static dma_addr_t pci_4v_map_single(struct pci_dev *pdev, void *ptr, size_t sz,
 bad:
        if (printk_ratelimit())
                WARN_ON(1);
-       return PCI_DMA_ERROR_CODE;
+       return DMA_ERROR_CODE;
 
 iommu_map_fail:
        /* Interrupts are disabled.  */
        spin_lock(&iommu->lock);
-       pci_arena_free(&iommu->arena, entry, npages);
+       arena_free(&iommu->arena, entry, npages);
        spin_unlock_irqrestore(&iommu->lock, flags);
 
-       return PCI_DMA_ERROR_CODE;
+       return DMA_ERROR_CODE;
 }
 
-static void pci_4v_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction)
+static void dma_4v_unmap_single(struct device *dev, dma_addr_t bus_addr,
+                               size_t sz, enum dma_data_direction direction)
 {
        struct pci_pbm_info *pbm;
        struct iommu *iommu;
@@ -329,14 +334,14 @@ static void pci_4v_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_
        long entry;
        u32 devhandle;
 
-       if (unlikely(direction == PCI_DMA_NONE)) {
+       if (unlikely(direction == DMA_NONE)) {
                if (printk_ratelimit())
                        WARN_ON(1);
                return;
        }
 
-       iommu = pdev->dev.archdata.iommu;
-       pbm = pdev->dev.archdata.host_controller;
+       iommu = dev->archdata.iommu;
+       pbm = dev->archdata.host_controller;
        devhandle = pbm->devhandle;
 
        npages = IO_PAGE_ALIGN(bus_addr + sz) - (bus_addr & IO_PAGE_MASK);
@@ -346,7 +351,7 @@ static void pci_4v_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_
        spin_lock_irqsave(&iommu->lock, flags);
 
        entry = (bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT;
-       pci_arena_free(&iommu->arena, entry, npages);
+       arena_free(&iommu->arena, entry, npages);
 
        do {
                unsigned long num;
@@ -363,7 +368,7 @@ static void pci_4v_unmap_single(struct pci_dev *pdev, dma_addr_t bus_addr, size_
 #define SG_ENT_PHYS_ADDRESS(SG)        \
        (__pa(page_address((SG)->page)) + (SG)->offset)
 
-static inline long fill_sg(long entry, struct pci_dev *pdev,
+static inline long fill_sg(long entry, struct device *dev,
                           struct scatterlist *sg,
                           int nused, int nelems, unsigned long prot)
 {
@@ -374,7 +379,7 @@ static inline long fill_sg(long entry, struct pci_dev *pdev,
 
        local_irq_save(flags);
 
-       pci_iommu_batch_start(pdev, prot, entry);
+       iommu_batch_start(dev, prot, entry);
 
        for (i = 0; i < nused; i++) {
                unsigned long pteval = ~0UL;
@@ -415,7 +420,7 @@ static inline long fill_sg(long entry, struct pci_dev *pdev,
                        while (len > 0) {
                                long err;
 
-                               err = pci_iommu_batch_add(pteval);
+                               err = iommu_batch_add(pteval);
                                if (unlikely(err < 0L))
                                        goto iommu_map_failed;
 
@@ -446,7 +451,7 @@ static inline long fill_sg(long entry, struct pci_dev *pdev,
                dma_sg++;
        }
 
-       if (unlikely(pci_iommu_batch_end() < 0L))
+       if (unlikely(iommu_batch_end() < 0L))
                goto iommu_map_failed;
 
        local_irq_restore(flags);
@@ -457,7 +462,8 @@ iommu_map_failed:
        return -1L;
 }
 
-static int pci_4v_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
+static int dma_4v_map_sg(struct device *dev, struct scatterlist *sglist,
+                        int nelems, enum dma_data_direction direction)
 {
        struct iommu *iommu;
        unsigned long flags, npages, prot;
@@ -469,18 +475,19 @@ static int pci_4v_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int n
        /* Fast path single entry scatterlists. */
        if (nelems == 1) {
                sglist->dma_address =
-                       pci_4v_map_single(pdev,
-                                         (page_address(sglist->page) + sglist->offset),
+                       dma_4v_map_single(dev,
+                                         (page_address(sglist->page) +
+                                          sglist->offset),
                                          sglist->length, direction);
-               if (unlikely(sglist->dma_address == PCI_DMA_ERROR_CODE))
+               if (unlikely(sglist->dma_address == DMA_ERROR_CODE))
                        return 0;
                sglist->dma_length = sglist->length;
                return 1;
        }
 
-       iommu = pdev->dev.archdata.iommu;
+       iommu = dev->archdata.iommu;
        
-       if (unlikely(direction == PCI_DMA_NONE))
+       if (unlikely(direction == DMA_NONE))
                goto bad;
 
        /* Step 1: Prepare scatter list. */
@@ -488,7 +495,7 @@ static int pci_4v_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int n
 
        /* Step 2: Allocate a cluster and context, if necessary. */
        spin_lock_irqsave(&iommu->lock, flags);
-       entry = pci_arena_alloc(&iommu->arena, npages);
+       entry = arena_alloc(&iommu->arena, npages);
        spin_unlock_irqrestore(&iommu->lock, flags);
 
        if (unlikely(entry < 0L))
@@ -510,10 +517,10 @@ static int pci_4v_map_sg(struct pci_dev *pdev, struct scatterlist *sglist, int n
 
        /* Step 4: Create the mappings. */
        prot = HV_PCI_MAP_ATTR_READ;
-       if (direction != PCI_DMA_TODEVICE)
+       if (direction != DMA_TO_DEVICE)
                prot |= HV_PCI_MAP_ATTR_WRITE;
 
-       err = fill_sg(entry, pdev, sglist, used, nelems, prot);
+       err = fill_sg(entry, dev, sglist, used, nelems, prot);
        if (unlikely(err < 0L))
                goto iommu_map_failed;
 
@@ -526,13 +533,14 @@ bad:
 
 iommu_map_failed:
        spin_lock_irqsave(&iommu->lock, flags);
-       pci_arena_free(&iommu->arena, entry, npages);
+       arena_free(&iommu->arena, entry, npages);
        spin_unlock_irqrestore(&iommu->lock, flags);
 
        return 0;
 }
 
-static void pci_4v_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
+static void dma_4v_unmap_sg(struct device *dev, struct scatterlist *sglist,
+                           int nelems, enum dma_data_direction direction)
 {
        struct pci_pbm_info *pbm;
        struct iommu *iommu;
@@ -540,13 +548,13 @@ static void pci_4v_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, in
        long entry;
        u32 devhandle, bus_addr;
 
-       if (unlikely(direction == PCI_DMA_NONE)) {
+       if (unlikely(direction == DMA_NONE)) {
                if (printk_ratelimit())
                        WARN_ON(1);
        }
 
-       iommu = pdev->dev.archdata.iommu;
-       pbm = pdev->dev.archdata.host_controller;
+       iommu = dev->archdata.iommu;
+       pbm = dev->archdata.host_controller;
        devhandle = pbm->devhandle;
        
        bus_addr = sglist->dma_address & IO_PAGE_MASK;
@@ -562,7 +570,7 @@ static void pci_4v_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, in
 
        spin_lock_irqsave(&iommu->lock, flags);
 
-       pci_arena_free(&iommu->arena, entry, npages);
+       arena_free(&iommu->arena, entry, npages);
 
        do {
                unsigned long num;
@@ -576,25 +584,29 @@ static void pci_4v_unmap_sg(struct pci_dev *pdev, struct scatterlist *sglist, in
        spin_unlock_irqrestore(&iommu->lock, flags);
 }
 
-static void pci_4v_dma_sync_single_for_cpu(struct pci_dev *pdev, dma_addr_t bus_addr, size_t sz, int direction)
+static void dma_4v_sync_single_for_cpu(struct device *dev,
+                                      dma_addr_t bus_addr, size_t sz,
+                                      enum dma_data_direction direction)
 {
        /* Nothing to do... */
 }
 
-static void pci_4v_dma_sync_sg_for_cpu(struct pci_dev *pdev, struct scatterlist *sglist, int nelems, int direction)
+static void dma_4v_sync_sg_for_cpu(struct device *dev,
+                                  struct scatterlist *sglist, int nelems,
+                                  enum dma_data_direction direction)
 {
        /* Nothing to do... */
 }
 
-const struct pci_iommu_ops pci_sun4v_iommu_ops = {
-       .alloc_consistent               = pci_4v_alloc_consistent,
-       .free_consistent                = pci_4v_free_consistent,
-       .map_single                     = pci_4v_map_single,
-       .unmap_single                   = pci_4v_unmap_single,
-       .map_sg                         = pci_4v_map_sg,
-       .unmap_sg                       = pci_4v_unmap_sg,
-       .dma_sync_single_for_cpu        = pci_4v_dma_sync_single_for_cpu,
-       .dma_sync_sg_for_cpu            = pci_4v_dma_sync_sg_for_cpu,
+const struct dma_ops sun4v_dma_ops = {
+       .alloc_coherent                 = dma_4v_alloc_coherent,
+       .free_coherent                  = dma_4v_free_coherent,
+       .map_single                     = dma_4v_map_single,
+       .unmap_single                   = dma_4v_unmap_single,
+       .map_sg                         = dma_4v_map_sg,
+       .unmap_sg                       = dma_4v_unmap_sg,
+       .sync_single_for_cpu            = dma_4v_sync_single_for_cpu,
+       .sync_sg_for_cpu                = dma_4v_sync_sg_for_cpu,
 };
 
 static void pci_sun4v_scan_bus(struct pci_pbm_info *pbm)
@@ -1186,6 +1198,8 @@ void __init sun4v_pci_init(struct device_node *dp, char *model_name)
                }
                printk("SUN4V_PCI: Registered hvapi major[%lu] minor[%lu]\n",
                       vpci_major, vpci_minor);
+
+               dma_ops = &sun4v_dma_ops;
        }
 
        prop = of_find_property(dp, "reg", NULL);
@@ -1206,7 +1220,7 @@ void __init sun4v_pci_init(struct device_node *dp, char *model_name)
                if (!page)
                        goto fatal_memory_error;
 
-               per_cpu(pci_iommu_batch, i).pglist = (u64 *) page;
+               per_cpu(iommu_batch, i).pglist = (u64 *) page;
        }
 
        p = kzalloc(sizeof(struct pci_controller_info), GFP_ATOMIC);
index fd7899ba1d70bde8edee7211139081fe7bad88f9..ca7cdfd55f72084c901a1dfcc3c35e507422ddf7 100644 (file)
@@ -18,6 +18,7 @@
 #include <linux/kernel.h>
 #include <linux/kallsyms.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/stddef.h>
 #include <linux/ptrace.h>
index f4e0a9ad9be30b000895d5246d7f5318b1b11453..d1a78c976cef0cfe73c9b51a2610d3ab4fa4d015 100644 (file)
@@ -107,6 +107,21 @@ int of_set_property(struct device_node *dp, const char *name, void *val, int len
 }
 EXPORT_SYMBOL(of_set_property);
 
+int of_find_in_proplist(const char *list, const char *match, int len)
+{
+       while (len > 0) {
+               int l;
+
+               if (!strcmp(list, match))
+                       return 1;
+               l = strlen(list) + 1;
+               list += l;
+               len -= l;
+       }
+       return 0;
+}
+EXPORT_SYMBOL(of_find_in_proplist);
+
 static unsigned int prom_early_allocated;
 
 static void * __init prom_early_alloc(unsigned long size)
index a1fd9bcc0b872a5485bb6514b9a835cad583ee49..d1fb13ba02b59e75d56a9259e9f188e0784f3d38 100644 (file)
 
 #define MAP_BASE       ((u32)0xc0000000)
 
-struct sbus_info {
-       struct iommu    iommu;
-       struct strbuf   strbuf;
-};
-
 /* Offsets from iommu_regs */
 #define SYSIO_IOMMUREG_BASE    0x2400UL
 #define IOMMU_CONTROL  (0x2400UL - 0x2400UL)   /* IOMMU control register */
@@ -44,19 +39,6 @@ struct sbus_info {
 
 #define IOMMU_DRAM_VALID       (1UL << 30UL)
 
-static void __iommu_flushall(struct iommu *iommu)
-{
-       unsigned long tag;
-       int entry;
-
-       tag = iommu->iommu_control + (IOMMU_TAGDIAG - IOMMU_CONTROL);
-       for (entry = 0; entry < 16; entry++) {
-               upa_writeq(0, tag);
-               tag += 8UL;
-       }
-       upa_readq(iommu->write_complete_reg);
-}
-
 /* Offsets from strbuf_regs */
 #define SYSIO_STRBUFREG_BASE   0x2800UL
 #define STRBUF_CONTROL (0x2800UL - 0x2800UL)   /* Control */
@@ -69,511 +51,10 @@ static void __iommu_flushall(struct iommu *iommu)
 
 #define STRBUF_TAG_VALID       0x02UL
 
-static void sbus_strbuf_flush(struct iommu *iommu, struct strbuf *strbuf, u32 base, unsigned long npages, int direction)
-{
-       unsigned long n;
-       int limit;
-
-       n = npages;
-       while (n--)
-               upa_writeq(base + (n << IO_PAGE_SHIFT), strbuf->strbuf_pflush);
-
-       /* If the device could not have possibly put dirty data into
-        * the streaming cache, no flush-flag synchronization needs
-        * to be performed.
-        */
-       if (direction == SBUS_DMA_TODEVICE)
-               return;
-
-       *(strbuf->strbuf_flushflag) = 0UL;
-
-       /* Whoopee cushion! */
-       upa_writeq(strbuf->strbuf_flushflag_pa, strbuf->strbuf_fsync);
-       upa_readq(iommu->write_complete_reg);
-
-       limit = 100000;
-       while (*(strbuf->strbuf_flushflag) == 0UL) {
-               limit--;
-               if (!limit)
-                       break;
-               udelay(1);
-               rmb();
-       }
-       if (!limit)
-               printk(KERN_WARNING "sbus_strbuf_flush: flushflag timeout "
-                      "vaddr[%08x] npages[%ld]\n",
-                      base, npages);
-}
-
-/* Based largely upon the ppc64 iommu allocator.  */
-static long sbus_arena_alloc(struct iommu *iommu, unsigned long npages)
-{
-       struct iommu_arena *arena = &iommu->arena;
-       unsigned long n, i, start, end, limit;
-       int pass;
-
-       limit = arena->limit;
-       start = arena->hint;
-       pass = 0;
-
-again:
-       n = find_next_zero_bit(arena->map, limit, start);
-       end = n + npages;
-       if (unlikely(end >= limit)) {
-               if (likely(pass < 1)) {
-                       limit = start;
-                       start = 0;
-                       __iommu_flushall(iommu);
-                       pass++;
-                       goto again;
-               } else {
-                       /* Scanned the whole thing, give up. */
-                       return -1;
-               }
-       }
-
-       for (i = n; i < end; i++) {
-               if (test_bit(i, arena->map)) {
-                       start = i + 1;
-                       goto again;
-               }
-       }
-
-       for (i = n; i < end; i++)
-               __set_bit(i, arena->map);
-
-       arena->hint = end;
-
-       return n;
-}
-
-static void sbus_arena_free(struct iommu_arena *arena, unsigned long base, unsigned long npages)
-{
-       unsigned long i;
-
-       for (i = base; i < (base + npages); i++)
-               __clear_bit(i, arena->map);
-}
-
-static void sbus_iommu_table_init(struct iommu *iommu, unsigned int tsbsize)
-{
-       unsigned long tsbbase, order, sz, num_tsb_entries;
-
-       num_tsb_entries = tsbsize / sizeof(iopte_t);
-
-       /* Setup initial software IOMMU state. */
-       spin_lock_init(&iommu->lock);
-       iommu->page_table_map_base = MAP_BASE;
-
-       /* Allocate and initialize the free area map.  */
-       sz = num_tsb_entries / 8;
-       sz = (sz + 7UL) & ~7UL;
-       iommu->arena.map = kzalloc(sz, GFP_KERNEL);
-       if (!iommu->arena.map) {
-               prom_printf("SBUS_IOMMU: Error, kmalloc(arena.map) failed.\n");
-               prom_halt();
-       }
-       iommu->arena.limit = num_tsb_entries;
-
-       /* Now allocate and setup the IOMMU page table itself.  */
-       order = get_order(tsbsize);
-       tsbbase = __get_free_pages(GFP_KERNEL, order);
-       if (!tsbbase) {
-               prom_printf("IOMMU: Error, gfp(tsb) failed.\n");
-               prom_halt();
-       }
-       iommu->page_table = (iopte_t *)tsbbase;
-       memset(iommu->page_table, 0, tsbsize);
-}
-
-static inline iopte_t *alloc_npages(struct iommu *iommu, unsigned long npages)
-{
-       long entry;
-
-       entry = sbus_arena_alloc(iommu, npages);
-       if (unlikely(entry < 0))
-               return NULL;
-
-       return iommu->page_table + entry;
-}
-
-static inline void free_npages(struct iommu *iommu, dma_addr_t base, unsigned long npages)
-{
-       sbus_arena_free(&iommu->arena, base >> IO_PAGE_SHIFT, npages);
-}
-
-void *sbus_alloc_consistent(struct sbus_dev *sdev, size_t size, dma_addr_t *dvma_addr)
-{
-       struct sbus_info *info;
-       struct iommu *iommu;
-       iopte_t *iopte;
-       unsigned long flags, order, first_page;
-       void *ret;
-       int npages;
-
-       size = IO_PAGE_ALIGN(size);
-       order = get_order(size);
-       if (order >= 10)
-               return NULL;
-
-       first_page = __get_free_pages(GFP_KERNEL|__GFP_COMP, order);
-       if (first_page == 0UL)
-               return NULL;
-       memset((char *)first_page, 0, PAGE_SIZE << order);
-
-       info = sdev->bus->iommu;
-       iommu = &info->iommu;
-
-       spin_lock_irqsave(&iommu->lock, flags);
-       iopte = alloc_npages(iommu, size >> IO_PAGE_SHIFT);
-       spin_unlock_irqrestore(&iommu->lock, flags);
-
-       if (unlikely(iopte == NULL)) {
-               free_pages(first_page, order);
-               return NULL;
-       }
-
-       *dvma_addr = (iommu->page_table_map_base +
-                     ((iopte - iommu->page_table) << IO_PAGE_SHIFT));
-       ret = (void *) first_page;
-       npages = size >> IO_PAGE_SHIFT;
-       first_page = __pa(first_page);
-       while (npages--) {
-               iopte_val(*iopte) = (IOPTE_VALID | IOPTE_CACHE |
-                                    IOPTE_WRITE |
-                                    (first_page & IOPTE_PAGE));
-               iopte++;
-               first_page += IO_PAGE_SIZE;
-       }
-
-       return ret;
-}
-
-void sbus_free_consistent(struct sbus_dev *sdev, size_t size, void *cpu, dma_addr_t dvma)
-{
-       struct sbus_info *info;
-       struct iommu *iommu;
-       iopte_t *iopte;
-       unsigned long flags, order, npages;
-
-       npages = IO_PAGE_ALIGN(size) >> IO_PAGE_SHIFT;
-       info = sdev->bus->iommu;
-       iommu = &info->iommu;
-       iopte = iommu->page_table +
-               ((dvma - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
-
-       spin_lock_irqsave(&iommu->lock, flags);
-
-       free_npages(iommu, dvma - iommu->page_table_map_base, npages);
-
-       spin_unlock_irqrestore(&iommu->lock, flags);
-
-       order = get_order(size);
-       if (order < 10)
-               free_pages((unsigned long)cpu, order);
-}
-
-dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr, size_t sz, int direction)
-{
-       struct sbus_info *info;
-       struct iommu *iommu;
-       iopte_t *base;
-       unsigned long flags, npages, oaddr;
-       unsigned long i, base_paddr;
-       u32 bus_addr, ret;
-       unsigned long iopte_protection;
-
-       info = sdev->bus->iommu;
-       iommu = &info->iommu;
-
-       if (unlikely(direction == SBUS_DMA_NONE))
-               BUG();
-
-       oaddr = (unsigned long)ptr;
-       npages = IO_PAGE_ALIGN(oaddr + sz) - (oaddr & IO_PAGE_MASK);
-       npages >>= IO_PAGE_SHIFT;
-
-       spin_lock_irqsave(&iommu->lock, flags);
-       base = alloc_npages(iommu, npages);
-       spin_unlock_irqrestore(&iommu->lock, flags);
-
-       if (unlikely(!base))
-               BUG();
-
-       bus_addr = (iommu->page_table_map_base +
-                   ((base - iommu->page_table) << IO_PAGE_SHIFT));
-       ret = bus_addr | (oaddr & ~IO_PAGE_MASK);
-       base_paddr = __pa(oaddr & IO_PAGE_MASK);
-
-       iopte_protection = IOPTE_VALID | IOPTE_STBUF | IOPTE_CACHE;
-       if (direction != SBUS_DMA_TODEVICE)
-               iopte_protection |= IOPTE_WRITE;
-
-       for (i = 0; i < npages; i++, base++, base_paddr += IO_PAGE_SIZE)
-               iopte_val(*base) = iopte_protection | base_paddr;
-
-       return ret;
-}
-
-void sbus_unmap_single(struct sbus_dev *sdev, dma_addr_t bus_addr, size_t sz, int direction)
-{
-       struct sbus_info *info = sdev->bus->iommu;
-       struct iommu *iommu = &info->iommu;
-       struct strbuf *strbuf = &info->strbuf;
-       iopte_t *base;
-       unsigned long flags, npages, i;
-
-       if (unlikely(direction == SBUS_DMA_NONE))
-               BUG();
-
-       npages = IO_PAGE_ALIGN(bus_addr + sz) - (bus_addr & IO_PAGE_MASK);
-       npages >>= IO_PAGE_SHIFT;
-       base = iommu->page_table +
-               ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
-
-       bus_addr &= IO_PAGE_MASK;
-
-       spin_lock_irqsave(&iommu->lock, flags);
-       sbus_strbuf_flush(iommu, strbuf, bus_addr, npages, direction);
-       for (i = 0; i < npages; i++)
-               iopte_val(base[i]) = 0UL;
-       free_npages(iommu, bus_addr - iommu->page_table_map_base, npages);
-       spin_unlock_irqrestore(&iommu->lock, flags);
-}
-
-#define SG_ENT_PHYS_ADDRESS(SG)        \
-       (__pa(page_address((SG)->page)) + (SG)->offset)
-
-static inline void fill_sg(iopte_t *iopte, struct scatterlist *sg,
-                          int nused, int nelems, unsigned long iopte_protection)
-{
-       struct scatterlist *dma_sg = sg;
-       struct scatterlist *sg_end = sg + nelems;
-       int i;
-
-       for (i = 0; i < nused; i++) {
-               unsigned long pteval = ~0UL;
-               u32 dma_npages;
-
-               dma_npages = ((dma_sg->dma_address & (IO_PAGE_SIZE - 1UL)) +
-                             dma_sg->dma_length +
-                             ((IO_PAGE_SIZE - 1UL))) >> IO_PAGE_SHIFT;
-               do {
-                       unsigned long offset;
-                       signed int len;
-
-                       /* If we are here, we know we have at least one
-                        * more page to map.  So walk forward until we
-                        * hit a page crossing, and begin creating new
-                        * mappings from that spot.
-                        */
-                       for (;;) {
-                               unsigned long tmp;
-
-                               tmp = SG_ENT_PHYS_ADDRESS(sg);
-                               len = sg->length;
-                               if (((tmp ^ pteval) >> IO_PAGE_SHIFT) != 0UL) {
-                                       pteval = tmp & IO_PAGE_MASK;
-                                       offset = tmp & (IO_PAGE_SIZE - 1UL);
-                                       break;
-                               }
-                               if (((tmp ^ (tmp + len - 1UL)) >> IO_PAGE_SHIFT) != 0UL) {
-                                       pteval = (tmp + IO_PAGE_SIZE) & IO_PAGE_MASK;
-                                       offset = 0UL;
-                                       len -= (IO_PAGE_SIZE - (tmp & (IO_PAGE_SIZE - 1UL)));
-                                       break;
-                               }
-                               sg++;
-                       }
-
-                       pteval = iopte_protection | (pteval & IOPTE_PAGE);
-                       while (len > 0) {
-                               *iopte++ = __iopte(pteval);
-                               pteval += IO_PAGE_SIZE;
-                               len -= (IO_PAGE_SIZE - offset);
-                               offset = 0;
-                               dma_npages--;
-                       }
-
-                       pteval = (pteval & IOPTE_PAGE) + len;
-                       sg++;
-
-                       /* Skip over any tail mappings we've fully mapped,
-                        * adjusting pteval along the way.  Stop when we
-                        * detect a page crossing event.
-                        */
-                       while (sg < sg_end &&
-                              (pteval << (64 - IO_PAGE_SHIFT)) != 0UL &&
-                              (pteval == SG_ENT_PHYS_ADDRESS(sg)) &&
-                              ((pteval ^
-                                (SG_ENT_PHYS_ADDRESS(sg) + sg->length - 1UL)) >> IO_PAGE_SHIFT) == 0UL) {
-                               pteval += sg->length;
-                               sg++;
-                       }
-                       if ((pteval << (64 - IO_PAGE_SHIFT)) == 0UL)
-                               pteval = ~0UL;
-               } while (dma_npages != 0);
-               dma_sg++;
-       }
-}
-
-int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sglist, int nelems, int direction)
-{
-       struct sbus_info *info;
-       struct iommu *iommu;
-       unsigned long flags, npages, iopte_protection;
-       iopte_t *base;
-       u32 dma_base;
-       struct scatterlist *sgtmp;
-       int used;
-
-       /* Fast path single entry scatterlists. */
-       if (nelems == 1) {
-               sglist->dma_address =
-                       sbus_map_single(sdev,
-                                       (page_address(sglist->page) + sglist->offset),
-                                       sglist->length, direction);
-               sglist->dma_length = sglist->length;
-               return 1;
-       }
-
-       info = sdev->bus->iommu;
-       iommu = &info->iommu;
-
-       if (unlikely(direction == SBUS_DMA_NONE))
-               BUG();
-
-       npages = prepare_sg(sglist, nelems);
-
-       spin_lock_irqsave(&iommu->lock, flags);
-       base = alloc_npages(iommu, npages);
-       spin_unlock_irqrestore(&iommu->lock, flags);
-
-       if (unlikely(base == NULL))
-               BUG();
-
-       dma_base = iommu->page_table_map_base +
-               ((base - iommu->page_table) << IO_PAGE_SHIFT);
-
-       /* Normalize DVMA addresses. */
-       used = nelems;
-
-       sgtmp = sglist;
-       while (used && sgtmp->dma_length) {
-               sgtmp->dma_address += dma_base;
-               sgtmp++;
-               used--;
-       }
-       used = nelems - used;
-
-       iopte_protection = IOPTE_VALID | IOPTE_STBUF | IOPTE_CACHE;
-       if (direction != SBUS_DMA_TODEVICE)
-               iopte_protection |= IOPTE_WRITE;
-
-       fill_sg(base, sglist, used, nelems, iopte_protection);
-
-#ifdef VERIFY_SG
-       verify_sglist(sglist, nelems, base, npages);
-#endif
-
-       return used;
-}
-
-void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sglist, int nelems, int direction)
-{
-       struct sbus_info *info;
-       struct iommu *iommu;
-       struct strbuf *strbuf;
-       iopte_t *base;
-       unsigned long flags, i, npages;
-       u32 bus_addr;
-
-       if (unlikely(direction == SBUS_DMA_NONE))
-               BUG();
-
-       info = sdev->bus->iommu;
-       iommu = &info->iommu;
-       strbuf = &info->strbuf;
-
-       bus_addr = sglist->dma_address & IO_PAGE_MASK;
-
-       for (i = 1; i < nelems; i++)
-               if (sglist[i].dma_length == 0)
-                       break;
-       i--;
-       npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length) -
-                 bus_addr) >> IO_PAGE_SHIFT;
-
-       base = iommu->page_table +
-               ((bus_addr - iommu->page_table_map_base) >> IO_PAGE_SHIFT);
-
-       spin_lock_irqsave(&iommu->lock, flags);
-       sbus_strbuf_flush(iommu, strbuf, bus_addr, npages, direction);
-       for (i = 0; i < npages; i++)
-               iopte_val(base[i]) = 0UL;
-       free_npages(iommu, bus_addr - iommu->page_table_map_base, npages);
-       spin_unlock_irqrestore(&iommu->lock, flags);
-}
-
-void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev, dma_addr_t bus_addr, size_t sz, int direction)
-{
-       struct sbus_info *info;
-       struct iommu *iommu;
-       struct strbuf *strbuf;
-       unsigned long flags, npages;
-
-       info = sdev->bus->iommu;
-       iommu = &info->iommu;
-       strbuf = &info->strbuf;
-
-       npages = IO_PAGE_ALIGN(bus_addr + sz) - (bus_addr & IO_PAGE_MASK);
-       npages >>= IO_PAGE_SHIFT;
-       bus_addr &= IO_PAGE_MASK;
-
-       spin_lock_irqsave(&iommu->lock, flags);
-       sbus_strbuf_flush(iommu, strbuf, bus_addr, npages, direction);
-       spin_unlock_irqrestore(&iommu->lock, flags);
-}
-
-void sbus_dma_sync_single_for_device(struct sbus_dev *sdev, dma_addr_t base, size_t size, int direction)
-{
-}
-
-void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev, struct scatterlist *sglist, int nelems, int direction)
-{
-       struct sbus_info *info;
-       struct iommu *iommu;
-       struct strbuf *strbuf;
-       unsigned long flags, npages, i;
-       u32 bus_addr;
-
-       info = sdev->bus->iommu;
-       iommu = &info->iommu;
-       strbuf = &info->strbuf;
-
-       bus_addr = sglist[0].dma_address & IO_PAGE_MASK;
-       for (i = 0; i < nelems; i++) {
-               if (!sglist[i].dma_length)
-                       break;
-       }
-       i--;
-       npages = (IO_PAGE_ALIGN(sglist[i].dma_address + sglist[i].dma_length)
-                 - bus_addr) >> IO_PAGE_SHIFT;
-
-       spin_lock_irqsave(&iommu->lock, flags);
-       sbus_strbuf_flush(iommu, strbuf, bus_addr, npages, direction);
-       spin_unlock_irqrestore(&iommu->lock, flags);
-}
-
-void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev, struct scatterlist *sg, int nents, int direction)
-{
-}
-
 /* Enable 64-bit DVMA mode for the given device. */
 void sbus_set_sbus64(struct sbus_dev *sdev, int bursts)
 {
-       struct sbus_info *info = sdev->bus->iommu;
-       struct iommu *iommu = &info->iommu;
+       struct iommu *iommu = sdev->ofdev.dev.archdata.iommu;
        int slot = sdev->slot;
        unsigned long cfg_reg;
        u64 val;
@@ -713,8 +194,7 @@ static unsigned long sysio_imap_to_iclr(unsigned long imap)
 unsigned int sbus_build_irq(void *buscookie, unsigned int ino)
 {
        struct sbus_bus *sbus = (struct sbus_bus *)buscookie;
-       struct sbus_info *info = sbus->iommu;
-       struct iommu *iommu = &info->iommu;
+       struct iommu *iommu = sbus->ofdev.dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
        unsigned long imap, iclr;
        int sbus_level = 0;
@@ -776,8 +256,7 @@ unsigned int sbus_build_irq(void *buscookie, unsigned int ino)
 static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
 {
        struct sbus_bus *sbus = dev_id;
-       struct sbus_info *info = sbus->iommu;
-       struct iommu *iommu = &info->iommu;
+       struct iommu *iommu = sbus->ofdev.dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
        unsigned long afsr_reg, afar_reg;
        unsigned long afsr, afar, error_bits;
@@ -849,8 +328,7 @@ static irqreturn_t sysio_ue_handler(int irq, void *dev_id)
 static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
 {
        struct sbus_bus *sbus = dev_id;
-       struct sbus_info *info = sbus->iommu;
-       struct iommu *iommu = &info->iommu;
+       struct iommu *iommu = sbus->ofdev.dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
        unsigned long afsr_reg, afar_reg;
        unsigned long afsr, afar, error_bits;
@@ -927,8 +405,7 @@ static irqreturn_t sysio_ce_handler(int irq, void *dev_id)
 static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
 {
        struct sbus_bus *sbus = dev_id;
-       struct sbus_info *info = sbus->iommu;
-       struct iommu *iommu = &info->iommu;
+       struct iommu *iommu = sbus->ofdev.dev.archdata.iommu;
        unsigned long afsr_reg, afar_reg, reg_base;
        unsigned long afsr, afar, error_bits;
        int reported;
@@ -995,8 +472,7 @@ static irqreturn_t sysio_sbus_error_handler(int irq, void *dev_id)
 
 static void __init sysio_register_error_handlers(struct sbus_bus *sbus)
 {
-       struct sbus_info *info = sbus->iommu;
-       struct iommu *iommu = &info->iommu;
+       struct iommu *iommu = sbus->ofdev.dev.archdata.iommu;
        unsigned long reg_base = iommu->write_complete_reg - 0x2000UL;
        unsigned int irq;
        u64 control;
@@ -1041,7 +517,6 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
 {
        const struct linux_prom64_registers *pr;
        struct device_node *dp;
-       struct sbus_info *info;
        struct iommu *iommu;
        struct strbuf *strbuf;
        unsigned long regs, reg_base;
@@ -1054,25 +529,28 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
 
        pr = of_get_property(dp, "reg", NULL);
        if (!pr) {
-               prom_printf("sbus_iommu_init: Cannot map SYSIO control registers.\n");
+               prom_printf("sbus_iommu_init: Cannot map SYSIO "
+                           "control registers.\n");
                prom_halt();
        }
        regs = pr->phys_addr;
 
-       info = kzalloc(sizeof(*info), GFP_ATOMIC);
-       if (info == NULL) {
-               prom_printf("sbus_iommu_init: Fatal error, "
-                           "kmalloc(info) failed\n");
-               prom_halt();
-       }
+       iommu = kzalloc(sizeof(*iommu), GFP_ATOMIC);
+       if (!iommu)
+               goto fatal_memory_error;
+       strbuf = kzalloc(sizeof(*strbuf), GFP_ATOMIC);
+       if (!strbuf)
+               goto fatal_memory_error;
 
-       iommu = &info->iommu;
-       strbuf = &info->strbuf;
+       sbus->ofdev.dev.archdata.iommu = iommu;
+       sbus->ofdev.dev.archdata.stc = strbuf;
 
        reg_base = regs + SYSIO_IOMMUREG_BASE;
        iommu->iommu_control = reg_base + IOMMU_CONTROL;
        iommu->iommu_tsbbase = reg_base + IOMMU_TSBBASE;
        iommu->iommu_flush = reg_base + IOMMU_FLUSH;
+       iommu->iommu_tags = iommu->iommu_control +
+               (IOMMU_TAGDIAG - IOMMU_CONTROL);
 
        reg_base = regs + SYSIO_STRBUFREG_BASE;
        strbuf->strbuf_control = reg_base + STRBUF_CONTROL;
@@ -1093,14 +571,12 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
         */
        iommu->write_complete_reg = regs + 0x2000UL;
 
-       /* Link into SYSIO software state. */
-       sbus->iommu = info;
-
        printk("SYSIO: UPA portID %x, at %016lx\n",
               sbus->portid, regs);
 
        /* Setup for TSB_SIZE=7, TBW_SIZE=0, MMU_DE=1, MMU_EN=1 */
-       sbus_iommu_table_init(iommu, IO_TSB_SIZE);
+       if (iommu_table_init(iommu, IO_TSB_SIZE, MAP_BASE, 0xffffffff))
+               goto fatal_memory_error;
 
        control = upa_readq(iommu->iommu_control);
        control = ((7UL << 16UL)        |
@@ -1157,6 +633,10 @@ static void __init sbus_iommu_init(int __node, struct sbus_bus *sbus)
                starfire_hookup(sbus->portid);
 
        sysio_register_error_handlers(sbus);
+       return;
+
+fatal_memory_error:
+       prom_printf("sbus_iommu_init: Fatal memory allocation error.\n");
 }
 
 void sbus_fill_device_irq(struct sbus_dev *sdev)
index b448d33321c6d96c4732c4e6349a98671a56ec01..b84c49e3697c608c826c529739328ae633a860a8 100644 (file)
@@ -334,8 +334,6 @@ static void ldom_startcpu_cpuid(unsigned int cpu, unsigned long thread_reg)
 }
 #endif
 
-extern void sun4v_init_mondo_queues(int use_bootmem, int cpu, int alloc, int load);
-
 extern unsigned long sparc64_cpu_startup;
 
 /* The OBP cpu startup callback truncates the 3rd arg cookie to
@@ -359,9 +357,6 @@ static int __devinit smp_boot_one_cpu(unsigned int cpu)
        cpu_new_thread = task_thread_info(p);
 
        if (tlb_type == hypervisor) {
-               /* Alloc the mondo queues, cpu will load them.  */
-               sun4v_init_mondo_queues(0, cpu, 1, 0);
-
 #if defined(CONFIG_SUN_LDOMS) && defined(CONFIG_HOTPLUG_CPU)
                if (ldom_domaining_enabled)
                        ldom_startcpu_cpuid(cpu,
index d270c2f0be0fdf0c8e31fe6100df7305e120ebca..23fad7ebdd0dc7c1a79d60b7f55d993c866bf581 100644 (file)
@@ -168,6 +168,7 @@ EXPORT_SYMBOL(change_bit);
 EXPORT_SYMBOL(__flushw_user);
 
 EXPORT_SYMBOL(tlb_type);
+EXPORT_SYMBOL(sun4v_chip_type);
 EXPORT_SYMBOL(get_fb_unmapped_area);
 EXPORT_SYMBOL(flush_icache_range);
 
index 49063ca2efcdf53bfa6932185cc870a40948b02c..69cad1b653c14f55a57a2ec5ad0a5e2abf5ad801 100644 (file)
@@ -1460,6 +1460,74 @@ static int cmos_set_rtc_time(struct rtc_time *rtc_tm)
 }
 #endif /* CONFIG_PCI */
 
+static void mostek_get_rtc_time(struct rtc_time *rtc_tm)
+{
+       void __iomem *regs = mstk48t02_regs;
+       u8 tmp;
+
+       spin_lock_irq(&mostek_lock);
+
+       tmp = mostek_read(regs + MOSTEK_CREG);
+       tmp |= MSTK_CREG_READ;
+       mostek_write(regs + MOSTEK_CREG, tmp);
+
+       rtc_tm->tm_sec = MSTK_REG_SEC(regs);
+       rtc_tm->tm_min = MSTK_REG_MIN(regs);
+       rtc_tm->tm_hour = MSTK_REG_HOUR(regs);
+       rtc_tm->tm_mday = MSTK_REG_DOM(regs);
+       rtc_tm->tm_mon = MSTK_REG_MONTH(regs);
+       rtc_tm->tm_year = MSTK_CVT_YEAR( MSTK_REG_YEAR(regs) );
+       rtc_tm->tm_wday = MSTK_REG_DOW(regs);
+
+       tmp = mostek_read(regs + MOSTEK_CREG);
+       tmp &= ~MSTK_CREG_READ;
+       mostek_write(regs + MOSTEK_CREG, tmp);
+
+       spin_unlock_irq(&mostek_lock);
+
+       rtc_tm->tm_mon--;
+       rtc_tm->tm_wday--;
+       rtc_tm->tm_year -= 1900;
+}
+
+static int mostek_set_rtc_time(struct rtc_time *rtc_tm)
+{
+       unsigned char mon, day, hrs, min, sec, wday;
+       void __iomem *regs = mstk48t02_regs;
+       unsigned int yrs;
+       u8 tmp;
+
+       yrs = rtc_tm->tm_year + 1900;
+       mon = rtc_tm->tm_mon + 1;
+       day = rtc_tm->tm_mday;
+       wday = rtc_tm->tm_wday + 1;
+       hrs = rtc_tm->tm_hour;
+       min = rtc_tm->tm_min;
+       sec = rtc_tm->tm_sec;
+
+       spin_lock_irq(&mostek_lock);
+
+       tmp = mostek_read(regs + MOSTEK_CREG);
+       tmp |= MSTK_CREG_WRITE;
+       mostek_write(regs + MOSTEK_CREG, tmp);
+
+       MSTK_SET_REG_SEC(regs, sec);
+       MSTK_SET_REG_MIN(regs, min);
+       MSTK_SET_REG_HOUR(regs, hrs);
+       MSTK_SET_REG_DOW(regs, wday);
+       MSTK_SET_REG_DOM(regs, day);
+       MSTK_SET_REG_MONTH(regs, mon);
+       MSTK_SET_REG_YEAR(regs, yrs - MSTK_YEAR_ZERO);
+
+       tmp = mostek_read(regs + MOSTEK_CREG);
+       tmp &= ~MSTK_CREG_WRITE;
+       mostek_write(regs + MOSTEK_CREG, tmp);
+
+       spin_unlock_irq(&mostek_lock);
+
+       return 0;
+}
+
 struct mini_rtc_ops {
        void (*get_rtc_time)(struct rtc_time *);
        int (*set_rtc_time)(struct rtc_time *);
@@ -1487,6 +1555,11 @@ static struct mini_rtc_ops cmos_rtc_ops = {
 };
 #endif /* CONFIG_PCI */
 
+static struct mini_rtc_ops mostek_rtc_ops = {
+       .get_rtc_time = mostek_get_rtc_time,
+       .set_rtc_time = mostek_set_rtc_time,
+};
+
 static struct mini_rtc_ops *mini_rtc_ops;
 
 static inline void mini_get_rtc_time(struct rtc_time *time)
@@ -1615,6 +1688,8 @@ static int __init rtc_mini_init(void)
        else if (ds1287_regs)
                mini_rtc_ops = &cmos_rtc_ops;
 #endif /* CONFIG_PCI */
+       else if (mstk48t02_regs)
+               mini_rtc_ops = &mostek_rtc_ops;
        else
                return -ENODEV;
 
index a4dc01a3d23842afa0ae05ecfaa52ab15e4f9cae..9448595f9063f346202575ee5a0a2d72caef797b 100644 (file)
@@ -366,11 +366,8 @@ after_lock_tlb:
        call            hard_smp_processor_id
         nop
        
-       mov             %o0, %o1
-       mov             0, %o0
-       mov             0, %o2
-       call            sun4v_init_mondo_queues
-        mov            1, %o3
+       call            sun4v_register_mondo_queues
+        nop
 
 1:     call            init_cur_cpu_trap
         ldx            [%l0], %o0
index 6ef2d299fb10c4527687d323f89154c4dbce9f4d..6ef42b8e53d84dff82b67797d81764f0d9d1a359 100644 (file)
@@ -2134,12 +2134,20 @@ 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;
-       void *tp = task_stack_page(tsk);
+       struct thread_info *tp;
        struct reg_window *rw;
        int count = 0;
 
        ksp = (unsigned long) _ksp;
-
+       if (!tsk)
+               tsk = current;
+       tp = task_thread_info(tsk);
+       if (ksp == 0UL) {
+               if (tsk == current)
+                       asm("mov %%fp, %0" : "=r" (ksp));
+               else
+                       ksp = tp->ksp;
+       }
        if (tp == current_thread_info())
                flushw_all();
 
@@ -2168,11 +2176,7 @@ void show_stack(struct task_struct *tsk, unsigned long *_ksp)
 
 void dump_stack(void)
 {
-       unsigned long *ksp;
-
-       __asm__ __volatile__("mov       %%fp, %0"
-                            : "=r" (ksp));
-       show_stack(current, ksp);
+       show_stack(current, NULL);
 }
 
 EXPORT_SYMBOL(dump_stack);
index 3685daf5157f369a1d3257e7cd8bf97aa12b84b9..1550ac5673da99d4db56bd76c6afb9f9664ad726 100644 (file)
 #include <asm/mdesc.h>
 #include <asm/vio.h>
 
-static inline int find_in_proplist(const char *list, const char *match,
-                                  int len)
-{
-       while (len > 0) {
-               int l;
-
-               if (!strcmp(list, match))
-                       return 1;
-               l = strlen(list) + 1;
-               list += l;
-               len -= l;
-       }
-       return 0;
-}
-
 static const struct vio_device_id *vio_match_device(
        const struct vio_device_id *matches,
        const struct vio_dev *dev)
@@ -49,7 +34,7 @@ static const struct vio_device_id *vio_match_device(
 
                if (matches->compat[0]) {
                        match &= len &&
-                               find_in_proplist(compat, matches->compat, len);
+                               of_find_in_proplist(compat, matches->compat, len);
                }
                if (match)
                        return matches;
@@ -406,7 +391,7 @@ static int __init vio_init(void)
                       "property\n");
                goto out_release;
        }
-       if (!find_in_proplist(compat, channel_devices_compat, len)) {
+       if (!of_find_in_proplist(compat, channel_devices_compat, len)) {
                printk(KERN_ERR "VIO: Channel devices node lacks (%s) "
                       "compat entry.\n", channel_devices_compat);
                goto out_release;
index 09126fc338ba70ef28774af051146bebe5f1fa46..708fa1705fbe55fcfdf6b8c9b5d87de96f7653af 100644 (file)
@@ -702,7 +702,7 @@ u32 vio_send_sid(struct vio_driver_state *vio)
 }
 EXPORT_SYMBOL(vio_send_sid);
 
-extern int vio_ldc_alloc(struct vio_driver_state *vio,
+int vio_ldc_alloc(struct vio_driver_state *vio,
                         struct ldc_channel_config *base_cfg,
                         void *event_arg)
 {
diff --git a/arch/sparc64/lib/GENbzero.S b/arch/sparc64/lib/GENbzero.S
new file mode 100644 (file)
index 0000000..f9c71d6
--- /dev/null
@@ -0,0 +1,160 @@
+/* GENbzero.S: Generic sparc64 memset/clear_user.
+ *
+ * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
+ */
+#include <asm/asi.h>
+
+#define EX_ST(x,y)             \
+98:    x,y;                    \
+       .section .fixup;        \
+       .align 4;               \
+99:    retl;                   \
+        mov    %o1, %o0;       \
+       .section __ex_table;    \
+       .align 4;               \
+       .word 98b, 99b;         \
+       .text;                  \
+       .align 4;
+
+       .align  32
+       .text
+
+       .globl          GENmemset
+       .type           GENmemset, #function
+GENmemset:             /* %o0=buf, %o1=pat, %o2=len */
+       and             %o1, 0xff, %o3
+       mov             %o2, %o1
+       sllx            %o3, 8, %g1
+       or              %g1, %o3, %o2
+       sllx            %o2, 16, %g1
+       or              %g1, %o2, %o2
+       sllx            %o2, 32, %g1
+       ba,pt           %xcc, 1f
+        or             %g1, %o2, %o2
+
+       .globl          GENbzero
+       .type           GENbzero, #function
+GENbzero:
+       clr             %o2
+1:     brz,pn          %o1, GENbzero_return
+        mov            %o0, %o3
+
+       /* %o5: saved %asi, restored at GENbzero_done
+        * %o4: store %asi to use
+        */
+       rd              %asi, %o5
+       mov             ASI_P, %o4
+       wr              %o4, 0x0, %asi
+
+GENbzero_from_clear_user:
+       cmp             %o1, 15
+       bl,pn           %icc, GENbzero_tiny
+        andcc          %o0, 0x7, %g1
+       be,pt           %xcc, 2f
+        mov            8, %g2
+       sub             %g2, %g1, %g1
+       sub             %o1, %g1, %o1
+1:     EX_ST(stba %o2, [%o0 + 0x00] %asi)
+       subcc           %g1, 1, %g1
+       bne,pt          %xcc, 1b
+        add            %o0, 1, %o0
+2:     cmp             %o1, 128
+       bl,pn           %icc, GENbzero_medium
+        andcc          %o0, (64 - 1), %g1
+       be,pt           %xcc, GENbzero_pre_loop
+        mov            64, %g2
+       sub             %g2, %g1, %g1
+       sub             %o1, %g1, %o1
+1:     EX_ST(stxa %o2, [%o0 + 0x00] %asi)
+       subcc           %g1, 8, %g1
+       bne,pt          %xcc, 1b
+        add            %o0, 8, %o0
+
+GENbzero_pre_loop:
+       andn            %o1, (64 - 1), %g1
+       sub             %o1, %g1, %o1
+GENbzero_loop:
+       EX_ST(stxa %o2, [%o0 + 0x00] %asi)
+       EX_ST(stxa %o2, [%o0 + 0x08] %asi)
+       EX_ST(stxa %o2, [%o0 + 0x10] %asi)
+       EX_ST(stxa %o2, [%o0 + 0x18] %asi)
+       EX_ST(stxa %o2, [%o0 + 0x20] %asi)
+       EX_ST(stxa %o2, [%o0 + 0x28] %asi)
+       EX_ST(stxa %o2, [%o0 + 0x30] %asi)
+       EX_ST(stxa %o2, [%o0 + 0x38] %asi)
+       subcc           %g1, 64, %g1
+       bne,pt          %xcc, GENbzero_loop
+        add            %o0, 64, %o0
+
+       membar          #Sync
+       wr              %o4, 0x0, %asi
+       brz,pn          %o1, GENbzero_done
+GENbzero_medium:
+        andncc         %o1, 0x7, %g1
+       be,pn           %xcc, 2f
+        sub            %o1, %g1, %o1
+1:     EX_ST(stxa %o2, [%o0 + 0x00] %asi)
+       subcc           %g1, 8, %g1
+       bne,pt          %xcc, 1b
+        add            %o0, 8, %o0
+2:     brz,pt          %o1, GENbzero_done
+        nop
+
+GENbzero_tiny:
+1:     EX_ST(stba %o2, [%o0 + 0x00] %asi)
+       subcc           %o1, 1, %o1
+       bne,pt          %icc, 1b
+        add            %o0, 1, %o0
+
+       /* fallthrough */
+
+GENbzero_done:
+       wr              %o5, 0x0, %asi
+
+GENbzero_return:
+       retl
+        mov            %o3, %o0
+       .size           GENbzero, .-GENbzero
+       .size           GENmemset, .-GENmemset
+
+       .globl          GENclear_user
+       .type           GENclear_user, #function
+GENclear_user:         /* %o0=buf, %o1=len */
+       rd              %asi, %o5
+       brz,pn          %o1, GENbzero_done
+        clr            %o3
+       cmp             %o5, ASI_AIUS
+       bne,pn          %icc, GENbzero
+        clr            %o2
+       ba,pt           %xcc, GENbzero_from_clear_user
+        mov            ASI_AIUS, %o4
+       .size           GENclear_user, .-GENclear_user
+
+#define BRANCH_ALWAYS  0x10680000
+#define NOP            0x01000000
+#define GEN_DO_PATCH(OLD, NEW) \
+       sethi   %hi(NEW), %g1; \
+       or      %g1, %lo(NEW), %g1; \
+       sethi   %hi(OLD), %g2; \
+       or      %g2, %lo(OLD), %g2; \
+       sub     %g1, %g2, %g1; \
+       sethi   %hi(BRANCH_ALWAYS), %g3; \
+       sll     %g1, 11, %g1; \
+       srl     %g1, 11 + 2, %g1; \
+       or      %g3, %lo(BRANCH_ALWAYS), %g3; \
+       or      %g3, %g1, %g3; \
+       stw     %g3, [%g2]; \
+       sethi   %hi(NOP), %g3; \
+       or      %g3, %lo(NOP), %g3; \
+       stw     %g3, [%g2 + 0x4]; \
+       flush   %g2;
+
+       .globl  generic_patch_bzero
+       .type   generic_patch_bzero,#function
+generic_patch_bzero:
+       GEN_DO_PATCH(memset, GENmemset)
+       GEN_DO_PATCH(__bzero, GENbzero)
+       GEN_DO_PATCH(__clear_user, GENclear_user)
+       retl
+        nop
+       .size   generic_patch_bzero,.-generic_patch_bzero
diff --git a/arch/sparc64/lib/GENcopy_from_user.S b/arch/sparc64/lib/GENcopy_from_user.S
new file mode 100644 (file)
index 0000000..2b9df99
--- /dev/null
@@ -0,0 +1,34 @@
+/* GENcopy_from_user.S: Generic sparc64 copy from userspace.
+ *
+ * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
+ */
+
+#define EX_LD(x)               \
+98:    x;                      \
+       .section .fixup;        \
+       .align 4;               \
+99:    retl;                   \
+        mov    1, %o0;         \
+       .section __ex_table,"a";\
+       .align 4;               \
+       .word 98b, 99b;         \
+       .text;                  \
+       .align 4;
+
+#ifndef ASI_AIUS
+#define ASI_AIUS       0x11
+#endif
+
+#define FUNC_NAME              GENcopy_from_user
+#define LOAD(type,addr,dest)   type##a [addr] ASI_AIUS, dest
+#define EX_RETVAL(x)           0
+
+#ifdef __KERNEL__
+#define PREAMBLE                                       \
+       rd              %asi, %g1;                      \
+       cmp             %g1, ASI_AIUS;                  \
+       bne,pn          %icc, memcpy_user_stub;         \
+        nop
+#endif
+
+#include "GENmemcpy.S"
diff --git a/arch/sparc64/lib/GENcopy_to_user.S b/arch/sparc64/lib/GENcopy_to_user.S
new file mode 100644 (file)
index 0000000..bb3f708
--- /dev/null
@@ -0,0 +1,38 @@
+/* GENcopy_to_user.S: Generic sparc64 copy to userspace.
+ *
+ * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
+ */
+
+#define EX_ST(x)               \
+98:    x;                      \
+       .section .fixup;        \
+       .align 4;               \
+99:    retl;                   \
+        mov    1, %o0;         \
+       .section __ex_table,"a";\
+       .align 4;               \
+       .word 98b, 99b;         \
+       .text;                  \
+       .align 4;
+
+#ifndef ASI_AIUS
+#define ASI_AIUS       0x11
+#endif
+
+#define FUNC_NAME              GENcopy_to_user
+#define STORE(type,src,addr)   type##a src, [addr] ASI_AIUS
+#define EX_RETVAL(x)           0
+
+#ifdef __KERNEL__
+       /* Writing to %asi is _expensive_ so we hardcode it.
+        * Reading %asi to check for KERNEL_DS is comparatively
+        * cheap.
+        */
+#define PREAMBLE                                       \
+       rd              %asi, %g1;                      \
+       cmp             %g1, ASI_AIUS;                  \
+       bne,pn          %icc, memcpy_user_stub;         \
+        nop
+#endif
+
+#include "GENmemcpy.S"
diff --git a/arch/sparc64/lib/GENmemcpy.S b/arch/sparc64/lib/GENmemcpy.S
new file mode 100644 (file)
index 0000000..89358ee
--- /dev/null
@@ -0,0 +1,121 @@
+/* GENmemcpy.S: Generic sparc64 memcpy.
+ *
+ * Copyright (C) 2007 David S. Miller (davem@davemloft.net)
+ */
+
+#ifdef __KERNEL__
+#define GLOBAL_SPARE   %g7
+#else
+#define GLOBAL_SPARE   %g5
+#endif
+
+#ifndef EX_LD
+#define EX_LD(x)       x
+#endif
+
+#ifndef EX_ST
+#define EX_ST(x)       x
+#endif
+
+#ifndef EX_RETVAL
+#define EX_RETVAL(x)   x
+#endif
+
+#ifndef LOAD
+#define LOAD(type,addr,dest)   type [addr], dest
+#endif
+
+#ifndef STORE
+#define STORE(type,src,addr)   type src, [addr]
+#endif
+
+#ifndef FUNC_NAME
+#define FUNC_NAME      GENmemcpy
+#endif
+
+#ifndef PREAMBLE
+#define PREAMBLE
+#endif
+
+#ifndef XCC
+#define XCC xcc
+#endif
+
+       .register       %g2,#scratch
+       .register       %g3,#scratch
+
+       .text
+       .align          64
+
+       .globl  FUNC_NAME
+       .type   FUNC_NAME,#function
+FUNC_NAME:     /* %o0=dst, %o1=src, %o2=len */
+       srlx            %o2, 31, %g2
+       cmp             %g2, 0
+       tne             %XCC, 5
+       PREAMBLE
+       mov             %o0, GLOBAL_SPARE
+
+       cmp             %o2, 0
+       be,pn           %XCC, 85f
+        or             %o0, %o1, %o3
+       cmp             %o2, 16
+       blu,a,pn        %XCC, 80f
+        or             %o3, %o2, %o3
+
+       xor             %o0, %o1, %o4
+       andcc           %o4, 0x7, %g0
+       bne,a,pn        %XCC, 90f
+        sub            %o0, %o1, %o3
+
+       and             %o0, 0x7, %o4
+       sub             %o4, 0x8, %o4
+       sub             %g0, %o4, %o4
+       sub             %o2, %o4, %o2
+1:     subcc           %o4, 1, %o4
+       EX_LD(LOAD(ldub, %o1, %g1))
+       EX_ST(STORE(stb, %g1, %o0))
+       add             %o1, 1, %o1
+       bne,pt          %XCC, 1b
+       add             %o0, 1, %o0
+
+       andn            %o2, 0x7, %g1
+       sub             %o2, %g1, %o2
+1:     subcc           %g1, 0x8, %g1
+       EX_LD(LOAD(ldx, %o1, %g2))
+       EX_ST(STORE(stx, %g2, %o0))
+       add             %o1, 0x8, %o1
+       bne,pt          %XCC, 1b
+        add            %o0, 0x8, %o0
+
+       brz,pt          %o2, 85f
+        sub            %o0, %o1, %o3
+       ba,a,pt         %XCC, 90f
+
+       .align          64
+80: /* 0 < len <= 16 */
+       andcc           %o3, 0x3, %g0
+       bne,pn          %XCC, 90f
+        sub            %o0, %o1, %o3
+
+1:
+       subcc           %o2, 4, %o2
+       EX_LD(LOAD(lduw, %o1, %g1))
+       EX_ST(STORE(stw, %g1, %o1 + %o3))
+       bgu,pt          %XCC, 1b
+        add            %o1, 4, %o1
+
+85:    retl
+        mov            EX_RETVAL(GLOBAL_SPARE), %o0
+
+       .align          32
+90:
+       subcc           %o2, 1, %o2
+       EX_LD(LOAD(ldub, %o1, %g1))
+       EX_ST(STORE(stb, %g1, %o1 + %o3))
+       bgu,pt          %XCC, 90b
+        add            %o1, 1, %o1
+       retl
+        mov            EX_RETVAL(GLOBAL_SPARE), %o0
+
+       .size           FUNC_NAME, .-FUNC_NAME
diff --git a/arch/sparc64/lib/GENpage.S b/arch/sparc64/lib/GENpage.S
new file mode 100644 (file)
index 0000000..2ef9d05
--- /dev/null
@@ -0,0 +1,77 @@
+/* GENpage.S: Generic clear and copy page.
+ *
+ * Copyright (C) 2007 (davem@davemloft.net)
+ */
+#include <asm/page.h>
+
+       .text
+       .align  32
+
+GENcopy_user_page:
+       set     PAGE_SIZE, %g7
+1:     ldx     [%o1 + 0x00], %o2
+       ldx     [%o1 + 0x08], %o3
+       ldx     [%o1 + 0x10], %o4
+       ldx     [%o1 + 0x18], %o5
+       stx     %o2, [%o0 + 0x00]
+       stx     %o3, [%o0 + 0x08]
+       stx     %o4, [%o0 + 0x10]
+       stx     %o5, [%o0 + 0x18]
+       ldx     [%o1 + 0x20], %o2
+       ldx     [%o1 + 0x28], %o3
+       ldx     [%o1 + 0x30], %o4
+       ldx     [%o1 + 0x38], %o5
+       stx     %o2, [%o0 + 0x20]
+       stx     %o3, [%o0 + 0x28]
+       stx     %o4, [%o0 + 0x30]
+       stx     %o5, [%o0 + 0x38]
+       subcc   %g7, 64, %g7
+       add     %o1, 64, %o1
+       bne,pt  %xcc, 1b
+        add    %o0, 64, %o0
+       retl
+        nop
+
+GENclear_page:
+GENclear_user_page:
+       set     PAGE_SIZE, %g7
+1:     stx     %g0, [%o0 + 0x00]
+       stx     %g0, [%o0 + 0x08]
+       stx     %g0, [%o0 + 0x10]
+       stx     %g0, [%o0 + 0x18]
+       stx     %g0, [%o0 + 0x20]
+       stx     %g0, [%o0 + 0x28]
+       stx     %g0, [%o0 + 0x30]
+       stx     %g0, [%o0 + 0x38]
+       subcc   %g7, 64, %g7
+       bne,pt  %xcc, 1b
+        add    %o0, 64, %o0
+
+#define BRANCH_ALWAYS  0x10680000
+#define NOP            0x01000000
+#define GEN_DO_PATCH(OLD, NEW) \
+       sethi   %hi(NEW), %g1; \
+       or      %g1, %lo(NEW), %g1; \
+       sethi   %hi(OLD), %g2; \
+       or      %g2, %lo(OLD), %g2; \
+       sub     %g1, %g2, %g1; \
+       sethi   %hi(BRANCH_ALWAYS), %g3; \
+       sll     %g1, 11, %g1; \
+       srl     %g1, 11 + 2, %g1; \
+       or      %g3, %lo(BRANCH_ALWAYS), %g3; \
+       or      %g3, %g1, %g3; \
+       stw     %g3, [%g2]; \
+       sethi   %hi(NOP), %g3; \
+       or      %g3, %lo(NOP), %g3; \
+       stw     %g3, [%g2 + 0x4]; \
+       flush   %g2;
+
+       .globl  generic_patch_pageops
+       .type   generic_patch_pageops,#function
+generic_patch_pageops:
+       GEN_DO_PATCH(copy_user_page, GENcopy_user_page)
+       GEN_DO_PATCH(_clear_page, GENclear_page)
+       GEN_DO_PATCH(clear_user_page, GENclear_user_page)
+       retl
+        nop
+       .size   generic_patch_pageops,.-generic_patch_pageops
diff --git a/arch/sparc64/lib/GENpatch.S b/arch/sparc64/lib/GENpatch.S
new file mode 100644 (file)
index 0000000..fab9e89
--- /dev/null
@@ -0,0 +1,33 @@
+/* GENpatch.S: Patch Ultra-I routines with generic variant.
+ *
+ * Copyright (C) 2007 David S. Miller <davem@davemloft.net>
+ */
+
+#define BRANCH_ALWAYS  0x10680000
+#define NOP            0x01000000
+#define GEN_DO_PATCH(OLD, NEW) \
+       sethi   %hi(NEW), %g1; \
+       or      %g1, %lo(NEW), %g1; \
+       sethi   %hi(OLD), %g2; \
+       or      %g2, %lo(OLD), %g2; \
+       sub     %g1, %g2, %g1; \
+       sethi   %hi(BRANCH_ALWAYS), %g3; \
+       sll     %g1, 11, %g1; \
+       srl     %g1, 11 + 2, %g1; \
+       or      %g3, %lo(BRANCH_ALWAYS), %g3; \
+       or      %g3, %g1, %g3; \
+       stw     %g3, [%g2]; \
+       sethi   %hi(NOP), %g3; \
+       or      %g3, %lo(NOP), %g3; \
+       stw     %g3, [%g2 + 0x4]; \
+       flush   %g2;
+
+       .globl  generic_patch_copyops
+       .type   generic_patch_copyops,#function
+generic_patch_copyops:
+       GEN_DO_PATCH(memcpy, GENmemcpy)
+       GEN_DO_PATCH(___copy_from_user, GENcopy_from_user)
+       GEN_DO_PATCH(___copy_to_user, GENcopy_to_user)
+       retl
+        nop
+       .size   generic_patch_copyops,.-generic_patch_copyops
index c4a6d6e7d03c804bc54d293acf60ff65ff64842d..f95fbfa3eeb86b8a9389eb273514226c7b1a5bd5 100644 (file)
@@ -1,4 +1,4 @@
-# $Id: Makefile,v 1.25 2000/12/14 22:57:25 davem Exp $
+#
 # Makefile for Sparc64 library files..
 #
 
@@ -13,6 +13,8 @@ lib-y := PeeCeeI.o copy_page.o clear_page.o strlen.o strncmp.o \
         U3memcpy.o U3copy_from_user.o U3copy_to_user.o U3patch.o \
         NGmemcpy.o NGcopy_from_user.o NGcopy_to_user.o NGpatch.o \
         NGpage.o NGbzero.o \
+        GENmemcpy.o GENcopy_from_user.o GENcopy_to_user.o GENpatch.o \
+        GENpage.o GENbzero.o \
         copy_in_user.o user_fixup.o memmove.o \
         mcount.o ipcsum.o rwsem.o xor.o
 
index 17123e9ecf78dcdb8547f6dc51b9be8900a59bca..9f7740eee8d2957eeaf6170648f390a08e8a4268 100644 (file)
@@ -112,15 +112,12 @@ static void __kprobes unhandled_fault(unsigned long address,
 
 static void bad_kernel_pc(struct pt_regs *regs, unsigned long vaddr)
 {
-       unsigned long *ksp;
-
        printk(KERN_CRIT "OOPS: Bogus kernel PC [%016lx] in fault handler\n",
               regs->tpc);
        printk(KERN_CRIT "OOPS: RPC [%016lx]\n", regs->u_regs[15]);
        print_symbol("RPC: <%s>\n", regs->u_regs[15]);
        printk(KERN_CRIT "OOPS: Fault was to vaddr[%lx]\n", vaddr);
-       __asm__("mov %%sp, %0" : "=r" (ksp));
-       show_stack(current, ksp);
+       dump_stack();
        unhandled_fault(regs->tpc, current, regs);
 }
 
index 368d3e97dfd9a85a918c5455fb63390f3f0ab197..629b00e3b0b0c36f39800836d8525afd14456999 100644 (file)
@@ -157,7 +157,7 @@ static void tty_receive_char(struct tty_struct *tty, char ch)
 
 static int open_one_chan(struct chan *chan)
 {
-       int fd;
+       int fd, err;
 
        if(chan->opened)
                return 0;
@@ -168,6 +168,13 @@ static int open_one_chan(struct chan *chan)
                                     chan->data, &chan->dev);
        if(fd < 0)
                return fd;
+
+       err = os_set_fd_block(fd, 0);
+       if (err) {
+               (*chan->ops->close)(fd, chan->data);
+               return err;
+       }
+
        chan->fd = fd;
 
        chan->opened = 1;
index e41a08f04694ab74b531d31f0c9b50fb0249a3f5..867666a023397182c26f3b1f7e011f589acacba1 100644 (file)
@@ -12,6 +12,7 @@
 #include <linux/init.h> 
 #include <linux/module.h>
 #include <linux/mm.h> 
+#include <linux/fs.h>
 #include <linux/miscdevice.h>
 #include <asm/uaccess.h>
 #include "mem_user.h"
index 356e50f5aaed4c6567e8780adbba06f80494e2a2..ce6828fd396f3d65147064a8a97ef71c261b6a89 100644 (file)
@@ -6,6 +6,7 @@
 #include "linux/slab.h"
 #include "linux/smp_lock.h"
 #include "linux/ptrace.h"
+#include "linux/fs.h"
 #include "asm/ptrace.h"
 #include "asm/pgtable.h"
 #include "asm/tlbflush.h"
index d4f1d1ab252ba0757e47499db066bdb09cbf62bc..cba516e6c99a279683317045c1392b6315b5492c 100644 (file)
@@ -4,6 +4,7 @@
  */
 
 #include "linux/mm.h"
+#include "linux/fs.h"
 #include "linux/module.h"
 #include "linux/sched.h"
 #include "linux/init_task.h"
index 237c4eab7cfd6c429a6ca8831a6a681671a3ddd6..7b3b67333ff31c2b4c418308b7cec9ff36b9d951 100644 (file)
@@ -7,6 +7,7 @@
 #include "linux/file.h"
 #include "linux/smp_lock.h"
 #include "linux/mm.h"
+#include "linux/fs.h"
 #include "linux/utsname.h"
 #include "linux/msg.h"
 #include "linux/shm.h"
index 45f82ae6d38978ae02d049e7bf18b0624a9b98b2..ffa036406289cee0e9734f558d6e57ffa9bb0b7e 100644 (file)
@@ -765,6 +765,9 @@ config COMPAT
        depends on IA32_EMULATION
        default y
 
+config COMPAT_FOR_U64_ALIGNMENT
+       def_bool COMPAT
+
 config SYSVIPC_COMPAT
        bool
        depends on COMPAT && SYSVIPC
index 1312bfaff306866319fcbb8dec3caf06f933c0d1..9fd8030cc54ff2e48b05004ddf34e577fb494a85 100644 (file)
@@ -195,6 +195,11 @@ ENTRY(startup_64)
        movl    %eax, %ds
        movl    %eax, %es
        movl    %eax, %ss
+       movl    %eax, %fs
+       movl    %eax, %gs
+       lldt    %ax
+       movl    $0x20, %eax
+       ltr     %ax
 
        /* Compute the decompressed kernel start address.  It is where
         * we were loaded at aligned to a 2M boundary. %rbp contains the
@@ -295,6 +300,8 @@ gdt:
        .quad   0x0000000000000000      /* NULL descriptor */
        .quad   0x00af9a000000ffff      /* __KERNEL_CS */
        .quad   0x00cf92000000ffff      /* __KERNEL_DS */
+       .quad   0x0080890000000000      /* TS descriptor */
+       .quad   0x0000000000000000      /* TS continued */
 gdt_end:
        .bss
 /* Stack for uncompression */
index b7c4cd04bfc3c08d5711e3215d476ad3e629e272..e64f65c9d901903e67d0a487a319a76e98176c6f 100644 (file)
@@ -199,7 +199,7 @@ CONFIG_GENERIC_PENDING_IRQ=y
 CONFIG_PM=y
 # CONFIG_PM_LEGACY is not set
 # CONFIG_PM_DEBUG is not set
-CONFIG_SOFTWARE_SUSPEND=y
+CONFIG_HIBERNATION=y
 CONFIG_PM_STD_PARTITION=""
 CONFIG_SUSPEND_SMP=y
 
index b70f3e7cf06ca7a8943b4d90a7027c6c7e8a42cf..dffd2ac72747b59836de76618f0c74089778424b 100644 (file)
@@ -41,8 +41,9 @@ int sysctl_vsyscall32 = 1;
 #undef ARCH_DLINFO
 #define ARCH_DLINFO do {  \
        if (sysctl_vsyscall32) { \
-       NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \
-       NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL32_BASE);    \
+               current->mm->context.vdso = (void *)VSYSCALL32_BASE;    \
+               NEW_AUX_ENT(AT_SYSINFO, (u32)(u64)VSYSCALL32_VSYSCALL); \
+               NEW_AUX_ENT(AT_SYSINFO_EHDR, VSYSCALL32_BASE);    \
        }       \
 } while(0)
 
index 4de3a54318f4d6d4f3636144393ee7c88d13fea4..4a233ad6269cce1f2e7408af2137f9e8e92ba39a 100644 (file)
@@ -15,6 +15,7 @@
 #include <linux/syscalls.h>
 #include <linux/unistd.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/ptrace.h>
 #include <asm/ptrace.h>
 #include <asm/compat.h>
index fc4419ff03558f398cbb5ae22811f5900d39241e..15013bac181c7ed42a9765137f58989d2de6dfa2 100644 (file)
@@ -49,14 +49,6 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
        return ret;
 }
 
-const char *arch_vma_name(struct vm_area_struct *vma)
-{
-       if (vma->vm_start == VSYSCALL32_BASE &&
-           vma->vm_mm && vma->vm_mm->task_size == IA32_PAGE_OFFSET)
-               return "[vdso]";
-       return NULL;
-}
-
 static int __init init_syscall32(void)
 { 
        char *syscall32_page = (void *)get_zeroed_page(GFP_KERNEL);
index 47f1dc30bf565625c86d96ff4862e685f2a72615..ff5d8c9b96d9a2012cabd1f16680245026101d1e 100644 (file)
@@ -26,13 +26,12 @@ obj-y                               += io_apic.o mpparse.o genapic.o genapic_flat.o
 obj-$(CONFIG_KEXEC)            += machine_kexec.o relocate_kernel.o crash.o
 obj-$(CONFIG_CRASH_DUMP)       += crash_dump.o
 obj-$(CONFIG_PM)               += suspend.o
-obj-$(CONFIG_SOFTWARE_SUSPEND) += suspend_asm.o
+obj-$(CONFIG_HIBERNATION)      += suspend_asm.o
 obj-$(CONFIG_CPU_FREQ)         += cpufreq/
 obj-$(CONFIG_EARLY_PRINTK)     += early_printk.o
 obj-$(CONFIG_IOMMU)            += pci-gart.o aperture.o
 obj-$(CONFIG_CALGARY_IOMMU)    += pci-calgary.o tce.o
 obj-$(CONFIG_SWIOTLB)          += pci-swiotlb.o
-obj-$(CONFIG_SERIAL_8250)      += legacy_serial.o
 obj-$(CONFIG_KPROBES)          += kprobes.o
 obj-$(CONFIG_X86_PM_TIMER)     += pmtimer.o
 obj-$(CONFIG_X86_VSMP)         += vsmp.o
@@ -51,7 +50,6 @@ CFLAGS_vsyscall.o             := $(PROFILING) -g0
 
 therm_throt-y                   += ../../i386/kernel/cpu/mcheck/therm_throt.o
 bootflag-y                     += ../../i386/kernel/bootflag.o
-legacy_serial-y                        += ../../i386/kernel/legacy_serial.o
 cpuid-$(subst m,y,$(CONFIG_X86_CPUID))  += ../../i386/kernel/cpuid.o
 topology-y                     += ../../i386/kernel/topology.o
 microcode-$(subst m,y,$(CONFIG_MICROCODE))  += ../../i386/kernel/microcode.o
index 17595d23fee7be9c3e873ce9095d71fe0efa9a04..080b9963f1bc1a6f0213a8a59b7ef8898f6d829c 100644 (file)
@@ -1,6 +1,6 @@
 obj-y                  := boot.o
 boot-y                 := ../../../i386/kernel/acpi/boot.o
-obj-y                  += sleep.o wakeup.o
+obj-$(CONFIG_ACPI_SLEEP)       += sleep.o wakeup.o
 
 ifneq ($(CONFIG_ACPI_PROCESSOR),)
 obj-y                  += processor.o
index 900ff38d68de5418d2fe6b6d34937da43035050a..925758dbca0c6016b52e91ab90e7503c90ea08c0 100644 (file)
@@ -791,10 +791,8 @@ static void setup_APIC_timer(unsigned int clocks)
 
        /* wait for irq slice */
        if (hpet_address && hpet_use_timer) {
-               int trigger = hpet_readl(HPET_T0_CMP);
-               while (hpet_readl(HPET_COUNTER) >= trigger)
-                       /* do nothing */ ;
-               while (hpet_readl(HPET_COUNTER) <  trigger)
+               u32 trigger = hpet_readl(HPET_T0_CMP);
+               while (hpet_readl(HPET_T0_CMP) == trigger)
                        /* do nothing */ ;
        } else {
                int c1, c2;
index c3c6b91566ed822dd9d6ba20b3d1ceca55a86ea5..4e5e9d364d63d09243f21295b4ce9cd0abc2ebf5 100644 (file)
@@ -8,6 +8,7 @@
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <asm/alternative.h>
+#include <asm/bugs.h>
 #include <asm/processor.h>
 #include <asm/mtrr.h>
 
index 830cfc6ee8cb1ac08297650f3efcf9e8a7a469a8..1d232e5f5658e889ef8642fc98301b3f9527fbe1 100644 (file)
@@ -282,7 +282,7 @@ sysret_careful:
 sysret_signal:
        TRACE_IRQS_ON
        sti
-       testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
+       testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
        jz    1f
 
        /* Really a signal */
@@ -375,7 +375,7 @@ int_very_careful:
        jmp int_restore_rest
        
 int_signal:
-       testl $(_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
+       testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
        jz 1f
        movq %rsp,%rdi          # &ptregs -> arg1
        xorl %esi,%esi          # oldset -> arg2
@@ -599,7 +599,7 @@ retint_careful:
        jmp retint_check
        
 retint_signal:
-       testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
+       testl $(_TIF_SIGPENDING|_TIF_SINGLESTEP|_TIF_MCE_NOTIFY),%edx
        jz    retint_swapgs
        TRACE_IRQS_ON
        sti
index 3a16e417dd8dae1fc448043386041d9e211aca0c..e89abcdbdde8172e25d6dff0ddb8323471495c66 100644 (file)
@@ -120,7 +120,7 @@ ident_complete:
        addq    %rbp, trampoline_level4_pgt + 0(%rip)
        addq    %rbp, trampoline_level4_pgt + (511*8)(%rip)
 #endif
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_SLEEP
        addq    %rbp, wakeup_level4_pgt + 0(%rip)
        addq    %rbp, wakeup_level4_pgt + (511*8)(%rip)
 #endif
index 050141c0602bbd10d6a429d0016ccd8e6fd3ad83..f57f8b901912dba2829ebd3ced20ec754c61a813 100644 (file)
@@ -800,12 +800,15 @@ static struct irq_chip ioapic_chip;
 
 static void ioapic_register_intr(int irq, unsigned long trigger)
 {
-       if (trigger)
+       if (trigger) {
+               irq_desc[irq].status |= IRQ_LEVEL;
                set_irq_chip_and_handler_name(irq, &ioapic_chip,
                                              handle_fasteoi_irq, "fasteoi");
-       else
+       } else {
+               irq_desc[irq].status &= ~IRQ_LEVEL;
                set_irq_chip_and_handler_name(irq, &ioapic_chip,
                                              handle_edge_irq, "edge");
+       }
 }
 
 static void setup_IO_APIC_irq(int apic, int pin, unsigned int irq,
index ba16c968ca3f8a8a4f37c1862b1a9caa35261204..71da01e73f038162fe955181baad38f16de1126e 100644 (file)
@@ -367,16 +367,15 @@ static inline struct iommu_table *find_iommu_table(struct device *dev)
 
        pdev = to_pci_dev(dev);
 
-       /* is the device behind a bridge? */
-       if (unlikely(pdev->bus->parent))
-               pbus = pdev->bus->parent;
-       else
-               pbus = pdev->bus;
+       pbus = pdev->bus;
+
+       /* is the device behind a bridge? Look for the root bus */
+       while (pbus->parent)
+               pbus = pbus->parent;
 
        tbl = pci_iommu(pbus);
 
-       BUG_ON(pdev->bus->parent &&
-              (tbl->it_busno != pdev->bus->parent->number));
+       BUG_ON(tbl && (tbl->it_busno != pbus->number));
 
        return tbl;
 }
index e7ac629d4c4654ec97ddc387fc5ba71c0892e92a..2842f50cbe3fde220dfc33a61b720720aa7a7e7f 100644 (file)
@@ -23,6 +23,7 @@
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/elfcore.h>
 #include <linux/smp.h>
 #include <linux/slab.h>
index 0f400f3c469494894b37d68f7d2badf44a246e97..af838f6b0b7fc9b7e3ed4de0ab12992e48cf9f18 100644 (file)
@@ -333,7 +333,7 @@ void __init setup_arch(char **cmdline_p)
        reserve_bootmem_generic(SMP_TRAMPOLINE_BASE, 2*PAGE_SIZE);
 #endif
 
-#ifdef CONFIG_ACPI
+#ifdef CONFIG_ACPI_SLEEP
        /*
         * Reserve low memory region for sleep support.
         */
index ea83a9f91965d3217d1f9346fefa45679f69d62a..573c0a6e0ac636e29a1da03ae608094200f499f5 100644 (file)
@@ -146,7 +146,7 @@ void fix_processor_context(void)
 
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* Defined in arch/x86_64/kernel/suspend_asm.S */
 extern int restore_image(void);
 
@@ -236,4 +236,4 @@ int pfn_is_nosave(unsigned long pfn)
        unsigned long nosave_end_pfn = PAGE_ALIGN(__pa_symbol(&__nosave_end)) >> PAGE_SHIFT;
        return (pfn >= nosave_begin_pfn) && (pfn < nosave_end_pfn);
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
index d067d9a2ad27bd27cf2fdc108bd64de77c26a8a6..4770b7a2052cf22774d09d06efd7dadf74d34df8 100644 (file)
@@ -6,6 +6,7 @@
 #include <linux/sched.h>
 #include <linux/syscalls.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/smp.h>
 #include <linux/sem.h>
 #include <linux/msg.h>
index 3aeae2fa2e240048a8b793db8f9f12c5659c3ca7..e3f2569b2c44140a14d19fc7ab5e0fae0b8047c5 100644 (file)
@@ -131,7 +131,7 @@ done:
        return ret;
 }
 
-int build_tce_table(struct pci_dev *dev, void __iomem *bbar)
+int __init build_tce_table(struct pci_dev *dev, void __iomem *bbar)
 {
        struct iommu_table *tbl;
        int ret;
@@ -165,7 +165,7 @@ done:
        return ret;
 }
 
-void* alloc_tce_table(void)
+void * __init alloc_tce_table(void)
 {
        unsigned int size;
 
@@ -175,7 +175,7 @@ void* alloc_tce_table(void)
        return __alloc_bootmem_low(size, size, 0);
 }
 
-void free_tce_table(void *tbl)
+void __init free_tce_table(void *tbl)
 {
        unsigned int size;
 
index 9b76b03d06001209437382b15c6f072c70f7e0dd..2a59bde663f2f1c2b32028f141603bfdab1f38ca 100644 (file)
@@ -118,8 +118,6 @@ core_initcall(cpufreq_tsc);
 
 #endif
 
-static int tsc_unstable = 0;
-
 /*
  * Make an educated guess if the TSC is trustworthy and synchronized
  * over all CPUs.
index 0ea0ddc875a7128203b8a0c8a7c4f5784fb2b680..c22981fa2f3a95240f3a4c99d00da41d1b7392ec 100644 (file)
@@ -124,6 +124,8 @@ ENDPROC(__memcpy)
        .quad memcpy
        .quad 1b
        .byte X86_FEATURE_REP_GOOD
-       .byte .Lfinal - memcpy
+       /* Replace only beginning, memcpy is used to apply alternatives, so it
+        * is silly to overwrite itself with nops - reboot is only outcome... */
+       .byte 2b - 1b
        .byte 2b - 1b
        .previous
index 38f5d63680060769a58b7ac607f9085b6acf19d3..458893b376f811fe1e3b0b9f87444a68aeae53c6 100644 (file)
@@ -600,6 +600,16 @@ void mark_rodata_ro(void)
 {
        unsigned long start = (unsigned long)_stext, end;
 
+#ifdef CONFIG_HOTPLUG_CPU
+       /* It must still be possible to apply SMP alternatives. */
+       if (num_possible_cpus() > 1)
+               start = (unsigned long)_etext;
+#endif
+
+#ifdef CONFIG_KPROBES
+       start = (unsigned long)__start_rodata;
+#endif
+       
        end = (unsigned long)__end_rodata;
        start = (start + PAGE_SIZE - 1) & PAGE_MASK;
        end &= PAGE_MASK;
index 7e161c698af47cb98a766c8253c8596cfeeb4b74..10b9809ce821fa36be3dfebdb994ad635c2cf2ff 100644 (file)
@@ -75,7 +75,8 @@ static void flush_kernel_map(void *arg)
 
        /* When clflush is available always use it because it is
           much cheaper than WBINVD. */
-       if (!cpu_has_clflush)
+       /* clflush is still broken. Disable for now. */
+       if (1 || !cpu_has_clflush)
                asm volatile("wbinvd" ::: "memory");
        else list_for_each_entry(pg, l, lru) {
                void *adr = page_address(pg);
index 65d82736987e600b642646f4d14e515b4fc020fc..4095e4d66a1d9345b236ee514260db23cf94c64b 100644 (file)
@@ -66,13 +66,13 @@ static int pci_mmcfg_read(unsigned int seg, unsigned int bus,
 
        switch (len) {
        case 1:
-               *value = readb(addr + reg);
+               *value = mmio_config_readb(addr + reg);
                break;
        case 2:
-               *value = readw(addr + reg);
+               *value = mmio_config_readw(addr + reg);
                break;
        case 4:
-               *value = readl(addr + reg);
+               *value = mmio_config_readl(addr + reg);
                break;
        }
 
@@ -94,13 +94,13 @@ static int pci_mmcfg_write(unsigned int seg, unsigned int bus,
 
        switch (len) {
        case 1:
-               writeb(value, addr + reg);
+               mmio_config_writeb(addr + reg, value);
                break;
        case 2:
-               writew(value, addr + reg);
+               mmio_config_writew(addr + reg, value);
                break;
        case 4:
-               writel(value, addr + reg);
+               mmio_config_writel(addr + reg, value);
                break;
        }
 
diff --git a/arch/x86_64/vdso/.gitignore b/arch/x86_64/vdso/.gitignore
new file mode 100644 (file)
index 0000000..f8b69d8
--- /dev/null
@@ -0,0 +1 @@
+vdso.lds
index d4cb83a6c0662fd3e48969c69031343384926be4..ff9333e5fb083af76a77a5707b1a0661ae76e1ff 100644 (file)
@@ -4,6 +4,7 @@
  * Subject to the GPL, v.2
  */
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/random.h>
index ca2ef4e08497f21a8f5f542031839f3e63e18b48..2484e0e9d89c9127c0678052b18bfa879b8a827d 100644 (file)
@@ -49,8 +49,6 @@ config LSF
 
          If unsure, say Y.
 
-endif # BLOCK
-
 config BLK_DEV_BSG
        bool "Block layer SG support v4 (EXPERIMENTAL)"
        depends on EXPERIMENTAL
@@ -64,4 +62,6 @@ config BLK_DEV_BSG
        protocols (e.g. Task Management Functions and SMP in Serial
        Attached SCSI).
 
+endif # BLOCK
+
 source block/Kconfig.iosched
index 20c3e22587b50f390a739176c6f2174de5b358e3..20fa034ea4a219d2906cdb27680c039beffa9f85 100644 (file)
@@ -41,7 +41,7 @@ static void trace_note(struct blk_trace *bt, pid_t pid, int action,
                const int cpu = smp_processor_id();
 
                t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
-               t->time = sched_clock() - per_cpu(blk_trace_cpu_offset, cpu);
+               t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu);
                t->device = bt->dev;
                t->action = action;
                t->pid = pid;
@@ -159,7 +159,7 @@ void __blk_add_trace(struct blk_trace *bt, sector_t sector, int bytes,
 
                t->magic = BLK_IO_TRACE_MAGIC | BLK_IO_TRACE_VERSION;
                t->sequence = ++(*sequence);
-               t->time = sched_clock() - per_cpu(blk_trace_cpu_offset, cpu);
+               t->time = cpu_clock(cpu) - per_cpu(blk_trace_cpu_offset, cpu);
                t->sector = sector;
                t->bytes = bytes;
                t->action = what;
@@ -488,17 +488,17 @@ void blk_trace_shutdown(struct request_queue *q)
 }
 
 /*
- * Average offset over two calls to sched_clock() with a gettimeofday()
+ * Average offset over two calls to cpu_clock() with a gettimeofday()
  * in the middle
  */
-static void blk_check_time(unsigned long long *t)
+static void blk_check_time(unsigned long long *t, int this_cpu)
 {
        unsigned long long a, b;
        struct timeval tv;
 
-       a = sched_clock();
+       a = cpu_clock(this_cpu);
        do_gettimeofday(&tv);
-       b = sched_clock();
+       b = cpu_clock(this_cpu);
 
        *t = tv.tv_sec * 1000000000 + tv.tv_usec * 1000;
        *t -= (a + b) / 2;
@@ -510,16 +510,16 @@ static void blk_check_time(unsigned long long *t)
 static void blk_trace_check_cpu_time(void *data)
 {
        unsigned long long *t;
-       int cpu = get_cpu();
+       int this_cpu = get_cpu();
 
-       t = &per_cpu(blk_trace_cpu_offset, cpu);
+       t = &per_cpu(blk_trace_cpu_offset, this_cpu);
 
        /*
         * Just call it twice, hopefully the second call will be cache hot
         * and a little more precise
         */
-       blk_check_time(t);
-       blk_check_time(t);
+       blk_check_time(t, this_cpu);
+       blk_check_time(t, this_cpu);
 
        put_cpu();
 }
index 3b2f05258a9278d1b51b4b842e4da5784aa4eaed..ed264682723465793f0c947143e4a9fcd7ed5c93 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * bsg.c - block layer implementation of the sg v3 interface
+ * bsg.c - block layer implementation of the sg v4 interface
  *
  * Copyright (C) 2004 Jens Axboe <axboe@suse.de> SUSE Labs
  * Copyright (C) 2004 Peter M. Jones <pjones@redhat.com>
@@ -9,13 +9,6 @@
  *  archive for more details.
  *
  */
-/*
- * TODO
- *     - Should this get merged, block/scsi_ioctl.c will be migrated into
- *       this file. To keep maintenance down, it's easier to have them
- *       seperated right now.
- *
- */
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/file.h>
@@ -24,6 +17,7 @@
 #include <linux/cdev.h>
 #include <linux/percpu.h>
 #include <linux/uio.h>
+#include <linux/idr.h>
 #include <linux/bsg.h>
 
 #include <scsi/scsi.h>
@@ -70,13 +64,12 @@ enum {
 #endif
 
 static DEFINE_MUTEX(bsg_mutex);
-static int bsg_device_nr, bsg_minor_idx;
+static DEFINE_IDR(bsg_minor_idr);
 
 #define BSG_LIST_ARRAY_SIZE    8
 static struct hlist_head bsg_device_list[BSG_LIST_ARRAY_SIZE];
 
 static struct class *bsg_class;
-static LIST_HEAD(bsg_class_list);
 static int bsg_major;
 
 static struct kmem_cache *bsg_cmd_cachep;
@@ -92,7 +85,6 @@ struct bsg_command {
        struct bio *bidi_bio;
        int err;
        struct sg_io_v4 hdr;
-       struct sg_io_v4 __user *uhdr;
        char sense[SCSI_SENSE_BUFFERSIZE];
 };
 
@@ -429,7 +421,6 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
        hdr->info = 0;
        if (hdr->device_status || hdr->transport_status || hdr->driver_status)
                hdr->info |= SG_INFO_CHECK;
-       hdr->din_resid = rq->data_len;
        hdr->response_len = 0;
 
        if (rq->sense_len && hdr->response) {
@@ -445,9 +436,14 @@ static int blk_complete_sgv4_hdr_rq(struct request *rq, struct sg_io_v4 *hdr,
        }
 
        if (rq->next_rq) {
+               hdr->dout_resid = rq->data_len;
+               hdr->din_resid = rq->next_rq->data_len;
                blk_rq_unmap_user(bidi_bio);
                blk_put_request(rq->next_rq);
-       }
+       } else if (rq_data_dir(rq) == READ)
+               hdr->din_resid = rq->data_len;
+       else
+               hdr->dout_resid = rq->data_len;
 
        blk_rq_unmap_user(bio);
        blk_put_request(rq);
@@ -620,7 +616,6 @@ static int __bsg_write(struct bsg_device *bd, const char __user *buf,
                        break;
                }
 
-               bc->uhdr = (struct sg_io_v4 __user *) buf;
                if (copy_from_user(&bc->hdr, buf, sizeof(bc->hdr))) {
                        ret = -EFAULT;
                        break;
@@ -781,23 +776,18 @@ static struct bsg_device *__bsg_get_device(int minor)
 
 static struct bsg_device *bsg_get_device(struct inode *inode, struct file *file)
 {
-       struct bsg_device *bd = __bsg_get_device(iminor(inode));
-       struct bsg_class_device *bcd, *__bcd;
+       struct bsg_device *bd;
+       struct bsg_class_device *bcd;
 
+       bd = __bsg_get_device(iminor(inode));
        if (bd)
                return bd;
 
        /*
         * find the class device
         */
-       bcd = NULL;
        mutex_lock(&bsg_mutex);
-       list_for_each_entry(__bcd, &bsg_class_list, list) {
-               if (__bcd->minor == iminor(inode)) {
-                       bcd = __bcd;
-                       break;
-               }
-       }
+       bcd = idr_find(&bsg_minor_idr, iminor(inode));
        mutex_unlock(&bsg_mutex);
 
        if (!bcd)
@@ -936,13 +926,12 @@ void bsg_unregister_queue(struct request_queue *q)
                return;
 
        mutex_lock(&bsg_mutex);
+       idr_remove(&bsg_minor_idr, bcd->minor);
        sysfs_remove_link(&q->kobj, "bsg");
        class_device_unregister(bcd->class_dev);
        put_device(bcd->dev);
        bcd->class_dev = NULL;
        bcd->dev = NULL;
-       list_del_init(&bcd->list);
-       bsg_device_nr--;
        mutex_unlock(&bsg_mutex);
 }
 EXPORT_SYMBOL_GPL(bsg_unregister_queue);
@@ -950,9 +939,9 @@ EXPORT_SYMBOL_GPL(bsg_unregister_queue);
 int bsg_register_queue(struct request_queue *q, struct device *gdev,
                       const char *name)
 {
-       struct bsg_class_device *bcd, *__bcd;
+       struct bsg_class_device *bcd;
        dev_t dev;
-       int ret = -EMFILE;
+       int ret, minor;
        struct class_device *class_dev = NULL;
        const char *devname;
 
@@ -969,28 +958,26 @@ int bsg_register_queue(struct request_queue *q, struct device *gdev,
 
        bcd = &q->bsg_dev;
        memset(bcd, 0, sizeof(*bcd));
-       INIT_LIST_HEAD(&bcd->list);
 
        mutex_lock(&bsg_mutex);
-       if (bsg_device_nr == BSG_MAX_DEVS) {
-               printk(KERN_ERR "bsg: too many bsg devices\n");
-               goto err;
-       }
 
-retry:
-       list_for_each_entry(__bcd, &bsg_class_list, list) {
-               if (__bcd->minor == bsg_minor_idx) {
-                       bsg_minor_idx++;
-                       if (bsg_minor_idx == BSG_MAX_DEVS)
-                               bsg_minor_idx = 0;
-                       goto retry;
-               }
+       ret = idr_pre_get(&bsg_minor_idr, GFP_KERNEL);
+       if (!ret) {
+               ret = -ENOMEM;
+               goto unlock;
        }
 
-       bcd->minor = bsg_minor_idx++;
-       if (bsg_minor_idx == BSG_MAX_DEVS)
-               bsg_minor_idx = 0;
+       ret = idr_get_new(&bsg_minor_idr, bcd, &minor);
+       if (ret < 0)
+               goto unlock;
+
+       if (minor >= BSG_MAX_DEVS) {
+               printk(KERN_ERR "bsg: too many bsg devices\n");
+               ret = -EINVAL;
+               goto remove_idr;
+       }
 
+       bcd->minor = minor;
        bcd->queue = q;
        bcd->dev = get_device(gdev);
        dev = MKDEV(bsg_major, bcd->minor);
@@ -998,27 +985,26 @@ retry:
                                        devname);
        if (IS_ERR(class_dev)) {
                ret = PTR_ERR(class_dev);
-               goto err_put;
+               goto put_dev;
        }
        bcd->class_dev = class_dev;
 
        if (q->kobj.sd) {
                ret = sysfs_create_link(&q->kobj, &bcd->class_dev->kobj, "bsg");
                if (ret)
-                       goto err_unregister;
+                       goto unregister_class_dev;
        }
 
-       list_add_tail(&bcd->list, &bsg_class_list);
-       bsg_device_nr++;
-
        mutex_unlock(&bsg_mutex);
        return 0;
 
-err_unregister:
+unregister_class_dev:
        class_device_unregister(class_dev);
-err_put:
+put_dev:
        put_device(gdev);
-err:
+remove_idr:
+       idr_remove(&bsg_minor_idr, minor);
+unlock:
        mutex_unlock(&bsg_mutex);
        return ret;
 }
index 8c2caff87cc342819d53eb893f82269ea2205dec..a15845c164f298c97854e21e1c7d79019af646a6 100644 (file)
@@ -3047,6 +3047,10 @@ static inline void blk_partition_remap(struct bio *bio)
 
                bio->bi_sector += p->start_sect;
                bio->bi_bdev = bdev->bd_contains;
+
+               blk_add_trace_remap(bdev_get_queue(bio->bi_bdev), bio,
+                                   bdev->bd_dev, bio->bi_sector,
+                                   bio->bi_sector - p->start_sect);
        }
 }
 
index 1c166b47b4cc5b5a627c9ab5a8821d7f4f482779..3dbb1cc6eab52f5eeba3767f52a6e8225c8d4173 100644 (file)
@@ -35,7 +35,7 @@ static int setkey_unaligned(struct crypto_ablkcipher *tfm, const u8 *key, unsign
        alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
        memcpy(alignbuffer, key, keylen);
        ret = cipher->setkey(tfm, alignbuffer, keylen);
-       memset(alignbuffer, 0, absize);
+       memset(alignbuffer, 0, keylen);
        kfree(buffer);
        return ret;
 }
index 40a3dcff15bb89a95ffc4377eb22dc1e24f46e6c..7755834b8846e450d53cac256032295ed7b88830 100644 (file)
@@ -352,7 +352,7 @@ static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, unsigned int
        alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
        memcpy(alignbuffer, key, keylen);
        ret = cipher->setkey(tfm, alignbuffer, keylen);
-       memset(alignbuffer, 0, absize);
+       memset(alignbuffer, 0, keylen);
        kfree(buffer);
        return ret;
 }
index 0b2650c2014be315703365cd8e040d380c6d447b..fc6b46f2a9b0d495724f32113e18652498cf1035 100644 (file)
@@ -36,7 +36,7 @@ static int setkey_unaligned(struct crypto_tfm *tfm, const u8 *key, unsigned int
        alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
        memcpy(alignbuffer, key, keylen);
        ret = cia->cia_setkey(tfm, alignbuffer, keylen);
-       memset(alignbuffer, 0, absize);
+       memset(alignbuffer, 0, keylen);
        kfree(buffer);
        return ret;
 
index 4d75ca7b57b207fd2466b8adc03e0d42615150e7..4fd470bd729bef90bd9f606dbf43b9367f374165 100644 (file)
@@ -40,7 +40,7 @@ static int hash_setkey_unaligned(struct crypto_hash *crt, const u8 *key,
        alignbuffer = (u8 *)ALIGN((unsigned long)buffer, alignmask + 1);
        memcpy(alignbuffer, key, keylen);
        ret = alg->setkey(crt, alignbuffer, keylen);
-       memset(alignbuffer, 0, absize);
+       memset(alignbuffer, 0, keylen);
        kfree(buffer);
        return ret;
 }
index a9e4c5f922a041b094d219b5581398e8035ef1e4..f0878b2ec55ea47d5a87f5069890cca4e5de7ca3 100644 (file)
@@ -66,6 +66,7 @@ obj-y                         += i2c/
 obj-$(CONFIG_W1)               += w1/
 obj-$(CONFIG_POWER_SUPPLY)     += power/
 obj-$(CONFIG_HWMON)            += hwmon/
+obj-$(CONFIG_WATCHDOG)         += char/watchdog/
 obj-$(CONFIG_PHONE)            += telephony/
 obj-$(CONFIG_MD)               += md/
 obj-$(CONFIG_BT)               += bluetooth/
diff --git a/drivers/acorn/README b/drivers/acorn/README
deleted file mode 100644 (file)
index d399c09..0000000
+++ /dev/null
@@ -1 +0,0 @@
-Drivers for the ACORN "podule" ARM specific bus.
diff --git a/drivers/acorn/block/Kconfig b/drivers/acorn/block/Kconfig
deleted file mode 100644 (file)
index a0ff25e..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-#
-# Block device driver configuration
-#
-
-menu "Acorn-specific block devices"
-       depends on ARCH_ARC || ARCH_A5K
-
-config BLK_DEV_FD1772
-       tristate "Old Archimedes floppy (1772) support"
-       depends on ARCH_ARC || ARCH_A5K
-       help
-         Support the floppy drive on the Acorn Archimedes (A300, A4x0, A540,
-         R140 and R260) series of computers; it supports only 720K floppies
-         at the moment. If you don't have one of these machines just answer
-         N.
-
-config BLK_DEV_MFM
-       tristate "MFM harddisk support"
-       depends on ARCH_ARC || ARCH_A5K
-       help
-         Support the MFM hard drives on the Acorn Archimedes both
-         on-board the A4x0 motherboards and via the Acorn MFM podules.
-         Drives up to 64MB are supported. If you haven't got one of these
-         machines or drives just say N.
-
-config BLK_DEV_MFM_AUTODETECT
-       bool "Autodetect hard drive geometry"
-       depends on BLK_DEV_MFM
-       help
-         If you answer Y, the MFM code will attempt to automatically detect
-         the cylinders/heads/sectors count on your hard drive. WARNING: This
-         sometimes doesn't work and it also does some dodgy stuff which
-         potentially might damage your drive.
-
-endmenu
-
diff --git a/drivers/acorn/block/Makefile b/drivers/acorn/block/Makefile
deleted file mode 100644 (file)
index 38a9afe..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#
-# Makefile for the Acorn block device drivers.
-#
-
-fd1772_mod-objs        := fd1772.o fd1772dma.o
-mfmhd_mod-objs := mfmhd.o mfm.o
-
-obj-$(CONFIG_BLK_DEV_FD1772)   += fd1772_mod.o
-obj-$(CONFIG_BLK_DEV_MFM)      += mfmhd_mod.o
diff --git a/drivers/acorn/block/fd1772.c b/drivers/acorn/block/fd1772.c
deleted file mode 100644 (file)
index d7e18ce..0000000
+++ /dev/null
@@ -1,1604 +0,0 @@
-/*
- *  linux/kernel/arch/arm/drivers/block/fd1772.c
- *  Based on ataflop.c in the m68k Linux
- *  Copyright (C) 1993  Greg Harp
- *  Atari Support by Bjoern Brauel, Roman Hodek
- *  Archimedes Support by Dave Gilbert (linux@treblig.org)
- *
- *  Big cleanup Sep 11..14 1994 Roman Hodek:
- *   - Driver now works interrupt driven
- *   - Support for two drives; should work, but I cannot test that :-(
- *   - Reading is done in whole tracks and buffered to speed up things
- *   - Disk change detection and drive deselecting after motor-off
- *     similar to TOS
- *   - Autodetection of disk format (DD/HD); untested yet, because I
- *     don't have an HD drive :-(
- *
- *  Fixes Nov 13 1994 Martin Schaller:
- *   - Autodetection works now
- *   - Support for 5 1/4" disks
- *   - Removed drive type (unknown on atari)
- *   - Do seeks with 8 Mhz
- *
- *  Changes by Andreas Schwab:
- *   - After errors in multiple read mode try again reading single sectors
- *  (Feb 1995):
- *   - Clean up error handling
- *   - Set blk_size for proper size checking
- *   - Initialize track register when testing presence of floppy
- *   - Implement some ioctl's
- *
- *  Changes by Torsten Lang:
- *   - When probing the floppies we should add the FDC1772CMDADD_H flag since
- *     the FDC1772 will otherwise wait forever when no disk is inserted...
- *
- *  Things left to do:
- *   - Formatting
- *   - Maybe a better strategy for disk change detection (does anyone
- *     know one?)
- *   - There are some strange problems left: The strangest one is
- *     that, at least on my TT (4+4MB), the first 2 Bytes of the last
- *     page of the TT-Ram (!) change their contents (some bits get
- *     set) while a floppy DMA is going on. But there are no accesses
- *     to these memory locations from the kernel... (I tested that by
- *     making the page read-only). I cannot explain what's going on...
- *   - Sometimes the drive-change-detection stops to work. The
- *     function is still called, but the WP bit always reads as 0...
- *     Maybe a problem with the status reg mode or a timing problem.
- *     Note 10/12/94: The change detection now seems to work reliably.
- *     There is no proof, but I've seen no hang for a long time...
- *
- * ARCHIMEDES changes: (gilbertd@cs.man.ac.uk)
- *     26/12/95 - Changed all names starting with FDC to FDC1772
- *                Removed all references to clock speed of FDC - we're stuck with 8MHz
- *                Modified disk_type structure to remove HD formats
- *
- *      7/ 1/96 - Wrote FIQ code, removed most remaining atariisms
- *
- *     13/ 1/96 - Well I think its read a single sector; but there is a problem
- *                fd_rwsec_done which is called in FIQ mode starts another transfer
- *                off (in fd_rwsec) while still in FIQ mode.  Because its still in
- *                FIQ mode it can't service the DMA and loses data. So need to
- *                heavily restructure.
- *     14/ 1/96 - Found that the definitions of the register numbers of the
- *                FDC were multiplied by 2 in the header for the 16bit words
- *                of the atari so half the writes were going in the wrong place.
- *                Also realised that the FIQ entry didn't make any attempt to
- *                preserve registers or return correctly; now in assembler.
- *
- *     11/ 2/96 - Hmm - doesn't work on real machine.  Auto detect doesn't
- *                and hacking that past seems to wait forever - check motor
- *                being turned on.
- *
- *     17/ 2/96 - still having problems - forcing track to -1 when selecting
- *                new drives seems to allow it to read first few sectors
- *                but then we get solid hangs at apparently random places
- *                which change depending what is happening.
- *
- *      9/ 3/96 - Fiddled a lot of stuff around to move to kernel 1.3.35
- *                A lot of fiddling in DMA stuff. Having problems with it
- *                constnatly thinking its timeing out. Ah - its timeout
- *                was set to (6*HZ) rather than jiffies+(6*HZ).  Now giving
- *                duff data!
- *
- *      5/ 4/96 - Made it use the new IOC_ macros rather than *ioc
- *                Hmm - giving unexpected FIQ and then timeouts
- *     18/ 8/96 - Ran through indent -kr -i8
- *                Some changes to disc change detect; don't know how well it
- *                works.
- *     24/ 8/96 - Put all the track buffering code back in from the atari
- *                code - I wonder if it will still work... No :-)
- *                Still works if I turn off track buffering.
- *     25/ 8/96 - Changed the timer expires that I'd added back to be 
- *                jiffies + ....; and it all sprang to life! Got 2.8K/sec
- *                off a cp -r of a 679K disc (showed 94% cpu usage!)
- *                (PC gets 14.3K/sec - 0% CPU!) Hmm - hard drive corrupt!
- *                Also perhaps that compile was with cache off.
- *                changed cli in fd_readtrack_check to cliIF
- *                changed vmallocs to kmalloc (whats the difference!!)
- *                Removed the busy wait loop in do_fd_request and replaced
- *                by a routine on tq_immediate; only 11% cpu on a dd off the
- *                raw disc - but the speed is the same.
- *     1/ 9/96 - Idea (failed!) - set the 'disable spin-up sequence'
- *               when we read the track if we know the motor is on; didn't
- *               help - perhaps we have to do it in stepping as well.
- *               Nope. Still doesn't help.
- *               Hmm - what seems to be happening is that fd_readtrack_check
- *               is never getting called. Its job is to terminate the read
- *               just after we think we should have got the data; otherwise
- *               the fdc takes 1 second to timeout; which is what's happening
- *               Now I can see 'readtrack_timer' being set (which should do the
- *               call); but it never seems to be called - hmm!
- *               OK - I've moved the check to my tq_immediate code -
- *               and it WORKS! 13.95K/second at 19% CPU.
- *               I wish I knew why that timer didn't work.....
- *
- *     16/11/96 - Fiddled and frigged for 2.0.18
- *
- * DAG 30/01/99 - Started frobbing for 2.2.1
- * DAG 20/06/99 - A little more frobbing:
- *               Included include/asm/uaccess.h for get_user/put_user
- *
- * DAG  1/09/00 - Dusted off for 2.4.0-test7
- *                MAX_SECTORS was name clashing so it is now FD1772_...
- *                Minor parameter, name layouts for 2.4.x differences
- */
-
-#include <linux/sched.h>
-#include <linux/fs.h>
-#include <linux/fcntl.h>
-#include <linux/slab.h>
-#include <linux/kernel.h>
-#include <linux/interrupt.h>
-#include <linux/timer.h>
-#include <linux/workqueue.h>
-#include <linux/fd.h>
-#include <linux/fd1772.h>
-#include <linux/errno.h>
-#include <linux/types.h>
-#include <linux/delay.h>
-#include <linux/mm.h>
-#include <linux/bitops.h>
-
-#include <asm/arch/oldlatches.h>
-#include <asm/dma.h>
-#include <asm/hardware.h>
-#include <asm/hardware/ioc.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-#include <asm/pgtable.h>
-#include <asm/system.h>
-#include <asm/uaccess.h>
-
-
-/* Note: FD_MAX_UNITS could be redefined to 2 for the Atari (with
- * little additional rework in this file). But I'm not yet sure if
- * some other code depends on the number of floppies... (It is defined
- * in a public header!)
- */
-#if 0
-#undef FD_MAX_UNITS
-#define        FD_MAX_UNITS    2
-#endif
-
-/* Ditto worries for Arc - DAG */
-#define FD_MAX_UNITS 4
-#define TRACKBUFFER 0
-/*#define DEBUG*/
-
-#ifdef DEBUG
-#define DPRINT(a)      printk a
-#else
-#define DPRINT(a)
-#endif
-
-static struct request_queue *floppy_queue;
-
-#define MAJOR_NR FLOPPY_MAJOR
-#define FLOPPY_DMA 0
-#define DEVICE_NAME "floppy"
-#define QUEUE (floppy_queue)
-#define CURRENT elv_next_request(floppy_queue)
-
-/* Disk types: DD */
-static struct archy_disk_type {
-       const char *name;
-       unsigned spt;           /* sectors per track */
-       unsigned blocks;        /* total number of blocks */
-       unsigned stretch;       /* track doubling ? */
-} disk_type[] = {
-
-       { "d360", 9, 720, 0 },                  /* 360kB diskette */
-       { "D360", 9, 720, 1 },                  /* 360kb in 720kb drive */
-       { "D720", 9, 1440, 0 },                 /* 720kb diskette (DD) */
-       /*{ "D820", 10,1640, 0}, *//* DD disk with 82 tracks/10 sectors 
-                                     - DAG - can't see how type detect can distinguish this
-                                     from 720K until it reads block 4 by which time its too late! */
-};
-
-#define        NUM_DISK_TYPES (sizeof(disk_type)/sizeof(*disk_type))
-
-/*
- * Maximum disk size (in kilobytes). This default is used whenever the
- * current disk size is unknown.
- */
-#define MAX_DISK_SIZE 720
-
-static struct gendisk *disks[FD_MAX_UNIT];
-
-/* current info on each unit */
-static struct archy_floppy_struct {
-       int connected;          /* !=0 : drive is connected */
-       int autoprobe;          /* !=0 : do autoprobe       */
-
-       struct archy_disk_type *disktype;       /* current type of disk */
-
-       int track;              /* current head position or -1
-                                  * if unknown */
-       unsigned int steprate;  /* steprate setting */
-       unsigned int wpstat;    /* current state of WP signal
-                                  * (for disk change detection) */
-} unit[FD_MAX_UNITS];
-
-/* DAG: On Arc we spin on a flag being cleared by fdc1772_comendhandler which
-   is an assembler routine */
-extern void fdc1772_comendhandler(void);       /* Actually doens't have these parameters - see fd1772.S */
-extern volatile int fdc1772_comendstatus;
-extern volatile int fdc1772_fdc_int_done;
-
-#define FDC1772BASE ((0x210000>>2)|0x80000000)
-
-#define FDC1772_READ(reg) inb(FDC1772BASE+(reg/2))
-
-/* DAG: You wouldn't be silly to ask why FDC1772_WRITE is a function rather
-   than the #def below - well simple - the #def won't compile - and I
-   don't understand why (__outwc not defined) */
-/* NOTE: Reg is 0,2,4,6 as opposed to 0,1,2,3 or 0,4,8,12 to keep compatibility
-   with the ST version of fd1772.h */
-/*#define FDC1772_WRITE(reg,val) outw(val,(reg+FDC1772BASE)); */
-void FDC1772_WRITE(int reg, unsigned char val)
-{
-       if (reg == FDC1772REG_CMD) {
-               DPRINT(("FDC1772_WRITE new command 0x%x @ %d\n", val,jiffies));
-               if (fdc1772_fdc_int_done) {
-                       DPRINT(("FDC1772_WRITE: Hmm fdc1772_fdc_int_done true - resetting\n"));
-                       fdc1772_fdc_int_done = 0;
-               };
-       };
-       outb(val, (reg / 2) + FDC1772BASE);
-};
-
-#define        FD1772_MAX_SECTORS      22
-
-unsigned char *DMABuffer;      /* buffer for writes */
-/*static unsigned long PhysDMABuffer; *//* physical address */
-/* DAG: On Arc we just go straight for the DMA buffer */
-#define PhysDMABuffer DMABuffer
-
-#ifdef TRACKBUFFER   
-unsigned char *TrackBuffer;       /* buffer for reads */
-#define PhysTrackBuffer TrackBuffer /* physical address */
-static int BufferDrive, BufferSide, BufferTrack;
-static int read_track;    /* non-zero if we are reading whole tracks */
-  
-#define SECTOR_BUFFER(sec)  (TrackBuffer + ((sec)-1)*512)
-#define IS_BUFFERED(drive,side,track) \
-    (BufferDrive == (drive) && BufferSide == (side) && BufferTrack == (track))
-#endif
-
-/*
- * These are global variables, as that's the easiest way to give
- * information to interrupts. They are the data used for the current
- * request.
- */
-static int SelectedDrive = 0;
-static int ReqCmd, ReqBlock;
-static int ReqSide, ReqTrack, ReqSector, ReqCnt;
-static int HeadSettleFlag = 0;
-static unsigned char *ReqData, *ReqBuffer;
-static int MotorOn = 0, MotorOffTrys;
-
-/* Synchronization of FDC1772 access. */
-static volatile int fdc_busy = 0;
-static DECLARE_WAIT_QUEUE_HEAD(fdc_wait);
-
-
-/* long req'd for set_bit --RR */
-static unsigned long changed_floppies = 0xff, fake_change = 0;
-#define        CHECK_CHANGE_DELAY      HZ/2
-
-/* DAG - increased to 30*HZ - not sure if this is the correct thing to do */
-#define        FD_MOTOR_OFF_DELAY      (10*HZ)
-#define        FD_MOTOR_OFF_MAXTRY     (10*20)
-
-#define FLOPPY_TIMEOUT         (6*HZ)
-#define RECALIBRATE_ERRORS     4       /* After this many errors the drive
-                                        * will be recalibrated. */
-#define MAX_ERRORS             8       /* After this many errors the driver
-                                        * will give up. */
-
-#define        START_MOTOR_OFF_TIMER(delay)                            \
-       do {                                                    \
-               motor_off_timer.expires = jiffies + (delay);    \
-               add_timer( &motor_off_timer );                  \
-               MotorOffTrys = 0;                               \
-       } while(0)
-
-#define        START_CHECK_CHANGE_TIMER(delay)                         \
-       do {                                                    \
-               mod_timer(&fd_timer, jiffies + (delay));        \
-       } while(0)
-
-#define        START_TIMEOUT()                                         \
-       do {                                                    \
-               mod_timer(&timeout_timer, jiffies+FLOPPY_TIMEOUT); \
-       } while(0)
-
-#define        STOP_TIMEOUT()                                          \
-       do {                                                    \
-               del_timer( &timeout_timer );                    \
-       } while(0)
-
-#define ENABLE_IRQ() enable_irq(FIQ_FD1772+64);
-
-#define DISABLE_IRQ() disable_irq(FIQ_FD1772+64);
-
-static void fd1772_checkint(void);
-
-DECLARE_WORK(fd1772_tq, (void *)fd1772_checkint, NULL);
-/*
- * The driver is trying to determine the correct media format
- * while Probing is set. fd_rwsec_done() clears it after a
- * successful access.
- */
-static int Probing = 0;
-
-/* This flag is set when a dummy seek is necessary to make the WP
- * status bit accessible.
- */
-static int NeedSeek = 0;
-
-
-/***************************** Prototypes *****************************/
-
-static void fd_select_side(int side);
-static void fd_select_drive(int drive);
-static void fd_deselect(void);
-static void fd_motor_off_timer(unsigned long dummy);
-static void check_change(unsigned long dummy);
-static void floppy_irqconsequencehandler(void);
-static void fd_error(void);
-static void do_fd_action(int drive);
-static void fd_calibrate(void);
-static void fd_calibrate_done(int status);
-static void fd_seek(void);
-static void fd_seek_done(int status);
-static void fd_rwsec(void);
-#ifdef TRACKBUFFER   
-static void fd_readtrack_check( unsigned long dummy );  
-#endif
-static void fd_rwsec_done(int status);
-static void fd_times_out(unsigned long dummy);
-static void finish_fdc(void);
-static void finish_fdc_done(int dummy);
-static void floppy_off(unsigned int nr);
-static void setup_req_params(int drive);
-static void redo_fd_request(void);
-static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int
-                   cmd, unsigned long param);
-static void fd_probe(int drive);
-static int fd_test_drive_present(int drive);
-static void config_types(void);
-static int floppy_open(struct inode *inode, struct file *filp);
-static int floppy_release(struct inode *inode, struct file *filp);
-static void do_fd_request(struct request_queue *);
-
-/************************* End of Prototypes **************************/
-
-static DEFINE_TIMER(motor_off_timer, fd_motor_off_timer, 0, 0);
-
-#ifdef TRACKBUFFER
-static DEFINE_TIMER(readtrack_timer, fd_readtrack_check, 0, 0);
-#endif
-
-static DEFINE_TIMER(timeout_timer, fd_times_out, 0, 0);
-
-static DEFINE_TIMER(fd_timer, check_change, 0, 0);
-
-/* DAG: Haven't got a clue what this is? */
-int stdma_islocked(void)
-{
-       return 0;
-};
-
-/* Select the side to use. */
-
-static void fd_select_side(int side)
-{
-       oldlatch_aupdate(LATCHA_SIDESEL, side ? 0 : LATCHA_SIDESEL);
-}
-
-
-/* Select a drive, update the FDC1772's track register
- */
-
-static void fd_select_drive(int drive)
-{
-#ifdef DEBUG
-       printk("fd_select_drive:%d\n", drive);
-#endif
-       /* Hmm - nowhere do we seem to turn the motor on - I'm going to do it here! */
-       oldlatch_aupdate(LATCHA_MOTOR | LATCHA_INUSE, 0);
-
-       if (drive == SelectedDrive)
-               return;
-
-       oldlatch_aupdate(LATCHA_FDSELALL, 0xf - (1 << drive));
-
-       /* restore track register to saved value */
-       FDC1772_WRITE(FDC1772REG_TRACK, unit[drive].track);
-       udelay(25);
-
-       SelectedDrive = drive;
-}
-
-
-/* Deselect both drives. */
-
-static void fd_deselect(void)
-{
-       unsigned long flags;
-
-       DPRINT(("fd_deselect\n"));
-
-       oldlatch_aupdate(LATCHA_FDSELALL | LATCHA_MOTOR | LATCHA_INUSE, 0xf | LATCHA_MOTOR | LATCHA_INUSE);
-
-       SelectedDrive = -1;
-}
-
-
-/* This timer function deselects the drives when the FDC1772 switched the
- * motor off. The deselection cannot happen earlier because the FDC1772
- * counts the index signals, which arrive only if one drive is selected.
- */
-
-static void fd_motor_off_timer(unsigned long dummy)
-{
-       unsigned long flags;
-       unsigned char status;
-       int delay;
-
-       del_timer(&motor_off_timer);
-
-       if (SelectedDrive < 0)
-               /* no drive selected, needn't deselect anyone */
-               return;
-
-       save_flags(flags);
-       cli();
-
-       if (fdc_busy)           /* was stdma_islocked */
-               goto retry;
-
-       status = FDC1772_READ(FDC1772REG_STATUS);
-
-       if (!(status & 0x80)) {
-               /*
-                * motor already turned off by FDC1772 -> deselect drives
-                * In actual fact its this deselection which turns the motor
-                * off on the Arc, since the motor control is actually on
-                * Latch A
-                */
-               DPRINT(("fdc1772: deselecting in fd_motor_off_timer\n"));
-               fd_deselect();
-               MotorOn = 0;
-               restore_flags(flags);
-               return;
-       }
-       /* not yet off, try again */
-
-retry:
-       restore_flags(flags);
-       /* Test again later; if tested too often, it seems there is no disk
-        * in the drive and the FDC1772 will leave the motor on forever (or,
-        * at least until a disk is inserted). So we'll test only twice
-        * per second from then on...
-        */
-       delay = (MotorOffTrys < FD_MOTOR_OFF_MAXTRY) ?
-           (++MotorOffTrys, HZ / 20) : HZ / 2;
-       START_MOTOR_OFF_TIMER(delay);
-}
-
-
-/* This function is repeatedly called to detect disk changes (as good
- * as possible) and keep track of the current state of the write protection.
- */
-
-static void check_change(unsigned long dummy)
-{
-       static int drive = 0;
-
-       unsigned long flags;
-       int stat;
-
-       if (fdc_busy)
-               return;         /* Don't start poking about if the fdc is busy */
-
-       return;                 /* let's just forget it for the mo DAG */
-
-       if (++drive > 1 || !unit[drive].connected)
-               drive = 0;
-
-       save_flags(flags);
-       cli();
-
-       if (!stdma_islocked()) {
-               stat = !!(FDC1772_READ(FDC1772REG_STATUS) & FDC1772STAT_WPROT);
-
-               /* The idea here is that if the write protect line has changed then
-               the disc must have changed */
-               if (stat != unit[drive].wpstat) {
-                       DPRINT(("wpstat[%d] = %d\n", drive, stat));
-                       unit[drive].wpstat = stat;
-                       set_bit(drive, &changed_floppies);
-               }
-       }
-       restore_flags(flags);
-
-       START_CHECK_CHANGE_TIMER(CHECK_CHANGE_DELAY);
-}
-
-
-/* Handling of the Head Settling Flag: This flag should be set after each
- * seek operation, because we don't use seeks with verify.
- */
-
-static inline void set_head_settle_flag(void)
-{
-       HeadSettleFlag = FDC1772CMDADD_E;
-}
-
-static inline int get_head_settle_flag(void)
-{
-       int tmp = HeadSettleFlag;
-       HeadSettleFlag = 0;
-       return (tmp);
-}
-
-
-
-
-/* General Interrupt Handling */
-
-static inline void copy_buffer(void *from, void *to)
-{
-       ulong *p1 = (ulong *) from, *p2 = (ulong *) to;
-       int cnt;
-
-       for (cnt = 512 / 4; cnt; cnt--)
-               *p2++ = *p1++;
-}
-
-static void (*FloppyIRQHandler) (int status) = NULL;
-
-static void floppy_irqconsequencehandler(void)
-{
-       unsigned char status;
-       void (*handler) (int);
-
-       fdc1772_fdc_int_done = 0;
-
-       handler = FloppyIRQHandler;
-       FloppyIRQHandler = NULL;
-
-       if (handler) {
-               nop();
-               status = (unsigned char) fdc1772_comendstatus;
-               DPRINT(("FDC1772 irq, status = %02x handler = %08lx\n", (unsigned int) status, (unsigned long) handler));
-               handler(status);
-       } else {
-               DPRINT(("FDC1772 irq, no handler status=%02x\n", fdc1772_comendstatus));
-       }
-       DPRINT(("FDC1772 irq: end of floppy_irq\n"));
-}
-
-
-/* Error handling: If some error happened, retry some times, then
- * recalibrate, then try again, and fail after MAX_ERRORS.
- */
-
-static void fd_error(void)
-{
-       printk("FDC1772: fd_error\n");
-       /*panic("fd1772: fd_error"); *//* DAG tmp */
-       if (!CURRENT)
-               return;
-       CURRENT->errors++;
-       if (CURRENT->errors >= MAX_ERRORS) {
-               printk("fd%d: too many errors.\n", SelectedDrive);
-               end_request(CURRENT, 0);
-       } else if (CURRENT->errors == RECALIBRATE_ERRORS) {
-               printk("fd%d: recalibrating\n", SelectedDrive);
-               if (SelectedDrive != -1)
-                       unit[SelectedDrive].track = -1;
-       }
-       redo_fd_request();
-}
-
-
-
-#define        SET_IRQ_HANDLER(proc) do { FloppyIRQHandler = (proc); } while(0)
-
-
-/* do_fd_action() is the general procedure for a fd request: All
- * required parameter settings (drive select, side select, track
- * position) are checked and set if needed. For each of these
- * parameters and the actual reading or writing exist two functions:
- * one that starts the setting (or skips it if possible) and one
- * callback for the "done" interrupt. Each done func calls the next
- * set function to propagate the request down to fd_rwsec_done().
- */
-
-static void do_fd_action(int drive)
-{
-       struct request *req;
-       DPRINT(("do_fd_action unit[drive].track=%d\n", unit[drive].track));
-
-#ifdef TRACKBUFFER
-repeat:
-
-       if (IS_BUFFERED( drive, ReqSide, ReqTrack )) {
-               req = CURRENT;
-               if (ReqCmd == READ) {
-                       copy_buffer( SECTOR_BUFFER(ReqSector), ReqData );
-                       if (++ReqCnt < req->current_nr_sectors) {
-                               /* read next sector */
-                               setup_req_params( drive );
-                               goto repeat;
-                       } else {
-                               /* all sectors finished */
-                               req->nr_sectors -= req->current_nr_sectors;
-                               req->sector += req->current_nr_sectors;
-                               end_request(req, 1);
-                               redo_fd_request();
-                               return;
-                       }
-               } else {
-                       /* cmd == WRITE, pay attention to track buffer
-                        * consistency! */
-                       copy_buffer( ReqData, SECTOR_BUFFER(ReqSector) );
-               }
-       }
-#endif
-
-       if (SelectedDrive != drive) {
-               /*unit[drive].track = -1; DAG */
-               fd_select_drive(drive);
-       };
-
-
-       if (unit[drive].track == -1)
-               fd_calibrate();
-       else if (unit[drive].track != ReqTrack << unit[drive].disktype->stretch)
-               fd_seek();
-       else
-               fd_rwsec();
-}
-
-
-/* Seek to track 0 if the current track is unknown */
-
-static void fd_calibrate(void)
-{
-       DPRINT(("fd_calibrate\n"));
-       if (unit[SelectedDrive].track >= 0) {
-               fd_calibrate_done(0);
-               return;
-       }
-       DPRINT(("fd_calibrate (after track compare)\n"));
-       SET_IRQ_HANDLER(fd_calibrate_done);
-       /* we can't verify, since the speed may be incorrect */
-       FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_RESTORE | unit[SelectedDrive].steprate);
-
-       NeedSeek = 1;
-       MotorOn = 1;
-       START_TIMEOUT();
-       /* wait for IRQ */
-}
-
-
-static void fd_calibrate_done(int status)
-{
-       DPRINT(("fd_calibrate_done()\n"));
-       STOP_TIMEOUT();
-
-       /* set the correct speed now */
-       if (status & FDC1772STAT_RECNF) {
-               printk("fd%d: restore failed\n", SelectedDrive);
-               fd_error();
-       } else {
-               unit[SelectedDrive].track = 0;
-               fd_seek();
-       }
-}
-
-
-/* Seek the drive to the requested track. The drive must have been
- * calibrated at some point before this.
- */
-
-static void fd_seek(void)
-{
-       unsigned long flags;
-       DPRINT(("fd_seek() to track %d (unit[SelectedDrive].track=%d)\n", ReqTrack,
-               unit[SelectedDrive].track));
-       if (unit[SelectedDrive].track == ReqTrack <<
-           unit[SelectedDrive].disktype->stretch) {
-               fd_seek_done(0);
-               return;
-       }
-       FDC1772_WRITE(FDC1772REG_DATA, ReqTrack <<
-                     unit[SelectedDrive].disktype->stretch);
-       udelay(25);
-       save_flags(flags);
-       clf();
-       SET_IRQ_HANDLER(fd_seek_done);
-       FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_SEEK | unit[SelectedDrive].steprate |
-               /* DAG */
-               (MotorOn?FDC1772CMDADD_H:0));
-
-       restore_flags(flags);
-       MotorOn = 1;
-       set_head_settle_flag();
-       START_TIMEOUT();
-       /* wait for IRQ */
-}
-
-
-static void fd_seek_done(int status)
-{
-       DPRINT(("fd_seek_done()\n"));
-       STOP_TIMEOUT();
-
-       /* set the correct speed */
-       if (status & FDC1772STAT_RECNF) {
-               printk("fd%d: seek error (to track %d)\n",
-                      SelectedDrive, ReqTrack);
-               /* we don't know exactly which track we are on now! */
-               unit[SelectedDrive].track = -1;
-               fd_error();
-       } else {
-               unit[SelectedDrive].track = ReqTrack <<
-                   unit[SelectedDrive].disktype->stretch;
-               NeedSeek = 0;
-               fd_rwsec();
-       }
-}
-
-
-/* This does the actual reading/writing after positioning the head
- * over the correct track.
- */
-
-#ifdef TRACKBUFFER
-static int MultReadInProgress = 0;
-#endif
-
-
-static void fd_rwsec(void)
-{
-       unsigned long paddr, flags;
-       unsigned int rwflag, old_motoron;
-       unsigned int track;
-
-       DPRINT(("fd_rwsec(), Sec=%d, Access=%c\n", ReqSector, ReqCmd == WRITE ? 'w' : 'r'));
-       if (ReqCmd == WRITE) {
-               /*cache_push( (unsigned long)ReqData, 512 ); */
-               paddr = (unsigned long) ReqData;
-               rwflag = 0x100;
-       } else {
-               paddr = (unsigned long) PhysDMABuffer;
-#ifdef TRACKBUFFER
-               if (read_track)
-                       paddr = (unsigned long)PhysTrackBuffer;
-#endif
-               rwflag = 0;
-       }
-
-       DPRINT(("fd_rwsec() before sidesel rwflag=%d sec=%d trk=%d\n", rwflag,
-               ReqSector, FDC1772_READ(FDC1772REG_TRACK)));
-       fd_select_side(ReqSide);
-
-       /*DPRINT(("fd_rwsec() before start sector \n")); */
-       /* Start sector of this operation */
-#ifdef TRACKBUFFER
-       FDC1772_WRITE( FDC1772REG_SECTOR, !read_track ? ReqSector : 1 );
-#else
-       FDC1772_WRITE( FDC1772REG_SECTOR, ReqSector );
-#endif
-
-       /* Cheat for track if stretch != 0 */
-       if (unit[SelectedDrive].disktype->stretch) {
-               track = FDC1772_READ(FDC1772REG_TRACK);
-               FDC1772_WRITE(FDC1772REG_TRACK, track >>
-                             unit[SelectedDrive].disktype->stretch);
-       }
-       udelay(25);
-
-       DPRINT(("fd_rwsec() before setup DMA \n"));
-       /* Setup DMA - Heavily modified by DAG */
-       save_flags(flags);
-       clf();
-       disable_dma(FLOPPY_DMA);
-       set_dma_mode(FLOPPY_DMA, rwflag ? DMA_MODE_WRITE : DMA_MODE_READ);
-       set_dma_addr(FLOPPY_DMA, (long) paddr);         /* DAG - changed from Atari specific */
-#ifdef TRACKBUFFER
-       set_dma_count(FLOPPY_DMA,(!read_track ? 1 : unit[SelectedDrive].disktype->spt)*512);
-#else
-       set_dma_count(FLOPPY_DMA, 512);         /* Block/sector size - going to have to change */
-#endif
-       SET_IRQ_HANDLER(fd_rwsec_done);
-       /* Turn on dma int */
-       enable_dma(FLOPPY_DMA);
-       /* Now give it something to do */
-       FDC1772_WRITE(FDC1772REG_CMD, (rwflag ? (FDC1772CMD_WRSEC | FDC1772CMDADD_P) : 
-#ifdef TRACKBUFFER
-             (FDC1772CMD_RDSEC | (read_track ? FDC1772CMDADD_M : 0) |
-             /* Hmm - the idea here is to stop the FDC spinning the disc
-             up when we know that we already still have it spinning */
-             (MotorOn?FDC1772CMDADD_H:0))
-#else
-             FDC1772CMD_RDSEC
-#endif
-               ));
-
-       restore_flags(flags);
-       DPRINT(("fd_rwsec() after DMA setup flags=0x%08x\n", flags));
-       /*sti(); *//* DAG - Hmm */
-       /* Hmm - should do something DAG */
-       old_motoron = MotorOn;
-       MotorOn = 1;
-       NeedSeek = 1;
-
-       /* wait for interrupt */
-
-#ifdef TRACKBUFFER
-       if (read_track) {
-               /*
-                * If reading a whole track, wait about one disk rotation and
-                * then check if all sectors are read. The FDC will even
-                * search for the first non-existant sector and need 1 sec to
-                * recognise that it isn't present :-(
-                */
-               /* 1 rot. + 5 rot.s if motor was off  */
-               mod_timer(&readtrack_timer, jiffies + HZ/5 + (old_motoron ? 0 : HZ));
-               DPRINT(("Setting readtrack_timer to %d @ %d\n",
-                       readtrack_timer.expires,jiffies));
-               MultReadInProgress = 1;
-       }
-#endif
-
-       /*DPRINT(("fd_rwsec() before START_TIMEOUT \n")); */
-       START_TIMEOUT();
-       /*DPRINT(("fd_rwsec() after START_TIMEOUT \n")); */
-}
-
-
-#ifdef TRACKBUFFER
-
-static void fd_readtrack_check(unsigned long dummy)
-{
-       unsigned long flags, addr;
-       extern unsigned char *fdc1772_dataaddr;
-
-       DPRINT(("fd_readtrack_check @ %d\n",jiffies));
-
-       save_flags(flags);
-       clf();
-
-       del_timer( &readtrack_timer );
-
-       if (!MultReadInProgress) {
-               /* This prevents a race condition that could arise if the
-                * interrupt is triggered while the calling of this timer
-                * callback function takes place. The IRQ function then has
-                * already cleared 'MultReadInProgress'  when control flow
-                * gets here.
-                */
-               restore_flags(flags);
-               return;
-       }
-
-       /* get the current DMA address */
-       addr=(unsigned long)fdc1772_dataaddr; /* DAG - ? */
-       DPRINT(("fd_readtrack_check: addr=%x PhysTrackBuffer=%x\n",addr,PhysTrackBuffer));
-
-       if (addr >= (unsigned int)PhysTrackBuffer + unit[SelectedDrive].disktype->spt*512) {
-               /* already read enough data, force an FDC interrupt to stop
-                * the read operation
-                */
-               SET_IRQ_HANDLER( NULL );
-               restore_flags(flags);
-               DPRINT(("fd_readtrack_check(): done\n"));
-               FDC1772_WRITE( FDC1772REG_CMD, FDC1772CMD_FORCI );
-               udelay(25);
-
-               /* No error until now -- the FDC would have interrupted
-                * otherwise!
-                */
-               fd_rwsec_done( 0 );
-       } else {
-               /* not yet finished, wait another tenth rotation */
-               restore_flags(flags);
-               DPRINT(("fd_readtrack_check(): not yet finished\n"));
-               readtrack_timer.expires = jiffies + HZ/5/10;
-               add_timer( &readtrack_timer );
-       }
-}
-
-#endif
-
-static void fd_rwsec_done(int status)
-{
-       unsigned int track;
-
-       DPRINT(("fd_rwsec_done() status=%d @ %d\n", status,jiffies));
-
-#ifdef TRACKBUFFER
-       if (read_track && !MultReadInProgress)
-               return;
-
-       MultReadInProgress = 0;
-
-       STOP_TIMEOUT();
-
-       if (read_track)
-               del_timer( &readtrack_timer );
-#endif
-
-
-       /* Correct the track if stretch != 0 */
-       if (unit[SelectedDrive].disktype->stretch) {
-               track = FDC1772_READ(FDC1772REG_TRACK);
-               FDC1772_WRITE(FDC1772REG_TRACK, track <<
-                             unit[SelectedDrive].disktype->stretch);
-       }
-       if (ReqCmd == WRITE && (status & FDC1772STAT_WPROT)) {
-               printk("fd%d: is write protected\n", SelectedDrive);
-               goto err_end;
-       }
-       if ((status & FDC1772STAT_RECNF)
-#ifdef TRACKBUFFER
-           /* RECNF is no error after a multiple read when the FDC
-            * searched for a non-existant sector!
-            */
-           && !(read_track &&
-              FDC1772_READ(FDC1772REG_SECTOR) > unit[SelectedDrive].disktype->spt)
-#endif
-           ) {
-               if (Probing) {
-                       if (unit[SelectedDrive].disktype > disk_type) {
-                               /* try another disk type */
-                               unit[SelectedDrive].disktype--;
-                               set_capacity(disks[SelectedDrive],
-                                   unit[SelectedDrive].disktype->blocks);
-                       } else
-                               Probing = 0;
-               } else {
-                       /* record not found, but not probing. Maybe stretch wrong ? Restart probing */
-                       if (unit[SelectedDrive].autoprobe) {
-                               unit[SelectedDrive].disktype = disk_type + NUM_DISK_TYPES - 1;
-                               set_capacity(disks[SelectedDrive],
-                                   unit[SelectedDrive].disktype->blocks);
-                               Probing = 1;
-                       }
-               }
-               if (Probing) {
-                       setup_req_params(SelectedDrive);
-#ifdef TRACKBUFFER
-                       BufferDrive = -1;
-#endif
-                       do_fd_action(SelectedDrive);
-                       return;
-               }
-               printk("fd%d: sector %d not found (side %d, track %d)\n",
-                      SelectedDrive, FDC1772_READ(FDC1772REG_SECTOR), ReqSide, ReqTrack);
-               goto err_end;
-       }
-       if (status & FDC1772STAT_CRC) {
-               printk("fd%d: CRC error (side %d, track %d, sector %d)\n",
-                      SelectedDrive, ReqSide, ReqTrack, FDC1772_READ(FDC1772REG_SECTOR));
-               goto err_end;
-       }
-       if (status & FDC1772STAT_LOST) {
-               printk("fd%d: lost data (side %d, track %d, sector %d)\n",
-                      SelectedDrive, ReqSide, ReqTrack, FDC1772_READ(FDC1772REG_SECTOR));
-               goto err_end;
-       }
-       Probing = 0;
-
-       if (ReqCmd == READ) {
-#ifdef TRACKBUFFER
-               if (!read_track) {
-                       /*cache_clear (PhysDMABuffer, 512);*/
-                       copy_buffer (DMABuffer, ReqData);
-               } else {
-                       /*cache_clear (PhysTrackBuffer, FD1772_MAX_SECTORS * 512);*/
-                       BufferDrive = SelectedDrive;
-                       BufferSide  = ReqSide;
-                       BufferTrack = ReqTrack;
-                       copy_buffer (SECTOR_BUFFER (ReqSector), ReqData);
-               }
-#else
-               /*cache_clear( PhysDMABuffer, 512 ); */
-               copy_buffer(DMABuffer, ReqData);
-#endif
-       }
-       if (++ReqCnt < CURRENT->current_nr_sectors) {
-               /* read next sector */
-               setup_req_params(SelectedDrive);
-               do_fd_action(SelectedDrive);
-       } else {
-               /* all sectors finished */
-               CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
-               CURRENT->sector += CURRENT->current_nr_sectors;
-               end_request(CURRENT, 1);
-               redo_fd_request();
-       }
-       return;
-
-err_end:
-#ifdef TRACKBUFFER
-       BufferDrive = -1;
-#endif
-
-       fd_error();
-}
-
-
-static void fd_times_out(unsigned long dummy)
-{
-       SET_IRQ_HANDLER(NULL);
-       /* If the timeout occurred while the readtrack_check timer was
-        * active, we need to cancel it, else bad things will happen */
-       del_timer( &readtrack_timer ); 
-       FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_FORCI);
-       udelay(25);
-
-       printk("floppy timeout\n");
-       STOP_TIMEOUT();         /* hmm - should we do this ? */
-       fd_error();
-}
-
-
-/* The (noop) seek operation here is needed to make the WP bit in the
- * FDC1772 status register accessible for check_change. If the last disk
- * operation would have been a RDSEC, this bit would always read as 0
- * no matter what :-( To save time, the seek goes to the track we're
- * already on.
- */
-
-static void finish_fdc(void)
-{
-       /* DAG - just try without this dummy seek! */
-       finish_fdc_done(0);
-       return;
-
-       if (!NeedSeek) {
-               finish_fdc_done(0);
-       } else {
-               DPRINT(("finish_fdc: dummy seek started\n"));
-               FDC1772_WRITE(FDC1772REG_DATA, unit[SelectedDrive].track);
-               SET_IRQ_HANDLER(finish_fdc_done);
-               FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_SEEK);
-               MotorOn = 1;
-               START_TIMEOUT();
-               /* we must wait for the IRQ here, because the ST-DMA is
-                * released immediately afterwards and the interrupt may be
-                * delivered to the wrong driver.
-                */
-       }
-}
-
-
-static void finish_fdc_done(int dummy)
-{
-       unsigned long flags;
-
-       DPRINT(("finish_fdc_done entered\n"));
-       STOP_TIMEOUT();
-       NeedSeek = 0;
-
-       if (timer_pending(&fd_timer) &&
-           time_after(jiffies + 5, fd_timer.expires)) 
-               /* If the check for a disk change is done too early after this
-                * last seek command, the WP bit still reads wrong :-((
-                */
-               mod_timer(&fd_timer, jiffies + 5);
-       else {
-               /*      START_CHECK_CHANGE_TIMER( CHECK_CHANGE_DELAY ); */
-       };
-       del_timer(&motor_off_timer);
-       START_MOTOR_OFF_TIMER(FD_MOTOR_OFF_DELAY);
-
-       save_flags(flags);
-       cli();
-       /* stdma_release(); - not sure if I should do something DAG  */
-       fdc_busy = 0;
-       wake_up(&fdc_wait);
-       restore_flags(flags);
-
-       DPRINT(("finish_fdc() finished\n"));
-}
-
-
-/* Prevent "aliased" accesses. */
-static int fd_ref[4];
-static int fd_device[4];
-
-/* dummy for blk.h */
-static void floppy_off(unsigned int nr)
-{
-}
-
-
-/* On the old arcs write protect depends on the particular model
-   of machine.  On the A310, R140, and A440 there is a disc changed
-   detect, however on the A4x0/1 range there is not.  There
-   is nothing to tell you which machine your on.
-   At the moment I'm just marking changed always. I've
-   left the Atari's 'change on write protect change' code in this
-   part (but nothing sets it).
-   RiscOS apparently checks the disc serial number etc. to detect changes
-   - but if it sees a disc change line go high (?) it flips to using
-   it. Well  maybe I'll add that in the future (!?)
-*/
-static int check_floppy_change(struct gendisk *disk)
-{
-       struct archy_floppy_struct *p = disk->private_data;
-       unsigned int drive = p - unit;
-
-       if (test_bit(drive, &fake_change)) {
-               /* simulated change (e.g. after formatting) */
-               return 1;
-       }
-       if (test_bit(drive, &changed_floppies)) {
-               /* surely changed (the WP signal changed at least once) */
-               return 1;
-       }
-       if (p->wpstat) {
-               /* WP is on -> could be changed: to be sure, buffers should be
-                  * invalidated...
-                */
-               return 1;
-       }
-       return 1; /* DAG - was 0 */
-}
-
-static int floppy_revalidate(struct gendisk *disk)
-{
-       struct archy_floppy_struct *p = disk->private_data;
-       unsigned int drive = p - unit;
-
-       if (test_bit(drive, &changed_floppies) || test_bit(drive, &fake_change)
-           || unit[drive].disktype == 0) {
-#ifdef TRACKBUFFER
-               BufferDrive = -1;
-#endif
-               clear_bit(drive, &fake_change);
-               clear_bit(drive, &changed_floppies);
-               p->disktype = 0;
-       }
-       return 0;
-}
-
-/* This sets up the global variables describing the current request. */
-
-static void setup_req_params(int drive)
-{
-       int block = ReqBlock + ReqCnt;
-
-       ReqTrack = block / unit[drive].disktype->spt;
-       ReqSector = block - ReqTrack * unit[drive].disktype->spt + 1;
-       ReqSide = ReqTrack & 1;
-       ReqTrack >>= 1;
-       ReqData = ReqBuffer + 512 * ReqCnt;
-
-#ifdef TRACKBUFFER
-       read_track = (ReqCmd == READ && CURRENT->errors == 0);
-#endif
-
-       DPRINT(("Request params: Si=%d Tr=%d Se=%d Data=%08lx\n", ReqSide,
-               ReqTrack, ReqSector, (unsigned long) ReqData));
-}
-
-
-static void redo_fd_request(void)
-{
-       int drive, type;
-       struct archy_floppy_struct *floppy;
-
-       DPRINT(("redo_fd_request: CURRENT=%p dev=%s CURRENT->sector=%ld\n",
-               CURRENT, CURRENT ? CURRENT->rq_disk->disk_name : "",
-               CURRENT ? CURRENT->sector : 0));
-
-repeat:
-
-       if (!CURRENT)
-               goto the_end;
-
-       floppy = CURRENT->rq_disk->private_data;
-       drive = floppy - unit;
-       type = fd_device[drive];
-
-       if (!floppy->connected) {
-               /* drive not connected */
-               printk("Unknown Device: fd%d\n", drive);
-               end_request(CURRENT, 0);
-               goto repeat;
-       }
-       if (type == 0) {
-               if (!floppy->disktype) {
-                       Probing = 1;
-                       floppy->disktype = disk_type + NUM_DISK_TYPES - 1;
-                       set_capacity(disks[drive], floppy->disktype->blocks);
-                       floppy->autoprobe = 1;
-               }
-       } else {
-               /* user supplied disk type */
-               --type;
-               if (type >= NUM_DISK_TYPES) {
-                       printk("fd%d: invalid disk format", drive);
-                       end_request(CURRENT, 0);
-                       goto repeat;
-               }
-               floppy->disktype = &disk_type[type];
-               set_capacity(disks[drive], floppy->disktype->blocks);
-               floppy->autoprobe = 0;
-       }
-
-       if (CURRENT->sector + 1 > floppy->disktype->blocks) {
-               end_request(CURRENT, 0);
-               goto repeat;
-       }
-       /* stop deselect timer */
-       del_timer(&motor_off_timer);
-
-       ReqCnt = 0;
-       ReqCmd = rq_data_dir(CURRENT);
-       ReqBlock = CURRENT->sector;
-       ReqBuffer = CURRENT->buffer;
-       setup_req_params(drive);
-       do_fd_action(drive);
-
-       return;
-
-the_end:
-       finish_fdc();
-}
-
-static void fd1772_checkint(void)
-{
-       extern int fdc1772_bytestogo;
-
-       /*printk("fd1772_checkint %d\n",fdc1772_fdc_int_done);*/
-       if (fdc1772_fdc_int_done)
-               floppy_irqconsequencehandler();
-       if ((MultReadInProgress) && (fdc1772_bytestogo==0)) fd_readtrack_check(0);
-       if (fdc_busy) {
-               schedule_work(&fd1772_tq);
-       }
-}
-
-static void do_fd_request(struct request_queue* q)
-{
-       unsigned long flags;
-
-       DPRINT(("do_fd_request for pid %d\n", current->pid));
-       if (fdc_busy) return;
-       save_flags(flags);
-       cli();
-       wait_event(fdc_wait, !fdc_busy);
-       fdc_busy = 1;
-       ENABLE_IRQ();
-       restore_flags(flags);
-
-       fdc1772_fdc_int_done = 0;
-
-       redo_fd_request();
-
-       schedule_work(&fd1772_tq);
-}
-
-
-static int invalidate_drive(struct block_device *bdev)
-{
-       struct archy_floppy_struct *p = bdev->bd_disk->private_data;
-       /* invalidate the buffer track to force a reread */
-#ifdef TRACKBUFFER
-       BufferDrive = -1;
-#endif
-
-       set_bit(p - unit, &fake_change);
-       return 0;
-}
-
-static int fd_ioctl(struct inode *inode, struct file *filp,
-                   unsigned int cmd, unsigned long param)
-{
-       struct block_device *bdev = inode->i_bdev;
-
-       switch (cmd) {
-       case FDFMTEND:
-       case FDFLUSH:
-               invalidate_drive(bdev);
-               check_disk_change(bdev);
-       case FDFMTBEG:
-               return 0;
-       default:
-               return -EINVAL;
-       }
-}
-
-
-/* Initialize the 'unit' variable for drive 'drive' */
-
-static void fd_probe(int drive)
-{
-       unit[drive].connected = 0;
-       unit[drive].disktype = NULL;
-
-       if (!fd_test_drive_present(drive))
-               return;
-
-       unit[drive].connected = 1;
-       unit[drive].track = -1; /* If we put the auto detect back in this can go to 0 */
-       unit[drive].steprate = FDC1772STEP_6;
-       MotorOn = 1;            /* from probe restore operation! */
-}
-
-
-/* This function tests the physical presence of a floppy drive (not
- * whether a disk is inserted). This is done by issuing a restore
- * command, waiting max. 2 seconds (that should be enough to move the
- * head across the whole disk) and looking at the state of the "TR00"
- * signal. This should now be raised if there is a drive connected
- * (and there is no hardware failure :-) Otherwise, the drive is
- * declared absent.
- */
-
-static int fd_test_drive_present(int drive)
-{
-       unsigned long timeout;
-       unsigned char status;
-       int ok;
-
-       printk("fd_test_drive_present %d\n", drive);
-       if (drive > 1)
-               return (0);
-       return (1);             /* Simple hack for the moment - the autodetect doesn't seem to work on arc */
-       fd_select_drive(drive);
-
-       /* disable interrupt temporarily */
-       DISABLE_IRQ();
-       FDC1772_WRITE(FDC1772REG_TRACK, 0x00);  /* was ff00 why? */
-       FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_RESTORE | FDC1772CMDADD_H | FDC1772STEP_6);
-
-       /*printk("fd_test_drive_present: Going into timeout loop\n"); */
-       for (ok = 0, timeout = jiffies + 2 * HZ + HZ / 2; time_before(jiffies, timeout);) {
-               /*  What does this piece of atariism do? - query for an interrupt? */
-               /*  if (!(mfp.par_dt_reg & 0x20))
-                  break; */
-               /* Well this is my nearest guess - quit when we get an FDC interrupt */
-               if (ioc_readb(IOC_FIQSTAT) & 2)
-                       break;
-       }
-
-       /*printk("fd_test_drive_present: Coming out of timeout loop\n"); */
-       status = FDC1772_READ(FDC1772REG_STATUS);
-       ok = (status & FDC1772STAT_TR00) != 0;
-
-       /*printk("fd_test_drive_present: ok=%d\n",ok); */
-       /* force interrupt to abort restore operation (FDC1772 would try
-        * about 50 seconds!) */
-       FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_FORCI);
-       udelay(500);
-       status = FDC1772_READ(FDC1772REG_STATUS);
-       udelay(20);
-       /*printk("fd_test_drive_present: just before OK code %d\n",ok); */
-
-       if (ok) {
-               /* dummy seek command to make WP bit accessible */
-               FDC1772_WRITE(FDC1772REG_DATA, 0);
-               FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_SEEK);
-               printk("fd_test_drive_present: just before wait for int\n");
-               /* DAG: Guess means wait for interrupt */
-               while (!(ioc_readb(IOC_FIQSTAT) & 2));
-               printk("fd_test_drive_present: just after wait for int\n");
-               status = FDC1772_READ(FDC1772REG_STATUS);
-       }
-       printk("fd_test_drive_present: just before ENABLE_IRQ\n");
-       ENABLE_IRQ();
-       printk("fd_test_drive_present: about to return\n");
-       return (ok);
-}
-
-
-/* Look how many and which kind of drives are connected. If there are
- * floppies, additionally start the disk-change and motor-off timers.
- */
-
-static void config_types(void)
-{
-       int drive, cnt = 0;
-
-       printk("Probing floppy drive(s):\n");
-       for (drive = 0; drive < FD_MAX_UNITS; drive++) {
-               fd_probe(drive);
-               if (unit[drive].connected) {
-                       printk("fd%d\n", drive);
-                       ++cnt;
-               }
-       }
-
-       if (FDC1772_READ(FDC1772REG_STATUS) & FDC1772STAT_BUSY) {
-               /* If FDC1772 is still busy from probing, give it another FORCI
-                * command to abort the operation. If this isn't done, the FDC1772
-                * will interrupt later and its IRQ line stays low, because
-                * the status register isn't read. And this will block any
-                * interrupts on this IRQ line :-(
-                */
-               FDC1772_WRITE(FDC1772REG_CMD, FDC1772CMD_FORCI);
-               udelay(500);
-               FDC1772_READ(FDC1772REG_STATUS);
-               udelay(20);
-       }
-       if (cnt > 0) {
-               START_MOTOR_OFF_TIMER(FD_MOTOR_OFF_DELAY);
-               if (cnt == 1)
-                       fd_select_drive(0);
-               /*START_CHECK_CHANGE_TIMER( CHECK_CHANGE_DELAY ); */
-       }
-}
-
-/*
- * floppy_open check for aliasing (/dev/fd0 can be the same as
- * /dev/PS0 etc), and disallows simultaneous access to the same
- * drive with different device numbers.
- */
-
-static int floppy_open(struct inode *inode, struct file *filp)
-{
-       int drive = iminor(inode) & 3;
-       int type =  iminor(inode) >> 2;
-       int old_dev = fd_device[drive];
-
-       if (fd_ref[drive] && old_dev != type)
-               return -EBUSY;
-
-       if (fd_ref[drive] == -1 || (fd_ref[drive] && filp->f_flags & O_EXCL))
-               return -EBUSY;
-
-       if (filp->f_flags & O_EXCL)
-               fd_ref[drive] = -1;
-       else
-               fd_ref[drive]++;
-
-       fd_device[drive] = type;
-
-       if (filp->f_flags & O_NDELAY)
-               return 0;
-
-       if (filp->f_mode & 3) {
-               check_disk_change(inode->i_bdev);
-               if (filp->f_mode & 2) {
-                       if (unit[drive].wpstat) {
-                               floppy_release(inode, filp);
-                               return -EROFS;
-                       }
-               }
-       }
-       return 0;
-}
-
-
-static int floppy_release(struct inode *inode, struct file *filp)
-{
-       int drive = iminor(inode) & 3;
-
-       if (fd_ref[drive] < 0)
-               fd_ref[drive] = 0;
-       else if (!fd_ref[drive]--) {
-               printk("floppy_release with fd_ref == 0");
-               fd_ref[drive] = 0;
-       }
-
-       return 0;
-}
-
-static struct block_device_operations floppy_fops =
-{
-       .open           = floppy_open,
-       .release        = floppy_release,
-       .ioctl          = fd_ioctl,
-       .media_changed  = check_floppy_change,
-       .revalidate_disk= floppy_revalidate,
-};
-
-static struct kobject *floppy_find(dev_t dev, int *part, void *data)
-{
-       int drive = *part & 3;
-       if ((*part >> 2) > NUM_DISK_TYPES || drive >= FD_MAX_UNITS)
-               return NULL;
-       *part = 0;
-       return get_disk(disks[drive]);
-}
-
-int fd1772_init(void)
-{
-       static DEFINE_SPINLOCK(lock);
-       int i, err = -ENOMEM;
-
-       if (!machine_is_archimedes())
-               return 0;
-
-       for (i = 0; i < FD_MAX_UNITS; i++) {
-               disks[i] = alloc_disk(1);
-               if (!disks[i])
-                       goto err_disk;
-       }
-
-       err = register_blkdev(MAJOR_NR, "fd");
-       if (err)
-               goto err_disk;
-
-       err = -EBUSY;
-       if (request_dma(FLOPPY_DMA, "fd1772")) {
-               printk("Unable to grab DMA%d for the floppy (1772) driver\n", FLOPPY_DMA);
-               goto err_blkdev;
-       };
-
-       if (request_dma(FIQ_FD1772, "fd1772 end")) {
-               printk("Unable to grab DMA%d for the floppy (1772) driver\n", FIQ_FD1772);
-               goto err_dma1;
-       };
-
-       /* initialize variables */
-       SelectedDrive = -1;
-#ifdef TRACKBUFFER
-       BufferDrive = BufferSide = BufferTrack = -1;
-       /* Atari uses 512 - I want to eventually cope with 1K sectors */
-       DMABuffer = kmalloc((FD1772_MAX_SECTORS+1)*512,GFP_KERNEL);
-       TrackBuffer = DMABuffer + 512;
-#else
-       /* Allocate memory for the DMAbuffer - on the Atari this takes it
-          out of some special memory... */
-       DMABuffer = kmalloc(2048);      /* Copes with pretty large sectors */
-#endif
-       err = -ENOMEM;
-       if (!DMAbuffer)
-               goto err_dma2;
-
-       enable_dma(FIQ_FD1772); /* This inserts a call to our command end routine */
-
-       floppy_queue = blk_init_queue(do_fd_request, &lock);
-       if (!floppy_queue)
-               goto err_queue;
-
-       for (i = 0; i < FD_MAX_UNITS; i++) {
-               unit[i].track = -1;
-               disks[i]->major = MAJOR_NR;
-               disks[i]->first_minor = 0;
-               disks[i]->fops = &floppy_fops;
-               sprintf(disks[i]->disk_name, "fd%d", i);
-               disks[i]->private_data = &unit[i];
-               disks[i]->queue = floppy_queue;
-               set_capacity(disks[i], MAX_DISK_SIZE * 2);
-       }
-       blk_register_region(MKDEV(MAJOR_NR, 0), 256, THIS_MODULE,
-                               floppy_find, NULL, NULL);
-
-       for (i = 0; i < FD_MAX_UNITS; i++)
-               add_disk(disks[i]);
-
-       config_types();
-
-       return 0;
-
- err_queue:
-       kfree(DMAbuffer);
- err_dma2:
-       free_dma(FIQ_FD1772);
-
- err_dma1:
-       free_dma(FLOPPY_DMA);
-
- err_blkdev:
-       unregister_blkdev(MAJOR_NR, "fd");
-
- err_disk:
-       while (i--)
-               put_disk(disks[i]);
-       return err;
-}
diff --git a/drivers/acorn/block/fd1772dma.S b/drivers/acorn/block/fd1772dma.S
deleted file mode 100644 (file)
index 7964435..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-#include <asm/hardware.h>
-
-@ Code for DMA with the 1772 fdc
-.text
-
-
-  .global fdc1772_dataaddr
-fdc1772_fiqdata:
-@ Number of bytes left to DMA
-  .global fdc1772_bytestogo
-fdc1772_bytestogo:
-  .word 0
-@ Place to put/get data from in DMA
-  .global fdc1772_dataaddr
-fdc1772_dataaddr:
-  .word 0
-  
-  .global fdc1772_fdc_int_done
-fdc1772_fdc_int_done:
-  .word 0
-  .global fdc1772_comendstatus
-fdc1772_comendstatus:
-  .word 0
-
-@ We hang this off DMA channel 1
-    .global fdc1772_comendhandler
-fdc1772_comendhandler:
-  mov      r8,#IOC_BASE
-  ldrb     r9,[r8,#0x34]    @ IOC FIQ status
-  tst      r9,#2
-  subeqs   pc,r14,#4        @ should I leave a space here
-  orr      r9,r8,#0x10000   @ FDC base
-  adr      r8,fdc1772_fdc_int_done
-  ldrb     r10,[r9,#0]  @ FDC status
-  mov      r9,#1        @ Got a FIQ flag
-  stmia    r8,{r9,r10}
-  subs     pc,r14,#4
-
-
-    .global fdc1772_dma_read
-fdc1772_dma_read:
-  mov      r8,#IOC_BASE
-  ldrb     r9,[r8,#0x34]    @ IOC FIQ status
-  tst      r9,#1
-  beq      fdc1772_dma_read_notours
-  orr      r8,r8,#0x10000   @ FDC base
-  ldrb     r10,[r8,#0xc]   @ Read from FDC data reg (also clears interrupt)
-  ldmia    r11,{r8,r9}
-  subs     r8,r8,#1        @ One less byte to go
-  @ If there was somewhere for this data to go then store it and update pointers
-  strplb   r10,[r9],#1     @ Store the data and increment the pointer
-  stmplia  r11,{r8,r9}     @ Update count/pointers
-  @ Handle any other interrupts if there are any
-fdc1772_dma_read_notours:
-  @ Cant branch because this code has been copied down to the FIQ vector
-  ldr pc,[pc,#-4]
-  .word fdc1772_comendhandler
-  .global fdc1772_dma_read_end
-fdc1772_dma_read_end:
-
-    .global fdc1772_dma_write
-fdc1772_dma_write:
-  mov      r8,#IOC_BASE
-  ldrb     r9,[r8,#0x34]    @ IOC FIQ status
-  tst      r9,#1
-  beq      fdc1772_dma_write_notours
-  orr      r8,r8,#0x10000   @ FDC base
-  ldmia    r11,{r9,r10}
-  subs     r9,r9,#1        @ One less byte to go
-  @ If there really is some data then get it, store it and update count
-  ldrplb   r12,[r10],#1
-  strplb   r12,[r8,#0xc]   @ write it to FDC data reg
-  stmplia  r11,{r9,r10}    @ Update count and pointer - should clear interrupt
-  @ Handle any other interrupts
-fdc1772_dma_write_notours:
-  @ Cant branch because this code has been copied down to the FIQ vector
-  ldr pc,[pc,#-4]
-  .word fdc1772_comendhandler
-
-  .global fdc1772_dma_write_end
-fdc1772_dma_write_end:
-  
-
-@ Setup the FIQ R11 to point to the data and store the count, address
-@ for this dma
-@ R0=count
-@ R1=address
-  .global fdc1772_setupdma
-fdc1772_setupdma:
-       @ The big job is flipping in and out of FIQ mode
-       adr     r2,fdc1772_fiqdata      @ This is what we really came here for
-  stmia  r2,{r0,r1}
-       mov     r3, pc
-       teqp    pc,#0x0c000001  @ Disable FIQs, IRQs and switch to FIQ mode
-       mov     r0,r0           @ NOP
-       mov r11,r2
-       teqp    r3,#0           @ Normal mode
-       mov     r0,r0           @ NOP
-  mov pc,r14
-
diff --git a/drivers/acorn/block/mfm.S b/drivers/acorn/block/mfm.S
deleted file mode 100644 (file)
index c90cbd4..0000000
+++ /dev/null
@@ -1,162 +0,0 @@
-@ Read/Write DMA code for the ST506/MFM hard drive controllers on the A400 Acorn Archimedes
-@   motherboard and on ST506 expansion podules.
-@ (c) David Alan Gilbert (linux@treblig.org) 1996-1999
-
-#include <asm/assembler.h>
-hdc63463_irqdata:
-@ Controller base address
-  .global hdc63463_baseaddress
-hdc63463_baseaddress:
-  .word 0
-
-  .global hdc63463_irqpolladdress
-hdc63463_irqpolladdress:
-  .word 0
-  .global hdc63463_irqpollmask
-hdc63463_irqpollmask:
-  .word 0
-
-@ where to read/write data  from the kernel data space
-  .global hdc63463_dataptr
-hdc63463_dataptr:
-  .word 0
-
-@ Number of bytes left to transfer
-  .global hdc63463_dataleft
-hdc63463_dataleft:
-  .word 0
-
-@ -------------------------------------------------------------------------
-@ hdc63463_writedma: DMA from host to controller
-@  internal reg usage: r0=hdc base address, r1=irq poll address, r2=poll mask
-@                      r3=data ptr, r4=data left, r5,r6=temporary
-  .global hdc63463_writedma
-hdc63463_writedma:
-  stmfd sp!,{r4-r7}
-  adr r5,hdc63463_irqdata
-  ldmia r5,{r0,r1,r2,r3,r4}
-
-writedma_again:
-
-  @ test number of remaining bytes to transfer
-  cmp r4,#0
-  beq writedma_end
-  bmi writedma_end
-
-  @ Check the hdc is interrupting
-  ldrb r5,[r1,#0]
-  tst r5,r2
-  beq writedma_end
-
-  @ Transfer a block of upto 256 bytes
-  cmp r4,#256
-  movlt r7,r4
-  movge r7,#256
-
-  @ Check the hdc is still busy and command has not ended and no errors
-  ldr r5,[r0,#32]     @ Status reg - 16 bit - its the top few bits which are status
-  @ think we should continue DMA until it drops busy - perhaps this was
-  @ the main problem with corrected errors causing a hang
-  @tst r5,#0x3c00        @ Test for things which should be off
-  @bne writedma_end
-  and r5,r5,#0x8000        @ This is test for things which should be on: Busy
-  cmp r5,#0x8000
-  bne writedma_end 
-
-  @ Bytes remaining at end
-  sub r4,r4,r7
-
-  @ HDC Write register location
-  add r0,r0,#32+8
-
-writedma_loop:
-  @ OK - pretty sure we should be doing this
-
-  ldr r5,[r3],#4          @ Get a word to be written
-  @ get bottom half to be sent first
-  mov r6,r5,lsl#16        @ Separate the first 2 bytes
-  orr r2,r6,r6,lsr #16    @ Duplicate them in the bottom half of the word
-  @ now the top half
-  mov r6,r5,lsr#16        @ Get 2nd 2 bytes
-  orr r6,r6,r6,lsl#16     @ Duplicate
-  @str r6,[r0]       @ to hdc
-  stmia r0,{r2,r6}
-  subs r7,r7,#4           @ Dec. number of bytes left
-  bne writedma_loop
-
-  @ If we were too slow we had better go through again - DAG - took out with new interrupt routine
-  @ sub r0,r0,#32+8
-  @ adr r2,hdc63463_irqdata
-  @ ldr r2,[r2,#8]
-  @ b writedma_again
-
-writedma_end:
-  adr r5,hdc63463_irqdata+12
-  stmia r5,{r3,r4}
-  ldmfd sp!,{r4-r7}
-  RETINSTR(mov,pc,lr)
-
-@ -------------------------------------------------------------------------
-@ hdc63463_readdma: DMA from controller to host
-@  internal reg usage: r0=hdc base address, r1=irq poll address, r2=poll mask
-@                      r3=data ptr, r4=data left, r5,r6=temporary
-  .global hdc63463_readdma
-hdc63463_readdma:
-  stmfd sp!,{r4-r7}
-  adr r5,hdc63463_irqdata
-  ldmia r5,{r0,r1,r2,r3,r4}
-
-readdma_again:
-  @ test number of remaining bytes to transfer
-  cmp r4,#0
-  beq readdma_end
-  bmi readdma_end
-
-  @ Check the hdc is interrupting
-  ldrb r5,[r1,#0]
-  tst r5,r2
-  beq readdma_end
-
-  @ Check the hdc is still busy and command has not ended and no errors
-  ldr r5,[r0,#32]     @ Status reg - 16 bit - its the top few bits which are status
-  @ think we should continue DMA until it drops busy - perhaps this was
-  @ the main problem with corrected errors causing a hang
-  @tst r5,#0x3c00      @ Test for things which should be off
-  @bne readdma_end
-  and r5,r5,#0x8000        @ This is test for things which should be on: Busy
-  cmp r5,#0x8000
-  bne readdma_end 
-
-  @ Transfer a block of upto 256 bytes
-  cmp r4,#256
-  movlt r7,r4
-  movge r7,#256
-
-  @ Bytes remaining at end
-  sub r4,r4,r7
-
-  @ Set a pointer to the data register in the HDC
-  add r0,r0,#8
-readdma_loop:
-  @ OK - pretty sure we should be doing this
-  ldmia r0,{r5,r6}
-  mov r5,r5,lsl#16
-  mov r6,r6,lsl#16
-  orr r6,r6,r5,lsr #16
-  str r6,[r3],#4
-  subs r7,r7,#4        @ Decrement bytes to go
-  bne readdma_loop
-
-  @ Try reading multiple blocks - if this was fast enough then I do not think
-  @ this should help - NO taken out DAG - new interrupt handler has
-  @ non-consecutive memory blocks
-  @ sub r0,r0,#8
-  @ b readdma_again
-
-readdma_end:
-  adr r5,hdc63463_irqdata+12
-  stmia r5,{r3,r4}
-  ldmfd sp!,{r4-r7}
-  RETINSTR(mov,pc,lr)
diff --git a/drivers/acorn/block/mfmhd.c b/drivers/acorn/block/mfmhd.c
deleted file mode 100644 (file)
index 74058db..0000000
+++ /dev/null
@@ -1,1385 +0,0 @@
-/*
- * linux/drivers/acorn/block/mfmhd.c
- *
- * Copyright (C) 1995, 1996 Russell King, Dave Alan Gilbert (gilbertd@cs.man.ac.uk)
- *
- * MFM hard drive code [experimental]
- */
-
-/*
- * Change list:
- *
- *  3/2/96:DAG: Started a change list :-)
- *              Set the hardsect_size pointers up since we are running 256 byte
- *                sectors
- *              Added DMA code, put it into the rw_intr
- *              Moved RCAL out of generic interrupt code - don't want to do it
- *                while DMA'ing - its now in individual handlers.
- *              Took interrupt handlers off task queue lists and called
- *                directly - not sure of implications.
- *
- * 18/2/96:DAG: Well its reading OK I think, well enough for image file code
- *              to find the image file; but now I've discovered that I actually
- *              have to put some code in for image files.
- *
- *              Added stuff for image files; seems to work, but I've not
- *              got a multisegment image file (I don't think!).
- *              Put in a hack (yep a real hack) for multiple cylinder reads.
- *              Not convinced its working.
- *
- *  5/4/96:DAG: Added asm/hardware.h and use IOC_ macros
- *              Rewrote dma code in mfm.S (again!) - now takes a word at a time
- *              from main RAM for speed; still doesn't feel speedy!
- *
- * 20/4/96:DAG: After rewriting mfm.S a heck of a lot of times and speeding
- *              things up, I've finally figured out why its so damn slow.
- *              Linux is only reading a block at a time, and so you never
- *              get more than 1K per disc revoloution ~=60K/second.
- *
- * 27/4/96:DAG: On Russell's advice I change ll_rw_blk.c to ask it to
- *              join adjacent blocks together. Everything falls flat on its
- *              face.
- *              Four hours of debugging later; I hadn't realised that
- *              ll_rw_blk would be so generous as to join blocks whose
- *              results aren't going into consecutive buffers.
- * 
- *              OK; severe rehacking of mfm_rw_interrupt; now end_request's
- *              as soon as its DMA'd each request.  Odd thing is that
- *              we are sometimes getting interrupts where we are not transferring
- *              any data; why? Is that what happens when you miss? I doubt
- *              it; are we too fast? No - its just at command ends. Got 240K/s
- *              better than before, but RiscOS hits 480K/s
- *
- * 25/6/96:RMK: Fixed init code to allow the MFM podule to work.  Increased the
- *              number of errors for my Miniscribe drive (8425).
- *
- * 30/6/96:DAG: Russell suggested that a check drive 0 might turn the LEDs off
- *              - so in request_done just before it clears Busy it sends a
- *              check drive 0 - and the LEDs go off!!!!
- *
- *              Added test for mainboard controller. - Removes need for separate
- *              define.
- *
- * 13/7/96:DAG: Changed hardware sectore size to 512 in attempt to make
- *              IM drivers work.
- * 21/7/96:DAG: Took out old image file stuff (accessing it now produces an IO
- *              error.)
- *
- * 17/8/96:DAG: Ran through indent -kr -i8; evil - all my nice 2 character indents
- *              gone :-( Hand modified afterwards.
- *             Took out last remains of the older image map system.
- *
- * 22/9/96:DAG:        Changed mfm.S so it will carry on DMA'ing til; BSY is dropped
- *             Changed mfm_rw_intr so that it doesn't follow the error
- *             code until BSY is dropped. Nope - still broke. Problem
- *             may revolve around when it reads the results for the error
- *             number?
- *
- *16/11/96:DAG:        Modified for 2.0.18; request_irq changed
- *
- *17/12/96:RMK: Various cleanups, reorganisation, and the changes for new IO system.
- *             Improved probe for onboard MFM chip - it was hanging on my A5k.
- *             Added autodetect CHS code such that we don't rely on the presence
- *             of an ADFS boot block.  Added ioport resource manager calls so
- *             that we don't clash with already-running hardware (eg. RiscPC Ether
- *             card slots if someone tries this)!
- *
- * 17/1/97:RMK:        Upgraded to 2.1 kernels.
- *
- *  4/3/98:RMK:        Changed major number to 21.
- *
- * 27/6/98:RMK:        Changed asm/delay.h to linux/delay.h for mdelay().
- */
-
-/*
- * Possible enhancements:
- *  Multi-thread the code so that it is possible that while one drive
- *  is seeking, the other one can be reading data/seeking as well.
- *  This would be a performance boost with dual drive systems.
- */
-
-#include <linux/module.h>
-#include <linux/fs.h>
-#include <linux/interrupt.h>
-#include <linux/kernel.h>
-#include <linux/timer.h>
-#include <linux/mm.h>
-#include <linux/errno.h>
-#include <linux/genhd.h>
-#include <linux/major.h>
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/blkpg.h>
-
-#include <asm/system.h>
-#include <asm/io.h>
-#include <asm/irq.h>
-#include <asm/uaccess.h>
-#include <asm/dma.h>
-#include <asm/hardware.h>
-#include <asm/ecard.h>
-#include <asm/hardware/ioc.h>
-
-static void (*do_mfm)(void) = NULL;
-static struct request_queue *mfm_queue;
-static DEFINE_SPINLOCK(mfm_lock);
-
-#define MAJOR_NR       MFM_ACORN_MAJOR
-#define QUEUE (mfm_queue)
-#define CURRENT elv_next_request(mfm_queue)
-
-/*
- * Configuration section
- *
- * This is the maximum number of drives that we accept
- */
-#define MFM_MAXDRIVES 2
-/*
- * Linux I/O address of onboard MFM controller or 0 to disable this
- */
-#define ONBOARD_MFM_ADDRESS ((0x002d0000 >> 2) | 0x80000000)
-/*
- * Uncomment this to enable debugging in the MFM driver...
- */
-#ifndef DEBUG
-/*#define DEBUG */
-#endif
-/*
- * End of configuration
- */
-
-/*
- * This structure contains all information to do with a particular physical
- * device.
- */
-struct mfm_info {
-       unsigned char sectors;
-       unsigned char heads;
-       unsigned short cylinders;
-       unsigned short lowcurrent;
-       unsigned short precomp;
-#define NO_TRACK -1
-#define NEED_1_RECAL -2
-#define NEED_2_RECAL -3
-                int cylinder;
-       struct {
-               char recal;
-               char report;
-               char abort;
-       } errors;
-} mfm_info[MFM_MAXDRIVES];
-
-#define MFM_DRV_INFO mfm_info[raw_cmd.dev]
-
-/* Stuff from the assembly routines */
-extern unsigned int hdc63463_baseaddress;      /* Controller base address */
-extern unsigned int hdc63463_irqpolladdress;   /* Address to read to test for int */
-extern unsigned int hdc63463_irqpollmask;      /* Mask for irq register */
-extern unsigned int hdc63463_dataptr;  /* Pointer to kernel data space to DMA */
-extern int hdc63463_dataleft;  /* Number of bytes left to transfer */
-
-
-
-
-static int lastspecifieddrive;
-static unsigned Busy;
-
-static unsigned int PartFragRead;      /* The number of sectors which have been read
-                                          during a partial read split over two
-                                          cylinders.  If 0 it means a partial
-                                          read did not occur. */
-
-static unsigned int PartFragRead_RestartBlock; /* Where to restart on a split access */
-static unsigned int PartFragRead_SectorsLeft;  /* Where to restart on a split access */
-
-static int Sectors256LeftInCurrent;    /* i.e. 256 byte sectors left in current */
-static int SectorsLeftInRequest;       /* i.e. blocks left in the thing mfm_request was called for */
-static int Copy_Sector;                /* The 256 byte sector we are currently at - fragments need to know 
-                                  where to take over */
-static char *Copy_buffer;
-
-
-static void mfm_seek(void);
-static void mfm_rerequest(void);
-static void mfm_request(void);
-static void mfm_specify (void);
-static void issue_request(unsigned int block, unsigned int nsect,
-                         struct request *req);
-
-static unsigned int mfm_addr;          /* Controller address */
-static unsigned int mfm_IRQPollLoc;    /* Address to read for IRQ information */
-static unsigned int mfm_irqenable;     /* Podule IRQ enable location */
-static unsigned char mfm_irq;          /* Interrupt number */
-static int mfm_drives = 0;             /* drives available */
-static int mfm_status = 0;             /* interrupt status */
-static int *errors;
-
-static struct rawcmd {
-       unsigned int dev;
-       unsigned int cylinder;
-       unsigned int head;
-       unsigned int sector;
-       unsigned int cmdtype;
-       unsigned int cmdcode;
-       unsigned char cmddata[16];
-       unsigned int cmdlen;
-} raw_cmd;
-
-static unsigned char result[16];
-
-static struct cont {
-       void (*interrupt) (void);       /* interrupt handler */
-       void (*error) (void);   /* error handler */
-       void (*redo) (void);    /* redo handler */
-       void (*done) (int st);  /* done handler */
-} *cont = NULL;
-
-#if 0
-static struct tq_struct mfm_tq = {0, 0, (void (*)(void *)) NULL, 0};
-#endif
-
-int number_mfm_drives = 1;
-
-/* ------------------------------------------------------------------------------------------ */
-/*
- * From the HD63463 data sheet from Hitachi Ltd.
- */
-
-#define MFM_COMMAND (mfm_addr + 0)
-#define MFM_DATAOUT (mfm_addr + 1)
-#define MFM_STATUS  (mfm_addr + 8)
-#define MFM_DATAIN  (mfm_addr + 9)
-
-#define CMD_ABT                0xF0    /* Abort */
-#define CMD_SPC                0xE8    /* Specify */
-#define CMD_TST                0xE0    /* Test */
-#define CMD_RCLB       0xC8    /* Recalibrate */
-#define CMD_SEK                0xC0    /* Seek */
-#define CMD_WFS                0xAB    /* Write Format Skew */
-#define CMD_WFM                0xA3    /* Write Format */
-#define CMD_MTB                0x90    /* Memory to buffer */
-#define CMD_CMPD       0x88    /* Compare data */
-#define CMD_WD         0x87    /* Write data */
-#define CMD_RED                0x70    /* Read erroneous data */
-#define CMD_RIS                0x68    /* Read ID skew */
-#define CMD_FID                0x61    /* Find ID */
-#define CMD_RID                0x60    /* Read ID */
-#define CMD_BTM                0x50    /* Buffer to memory */
-#define CMD_CKD                0x48    /* Check data */
-#define CMD_RD         0x40    /* Read data */
-#define CMD_OPBW       0x38    /* Open buffer write */
-#define CMD_OPBR       0x30    /* Open buffer read */
-#define CMD_CKV                0x28    /* Check drive */
-#define CMD_CKE                0x20    /* Check ECC */
-#define CMD_POD                0x18    /* Polling disable */
-#define CMD_POL                0x10    /* Polling enable */
-#define CMD_RCAL       0x08    /* Recall */
-
-#define STAT_BSY       0x8000  /* Busy */
-#define STAT_CPR       0x4000  /* Command Parameter Rejection */
-#define STAT_CED       0x2000  /* Command end */
-#define STAT_SED       0x1000  /* Seek end */
-#define STAT_DER       0x0800  /* Drive error */
-#define STAT_ABN       0x0400  /* Abnormal end */
-#define STAT_POL       0x0200  /* Polling */
-
-/* ------------------------------------------------------------------------------------------ */
-#ifdef DEBUG
-static void console_printf(const char *fmt,...)
-{
-       static char buffer[2048];       /* Arbitary! */
-       extern void console_print(const char *);
-       unsigned long flags;
-       va_list ap;
-
-       local_irq_save(flags);
-
-       va_start(ap, fmt);
-       vsprintf(buffer, fmt, ap);
-       console_print(buffer);
-       va_end(fmt);
-
-       local_irq_restore(flags);
-};     /* console_printf */
-
-#define DBG(x...) console_printf(x)
-#else
-#define DBG(x...)
-#endif
-
-static void print_status(void)
-{
-       char *error;
-       static char *errors[] = {
-         "no error",
-        "command aborted",
-        "invalid command",
-        "parameter error",
-        "not initialised",
-        "rejected TEST",
-        "no useld",
-        "write fault",
-        "not ready",
-        "no scp",
-        "in seek",
-        "invalid NCA",
-        "invalid step rate",
-        "seek error",
-        "over run",
-        "invalid PHA",
-        "data field EEC error",
-        "data field CRC error",
-        "error corrected",
-        "data field fatal error",
-        "no data am",
-        "not hit",
-        "ID field CRC error",
-        "time over",
-        "no ID am",
-        "not writable"
-       };
-       if (result[1] < 0x65)
-               error = errors[result[1] >> 2];
-       else
-               error = "unknown";
-       printk("(");
-       if (mfm_status & STAT_BSY) printk("BSY ");
-       if (mfm_status & STAT_CPR) printk("CPR ");
-       if (mfm_status & STAT_CED) printk("CED ");
-       if (mfm_status & STAT_SED) printk("SED ");
-       if (mfm_status & STAT_DER) printk("DER ");
-       if (mfm_status & STAT_ABN) printk("ABN ");
-       if (mfm_status & STAT_POL) printk("POL ");
-       printk(") SSB = %X (%s)\n", result[1], error);
-
-}
-
-/* ------------------------------------------------------------------------------------- */
-
-static void issue_command(int command, unsigned char *cmdb, int len)
-{
-       int status;
-#ifdef DEBUG
-       int i;
-       console_printf("issue_command: %02X: ", command);
-       for (i = 0; i < len; i++)
-               console_printf("%02X ", cmdb[i]);
-       console_printf("\n");
-#endif
-
-       do {
-               status = inw(MFM_STATUS);
-       } while (status & (STAT_BSY | STAT_POL));
-       DBG("issue_command: status after pol/bsy loop: %02X:\n ", status >> 8);
-
-       if (status & (STAT_CPR | STAT_CED | STAT_SED | STAT_DER | STAT_ABN)) {
-               outw(CMD_RCAL, MFM_COMMAND);
-               while (inw(MFM_STATUS) & STAT_BSY);
-       }
-       status = inw(MFM_STATUS);
-       DBG("issue_command: status before parameter issue: %02X:\n ", status >> 8);
-
-       while (len > 0) {
-               outw(cmdb[1] | (cmdb[0] << 8), MFM_DATAOUT);
-               len -= 2;
-               cmdb += 2;
-       }
-       status = inw(MFM_STATUS);
-       DBG("issue_command: status before command issue: %02X:\n ", status >> 8);
-
-       outw(command, MFM_COMMAND);
-       status = inw(MFM_STATUS);
-       DBG("issue_command: status immediately after command issue: %02X:\n ", status >> 8);
-}
-
-static void wait_for_completion(void)
-{
-       while ((mfm_status = inw(MFM_STATUS)) & STAT_BSY);
-}
-
-static void wait_for_command_end(void)
-{
-       int i;
-
-       while (!((mfm_status = inw(MFM_STATUS)) & STAT_CED));
-
-       for (i = 0; i < 16;) {
-               int in;
-               in = inw(MFM_DATAIN);
-               result[i++] = in >> 8;
-               result[i++] = in;
-       }
-       outw (CMD_RCAL, MFM_COMMAND);
-}
-
-/* ------------------------------------------------------------------------------------- */
-
-static void mfm_rw_intr(void)
-{
-       int old_status;         /* Holds status on entry, we read to see if the command just finished */
-#ifdef DEBUG
-       console_printf("mfm_rw_intr...dataleft=%d\n", hdc63463_dataleft);
-       print_status();
-#endif
-
-  /* Now don't handle the error until BSY drops */
-       if ((mfm_status & (STAT_DER | STAT_ABN)) && ((mfm_status&STAT_BSY)==0)) {
-               /* Something has gone wrong - let's try that again */
-               outw(CMD_RCAL, MFM_COMMAND);    /* Clear interrupt condition */
-               if (cont) {
-                       DBG("mfm_rw_intr: DER/ABN err\n");
-                       cont->error();
-                       cont->redo();
-               };
-               return;
-       };
-
-       /* OK so what ever happened it's not an error, now I reckon we are left between
-          a choice of command end or some data which is ready to be collected */
-       /* I think we have to transfer data while the interrupt line is on and its
-          not any other type of interrupt */
-       if (rq_data_dir(CURRENT) == WRITE) {
-               extern void hdc63463_writedma(void);
-               if ((hdc63463_dataleft <= 0) && (!(mfm_status & STAT_CED))) {
-                       printk("mfm_rw_intr: Apparent DMA write request when no more to DMA\n");
-                       if (cont) {
-                               cont->error();
-                               cont->redo();
-                       };
-                       return;
-               };
-               hdc63463_writedma();
-       } else {
-               extern void hdc63463_readdma(void);
-               if ((hdc63463_dataleft <= 0) && (!(mfm_status & STAT_CED))) {
-                       printk("mfm_rw_intr: Apparent DMA read request when no more to DMA\n");
-                       if (cont) {
-                               cont->error();
-                               cont->redo();
-                       };
-                       return;
-               };
-               DBG("Going to try read dma..............status=0x%x, buffer=%p\n", mfm_status, hdc63463_dataptr);
-               hdc63463_readdma();
-       };                      /* Read */
-
-       if (hdc63463_dataptr != ((unsigned int) Copy_buffer + 256)) {
-               /* If we didn't actually manage to get any data on this interrupt - but why? We got the interrupt */
-               /* Ah - well looking at the status its just when we get command end; so no problem */
-               /*console_printf("mfm: dataptr mismatch. dataptr=0x%08x Copy_buffer+256=0x%08p\n",
-                  hdc63463_dataptr,Copy_buffer+256);
-                  print_status(); */
-       } else {
-               Sectors256LeftInCurrent--;
-               Copy_buffer += 256;
-               Copy_Sector++;
-
-               /* We have come to the end of this request */
-               if (!Sectors256LeftInCurrent) {
-                       DBG("mfm: end_request for CURRENT=0x%p CURRENT(sector=%d current_nr_sectors=%d nr_sectors=%d)\n",
-                                      CURRENT, CURRENT->sector, CURRENT->current_nr_sectors, CURRENT->nr_sectors);
-
-                       CURRENT->nr_sectors -= CURRENT->current_nr_sectors;
-                       CURRENT->sector += CURRENT->current_nr_sectors;
-                       SectorsLeftInRequest -= CURRENT->current_nr_sectors;
-
-                       end_request(CURRENT, 1);
-                       if (SectorsLeftInRequest) {
-                               hdc63463_dataptr = (unsigned int) CURRENT->buffer;
-                               Copy_buffer = CURRENT->buffer;
-                               Sectors256LeftInCurrent = CURRENT->current_nr_sectors * 2;
-                               errors = &(CURRENT->errors);
-                               /* These should match the present calculations of the next logical sector
-                                  on the device
-                                  Copy_Sector=CURRENT->sector*2; */
-
-                               if (Copy_Sector != CURRENT->sector * 2)
-#ifdef DEBUG
-                                       /*console_printf*/printk("mfm: Copy_Sector mismatch. Copy_Sector=%d CURRENT->sector*2=%d\n",
-                                       Copy_Sector, CURRENT->sector * 2);
-#else
-                                       printk("mfm: Copy_Sector mismatch! Eek!\n");
-#endif
-                       };      /* CURRENT */
-               };      /* Sectors256LeftInCurrent */
-       };
-
-       old_status = mfm_status;
-       mfm_status = inw(MFM_STATUS);
-       if (mfm_status & (STAT_DER | STAT_ABN)) {
-               /* Something has gone wrong - let's try that again */
-               if (cont) {
-                       DBG("mfm_rw_intr: DER/ABN error\n");
-                       cont->error();
-                       cont->redo();
-               };
-               return;
-       };
-
-       /* If this code wasn't entered due to command_end but there is
-          now a command end we must read the command results out. If it was
-          entered like this then mfm_interrupt_handler would have done the
-          job. */
-       if ((!((old_status & (STAT_CPR | STAT_BSY)) == STAT_CPR)) &&
-           ((mfm_status & (STAT_CPR | STAT_BSY)) == STAT_CPR)) {
-               int len = 0;
-               while (len < 16) {
-                       int in;
-                       in = inw(MFM_DATAIN);
-                       result[len++] = in >> 8;
-                       result[len++] = in;
-               };
-       };                      /* Result read */
-
-       /*console_printf ("mfm_rw_intr nearexit [%02X]\n", __raw_readb(mfm_IRQPollLoc)); */
-
-       /* If end of command move on */
-       if (mfm_status & (STAT_CED)) {
-               outw(CMD_RCAL, MFM_COMMAND);    /* Clear interrupt condition */
-               /* End of command - trigger the next command */
-               if (cont) {
-                       cont->done(1);
-               }
-               DBG("mfm_rw_intr: returned from cont->done\n");
-       } else {
-               /* Its going to generate another interrupt */
-               do_mfm = mfm_rw_intr;
-       };
-}
-
-static void mfm_setup_rw(void)
-{
-       DBG("setting up for rw...\n");
-
-       do_mfm = mfm_rw_intr;
-       issue_command(raw_cmd.cmdcode, raw_cmd.cmddata, raw_cmd.cmdlen);
-}
-
-static void mfm_recal_intr(void)
-{
-#ifdef DEBUG
-       console_printf("recal intr - status = ");
-       print_status();
-#endif
-       outw(CMD_RCAL, MFM_COMMAND);    /* Clear interrupt condition */
-       if (mfm_status & (STAT_DER | STAT_ABN)) {
-               printk("recal failed\n");
-               MFM_DRV_INFO.cylinder = NEED_2_RECAL;
-               if (cont) {
-                       cont->error();
-                       cont->redo();
-               }
-               return;
-       }
-       /* Thats seek end - we are finished */
-       if (mfm_status & STAT_SED) {
-               issue_command(CMD_POD, NULL, 0);
-               MFM_DRV_INFO.cylinder = 0;
-               mfm_seek();
-               return;
-       }
-       /* Command end without seek end (see data sheet p.20) for parallel seek
-          - we have to send a POL command to wait for the seek */
-       if (mfm_status & STAT_CED) {
-               do_mfm = mfm_recal_intr;
-               issue_command(CMD_POL, NULL, 0);
-               return;
-       }
-       printk("recal: unknown status\n");
-}
-
-static void mfm_seek_intr(void)
-{
-#ifdef DEBUG
-       console_printf("seek intr - status = ");
-       print_status();
-#endif
-       outw(CMD_RCAL, MFM_COMMAND);    /* Clear interrupt condition */
-       if (mfm_status & (STAT_DER | STAT_ABN)) {
-               printk("seek failed\n");
-               MFM_DRV_INFO.cylinder = NEED_2_RECAL;
-               if (cont) {
-                       cont->error();
-                       cont->redo();
-               }
-               return;
-       }
-       if (mfm_status & STAT_SED) {
-               issue_command(CMD_POD, NULL, 0);
-               MFM_DRV_INFO.cylinder = raw_cmd.cylinder;
-               mfm_seek();
-               return;
-       }
-       if (mfm_status & STAT_CED) {
-               do_mfm = mfm_seek_intr;
-               issue_command(CMD_POL, NULL, 0);
-               return;
-       }
-       printk("seek: unknown status\n");
-}
-
-/* IDEA2 seems to work better - its what RiscOS sets my
- * disc to - on its SECOND call to specify!
- */
-#define IDEA2
-#ifndef IDEA2
-#define SPEC_SL 0x16
-#define SPEC_SH 0xa9           /* Step pulse high=21, Record Length=001 (256 bytes) */
-#else
-#define SPEC_SL 0x00           /* OM2 - SL - step pulse low */
-#define SPEC_SH 0x21           /* Step pulse high=4, Record Length=001 (256 bytes) */
-#endif
-
-static void mfm_setupspecify (int drive, unsigned char *cmdb)
-{
-       cmdb[0]  = 0x1f;                /* OM0 - !SECT,!MOD,!DIF,PADP,ECD,CRCP,CRCI,ACOR */
-       cmdb[1]  = 0xc3;                /* OM1 - DTM,BRST,!CEDM,!SEDM,!DERM,0,AMEX,PSK */
-       cmdb[2]  = SPEC_SL;             /* OM2 - SL - step pulse low */
-       cmdb[3]  = (number_mfm_drives == 1) ? 0x02 : 0x06;      /* 1 or 2 drives */
-       cmdb[4]  = 0xfc | ((mfm_info[drive].cylinders - 1) >> 8);/* RW time over/high part of number of cylinders */
-       cmdb[5]  = mfm_info[drive].cylinders - 1;               /* low part of number of cylinders */
-       cmdb[6]  = mfm_info[drive].heads - 1;                   /* Number of heads */
-       cmdb[7]  = mfm_info[drive].sectors - 1;                 /* Number of sectors */
-       cmdb[8]  = SPEC_SH;
-       cmdb[9]  = 0x0a;                /* gap length 1 */
-       cmdb[10] = 0x0d;                /* gap length 2 */
-       cmdb[11] = 0x0c;                /* gap length 3 */
-       cmdb[12] = (mfm_info[drive].precomp - 1) >> 8;  /* pre comp cylinder */
-       cmdb[13] = mfm_info[drive].precomp - 1;
-       cmdb[14] = (mfm_info[drive].lowcurrent - 1) >> 8;       /* Low current cylinder */
-       cmdb[15] = mfm_info[drive].lowcurrent - 1;
-}
-
-static void mfm_specify (void)
-{
-       unsigned char cmdb[16];
-
-       DBG("specify...dev=%d lastspecified=%d\n", raw_cmd.dev, lastspecifieddrive);
-       mfm_setupspecify (raw_cmd.dev, cmdb);
-
-       issue_command (CMD_SPC, cmdb, 16);
-       /* Ensure that we will do another specify if we move to the other drive */
-       lastspecifieddrive = raw_cmd.dev;
-       wait_for_completion();
-}
-
-static void mfm_seek(void)
-{
-       unsigned char cmdb[4];
-
-       DBG("seeking...\n");
-       if (MFM_DRV_INFO.cylinder < 0) {
-               do_mfm = mfm_recal_intr;
-               DBG("mfm_seek: about to call specify\n");
-               mfm_specify (); /* DAG added this */
-
-               cmdb[0] = raw_cmd.dev + 1;
-               cmdb[1] = 0;
-
-               issue_command(CMD_RCLB, cmdb, 2);
-               return;
-       }
-       if (MFM_DRV_INFO.cylinder != raw_cmd.cylinder) {
-               cmdb[0] = raw_cmd.dev + 1;
-               cmdb[1] = 0;    /* raw_cmd.head; DAG: My data sheet says this should be 0 */
-               cmdb[2] = raw_cmd.cylinder >> 8;
-               cmdb[3] = raw_cmd.cylinder;
-
-               do_mfm = mfm_seek_intr;
-               issue_command(CMD_SEK, cmdb, 4);
-       } else
-               mfm_setup_rw();
-}
-
-static void mfm_initialise(void)
-{
-       DBG("init...\n");
-       mfm_seek();
-}
-
-static void request_done(int uptodate)
-{
-       DBG("mfm:request_done\n");
-       if (uptodate) {
-               unsigned char block[2] = {0, 0};
-
-               /* Apparently worked - let's check bytes left to DMA */
-               if (hdc63463_dataleft != (PartFragRead_SectorsLeft * 256)) {
-                       printk("mfm: request_done - dataleft=%d - should be %d - Eek!\n", hdc63463_dataleft, PartFragRead_SectorsLeft * 256);
-                       end_request(CURRENT, 0);
-                       Busy = 0;
-               };
-               /* Potentially this means that we've done; but we might be doing
-                  a partial access, (over two cylinders) or we may have a number
-                  of fragments in an image file.  First let's deal with partial accesss
-                */
-               if (PartFragRead) {
-                       /* Yep - a partial access */
-
-                       /* and issue the remainder */
-                       issue_request(PartFragRead_RestartBlock, PartFragRead_SectorsLeft, CURRENT);
-                       return;
-               }
-
-               /* ah well - perhaps there is another fragment to go */
-
-               /* Increment pointers/counts to start of next fragment */
-               if (SectorsLeftInRequest > 0) printk("mfm: SectorsLeftInRequest>0 - Eek! Shouldn't happen!\n");
-
-               /* No - its the end of the line */
-               /* end_request's should have happened at the end of sector DMAs */
-               /* Turns Drive LEDs off - may slow it down? */
-               if (!elv_next_request(QUEUE))
-                       issue_command(CMD_CKV, block, 2);
-
-               Busy = 0;
-               DBG("request_done: About to mfm_request\n");
-               /* Next one please */
-               mfm_request();  /* Moved from mfm_rw_intr */
-               DBG("request_done: returned from mfm_request\n");
-       } else {
-               printk("mfm:request_done: update=0\n");
-               end_request(CURRENT, 0);
-               Busy = 0;
-       }
-}
-
-static void error_handler(void)
-{
-       printk("error detected... status = ");
-       print_status();
-       (*errors)++;
-       if (*errors > MFM_DRV_INFO.errors.abort)
-               cont->done(0);
-       if (*errors > MFM_DRV_INFO.errors.recal)
-               MFM_DRV_INFO.cylinder = NEED_2_RECAL;
-}
-
-static void rw_interrupt(void)
-{
-       printk("rw_interrupt\n");
-}
-
-static struct cont rw_cont =
-{
-       rw_interrupt,
-       error_handler,
-       mfm_rerequest,
-       request_done
-};
-
-/*
- * Actually gets round to issuing the request - note everything at this
- * point is in 256 byte sectors not Linux 512 byte blocks
- */
-static void issue_request(unsigned int block, unsigned int nsect,
-                         struct request *req)
-{
-       struct gendisk *disk = req->rq_disk;
-       struct mfm_info *p = disk->private_data;
-       int track, start_head, start_sector;
-       int sectors_to_next_cyl;
-       dev = p - mfm_info;
-
-       track = block / p->sectors;
-       start_sector = block % p->sectors;
-       start_head = track % p->heads;
-
-       /* First get the number of whole tracks which are free before the next
-          track */
-       sectors_to_next_cyl = (p->heads - (start_head + 1)) * p->sectors;
-       /* Then add in the number of sectors left on this track */
-       sectors_to_next_cyl += (p->sectors - start_sector);
-
-       DBG("issue_request: mfm_info[dev].sectors=%d track=%d\n", p->sectors, track);
-
-       raw_cmd.dev = dev;
-       raw_cmd.sector = start_sector;
-       raw_cmd.head = start_head;
-       raw_cmd.cylinder = track / p->heads;
-       raw_cmd.cmdtype = CURRENT->cmd;
-       raw_cmd.cmdcode = rq_data_dir(CURRENT) == WRITE ? CMD_WD : CMD_RD;
-       raw_cmd.cmddata[0] = dev + 1;   /* DAG: +1 to get US */
-       raw_cmd.cmddata[1] = raw_cmd.head;
-       raw_cmd.cmddata[2] = raw_cmd.cylinder >> 8;
-       raw_cmd.cmddata[3] = raw_cmd.cylinder;
-       raw_cmd.cmddata[4] = raw_cmd.head;
-       raw_cmd.cmddata[5] = raw_cmd.sector;
-
-       /* Was == and worked - how the heck??? */
-       if (lastspecifieddrive != raw_cmd.dev)
-               mfm_specify ();
-
-       if (nsect <= sectors_to_next_cyl) {
-               raw_cmd.cmddata[6] = nsect >> 8;
-               raw_cmd.cmddata[7] = nsect;
-               PartFragRead = 0;       /* All in one */
-               PartFragRead_SectorsLeft = 0;   /* Must set this - used in DMA calcs */
-       } else {
-               raw_cmd.cmddata[6] = sectors_to_next_cyl >> 8;
-               raw_cmd.cmddata[7] = sectors_to_next_cyl;
-               PartFragRead = sectors_to_next_cyl;     /* only do this many this time */
-               PartFragRead_RestartBlock = block + sectors_to_next_cyl;        /* Where to restart from */
-               PartFragRead_SectorsLeft = nsect - sectors_to_next_cyl;
-       }
-       raw_cmd.cmdlen = 8;
-
-       /* Setup DMA pointers */
-       hdc63463_dataptr = (unsigned int) Copy_buffer;
-       hdc63463_dataleft = nsect * 256;        /* Better way? */
-
-       DBG("mfm%c: %sing: CHS=%d/%d/%d, sectors=%d, buffer=0x%08lx (%p)\n",
-            raw_cmd.dev + 'a', rq_data_dir(CURRENT) == READ ? "read" : "writ",
-                      raw_cmd.cylinder,
-                      raw_cmd.head,
-           raw_cmd.sector, nsect, (unsigned long) Copy_buffer, CURRENT);
-
-       cont = &rw_cont;
-       errors = &(CURRENT->errors);
-#if 0
-       mfm_tq.routine = (void (*)(void *)) mfm_initialise;
-       queue_task(&mfm_tq, &tq_immediate);
-       mark_bh(IMMEDIATE_BH);
-#else
-       mfm_initialise();
-#endif
-}                              /* issue_request */
-
-/*
- * Called when an error has just happened - need to trick mfm_request
- * into thinking we weren't busy
- *
- * Turn off ints - mfm_request expects them this way
- */
-static void mfm_rerequest(void)
-{
-       DBG("mfm_rerequest\n");
-       cli();
-       Busy = 0;
-       mfm_request();
-}
-
-static struct gendisk *mfm_gendisk[2];
-
-static void mfm_request(void)
-{
-       DBG("mfm_request CURRENT=%p Busy=%d\n", CURRENT, Busy);
-
-       /* If we are still processing then return; we will get called again */
-       if (Busy) {
-               /* Again seems to be common in 1.3.45 */
-               /*DBG*/printk("mfm_request: Exiting due to busy\n");
-               return;
-       }
-       Busy = 1;
-
-       while (1) {
-               unsigned int block, nsect;
-               struct gendisk *disk;
-
-               DBG("mfm_request: loop start\n");
-               sti();
-
-               DBG("mfm_request: before !CURRENT\n");
-
-               if (!CURRENT) {
-                       printk("mfm_request: Exiting due to empty queue (pre)\n");
-                       do_mfm = NULL;
-                       Busy = 0;
-                       return;
-               }
-
-               DBG("mfm_request:                 before arg extraction\n");
-
-               disk = CURRENT->rq_disk;
-               block = CURRENT->sector;
-               nsect = CURRENT->nr_sectors;
-               if (block >= get_capacity(disk) ||
-                   block+nsect > get_capacity(disk)) {
-                       printk("%s: bad access: block=%d, count=%d, nr_sects=%ld\n",
-                              disk->disk_name, block, nsect, get_capacity(disk));
-                       printk("mfm: continue 1\n");
-                       end_request(CURRENT, 0);
-                       Busy = 0;
-                       continue;
-               }
-
-               /* DAG: Linux doesn't cope with this - even though it has an array telling
-                  it the hardware block size - silly */
-               block <<= 1;    /* Now in 256 byte sectors */
-               nsect <<= 1;    /* Ditto */
-
-               SectorsLeftInRequest = nsect >> 1;
-               Sectors256LeftInCurrent = CURRENT->current_nr_sectors * 2;
-               Copy_buffer = CURRENT->buffer;
-               Copy_Sector = CURRENT->sector << 1;
-
-               DBG("mfm_request: block after offset=%d\n", block);
-
-               issue_request(block, nsect, CURRENT);
-
-               break;
-       }
-       DBG("mfm_request: Dropping out bottom\n");
-}
-
-static void do_mfm_request(struct request_queue *q)
-{
-       DBG("do_mfm_request: about to mfm_request\n");
-       mfm_request();
-}
-
-static void mfm_interrupt_handler(int unused, void *dev_id)
-{
-       void (*handler) (void) = do_mfm;
-
-       do_mfm = NULL;
-
-       DBG("mfm_interrupt_handler (handler=0x%p)\n", handler);
-
-       mfm_status = inw(MFM_STATUS);
-
-       /* If CPR (Command Parameter Reject) and not busy it means that the command
-          has some return message to give us */
-       if ((mfm_status & (STAT_CPR | STAT_BSY)) == STAT_CPR) {
-               int len = 0;
-               while (len < 16) {
-                       int in;
-                       in = inw(MFM_DATAIN);
-                       result[len++] = in >> 8;
-                       result[len++] = in;
-               }
-       }
-       if (handler) {
-               handler();
-               return;
-       }
-       outw (CMD_RCAL, MFM_COMMAND);   /* Clear interrupt condition */
-       printk ("mfm: unexpected interrupt - status = ");
-       print_status ();
-       while (1);
-}
-
-
-
-
-
-/*
- * Tell the user about the drive if we decided it exists.
- */
-static void mfm_geometry(int drive)
-{
-       struct mfm_info *p = mfm_info + drive;
-       struct gendisk *disk = mfm_gendisk[drive];
-       disk->private_data = p;
-       if (p->cylinders)
-               printk ("%s: %dMB CHS=%d/%d/%d LCC=%d RECOMP=%d\n",
-                       disk->disk_name,
-                       p->cylinders * p->heads * p->sectors / 4096,
-                       p->cylinders, p->heads, p->sectors,
-                       p->lowcurrent, p->precomp);
-       set_capacity(disk, p->cylinders * p->heads * p->sectors / 2);
-}
-
-#ifdef CONFIG_BLK_DEV_MFM_AUTODETECT
-/*
- * Attempt to detect a drive and find its geometry.  The drive has already been
- * specified...
- *
- * We first recalibrate the disk, then try to probe sectors, heads and then
- * cylinders.  NOTE! the cylinder probe may break drives.  The xd disk driver
- * does something along these lines, so I assume that most drives are up to
- * this mistreatment...
- */
-static int mfm_detectdrive (int drive)
-{
-       unsigned int mingeo[3], maxgeo[3];
-       unsigned int attribute, need_recal = 1;
-       unsigned char cmdb[8];
-
-       memset (mingeo, 0, sizeof (mingeo));
-       maxgeo[0] = mfm_info[drive].sectors;
-       maxgeo[1] = mfm_info[drive].heads;
-       maxgeo[2] = mfm_info[drive].cylinders;
-
-       cmdb[0] = drive + 1;
-       cmdb[6] = 0;
-       cmdb[7] = 1;
-       for (attribute = 0; attribute < 3; attribute++) {
-               while (mingeo[attribute] != maxgeo[attribute]) {
-                       unsigned int variable;
-
-                       variable = (maxgeo[attribute] + mingeo[attribute]) >> 1;
-                       cmdb[1] = cmdb[2] = cmdb[3] = cmdb[4] = cmdb[5] = 0;
-
-                       if (need_recal) {
-                               int tries = 5;
-
-                               do {
-                                       issue_command (CMD_RCLB, cmdb, 2);
-                                       wait_for_completion ();
-                                       wait_for_command_end ();
-                                       if  (result[1] == 0x20)
-                                               break;
-                               } while (result[1] && --tries);
-                               if (result[1]) {
-                                       outw (CMD_RCAL, MFM_COMMAND);
-                                       return 0;
-                               }
-                               need_recal = 0;
-                       }
-
-                       switch (attribute) {
-                       case 0:
-                               cmdb[5] = variable;
-                               issue_command (CMD_CMPD, cmdb, 8);
-                               break;
-                       case 1:
-                               cmdb[1] = variable;
-                               cmdb[4] = variable;
-                               issue_command (CMD_CMPD, cmdb, 8);
-                               break;
-                       case 2:
-                               cmdb[2] = variable >> 8;
-                               cmdb[3] = variable;
-                               issue_command (CMD_SEK, cmdb, 4);
-                               break;
-                       }
-                       wait_for_completion ();
-                       wait_for_command_end ();
-
-                       switch (result[1]) {
-                       case 0x00:
-                       case 0x50:
-                               mingeo[attribute] = variable + 1;
-                               break;
-
-                       case 0x20:
-                               outw (CMD_RCAL, MFM_COMMAND);
-                               return 0;
-
-                       case 0x24:
-                               need_recal = 1;
-                       default:
-                               maxgeo[attribute] = variable;
-                               break;
-                       }
-               }
-       }
-       mfm_info[drive].cylinders  = mingeo[2];
-       mfm_info[drive].lowcurrent = mingeo[2];
-       mfm_info[drive].precomp    = mingeo[2] / 2;
-       mfm_info[drive].heads      = mingeo[1];
-       mfm_info[drive].sectors    = mingeo[0];
-       outw (CMD_RCAL, MFM_COMMAND);
-       return 1;
-}
-#endif
-
-/*
- * Initialise all drive information for this controller.
- */
-static int mfm_initdrives(void)
-{
-       int drive;
-
-       if (number_mfm_drives > MFM_MAXDRIVES) {
-               number_mfm_drives = MFM_MAXDRIVES;
-               printk("No. of ADFS MFM drives is greater than MFM_MAXDRIVES - you can't have that many!\n");
-       }
-
-       for (drive = 0; drive < number_mfm_drives; drive++) {
-               mfm_info[drive].lowcurrent = 1;
-               mfm_info[drive].precomp    = 1;
-               mfm_info[drive].cylinder   = -1;
-               mfm_info[drive].errors.recal  = 0;
-               mfm_info[drive].errors.report = 0;
-               mfm_info[drive].errors.abort  = 4;
-
-#ifdef CONFIG_BLK_DEV_MFM_AUTODETECT
-               mfm_info[drive].cylinders  = 1024;
-               mfm_info[drive].heads      = 8;
-               mfm_info[drive].sectors    = 64;
-               {
-                       unsigned char cmdb[16];
-
-                       mfm_setupspecify (drive, cmdb);
-                       cmdb[1] &= ~0x81;
-                       issue_command (CMD_SPC, cmdb, 16);
-                       wait_for_completion ();
-                       if (!mfm_detectdrive (drive)) {
-                               mfm_info[drive].cylinders = 0;
-                               mfm_info[drive].heads     = 0;
-                               mfm_info[drive].sectors   = 0;
-                       }
-                       cmdb[0] = cmdb[1] = 0;
-                       issue_command (CMD_CKV, cmdb, 2);
-               }
-#else
-               mfm_info[drive].cylinders  = 1; /* its going to have to figure it out from the partition info */
-               mfm_info[drive].heads      = 4;
-               mfm_info[drive].sectors    = 32;
-#endif
-       }
-       return number_mfm_drives;
-}
-
-
-
-/*
- * The 'front' end of the mfm driver follows...
- */
-
-static int mfm_getgeo(struct block_device *bdev, struct hd_geometry *geo)
-{
-       struct mfm_info *p = bdev->bd_disk->private_data;
-
-       geo->heads = p->heads;
-       geo->sectors = p->sectors;
-       geo->cylinders = p->cylinders;
-       return 0;
-}
-
-/*
- * This is to handle various kernel command line parameters
- * specific to this driver.
- */
-void mfm_setup(char *str, int *ints)
-{
-       return;
-}
-
-/*
- * Set the CHS from the ADFS boot block if it is present.  This is not ideal
- * since if there are any non-ADFS partitions on the disk, this won't work!
- * Hence, I want to get rid of this...
- */
-void xd_set_geometry(struct block_device *bdev, unsigned char secsptrack,
-                       unsigned char heads, unsigned int secsize)
-{
-       struct mfm_info *p = bdev->bd_disk->private_data;
-       int drive = p - mfm_info;
-       unsigned long disksize = bdev->bd_inode->i_size;
-
-       if (p->cylinders == 1) {
-               p->sectors = secsptrack;
-               p->heads = heads;
-               p->cylinders = discsize / (secsptrack * heads * secsize);
-
-               if ((heads < 1) || (p->cylinders > 1024)) {
-                       printk("%s: Insane disc shape! Setting to 512/4/32\n",
-                               bdev->bd_disk->disk_name);
-
-                       /* These values are fairly arbitary, but are there so that if your
-                        * lucky you can pick apart your disc to find out what is going on -
-                        * I reckon these figures won't hurt MOST drives
-                        */
-                       p->sectors = 32;
-                       p->heads = 4;
-                       p->cylinders = 512;
-               }
-               if (raw_cmd.dev == drive)
-                       mfm_specify ();
-               mfm_geometry (drive);
-       }
-}
-
-static struct block_device_operations mfm_fops =
-{
-       .owner          = THIS_MODULE,
-       .getgeo         = mfm_getgeo,
-};
-
-/*
- * See if there is a controller at the address presently at mfm_addr
- *
- * We check to see if the controller is busy - if it is, we abort it first,
- * and check that the chip is no longer busy after at least 180 clock cycles.
- * We then issue a command and check that the BSY or CPR bits are set.
- */
-static int mfm_probecontroller (unsigned int mfm_addr)
-{
-       if (inw (MFM_STATUS) & STAT_BSY) {
-               outw (CMD_ABT, MFM_COMMAND);
-               udelay (50);
-               if (inw (MFM_STATUS) & STAT_BSY)
-                       return 0;
-       }
-
-       if (inw (MFM_STATUS) & STAT_CED)
-               outw (CMD_RCAL, MFM_COMMAND);
-
-       outw (CMD_SEK, MFM_COMMAND);
-
-       if (inw (MFM_STATUS) & (STAT_BSY | STAT_CPR)) {
-               unsigned int count = 2000;
-               while (inw (MFM_STATUS) & STAT_BSY) {
-                       udelay (500);
-                       if (!--count)
-                               return 0;
-               }
-
-               outw (CMD_RCAL, MFM_COMMAND);
-       }
-       return 1;
-}
-
-static int mfm_do_init(unsigned char irqmask)
-{
-       int i, ret;
-
-       printk("mfm: found at address %08X, interrupt %d\n", mfm_addr, mfm_irq);
-
-       ret = -EBUSY;
-       if (!request_region (mfm_addr, 10, "mfm"))
-               goto out1;
-
-       ret = register_blkdev(MAJOR_NR, "mfm");
-       if (ret)
-               goto out2;
-
-       /* Stuff for the assembler routines to get to */
-       hdc63463_baseaddress    = ioaddr(mfm_addr);
-       hdc63463_irqpolladdress = mfm_IRQPollLoc;
-       hdc63463_irqpollmask    = irqmask;
-
-       mfm_queue = blk_init_queue(do_mfm_request, &mfm_lock);
-       if (!mfm_queue)
-               goto out2a;
-
-       Busy = 0;
-       lastspecifieddrive = -1;
-
-       mfm_drives = mfm_initdrives();
-       if (!mfm_drives) {
-               ret = -ENODEV;
-               goto out3;
-       }
-       
-       for (i = 0; i < mfm_drives; i++) {
-               struct gendisk *disk = alloc_disk(64);
-               if (!disk)
-                       goto Enomem;
-               disk->major = MAJOR_NR;
-               disk->first_minor = i << 6;
-               disk->fops = &mfm_fops;
-               sprintf(disk->disk_name, "mfm%c", 'a'+i);
-               mfm_gendisk[i] = disk;
-       }
-
-       printk("mfm: detected %d hard drive%s\n", mfm_drives,
-                               mfm_drives == 1 ? "" : "s");
-       ret = request_irq(mfm_irq, mfm_interrupt_handler, IRQF_DISABLED, "MFM harddisk", NULL);
-       if (ret) {
-               printk("mfm: unable to get IRQ%d\n", mfm_irq);
-               goto out4;
-       }
-
-       if (mfm_irqenable)
-               outw(0x80, mfm_irqenable);      /* Required to enable IRQs from MFM podule */
-
-       for (i = 0; i < mfm_drives; i++) {
-               mfm_geometry(i);
-               mfm_gendisk[i]->queue = mfm_queue;
-               add_disk(mfm_gendisk[i]);
-       }
-       return 0;
-
-out4:
-       for (i = 0; i < mfm_drives; i++)
-               put_disk(mfm_gendisk[i]);
-out3:
-       blk_cleanup_queue(mfm_queue);
-out2a:
-       unregister_blkdev(MAJOR_NR, "mfm");
-out2:
-       release_region(mfm_addr, 10);
-out1:
-       return ret;
-Enomem:
-       while (i--)
-               put_disk(mfm_gendisk[i]);
-       goto out3;
-}
-
-static void mfm_do_exit(void)
-{
-       int i;
-
-       free_irq(mfm_irq, NULL);
-       for (i = 0; i < mfm_drives; i++) {
-               del_gendisk(mfm_gendisk[i]);
-               put_disk(mfm_gendisk[i]);
-       }
-       blk_cleanup_queue(mfm_queue);
-       unregister_blkdev(MAJOR_NR, "mfm");
-       if (mfm_addr)
-               release_region(mfm_addr, 10);
-}
-
-static int __devinit mfm_probe(struct expansion_card *ec, struct ecard_id *id)
-{
-       if (mfm_addr)
-               return -EBUSY;
-
-       mfm_addr        = ecard_address(ec, ECARD_IOC, ECARD_MEDIUM) + 0x800;
-       mfm_IRQPollLoc  = ioaddr(mfm_addr + 0x400);
-       mfm_irqenable   = mfm_IRQPollLoc;
-       mfm_irq         = ec->irq;
-
-       return mfm_do_init(0x08);
-}
-
-static void __devexit mfm_remove(struct expansion_card *ec)
-{
-       outw (0, mfm_irqenable);        /* Required to enable IRQs from MFM podule */
-       mfm_do_exit();
-}
-
-static const struct ecard_id mfm_cids[] = {
-       { MANU_ACORN, PROD_ACORN_MFM },
-       { 0xffff, 0xffff },
-};
-
-static struct ecard_driver mfm_driver = {
-       .probe          = mfm_probe,
-       .remove         = __devexit(mfm_remove),
-       .id_table       = mfm_cids,
-       .drv = {
-               .name   = "mfm",
-       },
-};
-
-/*
- * Look for a MFM controller - first check the motherboard, then the podules
- * The podules have an extra interrupt enable that needs to be played with
- *
- * The HDC is accessed at MEDIUM IOC speeds.
- */
-static int __init mfm_init (void)
-{
-       unsigned char irqmask;
-
-       if (mfm_probecontroller(ONBOARD_MFM_ADDRESS)) {
-               mfm_addr        = ONBOARD_MFM_ADDRESS;
-               mfm_IRQPollLoc  = IOC_IRQSTATB;
-               mfm_irqenable   = 0;
-               mfm_irq         = IRQ_HARDDISK;
-               return mfm_do_init(0x08);       /* IL3 pin */
-       } else {
-               return ecard_register_driver(&mfm_driver);
-       }
-}
-
-static void __exit mfm_exit(void)
-{
-       if (mfm_addr == ONBOARD_MFM_ADDRESS)
-               mfm_do_exit();
-       else
-               ecard_unregister_driver(&mfm_driver);
-}
-
-module_init(mfm_init)
-module_exit(mfm_exit)
-MODULE_LICENSE("GPL");
index 251344cb29aea1f04f2e42935b52c68c09103ba3..f1372de4ce7904d06577df91f24a5be725bb852e 100644 (file)
@@ -11,9 +11,6 @@ menuconfig ACPI
        depends on PCI
        depends on PM
        select PNP
-       # for sleep
-       select HOTPLUG_CPU if X86 && SMP
-       select SUSPEND_SMP if X86 && SMP
        default y
        ---help---
          Advanced Configuration and Power Interface (ACPI) support for 
@@ -45,6 +42,11 @@ menuconfig ACPI
 
 if ACPI
 
+config ACPI_SLEEP
+       bool
+       depends on PM_SLEEP
+       default y
+
 config ACPI_PROCFS
        bool "Deprecated /proc/acpi files"
        depends on PROC_FS
index 9c4bd220c44fdf30381046b169c336365f10214a..86fd142f4bf3929731a7b43ef3dc1d1d825f696d 100644 (file)
@@ -1192,6 +1192,7 @@ static int asus_hotk_get_info(void)
                        break;
                default:
                        kfree(model);
+                       model = NULL;
                        break;
                }
        }
index 81651032791b32364e3ed3b4cc45c0341a9db355..d7b499fe0cd932fec5f8c6a9c7237cd38b962acc 100644 (file)
@@ -113,7 +113,7 @@ struct acpi_battery_info {
        acpi_string oem_info;
 };
 
-enum acpi_battery_files{
+enum acpi_battery_files {
        ACPI_BATTERY_INFO = 0,
        ACPI_BATTERY_STATE,
        ACPI_BATTERY_ALARM,
@@ -129,13 +129,14 @@ struct acpi_battery_flags {
 };
 
 struct acpi_battery {
-       struct mutex mutex;
        struct acpi_device *device;
        struct acpi_battery_flags flags;
        struct acpi_buffer bif_data;
        struct acpi_buffer bst_data;
+       struct mutex lock;
        unsigned long alarm;
        unsigned long update_time[ACPI_BATTERY_NUMFILES];
+
 };
 
 inline int acpi_battery_present(struct acpi_battery *battery)
@@ -235,10 +236,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
                return 0;
 
        /* Evaluate _BIF */
-
-       status =
-           acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL,
-                                &buffer);
+       mutex_lock(&battery->lock);
+       status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF",
+                                     NULL, &buffer);
+       mutex_unlock(&battery->lock);
        if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
                return -ENODEV;
@@ -285,10 +286,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
                return 0;
 
        /* Evaluate _BST */
-
-       status =
-           acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL,
-                                &buffer);
+       mutex_lock(&battery->lock);
+       status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST",
+                                     NULL, &buffer);
+       mutex_unlock(&battery->lock);
        if (ACPI_FAILURE(status)) {
                ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
                return -ENODEV;
@@ -336,9 +337,10 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery,
 
        arg0.integer.value = alarm;
 
-       status =
-           acpi_evaluate_object(acpi_battery_handle(battery), "_BTP",
+       mutex_lock(&battery->lock);
+       status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP",
                                 &arg_list, NULL);
+       mutex_unlock(&battery->lock);
        if (ACPI_FAILURE(status))
                return -ENODEV;
 
@@ -658,8 +660,6 @@ acpi_battery_write_alarm(struct file *file,
        if (!battery || (count > sizeof(alarm_string) - 1))
                return -EINVAL;
 
-       mutex_lock(&battery->mutex);
-
        result = acpi_battery_update(battery, 1, &update_result);
        if (result) {
                result = -ENODEV;
@@ -688,9 +688,7 @@ acpi_battery_write_alarm(struct file *file,
        acpi_battery_check_result(battery, result);
 
        if (!result)
-               result = count;
-
-       mutex_unlock(&battery->mutex);
+               return count;
 
        return result;
 }
@@ -714,8 +712,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
        int update_result = ACPI_BATTERY_NONE_UPDATE;
        int update = 0;
 
-       mutex_lock(&battery->mutex);
-
        update = (get_seconds() - battery->update_time[fid] >= update_time);
        update = (update | battery->flags.update[fid]);
 
@@ -733,7 +729,6 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
        result = acpi_read_funcs[fid].print(seq, result);
        acpi_battery_check_result(battery, result);
        battery->flags.update[fid] = result;
-       mutex_unlock(&battery->mutex);
        return result;
 }
 
@@ -897,10 +892,7 @@ static int acpi_battery_add(struct acpi_device *device)
        if (!battery)
                return -ENOMEM;
 
-       mutex_init(&battery->mutex);
-
-       mutex_lock(&battery->mutex);
-
+       mutex_init(&battery->lock);
        battery->device = device;
        strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
        strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
@@ -936,7 +928,6 @@ static int acpi_battery_add(struct acpi_device *device)
                kfree(battery);
        }
 
-       mutex_unlock(&battery->mutex);
 
        return result;
 }
@@ -951,8 +942,6 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
 
        battery = acpi_driver_data(device);
 
-       mutex_lock(&battery->mutex);
-
        status = acpi_remove_notify_handler(device->handle,
                                            ACPI_ALL_NOTIFY,
                                            acpi_battery_notify);
@@ -963,9 +952,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
 
        kfree(battery->bst_data.pointer);
 
-       mutex_unlock(&battery->mutex);
-
-       mutex_destroy(&battery->mutex);
+       mutex_destroy(&battery->lock);
 
        kfree(battery);
 
index 56a5b3fffeb364a14e8fe3ff7f5b9a1ff103f51e..6daf6088ac888329177f35e4f7258bc8dfa42ddb 100644 (file)
@@ -337,7 +337,7 @@ static void bay_notify(acpi_handle handle, u32 event, void *data)
        char *envp[] = { event_string, NULL };
 
        bay_dprintk(handle, "Bay event");
-       sprintf(event_string, "BAY_EVENT=%d\n", event);
+       sprintf(event_string, "BAY_EVENT=%d", event);
        kobject_uevent_env(&dev->kobj, KOBJ_CHANGE, envp);
 }
 
index 6192c8be66df62587e0ee49e3af2a31b145b38bc..1dabdf4c07b36308e4ece7f7f3a0497ee4bb0c1c 100644 (file)
@@ -336,13 +336,13 @@ static void hotplug_dock_devices(struct dock_station *ds, u32 event)
 static void dock_event(struct dock_station *ds, u32 event, int num)
 {
        struct device *dev = &dock_device->dev;
-       char event_string[7];
+       char event_string[13];
        char *envp[] = { event_string, NULL };
 
        if (num == UNDOCK_EVENT)
-               sprintf(event_string, "UNDOCK");
+               sprintf(event_string, "EVENT=undock");
        else
-               sprintf(event_string, "DOCK");
+               sprintf(event_string, "EVENT=dock");
 
        /*
         * Indicate that the status of the dock station has
index 469f3f57f88133c43ad30f492fb8b7c28fd8658d..56bee9e065cf3e395e6680b4667cdaad5da45d84 100644 (file)
@@ -471,7 +471,6 @@ static void acpi_ec_gpe_query(void *ec_cxt)
                }
        }
        mutex_unlock(&ec->lock);
-       printk(KERN_ERR PREFIX "Handler for query 0x%x is not found!\n", value);
 }
 
 static u32 acpi_ec_gpe_handler(void *data)
@@ -665,30 +664,44 @@ acpi_ec_register_query_methods(acpi_handle handle, u32 level,
        return AE_OK;
 }
 
-static int ec_parse_device(struct acpi_ec *ec, acpi_handle handle)
+static acpi_status
+ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
 {
-       if (ACPI_FAILURE(acpi_walk_resources(handle, METHOD_NAME__CRS,
-                                    ec_parse_io_ports, ec)))
-               return -EINVAL;
+       acpi_status status;
+
+       struct acpi_ec *ec = context;
+       status = acpi_walk_resources(handle, METHOD_NAME__CRS,
+                                    ec_parse_io_ports, ec);
+       if (ACPI_FAILURE(status))
+               return status;
 
        /* Get GPE bit assignment (EC events). */
        /* TODO: Add support for _GPE returning a package */
-       if (ACPI_FAILURE(acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe)))
-               return -EINVAL;
-
-       /* Use the global lock for all EC transactions? */
-       acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
+       status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec->gpe);
+       if (ACPI_FAILURE(status))
+               return status;
 
        /* Find and register all query methods */
        acpi_walk_namespace(ACPI_TYPE_METHOD, handle, 1,
                            acpi_ec_register_query_methods, ec, NULL);
 
+       /* Use the global lock for all EC transactions? */
+       acpi_evaluate_integer(handle, "_GLK", NULL, &ec->global_lock);
+
        ec->handle = handle;
 
-       printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx",
+       printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n",
                          ec->gpe, ec->command_addr, ec->data_addr);
 
-       return 0;
+       return AE_CTRL_TERMINATE;
+}
+
+static void ec_remove_handlers(struct acpi_ec *ec)
+{
+       acpi_remove_address_space_handler(ec->handle,
+                                         ACPI_ADR_SPACE_EC,
+                                         &acpi_ec_space_handler);
+       acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
 }
 
 static int acpi_ec_add(struct acpi_device *device)
@@ -705,7 +718,8 @@ static int acpi_ec_add(struct acpi_device *device)
        if (!ec)
                return -ENOMEM;
 
-       if (ec_parse_device(ec, device->handle)) {
+       if (ec_parse_device(device->handle, 0, ec, NULL) !=
+           AE_CTRL_TERMINATE) {
                kfree(ec);
                return -EINVAL;
        }
@@ -713,16 +727,13 @@ static int acpi_ec_add(struct acpi_device *device)
        /* Check if we found the boot EC */
        if (boot_ec) {
                if (boot_ec->gpe == ec->gpe) {
-                       /* We might have incorrect info for GL at boot time */
-                       mutex_lock(&boot_ec->lock);
-                       boot_ec->global_lock = ec->global_lock;
-                       /* Copy handlers from new ec into boot ec */
-                       list_splice(&ec->list, &boot_ec->list);
-                       mutex_unlock(&boot_ec->lock);
-                       kfree(ec);
-                       ec = boot_ec;
+                       ec_remove_handlers(boot_ec);
+                       mutex_destroy(&boot_ec->lock);
+                       kfree(boot_ec);
+                       first_ec = boot_ec = NULL;
                }
-       } else
+       }
+       if (!first_ec)
                first_ec = ec;
        ec->handle = device->handle;
        acpi_driver_data(device) = ec;
@@ -734,14 +745,14 @@ static int acpi_ec_add(struct acpi_device *device)
 static int acpi_ec_remove(struct acpi_device *device, int type)
 {
        struct acpi_ec *ec;
-       struct acpi_ec_query_handler *handler;
+       struct acpi_ec_query_handler *handler, *tmp;
 
        if (!device)
                return -EINVAL;
 
        ec = acpi_driver_data(device);
        mutex_lock(&ec->lock);
-       list_for_each_entry(handler, &ec->list, node) {
+       list_for_each_entry_safe(handler, tmp, &ec->list, node) {
                list_del(&handler->node);
                kfree(handler);
        }
@@ -751,9 +762,6 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
        if (ec == first_ec)
                first_ec = NULL;
 
-       /* Don't touch boot EC */
-       if (boot_ec != ec)
-               kfree(ec);
        return 0;
 }
 
@@ -817,9 +825,7 @@ static int acpi_ec_start(struct acpi_device *device)
        if (!ec)
                return -EINVAL;
 
-       /* Boot EC is already working */
-       if (ec != boot_ec)
-               ret = ec_install_handlers(ec);
+       ret = ec_install_handlers(ec);
 
        /* EC is fully operational, allow queries */
        atomic_set(&ec->query_pending, 0);
@@ -829,7 +835,6 @@ static int acpi_ec_start(struct acpi_device *device)
 
 static int acpi_ec_stop(struct acpi_device *device, int type)
 {
-       acpi_status status;
        struct acpi_ec *ec;
 
        if (!device)
@@ -838,21 +843,7 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
        ec = acpi_driver_data(device);
        if (!ec)
                return -EINVAL;
-
-       /* Don't touch boot EC */
-       if (ec == boot_ec)
-               return 0;
-
-       status = acpi_remove_address_space_handler(ec->handle,
-                                                  ACPI_ADR_SPACE_EC,
-                                                  &acpi_ec_space_handler);
-       if (ACPI_FAILURE(status))
-               return -ENODEV;
-
-       status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
-       if (ACPI_FAILURE(status))
-               return -ENODEV;
-
+       ec_remove_handlers(ec);
        return 0;
 }
 
@@ -868,18 +859,21 @@ int __init acpi_ec_ecdt_probe(void)
        /*
         * Generate a boot ec context
         */
-
        status = acpi_get_table(ACPI_SIG_ECDT, 1,
                                (struct acpi_table_header **)&ecdt_ptr);
-       if (ACPI_FAILURE(status))
-               goto error;
-
-       printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n");
-
-       boot_ec->command_addr = ecdt_ptr->control.address;
-       boot_ec->data_addr = ecdt_ptr->data.address;
-       boot_ec->gpe = ecdt_ptr->gpe;
-       boot_ec->handle = ACPI_ROOT_OBJECT;
+       if (ACPI_SUCCESS(status)) {
+               printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n\n");
+               boot_ec->command_addr = ecdt_ptr->control.address;
+               boot_ec->data_addr = ecdt_ptr->data.address;
+               boot_ec->gpe = ecdt_ptr->gpe;
+               boot_ec->handle = ACPI_ROOT_OBJECT;
+       } else {
+               printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n");
+               status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device,
+                                               boot_ec, NULL);
+               if (ACPI_FAILURE(status))
+                       goto error;
+       }
 
        ret = ec_install_handlers(boot_ec);
        if (!ret) {
index dfa5853b17f097555095c9b87668d03a39ba6bd8..95637a4ff782b1d5975e656a23dcd2559d0dbcb9 100644 (file)
@@ -108,7 +108,7 @@ static const struct file_operations acpi_system_event_ops = {
 };
 
 #ifdef CONFIG_NET
-unsigned int acpi_event_seqnum;
+static unsigned int acpi_event_seqnum;
 struct acpi_genl_event {
        acpi_device_class device_class;
        char bus_id[15];
index a898991f77cbcfb18fc41c481afeca1fc63f0697..a8634a0655fca429b0a52f3c43b8d57a8ccc3095 100644 (file)
@@ -969,11 +969,17 @@ static void acpi_processor_power_verify_c3(struct acpi_processor *pr,
        }
 
        if (pr->flags.bm_check) {
-               /* bus mastering control is necessary */
                if (!pr->flags.bm_control) {
-                       /* In this case we enter C3 without bus mastering */
-                       ACPI_DEBUG_PRINT((ACPI_DB_INFO,
-                               "C3 support without bus mastering control\n"));
+                       if (pr->flags.has_cst != 1) {
+                               /* bus mastering control is necessary */
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                       "C3 support requires BM control\n"));
+                               return;
+                       } else {
+                               /* Here we enter C3 without bus mastering */
+                               ACPI_DEBUG_PRINT((ACPI_DB_INFO,
+                                       "C3 support without BM control\n"));
+                       }
                }
        } else {
                /*
index c4efc0c17f8f3029d244962be92482b30e36bcb4..463b0247cbc517c40567446df9446fff389c849b 100644 (file)
@@ -539,7 +539,7 @@ end:
 }
 
 int acpi_processor_preregister_performance(
-               struct acpi_processor_performance **performance)
+               struct acpi_processor_performance *performance)
 {
        int count, count_target;
        int retval = 0;
@@ -567,12 +567,12 @@ int acpi_processor_preregister_performance(
                        continue;
                }
 
-               if (!performance || !performance[i]) {
+               if (!performance || !percpu_ptr(performance, i)) {
                        retval = -EINVAL;
                        continue;
                }
 
-               pr->performance = performance[i];
+               pr->performance = percpu_ptr(performance, i);
                cpu_set(i, pr->performance->shared_cpu_map);
                if (acpi_processor_get_psd(pr)) {
                        retval = -EINVAL;
index f63813a358c57f37b96c9c0517f5b37b9d63ce4c..4c3fd4cdaf7382f6b04fb9b1470716c95454aea7 100644 (file)
@@ -474,8 +474,6 @@ acpi_rs_match_vendor_resource(struct acpi_resource *resource, void *context)
        return (AE_CTRL_TERMINATE);
 }
 
-ACPI_EXPORT_SYMBOL(acpi_rs_match_vendor_resource)
-
 /*******************************************************************************
  *
  * FUNCTION:    acpi_walk_resources
index 7d8e78ea13a514c4969aaecc069b73f2a3b400d8..82c3a550016d82068798351123f5d2b429ef64d4 100644 (file)
@@ -1415,7 +1415,7 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type)
        char dir_name[32];
        int do_battery_init = 0, do_ac_init = 0;
        int old_remaining_capacity = 0;
-       int update_ac = 1, update_battery = 1;
+       int update_battery = 1;
        int up_tm = update_time;
 
        if (sbs_zombie(sbs)) {
@@ -1435,10 +1435,6 @@ static int acpi_sbs_update_run(struct acpi_sbs *sbs, int id, int data_type)
 
        sbs->run_cnt++;
 
-       if (!update_ac && !update_battery) {
-               goto end;
-       }
-
        old_ac_present = sbs->ac.ac_present;
 
        result = acpi_ac_get_present(sbs);
index 01a993a1d08612b4e0a4fa5a2384806c8733d432..195a4f69c0f773d4ba73119d3efd0512c9d10454 100644 (file)
@@ -1,5 +1,5 @@
 obj-y                                  := poweroff.o wakeup.o
-obj-y                                  += main.o
-obj-$(CONFIG_X86)                      += proc.o
+obj-$(CONFIG_ACPI_SLEEP)               += main.o
+obj-$(CONFIG_ACPI_SLEEP)               += proc.o
 
 EXTRA_CFLAGS += $(ACPI_CFLAGS)
index ab21357c5c7b7d60dd15883981ea3016a94963b2..e8cff5dd4cbc8ba20cda8260825bff32122f4cbe 100644 (file)
@@ -21,6 +21,9 @@
 
 u8 sleep_states[ACPI_S_STATE_COUNT];
 
+static u32 acpi_target_sleep_state = ACPI_STATE_S0;
+
+#ifdef CONFIG_SUSPEND
 static struct pm_ops acpi_pm_ops;
 
 extern void do_suspend_lowlevel(void);
@@ -34,11 +37,6 @@ static u32 acpi_suspend_states[] = {
 
 static int init_8259A_after_S1;
 
-extern int acpi_sleep_prepare(u32 acpi_state);
-extern void acpi_power_off(void);
-
-static u32 acpi_target_sleep_state = ACPI_STATE_S0;
-
 /**
  *     acpi_pm_set_target - Set the target system sleep state to the state
  *             associated with given @pm_state, if supported.
@@ -163,21 +161,6 @@ static int acpi_pm_finish(suspend_state_t pm_state)
        return 0;
 }
 
-int acpi_suspend(u32 acpi_state)
-{
-       suspend_state_t states[] = {
-               [1] = PM_SUSPEND_STANDBY,
-               [3] = PM_SUSPEND_MEM,
-               [5] = PM_SUSPEND_MAX
-       };
-
-       if (acpi_state < 6 && states[acpi_state])
-               return pm_suspend(states[acpi_state]);
-       if (acpi_state == 4)
-               return hibernate();
-       return -EINVAL;
-}
-
 static int acpi_pm_state_valid(suspend_state_t pm_state)
 {
        u32 acpi_state;
@@ -202,7 +185,28 @@ static struct pm_ops acpi_pm_ops = {
        .finish = acpi_pm_finish,
 };
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+/*
+ * Toshiba fails to preserve interrupts over S1, reinitialization
+ * of 8259 is needed after S1 resume.
+ */
+static int __init init_ints_after_s1(struct dmi_system_id *d)
+{
+       printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
+       init_8259A_after_S1 = 1;
+       return 0;
+}
+
+static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
+       {
+        .callback = init_ints_after_s1,
+        .ident = "Toshiba Satellite 4030cdt",
+        .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),},
+        },
+       {},
+};
+#endif /* CONFIG_SUSPEND */
+
+#ifdef CONFIG_HIBERNATION
 static int acpi_hibernation_prepare(void)
 {
        return acpi_sleep_prepare(ACPI_STATE_S4);
@@ -254,7 +258,22 @@ static struct hibernation_ops acpi_hibernation_ops = {
        .pre_restore = acpi_hibernation_pre_restore,
        .restore_cleanup = acpi_hibernation_restore_cleanup,
 };
-#endif                         /* CONFIG_SOFTWARE_SUSPEND */
+#endif                         /* CONFIG_HIBERNATION */
+
+int acpi_suspend(u32 acpi_state)
+{
+       suspend_state_t states[] = {
+               [1] = PM_SUSPEND_STANDBY,
+               [3] = PM_SUSPEND_MEM,
+               [5] = PM_SUSPEND_MAX
+       };
+
+       if (acpi_state < 6 && states[acpi_state])
+               return pm_suspend(states[acpi_state]);
+       if (acpi_state == 4)
+               return hibernate();
+       return -EINVAL;
+}
 
 /**
  *     acpi_pm_device_sleep_state - return preferred power state of ACPI device
@@ -331,39 +350,22 @@ int acpi_pm_device_sleep_state(struct device *dev, int wake, int *d_min_p)
        return d_max;
 }
 
-/*
- * Toshiba fails to preserve interrupts over S1, reinitialization
- * of 8259 is needed after S1 resume.
- */
-static int __init init_ints_after_s1(struct dmi_system_id *d)
-{
-       printk(KERN_WARNING "%s with broken S1 detected.\n", d->ident);
-       init_8259A_after_S1 = 1;
-       return 0;
-}
-
-static struct dmi_system_id __initdata acpisleep_dmi_table[] = {
-       {
-        .callback = init_ints_after_s1,
-        .ident = "Toshiba Satellite 4030cdt",
-        .matches = {DMI_MATCH(DMI_PRODUCT_NAME, "S4030CDT/4.3"),},
-        },
-       {},
-};
-
 int __init acpi_sleep_init(void)
 {
+       acpi_status status;
+       u8 type_a, type_b;
+#ifdef CONFIG_SUSPEND
        int i = 0;
 
        dmi_check_system(acpisleep_dmi_table);
+#endif
 
        if (acpi_disabled)
                return 0;
 
+#ifdef CONFIG_SUSPEND
        printk(KERN_INFO PREFIX "(supports");
-       for (i = 0; i < ACPI_S_STATE_COUNT; i++) {
-               acpi_status status;
-               u8 type_a, type_b;
+       for (i = ACPI_STATE_S0; i < ACPI_STATE_S4; i++) {
                status = acpi_get_sleep_type_data(i, &type_a, &type_b);
                if (ACPI_SUCCESS(status)) {
                        sleep_states[i] = 1;
@@ -373,10 +375,14 @@ int __init acpi_sleep_init(void)
        printk(")\n");
 
        pm_set_ops(&acpi_pm_ops);
+#endif
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
-       if (sleep_states[ACPI_STATE_S4])
+#ifdef CONFIG_HIBERNATION
+       status = acpi_get_sleep_type_data(ACPI_STATE_S4, &type_a, &type_b);
+       if (ACPI_SUCCESS(status)) {
                hibernation_set_ops(&acpi_hibernation_ops);
+               sleep_states[ACPI_STATE_S4] = 1;
+       }
 #else
        sleep_states[ACPI_STATE_S4] = 0;
 #endif
index b3f68ef0669ed23ba6077e4c784a9b20eaab9564..39e40d56b034ec9bd46e68c4a9e2d9467c3b9686 100644 (file)
@@ -18,6 +18,7 @@
 
 int acpi_sleep_prepare(u32 acpi_state)
 {
+#ifdef CONFIG_ACPI_SLEEP
        /* do we have a wakeup address for S2 and S3? */
        if (acpi_state == ACPI_STATE_S3) {
                if (!acpi_wakeup_address) {
@@ -30,6 +31,7 @@ int acpi_sleep_prepare(u32 acpi_state)
        }
        ACPI_FLUSH_CPU_CACHE();
        acpi_enable_wakeup_device_prep(acpi_state);
+#endif
        acpi_gpe_sleep_prepare(acpi_state);
        acpi_enter_sleep_state_prep(acpi_state);
        return 0;
index ed58e1168aed6b40c1631b23a5c8317fc4cda39c..66b62b0d3609a52b976316166e1ee1b271a56cb7 100644 (file)
@@ -23,7 +23,7 @@
  */
 
 ACPI_MODULE_NAME("sleep")
-#ifdef CONFIG_ACPI_PROCFS
+#ifdef CONFIG_ACPI_PROCFS_SLEEP
 static int acpi_system_sleep_seq_show(struct seq_file *seq, void *offset)
 {
        int i;
@@ -66,7 +66,7 @@ acpi_system_write_sleep(struct file *file,
                goto Done;
        }
        state = simple_strtoul(str, NULL, 0);
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
        if (state == 4) {
                error = hibernate();
                goto Done;
@@ -76,9 +76,9 @@ acpi_system_write_sleep(struct file *file,
       Done:
        return error ? error : count;
 }
-#endif                         /* CONFIG_ACPI_PROCFS */
+#endif                         /* CONFIG_ACPI_PROCFS_SLEEP */
 
-#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE)
+#if defined(CONFIG_RTC_DRV_CMOS) || defined(CONFIG_RTC_DRV_CMOS_MODULE) || !defined(CONFIG_X86)
 /* use /sys/class/rtc/rtcX/wakealarm instead; it's not ACPI-specific */
 #else
 #define        HAVE_ACPI_LEGACY_ALARM
@@ -471,7 +471,7 @@ static const struct file_operations acpi_system_wakeup_device_fops = {
        .release = single_release,
 };
 
-#ifdef CONFIG_ACPI_PROCFS
+#ifdef CONFIG_ACPI_PROCFS_SLEEP
 static const struct file_operations acpi_system_sleep_fops = {
        .open = acpi_system_sleep_open_fs,
        .read = seq_read,
@@ -479,7 +479,7 @@ static const struct file_operations acpi_system_sleep_fops = {
        .llseek = seq_lseek,
        .release = single_release,
 };
-#endif                         /* CONFIG_ACPI_PROCFS */
+#endif                         /* CONFIG_ACPI_PROCFS_SLEEP */
 
 #ifdef HAVE_ACPI_LEGACY_ALARM
 static const struct file_operations acpi_system_alarm_fops = {
@@ -506,7 +506,7 @@ static int __init acpi_sleep_proc_init(void)
        if (acpi_disabled)
                return 0;
 
-#ifdef CONFIG_ACPI_PROCFS
+#ifdef CONFIG_ACPI_PROCFS_SLEEP
        /* 'sleep' [R/W] */
        entry =
            create_proc_entry("sleep", S_IFREG | S_IRUGO | S_IWUSR,
index f3e70397a7d67d1a95c7652dd067bf90340a5a43..ff1f8504f497e9a5127de4ce95a484b147771733 100644 (file)
@@ -6,3 +6,5 @@ extern void acpi_enable_wakeup_device_prep(u8 sleep_state);
 extern void acpi_enable_wakeup_device(u8 sleep_state);
 extern void acpi_disable_wakeup_device(u8 sleep_state);
 extern void acpi_gpe_sleep_prepare(u32 sleep_state);
+
+extern int acpi_sleep_prepare(u32 acpi_state);
index 5b302c4e293f78dd734e9c322a6551f03c01b493..a9e3331fee5deade7a3e8047a3c9da980e103f25 100644 (file)
@@ -52,6 +52,8 @@ ACPI_MODULE_NAME("tbxface")
 /* Local prototypes */
 static acpi_status acpi_tb_load_namespace(void);
 
+static int no_auto_ssdt;
+
 /*******************************************************************************
  *
  * FUNCTION:    acpi_allocate_root_table
@@ -536,6 +538,10 @@ static acpi_status acpi_tb_load_namespace(void)
 
                ACPI_INFO((AE_INFO, "Table DSDT replaced by host OS"));
                acpi_tb_print_table_header(0, table);
+
+               if (no_auto_ssdt == 0) {
+                       printk(KERN_WARNING "ACPI: DSDT override uses original SSDTs unless \"acpi_no_auto_ssdt\"");
+               }
        }
 
        status =
@@ -577,6 +583,11 @@ static acpi_status acpi_tb_load_namespace(void)
                        continue;
                }
 
+               if (no_auto_ssdt) {
+                       printk(KERN_WARNING "ACPI: SSDT ignored due to \"acpi_no_auto_ssdt\"\n");
+                       continue;
+               }
+
                /* Ignore errors while loading tables, get as many as possible */
 
                (void)acpi_ut_release_mutex(ACPI_MTX_TABLES);
@@ -622,3 +633,15 @@ acpi_status acpi_load_tables(void)
 }
 
 ACPI_EXPORT_SYMBOL(acpi_load_tables)
+
+
+static int __init acpi_no_auto_ssdt_setup(char *s) {
+
+        printk(KERN_NOTICE "ACPI: SSDT auto-load disabled\n");
+
+        no_auto_ssdt = 1;
+
+        return 1;
+}
+
+__setup("acpi_no_auto_ssdt", acpi_no_auto_ssdt_setup);
index 5a62de1b7f2a0e040f1d32a537bc8693a37b0584..1e06159fd9c4a529435615646aedce6c77c0fa96 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/dmi.h>
 #include <linux/init.h>
 #include <linux/types.h>
 #include <linux/proc_fs.h>
@@ -74,10 +75,26 @@ MODULE_AUTHOR("Paul Diefenbaugh");
 MODULE_DESCRIPTION("ACPI Thermal Zone Driver");
 MODULE_LICENSE("GPL");
 
+static int act;
+module_param(act, int, 0644);
+MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n");
+
 static int tzp;
-module_param(tzp, int, 0);
+module_param(tzp, int, 0444);
 MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n");
 
+static int nocrt;
+module_param(nocrt, int, 0);
+MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n");
+
+static int off;
+module_param(off, int, 0);
+MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n");
+
+static int psv;
+module_param(psv, int, 0644);
+MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n");
+
 static int acpi_thermal_add(struct acpi_device *device);
 static int acpi_thermal_remove(struct acpi_device *device, int type);
 static int acpi_thermal_resume(struct acpi_device *device);
@@ -339,9 +356,16 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
 
        /* Passive: Processors (optional) */
 
-       status =
-           acpi_evaluate_integer(tz->device->handle, "_PSV", NULL,
-                                 &tz->trips.passive.temperature);
+       if (psv == -1) {
+               status = AE_SUPPORT;
+       } else if (psv > 0) {
+               tz->trips.passive.temperature = CELSIUS_TO_KELVIN(psv);
+               status = AE_OK;
+       } else {
+               status = acpi_evaluate_integer(tz->device->handle,
+                       "_PSV", NULL, &tz->trips.passive.temperature);
+       }
+
        if (ACPI_FAILURE(status)) {
                tz->trips.passive.flags.valid = 0;
                ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No passive threshold\n"));
@@ -386,11 +410,33 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
 
                char name[5] = { '_', 'A', 'C', ('0' + i), '\0' };
 
-               status =
-                   acpi_evaluate_integer(tz->device->handle, name, NULL,
-                                         &tz->trips.active[i].temperature);
-               if (ACPI_FAILURE(status))
+               if (act == -1)
+                       break;  /* disable all active trip points */
+
+               status = acpi_evaluate_integer(tz->device->handle,
+                       name, NULL, &tz->trips.active[i].temperature);
+
+               if (ACPI_FAILURE(status)) {
+                       if (i == 0)     /* no active trip points */
+                               break;
+                       if (act <= 0)   /* no override requested */
+                               break;
+                       if (i == 1) {   /* 1 trip point */
+                               tz->trips.active[0].temperature =
+                                       CELSIUS_TO_KELVIN(act);
+                       } else {        /* multiple trips */
+                               /*
+                                * Don't allow override higher than
+                                * the next higher trip point
+                                */
+                               tz->trips.active[i - 1].temperature =
+                                   (tz->trips.active[i - 2].temperature <
+                                       CELSIUS_TO_KELVIN(act) ?
+                                       tz->trips.active[i - 2].temperature :
+                                       CELSIUS_TO_KELVIN(act));
+                       }
                        break;
+               }
 
                name[2] = 'L';
                status =
@@ -427,7 +473,7 @@ static int acpi_thermal_get_devices(struct acpi_thermal *tz)
 
 static int acpi_thermal_critical(struct acpi_thermal *tz)
 {
-       if (!tz || !tz->trips.critical.flags.valid)
+       if (!tz || !tz->trips.critical.flags.valid || nocrt)
                return -EINVAL;
 
        if (tz->temperature >= tz->trips.critical.temperature) {
@@ -449,7 +495,7 @@ static int acpi_thermal_critical(struct acpi_thermal *tz)
 
 static int acpi_thermal_hot(struct acpi_thermal *tz)
 {
-       if (!tz || !tz->trips.hot.flags.valid)
+       if (!tz || !tz->trips.hot.flags.valid || nocrt)
                return -EINVAL;
 
        if (tz->temperature >= tz->trips.hot.temperature) {
@@ -824,12 +870,14 @@ static int acpi_thermal_trip_seq_show(struct seq_file *seq, void *offset)
                goto end;
 
        if (tz->trips.critical.flags.valid)
-               seq_printf(seq, "critical (S5):           %ld C\n",
-                          KELVIN_TO_CELSIUS(tz->trips.critical.temperature));
+               seq_printf(seq, "critical (S5):           %ld C%s",
+                          KELVIN_TO_CELSIUS(tz->trips.critical.temperature),
+                          nocrt ? " <disabled>\n" : "\n");
 
        if (tz->trips.hot.flags.valid)
-               seq_printf(seq, "hot (S4):                %ld C\n",
-                          KELVIN_TO_CELSIUS(tz->trips.hot.temperature));
+               seq_printf(seq, "hot (S4):                %ld C%s",
+                          KELVIN_TO_CELSIUS(tz->trips.hot.temperature),
+                          nocrt ? " <disabled>\n" : "\n");
 
        if (tz->trips.passive.flags.valid) {
                seq_printf(seq,
@@ -1281,11 +1329,78 @@ static int acpi_thermal_resume(struct acpi_device *device)
        return AE_OK;
 }
 
+#ifdef CONFIG_DMI
+static int thermal_act(struct dmi_system_id *d) {
+
+       if (act == 0) {
+               printk(KERN_NOTICE "ACPI: %s detected: "
+                       "disabling all active thermal trip points\n", d->ident);
+               act = -1;
+       }
+       return 0;
+}
+static int thermal_tzp(struct dmi_system_id *d) {
+
+       if (tzp == 0) {
+               printk(KERN_NOTICE "ACPI: %s detected: "
+                       "enabling thermal zone polling\n", d->ident);
+               tzp = 300;      /* 300 dS = 30 Seconds */
+       }
+       return 0;
+}
+static int thermal_psv(struct dmi_system_id *d) {
+
+       if (psv == 0) {
+               printk(KERN_NOTICE "ACPI: %s detected: "
+                       "disabling all passive thermal trip points\n", d->ident);
+               psv = -1;
+       }
+       return 0;
+}
+
+static struct dmi_system_id thermal_dmi_table[] __initdata = {
+       /*
+        * Award BIOS on this AOpen makes thermal control almost worthless.
+        * http://bugzilla.kernel.org/show_bug.cgi?id=8842
+        */
+       {
+        .callback = thermal_act,
+        .ident = "AOpen i915GMm-HFS",
+        .matches = {
+               DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
+               DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
+               },
+       },
+       {
+        .callback = thermal_psv,
+        .ident = "AOpen i915GMm-HFS",
+        .matches = {
+               DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
+               DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
+               },
+       },
+       {
+        .callback = thermal_tzp,
+        .ident = "AOpen i915GMm-HFS",
+        .matches = {
+               DMI_MATCH(DMI_BOARD_VENDOR, "AOpen"),
+               DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
+               },
+       },
+       {}
+};
+#endif /* CONFIG_DMI */
+
 static int __init acpi_thermal_init(void)
 {
        int result = 0;
 
+       dmi_check_system(thermal_dmi_table);
 
+       if (off) {
+               printk(KERN_NOTICE "ACPI: thermal control disabled\n");
+               return -ENODEV;
+       }
        acpi_thermal_dir = proc_mkdir(ACPI_THERMAL_CLASS, acpi_root_dir);
        if (!acpi_thermal_dir)
                return -ENODEV;
index ad070861bb5373051e9a8dfa255f87cc926b60af..a78832ea81fa0f5cc9460cca362f498307820cb1 100644 (file)
@@ -890,37 +890,46 @@ static void ich_set_dmamode (struct ata_port *ap, struct ata_device *adev)
 }
 
 #ifdef CONFIG_PM
-static struct dmi_system_id piix_broken_suspend_dmi_table[] = {
-       {
-               .ident = "TECRA M5",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"),
-               },
-       },
-       {
-               .ident = "Satellite U200",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U200"),
+static int piix_broken_suspend(void)
+{
+       static struct dmi_system_id sysids[] = {
+               {
+                       .ident = "TECRA M5",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "TECRA M5"),
+                       },
                },
-       },
-       {
-               .ident = "Satellite U205",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"),
+               {
+                       .ident = "Satellite U205",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "Satellite U205"),
+                       },
                },
-       },
-       {
-               .ident = "Portege M500",
-               .matches = {
-                       DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"),
+               {
+                       .ident = "Portege M500",
+                       .matches = {
+                               DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"),
+                               DMI_MATCH(DMI_PRODUCT_NAME, "PORTEGE M500"),
+                       },
                },
-       },
-       { }
-};
+               { }
+       };
+       static const char *oemstrs[] = {
+               "Tecra M3,",
+       };
+       int i;
+
+       if (dmi_check_system(sysids))
+               return 1;
+
+       for (i = 0; i < ARRAY_SIZE(oemstrs); i++)
+               if (dmi_find_device(DMI_DEV_TYPE_OEM_STRING, oemstrs[i], NULL))
+                       return 1;
+
+       return 0;
+}
 
 static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
 {
@@ -937,8 +946,7 @@ static int piix_pci_device_suspend(struct pci_dev *pdev, pm_message_t mesg)
         * cycles and power trying to do something to the sleeping
         * beauty.
         */
-       if (dmi_check_system(piix_broken_suspend_dmi_table) &&
-           mesg.event == PM_EVENT_SUSPEND) {
+       if (piix_broken_suspend() && mesg.event == PM_EVENT_SUSPEND) {
                pci_save_state(pdev);
 
                /* mark its power state as "unknown", since we don't
@@ -973,10 +981,10 @@ static int piix_pci_device_resume(struct pci_dev *pdev)
                pci_restore_state(pdev);
 
                /* PCI device wasn't disabled during suspend.  Use
-                * __pci_reenable_device() to avoid affecting the
-                * enable count.
+                * pci_reenable_device() to avoid affecting the enable
+                * count.
                 */
-               rc = __pci_reenable_device(pdev);
+               rc = pci_reenable_device(pdev);
                if (rc)
                        dev_printk(KERN_ERR, &pdev->dev, "failed to enable "
                                   "device after resume (%d)\n", rc);
index 6001aae0b8841b88acdb90c4250ce2e5e5d71861..60e78bef469fed2f49423deea956a16b60a0448b 100644 (file)
@@ -3788,6 +3788,7 @@ static const struct ata_blacklist_entry ata_device_blacklist [] = {
        { "WDC WD740ADFD-00NLR1", NULL,         ATA_HORKAGE_NONCQ, },
        { "FUJITSU MHV2080BH",  "00840028",     ATA_HORKAGE_NONCQ, },
        { "ST9160821AS",        "3.CLF",        ATA_HORKAGE_NONCQ, },
+       { "SAMSUNG HD401LJ",    "ZZ100-15",     ATA_HORKAGE_NONCQ, },
 
        /* Devices with NCQ limits */
 
index 6c289c7b13224119d2ff13756ad556bcbff11fcf..1cce2198baaf1203deb7e1e7e6df305e215501df 100644 (file)
@@ -573,6 +573,10 @@ int ata_pci_init_bmdma(struct ata_host *host)
        struct pci_dev *pdev = to_pci_dev(gdev);
        int i, rc;
 
+       /* No BAR4 allocation: No DMA */
+       if (pci_resource_start(pdev, 4) == 0)
+               return 0;
+
        /* TODO: If we get no DMA mask we should fall back to PIO */
        rc = pci_set_dma_mask(pdev, ATA_DMA_MASK);
        if (rc)
index dc443e7dc37c07ee0c138ef475853564d00af6c9..e34b632487d74772efa858d87fe2ce8e66626f4a 100644 (file)
@@ -31,7 +31,7 @@
 #include <linux/libata.h>
 
 #define DRV_NAME "pata_cmd64x"
-#define DRV_VERSION "0.2.3"
+#define DRV_VERSION "0.2.4"
 
 /*
  * CMD64x specific registers definition.
@@ -397,7 +397,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                        .flags = ATA_FLAG_SLAVE_POSS,
                        .pio_mask = 0x1f,
                        .mwdma_mask = 0x07,
-                       .udma_mask = ATA_UDMA1,
+                       .udma_mask = ATA_UDMA2,
                        .port_ops = &cmd64x_port_ops
                },
                {       /* CMD 646 rev 1  */
@@ -412,7 +412,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                        .flags = ATA_FLAG_SLAVE_POSS,
                        .pio_mask = 0x1f,
                        .mwdma_mask = 0x07,
-                       .udma_mask = ATA_UDMA2,
+                       .udma_mask = ATA_UDMA4,
                        .port_ops = &cmd648_port_ops
                },
                {       /* CMD 649 */
@@ -420,7 +420,7 @@ static int cmd64x_init_one(struct pci_dev *pdev, const struct pci_device_id *id)
                        .flags = ATA_FLAG_SLAVE_POSS,
                        .pio_mask = 0x1f,
                        .mwdma_mask = 0x07,
-                       .udma_mask = ATA_UDMA3,
+                       .udma_mask = ATA_UDMA5,
                        .port_ops = &cmd648_port_ops
                }
        };
index 321d98b0bed299a1a73e738e9d40bc308af80ef0..64a711776c453b51e4c5be2f01bddcfbfb1fe0f9 100644 (file)
@@ -330,17 +330,12 @@ static void ata_dummy_noret(struct ata_port *port)
 {
 }
 
-/*
- * We need to shut down unused ports to prevent spurious interrupts.
- * FIXME: the libata core doesn't call this function for PATA interfaces.
- */
-static void pata_icside_port_disable(struct ata_port *ap)
+static void pata_icside_postreset(struct ata_port *ap, unsigned int *classes)
 {
        struct pata_icside_state *state = ap->host->private_data;
 
-       ata_port_printk(ap, KERN_ERR, "disabling icside port\n");
-
-       ata_port_disable(ap);
+       if (classes[0] != ATA_DEV_NONE || classes[1] != ATA_DEV_NONE)
+               return ata_std_postreset(ap, classes);
 
        state->port[ap->port_no].disabled = 1;
 
@@ -356,6 +351,12 @@ static void pata_icside_port_disable(struct ata_port *ap)
        }
 }
 
+static void pata_icside_error_handler(struct ata_port *ap)
+{
+       ata_bmdma_drive_eh(ap, ata_std_prereset, ata_std_softreset, NULL,
+                          pata_icside_postreset);
+}
+
 static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq)
 {
        unsigned int bits = chk_drq ? ATA_BUSY | ATA_DRQ : ATA_BUSY;
@@ -374,7 +375,7 @@ static u8 pata_icside_irq_ack(struct ata_port *ap, unsigned int chk_drq)
 }
 
 static struct ata_port_operations pata_icside_port_ops = {
-       .port_disable           = pata_icside_port_disable,
+       .port_disable           = ata_port_disable,
 
        .set_dmamode            = pata_icside_set_dmamode,
 
@@ -397,7 +398,7 @@ static struct ata_port_operations pata_icside_port_ops = {
 
        .freeze                 = ata_bmdma_freeze,
        .thaw                   = ata_bmdma_thaw,
-       .error_handler          = ata_bmdma_error_handler,
+       .error_handler          = pata_icside_error_handler,
        .post_internal_cmd      = pata_icside_bmdma_stop,
 
        .irq_clear              = ata_dummy_noret,
@@ -484,13 +485,6 @@ static int __devinit pata_icside_register_v6(struct pata_icside_info *info)
        state->port[0].port_sel = sel;
        state->port[1].port_sel = sel | 1;
 
-       /*
-        * FIXME: work around libata's aversion to calling port_disable.
-        * This permanently disables interrupts on port 0 - bad luck if
-        * you have a drive on that port.
-        */
-       state->port[0].disabled = 1;
-
        info->base = easi_base;
        info->irqops = &pata_icside_ops_arcin_v6;
        info->nr_ports = 2;
index 9a829a7cbc60c11b14606327c2cb940868a675fc..66bd0e83ac07c64a0f5c635fd3c461b97b909206 100644 (file)
@@ -2,6 +2,7 @@
  *    pata_sis.c - SiS ATA driver
  *
  *     (C) 2005 Red Hat <alan@redhat.com>
+ *     (C) 2007 Bartlomiej Zolnierkiewicz
  *
  *    Based upon linux/drivers/ide/pci/sis5513.c
  * Copyright (C) 1999-2000     Andre Hedrick <andre@linux-ide.org>
@@ -35,7 +36,7 @@
 #include "sis.h"
 
 #define DRV_NAME       "pata_sis"
-#define DRV_VERSION    "0.5.1"
+#define DRV_VERSION    "0.5.2"
 
 struct sis_chipset {
        u16 device;                             /* PCI host ID */
@@ -237,7 +238,7 @@ static void sis_old_set_piomode (struct ata_port *ap, struct ata_device *adev)
 }
 
 /**
- *     sis_100_set_pioode - Initialize host controller PATA PIO timings
+ *     sis_100_set_piomode - Initialize host controller PATA PIO timings
  *     @ap: Port whose timings we are configuring
  *     @adev: Device we are configuring for.
  *
@@ -262,7 +263,7 @@ static void sis_100_set_piomode (struct ata_port *ap, struct ata_device *adev)
 }
 
 /**
- *     sis_133_set_pioode - Initialize host controller PATA PIO timings
+ *     sis_133_set_piomode - Initialize host controller PATA PIO timings
  *     @ap: Port whose timings we are configuring
  *     @adev: Device we are configuring for.
  *
@@ -334,7 +335,7 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev)
        int drive_pci = sis_old_port_base(adev);
        u16 timing;
 
-       const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 };
+       const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 };
        const u16 udma_bits[]  = { 0xE000, 0xC000, 0xA000 };
 
        pci_read_config_word(pdev, drive_pci, &timing);
@@ -342,15 +343,15 @@ static void sis_old_set_dmamode (struct ata_port *ap, struct ata_device *adev)
        if (adev->dma_mode < XFER_UDMA_0) {
                /* bits 3-0 hold recovery timing bits 8-10 active timing and
                   the higer bits are dependant on the device */
-               timing &= ~ 0x870F;
+               timing &= ~0x870F;
                timing |= mwdma_bits[speed];
-               pci_write_config_word(pdev, drive_pci, timing);
        } else {
                /* Bit 15 is UDMA on/off, bit 13-14 are cycle time */
                speed = adev->dma_mode - XFER_UDMA_0;
                timing &= ~0x6000;
                timing |= udma_bits[speed];
        }
+       pci_write_config_word(pdev, drive_pci, timing);
 }
 
 /**
@@ -373,7 +374,7 @@ static void sis_66_set_dmamode (struct ata_port *ap, struct ata_device *adev)
        int drive_pci = sis_old_port_base(adev);
        u16 timing;
 
-       const u16 mwdma_bits[] = { 0x707, 0x202, 0x202 };
+       const u16 mwdma_bits[] = { 0x008, 0x302, 0x301 };
        const u16 udma_bits[]  = { 0xF000, 0xD000, 0xB000, 0xA000, 0x9000};
 
        pci_read_config_word(pdev, drive_pci, &timing);
@@ -432,8 +433,7 @@ static void sis_100_set_dmamode (struct ata_port *ap, struct ata_device *adev)
  *     @adev: Device to program
  *
  *     Set UDMA/MWDMA mode for device, in host controller PCI config space.
- *     Handles early SiS 961 bridges. Supports MWDMA as well unlike
- *     the old ide/pci driver.
+ *     Handles early SiS 961 bridges.
  *
  *     LOCKING:
  *     None (inherited from caller).
@@ -467,8 +467,6 @@ static void sis_133_early_set_dmamode (struct ata_port *ap, struct ata_device *a
  *     @adev: Device to program
  *
  *     Set UDMA/MWDMA mode for device, in host controller PCI config space.
- *     Handles early SiS 961 bridges. Supports MWDMA as well unlike
- *     the old ide/pci driver.
  *
  *     LOCKING:
  *     None (inherited from caller).
index 405ee5e092211ee8078ff80adbc4fbaa5cd928b7..8b12925fe7a41e7a54f846d1f64274c737a82009 100644 (file)
@@ -2435,7 +2435,7 @@ fore200e_init_cmd_queue(struct fore200e* fore200e)
 }
 
 
-static void __init
+static void __devinit
 fore200e_param_bs_queue(struct fore200e* fore200e,
                        enum buffer_scheme scheme, enum buffer_magn magn,
                        int queue_length, int pool_size, int supply_blksize)
index a3b605a0ca17a47e106359e4299d5db2e70515df..ef52452640e0b7f9c89594e6a9195653a1eee1a9 100644 (file)
@@ -1601,14 +1601,14 @@ static int rx_init(struct atm_dev *dev)
   
        skb_queue_head_init(&iadev->rx_dma_q);  
        iadev->rx_free_desc_qhead = NULL;   
-       iadev->rx_open = kmalloc(4*iadev->num_vc,GFP_KERNEL);
-       if (!iadev->rx_open)  
-       {  
+
+       iadev->rx_open = kzalloc(4 * iadev->num_vc, GFP_KERNEL);
+       if (!iadev->rx_open) {
                printk(KERN_ERR DEV_LABEL "itf %d couldn't get free page\n",
                dev->number);  
                goto err_free_dle;
        }  
-       memset(iadev->rx_open, 0, 4*iadev->num_vc);  
+
         iadev->rxing = 1;
         iadev->rx_pkt_cnt = 0;
        /* Mode Register */  
@@ -3171,12 +3171,12 @@ static int __devinit ia_init_one(struct pci_dev *pdev,
         unsigned long flags;
        int ret;
 
-       iadev = kmalloc(sizeof(*iadev), GFP_KERNEL); 
+       iadev = kzalloc(sizeof(*iadev), GFP_KERNEL);
        if (!iadev) {
                ret = -ENOMEM;
                goto err_out;
        }
-       memset(iadev, 0, sizeof(*iadev));
+
        iadev->pci = pdev;
 
        IF_INIT(printk("ia detected at bus:%d dev: %d function:%d\n",
index 55fd1b4543fdc5e034e8c358fc05967259f339b4..144a49f152207402c044caca1c0c8dde47f10747 100644 (file)
@@ -65,7 +65,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/interrupt.h>
-#include <linux/dma-mapping.h>
 
 /* -------------------- TUNABLE PARAMATERS: */
 
index 3599ab2506d269ee299b1b8e807746bcbca98391..e6738bcbe5a9b2da343e5d20a67b51a6b28545ee 100644 (file)
@@ -24,8 +24,6 @@
 #include "base.h"
 #include "power/power.h"
 
-extern const char *kobject_actions[];
-
 int (*platform_notify)(struct device * dev) = NULL;
 int (*platform_notify_remove)(struct device * dev) = NULL;
 
@@ -680,8 +678,7 @@ static int device_add_class_symlinks(struct device *dev)
                if (error)
                        goto out_subsys;
        }
-       /* only bus-device parents get a "device"-link */
-       if (dev->parent && dev->parent->bus) {
+       if (dev->parent) {
                error = sysfs_create_link(&dev->kobj, &dev->parent->kobj,
                                          "device");
                if (error)
index fe7ef339414441afc3592994d00dc97a99e0d0d5..40545071e3c93adc625bb51cb87e007333f06417 100644 (file)
@@ -53,7 +53,7 @@ static ssize_t store_online(struct sys_device *dev, const char *buf,
                ret = count;
        return ret;
 }
-static SYSDEV_ATTR(online, 0600, show_online, store_online);
+static SYSDEV_ATTR(online, 0644, show_online, store_online);
 
 static void __devinit register_cpu_control(struct cpu *cpu)
 {
index 53f0ee6f301663db0ff4b87b5500b39bcd74744b..b24efd4e3e3de2c1f681c68936c52eca839cd8ea 100644 (file)
@@ -232,6 +232,7 @@ fw_realloc_buffer(struct firmware_priv *fw_priv, int min_size)
 /**
  * firmware_data_write - write method for firmware
  * @kobj: kobject for the device
+ * @bin_attr: bin_attr structure
  * @buffer: buffer being written
  * @offset: buffer offset for write in total data store area
  * @count: buffer size
index 966a5e2874150eae972089e728f4b37b17cec9b8..9caeaea753a3e00623fae4c41d72ffceaef1643c 100644 (file)
@@ -1,5 +1,5 @@
 obj-y                  := shutdown.o
-obj-$(CONFIG_PM)       += main.o suspend.o resume.o sysfs.o
+obj-$(CONFIG_PM_SLEEP) += main.o suspend.o resume.o sysfs.o
 obj-$(CONFIG_PM_TRACE) += trace.o
 
 ifeq ($(CONFIG_DEBUG_DRIVER),y)
index 591a0dd5deee544a6b4d3dbbc5ee8ac553b72acc..8ba0830cbc03fa6fe50d8bc27be7b5c3e770259c 100644 (file)
@@ -5,7 +5,7 @@
 extern void device_shutdown(void);
 
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 
 /*
  * main.c
@@ -62,7 +62,7 @@ extern int resume_device(struct device *);
  */
 extern int suspend_device(struct device *, pm_message_t);
 
-#else /* CONFIG_PM */
+#else /* CONFIG_PM_SLEEP */
 
 
 static inline int device_pm_add(struct device * dev)
index a47ee1b70d2086b76bf41852650dc236fc483e38..56e8eaaac012cd544f69df0823aef84b023cfaaf 100644 (file)
@@ -44,7 +44,5 @@ void device_shutdown(void)
                        dev->driver->shutdown(dev);
                }
        }
-
-       sysdev_shutdown();
 }
 
index a7a099027fcadec6ff29705ba5096b13eaedb2d7..014e72121b5a255ae835d56b3ed7dd9989eab136 100644 (file)
@@ -31,4 +31,4 @@ obj-$(CONFIG_BLK_DEV_SX8)     += sx8.o
 obj-$(CONFIG_BLK_DEV_UB)       += ub.o
 
 obj-$(CONFIG_XEN_BLKDEV_FRONTEND)      += xen-blkfront.o
-obj-$(CONFIG_LGUEST_GUEST)     += lguest_blk.o
+obj-$(CONFIG_LGUEST_BLOCK)     += lguest_blk.o
index 1be82d544dc3866d15f8819e3f1b2a5859152531..084358a828e9de7f2e5fc27f48d47a523beb1ab5 100644 (file)
@@ -1977,12 +1977,13 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
 {
        ReadCapdata_struct *buf;
        int return_code;
-       buf = kmalloc(sizeof(ReadCapdata_struct), GFP_KERNEL);
-       if (buf == NULL) {
+
+       buf = kzalloc(sizeof(ReadCapdata_struct), GFP_KERNEL);
+       if (!buf) {
                printk(KERN_WARNING "cciss: out of memory\n");
                return;
        }
-       memset(buf, 0, sizeof(ReadCapdata_struct));
+
        if (withirq)
                return_code = sendcmd_withirq(CCISS_READ_CAPACITY,
                                ctlr, buf, sizeof(ReadCapdata_struct),
@@ -2003,7 +2004,6 @@ cciss_read_capacity(int ctlr, int logvol, int withirq, sector_t *total_size,
                printk(KERN_INFO "      blocks= %llu block_size= %d\n",
                (unsigned long long)*total_size+1, *block_size);
        kfree(buf);
-       return;
 }
 
 static void
@@ -2011,12 +2011,13 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
 {
        ReadCapdata_struct_16 *buf;
        int return_code;
-       buf = kmalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL);
-       if (buf == NULL) {
+
+       buf = kzalloc(sizeof(ReadCapdata_struct_16), GFP_KERNEL);
+       if (!buf) {
                printk(KERN_WARNING "cciss: out of memory\n");
                return;
        }
-       memset(buf, 0, sizeof(ReadCapdata_struct_16));
+
        if (withirq) {
                return_code = sendcmd_withirq(CCISS_READ_CAPACITY_16,
                        ctlr, buf, sizeof(ReadCapdata_struct_16),
@@ -2038,7 +2039,6 @@ cciss_read_capacity_16(int ctlr, int logvol, int withirq, sector_t *total_size,
        printk(KERN_INFO "      blocks= %llu block_size= %d\n",
               (unsigned long long)*total_size+1, *block_size);
        kfree(buf);
-       return;
 }
 
 static int cciss_revalidate(struct gendisk *disk)
@@ -3227,12 +3227,15 @@ static int alloc_cciss_hba(void)
        for (i = 0; i < MAX_CTLR; i++) {
                if (!hba[i]) {
                        ctlr_info_t *p;
+
                        p = kzalloc(sizeof(ctlr_info_t), GFP_KERNEL);
                        if (!p)
                                goto Enomem;
                        p->gendisk[0] = alloc_disk(1 << NWD_SHIFT);
-                       if (!p->gendisk[0])
+                       if (!p->gendisk[0]) {
+                               kfree(p);
                                goto Enomem;
+                       }
                        hba[i] = p;
                        return i;
                }
index be4e3477d83b87f785ba22b43121635acd906b0f..eb9799acf65b8a202606b9e8686a66360a4e9840 100644 (file)
@@ -420,18 +420,17 @@ static int __init cpqarray_register_ctlr( int i, struct pci_dev *pdev)
                        goto Enomem2;
        }
 
-       hba[i]->cmd_pool = (cmdlist_t *)pci_alloc_consistent(
+       hba[i]->cmd_pool = pci_alloc_consistent(
                hba[i]->pci_dev, NR_CMDS * sizeof(cmdlist_t),
                &(hba[i]->cmd_pool_dhandle));
-       hba[i]->cmd_pool_bits = kmalloc(
-               ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long),
+       hba[i]->cmd_pool_bits = kcalloc(
+               (NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG, sizeof(unsigned long),
                GFP_KERNEL);
 
        if (!hba[i]->cmd_pool_bits || !hba[i]->cmd_pool)
                        goto Enomem1;
 
        memset(hba[i]->cmd_pool, 0, NR_CMDS * sizeof(cmdlist_t));
-       memset(hba[i]->cmd_pool_bits, 0, ((NR_CMDS+BITS_PER_LONG-1)/BITS_PER_LONG)*sizeof(unsigned long));
        printk(KERN_INFO "cpqarray: Finding drives on %s",
                hba[i]->devname);
 
@@ -1660,45 +1659,30 @@ static void getgeometry(int ctlr)
 
        info_p->log_drv_map = 0;        
        
-       id_ldrive = kmalloc(sizeof(id_log_drv_t), GFP_KERNEL);
-       if(id_ldrive == NULL)
-       {
+       id_ldrive = kzalloc(sizeof(id_log_drv_t), GFP_KERNEL);
+       if (!id_ldrive) {
                printk( KERN_ERR "cpqarray:  out of memory.\n");
-               return;
+               goto err_0;
        }
 
-       id_ctlr_buf = kmalloc(sizeof(id_ctlr_t), GFP_KERNEL);
-       if(id_ctlr_buf == NULL)
-       {
-               kfree(id_ldrive);
+       id_ctlr_buf = kzalloc(sizeof(id_ctlr_t), GFP_KERNEL);
+       if (!id_ctlr_buf) {
                printk( KERN_ERR "cpqarray:  out of memory.\n");
-               return;
+               goto err_1;
        }
 
-       id_lstatus_buf = kmalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL);
-       if(id_lstatus_buf == NULL)
-       {
-               kfree(id_ctlr_buf);
-               kfree(id_ldrive);
+       id_lstatus_buf = kzalloc(sizeof(sense_log_drv_stat_t), GFP_KERNEL);
+       if (!id_lstatus_buf) {
                printk( KERN_ERR "cpqarray:  out of memory.\n");
-               return;
+               goto err_2;
        }
 
-       sense_config_buf = kmalloc(sizeof(config_t), GFP_KERNEL);
-       if(sense_config_buf == NULL)
-       {
-               kfree(id_lstatus_buf);
-               kfree(id_ctlr_buf);
-               kfree(id_ldrive);
+       sense_config_buf = kzalloc(sizeof(config_t), GFP_KERNEL);
+       if (!sense_config_buf) {
                printk( KERN_ERR "cpqarray:  out of memory.\n");
-               return;
+               goto err_3;
        }
 
-       memset(id_ldrive, 0, sizeof(id_log_drv_t));
-       memset(id_ctlr_buf, 0, sizeof(id_ctlr_t));
-       memset(id_lstatus_buf, 0, sizeof(sense_log_drv_stat_t));
-       memset(sense_config_buf, 0, sizeof(config_t));
-
        info_p->phys_drives = 0;
        info_p->log_drv_map = 0;
        info_p->drv_assign_map = 0;
@@ -1712,13 +1696,8 @@ static void getgeometry(int ctlr)
                 * so the idastubopen will fail on all logical drives
                 * on the controller.
                 */
-                /* Free all the buffers and return */ 
                printk(KERN_ERR "cpqarray: error sending ID controller\n");
-               kfree(sense_config_buf);
-                kfree(id_lstatus_buf);
-                kfree(id_ctlr_buf);
-                kfree(id_ldrive);
-                return;
+                goto err_4;
         }
 
        info_p->log_drives = id_ctlr_buf->nr_drvs;
@@ -1764,12 +1743,7 @@ static void getgeometry(int ctlr)
                                " failed to report status of logical drive %d\n"
                         "Access to this controller has been disabled\n",
                                ctlr, log_unit);
-                       /* Free all the buffers and return */
-                       kfree(sense_config_buf);
-                       kfree(id_lstatus_buf);
-                       kfree(id_ctlr_buf);
-                       kfree(id_ldrive);
-                       return;
+                       goto err_4;
                }
                /*
                   Make sure the logical drive is configured
@@ -1798,14 +1772,8 @@ static void getgeometry(int ctlr)
                                 sizeof(config_t), 0, 0, log_unit);
                                if (ret_code == IO_ERROR) {
                                        info_p->log_drv_map = 0;
-                                       /* Free all the buffers and return */
                                        printk(KERN_ERR "cpqarray: error sending sense config\n");
-                                       kfree(sense_config_buf);
-                                       kfree(id_lstatus_buf);
-                                       kfree(id_ctlr_buf);
-                                       kfree(id_ldrive);
-                                       return;
-
+                                       goto err_4;
                                }
 
                                info_p->phys_drives =
@@ -1820,12 +1788,18 @@ static void getgeometry(int ctlr)
                        log_index = log_index + 1;
                }               /* end of if logical drive configured */
        }                       /* end of for log_unit */
+
+       /* Free all the buffers and return */
+err_4:
        kfree(sense_config_buf);
-       kfree(id_ldrive);
+err_3:
        kfree(id_lstatus_buf);
+err_2:
        kfree(id_ctlr_buf);
+err_1:
+       kfree(id_ldrive);
+err_0:
        return;
-
 }
 
 static void __exit cpqarray_exit(void)
index 5b79d0724171763ea4950a81d96c282590ab4555..93e3c4001bf51f299a21bf04eff813b88adfaec6 100644 (file)
@@ -1,6 +1,12 @@
-/* A simple block driver for lguest.
+/*D:400
+ * The Guest block driver
  *
- * Copyright 2006 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
+ * This is a simple block driver, which appears as /dev/lgba, lgbb, lgbc etc.
+ * The mechanism is simple: we place the information about the request in the
+ * device page, then use SEND_DMA (containing the data for a write, or an empty
+ * "ping" DMA for a read).
+ :*/
+/* Copyright 2006 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 
 static char next_block_index = 'a';
 
+/*D:420 Here is the structure which holds all the information we need about
+ * each Guest block device.
+ *
+ * I'm sure at this stage, you're wondering "hey, where was the adventure I was
+ * promised?" and thinking "Rusty sucks, I shall say nasty things about him on
+ * my blog".  I think Real adventures have boring bits, too, and you're in the
+ * middle of one.  But it gets better.  Just not quite yet. */
 struct blockdev
 {
+       /* The block queue infrastructure wants a spinlock: it is held while it
+        * calls our block request function.  We grab it in our interrupt
+        * handler so the responses don't mess with new requests. */
        spinlock_t lock;
 
-       /* The disk structure for the kernel. */
+       /* The disk structure registered with kernel. */
        struct gendisk *disk;
 
-       /* The major number for this disk. */
+       /* The major device number for this disk, and the interrupt.  We only
+        * really keep them here for completeness; we'd need them if we
+        * supported device unplugging. */
        int major;
        int irq;
 
+       /* The physical address of this device's memory page */
        unsigned long phys_addr;
-       /* The mapped block page. */
+       /* The mapped memory page for convenient acces. */
        struct lguest_block_page *lb_page;
 
-       /* We only have a single request outstanding at a time. */
+       /* We only have a single request outstanding at a time: this is it. */
        struct lguest_dma dma;
        struct request *req;
 };
 
-/* Jens gave me this nice helper to end all chunks of a request. */
+/*D:495 We originally used end_request() throughout the driver, but it turns
+ * out that end_request() is deprecated, and doesn't actually end the request
+ * (which seems like a good reason to deprecate it!).  It simply ends the first
+ * bio.  So if we had 3 bios in a "struct request" we would do all 3,
+ * end_request(), do 2, end_request(), do 1 and end_request(): twice as much
+ * work as we needed to do.
+ *
+ * This reinforced to me that I do not understand the block layer.
+ *
+ * Nonetheless, Jens Axboe gave me this nice helper to end all chunks of a
+ * request.  This improved disk speed by 130%. */
 static void end_entire_request(struct request *req, int uptodate)
 {
        if (end_that_request_first(req, uptodate, req->hard_nr_sectors))
@@ -55,30 +84,62 @@ static void end_entire_request(struct request *req, int uptodate)
        end_that_request_last(req, uptodate);
 }
 
+/* I'm told there are only two stories in the world worth telling: love and
+ * hate.  So there used to be a love scene here like this:
+ *
+ *  Launcher:  We could make beautiful I/O together, you and I.
+ *  Guest:     My, that's a big disk!
+ *
+ * Unfortunately, it was just too raunchy for our otherwise-gentle tale. */
+
+/*D:490 This is the interrupt handler, called when a block read or write has
+ * been completed for us. */
 static irqreturn_t lgb_irq(int irq, void *_bd)
 {
+       /* We handed our "struct blockdev" as the argument to request_irq(), so
+        * it is passed through to us here.  This tells us which device we're
+        * dealing with in case we have more than one. */
        struct blockdev *bd = _bd;
        unsigned long flags;
 
+       /* We weren't doing anything?  Strange, but could happen if we shared
+        * interrupts (we don't!). */
        if (!bd->req) {
                pr_debug("No work!\n");
                return IRQ_NONE;
        }
 
+       /* Not done yet?  That's equally strange. */
        if (!bd->lb_page->result) {
                pr_debug("No result!\n");
                return IRQ_NONE;
        }
 
+       /* We have to grab the lock before ending the request. */
        spin_lock_irqsave(&bd->lock, flags);
+       /* "result" is 1 for success, 2 for failure: end_entire_request() wants
+        * to know whether this succeeded or not. */
        end_entire_request(bd->req, bd->lb_page->result == 1);
+       /* Clear out request, it's done. */
        bd->req = NULL;
+       /* Reset incoming DMA for next time. */
        bd->dma.used_len = 0;
+       /* Ready for more reads or writes */
        blk_start_queue(bd->disk->queue);
        spin_unlock_irqrestore(&bd->lock, flags);
+
+       /* The interrupt was for us, we dealt with it. */
        return IRQ_HANDLED;
 }
 
+/*D:480 The block layer's "struct request" contains a number of "struct bio"s,
+ * each of which contains "struct bio_vec"s, each of which contains a page, an
+ * offset and a length.
+ *
+ * Fortunately there are iterators to help us walk through the "struct
+ * request".  Even more fortunately, there were plenty of places to steal the
+ * code from.  We pack the "struct request" into our "struct lguest_dma" and
+ * return the total length. */
 static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
 {
        unsigned int i = 0, idx, len = 0;
@@ -87,8 +148,13 @@ static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
        rq_for_each_bio(bio, req) {
                struct bio_vec *bvec;
                bio_for_each_segment(bvec, bio, idx) {
+                       /* We told the block layer not to give us too many. */
                        BUG_ON(i == LGUEST_MAX_DMA_SECTIONS);
+                       /* If we had a zero-length segment, it would look like
+                        * the end of the data referred to by the "struct
+                        * lguest_dma", so make sure that doesn't happen. */
                        BUG_ON(!bvec->bv_len);
+                       /* Convert page & offset to a physical address */
                        dma->addr[i] = page_to_phys(bvec->bv_page)
                                + bvec->bv_offset;
                        dma->len[i] = bvec->bv_len;
@@ -96,26 +162,39 @@ static unsigned int req_to_dma(struct request *req, struct lguest_dma *dma)
                        i++;
                }
        }
+       /* If the array isn't full, we mark the end with a 0 length */
        if (i < LGUEST_MAX_DMA_SECTIONS)
                dma->len[i] = 0;
        return len;
 }
 
+/* This creates an empty DMA, useful for prodding the Host without sending data
+ * (ie. when we want to do a read) */
 static void empty_dma(struct lguest_dma *dma)
 {
        dma->len[0] = 0;
 }
 
+/*D:470 Setting up a request is fairly easy: */
 static void setup_req(struct blockdev *bd,
                      int type, struct request *req, struct lguest_dma *dma)
 {
+       /* The type is 1 (write) or 0 (read). */
        bd->lb_page->type = type;
+       /* The sector on disk where the read or write starts. */
        bd->lb_page->sector = req->sector;
+       /* The result is initialized to 0 (unfinished). */
        bd->lb_page->result = 0;
+       /* The current request (so we can end it in the interrupt handler). */
        bd->req = req;
+       /* The number of bytes: returned as a side-effect of req_to_dma(),
+        * which packs the block layer's "struct request" into our "struct
+        * lguest_dma" */
        bd->lb_page->bytes = req_to_dma(req, dma);
 }
 
+/*D:450 Write is pretty straightforward: we pack the request into a "struct
+ * lguest_dma", then use SEND_DMA to send the request. */
 static void do_write(struct blockdev *bd, struct request *req)
 {
        struct lguest_dma send;
@@ -126,6 +205,9 @@ static void do_write(struct blockdev *bd, struct request *req)
        lguest_send_dma(bd->phys_addr, &send);
 }
 
+/* Read is similar to write, except we pack the request into our receive
+ * "struct lguest_dma" and send through an empty DMA just to tell the Host that
+ * there's a request pending. */
 static void do_read(struct blockdev *bd, struct request *req)
 {
        struct lguest_dma ping;
@@ -137,21 +219,30 @@ static void do_read(struct blockdev *bd, struct request *req)
        lguest_send_dma(bd->phys_addr, &ping);
 }
 
+/*D:440 This where requests come in: we get handed the request queue and are
+ * expected to pull a "struct request" off it until we've finished them or
+ * we're waiting for a reply: */
 static void do_lgb_request(struct request_queue *q)
 {
        struct blockdev *bd;
        struct request *req;
 
 again:
+       /* This sometimes returns NULL even on the very first time around.  I
+        * wonder if it's something to do with letting elves handle the request
+        * queue... */
        req = elv_next_request(q);
        if (!req)
                return;
 
+       /* We attached the struct blockdev to the disk: get it back */
        bd = req->rq_disk->private_data;
-       /* Sometimes we get repeated requests after blk_stop_queue. */
+       /* Sometimes we get repeated requests after blk_stop_queue(), but we
+        * can only handle one at a time. */
        if (bd->req)
                return;
 
+       /* We only do reads and writes: no tricky business! */
        if (!blk_fs_request(req)) {
                pr_debug("Got non-command 0x%08x\n", req->cmd_type);
                req->errors++;
@@ -164,20 +255,31 @@ again:
        else
                do_read(bd, req);
 
-       /* Wait for interrupt to tell us it's done. */
+       /* We've put out the request, so stop any more coming in until we get
+        * an interrupt, which takes us to lgb_irq() to re-enable the queue. */
        blk_stop_queue(q);
 }
 
+/*D:430 This is the "struct block_device_operations" we attach to the disk at
+ * the end of lguestblk_probe().  It doesn't seem to want much. */
 static struct block_device_operations lguestblk_fops = {
        .owner = THIS_MODULE,
 };
 
+/*D:425 Setting up a disk device seems to involve a lot of code.  I'm not sure
+ * quite why.  I do know that the IDE code sent two or three of the maintainers
+ * insane, perhaps this is the fringe of the same disease?
+ *
+ * As in the console code, the probe function gets handed the generic
+ * lguest_device from lguest_bus.c: */
 static int lguestblk_probe(struct lguest_device *lgdev)
 {
        struct blockdev *bd;
        int err;
        int irqflags = IRQF_SHARED;
 
+       /* First we allocate our own "struct blockdev" and initialize the easy
+        * fields. */
        bd = kmalloc(sizeof(*bd), GFP_KERNEL);
        if (!bd)
                return -ENOMEM;
@@ -187,59 +289,100 @@ static int lguestblk_probe(struct lguest_device *lgdev)
        bd->req = NULL;
        bd->dma.used_len = 0;
        bd->dma.len[0] = 0;
+       /* The descriptor in the lguest_devices array provided by the Host
+        * gives the Guest the physical page number of the device's page. */
        bd->phys_addr = (lguest_devices[lgdev->index].pfn << PAGE_SHIFT);
 
+       /* We use lguest_map() to get a pointer to the device page */
        bd->lb_page = lguest_map(bd->phys_addr, 1);
        if (!bd->lb_page) {
                err = -ENOMEM;
                goto out_free_bd;
        }
 
+       /* We need a major device number: 0 means "assign one dynamically". */
        bd->major = register_blkdev(0, "lguestblk");
        if (bd->major < 0) {
                err = bd->major;
                goto out_unmap;
        }
 
+       /* This allocates a "struct gendisk" where we pack all the information
+        * about the disk which the rest of Linux sees.  We ask for one minor
+        * number; I do wonder if we should be asking for more. */
        bd->disk = alloc_disk(1);
        if (!bd->disk) {
                err = -ENOMEM;
                goto out_unregister_blkdev;
        }
 
+       /* Every disk needs a queue for requests to come in: we set up the
+        * queue with a callback function (the core of our driver) and the lock
+        * to use. */
        bd->disk->queue = blk_init_queue(do_lgb_request, &bd->lock);
        if (!bd->disk->queue) {
                err = -ENOMEM;
                goto out_put_disk;
        }
 
-       /* We can only handle a certain number of sg entries */
+       /* We can only handle a certain number of pointers in our SEND_DMA
+        * call, so we set that with blk_queue_max_hw_segments().  This is not
+        * to be confused with blk_queue_max_phys_segments() of course!  I
+        * know, who could possibly confuse the two?
+        *
+        * Well, it's simple to tell them apart: this one seems to work and the
+        * other one didn't. */
        blk_queue_max_hw_segments(bd->disk->queue, LGUEST_MAX_DMA_SECTIONS);
-       /* Buffers must not cross page boundaries */
+
+       /* Due to technical limitations of our Host (and simple coding) we
+        * can't have a single buffer which crosses a page boundary.  Tell it
+        * here.  This means that our maximum request size is 16
+        * (LGUEST_MAX_DMA_SECTIONS) pages. */
        blk_queue_segment_boundary(bd->disk->queue, PAGE_SIZE-1);
 
+       /* We name our disk: this becomes the device name when udev does its
+        * magic thing and creates the device node, such as /dev/lgba.
+        * next_block_index is a global which starts at 'a'.  Unfortunately
+        * this simple increment logic means that the 27th disk will be called
+        * "/dev/lgb{".  In that case, I recommend having at least 29 disks, so
+        * your /dev directory will be balanced. */
        sprintf(bd->disk->disk_name, "lgb%c", next_block_index++);
+
+       /* We look to the device descriptor again to see if this device's
+        * interrupts are expected to be random.  If they are, we tell the irq
+        * subsystem.  At the moment this bit is always set. */
        if (lguest_devices[lgdev->index].features & LGUEST_DEVICE_F_RANDOMNESS)
                irqflags |= IRQF_SAMPLE_RANDOM;
+
+       /* Now we have the name and irqflags, we can request the interrupt; we
+        * give it the "struct blockdev" we have set up to pass to lgb_irq()
+        * when there is an interrupt. */
        err = request_irq(bd->irq, lgb_irq, irqflags, bd->disk->disk_name, bd);
        if (err)
                goto out_cleanup_queue;
 
+       /* We bind our one-entry DMA pool to the key for this block device so
+        * the Host can reply to our requests.  The key is equal to the
+        * physical address of the device's page, which is conveniently
+        * unique. */
        err = lguest_bind_dma(bd->phys_addr, &bd->dma, 1, bd->irq);
        if (err)
                goto out_free_irq;
 
+       /* We finish our disk initialization and add the disk to the system. */
        bd->disk->major = bd->major;
        bd->disk->first_minor = 0;
        bd->disk->private_data = bd;
        bd->disk->fops = &lguestblk_fops;
-       /* This is initialized to the disk size by the other end. */
+       /* This is initialized to the disk size by the Launcher. */
        set_capacity(bd->disk, bd->lb_page->num_sectors);
        add_disk(bd->disk);
 
        printk(KERN_INFO "%s: device %i at major %d\n",
               bd->disk->disk_name, lgdev->index, bd->major);
 
+       /* We don't need to keep the "struct blockdev" around, but if we ever
+        * implemented device removal, we'd need this. */
        lgdev->private = bd;
        return 0;
 
@@ -258,6 +401,8 @@ out_free_bd:
        return err;
 }
 
+/*D:410 The boilerplate code for registering the lguest block driver is just
+ * like the console: */
 static struct lguest_driver lguestblk_drv = {
        .name = "lguestblk",
        .owner = THIS_MODULE,
index 85916e2665d4852ed9ed4e36ef04a5f00d599277..af3969a9c96301d3ab515c44b1554c472ddcd4e3 100644 (file)
@@ -41,7 +41,6 @@
 #include <linux/dma-mapping.h>
 #include <linux/completion.h>
 #include <linux/device.h>
-#include <linux/kernel.h>
 
 #include <asm/uaccess.h>
 #include <asm/vio.h>
index cb27e8863d7c58eac90af527f1bcf84f92186fcb..3ede0b63da13cc4f34b59c229318b3745622179c 100644 (file)
@@ -902,26 +902,17 @@ static int ace_release(struct inode *inode, struct file *filp)
        return 0;
 }
 
-static int ace_ioctl(struct inode *inode, struct file *filp,
-                    unsigned int cmd, unsigned long arg)
+static int ace_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 {
-       struct ace_device *ace = inode->i_bdev->bd_disk->private_data;
-       struct hd_geometry __user *geo = (struct hd_geometry __user *)arg;
-       struct hd_geometry g;
-       dev_dbg(ace->dev, "ace_ioctl()\n");
-
-       switch (cmd) {
-       case HDIO_GETGEO:
-               g.heads = ace->cf_id.heads;
-               g.sectors = ace->cf_id.sectors;
-               g.cylinders = ace->cf_id.cyls;
-               g.start = 0;
-               return copy_to_user(geo, &g, sizeof(g)) ? -EFAULT : 0;
+       struct ace_device *ace = bdev->bd_disk->private_data;
 
-       default:
-               return -ENOTTY;
-       }
-       return -ENOTTY;
+       dev_dbg(ace->dev, "ace_getgeo()\n");
+
+       geo->heads = ace->cf_id.heads;
+       geo->sectors = ace->cf_id.sectors;
+       geo->cylinders = ace->cf_id.cyls;
+
+       return 0;
 }
 
 static struct block_device_operations ace_fops = {
@@ -930,7 +921,7 @@ static struct block_device_operations ace_fops = {
        .release = ace_release,
        .media_changed = ace_media_changed,
        .revalidate_disk = ace_revalidate_disk,
-       .ioctl = ace_ioctl,
+       .getgeo = ace_getgeo,
 };
 
 /* --------------------------------------------------------------------
index acdbcdc3e45709e6bd3534537546188c936a380a..b391776e5bf31ca24f45eea0576e63364c2c2c80 100644 (file)
@@ -130,6 +130,7 @@ config ROCKETPORT
 config CYCLADES
        tristate "Cyclades async mux support"
        depends on SERIAL_NONSTANDARD && (PCI || ISA)
+       select FW_LOADER
        ---help---
          This driver supports Cyclades Z and Y multiserial boards.
          You would need something like this to connect more than two modems to
index 23b26b87cc3296e1cd9ecc97ed37633a6ec78f1f..d68ddbe70f737414a876c9f52cf1417223cbe8b7 100644 (file)
@@ -97,7 +97,6 @@ obj-$(CONFIG_GPIO_VR41XX)     += vr41xx_giu.o
 obj-$(CONFIG_GPIO_TB0219)      += tb0219.o
 obj-$(CONFIG_TELCLOCK)         += tlclk.o
 
-obj-$(CONFIG_WATCHDOG)         += watchdog/
 obj-$(CONFIG_MWAVE)            += mwave/
 obj-$(CONFIG_AGP)              += agp/
 obj-$(CONFIG_DRM)              += drm/
index a9f9c48c2424c8f307061bdf7feda686d7a996ab..713533d8a86e7449156113d1e40e0da69d1deafc 100644 (file)
@@ -50,7 +50,7 @@ config AGP_ATI
 
 config AGP_AMD
        tristate "AMD Irongate, 761, and 762 chipset support"
-       depends on AGP && X86_32
+       depends on AGP && (X86_32 || ALPHA)
        help
          This option gives you AGP support for the GLX component of
          X on AMD Irongate, 761, and 762 chipsets.
index 780e59e588ad968c82f6b1a7b15df14925ff35fa..da7513d7b4e7e9b190f8ff72f1314ae633f94662 100644 (file)
@@ -123,21 +123,16 @@ static int ati_create_gatt_pages(int nr_tables)
 
        for (i = 0; i < nr_tables; i++) {
                entry = kzalloc(sizeof(struct ati_page_map), GFP_KERNEL);
+               tables[i] = entry;
                if (entry == NULL) {
-                       while (i > 0) {
-                               kfree(tables[i-1]);
-                               i--;
-                       }
-                       kfree(tables);
                        retval = -ENOMEM;
                        break;
                }
-               tables[i] = entry;
                retval = ati_create_page_map(entry);
                if (retval != 0)
                        break;
        }
-       ati_generic_private.num_tables = nr_tables;
+       ati_generic_private.num_tables = i;
        ati_generic_private.gatt_pages = tables;
 
        if (retval != 0)
index fcb4b1bf0d4e664187c3fbf2633e1f5b5ecb6b96..ecd4248861b9dfda6475e29d0acfcc9c6c547f96 100644 (file)
@@ -28,6 +28,7 @@
 
 #include <linux/kernel.h>
 #include <linux/pci.h>
+#include <linux/fs.h>
 #include <linux/agpgart.h>
 #include <asm/uaccess.h>
 #include "agp.h"
index c7ed617aa7ff436ea8c359f66bdafa097b4641de..7791e98de51c81a34ed3b4aed1b007cb4b728e46 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/agpgart.h>
 #include <linux/slab.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/sched.h>
 #include <asm/uaccess.h>
 #include <asm/pgtable.h>
index d535c406b3192512433130cc3109a4d3cd77bfe2..3db4f4076ed4dae4292d8802b170efff796a036c 100644 (file)
@@ -1170,7 +1170,6 @@ void *agp_generic_alloc_page(struct agp_bridge_data *bridge)
        map_page_into_agp(page);
 
        get_page(page);
-       SetPageLocked(page);
        atomic_inc(&agp_bridge->current_memory_agp);
        return page_address(page);
 }
@@ -1187,7 +1186,6 @@ void agp_generic_destroy_page(void *addr)
        page = virt_to_page(addr);
        unmap_page_from_agp(page);
        put_page(page);
-       unlock_page(page);
        free_page((unsigned long)addr);
        atomic_dec(&agp_bridge->current_memory_agp);
 }
index a1240603912c2608f0137fa73ded8aa86a00e9e1..294cdbf4d44d9ecabe43ab892f4ee53502956be1 100644 (file)
@@ -20,7 +20,9 @@
 #define PCI_DEVICE_ID_INTEL_82965G_IG       0x29A2
 #define PCI_DEVICE_ID_INTEL_82965GM_HB      0x2A00
 #define PCI_DEVICE_ID_INTEL_82965GM_IG      0x2A02
+#define PCI_DEVICE_ID_INTEL_82965GME_HB     0x2A10
 #define PCI_DEVICE_ID_INTEL_82965GME_IG     0x2A12
+#define PCI_DEVICE_ID_INTEL_82945GME_HB     0x27AC
 #define PCI_DEVICE_ID_INTEL_82945GME_IG     0x27AE
 #define PCI_DEVICE_ID_INTEL_G33_HB          0x29C0
 #define PCI_DEVICE_ID_INTEL_G33_IG          0x29C2
@@ -33,7 +35,8 @@
                  agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_1_HB || \
                  agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965Q_HB || \
                  agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965G_HB || \
-                 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB)
+                 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GM_HB || \
+                 agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82965GME_HB)
 
 #define IS_G33 (agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_G33_HB || \
                agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_Q35_HB || \
@@ -213,7 +216,6 @@ static void *i8xx_alloc_pages(void)
        }
        global_flush_tlb();
        get_page(page);
-       SetPageLocked(page);
        atomic_inc(&agp_bridge->current_memory_agp);
        return page_address(page);
 }
@@ -229,7 +231,6 @@ static void i8xx_destroy_pages(void *addr)
        change_page_attr(page, 4, PAGE_KERNEL);
        global_flush_tlb();
        put_page(page);
-       unlock_page(page);
        __free_pages(page, 2);
        atomic_dec(&agp_bridge->current_memory_agp);
 }
@@ -527,6 +528,7 @@ static void intel_i830_init_gtt_entries(void)
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB ||
+                           agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB ||
                            IS_I965 || IS_G33)
                                gtt_entries = MB(48) - KB(size);
                        else
@@ -538,6 +540,7 @@ static void intel_i830_init_gtt_entries(void)
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82915GM_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945G_HB ||
                            agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GM_HB ||
+                           agp_bridge->dev->device == PCI_DEVICE_ID_INTEL_82945GME_HB ||
                            IS_I965 || IS_G33)
                                gtt_entries = MB(64) - KB(size);
                        else
@@ -1848,9 +1851,9 @@ static const struct intel_driver_description {
                NULL, &intel_915_driver },
        { PCI_DEVICE_ID_INTEL_82945G_HB, PCI_DEVICE_ID_INTEL_82945G_IG, 0, "945G",
                NULL, &intel_915_driver },
-       { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, 1, "945GM",
+       { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GM_IG, 0, "945GM",
                NULL, &intel_915_driver },
-       { PCI_DEVICE_ID_INTEL_82945GM_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, 0, "945GME",
+       { PCI_DEVICE_ID_INTEL_82945GME_HB, PCI_DEVICE_ID_INTEL_82945GME_IG, 0, "945GME",
                NULL, &intel_915_driver },
        { PCI_DEVICE_ID_INTEL_82946GZ_HB, PCI_DEVICE_ID_INTEL_82946GZ_IG, 0, "946GZ",
                NULL, &intel_i965_driver },
@@ -1860,9 +1863,9 @@ static const struct intel_driver_description {
                NULL, &intel_i965_driver },
        { PCI_DEVICE_ID_INTEL_82965G_HB, PCI_DEVICE_ID_INTEL_82965G_IG, 0, "965G",
                NULL, &intel_i965_driver },
-       { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, 1, "965GM",
+       { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GM_IG, 0, "965GM",
                NULL, &intel_i965_driver },
-       { PCI_DEVICE_ID_INTEL_82965GM_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, 0, "965GME/GLE",
+       { PCI_DEVICE_ID_INTEL_82965GME_HB, PCI_DEVICE_ID_INTEL_82965GME_IG, 0, "965GME/GLE",
                NULL, &intel_i965_driver },
        { PCI_DEVICE_ID_INTEL_7505_0, 0, 0, "E7505", &intel_7505_driver, NULL },
        { PCI_DEVICE_ID_INTEL_7205_0, 0, 0, "E7205", &intel_7505_driver, NULL },
@@ -2051,11 +2054,13 @@ static struct pci_device_id agp_intel_pci_table[] = {
        ID(PCI_DEVICE_ID_INTEL_82915GM_HB),
        ID(PCI_DEVICE_ID_INTEL_82945G_HB),
        ID(PCI_DEVICE_ID_INTEL_82945GM_HB),
+       ID(PCI_DEVICE_ID_INTEL_82945GME_HB),
        ID(PCI_DEVICE_ID_INTEL_82946GZ_HB),
        ID(PCI_DEVICE_ID_INTEL_82965G_1_HB),
        ID(PCI_DEVICE_ID_INTEL_82965Q_HB),
        ID(PCI_DEVICE_ID_INTEL_82965G_HB),
        ID(PCI_DEVICE_ID_INTEL_82965GM_HB),
+       ID(PCI_DEVICE_ID_INTEL_82965GME_HB),
        ID(PCI_DEVICE_ID_INTEL_G33_HB),
        ID(PCI_DEVICE_ID_INTEL_Q35_HB),
        ID(PCI_DEVICE_ID_INTEL_Q33_HB),
index cda608c42bea35e9fd7ed8f79f50ef1e9b8412ad..98cf8abb3e57f59ab3055934f4f460b3352d9c49 100644 (file)
@@ -51,7 +51,6 @@ static void *sgi_tioca_alloc_page(struct agp_bridge_data *bridge)
                return NULL;
 
        get_page(page);
-       SetPageLocked(page);
        atomic_inc(&agp_bridge->current_memory_agp);
        return page_address(page);
 }
index 3359cc2b97364b3d4580c9ae6fdb9e7ec8bb7c30..8e7d713a5a1588053d7093acbcb583d57a30ac40 100644 (file)
@@ -184,6 +184,8 @@ static int i915_initialize(struct drm_device * dev,
         * private backbuffer/depthbuffer usage.
         */
        dev_priv->use_mi_batchbuffer_start = 0;
+       if (IS_I965G(dev)) /* 965 doesn't support older method */
+               dev_priv->use_mi_batchbuffer_start = 1;
 
        /* Allow hardware batchbuffers unless told otherwise.
         */
@@ -517,8 +519,13 @@ static int i915_dispatch_batchbuffer(struct drm_device * dev,
 
                if (dev_priv->use_mi_batchbuffer_start) {
                        BEGIN_LP_RING(2);
-                       OUT_RING(MI_BATCH_BUFFER_START | (2 << 6));
-                       OUT_RING(batch->start | MI_BATCH_NON_SECURE);
+                       if (IS_I965G(dev)) {
+                               OUT_RING(MI_BATCH_BUFFER_START | (2 << 6) | MI_BATCH_NON_SECURE_I965);
+                               OUT_RING(batch->start);
+                       } else {
+                               OUT_RING(MI_BATCH_BUFFER_START | (2 << 6));
+                               OUT_RING(batch->start | MI_BATCH_NON_SECURE);
+                       }
                        ADVANCE_LP_RING();
                } else {
                        BEGIN_LP_RING(4);
@@ -735,7 +742,8 @@ static int i915_setparam(DRM_IOCTL_ARGS)
 
        switch (param.param) {
        case I915_SETPARAM_USE_MI_BATCHBUFFER_START:
-               dev_priv->use_mi_batchbuffer_start = param.value;
+               if (!IS_I965G(dev))
+                       dev_priv->use_mi_batchbuffer_start = param.value;
                break;
        case I915_SETPARAM_TEX_LRU_LOG_GRANULARITY:
                dev_priv->tex_lru_log_granularity = param.value;
index fd918565f4e56d0deccf694438da08a1e5252b95..737088bd07807a9d875b9c035e509f446b039139 100644 (file)
@@ -282,6 +282,7 @@ extern int i915_wait_ring(struct drm_device * dev, int n, const char *caller);
 #define MI_BATCH_BUFFER_START  (0x31<<23)
 #define MI_BATCH_BUFFER_END    (0xA<<23)
 #define MI_BATCH_NON_SECURE    (1)
+#define MI_BATCH_NON_SECURE_I965 (1<<8)
 
 #define MI_WAIT_FOR_EVENT       ((0x3<<23))
 #define MI_WAIT_FOR_PLANE_A_FLIP      (1<<2)
index 9a2694e5f8b98311ff435f3ce4733333c5682266..77bf4aa217a8afcb7e8eb505ed2b0f5d9a0542c0 100644 (file)
@@ -73,7 +73,7 @@ static struct clocksource clocksource_hpet = {
         .name           = "hpet",
         .rating         = 250,
         .read           = read_hpet,
-        .mask           = 0xffffffffffffffff,
+        .mask           = CLOCKSOURCE_MASK(64),
         .mult           = 0, /*to be caluclated*/
         .shift          = 10,
         .flags          = CLOCK_SOURCE_IS_CONTINUOUS,
index e7b889e404a7ec80d498a34f20302dc0ac03d3b8..3d6bd0baa56dec3e45e84638719c8842986a935c 100644 (file)
@@ -1,6 +1,22 @@
-/* Simple console for lguest.
+/*D:300
+ * The Guest console driver
  *
- * Copyright (C) 2006 Rusty Russell, IBM Corporation
+ * This is a trivial console driver: we use lguest's DMA mechanism to send
+ * bytes out, and register a DMA buffer to receive bytes in.  It is assumed to
+ * be present and available from the very beginning of boot.
+ *
+ * Writing console drivers is one of the few remaining Dark Arts in Linux.
+ * Fortunately for us, the path of virtual consoles has been well-trodden by
+ * the PowerPC folks, who wrote "hvc_console.c" to generically support any
+ * virtual console.  We use that infrastructure which only requires us to write
+ * the basic put_chars and get_chars functions and call the right register
+ * functions.
+ :*/
+
+/*M:002 The console can be flooded: while the Guest is processing input the
+ * Host can send more.  Buffering in the Host could alleviate this, but it is a
+ * difficult problem in general. :*/
+/* Copyright (C) 2006 Rusty Russell, IBM Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/lguest_bus.h>
+#include <asm/paravirt.h>
 #include "hvc_console.h"
 
+/*D:340 This is our single console input buffer, with associated "struct
+ * lguest_dma" referring to it.  Note the 0-terminated length array, and the
+ * use of physical address for the buffer itself. */
 static char inbuf[256];
 static struct lguest_dma cons_input = { .used_len = 0,
                                        .addr[0] = __pa(inbuf),
                                        .len[0] = sizeof(inbuf),
                                        .len[1] = 0 };
 
+/*D:310 The put_chars() callback is pretty straightforward.
+ *
+ * First we put the pointer and length in a "struct lguest_dma": we only have
+ * one pointer, so we set the second length to 0.  Then we use SEND_DMA to send
+ * the data to (Host) buffers attached to the console key.  Usually a device's
+ * key is a physical address within the device's memory, but because the
+ * console device doesn't have any associated physical memory, we use the
+ * LGUEST_CONSOLE_DMA_KEY constant (aka 0). */
 static int put_chars(u32 vtermno, const char *buf, int count)
 {
        struct lguest_dma dma;
 
-       /* FIXME: what if it's over a page boundary? */
+       /* FIXME: DMA buffers in a "struct lguest_dma" are not allowed
+        * to go over page boundaries.  This never seems to happen,
+        * but if it did we'd need to fix this code. */
        dma.len[0] = count;
        dma.len[1] = 0;
        dma.addr[0] = __pa(buf);
 
        lguest_send_dma(LGUEST_CONSOLE_DMA_KEY, &dma);
+       /* We're expected to return the amount of data we wrote: all of it. */
        return count;
 }
 
+/*D:350 get_chars() is the callback from the hvc_console infrastructure when
+ * an interrupt is received.
+ *
+ * Firstly we see if our buffer has been filled: if not, we return.  The rest
+ * of the code deals with the fact that the hvc_console() infrastructure only
+ * asks us for 16 bytes at a time.  We keep a "cons_offset" variable for
+ * partially-read buffers. */
 static int get_chars(u32 vtermno, char *buf, int count)
 {
        static int cons_offset;
 
+       /* Nothing left to see here... */
        if (!cons_input.used_len)
                return 0;
 
+       /* You want more than we have to give?  Well, try wanting less! */
        if (cons_input.used_len - cons_offset < count)
                count = cons_input.used_len - cons_offset;
 
+       /* Copy across to their buffer and increment offset. */
        memcpy(buf, inbuf + cons_offset, count);
        cons_offset += count;
+
+       /* Finished?  Zero offset, and reset cons_input so Host will use it
+        * again. */
        if (cons_offset == cons_input.used_len) {
                cons_offset = 0;
                cons_input.used_len = 0;
        }
        return count;
 }
+/*:*/
 
 static struct hv_ops lguest_cons = {
        .get_chars = get_chars,
        .put_chars = put_chars,
 };
 
+/*D:320 Console drivers are initialized very early so boot messages can go
+ * out.  At this stage, the console is output-only.  Our driver checks we're a
+ * Guest, and if so hands hvc_instantiate() the console number (0), priority
+ * (0), and the struct hv_ops containing the put_chars() function. */
 static int __init cons_init(void)
 {
        if (strcmp(paravirt_ops.name, "lguest") != 0)
@@ -73,21 +122,46 @@ static int __init cons_init(void)
 }
 console_initcall(cons_init);
 
+/*D:370 To set up and manage our virtual console, we call hvc_alloc() and
+ * stash the result in the private pointer of the "struct lguest_device".
+ * Since we never remove the console device we never need this pointer again,
+ * but using ->private is considered good form, and you never know who's going
+ * to copy your driver.
+ *
+ * Once the console is set up, we bind our input buffer ready for input. */
 static int lguestcons_probe(struct lguest_device *lgdev)
 {
        int err;
 
+       /* The first argument of hvc_alloc() is the virtual console number, so
+        * we use zero.  The second argument is the interrupt number.
+        *
+        * The third argument is a "struct hv_ops" containing the put_chars()
+        * and get_chars() pointers.  The final argument is the output buffer
+        * size: we use 256 and expect the Host to have room for us to send
+        * that much. */
        lgdev->private = hvc_alloc(0, lgdev_irq(lgdev), &lguest_cons, 256);
        if (IS_ERR(lgdev->private))
                return PTR_ERR(lgdev->private);
 
+       /* We bind a single DMA buffer at key LGUEST_CONSOLE_DMA_KEY.
+        * "cons_input" is that statically-initialized global DMA buffer we saw
+        * above, and we also give the interrupt we want. */
        err = lguest_bind_dma(LGUEST_CONSOLE_DMA_KEY, &cons_input, 1,
                              lgdev_irq(lgdev));
        if (err)
                printk("lguest console: failed to bind buffer.\n");
        return err;
 }
+/* Note the use of lgdev_irq() for the interrupt number.  We tell hvc_alloc()
+ * to expect input when this interrupt is triggered, and then tell
+ * lguest_bind_dma() that is the interrupt to send us when input comes in. */
 
+/*D:360 From now on the console driver follows standard Guest driver form:
+ * register_lguest_driver() registers the device type and probe function, and
+ * the probe function sets up the device.
+ *
+ * The standard "struct lguest_driver": */
 static struct lguest_driver lguestcons_drv = {
        .name = "lguestcons",
        .owner = THIS_MODULE,
@@ -95,6 +169,7 @@ static struct lguest_driver lguestcons_drv = {
        .probe = lguestcons_probe,
 };
 
+/* The standard init function */
 static int __init hvc_lguest_init(void)
 {
        return register_lguest_driver(&lguestcons_drv);
index 6005b52257725ed251a849184b8e56efc5f98133..8d74b8745e6010712f15faabef630b8103ac4c61 100644 (file)
@@ -500,7 +500,6 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
 {
        int i, j, box;
        int err = 0;
-       int status = 0;
        static int loaded;
        i2eBordStrPtr pB = NULL;
        int rc = -1;
@@ -588,6 +587,8 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize)
                case PCI:
 #ifdef CONFIG_PCI
                        {
+                               int status;
+
                                pci_dev_i = pci_get_device(PCI_VENDOR_ID_COMPUTONE,
                                                          PCI_DEVICE_ID_COMPUTONE_IP2EX, pci_dev_i);
                                if (pci_dev_i != NULL) {
index 4edfdda0cf99e0fa8bbc1933564550f3cdaac61b..96d2f9ee42d684afdf28c50c07842f3d604b4013 100644 (file)
@@ -2050,6 +2050,7 @@ static __devinit void try_init_dmi(struct dmi_ipmi_data *ipmi_data)
                info->si_type = SI_BT;
                break;
        default:
+               kfree(info);
                return;
        }
 
index 6e55cfb9c65a3f03a12d0431040532cebdeb2e7c..e60a74c66e3dfa05c00eb45596829e77932ce5c1 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/init.h>
 #include <linux/errno.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/mmtimer.h>
 #include <linux/miscdevice.h>
 #include <linux/posix-timers.h>
index c716ef0dd370af5043590d12d314e8981daac754..c08a4152ee8fc2f5df6032221d519beafb4837f0 100644 (file)
@@ -38,6 +38,7 @@
 #include <linux/miscdevice.h>
 #include <linux/spinlock.h>
 #include <linux/mm.h>
+#include <linux/fs.h>
 #include <linux/vmalloc.h>
 #include <linux/string.h>
 #include <linux/slab.h>
index fee58e03dbe2bb30e5d8d715e9fab42be3b04e85..4177f6db83e9c45336bf0b604dd113424b8076ad 100644 (file)
@@ -1629,7 +1629,7 @@ static int cmm_open(struct inode *inode, struct file *filp)
 {
        struct cm4000_dev *dev;
        struct pcmcia_device *link;
-       int rc, minor = iminor(inode);
+       int minor = iminor(inode);
 
        if (minor >= CM4000_MAX_DEV)
                return -ENODEV;
@@ -1668,7 +1668,6 @@ static int cmm_open(struct inode *inode, struct file *filp)
        start_monitor(dev);
 
        link->open = 1;         /* only one open per device */
-       rc = 0;
 
        DEBUGP(2, dev, "<- cmm_open\n");
        return nonseekable_open(inode, filp);
@@ -1824,7 +1823,7 @@ static int cm4000_resume(struct pcmcia_device *link)
 
 static void cm4000_release(struct pcmcia_device *link)
 {
-       cmm_cm4000_release(link->priv); /* delay release until device closed */
+       cmm_cm4000_release(link);       /* delay release until device closed */
        pcmcia_disable_device(link);
 }
 
index af88181a17f477cd01e5a1f2644a9c8039619262..b24a3e7bbb9f23b409a77dfb2ffc4ff93a0c9f26 100644 (file)
@@ -599,7 +599,7 @@ cs_release:
 
 static void reader_release(struct pcmcia_device *link)
 {
-       cm4040_reader_release(link->priv);
+       cm4040_reader_release(link);
        pcmcia_disable_device(link);
 }
 
index 73037a4d3c5023f2e7b31fccf804f61a8ece0b08..aeec67e27264463c5697ac4652212d8a8e13fb73 100644 (file)
@@ -1147,10 +1147,15 @@ static int sonypi_acpi_remove(struct acpi_device *device, int type)
        return 0;
 }
 
+const static struct acpi_device_id sonypi_device_ids[] = {
+       {"SNY6001", 0},
+       {"", 0},
+};
+
 static struct acpi_driver sonypi_acpi_driver = {
        .name           = "sonypi",
        .class          = "hkey",
-       .ids            = "SNY6001",
+       .ids            = sonypi_device_ids,
        .ops            = {
                           .add = sonypi_acpi_add,
                           .remove = sonypi_acpi_remove,
index 372a37e256208b30711e2ee1e3809f120c5b25cc..bbb7f1292665267bf22f3a59afb455abfb5aaf00 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: synclink_gt.c,v 4.36 2006/08/28 20:47:14 paulkf Exp $
+ * $Id: synclink_gt.c,v 4.50 2007/07/25 19:29:25 paulkf Exp $
  *
  * Device driver for Microgate SyncLink GT serial adapters.
  *
@@ -93,7 +93,7 @@
  * module identification
  */
 static char *driver_name     = "SyncLink GT";
-static char *driver_version  = "$Revision: 4.36 $";
+static char *driver_version  = "$Revision: 4.50 $";
 static char *tty_driver_name = "synclink_gt";
 static char *tty_dev_prefix  = "ttySLG";
 MODULE_LICENSE("GPL");
@@ -477,6 +477,7 @@ static void tx_set_idle(struct slgt_info *info);
 static unsigned int free_tbuf_count(struct slgt_info *info);
 static void reset_tbufs(struct slgt_info *info);
 static void tdma_reset(struct slgt_info *info);
+static void tdma_start(struct slgt_info *info);
 static void tx_load(struct slgt_info *info, const char *buf, unsigned int count);
 
 static void get_signals(struct slgt_info *info);
@@ -904,6 +905,8 @@ start:
                spin_lock_irqsave(&info->lock,flags);
                if (!info->tx_active)
                        tx_start(info);
+               else
+                       tdma_start(info);
                spin_unlock_irqrestore(&info->lock,flags);
        }
 
@@ -3871,44 +3874,58 @@ static void tx_start(struct slgt_info *info)
                        slgt_irq_on(info, IRQ_TXUNDER + IRQ_TXIDLE);
                        /* clear tx idle and underrun status bits */
                        wr_reg16(info, SSR, (unsigned short)(IRQ_TXIDLE + IRQ_TXUNDER));
-
-                       if (!(rd_reg32(info, TDCSR) & BIT0)) {
-                               /* tx DMA stopped, restart tx DMA */
-                               tdma_reset(info);
-                               /* set 1st descriptor address */
-                               wr_reg32(info, TDDAR, info->tbufs[info->tbuf_start].pdesc);
-                               switch(info->params.mode) {
-                               case MGSL_MODE_RAW:
-                               case MGSL_MODE_MONOSYNC:
-                               case MGSL_MODE_BISYNC:
-                                       wr_reg32(info, TDCSR, BIT2 + BIT0); /* IRQ + DMA enable */
-                                       break;
-                               default:
-                                       wr_reg32(info, TDCSR, BIT0); /* DMA enable */
-                               }
-                       }
-
                        if (info->params.mode == MGSL_MODE_HDLC)
                                mod_timer(&info->tx_timer, jiffies +
                                                msecs_to_jiffies(5000));
                } else {
-                       tdma_reset(info);
-                       /* set 1st descriptor address */
-                       wr_reg32(info, TDDAR, info->tbufs[info->tbuf_start].pdesc);
-
                        slgt_irq_off(info, IRQ_TXDATA);
                        slgt_irq_on(info, IRQ_TXIDLE);
                        /* clear tx idle status bit */
                        wr_reg16(info, SSR, IRQ_TXIDLE);
-
-                       /* enable tx DMA */
-                       wr_reg32(info, TDCSR, BIT0);
                }
-
+               tdma_start(info);
                info->tx_active = 1;
        }
 }
 
+/*
+ * start transmit DMA if inactive and there are unsent buffers
+ */
+static void tdma_start(struct slgt_info *info)
+{
+       unsigned int i;
+
+       if (rd_reg32(info, TDCSR) & BIT0)
+               return;
+
+       /* transmit DMA inactive, check for unsent buffers */
+       i = info->tbuf_start;
+       while (!desc_count(info->tbufs[i])) {
+               if (++i == info->tbuf_count)
+                       i = 0;
+               if (i == info->tbuf_current)
+                       return;
+       }
+       info->tbuf_start = i;
+
+       /* there are unsent buffers, start transmit DMA */
+
+       /* reset needed if previous error condition */
+       tdma_reset(info);
+
+       /* set 1st descriptor address */
+       wr_reg32(info, TDDAR, info->tbufs[info->tbuf_start].pdesc);
+       switch(info->params.mode) {
+       case MGSL_MODE_RAW:
+       case MGSL_MODE_MONOSYNC:
+       case MGSL_MODE_BISYNC:
+               wr_reg32(info, TDCSR, BIT2 + BIT0); /* IRQ + DMA enable */
+               break;
+       default:
+               wr_reg32(info, TDCSR, BIT0); /* DMA enable */
+       }
+}
+
 static void tx_stop(struct slgt_info *info)
 {
        unsigned short val;
@@ -4642,8 +4659,8 @@ static unsigned int free_tbuf_count(struct slgt_info *info)
                        i=0;
        } while (i != info->tbuf_current);
 
-       /* last buffer with zero count may be in use, assume it is */
-       if (count)
+       /* if tx DMA active, last zero count buffer is in use */
+       if (count && (rd_reg32(info, TDCSR) & BIT0))
                --count;
 
        return count;
index de37ebc3a4cf03fa9e94d68fbf7e0f70b9293337..51ea93cab6c4c098cbd40dba6d17aa96e09b5c6e 100644 (file)
@@ -369,25 +369,54 @@ static void tty_buffer_free(struct tty_struct *tty, struct tty_buffer *b)
 }
 
 /**
- *     tty_buffer_flush                -       flush full tty buffers
+ *     __tty_buffer_flush              -       flush full tty buffers
  *     @tty: tty to flush
  *
- *     flush all the buffers containing receive data
+ *     flush all the buffers containing receive data. Caller must
+ *     hold the buffer lock and must have ensured no parallel flush to
+ *     ldisc is running.
  *
- *     Locking: none
+ *     Locking: Caller must hold tty->buf.lock
  */
 
-static void tty_buffer_flush(struct tty_struct *tty)
+static void __tty_buffer_flush(struct tty_struct *tty)
 {
        struct tty_buffer *thead;
-       unsigned long flags;
 
-       spin_lock_irqsave(&tty->buf.lock, flags);
        while((thead = tty->buf.head) != NULL) {
                tty->buf.head = thead->next;
                tty_buffer_free(tty, thead);
        }
        tty->buf.tail = NULL;
+}
+
+/**
+ *     tty_buffer_flush                -       flush full tty buffers
+ *     @tty: tty to flush
+ *
+ *     flush all the buffers containing receive data. If the buffer is
+ *     being processed by flush_to_ldisc then we defer the processing
+ *     to that function
+ *
+ *     Locking: none
+ */
+
+static void tty_buffer_flush(struct tty_struct *tty)
+{
+       unsigned long flags;
+       spin_lock_irqsave(&tty->buf.lock, flags);
+
+       /* If the data is being pushed to the tty layer then we can't
+          process it here. Instead set a flag and the flush_to_ldisc
+          path will process the flush request before it exits */
+       if (test_bit(TTY_FLUSHING, &tty->flags)) {
+               set_bit(TTY_FLUSHPENDING, &tty->flags);
+               spin_unlock_irqrestore(&tty->buf.lock, flags);
+               wait_event(tty->read_wait,
+                               test_bit(TTY_FLUSHPENDING, &tty->flags) == 0);
+               return;
+       } else
+               __tty_buffer_flush(tty);
        spin_unlock_irqrestore(&tty->buf.lock, flags);
 }
 
@@ -3594,6 +3623,7 @@ static void flush_to_ldisc(struct work_struct *work)
                return;
 
        spin_lock_irqsave(&tty->buf.lock, flags);
+       set_bit(TTY_FLUSHING, &tty->flags);     /* So we know a flush is running */
        head = tty->buf.head;
        if (head != NULL) {
                tty->buf.head = NULL;
@@ -3607,6 +3637,11 @@ static void flush_to_ldisc(struct work_struct *work)
                                tty_buffer_free(tty, tbuf);
                                continue;
                        }
+                       /* Ldisc or user is trying to flush the buffers
+                          we are feeding to the ldisc, stop feeding the
+                          line discipline as we want to empty the queue */
+                       if (test_bit(TTY_FLUSHPENDING, &tty->flags))
+                               break;
                        if (!tty->receive_room) {
                                schedule_delayed_work(&tty->buf.work, 1);
                                break;
@@ -3620,8 +3655,17 @@ static void flush_to_ldisc(struct work_struct *work)
                        disc->receive_buf(tty, char_buf, flag_buf, count);
                        spin_lock_irqsave(&tty->buf.lock, flags);
                }
+               /* Restore the queue head */
                tty->buf.head = head;
        }
+       /* We may have a deferred request to flush the input buffer,
+          if so pull the chain under the lock and empty the queue */
+       if (test_bit(TTY_FLUSHPENDING, &tty->flags)) {
+               __tty_buffer_flush(tty);
+               clear_bit(TTY_FLUSHPENDING, &tty->flags);
+               wake_up(&tty->read_wait);
+       }
+       clear_bit(TTY_FLUSHING, &tty->flags);
        spin_unlock_irqrestore(&tty->buf.lock, flags);
 
        tty_ldisc_deref(disc);
index 16fb23125e96acdab10d128adda7181830fd93ea..37bddc1802de3904085c300ad62427cb6263c533 100644 (file)
@@ -55,6 +55,8 @@ config SOFT_WATCHDOG
          To compile this driver as a module, choose M here: the
          module will be called softdog.
 
+# ALPHA Architecture
+
 # ARM Architecture
 
 config AT91RM9200_WATCHDOG
@@ -189,7 +191,7 @@ config PNX4008_WATCHDOG
 
 config IOP_WATCHDOG
        tristate "IOP Watchdog"
-       depends on WATCHDOG && PLAT_IOP
+       depends on PLAT_IOP
        select WATCHDOG_NOWAYOUT if (ARCH_IOP32X || ARCH_IOP33X)
        help
          Say Y here if to include support for the watchdog timer
@@ -203,15 +205,48 @@ config IOP_WATCHDOG
          operating as an Root Complex and/or Central Resource, the PCI-X
          and/or PCIe busses will also be reset.  THIS IS A VERY BIG HAMMER.
 
+config DAVINCI_WATCHDOG
+       tristate "DaVinci watchdog"
+       depends on ARCH_DAVINCI
+       help
+         Say Y here if to include support for the watchdog timer
+         in the DaVinci DM644x/DM646x processors.
+         To compile this driver as a module, choose M here: the
+         module will be called davinci_wdt.
+
+         NOTE: once enabled, this timer cannot be disabled.
+         Say N if you are unsure.
+
+# ARM26 Architecture
+
 # AVR32 Architecture
 
 config AT32AP700X_WDT
        tristate "AT32AP700x watchdog"
-       depends on WATCHDOG && CPU_AT32AP7000
+       depends on CPU_AT32AP7000
        help
          Watchdog timer embedded into AT32AP700x devices. This will reboot
          your system when the timeout is reached.
 
+# BLACKFIN Architecture
+
+config BFIN_WDT
+       tristate "Blackfin On-Chip Watchdog Timer"
+       depends on BLACKFIN
+       ---help---
+         If you say yes here you will get support for the Blackfin On-Chip
+         Watchdog Timer. If you have one of these processors and wish to
+         have watchdog support enabled, say Y, otherwise say N.
+
+         To compile this driver as a module, choose M here: the
+         module will be called bfin_wdt.
+
+# CRIS Architecture
+
+# FRV Architecture
+
+# H8300 Architecture
+
 # X86 (i386 + ia64 + x86_64) Architecture
 
 config ACQUIRE_WDT
@@ -540,37 +575,11 @@ config SBC_EPX_C3_WATCHDOG
          To compile this driver as a module, choose M here: the
          module will be called sbc_epx_c3.
 
-# PowerPC Architecture
+# M32R Architecture
 
-config 8xx_WDT
-       tristate "MPC8xx Watchdog Timer"
-       depends on 8xx
+# M68K Architecture
 
-config 83xx_WDT
-       tristate "MPC83xx Watchdog Timer"
-       depends on PPC_83xx
-
-config MV64X60_WDT
-       tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
-       depends on MV64X60
-
-config BOOKE_WDT
-       bool "PowerPC Book-E Watchdog Timer"
-       depends on BOOKE || 4xx
-       ---help---
-         Please see Documentation/watchdog/watchdog-api.txt for
-         more information.
-
-# PPC64 Architecture
-
-config WATCHDOG_RTAS
-       tristate "RTAS watchdog"
-       depends on PPC_RTAS
-       help
-         This driver adds watchdog support for the RTAS watchdog.
-
-         To compile this driver as a module, choose M here. The module
-         will be called wdrtas.
+# M68KNOMMU Architecture
 
 # MIPS Architecture
 
@@ -600,6 +609,44 @@ config WDT_RM9K_GPI
          To compile this driver as a module, choose M here: the
          module will be called rm9k_wdt.
 
+# PARISC Architecture
+
+# POWERPC Architecture
+
+config MPC5200_WDT
+       tristate "MPC5200 Watchdog Timer"
+       depends on PPC_MPC52xx
+
+config 8xx_WDT
+       tristate "MPC8xx Watchdog Timer"
+       depends on 8xx
+
+config 83xx_WDT
+       tristate "MPC83xx Watchdog Timer"
+       depends on PPC_83xx
+
+config MV64X60_WDT
+       tristate "MV64X60 (Marvell Discovery) Watchdog Timer"
+       depends on MV64X60
+
+config BOOKE_WDT
+       bool "PowerPC Book-E Watchdog Timer"
+       depends on BOOKE || 4xx
+       ---help---
+         Please see Documentation/watchdog/watchdog-api.txt for
+         more information.
+
+# PPC64 Architecture
+
+config WATCHDOG_RTAS
+       tristate "RTAS watchdog"
+       depends on PPC_RTAS
+       help
+         This driver adds watchdog support for the RTAS watchdog.
+
+         To compile this driver as a module, choose M here. The module
+         will be called wdrtas.
+
 # S390 Architecture
 
 config ZVM_WATCHDOG
@@ -614,7 +661,7 @@ config ZVM_WATCHDOG
          To compile this driver as a module, choose M here. The module
          will be called vmwatchdog.
 
-# SUPERH Architecture
+# SUPERH (sh + sh64) Architecture
 
 config SH_WDT
        tristate "SuperH Watchdog"
@@ -641,6 +688,8 @@ config SH_WDT_MMAP
          If you say Y here, user applications will be able to mmap the
          WDT/CPG registers.
 
+# SPARC Architecture
+
 # SPARC64 Architecture
 
 config WATCHDOG_CP1XXX
@@ -665,6 +714,10 @@ config WATCHDOG_RIO
          machines.  The watchdog timeout period is normally one minute but
          can be changed with a boot-time parameter.
 
+# V850 Architecture
+
+# XTENSA Architecture
+
 #
 # ISA-based Watchdog Cards
 #
index bdb9d5e3bb41ece30f7924cc70adc3ca42518b71..389f8b14ccc43dc752fa7d1e3febfd677cdf1c9c 100644 (file)
@@ -22,6 +22,8 @@ obj-$(CONFIG_WDTPCI) += wdt_pci.o
 # USB-based Watchdog Cards
 obj-$(CONFIG_USBPCWATCHDOG) += pcwd_usb.o
 
+# ALPHA Architecture
+
 # ARM Architecture
 obj-$(CONFIG_AT91RM9200_WATCHDOG) += at91rm9200_wdt.o
 obj-$(CONFIG_OMAP_WATCHDOG) += omap_wdt.o
@@ -36,10 +38,22 @@ obj-$(CONFIG_MPCORE_WATCHDOG) += mpcore_wdt.o
 obj-$(CONFIG_EP93XX_WATCHDOG) += ep93xx_wdt.o
 obj-$(CONFIG_PNX4008_WATCHDOG) += pnx4008_wdt.o
 obj-$(CONFIG_IOP_WATCHDOG) += iop_wdt.o
+obj-$(CONFIG_DAVINCI_WATCHDOG) += davinci_wdt.o
+
+# ARM26 Architecture
 
 # AVR32 Architecture
 obj-$(CONFIG_AT32AP700X_WDT) += at32ap700x_wdt.o
 
+# BLACKFIN Architecture
+obj-$(CONFIG_BFIN_WDT) += bfin_wdt.o
+
+# CRIS Architecture
+
+# FRV Architecture
+
+# H8300 Architecture
+
 # X86 (i386 + ia64 + x86_64) Architecture
 obj-$(CONFIG_ACQUIRE_WDT) += acquirewdt.o
 obj-$(CONFIG_ADVANTECH_WDT) += advantechwdt.o
@@ -66,8 +80,22 @@ obj-$(CONFIG_W83977F_WDT) += w83977f_wdt.o
 obj-$(CONFIG_MACHZ_WDT) += machzwd.o
 obj-$(CONFIG_SBC_EPX_C3_WATCHDOG) += sbc_epx_c3.o
 
-# PowerPC Architecture
+# M32R Architecture
+
+# M68K Architecture
+
+# M68KNOMMU Architecture
+
+# MIPS Architecture
+obj-$(CONFIG_INDYDOG) += indydog.o
+obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
+obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
+
+# PARISC Architecture
+
+# POWERPC Architecture
 obj-$(CONFIG_8xx_WDT) += mpc8xx_wdt.o
+obj-$(CONFIG_MPC5200_WDT) += mpc5200_wdt.o
 obj-$(CONFIG_83xx_WDT) += mpc83xx_wdt.o
 obj-$(CONFIG_MV64X60_WDT) += mv64x60_wdt.o
 obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
@@ -75,17 +103,18 @@ obj-$(CONFIG_BOOKE_WDT) += booke_wdt.o
 # PPC64 Architecture
 obj-$(CONFIG_WATCHDOG_RTAS) += wdrtas.o
 
-# MIPS Architecture
-obj-$(CONFIG_INDYDOG) += indydog.o
-obj-$(CONFIG_WDT_MTX1) += mtx-1_wdt.o
-obj-$(CONFIG_WDT_RM9K_GPI) += rm9k_wdt.o
-
 # S390 Architecture
 
-# SUPERH Architecture
+# SUPERH (sh + sh64) Architecture
 obj-$(CONFIG_SH_WDT) += shwdt.o
 
+# SPARC Architecture
+
 # SPARC64 Architecture
 
+# V850 Architecture
+
+# XTENSA Architecture
+
 # Architecture Independant
 obj-$(CONFIG_SOFT_WATCHDOG) += softdog.o
diff --git a/drivers/char/watchdog/bfin_wdt.c b/drivers/char/watchdog/bfin_wdt.c
new file mode 100644 (file)
index 0000000..309d279
--- /dev/null
@@ -0,0 +1,490 @@
+/*
+ * Blackfin On-Chip Watchdog Driver
+ *  Supports BF53[123]/BF53[467]/BF54[2489]/BF561
+ *
+ * Originally based on softdog.c
+ * Copyright 2006-2007 Analog Devices Inc.
+ * Copyright 2006-2007 Michele d'Amico
+ * Copyright 1996 Alan Cox <alan@redhat.com>
+ *
+ * Enter bugs at http://blackfin.uclinux.org/
+ *
+ * Licensed under the GPL-2 or later.
+ */
+
+#include <linux/platform_device.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/types.h>
+#include <linux/timer.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/fs.h>
+#include <linux/notifier.h>
+#include <linux/reboot.h>
+#include <linux/init.h>
+#include <linux/interrupt.h>
+#include <asm/blackfin.h>
+#include <asm/uaccess.h>
+
+#define stamp(fmt, args...) pr_debug("%s:%i: " fmt "\n", __func__, __LINE__, ## args)
+#define stampit() stamp("here i am")
+
+#define WATCHDOG_NAME "bfin-wdt"
+#define PFX WATCHDOG_NAME ": "
+
+/* The BF561 has two watchdogs (one per core), but since Linux
+ * only runs on core A, we'll just work with that one.
+ */
+#ifdef BF561_FAMILY
+# define bfin_read_WDOG_CTL()    bfin_read_WDOGA_CTL()
+# define bfin_read_WDOG_CNT()    bfin_read_WDOGA_CNT()
+# define bfin_read_WDOG_STAT()   bfin_read_WDOGA_STAT()
+# define bfin_write_WDOG_CTL(x)  bfin_write_WDOGA_CTL(x)
+# define bfin_write_WDOG_CNT(x)  bfin_write_WDOGA_CNT(x)
+# define bfin_write_WDOG_STAT(x) bfin_write_WDOGA_STAT(x)
+#endif
+
+/* Bit in SWRST that indicates boot caused by watchdog */
+#define SWRST_RESET_WDOG 0x4000
+
+/* Bit in WDOG_CTL that indicates watchdog has expired (WDR0) */
+#define WDOG_EXPIRED 0x8000
+
+/* Masks for WDEV field in WDOG_CTL register */
+#define ICTL_RESET   0x0
+#define ICTL_NMI     0x2
+#define ICTL_GPI     0x4
+#define ICTL_NONE    0x6
+#define ICTL_MASK    0x6
+
+/* Masks for WDEN field in WDOG_CTL register */
+#define WDEN_MASK    0x0FF0
+#define WDEN_ENABLE  0x0000
+#define WDEN_DISABLE 0x0AD0
+
+/* some defaults */
+#define WATCHDOG_TIMEOUT 20
+
+static unsigned int timeout = WATCHDOG_TIMEOUT;
+static int nowayout = WATCHDOG_NOWAYOUT;
+static struct watchdog_info bfin_wdt_info;
+static unsigned long open_check;
+static char expect_close;
+static spinlock_t bfin_wdt_spinlock = SPIN_LOCK_UNLOCKED;
+
+/**
+ *     bfin_wdt_keepalive - Keep the Userspace Watchdog Alive
+ *
+ *     The Userspace watchdog got a KeepAlive: schedule the next timeout.
+ */
+static int bfin_wdt_keepalive(void)
+{
+       stampit();
+       bfin_write_WDOG_STAT(0);
+       return 0;
+}
+
+/**
+ *     bfin_wdt_stop - Stop the Watchdog
+ *
+ *     Stops the on-chip watchdog.
+ */
+static int bfin_wdt_stop(void)
+{
+       stampit();
+       bfin_write_WDOG_CTL(WDEN_DISABLE);
+       return 0;
+}
+
+/**
+ *     bfin_wdt_start - Start the Watchdog
+ *
+ *     Starts the on-chip watchdog.  Automatically loads WDOG_CNT
+ *     into WDOG_STAT for us.
+ */
+static int bfin_wdt_start(void)
+{
+       stampit();
+       bfin_write_WDOG_CTL(WDEN_ENABLE | ICTL_RESET);
+       return 0;
+}
+
+/**
+ *     bfin_wdt_running - Check Watchdog status
+ *
+ *     See if the watchdog is running.
+ */
+static int bfin_wdt_running(void)
+{
+       stampit();
+       return ((bfin_read_WDOG_CTL() & WDEN_MASK) != WDEN_DISABLE);
+}
+
+/**
+ *     bfin_wdt_set_timeout - Set the Userspace Watchdog timeout
+ *     @t: new timeout value (in seconds)
+ *
+ *     Translate the specified timeout in seconds into System Clock
+ *     terms which is what the on-chip Watchdog requires.
+ */
+static int bfin_wdt_set_timeout(unsigned long t)
+{
+       u32 cnt;
+       unsigned long flags;
+
+       stampit();
+
+       cnt = t * get_sclk();
+       if (cnt < get_sclk()) {
+               printk(KERN_WARNING PFX "timeout value is too large\n");
+               return -EINVAL;
+       }
+
+       spin_lock_irqsave(&bfin_wdt_spinlock, flags);
+       {
+               int run = bfin_wdt_running();
+               bfin_wdt_stop();
+               bfin_write_WDOG_CNT(cnt);
+               if (run) bfin_wdt_start();
+       }
+       spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
+
+       timeout = t;
+
+       return 0;
+}
+
+/**
+ *     bfin_wdt_open - Open the Device
+ *     @inode: inode of device
+ *     @file: file handle of device
+ *
+ *     Watchdog device is opened and started.
+ */
+static int bfin_wdt_open(struct inode *inode, struct file *file)
+{
+       stampit();
+
+       if (test_and_set_bit(0, &open_check))
+               return -EBUSY;
+
+       if (nowayout)
+               __module_get(THIS_MODULE);
+
+       bfin_wdt_keepalive();
+       bfin_wdt_start();
+
+       return nonseekable_open(inode, file);
+}
+
+/**
+ *     bfin_wdt_close - Close the Device
+ *     @inode: inode of device
+ *     @file: file handle of device
+ *
+ *     Watchdog device is closed and stopped.
+ */
+static int bfin_wdt_release(struct inode *inode, struct file *file)
+{
+       stampit();
+
+       if (expect_close == 42) {
+               bfin_wdt_stop();
+       } else {
+               printk(KERN_CRIT PFX "Unexpected close, not stopping watchdog!\n");
+               bfin_wdt_keepalive();
+       }
+
+       expect_close = 0;
+       clear_bit(0, &open_check);
+
+       return 0;
+}
+
+/**
+ *     bfin_wdt_write - Write to Device
+ *     @file: file handle of device
+ *     @buf: buffer to write
+ *     @count: length of buffer
+ *     @ppos: offset
+ *
+ *     Pings the watchdog on write.
+ */
+static ssize_t bfin_wdt_write(struct file *file, const char __user *data,
+                              size_t len, loff_t *ppos)
+{
+       stampit();
+
+       if (len) {
+               if (!nowayout) {
+                       size_t i;
+
+                       /* In case it was set long ago */
+                       expect_close = 0;
+
+                       for (i = 0; i != len; i++) {
+                               char c;
+                               if (get_user(c, data + i))
+                                       return -EFAULT;
+                               if (c == 'V')
+                                       expect_close = 42;
+                       }
+               }
+               bfin_wdt_keepalive();
+       }
+
+       return len;
+}
+
+/**
+ *     bfin_wdt_ioctl - Query Device
+ *     @inode: inode of device
+ *     @file: file handle of device
+ *     @cmd: watchdog command
+ *     @arg: argument
+ *
+ *     Query basic information from the device or ping it, as outlined by the
+ *     watchdog API.
+ */
+static int bfin_wdt_ioctl(struct inode *inode, struct file *file,
+                          unsigned int cmd, unsigned long arg)
+{
+       void __user *argp = (void __user *)arg;
+       int __user *p = argp;
+
+       stampit();
+
+       switch (cmd) {
+               default:
+                       return -ENOTTY;
+
+               case WDIOC_GETSUPPORT:
+                       if (copy_to_user(argp, &bfin_wdt_info, sizeof(bfin_wdt_info)))
+                               return -EFAULT;
+                       else
+                               return 0;
+
+               case WDIOC_GETSTATUS:
+               case WDIOC_GETBOOTSTATUS:
+                       return put_user(!!(_bfin_swrst & SWRST_RESET_WDOG), p);
+
+               case WDIOC_KEEPALIVE:
+                       bfin_wdt_keepalive();
+                       return 0;
+
+               case WDIOC_SETTIMEOUT: {
+                       int new_timeout;
+
+                       if (get_user(new_timeout, p))
+                               return -EFAULT;
+
+                       if (bfin_wdt_set_timeout(new_timeout))
+                               return -EINVAL;
+               }
+                       /* Fall */
+               case WDIOC_GETTIMEOUT:
+                       return put_user(timeout, p);
+
+               case WDIOC_SETOPTIONS: {
+                       unsigned long flags;
+                       int options, ret = -EINVAL;
+
+                       if (get_user(options, p))
+                               return -EFAULT;
+
+                       spin_lock_irqsave(&bfin_wdt_spinlock, flags);
+
+                       if (options & WDIOS_DISABLECARD) {
+                               bfin_wdt_stop();
+                               ret = 0;
+                       }
+
+                       if (options & WDIOS_ENABLECARD) {
+                               bfin_wdt_start();
+                               ret = 0;
+                       }
+
+                       spin_unlock_irqrestore(&bfin_wdt_spinlock, flags);
+
+                       return ret;
+               }
+       }
+}
+
+/**
+ *     bfin_wdt_notify_sys - Notifier Handler
+ *     @this: notifier block
+ *     @code: notifier event
+ *     @unused: unused
+ *
+ *     Handles specific events, such as turning off the watchdog during a
+ *     shutdown event.
+ */
+static int bfin_wdt_notify_sys(struct notifier_block *this, unsigned long code,
+                               void *unused)
+{
+       stampit();
+
+       if (code == SYS_DOWN || code == SYS_HALT)
+               bfin_wdt_stop();
+
+       return NOTIFY_DONE;
+}
+
+#ifdef CONFIG_PM
+static int state_before_suspend;
+
+/**
+ *     bfin_wdt_suspend - suspend the watchdog
+ *     @pdev: device being suspended
+ *     @state: requested suspend state
+ *
+ *     Remember if the watchdog was running and stop it.
+ *     TODO: is this even right?  Doesn't seem to be any
+ *           standard in the watchdog world ...
+ */
+static int bfin_wdt_suspend(struct platform_device *pdev, pm_message_t state)
+{
+       stampit();
+
+       state_before_suspend = bfin_wdt_running();
+       bfin_wdt_stop();
+
+       return 0;
+}
+
+/**
+ *     bfin_wdt_resume - resume the watchdog
+ *     @pdev: device being resumed
+ *
+ *     If the watchdog was running, turn it back on.
+ */
+static int bfin_wdt_resume(struct platform_device *pdev)
+{
+       stampit();
+
+       if (state_before_suspend) {
+               bfin_wdt_set_timeout(timeout);
+               bfin_wdt_start();
+       }
+
+       return 0;
+}
+#else
+# define bfin_wdt_suspend NULL
+# define bfin_wdt_resume NULL
+#endif
+
+static struct platform_device bfin_wdt_device = {
+       .name          = WATCHDOG_NAME,
+       .id            = -1,
+};
+
+static struct platform_driver bfin_wdt_driver = {
+       .driver    = {
+               .name  = WATCHDOG_NAME,
+               .owner = THIS_MODULE,
+       },
+       .suspend   = bfin_wdt_suspend,
+       .resume    = bfin_wdt_resume,
+};
+
+static struct file_operations bfin_wdt_fops = {
+       .owner    = THIS_MODULE,
+       .llseek   = no_llseek,
+       .write    = bfin_wdt_write,
+       .ioctl    = bfin_wdt_ioctl,
+       .open     = bfin_wdt_open,
+       .release  = bfin_wdt_release,
+};
+
+static struct miscdevice bfin_wdt_miscdev = {
+       .minor    = WATCHDOG_MINOR,
+       .name     = "watchdog",
+       .fops     = &bfin_wdt_fops,
+};
+
+static struct watchdog_info bfin_wdt_info = {
+       .identity = "Blackfin Watchdog",
+       .options  = WDIOF_SETTIMEOUT |
+                   WDIOF_KEEPALIVEPING |
+                   WDIOF_MAGICCLOSE,
+};
+
+static struct notifier_block bfin_wdt_notifier = {
+       .notifier_call = bfin_wdt_notify_sys,
+};
+
+/**
+ *     bfin_wdt_init - Initialize module
+ *
+ *     Registers the device and notifier handler. Actual device
+ *     initialization is handled by bfin_wdt_open().
+ */
+static int __init bfin_wdt_init(void)
+{
+       int ret;
+
+       stampit();
+
+       /* Check that the timeout value is within range */
+       if (bfin_wdt_set_timeout(timeout))
+               return -EINVAL;
+
+       /* Since this is an on-chip device and needs no board-specific
+        * resources, we'll handle all the platform device stuff here.
+        */
+       ret = platform_device_register(&bfin_wdt_device);
+       if (ret)
+               return ret;
+
+       ret = platform_driver_probe(&bfin_wdt_driver, NULL);
+       if (ret)
+               return ret;
+
+       ret = register_reboot_notifier(&bfin_wdt_notifier);
+       if (ret) {
+               printk(KERN_ERR PFX "cannot register reboot notifier (err=%d)\n", ret);
+               return ret;
+       }
+
+       ret = misc_register(&bfin_wdt_miscdev);
+       if (ret) {
+               printk(KERN_ERR PFX "cannot register miscdev on minor=%d (err=%d)\n",
+                      WATCHDOG_MINOR, ret);
+               unregister_reboot_notifier(&bfin_wdt_notifier);
+               return ret;
+       }
+
+       printk(KERN_INFO PFX "initialized: timeout=%d sec (nowayout=%d)\n",
+              timeout, nowayout);
+
+       return 0;
+}
+
+/**
+ *     bfin_wdt_exit - Deinitialize module
+ *
+ *     Unregisters the device and notifier handler. Actual device
+ *     deinitialization is handled by bfin_wdt_close().
+ */
+static void __exit bfin_wdt_exit(void)
+{
+       misc_deregister(&bfin_wdt_miscdev);
+       unregister_reboot_notifier(&bfin_wdt_notifier);
+}
+
+module_init(bfin_wdt_init);
+module_exit(bfin_wdt_exit);
+
+MODULE_AUTHOR("Michele d'Amico, Mike Frysinger <vapier@gentoo.org>");
+MODULE_DESCRIPTION("Blackfin Watchdog Device Driver");
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
+
+module_param(timeout, uint, 0);
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. (1<=timeout<=((2^32)/SCLK), default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ")");
+
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
index 0f5c77ddd39dedd5af2fdabe8bddfe5f81f14dc4..d362f5bf658ada49503343779c47de4ef270ddd6 100644 (file)
@@ -144,7 +144,7 @@ static int booke_wdt_open (struct inode *inode, struct file *file)
                                booke_wdt_period);
        }
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static const struct file_operations booke_wdt_fops = {
index d0d45a8b09f0a57c379028a4b4e62800c222e223..5941ca601a3a17359637753fdc3558b86430252f 100644 (file)
@@ -162,6 +162,10 @@ static int cpu5wdt_ioctl(struct inode *inode, struct file *file, unsigned int cm
                        if ( copy_to_user(argp, &value, sizeof(int)) )
                                return -EFAULT;
                        break;
+               case WDIOC_GETBOOTSTATUS:
+                       if ( copy_to_user(argp, &value, sizeof(int)) )
+                               return -EFAULT;
+                       break;
                case WDIOC_GETSUPPORT:
                        if ( copy_to_user(argp, &ident, sizeof(ident)) )
                                return -EFAULT;
diff --git a/drivers/char/watchdog/davinci_wdt.c b/drivers/char/watchdog/davinci_wdt.c
new file mode 100644 (file)
index 0000000..19db530
--- /dev/null
@@ -0,0 +1,281 @@
+/*
+ * drivers/char/watchdog/davinci_wdt.c
+ *
+ * Watchdog driver for DaVinci DM644x/DM646x processors
+ *
+ * Copyright (C) 2006 Texas Instruments.
+ *
+ * 2007 (c) MontaVista Software, Inc. This file is licensed under
+ * the terms of the GNU General Public License version 2. This program
+ * is licensed "as is" without any warranty of any kind, whether express
+ * or implied.
+ */
+
+#include <linux/module.h>
+#include <linux/moduleparam.h>
+#include <linux/types.h>
+#include <linux/kernel.h>
+#include <linux/fs.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/init.h>
+#include <linux/bitops.h>
+#include <linux/platform_device.h>
+#include <linux/spinlock.h>
+
+#include <asm/hardware.h>
+#include <asm/uaccess.h>
+#include <asm/io.h>
+
+#define MODULE_NAME "DAVINCI-WDT: "
+
+#define DEFAULT_HEARTBEAT 60
+#define MAX_HEARTBEAT     600  /* really the max margin is 264/27MHz*/
+
+/* Timer register set definition */
+#define PID12  (0x0)
+#define EMUMGT (0x4)
+#define TIM12  (0x10)
+#define TIM34  (0x14)
+#define PRD12  (0x18)
+#define PRD34  (0x1C)
+#define TCR    (0x20)
+#define TGCR   (0x24)
+#define WDTCR  (0x28)
+
+/* TCR bit definitions */
+#define ENAMODE12_DISABLED     (0 << 6)
+#define ENAMODE12_ONESHOT      (1 << 6)
+#define ENAMODE12_PERIODIC     (2 << 6)
+
+/* TGCR bit definitions */
+#define TIM12RS_UNRESET                (1 << 0)
+#define TIM34RS_UNRESET                (1 << 1)
+#define TIMMODE_64BIT_WDOG      (2 << 2)
+
+/* WDTCR bit definitions */
+#define WDEN                   (1 << 14)
+#define WDFLAG                 (1 << 15)
+#define WDKEY_SEQ0             (0xa5c6 << 16)
+#define WDKEY_SEQ1             (0xda7e << 16)
+
+static int heartbeat = DEFAULT_HEARTBEAT;
+
+static spinlock_t io_lock;
+static unsigned long wdt_status;
+#define WDT_IN_USE        0
+#define WDT_OK_TO_CLOSE   1
+#define WDT_REGION_INITED 2
+#define WDT_DEVICE_INITED 3
+
+static struct resource *wdt_mem;
+static void __iomem    *wdt_base;
+
+static void wdt_service(void)
+{
+       spin_lock(&io_lock);
+
+       /* put watchdog in service state */
+       davinci_writel(WDKEY_SEQ0, wdt_base + WDTCR);
+       /* put watchdog in active state */
+       davinci_writel(WDKEY_SEQ1, wdt_base + WDTCR);
+
+       spin_unlock(&io_lock);
+}
+
+static void wdt_enable(void)
+{
+       u32 tgcr;
+       u32 timer_margin;
+
+       spin_lock(&io_lock);
+
+       /* disable, internal clock source */
+       davinci_writel(0, wdt_base + TCR);
+       /* reset timer, set mode to 64-bit watchdog, and unreset */
+       davinci_writel(0, wdt_base + TGCR);
+       tgcr = TIMMODE_64BIT_WDOG | TIM12RS_UNRESET | TIM34RS_UNRESET;
+       davinci_writel(tgcr, wdt_base + TGCR);
+       /* clear counter regs */
+       davinci_writel(0, wdt_base + TIM12);
+       davinci_writel(0, wdt_base + TIM34);
+       /* set timeout period */
+       timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) & 0xffffffff);
+       davinci_writel(timer_margin, wdt_base + PRD12);
+       timer_margin = (((u64)heartbeat * CLOCK_TICK_RATE) >> 32);
+       davinci_writel(timer_margin, wdt_base + PRD34);
+       /* enable run continuously */
+       davinci_writel(ENAMODE12_PERIODIC, wdt_base + TCR);
+       /* Once the WDT is in pre-active state write to
+        * TIM12, TIM34, PRD12, PRD34, TCR, TGCR, WDTCR are
+        * write protected (except for the WDKEY field)
+        */
+       /* put watchdog in pre-active state */
+       davinci_writel(WDKEY_SEQ0 | WDEN, wdt_base + WDTCR);
+       /* put watchdog in active state */
+       davinci_writel(WDKEY_SEQ1 | WDEN, wdt_base + WDTCR);
+
+       spin_unlock(&io_lock);
+}
+
+static int davinci_wdt_open(struct inode *inode, struct file *file)
+{
+       if (test_and_set_bit(WDT_IN_USE, &wdt_status))
+               return -EBUSY;
+
+       wdt_enable();
+
+       return nonseekable_open(inode, file);
+}
+
+static ssize_t
+davinci_wdt_write(struct file *file, const char *data, size_t len,
+                 loff_t *ppos)
+{
+       if (len)
+               wdt_service();
+
+       return len;
+}
+
+static struct watchdog_info ident = {
+       .options = WDIOF_KEEPALIVEPING,
+       .identity = "DaVinci Watchdog",
+};
+
+static int
+davinci_wdt_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
+                 unsigned long arg)
+{
+       int ret = -ENOTTY;
+
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               ret = copy_to_user((struct watchdog_info *)arg, &ident,
+                                  sizeof(ident)) ? -EFAULT : 0;
+               break;
+
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               ret = put_user(0, (int *)arg);
+               break;
+
+       case WDIOC_GETTIMEOUT:
+               ret = put_user(heartbeat, (int *)arg);
+               break;
+
+       case WDIOC_KEEPALIVE:
+               wdt_service();
+               ret = 0;
+               break;
+       }
+       return ret;
+}
+
+static int davinci_wdt_release(struct inode *inode, struct file *file)
+{
+       wdt_service();
+       clear_bit(WDT_IN_USE, &wdt_status);
+
+       return 0;
+}
+
+static const struct file_operations davinci_wdt_fops = {
+       .owner = THIS_MODULE,
+       .llseek = no_llseek,
+       .write = davinci_wdt_write,
+       .ioctl = davinci_wdt_ioctl,
+       .open = davinci_wdt_open,
+       .release = davinci_wdt_release,
+};
+
+static struct miscdevice davinci_wdt_miscdev = {
+       .minor = WATCHDOG_MINOR,
+       .name = "watchdog",
+       .fops = &davinci_wdt_fops,
+};
+
+static int davinci_wdt_probe(struct platform_device *pdev)
+{
+       int ret = 0, size;
+       struct resource *res;
+
+       spin_lock_init(&io_lock);
+
+       if (heartbeat < 1 || heartbeat > MAX_HEARTBEAT)
+               heartbeat = DEFAULT_HEARTBEAT;
+
+       printk(KERN_INFO MODULE_NAME
+               "DaVinci Watchdog Timer: heartbeat %d sec\n", heartbeat);
+
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res == NULL) {
+               printk(KERN_INFO MODULE_NAME
+                       "failed to get memory region resource\n");
+               return -ENOENT;
+       }
+
+       size = res->end - res->start + 1;
+       wdt_mem = request_mem_region(res->start, size, pdev->name);
+
+       if (wdt_mem == NULL) {
+               printk(KERN_INFO MODULE_NAME "failed to get memory region\n");
+               return -ENOENT;
+       }
+       wdt_base = (void __iomem *)(res->start);
+
+       ret = misc_register(&davinci_wdt_miscdev);
+       if (ret < 0) {
+               printk(KERN_ERR MODULE_NAME "cannot register misc device\n");
+               release_resource(wdt_mem);
+               kfree(wdt_mem);
+       } else {
+               set_bit(WDT_DEVICE_INITED, &wdt_status);
+       }
+
+       return ret;
+}
+
+static int davinci_wdt_remove(struct platform_device *pdev)
+{
+       misc_deregister(&davinci_wdt_miscdev);
+       if (wdt_mem) {
+               release_resource(wdt_mem);
+               kfree(wdt_mem);
+               wdt_mem = NULL;
+       }
+       return 0;
+}
+
+static struct platform_driver platform_wdt_driver = {
+       .driver = {
+               .name = "watchdog",
+       },
+       .probe = davinci_wdt_probe,
+       .remove = davinci_wdt_remove,
+};
+
+static int __init davinci_wdt_init(void)
+{
+       return platform_driver_register(&platform_wdt_driver);
+}
+
+static void __exit davinci_wdt_exit(void)
+{
+       return platform_driver_unregister(&platform_wdt_driver);
+}
+
+module_init(davinci_wdt_init);
+module_exit(davinci_wdt_exit);
+
+MODULE_AUTHOR("Texas Instruments");
+MODULE_DESCRIPTION("DaVinci Watchdog Driver");
+
+module_param(heartbeat, int, 0);
+MODULE_PARM_DESC(heartbeat,
+                "Watchdog heartbeat period in seconds from 1 to "
+                __MODULE_STRING(MAX_HEARTBEAT) ", default "
+                __MODULE_STRING(DEFAULT_HEARTBEAT));
+
+MODULE_LICENSE("GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
index eac4f9b9f007f0cb543ff54b62a35cb7626e713f..cd5a565bc3a0abd3beb585e1dce0b97b98a5a18e 100644 (file)
  *     82801HR  (ICH8R)     : document number 313056-002, 313057-004,
  *     82801HH  (ICH8DH)    : document number 313056-002, 313057-004,
  *     82801HO  (ICH8DO)    : document number 313056-002, 313057-004,
- *     6300ESB  (6300ESB)   : document number 300641-003
+ *     82801IB  (ICH9)      : document number 316972-001, 316973-001,
+ *     82801IR  (ICH9R)     : document number 316972-001, 316973-001,
+ *     82801IH  (ICH9DH)    : document number 316972-001, 316973-001,
+ *     6300ESB  (6300ESB)   : document number 300641-003, 300884-010,
+ *     631xESB  (631xESB)   : document number 313082-001, 313075-005,
+ *     632xESB  (632xESB)   : document number 313082-001, 313075-005
  */
 
 /*
@@ -48,8 +53,8 @@
 
 /* Module and version information */
 #define DRV_NAME        "iTCO_wdt"
-#define DRV_VERSION     "1.01"
-#define DRV_RELDATE     "21-Jan-2007"
+#define DRV_VERSION     "1.02"
+#define DRV_RELDATE     "26-Jul-2007"
 #define PFX            DRV_NAME ": "
 
 /* Includes */
@@ -92,6 +97,10 @@ enum iTCO_chipsets {
        TCO_ICH8,       /* ICH8 & ICH8R */
        TCO_ICH8DH,     /* ICH8DH */
        TCO_ICH8DO,     /* ICH8DO */
+       TCO_ICH9,       /* ICH9 */
+       TCO_ICH9R,      /* ICH9R */
+       TCO_ICH9DH,     /* ICH9DH */
+       TCO_631XESB,    /* 631xESB/632xESB */
 };
 
 static struct {
@@ -118,6 +127,10 @@ static struct {
        {"ICH8 or ICH8R", 2},
        {"ICH8DH", 2},
        {"ICH8DO", 2},
+       {"ICH9", 2},
+       {"ICH9R", 2},
+       {"ICH9DH", 2},
+       {"631xESB/632xESB", 2},
        {NULL,0}
 };
 
@@ -148,6 +161,25 @@ static struct pci_device_id iTCO_wdt_pci_tbl[] = {
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_0,      PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8    },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_2,      PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DH  },
        { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH8_3,      PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH8DO  },
+       { PCI_VENDOR_ID_INTEL, 0x2918,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9    },
+       { PCI_VENDOR_ID_INTEL, 0x2916,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9R    },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ICH9_2,      PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_ICH9DH    },
+       { PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_ESB2_0,      PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2671,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2672,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2673,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2674,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2675,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2676,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2677,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2678,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x2679,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x267a,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x267b,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x267c,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x267d,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x267e,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
+       { PCI_VENDOR_ID_INTEL, 0x267f,  PCI_ANY_ID, PCI_ANY_ID, 0, 0, TCO_631XESB },
        { 0, },                 /* End of list */
 };
 MODULE_DEVICE_TABLE (pci, iTCO_wdt_pci_tbl);
index a0d27160c80e1f1e540c3cda4c80a0786dd03b5c..6d35bb112a5fc6a2507680f10153dd992fe6688e 100644 (file)
@@ -321,6 +321,7 @@ static int zf_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
                break;
 
        case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
                return put_user(0, p);
 
        case WDIOC_KEEPALIVE:
index db2ccb864412f6ce24842c4db8bbf87e67560b11..1adf1d56027df58081b737201ddf860c420ce6fe 100644 (file)
@@ -215,6 +215,11 @@ static int mixcomwd_ioctl(struct inode *inode, struct file *file,
                                return -EFAULT;
                        }
                        break;
+               case WDIOC_GETBOOTSTATUS:
+                       if (copy_to_user(p, &status, sizeof(int))) {
+                               return -EFAULT;
+                       }
+                       break;
                case WDIOC_GETSUPPORT:
                        if (copy_to_user(argp, &ident, sizeof(ident))) {
                                return -EFAULT;
diff --git a/drivers/char/watchdog/mpc5200_wdt.c b/drivers/char/watchdog/mpc5200_wdt.c
new file mode 100644 (file)
index 0000000..564143d
--- /dev/null
@@ -0,0 +1,286 @@
+#include <linux/init.h>
+#include <linux/module.h>
+#include <linux/miscdevice.h>
+#include <linux/watchdog.h>
+#include <linux/io.h>
+#include <linux/spinlock.h>
+#include <asm/of_platform.h>
+#include <asm/uaccess.h>
+#include <asm/mpc52xx.h>
+
+
+#define GPT_MODE_WDT           (1<<15)
+#define GPT_MODE_CE            (1<<12)
+#define GPT_MODE_MS_TIMER      (0x4)
+
+
+struct mpc5200_wdt {
+       unsigned count; /* timer ticks before watchdog kicks in */
+       long ipb_freq;
+       struct miscdevice miscdev;
+       struct resource mem;
+       struct mpc52xx_gpt __iomem *regs;
+       spinlock_t io_lock;
+};
+
+/* is_active stores wether or not the /dev/watchdog device is opened */
+static unsigned long is_active;
+
+/* misc devices don't provide a way, to get back to 'dev' or 'miscdev' from
+ * file operations, which sucks. But there can be max 1 watchdog anyway, so...
+ */
+static struct mpc5200_wdt *wdt_global;
+
+
+/* helper to calculate timeout in timer counts */
+static void mpc5200_wdt_set_timeout(struct mpc5200_wdt *wdt, int timeout)
+{
+       /* use biggest prescaler of 64k */
+       wdt->count = (wdt->ipb_freq + 0xffff) / 0x10000 * timeout;
+
+       if (wdt->count > 0xffff)
+               wdt->count = 0xffff;
+}
+/* return timeout in seconds (calculated from timer count) */
+static int mpc5200_wdt_get_timeout(struct mpc5200_wdt *wdt)
+{
+       return wdt->count * 0x10000 / wdt->ipb_freq;
+}
+
+
+/* watchdog operations */
+static int mpc5200_wdt_start(struct mpc5200_wdt *wdt)
+{
+       spin_lock(&wdt->io_lock);
+       /* disable */
+       out_be32(&wdt->regs->mode, 0);
+       /* set timeout, with maximum prescaler */
+       out_be32(&wdt->regs->count, 0x0 | wdt->count);
+       /* enable watchdog */
+       out_be32(&wdt->regs->mode, GPT_MODE_CE | GPT_MODE_WDT | GPT_MODE_MS_TIMER);
+       spin_unlock(&wdt->io_lock);
+
+       return 0;
+}
+static int mpc5200_wdt_ping(struct mpc5200_wdt *wdt)
+{
+       spin_lock(&wdt->io_lock);
+       /* writing A5 to OCPW resets the watchdog */
+       out_be32(&wdt->regs->mode, 0xA5000000 | (0xffffff & in_be32(&wdt->regs->mode)));
+       spin_unlock(&wdt->io_lock);
+       return 0;
+}
+static int mpc5200_wdt_stop(struct mpc5200_wdt *wdt)
+{
+       spin_lock(&wdt->io_lock);
+       /* disable */
+       out_be32(&wdt->regs->mode, 0);
+       spin_unlock(&wdt->io_lock);
+       return 0;
+}
+
+
+/* file operations */
+static ssize_t mpc5200_wdt_write(struct file *file, const char *data,
+               size_t len, loff_t *ppos)
+{
+       struct mpc5200_wdt *wdt = file->private_data;
+       mpc5200_wdt_ping(wdt);
+       return 0;
+}
+static struct watchdog_info mpc5200_wdt_info = {
+       .options        = WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING,
+       .identity       = "mpc5200 watchdog on GPT0",
+};
+static int mpc5200_wdt_ioctl(struct inode *inode, struct file *file,
+               unsigned int cmd, unsigned long arg)
+{
+       struct mpc5200_wdt *wdt = file->private_data;
+       int __user *data = (int __user *)arg;
+       int timeout;
+       int ret = 0;
+
+       switch (cmd) {
+       case WDIOC_GETSUPPORT:
+               ret = copy_to_user(data, &mpc5200_wdt_info,
+                       sizeof(mpc5200_wdt_info));
+               if (ret)
+                       ret = -EFAULT;
+               break;
+
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               ret = put_user(0, data);
+               break;
+
+       case WDIOC_KEEPALIVE:
+               mpc5200_wdt_ping(wdt);
+               break;
+
+       case WDIOC_SETTIMEOUT:
+               ret = get_user(timeout, data);
+               if (ret)
+                       break;
+               mpc5200_wdt_set_timeout(wdt, timeout);
+               mpc5200_wdt_start(wdt);
+               /* fall through and return the timeout */
+
+       case WDIOC_GETTIMEOUT:
+               timeout = mpc5200_wdt_get_timeout(wdt);
+               ret = put_user(timeout, data);
+               break;
+
+       default:
+               ret = -ENOTTY;
+       }
+       return ret;
+}
+static int mpc5200_wdt_open(struct inode *inode, struct file *file)
+{
+       /* /dev/watchdog can only be opened once */
+       if (test_and_set_bit(0, &is_active))
+               return -EBUSY;
+
+       /* Set and activate the watchdog */
+       mpc5200_wdt_set_timeout(wdt_global, 30);
+       mpc5200_wdt_start(wdt_global);
+       file->private_data = wdt_global;
+       return nonseekable_open(inode, file);
+}
+static int mpc5200_wdt_release(struct inode *inode, struct file *file)
+{
+#if WATCHDOG_NOWAYOUT == 0
+       struct mpc5200_wdt *wdt = file->private_data;
+       mpc5200_wdt_stop(wdt);
+       wdt->count = 0;         /* == disabled */
+#endif
+       clear_bit(0, &is_active);
+       return 0;
+}
+
+static struct file_operations mpc5200_wdt_fops = {
+       .owner  = THIS_MODULE,
+       .write  = mpc5200_wdt_write,
+       .ioctl  = mpc5200_wdt_ioctl,
+       .open   = mpc5200_wdt_open,
+       .release = mpc5200_wdt_release,
+};
+
+/* module operations */
+static int mpc5200_wdt_probe(struct of_device *op, const struct of_device_id *match)
+{
+       struct mpc5200_wdt *wdt;
+       int err;
+       const void *has_wdt;
+       int size;
+
+       has_wdt = of_get_property(op->node, "has-wdt", NULL);
+       if (!has_wdt)
+               return -ENODEV;
+
+       wdt = kzalloc(sizeof(*wdt), GFP_KERNEL);
+       if (!wdt)
+               return -ENOMEM;
+
+       wdt->ipb_freq = mpc52xx_find_ipb_freq(op->node);
+
+       err = of_address_to_resource(op->node, 0, &wdt->mem);
+       if (err)
+               goto out_free;
+       size = wdt->mem.end - wdt->mem.start + 1;
+       if (!request_mem_region(wdt->mem.start, size, "mpc5200_wdt")) {
+               err = -ENODEV;
+               goto out_free;
+       }
+       wdt->regs = ioremap(wdt->mem.start, size);
+       if (!wdt->regs) {
+               err = -ENODEV;
+               goto out_release;
+       }
+
+       dev_set_drvdata(&op->dev, wdt);
+       spin_lock_init(&wdt->io_lock);
+
+       wdt->miscdev = (struct miscdevice) {
+               .minor  = WATCHDOG_MINOR,
+               .name   = "watchdog",
+               .fops   = &mpc5200_wdt_fops,
+               .parent = &op->dev,
+       };
+       wdt_global = wdt;
+       err = misc_register(&wdt->miscdev);
+       if (!err)
+               return 0;
+
+       iounmap(wdt->regs);
+ out_release:
+       release_mem_region(wdt->mem.start, size);
+ out_free:
+       kfree(wdt);
+       return err;
+}
+
+static int mpc5200_wdt_remove(struct of_device *op)
+{
+       struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev);
+
+       mpc5200_wdt_stop(wdt);
+       misc_deregister(&wdt->miscdev);
+       iounmap(wdt->regs);
+       release_mem_region(wdt->mem.start, wdt->mem.end - wdt->mem.start + 1);
+       kfree(wdt);
+
+       return 0;
+}
+static int mpc5200_wdt_suspend(struct of_device *op, pm_message_t state)
+{
+       struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev);
+       mpc5200_wdt_stop(wdt);
+       return 0;
+}
+static int mpc5200_wdt_resume(struct of_device *op)
+{
+       struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev);
+       if (wdt->count)
+               mpc5200_wdt_start(wdt);
+       return 0;
+}
+static int mpc5200_wdt_shutdown(struct of_device *op)
+{
+       struct mpc5200_wdt *wdt = dev_get_drvdata(&op->dev);
+       mpc5200_wdt_stop(wdt);
+       return 0;
+}
+
+static struct of_device_id mpc5200_wdt_match[] = {
+       { .compatible = "mpc5200-gpt", },
+       {},
+};
+static struct of_platform_driver mpc5200_wdt_driver = {
+       .owner          = THIS_MODULE,
+       .name           = "mpc5200-gpt-wdt",
+       .match_table    = mpc5200_wdt_match,
+       .probe          = mpc5200_wdt_probe,
+       .remove         = mpc5200_wdt_remove,
+       .suspend        = mpc5200_wdt_suspend,
+       .resume         = mpc5200_wdt_resume,
+       .shutdown       = mpc5200_wdt_shutdown,
+};
+
+
+static int __init mpc5200_wdt_init(void)
+{
+       return of_register_platform_driver(&mpc5200_wdt_driver);
+}
+
+static void __exit mpc5200_wdt_exit(void)
+{
+       of_unregister_platform_driver(&mpc5200_wdt_driver);
+}
+
+module_init(mpc5200_wdt_init);
+module_exit(mpc5200_wdt_exit);
+
+MODULE_AUTHOR("Domen Puncer <domen.puncer@telargo.com>");
+MODULE_LICENSE("Dual BSD/GPL");
+MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR);
index 18ca752e2f904f7425208c0fd2453ef0c55ebd99..a0bf95fb976374099a7b1e27c0d3979f73841f74 100644 (file)
@@ -119,6 +119,9 @@ static int mpc83xx_wdt_ioctl(struct inode *inode, struct file *file,
        switch (cmd) {
        case WDIOC_GETSUPPORT:
                return copy_to_user(argp, &ident, sizeof(ident)) ? -EFAULT : 0;
+       case WDIOC_GETSTATUS:
+       case WDIOC_GETBOOTSTATUS:
+               return put_user(0, p);
        case WDIOC_KEEPALIVE:
                mpc83xx_wdt_keepalive();
                return 0;
index 8aaed10dd4999e66928168cdb781df1fda97fad2..85b5734403a5dbc5c2d3e8c026100aea79825f60 100644 (file)
@@ -57,7 +57,7 @@ static int mpc8xx_wdt_open(struct inode *inode, struct file *file)
        m8xx_wdt_reset();
        mpc8xx_wdt_handler_disable();
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int mpc8xx_wdt_release(struct inode *inode, struct file *file)
index 419ab445c944d5fd9ffc1f64eff6d8891329e9e5..dcfd401a7ad725dc3d4a1febf7726482e1d56650 100644 (file)
@@ -143,6 +143,7 @@ static int mtx1_wdt_ioctl(struct inode *inode, struct file *file, unsigned int c
                        mtx1_wdt_reset();
                        break;
                case WDIOC_GETSTATUS:
+               case WDIOC_GETBOOTSTATUS:
                        if ( copy_to_user(argp, &value, sizeof(int)) )
                                return -EFAULT;
                        break;
index b887cdb0133428c07d4f08613b355527dad55b82..0365c317f7e1a960ea91c8e94cf8b24cd029ab69 100644 (file)
 #include <linux/watchdog.h>
 #include <linux/platform_device.h>
 
-#include <asm/mv64x60.h>
+#include <linux/mv643xx.h>
 #include <asm/uaccess.h>
 #include <asm/io.h>
 
-/* MV64x60 WDC (config) register access definitions */
-#define MV64x60_WDC_CTL1_MASK  (3 << 24)
-#define MV64x60_WDC_CTL1(val)  ((val & 3) << 24)
-#define MV64x60_WDC_CTL2_MASK  (3 << 26)
-#define MV64x60_WDC_CTL2(val)  ((val & 3) << 26)
+#define MV64x60_WDT_WDC_OFFSET 0
+
+/*
+ * The watchdog configuration register contains a pair of 2-bit fields,
+ *   1.  a reload field, bits 27-26, which triggers a reload of
+ *       the countdown register, and
+ *   2.  an enable field, bits 25-24, which toggles between
+ *       enabling and disabling the watchdog timer.
+ * Bit 31 is a read-only field which indicates whether the
+ * watchdog timer is currently enabled.
+ *
+ * The low 24 bits contain the timer reload value.
+ */
+#define MV64x60_WDC_ENABLE_SHIFT       24
+#define MV64x60_WDC_SERVICE_SHIFT      26
+#define MV64x60_WDC_ENABLED_SHIFT      31
+
+#define MV64x60_WDC_ENABLED_TRUE       1
+#define MV64x60_WDC_ENABLED_FALSE      0
 
 /* Flags bits */
 #define MV64x60_WDOG_FLAG_OPENED       0
-#define MV64x60_WDOG_FLAG_ENABLED      1
 
 static unsigned long wdt_flags;
 static int wdt_status;
-static void __iomem *mv64x60_regs;
+static void __iomem *mv64x60_wdt_regs;
 static int mv64x60_wdt_timeout;
+static int mv64x60_wdt_count;
+static unsigned int bus_clk;
+static char expect_close;
+static DEFINE_SPINLOCK(mv64x60_wdt_spinlock);
+
+static int nowayout = WATCHDOG_NOWAYOUT;
+module_param(nowayout, int, 0);
+MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started (default=" __MODULE_STRING(WATCHDOG_NOWAYOUT) ")");
 
-static void mv64x60_wdt_reg_write(u32 val)
+static int mv64x60_wdt_toggle_wdc(int enabled_predicate, int field_shift)
 {
-       /* Allow write only to CTL1 / CTL2 fields, retaining values in
-        * other fields.
-        */
-       u32 data = readl(mv64x60_regs + MV64x60_WDT_WDC);
-       data &= ~(MV64x60_WDC_CTL1_MASK | MV64x60_WDC_CTL2_MASK);
-       data |= val;
-       writel(data, mv64x60_regs + MV64x60_WDT_WDC);
+       u32 data;
+       u32 enabled;
+       int ret = 0;
+
+       spin_lock(&mv64x60_wdt_spinlock);
+       data = readl(mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
+       enabled = (data >> MV64x60_WDC_ENABLED_SHIFT) & 1;
+
+       /* only toggle the requested field if enabled state matches predicate */
+       if ((enabled ^ enabled_predicate) == 0) {
+               /* We write a 1, then a 2 -- to the appropriate field */
+               data = (1 << field_shift) | mv64x60_wdt_count;
+               writel(data, mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
+
+               data = (2 << field_shift) | mv64x60_wdt_count;
+               writel(data, mv64x60_wdt_regs + MV64x60_WDT_WDC_OFFSET);
+               ret = 1;
+       }
+       spin_unlock(&mv64x60_wdt_spinlock);
+
+       return ret;
 }
 
 static void mv64x60_wdt_service(void)
 {
-       /* Write 01 followed by 10 to CTL2 */
-       mv64x60_wdt_reg_write(MV64x60_WDC_CTL2(0x01));
-       mv64x60_wdt_reg_write(MV64x60_WDC_CTL2(0x02));
+       mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_TRUE,
+                              MV64x60_WDC_SERVICE_SHIFT);
+}
+
+static void mv64x60_wdt_handler_enable(void)
+{
+       if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_FALSE,
+                                  MV64x60_WDC_ENABLE_SHIFT)) {
+               mv64x60_wdt_service();
+               printk(KERN_NOTICE "mv64x60_wdt: watchdog activated\n");
+       }
 }
 
 static void mv64x60_wdt_handler_disable(void)
 {
-       if (test_and_clear_bit(MV64x60_WDOG_FLAG_ENABLED, &wdt_flags)) {
-               /* Write 01 followed by 10 to CTL1 */
-               mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x01));
-               mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x02));
+       if (mv64x60_wdt_toggle_wdc(MV64x60_WDC_ENABLED_TRUE,
+                                  MV64x60_WDC_ENABLE_SHIFT))
                printk(KERN_NOTICE "mv64x60_wdt: watchdog deactivated\n");
-       }
 }
 
-static void mv64x60_wdt_handler_enable(void)
+static void mv64x60_wdt_set_timeout(unsigned int timeout)
 {
-       if (!test_and_set_bit(MV64x60_WDOG_FLAG_ENABLED, &wdt_flags)) {
-               /* Write 01 followed by 10 to CTL1 */
-               mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x01));
-               mv64x60_wdt_reg_write(MV64x60_WDC_CTL1(0x02));
-               printk(KERN_NOTICE "mv64x60_wdt: watchdog activated\n");
-       }
+       /* maximum bus cycle count is 0xFFFFFFFF */
+       if (timeout > 0xFFFFFFFF / bus_clk)
+               timeout = 0xFFFFFFFF / bus_clk;
+
+       mv64x60_wdt_count = timeout * bus_clk >> 8;
+       mv64x60_wdt_timeout = timeout;
 }
 
 static int mv64x60_wdt_open(struct inode *inode, struct file *file)
@@ -85,21 +125,24 @@ static int mv64x60_wdt_open(struct inode *inode, struct file *file)
        if (test_and_set_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags))
                return -EBUSY;
 
-       mv64x60_wdt_service();
-       mv64x60_wdt_handler_enable();
+       if (nowayout)
+               __module_get(THIS_MODULE);
 
-       nonseekable_open(inode, file);
+       mv64x60_wdt_handler_enable();
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int mv64x60_wdt_release(struct inode *inode, struct file *file)
 {
-       mv64x60_wdt_service();
-
-#if !defined(CONFIG_WATCHDOG_NOWAYOUT)
-       mv64x60_wdt_handler_disable();
-#endif
+       if (expect_close == 42)
+               mv64x60_wdt_handler_disable();
+       else {
+               printk(KERN_CRIT
+                      "mv64x60_wdt: unexpected close, not stopping timer!\n");
+               mv64x60_wdt_service();
+       }
+       expect_close = 0;
 
        clear_bit(MV64x60_WDOG_FLAG_OPENED, &wdt_flags);
 
@@ -109,8 +152,22 @@ static int mv64x60_wdt_release(struct inode *inode, struct file *file)
 static ssize_t mv64x60_wdt_write(struct file *file, const char __user *data,
                                 size_t len, loff_t * ppos)
 {
-       if (len)
+       if (len) {
+               if (!nowayout) {
+                       size_t i;
+
+                       expect_close = 0;
+
+                       for (i = 0; i != len; i++) {
+                               char c;
+                               if(get_user(c, data + i))
+                                       return -EFAULT;
+                               if (c == 'V')
+                                       expect_close = 42;
+                       }
+               }
                mv64x60_wdt_service();
+       }
 
        return len;
 }
@@ -119,9 +176,12 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
                             unsigned int cmd, unsigned long arg)
 {
        int timeout;
+       int options;
        void __user *argp = (void __user *)arg;
        static struct watchdog_info info = {
-               .options = WDIOF_KEEPALIVEPING,
+               .options =      WDIOF_SETTIMEOUT        |
+                               WDIOF_MAGICCLOSE        |
+                               WDIOF_KEEPALIVEPING,
                .firmware_version = 0,
                .identity = "MV64x60 watchdog",
        };
@@ -143,7 +203,15 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
                return -EOPNOTSUPP;
 
        case WDIOC_SETOPTIONS:
-               return -EOPNOTSUPP;
+               if (get_user(options, (int __user *)argp))
+                       return -EFAULT;
+
+               if (options & WDIOS_DISABLECARD)
+                       mv64x60_wdt_handler_disable();
+
+               if (options & WDIOS_ENABLECARD)
+                       mv64x60_wdt_handler_enable();
+               break;
 
        case WDIOC_KEEPALIVE:
                mv64x60_wdt_service();
@@ -151,11 +219,13 @@ static int mv64x60_wdt_ioctl(struct inode *inode, struct file *file,
                break;
 
        case WDIOC_SETTIMEOUT:
-               return -EOPNOTSUPP;
+               if (get_user(timeout, (int __user *)argp))
+                       return -EFAULT;
+               mv64x60_wdt_set_timeout(timeout);
+               /* Fall through */
 
        case WDIOC_GETTIMEOUT:
-               timeout = mv64x60_wdt_timeout * HZ;
-               if (put_user(timeout, (int __user *)argp))
+               if (put_user(mv64x60_wdt_timeout, (int __user *)argp))
                        return -EFAULT;
                break;
 
@@ -184,18 +254,33 @@ static struct miscdevice mv64x60_wdt_miscdev = {
 static int __devinit mv64x60_wdt_probe(struct platform_device *dev)
 {
        struct mv64x60_wdt_pdata *pdata = dev->dev.platform_data;
-       int bus_clk = 133;
+       struct resource *r;
+       int timeout = 10;
 
-       mv64x60_wdt_timeout = 10;
+       bus_clk = 133;                  /* in MHz */
        if (pdata) {
-               mv64x60_wdt_timeout = pdata->timeout;
+               timeout = pdata->timeout;
                bus_clk = pdata->bus_clk;
        }
 
-       mv64x60_regs = mv64x60_get_bridge_vbase();
+       /* Since bus_clk is truncated MHz, actual frequency could be
+        * up to 1MHz higher.  Round up, since it's better to time out
+        * too late than too soon.
+        */
+       bus_clk++;
+       bus_clk *= 1000000;             /* convert to Hz */
+
+       r = platform_get_resource(dev, IORESOURCE_MEM, 0);
+       if (!r)
+               return -ENODEV;
 
-       writel((mv64x60_wdt_timeout * (bus_clk * 1000000)) >> 8,
-              mv64x60_regs + MV64x60_WDT_WDC);
+       mv64x60_wdt_regs = ioremap(r->start, r->end - r->start + 1);
+       if (mv64x60_wdt_regs == NULL)
+               return -ENOMEM;
+
+       mv64x60_wdt_set_timeout(timeout);
+
+       mv64x60_wdt_handler_disable();  /* in case timer was already running */
 
        return misc_register(&mv64x60_wdt_miscdev);
 }
@@ -204,9 +289,10 @@ static int __devexit mv64x60_wdt_remove(struct platform_device *dev)
 {
        misc_deregister(&mv64x60_wdt_miscdev);
 
-       mv64x60_wdt_service();
        mv64x60_wdt_handler_disable();
 
+       iounmap(mv64x60_wdt_regs);
+
        return 0;
 }
 
@@ -219,40 +305,16 @@ static struct platform_driver mv64x60_wdt_driver = {
        },
 };
 
-static struct platform_device *mv64x60_wdt_dev;
-
 static int __init mv64x60_wdt_init(void)
 {
-       int ret;
-
        printk(KERN_INFO "MV64x60 watchdog driver\n");
 
-       mv64x60_wdt_dev = platform_device_alloc(MV64x60_WDT_NAME, -1);
-       if (!mv64x60_wdt_dev) {
-               ret = -ENOMEM;
-               goto out;
-       }
-
-       ret = platform_device_add(mv64x60_wdt_dev);
-       if (ret) {
-               platform_device_put(mv64x60_wdt_dev);
-               goto out;
-       }
-
-       ret = platform_driver_register(&mv64x60_wdt_driver);
-       if (ret) {
-               platform_device_unregister(mv64x60_wdt_dev);
-               goto out;
-       }
-
- out:
-       return ret;
+       return platform_driver_register(&mv64x60_wdt_driver);
 }
 
 static void __exit mv64x60_wdt_exit(void)
 {
        platform_driver_unregister(&mv64x60_wdt_driver);
-       platform_device_unregister(mv64x60_wdt_dev);
 }
 
 module_init(mv64x60_wdt_init);
index b36fa8de2131813940aee9151c84729e16705a76..719b066f73c41cd8cbf655d7f2afa0c7ad81e774 100644 (file)
@@ -142,7 +142,7 @@ static int omap_wdt_open(struct inode *inode, struct file *file)
 
        omap_wdt_set_timeout();
        omap_wdt_enable();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int omap_wdt_release(struct inode *inode, struct file *file)
@@ -197,7 +197,7 @@ omap_wdt_ioctl(struct inode *inode, struct file *file,
 
        switch (cmd) {
        default:
-               return -ENOIOCTLCMD;
+               return -ENOTTY;
        case WDIOC_GETSUPPORT:
                return copy_to_user((struct watchdog_info __user *)arg, &ident,
                                sizeof(ident));
index 50430bced2f26c8ddf8b684327e5e02dcd058de3..5d1c15f83d233a9691e3409f9945a39a092c71ca 100644 (file)
 
 #include <asm/arch/map.h>
 
-#undef S3C24XX_VA_WATCHDOG
-#define S3C24XX_VA_WATCHDOG (0)
+#undef S3C_VA_WATCHDOG
+#define S3C_VA_WATCHDOG (0)
 
-#include <asm/arch/regs-watchdog.h>
+#include <asm/plat-s3c/regs-watchdog.h>
 
 #define PFX "s3c2410-wdt: "
 
index 33c1137f17d6d3e8be5cbbc3abb2bf3099721cc1..3475f47aaa45766cc48f3cf7361683ddfede5aee 100644 (file)
@@ -45,7 +45,6 @@ static int boot_status;
  */
 static int sa1100dog_open(struct inode *inode, struct file *file)
 {
-       nonseekable_open(inode, file);
        if (test_and_set_bit(1,&sa1100wdt_users))
                return -EBUSY;
 
@@ -54,7 +53,7 @@ static int sa1100dog_open(struct inode *inode, struct file *file)
        OSSR = OSSR_M3;
        OWER = OWER_WME;
        OIER |= OIER_E3;
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 /*
index b6282039198c6cdcef656098d31a4570125c721e..e4f3cb6090bc7d0db295bacfdc8dcf88a787f031 100644 (file)
@@ -191,8 +191,6 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
 
 static int fop_open(struct inode * inode, struct file * file)
 {
-       nonseekable_open(inode, file);
-
        /* Just in case we're already talking to someone... */
        if(test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
@@ -202,7 +200,7 @@ static int fop_open(struct inode * inode, struct file * file)
 
        /* Good, fire up the show */
        wdt_startup();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int fop_close(struct inode * inode, struct file * file)
index 2f7ba7a514fe08616e71fc85a7eebb04a7523510..9670d47190d0875a41a23b81d0dc568ab3e0cb4e 100644 (file)
@@ -150,8 +150,6 @@ static inline int sc1200wdt_status(void)
 
 static int sc1200wdt_open(struct inode *inode, struct file *file)
 {
-       nonseekable_open(inode, file);
-
        /* allow one at a time */
        if (down_trylock(&open_sem))
                return -EBUSY;
@@ -162,7 +160,7 @@ static int sc1200wdt_open(struct inode *inode, struct file *file)
        sc1200wdt_start();
        printk(KERN_INFO PFX "Watchdog enabled, timeout = %d min(s)", timeout);
 
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 
index 2676a43895a71f640c19f5120a0d8ff7f2523dbb..e8594c64d1e64fd9a07606ba75878007ab523578 100644 (file)
@@ -248,8 +248,6 @@ static ssize_t fop_write(struct file * file, const char __user * buf, size_t cou
 
 static int fop_open(struct inode * inode, struct file * file)
 {
-       nonseekable_open(inode, file);
-
        /* Just in case we're already talking to someone... */
        if(test_and_set_bit(0, &wdt_is_open))
                return -EBUSY;
@@ -258,7 +256,7 @@ static int fop_open(struct inode * inode, struct file * file)
 
        /* Good, fire up the show */
        wdt_startup();
-       return 0;
+       return nonseekable_open(inode, file);
 }
 
 static int fop_close(struct inode * inode, struct file * file)
index b46e7f47d70594f0410b8de7ece91df56eaf8ea2..df33b3b5a53c34540509c50b3734fef54795aa3d 100644 (file)
@@ -4,7 +4,7 @@
  *     (c) Copyright 2007 Vlad Drukker <vlad@storewiz.com>
  *             added support for W83627THF.
  *
- *     (c) Copyright 2003 Pádraig Brady <P@draigBrady.com>
+ *     (c) Copyright 2003,2007 Pádraig Brady <P@draigBrady.com>
  *
  *     Based on advantechwdt.c which is based on wdt.c.
  *     Original copyright messages:
@@ -42,7 +42,7 @@
 #include <asm/uaccess.h>
 #include <asm/system.h>
 
-#define WATCHDOG_NAME "w83627hf/thf WDT"
+#define WATCHDOG_NAME "w83627hf/thf/hg WDT"
 #define PFX WATCHDOG_NAME ": "
 #define WATCHDOG_TIMEOUT 60            /* 60 sec default timeout */
 
@@ -57,7 +57,7 @@ MODULE_PARM_DESC(wdt_io, "w83627hf/thf WDT io port (default 0x2E)");
 
 static int timeout = WATCHDOG_TIMEOUT; /* in seconds */
 module_param(timeout, int, 0);
-MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=63, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
+MODULE_PARM_DESC(timeout, "Watchdog timeout in seconds. 1<= timeout <=255, default=" __MODULE_STRING(WATCHDOG_TIMEOUT) ".");
 
 static int nowayout = WATCHDOG_NOWAYOUT;
 module_param(nowayout, int, 0);
@@ -78,9 +78,9 @@ w83627hf_select_wd_register(void)
        outb_p(0x87, WDT_EFER); /* Enter extended function mode */
        outb_p(0x87, WDT_EFER); /* Again according to manual */
 
-       outb(0x20, WDT_EFER);   /* check chip version   */
+       outb(0x20, WDT_EFER);   /* check chip version   */
        c = inb(WDT_EFDR);
-       if (c == 0x82) {        /* W83627THF            */
+       if (c == 0x82) {        /* W83627THF            */
                outb_p(0x2b, WDT_EFER); /* select GPIO3 */
                c = ((inb_p(WDT_EFDR) & 0xf7) | 0x04); /* select WDT0 */
                outb_p(0x2b, WDT_EFER);
@@ -114,11 +114,17 @@ w83627hf_init(void)
                printk (KERN_INFO PFX "Watchdog already running. Resetting timeout to %d sec\n", timeout);
                outb_p(timeout, WDT_EFDR);    /* Write back to CRF6 */
        }
+
        outb_p(0xF5, WDT_EFER); /* Select CRF5 */
        t=inb_p(WDT_EFDR);      /* read CRF5 */
        t&=~0x0C;               /* set second mode & disable keyboard turning off watchdog */
        outb_p(t, WDT_EFDR);    /* Write back to CRF5 */
 
+       outb_p(0xF7, WDT_EFER); /* Select CRF7 */
+       t=inb_p(WDT_EFDR);      /* read CRF7 */
+       t&=~0xC0;               /* disable keyboard & mouse turning off watchdog */
+       outb_p(t, WDT_EFDR);    /* Write back to CRF7 */
+
        w83627hf_unselect_wd_register();
 }
 
@@ -126,7 +132,7 @@ static void
 wdt_ctrl(int timeout)
 {
        spin_lock(&io_lock);
-       
+
        w83627hf_select_wd_register();
 
        outb_p(0xF6, WDT_EFER);    /* Select CRF6 */
@@ -154,7 +160,7 @@ wdt_disable(void)
 static int
 wdt_set_heartbeat(int t)
 {
-       if ((t < 1) || (t > 63))
+       if ((t < 1) || (t > 255))
                return -EINVAL;
 
        timeout = t;
@@ -324,11 +330,11 @@ wdt_init(void)
 
        spin_lock_init(&io_lock);
 
-       printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF Super I/O chip initialising.\n");
+       printk(KERN_INFO "WDT driver for the Winbond(TM) W83627HF/THF/HG Super I/O chip initialising.\n");
 
        if (wdt_set_heartbeat(timeout)) {
                wdt_set_heartbeat(WATCHDOG_TIMEOUT);
-               printk (KERN_INFO PFX "timeout value must be 1<=timeout<=63, using %d\n",
+               printk (KERN_INFO PFX "timeout value must be 1<=timeout<=255, using %d\n",
                        WATCHDOG_TIMEOUT);
        }
 
index d637555a833b78870f2f19da130d54d93e0d2f96..e763d723e4cfa6fe7889e4d07f1db948bed317ca 100644 (file)
@@ -143,29 +143,6 @@ void dma_unpin_iovec_pages(struct dma_pinned_list *pinned_list)
        kfree(pinned_list);
 }
 
-static dma_cookie_t dma_memcpy_to_kernel_iovec(struct dma_chan *chan, struct
-       iovec *iov, unsigned char *kdata, size_t len)
-{
-       dma_cookie_t dma_cookie = 0;
-
-       while (len > 0) {
-               if (iov->iov_len) {
-                       int copy = min_t(unsigned int, iov->iov_len, len);
-                       dma_cookie = dma_async_memcpy_buf_to_buf(
-                                       chan,
-                                       iov->iov_base,
-                                       kdata,
-                                       copy);
-                       kdata += copy;
-                       len -= copy;
-                       iov->iov_len -= copy;
-                       iov->iov_base += copy;
-               }
-               iov++;
-       }
-
-       return dma_cookie;
-}
 
 /*
  * We have already pinned down the pages we will be using in the iovecs.
@@ -187,10 +164,6 @@ dma_cookie_t dma_memcpy_to_iovec(struct dma_chan *chan, struct iovec *iov,
        if (!chan)
                return memcpy_toiovec(iov, kdata, len);
 
-       /* -> kernel copies (e.g. smbfs) */
-       if (!pinned_list)
-               return dma_memcpy_to_kernel_iovec(chan, iov, kdata, len);
-
        iovec_idx = 0;
        while (iovec_idx < pinned_list->nr_iovecs) {
                struct dma_page_list *page_list;
index 1724c41d2414d8834e1f238df38e51977becebbd..98b6b4fb42577615447648d0cdbb3a3a7a33ca98 100644 (file)
@@ -8,7 +8,7 @@ menuconfig EDAC
        bool "EDAC - error detection and reporting (EXPERIMENTAL)"
        depends on HAS_IOMEM
        depends on EXPERIMENTAL
-       depends on X86 || MIPS || PPC
+       depends on X86 || PPC
        help
          EDAC is designed to report errors in the core system.
          These are low-level errors that are reported in the CPU or
@@ -126,7 +126,7 @@ config EDAC_I5000
 config EDAC_PASEMI
        tristate "PA Semi PWRficient"
        depends on EDAC_MM_EDAC && PCI
-       depends on PPC
+       depends on PPC_PASEMI
        help
          Support for error detection and correction on PA Semi
          PWRficient.
index 4471be3625995e59a8264ca91a3c6737e163e604..063a1bffe38b026ba7005ee0b105a4e956baf6e9 100644 (file)
@@ -214,6 +214,13 @@ void edac_mc_free(struct mem_ctl_info *mci)
 }
 EXPORT_SYMBOL_GPL(edac_mc_free);
 
+
+/*
+ * find_mci_by_dev
+ *
+ *     scan list of controllers looking for the one that manages
+ *     the 'dev' device
+ */
 static struct mem_ctl_info *find_mci_by_dev(struct device *dev)
 {
        struct mem_ctl_info *mci;
@@ -268,12 +275,6 @@ static void edac_mc_workq_function(struct work_struct *work_req)
        if (edac_mc_assert_error_check_and_clear() && (mci->edac_check != NULL))
                mci->edac_check(mci);
 
-       /*
-        * FIXME: temp place holder for PCI checks,
-        * goes away when we break out PCI
-        */
-       edac_pci_do_parity_check();
-
        mutex_unlock(&mem_ctls_mutex);
 
        /* Reschedule */
@@ -314,36 +315,55 @@ static void edac_mc_workq_teardown(struct mem_ctl_info *mci)
 {
        int status;
 
-       /* if not running POLL, leave now */
-       if (mci->op_state == OP_RUNNING_POLL) {
-               status = cancel_delayed_work(&mci->work);
-               if (status == 0) {
-                       debugf0("%s() not canceled, flush the queue\n",
-                               __func__);
+       status = cancel_delayed_work(&mci->work);
+       if (status == 0) {
+               debugf0("%s() not canceled, flush the queue\n",
+                       __func__);
 
-                       /* workq instance might be running, wait for it */
-                       flush_workqueue(edac_workqueue);
-               }
+               /* workq instance might be running, wait for it */
+               flush_workqueue(edac_workqueue);
        }
 }
 
 /*
- * edac_reset_delay_period
+ * edac_mc_reset_delay_period(unsigned long value)
+ *
+ *     user space has updated our poll period value, need to
+ *     reset our workq delays
  */
-static void edac_reset_delay_period(struct mem_ctl_info *mci, unsigned long value)
+void edac_mc_reset_delay_period(int value)
 {
-       /* cancel the current workq request */
-       edac_mc_workq_teardown(mci);
+       struct mem_ctl_info *mci;
+       struct list_head *item;
 
-       /* lock the list of devices for the new setup */
        mutex_lock(&mem_ctls_mutex);
 
-       /* restart the workq request, with new delay value */
-       edac_mc_workq_setup(mci, value);
+       /* scan the list and turn off all workq timers, doing so under lock
+        */
+       list_for_each(item, &mc_devices) {
+               mci = list_entry(item, struct mem_ctl_info, link);
+
+               if (mci->op_state == OP_RUNNING_POLL)
+                       cancel_delayed_work(&mci->work);
+       }
+
+       mutex_unlock(&mem_ctls_mutex);
+
+
+       /* re-walk the list, and reset the poll delay */
+       mutex_lock(&mem_ctls_mutex);
+
+       list_for_each(item, &mc_devices) {
+               mci = list_entry(item, struct mem_ctl_info, link);
+
+               edac_mc_workq_setup(mci, (unsigned long) value);
+       }
 
        mutex_unlock(&mem_ctls_mutex);
 }
 
+
+
 /* Return 0 on success, 1 on failure.
  * Before calling this function, caller must
  * assign a unique value to mci->mc_idx.
index cd090b0677a78b2606f09aa2e694357003f42a2c..4a0576bd06fc93bab9b2028b695ff7907a13f9c4 100644 (file)
@@ -122,6 +122,23 @@ static ssize_t memctrl_int_store(void *ptr, const char *buffer, size_t count)
        return count;
 }
 
+/*
+ * mc poll_msec time value
+ */
+static ssize_t poll_msec_int_store(void *ptr, const char *buffer, size_t count)
+{
+       int *value = (int *)ptr;
+
+       if (isdigit(*buffer)) {
+               *value = simple_strtoul(buffer, NULL, 0);
+
+               /* notify edac_mc engine to reset the poll period */
+               edac_mc_reset_delay_period(*value);
+       }
+
+       return count;
+}
+
 
 /* EDAC sysfs CSROW data structures and methods
  */
@@ -704,7 +721,7 @@ MEMCTRL_ATTR(edac_mc_log_ce,
        S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store);
 
 MEMCTRL_ATTR(edac_mc_poll_msec,
-       S_IRUGO | S_IWUSR, memctrl_int_show, memctrl_int_store);
+       S_IRUGO | S_IWUSR, memctrl_int_show, poll_msec_int_store);
 
 /* Base Attributes of the memory ECC object */
 static struct memctrl_dev_attribute *memctrl_attr[] = {
index a2134dfc3cc691783122cddec1a9906d982b00ef..cbc419c8ebc1b8373c3c5661ce9a449cb3517107 100644 (file)
@@ -52,6 +52,8 @@ extern void edac_device_workq_setup(struct edac_device_ctl_info *edac_dev,
 extern void edac_device_workq_teardown(struct edac_device_ctl_info *edac_dev);
 extern void edac_device_reset_delay_period(struct edac_device_ctl_info
                                           *edac_dev, unsigned long value);
+extern void edac_mc_reset_delay_period(int value);
+
 extern void *edac_align_ptr(void *ptr, unsigned size);
 
 /*
@@ -64,6 +66,10 @@ extern int edac_sysfs_pci_setup(void);
 extern void edac_sysfs_pci_teardown(void);
 extern int edac_pci_get_check_errors(void);
 extern int edac_pci_get_poll_msec(void);
+extern void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci);
+extern void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg);
+extern void edac_pci_handle_npe(struct edac_pci_ctl_info *pci,
+                               const char *msg);
 #else                          /* CONFIG_PCI */
 /* pre-process these away */
 #define edac_pci_do_parity_check()
@@ -72,6 +78,8 @@ extern int edac_pci_get_poll_msec(void);
 #define edac_sysfs_pci_teardown()
 #define edac_pci_get_check_errors()
 #define edac_pci_get_poll_msec()
+#define edac_pci_handle_pe()
+#define edac_pci_handle_npe()
 #endif                         /* CONFIG_PCI */
 
 #endif                         /* __EDAC_MODULE_H__ */
index d9cd5e048cee92b520413bef79592e62b6521a73..5dee9f50414bee396fde63895efa6ddcf7f0841c 100644 (file)
 static DEFINE_MUTEX(edac_pci_ctls_mutex);
 static struct list_head edac_pci_list = LIST_HEAD_INIT(edac_pci_list);
 
-static inline void edac_lock_pci_list(void)
-{
-       mutex_lock(&edac_pci_ctls_mutex);
-}
-
-static inline void edac_unlock_pci_list(void)
-{
-       mutex_unlock(&edac_pci_ctls_mutex);
-}
-
 /*
- * The alloc() and free() functions for the 'edac_pci' control info
- * structure. The chip driver will allocate one of these for each
- * edac_pci it is going to control/register with the EDAC CORE.
+ * edac_pci_alloc_ctl_info
+ *
+ *     The alloc() function for the 'edac_pci' control info
+ *     structure. The chip driver will allocate one of these for each
+ *     edac_pci it is going to control/register with the EDAC CORE.
  */
 struct edac_pci_ctl_info *edac_pci_alloc_ctl_info(unsigned int sz_pvt,
                                                const char *edac_pci_name)
@@ -53,47 +45,59 @@ struct edac_pci_ctl_info *edac_pci_alloc_ctl_info(unsigned int sz_pvt,
        void *pvt;
        unsigned int size;
 
+       debugf1("%s()\n", __func__);
+
        pci = (struct edac_pci_ctl_info *)0;
        pvt = edac_align_ptr(&pci[1], sz_pvt);
        size = ((unsigned long)pvt) + sz_pvt;
 
-       if ((pci = kzalloc(size, GFP_KERNEL)) == NULL)
+       /* Alloc the needed control struct memory */
+       pci = kzalloc(size, GFP_KERNEL);
+       if (pci  == NULL)
                return NULL;
 
+       /* Now much private space */
        pvt = sz_pvt ? ((char *)pci) + ((unsigned long)pvt) : NULL;
 
        pci->pvt_info = pvt;
-
        pci->op_state = OP_ALLOC;
 
        snprintf(pci->name, strlen(edac_pci_name) + 1, "%s", edac_pci_name);
 
        return pci;
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_alloc_ctl_info);
 
 /*
  * edac_pci_free_ctl_info()
- *     frees the memory allocated by edac_pci_alloc_ctl_info() function
+ *
+ *     Last action on the pci control structure.
+ *
+ *     call the remove sysfs informaton, which will unregister
+ *     this control struct's kobj. When that kobj's ref count
+ *     goes to zero, its release function will be call and then
+ *     kfree() the memory.
  */
 void edac_pci_free_ctl_info(struct edac_pci_ctl_info *pci)
 {
-       kfree(pci);
-}
+       debugf1("%s()\n", __func__);
 
+       edac_pci_remove_sysfs(pci);
+}
 EXPORT_SYMBOL_GPL(edac_pci_free_ctl_info);
 
 /*
  * find_edac_pci_by_dev()
  *     scans the edac_pci list for a specific 'struct device *'
+ *
+ *     return NULL if not found, or return control struct pointer
  */
 static struct edac_pci_ctl_info *find_edac_pci_by_dev(struct device *dev)
 {
        struct edac_pci_ctl_info *pci;
        struct list_head *item;
 
-       debugf3("%s()\n", __func__);
+       debugf1("%s()\n", __func__);
 
        list_for_each(item, &edac_pci_list) {
                pci = list_entry(item, struct edac_pci_ctl_info, link);
@@ -118,10 +122,13 @@ static int add_edac_pci_to_global_list(struct edac_pci_ctl_info *pci)
        struct list_head *item, *insert_before;
        struct edac_pci_ctl_info *rover;
 
+       debugf1("%s()\n", __func__);
+
        insert_before = &edac_pci_list;
 
        /* Determine if already on the list */
-       if (unlikely((rover = find_edac_pci_by_dev(pci->dev)) != NULL))
+       rover = find_edac_pci_by_dev(pci->dev);
+       if (unlikely(rover != NULL))
                goto fail0;
 
        /* Insert in ascending order by 'pci_idx', so find position */
@@ -157,6 +164,8 @@ fail1:
 
 /*
  * complete_edac_pci_list_del
+ *
+ *     RCU completion callback to indicate item is deleted
  */
 static void complete_edac_pci_list_del(struct rcu_head *head)
 {
@@ -169,6 +178,8 @@ static void complete_edac_pci_list_del(struct rcu_head *head)
 
 /*
  * del_edac_pci_from_global_list
+ *
+ *     remove the PCI control struct from the global list
  */
 static void del_edac_pci_from_global_list(struct edac_pci_ctl_info *pci)
 {
@@ -207,35 +218,52 @@ struct edac_pci_ctl_info *edac_pci_find(int idx)
 
        return NULL;
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_find);
 
 /*
  * edac_pci_workq_function()
- *     performs the operation scheduled by a workq request
+ *
+ *     periodic function that performs the operation
+ *     scheduled by a workq request, for a given PCI control struct
  */
 static void edac_pci_workq_function(struct work_struct *work_req)
 {
        struct delayed_work *d_work = (struct delayed_work *)work_req;
        struct edac_pci_ctl_info *pci = to_edac_pci_ctl_work(d_work);
+       int msec;
+       unsigned long delay;
 
-       edac_lock_pci_list();
+       debugf3("%s() checking\n", __func__);
 
-       if ((pci->op_state == OP_RUNNING_POLL) &&
-               (pci->edac_check != NULL) && (edac_pci_get_check_errors()))
-               pci->edac_check(pci);
+       mutex_lock(&edac_pci_ctls_mutex);
 
-       edac_unlock_pci_list();
+       if (pci->op_state == OP_RUNNING_POLL) {
+               /* we might be in POLL mode, but there may NOT be a poll func
+                */
+               if ((pci->edac_check != NULL) && edac_pci_get_check_errors())
+                       pci->edac_check(pci);
+
+               /* if we are on a one second period, then use round */
+               msec = edac_pci_get_poll_msec();
+               if (msec == 1000)
+                       delay = round_jiffies(msecs_to_jiffies(msec));
+               else
+                       delay = msecs_to_jiffies(msec);
+
+               /* Reschedule only if we are in POLL mode */
+               queue_delayed_work(edac_workqueue, &pci->work, delay);
+       }
 
-       /* Reschedule */
-       queue_delayed_work(edac_workqueue, &pci->work,
-                       msecs_to_jiffies(edac_pci_get_poll_msec()));
+       mutex_unlock(&edac_pci_ctls_mutex);
 }
 
 /*
  * edac_pci_workq_setup()
  *     initialize a workq item for this edac_pci instance
  *     passing in the new delay period in msec
+ *
+ *     locking model:
+ *             called when 'edac_pci_ctls_mutex' is locked
  */
 static void edac_pci_workq_setup(struct edac_pci_ctl_info *pci,
                                 unsigned int msec)
@@ -255,6 +283,8 @@ static void edac_pci_workq_teardown(struct edac_pci_ctl_info *pci)
 {
        int status;
 
+       debugf0("%s()\n", __func__);
+
        status = cancel_delayed_work(&pci->work);
        if (status == 0)
                flush_workqueue(edac_workqueue);
@@ -262,19 +292,25 @@ static void edac_pci_workq_teardown(struct edac_pci_ctl_info *pci)
 
 /*
  * edac_pci_reset_delay_period
+ *
+ *     called with a new period value for the workq period
+ *     a) stop current workq timer
+ *     b) restart workq timer with new value
  */
 void edac_pci_reset_delay_period(struct edac_pci_ctl_info *pci,
                                 unsigned long value)
 {
-       edac_lock_pci_list();
+       debugf0("%s()\n", __func__);
 
        edac_pci_workq_teardown(pci);
 
+       /* need to lock for the setup */
+       mutex_lock(&edac_pci_ctls_mutex);
+
        edac_pci_workq_setup(pci, value);
 
-       edac_unlock_pci_list();
+       mutex_unlock(&edac_pci_ctls_mutex);
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_reset_delay_period);
 
 /*
@@ -294,14 +330,13 @@ int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx)
        debugf0("%s()\n", __func__);
 
        pci->pci_idx = edac_idx;
+       pci->start_time = jiffies;
 
-       edac_lock_pci_list();
+       mutex_lock(&edac_pci_ctls_mutex);
 
        if (add_edac_pci_to_global_list(pci))
                goto fail0;
 
-       pci->start_time = jiffies;
-
        if (edac_pci_create_sysfs(pci)) {
                edac_pci_printk(pci, KERN_WARNING,
                                "failed to create sysfs pci\n");
@@ -323,16 +358,16 @@ int edac_pci_add_device(struct edac_pci_ctl_info *pci, int edac_idx)
                        pci->ctl_name,
                        dev_name(pci), edac_op_state_to_string(pci->op_state));
 
-       edac_unlock_pci_list();
+       mutex_unlock(&edac_pci_ctls_mutex);
        return 0;
 
+       /* error unwind stack */
 fail1:
        del_edac_pci_from_global_list(pci);
 fail0:
-       edac_unlock_pci_list();
+       mutex_unlock(&edac_pci_ctls_mutex);
        return 1;
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_add_device);
 
 /*
@@ -354,22 +389,25 @@ struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev)
 
        debugf0("%s()\n", __func__);
 
-       edac_lock_pci_list();
+       mutex_lock(&edac_pci_ctls_mutex);
 
-       if ((pci = find_edac_pci_by_dev(dev)) == NULL) {
-               edac_unlock_pci_list();
+       /* ensure the control struct is on the global list
+        * if not, then leave
+        */
+       pci = find_edac_pci_by_dev(dev);
+       if (pci  == NULL) {
+               mutex_unlock(&edac_pci_ctls_mutex);
                return NULL;
        }
 
        pci->op_state = OP_OFFLINE;
 
-       edac_pci_workq_teardown(pci);
-
-       edac_pci_remove_sysfs(pci);
-
        del_edac_pci_from_global_list(pci);
 
-       edac_unlock_pci_list();
+       mutex_unlock(&edac_pci_ctls_mutex);
+
+       /* stop the workq timer */
+       edac_pci_workq_teardown(pci);
 
        edac_printk(KERN_INFO, EDAC_PCI,
                "Removed device %d for %s %s: DEV %s\n",
@@ -377,14 +415,20 @@ struct edac_pci_ctl_info *edac_pci_del_device(struct device *dev)
 
        return pci;
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_del_device);
 
+/*
+ * edac_pci_generic_check
+ *
+ *     a Generic parity check API
+ */
 void edac_pci_generic_check(struct edac_pci_ctl_info *pci)
 {
+       debugf4("%s()\n", __func__);
        edac_pci_do_parity_check();
 }
 
+/* free running instance index counter */
 static int edac_pci_idx;
 #define EDAC_PCI_GENCTL_NAME   "EDAC PCI controller"
 
@@ -392,6 +436,17 @@ struct edac_pci_gen_data {
        int edac_idx;
 };
 
+/*
+ * edac_pci_create_generic_ctl
+ *
+ *     A generic constructor for a PCI parity polling device
+ *     Some systems have more than one domain of PCI busses.
+ *     For systems with one domain, then this API will
+ *     provide for a generic poller.
+ *
+ *     This routine calls the edac_pci_alloc_ctl_info() for
+ *     the generic device, with default values
+ */
 struct edac_pci_ctl_info *edac_pci_create_generic_ctl(struct device *dev,
                                                const char *mod_name)
 {
@@ -421,13 +476,18 @@ struct edac_pci_ctl_info *edac_pci_create_generic_ctl(struct device *dev,
 
        return pci;
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_create_generic_ctl);
 
+/*
+ * edac_pci_release_generic_ctl
+ *
+ *     The release function of a generic EDAC PCI polling device
+ */
 void edac_pci_release_generic_ctl(struct edac_pci_ctl_info *pci)
 {
+       debugf0("%s() pci mod=%s\n", __func__, pci->mod_name);
+
        edac_pci_del_device(pci->dev);
        edac_pci_free_ctl_info(pci);
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_release_generic_ctl);
index fac94cae2c3d5cb126707c3435a5822c9e3cec03..69f5dddabddfcfcb0294e374c42bf70c3104c89f 100644 (file)
 #include "edac_core.h"
 #include "edac_module.h"
 
+/* Turn off this whole feature if PCI is not configured */
 #ifdef CONFIG_PCI
 
 #define EDAC_PCI_SYMLINK       "device"
 
-static int check_pci_errors;   /* default YES check PCI parity */
-static int edac_pci_panic_on_pe;       /* default no panic on PCI Parity */
-static int edac_pci_log_pe = 1;        /* log PCI parity errors */
+/* data variables exported via sysfs */
+static int check_pci_errors;           /* default NO check PCI parity */
+static int edac_pci_panic_on_pe;       /* default NO panic on PCI Parity */
+static int edac_pci_log_pe = 1;                /* log PCI parity errors */
 static int edac_pci_log_npe = 1;       /* log PCI non-parity error errors */
+static int edac_pci_poll_msec = 1000;  /* one second workq period */
+
 static atomic_t pci_parity_count = ATOMIC_INIT(0);
 static atomic_t pci_nonparity_count = ATOMIC_INIT(0);
-static int edac_pci_poll_msec = 1000;
 
-static struct kobject edac_pci_kobj;   /* /sys/devices/system/edac/pci */
-static struct completion edac_pci_kobj_complete;
+static struct kobject edac_pci_top_main_kobj;
 static atomic_t edac_pci_sysfs_refcount = ATOMIC_INIT(0);
 
+/* getter functions for the data variables */
 int edac_pci_get_check_errors(void)
 {
        return check_pci_errors;
@@ -74,17 +77,22 @@ static void edac_pci_instance_release(struct kobject *kobj)
 {
        struct edac_pci_ctl_info *pci;
 
-       debugf1("%s()\n", __func__);
+       debugf0("%s()\n", __func__);
 
+       /* Form pointer to containing struct, the pci control struct */
        pci = to_instance(kobj);
-       complete(&pci->kobj_complete);
+
+       /* decrement reference count on top main kobj */
+       kobject_put(&edac_pci_top_main_kobj);
+
+       kfree(pci);     /* Free the control struct */
 }
 
 /* instance specific attribute structure */
 struct instance_attribute {
        struct attribute attr;
-        ssize_t(*show) (struct edac_pci_ctl_info *, char *);
-        ssize_t(*store) (struct edac_pci_ctl_info *, const char *, size_t);
+       ssize_t(*show) (struct edac_pci_ctl_info *, char *);
+       ssize_t(*store) (struct edac_pci_ctl_info *, const char *, size_t);
 };
 
 /* Function to 'show' fields from the edac_pci 'instance' structure */
@@ -112,6 +120,7 @@ static ssize_t edac_pci_instance_store(struct kobject *kobj,
        return -EIO;
 }
 
+/* fs_ops table */
 static struct sysfs_ops pci_instance_ops = {
        .show = edac_pci_instance_show,
        .store = edac_pci_instance_store
@@ -134,48 +143,82 @@ static struct instance_attribute *pci_instance_attr[] = {
        NULL
 };
 
-/* the ktype for pci instance */
+/* the ktype for pci instance */
 static struct kobj_type ktype_pci_instance = {
        .release = edac_pci_instance_release,
        .sysfs_ops = &pci_instance_ops,
        .default_attrs = (struct attribute **)pci_instance_attr,
 };
 
+/*
+ * edac_pci_create_instance_kobj
+ *
+ *     construct one EDAC PCI instance's kobject for use
+ */
 static int edac_pci_create_instance_kobj(struct edac_pci_ctl_info *pci, int idx)
 {
+       struct kobject *main_kobj;
        int err;
 
-       pci->kobj.parent = &edac_pci_kobj;
+       debugf0("%s()\n", __func__);
+
+       /* Set the parent and the instance's ktype */
+       pci->kobj.parent = &edac_pci_top_main_kobj;
        pci->kobj.ktype = &ktype_pci_instance;
 
        err = kobject_set_name(&pci->kobj, "pci%d", idx);
        if (err)
                return err;
 
+       /* First bump the ref count on the top main kobj, which will
+        * track the number of PCI instances we have, and thus nest
+        * properly on keeping the module loaded
+        */
+       main_kobj = kobject_get(&edac_pci_top_main_kobj);
+       if (!main_kobj) {
+               err = -ENODEV;
+               goto error_out;
+       }
+
+       /* And now register this new kobject under the main kobj */
        err = kobject_register(&pci->kobj);
        if (err != 0) {
                debugf2("%s() failed to register instance pci%d\n",
                        __func__, idx);
-               return err;
+               kobject_put(&edac_pci_top_main_kobj);
+               goto error_out;
        }
 
        debugf1("%s() Register instance 'pci%d' kobject\n", __func__, idx);
 
        return 0;
+
+       /* Error unwind statck */
+error_out:
+       return err;
 }
 
-static void
-edac_pci_delete_instance_kobj(struct edac_pci_ctl_info *pci, int idx)
+/*
+ * edac_pci_unregister_sysfs_instance_kobj
+ *
+ *     unregister the kobj for the EDAC PCI instance
+ */
+void edac_pci_unregister_sysfs_instance_kobj(struct edac_pci_ctl_info *pci)
 {
-       init_completion(&pci->kobj_complete);
+       debugf0("%s()\n", __func__);
+
+       /* Unregister the instance kobject and allow its release
+        * function release the main reference count and then
+        * kfree the memory
+        */
        kobject_unregister(&pci->kobj);
-       wait_for_completion(&pci->kobj_complete);
 }
 
 /***************************** EDAC PCI sysfs root **********************/
 #define to_edacpci(k) container_of(k, struct edac_pci_ctl_info, kobj)
 #define to_edacpci_attr(a) container_of(a, struct edac_pci_attr, attr)
 
+/* simple show/store functions for attributes */
 static ssize_t edac_pci_int_show(void *ptr, char *buffer)
 {
        int *value = ptr;
@@ -267,118 +310,189 @@ static struct edac_pci_dev_attribute *edac_pci_attr[] = {
        NULL,
 };
 
-/* No memory to release */
-static void edac_pci_release(struct kobject *kobj)
+/*
+ * edac_pci_release_main_kobj
+ *
+ *     This release function is called when the reference count to the
+ *     passed kobj goes to zero.
+ *
+ *     This kobj is the 'main' kobject that EDAC PCI instances
+ *     link to, and thus provide for proper nesting counts
+ */
+static void edac_pci_release_main_kobj(struct kobject *kobj)
 {
-       struct edac_pci_ctl_info *pci;
 
-       pci = to_edacpci(kobj);
+       debugf0("%s() here to module_put(THIS_MODULE)\n", __func__);
 
-       debugf1("%s()\n", __func__);
-       complete(&pci->kobj_complete);
+       /* last reference to top EDAC PCI kobject has been removed,
+        * NOW release our ref count on the core module
+        */
+       module_put(THIS_MODULE);
 }
 
-static struct kobj_type ktype_edac_pci = {
-       .release = edac_pci_release,
+/* ktype struct for the EDAC PCI main kobj */
+static struct kobj_type ktype_edac_pci_main_kobj = {
+       .release = edac_pci_release_main_kobj,
        .sysfs_ops = &edac_pci_sysfs_ops,
        .default_attrs = (struct attribute **)edac_pci_attr,
 };
 
 /**
- * edac_sysfs_pci_setup()
+ * edac_pci_main_kobj_setup()
  *
  *     setup the sysfs for EDAC PCI attributes
  *     assumes edac_class has already been initialized
  */
-int edac_pci_register_main_kobj(void)
+int edac_pci_main_kobj_setup(void)
 {
        int err;
        struct sysdev_class *edac_class;
 
-       debugf1("%s()\n", __func__);
+       debugf0("%s()\n", __func__);
+
+       /* check and count if we have already created the main kobject */
+       if (atomic_inc_return(&edac_pci_sysfs_refcount) != 1)
+               return 0;
 
+       /* First time, so create the main kobject and its
+        * controls and atributes
+        */
        edac_class = edac_get_edac_class();
        if (edac_class == NULL) {
                debugf1("%s() no edac_class\n", __func__);
-               return -ENODEV;
+               err = -ENODEV;
+               goto decrement_count_fail;
        }
 
-       edac_pci_kobj.ktype = &ktype_edac_pci;
+       /* Need the kobject hook ups, and name setting */
+       edac_pci_top_main_kobj.ktype = &ktype_edac_pci_main_kobj;
+       edac_pci_top_main_kobj.parent = &edac_class->kset.kobj;
 
-       edac_pci_kobj.parent = &edac_class->kset.kobj;
-
-       err = kobject_set_name(&edac_pci_kobj, "pci");
+       err = kobject_set_name(&edac_pci_top_main_kobj, "pci");
        if (err)
-               return err;
+               goto decrement_count_fail;
+
+       /* Bump the reference count on this module to ensure the
+        * modules isn't unloaded until we deconstruct the top
+        * level main kobj for EDAC PCI
+        */
+       if (!try_module_get(THIS_MODULE)) {
+               debugf1("%s() try_module_get() failed\n", __func__);
+               err = -ENODEV;
+               goto decrement_count_fail;
+       }
 
        /* Instanstiate the pci object */
        /* FIXME: maybe new sysdev_create_subdir() */
-       err = kobject_register(&edac_pci_kobj);
-
+       err = kobject_register(&edac_pci_top_main_kobj);
        if (err) {
                debugf1("Failed to register '.../edac/pci'\n");
-               return err;
+               goto kobject_register_fail;
        }
 
+       /* At this point, to 'release' the top level kobject
+        * for EDAC PCI, then edac_pci_main_kobj_teardown()
+        * must be used, for resources to be cleaned up properly
+        */
        debugf1("Registered '.../edac/pci' kobject\n");
 
        return 0;
+
+       /* Error unwind statck */
+kobject_register_fail:
+       module_put(THIS_MODULE);
+
+decrement_count_fail:
+       /* if are on this error exit, nothing to tear down */
+       atomic_dec(&edac_pci_sysfs_refcount);
+
+       return err;
 }
 
 /*
- * edac_pci_unregister_main_kobj()
+ * edac_pci_main_kobj_teardown()
  *
- *     perform the sysfs teardown for the PCI attributes
+ *     if no longer linked (needed) remove the top level EDAC PCI
+ *     kobject with its controls and attributes
  */
-void edac_pci_unregister_main_kobj(void)
+static void edac_pci_main_kobj_teardown(void)
 {
        debugf0("%s()\n", __func__);
-       init_completion(&edac_pci_kobj_complete);
-       kobject_unregister(&edac_pci_kobj);
-       wait_for_completion(&edac_pci_kobj_complete);
+
+       /* Decrement the count and only if no more controller instances
+        * are connected perform the unregisteration of the top level
+        * main kobj
+        */
+       if (atomic_dec_return(&edac_pci_sysfs_refcount) == 0) {
+               debugf0("%s() called kobject_unregister on main kobj\n",
+                       __func__);
+               kobject_unregister(&edac_pci_top_main_kobj);
+       }
 }
 
+/*
+ *
+ * edac_pci_create_sysfs
+ *
+ *     Create the controls/attributes for the specified EDAC PCI device
+ */
 int edac_pci_create_sysfs(struct edac_pci_ctl_info *pci)
 {
        int err;
        struct kobject *edac_kobj = &pci->kobj;
 
-       if (atomic_inc_return(&edac_pci_sysfs_refcount) == 1) {
-               err = edac_pci_register_main_kobj();
-               if (err) {
-                       atomic_dec(&edac_pci_sysfs_refcount);
-                       return err;
-               }
-       }
+       debugf0("%s() idx=%d\n", __func__, pci->pci_idx);
 
-       err = edac_pci_create_instance_kobj(pci, pci->pci_idx);
-       if (err) {
-               if (atomic_dec_return(&edac_pci_sysfs_refcount) == 0)
-                       edac_pci_unregister_main_kobj();
-       }
+       /* create the top main EDAC PCI kobject, IF needed */
+       err = edac_pci_main_kobj_setup();
+       if (err)
+               return err;
 
-       debugf0("%s() idx=%d\n", __func__, pci->pci_idx);
+       /* Create this instance's kobject under the MAIN kobject */
+       err = edac_pci_create_instance_kobj(pci, pci->pci_idx);
+       if (err)
+               goto unregister_cleanup;
 
        err = sysfs_create_link(edac_kobj, &pci->dev->kobj, EDAC_PCI_SYMLINK);
        if (err) {
                debugf0("%s() sysfs_create_link() returned err= %d\n",
                        __func__, err);
-               return err;
+               goto symlink_fail;
        }
 
        return 0;
+
+       /* Error unwind stack */
+symlink_fail:
+       edac_pci_unregister_sysfs_instance_kobj(pci);
+
+unregister_cleanup:
+       edac_pci_main_kobj_teardown();
+
+       return err;
 }
 
+/*
+ * edac_pci_remove_sysfs
+ *
+ *     remove the controls and attributes for this EDAC PCI device
+ */
 void edac_pci_remove_sysfs(struct edac_pci_ctl_info *pci)
 {
-       debugf0("%s()\n", __func__);
-
-       edac_pci_delete_instance_kobj(pci, pci->pci_idx);
+       debugf0("%s() index=%d\n", __func__, pci->pci_idx);
 
+       /* Remove the symlink */
        sysfs_remove_link(&pci->kobj, EDAC_PCI_SYMLINK);
 
-       if (atomic_dec_return(&edac_pci_sysfs_refcount) == 0)
-               edac_pci_unregister_main_kobj();
+       /* remove this PCI instance's sysfs entries */
+       edac_pci_unregister_sysfs_instance_kobj(pci);
+
+       /* Call the main unregister function, which will determine
+        * if this 'pci' is the last instance.
+        * If it is, the main kobject will be unregistered as a result
+        */
+       debugf0("%s() calling edac_pci_main_kobj_teardown()\n", __func__);
+       edac_pci_main_kobj_teardown();
 }
 
 /************************ PCI error handling *************************/
@@ -414,13 +528,14 @@ static u16 get_pci_parity_status(struct pci_dev *dev, int secondary)
        return status;
 }
 
-typedef void (*pci_parity_check_fn_t) (struct pci_dev * dev);
 
 /* Clear any PCI parity errors logged by this device. */
 static void edac_pci_dev_parity_clear(struct pci_dev *dev)
 {
        u8 header_type;
 
+       debugf0("%s()\n", __func__);
+
        get_pci_parity_status(dev, 0);
 
        /* read the device TYPE, looking for bridges */
@@ -433,17 +548,28 @@ static void edac_pci_dev_parity_clear(struct pci_dev *dev)
 /*
  *  PCI Parity polling
  *
+ *     Fucntion to retrieve the current parity status
+ *     and decode it
+ *
  */
 static void edac_pci_dev_parity_test(struct pci_dev *dev)
 {
+       unsigned long flags;
        u16 status;
        u8 header_type;
 
-       /* read the STATUS register on this device
-        */
+       /* stop any interrupts until we can acquire the status */
+       local_irq_save(flags);
+
+       /* read the STATUS register on this device */
        status = get_pci_parity_status(dev, 0);
 
-       debugf2("PCI STATUS= 0x%04x %s\n", status, dev->dev.bus_id);
+       /* read the device TYPE, looking for bridges */
+       pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type);
+
+       local_irq_restore(flags);
+
+       debugf4("PCI STATUS= 0x%04x %s\n", status, dev->dev.bus_id);
 
        /* check the status reg for errors */
        if (status) {
@@ -471,16 +597,14 @@ static void edac_pci_dev_parity_test(struct pci_dev *dev)
                }
        }
 
-       /* read the device TYPE, looking for bridges */
-       pci_read_config_byte(dev, PCI_HEADER_TYPE, &header_type);
 
-       debugf2("PCI HEADER TYPE= 0x%02x %s\n", header_type, dev->dev.bus_id);
+       debugf4("PCI HEADER TYPE= 0x%02x %s\n", header_type, dev->dev.bus_id);
 
        if ((header_type & 0x7F) == PCI_HEADER_TYPE_BRIDGE) {
                /* On bridges, need to examine secondary status register  */
                status = get_pci_parity_status(dev, 1);
 
-               debugf2("PCI SEC_STATUS= 0x%04x %s\n", status, dev->dev.bus_id);
+               debugf4("PCI SEC_STATUS= 0x%04x %s\n", status, dev->dev.bus_id);
 
                /* check the secondary status reg for errors */
                if (status) {
@@ -510,9 +634,12 @@ static void edac_pci_dev_parity_test(struct pci_dev *dev)
        }
 }
 
+/* reduce some complexity in definition of the iterator */
+typedef void (*pci_parity_check_fn_t) (struct pci_dev *dev);
+
 /*
  * pci_dev parity list iterator
- *     Scan the PCI device list for one iteration, looking for SERRORs
+ *     Scan the PCI device list for one pass, looking for SERRORs
  *     Master Parity ERRORS or Parity ERRORs on primary or secondary devices
  */
 static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn)
@@ -535,22 +662,22 @@ static inline void edac_pci_dev_parity_iterator(pci_parity_check_fn_t fn)
  */
 void edac_pci_do_parity_check(void)
 {
-       unsigned long flags;
        int before_count;
 
        debugf3("%s()\n", __func__);
 
+       /* if policy has PCI check off, leave now */
        if (!check_pci_errors)
                return;
 
        before_count = atomic_read(&pci_parity_count);
 
        /* scan all PCI devices looking for a Parity Error on devices and
-        * bridges
+        * bridges.
+        * The iterator calls pci_get_device() which might sleep, thus
+        * we cannot disable interrupts in this scan.
         */
-       local_irq_save(flags);
        edac_pci_dev_parity_iterator(edac_pci_dev_parity_test);
-       local_irq_restore(flags);
 
        /* Only if operator has selected panic on PCI Error */
        if (edac_pci_get_panic_on_pe()) {
@@ -560,6 +687,12 @@ void edac_pci_do_parity_check(void)
        }
 }
 
+/*
+ * edac_pci_clear_parity_errors
+ *
+ *     function to perform an iteration over the PCI devices
+ *     and clearn their current status
+ */
 void edac_pci_clear_parity_errors(void)
 {
        /* Clear any PCI bus parity errors that devices initially have logged
@@ -567,6 +700,12 @@ void edac_pci_clear_parity_errors(void)
         */
        edac_pci_dev_parity_iterator(edac_pci_dev_parity_clear);
 }
+
+/*
+ * edac_pci_handle_pe
+ *
+ *     Called to handle a PARITY ERROR event
+ */
 void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg)
 {
 
@@ -584,9 +723,14 @@ void edac_pci_handle_pe(struct edac_pci_ctl_info *pci, const char *msg)
         */
        edac_pci_do_parity_check();
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_handle_pe);
 
+
+/*
+ * edac_pci_handle_npe
+ *
+ *     Called to handle a NON-PARITY ERROR event
+ */
 void edac_pci_handle_npe(struct edac_pci_ctl_info *pci, const char *msg)
 {
 
@@ -604,7 +748,6 @@ void edac_pci_handle_npe(struct edac_pci_ctl_info *pci, const char *msg)
         */
        edac_pci_do_parity_check();
 }
-
 EXPORT_SYMBOL_GPL(edac_pci_handle_npe);
 
 /*
index 0ecfdc432f87045588080183f5b96ecbc340e28a..e895f9f887abb8dbda0c45706e649a8cff8fd9c8 100644 (file)
@@ -275,7 +275,7 @@ static int i3000_probe1(struct pci_dev *pdev, int dev_idx)
        unsigned char *c0dra = dra, *c1dra = &dra[I3000_RANKS_PER_CHANNEL / 2];
        unsigned char *c0drb = drb, *c1drb = &drb[I3000_RANKS_PER_CHANNEL];
        unsigned long mchbar;
-       void *window;
+       void __iomem *window;
 
        debugf0("MC: %s()\n", __func__);
 
index db703758db98c3ec0a7f26067e6d410f3fe770c7..7e427b4c74b5fe0ea5a8c87e9250a4c0b576fe95 100644 (file)
@@ -907,6 +907,8 @@ static void bus_reset_tasklet(unsigned long data)
        int self_id_count, i, j, reg;
        int generation, new_generation;
        unsigned long flags;
+       void *free_rom = NULL;
+       dma_addr_t free_rom_bus = 0;
 
        reg = reg_read(ohci, OHCI1394_NodeID);
        if (!(reg & OHCI1394_NodeID_idValid)) {
@@ -970,8 +972,8 @@ static void bus_reset_tasklet(unsigned long data)
         */
 
        if (ohci->next_config_rom != NULL) {
-               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
-                                 ohci->config_rom, ohci->config_rom_bus);
+               free_rom     = ohci->config_rom;
+               free_rom_bus = ohci->config_rom_bus;
                ohci->config_rom      = ohci->next_config_rom;
                ohci->config_rom_bus  = ohci->next_config_rom_bus;
                ohci->next_config_rom = NULL;
@@ -990,6 +992,10 @@ static void bus_reset_tasklet(unsigned long data)
 
        spin_unlock_irqrestore(&ohci->lock, flags);
 
+       if (free_rom)
+               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
+                                 free_rom, free_rom_bus);
+
        fw_core_handle_bus_reset(&ohci->card, ohci->node_id, generation,
                                 self_id_count, ohci->self_id_buffer);
 }
@@ -1186,7 +1192,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
 {
        struct fw_ohci *ohci;
        unsigned long flags;
-       int retval = 0;
+       int retval = -EBUSY;
        __be32 *next_config_rom;
        dma_addr_t next_config_rom_bus;
 
@@ -1240,10 +1246,7 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
 
                reg_write(ohci, OHCI1394_ConfigROMmap,
                          ohci->next_config_rom_bus);
-       } else {
-               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
-                                 next_config_rom, next_config_rom_bus);
-               retval = -EBUSY;
+               retval = 0;
        }
 
        spin_unlock_irqrestore(&ohci->lock, flags);
@@ -1257,6 +1260,9 @@ ohci_set_config_rom(struct fw_card *card, u32 *config_rom, size_t length)
         */
        if (retval == 0)
                fw_core_initiate_bus_reset(&ohci->card, 1);
+       else
+               dma_free_coherent(ohci->card.device, CONFIG_ROM_SIZE,
+                                 next_config_rom, next_config_rom_bus);
 
        return retval;
 }
index 3e4a369d0057f4679dff2dcf23acedb4123ec454..ba816ef6def1b66b97a250a5b70a7d719fbee367 100644 (file)
@@ -984,6 +984,7 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
        struct fw_unit *unit = sd->unit;
        struct fw_device *device = fw_device(unit->device.parent);
        struct sbp2_command_orb *orb;
+       unsigned max_payload;
 
        /*
         * Bidirectional commands are not yet implemented, and unknown
@@ -1017,8 +1018,10 @@ static int sbp2_scsi_queuecommand(struct scsi_cmnd *cmd, scsi_done_fn_t done)
         * specifies the max payload size as 2 ^ (max_payload + 2), so
         * if we set this to max_speed + 7, we get the right value.
         */
+       max_payload = min(device->max_speed + 7,
+                         device->card->max_receive - 1);
        orb->request.misc =
-               COMMAND_ORB_MAX_PAYLOAD(device->max_speed + 7) |
+               COMMAND_ORB_MAX_PAYLOAD(max_payload) |
                COMMAND_ORB_SPEED(device->max_speed) |
                COMMAND_ORB_NOTIFY;
 
index 3ce8e2fbe15fc3d84fb6be6cf8b73cdcc195ac2c..3e1cb12e43cd13f3b8777af28f78c94f7bfb03d0 100644 (file)
@@ -734,7 +734,7 @@ fw_core_handle_response(struct fw_card *card, struct fw_packet *p)
 }
 EXPORT_SYMBOL(fw_core_handle_response);
 
-const struct fw_address_region topology_map_region =
+static const struct fw_address_region topology_map_region =
        { .start = 0xfffff0001000ull, .end = 0xfffff0001400ull, };
 
 static void
@@ -772,7 +772,7 @@ static struct fw_address_handler topology_map = {
        .address_callback       = handle_topology_map,
 };
 
-const struct fw_address_region registers_region =
+static const struct fw_address_region registers_region =
        { .start = 0xfffff0000000ull, .end = 0xfffff0000400ull, };
 
 static void
index 5ceaccd10564cbfd7623757ba351e8490d542fe7..fa7967b57408586359f70ae5bc610f39d7a55223 100644 (file)
@@ -231,7 +231,7 @@ struct fw_card {
        unsigned long reset_jiffies;
 
        unsigned long long guid;
-       int max_receive;
+       unsigned max_receive;
        int link_speed;
        int config_rom_generation;
 
index b2baeaeba9beb2d8a5f598ffec4d24375bab2fb2..0a1f2b52a12fa4bab847f905e8f5069e87cb5944 100644 (file)
@@ -743,7 +743,7 @@ static struct hid_device *usb_hid_configure(struct usb_interface *intf)
        hid->quirks = quirks;
 
        if (!(usbhid = kzalloc(sizeof(struct usbhid_device), GFP_KERNEL)))
-               goto fail;
+               goto fail_no_usbhid;
 
        hid->driver_data = usbhid;
        usbhid->hid = hid;
@@ -878,6 +878,8 @@ fail:
        usb_free_urb(usbhid->urbout);
        usb_free_urb(usbhid->urbctrl);
        hid_free_buffers(dev, hid);
+       kfree(usbhid);
+fail_no_usbhid:
        hid_free_device(hid);
 
        return NULL;
@@ -913,6 +915,7 @@ static void hid_disconnect(struct usb_interface *intf)
        usb_free_urb(usbhid->urbout);
 
        hid_free_buffers(hid_to_usb_dev(hid), hid);
+       kfree(usbhid);
        hid_free_device(hid);
 }
 
index 775b9f3b8ce3e37cce8cc2e45166c1035107d59f..6b21a214f419028f212f238374d92687f1e3a556 100644 (file)
@@ -61,7 +61,9 @@
 #define USB_DEVICE_ID_APPLE_GEYSER4_JIS        0x021c
 #define USB_DEVICE_ID_APPLE_FOUNTAIN_TP_ONLY   0x030a
 #define USB_DEVICE_ID_APPLE_GEYSER1_TP_ONLY    0x030b
-#define USB_DEVICE_ID_APPLE_IR         0x8240
+
+#define USB_VENDOR_ID_ASUS             0x0b05
+#define USB_DEVICE_ID_ASUS_LCM         0x1726
 
 #define USB_VENDOR_ID_ATEN             0x0557
 #define USB_DEVICE_ID_ATEN_UC100KM     0x2004
 
 #define USB_VENDOR_ID_LOGITECH         0x046d
 #define USB_DEVICE_ID_LOGITECH_RECEIVER        0xc101
+#define USB_DEVICE_ID_LOGITECH_HARMONY  0xc110
+#define USB_DEVICE_ID_LOGITECH_HARMONY_2 0xc111
+#define USB_DEVICE_ID_LOGITECH_HARMONY_3 0xc112
+#define USB_DEVICE_ID_LOGITECH_HARMONY_4 0xc113
+#define USB_DEVICE_ID_LOGITECH_HARMONY_5 0xc114
+#define USB_DEVICE_ID_LOGITECH_HARMONY_6 0xc115
+#define USB_DEVICE_ID_LOGITECH_HARMONY_7 0xc116
+#define USB_DEVICE_ID_LOGITECH_HARMONY_8 0xc117
+#define USB_DEVICE_ID_LOGITECH_HARMONY_9 0xc118
+#define USB_DEVICE_ID_LOGITECH_HARMONY_10 0xc119
+#define USB_DEVICE_ID_LOGITECH_HARMONY_11 0xc11a
+#define USB_DEVICE_ID_LOGITECH_HARMONY_12 0xc11b
+#define USB_DEVICE_ID_LOGITECH_HARMONY_13 0xc11c
+#define USB_DEVICE_ID_LOGITECH_HARMONY_14 0xc11d
+#define USB_DEVICE_ID_LOGITECH_HARMONY_15 0xc11e
+#define USB_DEVICE_ID_LOGITECH_HARMONY_16 0xc11f
+#define USB_DEVICE_ID_LOGITECH_HARMONY_17 0xc120
+#define USB_DEVICE_ID_LOGITECH_HARMONY_18 0xc121
+#define USB_DEVICE_ID_LOGITECH_HARMONY_19 0xc122
+#define USB_DEVICE_ID_LOGITECH_HARMONY_20 0xc123
+#define USB_DEVICE_ID_LOGITECH_HARMONY_21 0xc124
+#define USB_DEVICE_ID_LOGITECH_HARMONY_22 0xc125
+#define USB_DEVICE_ID_LOGITECH_HARMONY_23 0xc126
+#define USB_DEVICE_ID_LOGITECH_HARMONY_24 0xc127
+#define USB_DEVICE_ID_LOGITECH_HARMONY_25 0xc128
+#define USB_DEVICE_ID_LOGITECH_HARMONY_26 0xc129
+#define USB_DEVICE_ID_LOGITECH_HARMONY_27 0xc12a
+#define USB_DEVICE_ID_LOGITECH_HARMONY_28 0xc12b
+#define USB_DEVICE_ID_LOGITECH_HARMONY_29 0xc12c
+#define USB_DEVICE_ID_LOGITECH_HARMONY_30 0xc12d
+#define USB_DEVICE_ID_LOGITECH_HARMONY_31 0xc12e
+#define USB_DEVICE_ID_LOGITECH_HARMONY_32 0xc12f
+#define USB_DEVICE_ID_LOGITECH_HARMONY_33 0xc130
+#define USB_DEVICE_ID_LOGITECH_HARMONY_34 0xc131
+#define USB_DEVICE_ID_LOGITECH_HARMONY_35 0xc132
+#define USB_DEVICE_ID_LOGITECH_HARMONY_36 0xc133
+#define USB_DEVICE_ID_LOGITECH_HARMONY_37 0xc134
+#define USB_DEVICE_ID_LOGITECH_HARMONY_38 0xc135
+#define USB_DEVICE_ID_LOGITECH_HARMONY_39 0xc136
+#define USB_DEVICE_ID_LOGITECH_HARMONY_40 0xc137
+#define USB_DEVICE_ID_LOGITECH_HARMONY_41 0xc138
+#define USB_DEVICE_ID_LOGITECH_HARMONY_42 0xc139
+#define USB_DEVICE_ID_LOGITECH_HARMONY_43 0xc13a
+#define USB_DEVICE_ID_LOGITECH_HARMONY_44 0xc13b
+#define USB_DEVICE_ID_LOGITECH_HARMONY_45 0xc13c
+#define USB_DEVICE_ID_LOGITECH_HARMONY_46 0xc13d
+#define USB_DEVICE_ID_LOGITECH_HARMONY_47 0xc13e
+#define USB_DEVICE_ID_LOGITECH_HARMONY_48 0xc13f
+#define USB_DEVICE_ID_LOGITECH_HARMONY_49 0xc140
+#define USB_DEVICE_ID_LOGITECH_HARMONY_50 0xc141
+#define USB_DEVICE_ID_LOGITECH_HARMONY_51 0xc142
+#define USB_DEVICE_ID_LOGITECH_HARMONY_52 0xc143
+#define USB_DEVICE_ID_LOGITECH_HARMONY_53 0xc144
+#define USB_DEVICE_ID_LOGITECH_HARMONY_54 0xc145
+#define USB_DEVICE_ID_LOGITECH_HARMONY_55 0xc146
+#define USB_DEVICE_ID_LOGITECH_HARMONY_56 0xc147
+#define USB_DEVICE_ID_LOGITECH_HARMONY_57 0xc148
+#define USB_DEVICE_ID_LOGITECH_HARMONY_58 0xc149
+#define USB_DEVICE_ID_LOGITECH_HARMONY_59 0xc14a
+#define USB_DEVICE_ID_LOGITECH_HARMONY_60 0xc14b
+#define USB_DEVICE_ID_LOGITECH_HARMONY_61 0xc14c
+#define USB_DEVICE_ID_LOGITECH_HARMONY_62 0xc14d
+#define USB_DEVICE_ID_LOGITECH_HARMONY_63 0xc14e
+#define USB_DEVICE_ID_LOGITECH_HARMONY_64 0xc14f
 #define USB_DEVICE_ID_LOGITECH_WHEEL   0xc294
 #define USB_DEVICE_ID_LOGITECH_KBD     0xc311
 #define USB_DEVICE_ID_S510_RECEIVER    0xc50c
 #define USB_DEVICE_ID_NCR_FIRST                0x0300
 #define USB_DEVICE_ID_NCR_LAST         0x03ff
 
+#define USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR 0x0400
+#define USB_DEVICE_ID_N_S_HARMONY       0xc359
+
 #define USB_VENDOR_ID_NEC              0x073e
 #define USB_DEVICE_ID_NEC_USB_GAME_PAD 0x0301
 
@@ -315,7 +384,7 @@ static const struct hid_blacklist {
        { USB_VENDOR_ID_AIPTEK, USB_DEVICE_ID_AIPTEK_24, HID_QUIRK_IGNORE },
        { USB_VENDOR_ID_AIRCABLE, USB_DEVICE_ID_AIRCABLE1, HID_QUIRK_IGNORE },
        { USB_VENDOR_ID_ALCOR, USB_DEVICE_ID_ALCOR_USBRS232, HID_QUIRK_IGNORE },
-       { USB_VENDOR_ID_APPLE, USB_DEVICE_ID_APPLE_IR, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_ASUS, USB_DEVICE_ID_ASUS_LCM, HID_QUIRK_IGNORE},
        { USB_VENDOR_ID_BERKSHIRE, USB_DEVICE_ID_BERKSHIRE_PCWD, HID_QUIRK_IGNORE },
        { USB_VENDOR_ID_CIDC, 0x0103, HID_QUIRK_IGNORE },
        { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_HIDCOM, HID_QUIRK_IGNORE },
@@ -463,6 +532,71 @@ static const struct hid_blacklist {
 
        { USB_VENDOR_ID_DELL, USB_DEVICE_ID_DELL_W7658, HID_QUIRK_RESET_LEDS },
        { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_KBD, HID_QUIRK_RESET_LEDS },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_2, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_3, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_4, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_5, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_6, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_7, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_8, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_9, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_10, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_11, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_12, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_13, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_14, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_15, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_16, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_17, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_18, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_19, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_20, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_21, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_22, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_23, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_24, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_25, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_26, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_27, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_28, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_29, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_30, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_31, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_32, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_33, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_34, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_35, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_36, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_37, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_38, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_39, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_40, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_41, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_42, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_43, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_44, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_45, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_46, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_47, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_48, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_49, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_50, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_51, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_52, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_53, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_54, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_55, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_56, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_57, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_58, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_59, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_60, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_61, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_62, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_63, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_LOGITECH, USB_DEVICE_ID_LOGITECH_HARMONY_64, HID_QUIRK_IGNORE },
+       { USB_VENDOR_ID_NATIONAL_SEMICONDUCTOR, USB_DEVICE_ID_N_S_HARMONY, HID_QUIRK_IGNORE },
 
        { 0, 0 }
 };
index dbdca6f10e46db2de7930cad8c579d533bb648b2..192953b29b2843e243d41102b7367d5181c2d7a4 100644 (file)
@@ -520,6 +520,16 @@ config SENSORS_SMSC47B397
          This driver can also be built as a module.  If so, the module
          will be called smsc47b397.
 
+config SENSORS_THMC50
+       tristate "Texas Instruments THMC50 / Analog Devices ADM1022"
+       depends on I2C && EXPERIMENTAL
+       help
+         If you say yes here you get support for Texas Instruments THMC50
+         sensor chips and clones: the Analog Devices ADM1022.
+
+         This driver can also be built as a module.  If so, the module
+         will be called thmc50.
+
 config SENSORS_VIA686A
        tristate "VIA686A"
        depends on PCI
index 59f81fae40a06d817682209399f6d6b5c393edc2..d04f90031ebfbce2f22aa63dba2fa9d061497d7f 100644 (file)
@@ -56,6 +56,7 @@ obj-$(CONFIG_SENSORS_SIS5595) += sis5595.o
 obj-$(CONFIG_SENSORS_SMSC47B397)+= smsc47b397.o
 obj-$(CONFIG_SENSORS_SMSC47M1) += smsc47m1.o
 obj-$(CONFIG_SENSORS_SMSC47M192)+= smsc47m192.o
+obj-$(CONFIG_SENSORS_THMC50)   += thmc50.o
 obj-$(CONFIG_SENSORS_VIA686A)  += via686a.o
 obj-$(CONFIG_SENSORS_VT1211)   += vt1211.o
 obj-$(CONFIG_SENSORS_VT8231)   += vt8231.o
index a003d104ca4594bfb6118490da8a42323ca7496b..cdd8b6dea16ddb4d851fef2ea030fe1f47a6a6cf 100644 (file)
@@ -691,8 +691,9 @@ static int abituguru3_read(struct abituguru3_data *data, u8 bank, u8 offset,
 
 /* Sensor settings are stored 1 byte per offset with the bytes
    placed add consecutive offsets. */
-int abituguru3_read_increment_offset(struct abituguru3_data *data, u8 bank,
-       u8 offset, u8 count, u8 *buf, int offset_count)
+static int abituguru3_read_increment_offset(struct abituguru3_data *data,
+                                           u8 bank, u8 offset, u8 count,
+                                           u8 *buf, int offset_count)
 {
        int i, x;
 
index 6db9737397259f5af26c203682b1baa75454c617..a112a03e8f29774c3d1fd567ee02801153005175 100644 (file)
@@ -23,7 +23,6 @@
 #include <linux/types.h>
 #include <linux/errno.h>
 #include <linux/init.h>
-#include <linux/module.h>
 #include <asm/pmac_pfunc.h>
 #include <asm/of_platform.h>
 
index fd1281f4220909e3f80d10aee1a3a6c501cf9fcc..941729a131f5c41498f47bc77c55c6cc2181736f 100644 (file)
 
 /*
  * Temperature sensors keys (sp78 - 2 bytes).
- * First set for Macbook(Pro), second for Macmini.
  */
 static const char* temperature_sensors_sets[][13] = {
+/* Set 0: Macbook Pro */
        { "TA0P", "TB0T", "TC0D", "TC0P", "TG0H", "TG0P", "TG0T", "Th0H",
          "Th1H", "Tm0P", "Ts0P", "Ts1P", NULL },
+/* Set 1: Macbook set */
+       { "TB0T", "TC0D", "TC0P", "TM0P", "TN0P", "TN1P", "Th0H", "Th0S",
+         "Th1H", "Ts0P", NULL },
+/* Set 2: Macmini set */
        { "TC0D", "TC0P", NULL }
 };
 
@@ -1150,10 +1154,10 @@ static void applesmc_release_accelerometer(void)
 static __initdata struct dmi_match_data applesmc_dmi_data[] = {
 /* MacBook Pro: accelerometer, backlight and temperature set 0 */
        { .accelerometer = 1, .light = 1, .temperature_set = 0 },
-/* MacBook: accelerometer and temperature set 0 */
-       { .accelerometer = 1, .light = 0, .temperature_set = 0 },
-/* MacBook: temperature set 1 */
-       { .accelerometer = 0, .light = 0, .temperature_set = 1 }
+/* MacBook: accelerometer and temperature set 1 */
+       { .accelerometer = 1, .light = 0, .temperature_set = 1 },
+/* MacMini: temperature set 2 */
+       { .accelerometer = 0, .light = 0, .temperature_set = 2 },
 };
 
 /* Note that DMI_MATCH(...,"MacBook") will match "MacBookPro1,1".
index be3aaa5d0b917414648dfb7cb0f38b54aea1d073..e9cbc727664d4221422be223c3c8ca082231ce67 100644 (file)
@@ -750,7 +750,7 @@ static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
                res = (data->alarms >> DME1737_BIT_ALARM_TEMP[ix]) & 0x01;
                break;
        case SYS_TEMP_FAULT:
-               res = (data->temp[ix] == 0x0800);
+               res = (((u16)data->temp[ix] & 0xff00) == 0x8000);
                break;
        default:
                res = 0;
index 19717752cfcad64a6efd3d786a79d3b53b861578..b34b546c68b847486d5688edd021eaf17916ae22 100644 (file)
@@ -441,6 +441,8 @@ static struct fscher_data *fscher_update_device(struct device *dev)
                data->watchdog[2] = fscher_read_value(client, FSCHER_REG_WDOG_CONTROL);
 
                data->global_event = fscher_read_value(client, FSCHER_REG_EVENT_STATE);
+               data->global_control = fscher_read_value(client,
+                                                       FSCHER_REG_CONTROL);
 
                data->last_updated = jiffies;
                data->valid = 1;                 
@@ -599,7 +601,7 @@ static ssize_t set_control(struct i2c_client *client, struct fscher_data *data,
        unsigned long v = simple_strtoul(buf, NULL, 10) & 0x01;
 
        mutex_lock(&data->update_lock);
-       data->global_control &= ~v;
+       data->global_control v;
        fscher_write_value(client, reg, v);
        mutex_unlock(&data->update_lock);
        return count;
index eff6036e15c0fbca5b7888dde96f200c86c5d3fa..d75dba9b810b3aa81b80afc489fd22e11ae1b101 100644 (file)
@@ -252,7 +252,7 @@ struct it87_data {
 
 
 static int it87_probe(struct platform_device *pdev);
-static int it87_remove(struct platform_device *pdev);
+static int __devexit it87_remove(struct platform_device *pdev);
 
 static int it87_read_value(struct it87_data *data, u8 reg);
 static void it87_write_value(struct it87_data *data, u8 reg, u8 value);
index 9fb572f03ba5bf707cd8768a7c1f60928c444821..565c4e679b8d4f1ebcf1cb04cc1faecd71fb31d9 100644 (file)
@@ -864,7 +864,7 @@ static int __init lm78_isa_found(unsigned short address)
        /* Determine the chip type */
        outb_p(LM78_REG_CHIPID, address + LM78_ADDR_REG_OFFSET);
        val = inb_p(address + LM78_DATA_REG_OFFSET);
-       if (val == 0x00                 /* LM78 */
+       if (val == 0x00 || val == 0x20  /* LM78 */
         || val == 0x40                 /* LM78-J */
         || (val & 0xfe) == 0xc0)       /* LM79 */
                found = 1;
index 48833fff492004e740b228ad89d585da6b95943e..af541d67245dd040b055c6bed708b99b9caf5f9e 100644 (file)
@@ -585,7 +585,7 @@ static int lm90_detect(struct i2c_adapter *adapter, int address, int kind)
                         * those of the man_id register.
                         */
                        if (chip_id == man_id
-                        && (address == 0x4F || address == 0x4D)
+                        && (address == 0x4C || address == 0x4D)
                         && (reg_config1 & 0x1F) == (man_id & 0x0F)
                         && reg_convrate <= 0x09) {
                                kind = max6657;
index 23edf4fe422142eed31a6f9c26d9633951252da6..d84f8bf6f28476edf6c8e422eb675972af44acc1 100644 (file)
@@ -234,7 +234,7 @@ struct lm93_data {
        struct {
                u8 min;
                u8 max;
-       } temp_lim[3];
+       } temp_lim[4];
 
        /* vin1 - vin16: low and high limits */
        struct {
index cb72526c346a3e04af035503400ff4ae5fdfcbd4..f57c75d59a5bcf0273aba9569b0958e417eaa81d 100644 (file)
@@ -220,7 +220,7 @@ struct pc87360_data {
  */
 
 static int pc87360_probe(struct platform_device *pdev);
-static int pc87360_remove(struct platform_device *pdev);
+static int __devexit pc87360_remove(struct platform_device *pdev);
 
 static int pc87360_read_value(struct pc87360_data *data, u8 ldi, u8 bank,
                              u8 reg);
index 83321b28cf0e31e49f20396c5d1688ff8b57dbd5..92956eb3f3c15b657bcabf341cf4984b484cbbd0 100644 (file)
@@ -187,7 +187,7 @@ struct sis5595_data {
 static struct pci_dev *s_bridge;       /* pointer to the (only) sis5595 */
 
 static int sis5595_probe(struct platform_device *pdev);
-static int sis5595_remove(struct platform_device *pdev);
+static int __devexit sis5595_remove(struct platform_device *pdev);
 
 static int sis5595_read_value(struct sis5595_data *data, u8 reg);
 static void sis5595_write_value(struct sis5595_data *data, u8 reg, u8 value);
index 1de2f2be8708715dcfdf40b191af4ee5db4459d5..338ee4f5461424b01c0895e8dc80348efbf4e350 100644 (file)
@@ -134,7 +134,7 @@ struct smsc47m1_sio_data {
 
 
 static int smsc47m1_probe(struct platform_device *pdev);
-static int smsc47m1_remove(struct platform_device *pdev);
+static int __devexit smsc47m1_remove(struct platform_device *pdev);
 static struct smsc47m1_data *smsc47m1_update_device(struct device *dev,
                int init);
 
diff --git a/drivers/hwmon/thmc50.c b/drivers/hwmon/thmc50.c
new file mode 100644 (file)
index 0000000..9395b52
--- /dev/null
@@ -0,0 +1,440 @@
+/*
+    thmc50.c - Part of lm_sensors, Linux kernel modules for hardware
+             monitoring
+    Copyright (C) 2007 Krzysztof Helt <krzysztof.h1@wp.pl>
+    Based on 2.4 driver by Frodo Looijaard <frodol@dds.nl> and
+    Philip Edelbrock <phil@netroedge.com>
+
+    This program is free software; you can redistribute it and/or modify
+    it under the terms of the GNU General Public License as published by
+    the Free Software Foundation; either version 2 of the License, or
+    (at your option) any later version.
+
+    This program is distributed in the hope that it will be useful,
+    but WITHOUT ANY WARRANTY; without even the implied warranty of
+    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+    GNU General Public License for more details.
+
+    You should have received a copy of the GNU General Public License
+    along with this program; if not, write to the Free Software
+    Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+*/
+
+#include <linux/module.h>
+#include <linux/init.h>
+#include <linux/slab.h>
+#include <linux/i2c.h>
+#include <linux/hwmon.h>
+#include <linux/hwmon-sysfs.h>
+#include <linux/err.h>
+#include <linux/mutex.h>
+
+MODULE_LICENSE("GPL");
+
+/* Addresses to scan */
+static unsigned short normal_i2c[] = { 0x2c, 0x2d, 0x2e, I2C_CLIENT_END };
+
+/* Insmod parameters */
+I2C_CLIENT_INSMOD_2(thmc50, adm1022);
+I2C_CLIENT_MODULE_PARM(adm1022_temp3, "List of adapter,address pairs "
+                       "to enable 3rd temperature (ADM1022 only)");
+
+/* Many THMC50 constants specified below */
+
+/* The THMC50 registers */
+#define THMC50_REG_CONF                                0x40
+#define THMC50_REG_COMPANY_ID                  0x3E
+#define THMC50_REG_DIE_CODE                    0x3F
+#define THMC50_REG_ANALOG_OUT                  0x19
+
+const static u8 THMC50_REG_TEMP[] = { 0x27, 0x26, 0x20 };
+const static u8 THMC50_REG_TEMP_MIN[] = { 0x3A, 0x38, 0x2C };
+const static u8 THMC50_REG_TEMP_MAX[] = { 0x39, 0x37, 0x2B };
+
+#define THMC50_REG_CONF_nFANOFF                        0x20
+
+/* Each client has this additional data */
+struct thmc50_data {
+       struct i2c_client client;
+       struct class_device *class_dev;
+
+       struct mutex update_lock;
+       enum chips type;
+       unsigned long last_updated;     /* In jiffies */
+       char has_temp3;         /* !=0 if it is ADM1022 in temp3 mode */
+       char valid;             /* !=0 if following fields are valid */
+
+       /* Register values */
+       s8 temp_input[3];
+       s8 temp_max[3];
+       s8 temp_min[3];
+       u8 analog_out;
+};
+
+static int thmc50_attach_adapter(struct i2c_adapter *adapter);
+static int thmc50_detach_client(struct i2c_client *client);
+static void thmc50_init_client(struct i2c_client *client);
+static struct thmc50_data *thmc50_update_device(struct device *dev);
+
+static struct i2c_driver thmc50_driver = {
+       .driver = {
+               .name = "thmc50",
+       },
+       .attach_adapter = thmc50_attach_adapter,
+       .detach_client = thmc50_detach_client,
+};
+
+static ssize_t show_analog_out(struct device *dev,
+                              struct device_attribute *attr, char *buf)
+{
+       struct thmc50_data *data = thmc50_update_device(dev);
+       return sprintf(buf, "%d\n", data->analog_out);
+}
+
+static ssize_t set_analog_out(struct device *dev,
+                             struct device_attribute *attr,
+                             const char *buf, size_t count)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct thmc50_data *data = i2c_get_clientdata(client);
+       int tmp = simple_strtoul(buf, NULL, 10);
+       int config;
+
+       mutex_lock(&data->update_lock);
+       data->analog_out = SENSORS_LIMIT(tmp, 0, 255);
+       i2c_smbus_write_byte_data(client, THMC50_REG_ANALOG_OUT,
+                                 data->analog_out);
+
+       config = i2c_smbus_read_byte_data(client, THMC50_REG_CONF);
+       if (data->analog_out == 0)
+               config &= ~THMC50_REG_CONF_nFANOFF;
+       else
+               config |= THMC50_REG_CONF_nFANOFF;
+       i2c_smbus_write_byte_data(client, THMC50_REG_CONF, config);
+
+       mutex_unlock(&data->update_lock);
+       return count;
+}
+
+/* There is only one PWM mode = DC */
+static ssize_t show_pwm_mode(struct device *dev, struct device_attribute *attr,
+                            char *buf)
+{
+       return sprintf(buf, "0\n");
+}
+
+/* Temperatures */
+static ssize_t show_temp(struct device *dev, struct device_attribute *attr,
+                        char *buf)
+{
+       int nr = to_sensor_dev_attr(attr)->index;
+       struct thmc50_data *data = thmc50_update_device(dev);
+       return sprintf(buf, "%d\n", data->temp_input[nr] * 1000);
+}
+
+static ssize_t show_temp_min(struct device *dev, struct device_attribute *attr,
+                            char *buf)
+{
+       int nr = to_sensor_dev_attr(attr)->index;
+       struct thmc50_data *data = thmc50_update_device(dev);
+       return sprintf(buf, "%d\n", data->temp_min[nr] * 1000);
+}
+
+static ssize_t set_temp_min(struct device *dev, struct device_attribute *attr,
+                           const char *buf, size_t count)
+{
+       int nr = to_sensor_dev_attr(attr)->index;
+       struct i2c_client *client = to_i2c_client(dev);
+       struct thmc50_data *data = i2c_get_clientdata(client);
+       int val = simple_strtol(buf, NULL, 10);
+
+       mutex_lock(&data->update_lock);
+       data->temp_min[nr] = SENSORS_LIMIT(val / 1000, -128, 127);
+       i2c_smbus_write_byte_data(client, THMC50_REG_TEMP_MIN[nr],
+                                 data->temp_min[nr]);
+       mutex_unlock(&data->update_lock);
+       return count;
+}
+
+static ssize_t show_temp_max(struct device *dev, struct device_attribute *attr,
+                            char *buf)
+{
+       int nr = to_sensor_dev_attr(attr)->index;
+       struct thmc50_data *data = thmc50_update_device(dev);
+       return sprintf(buf, "%d\n", data->temp_max[nr] * 1000);
+}
+
+static ssize_t set_temp_max(struct device *dev, struct device_attribute *attr,
+                           const char *buf, size_t count)
+{
+       int nr = to_sensor_dev_attr(attr)->index;
+       struct i2c_client *client = to_i2c_client(dev);
+       struct thmc50_data *data = i2c_get_clientdata(client);
+       int val = simple_strtol(buf, NULL, 10);
+
+       mutex_lock(&data->update_lock);
+       data->temp_max[nr] = SENSORS_LIMIT(val / 1000, -128, 127);
+       i2c_smbus_write_byte_data(client, THMC50_REG_TEMP_MAX[nr],
+                                 data->temp_max[nr]);
+       mutex_unlock(&data->update_lock);
+       return count;
+}
+
+#define temp_reg(offset)                                               \
+static SENSOR_DEVICE_ATTR(temp##offset##_input, S_IRUGO, show_temp,    \
+                       NULL, offset - 1);                              \
+static SENSOR_DEVICE_ATTR(temp##offset##_min, S_IRUGO | S_IWUSR,       \
+                       show_temp_min, set_temp_min, offset - 1);       \
+static SENSOR_DEVICE_ATTR(temp##offset##_max, S_IRUGO | S_IWUSR,       \
+                       show_temp_max, set_temp_max, offset - 1);
+
+temp_reg(1);
+temp_reg(2);
+temp_reg(3);
+
+static SENSOR_DEVICE_ATTR(pwm1, S_IRUGO | S_IWUSR, show_analog_out,
+                         set_analog_out, 0);
+static SENSOR_DEVICE_ATTR(pwm1_mode, S_IRUGO, show_pwm_mode, NULL, 0);
+
+static struct attribute *thmc50_attributes[] = {
+       &sensor_dev_attr_temp1_max.dev_attr.attr,
+       &sensor_dev_attr_temp1_min.dev_attr.attr,
+       &sensor_dev_attr_temp1_input.dev_attr.attr,
+       &sensor_dev_attr_temp2_max.dev_attr.attr,
+       &sensor_dev_attr_temp2_min.dev_attr.attr,
+       &sensor_dev_attr_temp2_input.dev_attr.attr,
+       &sensor_dev_attr_pwm1.dev_attr.attr,
+       &sensor_dev_attr_pwm1_mode.dev_attr.attr,
+       NULL
+};
+
+static const struct attribute_group thmc50_group = {
+       .attrs = thmc50_attributes,
+};
+
+/* for ADM1022 3rd temperature mode */
+static struct attribute *adm1022_attributes[] = {
+       &sensor_dev_attr_temp3_max.dev_attr.attr,
+       &sensor_dev_attr_temp3_min.dev_attr.attr,
+       &sensor_dev_attr_temp3_input.dev_attr.attr,
+       NULL
+};
+
+static const struct attribute_group adm1022_group = {
+       .attrs = adm1022_attributes,
+};
+
+static int thmc50_detect(struct i2c_adapter *adapter, int address, int kind)
+{
+       unsigned company;
+       unsigned revision;
+       unsigned config;
+       struct i2c_client *client;
+       struct thmc50_data *data;
+       struct device *dev;
+       int err = 0;
+       const char *type_name = "";
+
+       if (!i2c_check_functionality(adapter, I2C_FUNC_SMBUS_BYTE_DATA)) {
+               pr_debug("thmc50: detect failed, "
+                        "smbus byte data not supported!\n");
+               goto exit;
+       }
+
+       /* OK. For now, we presume we have a valid client. We now create the
+          client structure, even though we cannot fill it completely yet.
+          But it allows us to access thmc50 registers. */
+       if (!(data = kzalloc(sizeof(struct thmc50_data), GFP_KERNEL))) {
+               pr_debug("thmc50: detect failed, kzalloc failed!\n");
+               err = -ENOMEM;
+               goto exit;
+       }
+
+       client = &data->client;
+       i2c_set_clientdata(client, data);
+       client->addr = address;
+       client->adapter = adapter;
+       client->driver = &thmc50_driver;
+       dev = &client->dev;
+
+       pr_debug("thmc50: Probing for THMC50 at 0x%2X on bus %d\n",
+                client->addr, i2c_adapter_id(client->adapter));
+
+       /* Now, we do the remaining detection. */
+       company = i2c_smbus_read_byte_data(client, THMC50_REG_COMPANY_ID);
+       revision = i2c_smbus_read_byte_data(client, THMC50_REG_DIE_CODE);
+       config = i2c_smbus_read_byte_data(client, THMC50_REG_CONF);
+
+       if (kind == 0)
+               kind = thmc50;
+       else if (kind < 0) {
+               err = -ENODEV;
+               if (revision >= 0xc0 && ((config & 0x10) == 0)) {
+                       if (company == 0x49) {
+                               kind = thmc50;
+                               err = 0;
+                       } else if (company == 0x41) {
+                               kind = adm1022;
+                               err = 0;
+                       }
+               }
+       }
+       if (err == -ENODEV) {
+               pr_debug("thmc50: Detection of THMC50/ADM1022 failed\n");
+               goto exit_free;
+       }
+       pr_debug("thmc50: Detected %s (version %x, revision %x)\n",
+                type_name, (revision >> 4) - 0xc, revision & 0xf);
+       data->type = kind;
+
+       if (kind == thmc50)
+               type_name = "thmc50";
+       else if (kind == adm1022) {
+               int id = i2c_adapter_id(client->adapter);
+               int i;
+
+               type_name = "adm1022";
+               data->has_temp3 = (config >> 7) & 1;    /* config MSB */
+               for (i = 0; i + 1 < adm1022_temp3_num; i += 2)
+                       if (adm1022_temp3[i] == id &&
+                           adm1022_temp3[i + 1] == address) {
+                               /* enable 2nd remote temp */
+                               data->has_temp3 = 1;
+                               break;
+                       }
+       }
+
+       /* Fill in the remaining client fields & put it into the global list */
+       strlcpy(client->name, type_name, I2C_NAME_SIZE);
+       mutex_init(&data->update_lock);
+
+       /* Tell the I2C layer a new client has arrived */
+       if ((err = i2c_attach_client(client)))
+               goto exit_free;
+
+       thmc50_init_client(client);
+
+       /* Register sysfs hooks */
+       if ((err = sysfs_create_group(&client->dev.kobj, &thmc50_group)))
+               goto exit_detach;
+
+       /* Register ADM1022 sysfs hooks */
+       if (data->type == adm1022)
+               if ((err = sysfs_create_group(&client->dev.kobj,
+                                             &adm1022_group)))
+                       goto exit_remove_sysfs_thmc50;
+
+       /* Register a new directory entry with module sensors */
+       data->class_dev = hwmon_device_register(&client->dev);
+       if (IS_ERR(data->class_dev)) {
+               err = PTR_ERR(data->class_dev);
+               goto exit_remove_sysfs;
+       }
+
+       return 0;
+
+exit_remove_sysfs:
+       if (data->type == adm1022)
+               sysfs_remove_group(&client->dev.kobj, &adm1022_group);
+exit_remove_sysfs_thmc50:
+       sysfs_remove_group(&client->dev.kobj, &thmc50_group);
+exit_detach:
+       i2c_detach_client(client);
+exit_free:
+       kfree(data);
+exit:
+       return err;
+}
+
+static int thmc50_attach_adapter(struct i2c_adapter *adapter)
+{
+       if (!(adapter->class & I2C_CLASS_HWMON))
+               return 0;
+       return i2c_probe(adapter, &addr_data, thmc50_detect);
+}
+
+static int thmc50_detach_client(struct i2c_client *client)
+{
+       struct thmc50_data *data = i2c_get_clientdata(client);
+       int err;
+
+       hwmon_device_unregister(data->class_dev);
+       sysfs_remove_group(&client->dev.kobj, &thmc50_group);
+       if (data->type == adm1022)
+               sysfs_remove_group(&client->dev.kobj, &adm1022_group);
+
+       if ((err = i2c_detach_client(client)))
+               return err;
+
+       kfree(data);
+
+       return 0;
+}
+
+static void thmc50_init_client(struct i2c_client *client)
+{
+       struct thmc50_data *data = i2c_get_clientdata(client);
+       int config;
+
+       data->analog_out = i2c_smbus_read_byte_data(client,
+                                                   THMC50_REG_ANALOG_OUT);
+       /* set up to at least 1 */
+       if (data->analog_out == 0) {
+               data->analog_out = 1;
+               i2c_smbus_write_byte_data(client, THMC50_REG_ANALOG_OUT,
+                                         data->analog_out);
+       }
+       config = i2c_smbus_read_byte_data(client, THMC50_REG_CONF);
+       config |= 0x1;  /* start the chip if it is in standby mode */
+       if (data->has_temp3)
+               config |= 0x80;         /* enable 2nd remote temp */
+       i2c_smbus_write_byte_data(client, THMC50_REG_CONF, config);
+}
+
+static struct thmc50_data *thmc50_update_device(struct device *dev)
+{
+       struct i2c_client *client = to_i2c_client(dev);
+       struct thmc50_data *data = i2c_get_clientdata(client);
+       int timeout = HZ / 5 + (data->type == thmc50 ? HZ : 0);
+
+       mutex_lock(&data->update_lock);
+
+       if (time_after(jiffies, data->last_updated + timeout)
+           || !data->valid) {
+
+               int temps = data->has_temp3 ? 3 : 2;
+               int i;
+               for (i = 0; i < temps; i++) {
+                       data->temp_input[i] = i2c_smbus_read_byte_data(client,
+                                               THMC50_REG_TEMP[i]);
+                       data->temp_max[i] = i2c_smbus_read_byte_data(client,
+                                               THMC50_REG_TEMP_MAX[i]);
+                       data->temp_min[i] = i2c_smbus_read_byte_data(client,
+                                               THMC50_REG_TEMP_MIN[i]);
+               }
+               data->analog_out =
+                   i2c_smbus_read_byte_data(client, THMC50_REG_ANALOG_OUT);
+               data->last_updated = jiffies;
+               data->valid = 1;
+       }
+
+       mutex_unlock(&data->update_lock);
+
+       return data;
+}
+
+static int __init sm_thmc50_init(void)
+{
+       return i2c_add_driver(&thmc50_driver);
+}
+
+static void __exit sm_thmc50_exit(void)
+{
+       i2c_del_driver(&thmc50_driver);
+}
+
+MODULE_AUTHOR("Krzysztof Helt <krzysztof.h1@wp.pl>");
+MODULE_DESCRIPTION("THMC50 driver");
+
+module_init(sm_thmc50_init);
+module_exit(sm_thmc50_exit);
index 24a6851491d00d7c9655d3a67ab43dd2d53c60e5..696c8a2e537473e75e49bda1a97ef81c3dd480da 100644 (file)
@@ -314,7 +314,7 @@ struct via686a_data {
 static struct pci_dev *s_bridge;       /* pointer to the (only) via686a */
 
 static int via686a_probe(struct platform_device *pdev);
-static int via686a_remove(struct platform_device *pdev);
+static int __devexit via686a_remove(struct platform_device *pdev);
 
 static inline int via686a_read_value(struct via686a_data *data, u8 reg)
 {
index c604972f0186ed1013d096bd209b0afa54048bc1..3e63eaf19041edec1d92ee2207d9f204992bf9b9 100644 (file)
@@ -167,7 +167,7 @@ struct vt8231_data {
 
 static struct pci_dev *s_bridge;
 static int vt8231_probe(struct platform_device *pdev);
-static int vt8231_remove(struct platform_device *pdev);
+static int __devexit vt8231_remove(struct platform_device *pdev);
 static struct vt8231_data *vt8231_update_device(struct device *dev);
 static void vt8231_init_device(struct vt8231_data *data);
 
@@ -751,7 +751,7 @@ exit_release:
        return err;
 }
 
-static int vt8231_remove(struct platform_device *pdev)
+static int __devexit vt8231_remove(struct platform_device *pdev)
 {
        struct vt8231_data *data = platform_get_drvdata(pdev);
        int i;
index 1ce78179b0051bc4237af054357a3981fd521838..7a4a15f4bf8ba2fd42ebab9c42a9667768dad348 100644 (file)
@@ -387,7 +387,7 @@ struct w83627hf_sio_data {
 
 
 static int w83627hf_probe(struct platform_device *pdev);
-static int w83627hf_remove(struct platform_device *pdev);
+static int __devexit w83627hf_remove(struct platform_device *pdev);
 
 static int w83627hf_read_value(struct w83627hf_data *data, u16 reg);
 static int w83627hf_write_value(struct w83627hf_data *data, u16 reg, u16 value);
index da1647869f914872507ba0cb77a1258e1418c805..1842f523c23d33b3b1458e992d35effcbf88d0f8 100644 (file)
@@ -92,9 +92,9 @@ config I2C_AU1550
 
 config I2C_BLACKFIN_TWI
        tristate "Blackfin TWI I2C support"
-       depends on BF534 || BF536 || BF537
+       depends on BF534 || BF536 || BF537 || BF54x
        help
-         This is the TWI I2C device driver for Blackfin 534/536/537.
+         This is the TWI I2C device driver for Blackfin 534/536/537/54x.
          This driver can also be built as a module.  If so, the module
          will be called i2c-bfin-twi.
 
index 8f5c686123b8a5da5fae95064cb3bd8355ca5428..289816db52aed4b956dd515238f65a8fda481597 100644 (file)
@@ -272,11 +272,11 @@ static int i801_block_transaction_byte_by_byte(union i2c_smbus_data *data,
                /* Make sure the SMBus host is ready to start transmitting */
                temp = inb_p(SMBHSTSTS);
                if (i == 1) {
-                       /* Erronenous conditions before transaction:
+                       /* Erroneous conditions before transaction:
                         * Byte_Done, Failed, Bus_Err, Dev_Err, Intr, Host_Busy */
                        errmask = 0x9f;
                } else {
-                       /* Erronenous conditions during transaction:
+                       /* Erroneous conditions during transaction:
                         * Failed, Bus_Err, Dev_Err, Intr */
                        errmask = 0x1e;
                }
index 440342bc62e183d0d20b8acced8ea0a9a5cd5b86..ace644e21b14380585f05103028a133b02a904af 100644 (file)
@@ -490,6 +490,7 @@ iop3xx_i2c_probe(struct platform_device *pdev)
        memcpy(new_adapter->name, pdev->name, strlen(pdev->name));
        new_adapter->id = I2C_HW_IOP3XX;
        new_adapter->owner = THIS_MODULE;
+       new_adapter->class = I2C_CLASS_HWMON;
        new_adapter->dev.parent = &pdev->dev;
        new_adapter->nr = pdev->id;
 
index 851c3ed513d015e50b5c75c362a014dfa09c1c1d..d8de4ac88b7d9d7718b9693eb1506f8ec45709a6 100644 (file)
@@ -105,6 +105,7 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
                        schedule();
                        if (time_after(jiffies, orig_jiffies + timeout)) {
                                pr_debug("I2C: timeout\n");
+                               writeccr(i2c, 0);
                                result = -EIO;
                                break;
                        }
@@ -116,10 +117,12 @@ static int i2c_wait(struct mpc_i2c *i2c, unsigned timeout, int writing)
                result = wait_event_interruptible_timeout(i2c->queue,
                        (i2c->interrupt & CSR_MIF), timeout * HZ);
 
-               if (unlikely(result < 0))
+               if (unlikely(result < 0)) {
                        pr_debug("I2C: wait interrupted\n");
-               else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
+                       writeccr(i2c, 0);
+               } else if (unlikely(!(i2c->interrupt & CSR_MIF))) {
                        pr_debug("I2C: wait timeout\n");
+                       writeccr(i2c, 0);
                        result = -ETIMEDOUT;
                }
 
@@ -172,7 +175,6 @@ static void mpc_i2c_start(struct mpc_i2c *i2c)
 static void mpc_i2c_stop(struct mpc_i2c *i2c)
 {
        writeccr(i2c, CCR_MEN);
-       writeccr(i2c, 0);
 }
 
 static int mpc_write(struct mpc_i2c *i2c, int target,
@@ -261,6 +263,7 @@ static int mpc_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
        while (readb(i2c->base + MPC_I2C_SR) & CSR_MBB) {
                if (signal_pending(current)) {
                        pr_debug("I2C: Interrupted\n");
+                       writeccr(i2c, 0);
                        return -EINTR;
                }
                if (time_after(jiffies, orig_jiffies + HZ)) {
@@ -362,7 +365,7 @@ static int fsl_i2c_probe(struct platform_device *pdev)
 
       fail_add:
        if (i2c->irq != 0)
-               free_irq(i2c->irq, NULL);
+               free_irq(i2c->irq, i2c);
       fail_irq:
        iounmap(i2c->base);
       fail_map:
index 251154ae5d97ad3eb0bddff1067c3a655075ba5f..bb7bf68a7fb66eb4fb648ba0d770d2bcbda38333 100644 (file)
@@ -107,6 +107,21 @@ struct mv64xxx_i2c_data {
  *
  *****************************************************************************
  */
+
+/* Reset hardware and initialize FSM */
+static void
+mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
+{
+       writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET);
+       writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)),
+               drv_data->reg_base + MV64XXX_I2C_REG_BAUD);
+       writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR);
+       writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR);
+       writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
+               drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
+       drv_data->state = MV64XXX_I2C_STATE_IDLE;
+}
+
 static void
 mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
 {
@@ -203,7 +218,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
                         drv_data->state, status, drv_data->msg->addr,
                         drv_data->msg->flags);
                drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
-               drv_data->state = MV64XXX_I2C_STATE_IDLE;
+               mv64xxx_i2c_hw_init(drv_data);
                drv_data->rc = -EIO;
        }
 }
@@ -367,6 +382,7 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
                                "mv64xxx: I2C bus locked, block: %d, "
                                "time_left: %d\n", drv_data->block,
                                (int)time_left);
+                       mv64xxx_i2c_hw_init(drv_data);
                }
        } else
                spin_unlock_irqrestore(&drv_data->lock, flags);
@@ -443,19 +459,6 @@ static const struct i2c_algorithm mv64xxx_i2c_algo = {
  *
  *****************************************************************************
  */
-static void __devinit
-mv64xxx_i2c_hw_init(struct mv64xxx_i2c_data *drv_data)
-{
-       writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SOFT_RESET);
-       writel((((drv_data->freq_m & 0xf) << 3) | (drv_data->freq_n & 0x7)),
-               drv_data->reg_base + MV64XXX_I2C_REG_BAUD);
-       writel(0, drv_data->reg_base + MV64XXX_I2C_REG_SLAVE_ADDR);
-       writel(0, drv_data->reg_base + MV64XXX_I2C_REG_EXT_SLAVE_ADDR);
-       writel(MV64XXX_I2C_REG_CONTROL_TWSIEN | MV64XXX_I2C_REG_CONTROL_STOP,
-               drv_data->reg_base + MV64XXX_I2C_REG_CONTROL);
-       drv_data->state = MV64XXX_I2C_STATE_IDLE;
-}
-
 static int __devinit
 mv64xxx_i2c_map_regs(struct platform_device *pd,
        struct mv64xxx_i2c_data *drv_data)
index e4540fcf6476e17fc5aa6d1f764d583fc0403c1d..c44ada5f4292e301bfb4e2e1165e06b1007b626f 100644 (file)
@@ -39,8 +39,8 @@
 #include <asm/io.h>
 
 #include <asm/arch/regs-gpio.h>
-#include <asm/arch/regs-iic.h>
-#include <asm/arch/iic.h>
+#include <asm/plat-s3c/regs-iic.h>
+#include <asm/plat-s3c/iic.h>
 
 /* i2c controller state */
 
index 5879f0f25495ae6fe7f0fc04b3dfd4237a95e5ac..9e94542c18a2bc57abd22d05c17c0b04955fe7c3 100644 (file)
@@ -75,7 +75,8 @@ static ssize_t ds1682_show(struct device *dev, struct device_attribute *attr,
        /* Special case: the 32 bit regs are time values with 1/4s
         * resolution, scale them up to milliseconds */
        if (sattr->nr == 4)
-               return sprintf(buf, "%llu\n", ((u64) le32_to_cpu(val)) * 250);
+               return sprintf(buf, "%llu\n",
+                       ((unsigned long long)le32_to_cpu(val)) * 250);
 
        /* Format the output string and return # of bytes */
        return sprintf(buf, "%li\n", (long)le32_to_cpu(val));
index 9fafadb92510219e74ddce66bdc223e88165bc9a..fe04e46991aa9911967c267166c4b11db944cc6f 100644 (file)
@@ -18,8 +18,6 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  */
-#undef DEBUG
-#undef VERBOSE
 
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -44,7 +42,7 @@
 
 
 #define        DRIVER_VERSION  "24 August 2004"
-#define        DRIVER_NAME     (isp1301_driver.name)
+#define        DRIVER_NAME     (isp1301_driver.driver.name)
 
 MODULE_DESCRIPTION("ISP1301 USB OTG Transceiver Driver");
 MODULE_LICENSE("GPL");
@@ -55,6 +53,7 @@ struct isp1301 {
        void                    (*i2c_release)(struct device *dev);
 
        int                     irq;
+       int                     irq_type;
 
        u32                     last_otg_ctrl;
        unsigned                working:1;
@@ -63,7 +62,7 @@ struct isp1301 {
 
        /* use keventd context to change the state for us */
        struct work_struct      work;
-       
+
        unsigned long           todo;
 #              define WORK_UPDATE_ISP  0       /* update ISP from OTG */
 #              define WORK_UPDATE_OTG  1       /* update OTG from ISP */
@@ -94,7 +93,7 @@ struct isp1301 {
 
 /* board-specific PM hooks */
 
-#include <asm/arch/gpio.h>
+#include <asm/gpio.h>
 #include <asm/arch/mux.h>
 #include <asm/mach-types.h>
 
@@ -291,7 +290,7 @@ static void power_up(struct isp1301 *isp)
 {
        // isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_2, MC2_GLOBAL_PWR_DN);
        isp1301_clear_bits(isp, ISP1301_MODE_CONTROL_1, MC1_SUSPEND_REG);
-       
+
        /* do this only when cpu is driving transceiver,
         * so host won't see a low speed device...
         */
@@ -799,7 +798,7 @@ static irqreturn_t omap_otg_irq(int irq, void *_isp)
                /* role is host */
                } else {
                        if (!(otg_ctrl & OTG_ID)) {
-                               otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
+                               otg_ctrl &= OTG_CTRL_MASK & ~OTG_XCEIV_INPUTS;
                                OTG_CTRL_REG = otg_ctrl | OTG_A_BUSREQ;
                        }
 
@@ -1100,9 +1099,9 @@ static u8 isp1301_clear_latch(struct isp1301 *isp)
 }
 
 static void
-isp1301_work(void *data)
+isp1301_work(struct work_struct *work)
 {
-       struct isp1301  *isp = data;
+       struct isp1301  *isp = container_of(work, struct isp1301, work);
        int             stop;
 
        /* implicit lock:  we're the only task using this device */
@@ -1244,7 +1243,7 @@ static int isp1301_detach_client(struct i2c_client *i2c)
  *  - DEVICE mode, for when there's a B/Mini-B (device) connector
  *
  * As a rule, you won't have an isp1301 chip unless it's there to
- * support the OTG mode.  Other modes help testing USB controllers 
+ * support the OTG mode.  Other modes help testing USB controllers
  * in isolation from (full) OTG support, or maybe so later board
  * revisions can help to support those feature.
  */
@@ -1260,9 +1259,9 @@ static int isp1301_otg_enable(struct isp1301 *isp)
         * a few more interrupts than are strictly needed.
         */
        isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
-               INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
+               INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
        isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
-               INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
+               INTR_VBUS_VLD | INTR_SESS_VLD | INTR_ID_GND);
 
        dev_info(&isp->client.dev, "ready for dual-role USB ...\n");
 
@@ -1306,9 +1305,9 @@ isp1301_set_host(struct otg_transceiver *otg, struct usb_bus *host)
 
        dev_info(&isp->client.dev, "A-Host sessions ok\n");
        isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
-               INTR_ID_GND);
+               INTR_ID_GND);
        isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
-               INTR_ID_GND);
+               INTR_ID_GND);
 
        /* If this has a Mini-AB connector, this mode is highly
         * nonstandard ... but can be handy for testing, especially with
@@ -1368,9 +1367,9 @@ isp1301_set_peripheral(struct otg_transceiver *otg, struct usb_gadget *gadget)
                isp1301_set_bits(isp, ISP1301_MODE_CONTROL_1, MC1_DAT_SE0);
 
        isp1301_set_bits(isp, ISP1301_INTERRUPT_RISING,
-               INTR_SESS_VLD);
+               INTR_SESS_VLD);
        isp1301_set_bits(isp, ISP1301_INTERRUPT_FALLING,
-               INTR_VBUS_VLD);
+               INTR_VBUS_VLD);
        dev_info(&isp->client.dev, "B-Peripheral sessions ok\n");
        dump_regs(isp, __FUNCTION__);
 
@@ -1494,7 +1493,7 @@ static int isp1301_probe(struct i2c_adapter *bus, int address, int kind)
        if (!isp)
                return 0;
 
-       INIT_WORK(&isp->work, isp1301_work, isp);
+       INIT_WORK(&isp->work, isp1301_work);
        init_timer(&isp->timer);
        isp->timer.function = isp1301_timer;
        isp->timer.data = (unsigned long) isp;
@@ -1572,13 +1571,14 @@ fail1:
                /* IRQ wired at M14 */
                omap_cfg_reg(M14_1510_GPIO2);
                isp->irq = OMAP_GPIO_IRQ(2);
-               omap_request_gpio(2);
-               omap_set_gpio_direction(2, 1);
-               omap_set_gpio_edge_ctrl(2, OMAP_GPIO_FALLING_EDGE);
+               if (gpio_request(2, "isp1301") == 0)
+                       gpio_direction_input(2);
+               isp->irq_type = IRQF_TRIGGER_FALLING;
        }
 
+       isp->irq_type |= IRQF_SAMPLE_RANDOM;
        status = request_irq(isp->irq, isp1301_irq,
-                       IRQF_SAMPLE_RANDOM, DRIVER_NAME, isp);
+                       isp->irq_type, DRIVER_NAME, isp);
        if (status < 0) {
                dev_dbg(&i2c->dev, "can't get IRQ %d, err %d\n",
                                isp->irq, status);
index 48a7e2f0bdd3c87d9385bd32bb675d52abd88835..d9c92c5e007730ac62f7140ef51f5edb9d5eafb3 100644 (file)
@@ -1,4 +1,3 @@
-#define DEBUG
 /*
  * Copyright (C) 2004 Texas Instruments, Inc.
  *
@@ -933,7 +932,7 @@ static int menelaus_set_time(struct device *dev, struct rtc_time *t)
                return status;
        status = menelaus_write_reg(MENELAUS_RTC_WKDAY, BIN2BCD(t->tm_wday));
        if (status < 0) {
-               dev_err(&the_menelaus->client->dev, "rtc write reg %02x",
+               dev_err(&the_menelaus->client->dev, "rtc write reg %02x "
                                "err %d\n", MENELAUS_RTC_WKDAY, status);
                return status;
        }
index 3c3f2ebf3fc9786eecf042ed4aa1d1ae9a56c9c3..503ffec2ce07c4f78ad04013b36d35c88d7d68ee 100644 (file)
@@ -352,7 +352,7 @@ static void tps65010_interrupt(struct tps65010 *tps)
                        /* REVISIT:  this might need its own workqueue
                         * plus tweaks including deadlock avoidance ...
                         * also needs to get error handling and probably
-                        * an #ifdef CONFIG_SOFTWARE_SUSPEND
+                        * an #ifdef CONFIG_HIBERNATION
                         */
                        hibernate();
 #endif
index b1a9b81c211fad756afad1216e0b582ca282b1c9..e049f65bc3a2f41ac75de5b7598573119519498d 100644 (file)
@@ -833,7 +833,7 @@ config BLK_DEV_IDE_AU1XXX_SEQTS_PER_RQ
        depends on BLK_DEV_IDE_AU1XXX
 
 config IDE_ARM
-       def_bool ARM && (ARCH_A5K || ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
+       def_bool ARM && (ARCH_CLPS7500 || ARCH_RPC || ARCH_SHARK)
 
 config BLK_DEV_IDE_ICSIDE
        tristate "ICS IDE interface support"
index c89b5f4b2d043b09a418cb408d393582b9cb01c2..8a9b98fcb66dca0acd2225df5b8ceebc14055949 100644 (file)
@@ -693,13 +693,12 @@ icside_probe(struct expansion_card *ec, const struct ecard_id *id)
        if (ret)
                goto out;
 
-       state = kmalloc(sizeof(struct icside_state), GFP_KERNEL);
+       state = kzalloc(sizeof(struct icside_state), GFP_KERNEL);
        if (!state) {
                ret = -ENOMEM;
                goto release;
        }
 
-       memset(state, 0, sizeof(state));
        state->type     = ICS_TYPE_NOTYPE;
        state->dev      = &ec->dev;
 
index a3d6744e870a18870e7b98a23129e76b78cce34c..bce2bec81413eafa8f9358bb81efc3306ca7ad83 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * ARM/ARM26 default IDE host driver
+ * ARM default IDE host driver
  *
  * Copyright (C) 2004 Bartlomiej Zolnierkiewicz
  * Based on code by: Russell King, Ian Molton and Alexander Schulz.
 #include <asm/mach-types.h>
 #include <asm/irq.h>
 
-#ifdef CONFIG_ARM26
-# define IDE_ARM_HOST  (machine_is_a5k())
-#else
-# define IDE_ARM_HOST  (1)
-#endif
-
 #ifdef CONFIG_ARCH_CLPS7500
 # include <asm/arch/hardware.h>
 #
 
 void __init ide_arm_init(void)
 {
-       if (IDE_ARM_HOST) {
-               hw_regs_t hw;
+       hw_regs_t hw;
 
-               memset(&hw, 0, sizeof(hw));
-               ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
-               hw.irq = IDE_ARM_IRQ;
-               ide_register_hw(&hw, 1, NULL);
-       }
+       memset(&hw, 0, sizeof(hw));
+       ide_std_init_ports(&hw, IDE_ARM_IO, IDE_ARM_IO + 0x206);
+       hw.irq = IDE_ARM_IRQ;
+       ide_register_hw(&hw, 1, NULL);
 }
index e82bfa5e0ab88a383cff8d665cb0fe7d1f78d758..1fa57947bca0777a3b173aa8011edfb251edded3 100644 (file)
@@ -640,7 +640,7 @@ typedef enum {
 } idetape_chrdev_direction_t;
 
 struct idetape_bh {
-       unsigned short b_size;
+       u32 b_size;
        atomic_t b_count;
        struct idetape_bh *b_reqnext;
        char *b_data;
index 5511c86733dc6162649b2f66462049f20b49ecc5..025689de50e9e6b5e420cdcdf89504759946f043 100644 (file)
@@ -593,7 +593,7 @@ static struct dmi_system_id cable_dmi_table[] = {
                .ident = "HP Pavilion N5430",
                .matches = {
                        DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
-                       DMI_MATCH(DMI_BOARD_NAME, "OmniBook N32N-736"),
+                       DMI_MATCH(DMI_BOARD_VERSION, "OmniBook N32N-736"),
                },
        },
        { }
index 19633c5aba15190925b6872d03293fe7e5475e88..0e3b5de26e698a73b7976f4eb2358ab63e3fbc18 100644 (file)
@@ -475,11 +475,11 @@ static unsigned int __devinit init_chipset_cmd64x(struct pci_dev *dev, const cha
                switch (rev) {
                case 0x07:
                case 0x05:
-                       printk("%s: UltraDMA capable", name);
+                       printk("%s: UltraDMA capable\n", name);
                        break;
                case 0x03:
                default:
-                       printk("%s: MultiWord DMA force limited", name);
+                       printk("%s: MultiWord DMA force limited\n", name);
                        break;
                case 0x01:
                        printk("%s: MultiWord DMA limited, "
index bccedf9b8b28c7160895398b21902a97b86c9c67..b89e816568751c53423a3bd5070e2d76b2aae87d 100644 (file)
@@ -133,7 +133,7 @@ static void cs5520_tune_drive(ide_drive_t *drive, u8 pio)
 static int cs5520_config_drive_xfer_rate(ide_drive_t *drive)
 {
        /* Tune the drive for PIO modes up to PIO 4 */  
-       cs5520_tune_drive(drive, 4);
+       cs5520_tune_drive(drive, 255);
 
        /* Then tell the core to use DMA operations */
        return 0;
index ce44e38390aa9e8bec5232ba1f9304f191dc6c07..082ca7da2cbcd0e2f85d5aebce929aa27fa07995 100644 (file)
@@ -2,6 +2,7 @@
  * linux/drivers/ide/pci/cs5535.c
  *
  * Copyright (C) 2004-2005 Advanced Micro Devices, Inc.
+ * Copyright (C)      2007 Bartlomiej Zolnierkiewicz
  *
  * History:
  * 09/20/2005 - Jaya Kumar <jayakumar.ide@gmail.com>
@@ -83,14 +84,17 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
 
        /* Set the PIO timings */
        if ((speed & XFER_MODE) == XFER_PIO) {
-               u8 pioa;
-               u8 piob;
-               u8 cmd;
+               ide_drive_t *pair = &drive->hwif->drives[drive->dn ^ 1];
+               u8 cmd, pioa;
 
-               pioa = speed - XFER_PIO_0;
-               piob = ide_get_best_pio_mode(&(drive->hwif->drives[!unit]),
-                                               255, 4);
-               cmd = pioa < piob ? pioa : piob;
+               cmd = pioa = speed - XFER_PIO_0;
+
+               if (pair->present) {
+                       u8 piob = ide_get_best_pio_mode(pair, 255, 4);
+
+                       if (piob < cmd)
+                               cmd = piob;
+               }
 
                /* Write the speed of the current drive */
                reg = (cs5535_pio_cmd_timings[cmd] << 16) |
@@ -116,7 +120,7 @@ static void cs5535_set_speed(ide_drive_t *drive, u8 speed)
 
                reg &= 0x80000000UL;  /* Preserve the PIO format bit */
 
-               if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_7)
+               if (speed >= XFER_UDMA_0 && speed <= XFER_UDMA_4)
                        reg |= cs5535_udma_timings[speed - XFER_UDMA_0];
                else if (speed >= XFER_MW_DMA_0 && speed <= XFER_MW_DMA_2)
                        reg |= cs5535_mwdma_timings[speed - XFER_MW_DMA_0];
@@ -151,32 +155,22 @@ static int cs5535_set_drive(ide_drive_t *drive, u8 speed)
  *
  *     A callback from the upper layers for PIO-only tuning.
  */
-static void cs5535_tuneproc(ide_drive_t *drive, u8 xferspeed)
+static void cs5535_tuneproc(ide_drive_t *drive, u8 pio)
 {
-       u8 modes[] = {  XFER_PIO_0, XFER_PIO_1, XFER_PIO_2, XFER_PIO_3,
-                       XFER_PIO_4 };
-
-       /* cs5535 max pio is pio 4, best_pio will check the blacklist.
-       i think we don't need to rate_filter the incoming xferspeed
-       since we know we're only going to choose pio */
-       xferspeed = ide_get_best_pio_mode(drive, xferspeed, 4);
-       ide_config_drive_speed(drive, modes[xferspeed]);
-       cs5535_set_speed(drive, xferspeed);
+       pio = ide_get_best_pio_mode(drive, pio, 4);
+       ide_config_drive_speed(drive, XFER_PIO_0 + pio);
+       cs5535_set_speed(drive, XFER_PIO_0 + pio);
 }
 
 static int cs5535_dma_check(ide_drive_t *drive)
 {
-       u8 speed;
-
        drive->init_speed = 0;
 
        if (ide_tune_dma(drive))
                return 0;
 
-       if (ide_use_fast_pio(drive)) {
-               speed = ide_get_best_pio_mode(drive, 255, 4);
-               cs5535_set_drive(drive, speed);
-       }
+       if (ide_use_fast_pio(drive))
+               cs5535_tuneproc(drive, 255);
 
        return -1;
 }
index 95dbed7e6022b839ebc5467bbb31e82909ecfa71..70b3245dbf62d59db907faba1ade0f3804af4616 100644 (file)
@@ -21,7 +21,7 @@
  *     it8213_dma_2_pio                -       return the PIO mode matching DMA
  *     @xfer_rate: transfer speed
  *
- *     Returns the nearest equivalent PIO timing for the PIO or DMA
+ *     Returns the nearest equivalent PIO timing for the DMA
  *     mode requested by the controller.
  */
 
@@ -35,34 +35,28 @@ static u8 it8213_dma_2_pio (u8 xfer_rate) {
                case XFER_UDMA_1:
                case XFER_UDMA_0:
                case XFER_MW_DMA_2:
-               case XFER_PIO_4:
                        return 4;
                case XFER_MW_DMA_1:
-               case XFER_PIO_3:
                        return 3;
                case XFER_SW_DMA_2:
-               case XFER_PIO_2:
                        return 2;
                case XFER_MW_DMA_0:
                case XFER_SW_DMA_1:
                case XFER_SW_DMA_0:
-               case XFER_PIO_1:
-               case XFER_PIO_0:
-               case XFER_PIO_SLOW:
                default:
                        return 0;
        }
 }
 
 /*
- *     it8213_tuneproc -       tune a drive
+ *     it8213_tune_pio -       tune a drive
  *     @drive: drive to tune
  *     @pio: desired PIO mode
  *
  *     Set the interface PIO mode.
  */
 
-static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
+static void it8213_tune_pio(ide_drive_t *drive, const u8 pio)
 {
        ide_hwif_t *hwif        = HWIF(drive);
        struct pci_dev *dev     = hwif->pci_dev;
@@ -82,8 +76,6 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
                                        { 2, 1 },
                                        { 2, 3 }, };
 
-       pio = ide_get_best_pio_mode(drive, pio, 4);
-
        spin_lock_irqsave(&tune_lock, flags);
        pci_read_config_word(dev, master_port, &master_data);
 
@@ -113,6 +105,13 @@ static void it8213_tuneproc (ide_drive_t *drive, u8 pio)
        spin_unlock_irqrestore(&tune_lock, flags);
 }
 
+static void it8213_tuneproc(ide_drive_t *drive, u8 pio)
+{
+       pio = ide_get_best_pio_mode(drive, pio, 4);
+       it8213_tune_pio(drive, pio);
+       ide_config_drive_speed(drive, XFER_PIO_0 + pio);
+}
+
 /**
  *     it8213_tune_chipset     -       set controller timings
  *     @drive: Drive to set up
@@ -193,7 +192,12 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)
                if (reg55 & w_flag)
                        pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
        }
-       it8213_tuneproc(drive, it8213_dma_2_pio(speed));
+
+       if (speed > XFER_PIO_4)
+               it8213_tune_pio(drive, it8213_dma_2_pio(speed));
+       else
+               it8213_tune_pio(drive, speed - XFER_PIO_0);
+
        return ide_config_drive_speed(drive, speed);
 }
 
@@ -209,13 +213,10 @@ static int it8213_tune_chipset (ide_drive_t *drive, u8 xferspeed)
 
 static int it8213_config_drive_for_dma (ide_drive_t *drive)
 {
-       u8 pio;
-
        if (ide_tune_dma(drive))
                return 0;
 
-       pio = ide_get_best_pio_mode(drive, 255, 4);
-       it8213_tune_chipset(drive, XFER_PIO_0 + pio);
+       it8213_tuneproc(drive, 255);
 
        return -1;
 }
index d7ce9dd8de1645528c008b2421e37bc2c0f91241..65a0ff352b98e3315a19418dc047396ee1fe0238 100644 (file)
@@ -83,23 +83,10 @@ static u8 __devinit ata66_jmicron(ide_hwif_t *hwif)
        return ATA_CBL_PATA80;
 }
 
-static void jmicron_tuneproc (ide_drive_t *drive, byte mode_wanted)
+static void jmicron_tuneproc(ide_drive_t *drive, u8 pio)
 {
-       return;
-}
-
-/**
- *     config_jmicron_chipset_for_pio  -       set drive timings
- *     @drive: drive to tune
- *     @speed we want
- *
- */
-
-static void config_jmicron_chipset_for_pio (ide_drive_t *drive, byte set_speed)
-{
-       u8 speed = XFER_PIO_0 + ide_get_best_pio_mode(drive, 255, 5);
-       if (set_speed)
-               (void) ide_config_drive_speed(drive, speed);
+       pio = ide_get_best_pio_mode(drive, pio, 5);
+       ide_config_drive_speed(drive, XFER_PIO_0 + pio);
 }
 
 /**
@@ -132,7 +119,7 @@ static int jmicron_config_drive_for_dma (ide_drive_t *drive)
        if (ide_tune_dma(drive))
                return 0;
 
-       config_jmicron_chipset_for_pio(drive, 1);
+       jmicron_tuneproc(drive, 255);
 
        return -1;
 }
index 4f69cd067e5ec3b8a1705bd58a5bb72fcb5099d5..5cfa9378bbb88b27a6b144eb7eb4ce0117d558be 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/pci/piix.c       Version 0.50    Jun 10, 2007
+ *  linux/drivers/ide/pci/piix.c       Version 0.51    Jul 6, 2007
  *
  *  Copyright (C) 1998-1999 Andrzej Krzysztofowicz, Author and Maintainer
  *  Copyright (C) 1998-2000 Andre Hedrick <andre@linux-ide.org>
@@ -109,7 +109,7 @@ static int no_piix_dma;
  *     piix_dma_2_pio          -       return the PIO mode matching DMA
  *     @xfer_rate: transfer speed
  *
- *     Returns the nearest equivalent PIO timing for the PIO or DMA
+ *     Returns the nearest equivalent PIO timing for the DMA
  *     mode requested by the controller.
  */
  
@@ -123,20 +123,14 @@ static u8 piix_dma_2_pio (u8 xfer_rate) {
                case XFER_UDMA_1:
                case XFER_UDMA_0:
                case XFER_MW_DMA_2:
-               case XFER_PIO_4:
                        return 4;
                case XFER_MW_DMA_1:
-               case XFER_PIO_3:
                        return 3;
                case XFER_SW_DMA_2:
-               case XFER_PIO_2:
                        return 2;
                case XFER_MW_DMA_0:
                case XFER_SW_DMA_1:
                case XFER_SW_DMA_0:
-               case XFER_PIO_1:
-               case XFER_PIO_0:
-               case XFER_PIO_SLOW:
                default:
                        return 0;
        }
@@ -269,6 +263,7 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
                case XFER_PIO_4:
                case XFER_PIO_3:
                case XFER_PIO_2:
+               case XFER_PIO_1:
                case XFER_PIO_0:        break;
                default:                return -1;
        }
@@ -299,7 +294,11 @@ static int piix_tune_chipset (ide_drive_t *drive, u8 xferspeed)
                        pci_write_config_byte(dev, 0x55, (u8) reg55 & ~w_flag);
        }
 
-       piix_tune_pio(drive, piix_dma_2_pio(speed));
+       if (speed > XFER_PIO_4)
+               piix_tune_pio(drive, piix_dma_2_pio(speed));
+       else
+               piix_tune_pio(drive, speed - XFER_PIO_0);
+
        return ide_config_drive_speed(drive, speed);
 }
 
index f668d235e6be25a2a91de82dd18d052ad08b1887..eeb0a6d434aaaeee3a0f97307838595b09150db2 100644 (file)
@@ -190,7 +190,7 @@ scc_ide_outsl(unsigned long port, void *addr, u32 count)
 }
 
 /**
- *     scc_tuneproc    -       tune a drive PIO mode
+ *     scc_tune_pio    -       tune a drive PIO mode
  *     @drive: drive to tune
  *     @mode_wanted: the target operating mode
  *
@@ -198,7 +198,7 @@ scc_ide_outsl(unsigned long port, void *addr, u32 count)
  *     controller.
  */
 
-static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted)
+static void scc_tune_pio(ide_drive_t *drive, const u8 pio)
 {
        ide_hwif_t *hwif = HWIF(drive);
        struct scc_ports *ports = ide_get_hwifdata(hwif);
@@ -207,41 +207,25 @@ static void scc_tuneproc(ide_drive_t *drive, byte mode_wanted)
        unsigned long piosht_port = ctl_base + 0x000;
        unsigned long pioct_port = ctl_base + 0x004;
        unsigned long reg;
-       unsigned char speed = XFER_PIO_0;
        int offset;
 
-       mode_wanted = ide_get_best_pio_mode(drive, mode_wanted, 4);
-       switch (mode_wanted) {
-       case 4:
-               speed = XFER_PIO_4;
-               break;
-       case 3:
-               speed = XFER_PIO_3;
-               break;
-       case 2:
-               speed = XFER_PIO_2;
-               break;
-       case 1:
-               speed = XFER_PIO_1;
-               break;
-       case 0:
-       default:
-               speed = XFER_PIO_0;
-               break;
-       }
-
        reg = in_be32((void __iomem *)cckctrl_port);
        if (reg & CCKCTRL_ATACLKOEN) {
                offset = 1; /* 133MHz */
        } else {
                offset = 0; /* 100MHz */
        }
-       reg = JCHSTtbl[offset][mode_wanted] << 16 | JCHHTtbl[offset][mode_wanted];
+       reg = JCHSTtbl[offset][pio] << 16 | JCHHTtbl[offset][pio];
        out_be32((void __iomem *)piosht_port, reg);
-       reg = JCHCTtbl[offset][mode_wanted];
+       reg = JCHCTtbl[offset][pio];
        out_be32((void __iomem *)pioct_port, reg);
+}
 
-       ide_config_drive_speed(drive, speed);
+static void scc_tuneproc(ide_drive_t *drive, u8 pio)
+{
+       pio = ide_get_best_pio_mode(drive, pio, 4);
+       scc_tune_pio(drive, pio);
+       ide_config_drive_speed(drive, XFER_PIO_0 + pio);
 }
 
 /**
@@ -280,26 +264,21 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
 
        switch (speed) {
        case XFER_UDMA_6:
-               idx = 6;
-               break;
        case XFER_UDMA_5:
-               idx = 5;
-               break;
        case XFER_UDMA_4:
-               idx = 4;
-               break;
        case XFER_UDMA_3:
-               idx = 3;
-               break;
        case XFER_UDMA_2:
-               idx = 2;
-               break;
        case XFER_UDMA_1:
-               idx = 1;
-               break;
        case XFER_UDMA_0:
-               idx = 0;
+               idx = speed - XFER_UDMA_0;
                break;
+       case XFER_PIO_4:
+       case XFER_PIO_3:
+       case XFER_PIO_2:
+       case XFER_PIO_1:
+       case XFER_PIO_0:
+               scc_tune_pio(drive, speed - XFER_PIO_0);
+               return ide_config_drive_speed(drive, speed);
        default:
                return 1;
        }
@@ -329,7 +308,7 @@ static int scc_tune_chipset(ide_drive_t *drive, byte xferspeed)
  *     required.
  *      If the drive isn't suitable for DMA or we hit other problems
  *      then we will drop down to PIO and set up PIO appropriately.
- *      (return 1)
+ *      (return -1)
  */
 
 static int scc_config_drive_for_dma(ide_drive_t *drive)
@@ -338,7 +317,7 @@ static int scc_config_drive_for_dma(ide_drive_t *drive)
                return 0;
 
        if (ide_use_fast_pio(drive))
-               scc_tuneproc(drive, 4);
+               scc_tuneproc(drive, 255);
 
        return -1;
 }
@@ -551,8 +530,8 @@ static int setup_mmio_scc (struct pci_dev *dev, const char *name)
        unsigned long dma_base = pci_resource_start(dev, 1);
        unsigned long ctl_size = pci_resource_len(dev, 0);
        unsigned long dma_size = pci_resource_len(dev, 1);
-       void *ctl_addr;
-       void *dma_addr;
+       void __iomem *ctl_addr;
+       void __iomem *dma_addr;
        int i;
 
        for (i = 0; i < MAX_HWIFS; i++) {
index 63fbb79e8178d7800642a3656c712faa5d0fc2b5..26f24802d3e895445711f639f00d4f832d1fe212 100644 (file)
@@ -801,6 +801,7 @@ struct sis_laptop {
 static const struct sis_laptop sis_laptop[] = {
        /* devid, subvendor, subdev */
        { 0x5513, 0x1043, 0x1107 },     /* ASUS A6K */
+       { 0x5513, 0x1734, 0x105f },     /* FSC Amilo A1630 */
        /* end marker */
        { 0, }
 };
index 8e655f2db5cb6936bc78c223e2fdfca7652b4897..628b0664f57672e9802b9f715529f668c4fa08de 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/ide/pci/slc90e66.c   Version 0.14    February 8, 2007
+ *  linux/drivers/ide/pci/slc90e66.c   Version 0.15    Jul 6, 2007
  *
  *  Copyright (C) 2000-2002 Andre Hedrick <andre@linux-ide.org>
  *  Copyright (C) 2006-2007 MontaVista Software, Inc. <source@mvista.com>
@@ -29,20 +29,14 @@ static u8 slc90e66_dma_2_pio (u8 xfer_rate) {
                case XFER_UDMA_1:
                case XFER_UDMA_0:
                case XFER_MW_DMA_2:
-               case XFER_PIO_4:
                        return 4;
                case XFER_MW_DMA_1:
-               case XFER_PIO_3:
                        return 3;
                case XFER_SW_DMA_2:
-               case XFER_PIO_2:
                        return 2;
                case XFER_MW_DMA_0:
                case XFER_SW_DMA_1:
                case XFER_SW_DMA_0:
-               case XFER_PIO_1:
-               case XFER_PIO_0:
-               case XFER_PIO_SLOW:
                default:
                        return 0;
        }
@@ -136,6 +130,7 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
                case XFER_PIO_4:
                case XFER_PIO_3:
                case XFER_PIO_2:
+               case XFER_PIO_1:
                case XFER_PIO_0:        break;
                default:                return -1;
        }
@@ -156,7 +151,11 @@ static int slc90e66_tune_chipset (ide_drive_t *drive, u8 xferspeed)
                        pci_write_config_word(dev, 0x4a, reg4a & ~a_speed);
        }
 
-       slc90e66_tune_pio(drive, slc90e66_dma_2_pio(speed));
+       if (speed > XFER_PIO_4)
+               slc90e66_tune_pio(drive, slc90e66_dma_2_pio(speed));
+       else
+               slc90e66_tune_pio(drive, speed - XFER_PIO_0);
+
        return ide_config_drive_speed(drive, speed);
 }
 
index 8012b3b0ce75b83c23ae81f872fadb645167e3f1..545663ef820b3992211d4dab31a05ea28f7272c4 100644 (file)
@@ -97,7 +97,7 @@ config IEEE1394_SBP2
 
 config IEEE1394_SBP2_PHYS_DMA
        bool "Enable replacement for physical DMA in SBP2"
-       depends on IEEE1394 && IEEE1394_SBP2 && EXPERIMENTAL && (X86_32 || PPC_32)
+       depends on IEEE1394_SBP2 && VIRT_TO_BUS && EXPERIMENTAL
        help
          This builds sbp2 for use with non-OHCI host adapters which do not
          support physical DMA or for when ohci1394 is run with phys_dma=0.
index 336e5ff4cfcf6f111cf5c57d6a043c5767d1513d..cadf0479cce54d7b0150aaa833114d2b9b8f2b7e 100644 (file)
@@ -2677,7 +2677,7 @@ static long raw1394_iso_xmit_recv_packets32(struct file *file, unsigned int cmd,
                                           struct raw1394_iso_packets32 __user *arg)
 {
        compat_uptr_t infos32;
-       void *infos;
+       void __user *infos;
        long err = -EFAULT;
        struct raw1394_iso_packets __user *dst = compat_alloc_user_space(sizeof(struct raw1394_iso_packets));
 
index e882cb951b474e06a11a861327f8dde7c73d316f..47dbe8f17e8210cabe7b87254b7ba1ac329a1c9d 100644 (file)
@@ -773,11 +773,6 @@ static struct sbp2_lu *sbp2_alloc_device(struct unit_directory *ud)
                        SBP2_ERR("failed to register lower 4GB address range");
                        goto failed_alloc;
                }
-#else
-               if (dma_set_mask(hi->host->device.parent, DMA_32BIT_MASK)) {
-                       SBP2_ERR("failed to set 4GB DMA mask");
-                       goto failed_alloc;
-               }
 #endif
        }
 
index 420c1380f5c3f5bddb9534c08621d4869f7e36c7..01d07862ea86257330958377032283d95201498d 100644 (file)
@@ -506,6 +506,7 @@ int c2_alloc_qp(struct c2_dev *c2dev,
        qp->send_sgl_depth = qp_attrs->cap.max_send_sge;
        qp->rdma_write_sgl_depth = qp_attrs->cap.max_send_sge;
        qp->recv_sgl_depth = qp_attrs->cap.max_recv_sge;
+       init_waitqueue_head(&qp->wait);
 
        /* Initialize the SQ MQ */
        q_size = be32_to_cpu(reply->sq_depth);
index 3725aa8664d9b59360ed608eb2c6ab1c024b3b8c..b5e96030531642c7a95fc6141d1a4228137fa3ac 100644 (file)
@@ -322,6 +322,7 @@ extern int ehca_static_rate;
 extern int ehca_port_act_time;
 extern int ehca_use_hp_mr;
 extern int ehca_scaling_code;
+extern int ehca_mr_largepage;
 
 struct ipzu_queue_resp {
        u32 qe_size;      /* queue entry size */
index 71c0799b3500503fd4d8e751e1284943a00b54f6..ee06d8bd73965997d48fd9aac49c699dcfabc48c 100644 (file)
@@ -116,7 +116,7 @@ static void print_error_data(struct ehca_shca *shca, void *data,
        }
        default:
                ehca_err(&shca->ib_device,
-                        "Unknown errror type: %lx on %s.",
+                        "Unknown error type: %lx on %s.",
                         type, shca->ib_device.name);
                break;
        }
index c1b868b79d677bf6a8caf0d2ff0532d860082e71..d97eda3e1da0e15f4e131b30cc6c71f270fb912c 100644 (file)
  * POSSIBILITY OF SUCH DAMAGE.
  */
 
-#include <rdma/ib_umem.h>
-
 #include <asm/current.h>
 
+#include <rdma/ib_umem.h>
+
 #include "ehca_iverbs.h"
 #include "ehca_mrmw.h"
 #include "hcp_if.h"
@@ -64,8 +64,6 @@ enum ehca_mr_pgsize {
        EHCA_MR_PGSIZE16M = 0x1000000L
 };
 
-extern int ehca_mr_largepage;
-
 static u32 ehca_encode_hwpage_size(u32 pgsize)
 {
        u32 idx = 0;
index 3dafd7ff36cd52a636ef938dafeaacbc52fd045f..43bcf085fcf21808c11b6075cc6fd4d80e7f926d 100644 (file)
@@ -88,7 +88,6 @@ int ehca_dealloc_pd(struct ib_pd *pd)
        u32 cur_pid = current->tgid;
        struct ehca_pd *my_pd = container_of(pd, struct ehca_pd, ib_pd);
        int i, leftovers = 0;
-       extern struct kmem_cache *small_qp_cache;
        struct ipz_small_queue_page *page, *tmp;
 
        if (my_pd->ib_pd.uobject && my_pd->ib_pd.uobject->context &&
index fdbfebea7d114d1f32db3eabfdfb58d291be9a72..24f454162f2479029255a3b4097a6ad7b0a61c0b 100644 (file)
@@ -758,7 +758,6 @@ u64 hipz_h_register_rpage_mr(const struct ipz_adapter_handle adapter_handle,
                             const u64 logical_address_of_page,
                             const u64 count)
 {
-       extern int ehca_debug_level;
        u64 ret;
 
        if (unlikely(ehca_debug_level >= 2)) {
index c6937a044e8a72e724abb65f01bd5ebe17e706ea..a801274ea337ae08c0a463170bb0688a325d326a 100644 (file)
@@ -54,6 +54,8 @@
 struct ehca_pd;
 struct ipz_small_queue_page;
 
+extern struct kmem_cache *small_qp_cache;
+
 /* struct generic ehca page */
 struct ipz_page {
        u8 entries[EHCA_PAGESIZE];
index b4b786d0dfcaaafff0af2bc45465c6b32984f3a7..6ad822c35930417c558dba5f14e9f6dcb81df182 100644 (file)
@@ -100,8 +100,7 @@ struct infinipath_stats {
        __u64 sps_hwerrs;
        /* number of times IB link changed state unexpectedly */
        __u64 sps_iblink;
-       /* kernel receive interrupts that didn't read intstat */
-       __u64 sps_fastrcvint;
+       __u64 sps_unused; /* was fastrcvint, no longer implemented */
        /* number of kernel (port0) packets received */
        __u64 sps_port0pkts;
        /* number of "ethernet" packets sent by driver */
index a698f1949d1040da508c1c727acca8bf6bb24dbb..cf25cdab02f9dd3efa5af610d200cf6211b9b85a 100644 (file)
@@ -44,6 +44,7 @@
 #include <linux/io.h>
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
+#include <linux/fs.h>
 #include <asm/uaccess.h>
 
 #include "ipath_kernel.h"
index 09c5fd84b1e335cce7b82cd49a7b1b1d899fd010..6ccba365a24c90821edfd3a247692221318bf57b 100644 (file)
@@ -740,7 +740,7 @@ void ipath_disarm_piobufs(struct ipath_devdata *dd, unsigned first,
         * pioavail updates to memory to stop.
         */
        ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
-                        sendorig & ~IPATH_S_PIOBUFAVAILUPD);
+                        sendorig & ~INFINIPATH_S_PIOBUFAVAILUPD);
        sendorig = ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
        ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
                         dd->ipath_sendctrl);
@@ -1614,7 +1614,7 @@ int ipath_waitfor_mdio_cmdready(struct ipath_devdata *dd)
  * it's safer to always do it.
  * PIOAvail bits are updated by the chip as if normal send had happened.
  */
-void ipath_cancel_sends(struct ipath_devdata *dd)
+void ipath_cancel_sends(struct ipath_devdata *dd, int restore_sendctrl)
 {
        ipath_dbg("Cancelling all in-progress send buffers\n");
        dd->ipath_lastcancel = jiffies+HZ/2; /* skip armlaunch errs a bit */
@@ -1627,6 +1627,9 @@ void ipath_cancel_sends(struct ipath_devdata *dd)
        ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
        ipath_disarm_piobufs(dd, 0,
                (unsigned)(dd->ipath_piobcnt2k + dd->ipath_piobcnt4k));
+       if (restore_sendctrl) /* else done by caller later */
+               ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
+                                dd->ipath_sendctrl);
 
        /* and again, be sure all have hit the chip */
        ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
@@ -1655,7 +1658,7 @@ static void ipath_set_ib_lstate(struct ipath_devdata *dd, int which)
        /* flush all queued sends when going to DOWN or INIT, to be sure that
         * they don't block MAD packets */
        if (!linkcmd || linkcmd == INFINIPATH_IBCC_LINKCMD_INIT)
-               ipath_cancel_sends(dd);
+               ipath_cancel_sends(dd, 1);
 
        ipath_write_kreg(dd, dd->ipath_kregs->kr_ibcctrl,
                         dd->ipath_ibcctrl | which);
@@ -2000,7 +2003,7 @@ void ipath_shutdown_device(struct ipath_devdata *dd)
 
        ipath_set_ib_lstate(dd, INFINIPATH_IBCC_LINKINITCMD_DISABLE <<
                            INFINIPATH_IBCC_LINKINITCMD_SHIFT);
-       ipath_cancel_sends(dd);
+       ipath_cancel_sends(dd, 0);
 
        /* disable IBC */
        dd->ipath_control &= ~INFINIPATH_C_LINKENABLE;
index 9868ccda5f26769b66dc76593ef107a53a5630f2..5b6ac9a1a7095ba28ec986ecd89a90e4939fdb02 100644 (file)
@@ -321,6 +321,8 @@ static const struct ipath_hwerror_msgs ipath_6120_hwerror_msgs[] = {
                        << INFINIPATH_HWE_TXEMEMPARITYERR_SHIFT)
 
 static int ipath_pe_txe_recover(struct ipath_devdata *);
+static void ipath_pe_put_tid_2(struct ipath_devdata *, u64 __iomem *,
+                              u32, unsigned long);
 
 /**
  * ipath_pe_handle_hwerrors - display hardware errors.
@@ -555,8 +557,11 @@ static int ipath_pe_boardname(struct ipath_devdata *dd, char *name,
                ipath_dev_err(dd, "Unsupported InfiniPath hardware revision %u.%u!\n",
                              dd->ipath_majrev, dd->ipath_minrev);
                ret = 1;
-       } else
+       } else {
                ret = 0;
+               if (dd->ipath_minrev >= 2)
+                       dd->ipath_f_put_tid = ipath_pe_put_tid_2;
+       }
 
        return ret;
 }
@@ -1220,7 +1225,7 @@ static void ipath_pe_clear_tids(struct ipath_devdata *dd, unsigned port)
                 port * dd->ipath_rcvtidcnt * sizeof(*tidbase));
 
        for (i = 0; i < dd->ipath_rcvtidcnt; i++)
-               ipath_pe_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EXPECTED,
+               dd->ipath_f_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EXPECTED,
                                 tidinv);
 
        tidbase = (u64 __iomem *)
@@ -1229,7 +1234,7 @@ static void ipath_pe_clear_tids(struct ipath_devdata *dd, unsigned port)
                 port * dd->ipath_rcvegrcnt * sizeof(*tidbase));
 
        for (i = 0; i < dd->ipath_rcvegrcnt; i++)
-               ipath_pe_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EAGER,
+               dd->ipath_f_put_tid(dd, &tidbase[i], RCVHQ_RCV_TYPE_EAGER,
                                 tidinv);
 }
 
@@ -1395,10 +1400,11 @@ void ipath_init_iba6120_funcs(struct ipath_devdata *dd)
        dd->ipath_f_quiet_serdes = ipath_pe_quiet_serdes;
        dd->ipath_f_bringup_serdes = ipath_pe_bringup_serdes;
        dd->ipath_f_clear_tids = ipath_pe_clear_tids;
-       if (dd->ipath_minrev >= 2)
-               dd->ipath_f_put_tid = ipath_pe_put_tid_2;
-       else
-               dd->ipath_f_put_tid = ipath_pe_put_tid;
+       /*
+        * this may get changed after we read the chip revision,
+        * but we start with the safe version for all revs
+        */
+       dd->ipath_f_put_tid = ipath_pe_put_tid;
        dd->ipath_f_cleanup = ipath_setup_pe_cleanup;
        dd->ipath_f_setextled = ipath_setup_pe_setextled;
        dd->ipath_f_get_base_info = ipath_pe_get_base_info;
index 49951d5838049349df8ca39237365deb90525fbd..9dd0bacf84610847f94270b79e5f243e2dd1ceb3 100644 (file)
@@ -782,7 +782,7 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
         * Follows early_init because some chips have to initialize
         * PIO buffers in early_init to avoid false parity errors.
         */
-       ipath_cancel_sends(dd);
+       ipath_cancel_sends(dd, 0);
 
        /* early_init sets rcvhdrentsize and rcvhdrsize, so this must be
         * done after early_init */
@@ -851,13 +851,14 @@ int ipath_init_chip(struct ipath_devdata *dd, int reinit)
        ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrmask,
                         dd->ipath_hwerrmask);
 
-       dd->ipath_maskederrs = dd->ipath_ignorederrs;
        /* clear all */
        ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, -1LL);
        /* enable errors that are masked, at least this first time. */
        ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask,
                         ~dd->ipath_maskederrs);
-       /* clear any interrups up to this point (ints still not enabled) */
+       dd->ipath_errormask = ipath_read_kreg64(dd,
+               dd->ipath_kregs->kr_errormask);
+       /* clear any interrupts up to this point (ints still not enabled) */
        ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, -1LL);
 
        /*
index 1fd91c59f2466f4c738f58f1caf74b560164d3ca..b29fe7e9b11a598686052f3797b8f0b2c1c6f3d1 100644 (file)
@@ -303,7 +303,7 @@ static void handle_e_ibstatuschanged(struct ipath_devdata *dd,
                 * Flush all queued sends when link went to DOWN or INIT,
                 * to be sure that they don't block SMA and other MAD packets
                 */
-               ipath_cancel_sends(dd);
+               ipath_cancel_sends(dd, 1);
        }
        else if (lstate == IPATH_IBSTATE_INIT || lstate == IPATH_IBSTATE_ARM ||
            lstate == IPATH_IBSTATE_ACTIVE) {
@@ -517,10 +517,7 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
 
        supp_msgs = handle_frequent_errors(dd, errs, msg, &noprint);
 
-       /*
-        * don't report errors that are masked (includes those always
-        * ignored)
-        */
+       /* don't report errors that are masked */
        errs &= ~dd->ipath_maskederrs;
 
        /* do these first, they are most important */
@@ -566,19 +563,19 @@ static int handle_errors(struct ipath_devdata *dd, ipath_err_t errs)
                 * ones on this particular interrupt, which also isn't great
                 */
                dd->ipath_maskederrs |= dd->ipath_lasterror | errs;
+               dd->ipath_errormask &= ~dd->ipath_maskederrs;
                ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask,
-                                ~dd->ipath_maskederrs);
+                       dd->ipath_errormask);
                s_iserr = ipath_decode_err(msg, sizeof msg,
-                                (dd->ipath_maskederrs & ~dd->
-                                 ipath_ignorederrs));
+                       dd->ipath_maskederrs);
 
-               if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs) &
+               if (dd->ipath_maskederrs &
                        ~(INFINIPATH_E_RRCVEGRFULL |
                        INFINIPATH_E_RRCVHDRFULL | INFINIPATH_E_PKTERRS))
                        ipath_dev_err(dd, "Temporarily disabling "
                            "error(s) %llx reporting; too frequent (%s)\n",
-                               (unsigned long long) (dd->ipath_maskederrs &
-                               ~dd->ipath_ignorederrs), msg);
+                               (unsigned long long)dd->ipath_maskederrs,
+                               msg);
                else {
                        /*
                         * rcvegrfull and rcvhdrqfull are "normal",
@@ -793,19 +790,22 @@ void ipath_clear_freeze(struct ipath_devdata *dd)
        /* disable error interrupts, to avoid confusion */
        ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask, 0ULL);
 
+       /* also disable interrupts; errormask is sometimes overwriten */
+       ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, 0ULL);
+
        /*
         * clear all sends, because they have may been
         * completed by usercode while in freeze mode, and
         * therefore would not be sent, and eventually
         * might cause the process to run out of bufs
         */
-       ipath_cancel_sends(dd);
+       ipath_cancel_sends(dd, 0);
        ipath_write_kreg(dd, dd->ipath_kregs->kr_control,
                         dd->ipath_control);
 
        /* ensure pio avail updates continue */
        ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
-                dd->ipath_sendctrl & ~IPATH_S_PIOBUFAVAILUPD);
+                dd->ipath_sendctrl & ~INFINIPATH_S_PIOBUFAVAILUPD);
        ipath_read_kreg64(dd, dd->ipath_kregs->kr_scratch);
        ipath_write_kreg(dd, dd->ipath_kregs->kr_sendctrl,
                 dd->ipath_sendctrl);
@@ -817,7 +817,7 @@ void ipath_clear_freeze(struct ipath_devdata *dd)
        for (i = 0; i < dd->ipath_pioavregs; i++) {
                /* deal with 6110 chip bug */
                im = i > 3 ? ((i&1) ? i-1 : i+1) : i;
-               val = ipath_read_kreg64(dd, 0x1000+(im*sizeof(u64)));
+               val = ipath_read_kreg64(dd, (0x1000/sizeof(u64))+im);
                dd->ipath_pioavailregs_dma[i] = dd->ipath_pioavailshadow[i]
                        = le64_to_cpu(val);
        }
@@ -832,7 +832,8 @@ void ipath_clear_freeze(struct ipath_devdata *dd)
        ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear,
                E_SPKT_ERRS_IGNORE);
        ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask,
-               ~dd->ipath_maskederrs);
+               dd->ipath_errormask);
+       ipath_write_kreg(dd, dd->ipath_kregs->kr_intmask, -1LL);
        ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, 0ULL);
 }
 
@@ -1002,7 +1003,6 @@ irqreturn_t ipath_intr(int irq, void *data)
        u32 istat, chk0rcv = 0;
        ipath_err_t estat = 0;
        irqreturn_t ret;
-       u32 oldhead, curtail;
        static unsigned unexpected = 0;
        static const u32 port0rbits = (1U<<INFINIPATH_I_RCVAVAIL_SHIFT) |
                 (1U<<INFINIPATH_I_RCVURG_SHIFT);
@@ -1035,36 +1035,6 @@ irqreturn_t ipath_intr(int irq, void *data)
                goto bail;
        }
 
-       /*
-        * We try to avoid reading the interrupt status register, since
-        * that's a PIO read, and stalls the processor for up to about
-        * ~0.25 usec. The idea is that if we processed a port0 packet,
-        * we blindly clear the  port 0 receive interrupt bits, and nothing
-        * else, then return.  If other interrupts are pending, the chip
-        * will re-interrupt us as soon as we write the intclear register.
-        * We then won't process any more kernel packets (if not the 2nd
-        * time, then the 3rd or 4th) and we'll then handle the other
-        * interrupts.   We clear the interrupts first so that we don't
-        * lose intr for later packets that arrive while we are processing.
-        */
-       oldhead = dd->ipath_port0head;
-       curtail = (u32)le64_to_cpu(*dd->ipath_hdrqtailptr);
-       if (oldhead != curtail) {
-               if (dd->ipath_flags & IPATH_GPIO_INTR) {
-                       ipath_write_kreg(dd, dd->ipath_kregs->kr_gpio_clear,
-                                        (u64) (1 << IPATH_GPIO_PORT0_BIT));
-                       istat = port0rbits | INFINIPATH_I_GPIO;
-               }
-               else
-                       istat = port0rbits;
-               ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, istat);
-               ipath_kreceive(dd);
-               if (oldhead != dd->ipath_port0head) {
-                       ipath_stats.sps_fastrcvint++;
-                       goto done;
-               }
-       }
-
        istat = ipath_read_kreg32(dd, dd->ipath_kregs->kr_intstatus);
 
        if (unlikely(!istat)) {
@@ -1225,7 +1195,6 @@ irqreturn_t ipath_intr(int irq, void *data)
                handle_layer_pioavail(dd);
        }
 
-done:
        ret = IRQ_HANDLED;
 
 bail:
index ace63ef78e6fa3c23e6a908b1e92ae47cd6ecff1..7a7966f7e4fff96cc5a2027072fb15893126d927 100644 (file)
@@ -261,18 +261,10 @@ struct ipath_devdata {
         * limiting of hwerror reporting
         */
        ipath_err_t ipath_lasthwerror;
-       /*
-        * errors masked because they occur too fast, also includes errors
-        * that are always ignored (ipath_ignorederrs)
-        */
+       /* errors masked because they occur too fast */
        ipath_err_t ipath_maskederrs;
        /* time in jiffies at which to re-enable maskederrs */
        unsigned long ipath_unmasktime;
-       /*
-        * errors always ignored (masked), at least for a given
-        * chip/device, because they are wrong or not useful
-        */
-       ipath_err_t ipath_ignorederrs;
        /* count of egrfull errors, combined for all ports */
        u64 ipath_last_tidfull;
        /* for ipath_qcheck() */
@@ -436,6 +428,7 @@ struct ipath_devdata {
        u64 ipath_lastibcstat;
        /* hwerrmask shadow */
        ipath_err_t ipath_hwerrmask;
+       ipath_err_t ipath_errormask; /* errormask shadow */
        /* interrupt config reg shadow */
        u64 ipath_intconfig;
        /* kr_sendpiobufbase value */
@@ -683,7 +676,7 @@ int ipath_unordered_wc(void);
 
 void ipath_disarm_piobufs(struct ipath_devdata *, unsigned first,
                          unsigned cnt);
-void ipath_cancel_sends(struct ipath_devdata *);
+void ipath_cancel_sends(struct ipath_devdata *, int);
 
 int ipath_create_rcvhdrq(struct ipath_devdata *, struct ipath_portdata *);
 void ipath_free_pddata(struct ipath_devdata *, struct ipath_portdata *);
index 73ed17d031887cbf5da73d57ee92f0c8b6aeb457..bae4f56f7271f05b65660a84bf886a1ed19a1b6f 100644 (file)
@@ -196,6 +196,45 @@ static void ipath_qcheck(struct ipath_devdata *dd)
        }
 }
 
+static void ipath_chk_errormask(struct ipath_devdata *dd)
+{
+       static u32 fixed;
+       u32 ctrl;
+       unsigned long errormask;
+       unsigned long hwerrs;
+
+       if (!dd->ipath_errormask || !(dd->ipath_flags & IPATH_INITTED))
+               return;
+
+       errormask = ipath_read_kreg64(dd, dd->ipath_kregs->kr_errormask);
+
+       if (errormask == dd->ipath_errormask)
+               return;
+       fixed++;
+
+       hwerrs = ipath_read_kreg64(dd, dd->ipath_kregs->kr_hwerrstatus);
+       ctrl = ipath_read_kreg32(dd, dd->ipath_kregs->kr_control);
+
+       ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask,
+               dd->ipath_errormask);
+
+       if ((hwerrs & dd->ipath_hwerrmask) ||
+               (ctrl & INFINIPATH_C_FREEZEMODE)) {
+               /* force re-interrupt of pending events, just in case */
+               ipath_write_kreg(dd, dd->ipath_kregs->kr_hwerrclear, 0ULL);
+               ipath_write_kreg(dd, dd->ipath_kregs->kr_errorclear, 0ULL);
+               ipath_write_kreg(dd, dd->ipath_kregs->kr_intclear, 0ULL);
+               dev_info(&dd->pcidev->dev,
+                       "errormask fixed(%u) %lx -> %lx, ctrl %x hwerr %lx\n",
+                       fixed, errormask, (unsigned long)dd->ipath_errormask,
+                       ctrl, hwerrs);
+       } else
+               ipath_dbg("errormask fixed(%u) %lx -> %lx, no freeze\n",
+                       fixed, errormask,
+                       (unsigned long)dd->ipath_errormask);
+}
+
+
 /**
  * ipath_get_faststats - get word counters from chip before they overflow
  * @opaque - contains a pointer to the infinipath device ipath_devdata
@@ -251,14 +290,13 @@ void ipath_get_faststats(unsigned long opaque)
                dd->ipath_lasterror = 0;
        if (dd->ipath_lasthwerror)
                dd->ipath_lasthwerror = 0;
-       if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs)
+       if (dd->ipath_maskederrs
            && time_after(jiffies, dd->ipath_unmasktime)) {
                char ebuf[256];
                int iserr;
                iserr = ipath_decode_err(ebuf, sizeof ebuf,
-                                (dd->ipath_maskederrs & ~dd->
-                                 ipath_ignorederrs));
-               if ((dd->ipath_maskederrs & ~dd->ipath_ignorederrs) &
+                       dd->ipath_maskederrs);
+               if (dd->ipath_maskederrs &
                                ~(INFINIPATH_E_RRCVEGRFULL | INFINIPATH_E_RRCVHDRFULL |
                                INFINIPATH_E_PKTERRS ))
                        ipath_dev_err(dd, "Re-enabling masked errors "
@@ -278,9 +316,12 @@ void ipath_get_faststats(unsigned long opaque)
                                ipath_cdbg(ERRPKT, "Re-enabling packet"
                                                " problem interrupt (%s)\n", ebuf);
                }
-               dd->ipath_maskederrs = dd->ipath_ignorederrs;
+
+               /* re-enable masked errors */
+               dd->ipath_errormask |= dd->ipath_maskederrs;
                ipath_write_kreg(dd, dd->ipath_kregs->kr_errormask,
-                                ~dd->ipath_maskederrs);
+                       dd->ipath_errormask);
+               dd->ipath_maskederrs = 0;
        }
 
        /* limit qfull messages to ~one per minute per port */
@@ -294,6 +335,7 @@ void ipath_get_faststats(unsigned long opaque)
                }
        }
 
+       ipath_chk_errormask(dd);
 done:
        mod_timer(&dd->ipath_stats_timer, jiffies + HZ * 5);
 }
index f6315dfb213ec8638a2e239272cd77848175773c..ba0428d872aa4bc0a6cc2993049c6f60f2eba25e 100644 (file)
@@ -1209,7 +1209,6 @@ static void set_datagram_seg(struct mlx4_wqe_datagram_seg *dseg,
        memcpy(dseg->av, &to_mah(wr->wr.ud.ah)->av, sizeof (struct mlx4_av));
        dseg->dqpn = cpu_to_be32(wr->wr.ud.remote_qpn);
        dseg->qkey = cpu_to_be32(wr->wr.ud.remote_qkey);
-
 }
 
 static void set_data_seg(struct mlx4_wqe_data_seg *dseg,
index 5db31438027109588ea50018a4875bfd64ae9521..bad8dacafd108e5c2c9fd0f4826e2a59630337e9 100644 (file)
@@ -548,6 +548,7 @@ iscsi_iser_ep_disconnect(__u64 ep_handle)
 }
 
 static struct scsi_host_template iscsi_iser_sht = {
+       .module                 = THIS_MODULE,
        .name                   = "iSCSI Initiator over iSER, v." DRV_VER,
        .queuecommand           = iscsi_queuecommand,
        .can_queue              = ISCSI_DEF_XMIT_CMDS_MAX - 1,
index ab4b2d9b5327a881da8a2bf13748d29ea72328fa..f1c3d6cebd585a5392c96e0ed1a25e9cf275a73a 100644 (file)
@@ -186,7 +186,7 @@ struct input_event_compat {
 #elif defined(CONFIG_S390)
 #  define COMPAT_TEST test_thread_flag(TIF_31BIT)
 #elif defined(CONFIG_MIPS)
-#  define COMPAT_TEST (current->thread.mflags & MF_32BIT_ADDR)
+#  define COMPAT_TEST test_thread_flag(TIF_32BIT_ADDR)
 #else
 #  define COMPAT_TEST test_thread_flag(TIF_32BIT)
 #endif
index adef447f23ea601fd4bb61d1b7935b61b1c7ee75..5ce632ca6815e34c6cf2ce0416f63c8ec9817608 100644 (file)
@@ -21,7 +21,7 @@ if SERIO
 config SERIO_I8042
        tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86
        default y
-       depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K
+       depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BFIN
        ---help---
          i8042 is the chip over which the standard AT keyboard and PS/2
          mouse are connected to the computer. If you use these devices,
index be77ee625bb75e4d63181fbeb396f2b08cc591b6..559a0d0244cf38b59d6aa809bddee183089f8c44 100644 (file)
@@ -70,6 +70,8 @@ put_info_buffer(char *cp)
        wake_up_interruptible(&(rd_queue));
 }                              /* put_info_buffer */
 
+#ifdef CONFIG_PROC_FS
+
 /**********************************/
 /* deflection device read routine */
 /**********************************/
@@ -253,8 +255,6 @@ isdn_divert_ioctl(struct inode *inode, struct file *file,
        return copy_to_user((void __user *)arg, &dioctl, sizeof(dioctl)) ? -EFAULT : 0;
 }                              /* isdn_divert_ioctl */
 
-
-#ifdef CONFIG_PROC_FS
 static const struct file_operations isdn_fops =
 {
        .owner          = THIS_MODULE,
index 1f979cb0df314f82cab71e88f2c7892922454860..4b8a0cc9665eda6662c5248782ec846e1e6367e7 100644 (file)
@@ -1217,11 +1217,13 @@ twobyte_insn:
                }
                break;
        case 0x21: /* mov from dr to reg */
+               no_wb = 1;
                if (modrm_mod != 3)
                        goto cannot_emulate;
                rc = emulator_get_dr(ctxt, modrm_reg, &_regs[modrm_rm]);
                break;
        case 0x23: /* mov from reg to dr */
+               no_wb = 1;
                if (modrm_mod != 3)
                        goto cannot_emulate;
                rc = emulator_set_dr(ctxt, modrm_reg, _regs[modrm_rm]);
index 43d901fdc77f714dd44203e178835a6a61464bae..fd6925f41647acf48a9af59c14a78e86569974e9 100644 (file)
@@ -1,6 +1,6 @@
 config LGUEST
        tristate "Linux hypervisor example code"
-       depends on X86 && PARAVIRT && NET && EXPERIMENTAL && !X86_PAE
+       depends on X86 && PARAVIRT && EXPERIMENTAL && !X86_PAE
        select LGUEST_GUEST
        select HVC_DRIVER
        ---help---
@@ -18,3 +18,13 @@ config LGUEST_GUEST
          The guest needs code built-in, even if the host has lguest
          support as a module.  The drivers are tiny, so we build them
          in too.
+
+config LGUEST_NET
+       tristate
+       default y
+       depends on LGUEST_GUEST && NET
+
+config LGUEST_BLOCK
+       tristate
+       default y
+       depends on LGUEST_GUEST && BLOCK
index 55382c7d799c2453c06656507ff8054f29272647..e5047471c334ed0f84081bf594a9ada58f20ba70 100644 (file)
@@ -5,3 +5,15 @@ obj-$(CONFIG_LGUEST_GUEST) += lguest.o lguest_asm.o lguest_bus.o
 obj-$(CONFIG_LGUEST)   += lg.o
 lg-y := core.o hypercalls.o page_tables.o interrupts_and_traps.o \
        segments.o io.o lguest_user.o switcher.o
+
+Preparation Preparation!: PREFIX=P
+Guest: PREFIX=G
+Drivers: PREFIX=D
+Launcher: PREFIX=L
+Host: PREFIX=H
+Switcher: PREFIX=S
+Mastery: PREFIX=M
+Beer:
+       @for f in Preparation Guest Drivers Launcher Host Switcher Mastery; do echo "{==- $$f -==}"; make -s $$f; done; echo "{==-==}"
+Preparation Preparation! Guest Drivers Launcher Host Switcher Mastery:
+       @sh ../../Documentation/lguest/extract $(PREFIX) `find ../../* -name '*.[chS]' -wholename '*lguest*'`
diff --git a/drivers/lguest/README b/drivers/lguest/README
new file mode 100644 (file)
index 0000000..b7db39a
--- /dev/null
@@ -0,0 +1,47 @@
+Welcome, friend reader, to lguest.
+
+Lguest is an adventure, with you, the reader, as Hero.  I can't think of many
+5000-line projects which offer both such capability and glimpses of future
+potential; it is an exciting time to be delving into the source!
+
+But be warned; this is an arduous journey of several hours or more!  And as we
+know, all true Heroes are driven by a Noble Goal.  Thus I offer a Beer (or
+equivalent) to anyone I meet who has completed this documentation.
+
+So get comfortable and keep your wits about you (both quick and humorous).
+Along your way to the Noble Goal, you will also gain masterly insight into
+lguest, and hypervisors and x86 virtualization in general.
+
+Our Quest is in seven parts: (best read with C highlighting turned on)
+
+I) Preparation
+       - In which our potential hero is flown quickly over the landscape for a
+         taste of its scope.  Suitable for the armchair coders and other such
+         persons of faint constitution.
+
+II) Guest
+       - Where we encounter the first tantalising wisps of code, and come to
+         understand the details of the life of a Guest kernel.
+
+III) Drivers
+       - Whereby the Guest finds its voice and become useful, and our
+         understanding of the Guest is completed.
+
+IV) Launcher
+       - Where we trace back to the creation of the Guest, and thus begin our
+         understanding of the Host.
+
+V) Host
+       - Where we master the Host code, through a long and tortuous journey.
+         Indeed, it is here that our hero is tested in the Bit of Despair.
+
+VI) Switcher
+       - Where our understanding of the intertwined nature of Guests and Hosts
+         is completed.
+
+VII) Mastery
+       - Where our fully fledged hero grapples with the Great Question:
+         "What next?"
+
+make Preparation!
+Rusty Russell.
index ce909ec57499729a69694b558eb0320774941105..4a315f08a567d40a15735fa9091118a7b96f60eb 100644 (file)
@@ -1,5 +1,8 @@
-/* World's simplest hypervisor, to test paravirt_ops and show
- * unbelievers that virtualization is the future.  Plus, it's fun! */
+/*P:400 This contains run_guest() which actually calls into the Host<->Guest
+ * Switcher and analyzes the return, such as determining if the Guest wants the
+ * Host to do something.  This file also contains useful helper routines, and a
+ * couple of non-obvious setup and teardown pieces which were implemented after
+ * days of debugging pain. :*/
 #include <linux/module.h>
 #include <linux/stringify.h>
 #include <linux/stddef.h>
@@ -61,11 +64,33 @@ static struct lguest_pages *lguest_pages(unsigned int cpu)
                  (SWITCHER_ADDR + SHARED_SWITCHER_PAGES*PAGE_SIZE))[cpu]);
 }
 
+/*H:010 We need to set up the Switcher at a high virtual address.  Remember the
+ * Switcher is a few hundred bytes of assembler code which actually changes the
+ * CPU to run the Guest, and then changes back to the Host when a trap or
+ * interrupt happens.
+ *
+ * The Switcher code must be at the same virtual address in the Guest as the
+ * Host since it will be running as the switchover occurs.
+ *
+ * Trying to map memory at a particular address is an unusual thing to do, so
+ * it's not a simple one-liner.  We also set up the per-cpu parts of the
+ * Switcher here.
+ */
 static __init int map_switcher(void)
 {
        int i, err;
        struct page **pagep;
 
+       /*
+        * Map the Switcher in to high memory.
+        *
+        * It turns out that if we choose the address 0xFFC00000 (4MB under the
+        * top virtual address), it makes setting up the page tables really
+        * easy.
+        */
+
+       /* We allocate an array of "struct page"s.  map_vm_area() wants the
+        * pages in this form, rather than just an array of pointers. */
        switcher_page = kmalloc(sizeof(switcher_page[0])*TOTAL_SWITCHER_PAGES,
                                GFP_KERNEL);
        if (!switcher_page) {
@@ -73,6 +98,8 @@ static __init int map_switcher(void)
                goto out;
        }
 
+       /* Now we actually allocate the pages.  The Guest will see these pages,
+        * so we make sure they're zeroed. */
        for (i = 0; i < TOTAL_SWITCHER_PAGES; i++) {
                unsigned long addr = get_zeroed_page(GFP_KERNEL);
                if (!addr) {
@@ -82,6 +109,9 @@ static __init int map_switcher(void)
                switcher_page[i] = virt_to_page(addr);
        }
 
+       /* Now we reserve the "virtual memory area" we want: 0xFFC00000
+        * (SWITCHER_ADDR).  We might not get it in theory, but in practice
+        * it's worked so far. */
        switcher_vma = __get_vm_area(TOTAL_SWITCHER_PAGES * PAGE_SIZE,
                                       VM_ALLOC, SWITCHER_ADDR, VMALLOC_END);
        if (!switcher_vma) {
@@ -90,49 +120,105 @@ static __init int map_switcher(void)
                goto free_pages;
        }
 
+       /* This code actually sets up the pages we've allocated to appear at
+        * SWITCHER_ADDR.  map_vm_area() takes the vma we allocated above, the
+        * kind of pages we're mapping (kernel pages), and a pointer to our
+        * array of struct pages.  It increments that pointer, but we don't
+        * care. */
        pagep = switcher_page;
        err = map_vm_area(switcher_vma, PAGE_KERNEL, &pagep);
        if (err) {
                printk("lguest: map_vm_area failed: %i\n", err);
                goto free_vma;
        }
+
+       /* Now the switcher is mapped at the right address, we can't fail!
+        * Copy in the compiled-in Switcher code (from switcher.S). */
        memcpy(switcher_vma->addr, start_switcher_text,
               end_switcher_text - start_switcher_text);
 
-       /* Fix up IDT entries to point into copied text. */
+       /* Most of the switcher.S doesn't care that it's been moved; on Intel,
+        * jumps are relative, and it doesn't access any references to external
+        * code or data.
+        *
+        * The only exception is the interrupt handlers in switcher.S: their
+        * addresses are placed in a table (default_idt_entries), so we need to
+        * update the table with the new addresses.  switcher_offset() is a
+        * convenience function which returns the distance between the builtin
+        * switcher code and the high-mapped copy we just made. */
        for (i = 0; i < IDT_ENTRIES; i++)
                default_idt_entries[i] += switcher_offset();
 
+       /*
+        * Set up the Switcher's per-cpu areas.
+        *
+        * Each CPU gets two pages of its own within the high-mapped region
+        * (aka. "struct lguest_pages").  Much of this can be initialized now,
+        * but some depends on what Guest we are running (which is set up in
+        * copy_in_guest_info()).
+        */
        for_each_possible_cpu(i) {
+               /* lguest_pages() returns this CPU's two pages. */
                struct lguest_pages *pages = lguest_pages(i);
+               /* This is a convenience pointer to make the code fit one
+                * statement to a line. */
                struct lguest_ro_state *state = &pages->state;
 
-               /* These fields are static: rest done in copy_in_guest_info */
+               /* The Global Descriptor Table: the Host has a different one
+                * for each CPU.  We keep a descriptor for the GDT which says
+                * where it is and how big it is (the size is actually the last
+                * byte, not the size, hence the "-1"). */
                state->host_gdt_desc.size = GDT_SIZE-1;
                state->host_gdt_desc.address = (long)get_cpu_gdt_table(i);
+
+               /* All CPUs on the Host use the same Interrupt Descriptor
+                * Table, so we just use store_idt(), which gets this CPU's IDT
+                * descriptor. */
                store_idt(&state->host_idt_desc);
+
+               /* The descriptors for the Guest's GDT and IDT can be filled
+                * out now, too.  We copy the GDT & IDT into ->guest_gdt and
+                * ->guest_idt before actually running the Guest. */
                state->guest_idt_desc.size = sizeof(state->guest_idt)-1;
                state->guest_idt_desc.address = (long)&state->guest_idt;
                state->guest_gdt_desc.size = sizeof(state->guest_gdt)-1;
                state->guest_gdt_desc.address = (long)&state->guest_gdt;
+
+               /* We know where we want the stack to be when the Guest enters
+                * the switcher: in pages->regs.  The stack grows upwards, so
+                * we start it at the end of that structure. */
                state->guest_tss.esp0 = (long)(&pages->regs + 1);
+               /* And this is the GDT entry to use for the stack: we keep a
+                * couple of special LGUEST entries. */
                state->guest_tss.ss0 = LGUEST_DS;
-               /* No I/O for you! */
+
+               /* x86 can have a finegrained bitmap which indicates what I/O
+                * ports the process can use.  We set it to the end of our
+                * structure, meaning "none". */
                state->guest_tss.io_bitmap_base = sizeof(state->guest_tss);
+
+               /* Some GDT entries are the same across all Guests, so we can
+                * set them up now. */
                setup_default_gdt_entries(state);
+               /* Most IDT entries are the same for all Guests, too.*/
                setup_default_idt_entries(state, default_idt_entries);
 
-               /* Setup LGUEST segments on all cpus */
+               /* The Host needs to be able to use the LGUEST segments on this
+                * CPU, too, so put them in the Host GDT. */
                get_cpu_gdt_table(i)[GDT_ENTRY_LGUEST_CS] = FULL_EXEC_SEGMENT;
                get_cpu_gdt_table(i)[GDT_ENTRY_LGUEST_DS] = FULL_SEGMENT;
        }
 
-       /* Initialize entry point into switcher. */
+       /* In the Switcher, we want the %cs segment register to use the
+        * LGUEST_CS GDT entry: we've put that in the Host and Guest GDTs, so
+        * it will be undisturbed when we switch.  To change %cs and jump we
+        * need this structure to feed to Intel's "lcall" instruction. */
        lguest_entry.offset = (long)switch_to_guest + switcher_offset();
        lguest_entry.segment = LGUEST_CS;
 
        printk(KERN_INFO "lguest: mapped switcher at %p\n",
               switcher_vma->addr);
+       /* And we succeeded... */
        return 0;
 
 free_vma:
@@ -146,35 +232,58 @@ free_some_pages:
 out:
        return err;
 }
+/*:*/
 
+/* Cleaning up the mapping when the module is unloaded is almost...
+ * too easy. */
 static void unmap_switcher(void)
 {
        unsigned int i;
 
+       /* vunmap() undoes *both* map_vm_area() and __get_vm_area(). */
        vunmap(switcher_vma->addr);
+       /* Now we just need to free the pages we copied the switcher into */
        for (i = 0; i < TOTAL_SWITCHER_PAGES; i++)
                __free_pages(switcher_page[i], 0);
 }
 
-/* IN/OUT insns: enough to get us past boot-time probing. */
+/*H:130 Our Guest is usually so well behaved; it never tries to do things it
+ * isn't allowed to.  Unfortunately, "struct paravirt_ops" isn't quite
+ * complete, because it doesn't contain replacements for the Intel I/O
+ * instructions.  As a result, the Guest sometimes fumbles across one during
+ * the boot process as it probes for various things which are usually attached
+ * to a PC.
+ *
+ * When the Guest uses one of these instructions, we get trap #13 (General
+ * Protection Fault) and come here.  We see if it's one of those troublesome
+ * instructions and skip over it.  We return true if we did. */
 static int emulate_insn(struct lguest *lg)
 {
        u8 insn;
        unsigned int insnlen = 0, in = 0, shift = 0;
+       /* The eip contains the *virtual* address of the Guest's instruction:
+        * guest_pa just subtracts the Guest's page_offset. */
        unsigned long physaddr = guest_pa(lg, lg->regs->eip);
 
-       /* This only works for addresses in linear mapping... */
+       /* The guest_pa() function only works for Guest kernel addresses, but
+        * that's all we're trying to do anyway. */
        if (lg->regs->eip < lg->page_offset)
                return 0;
+
+       /* Decoding x86 instructions is icky. */
        lgread(lg, &insn, physaddr, 1);
 
-       /* Operand size prefix means it's actually for ax. */
+       /* 0x66 is an "operand prefix".  It means it's using the upper 16 bits
+          of the eax register. */
        if (insn == 0x66) {
                shift = 16;
+               /* The instruction is 1 byte so far, read the next byte. */
                insnlen = 1;
                lgread(lg, &insn, physaddr + insnlen, 1);
        }
 
+       /* We can ignore the lower bit for the moment and decode the 4 opcodes
+        * we need to emulate. */
        switch (insn & 0xFE) {
        case 0xE4: /* in     <next byte>,%al */
                insnlen += 2;
@@ -191,9 +300,13 @@ static int emulate_insn(struct lguest *lg)
                insnlen += 1;
                break;
        default:
+               /* OK, we don't know what this is, can't emulate. */
                return 0;
        }
 
+       /* If it was an "IN" instruction, they expect the result to be read
+        * into %eax, so we change %eax.  We always return all-ones, which
+        * traditionally means "there's nothing there". */
        if (in) {
                /* Lower bit tells is whether it's a 16 or 32 bit access */
                if (insn & 0x1)
@@ -201,28 +314,46 @@ static int emulate_insn(struct lguest *lg)
                else
                        lg->regs->eax |= (0xFFFF << shift);
        }
+       /* Finally, we've "done" the instruction, so move past it. */
        lg->regs->eip += insnlen;
+       /* Success! */
        return 1;
 }
-
+/*:*/
+
+/*L:305
+ * Dealing With Guest Memory.
+ *
+ * When the Guest gives us (what it thinks is) a physical address, we can use
+ * the normal copy_from_user() & copy_to_user() on that address: remember,
+ * Guest physical == Launcher virtual.
+ *
+ * But we can't trust the Guest: it might be trying to access the Launcher
+ * code.  We have to check that the range is below the pfn_limit the Launcher
+ * gave us.  We have to make sure that addr + len doesn't give us a false
+ * positive by overflowing, too. */
 int lguest_address_ok(const struct lguest *lg,
                      unsigned long addr, unsigned long len)
 {
        return (addr+len) / PAGE_SIZE < lg->pfn_limit && (addr+len >= addr);
 }
 
-/* Just like get_user, but don't let guest access lguest binary. */
+/* This is a convenient routine to get a 32-bit value from the Guest (a very
+ * common operation).  Here we can see how useful the kill_lguest() routine we
+ * met in the Launcher can be: we return a random value (0) instead of needing
+ * to return an error. */
 u32 lgread_u32(struct lguest *lg, unsigned long addr)
 {
        u32 val = 0;
 
-       /* Don't let them access lguest binary */
+       /* Don't let them access lguest binary. */
        if (!lguest_address_ok(lg, addr, sizeof(val))
            || get_user(val, (u32 __user *)addr) != 0)
                kill_guest(lg, "bad read address %#lx", addr);
        return val;
 }
 
+/* Same thing for writing a value. */
 void lgwrite_u32(struct lguest *lg, unsigned long addr, u32 val)
 {
        if (!lguest_address_ok(lg, addr, sizeof(val))
@@ -230,6 +361,9 @@ void lgwrite_u32(struct lguest *lg, unsigned long addr, u32 val)
                kill_guest(lg, "bad write address %#lx", addr);
 }
 
+/* This routine is more generic, and copies a range of Guest bytes into a
+ * buffer.  If the copy_from_user() fails, we fill the buffer with zeroes, so
+ * the caller doesn't end up using uninitialized kernel memory. */
 void lgread(struct lguest *lg, void *b, unsigned long addr, unsigned bytes)
 {
        if (!lguest_address_ok(lg, addr, bytes)
@@ -240,6 +374,7 @@ void lgread(struct lguest *lg, void *b, unsigned long addr, unsigned bytes)
        }
 }
 
+/* Similarly, our generic routine to copy into a range of Guest bytes. */
 void lgwrite(struct lguest *lg, unsigned long addr, const void *b,
             unsigned bytes)
 {
@@ -247,6 +382,7 @@ void lgwrite(struct lguest *lg, unsigned long addr, const void *b,
            || copy_to_user((void __user *)addr, b, bytes) != 0)
                kill_guest(lg, "bad write address %#lx len %u", addr, bytes);
 }
+/* (end of memory access helper routines) :*/
 
 static void set_ts(void)
 {
@@ -257,54 +393,113 @@ static void set_ts(void)
                write_cr0(cr0|8);
 }
 
+/*S:010
+ * We are getting close to the Switcher.
+ *
+ * Remember that each CPU has two pages which are visible to the Guest when it
+ * runs on that CPU.  This has to contain the state for that Guest: we copy the
+ * state in just before we run the Guest.
+ *
+ * Each Guest has "changed" flags which indicate what has changed in the Guest
+ * since it last ran.  We saw this set in interrupts_and_traps.c and
+ * segments.c.
+ */
 static void copy_in_guest_info(struct lguest *lg, struct lguest_pages *pages)
 {
+       /* Copying all this data can be quite expensive.  We usually run the
+        * same Guest we ran last time (and that Guest hasn't run anywhere else
+        * meanwhile).  If that's not the case, we pretend everything in the
+        * Guest has changed. */
        if (__get_cpu_var(last_guest) != lg || lg->last_pages != pages) {
                __get_cpu_var(last_guest) = lg;
                lg->last_pages = pages;
                lg->changed = CHANGED_ALL;
        }
 
-       /* These are pretty cheap, so we do them unconditionally. */
+       /* These copies are pretty cheap, so we do them unconditionally: */
+       /* Save the current Host top-level page directory. */
        pages->state.host_cr3 = __pa(current->mm->pgd);
+       /* Set up the Guest's page tables to see this CPU's pages (and no
+        * other CPU's pages). */
        map_switcher_in_guest(lg, pages);
+       /* Set up the two "TSS" members which tell the CPU what stack to use
+        * for traps which do directly into the Guest (ie. traps at privilege
+        * level 1). */
        pages->state.guest_tss.esp1 = lg->esp1;
        pages->state.guest_tss.ss1 = lg->ss1;
 
-       /* Copy direct trap entries. */
+       /* Copy direct-to-Guest trap entries. */
        if (lg->changed & CHANGED_IDT)
                copy_traps(lg, pages->state.guest_idt, default_idt_entries);
 
-       /* Copy all GDT entries but the TSS. */
+       /* Copy all GDT entries which the Guest can change. */
        if (lg->changed & CHANGED_GDT)
                copy_gdt(lg, pages->state.guest_gdt);
        /* If only the TLS entries have changed, copy them. */
        else if (lg->changed & CHANGED_GDT_TLS)
                copy_gdt_tls(lg, pages->state.guest_gdt);
 
+       /* Mark the Guest as unchanged for next time. */
        lg->changed = 0;
 }
 
+/* Finally: the code to actually call into the Switcher to run the Guest. */
 static void run_guest_once(struct lguest *lg, struct lguest_pages *pages)
 {
+       /* This is a dummy value we need for GCC's sake. */
        unsigned int clobber;
 
+       /* Copy the guest-specific information into this CPU's "struct
+        * lguest_pages". */
        copy_in_guest_info(lg, pages);
 
-       /* Put eflags on stack, lcall does rest: suitable for iret return. */
+       /* Set the trap number to 256 (impossible value).  If we fault while
+        * switching to the Guest (bad segment registers or bug), this will
+        * cause us to abort the Guest. */
+       lg->regs->trapnum = 256;
+
+       /* Now: we push the "eflags" register on the stack, then do an "lcall".
+        * This is how we change from using the kernel code segment to using
+        * the dedicated lguest code segment, as well as jumping into the
+        * Switcher.
+        *
+        * The lcall also pushes the old code segment (KERNEL_CS) onto the
+        * stack, then the address of this call.  This stack layout happens to
+        * exactly match the stack of an interrupt... */
        asm volatile("pushf; lcall *lguest_entry"
+                    /* This is how we tell GCC that %eax ("a") and %ebx ("b")
+                     * are changed by this routine.  The "=" means output. */
                     : "=a"(clobber), "=b"(clobber)
+                    /* %eax contains the pages pointer.  ("0" refers to the
+                     * 0-th argument above, ie "a").  %ebx contains the
+                     * physical address of the Guest's top-level page
+                     * directory. */
                     : "0"(pages), "1"(__pa(lg->pgdirs[lg->pgdidx].pgdir))
+                    /* We tell gcc that all these registers could change,
+                     * which means we don't have to save and restore them in
+                     * the Switcher. */
                     : "memory", "%edx", "%ecx", "%edi", "%esi");
 }
+/*:*/
 
+/*H:030 Let's jump straight to the the main loop which runs the Guest.
+ * Remember, this is called by the Launcher reading /dev/lguest, and we keep
+ * going around and around until something interesting happens. */
 int run_guest(struct lguest *lg, unsigned long __user *user)
 {
+       /* We stop running once the Guest is dead. */
        while (!lg->dead) {
+               /* We need to initialize this, otherwise gcc complains.  It's
+                * not (yet) clever enough to see that it's initialized when we
+                * need it. */
                unsigned int cr2 = 0; /* Damn gcc */
 
-               /* Hypercalls first: we might have been out to userspace */
+               /* First we run any hypercalls the Guest wants done: either in
+                * the hypercall ring in "struct lguest_data", or directly by
+                * using int 31 (LGUEST_TRAP_ENTRY). */
                do_hypercalls(lg);
+               /* It's possible the Guest did a SEND_DMA hypercall to the
+                * Launcher, in which case we return from the read() now. */
                if (lg->dma_is_pending) {
                        if (put_user(lg->pending_dma, user) ||
                            put_user(lg->pending_key, user+1))
@@ -312,6 +507,7 @@ int run_guest(struct lguest *lg, unsigned long __user *user)
                        return sizeof(unsigned long)*2;
                }
 
+               /* Check for signals */
                if (signal_pending(current))
                        return -ERESTARTSYS;
 
@@ -319,77 +515,154 @@ int run_guest(struct lguest *lg, unsigned long __user *user)
                if (lg->break_out)
                        return -EAGAIN;
 
+               /* Check if there are any interrupts which can be delivered
+                * now: if so, this sets up the hander to be executed when we
+                * next run the Guest. */
                maybe_do_interrupt(lg);
 
+               /* All long-lived kernel loops need to check with this horrible
+                * thing called the freezer.  If the Host is trying to suspend,
+                * it stops us. */
                try_to_freeze();
 
+               /* Just make absolutely sure the Guest is still alive.  One of
+                * those hypercalls could have been fatal, for example. */
                if (lg->dead)
                        break;
 
+               /* If the Guest asked to be stopped, we sleep.  The Guest's
+                * clock timer or LHCALL_BREAK from the Waker will wake us. */
                if (lg->halted) {
                        set_current_state(TASK_INTERRUPTIBLE);
                        schedule();
                        continue;
                }
 
+               /* OK, now we're ready to jump into the Guest.  First we put up
+                * the "Do Not Disturb" sign: */
                local_irq_disable();
 
-               /* Even if *we* don't want FPU trap, guest might... */
+               /* Remember the awfully-named TS bit?  If the Guest has asked
+                * to set it we set it now, so we can trap and pass that trap
+                * to the Guest if it uses the FPU. */
                if (lg->ts)
                        set_ts();
 
-               /* Don't let Guest do SYSENTER: we can't handle it. */
+               /* SYSENTER is an optimized way of doing system calls.  We
+                * can't allow it because it always jumps to privilege level 0.
+                * A normal Guest won't try it because we don't advertise it in
+                * CPUID, but a malicious Guest (or malicious Guest userspace
+                * program) could, so we tell the CPU to disable it before
+                * running the Guest. */
                if (boot_cpu_has(X86_FEATURE_SEP))
                        wrmsr(MSR_IA32_SYSENTER_CS, 0, 0);
 
+               /* Now we actually run the Guest.  It will pop back out when
+                * something interesting happens, and we can examine its
+                * registers to see what it was doing. */
                run_guest_once(lg, lguest_pages(raw_smp_processor_id()));
 
-               /* Save cr2 now if we page-faulted. */
+               /* The "regs" pointer contains two extra entries which are not
+                * really registers: a trap number which says what interrupt or
+                * trap made the switcher code come back, and an error code
+                * which some traps set.  */
+
+               /* If the Guest page faulted, then the cr2 register will tell
+                * us the bad virtual address.  We have to grab this now,
+                * because once we re-enable interrupts an interrupt could
+                * fault and thus overwrite cr2, or we could even move off to a
+                * different CPU. */
                if (lg->regs->trapnum == 14)
                        cr2 = read_cr2();
+               /* Similarly, if we took a trap because the Guest used the FPU,
+                * we have to restore the FPU it expects to see. */
                else if (lg->regs->trapnum == 7)
                        math_state_restore();
 
+               /* Restore SYSENTER if it's supposed to be on. */
                if (boot_cpu_has(X86_FEATURE_SEP))
                        wrmsr(MSR_IA32_SYSENTER_CS, __KERNEL_CS, 0);
+
+               /* Now we're ready to be interrupted or moved to other CPUs */
                local_irq_enable();
 
+               /* OK, so what happened? */
                switch (lg->regs->trapnum) {
                case 13: /* We've intercepted a GPF. */
+                       /* Check if this was one of those annoying IN or OUT
+                        * instructions which we need to emulate.  If so, we
+                        * just go back into the Guest after we've done it. */
                        if (lg->regs->errcode == 0) {
                                if (emulate_insn(lg))
                                        continue;
                        }
                        break;
                case 14: /* We've intercepted a page fault. */
+                       /* The Guest accessed a virtual address that wasn't
+                        * mapped.  This happens a lot: we don't actually set
+                        * up most of the page tables for the Guest at all when
+                        * we start: as it runs it asks for more and more, and
+                        * we set them up as required. In this case, we don't
+                        * even tell the Guest that the fault happened.
+                        *
+                        * The errcode tells whether this was a read or a
+                        * write, and whether kernel or userspace code. */
                        if (demand_page(lg, cr2, lg->regs->errcode))
                                continue;
 
-                       /* If lguest_data is NULL, this won't hurt. */
+                       /* OK, it's really not there (or not OK): the Guest
+                        * needs to know.  We write out the cr2 value so it
+                        * knows where the fault occurred.
+                        *
+                        * Note that if the Guest were really messed up, this
+                        * could happen before it's done the INITIALIZE
+                        * hypercall, so lg->lguest_data will be NULL, so
+                        * &lg->lguest_data->cr2 will be address 8.  Writing
+                        * into that address won't hurt the Host at all,
+                        * though. */
                        if (put_user(cr2, &lg->lguest_data->cr2))
                                kill_guest(lg, "Writing cr2");
                        break;
                case 7: /* We've intercepted a Device Not Available fault. */
-                       /* If they don't want to know, just absorb it. */
+                       /* If the Guest doesn't want to know, we already
+                        * restored the Floating Point Unit, so we just
+                        * continue without telling it. */
                        if (!lg->ts)
                                continue;
                        break;
-               case 32 ... 255: /* Real interrupt, fall thru */
+               case 32 ... 255:
+                       /* These values mean a real interrupt occurred, in
+                        * which case the Host handler has already been run.
+                        * We just do a friendly check if another process
+                        * should now be run, then fall through to loop
+                        * around: */
                        cond_resched();
                case LGUEST_TRAP_ENTRY: /* Handled at top of loop */
                        continue;
                }
 
+               /* If we get here, it's a trap the Guest wants to know
+                * about. */
                if (deliver_trap(lg, lg->regs->trapnum))
                        continue;
 
+               /* If the Guest doesn't have a handler (either it hasn't
+                * registered any yet, or it's one of the faults we don't let
+                * it handle), it dies with a cryptic error message. */
                kill_guest(lg, "unhandled trap %li at %#lx (%#lx)",
                           lg->regs->trapnum, lg->regs->eip,
                           lg->regs->trapnum == 14 ? cr2 : lg->regs->errcode);
        }
+       /* The Guest is dead => "No such file or directory" */
        return -ENOENT;
 }
 
+/* Now we can look at each of the routines this calls, in increasing order of
+ * complexity: do_hypercalls(), emulate_insn(), maybe_do_interrupt(),
+ * deliver_trap() and demand_page().  After all those, we'll be ready to
+ * examine the Switcher, and our philosophical understanding of the Host/Guest
+ * duality will be complete. :*/
+
 int find_free_guest(void)
 {
        unsigned int i;
@@ -407,55 +680,96 @@ static void adjust_pge(void *on)
                write_cr4(read_cr4() & ~X86_CR4_PGE);
 }
 
+/*H:000
+ * Welcome to the Host!
+ *
+ * By this point your brain has been tickled by the Guest code and numbed by
+ * the Launcher code; prepare for it to be stretched by the Host code.  This is
+ * the heart.  Let's begin at the initialization routine for the Host's lg
+ * module.
+ */
 static int __init init(void)
 {
        int err;
 
+       /* Lguest can't run under Xen, VMI or itself.  It does Tricky Stuff. */
        if (paravirt_enabled()) {
                printk("lguest is afraid of %s\n", paravirt_ops.name);
                return -EPERM;
        }
 
+       /* First we put the Switcher up in very high virtual memory. */
        err = map_switcher();
        if (err)
                return err;
 
+       /* Now we set up the pagetable implementation for the Guests. */
        err = init_pagetables(switcher_page, SHARED_SWITCHER_PAGES);
        if (err) {
                unmap_switcher();
                return err;
        }
+
+       /* The I/O subsystem needs some things initialized. */
        lguest_io_init();
 
+       /* /dev/lguest needs to be registered. */
        err = lguest_device_init();
        if (err) {
                free_pagetables();
                unmap_switcher();
                return err;
        }
+
+       /* Finally, we need to turn off "Page Global Enable".  PGE is an
+        * optimization where page table entries are specially marked to show
+        * they never change.  The Host kernel marks all the kernel pages this
+        * way because it's always present, even when userspace is running.
+        *
+        * Lguest breaks this: unbeknownst to the rest of the Host kernel, we
+        * switch to the Guest kernel.  If you don't disable this on all CPUs,
+        * you'll get really weird bugs that you'll chase for two days.
+        *
+        * I used to turn PGE off every time we switched to the Guest and back
+        * on when we return, but that slowed the Switcher down noticibly. */
+
+       /* We don't need the complexity of CPUs coming and going while we're
+        * doing this. */
        lock_cpu_hotplug();
        if (cpu_has_pge) { /* We have a broader idea of "global". */
+               /* Remember that this was originally set (for cleanup). */
                cpu_had_pge = 1;
+               /* adjust_pge is a helper function which sets or unsets the PGE
+                * bit on its CPU, depending on the argument (0 == unset). */
                on_each_cpu(adjust_pge, (void *)0, 0, 1);
+               /* Turn off the feature in the global feature set. */
                clear_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability);
        }
        unlock_cpu_hotplug();
+
+       /* All good! */
        return 0;
 }
 
+/* Cleaning up is just the same code, backwards.  With a little French. */
 static void __exit fini(void)
 {
        lguest_device_remove();
        free_pagetables();
        unmap_switcher();
+
+       /* If we had PGE before we started, turn it back on now. */
        lock_cpu_hotplug();
        if (cpu_had_pge) {
                set_bit(X86_FEATURE_PGE, boot_cpu_data.x86_capability);
+               /* adjust_pge's argument "1" means set PGE. */
                on_each_cpu(adjust_pge, (void *)1, 0, 1);
        }
        unlock_cpu_hotplug();
 }
 
+/* The Host side of lguest can be a module.  This is a nice way for people to
+ * play with it.  */
 module_init(init);
 module_exit(fini);
 MODULE_LICENSE("GPL");
index ea52ca451f74f78dce4dec85f1e0b39551615fd9..db6caace3b9c22a7ce16a85580de212d318c4cd2 100644 (file)
@@ -1,5 +1,10 @@
-/*  Actual hypercalls, which allow guests to actually do something.
-    Copyright (C) 2006 Rusty Russell IBM Corporation
+/*P:500 Just as userspace programs request kernel operations through a system
+ * call, the Guest requests Host operations through a "hypercall".  You might
+ * notice this nomenclature doesn't really follow any logic, but the name has
+ * been around for long enough that we're stuck with it.  As you'd expect, this
+ * code is basically a one big switch statement. :*/
+
+/*  Copyright (C) 2006 Rusty Russell IBM Corporation
 
     This program is free software; you can redistribute it and/or modify
     it under the terms of the GNU General Public License as published by
 #include <irq_vectors.h>
 #include "lg.h"
 
+/*H:120 This is the core hypercall routine: where the Guest gets what it
+ * wants.  Or gets killed.  Or, in the case of LHCALL_CRASH, both.
+ *
+ * Remember from the Guest: %eax == which call to make, and the arguments are
+ * packed into %edx, %ebx and %ecx if needed. */
 static void do_hcall(struct lguest *lg, struct lguest_regs *regs)
 {
        switch (regs->eax) {
        case LHCALL_FLUSH_ASYNC:
+               /* This call does nothing, except by breaking out of the Guest
+                * it makes us process all the asynchronous hypercalls. */
                break;
        case LHCALL_LGUEST_INIT:
+               /* You can't get here unless you're already initialized.  Don't
+                * do that. */
                kill_guest(lg, "already have lguest_data");
                break;
        case LHCALL_CRASH: {
+               /* Crash is such a trivial hypercall that we do it in four
+                * lines right here. */
                char msg[128];
+               /* If the lgread fails, it will call kill_guest() itself; the
+                * kill_guest() with the message will be ignored. */
                lgread(lg, msg, regs->edx, sizeof(msg));
                msg[sizeof(msg)-1] = '\0';
                kill_guest(lg, "CRASH: %s", msg);
                break;
        }
        case LHCALL_FLUSH_TLB:
+               /* FLUSH_TLB comes in two flavors, depending on the
+                * argument: */
                if (regs->edx)
                        guest_pagetable_clear_all(lg);
                else
                        guest_pagetable_flush_user(lg);
                break;
-       case LHCALL_GET_WALLCLOCK: {
-               struct timespec ts;
-               ktime_get_real_ts(&ts);
-               regs->eax = ts.tv_sec;
-               break;
-       }
        case LHCALL_BIND_DMA:
+               /* BIND_DMA really wants four arguments, but it's the only call
+                * which does.  So the Guest packs the number of buffers and
+                * the interrupt number into the final argument, and we decode
+                * it here.  This can legitimately fail, since we currently
+                * place a limit on the number of DMA pools a Guest can have.
+                * So we return true or false from this call. */
                regs->eax = bind_dma(lg, regs->edx, regs->ebx,
                                     regs->ecx >> 8, regs->ecx & 0xFF);
                break;
+
+       /* All these calls simply pass the arguments through to the right
+        * routines. */
        case LHCALL_SEND_DMA:
                send_dma(lg, regs->edx, regs->ebx);
                break;
@@ -81,10 +104,13 @@ static void do_hcall(struct lguest *lg, struct lguest_regs *regs)
        case LHCALL_SET_CLOCKEVENT:
                guest_set_clockevent(lg, regs->edx);
                break;
+
        case LHCALL_TS:
+               /* This sets the TS flag, as we saw used in run_guest(). */
                lg->ts = regs->edx;
                break;
        case LHCALL_HALT:
+               /* Similarly, this sets the halted flag for run_guest(). */
                lg->halted = 1;
                break;
        default:
@@ -92,25 +118,42 @@ static void do_hcall(struct lguest *lg, struct lguest_regs *regs)
        }
 }
 
-/* We always do queued calls before actual hypercall. */
+/* Asynchronous hypercalls are easy: we just look in the array in the Guest's
+ * "struct lguest_data" and see if there are any new ones marked "ready".
+ *
+ * We are careful to do these in order: obviously we respect the order the
+ * Guest put them in the ring, but we also promise the Guest that they will
+ * happen before any normal hypercall (which is why we check this before
+ * checking for a normal hcall). */
 static void do_async_hcalls(struct lguest *lg)
 {
        unsigned int i;
        u8 st[LHCALL_RING_SIZE];
 
+       /* For simplicity, we copy the entire call status array in at once. */
        if (copy_from_user(&st, &lg->lguest_data->hcall_status, sizeof(st)))
                return;
 
+
+       /* We process "struct lguest_data"s hcalls[] ring once. */
        for (i = 0; i < ARRAY_SIZE(st); i++) {
                struct lguest_regs regs;
+               /* We remember where we were up to from last time.  This makes
+                * sure that the hypercalls are done in the order the Guest
+                * places them in the ring. */
                unsigned int n = lg->next_hcall;
 
+               /* 0xFF means there's no call here (yet). */
                if (st[n] == 0xFF)
                        break;
 
+               /* OK, we have hypercall.  Increment the "next_hcall" cursor,
+                * and wrap back to 0 if we reach the end. */
                if (++lg->next_hcall == LHCALL_RING_SIZE)
                        lg->next_hcall = 0;
 
+               /* We copy the hypercall arguments into a fake register
+                * structure.  This makes life simple for do_hcall(). */
                if (get_user(regs.eax, &lg->lguest_data->hcalls[n].eax)
                    || get_user(regs.edx, &lg->lguest_data->hcalls[n].edx)
                    || get_user(regs.ecx, &lg->lguest_data->hcalls[n].ecx)
@@ -119,74 +162,139 @@ static void do_async_hcalls(struct lguest *lg)
                        break;
                }
 
+               /* Do the hypercall, same as a normal one. */
                do_hcall(lg, &regs);
+
+               /* Mark the hypercall done. */
                if (put_user(0xFF, &lg->lguest_data->hcall_status[n])) {
                        kill_guest(lg, "Writing result for async hypercall");
                        break;
                }
 
+               /* Stop doing hypercalls if we've just done a DMA to the
+                * Launcher: it needs to service this first. */
                if (lg->dma_is_pending)
                        break;
        }
 }
 
+/* Last of all, we look at what happens first of all.  The very first time the
+ * Guest makes a hypercall, we end up here to set things up: */
 static void initialize(struct lguest *lg)
 {
        u32 tsc_speed;
 
+       /* You can't do anything until you're initialized.  The Guest knows the
+        * rules, so we're unforgiving here. */
        if (lg->regs->eax != LHCALL_LGUEST_INIT) {
                kill_guest(lg, "hypercall %li before LGUEST_INIT",
                           lg->regs->eax);
                return;
        }
 
-       /* We only tell the guest to use the TSC if it's reliable. */
+       /* We insist that the Time Stamp Counter exist and doesn't change with
+        * cpu frequency.  Some devious chip manufacturers decided that TSC
+        * changes could be handled in software.  I decided that time going
+        * backwards might be good for benchmarks, but it's bad for users.
+        *
+        * We also insist that the TSC be stable: the kernel detects unreliable
+        * TSCs for its own purposes, and we use that here. */
        if (boot_cpu_has(X86_FEATURE_CONSTANT_TSC) && !check_tsc_unstable())
                tsc_speed = tsc_khz;
        else
                tsc_speed = 0;
 
+       /* The pointer to the Guest's "struct lguest_data" is the only
+        * argument. */
        lg->lguest_data = (struct lguest_data __user *)lg->regs->edx;
-       /* We check here so we can simply copy_to_user/from_user */
+       /* If we check the address they gave is OK now, we can simply
+        * copy_to_user/from_user from now on rather than using lgread/lgwrite.
+        * I put this in to show that I'm not immune to writing stupid
+        * optimizations. */
        if (!lguest_address_ok(lg, lg->regs->edx, sizeof(*lg->lguest_data))) {
                kill_guest(lg, "bad guest page %p", lg->lguest_data);
                return;
        }
+       /* The Guest tells us where we're not to deliver interrupts by putting
+        * the range of addresses into "struct lguest_data". */
        if (get_user(lg->noirq_start, &lg->lguest_data->noirq_start)
            || get_user(lg->noirq_end, &lg->lguest_data->noirq_end)
-           /* We reserve the top pgd entry. */
+           /* We tell the Guest that it can't use the top 4MB of virtual
+            * addresses used by the Switcher. */
            || put_user(4U*1024*1024, &lg->lguest_data->reserve_mem)
            || put_user(tsc_speed, &lg->lguest_data->tsc_khz)
+           /* We also give the Guest a unique id, as used in lguest_net.c. */
            || put_user(lg->guestid, &lg->lguest_data->guestid))
                kill_guest(lg, "bad guest page %p", lg->lguest_data);
 
-       /* This is the one case where the above accesses might have
-        * been the first write to a Guest page.  This may have caused
-        * a copy-on-write fault, but the Guest might be referring to
-        * the old (read-only) page. */
+       /* We write the current time into the Guest's data page once now. */
+       write_timestamp(lg);
+
+       /* This is the one case where the above accesses might have been the
+        * first write to a Guest page.  This may have caused a copy-on-write
+        * fault, but the Guest might be referring to the old (read-only)
+        * page. */
        guest_pagetable_clear_all(lg);
 }
+/* Now we've examined the hypercall code; our Guest can make requests.  There
+ * is one other way we can do things for the Guest, as we see in
+ * emulate_insn(). */
 
-/* Even if we go out to userspace and come back, we don't want to do
- * the hypercall again. */
+/*H:110 Tricky point: we mark the hypercall as "done" once we've done it.
+ * Normally we don't need to do this: the Guest will run again and update the
+ * trap number before we come back around the run_guest() loop to
+ * do_hypercalls().
+ *
+ * However, if we are signalled or the Guest sends DMA to the Launcher, that
+ * loop will exit without running the Guest.  When it comes back it would try
+ * to re-run the hypercall. */
 static void clear_hcall(struct lguest *lg)
 {
        lg->regs->trapnum = 255;
 }
 
+/*H:100
+ * Hypercalls
+ *
+ * Remember from the Guest, hypercalls come in two flavors: normal and
+ * asynchronous.  This file handles both of types.
+ */
 void do_hypercalls(struct lguest *lg)
 {
+       /* Not initialized yet? */
        if (unlikely(!lg->lguest_data)) {
+               /* Did the Guest make a hypercall?  We might have come back for
+                * some other reason (an interrupt, a different trap). */
                if (lg->regs->trapnum == LGUEST_TRAP_ENTRY) {
+                       /* Set up the "struct lguest_data" */
                        initialize(lg);
+                       /* The hypercall is done. */
                        clear_hcall(lg);
                }
                return;
        }
 
+       /* The Guest has initialized.
+        *
+        * Look in the hypercall ring for the async hypercalls: */
        do_async_hcalls(lg);
+
+       /* If we stopped reading the hypercall ring because the Guest did a
+        * SEND_DMA to the Launcher, we want to return now.  Otherwise if the
+        * Guest asked us to do a hypercall, we do it. */
        if (!lg->dma_is_pending && lg->regs->trapnum == LGUEST_TRAP_ENTRY) {
                do_hcall(lg, lg->regs);
+               /* The hypercall is done. */
                clear_hcall(lg);
        }
 }
+
+/* This routine supplies the Guest with time: it's used for wallclock time at
+ * initial boot and as a rough time source if the TSC isn't available. */
+void write_timestamp(struct lguest *lg)
+{
+       struct timespec now;
+       ktime_get_real_ts(&now);
+       if (put_user(now, &lg->lguest_data->time))
+               kill_guest(lg, "Writing timestamp");
+}
index bee029bb2c7bf543912f97d1fa798739569e2606..49aa55577d0dec0e2543c2a8801b91ebc98b1359 100644 (file)
+/*P:800 Interrupts (traps) are complicated enough to earn their own file.
+ * There are three classes of interrupts:
+ *
+ * 1) Real hardware interrupts which occur while we're running the Guest,
+ * 2) Interrupts for virtual devices attached to the Guest, and
+ * 3) Traps and faults from the Guest.
+ *
+ * Real hardware interrupts must be delivered to the Host, not the Guest.
+ * Virtual interrupts must be delivered to the Guest, but we make them look
+ * just like real hardware would deliver them.  Traps from the Guest can be set
+ * up to go directly back into the Guest, but sometimes the Host wants to see
+ * them first, so we also have a way of "reflecting" them into the Guest as if
+ * they had been delivered to it directly. :*/
 #include <linux/uaccess.h>
 #include "lg.h"
 
+/* The address of the interrupt handler is split into two bits: */
 static unsigned long idt_address(u32 lo, u32 hi)
 {
        return (lo & 0x0000FFFF) | (hi & 0xFFFF0000);
 }
 
+/* The "type" of the interrupt handler is a 4 bit field: we only support a
+ * couple of types. */
 static int idt_type(u32 lo, u32 hi)
 {
        return (hi >> 8) & 0xF;
 }
 
+/* An IDT entry can't be used unless the "present" bit is set. */
 static int idt_present(u32 lo, u32 hi)
 {
        return (hi & 0x8000);
 }
 
+/* We need a helper to "push" a value onto the Guest's stack, since that's a
+ * big part of what delivering an interrupt does. */
 static void push_guest_stack(struct lguest *lg, unsigned long *gstack, u32 val)
 {
+       /* Stack grows upwards: move stack then write value. */
        *gstack -= 4;
        lgwrite_u32(lg, *gstack, val);
 }
 
+/*H:210 The set_guest_interrupt() routine actually delivers the interrupt or
+ * trap.  The mechanics of delivering traps and interrupts to the Guest are the
+ * same, except some traps have an "error code" which gets pushed onto the
+ * stack as well: the caller tells us if this is one.
+ *
+ * "lo" and "hi" are the two parts of the Interrupt Descriptor Table for this
+ * interrupt or trap.  It's split into two parts for traditional reasons: gcc
+ * on i386 used to be frightened by 64 bit numbers.
+ *
+ * We set up the stack just like the CPU does for a real interrupt, so it's
+ * identical for the Guest (and the standard "iret" instruction will undo
+ * it). */
 static void set_guest_interrupt(struct lguest *lg, u32 lo, u32 hi, int has_err)
 {
        unsigned long gstack;
        u32 eflags, ss, irq_enable;
 
-       /* If they want a ring change, we use new stack and push old ss/esp */
+       /* There are two cases for interrupts: one where the Guest is already
+        * in the kernel, and a more complex one where the Guest is in
+        * userspace.  We check the privilege level to find out. */
        if ((lg->regs->ss&0x3) != GUEST_PL) {
+               /* The Guest told us their kernel stack with the SET_STACK
+                * hypercall: both the virtual address and the segment */
                gstack = guest_pa(lg, lg->esp1);
                ss = lg->ss1;
+               /* We push the old stack segment and pointer onto the new
+                * stack: when the Guest does an "iret" back from the interrupt
+                * handler the CPU will notice they're dropping privilege
+                * levels and expect these here. */
                push_guest_stack(lg, &gstack, lg->regs->ss);
                push_guest_stack(lg, &gstack, lg->regs->esp);
        } else {
+               /* We're staying on the same Guest (kernel) stack. */
                gstack = guest_pa(lg, lg->regs->esp);
                ss = lg->regs->ss;
        }
 
-       /* We use IF bit in eflags to indicate whether irqs were enabled
-          (it's always 1, since irqs are enabled when guest is running). */
+       /* Remember that we never let the Guest actually disable interrupts, so
+        * the "Interrupt Flag" bit is always set.  We copy that bit from the
+        * Guest's "irq_enabled" field into the eflags word: the Guest copies
+        * it back in "lguest_iret". */
        eflags = lg->regs->eflags;
        if (get_user(irq_enable, &lg->lguest_data->irq_enabled) == 0
            && !(irq_enable & X86_EFLAGS_IF))
                eflags &= ~X86_EFLAGS_IF;
 
+       /* An interrupt is expected to push three things on the stack: the old
+        * "eflags" word, the old code segment, and the old instruction
+        * pointer. */
        push_guest_stack(lg, &gstack, eflags);
        push_guest_stack(lg, &gstack, lg->regs->cs);
        push_guest_stack(lg, &gstack, lg->regs->eip);
 
+       /* For the six traps which supply an error code, we push that, too. */
        if (has_err)
                push_guest_stack(lg, &gstack, lg->regs->errcode);
 
-       /* Change the real stack so switcher returns to trap handler */
+       /* Now we've pushed all the old state, we change the stack, the code
+        * segment and the address to execute. */
        lg->regs->ss = ss;
        lg->regs->esp = gstack + lg->page_offset;
        lg->regs->cs = (__KERNEL_CS|GUEST_PL);
        lg->regs->eip = idt_address(lo, hi);
 
-       /* Disable interrupts for an interrupt gate. */
+       /* There are two kinds of interrupt handlers: 0xE is an "interrupt
+        * gate" which expects interrupts to be disabled on entry. */
        if (idt_type(lo, hi) == 0xE)
                if (put_user(0, &lg->lguest_data->irq_enabled))
                        kill_guest(lg, "Disabling interrupts");
 }
 
+/*H:200
+ * Virtual Interrupts.
+ *
+ * maybe_do_interrupt() gets called before every entry to the Guest, to see if
+ * we should divert the Guest to running an interrupt handler. */
 void maybe_do_interrupt(struct lguest *lg)
 {
        unsigned int irq;
        DECLARE_BITMAP(blk, LGUEST_IRQS);
        struct desc_struct *idt;
 
+       /* If the Guest hasn't even initialized yet, we can do nothing. */
        if (!lg->lguest_data)
                return;
 
-       /* Mask out any interrupts they have blocked. */
+       /* Take our "irqs_pending" array and remove any interrupts the Guest
+        * wants blocked: the result ends up in "blk". */
        if (copy_from_user(&blk, lg->lguest_data->blocked_interrupts,
                           sizeof(blk)))
                return;
 
        bitmap_andnot(blk, lg->irqs_pending, blk, LGUEST_IRQS);
 
+       /* Find the first interrupt. */
        irq = find_first_bit(blk, LGUEST_IRQS);
+       /* None?  Nothing to do */
        if (irq >= LGUEST_IRQS)
                return;
 
+       /* They may be in the middle of an iret, where they asked us never to
+        * deliver interrupts. */
        if (lg->regs->eip >= lg->noirq_start && lg->regs->eip < lg->noirq_end)
                return;
 
-       /* If they're halted, we re-enable interrupts. */
+       /* If they're halted, interrupts restart them. */
        if (lg->halted) {
                /* Re-enable interrupts. */
                if (put_user(X86_EFLAGS_IF, &lg->lguest_data->irq_enabled))
                        kill_guest(lg, "Re-enabling interrupts");
                lg->halted = 0;
        } else {
-               /* Maybe they have interrupts disabled? */
+               /* Otherwise we check if they have interrupts disabled. */
                u32 irq_enabled;
                if (get_user(irq_enabled, &lg->lguest_data->irq_enabled))
                        irq_enabled = 0;
@@ -102,112 +162,221 @@ void maybe_do_interrupt(struct lguest *lg)
                        return;
        }
 
+       /* Look at the IDT entry the Guest gave us for this interrupt.  The
+        * first 32 (FIRST_EXTERNAL_VECTOR) entries are for traps, so we skip
+        * over them. */
        idt = &lg->idt[FIRST_EXTERNAL_VECTOR+irq];
+       /* If they don't have a handler (yet?), we just ignore it */
        if (idt_present(idt->a, idt->b)) {
+               /* OK, mark it no longer pending and deliver it. */
                clear_bit(irq, lg->irqs_pending);
+               /* set_guest_interrupt() takes the interrupt descriptor and a
+                * flag to say whether this interrupt pushes an error code onto
+                * the stack as well: virtual interrupts never do. */
                set_guest_interrupt(lg, idt->a, idt->b, 0);
        }
+
+       /* Every time we deliver an interrupt, we update the timestamp in the
+        * Guest's lguest_data struct.  It would be better for the Guest if we
+        * did this more often, but it can actually be quite slow: doing it
+        * here is a compromise which means at least it gets updated every
+        * timer interrupt. */
+       write_timestamp(lg);
 }
 
+/*H:220 Now we've got the routines to deliver interrupts, delivering traps
+ * like page fault is easy.  The only trick is that Intel decided that some
+ * traps should have error codes: */
 static int has_err(unsigned int trap)
 {
        return (trap == 8 || (trap >= 10 && trap <= 14) || trap == 17);
 }
 
+/* deliver_trap() returns true if it could deliver the trap. */
 int deliver_trap(struct lguest *lg, unsigned int num)
 {
-       u32 lo = lg->idt[num].a, hi = lg->idt[num].b;
+       /* Trap numbers are always 8 bit, but we set an impossible trap number
+        * for traps inside the Switcher, so check that here. */
+       if (num >= ARRAY_SIZE(lg->idt))
+               return 0;
 
-       if (!idt_present(lo, hi))
+       /* Early on the Guest hasn't set the IDT entries (or maybe it put a
+        * bogus one in): if we fail here, the Guest will be killed. */
+       if (!idt_present(lg->idt[num].a, lg->idt[num].b))
                return 0;
-       set_guest_interrupt(lg, lo, hi, has_err(num));
+       set_guest_interrupt(lg, lg->idt[num].a, lg->idt[num].b, has_err(num));
        return 1;
 }
 
+/*H:250 Here's the hard part: returning to the Host every time a trap happens
+ * and then calling deliver_trap() and re-entering the Guest is slow.
+ * Particularly because Guest userspace system calls are traps (trap 128).
+ *
+ * So we'd like to set up the IDT to tell the CPU to deliver traps directly
+ * into the Guest.  This is possible, but the complexities cause the size of
+ * this file to double!  However, 150 lines of code is worth writing for taking
+ * system calls down from 1750ns to 270ns.  Plus, if lguest didn't do it, all
+ * the other hypervisors would tease it.
+ *
+ * This routine determines if a trap can be delivered directly. */
 static int direct_trap(const struct lguest *lg,
                       const struct desc_struct *trap,
                       unsigned int num)
 {
-       /* Hardware interrupts don't go to guest (except syscall). */
+       /* Hardware interrupts don't go to the Guest at all (except system
+        * call). */
        if (num >= FIRST_EXTERNAL_VECTOR && num != SYSCALL_VECTOR)
                return 0;
 
-       /* We intercept page fault (demand shadow paging & cr2 saving)
-          protection fault (in/out emulation) and device not
-          available (TS handling), and hypercall */
+       /* The Host needs to see page faults (for shadow paging and to save the
+        * fault address), general protection faults (in/out emulation) and
+        * device not available (TS handling), and of course, the hypercall
+        * trap. */
        if (num == 14 || num == 13 || num == 7 || num == LGUEST_TRAP_ENTRY)
                return 0;
 
-       /* Interrupt gates (0xE) or not present (0x0) can't go direct. */
+       /* Only trap gates (type 15) can go direct to the Guest.  Interrupt
+        * gates (type 14) disable interrupts as they are entered, which we
+        * never let the Guest do.  Not present entries (type 0x0) also can't
+        * go direct, of course 8) */
        return idt_type(trap->a, trap->b) == 0xF;
 }
-
+/*:*/
+
+/*M:005 The Guest has the ability to turn its interrupt gates into trap gates,
+ * if it is careful.  The Host will let trap gates can go directly to the
+ * Guest, but the Guest needs the interrupts atomically disabled for an
+ * interrupt gate.  It can do this by pointing the trap gate at instructions
+ * within noirq_start and noirq_end, where it can safely disable interrupts. */
+
+/*M:006 The Guests do not use the sysenter (fast system call) instruction,
+ * because it's hardcoded to enter privilege level 0 and so can't go direct.
+ * It's about twice as fast as the older "int 0x80" system call, so it might
+ * still be worthwhile to handle it in the Switcher and lcall down to the
+ * Guest.  The sysenter semantics are hairy tho: search for that keyword in
+ * entry.S :*/
+
+/*H:260 When we make traps go directly into the Guest, we need to make sure
+ * the kernel stack is valid (ie. mapped in the page tables).  Otherwise, the
+ * CPU trying to deliver the trap will fault while trying to push the interrupt
+ * words on the stack: this is called a double fault, and it forces us to kill
+ * the Guest.
+ *
+ * Which is deeply unfair, because (literally!) it wasn't the Guests' fault. */
 void pin_stack_pages(struct lguest *lg)
 {
        unsigned int i;
 
+       /* Depending on the CONFIG_4KSTACKS option, the Guest can have one or
+        * two pages of stack space. */
        for (i = 0; i < lg->stack_pages; i++)
+               /* The stack grows *upwards*, hence the subtraction */
                pin_page(lg, lg->esp1 - i * PAGE_SIZE);
 }
 
+/* Direct traps also mean that we need to know whenever the Guest wants to use
+ * a different kernel stack, so we can change the IDT entries to use that
+ * stack.  The IDT entries expect a virtual address, so unlike most addresses
+ * the Guest gives us, the "esp" (stack pointer) value here is virtual, not
+ * physical.
+ *
+ * In Linux each process has its own kernel stack, so this happens a lot: we
+ * change stacks on each context switch. */
 void guest_set_stack(struct lguest *lg, u32 seg, u32 esp, unsigned int pages)
 {
-       /* You cannot have a stack segment with priv level 0. */
+       /* You are not allowd have a stack segment with privilege level 0: bad
+        * Guest! */
        if ((seg & 0x3) != GUEST_PL)
                kill_guest(lg, "bad stack segment %i", seg);
+       /* We only expect one or two stack pages. */
        if (pages > 2)
                kill_guest(lg, "bad stack pages %u", pages);
+       /* Save where the stack is, and how many pages */
        lg->ss1 = seg;
        lg->esp1 = esp;
        lg->stack_pages = pages;
+       /* Make sure the new stack pages are mapped */
        pin_stack_pages(lg);
 }
 
-/* Set up trap in IDT. */
+/* All this reference to mapping stacks leads us neatly into the other complex
+ * part of the Host: page table handling. */
+
+/*H:235 This is the routine which actually checks the Guest's IDT entry and
+ * transfers it into our entry in "struct lguest": */
 static void set_trap(struct lguest *lg, struct desc_struct *trap,
                     unsigned int num, u32 lo, u32 hi)
 {
        u8 type = idt_type(lo, hi);
 
+       /* We zero-out a not-present entry */
        if (!idt_present(lo, hi)) {
                trap->a = trap->b = 0;
                return;
        }
 
+       /* We only support interrupt and trap gates. */
        if (type != 0xE && type != 0xF)
                kill_guest(lg, "bad IDT type %i", type);
 
+       /* We only copy the handler address, present bit, privilege level and
+        * type.  The privilege level controls where the trap can be triggered
+        * manually with an "int" instruction.  This is usually GUEST_PL,
+        * except for system calls which userspace can use. */
        trap->a = ((__KERNEL_CS|GUEST_PL)<<16) | (lo&0x0000FFFF);
        trap->b = (hi&0xFFFFEF00);
 }
 
+/*H:230 While we're here, dealing with delivering traps and interrupts to the
+ * Guest, we might as well complete the picture: how the Guest tells us where
+ * it wants them to go.  This would be simple, except making traps fast
+ * requires some tricks.
+ *
+ * We saw the Guest setting Interrupt Descriptor Table (IDT) entries with the
+ * LHCALL_LOAD_IDT_ENTRY hypercall before: that comes here. */
 void load_guest_idt_entry(struct lguest *lg, unsigned int num, u32 lo, u32 hi)
 {
-       /* Guest never handles: NMI, doublefault, hypercall, spurious irq. */
+       /* Guest never handles: NMI, doublefault, spurious interrupt or
+        * hypercall.  We ignore when it tries to set them. */
        if (num == 2 || num == 8 || num == 15 || num == LGUEST_TRAP_ENTRY)
                return;
 
+       /* Mark the IDT as changed: next time the Guest runs we'll know we have
+        * to copy this again. */
        lg->changed |= CHANGED_IDT;
+
+       /* The IDT which we keep in "struct lguest" only contains 32 entries
+        * for the traps and LGUEST_IRQS (32) entries for interrupts.  We
+        * ignore attempts to set handlers for higher interrupt numbers, except
+        * for the system call "interrupt" at 128: we have a special IDT entry
+        * for that. */
        if (num < ARRAY_SIZE(lg->idt))
                set_trap(lg, &lg->idt[num], num, lo, hi);
        else if (num == SYSCALL_VECTOR)
                set_trap(lg, &lg->syscall_idt, num, lo, hi);
 }
 
+/* The default entry for each interrupt points into the Switcher routines which
+ * simply return to the Host.  The run_guest() loop will then call
+ * deliver_trap() to bounce it back into the Guest. */
 static void default_idt_entry(struct desc_struct *idt,
                              int trap,
                              const unsigned long handler)
 {
+       /* A present interrupt gate. */
        u32 flags = 0x8e00;
 
-       /* They can't "int" into any of them except hypercall. */
+       /* Set the privilege level on the entry for the hypercall: this allows
+        * the Guest to use the "int" instruction to trigger it. */
        if (trap == LGUEST_TRAP_ENTRY)
                flags |= (GUEST_PL << 13);
 
+       /* Now pack it into the IDT entry in its weird format. */
        idt->a = (LGUEST_CS<<16) | (handler&0x0000FFFF);
        idt->b = (handler&0xFFFF0000) | flags;
 }
 
+/* When the Guest first starts, we put default entries into the IDT. */
 void setup_default_idt_entries(struct lguest_ro_state *state,
                               const unsigned long *def)
 {
@@ -217,19 +386,25 @@ void setup_default_idt_entries(struct lguest_ro_state *state,
                default_idt_entry(&state->guest_idt[i], i, def[i]);
 }
 
+/*H:240 We don't use the IDT entries in the "struct lguest" directly, instead
+ * we copy them into the IDT which we've set up for Guests on this CPU, just
+ * before we run the Guest.  This routine does that copy. */
 void copy_traps(const struct lguest *lg, struct desc_struct *idt,
                const unsigned long *def)
 {
        unsigned int i;
 
-       /* All hardware interrupts are same whatever the guest: only the
-        * traps might be different. */
+       /* We can simply copy the direct traps, otherwise we use the default
+        * ones in the Switcher: they will return to the Host. */
        for (i = 0; i < FIRST_EXTERNAL_VECTOR; i++) {
                if (direct_trap(lg, &lg->idt[i], i))
                        idt[i] = lg->idt[i];
                else
                        default_idt_entry(&idt[i], i, def[i]);
        }
+
+       /* Don't forget the system call trap!  The IDT entries for other
+        * interupts never change, so no need to copy them. */
        i = SYSCALL_VECTOR;
        if (direct_trap(lg, &lg->syscall_idt, i))
                idt[i] = lg->syscall_idt;
index c8eb79266991efb68d34e077de859295e8f8edcb..ea68613b43f6282fb922d19a5af30b0e2073b870 100644 (file)
@@ -1,5 +1,9 @@
-/* Simple I/O model for guests, based on shared memory.
- * Copyright (C) 2006 Rusty Russell IBM Corporation
+/*P:300 The I/O mechanism in lguest is simple yet flexible, allowing the Guest
+ * to talk to the Launcher or directly to another Guest.  It uses familiar
+ * concepts of DMA and interrupts, plus some neat code stolen from
+ * futexes... :*/
+
+/* Copyright (C) 2006 Rusty Russell IBM Corporation
  *
  *  This program is free software; you can redistribute it and/or modify
  *  it under the terms of the GNU General Public License as published by
 #include <linux/uaccess.h>
 #include "lg.h"
 
+/*L:300
+ * I/O
+ *
+ * Getting data in and out of the Guest is quite an art.  There are numerous
+ * ways to do it, and they all suck differently.  We try to keep things fairly
+ * close to "real" hardware so our Guest's drivers don't look like an alien
+ * visitation in the middle of the Linux code, and yet make sure that Guests
+ * can talk directly to other Guests, not just the Launcher.
+ *
+ * To do this, the Guest gives us a key when it binds or sends DMA buffers.
+ * The key corresponds to a "physical" address inside the Guest (ie. a virtual
+ * address inside the Launcher process).  We don't, however, use this key
+ * directly.
+ *
+ * We want Guests which share memory to be able to DMA to each other: two
+ * Launchers can mmap memory the same file, then the Guests can communicate.
+ * Fortunately, the futex code provides us with a way to get a "union
+ * futex_key" corresponding to the memory lying at a virtual address: if the
+ * two processes share memory, the "union futex_key" for that memory will match
+ * even if the memory is mapped at different addresses in each.  So we always
+ * convert the keys to "union futex_key"s to compare them.
+ *
+ * Before we dive into this though, we need to look at another set of helper
+ * routines used throughout the Host kernel code to access Guest memory.
+ :*/
 static struct list_head dma_hash[61];
 
+/* An unfortunate side effect of the Linux double-linked list implementation is
+ * that there's no good way to statically initialize an array of linked
+ * lists. */
 void lguest_io_init(void)
 {
        unsigned int i;
@@ -56,6 +88,19 @@ kill:
        return 0;
 }
 
+/*L:330 This is our hash function, using the wonderful Jenkins hash.
+ *
+ * The futex key is a union with three parts: an unsigned long word, a pointer,
+ * and an int "offset".  We could use jhash_2words() which takes three u32s.
+ * (Ok, the hash functions are great: the naming sucks though).
+ *
+ * It's nice to be portable to 64-bit platforms, so we use the more generic
+ * jhash2(), which takes an array of u32, the number of u32s, and an initial
+ * u32 to roll in.  This is uglier, but breaks down to almost the same code on
+ * 32-bit platforms like this one.
+ *
+ * We want a position in the array, so we modulo ARRAY_SIZE(dma_hash) (ie. 61).
+ */
 static unsigned int hash(const union futex_key *key)
 {
        return jhash2((u32*)&key->both.word,
@@ -64,6 +109,9 @@ static unsigned int hash(const union futex_key *key)
                % ARRAY_SIZE(dma_hash);
 }
 
+/* This is a convenience routine to compare two keys.  It's a much bemoaned C
+ * weakness that it doesn't allow '==' on structures or unions, so we have to
+ * open-code it like this. */
 static inline int key_eq(const union futex_key *a, const union futex_key *b)
 {
        return (a->both.word == b->both.word
@@ -71,22 +119,36 @@ static inline int key_eq(const union futex_key *a, const union futex_key *b)
                && a->both.offset == b->both.offset);
 }
 
-/* Must hold read lock on dmainfo owner's current->mm->mmap_sem */
+/*L:360 OK, when we need to actually free up a Guest's DMA array we do several
+ * things, so we have a convenient function to do it.
+ *
+ * The caller must hold a read lock on dmainfo owner's current->mm->mmap_sem
+ * for the drop_futex_key_refs(). */
 static void unlink_dma(struct lguest_dma_info *dmainfo)
 {
+       /* You locked this too, right? */
        BUG_ON(!mutex_is_locked(&lguest_lock));
+       /* This is how we know that the entry is free. */
        dmainfo->interrupt = 0;
+       /* Remove it from the hash table. */
        list_del(&dmainfo->list);
+       /* Drop the references we were holding (to the inode or mm). */
        drop_futex_key_refs(&dmainfo->key);
 }
 
+/*L:350 This is the routine which we call when the Guest asks to unregister a
+ * DMA array attached to a given key.  Returns true if the array was found. */
 static int unbind_dma(struct lguest *lg,
                      const union futex_key *key,
                      unsigned long dmas)
 {
        int i, ret = 0;
 
+       /* We don't bother with the hash table, just look through all this
+        * Guest's DMA arrays. */
        for (i = 0; i < LGUEST_MAX_DMA; i++) {
+               /* In theory it could have more than one array on the same key,
+                * or one array on multiple keys, so we check both */
                if (key_eq(key, &lg->dma[i].key) && dmas == lg->dma[i].dmas) {
                        unlink_dma(&lg->dma[i]);
                        ret = 1;
@@ -96,51 +158,91 @@ static int unbind_dma(struct lguest *lg,
        return ret;
 }
 
+/*L:340 BIND_DMA: this is the hypercall which sets up an array of "struct
+ * lguest_dma" for receiving I/O.
+ *
+ * The Guest wants to bind an array of "struct lguest_dma"s to a particular key
+ * to receive input.  This only happens when the Guest is setting up a new
+ * device, so it doesn't have to be very fast.
+ *
+ * It returns 1 on a successful registration (it can fail if we hit the limit
+ * of registrations for this Guest).
+ */
 int bind_dma(struct lguest *lg,
             unsigned long ukey, unsigned long dmas, u16 numdmas, u8 interrupt)
 {
        unsigned int i;
        int ret = 0;
        union futex_key key;
+       /* Futex code needs the mmap_sem. */
        struct rw_semaphore *fshared = &current->mm->mmap_sem;
 
+       /* Invalid interrupt?  (We could kill the guest here). */
        if (interrupt >= LGUEST_IRQS)
                return 0;
 
+       /* We need to grab the Big Lguest Lock, because other Guests may be
+        * trying to look through this Guest's DMAs to send something while
+        * we're doing this. */
        mutex_lock(&lguest_lock);
        down_read(fshared);
        if (get_futex_key((u32 __user *)ukey, fshared, &key) != 0) {
                kill_guest(lg, "bad dma key %#lx", ukey);
                goto unlock;
        }
+
+       /* We want to keep this key valid once we drop mmap_sem, so we have to
+        * hold a reference. */
        get_futex_key_refs(&key);
 
+       /* If the Guest specified an interrupt of 0, that means they want to
+        * unregister this array of "struct lguest_dma"s. */
        if (interrupt == 0)
                ret = unbind_dma(lg, &key, dmas);
        else {
+               /* Look through this Guest's dma array for an unused entry. */
                for (i = 0; i < LGUEST_MAX_DMA; i++) {
+                       /* If the interrupt is non-zero, the entry is already
+                        * used. */
                        if (lg->dma[i].interrupt)
                                continue;
 
+                       /* OK, a free one!  Fill on our details. */
                        lg->dma[i].dmas = dmas;
                        lg->dma[i].num_dmas = numdmas;
                        lg->dma[i].next_dma = 0;
                        lg->dma[i].key = key;
                        lg->dma[i].guestid = lg->guestid;
                        lg->dma[i].interrupt = interrupt;
+
+                       /* Now we add it to the hash table: the position
+                        * depends on the futex key that we got. */
                        list_add(&lg->dma[i].list, &dma_hash[hash(&key)]);
+                       /* Success! */
                        ret = 1;
                        goto unlock;
                }
        }
+       /* If we didn't find a slot to put the key in, drop the reference
+        * again. */
        drop_futex_key_refs(&key);
 unlock:
+       /* Unlock and out. */
        up_read(fshared);
        mutex_unlock(&lguest_lock);
        return ret;
 }
 
-/* lgread from another guest */
+/*L:385 Note that our routines to access a different Guest's memory are called
+ * lgread_other() and lgwrite_other(): these names emphasize that they are only
+ * used when the Guest is *not* the current Guest.
+ *
+ * The interface for copying from another process's memory is called
+ * access_process_vm(), with a final argument of 0 for a read, and 1 for a
+ * write.
+ *
+ * We need lgread_other() to read the destination Guest's "struct lguest_dma"
+ * array. */
 static int lgread_other(struct lguest *lg,
                        void *buf, u32 addr, unsigned bytes)
 {
@@ -153,7 +255,8 @@ static int lgread_other(struct lguest *lg,
        return 1;
 }
 
-/* lgwrite to another guest */
+/* "lgwrite()" to another Guest: used to update the destination "used_len" once
+ * we've transferred data into the buffer. */
 static int lgwrite_other(struct lguest *lg, u32 addr,
                         const void *buf, unsigned bytes)
 {
@@ -166,6 +269,15 @@ static int lgwrite_other(struct lguest *lg, u32 addr,
        return 1;
 }
 
+/*L:400 This is the generic engine which copies from a source "struct
+ * lguest_dma" from this Guest into another Guest's "struct lguest_dma".  The
+ * destination Guest's pages have already been mapped, as contained in the
+ * pages array.
+ *
+ * If you're wondering if there's a nice "copy from one process to another"
+ * routine, so was I.  But Linux isn't really set up to copy between two
+ * unrelated processes, so we have to write it ourselves.
+ */
 static u32 copy_data(struct lguest *srclg,
                     const struct lguest_dma *src,
                     const struct lguest_dma *dst,
@@ -174,33 +286,59 @@ static u32 copy_data(struct lguest *srclg,
        unsigned int totlen, si, di, srcoff, dstoff;
        void *maddr = NULL;
 
+       /* We return the total length transferred. */
        totlen = 0;
+
+       /* We keep indexes into the source and destination "struct lguest_dma",
+        * and an offset within each region. */
        si = di = 0;
        srcoff = dstoff = 0;
+
+       /* We loop until the source or destination is exhausted. */
        while (si < LGUEST_MAX_DMA_SECTIONS && src->len[si]
               && di < LGUEST_MAX_DMA_SECTIONS && dst->len[di]) {
+               /* We can only transfer the rest of the src buffer, or as much
+                * as will fit into the destination buffer. */
                u32 len = min(src->len[si] - srcoff, dst->len[di] - dstoff);
 
+               /* For systems using "highmem" we need to use kmap() to access
+                * the page we want.  We often use the same page over and over,
+                * so rather than kmap() it on every loop, we set the maddr
+                * pointer to NULL when we need to move to the next
+                * destination page. */
                if (!maddr)
                        maddr = kmap(pages[di]);
 
-               /* FIXME: This is not completely portable, since
-                  archs do different things for copy_to_user_page. */
+               /* Copy directly from (this Guest's) source address to the
+                * destination Guest's kmap()ed buffer.  Note that maddr points
+                * to the start of the page: we need to add the offset of the
+                * destination address and offset within the buffer. */
+
+               /* FIXME: This is not completely portable.  I looked at
+                * copy_to_user_page(), and some arch's seem to need special
+                * flushes.  x86 is fine. */
                if (copy_from_user(maddr + (dst->addr[di] + dstoff)%PAGE_SIZE,
                                   (void __user *)src->addr[si], len) != 0) {
+                       /* If a copy failed, it's the source's fault. */
                        kill_guest(srclg, "bad address in sending DMA");
                        totlen = 0;
                        break;
                }
 
+               /* Increment the total and src & dst offsets */
                totlen += len;
                srcoff += len;
                dstoff += len;
+
+               /* Presumably we reached the end of the src or dest buffers: */
                if (srcoff == src->len[si]) {
+                       /* Move to the next buffer at offset 0 */
                        si++;
                        srcoff = 0;
                }
                if (dstoff == dst->len[di]) {
+                       /* We need to unmap that destination page and reset
+                        * maddr ready for the next one. */
                        kunmap(pages[di]);
                        maddr = NULL;
                        di++;
@@ -208,13 +346,15 @@ static u32 copy_data(struct lguest *srclg,
                }
        }
 
+       /* If we still had a page mapped at the end, unmap now. */
        if (maddr)
                kunmap(pages[di]);
 
        return totlen;
 }
 
-/* Src is us, ie. current. */
+/*L:390 This is how we transfer a "struct lguest_dma" from the source Guest
+ * (the current Guest which called SEND_DMA) to another Guest. */
 static u32 do_dma(struct lguest *srclg, const struct lguest_dma *src,
                  struct lguest *dstlg, const struct lguest_dma *dst)
 {
@@ -222,23 +362,31 @@ static u32 do_dma(struct lguest *srclg, const struct lguest_dma *src,
        u32 ret;
        struct page *pages[LGUEST_MAX_DMA_SECTIONS];
 
+       /* We check that both source and destination "struct lguest_dma"s are
+        * within the bounds of the source and destination Guests */
        if (!check_dma_list(dstlg, dst) || !check_dma_list(srclg, src))
                return 0;
 
-       /* First get the destination pages */
+       /* We need to map the pages which correspond to each parts of
+        * destination buffer. */
        for (i = 0; i < LGUEST_MAX_DMA_SECTIONS; i++) {
                if (dst->len[i] == 0)
                        break;
+               /* get_user_pages() is a complicated function, especially since
+                * we only want a single page.  But it works, and returns the
+                * number of pages.  Note that we're holding the destination's
+                * mmap_sem, as get_user_pages() requires. */
                if (get_user_pages(dstlg->tsk, dstlg->mm,
                                   dst->addr[i], 1, 1, 1, pages+i, NULL)
                    != 1) {
+                       /* This means the destination gave us a bogus buffer */
                        kill_guest(dstlg, "Error mapping DMA pages");
                        ret = 0;
                        goto drop_pages;
                }
        }
 
-       /* Now copy until we run out of src or dst. */
+       /* Now copy the data until we run out of src or dst. */
        ret = copy_data(srclg, src, dst, pages);
 
 drop_pages:
@@ -247,6 +395,11 @@ drop_pages:
        return ret;
 }
 
+/*L:380 Transferring data from one Guest to another is not as simple as I'd
+ * like.  We've found the "struct lguest_dma_info" bound to the same address as
+ * the send, we need to copy into it.
+ *
+ * This function returns true if the destination array was empty. */
 static int dma_transfer(struct lguest *srclg,
                        unsigned long udma,
                        struct lguest_dma_info *dst)
@@ -255,15 +408,23 @@ static int dma_transfer(struct lguest *srclg,
        struct lguest *dstlg;
        u32 i, dma = 0;
 
+       /* From the "struct lguest_dma_info" we found in the hash, grab the
+        * Guest. */
        dstlg = &lguests[dst->guestid];
-       /* Get our dma list. */
+       /* Read in the source "struct lguest_dma" handed to SEND_DMA. */
        lgread(srclg, &src_dma, udma, sizeof(src_dma));
 
-       /* We can't deadlock against them dmaing to us, because this
-        * is all under the lguest_lock. */
+       /* We need the destination's mmap_sem, and we already hold the source's
+        * mmap_sem for the futex key lookup.  Normally this would suggest that
+        * we could deadlock if the destination Guest was trying to send to
+        * this source Guest at the same time, which is another reason that all
+        * I/O is done under the big lguest_lock. */
        down_read(&dstlg->mm->mmap_sem);
 
+       /* Look through the destination DMA array for an available buffer. */
        for (i = 0; i < dst->num_dmas; i++) {
+               /* We keep a "next_dma" pointer which often helps us avoid
+                * looking at lots of previously-filled entries. */
                dma = (dst->next_dma + i) % dst->num_dmas;
                if (!lgread_other(dstlg, &dst_dma,
                                  dst->dmas + dma * sizeof(struct lguest_dma),
@@ -273,30 +434,46 @@ static int dma_transfer(struct lguest *srclg,
                if (!dst_dma.used_len)
                        break;
        }
+
+       /* If we found a buffer, we do the actual data copy. */
        if (i != dst->num_dmas) {
                unsigned long used_lenp;
                unsigned int ret;
 
                ret = do_dma(srclg, &src_dma, dstlg, &dst_dma);
-               /* Put used length in src. */
+               /* Put used length in the source "struct lguest_dma"'s used_len
+                * field.  It's a little tricky to figure out where that is,
+                * though. */
                lgwrite_u32(srclg,
                            udma+offsetof(struct lguest_dma, used_len), ret);
+               /* Tranferring 0 bytes is OK if the source buffer was empty. */
                if (ret == 0 && src_dma.len[0] != 0)
                        goto fail;
 
-               /* Make sure destination sees contents before length. */
+               /* The destination Guest might be running on a different CPU:
+                * we have to make sure that it will see the "used_len" field
+                * change to non-zero *after* it sees the data we copied into
+                * the buffer.  Hence a write memory barrier. */
                wmb();
+               /* Figuring out where the destination's used_len field for this
+                * "struct lguest_dma" in the array is also a little ugly. */
                used_lenp = dst->dmas
                        + dma * sizeof(struct lguest_dma)
                        + offsetof(struct lguest_dma, used_len);
                lgwrite_other(dstlg, used_lenp, &ret, sizeof(ret));
+               /* Move the cursor for next time. */
                dst->next_dma++;
        }
        up_read(&dstlg->mm->mmap_sem);
 
-       /* Do this last so dst doesn't simply sleep on lock. */
+       /* We trigger the destination interrupt, even if the destination was
+        * empty and we didn't transfer anything: this gives them a chance to
+        * wake up and refill. */
        set_bit(dst->interrupt, dstlg->irqs_pending);
+       /* Wake up the destination process. */
        wake_up_process(dstlg->tsk);
+       /* If we passed the last "struct lguest_dma", the receive had no
+        * buffers left. */
        return i == dst->num_dmas;
 
 fail:
@@ -304,6 +481,8 @@ fail:
        return 0;
 }
 
+/*L:370 This is the counter-side to the BIND_DMA hypercall; the SEND_DMA
+ * hypercall.  We find out who's listening, and send to them. */
 void send_dma(struct lguest *lg, unsigned long ukey, unsigned long udma)
 {
        union futex_key key;
@@ -313,31 +492,43 @@ void send_dma(struct lguest *lg, unsigned long ukey, unsigned long udma)
 again:
        mutex_lock(&lguest_lock);
        down_read(fshared);
+       /* Get the futex key for the key the Guest gave us */
        if (get_futex_key((u32 __user *)ukey, fshared, &key) != 0) {
                kill_guest(lg, "bad sending DMA key");
                goto unlock;
        }
-       /* Shared mapping?  Look for other guests... */
+       /* Since the key must be a multiple of 4, the futex key uses the lower
+        * bit of the "offset" field (which would always be 0) to indicate a
+        * mapping which is shared with other processes (ie. Guests). */
        if (key.shared.offset & 1) {
                struct lguest_dma_info *i;
+               /* Look through the hash for other Guests. */
                list_for_each_entry(i, &dma_hash[hash(&key)], list) {
+                       /* Don't send to ourselves. */
                        if (i->guestid == lg->guestid)
                                continue;
                        if (!key_eq(&key, &i->key))
                                continue;
 
+                       /* If dma_transfer() tells us the destination has no
+                        * available buffers, we increment "empty". */
                        empty += dma_transfer(lg, udma, i);
                        break;
                }
+               /* If the destination is empty, we release our locks and
+                * give the destination Guest a brief chance to restock. */
                if (empty == 1) {
                        /* Give any recipients one chance to restock. */
                        up_read(&current->mm->mmap_sem);
                        mutex_unlock(&lguest_lock);
+                       /* Next time, we won't try again. */
                        empty++;
                        goto again;
                }
        } else {
-               /* Private mapping: tell our userspace. */
+               /* Private mapping: Guest is sending to its Launcher.  We set
+                * the "dma_is_pending" flag so that the main loop will exit
+                * and the Launcher's read() from /dev/lguest will return. */
                lg->dma_is_pending = 1;
                lg->pending_dma = udma;
                lg->pending_key = ukey;
@@ -346,6 +537,7 @@ unlock:
        up_read(fshared);
        mutex_unlock(&lguest_lock);
 }
+/*:*/
 
 void release_all_dma(struct lguest *lg)
 {
@@ -361,7 +553,18 @@ void release_all_dma(struct lguest *lg)
        up_read(&lg->mm->mmap_sem);
 }
 
-/* Userspace wants a dma buffer from this guest. */
+/*M:007 We only return a single DMA buffer to the Launcher, but it would be
+ * more efficient to return a pointer to the entire array of DMA buffers, which
+ * it can cache and choose one whenever it wants.
+ *
+ * Currently the Launcher uses a write to /dev/lguest, and the return value is
+ * the address of the DMA structure with the interrupt number placed in
+ * dma->used_len.  If we wanted to return the entire array, we need to return
+ * the address, array size and interrupt number: this seems to require an
+ * ioctl(). :*/
+
+/*L:320 This routine looks for a DMA buffer registered by the Guest on the
+ * given key (using the BIND_DMA hypercall). */
 unsigned long get_dma_buffer(struct lguest *lg,
                             unsigned long ukey, unsigned long *interrupt)
 {
@@ -370,15 +573,29 @@ unsigned long get_dma_buffer(struct lguest *lg,
        struct lguest_dma_info *i;
        struct rw_semaphore *fshared = &current->mm->mmap_sem;
 
+       /* Take the Big Lguest Lock to stop other Guests sending this Guest DMA
+        * at the same time. */
        mutex_lock(&lguest_lock);
+       /* To match between Guests sharing the same underlying memory we steal
+        * code from the futex infrastructure.  This requires that we hold the
+        * "mmap_sem" for our process (the Launcher), and pass it to the futex
+        * code. */
        down_read(fshared);
+
+       /* This can fail if it's not a valid address, or if the address is not
+        * divisible by 4 (the futex code needs that, we don't really). */
        if (get_futex_key((u32 __user *)ukey, fshared, &key) != 0) {
                kill_guest(lg, "bad registered DMA buffer");
                goto unlock;
        }
+       /* Search the hash table for matching entries (the Launcher can only
+        * send to its own Guest for the moment, so the entry must be for this
+        * Guest) */
        list_for_each_entry(i, &dma_hash[hash(&key)], list) {
                if (key_eq(&key, &i->key) && i->guestid == lg->guestid) {
                        unsigned int j;
+                       /* Look through the registered DMA array for an
+                        * available buffer. */
                        for (j = 0; j < i->num_dmas; j++) {
                                struct lguest_dma dma;
 
@@ -387,6 +604,8 @@ unsigned long get_dma_buffer(struct lguest *lg,
                                if (dma.used_len == 0)
                                        break;
                        }
+                       /* Store the interrupt the Guest wants when the buffer
+                        * is used. */
                        *interrupt = i->interrupt;
                        break;
                }
@@ -396,4 +615,12 @@ unlock:
        mutex_unlock(&lguest_lock);
        return ret;
 }
+/*:*/
 
+/*L:410 This really has completed the Launcher.  Not only have we now finished
+ * the longest chapter in our journey, but this also means we are over halfway
+ * through!
+ *
+ * Enough prevaricating around the bush: it is time for us to dive into the
+ * core of the Host, in "make Host".
+ */
index 3e2ddfbc816e9fc1396c8fe724e14e1732928502..64f0abed317c2fbb6afe4c7d3ca881c163353ef7 100644 (file)
@@ -58,9 +58,18 @@ struct lguest_dma_info
        u8 interrupt;   /* 0 when not registered */
 };
 
-/* We have separate types for the guest's ptes & pgds and the shadow ptes &
- * pgds.  Since this host might use three-level pagetables and the guest and
- * shadow pagetables don't, we can't use the normal pte_t/pgd_t. */
+/*H:310 The page-table code owes a great debt of gratitude to Andi Kleen.  He
+ * reviewed the original code which used "u32" for all page table entries, and
+ * insisted that it would be far clearer with explicit typing.  I thought it
+ * was overkill, but he was right: it is much clearer than it was before.
+ *
+ * We have separate types for the Guest's ptes & pgds and the shadow ptes &
+ * pgds.  There's already a Linux type for these (pte_t and pgd_t) but they
+ * change depending on kernel config options (PAE). */
+
+/* Each entry is identical: lower 12 bits of flags and upper 20 bits for the
+ * "page frame number" (0 == first physical page, etc).  They are different
+ * types so the compiler will warn us if we mix them improperly. */
 typedef union {
        struct { unsigned flags:12, pfn:20; };
        struct { unsigned long val; } raw;
@@ -77,8 +86,12 @@ typedef union {
        struct { unsigned flags:12, pfn:20; };
        struct { unsigned long val; } raw;
 } gpte_t;
+
+/* We have two convenient macros to convert a "raw" value as handed to us by
+ * the Guest into the correct Guest PGD or PTE type. */
 #define mkgpte(_val) ((gpte_t){.raw.val = _val})
 #define mkgpgd(_val) ((gpgd_t){.raw.val = _val})
+/*:*/
 
 struct pgdir
 {
@@ -243,7 +256,32 @@ unsigned long get_dma_buffer(struct lguest *lg, unsigned long key,
 
 /* hypercalls.c: */
 void do_hypercalls(struct lguest *lg);
-
+void write_timestamp(struct lguest *lg);
+
+/*L:035
+ * Let's step aside for the moment, to study one important routine that's used
+ * widely in the Host code.
+ *
+ * There are many cases where the Guest does something invalid, like pass crap
+ * to a hypercall.  Since only the Guest kernel can make hypercalls, it's quite
+ * acceptable to simply terminate the Guest and give the Launcher a nicely
+ * formatted reason.  It's also simpler for the Guest itself, which doesn't
+ * need to check most hypercalls for "success"; if you're still running, it
+ * succeeded.
+ *
+ * Once this is called, the Guest will never run again, so most Host code can
+ * call this then continue as if nothing had happened.  This means many
+ * functions don't have to explicitly return an error code, which keeps the
+ * code simple.
+ *
+ * It also means that this can be called more than once: only the first one is
+ * remembered.  The only trick is that we still need to kill the Guest even if
+ * we can't allocate memory to store the reason.  Linux has a neat way of
+ * packing error codes into invalid pointers, so we use that here.
+ *
+ * Like any macro which uses an "if", it is safely wrapped in a run-once "do {
+ * } while(0)".
+ */
 #define kill_guest(lg, fmt...)                                 \
 do {                                                           \
        if (!(lg)->dead) {                                      \
@@ -252,6 +290,7 @@ do {                                                                \
                        (lg)->dead = ERR_PTR(-ENOMEM);          \
        }                                                       \
 } while(0)
+/* (End of aside) :*/
 
 static inline unsigned long guest_pa(struct lguest *lg, unsigned long vaddr)
 {
index 18dade06d4a9e8b92c2a2499dd74981c68b5d9c3..6e135ac0834f9c867ae2e475fee47ae2bb05405c 100644 (file)
@@ -1,6 +1,32 @@
-/*
- * Lguest specific paravirt-ops implementation
+/*P:010
+ * A hypervisor allows multiple Operating Systems to run on a single machine.
+ * To quote David Wheeler: "Any problem in computer science can be solved with
+ * another layer of indirection."
+ *
+ * We keep things simple in two ways.  First, we start with a normal Linux
+ * kernel and insert a module (lg.ko) which allows us to run other Linux
+ * kernels the same way we'd run processes.  We call the first kernel the Host,
+ * and the others the Guests.  The program which sets up and configures Guests
+ * (such as the example in Documentation/lguest/lguest.c) is called the
+ * Launcher.
+ *
+ * Secondly, we only run specially modified Guests, not normal kernels.  When
+ * you set CONFIG_LGUEST to 'y' or 'm', this automatically sets
+ * CONFIG_LGUEST_GUEST=y, which compiles this file into the kernel so it knows
+ * how to be a Guest.  This means that you can use the same kernel you boot
+ * normally (ie. as a Host) as a Guest.
  *
+ * These Guests know that they cannot do privileged operations, such as disable
+ * interrupts, and that they have to ask the Host to do such things explicitly.
+ * This file consists of all the replacements for such low-level native
+ * hardware operations: these special Guest versions call the Host.
+ *
+ * So how does the kernel know it's a Guest?  The Guest starts at a special
+ * entry point marked with a magic string, which sets up a few things then
+ * calls here.  We replace the native functions in "struct paravirt_ops"
+ * with our Guest versions, then boot like normal. :*/
+
+/*
  * Copyright (C) 2006, Rusty Russell <rusty@rustcorp.com.au> IBM Corporation.
  *
  * This program is free software; you can redistribute it and/or modify
 #include <asm/mce.h>
 #include <asm/io.h>
 
+/*G:010 Welcome to the Guest!
+ *
+ * The Guest in our tale is a simple creature: identical to the Host but
+ * behaving in simplified but equivalent ways.  In particular, the Guest is the
+ * same kernel as the Host (or at least, built from the same source code). :*/
+
 /* Declarations for definitions in lguest_guest.S */
 extern char lguest_noirq_start[], lguest_noirq_end[];
 extern const char lgstart_cli[], lgend_cli[];
@@ -58,7 +90,26 @@ struct lguest_data lguest_data = {
 struct lguest_device_desc *lguest_devices;
 static cycle_t clock_base;
 
-static enum paravirt_lazy_mode lazy_mode;
+/*G:035 Notice the lazy_hcall() above, rather than hcall().  This is our first
+ * real optimization trick!
+ *
+ * When lazy_mode is set, it means we're allowed to defer all hypercalls and do
+ * them as a batch when lazy_mode is eventually turned off.  Because hypercalls
+ * are reasonably expensive, batching them up makes sense.  For example, a
+ * large mmap might update dozens of page table entries: that code calls
+ * lguest_lazy_mode(PARAVIRT_LAZY_MMU), does the dozen updates, then calls
+ * lguest_lazy_mode(PARAVIRT_LAZY_NONE).
+ *
+ * So, when we're in lazy mode, we call async_hypercall() to store the call for
+ * future processing.  When lazy mode is turned off we issue a hypercall to
+ * flush the stored calls.
+ *
+ * There's also a hack where "mode" is set to "PARAVIRT_LAZY_FLUSH" which
+ * indicates we're to flush any outstanding calls immediately.  This is used
+ * when an interrupt handler does a kmap_atomic(): the page table changes must
+ * happen immediately even if we're in the middle of a batch.  Usually we're
+ * not, though, so there's nothing to do. */
+static enum paravirt_lazy_mode lazy_mode; /* Note: not SMP-safe! */
 static void lguest_lazy_mode(enum paravirt_lazy_mode mode)
 {
        if (mode == PARAVIRT_LAZY_FLUSH) {
@@ -82,6 +133,16 @@ static void lazy_hcall(unsigned long call,
                async_hcall(call, arg1, arg2, arg3);
 }
 
+/* async_hcall() is pretty simple: I'm quite proud of it really.  We have a
+ * ring buffer of stored hypercalls which the Host will run though next time we
+ * do a normal hypercall.  Each entry in the ring has 4 slots for the hypercall
+ * arguments, and a "hcall_status" word which is 0 if the call is ready to go,
+ * and 255 once the Host has finished with it.
+ *
+ * If we come around to a slot which hasn't been finished, then the table is
+ * full and we just make the hypercall directly.  This has the nice side
+ * effect of causing the Host to run all the stored calls in the ring buffer
+ * which empties it for next time! */
 void async_hcall(unsigned long call,
                 unsigned long arg1, unsigned long arg2, unsigned long arg3)
 {
@@ -89,6 +150,9 @@ void async_hcall(unsigned long call,
        static unsigned int next_call;
        unsigned long flags;
 
+       /* Disable interrupts if not already disabled: we don't want an
+        * interrupt handler making a hypercall while we're already doing
+        * one! */
        local_irq_save(flags);
        if (lguest_data.hcall_status[next_call] != 0xFF) {
                /* Table full, so do normal hcall which will flush table. */
@@ -98,7 +162,7 @@ void async_hcall(unsigned long call,
                lguest_data.hcalls[next_call].edx = arg1;
                lguest_data.hcalls[next_call].ebx = arg2;
                lguest_data.hcalls[next_call].ecx = arg3;
-               /* Make sure host sees arguments before "valid" flag. */
+               /* Arguments must all be written before we mark it to go */
                wmb();
                lguest_data.hcall_status[next_call] = 0;
                if (++next_call == LHCALL_RING_SIZE)
@@ -106,9 +170,14 @@ void async_hcall(unsigned long call,
        }
        local_irq_restore(flags);
 }
+/*:*/
 
+/* Wrappers for the SEND_DMA and BIND_DMA hypercalls.  This is mainly because
+ * Jeff Garzik complained that __pa() should never appear in drivers, and this
+ * helps remove most of them.   But also, it wraps some ugliness. */
 void lguest_send_dma(unsigned long key, struct lguest_dma *dma)
 {
+       /* The hcall might not write this if something goes wrong */
        dma->used_len = 0;
        hcall(LHCALL_SEND_DMA, key, __pa(dma), 0);
 }
@@ -116,11 +185,16 @@ void lguest_send_dma(unsigned long key, struct lguest_dma *dma)
 int lguest_bind_dma(unsigned long key, struct lguest_dma *dmas,
                    unsigned int num, u8 irq)
 {
+       /* This is the only hypercall which actually wants 5 arguments, and we
+        * only support 4.  Fortunately the interrupt number is always less
+        * than 256, so we can pack it with the number of dmas in the final
+        * argument.  */
        if (!hcall(LHCALL_BIND_DMA, key, __pa(dmas), (num << 8) | irq))
                return -ENOMEM;
        return 0;
 }
 
+/* Unbinding is the same hypercall as binding, but with 0 num & irq. */
 void lguest_unbind_dma(unsigned long key, struct lguest_dma *dmas)
 {
        hcall(LHCALL_BIND_DMA, key, __pa(dmas), 0);
@@ -138,35 +212,73 @@ void lguest_unmap(void *addr)
        iounmap((__force void __iomem *)addr);
 }
 
+/*G:033
+ * Here are our first native-instruction replacements: four functions for
+ * interrupt control.
+ *
+ * The simplest way of implementing these would be to have "turn interrupts
+ * off" and "turn interrupts on" hypercalls.  Unfortunately, this is too slow:
+ * these are by far the most commonly called functions of those we override.
+ *
+ * So instead we keep an "irq_enabled" field inside our "struct lguest_data",
+ * which the Guest can update with a single instruction.  The Host knows to
+ * check there when it wants to deliver an interrupt.
+ */
+
+/* save_flags() is expected to return the processor state (ie. "eflags").  The
+ * eflags word contains all kind of stuff, but in practice Linux only cares
+ * about the interrupt flag.  Our "save_flags()" just returns that. */
 static unsigned long save_fl(void)
 {
        return lguest_data.irq_enabled;
 }
 
+/* "restore_flags" just sets the flags back to the value given. */
 static void restore_fl(unsigned long flags)
 {
-       /* FIXME: Check if interrupt pending... */
        lguest_data.irq_enabled = flags;
 }
 
+/* Interrupts go off... */
 static void irq_disable(void)
 {
        lguest_data.irq_enabled = 0;
 }
 
+/* Interrupts go on... */
 static void irq_enable(void)
 {
-       /* FIXME: Check if interrupt pending... */
        lguest_data.irq_enabled = X86_EFLAGS_IF;
 }
-
+/*:*/
+/*M:003 Note that we don't check for outstanding interrupts when we re-enable
+ * them (or when we unmask an interrupt).  This seems to work for the moment,
+ * since interrupts are rare and we'll just get the interrupt on the next timer
+ * tick, but when we turn on CONFIG_NO_HZ, we should revisit this.  One way
+ * would be to put the "irq_enabled" field in a page by itself, and have the
+ * Host write-protect it when an interrupt comes in when irqs are disabled.
+ * There will then be a page fault as soon as interrupts are re-enabled. :*/
+
+/*G:034
+ * The Interrupt Descriptor Table (IDT).
+ *
+ * The IDT tells the processor what to do when an interrupt comes in.  Each
+ * entry in the table is a 64-bit descriptor: this holds the privilege level,
+ * address of the handler, and... well, who cares?  The Guest just asks the
+ * Host to make the change anyway, because the Host controls the real IDT.
+ */
 static void lguest_write_idt_entry(struct desc_struct *dt,
                                   int entrynum, u32 low, u32 high)
 {
+       /* Keep the local copy up to date. */
        write_dt_entry(dt, entrynum, low, high);
+       /* Tell Host about this new entry. */
        hcall(LHCALL_LOAD_IDT_ENTRY, entrynum, low, high);
 }
 
+/* Changing to a different IDT is very rare: we keep the IDT up-to-date every
+ * time it is written, so we can simply loop through all entries and tell the
+ * Host about them. */
 static void lguest_load_idt(const struct Xgt_desc_struct *desc)
 {
        unsigned int i;
@@ -176,12 +288,29 @@ static void lguest_load_idt(const struct Xgt_desc_struct *desc)
                hcall(LHCALL_LOAD_IDT_ENTRY, i, idt[i].a, idt[i].b);
 }
 
+/*
+ * The Global Descriptor Table.
+ *
+ * The Intel architecture defines another table, called the Global Descriptor
+ * Table (GDT).  You tell the CPU where it is (and its size) using the "lgdt"
+ * instruction, and then several other instructions refer to entries in the
+ * table.  There are three entries which the Switcher needs, so the Host simply
+ * controls the entire thing and the Guest asks it to make changes using the
+ * LOAD_GDT hypercall.
+ *
+ * This is the opposite of the IDT code where we have a LOAD_IDT_ENTRY
+ * hypercall and use that repeatedly to load a new IDT.  I don't think it
+ * really matters, but wouldn't it be nice if they were the same?
+ */
 static void lguest_load_gdt(const struct Xgt_desc_struct *desc)
 {
        BUG_ON((desc->size+1)/8 != GDT_ENTRIES);
        hcall(LHCALL_LOAD_GDT, __pa(desc->address), GDT_ENTRIES, 0);
 }
 
+/* For a single GDT entry which changes, we do the lazy thing: alter our GDT,
+ * then tell the Host to reload the entire thing.  This operation is so rare
+ * that this naive implementation is reasonable. */
 static void lguest_write_gdt_entry(struct desc_struct *dt,
                                   int entrynum, u32 low, u32 high)
 {
@@ -189,19 +318,61 @@ static void lguest_write_gdt_entry(struct desc_struct *dt,
        hcall(LHCALL_LOAD_GDT, __pa(dt), GDT_ENTRIES, 0);
 }
 
+/* OK, I lied.  There are three "thread local storage" GDT entries which change
+ * on every context switch (these three entries are how glibc implements
+ * __thread variables).  So we have a hypercall specifically for this case. */
 static void lguest_load_tls(struct thread_struct *t, unsigned int cpu)
 {
+       /* There's one problem which normal hardware doesn't have: the Host
+        * can't handle us removing entries we're currently using.  So we clear
+        * the GS register here: if it's needed it'll be reloaded anyway. */
+       loadsegment(gs, 0);
        lazy_hcall(LHCALL_LOAD_TLS, __pa(&t->tls_array), cpu, 0);
 }
 
+/*G:038 That's enough excitement for now, back to ploughing through each of
+ * the paravirt_ops (we're about 1/3 of the way through).
+ *
+ * This is the Local Descriptor Table, another weird Intel thingy.  Linux only
+ * uses this for some strange applications like Wine.  We don't do anything
+ * here, so they'll get an informative and friendly Segmentation Fault. */
 static void lguest_set_ldt(const void *addr, unsigned entries)
 {
 }
 
+/* This loads a GDT entry into the "Task Register": that entry points to a
+ * structure called the Task State Segment.  Some comments scattered though the
+ * kernel code indicate that this used for task switching in ages past, along
+ * with blood sacrifice and astrology.
+ *
+ * Now there's nothing interesting in here that we don't get told elsewhere.
+ * But the native version uses the "ltr" instruction, which makes the Host
+ * complain to the Guest about a Segmentation Fault and it'll oops.  So we
+ * override the native version with a do-nothing version. */
 static void lguest_load_tr_desc(void)
 {
 }
 
+/* The "cpuid" instruction is a way of querying both the CPU identity
+ * (manufacturer, model, etc) and its features.  It was introduced before the
+ * Pentium in 1993 and keeps getting extended by both Intel and AMD.  As you
+ * might imagine, after a decade and a half this treatment, it is now a giant
+ * ball of hair.  Its entry in the current Intel manual runs to 28 pages.
+ *
+ * This instruction even it has its own Wikipedia entry.  The Wikipedia entry
+ * has been translated into 4 languages.  I am not making this up!
+ *
+ * We could get funky here and identify ourselves as "GenuineLguest", but
+ * instead we just use the real "cpuid" instruction.  Then I pretty much turned
+ * off feature bits until the Guest booted.  (Don't say that: you'll damage
+ * lguest sales!)  Shut up, inner voice!  (Hey, just pointing out that this is
+ * hardly future proof.)  Noone's listening!  They don't like you anyway,
+ * parenthetic weirdo!
+ *
+ * Replacing the cpuid so we can turn features off is great for the kernel, but
+ * anyone (including userspace) can just use the raw "cpuid" instruction and
+ * the Host won't even notice since it isn't privileged.  So we try not to get
+ * too worked up about it. */
 static void lguest_cpuid(unsigned int *eax, unsigned int *ebx,
                         unsigned int *ecx, unsigned int *edx)
 {
@@ -214,21 +385,43 @@ static void lguest_cpuid(unsigned int *eax, unsigned int *ebx,
                *ecx &= 0x00002201;
                /* SSE, SSE2, FXSR, MMX, CMOV, CMPXCHG8B, FPU. */
                *edx &= 0x07808101;
-               /* Host wants to know when we flush kernel pages: set PGE. */
+               /* The Host can do a nice optimization if it knows that the
+                * kernel mappings (addresses above 0xC0000000 or whatever
+                * PAGE_OFFSET is set to) haven't changed.  But Linux calls
+                * flush_tlb_user() for both user and kernel mappings unless
+                * the Page Global Enable (PGE) feature bit is set. */
                *edx |= 0x00002000;
                break;
        case 0x80000000:
                /* Futureproof this a little: if they ask how much extended
-                * processor information, limit it to known fields. */
+                * processor information there is, limit it to known fields. */
                if (*eax > 0x80000008)
                        *eax = 0x80000008;
                break;
        }
 }
 
+/* Intel has four control registers, imaginatively named cr0, cr2, cr3 and cr4.
+ * I assume there's a cr1, but it hasn't bothered us yet, so we'll not bother
+ * it.  The Host needs to know when the Guest wants to change them, so we have
+ * a whole series of functions like read_cr0() and write_cr0().
+ *
+ * We start with CR0.  CR0 allows you to turn on and off all kinds of basic
+ * features, but Linux only really cares about one: the horrifically-named Task
+ * Switched (TS) bit at bit 3 (ie. 8)
+ *
+ * What does the TS bit do?  Well, it causes the CPU to trap (interrupt 7) if
+ * the floating point unit is used.  Which allows us to restore FPU state
+ * lazily after a task switch, and Linux uses that gratefully, but wouldn't a
+ * name like "FPUTRAP bit" be a little less cryptic?
+ *
+ * We store cr0 (and cr3) locally, because the Host never changes it.  The
+ * Guest sometimes wants to read it and we'd prefer not to bother the Host
+ * unnecessarily. */
 static unsigned long current_cr0, current_cr3;
 static void lguest_write_cr0(unsigned long val)
 {
+       /* 8 == TS bit. */
        lazy_hcall(LHCALL_TS, val & 8, 0, 0);
        current_cr0 = val;
 }
@@ -238,17 +431,25 @@ static unsigned long lguest_read_cr0(void)
        return current_cr0;
 }
 
+/* Intel provided a special instruction to clear the TS bit for people too cool
+ * to use write_cr0() to do it.  This "clts" instruction is faster, because all
+ * the vowels have been optimized out. */
 static void lguest_clts(void)
 {
        lazy_hcall(LHCALL_TS, 0, 0, 0);
        current_cr0 &= ~8U;
 }
 
+/* CR2 is the virtual address of the last page fault, which the Guest only ever
+ * reads.  The Host kindly writes this into our "struct lguest_data", so we
+ * just read it out of there. */
 static unsigned long lguest_read_cr2(void)
 {
        return lguest_data.cr2;
 }
 
+/* CR3 is the current toplevel pagetable page: the principle is the same as
+ * cr0.  Keep a local copy, and tell the Host when it changes. */
 static void lguest_write_cr3(unsigned long cr3)
 {
        lazy_hcall(LHCALL_NEW_PGTABLE, cr3, 0, 0);
@@ -260,7 +461,7 @@ static unsigned long lguest_read_cr3(void)
        return current_cr3;
 }
 
-/* Used to enable/disable PGE, but we don't care. */
+/* CR4 is used to enable and disable PGE, but we don't care. */
 static unsigned long lguest_read_cr4(void)
 {
        return 0;
@@ -270,6 +471,59 @@ static void lguest_write_cr4(unsigned long val)
 {
 }
 
+/*
+ * Page Table Handling.
+ *
+ * Now would be a good time to take a rest and grab a coffee or similarly
+ * relaxing stimulant.  The easy parts are behind us, and the trek gradually
+ * winds uphill from here.
+ *
+ * Quick refresher: memory is divided into "pages" of 4096 bytes each.  The CPU
+ * maps virtual addresses to physical addresses using "page tables".  We could
+ * use one huge index of 1 million entries: each address is 4 bytes, so that's
+ * 1024 pages just to hold the page tables.   But since most virtual addresses
+ * are unused, we use a two level index which saves space.  The CR3 register
+ * contains the physical address of the top level "page directory" page, which
+ * contains physical addresses of up to 1024 second-level pages.  Each of these
+ * second level pages contains up to 1024 physical addresses of actual pages,
+ * or Page Table Entries (PTEs).
+ *
+ * Here's a diagram, where arrows indicate physical addresses:
+ *
+ * CR3 ---> +---------+
+ *         |      --------->+---------+
+ *         |         |      | PADDR1  |
+ *       Top-level   |      | PADDR2  |
+ *       (PMD) page  |      |         |
+ *         |         |    Lower-level |
+ *         |         |    (PTE) page  |
+ *         |         |      |         |
+ *           ....               ....
+ *
+ * So to convert a virtual address to a physical address, we look up the top
+ * level, which points us to the second level, which gives us the physical
+ * address of that page.  If the top level entry was not present, or the second
+ * level entry was not present, then the virtual address is invalid (we
+ * say "the page was not mapped").
+ *
+ * Put another way, a 32-bit virtual address is divided up like so:
+ *
+ *  1 1 0 0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+ * |<---- 10 bits ---->|<---- 10 bits ---->|<------ 12 bits ------>|
+ *    Index into top     Index into second      Offset within page
+ *  page directory page    pagetable page
+ *
+ * The kernel spends a lot of time changing both the top-level page directory
+ * and lower-level pagetable pages.  The Guest doesn't know physical addresses,
+ * so while it maintains these page tables exactly like normal, it also needs
+ * to keep the Host informed whenever it makes a change: the Host will create
+ * the real page tables based on the Guests'.
+ */
+
+/* The Guest calls this to set a second-level entry (pte), ie. to map a page
+ * into a process' address space.  We set the entry then tell the Host the
+ * toplevel and address this corresponds to.  The Guest uses one pagetable per
+ * process, so we need to tell the Host which one we're changing (mm->pgd). */
 static void lguest_set_pte_at(struct mm_struct *mm, unsigned long addr,
                              pte_t *ptep, pte_t pteval)
 {
@@ -277,7 +531,9 @@ static void lguest_set_pte_at(struct mm_struct *mm, unsigned long addr,
        lazy_hcall(LHCALL_SET_PTE, __pa(mm->pgd), addr, pteval.pte_low);
 }
 
-/* We only support two-level pagetables at the moment. */
+/* The Guest calls this to set a top-level entry.  Again, we set the entry then
+ * tell the Host which top-level page we changed, and the index of the entry we
+ * changed. */
 static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
 {
        *pmdp = pmdval;
@@ -285,7 +541,15 @@ static void lguest_set_pmd(pmd_t *pmdp, pmd_t pmdval)
                   (__pa(pmdp)&(PAGE_SIZE-1))/4, 0);
 }
 
-/* FIXME: Eliminate all callers of this. */
+/* There are a couple of legacy places where the kernel sets a PTE, but we
+ * don't know the top level any more.  This is useless for us, since we don't
+ * know which pagetable is changing or what address, so we just tell the Host
+ * to forget all of them.  Fortunately, this is very rare.
+ *
+ * ... except in early boot when the kernel sets up the initial pagetables,
+ * which makes booting astonishingly slow.  So we don't even tell the Host
+ * anything changed until we've done the first page table switch.
+ */
 static void lguest_set_pte(pte_t *ptep, pte_t pteval)
 {
        *ptep = pteval;
@@ -294,22 +558,51 @@ static void lguest_set_pte(pte_t *ptep, pte_t pteval)
                lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0);
 }
 
+/* Unfortunately for Lguest, the paravirt_ops for page tables were based on
+ * native page table operations.  On native hardware you can set a new page
+ * table entry whenever you want, but if you want to remove one you have to do
+ * a TLB flush (a TLB is a little cache of page table entries kept by the CPU).
+ *
+ * So the lguest_set_pte_at() and lguest_set_pmd() functions above are only
+ * called when a valid entry is written, not when it's removed (ie. marked not
+ * present).  Instead, this is where we come when the Guest wants to remove a
+ * page table entry: we tell the Host to set that entry to 0 (ie. the present
+ * bit is zero). */
 static void lguest_flush_tlb_single(unsigned long addr)
 {
-       /* Simply set it to zero, and it will fault back in. */
+       /* Simply set it to zero: if it was not, it will fault back in. */
        lazy_hcall(LHCALL_SET_PTE, current_cr3, addr, 0);
 }
 
+/* This is what happens after the Guest has removed a large number of entries.
+ * This tells the Host that any of the page table entries for userspace might
+ * have changed, ie. virtual addresses below PAGE_OFFSET. */
 static void lguest_flush_tlb_user(void)
 {
        lazy_hcall(LHCALL_FLUSH_TLB, 0, 0, 0);
 }
 
+/* This is called when the kernel page tables have changed.  That's not very
+ * common (unless the Guest is using highmem, which makes the Guest extremely
+ * slow), so it's worth separating this from the user flushing above. */
 static void lguest_flush_tlb_kernel(void)
 {
        lazy_hcall(LHCALL_FLUSH_TLB, 1, 0, 0);
 }
 
+/*
+ * The Unadvanced Programmable Interrupt Controller.
+ *
+ * This is an attempt to implement the simplest possible interrupt controller.
+ * I spent some time looking though routines like set_irq_chip_and_handler,
+ * set_irq_chip_and_handler_name, set_irq_chip_data and set_phasers_to_stun and
+ * I *think* this is as simple as it gets.
+ *
+ * We can tell the Host what interrupts we want blocked ready for using the
+ * lguest_data.interrupts bitmap, so disabling (aka "masking") them is as
+ * simple as setting a bit.  We don't actually "ack" interrupts as such, we
+ * just mask and unmask them.  I wonder if we should be cleverer?
+ */
 static void disable_lguest_irq(unsigned int irq)
 {
        set_bit(irq, lguest_data.blocked_interrupts);
@@ -318,9 +611,9 @@ static void disable_lguest_irq(unsigned int irq)
 static void enable_lguest_irq(unsigned int irq)
 {
        clear_bit(irq, lguest_data.blocked_interrupts);
-       /* FIXME: If it's pending? */
 }
 
+/* This structure describes the lguest IRQ controller. */
 static struct irq_chip lguest_irq_controller = {
        .name           = "lguest",
        .mask           = disable_lguest_irq,
@@ -328,6 +621,10 @@ static struct irq_chip lguest_irq_controller = {
        .unmask         = enable_lguest_irq,
 };
 
+/* This sets up the Interrupt Descriptor Table (IDT) entry for each hardware
+ * interrupt (except 128, which is used for system calls), and then tells the
+ * Linux infrastructure that each interrupt is controlled by our level-based
+ * lguest interrupt controller. */
 static void __init lguest_init_IRQ(void)
 {
        unsigned int i;
@@ -340,20 +637,51 @@ static void __init lguest_init_IRQ(void)
                                                 handle_level_irq);
                }
        }
+       /* This call is required to set up for 4k stacks, where we have
+        * separate stacks for hard and soft interrupts. */
        irq_ctx_init(smp_processor_id());
 }
 
+/*
+ * Time.
+ *
+ * It would be far better for everyone if the Guest had its own clock, but
+ * until then the Host gives us the time on every interrupt.
+ */
 static unsigned long lguest_get_wallclock(void)
 {
-       return hcall(LHCALL_GET_WALLCLOCK, 0, 0, 0);
+       return lguest_data.time.tv_sec;
 }
 
 static cycle_t lguest_clock_read(void)
 {
+       unsigned long sec, nsec;
+
+       /* If the Host tells the TSC speed, we can trust that. */
        if (lguest_data.tsc_khz)
                return native_read_tsc();
-       else
-               return jiffies;
+
+       /* If we can't use the TSC, we read the time value written by the Host.
+        * Since it's in two parts (seconds and nanoseconds), we risk reading
+        * it just as it's changing from 99 & 0.999999999 to 100 and 0, and
+        * getting 99 and 0.  As Linux tends to come apart under the stress of
+        * time travel, we must be careful: */
+       do {
+               /* First we read the seconds part. */
+               sec = lguest_data.time.tv_sec;
+               /* This read memory barrier tells the compiler and the CPU that
+                * this can't be reordered: we have to complete the above
+                * before going on. */
+               rmb();
+               /* Now we read the nanoseconds part. */
+               nsec = lguest_data.time.tv_nsec;
+               /* Make sure we've done that. */
+               rmb();
+               /* Now if the seconds part has changed, try again. */
+       } while (unlikely(lguest_data.time.tv_sec != sec));
+
+       /* Our non-TSC clock is in real nanoseconds. */
+       return sec*1000000000ULL + nsec;
 }
 
 /* This is what we tell the kernel is our clocksource.  */
@@ -361,8 +689,12 @@ static struct clocksource lguest_clock = {
        .name           = "lguest",
        .rating         = 400,
        .read           = lguest_clock_read,
+       .mask           = CLOCKSOURCE_MASK(64),
+       .mult           = 1 << 22,
+       .shift          = 22,
 };
 
+/* The "scheduler clock" is just our real clock, adjusted to start at zero */
 static unsigned long long lguest_sched_clock(void)
 {
        return cyc2ns(&lguest_clock, lguest_clock_read() - clock_base);
@@ -428,34 +760,54 @@ static void lguest_time_irq(unsigned int irq, struct irq_desc *desc)
        local_irq_restore(flags);
 }
 
+/* At some point in the boot process, we get asked to set up our timing
+ * infrastructure.  The kernel doesn't expect timer interrupts before this, but
+ * we cleverly initialized the "blocked_interrupts" field of "struct
+ * lguest_data" so that timer interrupts were blocked until now. */
 static void lguest_time_init(void)
 {
+       /* Set up the timer interrupt (0) to go to our simple timer routine */
        set_irq_handler(0, lguest_time_irq);
 
-       /* We use the TSC if the Host tells us we can, otherwise a dumb
-        * jiffies-based clock. */
+       /* Our clock structure look like arch/i386/kernel/tsc.c if we can use
+        * the TSC, otherwise it's a dumb nanosecond-resolution clock.  Either
+        * way, the "rating" is initialized so high that it's always chosen
+        * over any other clocksource. */
        if (lguest_data.tsc_khz) {
-               lguest_clock.shift = 22;
                lguest_clock.mult = clocksource_khz2mult(lguest_data.tsc_khz,
                                                         lguest_clock.shift);
-               lguest_clock.mask = CLOCKSOURCE_MASK(64);
                lguest_clock.flags = CLOCK_SOURCE_IS_CONTINUOUS;
-       } else {
-               /* To understand this, start at kernel/time/jiffies.c... */
-               lguest_clock.shift = 8;
-               lguest_clock.mult = (((u64)NSEC_PER_SEC<<8)/ACTHZ) << 8;
-               lguest_clock.mask = CLOCKSOURCE_MASK(32);
        }
        clock_base = lguest_clock_read();
        clocksource_register(&lguest_clock);
 
-       /* We can't set cpumask in the initializer: damn C limitations! */
+       /* Now we've set up our clock, we can use it as the scheduler clock */
+       paravirt_ops.sched_clock = lguest_sched_clock;
+
+       /* We can't set cpumask in the initializer: damn C limitations!  Set it
+        * here and register our timer device. */
        lguest_clockevent.cpumask = cpumask_of_cpu(0);
        clockevents_register_device(&lguest_clockevent);
 
+       /* Finally, we unblock the timer interrupt. */
        enable_lguest_irq(0);
 }
 
+/*
+ * Miscellaneous bits and pieces.
+ *
+ * Here is an oddball collection of functions which the Guest needs for things
+ * to work.  They're pretty simple.
+ */
+
+/* The Guest needs to tell the host what stack it expects traps to use.  For
+ * native hardware, this is part of the Task State Segment mentioned above in
+ * lguest_load_tr_desc(), but to help hypervisors there's this special call.
+ *
+ * We tell the Host the segment we want to use (__KERNEL_DS is the kernel data
+ * segment), the privilege level (we're privilege level 1, the Host is 0 and
+ * will not tolerate us trying to use that), the stack pointer, and the number
+ * of pages in the stack. */
 static void lguest_load_esp0(struct tss_struct *tss,
                                     struct thread_struct *thread)
 {
@@ -463,15 +815,31 @@ static void lguest_load_esp0(struct tss_struct *tss,
                   THREAD_SIZE/PAGE_SIZE);
 }
 
+/* Let's just say, I wouldn't do debugging under a Guest. */
 static void lguest_set_debugreg(int regno, unsigned long value)
 {
        /* FIXME: Implement */
 }
 
+/* There are times when the kernel wants to make sure that no memory writes are
+ * caught in the cache (that they've all reached real hardware devices).  This
+ * doesn't matter for the Guest which has virtual hardware.
+ *
+ * On the Pentium 4 and above, cpuid() indicates that the Cache Line Flush
+ * (clflush) instruction is available and the kernel uses that.  Otherwise, it
+ * uses the older "Write Back and Invalidate Cache" (wbinvd) instruction.
+ * Unlike clflush, wbinvd can only be run at privilege level 0.  So we can
+ * ignore clflush, but replace wbinvd.
+ */
 static void lguest_wbinvd(void)
 {
 }
 
+/* If the Guest expects to have an Advanced Programmable Interrupt Controller,
+ * we play dumb by ignoring writes and returning 0 for reads.  So it's no
+ * longer Programmable nor Controlling anything, and I don't think 8 lines of
+ * code qualifies for Advanced.  It will also never interrupt anything.  It
+ * does, however, allow us to get through the Linux boot code. */
 #ifdef CONFIG_X86_LOCAL_APIC
 static void lguest_apic_write(unsigned long reg, unsigned long v)
 {
@@ -483,19 +851,32 @@ static unsigned long lguest_apic_read(unsigned long reg)
 }
 #endif
 
+/* STOP!  Until an interrupt comes in. */
 static void lguest_safe_halt(void)
 {
        hcall(LHCALL_HALT, 0, 0, 0);
 }
 
+/* Perhaps CRASH isn't the best name for this hypercall, but we use it to get a
+ * message out when we're crashing as well as elegant termination like powering
+ * off.
+ *
+ * Note that the Host always prefers that the Guest speak in physical addresses
+ * rather than virtual addresses, so we use __pa() here. */
 static void lguest_power_off(void)
 {
        hcall(LHCALL_CRASH, __pa("Power down"), 0, 0);
 }
 
+/*
+ * Panicing.
+ *
+ * Don't.  But if you did, this is what happens.
+ */
 static int lguest_panic(struct notifier_block *nb, unsigned long l, void *p)
 {
        hcall(LHCALL_CRASH, __pa(p), 0, 0);
+       /* The hcall won't return, but to keep gcc happy, we're "done". */
        return NOTIFY_DONE;
 }
 
@@ -503,15 +884,45 @@ static struct notifier_block paniced = {
        .notifier_call = lguest_panic
 };
 
+/* Setting up memory is fairly easy. */
 static __init char *lguest_memory_setup(void)
 {
-       /* We do this here because lockcheck barfs if before start_kernel */
+       /* We do this here and not earlier because lockcheck barfs if we do it
+        * before start_kernel() */
        atomic_notifier_chain_register(&panic_notifier_list, &paniced);
 
+       /* The Linux bootloader header contains an "e820" memory map: the
+        * Launcher populated the first entry with our memory limit. */
        add_memory_region(E820_MAP->addr, E820_MAP->size, E820_MAP->type);
+
+       /* This string is for the boot messages. */
        return "LGUEST";
 }
 
+/*G:050
+ * Patching (Powerfully Placating Performance Pedants)
+ *
+ * We have already seen that "struct paravirt_ops" lets us replace simple
+ * native instructions with calls to the appropriate back end all throughout
+ * the kernel.  This allows the same kernel to run as a Guest and as a native
+ * kernel, but it's slow because of all the indirect branches.
+ *
+ * Remember that David Wheeler quote about "Any problem in computer science can
+ * be solved with another layer of indirection"?  The rest of that quote is
+ * "... But that usually will create another problem."  This is the first of
+ * those problems.
+ *
+ * Our current solution is to allow the paravirt back end to optionally patch
+ * over the indirect calls to replace them with something more efficient.  We
+ * patch the four most commonly called functions: disable interrupts, enable
+ * interrupts, restore interrupts and save interrupts.  We usually have 10
+ * bytes to patch into: the Guest versions of these operations are small enough
+ * that we can fit comfortably.
+ *
+ * First we need assembly templates of each of the patchable Guest operations,
+ * and these are in lguest_asm.S. */
+
+/*G:060 We construct a table from the assembler templates: */
 static const struct lguest_insns
 {
        const char *start, *end;
@@ -521,35 +932,53 @@ static const struct lguest_insns
        [PARAVIRT_PATCH(restore_fl)] = { lgstart_popf, lgend_popf },
        [PARAVIRT_PATCH(save_fl)] = { lgstart_pushf, lgend_pushf },
 };
-static unsigned lguest_patch(u8 type, u16 clobber, void *insns, unsigned len)
+
+/* Now our patch routine is fairly simple (based on the native one in
+ * paravirt.c).  If we have a replacement, we copy it in and return how much of
+ * the available space we used. */
+static unsigned lguest_patch(u8 type, u16 clobber, void *ibuf,
+                            unsigned long addr, unsigned len)
 {
        unsigned int insn_len;
 
-       /* Don't touch it if we don't have a replacement */
+       /* Don't do anything special if we don't have a replacement */
        if (type >= ARRAY_SIZE(lguest_insns) || !lguest_insns[type].start)
-               return paravirt_patch_default(type, clobber, insns, len);
+               return paravirt_patch_default(type, clobber, ibuf, addr, len);
 
        insn_len = lguest_insns[type].end - lguest_insns[type].start;
 
-       /* Similarly if we can't fit replacement. */
+       /* Similarly if we can't fit replacement (shouldn't happen, but let's
+        * be thorough). */
        if (len < insn_len)
-               return paravirt_patch_default(type, clobber, insns, len);
+               return paravirt_patch_default(type, clobber, ibuf, addr, len);
 
-       memcpy(insns, lguest_insns[type].start, insn_len);
+       /* Copy in our instructions. */
+       memcpy(ibuf, lguest_insns[type].start, insn_len);
        return insn_len;
 }
 
+/*G:030 Once we get to lguest_init(), we know we're a Guest.  The paravirt_ops
+ * structure in the kernel provides a single point for (almost) every routine
+ * we have to override to avoid privileged instructions. */
 __init void lguest_init(void *boot)
 {
-       /* Copy boot parameters first. */
+       /* Copy boot parameters first: the Launcher put the physical location
+        * in %esi, and head.S converted that to a virtual address and handed
+        * it to us. */
        memcpy(&boot_params, boot, PARAM_SIZE);
+       /* The boot parameters also tell us where the command-line is: save
+        * that, too. */
        memcpy(boot_command_line, __va(boot_params.hdr.cmd_line_ptr),
               COMMAND_LINE_SIZE);
 
+       /* We're under lguest, paravirt is enabled, and we're running at
+        * privilege level 1, not 0 as normal. */
        paravirt_ops.name = "lguest";
        paravirt_ops.paravirt_enabled = 1;
        paravirt_ops.kernel_rpl = 1;
 
+       /* We set up all the lguest overrides for sensitive operations.  These
+        * are detailed with the operations themselves. */
        paravirt_ops.save_fl = save_fl;
        paravirt_ops.restore_fl = restore_fl;
        paravirt_ops.irq_disable = irq_disable;
@@ -592,21 +1021,50 @@ __init void lguest_init(void *boot)
        paravirt_ops.time_init = lguest_time_init;
        paravirt_ops.set_lazy_mode = lguest_lazy_mode;
        paravirt_ops.wbinvd = lguest_wbinvd;
-       paravirt_ops.sched_clock = lguest_sched_clock;
-
+       /* Now is a good time to look at the implementations of these functions
+        * before returning to the rest of lguest_init(). */
+
+       /*G:070 Now we've seen all the paravirt_ops, we return to
+        * lguest_init() where the rest of the fairly chaotic boot setup
+        * occurs.
+        *
+        * The Host expects our first hypercall to tell it where our "struct
+        * lguest_data" is, so we do that first. */
        hcall(LHCALL_LGUEST_INIT, __pa(&lguest_data), 0, 0);
 
-       /* We use top of mem for initial pagetables. */
+       /* The native boot code sets up initial page tables immediately after
+        * the kernel itself, and sets init_pg_tables_end so they're not
+        * clobbered.  The Launcher places our initial pagetables somewhere at
+        * the top of our physical memory, so we don't need extra space: set
+        * init_pg_tables_end to the end of the kernel. */
        init_pg_tables_end = __pa(pg0);
 
+       /* Load the %fs segment register (the per-cpu segment register) with
+        * the normal data segment to get through booting. */
        asm volatile ("mov %0, %%fs" : : "r" (__KERNEL_DS) : "memory");
 
+       /* Clear the part of the kernel data which is expected to be zero.
+        * Normally it will be anyway, but if we're loading from a bzImage with
+        * CONFIG_RELOCATALE=y, the relocations will be sitting here. */
+       memset(__bss_start, 0, __bss_stop - __bss_start);
+
+       /* The Host uses the top of the Guest's virtual address space for the
+        * Host<->Guest Switcher, and it tells us how much it needs in
+        * lguest_data.reserve_mem, set up on the LGUEST_INIT hypercall. */
        reserve_top_address(lguest_data.reserve_mem);
 
+       /* If we don't initialize the lock dependency checker now, it crashes
+        * paravirt_disable_iospace. */
        lockdep_init();
 
+       /* The IDE code spends about 3 seconds probing for disks: if we reserve
+        * all the I/O ports up front it can't get them and so doesn't probe.
+        * Other device drivers are similar (but less severe).  This cuts the
+        * kernel boot time on my machine from 4.1 seconds to 0.45 seconds. */
        paravirt_disable_iospace();
 
+       /* This is messy CPU setup stuff which the native boot code does before
+        * start_kernel, so we have to do, too: */
        cpu_detect(&new_cpu_data);
        /* head.S usually sets up the first capability word, so do it here. */
        new_cpu_data.x86_capability[0] = cpuid_edx(1);
@@ -617,14 +1075,27 @@ __init void lguest_init(void *boot)
 #ifdef CONFIG_X86_MCE
        mce_disabled = 1;
 #endif
-
 #ifdef CONFIG_ACPI
        acpi_disabled = 1;
        acpi_ht = 0;
 #endif
 
+       /* We set the perferred console to "hvc".  This is the "hypervisor
+        * virtual console" driver written by the PowerPC people, which we also
+        * adapted for lguest's use. */
        add_preferred_console("hvc", 0, NULL);
 
+       /* Last of all, we set the power management poweroff hook to point to
+        * the Guest routine to power off. */
        pm_power_off = lguest_power_off;
+
+       /* Now we're set up, call start_kernel() in init/main.c and we proceed
+        * to boot as normal.  It never returns. */
        start_kernel();
 }
+/*
+ * This marks the end of stage II of our journey, The Guest.
+ *
+ * It is now time for us to explore the nooks and crannies of the three Guest
+ * devices and complete our understanding of the Guest in "make Drivers".
+ */
index a3dbf22ee365a86d11b85792e1163f8256e9cdda..f182c6a36209c4c35b5f0c1b5bba3e5bf1b57f0c 100644 (file)
@@ -4,15 +4,15 @@
 #include <asm/thread_info.h>
 #include <asm/processor-flags.h>
 
-/*
- * This is where we begin: we have a magic signature which the launcher looks
- * for.  The plan is that the Linux boot protocol will be extended with a
+/*G:020 This is where we begin: we have a magic signature which the launcher
+ * looks for.  The plan is that the Linux boot protocol will be extended with a
  * "platform type" field which will guide us here from the normal entry point,
- * but for the moment this suffices.  We pass the virtual address of the boot
- * info to lguest_init().
+ * but for the moment this suffices.  The normal boot code uses %esi for the
+ * boot header, so we do too.  We convert it to a virtual address by adding
+ * PAGE_OFFSET, and hand it to lguest_init() as its argument (ie. %eax).
  *
- * We put it in .init.text will be discarded after boot.
- */
+ * The .section line puts this code in .init.text so it will be discarded after
+ * boot. */
 .section .init.text, "ax", @progbits
 .ascii "GenuineLguest"
        /* Set up initial stack. */
@@ -21,7 +21,9 @@
        addl $__PAGE_OFFSET, %eax
        jmp lguest_init
 
-/* The templates for inline patching. */
+/*G:055 We create a macro which puts the assembler code between lgstart_ and
+ * lgend_ markers.  These templates end up in the .init.text section, so they
+ * are discarded after boot. */
 #define LGUEST_PATCH(name, insns...)                   \
        lgstart_##name: insns; lgend_##name:;           \
        .globl lgstart_##name; .globl lgend_##name
@@ -30,24 +32,61 @@ LGUEST_PATCH(cli, movl $0, lguest_data+LGUEST_DATA_irq_enabled)
 LGUEST_PATCH(sti, movl $X86_EFLAGS_IF, lguest_data+LGUEST_DATA_irq_enabled)
 LGUEST_PATCH(popf, movl %eax, lguest_data+LGUEST_DATA_irq_enabled)
 LGUEST_PATCH(pushf, movl lguest_data+LGUEST_DATA_irq_enabled, %eax)
+/*:*/
 
 .text
 /* These demark the EIP range where host should never deliver interrupts. */
 .global lguest_noirq_start
 .global lguest_noirq_end
 
-/*
- * We move eflags word to lguest_data.irq_enabled to restore interrupt state.
- * For page faults, gpfs and virtual interrupts, the hypervisor has saved
- * eflags manually, otherwise it was delivered directly and so eflags reflects
- * the real machine IF state, ie. interrupts on.  Since the kernel always dies
- * if it takes such a trap with interrupts disabled anyway, turning interrupts
- * back on unconditionally here is OK.
- */
+/*M:004 When the Host reflects a trap or injects an interrupt into the Guest,
+ * it sets the eflags interrupt bit on the stack based on
+ * lguest_data.irq_enabled, so the Guest iret logic does the right thing when
+ * restoring it.  However, when the Host sets the Guest up for direct traps,
+ * such as system calls, the processor is the one to push eflags onto the
+ * stack, and the interrupt bit will be 1 (in reality, interrupts are always
+ * enabled in the Guest).
+ *
+ * This turns out to be harmless: the only trap which should happen under Linux
+ * with interrupts disabled is Page Fault (due to our lazy mapping of vmalloc
+ * regions), which has to be reflected through the Host anyway.  If another
+ * trap *does* go off when interrupts are disabled, the Guest will panic, and
+ * we'll never get to this iret! :*/
+
+/*G:045 There is one final paravirt_op that the Guest implements, and glancing
+ * at it you can see why I left it to last.  It's *cool*!  It's in *assembler*!
+ *
+ * The "iret" instruction is used to return from an interrupt or trap.  The
+ * stack looks like this:
+ *   old address
+ *   old code segment & privilege level
+ *   old processor flags ("eflags")
+ *
+ * The "iret" instruction pops those values off the stack and restores them all
+ * at once.  The only problem is that eflags includes the Interrupt Flag which
+ * the Guest can't change: the CPU will simply ignore it when we do an "iret".
+ * So we have to copy eflags from the stack to lguest_data.irq_enabled before
+ * we do the "iret".
+ *
+ * There are two problems with this: firstly, we need to use a register to do
+ * the copy and secondly, the whole thing needs to be atomic.  The first
+ * problem is easy to solve: push %eax on the stack so we can use it, and then
+ * restore it at the end just before the real "iret".
+ *
+ * The second is harder: copying eflags to lguest_data.irq_enabled will turn
+ * interrupts on before we're finished, so we could be interrupted before we
+ * return to userspace or wherever.  Our solution to this is to surround the
+ * code with lguest_noirq_start: and lguest_noirq_end: labels.  We tell the
+ * Host that it is *never* to interrupt us there, even if interrupts seem to be
+ * enabled. */
 ENTRY(lguest_iret)
        pushl   %eax
        movl    12(%esp), %eax
 lguest_noirq_start:
+       /* Note the %ss: segment prefix here.  Normal data accesses use the
+        * "ds" segment, but that will have already been restored for whatever
+        * we're returning to (such as userspace): we can't trust it.  The %ss:
+        * prefix makes sure we use the stack segment, which is still valid. */
        movl    %eax,%ss:lguest_data+LGUEST_DATA_irq_enabled
        popl    %eax
        iret
index 18d6ab21a43bfbce2bedc252832477930ec74256..9e7752cc8002ea60ffa98d0f2e920b73b7f52447 100644 (file)
@@ -1,7 +1,11 @@
+/*P:050 Lguest guests use a very simple bus for devices.  It's a simple array
+ * of device descriptors contained just above the top of normal memory.  The
+ * lguest bus is 80% tedious boilerplate code. :*/
 #include <linux/init.h>
 #include <linux/bootmem.h>
 #include <linux/lguest_bus.h>
 #include <asm/io.h>
+#include <asm/paravirt.h>
 
 static ssize_t type_show(struct device *_dev,
                          struct device_attribute *attr, char *buf)
@@ -43,6 +47,10 @@ static struct device_attribute lguest_dev_attrs[] = {
        __ATTR_NULL
 };
 
+/*D:130 The generic bus infrastructure requires a function which says whether a
+ * device matches a driver.  For us, it is simple: "struct lguest_driver"
+ * contains a "device_type" field which indicates what type of device it can
+ * handle, so we just cast the args and compare: */
 static int lguest_dev_match(struct device *_dev, struct device_driver *_drv)
 {
        struct lguest_device *dev = container_of(_dev,struct lguest_device,dev);
@@ -50,6 +58,7 @@ static int lguest_dev_match(struct device *_dev, struct device_driver *_drv)
 
        return (drv->device_type == lguest_devices[dev->index].type);
 }
+/*:*/
 
 struct lguest_bus {
        struct bus_type bus;
@@ -68,11 +77,24 @@ static struct lguest_bus lguest_bus = {
        }
 };
 
+/*D:140 This is the callback which occurs once the bus infrastructure matches
+ * up a device and driver, ie. in response to add_lguest_device() calling
+ * device_register(), or register_lguest_driver() calling driver_register().
+ *
+ * At the moment it's always the latter: the devices are added first, since
+ * scan_devices() is called from a "core_initcall", and the drivers themselves
+ * called later as a normal "initcall".  But it would work the other way too.
+ *
+ * So now we have the happy couple, we add the status bit to indicate that we
+ * found a driver.  If the driver truly loves the device, it will return
+ * happiness from its probe function (ok, perhaps this wasn't my greatest
+ * analogy), and we set the final "driver ok" bit so the Host sees it's all
+ * green. */
 static int lguest_dev_probe(struct device *_dev)
 {
        int ret;
-       struct lguest_device *dev = container_of(_dev,struct lguest_device,dev);
-       struct lguest_driver *drv = container_of(dev->dev.driver,
+       struct lguest_device*dev = container_of(_dev,struct lguest_device,dev);
+       struct lguest_driver*drv = container_of(dev->dev.driver,
                                                struct lguest_driver, drv);
 
        lguest_devices[dev->index].status |= LGUEST_DEVICE_S_DRIVER;
@@ -82,6 +104,10 @@ static int lguest_dev_probe(struct device *_dev)
        return ret;
 }
 
+/* The last part of the bus infrastructure is the function lguest drivers use
+ * to register themselves.  Firstly, we do nothing if there's no lguest bus
+ * (ie. this is not a Guest), otherwise we fill in the embedded generic "struct
+ * driver" fields and call the generic driver_register(). */
 int register_lguest_driver(struct lguest_driver *drv)
 {
        if (!lguest_devices)
@@ -94,12 +120,36 @@ int register_lguest_driver(struct lguest_driver *drv)
 
        return driver_register(&drv->drv);
 }
+
+/* At the moment we build all the drivers into the kernel because they're so
+ * simple: 8144 bytes for all three of them as I type this.  And as the console
+ * really needs to be built in, it's actually only 3527 bytes for the network
+ * and block drivers.
+ *
+ * If they get complex it will make sense for them to be modularized, so we
+ * need to explicitly export the symbol.
+ *
+ * I don't think non-GPL modules make sense, so it's a GPL-only export.
+ */
 EXPORT_SYMBOL_GPL(register_lguest_driver);
 
+/*D:120 This is the core of the lguest bus: actually adding a new device.
+ * It's a separate function because it's neater that way, and because an
+ * earlier version of the code supported hotplug and unplug.  They were removed
+ * early on because they were never used.
+ *
+ * As Andrew Tridgell says, "Untested code is buggy code".
+ *
+ * It's worth reading this carefully: we start with an index into the array of
+ * "struct lguest_device_desc"s indicating the device which is new: */
 static void add_lguest_device(unsigned int index)
 {
        struct lguest_device *new;
 
+       /* Each "struct lguest_device_desc" has a "status" field, which the
+        * Guest updates as the device is probed.  In the worst case, the Host
+        * can look at these bits to tell what part of device setup failed,
+        * even if the console isn't available. */
        lguest_devices[index].status |= LGUEST_DEVICE_S_ACKNOWLEDGE;
        new = kmalloc(sizeof(struct lguest_device), GFP_KERNEL);
        if (!new) {
@@ -108,12 +158,17 @@ static void add_lguest_device(unsigned int index)
                return;
        }
 
+       /* The "struct lguest_device" setup is pretty straight-forward example
+        * code. */
        new->index = index;
        new->private = NULL;
        memset(&new->dev, 0, sizeof(new->dev));
        new->dev.parent = &lguest_bus.dev;
        new->dev.bus = &lguest_bus.bus;
        sprintf(new->dev.bus_id, "%u", index);
+
+       /* device_register() causes the bus infrastructure to look for a
+        * matching driver. */
        if (device_register(&new->dev) != 0) {
                printk(KERN_EMERG "Cannot register lguest device %u\n", index);
                lguest_devices[index].status |= LGUEST_DEVICE_S_FAILED;
@@ -121,6 +176,9 @@ static void add_lguest_device(unsigned int index)
        }
 }
 
+/*D:110 scan_devices() simply iterates through the device array.  The type 0
+ * is reserved to mean "no device", and anything else means we have found a
+ * device: add it. */
 static void scan_devices(void)
 {
        unsigned int i;
@@ -130,12 +188,23 @@ static void scan_devices(void)
                        add_lguest_device(i);
 }
 
+/*D:100 Fairly early in boot, lguest_bus_init() is called to set up the lguest
+ * bus.  We check that we are a Guest by checking paravirt_ops.name: there are
+ * other ways of checking, but this seems most obvious to me.
+ *
+ * So we can access the array of "struct lguest_device_desc"s easily, we map
+ * that memory and store the pointer in the global "lguest_devices".  Then we
+ * register the bus with the core.  Doing two registrations seems clunky to me,
+ * but it seems to be the correct sysfs incantation.
+ *
+ * Finally we call scan_devices() which adds all the devices found in the
+ * "struct lguest_device_desc" array. */
 static int __init lguest_bus_init(void)
 {
        if (strcmp(paravirt_ops.name, "lguest") != 0)
                return 0;
 
-       /* Devices are in page above top of "normal" mem. */
+       /* Devices are in a single page above top of "normal" mem */
        lguest_devices = lguest_map(max_pfn<<PAGE_SHIFT, 1);
 
        if (bus_register(&lguest_bus.bus) != 0
@@ -145,4 +214,5 @@ static int __init lguest_bus_init(void)
        scan_devices();
        return 0;
 }
+/* Do this after core stuff, before devices. */
 postcore_initcall(lguest_bus_init);
index e90d7a783dafab8d94002230812758bea7782cfc..80d1b58c76986b9d245637e4e29999793260ddcd 100644 (file)
@@ -1,36 +1,70 @@
-/* Userspace control of the guest, via /dev/lguest. */
+/*P:200 This contains all the /dev/lguest code, whereby the userspace launcher
+ * controls and communicates with the Guest.  For example, the first write will
+ * tell us the memory size, pagetable, entry point and kernel address offset.
+ * A read will run the Guest until a signal is pending (-EINTR), or the Guest
+ * does a DMA out to the Launcher.  Writes are also used to get a DMA buffer
+ * registered by the Guest and to send the Guest an interrupt. :*/
 #include <linux/uaccess.h>
 #include <linux/miscdevice.h>
 #include <linux/fs.h>
 #include "lg.h"
 
+/*L:030 setup_regs() doesn't really belong in this file, but it gives us an
+ * early glimpse deeper into the Host so it's worth having here.
+ *
+ * Most of the Guest's registers are left alone: we used get_zeroed_page() to
+ * allocate the structure, so they will be 0. */
 static void setup_regs(struct lguest_regs *regs, unsigned long start)
 {
-       /* Write out stack in format lguest expects, so we can switch to it. */
+       /* There are four "segment" registers which the Guest needs to boot:
+        * The "code segment" register (cs) refers to the kernel code segment
+        * __KERNEL_CS, and the "data", "extra" and "stack" segment registers
+        * refer to the kernel data segment __KERNEL_DS.
+        *
+        * The privilege level is packed into the lower bits.  The Guest runs
+        * at privilege level 1 (GUEST_PL).*/
        regs->ds = regs->es = regs->ss = __KERNEL_DS|GUEST_PL;
        regs->cs = __KERNEL_CS|GUEST_PL;
-       regs->eflags = 0x202;   /* Interrupts enabled. */
+
+       /* The "eflags" register contains miscellaneous flags.  Bit 1 (0x002)
+        * is supposed to always be "1".  Bit 9 (0x200) controls whether
+        * interrupts are enabled.  We always leave interrupts enabled while
+        * running the Guest. */
+       regs->eflags = 0x202;
+
+       /* The "Extended Instruction Pointer" register says where the Guest is
+        * running. */
        regs->eip = start;
-       /* esi points to our boot information (physical address 0) */
+
+       /* %esi points to our boot information, at physical address 0, so don't
+        * touch it. */
 }
 
-/* + addr */
+/*L:310 To send DMA into the Guest, the Launcher needs to be able to ask for a
+ * DMA buffer.  This is done by writing LHREQ_GETDMA and the key to
+ * /dev/lguest. */
 static long user_get_dma(struct lguest *lg, const u32 __user *input)
 {
        unsigned long key, udma, irq;
 
+       /* Fetch the key they wrote to us. */
        if (get_user(key, input) != 0)
                return -EFAULT;
+       /* Look for a free Guest DMA buffer bound to that key. */
        udma = get_dma_buffer(lg, key, &irq);
        if (!udma)
                return -ENOENT;
 
-       /* We put irq number in udma->used_len. */
+       /* We need to tell the Launcher what interrupt the Guest expects after
+        * the buffer is filled.  We stash it in udma->used_len. */
        lgwrite_u32(lg, udma + offsetof(struct lguest_dma, used_len), irq);
+
+       /* The (guest-physical) address of the DMA buffer is returned from
+        * the write(). */
        return udma;
 }
 
-/* To force the Guest to stop running and return to the Launcher, the
+/*L:315 To force the Guest to stop running and return to the Launcher, the
  * Waker sets writes LHREQ_BREAK and the value "1" to /dev/lguest.  The
  * Launcher then writes LHREQ_BREAK and "0" to release the Waker. */
 static int break_guest_out(struct lguest *lg, const u32 __user *input)
@@ -54,7 +88,8 @@ static int break_guest_out(struct lguest *lg, const u32 __user *input)
        }
 }
 
-/* + irq */
+/*L:050 Sending an interrupt is done by writing LHREQ_IRQ and an interrupt
+ * number to /dev/lguest. */
 static int user_send_irq(struct lguest *lg, const u32 __user *input)
 {
        u32 irq;
@@ -63,14 +98,19 @@ static int user_send_irq(struct lguest *lg, const u32 __user *input)
                return -EFAULT;
        if (irq >= LGUEST_IRQS)
                return -EINVAL;
+       /* Next time the Guest runs, the core code will see if it can deliver
+        * this interrupt. */
        set_bit(irq, lg->irqs_pending);
        return 0;
 }
 
+/*L:040 Once our Guest is initialized, the Launcher makes it run by reading
+ * from /dev/lguest. */
 static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
 {
        struct lguest *lg = file->private_data;
 
+       /* You must write LHREQ_INITIALIZE first! */
        if (!lg)
                return -EINVAL;
 
@@ -78,27 +118,52 @@ static ssize_t read(struct file *file, char __user *user, size_t size,loff_t*o)
        if (current != lg->tsk)
                return -EPERM;
 
+       /* If the guest is already dead, we indicate why */
        if (lg->dead) {
                size_t len;
 
+               /* lg->dead either contains an error code, or a string. */
                if (IS_ERR(lg->dead))
                        return PTR_ERR(lg->dead);
 
+               /* We can only return as much as the buffer they read with. */
                len = min(size, strlen(lg->dead)+1);
                if (copy_to_user(user, lg->dead, len) != 0)
                        return -EFAULT;
                return len;
        }
 
+       /* If we returned from read() last time because the Guest sent DMA,
+        * clear the flag. */
        if (lg->dma_is_pending)
                lg->dma_is_pending = 0;
 
+       /* Run the Guest until something interesting happens. */
        return run_guest(lg, (unsigned long __user *)user);
 }
 
-/* Take: pfnlimit, pgdir, start, pageoffset. */
+/*L:020 The initialization write supplies 4 32-bit values (in addition to the
+ * 32-bit LHREQ_INITIALIZE value).  These are:
+ *
+ * pfnlimit: The highest (Guest-physical) page number the Guest should be
+ * allowed to access.  The Launcher has to live in Guest memory, so it sets
+ * this to ensure the Guest can't reach it.
+ *
+ * pgdir: The (Guest-physical) address of the top of the initial Guest
+ * pagetables (which are set up by the Launcher).
+ *
+ * start: The first instruction to execute ("eip" in x86-speak).
+ *
+ * page_offset: The PAGE_OFFSET constant in the Guest kernel.  We should
+ * probably wean the code off this, but it's a very useful constant!  Any
+ * address above this is within the Guest kernel, and any kernel address can
+ * quickly converted from physical to virtual by adding PAGE_OFFSET.  It's
+ * 0xC0000000 (3G) by default, but it's configurable at kernel build time.
+ */
 static int initialize(struct file *file, const u32 __user *input)
 {
+       /* "struct lguest" contains everything we (the Host) know about a
+        * Guest. */
        struct lguest *lg;
        int err, i;
        u32 args[4];
@@ -106,7 +171,7 @@ static int initialize(struct file *file, const u32 __user *input)
        /* We grab the Big Lguest lock, which protects the global array
         * "lguests" and multiple simultaneous initializations. */
        mutex_lock(&lguest_lock);
-
+       /* You can't initialize twice!  Close the device and start again... */
        if (file->private_data) {
                err = -EBUSY;
                goto unlock;
@@ -117,37 +182,70 @@ static int initialize(struct file *file, const u32 __user *input)
                goto unlock;
        }
 
+       /* Find an unused guest. */
        i = find_free_guest();
        if (i < 0) {
                err = -ENOSPC;
                goto unlock;
        }
+       /* OK, we have an index into the "lguest" array: "lg" is a convenient
+        * pointer. */
        lg = &lguests[i];
+
+       /* Populate the easy fields of our "struct lguest" */
        lg->guestid = i;
        lg->pfn_limit = args[0];
        lg->page_offset = args[3];
+
+       /* We need a complete page for the Guest registers: they are accessible
+        * to the Guest and we can only grant it access to whole pages. */
        lg->regs_page = get_zeroed_page(GFP_KERNEL);
        if (!lg->regs_page) {
                err = -ENOMEM;
                goto release_guest;
        }
+       /* We actually put the registers at the bottom of the page. */
        lg->regs = (void *)lg->regs_page + PAGE_SIZE - sizeof(*lg->regs);
 
+       /* Initialize the Guest's shadow page tables, using the toplevel
+        * address the Launcher gave us.  This allocates memory, so can
+        * fail. */
        err = init_guest_pagetable(lg, args[1]);
        if (err)
                goto free_regs;
 
+       /* Now we initialize the Guest's registers, handing it the start
+        * address. */
        setup_regs(lg->regs, args[2]);
+
+       /* There are a couple of GDT entries the Guest expects when first
+        * booting. */
        setup_guest_gdt(lg);
+
+       /* The timer for lguest's clock needs initialization. */
        init_clockdev(lg);
+
+       /* We keep a pointer to the Launcher task (ie. current task) for when
+        * other Guests want to wake this one (inter-Guest I/O). */
        lg->tsk = current;
+       /* We need to keep a pointer to the Launcher's memory map, because if
+        * the Launcher dies we need to clean it up.  If we don't keep a
+        * reference, it is destroyed before close() is called. */
        lg->mm = get_task_mm(lg->tsk);
+
+       /* Initialize the queue for the waker to wait on */
        init_waitqueue_head(&lg->break_wq);
+
+       /* We remember which CPU's pages this Guest used last, for optimization
+        * when the same Guest runs on the same CPU twice. */
        lg->last_pages = NULL;
+
+       /* We keep our "struct lguest" in the file's private_data. */
        file->private_data = lg;
 
        mutex_unlock(&lguest_lock);
 
+       /* And because this is a write() call, we return the length used. */
        return sizeof(args);
 
 free_regs:
@@ -159,9 +257,15 @@ unlock:
        return err;
 }
 
+/*L:010 The first operation the Launcher does must be a write.  All writes
+ * start with a 32 bit number: for the first write this must be
+ * LHREQ_INITIALIZE to set up the Guest.  After that the Launcher can use
+ * writes of other values to get DMA buffers and send interrupts. */
 static ssize_t write(struct file *file, const char __user *input,
                     size_t size, loff_t *off)
 {
+       /* Once the guest is initialized, we hold the "struct lguest" in the
+        * file private data. */
        struct lguest *lg = file->private_data;
        u32 req;
 
@@ -169,8 +273,11 @@ static ssize_t write(struct file *file, const char __user *input,
                return -EFAULT;
        input += sizeof(req);
 
+       /* If you haven't initialized, you must do that first. */
        if (req != LHREQ_INITIALIZE && !lg)
                return -EINVAL;
+
+       /* Once the Guest is dead, all you can do is read() why it died. */
        if (lg && lg->dead)
                return -ENOENT;
 
@@ -192,33 +299,72 @@ static ssize_t write(struct file *file, const char __user *input,
        }
 }
 
+/*L:060 The final piece of interface code is the close() routine.  It reverses
+ * everything done in initialize().  This is usually called because the
+ * Launcher exited.
+ *
+ * Note that the close routine returns 0 or a negative error number: it can't
+ * really fail, but it can whine.  I blame Sun for this wart, and K&R C for
+ * letting them do it. :*/
 static int close(struct inode *inode, struct file *file)
 {
        struct lguest *lg = file->private_data;
 
+       /* If we never successfully initialized, there's nothing to clean up */
        if (!lg)
                return 0;
 
+       /* We need the big lock, to protect from inter-guest I/O and other
+        * Launchers initializing guests. */
        mutex_lock(&lguest_lock);
        /* Cancels the hrtimer set via LHCALL_SET_CLOCKEVENT. */
        hrtimer_cancel(&lg->hrt);
+       /* Free any DMA buffers the Guest had bound. */
        release_all_dma(lg);
+       /* Free up the shadow page tables for the Guest. */
        free_guest_pagetable(lg);
+       /* Now all the memory cleanups are done, it's safe to release the
+        * Launcher's memory management structure. */
        mmput(lg->mm);
+       /* If lg->dead doesn't contain an error code it will be NULL or a
+        * kmalloc()ed string, either of which is ok to hand to kfree(). */
        if (!IS_ERR(lg->dead))
                kfree(lg->dead);
+       /* We can free up the register page we allocated. */
        free_page(lg->regs_page);
+       /* We clear the entire structure, which also marks it as free for the
+        * next user. */
        memset(lg, 0, sizeof(*lg));
+       /* Release lock and exit. */
        mutex_unlock(&lguest_lock);
+
        return 0;
 }
 
+/*L:000
+ * Welcome to our journey through the Launcher!
+ *
+ * The Launcher is the Host userspace program which sets up, runs and services
+ * the Guest.  In fact, many comments in the Drivers which refer to "the Host"
+ * doing things are inaccurate: the Launcher does all the device handling for
+ * the Guest.  The Guest can't tell what's done by the the Launcher and what by
+ * the Host.
+ *
+ * Just to confuse you: to the Host kernel, the Launcher *is* the Guest and we
+ * shall see more of that later.
+ *
+ * We begin our understanding with the Host kernel interface which the Launcher
+ * uses: reading and writing a character device called /dev/lguest.  All the
+ * work happens in the read(), write() and close() routines: */
 static struct file_operations lguest_fops = {
        .owner   = THIS_MODULE,
        .release = close,
        .write   = write,
        .read    = read,
 };
+
+/* This is a textbook example of a "misc" character device.  Populate a "struct
+ * miscdevice" and register it with misc_register(). */
 static struct miscdevice lguest_dev = {
        .minor  = MISC_DYNAMIC_MINOR,
        .name   = "lguest",
index 1b0ba09b126927b3898a5aae43d4aac46984f040..b7a924ace68426d85167adb6121f7e39364e9be4 100644 (file)
@@ -1,5 +1,11 @@
-/* Shadow page table operations.
- * Copyright (C) Rusty Russell IBM Corporation 2006.
+/*P:700 The pagetable code, on the other hand, still shows the scars of
+ * previous encounters.  It's functional, and as neat as it can be in the
+ * circumstances, but be wary, for these things are subtle and break easily.
+ * The Guest provides a virtual to physical mapping, but we can neither trust
+ * it nor use it: we verify and convert it here to point the hardware to the
+ * actual Guest pages when running the Guest. :*/
+
+/* Copyright (C) Rusty Russell IBM Corporation 2006.
  * GPL v2 and any later version */
 #include <linux/mm.h>
 #include <linux/types.h>
 #include <asm/tlbflush.h>
 #include "lg.h"
 
+/*M:008 We hold reference to pages, which prevents them from being swapped.
+ * It'd be nice to have a callback in the "struct mm_struct" when Linux wants
+ * to swap out.  If we had this, and a shrinker callback to trim PTE pages, we
+ * could probably consider launching Guests as non-root. :*/
+
+/*H:300
+ * The Page Table Code
+ *
+ * We use two-level page tables for the Guest.  If you're not entirely
+ * comfortable with virtual addresses, physical addresses and page tables then
+ * I recommend you review lguest.c's "Page Table Handling" (with diagrams!).
+ *
+ * The Guest keeps page tables, but we maintain the actual ones here: these are
+ * called "shadow" page tables.  Which is a very Guest-centric name: these are
+ * the real page tables the CPU uses, although we keep them up to date to
+ * reflect the Guest's.  (See what I mean about weird naming?  Since when do
+ * shadows reflect anything?)
+ *
+ * Anyway, this is the most complicated part of the Host code.  There are seven
+ * parts to this:
+ *  (i) Setting up a page table entry for the Guest when it faults,
+ *  (ii) Setting up the page table entry for the Guest stack,
+ *  (iii) Setting up a page table entry when the Guest tells us it has changed,
+ *  (iv) Switching page tables,
+ *  (v) Flushing (thowing away) page tables,
+ *  (vi) Mapping the Switcher when the Guest is about to run,
+ *  (vii) Setting up the page tables initially.
+ :*/
+
+/* Pages a 4k long, and each page table entry is 4 bytes long, giving us 1024
+ * (or 2^10) entries per page. */
 #define PTES_PER_PAGE_SHIFT 10
 #define PTES_PER_PAGE (1 << PTES_PER_PAGE_SHIFT)
+
+/* 1024 entries in a page table page maps 1024 pages: 4MB.  The Switcher is
+ * conveniently placed at the top 4MB, so it uses a separate, complete PTE
+ * page.  */
 #define SWITCHER_PGD_INDEX (PTES_PER_PAGE - 1)
 
+/* We actually need a separate PTE page for each CPU.  Remember that after the
+ * Switcher code itself comes two pages for each CPU, and we don't want this
+ * CPU's guest to see the pages of any other CPU. */
 static DEFINE_PER_CPU(spte_t *, switcher_pte_pages);
 #define switcher_pte_page(cpu) per_cpu(switcher_pte_pages, cpu)
 
+/*H:320 With our shadow and Guest types established, we need to deal with
+ * them: the page table code is curly enough to need helper functions to keep
+ * it clear and clean.
+ *
+ * The first helper takes a virtual address, and says which entry in the top
+ * level page table deals with that address.  Since each top level entry deals
+ * with 4M, this effectively divides by 4M. */
 static unsigned vaddr_to_pgd_index(unsigned long vaddr)
 {
        return vaddr >> (PAGE_SHIFT + PTES_PER_PAGE_SHIFT);
 }
 
-/* These access the shadow versions (ie. the ones used by the CPU). */
+/* There are two functions which return pointers to the shadow (aka "real")
+ * page tables.
+ *
+ * spgd_addr() takes the virtual address and returns a pointer to the top-level
+ * page directory entry for that address.  Since we keep track of several page
+ * tables, the "i" argument tells us which one we're interested in (it's
+ * usually the current one). */
 static spgd_t *spgd_addr(struct lguest *lg, u32 i, unsigned long vaddr)
 {
        unsigned int index = vaddr_to_pgd_index(vaddr);
 
+       /* We kill any Guest trying to touch the Switcher addresses. */
        if (index >= SWITCHER_PGD_INDEX) {
                kill_guest(lg, "attempt to access switcher pages");
                index = 0;
        }
+       /* Return a pointer index'th pgd entry for the i'th page table. */
        return &lg->pgdirs[i].pgdir[index];
 }
 
+/* This routine then takes the PGD entry given above, which contains the
+ * address of the PTE page.  It then returns a pointer to the PTE entry for the
+ * given address. */
 static spte_t *spte_addr(struct lguest *lg, spgd_t spgd, unsigned long vaddr)
 {
        spte_t *page = __va(spgd.pfn << PAGE_SHIFT);
+       /* You should never call this if the PGD entry wasn't valid */
        BUG_ON(!(spgd.flags & _PAGE_PRESENT));
        return &page[(vaddr >> PAGE_SHIFT) % PTES_PER_PAGE];
 }
 
-/* These access the guest versions. */
+/* These two functions just like the above two, except they access the Guest
+ * page tables.  Hence they return a Guest address. */
 static unsigned long gpgd_addr(struct lguest *lg, unsigned long vaddr)
 {
        unsigned int index = vaddr >> (PAGE_SHIFT + PTES_PER_PAGE_SHIFT);
@@ -55,12 +119,24 @@ static unsigned long gpte_addr(struct lguest *lg,
        return gpage + ((vaddr>>PAGE_SHIFT) % PTES_PER_PAGE) * sizeof(gpte_t);
 }
 
-/* Do a virtual -> physical mapping on a user page. */
+/*H:350 This routine takes a page number given by the Guest and converts it to
+ * an actual, physical page number.  It can fail for several reasons: the
+ * virtual address might not be mapped by the Launcher, the write flag is set
+ * and the page is read-only, or the write flag was set and the page was
+ * shared so had to be copied, but we ran out of memory.
+ *
+ * This holds a reference to the page, so release_pte() is careful to
+ * put that back. */
 static unsigned long get_pfn(unsigned long virtpfn, int write)
 {
        struct page *page;
+       /* This value indicates failure. */
        unsigned long ret = -1UL;
 
+       /* get_user_pages() is a complex interface: it gets the "struct
+        * vm_area_struct" and "struct page" assocated with a range of pages.
+        * It also needs the task's mmap_sem held, and is not very quick.
+        * It returns the number of pages it got. */
        down_read(&current->mm->mmap_sem);
        if (get_user_pages(current, current->mm, virtpfn << PAGE_SHIFT,
                           1, write, 1, &page, NULL) == 1)
@@ -69,28 +145,47 @@ static unsigned long get_pfn(unsigned long virtpfn, int write)
        return ret;
 }
 
+/*H:340 Converting a Guest page table entry to a shadow (ie. real) page table
+ * entry can be a little tricky.  The flags are (almost) the same, but the
+ * Guest PTE contains a virtual page number: the CPU needs the real page
+ * number. */
 static spte_t gpte_to_spte(struct lguest *lg, gpte_t gpte, int write)
 {
        spte_t spte;
        unsigned long pfn;
 
-       /* We ignore the global flag. */
+       /* The Guest sets the global flag, because it thinks that it is using
+        * PGE.  We only told it to use PGE so it would tell us whether it was
+        * flushing a kernel mapping or a userspace mapping.  We don't actually
+        * use the global bit, so throw it away. */
        spte.flags = (gpte.flags & ~_PAGE_GLOBAL);
+
+       /* We need a temporary "unsigned long" variable to hold the answer from
+        * get_pfn(), because it returns 0xFFFFFFFF on failure, which wouldn't
+        * fit in spte.pfn.  get_pfn() finds the real physical number of the
+        * page, given the virtual number. */
        pfn = get_pfn(gpte.pfn, write);
        if (pfn == -1UL) {
                kill_guest(lg, "failed to get page %u", gpte.pfn);
-               /* Must not put_page() bogus page on cleanup. */
+               /* When we destroy the Guest, we'll go through the shadow page
+                * tables and release_pte() them.  Make sure we don't think
+                * this one is valid! */
                spte.flags = 0;
        }
+       /* Now we assign the page number, and our shadow PTE is complete. */
        spte.pfn = pfn;
        return spte;
 }
 
+/*H:460 And to complete the chain, release_pte() looks like this: */
 static void release_pte(spte_t pte)
 {
+       /* Remember that get_user_pages() took a reference to the page, in
+        * get_pfn()?  We have to put it back now. */
        if (pte.flags & _PAGE_PRESENT)
                put_page(pfn_to_page(pte.pfn));
 }
+/*:*/
 
 static void check_gpte(struct lguest *lg, gpte_t gpte)
 {
@@ -104,11 +199,16 @@ static void check_gpgd(struct lguest *lg, gpgd_t gpgd)
                kill_guest(lg, "bad page directory entry");
 }
 
-/* FIXME: We hold reference to pages, which prevents them from being
-   swapped.  It'd be nice to have a callback when Linux wants to swap out. */
-
-/* We fault pages in, which allows us to update accessed/dirty bits.
- * Return true if we got page. */
+/*H:330
+ * (i) Setting up a page table entry for the Guest when it faults
+ *
+ * We saw this call in run_guest(): when we see a page fault in the Guest, we
+ * come here.  That's because we only set up the shadow page tables lazily as
+ * they're needed, so we get page faults all the time and quietly fix them up
+ * and return to the Guest without it knowing.
+ *
+ * If we fixed up the fault (ie. we mapped the address), this routine returns
+ * true. */
 int demand_page(struct lguest *lg, unsigned long vaddr, int errcode)
 {
        gpgd_t gpgd;
@@ -117,106 +217,161 @@ int demand_page(struct lguest *lg, unsigned long vaddr, int errcode)
        gpte_t gpte;
        spte_t *spte;
 
+       /* First step: get the top-level Guest page table entry. */
        gpgd = mkgpgd(lgread_u32(lg, gpgd_addr(lg, vaddr)));
+       /* Toplevel not present?  We can't map it in. */
        if (!(gpgd.flags & _PAGE_PRESENT))
                return 0;
 
+       /* Now look at the matching shadow entry. */
        spgd = spgd_addr(lg, lg->pgdidx, vaddr);
        if (!(spgd->flags & _PAGE_PRESENT)) {
-               /* Get a page of PTEs for them. */
+               /* No shadow entry: allocate a new shadow PTE page. */
                unsigned long ptepage = get_zeroed_page(GFP_KERNEL);
-               /* FIXME: Steal from self in this case? */
+               /* This is not really the Guest's fault, but killing it is
+                * simple for this corner case. */
                if (!ptepage) {
                        kill_guest(lg, "out of memory allocating pte page");
                        return 0;
                }
+               /* We check that the Guest pgd is OK. */
                check_gpgd(lg, gpgd);
+               /* And we copy the flags to the shadow PGD entry.  The page
+                * number in the shadow PGD is the page we just allocated. */
                spgd->raw.val = (__pa(ptepage) | gpgd.flags);
        }
 
+       /* OK, now we look at the lower level in the Guest page table: keep its
+        * address, because we might update it later. */
        gpte_ptr = gpte_addr(lg, gpgd, vaddr);
        gpte = mkgpte(lgread_u32(lg, gpte_ptr));
 
-       /* No page? */
+       /* If this page isn't in the Guest page tables, we can't page it in. */
        if (!(gpte.flags & _PAGE_PRESENT))
                return 0;
 
-       /* Write to read-only page? */
+       /* Check they're not trying to write to a page the Guest wants
+        * read-only (bit 2 of errcode == write). */
        if ((errcode & 2) && !(gpte.flags & _PAGE_RW))
                return 0;
 
-       /* User access to a non-user page? */
+       /* User access to a kernel page? (bit 3 == user access) */
        if ((errcode & 4) && !(gpte.flags & _PAGE_USER))
                return 0;
 
+       /* Check that the Guest PTE flags are OK, and the page number is below
+        * the pfn_limit (ie. not mapping the Launcher binary). */
        check_gpte(lg, gpte);
+       /* Add the _PAGE_ACCESSED and (for a write) _PAGE_DIRTY flag */
        gpte.flags |= _PAGE_ACCESSED;
        if (errcode & 2)
                gpte.flags |= _PAGE_DIRTY;
 
-       /* We're done with the old pte. */
+       /* Get the pointer to the shadow PTE entry we're going to set. */
        spte = spte_addr(lg, *spgd, vaddr);
+       /* If there was a valid shadow PTE entry here before, we release it.
+        * This can happen with a write to a previously read-only entry. */
        release_pte(*spte);
 
-       /* We don't make it writable if this isn't a write: later
-        * write will fault so we can set dirty bit in guest. */
+       /* If this is a write, we insist that the Guest page is writable (the
+        * final arg to gpte_to_spte()). */
        if (gpte.flags & _PAGE_DIRTY)
                *spte = gpte_to_spte(lg, gpte, 1);
        else {
+               /* If this is a read, don't set the "writable" bit in the page
+                * table entry, even if the Guest says it's writable.  That way
+                * we come back here when a write does actually ocur, so we can
+                * update the Guest's _PAGE_DIRTY flag. */
                gpte_t ro_gpte = gpte;
                ro_gpte.flags &= ~_PAGE_RW;
                *spte = gpte_to_spte(lg, ro_gpte, 0);
        }
 
-       /* Now we update dirty/accessed on guest. */
+       /* Finally, we write the Guest PTE entry back: we've set the
+        * _PAGE_ACCESSED and maybe the _PAGE_DIRTY flags. */
        lgwrite_u32(lg, gpte_ptr, gpte.raw.val);
+
+       /* We succeeded in mapping the page! */
        return 1;
 }
 
-/* This is much faster than the full demand_page logic. */
+/*H:360 (ii) Setting up the page table entry for the Guest stack.
+ *
+ * Remember pin_stack_pages() which makes sure the stack is mapped?  It could
+ * simply call demand_page(), but as we've seen that logic is quite long, and
+ * usually the stack pages are already mapped anyway, so it's not required.
+ *
+ * This is a quick version which answers the question: is this virtual address
+ * mapped by the shadow page tables, and is it writable? */
 static int page_writable(struct lguest *lg, unsigned long vaddr)
 {
        spgd_t *spgd;
        unsigned long flags;
 
+       /* Look at the top level entry: is it present? */
        spgd = spgd_addr(lg, lg->pgdidx, vaddr);
        if (!(spgd->flags & _PAGE_PRESENT))
                return 0;
 
+       /* Check the flags on the pte entry itself: it must be present and
+        * writable. */
        flags = spte_addr(lg, *spgd, vaddr)->flags;
        return (flags & (_PAGE_PRESENT|_PAGE_RW)) == (_PAGE_PRESENT|_PAGE_RW);
 }
 
+/* So, when pin_stack_pages() asks us to pin a page, we check if it's already
+ * in the page tables, and if not, we call demand_page() with error code 2
+ * (meaning "write"). */
 void pin_page(struct lguest *lg, unsigned long vaddr)
 {
        if (!page_writable(lg, vaddr) && !demand_page(lg, vaddr, 2))
                kill_guest(lg, "bad stack page %#lx", vaddr);
 }
 
+/*H:450 If we chase down the release_pgd() code, it looks like this: */
 static void release_pgd(struct lguest *lg, spgd_t *spgd)
 {
+       /* If the entry's not present, there's nothing to release. */
        if (spgd->flags & _PAGE_PRESENT) {
                unsigned int i;
+               /* Converting the pfn to find the actual PTE page is easy: turn
+                * the page number into a physical address, then convert to a
+                * virtual address (easy for kernel pages like this one). */
                spte_t *ptepage = __va(spgd->pfn << PAGE_SHIFT);
+               /* For each entry in the page, we might need to release it. */
                for (i = 0; i < PTES_PER_PAGE; i++)
                        release_pte(ptepage[i]);
+               /* Now we can free the page of PTEs */
                free_page((long)ptepage);
+               /* And zero out the PGD entry we we never release it twice. */
                spgd->raw.val = 0;
        }
 }
 
+/*H:440 (v) Flushing (thowing away) page tables,
+ *
+ * We saw flush_user_mappings() called when we re-used a top-level pgdir page.
+ * It simply releases every PTE page from 0 up to the kernel address. */
 static void flush_user_mappings(struct lguest *lg, int idx)
 {
        unsigned int i;
+       /* Release every pgd entry up to the kernel's address. */
        for (i = 0; i < vaddr_to_pgd_index(lg->page_offset); i++)
                release_pgd(lg, lg->pgdirs[idx].pgdir + i);
 }
 
+/* The Guest also has a hypercall to do this manually: it's used when a large
+ * number of mappings have been changed. */
 void guest_pagetable_flush_user(struct lguest *lg)
 {
+       /* Drop the userspace part of the current page table. */
        flush_user_mappings(lg, lg->pgdidx);
 }
+/*:*/
 
+/* We keep several page tables.  This is a simple routine to find the page
+ * table (if any) corresponding to this top-level address the Guest has given
+ * us. */
 static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable)
 {
        unsigned int i;
@@ -226,21 +381,30 @@ static unsigned int find_pgdir(struct lguest *lg, unsigned long pgtable)
        return i;
 }
 
+/*H:435 And this is us, creating the new page directory.  If we really do
+ * allocate a new one (and so the kernel parts are not there), we set
+ * blank_pgdir. */
 static unsigned int new_pgdir(struct lguest *lg,
                              unsigned long cr3,
                              int *blank_pgdir)
 {
        unsigned int next;
 
+       /* We pick one entry at random to throw out.  Choosing the Least
+        * Recently Used might be better, but this is easy. */
        next = random32() % ARRAY_SIZE(lg->pgdirs);
+       /* If it's never been allocated at all before, try now. */
        if (!lg->pgdirs[next].pgdir) {
                lg->pgdirs[next].pgdir = (spgd_t *)get_zeroed_page(GFP_KERNEL);
+               /* If the allocation fails, just keep using the one we have */
                if (!lg->pgdirs[next].pgdir)
                        next = lg->pgdidx;
                else
-                       /* There are no mappings: you'll need to re-pin */
+                       /* This is a blank page, so there are no kernel
+                        * mappings: caller must map the stack! */
                        *blank_pgdir = 1;
        }
+       /* Record which Guest toplevel this shadows. */
        lg->pgdirs[next].cr3 = cr3;
        /* Release all the non-kernel mappings. */
        flush_user_mappings(lg, next);
@@ -248,82 +412,161 @@ static unsigned int new_pgdir(struct lguest *lg,
        return next;
 }
 
+/*H:430 (iv) Switching page tables
+ *
+ * This is what happens when the Guest changes page tables (ie. changes the
+ * top-level pgdir).  This happens on almost every context switch. */
 void guest_new_pagetable(struct lguest *lg, unsigned long pgtable)
 {
        int newpgdir, repin = 0;
 
+       /* Look to see if we have this one already. */
        newpgdir = find_pgdir(lg, pgtable);
+       /* If not, we allocate or mug an existing one: if it's a fresh one,
+        * repin gets set to 1. */
        if (newpgdir == ARRAY_SIZE(lg->pgdirs))
                newpgdir = new_pgdir(lg, pgtable, &repin);
+       /* Change the current pgd index to the new one. */
        lg->pgdidx = newpgdir;
+       /* If it was completely blank, we map in the Guest kernel stack */
        if (repin)
                pin_stack_pages(lg);
 }
 
+/*H:470 Finally, a routine which throws away everything: all PGD entries in all
+ * the shadow page tables.  This is used when we destroy the Guest. */
 static void release_all_pagetables(struct lguest *lg)
 {
        unsigned int i, j;
 
+       /* Every shadow pagetable this Guest has */
        for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++)
                if (lg->pgdirs[i].pgdir)
+                       /* Every PGD entry except the Switcher at the top */
                        for (j = 0; j < SWITCHER_PGD_INDEX; j++)
                                release_pgd(lg, lg->pgdirs[i].pgdir + j);
 }
 
+/* We also throw away everything when a Guest tells us it's changed a kernel
+ * mapping.  Since kernel mappings are in every page table, it's easiest to
+ * throw them all away.  This is amazingly slow, but thankfully rare. */
 void guest_pagetable_clear_all(struct lguest *lg)
 {
        release_all_pagetables(lg);
+       /* We need the Guest kernel stack mapped again. */
        pin_stack_pages(lg);
 }
 
+/*H:420 This is the routine which actually sets the page table entry for then
+ * "idx"'th shadow page table.
+ *
+ * Normally, we can just throw out the old entry and replace it with 0: if they
+ * use it demand_page() will put the new entry in.  We need to do this anyway:
+ * The Guest expects _PAGE_ACCESSED to be set on its PTE the first time a page
+ * is read from, and _PAGE_DIRTY when it's written to.
+ *
+ * But Avi Kivity pointed out that most Operating Systems (Linux included) set
+ * these bits on PTEs immediately anyway.  This is done to save the CPU from
+ * having to update them, but it helps us the same way: if they set
+ * _PAGE_ACCESSED then we can put a read-only PTE entry in immediately, and if
+ * they set _PAGE_DIRTY then we can put a writable PTE entry in immediately.
+ */
 static void do_set_pte(struct lguest *lg, int idx,
                       unsigned long vaddr, gpte_t gpte)
 {
+       /* Look up the matching shadow page directot entry. */
        spgd_t *spgd = spgd_addr(lg, idx, vaddr);
+
+       /* If the top level isn't present, there's no entry to update. */
        if (spgd->flags & _PAGE_PRESENT) {
+               /* Otherwise, we start by releasing the existing entry. */
                spte_t *spte = spte_addr(lg, *spgd, vaddr);
                release_pte(*spte);
+
+               /* If they're setting this entry as dirty or accessed, we might
+                * as well put that entry they've given us in now.  This shaves
+                * 10% off a copy-on-write micro-benchmark. */
                if (gpte.flags & (_PAGE_DIRTY | _PAGE_ACCESSED)) {
                        check_gpte(lg, gpte);
                        *spte = gpte_to_spte(lg, gpte, gpte.flags&_PAGE_DIRTY);
                } else
+                       /* Otherwise we can demand_page() it in later. */
                        spte->raw.val = 0;
        }
 }
 
+/*H:410 Updating a PTE entry is a little trickier.
+ *
+ * We keep track of several different page tables (the Guest uses one for each
+ * process, so it makes sense to cache at least a few).  Each of these have
+ * identical kernel parts: ie. every mapping above PAGE_OFFSET is the same for
+ * all processes.  So when the page table above that address changes, we update
+ * all the page tables, not just the current one.  This is rare.
+ *
+ * The benefit is that when we have to track a new page table, we can copy keep
+ * all the kernel mappings.  This speeds up context switch immensely. */
 void guest_set_pte(struct lguest *lg,
                   unsigned long cr3, unsigned long vaddr, gpte_t gpte)
 {
-       /* Kernel mappings must be changed on all top levels. */
+       /* Kernel mappings must be changed on all top levels.  Slow, but
+        * doesn't happen often. */
        if (vaddr >= lg->page_offset) {
                unsigned int i;
                for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++)
                        if (lg->pgdirs[i].pgdir)
                                do_set_pte(lg, i, vaddr, gpte);
        } else {
+               /* Is this page table one we have a shadow for? */
                int pgdir = find_pgdir(lg, cr3);
                if (pgdir != ARRAY_SIZE(lg->pgdirs))
+                       /* If so, do the update. */
                        do_set_pte(lg, pgdir, vaddr, gpte);
        }
 }
 
+/*H:400
+ * (iii) Setting up a page table entry when the Guest tells us it has changed.
+ *
+ * Just like we did in interrupts_and_traps.c, it makes sense for us to deal
+ * with the other side of page tables while we're here: what happens when the
+ * Guest asks for a page table to be updated?
+ *
+ * We already saw that demand_page() will fill in the shadow page tables when
+ * needed, so we can simply remove shadow page table entries whenever the Guest
+ * tells us they've changed.  When the Guest tries to use the new entry it will
+ * fault and demand_page() will fix it up.
+ *
+ * So with that in mind here's our code to to update a (top-level) PGD entry:
+ */
 void guest_set_pmd(struct lguest *lg, unsigned long cr3, u32 idx)
 {
        int pgdir;
 
+       /* The kernel seems to try to initialize this early on: we ignore its
+        * attempts to map over the Switcher. */
        if (idx >= SWITCHER_PGD_INDEX)
                return;
 
+       /* If they're talking about a page table we have a shadow for... */
        pgdir = find_pgdir(lg, cr3);
        if (pgdir < ARRAY_SIZE(lg->pgdirs))
+               /* ... throw it away. */
                release_pgd(lg, lg->pgdirs[pgdir].pgdir + idx);
 }
 
+/*H:500 (vii) Setting up the page tables initially.
+ *
+ * When a Guest is first created, the Launcher tells us where the toplevel of
+ * its first page table is.  We set some things up here: */
 int init_guest_pagetable(struct lguest *lg, unsigned long pgtable)
 {
-       /* We assume this in flush_user_mappings, so check now */
+       /* In flush_user_mappings() we loop from 0 to
+        * "vaddr_to_pgd_index(lg->page_offset)".  This assumes it won't hit
+        * the Switcher mappings, so check that now. */
        if (vaddr_to_pgd_index(lg->page_offset) >= SWITCHER_PGD_INDEX)
                return -EINVAL;
+       /* We start on the first shadow page table, and give it a blank PGD
+        * page. */
        lg->pgdidx = 0;
        lg->pgdirs[lg->pgdidx].cr3 = pgtable;
        lg->pgdirs[lg->pgdidx].pgdir = (spgd_t*)get_zeroed_page(GFP_KERNEL);
@@ -332,33 +575,48 @@ int init_guest_pagetable(struct lguest *lg, unsigned long pgtable)
        return 0;
 }
 
+/* When a Guest dies, our cleanup is fairly simple. */
 void free_guest_pagetable(struct lguest *lg)
 {
        unsigned int i;
 
+       /* Throw away all page table pages. */
        release_all_pagetables(lg);
+       /* Now free the top levels: free_page() can handle 0 just fine. */
        for (i = 0; i < ARRAY_SIZE(lg->pgdirs); i++)
                free_page((long)lg->pgdirs[i].pgdir);
 }
 
-/* Caller must be preempt-safe */
+/*H:480 (vi) Mapping the Switcher when the Guest is about to run.
+ *
+ * The Switcher and the two pages for this CPU need to be available to the
+ * Guest (and not the pages for other CPUs).  We have the appropriate PTE pages
+ * for each CPU already set up, we just need to hook them in. */
 void map_switcher_in_guest(struct lguest *lg, struct lguest_pages *pages)
 {
        spte_t *switcher_pte_page = __get_cpu_var(switcher_pte_pages);
        spgd_t switcher_pgd;
        spte_t regs_pte;
 
-       /* Since switcher less that 4MB, we simply mug top pte page. */
+       /* Make the last PGD entry for this Guest point to the Switcher's PTE
+        * page for this CPU (with appropriate flags). */
        switcher_pgd.pfn = __pa(switcher_pte_page) >> PAGE_SHIFT;
        switcher_pgd.flags = _PAGE_KERNEL;
        lg->pgdirs[lg->pgdidx].pgdir[SWITCHER_PGD_INDEX] = switcher_pgd;
 
-       /* Map our regs page over stack page. */
+       /* We also change the Switcher PTE page.  When we're running the Guest,
+        * we want the Guest's "regs" page to appear where the first Switcher
+        * page for this CPU is.  This is an optimization: when the Switcher
+        * saves the Guest registers, it saves them into the first page of this
+        * CPU's "struct lguest_pages": if we make sure the Guest's register
+        * page is already mapped there, we don't have to copy them out
+        * again. */
        regs_pte.pfn = __pa(lg->regs_page) >> PAGE_SHIFT;
        regs_pte.flags = _PAGE_KERNEL;
        switcher_pte_page[(unsigned long)pages/PAGE_SIZE%PTES_PER_PAGE]
                = regs_pte;
 }
+/*:*/
 
 static void free_switcher_pte_pages(void)
 {
@@ -368,6 +626,10 @@ static void free_switcher_pte_pages(void)
                free_page((long)switcher_pte_page(i));
 }
 
+/*H:520 Setting up the Switcher PTE page for given CPU is fairly easy, given
+ * the CPU number and the "struct page"s for the Switcher code itself.
+ *
+ * Currently the Switcher is less than a page long, so "pages" is always 1. */
 static __init void populate_switcher_pte_page(unsigned int cpu,
                                              struct page *switcher_page[],
                                              unsigned int pages)
@@ -375,21 +637,26 @@ static __init void populate_switcher_pte_page(unsigned int cpu,
        unsigned int i;
        spte_t *pte = switcher_pte_page(cpu);
 
+       /* The first entries are easy: they map the Switcher code. */
        for (i = 0; i < pages; i++) {
                pte[i].pfn = page_to_pfn(switcher_page[i]);
                pte[i].flags = _PAGE_PRESENT|_PAGE_ACCESSED;
        }
 
-       /* We only map this CPU's pages, so guest can't see others. */
+       /* The only other thing we map is this CPU's pair of pages. */
        i = pages + cpu*2;
 
-       /* First page (regs) is rw, second (state) is ro. */
+       /* First page (Guest registers) is writable from the Guest */
        pte[i].pfn = page_to_pfn(switcher_page[i]);
        pte[i].flags = _PAGE_PRESENT|_PAGE_ACCESSED|_PAGE_RW;
+       /* The second page contains the "struct lguest_ro_state", and is
+        * read-only. */
        pte[i+1].pfn = page_to_pfn(switcher_page[i+1]);
        pte[i+1].flags = _PAGE_PRESENT|_PAGE_ACCESSED;
 }
 
+/*H:510 At boot or module load time, init_pagetables() allocates and populates
+ * the Switcher PTE page for each CPU. */
 __init int init_pagetables(struct page **switcher_page, unsigned int pages)
 {
        unsigned int i;
@@ -404,7 +671,9 @@ __init int init_pagetables(struct page **switcher_page, unsigned int pages)
        }
        return 0;
 }
+/*:*/
 
+/* Cleaning up simply involves freeing the PTE page for each CPU. */
 void free_pagetables(void)
 {
        free_switcher_pte_pages();
index 1b2cfe89dcd568546bfd93d4e780794759914d94..9b81119f46e937ce9b9639fe4e74f65139288a51 100644 (file)
@@ -1,16 +1,52 @@
+/*P:600 The x86 architecture has segments, which involve a table of descriptors
+ * which can be used to do funky things with virtual address interpretation.
+ * We originally used to use segments so the Guest couldn't alter the
+ * Guest<->Host Switcher, and then we had to trim Guest segments, and restore
+ * for userspace per-thread segments, but trim again for on userspace->kernel
+ * transitions...  This nightmarish creation was contained within this file,
+ * where we knew not to tread without heavy armament and a change of underwear.
+ *
+ * In these modern times, the segment handling code consists of simple sanity
+ * checks, and the worst you'll experience reading this code is butterfly-rash
+ * from frolicking through its parklike serenity. :*/
 #include "lg.h"
 
-static int desc_ok(const struct desc_struct *gdt)
-{
-       /* MBZ=0, P=1, DT=1  */
-       return ((gdt->b & 0x00209000) == 0x00009000);
-}
-
-static int segment_present(const struct desc_struct *gdt)
-{
-       return gdt->b & 0x8000;
-}
-
+/*H:600
+ * We've almost completed the Host; there's just one file to go!
+ *
+ * Segments & The Global Descriptor Table
+ *
+ * (That title sounds like a bad Nerdcore group.  Not to suggest that there are
+ * any good Nerdcore groups, but in high school a friend of mine had a band
+ * called Joe Fish and the Chips, so there are definitely worse band names).
+ *
+ * To refresh: the GDT is a table of 8-byte values describing segments.  Once
+ * set up, these segments can be loaded into one of the 6 "segment registers".
+ *
+ * GDT entries are passed around as "struct desc_struct"s, which like IDT
+ * entries are split into two 32-bit members, "a" and "b".  One day, someone
+ * will clean that up, and be declared a Hero.  (No pressure, I'm just saying).
+ *
+ * Anyway, the GDT entry contains a base (the start address of the segment), a
+ * limit (the size of the segment - 1), and some flags.  Sounds simple, and it
+ * would be, except those zany Intel engineers decided that it was too boring
+ * to put the base at one end, the limit at the other, and the flags in
+ * between.  They decided to shotgun the bits at random throughout the 8 bytes,
+ * like so:
+ *
+ * 0               16                     40       48  52  56     63
+ * [ limit part 1 ][     base part 1     ][ flags ][li][fl][base ]
+ *                                                  mit ags part 2
+ *                                                part 2
+ *
+ * As a result, this file contains a certain amount of magic numeracy.  Let's
+ * begin.
+ */
+
+/* There are several entries we don't let the Guest set.  The TSS entry is the
+ * "Task State Segment" which controls all kinds of delicate things.  The
+ * LGUEST_CS and LGUEST_DS entries are reserved for the Switcher, and the
+ * the Guest can't be trusted to deal with double faults. */
 static int ignored_gdt(unsigned int num)
 {
        return (num == GDT_ENTRY_TSS
@@ -19,75 +55,72 @@ static int ignored_gdt(unsigned int num)
                || num == GDT_ENTRY_DOUBLEFAULT_TSS);
 }
 
-/* We don't allow removal of CS, DS or SS; it doesn't make sense. */
-static void check_segment_use(struct lguest *lg, unsigned int desc)
-{
-       if (lg->regs->gs / 8 == desc)
-               lg->regs->gs = 0;
-       if (lg->regs->fs / 8 == desc)
-               lg->regs->fs = 0;
-       if (lg->regs->es / 8 == desc)
-               lg->regs->es = 0;
-       if (lg->regs->ds / 8 == desc
-           || lg->regs->cs / 8 == desc
-           || lg->regs->ss / 8 == desc)
-               kill_guest(lg, "Removed live GDT entry %u", desc);
-}
-
+/*H:610 Once the GDT has been changed, we fix the new entries up a little.  We
+ * don't care if they're invalid: the worst that can happen is a General
+ * Protection Fault in the Switcher when it restores a Guest segment register
+ * which tries to use that entry.  Then we kill the Guest for causing such a
+ * mess: the message will be "unhandled trap 256". */
 static void fixup_gdt_table(struct lguest *lg, unsigned start, unsigned end)
 {
        unsigned int i;
 
        for (i = start; i < end; i++) {
-               /* We never copy these ones to real gdt */
+               /* We never copy these ones to real GDT, so we don't care what
+                * they say */
                if (ignored_gdt(i))
                        continue;
 
-               /* We could fault in switch_to_guest if they are using
-                * a removed segment. */
-               if (!segment_present(&lg->gdt[i])) {
-                       check_segment_use(lg, i);
-                       continue;
-               }
-
-               if (!desc_ok(&lg->gdt[i]))
-                       kill_guest(lg, "Bad GDT descriptor %i", i);
-
-               /* DPL 0 presumably means "for use by guest". */
+               /* Segment descriptors contain a privilege level: the Guest is
+                * sometimes careless and leaves this as 0, even though it's
+                * running at privilege level 1.  If so, we fix it here. */
                if ((lg->gdt[i].b & 0x00006000) == 0)
                        lg->gdt[i].b |= (GUEST_PL << 13);
 
-               /* Set accessed bit, since gdt isn't writable. */
+               /* Each descriptor has an "accessed" bit.  If we don't set it
+                * now, the CPU will try to set it when the Guest first loads
+                * that entry into a segment register.  But the GDT isn't
+                * writable by the Guest, so bad things can happen. */
                lg->gdt[i].b |= 0x00000100;
        }
 }
 
+/* This routine is called at boot or modprobe time for each CPU to set up the
+ * "constant" GDT entries for Guests running on that CPU. */
 void setup_default_gdt_entries(struct lguest_ro_state *state)
 {
        struct desc_struct *gdt = state->guest_gdt;
        unsigned long tss = (unsigned long)&state->guest_tss;
 
-       /* Hypervisor segments. */
+       /* The hypervisor segments are full 0-4G segments, privilege level 0 */
        gdt[GDT_ENTRY_LGUEST_CS] = FULL_EXEC_SEGMENT;
        gdt[GDT_ENTRY_LGUEST_DS] = FULL_SEGMENT;
 
-       /* This is the one which we *cannot* copy from guest, since tss
-          is depended on this lguest_ro_state, ie. this cpu. */
+       /* The TSS segment refers to the TSS entry for this CPU, so we cannot
+        * copy it from the Guest.  Forgive the magic flags */
        gdt[GDT_ENTRY_TSS].a = 0x00000067 | (tss << 16);
        gdt[GDT_ENTRY_TSS].b = 0x00008900 | (tss & 0xFF000000)
                | ((tss >> 16) & 0x000000FF);
 }
 
+/* This routine is called before the Guest is run for the first time. */
 void setup_guest_gdt(struct lguest *lg)
 {
+       /* Start with full 0-4G segments... */
        lg->gdt[GDT_ENTRY_KERNEL_CS] = FULL_EXEC_SEGMENT;
        lg->gdt[GDT_ENTRY_KERNEL_DS] = FULL_SEGMENT;
+       /* ...except the Guest is allowed to use them, so set the privilege
+        * level appropriately in the flags. */
        lg->gdt[GDT_ENTRY_KERNEL_CS].b |= (GUEST_PL << 13);
        lg->gdt[GDT_ENTRY_KERNEL_DS].b |= (GUEST_PL << 13);
 }
 
-/* This is a fast version for the common case where only the three TLS entries
- * have changed. */
+/* Like the IDT, we never simply use the GDT the Guest gives us.  We set up the
+ * GDTs for each CPU, then we copy across the entries each time we want to run
+ * a different Guest on that CPU. */
+
+/* A partial GDT load, for the three "thead-local storage" entries.  Otherwise
+ * it's just like load_guest_gdt().  So much, in fact, it would probably be
+ * neater to have a single hypercall to cover both. */
 void copy_gdt_tls(const struct lguest *lg, struct desc_struct *gdt)
 {
        unsigned int i;
@@ -96,22 +129,31 @@ void copy_gdt_tls(const struct lguest *lg, struct desc_struct *gdt)
                gdt[i] = lg->gdt[i];
 }
 
+/* This is the full version */
 void copy_gdt(const struct lguest *lg, struct desc_struct *gdt)
 {
        unsigned int i;
 
+       /* The default entries from setup_default_gdt_entries() are not
+        * replaced.  See ignored_gdt() above. */
        for (i = 0; i < GDT_ENTRIES; i++)
                if (!ignored_gdt(i))
                        gdt[i] = lg->gdt[i];
 }
 
+/* This is where the Guest asks us to load a new GDT (LHCALL_LOAD_GDT). */
 void load_guest_gdt(struct lguest *lg, unsigned long table, u32 num)
 {
+       /* We assume the Guest has the same number of GDT entries as the
+        * Host, otherwise we'd have to dynamically allocate the Guest GDT. */
        if (num > ARRAY_SIZE(lg->gdt))
                kill_guest(lg, "too many gdt entries %i", num);
 
+       /* We read the whole thing in, then fix it up. */
        lgread(lg, lg->gdt, table, num * sizeof(lg->gdt[0]));
        fixup_gdt_table(lg, 0, ARRAY_SIZE(lg->gdt));
+       /* Mark that the GDT changed so the core knows it has to copy it again,
+        * even if the Guest is run on the same CPU. */
        lg->changed |= CHANGED_GDT;
 }
 
@@ -123,3 +165,13 @@ void guest_load_tls(struct lguest *lg, unsigned long gtls)
        fixup_gdt_table(lg, GDT_ENTRY_TLS_MIN, GDT_ENTRY_TLS_MAX+1);
        lg->changed |= CHANGED_GDT_TLS;
 }
+
+/*
+ * With this, we have finished the Host.
+ *
+ * Five of the seven parts of our task are complete.  You have made it through
+ * the Bit of Despair (I think that's somewhere in the page table code,
+ * myself).
+ *
+ * Next, we examine "make Switcher".  It's short, but intense.
+ */
index eadd4cc299d2c80f64b807a7d86fc2d9f560699c..7c9c230cc845f184973e6eebea5beb9a41568735 100644 (file)
-/* This code sits at 0xFFC00000 to do the low-level guest<->host switch.
+/*P:900 This is the Switcher: code which sits at 0xFFC00000 to do the low-level
+ * Guest<->Host switch.  It is as simple as it can be made, but it's naturally
+ * very specific to x86.
+ *
+ * You have now completed Preparation.  If this has whet your appetite; if you
+ * are feeling invigorated and refreshed then the next, more challenging stage
+ * can be found in "make Guest". :*/
 
-   There is are two pages above us for this CPU (struct lguest_pages).
-   The second page (struct lguest_ro_state) becomes read-only after the
-   context switch.  The first page (the stack for traps) remains writable,
-   but while we're in here, the guest cannot be running.
-*/
+/*S:100
+ * Welcome to the Switcher itself!
+ *
+ * This file contains the low-level code which changes the CPU to run the Guest
+ * code, and returns to the Host when something happens.  Understand this, and
+ * you understand the heart of our journey.
+ *
+ * Because this is in assembler rather than C, our tale switches from prose to
+ * verse.  First I tried limericks:
+ *
+ *     There once was an eax reg,
+ *     To which our pointer was fed,
+ *     It needed an add,
+ *     Which asm-offsets.h had
+ *     But this limerick is hurting my head.
+ *
+ * Next I tried haikus, but fitting the required reference to the seasons in
+ * every stanza was quickly becoming tiresome:
+ *
+ *     The %eax reg
+ *     Holds "struct lguest_pages" now:
+ *     Cherry blossoms fall.
+ *
+ * Then I started with Heroic Verse, but the rhyming requirement leeched away
+ * the content density and led to some uniquely awful oblique rhymes:
+ *
+ *     These constants are coming from struct offsets
+ *     For use within the asm switcher text.
+ *
+ * Finally, I settled for something between heroic hexameter, and normal prose
+ * with inappropriate linebreaks.  Anyway, it aint no Shakespeare.
+ */
+
+// Not all kernel headers work from assembler
+// But these ones are needed: the ENTRY() define
+// And constants extracted from struct offsets
+// To avoid magic numbers and breakage:
+// Should they change the compiler can't save us
+// Down here in the depths of assembler code.
 #include <linux/linkage.h>
 #include <asm/asm-offsets.h>
+#include <asm/page.h>
 #include "lg.h"
 
+// We mark the start of the code to copy
+// It's placed in .text tho it's never run here
+// You'll see the trick macro at the end
+// Which interleaves data and text to effect.
 .text
 ENTRY(start_switcher_text)
 
-/* %eax points to lguest pages for this CPU.  %ebx contains cr3 value.
-   All normal registers can be clobbered! */
+// When we reach switch_to_guest we have just left
+// The safe and comforting shores of C code
+// %eax has the "struct lguest_pages" to use
+// Where we save state and still see it from the Guest
+// And %ebx holds the Guest shadow pagetable:
+// Once set we have truly left Host behind.
 ENTRY(switch_to_guest)
-       /* Save host segments on host stack. */
+       // We told gcc all its regs could fade,
+       // Clobbered by our journey into the Guest
+       // We could have saved them, if we tried
+       // But time is our master and cycles count.
+
+       // Segment registers must be saved for the Host
+       // We push them on the Host stack for later
        pushl   %es
        pushl   %ds
        pushl   %gs
        pushl   %fs
-       /* With CONFIG_FRAME_POINTER, gcc doesn't let us clobber this! */
+       // But the compiler is fickle, and heeds
+       // No warning of %ebp clobbers
+       // When frame pointers are used.  That register
+       // Must be saved and restored or chaos strikes.
        pushl   %ebp
-       /* Save host stack. */
+       // The Host's stack is done, now save it away
+       // In our "struct lguest_pages" at offset
+       // Distilled into asm-offsets.h
        movl    %esp, LGUEST_PAGES_host_sp(%eax)
-       /* Switch to guest stack: if we get NMI we expect to be there. */
+
+       // All saved and there's now five steps before us:
+       // Stack, GDT, IDT, TSS
+       // And last of all the page tables are flipped.
+
+       // Yet beware that our stack pointer must be
+       // Always valid lest an NMI hits
+       // %edx does the duty here as we juggle
+       // %eax is lguest_pages: our stack lies within.
        movl    %eax, %edx
        addl    $LGUEST_PAGES_regs, %edx
        movl    %edx, %esp
-       /* Switch to guest's GDT, IDT. */
+
+       // The Guest's GDT we so carefully
+       // Placed in the "struct lguest_pages" before
        lgdt    LGUEST_PAGES_guest_gdt_desc(%eax)
+
+       // The Guest's IDT we did partially
+       // Move to the "struct lguest_pages" as well.
        lidt    LGUEST_PAGES_guest_idt_desc(%eax)
-       /* Switch to guest's TSS while GDT still writable. */
+
+       // The TSS entry which controls traps
+       // Must be loaded up with "ltr" now:
+       // For after we switch over our page tables
+       // It (as the rest) will be writable no more.
+       // (The GDT entry TSS needs
+       // Changes type when we load it: damn Intel!)
        movl    $(GDT_ENTRY_TSS*8), %edx
        ltr     %dx
-       /* Set host's TSS GDT entry to available (clear byte 5 bit 2). */
+
+       // Look back now, before we take this last step!
+       // The Host's TSS entry was also marked used;
+       // Let's clear it again, ere we return.
+       // The GDT descriptor of the Host
+       // Points to the table after two "size" bytes
        movl    (LGUEST_PAGES_host_gdt_desc+2)(%eax), %edx
+       // Clear the type field of "used" (byte 5, bit 2)
        andb    $0xFD, (GDT_ENTRY_TSS*8 + 5)(%edx)
-       /* Switch to guest page tables: lguest_pages->state now read-only. */
+
+       // Once our page table's switched, the Guest is live!
+       // The Host fades as we run this final step.
+       // Our "struct lguest_pages" is now read-only.
        movl    %ebx, %cr3
-       /* Restore guest regs */
+
+       // The page table change did one tricky thing:
+       // The Guest's register page has been mapped
+       // Writable onto our %esp (stack) --
+       // We can simply pop off all Guest regs.
        popl    %ebx
        popl    %ecx
        popl    %edx
@@ -51,12 +143,27 @@ ENTRY(switch_to_guest)
        popl    %fs
        popl    %ds
        popl    %es
-       /* Skip error code and trap number */
+
+       // Near the base of the stack lurk two strange fields
+       // Which we fill as we exit the Guest
+       // These are the trap number and its error
+       // We can simply step past them on our way.
        addl    $8, %esp
+
+       // The last five stack slots hold return address
+       // And everything needed to change privilege
+       // Into the Guest privilege level of 1,
+       // And the stack where the Guest had last left it.
+       // Interrupts are turned back on: we are Guest.
        iret
 
+// There are two paths where we switch to the Host
+// So we put the routine in a macro.
+// We are on our way home, back to the Host
+// Interrupted out of the Guest, we come here.
 #define SWITCH_TO_HOST                                                 \
-       /* Save guest state */                                          \
+       /* We save the Guest state: all registers first                 \
+        * Laid out just as "struct lguest_regs" defines */             \
        pushl   %es;                                                    \
        pushl   %ds;                                                    \
        pushl   %fs;                                                    \
@@ -68,58 +175,121 @@ ENTRY(switch_to_guest)
        pushl   %edx;                                                   \
        pushl   %ecx;                                                   \
        pushl   %ebx;                                                   \
-       /* Load lguest ds segment for convenience. */                   \
+       /* Our stack and our code are using segments                    \
+        * Set in the TSS and IDT                                       \
+        * Yet if we were to touch data we'd use                        \
+        * Whatever data segment the Guest had.                         \
+        * Load the lguest ds segment for now. */                       \
        movl    $(LGUEST_DS), %eax;                                     \
        movl    %eax, %ds;                                              \
-       /* Figure out where we are, based on stack (at top of regs). */ \
+       /* So where are we?  Which CPU, which struct?                   \
+        * The stack is our clue: our TSS starts                        \
+        * It at the end of "struct lguest_pages".                      \
+        * Or we may have stumbled while restoring                      \
+        * Our Guest segment regs while in switch_to_guest,             \
+        * The fault pushed atop that part-unwound stack.               \
+        * If we round the stack down to the page start                 \
+        * We're at the start of "struct lguest_pages". */              \
        movl    %esp, %eax;                                             \
-       subl    $LGUEST_PAGES_regs, %eax;                               \
-       /* Put trap number in %ebx before we switch cr3 and lose it. */ \
+       andl    $(~(1 << PAGE_SHIFT - 1)), %eax;                        \
+       /* Save our trap number: the switch will obscure it             \
+        * (The Guest regs are not mapped here in the Host)             \
+        * %ebx holds it safe for deliver_to_host */                    \
        movl    LGUEST_PAGES_regs_trapnum(%eax), %ebx;                  \
-       /* Switch to host page tables (host GDT, IDT and stack are in host   \
-          mem, so need this first) */                                  \
+       /* The Host GDT, IDT and stack!                                 \
+        * All these lie safely hidden from the Guest:                  \
+        * We must return to the Host page tables                       \
+        * (Hence that was saved in struct lguest_pages) */             \
        movl    LGUEST_PAGES_host_cr3(%eax), %edx;                      \
        movl    %edx, %cr3;                                             \
-       /* Set guest's TSS to available (clear byte 5 bit 2). */        \
+       /* As before, when we looked back at the Host                   \
+        * As we left and marked TSS unused                             \
+        * So must we now for the Guest left behind. */                 \
        andb    $0xFD, (LGUEST_PAGES_guest_gdt+GDT_ENTRY_TSS*8+5)(%eax); \
-       /* Switch to host's GDT & IDT. */                               \
+       /* Switch to Host's GDT, IDT. */                                \
        lgdt    LGUEST_PAGES_host_gdt_desc(%eax);                       \
        lidt    LGUEST_PAGES_host_idt_desc(%eax);                       \
-       /* Switch to host's stack. */                                   \
+       /* Restore the Host's stack where it's saved regs lie */        \
        movl    LGUEST_PAGES_host_sp(%eax), %esp;                       \
-       /* Switch to host's TSS */                                      \
+       /* Last the TSS: our Host is complete */                        \
        movl    $(GDT_ENTRY_TSS*8), %edx;                               \
        ltr     %dx;                                                    \
+       /* Restore now the regs saved right at the first. */            \
        popl    %ebp;                                                   \
        popl    %fs;                                                    \
        popl    %gs;                                                    \
        popl    %ds;                                                    \
        popl    %es
 
-/* Return to run_guest_once. */
+// Here's where we come when the Guest has just trapped:
+// (Which trap we'll see has been pushed on the stack).
+// We need only switch back, and the Host will decode
+// Why we came home, and what needs to be done.
 return_to_host:
        SWITCH_TO_HOST
        iret
 
+// An interrupt, with some cause external
+// Has ajerked us rudely from the Guest's code
+// Again we must return home to the Host
 deliver_to_host:
        SWITCH_TO_HOST
-       /* Decode IDT and jump to hosts' irq handler.  When that does iret, it
-        * will return to run_guest_once.  This is a feature. */
+       // But now we must go home via that place
+       // Where that interrupt was supposed to go
+       // Had we not been ensconced, running the Guest.
+       // Here we see the cleverness of our stack:
+       // The Host stack is formed like an interrupt
+       // With EIP, CS and EFLAGS layered.
+       // Interrupt handlers end with "iret"
+       // And that will take us home at long long last.
+
+       // But first we must find the handler to call!
+       // The IDT descriptor for the Host
+       // Has two bytes for size, and four for address:
+       // %edx will hold it for us for now.
        movl    (LGUEST_PAGES_host_idt_desc+2)(%eax), %edx
+       // We now know the table address we need,
+       // And saved the trap's number inside %ebx.
+       // Yet the pointer to the handler is smeared
+       // Across the bits of the table entry.
+       // What oracle can tell us how to extract
+       // From such a convoluted encoding?
+       // I consulted gcc, and it gave
+       // These instructions, which I gladly credit:
        leal    (%edx,%ebx,8), %eax
        movzwl  (%eax),%edx
        movl    4(%eax), %eax
        xorw    %ax, %ax
        orl     %eax, %edx
+       // Now the address of the handler's in %edx
+       // We call it now: its "iret" takes us home.
        jmp     *%edx
 
-/* Real hardware interrupts are delivered straight to the host.  Others
-   cause us to return to run_guest_once so it can decide what to do.  Note
-   that some of these are overridden by the guest to deliver directly, and
-   never enter here (see load_guest_idt_entry). */
+// Every interrupt can come to us here
+// But we must truly tell each apart.
+// They number two hundred and fifty six
+// And each must land in a different spot,
+// Push its number on stack, and join the stream.
+
+// And worse, a mere six of the traps stand apart
+// And push on their stack an addition:
+// An error number, thirty two bits long
+// So we punish the other two fifty
+// And make them push a zero so they match.
+
+// Yet two fifty six entries is long
+// And all will look most the same as the last
+// So we create a macro which can make
+// As many entries as we need to fill.
+
+// Note the change to .data then .text:
+// We plant the address of each entry
+// Into a (data) table for the Host
+// To know where each Guest interrupt should go.
 .macro IRQ_STUB N TARGET
        .data; .long 1f; .text; 1:
- /* Make an error number for most traps, which don't have one. */
+ // Trap eight, ten through fourteen and seventeen
+ // Supply an error number.  Else zero.
  .if (\N <> 8) && (\N < 10 || \N > 14) && (\N <> 17)
        pushl   $0
  .endif
@@ -128,6 +298,8 @@ deliver_to_host:
        ALIGN
 .endm
 
+// This macro creates numerous entries
+// Using GAS macros which out-power C's.
 .macro IRQ_STUBS FIRST LAST TARGET
  irq=\FIRST
  .rept \LAST-\FIRST+1
@@ -136,24 +308,43 @@ deliver_to_host:
  .endr
 .endm
 
-/* We intercept every interrupt, because we may need to switch back to
- * host.  Unfortunately we can't tell them apart except by entry
- * point, so we need 256 entry points.
- */
+// Here's the marker for our pointer table
+// Laid in the data section just before
+// Each macro places the address of code
+// Forming an array: each one points to text
+// Which handles interrupt in its turn.
 .data
 .global default_idt_entries
 default_idt_entries:
 .text
-       IRQ_STUBS 0 1 return_to_host            /* First two traps */
-       IRQ_STUB 2 handle_nmi                   /* NMI */
-       IRQ_STUBS 3 31 return_to_host           /* Rest of traps */
-       IRQ_STUBS 32 127 deliver_to_host        /* Real interrupts */
-       IRQ_STUB 128 return_to_host             /* System call (overridden) */
-       IRQ_STUBS 129 255 deliver_to_host       /* Other real interrupts */
-
-/* We ignore NMI and return. */
+       // The first two traps go straight back to the Host
+       IRQ_STUBS 0 1 return_to_host
+       // We'll say nothing, yet, about NMI
+       IRQ_STUB 2 handle_nmi
+       // Other traps also return to the Host
+       IRQ_STUBS 3 31 return_to_host
+       // All interrupts go via their handlers
+       IRQ_STUBS 32 127 deliver_to_host
+       // 'Cept system calls coming from userspace
+       // Are to go to the Guest, never the Host.
+       IRQ_STUB 128 return_to_host
+       IRQ_STUBS 129 255 deliver_to_host
+
+// The NMI, what a fabulous beast
+// Which swoops in and stops us no matter that
+// We're suspended between heaven and hell,
+// (Or more likely between the Host and Guest)
+// When in it comes!  We are dazed and confused
+// So we do the simplest thing which one can.
+// Though we've pushed the trap number and zero
+// We discard them, return, and hope we live.
 handle_nmi:
        addl    $8, %esp
        iret
 
+// We are done; all that's left is Mastery
+// And "make Mastery" is a journey long
+// Designed to make your fingers itch to code.
+
+// Here ends the text, the file and poem.
 ENTRY(end_switcher_text)
index 141ff9fa296e2a429436e1c402ef330df0c89cac..2120155929a6d0d860e4dffb78c2395cfcffdaa2 100644 (file)
@@ -580,8 +580,8 @@ static void __map_bio(struct dm_target *ti, struct bio *clone,
                /* the bio has been remapped so dispatch it */
 
                blk_add_trace_remap(bdev_get_queue(clone->bi_bdev), clone,
-                                   tio->io->bio->bi_bdev->bd_dev, sector,
-                                   clone->bi_sector);
+                                   tio->io->bio->bi_bdev->bd_dev,
+                                   clone->bi_sector, sector);
 
                generic_make_request(clone);
        } else if (r < 0 || r == DM_MAPIO_REQUEUE) {
index f730a144baf12339fceba31c04e0f54819a7000d..4e53792aa520b8c5fc0aa18df1266dae15d998bf 100644 (file)
@@ -917,6 +917,13 @@ static int make_request(struct request_queue *q, struct bio * bio)
                bio_list_add(&bl, mbio);
        }
 
+       if (unlikely(!atomic_read(&r10_bio->remaining))) {
+               /* the array is dead */
+               md_write_end(mddev);
+               raid_end_bio_io(r10_bio);
+               return 0;
+       }
+
        bitmap_startwrite(mddev->bitmap, bio->bi_sector, r10_bio->sectors, 0);
        spin_lock_irqsave(&conf->device_lock, flags);
        bio_list_merge(&conf->pending_bio_list, &bl);
@@ -1557,7 +1564,6 @@ static void raid10d(mddev_t *mddev)
                        bio = r10_bio->devs[r10_bio->read_slot].bio;
                        r10_bio->devs[r10_bio->read_slot].bio =
                                mddev->ro ? IO_BLOCKED : NULL;
-                       bio_put(bio);
                        mirror = read_balance(conf, r10_bio);
                        if (mirror == -1) {
                                printk(KERN_ALERT "raid10: %s: unrecoverable I/O"
@@ -1565,8 +1571,10 @@ static void raid10d(mddev_t *mddev)
                                       bdevname(bio->bi_bdev,b),
                                       (unsigned long long)r10_bio->sector);
                                raid_end_bio_io(r10_bio);
+                               bio_put(bio);
                        } else {
                                const int do_sync = bio_sync(r10_bio->master_bio);
+                               bio_put(bio);
                                rdev = conf->mirrors[mirror].rdev;
                                if (printk_ratelimit())
                                        printk(KERN_ERR "raid10: %s: redirecting sector %llu to"
index 7195c9461524bb1507bac6ff8015a5097642c650..b1a9c4cdec93ee27f8eec60f6f7dcf5774836c4e 100644 (file)
@@ -29,8 +29,6 @@
 
 struct af9005_fe_state {
        struct dvb_usb_device *d;
-       struct dvb_frontend *tuner;
-
        fe_status_t stat;
 
        /* retraining parameters */
@@ -345,8 +343,8 @@ static int af9005_reset_pre_viterbi(struct dvb_frontend *fe)
                                       1 & 0xff);
        if (ret)
                return ret;
-       af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8,
-                                  1 >> 8);
+       ret = af9005_write_ofdm_register(state->d, xd_p_fec_super_frm_unit_15_8,
+                                        1 >> 8);
        if (ret)
                return ret;
        /* reset pre viterbi error count */
@@ -447,7 +445,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat)
        u8 temp;
        int ret;
 
-       if (state->tuner == NULL)
+       if (fe->ops.tuner_ops.release == NULL)
                return -ENODEV;
 
        *stat = 0;
@@ -493,7 +491,7 @@ static int af9005_fe_read_status(struct dvb_frontend *fe, fe_status_t * stat)
 static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber)
 {
        struct af9005_fe_state *state = fe->demodulator_priv;
-       if (state->tuner == NULL)
+       if (fe->ops.tuner_ops.release  == NULL)
                return -ENODEV;
        af9005_fe_refresh_state(fe);
        *ber = state->ber;
@@ -503,7 +501,7 @@ static int af9005_fe_read_ber(struct dvb_frontend *fe, u32 * ber)
 static int af9005_fe_read_unc_blocks(struct dvb_frontend *fe, u32 * unc)
 {
        struct af9005_fe_state *state = fe->demodulator_priv;
-       if (state->tuner == NULL)
+       if (fe->ops.tuner_ops.release == NULL)
                return -ENODEV;
        af9005_fe_refresh_state(fe);
        *unc = state->unc;
@@ -517,7 +515,7 @@ static int af9005_fe_read_signal_strength(struct dvb_frontend *fe,
        int ret;
        u8 if_gain, rf_gain;
 
-       if (state->tuner == NULL)
+       if (fe->ops.tuner_ops.release == NULL)
                return -ENODEV;
        ret =
            af9005_read_ofdm_register(state->d, xd_r_reg_aagc_rf_gain,
@@ -881,10 +879,8 @@ static int af9005_fe_init(struct dvb_frontend *fe)
             af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst,
                                        reg_ofdm_rst_pos, reg_ofdm_rst_len, 1)))
                return ret;
-       if ((ret =
-            af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst,
-                                       reg_ofdm_rst_pos, reg_ofdm_rst_len, 0)))
-               return ret;
+       ret = af9005_write_register_bits(state->d, xd_I2C_reg_ofdm_rst,
+                                        reg_ofdm_rst_pos, reg_ofdm_rst_len, 0);
 
        if (ret)
                return ret;
@@ -1041,7 +1037,7 @@ static int af9005_fe_init(struct dvb_frontend *fe)
                return ret;
 
        /* attach tuner and init */
-       if (state->tuner == NULL) {
+       if (fe->ops.tuner_ops.release == NULL) {
                /* read tuner and board id from eeprom */
                ret = af9005_read_eeprom(adap->dev, 0xc6, buf, 2);
                if (ret) {
@@ -1058,20 +1054,16 @@ static int af9005_fe_init(struct dvb_frontend *fe)
                                return ret;
                        }
                        if1 = (u16) (buf[0] << 8) + buf[1];
-                       state->tuner =
-                           dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap,
-                                      &af9005_mt2060_config, if1);
-                       if (state->tuner == NULL) {
+                       if (dvb_attach(mt2060_attach, fe, &adap->dev->i2c_adap,
+                                        &af9005_mt2060_config, if1) == NULL) {
                                deb_info("MT2060 attach failed\n");
                                return -ENODEV;
                        }
                        break;
                case 3: /* QT1010 */
                case 9: /* QT1010B */
-                       state->tuner =
-                           dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap,
-                                      &af9005_qt1010_config);
-                       if (state->tuner == NULL) {
+                       if (dvb_attach(qt1010_attach, fe, &adap->dev->i2c_adap,
+                                       &af9005_qt1010_config) ==NULL) {
                                deb_info("QT1010 attach failed\n");
                                return -ENODEV;
                        }
@@ -1080,7 +1072,7 @@ static int af9005_fe_init(struct dvb_frontend *fe)
                        err("Unsupported tuner type %d", buf[0]);
                        return -ENODEV;
                }
-               ret = state->tuner->ops.tuner_ops.init(state->tuner);
+               ret = fe->ops.tuner_ops.init(fe);
                if (ret)
                        return ret;
        }
@@ -1118,7 +1110,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe,
 
        deb_info("af9005_fe_set_frontend freq %d bw %d\n", fep->frequency,
                 fep->u.ofdm.bandwidth);
-       if (state->tuner == NULL) {
+       if (fe->ops.tuner_ops.release == NULL) {
                err("Tuner not attached");
                return -ENODEV;
        }
@@ -1199,7 +1191,7 @@ static int af9005_fe_set_frontend(struct dvb_frontend *fe,
                return ret;
        /* set tuner */
        deb_info("set tuner\n");
-       ret = state->tuner->ops.tuner_ops.set_params(state->tuner, fep);
+       ret = fe->ops.tuner_ops.set_params(fe, fep);
        if (ret)
                return ret;
 
@@ -1435,12 +1427,6 @@ static void af9005_fe_release(struct dvb_frontend *fe)
 {
        struct af9005_fe_state *state =
            (struct af9005_fe_state *)fe->demodulator_priv;
-       if (state->tuner != NULL && state->tuner->ops.tuner_ops.release != NULL) {
-               state->tuner->ops.tuner_ops.release(state->tuner);
-#ifdef CONFIG_DVB_CORE_ATTACH
-               symbol_put_addr(state->tuner->ops.tuner_ops.release);
-#endif
-       }
        kfree(state);
 }
 
@@ -1458,7 +1444,6 @@ struct dvb_frontend *af9005_fe_attach(struct dvb_usb_device *d)
        deb_info("attaching frontend af9005\n");
 
        state->d = d;
-       state->tuner = NULL;
        state->opened = 0;
 
        memcpy(&state->frontend.ops, &af9005_fe_ops,
index 0c0b94767bc1e1b8a64e8a75aa76415135b72fe3..ca99e439c97c26288dd10dd8d5a93f5f92eb8688 100644 (file)
@@ -501,7 +501,7 @@ static struct dvb_pll_desc dvb_pll_opera1 = {
 
 /* Philips FCV1236D
  */
-struct dvb_pll_desc dvb_pll_fcv1236d = {
+static struct dvb_pll_desc dvb_pll_fcv1236d = {
 /* Bit_0: RF Input select
  * Bit_1: 0=digital, 1=analog
  */
index 9dcbffd0aa151a711ccc1e43a70f1347b575925a..e204e7b4028a986c7b3de8c5b8b95f86eac58180 100644 (file)
@@ -509,7 +509,7 @@ config VIDEO_VINO
 
 config VIDEO_STRADIS
        tristate "Stradis 4:2:2 MPEG-2 video driver  (EXPERIMENTAL)"
-       depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && !PPC64
+       depends on EXPERIMENTAL && PCI && VIDEO_V4L1 && VIRT_TO_BUS
        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
@@ -520,7 +520,7 @@ config VIDEO_ZORAN_ZR36060
 
 config VIDEO_ZORAN
        tristate "Zoran ZR36057/36067 Video For Linux"
-       depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && !PPC64
+       depends on PCI && I2C_ALGOBIT && VIDEO_V4L1 && VIRT_TO_BUS
        help
          Say Y for support for MJPEG capture cards based on the Zoran
          36057/36067 PCI controller chipset. This includes the Iomega
index 387cb2122d4f0061d1e964d0c7ecf8ce3fa42839..f6715007d409089cad347d660f6680fb35fa4111 100644 (file)
@@ -33,6 +33,7 @@
 #include <linux/pci.h>
 #include <linux/vmalloc.h>
 #include <linux/firmware.h>
+#include <net/checksum.h>
 
 #include <asm/io.h>
 
@@ -45,7 +46,7 @@ static void boot_msp34xx(struct bttv *btv, int pin);
 static void boot_bt832(struct bttv *btv);
 static void hauppauge_eeprom(struct bttv *btv);
 static void avermedia_eeprom(struct bttv *btv);
-static void osprey_eeprom(struct bttv *btv);
+static void osprey_eeprom(struct bttv *btv, const u8 ee[256]);
 static void modtec_eeprom(struct bttv *btv);
 static void init_PXC200(struct bttv *btv);
 static void init_RTV24(struct bttv *btv);
@@ -2843,13 +2844,28 @@ struct tvcard bttv_tvcards[] = {
                .has_remote     = 1,
        },
                /* ---- card 0x8c ---------------------------------- */
+       /* Has four Bt878 chips behind a PCI bridge, each chip has:
+            one external BNC composite input (mux 2)
+            three internal composite inputs (unknown muxes)
+            an 18-bit stereo A/D (CS5331A), which has:
+              one external stereo unblanced (RCA) audio connection
+              one (or 3?) internal stereo balanced (XLR) audio connection
+              input is selected via gpio to a 14052B mux
+                (mask=0x300, unbal=0x000, bal=0x100, ??=0x200,0x300)
+              gain is controlled via an X9221A chip on the I2C bus @0x28
+              sample rate is controlled via gpio to an MK1413S
+                (mask=0x3, 32kHz=0x0, 44.1kHz=0x1, 48kHz=0x2, ??=0x3)
+            There is neither a tuner nor an svideo input. */
        [BTTV_BOARD_OSPREY440]  = {
                .name           = "Osprey 440",
-               .video_inputs   = 1,
-               .audio_inputs   = 1,
+               .video_inputs   = 4,
+               .audio_inputs   = 2, /* this is meaningless */
                .tuner          = UNSET,
-               .svhs           = 1,
-               .muxsel         = { 2 },
+               .svhs           = UNSET,
+               .muxsel         = { 2, 3, 0, 1 }, /* 3,0,1 are guesses */
+               .gpiomask       = 0x303,
+               .gpiomute       = 0x000, /* int + 32kHz */
+               .gpiomux        = { 0, 0, 0x000, 0x100},
                .pll            = PLL_28,
                .tuner_type     = UNSET,
                .tuner_addr     = ADDR_UNSET,
@@ -3453,11 +3469,12 @@ void __devinit bttv_init_card2(struct bttv *btv)
        case BTTV_BOARD_OSPREY2xx:
        case BTTV_BOARD_OSPREY2x0_SVID:
        case BTTV_BOARD_OSPREY2x0:
+       case BTTV_BOARD_OSPREY440:
        case BTTV_BOARD_OSPREY500:
        case BTTV_BOARD_OSPREY540:
        case BTTV_BOARD_OSPREY2000:
                bttv_readee(btv,eeprom_data,0xa0);
-               osprey_eeprom(btv);
+               osprey_eeprom(btv, eeprom_data);
                break;
        case BTTV_BOARD_IDS_EAGLE:
                init_ids_eagle(btv);
@@ -3748,106 +3765,119 @@ static int __devinit pvr_boot(struct bttv *btv)
 /* ----------------------------------------------------------------------- */
 /* some osprey specific stuff                                              */
 
-static void __devinit osprey_eeprom(struct bttv *btv)
+static void __devinit osprey_eeprom(struct bttv *btv, const u8 ee[256])
 {
-       int i = 0;
-       unsigned char *ee = eeprom_data;
-       unsigned long serial = 0;
-
-       if (btv->c.type == 0) {
-              /* this might be an antique... check for MMAC label in eeprom */
-              if ((ee[0]=='M') && (ee[1]=='M') && (ee[2]=='A') && (ee[3]=='C')) {
-                      unsigned char checksum = 0;
-                      for (i = 0; i < 21; i++)
-                              checksum += ee[i];
-                      if (checksum != ee[21])
-                              return;
-                      btv->c.type = BTTV_BOARD_OSPREY1x0_848;
-                      for (i = 12; i < 21; i++)
-                              serial *= 10, serial += ee[i] - '0';
-              }
+       int i;
+       u32 serial = 0;
+       int cardid = -1;
+
+       /* This code will nevery actually get called in this case.... */
+       if (btv->c.type == BTTV_BOARD_UNKNOWN) {
+               /* this might be an antique... check for MMAC label in eeprom */
+               if (!strncmp(ee, "MMAC", 4)) {
+                       u8 checksum = 0;
+                       for (i = 0; i < 21; i++)
+                               checksum += ee[i];
+                       if (checksum != ee[21])
+                               return;
+                       cardid = BTTV_BOARD_OSPREY1x0_848;
+                       for (i = 12; i < 21; i++)
+                               serial *= 10, serial += ee[i] - '0';
+               }
        } else {
-              unsigned short type;
-              int offset = 4*16;
-
-              for (; offset < 8*16; offset += 16) {
-                      unsigned short checksum = 0;
-                      /* verify the checksum */
-                      for (i = 0; i < 14; i++)
-                               checksum += ee[i+offset];
-                       checksum = ~checksum;  /* no idea why */
-                       if ((((checksum>>8)&0x0FF) == ee[offset+14]) &&
-                                  ((checksum & 0x0FF) == ee[offset+15])) {
-                              break;
-                      }
-              }
-
-              if (offset >= 8*16)
-                      return;
-
-              /* found a valid descriptor */
-              type = (ee[offset+4]<<8) | (ee[offset+5]);
-
-              switch(type) {
-              /* 848 based */
-              case 0x0004:
-                      btv->c.type = BTTV_BOARD_OSPREY1x0_848;
-                      break;
-              case 0x0005:
-                      btv->c.type = BTTV_BOARD_OSPREY101_848;
-                      break;
-
-              /* 878 based */
-              case 0x0012:
-              case 0x0013:
-                      btv->c.type = BTTV_BOARD_OSPREY1x0;
-                      break;
-              case 0x0014:
-              case 0x0015:
-                      btv->c.type = BTTV_BOARD_OSPREY1x1;
-                      break;
-              case 0x0016:
-              case 0x0017:
-              case 0x0020:
-                      btv->c.type = BTTV_BOARD_OSPREY1x1_SVID;
-                      break;
-              case 0x0018:
-              case 0x0019:
-              case 0x001E:
-              case 0x001F:
-                      btv->c.type = BTTV_BOARD_OSPREY2xx;
-                      break;
-              case 0x001A:
-              case 0x001B:
-                      btv->c.type = BTTV_BOARD_OSPREY2x0_SVID;
-                      break;
-              case 0x0040:
-                      btv->c.type = BTTV_BOARD_OSPREY500;
-                      break;
-              case 0x0050:
-              case 0x0056:
-                      btv->c.type = BTTV_BOARD_OSPREY540;
-                      /* bttv_osprey_540_init(btv); */
-                      break;
-              case 0x0060:
-              case 0x0070:
-              case 0x00A0:
-                      btv->c.type = BTTV_BOARD_OSPREY2x0;
-                      /* enable output on select control lines */
-                      gpio_inout(0xffffff,0x000303);
-                      break;
-              default:
-                      /* unknown...leave generic, but get serial # */
-                      break;
-              }
-              serial =  (ee[offset+6] << 24)
-                      | (ee[offset+7] << 16)
-                      | (ee[offset+8] <<  8)
-                      | (ee[offset+9]);
-       }
-
-       printk(KERN_INFO "bttv%d: osprey eeprom: card=%d name=%s serial=%ld\n",
-             btv->c.nr, btv->c.type, bttv_tvcards[btv->c.type].name,serial);
+               unsigned short type;
+
+               for (i = 4*16; i < 8*16; i += 16) {
+                       u16 checksum = ip_compute_csum(ee + i, 16);
+
+                       if ((checksum&0xff) + (checksum>>8) == 0xff)
+                               break;
+               }
+               if (i >= 8*16)
+                       return;
+               ee += i;
+
+               /* found a valid descriptor */
+               type = be16_to_cpup((u16*)(ee+4));
+
+               switch(type) {
+               /* 848 based */
+               case 0x0004:
+                       cardid = BTTV_BOARD_OSPREY1x0_848;
+                       break;
+               case 0x0005:
+                       cardid = BTTV_BOARD_OSPREY101_848;
+                       break;
+
+               /* 878 based */
+               case 0x0012:
+               case 0x0013:
+                       cardid = BTTV_BOARD_OSPREY1x0;
+                       break;
+               case 0x0014:
+               case 0x0015:
+                       cardid = BTTV_BOARD_OSPREY1x1;
+                       break;
+               case 0x0016:
+               case 0x0017:
+               case 0x0020:
+                       cardid = BTTV_BOARD_OSPREY1x1_SVID;
+                       break;
+               case 0x0018:
+               case 0x0019:
+               case 0x001E:
+               case 0x001F:
+                       cardid = BTTV_BOARD_OSPREY2xx;
+                       break;
+               case 0x001A:
+               case 0x001B:
+                       cardid = BTTV_BOARD_OSPREY2x0_SVID;
+                       break;
+               case 0x0040:
+                       cardid = BTTV_BOARD_OSPREY500;
+                       break;
+               case 0x0050:
+               case 0x0056:
+                       cardid = BTTV_BOARD_OSPREY540;
+                       /* bttv_osprey_540_init(btv); */
+                       break;
+               case 0x0060:
+               case 0x0070:
+               case 0x00A0:
+                       cardid = BTTV_BOARD_OSPREY2x0;
+                       /* enable output on select control lines */
+                       gpio_inout(0xffffff,0x000303);
+                       break;
+               case 0x00D8:
+                       cardid = BTTV_BOARD_OSPREY440;
+                       break;
+               default:
+                       /* unknown...leave generic, but get serial # */
+                       printk(KERN_INFO "bttv%d: "
+                              "osprey eeprom: unknown card type 0x%04x\n",
+                              btv->c.nr, type);
+                       break;
+               }
+               serial = be32_to_cpup((u32*)(ee+6));
+       }
+
+       printk(KERN_INFO "bttv%d: osprey eeprom: card=%d '%s' serial=%u\n",
+              btv->c.nr, cardid,
+              cardid>0 ? bttv_tvcards[cardid].name : "Unknown", serial);
+
+       if (cardid<0 || btv->c.type == cardid)
+               return;
+
+       /* card type isn't set correctly */
+       if (card[btv->c.nr] < bttv_num_tvcards) {
+               printk(KERN_WARNING "bttv%d: osprey eeprom: "
+                      "Not overriding user specified card type\n", btv->c.nr);
+       } else {
+               printk(KERN_INFO "bttv%d: osprey eeprom: "
+                      "Changing card type from %d to %d\n", btv->c.nr,
+                      btv->c.type, cardid);
+               btv->c.type = cardid;
+       }
 }
 
 /* ----------------------------------------------------------------------- */
index 91b588d261ae2a2f81189ba08c14aa7631567573..8abb34a35816917c5af6392beb873020e387dafe 100644 (file)
@@ -417,6 +417,7 @@ struct ivtv_mailbox_data {
 #define IVTV_F_I_WORK_HANDLER_YUV  17  /* there is work to be done for YUV */
 #define IVTV_F_I_WORK_HANDLER_PIO  18  /* there is work to be done for PIO */
 #define IVTV_F_I_PIO              19   /* PIO in progress */
+#define IVTV_F_I_DEC_PAUSED       20   /* the decoder is paused */
 
 /* Event notifications */
 #define IVTV_F_I_EV_DEC_STOPPED           28   /* decoder stopped event */
index 8e97a938398f729fa7386da8bde213d1ecaa30e8..5dd519caf81d5dcbe52f788d65c4e337c719ac08 100644 (file)
@@ -757,6 +757,7 @@ static void ivtv_stop_decoding(struct ivtv_open_id *id, int flags, u64 pts)
            itv->output_mode = OUT_NONE;
 
        itv->speed = 0;
+       clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
        ivtv_release_stream(s);
 }
 
@@ -799,7 +800,16 @@ int ivtv_v4l2_close(struct inode *inode, struct file *filp)
                ivtv_unmute(itv);
                ivtv_release_stream(s);
        } else if (s->type >= IVTV_DEC_STREAM_TYPE_MPG) {
+               struct ivtv_stream *s_vout = &itv->streams[IVTV_DEC_STREAM_TYPE_VOUT];
+
                ivtv_stop_decoding(id, VIDEO_CMD_STOP_TO_BLACK | VIDEO_CMD_STOP_IMMEDIATELY, 0);
+
+               /* If all output streams are closed, and if the user doesn't have
+                  IVTV_DEC_STREAM_TYPE_VOUT open, then disable VBI on TV-out. */
+               if (itv->output_mode == OUT_NONE && !test_bit(IVTV_F_S_APPL_IO, &s_vout->s_flags)) {
+                       /* disable VBI on TV-out */
+                       ivtv_disable_vbi(itv);
+               }
        } else {
                ivtv_stop_capture(id, 0);
        }
index d0feabf9308023e3f2632cda4b27b10988e1daf3..425eb1063904726d15097f3696079497654af9e4 100644 (file)
@@ -72,8 +72,8 @@ retry:
                        dst++;
                        src++;
                }
-               release_firmware(fw);
                IVTV_INFO("Loaded %s firmware (%zd bytes)\n", fn, fw->size);
+               release_firmware(fw);
                return size;
        }
        IVTV_ERR("Unable to open firmware %s (must be %ld bytes)\n", fn, size);
index 4773453e8dab2b8e966523f2948965616ec3fdf6..047624b9e2717f0ded7af8e2403e908ee60c3091 100644 (file)
@@ -285,6 +285,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
 
                if (ivtv_set_output_mode(itv, OUT_MPG) != OUT_MPG)
                        return -EBUSY;
+               if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
+                       /* forces ivtv_set_speed to be called */
+                       itv->speed = 0;
+               }
                return ivtv_start_decoding(id, vc->play.speed);
        }
 
@@ -309,6 +313,7 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
                if (atomic_read(&itv->decoding) > 0) {
                        ivtv_vapi(itv, CX2341X_DEC_PAUSE_PLAYBACK, 1,
                                (vc->flags & VIDEO_CMD_FREEZE_TO_BLACK) ? 1 : 0);
+                       set_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags);
                }
                break;
 
@@ -317,8 +322,10 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
                if (try) break;
                if (itv->output_mode != OUT_MPG)
                        return -EBUSY;
-               if (atomic_read(&itv->decoding) > 0) {
-                       ivtv_vapi(itv, CX2341X_DEC_START_PLAYBACK, 2, 0, 0);
+               if (test_and_clear_bit(IVTV_F_I_DEC_PAUSED, &itv->i_flags)) {
+                       int speed = itv->speed;
+                       itv->speed = 0;
+                       return ivtv_start_decoding(id, speed);
                }
                break;
 
index 814a673712b386e3d79e245ddd9e5d733c42b50c..5e3b679202ae8a69031f4d118e42d40ae220d3ce 100644 (file)
@@ -40,6 +40,7 @@
 #define API_HIGH_VOL    (1 << 5)       /* High volume command (i.e. called during encoding or decoding) */
 #define API_NO_WAIT_MB          (1 << 4)       /* Command may not wait for a free mailbox */
 #define API_NO_WAIT_RES         (1 << 5)       /* Command may not wait for the result */
+#define API_NO_POLL     (1 << 6)       /* Avoid pointless polling */
 
 struct ivtv_api_info {
        int flags;              /* Flags, see above */
@@ -51,7 +52,7 @@ struct ivtv_api_info {
 static const struct ivtv_api_info api_info[256] = {
        /* MPEG encoder API */
        API_ENTRY(CX2341X_ENC_PING_FW,                  API_FAST_RESULT),
-       API_ENTRY(CX2341X_ENC_START_CAPTURE,            API_RESULT),
+       API_ENTRY(CX2341X_ENC_START_CAPTURE,            API_RESULT | API_NO_POLL),
        API_ENTRY(CX2341X_ENC_STOP_CAPTURE,             API_RESULT),
        API_ENTRY(CX2341X_ENC_SET_AUDIO_ID,             API_CACHE),
        API_ENTRY(CX2341X_ENC_SET_VIDEO_ID,             API_CACHE),
@@ -96,7 +97,7 @@ static const struct ivtv_api_info api_info[256] = {
 
        /* MPEG decoder API */
        API_ENTRY(CX2341X_DEC_PING_FW,                  API_FAST_RESULT),
-       API_ENTRY(CX2341X_DEC_START_PLAYBACK,           API_RESULT),
+       API_ENTRY(CX2341X_DEC_START_PLAYBACK,           API_RESULT | API_NO_POLL),
        API_ENTRY(CX2341X_DEC_STOP_PLAYBACK,            API_RESULT),
        API_ENTRY(CX2341X_DEC_SET_PLAYBACK_SPEED,       API_RESULT),
        API_ENTRY(CX2341X_DEC_STEP_VIDEO,               API_RESULT),
@@ -290,6 +291,13 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
        /* Get results */
        then = jiffies;
 
+       if (!(flags & API_NO_POLL)) {
+               /* First try to poll, then switch to delays */
+               for (i = 0; i < 100; i++) {
+                       if (readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE)
+                               break;
+               }
+       }
        while (!(readl(&mbox->flags) & IVTV_MBOX_FIRMWARE_DONE)) {
                if (jiffies - then > api_timeout) {
                        IVTV_DEBUG_WARN("Could not get result (%s)\n", api_info[cmd].name);
@@ -301,7 +309,7 @@ static int ivtv_api_call(struct ivtv *itv, int cmd, int args, u32 data[])
                if (flags & API_NO_WAIT_RES)
                        mdelay(1);
                else
-                       ivtv_msleep_timeout(10, 0);
+                       ivtv_msleep_timeout(1, 0);
        }
        if (jiffies - then > msecs_to_jiffies(100))
                IVTV_DEBUG_WARN("%s took %u jiffies\n",
index 322b347b67c28905ccf00091a1a189dfe1c800bb..51df3f8550310f2ffdc0b3c5c937ca14ac1bdde1 100644 (file)
@@ -603,10 +603,6 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s)
 
        IVTV_DEBUG_INFO("Setting some initial decoder settings\n");
 
-       /* disable VBI signals, if the MPEG stream contains VBI data,
-          then that data will be processed automatically for you. */
-       ivtv_disable_vbi(itv);
-
        /* set audio mode to left/stereo  for dual/stereo mode. */
        ivtv_vapi(itv, CX2341X_DEC_SET_AUDIO_MODE, 2, itv->audio_bilingual_mode, itv->audio_stereo_mode);
 
@@ -639,7 +635,7 @@ static int ivtv_setup_v4l2_decode_stream(struct ivtv_stream *s)
        }
        if (ivtv_vapi(itv, CX2341X_DEC_SET_DECODER_SOURCE, 4, datatype,
                        itv->params.width, itv->params.height, itv->params.audio_properties)) {
-               IVTV_DEBUG_WARN("COULDN'T INITIALIZE DECODER SOURCE\n");
+               IVTV_DEBUG_WARN("Couldn't initialize decoder source\n");
        }
        return 0;
 }
@@ -909,11 +905,6 @@ int ivtv_stop_v4l2_decode_stream(struct ivtv_stream *s, int flags, u64 pts)
        clear_bit(IVTV_F_S_STREAMING, &s->s_flags);
        ivtv_flush_queues(s);
 
-       if (!test_bit(IVTV_F_S_PASSTHROUGH, &s->s_flags)) {
-               /* disable VBI on TV-out */
-               ivtv_disable_vbi(itv);
-       }
-
        /* decrement decoding */
        atomic_dec(&itv->decoding);
 
index 868b6886fe7fcb44d892c4b7090213eb01342b89..e3371f972240a896b930fd03107f12882aedf064 100644 (file)
@@ -517,6 +517,7 @@ static int vidioc_g_register (struct file *file, void *priv,
                    __FUNCTION__, errCode);
                return errCode;
        }
+       reg->val = errCode;
        return 0;
 }
 
@@ -531,8 +532,8 @@ static int vidioc_s_register (struct file *file, void *priv,
        if (!v4l2_chip_match_host(reg->match_type, reg->match_chip))
                return -EINVAL;
        /* NT100x has a 8-bit register space */
-       reg->val = (u8)usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
-       if (reg->val < 0) {
+       errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
+       if (errCode < 0) {
                err("%s: VIDIOC_DBG_S_REGISTER failed: error %d",
                    __FUNCTION__, errCode);
                return errCode;
index 8fb4a3414e0a7441d0f13ca3749bc551051447d1..937c4a616c0e3fbb7e9244de9e25d4b103aac12a 100644 (file)
@@ -240,11 +240,16 @@ enum gpcs_type {
 
 struct zoran_format {
        char *name;
+#ifdef CONFIG_VIDEO_V4L1_COMPAT
        int palette;
+#endif
+#ifdef CONFIG_VIDEO_V4L2
        __u32 fourcc;
        int colorspace;
+#endif
        int depth;
        __u32 flags;
+       __u32 vfespfr;
 };
 /* flags */
 #define ZORAN_FORMAT_COMPRESSED 1<<0
index b0752767ee4f5195df9144a42712837d4eedfd47..ba2f4ed294836586fe36e8560ab54e5cc6389918 100644 (file)
@@ -429,8 +429,6 @@ zr36057_set_vfe (struct zoran              *zr,
        reg |= (HorDcm << ZR36057_VFESPFR_HorDcm);
        reg |= (VerDcm << ZR36057_VFESPFR_VerDcm);
        reg |= (DispMode << ZR36057_VFESPFR_DispMode);
-       if (format->palette != VIDEO_PALETTE_YUV422 && format->palette != VIDEO_PALETTE_YUYV)
-               reg |= ZR36057_VFESPFR_LittleEndian;
        /* RJ: I don't know, why the following has to be the opposite
         * of the corresponding ZR36060 setting, but only this way
         * we get the correct colors when uncompressing to the screen  */
@@ -439,36 +437,6 @@ zr36057_set_vfe (struct zoran              *zr,
        if (zr->norm != VIDEO_MODE_NTSC)
                reg |= ZR36057_VFESPFR_ExtFl;   // NEEDED!!!!!!! Wolfgang
        reg |= ZR36057_VFESPFR_TopField;
-       switch (format->palette) {
-
-       case VIDEO_PALETTE_YUYV:
-       case VIDEO_PALETTE_YUV422:
-               reg |= ZR36057_VFESPFR_YUV422;
-               break;
-
-       case VIDEO_PALETTE_RGB555:
-               reg |= ZR36057_VFESPFR_RGB555 | ZR36057_VFESPFR_ErrDif;
-               break;
-
-       case VIDEO_PALETTE_RGB565:
-               reg |= ZR36057_VFESPFR_RGB565 | ZR36057_VFESPFR_ErrDif;
-               break;
-
-       case VIDEO_PALETTE_RGB24:
-               reg |= ZR36057_VFESPFR_RGB888 | ZR36057_VFESPFR_Pack24;
-               break;
-
-       case VIDEO_PALETTE_RGB32:
-               reg |= ZR36057_VFESPFR_RGB888;
-               break;
-
-       default:
-               dprintk(1,
-                       KERN_INFO "%s: set_vfe() - unknown color_fmt=%x\n",
-                       ZR_DEVNAME(zr), format->palette);
-               return;
-
-       }
        if (HorDcm >= 48) {
                reg |= 3 << ZR36057_VFESPFR_HFilter;    /* 5 tap filter */
        } else if (HorDcm >= 32) {
@@ -476,6 +444,7 @@ zr36057_set_vfe (struct zoran              *zr,
        } else if (HorDcm >= 16) {
                reg |= 1 << ZR36057_VFESPFR_HFilter;    /* 3 tap filter */
        }
+       reg |= format->vfespfr;
        btwrite(reg, ZR36057_VFESPFR);
 
        /* display configuration */
@@ -651,11 +620,17 @@ zr36057_set_memgrab (struct zoran *zr,
                     int           mode)
 {
        if (mode) {
-               if (btread(ZR36057_VSSFGR) &
-                   (ZR36057_VSSFGR_SnapShot | ZR36057_VSSFGR_FrameGrab))
+               /* We only check SnapShot and not FrameGrab here.  SnapShot==1
+                * means a capture is already in progress, but FrameGrab==1
+                * doesn't necessary mean that.  It's more correct to say a 1
+                * to 0 transition indicates a capture completed.  If a
+                * capture is pending when capturing is tuned off, FrameGrab
+                * will be stuck at 1 until capturing is turned back on.
+                */
+               if (btread(ZR36057_VSSFGR) & ZR36057_VSSFGR_SnapShot)
                        dprintk(1,
                                KERN_WARNING
-                               "%s: zr36057_set_memgrab(1) with SnapShot or FrameGrab on!?\n",
+                               "%s: zr36057_set_memgrab(1) with SnapShot on!?\n",
                                ZR_DEVNAME(zr));
 
                /* switch on VSync interrupts */
@@ -672,11 +647,12 @@ zr36057_set_memgrab (struct zoran *zr,
 
                zr->v4l_memgrab_active = 1;
        } else {
-               zr->v4l_memgrab_active = 0;
-
                /* switch off VSync interrupts */
                btand(~zr->card.vsync_int, ZR36057_ICR);        // SW
 
+               zr->v4l_memgrab_active = 0;
+               zr->v4l_grab_frame = NO_GRAB_ACTIVE;
+
                /* reenable grabbing to screen if it was running */
                if (zr->v4l_overlay_active) {
                        zr36057_overlay(zr, 1);
index 17118a490f8166cb2d3ddffdf7c304a473d4287d..72a037b75d63af058f8a7869eca4bb4a8c8af824 100644 (file)
 
 #include <asm/byteorder.h>
 
-const struct zoran_format zoran_formats[] = {
-       {
-               .name = "15-bit RGB",
-               .palette = VIDEO_PALETTE_RGB555,
-#ifdef CONFIG_VIDEO_V4L2
-#ifdef __LITTLE_ENDIAN
-               .fourcc = V4L2_PIX_FMT_RGB555,
+#if defined(CONFIG_VIDEO_V4L2) && defined(CONFIG_VIDEO_V4L1_COMPAT)
+#define ZFMT(pal, fcc, cs) \
+       .palette = (pal), .fourcc = (fcc), .colorspace = (cs)
+#elif defined(CONFIG_VIDEO_V4L2)
+#define ZFMT(pal, fcc, cs) \
+       .fourcc = (fcc), .colorspace = (cs)
 #else
-               .fourcc = V4L2_PIX_FMT_RGB555X,
-#endif
-               .colorspace = V4L2_COLORSPACE_SRGB,
+#define ZFMT(pal, fcc, cs) \
+       .palette = (pal)
 #endif
+
+const struct zoran_format zoran_formats[] = {
+       {
+               .name = "15-bit RGB LE",
+               ZFMT(VIDEO_PALETTE_RGB555,
+                    V4L2_PIX_FMT_RGB555, V4L2_COLORSPACE_SRGB),
                .depth = 15,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif|
+                          ZR36057_VFESPFR_LittleEndian,
        }, {
-               .name = "16-bit RGB",
-               .palette = VIDEO_PALETTE_RGB565,
-#ifdef CONFIG_VIDEO_V4L2
-#ifdef __LITTLE_ENDIAN
-               .fourcc = V4L2_PIX_FMT_RGB565,
-#else
-               .fourcc = V4L2_PIX_FMT_RGB565X,
-#endif
-               .colorspace = V4L2_COLORSPACE_SRGB,
-#endif
+               .name = "15-bit RGB BE",
+               ZFMT(-1,
+                    V4L2_PIX_FMT_RGB555X, V4L2_COLORSPACE_SRGB),
+               .depth = 15,
+               .flags = ZORAN_FORMAT_CAPTURE |
+                        ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_RGB555|ZR36057_VFESPFR_ErrDif,
+       }, {
+               .name = "16-bit RGB LE",
+               ZFMT(VIDEO_PALETTE_RGB565,
+                    V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB),
                .depth = 16,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif|
+                          ZR36057_VFESPFR_LittleEndian,
+       }, {
+               .name = "16-bit RGB BE",
+               ZFMT(-1,
+                    V4L2_PIX_FMT_RGB565, V4L2_COLORSPACE_SRGB),
+               .depth = 16,
+               .flags = ZORAN_FORMAT_CAPTURE |
+                        ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_RGB565|ZR36057_VFESPFR_ErrDif,
        }, {
                .name = "24-bit RGB",
-               .palette = VIDEO_PALETTE_RGB24,
-#ifdef CONFIG_VIDEO_V4L2
-#ifdef __LITTLE_ENDIAN
-               .fourcc = V4L2_PIX_FMT_BGR24,
-#else
-               .fourcc = V4L2_PIX_FMT_RGB24,
-#endif
-               .colorspace = V4L2_COLORSPACE_SRGB,
-#endif
+               ZFMT(VIDEO_PALETTE_RGB24,
+                    V4L2_PIX_FMT_BGR24, V4L2_COLORSPACE_SRGB),
                .depth = 24,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_Pack24,
        }, {
-               .name = "32-bit RGB",
-               .palette = VIDEO_PALETTE_RGB32,
-#ifdef CONFIG_VIDEO_V4L2
-#ifdef __LITTLE_ENDIAN
-               .fourcc = V4L2_PIX_FMT_BGR32,
-#else
-               .fourcc = V4L2_PIX_FMT_RGB32,
-#endif
-               .colorspace = V4L2_COLORSPACE_SRGB,
-#endif
+               .name = "32-bit RGB LE",
+               ZFMT(VIDEO_PALETTE_RGB32,
+                    V4L2_PIX_FMT_BGR32, V4L2_COLORSPACE_SRGB),
+               .depth = 32,
+               .flags = ZORAN_FORMAT_CAPTURE |
+                        ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_RGB888|ZR36057_VFESPFR_LittleEndian,
+       }, {
+               .name = "32-bit RGB BE",
+               ZFMT(-1,
+                    V4L2_PIX_FMT_RGB32, V4L2_COLORSPACE_SRGB),
                .depth = 32,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_RGB888,
        }, {
                .name = "4:2:2, packed, YUYV",
-               .palette = VIDEO_PALETTE_YUV422,
-#ifdef CONFIG_VIDEO_V4L2
-               .fourcc = V4L2_PIX_FMT_YUYV,
-               .colorspace = V4L2_COLORSPACE_SMPTE170M,
-#endif
+               ZFMT(VIDEO_PALETTE_YUV422,
+                    V4L2_PIX_FMT_YUYV, V4L2_COLORSPACE_SMPTE170M),
+               .depth = 16,
+               .flags = ZORAN_FORMAT_CAPTURE |
+                        ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_YUV422,
+       }, {
+               .name = "4:2:2, packed, UYVY",
+               ZFMT(VIDEO_PALETTE_UYVY,
+                    V4L2_PIX_FMT_UYVY, V4L2_COLORSPACE_SMPTE170M),
                .depth = 16,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_OVERLAY,
+               .vfespfr = ZR36057_VFESPFR_YUV422|ZR36057_VFESPFR_LittleEndian,
        }, {
                .name = "Hardware-encoded Motion-JPEG",
-               .palette = -1,
-#ifdef CONFIG_VIDEO_V4L2
-               .fourcc = V4L2_PIX_FMT_MJPEG,
-               .colorspace = V4L2_COLORSPACE_SMPTE170M,
-#endif
+               ZFMT(-1,
+                    V4L2_PIX_FMT_MJPEG, V4L2_COLORSPACE_SMPTE170M),
                .depth = 0,
                .flags = ZORAN_FORMAT_CAPTURE |
                         ZORAN_FORMAT_PLAYBACK |
                         ZORAN_FORMAT_COMPRESSED,
        }
 };
-static const int zoran_num_formats =
-    (sizeof(zoran_formats) / sizeof(struct zoran_format));
+#define NUM_FORMATS ARRAY_SIZE(zoran_formats)
 
 // RJ: Test only - want to test BUZ_USE_HIMEM even when CONFIG_BIGPHYS_AREA is defined
 
@@ -768,13 +783,13 @@ v4l_grab (struct file       *file,
        struct zoran *zr = fh->zr;
        int res = 0, i;
 
-       for (i = 0; i < zoran_num_formats; i++) {
+       for (i = 0; i < NUM_FORMATS; i++) {
                if (zoran_formats[i].palette == mp->format &&
                    zoran_formats[i].flags & ZORAN_FORMAT_CAPTURE &&
                    !(zoran_formats[i].flags & ZORAN_FORMAT_COMPRESSED))
                        break;
        }
-       if (i == zoran_num_formats || zoran_formats[i].depth == 0) {
+       if (i == NUM_FORMATS || zoran_formats[i].depth == 0) {
                dprintk(1,
                        KERN_ERR
                        "%s: v4l_grab() - wrong bytes-per-pixel format\n",
@@ -1173,10 +1188,14 @@ zoran_close_end_session (struct file *file)
 
        /* v4l capture */
        if (fh->v4l_buffers.active != ZORAN_FREE) {
+               long flags;
+
+               spin_lock_irqsave(&zr->spinlock, flags);
                zr36057_set_memgrab(zr, 0);
                zr->v4l_buffers.allocated = 0;
                zr->v4l_buffers.active = fh->v4l_buffers.active =
                    ZORAN_FREE;
+               spin_unlock_irqrestore(&zr->spinlock, flags);
        }
 
        /* v4l buffers */
@@ -2107,7 +2126,7 @@ zoran_do_ioctl (struct inode *inode,
                        vpict->colour, vpict->contrast, vpict->depth,
                        vpict->palette);
 
-               for (i = 0; i < zoran_num_formats; i++) {
+               for (i = 0; i < NUM_FORMATS; i++) {
                        const struct zoran_format *fmt = &zoran_formats[i];
 
                        if (fmt->palette != -1 &&
@@ -2116,7 +2135,7 @@ zoran_do_ioctl (struct inode *inode,
                            fmt->depth == vpict->depth)
                                break;
                }
-               if (i == zoran_num_formats) {
+               if (i == NUM_FORMATS) {
                        dprintk(1,
                                KERN_ERR
                                "%s: VIDIOCSPICT - Invalid palette %d\n",
@@ -2220,10 +2239,10 @@ zoran_do_ioctl (struct inode *inode,
                        ZR_DEVNAME(zr), vbuf->base, vbuf->width,
                        vbuf->height, vbuf->depth, vbuf->bytesperline);
 
-               for (i = 0; i < zoran_num_formats; i++)
+               for (i = 0; i < NUM_FORMATS; i++)
                        if (zoran_formats[i].depth == vbuf->depth)
                                break;
-               if (i == zoran_num_formats) {
+               if (i == NUM_FORMATS) {
                        dprintk(1,
                                KERN_ERR
                                "%s: VIDIOCSFBUF - invalid fbuf depth %d\n",
@@ -2672,14 +2691,14 @@ zoran_do_ioctl (struct inode *inode,
                        return -EINVAL;
                }
 
-               for (i = 0; i < zoran_num_formats; i++) {
+               for (i = 0; i < NUM_FORMATS; i++) {
                        if (zoran_formats[i].flags & flag)
                                num++;
                        if (num == fmt->index)
                                break;
                }
                if (fmt->index < 0 /* late, but not too late */  ||
-                   i == zoran_num_formats)
+                   i == NUM_FORMATS)
                        return -EINVAL;
 
                memset(fmt, 0, sizeof(*fmt));
@@ -2737,7 +2756,8 @@ zoran_do_ioctl (struct inode *inode,
                                fmt->fmt.pix.height =
                                    fh->v4l_settings.height;
                                fmt->fmt.pix.sizeimage =
-                                   fh->v4l_buffers.buffer_size;
+                                   fh->v4l_settings.bytesperline *
+                                   fh->v4l_settings.height;
                                fmt->fmt.pix.pixelformat =
                                    fh->v4l_settings.format->fourcc;
                                fmt->fmt.pix.colorspace =
@@ -2941,11 +2961,11 @@ zoran_do_ioctl (struct inode *inode,
                        sfmtjpg_unlock_and_return:
                                mutex_unlock(&zr->resource_lock);
                        } else {
-                               for (i = 0; i < zoran_num_formats; i++)
+                               for (i = 0; i < NUM_FORMATS; i++)
                                        if (fmt->fmt.pix.pixelformat ==
                                            zoran_formats[i].fourcc)
                                                break;
-                               if (i == zoran_num_formats) {
+                               if (i == NUM_FORMATS) {
                                        dprintk(1,
                                                KERN_ERR
                                                "%s: VIDIOC_S_FMT - unknown/unsupported format 0x%x (%4.4s)\n",
@@ -2984,8 +3004,9 @@ zoran_do_ioctl (struct inode *inode,
 
                                /* tell the user the
                                 * results/missing stuff */
-                               fmt->fmt.pix.sizeimage = fh->v4l_buffers.buffer_size    /*zr->gbpl * zr->gheight */
-                                   ;
+                               fmt->fmt.pix.sizeimage =
+                                       fh->v4l_settings.height *
+                                       fh->v4l_settings.bytesperline;
                                if (BUZ_MAX_HEIGHT <
                                    (fh->v4l_settings.height * 2))
                                        fmt->fmt.pix.field =
@@ -3053,10 +3074,10 @@ zoran_do_ioctl (struct inode *inode,
                        fb->fmt.bytesperline, fb->fmt.pixelformat,
                        (char *) &printformat);
 
-               for (i = 0; i < zoran_num_formats; i++)
+               for (i = 0; i < NUM_FORMATS; i++)
                        if (zoran_formats[i].fourcc == fb->fmt.pixelformat)
                                break;
-               if (i == zoran_num_formats) {
+               if (i == NUM_FORMATS) {
                        dprintk(1,
                                KERN_ERR
                                "%s: VIDIOC_S_FBUF - format=0x%x (%4.4s) not allowed\n",
@@ -3439,8 +3460,13 @@ zoran_do_ioctl (struct inode *inode,
                                goto strmoff_unlock_and_return;
 
                        /* unload capture */
-                       if (zr->v4l_memgrab_active)
+                       if (zr->v4l_memgrab_active) {
+                               long flags;
+
+                               spin_lock_irqsave(&zr->spinlock, flags);
                                zr36057_set_memgrab(zr, 0);
+                               spin_unlock_irqrestore(&zr->spinlock, flags);
+                       }
 
                        for (i = 0; i < fh->v4l_buffers.num_buffers; i++)
                                zr->v4l_buffers.buffer[i].state =
@@ -3704,11 +3730,11 @@ zoran_do_ioctl (struct inode *inode,
                dprintk(3, KERN_DEBUG "%s: VIDIOC_S_STD - norm=0x%llx\n",
                        ZR_DEVNAME(zr), (unsigned long long)*std);
 
-               if (*std == V4L2_STD_PAL)
+               if ((*std & V4L2_STD_PAL) && !(*std & ~V4L2_STD_PAL))
                        norm = VIDEO_MODE_PAL;
-               else if (*std == V4L2_STD_NTSC)
+               else if ((*std & V4L2_STD_NTSC) && !(*std & ~V4L2_STD_NTSC))
                        norm = VIDEO_MODE_NTSC;
-               else if (*std == V4L2_STD_SECAM)
+               else if ((*std & V4L2_STD_SECAM) && !(*std & ~V4L2_STD_SECAM))
                        norm = VIDEO_MODE_SECAM;
                else if (*std == V4L2_STD_ALL)
                        norm = VIDEO_MODE_AUTO;
@@ -4149,11 +4175,11 @@ zoran_do_ioctl (struct inode *inode,
                                   V4L2_BUF_TYPE_VIDEO_CAPTURE) {
                                int i;
 
-                               for (i = 0; i < zoran_num_formats; i++)
+                               for (i = 0; i < NUM_FORMATS; i++)
                                        if (zoran_formats[i].fourcc ==
                                            fmt->fmt.pix.pixelformat)
                                                break;
-                               if (i == zoran_num_formats) {
+                               if (i == NUM_FORMATS) {
                                        res = -EINVAL;
                                        goto tryfmt_unlock_and_return;
                                }
@@ -4213,8 +4239,8 @@ zoran_poll (struct file *file,
 {
        struct zoran_fh *fh = file->private_data;
        struct zoran *zr = fh->zr;
-       wait_queue_head_t *queue = NULL;
        int res = 0, frame;
+       unsigned long flags;
 
        /* we should check whether buffers are ready to be synced on
         * (w/o waits - O_NONBLOCK) here
@@ -4228,51 +4254,58 @@ zoran_poll (struct file *file,
 
        switch (fh->map_mode) {
        case ZORAN_MAP_MODE_RAW:
-               if (fh->v4l_buffers.active == ZORAN_FREE ||
-                   zr->v4l_pend_head == zr->v4l_pend_tail) {
-                       dprintk(1,
-                               "%s: zoran_poll() - no buffers queued\n",
-                               ZR_DEVNAME(zr));
-                       res = POLLNVAL;
-                       goto poll_unlock_and_return;
-               }
-               queue = &zr->v4l_capq;
-               frame = zr->v4l_pend[zr->v4l_pend_tail & V4L_MASK_FRAME];
-               poll_wait(file, queue, wait);
-               if (fh->v4l_buffers.buffer[frame].state == BUZ_STATE_DONE)
+               poll_wait(file, &zr->v4l_capq, wait);
+               frame = zr->v4l_pend[zr->v4l_sync_tail & V4L_MASK_FRAME];
+
+               spin_lock_irqsave(&zr->spinlock, flags);
+               dprintk(3,
+                       KERN_DEBUG
+                       "%s: %s() raw - active=%c, sync_tail=%lu/%c, pend_tail=%lu, pend_head=%lu\n",
+                       ZR_DEVNAME(zr), __FUNCTION__,
+                       "FAL"[fh->v4l_buffers.active], zr->v4l_sync_tail,
+                       "UPMD"[zr->v4l_buffers.buffer[frame].state],
+                       zr->v4l_pend_tail, zr->v4l_pend_head);
+               /* Process is the one capturing? */
+               if (fh->v4l_buffers.active != ZORAN_FREE &&
+                   /* Buffer ready to DQBUF? */
+                   zr->v4l_buffers.buffer[frame].state == BUZ_STATE_DONE)
                        res = POLLIN | POLLRDNORM;
+               spin_unlock_irqrestore(&zr->spinlock, flags);
+
                break;
 
        case ZORAN_MAP_MODE_JPG_REC:
        case ZORAN_MAP_MODE_JPG_PLAY:
-               if (fh->jpg_buffers.active == ZORAN_FREE ||
-                   zr->jpg_que_head == zr->jpg_que_tail) {
-                       dprintk(1,
-                               "%s: zoran_poll() - no buffers queued\n",
-                               ZR_DEVNAME(zr));
-                       res = POLLNVAL;
-                       goto poll_unlock_and_return;
-               }
-               queue = &zr->jpg_capq;
+               poll_wait(file, &zr->jpg_capq, wait);
                frame = zr->jpg_pend[zr->jpg_que_tail & BUZ_MASK_FRAME];
-               poll_wait(file, queue, wait);
-               if (fh->jpg_buffers.buffer[frame].state == BUZ_STATE_DONE) {
+
+               spin_lock_irqsave(&zr->spinlock, flags);
+               dprintk(3,
+                       KERN_DEBUG
+                       "%s: %s() jpg - active=%c, que_tail=%lu/%c, que_head=%lu, dma=%lu/%lu\n",
+                       ZR_DEVNAME(zr), __FUNCTION__,
+                       "FAL"[fh->jpg_buffers.active], zr->jpg_que_tail,
+                       "UPMD"[zr->jpg_buffers.buffer[frame].state],
+                       zr->jpg_que_head, zr->jpg_dma_tail, zr->jpg_dma_head);
+               if (fh->jpg_buffers.active != ZORAN_FREE &&
+                   zr->jpg_buffers.buffer[frame].state == BUZ_STATE_DONE) {
                        if (fh->map_mode == ZORAN_MAP_MODE_JPG_REC)
                                res = POLLIN | POLLRDNORM;
                        else
                                res = POLLOUT | POLLWRNORM;
                }
+               spin_unlock_irqrestore(&zr->spinlock, flags);
+
                break;
 
        default:
                dprintk(1,
+                       KERN_ERR
                        "%s: zoran_poll() - internal error, unknown map_mode=%d\n",
                        ZR_DEVNAME(zr), fh->map_mode);
                res = POLLNVAL;
-               goto poll_unlock_and_return;
        }
 
-poll_unlock_and_return:
        mutex_unlock(&zr->resource_lock);
 
        return res;
@@ -4368,11 +4401,15 @@ zoran_vm_close (struct vm_area_struct *vma)
                                mutex_lock(&zr->resource_lock);
 
                                if (fh->v4l_buffers.active != ZORAN_FREE) {
+                                       long flags;
+
+                                       spin_lock_irqsave(&zr->spinlock, flags);
                                        zr36057_set_memgrab(zr, 0);
                                        zr->v4l_buffers.allocated = 0;
                                        zr->v4l_buffers.active =
                                            fh->v4l_buffers.active =
                                            ZORAN_FREE;
+                                       spin_unlock_irqrestore(&zr->spinlock, flags);
                                }
                                //v4l_fbuffer_free(file);
                                fh->v4l_buffers.allocated = 0;
index 4494e0fd36c623088858fd5c0f61bb14f050d41d..f55cc03a75c9a8a5135a670ad3ad7f320b9b7a1f 100644 (file)
@@ -102,4 +102,18 @@ config FUSION_LAN
 
          If unsure whether you really want or need this, say N.
 
+config FUSION_LOGGING
+       bool "Fusion MPT logging facility"
+       depends on FUSION
+       ---help---
+         This turns on a logging facility that can be used to debug a number
+         of Fusion MPT related problems.
+
+         The debug level can be programmed on the fly via SysFS (hex values)
+
+         echo [level] > /sys/class/scsi_host/host#/debug_level
+
+         There are various debug levels that an be found in the source:
+         file:drivers/message/fusion/mptdebug.h
+
 endmenu
index 6003b46c8438163367695238695171c3d59cb8e7..95c9532cb07ca693cd39a6f37a49c9debe3db9d6 100644 (file)
@@ -1,39 +1,8 @@
 # Fusion MPT drivers; recognized debug defines...
-#  MPT general:
-#EXTRA_CFLAGS += -DMPT_DEBUG
-#EXTRA_CFLAGS += -DMPT_DEBUG_MSG_FRAME
-#EXTRA_CFLAGS += -DMPT_DEBUG_SG
-#EXTRA_CFLAGS += -DMPT_DEBUG_EVENTS
-#EXTRA_CFLAGS += -DMPT_DEBUG_VERBOSE_EVENTS
-#EXTRA_CFLAGS += -DMPT_DEBUG_INIT
-#EXTRA_CFLAGS += -DMPT_DEBUG_EXIT
-#EXTRA_CFLAGS += -DMPT_DEBUG_FAIL
-#EXTRA_CFLAGS += -DMPT_DEBUG_DV
-#EXTRA_CFLAGS += -DMPT_DEBUG_TM
-#EXTRA_CFLAGS += -DMPT_DEBUG_REPLY
 
-#
-# driver/module specifics...
-#
-#  For mptbase:
-#CFLAGS_mptbase.o += -DMPT_DEBUG_HANDSHAKE
-#CFLAGS_mptbase.o += -DMPT_DEBUG_CONFIG
-#CFLAGS_mptbase.o += -DMPT_DEBUG_DL
-#CFLAGS_mptbase.o += -DMPT_DEBUG_IRQ
-#CFLAGS_mptbase.o += -DMPT_DEBUG_RESET
-#
-#  For mptscsih:
-#CFLAGS_mptscsih.o += -DMPT_DEBUG_SCSI
-#
-#  For mptctl:
-#CFLAGS_mptctl.o += -DMPT_DEBUG_IOCTL
-#
-#  For mptfc:
-#CFLAGS_mptfc.o += -DMPT_DEBUG_FC
-
-#  For mptsas:
-#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS
-#CFLAGS_mptsas.o += -DMPT_DEBUG_SAS_WIDE
+# enable verbose logging
+# CONFIG_FUSION_LOGGING needs to be enabled in Kconfig
+#EXTRA_CFLAGS += -DMPT_DEBUG_VERBOSE
 
 
 #=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-} LSI_LOGIC
index 04f75e24dcecb2cd513a1275df597ed914ea7676..414c109f4cf5f8ef92ac17cd56790574d760cf3d 100644 (file)
@@ -87,6 +87,12 @@ static int mpt_channel_mapping;
 module_param(mpt_channel_mapping, int, 0);
 MODULE_PARM_DESC(mpt_channel_mapping, " Mapping id's to channels (default=0)");
 
+static int mpt_debug_level;
+static int mpt_set_debug_level(const char *val, struct kernel_param *kp);
+module_param_call(mpt_debug_level, mpt_set_debug_level, param_get_int,
+                 &mpt_debug_level, 0600);
+MODULE_PARM_DESC(mpt_debug_level, " debug level - refer to mptdebug.h - (default=0)");
+
 #ifdef MFCNT
 static int mfcounter = 0;
 #define PRINT_MF_COUNT 20000
@@ -179,9 +185,7 @@ static void mpt_get_fw_exp_ver(char *buf, MPT_ADAPTER *ioc);
 
 //int          mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag);
 static int     ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *evReply, int *evHandlers);
-#ifdef MPT_DEBUG_REPLY
 static void    mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf);
-#endif
 static void    mpt_fc_log_info(MPT_ADAPTER *ioc, u32 log_info);
 static void    mpt_spi_log_info(MPT_ADAPTER *ioc, u32 log_info);
 static void    mpt_sas_log_info(MPT_ADAPTER *ioc, u32 log_info);
@@ -218,6 +222,19 @@ pci_enable_io_access(struct pci_dev *pdev)
        pci_write_config_word(pdev, PCI_COMMAND, command_reg);
 }
 
+static int mpt_set_debug_level(const char *val, struct kernel_param *kp)
+{
+       int ret = param_set_int(val, kp);
+       MPT_ADAPTER *ioc;
+
+       if (ret)
+               return ret;
+
+       list_for_each_entry(ioc, &ioc_list, list)
+               ioc->debug_level = mpt_debug_level;
+       return 0;
+}
+
 /*
  *  Process turbo (context) reply...
  */
@@ -229,7 +246,7 @@ mpt_turbo_reply(MPT_ADAPTER *ioc, u32 pa)
        int req_idx = 0;
        int cb_idx;
 
-       dmfprintk((MYIOC_s_INFO_FMT "Got TURBO reply req_idx=%08x\n",
+       dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Got TURBO reply req_idx=%08x\n",
                                ioc->name, pa));
 
        switch (pa >> MPI_CONTEXT_REPLY_TYPE_SHIFT) {
@@ -312,9 +329,9 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
        cb_idx = mr->u.frame.hwhdr.msgctxu.fld.cb_idx;
        mf = MPT_INDEX_2_MFPTR(ioc, req_idx);
 
-       dmfprintk((MYIOC_s_INFO_FMT "Got non-TURBO reply=%p req_idx=%x cb_idx=%x Function=%x\n",
+       dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Got non-TURBO reply=%p req_idx=%x cb_idx=%x Function=%x\n",
                        ioc->name, mr, req_idx, cb_idx, mr->u.hdr.Function));
-       DBG_DUMP_REPLY_FRAME(mr)
+       DBG_DUMP_REPLY_FRAME(ioc, (u32 *)mr)
 
         /*  Check/log IOC log info
         */
@@ -329,10 +346,8 @@ mpt_reply(MPT_ADAPTER *ioc, u32 pa)
                        mpt_sas_log_info(ioc, log_info);
        }
 
-#ifdef MPT_DEBUG_REPLY
        if (ioc_stat & MPI_IOCSTATUS_MASK)
                mpt_iocstatus_info(ioc, (u32)ioc_stat, mf);
-#endif
 
        /*  Check for (valid) IO callback!  */
        if (cb_idx < 1 || cb_idx >= MPT_MAX_PROTOCOL_DRIVERS ||
@@ -414,17 +429,17 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
        int freereq = 1;
        u8 func;
 
-       dmfprintk((MYIOC_s_INFO_FMT "mpt_base_reply() called\n", ioc->name));
-
-#if defined(MPT_DEBUG_MSG_FRAME)
-       if (!(reply->u.hdr.MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY)) {
-               dmfprintk((KERN_INFO MYNAM ": Original request frame (@%p) header\n", mf));
-               DBG_DUMP_REQUEST_FRAME_HDR(mf)
+       dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_base_reply() called\n", ioc->name));
+#ifdef CONFIG_FUSION_LOGGING
+       if ((ioc->debug_level & MPT_DEBUG_MSG_FRAME) &&
+                       !(reply->u.hdr.MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY)) {
+               dmfprintk(ioc, printk(KERN_INFO MYNAM ": Original request frame (@%p) header\n", mf));
+               DBG_DUMP_REQUEST_FRAME_HDR(ioc, (u32 *)mf)
        }
 #endif
 
        func = reply->u.hdr.Function;
-       dmfprintk((MYIOC_s_INFO_FMT "mpt_base_reply, Function=%02Xh\n",
+       dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_base_reply, Function=%02Xh\n",
                        ioc->name, func));
 
        if (func == MPI_FUNCTION_EVENT_NOTIFICATION) {
@@ -435,7 +450,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
                results = ProcessEventNotification(ioc, pEvReply, &evHandlers);
                if (results != evHandlers) {
                        /* CHECKME! Any special handling needed here? */
-                       devtverboseprintk((MYIOC_s_WARN_FMT "Called %d event handlers, sum results = %d\n",
+                       devtverboseprintk(ioc, printk(MYIOC_s_WARN_FMT "Called %d event handlers, sum results = %d\n",
                                        ioc->name, evHandlers, results));
                }
 
@@ -446,7 +461,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
                if (pEvReply->MsgFlags & MPI_MSGFLAGS_CONTINUATION_REPLY) {
                        freereq = 0;
                } else {
-                       devtverboseprintk((MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n",
+                       devtverboseprintk(ioc, printk(MYIOC_s_WARN_FMT "EVENT_NOTIFICATION reply %p returns Request frame\n",
                                ioc->name, pEvReply));
                }
 
@@ -455,13 +470,13 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
 #endif
 
        } else if (func == MPI_FUNCTION_EVENT_ACK) {
-               dprintk((MYIOC_s_INFO_FMT "mpt_base_reply, EventAck reply received\n",
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_base_reply, EventAck reply received\n",
                                ioc->name));
        } else if (func == MPI_FUNCTION_CONFIG) {
                CONFIGPARMS *pCfg;
                unsigned long flags;
 
-               dcprintk((MYIOC_s_INFO_FMT "config_complete (mf=%p,mr=%p)\n",
+               dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "config_complete (mf=%p,mr=%p)\n",
                                ioc->name, mf, reply));
 
                pCfg = * ((CONFIGPARMS **)((u8 *) mf + ioc->req_sz - sizeof(void *)));
@@ -484,7 +499,7 @@ mpt_base_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *reply)
                                u16              status;
 
                                status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK;
-                               dcprintk((KERN_NOTICE "  IOCStatus=%04xh, IOCLogInfo=%08xh\n",
+                               dcprintk(ioc, printk(KERN_NOTICE "  IOCStatus=%04xh, IOCLogInfo=%08xh\n",
                                     status, le32_to_cpu(pReply->IOCLogInfo)));
 
                                pCfg->status = status;
@@ -789,7 +804,7 @@ mpt_get_msg_frame(int handle, MPT_ADAPTER *ioc)
                printk(KERN_INFO "MF Count 0x%x Max 0x%x \n", ioc->mfcnt, ioc->req_depth);
 #endif
 
-       dmfprintk((KERN_INFO MYNAM ": %s: mpt_get_msg_frame(%d,%d), got mf=%p\n",
+       dmfprintk(ioc, printk(KERN_INFO MYNAM ": %s: mpt_get_msg_frame(%d,%d), got mf=%p\n",
                        ioc->name, handle, ioc->id, mf));
        return mf;
 }
@@ -820,27 +835,10 @@ mpt_put_msg_frame(int handle, MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf)
        mf->u.frame.hwhdr.msgctxu.fld.req_idx = cpu_to_le16(req_idx);
        mf->u.frame.hwhdr.msgctxu.fld.rsvd = 0;
 
-#ifdef MPT_DEBUG_MSG_FRAME
-       {
-               u32     *m = mf->u.frame.hwhdr.__hdr;
-               int      ii, n;
-
-               printk(KERN_INFO MYNAM ": %s: About to Put msg frame @ %p:\n" KERN_INFO " ",
-                               ioc->name, m);
-               n = ioc->req_sz/4 - 1;
-               while (m[n] == 0)
-                       n--;
-               for (ii=0; ii<=n; ii++) {
-                       if (ii && ((ii%8)==0))
-                               printk("\n" KERN_INFO " ");
-                       printk(" %08x", le32_to_cpu(m[ii]));
-               }
-               printk("\n");
-       }
-#endif
+       DBG_DUMP_PUT_MSG_FRAME(ioc, (u32 *)mf);
 
        mf_dma_addr = (ioc->req_frames_low_dma + req_offset) | ioc->RequestNB[req_idx];
-       dsgprintk((MYIOC_s_INFO_FMT "mf_dma_addr=%x req_idx=%d RequestNB=%x\n", ioc->name, mf_dma_addr, req_idx, ioc->RequestNB[req_idx]));
+       dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mf_dma_addr=%x req_idx=%d RequestNB=%x\n", ioc->name, mf_dma_addr, req_idx, ioc->RequestNB[req_idx]));
        CHIPREG_WRITE32(&ioc->chip->RequestFifo, mf_dma_addr);
 }
 
@@ -955,7 +953,7 @@ mpt_send_handshake_request(int handle, MPT_ADAPTER *ioc, int reqBytes, u32 *req,
        if (!(CHIPREG_READ32(&ioc->chip->Doorbell) & MPI_DOORBELL_ACTIVE))
                return -5;
 
-       dhsprintk((KERN_INFO MYNAM ": %s: mpt_send_handshake_request start, WaitCnt=%d\n",
+       dhsprintk(ioc, printk(KERN_INFO MYNAM ": %s: mpt_send_handshake_request start, WaitCnt=%d\n",
                ioc->name, ii));
 
        CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
@@ -1066,7 +1064,7 @@ mpt_host_page_alloc(MPT_ADAPTER *ioc, pIOCInit_t ioc_init)
                            host_page_buffer_sz,
                            &ioc->HostPageBuffer_dma)) != NULL) {
 
-                               dinitprintk((MYIOC_s_INFO_FMT
+                               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                                    "host_page_buffer @ %p, dma @ %x, sz=%d bytes\n",
                                    ioc->name, ioc->HostPageBuffer,
                                    (u32)ioc->HostPageBuffer_dma,
@@ -1410,31 +1408,37 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
        struct proc_dir_entry *dent, *ent;
 #endif
 
+       ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
+       if (ioc == NULL) {
+               printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");
+               return -ENOMEM;
+       }
+
+       ioc->debug_level = mpt_debug_level;
+       if (mpt_debug_level)
+               printk(KERN_INFO MYNAM ": mpt_debug_level=%xh\n", mpt_debug_level);
+
        if (pci_enable_device(pdev))
                return r;
 
-       dinitprintk((KERN_WARNING MYNAM ": mpt_adapter_install\n"));
+       dinitprintk(ioc, printk(KERN_WARNING MYNAM ": mpt_adapter_install\n"));
 
        if (!pci_set_dma_mask(pdev, DMA_64BIT_MASK)) {
-               dprintk((KERN_INFO MYNAM
+               dprintk(ioc, printk(KERN_INFO MYNAM
                        ": 64 BIT PCI BUS DMA ADDRESSING SUPPORTED\n"));
        } else if (pci_set_dma_mask(pdev, DMA_32BIT_MASK)) {
                printk(KERN_WARNING MYNAM ": 32 BIT PCI BUS DMA ADDRESSING NOT SUPPORTED\n");
                return r;
        }
 
-       if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK))
-               dprintk((KERN_INFO MYNAM
+       if (!pci_set_consistent_dma_mask(pdev, DMA_64BIT_MASK)) {
+               dprintk(ioc, printk(KERN_INFO MYNAM
                        ": Using 64 bit consistent mask\n"));
-       else
-               dprintk((KERN_INFO MYNAM
+       } else {
+               dprintk(ioc, printk(KERN_INFO MYNAM
                        ": Not using 64 bit consistent mask\n"));
-
-       ioc = kzalloc(sizeof(MPT_ADAPTER), GFP_ATOMIC);
-       if (ioc == NULL) {
-               printk(KERN_ERR MYNAM ": ERROR - Insufficient memory to add adapter!\n");
-               return -ENOMEM;
        }
+
        ioc->alloc_total = sizeof(MPT_ADAPTER);
        ioc->req_sz = MPT_DEFAULT_FRAME_SIZE;           /* avoid div by zero! */
        ioc->reply_sz = MPT_REPLY_FRAME_SIZE;
@@ -1502,9 +1506,9 @@ mpt_attach(struct pci_dev *pdev, const struct pci_device_id *id)
                return -EINVAL;
        }
        ioc->memmap = mem;
-       dinitprintk((KERN_INFO MYNAM ": mem = %p, mem_phys = %lx\n", mem, mem_phys));
+       dinitprintk(ioc, printk(KERN_INFO MYNAM ": mem = %p, mem_phys = %lx\n", mem, mem_phys));
 
-       dinitprintk((KERN_INFO MYNAM ": facts @ %p, pfacts[0] @ %p\n",
+       dinitprintk(ioc, printk(KERN_INFO MYNAM ": facts @ %p, pfacts[0] @ %p\n",
                        &ioc->facts, &ioc->pfacts[0]));
 
        ioc->mem_phys = mem_phys;
@@ -1830,6 +1834,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
        int      ret = 0;
        int      reset_alt_ioc_active = 0;
        int      irq_allocated = 0;
+       u8      *a;
 
        printk(KERN_INFO MYNAM ": Initiating %s %s\n",
                        ioc->name, reason==MPT_HOSTEVENT_IOC_BRINGUP ? "bringup" : "recovery");
@@ -1858,7 +1863,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
 
                        if (reset_alt_ioc_active && ioc->alt_ioc) {
                                /* (re)Enable alt-IOC! (reply interrupt, FreeQ) */
-                               dprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n",
+                               dprintk(ioc, printk(KERN_INFO MYNAM
+                                       ": alt-%s reply irq re-enabled\n",
                                                ioc->alt_ioc->name));
                                CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
                                ioc->alt_ioc->active = 1;
@@ -1891,7 +1897,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
 
 
        if (ii == 5) {
-               dinitprintk((MYIOC_s_INFO_FMT "Retry IocFacts failed rc=%x\n", ioc->name, rc));
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Retry IocFacts failed rc=%x\n", ioc->name, rc));
                ret = -2;
        } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
                MptDisplayIocCapabilities(ioc);
@@ -1899,13 +1905,15 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
 
        if (alt_ioc_ready) {
                if ((rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason)) != 0) {
-                       dinitprintk((MYIOC_s_INFO_FMT "Initial Alt IocFacts failed rc=%x\n", ioc->name, rc));
+                       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                               "Initial Alt IocFacts failed rc=%x\n", ioc->name, rc));
                        /* Retry - alt IOC was initialized once
                         */
                        rc = GetIocFacts(ioc->alt_ioc, sleepFlag, reason);
                }
                if (rc) {
-                       dinitprintk((MYIOC_s_INFO_FMT "Retry Alt IocFacts failed rc=%x\n", ioc->name, rc));
+                       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                               "Retry Alt IocFacts failed rc=%x\n", ioc->name, rc));
                        alt_ioc_ready = 0;
                        reset_alt_ioc_active = 0;
                } else if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
@@ -1938,7 +1946,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                        ioc->pci_irq = ioc->pcidev->irq;
                        pci_set_master(ioc->pcidev);            /* ?? */
                        pci_set_drvdata(ioc->pcidev, ioc);
-                       dprintk((KERN_INFO MYNAM ": %s installed at interrupt "
+                       dprintk(ioc, printk(KERN_INFO MYNAM ": %s installed at interrupt "
                                "%d\n", ioc->name, ioc->pcidev->irq));
                }
        }
@@ -1976,7 +1984,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
 
        if (reason == MPT_HOSTEVENT_IOC_BRINGUP){
                if (ioc->upload_fw) {
-                       ddlprintk((MYIOC_s_INFO_FMT
+                       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                                "firmware upload required!\n", ioc->name));
 
                        /* Controller is not operational, cannot do upload
@@ -1992,7 +2000,8 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                                                 * chips (mpt_adapter_disable,
                                                 * mpt_diag_reset)
                                                 */
-                                               ddlprintk((MYIOC_s_INFO_FMT ": mpt_upload:  alt_%s has cached_fw=%p \n",
+                                               ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                                       ": mpt_upload:  alt_%s has cached_fw=%p \n",
                                                        ioc->name, ioc->alt_ioc->name, ioc->alt_ioc->cached_fw));
                                                ioc->alt_ioc->cached_fw = NULL;
                                        }
@@ -2012,7 +2021,7 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
 
        if (reset_alt_ioc_active && ioc->alt_ioc) {
                /* (re)Enable alt-IOC! (reply interrupt) */
-               dinitprintk((KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n",
+               dinitprintk(ioc, printk(KERN_INFO MYNAM ": alt-%s reply irq re-enabled\n",
                                ioc->alt_ioc->name));
                CHIPREG_WRITE32(&ioc->alt_ioc->chip->IntMask, MPI_HIM_DIM);
                ioc->alt_ioc->active = 1;
@@ -2064,13 +2073,13 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                                 *  (LANPage1_t stuff)
                                 */
                                (void) GetLanConfigPages(ioc);
-#ifdef MPT_DEBUG
-                               {
-                                       u8 *a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
-                                       dprintk((MYIOC_s_INFO_FMT "LanAddr = %02X:%02X:%02X:%02X:%02X:%02X\n",
-                                                       ioc->name, a[5], a[4], a[3], a[2], a[1], a[0] ));
-                               }
-#endif
+                               a = (u8*)&ioc->lan_cnfg_page1.HardwareAddressLow;
+                               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "LanAddr = %02X:%02X:%02X:"
+                                       "%02X:%02X:%02X\n",
+                                       ioc->name, a[5], a[4],
+                                       a[3], a[2], a[1], a[0] ));
+
                        }
                } else {
                        /* Get NVRAM and adapter maximums from SPP 0 and 2
@@ -2107,15 +2116,17 @@ mpt_do_ioc_recovery(MPT_ADAPTER *ioc, u32 reason, int sleepFlag)
                rc = handlers = 0;
                for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
                        if ((ret == 0) && MptResetHandlers[ii]) {
-                               dprintk((MYIOC_s_INFO_FMT "Calling IOC post_reset handler #%d\n",
-                                               ioc->name, ii));
+                               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "Calling IOC post_reset handler #%d\n",
+                                       ioc->name, ii));
                                rc += mpt_signal_reset(ii, ioc, MPT_IOC_POST_RESET);
                                handlers++;
                        }
 
                        if (alt_ioc_ready && MptResetHandlers[ii]) {
-                               drsprintk((MYIOC_s_INFO_FMT "Calling alt-%s post_reset handler #%d\n",
-                                               ioc->name, ioc->alt_ioc->name, ii));
+                               drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "Calling alt-%s post_reset handler #%d\n",
+                                       ioc->name, ioc->alt_ioc->name, ii));
                                rc += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_POST_RESET);
                                handlers++;
                        }
@@ -2153,7 +2164,7 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
        unsigned int func = PCI_FUNC(pdev->devfn);
        MPT_ADAPTER *ioc_srch;
 
-       dprintk((MYIOC_s_INFO_FMT "PCI device %s devfn=%x/%x,"
+       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "PCI device %s devfn=%x/%x,"
            " searching for devfn match on %x or %x\n",
                ioc->name, pci_name(pdev), pdev->bus->number,
                pdev->devfn, func-1, func+1));
@@ -2178,7 +2189,7 @@ mpt_detect_bound_ports(MPT_ADAPTER *ioc, struct pci_dev *pdev)
                                        ioc_srch->name, ioc_srch->alt_ioc->name);
                                break;
                        }
-                       dprintk((KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n",
+                       dprintk(ioc, printk(KERN_INFO MYNAM ": FOUND! binding %s <==> %s\n",
                                ioc->name, ioc_srch->name));
                        ioc_srch->alt_ioc = ioc;
                        ioc->alt_ioc = ioc_srch;
@@ -2199,7 +2210,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
        int ret;
 
        if (ioc->cached_fw != NULL) {
-               ddlprintk((KERN_INFO MYNAM ": mpt_adapter_disable: Pushing FW onto adapter\n"));
+               ddlprintk(ioc, printk(KERN_INFO MYNAM ": mpt_adapter_disable: Pushing FW onto adapter\n"));
                if ((ret = mpt_downloadboot(ioc, (MpiFwHeader_t *)ioc->cached_fw, NO_SLEEP)) < 0) {
                        printk(KERN_WARNING MYNAM
                                ": firmware downloadboot failure (%d)!\n", ret);
@@ -2214,7 +2225,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
 
        if (ioc->alloc != NULL) {
                sz = ioc->alloc_sz;
-               dexitprintk((KERN_INFO MYNAM ": %s.free  @ %p, sz=%d bytes\n",
+               dexitprintk(ioc, printk(KERN_INFO MYNAM ": %s.free  @ %p, sz=%d bytes\n",
                        ioc->name, ioc->alloc, ioc->alloc_sz));
                pci_free_consistent(ioc->pcidev, sz,
                                ioc->alloc, ioc->alloc_dma);
@@ -2256,7 +2267,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
 
        if (ioc->spi_data.pIocPg4 != NULL) {
                sz = ioc->spi_data.IocPg4Sz;
-               pci_free_consistent(ioc->pcidev, sz, 
+               pci_free_consistent(ioc->pcidev, sz,
                        ioc->spi_data.pIocPg4,
                        ioc->spi_data.IocPg4_dma);
                ioc->spi_data.pIocPg4 = NULL;
@@ -2279,7 +2290,7 @@ mpt_adapter_disable(MPT_ADAPTER *ioc)
                           ": %s: host page buffers free failed (%d)!\n",
                            __FUNCTION__, ret);
                }
-               dexitprintk((KERN_INFO MYNAM ": %s HostPageBuffer free  @ %p, sz=%d bytes\n",
+               dexitprintk(ioc, printk(KERN_INFO MYNAM ": %s HostPageBuffer free  @ %p, sz=%d bytes\n",
                        ioc->name, ioc->HostPageBuffer, ioc->HostPageBuffer_sz));
                pci_free_consistent(ioc->pcidev, ioc->HostPageBuffer_sz,
                                ioc->HostPageBuffer,
@@ -2325,7 +2336,7 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
 #if defined(CONFIG_MTRR) && 0
        if (ioc->mtrr_reg > 0) {
                mtrr_del(ioc->mtrr_reg, 0, 0);
-               dprintk((KERN_INFO MYNAM ": %s: MTRR region de-registered\n", ioc->name));
+               dprintk(ioc, printk(KERN_INFO MYNAM ": %s: MTRR region de-registered\n", ioc->name));
        }
 #endif
 
@@ -2333,7 +2344,7 @@ mpt_adapter_dispose(MPT_ADAPTER *ioc)
        list_del(&ioc->list);
 
        sz_last = ioc->alloc_total;
-       dprintk((KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n",
+       dprintk(ioc, printk(KERN_INFO MYNAM ": %s: free'd %d of %d bytes\n",
                        ioc->name, sz_first-sz_last+(int)sizeof(*ioc), sz_first));
 
        if (ioc->alt_ioc)
@@ -2413,7 +2424,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
 
        /* Get current [raw] IOC state  */
        ioc_state = mpt_GetIocState(ioc, 0);
-       dhsprintk((KERN_INFO MYNAM "::MakeIocReady, %s [raw] state=%08x\n", ioc->name, ioc_state));
+       dhsprintk(ioc, printk(KERN_INFO MYNAM "::MakeIocReady, %s [raw] state=%08x\n", ioc->name, ioc_state));
 
        /*
         *      Check to see if IOC got left/stuck in doorbell handshake
@@ -2444,7 +2455,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
         *      Hmmm...  Did it get left operational?
         */
        if ((ioc_state & MPI_IOC_STATE_MASK) == MPI_IOC_STATE_OPERATIONAL) {
-               dinitprintk((MYIOC_s_INFO_FMT "IOC operational unexpected\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "IOC operational unexpected\n",
                                ioc->name));
 
                /* Check WhoInit.
@@ -2453,7 +2464,7 @@ MakeIocReady(MPT_ADAPTER *ioc, int force, int sleepFlag)
                 * Else, fall through to KickStart case
                 */
                whoinit = (ioc_state & MPI_DOORBELL_WHO_INIT_MASK) >> MPI_DOORBELL_WHO_INIT_SHIFT;
-               dinitprintk((KERN_INFO MYNAM
+               dinitprintk(ioc, printk(KERN_INFO MYNAM
                        ": whoinit 0x%x statefault %d force %d\n",
                        whoinit, statefault, force));
                if (whoinit == MPI_WHOINIT_PCI_PEER)
@@ -2589,7 +2600,7 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
        get_facts.Function = MPI_FUNCTION_IOC_FACTS;
        /* Assert: All other get_facts fields are zero! */
 
-       dinitprintk((MYIOC_s_INFO_FMT
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
            "Sending get IocFacts request req_sz=%d reply_sz=%d\n",
            ioc->name, req_sz, reply_sz));
 
@@ -2691,8 +2702,9 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
                        sz = sz >> 1;
                }
                ioc->NBShiftFactor  = shiftFactor;
-               dinitprintk((MYIOC_s_INFO_FMT "NB_for_64_byte_frame=%x NBShiftFactor=%x BlockSize=%x\n",
-                                       ioc->name, vv, shiftFactor, r));
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                       "NB_for_64_byte_frame=%x NBShiftFactor=%x BlockSize=%x\n",
+                       ioc->name, vv, shiftFactor, r));
 
                if (reason == MPT_HOSTEVENT_IOC_BRINGUP) {
                        /*
@@ -2704,9 +2716,9 @@ GetIocFacts(MPT_ADAPTER *ioc, int sleepFlag, int reason)
                        ioc->reply_sz = MPT_REPLY_FRAME_SIZE;
                        ioc->reply_depth = min_t(int, MPT_DEFAULT_REPLY_DEPTH, facts->ReplyQueueDepth);
 
-                       dinitprintk((MYIOC_s_INFO_FMT "reply_sz=%3d, reply_depth=%4d\n",
+                       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "reply_sz=%3d, reply_depth=%4d\n",
                                ioc->name, ioc->reply_sz, ioc->reply_depth));
-                       dinitprintk((MYIOC_s_INFO_FMT "req_sz  =%3d, req_depth  =%4d\n",
+                       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "req_sz  =%3d, req_depth  =%4d\n",
                                ioc->name, ioc->req_sz, ioc->req_depth));
 
                        /* Get port facts! */
@@ -2765,7 +2777,7 @@ GetPortFacts(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
        get_pfacts.PortNumber = portnum;
        /* Assert: All other get_pfacts fields are zero! */
 
-       dinitprintk((MYIOC_s_INFO_FMT "Sending get PortFacts(%d) request\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending get PortFacts(%d) request\n",
                        ioc->name, portnum));
 
        /* No non-zero fields in the get_pfacts request are greater than
@@ -2841,12 +2853,12 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
                ioc->upload_fw = 1;
        else
                ioc->upload_fw = 0;
-       ddlprintk((MYIOC_s_INFO_FMT "upload_fw %d facts.Flags=%x\n",
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "upload_fw %d facts.Flags=%x\n",
                   ioc->name, ioc->upload_fw, ioc->facts.Flags));
 
        ioc_init.MaxDevices = (U8)ioc->devices_per_bus;
        ioc_init.MaxBuses = (U8)ioc->number_of_buses;
-       dinitprintk((MYIOC_s_INFO_FMT "facts.MsgVersion=%x\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "facts.MsgVersion=%x\n",
                   ioc->name, ioc->facts.MsgVersion));
        if (ioc->facts.MsgVersion >= MPI_VERSION_01_05) {
                // set MsgVersion and HeaderVersion host driver was built with
@@ -2877,7 +2889,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
        ioc->facts.MaxDevices = ioc_init.MaxDevices;
        ioc->facts.MaxBuses = ioc_init.MaxBuses;
 
-       dhsprintk((MYIOC_s_INFO_FMT "Sending IOCInit (req @ %p)\n",
+       dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending IOCInit (req @ %p)\n",
                        ioc->name, &ioc_init));
 
        r = mpt_handshake_req_reply_wait(ioc, sizeof(IOCInit_t), (u32*)&ioc_init,
@@ -2891,7 +2903,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
         * since we don't even look at its contents.
         */
 
-       dhsprintk((MYIOC_s_INFO_FMT "Sending PortEnable (req @ %p)\n",
+       dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending PortEnable (req @ %p)\n",
                        ioc->name, &ioc_init));
 
        if ((r = SendPortEnable(ioc, 0, sleepFlag)) != 0) {
@@ -2922,7 +2934,7 @@ SendIocInit(MPT_ADAPTER *ioc, int sleepFlag)
                state = mpt_GetIocState(ioc, 1);
                count++;
        }
-       dinitprintk((MYIOC_s_INFO_FMT "INFO - Wait IOC_OPERATIONAL state (cnt=%d)\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "INFO - Wait IOC_OPERATIONAL state (cnt=%d)\n",
                        ioc->name, count));
 
        ioc->aen_event_read_flag=0;
@@ -2962,7 +2974,7 @@ SendPortEnable(MPT_ADAPTER *ioc, int portnum, int sleepFlag)
 /*     port_enable.MsgFlags = 0;               */
 /*     port_enable.MsgContext = 0;             */
 
-       dinitprintk((MYIOC_s_INFO_FMT "Sending Port(%d)Enable (req @ %p)\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Port(%d)Enable (req @ %p)\n",
                        ioc->name, portnum, &port_enable));
 
        /* RAID FW may take a long time to enable
@@ -3015,7 +3027,7 @@ mpt_free_fw_memory(MPT_ADAPTER *ioc)
        int sz;
 
        sz = ioc->facts.FWImageSize;
-       dinitprintk((KERN_INFO MYNAM "free_fw_memory: FW Image  @ %p[%p], sz=%d[%x] bytes\n",
+       dinitprintk(ioc, printk(KERN_INFO MYNAM "free_fw_memory: FW Image  @ %p[%p], sz=%d[%x] bytes\n",
                 ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz));
        pci_free_consistent(ioc->pcidev, sz,
                        ioc->cached_fw, ioc->cached_fw_dma);
@@ -3059,7 +3071,7 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
 
        mpt_alloc_fw_memory(ioc, sz);
 
-       dinitprintk((KERN_INFO MYNAM ": FW Image  @ %p[%p], sz=%d[%x] bytes\n",
+       dinitprintk(ioc, printk(KERN_INFO MYNAM ": FW Image  @ %p[%p], sz=%d[%x] bytes\n",
                 ioc->cached_fw, (void *)(ulong)ioc->cached_fw_dma, sz, sz));
 
        if (ioc->cached_fw == NULL) {
@@ -3091,14 +3103,14 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
        mpt_add_sge(&request[sgeoffset], flagsLength, ioc->cached_fw_dma);
 
        sgeoffset += sizeof(u32) + sizeof(dma_addr_t);
-       dinitprintk((KERN_INFO MYNAM ": Sending FW Upload (req @ %p) sgeoffset=%d \n",
+       dinitprintk(ioc, printk(KERN_INFO MYNAM ": Sending FW Upload (req @ %p) sgeoffset=%d \n",
                        prequest, sgeoffset));
-       DBG_DUMP_FW_REQUEST_FRAME(prequest)
+       DBG_DUMP_FW_REQUEST_FRAME(ioc, (u32 *)prequest)
 
        ii = mpt_handshake_req_reply_wait(ioc, sgeoffset, (u32*)prequest,
                                reply_sz, (u16*)preply, 65 /*seconds*/, sleepFlag);
 
-       dinitprintk((KERN_INFO MYNAM ": FW Upload completed rc=%x \n", ii));
+       dinitprintk(ioc, printk(KERN_INFO MYNAM ": FW Upload completed rc=%x \n", ii));
 
        cmdStatus = -EFAULT;
        if (ii == 0) {
@@ -3113,13 +3125,13 @@ mpt_do_upload(MPT_ADAPTER *ioc, int sleepFlag)
                                cmdStatus = 0;
                }
        }
-       dinitprintk((MYIOC_s_INFO_FMT ": do_upload cmdStatus=%d \n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": do_upload cmdStatus=%d \n",
                        ioc->name, cmdStatus));
 
 
        if (cmdStatus) {
 
-               ddlprintk((MYIOC_s_INFO_FMT ": fw upload failed, freeing image \n",
+               ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": fw upload failed, freeing image \n",
                        ioc->name));
                mpt_free_fw_memory(ioc);
        }
@@ -3154,7 +3166,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
        u32                      load_addr;
        u32                      ioc_state=0;
 
-       ddlprintk((MYIOC_s_INFO_FMT "downloadboot: fw size 0x%x (%d), FW Ptr %p\n",
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot: fw size 0x%x (%d), FW Ptr %p\n",
                                ioc->name, pFwHeader->ImageSize, pFwHeader->ImageSize, pFwHeader));
 
        CHIPREG_WRITE32(&ioc->chip->WriteSequence, 0xFF);
@@ -3179,7 +3191,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
        for (count = 0; count < 30; count ++) {
                diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
                if (!(diag0val & MPI_DIAG_RESET_ADAPTER)) {
-                       ddlprintk((MYIOC_s_INFO_FMT "RESET_ADAPTER cleared, count=%d\n",
+                       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RESET_ADAPTER cleared, count=%d\n",
                                ioc->name, count));
                        break;
                }
@@ -3192,7 +3204,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
        }
 
        if ( count == 30 ) {
-               ddlprintk((MYIOC_s_INFO_FMT "downloadboot failed! "
+               ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot failed! "
                "Unable to get MPI_DIAG_DRWE mode, diag0val=%x\n",
                ioc->name, diag0val));
                return -3;
@@ -3218,10 +3230,10 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
                pci_enable_io_access(ioc->pcidev);
 
        CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->LoadStartAddress);
-       ddlprintk((MYIOC_s_INFO_FMT "LoadStart addr written 0x%x \n",
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "LoadStart addr written 0x%x \n",
                ioc->name, pFwHeader->LoadStartAddress));
 
-       ddlprintk((MYIOC_s_INFO_FMT "Write FW Image: 0x%x bytes @ %p\n",
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write FW Image: 0x%x bytes @ %p\n",
                                ioc->name, fwSize*4, ptrFw));
        while (fwSize--) {
                CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, *ptrFw++);
@@ -3236,7 +3248,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
                fwSize = (pExtImage->ImageSize + 3) >> 2;
                ptrFw = (u32 *)pExtImage;
 
-               ddlprintk((MYIOC_s_INFO_FMT "Write Ext Image: 0x%x (%d) bytes @ %p load_addr=%x\n",
+               ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write Ext Image: 0x%x (%d) bytes @ %p load_addr=%x\n",
                                                ioc->name, fwSize*4, fwSize*4, ptrFw, load_addr));
                CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, load_addr);
 
@@ -3247,11 +3259,11 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
        }
 
        /* Write the IopResetVectorRegAddr */
-       ddlprintk((MYIOC_s_INFO_FMT "Write IopResetVector Addr=%x! \n", ioc->name,      pFwHeader->IopResetRegAddr));
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Addr=%x! \n", ioc->name,  pFwHeader->IopResetRegAddr));
        CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwAddress, pFwHeader->IopResetRegAddr);
 
        /* Write the IopResetVectorValue */
-       ddlprintk((MYIOC_s_INFO_FMT "Write IopResetVector Value=%x! \n", ioc->name, pFwHeader->IopResetVectorValue));
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Write IopResetVector Value=%x! \n", ioc->name, pFwHeader->IopResetVectorValue));
        CHIPREG_PIO_WRITE32(&ioc->pio_chip->DiagRwData, pFwHeader->IopResetVectorValue);
 
        /* Clear the internal flash bad bit - autoincrementing register,
@@ -3285,11 +3297,11 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
                pci_disable_io_access(ioc->pcidev);
 
        diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
-       ddlprintk((MYIOC_s_INFO_FMT "downloadboot diag0val=%x, "
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot diag0val=%x, "
                "turning off PREVENT_IOC_BOOT, DISABLE_ARM, RW_ENABLE\n",
                ioc->name, diag0val));
        diag0val &= ~(MPI_DIAG_PREVENT_IOC_BOOT | MPI_DIAG_DISABLE_ARM | MPI_DIAG_RW_ENABLE);
-       ddlprintk((MYIOC_s_INFO_FMT "downloadboot now diag0val=%x\n",
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "downloadboot now diag0val=%x\n",
                ioc->name, diag0val));
        CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val);
 
@@ -3300,7 +3312,7 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
                ioc_state = mpt_GetIocState(ioc, 0);
                if ( (GetIocFacts(ioc, sleepFlag,
                                MPT_HOSTEVENT_IOC_BRINGUP)) != 0 ) {
-                       ddlprintk((MYIOC_s_INFO_FMT "GetIocFacts failed: IocState=%x\n",
+                       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "GetIocFacts failed: IocState=%x\n",
                                        ioc->name, ioc_state));
                        return -EFAULT;
                }
@@ -3308,17 +3320,20 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
 
        for (count=0; count<HZ*20; count++) {
                if ((ioc_state = mpt_GetIocState(ioc, 0)) & MPI_IOC_STATE_READY) {
-                       ddlprintk((MYIOC_s_INFO_FMT "downloadboot successful! (count=%d) IocState=%x\n",
-                                       ioc->name, count, ioc_state));
+                       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                               "downloadboot successful! (count=%d) IocState=%x\n",
+                               ioc->name, count, ioc_state));
                        if (ioc->bus_type == SAS) {
                                return 0;
                        }
                        if ((SendIocInit(ioc, sleepFlag)) != 0) {
-                               ddlprintk((MYIOC_s_INFO_FMT "downloadboot: SendIocInit failed\n",
+                               ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "downloadboot: SendIocInit failed\n",
                                        ioc->name));
                                return -EFAULT;
                        }
-                       ddlprintk((MYIOC_s_INFO_FMT "downloadboot: SendIocInit successful\n",
+                       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "downloadboot: SendIocInit successful\n",
                                        ioc->name));
                        return 0;
                }
@@ -3328,8 +3343,8 @@ mpt_downloadboot(MPT_ADAPTER *ioc, MpiFwHeader_t *pFwHeader, int sleepFlag)
                        mdelay (10);
                }
        }
-       ddlprintk((MYIOC_s_INFO_FMT "downloadboot failed! IocState=%x\n",
-               ioc->name, ioc_state));
+       ddlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+               "downloadboot failed! IocState=%x\n",ioc->name, ioc_state));
        return -EFAULT;
 }
 
@@ -3366,7 +3381,7 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
        u32 ioc_state=0;
        int cnt,cntdn;
 
-       dinitprintk((KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name));
+       dinitprintk(ioc, printk(KERN_WARNING MYNAM ": KickStarting %s!\n", ioc->name));
        if (ioc->bus_type == SPI) {
                /* Always issue a Msg Unit Reset first. This will clear some
                 * SCSI bus hang conditions.
@@ -3384,14 +3399,14 @@ KickStart(MPT_ADAPTER *ioc, int force, int sleepFlag)
        if (hard_reset_done < 0)
                return hard_reset_done;
 
-       dinitprintk((MYIOC_s_INFO_FMT "Diagnostic reset successful!\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Diagnostic reset successful!\n",
                        ioc->name));
 
        cntdn = ((sleepFlag == CAN_SLEEP) ? HZ : 1000) * 2;     /* 2 seconds */
        for (cnt=0; cnt<cntdn; cnt++) {
                ioc_state = mpt_GetIocState(ioc, 1);
                if ((ioc_state == MPI_IOC_STATE_READY) || (ioc_state == MPI_IOC_STATE_OPERATIONAL)) {
-                       dinitprintk((MYIOC_s_INFO_FMT "KickStart successful! (cnt=%d)\n",
+                       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "KickStart successful! (cnt=%d)\n",
                                        ioc->name, cnt));
                        return hard_reset_done;
                }
@@ -3434,15 +3449,13 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
        u32 doorbell;
        int hard_reset_done = 0;
        int count = 0;
-#ifdef MPT_DEBUG
        u32 diag1val = 0;
-#endif
 
        /* Clear any existing interrupts */
        CHIPREG_WRITE32(&ioc->chip->IntStatus, 0);
 
        if (ioc->pcidev->device == MPI_MANUFACTPAGE_DEVID_SAS1078) {
-               drsprintk((MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset "
+               drsprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: Doorbell=%p; 1078 reset "
                        "address=%p\n",  ioc->name, __FUNCTION__,
                        &ioc->chip->Doorbell, &ioc->chip->Reset_1078));
                CHIPREG_WRITE32(&ioc->chip->Reset_1078, 0x07);
@@ -3455,7 +3468,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
                        doorbell = CHIPREG_READ32(&ioc->chip->Doorbell);
                        doorbell &= MPI_IOC_STATE_MASK;
 
-                       drsprintk((MYIOC_s_INFO_FMT
+                       drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                                "looking for READY STATE: doorbell=%x"
                                " count=%d\n",
                                ioc->name, doorbell, count));
@@ -3475,12 +3488,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
        /* Use "Diagnostic reset" method! (only thing available!) */
        diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
 
-#ifdef MPT_DEBUG
-       if (ioc->alt_ioc)
-               diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
-       dprintk((MYIOC_s_INFO_FMT "DbG1: diag0=%08x, diag1=%08x\n",
+       if (ioc->debug_level & MPT_DEBUG) {
+               if (ioc->alt_ioc)
+                       diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG1: diag0=%08x, diag1=%08x\n",
                        ioc->name, diag0val, diag1val));
-#endif
+       }
 
        /* Do the reset if we are told to ignore the reset history
         * or if the reset history is 0
@@ -3514,16 +3527,16 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
 
                        diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
 
-                       dprintk((MYIOC_s_INFO_FMT "Wrote magic DiagWriteEn sequence (%x)\n",
+                       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Wrote magic DiagWriteEn sequence (%x)\n",
                                        ioc->name, diag0val));
                }
 
-#ifdef MPT_DEBUG
-               if (ioc->alt_ioc)
-                       diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
-               dprintk((MYIOC_s_INFO_FMT "DbG2: diag0=%08x, diag1=%08x\n",
+               if (ioc->debug_level & MPT_DEBUG) {
+                       if (ioc->alt_ioc)
+                               diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
+                       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG2: diag0=%08x, diag1=%08x\n",
                                ioc->name, diag0val, diag1val));
-#endif
+               }
                /*
                 * Disable the ARM (Bug fix)
                 *
@@ -3537,7 +3550,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
                 */
                CHIPREG_WRITE32(&ioc->chip->Diagnostic, diag0val | MPI_DIAG_RESET_ADAPTER);
                hard_reset_done = 1;
-               dprintk((MYIOC_s_INFO_FMT "Diagnostic reset performed\n",
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Diagnostic reset performed\n",
                                ioc->name));
 
                /*
@@ -3552,12 +3565,14 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
 
                        for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
                                if (MptResetHandlers[ii]) {
-                                       dprintk((MYIOC_s_INFO_FMT "Calling IOC pre_reset handler #%d\n",
-                                                       ioc->name, ii));
+                                       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                               "Calling IOC pre_reset handler #%d\n",
+                                               ioc->name, ii));
                                        r += mpt_signal_reset(ii, ioc, MPT_IOC_PRE_RESET);
                                        if (ioc->alt_ioc) {
-                                               dprintk((MYIOC_s_INFO_FMT "Calling alt-%s pre_reset handler #%d\n",
-                                                               ioc->name, ioc->alt_ioc->name, ii));
+                                               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                                       "Calling alt-%s pre_reset handler #%d\n",
+                                                       ioc->name, ioc->alt_ioc->name, ii));
                                                r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_PRE_RESET);
                                        }
                                }
@@ -3580,7 +3595,7 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
                                        break;
                                }
 
-                               dprintk((MYIOC_s_INFO_FMT "cached_fw: diag0val=%x count=%d\n",
+                               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "cached_fw: diag0val=%x count=%d\n",
                                        iocp->name, diag0val, count));
                                /* wait 1 sec */
                                if (sleepFlag == CAN_SLEEP) {
@@ -3621,12 +3636,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
        }
 
        diag0val = CHIPREG_READ32(&ioc->chip->Diagnostic);
-#ifdef MPT_DEBUG
-       if (ioc->alt_ioc)
-               diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
-       dprintk((MYIOC_s_INFO_FMT "DbG3: diag0=%08x, diag1=%08x\n",
-               ioc->name, diag0val, diag1val));
-#endif
+       if (ioc->debug_level & MPT_DEBUG) {
+               if (ioc->alt_ioc)
+                       diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG3: diag0=%08x, diag1=%08x\n",
+                       ioc->name, diag0val, diag1val));
+       }
 
        /* Clear RESET_HISTORY bit!  Place board in the
         * diagnostic mode to update the diag register.
@@ -3680,12 +3695,12 @@ mpt_diag_reset(MPT_ADAPTER *ioc, int ignore, int sleepFlag)
                return -3;
        }
 
-#ifdef MPT_DEBUG
-       if (ioc->alt_ioc)
-               diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
-       dprintk((MYIOC_s_INFO_FMT "DbG4: diag0=%08x, diag1=%08x\n",
+       if (ioc->debug_level & MPT_DEBUG) {
+               if (ioc->alt_ioc)
+                       diag1val = CHIPREG_READ32(&ioc->alt_ioc->chip->Diagnostic);
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "DbG4: diag0=%08x, diag1=%08x\n",
                        ioc->name, diag0val, diag1val));
-#endif
+       }
 
        /*
         * Reset flag that says we've enabled event notification
@@ -3717,7 +3732,7 @@ SendIocReset(MPT_ADAPTER *ioc, u8 reset_type, int sleepFlag)
        u32 state;
        int cntdn, count;
 
-       drsprintk((KERN_INFO MYNAM ": %s: Sending IOC reset(0x%02x)!\n",
+       drsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending IOC reset(0x%02x)!\n",
                        ioc->name, reset_type));
        CHIPREG_WRITE32(&ioc->chip->Doorbell, reset_type<<MPI_DOORBELL_FUNCTION_SHIFT);
        if ((r = WaitForDoorbellAck(ioc, 5, sleepFlag)) < 0)
@@ -3782,14 +3797,14 @@ initChainBuffers(MPT_ADAPTER *ioc)
                        return -1;
 
                ioc->ReqToChain = (int *) mem;
-               dinitprintk((KERN_INFO MYNAM ": %s ReqToChain alloc  @ %p, sz=%d bytes\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReqToChain alloc  @ %p, sz=%d bytes\n",
                                ioc->name, mem, sz));
                mem = kmalloc(sz, GFP_ATOMIC);
                if (mem == NULL)
                        return -1;
 
                ioc->RequestNB = (int *) mem;
-               dinitprintk((KERN_INFO MYNAM ": %s RequestNB alloc  @ %p, sz=%d bytes\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestNB alloc  @ %p, sz=%d bytes\n",
                                ioc->name, mem, sz));
        }
        for (ii = 0; ii < ioc->req_depth; ii++) {
@@ -3819,7 +3834,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
                numSGE = 1 + (scale - 1) * (ioc->facts.MaxChainDepth-1) + scale +
                        (ioc->req_sz - 64) / (sizeof(dma_addr_t) + sizeof(u32));
        }
-       dinitprintk((KERN_INFO MYNAM ": %s num_sge=%d numSGE=%d\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "num_sge=%d numSGE=%d\n",
                ioc->name, num_sge, numSGE));
 
        if ( numSGE > MPT_SCSI_SG_DEPTH )
@@ -3832,7 +3847,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
        }
        num_chain++;
 
-       dinitprintk((KERN_INFO MYNAM ": %s Now numSGE=%d num_sge=%d num_chain=%d\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Now numSGE=%d num_sge=%d num_chain=%d\n",
                ioc->name, numSGE, num_sge, num_chain));
 
        if (ioc->bus_type == SPI)
@@ -3849,7 +3864,7 @@ initChainBuffers(MPT_ADAPTER *ioc)
                        return -1;
 
                ioc->ChainToChain = (int *) mem;
-               dinitprintk((KERN_INFO MYNAM ": %s ChainToChain alloc @ %p, sz=%d bytes\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainToChain alloc @ %p, sz=%d bytes\n",
                                ioc->name, mem, sz));
        } else {
                mem = (u8 *) ioc->ChainToChain;
@@ -3885,22 +3900,22 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
                        return -1;
 
                total_size = reply_sz = (ioc->reply_sz * ioc->reply_depth);
-               dinitprintk((KERN_INFO MYNAM ": %s.ReplyBuffer sz=%d bytes, ReplyDepth=%d\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffer sz=%d bytes, ReplyDepth=%d\n",
                                ioc->name, ioc->reply_sz, ioc->reply_depth));
-               dinitprintk((KERN_INFO MYNAM ": %s.ReplyBuffer sz=%d[%x] bytes\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffer sz=%d[%x] bytes\n",
                                ioc->name, reply_sz, reply_sz));
 
                sz = (ioc->req_sz * ioc->req_depth);
-               dinitprintk((KERN_INFO MYNAM ": %s.RequestBuffer sz=%d bytes, RequestDepth=%d\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestBuffer sz=%d bytes, RequestDepth=%d\n",
                                ioc->name, ioc->req_sz, ioc->req_depth));
-               dinitprintk((KERN_INFO MYNAM ": %s.RequestBuffer sz=%d[%x] bytes\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestBuffer sz=%d[%x] bytes\n",
                                ioc->name, sz, sz));
                total_size += sz;
 
                sz = num_chain * ioc->req_sz; /* chain buffer pool size */
-               dinitprintk((KERN_INFO MYNAM ": %s.ChainBuffer sz=%d bytes, ChainDepth=%d\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainBuffer sz=%d bytes, ChainDepth=%d\n",
                                ioc->name, ioc->req_sz, num_chain));
-               dinitprintk((KERN_INFO MYNAM ": %s.ChainBuffer sz=%d[%x] bytes num_chain=%d\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainBuffer sz=%d[%x] bytes num_chain=%d\n",
                                ioc->name, sz, sz, num_chain));
 
                total_size += sz;
@@ -3911,7 +3926,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
                        goto out_fail;
                }
 
-               dinitprintk((KERN_INFO MYNAM ": %s.Total alloc @ %p[%p], sz=%d[%x] bytes\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Total alloc @ %p[%p], sz=%d[%x] bytes\n",
                                ioc->name, mem, (void *)(ulong)alloc_dma, total_size, total_size));
 
                memset(mem, 0, total_size);
@@ -3922,7 +3937,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
                ioc->reply_frames = (MPT_FRAME_HDR *) mem;
                ioc->reply_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF);
 
-               dinitprintk((KERN_INFO MYNAM ": %s ReplyBuffers @ %p[%p]\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffers @ %p[%p]\n",
                        ioc->name, ioc->reply_frames, (void *)(ulong)alloc_dma));
 
                alloc_dma += reply_sz;
@@ -3933,7 +3948,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
                ioc->req_frames = (MPT_FRAME_HDR *) mem;
                ioc->req_frames_dma = alloc_dma;
 
-               dinitprintk((KERN_INFO MYNAM ": %s RequestBuffers @ %p[%p]\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "RequestBuffers @ %p[%p]\n",
                                ioc->name, mem, (void *)(ulong)alloc_dma));
 
                ioc->req_frames_low_dma = (u32) (alloc_dma & 0xFFFFFFFF);
@@ -3947,7 +3962,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
                ioc->mtrr_reg = mtrr_add(ioc->req_frames_dma,
                                         sz,
                                         MTRR_TYPE_WRCOMB, 1);
-               dprintk((MYIOC_s_INFO_FMT "MTRR region registered (base:size=%08x:%x)\n",
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MTRR region registered (base:size=%08x:%x)\n",
                                ioc->name, ioc->req_frames_dma, sz));
 #endif
 
@@ -3959,7 +3974,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
                ioc->ChainBuffer = mem;
                ioc->ChainBufferDMA = alloc_dma;
 
-               dinitprintk((KERN_INFO MYNAM " :%s ChainBuffers @ %p(%p)\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ChainBuffers @ %p(%p)\n",
                        ioc->name, ioc->ChainBuffer, (void *)(ulong)ioc->ChainBufferDMA));
 
                /* Initialize the free chain Q.
@@ -4004,7 +4019,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
 
                ioc->sense_buf_low_dma = (u32) (ioc->sense_buf_pool_dma & 0xFFFFFFFF);
                ioc->alloc_total += sz;
-               dinitprintk((KERN_INFO MYNAM ": %s.SenseBuffers @ %p[%p]\n",
+               dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SenseBuffers @ %p[%p]\n",
                        ioc->name, ioc->sense_buf_pool, (void *)(ulong)ioc->sense_buf_pool_dma));
 
        }
@@ -4012,7 +4027,7 @@ PrimeIocFifos(MPT_ADAPTER *ioc)
        /* Post Reply frames to FIFO
         */
        alloc_dma = ioc->alloc_dma;
-       dinitprintk((KERN_INFO MYNAM ": %s.ReplyBuffers @ %p[%p]\n",
+       dinitprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ReplyBuffers @ %p[%p]\n",
                ioc->name, ioc->reply_frames, (void *)(ulong)alloc_dma));
 
        for (i = 0; i < ioc->reply_depth; i++) {
@@ -4093,7 +4108,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
        if ((t = WaitForDoorbellInt(ioc, 5, sleepFlag)) < 0)
                failcnt++;
 
-       dhsprintk((MYIOC_s_INFO_FMT "HandShake request start reqBytes=%d, WaitCnt=%d%s\n",
+       dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HandShake request start reqBytes=%d, WaitCnt=%d%s\n",
                        ioc->name, reqBytes, t, failcnt ? " - MISSING DOORBELL HANDSHAKE!" : ""));
 
        /* Read doorbell and check for active bit */
@@ -4128,10 +4143,10 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
                                failcnt++;
                }
 
-               dhsprintk((KERN_INFO MYNAM ": Handshake request frame (@%p) header\n", req));
-               DBG_DUMP_REQUEST_FRAME_HDR(req)
+               dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Handshake request frame (@%p) header\n", ioc->name, req));
+               DBG_DUMP_REQUEST_FRAME_HDR(ioc, (u32 *)req)
 
-               dhsprintk((MYIOC_s_INFO_FMT "HandShake request post done, WaitCnt=%d%s\n",
+               dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HandShake request post done, WaitCnt=%d%s\n",
                                ioc->name, t, failcnt ? " - MISSING DOORBELL ACK!" : ""));
 
                /*
@@ -4140,7 +4155,7 @@ mpt_handshake_req_reply_wait(MPT_ADAPTER *ioc, int reqBytes, u32 *req,
                if (!failcnt && (t = WaitForDoorbellReply(ioc, maxwait, sleepFlag)) < 0)
                        failcnt++;
 
-               dhsprintk((MYIOC_s_INFO_FMT "HandShake reply count=%d%s\n",
+               dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HandShake reply count=%d%s\n",
                                ioc->name, t, failcnt ? " - MISSING DOORBELL REPLY!" : ""));
 
                /*
@@ -4196,7 +4211,7 @@ WaitForDoorbellAck(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
        }
 
        if (cntdn) {
-               dprintk((MYIOC_s_INFO_FMT "WaitForDoorbell ACK (count=%d)\n",
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitForDoorbell ACK (count=%d)\n",
                                ioc->name, count));
                return count;
        }
@@ -4245,7 +4260,7 @@ WaitForDoorbellInt(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
        }
 
        if (cntdn) {
-               dprintk((MYIOC_s_INFO_FMT "WaitForDoorbell INT (cnt=%d) howlong=%d\n",
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitForDoorbell INT (cnt=%d) howlong=%d\n",
                                ioc->name, count, howlong));
                return count;
        }
@@ -4297,7 +4312,7 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
                }
        }
 
-       dhsprintk((MYIOC_s_INFO_FMT "WaitCnt=%d First handshake reply word=%08x%s\n",
+       dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitCnt=%d First handshake reply word=%08x%s\n",
                        ioc->name, t, le32_to_cpu(*(u32 *)hs_reply),
                        failcnt ? " - MISSING DOORBELL HANDSHAKE!" : ""));
 
@@ -4333,10 +4348,10 @@ WaitForDoorbellReply(MPT_ADAPTER *ioc, int howlong, int sleepFlag)
        }
 #endif
 
-       dhsprintk((MYIOC_s_INFO_FMT "Got Handshake reply:\n", ioc->name));
-       DBG_DUMP_REPLY_FRAME(mptReply)
+       dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Got Handshake reply:\n", ioc->name));
+       DBG_DUMP_REPLY_FRAME(ioc, (u32 *)mptReply)
 
-       dhsprintk((MYIOC_s_INFO_FMT "WaitForDoorbell REPLY WaitCnt=%d (sz=%d)\n",
+       dhsprintk(ioc, printk(MYIOC_s_DEBUG_FMT "WaitForDoorbell REPLY WaitCnt=%d (sz=%d)\n",
                        ioc->name, t, u16cnt/2));
        return u16cnt/2;
 }
@@ -4761,7 +4776,7 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
 
                ioc->spi_data.nvram = (int *) mem;
 
-               dprintk((MYIOC_s_INFO_FMT "SCSI device NVRAM settings @ %p, sz=%d\n",
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SCSI device NVRAM settings @ %p, sz=%d\n",
                        ioc->name, ioc->spi_data.nvram, sz));
        }
 
@@ -4797,7 +4812,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
                                ioc->spi_data.minSyncFactor = MPT_ASYNC;
                                ioc->spi_data.busType = MPT_HOST_BUS_UNKNOWN;
                                rc = 1;
-                               ddvprintk((MYIOC_s_INFO_FMT "Unable to read PortPage0 minSyncFactor=%x\n",
+                               ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "Unable to read PortPage0 minSyncFactor=%x\n",
                                        ioc->name, ioc->spi_data.minSyncFactor));
                        } else {
                                /* Save the Port Page 0 data
@@ -4808,7 +4824,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
 
                                if ( (pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_QAS) == 0 ) {
                                        ioc->spi_data.noQas |= MPT_TARGET_NO_NEGO_QAS;
-                                       ddvprintk((KERN_INFO MYNAM " :%s noQas due to Capabilities=%x\n",
+                                       ddvprintk(ioc, printk(KERN_INFO MYNAM
+                                               " :%s noQas due to Capabilities=%x\n",
                                                ioc->name, pPP0->Capabilities));
                                }
                                ioc->spi_data.maxBusWidth = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_WIDE ? 1 : 0;
@@ -4817,7 +4834,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
                                        ioc->spi_data.maxSyncOffset = (u8) (data >> 16);
                                        data = pPP0->Capabilities & MPI_SCSIPORTPAGE0_CAP_MIN_SYNC_PERIOD_MASK;
                                        ioc->spi_data.minSyncFactor = (u8) (data >> 8);
-                                       ddvprintk((MYIOC_s_INFO_FMT "PortPage0 minSyncFactor=%x\n",
+                                       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                               "PortPage0 minSyncFactor=%x\n",
                                                ioc->name, ioc->spi_data.minSyncFactor));
                                } else {
                                        ioc->spi_data.maxSyncOffset = 0;
@@ -4833,7 +4851,8 @@ mpt_GetScsiPortSettings(MPT_ADAPTER *ioc, int portnum)
 
                                        if (ioc->spi_data.minSyncFactor < MPT_ULTRA) {
                                                ioc->spi_data.minSyncFactor = MPT_ULTRA;
-                                               ddvprintk((MYIOC_s_INFO_FMT "HVD or SE detected, minSyncFactor=%x\n",
+                                               ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                                       "HVD or SE detected, minSyncFactor=%x\n",
                                                        ioc->name, ioc->spi_data.minSyncFactor));
                                        }
                                }
@@ -4949,10 +4968,10 @@ mpt_readScsiDevicePageHeaders(MPT_ADAPTER *ioc, int portnum)
        ioc->spi_data.sdp0version = cfg.cfghdr.hdr->PageVersion;
        ioc->spi_data.sdp0length = cfg.cfghdr.hdr->PageLength;
 
-       dcprintk((MYIOC_s_INFO_FMT "Headers: 0: version %d length %d\n",
+       dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Headers: 0: version %d length %d\n",
                        ioc->name, ioc->spi_data.sdp0version, ioc->spi_data.sdp0length));
 
-       dcprintk((MYIOC_s_INFO_FMT "Headers: 1: version %d length %d\n",
+       dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Headers: 1: version %d length %d\n",
                        ioc->name, ioc->spi_data.sdp1version, ioc->spi_data.sdp1length));
        return 0;
 }
@@ -5361,12 +5380,12 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
        cfg.physAddr = ioc1_dma;
        cfg.action = MPI_CONFIG_ACTION_PAGE_READ_CURRENT;
        if (mpt_config(ioc, &cfg) == 0) {
-               
+
                tmp = le32_to_cpu(pIoc1->Flags) & MPI_IOCPAGE1_REPLY_COALESCING;
                if (tmp == MPI_IOCPAGE1_REPLY_COALESCING) {
                        tmp = le32_to_cpu(pIoc1->CoalescingTimeout);
 
-                       dprintk((MYIOC_s_INFO_FMT "Coalescing Enabled Timeout = %d\n",
+                       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Coalescing Enabled Timeout = %d\n",
                                        ioc->name, tmp));
 
                        if (tmp > MPT_COALESCING_TIMEOUT) {
@@ -5377,26 +5396,29 @@ mpt_read_ioc_pg_1(MPT_ADAPTER *ioc)
                                cfg.dir = 1;
                                cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_CURRENT;
                                if (mpt_config(ioc, &cfg) == 0) {
-                                       dprintk((MYIOC_s_INFO_FMT "Reset Current Coalescing Timeout to = %d\n",
+                                       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Reset Current Coalescing Timeout to = %d\n",
                                                        ioc->name, MPT_COALESCING_TIMEOUT));
 
                                        cfg.action = MPI_CONFIG_ACTION_PAGE_WRITE_NVRAM;
                                        if (mpt_config(ioc, &cfg) == 0) {
-                                               dprintk((MYIOC_s_INFO_FMT "Reset NVRAM Coalescing Timeout to = %d\n",
+                                               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                                               "Reset NVRAM Coalescing Timeout to = %d\n",
                                                                ioc->name, MPT_COALESCING_TIMEOUT));
                                        } else {
-                                               dprintk((MYIOC_s_INFO_FMT "Reset NVRAM Coalescing Timeout Failed\n",
-                                                                       ioc->name));
+                                               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                                               "Reset NVRAM Coalescing Timeout Failed\n",
+                                                               ioc->name));
                                        }
 
                                } else {
-                                       dprintk((MYIOC_s_WARN_FMT "Reset of Current Coalescing Timeout Failed!\n",
-                                                               ioc->name));
+                                       dprintk(ioc, printk(MYIOC_s_WARN_FMT
+                                               "Reset of Current Coalescing Timeout Failed!\n",
+                                               ioc->name));
                                }
                        }
 
                } else {
-                       dprintk((MYIOC_s_WARN_FMT "Coalescing Disabled\n", ioc->name));
+                       dprintk(ioc, printk(MYIOC_s_WARN_FMT "Coalescing Disabled\n", ioc->name));
                }
        }
 
@@ -5461,13 +5483,13 @@ SendEventNotification(MPT_ADAPTER *ioc, u8 EvSwitch)
 
        evnp = (EventNotification_t *) mpt_get_msg_frame(mpt_base_index, ioc);
        if (evnp == NULL) {
-               devtverboseprintk((MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n",
+               devtverboseprintk(ioc, printk(MYIOC_s_WARN_FMT "Unable to allocate event request frame!\n",
                                ioc->name));
                return 0;
        }
        memset(evnp, 0, sizeof(*evnp));
 
-       devtverboseprintk((MYIOC_s_INFO_FMT "Sending EventNotification (%d) request %p\n", ioc->name, EvSwitch, evnp));
+       devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending EventNotification (%d) request %p\n", ioc->name, EvSwitch, evnp));
 
        evnp->Function = MPI_FUNCTION_EVENT_NOTIFICATION;
        evnp->ChainOffset = 0;
@@ -5491,12 +5513,12 @@ SendEventAck(MPT_ADAPTER *ioc, EventNotificationReply_t *evnp)
        EventAck_t      *pAck;
 
        if ((pAck = (EventAck_t *) mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
-               dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
                    ioc->name,__FUNCTION__));
                return -1;
        }
 
-       devtverboseprintk((MYIOC_s_INFO_FMT "Sending EventAck\n", ioc->name));
+       devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending EventAck\n", ioc->name));
 
        pAck->Function     = MPI_FUNCTION_EVENT_ACK;
        pAck->ChainOffset  = 0;
@@ -5541,7 +5563,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
         */
        in_isr = in_interrupt();
        if (in_isr) {
-               dcprintk((MYIOC_s_WARN_FMT "Config request not allowed in ISR context!\n",
+               dcprintk(ioc, printk(MYIOC_s_WARN_FMT "Config request not allowed in ISR context!\n",
                                ioc->name));
                return -EPERM;
        }
@@ -5549,7 +5571,7 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
        /* Get and Populate a free Frame
         */
        if ((mf = mpt_get_msg_frame(mpt_base_index, ioc)) == NULL) {
-               dcprintk((MYIOC_s_WARN_FMT "mpt_config: no msg frames!\n",
+               dcprintk(ioc, printk(MYIOC_s_WARN_FMT "mpt_config: no msg frames!\n",
                                ioc->name));
                return -EAGAIN;
        }
@@ -5594,13 +5616,13 @@ mpt_config(MPT_ADAPTER *ioc, CONFIGPARMS *pCfg)
        if ((pCfg->cfghdr.hdr->PageType & MPI_CONFIG_PAGETYPE_MASK) == MPI_CONFIG_PAGETYPE_EXTENDED) {
                flagsLength |= pExtHdr->ExtPageLength * 4;
 
-               dcprintk((MYIOC_s_INFO_FMT "Sending Config request type %d, page %d and action %d\n",
+               dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Config request type %d, page %d and action %d\n",
                        ioc->name, pReq->ExtPageType, pReq->Header.PageNumber, pReq->Action));
        }
        else {
                flagsLength |= pCfg->cfghdr.hdr->PageLength * 4;
 
-               dcprintk((MYIOC_s_INFO_FMT "Sending Config request type %d, page %d and action %d\n",
+               dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Sending Config request type %d, page %d and action %d\n",
                        ioc->name, pReq->Header.PageType, pReq->Header.PageNumber, pReq->Action));
        }
 
@@ -5650,7 +5672,7 @@ mpt_timer_expired(unsigned long data)
 {
        MPT_ADAPTER *ioc = (MPT_ADAPTER *) data;
 
-       dcprintk((MYIOC_s_WARN_FMT "mpt_timer_expired! \n", ioc->name));
+       dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_timer_expired! \n", ioc->name));
 
        /* Perform a FW reload */
        if (mpt_HardResetHandler(ioc, NO_SLEEP) < 0)
@@ -5660,7 +5682,7 @@ mpt_timer_expired(unsigned long data)
         * Hard reset clean-up will wake up
         * process and free all resources.
         */
-       dcprintk((MYIOC_s_WARN_FMT "mpt_timer_expired complete!\n", ioc->name));
+       dcprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mpt_timer_expired complete!\n", ioc->name));
 
        return;
 }
@@ -5679,7 +5701,7 @@ mpt_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
        CONFIGPARMS *pCfg;
        unsigned long flags;
 
-       dprintk((KERN_WARNING MYNAM
+       dprintk(ioc, printk(KERN_DEBUG MYNAM
                        ": IOC %s_reset routed to MPT base driver!\n",
                        reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
                        reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
@@ -6050,7 +6072,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
        int              rc;
        unsigned long    flags;
 
-       dtmprintk((MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name));
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler Entered!\n", ioc->name));
 #ifdef MFCNT
        printk(MYIOC_s_INFO_FMT "HardResetHandler Entered!\n", ioc->name);
        printk("MF count 0x%x !\n", ioc->mfcnt);
@@ -6082,11 +6104,11 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
 
                for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
                        if (MptResetHandlers[ii]) {
-                               dtmprintk((MYIOC_s_INFO_FMT "Calling IOC reset_setup handler #%d\n",
+                               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Calling IOC reset_setup handler #%d\n",
                                                ioc->name, ii));
                                r += mpt_signal_reset(ii, ioc, MPT_IOC_SETUP_RESET);
                                if (ioc->alt_ioc) {
-                                       dtmprintk((MYIOC_s_INFO_FMT "Calling alt-%s setup reset handler #%d\n",
+                                       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Calling alt-%s setup reset handler #%d\n",
                                                        ioc->name, ioc->alt_ioc->name, ii));
                                        r += mpt_signal_reset(ii, ioc->alt_ioc, MPT_IOC_SETUP_RESET);
                                }
@@ -6108,7 +6130,7 @@ mpt_HardResetHandler(MPT_ADAPTER *ioc, int sleepFlag)
                ioc->alt_ioc->diagPending = 0;
        spin_unlock_irqrestore(&ioc->diagLock, flags);
 
-       dtmprintk((MYIOC_s_INFO_FMT "HardResetHandler rc = %d!\n", ioc->name, rc));
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "HardResetHandler rc = %d!\n", ioc->name, rc));
 
        return rc;
 }
@@ -6509,16 +6531,18 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
        }
 
        EventDescriptionStr(event, evData0, evStr);
-       devtprintk((MYIOC_s_INFO_FMT "MPT event:(%02Xh) : %s\n",
+       devtprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MPT event:(%02Xh) : %s\n",
                        ioc->name,
                        event,
                        evStr));
 
-#if defined(MPT_DEBUG) || defined(MPT_DEBUG_VERBOSE_EVENTS)
-       printk(KERN_INFO MYNAM ": Event data:\n" KERN_INFO);
+#ifdef CONFIG_FUSION_LOGGING
+       devtverboseprintk(ioc, printk(KERN_DEBUG MYNAM
+           ": Event data:\n"));
        for (ii = 0; ii < evDataLen; ii++)
-               printk(" %08x", le32_to_cpu(pEventReply->Data[ii]));
-       printk("\n");
+               devtverboseprintk(ioc, printk(" %08x",
+                   le32_to_cpu(pEventReply->Data[ii])));
+       devtverboseprintk(ioc, printk(KERN_DEBUG "\n"));
 #endif
 
        /*
@@ -6573,7 +6597,7 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
         */
        for (ii=MPT_MAX_PROTOCOL_DRIVERS-1; ii; ii--) {
                if (MptEvHandlers[ii]) {
-                       devtverboseprintk((MYIOC_s_INFO_FMT "Routing Event to event handler #%d\n",
+                       devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Routing Event to event handler #%d\n",
                                        ioc->name, ii));
                        r += (*(MptEvHandlers[ii]))(ioc, pEventReply);
                        handlers++;
@@ -6585,10 +6609,10 @@ ProcessEventNotification(MPT_ADAPTER *ioc, EventNotificationReply_t *pEventReply
         *  If needed, send (a single) EventAck.
         */
        if (pEventReply->AckRequired == MPI_EVENT_NOTIFICATION_ACK_REQUIRED) {
-               devtverboseprintk((MYIOC_s_WARN_FMT
+               devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                        "EventAck required\n",ioc->name));
                if ((ii = SendEventAck(ioc, pEventReply)) != 0) {
-                       devtverboseprintk((MYIOC_s_WARN_FMT "SendEventAck returned %d\n",
+                       devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SendEventAck returned %d\n",
                                        ioc->name, ii));
                }
        }
@@ -6935,7 +6959,6 @@ union loginfo_type {
                        sas_loginfo.dw.code, sas_loginfo.dw.subcode);
 }
 
-#ifdef MPT_DEBUG_REPLY
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 /**
  *     mpt_iocstatus_info_config - IOCSTATUS information for config pages
@@ -7240,7 +7263,6 @@ mpt_iocstatus_info(MPT_ADAPTER *ioc, u32 ioc_status, MPT_FRAME_HDR *mf)
 
        printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s\n", ioc->name, status, desc);
 }
-#endif
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 EXPORT_SYMBOL(mpt_attach);
@@ -7305,11 +7327,7 @@ fusion_init(void)
 
        /* Register for hard reset handling callbacks.
         */
-       if (mpt_reset_register(mpt_base_index, mpt_ioc_reset) == 0) {
-               dprintk((KERN_INFO MYNAM ": Register for IOC reset notification\n"));
-       } else {
-               /* FIXME! */
-       }
+       mpt_reset_register(mpt_base_index, mpt_ioc_reset);
 
 #ifdef CONFIG_PROC_FS
        (void) procmpt_create();
@@ -7328,8 +7346,6 @@ static void __exit
 fusion_exit(void)
 {
 
-       dexitprintk((KERN_INFO MYNAM ": fusion_exit() called!\n"));
-
        mpt_reset_deregister(mpt_base_index);
 
 #ifdef CONFIG_PROC_FS
index 98eb9c688e1794b3e8264016d2cf23ef4836128d..15ff22645844ace62cfe016d93b6efef0cf242d2 100644 (file)
  * MPT drivers.  NOTE: Users of these macro defs must
  * themselves define their own MYNAM.
  */
+#define MYIOC_s_DEBUG_FMT              KERN_DEBUG MYNAM ": %s: "
 #define MYIOC_s_INFO_FMT               KERN_INFO MYNAM ": %s: "
 #define MYIOC_s_NOTE_FMT               KERN_NOTICE MYNAM ": %s: "
 #define MYIOC_s_WARN_FMT               KERN_WARNING MYNAM ": %s: WARNING - "
@@ -543,6 +544,7 @@ typedef struct _MPT_ADAPTER
        char                     board_tracer[16];
        u16                      nvdata_version_persistent;
        u16                      nvdata_version_default;
+       int                      debug_level;
        u8                       io_missing_delay;
        u8                       device_missing_delay;
        SYSIF_REGS __iomem      *chip;          /* == c8817000 (mmap) */
@@ -718,171 +720,7 @@ typedef struct _mpt_sge {
 /*
  *  Funky (private) macros...
  */
-#ifdef MPT_DEBUG
-#define dprintk(x)  printk x
-#else
-#define dprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_INIT
-#define dinitprintk(x)  printk x
-#define DBG_DUMP_FW_REQUEST_FRAME(mfp) \
-       {       int  i, n = 10;                                         \
-               u32 *m = (u32 *)(mfp);                                  \
-               printk(KERN_INFO " ");                                  \
-               for (i=0; i<n; i++)                                     \
-                       printk(" %08x", le32_to_cpu(m[i]));             \
-               printk("\n");                                           \
-       }
-#else
-#define dinitprintk(x)
-#define DBG_DUMP_FW_REQUEST_FRAME(mfp)
-#endif
-
-#ifdef MPT_DEBUG_EXIT
-#define dexitprintk(x)  printk x
-#else
-#define dexitprintk(x)
-#endif
-
-#if defined MPT_DEBUG_FAIL || defined (MPT_DEBUG_SG)
-#define dfailprintk(x) printk x
-#else
-#define dfailprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_HANDSHAKE
-#define dhsprintk(x)  printk x
-#else
-#define dhsprintk(x)
-#endif
-
-#if defined(MPT_DEBUG_EVENTS) || defined(MPT_DEBUG_VERBOSE_EVENTS)
-#define devtprintk(x)  printk x
-#else
-#define devtprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_VERBOSE_EVENTS
-#define devtverboseprintk(x)  printk x
-#else
-#define devtverboseprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_RESET
-#define drsprintk(x)  printk x
-#else
-#define drsprintk(x)
-#endif
-
-//#if defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
-#if defined(MPT_DEBUG_MSG_FRAME)
-#define dmfprintk(x)  printk x
-#define DBG_DUMP_REQUEST_FRAME(mfp) \
-       {       int  i, n = 24;                                         \
-               u32 *m = (u32 *)(mfp);                                  \
-               for (i=0; i<n; i++) {                                   \
-                       if (i && ((i%8)==0))                            \
-                               printk("\n");                           \
-                       printk("%08x ", le32_to_cpu(m[i]));             \
-               }                                                       \
-               printk("\n");                                           \
-       }
-#else
-#define dmfprintk(x)
-#define DBG_DUMP_REQUEST_FRAME(mfp)
-#endif
-
-#ifdef MPT_DEBUG_IRQ
-#define dirqprintk(x)  printk x
-#else
-#define dirqprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_SG
-#define dsgprintk(x)  printk x
-#else
-#define dsgprintk(x)
-#endif
-
-#if defined(MPT_DEBUG_DL) || defined(MPT_DEBUG)
-#define ddlprintk(x)  printk x
-#else
-#define ddlprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_DV
-#define ddvprintk(x)  printk x
-#else
-#define ddvprintk(x)
-#endif
-
-#if defined(MPT_DEBUG_DV) || defined(MPT_DEBUG_DV_TINY)
-#define ddvtprintk(x)  printk x
-#else
-#define ddvtprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_IOCTL
-#define dctlprintk(x) printk x
-#else
-#define dctlprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_REPLY
-#define dreplyprintk(x) printk x
-#else
-#define dreplyprintk(x)
-#endif
-
-#ifdef DMPT_DEBUG_FC
-#define dfcprintk(x) printk x
-#else
-#define dfcprintk(x)
-#endif
-
-#ifdef MPT_DEBUG_TM
-#define dtmprintk(x) printk x
-#define DBG_DUMP_TM_REQUEST_FRAME(mfp) \
-       {       u32 *m = (u32 *)(mfp);                                  \
-               int  i, n = 13;                                         \
-               printk("TM_REQUEST:\n");                                \
-               for (i=0; i<n; i++) {                                   \
-                       if (i && ((i%8)==0))                            \
-                               printk("\n");                           \
-                       printk("%08x ", le32_to_cpu(m[i]));             \
-               }                                                       \
-               printk("\n");                                           \
-       }
-#define DBG_DUMP_TM_REPLY_FRAME(mfp) \
-       {       u32 *m = (u32 *)(mfp);                                  \
-               int  i, n = (le32_to_cpu(m[0]) & 0x00FF0000) >> 16;     \
-               printk("TM_REPLY MessageLength=%d:\n", n);              \
-               for (i=0; i<n; i++) {                                   \
-                       if (i && ((i%8)==0))                            \
-                               printk("\n");                           \
-                       printk(" %08x", le32_to_cpu(m[i]));             \
-               }                                                       \
-               printk("\n");                                           \
-       }
-#else
-#define dtmprintk(x)
-#define DBG_DUMP_TM_REQUEST_FRAME(mfp)
-#define DBG_DUMP_TM_REPLY_FRAME(mfp)
-#endif
-
-#if defined(MPT_DEBUG_CONFIG) || defined(MPT_DEBUG)
-#define dcprintk(x) printk x
-#else
-#define dcprintk(x)
-#endif
-
-#if defined(MPT_DEBUG_SCSI) || defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
-#define dsprintk(x) printk x
-#else
-#define dsprintk(x)
-#endif
-
+#include "mptdebug.h"
 
 #define MPT_INDEX_2_MFPTR(ioc,idx) \
        (MPT_FRAME_HDR*)( (u8*)(ioc)->req_frames + (ioc)->req_sz * (idx) )
@@ -893,36 +731,6 @@ typedef struct _mpt_sge {
 #define MPT_INDEX_2_RFPTR(ioc,idx) \
        (MPT_FRAME_HDR*)( (u8*)(ioc)->reply_frames + (ioc)->req_sz * (idx) )
 
-#if defined(MPT_DEBUG) || defined(MPT_DEBUG_MSG_FRAME)
-#define DBG_DUMP_REPLY_FRAME(mfp) \
-       {       u32 *m = (u32 *)(mfp);                                  \
-               int  i, n = (le32_to_cpu(m[0]) & 0x00FF0000) >> 16;     \
-               printk(KERN_INFO " ");                                  \
-               for (i=0; i<n; i++)                                     \
-                       printk(" %08x", le32_to_cpu(m[i]));             \
-               printk("\n");                                           \
-       }
-#define DBG_DUMP_REQUEST_FRAME_HDR(mfp) \
-       {       int  i, n = 3;                                          \
-               u32 *m = (u32 *)(mfp);                                  \
-               printk(KERN_INFO " ");                                  \
-               for (i=0; i<n; i++)                                     \
-                       printk(" %08x", le32_to_cpu(m[i]));             \
-               printk("\n");                                           \
-       }
-#else
-#define DBG_DUMP_REPLY_FRAME(mfp)
-#define DBG_DUMP_REQUEST_FRAME_HDR(mfp)
-#endif
-
-// debug sas wide ports
-#ifdef MPT_DEBUG_SAS_WIDE
-#define dsaswideprintk(x) printk x
-#else
-#define dsaswideprintk(x)
-#endif
-
-
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
 
 #define SCSI_STD_SENSE_BYTES    18
index 58e6c319cc76244db9aab6b6a79eb57e0afaed81..89695e705bdc936b72df4dca3a98b3364ee58f3b 100644 (file)
@@ -181,7 +181,7 @@ static inline int
 mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
 {
        int rc = 0;
-       dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock));
+//     dctlprintk(ioc, printk(KERN_DEBUG MYNAM "::mptctl_syscall_down(%p,%d) called\n", ioc, nonblock));
 
        if (nonblock) {
                if (!mutex_trylock(&ioc->ioctl->ioctl_mutex))
@@ -190,7 +190,7 @@ mptctl_syscall_down(MPT_ADAPTER *ioc, int nonblock)
                if (mutex_lock_interruptible(&ioc->ioctl->ioctl_mutex))
                        rc = -ERESTARTSYS;
        }
-       dctlprintk((KERN_INFO MYNAM "::mptctl_syscall_down return %d\n", rc));
+//     dctlprintk(ioc, printk(KERN_DEBUG MYNAM "::mptctl_syscall_down return %d\n", rc));
        return rc;
 }
 
@@ -209,18 +209,19 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
        u16 iocStatus;
        u8 cmd;
 
-       dctlprintk(("mptctl_reply()!\n"));
        if (req)
                 cmd = req->u.hdr.Function;
        else
                return 1;
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tcompleting mpi function (0x%02X), req=%p, "
+           "reply=%p\n", ioc->name,  req->u.hdr.Function, req, reply));
 
        if (ioc->ioctl) {
 
                if (reply==NULL) {
 
-                       dctlprintk(("mptctl_reply() NULL Reply "
-                               "Function=%x!\n", cmd));
+                       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_reply() NULL Reply "
+                               "Function=%x!\n", ioc->name, cmd));
 
                        ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
                        ioc->ioctl->reset &= ~MPTCTL_RESET_OK;
@@ -233,14 +234,9 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
 
                }
 
-               dctlprintk(("mptctl_reply() with req=%p "
-                       "reply=%p Function=%x!\n", req, reply, cmd));
-
                /* Copy the reply frame (which much exist
                 * for non-SCSI I/O) to the IOC structure.
                 */
-               dctlprintk(("Copying Reply Frame @%p to ioc%d!\n",
-                       reply, ioc->id));
                memcpy(ioc->ioctl->ReplyFrame, reply,
                        min(ioc->reply_sz, 4*reply->u.reply.MsgLength));
                ioc->ioctl->status |= MPT_IOCTL_STATUS_RF_VALID;
@@ -252,8 +248,24 @@ mptctl_reply(MPT_ADAPTER *ioc, MPT_FRAME_HDR *req, MPT_FRAME_HDR *reply)
                if (iocStatus  == MPI_IOCSTATUS_SUCCESS)
                        ioc->ioctl->status |= MPT_IOCTL_STATUS_COMMAND_GOOD;
 
+               if (iocStatus || reply->u.reply.IOCLogInfo)
+                       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\tiocstatus (0x%04X), "
+                               "loginfo (0x%08X)\n", ioc->name,
+                               iocStatus,
+                               le32_to_cpu(reply->u.reply.IOCLogInfo)));
+
                if ((cmd == MPI_FUNCTION_SCSI_IO_REQUEST) ||
                        (cmd == MPI_FUNCTION_RAID_SCSI_IO_PASSTHROUGH)) {
+
+                       if (reply->u.sreply.SCSIStatus || reply->u.sreply.SCSIState)
+                               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                                       "\tscsi_status (0x%02x), scsi_state (0x%02x), "
+                                       "tag = (0x%04x), transfer_count (0x%08x)\n", ioc->name,
+                                       reply->u.sreply.SCSIStatus,
+                                       reply->u.sreply.SCSIState,
+                                       le16_to_cpu(reply->u.sreply.TaskTag),
+                                       le32_to_cpu(reply->u.sreply.TransferCount)));
+
                        ioc->ioctl->reset &= ~MPTCTL_RESET_OK;
 
                        if ((iocStatus == MPI_IOCSTATUS_SCSI_DATA_UNDERRUN) ||
@@ -298,8 +310,8 @@ static void mptctl_timeout_expired (MPT_IOCTL *ioctl)
 {
        int rc = 1;
 
-       dctlprintk((KERN_NOTICE MYNAM ": Timeout Expired! Host %d\n",
-                               ioctl->ioc->id));
+       dctlprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT ": Timeout Expired! Host %d\n",
+                               ioctl->ioc->name, ioctl->ioc->id));
        if (ioctl == NULL)
                return;
 
@@ -311,7 +323,7 @@ static void mptctl_timeout_expired (MPT_IOCTL *ioctl)
                /* Issue a reset for this device.
                 * The IOC is not responding.
                 */
-               dctlprintk((MYIOC_s_INFO_FMT "Calling HardReset! \n",
+               dctlprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n",
                         ioctl->ioc->name));
                mpt_HardResetHandler(ioctl->ioc, CAN_SLEEP);
        }
@@ -350,14 +362,14 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
        /* Send request
         */
        if ((mf = mpt_get_msg_frame(mptctl_id, ioctl->ioc)) == NULL) {
-               dctlprintk((MYIOC_s_WARN_FMT "IssueTaskMgmt, no msg frames!!\n",
+               dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt, no msg frames!!\n",
                                ioctl->ioc->name));
 
                mptctl_free_tm_flags(ioctl->ioc);
                return -ENOMEM;
        }
 
-       dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt request @ %p\n",
+       dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n",
                        ioctl->ioc->name, mf));
 
        pScsiTm = (SCSITaskMgmt_t *) mf;
@@ -377,15 +389,15 @@ static int mptctl_bus_reset(MPT_IOCTL *ioctl)
                pScsiTm->Reserved2[ii] = 0;
 
        pScsiTm->TaskMsgContext = 0;
-       dtmprintk((MYIOC_s_INFO_FMT
+       dtmprintk(ioctl->ioc, printk(MYIOC_s_DEBUG_FMT
                "mptctl_bus_reset: issued.\n", ioctl->ioc->name));
 
-       DBG_DUMP_TM_REQUEST_FRAME((u32 *)mf);
+       DBG_DUMP_TM_REQUEST_FRAME(ioctl->ioc, (u32 *)mf);
 
        ioctl->wait_done=0;
        if ((retval = mpt_send_handshake_request(mptctl_id, ioctl->ioc,
             sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) {
-               dfailprintk((MYIOC_s_ERR_FMT "_send_handshake FAILED!"
+               dfailprintk(ioctl->ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!"
                        " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
                        hd->ioc, mf));
                goto mptctl_bus_reset_done;
@@ -456,7 +468,7 @@ static int
 mptctl_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
 {
        MPT_IOCTL *ioctl = ioc->ioctl;
-       dctlprintk((KERN_INFO MYNAM ": IOC %s_reset routed to IOCTL driver!\n",
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": IOC %s_reset routed to IOCTL driver!\n",ioc->name,
                reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
                reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
 
@@ -487,7 +499,8 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
 
        event = le32_to_cpu(pEvReply->Event) & 0xFF;
 
-       dctlprintk(("%s() called\n", __FUNCTION__));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "%s() called\n",
+           ioc->name, __FUNCTION__));
        if(async_queue == NULL)
                return 1;
 
@@ -497,8 +510,10 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
         */
         if (event == 0x21 ) {
                ioc->aen_event_read_flag=1;
-               dctlprintk(("Raised SIGIO to application\n"));
-               devtverboseprintk(("Raised SIGIO to application\n"));
+               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Raised SIGIO to application\n",
+                   ioc->name));
+               devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                   "Raised SIGIO to application\n", ioc->name));
                kill_fasync(&async_queue, SIGIO, POLL_IN);
                return 1;
         }
@@ -515,8 +530,10 @@ mptctl_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
         */
        if (ioc->events && (ioc->eventTypes & ( 1 << event))) {
                ioc->aen_event_read_flag=1;
-               dctlprintk(("Raised SIGIO to application\n"));
-               devtverboseprintk(("Raised SIGIO to application\n"));
+               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                   "Raised SIGIO to application\n", ioc->name));
+               devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                   "Raised SIGIO to application\n", ioc->name));
                kill_fasync(&async_queue, SIGIO, POLL_IN);
        }
        return 1;
@@ -530,14 +547,12 @@ mptctl_fasync(int fd, struct file *filep, int mode)
        list_for_each_entry(ioc, &ioc_list, list)
                ioc->aen_event_read_flag=0;
 
-       dctlprintk(("%s() called\n", __FUNCTION__));
        return fasync_helper(fd, filep, mode, &async_queue);
 }
 
 static int
 mptctl_release(struct inode *inode, struct file *filep)
 {
-       dctlprintk(("%s() called\n", __FUNCTION__));
        return fasync_helper(-1, filep, 0, &async_queue);
 }
 
@@ -558,8 +573,6 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        int ret;
        MPT_ADAPTER *iocp = NULL;
 
-       dctlprintk(("mptctl_ioctl() called\n"));
-
        if (copy_from_user(&khdr, uhdr, sizeof(khdr))) {
                printk(KERN_ERR "%s::mptctl_ioctl() @%d - "
                                "Unable to copy mpt_ioctl_header data @ %p\n",
@@ -574,13 +587,13 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        iocnumX = khdr.iocnum & 0xFF;
        if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
            (iocp == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnumX));
+               printk(KERN_DEBUG "%s::mptctl_ioctl() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnumX);
                return -ENODEV;
        }
 
        if (!iocp->active) {
-               printk(KERN_ERR "%s::mptctl_ioctl() @%d - Controller disabled.\n",
+               printk(KERN_DEBUG "%s::mptctl_ioctl() @%d - Controller disabled.\n",
                                __FILE__, __LINE__);
                return -EFAULT;
        }
@@ -612,8 +625,6 @@ __mptctl_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
        if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
                return ret;
 
-       dctlprintk((MYIOC_s_INFO_FMT ": mptctl_ioctl()\n", iocp->name));
-
        if (cmd == MPTFWDOWNLOAD)
                ret = mptctl_fw_download(arg);
        else if (cmd == MPTCOMMAND)
@@ -648,8 +659,6 @@ static int mptctl_do_reset(unsigned long arg)
        struct mpt_ioctl_diag_reset krinfo;
        MPT_ADAPTER             *iocp;
 
-       dctlprintk((KERN_INFO "mptctl_do_reset called.\n"));
-
        if (copy_from_user(&krinfo, urinfo, sizeof(struct mpt_ioctl_diag_reset))) {
                printk(KERN_ERR "%s@%d::mptctl_do_reset - "
                                "Unable to copy mpt_ioctl_diag_reset struct @ %p\n",
@@ -658,11 +667,14 @@ static int mptctl_do_reset(unsigned long arg)
        }
 
        if (mpt_verify_adapter(krinfo.hdr.iocnum, &iocp) < 0) {
-               dctlprintk((KERN_ERR "%s@%d::mptctl_do_reset - ioc%d not found!\n",
-                               __FILE__, __LINE__, krinfo.hdr.iocnum));
+               printk(KERN_DEBUG "%s@%d::mptctl_do_reset - ioc%d not found!\n",
+                               __FILE__, __LINE__, krinfo.hdr.iocnum);
                return -ENODEV; /* (-6) No such device or address */
        }
 
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "mptctl_do_reset called.\n",
+           iocp->name));
+
        if (mpt_HardResetHandler(iocp, CAN_SLEEP) != 0) {
                printk (KERN_ERR "%s@%d::mptctl_do_reset - reset failed.\n",
                        __FILE__, __LINE__);
@@ -695,7 +707,6 @@ mptctl_fw_download(unsigned long arg)
        struct mpt_fw_xfer __user *ufwdl = (void __user *) arg;
        struct mpt_fw_xfer       kfwdl;
 
-       dctlprintk((KERN_INFO "mptctl_fwdl called. mptctl_id = %xh\n", mptctl_id)); //tc
        if (copy_from_user(&kfwdl, ufwdl, sizeof(struct mpt_fw_xfer))) {
                printk(KERN_ERR "%s@%d::_ioctl_fwdl - "
                                "Unable to copy mpt_fw_xfer struct @ %p\n",
@@ -744,15 +755,8 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
        u16                      iocstat;
        pFWDownloadReply_t       ReplyMsg = NULL;
 
-       dctlprintk(("mptctl_do_fwdl called. mptctl_id = %xh.\n", mptctl_id));
-
-       dctlprintk(("DbG: kfwdl.bufp  = %p\n", ufwbuf));
-       dctlprintk(("DbG: kfwdl.fwlen = %d\n", (int)fwlen));
-       dctlprintk(("DbG: kfwdl.ioc   = %04xh\n", ioc));
-
        if (mpt_verify_adapter(ioc, &iocp) < 0) {
-               dctlprintk(("ioctl_fwdl - ioc%d not found!\n",
-                                ioc));
+               printk(KERN_DEBUG "ioctl_fwdl - ioc%d not found!\n",                             ioc);
                return -ENODEV; /* (-6) No such device or address */
        } else {
 
@@ -761,6 +765,16 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
                if ((mf = mpt_get_msg_frame(mptctl_id, iocp)) == NULL)
                        return -EAGAIN;
        }
+
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT
+           "mptctl_do_fwdl called. mptctl_id = %xh.\n", iocp->name, mptctl_id));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.bufp  = %p\n",
+           iocp->name, ufwbuf));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.fwlen = %d\n",
+           iocp->name, (int)fwlen));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: kfwdl.ioc   = %04xh\n",
+           iocp->name, ioc));
+
        dlmsg = (FWDownload_t*) mf;
        ptsge = (FWDownloadTCSGE_t *) &dlmsg->SGL;
        sgOut = (char *) (ptsge + 1);
@@ -829,7 +843,8 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
                goto fwdl_out;
        }
 
-       dctlprintk(("DbG: sgl buffer  = %p, sgfrags = %d\n", sgl, numfrags));
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "DbG: sgl buffer = %p, sgfrags = %d\n",
+           iocp->name, sgl, numfrags));
 
        /*
         * Parse SG list, copying sgl itself,
@@ -865,15 +880,7 @@ mptctl_do_fw_download(int ioc, char __user *ufwbuf, size_t fwlen)
                sgOut += (sizeof(dma_addr_t) + sizeof(u32));
        }
 
-#ifdef MPT_DEBUG
-       {
-               u32 *m = (u32 *)mf;
-               printk(KERN_INFO MYNAM ": F/W download request:\n" KERN_INFO " ");
-               for (i=0; i < 7+numfrags*2; i++)
-                       printk(" %08x", le32_to_cpu(m[i]));
-               printk("\n");
-       }
-#endif
+       DBG_DUMP_FW_DOWNLOAD(iocp, (u32 *)mf, numfrags);
 
        /*
         * Finally, perform firmware download.
@@ -1049,13 +1056,11 @@ kbuf_alloc_2_sgl(int bytes, u32 sgdir, int sge_offset, int *frags,
        *frags = numfrags;
        *blp = buflist;
 
-       dctlprintk((KERN_INFO MYNAM "-SG: kbuf_alloc_2_sgl() - "
-                          "%d SG frags generated!\n",
-                          numfrags));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: kbuf_alloc_2_sgl() - "
+          "%d SG frags generated!\n", ioc->name, numfrags));
 
-       dctlprintk((KERN_INFO MYNAM "-SG: kbuf_alloc_2_sgl() - "
-                          "last (big) alloc_sz=%d\n",
-                          alloc_sz));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: kbuf_alloc_2_sgl() - "
+          "last (big) alloc_sz=%d\n", ioc->name, alloc_sz));
 
        return sglbuf;
 
@@ -1139,7 +1144,8 @@ kfree_sgl(MptSge_t *sgl, dma_addr_t sgl_dma, struct buflist *buflist, MPT_ADAPTE
 
        pci_free_consistent(ioc->pcidev, MAX_SGL_BYTES, sgl, sgl_dma);
        kfree(buflist);
-       dctlprintk((KERN_INFO MYNAM "-SG: Free'd 1 SGL buf + %d kbufs!\n", n));
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "-SG: Free'd 1 SGL buf + %d kbufs!\n",
+           ioc->name, n));
 }
 
 /*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
@@ -1166,7 +1172,6 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
        struct scsi_device      *sdev;
        VirtDevice              *vdev;
 
-       dctlprintk((": mptctl_getiocinfo called.\n"));
        /* Add of PCI INFO results in unaligned access for
         * IA64 and Sparc. Reset long to int. Return no PCI
         * data for obsolete format.
@@ -1199,8 +1204,8 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
 
        if (((iocnum = mpt_verify_adapter(karg->hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_getiocinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                kfree(karg);
                return -ENODEV;
        }
@@ -1214,6 +1219,9 @@ mptctl_getiocinfo (unsigned long arg, unsigned int data_size)
                return -EFAULT;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_getiocinfo called.\n",
+           ioc->name));
+
        /* Fill in the data and return the structure to the calling
         * program
         */
@@ -1320,7 +1328,6 @@ mptctl_gettargetinfo (unsigned long arg)
        u8                      port;
        struct scsi_device      *sdev;
 
-       dctlprintk(("mptctl_gettargetinfo called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_targetinfo))) {
                printk(KERN_ERR "%s@%d::mptctl_gettargetinfo - "
                        "Unable to read in mpt_ioctl_targetinfo struct @ %p\n",
@@ -1330,11 +1337,13 @@ mptctl_gettargetinfo (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_gettargetinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_gettargetinfo called.\n",
+           ioc->name));
        /* Get the port number and set the maximum number of bytes
         * in the returned structure.
         * Ignore the port setting.
@@ -1434,7 +1443,6 @@ mptctl_readtest (unsigned long arg)
        MPT_ADAPTER *ioc;
        int iocnum;
 
-       dctlprintk(("mptctl_readtest called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_test))) {
                printk(KERN_ERR "%s@%d::mptctl_readtest - "
                        "Unable to read in mpt_ioctl_test struct @ %p\n",
@@ -1444,11 +1452,13 @@ mptctl_readtest (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_readtest() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_readtest() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_readtest called.\n",
+           ioc->name));
        /* Fill in the data and return the structure to the calling
         * program
         */
@@ -1494,7 +1504,6 @@ mptctl_eventquery (unsigned long arg)
        MPT_ADAPTER *ioc;
        int iocnum;
 
-       dctlprintk(("mptctl_eventquery called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventquery))) {
                printk(KERN_ERR "%s@%d::mptctl_eventquery - "
                        "Unable to read in mpt_ioctl_eventquery struct @ %p\n",
@@ -1504,11 +1513,13 @@ mptctl_eventquery (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_eventquery() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventquery called.\n",
+           ioc->name));
        karg.eventEntries = MPTCTL_EVENT_LOG_SIZE;
        karg.eventTypes = ioc->eventTypes;
 
@@ -1532,7 +1543,6 @@ mptctl_eventenable (unsigned long arg)
        MPT_ADAPTER *ioc;
        int iocnum;
 
-       dctlprintk(("mptctl_eventenable called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventenable))) {
                printk(KERN_ERR "%s@%d::mptctl_eventenable - "
                        "Unable to read in mpt_ioctl_eventenable struct @ %p\n",
@@ -1542,11 +1552,13 @@ mptctl_eventenable (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_eventenable() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventenable called.\n",
+           ioc->name));
        if (ioc->events == NULL) {
                /* Have not yet allocated memory - do so now.
                 */
@@ -1579,7 +1591,6 @@ mptctl_eventreport (unsigned long arg)
        int                      iocnum;
        int                      numBytes, maxEvents, max;
 
-       dctlprintk(("mptctl_eventreport called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_eventreport))) {
                printk(KERN_ERR "%s@%d::mptctl_eventreport - "
                        "Unable to read in mpt_ioctl_eventreport struct @ %p\n",
@@ -1589,10 +1600,12 @@ mptctl_eventreport (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_eventreport() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_eventreport called.\n",
+           ioc->name));
 
        numBytes = karg.hdr.maxDataSize - sizeof(mpt_ioctl_header);
        maxEvents = numBytes/sizeof(MPT_IOCTL_EVENTS);
@@ -1632,7 +1645,6 @@ mptctl_replace_fw (unsigned long arg)
        int                      iocnum;
        int                      newFwSize;
 
-       dctlprintk(("mptctl_replace_fw called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_replace_fw))) {
                printk(KERN_ERR "%s@%d::mptctl_replace_fw - "
                        "Unable to read in mpt_ioctl_replace_fw struct @ %p\n",
@@ -1642,11 +1654,13 @@ mptctl_replace_fw (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_replace_fw() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "mptctl_replace_fw called.\n",
+           ioc->name));
        /* If caching FW, Free the old FW image
         */
        if (ioc->cached_fw == NULL)
@@ -1704,7 +1718,6 @@ mptctl_mpt_command (unsigned long arg)
        int             iocnum;
        int             rc;
 
-       dctlprintk(("mptctl_command called.\n"));
 
        if (copy_from_user(&karg, uarg, sizeof(struct mpt_ioctl_command))) {
                printk(KERN_ERR "%s@%d::mptctl_mpt_command - "
@@ -1715,8 +1728,8 @@ mptctl_mpt_command (unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_mpt_command() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
 
@@ -1756,13 +1769,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
        ulong           timeout;
        struct scsi_device *sdev;
 
-       dctlprintk(("mptctl_do_mpt_command called.\n"));
        bufIn.kptr = bufOut.kptr = NULL;
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_do_mpt_command() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
        if (!ioc->ioctl) {
@@ -1816,6 +1828,9 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
 
        /* Verify that this request is allowed.
         */
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "sending mpi function (0x%02X), req=%p\n",
+           ioc->name, hdr->Function, mf));
+
        switch (hdr->Function) {
        case MPI_FUNCTION_IOC_FACTS:
        case MPI_FUNCTION_PORT_FACTS:
@@ -1823,6 +1838,18 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
                break;
 
        case MPI_FUNCTION_CONFIG:
+       {
+               Config_t *config_frame;
+               config_frame = (Config_t *)mf;
+               dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT "\ttype=0x%02x ext_type=0x%02x "
+                   "number=0x%02x action=0x%02x\n", ioc->name,
+                   config_frame->Header.PageType,
+                   config_frame->ExtPageType,
+                   config_frame->Header.PageNumber,
+                   config_frame->Action));
+               break;
+       }
+
        case MPI_FUNCTION_FC_COMMON_TRANSPORT_SEND:
        case MPI_FUNCTION_FC_EX_LINK_SRVC_SEND:
        case MPI_FUNCTION_FW_UPLOAD:
@@ -2158,12 +2185,12 @@ mptctl_do_mpt_command (struct mpt_ioctl_command karg, void __user *mfPtr)
        ioc->ioctl->wait_done = 0;
        if (hdr->Function == MPI_FUNCTION_SCSI_TASK_MGMT) {
 
-               DBG_DUMP_TM_REQUEST_FRAME((u32 *)mf);
+               DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
 
                if (mpt_send_handshake_request(mptctl_id, ioc,
                        sizeof(SCSITaskMgmt_t), (u32*)mf,
                        CAN_SLEEP) != 0) {
-                       dfailprintk((MYIOC_s_ERR_FMT "_send_handshake FAILED!"
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT "_send_handshake FAILED!"
                                " (ioc %p, mf %p) \n", ioc->name,
                                ioc, mf));
                        mptctl_free_tm_flags(ioc);
@@ -2303,7 +2330,6 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
        MPT_FRAME_HDR           *mf = NULL;
        MPIHeader_t             *mpi_hdr;
 
-       dctlprintk((": mptctl_hp_hostinfo called.\n"));
        /* Reset long to int. Should affect IA64 and SPARC only
         */
        if (data_size == sizeof(hp_host_info_t))
@@ -2322,10 +2348,12 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
            (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_hp_hostinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_hostinfo called.\n",
+           ioc->name));
 
        /* Fill in the data and return the structure to the calling
         * program
@@ -2441,7 +2469,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
         * Gather ISTWI(Industry Standard Two Wire Interface) Data
         */
        if ((mf = mpt_get_msg_frame(mptctl_id, ioc)) == NULL) {
-               dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames!!\n",
                    ioc->name,__FUNCTION__));
                goto out;
        }
@@ -2474,7 +2502,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
             HZ*MPT_IOCTL_DEFAULT_TIMEOUT /* 10 sec */);
 
        if(rc <=0 && (ioc->ioctl->wait_done != 1 )) {
-               /* 
+               /*
                 * Now we need to reset the board
                 */
                mpt_free_msg_frame(ioc, mf);
@@ -2482,7 +2510,7 @@ mptctl_hp_hostinfo(unsigned long arg, unsigned int data_size)
                goto out;
        }
 
-       /* 
+       /*
         *ISTWI Data Definition
         * pbuf[0] = FW_VERSION = 0x4
         * pbuf[1] = Bay Count = 6 or 4 or 2, depending on
@@ -2538,7 +2566,6 @@ mptctl_hp_targetinfo(unsigned long arg)
        ConfigPageHeader_t      hdr;
        int                     tmp, np, rc = 0;
 
-       dctlprintk((": mptctl_hp_targetinfo called.\n"));
        if (copy_from_user(&karg, uarg, sizeof(hp_target_info_t))) {
                printk(KERN_ERR "%s@%d::mptctl_hp_targetinfo - "
                        "Unable to read in hp_host_targetinfo struct @ %p\n",
@@ -2548,10 +2575,12 @@ mptctl_hp_targetinfo(unsigned long arg)
 
        if (((iocnum = mpt_verify_adapter(karg.hdr.iocnum, &ioc)) < 0) ||
                (ioc == NULL)) {
-               dctlprintk((KERN_ERR "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
-                               __FILE__, __LINE__, iocnum));
+               printk(KERN_DEBUG "%s::mptctl_hp_targetinfo() @%d - ioc%d not found!\n",
+                               __FILE__, __LINE__, iocnum);
                return -ENODEV;
        }
+       dctlprintk(ioc, printk(MYIOC_s_DEBUG_FMT ": mptctl_hp_targetinfo called.\n",
+           ioc->name));
 
        /*  There is nothing to do for FCP parts.
         */
@@ -2694,7 +2723,6 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
        int nonblock = (filp->f_flags & O_NONBLOCK);
        int ret;
 
-       dctlprintk((KERN_INFO MYNAM "::compat_mptfwxfer_ioctl() called\n"));
 
        if (copy_from_user(&kfw32, (char __user *)arg, sizeof(kfw32)))
                return -EFAULT;
@@ -2703,14 +2731,16 @@ compat_mptfwxfer_ioctl(struct file *filp, unsigned int cmd,
        iocnumX = kfw32.iocnum & 0xFF;
        if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
            (iocp == NULL)) {
-               dctlprintk((KERN_ERR MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
-                               __LINE__, iocnumX));
+               printk(KERN_DEBUG MYNAM "::compat_mptfwxfer_ioctl @%d - ioc%d not found!\n",
+                               __LINE__, iocnumX);
                return -ENODEV;
        }
 
        if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
                return ret;
 
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "compat_mptfwxfer_ioctl() called\n",
+           iocp->name));
        kfw.iocnum = iocnum;
        kfw.fwlen = kfw32.fwlen;
        kfw.bufp = compat_ptr(kfw32.bufp);
@@ -2734,8 +2764,6 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
        int nonblock = (filp->f_flags & O_NONBLOCK);
        int ret;
 
-       dctlprintk((KERN_INFO MYNAM "::compat_mpt_command() called\n"));
-
        if (copy_from_user(&karg32, (char __user *)arg, sizeof(karg32)))
                return -EFAULT;
 
@@ -2743,14 +2771,16 @@ compat_mpt_command(struct file *filp, unsigned int cmd,
        iocnumX = karg32.hdr.iocnum & 0xFF;
        if (((iocnum = mpt_verify_adapter(iocnumX, &iocp)) < 0) ||
            (iocp == NULL)) {
-               dctlprintk((KERN_ERR MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
-                               __LINE__, iocnumX));
+               printk(KERN_DEBUG MYNAM "::compat_mpt_command @%d - ioc%d not found!\n",
+                               __LINE__, iocnumX);
                return -ENODEV;
        }
 
        if ((ret = mptctl_syscall_down(iocp, nonblock)) != 0)
                return ret;
 
+       dctlprintk(iocp, printk(MYIOC_s_DEBUG_FMT "compat_mpt_command() called\n",
+           iocp->name));
        /* Copy data to karg */
        karg.hdr.iocnum = karg32.hdr.iocnum;
        karg.hdr.port = karg32.hdr.port;
@@ -2878,11 +2908,7 @@ static int __init mptctl_init(void)
 
        show_mptmod_ver(my_NAME, my_VERSION);
 
-       if(mpt_device_driver_register(&mptctl_driver,
-         MPTCTL_DRIVER) != 0 ) {
-               dprintk((KERN_INFO MYNAM
-               ": failed to register dd callbacks\n"));
-       }
+       mpt_device_driver_register(&mptctl_driver, MPTCTL_DRIVER);
 
        /* Register this device */
        err = misc_register(&mptctl_miscdev);
@@ -2905,16 +2931,8 @@ static int __init mptctl_init(void)
                goto out_fail;
        }
 
-       if (mpt_reset_register(mptctl_id, mptctl_ioc_reset) == 0) {
-               dprintk((KERN_INFO MYNAM ": Registered for IOC reset notifications\n"));
-       } else {
-               /* FIXME! */
-       }
-
-       if (mpt_event_register(mptctl_id, mptctl_event_process) == 0) {
-               devtverboseprintk((KERN_INFO MYNAM
-                 ": Registered for IOC event notifications\n"));
-       }
+       mpt_reset_register(mptctl_id, mptctl_ioc_reset);
+       mpt_event_register(mptctl_id, mptctl_event_process);
 
        return 0;
 
@@ -2934,11 +2952,9 @@ static void mptctl_exit(void)
 
        /* De-register reset handler from base module */
        mpt_reset_deregister(mptctl_id);
-       dprintk((KERN_INFO MYNAM ": Deregistered for IOC reset notifications\n"));
 
        /* De-register callback handler from base module */
        mpt_deregister(mptctl_id);
-       printk(KERN_INFO MYNAM ": Deregistered from Fusion MPT base driver\n");
 
         mpt_device_driver_deregister(MPTCTL_DRIVER);
 
diff --git a/drivers/message/fusion/mptdebug.h b/drivers/message/fusion/mptdebug.h
new file mode 100644 (file)
index 0000000..ffdb0a6
--- /dev/null
@@ -0,0 +1,288 @@
+/*
+ *  linux/drivers/message/fusion/mptdebug.h
+ *      For use with LSI PCI chip/adapter(s)
+ *      running LSI Fusion MPT (Message Passing Technology) firmware.
+ *
+ *  Copyright (c) 1999-2007 LSI Corporation
+ *  (mailto:DL-MPTFusionLinux@lsi.com)
+ *
+ */
+/*=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=*/
+
+#ifndef MPTDEBUG_H_INCLUDED
+#define MPTDEBUG_H_INCLUDED
+
+/*
+ * debug level can be programmed on the fly via SysFS (hex values)
+ *
+ * Example:  (programming for MPT_DEBUG_EVENTS on host 5)
+ *
+ * echo 8 > /sys/class/scsi_host/host5/debug_level
+ *
+ * --------------------------------------------------------
+ * mpt_debug_level - command line parameter
+ * this allow enabling debug at driver load time (for all iocs)
+ *
+ * Example  (programming for MPT_DEBUG_EVENTS)
+ *
+ * insmod mptbase.ko mpt_debug_level=8
+ *
+ * --------------------------------------------------------
+ * CONFIG_FUSION_LOGGING - enables compiling debug into driver
+ * this can be enabled in the driver Makefile
+ *
+ *
+ * --------------------------------------------------------
+ * Please note most debug prints are set to logging priority = debug
+ * This is the lowest level, and most verbose.  Please refer to manual
+ * pages for syslogd or syslogd-ng on how to configure this.
+ */
+
+#define MPT_DEBUG                      0x00000001
+#define MPT_DEBUG_MSG_FRAME            0x00000002
+#define MPT_DEBUG_SG                   0x00000004
+#define MPT_DEBUG_EVENTS               0x00000008
+#define MPT_DEBUG_VERBOSE_EVENTS       0x00000010
+#define MPT_DEBUG_INIT                 0x00000020
+#define MPT_DEBUG_EXIT                 0x00000040
+#define MPT_DEBUG_FAIL                 0x00000080
+#define MPT_DEBUG_TM                   0x00000100
+#define MPT_DEBUG_DV                   0x00000200
+#define MPT_DEBUG_REPLY                        0x00000400
+#define MPT_DEBUG_HANDSHAKE            0x00000800
+#define MPT_DEBUG_CONFIG               0x00001000
+#define MPT_DEBUG_DL                   0x00002000
+#define MPT_DEBUG_RESET                        0x00008000
+#define MPT_DEBUG_SCSI                 0x00010000
+#define MPT_DEBUG_IOCTL                        0x00020000
+#define MPT_DEBUG_FC                   0x00080000
+#define MPT_DEBUG_SAS                  0x00100000
+#define MPT_DEBUG_SAS_WIDE             0x00200000
+
+/*
+ * CONFIG_FUSION_LOGGING - enabled in Kconfig
+ */
+
+#ifdef CONFIG_FUSION_LOGGING
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)                      \
+{                                                              \
+       if (IOC->debug_level & BITS)                            \
+               CMD;                                            \
+}
+#else
+#define MPT_CHECK_LOGGING(IOC, CMD, BITS)
+#endif
+
+
+/*
+ * debug macros
+ */
+
+#define dprintk(IOC, CMD)                      \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG)
+
+#define dsgprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SG)
+
+#define devtprintk(IOC, CMD)                   \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EVENTS)
+
+#define devtverboseprintk(IOC, CMD)            \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_VERBOSE_EVENTS)
+
+#define dinitprintk(IOC, CMD)                  \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_INIT)
+
+#define dexitprintk(IOC, CMD)                  \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_EXIT)
+
+#define dfailprintk(IOC, CMD)                  \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FAIL)
+
+#define dtmprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_TM)
+
+#define ddvprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DV)
+
+#define dreplyprintk(IOC, CMD)                 \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_REPLY)
+
+#define dhsprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_HANDSHAKE)
+
+#define dcprintk(IOC, CMD)                     \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_CONFIG)
+
+#define ddlprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_DL)
+
+#define drsprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_RESET)
+
+#define dsprintk(IOC, CMD)                     \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SCSI)
+
+#define dctlprintk(IOC, CMD)                   \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_IOCTL)
+
+#define dfcprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_FC)
+
+#define dsasprintk(IOC, CMD)                   \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS)
+
+#define dsaswideprintk(IOC, CMD)               \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_SAS_WIDE)
+
+
+
+/*
+ * Verbose logging
+ */
+#if defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING)
+static inline void
+DBG_DUMP_FW_DOWNLOAD(MPT_ADAPTER *ioc, u32  *mfp, int numfrags)
+{
+       int i;
+
+       if (!(ioc->debug_level & MPT_DEBUG))
+               return;
+       printk(KERN_DEBUG "F/W download request:\n");
+       for (i=0; i < 7+numfrags*2; i++)
+               printk(" %08x", le32_to_cpu(mfp[i]));
+       printk("\n");
+}
+
+static inline void
+DBG_DUMP_PUT_MSG_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
+{
+       int      ii, n;
+
+       if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
+               return;
+       printk(KERN_DEBUG "%s: About to Put msg frame @ %p:\n",
+               ioc->name, mfp);
+       n = ioc->req_sz/4 - 1;
+       while (mfp[n] == 0)
+               n--;
+       for (ii=0; ii<=n; ii++) {
+               if (ii && ((ii%8)==0))
+                       printk("\n");
+               printk(" %08x", le32_to_cpu(mfp[ii]));
+       }
+       printk("\n");
+}
+
+static inline void
+DBG_DUMP_FW_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
+{
+       int  i, n;
+
+       if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
+               return;
+       n = 10;
+       printk(KERN_INFO " ");
+       for (i = 0; i < n; i++)
+               printk(" %08x", le32_to_cpu(mfp[i]));
+       printk("\n");
+}
+
+static inline void
+DBG_DUMP_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
+{
+       int  i, n;
+
+       if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
+               return;
+       n = 24;
+       for (i=0; i<n; i++) {
+               if (i && ((i%8)==0))
+                       printk("\n");
+               printk("%08x ", le32_to_cpu(mfp[i]));
+       }
+       printk("\n");
+}
+
+static inline void
+DBG_DUMP_REPLY_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
+{
+       int  i, n;
+
+       if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
+               return;
+       n = (le32_to_cpu(mfp[0]) & 0x00FF0000) >> 16;
+       printk(KERN_INFO " ");
+       for (i=0; i<n; i++)
+               printk(" %08x", le32_to_cpu(mfp[i]));
+       printk("\n");
+}
+
+static inline void
+DBG_DUMP_REQUEST_FRAME_HDR(MPT_ADAPTER *ioc, u32 *mfp)
+{
+       int  i, n;
+
+       if (!(ioc->debug_level & MPT_DEBUG_MSG_FRAME))
+               return;
+       n = 3;
+       printk(KERN_INFO " ");
+       for (i=0; i<n; i++)
+               printk(" %08x", le32_to_cpu(mfp[i]));
+       printk("\n");
+}
+
+static inline void
+DBG_DUMP_TM_REQUEST_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
+{
+       int  i, n;
+
+       if (!(ioc->debug_level & MPT_DEBUG_TM))
+               return;
+       n = 13;
+       printk(KERN_DEBUG "TM_REQUEST:\n");
+       for (i=0; i<n; i++) {
+               if (i && ((i%8)==0))
+                       printk("\n");
+               printk("%08x ", le32_to_cpu(mfp[i]));
+       }
+       printk("\n");
+}
+
+static inline void
+DBG_DUMP_TM_REPLY_FRAME(MPT_ADAPTER *ioc, u32 *mfp)
+{
+       int  i, n;
+
+       if (!(ioc->debug_level & MPT_DEBUG_TM))
+               return;
+       n = (le32_to_cpu(mfp[0]) & 0x00FF0000) >> 16;
+       printk(KERN_DEBUG "TM_REPLY MessageLength=%d:\n", n);
+       for (i=0; i<n; i++) {
+               if (i && ((i%8)==0))
+                       printk("\n");
+               printk(" %08x", le32_to_cpu(mfp[i]));
+       }
+       printk("\n");
+}
+
+#define dmfprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
+
+# else /* ifdef MPT_DEBUG_MF */
+
+#define DBG_DUMP_FW_DOWNLOAD(IOC, mfp, numfrags)
+#define DBG_DUMP_PUT_MSG_FRAME(IOC, mfp)
+#define DBG_DUMP_FW_REQUEST_FRAME(IOC, mfp)
+#define DBG_DUMP_REQUEST_FRAME(IOC, mfp)
+#define DBG_DUMP_REPLY_FRAME(IOC, mfp)
+#define DBG_DUMP_REQUEST_FRAME_HDR(IOC, mfp)
+#define DBG_DUMP_TM_REQUEST_FRAME(IOC, mfp)
+#define DBG_DUMP_TM_REPLY_FRAME(IOC, mfp)
+
+#define dmfprintk(IOC, CMD)                    \
+       MPT_CHECK_LOGGING(IOC, CMD, MPT_DEBUG_MSG_FRAME)
+
+#endif /* defined(MPT_DEBUG_VERBOSE) && defined(CONFIG_FUSION_LOGGING) */
+
+#endif /* ifndef MPTDEBUG_H_INCLUDED */
index f2ebaa9992febc19cee852c63542fe62b6f494f6..8422c25e4a3e7f71f8ecc26e95a16b416a5c15ac 100644 (file)
@@ -188,16 +188,18 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
                          int (*func)(struct scsi_cmnd *SCpnt),
                          const char *caller)
 {
+       MPT_SCSI_HOST           *hd;
        struct scsi_device      *sdev = SCpnt->device;
        struct Scsi_Host        *shost = sdev->host;
        struct fc_rport         *rport = starget_to_rport(scsi_target(sdev));
        unsigned long           flags;
        int                     ready;
 
+       hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
        spin_lock_irqsave(shost->host_lock, flags);
        while ((ready = fc_remote_port_chkready(rport) >> 16) == DID_IMM_RETRY) {
                spin_unlock_irqrestore(shost->host_lock, flags);
-               dfcprintk ((MYIOC_s_INFO_FMT
+               dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
                        "mptfc_block_error_handler.%d: %d:%d, port status is "
                        "DID_IMM_RETRY, deferring %s recovery.\n",
                        ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
@@ -209,7 +211,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
        spin_unlock_irqrestore(shost->host_lock, flags);
 
        if (ready == DID_NO_CONNECT || !SCpnt->device->hostdata) {
-               dfcprintk ((MYIOC_s_INFO_FMT
+               dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
                        "%s.%d: %d:%d, failing recovery, "
                        "port state %d, vdev %p.\n", caller,
                        ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
@@ -218,7 +220,7 @@ mptfc_block_error_handler(struct scsi_cmnd *SCpnt,
                        SCpnt->device->hostdata));
                return FAILED;
        }
-       dfcprintk ((MYIOC_s_INFO_FMT
+       dfcprintk (hd->ioc, printk(MYIOC_s_DEBUG_FMT
                "%s.%d: %d:%d, executing recovery.\n", caller,
                ((MPT_SCSI_HOST *) shost->hostdata)->ioc->name,
                ((MPT_SCSI_HOST *) shost->hostdata)->ioc->sh->host_no,
@@ -483,7 +485,7 @@ mptfc_register_dev(MPT_ADAPTER *ioc, int channel, FCDevicePage0_t *pg0)
 
                        pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
                        nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
-                       dfcprintk ((MYIOC_s_INFO_FMT
+                       dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
                                "mptfc_reg_dev.%d: %x, %llx / %llx, tid %d, "
                                "rport tid %d, tmo %d\n",
                                        ioc->name,
@@ -559,6 +561,35 @@ mptfc_target_alloc(struct scsi_target *starget)
 
        return rc;
 }
+/*
+ *     mptfc_dump_lun_info
+ *     @ioc
+ *     @rport
+ *     @sdev
+ *
+ */
+static void
+mptfc_dump_lun_info(MPT_ADAPTER *ioc, struct fc_rport *rport, struct scsi_device *sdev,
+               VirtTarget *vtarget)
+{
+       u64 nn, pn;
+       struct mptfc_rport_info *ri;
+
+       ri = *((struct mptfc_rport_info **)rport->dd_data);
+       pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
+       nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
+       dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
+               "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, "
+               "CurrentTargetID %d, %x %llx %llx\n",
+               ioc->name,
+               sdev->host->host_no,
+               vtarget->num_luns,
+               sdev->id, ri->pg0.CurrentTargetID,
+               ri->pg0.PortIdentifier,
+               (unsigned long long)pn,
+               (unsigned long long)nn));
+}
+
 
 /*
  *     OS entry point to allow host driver to alloc memory
@@ -606,25 +637,7 @@ mptfc_slave_alloc(struct scsi_device *sdev)
        vtarget->num_luns++;
 
 
-#ifdef DMPT_DEBUG_FC
-       {
-       u64 nn, pn;
-       struct mptfc_rport_info *ri;
-       ri = *((struct mptfc_rport_info **)rport->dd_data);
-       pn = (u64)ri->pg0.WWPN.High << 32 | (u64)ri->pg0.WWPN.Low;
-       nn = (u64)ri->pg0.WWNN.High << 32 | (u64)ri->pg0.WWNN.Low;
-       dfcprintk ((MYIOC_s_INFO_FMT
-               "mptfc_slv_alloc.%d: num_luns %d, sdev.id %d, "
-               "CurrentTargetID %d, %x %llx %llx\n",
-               hd->ioc->name,
-               sdev->host->host_no,
-               vtarget->num_luns,
-               sdev->id, ri->pg0.CurrentTargetID,
-               ri->pg0.PortIdentifier,
-               (unsigned long long)pn,
-               (unsigned long long)nn));
-       }
-#endif
+       mptfc_dump_lun_info(hd->ioc, rport, sdev, vtarget);
 
        return 0;
 }
@@ -653,27 +666,12 @@ mptfc_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        /* dd_data is null until finished adding target */
        ri = *((struct mptfc_rport_info **)rport->dd_data);
        if (unlikely(!ri)) {
-               dfcprintk ((MYIOC_s_INFO_FMT
-                       "mptfc_qcmd.%d: %d:%d, dd_data is null.\n",
-                       ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name,
-                       ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no,
-                       SCpnt->device->id,SCpnt->device->lun));
                SCpnt->result = DID_IMM_RETRY << 16;
                done(SCpnt);
                return 0;
        }
 
-       err = mptscsih_qcmd(SCpnt,done);
-#ifdef DMPT_DEBUG_FC
-       if (unlikely(err)) {
-               dfcprintk ((MYIOC_s_INFO_FMT
-                       "mptfc_qcmd.%d: %d:%d, mptscsih_qcmd returns non-zero, (%x).\n",
-                       ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->name,
-                       ((MPT_SCSI_HOST *) SCpnt->device->host->hostdata)->ioc->sh->host_no,
-                       SCpnt->device->id,SCpnt->device->lun,err));
-       }
-#endif
-       return err;
+       return mptscsih_qcmd(SCpnt,done);
 }
 
 /*
@@ -1041,7 +1039,7 @@ mptfc_setup_reset(struct work_struct *work)
 
                        pn = (u64)ri->pg0.WWPN.High << 32 |
                             (u64)ri->pg0.WWPN.Low;
-                       dfcprintk ((MYIOC_s_INFO_FMT
+                       dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
                                "mptfc_setup_reset.%d: %llx deleted\n",
                                ioc->name,
                                ioc->sh->host_no,
@@ -1088,7 +1086,7 @@ mptfc_rescan_devices(struct work_struct *work)
 
                        pn = (u64)ri->pg0.WWPN.High << 32 |
                             (u64)ri->pg0.WWPN.Low;
-                       dfcprintk ((MYIOC_s_INFO_FMT
+                       dfcprintk (ioc, printk(MYIOC_s_DEBUG_FMT
                                "mptfc_rescan.%d: %llx deleted\n",
                                ioc->name,
                                ioc->sh->host_no,
@@ -1212,7 +1210,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        if (numSGE < sh->sg_tablesize) {
                /* Reset this value */
-               dprintk((MYIOC_s_INFO_FMT
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                  "Resetting sg_tablesize to %d from %d\n",
                  ioc->name, numSGE, sh->sg_tablesize));
                sh->sg_tablesize = numSGE;
@@ -1232,7 +1230,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto out_mptfc_probe;
        }
 
-       dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n",
+       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
                 ioc->name, hd->ScsiLookup));
 
        /* Clear the TM flags
@@ -1264,7 +1262,7 @@ mptfc_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        sh->transportt = mptfc_transport_template;
        error = scsi_add_host (sh, &ioc->pcidev->dev);
        if(error) {
-               dprintk((KERN_ERR MYNAM
+               dprintk(ioc, printk(KERN_ERR MYNAM
                  "scsi_add_host failed\n"));
                goto out_mptfc_probe;
        }
@@ -1323,7 +1321,7 @@ mptfc_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
        unsigned long flags;
        int rc=1;
 
-       devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
+       devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
                        ioc->name, event));
 
        if (ioc->sh == NULL ||
@@ -1357,8 +1355,8 @@ mptfc_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
                return rc;
 
 
-       dtmprintk((KERN_WARNING MYNAM
-               ": IOC %s_reset routed to FC host driver!\n",
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+               ": IOC %s_reset routed to FC host driver!\n",ioc->name,
                reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
                reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
 
@@ -1413,15 +1411,8 @@ mptfc_init(void)
        mptfcTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTFC_DRIVER);
        mptfcInternalCtx = mpt_register(mptscsih_scandv_complete, MPTFC_DRIVER);
 
-       if (mpt_event_register(mptfcDoneCtx, mptfc_event_process) == 0) {
-               devtverboseprintk((KERN_INFO MYNAM
-                 ": Registered for IOC event notifications\n"));
-       }
-
-       if (mpt_reset_register(mptfcDoneCtx, mptfc_ioc_reset) == 0) {
-               dprintk((KERN_INFO MYNAM
-                 ": Registered for IOC reset notifications\n"));
-       }
+       mpt_event_register(mptfcDoneCtx, mptfc_event_process);
+       mpt_reset_register(mptfcDoneCtx, mptfc_ioc_reset);
 
        error = pci_register_driver(&mptfc_driver);
        if (error)
@@ -1486,12 +1477,7 @@ mptfc_exit(void)
        fc_release_transport(mptfc_transport_template);
 
        mpt_reset_deregister(mptfcDoneCtx);
-       dprintk((KERN_INFO MYNAM
-         ": Deregistered for IOC reset notifications\n"));
-
        mpt_event_deregister(mptfcDoneCtx);
-       dprintk((KERN_INFO MYNAM
-         ": Deregistered for IOC event notifications\n"));
 
        mpt_deregister(mptfcInternalCtx);
        mpt_deregister(mptfcTaskCtx);
index 7e8a90cb484e303542f112c29e2221c292dbd76d..01fc397fdd979f7783bcd90d6c8b5069d1bd0c9e 100644 (file)
@@ -1524,8 +1524,7 @@ static int __init mpt_lan_init (void)
 
        dlprintk((KERN_INFO MYNAM ": Registered for IOC reset notifications\n"));
        
-       if (mpt_device_driver_register(&mptlan_driver, MPTLAN_DRIVER))
-               dprintk((KERN_INFO MYNAM ": failed to register dd callbacks\n"));
+       mpt_device_driver_register(&mptlan_driver, MPTLAN_DRIVER);
        return 0;
 }
 
index d5066464051221589bb4dab1f0a6de65f3200a42..b9c69bff218caed8ac8dd2057157d7c72aa31818 100644 (file)
@@ -201,103 +201,91 @@ struct mptsas_enclosure {
        u8      sep_channel;            /* SEP channel logical channel id */
 };
 
-#ifdef MPT_DEBUG_SAS
-static void mptsas_print_phy_data(MPI_SAS_IO_UNIT0_PHY_DATA *phy_data)
-{
-       printk("---- IO UNIT PAGE 0 ------------\n");
-       printk("Handle=0x%X\n",
-               le16_to_cpu(phy_data->AttachedDeviceHandle));
-       printk("Controller Handle=0x%X\n",
-               le16_to_cpu(phy_data->ControllerDevHandle));
-       printk("Port=0x%X\n", phy_data->Port);
-       printk("Port Flags=0x%X\n", phy_data->PortFlags);
-       printk("PHY Flags=0x%X\n", phy_data->PhyFlags);
-       printk("Negotiated Link Rate=0x%X\n", phy_data->NegotiatedLinkRate);
-       printk("Controller PHY Device Info=0x%X\n",
-               le32_to_cpu(phy_data->ControllerPhyDeviceInfo));
-       printk("DiscoveryStatus=0x%X\n",
-               le32_to_cpu(phy_data->DiscoveryStatus));
-       printk("\n");
-}
-
-static void mptsas_print_phy_pg0(SasPhyPage0_t *pg0)
+static void mptsas_print_phy_data(MPT_ADAPTER *ioc,
+                                       MPI_SAS_IO_UNIT0_PHY_DATA *phy_data)
+{
+       dsasprintk(ioc, printk(KERN_DEBUG "---- IO UNIT PAGE 0 ------------\n"));
+       dsasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n",
+               le16_to_cpu(phy_data->AttachedDeviceHandle)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Controller Handle=0x%X\n",
+               le16_to_cpu(phy_data->ControllerDevHandle)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Port=0x%X\n", phy_data->Port));
+       dsasprintk(ioc, printk(KERN_DEBUG "Port Flags=0x%X\n", phy_data->PortFlags));
+       dsasprintk(ioc, printk(KERN_DEBUG "PHY Flags=0x%X\n", phy_data->PhyFlags));
+       dsasprintk(ioc, printk(KERN_DEBUG "Negotiated Link Rate=0x%X\n", phy_data->NegotiatedLinkRate));
+       dsasprintk(ioc, printk(KERN_DEBUG "Controller PHY Device Info=0x%X\n",
+               le32_to_cpu(phy_data->ControllerPhyDeviceInfo)));
+       dsasprintk(ioc, printk(KERN_DEBUG "DiscoveryStatus=0x%X\n\n",
+               le32_to_cpu(phy_data->DiscoveryStatus)));
+}
+
+static void mptsas_print_phy_pg0(MPT_ADAPTER *ioc, SasPhyPage0_t *pg0)
 {
        __le64 sas_address;
 
        memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64));
 
-       printk("---- SAS PHY PAGE 0 ------------\n");
-       printk("Attached Device Handle=0x%X\n",
-                       le16_to_cpu(pg0->AttachedDevHandle));
-       printk("SAS Address=0x%llX\n",
-                       (unsigned long long)le64_to_cpu(sas_address));
-       printk("Attached PHY Identifier=0x%X\n", pg0->AttachedPhyIdentifier);
-       printk("Attached Device Info=0x%X\n",
-                       le32_to_cpu(pg0->AttachedDeviceInfo));
-       printk("Programmed Link Rate=0x%X\n", pg0->ProgrammedLinkRate);
-       printk("Change Count=0x%X\n", pg0->ChangeCount);
-       printk("PHY Info=0x%X\n", le32_to_cpu(pg0->PhyInfo));
-       printk("\n");
+       dsasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 0 ------------\n"));
+       dsasprintk(ioc, printk(KERN_DEBUG "Attached Device Handle=0x%X\n",
+                       le16_to_cpu(pg0->AttachedDevHandle)));
+       dsasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n",
+                       (unsigned long long)le64_to_cpu(sas_address)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Attached PHY Identifier=0x%X\n", pg0->AttachedPhyIdentifier));
+       dsasprintk(ioc, printk(KERN_DEBUG "Attached Device Info=0x%X\n",
+                       le32_to_cpu(pg0->AttachedDeviceInfo)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Programmed Link Rate=0x%X\n", pg0->ProgrammedLinkRate));
+       dsasprintk(ioc, printk(KERN_DEBUG "Change Count=0x%X\n", pg0->ChangeCount));
+       dsasprintk(ioc, printk(KERN_DEBUG "PHY Info=0x%X\n\n", le32_to_cpu(pg0->PhyInfo)));
 }
 
-static void mptsas_print_phy_pg1(SasPhyPage1_t *pg1)
+static void mptsas_print_phy_pg1(MPT_ADAPTER *ioc, SasPhyPage1_t *pg1)
 {
-       printk("---- SAS PHY PAGE 1 ------------\n");
-       printk("Invalid Dword Count=0x%x\n", pg1->InvalidDwordCount);
-       printk("Running Disparity Error Count=0x%x\n",
-                       pg1->RunningDisparityErrorCount);
-       printk("Loss Dword Synch Count=0x%x\n", pg1->LossDwordSynchCount);
-       printk("PHY Reset Problem Count=0x%x\n", pg1->PhyResetProblemCount);
-       printk("\n");
+       dsasprintk(ioc, printk(KERN_DEBUG "---- SAS PHY PAGE 1 ------------\n"));
+       dsasprintk(ioc, printk(KERN_DEBUG "Invalid Dword Count=0x%x\n", pg1->InvalidDwordCount));
+       dsasprintk(ioc, printk(KERN_DEBUG "Running Disparity Error Count=0x%x\n",
+                       pg1->RunningDisparityErrorCount));
+       dsasprintk(ioc, printk(KERN_DEBUG "Loss Dword Synch Count=0x%x\n", pg1->LossDwordSynchCount));
+       dsasprintk(ioc, printk(KERN_DEBUG "PHY Reset Problem Count=0x%x\n\n", pg1->PhyResetProblemCount));
 }
 
-static void mptsas_print_device_pg0(SasDevicePage0_t *pg0)
+static void mptsas_print_device_pg0(MPT_ADAPTER *ioc, SasDevicePage0_t *pg0)
 {
        __le64 sas_address;
 
        memcpy(&sas_address, &pg0->SASAddress, sizeof(__le64));
 
-       printk("---- SAS DEVICE PAGE 0 ---------\n");
-       printk("Handle=0x%X\n" ,le16_to_cpu(pg0->DevHandle));
-       printk("Parent Handle=0x%X\n" ,le16_to_cpu(pg0->ParentDevHandle));
-       printk("Enclosure Handle=0x%X\n", le16_to_cpu(pg0->EnclosureHandle));
-       printk("Slot=0x%X\n", le16_to_cpu(pg0->Slot));
-       printk("SAS Address=0x%llX\n", (unsigned long long)
-           le64_to_cpu(sas_address));
-       printk("Target ID=0x%X\n", pg0->TargetID);
-       printk("Bus=0x%X\n", pg0->Bus);
+       dsasprintk(ioc, printk(KERN_DEBUG "---- SAS DEVICE PAGE 0 ---------\n"));
+       dsasprintk(ioc, printk(KERN_DEBUG "Handle=0x%X\n" ,le16_to_cpu(pg0->DevHandle)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Parent Handle=0x%X\n" ,le16_to_cpu(pg0->ParentDevHandle)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Enclosure Handle=0x%X\n", le16_to_cpu(pg0->EnclosureHandle)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Slot=0x%X\n", le16_to_cpu(pg0->Slot)));
+       dsasprintk(ioc, printk(KERN_DEBUG "SAS Address=0x%llX\n", (unsigned long long)
+           le64_to_cpu(sas_address)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Target ID=0x%X\n", pg0->TargetID));
+       dsasprintk(ioc, printk(KERN_DEBUG "Bus=0x%X\n", pg0->Bus));
        /* The PhyNum field specifies the PHY number of the parent
         * device this device is linked to
         */
-       printk("Parent Phy Num=0x%X\n", pg0->PhyNum);
-       printk("Access Status=0x%X\n", le16_to_cpu(pg0->AccessStatus));
-       printk("Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo));
-       printk("Flags=0x%X\n", le16_to_cpu(pg0->Flags));
-       printk("Physical Port=0x%X\n", pg0->PhysicalPort);
-       printk("\n");
-}
-
-static void mptsas_print_expander_pg1(SasExpanderPage1_t *pg1)
-{
-       printk("---- SAS EXPANDER PAGE 1 ------------\n");
-
-       printk("Physical Port=0x%X\n", pg1->PhysicalPort);
-       printk("PHY Identifier=0x%X\n", pg1->PhyIdentifier);
-       printk("Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate);
-       printk("Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate);
-       printk("Hardware Link Rate=0x%X\n", pg1->HwLinkRate);
-       printk("Owner Device Handle=0x%X\n",
-                       le16_to_cpu(pg1->OwnerDevHandle));
-       printk("Attached Device Handle=0x%X\n",
-                       le16_to_cpu(pg1->AttachedDevHandle));
-}
-#else
-#define mptsas_print_phy_data(phy_data)                do { } while (0)
-#define mptsas_print_phy_pg0(pg0)              do { } while (0)
-#define mptsas_print_phy_pg1(pg1)              do { } while (0)
-#define mptsas_print_device_pg0(pg0)           do { } while (0)
-#define mptsas_print_expander_pg1(pg1)         do { } while (0)
-#endif
+       dsasprintk(ioc, printk(KERN_DEBUG "Parent Phy Num=0x%X\n", pg0->PhyNum));
+       dsasprintk(ioc, printk(KERN_DEBUG "Access Status=0x%X\n", le16_to_cpu(pg0->AccessStatus)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Device Info=0x%X\n", le32_to_cpu(pg0->DeviceInfo)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Flags=0x%X\n", le16_to_cpu(pg0->Flags)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Physical Port=0x%X\n\n", pg0->PhysicalPort));
+}
+
+static void mptsas_print_expander_pg1(MPT_ADAPTER *ioc, SasExpanderPage1_t *pg1)
+{
+       dsasprintk(ioc, printk(KERN_DEBUG "---- SAS EXPANDER PAGE 1 ------------\n"));
+       dsasprintk(ioc, printk(KERN_DEBUG "Physical Port=0x%X\n", pg1->PhysicalPort));
+       dsasprintk(ioc, printk(KERN_DEBUG "PHY Identifier=0x%X\n", pg1->PhyIdentifier));
+       dsasprintk(ioc, printk(KERN_DEBUG "Negotiated Link Rate=0x%X\n", pg1->NegotiatedLinkRate));
+       dsasprintk(ioc, printk(KERN_DEBUG "Programmed Link Rate=0x%X\n", pg1->ProgrammedLinkRate));
+       dsasprintk(ioc, printk(KERN_DEBUG "Hardware Link Rate=0x%X\n", pg1->HwLinkRate));
+       dsasprintk(ioc, printk(KERN_DEBUG "Owner Device Handle=0x%X\n",
+                       le16_to_cpu(pg1->OwnerDevHandle)));
+       dsasprintk(ioc, printk(KERN_DEBUG "Attached Device Handle=0x%X\n\n",
+                       le16_to_cpu(pg1->AttachedDevHandle)));
+}
 
 static inline MPT_ADAPTER *phy_to_ioc(struct sas_phy *phy)
 {
@@ -354,7 +342,7 @@ mptsas_is_end_device(struct mptsas_devinfo * attached)
 
 /* no mutex */
 static void
-mptsas_port_delete(struct mptsas_portinfo_details * port_details)
+mptsas_port_delete(MPT_ADAPTER *ioc, struct mptsas_portinfo_details * port_details)
 {
        struct mptsas_portinfo *port_info;
        struct mptsas_phyinfo *phy_info;
@@ -366,7 +354,7 @@ mptsas_port_delete(struct mptsas_portinfo_details * port_details)
        port_info = port_details->port_info;
        phy_info = port_info->phy_info;
 
-       dsaswideprintk((KERN_DEBUG "%s: [%p]: num_phys=%02d "
+       dsaswideprintk(ioc, printk(KERN_DEBUG "%s: [%p]: num_phys=%02d "
            "bitmask=0x%016llX\n", __FUNCTION__, port_details,
            port_details->num_phys, (unsigned long long)
            port_details->phy_bitmask));
@@ -390,20 +378,19 @@ mptsas_get_rphy(struct mptsas_phyinfo *phy_info)
 }
 
 static inline void
-mptsas_set_rphy(struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy)
+mptsas_set_rphy(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_rphy *rphy)
 {
        if (phy_info->port_details) {
                phy_info->port_details->rphy = rphy;
-               dsaswideprintk((KERN_DEBUG "sas_rphy_add: rphy=%p\n", rphy));
+               dsaswideprintk(ioc, printk(KERN_DEBUG "sas_rphy_add: rphy=%p\n", rphy));
        }
 
-#ifdef MPT_DEBUG_SAS_WIDE
        if (rphy) {
-               dev_printk(KERN_DEBUG, &rphy->dev, "add:");
-               printk("rphy=%p release=%p\n",
-                       rphy, rphy->dev.release);
+               dsaswideprintk(ioc, dev_printk(KERN_DEBUG,
+                   &rphy->dev, "add:"));
+               dsaswideprintk(ioc, printk(KERN_DEBUG "rphy=%p release=%p\n",
+                       rphy, rphy->dev.release));
        }
-#endif
 }
 
 static inline struct sas_port *
@@ -416,18 +403,17 @@ mptsas_get_port(struct mptsas_phyinfo *phy_info)
 }
 
 static inline void
-mptsas_set_port(struct mptsas_phyinfo *phy_info, struct sas_port *port)
+mptsas_set_port(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info, struct sas_port *port)
 {
        if (phy_info->port_details)
                phy_info->port_details->port = port;
 
-#ifdef MPT_DEBUG_SAS_WIDE
        if (port) {
-               dev_printk(KERN_DEBUG, &port->dev, "add: ");
-               printk("port=%p release=%p\n",
-                       port, port->dev.release);
+               dsaswideprintk(ioc, dev_printk(KERN_DEBUG,
+                   &port->dev, "add:"));
+               dsaswideprintk(ioc, printk(KERN_DEBUG "port=%p release=%p\n",
+                       port, port->dev.release));
        }
-#endif
 }
 
 static inline struct scsi_target *
@@ -477,7 +463,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
                 * Removing a phy from a port, letting the last
                 * phy be removed by firmware events.
                 */
-               dsaswideprintk((KERN_DEBUG
+               dsaswideprintk(ioc, printk(KERN_DEBUG
                        "%s: [%p]: deleting phy = %d\n",
                        __FUNCTION__, port_details, i));
                port_details->num_phys--;
@@ -493,7 +479,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
        phy_info = port_info->phy_info;
        for (i = 0 ; i < port_info->num_phys ; i++, phy_info++) {
                sas_address = phy_info->attached.sas_address;
-               dsaswideprintk((KERN_DEBUG "phy_id=%d sas_address=0x%018llX\n",
+               dsaswideprintk(ioc, printk(KERN_DEBUG "phy_id=%d sas_address=0x%018llX\n",
                    i, (unsigned long long)sas_address));
                if (!sas_address)
                        continue;
@@ -512,7 +498,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
                                port_details->phy_bitmask |=
                                    (1 << phy_info->phy_id);
                        phy_info->sas_port_add_phy=1;
-                       dsaswideprintk((KERN_DEBUG "\t\tForming port\n\t\t"
+                       dsaswideprintk(ioc, printk(KERN_DEBUG "\t\tForming port\n\t\t"
                            "phy_id=%d sas_address=0x%018llX\n",
                            i, (unsigned long long)sas_address));
                        phy_info->port_details = port_details;
@@ -529,7 +515,7 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
                                continue;
                        if (phy_info_cmp->port_details == port_details )
                                continue;
-                       dsaswideprintk((KERN_DEBUG
+                       dsaswideprintk(ioc, printk(KERN_DEBUG
                            "\t\tphy_id=%d sas_address=0x%018llX\n",
                            j, (unsigned long long)
                            phy_info_cmp->attached.sas_address));
@@ -559,21 +545,19 @@ mptsas_setup_wide_ports(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
 
  out:
 
-#ifdef MPT_DEBUG_SAS_WIDE
        for (i = 0; i < port_info->num_phys; i++) {
                port_details = port_info->phy_info[i].port_details;
                if (!port_details)
                        continue;
-               dsaswideprintk((KERN_DEBUG
+               dsaswideprintk(ioc, printk(KERN_DEBUG
                    "%s: [%p]: phy_id=%02d num_phys=%02d "
                    "bitmask=0x%016llX\n", __FUNCTION__,
                    port_details, i, port_details->num_phys,
                    (unsigned long long)port_details->phy_bitmask));
-               dsaswideprintk((KERN_DEBUG"\t\tport = %p rphy=%p\n",
+               dsaswideprintk(ioc, printk(KERN_DEBUG"\t\tport = %p rphy=%p\n",
                        port_details->port, port_details->rphy));
        }
-       dsaswideprintk((KERN_DEBUG"\n"));
-#endif
+       dsaswideprintk(ioc, printk(KERN_DEBUG"\n"));
        mutex_unlock(&ioc->sas_topology_mutex);
 }
 
@@ -622,7 +606,7 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
        SCSITaskMgmt_t  *pScsiTm;
 
        if ((mf = mpt_get_msg_frame(ioc->TaskCtx, ioc)) == NULL) {
-               dfailprintk((MYIOC_s_WARN_FMT "%s, no msg frames @%d!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, no msg frames @%d!!\n",
                    ioc->name,__FUNCTION__, __LINE__));
                return 0;
        }
@@ -637,12 +621,12 @@ mptsas_target_reset(MPT_ADAPTER *ioc, u8 channel, u8 id)
        pScsiTm->TaskType = MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET;
        pScsiTm->MsgFlags = MPI_SCSITASKMGMT_MSGFLAGS_LIPRESET_RESET_OPTION;
 
-       DBG_DUMP_TM_REQUEST_FRAME(mf);
+       DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)mf);
 
        if (mpt_send_handshake_request(ioc->TaskCtx, ioc,
            sizeof(SCSITaskMgmt_t), (u32 *)mf, NO_SLEEP)) {
                mpt_free_msg_frame(ioc, mf);
-               dfailprintk((MYIOC_s_WARN_FMT "%s, tm handshake failed @%d!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, tm handshake failed @%d!!\n",
                    ioc->name,__FUNCTION__, __LINE__));
                return 0;
        }
@@ -681,7 +665,7 @@ mptsas_target_reset_queue(MPT_ADAPTER *ioc,
        target_reset_list = kzalloc(sizeof(*target_reset_list),
            GFP_ATOMIC);
        if (!target_reset_list) {
-               dfailprintk((MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
                    ioc->name,__FUNCTION__, __LINE__));
                return;
        }
@@ -748,7 +732,7 @@ mptsas_dev_reset_complete(MPT_ADAPTER *ioc)
 
        ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
        if (!ev) {
-               dfailprintk((MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s, failed to allocate mem @%d..!!\n",
                    ioc->name,__FUNCTION__, __LINE__));
                return;
        }
@@ -1168,7 +1152,7 @@ static int mptsas_get_linkerrors(struct sas_phy *phy)
        if (error)
                goto out_free_consistent;
 
-       mptsas_print_phy_pg1(buffer);
+       mptsas_print_phy_pg1(ioc, buffer);
 
        phy->invalid_dword_count = le32_to_cpu(buffer->InvalidDwordCount);
        phy->running_disparity_error_count =
@@ -1328,11 +1312,137 @@ mptsas_get_bay_identifier(struct sas_rphy *rphy)
        return rc;
 }
 
+static int mptsas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
+                             struct request *req)
+{
+       MPT_ADAPTER *ioc = ((MPT_SCSI_HOST *) shost->hostdata)->ioc;
+       MPT_FRAME_HDR *mf;
+       SmpPassthroughRequest_t *smpreq;
+       struct request *rsp = req->next_rq;
+       int ret;
+       int flagsLength;
+       unsigned long timeleft;
+       char *psge;
+       dma_addr_t dma_addr_in = 0;
+       dma_addr_t dma_addr_out = 0;
+       u64 sas_address = 0;
+
+       if (!rsp) {
+               printk(KERN_ERR "%s: the smp response space is missing\n",
+                      __FUNCTION__);
+               return -EINVAL;
+       }
+
+       /* do we need to support multiple segments? */
+       if (req->bio->bi_vcnt > 1 || rsp->bio->bi_vcnt > 1) {
+               printk(KERN_ERR "%s: multiple segments req %u %u, rsp %u %u\n",
+                      __FUNCTION__, req->bio->bi_vcnt, req->data_len,
+                      rsp->bio->bi_vcnt, rsp->data_len);
+               return -EINVAL;
+       }
+
+       ret = mutex_lock_interruptible(&ioc->sas_mgmt.mutex);
+       if (ret)
+               goto out;
+
+       mf = mpt_get_msg_frame(mptsasMgmtCtx, ioc);
+       if (!mf) {
+               ret = -ENOMEM;
+               goto out_unlock;
+       }
+
+       smpreq = (SmpPassthroughRequest_t *)mf;
+       memset(smpreq, 0, sizeof(*smpreq));
+
+       smpreq->RequestDataLength = cpu_to_le16(req->data_len - 4);
+       smpreq->Function = MPI_FUNCTION_SMP_PASSTHROUGH;
+
+       if (rphy)
+               sas_address = rphy->identify.sas_address;
+       else {
+               struct mptsas_portinfo *port_info;
+
+               mutex_lock(&ioc->sas_topology_mutex);
+               port_info = mptsas_find_portinfo_by_handle(ioc, ioc->handle);
+               if (port_info && port_info->phy_info)
+                       sas_address =
+                               port_info->phy_info[0].phy->identify.sas_address;
+               mutex_unlock(&ioc->sas_topology_mutex);
+       }
+
+       *((u64 *)&smpreq->SASAddress) = cpu_to_le64(sas_address);
+
+       psge = (char *)
+               (((int *) mf) + (offsetof(SmpPassthroughRequest_t, SGL) / 4));
+
+       /* request */
+       flagsLength = (MPI_SGE_FLAGS_SIMPLE_ELEMENT |
+                      MPI_SGE_FLAGS_END_OF_BUFFER |
+                      MPI_SGE_FLAGS_DIRECTION |
+                      mpt_addr_size()) << MPI_SGE_FLAGS_SHIFT;
+       flagsLength |= (req->data_len - 4);
+
+       dma_addr_out = pci_map_single(ioc->pcidev, bio_data(req->bio),
+                                     req->data_len, PCI_DMA_BIDIRECTIONAL);
+       if (!dma_addr_out)
+               goto put_mf;
+       mpt_add_sge(psge, flagsLength, dma_addr_out);
+       psge += (sizeof(u32) + sizeof(dma_addr_t));
+
+       /* response */
+       flagsLength = MPT_SGE_FLAGS_SSIMPLE_READ;
+       flagsLength |= rsp->data_len + 4;
+       dma_addr_in =  pci_map_single(ioc->pcidev, bio_data(rsp->bio),
+                                     rsp->data_len, PCI_DMA_BIDIRECTIONAL);
+       if (!dma_addr_in)
+               goto unmap;
+       mpt_add_sge(psge, flagsLength, dma_addr_in);
+
+       mpt_put_msg_frame(mptsasMgmtCtx, ioc, mf);
+
+       timeleft = wait_for_completion_timeout(&ioc->sas_mgmt.done, 10 * HZ);
+       if (!timeleft) {
+               printk(KERN_ERR "%s: smp timeout!\n", __FUNCTION__);
+               /* On timeout reset the board */
+               mpt_HardResetHandler(ioc, CAN_SLEEP);
+               ret = -ETIMEDOUT;
+               goto unmap;
+       }
+       mf = NULL;
+
+       if (ioc->sas_mgmt.status & MPT_IOCTL_STATUS_RF_VALID) {
+               SmpPassthroughReply_t *smprep;
+
+               smprep = (SmpPassthroughReply_t *)ioc->sas_mgmt.reply;
+               memcpy(req->sense, smprep, sizeof(*smprep));
+               req->sense_len = sizeof(*smprep);
+       } else {
+               printk(KERN_ERR "%s: smp passthru reply failed to be returned\n",
+                      __FUNCTION__);
+               ret = -ENXIO;
+       }
+unmap:
+       if (dma_addr_out)
+               pci_unmap_single(ioc->pcidev, dma_addr_out, req->data_len,
+                                PCI_DMA_BIDIRECTIONAL);
+       if (dma_addr_in)
+               pci_unmap_single(ioc->pcidev, dma_addr_in, rsp->data_len,
+                                PCI_DMA_BIDIRECTIONAL);
+put_mf:
+       if (mf)
+               mpt_free_msg_frame(ioc, mf);
+out_unlock:
+       mutex_unlock(&ioc->sas_mgmt.mutex);
+out:
+       return ret;
+}
+
 static struct sas_function_template mptsas_transport_functions = {
        .get_linkerrors         = mptsas_get_linkerrors,
        .get_enclosure_identifier = mptsas_get_enclosure_identifier,
        .get_bay_identifier     = mptsas_get_bay_identifier,
        .phy_reset              = mptsas_phy_reset,
+       .smp_handler            = mptsas_smp_handler,
 };
 
 static struct scsi_transport_template *mptsas_transport_template;
@@ -1397,7 +1507,7 @@ mptsas_sas_io_unit_pg0(MPT_ADAPTER *ioc, struct mptsas_portinfo *port_info)
            le16_to_cpu(buffer->NvdataVersionDefault);
 
        for (i = 0; i < port_info->num_phys; i++) {
-               mptsas_print_phy_data(&buffer->PhyData[i]);
+               mptsas_print_phy_data(ioc, &buffer->PhyData[i]);
                port_info->phy_info[i].phy_id = i;
                port_info->phy_info[i].port_id =
                    buffer->PhyData[i].Port;
@@ -1522,7 +1632,7 @@ mptsas_sas_phy_pg0(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
        if (error)
                goto out_free_consistent;
 
-       mptsas_print_phy_pg0(buffer);
+       mptsas_print_phy_pg0(ioc, buffer);
 
        phy_info->hw_link_rate = buffer->HwLinkRate;
        phy_info->programmed_link_rate = buffer->ProgrammedLinkRate;
@@ -1589,7 +1699,7 @@ mptsas_sas_device_pg0(MPT_ADAPTER *ioc, struct mptsas_devinfo *device_info,
        if (error)
                goto out_free_consistent;
 
-       mptsas_print_device_pg0(buffer);
+       mptsas_print_device_pg0(ioc, buffer);
 
        device_info->handle = le16_to_cpu(buffer->DevHandle);
        device_info->handle_parent = le16_to_cpu(buffer->ParentDevHandle);
@@ -1737,7 +1847,7 @@ mptsas_sas_expander_pg1(MPT_ADAPTER *ioc, struct mptsas_phyinfo *phy_info,
                goto out_free_consistent;
 
 
-       mptsas_print_expander_pg1(buffer);
+       mptsas_print_expander_pg1(ioc, buffer);
 
        /* save config data */
        phy_info->phy_id = buffer->PhyIdentifier;
@@ -1946,17 +2056,17 @@ static int mptsas_probe_one_phy(struct device *dev,
                        }
                        error = sas_port_add(port);
                        if (error) {
-                               dfailprintk((MYIOC_s_ERR_FMT
+                               dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                        "%s: exit at line=%d\n", ioc->name,
                                        __FUNCTION__, __LINE__));
                                goto out;
                        }
-                       mptsas_set_port(phy_info, port);
-                       dsaswideprintk((KERN_DEBUG
+                       mptsas_set_port(ioc, phy_info, port);
+                       dsaswideprintk(ioc, printk(KERN_DEBUG
                            "sas_port_alloc: port=%p dev=%p port_id=%d\n",
                            port, dev, port->port_identifier));
                }
-               dsaswideprintk((KERN_DEBUG "sas_port_add_phy: phy_id=%d\n",
+               dsaswideprintk(ioc, printk(KERN_DEBUG "sas_port_add_phy: phy_id=%d\n",
                    phy_info->phy_id));
                sas_port_add_phy(port, phy_info->phy);
                phy_info->sas_port_add_phy = 0;
@@ -2017,7 +2127,7 @@ static int mptsas_probe_one_phy(struct device *dev,
                        break;
                }
                if (!rphy) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        goto out;
@@ -2026,13 +2136,13 @@ static int mptsas_probe_one_phy(struct device *dev,
                rphy->identify = identify;
                error = sas_rphy_add(rphy);
                if (error) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        sas_rphy_free(rphy);
                        goto out;
                }
-               mptsas_set_rphy(phy_info, rphy);
+               mptsas_set_rphy(ioc, phy_info, rphy);
        }
 
  out:
@@ -2258,18 +2368,17 @@ mptsas_delete_expander_phys(MPT_ADAPTER *ioc)
                                if (phy_info->attached.sas_address !=
                                        expander_sas_address)
                                        continue;
-#ifdef MPT_DEBUG_SAS_WIDE
-                               dev_printk(KERN_DEBUG, &port->dev,
-                                   "delete port (%d)\n", port->port_identifier);
-#endif
+                               dsaswideprintk(ioc,
+                                       dev_printk(KERN_DEBUG, &port->dev,
+                                       "delete port (%d)\n", port->port_identifier));
                                sas_port_delete(port);
-                               mptsas_port_delete(phy_info->port_details);
+                               mptsas_port_delete(ioc, phy_info->port_details);
                        }
  next_port:
 
                        phy_info = port_info->phy_info;
                        for (i = 0; i < port_info->num_phys; i++, phy_info++)
-                               mptsas_port_delete(phy_info->port_details);
+                               mptsas_port_delete(ioc, phy_info->port_details);
 
                        list_del(&port_info->list);
                        kfree(port_info->phy_info);
@@ -2555,7 +2664,7 @@ mptsas_hotplug_work(struct work_struct *work)
                                    (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID <<
                                     MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
                                    (ev->channel << 8) + ev->id)) {
-                                       dfailprintk((MYIOC_s_ERR_FMT
+                                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                        "%s: exit at line=%d\n", ioc->name,
                                                __FUNCTION__, __LINE__));
                                        break;
@@ -2575,20 +2684,20 @@ mptsas_hotplug_work(struct work_struct *work)
                 * Sanity checks, for non-existing phys and remote rphys.
                 */
                if (!phy_info){
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        break;
                }
                if (!phy_info->port_details) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        break;
                }
                rphy = mptsas_get_rphy(phy_info);
                if (!rphy) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        break;
@@ -2596,7 +2705,7 @@ mptsas_hotplug_work(struct work_struct *work)
 
                port = mptsas_get_port(phy_info);
                if (!port) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        break;
@@ -2607,7 +2716,7 @@ mptsas_hotplug_work(struct work_struct *work)
                        vtarget = starget->hostdata;
 
                        if (!vtarget) {
-                               dfailprintk((MYIOC_s_ERR_FMT
+                               dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                        "%s: exit at line=%d\n", ioc->name,
                                        __FUNCTION__, __LINE__));
                                break;
@@ -2645,12 +2754,10 @@ mptsas_hotplug_work(struct work_struct *work)
                printk(MYIOC_s_INFO_FMT
                       "removing %s device, channel %d, id %d, phy %d\n",
                       ioc->name, ds, ev->channel, ev->id, phy_info->phy_id);
-#ifdef MPT_DEBUG_SAS_WIDE
                dev_printk(KERN_DEBUG, &port->dev,
                    "delete port (%d)\n", port->port_identifier);
-#endif
                sas_port_delete(port);
-               mptsas_port_delete(phy_info->port_details);
+               mptsas_port_delete(ioc, phy_info->port_details);
                break;
        case MPTSAS_ADD_DEVICE:
 
@@ -2664,7 +2771,7 @@ mptsas_hotplug_work(struct work_struct *work)
                    (MPI_SAS_DEVICE_PGAD_FORM_BUS_TARGET_ID <<
                     MPI_SAS_DEVICE_PGAD_FORM_SHIFT),
                        (ev->channel << 8) + ev->id)) {
-                               dfailprintk((MYIOC_s_ERR_FMT
+                               dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                        "%s: exit at line=%d\n", ioc->name,
                                        __FUNCTION__, __LINE__));
                        break;
@@ -2676,7 +2783,7 @@ mptsas_hotplug_work(struct work_struct *work)
                                sas_device.sas_address);
 
                if (!phy_info || !phy_info->port_details) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        break;
@@ -2688,7 +2795,7 @@ mptsas_hotplug_work(struct work_struct *work)
                        vtarget = starget->hostdata;
 
                        if (!vtarget) {
-                               dfailprintk((MYIOC_s_ERR_FMT
+                               dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                        "%s: exit at line=%d\n", ioc->name,
                                        __FUNCTION__, __LINE__));
                                break;
@@ -2711,7 +2818,7 @@ mptsas_hotplug_work(struct work_struct *work)
                }
 
                if (mptsas_get_rphy(phy_info)) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        if (ev->channel) printk("%d\n", __LINE__);
@@ -2720,7 +2827,7 @@ mptsas_hotplug_work(struct work_struct *work)
 
                port = mptsas_get_port(phy_info);
                if (!port) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        break;
@@ -2745,7 +2852,7 @@ mptsas_hotplug_work(struct work_struct *work)
                mptsas_parse_device_info(&identify, &phy_info->attached);
                rphy = sas_end_device_alloc(port);
                if (!rphy) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        break; /* non-fatal: an rphy can be added later */
@@ -2753,13 +2860,13 @@ mptsas_hotplug_work(struct work_struct *work)
 
                rphy->identify = identify;
                if (sas_rphy_add(rphy)) {
-                       dfailprintk((MYIOC_s_ERR_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_ERR_FMT
                                "%s: exit at line=%d\n", ioc->name,
                                __FUNCTION__, __LINE__));
                        sas_rphy_free(rphy);
                        break;
                }
-               mptsas_set_rphy(phy_info, rphy);
+               mptsas_set_rphy(ioc, phy_info, rphy);
                break;
        case MPTSAS_ADD_RAID:
                sdev = scsi_device_lookup(ioc->sh, MPTSAS_RAID_CHANNEL,
@@ -3175,7 +3282,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        if (numSGE < sh->sg_tablesize) {
                /* Reset this value */
-               dprintk((MYIOC_s_INFO_FMT
+               dprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                  "Resetting sg_tablesize to %d from %d\n",
                  ioc->name, numSGE, sh->sg_tablesize));
                sh->sg_tablesize = numSGE;
@@ -3193,7 +3300,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto out_mptsas_probe;
        }
 
-       dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n",
+       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
                 ioc->name, hd->ScsiLookup));
 
        /* Clear the TM flags
@@ -3233,7 +3340,7 @@ mptsas_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        error = scsi_add_host(sh, &ioc->pcidev->dev);
        if (error) {
-               dprintk((KERN_ERR MYNAM
+               dprintk(ioc, printk(KERN_ERR MYNAM
                  "scsi_add_host failed\n"));
                goto out_mptsas_probe;
        }
@@ -3261,7 +3368,7 @@ static void __devexit mptsas_remove(struct pci_dev *pdev)
        list_for_each_entry_safe(p, n, &ioc->sas_topology, list) {
                list_del(&p->list);
                for (i = 0 ; i < p->num_phys ; i++)
-                       mptsas_port_delete(p->phy_info[i].port_details);
+                       mptsas_port_delete(ioc, p->phy_info[i].port_details);
                kfree(p->phy_info);
                kfree(p);
        }
@@ -3316,15 +3423,8 @@ mptsas_init(void)
                mpt_register(mptscsih_scandv_complete, MPTSAS_DRIVER);
        mptsasMgmtCtx = mpt_register(mptsas_mgmt_done, MPTSAS_DRIVER);
 
-       if (mpt_event_register(mptsasDoneCtx, mptsas_event_process) == 0) {
-               devtverboseprintk((KERN_INFO MYNAM
-                 ": Registered for IOC event notifications\n"));
-       }
-
-       if (mpt_reset_register(mptsasDoneCtx, mptsas_ioc_reset) == 0) {
-               dprintk((KERN_INFO MYNAM
-                 ": Registered for IOC reset notifications\n"));
-       }
+       mpt_event_register(mptsasDoneCtx, mptsas_event_process);
+       mpt_reset_register(mptsasDoneCtx, mptsas_ioc_reset);
 
        error = pci_register_driver(&mptsas_driver);
        if (error)
index fd3aa2619f427317c5d7afb1e73d472887bd2c7a..5431529741ad28380442e3b5618d799b988bdecd 100644 (file)
@@ -191,7 +191,7 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER *ioc, int *retIndex)
        int rc;
        int chain_idx;
 
-       dsgprintk((MYIOC_s_INFO_FMT "getFreeChainBuffer called\n",
+       dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer called\n",
                        ioc->name));
        spin_lock_irqsave(&ioc->FreeQlock, flags);
        if (!list_empty(&ioc->FreeChainQ)) {
@@ -203,12 +203,12 @@ mptscsih_getFreeChainBuffer(MPT_ADAPTER *ioc, int *retIndex)
                offset = (u8 *)chainBuf - (u8 *)ioc->ChainBuffer;
                chain_idx = offset / ioc->req_sz;
                rc = SUCCESS;
-               dsgprintk((MYIOC_s_ERR_FMT "getFreeChainBuffer chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n",
+               dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer chainBuf=%p ChainBuffer=%p offset=%d chain_idx=%d\n",
                        ioc->name, chainBuf, ioc->ChainBuffer, offset, chain_idx));
        } else {
                rc = FAILED;
                chain_idx = MPT_HOST_NO_CHAIN;
-               dfailprintk((MYIOC_s_INFO_FMT "getFreeChainBuffer failed\n",
+               dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT "getFreeChainBuffer failed\n",
                        ioc->name));
        }
        spin_unlock_irqrestore(&ioc->FreeQlock, flags);
@@ -337,7 +337,7 @@ nextSGEset:
                         */
                        pReq->ChainOffset = 0;
                        RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor)  + 1) & 0x03;
-                       dsgprintk((MYIOC_s_INFO_FMT
+                       dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                            "Single Buffer RequestNB=%x, sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset));
                        ioc->RequestNB[req_idx] = RequestNB;
                }
@@ -353,7 +353,7 @@ nextSGEset:
                 * Loop until done.
                 */
 
-               dsgprintk((MYIOC_s_INFO_FMT "SG: Chain Required! sg done %d\n",
+               dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "SG: Chain Required! sg done %d\n",
                                ioc->name, sg_done));
 
                /* Set LAST_ELEMENT flag for last non-chain element
@@ -386,7 +386,7 @@ nextSGEset:
                         */
                        pReq->ChainOffset = (u8) (sgeOffset >> 2);
                        RequestNB = (((sgeOffset - 1) >> ioc->NBShiftFactor)  + 1) & 0x03;
-                       dsgprintk((MYIOC_s_ERR_FMT "Chain Buffer Needed, RequestNB=%x sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset));
+                       dsgprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Chain Buffer Needed, RequestNB=%x sgeOffset=%d\n", ioc->name, RequestNB, sgeOffset));
                        ioc->RequestNB[req_idx] = RequestNB;
                }
 
@@ -397,7 +397,7 @@ nextSGEset:
                 * in current buffer. Get a chain buffer.
                 */
                if ((mptscsih_getFreeChainBuffer(ioc, &newIndex)) == FAILED) {
-                       dfailprintk((MYIOC_s_INFO_FMT
+                       dfailprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                            "getFreeChainBuffer FAILED SCSI cmd=%02x (%p)\n",
                            ioc->name, pReq->CDB[0], SCpnt));
                        return FAILED;
@@ -419,7 +419,7 @@ nextSGEset:
                 *   out the Address and Flags fields.
                 */
                chainSge = (char *) psge;
-               dsgprintk((KERN_INFO "  Current buff @ %p (index 0x%x)",
+               dsgprintk(ioc, printk(KERN_DEBUG "  Current buff @ %p (index 0x%x)",
                                psge, req_idx));
 
                /* Start the SGE for the next buffer
@@ -428,7 +428,7 @@ nextSGEset:
                sgeOffset = 0;
                sg_done = 0;
 
-               dsgprintk((KERN_INFO "  Chain buff @ %p (index 0x%x)\n",
+               dsgprintk(ioc, printk(KERN_DEBUG "  Chain buff @ %p (index 0x%x)\n",
                                psge, chain_idx));
 
                /* Start the SGE for the next buffer
@@ -456,7 +456,7 @@ mptscsih_issue_sep_command(MPT_ADAPTER *ioc, VirtTarget *vtarget,
                return;
 
        if ((mf = mpt_get_msg_frame(ioc->InternalCtx, ioc)) == NULL) {
-               dfailprintk((MYIOC_s_WARN_FMT "%s: no msg frames!!\n",
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT "%s: no msg frames!!\n",
                    ioc->name,__FUNCTION__));
                return;
        }
@@ -467,93 +467,158 @@ mptscsih_issue_sep_command(MPT_ADAPTER *ioc, VirtTarget *vtarget,
        SEPMsg->TargetID = vtarget->id;
        SEPMsg->Action = MPI_SEP_REQ_ACTION_WRITE_STATUS;
        SEPMsg->SlotStatus = SlotStatus;
-       devtverboseprintk((MYIOC_s_WARN_FMT
+       devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT
            "Sending SEP cmd=%x channel=%d id=%d\n",
            ioc->name, SlotStatus, SEPMsg->Bus, SEPMsg->TargetID));
        mpt_put_msg_frame(ioc->DoneCtx, ioc, mf);
 }
 
-#ifdef MPT_DEBUG_REPLY
+#ifdef CONFIG_FUSION_LOGGING
 /**
- *     mptscsih_iocstatus_info_scsiio - IOCSTATUS information for SCSIIO
+ *     mptscsih_info_scsiio - debug print info on reply frame
  *     @ioc: Pointer to MPT_ADAPTER structure
- *     @ioc_status: U32 IOCStatus word from IOC
- *     @scsi_status: U8 sam status from target
- *     @scsi_state: U8 scsi state
  *     @sc: original scsi cmnd pointer
- *     @mf: Pointer to MPT request frame
+ *     @pScsiReply: Pointer to MPT reply frame
+ *
+ *     MPT_DEBUG_REPLY needs to be enabled to obtain this info
  *
  *     Refer to lsi/mpi.h.
  **/
 static void
-mptscsih_iocstatus_info_scsiio(MPT_ADAPTER *ioc, u32 ioc_status,
-    u8 scsi_status, u8 scsi_state, struct scsi_cmnd *sc)
+mptscsih_info_scsiio(MPT_ADAPTER *ioc, struct scsi_cmnd *sc, SCSIIOReply_t * pScsiReply)
 {
-       char extend_desc[EVENT_DESCR_STR_SZ];
-       char *desc = NULL;
+       char    *desc = NULL;
+       char    *desc1 = NULL;
+       u16     ioc_status;
+       u8      skey, asc, ascq;
+
+       ioc_status = le16_to_cpu(pScsiReply->IOCStatus) & MPI_IOCSTATUS_MASK;
 
        switch (ioc_status) {
 
-       case MPI_IOCSTATUS_SCSI_INVALID_BUS: /* 0x0041 */
-               desc = "SCSI Invalid Bus";
+       case MPI_IOCSTATUS_SUCCESS:
+               desc = "success";
                break;
-
-       case MPI_IOCSTATUS_SCSI_INVALID_TARGETID: /* 0x0042 */
-               desc = "SCSI Invalid TargetID";
+       case MPI_IOCSTATUS_SCSI_INVALID_BUS:
+               desc = "invalid bus";
                break;
-
-       case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE: /* 0x0043 */
-               /*
-                * Inquiry is issued for device scanning
-                */
-               if (sc->cmnd[0] != 0x12)
-                       desc = "SCSI Device Not There";
+       case MPI_IOCSTATUS_SCSI_INVALID_TARGETID:
+               desc = "invalid target_id";
                break;
-
-       case MPI_IOCSTATUS_SCSI_DATA_OVERRUN: /* 0x0044 */
-               desc = "SCSI Data Overrun";
+       case MPI_IOCSTATUS_SCSI_DEVICE_NOT_THERE:
+               desc = "device not there";
                break;
-
-       case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR: /* 0x0046 */
-               desc = "SCSI I/O Data Error";
+       case MPI_IOCSTATUS_SCSI_DATA_OVERRUN:
+               desc = "data overrun";
                break;
-
-       case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR: /* 0x0047 */
-               desc = "SCSI Protocol Error";
+       case MPI_IOCSTATUS_SCSI_DATA_UNDERRUN:
+               desc = "data underrun";
                break;
-
-       case MPI_IOCSTATUS_SCSI_TASK_TERMINATED: /* 0x0048 */
-               desc = "SCSI Task Terminated";
+       case MPI_IOCSTATUS_SCSI_IO_DATA_ERROR:
+               desc = "I/O data error";
                break;
-
-       case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH: /* 0x0049 */
-               desc = "SCSI Residual Mismatch";
+       case MPI_IOCSTATUS_SCSI_PROTOCOL_ERROR:
+               desc = "protocol error";
                break;
-
-       case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED: /* 0x004A */
-               desc = "SCSI Task Management Failed";
+       case MPI_IOCSTATUS_SCSI_TASK_TERMINATED:
+               desc = "task terminated";
                break;
-
-       case MPI_IOCSTATUS_SCSI_IOC_TERMINATED: /* 0x004B */
-               desc = "SCSI IOC Terminated";
+       case MPI_IOCSTATUS_SCSI_RESIDUAL_MISMATCH:
+               desc = "residual mismatch";
+               break;
+       case MPI_IOCSTATUS_SCSI_TASK_MGMT_FAILED:
+               desc = "task management failed";
+               break;
+       case MPI_IOCSTATUS_SCSI_IOC_TERMINATED:
+               desc = "IOC terminated";
+               break;
+       case MPI_IOCSTATUS_SCSI_EXT_TERMINATED:
+               desc = "ext terminated";
                break;
+       default:
+               desc = "";
+               break;
+       }
+
+       switch (pScsiReply->SCSIStatus)
+       {
 
-       case MPI_IOCSTATUS_SCSI_EXT_TERMINATED: /* 0x004C */
-               desc = "SCSI Ext Terminated";
+       case MPI_SCSI_STATUS_SUCCESS:
+               desc1 = "success";
+               break;
+       case MPI_SCSI_STATUS_CHECK_CONDITION:
+               desc1 = "check condition";
+               break;
+       case MPI_SCSI_STATUS_CONDITION_MET:
+               desc1 = "condition met";
+               break;
+       case MPI_SCSI_STATUS_BUSY:
+               desc1 = "busy";
+               break;
+       case MPI_SCSI_STATUS_INTERMEDIATE:
+               desc1 = "intermediate";
+               break;
+       case MPI_SCSI_STATUS_INTERMEDIATE_CONDMET:
+               desc1 = "intermediate condmet";
+               break;
+       case MPI_SCSI_STATUS_RESERVATION_CONFLICT:
+               desc1 = "reservation conflict";
+               break;
+       case MPI_SCSI_STATUS_COMMAND_TERMINATED:
+               desc1 = "command terminated";
+               break;
+       case MPI_SCSI_STATUS_TASK_SET_FULL:
+               desc1 = "task set full";
+               break;
+       case MPI_SCSI_STATUS_ACA_ACTIVE:
+               desc1 = "aca active";
+               break;
+       case MPI_SCSI_STATUS_FCPEXT_DEVICE_LOGGED_OUT:
+               desc1 = "fcpext device logged out";
+               break;
+       case MPI_SCSI_STATUS_FCPEXT_NO_LINK:
+               desc1 = "fcpext no link";
+               break;
+       case MPI_SCSI_STATUS_FCPEXT_UNASSIGNED:
+               desc1 = "fcpext unassigned";
+               break;
+       default:
+               desc1 = "";
                break;
        }
 
-       if (!desc)
-               return;
+       scsi_print_command(sc);
+       printk(KERN_DEBUG "\tfw_channel = %d, fw_id = %d\n",
+           pScsiReply->Bus, pScsiReply->TargetID);
+       printk(KERN_DEBUG "\trequest_len = %d, underflow = %d, resid = %d\n",
+           scsi_bufflen(sc), sc->underflow, scsi_get_resid(sc));
+       printk(KERN_DEBUG "\ttag = %d, transfer_count = %d, sc->result = %08X\n",
+           le16_to_cpu(pScsiReply->TaskTag),
+           le32_to_cpu(pScsiReply->TransferCount), sc->result);
 
-       snprintf(extend_desc, EVENT_DESCR_STR_SZ,
-           "[%d:%d:%d:%d] cmd=%02Xh, sam_status=%02Xh state=%02Xh",
-               sc->device->host->host_no,
-               sc->device->channel, sc->device->id, sc->device->lun,
-               sc->cmnd[0], scsi_status, scsi_state);
+       printk(KERN_DEBUG "\tiocstatus = %s (0x%04x), "
+           "scsi_status = %s (0x%02x), scsi_state = (0x%02x)\n",
+           desc, ioc_status,
+           desc1, pScsiReply->SCSIStatus,
+           pScsiReply->SCSIState);
 
-       printk(MYIOC_s_INFO_FMT "IOCStatus(0x%04X): %s: %s\n",
-           ioc->name, ioc_status, desc, extend_desc);
+       if (pScsiReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_VALID) {
+               skey = sc->sense_buffer[2] & 0x0F;
+               asc = sc->sense_buffer[12];
+               ascq = sc->sense_buffer[13];
+
+               printk(KERN_DEBUG "\t[sense_key,asc,ascq]: "
+                   "[0x%02x,0x%02x,0x%02x]\n",
+                   skey, asc, ascq);
+       }
+
+       /*
+        *  Look for + dump FCP ResponseInfo[]!
+        */
+       if (pScsiReply->SCSIState & MPI_SCSI_STATE_RESPONSE_INFO_VALID &&
+           pScsiReply->ResponseInfo)
+               printk(KERN_DEBUG "response_info = %08xh\n",
+                   le32_to_cpu(pScsiReply->ResponseInfo));
 }
 #endif
 
@@ -627,11 +692,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
        pScsiReply = (SCSIIOReply_t *) mr;
 
        if((ioc->facts.MsgVersion >= MPI_VERSION_01_05) && pScsiReply){
-               dmfprintk((MYIOC_s_INFO_FMT
+               dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                        "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d,task-tag=%d)\n",
                        ioc->name, mf, mr, sc, req_idx, pScsiReply->TaskTag));
        }else{
-               dmfprintk((MYIOC_s_INFO_FMT
+               dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                        "ScsiDone (mf=%p,mr=%p,sc=%p,idx=%d)\n",
                        ioc->name, mf, mr, sc, req_idx));
        }
@@ -759,7 +824,7 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                                sc->result=DID_SOFT_ERROR << 16;
                        else /* Sufficient data transfer occurred */
                                sc->result = (DID_OK << 16) | scsi_status;
-                       dreplyprintk((KERN_NOTICE
+                       dreplyprintk(ioc, printk(KERN_DEBUG
                            "RESIDUAL_MISMATCH: result=%x on channel=%d id=%d\n",
                            sc->result, sc->device->channel, sc->device->id));
                        break;
@@ -792,9 +857,11 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                                }
                        }
 
-                       dreplyprintk((KERN_NOTICE "  sc->underflow={report ERR if < %02xh bytes xfer'd}\n",
+
+                       dreplyprintk(ioc, printk(KERN_DEBUG "  sc->underflow={report ERR if < %02xh bytes xfer'd}\n",
                                        sc->underflow));
-                       dreplyprintk((KERN_NOTICE "  ActBytesXferd=%02xh\n", xfer_cnt));
+                       dreplyprintk(ioc, printk(KERN_DEBUG "  ActBytesXferd=%02xh\n", xfer_cnt));
+
                        /* Report Queue Full
                         */
                        if (scsi_status == MPI_SCSI_STATUS_TASK_SET_FULL)
@@ -871,27 +938,9 @@ mptscsih_io_done(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 
                }       /* switch(status) */
 
-#ifdef MPT_DEBUG_REPLY
-               if (sc->result) {
-
-                       mptscsih_iocstatus_info_scsiio(ioc, status,
-                           scsi_status, scsi_state, sc);
-
-                       dreplyprintk(("%s: [%d:%d:%d:%d] cmd=0x%02x "
-                           "result=0x%08x\n\tiocstatus=0x%04X "
-                           "scsi_state=0x%02X scsi_status=0x%02X "
-                           "loginfo=0x%08X\n", __FUNCTION__,
-                           sc->device->host->host_no, sc->device->channel, sc->device->id,
-                           sc->device->lun, sc->cmnd[0], sc->result, status,
-                           scsi_state, scsi_status, log_info));
-
-                       dreplyprintk(("%s: [%d:%d:%d:%d] resid=%d "
-                                     "bufflen=%d xfer_cnt=%d\n", __FUNCTION__,
-                                     sc->device->host->host_no,
-                                     sc->device->channel, sc->device->id,
-                                     sc->device->lun, scsi_get_resid(sc),
-                                     scsi_bufflen(sc), xfer_cnt));
-               }
+#ifdef CONFIG_FUSION_LOGGING
+               if (sc->result && (ioc->debug_level & MPT_DEBUG_REPLY))
+                       mptscsih_info_scsiio(ioc, sc, pScsiReply);
 #endif
 
        } /* end of address reply case */
@@ -925,7 +974,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
        int              ii;
        int              max = ioc->req_depth;
 
-       dprintk((KERN_INFO MYNAM ": flush_ScsiLookup called\n"));
+       dprintk(ioc, printk(KERN_DEBUG MYNAM ": flush_ScsiLookup called\n"));
        for (ii= 0; ii < max; ii++) {
                if ((SCpnt = hd->ScsiLookup[ii]) != NULL) {
 
@@ -937,7 +986,7 @@ mptscsih_flush_running_cmds(MPT_SCSI_HOST *hd)
                        hd->ScsiLookup[ii] = NULL;
 
                        mf = MPT_INDEX_2_MFPTR(ioc, ii);
-                       dmfprintk(( "flush: ScsiDone (mf=%p,sc=%p)\n",
+                       dmfprintk(ioc, printk(KERN_DEBUG MYNAM ": flush: ScsiDone (mf=%p,sc=%p)\n",
                                        mf, SCpnt));
 
                        /* Free Chain buffers */
@@ -987,7 +1036,7 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
        struct scsi_cmnd *sc;
        struct scsi_lun  lun;
 
-       dsprintk((KERN_INFO MYNAM ": search_running channel %d id %d lun %d max %d\n",
+       dsprintk(hd->ioc, printk(KERN_DEBUG MYNAM ": search_running channel %d id %d lun %d max %d\n",
            vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun, max));
 
        for (ii=0; ii < max; ii++) {
@@ -1020,9 +1069,9 @@ mptscsih_search_running_cmds(MPT_SCSI_HOST *hd, VirtDevice *vdevice)
                        scsi_dma_unmap(sc);
                        sc->host_scribble = NULL;
                        sc->result = DID_NO_CONNECT << 16;
-                       dsprintk(( "search_running: found (sc=%p, mf = %p) "
-                           "channel %d id %d, lun %d \n", sc, mf,
-                           vdevice->vtarget->channel, vdevice->vtarget->id, vdevice->lun));
+                       sdev_printk(KERN_INFO, sc->device, "completing cmds: fw_channel %d,"
+                          "fw_id %d, sc=%p, mf = %p, idx=%x\n", vdevice->vtarget->channel,
+                          vdevice->vtarget->id, sc, mf, ii);
                        sc->scsi_done(sc);
                }
        }
@@ -1057,7 +1106,7 @@ mptscsih_report_queue_full(struct scsi_cmnd *sc, SCSIIOReply_t *pScsiReply, SCSI
                return;
 
        if (time - hd->last_queue_full > 10 * HZ) {
-               dprintk((MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
+               dprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "Device (%d:%d:%d) reported QUEUE_FULL!\n",
                                hd->ioc->name, 0, sc->device->id, sc->device->lun));
                hd->last_queue_full = time;
        }
@@ -1098,7 +1147,7 @@ mptscsih_remove(struct pci_dev *pdev)
                hd->ScsiLookup = NULL;
        }
 
-       dprintk((MYIOC_s_INFO_FMT
+       dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
            "Free'd ScsiLookup (%d) memory\n",
            hd->ioc->name, sz1));
 
@@ -1317,17 +1366,19 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        u32      cmd_len;
        int      my_idx;
        int      ii;
+       MPT_ADAPTER *ioc;
 
        hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata;
+       ioc = hd->ioc;
        lun = SCpnt->device->lun;
        SCpnt->scsi_done = done;
 
-       dmfprintk((MYIOC_s_INFO_FMT "qcmd: SCpnt=%p, done()=%p\n",
-                       (hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt, done));
+       dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "qcmd: SCpnt=%p, done()=%p\n",
+               ioc->name, SCpnt, done));
 
        if (hd->resetPending) {
-               dtmprintk((MYIOC_s_WARN_FMT "qcmd: SCpnt=%p timeout + 60HZ\n",
-                       (hd && hd->ioc) ? hd->ioc->name : "ioc?", SCpnt));
+               dtmprintk(ioc, printk(MYIOC_s_WARN_FMT "qcmd: SCpnt=%p timeout + 60HZ\n",
+                       ioc->name, SCpnt));
                return SCSI_MLQUEUE_HOST_BUSY;
        }
 
@@ -1335,8 +1386,8 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
         *  Put together a MPT SCSI request...
         */
        if ((mf = mpt_get_msg_frame(hd->ioc->DoneCtx, hd->ioc)) == NULL) {
-               dprintk((MYIOC_s_WARN_FMT "QueueCmd, no msg frames!!\n",
-                               hd->ioc->name));
+               dprintk(ioc, printk(MYIOC_s_WARN_FMT "QueueCmd, no msg frames!!\n",
+                               ioc->name));
                return SCSI_MLQUEUE_HOST_BUSY;
        }
 
@@ -1422,9 +1473,9 @@ mptscsih_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
        hd->ScsiLookup[my_idx] = SCpnt;
 
        mpt_put_msg_frame(hd->ioc->DoneCtx, hd->ioc, mf);
-       dmfprintk((MYIOC_s_INFO_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n",
-                       hd->ioc->name, SCpnt, mf, my_idx));
-       DBG_DUMP_REQUEST_FRAME(mf)
+       dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Issued SCSI cmd (%p) mf=%p idx=%d\n",
+                       ioc->name, SCpnt, mf, my_idx));
+       DBG_DUMP_REQUEST_FRAME(ioc, (u32 *)mf)
        return 0;
 
  fail:
@@ -1475,7 +1526,7 @@ mptscsih_freeChainBuffers(MPT_ADAPTER *ioc, int req_idx)
                list_add_tail(&chain->u.frame.linkage.list, &ioc->FreeChainQ);
                spin_unlock_irqrestore(&ioc->FreeQlock, flags);
 
-               dmfprintk((MYIOC_s_INFO_FMT "FreeChainBuffers (index %d)\n",
+               dmfprintk(ioc, printk(MYIOC_s_DEBUG_FMT "FreeChainBuffers (index %d)\n",
                                ioc->name, chain_idx));
 
                /* handle next */
@@ -1519,7 +1570,7 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c
        unsigned long    flags;
 
        ioc = hd->ioc;
-       dtmprintk((MYIOC_s_INFO_FMT "TMHandler Entered!\n", ioc->name));
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TMHandler Entered!\n", ioc->name));
 
        // SJR - CHECKME - Can we avoid this here?
        // (mpt_HardResetHandler has this check...)
@@ -1539,20 +1590,20 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c
         */
        if (mptscsih_tm_pending_wait(hd) == FAILED) {
                if (type == MPI_SCSITASKMGMT_TASKTYPE_ABORT_TASK) {
-                       dtmprintk((KERN_INFO MYNAM ": %s: TMHandler abort: "
+                       dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: TMHandler abort: "
                           "Timed out waiting for last TM (%d) to complete! \n",
-                          hd->ioc->name, hd->tmPending));
+                          ioc->name, hd->tmPending));
                        return FAILED;
                } else if (type == MPI_SCSITASKMGMT_TASKTYPE_TARGET_RESET) {
-                       dtmprintk((KERN_INFO MYNAM ": %s: TMHandler target "
+                       dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: TMHandler target "
                                "reset: Timed out waiting for last TM (%d) "
-                               "to complete! \n", hd->ioc->name,
+                               "to complete! \n", ioc->name,
                                hd->tmPending));
                        return FAILED;
                } else if (type == MPI_SCSITASKMGMT_TASKTYPE_RESET_BUS) {
-                       dtmprintk((KERN_INFO MYNAM ": %s: TMHandler bus reset: "
+                       dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: TMHandler bus reset: "
                           "Timed out waiting for last TM (%d) to complete! \n",
-                          hd->ioc->name, hd->tmPending));
+                         ioc->name, hd->tmPending));
                        return FAILED;
                }
        } else {
@@ -1591,12 +1642,13 @@ mptscsih_TMHandler(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, int c
            ctx2abort, timeout);
        if (rc)
                printk(MYIOC_s_INFO_FMT "Issue of TaskMgmt failed!\n",
-                      hd->ioc->name);
+                      ioc->name);
        else
-               dtmprintk((MYIOC_s_INFO_FMT "Issue of TaskMgmt Successful!\n",
-                          hd->ioc->name));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Issue of TaskMgmt Successful!\n",
+                          ioc->name));
 
-       dtmprintk((MYIOC_s_INFO_FMT "TMHandler rc = %d!\n", hd->ioc->name, rc));
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT
+                       "TMHandler rc = %d!\n", ioc->name, rc));
 
        return rc;
 }
@@ -1632,11 +1684,11 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i
        /* Return Fail to calling function if no message frames available.
         */
        if ((mf = mpt_get_msg_frame(hd->ioc->TaskCtx, hd->ioc)) == NULL) {
-               dfailprintk((MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n",
+               dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "IssueTaskMgmt, no msg frames!!\n",
                                hd->ioc->name));
                return FAILED;
        }
-       dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt request @ %p\n",
+       dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt request @ %p\n",
                        hd->ioc->name, mf));
 
        /* Format the Request
@@ -1660,27 +1712,27 @@ mptscsih_IssueTaskMgmt(MPT_SCSI_HOST *hd, u8 type, u8 channel, u8 id, int lun, i
 
        pScsiTm->TaskMsgContext = ctx2abort;
 
-       dtmprintk((MYIOC_s_INFO_FMT "IssueTaskMgmt: ctx2abort (0x%08x) "
+       dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "IssueTaskMgmt: ctx2abort (0x%08x) "
                "type=%d\n", hd->ioc->name, ctx2abort, type));
 
-       DBG_DUMP_TM_REQUEST_FRAME((u32 *)pScsiTm);
+       DBG_DUMP_TM_REQUEST_FRAME(ioc, (u32 *)pScsiTm);
 
        if ((retval = mpt_send_handshake_request(hd->ioc->TaskCtx, hd->ioc,
                sizeof(SCSITaskMgmt_t), (u32*)pScsiTm, CAN_SLEEP)) != 0) {
-               dfailprintk((MYIOC_s_ERR_FMT "send_handshake FAILED!"
+               dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "send_handshake FAILED!"
                        " (hd %p, ioc %p, mf %p, rc=%d) \n", hd->ioc->name, hd,
                        hd->ioc, mf, retval));
                goto fail_out;
        }
 
        if(mptscsih_tm_wait_for_completion(hd, timeout) == FAILED) {
-               dfailprintk((MYIOC_s_ERR_FMT "task management request TIMED OUT!"
+               dfailprintk(hd->ioc, printk(MYIOC_s_ERR_FMT "task management request TIMED OUT!"
                        " (hd %p, ioc %p, mf %p) \n", hd->ioc->name, hd,
                        hd->ioc, mf));
-               dtmprintk((MYIOC_s_INFO_FMT "Calling HardReset! \n",
+               dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Calling HardReset! \n",
                         hd->ioc->name));
                retval = mpt_HardResetHandler(hd->ioc, CAN_SLEEP);
-               dtmprintk((MYIOC_s_INFO_FMT "rc=%d \n",
+               dtmprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "rc=%d \n",
                         hd->ioc->name, retval));
                goto fail_out;
        }
@@ -1748,8 +1800,8 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
        if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL) {
                SCpnt->result = DID_RESET << 16;
                SCpnt->scsi_done(SCpnt);
-               dfailprintk((KERN_INFO MYNAM ": mptscsih_abort: Can't locate "
-                   "host! (sc=%p)\n", SCpnt));
+               printk(KERN_DEBUG MYNAM ": mptscsih_abort: Can't locate "
+                   "host! (sc=%p)\n", SCpnt);
                return FAILED;
        }
 
@@ -1760,7 +1812,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
 
        vdevice = SCpnt->device->hostdata;
        if (!vdevice || !vdevice->vtarget) {
-               dtmprintk((MYIOC_s_DEBUG_FMT "task abort: device has been "
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "task abort: device has been "
                    "deleted (sc=%p)\n", ioc->name, SCpnt));
                SCpnt->result = DID_NO_CONNECT << 16;
                SCpnt->scsi_done(SCpnt);
@@ -1771,7 +1823,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
        /* Task aborts are not supported for hidden raid components.
         */
        if (vdevice->vtarget->tflags & MPT_TARGET_FLAGS_RAID_COMPONENT) {
-               dtmprintk((MYIOC_s_DEBUG_FMT "task abort: hidden raid "
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "task abort: hidden raid "
                    "component (sc=%p)\n", ioc->name, SCpnt));
                SCpnt->result = DID_RESET << 16;
                retval = FAILED;
@@ -1785,7 +1837,7 @@ mptscsih_abort(struct scsi_cmnd * SCpnt)
                 * Do OS callback.
                 */
                SCpnt->result = DID_RESET << 16;
-               dtmprintk((KERN_INFO MYNAM ": %s: mptscsih_abort: "
+               dtmprintk(ioc, printk(KERN_DEBUG MYNAM ": %s: mptscsih_abort: "
                   "Command not in the active list! (sc=%p)\n", ioc->name,
                   SCpnt));
                retval = 0;
@@ -1850,8 +1902,8 @@ mptscsih_dev_reset(struct scsi_cmnd * SCpnt)
        /* If we can't locate our host adapter structure, return FAILED status.
         */
        if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
-               dtmprintk((KERN_INFO MYNAM ": mptscsih_dev_reset: Can't "
-                   "locate host! (sc=%p)\n", SCpnt));
+               printk(KERN_DEBUG MYNAM ": mptscsih_dev_reset: Can't "
+                   "locate host! (sc=%p)\n", SCpnt);
                return FAILED;
        }
 
@@ -1913,8 +1965,8 @@ mptscsih_bus_reset(struct scsi_cmnd * SCpnt)
        /* If we can't locate our host adapter structure, return FAILED status.
         */
        if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
-               dtmprintk((KERN_INFO MYNAM ": mptscsih_bus_reset: Can't "
-                   "locate host! (sc=%p)\n", SCpnt ));
+               printk(KERN_DEBUG MYNAM ": mptscsih_bus_reset: Can't "
+                   "locate host! (sc=%p)\n", SCpnt );
                return FAILED;
        }
 
@@ -1957,8 +2009,8 @@ mptscsih_host_reset(struct scsi_cmnd *SCpnt)
 
        /*  If we can't locate the host to reset, then we failed. */
        if ((hd = (MPT_SCSI_HOST *) SCpnt->device->host->hostdata) == NULL){
-               dtmprintk( ( KERN_INFO MYNAM ": mptscsih_host_reset: Can't "
-                   "locate host! (sc=%p)\n", SCpnt));
+               printk( KERN_DEBUG MYNAM ": mptscsih_host_reset: Can't "
+                   "locate host! (sc=%p)\n", SCpnt);
                return FAILED;
        }
 
@@ -2106,16 +2158,16 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *m
        u8                       tmType;
        u32                      termination_count;
 
-       dtmprintk((MYIOC_s_WARN_FMT "TaskMgmt completed (mf=%p,mr=%p)\n",
+       dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "TaskMgmt completed (mf=%p,mr=%p)\n",
            ioc->name, mf, mr));
        if (!ioc->sh) {
-               dtmprintk((MYIOC_s_WARN_FMT
+               dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
                    "TaskMgmt Complete: NULL Scsi Host Ptr\n", ioc->name));
                return 1;
        }
 
        if (mr == NULL) {
-               dtmprintk((MYIOC_s_WARN_FMT
+               dtmprintk(ioc, printk(MYIOC_s_WARN_FMT
                    "ERROR! TaskMgmt Reply: NULL Request %p\n", ioc->name, mf));
                return 1;
        }
@@ -2131,19 +2183,21 @@ mptscsih_taskmgmt_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *m
            pScsiTmReply->ResponseCode)
                mptscsih_taskmgmt_response_code(ioc,
                    pScsiTmReply->ResponseCode);
-       DBG_DUMP_TM_REPLY_FRAME((u32 *)pScsiTmReply);
-
-#if defined(MPT_DEBUG_REPLY) || defined(MPT_DEBUG_TM)
-       printk("%s: ha=%d [%d:%d:0] task_type=0x%02X "
-           "iocstatus=0x%04X\n\tloginfo=0x%08X response_code=0x%02X "
-           "term_cmnds=%d\n", __FUNCTION__, ioc->id, pScsiTmReply->Bus,
-           pScsiTmReply->TargetID, pScsiTmReq->TaskType,
-           le16_to_cpu(pScsiTmReply->IOCStatus),
-           le32_to_cpu(pScsiTmReply->IOCLogInfo),pScsiTmReply->ResponseCode,
-           le32_to_cpu(pScsiTmReply->TerminationCount));
+       DBG_DUMP_TM_REPLY_FRAME(ioc, (u32 *)pScsiTmReply);
+
+#ifdef CONFIG_FUSION_LOGGING
+       if ((ioc->debug_level & MPT_DEBUG_REPLY) ||
+                               (ioc->debug_level & MPT_DEBUG_TM ))
+               printk("%s: ha=%d [%d:%d:0] task_type=0x%02X "
+                       "iocstatus=0x%04X\n\tloginfo=0x%08X response_code=0x%02X "
+                       "term_cmnds=%d\n", __FUNCTION__, ioc->id, pScsiTmReply->Bus,
+                        pScsiTmReply->TargetID, pScsiTmReq->TaskType,
+                       le16_to_cpu(pScsiTmReply->IOCStatus),
+                       le32_to_cpu(pScsiTmReply->IOCLogInfo),pScsiTmReply->ResponseCode,
+                       le32_to_cpu(pScsiTmReply->TerminationCount));
 #endif
        if (!iocstatus) {
-               dtmprintk((MYIOC_s_WARN_FMT " TaskMgmt SUCCESS\n", ioc->name));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT " TaskMgmt SUCCESS\n", ioc->name));
                        hd->abortSCpnt = NULL;
                goto out;
        }
@@ -2224,10 +2278,6 @@ mptscsih_bios_param(struct scsi_device * sdev, struct block_device *bdev,
        geom[1] = sectors;
        geom[2] = cylinders;
 
-       dprintk((KERN_NOTICE
-               ": bios_param: Id=%i Lun=%i Channel=%i CHS=%i/%i/%i\n",
-               sdev->id, sdev->lun, sdev->channel, (int)cylinders, heads, sectors));
-
        return 0;
 }
 
@@ -2393,11 +2443,11 @@ mptscsih_slave_configure(struct scsi_device *sdev)
        vtarget = starget->hostdata;
        vdevice = sdev->hostdata;
 
-       dsprintk((MYIOC_s_INFO_FMT
+       dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
                "device @ %p, channel=%d, id=%d, lun=%d\n",
                hd->ioc->name, sdev, sdev->channel, sdev->id, sdev->lun));
        if (hd->ioc->bus_type == SPI)
-               dsprintk((MYIOC_s_INFO_FMT
+               dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
                    "sdtr %d wdtr %d ppr %d inq length=%d\n",
                    hd->ioc->name, sdev->sdtr, sdev->wdtr,
                    sdev->ppr, sdev->inquiry_len));
@@ -2411,19 +2461,19 @@ mptscsih_slave_configure(struct scsi_device *sdev)
        vdevice->configured_lun = 1;
        mptscsih_change_queue_depth(sdev, MPT_SCSI_CMD_PER_DEV_HIGH);
 
-       dsprintk((MYIOC_s_INFO_FMT
+       dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
                "Queue depth=%d, tflags=%x\n",
                hd->ioc->name, sdev->queue_depth, vtarget->tflags));
 
        if (hd->ioc->bus_type == SPI)
-               dsprintk((MYIOC_s_INFO_FMT
+               dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
                    "negoFlags=%x, maxOffset=%x, SyncFactor=%x\n",
                    hd->ioc->name, vtarget->negoFlags, vtarget->maxOffset,
                    vtarget->minSyncFactor));
 
 slave_configure_exit:
 
-       dsprintk((MYIOC_s_INFO_FMT
+       dsprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT
                "tagged %d, simple %d, ordered %d\n",
                hd->ioc->name,sdev->tagged_supported, sdev->simple_tags,
                sdev->ordered_tags));
@@ -2490,7 +2540,7 @@ mptscsih_copy_sense_data(struct scsi_cmnd *sc, MPT_SCSI_HOST *hd, MPT_FRAME_HDR
                        }
                }
        } else {
-               dprintk((MYIOC_s_INFO_FMT "Hmmm... SenseData len=0! (?)\n",
+               dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Hmmm... SenseData len=0! (?)\n",
                                hd->ioc->name));
        }
 }
@@ -2520,7 +2570,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
        unsigned long    flags;
        int             ii;
 
-       dtmprintk((KERN_WARNING MYNAM
+       dtmprintk(ioc, printk(KERN_DEBUG MYNAM
                        ": IOC %s_reset routed to SCSI host driver!\n",
                        reset_phase==MPT_IOC_SETUP_RESET ? "setup" : (
                        reset_phase==MPT_IOC_PRE_RESET ? "pre" : "post")));
@@ -2535,7 +2585,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
                hd = (MPT_SCSI_HOST *) ioc->sh->hostdata;
 
        if (reset_phase == MPT_IOC_SETUP_RESET) {
-               dtmprintk((MYIOC_s_WARN_FMT "Setup-Diag Reset\n", ioc->name));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Setup-Diag Reset\n", ioc->name));
 
                /* Clean Up:
                 * 1. Set Hard Reset Pending Flag
@@ -2544,7 +2594,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
                hd->resetPending = 1;
 
        } else if (reset_phase == MPT_IOC_PRE_RESET) {
-               dtmprintk((MYIOC_s_WARN_FMT "Pre-Diag Reset\n", ioc->name));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Pre-Diag Reset\n", ioc->name));
 
                /* 2. Flush running commands
                 *      Clean ScsiLookup (and associated memory)
@@ -2564,10 +2614,10 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
                        mpt_free_msg_frame(ioc, hd->cmdPtr);
                }
 
-               dtmprintk((MYIOC_s_WARN_FMT "Pre-Reset complete.\n", ioc->name));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Pre-Reset complete.\n", ioc->name));
 
        } else {
-               dtmprintk((MYIOC_s_WARN_FMT "Post-Diag Reset\n", ioc->name));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Post-Diag Reset\n", ioc->name));
 
                /* Once a FW reload begins, all new OS commands are
                 * redirected to the doneQ w/ a reset status.
@@ -2607,7 +2657,7 @@ mptscsih_ioc_reset(MPT_ADAPTER *ioc, int reset_phase)
                        hd->cmdPtr = NULL;
                }
 
-               dtmprintk((MYIOC_s_WARN_FMT "Post-Reset complete.\n", ioc->name));
+               dtmprintk(ioc, printk(MYIOC_s_DEBUG_FMT "Post-Reset complete.\n", ioc->name));
 
        }
 
@@ -2621,7 +2671,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
        MPT_SCSI_HOST *hd;
        u8 event = le32_to_cpu(pEvReply->Event) & 0xFF;
 
-       devtverboseprintk((MYIOC_s_INFO_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
+       devtverboseprintk(ioc, printk(MYIOC_s_DEBUG_FMT "MPT event (=%02Xh) routed to SCSI host driver!\n",
                        ioc->name, event));
 
        if (ioc->sh == NULL ||
@@ -2663,7 +2713,7 @@ mptscsih_event_process(MPT_ADAPTER *ioc, EventNotificationReply_t *pEvReply)
        case MPI_EVENT_STATE_CHANGE:                    /* 02 */
        case MPI_EVENT_EVENT_CHANGE:                    /* 0A */
        default:
-               dprintk((KERN_INFO "  Ignoring event (=%02Xh)\n", event));
+               dprintk(ioc, printk(KERN_DEBUG MYNAM ": Ignoring event (=%02Xh)\n", event));
                break;
        }
 
@@ -2724,7 +2774,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
        }
        hd->cmdPtr = NULL;
 
-       ddvprintk((MYIOC_s_INFO_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n",
+       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScanDvComplete (mf=%p,mr=%p,idx=%d)\n",
                        hd->ioc->name, mf, mr, req_idx));
 
        hd->pLocal = &hd->localReply;
@@ -2744,9 +2794,6 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                status = le16_to_cpu(pReply->IOCStatus) & MPI_IOCSTATUS_MASK;
                scsi_status = pReply->SCSIStatus;
 
-               ddvtprintk((KERN_NOTICE "  IOCStatus=%04xh, SCSIState=%02xh, SCSIStatus=%02xh, IOCLogInfo=%08xh\n",
-                            status, pReply->SCSIState, scsi_status,
-                            le32_to_cpu(pReply->IOCLogInfo)));
 
                switch(status) {
 
@@ -2799,7 +2846,7 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
                                                        SCSI_STD_SENSE_BYTES);
                                memcpy(hd->pLocal->sense, sense_data, sz);
 
-                               ddvprintk((KERN_NOTICE "  Check Condition, sense ptr %p\n",
+                               ddvprintk(ioc, printk(KERN_DEBUG "  Check Condition, sense ptr %p\n",
                                                sense_data));
                        } else if (pReply->SCSIState & MPI_SCSI_STATE_AUTOSENSE_FAILED) {
                                if (pReq->CDB[0] == INQUIRY)
@@ -2830,8 +2877,6 @@ mptscsih_scandv_complete(MPT_ADAPTER *ioc, MPT_FRAME_HDR *mf, MPT_FRAME_HDR *mr)
 
                }       /* switch(status) */
 
-               ddvtprintk((KERN_NOTICE "  completionCode set to %08xh\n",
-                               completionCode));
        } /* end of address reply case */
 
        hd->pLocal->completion = completionCode;
@@ -2862,7 +2907,7 @@ mptscsih_timer_expired(unsigned long data)
 {
        MPT_SCSI_HOST *hd = (MPT_SCSI_HOST *) data;
 
-       ddvprintk((MYIOC_s_WARN_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr));
+       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired! Cmd %p\n", hd->ioc->name, hd->cmdPtr));
 
        if (hd->cmdPtr) {
                MPIHeader_t *cmd = (MPIHeader_t *)hd->cmdPtr;
@@ -2874,7 +2919,6 @@ mptscsih_timer_expired(unsigned long data)
                         * If new eh code, do nothing. Wait for OS cmd timeout
                         *      for bus reset.
                         */
-                       ddvtprintk((MYIOC_s_NOTE_FMT "DV Cmd Timeout: NoOp\n", hd->ioc->name));
                } else {
                        /* Perform a FW reload */
                        if (mpt_HardResetHandler(hd->ioc, NO_SLEEP) < 0) {
@@ -2891,7 +2935,7 @@ mptscsih_timer_expired(unsigned long data)
         * The FW will reply to all outstanding commands, callback will finish cleanup.
         * Hard reset clean-up will free all resources.
         */
-       ddvprintk((MYIOC_s_WARN_FMT "Timer Expired Complete!\n", hd->ioc->name));
+       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Timer Expired Complete!\n", hd->ioc->name));
 
        return;
 }
@@ -2932,7 +2976,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
 
        in_isr = in_interrupt();
        if (in_isr) {
-               dprintk((MYIOC_s_WARN_FMT "Internal SCSI IO request not allowed in ISR context!\n",
+               dprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Internal SCSI IO request not allowed in ISR context!\n",
                                        hd->ioc->name));
                return -EPERM;
        }
@@ -3035,7 +3079,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
        /* Get and Populate a free Frame
         */
        if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {
-               ddvprintk((MYIOC_s_WARN_FMT "No msg frames!\n",
+               ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "No msg frames!\n",
                                        hd->ioc->name));
                return -EBUSY;
        }
@@ -3075,7 +3119,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
 
        if (cmd == REQUEST_SENSE) {
                pScsiReq->Control = cpu_to_le32(dir | MPI_SCSIIO_CONTROL_UNTAGGED);
-               ddvprintk((MYIOC_s_INFO_FMT "Untagged! 0x%2x\n",
+               ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Untagged! 0x%2x\n",
                        hd->ioc->name, cmd));
        }
 
@@ -3086,7 +3130,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
        pScsiReq->SenseBufferLowAddr = cpu_to_le32(hd->ioc->sense_buf_low_dma
                                           + (my_idx * MPT_SENSE_BUFFER_ALLOC));
 
-       ddvprintk((MYIOC_s_INFO_FMT "Sending Command 0x%x for (%d:%d:%d)\n",
+       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "Sending Command 0x%x for (%d:%d:%d)\n",
                        hd->ioc->name, cmd, io->channel, io->id, io->lun));
 
        if (dir == MPI_SCSIIO_CONTROL_READ) {
@@ -3138,7 +3182,7 @@ mptscsih_do_cmd(MPT_SCSI_HOST *hd, INTERNAL_CMD *io)
        } else {
                rc = -EFAULT;
                /* This should never happen. */
-               ddvprintk((MYIOC_s_INFO_FMT "_do_cmd: Null pLocal!!!\n",
+               ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "_do_cmd: Null pLocal!!!\n",
                                hd->ioc->name));
        }
 
@@ -3324,6 +3368,35 @@ mptscsih_device_delay_show(struct class_device *cdev, char *buf)
 static CLASS_DEVICE_ATTR(device_delay, S_IRUGO,
     mptscsih_device_delay_show, NULL);
 
+static ssize_t
+mptscsih_debug_level_show(struct class_device *cdev, char *buf)
+{
+       struct Scsi_Host *host = class_to_shost(cdev);
+       MPT_SCSI_HOST   *hd = (MPT_SCSI_HOST *)host->hostdata;
+       MPT_ADAPTER *ioc = hd->ioc;
+
+       return snprintf(buf, PAGE_SIZE, "%08xh\n", ioc->debug_level);
+}
+static ssize_t
+mptscsih_debug_level_store(struct class_device *cdev, const char *buf,
+                                                               size_t count)
+{
+       struct Scsi_Host *host = class_to_shost(cdev);
+       MPT_SCSI_HOST   *hd = (MPT_SCSI_HOST *)host->hostdata;
+       MPT_ADAPTER *ioc = hd->ioc;
+       int val = 0;
+
+       if (sscanf(buf, "%x", &val) != 1)
+               return -EINVAL;
+
+       ioc->debug_level = val;
+       printk(MYIOC_s_INFO_FMT "debug_level=%08xh\n",
+                               ioc->name, ioc->debug_level);
+       return strlen(buf);
+}
+static CLASS_DEVICE_ATTR(debug_level, S_IRUGO | S_IWUSR,
+    mptscsih_debug_level_show, mptscsih_debug_level_store);
+
 struct class_device_attribute *mptscsih_host_attrs[] = {
        &class_device_attr_version_fw,
        &class_device_attr_version_bios,
@@ -3336,6 +3409,7 @@ struct class_device_attribute *mptscsih_host_attrs[] = {
        &class_device_attr_board_tracer,
        &class_device_attr_io_delay,
        &class_device_attr_device_delay,
+       &class_device_attr_debug_level,
        NULL,
 };
 EXPORT_SYMBOL(mptscsih_host_attrs);
index 947fe29018002703b4b9dac91b6c2ef416fbbb9a..8c98420640a5eccaccaecfc3bff15f219a4e8707 100644 (file)
@@ -138,7 +138,9 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
                                else {
                                        factor = MPT_ULTRA320;
                                        if (scsi_device_qas(sdev)) {
-                                               ddvprintk((KERN_INFO "Enabling QAS due to byte56=%02x on id=%d!\n", scsi_device_qas(sdev), id));
+                                               ddvprintk(hd->ioc,
+                                               printk(KERN_DEBUG "Enabling QAS due to "
+                                               "byte56=%02x on id=%d!\n", scsi_device_qas(sdev), id));
                                                noQas = 0;
                                        }
                                        if (sdev->type == TYPE_TAPE &&
@@ -225,7 +227,8 @@ mptspi_setTargetNegoParms(MPT_SCSI_HOST *hd, VirtTarget *target,
                /* Disable QAS in a mixed configuration case
                 */
 
-               ddvprintk((KERN_INFO "Disabling QAS due to noQas=%02x on id=%d!\n", noQas, id));
+               ddvprintk(hd->ioc, printk(KERN_DEBUG
+                       "Disabling QAS due to noQas=%02x on id=%d!\n", noQas, id));
        }
 }
 
@@ -256,8 +259,8 @@ mptspi_writeIOCPage4(MPT_SCSI_HOST *hd, u8 channel , u8 id)
        /* Get a MF for this command.
         */
        if ((mf = mpt_get_msg_frame(ioc->DoneCtx, ioc)) == NULL) {
-               dfailprintk((MYIOC_s_WARN_FMT "writeIOCPage4 : no msg frames!\n",
-                                       ioc->name));
+               dfailprintk(ioc, printk(MYIOC_s_WARN_FMT
+                               "writeIOCPage4 : no msg frames!\n",ioc->name));
                return -EAGAIN;
        }
 
@@ -297,7 +300,7 @@ mptspi_writeIOCPage4(MPT_SCSI_HOST *hd, u8 channel , u8 id)
 
        mpt_add_sge((char *)&pReq->PageBufferSGE, flagsLength, dataDma);
 
-       ddvprintk((MYIOC_s_INFO_FMT
+       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                "writeIOCPage4: MaxSEP=%d ActiveSEP=%d id=%d bus=%d\n",
                        ioc->name, IOCPage4Ptr->MaxSEP, IOCPage4Ptr->ActiveSEP, id, channel));
 
@@ -422,7 +425,7 @@ static int mptspi_target_alloc(struct scsi_target *starget)
        if (starget->channel == 0 &&
            mptspi_is_raid(hd, starget->id)) {
                vtarget->raidVolume = 1;
-               ddvprintk((KERN_INFO
+               ddvprintk(hd->ioc, printk(KERN_DEBUG
                    "RAID Volume @ channel=%d id=%d\n", starget->channel,
                    starget->id));
        }
@@ -462,7 +465,7 @@ mptspi_target_destroy(struct scsi_target *starget)
 static void
 mptspi_print_write_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii)
 {
-       ddvprintk((MYIOC_s_INFO_FMT "id=%d Requested = 0x%08x"
+       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Requested = 0x%08x"
            " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n",
            hd->ioc->name, starget->id, ii,
            ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "",
@@ -487,7 +490,7 @@ mptspi_print_write_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget,
 static void
 mptspi_print_read_nego(struct _MPT_SCSI_HOST *hd, struct scsi_target *starget, u32 ii)
 {
-       ddvprintk((MYIOC_s_INFO_FMT "id=%d Read = 0x%08x"
+       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d Read = 0x%08x"
            " ( %s factor = 0x%02x @ offset = 0x%02x %s%s%s%s%s%s%s%s)\n",
            hd->ioc->name, starget->id, ii,
            ii & MPI_SCSIDEVPAGE0_NP_WIDE ? "Wide ": "",
@@ -613,7 +616,7 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
        /* Get and Populate a free Frame
         */
        if ((mf = mpt_get_msg_frame(hd->ioc->InternalCtx, hd->ioc)) == NULL) {
-               ddvprintk((MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n",
+               ddvprintk(hd->ioc, printk(MYIOC_s_WARN_FMT "_do_raid: no msg frames!\n",
                                        hd->ioc->name));
                return -EAGAIN;
        }
@@ -635,7 +638,7 @@ mptscsih_quiesce_raid(MPT_SCSI_HOST *hd, int quiesce, u8 channel, u8 id)
        mpt_add_sge((char *)&pReq->ActionDataSGE,
                MPT_SGE_FLAGS_SSIMPLE_READ | 0, (dma_addr_t) -1);
 
-       ddvprintk((MYIOC_s_INFO_FMT "RAID Volume action=%x channel=%d id=%d\n",
+       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "RAID Volume action=%x channel=%d id=%d\n",
                        hd->ioc->name, pReq->Action, channel, id));
 
        hd->pLocal = NULL;
@@ -735,7 +738,7 @@ static int mptspi_slave_configure(struct scsi_device *sdev)
        if (ret)
                return ret;
 
-       ddvprintk((MYIOC_s_INFO_FMT "id=%d min_period=0x%02x"
+       ddvprintk(hd->ioc, printk(MYIOC_s_DEBUG_FMT "id=%d min_period=0x%02x"
                " max_offset=0x%02x max_width=%d\n", hd->ioc->name,
                sdev->id, spi_min_period(scsi_target(sdev)),
                spi_max_offset(scsi_target(sdev)),
@@ -768,10 +771,8 @@ mptspi_qcmd(struct scsi_cmnd *SCpnt, void (*done)(struct scsi_cmnd *))
                return 0;
        }
 
-#ifdef MPT_DEBUG_DV
        if (spi_dv_pending(scsi_target(SCpnt->device)))
-               scsi_print_command(SCpnt);
-#endif
+               ddvprintk(hd->ioc, scsi_print_command(SCpnt));
 
        return mptscsih_qcmd(SCpnt,done);
 }
@@ -1415,7 +1416,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        if (numSGE < sh->sg_tablesize) {
                /* Reset this value */
-               dprintk((MYIOC_s_INFO_FMT
+               dprintk(ioc, printk(MYIOC_s_INFO_FMT
                  "Resetting sg_tablesize to %d from %d\n",
                  ioc->name, numSGE, sh->sg_tablesize));
                sh->sg_tablesize = numSGE;
@@ -1435,7 +1436,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
                goto out_mptspi_probe;
        }
 
-       dprintk((MYIOC_s_INFO_FMT "ScsiLookup @ %p\n",
+       dprintk(ioc, printk(MYIOC_s_DEBUG_FMT "ScsiLookup @ %p\n",
                 ioc->name, hd->ScsiLookup));
 
        /* Clear the TM flags
@@ -1463,7 +1464,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
        ioc->spi_data.Saf_Te = mpt_saf_te;
 
        hd->negoNvram = MPT_SCSICFG_USE_NVRAM;
-       ddvprintk((MYIOC_s_INFO_FMT
+       ddvprintk(ioc, printk(MYIOC_s_DEBUG_FMT
                "saf_te %x\n",
                ioc->name,
                mpt_saf_te));
@@ -1481,7 +1482,7 @@ mptspi_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 
        error = scsi_add_host (sh, &ioc->pcidev->dev);
        if(error) {
-               dprintk((KERN_ERR MYNAM
+               dprintk(ioc, printk(KERN_ERR MYNAM
                  "scsi_add_host failed\n"));
                goto out_mptspi_probe;
        }
@@ -1536,15 +1537,8 @@ mptspi_init(void)
        mptspiTaskCtx = mpt_register(mptscsih_taskmgmt_complete, MPTSPI_DRIVER);
        mptspiInternalCtx = mpt_register(mptscsih_scandv_complete, MPTSPI_DRIVER);
 
-       if (mpt_event_register(mptspiDoneCtx, mptspi_event_process) == 0) {
-               devtverboseprintk((KERN_INFO MYNAM
-                 ": Registered for IOC event notifications\n"));
-       }
-
-       if (mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset) == 0) {
-               dprintk((KERN_INFO MYNAM
-                 ": Registered for IOC reset notifications\n"));
-       }
+       mpt_event_register(mptspiDoneCtx, mptspi_event_process);
+       mpt_reset_register(mptspiDoneCtx, mptspi_ioc_reset);
 
        error = pci_register_driver(&mptspi_driver);
        if (error)
@@ -1564,12 +1558,7 @@ mptspi_exit(void)
        pci_unregister_driver(&mptspi_driver);
 
        mpt_reset_deregister(mptspiDoneCtx);
-       dprintk((KERN_INFO MYNAM
-         ": Deregistered for IOC reset notifications\n"));
-
        mpt_event_deregister(mptspiDoneCtx);
-       dprintk((KERN_INFO MYNAM
-         ": Deregistered for IOC event notifications\n"));
 
        mpt_deregister(mptspiInternalCtx);
        mpt_deregister(mptspiTaskCtx);
index 5e1c99f83ab51bfef3bdffe39ca3a297ece07f56..50b2c73344105b3f867d4b322864af9d540573ca 100644 (file)
@@ -744,7 +744,7 @@ static int i2o_block_transfer(struct request *req)
 {
        struct i2o_block_device *dev = req->rq_disk->private_data;
        struct i2o_controller *c;
-       int tid = dev->i2o_dev->lct_data.tid;
+       u32 tid = dev->i2o_dev->lct_data.tid;
        struct i2o_message *msg;
        u32 *mptr;
        struct i2o_block_request *ireq = req->special;
index aaaa61ea4217a5013da3933b768da1e99d261ed3..518d5d33546489e2d4de6fca87e5a9983ce05fb0 100644 (file)
@@ -200,14 +200,22 @@ config THINKPAD_ACPI_BAY
 config THINKPAD_ACPI_INPUT_ENABLED
        bool "Enable input layer support by default"
        depends on THINKPAD_ACPI
-       default y
+       default n
        ---help---
-         Enables hot key handling over the input layer by default.  If unset,
-         the driver does not enable any hot key handling by default, and also
-         starts up with a mostly empty keymap.
-
-         If you are not sure, say Y here.  Say N to retain the deprecated
-         behavior of ibm-acpi, and thinkpad-acpi for kernels up to 2.6.21.
+         This option enables thinkpad-acpi hot key handling over the input
+         layer at driver load time.  When it is unset, the driver does not
+         enable hot key handling by default, and also starts up with a mostly
+         empty keymap.
+
+         This option should be enabled if you have a new enough HAL or other
+         userspace support that properly handles the thinkpad-acpi event
+         device.  It auto-tunes the hot key support to those reported by the
+         firmware and enables it automatically.
+
+         If unsure, say N here to retain the old behaviour of ibm-acpi, and
+         thinkpad-acpi up to kernel 2.6.21: userspace will have to enable and
+         set up the thinkpad-acpi hot key handling using the sysfs interace
+         after loading the driver.
 
 
 endif # MISC_DEVICES
index 14ee06c8f12727ebd3d0a950b7e870d440616305..91da6880ae9390fc2e46490836cd7de97ba27367 100644 (file)
@@ -845,7 +845,7 @@ static struct sony_nc_event sony_C_events[] = {
 };
 
 /* SNC-only model map */
-struct dmi_system_id sony_nc_ids[] = {
+static struct dmi_system_id sony_nc_ids[] = {
                {
                        .ident = "Sony Vaio FE Series",
                        .callback = sony_nc_C_enable,
@@ -942,6 +942,11 @@ static int sony_nc_resume(struct acpi_device *device)
                }
        }
 
+       /* set the last requested brightness level */
+       if (sony_backlight_device &&
+                       !sony_backlight_update_status(sony_backlight_device))
+               printk(KERN_WARNING DRV_PFX "unable to restore brightness level");
+
        /* re-initialize models with specific requirements */
        dmi_check_system(sony_nc_ids);
 
index fa80f355e522ffc65f6a67caa96659e1e7f2e7d0..f6cd34a3dbaca218cf0ff8a19ff94d03c41cb8d7 100644 (file)
@@ -4668,12 +4668,15 @@ static int __init thinkpad_acpi_module_init(void)
                thinkpad_acpi_module_exit();
                return ret;
        }
+       tp_features.platform_drv_registered = 1;
+
        ret = tpacpi_create_driver_attributes(&tpacpi_pdriver.driver);
        if (ret) {
                printk(IBM_ERR "unable to create sysfs driver attributes\n");
                thinkpad_acpi_module_exit();
                return ret;
        }
+       tp_features.platform_drv_attrs_registered = 1;
 
 
        /* Device initialization */
@@ -4756,8 +4759,11 @@ static void thinkpad_acpi_module_exit(void)
        if (tpacpi_pdev)
                platform_device_unregister(tpacpi_pdev);
 
-       tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver);
-       platform_driver_unregister(&tpacpi_pdriver);
+       if (tp_features.platform_drv_attrs_registered)
+               tpacpi_remove_driver_attributes(&tpacpi_pdriver.driver);
+
+       if (tp_features.platform_drv_registered)
+               platform_driver_unregister(&tpacpi_pdriver);
 
        if (proc_dir)
                remove_proc_entry(IBM_PROC_DIR, acpi_root_dir);
index 88af089d64945b41a5150e545a5064ce1b6f0a5a..eee8809a50d9aed1ed796a20fe6f4c5a6ae4ae5c 100644 (file)
@@ -246,6 +246,8 @@ static struct {
        u16 wan:1;
        u16 fan_ctrl_status_undef:1;
        u16 input_device_registered:1;
+       u16 platform_drv_registered:1;
+       u16 platform_drv_attrs_registered:1;
 } tp_features;
 
 struct thinkpad_id_data {
index e02eac876362e399e16bb50265dc01b662507f71..b0abc7d928051274f5168fe4d1e85fcbabc31b9b 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/queue.c
+ *  linux/drivers/mmc/card/queue.c
  *
  *  Copyright (C) 2003 Russell King, All Rights Reserved.
  *  Copyright 2006-2007 Pierre Ossman
@@ -117,7 +117,6 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
        struct mmc_host *host = card->host;
        u64 limit = BLK_BOUNCE_HIGH;
        int ret;
-       unsigned int bouncesz;
 
        if (mmc_dev(host)->dma_mask && *mmc_dev(host)->dma_mask)
                limit = *mmc_dev(host)->dma_mask;
@@ -134,6 +133,8 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
 
 #ifdef CONFIG_MMC_BLOCK_BOUNCE
        if (host->max_hw_segs == 1) {
+               unsigned int bouncesz;
+
                bouncesz = MMC_QUEUE_BOUNCESZ;
 
                if (bouncesz > host->max_req_size)
@@ -156,14 +157,14 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
                                GFP_KERNEL);
                        if (!mq->sg) {
                                ret = -ENOMEM;
-                               goto free_bounce_buf;
+                               goto cleanup_queue;
                        }
 
                        mq->bounce_sg = kmalloc(sizeof(struct scatterlist) *
                                bouncesz / 512, GFP_KERNEL);
                        if (!mq->bounce_sg) {
                                ret = -ENOMEM;
-                               goto free_sg;
+                               goto cleanup_queue;
                        }
                }
        }
@@ -197,14 +198,13 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock
        if (mq->bounce_sg)
                kfree(mq->bounce_sg);
        mq->bounce_sg = NULL;
- free_sg:
-       kfree(mq->sg);
+ cleanup_queue:
+       if (mq->sg)
+               kfree(mq->sg);
        mq->sg = NULL;
- free_bounce_buf:
        if (mq->bounce_buf)
                kfree(mq->bounce_buf);
        mq->bounce_buf = NULL;
- cleanup_queue:
        blk_cleanup_queue(mq->queue);
        return ret;
 }
index 348b566bf4fd6b3c359d58f08f863afda8f159c7..fe0e785ed7d2f57634fac42f5d6613417646affa 100644 (file)
@@ -209,10 +209,30 @@ struct mmc_card *mmc_alloc_card(struct mmc_host *host)
 int mmc_add_card(struct mmc_card *card)
 {
        int ret;
+       const char *type;
 
        snprintf(card->dev.bus_id, sizeof(card->dev.bus_id),
                 "%s:%04x", mmc_hostname(card->host), card->rca);
 
+       switch (card->type) {
+       case MMC_TYPE_MMC:
+               type = "MMC";
+               break;
+       case MMC_TYPE_SD:
+               type = "SD";
+               if (mmc_card_blockaddr(card))
+                       type = "SDHC";
+               break;
+       default:
+               type = "?";
+               break;
+       }
+
+       printk(KERN_INFO "%s: new %s%s card at address %04x\n",
+               mmc_hostname(card->host),
+               mmc_card_highspeed(card) ? "high speed " : "",
+               type, card->rca);
+
        card->dev.uevent_suppress = 1;
 
        ret = device_add(&card->dev);
@@ -243,6 +263,9 @@ int mmc_add_card(struct mmc_card *card)
 void mmc_remove_card(struct mmc_card *card)
 {
        if (mmc_card_present(card)) {
+               printk(KERN_INFO "%s: card %04x removed\n",
+                       mmc_hostname(card->host), card->rca);
+
                if (card->host->bus_ops->sysfs_remove)
                        card->host->bus_ops->sysfs_remove(card->host, card);
                device_del(&card->dev);
index b5d8a6d90cca6dfdac015f2e6cac031786963067..bfd2ae5bd669fe2a61307995832f2fd2bcb0c4c2 100644 (file)
@@ -68,32 +68,41 @@ void mmc_request_done(struct mmc_host *host, struct mmc_request *mrq)
        struct mmc_command *cmd = mrq->cmd;
        int err = cmd->error;
 
-       pr_debug("%s: req done (CMD%u): %d/%d/%d: %08x %08x %08x %08x\n",
-                mmc_hostname(host), cmd->opcode, err,
-                mrq->data ? mrq->data->error : 0,
-                mrq->stop ? mrq->stop->error : 0,
-                cmd->resp[0], cmd->resp[1], cmd->resp[2], cmd->resp[3]);
-
        if (err && cmd->retries) {
+               pr_debug("%s: req failed (CMD%u): %d, retrying...\n",
+                       mmc_hostname(host), cmd->opcode, err);
+
                cmd->retries--;
                cmd->error = 0;
                host->ops->request(host, mrq);
-       } else if (mrq->done) {
-               mrq->done(mrq);
+       } else {
+               pr_debug("%s: req done (CMD%u): %d: %08x %08x %08x %08x\n",
+                       mmc_hostname(host), cmd->opcode, err,
+                       cmd->resp[0], cmd->resp[1],
+                       cmd->resp[2], cmd->resp[3]);
+
+               if (mrq->data) {
+                       pr_debug("%s:     %d bytes transferred: %d\n",
+                               mmc_hostname(host),
+                               mrq->data->bytes_xfered, mrq->data->error);
+               }
+
+               if (mrq->stop) {
+                       pr_debug("%s:     (CMD%u): %d: %08x %08x %08x %08x\n",
+                               mmc_hostname(host), mrq->stop->opcode,
+                               mrq->stop->error,
+                               mrq->stop->resp[0], mrq->stop->resp[1],
+                               mrq->stop->resp[2], mrq->stop->resp[3]);
+               }
+
+               if (mrq->done)
+                       mrq->done(mrq);
        }
 }
 
 EXPORT_SYMBOL(mmc_request_done);
 
-/**
- *     mmc_start_request - start a command on a host
- *     @host: MMC host to start command on
- *     @mrq: MMC request to start
- *
- *     Queue a command on the specified host.  We expect the
- *     caller to be holding the host lock with interrupts disabled.
- */
-void
+static void
 mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
 {
 #ifdef CONFIG_MMC_DEBUG
@@ -104,6 +113,21 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
                 mmc_hostname(host), mrq->cmd->opcode,
                 mrq->cmd->arg, mrq->cmd->flags);
 
+       if (mrq->data) {
+               pr_debug("%s:     blksz %d blocks %d flags %08x "
+                       "tsac %d ms nsac %d\n",
+                       mmc_hostname(host), mrq->data->blksz,
+                       mrq->data->blocks, mrq->data->flags,
+                       mrq->data->timeout_ns / 10000000,
+                       mrq->data->timeout_clks);
+       }
+
+       if (mrq->stop) {
+               pr_debug("%s:     CMD%u arg %08x flags %08x\n",
+                        mmc_hostname(host), mrq->stop->opcode,
+                        mrq->stop->arg, mrq->stop->flags);
+       }
+
        WARN_ON(!host->claimed);
 
        mrq->cmd->error = 0;
@@ -133,14 +157,21 @@ mmc_start_request(struct mmc_host *host, struct mmc_request *mrq)
        host->ops->request(host, mrq);
 }
 
-EXPORT_SYMBOL(mmc_start_request);
-
 static void mmc_wait_done(struct mmc_request *mrq)
 {
        complete(mrq->done_data);
 }
 
-int mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
+/**
+ *     mmc_wait_for_req - start a request and wait for completion
+ *     @host: MMC host to start command
+ *     @mrq: MMC request to start
+ *
+ *     Start a new MMC custom command request for a host, and wait
+ *     for the command to complete. Does not attempt to parse the
+ *     response.
+ */
+void mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
 {
        DECLARE_COMPLETION_ONSTACK(complete);
 
@@ -150,8 +181,6 @@ int mmc_wait_for_req(struct mmc_host *host, struct mmc_request *mrq)
        mmc_start_request(host, mrq);
 
        wait_for_completion(&complete);
-
-       return 0;
 }
 
 EXPORT_SYMBOL(mmc_wait_for_req);
@@ -192,6 +221,9 @@ EXPORT_SYMBOL(mmc_wait_for_cmd);
  *     @data: data phase for command
  *     @card: the MMC card associated with the data transfer
  *     @write: flag to differentiate reads from writes
+ *
+ *     Computes the data timeout parameters according to the
+ *     correct algorithm given the card type.
  */
 void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card,
                          int write)
@@ -240,21 +272,18 @@ void mmc_set_data_timeout(struct mmc_data *data, const struct mmc_card *card,
 EXPORT_SYMBOL(mmc_set_data_timeout);
 
 /**
- *     __mmc_claim_host - exclusively claim a host
+ *     mmc_claim_host - exclusively claim a host
  *     @host: mmc host to claim
- *     @card: mmc card to claim host for
- *
- *     Claim a host for a set of operations.  If a valid card
- *     is passed and this wasn't the last card selected, select
- *     the card before returning.
  *
- *     Note: you should use mmc_card_claim_host or mmc_claim_host.
+ *     Claim a host for a set of operations.
  */
 void mmc_claim_host(struct mmc_host *host)
 {
        DECLARE_WAITQUEUE(wait, current);
        unsigned long flags;
 
+       might_sleep();
+
        add_wait_queue(&host->wq, &wait);
        spin_lock_irqsave(&host->lock, flags);
        while (1) {
@@ -432,6 +461,45 @@ static void mmc_power_off(struct mmc_host *host)
        mmc_set_ios(host);
 }
 
+/*
+ * Cleanup when the last reference to the bus operator is dropped.
+ */
+void __mmc_release_bus(struct mmc_host *host)
+{
+       BUG_ON(!host);
+       BUG_ON(host->bus_refs);
+       BUG_ON(!host->bus_dead);
+
+       host->bus_ops = NULL;
+}
+
+/*
+ * Increase reference count of bus operator
+ */
+static inline void mmc_bus_get(struct mmc_host *host)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&host->lock, flags);
+       host->bus_refs++;
+       spin_unlock_irqrestore(&host->lock, flags);
+}
+
+/*
+ * Decrease reference count of bus operator and free it if
+ * it is the last reference.
+ */
+static inline void mmc_bus_put(struct mmc_host *host)
+{
+       unsigned long flags;
+
+       spin_lock_irqsave(&host->lock, flags);
+       host->bus_refs--;
+       if ((host->bus_refs == 0) && host->bus_ops)
+               __mmc_release_bus(host);
+       spin_unlock_irqrestore(&host->lock, flags);
+}
+
 /*
  * Assign a mmc bus handler to a host. Only one bus handler may control a
  * host at any given time.
@@ -481,25 +549,15 @@ void mmc_detach_bus(struct mmc_host *host)
        mmc_bus_put(host);
 }
 
-/*
- * Cleanup when the last reference to the bus operator is dropped.
- */
-void __mmc_release_bus(struct mmc_host *host)
-{
-       BUG_ON(!host);
-       BUG_ON(host->bus_refs);
-       BUG_ON(!host->bus_dead);
-
-       host->bus_ops = NULL;
-}
-
 /**
  *     mmc_detect_change - process change of state on a MMC socket
  *     @host: host which changed state.
  *     @delay: optional delay to wait before detection (jiffies)
  *
- *     All we know is that card(s) have been inserted or removed
- *     from the socket(s).  We don't know which socket or cards.
+ *     MMC drivers should call this when they detect a card has been
+ *     inserted or removed. The MMC layer will confirm that any
+ *     present card is still functional, and initialize any newly
+ *     inserted.
  */
 void mmc_detect_change(struct mmc_host *host, unsigned long delay)
 {
index ae006b30dd86bdbb3fdeb3367fc66c83847e711d..bb2774af9ea91d9891b3b4ba752b4c7221266e8e 100644 (file)
@@ -27,28 +27,6 @@ struct mmc_bus_ops {
 void mmc_attach_bus(struct mmc_host *host, const struct mmc_bus_ops *ops);
 void mmc_detach_bus(struct mmc_host *host);
 
-void __mmc_release_bus(struct mmc_host *host);
-
-static inline void mmc_bus_get(struct mmc_host *host)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&host->lock, flags);
-       host->bus_refs++;
-       spin_unlock_irqrestore(&host->lock, flags);
-}
-
-static inline void mmc_bus_put(struct mmc_host *host)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&host->lock, flags);
-       host->bus_refs--;
-       if ((host->bus_refs == 0) && host->bus_ops)
-               __mmc_release_bus(host);
-       spin_unlock_irqrestore(&host->lock, flags);
-}
-
 void mmc_set_chip_select(struct mmc_host *host, int mode);
 void mmc_set_clock(struct mmc_host *host, unsigned int hz);
 void mmc_set_bus_mode(struct mmc_host *host, unsigned int mode);
index 1433d95c40bb6d660c2f69115390b2a2fc916c44..6a7e29849603dd86e29242c81e6184b1bd6d7033 100644 (file)
@@ -93,6 +93,10 @@ EXPORT_SYMBOL(mmc_alloc_host);
 /**
  *     mmc_add_host - initialise host hardware
  *     @host: mmc host
+ *
+ *     Register the host with the driver model. The host must be
+ *     prepared to start servicing requests before this function
+ *     completes.
  */
 int mmc_add_host(struct mmc_host *host)
 {
@@ -126,7 +130,8 @@ EXPORT_SYMBOL(mmc_add_host);
  *     @host: mmc host
  *
  *     Unregister and remove all cards associated with this host,
- *     and power down the MMC bus.
+ *     and power down the MMC bus. No new requests will be issued
+ *     after this function has returned.
  */
 void mmc_remove_host(struct mmc_host *host)
 {
index 66f85bfa8dbbfb9704df09c68245d3d137339275..21d7f48e1d4e67c33ff7f59a46955bc7e2e70df0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/mmc.c
+ *  linux/drivers/mmc/core/mmc.c
  *
  *  Copyright (C) 2003-2004 Russell King, All Rights Reserved.
  *  Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
@@ -100,7 +100,7 @@ static int mmc_decode_cid(struct mmc_card *card)
                break;
 
        default:
-               printk("%s: card has unknown MMCA version %d\n",
+               printk(KERN_ERR "%s: card has unknown MMCA version %d\n",
                        mmc_hostname(card->host), card->csd.mmca_vsn);
                return -EINVAL;
        }
@@ -123,7 +123,7 @@ static int mmc_decode_csd(struct mmc_card *card)
         */
        csd_struct = UNSTUFF_BITS(resp, 126, 2);
        if (csd_struct != 1 && csd_struct != 2) {
-               printk("%s: unrecognised CSD structure version %d\n",
+               printk(KERN_ERR "%s: unrecognised CSD structure version %d\n",
                        mmc_hostname(card->host), csd_struct);
                return -EINVAL;
        }
@@ -499,14 +499,17 @@ static void mmc_resume(struct mmc_host *host)
        BUG_ON(!host->card);
 
        mmc_claim_host(host);
-
        err = mmc_init_card(host, host->ocr, host->card);
+       mmc_release_host(host);
+
        if (err != MMC_ERR_NONE) {
                mmc_remove(host);
+
+               mmc_claim_host(host);
                mmc_detach_bus(host);
+               mmc_release_host(host);
        }
 
-       mmc_release_host(host);
 }
 
 #else
@@ -553,8 +556,10 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
        /*
         * Can we support the voltage of the card?
         */
-       if (!host->ocr)
+       if (!host->ocr) {
+               err = -EINVAL;
                goto err;
+       }
 
        /*
         * Detect and init the card.
@@ -567,18 +572,21 @@ int mmc_attach_mmc(struct mmc_host *host, u32 ocr)
 
        err = mmc_add_card(host->card);
        if (err)
-               goto reclaim_host;
+               goto remove_card;
 
        return 0;
 
-reclaim_host:
-       mmc_claim_host(host);
+remove_card:
        mmc_remove_card(host->card);
        host->card = NULL;
+       mmc_claim_host(host);
 err:
        mmc_detach_bus(host);
        mmc_release_host(host);
 
+       printk(KERN_ERR "%s: error %d whilst initialising MMC card\n",
+               mmc_hostname(host), err);
+
        return 0;
 }
 
index 7dd720fa589550a9500cb39333187c1273bc3c82..913e75f008434179e45780ffb7e57ba7c6ff3d9e 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/mmc_ops.h
+ *  linux/drivers/mmc/core/mmc_ops.h
  *
  *  Copyright 2006-2007 Pierre Ossman
  *
index 7a481e8ca5ea43669aced1e1c85a6d105e82b805..76d09a93c5d6c991cbe394889e12428845bacff4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/mmc_ops.h
+ *  linux/drivers/mmc/core/mmc_ops.h
  *
  *  Copyright 2006-2007 Pierre Ossman
  *
index 1240684083f1830c9e58c6f40ccad9c11ea10c71..1edc62b1e5c65d4625daf17ee0d0429c34a95d1c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/sd.c
+ *  linux/drivers/mmc/core/sd.c
  *
  *  Copyright (C) 2003-2004 Russell King, All Rights Reserved.
  *  SD support Copyright (C) 2004 Ian Molton, All Rights Reserved.
@@ -149,7 +149,7 @@ static int mmc_decode_csd(struct mmc_card *card)
                csd->write_partial = 0;
                break;
        default:
-               printk("%s: unrecognised CSD structure version %d\n",
+               printk(KERN_ERR "%s: unrecognised CSD structure version %d\n",
                        mmc_hostname(card->host), csd_struct);
                return -EINVAL;
        }
@@ -173,7 +173,7 @@ static int mmc_decode_scr(struct mmc_card *card)
 
        scr_struct = UNSTUFF_BITS(resp, 60, 4);
        if (scr_struct != 0) {
-               printk("%s: unrecognised SCR structure version %d\n",
+               printk(KERN_ERR "%s: unrecognised SCR structure version %d\n",
                        mmc_hostname(card->host), scr_struct);
                return -EINVAL;
        }
@@ -206,9 +206,8 @@ static int mmc_read_switch(struct mmc_card *card)
 
        status = kmalloc(64, GFP_KERNEL);
        if (!status) {
-               printk("%s: could not allocate a buffer for switch "
-                      "capabilities.\n",
-                       mmc_hostname(card->host));
+               printk(KERN_ERR "%s: could not allocate a buffer for "
+                       "switch capabilities.\n", mmc_hostname(card->host));
                return err;
        }
 
@@ -254,9 +253,8 @@ static int mmc_switch_hs(struct mmc_card *card)
 
        status = kmalloc(64, GFP_KERNEL);
        if (!status) {
-               printk("%s: could not allocate a buffer for switch "
-                      "capabilities.\n",
-                       mmc_hostname(card->host));
+               printk(KERN_ERR "%s: could not allocate a buffer for "
+                       "switch capabilities.\n", mmc_hostname(card->host));
                return err;
        }
 
@@ -573,14 +571,17 @@ static void mmc_sd_resume(struct mmc_host *host)
        BUG_ON(!host->card);
 
        mmc_claim_host(host);
-
        err = mmc_sd_init_card(host, host->ocr, host->card);
+       mmc_release_host(host);
+
        if (err != MMC_ERR_NONE) {
                mmc_sd_remove(host);
+
+               mmc_claim_host(host);
                mmc_detach_bus(host);
+               mmc_release_host(host);
        }
 
-       mmc_release_host(host);
 }
 
 #else
@@ -634,8 +635,10 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
        /*
         * Can we support the voltage(s) of the card(s)?
         */
-       if (!host->ocr)
+       if (!host->ocr) {
+               err = -EINVAL;
                goto err;
+       }
 
        /*
         * Detect and init the card.
@@ -648,18 +651,21 @@ int mmc_attach_sd(struct mmc_host *host, u32 ocr)
 
        err = mmc_add_card(host->card);
        if (err)
-               goto reclaim_host;
+               goto remove_card;
 
        return 0;
 
-reclaim_host:
-       mmc_claim_host(host);
+remove_card:
        mmc_remove_card(host->card);
        host->card = NULL;
+       mmc_claim_host(host);
 err:
        mmc_detach_bus(host);
        mmc_release_host(host);
 
+       printk(KERN_ERR "%s: error %d whilst initialising SD card\n",
+               mmc_hostname(host), err);
+
        return 0;
 }
 
index 9697ce58110168486f926080caf01af3a4cc0cab..342f340ebc2579d8c81dd231f526b140f87552d5 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/sd_ops.h
+ *  linux/drivers/mmc/core/sd_ops.h
  *
  *  Copyright 2006-2007 Pierre Ossman
  *
 #include "core.h"
 #include "sd_ops.h"
 
+static int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
+{
+       int err;
+       struct mmc_command cmd;
+
+       BUG_ON(!host);
+       BUG_ON(card && (card->host != host));
+
+       cmd.opcode = MMC_APP_CMD;
+
+       if (card) {
+               cmd.arg = card->rca << 16;
+               cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
+       } else {
+               cmd.arg = 0;
+               cmd.flags = MMC_RSP_R1 | MMC_CMD_BCR;
+       }
+
+       err = mmc_wait_for_cmd(host, &cmd, 0);
+       if (err != MMC_ERR_NONE)
+               return err;
+
+       /* Check that card supported application commands */
+       if (!(cmd.resp[0] & R1_APP_CMD))
+               return MMC_ERR_FAILED;
+
+       return MMC_ERR_NONE;
+}
+
 /**
  *     mmc_wait_for_app_cmd - start an application command and wait for
                               completion
  *     @host: MMC host to start command
- *     @rca: RCA to send MMC_APP_CMD to
+ *     @card: Card to send MMC_APP_CMD to
  *     @cmd: MMC command to start
  *     @retries: maximum number of retries
  *
@@ -77,35 +106,6 @@ int mmc_wait_for_app_cmd(struct mmc_host *host, struct mmc_card *card,
 
 EXPORT_SYMBOL(mmc_wait_for_app_cmd);
 
-int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card)
-{
-       int err;
-       struct mmc_command cmd;
-
-       BUG_ON(!host);
-       BUG_ON(card && (card->host != host));
-
-       cmd.opcode = MMC_APP_CMD;
-
-       if (card) {
-               cmd.arg = card->rca << 16;
-               cmd.flags = MMC_RSP_R1 | MMC_CMD_AC;
-       } else {
-               cmd.arg = 0;
-               cmd.flags = MMC_RSP_R1 | MMC_CMD_BCR;
-       }
-
-       err = mmc_wait_for_cmd(host, &cmd, 0);
-       if (err != MMC_ERR_NONE)
-               return err;
-
-       /* Check that card supported application commands */
-       if (!(cmd.resp[0] & R1_APP_CMD))
-               return MMC_ERR_FAILED;
-
-       return MMC_ERR_NONE;
-}
-
 int mmc_app_set_bus_width(struct mmc_card *card, int width)
 {
        int err;
index 1240fddba5e393a57b93f5098793b6d45ca54811..9742d8a3066483bbadbcd6b79b9c24004d115035 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/sd_ops.h
+ *  linux/drivers/mmc/core/sd_ops.h
  *
  *  Copyright 2006-2007 Pierre Ossman
  *
@@ -12,7 +12,6 @@
 #ifndef _MMC_SD_OPS_H
 #define _MMC_SD_OPS_H
 
-int mmc_app_cmd(struct mmc_host *host, struct mmc_card *card);
 int mmc_app_set_bus_width(struct mmc_card *card, int width);
 int mmc_send_app_op_cond(struct mmc_host *host, u32 ocr, u32 *rocr);
 int mmc_send_if_cond(struct mmc_host *host, u32 ocr);
index 15aab374127ee1d625aab1a9c39ea58286eb7430..bfebd2fa7ada9a50c9359fe463f68565e492adae 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/at91_mci.c - ATMEL AT91 MCI Driver
+ *  linux/drivers/mmc/host/at91_mci.c - ATMEL AT91 MCI Driver
  *
  *  Copyright (C) 2005 Cougar Creek Computing Devices Ltd, All Rights Reserved
  *
@@ -83,7 +83,7 @@
 
 #define AT91_MCI_ERRORS        (AT91_MCI_RINDE | AT91_MCI_RDIRE | AT91_MCI_RCRCE       \
                | AT91_MCI_RENDE | AT91_MCI_RTOE | AT91_MCI_DCRCE               \
-               | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)                        
+               | AT91_MCI_DTOE | AT91_MCI_OVRE | AT91_MCI_UNRE)
 
 #define at91_mci_read(host, reg)       __raw_readl((host)->baseaddr + (reg))
 #define at91_mci_write(host, reg, val) __raw_writel((val), (host)->baseaddr + (reg))
@@ -676,15 +676,15 @@ static irqreturn_t at91_mci_irq(int irq, void *devid)
 
        int_status = at91_mci_read(host, AT91_MCI_SR);
        int_mask = at91_mci_read(host, AT91_MCI_IMR);
-       
+
        pr_debug("MCI irq: status = %08X, %08X, %08X\n", int_status, int_mask,
                int_status & int_mask);
-       
+
        int_status = int_status & int_mask;
 
        if (int_status & AT91_MCI_ERRORS) {
                completed = 1;
-               
+
                if (int_status & AT91_MCI_UNRE)
                        pr_debug("MMC: Underrun error\n");
                if (int_status & AT91_MCI_OVRE)
index 52b63f11ddd6498000003049ce95f67306e80ab7..34c99d4ea0415885e3bff95df2f6cc60a8aa564f 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * linux/drivers/mmc/au1xmmc.c - AU1XX0 MMC driver
+ * linux/drivers/mmc/host/au1xmmc.c - AU1XX0 MMC driver
  *
  *  Copyright (c) 2005, Advanced Micro Devices, Inc.
  *
index 7ee2045acbef3fddc232236e9c4ee440244ddce1..54bfc9f255966329b6e01c290650f297e7859154 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/imxmmc.c - Motorola i.MX MMCI driver
+ *  linux/drivers/mmc/host/imxmmc.c - Motorola i.MX MMCI driver
  *
  *  Copyright (C) 2004 Sascha Hauer, Pengutronix <sascha@saschahauer.de>
  *  Copyright (C) 2006 Pavel Pisa, PiKRON <ppisa@pikron.com>
index d11c2d23ceea2bbdd732d6112ce840f1a3a76a5a..be730c0a0352a6f942fb001ad8866b42ab84d666 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/mmci.c - ARM PrimeCell MMCI PL180/1 driver
+ *  linux/drivers/mmc/host/mmci.c - ARM PrimeCell MMCI PL180/1 driver
  *
  *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
  *
index 6d7eadc9a6789b5e354b70c12a7e9d62d08526c1..000e6a9197828f38a0a69492bb47fa290738d733 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/mmci.h - ARM PrimeCell MMCI PL180/1 driver
+ *  linux/drivers/mmc/host/mmci.h - ARM PrimeCell MMCI PL180/1 driver
  *
  *  Copyright (C) 2003 Deep Blue Solutions, Ltd, All Rights Reserved.
  *
index b0824a38f42542602b5471fd8c4e0a6c986caf16..0cf97edc5f58f978437f49da8cb1323c3599bc41 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/media/mmc/omap.c
+ *  linux/drivers/mmc/host/omap.c
  *
  *  Copyright (C) 2004 Nokia Corporation
  *  Written by Tuukka Tikkanen and Juha Yrjölä<juha.yrjola@nokia.com>
index f8985c508bb9191ce5406b7f4b8bb43c092c939d..ff960334b337d814e72bd1fc5446d80aa4294ea0 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/pxa.c - PXA MMCI driver
+ *  linux/drivers/mmc/host/pxa.c - PXA MMCI driver
  *
  *  Copyright (C) 2003 Russell King, All Rights Reserved.
  *
index 4a24db028d87f1902ce2b27628a3f90dff29852f..f2bc87ac24f7fe9151dcc948ffedb921d798116c 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/sdhci.c - Secure Digital Host Controller Interface driver
+ *  linux/drivers/mmc/host/sdhci.c - Secure Digital Host Controller Interface driver
  *
  *  Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
  *
@@ -34,6 +34,7 @@ static unsigned int debug_quirks = 0;
 /* Controller doesn't like some resets when there is no card inserted. */
 #define SDHCI_QUIRK_NO_CARD_NO_RESET                   (1<<2)
 #define SDHCI_QUIRK_SINGLE_POWER_WRITE                 (1<<3)
+#define SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS              (1<<4)
 
 static const struct pci_device_id pci_ids[] __devinitdata = {
        {
@@ -78,6 +79,24 @@ static const struct pci_device_id pci_ids[] __devinitdata = {
                .driver_data    = SDHCI_QUIRK_SINGLE_POWER_WRITE,
        },
 
+       {
+               .vendor         = PCI_VENDOR_ID_ENE,
+               .device         = PCI_DEVICE_ID_ENE_CB714_SD,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .driver_data    = SDHCI_QUIRK_SINGLE_POWER_WRITE |
+                                 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS,
+       },
+
+       {
+               .vendor         = PCI_VENDOR_ID_ENE,
+               .device         = PCI_DEVICE_ID_ENE_CB714_SD_2,
+               .subvendor      = PCI_ANY_ID,
+               .subdevice      = PCI_ANY_ID,
+               .driver_data    = SDHCI_QUIRK_SINGLE_POWER_WRITE |
+                                 SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS,
+       },
+
        {       /* Generic SD host controller */
                PCI_DEVICE_CLASS((PCI_CLASS_SYSTEM_SDHCI << 8), 0xFFFF00)
        },
@@ -361,11 +380,6 @@ static void sdhci_prepare_data(struct sdhci_host *host, struct mmc_data *data)
        if (data == NULL)
                return;
 
-       DBG("blksz %04x blks %04x flags %08x\n",
-               data->blksz, data->blocks, data->flags);
-       DBG("tsac %d ms nsac %d clk\n",
-               data->timeout_ns / 1000000, data->timeout_clks);
-
        /* Sanity checks */
        BUG_ON(data->blksz * data->blocks > 524288);
        BUG_ON(data->blksz > host->mmc->max_blk_size);
@@ -476,8 +490,6 @@ static void sdhci_finish_data(struct sdhci_host *host)
                data->error = MMC_ERR_FAILED;
        }
 
-       DBG("Ending data transfer (%d bytes)\n", data->bytes_xfered);
-
        if (data->stop) {
                /*
                 * The controller needs a reset of internal state machines
@@ -501,8 +513,6 @@ static void sdhci_send_command(struct sdhci_host *host, struct mmc_command *cmd)
 
        WARN_ON(host->cmd);
 
-       DBG("Sending cmd (%x)\n", cmd->opcode);
-
        /* Wait max 10 ms */
        timeout = 10;
 
@@ -590,8 +600,6 @@ static void sdhci_finish_command(struct sdhci_host *host)
 
        host->cmd->error = MMC_ERR_NONE;
 
-       DBG("Ending cmd (%x)\n", host->cmd->opcode);
-
        if (host->cmd->data)
                host->data = host->cmd->data;
        else
@@ -759,6 +767,14 @@ static void sdhci_set_ios(struct mmc_host *mmc, struct mmc_ios *ios)
 
        writeb(ctrl, host->ioaddr + SDHCI_HOST_CONTROL);
 
+       /*
+        * Some (ENE) controllers go apeshit on some ios operation,
+        * signalling timeout and CRC errors even on CMD0. Resetting
+        * it on each ios seems to solve the problem.
+        */
+       if(host->chip->quirks & SDHCI_QUIRK_RESET_CMD_DATA_ON_IOS)
+               sdhci_reset(host, SDHCI_RESET_CMD | SDHCI_RESET_DATA);
+
        mmiowb();
        spin_unlock_irqrestore(&host->lock, flags);
 }
@@ -835,8 +851,6 @@ static void sdhci_tasklet_finish(unsigned long param)
 
        mrq = host->mrq;
 
-       DBG("Ending request, cmd (%x)\n", mrq->cmd->opcode);
-
        /*
         * The controller needs a reset of internal state machines
         * upon error conditions.
@@ -922,20 +936,17 @@ static void sdhci_cmd_irq(struct sdhci_host *host, u32 intmask)
                return;
        }
 
-       if (intmask & SDHCI_INT_RESPONSE)
-               sdhci_finish_command(host);
-       else {
-               if (intmask & SDHCI_INT_TIMEOUT)
-                       host->cmd->error = MMC_ERR_TIMEOUT;
-               else if (intmask & SDHCI_INT_CRC)
-                       host->cmd->error = MMC_ERR_BADCRC;
-               else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX))
-                       host->cmd->error = MMC_ERR_FAILED;
-               else
-                       host->cmd->error = MMC_ERR_INVALID;
+       if (intmask & SDHCI_INT_TIMEOUT)
+               host->cmd->error = MMC_ERR_TIMEOUT;
+       else if (intmask & SDHCI_INT_CRC)
+               host->cmd->error = MMC_ERR_BADCRC;
+       else if (intmask & (SDHCI_INT_END_BIT | SDHCI_INT_INDEX))
+               host->cmd->error = MMC_ERR_FAILED;
 
+       if (host->cmd->error != MMC_ERR_NONE)
                tasklet_schedule(&host->finish_tasklet);
-       }
+       else if (intmask & SDHCI_INT_RESPONSE)
+               sdhci_finish_command(host);
 }
 
 static void sdhci_data_irq(struct sdhci_host *host, u32 intmask)
index a6c870480b8a02700cde756566e05926f5284fd5..d157776c11491d1f58d7c255acf8dd03d448a1f7 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/sdhci.h - Secure Digital Host Controller Interface driver
+ *  linux/drivers/mmc/host/sdhci.h - Secure Digital Host Controller Interface driver
  *
  *  Copyright (C) 2005-2007 Pierre Ossman, All Rights Reserved.
  *
index 867ca6a69298028057f35a13409574dead8f0c8d..9bf2a877113bf0a55cf8bc21904158990c24ca39 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/wbsd.c - Winbond W83L51xD SD/MMC driver
+ *  linux/drivers/mmc/host/wbsd.c - Winbond W83L51xD SD/MMC driver
  *
  *  Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved.
  *
@@ -207,8 +207,6 @@ static void wbsd_request_end(struct wbsd_host *host, struct mmc_request *mrq)
 {
        unsigned long dmaflags;
 
-       DBGF("Ending request, cmd (%x)\n", mrq->cmd->opcode);
-
        if (host->dma >= 0) {
                /*
                 * Release ISA DMA controller.
@@ -360,8 +358,6 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd)
        int i;
        u8 status, isr;
 
-       DBGF("Sending cmd (%x)\n", cmd->opcode);
-
        /*
         * Clear accumulated ISR. The interrupt routine
         * will fill this one with events that occur during
@@ -411,8 +407,6 @@ static void wbsd_send_command(struct wbsd_host *host, struct mmc_command *cmd)
                                wbsd_get_short_reply(host, cmd);
                }
        }
-
-       DBGF("Sent cmd (%x), res %d\n", cmd->opcode, cmd->error);
 }
 
 /*
@@ -550,11 +544,6 @@ static void wbsd_prepare_data(struct wbsd_host *host, struct mmc_data *data)
        unsigned long dmaflags;
        unsigned int size;
 
-       DBGF("blksz %04x blks %04x flags %08x\n",
-               data->blksz, data->blocks, data->flags);
-       DBGF("tsac %d ms nsac %d clk\n",
-               data->timeout_ns / 1000000, data->timeout_clks);
-
        /*
         * Calculate size.
         */
@@ -752,8 +741,6 @@ static void wbsd_finish_data(struct wbsd_host *host, struct mmc_data *data)
                }
        }
 
-       DBGF("Ending data transfer (%d bytes)\n", data->bytes_xfered);
-
        wbsd_request_end(host, host->mrq);
 }
 
@@ -1279,7 +1266,7 @@ static int __devinit wbsd_alloc_mmc(struct device *dev)
        return 0;
 }
 
-static void __devexit wbsd_free_mmc(struct device *dev)
+static void wbsd_free_mmc(struct device *dev)
 {
        struct mmc_host *mmc;
        struct wbsd_host *host;
@@ -1371,7 +1358,7 @@ static int __devinit wbsd_request_region(struct wbsd_host *host, int base)
        return 0;
 }
 
-static void __devexit wbsd_release_regions(struct wbsd_host *host)
+static void wbsd_release_regions(struct wbsd_host *host)
 {
        if (host->base)
                release_region(host->base, 8);
@@ -1447,7 +1434,7 @@ err:
                "Falling back on FIFO.\n", dma);
 }
 
-static void __devexit wbsd_release_dma(struct wbsd_host *host)
+static void wbsd_release_dma(struct wbsd_host *host)
 {
        if (host->dma_addr) {
                dma_unmap_single(mmc_dev(host->mmc), host->dma_addr,
@@ -1497,7 +1484,7 @@ static int __devinit wbsd_request_irq(struct wbsd_host *host, int irq)
        return 0;
 }
 
-static void __devexit wbsd_release_irq(struct wbsd_host *host)
+static void  wbsd_release_irq(struct wbsd_host *host)
 {
        if (!host->irq)
                return;
@@ -1548,7 +1535,7 @@ static int __devinit wbsd_request_resources(struct wbsd_host *host,
  * Release all resources for the host.
  */
 
-static void __devexit wbsd_release_resources(struct wbsd_host *host)
+static void wbsd_release_resources(struct wbsd_host *host)
 {
        wbsd_release_dma(host);
        wbsd_release_irq(host);
index 873bda1e59b462b7a750bb70d77482a8950ff914..0877866f8d2811a7594ed0e9f3105534c7d17d15 100644 (file)
@@ -1,5 +1,5 @@
 /*
- *  linux/drivers/mmc/wbsd.h - Winbond W83L51xD SD/MMC driver
+ *  linux/drivers/mmc/host/wbsd.h - Winbond W83L51xD SD/MMC driver
  *
  *  Copyright (C) 2004-2007 Pierre Ossman, All Rights Reserved.
  *
index 451adcc52b3c5c281da118b50768ccd338a482a8..6d958a4566ffdf041397b9c685a76b88587493d4 100644 (file)
@@ -3,9 +3,9 @@
 #
 
 # Core functionality.
+obj-$(CONFIG_MTD)              += mtd.o
 mtd-y                          := mtdcore.o mtdsuper.o
 mtd-$(CONFIG_MTD_PARTITIONS)   += mtdpart.o
-obj-$(CONFIG_MTD)              += $(mtd-y)
 
 obj-$(CONFIG_MTD_CONCAT)       += mtdconcat.o
 obj-$(CONFIG_MTD_REDBOOT_PARTS) += redboot.o
index b96ac8e119dc15efdfe4251742aee5be4b8b420f..54aa7590764028c673a6b8e9dec1a06a5dbfbf8f 100644 (file)
@@ -81,9 +81,6 @@ static unsigned long __initdata doc_locations[] = {
 #endif /*  CONFIG_MTD_DOCPROBE_HIGH */
 #elif defined(__PPC__)
        0xe4000000,
-#elif defined(CONFIG_MOMENCO_OCELOT)
-       0x2f000000,
-        0xff000000,
 #elif defined(CONFIG_MOMENCO_OCELOT_G)
         0xff000000,
 ##else
index f88ebc5b685e93863fc14ad138f0d8fb089acf38..cc6c734424350e17de559c8551a470e70f7e5639 100644 (file)
@@ -103,7 +103,7 @@ config MTD_PMC_MSP_RAMROOT
 
 config MTD_SUN_UFLASH
        tristate "Sun Microsystems userflash support"
-       depends on SPARC && MTD_CFI
+       depends on SPARC && MTD_CFI && PCI
        help
          This provides a 'mapping' driver which supports the way in
          which user-programmable flash chips are connected on various
index 8c86b802f212afa98ca588d06717e46d4b9afe3f..d091b2430b480254c4cb2743a28def0e6805486a 100644 (file)
@@ -7,6 +7,7 @@
 
 #include <linux/device.h>
 #include <linux/fs.h>
+#include <linux/mm.h>
 #include <linux/err.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
index 9c6236852942ec7e98441c5a333c1786a0e83a0c..6174a97d790274f5aa1245dc53171c324482ebb9 100644 (file)
@@ -560,7 +560,3 @@ int parse_mtd_partitions(struct mtd_info *master, const char **types,
 EXPORT_SYMBOL_GPL(parse_mtd_partitions);
 EXPORT_SYMBOL_GPL(register_mtd_parser);
 EXPORT_SYMBOL_GPL(deregister_mtd_parser);
-
-MODULE_LICENSE("GPL");
-MODULE_AUTHOR("Nicolas Pitre <nico@cam.org>");
-MODULE_DESCRIPTION("Generic support for partitioning of MTD devices");
index 512e999177f70cb39c745ac6d454d22e6a4c3bae..b2a5672df6e0a15a2c1b2f2183087883c1a9f35e 100644 (file)
@@ -128,7 +128,10 @@ static int __init at91_nand_probe(struct platform_device *pdev)
        nand_chip->IO_ADDR_R = host->io_base;
        nand_chip->IO_ADDR_W = host->io_base;
        nand_chip->cmd_ctrl = at91_nand_cmd_ctrl;
-       nand_chip->dev_ready = at91_nand_device_ready;
+
+       if (host->board->rdy_pin)
+               nand_chip->dev_ready = at91_nand_device_ready;
+
        nand_chip->ecc.mode = NAND_ECC_SOFT;    /* enable ECC */
        nand_chip->chip_delay = 20;             /* 20us command delay time */
 
index 17c868034aad4a8d7cee4851400867bb9b299747..e96259f22cca3405b6919c2d01f3b5eb11049552 100644 (file)
@@ -56,9 +56,6 @@ static unsigned long __initdata doc_locations[] = {
 #endif /*  CONFIG_MTD_DOCPROBE_HIGH */
 #elif defined(__PPC__)
        0xe4000000,
-#elif defined(CONFIG_MOMENCO_OCELOT)
-       0x2f000000,
-       0xff000000,
 #elif defined(CONFIG_MOMENCO_OCELOT_G)
        0xff000000,
 #else
index 1daf8231aaefc079885be293a7f598e88bb87401..0146cdc48039617259a72c5a8c094d6a53c18cc5 100644 (file)
@@ -74,7 +74,7 @@ static struct mtd_partition partition_info[] = {
 /*
  *     hardware specific access to control-lines
  *
- *     NAND_NCE: bit 0 -> bit 7
+ *     NAND_NCE: bit 0 -> bit 6 (bit 7 = 1)
  *     NAND_CLE: bit 1 -> bit 4
  *     NAND_ALE: bit 2 -> bit 5
  */
@@ -83,12 +83,12 @@ static void ep7312_hwcontrol(struct mtd_info *mtd, int cmd, unsigned int ctrl)
        struct nand_chip *chip = mtd->priv;
 
        if (ctrl & NAND_CTRL_CHANGE) {
-               unsigned char bits;
+               unsigned char bits = 0x80;
 
-               bits = (ctrl & (NAND_CLE | NAND_ALE)) << 3;
-               bits = (ctrl & NAND_NCE) << 7;
+               bits |= (ctrl & (NAND_CLE | NAND_ALE)) << 3;
+               bits |= (ctrl & NAND_NCE) ? 0x00 : 0x40;
 
-               clps_writeb((clps_readb(ep7312_pxdr)  & 0xB0) | 0x10,
+               clps_writeb((clps_readb(ep7312_pxdr)  & 0xF0) | bits,
                            ep7312_pxdr);
        }
        if (cmd != NAND_CMD_NONE)
index 7e68203fe1ba1c46c779d55a5ae2c9151c5659bf..24ac6778b1a8cda528ff6426abd37cd24fe12e8b 100644 (file)
@@ -24,6 +24,7 @@
  *     if we have HW ecc support.
  *     The AG-AND chips have nice features for speed improvement,
  *     which are not supported yet. Read / program 4 pages in one go.
+ *     BBT table is not serialized, has to be fixed
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License version 2 as
@@ -360,6 +361,7 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
                /* We write two bytes, so we dont have to mess with 16 bit
                 * access
                 */
+               nand_get_device(chip, mtd, FL_WRITING);
                ofs += mtd->oobsize;
                chip->ops.len = chip->ops.ooblen = 2;
                chip->ops.datbuf = NULL;
@@ -367,9 +369,11 @@ static int nand_default_block_markbad(struct mtd_info *mtd, loff_t ofs)
                chip->ops.ooboffs = chip->badblockpos & ~0x01;
 
                ret = nand_do_write_oob(mtd, ofs, &chip->ops);
+               nand_release_device(mtd);
        }
        if (!ret)
                mtd->ecc_stats.badblocks++;
+
        return ret;
 }
 
@@ -768,7 +772,7 @@ static int nand_read_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
        uint8_t *p = buf;
        uint8_t *ecc_calc = chip->buffers->ecccalc;
        uint8_t *ecc_code = chip->buffers->ecccode;
-       int *eccpos = chip->ecc.layout->eccpos;
+       uint32_t *eccpos = chip->ecc.layout->eccpos;
 
        chip->ecc.read_page_raw(mtd, chip, buf);
 
@@ -810,7 +814,7 @@ static int nand_read_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
        uint8_t *p = buf;
        uint8_t *ecc_calc = chip->buffers->ecccalc;
        uint8_t *ecc_code = chip->buffers->ecccode;
-       int *eccpos = chip->ecc.layout->eccpos;
+       uint32_t *eccpos = chip->ecc.layout->eccpos;
 
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
                chip->ecc.hwctl(mtd, NAND_ECC_READ);
@@ -1416,7 +1420,7 @@ static void nand_write_page_swecc(struct mtd_info *mtd, struct nand_chip *chip,
        int eccsteps = chip->ecc.steps;
        uint8_t *ecc_calc = chip->buffers->ecccalc;
        const uint8_t *p = buf;
-       int *eccpos = chip->ecc.layout->eccpos;
+       uint32_t *eccpos = chip->ecc.layout->eccpos;
 
        /* Software ecc calculation */
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize)
@@ -1442,7 +1446,7 @@ static void nand_write_page_hwecc(struct mtd_info *mtd, struct nand_chip *chip,
        int eccsteps = chip->ecc.steps;
        uint8_t *ecc_calc = chip->buffers->ecccalc;
        const uint8_t *p = buf;
-       int *eccpos = chip->ecc.layout->eccpos;
+       uint32_t *eccpos = chip->ecc.layout->eccpos;
 
        for (i = 0; eccsteps; eccsteps--, i += eccbytes, p += eccsize) {
                chip->ecc.hwctl(mtd, NAND_ECC_WRITE);
index d4b1ba8f23ef40b0dd072fc2c251c46f8f54dc7d..006c03aacb55d1241fc99cae8420c7b8383dda3d 100644 (file)
@@ -779,6 +779,7 @@ static void rfd_ftl_add_mtd(struct mtd_blktrans_ops *tr, struct mtd_info *mtd)
        else {
                if (!mtd->erasesize) {
                        printk(KERN_WARNING PREFIX "please provide block_size");
+                       kfree(part);
                        return;
                }
                else
index 6deb20fc7a08017f6b9ef7955a827103181529c7..a8c0f436cdd2b3088e4cdeb165841f243e2823d0 100644 (file)
@@ -1555,6 +1555,7 @@ vortex_up(struct net_device *dev)
                mii_reg1 = mdio_read(dev, vp->phys[0], MII_BMSR);
                mii_reg5 = mdio_read(dev, vp->phys[0], MII_LPA);
                vp->partner_flow_ctrl = ((mii_reg5 & 0x0400) != 0);
+               vp->mii.full_duplex = vp->full_duplex;
 
                vortex_check_media(dev, 1);
        }
@@ -2886,7 +2887,6 @@ static const struct ethtool_ops vortex_ethtool_ops = {
        .set_settings           = vortex_set_settings,
        .get_link               = ethtool_op_get_link,
        .nway_reset             = vortex_nway_reset,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 #ifdef CONFIG_PCI
index e970e64bf96698916a1caaac8c5000471ed6cc18..a79f28c7a1009aac9cc023807b27d903a52807a4 100644 (file)
@@ -1578,7 +1578,6 @@ static const struct ethtool_ops cp_ethtool_ops = {
        .set_wol                = cp_set_wol,
        .get_strings            = cp_get_strings,
        .get_ethtool_stats      = cp_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
        .get_eeprom_len         = cp_get_eeprom_len,
        .get_eeprom             = cp_get_eeprom,
        .set_eeprom             = cp_set_eeprom,
index 327eaa7b4999183dee5ad600dc56b29efbbed787..f4e4298d24b96ef40ab305fb3270855b388360d4 100644 (file)
@@ -2452,7 +2452,6 @@ static const struct ethtool_ops rtl8139_ethtool_ops = {
        .get_strings            = rtl8139_get_strings,
        .get_stats_count        = rtl8139_get_stats_count,
        .get_ethtool_stats      = rtl8139_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
index f8a602caabcb9595d249065569eb0dbc03a3aef4..81ef81c9a5841904887b70a3d37470a624467fbf 100644 (file)
@@ -2851,7 +2851,7 @@ config PPPOATM
 
 config PPPOL2TP
        tristate "PPP over L2TP (EXPERIMENTAL)"
-       depends on EXPERIMENTAL && PPP
+       depends on EXPERIMENTAL && PPP && INET
        help
          Support for PPP-over-L2TP socket family. L2TP is a protocol
          used by ISPs and enterprises to tunnel PPP traffic over UDP
index 94b78cc5fe86d554647585b9e310909931678952..e684212fd8e2004fd6410b1e8688fe2cc5044af5 100644 (file)
@@ -177,7 +177,7 @@ obj-$(CONFIG_ZORRO8390) += zorro8390.o
 obj-$(CONFIG_HPLANCE) += hplance.o 7990.o
 obj-$(CONFIG_MVME147_NET) += mvme147.o 7990.o
 obj-$(CONFIG_EQUALIZER) += eql.o
-obj-$(CONFIG_LGUEST_GUEST) += lguest_net.o
+obj-$(CONFIG_LGUEST_NET) += lguest_net.o
 obj-$(CONFIG_MIPS_JAZZ_SONIC) += jazzsonic.o
 obj-$(CONFIG_MIPS_AU1X00_ENET) += au1000_eth.o
 obj-$(CONFIG_MIPS_SIM_NET) += mipsnet.o
index 56f6389a300eb3c18a50b7b636cb9965118b49cb..3c1984ecf36ca7a0331748f5d488dbed8838149f 100644 (file)
@@ -1704,10 +1704,8 @@ static int atl1_xmit_frame(struct sk_buff *skb, struct net_device *netdev)
                }
        }
 
-       local_irq_save(flags);
-       if (!spin_trylock(&adapter->lock)) {
+       if (!spin_trylock_irqsave(&adapter->lock, flags)) {
                /* Can't get lock - tell upper layer to requeue */
-               local_irq_restore(flags);
                dev_printk(KERN_DEBUG, &adapter->pdev->dev, "tx locked\n");
                return NETDEV_TX_LOCKED;
        }
index 1d882360b34da8ea6cd97488739656d6f9f13e09..90e0734e60375abe0325cc5cfd0c7a49e0b9c43f 100644 (file)
@@ -580,7 +580,6 @@ static const struct ethtool_ops ax_ethtool_ops = {
        .set_settings           = ax_set_settings,
        .nway_reset             = ax_nway_reset,
        .get_link               = ax_get_link,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 /* setup code */
@@ -819,11 +818,12 @@ static int ax_probe(struct platform_device *pdev)
        }
 
        ei_status.mem = ioremap(res->start, size);
-       dev->base_addr = (long)ei_status.mem;
+       dev->base_addr = (unsigned long)ei_status.mem;
 
        if (ei_status.mem == NULL) {
-               dev_err(&pdev->dev, "Cannot ioremap area (%08zx,%08zx)\n",
-                       res->start, res->end);
+               dev_err(&pdev->dev, "Cannot ioremap area (%08llx,%08llx)\n",
+                       (unsigned long long)res->start,
+                       (unsigned long long)res->end);
 
                ret = -ENXIO;
                goto exit_req;
index 37f1b6ff5c123c612fe2feadb29b976ac0ea76d3..0795df2354928e7caec1cda7b39d3743c6a2603d 100644 (file)
@@ -2033,7 +2033,6 @@ static const struct ethtool_ops b44_ethtool_ops = {
        .get_strings            = b44_get_strings,
        .get_stats_count        = b44_get_stats_count,
        .get_ethtool_stats      = b44_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static int b44_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
index 9a08d656f1ce5a879da190cf1bdb6a662439c9a6..2bb97d464689e9bcbe90db886a08a7f06ef15243 100644 (file)
@@ -798,6 +798,7 @@ static void bf537mac_shutdown(struct net_device *dev)
  */
 static int bf537mac_open(struct net_device *dev)
 {
+       int retval;
        pr_debug("%s: %s\n", dev->name, __FUNCTION__);
 
        /*
@@ -811,7 +812,10 @@ static int bf537mac_open(struct net_device *dev)
        }
 
        /* initial rx and tx list */
-       desc_list_init();
+       retval = desc_list_init();
+
+       if (retval)
+               return retval;
 
        bf537mac_setphy(dev);
        setup_system_regs(dev);
index a729da061bbb649ab51ee0d53775f2a536f049fc..24e7f9ab3f5a72c76eeefd54b332152531c2b98b 100644 (file)
@@ -54,8 +54,8 @@
 
 #define DRV_MODULE_NAME                "bnx2"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "1.6.3"
-#define DRV_MODULE_RELDATE     "July 16, 2007"
+#define DRV_MODULE_VERSION     "1.6.4"
+#define DRV_MODULE_RELDATE     "August 3, 2007"
 
 #define RUN_AT(x) (jiffies + (x))
 
@@ -6269,7 +6269,6 @@ static const struct ethtool_ops bnx2_ethtool_ops = {
        .phys_id                = bnx2_phys_id,
        .get_stats_count        = bnx2_get_stats_count,
        .get_ethtool_stats      = bnx2_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 /* Called with rtnl_lock */
@@ -6938,6 +6937,11 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
        struct bnx2 *bp = netdev_priv(dev);
        u32 reset_code;
 
+       /* PCI register 4 needs to be saved whether netif_running() or not.
+        * MSI address and data need to be saved if using MSI and
+        * netif_running().
+        */
+       pci_save_state(pdev);
        if (!netif_running(dev))
                return 0;
 
@@ -6953,7 +6957,6 @@ bnx2_suspend(struct pci_dev *pdev, pm_message_t state)
                reset_code = BNX2_DRV_MSG_CODE_SUSPEND_NO_WOL;
        bnx2_reset_chip(bp, reset_code);
        bnx2_free_skbs(bp);
-       pci_save_state(pdev);
        bnx2_set_power_state(bp, pci_choose_state(pdev, state));
        return 0;
 }
@@ -6964,10 +6967,10 @@ bnx2_resume(struct pci_dev *pdev)
        struct net_device *dev = pci_get_drvdata(pdev);
        struct bnx2 *bp = netdev_priv(dev);
 
+       pci_restore_state(pdev);
        if (!netif_running(dev))
                return 0;
 
-       pci_restore_state(pdev);
        bnx2_set_power_state(bp, PCI_D0);
        netif_device_attach(dev);
        bnx2_init_nic(bp);
index cb9cb3013f4250d7fbf302b4495fa069abd47efa..1afda3230defc01c1d38db13f9e17cf8b80397cd 100644 (file)
@@ -613,38 +613,20 @@ down:
 static int bond_update_speed_duplex(struct slave *slave)
 {
        struct net_device *slave_dev = slave->dev;
-       static int (* ioctl)(struct net_device *, struct ifreq *, int);
-       struct ifreq ifr;
        struct ethtool_cmd etool;
+       int res;
 
        /* Fake speed and duplex */
        slave->speed = SPEED_100;
        slave->duplex = DUPLEX_FULL;
 
-       if (slave_dev->ethtool_ops) {
-               int res;
-
-               if (!slave_dev->ethtool_ops->get_settings) {
-                       return -1;
-               }
-
-               res = slave_dev->ethtool_ops->get_settings(slave_dev, &etool);
-               if (res < 0) {
-                       return -1;
-               }
-
-               goto verify;
-       }
+       if (!slave_dev->ethtool_ops || !slave_dev->ethtool_ops->get_settings)
+               return -1;
 
-       ioctl = slave_dev->do_ioctl;
-       strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
-       etool.cmd = ETHTOOL_GSET;
-       ifr.ifr_data = (char*)&etool;
-       if (!ioctl || (IOCTL(slave_dev, &ifr, SIOCETHTOOL) < 0)) {
+       res = slave_dev->ethtool_ops->get_settings(slave_dev, &etool);
+       if (res < 0)
                return -1;
-       }
 
-verify:
        switch (etool.speed) {
        case SPEED_10:
        case SPEED_100:
@@ -690,7 +672,6 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
        static int (* ioctl)(struct net_device *, struct ifreq *, int);
        struct ifreq ifr;
        struct mii_ioctl_data *mii;
-       struct ethtool_value etool;
 
        if (bond->params.use_carrier) {
                return netif_carrier_ok(slave_dev) ? BMSR_LSTATUS : 0;
@@ -721,9 +702,10 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
                }
        }
 
-       /* try SIOCETHTOOL ioctl, some drivers cache ETHTOOL_GLINK */
-       /* for a period of time so we attempt to get link status   */
-       /* from it last if the above MII ioctls fail...            */
+       /*
+        * Some drivers cache ETHTOOL_GLINK for a period of time so we only
+        * attempt to get link status from it if the above MII ioctls fail.
+        */
        if (slave_dev->ethtool_ops) {
                if (slave_dev->ethtool_ops->get_link) {
                        u32 link;
@@ -734,23 +716,9 @@ static int bond_check_dev_link(struct bonding *bond, struct net_device *slave_de
                }
        }
 
-       if (ioctl) {
-               strncpy(ifr.ifr_name, slave_dev->name, IFNAMSIZ);
-               etool.cmd = ETHTOOL_GLINK;
-               ifr.ifr_data = (char*)&etool;
-               if (IOCTL(slave_dev, &ifr, SIOCETHTOOL) == 0) {
-                       if (etool.data == 1) {
-                               return BMSR_LSTATUS;
-                       } else {
-                               dprintk("SIOCETHTOOL shows link down\n");
-                               return 0;
-                       }
-               }
-       }
-
        /*
         * If reporting, report that either there's no dev->do_ioctl,
-        * or both SIOCGMIIREG and SIOCETHTOOL failed (meaning that we
+        * or both SIOCGMIIREG and get_link failed (meaning that we
         * cannot report link status).  If not reporting, pretend
         * we're ok.
         */
@@ -1234,43 +1202,35 @@ static int bond_sethwaddr(struct net_device *bond_dev,
        return 0;
 }
 
-#define BOND_INTERSECT_FEATURES \
-       (NETIF_F_SG | NETIF_F_ALL_CSUM | NETIF_F_TSO | NETIF_F_UFO)
+#define BOND_VLAN_FEATURES \
+       (NETIF_F_VLAN_CHALLENGED | NETIF_F_HW_VLAN_RX | NETIF_F_HW_VLAN_TX | \
+        NETIF_F_HW_VLAN_FILTER)
 
 /* 
  * Compute the common dev->feature set available to all slaves.  Some
- * feature bits are managed elsewhere, so preserve feature bits set on
- * master device that are not part of the examined set.
+ * feature bits are managed elsewhere, so preserve those feature bits
+ * on the master device.
  */
 static int bond_compute_features(struct bonding *bond)
 {
-       unsigned long features = BOND_INTERSECT_FEATURES;
        struct slave *slave;
        struct net_device *bond_dev = bond->dev;
+       unsigned long features = bond_dev->features;
        unsigned short max_hard_header_len = ETH_HLEN;
        int i;
 
+       features &= ~(NETIF_F_ALL_CSUM | BOND_VLAN_FEATURES);
+       features |= NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
+                   NETIF_F_GSO_MASK | NETIF_F_NO_CSUM;
+
        bond_for_each_slave(bond, slave, i) {
-               features &= (slave->dev->features & BOND_INTERSECT_FEATURES);
+               features = netdev_compute_features(features,
+                                                  slave->dev->features);
                if (slave->dev->hard_header_len > max_hard_header_len)
                        max_hard_header_len = slave->dev->hard_header_len;
        }
 
-       if ((features & NETIF_F_SG) && 
-           !(features & NETIF_F_ALL_CSUM))
-               features &= ~NETIF_F_SG;
-
-       /* 
-        * features will include NETIF_F_TSO (NETIF_F_UFO) iff all 
-        * slave devices support NETIF_F_TSO (NETIF_F_UFO), which 
-        * implies that all slaves also support scatter-gather 
-        * (NETIF_F_SG), which implies that features also includes 
-        * NETIF_F_SG. So no need to check whether we have an  
-        * illegal combination of NETIF_F_{TSO,UFO} and 
-        * !NETIF_F_SG 
-        */
-
-       features |= (bond_dev->features & ~BOND_INTERSECT_FEATURES);
+       features |= (bond_dev->features & BOND_VLAN_FEATURES);
        bond_dev->features = features;
        bond_dev->hard_header_len = max_hard_header_len;
 
index 6fd1e5241833d7e2f68800f092ade1074e27256a..dc5d26988bb3e912030ae2a35bb91020a45ca5f4 100644 (file)
@@ -1583,7 +1583,6 @@ static const struct ethtool_ops cxgb_ethtool_ops = {
        .get_wol = get_wol,
        .get_tso = ethtool_op_get_tso,
        .set_tso = ethtool_op_set_tso,
-       .get_perm_addr = ethtool_op_get_perm_addr
 };
 
 static int in_range(int val, int lo, int hi)
index ebcf35e4cf5b45db0c7ffda9054c20d7982e826b..e620ed4c3ff0b5fb7aaa8650cc0315f2f4a714f8 100644 (file)
@@ -699,7 +699,7 @@ static int do_cr(struct t3cdev *dev, struct sk_buff *skb)
  * the buffer.
  */
 static struct sk_buff *cxgb3_get_cpl_reply_skb(struct sk_buff *skb, size_t len,
-                                              int gfp)
+                                              gfp_t gfp)
 {
        if (likely(!skb_cloned(skb))) {
                BUG_ON(skb->len < len);
index 6b6401e9304e6b2a298773019cb2c6d32f26a0f9..280313b9b069cfa146b8d2dd4cf93f821678df5a 100644 (file)
@@ -2506,7 +2506,6 @@ static const struct ethtool_ops e100_ethtool_ops = {
        .phys_id                = e100_phys_id,
        .get_stats_count        = e100_get_stats_count,
        .get_ethtool_stats      = e100_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static int e100_do_ioctl(struct net_device *netdev, struct ifreq *ifr, int cmd)
index bb08375b5f13f73629320bc874653c0fa7cfba01..4c3785c9d4b811067b5af3dafd0de33224591bae 100644 (file)
@@ -1706,6 +1706,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol
        case E1000_DEV_ID_82545EM_COPPER:
        case E1000_DEV_ID_82546GB_QUAD_COPPER:
        case E1000_DEV_ID_82546GB_PCIE:
+       case E1000_DEV_ID_82571EB_SERDES_QUAD:
                /* these don't support WoL at all */
                wol->supported = 0;
                break;
@@ -1723,6 +1724,7 @@ static int e1000_wol_exclusion(struct e1000_adapter *adapter, struct ethtool_wol
                retval = 0;
                break;
        case E1000_DEV_ID_82571EB_QUAD_COPPER:
+       case E1000_DEV_ID_82571EB_QUAD_FIBER:
        case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
        case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
                /* quad port adapters only support WoL on port A */
@@ -1973,7 +1975,6 @@ static const struct ethtool_ops e1000_ethtool_ops = {
        .phys_id                = e1000_phys_id,
        .get_stats_count        = e1000_get_stats_count,
        .get_ethtool_stats      = e1000_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 void e1000_set_ethtool_ops(struct net_device *netdev)
index 9be44699300b8a350041d923917cae5630b724c0..ba120f7fb0bef2c619475fcd5742170f02b44124 100644 (file)
@@ -384,7 +384,10 @@ e1000_set_mac_type(struct e1000_hw *hw)
        case E1000_DEV_ID_82571EB_COPPER:
        case E1000_DEV_ID_82571EB_FIBER:
        case E1000_DEV_ID_82571EB_SERDES:
+       case E1000_DEV_ID_82571EB_SERDES_DUAL:
+       case E1000_DEV_ID_82571EB_SERDES_QUAD:
        case E1000_DEV_ID_82571EB_QUAD_COPPER:
+       case E1000_DEV_ID_82571EB_QUAD_FIBER:
        case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
                hw->mac_type = e1000_82571;
                break;
@@ -485,6 +488,8 @@ e1000_set_media_type(struct e1000_hw *hw)
     case E1000_DEV_ID_82545GM_SERDES:
     case E1000_DEV_ID_82546GB_SERDES:
     case E1000_DEV_ID_82571EB_SERDES:
+    case E1000_DEV_ID_82571EB_SERDES_DUAL:
+    case E1000_DEV_ID_82571EB_SERDES_QUAD:
     case E1000_DEV_ID_82572EI_SERDES:
     case E1000_DEV_ID_80003ES2LAN_SERDES_DPT:
         hw->media_type = e1000_media_type_internal_serdes;
index bd000b802ee7190a325e9b573621350affe4ce36..fe8714655c90445808000870543f5539d70e1dfa 100644 (file)
@@ -475,7 +475,10 @@ int32_t e1000_check_phy_reset_block(struct e1000_hw *hw);
 #define E1000_DEV_ID_82571EB_FIBER       0x105F
 #define E1000_DEV_ID_82571EB_SERDES      0x1060
 #define E1000_DEV_ID_82571EB_QUAD_COPPER 0x10A4
+#define E1000_DEV_ID_82571EB_QUAD_FIBER  0x10A5
 #define E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE  0x10BC
+#define E1000_DEV_ID_82571EB_SERDES_DUAL 0x10D9
+#define E1000_DEV_ID_82571EB_SERDES_QUAD 0x10DA
 #define E1000_DEV_ID_82572EI_COPPER      0x107D
 #define E1000_DEV_ID_82572EI_FIBER       0x107E
 #define E1000_DEV_ID_82572EI_SERDES      0x107F
index f48b659e0c2bd3dbdfbb6015ad22acdd5f876951..4a225950fb43f6cbe30feff14945857305825dbe 100644 (file)
@@ -100,6 +100,7 @@ static struct pci_device_id e1000_pci_tbl[] = {
        INTEL_E1000_ETHERNET_DEVICE(0x1099),
        INTEL_E1000_ETHERNET_DEVICE(0x109A),
        INTEL_E1000_ETHERNET_DEVICE(0x10A4),
+       INTEL_E1000_ETHERNET_DEVICE(0x10A5),
        INTEL_E1000_ETHERNET_DEVICE(0x10B5),
        INTEL_E1000_ETHERNET_DEVICE(0x10B9),
        INTEL_E1000_ETHERNET_DEVICE(0x10BA),
@@ -107,6 +108,8 @@ static struct pci_device_id e1000_pci_tbl[] = {
        INTEL_E1000_ETHERNET_DEVICE(0x10BC),
        INTEL_E1000_ETHERNET_DEVICE(0x10C4),
        INTEL_E1000_ETHERNET_DEVICE(0x10C5),
+       INTEL_E1000_ETHERNET_DEVICE(0x10D9),
+       INTEL_E1000_ETHERNET_DEVICE(0x10DA),
        /* required last entry */
        {0,}
 };
@@ -1096,6 +1099,7 @@ e1000_probe(struct pci_dev *pdev,
                break;
        case E1000_DEV_ID_82546GB_QUAD_COPPER_KSP3:
        case E1000_DEV_ID_82571EB_QUAD_COPPER:
+       case E1000_DEV_ID_82571EB_QUAD_FIBER:
        case E1000_DEV_ID_82571EB_QUAD_COPPER_LOWPROFILE:
                /* if quad port adapter, disable WoL on all but port A */
                if (global_quad_port_a != 0)
index 8ee2c2c86b423ce74bfe9e924da508cb38675672..d67f97bfa3a442b6d93f6938e5c5fc1d2f8fa249 100644 (file)
@@ -39,7 +39,7 @@
 #include <asm/io.h>
 
 #define DRV_NAME       "ehea"
-#define DRV_VERSION    "EHEA_0072"
+#define DRV_VERSION    "EHEA_0073"
 
 /* eHEA capability flags */
 #define DLPAR_PORT_ADD_REM 1
index 58702f54c3fbed67ce311cf3290487f73f46910a..9756211e83cef666cd244f1f7c330d2810d31b33 100644 (file)
@@ -1326,7 +1326,6 @@ static void write_swqe2_TSO(struct sk_buff *skb,
        u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
        int skb_data_size = skb->len - skb->data_len;
        int headersize;
-       u64 tmp_addr;
 
        /* Packet is TCP with TSO enabled */
        swqe->tx_control |= EHEA_SWQE_TSO;
@@ -1347,9 +1346,8 @@ static void write_swqe2_TSO(struct sk_buff *skb,
                        /* set sg1entry data */
                        sg1entry->l_key = lkey;
                        sg1entry->len = skb_data_size - headersize;
-
-                       tmp_addr = (u64)(skb->data + headersize);
-                       sg1entry->vaddr = ehea_map_vaddr(tmp_addr);
+                       sg1entry->vaddr =
+                               ehea_map_vaddr(skb->data + headersize);
                        swqe->descriptors++;
                }
        } else
@@ -1362,7 +1360,6 @@ static void write_swqe2_nonTSO(struct sk_buff *skb,
        int skb_data_size = skb->len - skb->data_len;
        u8 *imm_data = &swqe->u.immdata_desc.immediate_data[0];
        struct ehea_vsgentry *sg1entry = &swqe->u.immdata_desc.sg_entry;
-       u64 tmp_addr;
 
        /* Packet is any nonTSO type
         *
@@ -1379,8 +1376,8 @@ static void write_swqe2_nonTSO(struct sk_buff *skb,
                        /* copy sg1entry data */
                        sg1entry->l_key = lkey;
                        sg1entry->len = skb_data_size - SWQE2_MAX_IMM;
-                       tmp_addr = (u64)(skb->data + SWQE2_MAX_IMM);
-                       sg1entry->vaddr = ehea_map_vaddr(tmp_addr);
+                       sg1entry->vaddr =
+                               ehea_map_vaddr(skb->data + SWQE2_MAX_IMM);
                        swqe->descriptors++;
                }
        } else {
@@ -1395,7 +1392,6 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
        struct ehea_vsgentry *sg_list, *sg1entry, *sgentry;
        skb_frag_t *frag;
        int nfrags, sg1entry_contains_frag_data, i;
-       u64 tmp_addr;
 
        nfrags = skb_shinfo(skb)->nr_frags;
        sg1entry = &swqe->u.immdata_desc.sg_entry;
@@ -1417,9 +1413,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
                        /* copy sg1entry data */
                        sg1entry->l_key = lkey;
                        sg1entry->len = frag->size;
-                       tmp_addr =  (u64)(page_address(frag->page)
-                                         + frag->page_offset);
-                       sg1entry->vaddr = ehea_map_vaddr(tmp_addr);
+                       sg1entry->vaddr =
+                               ehea_map_vaddr(page_address(frag->page)
+                                              + frag->page_offset);
                        swqe->descriptors++;
                        sg1entry_contains_frag_data = 1;
                }
@@ -1431,10 +1427,9 @@ static inline void write_swqe2_data(struct sk_buff *skb, struct net_device *dev,
 
                        sgentry->l_key = lkey;
                        sgentry->len = frag->size;
-
-                       tmp_addr = (u64)(page_address(frag->page)
-                                        + frag->page_offset);
-                       sgentry->vaddr = ehea_map_vaddr(tmp_addr);
+                       sgentry->vaddr =
+                               ehea_map_vaddr(page_address(frag->page)
+                                              + frag->page_offset);
                        swqe->descriptors++;
                }
        }
@@ -2165,24 +2160,18 @@ static int ehea_clean_all_portres(struct ehea_port *port)
        return ret;
 }
 
-static void ehea_remove_adapter_mr (struct ehea_adapter *adapter)
+static void ehea_remove_adapter_mr(struct ehea_adapter *adapter)
 {
-       int i;
-
-       for (i=0; i < EHEA_MAX_PORTS; i++)
-               if (adapter->port[i])
-                       return;
+       if (adapter->active_ports)
+               return;
 
        ehea_rem_mr(&adapter->mr);
 }
 
-static int ehea_add_adapter_mr (struct ehea_adapter *adapter)
+static int ehea_add_adapter_mr(struct ehea_adapter *adapter)
 {
-       int i;
-
-       for (i=0; i < EHEA_MAX_PORTS; i++)
-               if (adapter->port[i])
-                       return 0;
+       if (adapter->active_ports)
+               return 0;
 
        return ehea_reg_kernel_mr(adapter, &adapter->mr);
 }
@@ -3099,6 +3088,7 @@ out:
 
 static void __exit ehea_module_exit(void)
 {
+       destroy_workqueue(ehea_driver_wq);
        driver_remove_file(&ehea_driver.driver, &driver_attr_capabilities);
        ibmebus_unregister_driver(&ehea_driver);
        ehea_destroy_busmap();
index 03023dd17829da101765112c4b7ef6054e4a9325..4e8df910c00d0705a503ee4441cd0df2233e9c4b 100644 (file)
@@ -47,6 +47,7 @@
 #include <asm/uaccess.h>
 #include <asm/io.h>
 #include <asm/pgtable.h>
+#include <asm/cacheflush.h>
 
 #if defined(CONFIG_M523x) || defined(CONFIG_M527x) || \
     defined(CONFIG_M5272) || defined(CONFIG_M528x) || \
@@ -98,8 +99,6 @@ static unsigned char  fec_mac_default[] = {
 #define        FEC_FLASHMAC    0xf0006006
 #elif defined(CONFIG_GILBARCONAP) || defined(CONFIG_SCALES)
 #define        FEC_FLASHMAC    0xf0006000
-#elif defined (CONFIG_MTD_KeyTechnology)
-#define        FEC_FLASHMAC    0xffe04000
 #elif defined(CONFIG_CANCam)
 #define        FEC_FLASHMAC    0xf0020000
 #elif defined (CONFIG_M5272C3)
@@ -191,6 +190,8 @@ struct fec_enet_private {
        /* Hardware registers of the FEC device */
        volatile fec_t  *hwp;
 
+       struct net_device *netdev;
+
        /* The saved address of a sent-in-place packet/buffer, for skfree(). */
        unsigned char *tx_bounce[TX_RING_SIZE];
        struct  sk_buff* tx_skbuff[TX_RING_SIZE];
@@ -1269,7 +1270,7 @@ static void __inline__ fec_request_intrs(struct net_device *dev)
        icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR3);
        *icrp = 0x00000ddd;
        icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
-       *icrp = (*icrp & 0x70777777) | 0x0d000000;
+       *icrp = 0x0d000000;
 }
 
 static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
@@ -1331,7 +1332,7 @@ static void __inline__ fec_disable_phy_intr(void)
 {
        volatile unsigned long *icrp;
        icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
-       *icrp = (*icrp & 0x70777777) | 0x08000000;
+       *icrp = 0x08000000;
 }
 
 static void __inline__ fec_phy_ack_intr(void)
@@ -1339,7 +1340,7 @@ static void __inline__ fec_phy_ack_intr(void)
        volatile unsigned long *icrp;
        /* Acknowledge the interrupt */
        icrp = (volatile unsigned long *) (MCF_MBAR + MCFSIM_ICR1);
-       *icrp = (*icrp & 0x77777777) | 0x08000000;
+       *icrp = 0x0d000000;
 }
 
 static void __inline__ fec_localhw_setup(void)
@@ -1426,6 +1427,29 @@ static void __inline__ fec_request_intrs(struct net_device *dev)
                *gpio_pehlpar = 0xc0;
        }
 #endif
+
+#if defined(CONFIG_M527x)
+       /* Set up gpio outputs for MII lines */
+       {
+               volatile u8 *gpio_par_fec;
+               volatile u16 *gpio_par_feci2c;
+
+               gpio_par_feci2c = (volatile u16 *)(MCF_IPSBAR + 0x100082);
+               /* Set up gpio outputs for FEC0 MII lines */
+               gpio_par_fec = (volatile u8 *)(MCF_IPSBAR + 0x100078);
+
+               *gpio_par_feci2c |= 0x0f00;
+               *gpio_par_fec |= 0xc0;
+
+#if defined(CONFIG_FEC2)
+               /* Set up gpio outputs for FEC1 MII lines */
+               gpio_par_fec = (volatile u8 *)(MCF_IPSBAR + 0x100079);
+
+               *gpio_par_feci2c |= 0x00a0;
+               *gpio_par_fec |= 0xc0;
+#endif /* CONFIG_FEC2 */
+       }
+#endif /* CONFIG_M527x */
 }
 
 static void __inline__ fec_set_mii(struct net_device *dev, struct fec_enet_private *fep)
@@ -1940,9 +1964,10 @@ static void mii_display_status(struct net_device *dev)
        printk(".\n");
 }
 
-static void mii_display_config(struct net_device *dev)
+static void mii_display_config(struct work_struct *work)
 {
-       struct fec_enet_private *fep = netdev_priv(dev);
+       struct fec_enet_private *fep = container_of(work, struct fec_enet_private, phy_task);
+       struct net_device *dev = fep->netdev;
        uint status = fep->phy_status;
 
        /*
@@ -1976,9 +2001,10 @@ static void mii_display_config(struct net_device *dev)
        fep->sequence_done = 1;
 }
 
-static void mii_relink(struct net_device *dev)
+static void mii_relink(struct work_struct *work)
 {
-       struct fec_enet_private *fep = netdev_priv(dev);
+       struct fec_enet_private *fep = container_of(work, struct fec_enet_private, phy_task);
+       struct net_device *dev = fep->netdev;
        int duplex;
 
        /*
@@ -2022,7 +2048,7 @@ static void mii_queue_relink(uint mii_reg, struct net_device *dev)
                return;
 
        fep->mii_phy_task_queued = 1;
-       INIT_WORK(&fep->phy_task, (void*)mii_relink, dev);
+       INIT_WORK(&fep->phy_task, mii_relink);
        schedule_work(&fep->phy_task);
 }
 
@@ -2035,7 +2061,7 @@ static void mii_queue_config(uint mii_reg, struct net_device *dev)
                return;
 
        fep->mii_phy_task_queued = 1;
-       INIT_WORK(&fep->phy_task, (void*)mii_display_config, dev);
+       INIT_WORK(&fep->phy_task, mii_display_config);
        schedule_work(&fep->phy_task);
 }
 
@@ -2330,6 +2356,7 @@ int __init fec_enet_init(struct net_device *dev)
 
        fep->index = index;
        fep->hwp = fecp;
+       fep->netdev = dev;
 
        /* Whack a reset.  We should wait for this.
        */
index 661c747389e47fc53dff900eef525bb3687376c7..69f5f365239a2ec261052c851b5a4387a51bfbe1 100644 (file)
 #define DEV_HAS_STATISTICS_V2   0x0800  /* device supports hw statistics version 2 */
 #define DEV_HAS_TEST_EXTENDED   0x1000  /* device supports extended diagnostic test */
 #define DEV_HAS_MGMT_UNIT       0x2000  /* device supports management unit */
+#define DEV_HAS_CORRECT_MACADDR 0x4000  /* device supports correct mac address order */
 
 enum {
        NvRegIrqStatus = 0x000,
@@ -4706,7 +4707,6 @@ static const struct ethtool_ops ops = {
        .get_regs_len = nv_get_regs_len,
        .get_regs = nv_get_regs,
        .nway_reset = nv_nway_reset,
-       .get_perm_addr = ethtool_op_get_perm_addr,
        .get_tso = ethtool_op_get_tso,
        .set_tso = nv_set_tso,
        .get_ringparam = nv_get_ringparam,
@@ -5172,7 +5172,8 @@ static int __devinit nv_probe(struct pci_dev *pci_dev, const struct pci_device_i
 
        /* check the workaround bit for correct mac address order */
        txreg = readl(base + NvRegTransmitPoll);
-       if (txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) {
+       if ((txreg & NVREG_TRANSMITPOLL_MAC_ADDR_REV) ||
+           (id->driver_data & DEV_HAS_CORRECT_MACADDR)) {
                /* mac address is already in correct order */
                dev->dev_addr[0] = (np->orig_mac[0] >>  0) & 0xff;
                dev->dev_addr[1] = (np->orig_mac[0] >>  8) & 0xff;
@@ -5500,67 +5501,67 @@ static struct pci_device_id pci_tbl[] = {
        },
        {       /* MCP61 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_16),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP61 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_17),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP61 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_18),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP61 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_19),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP65 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_20),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP65 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_21),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP65 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_22),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP65 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_23),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_LARGEDESC|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP67 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_24),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP67 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_25),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP67 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_26),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP67 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_27),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP73 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_28),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP73 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_29),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP73 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_30),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {       /* MCP73 Ethernet Controller */
                PCI_DEVICE(PCI_VENDOR_ID_NVIDIA, PCI_DEVICE_ID_NVIDIA_NVENET_31),
-               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT,
+               .driver_data = DEV_NEED_TIMERIRQ|DEV_NEED_LINKTIMER|DEV_HAS_HIGH_DMA|DEV_HAS_POWER_CNTRL|DEV_HAS_MSI|DEV_HAS_PAUSEFRAME_TX|DEV_HAS_STATISTICS_V2|DEV_HAS_TEST_EXTENDED|DEV_HAS_MGMT_UNIT|DEV_HAS_CORRECT_MACADDR,
        },
        {0,},
 };
index ac3596f45dd86e5ba3b1b4f7678151578777cfc8..100bf410bf5fdf655446798073c53dfed60929ff 100644 (file)
@@ -245,7 +245,7 @@ int __init gfar_mdio_init(void)
        return driver_register(&gianfar_mdio_driver);
 }
 
-void __exit gfar_mdio_exit(void)
+void gfar_mdio_exit(void)
 {
        driver_unregister(&gianfar_mdio_driver);
 }
index 5d3400469514afe0a99f2e38c615ffcf3de97aaa..b373091c703184f78ad7d1cfa6ffa58e3d702631 100644 (file)
@@ -42,5 +42,5 @@ struct gfar_mii {
 int gfar_mdio_read(struct mii_bus *bus, int mii_id, int regnum);
 int gfar_mdio_write(struct mii_bus *bus, int mii_id, int regnum, u16 value);
 int __init gfar_mdio_init(void);
-void __exit gfar_mdio_exit(void);
+void gfar_mdio_exit(void);
 #endif /* GIANFAR_PHY_H */
index 656f2789c9ba03585866ba490f3ab1c11a306c98..cc0ee93669eac11c4c4cad1d99c611889c866da4 100644 (file)
@@ -413,12 +413,12 @@ static void *bpq_seq_next(struct seq_file *seq, void *v, loff_t *pos)
        ++*pos;
 
        if (v == SEQ_START_TOKEN)
-               p = bpq_devices.next;
+               p = rcu_dereference(bpq_devices.next);
        else
-               p = ((struct bpqdev *)v)->bpq_list.next;
+               p = rcu_dereference(((struct bpqdev *)v)->bpq_list.next);
 
        return (p == &bpq_devices) ? NULL 
-               : rcu_dereference(list_entry(p, struct bpqdev, bpq_list));
+               : list_entry(p, struct bpqdev, bpq_list);
 }
 
 static void bpq_seq_stop(struct seq_file *seq, void *v)
index d96eb72295488fe486136df191a3a0f8c8b6b96d..acba90f1638e7596edc6fe7e14bc11240f029197 100644 (file)
@@ -963,7 +963,7 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
 {
        int rc, i;
        struct net_device *netdev;
-       struct ibmveth_adapter *adapter = NULL;
+       struct ibmveth_adapter *adapter;
 
        unsigned char *mac_addr_p;
        unsigned int *mcastFilterSize_p;
@@ -997,7 +997,6 @@ static int __devinit ibmveth_probe(struct vio_dev *dev, const struct vio_device_
        SET_MODULE_OWNER(netdev);
 
        adapter = netdev->priv;
-       memset(adapter, 0, sizeof(adapter));
        dev->dev.driver_data = netdev;
 
        adapter->vdev = dev;
@@ -1280,24 +1279,28 @@ const char * buf, size_t count)
                        int i;
                        /* Make sure there is a buffer pool with buffers that
                           can hold a packet of the size of the MTU */
-                       for(i = 0; i<IbmVethNumBufferPools; i++) {
+                       for (i = 0; i < IbmVethNumBufferPools; i++) {
                                if (pool == &adapter->rx_buff_pool[i])
                                        continue;
                                if (!adapter->rx_buff_pool[i].active)
                                        continue;
-                               if (mtu < adapter->rx_buff_pool[i].buff_size) {
-                                       pool->active = 0;
-                                       h_free_logical_lan_buffer(adapter->
-                                                                 vdev->
-                                                                 unit_address,
-                                                                 pool->
-                                                                 buff_size);
-                               }
+                               if (mtu <= adapter->rx_buff_pool[i].buff_size)
+                                       break;
                        }
-                       if (pool->active) {
+
+                       if (i == IbmVethNumBufferPools) {
                                ibmveth_error_printk("no active pool >= MTU\n");
                                return -EPERM;
                        }
+
+                       pool->active = 0;
+                       if (netif_running(netdev)) {
+                               adapter->pool_config = 1;
+                               ibmveth_close(netdev);
+                               adapter->pool_config = 0;
+                               if ((rc = ibmveth_open(netdev)))
+                                       return rc;
+                       }
                }
        } else if (attr == &veth_num_attr) {
                if (value <= 0 || value > IBMVETH_MAX_POOL_COUNT)
index bb69ccae8aceaac5b478efb24fa94f1516b366ae..72cc15a6cab745b3a2a273b6be7e4d085bfd08cb 100644 (file)
@@ -73,9 +73,6 @@ static inline long h_send_logical_lan(unsigned long unit_address,
 #define h_change_logical_lan_mac(ua, mac) \
   plpar_hcall_norets(H_CHANGE_LOGICAL_LAN_MAC, ua, mac)
 
-#define h_free_logical_lan_buffer(ua, bufsize) \
-  plpar_hcall_norets(H_FREE_LOGICAL_LAN_BUFFER, ua, bufsize)
-
 #define IbmVethNumBufferPools 5
 #define IBMVETH_BUFF_OH 22 /* Overhead: 14 ethernet header + 8 opaque handle */
 #define IBMVETH_MAX_MTU 68
index 0ac240ca905b8504d7a9524e532c0a6f5e504608..3b0fd83fa26634351695b3f98e68a550c83d5701 100644 (file)
@@ -1561,10 +1561,9 @@ static inline struct irda_class_desc *irda_usb_find_class_desc(struct usb_interf
        struct irda_class_desc *desc;
        int ret;
 
-       desc = kmalloc(sizeof (*desc), GFP_KERNEL);
-       if (desc == NULL) 
+       desc = kzalloc(sizeof(*desc), GFP_KERNEL);
+       if (!desc)
                return NULL;
-       memset(desc, 0, sizeof(*desc));
 
        /* USB-IrDA class spec 1.0:
         *      6.1.3: Standard "Get Descriptor" Device Request is not
@@ -1617,7 +1616,7 @@ static int irda_usb_probe(struct usb_interface *intf,
 {
        struct net_device *net;
        struct usb_device *dev = interface_to_usbdev(intf);
-       struct irda_usb_cb *self = NULL;
+       struct irda_usb_cb *self;
        struct usb_host_interface *interface;
        struct irda_class_desc *irda_desc;
        int ret = -ENOMEM;
@@ -1655,7 +1654,7 @@ static int irda_usb_probe(struct usb_interface *intf,
                self->header_length = USB_IRDA_HEADER;
        }
 
-       self->rx_urb = kzalloc(self->max_rx_urb * sizeof(struct urb *),
+       self->rx_urb = kcalloc(self->max_rx_urb, sizeof(struct urb *),
                                GFP_KERNEL);
 
        for (i = 0; i < self->max_rx_urb; i++) {
@@ -1715,7 +1714,7 @@ static int irda_usb_probe(struct usb_interface *intf,
        /* Find IrDA class descriptor */
        irda_desc = irda_usb_find_class_desc(intf);
        ret = -ENODEV;
-       if (irda_desc == NULL)
+       if (!irda_desc)
                goto err_out_3;
 
        if (self->needspatch) {
@@ -1738,15 +1737,13 @@ static int irda_usb_probe(struct usb_interface *intf,
        /* Don't change this buffer size and allocation without doing
         * some heavy and complete testing. Don't ask why :-(
         * Jean II */
-       self->speed_buff = kmalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
-       if (self->speed_buff == NULL) 
+       self->speed_buff = kzalloc(IRDA_USB_SPEED_MTU, GFP_KERNEL);
+       if (!self->speed_buff)
                goto err_out_3;
 
-       memset(self->speed_buff, 0, IRDA_USB_SPEED_MTU);
-
        self->tx_buff = kzalloc(IRDA_SKB_MAX_MTU + self->header_length,
                                GFP_KERNEL);
-       if (self->tx_buff == NULL)
+       if (!self->tx_buff)
                goto err_out_4;
 
        ret = irda_usb_open(self);
@@ -1767,12 +1764,11 @@ static int irda_usb_probe(struct usb_interface *intf,
 
                /* replace IrDA class descriptor with what patched device is now reporting */
                irda_desc = irda_usb_find_class_desc (self->usbintf);
-               if (irda_desc == NULL) {
+               if (!irda_desc) {
                        ret = -ENODEV;
                        goto err_out_6;
                }
-               if (self->irda_desc)
-                       kfree (self->irda_desc);
+               kfree(self->irda_desc);
                self->irda_desc = irda_desc;
                irda_usb_init_qos(self);
        }
index afde84868bea71376da126670765a68143074558..0413cd95eda7b28d0a273e82ff2b6b6758b9f89e 100644 (file)
@@ -724,7 +724,6 @@ static const struct ethtool_ops ixgb_ethtool_ops = {
        .phys_id = ixgb_phys_id,
        .get_stats_count = ixgb_get_stats_count,
        .get_ethtool_stats = ixgb_get_ethtool_stats,
-       .get_perm_addr = ethtool_op_get_perm_addr,
 };
 
 void ixgb_set_ethtool_ops(struct net_device *netdev)
index 112778652f7d8986345a439ab5e7f46815af1369..cab57911a80e041e1f7b536324f1c56de6a44c19 100644 (file)
@@ -1,6 +1,13 @@
-/* A simple network driver for lguest.
+/*D:500
+ * The Guest network driver.
  *
- * Copyright 2006 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
+ * This is very simple a virtual network driver, and our last Guest driver.
+ * The only trick is that it can talk directly to multiple other recipients
+ * (ie. other Guests on the same network).  It can also be used with only the
+ * Host on the network.
+ :*/
+
+/* Copyright 2006 Rusty Russell <rusty@rustcorp.com.au> IBM Corporation
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
 #define MAX_LANS               4
 #define NUM_SKBS               8
 
+/*M:011 Network code master Jeff Garzik points out numerous shortcomings in
+ * this driver if it aspires to greatness.
+ *
+ * Firstly, it doesn't use "NAPI": the networking's New API, and is poorer for
+ * it.  As he says "NAPI means system-wide load leveling, across multiple
+ * network interfaces.  Lack of NAPI can mean competition at higher loads."
+ *
+ * He also points out that we don't implement set_mac_address, so users cannot
+ * change the devices hardware address.  When I asked why one would want to:
+ * "Bonding, and situations where you /do/ want the MAC address to "leak" out
+ * of the host onto the wider net."
+ *
+ * Finally, he would like module unloading: "It is not unrealistic to think of
+ * [un|re|]loading the net support module in an lguest guest.  And, adding
+ * module support makes the programmer more responsible, because they now have
+ * to learn to clean up after themselves.  Any driver that cannot clean up
+ * after itself is an incomplete driver in my book."
+ :*/
+
+/*D:530 The "struct lguestnet_info" contains all the information we need to
+ * know about the network device. */
 struct lguestnet_info
 {
-       /* The shared page(s). */
+       /* The mapped device page(s) (an array of "struct lguest_net"). */
        struct lguest_net *peer;
+       /* The physical address of the device page(s) */
        unsigned long peer_phys;
+       /* The size of the device page(s). */
        unsigned long mapsize;
 
        /* The lguest_device I come from */
        struct lguest_device *lgdev;
 
-       /* My peerid. */
+       /* My peerid (ie. my slot in the array). */
        unsigned int me;
 
-       /* Receive queue. */
+       /* Receive queue: the network packets waiting to be filled. */
        struct sk_buff *skb[NUM_SKBS];
        struct lguest_dma dma[NUM_SKBS];
 };
+/*:*/
 
 /* How many bytes left in this page. */
 static unsigned int rest_of_page(void *data)
@@ -52,39 +83,82 @@ static unsigned int rest_of_page(void *data)
        return PAGE_SIZE - ((unsigned long)data % PAGE_SIZE);
 }
 
-/* Simple convention: offset 4 * peernum. */
+/*D:570 Each peer (ie. Guest or Host) on the network binds their receive
+ * buffers to a different key: we simply use the physical address of the
+ * device's memory page plus the peer number.  The Host insists that all keys
+ * be a multiple of 4, so we multiply the peer number by 4. */
 static unsigned long peer_key(struct lguestnet_info *info, unsigned peernum)
 {
        return info->peer_phys + 4 * peernum;
 }
 
+/* This is the routine which sets up a "struct lguest_dma" to point to a
+ * network packet, similar to req_to_dma() in lguest_blk.c.  The structure of a
+ * "struct sk_buff" has grown complex over the years: it consists of a "head"
+ * linear section pointed to by "skb->data", and possibly an array of
+ * "fragments" in the case of a non-linear packet.
+ *
+ * Our receive buffers don't use fragments at all but outgoing skbs might, so
+ * we handle it. */
 static void skb_to_dma(const struct sk_buff *skb, unsigned int headlen,
                       struct lguest_dma *dma)
 {
        unsigned int i, seg;
 
+       /* First, we put the linear region into the "struct lguest_dma".  Each
+        * entry can't go over a page boundary, so even though all our packets
+        * are 1514 bytes or less, we might need to use two entries here: */
        for (i = seg = 0; i < headlen; seg++, i += rest_of_page(skb->data+i)) {
                dma->addr[seg] = virt_to_phys(skb->data + i);
                dma->len[seg] = min((unsigned)(headlen - i),
                                    rest_of_page(skb->data + i));
        }
+
+       /* Now we handle the fragments: at least they're guaranteed not to go
+        * over a page.  skb_shinfo(skb) returns a pointer to the structure
+        * which tells us about the number of fragments and the fragment
+        * array. */
        for (i = 0; i < skb_shinfo(skb)->nr_frags; i++, seg++) {
                const skb_frag_t *f = &skb_shinfo(skb)->frags[i];
                /* Should not happen with MTU less than 64k - 2 * PAGE_SIZE. */
                if (seg == LGUEST_MAX_DMA_SECTIONS) {
+                       /* We will end up sending a truncated packet should
+                        * this ever happen.  Plus, a cool log message! */
                        printk("Woah dude!  Megapacket!\n");
                        break;
                }
                dma->addr[seg] = page_to_phys(f->page) + f->page_offset;
                dma->len[seg] = f->size;
        }
+
+       /* If after all that we didn't use the entire "struct lguest_dma"
+        * array, we terminate it with a 0 length. */
        if (seg < LGUEST_MAX_DMA_SECTIONS)
                dma->len[seg] = 0;
 }
 
-/* We overload multicast bit to show promiscuous mode. */
+/*
+ * Packet transmission.
+ *
+ * Our packet transmission is a little unusual.  A real network card would just
+ * send out the packet and leave the receivers to decide if they're interested.
+ * Instead, we look through the network device memory page and see if any of
+ * the ethernet addresses match the packet destination, and if so we send it to
+ * that Guest.
+ *
+ * This is made a little more complicated in two cases.  The first case is
+ * broadcast packets: for that we send the packet to all Guests on the network,
+ * one at a time.  The second case is "promiscuous" mode, where a Guest wants
+ * to see all the packets on the network.  We need a way for the Guest to tell
+ * us it wants to see all packets, so it sets the "multicast" bit on its
+ * published MAC address, which is never valid in a real ethernet address.
+ */
 #define PROMISC_BIT            0x01
 
+/* This is the callback which is summoned whenever the network device's
+ * multicast or promiscuous state changes.  If the card is in promiscuous mode,
+ * we advertise that in our ethernet address in the device's memory.  We do the
+ * same if Linux wants any or all multicast traffic.  */
 static void lguestnet_set_multicast(struct net_device *dev)
 {
        struct lguestnet_info *info = netdev_priv(dev);
@@ -95,11 +169,14 @@ static void lguestnet_set_multicast(struct net_device *dev)
                info->peer[info->me].mac[0] &= ~PROMISC_BIT;
 }
 
+/* A simple test function to see if a peer wants to see all packets.*/
 static int promisc(struct lguestnet_info *info, unsigned int peer)
 {
        return info->peer[peer].mac[0] & PROMISC_BIT;
 }
 
+/* Another simple function to see if a peer's advertised ethernet address
+ * matches a packet's destination ethernet address. */
 static int mac_eq(const unsigned char mac[ETH_ALEN],
                  struct lguestnet_info *info, unsigned int peer)
 {
@@ -109,6 +186,8 @@ static int mac_eq(const unsigned char mac[ETH_ALEN],
        return memcmp(mac+1, info->peer[peer].mac+1, ETH_ALEN-1) == 0;
 }
 
+/* This is the function which actually sends a packet once we've decided a
+ * peer wants it: */
 static void transfer_packet(struct net_device *dev,
                            struct sk_buff *skb,
                            unsigned int peernum)
@@ -116,76 +195,134 @@ static void transfer_packet(struct net_device *dev,
        struct lguestnet_info *info = netdev_priv(dev);
        struct lguest_dma dma;
 
+       /* We use our handy "struct lguest_dma" packing function to prepare
+        * the skb for sending. */
        skb_to_dma(skb, skb_headlen(skb), &dma);
        pr_debug("xfer length %04x (%u)\n", htons(skb->len), skb->len);
 
+       /* This is the actual send call which copies the packet. */
        lguest_send_dma(peer_key(info, peernum), &dma);
+
+       /* Check that the entire packet was transmitted.  If not, it could mean
+        * that the other Guest registered a short receive buffer, but this
+        * driver should never do that.  More likely, the peer is dead. */
        if (dma.used_len != skb->len) {
                dev->stats.tx_carrier_errors++;
                pr_debug("Bad xfer to peer %i: %i of %i (dma %p/%i)\n",
                         peernum, dma.used_len, skb->len,
                         (void *)dma.addr[0], dma.len[0]);
        } else {
+               /* On success we update the stats. */
                dev->stats.tx_bytes += skb->len;
                dev->stats.tx_packets++;
        }
 }
 
+/* Another helper function to tell is if a slot in the device memory is unused.
+ * Since we always set the Local Assignment bit in the ethernet address, the
+ * first byte can never be 0. */
 static int unused_peer(const struct lguest_net peer[], unsigned int num)
 {
        return peer[num].mac[0] == 0;
 }
 
+/* Finally, here is the routine which handles an outgoing packet.  It's called
+ * "start_xmit" for traditional reasons. */
 static int lguestnet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        unsigned int i;
        int broadcast;
        struct lguestnet_info *info = netdev_priv(dev);
+       /* Extract the destination ethernet address from the packet. */
        const unsigned char *dest = ((struct ethhdr *)skb->data)->h_dest;
 
        pr_debug("%s: xmit %02x:%02x:%02x:%02x:%02x:%02x\n",
                 dev->name, dest[0],dest[1],dest[2],dest[3],dest[4],dest[5]);
 
+       /* If it's a multicast packet, we broadcast to everyone.  That's not
+        * very efficient, but there are very few applications which actually
+        * use multicast, which is a shame really.
+        *
+        * As etherdevice.h points out: "By definition the broadcast address is
+        * also a multicast address."  So we don't have to test for broadcast
+        * packets separately. */
        broadcast = is_multicast_ether_addr(dest);
+
+       /* Look through all the published ethernet addresses to see if we
+        * should send this packet. */
        for (i = 0; i < info->mapsize/sizeof(struct lguest_net); i++) {
+               /* We don't send to ourselves (we actually can't SEND_DMA to
+                * ourselves anyway), and don't send to unused slots.*/
                if (i == info->me || unused_peer(info->peer, i))
                        continue;
 
+               /* If it's broadcast we send it.  If they want every packet we
+                * send it.  If the destination matches their address we send
+                * it.  Otherwise we go to the next peer. */
                if (!broadcast && !promisc(info, i) && !mac_eq(dest, info, i))
                        continue;
 
                pr_debug("lguestnet %s: sending from %i to %i\n",
                         dev->name, info->me, i);
+               /* Our routine which actually does the transfer. */
                transfer_packet(dev, skb, i);
        }
+
+       /* An xmit routine is expected to dispose of the packet, so we do. */
        dev_kfree_skb(skb);
+
+       /* As per kernel convention, 0 means success.  This is why I love
+        * networking: even if we never sent to anyone, that's still
+        * success! */
        return 0;
 }
 
-/* Find a new skb to put in this slot in shared mem. */
+/*D:560
+ * Packet receiving.
+ *
+ * First, here's a helper routine which fills one of our array of receive
+ * buffers: */
 static int fill_slot(struct net_device *dev, unsigned int slot)
 {
        struct lguestnet_info *info = netdev_priv(dev);
-       /* Try to create and register a new one. */
+
+       /* We can receive ETH_DATA_LEN (1500) byte packets, plus a standard
+        * ethernet header of ETH_HLEN (14) bytes. */
        info->skb[slot] = netdev_alloc_skb(dev, ETH_HLEN + ETH_DATA_LEN);
        if (!info->skb[slot]) {
                printk("%s: could not fill slot %i\n", dev->name, slot);
                return -ENOMEM;
        }
 
+       /* skb_to_dma() is a helper which sets up the "struct lguest_dma" to
+        * point to the data in the skb: we also use it for sending out a
+        * packet. */
        skb_to_dma(info->skb[slot], ETH_HLEN + ETH_DATA_LEN, &info->dma[slot]);
+
+       /* This is a Write Memory Barrier: it ensures that the entry in the
+        * receive buffer array is written *before* we set the "used_len" entry
+        * to 0.  If the Host were looking at the receive buffer array from a
+        * different CPU, it could potentially see "used_len = 0" and not see
+        * the updated receive buffer information.  This would be a horribly
+        * nasty bug, so make sure the compiler and CPU know this has to happen
+        * first. */
        wmb();
-       /* Now we tell hypervisor it can use the slot. */
+       /* Writing 0 to "used_len" tells the Host it can use this receive
+        * buffer now. */
        info->dma[slot].used_len = 0;
        return 0;
 }
 
+/* This is the actual receive routine.  When we receive an interrupt from the
+ * Host to tell us a packet has been delivered, we arrive here: */
 static irqreturn_t lguestnet_rcv(int irq, void *dev_id)
 {
        struct net_device *dev = dev_id;
        struct lguestnet_info *info = netdev_priv(dev);
        unsigned int i, done = 0;
 
+       /* Look through our entire receive array for an entry which has data
+        * in it. */
        for (i = 0; i < ARRAY_SIZE(info->dma); i++) {
                unsigned int length;
                struct sk_buff *skb;
@@ -194,10 +331,16 @@ static irqreturn_t lguestnet_rcv(int irq, void *dev_id)
                if (length == 0)
                        continue;
 
+               /* We've found one!  Remember the skb (we grabbed the length
+                * above), and immediately refill the slot we've taken it
+                * from. */
                done++;
                skb = info->skb[i];
                fill_slot(dev, i);
 
+               /* This shouldn't happen: micropackets could be sent by a
+                * badly-behaved Guest on the network, but the Host will never
+                * stuff more data in the buffer than the buffer length. */
                if (length < ETH_HLEN || length > ETH_HLEN + ETH_DATA_LEN) {
                        pr_debug(KERN_WARNING "%s: unbelievable skb len: %i\n",
                                 dev->name, length);
@@ -205,36 +348,72 @@ static irqreturn_t lguestnet_rcv(int irq, void *dev_id)
                        continue;
                }
 
+               /* skb_put(), what a great function!  I've ranted about this
+                * function before (http://lkml.org/lkml/1999/9/26/24).  You
+                * call it after you've added data to the end of an skb (in
+                * this case, it was the Host which wrote the data). */
                skb_put(skb, length);
+
+               /* The ethernet header contains a protocol field: we use the
+                * standard helper to extract it, and place the result in
+                * skb->protocol.  The helper also sets up skb->pkt_type and
+                * eats up the ethernet header from the front of the packet. */
                skb->protocol = eth_type_trans(skb, dev);
-               /* This is a reliable transport. */
+
+               /* If this device doesn't need checksums for sending, we also
+                * don't need to check the packets when they come in. */
                if (dev->features & NETIF_F_NO_CSUM)
                        skb->ip_summed = CHECKSUM_UNNECESSARY;
+
+               /* As a last resort for debugging the driver or the lguest I/O
+                * subsystem, you can uncomment the "#define DEBUG" at the top
+                * of this file, which turns all the pr_debug() into printk()
+                * and floods the logs. */
                pr_debug("Receiving skb proto 0x%04x len %i type %i\n",
                         ntohs(skb->protocol), skb->len, skb->pkt_type);
 
+               /* Update the packet and byte counts (visible from ifconfig,
+                * and good for debugging). */
                dev->stats.rx_bytes += skb->len;
                dev->stats.rx_packets++;
+
+               /* Hand our fresh network packet into the stack's "network
+                * interface receive" routine.  That will free the packet
+                * itself when it's finished. */
                netif_rx(skb);
        }
+
+       /* If we found any packets, we assume the interrupt was for us. */
        return done ? IRQ_HANDLED : IRQ_NONE;
 }
 
+/*D:550 This is where we start: when the device is brought up by dhcpd or
+ * ifconfig.  At this point we advertise our MAC address to the rest of the
+ * network, and register receive buffers ready for incoming packets. */
 static int lguestnet_open(struct net_device *dev)
 {
        int i;
        struct lguestnet_info *info = netdev_priv(dev);
 
-       /* Set up our MAC address */
+       /* Copy our MAC address into the device page, so others on the network
+        * can find us. */
        memcpy(info->peer[info->me].mac, dev->dev_addr, ETH_ALEN);
 
-       /* Turn on promisc mode if needed */
+       /* We might already be in promisc mode (dev->flags & IFF_PROMISC).  Our
+        * set_multicast callback handles this already, so we call it now. */
        lguestnet_set_multicast(dev);
 
+       /* Allocate packets and put them into our "struct lguest_dma" array.
+        * If we fail to allocate all the packets we could still limp along,
+        * but it's a sign of real stress so we should probably give up now. */
        for (i = 0; i < ARRAY_SIZE(info->dma); i++) {
                if (fill_slot(dev, i) != 0)
                        goto cleanup;
        }
+
+       /* Finally we tell the Host where our array of "struct lguest_dma"
+        * receive buffers is, binding it to the key corresponding to the
+        * device's physical memory plus our peerid. */
        if (lguest_bind_dma(peer_key(info,info->me), info->dma,
                            NUM_SKBS, lgdev_irq(info->lgdev)) != 0)
                goto cleanup;
@@ -245,22 +424,29 @@ cleanup:
                dev_kfree_skb(info->skb[i]);
        return -ENOMEM;
 }
+/*:*/
 
+/* The close routine is called when the device is no longer in use: we clean up
+ * elegantly. */
 static int lguestnet_close(struct net_device *dev)
 {
        unsigned int i;
        struct lguestnet_info *info = netdev_priv(dev);
 
-       /* Clear all trace: others might deliver packets, we'll ignore it. */
+       /* Clear all trace of our existence out of the device memory by setting
+        * the slot which held our MAC address to 0 (unused). */
        memset(&info->peer[info->me], 0, sizeof(info->peer[info->me]));
 
-       /* Deregister sg lists. */
+       /* Unregister our array of receive buffers */
        lguest_unbind_dma(peer_key(info, info->me), info->dma);
        for (i = 0; i < ARRAY_SIZE(info->dma); i++)
                dev_kfree_skb(info->skb[i]);
        return 0;
 }
 
+/*D:510 The network device probe function is basically a standard ethernet
+ * device setup.  It reads the "struct lguest_device_desc" and sets the "struct
+ * net_device".  Oh, the line-by-line excitement!  Let's skip over it. :*/
 static int lguestnet_probe(struct lguest_device *lgdev)
 {
        int err, irqf = IRQF_SHARED;
@@ -290,10 +476,16 @@ static int lguestnet_probe(struct lguest_device *lgdev)
        dev->stop = lguestnet_close;
        dev->hard_start_xmit = lguestnet_start_xmit;
 
-       /* Turning on/off promisc will call dev->set_multicast_list.
-        * We don't actually support multicast yet */
+       /* We don't actually support multicast yet, but turning on/off
+        * promisc also calls dev->set_multicast_list. */
        dev->set_multicast_list = lguestnet_set_multicast;
        SET_NETDEV_DEV(dev, &lgdev->dev);
+
+       /* The network code complains if you have "scatter-gather" capability
+        * if you don't also handle checksums (it seem that would be
+        * "illogical").  So we use a lie of omission and don't tell it that we
+        * can handle scattered packets unless we also don't want checksums,
+        * even though to us they're completely independent. */
        if (desc->features & LGUEST_NET_F_NOCSUM)
                dev->features = NETIF_F_SG|NETIF_F_NO_CSUM;
 
@@ -325,6 +517,9 @@ static int lguestnet_probe(struct lguest_device *lgdev)
        }
 
        pr_debug("lguestnet: registered device %s\n", dev->name);
+       /* Finally, we put the "struct net_device" in the generic "struct
+        * lguest_device"s private pointer.  Again, it's not necessary, but
+        * makes sure the cool kernel kids don't tease us. */
        lgdev->private = dev;
        return 0;
 
@@ -352,3 +547,11 @@ module_init(lguestnet_init);
 
 MODULE_DESCRIPTION("Lguest network driver");
 MODULE_LICENSE("GPL");
+
+/*D:580
+ * This is the last of the Drivers, and with this we have covered the many and
+ * wonderous and fine (and boring) details of the Guest.
+ *
+ * "make Launcher" beckons, where we answer questions like "Where do Guests
+ * come from?", and "What do you do when someone asks for optimization?"
+ */
index 5c86e737f954bee9f3fbc438e70f4cf615df5f96..c429a5002dd6c3116b343d2ab7e1100314a70d87 100644 (file)
@@ -143,6 +143,52 @@ static void __NS8390_init(struct net_device *dev, int startp);
  *     annoying the transmit function is called bh atomic. That places
  *     restrictions on the user context callers as disable_irq won't save
  *     them.
+ *
+ *     Additional explanation of problems with locking by Alan Cox:
+ *
+ *     "The author (me) didn't use spin_lock_irqsave because the slowness of the
+ *     card means that approach caused horrible problems like losing serial data
+ *     at 38400 baud on some chips. Rememeber many 8390 nics on PCI were ISA
+ *     chips with FPGA front ends.
+ *     
+ *     Ok the logic behind the 8390 is very simple:
+ *     
+ *     Things to know
+ *             - IRQ delivery is asynchronous to the PCI bus
+ *             - Blocking the local CPU IRQ via spin locks was too slow
+ *             - The chip has register windows needing locking work
+ *     
+ *     So the path was once (I say once as people appear to have changed it
+ *     in the mean time and it now looks rather bogus if the changes to use
+ *     disable_irq_nosync_irqsave are disabling the local IRQ)
+ *     
+ *     
+ *             Take the page lock
+ *             Mask the IRQ on chip
+ *             Disable the IRQ (but not mask locally- someone seems to have
+ *                     broken this with the lock validator stuff)
+ *                     [This must be _nosync as the page lock may otherwise
+ *                             deadlock us]
+ *             Drop the page lock and turn IRQs back on
+ *             
+ *             At this point an existing IRQ may still be running but we can't
+ *             get a new one
+ *     
+ *             Take the lock (so we know the IRQ has terminated) but don't mask
+ *     the IRQs on the processor
+ *             Set irqlock [for debug]
+ *     
+ *             Transmit (slow as ****)
+ *     
+ *             re-enable the IRQ
+ *     
+ *     
+ *     We have to use disable_irq because otherwise you will get delayed
+ *     interrupts on the APIC bus deadlocking the transmit path.
+ *     
+ *     Quite hairy but the chip simply wasn't designed for SMP and you can't
+ *     even ACK an interrupt without risking corrupting other parallel
+ *     activities on the chip." [lkml, 25 Jul 2007]
  */
 
 
@@ -219,15 +265,6 @@ static void ei_tx_timeout(struct net_device *dev)
        int txsr, isr, tickssofar = jiffies - dev->trans_start;
        unsigned long flags;
 
-#if defined(CONFIG_M32R) && defined(CONFIG_SMP)
-       unsigned long icucr;
-
-       local_irq_save(flags);
-       icucr = inl(M32R_ICU_CR1_PORTL);
-       icucr |= M32R_ICUCR_ISMOD11;
-       outl(icucr, M32R_ICU_CR1_PORTL);
-       local_irq_restore(flags);
-#endif
        ei_local->stat.tx_errors++;
 
        spin_lock_irqsave(&ei_local->page_lock, flags);
index 6ba6ed2b480add4ec4d37fbdf2c1653997376c78..5106c2328d12cb7a52f7f3fec847ea844e87d306 100644 (file)
@@ -229,7 +229,12 @@ struct net_device loopback_dev = {
 /* Setup and register the loopback device. */
 static int __init loopback_init(void)
 {
-       return register_netdev(&loopback_dev);
+       int err = register_netdev(&loopback_dev);
+
+       if (err)
+               panic("loopback: Failed to register netdevice: %d\n", err);
+
+       return err;
 };
 
 module_init(loopback_init);
index d0808fa3ec822c0d3b231202c535f673f891b597..5b87183e62ce47c292f2b95234d5d4896369503d 100644 (file)
@@ -255,10 +255,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
        int err;
 
        index = mlx4_bitmap_alloc(&priv->mr_table.mpt_bitmap);
-       if (index == -1) {
-               err = -ENOMEM;
-               goto err;
-       }
+       if (index == -1)
+               return -ENOMEM;
 
        mr->iova       = iova;
        mr->size       = size;
@@ -269,15 +267,8 @@ int mlx4_mr_alloc(struct mlx4_dev *dev, u32 pd, u64 iova, u64 size, u32 access,
 
        err = mlx4_mtt_init(dev, npages, page_shift, &mr->mtt);
        if (err)
-               goto err_index;
-
-       return 0;
-
-err_index:
-       mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index);
+               mlx4_bitmap_free(&priv->mr_table.mpt_bitmap, index);
 
-err:
-       kfree(mr);
        return err;
 }
 EXPORT_SYMBOL_GPL(mlx4_mr_alloc);
index deca65330b0f19f2ed085b8c3aeb146db77017f2..ae9bb7b7fd6756d240c7b2587a8d6afd5d23c5ec 100644 (file)
@@ -191,6 +191,7 @@ struct myri10ge_priv {
        struct timer_list watchdog_timer;
        int watchdog_tx_done;
        int watchdog_tx_req;
+       int watchdog_pause;
        int watchdog_resets;
        int tx_linearized;
        int pause;
@@ -2800,6 +2801,7 @@ static void myri10ge_watchdog(struct work_struct *work)
 static void myri10ge_watchdog_timer(unsigned long arg)
 {
        struct myri10ge_priv *mgp;
+       u32 rx_pause_cnt;
 
        mgp = (struct myri10ge_priv *)arg;
 
@@ -2816,19 +2818,28 @@ static void myri10ge_watchdog_timer(unsigned long arg)
                    myri10ge_fill_thresh)
                        mgp->rx_big.watchdog_needed = 0;
        }
+       rx_pause_cnt = ntohl(mgp->fw_stats->dropped_pause);
 
        if (mgp->tx.req != mgp->tx.done &&
            mgp->tx.done == mgp->watchdog_tx_done &&
-           mgp->watchdog_tx_req != mgp->watchdog_tx_done)
+           mgp->watchdog_tx_req != mgp->watchdog_tx_done) {
                /* nic seems like it might be stuck.. */
-               schedule_work(&mgp->watchdog_work);
-       else
-               /* rearm timer */
-               mod_timer(&mgp->watchdog_timer,
-                         jiffies + myri10ge_watchdog_timeout * HZ);
-
+               if (rx_pause_cnt != mgp->watchdog_pause) {
+                       if (net_ratelimit())
+                               printk(KERN_WARNING "myri10ge %s:"
+                                      "TX paused, check link partner\n",
+                                      mgp->dev->name);
+               } else {
+                       schedule_work(&mgp->watchdog_work);
+                       return;
+               }
+       }
+       /* rearm timer */
+       mod_timer(&mgp->watchdog_timer,
+                 jiffies + myri10ge_watchdog_timeout * HZ);
        mgp->watchdog_tx_done = mgp->tx.done;
        mgp->watchdog_tx_req = mgp->tx.req;
+       mgp->watchdog_pause = rx_pause_cnt;
 }
 
 static int myri10ge_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
index 6bb48ba809649ca7e3ab940f42ba98ba1f9dc643..b47a12d684f9ed30dd0b8cd302c09259ee394636 100644 (file)
@@ -2438,13 +2438,16 @@ static void netdev_error(struct net_device *dev, int intr_status)
                                dev->name);
                }
                np->stats.rx_fifo_errors++;
+               np->stats.rx_errors++;
        }
        /* Hmmmmm, it's not clear how to recover from PCI faults. */
        if (intr_status & IntrPCIErr) {
                printk(KERN_NOTICE "%s: PCI error %#08x\n", dev->name,
                        intr_status & IntrPCIErr);
                np->stats.tx_fifo_errors++;
+               np->stats.tx_errors++;
                np->stats.rx_fifo_errors++;
+               np->stats.rx_errors++;
        }
        spin_unlock(&np->lock);
 }
index cfdeaf7aa163516ba5a56c19cdabe89f419fc64e..f81d9398d605b89a5098f3aa4dc1e10c90fc9958 100644 (file)
@@ -638,7 +638,6 @@ static const struct ethtool_ops ne2k_pci_ethtool_ops = {
        .get_drvinfo            = ne2k_pci_get_drvinfo,
        .get_tx_csum            = ethtool_op_get_tx_csum,
        .get_sg                 = ethtool_op_get_sg,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static void __devexit ne2k_pci_remove_one (struct pci_dev *pdev)
index 0175f6c353f625d732a1ac08e4e5392346578cfc..a6138b474b4aa8f7b00a936e3e15f66cb49aae54 100644 (file)
@@ -755,5 +755,4 @@ struct ethtool_ops netxen_nic_ethtool_ops = {
        .get_strings = netxen_nic_get_strings,
        .get_stats_count = netxen_nic_get_stats_count,
        .get_ethtool_stats = netxen_nic_get_ethtool_stats,
-       .get_perm_addr = ethtool_op_get_perm_addr,
 };
index 19e2fa940ac025643236c04224cc5937898c0675..08a62acde8bf0e991c91706c53fa87fdb8c475d2 100644 (file)
@@ -335,7 +335,6 @@ netxen_nic_probe(struct pci_dev *pdev, const struct pci_device_id *ent)
        adapter->ahw.pdev = pdev;
        adapter->ahw.pci_func  = pci_func_id;
        spin_lock_init(&adapter->tx_lock);
-       spin_lock_init(&adapter->lock);
 
        /* remap phys address */
        mem_base = pci_resource_start(pdev, 0); /* 0 is for BAR 0 */
@@ -895,8 +894,6 @@ static int netxen_nic_open(struct net_device *netdev)
 
        /* Done here again so that even if phantom sw overwrote it,
         * we set it */
-       if (adapter->macaddr_set)
-               adapter->macaddr_set(adapter, netdev->dev_addr);
        if (adapter->init_port
            && adapter->init_port(adapter, adapter->portnum) != 0) {
            del_timer_sync(&adapter->watchdog_timer);
@@ -904,6 +901,8 @@ static int netxen_nic_open(struct net_device *netdev)
                                netxen_nic_driver_name, adapter->portnum);
                return -EIO;
        }
+       if (adapter->macaddr_set)
+               adapter->macaddr_set(adapter, netdev->dev_addr);
 
        netxen_nic_set_link_parameters(adapter);
 
@@ -930,6 +929,8 @@ static int netxen_nic_close(struct net_device *netdev)
        netif_carrier_off(netdev);
        netif_stop_queue(netdev);
 
+       netxen_nic_disable_int(adapter);
+
        cmd_buff = adapter->cmd_buf_arr;
        for (i = 0; i < adapter->max_tx_desc_count; i++) {
                buffrag = cmd_buff->frag_array;
@@ -1226,15 +1227,12 @@ static void netxen_tx_timeout_task(struct work_struct *work)
 {
        struct netxen_adapter *adapter = 
                container_of(work, struct netxen_adapter, tx_timeout_task);
-       unsigned long flags;
 
        printk(KERN_ERR "%s %s: transmit timeout, resetting.\n",
               netxen_nic_driver_name, adapter->netdev->name);
 
-       spin_lock_irqsave(&adapter->lock, flags);
        netxen_nic_close(adapter->netdev);
        netxen_nic_open(adapter->netdev);
-       spin_unlock_irqrestore(&adapter->lock, flags);
        adapter->netdev->trans_start = jiffies;
        netif_wake_queue(adapter->netdev);
 }
@@ -1243,28 +1241,12 @@ static int
 netxen_handle_int(struct netxen_adapter *adapter, struct net_device *netdev)
 {
        u32 ret = 0;
-       u32 our_int = 0;
 
        DPRINTK(INFO, "Entered handle ISR\n");
        adapter->stats.ints++;
 
-       if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
-               our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
-               /* not our interrupt */
-               if ((our_int & (0x80 << adapter->portnum)) == 0)
-                       return ret;
-       }
-
        netxen_nic_disable_int(adapter);
 
-       if (adapter->intr_scheme == INTR_SCHEME_PERPORT) {
-               /* claim interrupt */
-               if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
-                       writel(our_int & ~((u32)(0x80 << adapter->portnum)),
-                       NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
-               }
-       }
-
        if (netxen_nic_rx_has_work(adapter) || netxen_nic_tx_has_work(adapter)) {
                if (netif_rx_schedule_prep(netdev)) {
                        /*
@@ -1298,6 +1280,7 @@ irqreturn_t netxen_intr(int irq, void *data)
 {
        struct netxen_adapter *adapter;
        struct net_device *netdev;
+       u32 our_int = 0;
 
        if (unlikely(!irq)) {
                return IRQ_NONE;        /* Not our interrupt */
@@ -1305,7 +1288,22 @@ irqreturn_t netxen_intr(int irq, void *data)
 
        adapter = (struct netxen_adapter *)data;
        netdev  = adapter->netdev;
-       /* process our status queue (for all 4 ports) */
+
+       if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
+               our_int = readl(NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
+               /* not our interrupt */
+               if ((our_int & (0x80 << adapter->portnum)) == 0)
+                       return IRQ_NONE;
+       }
+
+       if (adapter->intr_scheme == INTR_SCHEME_PERPORT) {
+               /* claim interrupt */
+               if (!(adapter->flags & NETXEN_NIC_MSI_ENABLED)) {
+                       writel(our_int & ~((u32)(0x80 << adapter->portnum)),
+                       NETXEN_CRB_NORMALIZE(adapter, CRB_INT_VECTOR));
+               }
+       }
+
        if (netif_running(netdev))
                netxen_handle_int(adapter, netdev);
 
index 73da611fd536b18d93b5f44ecd90602892a98bc0..997c2d0c83bbdbe1f2d765fbc582178d02b84be7 100644 (file)
@@ -996,7 +996,7 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
 {
   struct net_device *dev = (struct net_device *) dev_id;
   mace_private *lp = netdev_priv(dev);
-  kio_addr_t ioaddr = dev->base_addr;
+  kio_addr_t ioaddr;
   int status;
   int IntrCnt = MACE_MAX_IR_ITERATIONS;
 
@@ -1006,6 +1006,8 @@ static irqreturn_t mace_interrupt(int irq, void *dev_id)
     return IRQ_NONE;
   }
 
+  ioaddr = dev->base_addr;
+
   if (lp->tx_irq_disabled) {
     printk(
       (lp->tx_irq_disabled?
index 7912dbd14251d515712205e00891a3e9b703437b..af6728cb49c3134b6dfecce5f55b8ba3e6d90ceb 100644 (file)
@@ -1368,6 +1368,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev)
     kio_addr_t ioaddr = dev->base_addr;
     u_short num_pages;
     short time_out, ir;
+    unsigned long flags;
 
     netif_stop_queue(dev);
 
@@ -1395,6 +1396,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev)
     /* A packet is now waiting. */
     smc->packets_waiting++;
 
+    spin_lock_irqsave(&smc->lock, flags);
     SMC_SELECT_BANK(2);        /* Paranoia, we should always be in window 2 */
 
     /* need MC_RESET to keep the memory consistent. errata? */
@@ -1411,6 +1413,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev)
            /* Acknowledge the interrupt, send the packet. */
            outw((ir&0xff00) | IM_ALLOC_INT, ioaddr + INTERRUPT);
            smc_hardware_send_packet(dev);      /* Send the packet now.. */
+           spin_unlock_irqrestore(&smc->lock, flags);
            return 0;
        }
     }
@@ -1418,6 +1421,7 @@ static int smc_start_xmit(struct sk_buff *skb, struct net_device *dev)
     /* Otherwise defer until the Tx-space-allocated interrupt. */
     DEBUG(2, "%s: memory allocation deferred.\n", dev->name);
     outw((IM_ALLOC_INT << 8) | (ir & 0xff00), ioaddr + INTERRUPT);
+    spin_unlock_irqrestore(&smc->lock, flags);
 
     return 0;
 }
@@ -1523,6 +1527,7 @@ static irqreturn_t smc_interrupt(int irq, void *dev_id)
     DEBUG(3, "%s: SMC91c92 interrupt %d at %#x.\n", dev->name,
          irq, ioaddr);
 
+    spin_lock(&smc->lock);
     smc->watchdog = 0;
     saved_bank = inw(ioaddr + BANK_SELECT);
     if ((saved_bank & 0xff00) != 0x3300) {
@@ -1620,6 +1625,7 @@ irq_done:
        readb(smc->base+MEGAHERTZ_ISR);
     }
 #endif
+    spin_unlock(&smc->lock);
     return IRQ_RETVAL(handled);
 }
 
@@ -1902,6 +1908,9 @@ static void media_check(u_long arg)
     kio_addr_t ioaddr = dev->base_addr;
     u_short i, media, saved_bank;
     u_short link;
+    unsigned long flags;
+
+    spin_lock_irqsave(&smc->lock, flags);
 
     saved_bank = inw(ioaddr + BANK_SELECT);
 
@@ -1934,6 +1943,7 @@ static void media_check(u_long arg)
        smc->media.expires = jiffies + HZ/100;
        add_timer(&smc->media);
        SMC_SELECT_BANK(saved_bank);
+       spin_unlock_irqrestore(&smc->lock, flags);
        return;
     }
 
@@ -2007,6 +2017,7 @@ reschedule:
     smc->media.expires = jiffies + HZ;
     add_timer(&smc->media);
     SMC_SELECT_BANK(saved_bank);
+    spin_unlock_irqrestore(&smc->lock, flags);
 }
 
 static int smc_link_ok(struct net_device *dev)
@@ -2094,14 +2105,14 @@ static int smc_get_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
        u16 saved_bank = inw(ioaddr + BANK_SELECT);
        int ret;
 
-       SMC_SELECT_BANK(3);
        spin_lock_irq(&smc->lock);
+       SMC_SELECT_BANK(3);
        if (smc->cfg & CFG_MII_SELECT)
                ret = mii_ethtool_gset(&smc->mii_if, ecmd);
        else
                ret = smc_netdev_get_ecmd(dev, ecmd);
-       spin_unlock_irq(&smc->lock);
        SMC_SELECT_BANK(saved_bank);
+       spin_unlock_irq(&smc->lock);
        return ret;
 }
 
@@ -2112,14 +2123,14 @@ static int smc_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd)
        u16 saved_bank = inw(ioaddr + BANK_SELECT);
        int ret;
 
-       SMC_SELECT_BANK(3);
        spin_lock_irq(&smc->lock);
+       SMC_SELECT_BANK(3);
        if (smc->cfg & CFG_MII_SELECT)
                ret = mii_ethtool_sset(&smc->mii_if, ecmd);
        else
                ret = smc_netdev_set_ecmd(dev, ecmd);
-       spin_unlock_irq(&smc->lock);
        SMC_SELECT_BANK(saved_bank);
+       spin_unlock_irq(&smc->lock);
        return ret;
 }
 
@@ -2130,11 +2141,11 @@ static u32 smc_get_link(struct net_device *dev)
        u16 saved_bank = inw(ioaddr + BANK_SELECT);
        u32 ret;
 
-       SMC_SELECT_BANK(3);
        spin_lock_irq(&smc->lock);
+       SMC_SELECT_BANK(3);
        ret = smc_link_ok(dev);
-       spin_unlock_irq(&smc->lock);
        SMC_SELECT_BANK(saved_bank);
+       spin_unlock_irq(&smc->lock);
        return ret;
 }
 
index 465485a3fbc642529c0c84a60c92ddd10b102b2e..e6a67531de99706ded46e208cf700d9eb545ebfc 100644 (file)
@@ -1515,7 +1515,6 @@ static const struct ethtool_ops pcnet32_ethtool_ops = {
        .phys_id                = pcnet32_phys_id,
        .get_regs_len           = pcnet32_get_regs_len,
        .get_regs               = pcnet32_get_regs,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 /* only probes for non-PCI devices, the rest are handled by
index f71dab347667cd3fc33b408aaa55c0fdf7e4e570..e323efd4ed18dda72f1903ed36cb7058b891e558 100644 (file)
@@ -261,7 +261,7 @@ void phy_sanitize_settings(struct phy_device *phydev)
 
        /* Sanitize settings based on PHY capabilities */
        if ((features & SUPPORTED_Autoneg) == 0)
-               phydev->autoneg = 0;
+               phydev->autoneg = AUTONEG_DISABLE;
 
        idx = phy_find_valid(phy_find_setting(phydev->speed, phydev->duplex),
                        features);
@@ -374,7 +374,7 @@ int phy_mii_ioctl(struct phy_device *phydev,
                if (mii_data->phy_id == phydev->addr) {
                        switch(mii_data->reg_num) {
                        case MII_BMCR:
-                               if (val & (BMCR_RESET|BMCR_ANENABLE))
+                               if ((val & (BMCR_RESET|BMCR_ANENABLE)) == 0)
                                        phydev->autoneg = AUTONEG_DISABLE;
                                else
                                        phydev->autoneg = AUTONEG_ENABLE;
index 6f98834e6ace29bc892b54f63a03aa6ed799fd70..68631a5721ac1046774450c168be665808dd9cd5 100644 (file)
@@ -108,19 +108,24 @@ static inline int cmp_addr(struct pppoe_addr *a, unsigned long sid, char *addr)
                (memcmp(a->remote,addr,ETH_ALEN) == 0));
 }
 
-static int hash_item(unsigned long sid, unsigned char *addr)
+#if 8%PPPOE_HASH_BITS
+#error 8 must be a multiple of PPPOE_HASH_BITS
+#endif
+
+static int hash_item(unsigned int sid, unsigned char *addr)
 {
-       char hash = 0;
-       int i, j;
+       unsigned char hash = 0;
+       unsigned int i;
 
-       for (i = 0; i < ETH_ALEN ; ++i) {
-               for (j = 0; j < 8/PPPOE_HASH_BITS ; ++j) {
-                       hash ^= addr[i] >> ( j * PPPOE_HASH_BITS );
-               }
+       for (i = 0 ; i < ETH_ALEN ; i++) {
+               hash ^= addr[i];
+       }
+       for (i = 0 ; i < sizeof(sid_t)*8 ; i += 8 ){
+               hash ^= sid>>i;
+       }
+       for (i = 8 ; (i>>=1) >= PPPOE_HASH_BITS ; ) {
+               hash ^= hash>>i;
        }
-
-       for (i = 0; i < (sizeof(unsigned long)*8) / PPPOE_HASH_BITS ; ++i)
-               hash ^= sid >> (i*PPPOE_HASH_BITS);
 
        return hash & ( PPPOE_HASH_SIZE - 1 );
 }
@@ -664,8 +669,8 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
 {
        struct sock *sk = sock->sk;
        struct pppox_sock *po = pppox_sk(sk);
-       int val = 0;
-       int err = 0;
+       int val;
+       int err;
 
        switch (cmd) {
        case PPPIOCGMRU:
@@ -754,8 +759,9 @@ static int pppoe_ioctl(struct socket *sock, unsigned int cmd,
                err = 0;
                break;
 
-       default:;
-       };
+       default:
+               err = -ENOTTY;
+       }
 
        return err;
 }
@@ -773,6 +779,7 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
        struct net_device *dev;
        char *start;
 
+       lock_sock(sk);
        if (sock_flag(sk, SOCK_DEAD) || !(sk->sk_state & PPPOX_CONNECTED)) {
                error = -ENOTCONN;
                goto end;
@@ -783,8 +790,6 @@ static int pppoe_sendmsg(struct kiocb *iocb, struct socket *sock,
        hdr.code = 0;
        hdr.sid = po->num;
 
-       lock_sock(sk);
-
        dev = po->pppoe_dev;
 
        error = -EMSGSIZE;
index f87176055d0ee6430ddc1fff6b09dea781ebd5b2..266e8b38fe10004366e78f3bce482add5037b407 100644 (file)
@@ -2054,7 +2054,7 @@ end:
  */
 static int pppol2tp_tunnel_getsockopt(struct sock *sk,
                                      struct pppol2tp_tunnel *tunnel,
-                                     int optname, int __user *val)
+                                     int optname, int *val)
 {
        int err = 0;
 
@@ -2077,7 +2077,7 @@ static int pppol2tp_tunnel_getsockopt(struct sock *sk,
  */
 static int pppol2tp_session_getsockopt(struct sock *sk,
                                       struct pppol2tp_session *session,
-                                      int optname, int __user *val)
+                                      int optname, int *val)
 {
        int err = 0;
 
index f3e47d0c2b3ce2cb253d96844e33ffb8b03b2552..25c52b55c38fb6cb11ddc369ce88f5b527f7cf20 100644 (file)
@@ -73,7 +73,7 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
 {
        struct sock *sk = sock->sk;
        struct pppox_sock *po = pppox_sk(sk);
-       int rc = 0;
+       int rc;
 
        lock_sock(sk);
 
@@ -94,12 +94,9 @@ int pppox_ioctl(struct socket *sock, unsigned int cmd, unsigned long arg)
                break;
        }
        default:
-               if (pppox_protos[sk->sk_protocol]->ioctl)
-                       rc = pppox_protos[sk->sk_protocol]->ioctl(sock, cmd,
-                                                                 arg);
-
-               break;
-       };
+               rc = pppox_protos[sk->sk_protocol]->ioctl ?
+                       pppox_protos[sk->sk_protocol]->ioctl(sock, cmd, arg) : -ENOTTY;
+       }
 
        release_sock(sk);
        return rc;
index 8be8be451ada960037f8521776066b1b33c12a22..69da95b5ad0c3ca51aac4ca58d1729681a8a9923 100755 (executable)
@@ -1904,7 +1904,6 @@ static void ql_get_pauseparam(struct net_device *ndev,
 static const struct ethtool_ops ql3xxx_ethtool_ops = {
        .get_settings = ql_get_settings,
        .get_drvinfo = ql_get_drvinfo,
-       .get_perm_addr = ethtool_op_get_perm_addr,
        .get_link = ethtool_op_get_link,
        .get_msglevel = ql_get_msglevel,
        .set_msglevel = ql_set_msglevel,
index bb6896ae31517c46b098dafcf1f35a28232112b3..b85ab4a8f2a3377354bf357940334be642f4a6ef 100644 (file)
@@ -725,6 +725,12 @@ static int rtl8169_set_speed_xmii(struct net_device *dev,
 
        auto_nego |= ADVERTISE_PAUSE_CAP | ADVERTISE_PAUSE_ASYM;
 
+       if (tp->mac_version == RTL_GIGA_MAC_VER_12) {
+               /* Vendor specific (0x1f) and reserved (0x0e) MII registers. */
+               mdio_write(ioaddr, 0x1f, 0x0000);
+               mdio_write(ioaddr, 0x0e, 0x0000);
+       }
+
        tp->phy_auto_nego_reg = auto_nego;
        tp->phy_1000_ctrl_reg = giga_ctrl;
 
@@ -1066,7 +1072,6 @@ static const struct ethtool_ops rtl8169_ethtool_ops = {
        .get_strings            = rtl8169_get_strings,
        .get_stats_count        = rtl8169_get_stats_count,
        .get_ethtool_stats      = rtl8169_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static void rtl8169_write_gmii_reg_bit(void __iomem *ioaddr, int reg,
@@ -2761,14 +2766,16 @@ static irqreturn_t rtl8169_interrupt(int irq, void *dev_instance)
                        rtl8169_check_link_status(dev, tp, ioaddr);
 
 #ifdef CONFIG_R8169_NAPI
-               RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
-               tp->intr_mask = ~tp->napi_event;
-
-               if (likely(netif_rx_schedule_prep(dev)))
-                       __netif_rx_schedule(dev);
-               else if (netif_msg_intr(tp)) {
-                       printk(KERN_INFO "%s: interrupt %04x taken in poll\n",
-                              dev->name, status);
+               if (status & tp->napi_event) {
+                       RTL_W16(IntrMask, tp->intr_event & ~tp->napi_event);
+                       tp->intr_mask = ~tp->napi_event;
+
+                       if (likely(netif_rx_schedule_prep(dev)))
+                               __netif_rx_schedule(dev);
+                       else if (netif_msg_intr(tp)) {
+                               printk(KERN_INFO "%s: interrupt %04x in poll\n",
+                                      dev->name, status);
+                       }
                }
                break;
 #else
index 4cb710bbe72909ff3f010ea850e240823c942a20..cfa267914476158a9cea058e203f3e5881f46925 100644 (file)
@@ -747,10 +747,9 @@ struct XENA_dev_config {
 #define MC_ERR_REG_MIRI_CRI_ERR_1          BIT(23)
 #define MC_ERR_REG_SM_ERR                  BIT(31)
 #define MC_ERR_REG_ECC_ALL_SNG            (BIT(2) | BIT(3) | BIT(4) | BIT(5) |\
-                                           BIT(6) | BIT(7) | BIT(17) | BIT(19))
+                                       BIT(17) | BIT(19))
 #define MC_ERR_REG_ECC_ALL_DBL            (BIT(10) | BIT(11) | BIT(12) |\
-                                           BIT(13) | BIT(14) | BIT(15) |\
-                                           BIT(18) | BIT(20))
+                                       BIT(13) | BIT(18) | BIT(20))
        u64 mc_err_mask;
        u64 mc_err_alarm;
 
index afef6c0c59fe3a34a70467ee60ba87cfedada12e..24feb00600eea835b1c50da642f610157a9e5f62 100644 (file)
  * rx_ring_sz: This defines the number of receive blocks each ring can have.
  *     This is also an array of size 8.
  * rx_ring_mode: This defines the operation mode of all 8 rings. The valid
- *             values are 1, 2 and 3.
+ *             values are 1, 2.
  * tx_fifo_num: This defines the number of Tx FIFOs thats used int the driver.
  * tx_fifo_len: This too is an array of 8. Each element defines the number of
  * Tx descriptors that can be associated with each corresponding FIFO.
  * intr_type: This defines the type of interrupt. The values can be 0(INTA),
- *     1(MSI), 2(MSI_X). Default value is '0(INTA)'
+ *     2(MSI_X). Default value is '0(INTA)'
  * lro: Specifies whether to enable Large Receive Offload (LRO) or not.
  *     Possible values '1' for enable '0' for disable. Default is '0'
  * lro_max_pkts: This parameter defines maximum number of packets can be
 #include "s2io.h"
 #include "s2io-regs.h"
 
-#define DRV_VERSION "2.0.23.1"
+#define DRV_VERSION "2.0.25.1"
 
 /* S2io Driver name & version. */
 static char s2io_driver_name[] = "Neterion";
 static char s2io_driver_version[] = DRV_VERSION;
 
-static int rxd_size[4] = {32,48,48,64};
-static int rxd_count[4] = {127,85,85,63};
+static int rxd_size[2] = {32,48};
+static int rxd_count[2] = {127,85};
 
 static inline int RXD_IS_UP2DT(struct RxD_t *rxdp)
 {
@@ -282,6 +282,7 @@ static char ethtool_driver_stats_keys[][ETH_GSTRING_LEN] = {
        ("lro_flush_due_to_max_pkts"),
        ("lro_avg_aggr_pkts"),
        ("mem_alloc_fail_cnt"),
+       ("pci_map_fail_cnt"),
        ("watchdog_timer_cnt"),
        ("mem_allocated"),
        ("mem_freed"),
@@ -426,7 +427,7 @@ S2IO_PARM_INT(bimodal, 0);
 S2IO_PARM_INT(l3l4hdr_size, 128);
 /* Frequency of Rx desc syncs expressed as power of 2 */
 S2IO_PARM_INT(rxsync_frequency, 3);
-/* Interrupt type. Values can be 0(INTA), 1(MSI), 2(MSI_X) */
+/* Interrupt type. Values can be 0(INTA), 2(MSI_X) */
 S2IO_PARM_INT(intr_type, 0);
 /* Large receive offload feature */
 S2IO_PARM_INT(lro, 0);
@@ -701,7 +702,7 @@ static int init_shared_mem(struct s2io_nic *nic)
                            (u64) tmp_p_addr_next;
                }
        }
-       if (nic->rxd_mode >= RXD_MODE_3A) {
+       if (nic->rxd_mode == RXD_MODE_3B) {
                /*
                 * Allocation of Storages for buffer addresses in 2BUFF mode
                 * and the buffers as well.
@@ -870,7 +871,7 @@ static void free_shared_mem(struct s2io_nic *nic)
                }
        }
 
-       if (nic->rxd_mode >= RXD_MODE_3A) {
+       if (nic->rxd_mode == RXD_MODE_3B) {
                /* Freeing buffer storage addresses in 2BUFF mode. */
                for (i = 0; i < config->rx_ring_num; i++) {
                        blk_cnt = config->rx_cfg[i].num_rxd /
@@ -2233,44 +2234,6 @@ static void stop_nic(struct s2io_nic *nic)
        writeq(val64, &bar0->adapter_control);
 }
 
-static int fill_rxd_3buf(struct s2io_nic *nic, struct RxD_t *rxdp, struct \
-                               sk_buff *skb)
-{
-       struct net_device *dev = nic->dev;
-       struct sk_buff *frag_list;
-       void *tmp;
-
-       /* Buffer-1 receives L3/L4 headers */
-       ((struct RxD3*)rxdp)->Buffer1_ptr = pci_map_single
-                       (nic->pdev, skb->data, l3l4hdr_size + 4,
-                       PCI_DMA_FROMDEVICE);
-
-       /* skb_shinfo(skb)->frag_list will have L4 data payload */
-       skb_shinfo(skb)->frag_list = dev_alloc_skb(dev->mtu + ALIGN_SIZE);
-       if (skb_shinfo(skb)->frag_list == NULL) {
-               nic->mac_control.stats_info->sw_stat.mem_alloc_fail_cnt++;
-               DBG_PRINT(INFO_DBG, "%s: dev_alloc_skb failed\n ", dev->name);
-               return -ENOMEM ;
-       }
-       frag_list = skb_shinfo(skb)->frag_list;
-       skb->truesize += frag_list->truesize;
-       nic->mac_control.stats_info->sw_stat.mem_allocated 
-               += frag_list->truesize;
-       frag_list->next = NULL;
-       tmp = (void *)ALIGN((long)frag_list->data, ALIGN_SIZE + 1);
-       frag_list->data = tmp;
-       skb_reset_tail_pointer(frag_list);
-
-       /* Buffer-2 receives L4 data payload */
-       ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single(nic->pdev,
-                               frag_list->data, dev->mtu,
-                               PCI_DMA_FROMDEVICE);
-       rxdp->Control_2 |= SET_BUFFER1_SIZE_3(l3l4hdr_size + 4);
-       rxdp->Control_2 |= SET_BUFFER2_SIZE_3(dev->mtu);
-
-       return SUCCESS;
-}
-
 /**
  *  fill_rx_buffers - Allocates the Rx side skbs
  *  @nic:  device private variable
@@ -2307,6 +2270,9 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
        unsigned long flags;
        struct RxD_t *first_rxdp = NULL;
        u64 Buffer0_ptr = 0, Buffer1_ptr = 0;
+       struct RxD1 *rxdp1;
+       struct RxD3 *rxdp3;
+       struct swStat *stats = &nic->mac_control.stats_info->sw_stat;
 
        mac_control = &nic->mac_control;
        config = &nic->config;
@@ -2359,7 +2325,7 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                        (block_no * (rxd_count[nic->rxd_mode] + 1)) + off;
                }
                if ((rxdp->Control_1 & RXD_OWN_XENA) &&
-                       ((nic->rxd_mode >= RXD_MODE_3A) &&
+                       ((nic->rxd_mode == RXD_MODE_3B) &&
                                (rxdp->Control_2 & BIT(0)))) {
                        mac_control->rings[ring_no].rx_curr_put_info.
                                        offset = off;
@@ -2370,10 +2336,8 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                                HEADER_802_2_SIZE + HEADER_SNAP_SIZE;
                if (nic->rxd_mode == RXD_MODE_1)
                        size += NET_IP_ALIGN;
-               else if (nic->rxd_mode == RXD_MODE_3B)
-                       size = dev->mtu + ALIGN_SIZE + BUF0_LEN + 4;
                else
-                       size = l3l4hdr_size + ALIGN_SIZE + BUF0_LEN + 4;
+                       size = dev->mtu + ALIGN_SIZE + BUF0_LEN + 4;
 
                /* allocate skb */
                skb = dev_alloc_skb(size);
@@ -2392,33 +2356,35 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                        += skb->truesize;
                if (nic->rxd_mode == RXD_MODE_1) {
                        /* 1 buffer mode - normal operation mode */
+                       rxdp1 = (struct RxD1*)rxdp;
                        memset(rxdp, 0, sizeof(struct RxD1));
                        skb_reserve(skb, NET_IP_ALIGN);
-                       ((struct RxD1*)rxdp)->Buffer0_ptr = pci_map_single
+                       rxdp1->Buffer0_ptr = pci_map_single
                            (nic->pdev, skb->data, size - NET_IP_ALIGN,
                                PCI_DMA_FROMDEVICE);
+                       if( (rxdp1->Buffer0_ptr == 0) ||
+                               (rxdp1->Buffer0_ptr ==
+                               DMA_ERROR_CODE))
+                               goto pci_map_failed;
+
                        rxdp->Control_2 = 
                                SET_BUFFER0_SIZE_1(size - NET_IP_ALIGN);
 
-               } else if (nic->rxd_mode >= RXD_MODE_3A) {
+               } else if (nic->rxd_mode == RXD_MODE_3B) {
                        /*
-                        * 2 or 3 buffer mode -
-                        * Both 2 buffer mode and 3 buffer mode provides 128
+                        * 2 buffer mode -
+                        * 2 buffer mode provides 128
                         * byte aligned receive buffers.
-                        *
-                        * 3 buffer mode provides header separation where in
-                        * skb->data will have L3/L4 headers where as
-                        * skb_shinfo(skb)->frag_list will have the L4 data
-                        * payload
                         */
 
+                       rxdp3 = (struct RxD3*)rxdp;
                        /* save buffer pointers to avoid frequent dma mapping */
-                       Buffer0_ptr = ((struct RxD3*)rxdp)->Buffer0_ptr;
-                       Buffer1_ptr = ((struct RxD3*)rxdp)->Buffer1_ptr;
+                       Buffer0_ptr = rxdp3->Buffer0_ptr;
+                       Buffer1_ptr = rxdp3->Buffer1_ptr;
                        memset(rxdp, 0, sizeof(struct RxD3));
                        /* restore the buffer pointers for dma sync*/
-                       ((struct RxD3*)rxdp)->Buffer0_ptr = Buffer0_ptr;
-                       ((struct RxD3*)rxdp)->Buffer1_ptr = Buffer1_ptr;
+                       rxdp3->Buffer0_ptr = Buffer0_ptr;
+                       rxdp3->Buffer1_ptr = Buffer1_ptr;
 
                        ba = &mac_control->rings[ring_no].ba[block_no][off];
                        skb_reserve(skb, BUF0_LEN);
@@ -2428,14 +2394,18 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                        skb->data = (void *) (unsigned long)tmp;
                        skb_reset_tail_pointer(skb);
 
-                       if (!(((struct RxD3*)rxdp)->Buffer0_ptr))
-                               ((struct RxD3*)rxdp)->Buffer0_ptr =
+                       if (!(rxdp3->Buffer0_ptr))
+                               rxdp3->Buffer0_ptr =
                                   pci_map_single(nic->pdev, ba->ba_0, BUF0_LEN,
                                           PCI_DMA_FROMDEVICE);
                        else
                                pci_dma_sync_single_for_device(nic->pdev,
-                               (dma_addr_t) ((struct RxD3*)rxdp)->Buffer0_ptr,
+                               (dma_addr_t) rxdp3->Buffer0_ptr,
                                    BUF0_LEN, PCI_DMA_FROMDEVICE);
+                       if( (rxdp3->Buffer0_ptr == 0) ||
+                               (rxdp3->Buffer0_ptr == DMA_ERROR_CODE))
+                               goto pci_map_failed;
+
                        rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
                        if (nic->rxd_mode == RXD_MODE_3B) {
                                /* Two buffer mode */
@@ -2444,33 +2414,30 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
                                 * Buffer2 will have L3/L4 header plus
                                 * L4 payload
                                 */
-                               ((struct RxD3*)rxdp)->Buffer2_ptr = pci_map_single
+                               rxdp3->Buffer2_ptr = pci_map_single
                                (nic->pdev, skb->data, dev->mtu + 4,
                                                PCI_DMA_FROMDEVICE);
 
-                               /* Buffer-1 will be dummy buffer. Not used */
-                               if (!(((struct RxD3*)rxdp)->Buffer1_ptr)) {
-                                       ((struct RxD3*)rxdp)->Buffer1_ptr =
+                               if( (rxdp3->Buffer2_ptr == 0) ||
+                                       (rxdp3->Buffer2_ptr == DMA_ERROR_CODE))
+                                       goto pci_map_failed;
+
+                               rxdp3->Buffer1_ptr =
                                                pci_map_single(nic->pdev,
                                                ba->ba_1, BUF1_LEN,
                                                PCI_DMA_FROMDEVICE);
+                               if( (rxdp3->Buffer1_ptr == 0) ||
+                                       (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
+                                       pci_unmap_single
+                                               (nic->pdev,
+                                               (dma_addr_t)rxdp3->Buffer2_ptr,
+                                               dev->mtu + 4,
+                                               PCI_DMA_FROMDEVICE);
+                                       goto pci_map_failed;
                                }
                                rxdp->Control_2 |= SET_BUFFER1_SIZE_3(1);
                                rxdp->Control_2 |= SET_BUFFER2_SIZE_3
                                                                (dev->mtu + 4);
-                       } else {
-                               /* 3 buffer mode */
-                               if (fill_rxd_3buf(nic, rxdp, skb) == -ENOMEM) {
-                                       nic->mac_control.stats_info->sw_stat.\
-                                       mem_freed += skb->truesize;
-                                       dev_kfree_skb_irq(skb);
-                                       if (first_rxdp) {
-                                               wmb();
-                                               first_rxdp->Control_1 |=
-                                                       RXD_OWN_XENA;
-                                       }
-                                       return -ENOMEM ;
-                               }
                        }
                        rxdp->Control_2 |= BIT(0);
                }
@@ -2505,6 +2472,11 @@ static int fill_rx_buffers(struct s2io_nic *nic, int ring_no)
        }
 
        return SUCCESS;
+pci_map_failed:
+       stats->pci_map_fail_cnt++;
+       stats->mem_freed += skb->truesize;
+       dev_kfree_skb_irq(skb);
+       return -ENOMEM;
 }
 
 static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
@@ -2515,6 +2487,8 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
        struct RxD_t *rxdp;
        struct mac_info *mac_control;
        struct buffAdd *ba;
+       struct RxD1 *rxdp1;
+       struct RxD3 *rxdp3;
 
        mac_control = &sp->mac_control;
        for (j = 0 ; j < rxd_count[sp->rxd_mode]; j++) {
@@ -2526,40 +2500,30 @@ static void free_rxd_blk(struct s2io_nic *sp, int ring_no, int blk)
                        continue;
                }
                if (sp->rxd_mode == RXD_MODE_1) {
+                       rxdp1 = (struct RxD1*)rxdp;
                        pci_unmap_single(sp->pdev, (dma_addr_t)
-                                ((struct RxD1*)rxdp)->Buffer0_ptr,
-                                dev->mtu +
-                                HEADER_ETHERNET_II_802_3_SIZE
-                                + HEADER_802_2_SIZE +
-                                HEADER_SNAP_SIZE,
-                                PCI_DMA_FROMDEVICE);
+                               rxdp1->Buffer0_ptr,
+                               dev->mtu +
+                               HEADER_ETHERNET_II_802_3_SIZE
+                               + HEADER_802_2_SIZE +
+                               HEADER_SNAP_SIZE,
+                               PCI_DMA_FROMDEVICE);
                        memset(rxdp, 0, sizeof(struct RxD1));
                } else if(sp->rxd_mode == RXD_MODE_3B) {
+                       rxdp3 = (struct RxD3*)rxdp;
                        ba = &mac_control->rings[ring_no].
                                ba[blk][j];
                        pci_unmap_single(sp->pdev, (dma_addr_t)
-                                ((struct RxD3*)rxdp)->Buffer0_ptr,
-                                BUF0_LEN,
-                                PCI_DMA_FROMDEVICE);
-                       pci_unmap_single(sp->pdev, (dma_addr_t)
-                                ((struct RxD3*)rxdp)->Buffer1_ptr,
-                                BUF1_LEN,
-                                PCI_DMA_FROMDEVICE);
-                       pci_unmap_single(sp->pdev, (dma_addr_t)
-                                ((struct RxD3*)rxdp)->Buffer2_ptr,
-                                dev->mtu + 4,
-                                PCI_DMA_FROMDEVICE);
-                       memset(rxdp, 0, sizeof(struct RxD3));
-               } else {
-                       pci_unmap_single(sp->pdev, (dma_addr_t)
-                               ((struct RxD3*)rxdp)->Buffer0_ptr, BUF0_LEN,
+                               rxdp3->Buffer0_ptr,
+                               BUF0_LEN,
                                PCI_DMA_FROMDEVICE);
                        pci_unmap_single(sp->pdev, (dma_addr_t)
-                               ((struct RxD3*)rxdp)->Buffer1_ptr,
-                               l3l4hdr_size + 4,
+                               rxdp3->Buffer1_ptr,
+                               BUF1_LEN,
                                PCI_DMA_FROMDEVICE);
                        pci_unmap_single(sp->pdev, (dma_addr_t)
-                               ((struct RxD3*)rxdp)->Buffer2_ptr, dev->mtu,
+                               rxdp3->Buffer2_ptr,
+                               dev->mtu + 4,
                                PCI_DMA_FROMDEVICE);
                        memset(rxdp, 0, sizeof(struct RxD3));
                }
@@ -2756,6 +2720,8 @@ static void rx_intr_handler(struct ring_info *ring_data)
        struct sk_buff *skb;
        int pkt_cnt = 0;
        int i;
+       struct RxD1* rxdp1;
+       struct RxD3* rxdp3;
 
        spin_lock(&nic->rx_lock);
        if (atomic_read(&nic->card_state) == CARD_DOWN) {
@@ -2796,32 +2762,23 @@ static void rx_intr_handler(struct ring_info *ring_data)
                        return;
                }
                if (nic->rxd_mode == RXD_MODE_1) {
+                       rxdp1 = (struct RxD1*)rxdp;
                        pci_unmap_single(nic->pdev, (dma_addr_t)
-                                ((struct RxD1*)rxdp)->Buffer0_ptr,
-                                dev->mtu +
-                                HEADER_ETHERNET_II_802_3_SIZE +
-                                HEADER_802_2_SIZE +
-                                HEADER_SNAP_SIZE,
-                                PCI_DMA_FROMDEVICE);
+                               rxdp1->Buffer0_ptr,
+                               dev->mtu +
+                               HEADER_ETHERNET_II_802_3_SIZE +
+                               HEADER_802_2_SIZE +
+                               HEADER_SNAP_SIZE,
+                               PCI_DMA_FROMDEVICE);
                } else if (nic->rxd_mode == RXD_MODE_3B) {
+                       rxdp3 = (struct RxD3*)rxdp;
                        pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t)
-                                ((struct RxD3*)rxdp)->Buffer0_ptr,
-                                BUF0_LEN, PCI_DMA_FROMDEVICE);
-                       pci_unmap_single(nic->pdev, (dma_addr_t)
-                                ((struct RxD3*)rxdp)->Buffer2_ptr,
-                                dev->mtu + 4,
-                                PCI_DMA_FROMDEVICE);
-               } else {
-                       pci_dma_sync_single_for_cpu(nic->pdev, (dma_addr_t)
-                                        ((struct RxD3*)rxdp)->Buffer0_ptr, BUF0_LEN,
-                                        PCI_DMA_FROMDEVICE);
-                       pci_unmap_single(nic->pdev, (dma_addr_t)
-                                        ((struct RxD3*)rxdp)->Buffer1_ptr,
-                                        l3l4hdr_size + 4,
-                                        PCI_DMA_FROMDEVICE);
+                               rxdp3->Buffer0_ptr,
+                               BUF0_LEN, PCI_DMA_FROMDEVICE);
                        pci_unmap_single(nic->pdev, (dma_addr_t)
-                                        ((struct RxD3*)rxdp)->Buffer2_ptr,
-                                        dev->mtu, PCI_DMA_FROMDEVICE);
+                               rxdp3->Buffer2_ptr,
+                               dev->mtu + 4,
+                               PCI_DMA_FROMDEVICE);
                }
                prefetch(skb->data);
                rx_osm_handler(ring_data, rxdp);
@@ -3425,23 +3382,8 @@ static void s2io_reset(struct s2io_nic * sp)
        /* Back up  the PCI-X CMD reg, dont want to lose MMRBC, OST settings */
        pci_read_config_word(sp->pdev, PCIX_COMMAND_REGISTER, &(pci_cmd));
 
-       if (sp->device_type == XFRAME_II_DEVICE) {
-               int ret;
-               ret = pci_set_power_state(sp->pdev, 3);
-               if (!ret)
-                       ret = pci_set_power_state(sp->pdev, 0);
-               else {
-                       DBG_PRINT(ERR_DBG,"%s PME based SW_Reset failed!\n",
-                                       __FUNCTION__);
-                       goto old_way;
-               }
-               msleep(20);
-               goto new_way;
-       }
-old_way:
        val64 = SW_RESET_ALL;
        writeq(val64, &bar0->sw_reset);
-new_way:
        if (strstr(sp->product_name, "CX4")) {
                msleep(750);
        }
@@ -3731,56 +3673,6 @@ static void store_xmsi_data(struct s2io_nic *nic)
        }
 }
 
-int s2io_enable_msi(struct s2io_nic *nic)
-{
-       struct XENA_dev_config __iomem *bar0 = nic->bar0;
-       u16 msi_ctrl, msg_val;
-       struct config_param *config = &nic->config;
-       struct net_device *dev = nic->dev;
-       u64 val64, tx_mat, rx_mat;
-       int i, err;
-
-       val64 = readq(&bar0->pic_control);
-       val64 &= ~BIT(1);
-       writeq(val64, &bar0->pic_control);
-
-       err = pci_enable_msi(nic->pdev);
-       if (err) {
-               DBG_PRINT(ERR_DBG, "%s: enabling MSI failed\n",
-                         nic->dev->name);
-               return err;
-       }
-
-       /*
-        * Enable MSI and use MSI-1 in stead of the standard MSI-0
-        * for interrupt handling.
-        */
-       pci_read_config_word(nic->pdev, 0x4c, &msg_val);
-       msg_val ^= 0x1;
-       pci_write_config_word(nic->pdev, 0x4c, msg_val);
-       pci_read_config_word(nic->pdev, 0x4c, &msg_val);
-
-       pci_read_config_word(nic->pdev, 0x42, &msi_ctrl);
-       msi_ctrl |= 0x10;
-       pci_write_config_word(nic->pdev, 0x42, msi_ctrl);
-
-       /* program MSI-1 into all usable Tx_Mat and Rx_Mat fields */
-       tx_mat = readq(&bar0->tx_mat0_n[0]);
-       for (i=0; i<config->tx_fifo_num; i++) {
-               tx_mat |= TX_MAT_SET(i, 1);
-       }
-       writeq(tx_mat, &bar0->tx_mat0_n[0]);
-
-       rx_mat = readq(&bar0->rx_mat);
-       for (i=0; i<config->rx_ring_num; i++) {
-               rx_mat |= RX_MAT_SET(i, 1);
-       }
-       writeq(rx_mat, &bar0->rx_mat);
-
-       dev->irq = nic->pdev->irq;
-       return 0;
-}
-
 static int s2io_enable_msi_x(struct s2io_nic *nic)
 {
        struct XENA_dev_config __iomem *bar0 = nic->bar0;
@@ -4001,6 +3893,7 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
        struct mac_info *mac_control;
        struct config_param *config;
        int offload_type;
+       struct swStat *stats = &sp->mac_control.stats_info->sw_stat;
 
        mac_control = &sp->mac_control;
        config = &sp->config;
@@ -4085,11 +3978,18 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
                txdp->Buffer_Pointer = pci_map_single(sp->pdev,
                                        sp->ufo_in_band_v,
                                        sizeof(u64), PCI_DMA_TODEVICE);
+               if((txdp->Buffer_Pointer == 0) ||
+                       (txdp->Buffer_Pointer == DMA_ERROR_CODE))
+                       goto pci_map_failed;
                txdp++;
        }
 
        txdp->Buffer_Pointer = pci_map_single
            (sp->pdev, skb->data, frg_len, PCI_DMA_TODEVICE);
+       if((txdp->Buffer_Pointer == 0) ||
+               (txdp->Buffer_Pointer == DMA_ERROR_CODE))
+               goto pci_map_failed;
+
        txdp->Host_Control = (unsigned long) skb;
        txdp->Control_1 |= TXD_BUFFER0_SIZE(frg_len);
        if (offload_type == SKB_GSO_UDP)
@@ -4145,6 +4045,13 @@ static int s2io_xmit(struct sk_buff *skb, struct net_device *dev)
        dev->trans_start = jiffies;
        spin_unlock_irqrestore(&sp->tx_lock, flags);
 
+       return 0;
+pci_map_failed:
+       stats->pci_map_fail_cnt++;
+       netif_stop_queue(dev);
+       stats->mem_freed += skb->truesize;
+       dev_kfree_skb(skb);
+       spin_unlock_irqrestore(&sp->tx_lock, flags);
        return 0;
 }
 
@@ -4186,39 +4093,6 @@ static int s2io_chk_rx_buffers(struct s2io_nic *sp, int rng_n)
        return 0;
 }
 
-static irqreturn_t s2io_msi_handle(int irq, void *dev_id)
-{
-       struct net_device *dev = (struct net_device *) dev_id;
-       struct s2io_nic *sp = dev->priv;
-       int i;
-       struct mac_info *mac_control;
-       struct config_param *config;
-
-       atomic_inc(&sp->isr_cnt);
-       mac_control = &sp->mac_control;
-       config = &sp->config;
-       DBG_PRINT(INTR_DBG, "%s: MSI handler\n", __FUNCTION__);
-
-       /* If Intr is because of Rx Traffic */
-       for (i = 0; i < config->rx_ring_num; i++)
-               rx_intr_handler(&mac_control->rings[i]);
-
-       /* If Intr is because of Tx Traffic */
-       for (i = 0; i < config->tx_fifo_num; i++)
-               tx_intr_handler(&mac_control->fifos[i]);
-
-       /*
-        * If the Rx buffer count is below the panic threshold then
-        * reallocate the buffers from the interrupt handler itself,
-        * else schedule a tasklet to reallocate the buffers.
-        */
-       for (i = 0; i < config->rx_ring_num; i++)
-               s2io_chk_rx_buffers(sp, i);
-
-       atomic_dec(&sp->isr_cnt);
-       return IRQ_HANDLED;
-}
-
 static irqreturn_t s2io_msix_ring_handle(int irq, void *dev_id)
 {
        struct ring_info *ring = (struct ring_info *)dev_id;
@@ -4927,19 +4801,17 @@ static void s2io_ethtool_gringparam(struct net_device *dev,
                ering->rx_max_pending = MAX_RX_DESC_1;
        else if (sp->rxd_mode == RXD_MODE_3B)
                ering->rx_max_pending = MAX_RX_DESC_2;
-       else if (sp->rxd_mode == RXD_MODE_3A)
-               ering->rx_max_pending = MAX_RX_DESC_3;
 
        ering->tx_max_pending = MAX_TX_DESC;
-       for (i = 0 ; i < sp->config.tx_fifo_num ; i++) {
+       for (i = 0 ; i < sp->config.tx_fifo_num ; i++) 
                tx_desc_count += sp->config.tx_cfg[i].fifo_len;
-       }
+       
        DBG_PRINT(INFO_DBG,"\nmax txds : %d\n",sp->config.max_txds);
        ering->tx_pending = tx_desc_count;
        rx_desc_count = 0;
-       for (i = 0 ; i < sp->config.rx_ring_num ; i++) {
+       for (i = 0 ; i < sp->config.rx_ring_num ; i++) 
                rx_desc_count += sp->config.rx_cfg[i].num_rxd;
-       }
+
        ering->rx_pending = rx_desc_count;
 
        ering->rx_mini_max_pending = 0;
@@ -5923,6 +5795,7 @@ static void s2io_get_ethtool_stats(struct net_device *dev,
        else
                tmp_stats[i++] = 0;
        tmp_stats[i++] = stat_info->sw_stat.mem_alloc_fail_cnt;
+       tmp_stats[i++] = stat_info->sw_stat.pci_map_fail_cnt;
        tmp_stats[i++] = stat_info->sw_stat.watchdog_timer_cnt;
        tmp_stats[i++] = stat_info->sw_stat.mem_allocated;
        tmp_stats[i++] = stat_info->sw_stat.mem_freed;
@@ -6266,9 +6139,10 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                                u64 *temp2, int size)
 {
        struct net_device *dev = sp->dev;
-       struct sk_buff *frag_list;
+       struct swStat *stats = &sp->mac_control.stats_info->sw_stat;
 
        if ((sp->rxd_mode == RXD_MODE_1) && (rxdp->Host_Control == 0)) {
+               struct RxD1 *rxdp1 = (struct RxD1 *)rxdp;
                /* allocate skb */
                if (*skb) {
                        DBG_PRINT(INFO_DBG, "SKB is not NULL\n");
@@ -6277,7 +6151,7 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                         * using same mapped address for the Rxd
                         * buffer pointer
                         */
-                       ((struct RxD1*)rxdp)->Buffer0_ptr = *temp0;
+                       rxdp1->Buffer0_ptr = *temp0;
                } else {
                        *skb = dev_alloc_skb(size);
                        if (!(*skb)) {
@@ -6294,18 +6168,23 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                         * such it will be used for next rxd whose
                         * Host Control is NULL
                         */
-                       ((struct RxD1*)rxdp)->Buffer0_ptr = *temp0 =
+                       rxdp1->Buffer0_ptr = *temp0 =
                                pci_map_single( sp->pdev, (*skb)->data,
                                        size - NET_IP_ALIGN,
                                        PCI_DMA_FROMDEVICE);
+                       if( (rxdp1->Buffer0_ptr == 0) ||
+                               (rxdp1->Buffer0_ptr == DMA_ERROR_CODE)) {
+                               goto memalloc_failed;
+                       }
                        rxdp->Host_Control = (unsigned long) (*skb);
                }
        } else if ((sp->rxd_mode == RXD_MODE_3B) && (rxdp->Host_Control == 0)) {
+               struct RxD3 *rxdp3 = (struct RxD3 *)rxdp;
                /* Two buffer Mode */
                if (*skb) {
-                       ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2;
-                       ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0;
-                       ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1;
+                       rxdp3->Buffer2_ptr = *temp2;
+                       rxdp3->Buffer0_ptr = *temp0;
+                       rxdp3->Buffer1_ptr = *temp1;
                } else {
                        *skb = dev_alloc_skb(size);
                        if (!(*skb)) {
@@ -6318,73 +6197,50 @@ static int set_rxd_buffer_pointer(struct s2io_nic *sp, struct RxD_t *rxdp,
                        }
                        sp->mac_control.stats_info->sw_stat.mem_allocated 
                                += (*skb)->truesize;
-                       ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2 =
+                       rxdp3->Buffer2_ptr = *temp2 =
                                pci_map_single(sp->pdev, (*skb)->data,
                                               dev->mtu + 4,
                                               PCI_DMA_FROMDEVICE);
-                       ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0 =
+                       if( (rxdp3->Buffer2_ptr == 0) ||
+                               (rxdp3->Buffer2_ptr == DMA_ERROR_CODE)) {
+                               goto memalloc_failed;
+                       }
+                       rxdp3->Buffer0_ptr = *temp0 =
                                pci_map_single( sp->pdev, ba->ba_0, BUF0_LEN,
                                                PCI_DMA_FROMDEVICE);
+                       if( (rxdp3->Buffer0_ptr == 0) ||
+                               (rxdp3->Buffer0_ptr == DMA_ERROR_CODE)) {
+                               pci_unmap_single (sp->pdev,
+                                       (dma_addr_t)rxdp3->Buffer2_ptr,
+                                       dev->mtu + 4, PCI_DMA_FROMDEVICE);
+                               goto memalloc_failed;
+                       }
                        rxdp->Host_Control = (unsigned long) (*skb);
 
                        /* Buffer-1 will be dummy buffer not used */
-                       ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1 =
+                       rxdp3->Buffer1_ptr = *temp1 =
                                pci_map_single(sp->pdev, ba->ba_1, BUF1_LEN,
-                                              PCI_DMA_FROMDEVICE);
-               }
-       } else if ((rxdp->Host_Control == 0)) {
-               /* Three buffer mode */
-               if (*skb) {
-                       ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0;
-                       ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1;
-                       ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2;
-               } else {
-                       *skb = dev_alloc_skb(size);
-                       if (!(*skb)) {
-                               DBG_PRINT(INFO_DBG, "%s: Out of ", dev->name);
-                               DBG_PRINT(INFO_DBG, "memory to allocate ");
-                               DBG_PRINT(INFO_DBG, "3 buf mode SKBs\n");
-                               sp->mac_control.stats_info->sw_stat. \
-                                       mem_alloc_fail_cnt++;
-                               return -ENOMEM;
-                       }
-                       sp->mac_control.stats_info->sw_stat.mem_allocated 
-                               += (*skb)->truesize;
-                       ((struct RxD3*)rxdp)->Buffer0_ptr = *temp0 =
-                               pci_map_single(sp->pdev, ba->ba_0, BUF0_LEN,
-                                              PCI_DMA_FROMDEVICE);
-                       /* Buffer-1 receives L3/L4 headers */
-                       ((struct RxD3*)rxdp)->Buffer1_ptr = *temp1 =
-                               pci_map_single( sp->pdev, (*skb)->data,
-                                               l3l4hdr_size + 4,
                                                PCI_DMA_FROMDEVICE);
-                       /*
-                        * skb_shinfo(skb)->frag_list will have L4
-                        * data payload
-                        */
-                       skb_shinfo(*skb)->frag_list = dev_alloc_skb(dev->mtu +
-                                                                  ALIGN_SIZE);
-                       if (skb_shinfo(*skb)->frag_list == NULL) {
-                               DBG_PRINT(ERR_DBG, "%s: dev_alloc_skb \
-                                         failed\n ", dev->name);
-                               sp->mac_control.stats_info->sw_stat. \
-                                       mem_alloc_fail_cnt++;
-                               return -ENOMEM ;
+                       if( (rxdp3->Buffer1_ptr == 0) ||
+                               (rxdp3->Buffer1_ptr == DMA_ERROR_CODE)) {
+                               pci_unmap_single (sp->pdev,
+                                       (dma_addr_t)rxdp3->Buffer0_ptr,
+                                       BUF0_LEN, PCI_DMA_FROMDEVICE);
+                               pci_unmap_single (sp->pdev,
+                                       (dma_addr_t)rxdp3->Buffer2_ptr,
+                                       dev->mtu + 4, PCI_DMA_FROMDEVICE);
+                               goto memalloc_failed;
                        }
-                       frag_list = skb_shinfo(*skb)->frag_list;
-                       frag_list->next = NULL;
-                       sp->mac_control.stats_info->sw_stat.mem_allocated 
-                               += frag_list->truesize;
-                       /*
-                        * Buffer-2 receives L4 data payload
-                        */
-                       ((struct RxD3*)rxdp)->Buffer2_ptr = *temp2 =
-                               pci_map_single( sp->pdev, frag_list->data,
-                                               dev->mtu, PCI_DMA_FROMDEVICE);
                }
        }
        return 0;
+       memalloc_failed:
+               stats->pci_map_fail_cnt++;
+               stats->mem_freed += (*skb)->truesize;
+               dev_kfree_skb(*skb);
+               return -ENOMEM;
 }
+
 static void set_rxd_buffer_size(struct s2io_nic *sp, struct RxD_t *rxdp,
                                int size)
 {
@@ -6395,10 +6251,6 @@ static void set_rxd_buffer_size(struct s2io_nic *sp, struct RxD_t *rxdp,
                rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
                rxdp->Control_2 |= SET_BUFFER1_SIZE_3(1);
                rxdp->Control_2 |= SET_BUFFER2_SIZE_3( dev->mtu + 4);
-       } else {
-               rxdp->Control_2 = SET_BUFFER0_SIZE_3(BUF0_LEN);
-               rxdp->Control_2 |= SET_BUFFER1_SIZE_3(l3l4hdr_size + 4);
-               rxdp->Control_2 |= SET_BUFFER2_SIZE_3(dev->mtu);
        }
 }
 
@@ -6420,8 +6272,6 @@ static  int rxd_owner_bit_reset(struct s2io_nic *sp)
                size += NET_IP_ALIGN;
        else if (sp->rxd_mode == RXD_MODE_3B)
                size = dev->mtu + ALIGN_SIZE + BUF0_LEN + 4;
-       else
-               size = l3l4hdr_size + ALIGN_SIZE + BUF0_LEN + 4;
 
        for (i = 0; i < config->rx_ring_num; i++) {
                blk_cnt = config->rx_cfg[i].num_rxd /
@@ -6431,7 +6281,7 @@ static  int rxd_owner_bit_reset(struct s2io_nic *sp)
                        for (k = 0; k < rxd_count[sp->rxd_mode]; k++) {
                                rxdp = mac_control->rings[i].
                                        rx_blocks[j].rxds[k].virt_addr;
-                               if(sp->rxd_mode >= RXD_MODE_3A)
+                               if(sp->rxd_mode == RXD_MODE_3B)
                                        ba = &mac_control->rings[i].ba[j][k];
                                if (set_rxd_buffer_pointer(sp, rxdp, ba,
                                                       &skb,(u64 *)&temp0_64,
@@ -6458,9 +6308,7 @@ static int s2io_add_isr(struct s2io_nic * sp)
        struct net_device *dev = sp->dev;
        int err = 0;
 
-       if (sp->intr_type == MSI)
-               ret = s2io_enable_msi(sp);
-       else if (sp->intr_type == MSI_X)
+       if (sp->intr_type == MSI_X)
                ret = s2io_enable_msi_x(sp);
        if (ret) {
                DBG_PRINT(ERR_DBG, "%s: Defaulting to INTA\n", dev->name);
@@ -6471,16 +6319,6 @@ static int s2io_add_isr(struct s2io_nic * sp)
        store_xmsi_data(sp);
 
        /* After proper initialization of H/W, register ISR */
-       if (sp->intr_type == MSI) {
-               err = request_irq((int) sp->pdev->irq, s2io_msi_handle,
-                       IRQF_SHARED, sp->name, dev);
-               if (err) {
-                       pci_disable_msi(sp->pdev);
-                       DBG_PRINT(ERR_DBG, "%s: MSI registration failed\n",
-                                 dev->name);
-                       return -1;
-               }
-       }
        if (sp->intr_type == MSI_X) {
                int i, msix_tx_cnt=0,msix_rx_cnt=0;
 
@@ -6567,14 +6405,6 @@ static void s2io_rem_isr(struct s2io_nic * sp)
                pci_disable_msix(sp->pdev);
        } else {
                free_irq(sp->pdev->irq, dev);
-               if (sp->intr_type == MSI) {
-                       u16 val;
-
-                       pci_disable_msi(sp->pdev);
-                       pci_read_config_word(sp->pdev, 0x4c, &val);
-                       val ^= 0x1;
-                       pci_write_config_word(sp->pdev, 0x4c, val);
-               }
        }
        /* Waiting till all Interrupt handlers are complete */
        cnt = 0;
@@ -6907,6 +6737,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
        }
 
        /* Updating statistics */
+       sp->stats.rx_packets++;
        rxdp->Host_Control = 0;
        if (sp->rxd_mode == RXD_MODE_1) {
                int len = RXD_GET_BUFFER0_SIZE_1(rxdp->Control_2);
@@ -6914,7 +6745,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
                sp->stats.rx_bytes += len;
                skb_put(skb, len);
 
-       } else if (sp->rxd_mode >= RXD_MODE_3A) {
+       } else if (sp->rxd_mode == RXD_MODE_3B) {
                int get_block = ring_data->rx_curr_get_info.block_index;
                int get_off = ring_data->rx_curr_get_info.offset;
                int buf0_len = RXD_GET_BUFFER0_SIZE_3(rxdp->Control_2);
@@ -6924,18 +6755,7 @@ static int rx_osm_handler(struct ring_info *ring_data, struct RxD_t * rxdp)
                struct buffAdd *ba = &ring_data->ba[get_block][get_off];
                sp->stats.rx_bytes += buf0_len + buf2_len;
                memcpy(buff, ba->ba_0, buf0_len);
-
-               if (sp->rxd_mode == RXD_MODE_3A) {
-                       int buf1_len = RXD_GET_BUFFER1_SIZE_3(rxdp->Control_2);
-
-                       skb_put(skb, buf1_len);
-                       skb->len += buf2_len;
-                       skb->data_len += buf2_len;
-                       skb_put(skb_shinfo(skb)->frag_list, buf2_len);
-                       sp->stats.rx_bytes += buf1_len;
-
-               } else
-                       skb_put(skb, buf2_len);
+               skb_put(skb, buf2_len);
        }
 
        if ((rxdp->Control_1 & TCP_OR_UDP_FRAME) && ((!sp->lro) ||
@@ -7131,7 +6951,7 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
                *dev_intr_type = INTA;
        }
 #else
-       if (*dev_intr_type > MSI_X) {
+       if ((*dev_intr_type != INTA) && (*dev_intr_type != MSI_X)) {
                DBG_PRINT(ERR_DBG, "s2io: Wrong intr_type requested. "
                          "Defaulting to INTA\n");
                *dev_intr_type = INTA;
@@ -7145,10 +6965,10 @@ static int s2io_verify_parm(struct pci_dev *pdev, u8 *dev_intr_type)
                *dev_intr_type = INTA;
        }
 
-       if (rx_ring_mode > 3) {
+       if ((rx_ring_mode != 1) && (rx_ring_mode != 2)) {
                DBG_PRINT(ERR_DBG, "s2io: Requested ring mode not supported\n");
-               DBG_PRINT(ERR_DBG, "s2io: Defaulting to 3-buffer mode\n");
-               rx_ring_mode = 3;
+               DBG_PRINT(ERR_DBG, "s2io: Defaulting to 1-buffer mode\n");
+               rx_ring_mode = 1;
        }
        return SUCCESS;
 }
@@ -7240,28 +7060,10 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                pci_disable_device(pdev);
                return -ENOMEM;
        }
-       if (dev_intr_type != MSI_X) {
-               if (pci_request_regions(pdev, s2io_driver_name)) {
-                       DBG_PRINT(ERR_DBG, "Request Regions failed\n");
-                       pci_disable_device(pdev);
-                       return -ENODEV;
-               }
-       }
-       else {
-               if (!(request_mem_region(pci_resource_start(pdev, 0),
-                                pci_resource_len(pdev, 0), s2io_driver_name))) {
-                       DBG_PRINT(ERR_DBG, "bar0 Request Regions failed\n");
-                       pci_disable_device(pdev);
-                       return -ENODEV;
-               }
-               if (!(request_mem_region(pci_resource_start(pdev, 2),
-                                pci_resource_len(pdev, 2), s2io_driver_name))) {
-                       DBG_PRINT(ERR_DBG, "bar1 Request Regions failed\n");
-                       release_mem_region(pci_resource_start(pdev, 0),
-                                   pci_resource_len(pdev, 0));
-                       pci_disable_device(pdev);
-                       return -ENODEV;
-               }
+       if ((ret = pci_request_regions(pdev, s2io_driver_name))) {
+               DBG_PRINT(ERR_DBG, "%s: Request Regions failed - %x \n", __FUNCTION__, ret);
+               pci_disable_device(pdev);
+               return -ENODEV;
        }
 
        dev = alloc_etherdev(sizeof(struct s2io_nic));
@@ -7288,8 +7090,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                sp->rxd_mode = RXD_MODE_1;
        if (rx_ring_mode == 2)
                sp->rxd_mode = RXD_MODE_3B;
-       if (rx_ring_mode == 3)
-               sp->rxd_mode = RXD_MODE_3A;
 
        sp->intr_type = dev_intr_type;
 
@@ -7565,10 +7365,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                    DBG_PRINT(ERR_DBG, "%s: 2-Buffer receive mode enabled\n",
                                                dev->name);
                    break;
-               case RXD_MODE_3A:
-                   DBG_PRINT(ERR_DBG, "%s: 3-Buffer receive mode enabled\n",
-                                               dev->name);
-                   break;
        }
 
        if (napi)
@@ -7577,9 +7373,6 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
                case INTA:
                    DBG_PRINT(ERR_DBG, "%s: Interrupt type INTA\n", dev->name);
                    break;
-               case MSI:
-                   DBG_PRINT(ERR_DBG, "%s: Interrupt type MSI\n", dev->name);
-                   break;
                case MSI_X:
                    DBG_PRINT(ERR_DBG, "%s: Interrupt type MSI-X\n", dev->name);
                    break;
@@ -7619,14 +7412,7 @@ s2io_init_nic(struct pci_dev *pdev, const struct pci_device_id *pre)
       mem_alloc_failed:
        free_shared_mem(sp);
        pci_disable_device(pdev);
-       if (dev_intr_type != MSI_X)
-               pci_release_regions(pdev);
-       else {
-               release_mem_region(pci_resource_start(pdev, 0),
-                       pci_resource_len(pdev, 0));
-               release_mem_region(pci_resource_start(pdev, 2),
-                       pci_resource_len(pdev, 2));
-       }
+       pci_release_regions(pdev);
        pci_set_drvdata(pdev, NULL);
        free_netdev(dev);
 
@@ -7661,14 +7447,7 @@ static void __devexit s2io_rem_nic(struct pci_dev *pdev)
        free_shared_mem(sp);
        iounmap(sp->bar0);
        iounmap(sp->bar1);
-       if (sp->intr_type != MSI_X)
-               pci_release_regions(pdev);
-       else {
-               release_mem_region(pci_resource_start(pdev, 0),
-                       pci_resource_len(pdev, 0));
-               release_mem_region(pci_resource_start(pdev, 2),
-                       pci_resource_len(pdev, 2));
-       }
+       pci_release_regions(pdev);
        pci_set_drvdata(pdev, NULL);
        free_netdev(dev);
        pci_disable_device(pdev);
index 3887fe63a908146bc2fdff545a73ed2eebab098e..92983ee7df8c35bd01cb6b7872ad430fe0199304 100644 (file)
@@ -74,6 +74,10 @@ static int debug_level = ERR_DBG;
 /* DEBUG message print. */
 #define DBG_PRINT(dbg_level, args...)  if(!(debug_level<dbg_level)) printk(args)
 
+#ifndef DMA_ERROR_CODE
+#define DMA_ERROR_CODE          (~(dma_addr_t)0x0)
+#endif
+
 /* Protocol assist features of the NIC */
 #define L3_CKSUM_OK 0xFFFF
 #define L4_CKSUM_OK 0xFFFF
@@ -97,6 +101,7 @@ struct swStat {
        unsigned long long num_aggregations;
        /* Other statistics */
        unsigned long long mem_alloc_fail_cnt;
+       unsigned long long pci_map_fail_cnt;
        unsigned long long watchdog_timer_cnt;
        unsigned long long mem_allocated;
        unsigned long long mem_freed;
@@ -575,8 +580,7 @@ struct RxD_block {
 #define SIZE_OF_BLOCK  4096
 
 #define RXD_MODE_1     0 /* One Buffer mode */
-#define RXD_MODE_3A    1 /* Three Buffer mode */
-#define RXD_MODE_3B    2 /* Two Buffer mode */
+#define RXD_MODE_3B    1 /* Two Buffer mode */
 
 /* Structure to hold virtual addresses of Buf0 and Buf1 in
  * 2buf mode. */
@@ -876,7 +880,6 @@ struct s2io_nic {
        u16             lro_max_aggr_per_sess;
 
 #define INTA   0
-#define MSI    1
 #define MSI_X  2
        u8 intr_type;
 
@@ -1020,8 +1023,6 @@ static int s2io_poll(struct net_device *dev, int *budget);
 static void s2io_init_pci(struct s2io_nic * sp);
 static int s2io_set_mac_addr(struct net_device *dev, u8 * addr);
 static void s2io_alarm_handle(unsigned long data);
-static int s2io_enable_msi(struct s2io_nic *nic);
-static irqreturn_t s2io_msi_handle(int irq, void *dev_id);
 static irqreturn_t
 s2io_msix_ring_handle(int irq, void *dev_id);
 static irqreturn_t
index 5b7284c955dc7c9d7c0e6be70025b35f1c7ed164..872cb1cc9c41c05d2b12048450a5b187b782608f 100644 (file)
@@ -1402,7 +1402,6 @@ static struct ethtool_ops sc92031_ethtool_ops = {
        .get_strings            = sc92031_ethtool_get_strings,
        .get_stats_count        = sc92031_ethtool_get_stats_count,
        .get_ethtool_stats      = sc92031_ethtool_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
        .get_ufo                = ethtool_op_get_ufo,
 };
 
index ec2ad9f0efa25bcbc46509149920bdd8a6a4ec5a..d470b19c08107a9f603686f1c45ffd48d7159366 100644 (file)
@@ -1593,6 +1593,9 @@ static int __devinit sis190_get_mac_addr_from_apc(struct pci_dev *pdev,
                  pci_name(pdev));
 
        isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0965, NULL);
+       if (!isa_bridge)
+               isa_bridge = pci_get_device(PCI_VENDOR_ID_SI, 0x0966, NULL);
+
        if (!isa_bridge) {
                net_probe(tp, KERN_INFO "%s: Can not find ISA bridge.\n",
                          pci_name(pdev));
index efc639c013fde5b0fc82d2e1fc2cb99ca13009d2..ea85de918233ab52c0ecb5b666a066d53e5b1dda 100644 (file)
@@ -575,7 +575,7 @@ void smt_add_para(struct s_smc *smc, struct s_pcon *pcon, u_short para,
        int             sp_len ;
 
        /*
-        * skip if errror
+        * skip if error
         */
        if (pcon->pc_err)
                return ;
index 776692946562090527838259d780db424b9afc11..e3d8520209b85e1bc5e3bccd60e58c1b1d03b0aa 100644 (file)
@@ -821,7 +821,6 @@ static const struct ethtool_ops skge_ethtool_ops = {
        .phys_id        = skge_phys_id,
        .get_stats_count = skge_get_stats_count,
        .get_ethtool_stats = skge_get_ethtool_stats,
-       .get_perm_addr  = ethtool_op_get_perm_addr,
 };
 
 /*
index 13f08a390e1f599e304b112d10ab428a495958c5..e7a2eadcc3b0c8030f782292af7adbbe4db61f99 100644 (file)
@@ -3548,7 +3548,6 @@ static const struct ethtool_ops sky2_ethtool_ops = {
        .phys_id        = sky2_phys_id,
        .get_stats_count = sky2_get_stats_count,
        .get_ethtool_stats = sky2_get_ethtool_stats,
-       .get_perm_addr  = ethtool_op_get_perm_addr,
 };
 
 #ifdef CONFIG_SKY2_DEBUG
index f8429449dc1ebf0e28a3de7e7184f72dbca38f8f..6ff3a1627af87112ea87cca3f7ca7dd952c3a2e7 100644 (file)
@@ -299,7 +299,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 
 #define SMC_CAN_USE_8BIT       1
 #define SMC_CAN_USE_16BIT      1
-#define SMC_CAN_USE_32BIT      1
+#define SMC_CAN_USE_32BIT      0
 
 #define SMC_inb(a, r)          inb((a) + (r))
 #define SMC_inw(a, r)          inw((a) + (r))
@@ -310,8 +310,6 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg)
 
 #endif  /* BOARDS */
 
-#define set_irq_type(irq, type) do {} while (0)
-
 #elif   defined(CONFIG_M32R)
 
 #define SMC_CAN_USE_8BIT       0
index af0c9831074c62c4c9d14d4fad624fcd81bd0391..a8f2af8f778a7d5c51d46af333f3a0a178a5b669 100644 (file)
@@ -1586,7 +1586,6 @@ static const struct ethtool_ops ethtool_ops = {
        .get_link = get_link,
        .get_msglevel = get_msglevel,
        .set_msglevel = set_msglevel,
-       .get_perm_addr = ethtool_op_get_perm_addr,
 };
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
index 053b7cb0d94406fb8b3b30b3a21cf51d4494be7e..68e4f660367d5e1795ffbef7a4fb2fe6e75339ac 100644 (file)
@@ -99,8 +99,7 @@ static char lancestr[] = "LANCE";
 #include <asm/byteorder.h>     /* Used by the checksum routines */
 #include <asm/idprom.h>
 #include <asm/sbus.h>
-#include <asm/openprom.h>
-#include <asm/oplib.h>
+#include <asm/prom.h>
 #include <asm/auxio.h>         /* For tpe-link-test? setting */
 #include <asm/irq.h>
 
@@ -1326,6 +1325,7 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
                                           struct sbus_dev *lebuffer)
 {
        static unsigned version_printed;
+       struct device_node *dp = sdev->ofdev.node;
        struct net_device *dev;
        struct lance_private *lp;
        int    i;
@@ -1389,54 +1389,46 @@ static int __devinit sparc_lance_probe_one(struct sbus_dev *sdev,
                lp->rx = lance_rx_dvma;
                lp->tx = lance_tx_dvma;
        }
-       lp->busmaster_regval = prom_getintdefault(sdev->prom_node,
-                                                 "busmaster-regval",
-                                                 (LE_C3_BSWP | LE_C3_ACON |
-                                                  LE_C3_BCON));
+       lp->busmaster_regval = of_getintprop_default(dp,  "busmaster-regval",
+                                                    (LE_C3_BSWP |
+                                                     LE_C3_ACON |
+                                                     LE_C3_BCON));
 
        lp->name = lancestr;
        lp->ledma = ledma;
 
        lp->burst_sizes = 0;
        if (lp->ledma) {
-               char prop[6];
+               struct device_node *ledma_dp = ledma->sdev->ofdev.node;
+               const char *prop;
                unsigned int sbmask;
                u32 csr;
 
                /* Find burst-size property for ledma */
-               lp->burst_sizes = prom_getintdefault(ledma->sdev->prom_node,
-                                                    "burst-sizes", 0);
+               lp->burst_sizes = of_getintprop_default(ledma_dp,
+                                                       "burst-sizes", 0);
 
                /* ledma may be capable of fast bursts, but sbus may not. */
-               sbmask = prom_getintdefault(ledma->sdev->bus->prom_node,
-                                           "burst-sizes", DMA_BURSTBITS);
+               sbmask = of_getintprop_default(ledma_dp, "burst-sizes",
+                                              DMA_BURSTBITS);
                lp->burst_sizes &= sbmask;
 
                /* Get the cable-selection property */
-               memset(prop, 0, sizeof(prop));
-               prom_getstring(ledma->sdev->prom_node, "cable-selection",
-                              prop, sizeof(prop));
-               if (prop[0] == 0) {
-                       int topnd, nd;
+               prop = of_get_property(ledma_dp, "cable-selection", NULL);
+               if (!prop || prop[0] == '\0') {
+                       struct device_node *nd;
 
-                       printk(KERN_INFO "SunLance: using auto-carrier-detection.\n");
+                       printk(KERN_INFO "SunLance: using "
+                              "auto-carrier-detection.\n");
 
-                       /* Is this found at /options .attributes in all
-                        * Prom versions? XXX
-                        */
-                       topnd = prom_getchild(prom_root_node);
-
-                       nd = prom_searchsiblings(topnd, "options");
+                       nd = of_find_node_by_path("/options");
                        if (!nd)
                                goto no_link_test;
 
-                       if (!prom_node_has_property(nd, "tpe-link-test?"))
+                       prop = of_get_property(nd, "tpe-link-test?", NULL);
+                       if (!prop)
                                goto no_link_test;
 
-                       memset(prop, 0, sizeof(prop));
-                       prom_getstring(nd, "tpe-link-test?", prop,
-                                      sizeof(prop));
-
                        if (strcmp(prop, "true")) {
                                printk(KERN_NOTICE "SunLance: warning: overriding option "
                                       "'tpe-link-test?'\n");
index 61f98251feab04f428e4769c112ac8c4059e33be..ff1028a597df1b34860d53cffcf33c02e8d7c845 100644 (file)
@@ -906,7 +906,6 @@ static const struct ethtool_ops vnet_ethtool_ops = {
        .get_msglevel           = vnet_get_msglevel,
        .set_msglevel           = vnet_set_msglevel,
        .get_link               = ethtool_op_get_link,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static void vnet_port_free_tx_bufs(struct vnet_port *port)
index 7f94ca930988d08e63271469a3f3910494831259..ec41469eee82d569391780c5263d1e4e9584369b 100644 (file)
@@ -2198,7 +2198,6 @@ static const struct ethtool_ops tc35815_ethtool_ops = {
        .get_strings            = tc35815_get_strings,
        .get_stats_count        = tc35815_get_stats_count,
        .get_ethtool_stats      = tc35815_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static int tc35815_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
index 887b9a5cfe48bed9bbd6978c4bcdca8e367dfbfd..58740428dd0709fa76440d852d5d32cc1759d54d 100644 (file)
@@ -64,8 +64,8 @@
 
 #define DRV_MODULE_NAME                "tg3"
 #define PFX DRV_MODULE_NAME    ": "
-#define DRV_MODULE_VERSION     "3.79"
-#define DRV_MODULE_RELDATE     "July 18, 2007"
+#define DRV_MODULE_VERSION     "3.80"
+#define DRV_MODULE_RELDATE     "August 2, 2007"
 
 #define TG3_DEF_MAC_MODE       0
 #define TG3_DEF_RX_MODE                0
@@ -9294,7 +9294,6 @@ static const struct ethtool_ops tg3_ethtool_ops = {
        .get_ethtool_stats      = tg3_get_ethtool_stats,
        .get_coalesce           = tg3_get_coalesce,
        .set_coalesce           = tg3_set_coalesce,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static void __devinit tg3_get_eeprom_size(struct tg3 *tp)
@@ -12112,6 +12111,12 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
        struct tg3 *tp = netdev_priv(dev);
        int err;
 
+       /* PCI register 4 needs to be saved whether netif_running() or not.
+        * MSI address and data need to be saved if using MSI and
+        * netif_running().
+        */
+       pci_save_state(pdev);
+
        if (!netif_running(dev))
                return 0;
 
@@ -12131,9 +12136,6 @@ static int tg3_suspend(struct pci_dev *pdev, pm_message_t state)
        tp->tg3_flags &= ~TG3_FLAG_INIT_COMPLETE;
        tg3_full_unlock(tp);
 
-       /* Save MSI address and data for resume.  */
-       pci_save_state(pdev);
-
        err = tg3_set_power_state(tp, pci_choose_state(pdev, state));
        if (err) {
                tg3_full_lock(tp, 0);
@@ -12161,11 +12163,11 @@ static int tg3_resume(struct pci_dev *pdev)
        struct tg3 *tp = netdev_priv(dev);
        int err;
 
+       pci_restore_state(tp->pdev);
+
        if (!netif_running(dev))
                return 0;
 
-       pci_restore_state(tp->pdev);
-
        err = tg3_set_power_state(tp, PCI_D0);
        if (err)
                return err;
index f87d76981ab7c2e988593e90be9102c54cd7c9a3..eca984f89bbf6f419c156e3023ec358bc4fcb1b5 100644 (file)
@@ -1471,14 +1471,6 @@ static int __devinit tulip_init_one (struct pci_dev *pdev,
                        sa_offset = 2;          /* Grrr, damn Matrox boards. */
                        multiport_cnt = 4;
                }
-#ifdef CONFIG_DDB5477
-               if ((pdev->bus->number == 0) && (PCI_SLOT(pdev->devfn) == 4)) {
-                       /* DDB5477 MAC address in first EEPROM locations. */
-                       sa_offset = 0;
-                       /* No media table either */
-                       tp->flags &= ~HAS_MEDIA_TABLE;
-               }
-#endif
 #ifdef CONFIG_MIPS_COBALT
                if ((pdev->bus->number == 0) &&
                    ((PCI_SLOT(pdev->devfn) == 7) ||
index a8994c7b8583f204e4db8e2ebea2073c8a2b5f7e..64bef7c123654529b5a46864f872717fdde8623f 100644 (file)
@@ -379,7 +379,6 @@ static const struct ethtool_ops uec_ethtool_ops = {
        .get_stats_count        = uec_get_stats_count,
        .get_strings            = uec_get_strings,
        .get_ethtool_stats      = uec_get_ethtool_stats,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 void uec_set_ethtool_ops(struct net_device *netdev)
index 5f8c2d30a328f0342b45faff7341adfb385af7ea..6c257b88ce51ed8fc7206407e351f3c9f431c0ff 100644 (file)
@@ -272,7 +272,8 @@ int __init uec_mdio_init(void)
        return of_register_platform_driver(&uec_mdio_driver);
 }
 
-void __exit uec_mdio_exit(void)
+/* called from __init ucc_geth_init, therefore can not be __exit */
+void uec_mdio_exit(void)
 {
        of_unregister_platform_driver(&uec_mdio_driver);
 }
index a05fd97e5bc2e0c98b67664142767501611cd293..04cba6bf3d5477ffb6678e53187cde36e724f624 100644 (file)
@@ -768,11 +768,13 @@ done:
 static void write_bulk_callback(struct urb *urb)
 {
        pegasus_t *pegasus = urb->context;
-       struct net_device *net = pegasus->net;
+       struct net_device *net;
 
        if (!pegasus)
                return;
 
+       net = pegasus->net;
+
        if (!netif_device_present(net) || !netif_running(net))
                return;
 
index f51c2c138f1032e64a86bcadd599bb15f77ad7f0..b56dff26772de6a1f194b446a481c286439b7d77 100644 (file)
@@ -42,7 +42,13 @@ static int max_interrupt_work = 20;
 
 /* Set the copy breakpoint for the copy-only-tiny-frames scheme.
    Setting to > 1518 effectively disables this feature. */
+#if defined(__alpha__) || defined(__arm__) || defined(__hppa__) \
+       || defined(CONFIG_SPARC) || defined(__ia64__) \
+       || defined(__sh__) || defined(__mips__)
+static int rx_copybreak = 1518;
+#else
 static int rx_copybreak;
+#endif
 
 /* Work-around for broken BIOSes: they are unable to get the chip back out of
    power state D3 so PXE booting fails. bootparam(7): via-rhine.avoid_D3=1 */
@@ -1805,7 +1811,6 @@ static const struct ethtool_ops netdev_ethtool_ops = {
        .set_wol                = rhine_set_wol,
        .get_sg                 = ethtool_op_get_sg,
        .get_tx_csum            = ethtool_op_get_tx_csum,
-       .get_perm_addr          = ethtool_op_get_perm_addr,
 };
 
 static int netdev_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
index f331843d1102ac80839e2a46f098a7b2b51d5f67..93574add4063e6d17af9dec41e9ff57060e403c6 100644 (file)
@@ -1613,7 +1613,7 @@ static void velocity_error(struct velocity_info *vptr, int status)
        if (status & ISR_TXSTLI) {
                struct mac_regs __iomem * regs = vptr->mac_regs;
 
-               printk(KERN_ERR "TD structure errror TDindex=%hx\n", readw(&regs->TDIdx[0]));
+               printk(KERN_ERR "TD structure error TDindex=%hx\n", readw(&regs->TDIdx[0]));
                BYTE_REG_BITS_ON(TXESR_TDSTR, &regs->TXESR);
                writew(TRDCSR_RUN, &regs->TDCSRClr);
                netif_stop_queue(vptr->dev);
index 15b6e07a4382020a4d8fc9aaeb721c3dd0953732..071a64cacd5c29cdedfc959c922bea885a7a7cc2 100644 (file)
@@ -212,14 +212,13 @@ static pvc_device* add_pvc(struct net_device *dev, u16 dlci)
                pvc_p = &(*pvc_p)->next;
        }
 
-       pvc = kmalloc(sizeof(pvc_device), GFP_ATOMIC);
+       pvc = kzalloc(sizeof(pvc_device), GFP_ATOMIC);
 #ifdef DEBUG_PVC
        printk(KERN_DEBUG "add_pvc: allocated pvc %p, frad %p\n", pvc, dev);
 #endif
        if (!pvc)
                return NULL;
 
-       memset(pvc, 0, sizeof(pvc_device));
        pvc->dlci = dlci;
        pvc->frad = dev;
        pvc->next = *pvc_p;     /* Put it in the chain */
index d779199c30d056d707ea341530ce453472f09bc2..b37f1e348700c9c775dce61695bd2bde12101b6e 100644 (file)
@@ -1638,7 +1638,7 @@ void bcm43xx_phy_set_baseband_attenuation(struct bcm43xx_private *bcm,
                return;
        }
 
-       if (phy->analog == 1) {
+       if (phy->analog > 1) {
                value = bcm43xx_phy_read(bcm, 0x0060) & ~0x003C;
                value |= (baseband_attenuation << 2) & 0x003C;
        } else {
index cea85894b7f2d1882a2951313073d5c39c638f9a..e61c6d5ba1a93d26261369dfacffde1c8c5231da 100644 (file)
@@ -466,7 +466,7 @@ static int rtl8187_add_interface(struct ieee80211_hw *dev,
                return -EOPNOTSUPP;
        }
 
-       priv->hwaddr = conf->mac_addr;
+       priv->hwaddr = conf->mac_addr ? conf->mac_addr : dev->wiphy->perm_addr;
 
        return 0;
 }
index f6c487aa8246ac12a2143f9c891801659dd8acaf..26869d107e52acbc4c04b322272b0806cea74ca2 100644 (file)
@@ -822,7 +822,7 @@ static void cs_set_control(struct zd_mac *mac, struct zd_ctrlset *cs,
                cs->control |= ZD_CS_MULTICAST;
 
        /* PS-POLL */
-       if (stype == IEEE80211_STYPE_PSPOLL)
+       if (ftype == IEEE80211_FTYPE_CTL && stype == IEEE80211_STYPE_PSPOLL)
                cs->control |= ZD_CS_PS_POLL_FRAME;
 
        /* Unicast data frames over the threshold should have RTS */
index 489f69c5d6ca057f671c8d78faa42c1683814e62..4445810335a8ef7dff90f4c01683308d12e66c73 100644 (file)
@@ -566,6 +566,10 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
        if (notify)
                notify_remote_via_irq(np->netdev->irq);
 
+       np->stats.tx_bytes += skb->len;
+       np->stats.tx_packets++;
+
+       /* Note: It is not safe to access skb after xennet_tx_buf_gc()! */
        xennet_tx_buf_gc(dev);
 
        if (!netfront_tx_slot_available(np))
@@ -573,9 +577,6 @@ static int xennet_start_xmit(struct sk_buff *skb, struct net_device *dev)
 
        spin_unlock_irq(&np->tx_lock);
 
-       np->stats.tx_bytes += skb->len;
-       np->stats.tx_packets++;
-
        return 0;
 
  drop:
index 5d58ad55d85c65d4c0d379b19bacfde13e931aab..e2be84001105588a8939625fc3aecde88d7211d0 100644 (file)
@@ -3445,7 +3445,6 @@ static void __exit parport_pc_exit(void)
                pnp_unregister_driver (&parport_pc_pnp_driver);
        platform_driver_unregister(&parport_pc_platform_driver);
 
-       spin_lock(&ports_lock);
        while (!list_empty(&ports_list)) {
                struct parport_pc_private *priv;
                struct parport *port;
@@ -3455,11 +3454,8 @@ static void __exit parport_pc_exit(void)
                if (port->dev && port->dev->bus == &platform_bus_type)
                        platform_device_unregister(
                                to_platform_device(port->dev));
-               spin_unlock(&ports_lock);
                parport_pc_unregister_port(port);
-               spin_lock(&ports_lock);
        }
-       spin_unlock(&ports_lock);
 }
 
 MODULE_AUTHOR("Phil Blundell, Tim Waugh, others");
index 67c63d1f15829453941f94f3283d0bef1da421f1..5c6a5d043007ebec1418fe2d9a70cf5071cc06eb 100644 (file)
@@ -220,6 +220,7 @@ acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
 }
 EXPORT_SYMBOL(pci_osc_control_set);
 
+#ifdef CONFIG_ACPI_SLEEP
 /*
  * _SxD returns the D-state with the highest power
  * (lowest D-state number) supported in the S-state "x".
@@ -267,6 +268,7 @@ static pci_power_t acpi_pci_choose_state(struct pci_dev *pdev,
        }
        return PCI_POWER_ERROR;
 }
+#endif
 
 static int acpi_pci_set_power_state(struct pci_dev *dev, pci_power_t state)
 {
@@ -340,7 +342,9 @@ static int __init acpi_pci_init(void)
        ret = register_acpi_bus_type(&acpi_pci_bus);
        if (ret)
                return 0;
+#ifdef CONFIG_ACPI_SLEEP
        platform_pci_choose_state = acpi_pci_choose_state;
+#endif
        platform_pci_set_power_state = acpi_pci_set_power_state;
        return 0;
 }
index 8e58ea3d95c09fab4c72656a616a33cd5c73f84a..004bc248727096b3702b5b8e3f02fc89b6cb8ef1 100644 (file)
@@ -310,7 +310,7 @@ static int pci_default_resume(struct pci_dev *pci_dev)
        /* restore the PCI config space */
        pci_restore_state(pci_dev);
        /* if the device was enabled before suspend, reenable */
-       retval = __pci_reenable_device(pci_dev);
+       retval = pci_reenable_device(pci_dev);
        /* if the device was busmaster before the suspend, make it busmaster again */
        if (pci_dev->is_busmaster)
                pci_set_master(pci_dev);
index fba319d6fcc86bf178be1cc531e0d227adff0a6c..37c00f6fd8010d3dc7b0b4582fea08394e20317f 100644 (file)
@@ -695,14 +695,13 @@ static int do_pci_enable_device(struct pci_dev *dev, int bars)
 }
 
 /**
- * __pci_reenable_device - Resume abandoned device
+ * pci_reenable_device - Resume abandoned device
  * @dev: PCI device to be resumed
  *
  *  Note this function is a backend of pci_default_resume and is not supposed
  *  to be called by normal code, write proper resume handler and use it instead.
  */
-int
-__pci_reenable_device(struct pci_dev *dev)
+int pci_reenable_device(struct pci_dev *dev)
 {
        if (atomic_read(&dev->enable_cnt))
                return do_pci_enable_device(dev, (1 << PCI_NUM_RESOURCES) - 1);
@@ -1517,7 +1516,7 @@ EXPORT_SYMBOL(pcie_get_readrq);
 /**
  * pcie_set_readrq - set PCI Express maximum memory read request
  * @dev: PCI device to query
- * @count: maximum memory read count in bytes
+ * @rq: maximum memory read count in bytes
  *    valid values are 128, 256, 512, 1024, 2048, 4096
  *
  * If possible sets maximum read byte count
@@ -1604,7 +1603,7 @@ early_param("pci", pci_setup);
 device_initcall(pci_init);
 
 EXPORT_SYMBOL_GPL(pci_restore_bars);
-EXPORT_SYMBOL(__pci_reenable_device);
+EXPORT_SYMBOL(pci_reenable_device);
 EXPORT_SYMBOL(pci_enable_device_bars);
 EXPORT_SYMBOL(pci_enable_device);
 EXPORT_SYMBOL(pcim_enable_device);
index 7c93a108f9b81f4c88ba67ae1a5f0686fc003b6a..f8b13f0270d744f87d766072599de14760aa821e 100644 (file)
@@ -409,6 +409,9 @@ static void socket_shutdown(struct pcmcia_socket *s)
 #endif
        s->functions = 0;
 
+       /* give socket some time to power down */
+       msleep(100);
+
        s->ops->get_status(s, &status);
        if (status & SS_POWERON) {
                printk(KERN_ERR "PCMCIA: socket %p: *** DANGER *** unable to remove socket power\n", s);
index dd6384b1efce13d01f5fec8fd2125b1114ae345e..b6a4f02b01d13b8a824c58adb7b0b95fb274e441 100644 (file)
@@ -2,7 +2,6 @@
  * card.c - contains functions for managing groups of PnP devices
  *
  * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #include <linux/module.h>
 LIST_HEAD(pnp_cards);
 static LIST_HEAD(pnp_card_drivers);
 
-
-static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv, struct pnp_card * card)
+static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
+                                                  struct pnp_card *card)
 {
-       const struct pnp_card_device_id * drv_id = drv->id_table;
-       while (*drv_id->id){
-               if (compare_pnp_id(card->id,drv_id->id)) {
+       const struct pnp_card_device_id *drv_id = drv->id_table;
+
+       while (*drv_id->id) {
+               if (compare_pnp_id(card->id, drv_id->id)) {
                        int i = 0;
+
                        for (;;) {
                                int found;
                                struct pnp_dev *dev;
-                               if (i == PNP_MAX_DEVICES || ! *drv_id->devs[i].id)
+
+                               if (i == PNP_MAX_DEVICES
+                                   || !*drv_id->devs[i].id)
                                        return drv_id;
                                found = 0;
                                card_for_each_dev(card, dev) {
-                                       if (compare_pnp_id(dev->id, drv_id->devs[i].id)) {
+                                       if (compare_pnp_id
+                                           (dev->id, drv_id->devs[i].id)) {
                                                found = 1;
                                                break;
                                        }
                                }
-                               if (! found)
+                               if (!found)
                                        break;
                                i++;
                        }
@@ -42,14 +46,15 @@ static const struct pnp_card_device_id * match_card(struct pnp_card_driver * drv
        return NULL;
 }
 
-static void card_remove(struct pnp_dev * dev)
+static void card_remove(struct pnp_dev *dev)
 {
        dev->card_link = NULL;
 }
 
-static void card_remove_first(struct pnp_dev * dev)
+static void card_remove_first(struct pnp_dev *dev)
 {
-       struct pnp_card_driver * drv = to_pnp_card_driver(dev->driver);
+       struct pnp_card_driver *drv = to_pnp_card_driver(dev->driver);
+
        if (!dev->card || !drv)
                return;
        if (drv->remove)
@@ -67,7 +72,7 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
 
        if (!drv->probe)
                return 0;
-       id = match_card(drv,card);
+       id = match_card(drv, card);
        if (!id)
                return 0;
 
@@ -94,12 +99,11 @@ static int card_probe(struct pnp_card *card, struct pnp_card_driver *drv)
  * pnp_add_card_id - adds an EISA id to the specified card
  * @id: pointer to a pnp_id structure
  * @card: pointer to the desired card
- *
  */
-
-int pnp_add_card_id(struct pnp_id *id, struct pnp_card * card)
+int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card)
 {
-       struct pnp_id * ptr;
+       struct pnp_id *ptr;
+
        if (!id)
                return -EINVAL;
        if (!card)
@@ -115,10 +119,11 @@ int pnp_add_card_id(struct pnp_id *id, struct pnp_card * card)
        return 0;
 }
 
-static void pnp_free_card_ids(struct pnp_card * card)
+static void pnp_free_card_ids(struct pnp_card *card)
 {
-       struct pnp_id * id;
+       struct pnp_id *id;
        struct pnp_id *next;
+
        if (!card)
                return;
        id = card->id;
@@ -131,49 +136,55 @@ static void pnp_free_card_ids(struct pnp_card * card)
 
 static void pnp_release_card(struct device *dmdev)
 {
-       struct pnp_card * card = to_pnp_card(dmdev);
+       struct pnp_card *card = to_pnp_card(dmdev);
+
        pnp_free_card_ids(card);
        kfree(card);
 }
 
-
-static ssize_t pnp_show_card_name(struct device *dmdev, struct device_attribute *attr, char *buf)
+static ssize_t pnp_show_card_name(struct device *dmdev,
+                                 struct device_attribute *attr, char *buf)
 {
        char *str = buf;
        struct pnp_card *card = to_pnp_card(dmdev);
-       str += sprintf(str,"%s\n", card->name);
+
+       str += sprintf(str, "%s\n", card->name);
        return (str - buf);
 }
 
-static DEVICE_ATTR(name,S_IRUGO,pnp_show_card_name,NULL);
+static DEVICE_ATTR(name, S_IRUGO, pnp_show_card_name, NULL);
 
-static ssize_t pnp_show_card_ids(struct device *dmdev, struct device_attribute *attr, char *buf)
+static ssize_t pnp_show_card_ids(struct device *dmdev,
+                                struct device_attribute *attr, char *buf)
 {
        char *str = buf;
        struct pnp_card *card = to_pnp_card(dmdev);
-       struct pnp_id * pos = card->id;
+       struct pnp_id *pos = card->id;
 
        while (pos) {
-               str += sprintf(str,"%s\n", pos->id);
+               str += sprintf(str, "%s\n", pos->id);
                pos = pos->next;
        }
        return (str - buf);
 }
 
-static DEVICE_ATTR(card_id,S_IRUGO,pnp_show_card_ids,NULL);
+static DEVICE_ATTR(card_id, S_IRUGO, pnp_show_card_ids, NULL);
 
 static int pnp_interface_attach_card(struct pnp_card *card)
 {
-       int rc = device_create_file(&card->dev,&dev_attr_name);
-       if (rc) return rc;
+       int rc = device_create_file(&card->dev, &dev_attr_name);
 
-       rc = device_create_file(&card->dev,&dev_attr_card_id);
-       if (rc) goto err_name;
+       if (rc)
+               return rc;
+
+       rc = device_create_file(&card->dev, &dev_attr_card_id);
+       if (rc)
+               goto err_name;
 
        return 0;
 
-err_name:
-       device_remove_file(&card->dev,&dev_attr_name);
+      err_name:
+       device_remove_file(&card->dev, &dev_attr_name);
        return rc;
 }
 
@@ -181,15 +192,16 @@ err_name:
  * pnp_add_card - adds a PnP card to the PnP Layer
  * @card: pointer to the card to add
  */
-
-int pnp_add_card(struct pnp_card * card)
+int pnp_add_card(struct pnp_card *card)
 {
        int error;
-       struct list_head * pos, * temp;
+       struct list_head *pos, *temp;
+
        if (!card || !card->protocol)
                return -EINVAL;
 
-       sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, card->number);
+       sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number,
+               card->number);
        card->dev.parent = &card->protocol->dev;
        card->dev.bus = NULL;
        card->dev.release = &pnp_release_card;
@@ -205,18 +217,21 @@ int pnp_add_card(struct pnp_card * card)
                /* we wait until now to add devices in order to ensure the drivers
                 * will be able to use all of the related devices on the card
                 * without waiting any unresonable length of time */
-               list_for_each(pos,&card->devices){
+               list_for_each(pos, &card->devices) {
                        struct pnp_dev *dev = card_to_pnp_dev(pos);
                        __pnp_add_device(dev);
                }
 
                /* match with card drivers */
-               list_for_each_safe(pos,temp,&pnp_card_drivers){
-                       struct pnp_card_driver * drv = list_entry(pos, struct pnp_card_driver, global_list);
-                       card_probe(card,drv);
+               list_for_each_safe(pos, temp, &pnp_card_drivers) {
+                       struct pnp_card_driver *drv =
+                           list_entry(pos, struct pnp_card_driver,
+                                      global_list);
+                       card_probe(card, drv);
                }
        } else
-               pnp_err("sysfs failure, card '%s' will be unavailable", card->dev.bus_id);
+               pnp_err("sysfs failure, card '%s' will be unavailable",
+                       card->dev.bus_id);
        return error;
 }
 
@@ -224,10 +239,10 @@ int pnp_add_card(struct pnp_card * card)
  * pnp_remove_card - removes a PnP card from the PnP Layer
  * @card: pointer to the card to remove
  */
-
-void pnp_remove_card(struct pnp_card * card)
+void pnp_remove_card(struct pnp_card *card)
 {
        struct list_head *pos, *temp;
+
        if (!card)
                return;
        device_unregister(&card->dev);
@@ -235,7 +250,7 @@ void pnp_remove_card(struct pnp_card * card)
        list_del(&card->global_list);
        list_del(&card->protocol_list);
        spin_unlock(&pnp_lock);
-       list_for_each_safe(pos,temp,&card->devices){
+       list_for_each_safe(pos, temp, &card->devices) {
                struct pnp_dev *dev = card_to_pnp_dev(pos);
                pnp_remove_card_device(dev);
        }
@@ -246,15 +261,14 @@ void pnp_remove_card(struct pnp_card * card)
  * @card: pointer to the card to add to
  * @dev: pointer to the device to add
  */
-
-int pnp_add_card_device(struct pnp_card * card, struct pnp_dev * dev)
+int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev)
 {
        if (!card || !dev || !dev->protocol)
                return -EINVAL;
        dev->dev.parent = &card->dev;
        dev->card_link = NULL;
-       snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", dev->protocol->number,
-                card->number,dev->number);
+       snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x",
+                dev->protocol->number, card->number, dev->number);
        spin_lock(&pnp_lock);
        dev->card = card;
        list_add_tail(&dev->card_list, &card->devices);
@@ -266,8 +280,7 @@ int pnp_add_card_device(struct pnp_card * card, struct pnp_dev * dev)
  * pnp_remove_card_device- removes a device from the specified card
  * @dev: pointer to the device to remove
  */
-
-void pnp_remove_card_device(struct pnp_dev * dev)
+void pnp_remove_card_device(struct pnp_dev *dev)
 {
        spin_lock(&pnp_lock);
        dev->card = NULL;
@@ -282,13 +295,14 @@ void pnp_remove_card_device(struct pnp_dev * dev)
  * @id: pointer to a PnP ID structure that explains the rules for finding the device
  * @from: Starting place to search from. If NULL it will start from the begining.
  */
-
-struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from)
+struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
+                                       const char *id, struct pnp_dev *from)
 {
-       struct list_head * pos;
-       struct pnp_dev * dev;
-       struct pnp_card_driver * drv;
-       struct pnp_card * card;
+       struct list_head *pos;
+       struct pnp_dev *dev;
+       struct pnp_card_driver *drv;
+       struct pnp_card *card;
+
        if (!clink || !id)
                goto done;
        card = clink->card;
@@ -302,15 +316,15 @@ struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char
        }
        while (pos != &card->devices) {
                dev = card_to_pnp_dev(pos);
-               if ((!dev->card_link) && compare_pnp_id(dev->id,id))
+               if ((!dev->card_link) && compare_pnp_id(dev->id, id))
                        goto found;
                pos = pos->next;
        }
 
-done:
+      done:
        return NULL;
 
-found:
+      found:
        dev->card_link = clink;
        dev->dev.driver = &drv->link.driver;
        if (pnp_bus_type.probe(&dev->dev))
@@ -320,7 +334,7 @@ found:
 
        return dev;
 
-err_out:
+      err_out:
        dev->dev.driver = NULL;
        dev->card_link = NULL;
        return NULL;
@@ -330,10 +344,10 @@ err_out:
  * pnp_release_card_device - call this when the driver no longer needs the device
  * @dev: pointer to the PnP device stucture
  */
-
-void pnp_release_card_device(struct pnp_dev * dev)
+void pnp_release_card_device(struct pnp_dev *dev)
 {
-       struct pnp_card_driver * drv = dev->card_link->driver;
+       struct pnp_card_driver *drv = dev->card_link->driver;
+
        if (!drv)
                return;
        drv->link.remove = &card_remove;
@@ -347,6 +361,7 @@ void pnp_release_card_device(struct pnp_dev * dev)
 static int card_suspend(struct pnp_dev *dev, pm_message_t state)
 {
        struct pnp_card_link *link = dev->card_link;
+
        if (link->pm_state.event == state.event)
                return 0;
        link->pm_state = state;
@@ -356,6 +371,7 @@ static int card_suspend(struct pnp_dev *dev, pm_message_t state)
 static int card_resume(struct pnp_dev *dev)
 {
        struct pnp_card_link *link = dev->card_link;
+
        if (link->pm_state.event == PM_EVENT_ON)
                return 0;
        link->pm_state = PMSG_ON;
@@ -367,8 +383,7 @@ static int card_resume(struct pnp_dev *dev)
  * pnp_register_card_driver - registers a PnP card driver with the PnP Layer
  * @drv: pointer to the driver to register
  */
-
-int pnp_register_card_driver(struct pnp_card_driver * drv)
+int pnp_register_card_driver(struct pnp_card_driver *drv)
 {
        int error;
        struct list_head *pos, *temp;
@@ -389,9 +404,10 @@ int pnp_register_card_driver(struct pnp_card_driver * drv)
        list_add_tail(&drv->global_list, &pnp_card_drivers);
        spin_unlock(&pnp_lock);
 
-       list_for_each_safe(pos,temp,&pnp_cards){
-               struct pnp_card *card = list_entry(pos, struct pnp_card, global_list);
-               card_probe(card,drv);
+       list_for_each_safe(pos, temp, &pnp_cards) {
+               struct pnp_card *card =
+                   list_entry(pos, struct pnp_card, global_list);
+               card_probe(card, drv);
        }
        return 0;
 }
@@ -400,8 +416,7 @@ int pnp_register_card_driver(struct pnp_card_driver * drv)
  * pnp_unregister_card_driver - unregisters a PnP card driver from the PnP Layer
  * @drv: pointer to the driver to unregister
  */
-
-void pnp_unregister_card_driver(struct pnp_card_driver * drv)
+void pnp_unregister_card_driver(struct pnp_card_driver *drv)
 {
        spin_lock(&pnp_lock);
        list_del(&drv->global_list);
@@ -409,13 +424,6 @@ void pnp_unregister_card_driver(struct pnp_card_driver * drv)
        pnp_unregister_driver(&drv->link);
 }
 
-#if 0
-EXPORT_SYMBOL(pnp_add_card);
-EXPORT_SYMBOL(pnp_remove_card);
-EXPORT_SYMBOL(pnp_add_card_device);
-EXPORT_SYMBOL(pnp_remove_card_device);
-EXPORT_SYMBOL(pnp_add_card_id);
-#endif  /*  0  */
 EXPORT_SYMBOL(pnp_request_card_device);
 EXPORT_SYMBOL(pnp_release_card_device);
 EXPORT_SYMBOL(pnp_register_card_driver);
index 8e7b2dd3881086de3d95a8c6d9f34357827306a1..61066fdb9e6ddac8237281cfaecb81d55dc246d3 100644 (file)
@@ -2,7 +2,6 @@
  * core.c - contains all core device and protocol registration functions
  *
  * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #include <linux/pnp.h>
@@ -18,7 +17,6 @@
 
 #include "base.h"
 
-
 static LIST_HEAD(pnp_protocols);
 LIST_HEAD(pnp_global);
 DEFINE_SPINLOCK(pnp_lock);
@@ -36,7 +34,7 @@ void *pnp_alloc(long size)
        void *result;
 
        result = kzalloc(size, GFP_KERNEL);
-       if (!result){
+       if (!result) {
                printk(KERN_ERR "pnp: Out of Memory\n");
                return NULL;
        }
@@ -49,11 +47,10 @@ void *pnp_alloc(long size)
  *
  *  Ex protocols: ISAPNP, PNPBIOS, etc
  */
-
 int pnp_register_protocol(struct pnp_protocol *protocol)
 {
        int nodenum;
-       struct list_head * pos;
+       struct list_head *pos;
 
        if (!protocol)
                return -EINVAL;
@@ -64,9 +61,9 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
        spin_lock(&pnp_lock);
 
        /* assign the lowest unused number */
-       list_for_each(pos,&pnp_protocols) {
-               struct pnp_protocol * cur = to_pnp_protocol(pos);
-               if (cur->number == nodenum){
+       list_for_each(pos, &pnp_protocols) {
+               struct pnp_protocol *cur = to_pnp_protocol(pos);
+               if (cur->number == nodenum) {
                        pos = &pnp_protocols;
                        nodenum++;
                }
@@ -83,7 +80,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
 /**
  * pnp_protocol_unregister - removes a pnp protocol from the pnp layer
  * @protocol: pointer to the corresponding pnp_protocol structure
- *
  */
 void pnp_unregister_protocol(struct pnp_protocol *protocol)
 {
@@ -93,11 +89,11 @@ void pnp_unregister_protocol(struct pnp_protocol *protocol)
        device_unregister(&protocol->dev);
 }
 
-
 static void pnp_free_ids(struct pnp_dev *dev)
 {
-       struct pnp_id * id;
-       struct pnp_id * next;
+       struct pnp_id *id;
+       struct pnp_id *next;
+
        if (!dev)
                return;
        id = dev->id;
@@ -110,7 +106,8 @@ static void pnp_free_ids(struct pnp_dev *dev)
 
 static void pnp_release_device(struct device *dmdev)
 {
-       struct pnp_dev * dev = to_pnp_dev(dmdev);
+       struct pnp_dev *dev = to_pnp_dev(dmdev);
+
        pnp_free_option(dev->independent);
        pnp_free_option(dev->dependent);
        pnp_free_ids(dev);
@@ -120,6 +117,7 @@ static void pnp_release_device(struct device *dmdev)
 int __pnp_add_device(struct pnp_dev *dev)
 {
        int ret;
+
        pnp_fixup_device(dev);
        dev->dev.bus = &pnp_bus_type;
        dev->dev.dma_mask = &dev->dma_mask;
@@ -143,13 +141,13 @@ int __pnp_add_device(struct pnp_dev *dev)
  *
  *  adds to driver model, name database, fixups, interface, etc.
  */
-
 int pnp_add_device(struct pnp_dev *dev)
 {
        if (!dev || !dev->protocol || dev->card)
                return -EINVAL;
        dev->dev.parent = &dev->protocol->dev;
-       sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, dev->number);
+       sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
+               dev->number);
        return __pnp_add_device(dev);
 }
 
@@ -162,21 +160,6 @@ void __pnp_remove_device(struct pnp_dev *dev)
        device_unregister(&dev->dev);
 }
 
-/**
- * pnp_remove_device - removes a pnp device from the pnp layer
- * @dev: pointer to dev to add
- *
- * this function will free all mem used by dev
- */
-#if 0
-void pnp_remove_device(struct pnp_dev *dev)
-{
-       if (!dev || dev->card)
-               return;
-       __pnp_remove_device(dev);
-}
-#endif  /*  0  */
-
 static int __init pnp_init(void)
 {
        printk(KERN_INFO "Linux Plug and Play Support v0.97 (c) Adam Belay\n");
@@ -184,10 +167,3 @@ static int __init pnp_init(void)
 }
 
 subsys_initcall(pnp_init);
-
-#if 0
-EXPORT_SYMBOL(pnp_register_protocol);
-EXPORT_SYMBOL(pnp_unregister_protocol);
-EXPORT_SYMBOL(pnp_add_device);
-EXPORT_SYMBOL(pnp_remove_device);
-#endif  /*  0  */
index 1432806451cd03cf751d2f3e9c896582bd7571cd..30b8f6f3258afa48bf546e297d79014daacb877d 100644 (file)
@@ -2,7 +2,6 @@
  * driver.c - device id matching, driver model, etc.
  *
  * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #include <linux/string.h>
 static int compare_func(const char *ida, const char *idb)
 {
        int i;
+
        /* we only need to compare the last 4 chars */
-       for (i=3; i<7; i++)
-       {
+       for (i = 3; i < 7; i++) {
                if (ida[i] != 'X' &&
-                   idb[i] != 'X' &&
-                   toupper(ida[i]) != toupper(idb[i]))
+                   idb[i] != 'X' && toupper(ida[i]) != toupper(idb[i]))
                        return 0;
        }
        return 1;
@@ -31,20 +29,22 @@ int compare_pnp_id(struct pnp_id *pos, const char *id)
 {
        if (!pos || !id || (strlen(id) != 7))
                return 0;
-       if (memcmp(id,"ANYDEVS",7)==0)
+       if (memcmp(id, "ANYDEVS", 7) == 0)
                return 1;
-       while (pos){
-               if (memcmp(pos->id,id,3)==0)
-                       if (compare_func(pos->id,id)==1)
+       while (pos) {
+               if (memcmp(pos->id, id, 3) == 0)
+                       if (compare_func(pos->id, id) == 1)
                                return 1;
                pos = pos->next;
        }
        return 0;
 }
 
-static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct pnp_dev *dev)
+static const struct pnp_device_id *match_device(struct pnp_driver *drv,
+                                               struct pnp_dev *dev)
 {
        const struct pnp_device_id *drv_id = drv->id_table;
+
        if (!drv_id)
                return NULL;
 
@@ -59,7 +59,7 @@ static const struct pnp_device_id * match_device(struct pnp_driver *drv, struct
 int pnp_device_attach(struct pnp_dev *pnp_dev)
 {
        spin_lock(&pnp_lock);
-       if(pnp_dev->status != PNP_READY){
+       if (pnp_dev->status != PNP_READY) {
                spin_unlock(&pnp_lock);
                return -EBUSY;
        }
@@ -86,7 +86,8 @@ static int pnp_device_probe(struct device *dev)
        pnp_dev = to_pnp_dev(dev);
        pnp_drv = to_pnp_driver(dev->driver);
 
-       pnp_dbg("match found with the PnP device '%s' and the driver '%s'", dev->bus_id,pnp_drv->name);
+       pnp_dbg("match found with the PnP device '%s' and the driver '%s'",
+               dev->bus_id, pnp_drv->name);
 
        error = pnp_device_attach(pnp_dev);
        if (error < 0)
@@ -99,7 +100,7 @@ static int pnp_device_probe(struct device *dev)
                                return error;
                }
        } else if ((pnp_drv->flags & PNP_DRIVER_RES_DISABLE)
-                   == PNP_DRIVER_RES_DISABLE) {
+                  == PNP_DRIVER_RES_DISABLE) {
                error = pnp_disable_dev(pnp_dev);
                if (error < 0)
                        return error;
@@ -110,22 +111,22 @@ static int pnp_device_probe(struct device *dev)
                if (dev_id != NULL)
                        error = pnp_drv->probe(pnp_dev, dev_id);
        }
-       if (error >= 0){
+       if (error >= 0) {
                pnp_dev->driver = pnp_drv;
                error = 0;
        } else
                goto fail;
        return error;
 
-fail:
+      fail:
        pnp_device_detach(pnp_dev);
        return error;
 }
 
 static int pnp_device_remove(struct device *dev)
 {
-       struct pnp_dev * pnp_dev = to_pnp_dev(dev);
-       struct pnp_driver * drv = pnp_dev->driver;
+       struct pnp_dev *pnp_dev = to_pnp_dev(dev);
+       struct pnp_driver *drv = pnp_dev->driver;
 
        if (drv) {
                if (drv->remove)
@@ -138,8 +139,9 @@ static int pnp_device_remove(struct device *dev)
 
 static int pnp_bus_match(struct device *dev, struct device_driver *drv)
 {
-       struct pnp_dev * pnp_dev = to_pnp_dev(dev);
-       struct pnp_driver * pnp_drv = to_pnp_driver(drv);
+       struct pnp_dev *pnp_dev = to_pnp_dev(dev);
+       struct pnp_driver *pnp_drv = to_pnp_driver(drv);
+
        if (match_device(pnp_drv, pnp_dev) == NULL)
                return 0;
        return 1;
@@ -147,8 +149,8 @@ static int pnp_bus_match(struct device *dev, struct device_driver *drv)
 
 static int pnp_bus_suspend(struct device *dev, pm_message_t state)
 {
-       struct pnp_dev * pnp_dev = to_pnp_dev(dev);
-       struct pnp_driver * pnp_drv = pnp_dev->driver;
+       struct pnp_dev *pnp_dev = to_pnp_dev(dev);
+       struct pnp_driver *pnp_drv = pnp_dev->driver;
        int error;
 
        if (!pnp_drv)
@@ -162,9 +164,9 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
 
        if (!(pnp_drv->flags & PNP_DRIVER_RES_DO_NOT_CHANGE) &&
            pnp_can_disable(pnp_dev)) {
-               error = pnp_stop_dev(pnp_dev);
-               if (error)
-                       return error;
+               error = pnp_stop_dev(pnp_dev);
+               if (error)
+                       return error;
        }
 
        if (pnp_dev->protocol && pnp_dev->protocol->suspend)
@@ -174,8 +176,8 @@ static int pnp_bus_suspend(struct device *dev, pm_message_t state)
 
 static int pnp_bus_resume(struct device *dev)
 {
-       struct pnp_dev * pnp_dev = to_pnp_dev(dev);
-       struct pnp_driver * pnp_drv = pnp_dev->driver;
+       struct pnp_dev *pnp_dev = to_pnp_dev(dev);
+       struct pnp_driver *pnp_drv = pnp_dev->driver;
        int error;
 
        if (!pnp_drv)
@@ -197,12 +199,12 @@ static int pnp_bus_resume(struct device *dev)
 }
 
 struct bus_type pnp_bus_type = {
-       .name   = "pnp",
-       .match  = pnp_bus_match,
-       .probe  = pnp_device_probe,
-       .remove = pnp_device_remove,
+       .name    = "pnp",
+       .match   = pnp_bus_match,
+       .probe   = pnp_device_probe,
+       .remove  = pnp_device_remove,
        .suspend = pnp_bus_suspend,
-       .resume = pnp_bus_resume,
+       .resume  = pnp_bus_resume,
 };
 
 int pnp_register_driver(struct pnp_driver *drv)
@@ -225,12 +227,11 @@ void pnp_unregister_driver(struct pnp_driver *drv)
  * pnp_add_id - adds an EISA id to the specified device
  * @id: pointer to a pnp_id structure
  * @dev: pointer to the desired device
- *
  */
-
 int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
 {
        struct pnp_id *ptr;
+
        if (!id)
                return -EINVAL;
        if (!dev)
@@ -248,8 +249,5 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
 
 EXPORT_SYMBOL(pnp_register_driver);
 EXPORT_SYMBOL(pnp_unregister_driver);
-#if 0
-EXPORT_SYMBOL(pnp_add_id);
-#endif
 EXPORT_SYMBOL(pnp_device_attach);
 EXPORT_SYMBOL(pnp_device_detach);
index ac9fcd499f3f0cb9912dee2e1400e6f1f519aad3..fe6684e13e828b0ebcf695b7327ba9b14e339e0c 100644 (file)
@@ -3,7 +3,6 @@
  *
  * Some code, especially possible resource dumping is based on isapnp_proc.c (c) Jaroslav Kysela <perex@suse.cz>
  * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #include <linux/pnp.h>
@@ -29,7 +28,7 @@ struct pnp_info_buffer {
 
 typedef struct pnp_info_buffer pnp_info_buffer_t;
 
-static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt,...)
+static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt, ...)
 {
        va_list args;
        int res;
@@ -48,14 +47,18 @@ static int pnp_printf(pnp_info_buffer_t * buffer, char *fmt,...)
        return res;
 }
 
-static void pnp_print_port(pnp_info_buffer_t *buffer, char *space, struct pnp_port *port)
+static void pnp_print_port(pnp_info_buffer_t * buffer, char *space,
+                          struct pnp_port *port)
 {
-       pnp_printf(buffer, "%sport 0x%x-0x%x, align 0x%x, size 0x%x, %i-bit address decoding\n",
-                       space, port->min, port->max, port->align ? (port->align-1) : 0, port->size,
-                       port->flags & PNP_PORT_FLAG_16BITADDR ? 16 : 10);
+       pnp_printf(buffer,
+                  "%sport 0x%x-0x%x, align 0x%x, size 0x%x, %i-bit address decoding\n",
+                  space, port->min, port->max,
+                  port->align ? (port->align - 1) : 0, port->size,
+                  port->flags & PNP_PORT_FLAG_16BITADDR ? 16 : 10);
 }
 
-static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq *irq)
+static void pnp_print_irq(pnp_info_buffer_t * buffer, char *space,
+                         struct pnp_irq *irq)
 {
        int first = 1, i;
 
@@ -85,14 +88,15 @@ static void pnp_print_irq(pnp_info_buffer_t *buffer, char *space, struct pnp_irq
        pnp_printf(buffer, "\n");
 }
 
-static void pnp_print_dma(pnp_info_buffer_t *buffer, char *space, struct pnp_dma *dma)
+static void pnp_print_dma(pnp_info_buffer_t * buffer, char *space,
+                         struct pnp_dma *dma)
 {
        int first = 1, i;
        char *s;
 
        pnp_printf(buffer, "%sdma ", space);
        for (i = 0; i < 8; i++)
-               if (dma->map & (1<<i)) {
+               if (dma->map & (1 << i)) {
                        if (!first) {
                                pnp_printf(buffer, ",");
                        } else {
@@ -136,12 +140,13 @@ static void pnp_print_dma(pnp_info_buffer_t *buffer, char *space, struct pnp_dma
        pnp_printf(buffer, " %s\n", s);
 }
 
-static void pnp_print_mem(pnp_info_buffer_t *buffer, char *space, struct pnp_mem *mem)
+static void pnp_print_mem(pnp_info_buffer_t * buffer, char *space,
+                         struct pnp_mem *mem)
 {
        char *s;
 
        pnp_printf(buffer, "%sMemory 0x%x-0x%x, align 0x%x, size 0x%x",
-                       space, mem->min, mem->max, mem->align, mem->size);
+                  space, mem->min, mem->max, mem->align, mem->size);
        if (mem->flags & IORESOURCE_MEM_WRITEABLE)
                pnp_printf(buffer, ", writeable");
        if (mem->flags & IORESOURCE_MEM_CACHEABLE)
@@ -168,7 +173,7 @@ static void pnp_print_mem(pnp_info_buffer_t *buffer, char *space, struct pnp_mem
        pnp_printf(buffer, ", %s\n", s);
 }
 
-static void pnp_print_option(pnp_info_buffer_t *buffer, char *space,
+static void pnp_print_option(pnp_info_buffer_t * buffer, char *space,
                             struct pnp_option *option, int dep)
 {
        char *s;
@@ -179,19 +184,19 @@ static void pnp_print_option(pnp_info_buffer_t *buffer, char *space,
 
        if (dep) {
                switch (option->priority) {
-                       case PNP_RES_PRIORITY_PREFERRED:
+               case PNP_RES_PRIORITY_PREFERRED:
                        s = "preferred";
                        break;
-                       case PNP_RES_PRIORITY_ACCEPTABLE:
+               case PNP_RES_PRIORITY_ACCEPTABLE:
                        s = "acceptable";
                        break;
-                       case PNP_RES_PRIORITY_FUNCTIONAL:
+               case PNP_RES_PRIORITY_FUNCTIONAL:
                        s = "functional";
                        break;
-                       default:
+               default:
                        s = "invalid";
                }
-               pnp_printf(buffer, "Dependent: %02i - Priority %s\n",dep, s);
+               pnp_printf(buffer, "Dependent: %02i - Priority %s\n", dep, s);
        }
 
        for (port = option->port; port; port = port->next)
@@ -204,16 +209,16 @@ static void pnp_print_option(pnp_info_buffer_t *buffer, char *space,
                pnp_print_mem(buffer, space, mem);
 }
 
-
-static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *attr, char *buf)
+static ssize_t pnp_show_options(struct device *dmdev,
+                               struct device_attribute *attr, char *buf)
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
-       struct pnp_option * independent = dev->independent;
-       struct pnp_option * dependent = dev->dependent;
+       struct pnp_option *independent = dev->independent;
+       struct pnp_option *dependent = dev->dependent;
        int ret, dep = 1;
 
        pnp_info_buffer_t *buffer = (pnp_info_buffer_t *)
-                                pnp_alloc(sizeof(pnp_info_buffer_t));
+           pnp_alloc(sizeof(pnp_info_buffer_t));
        if (!buffer)
                return -ENOMEM;
 
@@ -223,7 +228,7 @@ static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *a
        if (independent)
                pnp_print_option(buffer, "", independent, 0);
 
-       while (dependent){
+       while (dependent) {
                pnp_print_option(buffer, "   ", dependent, dep);
                dependent = dependent->next;
                dep++;
@@ -233,10 +238,11 @@ static ssize_t pnp_show_options(struct device *dmdev, struct device_attribute *a
        return ret;
 }
 
-static DEVICE_ATTR(options,S_IRUGO,pnp_show_options,NULL);
+static DEVICE_ATTR(options, S_IRUGO, pnp_show_options, NULL);
 
-
-static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_attribute *attr, char *buf)
+static ssize_t pnp_show_current_resources(struct device *dmdev,
+                                         struct device_attribute *attr,
+                                         char *buf)
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
        int i, ret;
@@ -252,52 +258,56 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
        buffer->buffer = buf;
        buffer->curr = buffer->buffer;
 
-       pnp_printf(buffer,"state = ");
+       pnp_printf(buffer, "state = ");
        if (dev->active)
-               pnp_printf(buffer,"active\n");
+               pnp_printf(buffer, "active\n");
        else
-               pnp_printf(buffer,"disabled\n");
+               pnp_printf(buffer, "disabled\n");
 
        for (i = 0; i < PNP_MAX_PORT; i++) {
                if (pnp_port_valid(dev, i)) {
-                       pnp_printf(buffer,"io");
+                       pnp_printf(buffer, "io");
                        if (pnp_port_flags(dev, i) & IORESOURCE_DISABLED)
-                               pnp_printf(buffer," disabled\n");
+                               pnp_printf(buffer, " disabled\n");
                        else
-                               pnp_printf(buffer," 0x%llx-0x%llx\n",
-                                       (unsigned long long)pnp_port_start(dev, i),
-                                       (unsigned long long)pnp_port_end(dev, i));
+                               pnp_printf(buffer, " 0x%llx-0x%llx\n",
+                                          (unsigned long long)
+                                          pnp_port_start(dev, i),
+                                          (unsigned long long)pnp_port_end(dev,
+                                                                           i));
                }
        }
        for (i = 0; i < PNP_MAX_MEM; i++) {
                if (pnp_mem_valid(dev, i)) {
-                       pnp_printf(buffer,"mem");
+                       pnp_printf(buffer, "mem");
                        if (pnp_mem_flags(dev, i) & IORESOURCE_DISABLED)
-                               pnp_printf(buffer," disabled\n");
+                               pnp_printf(buffer, " disabled\n");
                        else
-                               pnp_printf(buffer," 0x%llx-0x%llx\n",
-                                       (unsigned long long)pnp_mem_start(dev, i),
-                                       (unsigned long long)pnp_mem_end(dev, i));
+                               pnp_printf(buffer, " 0x%llx-0x%llx\n",
+                                          (unsigned long long)
+                                          pnp_mem_start(dev, i),
+                                          (unsigned long long)pnp_mem_end(dev,
+                                                                          i));
                }
        }
        for (i = 0; i < PNP_MAX_IRQ; i++) {
                if (pnp_irq_valid(dev, i)) {
-                       pnp_printf(buffer,"irq");
+                       pnp_printf(buffer, "irq");
                        if (pnp_irq_flags(dev, i) & IORESOURCE_DISABLED)
-                               pnp_printf(buffer," disabled\n");
+                               pnp_printf(buffer, " disabled\n");
                        else
-                               pnp_printf(buffer," %lld\n",
-                                       (unsigned long long)pnp_irq(dev, i));
+                               pnp_printf(buffer, " %lld\n",
+                                          (unsigned long long)pnp_irq(dev, i));
                }
        }
        for (i = 0; i < PNP_MAX_DMA; i++) {
                if (pnp_dma_valid(dev, i)) {
-                       pnp_printf(buffer,"dma");
+                       pnp_printf(buffer, "dma");
                        if (pnp_dma_flags(dev, i) & IORESOURCE_DISABLED)
-                               pnp_printf(buffer," disabled\n");
+                               pnp_printf(buffer, " disabled\n");
                        else
-                               pnp_printf(buffer," %lld\n",
-                                       (unsigned long long)pnp_dma(dev, i));
+                               pnp_printf(buffer, " %lld\n",
+                                          (unsigned long long)pnp_dma(dev, i));
                }
        }
        ret = (buffer->curr - buf);
@@ -308,55 +318,57 @@ static ssize_t pnp_show_current_resources(struct device *dmdev, struct device_at
 extern struct semaphore pnp_res_mutex;
 
 static ssize_t
-pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr, const char * ubuf, size_t count)
+pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
+                         const char *ubuf, size_t count)
 {
        struct pnp_dev *dev = to_pnp_dev(dmdev);
-       char    *buf = (void *)ubuf;
-       int     retval = 0;
+       char *buf = (void *)ubuf;
+       int retval = 0;
 
        if (dev->status & PNP_ATTACHED) {
                retval = -EBUSY;
-               pnp_info("Device %s cannot be configured because it is in use.", dev->dev.bus_id);
+               pnp_info("Device %s cannot be configured because it is in use.",
+                        dev->dev.bus_id);
                goto done;
        }
 
        while (isspace(*buf))
                ++buf;
-       if (!strnicmp(buf,"disable",7)) {
+       if (!strnicmp(buf, "disable", 7)) {
                retval = pnp_disable_dev(dev);
                goto done;
        }
-       if (!strnicmp(buf,"activate",8)) {
+       if (!strnicmp(buf, "activate", 8)) {
                retval = pnp_activate_dev(dev);
                goto done;
        }
-       if (!strnicmp(buf,"fill",4)) {
+       if (!strnicmp(buf, "fill", 4)) {
                if (dev->active)
                        goto done;
                retval = pnp_auto_config_dev(dev);
                goto done;
        }
-       if (!strnicmp(buf,"auto",4)) {
+       if (!strnicmp(buf, "auto", 4)) {
                if (dev->active)
                        goto done;
                pnp_init_resource_table(&dev->res);
                retval = pnp_auto_config_dev(dev);
                goto done;
        }
-       if (!strnicmp(buf,"clear",5)) {
+       if (!strnicmp(buf, "clear", 5)) {
                if (dev->active)
                        goto done;
                pnp_init_resource_table(&dev->res);
                goto done;
        }
-       if (!strnicmp(buf,"get",3)) {
+       if (!strnicmp(buf, "get", 3)) {
                down(&pnp_res_mutex);
                if (pnp_can_read(dev))
                        dev->protocol->get(dev, &dev->res);
                up(&pnp_res_mutex);
                goto done;
        }
-       if (!strnicmp(buf,"set",3)) {
+       if (!strnicmp(buf, "set", 3)) {
                int nport = 0, nmem = 0, nirq = 0, ndma = 0;
                if (dev->active)
                        goto done;
@@ -366,65 +378,77 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,
                while (1) {
                        while (isspace(*buf))
                                ++buf;
-                       if (!strnicmp(buf,"io",2)) {
+                       if (!strnicmp(buf, "io", 2)) {
                                buf += 2;
                                while (isspace(*buf))
                                        ++buf;
-                               dev->res.port_resource[nport].start = simple_strtoul(buf,&buf,0);
+                               dev->res.port_resource[nport].start =
+                                   simple_strtoul(buf, &buf, 0);
                                while (isspace(*buf))
                                        ++buf;
-                               if(*buf == '-') {
+                               if (*buf == '-') {
                                        buf += 1;
                                        while (isspace(*buf))
                                                ++buf;
-                                       dev->res.port_resource[nport].end = simple_strtoul(buf,&buf,0);
+                                       dev->res.port_resource[nport].end =
+                                           simple_strtoul(buf, &buf, 0);
                                } else
-                                       dev->res.port_resource[nport].end = dev->res.port_resource[nport].start;
-                               dev->res.port_resource[nport].flags = IORESOURCE_IO;
+                                       dev->res.port_resource[nport].end =
+                                           dev->res.port_resource[nport].start;
+                               dev->res.port_resource[nport].flags =
+                                   IORESOURCE_IO;
                                nport++;
                                if (nport >= PNP_MAX_PORT)
                                        break;
                                continue;
                        }
-                       if (!strnicmp(buf,"mem",3)) {
+                       if (!strnicmp(buf, "mem", 3)) {
                                buf += 3;
                                while (isspace(*buf))
                                        ++buf;
-                               dev->res.mem_resource[nmem].start = simple_strtoul(buf,&buf,0);
+                               dev->res.mem_resource[nmem].start =
+                                   simple_strtoul(buf, &buf, 0);
                                while (isspace(*buf))
                                        ++buf;
-                               if(*buf == '-') {
+                               if (*buf == '-') {
                                        buf += 1;
                                        while (isspace(*buf))
                                                ++buf;
-                                       dev->res.mem_resource[nmem].end = simple_strtoul(buf,&buf,0);
+                                       dev->res.mem_resource[nmem].end =
+                                           simple_strtoul(buf, &buf, 0);
                                } else
-                                       dev->res.mem_resource[nmem].end = dev->res.mem_resource[nmem].start;
-                               dev->res.mem_resource[nmem].flags = IORESOURCE_MEM;
+                                       dev->res.mem_resource[nmem].end =
+                                           dev->res.mem_resource[nmem].start;
+                               dev->res.mem_resource[nmem].flags =
+                                   IORESOURCE_MEM;
                                nmem++;
                                if (nmem >= PNP_MAX_MEM)
                                        break;
                                continue;
                        }
-                       if (!strnicmp(buf,"irq",3)) {
+                       if (!strnicmp(buf, "irq", 3)) {
                                buf += 3;
                                while (isspace(*buf))
                                        ++buf;
                                dev->res.irq_resource[nirq].start =
-                               dev->res.irq_resource[nirq].end = simple_strtoul(buf,&buf,0);
-                               dev->res.irq_resource[nirq].flags = IORESOURCE_IRQ;
+                                   dev->res.irq_resource[nirq].end =
+                                   simple_strtoul(buf, &buf, 0);
+                               dev->res.irq_resource[nirq].flags =
+                                   IORESOURCE_IRQ;
                                nirq++;
                                if (nirq >= PNP_MAX_IRQ)
                                        break;
                                continue;
                        }
-                       if (!strnicmp(buf,"dma",3)) {
+                       if (!strnicmp(buf, "dma", 3)) {
                                buf += 3;
                                while (isspace(*buf))
                                        ++buf;
                                dev->res.dma_resource[ndma].start =
-                               dev->res.dma_resource[ndma].end = simple_strtoul(buf,&buf,0);
-                               dev->res.dma_resource[ndma].flags = IORESOURCE_DMA;
+                                   dev->res.dma_resource[ndma].end =
+                                   simple_strtoul(buf, &buf, 0);
+                               dev->res.dma_resource[ndma].flags =
+                                   IORESOURCE_DMA;
                                ndma++;
                                if (ndma >= PNP_MAX_DMA)
                                        break;
@@ -435,45 +459,50 @@ pnp_set_current_resources(struct device * dmdev, struct device_attribute *attr,
                up(&pnp_res_mutex);
                goto done;
        }
- done:
     done:
        if (retval < 0)
                return retval;
        return count;
 }
 
-static DEVICE_ATTR(resources,S_IRUGO | S_IWUSR,
-                  pnp_show_current_resources,pnp_set_current_resources);
+static DEVICE_ATTR(resources, S_IRUGO | S_IWUSR,
+                  pnp_show_current_resources, pnp_set_current_resources);
 
-static ssize_t pnp_show_current_ids(struct device *dmdev, struct device_attribute *attr, char *buf)
+static ssize_t pnp_show_current_ids(struct device *dmdev,
+                                   struct device_attribute *attr, char *buf)
 {
        char *str = buf;
        struct pnp_dev *dev = to_pnp_dev(dmdev);
-       struct pnp_id * pos = dev->id;
+       struct pnp_id *pos = dev->id;
 
        while (pos) {
-               str += sprintf(str,"%s\n", pos->id);
+               str += sprintf(str, "%s\n", pos->id);
                pos = pos->next;
        }
        return (str - buf);
 }
 
-static DEVICE_ATTR(id,S_IRUGO,pnp_show_current_ids,NULL);
+static DEVICE_ATTR(id, S_IRUGO, pnp_show_current_ids, NULL);
 
 int pnp_interface_attach_device(struct pnp_dev *dev)
 {
-       int rc = device_create_file(&dev->dev,&dev_attr_options);
-       if (rc) goto err;
-       rc = device_create_file(&dev->dev,&dev_attr_resources);
-       if (rc) goto err_opt;
-       rc = device_create_file(&dev->dev,&dev_attr_id);
-       if (rc) goto err_res;
+       int rc = device_create_file(&dev->dev, &dev_attr_options);
+
+       if (rc)
+               goto err;
+       rc = device_create_file(&dev->dev, &dev_attr_resources);
+       if (rc)
+               goto err_opt;
+       rc = device_create_file(&dev->dev, &dev_attr_id);
+       if (rc)
+               goto err_res;
 
        return 0;
 
-err_res:
-       device_remove_file(&dev->dev,&dev_attr_resources);
-err_opt:
-       device_remove_file(&dev->dev,&dev_attr_options);
-err:
+      err_res:
+       device_remove_file(&dev->dev, &dev_attr_resources);
+      err_opt:
+       device_remove_file(&dev->dev, &dev_attr_options);
+      err:
        return rc;
 }
index 0697ab88a9ac5df1fcb04e519438c9a594456e26..10bdcc4d4f7b48484391d841d2eb915a6f56b361 100644 (file)
@@ -3,34 +3,30 @@
  *            the old isapnp APIs. If possible use the new APIs instead.
  *
  * Copyright 2002 Adam Belay <ambx1@neo.rr.com>
- *
  */
-/* TODO: see if more isapnp functions are needed here */
 
 #include <linux/module.h>
 #include <linux/isapnp.h>
 #include <linux/string.h>
 
-static void pnp_convert_id(char *buf, unsigned short vendor, unsigned short device)
+static void pnp_convert_id(char *buf, unsigned short vendor,
+                          unsigned short device)
 {
        sprintf(buf, "%c%c%c%x%x%x%x",
-                       'A' + ((vendor >> 2) & 0x3f) - 1,
-                       'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
-                       'A' + ((vendor >> 8) & 0x1f) - 1,
-                       (device >> 4) & 0x0f,
-                       device & 0x0f,
-                       (device >> 12) & 0x0f,
-                       (device >> 8) & 0x0f);
+               'A' + ((vendor >> 2) & 0x3f) - 1,
+               'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
+               'A' + ((vendor >> 8) & 0x1f) - 1,
+               (device >> 4) & 0x0f, device & 0x0f,
+               (device >> 12) & 0x0f, (device >> 8) & 0x0f);
 }
 
-struct pnp_card *pnp_find_card(unsigned short vendor,
-                              unsigned short device,
+struct pnp_card *pnp_find_card(unsigned short vendor, unsigned short device,
                               struct pnp_card *from)
 {
        char id[8];
        char any[8];
        struct list_head *list;
+
        pnp_convert_id(id, vendor, device);
        pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
 
@@ -38,20 +34,20 @@ struct pnp_card *pnp_find_card(unsigned short vendor,
 
        while (list != &pnp_cards) {
                struct pnp_card *card = global_to_pnp_card(list);
-               if (compare_pnp_id(card->id,id) || (memcmp(id,any,7)==0))
+
+               if (compare_pnp_id(card->id, id) || (memcmp(id, any, 7) == 0))
                        return card;
                list = list->next;
        }
        return NULL;
 }
 
-struct pnp_dev *pnp_find_dev(struct pnp_card *card,
-                            unsigned short vendor,
-                            unsigned short function,
-                            struct pnp_dev *from)
+struct pnp_dev *pnp_find_dev(struct pnp_card *card, unsigned short vendor,
+                            unsigned short function, struct pnp_dev *from)
 {
        char id[8];
        char any[8];
+
        pnp_convert_id(id, vendor, function);
        pnp_convert_id(any, ISAPNP_ANY_ID, ISAPNP_ANY_ID);
        if (card == NULL) {     /* look for a logical device from all cards */
@@ -63,7 +59,9 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
 
                while (list != &pnp_global) {
                        struct pnp_dev *dev = global_to_pnp_dev(list);
-                       if (compare_pnp_id(dev->id,id) || (memcmp(id,any,7)==0))
+
+                       if (compare_pnp_id(dev->id, id) ||
+                           (memcmp(id, any, 7) == 0))
                                return dev;
                        list = list->next;
                }
@@ -78,7 +76,8 @@ struct pnp_dev *pnp_find_dev(struct pnp_card *card,
                }
                while (list != &card->devices) {
                        struct pnp_dev *dev = card_to_pnp_dev(list);
-                       if (compare_pnp_id(dev->id,id))
+
+                       if (compare_pnp_id(dev->id, id))
                                return dev;
                        list = list->next;
                }
index 914d00c423ade6a353fd81d333c2eef7d89a6254..b4e2aa995b53160ef5056ea2180b95ff2e05b300 100644 (file)
 #define ISAPNP_DEBUG
 #endif
 
-int isapnp_disable;                    /* Disable ISA PnP */
-static int isapnp_rdp;                 /* Read Data Port */
-static int isapnp_reset = 1;           /* reset all PnP cards (deactivate) */
-static int isapnp_verbose = 1;         /* verbose mode */
+int isapnp_disable;            /* Disable ISA PnP */
+static int isapnp_rdp;         /* Read Data Port */
+static int isapnp_reset = 1;   /* reset all PnP cards (deactivate) */
+static int isapnp_verbose = 1; /* verbose mode */
 
 MODULE_AUTHOR("Jaroslav Kysela <perex@suse.cz>");
 MODULE_DESCRIPTION("Generic ISA Plug & Play support");
@@ -126,7 +126,7 @@ static unsigned short isapnp_read_word(unsigned char idx)
        unsigned short val;
 
        val = isapnp_read_byte(idx);
-       val = (val << 8) + isapnp_read_byte(idx+1);
+       val = (val << 8) + isapnp_read_byte(idx + 1);
        return val;
 }
 
@@ -139,7 +139,7 @@ void isapnp_write_byte(unsigned char idx, unsigned char val)
 static void isapnp_write_word(unsigned char idx, unsigned short val)
 {
        isapnp_write_byte(idx, val >> 8);
-       isapnp_write_byte(idx+1, val);
+       isapnp_write_byte(idx + 1, val);
 }
 
 static void isapnp_key(void)
@@ -193,7 +193,7 @@ static void isapnp_deactivate(unsigned char logdev)
 static void __init isapnp_peek(unsigned char *data, int bytes)
 {
        int i, j;
-       unsigned char d=0;
+       unsigned char d = 0;
 
        for (i = 1; i <= bytes; i++) {
                for (j = 0; j < 20; j++) {
@@ -220,19 +220,18 @@ static int isapnp_next_rdp(void)
 {
        int rdp = isapnp_rdp;
        static int old_rdp = 0;
-       
-       if(old_rdp)
-       {
+
+       if (old_rdp) {
                release_region(old_rdp, 1);
                old_rdp = 0;
        }
        while (rdp <= 0x3ff) {
                /*
-                *      We cannot use NE2000 probe spaces for ISAPnP or we
-                *      will lock up machines.
+                *      We cannot use NE2000 probe spaces for ISAPnP or we
+                *      will lock up machines.
                 */
-               if ((rdp < 0x280 || rdp >  0x380) && request_region(rdp, 1, "ISAPnP"))
-               {
+               if ((rdp < 0x280 || rdp > 0x380)
+                   && request_region(rdp, 1, "ISAPnP")) {
                        isapnp_rdp = rdp;
                        old_rdp = rdp;
                        return 0;
@@ -253,7 +252,6 @@ static inline void isapnp_set_rdp(void)
  *     Perform an isolation. The port selection code now tries to avoid
  *     "dangerous to read" ports.
  */
-
 static int __init isapnp_isolate_rdp_select(void)
 {
        isapnp_wait();
@@ -282,7 +280,6 @@ static int __init isapnp_isolate_rdp_select(void)
 /*
  *  Isolate (assign uniqued CSN) to all ISA PnP devices.
  */
-
 static int __init isapnp_isolate(void)
 {
        unsigned char checksum = 0x6a;
@@ -305,7 +302,9 @@ static int __init isapnp_isolate(void)
                        udelay(250);
                        if (data == 0x55aa)
                                bit = 0x01;
-                       checksum = ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7) | (checksum >> 1);
+                       checksum =
+                           ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7)
+                           | (checksum >> 1);
                        bit = 0x00;
                }
                for (i = 65; i <= 72; i++) {
@@ -351,13 +350,12 @@ static int __init isapnp_isolate(void)
 /*
  *  Read one tag from stream.
  */
-
 static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
 {
        unsigned char tag, tmp[2];
 
        isapnp_peek(&tag, 1);
-       if (tag == 0)                           /* invalid tag */
+       if (tag == 0)           /* invalid tag */
                return -1;
        if (tag & 0x80) {       /* large item */
                *type = tag;
@@ -368,7 +366,8 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
                *size = tag & 0x07;
        }
 #if 0
-       printk(KERN_DEBUG "tag = 0x%x, type = 0x%x, size = %i\n", tag, *type, *size);
+       printk(KERN_DEBUG "tag = 0x%x, type = 0x%x, size = %i\n", tag, *type,
+              *size);
 #endif
        if (*type == 0xff && *size == 0xffff)   /* probably invalid data */
                return -1;
@@ -378,7 +377,6 @@ static int __init isapnp_read_tag(unsigned char *type, unsigned short *size)
 /*
  *  Skip specified number of bytes from stream.
  */
-
 static void __init isapnp_skip_bytes(int count)
 {
        isapnp_peek(NULL, count);
@@ -387,31 +385,30 @@ static void __init isapnp_skip_bytes(int count)
 /*
  *  Parse EISA id.
  */
-
-static void isapnp_parse_id(struct pnp_dev * dev, unsigned short vendor, unsigned short device)
+static void isapnp_parse_id(struct pnp_dev *dev, unsigned short vendor,
+                           unsigned short device)
 {
-       struct pnp_id * id;
+       struct pnp_id *id;
+
        if (!dev)
                return;
        id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
        if (!id)
                return;
        sprintf(id->id, "%c%c%c%x%x%x%x",
-                       'A' + ((vendor >> 2) & 0x3f) - 1,
-                       'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
-                       'A' + ((vendor >> 8) & 0x1f) - 1,
-                       (device >> 4) & 0x0f,
-                       device & 0x0f,
-                       (device >> 12) & 0x0f,
-                       (device >> 8) & 0x0f);
+               'A' + ((vendor >> 2) & 0x3f) - 1,
+               'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
+               'A' + ((vendor >> 8) & 0x1f) - 1,
+               (device >> 4) & 0x0f,
+               device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
        pnp_add_id(id, dev);
 }
 
 /*
  *  Parse logical device tag.
  */
-
-static struct pnp_dev * __init isapnp_parse_device(struct pnp_card *card, int size, int number)
+static struct pnp_dev *__init isapnp_parse_device(struct pnp_card *card,
+                                                 int size, int number)
 {
        unsigned char tmp[6];
        struct pnp_dev *dev;
@@ -435,13 +432,11 @@ static struct pnp_dev * __init isapnp_parse_device(struct pnp_card *card, int si
        return dev;
 }
 
-
 /*
  *  Add IRQ resource to resources list.
  */
-
 static void __init isapnp_parse_irq_resource(struct pnp_option *option,
-                                              int size)
+                                            int size)
 {
        unsigned char tmp[3];
        struct pnp_irq *irq;
@@ -458,15 +453,13 @@ static void __init isapnp_parse_irq_resource(struct pnp_option *option,
        else
                irq->flags = IORESOURCE_IRQ_HIGHEDGE;
        pnp_register_irq_resource(option, irq);
-       return;
 }
 
 /*
  *  Add DMA resource to resources list.
  */
-
 static void __init isapnp_parse_dma_resource(struct pnp_option *option,
-                                              int size)
+                                            int size)
 {
        unsigned char tmp[2];
        struct pnp_dma *dma;
@@ -478,15 +471,13 @@ static void __init isapnp_parse_dma_resource(struct pnp_option *option,
        dma->map = tmp[0];
        dma->flags = tmp[1];
        pnp_register_dma_resource(option, dma);
-       return;
 }
 
 /*
  *  Add port resource to resources list.
  */
-
 static void __init isapnp_parse_port_resource(struct pnp_option *option,
-                                               int size)
+                                             int size)
 {
        unsigned char tmp[7];
        struct pnp_port *port;
@@ -500,16 +491,14 @@ static void __init isapnp_parse_port_resource(struct pnp_option *option,
        port->align = tmp[5];
        port->size = tmp[6];
        port->flags = tmp[0] ? PNP_PORT_FLAG_16BITADDR : 0;
-       pnp_register_port_resource(option,port);
-       return;
+       pnp_register_port_resource(option, port);
 }
 
 /*
  *  Add fixed port resource to resources list.
  */
-
 static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
-                                                     int size)
+                                                   int size)
 {
        unsigned char tmp[3];
        struct pnp_port *port;
@@ -522,16 +511,14 @@ static void __init isapnp_parse_fixed_port_resource(struct pnp_option *option,
        port->size = tmp[2];
        port->align = 0;
        port->flags = PNP_PORT_FLAG_FIXED;
-       pnp_register_port_resource(option,port);
-       return;
+       pnp_register_port_resource(option, port);
 }
 
 /*
  *  Add memory resource to resources list.
  */
-
 static void __init isapnp_parse_mem_resource(struct pnp_option *option,
-                                              int size)
+                                            int size)
 {
        unsigned char tmp[9];
        struct pnp_mem *mem;
@@ -545,16 +532,14 @@ static void __init isapnp_parse_mem_resource(struct pnp_option *option,
        mem->align = (tmp[6] << 8) | tmp[5];
        mem->size = ((tmp[8] << 8) | tmp[7]) << 8;
        mem->flags = tmp[0];
-       pnp_register_mem_resource(option,mem);
-       return;
+       pnp_register_mem_resource(option, mem);
 }
 
 /*
  *  Add 32-bit memory resource to resources list.
  */
-
 static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
-                                                int size)
+                                              int size)
 {
        unsigned char tmp[17];
        struct pnp_mem *mem;
@@ -565,18 +550,19 @@ static void __init isapnp_parse_mem32_resource(struct pnp_option *option,
                return;
        mem->min = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
        mem->max = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5];
-       mem->align = (tmp[12] << 24) | (tmp[11] << 16) | (tmp[10] << 8) | tmp[9];
-       mem->size = (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13];
+       mem->align =
+           (tmp[12] << 24) | (tmp[11] << 16) | (tmp[10] << 8) | tmp[9];
+       mem->size =
+           (tmp[16] << 24) | (tmp[15] << 16) | (tmp[14] << 8) | tmp[13];
        mem->flags = tmp[0];
-       pnp_register_mem_resource(option,mem);
+       pnp_register_mem_resource(option, mem);
 }
 
 /*
  *  Add 32-bit fixed memory resource to resources list.
  */
-
 static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
-                                                      int size)
+                                                    int size)
 {
        unsigned char tmp[9];
        struct pnp_mem *mem;
@@ -585,28 +571,29 @@ static void __init isapnp_parse_fixed_mem32_resource(struct pnp_option *option,
        mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
        if (!mem)
                return;
-       mem->min = mem->max = (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
+       mem->min = mem->max =
+           (tmp[4] << 24) | (tmp[3] << 16) | (tmp[2] << 8) | tmp[1];
        mem->size = (tmp[8] << 24) | (tmp[7] << 16) | (tmp[6] << 8) | tmp[5];
        mem->align = 0;
        mem->flags = tmp[0];
-       pnp_register_mem_resource(option,mem);
+       pnp_register_mem_resource(option, mem);
 }
 
 /*
  *  Parse card name for ISA PnP device.
- */ 
-
+ */
 static void __init
 isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
 {
        if (name[0] == '\0') {
-               unsigned short size1 = *size >= name_max ? (name_max - 1) : *size;
+               unsigned short size1 =
+                   *size >= name_max ? (name_max - 1) : *size;
                isapnp_peek(name, size1);
                name[size1] = '\0';
                *size -= size1;
 
                /* clean whitespace from end of string */
-               while (size1 > 0  &&  name[--size1] == ' ')
+               while (size1 > 0 && name[--size1] == ' ')
                        name[size1] = '\0';
        }
 }
@@ -614,7 +601,6 @@ isapnp_parse_name(char *name, unsigned int name_max, unsigned short *size)
 /*
  *  Parse resource map for logical device.
  */
-
 static int __init isapnp_create_device(struct pnp_card *card,
                                       unsigned short size)
 {
@@ -622,6 +608,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
        unsigned char type, tmp[17];
        struct pnp_option *option;
        struct pnp_dev *dev;
+
        if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
                return 1;
        option = pnp_register_independent_option(dev);
@@ -629,17 +616,19 @@ static int __init isapnp_create_device(struct pnp_card *card,
                kfree(dev);
                return 1;
        }
-       pnp_add_card_device(card,dev);
+       pnp_add_card_device(card, dev);
 
        while (1) {
-               if (isapnp_read_tag(&type, &size)<0)
+               if (isapnp_read_tag(&type, &size) < 0)
                        return 1;
                if (skip && type != _STAG_LOGDEVID && type != _STAG_END)
                        goto __skip;
                switch (type) {
                case _STAG_LOGDEVID:
                        if (size >= 5 && size <= 6) {
-                               if ((dev = isapnp_parse_device(card, size, number++)) == NULL)
+                               if ((dev =
+                                    isapnp_parse_device(card, size,
+                                                        number++)) == NULL)
                                        return 1;
                                size = 0;
                                skip = 0;
@@ -648,7 +637,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
                                        kfree(dev);
                                        return 1;
                                }
-                               pnp_add_card_device(card,dev);
+                               pnp_add_card_device(card, dev);
                        } else {
                                skip = 1;
                        }
@@ -658,7 +647,8 @@ static int __init isapnp_create_device(struct pnp_card *card,
                case _STAG_COMPATDEVID:
                        if (size == 4 && compat < DEVICE_COUNT_COMPATIBLE) {
                                isapnp_peek(tmp, 4);
-                               isapnp_parse_id(dev,(tmp[1] << 8) | tmp[0], (tmp[3] << 8) | tmp[2]);
+                               isapnp_parse_id(dev, (tmp[1] << 8) | tmp[0],
+                                               (tmp[3] << 8) | tmp[2]);
                                compat++;
                                size = 0;
                        }
@@ -684,7 +674,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
                                priority = 0x100 | tmp[0];
                                size = 0;
                        }
-                       option = pnp_register_dependent_option(dev,priority);
+                       option = pnp_register_dependent_option(dev, priority);
                        if (!option)
                                return 1;
                        break;
@@ -739,11 +729,13 @@ static int __init isapnp_create_device(struct pnp_card *card,
                                isapnp_skip_bytes(size);
                        return 1;
                default:
-                       printk(KERN_ERR "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", type, dev->number, card->number);
+                       printk(KERN_ERR
+                              "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n",
+                              type, dev->number, card->number);
                }
              __skip:
-               if (size > 0)
-                       isapnp_skip_bytes(size);
+               if (size > 0)
+                       isapnp_skip_bytes(size);
        }
        return 0;
 }
@@ -751,14 +743,13 @@ static int __init isapnp_create_device(struct pnp_card *card,
 /*
  *  Parse resource map for ISA PnP card.
  */
-
 static void __init isapnp_parse_resource_map(struct pnp_card *card)
 {
        unsigned char type, tmp[17];
        unsigned short size;
 
        while (1) {
-               if (isapnp_read_tag(&type, &size)<0)
+               if (isapnp_read_tag(&type, &size) < 0)
                        return;
                switch (type) {
                case _STAG_PNPVERNO:
@@ -771,7 +762,7 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
                        break;
                case _STAG_LOGDEVID:
                        if (size >= 5 && size <= 6) {
-                               if (isapnp_create_device(card, size)==1)
+                               if (isapnp_create_device(card, size) == 1)
                                        return;
                                size = 0;
                        }
@@ -779,7 +770,8 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
                case _STAG_VENDOR:
                        break;
                case _LTAG_ANSISTR:
-                       isapnp_parse_name(card->name, sizeof(card->name), &size);
+                       isapnp_parse_name(card->name, sizeof(card->name),
+                                         &size);
                        break;
                case _LTAG_UNICODESTR:
                        /* silently ignore */
@@ -792,18 +784,19 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
                                isapnp_skip_bytes(size);
                        return;
                default:
-                       printk(KERN_ERR "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", type, card->number);
+                       printk(KERN_ERR
+                              "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n",
+                              type, card->number);
                }
              __skip:
-               if (size > 0)
-                       isapnp_skip_bytes(size);
+               if (size > 0)
+                       isapnp_skip_bytes(size);
        }
 }
 
 /*
  *  Compute ISA PnP checksum for first eight bytes.
  */
-
 static unsigned char __init isapnp_checksum(unsigned char *data)
 {
        int i, j;
@@ -815,7 +808,9 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
                        bit = 0;
                        if (b & (1 << j))
                                bit = 1;
-                       checksum = ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7) | (checksum >> 1);
+                       checksum =
+                           ((((checksum ^ (checksum >> 1)) & 0x01) ^ bit) << 7)
+                           | (checksum >> 1);
                }
        }
        return checksum;
@@ -824,27 +819,25 @@ static unsigned char __init isapnp_checksum(unsigned char *data)
 /*
  *  Parse EISA id for ISA PnP card.
  */
-
-static void isapnp_parse_card_id(struct pnp_card * card, unsigned short vendor, unsigned short device)
+static void isapnp_parse_card_id(struct pnp_card *card, unsigned short vendor,
+                                unsigned short device)
 {
-       struct pnp_id * id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
+       struct pnp_id *id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
+
        if (!id)
                return;
        sprintf(id->id, "%c%c%c%x%x%x%x",
-                       'A' + ((vendor >> 2) & 0x3f) - 1,
-                       'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
-                       'A' + ((vendor >> 8) & 0x1f) - 1,
-                       (device >> 4) & 0x0f,
-                       device & 0x0f,
-                       (device >> 12) & 0x0f,
-                       (device >> 8) & 0x0f);
-       pnp_add_card_id(id,card);
+               'A' + ((vendor >> 2) & 0x3f) - 1,
+               'A' + (((vendor & 3) << 3) | ((vendor >> 13) & 7)) - 1,
+               'A' + ((vendor >> 8) & 0x1f) - 1,
+               (device >> 4) & 0x0f,
+               device & 0x0f, (device >> 12) & 0x0f, (device >> 8) & 0x0f);
+       pnp_add_card_id(id, card);
 }
 
 /*
  *  Build device list for all present ISA PnP devices.
  */
-
 static int __init isapnp_build_device_list(void)
 {
        int csn;
@@ -858,22 +851,29 @@ static int __init isapnp_build_device_list(void)
                isapnp_peek(header, 9);
                checksum = isapnp_checksum(header);
 #if 0
-               printk(KERN_DEBUG "vendor: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
-                       header[0], header[1], header[2], header[3],
-                       header[4], header[5], header[6], header[7], header[8]);
+               printk(KERN_DEBUG
+                      "vendor: %02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x\n",
+                      header[0], header[1], header[2], header[3], header[4],
+                      header[5], header[6], header[7], header[8]);
                printk(KERN_DEBUG "checksum = 0x%x\n", checksum);
 #endif
-               if ((card = kzalloc(sizeof(struct pnp_card), GFP_KERNEL)) == NULL)
+               if ((card =
+                    kzalloc(sizeof(struct pnp_card), GFP_KERNEL)) == NULL)
                        continue;
 
                card->number = csn;
                INIT_LIST_HEAD(&card->devices);
-               isapnp_parse_card_id(card, (header[1] << 8) | header[0], (header[3] << 8) | header[2]);
-               card->serial = (header[7] << 24) | (header[6] << 16) | (header[5] << 8) | header[4];
+               isapnp_parse_card_id(card, (header[1] << 8) | header[0],
+                                    (header[3] << 8) | header[2]);
+               card->serial =
+                   (header[7] << 24) | (header[6] << 16) | (header[5] << 8) |
+                   header[4];
                isapnp_checksum_value = 0x00;
                isapnp_parse_resource_map(card);
                if (isapnp_checksum_value != 0x00)
-                       printk(KERN_ERR "isapnp: checksum for device %i is not valid (0x%x)\n", csn, isapnp_checksum_value);
+                       printk(KERN_ERR
+                              "isapnp: checksum for device %i is not valid (0x%x)\n",
+                              csn, isapnp_checksum_value);
                card->checksum = isapnp_checksum_value;
                card->protocol = &isapnp_protocol;
 
@@ -890,6 +890,7 @@ static int __init isapnp_build_device_list(void)
 int isapnp_present(void)
 {
        struct pnp_card *card;
+
        pnp_for_each_card(card) {
                if (card->protocol == &isapnp_protocol)
                        return 1;
@@ -911,13 +912,13 @@ int isapnp_cfg_begin(int csn, int logdev)
        /* it is possible to set RDP only in the isolation phase */
        /*   Jens Thoms Toerring <Jens.Toerring@physik.fu-berlin.de> */
        isapnp_write_byte(0x02, 0x04);  /* clear CSN of card */
-       mdelay(2);                      /* is this necessary? */
-       isapnp_wake(csn);               /* bring card into sleep state */
-       isapnp_wake(0);                 /* bring card into isolation state */
-       isapnp_set_rdp();               /* reset the RDP port */
-       udelay(1000);                   /* delay 1000us */
+       mdelay(2);              /* is this necessary? */
+       isapnp_wake(csn);       /* bring card into sleep state */
+       isapnp_wake(0);         /* bring card into isolation state */
+       isapnp_set_rdp();       /* reset the RDP port */
+       udelay(1000);           /* delay 1000us */
        isapnp_write_byte(0x06, csn);   /* reset CSN to previous value */
-       udelay(250);                    /* is this necessary? */
+       udelay(250);            /* is this necessary? */
 #endif
        if (logdev >= 0)
                isapnp_device(logdev);
@@ -931,12 +932,10 @@ int isapnp_cfg_end(void)
        return 0;
 }
 
-
 /*
- *  Inititialization.
+ *  Initialization.
  */
 
-
 EXPORT_SYMBOL(isapnp_protocol);
 EXPORT_SYMBOL(isapnp_present);
 EXPORT_SYMBOL(isapnp_cfg_begin);
@@ -946,7 +945,8 @@ EXPORT_SYMBOL(isapnp_read_byte);
 #endif
 EXPORT_SYMBOL(isapnp_write_byte);
 
-static int isapnp_read_resources(struct pnp_dev *dev, struct pnp_resource_table *res)
+static int isapnp_read_resources(struct pnp_dev *dev,
+                                struct pnp_resource_table *res)
 {
        int tmp, ret;
 
@@ -960,31 +960,37 @@ static int isapnp_read_resources(struct pnp_dev *dev, struct pnp_resource_table
                        res->port_resource[tmp].flags = IORESOURCE_IO;
                }
                for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
-                       ret = isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8;
+                       ret =
+                           isapnp_read_word(ISAPNP_CFG_MEM + (tmp << 3)) << 8;
                        if (!ret)
                                continue;
                        res->mem_resource[tmp].start = ret;
                        res->mem_resource[tmp].flags = IORESOURCE_MEM;
                }
                for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
-                       ret = (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >> 8);
+                       ret =
+                           (isapnp_read_word(ISAPNP_CFG_IRQ + (tmp << 1)) >>
+                            8);
                        if (!ret)
                                continue;
-                       res->irq_resource[tmp].start = res->irq_resource[tmp].end = ret;
+                       res->irq_resource[tmp].start =
+                           res->irq_resource[tmp].end = ret;
                        res->irq_resource[tmp].flags = IORESOURCE_IRQ;
                }
                for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
                        ret = isapnp_read_byte(ISAPNP_CFG_DMA + tmp);
                        if (ret == 4)
                                continue;
-                       res->dma_resource[tmp].start = res->dma_resource[tmp].end = ret;
+                       res->dma_resource[tmp].start =
+                           res->dma_resource[tmp].end = ret;
                        res->dma_resource[tmp].flags = IORESOURCE_DMA;
                }
        }
        return 0;
 }
 
-static int isapnp_get_resources(struct pnp_dev *dev, struct pnp_resource_table * res)
+static int isapnp_get_resources(struct pnp_dev *dev,
+                               struct pnp_resource_table *res)
 {
        int ret;
        pnp_init_resource_table(res);
@@ -994,24 +1000,44 @@ static int isapnp_get_resources(struct pnp_dev *dev, struct pnp_resource_table *
        return ret;
 }
 
-static int isapnp_set_resources(struct pnp_dev *dev, struct pnp_resource_table * res)
+static int isapnp_set_resources(struct pnp_dev *dev,
+                               struct pnp_resource_table *res)
 {
        int tmp;
 
        isapnp_cfg_begin(dev->card->number, dev->number);
        dev->active = 1;
-       for (tmp = 0; tmp < PNP_MAX_PORT && (res->port_resource[tmp].flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO; tmp++)
-               isapnp_write_word(ISAPNP_CFG_PORT+(tmp<<1), res->port_resource[tmp].start);
-       for (tmp = 0; tmp < PNP_MAX_IRQ && (res->irq_resource[tmp].flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ; tmp++) {
+       for (tmp = 0;
+            tmp < PNP_MAX_PORT
+            && (res->port_resource[tmp].
+                flags & (IORESOURCE_IO | IORESOURCE_UNSET)) == IORESOURCE_IO;
+            tmp++)
+               isapnp_write_word(ISAPNP_CFG_PORT + (tmp << 1),
+                                 res->port_resource[tmp].start);
+       for (tmp = 0;
+            tmp < PNP_MAX_IRQ
+            && (res->irq_resource[tmp].
+                flags & (IORESOURCE_IRQ | IORESOURCE_UNSET)) == IORESOURCE_IRQ;
+            tmp++) {
                int irq = res->irq_resource[tmp].start;
                if (irq == 2)
                        irq = 9;
-               isapnp_write_byte(ISAPNP_CFG_IRQ+(tmp<<1), irq);
+               isapnp_write_byte(ISAPNP_CFG_IRQ + (tmp << 1), irq);
        }
-       for (tmp = 0; tmp < PNP_MAX_DMA && (res->dma_resource[tmp].flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA; tmp++)
-               isapnp_write_byte(ISAPNP_CFG_DMA+tmp, res->dma_resource[tmp].start);
-       for (tmp = 0; tmp < PNP_MAX_MEM && (res->mem_resource[tmp].flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM; tmp++)
-               isapnp_write_word(ISAPNP_CFG_MEM+(tmp<<3), (res->mem_resource[tmp].start >> 8) & 0xffff);
+       for (tmp = 0;
+            tmp < PNP_MAX_DMA
+            && (res->dma_resource[tmp].
+                flags & (IORESOURCE_DMA | IORESOURCE_UNSET)) == IORESOURCE_DMA;
+            tmp++)
+               isapnp_write_byte(ISAPNP_CFG_DMA + tmp,
+                                 res->dma_resource[tmp].start);
+       for (tmp = 0;
+            tmp < PNP_MAX_MEM
+            && (res->mem_resource[tmp].
+                flags & (IORESOURCE_MEM | IORESOURCE_UNSET)) == IORESOURCE_MEM;
+            tmp++)
+               isapnp_write_word(ISAPNP_CFG_MEM + (tmp << 3),
+                                 (res->mem_resource[tmp].start >> 8) & 0xffff);
        /* FIXME: We aren't handling 32bit mems properly here */
        isapnp_activate(dev->number);
        isapnp_cfg_end();
@@ -1030,9 +1056,9 @@ static int isapnp_disable_resources(struct pnp_dev *dev)
 }
 
 struct pnp_protocol isapnp_protocol = {
-       .name   = "ISA Plug and Play",
-       .get    = isapnp_get_resources,
-       .set    = isapnp_set_resources,
+       .name = "ISA Plug and Play",
+       .get = isapnp_get_resources,
+       .set = isapnp_set_resources,
        .disable = isapnp_disable_resources,
 };
 
@@ -1053,31 +1079,36 @@ static int __init isapnp_init(void)
 #endif
 #ifdef ISAPNP_REGION_OK
        if (!request_region(_PIDXR, 1, "isapnp index")) {
-               printk(KERN_ERR "isapnp: Index Register 0x%x already used\n", _PIDXR);
+               printk(KERN_ERR "isapnp: Index Register 0x%x already used\n",
+                      _PIDXR);
                return -EBUSY;
        }
 #endif
        if (!request_region(_PNPWRP, 1, "isapnp write")) {
-               printk(KERN_ERR "isapnp: Write Data Register 0x%x already used\n", _PNPWRP);
+               printk(KERN_ERR
+                      "isapnp: Write Data Register 0x%x already used\n",
+                      _PNPWRP);
 #ifdef ISAPNP_REGION_OK
                release_region(_PIDXR, 1);
 #endif
                return -EBUSY;
        }
 
-       if(pnp_register_protocol(&isapnp_protocol)<0)
+       if (pnp_register_protocol(&isapnp_protocol) < 0)
                return -EBUSY;
 
        /*
-        *      Print a message. The existing ISAPnP code is hanging machines
-        *      so let the user know where.
+        *      Print a message. The existing ISAPnP code is hanging machines
+        *      so let the user know where.
         */
-        
+
        printk(KERN_INFO "isapnp: Scanning for PnP cards...\n");
        if (isapnp_rdp >= 0x203 && isapnp_rdp <= 0x3ff) {
                isapnp_rdp |= 3;
                if (!request_region(isapnp_rdp, 1, "isapnp read")) {
-                       printk(KERN_ERR "isapnp: Read Data Register 0x%x already used\n", isapnp_rdp);
+                       printk(KERN_ERR
+                              "isapnp: Read Data Register 0x%x already used\n",
+                              isapnp_rdp);
 #ifdef ISAPNP_REGION_OK
                        release_region(_PIDXR, 1);
 #endif
@@ -1089,14 +1120,14 @@ static int __init isapnp_init(void)
        isapnp_detected = 1;
        if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) {
                cards = isapnp_isolate();
-               if (cards < 0 || 
-                   (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) {
+               if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) {
 #ifdef ISAPNP_REGION_OK
                        release_region(_PIDXR, 1);
 #endif
                        release_region(_PNPWRP, 1);
                        isapnp_detected = 0;
-                       printk(KERN_INFO "isapnp: No Plug & Play device found\n");
+                       printk(KERN_INFO
+                              "isapnp: No Plug & Play device found\n");
                        return 0;
                }
                request_region(isapnp_rdp, 1, "isapnp read");
@@ -1104,19 +1135,23 @@ static int __init isapnp_init(void)
        isapnp_build_device_list();
        cards = 0;
 
-       protocol_for_each_card(&isapnp_protocol,card) {
+       protocol_for_each_card(&isapnp_protocol, card) {
                cards++;
                if (isapnp_verbose) {
-                       printk(KERN_INFO "isapnp: Card '%s'\n", card->name[0]?card->name:"Unknown");
+                       printk(KERN_INFO "isapnp: Card '%s'\n",
+                              card->name[0] ? card->name : "Unknown");
                        if (isapnp_verbose < 2)
                                continue;
-                       card_for_each_dev(card,dev) {
-                               printk(KERN_INFO "isapnp:   Device '%s'\n", dev->name[0]?dev->name:"Unknown");
+                       card_for_each_dev(card, dev) {
+                               printk(KERN_INFO "isapnp:   Device '%s'\n",
+                                      dev->name[0] ? dev->name : "Unknown");
                        }
                }
        }
        if (cards) {
-               printk(KERN_INFO "isapnp: %i Plug & Play card%s detected total\n", cards, cards>1?"s":"");
+               printk(KERN_INFO
+                      "isapnp: %i Plug & Play card%s detected total\n", cards,
+                      cards > 1 ? "s" : "");
        } else {
                printk(KERN_INFO "isapnp: No Plug & Play card found\n");
        }
@@ -1141,11 +1176,10 @@ __setup("noisapnp", isapnp_setup_disable);
 
 static int __init isapnp_setup_isapnp(char *str)
 {
-       (void)((get_option(&str,&isapnp_rdp) == 2) &&
-              (get_option(&str,&isapnp_reset) == 2) &&
-              (get_option(&str,&isapnp_verbose) == 2));
+       (void)((get_option(&str, &isapnp_rdp) == 2) &&
+              (get_option(&str, &isapnp_reset) == 2) &&
+              (get_option(&str, &isapnp_verbose) == 2));
        return 1;
 }
 
 __setup("isapnp=", isapnp_setup_isapnp);
-
index 40b724ebe23bd1ce8e1bba713beb022df61b7036..3fbc0f9ffc2623091027a9f873759896c0a8f898 100644 (file)
@@ -2,7 +2,6 @@
  *  ISA Plug & Play support
  *  Copyright (c) by Jaroslav Kysela <perex@suse.cz>
  *
- *
  *   This program is free software; you can redistribute it and/or modify
  *   it under the terms of the GNU General Public License as published by
  *   the Free Software Foundation; either version 2 of the License, or
@@ -16,7 +15,6 @@
  *   You should have received a copy of the GNU General Public License
  *   along with this program; if not, write to the Free Software
  *   Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
- *
  */
 
 #include <linux/module.h>
@@ -54,7 +52,8 @@ static loff_t isapnp_proc_bus_lseek(struct file *file, loff_t off, int whence)
        return (file->f_pos = new);
 }
 
-static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t nbytes, loff_t *ppos)
+static ssize_t isapnp_proc_bus_read(struct file *file, char __user * buf,
+                                   size_t nbytes, loff_t * ppos)
 {
        struct inode *ino = file->f_path.dentry->d_inode;
        struct proc_dir_entry *dp = PDE(ino);
@@ -74,7 +73,7 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t
                return -EINVAL;
 
        isapnp_cfg_begin(dev->card->number, dev->number);
-       for ( ; pos < 256 && cnt > 0; pos++, buf++, cnt--) {
+       for (; pos < 256 && cnt > 0; pos++, buf++, cnt--) {
                unsigned char val;
                val = isapnp_read_byte(pos);
                __put_user(val, buf);
@@ -85,10 +84,9 @@ static ssize_t isapnp_proc_bus_read(struct file *file, char __user *buf, size_t
        return nbytes;
 }
 
-static const struct file_operations isapnp_proc_bus_file_operations =
-{
-       .llseek         = isapnp_proc_bus_lseek,
-       .read           = isapnp_proc_bus_read,
+static const struct file_operations isapnp_proc_bus_file_operations = {
+       .llseek = isapnp_proc_bus_lseek,
+       .read = isapnp_proc_bus_read,
 };
 
 static int isapnp_proc_attach_device(struct pnp_dev *dev)
@@ -139,13 +137,14 @@ static int __exit isapnp_proc_detach_bus(struct pnp_card *bus)
        remove_proc_entry(name, isapnp_proc_bus_dir);
        return 0;
 }
-#endif /* MODULE */
+#endif                         /* MODULE */
 
 int __init isapnp_proc_init(void)
 {
        struct pnp_dev *dev;
+
        isapnp_proc_bus_dir = proc_mkdir("isapnp", proc_bus);
-       protocol_for_each_dev(&isapnp_protocol,dev) {
+       protocol_for_each_dev(&isapnp_protocol, dev) {
                isapnp_proc_attach_device(dev);
        }
        return 0;
@@ -167,4 +166,4 @@ int __exit isapnp_proc_done(void)
                remove_proc_entry("isapnp", proc_bus);
        return 0;
 }
-#endif /* MODULE */
+#endif                         /* MODULE */
index 57e6ab1004d0bd788f848440099ed35c0730ba4c..3bda513a6bd36cb92ea092ef3fd4ae13c7a6ad19 100644 (file)
@@ -3,7 +3,6 @@
  *
  * based on isapnp.c resource management (c) Jaroslav Kysela <perex@suse.cz>
  * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #include <linux/errno.h>
@@ -26,7 +25,8 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
                return -EINVAL;
 
        if (idx >= PNP_MAX_PORT) {
-               pnp_err("More than 4 ports is incompatible with pnp specifications.");
+               pnp_err
+                   ("More than 4 ports is incompatible with pnp specifications.");
                /* pretend we were successful so at least the manager won't try again */
                return 1;
        }
@@ -41,11 +41,11 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
 
        /* set the initial values */
        *flags |= rule->flags | IORESOURCE_IO;
-       *flags &=  ~IORESOURCE_UNSET;
+       *flags &= ~IORESOURCE_UNSET;
 
        if (!rule->size) {
                *flags |= IORESOURCE_DISABLED;
-               return 1; /* skip disabled resource requests */
+               return 1;       /* skip disabled resource requests */
        }
 
        *start = rule->min;
@@ -70,7 +70,8 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
                return -EINVAL;
 
        if (idx >= PNP_MAX_MEM) {
-               pnp_err("More than 8 mems is incompatible with pnp specifications.");
+               pnp_err
+                   ("More than 8 mems is incompatible with pnp specifications.");
                /* pretend we were successful so at least the manager won't try again */
                return 1;
        }
@@ -85,7 +86,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
 
        /* set the initial values */
        *flags |= rule->flags | IORESOURCE_MEM;
-       *flags &=  ~IORESOURCE_UNSET;
+       *flags &= ~IORESOURCE_UNSET;
 
        /* convert pnp flags to standard Linux flags */
        if (!(rule->flags & IORESOURCE_MEM_WRITEABLE))
@@ -99,11 +100,11 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
 
        if (!rule->size) {
                *flags |= IORESOURCE_DISABLED;
-               return 1; /* skip disabled resource requests */
+               return 1;       /* skip disabled resource requests */
        }
 
        *start = rule->min;
-       *end = *start + rule->size -1;
+       *end = *start + rule->size - 1;
 
        /* run through until pnp_check_mem is happy */
        while (!pnp_check_mem(dev, idx)) {
@@ -115,7 +116,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
        return 1;
 }
 
-static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
+static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
 {
        resource_size_t *start, *end;
        unsigned long *flags;
@@ -130,7 +131,8 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
                return -EINVAL;
 
        if (idx >= PNP_MAX_IRQ) {
-               pnp_err("More than 2 irqs is incompatible with pnp specifications.");
+               pnp_err
+                   ("More than 2 irqs is incompatible with pnp specifications.");
                /* pretend we were successful so at least the manager won't try again */
                return 1;
        }
@@ -145,11 +147,11 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
 
        /* set the initial values */
        *flags |= rule->flags | IORESOURCE_IRQ;
-       *flags &=  ~IORESOURCE_UNSET;
+       *flags &= ~IORESOURCE_UNSET;
 
        if (bitmap_empty(rule->map, PNP_IRQ_NR)) {
                *flags |= IORESOURCE_DISABLED;
-               return 1; /* skip disabled resource requests */
+               return 1;       /* skip disabled resource requests */
        }
 
        /* TBD: need check for >16 IRQ */
@@ -159,9 +161,9 @@ static int pnp_assign_irq(struct pnp_dev * dev, struct pnp_irq *rule, int idx)
                return 1;
        }
        for (i = 0; i < 16; i++) {
-               if(test_bit(xtab[i], rule->map)) {
+               if (test_bit(xtab[i], rule->map)) {
                        *start = *end = xtab[i];
-                       if(pnp_check_irq(dev, idx))
+                       if (pnp_check_irq(dev, idx))
                                return 1;
                }
        }
@@ -183,7 +185,8 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
                return -EINVAL;
 
        if (idx >= PNP_MAX_DMA) {
-               pnp_err("More than 2 dmas is incompatible with pnp specifications.");
+               pnp_err
+                   ("More than 2 dmas is incompatible with pnp specifications.");
                /* pretend we were successful so at least the manager won't try again */
                return 1;
        }
@@ -198,17 +201,17 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
 
        /* set the initial values */
        *flags |= rule->flags | IORESOURCE_DMA;
-       *flags &=  ~IORESOURCE_UNSET;
+       *flags &= ~IORESOURCE_UNSET;
 
        if (!rule->map) {
                *flags |= IORESOURCE_DISABLED;
-               return 1; /* skip disabled resource requests */
+               return 1;       /* skip disabled resource requests */
        }
 
        for (i = 0; i < 8; i++) {
-               if(rule->map & (1<<xtab[i])) {
+               if (rule->map & (1 << xtab[i])) {
                        *start = *end = xtab[i];
-                       if(pnp_check_dma(dev, idx))
+                       if (pnp_check_dma(dev, idx))
                                return 1;
                }
        }
@@ -218,72 +221,80 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
 /**
  * pnp_init_resources - Resets a resource table to default values.
  * @table: pointer to the desired resource table
- *
  */
 void pnp_init_resource_table(struct pnp_resource_table *table)
 {
        int idx;
+
        for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
                table->irq_resource[idx].name = NULL;
                table->irq_resource[idx].start = -1;
                table->irq_resource[idx].end = -1;
-               table->irq_resource[idx].flags = IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               table->irq_resource[idx].flags =
+                   IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
        for (idx = 0; idx < PNP_MAX_DMA; idx++) {
                table->dma_resource[idx].name = NULL;
                table->dma_resource[idx].start = -1;
                table->dma_resource[idx].end = -1;
-               table->dma_resource[idx].flags = IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               table->dma_resource[idx].flags =
+                   IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
        for (idx = 0; idx < PNP_MAX_PORT; idx++) {
                table->port_resource[idx].name = NULL;
                table->port_resource[idx].start = 0;
                table->port_resource[idx].end = 0;
-               table->port_resource[idx].flags = IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               table->port_resource[idx].flags =
+                   IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
        for (idx = 0; idx < PNP_MAX_MEM; idx++) {
                table->mem_resource[idx].name = NULL;
                table->mem_resource[idx].start = 0;
                table->mem_resource[idx].end = 0;
-               table->mem_resource[idx].flags = IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               table->mem_resource[idx].flags =
+                   IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
 }
 
 /**
  * pnp_clean_resources - clears resources that were not manually set
  * @res: the resources to clean
- *
  */
-static void pnp_clean_resource_table(struct pnp_resource_table * res)
+static void pnp_clean_resource_table(struct pnp_resource_table *res)
 {
        int idx;
+
        for (idx = 0; idx < PNP_MAX_IRQ; idx++) {
                if (!(res->irq_resource[idx].flags & IORESOURCE_AUTO))
                        continue;
                res->irq_resource[idx].start = -1;
                res->irq_resource[idx].end = -1;
-               res->irq_resource[idx].flags = IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               res->irq_resource[idx].flags =
+                   IORESOURCE_IRQ | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
        for (idx = 0; idx < PNP_MAX_DMA; idx++) {
                if (!(res->dma_resource[idx].flags & IORESOURCE_AUTO))
                        continue;
                res->dma_resource[idx].start = -1;
                res->dma_resource[idx].end = -1;
-               res->dma_resource[idx].flags = IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               res->dma_resource[idx].flags =
+                   IORESOURCE_DMA | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
        for (idx = 0; idx < PNP_MAX_PORT; idx++) {
                if (!(res->port_resource[idx].flags & IORESOURCE_AUTO))
                        continue;
                res->port_resource[idx].start = 0;
                res->port_resource[idx].end = 0;
-               res->port_resource[idx].flags = IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               res->port_resource[idx].flags =
+                   IORESOURCE_IO | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
        for (idx = 0; idx < PNP_MAX_MEM; idx++) {
                if (!(res->mem_resource[idx].flags & IORESOURCE_AUTO))
                        continue;
                res->mem_resource[idx].start = 0;
                res->mem_resource[idx].end = 0;
-               res->mem_resource[idx].flags = IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
+               res->mem_resource[idx].flags =
+                   IORESOURCE_MEM | IORESOURCE_AUTO | IORESOURCE_UNSET;
        }
 }
 
@@ -306,7 +317,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
                return -ENODEV;
 
        down(&pnp_res_mutex);
-       pnp_clean_resource_table(&dev->res); /* start with a fresh slate */
+       pnp_clean_resource_table(&dev->res);    /* start with a fresh slate */
        if (dev->independent) {
                port = dev->independent->port;
                mem = dev->independent->mem;
@@ -341,10 +352,11 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
        if (depnum) {
                struct pnp_option *dep;
                int i;
-               for (i=1,dep=dev->dependent; i<depnum; i++, dep=dep->next)
-                       if(!dep)
+               for (i = 1, dep = dev->dependent; i < depnum;
+                    i++, dep = dep->next)
+                       if (!dep)
                                goto fail;
-               port =dep->port;
+               port = dep->port;
                mem = dep->mem;
                irq = dep->irq;
                dma = dep->dma;
@@ -378,7 +390,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
        up(&pnp_res_mutex);
        return 1;
 
-fail:
+      fail:
        pnp_clean_resource_table(&dev->res);
        up(&pnp_res_mutex);
        return 0;
@@ -392,10 +404,12 @@ fail:
  *
  * This function can be used by drivers that want to manually set thier resources.
  */
-int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res, int mode)
+int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
+                         int mode)
 {
        int i;
-       struct pnp_resource_table * bak;
+       struct pnp_resource_table *bak;
+
        if (!dev || !res)
                return -EINVAL;
        if (!pnp_can_configure(dev))
@@ -409,19 +423,19 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res,
        dev->res = *res;
        if (!(mode & PNP_CONFIG_FORCE)) {
                for (i = 0; i < PNP_MAX_PORT; i++) {
-                       if(!pnp_check_port(dev,i))
+                       if (!pnp_check_port(dev, i))
                                goto fail;
                }
                for (i = 0; i < PNP_MAX_MEM; i++) {
-                       if(!pnp_check_mem(dev,i))
+                       if (!pnp_check_mem(dev, i))
                                goto fail;
                }
                for (i = 0; i < PNP_MAX_IRQ; i++) {
-                       if(!pnp_check_irq(dev,i))
+                       if (!pnp_check_irq(dev, i))
                                goto fail;
                }
                for (i = 0; i < PNP_MAX_DMA; i++) {
-                       if(!pnp_check_dma(dev,i))
+                       if (!pnp_check_dma(dev, i))
                                goto fail;
                }
        }
@@ -430,7 +444,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table * res,
        kfree(bak);
        return 0;
 
-fail:
+      fail:
        dev->res = *bak;
        up(&pnp_res_mutex);
        kfree(bak);
@@ -440,18 +454,18 @@ fail:
 /**
  * pnp_auto_config_dev - automatically assigns resources to a device
  * @dev: pointer to the desired device
- *
  */
 int pnp_auto_config_dev(struct pnp_dev *dev)
 {
        struct pnp_option *dep;
        int i = 1;
 
-       if(!dev)
+       if (!dev)
                return -EINVAL;
 
-       if(!pnp_can_configure(dev)) {
-               pnp_dbg("Device %s does not support resource configuration.", dev->dev.bus_id);
+       if (!pnp_can_configure(dev)) {
+               pnp_dbg("Device %s does not support resource configuration.",
+                       dev->dev.bus_id);
                return -ENODEV;
        }
 
@@ -476,23 +490,22 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
  * pnp_start_dev - low-level start of the PnP device
  * @dev: pointer to the desired device
  *
- * assumes that resources have alread been allocated
+ * assumes that resources have already been allocated
  */
-
 int pnp_start_dev(struct pnp_dev *dev)
 {
        if (!pnp_can_write(dev)) {
-               pnp_dbg("Device %s does not support activation.", dev->dev.bus_id);
+               pnp_dbg("Device %s does not support activation.",
+                       dev->dev.bus_id);
                return -EINVAL;
        }
 
-       if (dev->protocol->set(dev, &dev->res)<0) {
+       if (dev->protocol->set(dev, &dev->res) < 0) {
                pnp_err("Failed to activate device %s.", dev->dev.bus_id);
                return -EIO;
        }
 
        pnp_info("Device %s activated.", dev->dev.bus_id);
-
        return 0;
 }
 
@@ -502,20 +515,19 @@ int pnp_start_dev(struct pnp_dev *dev)
  *
  * does not free resources
  */
-
 int pnp_stop_dev(struct pnp_dev *dev)
 {
        if (!pnp_can_disable(dev)) {
-               pnp_dbg("Device %s does not support disabling.", dev->dev.bus_id);
+               pnp_dbg("Device %s does not support disabling.",
+                       dev->dev.bus_id);
                return -EINVAL;
        }
-       if (dev->protocol->disable(dev)<0) {
+       if (dev->protocol->disable(dev) < 0) {
                pnp_err("Failed to disable device %s.", dev->dev.bus_id);
                return -EIO;
        }
 
        pnp_info("Device %s disabled.", dev->dev.bus_id);
-
        return 0;
 }
 
@@ -531,9 +543,8 @@ int pnp_activate_dev(struct pnp_dev *dev)
 
        if (!dev)
                return -EINVAL;
-       if (dev->active) {
-               return 0; /* the device is already active */
-       }
+       if (dev->active)
+               return 0;       /* the device is already active */
 
        /* ensure resources are allocated */
        if (pnp_auto_config_dev(dev))
@@ -544,7 +555,6 @@ int pnp_activate_dev(struct pnp_dev *dev)
                return error;
 
        dev->active = 1;
-
        return 1;
 }
 
@@ -558,11 +568,10 @@ int pnp_disable_dev(struct pnp_dev *dev)
 {
        int error;
 
-        if (!dev)
-                return -EINVAL;
-       if (!dev->active) {
-               return 0; /* the device is already disabled */
-       }
+       if (!dev)
+               return -EINVAL;
+       if (!dev->active)
+               return 0;       /* the device is already disabled */
 
        error = pnp_stop_dev(dev);
        if (error)
@@ -583,10 +592,9 @@ int pnp_disable_dev(struct pnp_dev *dev)
  * @resource: pointer to resource to be changed
  * @start: start of region
  * @size: size of region
- *
  */
 void pnp_resource_change(struct resource *resource, resource_size_t start,
-                               resource_size_t size)
+                        resource_size_t size)
 {
        if (resource == NULL)
                return;
@@ -595,11 +603,7 @@ void pnp_resource_change(struct resource *resource, resource_size_t start,
        resource->end = start + size - 1;
 }
 
-
 EXPORT_SYMBOL(pnp_manual_config_dev);
-#if 0
-EXPORT_SYMBOL(pnp_auto_config_dev);
-#endif
 EXPORT_SYMBOL(pnp_start_dev);
 EXPORT_SYMBOL(pnp_stop_dev);
 EXPORT_SYMBOL(pnp_activate_dev);
index fcd32ac575c3493edacfb8ed322c5162ebdd2e61..616fc72190bfd9ad007c459bc142e063a6150d2f 100644 (file)
@@ -34,13 +34,13 @@ static int num = 0;
  * used by the kernel (PCI root, ...), as it is harmless and there were
  * already present in pnpbios. But there is an exception for devices that
  * have irqs (PIC, Timer) because we call acpi_register_gsi.
- * Finaly only devices that have a CRS method need to be in this list.
+ * Finally, only devices that have a CRS method need to be in this list.
  */
-static __initdata struct acpi_device_id excluded_id_list[] ={
-       {"PNP0C09", 0}, /* EC */
-       {"PNP0C0F", 0}, /* Link device */
-       {"PNP0000", 0}, /* PIC */
-       {"PNP0100", 0}, /* Timer */
+static struct __initdata acpi_device_id excluded_id_list[] = {
+       {"PNP0C09", 0},         /* EC */
+       {"PNP0C0F", 0},         /* Link device */
+       {"PNP0000", 0},         /* PIC */
+       {"PNP0100", 0},         /* Timer */
        {"", 0},
 };
 
@@ -84,15 +84,18 @@ static void __init pnpidacpi_to_pnpid(char *id, char *str)
        str[7] = '\0';
 }
 
-static int pnpacpi_get_resources(struct pnp_dev * dev, struct pnp_resource_table * res)
+static int pnpacpi_get_resources(struct pnp_dev *dev,
+                                struct pnp_resource_table *res)
 {
        acpi_status status;
-       status = pnpacpi_parse_allocated_resource((acpi_handle)dev->data,
-               &dev->res);
+
+       status = pnpacpi_parse_allocated_resource((acpi_handle) dev->data,
+                                                 &dev->res);
        return ACPI_FAILURE(status) ? -ENODEV : 0;
 }
 
-static int pnpacpi_set_resources(struct pnp_dev * dev, struct pnp_resource_table * res)
+static int pnpacpi_set_resources(struct pnp_dev *dev,
+                                struct pnp_resource_table *res)
 {
        acpi_handle handle = dev->data;
        struct acpi_buffer buffer;
@@ -119,30 +122,36 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev)
        acpi_status status;
 
        /* acpi_unregister_gsi(pnp_irq(dev, 0)); */
-       status = acpi_evaluate_object((acpi_handle)dev->data,
-               "_DIS", NULL, NULL);
+       status = acpi_evaluate_object((acpi_handle) dev->data,
+                                     "_DIS", NULL, NULL);
        return ACPI_FAILURE(status) ? -ENODEV : 0;
 }
 
+#ifdef CONFIG_ACPI_SLEEP
 static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state)
 {
-       return acpi_bus_set_power((acpi_handle)dev->data,
-               acpi_pm_device_sleep_state(&dev->dev,
-               device_may_wakeup(&dev->dev), NULL));
+       return acpi_bus_set_power((acpi_handle) dev->data,
+                                 acpi_pm_device_sleep_state(&dev->dev,
+                                                            device_may_wakeup
+                                                            (&dev->dev),
+                                                            NULL));
 }
 
 static int pnpacpi_resume(struct pnp_dev *dev)
 {
-       return acpi_bus_set_power((acpi_handle)dev->data, ACPI_STATE_D0);
+       return acpi_bus_set_power((acpi_handle) dev->data, ACPI_STATE_D0);
 }
+#endif
 
 static struct pnp_protocol pnpacpi_protocol = {
-       .name   = "Plug and Play ACPI",
-       .get    = pnpacpi_get_resources,
-       .set    = pnpacpi_set_resources,
+       .name    = "Plug and Play ACPI",
+       .get     = pnpacpi_get_resources,
+       .set     = pnpacpi_set_resources,
        .disable = pnpacpi_disable_resources,
+#ifdef CONFIG_ACPI_SLEEP
        .suspend = pnpacpi_suspend,
        .resume = pnpacpi_resume,
+#endif
 };
 
 static int __init pnpacpi_add_device(struct acpi_device *device)
@@ -154,17 +163,17 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
 
        status = acpi_get_handle(device->handle, "_CRS", &temp);
        if (ACPI_FAILURE(status) || !ispnpidacpi(acpi_device_hid(device)) ||
-               is_exclusive_device(device))
+           is_exclusive_device(device))
                return 0;
 
        pnp_dbg("ACPI device : hid %s", acpi_device_hid(device));
-       dev =  kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
+       dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
        if (!dev) {
                pnp_err("Out of memory");
                return -ENOMEM;
        }
        dev->data = device->handle;
-       /* .enabled means if the device can decode the resources */
+       /* .enabled means the device can decode the resources */
        dev->active = device->status.enabled;
        status = acpi_get_handle(device->handle, "_SRS", &temp);
        if (ACPI_SUCCESS(status))
@@ -194,20 +203,23 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
        pnpidacpi_to_pnpid(acpi_device_hid(device), dev_id->id);
        pnp_add_id(dev_id, dev);
 
-       if(dev->active) {
+       if (dev->active) {
                /* parse allocated resource */
-               status = pnpacpi_parse_allocated_resource(device->handle, &dev->res);
+               status = pnpacpi_parse_allocated_resource(device->handle,
+                                                         &dev->res);
                if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
-                       pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s", dev_id->id);
+                       pnp_err("PnPACPI: METHOD_NAME__CRS failure for %s",
+                               dev_id->id);
                        goto err1;
                }
        }
 
-       if(dev->capabilities & PNP_CONFIGURABLE) {
+       if (dev->capabilities & PNP_CONFIGURABLE) {
                status = pnpacpi_parse_resource_option_data(device->handle,
-                       dev);
+                                                           dev);
                if (ACPI_FAILURE(status) && (status != AE_NOT_FOUND)) {
-                       pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s", dev_id->id);
+                       pnp_err("PnPACPI: METHOD_NAME__PRS failure for %s",
+                               dev_id->id);
                        goto err1;
                }
        }
@@ -233,18 +245,19 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
        if (!dev->active)
                pnp_init_resource_table(&dev->res);
        pnp_add_device(dev);
-       num ++;
+       num++;
 
        return AE_OK;
-err1:
+      err1:
        kfree(dev_id);
-err:
+      err:
        kfree(dev);
        return -EINVAL;
 }
 
 static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
-       u32 lvl, void *context, void **rv)
+                                                    u32 lvl, void *context,
+                                                    void **rv)
 {
        struct acpi_device *device;
 
@@ -257,23 +270,22 @@ static acpi_status __init pnpacpi_add_device_handler(acpi_handle handle,
 
 static int __init acpi_pnp_match(struct device *dev, void *_pnp)
 {
-       struct acpi_device      *acpi = to_acpi_device(dev);
-       struct pnp_dev          *pnp = _pnp;
+       struct acpi_device *acpi = to_acpi_device(dev);
+       struct pnp_dev *pnp = _pnp;
 
        /* true means it matched */
        return acpi->flags.hardware_id
-               && !acpi_get_physical_device(acpi->handle)
-               && compare_pnp_id(pnp->id, acpi->pnp.hardware_id);
+           && !acpi_get_physical_device(acpi->handle)
+           && compare_pnp_id(pnp->id, acpi->pnp.hardware_id);
 }
 
-static int __init acpi_pnp_find_device(struct device *dev, acpi_handle *handle)
+static int __init acpi_pnp_find_device(struct device *dev, acpi_handle * handle)
 {
-       struct device           *adev;
-       struct acpi_device      *acpi;
+       struct device *adev;
+       struct acpi_device *acpi;
 
        adev = bus_find_device(&acpi_bus_type, NULL,
-                       to_pnp_dev(dev),
-                       acpi_pnp_match);
+                              to_pnp_dev(dev), acpi_pnp_match);
        if (!adev)
                return -ENODEV;
 
@@ -287,7 +299,7 @@ static int __init acpi_pnp_find_device(struct device *dev, acpi_handle *handle)
  * pnpdev->dev.archdata.acpi_handle point to its ACPI sibling.
  */
 static struct acpi_bus_type __initdata acpi_pnp_bus = {
-       .bus = &pnp_bus_type,
+       .bus         = &pnp_bus_type,
        .find_device = acpi_pnp_find_device,
 };
 
@@ -307,6 +319,7 @@ static int __init pnpacpi_init(void)
        pnp_platform_devices = 1;
        return 0;
 }
+
 subsys_initcall(pnpacpi_init);
 
 static int __init pnpacpi_setup(char *str)
@@ -317,8 +330,5 @@ static int __init pnpacpi_setup(char *str)
                pnpacpi_disabled = 1;
        return 1;
 }
-__setup("pnpacpi=", pnpacpi_setup);
 
-#if 0
-EXPORT_SYMBOL(pnpacpi_protocol);
-#endif
+__setup("pnpacpi=", pnpacpi_setup);
index 118ac9779b3cf5bffc479a0ded1ba55db3e92da7..ce5027feb3da88cd5e32ced586a85c666358ea7c 100644 (file)
@@ -40,8 +40,7 @@ static int irq_flags(int triggering, int polarity)
                        flag = IORESOURCE_IRQ_LOWLEVEL;
                else
                        flag = IORESOURCE_IRQ_HIGHLEVEL;
-       }
-       else {
+       } else {
                if (polarity == ACPI_ACTIVE_LOW)
                        flag = IORESOURCE_IRQ_LOWEDGE;
                else
@@ -72,9 +71,9 @@ static void decode_irq_flags(int flag, int *triggering, int *polarity)
        }
 }
 
-static void
-pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
-       int triggering, int polarity, int shareable)
+static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res,
+                                               u32 gsi, int triggering,
+                                               int polarity, int shareable)
 {
        int i = 0;
        int irq;
@@ -83,12 +82,12 @@ pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, u32 gsi,
                return;
 
        while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) &&
-                       i < PNP_MAX_IRQ)
+              i < PNP_MAX_IRQ)
                i++;
        if (i >= PNP_MAX_IRQ)
                return;
 
-       res->irq_resource[i].flags = IORESOURCE_IRQ;  // Also clears _UNSET flag
+       res->irq_resource[i].flags = IORESOURCE_IRQ;    // Also clears _UNSET flag
        res->irq_resource[i].flags |= irq_flags(triggering, polarity);
        irq = acpi_register_gsi(gsi, triggering, polarity);
        if (irq < 0) {
@@ -147,17 +146,19 @@ static int dma_flags(int type, int bus_master, int transfer)
        return flags;
 }
 
-static void
-pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma,
-       int type, int bus_master, int transfer)
+static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res,
+                                               u32 dma, int type,
+                                               int bus_master, int transfer)
 {
        int i = 0;
+
        while (i < PNP_MAX_DMA &&
-                       !(res->dma_resource[i].flags & IORESOURCE_UNSET))
+              !(res->dma_resource[i].flags & IORESOURCE_UNSET))
                i++;
        if (i < PNP_MAX_DMA) {
-               res->dma_resource[i].flags = IORESOURCE_DMA;  // Also clears _UNSET flag
-               res->dma_resource[i].flags |= dma_flags(type, bus_master, transfer);
+               res->dma_resource[i].flags = IORESOURCE_DMA;    // Also clears _UNSET flag
+               res->dma_resource[i].flags |=
+                   dma_flags(type, bus_master, transfer);
                if (dma == -1) {
                        res->dma_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
@@ -167,19 +168,19 @@ pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, u32 dma,
        }
 }
 
-static void
-pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
-       u64 io, u64 len, int io_decode)
+static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
+                                              u64 io, u64 len, int io_decode)
 {
        int i = 0;
+
        while (!(res->port_resource[i].flags & IORESOURCE_UNSET) &&
-                       i < PNP_MAX_PORT)
+              i < PNP_MAX_PORT)
                i++;
        if (i < PNP_MAX_PORT) {
-               res->port_resource[i].flags = IORESOURCE_IO;  // Also clears _UNSET flag
+               res->port_resource[i].flags = IORESOURCE_IO;    // Also clears _UNSET flag
                if (io_decode == ACPI_DECODE_16)
                        res->port_resource[i].flags |= PNP_PORT_FLAG_16BITADDR;
-               if (len <= 0 || (io + len -1) >= 0x10003) {
+               if (len <= 0 || (io + len - 1) >= 0x10003) {
                        res->port_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
@@ -188,21 +189,22 @@ pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res,
        }
 }
 
-static void
-pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
-       u64 mem, u64 len, int write_protect)
+static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
+                                               u64 mem, u64 len,
+                                               int write_protect)
 {
        int i = 0;
+
        while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) &&
-                       (i < PNP_MAX_MEM))
+              (i < PNP_MAX_MEM))
                i++;
        if (i < PNP_MAX_MEM) {
-               res->mem_resource[i].flags = IORESOURCE_MEM;  // Also clears _UNSET flag
+               res->mem_resource[i].flags = IORESOURCE_MEM;    // Also clears _UNSET flag
                if (len <= 0) {
                        res->mem_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
-               if(write_protect == ACPI_READ_WRITE_MEMORY)
+               if (write_protect == ACPI_READ_WRITE_MEMORY)
                        res->mem_resource[i].flags |= IORESOURCE_MEM_WRITEABLE;
 
                res->mem_resource[i].start = mem;
@@ -210,9 +212,8 @@ pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res,
        }
 }
 
-static void
-pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
-       struct acpi_resource *res)
+static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
+                                                 struct acpi_resource *res)
 {
        struct acpi_resource_address64 addr, *p = &addr;
        acpi_status status;
@@ -220,7 +221,7 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
        status = acpi_resource_to_address64(res, p);
        if (!ACPI_SUCCESS(status)) {
                pnp_warn("PnPACPI: failed to convert resource type %d",
-                       res->type);
+                        res->type);
                return;
        }
 
@@ -229,17 +230,20 @@ pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res_table,
 
        if (p->resource_type == ACPI_MEMORY_RANGE)
                pnpacpi_parse_allocated_memresource(res_table,
-                               p->minimum, p->address_length, p->info.mem.write_protect);
+                       p->minimum, p->address_length,
+                       p->info.mem.write_protect);
        else if (p->resource_type == ACPI_IO_RANGE)
                pnpacpi_parse_allocated_ioresource(res_table,
-                               p->minimum, p->address_length,
-                               p->granularity == 0xfff ? ACPI_DECODE_10 : ACPI_DECODE_16);
+                       p->minimum, p->address_length,
+                       p->granularity == 0xfff ? ACPI_DECODE_10 :
+                               ACPI_DECODE_16);
 }
 
 static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
-       void *data)
+                                             void *data)
 {
-       struct pnp_resource_table *res_table = (struct pnp_resource_table *)data;
+       struct pnp_resource_table *res_table =
+           (struct pnp_resource_table *)data;
        int i;
 
        switch (res->type) {
@@ -260,17 +264,17 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
        case ACPI_RESOURCE_TYPE_DMA:
                if (res->data.dma.channel_count > 0)
                        pnpacpi_parse_allocated_dmaresource(res_table,
-                                       res->data.dma.channels[0],
-                                       res->data.dma.type,
-                                       res->data.dma.bus_master,
-                                       res->data.dma.transfer);
+                               res->data.dma.channels[0],
+                               res->data.dma.type,
+                               res->data.dma.bus_master,
+                               res->data.dma.transfer);
                break;
 
        case ACPI_RESOURCE_TYPE_IO:
                pnpacpi_parse_allocated_ioresource(res_table,
-                               res->data.io.minimum,
-                               res->data.io.address_length,
-                               res->data.io.io_decode);
+                       res->data.io.minimum,
+                       res->data.io.address_length,
+                       res->data.io.io_decode);
                break;
 
        case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -279,9 +283,9 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
 
        case ACPI_RESOURCE_TYPE_FIXED_IO:
                pnpacpi_parse_allocated_ioresource(res_table,
-                               res->data.fixed_io.address,
-                               res->data.fixed_io.address_length,
-                               ACPI_DECODE_10);
+                       res->data.fixed_io.address,
+                       res->data.fixed_io.address_length,
+                       ACPI_DECODE_10);
                break;
 
        case ACPI_RESOURCE_TYPE_VENDOR:
@@ -292,21 +296,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
 
        case ACPI_RESOURCE_TYPE_MEMORY24:
                pnpacpi_parse_allocated_memresource(res_table,
-                               res->data.memory24.minimum,
-                               res->data.memory24.address_length,
-                               res->data.memory24.write_protect);
+                       res->data.memory24.minimum,
+                       res->data.memory24.address_length,
+                       res->data.memory24.write_protect);
                break;
        case ACPI_RESOURCE_TYPE_MEMORY32:
                pnpacpi_parse_allocated_memresource(res_table,
-                               res->data.memory32.minimum,
-                               res->data.memory32.address_length,
-                               res->data.memory32.write_protect);
+                       res->data.memory32.minimum,
+                       res->data.memory32.address_length,
+                       res->data.memory32.write_protect);
                break;
        case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
                pnpacpi_parse_allocated_memresource(res_table,
-                               res->data.fixed_memory32.address,
-                               res->data.fixed_memory32.address_length,
-                               res->data.fixed_memory32.write_protect);
+                       res->data.fixed_memory32.address,
+                       res->data.fixed_memory32.address_length,
+                       res->data.fixed_memory32.write_protect);
                break;
        case ACPI_RESOURCE_TYPE_ADDRESS16:
        case ACPI_RESOURCE_TYPE_ADDRESS32:
@@ -343,18 +347,21 @@ static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
        return AE_OK;
 }
 
-acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle, struct pnp_resource_table *res)
+acpi_status pnpacpi_parse_allocated_resource(acpi_handle handle,
+                                            struct pnp_resource_table * res)
 {
        /* Blank the resource table values */
        pnp_init_resource_table(res);
 
-       return acpi_walk_resources(handle, METHOD_NAME__CRS, pnpacpi_allocated_resource, res);
+       return acpi_walk_resources(handle, METHOD_NAME__CRS,
+                                  pnpacpi_allocated_resource, res);
 }
 
-static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_resource_dma *p)
+static void pnpacpi_parse_dma_option(struct pnp_option *option,
+                                    struct acpi_resource_dma *p)
 {
        int i;
-       struct pnp_dma * dma;
+       struct pnp_dma *dma;
 
        if (p->channel_count == 0)
                return;
@@ -362,18 +369,16 @@ static void pnpacpi_parse_dma_option(struct pnp_option *option, struct acpi_reso
        if (!dma)
                return;
 
-       for(i = 0; i < p->channel_count; i++)
+       for (i = 0; i < p->channel_count; i++)
                dma->map |= 1 << p->channels[i];
 
        dma->flags = dma_flags(p->type, p->bus_master, p->transfer);
 
        pnp_register_dma_resource(option, dma);
-       return;
 }
 
-
 static void pnpacpi_parse_irq_option(struct pnp_option *option,
-       struct acpi_resource_irq *p)
+                                    struct acpi_resource_irq *p)
 {
        int i;
        struct pnp_irq *irq;
@@ -384,17 +389,16 @@ static void pnpacpi_parse_irq_option(struct pnp_option *option,
        if (!irq)
                return;
 
-       for(i = 0; i < p->interrupt_count; i++)
+       for (i = 0; i < p->interrupt_count; i++)
                if (p->interrupts[i])
                        __set_bit(p->interrupts[i], irq->map);
        irq->flags = irq_flags(p->triggering, p->polarity);
 
        pnp_register_irq_resource(option, irq);
-       return;
 }
 
 static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
-       struct acpi_resource_extended_irq *p)
+                                        struct acpi_resource_extended_irq *p)
 {
        int i;
        struct pnp_irq *irq;
@@ -405,18 +409,16 @@ static void pnpacpi_parse_ext_irq_option(struct pnp_option *option,
        if (!irq)
                return;
 
-       for(i = 0; i < p->interrupt_count; i++)
+       for (i = 0; i < p->interrupt_count; i++)
                if (p->interrupts[i])
                        __set_bit(p->interrupts[i], irq->map);
        irq->flags = irq_flags(p->triggering, p->polarity);
 
        pnp_register_irq_resource(option, irq);
-       return;
 }
 
-static void
-pnpacpi_parse_port_option(struct pnp_option *option,
-       struct acpi_resource_io *io)
+static void pnpacpi_parse_port_option(struct pnp_option *option,
+                                     struct acpi_resource_io *io)
 {
        struct pnp_port *port;
 
@@ -430,14 +432,12 @@ pnpacpi_parse_port_option(struct pnp_option *option,
        port->align = io->alignment;
        port->size = io->address_length;
        port->flags = ACPI_DECODE_16 == io->io_decode ?
-               PNP_PORT_FLAG_16BITADDR : 0;
+           PNP_PORT_FLAG_16BITADDR : 0;
        pnp_register_port_resource(option, port);
-       return;
 }
 
-static void
-pnpacpi_parse_fixed_port_option(struct pnp_option *option,
-       struct acpi_resource_fixed_io *io)
+static void pnpacpi_parse_fixed_port_option(struct pnp_option *option,
+                                           struct acpi_resource_fixed_io *io)
 {
        struct pnp_port *port;
 
@@ -451,12 +451,10 @@ pnpacpi_parse_fixed_port_option(struct pnp_option *option,
        port->align = 0;
        port->flags = PNP_PORT_FLAG_FIXED;
        pnp_register_port_resource(option, port);
-       return;
 }
 
-static void
-pnpacpi_parse_mem24_option(struct pnp_option *option,
-       struct acpi_resource_memory24 *p)
+static void pnpacpi_parse_mem24_option(struct pnp_option *option,
+                                      struct acpi_resource_memory24 *p)
 {
        struct pnp_mem *mem;
 
@@ -471,15 +469,13 @@ pnpacpi_parse_mem24_option(struct pnp_option *option,
        mem->size = p->address_length;
 
        mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
-                       IORESOURCE_MEM_WRITEABLE : 0;
+           IORESOURCE_MEM_WRITEABLE : 0;
 
        pnp_register_mem_resource(option, mem);
-       return;
 }
 
-static void
-pnpacpi_parse_mem32_option(struct pnp_option *option,
-       struct acpi_resource_memory32 *p)
+static void pnpacpi_parse_mem32_option(struct pnp_option *option,
+                                      struct acpi_resource_memory32 *p)
 {
        struct pnp_mem *mem;
 
@@ -494,15 +490,13 @@ pnpacpi_parse_mem32_option(struct pnp_option *option,
        mem->size = p->address_length;
 
        mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
-                       IORESOURCE_MEM_WRITEABLE : 0;
+           IORESOURCE_MEM_WRITEABLE : 0;
 
        pnp_register_mem_resource(option, mem);
-       return;
 }
 
-static void
-pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
-       struct acpi_resource_fixed_memory32 *p)
+static void pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
+                                        struct acpi_resource_fixed_memory32 *p)
 {
        struct pnp_mem *mem;
 
@@ -516,14 +510,13 @@ pnpacpi_parse_fixed_mem32_option(struct pnp_option *option,
        mem->align = 0;
 
        mem->flags = (ACPI_READ_WRITE_MEMORY == p->write_protect) ?
-                       IORESOURCE_MEM_WRITEABLE : 0;
+           IORESOURCE_MEM_WRITEABLE : 0;
 
        pnp_register_mem_resource(option, mem);
-       return;
 }
 
-static void
-pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
+static void pnpacpi_parse_address_option(struct pnp_option *option,
+                                        struct acpi_resource *r)
 {
        struct acpi_resource_address64 addr, *p = &addr;
        acpi_status status;
@@ -532,7 +525,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
 
        status = acpi_resource_to_address64(r, p);
        if (!ACPI_SUCCESS(status)) {
-               pnp_warn("PnPACPI: failed to convert resource type %d", r->type);
+               pnp_warn("PnPACPI: failed to convert resource type %d",
+                        r->type);
                return;
        }
 
@@ -547,7 +541,8 @@ pnpacpi_parse_address_option(struct pnp_option *option, struct acpi_resource *r)
                mem->size = p->address_length;
                mem->align = 0;
                mem->flags = (p->info.mem.write_protect ==
-                   ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE : 0;
+                             ACPI_READ_WRITE_MEMORY) ? IORESOURCE_MEM_WRITEABLE
+                   : 0;
                pnp_register_mem_resource(option, mem);
        } else if (p->resource_type == ACPI_IO_RANGE) {
                port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL);
@@ -568,109 +563,108 @@ struct acpipnp_parse_option_s {
 };
 
 static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
-       void *data)
+                                          void *data)
 {
        int priority = 0;
-       struct acpipnp_parse_option_s *parse_data = (struct acpipnp_parse_option_s *)data;
+       struct acpipnp_parse_option_s *parse_data =
+           (struct acpipnp_parse_option_s *)data;
        struct pnp_dev *dev = parse_data->dev;
        struct pnp_option *option = parse_data->option;
 
        switch (res->type) {
-               case ACPI_RESOURCE_TYPE_IRQ:
-                       pnpacpi_parse_irq_option(option, &res->data.irq);
-                       break;
+       case ACPI_RESOURCE_TYPE_IRQ:
+               pnpacpi_parse_irq_option(option, &res->data.irq);
+               break;
 
-               case ACPI_RESOURCE_TYPE_DMA:
-                       pnpacpi_parse_dma_option(option, &res->data.dma);
-                       break;
+       case ACPI_RESOURCE_TYPE_DMA:
+               pnpacpi_parse_dma_option(option, &res->data.dma);
+               break;
 
-               case ACPI_RESOURCE_TYPE_START_DEPENDENT:
-                       switch (res->data.start_dpf.compatibility_priority) {
-                               case ACPI_GOOD_CONFIGURATION:
-                                       priority = PNP_RES_PRIORITY_PREFERRED;
-                                       break;
-
-                               case ACPI_ACCEPTABLE_CONFIGURATION:
-                                       priority = PNP_RES_PRIORITY_ACCEPTABLE;
-                                       break;
-
-                               case ACPI_SUB_OPTIMAL_CONFIGURATION:
-                                       priority = PNP_RES_PRIORITY_FUNCTIONAL;
-                                       break;
-                               default:
-                                       priority = PNP_RES_PRIORITY_INVALID;
-                                       break;
-                       }
-                       /* TBD: Considering performace/robustness bits */
-                       option = pnp_register_dependent_option(dev, priority);
-                       if (!option)
-                               return AE_ERROR;
-                       parse_data->option = option;
+       case ACPI_RESOURCE_TYPE_START_DEPENDENT:
+               switch (res->data.start_dpf.compatibility_priority) {
+               case ACPI_GOOD_CONFIGURATION:
+                       priority = PNP_RES_PRIORITY_PREFERRED;
                        break;
 
-               case ACPI_RESOURCE_TYPE_END_DEPENDENT:
-                       /*only one EndDependentFn is allowed*/
-                       if (!parse_data->option_independent) {
-                               pnp_warn("PnPACPI: more than one EndDependentFn");
-                               return AE_ERROR;
-                       }
-                       parse_data->option = parse_data->option_independent;
-                       parse_data->option_independent = NULL;
+               case ACPI_ACCEPTABLE_CONFIGURATION:
+                       priority = PNP_RES_PRIORITY_ACCEPTABLE;
                        break;
 
-               case ACPI_RESOURCE_TYPE_IO:
-                       pnpacpi_parse_port_option(option, &res->data.io);
+               case ACPI_SUB_OPTIMAL_CONFIGURATION:
+                       priority = PNP_RES_PRIORITY_FUNCTIONAL;
                        break;
-
-               case ACPI_RESOURCE_TYPE_FIXED_IO:
-                       pnpacpi_parse_fixed_port_option(option,
-                               &res->data.fixed_io);
+               default:
+                       priority = PNP_RES_PRIORITY_INVALID;
                        break;
+               }
+               /* TBD: Consider performance/robustness bits */
+               option = pnp_register_dependent_option(dev, priority);
+               if (!option)
+                       return AE_ERROR;
+               parse_data->option = option;
+               break;
 
-               case ACPI_RESOURCE_TYPE_VENDOR:
-               case ACPI_RESOURCE_TYPE_END_TAG:
-                       break;
+       case ACPI_RESOURCE_TYPE_END_DEPENDENT:
+               /*only one EndDependentFn is allowed */
+               if (!parse_data->option_independent) {
+                       pnp_warn("PnPACPI: more than one EndDependentFn");
+                       return AE_ERROR;
+               }
+               parse_data->option = parse_data->option_independent;
+               parse_data->option_independent = NULL;
+               break;
 
-               case ACPI_RESOURCE_TYPE_MEMORY24:
-                       pnpacpi_parse_mem24_option(option, &res->data.memory24);
-                       break;
+       case ACPI_RESOURCE_TYPE_IO:
+               pnpacpi_parse_port_option(option, &res->data.io);
+               break;
 
-               case ACPI_RESOURCE_TYPE_MEMORY32:
-                       pnpacpi_parse_mem32_option(option, &res->data.memory32);
-                       break;
+       case ACPI_RESOURCE_TYPE_FIXED_IO:
+               pnpacpi_parse_fixed_port_option(option, &res->data.fixed_io);
+               break;
 
-               case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
-                       pnpacpi_parse_fixed_mem32_option(option,
-                               &res->data.fixed_memory32);
-                       break;
+       case ACPI_RESOURCE_TYPE_VENDOR:
+       case ACPI_RESOURCE_TYPE_END_TAG:
+               break;
 
-               case ACPI_RESOURCE_TYPE_ADDRESS16:
-               case ACPI_RESOURCE_TYPE_ADDRESS32:
-               case ACPI_RESOURCE_TYPE_ADDRESS64:
-                       pnpacpi_parse_address_option(option, res);
-                       break;
+       case ACPI_RESOURCE_TYPE_MEMORY24:
+               pnpacpi_parse_mem24_option(option, &res->data.memory24);
+               break;
 
-               case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
-                       break;
+       case ACPI_RESOURCE_TYPE_MEMORY32:
+               pnpacpi_parse_mem32_option(option, &res->data.memory32);
+               break;
 
-               case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
-                       pnpacpi_parse_ext_irq_option(option,
-                               &res->data.extended_irq);
-                       break;
+       case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
+               pnpacpi_parse_fixed_mem32_option(option,
+                                                &res->data.fixed_memory32);
+               break;
 
-               case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
-                       break;
+       case ACPI_RESOURCE_TYPE_ADDRESS16:
+       case ACPI_RESOURCE_TYPE_ADDRESS32:
+       case ACPI_RESOURCE_TYPE_ADDRESS64:
+               pnpacpi_parse_address_option(option, res);
+               break;
 
-               default:
-                       pnp_warn("PnPACPI: unknown resource type %d", res->type);
-                       return AE_ERROR;
+       case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
+               break;
+
+       case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
+               pnpacpi_parse_ext_irq_option(option, &res->data.extended_irq);
+               break;
+
+       case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
+               break;
+
+       default:
+               pnp_warn("PnPACPI: unknown resource type %d", res->type);
+               return AE_ERROR;
        }
 
        return AE_OK;
 }
 
 acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
-       struct pnp_dev *dev)
+                                              struct pnp_dev * dev)
 {
        acpi_status status;
        struct acpipnp_parse_option_s parse_data;
@@ -681,7 +675,7 @@ acpi_status pnpacpi_parse_resource_option_data(acpi_handle handle,
        parse_data.option_independent = parse_data.option;
        parse_data.dev = dev;
        status = acpi_walk_resources(handle, METHOD_NAME__PRS,
-               pnpacpi_option_resource, &parse_data);
+                                    pnpacpi_option_resource, &parse_data);
 
        return status;
 }
@@ -709,7 +703,7 @@ static int pnpacpi_supported_resource(struct acpi_resource *res)
  * Set resource
  */
 static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
-       void *data)
+                                          void *data)
 {
        int *res_cnt = (int *)data;
 
@@ -732,14 +726,14 @@ static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data)
 }
 
 int pnpacpi_build_resource_template(acpi_handle handle,
-       struct acpi_buffer *buffer)
+                                   struct acpi_buffer *buffer)
 {
        struct acpi_resource *resource;
        int res_cnt = 0;
        acpi_status status;
 
        status = acpi_walk_resources(handle, METHOD_NAME__CRS,
-               pnpacpi_count_resources, &res_cnt);
+                                    pnpacpi_count_resources, &res_cnt);
        if (ACPI_FAILURE(status)) {
                pnp_err("Evaluate _CRS failed");
                return -EINVAL;
@@ -753,7 +747,7 @@ int pnpacpi_build_resource_template(acpi_handle handle,
        pnp_dbg("Res cnt %d", res_cnt);
        resource = (struct acpi_resource *)buffer->pointer;
        status = acpi_walk_resources(handle, METHOD_NAME__CRS,
-               pnpacpi_type_resources, &resource);
+                                    pnpacpi_type_resources, &resource);
        if (ACPI_FAILURE(status)) {
                kfree(buffer->pointer);
                pnp_err("Evaluate _CRS failed");
@@ -766,7 +760,7 @@ int pnpacpi_build_resource_template(acpi_handle handle,
 }
 
 static void pnpacpi_encode_irq(struct acpi_resource *resource,
-       struct resource *p)
+                              struct resource *p)
 {
        int triggering, polarity;
 
@@ -782,7 +776,7 @@ static void pnpacpi_encode_irq(struct acpi_resource *resource,
 }
 
 static void pnpacpi_encode_ext_irq(struct acpi_resource *resource,
-       struct resource *p)
+                                  struct resource *p)
 {
        int triggering, polarity;
 
@@ -799,32 +793,32 @@ static void pnpacpi_encode_ext_irq(struct acpi_resource *resource,
 }
 
 static void pnpacpi_encode_dma(struct acpi_resource *resource,
-       struct resource *p)
+                              struct resource *p)
 {
        /* Note: pnp_assign_dma will copy pnp_dma->flags into p->flags */
        switch (p->flags & IORESOURCE_DMA_SPEED_MASK) {
-               case IORESOURCE_DMA_TYPEA:
-                       resource->data.dma.type = ACPI_TYPE_A;
-                       break;
-               case IORESOURCE_DMA_TYPEB:
-                       resource->data.dma.type = ACPI_TYPE_B;
-                       break;
-               case IORESOURCE_DMA_TYPEF:
-                       resource->data.dma.type = ACPI_TYPE_F;
-                       break;
-               default:
-                       resource->data.dma.type = ACPI_COMPATIBILITY;
+       case IORESOURCE_DMA_TYPEA:
+               resource->data.dma.type = ACPI_TYPE_A;
+               break;
+       case IORESOURCE_DMA_TYPEB:
+               resource->data.dma.type = ACPI_TYPE_B;
+               break;
+       case IORESOURCE_DMA_TYPEF:
+               resource->data.dma.type = ACPI_TYPE_F;
+               break;
+       default:
+               resource->data.dma.type = ACPI_COMPATIBILITY;
        }
 
        switch (p->flags & IORESOURCE_DMA_TYPE_MASK) {
-               case IORESOURCE_DMA_8BIT:
-                       resource->data.dma.transfer = ACPI_TRANSFER_8;
-                       break;
-               case IORESOURCE_DMA_8AND16BIT:
-                       resource->data.dma.transfer = ACPI_TRANSFER_8_16;
-                       break;
-               default:
-                       resource->data.dma.transfer = ACPI_TRANSFER_16;
+       case IORESOURCE_DMA_8BIT:
+               resource->data.dma.transfer = ACPI_TRANSFER_8;
+               break;
+       case IORESOURCE_DMA_8AND16BIT:
+               resource->data.dma.transfer = ACPI_TRANSFER_8_16;
+               break;
+       default:
+               resource->data.dma.transfer = ACPI_TRANSFER_16;
        }
 
        resource->data.dma.bus_master = !!(p->flags & IORESOURCE_DMA_MASTER);
@@ -833,31 +827,31 @@ static void pnpacpi_encode_dma(struct acpi_resource *resource,
 }
 
 static void pnpacpi_encode_io(struct acpi_resource *resource,
-       struct resource *p)
+                             struct resource *p)
 {
        /* Note: pnp_assign_port will copy pnp_port->flags into p->flags */
-       resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR)?
-               ACPI_DECODE_16 : ACPI_DECODE_10;
+       resource->data.io.io_decode = (p->flags & PNP_PORT_FLAG_16BITADDR) ?
+           ACPI_DECODE_16 : ACPI_DECODE_10;
        resource->data.io.minimum = p->start;
        resource->data.io.maximum = p->end;
-       resource->data.io.alignment = 0; /* Correct? */
+       resource->data.io.alignment = 0;        /* Correct? */
        resource->data.io.address_length = p->end - p->start + 1;
 }
 
 static void pnpacpi_encode_fixed_io(struct acpi_resource *resource,
-       struct resource *p)
+                                   struct resource *p)
 {
        resource->data.fixed_io.address = p->start;
        resource->data.fixed_io.address_length = p->end - p->start + 1;
 }
 
 static void pnpacpi_encode_mem24(struct acpi_resource *resource,
-       struct resource *p)
+                                struct resource *p)
 {
        /* Note: pnp_assign_mem will copy pnp_mem->flags into p->flags */
        resource->data.memory24.write_protect =
-               (p->flags & IORESOURCE_MEM_WRITEABLE) ?
-               ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
+           (p->flags & IORESOURCE_MEM_WRITEABLE) ?
+           ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
        resource->data.memory24.minimum = p->start;
        resource->data.memory24.maximum = p->end;
        resource->data.memory24.alignment = 0;
@@ -865,11 +859,11 @@ static void pnpacpi_encode_mem24(struct acpi_resource *resource,
 }
 
 static void pnpacpi_encode_mem32(struct acpi_resource *resource,
-       struct resource *p)
+                                struct resource *p)
 {
        resource->data.memory32.write_protect =
-               (p->flags & IORESOURCE_MEM_WRITEABLE) ?
-               ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
+           (p->flags & IORESOURCE_MEM_WRITEABLE) ?
+           ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
        resource->data.memory32.minimum = p->start;
        resource->data.memory32.maximum = p->end;
        resource->data.memory32.alignment = 0;
@@ -877,74 +871,77 @@ static void pnpacpi_encode_mem32(struct acpi_resource *resource,
 }
 
 static void pnpacpi_encode_fixed_mem32(struct acpi_resource *resource,
-       struct resource *p)
+                                      struct resource *p)
 {
        resource->data.fixed_memory32.write_protect =
-               (p->flags & IORESOURCE_MEM_WRITEABLE) ?
-               ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
+           (p->flags & IORESOURCE_MEM_WRITEABLE) ?
+           ACPI_READ_WRITE_MEMORY : ACPI_READ_ONLY_MEMORY;
        resource->data.fixed_memory32.address = p->start;
        resource->data.fixed_memory32.address_length = p->end - p->start + 1;
 }
 
 int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
-       struct acpi_buffer *buffer)
+                            struct acpi_buffer *buffer)
 {
        int i = 0;
        /* pnpacpi_build_resource_template allocates extra mem */
-       int res_cnt = (buffer->length - 1)/sizeof(struct acpi_resource) - 1;
-       struct acpi_resource *resource = (struct acpi_resource*)buffer->pointer;
+       int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1;
+       struct acpi_resource *resource =
+           (struct acpi_resource *)buffer->pointer;
        int port = 0, irq = 0, dma = 0, mem = 0;
 
        pnp_dbg("res cnt %d", res_cnt);
        while (i < res_cnt) {
-               switch(resource->type) {
+               switch (resource->type) {
                case ACPI_RESOURCE_TYPE_IRQ:
                        pnp_dbg("Encode irq");
                        pnpacpi_encode_irq(resource,
-                               &res_table->irq_resource[irq]);
+                                          &res_table->irq_resource[irq]);
                        irq++;
                        break;
 
                case ACPI_RESOURCE_TYPE_DMA:
                        pnp_dbg("Encode dma");
                        pnpacpi_encode_dma(resource,
-                               &res_table->dma_resource[dma]);
+                                          &res_table->dma_resource[dma]);
                        dma++;
                        break;
                case ACPI_RESOURCE_TYPE_IO:
                        pnp_dbg("Encode io");
                        pnpacpi_encode_io(resource,
-                               &res_table->port_resource[port]);
+                                         &res_table->port_resource[port]);
                        port++;
                        break;
                case ACPI_RESOURCE_TYPE_FIXED_IO:
                        pnp_dbg("Encode fixed io");
                        pnpacpi_encode_fixed_io(resource,
-                               &res_table->port_resource[port]);
+                                               &res_table->
+                                               port_resource[port]);
                        port++;
                        break;
                case ACPI_RESOURCE_TYPE_MEMORY24:
                        pnp_dbg("Encode mem24");
                        pnpacpi_encode_mem24(resource,
-                               &res_table->mem_resource[mem]);
+                                            &res_table->mem_resource[mem]);
                        mem++;
                        break;
                case ACPI_RESOURCE_TYPE_MEMORY32:
                        pnp_dbg("Encode mem32");
                        pnpacpi_encode_mem32(resource,
-                               &res_table->mem_resource[mem]);
+                                            &res_table->mem_resource[mem]);
                        mem++;
                        break;
                case ACPI_RESOURCE_TYPE_FIXED_MEMORY32:
                        pnp_dbg("Encode fixed mem32");
                        pnpacpi_encode_fixed_mem32(resource,
-                               &res_table->mem_resource[mem]);
+                                                  &res_table->
+                                                  mem_resource[mem]);
                        mem++;
                        break;
                case ACPI_RESOURCE_TYPE_EXTENDED_IRQ:
                        pnp_dbg("Encode ext irq");
                        pnpacpi_encode_ext_irq(resource,
-                               &res_table->irq_resource[irq]);
+                                              &res_table->irq_resource[irq]);
                        irq++;
                        break;
                case ACPI_RESOURCE_TYPE_START_DEPENDENT:
@@ -956,7 +953,7 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
                case ACPI_RESOURCE_TYPE_ADDRESS64:
                case ACPI_RESOURCE_TYPE_EXTENDED_ADDRESS64:
                case ACPI_RESOURCE_TYPE_GENERIC_REGISTER:
-               default: /* other type */
+               default:        /* other type */
                        pnp_warn("unknown resource type %d", resource->type);
                        return -EINVAL;
                }
index a1f0b0ba2bfe8600109b0061a93d4ea47b26e6a4..5dba68fe33f59590bb43c8ac23ec4f4cac4522e0 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * bioscalls.c - the lowlevel layer of the PnPBIOS driver
- *
  */
 
 #include <linux/types.h>
 #include "pnpbios.h"
 
 static struct {
-       u16     offset;
-       u16     segment;
+       u16 offset;
+       u16 segment;
 } pnp_bios_callpoint;
 
-
 /*
  * These are some opcodes for a "static asmlinkage"
  * As this code is *not* executed inside the linux kernel segment, but in a
@@ -44,8 +42,7 @@ static struct {
 
 asmlinkage void pnp_bios_callfunc(void);
 
-__asm__(
-       ".text                  \n"
+__asm__(".text                 \n"
        __ALIGN_STR "\n"
        "pnp_bios_callfunc:\n"
        "       pushl %edx      \n"
@@ -55,8 +52,7 @@ __asm__(
        "       lcallw *pnp_bios_callpoint\n"
        "       addl $16, %esp  \n"
        "       lret            \n"
-       ".previous              \n"
-);
+       ".previous              \n");
 
 #define Q2_SET_SEL(cpu, selname, address, size) \
 do { \
@@ -78,7 +74,6 @@ u32 pnp_bios_is_utter_crap = 0;
 
 static spinlock_t pnp_bios_lock;
 
-
 /*
  * Support Functions
  */
@@ -97,7 +92,7 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
         * PnP BIOSes are generally not terribly re-entrant.
         * Also, don't rely on them to save everything correctly.
         */
-       if(pnp_bios_is_utter_crap)
+       if (pnp_bios_is_utter_crap)
                return PNP_FUNCTION_NOT_SUPPORTED;
 
        cpu = get_cpu();
@@ -113,112 +108,128 @@ static inline u16 call_pnp_bios(u16 func, u16 arg1, u16 arg2, u16 arg3,
        if (ts2_size)
                Q2_SET_SEL(smp_processor_id(), PNP_TS2, ts2_base, ts2_size);
 
-       __asm__ __volatile__(
-               "pushl %%ebp\n\t"
-               "pushl %%edi\n\t"
-               "pushl %%esi\n\t"
-               "pushl %%ds\n\t"
-               "pushl %%es\n\t"
-               "pushl %%fs\n\t"
-               "pushl %%gs\n\t"
-               "pushfl\n\t"
-               "movl %%esp, pnp_bios_fault_esp\n\t"
-               "movl $1f, pnp_bios_fault_eip\n\t"
-               "lcall %5,%6\n\t"
-               "1:popfl\n\t"
-               "popl %%gs\n\t"
-               "popl %%fs\n\t"
-               "popl %%es\n\t"
-               "popl %%ds\n\t"
-               "popl %%esi\n\t"
-               "popl %%edi\n\t"
-               "popl %%ebp\n\t"
-               : "=a" (status)
-               : "0" ((func) | (((u32)arg1) << 16)),
-                 "b" ((arg2) | (((u32)arg3) << 16)),
-                 "c" ((arg4) | (((u32)arg5) << 16)),
-                 "d" ((arg6) | (((u32)arg7) << 16)),
-                 "i" (PNP_CS32),
-                 "i" (0)
-               : "memory"
-       );
+       __asm__ __volatile__("pushl %%ebp\n\t"
+                            "pushl %%edi\n\t"
+                            "pushl %%esi\n\t"
+                            "pushl %%ds\n\t"
+                            "pushl %%es\n\t"
+                            "pushl %%fs\n\t"
+                            "pushl %%gs\n\t"
+                            "pushfl\n\t"
+                            "movl %%esp, pnp_bios_fault_esp\n\t"
+                            "movl $1f, pnp_bios_fault_eip\n\t"
+                            "lcall %5,%6\n\t"
+                            "1:popfl\n\t"
+                            "popl %%gs\n\t"
+                            "popl %%fs\n\t"
+                            "popl %%es\n\t"
+                            "popl %%ds\n\t"
+                            "popl %%esi\n\t"
+                            "popl %%edi\n\t"
+                            "popl %%ebp\n\t":"=a"(status)
+                            :"0"((func) | (((u32) arg1) << 16)),
+                            "b"((arg2) | (((u32) arg3) << 16)),
+                            "c"((arg4) | (((u32) arg5) << 16)),
+                            "d"((arg6) | (((u32) arg7) << 16)),
+                            "i"(PNP_CS32), "i"(0)
+                            :"memory");
        spin_unlock_irqrestore(&pnp_bios_lock, flags);
 
        get_cpu_gdt_table(cpu)[0x40 / 8] = save_desc_40;
        put_cpu();
 
        /* If we get here and this is set then the PnP BIOS faulted on us. */
-       if(pnp_bios_is_utter_crap)
-       {
-               printk(KERN_ERR "PnPBIOS: Warning! Your PnP BIOS caused a fatal error. Attempting to continue\n");
-               printk(KERN_ERR "PnPBIOS: You may need to reboot with the \"pnpbios=off\" option to operate stably\n");
-               printk(KERN_ERR "PnPBIOS: Check with your vendor for an updated BIOS\n");
+       if (pnp_bios_is_utter_crap) {
+               printk(KERN_ERR
+                      "PnPBIOS: Warning! Your PnP BIOS caused a fatal error. Attempting to continue\n");
+               printk(KERN_ERR
+                      "PnPBIOS: You may need to reboot with the \"pnpbios=off\" option to operate stably\n");
+               printk(KERN_ERR
+                      "PnPBIOS: Check with your vendor for an updated BIOS\n");
        }
 
        return status;
 }
 
-void pnpbios_print_status(const char * module, u16 status)
+void pnpbios_print_status(const char *module, u16 status)
 {
-       switch(status) {
+       switch (status) {
        case PNP_SUCCESS:
                printk(KERN_ERR "PnPBIOS: %s: function successful\n", module);
                break;
        case PNP_NOT_SET_STATICALLY:
-               printk(KERN_ERR "PnPBIOS: %s: unable to set static resources\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: unable to set static resources\n",
+                      module);
                break;
        case PNP_UNKNOWN_FUNCTION:
-               printk(KERN_ERR "PnPBIOS: %s: invalid function number passed\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: invalid function number passed\n",
+                      module);
                break;
        case PNP_FUNCTION_NOT_SUPPORTED:
-               printk(KERN_ERR "PnPBIOS: %s: function not supported on this system\n", module);
+               printk(KERN_ERR
+                      "PnPBIOS: %s: function not supported on this system\n",
+                      module);
                break;
        case PNP_INVALID_HANDLE:
                printk(KERN_ERR "PnPBIOS: %s: invalid handle\n", module);
                break;
        case PNP_BAD_PARAMETER:
-               printk(KERN_ERR "PnPBIOS: %s: invalid parameters were passed\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: invalid parameters were passed\n",
+                      module);
                break;
        case PNP_SET_FAILED:
-               printk(KERN_ERR "PnPBIOS: %s: unable to set resources\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: unable to set resources\n",
+                      module);
                break;
        case PNP_EVENTS_NOT_PENDING:
                printk(KERN_ERR "PnPBIOS: %s: no events are pending\n", module);
                break;
        case PNP_SYSTEM_NOT_DOCKED:
-               printk(KERN_ERR "PnPBIOS: %s: the system is not docked\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: the system is not docked\n",
+                      module);
                break;
        case PNP_NO_ISA_PNP_CARDS:
-               printk(KERN_ERR "PnPBIOS: %s: no isapnp cards are installed on this system\n", module);
+               printk(KERN_ERR
+                      "PnPBIOS: %s: no isapnp cards are installed on this system\n",
+                      module);
                break;
        case PNP_UNABLE_TO_DETERMINE_DOCK_CAPABILITIES:
-               printk(KERN_ERR "PnPBIOS: %s: cannot determine the capabilities of the docking station\n", module);
+               printk(KERN_ERR
+                      "PnPBIOS: %s: cannot determine the capabilities of the docking station\n",
+                      module);
                break;
        case PNP_CONFIG_CHANGE_FAILED_NO_BATTERY:
-               printk(KERN_ERR "PnPBIOS: %s: unable to undock, the system does not have a battery\n", module);
+               printk(KERN_ERR
+                      "PnPBIOS: %s: unable to undock, the system does not have a battery\n",
+                      module);
                break;
        case PNP_CONFIG_CHANGE_FAILED_RESOURCE_CONFLICT:
-               printk(KERN_ERR "PnPBIOS: %s: could not dock due to resource conflicts\n", module);
+               printk(KERN_ERR
+                      "PnPBIOS: %s: could not dock due to resource conflicts\n",
+                      module);
                break;
        case PNP_BUFFER_TOO_SMALL:
-               printk(KERN_ERR "PnPBIOS: %s: the buffer passed is too small\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: the buffer passed is too small\n",
+                      module);
                break;
        case PNP_USE_ESCD_SUPPORT:
                printk(KERN_ERR "PnPBIOS: %s: use ESCD instead\n", module);
                break;
        case PNP_MESSAGE_NOT_SUPPORTED:
-               printk(KERN_ERR "PnPBIOS: %s: the message is unsupported\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: the message is unsupported\n",
+                      module);
                break;
        case PNP_HARDWARE_ERROR:
-               printk(KERN_ERR "PnPBIOS: %s: a hardware failure has occured\n", module);
+               printk(KERN_ERR "PnPBIOS: %s: a hardware failure has occured\n",
+                      module);
                break;
        default:
-               printk(KERN_ERR "PnPBIOS: %s: unexpected status 0x%x\n", module, status);
+               printk(KERN_ERR "PnPBIOS: %s: unexpected status 0x%x\n", module,
+                      status);
                break;
        }
 }
 
-
 /*
  * PnP BIOS Low Level Calls
  */
@@ -243,19 +254,22 @@ void pnpbios_print_status(const char * module, u16 status)
 static int __pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
 {
        u16 status;
+
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2, PNP_TS1, PNP_DS, 0, 0,
-                              data, sizeof(struct pnp_dev_node_info), NULL, 0);
+       status = call_pnp_bios(PNP_GET_NUM_SYS_DEV_NODES, 0, PNP_TS1, 2,
+                              PNP_TS1, PNP_DS, 0, 0, data,
+                              sizeof(struct pnp_dev_node_info), NULL, 0);
        data->no_nodes &= 0xff;
        return status;
 }
 
 int pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
 {
-       int status = __pnp_bios_dev_node_info( data );
-       if ( status )
-               pnpbios_print_status( "dev_node_info", status );
+       int status = __pnp_bios_dev_node_info(data);
+
+       if (status)
+               pnpbios_print_status("dev_node_info", status);
        return status;
 }
 
@@ -273,17 +287,20 @@ int pnp_bios_dev_node_info(struct pnp_dev_node_info *data)
  *               or volatile current (0) config
  * Output: *nodenum=next node or 0xff if no more nodes
  */
-static int __pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data)
+static int __pnp_bios_get_dev_node(u8 *nodenum, char boot,
+                                  struct pnp_bios_node *data)
 {
        u16 status;
        u16 tmp_nodenum;
+
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
-       if ( !boot && pnpbios_dont_use_current_config )
+       if (!boot && pnpbios_dont_use_current_config)
                return PNP_FUNCTION_NOT_SUPPORTED;
        tmp_nodenum = *nodenum;
-       status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2, boot ? 2 : 1, PNP_DS, 0,
-                              &tmp_nodenum, sizeof(tmp_nodenum), data, 65536);
+       status = call_pnp_bios(PNP_GET_SYS_DEV_NODE, 0, PNP_TS1, 0, PNP_TS2,
+                              boot ? 2 : 1, PNP_DS, 0, &tmp_nodenum,
+                              sizeof(tmp_nodenum), data, 65536);
        *nodenum = tmp_nodenum;
        return status;
 }
@@ -291,104 +308,66 @@ static int __pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node
 int pnp_bios_get_dev_node(u8 *nodenum, char boot, struct pnp_bios_node *data)
 {
        int status;
-       status =  __pnp_bios_get_dev_node( nodenum, boot, data );
-       if ( status )
-               pnpbios_print_status( "get_dev_node", status );
+
+       status = __pnp_bios_get_dev_node(nodenum, boot, data);
+       if (status)
+               pnpbios_print_status("get_dev_node", status);
        return status;
 }
 
-
 /*
  * Call PnP BIOS with function 0x02, "set system device node"
  * Input: *nodenum = desired node, 
  *        boot = whether to set nonvolatile boot (!=0)
  *               or volatile current (0) config
  */
-static int __pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data)
+static int __pnp_bios_set_dev_node(u8 nodenum, char boot,
+                                  struct pnp_bios_node *data)
 {
        u16 status;
+
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
-       if ( !boot && pnpbios_dont_use_current_config )
+       if (!boot && pnpbios_dont_use_current_config)
                return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1, boot ? 2 : 1, PNP_DS, 0, 0,
-                              data, 65536, NULL, 0);
+       status = call_pnp_bios(PNP_SET_SYS_DEV_NODE, nodenum, 0, PNP_TS1,
+                              boot ? 2 : 1, PNP_DS, 0, 0, data, 65536, NULL,
+                              0);
        return status;
 }
 
 int pnp_bios_set_dev_node(u8 nodenum, char boot, struct pnp_bios_node *data)
 {
        int status;
-       status =  __pnp_bios_set_dev_node( nodenum, boot, data );
-       if ( status ) {
-               pnpbios_print_status( "set_dev_node", status );
+
+       status = __pnp_bios_set_dev_node(nodenum, boot, data);
+       if (status) {
+               pnpbios_print_status("set_dev_node", status);
                return status;
        }
-       if ( !boot ) { /* Update devlist */
-               status =  pnp_bios_get_dev_node( &nodenum, boot, data );
-               if ( status )
+       if (!boot) {            /* Update devlist */
+               status = pnp_bios_get_dev_node(&nodenum, boot, data);
+               if (status)
                        return status;
        }
        return status;
 }
 
-#if needed
-/*
- * Call PnP BIOS with function 0x03, "get event"
- */
-static int pnp_bios_get_event(u16 *event)
-{
-       u16 status;
-       if (!pnp_bios_present())
-               return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_GET_EVENT, 0, PNP_TS1, PNP_DS, 0, 0 ,0 ,0,
-                              event, sizeof(u16), NULL, 0);
-       return status;
-}
-#endif
-
-#if needed
-/*
- * Call PnP BIOS with function 0x04, "send message"
- */
-static int pnp_bios_send_message(u16 message)
-{
-       u16 status;
-       if (!pnp_bios_present())
-               return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_SEND_MESSAGE, message, PNP_DS, 0, 0, 0, 0, 0, 0, 0, 0, 0);
-       return status;
-}
-#endif
-
 /*
  * Call PnP BIOS with function 0x05, "get docking station information"
  */
 int pnp_bios_dock_station_info(struct pnp_docking_station_info *data)
 {
        u16 status;
-       if (!pnp_bios_present())
-               return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0,
-                              data, sizeof(struct pnp_docking_station_info), NULL, 0);
-       return status;
-}
 
-#if needed
-/*
- * Call PnP BIOS with function 0x09, "set statically allocated resource
- * information"
- */
-static int pnp_bios_set_stat_res(char *info)
-{
-       u16 status;
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_SET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0,
-                              info, *((u16 *) info), 0, 0);
+       status = call_pnp_bios(PNP_GET_DOCKING_STATION_INFORMATION, 0, PNP_TS1,
+                              PNP_DS, 0, 0, 0, 0, data,
+                              sizeof(struct pnp_docking_station_info), NULL,
+                              0);
        return status;
 }
-#endif
 
 /*
  * Call PnP BIOS with function 0x0a, "get statically allocated resource
@@ -397,36 +376,23 @@ static int pnp_bios_set_stat_res(char *info)
 static int __pnp_bios_get_stat_res(char *info)
 {
        u16 status;
+
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0,
-                              info, 65536, NULL, 0);
+       status = call_pnp_bios(PNP_GET_STATIC_ALLOCED_RES_INFO, 0, PNP_TS1,
+                              PNP_DS, 0, 0, 0, 0, info, 65536, NULL, 0);
        return status;
 }
 
 int pnp_bios_get_stat_res(char *info)
 {
        int status;
-       status = __pnp_bios_get_stat_res( info );
-       if ( status )
-               pnpbios_print_status( "get_stat_res", status );
-       return status;
-}
 
-#if needed
-/*
- * Call PnP BIOS with function 0x0b, "get APM id table"
- */
-static int pnp_bios_apm_id_table(char *table, u16 *size)
-{
-       u16 status;
-       if (!pnp_bios_present())
-               return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_GET_APM_ID_TABLE, 0, PNP_TS2, 0, PNP_TS1, PNP_DS, 0, 0,
-                              table, *size, size, sizeof(u16));
+       status = __pnp_bios_get_stat_res(info);
+       if (status)
+               pnpbios_print_status("get_stat_res", status);
        return status;
 }
-#endif
 
 /*
  * Call PnP BIOS with function 0x40, "get isa pnp configuration structure"
@@ -434,19 +400,22 @@ static int pnp_bios_apm_id_table(char *table, u16 *size)
 static int __pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
 {
        u16 status;
+
        if (!pnp_bios_present())
                return PNP_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS, 0, 0, 0, 0,
-                              data, sizeof(struct pnp_isa_config_struc), NULL, 0);
+       status = call_pnp_bios(PNP_GET_PNP_ISA_CONFIG_STRUC, 0, PNP_TS1, PNP_DS,
+                              0, 0, 0, 0, data,
+                              sizeof(struct pnp_isa_config_struc), NULL, 0);
        return status;
 }
 
 int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
 {
        int status;
-       status = __pnp_bios_isapnp_config( data );
-       if ( status )
-               pnpbios_print_status( "isapnp_config", status );
+
+       status = __pnp_bios_isapnp_config(data);
+       if (status)
+               pnpbios_print_status("isapnp_config", status);
        return status;
 }
 
@@ -456,19 +425,22 @@ int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data)
 static int __pnp_bios_escd_info(struct escd_info_struc *data)
 {
        u16 status;
+
        if (!pnp_bios_present())
                return ESCD_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4, PNP_TS1, PNP_DS,
-                              data, sizeof(struct escd_info_struc), NULL, 0);
+       status = call_pnp_bios(PNP_GET_ESCD_INFO, 0, PNP_TS1, 2, PNP_TS1, 4,
+                              PNP_TS1, PNP_DS, data,
+                              sizeof(struct escd_info_struc), NULL, 0);
        return status;
 }
 
 int pnp_bios_escd_info(struct escd_info_struc *data)
 {
        int status;
-       status = __pnp_bios_escd_info( data );
-       if ( status )
-               pnpbios_print_status( "escd_info", status );
+
+       status = __pnp_bios_escd_info(data);
+       if (status)
+               pnpbios_print_status("escd_info", status);
        return status;
 }
 
@@ -479,57 +451,42 @@ int pnp_bios_escd_info(struct escd_info_struc *data)
 static int __pnp_bios_read_escd(char *data, u32 nvram_base)
 {
        u16 status;
+
        if (!pnp_bios_present())
                return ESCD_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0,
-                              data, 65536, __va(nvram_base), 65536);
+       status = call_pnp_bios(PNP_READ_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0,
+                              0, data, 65536, __va(nvram_base), 65536);
        return status;
 }
 
 int pnp_bios_read_escd(char *data, u32 nvram_base)
 {
        int status;
-       status = __pnp_bios_read_escd( data, nvram_base );
-       if ( status )
-               pnpbios_print_status( "read_escd", status );
-       return status;
-}
 
-#if needed
-/*
- * Call PnP BIOS function 0x43, "write ESCD"
- */
-static int pnp_bios_write_escd(char *data, u32 nvram_base)
-{
-       u16 status;
-       if (!pnp_bios_present())
-               return ESCD_FUNCTION_NOT_SUPPORTED;
-       status = call_pnp_bios(PNP_WRITE_ESCD, 0, PNP_TS1, PNP_TS2, PNP_DS, 0, 0, 0,
-                              data, 65536, __va(nvram_base), 65536);
+       status = __pnp_bios_read_escd(data, nvram_base);
+       if (status)
+               pnpbios_print_status("read_escd", status);
        return status;
 }
-#endif
-
-
-/*
- * Initialization
- */
 
 void pnpbios_calls_init(union pnp_bios_install_struct *header)
 {
        int i;
+
        spin_lock_init(&pnp_bios_lock);
        pnp_bios_callpoint.offset = header->fields.pm16offset;
        pnp_bios_callpoint.segment = PNP_CS16;
 
        set_base(bad_bios_desc, __va((unsigned long)0x40 << 4));
        _set_limit((char *)&bad_bios_desc, 4095 - (0x40 << 4));
-       for (i = 0; i < NR_CPUS; i++) {
-               struct desc_struct *gdt = get_cpu_gdt_table(i);
-               if (!gdt)
-                       continue;
-               set_base(gdt[GDT_ENTRY_PNPBIOS_CS32], &pnp_bios_callfunc);
-               set_base(gdt[GDT_ENTRY_PNPBIOS_CS16], __va(header->fields.pm16cseg));
-               set_base(gdt[GDT_ENTRY_PNPBIOS_DS], __va(header->fields.pm16dseg));
-       }
+       for (i = 0; i < NR_CPUS; i++) {
+               struct desc_struct *gdt = get_cpu_gdt_table(i);
+               if (!gdt)
+                       continue;
+               set_base(gdt[GDT_ENTRY_PNPBIOS_CS32], &pnp_bios_callfunc);
+               set_base(gdt[GDT_ENTRY_PNPBIOS_CS16],
+                        __va(header->fields.pm16cseg));
+               set_base(gdt[GDT_ENTRY_PNPBIOS_DS],
+                        __va(header->fields.pm16dseg));
+       }
 }
index ed112ee160127f7ef81a6d2a31a1120761b3ae30..3692a099b45f63f96d834055751bc94f9594f27c 100644 (file)
@@ -32,7 +32,7 @@
  * along with this program; if not, write to the Free Software
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
+
 /* Change Log
  *
  * Adam Belay - <ambx1@neo.rr.com> - March 16, 2003
 
 #include "pnpbios.h"
 
-
 /*
  *
  * PnP BIOS INTERFACE
  *
  */
 
-static union pnp_bios_install_struct * pnp_bios_install = NULL;
+static union pnp_bios_install_struct *pnp_bios_install = NULL;
 
 int pnp_bios_present(void)
 {
@@ -101,36 +100,35 @@ static struct completion unload_sem;
 /*
  * (Much of this belongs in a shared routine somewhere)
  */
 static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
 {
-       char *argv [3], **envp, *buf, *scratch;
+       char *argv[3], **envp, *buf, *scratch;
        int i = 0, value;
 
-       if (!current->fs->root) {
+       if (!current->fs->root)
                return -EAGAIN;
-       }
-       if (!(envp = kcalloc(20, sizeof (char *), GFP_KERNEL))) {
+       if (!(envp = kcalloc(20, sizeof(char *), GFP_KERNEL)))
                return -ENOMEM;
-       }
        if (!(buf = kzalloc(256, GFP_KERNEL))) {
-               kfree (envp);
+               kfree(envp);
                return -ENOMEM;
        }
 
-       /* FIXME: if there are actual users of this, it should be integrated into
-        * the driver core and use the usual infrastructure like sysfs and uevents */
-       argv [0] = "/sbin/pnpbios";
-       argv [1] = "dock";
-       argv [2] = NULL;
+       /* FIXME: if there are actual users of this, it should be
+        * integrated into the driver core and use the usual infrastructure
+        * like sysfs and uevents
+        */
+       argv[0] = "/sbin/pnpbios";
+       argv[1] = "dock";
+       argv[2] = NULL;
 
        /* minimal command environment */
-       envp [i++] = "HOME=/";
-       envp [i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
+       envp[i++] = "HOME=/";
+       envp[i++] = "PATH=/sbin:/bin:/usr/sbin:/usr/bin";
 
 #ifdef DEBUG
        /* hint that policy agent should enter no-stdout debug mode */
-       envp [i++] = "DEBUG=kernel";
+       envp[i++] = "DEBUG=kernel";
 #endif
        /* extensible set of named bus-specific parameters,
         * supporting multiple driver selection algorithms.
@@ -138,33 +136,33 @@ static int pnp_dock_event(int dock, struct pnp_docking_station_info *info)
        scratch = buf;
 
        /* action:  add, remove */
-       envp [i++] = scratch;
-       scratch += sprintf (scratch, "ACTION=%s", dock?"add":"remove") + 1;
+       envp[i++] = scratch;
+       scratch += sprintf(scratch, "ACTION=%s", dock ? "add" : "remove") + 1;
 
        /* Report the ident for the dock */
-       envp [i++] = scratch;
-       scratch += sprintf (scratch, "DOCK=%x/%x/%x",
-               info->location_id, info->serial, info->capabilities);
+       envp[i++] = scratch;
+       scratch += sprintf(scratch, "DOCK=%x/%x/%x",
+                          info->location_id, info->serial, info->capabilities);
        envp[i] = NULL;
-       
-       value = call_usermodehelper (argv [0], argv, envp, UMH_WAIT_EXEC);
-       kfree (buf);
-       kfree (envp);
+
+       value = call_usermodehelper(argv [0], argv, envp, UMH_WAIT_EXEC);
+       kfree(buf);
+       kfree(envp);
        return 0;
 }
 
 /*
  * Poll the PnP docking at regular intervals
  */
-static int pnp_dock_thread(void * unused)
+static int pnp_dock_thread(void *unused)
 {
        static struct pnp_docking_station_info now;
        int docked = -1, d = 0;
+
        set_freezable();
-       while (!unloading)
-       {
+       while (!unloading) {
                int status;
-               
+
                /*
                 * Poll every 2 seconds
                 */
@@ -175,30 +173,29 @@ static int pnp_dock_thread(void * unused)
 
                status = pnp_bios_dock_station_info(&now);
 
-               switch(status)
-               {
+               switch (status) {
                        /*
                         * No dock to manage
                         */
-                       case PNP_FUNCTION_NOT_SUPPORTED:
-                               complete_and_exit(&unload_sem, 0);
-                       case PNP_SYSTEM_NOT_DOCKED:
-                               d = 0;
-                               break;
-                       case PNP_SUCCESS:
-                               d = 1;
-                               break;
-                       default:
-                               pnpbios_print_status( "pnp_dock_thread", status );
-                               continue;
+               case PNP_FUNCTION_NOT_SUPPORTED:
+                       complete_and_exit(&unload_sem, 0);
+               case PNP_SYSTEM_NOT_DOCKED:
+                       d = 0;
+                       break;
+               case PNP_SUCCESS:
+                       d = 1;
+                       break;
+               default:
+                       pnpbios_print_status("pnp_dock_thread", status);
+                       continue;
                }
-               if(d != docked)
-               {
-                       if(pnp_dock_event(d, &now)==0)
-                       {
+               if (d != docked) {
+                       if (pnp_dock_event(d, &now) == 0) {
                                docked = d;
 #if 0
-                               printk(KERN_INFO "PnPBIOS: Docking station %stached\n", docked?"at":"de");
+                               printk(KERN_INFO
+                                      "PnPBIOS: Docking station %stached\n",
+                                      docked ? "at" : "de");
 #endif
                        }
                }
@@ -206,21 +203,21 @@ static int pnp_dock_thread(void * unused)
        complete_and_exit(&unload_sem, 0);
 }
 
-#endif   /* CONFIG_HOTPLUG */
+#endif                         /* CONFIG_HOTPLUG */
 
-static int pnpbios_get_resources(struct pnp_dev * dev, struct pnp_resource_table * res)
+static int pnpbios_get_resources(struct pnp_dev *dev,
+                                struct pnp_resource_table *res)
 {
        u8 nodenum = dev->number;
-       struct pnp_bios_node * node;
+       struct pnp_bios_node *node;
 
-       /* just in case */
-       if(!pnpbios_is_dynamic(dev))
+       if (!pnpbios_is_dynamic(dev))
                return -EPERM;
 
        node = kzalloc(node_info.max_node_size, GFP_KERNEL);
        if (!node)
                return -1;
-       if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
+       if (pnp_bios_get_dev_node(&nodenum, (char)PNPMODE_DYNAMIC, node)) {
                kfree(node);
                return -ENODEV;
        }
@@ -230,24 +227,24 @@ static int pnpbios_get_resources(struct pnp_dev * dev, struct pnp_resource_table
        return 0;
 }
 
-static int pnpbios_set_resources(struct pnp_dev * dev, struct pnp_resource_table * res)
+static int pnpbios_set_resources(struct pnp_dev *dev,
+                                struct pnp_resource_table *res)
 {
        u8 nodenum = dev->number;
-       struct pnp_bios_node * node;
+       struct pnp_bios_node *node;
        int ret;
 
-       /* just in case */
        if (!pnpbios_is_dynamic(dev))
                return -EPERM;
 
        node = kzalloc(node_info.max_node_size, GFP_KERNEL);
        if (!node)
                return -1;
-       if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
+       if (pnp_bios_get_dev_node(&nodenum, (char)PNPMODE_DYNAMIC, node)) {
                kfree(node);
                return -ENODEV;
        }
-       if(pnpbios_write_resources_to_node(res, node)<0) {
+       if (pnpbios_write_resources_to_node(res, node) < 0) {
                kfree(node);
                return -1;
        }
@@ -258,18 +255,19 @@ static int pnpbios_set_resources(struct pnp_dev * dev, struct pnp_resource_table
        return ret;
 }
 
-static void pnpbios_zero_data_stream(struct pnp_bios_node * node)
+static void pnpbios_zero_data_stream(struct pnp_bios_node *node)
 {
-       unsigned char * p = (char *)node->data;
-       unsigned char * end = (char *)(node->data + node->size);
+       unsigned char *p = (char *)node->data;
+       unsigned char *end = (char *)(node->data + node->size);
        unsigned int len;
        int i;
+
        while ((char *)p < (char *)end) {
-               if(p[0] & 0x80) { /* large tag */
+               if (p[0] & 0x80) {      /* large tag */
                        len = (p[2] << 8) | p[1];
                        p += 3;
                } else {
-                       if (((p[0]>>3) & 0x0f) == 0x0f)
+                       if (((p[0] >> 3) & 0x0f) == 0x0f)
                                return;
                        len = p[0] & 0x07;
                        p += 1;
@@ -278,24 +276,24 @@ static void pnpbios_zero_data_stream(struct pnp_bios_node * node)
                        p[i] = 0;
                p += len;
        }
-       printk(KERN_ERR "PnPBIOS: Resource structure did not contain an end tag.\n");
+       printk(KERN_ERR
+              "PnPBIOS: Resource structure did not contain an end tag.\n");
 }
 
 static int pnpbios_disable_resources(struct pnp_dev *dev)
 {
-       struct pnp_bios_node * node;
+       struct pnp_bios_node *node;
        u8 nodenum = dev->number;
        int ret;
 
-       /* just in case */
-       if(dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
+       if (dev->flags & PNPBIOS_NO_DISABLE || !pnpbios_is_dynamic(dev))
                return -EPERM;
 
        node = kzalloc(node_info.max_node_size, GFP_KERNEL);
        if (!node)
                return -ENOMEM;
 
-       if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node)) {
+       if (pnp_bios_get_dev_node(&nodenum, (char)PNPMODE_DYNAMIC, node)) {
                kfree(node);
                return -ENODEV;
        }
@@ -311,22 +309,22 @@ static int pnpbios_disable_resources(struct pnp_dev *dev)
 /* PnP Layer support */
 
 struct pnp_protocol pnpbios_protocol = {
-       .name   = "Plug and Play BIOS",
-       .get    = pnpbios_get_resources,
-       .set    = pnpbios_set_resources,
+       .name = "Plug and Play BIOS",
+       .get = pnpbios_get_resources,
+       .set = pnpbios_set_resources,
        .disable = pnpbios_disable_resources,
 };
 
-static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node)
+static int insert_device(struct pnp_dev *dev, struct pnp_bios_node *node)
 {
-       struct list_head * pos;
-       struct pnp_dev * pnp_dev;
+       struct list_head *pos;
+       struct pnp_dev *pnp_dev;
        struct pnp_id *dev_id;
        char id[8];
 
        /* check if the device is already added */
        dev->number = node->handle;
-       list_for_each (pos, &pnpbios_protocol.devices){
+       list_for_each(pos, &pnpbios_protocol.devices) {
                pnp_dev = list_entry(pos, struct pnp_dev, protocol_list);
                if (dev->number == pnp_dev->number)
                        return -1;
@@ -336,8 +334,8 @@ static int insert_device(struct pnp_dev *dev, struct pnp_bios_node * node)
        dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
        if (!dev_id)
                return -1;
-       pnpid32_to_pnpid(node->eisa_id,id);
-       memcpy(dev_id->id,id,7);
+       pnpid32_to_pnpid(node->eisa_id, id);
+       memcpy(dev_id->id, id, 7);
        pnp_add_id(dev_id, dev);
        pnpbios_parse_data_stream(dev, node);
        dev->active = pnp_is_active(dev);
@@ -375,35 +373,41 @@ static void __init build_devlist(void)
        if (!node)
                return;
 
-       for(nodenum=0; nodenum<0xff; ) {
+       for (nodenum = 0; nodenum < 0xff;) {
                u8 thisnodenum = nodenum;
                /* eventually we will want to use PNPMODE_STATIC here but for now
                 * dynamic will help us catch buggy bioses to add to the blacklist.
                 */
                if (!pnpbios_dont_use_current_config) {
-                       if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_DYNAMIC, node))
+                       if (pnp_bios_get_dev_node
+                           (&nodenum, (char)PNPMODE_DYNAMIC, node))
                                break;
                } else {
-                       if (pnp_bios_get_dev_node(&nodenum, (char )PNPMODE_STATIC, node))
+                       if (pnp_bios_get_dev_node
+                           (&nodenum, (char)PNPMODE_STATIC, node))
                                break;
                }
                nodes_got++;
-               dev =  kzalloc(sizeof (struct pnp_dev), GFP_KERNEL);
+               dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL);
                if (!dev)
                        break;
-               if(insert_device(dev,node)<0)
+               if (insert_device(dev, node) < 0)
                        kfree(dev);
                else
                        devs++;
                if (nodenum <= thisnodenum) {
-                       printk(KERN_ERR "PnPBIOS: build_devlist: Node number 0x%x is out of sequence following node 0x%x. Aborting.\n", (unsigned int)nodenum, (unsigned int)thisnodenum);
+                       printk(KERN_ERR
+                              "PnPBIOS: build_devlist: Node number 0x%x is out of sequence following node 0x%x. Aborting.\n",
+                              (unsigned int)nodenum,
+                              (unsigned int)thisnodenum);
                        break;
                }
        }
        kfree(node);
 
-       printk(KERN_INFO "PnPBIOS: %i node%s reported by PnP BIOS; %i recorded by driver\n",
-               nodes_got, nodes_got != 1 ? "s" : "", devs);
+       printk(KERN_INFO
+              "PnPBIOS: %i node%s reported by PnP BIOS; %i recorded by driver\n",
+              nodes_got, nodes_got != 1 ? "s" : "", devs);
 }
 
 /*
@@ -412,8 +416,8 @@ static void __init build_devlist(void)
  *
  */
 
-static int pnpbios_disabled; /* = 0 */
-int pnpbios_dont_use_current_config; /* = 0 */
+static int pnpbios_disabled;
+int pnpbios_dont_use_current_config;
 
 #ifndef MODULE
 static int __init pnpbios_setup(char *str)
@@ -422,9 +426,9 @@ static int __init pnpbios_setup(char *str)
 
        while ((str != NULL) && (*str != '\0')) {
                if (strncmp(str, "off", 3) == 0)
-                       pnpbios_disabled=1;
+                       pnpbios_disabled = 1;
                if (strncmp(str, "on", 2) == 0)
-                       pnpbios_disabled=0;
+                       pnpbios_disabled = 0;
                invert = (strncmp(str, "no-", 3) == 0);
                if (invert)
                        str += 3;
@@ -453,35 +457,41 @@ static int __init pnpbios_probe_system(void)
        printk(KERN_INFO "PnPBIOS: Scanning system for PnP BIOS support...\n");
 
        /*
-        * Search the defined area (0xf0000-0xffff0) for a valid PnP BIOS
+        * Search the defined area (0xf0000-0xffff0) for a valid PnP BIOS
         * structure and, if one is found, sets up the selectors and
         * entry points
         */
-       for (check = (union pnp_bios_install_struct *) __va(0xf0000);
-            check < (union pnp_bios_install_struct *) __va(0xffff0);
+       for (check = (union pnp_bios_install_struct *)__va(0xf0000);
+            check < (union pnp_bios_install_struct *)__va(0xffff0);
             check = (void *)check + 16) {
                if (check->fields.signature != PNP_SIGNATURE)
                        continue;
-               printk(KERN_INFO "PnPBIOS: Found PnP BIOS installation structure at 0x%p\n", check);
+               printk(KERN_INFO
+                      "PnPBIOS: Found PnP BIOS installation structure at 0x%p\n",
+                      check);
                length = check->fields.length;
                if (!length) {
-                       printk(KERN_ERR "PnPBIOS: installation structure is invalid, skipping\n");
+                       printk(KERN_ERR
+                              "PnPBIOS: installation structure is invalid, skipping\n");
                        continue;
                }
                for (sum = 0, i = 0; i < length; i++)
                        sum += check->chars[i];
                if (sum) {
-                       printk(KERN_ERR "PnPBIOS: installation structure is corrupted, skipping\n");
+                       printk(KERN_ERR
+                              "PnPBIOS: installation structure is corrupted, skipping\n");
                        continue;
                }
                if (check->fields.version < 0x10) {
-                       printk(KERN_WARNING "PnPBIOS: PnP BIOS version %d.%d is not supported\n",
+                       printk(KERN_WARNING
+                              "PnPBIOS: PnP BIOS version %d.%d is not supported\n",
                               check->fields.version >> 4,
                               check->fields.version & 15);
                        continue;
                }
-               printk(KERN_INFO "PnPBIOS: PnP BIOS version %d.%d, entry 0x%x:0x%x, dseg 0x%x\n",
-                       check->fields.version >> 4, check->fields.version & 15,
+               printk(KERN_INFO
+                      "PnPBIOS: PnP BIOS version %d.%d, entry 0x%x:0x%x, dseg 0x%x\n",
+                      check->fields.version >> 4, check->fields.version & 15,
                       check->fields.pm16cseg, check->fields.pm16offset,
                       check->fields.pm16dseg);
                pnp_bios_install = check;
@@ -499,25 +509,25 @@ static int __init exploding_pnp_bios(struct dmi_system_id *d)
 }
 
 static struct dmi_system_id pnpbios_dmi_table[] __initdata = {
-       {       /* PnPBIOS GPF on boot */
-               .callback = exploding_pnp_bios,
-               .ident = "Higraded P14H",
-               .matches = {
-                       DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
-                       DMI_MATCH(DMI_BIOS_VERSION, "07.00T"),
-                       DMI_MATCH(DMI_SYS_VENDOR, "Higraded"),
-                       DMI_MATCH(DMI_PRODUCT_NAME, "P14H"),
-               },
-       },
-       {       /* PnPBIOS GPF on boot */
-               .callback = exploding_pnp_bios,
-               .ident = "ASUS P4P800",
-               .matches = {
-                       DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
-                       DMI_MATCH(DMI_BOARD_NAME, "P4P800"),
-               },
-       },
-       { }
+       {                       /* PnPBIOS GPF on boot */
+        .callback = exploding_pnp_bios,
+        .ident = "Higraded P14H",
+        .matches = {
+                    DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
+                    DMI_MATCH(DMI_BIOS_VERSION, "07.00T"),
+                    DMI_MATCH(DMI_SYS_VENDOR, "Higraded"),
+                    DMI_MATCH(DMI_PRODUCT_NAME, "P14H"),
+                    },
+        },
+       {                       /* PnPBIOS GPF on boot */
+        .callback = exploding_pnp_bios,
+        .ident = "ASUS P4P800",
+        .matches = {
+                    DMI_MATCH(DMI_BOARD_VENDOR, "ASUSTeK Computer Inc."),
+                    DMI_MATCH(DMI_BOARD_NAME, "P4P800"),
+                    },
+        },
+       {}
 };
 
 static int __init pnpbios_init(void)
@@ -533,14 +543,13 @@ static int __init pnpbios_init(void)
                printk(KERN_INFO "PnPBIOS: Disabled\n");
                return -ENODEV;
        }
-
 #ifdef CONFIG_PNPACPI
        if (!acpi_disabled && !pnpacpi_disabled) {
                pnpbios_disabled = 1;
                printk(KERN_INFO "PnPBIOS: Disabled by ACPI PNP\n");
                return -ENODEV;
        }
-#endif /* CONFIG_ACPI */
+#endif                         /* CONFIG_ACPI */
 
        /* scan the system for pnpbios support */
        if (!pnpbios_probe_system())
@@ -552,14 +561,16 @@ static int __init pnpbios_init(void)
        /* read the node info */
        ret = pnp_bios_dev_node_info(&node_info);
        if (ret) {
-               printk(KERN_ERR "PnPBIOS: Unable to get node info.  Aborting.\n");
+               printk(KERN_ERR
+                      "PnPBIOS: Unable to get node info.  Aborting.\n");
                return ret;
        }
 
        /* register with the pnp layer */
        ret = pnp_register_protocol(&pnpbios_protocol);
        if (ret) {
-               printk(KERN_ERR "PnPBIOS: Unable to register driver.  Aborting.\n");
+               printk(KERN_ERR
+                      "PnPBIOS: Unable to register driver.  Aborting.\n");
                return ret;
        }
 
index 8027073f7919b78f7071edb7db11fabece4d314e..9c8c07701b65f053116c369103de0ddedb32836c 100644 (file)
@@ -18,9 +18,6 @@
  * The other files are human-readable.
  */
 
-//#include <pcmcia/config.h>
-//#include <pcmcia/k_compat.h>
-
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/slab.h>
@@ -37,42 +34,37 @@ static struct proc_dir_entry *proc_pnp = NULL;
 static struct proc_dir_entry *proc_pnp_boot = NULL;
 
 static int proc_read_pnpconfig(char *buf, char **start, off_t pos,
-                               int count, int *eof, void *data)
+                              int count, int *eof, void *data)
 {
        struct pnp_isa_config_struc pnps;
 
        if (pnp_bios_isapnp_config(&pnps))
                return -EIO;
        return snprintf(buf, count,
-               "structure_revision %d\n"
-               "number_of_CSNs %d\n"
-               "ISA_read_data_port 0x%x\n",
-               pnps.revision,
-               pnps.no_csns,
-               pnps.isa_rd_data_port
-       );
+                       "structure_revision %d\n"
+                       "number_of_CSNs %d\n"
+                       "ISA_read_data_port 0x%x\n",
+                       pnps.revision, pnps.no_csns, pnps.isa_rd_data_port);
 }
 
 static int proc_read_escdinfo(char *buf, char **start, off_t pos,
-                              int count, int *eof, void *data)
+                             int count, int *eof, void *data)
 {
        struct escd_info_struc escd;
 
        if (pnp_bios_escd_info(&escd))
                return -EIO;
        return snprintf(buf, count,
-               "min_ESCD_write_size %d\n"
-               "ESCD_size %d\n"
-               "NVRAM_base 0x%x\n",
-               escd.min_escd_write_size,
-               escd.escd_size,
-               escd.nv_storage_base
-       );
+                       "min_ESCD_write_size %d\n"
+                       "ESCD_size %d\n"
+                       "NVRAM_base 0x%x\n",
+                       escd.min_escd_write_size,
+                       escd.escd_size, escd.nv_storage_base);
 }
 
 #define MAX_SANE_ESCD_SIZE (32*1024)
 static int proc_read_escd(char *buf, char **start, off_t pos,
-                          int count, int *eof, void *data)
+                         int count, int *eof, void *data)
 {
        struct escd_info_struc escd;
        char *tmpbuf;
@@ -83,30 +75,36 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
 
        /* sanity check */
        if (escd.escd_size > MAX_SANE_ESCD_SIZE) {
-               printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by BIOS escd_info call is too great\n");
+               printk(KERN_ERR
+                      "PnPBIOS: proc_read_escd: ESCD size reported by BIOS escd_info call is too great\n");
                return -EFBIG;
        }
 
        tmpbuf = kzalloc(escd.escd_size, GFP_KERNEL);
-       if (!tmpbuf) return -ENOMEM;
+       if (!tmpbuf)
+               return -ENOMEM;
 
        if (pnp_bios_read_escd(tmpbuf, escd.nv_storage_base)) {
                kfree(tmpbuf);
                return -EIO;
        }
 
-       escd_size = (unsigned char)(tmpbuf[0]) + (unsigned char)(tmpbuf[1])*256;
+       escd_size =
+           (unsigned char)(tmpbuf[0]) + (unsigned char)(tmpbuf[1]) * 256;
 
        /* sanity check */
        if (escd_size > MAX_SANE_ESCD_SIZE) {
-               printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n");
+               printk(KERN_ERR
+                      "PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n");
                return -EFBIG;
        }
 
        escd_left_to_read = escd_size - pos;
-       if (escd_left_to_read < 0) escd_left_to_read = 0;
-       if (escd_left_to_read == 0) *eof = 1;
-       n = min(count,escd_left_to_read);
+       if (escd_left_to_read < 0)
+               escd_left_to_read = 0;
+       if (escd_left_to_read == 0)
+               *eof = 1;
+       n = min(count, escd_left_to_read);
        memcpy(buf, tmpbuf + pos, n);
        kfree(tmpbuf);
        *start = buf;
@@ -114,17 +112,17 @@ static int proc_read_escd(char *buf, char **start, off_t pos,
 }
 
 static int proc_read_legacyres(char *buf, char **start, off_t pos,
-                               int count, int *eof, void *data)
+                              int count, int *eof, void *data)
 {
        /* Assume that the following won't overflow the buffer */
-       if (pnp_bios_get_stat_res(buf)) 
+       if (pnp_bios_get_stat_res(buf))
                return -EIO;
 
-       return count;  // FIXME: Return actual length
+       return count;           // FIXME: Return actual length
 }
 
 static int proc_read_devices(char *buf, char **start, off_t pos,
-                             int count, int *eof, void *data)
+                            int count, int *eof, void *data)
 {
        struct pnp_bios_node *node;
        u8 nodenum;
@@ -134,9 +132,10 @@ static int proc_read_devices(char *buf, char **start, off_t pos,
                return 0;
 
        node = kzalloc(node_info.max_node_size, GFP_KERNEL);
-       if (!node) return -ENOMEM;
+       if (!node)
+               return -ENOMEM;
 
-       for (nodenum=pos; nodenum<0xff; ) {
+       for (nodenum = pos; nodenum < 0xff;) {
                u8 thisnodenum = nodenum;
                /* 26 = the number of characters per line sprintf'ed */
                if ((p - buf + 26) > count)
@@ -148,7 +147,11 @@ static int proc_read_devices(char *buf, char **start, off_t pos,
                             node->type_code[0], node->type_code[1],
                             node->type_code[2], node->flags);
                if (nodenum <= thisnodenum) {
-                       printk(KERN_ERR "%s Node number 0x%x is out of sequence following node 0x%x. Aborting.\n", "PnPBIOS: proc_read_devices:", (unsigned int)nodenum, (unsigned int)thisnodenum);
+                       printk(KERN_ERR
+                              "%s Node number 0x%x is out of sequence following node 0x%x. Aborting.\n",
+                              "PnPBIOS: proc_read_devices:",
+                              (unsigned int)nodenum,
+                              (unsigned int)thisnodenum);
                        *eof = 1;
                        break;
                }
@@ -156,12 +159,12 @@ static int proc_read_devices(char *buf, char **start, off_t pos,
        kfree(node);
        if (nodenum == 0xff)
                *eof = 1;
-       *start = (char *)((off_t)nodenum - pos);
+       *start = (char *)((off_t) nodenum - pos);
        return p - buf;
 }
 
 static int proc_read_node(char *buf, char **start, off_t pos,
-                          int count, int *eof, void *data)
+                         int count, int *eof, void *data)
 {
        struct pnp_bios_node *node;
        int boot = (long)data >> 8;
@@ -169,7 +172,8 @@ static int proc_read_node(char *buf, char **start, off_t pos,
        int len;
 
        node = kzalloc(node_info.max_node_size, GFP_KERNEL);
-       if (!node) return -ENOMEM;
+       if (!node)
+               return -ENOMEM;
        if (pnp_bios_get_dev_node(&nodenum, boot, node)) {
                kfree(node);
                return -EIO;
@@ -180,8 +184,8 @@ static int proc_read_node(char *buf, char **start, off_t pos,
        return len;
 }
 
-static int proc_write_node(struct file *file, const char __user *buf,
-                           unsigned long count, void *data)
+static int proc_write_node(struct file *file, const char __user * buf,
+                          unsigned long count, void *data)
 {
        struct pnp_bios_node *node;
        int boot = (long)data >> 8;
@@ -208,12 +212,12 @@ static int proc_write_node(struct file *file, const char __user *buf,
                goto out;
        }
        ret = count;
-out:
+      out:
        kfree(node);
        return ret;
 }
 
-int pnpbios_interface_attach_device(struct pnp_bios_node * node)
+int pnpbios_interface_attach_device(struct pnp_bios_node *node)
 {
        char name[3];
        struct proc_dir_entry *ent;
@@ -222,7 +226,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
 
        if (!proc_pnp)
                return -EIO;
-       if ( !pnpbios_dont_use_current_config ) {
+       if (!pnpbios_dont_use_current_config) {
                ent = create_proc_entry(name, 0, proc_pnp);
                if (ent) {
                        ent->read_proc = proc_read_node;
@@ -237,7 +241,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
        if (ent) {
                ent->read_proc = proc_read_node;
                ent->write_proc = proc_write_node;
-               ent->data = (void *)(long)(node->handle+0x100);
+               ent->data = (void *)(long)(node->handle + 0x100);
                return 0;
        }
 
@@ -249,7 +253,7 @@ int pnpbios_interface_attach_device(struct pnp_bios_node * node)
  * work and the pnpbios_dont_use_current_config flag
  * should already have been set to the appropriate value
  */
-int __init pnpbios_proc_init( void )
+int __init pnpbios_proc_init(void)
 {
        proc_pnp = proc_mkdir("pnp", proc_bus);
        if (!proc_pnp)
@@ -258,10 +262,13 @@ int __init pnpbios_proc_init( void )
        if (!proc_pnp_boot)
                return -EIO;
        create_proc_read_entry("devices", 0, proc_pnp, proc_read_devices, NULL);
-       create_proc_read_entry("configuration_info", 0, proc_pnp, proc_read_pnpconfig, NULL);
-       create_proc_read_entry("escd_info", 0, proc_pnp, proc_read_escdinfo, NULL);
+       create_proc_read_entry("configuration_info", 0, proc_pnp,
+                              proc_read_pnpconfig, NULL);
+       create_proc_read_entry("escd_info", 0, proc_pnp, proc_read_escdinfo,
+                              NULL);
        create_proc_read_entry("escd", S_IRUSR, proc_pnp, proc_read_escd, NULL);
-       create_proc_read_entry("legacy_device_resources", 0, proc_pnp, proc_read_legacyres, NULL);
+       create_proc_read_entry("legacy_device_resources", 0, proc_pnp,
+                              proc_read_legacyres, NULL);
 
        return 0;
 }
@@ -274,9 +281,9 @@ void __exit pnpbios_proc_exit(void)
        if (!proc_pnp)
                return;
 
-       for (i=0; i<0xff; i++) {
+       for (i = 0; i < 0xff; i++) {
                sprintf(name, "%02x", i);
-               if ( !pnpbios_dont_use_current_config )
+               if (!pnpbios_dont_use_current_config)
                        remove_proc_entry(name, proc_pnp);
                remove_proc_entry(name, proc_pnp_boot);
        }
@@ -287,6 +294,4 @@ void __exit pnpbios_proc_exit(void)
        remove_proc_entry("devices", proc_pnp);
        remove_proc_entry("boot", proc_pnp);
        remove_proc_entry("pnp", proc_bus);
-
-       return;
 }
index 3c2ab8394e3f987b71a555461e98c3c0b1a58e3e..04ecd7b6723000d99cc25df6ccb2658ca87aa560 100644 (file)
@@ -1,6 +1,5 @@
 /*
  * rsparser.c - parses and encodes pnpbios resource data streams
- *
  */
 
 #include <linux/ctype.h>
 #ifdef CONFIG_PCI
 #include <linux/pci.h>
 #else
-inline void pcibios_penalize_isa_irq(int irq, int active) {}
-#endif /* CONFIG_PCI */
+inline void pcibios_penalize_isa_irq(int irq, int active)
+{
+}
+#endif                         /* CONFIG_PCI */
 
 #include "pnpbios.h"
 
@@ -52,75 +53,88 @@ inline void pcibios_penalize_isa_irq(int irq, int active) {}
  * Allocated Resources
  */
 
-static void
-pnpbios_parse_allocated_irqresource(struct pnp_resource_table * res, int irq)
+static void pnpbios_parse_allocated_irqresource(struct pnp_resource_table *res,
+                                               int irq)
 {
        int i = 0;
-       while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_IRQ) i++;
+
+       while (!(res->irq_resource[i].flags & IORESOURCE_UNSET)
+              && i < PNP_MAX_IRQ)
+               i++;
        if (i < PNP_MAX_IRQ) {
-               res->irq_resource[i].flags = IORESOURCE_IRQ;  // Also clears _UNSET flag
+               res->irq_resource[i].flags = IORESOURCE_IRQ;    // Also clears _UNSET flag
                if (irq == -1) {
                        res->irq_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
                res->irq_resource[i].start =
-               res->irq_resource[i].end = (unsigned long) irq;
+                   res->irq_resource[i].end = (unsigned long)irq;
                pcibios_penalize_isa_irq(irq, 1);
        }
 }
 
-static void
-pnpbios_parse_allocated_dmaresource(struct pnp_resource_table * res, int dma)
+static void pnpbios_parse_allocated_dmaresource(struct pnp_resource_table *res,
+                                               int dma)
 {
        int i = 0;
+
        while (i < PNP_MAX_DMA &&
-                       !(res->dma_resource[i].flags & IORESOURCE_UNSET))
+              !(res->dma_resource[i].flags & IORESOURCE_UNSET))
                i++;
        if (i < PNP_MAX_DMA) {
-               res->dma_resource[i].flags = IORESOURCE_DMA;  // Also clears _UNSET flag
+               res->dma_resource[i].flags = IORESOURCE_DMA;    // Also clears _UNSET flag
                if (dma == -1) {
                        res->dma_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
                res->dma_resource[i].start =
-               res->dma_resource[i].end = (unsigned long) dma;
+                   res->dma_resource[i].end = (unsigned long)dma;
        }
 }
 
-static void
-pnpbios_parse_allocated_ioresource(struct pnp_resource_table * res, int io, int len)
+static void pnpbios_parse_allocated_ioresource(struct pnp_resource_table *res,
+                                              int io, int len)
 {
        int i = 0;
-       while (!(res->port_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_PORT) i++;
+
+       while (!(res->port_resource[i].flags & IORESOURCE_UNSET)
+              && i < PNP_MAX_PORT)
+               i++;
        if (i < PNP_MAX_PORT) {
-               res->port_resource[i].flags = IORESOURCE_IO;  // Also clears _UNSET flag
-               if (len <= 0 || (io + len -1) >= 0x10003) {
+               res->port_resource[i].flags = IORESOURCE_IO;    // Also clears _UNSET flag
+               if (len <= 0 || (io + len - 1) >= 0x10003) {
                        res->port_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
-               res->port_resource[i].start = (unsigned long) io;
+               res->port_resource[i].start = (unsigned long)io;
                res->port_resource[i].end = (unsigned long)(io + len - 1);
        }
 }
 
-static void
-pnpbios_parse_allocated_memresource(struct pnp_resource_table * res, int mem, int len)
+static void pnpbios_parse_allocated_memresource(struct pnp_resource_table *res,
+                                               int mem, int len)
 {
        int i = 0;
-       while (!(res->mem_resource[i].flags & IORESOURCE_UNSET) && i < PNP_MAX_MEM) i++;
+
+       while (!(res->mem_resource[i].flags & IORESOURCE_UNSET)
+              && i < PNP_MAX_MEM)
+               i++;
        if (i < PNP_MAX_MEM) {
-               res->mem_resource[i].flags = IORESOURCE_MEM;  // Also clears _UNSET flag
+               res->mem_resource[i].flags = IORESOURCE_MEM;    // Also clears _UNSET flag
                if (len <= 0) {
                        res->mem_resource[i].flags |= IORESOURCE_DISABLED;
                        return;
                }
-               res->mem_resource[i].start = (unsigned long) mem;
+               res->mem_resource[i].start = (unsigned long)mem;
                res->mem_resource[i].end = (unsigned long)(mem + len - 1);
        }
 }
 
-static unsigned char *
-pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, struct pnp_resource_table * res)
+static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
+                                                           unsigned char *end,
+                                                           struct
+                                                           pnp_resource_table
+                                                           *res)
 {
        unsigned int len, tag;
        int io, size, mask, i;
@@ -134,12 +148,12 @@ pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, st
        while ((char *)p < (char *)end) {
 
                /* determine the type of tag */
-               if (p[0] & LARGE_TAG) { /* large tag */
+               if (p[0] & LARGE_TAG) { /* large tag */
                        len = (p[2] << 8) | p[1];
                        tag = p[0];
-               } else { /* small tag */
+               } else {        /* small tag */
                        len = p[0] & 0x07;
-                       tag = ((p[0]>>3) & 0x0f);
+                       tag = ((p[0] >> 3) & 0x0f);
                }
 
                switch (tag) {
@@ -147,8 +161,8 @@ pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, st
                case LARGE_TAG_MEM:
                        if (len != 9)
                                goto len_err;
-                       io = *(short *) &p[4];
-                       size = *(short *) &p[10];
+                       io = *(short *)&p[4];
+                       size = *(short *)&p[10];
                        pnpbios_parse_allocated_memresource(res, io, size);
                        break;
 
@@ -163,16 +177,16 @@ pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, st
                case LARGE_TAG_MEM32:
                        if (len != 17)
                                goto len_err;
-                       io = *(int *) &p[4];
-                       size = *(int *) &p[16];
+                       io = *(int *)&p[4];
+                       size = *(int *)&p[16];
                        pnpbios_parse_allocated_memresource(res, io, size);
                        break;
 
                case LARGE_TAG_FIXEDMEM32:
                        if (len != 9)
                                goto len_err;
-                       io = *(int *) &p[4];
-                       size = *(int *) &p[8];
+                       io = *(int *)&p[4];
+                       size = *(int *)&p[8];
                        pnpbios_parse_allocated_memresource(res, io, size);
                        break;
 
@@ -180,9 +194,10 @@ pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, st
                        if (len < 2 || len > 3)
                                goto len_err;
                        io = -1;
-                       mask= p[1] + p[2]*256;
-                       for (i=0;i<16;i++, mask=mask>>1)
-                               if(mask & 0x01) io=i;
+                       mask = p[1] + p[2] * 256;
+                       for (i = 0; i < 16; i++, mask = mask >> 1)
+                               if (mask & 0x01)
+                                       io = i;
                        pnpbios_parse_allocated_irqresource(res, io);
                        break;
 
@@ -191,15 +206,16 @@ pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, st
                                goto len_err;
                        io = -1;
                        mask = p[1];
-                       for (i=0;i<8;i++, mask = mask>>1)
-                               if(mask & 0x01) io=i;
+                       for (i = 0; i < 8; i++, mask = mask >> 1)
+                               if (mask & 0x01)
+                                       io = i;
                        pnpbios_parse_allocated_dmaresource(res, io);
                        break;
 
                case SMALL_TAG_PORT:
                        if (len != 7)
                                goto len_err;
-                       io = p[2] + p[3] *256;
+                       io = p[2] + p[3] * 256;
                        size = p[7];
                        pnpbios_parse_allocated_ioresource(res, io, size);
                        break;
@@ -218,12 +234,14 @@ pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, st
 
                case SMALL_TAG_END:
                        p = p + 2;
-                       return (unsigned char *)p;
+                       return (unsigned char *)p;
                        break;
 
-               default: /* an unkown tag */
-                       len_err:
-                       printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len);
+               default:        /* an unkown tag */
+                     len_err:
+                       printk(KERN_ERR
+                              "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
+                              tag, len);
                        break;
                }
 
@@ -234,20 +252,21 @@ pnpbios_parse_allocated_resource_data(unsigned char * p, unsigned char * end, st
                        p += len + 1;
        }
 
-       printk(KERN_ERR "PnPBIOS: Resource structure does not contain an end tag.\n");
+       printk(KERN_ERR
+              "PnPBIOS: Resource structure does not contain an end tag.\n");
 
        return NULL;
 }
 
-
 /*
  * Resource Configuration Options
  */
 
-static void
-pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option)
+static void pnpbios_parse_mem_option(unsigned char *p, int size,
+                                    struct pnp_option *option)
 {
-       struct pnp_mem * mem;
+       struct pnp_mem *mem;
+
        mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
        if (!mem)
                return;
@@ -256,14 +275,14 @@ pnpbios_parse_mem_option(unsigned char *p, int size, struct pnp_option *option)
        mem->align = (p[9] << 8) | p[8];
        mem->size = ((p[11] << 8) | p[10]) << 8;
        mem->flags = p[3];
-       pnp_register_mem_resource(option,mem);
-       return;
+       pnp_register_mem_resource(option, mem);
 }
 
-static void
-pnpbios_parse_mem32_option(unsigned char *p, int size, struct pnp_option *option)
+static void pnpbios_parse_mem32_option(unsigned char *p, int size,
+                                      struct pnp_option *option)
 {
-       struct pnp_mem * mem;
+       struct pnp_mem *mem;
+
        mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
        if (!mem)
                return;
@@ -272,14 +291,13 @@ pnpbios_parse_mem32_option(unsigned char *p, int size, struct pnp_option *option
        mem->align = (p[15] << 24) | (p[14] << 16) | (p[13] << 8) | p[12];
        mem->size = (p[19] << 24) | (p[18] << 16) | (p[17] << 8) | p[16];
        mem->flags = p[3];
-       pnp_register_mem_resource(option,mem);
-       return;
+       pnp_register_mem_resource(option, mem);
 }
 
-static void
-pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, struct pnp_option *option)
+static void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size,
+                                            struct pnp_option *option)
 {
-       struct pnp_mem * mem;
+       struct pnp_mem *mem;
        mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
        if (!mem)
                return;
@@ -287,14 +305,13 @@ pnpbios_parse_fixed_mem32_option(unsigned char *p, int size, struct pnp_option *
        mem->size = (p[11] << 24) | (p[10] << 16) | (p[9] << 8) | p[8];
        mem->align = 0;
        mem->flags = p[3];
-       pnp_register_mem_resource(option,mem);
-       return;
+       pnp_register_mem_resource(option, mem);
 }
 
-static void
-pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option)
+static void pnpbios_parse_irq_option(unsigned char *p, int size,
+                                    struct pnp_option *option)
 {
-       struct pnp_irq * irq;
+       struct pnp_irq *irq;
        unsigned long bits;
 
        irq = kzalloc(sizeof(struct pnp_irq), GFP_KERNEL);
@@ -306,27 +323,27 @@ pnpbios_parse_irq_option(unsigned char *p, int size, struct pnp_option *option)
                irq->flags = p[3];
        else
                irq->flags = IORESOURCE_IRQ_HIGHEDGE;
-       pnp_register_irq_resource(option,irq);
-       return;
+       pnp_register_irq_resource(option, irq);
 }
 
-static void
-pnpbios_parse_dma_option(unsigned char *p, int size, struct pnp_option *option)
+static void pnpbios_parse_dma_option(unsigned char *p, int size,
+                                    struct pnp_option *option)
 {
-       struct pnp_dma * dma;
+       struct pnp_dma *dma;
+
        dma = kzalloc(sizeof(struct pnp_dma), GFP_KERNEL);
        if (!dma)
                return;
        dma->map = p[1];
        dma->flags = p[2];
-       pnp_register_dma_resource(option,dma);
-       return;
+       pnp_register_dma_resource(option, dma);
 }
 
-static void
-pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option)
+static void pnpbios_parse_port_option(unsigned char *p, int size,
+                                     struct pnp_option *option)
 {
-       struct pnp_port * port;
+       struct pnp_port *port;
+
        port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL);
        if (!port)
                return;
@@ -335,14 +352,14 @@ pnpbios_parse_port_option(unsigned char *p, int size, struct pnp_option *option)
        port->align = p[6];
        port->size = p[7];
        port->flags = p[1] ? PNP_PORT_FLAG_16BITADDR : 0;
-       pnp_register_port_resource(option,port);
-       return;
+       pnp_register_port_resource(option, port);
 }
 
-static void
-pnpbios_parse_fixed_port_option(unsigned char *p, int size, struct pnp_option *option)
+static void pnpbios_parse_fixed_port_option(unsigned char *p, int size,
+                                           struct pnp_option *option)
 {
-       struct pnp_port * port;
+       struct pnp_port *port;
+
        port = kzalloc(sizeof(struct pnp_port), GFP_KERNEL);
        if (!port)
                return;
@@ -350,12 +367,12 @@ pnpbios_parse_fixed_port_option(unsigned char *p, int size, struct pnp_option *o
        port->size = p[3];
        port->align = 0;
        port->flags = PNP_PORT_FLAG_FIXED;
-       pnp_register_port_resource(option,port);
-       return;
+       pnp_register_port_resource(option, port);
 }
 
-static unsigned char *
-pnpbios_parse_resource_option_data(unsigned char * p, unsigned char * end, struct pnp_dev *dev)
+static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p,
+                                                        unsigned char *end,
+                                                        struct pnp_dev *dev)
 {
        unsigned int len, tag;
        int priority = 0;
@@ -371,12 +388,12 @@ pnpbios_parse_resource_option_data(unsigned char * p, unsigned char * end, struc
        while ((char *)p < (char *)end) {
 
                /* determine the type of tag */
-               if (p[0] & LARGE_TAG) { /* large tag */
+               if (p[0] & LARGE_TAG) { /* large tag */
                        len = (p[2] << 8) | p[1];
                        tag = p[0];
-               } else { /* small tag */
+               } else {        /* small tag */
                        len = p[0] & 0x07;
-                       tag = ((p[0]>>3) & 0x0f);
+                       tag = ((p[0] >> 3) & 0x0f);
                }
 
                switch (tag) {
@@ -442,16 +459,19 @@ pnpbios_parse_resource_option_data(unsigned char * p, unsigned char * end, struc
                        if (len != 0)
                                goto len_err;
                        if (option_independent == option)
-                               printk(KERN_WARNING "PnPBIOS: Missing SMALL_TAG_STARTDEP tag\n");
+                               printk(KERN_WARNING
+                                      "PnPBIOS: Missing SMALL_TAG_STARTDEP tag\n");
                        option = option_independent;
                        break;
 
                case SMALL_TAG_END:
-                       return p + 2;
+                       return p + 2;
 
-               default: /* an unkown tag */
-                       len_err:
-                       printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len);
+               default:        /* an unkown tag */
+                     len_err:
+                       printk(KERN_ERR
+                              "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
+                              tag, len);
                        break;
                }
 
@@ -462,19 +482,18 @@ pnpbios_parse_resource_option_data(unsigned char * p, unsigned char * end, struc
                        p += len + 1;
        }
 
-       printk(KERN_ERR "PnPBIOS: Resource structure does not contain an end tag.\n");
+       printk(KERN_ERR
+              "PnPBIOS: Resource structure does not contain an end tag.\n");
 
        return NULL;
 }
 
-
 /*
  * Compatible Device IDs
  */
 
 #define HEX(id,a) hex[((id)>>a) & 15]
 #define CHAR(id,a) (0x40 + (((id)>>a) & 31))
-//
 
 void pnpid32_to_pnpid(u32 id, char *str)
 {
@@ -483,21 +502,20 @@ void pnpid32_to_pnpid(u32 id, char *str)
        id = be32_to_cpu(id);
        str[0] = CHAR(id, 26);
        str[1] = CHAR(id, 21);
-       str[2] = CHAR(id,16);
+       str[2] = CHAR(id, 16);
        str[3] = HEX(id, 12);
        str[4] = HEX(id, 8);
        str[5] = HEX(id, 4);
        str[6] = HEX(id, 0);
        str[7] = '\0';
-
-       return;
 }
-//
+
 #undef CHAR
 #undef HEX
 
-static unsigned char *
-pnpbios_parse_compatible_ids(unsigned char *p, unsigned char *end, struct pnp_dev *dev)
+static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
+                                                  unsigned char *end,
+                                                  struct pnp_dev *dev)
 {
        int len, tag;
        char id[8];
@@ -509,40 +527,45 @@ pnpbios_parse_compatible_ids(unsigned char *p, unsigned char *end, struct pnp_de
        while ((char *)p < (char *)end) {
 
                /* determine the type of tag */
-               if (p[0] & LARGE_TAG) { /* large tag */
+               if (p[0] & LARGE_TAG) { /* large tag */
                        len = (p[2] << 8) | p[1];
                        tag = p[0];
-               } else { /* small tag */
+               } else {        /* small tag */
                        len = p[0] & 0x07;
-                       tag = ((p[0]>>3) & 0x0f);
+                       tag = ((p[0] >> 3) & 0x0f);
                }
 
                switch (tag) {
 
                case LARGE_TAG_ANSISTR:
-                       strncpy(dev->name, p + 3, len >= PNP_NAME_LEN ? PNP_NAME_LEN - 2 : len);
-                       dev->name[len >= PNP_NAME_LEN ? PNP_NAME_LEN - 1 : len] = '\0';
+                       strncpy(dev->name, p + 3,
+                               len >= PNP_NAME_LEN ? PNP_NAME_LEN - 2 : len);
+                       dev->name[len >=
+                                 PNP_NAME_LEN ? PNP_NAME_LEN - 1 : len] = '\0';
                        break;
 
-               case SMALL_TAG_COMPATDEVID: /* compatible ID */
+               case SMALL_TAG_COMPATDEVID:     /* compatible ID */
                        if (len != 4)
                                goto len_err;
-                       dev_id =  kzalloc(sizeof (struct pnp_id), GFP_KERNEL);
+                       dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL);
                        if (!dev_id)
                                return NULL;
-                       pnpid32_to_pnpid(p[1] | p[2] << 8 | p[3] << 16 | p[4] << 24,id);
+                       pnpid32_to_pnpid(p[1] | p[2] << 8 | p[3] << 16 | p[4] <<
+                                        24, id);
                        memcpy(&dev_id->id, id, 7);
                        pnp_add_id(dev_id, dev);
                        break;
 
                case SMALL_TAG_END:
                        p = p + 2;
-                       return (unsigned char *)p;
+                       return (unsigned char *)p;
                        break;
 
-               default: /* an unkown tag */
-                       len_err:
-                       printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len);
+               default:        /* an unkown tag */
+                     len_err:
+                       printk(KERN_ERR
+                              "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
+                              tag, len);
                        break;
                }
 
@@ -553,33 +576,34 @@ pnpbios_parse_compatible_ids(unsigned char *p, unsigned char *end, struct pnp_de
                        p += len + 1;
        }
 
-       printk(KERN_ERR "PnPBIOS: Resource structure does not contain an end tag.\n");
+       printk(KERN_ERR
+              "PnPBIOS: Resource structure does not contain an end tag.\n");
 
        return NULL;
 }
 
-
 /*
  * Allocated Resource Encoding
  */
 
-static void pnpbios_encode_mem(unsigned char *p, struct resource * res)
+static void pnpbios_encode_mem(unsigned char *p, struct resource *res)
 {
        unsigned long base = res->start;
        unsigned long len = res->end - res->start + 1;
+
        p[4] = (base >> 8) & 0xff;
        p[5] = ((base >> 8) >> 8) & 0xff;
        p[6] = (base >> 8) & 0xff;
        p[7] = ((base >> 8) >> 8) & 0xff;
        p[10] = (len >> 8) & 0xff;
        p[11] = ((len >> 8) >> 8) & 0xff;
-       return;
 }
 
-static void pnpbios_encode_mem32(unsigned char *p, struct resource * res)
+static void pnpbios_encode_mem32(unsigned char *p, struct resource *res)
 {
        unsigned long base = res->start;
        unsigned long len = res->end - res->start + 1;
+
        p[4] = base & 0xff;
        p[5] = (base >> 8) & 0xff;
        p[6] = (base >> 16) & 0xff;
@@ -592,12 +616,13 @@ static void pnpbios_encode_mem32(unsigned char *p, struct resource * res)
        p[17] = (len >> 8) & 0xff;
        p[18] = (len >> 16) & 0xff;
        p[19] = (len >> 24) & 0xff;
-       return;
 }
 
-static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource * res)
-{      unsigned long base = res->start;
+static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource *res)
+{
+       unsigned long base = res->start;
        unsigned long len = res->end - res->start + 1;
+
        p[4] = base & 0xff;
        p[5] = (base >> 8) & 0xff;
        p[6] = (base >> 16) & 0xff;
@@ -606,50 +631,52 @@ static void pnpbios_encode_fixed_mem32(unsigned char *p, struct resource * res)
        p[9] = (len >> 8) & 0xff;
        p[10] = (len >> 16) & 0xff;
        p[11] = (len >> 24) & 0xff;
-       return;
 }
 
-static void pnpbios_encode_irq(unsigned char *p, struct resource * res)
+static void pnpbios_encode_irq(unsigned char *p, struct resource *res)
 {
        unsigned long map = 0;
+
        map = 1 << res->start;
        p[1] = map & 0xff;
        p[2] = (map >> 8) & 0xff;
-       return;
 }
 
-static void pnpbios_encode_dma(unsigned char *p, struct resource * res)
+static void pnpbios_encode_dma(unsigned char *p, struct resource *res)
 {
        unsigned long map = 0;
+
        map = 1 << res->start;
        p[1] = map & 0xff;
-       return;
 }
 
-static void pnpbios_encode_port(unsigned char *p, struct resource * res)
+static void pnpbios_encode_port(unsigned char *p, struct resource *res)
 {
        unsigned long base = res->start;
        unsigned long len = res->end - res->start + 1;
+
        p[2] = base & 0xff;
        p[3] = (base >> 8) & 0xff;
        p[4] = base & 0xff;
        p[5] = (base >> 8) & 0xff;
        p[7] = len & 0xff;
-       return;
 }
 
-static void pnpbios_encode_fixed_port(unsigned char *p, struct resource * res)
+static void pnpbios_encode_fixed_port(unsigned char *p, struct resource *res)
 {
        unsigned long base = res->start;
        unsigned long len = res->end - res->start + 1;
+
        p[1] = base & 0xff;
        p[2] = (base >> 8) & 0xff;
        p[3] = len & 0xff;
-       return;
 }
 
-static unsigned char *
-pnpbios_encode_allocated_resource_data(unsigned char * p, unsigned char * end, struct pnp_resource_table * res)
+static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p,
+                                                            unsigned char *end,
+                                                            struct
+                                                            pnp_resource_table
+                                                            *res)
 {
        unsigned int len, tag;
        int port = 0, irq = 0, dma = 0, mem = 0;
@@ -660,12 +687,12 @@ pnpbios_encode_allocated_resource_data(unsigned char * p, unsigned char * end, s
        while ((char *)p < (char *)end) {
 
                /* determine the type of tag */
-               if (p[0] & LARGE_TAG) { /* large tag */
+               if (p[0] & LARGE_TAG) { /* large tag */
                        len = (p[2] << 8) | p[1];
                        tag = p[0];
-               } else { /* small tag */
+               } else {        /* small tag */
                        len = p[0] & 0x07;
-                       tag = ((p[0]>>3) & 0x0f);
+                       tag = ((p[0] >> 3) & 0x0f);
                }
 
                switch (tag) {
@@ -725,12 +752,14 @@ pnpbios_encode_allocated_resource_data(unsigned char * p, unsigned char * end, s
 
                case SMALL_TAG_END:
                        p = p + 2;
-                       return (unsigned char *)p;
+                       return (unsigned char *)p;
                        break;
 
-               default: /* an unkown tag */
-                       len_err:
-                       printk(KERN_ERR "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", tag, len);
+               default:        /* an unkown tag */
+                     len_err:
+                       printk(KERN_ERR
+                              "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
+                              tag, len);
                        break;
                }
 
@@ -741,52 +770,52 @@ pnpbios_encode_allocated_resource_data(unsigned char * p, unsigned char * end, s
                        p += len + 1;
        }
 
-       printk(KERN_ERR "PnPBIOS: Resource structure does not contain an end tag.\n");
+       printk(KERN_ERR
+              "PnPBIOS: Resource structure does not contain an end tag.\n");
 
        return NULL;
 }
 
-
 /*
  * Core Parsing Functions
  */
 
-int
-pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node * node)
+int pnpbios_parse_data_stream(struct pnp_dev *dev, struct pnp_bios_node *node)
 {
-       unsigned char * p = (char *)node->data;
-       unsigned char * end = (char *)(node->data + node->size);
-       p = pnpbios_parse_allocated_resource_data(p,end,&dev->res);
+       unsigned char *p = (char *)node->data;
+       unsigned char *end = (char *)(node->data + node->size);
+
+       p = pnpbios_parse_allocated_resource_data(p, end, &dev->res);
        if (!p)
                return -EIO;
-       p = pnpbios_parse_resource_option_data(p,end,dev);
+       p = pnpbios_parse_resource_option_data(p, end, dev);
        if (!p)
                return -EIO;
-       p = pnpbios_parse_compatible_ids(p,end,dev);
+       p = pnpbios_parse_compatible_ids(p, end, dev);
        if (!p)
                return -EIO;
        return 0;
 }
 
-int
-pnpbios_read_resources_from_node(struct pnp_resource_table *res,
-                                struct pnp_bios_node * node)
+int pnpbios_read_resources_from_node(struct pnp_resource_table *res,
+                                    struct pnp_bios_node *node)
 {
-       unsigned char * p = (char *)node->data;
-       unsigned char * end = (char *)(node->data + node->size);
-       p = pnpbios_parse_allocated_resource_data(p,end,res);
+       unsigned char *p = (char *)node->data;
+       unsigned char *end = (char *)(node->data + node->size);
+
+       p = pnpbios_parse_allocated_resource_data(p, end, res);
        if (!p)
                return -EIO;
        return 0;
 }
 
-int
-pnpbios_write_resources_to_node(struct pnp_resource_table *res,
-                               struct pnp_bios_node * node)
+int pnpbios_write_resources_to_node(struct pnp_resource_table *res,
+                                   struct pnp_bios_node *node)
 {
-       unsigned char * p = (char *)node->data;
-       unsigned char * end = (char *)(node->data + node->size);
-       p = pnpbios_encode_allocated_resource_data(p,end,res);
+       unsigned char *p = (char *)node->data;
+       unsigned char *end = (char *)(node->data + node->size);
+
+       p = pnpbios_encode_allocated_resource_data(p, end, res);
        if (!p)
                return -EIO;
        return 0;
index 7c3236690cc3f04fbaec01b3324dc2910d41b1d8..90755d4cdb9f67808e9a32889a2bbfdd00709e07 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/io.h>
 #include "base.h"
 
-
 static void quirk_awe32_resources(struct pnp_dev *dev)
 {
        struct pnp_port *port, *port2, *port3;
@@ -31,7 +30,7 @@ static void quirk_awe32_resources(struct pnp_dev *dev)
         * two extra ports (at offset 0x400 and 0x800 from the one given) by
         * hand.
         */
-       for ( ; res ; res = res->next ) {
+       for (; res; res = res->next) {
                port2 = pnp_alloc(sizeof(struct pnp_port));
                if (!port2)
                        return;
@@ -58,18 +57,19 @@ static void quirk_cmi8330_resources(struct pnp_dev *dev)
        struct pnp_option *res = dev->dependent;
        unsigned long tmp;
 
-       for ( ; res ; res = res->next ) {
+       for (; res; res = res->next) {
 
                struct pnp_irq *irq;
                struct pnp_dma *dma;
 
-               for( irq = res->irq; irq; irq = irq->next ) {   // Valid irqs are 5, 7, 10
+               for (irq = res->irq; irq; irq = irq->next) {    // Valid irqs are 5, 7, 10
                        tmp = 0x04A0;
                        bitmap_copy(irq->map, &tmp, 16);        // 0000 0100 1010 0000
                }
 
-               for( dma = res->dma; dma; dma = dma->next ) // Valid 8bit dma channels are 1,3
-                       if( ( dma->flags & IORESOURCE_DMA_TYPE_MASK ) == IORESOURCE_DMA_8BIT )
+               for (dma = res->dma; dma; dma = dma->next)      // Valid 8bit dma channels are 1,3
+                       if ((dma->flags & IORESOURCE_DMA_TYPE_MASK) ==
+                           IORESOURCE_DMA_8BIT)
                                dma->map = 0x000A;
        }
        printk(KERN_INFO "pnp: CMI8330 quirk - fixing interrupts and dma\n");
@@ -79,7 +79,7 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
 {
        struct pnp_port *port;
        struct pnp_option *res = dev->dependent;
-       int    changed = 0;
+       int changed = 0;
 
        /*
         * The default range on the mpu port for these devices is 0x388-0x388.
@@ -87,24 +87,24 @@ static void quirk_sb16audio_resources(struct pnp_dev *dev)
         * auto-configured.
         */
 
-       for( ; res ; res = res->next ) {
+       for (; res; res = res->next) {
                port = res->port;
-               if(!port)
+               if (!port)
                        continue;
                port = port->next;
-               if(!port)
+               if (!port)
                        continue;
                port = port->next;
-               if(!port)
+               if (!port)
                        continue;
-               if(port->min != port->max)
+               if (port->min != port->max)
                        continue;
                port->max += 0x70;
                changed = 1;
        }
-       if(changed)
-               printk(KERN_INFO "pnp: SB audio device quirk - increasing port range\n");
-       return;
+       if (changed)
+               printk(KERN_INFO
+                      "pnp: SB audio device quirk - increasing port range\n");
 }
 
 static int quirk_smc_fir_enabled(struct pnp_dev *dev)
@@ -124,7 +124,7 @@ static int quirk_smc_fir_enabled(struct pnp_dev *dev)
        outb(bank, firbase + 7);
 
        high = inb(firbase + 0);
-       low  = inb(firbase + 1);
+       low = inb(firbase + 1);
        chip = inb(firbase + 2);
 
        /* This corresponds to the check in smsc_ircc_present() */
@@ -153,8 +153,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
         */
        dev_err(&dev->dev, "%s not responding at SIR 0x%lx, FIR 0x%lx; "
                "auto-configuring\n", dev->id->id,
-               (unsigned long) pnp_port_start(dev, 0),
-               (unsigned long) pnp_port_start(dev, 1));
+               (unsigned long)pnp_port_start(dev, 0),
+               (unsigned long)pnp_port_start(dev, 1));
 
        pnp_disable_dev(dev);
        pnp_init_resource_table(&dev->res);
@@ -162,8 +162,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
        pnp_activate_dev(dev);
        if (quirk_smc_fir_enabled(dev)) {
                dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n",
-                       (unsigned long) pnp_port_start(dev, 0),
-                       (unsigned long) pnp_port_start(dev, 1));
+                       (unsigned long)pnp_port_start(dev, 0),
+                       (unsigned long)pnp_port_start(dev, 1));
                return;
        }
 
@@ -175,8 +175,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
         */
        dev_err(&dev->dev, "not responding at SIR 0x%lx, FIR 0x%lx; "
                "swapping SIR/FIR and reconfiguring\n",
-               (unsigned long) pnp_port_start(dev, 0),
-               (unsigned long) pnp_port_start(dev, 1));
+               (unsigned long)pnp_port_start(dev, 0),
+               (unsigned long)pnp_port_start(dev, 1));
 
        /*
         * Clear IORESOURCE_AUTO so pnp_activate_dev() doesn't reassign
@@ -200,8 +200,8 @@ static void quirk_smc_enable(struct pnp_dev *dev)
 
        if (quirk_smc_fir_enabled(dev)) {
                dev_err(&dev->dev, "responds at SIR 0x%lx, FIR 0x%lx\n",
-                       (unsigned long) pnp_port_start(dev, 0),
-                       (unsigned long) pnp_port_start(dev, 1));
+                       (unsigned long)pnp_port_start(dev, 0),
+                       (unsigned long)pnp_port_start(dev, 1));
                return;
        }
 
@@ -209,7 +209,6 @@ static void quirk_smc_enable(struct pnp_dev *dev)
                "email bjorn.helgaas@hp.com\n");
 }
 
-
 /*
  *  PnP Quirks
  *  Cards or devices that need some tweaking due to incomplete resource info
@@ -217,21 +216,21 @@ static void quirk_smc_enable(struct pnp_dev *dev)
 
 static struct pnp_fixup pnp_fixups[] = {
        /* Soundblaster awe io port quirk */
-       { "CTL0021", quirk_awe32_resources },
-       { "CTL0022", quirk_awe32_resources },
-       { "CTL0023", quirk_awe32_resources },
+       {"CTL0021", quirk_awe32_resources},
+       {"CTL0022", quirk_awe32_resources},
+       {"CTL0023", quirk_awe32_resources},
        /* CMI 8330 interrupt and dma fix */
-       { "@X@0001", quirk_cmi8330_resources },
+       {"@X@0001", quirk_cmi8330_resources},
        /* Soundblaster audio device io port range quirk */
-       { "CTL0001", quirk_sb16audio_resources },
-       { "CTL0031", quirk_sb16audio_resources },
-       { "CTL0041", quirk_sb16audio_resources },
-       { "CTL0042", quirk_sb16audio_resources },
-       { "CTL0043", quirk_sb16audio_resources },
-       { "CTL0044", quirk_sb16audio_resources },
-       { "CTL0045", quirk_sb16audio_resources },
-       { "SMCf010", quirk_smc_enable },
-       { "" }
+       {"CTL0001", quirk_sb16audio_resources},
+       {"CTL0031", quirk_sb16audio_resources},
+       {"CTL0041", quirk_sb16audio_resources},
+       {"CTL0042", quirk_sb16audio_resources},
+       {"CTL0043", quirk_sb16audio_resources},
+       {"CTL0044", quirk_sb16audio_resources},
+       {"CTL0045", quirk_sb16audio_resources},
+       {"SMCf010", quirk_smc_enable},
+       {""}
 };
 
 void pnp_fixup_device(struct pnp_dev *dev)
@@ -239,9 +238,8 @@ void pnp_fixup_device(struct pnp_dev *dev)
        int i = 0;
 
        while (*pnp_fixups[i].id) {
-               if (compare_pnp_id(dev->id,pnp_fixups[i].id)) {
-                       pnp_dbg("Calling quirk for %s",
-                                 dev->dev.bus_id);
+               if (compare_pnp_id(dev->id, pnp_fixups[i].id)) {
+                       pnp_dbg("Calling quirk for %s", dev->dev.bus_id);
                        pnp_fixups[i].quirk_function(dev);
                }
                i++;
index a685fbec4604e861bdb004ff10bacf95befbaf7f..ea6ec14a05595f112a8d41fe300e5c0226b0f4ac 100644 (file)
@@ -3,7 +3,6 @@
  *
  * based on isapnp.c resource management (c) Jaroslav Kysela <perex@suse.cz>
  * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #include <linux/module.h>
 #include <linux/pnp.h>
 #include "base.h"
 
-static int pnp_reserve_irq[16] = { [0 ... 15] = -1 };  /* reserve (don't use) some IRQ */
-static int pnp_reserve_dma[8] = { [0 ... 7] = -1 };    /* reserve (don't use) some DMA */
-static int pnp_reserve_io[16] = { [0 ... 15] = -1 };   /* reserve (don't use) some I/O region */
-static int pnp_reserve_mem[16] = { [0 ... 15] = -1 };  /* reserve (don't use) some memory region */
-
+static int pnp_reserve_irq[16] = {[0 ... 15] = -1 };   /* reserve (don't use) some IRQ */
+static int pnp_reserve_dma[8] = {[0 ... 7] = -1 };     /* reserve (don't use) some DMA */
+static int pnp_reserve_io[16] = {[0 ... 15] = -1 };    /* reserve (don't use) some I/O region */
+static int pnp_reserve_mem[16] = {[0 ... 15] = -1 };   /* reserve (don't use) some memory region */
 
 /*
  * option registration
  */
 
-static struct pnp_option * pnp_build_option(int priority)
+static struct pnp_option *pnp_build_option(int priority)
 {
        struct pnp_option *option = pnp_alloc(sizeof(struct pnp_option));
 
-       /* check if pnp_alloc ran out of memory */
        if (!option)
                return NULL;
 
@@ -46,9 +43,10 @@ static struct pnp_option * pnp_build_option(int priority)
        return option;
 }
 
-struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev)
+struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
 {
        struct pnp_option *option;
+
        if (!dev)
                return NULL;
 
@@ -61,9 +59,11 @@ struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev)
        return option;
 }
 
-struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority)
+struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
+                                                int priority)
 {
        struct pnp_option *option;
+
        if (!dev)
                return NULL;
 
@@ -82,6 +82,7 @@ struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int prior
 int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
 {
        struct pnp_irq *ptr;
+
        if (!option)
                return -EINVAL;
        if (!data)
@@ -110,6 +111,7 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
 int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
 {
        struct pnp_dma *ptr;
+
        if (!option)
                return -EINVAL;
        if (!data)
@@ -129,6 +131,7 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
 int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
 {
        struct pnp_port *ptr;
+
        if (!option)
                return -EINVAL;
        if (!data)
@@ -148,6 +151,7 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
 int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
 {
        struct pnp_mem *ptr;
+
        if (!option)
                return -EINVAL;
        if (!data)
@@ -222,7 +226,6 @@ void pnp_free_option(struct pnp_option *option)
        }
 }
 
-
 /*
  * resource validity checking
  */
@@ -236,11 +239,12 @@ void pnp_free_option(struct pnp_option *option)
 #define cannot_compare(flags) \
 ((flags) & (IORESOURCE_UNSET | IORESOURCE_DISABLED))
 
-int pnp_check_port(struct pnp_dev * dev, int idx)
+int pnp_check_port(struct pnp_dev *dev, int idx)
 {
        int tmp;
        struct pnp_dev *tdev;
        resource_size_t *port, *end, *tport, *tend;
+
        port = &dev->res.port_resource[idx].start;
        end = &dev->res.port_resource[idx].end;
 
@@ -250,8 +254,8 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
 
        /* check if the resource is already in use, skip if the
         * device is active because it itself may be in use */
-       if(!dev->active) {
-               if (__check_region(&ioport_resource, *port, length(port,end)))
+       if (!dev->active) {
+               if (__check_region(&ioport_resource, *port, length(port, end)))
                        return 0;
        }
 
@@ -259,7 +263,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
        for (tmp = 0; tmp < 8; tmp++) {
                int rport = pnp_reserve_io[tmp << 1];
                int rend = pnp_reserve_io[(tmp << 1) + 1] + rport - 1;
-               if (ranged_conflict(port,end,&rport,&rend))
+               if (ranged_conflict(port, end, &rport, &rend))
                        return 0;
        }
 
@@ -268,7 +272,7 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
                if (dev->res.port_resource[tmp].flags & IORESOURCE_IO) {
                        tport = &dev->res.port_resource[tmp].start;
                        tend = &dev->res.port_resource[tmp].end;
-                       if (ranged_conflict(port,end,tport,tend))
+                       if (ranged_conflict(port, end, tport, tend))
                                return 0;
                }
        }
@@ -279,11 +283,12 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
                        continue;
                for (tmp = 0; tmp < PNP_MAX_PORT; tmp++) {
                        if (tdev->res.port_resource[tmp].flags & IORESOURCE_IO) {
-                               if (cannot_compare(tdev->res.port_resource[tmp].flags))
+                               if (cannot_compare
+                                   (tdev->res.port_resource[tmp].flags))
                                        continue;
                                tport = &tdev->res.port_resource[tmp].start;
                                tend = &tdev->res.port_resource[tmp].end;
-                               if (ranged_conflict(port,end,tport,tend))
+                               if (ranged_conflict(port, end, tport, tend))
                                        return 0;
                        }
                }
@@ -292,11 +297,12 @@ int pnp_check_port(struct pnp_dev * dev, int idx)
        return 1;
 }
 
-int pnp_check_mem(struct pnp_dev * dev, int idx)
+int pnp_check_mem(struct pnp_dev *dev, int idx)
 {
        int tmp;
        struct pnp_dev *tdev;
        resource_size_t *addr, *end, *taddr, *tend;
+
        addr = &dev->res.mem_resource[idx].start;
        end = &dev->res.mem_resource[idx].end;
 
@@ -306,8 +312,8 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
 
        /* check if the resource is already in use, skip if the
         * device is active because it itself may be in use */
-       if(!dev->active) {
-               if (check_mem_region(*addr, length(addr,end)))
+       if (!dev->active) {
+               if (check_mem_region(*addr, length(addr, end)))
                        return 0;
        }
 
@@ -315,7 +321,7 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
        for (tmp = 0; tmp < 8; tmp++) {
                int raddr = pnp_reserve_mem[tmp << 1];
                int rend = pnp_reserve_mem[(tmp << 1) + 1] + raddr - 1;
-               if (ranged_conflict(addr,end,&raddr,&rend))
+               if (ranged_conflict(addr, end, &raddr, &rend))
                        return 0;
        }
 
@@ -324,7 +330,7 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
                if (dev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
                        taddr = &dev->res.mem_resource[tmp].start;
                        tend = &dev->res.mem_resource[tmp].end;
-                       if (ranged_conflict(addr,end,taddr,tend))
+                       if (ranged_conflict(addr, end, taddr, tend))
                                return 0;
                }
        }
@@ -335,11 +341,12 @@ int pnp_check_mem(struct pnp_dev * dev, int idx)
                        continue;
                for (tmp = 0; tmp < PNP_MAX_MEM; tmp++) {
                        if (tdev->res.mem_resource[tmp].flags & IORESOURCE_MEM) {
-                               if (cannot_compare(tdev->res.mem_resource[tmp].flags))
+                               if (cannot_compare
+                                   (tdev->res.mem_resource[tmp].flags))
                                        continue;
                                taddr = &tdev->res.mem_resource[tmp].start;
                                tend = &tdev->res.mem_resource[tmp].end;
-                               if (ranged_conflict(addr,end,taddr,tend))
+                               if (ranged_conflict(addr, end, taddr, tend))
                                        return 0;
                        }
                }
@@ -353,11 +360,11 @@ static irqreturn_t pnp_test_handler(int irq, void *dev_id)
        return IRQ_HANDLED;
 }
 
-int pnp_check_irq(struct pnp_dev * dev, int idx)
+int pnp_check_irq(struct pnp_dev *dev, int idx)
 {
        int tmp;
        struct pnp_dev *tdev;
-       resource_size_t * irq = &dev->res.irq_resource[idx].start;
+       resource_size_t *irq = &dev->res.irq_resource[idx].start;
 
        /* if the resource doesn't exist, don't complain about it */
        if (cannot_compare(dev->res.irq_resource[idx].flags))
@@ -394,9 +401,9 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
 
        /* check if the resource is already in use, skip if the
         * device is active because it itself may be in use */
-       if(!dev->active) {
+       if (!dev->active) {
                if (request_irq(*irq, pnp_test_handler,
-                               IRQF_DISABLED|IRQF_PROBE_SHARED, "pnp", NULL))
+                               IRQF_DISABLED | IRQF_PROBE_SHARED, "pnp", NULL))
                        return 0;
                free_irq(*irq, NULL);
        }
@@ -407,7 +414,8 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
                        continue;
                for (tmp = 0; tmp < PNP_MAX_IRQ; tmp++) {
                        if (tdev->res.irq_resource[tmp].flags & IORESOURCE_IRQ) {
-                               if (cannot_compare(tdev->res.irq_resource[tmp].flags))
+                               if (cannot_compare
+                                   (tdev->res.irq_resource[tmp].flags))
                                        continue;
                                if ((tdev->res.irq_resource[tmp].start == *irq))
                                        return 0;
@@ -418,12 +426,12 @@ int pnp_check_irq(struct pnp_dev * dev, int idx)
        return 1;
 }
 
-int pnp_check_dma(struct pnp_dev * dev, int idx)
+int pnp_check_dma(struct pnp_dev *dev, int idx)
 {
 #ifndef CONFIG_IA64
        int tmp;
        struct pnp_dev *tdev;
-       resource_size_t * dma = &dev->res.dma_resource[idx].start;
+       resource_size_t *dma = &dev->res.dma_resource[idx].start;
 
        /* if the resource doesn't exist, don't complain about it */
        if (cannot_compare(dev->res.dma_resource[idx].flags))
@@ -449,7 +457,7 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
 
        /* check if the resource is already in use, skip if the
         * device is active because it itself may be in use */
-       if(!dev->active) {
+       if (!dev->active) {
                if (request_dma(*dma, "pnp"))
                        return 0;
                free_dma(*dma);
@@ -461,7 +469,8 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
                        continue;
                for (tmp = 0; tmp < PNP_MAX_DMA; tmp++) {
                        if (tdev->res.dma_resource[tmp].flags & IORESOURCE_DMA) {
-                               if (cannot_compare(tdev->res.dma_resource[tmp].flags))
+                               if (cannot_compare
+                                   (tdev->res.dma_resource[tmp].flags))
                                        continue;
                                if ((tdev->res.dma_resource[tmp].start == *dma))
                                        return 0;
@@ -471,30 +480,18 @@ int pnp_check_dma(struct pnp_dev * dev, int idx)
 
        return 1;
 #else
-       /* IA64 hasn't legacy DMA */
+       /* IA64 does not have legacy DMA */
        return 0;
 #endif
 }
 
-
-#if 0
-EXPORT_SYMBOL(pnp_register_dependent_option);
-EXPORT_SYMBOL(pnp_register_independent_option);
-EXPORT_SYMBOL(pnp_register_irq_resource);
-EXPORT_SYMBOL(pnp_register_dma_resource);
-EXPORT_SYMBOL(pnp_register_port_resource);
-EXPORT_SYMBOL(pnp_register_mem_resource);
-#endif  /*  0  */
-
-
 /* format is: pnp_reserve_irq=irq1[,irq2] .... */
-
 static int __init pnp_setup_reserve_irq(char *str)
 {
        int i;
 
        for (i = 0; i < 16; i++)
-               if (get_option(&str,&pnp_reserve_irq[i]) != 2)
+               if (get_option(&str, &pnp_reserve_irq[i]) != 2)
                        break;
        return 1;
 }
@@ -502,13 +499,12 @@ static int __init pnp_setup_reserve_irq(char *str)
 __setup("pnp_reserve_irq=", pnp_setup_reserve_irq);
 
 /* format is: pnp_reserve_dma=dma1[,dma2] .... */
-
 static int __init pnp_setup_reserve_dma(char *str)
 {
        int i;
 
        for (i = 0; i < 8; i++)
-               if (get_option(&str,&pnp_reserve_dma[i]) != 2)
+               if (get_option(&str, &pnp_reserve_dma[i]) != 2)
                        break;
        return 1;
 }
@@ -516,13 +512,12 @@ static int __init pnp_setup_reserve_dma(char *str)
 __setup("pnp_reserve_dma=", pnp_setup_reserve_dma);
 
 /* format is: pnp_reserve_io=io1,size1[,io2,size2] .... */
-
 static int __init pnp_setup_reserve_io(char *str)
 {
        int i;
 
        for (i = 0; i < 16; i++)
-               if (get_option(&str,&pnp_reserve_io[i]) != 2)
+               if (get_option(&str, &pnp_reserve_io[i]) != 2)
                        break;
        return 1;
 }
@@ -530,13 +525,12 @@ static int __init pnp_setup_reserve_io(char *str)
 __setup("pnp_reserve_io=", pnp_setup_reserve_io);
 
 /* format is: pnp_reserve_mem=mem1,size1[,mem2,size2] .... */
-
 static int __init pnp_setup_reserve_mem(char *str)
 {
        int i;
 
        for (i = 0; i < 16; i++)
-               if (get_option(&str,&pnp_reserve_mem[i]) != 2)
+               if (get_option(&str, &pnp_reserve_mem[i]) != 2)
                        break;
        return 1;
 }
index 946a0dcd627dcc0a30c48246827057a30bae7076..13c608f5fb302864b7bae16defaf2d95365ea815 100644 (file)
@@ -1,8 +1,7 @@
 /*
- * support.c - provides standard pnp functions for the use of pnp protocol drivers,
+ * support.c - standard functions for the use of pnp protocol drivers
  *
  * Copyright 2003 Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #include <linux/module.h>
 #include "base.h"
 
 /**
- * pnp_is_active - Determines if a device is active based on its current resources
+ * pnp_is_active - Determines if a device is active based on its current
+ *     resources
  * @dev: pointer to the desired PnP device
- *
  */
-
-int pnp_is_active(struct pnp_dev * dev)
+int pnp_is_active(struct pnp_dev *dev)
 {
        if (!pnp_port_start(dev, 0) && pnp_port_len(dev, 0) <= 1 &&
            !pnp_mem_start(dev, 0) && pnp_mem_len(dev, 0) <= 1 &&
-           pnp_irq(dev, 0) == -1 &&
-           pnp_dma(dev, 0) == -1)
-               return 0;
+           pnp_irq(dev, 0) == -1 && pnp_dma(dev, 0) == -1)
+               return 0;
        else
                return 1;
 }
 
-
-
 EXPORT_SYMBOL(pnp_is_active);
index a8a95540b1ef78a225ea39653bc48e8a217410d4..a06f980b3ac9b596ef886b08a908602c79ec270f 100644 (file)
 
 static const struct pnp_device_id pnp_dev_table[] = {
        /* General ID for reserving resources */
-       {       "PNP0c02",              0       },
+       {"PNP0c02", 0},
        /* memory controller */
-       {       "PNP0c01",              0       },
-       {       "",                     0       }
+       {"PNP0c01", 0},
+       {"", 0}
 };
 
-static void reserve_range(const char *pnpid, resource_size_t start, resource_size_t end, int port)
+static void reserve_range(const char *pnpid, resource_size_t start,
+                         resource_size_t end, int port)
 {
        struct resource *res;
        char *regionid;
@@ -32,9 +33,9 @@ static void reserve_range(const char *pnpid, resource_size_t start, resource_siz
                return;
        snprintf(regionid, 16, "pnp %s", pnpid);
        if (port)
-               res = request_region(start, end-start+1, regionid);
+               res = request_region(start, end - start + 1, regionid);
        else
-               res = request_mem_region(start, end-start+1, regionid);
+               res = request_mem_region(start, end - start + 1, regionid);
        if (res == NULL)
                kfree(regionid);
        else
@@ -44,11 +45,10 @@ static void reserve_range(const char *pnpid, resource_size_t start, resource_siz
         * example do reserve stuff they know about too, so we may well
         * have double reservations.
         */
-       printk(KERN_INFO
-               "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
-               pnpid, port ? "ioport" : "iomem",
-                (unsigned long long)start, (unsigned long long)end,
-               NULL != res ? "has been" : "could not be");
+       printk(KERN_INFO "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n",
+              pnpid, port ? "ioport" : "iomem",
+              (unsigned long long)start, (unsigned long long)end,
+              NULL != res ? "has been" : "could not be");
 }
 
 static void reserve_resources_of_dev(const struct pnp_dev *dev)
@@ -74,7 +74,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
                        continue;       /* invalid */
 
                reserve_range(dev->dev.bus_id, pnp_port_start(dev, i),
-                       pnp_port_end(dev, i), 1);
+                             pnp_port_end(dev, i), 1);
        }
 
        for (i = 0; i < PNP_MAX_MEM; i++) {
@@ -82,24 +82,22 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev)
                        continue;
 
                reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i),
-                       pnp_mem_end(dev, i), 0);
+                             pnp_mem_end(dev, i), 0);
        }
-
-       return;
 }
 
-static int system_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id)
+static int system_pnp_probe(struct pnp_dev *dev,
+                           const struct pnp_device_id *dev_id)
 {
        reserve_resources_of_dev(dev);
        return 0;
 }
 
 static struct pnp_driver system_pnp_driver = {
-       .name           = "system",
-       .id_table       = pnp_dev_table,
-       .flags          = PNP_DRIVER_RES_DO_NOT_CHANGE,
-       .probe          = system_pnp_probe,
-       .remove         = NULL,
+       .name     = "system",
+       .id_table = pnp_dev_table,
+       .flags    = PNP_DRIVER_RES_DO_NOT_CHANGE,
+       .probe    = system_pnp_probe,
 };
 
 static int __init pnp_system_init(void)
index 3f6e176e6ea1b5dde193fa3ad78a17d20c92a181..58c806e9c58a2a941578fe9a629d0187b8ea777b 100644 (file)
@@ -38,7 +38,7 @@ config BATTERY_DS2760
 
 config BATTERY_PMU
        tristate "Apple PMU battery"
-       depends on ADB_PMU
+       depends on PPC32 && ADB_PMU
        help
          Say Y here to expose battery information on Apple machines
          through the generic battery class.
index 9d8d40d5c8f77f1c8f969805de31f640bac12c31..ff9e35cb308dad6a5494c6956b57907981716487 100644 (file)
@@ -2,15 +2,13 @@
 # RTC class/drivers configuration
 #
 
-menu "Real Time Clock"
-       depends on !S390
-
 config RTC_LIB
        tristate
 
-config RTC_CLASS
-       tristate "RTC class"
+menuconfig RTC_CLASS
+       tristate "Real Time Clock"
        default n
+       depends on !S390
        select RTC_LIB
        help
          Generic RTC class support. If you say yes here, you will
@@ -20,6 +18,8 @@ config RTC_CLASS
          This driver can also be built as a module. If so, the module
          will be called rtc-class.
 
+if RTC_CLASS
+
 config RTC_HCTOSYS
        bool "Set system time from RTC on startup and resume"
        depends on RTC_CLASS = y
@@ -58,11 +58,10 @@ config RTC_DEBUG
          and individual RTC drivers.
 
 comment "RTC interfaces"
-       depends on RTC_CLASS
 
 config RTC_INTF_SYSFS
        boolean "/sys/class/rtc/rtcN (sysfs)"
-       depends on RTC_CLASS && SYSFS
+       depends on SYSFS
        default RTC_CLASS
        help
          Say yes here if you want to use your RTCs using sysfs interfaces,
@@ -73,7 +72,7 @@ config RTC_INTF_SYSFS
 
 config RTC_INTF_PROC
        boolean "/proc/driver/rtc (procfs for rtc0)"
-       depends on RTC_CLASS && PROC_FS
+       depends on PROC_FS
        default RTC_CLASS
        help
          Say yes here if you want to use your first RTC through the proc
@@ -85,7 +84,6 @@ config RTC_INTF_PROC
 
 config RTC_INTF_DEV
        boolean "/dev/rtcN (character devices)"
-       depends on RTC_CLASS
        default RTC_CLASS
        help
          Say yes here if you want to use your RTCs using the /dev
@@ -107,7 +105,6 @@ config RTC_INTF_DEV_UIE_EMUL
 
 config RTC_DRV_TEST
        tristate "Test driver/device"
-       depends on RTC_CLASS
        help
          If you say yes here you get support for the
          RTC test driver. It's a software RTC which can be
@@ -121,11 +118,12 @@ config RTC_DRV_TEST
          will be called rtc-test.
 
 comment "I2C RTC drivers"
-       depends on RTC_CLASS && I2C
+       depends on I2C
+
+if I2C
 
 config RTC_DRV_DS1307
        tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you get support for various compatible RTC
          chips (often with battery backup) connected with I2C.  This driver
@@ -143,7 +141,6 @@ config RTC_DRV_DS1307
 
 config RTC_DRV_DS1672
        tristate "Dallas/Maxim DS1672"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you get support for the
          Dallas/Maxim DS1672 timekeeping chip.
@@ -153,7 +150,6 @@ config RTC_DRV_DS1672
 
 config RTC_DRV_MAX6900
        tristate "Maxim 6900"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you will get support for the
          Maxim MAX6900 I2C RTC chip.
@@ -163,7 +159,6 @@ config RTC_DRV_MAX6900
 
 config RTC_DRV_RS5C372
        tristate "Ricoh RS5C372A/B, RV5C386, RV5C387A"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you get support for the
          Ricoh RS5C372A, RS5C372B, RV5C386, and RV5C387A RTC chips.
@@ -173,7 +168,6 @@ config RTC_DRV_RS5C372
 
 config RTC_DRV_ISL1208
        tristate "Intersil 1208"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you get support for the
          Intersil 1208 RTC chip.
@@ -183,7 +177,6 @@ config RTC_DRV_ISL1208
 
 config RTC_DRV_X1205
        tristate "Xicor/Intersil X1205"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you get support for the
          Xicor/Intersil X1205 RTC chip.
@@ -193,7 +186,6 @@ config RTC_DRV_X1205
 
 config RTC_DRV_PCF8563
        tristate "Philips PCF8563/Epson RTC8564"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you get support for the
          Philips PCF8563 RTC chip. The Epson RTC8564
@@ -204,7 +196,6 @@ config RTC_DRV_PCF8563
 
 config RTC_DRV_PCF8583
        tristate "Philips PCF8583"
-       depends on RTC_CLASS && I2C
        help
          If you say yes here you get support for the Philips PCF8583
          RTC chip found on Acorn RiscPCs. This driver supports the
@@ -217,7 +208,6 @@ config RTC_DRV_PCF8583
 
 config RTC_DRV_M41T80
        tristate "ST M41T80 series RTC"
-       depends on RTC_CLASS && I2C
        help
          If you say Y here you will get support for the
          ST M41T80 RTC chips series. Currently following chips are
@@ -236,19 +226,21 @@ config RTC_DRV_M41T80_WDT
 
 config RTC_DRV_TWL92330
        boolean "TI TWL92330/Menelaus"
-       depends on RTC_CLASS && I2C && MENELAUS
+       depends on MENELAUS
        help
          If you say yes here you get support for the RTC on the
          TWL92330 "Menelaus" power mangement chip, used with OMAP2
          platforms.  The support is integrated with the rest of
          the Menelaus driver; it's not separate module.
 
+endif # I2C
+
 comment "SPI RTC drivers"
-       depends on RTC_CLASS && SPI_MASTER
+
+if SPI_MASTER
 
 config RTC_DRV_RS5C348
        tristate "Ricoh RS5C348A/B"
-       depends on RTC_CLASS && SPI_MASTER
        help
          If you say yes here you get support for the
          Ricoh RS5C348A and RS5C348B RTC chips.
@@ -258,7 +250,6 @@ config RTC_DRV_RS5C348
 
 config RTC_DRV_MAX6902
        tristate "Maxim 6902"
-       depends on RTC_CLASS && SPI_MASTER
        help
          If you say yes here you will get support for the
          Maxim MAX6902 SPI RTC chip.
@@ -266,8 +257,9 @@ config RTC_DRV_MAX6902
          This driver can also be built as a module. If so, the module
          will be called rtc-max6902.
 
+endif # SPI_MASTER
+
 comment "Platform RTC drivers"
-       depends on RTC_CLASS
 
 # this 'CMOS' RTC driver is arch dependent because <asm-generic/rtc.h>
 # requires <asm/mc146818rtc.h> defining CMOS_READ/CMOS_WRITE, and a
@@ -275,8 +267,7 @@ comment "Platform RTC drivers"
 
 config RTC_DRV_CMOS
        tristate "PC-style 'CMOS'"
-       depends on RTC_CLASS && (X86 || ALPHA || ARM26 || ARM \
-               || M32R || ATARI || PPC || MIPS)
+       depends on X86 || ALPHA || ARM || M32R || ATARI || PPC || MIPS
        help
          Say "yes" here to get direct support for the real time clock
          found in every PC or ACPI-based system, and some other boards.
@@ -294,13 +285,12 @@ config RTC_DRV_CMOS
 
 config RTC_DRV_DS1216
        tristate "Dallas DS1216"
-       depends on RTC_CLASS && SNI_RM
+       depends on SNI_RM
        help
          If you say yes here you get support for the Dallas DS1216 RTC chips.
 
 config RTC_DRV_DS1553
        tristate "Dallas DS1553"
-       depends on RTC_CLASS
        help
          If you say yes here you get support for the
          Dallas DS1553 timekeeping chip.
@@ -320,7 +310,6 @@ config RTC_DRV_STK17TA8
 
 config RTC_DRV_DS1742
        tristate "Dallas DS1742/1743"
-       depends on RTC_CLASS
        help
          If you say yes here you get support for the
          Dallas DS1742/1743 timekeeping chip.
@@ -330,7 +319,6 @@ config RTC_DRV_DS1742
 
 config RTC_DRV_M48T86
        tristate "ST M48T86/Dallas DS12887"
-       depends on RTC_CLASS
        help
          If you say Y here you will get support for the
          ST M48T86 and Dallas DS12887 RTC chips.
@@ -340,7 +328,6 @@ config RTC_DRV_M48T86
 
 config RTC_DRV_M48T59
        tristate "ST M48T59"
-       depends on RTC_CLASS
        help
          If you say Y here you will get support for the
          ST M48T59 RTC chip.
@@ -350,7 +337,6 @@ config RTC_DRV_M48T59
 
 config RTC_DRV_V3020
        tristate "EM Microelectronic V3020"
-       depends on RTC_CLASS
        help
          If you say yes here you will get support for the
          EM Microelectronic v3020 RTC chip.
@@ -359,19 +345,17 @@ config RTC_DRV_V3020
          will be called rtc-v3020.
 
 comment "on-CPU RTC drivers"
-       depends on RTC_CLASS
 
 config RTC_DRV_OMAP
        tristate "TI OMAP1"
-       depends on RTC_CLASS && ( \
-               ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730 )
+       depends on ARCH_OMAP15XX || ARCH_OMAP16XX || ARCH_OMAP730
        help
          Say "yes" here to support the real time clock on TI OMAP1 chips.
          This driver can also be built as a module called rtc-omap.
 
 config RTC_DRV_S3C
        tristate "Samsung S3C series SoC RTC"
-       depends on RTC_CLASS && ARCH_S3C2410
+       depends on ARCH_S3C2410
        help
          RTC (Realtime Clock) driver for the clock inbuilt into the
          Samsung S3C24XX series of SoCs. This can provide periodic
@@ -387,7 +371,7 @@ config RTC_DRV_S3C
 
 config RTC_DRV_EP93XX
        tristate "Cirrus Logic EP93XX"
-       depends on RTC_CLASS && ARCH_EP93XX
+       depends on ARCH_EP93XX
        help
          If you say yes here you get support for the
          RTC embedded in the Cirrus Logic EP93XX processors.
@@ -397,7 +381,7 @@ config RTC_DRV_EP93XX
 
 config RTC_DRV_SA1100
        tristate "SA11x0/PXA2xx"
-       depends on RTC_CLASS && (ARCH_SA1100 || ARCH_PXA)
+       depends on ARCH_SA1100 || ARCH_PXA
        help
          If you say Y here you will get access to the real time clock
          built into your SA11x0 or PXA2xx CPU.
@@ -407,7 +391,7 @@ config RTC_DRV_SA1100
 
 config RTC_DRV_SH
        tristate "SuperH On-Chip RTC"
-       depends on RTC_CLASS && SUPERH && (CPU_SH3 || CPU_SH4)
+       depends on RTC_CLASS && (CPU_SH3 || CPU_SH4)
        help
          Say Y here to enable support for the on-chip RTC found in
          most SuperH processors.
@@ -417,7 +401,7 @@ config RTC_DRV_SH
 
 config RTC_DRV_VR41XX
        tristate "NEC VR41XX"
-       depends on RTC_CLASS && CPU_VR41XX
+       depends on CPU_VR41XX
        help
          If you say Y here you will get access to the real time clock
          built into your NEC VR41XX CPU.
@@ -427,7 +411,7 @@ config RTC_DRV_VR41XX
 
 config RTC_DRV_PL031
        tristate "ARM AMBA PL031 RTC"
-       depends on RTC_CLASS && ARM_AMBA
+       depends on ARM_AMBA
        help
          If you say Y here you will get access to ARM AMBA
          PrimeCell PL031 RTC found on certain ARM SOCs.
@@ -437,20 +421,20 @@ config RTC_DRV_PL031
 
 config RTC_DRV_AT32AP700X
        tristate "AT32AP700X series RTC"
-       depends on RTC_CLASS && PLATFORM_AT32AP
+       depends on PLATFORM_AT32AP
        help
          Driver for the internal RTC (Realtime Clock) on Atmel AVR32
          AT32AP700x family processors.
 
 config RTC_DRV_AT91RM9200
        tristate "AT91RM9200"
-       depends on RTC_CLASS && ARCH_AT91RM9200
+       depends on ARCH_AT91RM9200
        help
          Driver for the Atmel AT91RM9200's internal RTC (Realtime Clock).
 
 config RTC_DRV_BFIN
        tristate "Blackfin On-Chip RTC"
-       depends on RTC_CLASS && BFIN
+       depends on BFIN
        help
          If you say yes here you will get support for the
          Blackfin On-Chip Real Time Clock.
@@ -460,8 +444,8 @@ config RTC_DRV_BFIN
 
 config RTC_DRV_RS5C313
        tristate "Ricoh RS5C313"
-       depends on RTC_CLASS && SH_LANDISK
+       depends on SH_LANDISK
        help
          If you say yes here you get support for the Ricoh RS5C313 RTC chips.
 
-endmenu
+endif # RTC_CLASS
index 7ede9e7253607de74244cae1e979150037f40a40..d3a33aa2696fbad8dfda7c8e092a4b1df3e33731 100644 (file)
@@ -15,34 +15,36 @@ rtc-core-$(CONFIG_RTC_INTF_DEV)     += rtc-dev.o
 rtc-core-$(CONFIG_RTC_INTF_PROC) += rtc-proc.o
 rtc-core-$(CONFIG_RTC_INTF_SYSFS) += rtc-sysfs.o
 
+# Keep the list ordered.
+
+obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o
+obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
+obj-$(CONFIG_RTC_DRV_BFIN)     += rtc-bfin.o
 obj-$(CONFIG_RTC_DRV_CMOS)     += rtc-cmos.o
-obj-$(CONFIG_RTC_DRV_X1205)    += rtc-x1205.o
-obj-$(CONFIG_RTC_DRV_ISL1208)  += rtc-isl1208.o
-obj-$(CONFIG_RTC_DRV_TEST)     += rtc-test.o
-obj-$(CONFIG_RTC_DRV_AT32AP700X)       += rtc-at32ap700x.o
+obj-$(CONFIG_RTC_DRV_DS1216)   += rtc-ds1216.o
 obj-$(CONFIG_RTC_DRV_DS1307)   += rtc-ds1307.o
+obj-$(CONFIG_RTC_DRV_DS1553)   += rtc-ds1553.o
 obj-$(CONFIG_RTC_DRV_DS1672)   += rtc-ds1672.o
 obj-$(CONFIG_RTC_DRV_DS1742)   += rtc-ds1742.o
+obj-$(CONFIG_RTC_DRV_EP93XX)   += rtc-ep93xx.o
+obj-$(CONFIG_RTC_DRV_ISL1208)  += rtc-isl1208.o
+obj-$(CONFIG_RTC_DRV_M41T80)   += rtc-m41t80.o
+obj-$(CONFIG_RTC_DRV_M48T59)   += rtc-m48t59.o
+obj-$(CONFIG_RTC_DRV_M48T86)   += rtc-m48t86.o
+obj-$(CONFIG_RTC_DRV_MAX6900)  += rtc-max6900.o
+obj-$(CONFIG_RTC_DRV_MAX6902)  += rtc-max6902.o
 obj-$(CONFIG_RTC_DRV_OMAP)     += rtc-omap.o
 obj-$(CONFIG_RTC_DRV_PCF8563)  += rtc-pcf8563.o
 obj-$(CONFIG_RTC_DRV_PCF8583)  += rtc-pcf8583.o
+obj-$(CONFIG_RTC_DRV_PL031)    += rtc-pl031.o
+obj-$(CONFIG_RTC_DRV_RS5C313)  += rtc-rs5c313.o
+obj-$(CONFIG_RTC_DRV_RS5C348)  += rtc-rs5c348.o
 obj-$(CONFIG_RTC_DRV_RS5C372)  += rtc-rs5c372.o
 obj-$(CONFIG_RTC_DRV_S3C)      += rtc-s3c.o
-obj-$(CONFIG_RTC_DRV_RS5C348)  += rtc-rs5c348.o
-obj-$(CONFIG_RTC_DRV_M41T80)   += rtc-m41t80.o
-obj-$(CONFIG_RTC_DRV_M48T86)   += rtc-m48t86.o
-obj-$(CONFIG_RTC_DRV_DS1553)   += rtc-ds1553.o
-obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o
-obj-$(CONFIG_RTC_DRV_RS5C313)  += rtc-rs5c313.o
-obj-$(CONFIG_RTC_DRV_EP93XX)   += rtc-ep93xx.o
 obj-$(CONFIG_RTC_DRV_SA1100)   += rtc-sa1100.o
-obj-$(CONFIG_RTC_DRV_VR41XX)   += rtc-vr41xx.o
-obj-$(CONFIG_RTC_DRV_PL031)    += rtc-pl031.o
-obj-$(CONFIG_RTC_DRV_MAX6900)  += rtc-max6900.o
-obj-$(CONFIG_RTC_DRV_MAX6902)  += rtc-max6902.o
-obj-$(CONFIG_RTC_DRV_V3020)    += rtc-v3020.o
-obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o
 obj-$(CONFIG_RTC_DRV_SH)       += rtc-sh.o
-obj-$(CONFIG_RTC_DRV_BFIN)     += rtc-bfin.o
-obj-$(CONFIG_RTC_DRV_M48T59)   += rtc-m48t59.o
-obj-$(CONFIG_RTC_DRV_DS1216)   += rtc-ds1216.o
+obj-$(CONFIG_RTC_DRV_STK17TA8) += rtc-stk17ta8.o
+obj-$(CONFIG_RTC_DRV_TEST)     += rtc-test.o
+obj-$(CONFIG_RTC_DRV_V3020)    += rtc-v3020.o
+obj-$(CONFIG_RTC_DRV_VR41XX)   += rtc-vr41xx.o
+obj-$(CONFIG_RTC_DRV_X1205)    += rtc-x1205.o
index 260ead95991898b0f89f57f2838464263cdb1abd..1aa709dda0d67d0fbb9e5d660211e207b22ca3ba 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Blackfin On-Chip Real Time Clock Driver
- *  Supports BF531/BF532/BF533/BF534/BF536/BF537
+ *  Supports BF53[123]/BF53[467]/BF54[2489]
  *
  * Copyright 2004-2007 Analog Devices Inc.
  *
index 304535942de2568e120d26df0db9fe7c77289d5c..005fff3a3508dfe4c4d010648986acb8304e0be8 100644 (file)
@@ -348,6 +348,8 @@ static int rtc_dev_ioctl(struct inode *inode, struct file *file,
        case RTC_IRQP_SET:
                if (ops->irq_set_freq)
                        err = rtc_irq_set_freq(rtc, rtc->irq_task, arg);
+               else
+                       err = -ENOTTY;
                break;
 
 #if 0
index 5158a625671f8f4a1de2330cd22b25ed32ea9e4b..db6f3f0d8982e685b7e48cc78e2f2db6040c4742 100644 (file)
@@ -352,7 +352,7 @@ read_rtc:
                /* oscillator fault?  clear flag, and warn */
                if (ds1307->regs[DS1307_REG_CONTROL] & DS1338_BIT_OSF) {
                        i2c_smbus_write_byte_data(client, DS1307_REG_CONTROL,
-                                       ds1307->regs[DS1337_REG_CONTROL]
+                                       ds1307->regs[DS1307_REG_CONTROL]
                                        & ~DS1338_BIT_OSF);
                        dev_warn(&client->dev, "SET TIME!\n");
                        goto read_rtc;
index 33b752350ab5c91b708eda96cbff4df7b5d53f2c..bf60d35f580b55e98495af3e6c7ab8157135be78 100644 (file)
@@ -35,7 +35,7 @@
 struct m48t59_private {
        void __iomem *ioaddr;
        unsigned int size; /* iomem size */
-       unsigned int irq;
+       int irq;
        struct rtc_device *rtc;
        spinlock_t lock; /* serialize the NVRAM and RTC access */
 };
index 54b6130534686586aa817c449c5c02ca418b6e08..8c1012b432bb1e71b9378f25d87eac404583fb77 100644 (file)
@@ -29,7 +29,7 @@
 
 #include <asm/mach/time.h>
 
-#include <asm/arch/regs-rtc.h>
+#include <asm/plat-s3c/regs-rtc.h>
 
 /* I have yet to find an S3C implementation with more than one
  * of these rtc blocks in */
index e0f91dfce0f56bcb8f340058d208557e613a44dd..93ee05eeaeba810f6bda495c5655cccc4031de7f 100644 (file)
@@ -365,6 +365,7 @@ static int sh_rtc_set_time(struct device *dev, struct rtc_time *tm)
        /* Reset pre-scaler & stop RTC */
        tmp = readb(rtc->regbase + RCR2);
        tmp |= RCR2_RESET;
+       tmp &= ~RCR2_START;
        writeb(tmp, rtc->regbase + RCR2);
 
        writeb(BIN2BCD(tm->tm_sec),  rtc->regbase + RSECCNT);
index f10d3facecbeb16e7be17189dbe3835619b293a3..8288b6b2bf2b2c9971efe99a74a08e579ee8c659 100644 (file)
@@ -258,7 +258,8 @@ static const struct rtc_class_ops stk17ta8_rtc_ops = {
        .ioctl          = stk17ta8_rtc_ioctl,
 };
 
-static ssize_t stk17ta8_nvram_read(struct kobject *kobj, char *buf,
+static ssize_t stk17ta8_nvram_read(struct kobject *kobj,
+                                struct bin_attribute *attr, char *buf,
                                 loff_t pos, size_t size)
 {
        struct platform_device *pdev =
@@ -272,7 +273,8 @@ static ssize_t stk17ta8_nvram_read(struct kobject *kobj, char *buf,
        return count;
 }
 
-static ssize_t stk17ta8_nvram_write(struct kobject *kobj, char *buf,
+static ssize_t stk17ta8_nvram_write(struct kobject *kobj,
+                                 struct bin_attribute *attr, char *buf,
                                  loff_t pos, size_t size)
 {
        struct platform_device *pdev =
index 418b4e63a4fab42473f9d650073171a81543a8b4..ea63ba7828f9cce67263026c8f0bb2b52359ec8a 100644 (file)
@@ -555,7 +555,7 @@ dasd_eckd_read_conf(struct dasd_device *device)
                        if (conf_data == NULL) {
                                MESSAGE(KERN_WARNING, "%s", "No configuration "
                                        "data retrieved");
-                               continue;       /* no errror */
+                               continue;       /* no error */
                        }
                        if (conf_len != sizeof (struct dasd_eckd_confdata)) {
                                MESSAGE(KERN_WARNING,
@@ -564,7 +564,7 @@ dasd_eckd_read_conf(struct dasd_device *device)
                                        conf_len,
                                        sizeof (struct dasd_eckd_confdata));
                                kfree(conf_data);
-                               continue;       /* no errror */
+                               continue;       /* no error */
                        }
                        /* save first valid configuration data */
                        if (!conf_data_saved){
index 3f36cb3910ee638c3fcf167a605f42840effe755..643033890e341d28188a3769ea35dcc56cf66fe0 100644 (file)
@@ -44,15 +44,9 @@ config CCW_CONSOLE
        depends on TN3215_CONSOLE || TN3270_CONSOLE
        default y
 
-config SCLP
-       bool "Support for SCLP"
-       depends on S390
-       help
-         Include support for the SCLP interface to the service element.
-
 config SCLP_TTY
        bool "Support for SCLP line mode terminal"
-       depends on SCLP
+       depends on S390
        help
          Include support for IBM SCLP line-mode terminals.
 
@@ -65,7 +59,7 @@ config SCLP_CONSOLE
 
 config SCLP_VT220_TTY
        bool "Support for SCLP VT220-compatible terminal"
-       depends on SCLP
+       depends on S390
        help
          Include support for an IBM SCLP VT220-compatible terminal.
 
@@ -78,7 +72,7 @@ config SCLP_VT220_CONSOLE
 
 config SCLP_CPI
        tristate "Control-Program Identification"
-       depends on SCLP
+       depends on S390
        help
          This option enables the hardware console interface for system
          identification. This is commonly used for workload management and
index 268598ef3efe9ada78e23881b416ce6ef933b44e..20442fbf93465087b266f21d6790a71f9df8fa83 100644 (file)
@@ -17,6 +17,7 @@
 #include <linux/miscdevice.h>
 #include <linux/ctype.h>
 #include <linux/poll.h>
+#include <linux/mutex.h>
 #include <asm/uaccess.h>
 #include <asm/ebcdic.h>
 #include <asm/io.h>
@@ -41,6 +42,7 @@ struct mon_private {
        size_t hdr_to_read;
        size_t data_to_read;
        struct mon_buf *current_buf;
+       struct mutex thread_mutex;
 };
 
 /*
@@ -179,6 +181,7 @@ static int monwrite_open(struct inode *inode, struct file *filp)
                return -ENOMEM;
        INIT_LIST_HEAD(&monpriv->list);
        monpriv->hdr_to_read = sizeof(monpriv->hdr);
+       mutex_init(&monpriv->thread_mutex);
        filp->private_data = monpriv;
        return nonseekable_open(inode, filp);
 }
@@ -209,6 +212,7 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
        void *to;
        int rc;
 
+       mutex_lock(&monpriv->thread_mutex);
        for (written = 0; written < count; ) {
                if (monpriv->hdr_to_read) {
                        len = min(count - written, monpriv->hdr_to_read);
@@ -247,11 +251,13 @@ static ssize_t monwrite_write(struct file *filp, const char __user *data,
                }
                monpriv->hdr_to_read = sizeof(monpriv->hdr);
        }
+       mutex_unlock(&monpriv->thread_mutex);
        return written;
 
 out_error:
        monpriv->data_to_read = 0;
        monpriv->hdr_to_read = sizeof(struct monwrite_hdr);
+       mutex_unlock(&monpriv->thread_mutex);
        return rc;
 }
 
index 743944ad61ecb44be0ba47a9f60ebad97e159730..4f2f81b16cfa277dfebd324513a60cdf400d3c1e 100644 (file)
@@ -147,8 +147,7 @@ raw3270_request_alloc(size_t size)
  * Allocate a new 3270 ccw request from bootmem. Only works very
  * early in the boot process. Only con3270.c should be using this.
  */
-struct raw3270_request *
-raw3270_request_alloc_bootmem(size_t size)
+struct raw3270_request __init *raw3270_request_alloc_bootmem(size_t size)
 {
        struct raw3270_request *rq;
 
@@ -848,8 +847,7 @@ raw3270_setup_device(struct ccw_device *cdev, struct raw3270 *rp, char *ascebc)
 /*
  * Setup 3270 device configured as console.
  */
-struct raw3270 *
-raw3270_setup_console(struct ccw_device *cdev)
+struct raw3270 __init *raw3270_setup_console(struct ccw_device *cdev)
 {
        struct raw3270 *rp;
        char *ascebc;
index 726334757bbf659d17b60d47d65297942ff60cb2..40cd21bc5cc4dc936191b3b68e1e9febc4c62710 100644 (file)
@@ -621,11 +621,24 @@ sclp_vt220_flush_buffer(struct tty_struct *tty)
 /*
  * Initialize all relevant components and register driver with system.
  */
-static int
-__sclp_vt220_init(int early)
+static void __init __sclp_vt220_cleanup(void)
+{
+       struct list_head *page, *p;
+
+       list_for_each_safe(page, p, &sclp_vt220_empty) {
+               list_del(page);
+               if (slab_is_available())
+                       free_page((unsigned long) page);
+               else
+                       free_bootmem((unsigned long) page, PAGE_SIZE);
+       }
+}
+
+static int __init __sclp_vt220_init(void)
 {
        void *page;
        int i;
+       int num_pages;
 
        if (sclp_vt220_initialized)
                return 0;
@@ -642,13 +655,16 @@ __sclp_vt220_init(int early)
        sclp_vt220_flush_later = 0;
 
        /* Allocate pages for output buffering */
-       for (i = 0; i < (early ? MAX_CONSOLE_PAGES : MAX_KMEM_PAGES); i++) {
-               if (early)
-                       page = alloc_bootmem_low_pages(PAGE_SIZE);
-               else
+       num_pages = slab_is_available() ? MAX_KMEM_PAGES : MAX_CONSOLE_PAGES;
+       for (i = 0; i < num_pages; i++) {
+               if (slab_is_available())
                        page = (void *) get_zeroed_page(GFP_KERNEL | GFP_DMA);
-               if (!page)
+               else
+                       page = alloc_bootmem_low_pages(PAGE_SIZE);
+               if (!page) {
+                       __sclp_vt220_cleanup();
                        return -ENOMEM;
+               }
                list_add_tail((struct list_head *) page, &sclp_vt220_empty);
        }
        return 0;
@@ -662,14 +678,13 @@ static const struct tty_operations sclp_vt220_ops = {
        .flush_chars = sclp_vt220_flush_chars,
        .write_room = sclp_vt220_write_room,
        .chars_in_buffer = sclp_vt220_chars_in_buffer,
-       .flush_buffer = sclp_vt220_flush_buffer
+       .flush_buffer = sclp_vt220_flush_buffer,
 };
 
 /*
  * Register driver with SCLP and Linux and initialize internal tty structures.
  */
-static int __init
-sclp_vt220_tty_init(void)
+static int __init sclp_vt220_tty_init(void)
 {
        struct tty_driver *driver;
        int rc;
@@ -679,18 +694,15 @@ sclp_vt220_tty_init(void)
        driver = alloc_tty_driver(1);
        if (!driver)
                return -ENOMEM;
-       rc = __sclp_vt220_init(0);
-       if (rc) {
-               put_tty_driver(driver);
-               return rc;
-       }
+       rc = __sclp_vt220_init();
+       if (rc)
+               goto out_driver;
        rc = sclp_register(&sclp_vt220_register);
        if (rc) {
                printk(KERN_ERR SCLP_VT220_PRINT_HEADER
                       "could not register tty - "
                       "sclp_register returned %d\n", rc);
-               put_tty_driver(driver);
-               return rc;
+               goto out_init;
        }
 
        driver->owner = THIS_MODULE;
@@ -709,14 +721,20 @@ sclp_vt220_tty_init(void)
                printk(KERN_ERR SCLP_VT220_PRINT_HEADER
                       "could not register tty - "
                       "tty_register_driver returned %d\n", rc);
-               put_tty_driver(driver);
-               return rc;
+               goto out_sclp;
        }
        sclp_vt220_driver = driver;
        return 0;
-}
 
-module_init(sclp_vt220_tty_init);
+out_sclp:
+       sclp_unregister(&sclp_vt220_register);
+out_init:
+       __sclp_vt220_cleanup();
+out_driver:
+       put_tty_driver(driver);
+       return rc;
+}
+__initcall(sclp_vt220_tty_init);
 
 #ifdef CONFIG_SCLP_VT220_CONSOLE
 
@@ -762,7 +780,7 @@ sclp_vt220_con_init(void)
 
        if (!CONSOLE_IS_SCLP)
                return 0;
-       rc = __sclp_vt220_init(1);
+       rc = __sclp_vt220_init();
        if (rc)
                return rc;
        /* Attach linux console */
index e90b0f84619582f236c153cb7b4b00b7fd887a0d..04b19bdc09da501191e7f0685a46e860f1a45b0e 100644 (file)
@@ -119,10 +119,12 @@ static void urdev_put(struct urdev *urd)
 /*
  * Low-level functions to do I/O to a ur device.
  *     alloc_chan_prog
+ *     free_chan_prog
  *     do_ur_io
  *     ur_int_handler
  *
  * alloc_chan_prog allocates and builds the channel program
+ * free_chan_prog frees memory of the channel program
  *
  * do_ur_io issues the channel program to the device and blocks waiting
  * on a completion event it publishes at urd->io_done. The function
@@ -137,6 +139,16 @@ static void urdev_put(struct urdev *urd)
  * address pointer that alloc_chan_prog returned.
  */
 
+static void free_chan_prog(struct ccw1 *cpa)
+{
+       struct ccw1 *ptr = cpa;
+
+       while (ptr->cda) {
+               kfree((void *)(addr_t) ptr->cda);
+               ptr++;
+       }
+       kfree(cpa);
+}
 
 /*
  * alloc_chan_prog
@@ -144,44 +156,45 @@ static void urdev_put(struct urdev *urd)
  * with a final NOP CCW command-chained on (which ensures that CE and DE
  * are presented together in a single interrupt instead of as separate
  * interrupts unless an incorrect length indication kicks in first). The
- * data length in each CCW is reclen. The caller must ensure that count
- * is an integral multiple of reclen.
- * The channel program pointer returned by this function must be freed
- * with kfree. The caller is responsible for checking that
- * count/reclen is not ridiculously large.
+ * data length in each CCW is reclen.
  */
-static struct ccw1 *alloc_chan_prog(char *buf, size_t count, size_t reclen)
+static struct ccw1 *alloc_chan_prog(const char __user *ubuf, int rec_count,
+                                   int reclen)
 {
-       size_t num_ccws;
        struct ccw1 *cpa;
+       void *kbuf;
        int i;
 
-       TRACE("alloc_chan_prog(%p, %zu, %zu)\n", buf, count, reclen);
+       TRACE("alloc_chan_prog(%p, %i, %i)\n", ubuf, rec_count, reclen);
 
        /*
         * We chain a NOP onto the writes to force CE+DE together.
         * That means we allocate room for CCWs to cover count/reclen
         * records plus a NOP.
         */
-       num_ccws = count / reclen + 1;
-       cpa = kmalloc(num_ccws * sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
+       cpa = kzalloc((rec_count + 1) * sizeof(struct ccw1),
+                     GFP_KERNEL | GFP_DMA);
        if (!cpa)
-               return NULL;
+               return ERR_PTR(-ENOMEM);
 
-       for (i = 0; count; i++) {
+       for (i = 0; i < rec_count; i++) {
                cpa[i].cmd_code = WRITE_CCW_CMD;
                cpa[i].flags = CCW_FLAG_CC | CCW_FLAG_SLI;
                cpa[i].count = reclen;
-               cpa[i].cda = __pa(buf);
-               buf += reclen;
-               count -= reclen;
+               kbuf = kmalloc(reclen, GFP_KERNEL | GFP_DMA);
+               if (!kbuf) {
+                       free_chan_prog(cpa);
+                       return ERR_PTR(-ENOMEM);
+               }
+               cpa[i].cda = (u32)(addr_t) kbuf;
+               if (copy_from_user(kbuf, ubuf, reclen)) {
+                       free_chan_prog(cpa);
+                       return ERR_PTR(-EFAULT);
+               }
+               ubuf += reclen;
        }
        /* The following NOP CCW forces CE+DE to be presented together */
        cpa[i].cmd_code = CCW_CMD_NOOP;
-       cpa[i].flags = 0;
-       cpa[i].count = 0;
-       cpa[i].cda = 0;
-
        return cpa;
 }
 
@@ -189,7 +202,7 @@ static int do_ur_io(struct urdev *urd, struct ccw1 *cpa)
 {
        int rc;
        struct ccw_device *cdev = urd->cdev;
-       DECLARE_COMPLETION(event);
+       DECLARE_COMPLETION_ONSTACK(event);
 
        TRACE("do_ur_io: cpa=%p\n", cpa);
 
@@ -325,24 +338,11 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
                        size_t count, size_t reclen, loff_t *ppos)
 {
        struct ccw1 *cpa;
-       char *buf;
        int rc;
 
-       /* Data buffer must be under 2GB line for fmt1 CCWs: hence GFP_DMA */
-       buf = kmalloc(count, GFP_KERNEL | GFP_DMA);
-       if (!buf)
-               return -ENOMEM;
-
-       if (copy_from_user(buf, udata, count)) {
-               rc = -EFAULT;
-               goto fail_kfree_buf;
-       }
-
-       cpa = alloc_chan_prog(buf, count, reclen);
-       if (!cpa) {
-               rc = -ENOMEM;
-               goto fail_kfree_buf;
-       }
+       cpa = alloc_chan_prog(udata, count / reclen, reclen);
+       if (IS_ERR(cpa))
+               return PTR_ERR(cpa);
 
        rc = do_ur_io(urd, cpa);
        if (rc)
@@ -354,10 +354,9 @@ static ssize_t do_write(struct urdev *urd, const char __user *udata,
        }
        *ppos += count;
        rc = count;
+
 fail_kfree_cpa:
-       kfree(cpa);
-fail_kfree_buf:
-       kfree(buf);
+       free_chan_prog(cpa);
        return rc;
 }
 
@@ -473,7 +472,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
                return rc;
 
        len = min((size_t) PAGE_SIZE, count);
-       buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
+       buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
        if (!buf)
                return -ENOMEM;
 
@@ -486,7 +485,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
                }
                if (rc)
                        goto fail;
-               if (reclen)
+               if (reclen && (copied == 0) && (*offs < PAGE_SIZE))
                        *((u16 *) &buf[FILE_RECLEN_OFFSET]) = reclen;
                len = min(count - copied, PAGE_SIZE - res);
                if (copy_to_user(ubuf + copied, buf + res, len)) {
@@ -500,7 +499,7 @@ static ssize_t diag14_read(struct file *file, char __user *ubuf, size_t count,
        *offs += copied;
        rc = copied;
 fail:
-       kfree(buf);
+       free_page((unsigned long) buf);
        return rc;
 }
 
@@ -543,56 +542,97 @@ static int diag_read_next_file_info(struct file_control_block *buf, int spid)
        }
 }
 
-static int verify_device(struct urdev *urd)
+static int verify_uri_device(struct urdev *urd)
 {
-       struct file_control_block fcb;
+       struct file_control_block *fcb;
        char *buf;
        int rc;
 
+       fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
+       if (!fcb)
+               return -ENOMEM;
+
+       /* check for empty reader device (beginning of chain) */
+       rc = diag_read_next_file_info(fcb, 0);
+       if (rc)
+               goto fail_free_fcb;
+
+       /* if file is in hold status, we do not read it */
+       if (fcb->file_stat & (FLG_SYSTEM_HOLD | FLG_USER_HOLD)) {
+               rc = -EPERM;
+               goto fail_free_fcb;
+       }
+
+       /* open file on virtual reader  */
+       buf = (char *) __get_free_page(GFP_KERNEL | GFP_DMA);
+       if (!buf) {
+               rc = -ENOMEM;
+               goto fail_free_fcb;
+       }
+       rc = diag_read_file(urd->dev_id.devno, buf);
+       if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
+               goto fail_free_buf;
+
+       /* check if the file on top of the queue is open now */
+       rc = diag_read_next_file_info(fcb, 0);
+       if (rc)
+               goto fail_free_buf;
+       if (!(fcb->file_stat & FLG_IN_USE)) {
+               rc = -EMFILE;
+               goto fail_free_buf;
+       }
+       rc = 0;
+
+fail_free_buf:
+       free_page((unsigned long) buf);
+fail_free_fcb:
+       kfree(fcb);
+       return rc;
+}
+
+static int verify_device(struct urdev *urd)
+{
        switch (urd->class) {
        case DEV_CLASS_UR_O:
                return 0; /* no check needed here */
        case DEV_CLASS_UR_I:
-               /* check for empty reader device (beginning of chain) */
-               rc = diag_read_next_file_info(&fcb, 0);
-               if (rc)
-                       return rc;
-
-               /* open file on virtual reader  */
-               buf = kmalloc(PAGE_SIZE, GFP_KERNEL);
-               if (!buf)
-                       return -ENOMEM;
-               rc = diag_read_file(urd->dev_id.devno, buf);
-               kfree(buf);
-
-               if ((rc != 0) && (rc != -ENODATA)) /* EOF does not hurt */
-                       return rc;
-               return 0;
+               return verify_uri_device(urd);
        default:
                return -ENOTSUPP;
        }
 }
 
-static int get_file_reclen(struct urdev *urd)
+static int get_uri_file_reclen(struct urdev *urd)
 {
-       struct file_control_block fcb;
+       struct file_control_block *fcb;
        int rc;
 
+       fcb = kmalloc(sizeof(*fcb), GFP_KERNEL | GFP_DMA);
+       if (!fcb)
+               return -ENOMEM;
+       rc = diag_read_next_file_info(fcb, 0);
+       if (rc)
+               goto fail_free;
+       if (fcb->file_stat & FLG_CP_DUMP)
+               rc = 0;
+       else
+               rc = fcb->rec_len;
+
+fail_free:
+       kfree(fcb);
+       return rc;
+}
+
+static int get_file_reclen(struct urdev *urd)
+{
        switch (urd->class) {
        case DEV_CLASS_UR_O:
                return 0;
        case DEV_CLASS_UR_I:
-               rc = diag_read_next_file_info(&fcb, 0);
-               if (rc)
-                       return rc;
-               break;
+               return get_uri_file_reclen(urd);
        default:
                return -ENOTSUPP;
        }
-       if (fcb.file_stat & FLG_CP_DUMP)
-               return 0;
-
-       return fcb.rec_len;
 }
 
 static int ur_open(struct inode *inode, struct file *file)
index 16d0a4e38e40a17ec4943c3fed13f0cba8245e04..2b3c564e04728f133d527a2d95a94ddbacd3fb7c 100644 (file)
@@ -50,7 +50,10 @@ struct file_control_block {
        char  rest[200];
 } __attribute__ ((packed));
 
-#define FLG_CP_DUMP 0x10
+#define FLG_SYSTEM_HOLD        0x04
+#define FLG_CP_DUMP    0x10
+#define FLG_USER_HOLD  0x20
+#define FLG_IN_USE     0x80
 
 /*
  * A struct urdev is created for each ur device that is made available
index ec0404874fada1f004c01f2ebfbc54a81c87de22..bd5f16f80bf8f316e8d52937771100cf0f914d7f 100644 (file)
@@ -51,7 +51,7 @@ blacklist_range (range_action action, unsigned int from, unsigned int to,
                to = from;
 
        if (from > to || to > __MAX_SUBCHANNEL || ssid > __MAX_SSID) {
-               printk (KERN_WARNING "Invalid blacklist range "
+               printk (KERN_WARNING "cio: Invalid blacklist range "
                        "0.%x.%04x to 0.%x.%04x, skipping\n",
                        ssid, from, ssid, to);
                return;
@@ -119,7 +119,7 @@ blacklist_busid(char **str, int *id0, int *ssid, int *devno)
        return 0;
 confused:
        strsep(str, ",\n");
-       printk(KERN_WARNING "Invalid cio_ignore parameter '%s'\n", sav);
+       printk(KERN_WARNING "cio: Invalid cio_ignore parameter '%s'\n", sav);
        return 1;
 }
 
@@ -166,22 +166,19 @@ blacklist_parse_parameters (char *str, range_action action)
                                        continue;
                        }
                        if (*str == '-') {
-                               printk(KERN_WARNING "invalid cio_ignore "
+                               printk(KERN_WARNING "cio: invalid cio_ignore "
                                        "parameter '%s'\n",
                                        strsep(&str, ",\n"));
                                continue;
                        }
                        if ((from_id0 != to_id0) ||
                            (from_ssid != to_ssid)) {
-                               printk(KERN_WARNING "invalid cio_ignore range "
-                                       "%x.%x.%04x-%x.%x.%04x\n",
-                                       from_id0, from_ssid, from,
-                                       to_id0, to_ssid, to);
+                               printk(KERN_WARNING "cio: invalid cio_ignore "
+                                      "range %x.%x.%04x-%x.%x.%04x\n",
+                                      from_id0, from_ssid, from,
+                                      to_id0, to_ssid, to);
                                continue;
                        }
-                       pr_debug("blacklist_setup: adding range "
-                                "from %x.%x.%04x to %x.%x.%04x\n",
-                                from_id0, from_ssid, from, to_id0, to_ssid, to);
                        blacklist_range (ra, from, to, to_ssid);
                }
        }
@@ -239,7 +236,7 @@ blacklist_parse_proc_parameters (char *buf)
                 */
                blacklist_parse_parameters (buf + 4, add);
        } else {
-               printk (KERN_WARNING "cio_ignore: Parse error; \n"
+               printk (KERN_WARNING "cio: cio_ignore: Parse error; \n"
                        KERN_WARNING "try using 'free all|<devno-range>,"
                                     "<devno-range>,...'\n"
                        KERN_WARNING "or 'add <devno-range>,"
index e5ccda63e883a2cac7c9c277bcda9ac7b12e05f5..b0a18f5176aa3e07ecde788944f4061d1f0974d6 100644 (file)
@@ -359,7 +359,6 @@ ccwgroup_probe (struct device *dev)
        if ((ret = device_create_file(dev, &dev_attr_online)))
                return ret;
 
-       pr_debug("%s: device %s\n", __func__, gdev->dev.bus_id);
        ret = gdrv->probe ? gdrv->probe(gdev) : -ENODEV;
        if (ret)
                device_remove_file(dev, &dev_attr_online);
@@ -376,8 +375,6 @@ ccwgroup_remove (struct device *dev)
        gdev = to_ccwgroupdev(dev);
        gdrv = to_ccwgroupdrv(dev->driver);
 
-       pr_debug("%s: device %s\n", __func__, gdev->dev.bus_id);
-
        device_remove_file(dev, &dev_attr_online);
 
        if (gdrv && gdrv->remove)
index b57d93d986c0fa9fc6bf6a8cf4923542899207e5..920dd71e643457fbf541842f07e380e5a80cd407 100644 (file)
@@ -121,14 +121,8 @@ static int s390_vary_chpid(struct chp_id chpid, int on)
        CIO_TRACE_EVENT( 2, dbf_text);
 
        status = chp_get_status(chpid);
-       if (status < 0) {
-               printk(KERN_ERR "Can't vary unknown chpid %x.%02x\n",
-                      chpid.cssid, chpid.id);
-               return -EINVAL;
-       }
-
        if (!on && !status) {
-               printk(KERN_ERR "chpid %x.%02x is already offline\n",
+               printk(KERN_ERR "cio: chpid %x.%02x is already offline\n",
                       chpid.cssid, chpid.id);
                return -EINVAL;
        }
@@ -421,21 +415,14 @@ int chp_new(struct chp_id chpid)
                if (ret)
                        goto out_free;
        } else {
-               static int msg_done;
-
-               if (!msg_done) {
-                       printk(KERN_WARNING "cio: Channel measurements not "
-                              "available, continuing.\n");
-                       msg_done = 1;
-               }
                chp->cmg = -1;
        }
 
        /* make it known to the system */
        ret = device_register(&chp->dev);
        if (ret) {
-               printk(KERN_WARNING "%s: could not register %x.%02x\n",
-                      __func__, chpid.cssid, chpid.id);
+               CIO_MSG_EVENT(0, "Could not register chp%x.%02x: %d\n",
+                             chpid.cssid, chpid.id, ret);
                goto out_free;
        }
        ret = sysfs_create_group(&chp->dev.kobj, &chp_attr_group);
index ea92ac4d657709620b3d60a5d3bfddc276ec86ec..597c0c76a2adcaf12cc228465b6f363a8a528626 100644 (file)
@@ -990,16 +990,20 @@ out:
        return ret;
 }
 
-static int __init
-chsc_alloc_sei_area(void)
+int __init chsc_alloc_sei_area(void)
 {
        sei_page = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
        if (!sei_page)
-               printk(KERN_WARNING"Can't allocate page for processing of " \
-                      "chsc machine checks!\n");
+               CIO_MSG_EVENT(0, "Can't allocate page for processing of "
+                             "chsc machine checks!\n");
        return (sei_page ? 0 : -ENOMEM);
 }
 
+void __init chsc_free_sei_area(void)
+{
+       kfree(sei_page);
+}
+
 int __init
 chsc_enable_facility(int operation_code)
 {
@@ -1051,8 +1055,6 @@ chsc_enable_facility(int operation_code)
        return ret;
 }
 
-subsys_initcall(chsc_alloc_sei_area);
-
 struct css_general_char css_general_characteristics;
 struct css_chsc_char css_chsc_characteristics;
 
@@ -1073,8 +1075,8 @@ chsc_determine_css_characteristics(void)
 
        scsc_area = (void *)get_zeroed_page(GFP_KERNEL | GFP_DMA);
        if (!scsc_area) {
-               printk(KERN_WARNING"cio: Was not able to determine available" \
-                      "CHSCs due to no memory.\n");
+               CIO_MSG_EVENT(0, "Was not able to determine available"
+                             "CHSCs due to no memory.\n");
                return -ENOMEM;
        }
 
@@ -1083,15 +1085,15 @@ chsc_determine_css_characteristics(void)
 
        result = chsc(scsc_area);
        if (result) {
-               printk(KERN_WARNING"cio: Was not able to determine " \
-                      "available CHSCs, cc=%i.\n", result);
+               CIO_MSG_EVENT(0, "Was not able to determine available CHSCs, "
+                             "cc=%i.\n", result);
                result = -EIO;
                goto exit;
        }
 
        if (scsc_area->response.code != 1) {
-               printk(KERN_WARNING"cio: Was not able to determine " \
-                      "available CHSCs.\n");
+               CIO_MSG_EVENT(0, "Was not able to determine "
+                             "available CHSCs.\n");
                result = -EIO;
                goto exit;
        }
index 2ad81d11cf7bfa564bdebe1d65085f0e054e3f7f..d1f5db1e69b94d6eee24aef06351fdb515abc1e4 100644 (file)
@@ -79,6 +79,8 @@ extern int chsc_get_ssd_info(struct subchannel_id schid,
                             struct chsc_ssd_info *ssd);
 extern int chsc_determine_css_characteristics(void);
 extern int css_characteristics_avail;
+extern int chsc_alloc_sei_area(void);
+extern void chsc_free_sei_area(void);
 
 extern int chsc_enable_facility(int);
 struct channel_subsystem;
index ea1defba5693af2f7533d387b1aa54d1f0b3a5f2..f2708d65be5a1d8bb14cedb874b950f21859f5f8 100644 (file)
@@ -47,8 +47,8 @@ cio_setup (char *parm)
        else if (!strcmp (parm, "no"))
                cio_show_msg = 0;
        else
-               printk (KERN_ERR "cio_setup : invalid cio_msg parameter '%s'",
-                       parm);
+               printk(KERN_ERR "cio: cio_setup: "
+                      "invalid cio_msg parameter '%s'", parm);
        return 1;
 }
 
@@ -80,7 +80,6 @@ cio_debug_init (void)
                goto out_unregister;
        debug_register_view (cio_debug_crw_id, &debug_sprintf_view);
        debug_set_level (cio_debug_crw_id, 2);
-       pr_debug("debugging initialized\n");
        return 0;
 
 out_unregister:
@@ -90,7 +89,7 @@ out_unregister:
                debug_unregister (cio_debug_trace_id);
        if (cio_debug_crw_id)
                debug_unregister (cio_debug_crw_id);
-       pr_debug("could not initialize debugging\n");
+       printk(KERN_WARNING"cio: could not initialize debugging\n");
        return -1;
 }
 
@@ -568,7 +567,7 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
         */
        if (sch->st != 0) {
                CIO_DEBUG(KERN_INFO, 0,
-                         "Subchannel 0.%x.%04x reports "
+                         "cio: Subchannel 0.%x.%04x reports "
                          "non-I/O subchannel type %04X\n",
                          sch->schid.ssid, sch->schid.sch_no, sch->st);
                /* We stop here for non-io subchannels. */
@@ -601,7 +600,7 @@ cio_validate_subchannel (struct subchannel *sch, struct subchannel_id schid)
        sch->lpm = sch->schib.pmcw.pam & sch->opm;
 
        CIO_DEBUG(KERN_INFO, 0,
-                 "Detected device %04x on subchannel 0.%x.%04X"
+                 "cio: Detected device %04x on subchannel 0.%x.%04X"
                  " - PIM = %02X, PAM = %02X, POM = %02X\n",
                  sch->schib.pmcw.dev, sch->schid.ssid,
                  sch->schid.sch_no, sch->schib.pmcw.pim,
@@ -766,7 +765,7 @@ cio_get_console_sch_no(void)
                /* unlike in 2.4, we cannot autoprobe here, since
                 * the channel subsystem is not fully initialized.
                 * With some luck, the HWC console can take over */
-               printk(KERN_WARNING "No ccw console found!\n");
+               printk(KERN_WARNING "cio: No ccw console found!\n");
                return -1;
        }
        return console_irq;
index f88844adae1ba432e58e8f1d3744415062dab1e7..c9bf8989930ff9d3c4fa1b08b1c95513997cf906 100644 (file)
@@ -23,6 +23,8 @@ extern debug_info_t *cio_debug_crw_id;
 static inline void
 CIO_HEX_EVENT(int level, void *data, int length)
 {
+       if (unlikely(!cio_debug_trace_id))
+               return;
        while (length > 0) {
                debug_event(cio_debug_trace_id, level, data, length);
                length -= cio_debug_trace_id->buf_size;
index 28abd697be1ace37a94e318efa4dcb96e01c56de..02fd00b55e1b0cb50ecb617114e8d927052c4f58 100644 (file)
@@ -1185,12 +1185,12 @@ static ssize_t cmb_enable_store(struct device *dev, struct device_attribute *att
        case '0':
                ret = disable_cmf(cdev);
                if (ret)
-                       printk(KERN_INFO "disable_cmf failed (%d)\n", ret);
+                       dev_info(&cdev->dev, "disable_cmf failed (%d)\n", ret);
                break;
        case '1':
                ret = enable_cmf(cdev);
                if (ret && ret != -EBUSY)
-                       printk(KERN_INFO "enable_cmf failed (%d)\n", ret);
+                       dev_info(&cdev->dev, "enable_cmf failed (%d)\n", ret);
                break;
        }
 
@@ -1280,10 +1280,10 @@ init_cmf(void)
                format_string = "basic";
                cmbops = &cmbops_basic;
                if (cmb_area.num_channels > 4096 || cmb_area.num_channels < 1) {
-                       printk(KERN_ERR "Basic channel measurement facility"
-                                       " can only use 1 to 4096 devices\n"
+                       printk(KERN_ERR "cio: Basic channel measurement "
+                              "facility can only use 1 to 4096 devices\n"
                               KERN_ERR "when the cmf driver is built"
-                                       " as a loadable module\n");
+                              " as a loadable module\n");
                        return 1;
                }
                break;
@@ -1292,13 +1292,13 @@ init_cmf(void)
                cmbops = &cmbops_extended;
                break;
        default:
-               printk(KERN_ERR "Invalid format %d for channel "
+               printk(KERN_ERR "cio: Invalid format %d for channel "
                        "measurement facility\n", format);
                return 1;
        }
 
-       printk(KERN_INFO "Channel measurement facility using %s format (%s)\n",
-               format_string, detect_string);
+       printk(KERN_INFO "cio: Channel measurement facility using %s "
+              "format (%s)\n", format_string, detect_string);
        return 0;
 }
 
index dfca0ef139fdc374cddc8bb0ef452b24a10ccd78..5635e656c1a369b92bd0027c0e8beca261baed3c 100644 (file)
@@ -79,6 +79,7 @@ css_alloc_subchannel(struct subchannel_id schid)
        sch->schib.pmcw.intparm = (__u32)(unsigned long)sch;
        ret = cio_modify(sch);
        if (ret) {
+               kfree(sch->lock);
                kfree(sch);
                return ERR_PTR(ret);
        }
@@ -109,7 +110,7 @@ css_subchannel_release(struct device *dev)
        }
 }
 
-int css_sch_device_register(struct subchannel *sch)
+static int css_sch_device_register(struct subchannel *sch)
 {
        int ret;
 
@@ -184,8 +185,8 @@ static int css_register_subchannel(struct subchannel *sch)
        /* make it known to the system */
        ret = css_sch_device_register(sch);
        if (ret) {
-               printk (KERN_WARNING "%s: could not register %s\n",
-                       __func__, sch->dev.bus_id);
+               CIO_MSG_EVENT(0, "Could not register sch 0.%x.%04x: %d\n",
+                             sch->schid.ssid, sch->schid.sch_no, ret);
                return ret;
        }
        return ret;
@@ -371,15 +372,12 @@ static int __init slow_subchannel_init(void)
        spin_lock_init(&slow_subchannel_lock);
        slow_subchannel_set = idset_sch_new();
        if (!slow_subchannel_set) {
-               printk(KERN_WARNING "cio: could not allocate slow subchannel "
-                      "set\n");
+               CIO_MSG_EVENT(0, "could not allocate slow subchannel set\n");
                return -ENOMEM;
        }
        return 0;
 }
 
-subsys_initcall(slow_subchannel_init);
-
 static void css_slow_path_func(struct work_struct *unused)
 {
        struct subchannel_id schid;
@@ -425,8 +423,8 @@ static int reprobe_subchannel(struct subchannel_id schid, void *data)
        struct subchannel *sch;
        int ret;
 
-       CIO_DEBUG(KERN_INFO, 6, "cio: reprobe 0.%x.%04x\n",
-                 schid.ssid, schid.sch_no);
+       CIO_MSG_EVENT(6, "cio: reprobe 0.%x.%04x\n",
+                     schid.ssid, schid.sch_no);
        if (need_reprobe)
                return -EAGAIN;
 
@@ -642,9 +640,20 @@ init_channel_subsystem (void)
 {
        int ret, i;
 
-       if (chsc_determine_css_characteristics() == 0)
+       ret = chsc_determine_css_characteristics();
+       if (ret == -ENOMEM)
+               goto out; /* No need to continue. */
+       if (ret == 0)
                css_characteristics_avail = 1;
 
+       ret = chsc_alloc_sei_area();
+       if (ret)
+               goto out;
+
+       ret = slow_subchannel_init();
+       if (ret)
+               goto out;
+
        if ((ret = bus_register(&css_bus_type)))
                goto out;
 
@@ -710,6 +719,10 @@ out_unregister:
 out_bus:
        bus_unregister(&css_bus_type);
 out:
+       chsc_free_sei_area();
+       kfree(slow_subchannel_set);
+       printk(KERN_WARNING"cio: failed to initialize css driver (%d)!\n",
+              ret);
        return ret;
 }
 
index ed7977531c3f8a14d9e345f86130107e1e582442..5d65e83ca66e818428ccf003b2f2a4ddc4e5b365 100644 (file)
@@ -139,7 +139,6 @@ struct css_driver {
  */
 extern struct bus_type css_bus_type;
 
-extern int css_sch_device_register(struct subchannel *);
 extern void css_sch_device_unregister(struct subchannel *);
 extern struct subchannel * get_subchannel_by_schid(struct subchannel_id);
 extern int css_init_done;
index 001682e70f672dc1be7e73e4da5918eb708427ff..297659fa0e26c80bd077092a12909b559f233f3e 100644 (file)
@@ -338,15 +338,20 @@ ccw_device_remove_disconnected(struct ccw_device *cdev)
                rc = device_schedule_callback(&cdev->dev,
                                              ccw_device_remove_orphan_cb);
                if (rc)
-                       dev_info(&cdev->dev, "Couldn't unregister orphan\n");
+                       CIO_MSG_EVENT(2, "Couldn't unregister orphan "
+                                     "0.%x.%04x\n",
+                                     cdev->private->dev_id.ssid,
+                                     cdev->private->dev_id.devno);
                return;
        }
        /* Deregister subchannel, which will kill the ccw device. */
        rc = device_schedule_callback(cdev->dev.parent,
                                      ccw_device_remove_sch_cb);
        if (rc)
-               dev_info(&cdev->dev,
-                        "Couldn't unregister disconnected device\n");
+               CIO_MSG_EVENT(2, "Couldn't unregister disconnected device "
+                             "0.%x.%04x\n",
+                             cdev->private->dev_id.ssid,
+                             cdev->private->dev_id.devno);
 }
 
 int
@@ -379,8 +384,10 @@ ccw_device_set_offline(struct ccw_device *cdev)
        if (ret == 0)
                wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
        else {
-               pr_debug("ccw_device_offline returned %d, device %s\n",
-                        ret, cdev->dev.bus_id);
+               CIO_MSG_EVENT(2, "ccw_device_offline returned %d, "
+                             "device 0.%x.%04x\n",
+                             ret, cdev->private->dev_id.ssid,
+                             cdev->private->dev_id.devno);
                cdev->online = 1;
        }
        return ret;
@@ -402,8 +409,10 @@ ccw_device_set_online(struct ccw_device *cdev)
        if (ret == 0)
                wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
        else {
-               pr_debug("ccw_device_online returned %d, device %s\n",
-                        ret, cdev->dev.bus_id);
+               CIO_MSG_EVENT(2, "ccw_device_online returned %d, "
+                             "device 0.%x.%04x\n",
+                             ret, cdev->private->dev_id.ssid,
+                             cdev->private->dev_id.devno);
                return ret;
        }
        if (cdev->private->state != DEV_STATE_ONLINE)
@@ -417,9 +426,11 @@ ccw_device_set_online(struct ccw_device *cdev)
        spin_unlock_irq(cdev->ccwlock);
        if (ret == 0)
                wait_event(cdev->private->wait_q, dev_fsm_final_state(cdev));
-       else 
-               pr_debug("ccw_device_offline returned %d, device %s\n",
-                        ret, cdev->dev.bus_id);
+       else
+               CIO_MSG_EVENT(2, "ccw_device_offline returned %d, "
+                             "device 0.%x.%04x\n",
+                             ret, cdev->private->dev_id.ssid,
+                             cdev->private->dev_id.devno);
        return (ret == 0) ? -ENODEV : ret;
 }
 
@@ -439,9 +450,10 @@ static int online_store_recog_and_online(struct ccw_device *cdev)
        if (cdev->id.cu_type == 0) {
                ret = ccw_device_recognition(cdev);
                if (ret) {
-                       printk(KERN_WARNING"Couldn't start recognition "
-                              "for device %s (ret=%d)\n",
-                              cdev->dev.bus_id, ret);
+                       CIO_MSG_EVENT(0, "Couldn't start recognition "
+                                     "for device 0.%x.%04x (ret=%d)\n",
+                                     cdev->private->dev_id.ssid,
+                                     cdev->private->dev_id.devno, ret);
                        return ret;
                }
                wait_event(cdev->private->wait_q,
@@ -461,8 +473,8 @@ static void online_store_handle_online(struct ccw_device *cdev, int force)
        if (force && cdev->private->state == DEV_STATE_BOXED) {
                ret = ccw_device_stlck(cdev);
                if (ret) {
-                       printk(KERN_WARNING"ccw_device_stlck for device %s "
-                              "returned %d!\n", cdev->dev.bus_id, ret);
+                       dev_warn(&cdev->dev,
+                                "ccw_device_stlck returned %d!\n", ret);
                        return;
                }
                if (cdev->id.cu_type == 0)
@@ -893,8 +905,10 @@ io_subchannel_register(struct work_struct *work)
                        ret = device_reprobe(&cdev->dev);
                        if (ret)
                                /* We can't do much here. */
-                               dev_info(&cdev->dev, "device_reprobe() returned"
-                                        " %d\n", ret);
+                               CIO_MSG_EVENT(2, "device_reprobe() returned"
+                                             " %d for 0.%x.%04x\n", ret,
+                                             cdev->private->dev_id.ssid,
+                                             cdev->private->dev_id.devno);
                }
                goto out;
        }
@@ -907,8 +921,9 @@ io_subchannel_register(struct work_struct *work)
        /* make it known to the system */
        ret = ccw_device_register(cdev);
        if (ret) {
-               printk (KERN_WARNING "%s: could not register %s\n",
-                       __func__, cdev->dev.bus_id);
+               CIO_MSG_EVENT(0, "Could not register ccw dev 0.%x.%04x: %d\n",
+                             cdev->private->dev_id.ssid,
+                             cdev->private->dev_id.devno, ret);
                put_device(&cdev->dev);
                spin_lock_irqsave(sch->lock, flags);
                sch->dev.driver_data = NULL;
@@ -1361,7 +1376,6 @@ ccw_device_remove (struct device *dev)
        struct ccw_driver *cdrv = cdev->drv;
        int ret;
 
-       pr_debug("removing device %s\n", cdev->dev.bus_id);
        if (cdrv->remove)
                cdrv->remove(cdev);
        if (cdev->online) {
@@ -1374,8 +1388,10 @@ ccw_device_remove (struct device *dev)
                                   dev_fsm_final_state(cdev));
                else
                        //FIXME: we can't fail!
-                       pr_debug("ccw_device_offline returned %d, device %s\n",
-                                ret, cdev->dev.bus_id);
+                       CIO_MSG_EVENT(2, "ccw_device_offline returned %d, "
+                                     "device 0.%x.%04x\n",
+                                     ret, cdev->private->dev_id.ssid,
+                                     cdev->private->dev_id.devno);
        }
        ccw_device_set_timeout(cdev, 0);
        cdev->drv = NULL;
index 6bba809295772702bf3637bd6b263cb2a415a22b..8633dc537695db3a99a03d35e462133fca0fa829 100644 (file)
@@ -268,7 +268,7 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
        switch (state) {
        case DEV_STATE_NOT_OPER:
                CIO_DEBUG(KERN_WARNING, 2,
-                         "SenseID : unknown device %04x on subchannel "
+                         "cio: SenseID : unknown device %04x on subchannel "
                          "0.%x.%04x\n", cdev->private->dev_id.devno,
                          sch->schid.ssid, sch->schid.sch_no);
                break;
@@ -293,7 +293,8 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
                        return;
                }
                /* Issue device info message. */
-               CIO_DEBUG(KERN_INFO, 2, "SenseID : device 0.%x.%04x reports: "
+               CIO_DEBUG(KERN_INFO, 2,
+                         "cio: SenseID : device 0.%x.%04x reports: "
                          "CU  Type/Mod = %04X/%02X, Dev Type/Mod = "
                          "%04X/%02X\n",
                          cdev->private->dev_id.ssid,
@@ -303,7 +304,7 @@ ccw_device_recog_done(struct ccw_device *cdev, int state)
                break;
        case DEV_STATE_BOXED:
                CIO_DEBUG(KERN_WARNING, 2,
-                         "SenseID : boxed device %04x on subchannel "
+                         "cio: SenseID : boxed device %04x on subchannel "
                          "0.%x.%04x\n", cdev->private->dev_id.devno,
                          sch->schid.ssid, sch->schid.sch_no);
                break;
@@ -388,7 +389,7 @@ ccw_device_done(struct ccw_device *cdev, int state)
 
        if (state == DEV_STATE_BOXED)
                CIO_DEBUG(KERN_WARNING, 2,
-                         "Boxed device %04x on subchannel %04x\n",
+                         "cio: Boxed device %04x on subchannel %04x\n",
                          cdev->private->dev_id.devno, sch->schid.sch_no);
 
        if (cdev->private->flags.donotify) {
@@ -946,9 +947,10 @@ ccw_device_w4sense(struct ccw_device *cdev, enum dev_event dev_event)
                        /* Basic sense hasn't started. Try again. */
                        ccw_device_do_sense(cdev, irb);
                else {
-                       printk(KERN_INFO "Huh? %s(%s): unsolicited "
-                              "interrupt...\n",
-                              __FUNCTION__, cdev->dev.bus_id);
+                       CIO_MSG_EVENT(2, "Huh? 0.%x.%04x: unsolicited "
+                                     "interrupt during w4sense...\n",
+                                     cdev->private->dev_id.ssid,
+                                     cdev->private->dev_id.devno);
                        if (cdev->handler)
                                cdev->handler (cdev, 0, irb);
                }
@@ -1215,8 +1217,8 @@ ccw_device_nop(struct ccw_device *cdev, enum dev_event dev_event)
 static void
 ccw_device_bug(struct ccw_device *cdev, enum dev_event dev_event)
 {
-       printk(KERN_EMERG "dev_jumptable[%i][%i] == NULL\n",
-              cdev->private->state, dev_event);
+       CIO_MSG_EVENT(0, "dev_jumptable[%i][%i] == NULL\n",
+                     cdev->private->state, dev_event);
        BUG();
 }
 
index a5d263fb55ae1722ff0aced679d55df0978e7546..14eba854b1556e8bad206828105ea8c5974aeb24 100644 (file)
@@ -288,253 +288,6 @@ ccw_device_get_path_mask(struct ccw_device *cdev)
                return sch->lpm;
 }
 
-static void
-ccw_device_wake_up(struct ccw_device *cdev, unsigned long ip, struct irb *irb)
-{
-       if (!ip)
-               /* unsolicited interrupt */
-               return;
-
-       /* Abuse intparm for error reporting. */
-       if (IS_ERR(irb))
-               cdev->private->intparm = -EIO;
-       else if (irb->scsw.cc == 1)
-               /* Retry for deferred condition code. */
-               cdev->private->intparm = -EAGAIN;
-       else if ((irb->scsw.dstat !=
-                 (DEV_STAT_CHN_END|DEV_STAT_DEV_END)) ||
-                (irb->scsw.cstat != 0)) {
-               /*
-                * We didn't get channel end / device end. Check if path
-                * verification has been started; we can retry after it has
-                * finished. We also retry unit checks except for command reject
-                * or intervention required. Also check for long busy
-                * conditions.
-                */
-                if (cdev->private->flags.doverify ||
-                        cdev->private->state == DEV_STATE_VERIFY)
-                        cdev->private->intparm = -EAGAIN;
-               else if ((irb->scsw.dstat & DEV_STAT_UNIT_CHECK) &&
-                        !(irb->ecw[0] &
-                          (SNS0_CMD_REJECT | SNS0_INTERVENTION_REQ)))
-                       cdev->private->intparm = -EAGAIN;
-               else if ((irb->scsw.dstat & DEV_STAT_ATTENTION) &&
-                        (irb->scsw.dstat & DEV_STAT_DEV_END) &&
-                        (irb->scsw.dstat & DEV_STAT_UNIT_EXCEP))
-                       cdev->private->intparm = -EAGAIN;
-                else
-                        cdev->private->intparm = -EIO;
-                        
-       } else
-               cdev->private->intparm = 0;
-       wake_up(&cdev->private->wait_q);
-}
-
-static int
-__ccw_device_retry_loop(struct ccw_device *cdev, struct ccw1 *ccw, long magic, __u8 lpm)
-{
-       int ret;
-       struct subchannel *sch;
-
-       sch = to_subchannel(cdev->dev.parent);
-       do {
-               ccw_device_set_timeout(cdev, 60 * HZ);
-               ret = cio_start (sch, ccw, lpm);
-               if (ret != 0)
-                       ccw_device_set_timeout(cdev, 0);
-               if (ret == -EBUSY) {
-                       /* Try again later. */
-                       spin_unlock_irq(sch->lock);
-                       msleep(10);
-                       spin_lock_irq(sch->lock);
-                       continue;
-               }
-               if (ret != 0)
-                       /* Non-retryable error. */
-                       break;
-               /* Wait for end of request. */
-               cdev->private->intparm = magic;
-               spin_unlock_irq(sch->lock);
-               wait_event(cdev->private->wait_q,
-                          (cdev->private->intparm == -EIO) ||
-                          (cdev->private->intparm == -EAGAIN) ||
-                          (cdev->private->intparm == 0));
-               spin_lock_irq(sch->lock);
-               /* Check at least for channel end / device end */
-               if (cdev->private->intparm == -EIO) {
-                       /* Non-retryable error. */
-                       ret = -EIO;
-                       break;
-               }
-               if (cdev->private->intparm == 0)
-                       /* Success. */
-                       break;
-               /* Try again later. */
-               spin_unlock_irq(sch->lock);
-               msleep(10);
-               spin_lock_irq(sch->lock);
-       } while (1);
-
-       return ret;
-}
-
-/**
- * read_dev_chars() - read device characteristics
- * @param cdev   target ccw device
- * @param buffer pointer to buffer for rdc data
- * @param length size of rdc data
- * @returns 0 for success, negative error value on failure
- *
- * Context:
- *   called for online device, lock not held
- **/
-int
-read_dev_chars (struct ccw_device *cdev, void **buffer, int length)
-{
-       void (*handler)(struct ccw_device *, unsigned long, struct irb *);
-       struct subchannel *sch;
-       int ret;
-       struct ccw1 *rdc_ccw;
-
-       if (!cdev)
-               return -ENODEV;
-       if (!buffer || !length)
-               return -EINVAL;
-       sch = to_subchannel(cdev->dev.parent);
-
-       CIO_TRACE_EVENT (4, "rddevch");
-       CIO_TRACE_EVENT (4, sch->dev.bus_id);
-
-       rdc_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
-       if (!rdc_ccw)
-               return -ENOMEM;
-       rdc_ccw->cmd_code = CCW_CMD_RDC;
-       rdc_ccw->count = length;
-       rdc_ccw->flags = CCW_FLAG_SLI;
-       ret = set_normalized_cda (rdc_ccw, (*buffer));
-       if (ret != 0) {
-               kfree(rdc_ccw);
-               return ret;
-       }
-
-       spin_lock_irq(sch->lock);
-       /* Save interrupt handler. */
-       handler = cdev->handler;
-       /* Temporarily install own handler. */
-       cdev->handler = ccw_device_wake_up;
-       if (cdev->private->state != DEV_STATE_ONLINE)
-               ret = -ENODEV;
-       else if (((sch->schib.scsw.stctl & SCSW_STCTL_PRIM_STATUS) &&
-                 !(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) ||
-                cdev->private->flags.doverify)
-               ret = -EBUSY;
-       else
-               /* 0x00D9C4C3 == ebcdic "RDC" */
-               ret = __ccw_device_retry_loop(cdev, rdc_ccw, 0x00D9C4C3, 0);
-
-       /* Restore interrupt handler. */
-       cdev->handler = handler;
-       spin_unlock_irq(sch->lock);
-
-       clear_normalized_cda (rdc_ccw);
-       kfree(rdc_ccw);
-
-       return ret;
-}
-
-/*
- *  Read Configuration data using path mask
- */
-int
-read_conf_data_lpm (struct ccw_device *cdev, void **buffer, int *length, __u8 lpm)
-{
-       void (*handler)(struct ccw_device *, unsigned long, struct irb *);
-       struct subchannel *sch;
-       struct ciw *ciw;
-       char *rcd_buf;
-       int ret;
-       struct ccw1 *rcd_ccw;
-
-       if (!cdev)
-               return -ENODEV;
-       if (!buffer || !length)
-               return -EINVAL;
-       sch = to_subchannel(cdev->dev.parent);
-
-       CIO_TRACE_EVENT (4, "rdconf");
-       CIO_TRACE_EVENT (4, sch->dev.bus_id);
-
-       /*
-        * scan for RCD command in extended SenseID data
-        */
-       ciw = ccw_device_get_ciw(cdev, CIW_TYPE_RCD);
-       if (!ciw || ciw->cmd == 0)
-               return -EOPNOTSUPP;
-
-       /* Adjust requested path mask to excluded varied off paths. */
-       if (lpm) {
-               lpm &= sch->opm;
-               if (lpm == 0)
-                       return -EACCES;
-       }
-
-       rcd_ccw = kzalloc(sizeof(struct ccw1), GFP_KERNEL | GFP_DMA);
-       if (!rcd_ccw)
-               return -ENOMEM;
-       rcd_buf = kzalloc(ciw->count, GFP_KERNEL | GFP_DMA);
-       if (!rcd_buf) {
-               kfree(rcd_ccw);
-               return -ENOMEM;
-       }
-       rcd_ccw->cmd_code = ciw->cmd;
-       rcd_ccw->cda = (__u32) __pa (rcd_buf);
-       rcd_ccw->count = ciw->count;
-       rcd_ccw->flags = CCW_FLAG_SLI;
-
-       spin_lock_irq(sch->lock);
-       /* Save interrupt handler. */
-       handler = cdev->handler;
-       /* Temporarily install own handler. */
-       cdev->handler = ccw_device_wake_up;
-       if (cdev->private->state != DEV_STATE_ONLINE)
-               ret = -ENODEV;
-       else if (((sch->schib.scsw.stctl & SCSW_STCTL_PRIM_STATUS) &&
-                 !(sch->schib.scsw.stctl & SCSW_STCTL_SEC_STATUS)) ||
-                cdev->private->flags.doverify)
-               ret = -EBUSY;
-       else
-               /* 0x00D9C3C4 == ebcdic "RCD" */
-               ret = __ccw_device_retry_loop(cdev, rcd_ccw, 0x00D9C3C4, lpm);
-
-       /* Restore interrupt handler. */
-       cdev->handler = handler;
-       spin_unlock_irq(sch->lock);
-
-       /*
-        * on success we update the user input parms
-        */
-       if (ret) {
-               kfree (rcd_buf);
-               *buffer = NULL;
-               *length = 0;
-       } else {
-               *length = ciw->count;
-               *buffer = rcd_buf;
-       }
-       kfree(rcd_ccw);
-
-       return ret;
-}
-
-/*
- *  Read Configuration data
- */
-int
-read_conf_data (struct ccw_device *cdev, void **buffer, int *length)
-{
-       return read_conf_data_lpm (cdev, buffer, length, 0);
-}
-
 /*
  * Try to break the lock on a boxed device.
  */
@@ -635,12 +388,6 @@ _ccw_device_get_subchannel_number(struct ccw_device *cdev)
        return cdev->private->schid.sch_no;
 }
 
-int
-_ccw_device_get_device_number(struct ccw_device *cdev)
-{
-       return cdev->private->dev_id.devno;
-}
-
 
 MODULE_LICENSE("GPL");
 EXPORT_SYMBOL(ccw_device_set_options_mask);
@@ -655,9 +402,5 @@ EXPORT_SYMBOL(ccw_device_start_timeout_key);
 EXPORT_SYMBOL(ccw_device_start_key);
 EXPORT_SYMBOL(ccw_device_get_ciw);
 EXPORT_SYMBOL(ccw_device_get_path_mask);
-EXPORT_SYMBOL(read_conf_data);
-EXPORT_SYMBOL(read_dev_chars);
 EXPORT_SYMBOL(_ccw_device_get_subchannel_number);
-EXPORT_SYMBOL(_ccw_device_get_device_number);
 EXPORT_SYMBOL_GPL(ccw_device_get_chp_desc);
-EXPORT_SYMBOL_GPL(read_conf_data_lpm);
index ed026a1dc3244e066091571a546b50f168967061..03347aed2b3e65b523486dccbc11a15054e7ab0b 100644 (file)
@@ -81,6 +81,7 @@ static __u32 volatile spare_indicator;
 static atomic_t spare_indicator_usecount;
 #define QDIO_MEMPOOL_SCSSC_ELEMENTS 2
 static mempool_t *qdio_mempool_scssc;
+static struct kmem_cache *qdio_q_cache;
 
 static debug_info_t *qdio_dbf_setup;
 static debug_info_t *qdio_dbf_sbal;
@@ -1617,23 +1618,21 @@ static void
 qdio_release_irq_memory(struct qdio_irq *irq_ptr)
 {
        int i;
+       struct qdio_q *q;
 
-       for (i=0;i<QDIO_MAX_QUEUES_PER_IRQ;i++) {
-               if (!irq_ptr->input_qs[i])
-                       goto next;
-
-               kfree(irq_ptr->input_qs[i]->slib);
-               kfree(irq_ptr->input_qs[i]);
-
-next:
-               if (!irq_ptr->output_qs[i])
-                       continue;
-
-               kfree(irq_ptr->output_qs[i]->slib);
-               kfree(irq_ptr->output_qs[i]);
-
+       for (i = 0; i < QDIO_MAX_QUEUES_PER_IRQ; i++) {
+               q = irq_ptr->input_qs[i];
+               if (q) {
+                       free_page((unsigned long) q->slib);
+                       kmem_cache_free(qdio_q_cache, q);
+               }
+               q = irq_ptr->output_qs[i];
+               if (q) {
+                       free_page((unsigned long) q->slib);
+                       kmem_cache_free(qdio_q_cache, q);
+               }
        }
-       kfree(irq_ptr->qdr);
+       free_page((unsigned long) irq_ptr->qdr);
        free_page((unsigned long) irq_ptr);
 }
 
@@ -1680,44 +1679,35 @@ qdio_alloc_qs(struct qdio_irq *irq_ptr,
 {
        int i;
        struct qdio_q *q;
-       int result=-ENOMEM;
-
-       for (i=0;i<no_input_qs;i++) {
-               q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
 
-               if (!q) {
-                       QDIO_PRINT_ERR("kmalloc of q failed!\n");
-                       goto out;
-               }
+       for (i = 0; i < no_input_qs; i++) {
+               q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
+               if (!q)
+                       return -ENOMEM;
+               memset(q, 0, sizeof(*q));
 
-               q->slib = kmalloc(PAGE_SIZE, GFP_KERNEL);
+               q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
                if (!q->slib) {
-                       QDIO_PRINT_ERR("kmalloc of slib failed!\n");
-                       goto out;
+                       kmem_cache_free(qdio_q_cache, q);
+                       return -ENOMEM;
                }
-
                irq_ptr->input_qs[i]=q;
        }
 
-       for (i=0;i<no_output_qs;i++) {
-               q = kzalloc(sizeof(struct qdio_q), GFP_KERNEL);
-
-               if (!q) {
-                       goto out;
-               }
+       for (i = 0; i < no_output_qs; i++) {
+               q = kmem_cache_alloc(qdio_q_cache, GFP_KERNEL);
+               if (!q)
+                       return -ENOMEM;
+               memset(q, 0, sizeof(*q));
 
-               q->slib=kmalloc(PAGE_SIZE,GFP_KERNEL);
+               q->slib = (struct slib *) __get_free_page(GFP_KERNEL);
                if (!q->slib) {
-                       QDIO_PRINT_ERR("kmalloc of slib failed!\n");
-                       goto out;
+                       kmem_cache_free(qdio_q_cache, q);
+                       return -ENOMEM;
                }
-
                irq_ptr->output_qs[i]=q;
        }
-
-       result=0;
-out:
-       return result;
+       return 0;
 }
 
 static void
@@ -2985,17 +2975,17 @@ qdio_allocate(struct qdio_initialize *init_data)
        QDIO_DBF_HEX0(0,setup,&irq_ptr,sizeof(void*));
 
        if (!irq_ptr) {
-               QDIO_PRINT_ERR("kmalloc of irq_ptr failed!\n");
+               QDIO_PRINT_ERR("allocation of irq_ptr failed!\n");
                return -ENOMEM;
        }
 
        init_MUTEX(&irq_ptr->setting_up_sema);
 
        /* QDR must be in DMA area since CCW data address is only 32 bit */
-       irq_ptr->qdr=kmalloc(sizeof(struct qdr), GFP_KERNEL | GFP_DMA);
+       irq_ptr->qdr = (struct qdr *) __get_free_page(GFP_KERNEL | GFP_DMA);
        if (!(irq_ptr->qdr)) {
                free_page((unsigned long) irq_ptr);
-               QDIO_PRINT_ERR("kmalloc of irq_ptr->qdr failed!\n");
+               QDIO_PRINT_ERR("allocation of irq_ptr->qdr failed!\n");
                return -ENOMEM;
                }
        QDIO_DBF_TEXT0(0,setup,"qdr:");
@@ -3004,6 +2994,7 @@ qdio_allocate(struct qdio_initialize *init_data)
        if (qdio_alloc_qs(irq_ptr,
                                  init_data->no_input_qs,
                          init_data->no_output_qs)) {
+               QDIO_PRINT_ERR("queue allocation failed!\n");
                qdio_release_irq_memory(irq_ptr);
                return -ENOMEM;
        }
@@ -3895,9 +3886,19 @@ init_QDIO(void)
        if (res)
                return res;
 
+       qdio_q_cache = kmem_cache_create("qdio_q", sizeof(struct qdio_q),
+                                        256, 0, NULL);
+       if (!qdio_q_cache) {
+               qdio_release_qdio_memory();
+               return -ENOMEM;
+       }
+
        res = qdio_register_dbf_views();
-       if (res)
+       if (res) {
+               kmem_cache_destroy(qdio_q_cache);
+               qdio_release_qdio_memory();
                return res;
+       }
 
        QDIO_DBF_TEXT0(0,setup,"initQDIO");
        res = bus_create_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
@@ -3929,6 +3930,7 @@ cleanup_QDIO(void)
        qdio_release_qdio_memory();
        qdio_unregister_dbf_views();
        mempool_destroy(qdio_mempool_scssc);
+       kmem_cache_destroy(qdio_q_cache);
        bus_remove_file(&ccw_bus_type, &bus_attr_qdio_performance_stats);
        printk("qdio: %s: module removed\n",version);
 }
index b240800b78d7af56c31dbbf2a187b26506453fd6..99299976e89195288a32768147325b4958e99aea 100644 (file)
@@ -4154,8 +4154,9 @@ zfcp_fsf_send_fcp_command_task_handler(struct zfcp_fsf_req *fsf_req)
                              fcp_rsp_iu->fcp_resid,
                              (int) zfcp_get_fcp_dl(fcp_cmnd_iu));
 
-               scpnt->resid = fcp_rsp_iu->fcp_resid;
-               if (scpnt->request_bufflen - scpnt->resid < scpnt->underflow)
+               scsi_set_resid(scpnt, fcp_rsp_iu->fcp_resid);
+               if (scsi_bufflen(scpnt) - scsi_get_resid(scpnt) <
+                   scpnt->underflow)
                        set_host_byte(&scpnt->result, DID_ERROR);
        }
 
index c408badd2ae966c20917bf286951c3b347efb056..81daa8204bfeeda745cedd8838093b52a40d850e 100644 (file)
@@ -36,8 +36,6 @@ static void zfcp_qdio_sbale_fill
        (struct zfcp_fsf_req *, unsigned long, void *, int);
 static int zfcp_qdio_sbals_from_segment
        (struct zfcp_fsf_req *, unsigned long, void *, unsigned long);
-static int zfcp_qdio_sbals_from_buffer
-       (struct zfcp_fsf_req *, unsigned long, void *, unsigned long, int);
 
 static qdio_handler_t zfcp_qdio_request_handler;
 static qdio_handler_t zfcp_qdio_response_handler;
@@ -631,28 +629,6 @@ out:
 }
 
 
-/**
- * zfcp_qdio_sbals_from_buffer - fill SBALs from buffer
- * @fsf_req: request to be processed
- * @sbtype: SBALE flags
- * @buffer: data buffer
- * @length: length of buffer
- * @max_sbals: upper bound for number of SBALs to be used
- */
-static int
-zfcp_qdio_sbals_from_buffer(struct zfcp_fsf_req *fsf_req, unsigned long sbtype,
-                           void *buffer, unsigned long length, int max_sbals)
-{
-       struct scatterlist sg_segment;
-
-       zfcp_address_to_sg(buffer, &sg_segment);
-       sg_segment.length = length;
-
-       return zfcp_qdio_sbals_from_sg(fsf_req, sbtype, &sg_segment, 1,
-                                       max_sbals);
-}
-
-
 /**
  * zfcp_qdio_sbals_from_scsicmnd - fill SBALs from scsi command
  * @fsf_req: request to be processed
@@ -664,18 +640,13 @@ int
 zfcp_qdio_sbals_from_scsicmnd(struct zfcp_fsf_req *fsf_req,
                              unsigned long sbtype, struct scsi_cmnd *scsi_cmnd)
 {
-       if (scsi_cmnd->use_sg) {
+       if (scsi_sg_count(scsi_cmnd))
                return zfcp_qdio_sbals_from_sg(fsf_req, sbtype,
-                                               (struct scatterlist *)
-                                               scsi_cmnd->request_buffer,
-                                               scsi_cmnd->use_sg,
-                                               ZFCP_MAX_SBALS_PER_REQ);
-       } else {
-                return zfcp_qdio_sbals_from_buffer(fsf_req, sbtype,
-                                                   scsi_cmnd->request_buffer,
-                                                   scsi_cmnd->request_bufflen,
-                                                   ZFCP_MAX_SBALS_PER_REQ);
-       }
+                                              scsi_sglist(scsi_cmnd),
+                                              scsi_sg_count(scsi_cmnd),
+                                              ZFCP_MAX_SBALS_PER_REQ);
+       else
+               return 0;
 }
 
 /**
index e821a155b6588c163041d31a795313ce6158d6c3..0bde26989a23a2ebaf89251414fe58cf384ea84a 100644 (file)
@@ -479,11 +479,12 @@ static int kenvctrld(void *__unused)
 
 static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx)
 {
-       struct bbc_cpu_temperature *tp = kmalloc(sizeof(*tp), GFP_KERNEL);
+       struct bbc_cpu_temperature *tp;
 
+       tp = kzalloc(sizeof(*tp), GFP_KERNEL);
        if (!tp)
                return;
-       memset(tp, 0, sizeof(*tp));
+
        tp->client = bbc_i2c_attach(echild);
        if (!tp->client) {
                kfree(tp);
@@ -525,11 +526,12 @@ static void attach_one_temp(struct linux_ebus_child *echild, int temp_idx)
 
 static void attach_one_fan(struct linux_ebus_child *echild, int fan_idx)
 {
-       struct bbc_fan_control *fp = kmalloc(sizeof(*fp), GFP_KERNEL);
+       struct bbc_fan_control *fp;
 
+       fp = kzalloc(sizeof(*fp), GFP_KERNEL);
        if (!fp)
                return;
-       memset(fp, 0, sizeof(*fp));
+
        fp->client = bbc_i2c_attach(echild);
        if (!fp->client) {
                kfree(fp);
index fbadd4d761f3c98d9f73cd308f097d78f313d62d..ac8ef2ce07fb6ffd4dc5a4672a4f109a4a402554 100644 (file)
@@ -357,13 +357,13 @@ static void __init reset_one_i2c(struct bbc_i2c_bus *bp)
 
 static int __init attach_one_i2c(struct linux_ebus_device *edev, int index)
 {
-       struct bbc_i2c_bus *bp = kmalloc(sizeof(*bp), GFP_KERNEL);
+       struct bbc_i2c_bus *bp;
        struct linux_ebus_child *echild;
        int entry;
 
+       bp = kzalloc(sizeof(*bp), GFP_KERNEL);
        if (!bp)
                return -ENOMEM;
-       memset(bp, 0, sizeof(*bp));
 
        bp->i2c_control_regs = ioremap(edev->resource[0].start, 0x2);
        if (!bp->i2c_control_regs)
index 26b1d2a17ed2f9f3c15bb03d89d8f2e0739fa60c..9269f7fbd36364957f0cdc97a90357f4e987fd1f 100644 (file)
@@ -248,6 +248,7 @@ static int vfc_debug(struct vfc_dev *dev, int cmd, void __user *argp)
                                        buffer,inout.len);
 
                if (copy_to_user(argp,&inout,sizeof(inout))) {
+                       vfc_unlock_device(dev);
                        kfree(buffer);
                        return -EFAULT;
                }
index 2553629ec15db76dc364ec7cee2373783cdfe6e4..c37d7c2587ff923ad0129a3b145f1a542f150ddf 100644 (file)
@@ -210,6 +210,10 @@ static void __init walk_children(struct device_node *dp, struct sbus_dev *parent
 
                        sdev->bus = sbus;
                        sdev->parent = parent;
+                       sdev->ofdev.dev.archdata.iommu =
+                               sbus->ofdev.dev.archdata.iommu;
+                       sdev->ofdev.dev.archdata.stc =
+                               sbus->ofdev.dev.archdata.stc;
 
                        fill_sbus_device(dp, sdev);
 
@@ -269,6 +273,11 @@ static void __init build_one_sbus(struct device_node *dp, int num_sbus)
 
                        sdev->bus = sbus;
                        sdev->parent = NULL;
+                       sdev->ofdev.dev.archdata.iommu =
+                               sbus->ofdev.dev.archdata.iommu;
+                       sdev->ofdev.dev.archdata.stc =
+                               sbus->ofdev.dev.archdata.stc;
+
                        fill_sbus_device(dev_dp, sdev);
 
                        walk_children(dev_dp, sdev, sbus);
index a26baab09dbfb8e7edde8a99c02c8a8f291c17da..6800e578e4b1f82dc2a9b4763588497f2835fe63 100644 (file)
@@ -194,8 +194,7 @@ static inline int aac_valid_context(struct scsi_cmnd *scsicmd,
        struct scsi_device *device;
 
        if (unlikely(!scsicmd || !scsicmd->scsi_done )) {
-               dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"))
-;
+               dprintk((KERN_WARNING "aac_valid_context: scsi command corrupt\n"));
                 aac_fib_complete(fibptr);
                 aac_fib_free(fibptr);
                 return 0;
@@ -1689,23 +1688,23 @@ static void synchronize_callback(void *context, struct fib *fibptr)
        if (!aac_valid_context(cmd, fibptr))
                return;
 
-       dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n", 
+       dprintk((KERN_DEBUG "synchronize_callback[cpu %d]: t = %ld.\n",
                                smp_processor_id(), jiffies));
        BUG_ON(fibptr == NULL);
 
 
        synchronizereply = fib_data(fibptr);
        if (le32_to_cpu(synchronizereply->status) == CT_OK)
-               cmd->result = DID_OK << 16 | 
+               cmd->result = DID_OK << 16 |
                        COMMAND_COMPLETE << 8 | SAM_STAT_GOOD;
        else {
                struct scsi_device *sdev = cmd->device;
                struct aac_dev *dev = fibptr->dev;
                u32 cid = sdev_id(sdev);
-               printk(KERN_WARNING 
+               printk(KERN_WARNING
                     "synchronize_callback: synchronize failed, status = %d\n",
                     le32_to_cpu(synchronizereply->status));
-               cmd->result = DID_OK << 16 | 
+               cmd->result = DID_OK << 16 |
                        COMMAND_COMPLETE << 8 | SAM_STAT_CHECK_CONDITION;
                set_sense((u8 *)&dev->fsa_dev[cid].sense_data,
                                    HARDWARE_ERROR,
@@ -1713,7 +1712,7 @@ static void synchronize_callback(void *context, struct fib *fibptr)
                                    ASENCODE_INTERNAL_TARGET_FAILURE, 0, 0,
                                    0, 0);
                memcpy(cmd->sense_buffer, &dev->fsa_dev[cid].sense_data,
-                 min(sizeof(dev->fsa_dev[cid].sense_data), 
+                 min(sizeof(dev->fsa_dev[cid].sense_data),
                          sizeof(cmd->sense_buffer)));
        }
 
@@ -1731,6 +1730,9 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
        struct scsi_device *sdev = scsicmd->device;
        int active = 0;
        struct aac_dev *aac;
+       u64 lba = ((u64)scsicmd->cmnd[2] << 24) | (scsicmd->cmnd[3] << 16) |
+               (scsicmd->cmnd[4] << 8) | scsicmd->cmnd[5];
+       u32 count = (scsicmd->cmnd[7] << 8) | scsicmd->cmnd[8];
        unsigned long flags;
 
        /*
@@ -1739,7 +1741,51 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
         */
        spin_lock_irqsave(&sdev->list_lock, flags);
        list_for_each_entry(cmd, &sdev->cmd_list, list)
-               if (cmd != scsicmd && cmd->SCp.phase == AAC_OWNER_FIRMWARE) {
+               if (cmd->SCp.phase == AAC_OWNER_FIRMWARE) {
+                       u64 cmnd_lba;
+                       u32 cmnd_count;
+
+                       if (cmd->cmnd[0] == WRITE_6) {
+                               cmnd_lba = ((cmd->cmnd[1] & 0x1F) << 16) |
+                                       (cmd->cmnd[2] << 8) |
+                                       cmd->cmnd[3];
+                               cmnd_count = cmd->cmnd[4];
+                               if (cmnd_count == 0)
+                                       cmnd_count = 256;
+                       } else if (cmd->cmnd[0] == WRITE_16) {
+                               cmnd_lba = ((u64)cmd->cmnd[2] << 56) |
+                                       ((u64)cmd->cmnd[3] << 48) |
+                                       ((u64)cmd->cmnd[4] << 40) |
+                                       ((u64)cmd->cmnd[5] << 32) |
+                                       ((u64)cmd->cmnd[6] << 24) |
+                                       (cmd->cmnd[7] << 16) |
+                                       (cmd->cmnd[8] << 8) |
+                                       cmd->cmnd[9];
+                               cmnd_count = (cmd->cmnd[10] << 24) |
+                                       (cmd->cmnd[11] << 16) |
+                                       (cmd->cmnd[12] << 8) |
+                                       cmd->cmnd[13];
+                       } else if (cmd->cmnd[0] == WRITE_12) {
+                               cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
+                                       (cmd->cmnd[3] << 16) |
+                                       (cmd->cmnd[4] << 8) |
+                                       cmd->cmnd[5];
+                               cmnd_count = (cmd->cmnd[6] << 24) |
+                                       (cmd->cmnd[7] << 16) |
+                                       (cmd->cmnd[8] << 8) |
+                                       cmd->cmnd[9];
+                       } else if (cmd->cmnd[0] == WRITE_10) {
+                               cmnd_lba = ((u64)cmd->cmnd[2] << 24) |
+                                       (cmd->cmnd[3] << 16) |
+                                       (cmd->cmnd[4] << 8) |
+                                       cmd->cmnd[5];
+                               cmnd_count = (cmd->cmnd[7] << 8) |
+                                       cmd->cmnd[8];
+                       } else
+                               continue;
+                       if (((cmnd_lba + cmnd_count) < lba) ||
+                         (count && ((lba + count) < cmnd_lba)))
+                               continue;
                        ++active;
                        break;
                }
@@ -1768,7 +1814,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
        synchronizecmd->command = cpu_to_le32(VM_ContainerConfig);
        synchronizecmd->type = cpu_to_le32(CT_FLUSH_CACHE);
        synchronizecmd->cid = cpu_to_le32(scmd_id(scsicmd));
-       synchronizecmd->count = 
+       synchronizecmd->count =
             cpu_to_le32(sizeof(((struct aac_synchronize_reply *)NULL)->data));
 
        /*
@@ -1790,7 +1836,7 @@ static int aac_synchronize(struct scsi_cmnd *scsicmd)
                return 0;
        }
 
-       printk(KERN_WARNING 
+       printk(KERN_WARNING
                "aac_synchronize: aac_fib_send failed with status: %d.\n", status);
        aac_fib_complete(cmd_fibcontext);
        aac_fib_free(cmd_fibcontext);
index 400d03403cd547d84415d05ebceaa267a2a5b7db..94727b9375ecafde6fc46a74c4b7188bfe63fb2c 100644 (file)
@@ -12,7 +12,7 @@
  *----------------------------------------------------------------------------*/
 
 #ifndef AAC_DRIVER_BUILD
-# define AAC_DRIVER_BUILD 2447
+# define AAC_DRIVER_BUILD 2449
 # define AAC_DRIVER_BRANCH "-ms"
 #endif
 #define MAXIMUM_NUM_CONTAINERS 32
@@ -1807,10 +1807,10 @@ struct aac_aifcmd {
  *     accounting for the fact capacity could be a 64 bit value
  *
  */
-static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
+static inline unsigned int cap_to_cyls(sector_t capacity, unsigned divisor)
 {
        sector_div(capacity, divisor);
-       return (u32)capacity;
+       return capacity;
 }
 
 /* SCp.phase values */
index c709dc8ad99dee8e886d8b1bb4ac81749181733f..a7f42a17b5c708ba331b59874690f8a84cdab920 100644 (file)
@@ -826,7 +826,7 @@ static ssize_t aac_show_reset_adapter(struct class_device *class_dev,
        tmp = aac_adapter_check_health(dev);
        if ((tmp == 0) && dev->in_reset)
                tmp = -EBUSY;
-       len = snprintf(buf, PAGE_SIZE, "0x%x", tmp);
+       len = snprintf(buf, PAGE_SIZE, "0x%x\n", tmp);
        return len;
 }
 
@@ -1110,7 +1110,9 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
        __aac_shutdown(aac);
  out_unmap:
        aac_fib_map_free(aac);
-       pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr, aac->comm_phys);
+       if (aac->comm_addr)
+               pci_free_consistent(aac->pdev, aac->comm_size, aac->comm_addr,
+                 aac->comm_phys);
        kfree(aac->queues);
        aac_adapter_ioremap(aac, 0);
        kfree(aac->fibs);
@@ -1126,9 +1128,8 @@ static int __devinit aac_probe_one(struct pci_dev *pdev,
 static void aac_shutdown(struct pci_dev *dev)
 {
        struct Scsi_Host *shost = pci_get_drvdata(dev);
-       struct aac_dev *aac = (struct aac_dev *)shost->hostdata;
        scsi_block_requests(shost);
-       __aac_shutdown(aac);
+       __aac_shutdown((struct aac_dev *)shost->hostdata);
 }
 
 static void __devexit aac_remove_one(struct pci_dev *pdev)
index a8ace56778137d2548831d253b9e6ee8c572fea8..c55f7c862f0e0889541af9c1825fef78a3179c05 100644 (file)
@@ -1,11 +1,10 @@
 /*
  *     Adaptec AAC series RAID controller driver
- *     (c) Copyright 2001 Red Hat Inc. <alan@redhat.com>
  *
  * based on the old aacraid driver that is..
  * Adaptec aacraid device driver for Linux.
  *
- * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com)
+ * Copyright (c) 2006-2007 Adaptec, Inc. (aacraid@adaptec.com)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index 9c5fcfb398c21052266ed8b57826e6f39e5a4a16..8cd6588a83e3be4c7b81e65af0073b899b3600dd 100644 (file)
@@ -5,7 +5,7 @@
  * based on the old aacraid driver that is..
  * Adaptec aacraid device driver for Linux.
  *
- * Copyright (c) 2000 Adaptec, Inc. (aacraid@adaptec.com)
+ * Copyright (c) 2000-2007 Adaptec, Inc. (aacraid@adaptec.com)
  *
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
index ebc65b9fea92903bd63301626515d97c83a78a5b..73eef3dc5dc629d0056a1e8ba2178a1205bc9f4e 100644 (file)
@@ -472,7 +472,7 @@ static int aac_rx_restart_adapter(struct aac_dev *dev, int bled)
                else {
                        bled = aac_adapter_sync_cmd(dev, IOP_RESET_ALWAYS,
                          0, 0, 0, 0, 0, 0, &var, NULL, NULL, NULL, NULL);
-                       if (!bled && (var != 0x00000001))
+                       if (!bled && (var != 0x00000001) && (var != 0x3803000F))
                                bled = -EINVAL;
                }
                if (bled && (bled != -ETIMEDOUT))
index 2b6689709e53d6dfca3b3062c6ea88ad4db73b3e..79c0b6e37a3b92abe629101857f0364a046acfd6 100644 (file)
@@ -1,4 +1,4 @@
-#define ASC_VERSION "3.3K"    /* AdvanSys Driver Version */
+#define ASC_VERSION "3.3K"     /* AdvanSys Driver Version */
 
 /*
  * advansys.c - Linux Host Driver for AdvanSys SCSI Adapters
 #include <linux/pci.h>
 #endif /* CONFIG_PCI */
 
-
 /*
  * --- Driver Options
  */
 /* Enable driver tracing. */
 /* #define ADVANSYS_DEBUG */
 
-
-/*
- * --- Debugging Header
- */
-
-#ifdef ADVANSYS_DEBUG
-#define STATIC
-#else /* ADVANSYS_DEBUG */
-#define STATIC static
-#endif /* ADVANSYS_DEBUG */
-
-
 /*
  * --- Asc Library Constants and Macros
  */
  * are all consistent at 8, 16, and 32 bits respectively. Pointers
  * and long types are 64 bits on Alpha and UltraSPARC.
  */
-#define ASC_PADDR __u32         /* Physical/Bus address data type. */
-#define ASC_VADDR __u32         /* Virtual address data type. */
-#define ASC_DCNT  __u32         /* Unsigned Data count type. */
-#define ASC_SDCNT __s32         /* Signed Data count type. */
+#define ASC_PADDR __u32                /* Physical/Bus address data type. */
+#define ASC_VADDR __u32                /* Virtual address data type. */
+#define ASC_DCNT  __u32                /* Unsigned Data count type. */
+#define ASC_SDCNT __s32                /* Signed Data count type. */
 
 /*
  * These macros are used to convert a virtual address to a
@@ -911,7 +898,7 @@ typedef unsigned char uchar;
 #define CC_VERY_LONG_SG_LIST 0
 #define ASC_SRB2SCSIQ(srb_ptr)  (srb_ptr)
 
-#define PortAddr                 unsigned short    /* port address size  */
+#define PortAddr                 unsigned short        /* port address size  */
 #define inp(port)                inb(port)
 #define outp(port, byte)         outb((byte), (port))
 
@@ -1038,17 +1025,17 @@ typedef unsigned char uchar;
 #define ASC_INQ_CLOCKING(inq)       (((inq)->info & 0x0c) >> 2)
 
 typedef struct {
-    uchar               periph;
-    uchar               devtype;
-    uchar               ver;
-    uchar               byte3;
-    uchar               add_len;
-    uchar               res1;
-    uchar               res2;
-    uchar               flags;
-    uchar               vendor_id[8];
-    uchar               product_id[16];
-    uchar               product_rev_level[4];
+       uchar periph;
+       uchar devtype;
+       uchar ver;
+       uchar byte3;
+       uchar add_len;
+       uchar res1;
+       uchar res2;
+       uchar flags;
+       uchar vendor_id[8];
+       uchar product_id[16];
+       uchar product_rev_level[4];
 } ASC_SCSI_INQUIRY;
 
 #define ASC_SG_LIST_PER_Q   7
@@ -1165,139 +1152,139 @@ typedef struct {
 #define ASC_QNO_TO_QADDR(q_no)      ((ASC_QADR_BEG)+((int)(q_no) << 6))
 
 typedef struct asc_scsiq_1 {
-    uchar               status;
-    uchar               q_no;
-    uchar               cntl;
-    uchar               sg_queue_cnt;
-    uchar               target_id;
-    uchar               target_lun;
-    ASC_PADDR           data_addr;
-    ASC_DCNT            data_cnt;
-    ASC_PADDR           sense_addr;
-    uchar               sense_len;
-    uchar               extra_bytes;
+       uchar status;
+       uchar q_no;
+       uchar cntl;
+       uchar sg_queue_cnt;
+       uchar target_id;
+       uchar target_lun;
+       ASC_PADDR data_addr;
+       ASC_DCNT data_cnt;
+       ASC_PADDR sense_addr;
+       uchar sense_len;
+       uchar extra_bytes;
 } ASC_SCSIQ_1;
 
 typedef struct asc_scsiq_2 {
-    ASC_VADDR           srb_ptr;
-    uchar               target_ix;
-    uchar               flag;
-    uchar               cdb_len;
-    uchar               tag_code;
-    ushort              vm_id;
+       ASC_VADDR srb_ptr;
+       uchar target_ix;
+       uchar flag;
+       uchar cdb_len;
+       uchar tag_code;
+       ushort vm_id;
 } ASC_SCSIQ_2;
 
 typedef struct asc_scsiq_3 {
-    uchar               done_stat;
-    uchar               host_stat;
-    uchar               scsi_stat;
-    uchar               scsi_msg;
+       uchar done_stat;
+       uchar host_stat;
+       uchar scsi_stat;
+       uchar scsi_msg;
 } ASC_SCSIQ_3;
 
 typedef struct asc_scsiq_4 {
-    uchar               cdb[ASC_MAX_CDB_LEN];
-    uchar               y_first_sg_list_qp;
-    uchar               y_working_sg_qp;
-    uchar               y_working_sg_ix;
-    uchar               y_res;
-    ushort              x_req_count;
-    ushort              x_reconnect_rtn;
-    ASC_PADDR           x_saved_data_addr;
-    ASC_DCNT            x_saved_data_cnt;
+       uchar cdb[ASC_MAX_CDB_LEN];
+       uchar y_first_sg_list_qp;
+       uchar y_working_sg_qp;
+       uchar y_working_sg_ix;
+       uchar y_res;
+       ushort x_req_count;
+       ushort x_reconnect_rtn;
+       ASC_PADDR x_saved_data_addr;
+       ASC_DCNT x_saved_data_cnt;
 } ASC_SCSIQ_4;
 
 typedef struct asc_q_done_info {
-    ASC_SCSIQ_2         d2;
-    ASC_SCSIQ_3         d3;
-    uchar               q_status;
-    uchar               q_no;
-    uchar               cntl;
-    uchar               sense_len;
-    uchar               extra_bytes;
-    uchar               res;
-    ASC_DCNT            remain_bytes;
+       ASC_SCSIQ_2 d2;
+       ASC_SCSIQ_3 d3;
+       uchar q_status;
+       uchar q_no;
+       uchar cntl;
+       uchar sense_len;
+       uchar extra_bytes;
+       uchar res;
+       ASC_DCNT remain_bytes;
 } ASC_QDONE_INFO;
 
 typedef struct asc_sg_list {
-    ASC_PADDR           addr;
-    ASC_DCNT            bytes;
+       ASC_PADDR addr;
+       ASC_DCNT bytes;
 } ASC_SG_LIST;
 
 typedef struct asc_sg_head {
-    ushort              entry_cnt;
-    ushort              queue_cnt;
-    ushort              entry_to_copy;
-    ushort              res;
-    ASC_SG_LIST         sg_list[ASC_MAX_SG_LIST];
+       ushort entry_cnt;
+       ushort queue_cnt;
+       ushort entry_to_copy;
+       ushort res;
+       ASC_SG_LIST sg_list[ASC_MAX_SG_LIST];
 } ASC_SG_HEAD;
 
 #define ASC_MIN_SG_LIST   2
 
 typedef struct asc_min_sg_head {
-    ushort              entry_cnt;
-    ushort              queue_cnt;
-    ushort              entry_to_copy;
-    ushort              res;
-    ASC_SG_LIST         sg_list[ASC_MIN_SG_LIST];
+       ushort entry_cnt;
+       ushort queue_cnt;
+       ushort entry_to_copy;
+       ushort res;
+       ASC_SG_LIST sg_list[ASC_MIN_SG_LIST];
 } ASC_MIN_SG_HEAD;
 
 #define QCX_SORT        (0x0001)
 #define QCX_COALEASE    (0x0002)
 
 typedef struct asc_scsi_q {
-    ASC_SCSIQ_1         q1;
-    ASC_SCSIQ_2         q2;
-    uchar               *cdbptr;
-    ASC_SG_HEAD         *sg_head;
-    ushort              remain_sg_entry_cnt;
-    ushort              next_sg_index;
+       ASC_SCSIQ_1 q1;
+       ASC_SCSIQ_2 q2;
+       uchar *cdbptr;
+       ASC_SG_HEAD *sg_head;
+       ushort remain_sg_entry_cnt;
+       ushort next_sg_index;
 } ASC_SCSI_Q;
 
 typedef struct asc_scsi_req_q {
-    ASC_SCSIQ_1         r1;
-    ASC_SCSIQ_2         r2;
-    uchar               *cdbptr;
-    ASC_SG_HEAD         *sg_head;
-    uchar               *sense_ptr;
-    ASC_SCSIQ_3         r3;
-    uchar               cdb[ASC_MAX_CDB_LEN];
-    uchar               sense[ASC_MIN_SENSE_LEN];
+       ASC_SCSIQ_1 r1;
+       ASC_SCSIQ_2 r2;
+       uchar *cdbptr;
+       ASC_SG_HEAD *sg_head;
+       uchar *sense_ptr;
+       ASC_SCSIQ_3 r3;
+       uchar cdb[ASC_MAX_CDB_LEN];
+       uchar sense[ASC_MIN_SENSE_LEN];
 } ASC_SCSI_REQ_Q;
 
 typedef struct asc_scsi_bios_req_q {
-    ASC_SCSIQ_1         r1;
-    ASC_SCSIQ_2         r2;
-    uchar               *cdbptr;
-    ASC_SG_HEAD         *sg_head;
-    uchar               *sense_ptr;
-    ASC_SCSIQ_3         r3;
-    uchar               cdb[ASC_MAX_CDB_LEN];
-    uchar               sense[ASC_MIN_SENSE_LEN];
+       ASC_SCSIQ_1 r1;
+       ASC_SCSIQ_2 r2;
+       uchar *cdbptr;
+       ASC_SG_HEAD *sg_head;
+       uchar *sense_ptr;
+       ASC_SCSIQ_3 r3;
+       uchar cdb[ASC_MAX_CDB_LEN];
+       uchar sense[ASC_MIN_SENSE_LEN];
 } ASC_SCSI_BIOS_REQ_Q;
 
 typedef struct asc_risc_q {
-    uchar               fwd;
-    uchar               bwd;
-    ASC_SCSIQ_1         i1;
-    ASC_SCSIQ_2         i2;
-    ASC_SCSIQ_3         i3;
-    ASC_SCSIQ_4         i4;
+       uchar fwd;
+       uchar bwd;
+       ASC_SCSIQ_1 i1;
+       ASC_SCSIQ_2 i2;
+       ASC_SCSIQ_3 i3;
+       ASC_SCSIQ_4 i4;
 } ASC_RISC_Q;
 
 typedef struct asc_sg_list_q {
-    uchar               seq_no;
-    uchar               q_no;
-    uchar               cntl;
-    uchar               sg_head_qp;
-    uchar               sg_list_cnt;
-    uchar               sg_cur_list_cnt;
+       uchar seq_no;
+       uchar q_no;
+       uchar cntl;
+       uchar sg_head_qp;
+       uchar sg_list_cnt;
+       uchar sg_cur_list_cnt;
 } ASC_SG_LIST_Q;
 
 typedef struct asc_risc_sg_list_q {
-    uchar               fwd;
-    uchar               bwd;
-    ASC_SG_LIST_Q       sg;
-    ASC_SG_LIST         sg_list[7];
+       uchar fwd;
+       uchar bwd;
+       ASC_SG_LIST_Q sg;
+       ASC_SG_LIST sg_list[7];
 } ASC_RISC_SG_LIST_Q;
 
 #define ASC_EXE_SCSI_IO_MAX_IDLE_LOOP  0x1000000UL
@@ -1431,25 +1418,25 @@ typedef struct asc_risc_sg_list_q {
 #define SYN_ULTRA_XFER_NS_15  107
 
 typedef struct ext_msg {
-    uchar               msg_type;
-    uchar               msg_len;
-    uchar               msg_req;
-    union {
-        struct {
-            uchar               sdtr_xfer_period;
-            uchar               sdtr_req_ack_offset;
-        } sdtr;
-        struct {
-            uchar               wdtr_width;
-        } wdtr;
-        struct {
-            uchar               mdp_b3;
-            uchar               mdp_b2;
-            uchar               mdp_b1;
-            uchar               mdp_b0;
-        } mdp;
-    } u_ext_msg;
-    uchar               res;
+       uchar msg_type;
+       uchar msg_len;
+       uchar msg_req;
+       union {
+               struct {
+                       uchar sdtr_xfer_period;
+                       uchar sdtr_req_ack_offset;
+               } sdtr;
+               struct {
+                       uchar wdtr_width;
+               } wdtr;
+               struct {
+                       uchar mdp_b3;
+                       uchar mdp_b2;
+                       uchar mdp_b1;
+                       uchar mdp_b0;
+               } mdp;
+       } u_ext_msg;
+       uchar res;
 } EXT_MSG;
 
 #define xfer_period     u_ext_msg.sdtr.sdtr_xfer_period
@@ -1461,24 +1448,24 @@ typedef struct ext_msg {
 #define mdp_b0          u_ext_msg.mdp_b0
 
 typedef struct asc_dvc_cfg {
-    ASC_SCSI_BIT_ID_TYPE can_tagged_qng;
-    ASC_SCSI_BIT_ID_TYPE cmd_qng_enabled;
-    ASC_SCSI_BIT_ID_TYPE disc_enable;
-    ASC_SCSI_BIT_ID_TYPE sdtr_enable;
-    uchar               chip_scsi_id;
-    uchar               isa_dma_speed;
-    uchar               isa_dma_channel;
-    uchar               chip_version;
-    ushort              lib_serial_no;
-    ushort              lib_version;
-    ushort              mcode_date;
-    ushort              mcode_version;
-    uchar               max_tag_qng[ASC_MAX_TID + 1];
-    uchar               *overrun_buf;
-    uchar               sdtr_period_offset[ASC_MAX_TID + 1];
-    ushort              pci_slot_info;
-    uchar               adapter_info[6];
-    struct device      *dev;
+       ASC_SCSI_BIT_ID_TYPE can_tagged_qng;
+       ASC_SCSI_BIT_ID_TYPE cmd_qng_enabled;
+       ASC_SCSI_BIT_ID_TYPE disc_enable;
+       ASC_SCSI_BIT_ID_TYPE sdtr_enable;
+       uchar chip_scsi_id;
+       uchar isa_dma_speed;
+       uchar isa_dma_channel;
+       uchar chip_version;
+       ushort lib_serial_no;
+       ushort lib_version;
+       ushort mcode_date;
+       ushort mcode_version;
+       uchar max_tag_qng[ASC_MAX_TID + 1];
+       uchar *overrun_buf;
+       uchar sdtr_period_offset[ASC_MAX_TID + 1];
+       ushort pci_slot_info;
+       uchar adapter_info[6];
+       struct device *dev;
 } ASC_DVC_CFG;
 
 #define ASC_DEF_DVC_CNTL       0xFFFF
@@ -1501,64 +1488,64 @@ typedef struct asc_dvc_cfg {
 #define ASC_MIN_TAGGED_CMD  7
 #define ASC_MAX_SCSI_RESET_WAIT      30
 
-struct asc_dvc_var;     /* Forward Declaration. */
+struct asc_dvc_var;            /* Forward Declaration. */
 
-typedef void (* ASC_ISR_CALLBACK)(struct asc_dvc_var *, ASC_QDONE_INFO *);
-typedef int (* ASC_EXE_CALLBACK)(struct asc_dvc_var *, ASC_SCSI_Q *);
+typedef void (*ASC_ISR_CALLBACK) (struct asc_dvc_var *, ASC_QDONE_INFO *);
+typedef int (*ASC_EXE_CALLBACK) (struct asc_dvc_var *, ASC_SCSI_Q *);
 
 typedef struct asc_dvc_var {
-    PortAddr            iop_base;
-    ushort              err_code;
-    ushort              dvc_cntl;
-    ushort              bug_fix_cntl;
-    ushort              bus_type;
-    ASC_ISR_CALLBACK    isr_callback;
-    ASC_EXE_CALLBACK    exe_callback;
-    ASC_SCSI_BIT_ID_TYPE init_sdtr;
-    ASC_SCSI_BIT_ID_TYPE sdtr_done;
-    ASC_SCSI_BIT_ID_TYPE use_tagged_qng;
-    ASC_SCSI_BIT_ID_TYPE unit_not_ready;
-    ASC_SCSI_BIT_ID_TYPE queue_full_or_busy;
-    ASC_SCSI_BIT_ID_TYPE start_motor;
-    uchar               scsi_reset_wait;
-    uchar               chip_no;
-    char                is_in_int;
-    uchar               max_total_qng;
-    uchar               cur_total_qng;
-    uchar               in_critical_cnt;
-    uchar               irq_no;
-    uchar               last_q_shortage;
-    ushort              init_state;
-    uchar               cur_dvc_qng[ASC_MAX_TID + 1];
-    uchar               max_dvc_qng[ASC_MAX_TID + 1];
-    ASC_SCSI_Q  *scsiq_busy_head[ASC_MAX_TID + 1];
-    ASC_SCSI_Q  *scsiq_busy_tail[ASC_MAX_TID + 1];
-    uchar               sdtr_period_tbl[ASC_MAX_SYN_XFER_NO];
-    ASC_DVC_CFG *cfg;
-    ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer_always;
-    char                redo_scam;
-    ushort              res2;
-    uchar               dos_int13_table[ASC_MAX_TID + 1];
-    ASC_DCNT            max_dma_count;
-    ASC_SCSI_BIT_ID_TYPE no_scam;
-    ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer;
-    uchar               max_sdtr_index;
-    uchar               host_init_sdtr_index;
-    struct asc_board    *drv_ptr;
-    ASC_DCNT            uc_break;
+       PortAddr iop_base;
+       ushort err_code;
+       ushort dvc_cntl;
+       ushort bug_fix_cntl;
+       ushort bus_type;
+       ASC_ISR_CALLBACK isr_callback;
+       ASC_EXE_CALLBACK exe_callback;
+       ASC_SCSI_BIT_ID_TYPE init_sdtr;
+       ASC_SCSI_BIT_ID_TYPE sdtr_done;
+       ASC_SCSI_BIT_ID_TYPE use_tagged_qng;
+       ASC_SCSI_BIT_ID_TYPE unit_not_ready;
+       ASC_SCSI_BIT_ID_TYPE queue_full_or_busy;
+       ASC_SCSI_BIT_ID_TYPE start_motor;
+       uchar scsi_reset_wait;
+       uchar chip_no;
+       char is_in_int;
+       uchar max_total_qng;
+       uchar cur_total_qng;
+       uchar in_critical_cnt;
+       uchar irq_no;
+       uchar last_q_shortage;
+       ushort init_state;
+       uchar cur_dvc_qng[ASC_MAX_TID + 1];
+       uchar max_dvc_qng[ASC_MAX_TID + 1];
+       ASC_SCSI_Q *scsiq_busy_head[ASC_MAX_TID + 1];
+       ASC_SCSI_Q *scsiq_busy_tail[ASC_MAX_TID + 1];
+       uchar sdtr_period_tbl[ASC_MAX_SYN_XFER_NO];
+       ASC_DVC_CFG *cfg;
+       ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer_always;
+       char redo_scam;
+       ushort res2;
+       uchar dos_int13_table[ASC_MAX_TID + 1];
+       ASC_DCNT max_dma_count;
+       ASC_SCSI_BIT_ID_TYPE no_scam;
+       ASC_SCSI_BIT_ID_TYPE pci_fix_asyn_xfer;
+       uchar max_sdtr_index;
+       uchar host_init_sdtr_index;
+       struct asc_board *drv_ptr;
+       ASC_DCNT uc_break;
 } ASC_DVC_VAR;
 
 typedef struct asc_dvc_inq_info {
-    uchar               type[ASC_MAX_TID + 1][ASC_MAX_LUN + 1];
+       uchar type[ASC_MAX_TID + 1][ASC_MAX_LUN + 1];
 } ASC_DVC_INQ_INFO;
 
 typedef struct asc_cap_info {
-    ASC_DCNT            lba;
-    ASC_DCNT            blk_size;
+       ASC_DCNT lba;
+       ASC_DCNT blk_size;
 } ASC_CAP_INFO;
 
 typedef struct asc_cap_info_array {
-    ASC_CAP_INFO        cap_info[ASC_MAX_TID + 1][ASC_MAX_LUN + 1];
+       ASC_CAP_INFO cap_info[ASC_MAX_TID + 1][ASC_MAX_LUN + 1];
 } ASC_CAP_INFO_ARRAY;
 
 #define ASC_MCNTL_NO_SEL_TIMEOUT  (ushort)0x0001
@@ -1603,23 +1590,23 @@ typedef struct asc_cap_info_array {
    ((cfg)->id_speed = ((cfg)->id_speed & 0x0f) | ((spd) & 0x0f) << 4)
 
 typedef struct asceep_config {
-    ushort              cfg_lsw;
-    ushort              cfg_msw;
-    uchar               init_sdtr;
-    uchar               disc_enable;
-    uchar               use_cmd_qng;
-    uchar               start_motor;
-    uchar               max_total_qng;
-    uchar               max_tag_qng;
-    uchar               bios_scan;
-    uchar               power_up_wait;
-    uchar               no_scam;
-    uchar               id_speed; /* low order 4 bits is chip scsi id */
-                                  /* high order 4 bits is isa dma speed */
-    uchar               dos_int13_table[ASC_MAX_TID + 1];
-    uchar               adapter_info[6];
-    ushort              cntl;
-    ushort              chksum;
+       ushort cfg_lsw;
+       ushort cfg_msw;
+       uchar init_sdtr;
+       uchar disc_enable;
+       uchar use_cmd_qng;
+       uchar start_motor;
+       uchar max_total_qng;
+       uchar max_tag_qng;
+       uchar bios_scan;
+       uchar power_up_wait;
+       uchar no_scam;
+       uchar id_speed;         /* low order 4 bits is chip scsi id */
+       /* high order 4 bits is isa dma speed */
+       uchar dos_int13_table[ASC_MAX_TID + 1];
+       uchar adapter_info[6];
+       ushort cntl;
+       ushort chksum;
 } ASCEEP_CONFIG;
 
 #define ASC_PCI_CFG_LSW_SCSI_PARITY  0x0800
@@ -1827,8 +1814,8 @@ typedef struct asceep_config {
 #define ASC_MC_SAVE_DATA_WSIZE  0x40
 
 typedef struct asc_mc_saved {
-    ushort              data[ASC_MC_SAVE_DATA_WSIZE];
-    ushort              code[ASC_MC_SAVE_CODE_WSIZE];
+       ushort data[ASC_MC_SAVE_DATA_WSIZE];
+       ushort code[ASC_MC_SAVE_CODE_WSIZE];
 } ASC_MC_SAVED;
 
 #define AscGetQDoneInProgress(port)         AscReadLramByte((port), ASCV_Q_DONE_IN_PROGRESS_B)
@@ -1900,120 +1887,113 @@ typedef struct asc_mc_saved {
 #define AscReadChipDvcID(port)            (uchar)inp((port)+IOP_REG_ID)
 #define AscWriteChipDvcID(port, data)     outp((port)+IOP_REG_ID, data)
 
-STATIC int       AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg);
-STATIC int       AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg);
-STATIC void      AscWaitEEPRead(void);
-STATIC void      AscWaitEEPWrite(void);
-STATIC ushort    AscReadEEPWord(PortAddr, uchar);
-STATIC ushort    AscWriteEEPWord(PortAddr, uchar, ushort);
-STATIC ushort    AscGetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort);
-STATIC int       AscSetEEPConfigOnce(PortAddr, ASCEEP_CONFIG *, ushort);
-STATIC int       AscSetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort);
-STATIC int       AscStartChip(PortAddr);
-STATIC int       AscStopChip(PortAddr);
-STATIC void      AscSetChipIH(PortAddr, ushort);
-STATIC int       AscIsChipHalted(PortAddr);
-STATIC void      AscAckInterrupt(PortAddr);
-STATIC void      AscDisableInterrupt(PortAddr);
-STATIC void      AscEnableInterrupt(PortAddr);
-STATIC void      AscSetBank(PortAddr, uchar);
-STATIC int       AscResetChipAndScsiBus(ASC_DVC_VAR *);
+static int AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg);
+static int AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg);
+static void AscWaitEEPRead(void);
+static void AscWaitEEPWrite(void);
+static ushort AscReadEEPWord(PortAddr, uchar);
+static ushort AscWriteEEPWord(PortAddr, uchar, ushort);
+static ushort AscGetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort);
+static int AscSetEEPConfigOnce(PortAddr, ASCEEP_CONFIG *, ushort);
+static int AscSetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort);
+static int AscStartChip(PortAddr);
+static int AscStopChip(PortAddr);
+static void AscSetChipIH(PortAddr, ushort);
+static int AscIsChipHalted(PortAddr);
+static void AscAckInterrupt(PortAddr);
+static void AscDisableInterrupt(PortAddr);
+static void AscEnableInterrupt(PortAddr);
+static void AscSetBank(PortAddr, uchar);
+static int AscResetChipAndScsiBus(ASC_DVC_VAR *);
 #ifdef CONFIG_ISA
-STATIC ushort    AscGetIsaDmaChannel(PortAddr);
-STATIC ushort    AscSetIsaDmaChannel(PortAddr, ushort);
-STATIC uchar     AscSetIsaDmaSpeed(PortAddr, uchar);
-STATIC uchar     AscGetIsaDmaSpeed(PortAddr);
+static ushort AscGetIsaDmaChannel(PortAddr);
+static ushort AscSetIsaDmaChannel(PortAddr, ushort);
+static uchar AscSetIsaDmaSpeed(PortAddr, uchar);
+static uchar AscGetIsaDmaSpeed(PortAddr);
 #endif /* CONFIG_ISA */
-STATIC uchar     AscReadLramByte(PortAddr, ushort);
-STATIC ushort    AscReadLramWord(PortAddr, ushort);
+static uchar AscReadLramByte(PortAddr, ushort);
+static ushort AscReadLramWord(PortAddr, ushort);
 #if CC_VERY_LONG_SG_LIST
-STATIC ASC_DCNT  AscReadLramDWord(PortAddr, ushort);
+static ASC_DCNT AscReadLramDWord(PortAddr, ushort);
 #endif /* CC_VERY_LONG_SG_LIST */
-STATIC void      AscWriteLramWord(PortAddr, ushort, ushort);
-STATIC void      AscWriteLramByte(PortAddr, ushort, uchar);
-STATIC ASC_DCNT  AscMemSumLramWord(PortAddr, ushort, int);
-STATIC void      AscMemWordSetLram(PortAddr, ushort, ushort, int);
-STATIC void      AscMemWordCopyPtrToLram(PortAddr, ushort, uchar *, int);
-STATIC void      AscMemDWordCopyPtrToLram(PortAddr, ushort, uchar *, int);
-STATIC void      AscMemWordCopyPtrFromLram(PortAddr, ushort, uchar *, int);
-STATIC ushort    AscInitAscDvcVar(ASC_DVC_VAR *);
-STATIC ushort    AscInitFromEEP(ASC_DVC_VAR *);
-STATIC ushort    AscInitFromAscDvcVar(ASC_DVC_VAR *);
-STATIC ushort    AscInitMicroCodeVar(ASC_DVC_VAR *);
-STATIC int       AscTestExternalLram(ASC_DVC_VAR *);
-STATIC uchar     AscMsgOutSDTR(ASC_DVC_VAR *, uchar, uchar);
-STATIC uchar     AscCalSDTRData(ASC_DVC_VAR *, uchar, uchar);
-STATIC void      AscSetChipSDTR(PortAddr, uchar, uchar);
-STATIC uchar     AscGetSynPeriodIndex(ASC_DVC_VAR *, uchar);
-STATIC uchar     AscAllocFreeQueue(PortAddr, uchar);
-STATIC uchar     AscAllocMultipleFreeQueue(PortAddr, uchar, uchar);
-STATIC int       AscHostReqRiscHalt(PortAddr);
-STATIC int       AscStopQueueExe(PortAddr);
-STATIC int       AscSendScsiQueue(ASC_DVC_VAR *,
-                    ASC_SCSI_Q * scsiq,
-                    uchar n_q_required);
-STATIC int       AscPutReadyQueue(ASC_DVC_VAR *,
-                    ASC_SCSI_Q *, uchar);
-STATIC int       AscPutReadySgListQueue(ASC_DVC_VAR *,
-                    ASC_SCSI_Q *, uchar);
-STATIC int       AscSetChipSynRegAtID(PortAddr, uchar, uchar);
-STATIC int       AscSetRunChipSynRegAtID(PortAddr, uchar, uchar);
-STATIC ushort    AscInitLram(ASC_DVC_VAR *);
-STATIC ushort    AscInitQLinkVar(ASC_DVC_VAR *);
-STATIC int       AscSetLibErrorCode(ASC_DVC_VAR *, ushort);
-STATIC int       AscIsrChipHalted(ASC_DVC_VAR *);
-STATIC uchar     _AscCopyLramScsiDoneQ(PortAddr, ushort,
-                    ASC_QDONE_INFO *, ASC_DCNT);
-STATIC int       AscIsrQDone(ASC_DVC_VAR *);
-STATIC int       AscCompareString(uchar *, uchar *, int);
+static void AscWriteLramWord(PortAddr, ushort, ushort);
+static void AscWriteLramByte(PortAddr, ushort, uchar);
+static ASC_DCNT AscMemSumLramWord(PortAddr, ushort, int);
+static void AscMemWordSetLram(PortAddr, ushort, ushort, int);
+static void AscMemWordCopyPtrToLram(PortAddr, ushort, uchar *, int);
+static void AscMemDWordCopyPtrToLram(PortAddr, ushort, uchar *, int);
+static void AscMemWordCopyPtrFromLram(PortAddr, ushort, uchar *, int);
+static ushort AscInitAscDvcVar(ASC_DVC_VAR *);
+static ushort AscInitFromEEP(ASC_DVC_VAR *);
+static ushort AscInitFromAscDvcVar(ASC_DVC_VAR *);
+static ushort AscInitMicroCodeVar(ASC_DVC_VAR *);
+static int AscTestExternalLram(ASC_DVC_VAR *);
+static uchar AscMsgOutSDTR(ASC_DVC_VAR *, uchar, uchar);
+static uchar AscCalSDTRData(ASC_DVC_VAR *, uchar, uchar);
+static void AscSetChipSDTR(PortAddr, uchar, uchar);
+static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *, uchar);
+static uchar AscAllocFreeQueue(PortAddr, uchar);
+static uchar AscAllocMultipleFreeQueue(PortAddr, uchar, uchar);
+static int AscHostReqRiscHalt(PortAddr);
+static int AscStopQueueExe(PortAddr);
+static int AscSendScsiQueue(ASC_DVC_VAR *,
+                           ASC_SCSI_Q *scsiq, uchar n_q_required);
+static int AscPutReadyQueue(ASC_DVC_VAR *, ASC_SCSI_Q *, uchar);
+static int AscPutReadySgListQueue(ASC_DVC_VAR *, ASC_SCSI_Q *, uchar);
+static int AscSetChipSynRegAtID(PortAddr, uchar, uchar);
+static int AscSetRunChipSynRegAtID(PortAddr, uchar, uchar);
+static ushort AscInitLram(ASC_DVC_VAR *);
+static ushort AscInitQLinkVar(ASC_DVC_VAR *);
+static int AscSetLibErrorCode(ASC_DVC_VAR *, ushort);
+static int AscIsrChipHalted(ASC_DVC_VAR *);
+static uchar _AscCopyLramScsiDoneQ(PortAddr, ushort,
+                                  ASC_QDONE_INFO *, ASC_DCNT);
+static int AscIsrQDone(ASC_DVC_VAR *);
+static int AscCompareString(uchar *, uchar *, int);
 #ifdef CONFIG_ISA
-STATIC ushort    AscGetEisaChipCfg(PortAddr);
-STATIC ASC_DCNT  AscGetEisaProductID(PortAddr);
-STATIC PortAddr  AscSearchIOPortAddrEISA(PortAddr);
-STATIC PortAddr  AscSearchIOPortAddr11(PortAddr);
-STATIC PortAddr  AscSearchIOPortAddr(PortAddr, ushort);
-STATIC void      AscSetISAPNPWaitForKey(void);
+static ushort AscGetEisaChipCfg(PortAddr);
+static ASC_DCNT AscGetEisaProductID(PortAddr);
+static PortAddr AscSearchIOPortAddrEISA(PortAddr);
+static PortAddr AscSearchIOPortAddr11(PortAddr);
+static PortAddr AscSearchIOPortAddr(PortAddr, ushort);
+static void AscSetISAPNPWaitForKey(void);
 #endif /* CONFIG_ISA */
-STATIC uchar     AscGetChipScsiCtrl(PortAddr);
-STATIC uchar     AscSetChipScsiID(PortAddr, uchar);
-STATIC uchar     AscGetChipVersion(PortAddr, ushort);
-STATIC ushort    AscGetChipBusType(PortAddr);
-STATIC ASC_DCNT  AscLoadMicroCode(PortAddr, ushort, uchar *, ushort);
-STATIC int       AscFindSignature(PortAddr);
-STATIC void      AscToggleIRQAct(PortAddr);
-STATIC uchar     AscGetChipIRQ(PortAddr, ushort);
-STATIC uchar     AscSetChipIRQ(PortAddr, uchar, ushort);
-STATIC ushort    AscGetChipBiosAddress(PortAddr, ushort);
-STATIC inline ulong DvcEnterCritical(void);
-STATIC inline void DvcLeaveCritical(ulong);
+static uchar AscGetChipScsiCtrl(PortAddr);
+static uchar AscSetChipScsiID(PortAddr, uchar);
+static uchar AscGetChipVersion(PortAddr, ushort);
+static ushort AscGetChipBusType(PortAddr);
+static ASC_DCNT AscLoadMicroCode(PortAddr, ushort, uchar *, ushort);
+static int AscFindSignature(PortAddr);
+static void AscToggleIRQAct(PortAddr);
+static uchar AscGetChipIRQ(PortAddr, ushort);
+static uchar AscSetChipIRQ(PortAddr, uchar, ushort);
+static ushort AscGetChipBiosAddress(PortAddr, ushort);
+static inline ulong DvcEnterCritical(void);
+static inline void DvcLeaveCritical(ulong);
 #ifdef CONFIG_PCI
-STATIC uchar     DvcReadPCIConfigByte(ASC_DVC_VAR *, ushort);
-STATIC void      DvcWritePCIConfigByte(ASC_DVC_VAR *,
-                    ushort, uchar);
+static uchar DvcReadPCIConfigByte(ASC_DVC_VAR *, ushort);
+static void DvcWritePCIConfigByte(ASC_DVC_VAR *, ushort, uchar);
 #endif /* CONFIG_PCI */
-STATIC ushort      AscGetChipBiosAddress(PortAddr, ushort);
-STATIC void      DvcSleepMilliSecond(ASC_DCNT);
-STATIC void      DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT);
-STATIC void      DvcPutScsiQ(PortAddr, ushort, uchar *, int);
-STATIC void      DvcGetQinfo(PortAddr, ushort, uchar *, int);
-STATIC ushort    AscInitGetConfig(ASC_DVC_VAR *);
-STATIC ushort    AscInitSetConfig(ASC_DVC_VAR *);
-STATIC ushort    AscInitAsc1000Driver(ASC_DVC_VAR *);
-STATIC void      AscAsyncFix(ASC_DVC_VAR *, uchar,
-                    ASC_SCSI_INQUIRY *);
-STATIC int       AscTagQueuingSafe(ASC_SCSI_INQUIRY *);
-STATIC void      AscInquiryHandling(ASC_DVC_VAR *,
-                    uchar, ASC_SCSI_INQUIRY *);
-STATIC int       AscExeScsiQueue(ASC_DVC_VAR *, ASC_SCSI_Q *);
-STATIC int       AscISR(ASC_DVC_VAR *);
-STATIC uint      AscGetNumOfFreeQueue(ASC_DVC_VAR *, uchar,
-                    uchar);
-STATIC int       AscSgListToQueue(int);
+static ushort AscGetChipBiosAddress(PortAddr, ushort);
+static void DvcSleepMilliSecond(ASC_DCNT);
+static void DvcDelayNanoSecond(ASC_DVC_VAR *, ASC_DCNT);
+static void DvcPutScsiQ(PortAddr, ushort, uchar *, int);
+static void DvcGetQinfo(PortAddr, ushort, uchar *, int);
+static ushort AscInitGetConfig(ASC_DVC_VAR *);
+static ushort AscInitSetConfig(ASC_DVC_VAR *);
+static ushort AscInitAsc1000Driver(ASC_DVC_VAR *);
+static void AscAsyncFix(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *);
+static int AscTagQueuingSafe(ASC_SCSI_INQUIRY *);
+static void AscInquiryHandling(ASC_DVC_VAR *, uchar, ASC_SCSI_INQUIRY *);
+static int AscExeScsiQueue(ASC_DVC_VAR *, ASC_SCSI_Q *);
+static int AscISR(ASC_DVC_VAR *);
+static uint AscGetNumOfFreeQueue(ASC_DVC_VAR *, uchar, uchar);
+static int AscSgListToQueue(int);
 #ifdef CONFIG_ISA
-STATIC void      AscEnableIsaDma(uchar);
+static void AscEnableIsaDma(uchar);
 #endif /* CONFIG_ISA */
-STATIC ASC_DCNT  AscGetMaxDmaCount(ushort);
-static const char *advansys_info(struct Scsi_Host *shp);
+static ASC_DCNT AscGetMaxDmaCount(ushort);
+static const char *advansys_info(struct Scsi_Host *shost);
 
 /*
  * --- Adv Library Constants and Macros
@@ -2035,10 +2015,10 @@ static const char *advansys_info(struct Scsi_Host *shp);
  * are all consistent at 8, 16, and 32 bits respectively. Pointers
  * and long types are 64 bits on Alpha and UltraSPARC.
  */
-#define ADV_PADDR __u32         /* Physical address data type. */
-#define ADV_VADDR __u32         /* Virtual address data type. */
-#define ADV_DCNT  __u32         /* Unsigned Data count type. */
-#define ADV_SDCNT __s32         /* Signed Data count type. */
+#define ADV_PADDR __u32                /* Physical address data type. */
+#define ADV_VADDR __u32                /* Virtual address data type. */
+#define ADV_DCNT  __u32                /* Unsigned Data count type. */
+#define ADV_SDCNT __s32                /* Signed Data count type. */
 
 /*
  * These macros are used to convert a virtual address to a
@@ -2051,7 +2031,7 @@ static const char *advansys_info(struct Scsi_Host *shp);
 #define ADV_VADDR_TO_U32   virt_to_bus
 #define ADV_U32_TO_VADDR   bus_to_virt
 
-#define AdvPortAddr  void __iomem *     /* Virtual memory address size */
+#define AdvPortAddr  void __iomem *    /* Virtual memory address size */
 
 /*
  * Define Adv Library required memory access macros.
@@ -2103,20 +2083,20 @@ static const char *advansys_info(struct Scsi_Host *shp);
 
 #define ADV_EEP_DVC_CFG_BEGIN           (0x00)
 #define ADV_EEP_DVC_CFG_END             (0x15)
-#define ADV_EEP_DVC_CTL_BEGIN           (0x16)  /* location of OEM name */
+#define ADV_EEP_DVC_CTL_BEGIN           (0x16) /* location of OEM name */
 #define ADV_EEP_MAX_WORD_ADDR           (0x1E)
 
 #define ADV_EEP_DELAY_MS                100
 
-#define ADV_EEPROM_BIG_ENDIAN          0x8000   /* EEPROM Bit 15 */
-#define ADV_EEPROM_BIOS_ENABLE         0x4000   /* EEPROM Bit 14 */
+#define ADV_EEPROM_BIG_ENDIAN          0x8000  /* EEPROM Bit 15 */
+#define ADV_EEPROM_BIOS_ENABLE         0x4000  /* EEPROM Bit 14 */
 /*
  * For the ASC3550 Bit 13 is Termination Polarity control bit.
  * For later ICs Bit 13 controls whether the CIS (Card Information
  * Service Section) is loaded from EEPROM.
  */
-#define ADV_EEPROM_TERM_POL            0x2000   /* EEPROM Bit 13 */
-#define ADV_EEPROM_CIS_LD              0x2000   /* EEPROM Bit 13 */
+#define ADV_EEPROM_TERM_POL            0x2000  /* EEPROM Bit 13 */
+#define ADV_EEPROM_CIS_LD              0x2000  /* EEPROM Bit 13 */
 /*
  * ASC38C1600 Bit 11
  *
@@ -2128,280 +2108,277 @@ static const char *advansys_info(struct Scsi_Host *shp);
  * INT B in the PCI Configuration Space Int Pin field. If it is 1, then
  * Function 1 will specify INT A.
  */
-#define ADV_EEPROM_INTAB               0x0800   /* EEPROM Bit 11 */
-
-typedef struct adveep_3550_config
-{
-                                /* Word Offset, Description */
-
-  ushort cfg_lsw;               /* 00 power up initialization */
-                                /*  bit 13 set - Term Polarity Control */
-                                /*  bit 14 set - BIOS Enable */
-                                /*  bit 15 set - Big Endian Mode */
-  ushort cfg_msw;               /* 01 unused      */
-  ushort disc_enable;           /* 02 disconnect enable */
-  ushort wdtr_able;             /* 03 Wide DTR able */
-  ushort sdtr_able;             /* 04 Synchronous DTR able */
-  ushort start_motor;           /* 05 send start up motor */
-  ushort tagqng_able;           /* 06 tag queuing able */
-  ushort bios_scan;             /* 07 BIOS device control */
-  ushort scam_tolerant;         /* 08 no scam */
-
-  uchar  adapter_scsi_id;       /* 09 Host Adapter ID */
-  uchar  bios_boot_delay;       /*    power up wait */
-
-  uchar  scsi_reset_delay;      /* 10 reset delay */
-  uchar  bios_id_lun;           /*    first boot device scsi id & lun */
-                                /*    high nibble is lun */
-                                /*    low nibble is scsi id */
-
-  uchar  termination;           /* 11 0 - automatic */
-                                /*    1 - low off / high off */
-                                /*    2 - low off / high on */
-                                /*    3 - low on  / high on */
-                                /*    There is no low on  / high off */
-
-  uchar  reserved1;             /*    reserved byte (not used) */
-
-  ushort bios_ctrl;             /* 12 BIOS control bits */
-                                /*  bit 0  BIOS don't act as initiator. */
-                                /*  bit 1  BIOS > 1 GB support */
-                                /*  bit 2  BIOS > 2 Disk Support */
-                                /*  bit 3  BIOS don't support removables */
-                                /*  bit 4  BIOS support bootable CD */
-                                /*  bit 5  BIOS scan enabled */
-                                /*  bit 6  BIOS support multiple LUNs */
-                                /*  bit 7  BIOS display of message */
-                                /*  bit 8  SCAM disabled */
-                                /*  bit 9  Reset SCSI bus during init. */
-                                /*  bit 10 */
-                                /*  bit 11 No verbose initialization. */
-                                /*  bit 12 SCSI parity enabled */
-                                /*  bit 13 */
-                                /*  bit 14 */
-                                /*  bit 15 */
-  ushort  ultra_able;           /* 13 ULTRA speed able */
-  ushort  reserved2;            /* 14 reserved */
-  uchar   max_host_qng;         /* 15 maximum host queuing */
-  uchar   max_dvc_qng;          /*    maximum per device queuing */
-  ushort  dvc_cntl;             /* 16 control bit for driver */
-  ushort  bug_fix;              /* 17 control bit for bug fix */
-  ushort  serial_number_word1;  /* 18 Board serial number word 1 */
-  ushort  serial_number_word2;  /* 19 Board serial number word 2 */
-  ushort  serial_number_word3;  /* 20 Board serial number word 3 */
-  ushort  check_sum;            /* 21 EEP check sum */
-  uchar   oem_name[16];         /* 22 OEM name */
-  ushort  dvc_err_code;         /* 30 last device driver error code */
-  ushort  adv_err_code;         /* 31 last uc and Adv Lib error code */
-  ushort  adv_err_addr;         /* 32 last uc error address */
-  ushort  saved_dvc_err_code;   /* 33 saved last dev. driver error code   */
-  ushort  saved_adv_err_code;   /* 34 saved last uc and Adv Lib error code */
-  ushort  saved_adv_err_addr;   /* 35 saved last uc error address         */
-  ushort  num_of_err;           /* 36 number of error */
+#define ADV_EEPROM_INTAB               0x0800  /* EEPROM Bit 11 */
+
+typedef struct adveep_3550_config {
+       /* Word Offset, Description */
+
+       ushort cfg_lsw;         /* 00 power up initialization */
+       /*  bit 13 set - Term Polarity Control */
+       /*  bit 14 set - BIOS Enable */
+       /*  bit 15 set - Big Endian Mode */
+       ushort cfg_msw;         /* 01 unused      */
+       ushort disc_enable;     /* 02 disconnect enable */
+       ushort wdtr_able;       /* 03 Wide DTR able */
+       ushort sdtr_able;       /* 04 Synchronous DTR able */
+       ushort start_motor;     /* 05 send start up motor */
+       ushort tagqng_able;     /* 06 tag queuing able */
+       ushort bios_scan;       /* 07 BIOS device control */
+       ushort scam_tolerant;   /* 08 no scam */
+
+       uchar adapter_scsi_id;  /* 09 Host Adapter ID */
+       uchar bios_boot_delay;  /*    power up wait */
+
+       uchar scsi_reset_delay; /* 10 reset delay */
+       uchar bios_id_lun;      /*    first boot device scsi id & lun */
+       /*    high nibble is lun */
+       /*    low nibble is scsi id */
+
+       uchar termination;      /* 11 0 - automatic */
+       /*    1 - low off / high off */
+       /*    2 - low off / high on */
+       /*    3 - low on  / high on */
+       /*    There is no low on  / high off */
+
+       uchar reserved1;        /*    reserved byte (not used) */
+
+       ushort bios_ctrl;       /* 12 BIOS control bits */
+       /*  bit 0  BIOS don't act as initiator. */
+       /*  bit 1  BIOS > 1 GB support */
+       /*  bit 2  BIOS > 2 Disk Support */
+       /*  bit 3  BIOS don't support removables */
+       /*  bit 4  BIOS support bootable CD */
+       /*  bit 5  BIOS scan enabled */
+       /*  bit 6  BIOS support multiple LUNs */
+       /*  bit 7  BIOS display of message */
+       /*  bit 8  SCAM disabled */
+       /*  bit 9  Reset SCSI bus during init. */
+       /*  bit 10 */
+       /*  bit 11 No verbose initialization. */
+       /*  bit 12 SCSI parity enabled */
+       /*  bit 13 */
+       /*  bit 14 */
+       /*  bit 15 */
+       ushort ultra_able;      /* 13 ULTRA speed able */
+       ushort reserved2;       /* 14 reserved */
+       uchar max_host_qng;     /* 15 maximum host queuing */
+       uchar max_dvc_qng;      /*    maximum per device queuing */
+       ushort dvc_cntl;        /* 16 control bit for driver */
+       ushort bug_fix;         /* 17 control bit for bug fix */
+       ushort serial_number_word1;     /* 18 Board serial number word 1 */
+       ushort serial_number_word2;     /* 19 Board serial number word 2 */
+       ushort serial_number_word3;     /* 20 Board serial number word 3 */
+       ushort check_sum;       /* 21 EEP check sum */
+       uchar oem_name[16];     /* 22 OEM name */
+       ushort dvc_err_code;    /* 30 last device driver error code */
+       ushort adv_err_code;    /* 31 last uc and Adv Lib error code */
+       ushort adv_err_addr;    /* 32 last uc error address */
+       ushort saved_dvc_err_code;      /* 33 saved last dev. driver error code   */
+       ushort saved_adv_err_code;      /* 34 saved last uc and Adv Lib error code */
+       ushort saved_adv_err_addr;      /* 35 saved last uc error address         */
+       ushort num_of_err;      /* 36 number of error */
 } ADVEEP_3550_CONFIG;
 
-typedef struct adveep_38C0800_config
-{
-                                /* Word Offset, Description */
-
-  ushort cfg_lsw;               /* 00 power up initialization */
-                                /*  bit 13 set - Load CIS */
-                                /*  bit 14 set - BIOS Enable */
-                                /*  bit 15 set - Big Endian Mode */
-  ushort cfg_msw;               /* 01 unused      */
-  ushort disc_enable;           /* 02 disconnect enable */
-  ushort wdtr_able;             /* 03 Wide DTR able */
-  ushort sdtr_speed1;           /* 04 SDTR Speed TID 0-3 */
-  ushort start_motor;           /* 05 send start up motor */
-  ushort tagqng_able;           /* 06 tag queuing able */
-  ushort bios_scan;             /* 07 BIOS device control */
-  ushort scam_tolerant;         /* 08 no scam */
-
-  uchar  adapter_scsi_id;       /* 09 Host Adapter ID */
-  uchar  bios_boot_delay;       /*    power up wait */
-
-  uchar  scsi_reset_delay;      /* 10 reset delay */
-  uchar  bios_id_lun;           /*    first boot device scsi id & lun */
-                                /*    high nibble is lun */
-                                /*    low nibble is scsi id */
-
-  uchar  termination_se;        /* 11 0 - automatic */
-                                /*    1 - low off / high off */
-                                /*    2 - low off / high on */
-                                /*    3 - low on  / high on */
-                                /*    There is no low on  / high off */
-
-  uchar  termination_lvd;       /* 11 0 - automatic */
-                                /*    1 - low off / high off */
-                                /*    2 - low off / high on */
-                                /*    3 - low on  / high on */
-                                /*    There is no low on  / high off */
-
-  ushort bios_ctrl;             /* 12 BIOS control bits */
-                                /*  bit 0  BIOS don't act as initiator. */
-                                /*  bit 1  BIOS > 1 GB support */
-                                /*  bit 2  BIOS > 2 Disk Support */
-                                /*  bit 3  BIOS don't support removables */
-                                /*  bit 4  BIOS support bootable CD */
-                                /*  bit 5  BIOS scan enabled */
-                                /*  bit 6  BIOS support multiple LUNs */
-                                /*  bit 7  BIOS display of message */
-                                /*  bit 8  SCAM disabled */
-                                /*  bit 9  Reset SCSI bus during init. */
-                                /*  bit 10 */
-                                /*  bit 11 No verbose initialization. */
-                                /*  bit 12 SCSI parity enabled */
-                                /*  bit 13 */
-                                /*  bit 14 */
-                                /*  bit 15 */
-  ushort  sdtr_speed2;          /* 13 SDTR speed TID 4-7 */
-  ushort  sdtr_speed3;          /* 14 SDTR speed TID 8-11 */
-  uchar   max_host_qng;         /* 15 maximum host queueing */
-  uchar   max_dvc_qng;          /*    maximum per device queuing */
-  ushort  dvc_cntl;             /* 16 control bit for driver */
-  ushort  sdtr_speed4;          /* 17 SDTR speed 4 TID 12-15 */
-  ushort  serial_number_word1;  /* 18 Board serial number word 1 */
-  ushort  serial_number_word2;  /* 19 Board serial number word 2 */
-  ushort  serial_number_word3;  /* 20 Board serial number word 3 */
-  ushort  check_sum;            /* 21 EEP check sum */
-  uchar   oem_name[16];         /* 22 OEM name */
-  ushort  dvc_err_code;         /* 30 last device driver error code */
-  ushort  adv_err_code;         /* 31 last uc and Adv Lib error code */
-  ushort  adv_err_addr;         /* 32 last uc error address */
-  ushort  saved_dvc_err_code;   /* 33 saved last dev. driver error code   */
-  ushort  saved_adv_err_code;   /* 34 saved last uc and Adv Lib error code */
-  ushort  saved_adv_err_addr;   /* 35 saved last uc error address         */
-  ushort  reserved36;           /* 36 reserved */
-  ushort  reserved37;           /* 37 reserved */
-  ushort  reserved38;           /* 38 reserved */
-  ushort  reserved39;           /* 39 reserved */
-  ushort  reserved40;           /* 40 reserved */
-  ushort  reserved41;           /* 41 reserved */
-  ushort  reserved42;           /* 42 reserved */
-  ushort  reserved43;           /* 43 reserved */
-  ushort  reserved44;           /* 44 reserved */
-  ushort  reserved45;           /* 45 reserved */
-  ushort  reserved46;           /* 46 reserved */
-  ushort  reserved47;           /* 47 reserved */
-  ushort  reserved48;           /* 48 reserved */
-  ushort  reserved49;           /* 49 reserved */
-  ushort  reserved50;           /* 50 reserved */
-  ushort  reserved51;           /* 51 reserved */
-  ushort  reserved52;           /* 52 reserved */
-  ushort  reserved53;           /* 53 reserved */
-  ushort  reserved54;           /* 54 reserved */
-  ushort  reserved55;           /* 55 reserved */
-  ushort  cisptr_lsw;           /* 56 CIS PTR LSW */
-  ushort  cisprt_msw;           /* 57 CIS PTR MSW */
-  ushort  subsysvid;            /* 58 SubSystem Vendor ID */
-  ushort  subsysid;             /* 59 SubSystem ID */
-  ushort  reserved60;           /* 60 reserved */
-  ushort  reserved61;           /* 61 reserved */
-  ushort  reserved62;           /* 62 reserved */
-  ushort  reserved63;           /* 63 reserved */
+typedef struct adveep_38C0800_config {
+       /* Word Offset, Description */
+
+       ushort cfg_lsw;         /* 00 power up initialization */
+       /*  bit 13 set - Load CIS */
+       /*  bit 14 set - BIOS Enable */
+       /*  bit 15 set - Big Endian Mode */
+       ushort cfg_msw;         /* 01 unused      */
+       ushort disc_enable;     /* 02 disconnect enable */
+       ushort wdtr_able;       /* 03 Wide DTR able */
+       ushort sdtr_speed1;     /* 04 SDTR Speed TID 0-3 */
+       ushort start_motor;     /* 05 send start up motor */
+       ushort tagqng_able;     /* 06 tag queuing able */
+       ushort bios_scan;       /* 07 BIOS device control */
+       ushort scam_tolerant;   /* 08 no scam */
+
+       uchar adapter_scsi_id;  /* 09 Host Adapter ID */
+       uchar bios_boot_delay;  /*    power up wait */
+
+       uchar scsi_reset_delay; /* 10 reset delay */
+       uchar bios_id_lun;      /*    first boot device scsi id & lun */
+       /*    high nibble is lun */
+       /*    low nibble is scsi id */
+
+       uchar termination_se;   /* 11 0 - automatic */
+       /*    1 - low off / high off */
+       /*    2 - low off / high on */
+       /*    3 - low on  / high on */
+       /*    There is no low on  / high off */
+
+       uchar termination_lvd;  /* 11 0 - automatic */
+       /*    1 - low off / high off */
+       /*    2 - low off / high on */
+       /*    3 - low on  / high on */
+       /*    There is no low on  / high off */
+
+       ushort bios_ctrl;       /* 12 BIOS control bits */
+       /*  bit 0  BIOS don't act as initiator. */
+       /*  bit 1  BIOS > 1 GB support */
+       /*  bit 2  BIOS > 2 Disk Support */
+       /*  bit 3  BIOS don't support removables */
+       /*  bit 4  BIOS support bootable CD */
+       /*  bit 5  BIOS scan enabled */
+       /*  bit 6  BIOS support multiple LUNs */
+       /*  bit 7  BIOS display of message */
+       /*  bit 8  SCAM disabled */
+       /*  bit 9  Reset SCSI bus during init. */
+       /*  bit 10 */
+       /*  bit 11 No verbose initialization. */
+       /*  bit 12 SCSI parity enabled */
+       /*  bit 13 */
+       /*  bit 14 */
+       /*  bit 15 */
+       ushort sdtr_speed2;     /* 13 SDTR speed TID 4-7 */
+       ushort sdtr_speed3;     /* 14 SDTR speed TID 8-11 */
+       uchar max_host_qng;     /* 15 maximum host queueing */
+       uchar max_dvc_qng;      /*    maximum per device queuing */
+       ushort dvc_cntl;        /* 16 control bit for driver */
+       ushort sdtr_speed4;     /* 17 SDTR speed 4 TID 12-15 */
+       ushort serial_number_word1;     /* 18 Board serial number word 1 */
+       ushort serial_number_word2;     /* 19 Board serial number word 2 */
+       ushort serial_number_word3;     /* 20 Board serial number word 3 */
+       ushort check_sum;       /* 21 EEP check sum */
+       uchar oem_name[16];     /* 22 OEM name */
+       ushort dvc_err_code;    /* 30 last device driver error code */
+       ushort adv_err_code;    /* 31 last uc and Adv Lib error code */
+       ushort adv_err_addr;    /* 32 last uc error address */
+       ushort saved_dvc_err_code;      /* 33 saved last dev. driver error code   */
+       ushort saved_adv_err_code;      /* 34 saved last uc and Adv Lib error code */
+       ushort saved_adv_err_addr;      /* 35 saved last uc error address         */
+       ushort reserved36;      /* 36 reserved */
+       ushort reserved37;      /* 37 reserved */
+       ushort reserved38;      /* 38 reserved */
+       ushort reserved39;      /* 39 reserved */
+       ushort reserved40;      /* 40 reserved */
+       ushort reserved41;      /* 41 reserved */
+       ushort reserved42;      /* 42 reserved */
+       ushort reserved43;      /* 43 reserved */
+       ushort reserved44;      /* 44 reserved */
+       ushort reserved45;      /* 45 reserved */
+       ushort reserved46;      /* 46 reserved */
+       ushort reserved47;      /* 47 reserved */
+       ushort reserved48;      /* 48 reserved */
+       ushort reserved49;      /* 49 reserved */
+       ushort reserved50;      /* 50 reserved */
+       ushort reserved51;      /* 51 reserved */
+       ushort reserved52;      /* 52 reserved */
+       ushort reserved53;      /* 53 reserved */
+       ushort reserved54;      /* 54 reserved */
+       ushort reserved55;      /* 55 reserved */
+       ushort cisptr_lsw;      /* 56 CIS PTR LSW */
+       ushort cisprt_msw;      /* 57 CIS PTR MSW */
+       ushort subsysvid;       /* 58 SubSystem Vendor ID */
+       ushort subsysid;        /* 59 SubSystem ID */
+       ushort reserved60;      /* 60 reserved */
+       ushort reserved61;      /* 61 reserved */
+       ushort reserved62;      /* 62 reserved */
+       ushort reserved63;      /* 63 reserved */
 } ADVEEP_38C0800_CONFIG;
 
-typedef struct adveep_38C1600_config
-{
-                                /* Word Offset, Description */
-
-  ushort cfg_lsw;               /* 00 power up initialization */
-                                /*  bit 11 set - Func. 0 INTB, Func. 1 INTA */
-                                /*       clear - Func. 0 INTA, Func. 1 INTB */
-                                /*  bit 13 set - Load CIS */
-                                /*  bit 14 set - BIOS Enable */
-                                /*  bit 15 set - Big Endian Mode */
-  ushort cfg_msw;               /* 01 unused */
-  ushort disc_enable;           /* 02 disconnect enable */
-  ushort wdtr_able;             /* 03 Wide DTR able */
-  ushort sdtr_speed1;           /* 04 SDTR Speed TID 0-3 */
-  ushort start_motor;           /* 05 send start up motor */
-  ushort tagqng_able;           /* 06 tag queuing able */
-  ushort bios_scan;             /* 07 BIOS device control */
-  ushort scam_tolerant;         /* 08 no scam */
-
-  uchar  adapter_scsi_id;       /* 09 Host Adapter ID */
-  uchar  bios_boot_delay;       /*    power up wait */
-
-  uchar  scsi_reset_delay;      /* 10 reset delay */
-  uchar  bios_id_lun;           /*    first boot device scsi id & lun */
-                                /*    high nibble is lun */
-                                /*    low nibble is scsi id */
-
-  uchar  termination_se;        /* 11 0 - automatic */
-                                /*    1 - low off / high off */
-                                /*    2 - low off / high on */
-                                /*    3 - low on  / high on */
-                                /*    There is no low on  / high off */
-
-  uchar  termination_lvd;       /* 11 0 - automatic */
-                                /*    1 - low off / high off */
-                                /*    2 - low off / high on */
-                                /*    3 - low on  / high on */
-                                /*    There is no low on  / high off */
-
-  ushort bios_ctrl;             /* 12 BIOS control bits */
-                                /*  bit 0  BIOS don't act as initiator. */
-                                /*  bit 1  BIOS > 1 GB support */
-                                /*  bit 2  BIOS > 2 Disk Support */
-                                /*  bit 3  BIOS don't support removables */
-                                /*  bit 4  BIOS support bootable CD */
-                                /*  bit 5  BIOS scan enabled */
-                                /*  bit 6  BIOS support multiple LUNs */
-                                /*  bit 7  BIOS display of message */
-                                /*  bit 8  SCAM disabled */
-                                /*  bit 9  Reset SCSI bus during init. */
-                                /*  bit 10 Basic Integrity Checking disabled */
-                                /*  bit 11 No verbose initialization. */
-                                /*  bit 12 SCSI parity enabled */
-                                /*  bit 13 AIPP (Asyn. Info. Ph. Prot.) dis. */
-                                /*  bit 14 */
-                                /*  bit 15 */
-  ushort  sdtr_speed2;          /* 13 SDTR speed TID 4-7 */
-  ushort  sdtr_speed3;          /* 14 SDTR speed TID 8-11 */
-  uchar   max_host_qng;         /* 15 maximum host queueing */
-  uchar   max_dvc_qng;          /*    maximum per device queuing */
-  ushort  dvc_cntl;             /* 16 control bit for driver */
-  ushort  sdtr_speed4;          /* 17 SDTR speed 4 TID 12-15 */
-  ushort  serial_number_word1;  /* 18 Board serial number word 1 */
-  ushort  serial_number_word2;  /* 19 Board serial number word 2 */
-  ushort  serial_number_word3;  /* 20 Board serial number word 3 */
-  ushort  check_sum;            /* 21 EEP check sum */
-  uchar   oem_name[16];         /* 22 OEM name */
-  ushort  dvc_err_code;         /* 30 last device driver error code */
-  ushort  adv_err_code;         /* 31 last uc and Adv Lib error code */
-  ushort  adv_err_addr;         /* 32 last uc error address */
-  ushort  saved_dvc_err_code;   /* 33 saved last dev. driver error code   */
-  ushort  saved_adv_err_code;   /* 34 saved last uc and Adv Lib error code */
-  ushort  saved_adv_err_addr;   /* 35 saved last uc error address         */
-  ushort  reserved36;           /* 36 reserved */
-  ushort  reserved37;           /* 37 reserved */
-  ushort  reserved38;           /* 38 reserved */
-  ushort  reserved39;           /* 39 reserved */
-  ushort  reserved40;           /* 40 reserved */
-  ushort  reserved41;           /* 41 reserved */
-  ushort  reserved42;           /* 42 reserved */
-  ushort  reserved43;           /* 43 reserved */
-  ushort  reserved44;           /* 44 reserved */
-  ushort  reserved45;           /* 45 reserved */
-  ushort  reserved46;           /* 46 reserved */
-  ushort  reserved47;           /* 47 reserved */
-  ushort  reserved48;           /* 48 reserved */
-  ushort  reserved49;           /* 49 reserved */
-  ushort  reserved50;           /* 50 reserved */
-  ushort  reserved51;           /* 51 reserved */
-  ushort  reserved52;           /* 52 reserved */
-  ushort  reserved53;           /* 53 reserved */
-  ushort  reserved54;           /* 54 reserved */
-  ushort  reserved55;           /* 55 reserved */
-  ushort  cisptr_lsw;           /* 56 CIS PTR LSW */
-  ushort  cisprt_msw;           /* 57 CIS PTR MSW */
-  ushort  subsysvid;            /* 58 SubSystem Vendor ID */
-  ushort  subsysid;             /* 59 SubSystem ID */
-  ushort  reserved60;           /* 60 reserved */
-  ushort  reserved61;           /* 61 reserved */
-  ushort  reserved62;           /* 62 reserved */
-  ushort  reserved63;           /* 63 reserved */
+typedef struct adveep_38C1600_config {
+       /* Word Offset, Description */
+
+       ushort cfg_lsw;         /* 00 power up initialization */
+       /*  bit 11 set - Func. 0 INTB, Func. 1 INTA */
+       /*       clear - Func. 0 INTA, Func. 1 INTB */
+       /*  bit 13 set - Load CIS */
+       /*  bit 14 set - BIOS Enable */
+       /*  bit 15 set - Big Endian Mode */
+       ushort cfg_msw;         /* 01 unused */
+       ushort disc_enable;     /* 02 disconnect enable */
+       ushort wdtr_able;       /* 03 Wide DTR able */
+       ushort sdtr_speed1;     /* 04 SDTR Speed TID 0-3 */
+       ushort start_motor;     /* 05 send start up motor */
+       ushort tagqng_able;     /* 06 tag queuing able */
+       ushort bios_scan;       /* 07 BIOS device control */
+       ushort scam_tolerant;   /* 08 no scam */
+
+       uchar adapter_scsi_id;  /* 09 Host Adapter ID */
+       uchar bios_boot_delay;  /*    power up wait */
+
+       uchar scsi_reset_delay; /* 10 reset delay */
+       uchar bios_id_lun;      /*    first boot device scsi id & lun */
+       /*    high nibble is lun */
+       /*    low nibble is scsi id */
+
+       uchar termination_se;   /* 11 0 - automatic */
+       /*    1 - low off / high off */
+       /*    2 - low off / high on */
+       /*    3 - low on  / high on */
+       /*    There is no low on  / high off */
+
+       uchar termination_lvd;  /* 11 0 - automatic */
+       /*    1 - low off / high off */
+       /*    2 - low off / high on */
+       /*    3 - low on  / high on */
+       /*    There is no low on  / high off */
+
+       ushort bios_ctrl;       /* 12 BIOS control bits */
+       /*  bit 0  BIOS don't act as initiator. */
+       /*  bit 1  BIOS > 1 GB support */
+       /*  bit 2  BIOS > 2 Disk Support */
+       /*  bit 3  BIOS don't support removables */
+       /*  bit 4  BIOS support bootable CD */
+       /*  bit 5  BIOS scan enabled */
+       /*  bit 6  BIOS support multiple LUNs */
+       /*  bit 7  BIOS display of message */
+       /*  bit 8  SCAM disabled */
+       /*  bit 9  Reset SCSI bus during init. */
+       /*  bit 10 Basic Integrity Checking disabled */
+       /*  bit 11 No verbose initialization. */
+       /*  bit 12 SCSI parity enabled */
+       /*  bit 13 AIPP (Asyn. Info. Ph. Prot.) dis. */
+       /*  bit 14 */
+       /*  bit 15 */
+       ushort sdtr_speed2;     /* 13 SDTR speed TID 4-7 */
+       ushort sdtr_speed3;     /* 14 SDTR speed TID 8-11 */
+       uchar max_host_qng;     /* 15 maximum host queueing */
+       uchar max_dvc_qng;      /*    maximum per device queuing */
+       ushort dvc_cntl;        /* 16 control bit for driver */
+       ushort sdtr_speed4;     /* 17 SDTR speed 4 TID 12-15 */
+       ushort serial_number_word1;     /* 18 Board serial number word 1 */
+       ushort serial_number_word2;     /* 19 Board serial number word 2 */
+       ushort serial_number_word3;     /* 20 Board serial number word 3 */
+       ushort check_sum;       /* 21 EEP check sum */
+       uchar oem_name[16];     /* 22 OEM name */
+       ushort dvc_err_code;    /* 30 last device driver error code */
+       ushort adv_err_code;    /* 31 last uc and Adv Lib error code */
+       ushort adv_err_addr;    /* 32 last uc error address */
+       ushort saved_dvc_err_code;      /* 33 saved last dev. driver error code   */
+       ushort saved_adv_err_code;      /* 34 saved last uc and Adv Lib error code */
+       ushort saved_adv_err_addr;      /* 35 saved last uc error address         */
+       ushort reserved36;      /* 36 reserved */
+       ushort reserved37;      /* 37 reserved */
+       ushort reserved38;      /* 38 reserved */
+       ushort reserved39;      /* 39 reserved */
+       ushort reserved40;      /* 40 reserved */
+       ushort reserved41;      /* 41 reserved */
+       ushort reserved42;      /* 42 reserved */
+       ushort reserved43;      /* 43 reserved */
+       ushort reserved44;      /* 44 reserved */
+       ushort reserved45;      /* 45 reserved */
+       ushort reserved46;      /* 46 reserved */
+       ushort reserved47;      /* 47 reserved */
+       ushort reserved48;      /* 48 reserved */
+       ushort reserved49;      /* 49 reserved */
+       ushort reserved50;      /* 50 reserved */
+       ushort reserved51;      /* 51 reserved */
+       ushort reserved52;      /* 52 reserved */
+       ushort reserved53;      /* 53 reserved */
+       ushort reserved54;      /* 54 reserved */
+       ushort reserved55;      /* 55 reserved */
+       ushort cisptr_lsw;      /* 56 CIS PTR LSW */
+       ushort cisprt_msw;      /* 57 CIS PTR MSW */
+       ushort subsysvid;       /* 58 SubSystem Vendor ID */
+       ushort subsysid;        /* 59 SubSystem ID */
+       ushort reserved60;      /* 60 reserved */
+       ushort reserved61;      /* 61 reserved */
+       ushort reserved62;      /* 62 reserved */
+       ushort reserved63;      /* 63 reserved */
 } ADVEEP_38C1600_CONFIG;
 
 /*
@@ -2427,11 +2404,11 @@ typedef struct adveep_38C1600_config
 #define BIOS_CTRL_SCSI_PARITY        0x1000
 #define BIOS_CTRL_AIPP_DIS           0x2000
 
-#define ADV_3550_MEMSIZE   0x2000       /* 8 KB Internal Memory */
-#define ADV_3550_IOLEN     0x40         /* I/O Port Range in bytes */
+#define ADV_3550_MEMSIZE   0x2000      /* 8 KB Internal Memory */
+#define ADV_3550_IOLEN     0x40        /* I/O Port Range in bytes */
 
-#define ADV_38C0800_MEMSIZE  0x4000     /* 16 KB Internal Memory */
-#define ADV_38C0800_IOLEN    0x100      /* I/O Port Range in bytes */
+#define ADV_38C0800_MEMSIZE  0x4000    /* 16 KB Internal Memory */
+#define ADV_38C0800_IOLEN    0x100     /* I/O Port Range in bytes */
 
 /*
  * XXX - Since ASC38C1600 Rev.3 has a local RAM failure issue, there is
@@ -2440,9 +2417,9 @@ typedef struct adveep_38C1600_config
  *
  * #define ADV_38C1600_MEMSIZE  0x8000L   * 32 KB Internal Memory *
  */
-#define ADV_38C1600_MEMSIZE  0x4000   /* 16 KB Internal Memory */
-#define ADV_38C1600_IOLEN    0x100     /* I/O Port Range 256 bytes */
-#define ADV_38C1600_MEMLEN   0x1000    /* Memory Range 4KB bytes */
+#define ADV_38C1600_MEMSIZE  0x4000    /* 16 KB Internal Memory */
+#define ADV_38C1600_IOLEN    0x100     /* I/O Port Range 256 bytes */
+#define ADV_38C1600_MEMLEN   0x1000    /* Memory Range 4KB bytes */
 
 /*
  * Byte I/O register address from base of 'iop_base'.
@@ -2515,39 +2492,39 @@ typedef struct adveep_38C1600_config
 /*
  * Word I/O register address from base of 'iop_base'.
  */
-#define IOPW_CHIP_ID_0          0x00  /* CID0  */
-#define IOPW_CTRL_REG           0x02  /* CC    */
-#define IOPW_RAM_ADDR           0x04  /* LA    */
-#define IOPW_RAM_DATA           0x06  /* LD    */
+#define IOPW_CHIP_ID_0          0x00   /* CID0  */
+#define IOPW_CTRL_REG           0x02   /* CC    */
+#define IOPW_RAM_ADDR           0x04   /* LA    */
+#define IOPW_RAM_DATA           0x06   /* LD    */
 #define IOPW_RES_ADDR_08        0x08
-#define IOPW_RISC_CSR           0x0A  /* CSR   */
-#define IOPW_SCSI_CFG0          0x0C  /* CFG0  */
-#define IOPW_SCSI_CFG1          0x0E  /* CFG1  */
+#define IOPW_RISC_CSR           0x0A   /* CSR   */
+#define IOPW_SCSI_CFG0          0x0C   /* CFG0  */
+#define IOPW_SCSI_CFG1          0x0E   /* CFG1  */
 #define IOPW_RES_ADDR_10        0x10
-#define IOPW_SEL_MASK           0x12  /* SM    */
+#define IOPW_SEL_MASK           0x12   /* SM    */
 #define IOPW_RES_ADDR_14        0x14
-#define IOPW_FLASH_ADDR         0x16  /* FA    */
+#define IOPW_FLASH_ADDR         0x16   /* FA    */
 #define IOPW_RES_ADDR_18        0x18
-#define IOPW_EE_CMD             0x1A  /* EC    */
-#define IOPW_EE_DATA            0x1C  /* ED    */
-#define IOPW_SFIFO_CNT          0x1E  /* SFC   */
+#define IOPW_EE_CMD             0x1A   /* EC    */
+#define IOPW_EE_DATA            0x1C   /* ED    */
+#define IOPW_SFIFO_CNT          0x1E   /* SFC   */
 #define IOPW_RES_ADDR_20        0x20
-#define IOPW_Q_BASE             0x22  /* QB    */
-#define IOPW_QP                 0x24  /* QP    */
-#define IOPW_IX                 0x26  /* IX    */
-#define IOPW_SP                 0x28  /* SP    */
-#define IOPW_PC                 0x2A  /* PC    */
+#define IOPW_Q_BASE             0x22   /* QB    */
+#define IOPW_QP                 0x24   /* QP    */
+#define IOPW_IX                 0x26   /* IX    */
+#define IOPW_SP                 0x28   /* SP    */
+#define IOPW_PC                 0x2A   /* PC    */
 #define IOPW_RES_ADDR_2C        0x2C
 #define IOPW_RES_ADDR_2E        0x2E
-#define IOPW_SCSI_DATA          0x30  /* SD    */
-#define IOPW_SCSI_DATA_HSHK     0x32  /* SDH   */
-#define IOPW_SCSI_CTRL          0x34  /* SC    */
-#define IOPW_HSHK_CFG           0x36  /* HCFG  */
-#define IOPW_SXFR_STATUS        0x36  /* SXS   */
-#define IOPW_SXFR_CNTL          0x38  /* SXL   */
-#define IOPW_SXFR_CNTH          0x3A  /* SXH   */
+#define IOPW_SCSI_DATA          0x30   /* SD    */
+#define IOPW_SCSI_DATA_HSHK     0x32   /* SDH   */
+#define IOPW_SCSI_CTRL          0x34   /* SC    */
+#define IOPW_HSHK_CFG           0x36   /* HCFG  */
+#define IOPW_SXFR_STATUS        0x36   /* SXS   */
+#define IOPW_SXFR_CNTL          0x38   /* SXL   */
+#define IOPW_SXFR_CNTH          0x3A   /* SXH   */
 #define IOPW_RES_ADDR_3C        0x3C
-#define IOPW_RFIFO_DATA         0x3E  /* RFD   */
+#define IOPW_RFIFO_DATA         0x3E   /* RFD   */
 
 /*
  * Doubleword I/O register address from base of 'iop_base'.
@@ -2621,36 +2598,36 @@ typedef struct adveep_38C1600_config
 /*
  * SCSI_CFG0 Register bit definitions
  */
-#define TIMER_MODEAB    0xC000  /* Watchdog, Second, and Select. Timer Ctrl. */
-#define PARITY_EN       0x2000  /* Enable SCSI Parity Error detection */
-#define EVEN_PARITY     0x1000  /* Select Even Parity */
-#define WD_LONG         0x0800  /* Watchdog Interval, 1: 57 min, 0: 13 sec */
-#define QUEUE_128       0x0400  /* Queue Size, 1: 128 byte, 0: 64 byte */
-#define PRIM_MODE       0x0100  /* Primitive SCSI mode */
-#define SCAM_EN         0x0080  /* Enable SCAM selection */
-#define SEL_TMO_LONG    0x0040  /* Sel/Resel Timeout, 1: 400 ms, 0: 1.6 ms */
-#define CFRM_ID         0x0020  /* SCAM id sel. confirm., 1: fast, 0: 6.4 ms */
-#define OUR_ID_EN       0x0010  /* Enable OUR_ID bits */
-#define OUR_ID          0x000F  /* SCSI ID */
+#define TIMER_MODEAB    0xC000 /* Watchdog, Second, and Select. Timer Ctrl. */
+#define PARITY_EN       0x2000 /* Enable SCSI Parity Error detection */
+#define EVEN_PARITY     0x1000 /* Select Even Parity */
+#define WD_LONG         0x0800 /* Watchdog Interval, 1: 57 min, 0: 13 sec */
+#define QUEUE_128       0x0400 /* Queue Size, 1: 128 byte, 0: 64 byte */
+#define PRIM_MODE       0x0100 /* Primitive SCSI mode */
+#define SCAM_EN         0x0080 /* Enable SCAM selection */
+#define SEL_TMO_LONG    0x0040 /* Sel/Resel Timeout, 1: 400 ms, 0: 1.6 ms */
+#define CFRM_ID         0x0020 /* SCAM id sel. confirm., 1: fast, 0: 6.4 ms */
+#define OUR_ID_EN       0x0010 /* Enable OUR_ID bits */
+#define OUR_ID          0x000F /* SCSI ID */
 
 /*
  * SCSI_CFG1 Register bit definitions
  */
-#define BIG_ENDIAN      0x8000  /* Enable Big Endian Mode MIO:15, EEP:15 */
-#define TERM_POL        0x2000  /* Terminator Polarity Ctrl. MIO:13, EEP:13 */
-#define SLEW_RATE       0x1000  /* SCSI output buffer slew rate */
-#define FILTER_SEL      0x0C00  /* Filter Period Selection */
-#define  FLTR_DISABLE    0x0000  /* Input Filtering Disabled */
-#define  FLTR_11_TO_20NS 0x0800  /* Input Filtering 11ns to 20ns */
-#define  FLTR_21_TO_39NS 0x0C00  /* Input Filtering 21ns to 39ns */
-#define ACTIVE_DBL      0x0200  /* Disable Active Negation */
-#define DIFF_MODE       0x0100  /* SCSI differential Mode (Read-Only) */
-#define DIFF_SENSE      0x0080  /* 1: No SE cables, 0: SE cable (Read-Only) */
-#define TERM_CTL_SEL    0x0040  /* Enable TERM_CTL_H and TERM_CTL_L */
-#define TERM_CTL        0x0030  /* External SCSI Termination Bits */
-#define  TERM_CTL_H      0x0020  /* Enable External SCSI Upper Termination */
-#define  TERM_CTL_L      0x0010  /* Enable External SCSI Lower Termination */
-#define CABLE_DETECT    0x000F  /* External SCSI Cable Connection Status */
+#define BIG_ENDIAN      0x8000 /* Enable Big Endian Mode MIO:15, EEP:15 */
+#define TERM_POL        0x2000 /* Terminator Polarity Ctrl. MIO:13, EEP:13 */
+#define SLEW_RATE       0x1000 /* SCSI output buffer slew rate */
+#define FILTER_SEL      0x0C00 /* Filter Period Selection */
+#define  FLTR_DISABLE    0x0000        /* Input Filtering Disabled */
+#define  FLTR_11_TO_20NS 0x0800        /* Input Filtering 11ns to 20ns */
+#define  FLTR_21_TO_39NS 0x0C00        /* Input Filtering 21ns to 39ns */
+#define ACTIVE_DBL      0x0200 /* Disable Active Negation */
+#define DIFF_MODE       0x0100 /* SCSI differential Mode (Read-Only) */
+#define DIFF_SENSE      0x0080 /* 1: No SE cables, 0: SE cable (Read-Only) */
+#define TERM_CTL_SEL    0x0040 /* Enable TERM_CTL_H and TERM_CTL_L */
+#define TERM_CTL        0x0030 /* External SCSI Termination Bits */
+#define  TERM_CTL_H      0x0020        /* Enable External SCSI Upper Termination */
+#define  TERM_CTL_L      0x0010        /* Enable External SCSI Lower Termination */
+#define CABLE_DETECT    0x000F /* External SCSI Cable Connection Status */
 
 /*
  * Addendum for ASC-38C0800 Chip
@@ -2663,24 +2640,23 @@ typedef struct adveep_38C1600_config
  * Also each ASC-38C1600 function or channel uses only cable bits [5:4]
  * and [1:0]. Bits [14], [7:6], [3:2] are unused.
  */
-#define DIS_TERM_DRV    0x4000  /* 1: Read c_det[3:0], 0: cannot read */
-#define HVD_LVD_SE      0x1C00  /* Device Detect Bits */
-#define  HVD             0x1000  /* HVD Device Detect */
-#define  LVD             0x0800  /* LVD Device Detect */
-#define  SE              0x0400  /* SE Device Detect */
-#define TERM_LVD        0x00C0  /* LVD Termination Bits */
-#define  TERM_LVD_HI     0x0080  /* Enable LVD Upper Termination */
-#define  TERM_LVD_LO     0x0040  /* Enable LVD Lower Termination */
-#define TERM_SE         0x0030  /* SE Termination Bits */
-#define  TERM_SE_HI      0x0020  /* Enable SE Upper Termination */
-#define  TERM_SE_LO      0x0010  /* Enable SE Lower Termination */
-#define C_DET_LVD       0x000C  /* LVD Cable Detect Bits */
-#define  C_DET3          0x0008  /* Cable Detect for LVD External Wide */
-#define  C_DET2          0x0004  /* Cable Detect for LVD Internal Wide */
-#define C_DET_SE        0x0003  /* SE Cable Detect Bits */
-#define  C_DET1          0x0002  /* Cable Detect for SE Internal Wide */
-#define  C_DET0          0x0001  /* Cable Detect for SE Internal Narrow */
-
+#define DIS_TERM_DRV    0x4000 /* 1: Read c_det[3:0], 0: cannot read */
+#define HVD_LVD_SE      0x1C00 /* Device Detect Bits */
+#define  HVD             0x1000        /* HVD Device Detect */
+#define  LVD             0x0800        /* LVD Device Detect */
+#define  SE              0x0400        /* SE Device Detect */
+#define TERM_LVD        0x00C0 /* LVD Termination Bits */
+#define  TERM_LVD_HI     0x0080        /* Enable LVD Upper Termination */
+#define  TERM_LVD_LO     0x0040        /* Enable LVD Lower Termination */
+#define TERM_SE         0x0030 /* SE Termination Bits */
+#define  TERM_SE_HI      0x0020        /* Enable SE Upper Termination */
+#define  TERM_SE_LO      0x0010        /* Enable SE Lower Termination */
+#define C_DET_LVD       0x000C /* LVD Cable Detect Bits */
+#define  C_DET3          0x0008        /* Cable Detect for LVD External Wide */
+#define  C_DET2          0x0004        /* Cable Detect for LVD Internal Wide */
+#define C_DET_SE        0x0003 /* SE Cable Detect Bits */
+#define  C_DET1          0x0002        /* Cable Detect for SE Internal Wide */
+#define  C_DET0          0x0001        /* Cable Detect for SE Internal Narrow */
 
 #define CABLE_ILLEGAL_A 0x7
     /* x 0 0 0  | on  on | Illegal (all 3 connectors are used) */
@@ -2691,39 +2667,39 @@ typedef struct adveep_38C1600_config
 /*
  * MEM_CFG Register bit definitions
  */
-#define BIOS_EN         0x40    /* BIOS Enable MIO:14,EEP:14 */
-#define FAST_EE_CLK     0x20    /* Diagnostic Bit */
-#define RAM_SZ          0x1C    /* Specify size of RAM to RISC */
-#define  RAM_SZ_2KB      0x00    /* 2 KB */
-#define  RAM_SZ_4KB      0x04    /* 4 KB */
-#define  RAM_SZ_8KB      0x08    /* 8 KB */
-#define  RAM_SZ_16KB     0x0C    /* 16 KB */
-#define  RAM_SZ_32KB     0x10    /* 32 KB */
-#define  RAM_SZ_64KB     0x14    /* 64 KB */
+#define BIOS_EN         0x40   /* BIOS Enable MIO:14,EEP:14 */
+#define FAST_EE_CLK     0x20   /* Diagnostic Bit */
+#define RAM_SZ          0x1C   /* Specify size of RAM to RISC */
+#define  RAM_SZ_2KB      0x00  /* 2 KB */
+#define  RAM_SZ_4KB      0x04  /* 4 KB */
+#define  RAM_SZ_8KB      0x08  /* 8 KB */
+#define  RAM_SZ_16KB     0x0C  /* 16 KB */
+#define  RAM_SZ_32KB     0x10  /* 32 KB */
+#define  RAM_SZ_64KB     0x14  /* 64 KB */
 
 /*
  * DMA_CFG0 Register bit definitions
  *
  * This register is only accessible to the host.
  */
-#define BC_THRESH_ENB   0x80    /* PCI DMA Start Conditions */
-#define FIFO_THRESH     0x70    /* PCI DMA FIFO Threshold */
-#define  FIFO_THRESH_16B  0x00   /* 16 bytes */
-#define  FIFO_THRESH_32B  0x20   /* 32 bytes */
-#define  FIFO_THRESH_48B  0x30   /* 48 bytes */
-#define  FIFO_THRESH_64B  0x40   /* 64 bytes */
-#define  FIFO_THRESH_80B  0x50   /* 80 bytes (default) */
-#define  FIFO_THRESH_96B  0x60   /* 96 bytes */
-#define  FIFO_THRESH_112B 0x70   /* 112 bytes */
-#define START_CTL       0x0C    /* DMA start conditions */
-#define  START_CTL_TH    0x00    /* Wait threshold level (default) */
-#define  START_CTL_ID    0x04    /* Wait SDMA/SBUS idle */
-#define  START_CTL_THID  0x08    /* Wait threshold and SDMA/SBUS idle */
-#define  START_CTL_EMFU  0x0C    /* Wait SDMA FIFO empty/full */
-#define READ_CMD        0x03    /* Memory Read Method */
-#define  READ_CMD_MR     0x00    /* Memory Read */
-#define  READ_CMD_MRL    0x02    /* Memory Read Long */
-#define  READ_CMD_MRM    0x03    /* Memory Read Multiple (default) */
+#define BC_THRESH_ENB   0x80   /* PCI DMA Start Conditions */
+#define FIFO_THRESH     0x70   /* PCI DMA FIFO Threshold */
+#define  FIFO_THRESH_16B  0x00 /* 16 bytes */
+#define  FIFO_THRESH_32B  0x20 /* 32 bytes */
+#define  FIFO_THRESH_48B  0x30 /* 48 bytes */
+#define  FIFO_THRESH_64B  0x40 /* 64 bytes */
+#define  FIFO_THRESH_80B  0x50 /* 80 bytes (default) */
+#define  FIFO_THRESH_96B  0x60 /* 96 bytes */
+#define  FIFO_THRESH_112B 0x70 /* 112 bytes */
+#define START_CTL       0x0C   /* DMA start conditions */
+#define  START_CTL_TH    0x00  /* Wait threshold level (default) */
+#define  START_CTL_ID    0x04  /* Wait SDMA/SBUS idle */
+#define  START_CTL_THID  0x08  /* Wait threshold and SDMA/SBUS idle */
+#define  START_CTL_EMFU  0x0C  /* Wait SDMA FIFO empty/full */
+#define READ_CMD        0x03   /* Memory Read Method */
+#define  READ_CMD_MR     0x00  /* Memory Read */
+#define  READ_CMD_MRL    0x02  /* Memory Read Long */
+#define  READ_CMD_MRM    0x03  /* Memory Read Multiple (default) */
 
 /*
  * ASC-38C0800 RAM BIST Register bit definitions
@@ -2747,7 +2723,7 @@ typedef struct adveep_38C1600_config
  * IOPB_PCI_INT_CFG Bit Field Definitions
  */
 
-#define INTAB_LD        0x80    /* Value loaded from EEPROM Bit 11. */
+#define INTAB_LD        0x80   /* Value loaded from EEPROM Bit 11. */
 
 /*
  * Bit 1 can be set to change the interrupt for the Function to operate in
@@ -2780,53 +2756,52 @@ typedef struct adveep_38C1600_config
 #define ADV_BUSY        0
 #define ADV_ERROR       (-1)
 
-
 /*
  * ADV_DVC_VAR 'warn_code' values
  */
-#define ASC_WARN_BUSRESET_ERROR         0x0001 /* SCSI Bus Reset error */
-#define ASC_WARN_EEPROM_CHKSUM          0x0002 /* EEP check sum error */
-#define ASC_WARN_EEPROM_TERMINATION     0x0004 /* EEP termination bad field */
-#define ASC_WARN_SET_PCI_CONFIG_SPACE   0x0080 /* PCI config space set error */
-#define ASC_WARN_ERROR                  0xFFFF /* ADV_ERROR return */
+#define ASC_WARN_BUSRESET_ERROR         0x0001 /* SCSI Bus Reset error */
+#define ASC_WARN_EEPROM_CHKSUM          0x0002 /* EEP check sum error */
+#define ASC_WARN_EEPROM_TERMINATION     0x0004 /* EEP termination bad field */
+#define ASC_WARN_SET_PCI_CONFIG_SPACE   0x0080 /* PCI config space set error */
+#define ASC_WARN_ERROR                  0xFFFF /* ADV_ERROR return */
 
-#define ADV_MAX_TID                     15 /* max. target identifier */
-#define ADV_MAX_LUN                     7  /* max. logical unit number */
+#define ADV_MAX_TID                     15     /* max. target identifier */
+#define ADV_MAX_LUN                     7      /* max. logical unit number */
 
 /*
  * Error code values are set in ADV_DVC_VAR 'err_code'.
  */
-#define ASC_IERR_WRITE_EEPROM       0x0001 /* write EEPROM error */
-#define ASC_IERR_MCODE_CHKSUM       0x0002 /* micro code check sum error */
-#define ASC_IERR_NO_CARRIER         0x0004 /* No more carrier memory. */
-#define ASC_IERR_START_STOP_CHIP    0x0008 /* start/stop chip failed */
-#define ASC_IERR_CHIP_VERSION       0x0040 /* wrong chip version */
-#define ASC_IERR_SET_SCSI_ID        0x0080 /* set SCSI ID failed */
-#define ASC_IERR_HVD_DEVICE         0x0100 /* HVD attached to LVD connector. */
-#define ASC_IERR_BAD_SIGNATURE      0x0200 /* signature not found */
-#define ASC_IERR_ILLEGAL_CONNECTION 0x0400 /* Illegal cable connection */
-#define ASC_IERR_SINGLE_END_DEVICE  0x0800 /* Single-end used w/differential */
-#define ASC_IERR_REVERSED_CABLE     0x1000 /* Narrow flat cable reversed */
-#define ASC_IERR_BIST_PRE_TEST      0x2000 /* BIST pre-test error */
-#define ASC_IERR_BIST_RAM_TEST      0x4000 /* BIST RAM test error */
-#define ASC_IERR_BAD_CHIPTYPE       0x8000 /* Invalid 'chip_type' setting. */
+#define ASC_IERR_WRITE_EEPROM       0x0001     /* write EEPROM error */
+#define ASC_IERR_MCODE_CHKSUM       0x0002     /* micro code check sum error */
+#define ASC_IERR_NO_CARRIER         0x0004     /* No more carrier memory. */
+#define ASC_IERR_START_STOP_CHIP    0x0008     /* start/stop chip failed */
+#define ASC_IERR_CHIP_VERSION       0x0040     /* wrong chip version */
+#define ASC_IERR_SET_SCSI_ID        0x0080     /* set SCSI ID failed */
+#define ASC_IERR_HVD_DEVICE         0x0100     /* HVD attached to LVD connector. */
+#define ASC_IERR_BAD_SIGNATURE      0x0200     /* signature not found */
+#define ASC_IERR_ILLEGAL_CONNECTION 0x0400     /* Illegal cable connection */
+#define ASC_IERR_SINGLE_END_DEVICE  0x0800     /* Single-end used w/differential */
+#define ASC_IERR_REVERSED_CABLE     0x1000     /* Narrow flat cable reversed */
+#define ASC_IERR_BIST_PRE_TEST      0x2000     /* BIST pre-test error */
+#define ASC_IERR_BIST_RAM_TEST      0x4000     /* BIST RAM test error */
+#define ASC_IERR_BAD_CHIPTYPE       0x8000     /* Invalid 'chip_type' setting. */
 
 /*
  * Fixed locations of microcode operating variables.
  */
-#define ASC_MC_CODE_BEGIN_ADDR          0x0028 /* microcode start address */
-#define ASC_MC_CODE_END_ADDR            0x002A /* microcode end address */
-#define ASC_MC_CODE_CHK_SUM             0x002C /* microcode code checksum */
-#define ASC_MC_VERSION_DATE             0x0038 /* microcode version */
-#define ASC_MC_VERSION_NUM              0x003A /* microcode number */
-#define ASC_MC_BIOSMEM                  0x0040 /* BIOS RISC Memory Start */
-#define ASC_MC_BIOSLEN                  0x0050 /* BIOS RISC Memory Length */
-#define ASC_MC_BIOS_SIGNATURE           0x0058 /* BIOS Signature 0x55AA */
-#define ASC_MC_BIOS_VERSION             0x005A /* BIOS Version (2 bytes) */
-#define ASC_MC_SDTR_SPEED1              0x0090 /* SDTR Speed for TID 0-3 */
-#define ASC_MC_SDTR_SPEED2              0x0092 /* SDTR Speed for TID 4-7 */
-#define ASC_MC_SDTR_SPEED3              0x0094 /* SDTR Speed for TID 8-11 */
-#define ASC_MC_SDTR_SPEED4              0x0096 /* SDTR Speed for TID 12-15 */
+#define ASC_MC_CODE_BEGIN_ADDR          0x0028 /* microcode start address */
+#define ASC_MC_CODE_END_ADDR            0x002A /* microcode end address */
+#define ASC_MC_CODE_CHK_SUM             0x002C /* microcode code checksum */
+#define ASC_MC_VERSION_DATE             0x0038 /* microcode version */
+#define ASC_MC_VERSION_NUM              0x003A /* microcode number */
+#define ASC_MC_BIOSMEM                  0x0040 /* BIOS RISC Memory Start */
+#define ASC_MC_BIOSLEN                  0x0050 /* BIOS RISC Memory Length */
+#define ASC_MC_BIOS_SIGNATURE           0x0058 /* BIOS Signature 0x55AA */
+#define ASC_MC_BIOS_VERSION             0x005A /* BIOS Version (2 bytes) */
+#define ASC_MC_SDTR_SPEED1              0x0090 /* SDTR Speed for TID 0-3 */
+#define ASC_MC_SDTR_SPEED2              0x0092 /* SDTR Speed for TID 4-7 */
+#define ASC_MC_SDTR_SPEED3              0x0094 /* SDTR Speed for TID 8-11 */
+#define ASC_MC_SDTR_SPEED4              0x0096 /* SDTR Speed for TID 12-15 */
 #define ASC_MC_CHIP_TYPE                0x009A
 #define ASC_MC_INTRB_CODE               0x009B
 #define ASC_MC_WDTR_ABLE                0x009C
@@ -2844,9 +2819,9 @@ typedef struct adveep_38C1600_config
 #define ASC_MC_NUMBER_OF_QUEUED_CMD     0x00C0
 #define ASC_MC_NUMBER_OF_MAX_CMD        0x00D0
 #define ASC_MC_DEVICE_HSHK_CFG_TABLE    0x0100
-#define ASC_MC_CONTROL_FLAG             0x0122 /* Microcode control flag. */
+#define ASC_MC_CONTROL_FLAG             0x0122 /* Microcode control flag. */
 #define ASC_MC_WDTR_DONE                0x0124
-#define ASC_MC_CAM_MODE_MASK            0x015E /* CAM mode TID bitmask. */
+#define ASC_MC_CAM_MODE_MASK            0x015E /* CAM mode TID bitmask. */
 #define ASC_MC_ICQ                      0x0160
 #define ASC_MC_IRQ                      0x0164
 #define ASC_MC_PPR_ABLE                 0x017A
@@ -2865,8 +2840,8 @@ typedef struct adveep_38C1600_config
  * Flags set by the Adv Library in RISC variable 'control_flag' (0x122)
  * and handled by the microcode.
  */
-#define CONTROL_FLAG_IGNORE_PERR        0x0001 /* Ignore DMA Parity Errors */
-#define CONTROL_FLAG_ENABLE_AIPP        0x0002 /* Enabled AIPP checking. */
+#define CONTROL_FLAG_IGNORE_PERR        0x0001 /* Ignore DMA Parity Errors */
+#define CONTROL_FLAG_ENABLE_AIPP        0x0002 /* Enabled AIPP checking. */
 
 /*
  * ASC_MC_DEVICE_HSHK_CFG_TABLE microcode table or HSHK_CFG register format
@@ -2875,45 +2850,44 @@ typedef struct adveep_38C1600_config
 #define HSHK_CFG_RATE           0x0F00
 #define HSHK_CFG_OFFSET         0x001F
 
-#define ASC_DEF_MAX_HOST_QNG    0xFD /* Max. number of host commands (253) */
-#define ASC_DEF_MIN_HOST_QNG    0x10 /* Min. number of host commands (16) */
-#define ASC_DEF_MAX_DVC_QNG     0x3F /* Max. number commands per device (63) */
-#define ASC_DEF_MIN_DVC_QNG     0x04 /* Min. number commands per device (4) */
-
-#define ASC_QC_DATA_CHECK  0x01 /* Require ASC_QC_DATA_OUT set or clear. */
-#define ASC_QC_DATA_OUT    0x02 /* Data out DMA transfer. */
-#define ASC_QC_START_MOTOR 0x04 /* Send auto-start motor before request. */
-#define ASC_QC_NO_OVERRUN  0x08 /* Don't report overrun. */
-#define ASC_QC_FREEZE_TIDQ 0x10 /* Freeze TID queue after request. XXX TBD */
-
-#define ASC_QSC_NO_DISC     0x01 /* Don't allow disconnect for request. */
-#define ASC_QSC_NO_TAGMSG   0x02 /* Don't allow tag queuing for request. */
-#define ASC_QSC_NO_SYNC     0x04 /* Don't use Synch. transfer on request. */
-#define ASC_QSC_NO_WIDE     0x08 /* Don't use Wide transfer on request. */
-#define ASC_QSC_REDO_DTR    0x10 /* Renegotiate WDTR/SDTR before request. */
+#define ASC_DEF_MAX_HOST_QNG    0xFD   /* Max. number of host commands (253) */
+#define ASC_DEF_MIN_HOST_QNG    0x10   /* Min. number of host commands (16) */
+#define ASC_DEF_MAX_DVC_QNG     0x3F   /* Max. number commands per device (63) */
+#define ASC_DEF_MIN_DVC_QNG     0x04   /* Min. number commands per device (4) */
+
+#define ASC_QC_DATA_CHECK  0x01        /* Require ASC_QC_DATA_OUT set or clear. */
+#define ASC_QC_DATA_OUT    0x02        /* Data out DMA transfer. */
+#define ASC_QC_START_MOTOR 0x04        /* Send auto-start motor before request. */
+#define ASC_QC_NO_OVERRUN  0x08        /* Don't report overrun. */
+#define ASC_QC_FREEZE_TIDQ 0x10        /* Freeze TID queue after request. XXX TBD */
+
+#define ASC_QSC_NO_DISC     0x01       /* Don't allow disconnect for request. */
+#define ASC_QSC_NO_TAGMSG   0x02       /* Don't allow tag queuing for request. */
+#define ASC_QSC_NO_SYNC     0x04       /* Don't use Synch. transfer on request. */
+#define ASC_QSC_NO_WIDE     0x08       /* Don't use Wide transfer on request. */
+#define ASC_QSC_REDO_DTR    0x10       /* Renegotiate WDTR/SDTR before request. */
 /*
  * Note: If a Tag Message is to be sent and neither ASC_QSC_HEAD_TAG or
  * ASC_QSC_ORDERED_TAG is set, then a Simple Tag Message (0x20) is used.
  */
-#define ASC_QSC_HEAD_TAG    0x40 /* Use Head Tag Message (0x21). */
-#define ASC_QSC_ORDERED_TAG 0x80 /* Use Ordered Tag Message (0x22). */
+#define ASC_QSC_HEAD_TAG    0x40       /* Use Head Tag Message (0x21). */
+#define ASC_QSC_ORDERED_TAG 0x80       /* Use Ordered Tag Message (0x22). */
 
 /*
  * All fields here are accessed by the board microcode and need to be
  * little-endian.
  */
-typedef struct adv_carr_t
-{
-    ADV_VADDR   carr_va;       /* Carrier Virtual Address */
-    ADV_PADDR   carr_pa;       /* Carrier Physical Address */
-    ADV_VADDR   areq_vpa;      /* ASC_SCSI_REQ_Q Virtual or Physical Address */
-    /*
-     * next_vpa [31:4]            Carrier Virtual or Physical Next Pointer
-     *
-     * next_vpa [3:1]             Reserved Bits
-     * next_vpa [0]               Done Flag set in Response Queue.
-     */
-    ADV_VADDR   next_vpa;
+typedef struct adv_carr_t {
+       ADV_VADDR carr_va;      /* Carrier Virtual Address */
+       ADV_PADDR carr_pa;      /* Carrier Physical Address */
+       ADV_VADDR areq_vpa;     /* ASC_SCSI_REQ_Q Virtual or Physical Address */
+       /*
+        * next_vpa [31:4]            Carrier Virtual or Physical Next Pointer
+        *
+        * next_vpa [3:1]             Reserved Bits
+        * next_vpa [0]               Done Flag set in Response Queue.
+        */
+       ADV_VADDR next_vpa;
 } ADV_CARR_T;
 
 /*
@@ -2940,13 +2914,13 @@ typedef struct adv_carr_t
  * The Adv Library should limit use to the lower nibble (4 bits) of
  * a_flag. Drivers are free to use the upper nibble (4 bits) of a_flag.
  */
-#define ADV_POLL_REQUEST                0x01   /* poll for request completion */
-#define ADV_SCSIQ_DONE                  0x02   /* request done */
-#define ADV_DONT_RETRY                  0x08   /* don't do retry */
+#define ADV_POLL_REQUEST                0x01   /* poll for request completion */
+#define ADV_SCSIQ_DONE                  0x02   /* request done */
+#define ADV_DONT_RETRY                  0x08   /* don't do retry */
 
-#define ADV_CHIP_ASC3550          0x01   /* Ultra-Wide IC */
-#define ADV_CHIP_ASC38C0800       0x02   /* Ultra2-Wide/LVD IC */
-#define ADV_CHIP_ASC38C1600       0x03   /* Ultra3-Wide/LVD2 IC */
+#define ADV_CHIP_ASC3550          0x01 /* Ultra-Wide IC */
+#define ADV_CHIP_ASC38C0800       0x02 /* Ultra2-Wide/LVD IC */
+#define ADV_CHIP_ASC38C1600       0x03 /* Ultra3-Wide/LVD2 IC */
 
 /*
  * Adapter temporary configuration structure
@@ -2960,30 +2934,30 @@ typedef struct adv_carr_t
  *  value of the field is never reset.
  */
 typedef struct adv_dvc_cfg {
-  ushort disc_enable;       /* enable disconnection */
-  uchar  chip_version;      /* chip version */
-  uchar  termination;       /* Term. Ctrl. bits 6-5 of SCSI_CFG1 register */
-  ushort lib_version;       /* Adv Library version number */
-  ushort control_flag;      /* Microcode Control Flag */
-  ushort mcode_date;        /* Microcode date */
-  ushort mcode_version;     /* Microcode version */
-  ushort pci_slot_info;     /* high byte device/function number */
-                            /* bits 7-3 device num., bits 2-0 function num. */
-                            /* low byte bus num. */
-  ushort serial1;           /* EEPROM serial number word 1 */
-  ushort serial2;           /* EEPROM serial number word 2 */
-  ushort serial3;           /* EEPROM serial number word 3 */
-  struct device *dev;  /* pointer to the pci dev structure for this board */
+       ushort disc_enable;     /* enable disconnection */
+       uchar chip_version;     /* chip version */
+       uchar termination;      /* Term. Ctrl. bits 6-5 of SCSI_CFG1 register */
+       ushort lib_version;     /* Adv Library version number */
+       ushort control_flag;    /* Microcode Control Flag */
+       ushort mcode_date;      /* Microcode date */
+       ushort mcode_version;   /* Microcode version */
+       ushort pci_slot_info;   /* high byte device/function number */
+       /* bits 7-3 device num., bits 2-0 function num. */
+       /* low byte bus num. */
+       ushort serial1;         /* EEPROM serial number word 1 */
+       ushort serial2;         /* EEPROM serial number word 2 */
+       ushort serial3;         /* EEPROM serial number word 3 */
+       struct device *dev;     /* pointer to the pci dev structure for this board */
 } ADV_DVC_CFG;
 
 struct adv_dvc_var;
 struct adv_scsi_req_q;
 
-typedef void (* ADV_ISR_CALLBACK)
   (struct adv_dvc_var *, struct adv_scsi_req_q *);
+typedef void (*ADV_ISR_CALLBACK)
+ (struct adv_dvc_var *, struct adv_scsi_req_q *);
 
-typedef void (* ADV_ASYNC_CALLBACK)
   (struct adv_dvc_var *, uchar);
+typedef void (*ADV_ASYNC_CALLBACK)
+ (struct adv_dvc_var *, uchar);
 
 /*
  * Adapter operation variable structure.
@@ -2998,55 +2972,55 @@ typedef void (* ADV_ASYNC_CALLBACK)
  *  of the feature, the field is cleared.
  */
 typedef struct adv_dvc_var {
-  AdvPortAddr iop_base;   /* I/O port address */
-  ushort err_code;        /* fatal error code */
-  ushort bios_ctrl;       /* BIOS control word, EEPROM word 12 */
-  ADV_ISR_CALLBACK isr_callback;
-  ADV_ASYNC_CALLBACK async_callback;
-  ushort wdtr_able;       /* try WDTR for a device */
-  ushort sdtr_able;       /* try SDTR for a device */
-  ushort ultra_able;      /* try SDTR Ultra speed for a device */
-  ushort sdtr_speed1;     /* EEPROM SDTR Speed for TID 0-3   */
-  ushort sdtr_speed2;     /* EEPROM SDTR Speed for TID 4-7   */
-  ushort sdtr_speed3;     /* EEPROM SDTR Speed for TID 8-11  */
-  ushort sdtr_speed4;     /* EEPROM SDTR Speed for TID 12-15 */
-  ushort tagqng_able;     /* try tagged queuing with a device */
-  ushort ppr_able;        /* PPR message capable per TID bitmask. */
-  uchar  max_dvc_qng;     /* maximum number of tagged commands per device */
-  ushort start_motor;     /* start motor command allowed */
-  uchar  scsi_reset_wait; /* delay in seconds after scsi bus reset */
-  uchar  chip_no;         /* should be assigned by caller */
-  uchar  max_host_qng;    /* maximum number of Q'ed command allowed */
-  uchar  irq_no;          /* IRQ number */
-  ushort no_scam;         /* scam_tolerant of EEPROM */
-  struct asc_board *drv_ptr; /* driver pointer to private structure */
-  uchar  chip_scsi_id;    /* chip SCSI target ID */
-  uchar  chip_type;
-  uchar  bist_err_code;
-  ADV_CARR_T *carrier_buf;
-  ADV_CARR_T *carr_freelist; /* Carrier free list. */
-  ADV_CARR_T *icq_sp;  /* Initiator command queue stopper pointer. */
-  ADV_CARR_T *irq_sp;  /* Initiator response queue stopper pointer. */
-  ushort carr_pending_cnt;    /* Count of pending carriers. */
- /*
-  * Note: The following fields will not be used after initialization. The
-  * driver may discard the buffer after initialization is done.
-  */
-  ADV_DVC_CFG *cfg; /* temporary configuration structure  */
+       AdvPortAddr iop_base;   /* I/O port address */
+       ushort err_code;        /* fatal error code */
+       ushort bios_ctrl;       /* BIOS control word, EEPROM word 12 */
+       ADV_ISR_CALLBACK isr_callback;
+       ADV_ASYNC_CALLBACK async_callback;
+       ushort wdtr_able;       /* try WDTR for a device */
+       ushort sdtr_able;       /* try SDTR for a device */
+       ushort ultra_able;      /* try SDTR Ultra speed for a device */
+       ushort sdtr_speed1;     /* EEPROM SDTR Speed for TID 0-3   */
+       ushort sdtr_speed2;     /* EEPROM SDTR Speed for TID 4-7   */
+       ushort sdtr_speed3;     /* EEPROM SDTR Speed for TID 8-11  */
+       ushort sdtr_speed4;     /* EEPROM SDTR Speed for TID 12-15 */
+       ushort tagqng_able;     /* try tagged queuing with a device */
+       ushort ppr_able;        /* PPR message capable per TID bitmask. */
+       uchar max_dvc_qng;      /* maximum number of tagged commands per device */
+       ushort start_motor;     /* start motor command allowed */
+       uchar scsi_reset_wait;  /* delay in seconds after scsi bus reset */
+       uchar chip_no;          /* should be assigned by caller */
+       uchar max_host_qng;     /* maximum number of Q'ed command allowed */
+       uchar irq_no;           /* IRQ number */
+       ushort no_scam;         /* scam_tolerant of EEPROM */
+       struct asc_board *drv_ptr;      /* driver pointer to private structure */
+       uchar chip_scsi_id;     /* chip SCSI target ID */
+       uchar chip_type;
+       uchar bist_err_code;
+       ADV_CARR_T *carrier_buf;
+       ADV_CARR_T *carr_freelist;      /* Carrier free list. */
+       ADV_CARR_T *icq_sp;     /* Initiator command queue stopper pointer. */
+       ADV_CARR_T *irq_sp;     /* Initiator response queue stopper pointer. */
+       ushort carr_pending_cnt;        /* Count of pending carriers. */
      /*
+        * Note: The following fields will not be used after initialization. The
+        * driver may discard the buffer after initialization is done.
+        */
+       ADV_DVC_CFG *cfg;       /* temporary configuration structure  */
 } ADV_DVC_VAR;
 
 #define NO_OF_SG_PER_BLOCK              15
 
 typedef struct asc_sg_block {
-    uchar reserved1;
-    uchar reserved2;
-    uchar reserved3;
-    uchar sg_cnt;                     /* Valid entries in block. */
-    ADV_PADDR sg_ptr;                 /* Pointer to next sg block. */
-    struct  {
-        ADV_PADDR sg_addr;                  /* SG element address. */
-        ADV_DCNT  sg_count;                 /* SG element count. */
-    } sg_list[NO_OF_SG_PER_BLOCK];
+       uchar reserved1;
+       uchar reserved2;
+       uchar reserved3;
+       uchar sg_cnt;           /* Valid entries in block. */
+       ADV_PADDR sg_ptr;       /* Pointer to next sg block. */
+       struct {
+               ADV_PADDR sg_addr;      /* SG element address. */
+               ADV_DCNT sg_count;      /* SG element count. */
+       } sg_list[NO_OF_SG_PER_BLOCK];
 } ADV_SG_BLOCK;
 
 /*
@@ -3061,37 +3035,37 @@ typedef struct asc_sg_block {
  * order.
  */
 typedef struct adv_scsi_req_q {
-    uchar       cntl;           /* Ucode flags and state (ASC_MC_QC_*). */
-    uchar       target_cmd;
-    uchar       target_id;      /* Device target identifier. */
-    uchar       target_lun;     /* Device target logical unit number. */
-    ADV_PADDR   data_addr;      /* Data buffer physical address. */
-    ADV_DCNT    data_cnt;       /* Data count. Ucode sets to residual. */
-    ADV_PADDR   sense_addr;
-    ADV_PADDR   carr_pa;
-    uchar       mflag;
-    uchar       sense_len;
-    uchar       cdb_len;        /* SCSI CDB length. Must <= 16 bytes. */
-    uchar       scsi_cntl;
-    uchar       done_status;    /* Completion status. */
-    uchar       scsi_status;    /* SCSI status byte. */
-    uchar       host_status;    /* Ucode host status. */
-    uchar       sg_working_ix;
-    uchar       cdb[12];        /* SCSI CDB bytes 0-11. */
-    ADV_PADDR   sg_real_addr;   /* SG list physical address. */
-    ADV_PADDR   scsiq_rptr;
-    uchar       cdb16[4];       /* SCSI CDB bytes 12-15. */
-    ADV_VADDR   scsiq_ptr;
-    ADV_VADDR   carr_va;
-    /*
-     * End of microcode structure - 60 bytes. The rest of the structure
-     * is used by the Adv Library and ignored by the microcode.
-     */
-    ADV_VADDR   srb_ptr;
-    ADV_SG_BLOCK *sg_list_ptr; /* SG list virtual address. */
-    char        *vdata_addr;   /* Data buffer virtual address. */
-    uchar       a_flag;
-    uchar       pad[2];        /* Pad out to a word boundary. */
+       uchar cntl;             /* Ucode flags and state (ASC_MC_QC_*). */
+       uchar target_cmd;
+       uchar target_id;        /* Device target identifier. */
+       uchar target_lun;       /* Device target logical unit number. */
+       ADV_PADDR data_addr;    /* Data buffer physical address. */
+       ADV_DCNT data_cnt;      /* Data count. Ucode sets to residual. */
+       ADV_PADDR sense_addr;
+       ADV_PADDR carr_pa;
+       uchar mflag;
+       uchar sense_len;
+       uchar cdb_len;          /* SCSI CDB length. Must <= 16 bytes. */
+       uchar scsi_cntl;
+       uchar done_status;      /* Completion status. */
+       uchar scsi_status;      /* SCSI status byte. */
+       uchar host_status;      /* Ucode host status. */
+       uchar sg_working_ix;
+       uchar cdb[12];          /* SCSI CDB bytes 0-11. */
+       ADV_PADDR sg_real_addr; /* SG list physical address. */
+       ADV_PADDR scsiq_rptr;
+       uchar cdb16[4];         /* SCSI CDB bytes 12-15. */
+       ADV_VADDR scsiq_ptr;
+       ADV_VADDR carr_va;
+       /*
+        * End of microcode structure - 60 bytes. The rest of the structure
+        * is used by the Adv Library and ignored by the microcode.
+        */
+       ADV_VADDR srb_ptr;
+       ADV_SG_BLOCK *sg_list_ptr;      /* SG list virtual address. */
+       char *vdata_addr;       /* Data buffer virtual address. */
+       uchar a_flag;
+       uchar pad[2];           /* Pad out to a word boundary. */
 } ADV_SCSI_REQ_Q;
 
 /*
@@ -3103,8 +3077,8 @@ typedef struct adv_scsi_req_q {
 #define IDLE_CMD_SEND_INT            0x0004
 #define IDLE_CMD_ABORT               0x0008
 #define IDLE_CMD_DEVICE_RESET        0x0010
-#define IDLE_CMD_SCSI_RESET_START    0x0020 /* Assert SCSI Bus Reset */
-#define IDLE_CMD_SCSI_RESET_END      0x0040 /* Deassert SCSI Bus Reset */
+#define IDLE_CMD_SCSI_RESET_START    0x0020    /* Assert SCSI Bus Reset */
+#define IDLE_CMD_SCSI_RESET_END      0x0040    /* Deassert SCSI Bus Reset */
 #define IDLE_CMD_SCSIREQ             0x0080
 
 #define IDLE_CMD_STATUS_SUCCESS      0x0001
@@ -3118,60 +3092,59 @@ typedef struct adv_scsi_req_q {
 /*
  * Wait loop time out values.
  */
-#define SCSI_WAIT_10_SEC             10UL    /* 10 seconds */
-#define SCSI_WAIT_100_MSEC           100UL   /* 100 milliseconds */
-#define SCSI_US_PER_MSEC             1000    /* microseconds per millisecond */
-#define SCSI_MS_PER_SEC              1000UL  /* milliseconds per second */
-#define SCSI_MAX_RETRY               10      /* retry count */
+#define SCSI_WAIT_10_SEC             10UL      /* 10 seconds */
+#define SCSI_WAIT_100_MSEC           100UL     /* 100 milliseconds */
+#define SCSI_US_PER_MSEC             1000      /* microseconds per millisecond */
+#define SCSI_MS_PER_SEC              1000UL    /* milliseconds per second */
+#define SCSI_MAX_RETRY               10        /* retry count */
 
-#define ADV_ASYNC_RDMA_FAILURE          0x01 /* Fatal RDMA failure. */
-#define ADV_ASYNC_SCSI_BUS_RESET_DET    0x02 /* Detected SCSI Bus Reset. */
-#define ADV_ASYNC_CARRIER_READY_FAILURE 0x03 /* Carrier Ready failure. */
-#define ADV_RDMA_IN_CARR_AND_Q_INVALID  0x04 /* RDMAed-in data invalid. */
+#define ADV_ASYNC_RDMA_FAILURE          0x01   /* Fatal RDMA failure. */
+#define ADV_ASYNC_SCSI_BUS_RESET_DET    0x02   /* Detected SCSI Bus Reset. */
+#define ADV_ASYNC_CARRIER_READY_FAILURE 0x03   /* Carrier Ready failure. */
+#define ADV_RDMA_IN_CARR_AND_Q_INVALID  0x04   /* RDMAed-in data invalid. */
 
-
-#define ADV_HOST_SCSI_BUS_RESET      0x80 /* Host Initiated SCSI Bus Reset. */
+#define ADV_HOST_SCSI_BUS_RESET      0x80      /* Host Initiated SCSI Bus Reset. */
 
 /*
  * Device drivers must define the following functions.
  */
-STATIC inline ulong DvcEnterCritical(void);
-STATIC inline void  DvcLeaveCritical(ulong);
-STATIC void  DvcSleepMilliSecond(ADV_DCNT);
-STATIC uchar DvcAdvReadPCIConfigByte(ADV_DVC_VAR *, ushort);
-STATIC void  DvcAdvWritePCIConfigByte(ADV_DVC_VAR *, ushort, uchar);
-STATIC ADV_PADDR DvcGetPhyAddr(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *,
-                uchar *, ASC_SDCNT *, int);
-STATIC void  DvcDelayMicroSecond(ADV_DVC_VAR *, ushort);
+static inline ulong DvcEnterCritical(void);
+static inline void DvcLeaveCritical(ulong);
+static void DvcSleepMilliSecond(ADV_DCNT);
+static uchar DvcAdvReadPCIConfigByte(ADV_DVC_VAR *, ushort);
+static void DvcAdvWritePCIConfigByte(ADV_DVC_VAR *, ushort, uchar);
+static ADV_PADDR DvcGetPhyAddr(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *,
+                              uchar *, ASC_SDCNT *, int);
+static void DvcDelayMicroSecond(ADV_DVC_VAR *, ushort);
 
 /*
  * Adv Library functions available to drivers.
  */
-STATIC int     AdvExeScsiQueue(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *);
-STATIC int     AdvISR(ADV_DVC_VAR *);
-STATIC int     AdvInitGetConfig(ADV_DVC_VAR *);
-STATIC int     AdvInitAsc3550Driver(ADV_DVC_VAR *);
-STATIC int     AdvInitAsc38C0800Driver(ADV_DVC_VAR *);
-STATIC int     AdvInitAsc38C1600Driver(ADV_DVC_VAR *);
-STATIC int     AdvResetChipAndSB(ADV_DVC_VAR *);
-STATIC int     AdvResetSB(ADV_DVC_VAR *asc_dvc);
+static int AdvExeScsiQueue(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *);
+static int AdvISR(ADV_DVC_VAR *);
+static int AdvInitGetConfig(ADV_DVC_VAR *);
+static int AdvInitAsc3550Driver(ADV_DVC_VAR *);
+static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *);
+static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *);
+static int AdvResetChipAndSB(ADV_DVC_VAR *);
+static int AdvResetSB(ADV_DVC_VAR *asc_dvc);
 
 /*
  * Internal Adv Library functions.
  */
-STATIC int    AdvSendIdleCmd(ADV_DVC_VAR *, ushort, ADV_DCNT);
-STATIC void   AdvInquiryHandling(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *);
-STATIC int    AdvInitFrom3550EEP(ADV_DVC_VAR *);
-STATIC int    AdvInitFrom38C0800EEP(ADV_DVC_VAR *);
-STATIC int    AdvInitFrom38C1600EEP(ADV_DVC_VAR *);
-STATIC ushort AdvGet3550EEPConfig(AdvPortAddr, ADVEEP_3550_CONFIG *);
-STATIC void   AdvSet3550EEPConfig(AdvPortAddr, ADVEEP_3550_CONFIG *);
-STATIC ushort AdvGet38C0800EEPConfig(AdvPortAddr, ADVEEP_38C0800_CONFIG *);
-STATIC void   AdvSet38C0800EEPConfig(AdvPortAddr, ADVEEP_38C0800_CONFIG *);
-STATIC ushort AdvGet38C1600EEPConfig(AdvPortAddr, ADVEEP_38C1600_CONFIG *);
-STATIC void   AdvSet38C1600EEPConfig(AdvPortAddr, ADVEEP_38C1600_CONFIG *);
-STATIC void   AdvWaitEEPCmd(AdvPortAddr);
-STATIC ushort AdvReadEEPWord(AdvPortAddr, int);
+static int AdvSendIdleCmd(ADV_DVC_VAR *, ushort, ADV_DCNT);
+static void AdvInquiryHandling(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *);
+static int AdvInitFrom3550EEP(ADV_DVC_VAR *);
+static int AdvInitFrom38C0800EEP(ADV_DVC_VAR *);
+static int AdvInitFrom38C1600EEP(ADV_DVC_VAR *);
+static ushort AdvGet3550EEPConfig(AdvPortAddr, ADVEEP_3550_CONFIG *);
+static void AdvSet3550EEPConfig(AdvPortAddr, ADVEEP_3550_CONFIG *);
+static ushort AdvGet38C0800EEPConfig(AdvPortAddr, ADVEEP_38C0800_CONFIG *);
+static void AdvSet38C0800EEPConfig(AdvPortAddr, ADVEEP_38C0800_CONFIG *);
+static ushort AdvGet38C1600EEPConfig(AdvPortAddr, ADVEEP_38C1600_CONFIG *);
+static void AdvSet38C1600EEPConfig(AdvPortAddr, ADVEEP_38C1600_CONFIG *);
+static void AdvWaitEEPCmd(AdvPortAddr);
+static ushort AdvReadEEPWord(AdvPortAddr, int);
 
 /*
  * PCI Bus Definitions
@@ -3241,7 +3214,6 @@ do { \
 #define AdvWriteWordAutoIncLram(iop_base, word) \
      (ADV_MEM_WRITEW((iop_base) + IOPW_RAM_DATA, (word)))
 
-
 /*
  * Define macro to check for Condor signature.
  *
@@ -3313,7 +3285,7 @@ do { \
  * ASC_SCSI_REQ_Q 'done_status' and 'host_status' return values.
  */
 
-#define QD_NO_STATUS         0x00       /* Request not completed yet. */
+#define QD_NO_STATUS         0x00      /* Request not completed yet. */
 #define QD_NO_ERROR          0x01
 #define QD_ABORTED_BY_HOST   0x02
 #define QD_WITH_ERROR        0x04
@@ -3323,30 +3295,29 @@ do { \
 #define QHSTA_M_DATA_OVER_RUN       0x12
 #define QHSTA_M_UNEXPECTED_BUS_FREE 0x13
 #define QHSTA_M_QUEUE_ABORTED       0x15
-#define QHSTA_M_SXFR_SDMA_ERR       0x16 /* SXFR_STATUS SCSI DMA Error */
-#define QHSTA_M_SXFR_SXFR_PERR      0x17 /* SXFR_STATUS SCSI Bus Parity Error */
-#define QHSTA_M_RDMA_PERR           0x18 /* RISC PCI DMA parity error */
-#define QHSTA_M_SXFR_OFF_UFLW       0x19 /* SXFR_STATUS Offset Underflow */
-#define QHSTA_M_SXFR_OFF_OFLW       0x20 /* SXFR_STATUS Offset Overflow */
-#define QHSTA_M_SXFR_WD_TMO         0x21 /* SXFR_STATUS Watchdog Timeout */
-#define QHSTA_M_SXFR_DESELECTED     0x22 /* SXFR_STATUS Deselected */
+#define QHSTA_M_SXFR_SDMA_ERR       0x16       /* SXFR_STATUS SCSI DMA Error */
+#define QHSTA_M_SXFR_SXFR_PERR      0x17       /* SXFR_STATUS SCSI Bus Parity Error */
+#define QHSTA_M_RDMA_PERR           0x18       /* RISC PCI DMA parity error */
+#define QHSTA_M_SXFR_OFF_UFLW       0x19       /* SXFR_STATUS Offset Underflow */
+#define QHSTA_M_SXFR_OFF_OFLW       0x20       /* SXFR_STATUS Offset Overflow */
+#define QHSTA_M_SXFR_WD_TMO         0x21       /* SXFR_STATUS Watchdog Timeout */
+#define QHSTA_M_SXFR_DESELECTED     0x22       /* SXFR_STATUS Deselected */
 /* Note: QHSTA_M_SXFR_XFR_OFLW is identical to QHSTA_M_DATA_OVER_RUN. */
-#define QHSTA_M_SXFR_XFR_OFLW       0x12 /* SXFR_STATUS Transfer Overflow */
-#define QHSTA_M_SXFR_XFR_PH_ERR     0x24 /* SXFR_STATUS Transfer Phase Error */
-#define QHSTA_M_SXFR_UNKNOWN_ERROR  0x25 /* SXFR_STATUS Unknown Error */
-#define QHSTA_M_SCSI_BUS_RESET      0x30 /* Request aborted from SBR */
-#define QHSTA_M_SCSI_BUS_RESET_UNSOL 0x31 /* Request aborted from unsol. SBR */
-#define QHSTA_M_BUS_DEVICE_RESET    0x32 /* Request aborted from BDR */
-#define QHSTA_M_DIRECTION_ERR       0x35 /* Data Phase mismatch */
-#define QHSTA_M_DIRECTION_ERR_HUNG  0x36 /* Data Phase mismatch and bus hang */
+#define QHSTA_M_SXFR_XFR_OFLW       0x12       /* SXFR_STATUS Transfer Overflow */
+#define QHSTA_M_SXFR_XFR_PH_ERR     0x24       /* SXFR_STATUS Transfer Phase Error */
+#define QHSTA_M_SXFR_UNKNOWN_ERROR  0x25       /* SXFR_STATUS Unknown Error */
+#define QHSTA_M_SCSI_BUS_RESET      0x30       /* Request aborted from SBR */
+#define QHSTA_M_SCSI_BUS_RESET_UNSOL 0x31      /* Request aborted from unsol. SBR */
+#define QHSTA_M_BUS_DEVICE_RESET    0x32       /* Request aborted from BDR */
+#define QHSTA_M_DIRECTION_ERR       0x35       /* Data Phase mismatch */
+#define QHSTA_M_DIRECTION_ERR_HUNG  0x36       /* Data Phase mismatch and bus hang */
 #define QHSTA_M_WTM_TIMEOUT         0x41
 #define QHSTA_M_BAD_CMPL_STATUS_IN  0x42
 #define QHSTA_M_NO_AUTO_REQ_SENSE   0x43
 #define QHSTA_M_AUTO_REQ_SENSE_FAIL 0x44
-#define QHSTA_M_INVALID_DEVICE      0x45 /* Bad target ID */
-#define QHSTA_M_FROZEN_TIDQ         0x46 /* TID Queue frozen. */
-#define QHSTA_M_SGBACKUP_ERROR      0x47 /* Scatter-Gather backup error */
-
+#define QHSTA_M_INVALID_DEVICE      0x45       /* Bad target ID */
+#define QHSTA_M_FROZEN_TIDQ         0x46       /* TID Queue frozen. */
+#define QHSTA_M_SGBACKUP_ERROR      0x47       /* Scatter-Gather backup error */
 
 /*
  * Default EEPROM Configuration structure defined in a_init.c.
@@ -3358,12 +3329,12 @@ static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config;
 /*
  * DvcGetPhyAddr() flag arguments
  */
-#define ADV_IS_SCSIQ_FLAG       0x01 /* 'addr' is ASC_SCSI_REQ_Q pointer */
-#define ADV_ASCGETSGLIST_VADDR  0x02 /* 'addr' is AscGetSGList() virtual addr */
-#define ADV_IS_SENSE_FLAG       0x04 /* 'addr' is sense virtual pointer */
-#define ADV_IS_DATA_FLAG        0x08 /* 'addr' is data virtual pointer */
-#define ADV_IS_SGLIST_FLAG      0x10 /* 'addr' is sglist virtual pointer */
-#define ADV_IS_CARRIER_FLAG     0x20 /* 'addr' is ADV_CARR_T pointer */
+#define ADV_IS_SCSIQ_FLAG       0x01   /* 'addr' is ASC_SCSI_REQ_Q pointer */
+#define ADV_ASCGETSGLIST_VADDR  0x02   /* 'addr' is AscGetSGList() virtual addr */
+#define ADV_IS_SENSE_FLAG       0x04   /* 'addr' is sense virtual pointer */
+#define ADV_IS_DATA_FLAG        0x08   /* 'addr' is data virtual pointer */
+#define ADV_IS_SGLIST_FLAG      0x10   /* 'addr' is sglist virtual pointer */
+#define ADV_IS_CARRIER_FLAG     0x20   /* 'addr' is ADV_CARR_T pointer */
 
 /* Return the address that is aligned at the next doubleword >= to 'addr'. */
 #define ADV_8BALIGN(addr)      (((ulong) (addr) + 0x7) & ~0x7)
@@ -3413,43 +3384,42 @@ static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config;
 #define ADV_INQ_CLOCKING(inq)       (((inq)->info & 0x0c) >> 2)
 
 typedef struct {
-  uchar periph;                 /* peripheral device type [0:4] */
-                                /* peripheral qualifier [5:7] */
-  uchar devtype;                /* device type modifier (for SCSI I) [0:6] */
-                                /* RMB - removable medium bit [7] */
-  uchar ver;                    /* ANSI approved version [0:2] */
-                                /* ECMA version [3:5] */
-                                /* ISO version [6:7] */
-  uchar byte3;                  /* response data format [0:3] */
-                                /* 0 SCSI 1 */
-                                /* 1 CCS */
-                                /* 2 SCSI-2 */
-                                /* 3-F reserved */
-                                /* reserved [4:5] */
-                                /* terminate I/O process bit (see 5.6.22) [6] */
-                                /* asynch. event notification (processor) [7] */
-  uchar add_len;                /* additional length */
-  uchar res1;                   /* reserved */
-  uchar res2;                   /* reserved */
-  uchar flags;                  /* soft reset implemented [0] */
-                                /* command queuing [1] */
-                                /* reserved [2] */
-                                /* linked command for this logical unit [3] */
-                                /* synchronous data transfer [4] */
-                                /* wide bus 16 bit data transfer [5] */
-                                /* wide bus 32 bit data transfer [6] */
-                                /* relative addressing mode [7] */
-  uchar vendor_id[8];           /* vendor identification */
-  uchar product_id[16];         /* product identification */
-  uchar product_rev_level[4];   /* product revision level */
-  uchar vendor_specific[20];    /* vendor specific */
-  uchar info;                   /* information unit supported [0] */
-                                /* quick arbitrate supported [1] */
-                                /* clocking field [2:3] */
-                                /* reserved [4:7] */
-  uchar res3;                   /* reserved */
-} ADV_SCSI_INQUIRY; /* 58 bytes */
-
+       uchar periph;           /* peripheral device type [0:4] */
+       /* peripheral qualifier [5:7] */
+       uchar devtype;          /* device type modifier (for SCSI I) [0:6] */
+       /* RMB - removable medium bit [7] */
+       uchar ver;              /* ANSI approved version [0:2] */
+       /* ECMA version [3:5] */
+       /* ISO version [6:7] */
+       uchar byte3;            /* response data format [0:3] */
+       /* 0 SCSI 1 */
+       /* 1 CCS */
+       /* 2 SCSI-2 */
+       /* 3-F reserved */
+       /* reserved [4:5] */
+       /* terminate I/O process bit (see 5.6.22) [6] */
+       /* asynch. event notification (processor) [7] */
+       uchar add_len;          /* additional length */
+       uchar res1;             /* reserved */
+       uchar res2;             /* reserved */
+       uchar flags;            /* soft reset implemented [0] */
+       /* command queuing [1] */
+       /* reserved [2] */
+       /* linked command for this logical unit [3] */
+       /* synchronous data transfer [4] */
+       /* wide bus 16 bit data transfer [5] */
+       /* wide bus 32 bit data transfer [6] */
+       /* relative addressing mode [7] */
+       uchar vendor_id[8];     /* vendor identification */
+       uchar product_id[16];   /* product identification */
+       uchar product_rev_level[4];     /* product revision level */
+       uchar vendor_specific[20];      /* vendor specific */
+       uchar info;             /* information unit supported [0] */
+       /* quick arbitrate supported [1] */
+       /* clocking field [2:3] */
+       /* reserved [4:7] */
+       uchar res3;             /* reserved */
+} ADV_SCSI_INQUIRY;            /* 58 bytes */
 
 /*
  * --- Driver Constants and Macros
@@ -3464,15 +3434,15 @@ typedef struct {
 
 /* asc_board_t flags */
 #define ASC_HOST_IN_RESET       0x01
-#define ASC_IS_WIDE_BOARD       0x04    /* AdvanSys Wide Board */
+#define ASC_IS_WIDE_BOARD       0x04   /* AdvanSys Wide Board */
 #define ASC_SELECT_QUEUE_DEPTHS 0x08
 
 #define ASC_NARROW_BOARD(boardp) (((boardp)->flags & ASC_IS_WIDE_BOARD) == 0)
 #define ASC_WIDE_BOARD(boardp)   ((boardp)->flags & ASC_IS_WIDE_BOARD)
 
-#define NO_ISA_DMA              0xff        /* No ISA DMA Channel Used */
+#define NO_ISA_DMA              0xff   /* No ISA DMA Channel Used */
 
-#define ASC_INFO_SIZE           128            /* advansys_info() line size */
+#define ASC_INFO_SIZE           128    /* advansys_info() line size */
 
 #ifdef CONFIG_PROC_FS
 /* /proc/scsi/advansys/[0...] related definitions */
@@ -3514,7 +3484,7 @@ typedef struct {
  *  REQPTIME(reqp) - reqp's time stamp value
  *  REQTIMESTAMP() - system time stamp value
  */
-typedef struct scsi_cmnd     REQ, *REQP;
+typedef struct scsi_cmnd REQ, *REQP;
 #define REQPNEXT(reqp)       ((REQP) ((reqp)->host_scribble))
 #define REQPNEXTP(reqp)      ((REQP *) &((reqp)->host_scribble))
 #define REQPTID(reqp)        ((reqp)->device->id)
@@ -3564,17 +3534,17 @@ typedef struct scsi_cmnd     REQ, *REQP;
 #define PCI_MAX_SLOT            0x1F
 #define PCI_MAX_BUS             0xFF
 #define PCI_IOADDRESS_MASK      0xFFFE
-#define ASC_PCI_DEVICE_ID_CNT   6       /* PCI Device ID count. */
+#define ASC_PCI_DEVICE_ID_CNT   6      /* PCI Device ID count. */
 
 #ifndef ADVANSYS_STATS
-#define ASC_STATS(shp, counter)
-#define ASC_STATS_ADD(shp, counter, count)
+#define ASC_STATS(shost, counter)
+#define ASC_STATS_ADD(shost, counter, count)
 #else /* ADVANSYS_STATS */
-#define ASC_STATS(shp, counter) \
-    (ASC_BOARDP(shp)->asc_stats.counter++)
+#define ASC_STATS(shost, counter) \
+    (ASC_BOARDP(shost)->asc_stats.counter++)
 
-#define ASC_STATS_ADD(shp, counter, count) \
-    (ASC_BOARDP(shp)->asc_stats.counter += (count))
+#define ASC_STATS_ADD(shost, counter, count) \
+    (ASC_BOARDP(shost)->asc_stats.counter += (count))
 #endif /* ADVANSYS_STATS */
 
 #define ASC_CEILING(val, unit) (((val) + ((unit) - 1))/(unit))
@@ -3617,7 +3587,6 @@ typedef struct scsi_cmnd     REQ, *REQP;
         printk((s), (a1), (a2), (a3), (a4)); \
     }
 
-
 #ifndef ADVANSYS_DEBUG
 
 #define ASC_DBG(lvl, s)
@@ -3746,7 +3715,6 @@ typedef struct scsi_cmnd     REQ, *REQP;
 
 #endif /* ADVANSYS_ASSERT */
 
-
 /*
  * --- Driver Structures
  */
@@ -3755,27 +3723,27 @@ typedef struct scsi_cmnd     REQ, *REQP;
 
 /* Per board statistics structure */
 struct asc_stats {
-    /* Driver Entrypoint Statistics */
-    ADV_DCNT queuecommand;    /* # calls to advansys_queuecommand() */
-    ADV_DCNT reset;           /* # calls to advansys_eh_bus_reset() */
-    ADV_DCNT biosparam;       /* # calls to advansys_biosparam() */
-    ADV_DCNT interrupt;       /* # advansys_interrupt() calls */
-    ADV_DCNT callback;        /* # calls to asc/adv_isr_callback() */
-    ADV_DCNT done;            /* # calls to request's scsi_done function */
-    ADV_DCNT build_error;     /* # asc/adv_build_req() ASC_ERROR returns. */
-    ADV_DCNT adv_build_noreq; /* # adv_build_req() adv_req_t alloc. fail. */
-    ADV_DCNT adv_build_nosg;  /* # adv_build_req() adv_sgblk_t alloc. fail. */
-    /* AscExeScsiQueue()/AdvExeScsiQueue() Statistics */
-    ADV_DCNT exe_noerror;     /* # ASC_NOERROR returns. */
-    ADV_DCNT exe_busy;        /* # ASC_BUSY returns. */
-    ADV_DCNT exe_error;       /* # ASC_ERROR returns. */
-    ADV_DCNT exe_unknown;     /* # unknown returns. */
-    /* Data Transfer Statistics */
-    ADV_DCNT cont_cnt;        /* # non-scatter-gather I/O requests received */
-    ADV_DCNT cont_xfer;       /* # contiguous transfer 512-bytes */
-    ADV_DCNT sg_cnt;          /* # scatter-gather I/O requests received */
-    ADV_DCNT sg_elem;         /* # scatter-gather elements */
-    ADV_DCNT sg_xfer;         /* # scatter-gather transfer 512-bytes */
+       /* Driver Entrypoint Statistics */
+       ADV_DCNT queuecommand;  /* # calls to advansys_queuecommand() */
+       ADV_DCNT reset;         /* # calls to advansys_eh_bus_reset() */
+       ADV_DCNT biosparam;     /* # calls to advansys_biosparam() */
+       ADV_DCNT interrupt;     /* # advansys_interrupt() calls */
+       ADV_DCNT callback;      /* # calls to asc/adv_isr_callback() */
+       ADV_DCNT done;          /* # calls to request's scsi_done function */
+       ADV_DCNT build_error;   /* # asc/adv_build_req() ASC_ERROR returns. */
+       ADV_DCNT adv_build_noreq;       /* # adv_build_req() adv_req_t alloc. fail. */
+       ADV_DCNT adv_build_nosg;        /* # adv_build_req() adv_sgblk_t alloc. fail. */
+       /* AscExeScsiQueue()/AdvExeScsiQueue() Statistics */
+       ADV_DCNT exe_noerror;   /* # ASC_NOERROR returns. */
+       ADV_DCNT exe_busy;      /* # ASC_BUSY returns. */
+       ADV_DCNT exe_error;     /* # ASC_ERROR returns. */
+       ADV_DCNT exe_unknown;   /* # unknown returns. */
+       /* Data Transfer Statistics */
+       ADV_DCNT cont_cnt;      /* # non-scatter-gather I/O requests received */
+       ADV_DCNT cont_xfer;     /* # contiguous transfer 512-bytes */
+       ADV_DCNT sg_cnt;        /* # scatter-gather I/O requests received */
+       ADV_DCNT sg_elem;       /* # scatter-gather elements */
+       ADV_DCNT sg_xfer;       /* # scatter-gather transfer 512-bytes */
 };
 #endif /* ADVANSYS_STATS */
 
@@ -3783,17 +3751,17 @@ struct asc_stats {
  * Request queuing structure
  */
 typedef struct asc_queue {
-    ADV_SCSI_BIT_ID_TYPE  q_tidmask;                /* queue mask */
-    REQP                  q_first[ADV_MAX_TID+1];   /* first queued request */
-    REQP                  q_last[ADV_MAX_TID+1];    /* last queued request */
+       ADV_SCSI_BIT_ID_TYPE q_tidmask; /* queue mask */
+       REQP q_first[ADV_MAX_TID + 1];  /* first queued request */
+       REQP q_last[ADV_MAX_TID + 1];   /* last queued request */
 #ifdef ADVANSYS_STATS
-    short                 q_cur_cnt[ADV_MAX_TID+1]; /* current queue count */
-    short                 q_max_cnt[ADV_MAX_TID+1]; /* maximum queue count */
-    ADV_DCNT              q_tot_cnt[ADV_MAX_TID+1]; /* total enqueue count */
-    ADV_DCNT              q_tot_tim[ADV_MAX_TID+1]; /* total time queued */
-    ushort                q_max_tim[ADV_MAX_TID+1]; /* maximum time queued */
-    ushort                q_min_tim[ADV_MAX_TID+1]; /* minimum time queued */
-#endif /* ADVANSYS_STATS */
+       short q_cur_cnt[ADV_MAX_TID + 1];       /* current queue count */
+       short q_max_cnt[ADV_MAX_TID + 1];       /* maximum queue count */
+       ADV_DCNT q_tot_cnt[ADV_MAX_TID + 1];    /* total enqueue count */
+       ADV_DCNT q_tot_tim[ADV_MAX_TID + 1];    /* total time queued */
+       ushort q_max_tim[ADV_MAX_TID + 1];      /* maximum time queued */
+       ushort q_min_tim[ADV_MAX_TID + 1];      /* minimum time queued */
+#endif                         /* ADVANSYS_STATS */
 } asc_queue_t;
 
 /*
@@ -3814,17 +3782,17 @@ typedef struct asc_queue {
  * Both structures must be 32 byte aligned.
  */
 typedef struct adv_sgblk {
-    ADV_SG_BLOCK        sg_block;     /* Sgblock structure. */
-    uchar               align[32];    /* Sgblock structure padding. */
-    struct adv_sgblk    *next_sgblkp; /* Next scatter-gather structure. */
+       ADV_SG_BLOCK sg_block;  /* Sgblock structure. */
+       uchar align[32];        /* Sgblock structure padding. */
+       struct adv_sgblk *next_sgblkp;  /* Next scatter-gather structure. */
 } adv_sgblk_t;
 
 typedef struct adv_req {
-    ADV_SCSI_REQ_Q      scsi_req_q;   /* Adv Library request structure. */
-    uchar               align[32];    /* Request structure padding. */
-    struct scsi_cmnd   *cmndp;       /* Mid-Level SCSI command pointer. */
-    adv_sgblk_t         *sgblkp;      /* Adv Library scatter-gather pointer. */
-    struct adv_req      *next_reqp;   /* Next Request Structure. */
+       ADV_SCSI_REQ_Q scsi_req_q;      /* Adv Library request structure. */
+       uchar align[32];        /* Request structure padding. */
+       struct scsi_cmnd *cmndp;        /* Mid-Level SCSI command pointer. */
+       adv_sgblk_t *sgblkp;    /* Adv Library scatter-gather pointer. */
+       struct adv_req *next_reqp;      /* Next Request Structure. */
 } adv_req_t;
 
 /*
@@ -3835,113 +3803,109 @@ typedef struct adv_req {
  * field. It is guaranteed to be allocated from DMA-able memory.
  */
 typedef struct asc_board {
-    int                  id;                    /* Board Id */
-    uint                 flags;                 /* Board flags */
-    union {
-        ASC_DVC_VAR      asc_dvc_var;           /* Narrow board */
-        ADV_DVC_VAR      adv_dvc_var;           /* Wide board */
-    } dvc_var;
-    union {
-        ASC_DVC_CFG      asc_dvc_cfg;           /* Narrow board */
-        ADV_DVC_CFG      adv_dvc_cfg;           /* Wide board */
-    } dvc_cfg;
-    ushort               asc_n_io_port;         /* Number I/O ports. */
-    asc_queue_t          active;                /* Active command queue */
-    asc_queue_t          waiting;               /* Waiting command queue */
-    asc_queue_t          done;                  /* Done command queue */
-    ADV_SCSI_BIT_ID_TYPE init_tidmask;          /* Target init./valid mask */
-    struct scsi_device *device[ADV_MAX_TID+1]; /* Mid-Level Scsi Device */
-    ushort               reqcnt[ADV_MAX_TID+1]; /* Starvation request count */
-    ADV_SCSI_BIT_ID_TYPE queue_full;            /* Queue full mask */
-    ushort               queue_full_cnt[ADV_MAX_TID+1]; /* Queue full count */
-    union {
-        ASCEEP_CONFIG         asc_eep;          /* Narrow EEPROM config. */
-        ADVEEP_3550_CONFIG    adv_3550_eep;     /* 3550 EEPROM config. */
-        ADVEEP_38C0800_CONFIG adv_38C0800_eep;  /* 38C0800 EEPROM config. */
-        ADVEEP_38C1600_CONFIG adv_38C1600_eep;  /* 38C1600 EEPROM config. */
-    } eep_config;
-    ulong                last_reset;            /* Saved last reset time */
-    spinlock_t lock;                            /* Board spinlock */
+       int id;                 /* Board Id */
+       uint flags;             /* Board flags */
+       union {
+               ASC_DVC_VAR asc_dvc_var;        /* Narrow board */
+               ADV_DVC_VAR adv_dvc_var;        /* Wide board */
+       } dvc_var;
+       union {
+               ASC_DVC_CFG asc_dvc_cfg;        /* Narrow board */
+               ADV_DVC_CFG adv_dvc_cfg;        /* Wide board */
+       } dvc_cfg;
+       ushort asc_n_io_port;   /* Number I/O ports. */
+       asc_queue_t active;     /* Active command queue */
+       asc_queue_t waiting;    /* Waiting command queue */
+       asc_queue_t done;       /* Done command queue */
+       ADV_SCSI_BIT_ID_TYPE init_tidmask;      /* Target init./valid mask */
+       struct scsi_device *device[ADV_MAX_TID + 1];    /* Mid-Level Scsi Device */
+       ushort reqcnt[ADV_MAX_TID + 1]; /* Starvation request count */
+       ADV_SCSI_BIT_ID_TYPE queue_full;        /* Queue full mask */
+       ushort queue_full_cnt[ADV_MAX_TID + 1]; /* Queue full count */
+       union {
+               ASCEEP_CONFIG asc_eep;  /* Narrow EEPROM config. */
+               ADVEEP_3550_CONFIG adv_3550_eep;        /* 3550 EEPROM config. */
+               ADVEEP_38C0800_CONFIG adv_38C0800_eep;  /* 38C0800 EEPROM config. */
+               ADVEEP_38C1600_CONFIG adv_38C1600_eep;  /* 38C1600 EEPROM config. */
+       } eep_config;
+       ulong last_reset;       /* Saved last reset time */
+       spinlock_t lock;        /* Board spinlock */
 #ifdef CONFIG_PROC_FS
-    /* /proc/scsi/advansys/[0...] */
-    char                 *prtbuf;               /* /proc print buffer */
-#endif /* CONFIG_PROC_FS */
+       /* /proc/scsi/advansys/[0...] */
+       char *prtbuf;           /* /proc print buffer */
+#endif                         /* CONFIG_PROC_FS */
 #ifdef ADVANSYS_STATS
-    struct asc_stats     asc_stats;             /* Board statistics */
-#endif /* ADVANSYS_STATS */
-    /*
-     * The following fields are used only for Narrow Boards.
-     */
-    /* The following three structures must be in DMA-able memory. */
-    ASC_SCSI_REQ_Q       scsireqq;
-    ASC_CAP_INFO         cap_info;
-    ASC_SCSI_INQUIRY     inquiry;
-    uchar                sdtr_data[ASC_MAX_TID+1]; /* SDTR information */
-    /*
-     * The following fields are used only for Wide Boards.
-     */
-    void                 __iomem *ioremap_addr; /* I/O Memory remap address. */
-    ushort               ioport;                /* I/O Port address. */
-    ADV_CARR_T           *orig_carrp;           /* ADV_CARR_T memory block. */
-    adv_req_t            *orig_reqp;            /* adv_req_t memory block. */
-    adv_req_t            *adv_reqp;             /* Request structures. */
-    adv_sgblk_t          *adv_sgblkp;           /* Scatter-gather structures. */
-    ushort               bios_signature;        /* BIOS Signature. */
-    ushort               bios_version;          /* BIOS Version. */
-    ushort               bios_codeseg;          /* BIOS Code Segment. */
-    ushort               bios_codelen;          /* BIOS Code Segment Length. */
+       struct asc_stats asc_stats;     /* Board statistics */
+#endif                         /* ADVANSYS_STATS */
+       /*
+        * The following fields are used only for Narrow Boards.
+        */
+       /* The following three structures must be in DMA-able memory. */
+       ASC_SCSI_REQ_Q scsireqq;
+       ASC_CAP_INFO cap_info;
+       ASC_SCSI_INQUIRY inquiry;
+       uchar sdtr_data[ASC_MAX_TID + 1];       /* SDTR information */
+       /*
+        * The following fields are used only for Wide Boards.
+        */
+       void __iomem *ioremap_addr;     /* I/O Memory remap address. */
+       ushort ioport;          /* I/O Port address. */
+       ADV_CARR_T *orig_carrp; /* ADV_CARR_T memory block. */
+       adv_req_t *orig_reqp;   /* adv_req_t memory block. */
+       adv_req_t *adv_reqp;    /* Request structures. */
+       adv_sgblk_t *adv_sgblkp;        /* Scatter-gather structures. */
+       ushort bios_signature;  /* BIOS Signature. */
+       ushort bios_version;    /* BIOS Version. */
+       ushort bios_codeseg;    /* BIOS Code Segment. */
+       ushort bios_codelen;    /* BIOS Code Segment Length. */
 } asc_board_t;
 
 /*
  * PCI configuration structures
  */
-typedef struct _PCI_DATA_
-{
-    uchar    type;
-    uchar    bus;
-    uchar    slot;
-    uchar    func;
-    uchar    offset;
+typedef struct _PCI_DATA_ {
+       uchar type;
+       uchar bus;
+       uchar slot;
+       uchar func;
+       uchar offset;
 } PCI_DATA;
 
-typedef struct _PCI_DEVICE_
-{
-    ushort   vendorID;
-    ushort   deviceID;
-    ushort   slotNumber;
-    ushort   slotFound;
-    uchar    busNumber;
-    uchar    maxBusNumber;
-    uchar    devFunc;
-    ushort   startSlot;
-    ushort   endSlot;
-    uchar    bridge;
-    uchar    type;
+typedef struct _PCI_DEVICE_ {
+       ushort vendorID;
+       ushort deviceID;
+       ushort slotNumber;
+       ushort slotFound;
+       uchar busNumber;
+       uchar maxBusNumber;
+       uchar devFunc;
+       ushort startSlot;
+       ushort endSlot;
+       uchar bridge;
+       uchar type;
 } PCI_DEVICE;
 
-typedef struct _PCI_CONFIG_SPACE_
-{
-    ushort   vendorID;
-    ushort   deviceID;
-    ushort   command;
-    ushort   status;
-    uchar    revision;
-    uchar    classCode[3];
-    uchar    cacheSize;
-    uchar    latencyTimer;
-    uchar    headerType;
-    uchar    bist;
-    ADV_PADDR baseAddress[6];
-    ushort   reserved[4];
-    ADV_PADDR optionRomAddr;
-    ushort   reserved2[4];
-    uchar    irqLine;
-    uchar    irqPin;
-    uchar    minGnt;
-    uchar    maxLatency;
+typedef struct _PCI_CONFIG_SPACE_ {
+       ushort vendorID;
+       ushort deviceID;
+       ushort command;
+       ushort status;
+       uchar revision;
+       uchar classCode[3];
+       uchar cacheSize;
+       uchar latencyTimer;
+       uchar headerType;
+       uchar bist;
+       ADV_PADDR baseAddress[6];
+       ushort reserved[4];
+       ADV_PADDR optionRomAddr;
+       ushort reserved2[4];
+       uchar irqLine;
+       uchar irqPin;
+       uchar minGnt;
+       uchar maxLatency;
 } PCI_CONFIG_SPACE;
 
-
 /*
  * --- Driver Data
  */
@@ -3949,44 +3913,42 @@ typedef struct _PCI_CONFIG_SPACE_
 /* Note: All driver global data should be initialized. */
 
 /* Number of boards detected in system. */
-STATIC int asc_board_count = 0;
-STATIC struct Scsi_Host    *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL };
+static int asc_board_count = 0;
+static struct Scsi_Host *asc_host[ASC_NUM_BOARD_SUPPORTED] = { NULL };
 
 /* Overrun buffer used by all narrow boards. */
-STATIC uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 };
+static uchar overrun_buf[ASC_OVERRUN_BSIZE] = { 0 };
 
 /*
  * Global structures required to issue a command.
  */
-STATIC ASC_SCSI_Q asc_scsi_q = { { 0 } };
-STATIC ASC_SG_HEAD asc_sg_head = { 0 };
+static ASC_SCSI_Q asc_scsi_q = { {0} };
+static ASC_SG_HEAD asc_sg_head = { 0 };
 
 /* List of supported bus types. */
-STATIC ushort asc_bus[ASC_NUM_BUS] __initdata = {
-    ASC_IS_ISA,
-    ASC_IS_VL,
-    ASC_IS_EISA,
-    ASC_IS_PCI,
+static ushort asc_bus[ASC_NUM_BUS] __initdata = {
+       ASC_IS_ISA,
+       ASC_IS_VL,
+       ASC_IS_EISA,
+       ASC_IS_PCI,
 };
 
-STATIC int asc_iopflag = ASC_FALSE;
-STATIC int asc_ioport[ASC_NUM_IOPORT_PROBE] = { 0, 0, 0, 0 };
+static int asc_iopflag = ASC_FALSE;
+static int asc_ioport[ASC_NUM_IOPORT_PROBE] = { 0, 0, 0, 0 };
 
 #ifdef ADVANSYS_DEBUG
-STATIC char *
-asc_bus_name[ASC_NUM_BUS] = {
-    "ASC_IS_ISA",
-    "ASC_IS_VL",
-    "ASC_IS_EISA",
-    "ASC_IS_PCI",
+static char *asc_bus_name[ASC_NUM_BUS] = {
+       "ASC_IS_ISA",
+       "ASC_IS_VL",
+       "ASC_IS_EISA",
+       "ASC_IS_PCI",
 };
 
-STATIC int          asc_dbglvl = 3;
+static int asc_dbglvl = 3;
 #endif /* ADVANSYS_DEBUG */
 
 /* Declaration for Asc Library internal data referenced by driver. */
-STATIC PortAddr     _asc_def_iop_base[];
-
+static PortAddr _asc_def_iop_base[];
 
 /*
  * --- Driver Function Prototypes
@@ -3994,62 +3956,61 @@ STATIC PortAddr     _asc_def_iop_base[];
  * advansys.h contains function prototypes for functions global to Linux.
  */
 
-STATIC irqreturn_t advansys_interrupt(int, void *);
-STATIC int       advansys_slave_configure(struct scsi_device *);
-STATIC void       asc_scsi_done_list(struct scsi_cmnd *);
-STATIC int        asc_execute_scsi_cmnd(struct scsi_cmnd *);
-STATIC int        asc_build_req(asc_board_t *, struct scsi_cmnd *);
-STATIC int        adv_build_req(asc_board_t *, struct scsi_cmnd *, ADV_SCSI_REQ_Q **);
-STATIC int        adv_get_sglist(asc_board_t *, adv_req_t *, struct scsi_cmnd *, int);
-STATIC void       asc_isr_callback(ASC_DVC_VAR *, ASC_QDONE_INFO *);
-STATIC void       adv_isr_callback(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *);
-STATIC void       adv_async_callback(ADV_DVC_VAR *, uchar);
-STATIC void       asc_enqueue(asc_queue_t *, REQP, int);
-STATIC REQP       asc_dequeue(asc_queue_t *, int);
-STATIC REQP       asc_dequeue_list(asc_queue_t *, REQP *, int);
-STATIC int        asc_rmqueue(asc_queue_t *, REQP);
-STATIC void       asc_execute_queue(asc_queue_t *);
+static irqreturn_t advansys_interrupt(int, void *);
+static int advansys_slave_configure(struct scsi_device *);
+static void asc_scsi_done_list(struct scsi_cmnd *);
+static int asc_execute_scsi_cmnd(struct scsi_cmnd *);
+static int asc_build_req(asc_board_t *, struct scsi_cmnd *);
+static int adv_build_req(asc_board_t *, struct scsi_cmnd *, ADV_SCSI_REQ_Q **);
+static int adv_get_sglist(asc_board_t *, adv_req_t *, struct scsi_cmnd *, int);
+static void asc_isr_callback(ASC_DVC_VAR *, ASC_QDONE_INFO *);
+static void adv_isr_callback(ADV_DVC_VAR *, ADV_SCSI_REQ_Q *);
+static void adv_async_callback(ADV_DVC_VAR *, uchar);
+static void asc_enqueue(asc_queue_t *, REQP, int);
+static REQP asc_dequeue(asc_queue_t *, int);
+static REQP asc_dequeue_list(asc_queue_t *, REQP *, int);
+static int asc_rmqueue(asc_queue_t *, REQP);
+static void asc_execute_queue(asc_queue_t *);
 #ifdef CONFIG_PROC_FS
-STATIC int        asc_proc_copy(off_t, off_t, char *, int , char *, int);
-STATIC int        asc_prt_board_devices(struct Scsi_Host *, char *, int);
-STATIC int        asc_prt_adv_bios(struct Scsi_Host *, char *, int);
-STATIC int        asc_get_eeprom_string(ushort *serialnum, uchar *cp);
-STATIC int        asc_prt_asc_board_eeprom(struct Scsi_Host *, char *, int);
-STATIC int        asc_prt_adv_board_eeprom(struct Scsi_Host *, char *, int);
-STATIC int        asc_prt_driver_conf(struct Scsi_Host *, char *, int);
-STATIC int        asc_prt_asc_board_info(struct Scsi_Host *, char *, int);
-STATIC int        asc_prt_adv_board_info(struct Scsi_Host *, char *, int);
-STATIC int        asc_prt_line(char *, int, char *fmt, ...);
+static int asc_proc_copy(off_t, off_t, char *, int, char *, int);
+static int asc_prt_board_devices(struct Scsi_Host *, char *, int);
+static int asc_prt_adv_bios(struct Scsi_Host *, char *, int);
+static int asc_get_eeprom_string(ushort *serialnum, uchar *cp);
+static int asc_prt_asc_board_eeprom(struct Scsi_Host *, char *, int);
+static int asc_prt_adv_board_eeprom(struct Scsi_Host *, char *, int);
+static int asc_prt_driver_conf(struct Scsi_Host *, char *, int);
+static int asc_prt_asc_board_info(struct Scsi_Host *, char *, int);
+static int asc_prt_adv_board_info(struct Scsi_Host *, char *, int);
+static int asc_prt_line(char *, int, char *fmt, ...);
 #endif /* CONFIG_PROC_FS */
 
 /* Declaration for Asc Library internal functions referenced by driver. */
-STATIC int          AscFindSignature(PortAddr);
-STATIC ushort       AscGetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort);
+static int AscFindSignature(PortAddr);
+static ushort AscGetEEPConfig(PortAddr, ASCEEP_CONFIG *, ushort);
 
 /* Statistics function prototypes. */
 #ifdef ADVANSYS_STATS
 #ifdef CONFIG_PROC_FS
-STATIC int          asc_prt_board_stats(struct Scsi_Host *, char *, int);
-STATIC int          asc_prt_target_stats(struct Scsi_Host *, int, char *, int);
+static int asc_prt_board_stats(struct Scsi_Host *, char *, int);
+static int asc_prt_target_stats(struct Scsi_Host *, int, char *, int);
 #endif /* CONFIG_PROC_FS */
 #endif /* ADVANSYS_STATS */
 
 /* Debug function prototypes. */
 #ifdef ADVANSYS_DEBUG
-STATIC void         asc_prt_scsi_host(struct Scsi_Host *);
-STATIC void         asc_prt_scsi_cmnd(struct scsi_cmnd *);
-STATIC void         asc_prt_asc_dvc_cfg(ASC_DVC_CFG *);
-STATIC void         asc_prt_asc_dvc_var(ASC_DVC_VAR *);
-STATIC void         asc_prt_asc_scsi_q(ASC_SCSI_Q *);
-STATIC void         asc_prt_asc_qdone_info(ASC_QDONE_INFO *);
-STATIC void         asc_prt_adv_dvc_cfg(ADV_DVC_CFG *);
-STATIC void         asc_prt_adv_dvc_var(ADV_DVC_VAR *);
-STATIC void         asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *);
-STATIC void         asc_prt_adv_sgblock(int, ADV_SG_BLOCK *);
-STATIC void         asc_prt_hex(char *f, uchar *, int);
+static void asc_prt_scsi_host(struct Scsi_Host *);
+static void asc_prt_scsi_cmnd(struct scsi_cmnd *);
+static void asc_prt_asc_dvc_cfg(ASC_DVC_CFG *);
+static void asc_prt_asc_dvc_var(ASC_DVC_VAR *);
+static void asc_prt_asc_scsi_q(ASC_SCSI_Q *);
+static void asc_prt_asc_qdone_info(ASC_QDONE_INFO *);
+static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG *);
+static void asc_prt_adv_dvc_var(ADV_DVC_VAR *);
+static void asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *);
+static void asc_prt_adv_sgblock(int, ADV_SG_BLOCK *);
+static void asc_prt_hex(char *f, uchar *, int);
 #endif /* ADVANSYS_DEBUG */
 
-
 #ifdef CONFIG_PROC_FS
 /*
  * advansys_proc_info() - /proc/scsi/advansys/[0-(ASC_NUM_BOARD_SUPPORTED-1)]
@@ -4073,1389 +4034,210 @@ STATIC void         asc_prt_hex(char *f, uchar *, int);
  */
 static int
 advansys_proc_info(struct Scsi_Host *shost, char *buffer, char **start,
-               off_t offset, int length, int inout)
+                  off_t offset, int length, int inout)
 {
-    struct Scsi_Host    *shp;
-    asc_board_t         *boardp;
-    int                 i;
-    char                *cp;
-    int                        cplen;
-    int                 cnt;
-    int                 totcnt;
-    int                 leftlen;
-    char                *curbuf;
-    off_t               advoffset;
+       struct Scsi_Host *shp;
+       asc_board_t *boardp;
+       int i;
+       char *cp;
+       int cplen;
+       int cnt;
+       int totcnt;
+       int leftlen;
+       char *curbuf;
+       off_t advoffset;
 #ifdef ADVANSYS_STATS
-    int                 tgt_id;
+       int tgt_id;
 #endif /* ADVANSYS_STATS */
 
-    ASC_DBG(1, "advansys_proc_info: begin\n");
-
-    /*
-     * User write not supported.
-     */
-    if (inout == TRUE) {
-        return(-ENOSYS);
-    }
-
-    /*
-     * User read of /proc/scsi/advansys/[0...] file.
-     */
-
-    /* Find the specified board. */
-    for (i = 0; i < asc_board_count; i++) {
-        if (asc_host[i]->host_no == shost->host_no) {
-            break;
-        }
-    }
-    if (i == asc_board_count) {
-        return(-ENOENT);
-    }
-
-    shp = asc_host[i];
-    boardp = ASC_BOARDP(shp);
+       ASC_DBG(1, "advansys_proc_info: begin\n");
 
-    /* Copy read data starting at the beginning of the buffer. */
-    *start = buffer;
-    curbuf = buffer;
-    advoffset = 0;
-    totcnt = 0;
-    leftlen = length;
-
-    /*
-     * Get board configuration information.
-     *
-     * advansys_info() returns the board string from its own static buffer.
-     */
-    cp = (char *) advansys_info(shp);
-    strcat(cp, "\n");
-    cplen = strlen(cp);
-    /* Copy board information. */
-    cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-    totcnt += cnt;
-    leftlen -= cnt;
-    if (leftlen == 0) {
-        ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-        return totcnt;
-    }
-    advoffset += cplen;
-    curbuf += cnt;
+       /*
+        * User write not supported.
+        */
+       if (inout == TRUE) {
+               return (-ENOSYS);
+       }
 
-    /*
-     * Display Wide Board BIOS Information.
-     */
-    if (ASC_WIDE_BOARD(boardp)) {
-        cp = boardp->prtbuf;
-        cplen = asc_prt_adv_bios(shp, cp, ASC_PRTBUF_SIZE);
-        ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
-        cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-        totcnt += cnt;
-        leftlen -= cnt;
-        if (leftlen == 0) {
-            ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-            return totcnt;
-        }
-        advoffset += cplen;
-        curbuf += cnt;
-    }
+       /*
+        * User read of /proc/scsi/advansys/[0...] file.
+        */
 
-    /*
-     * Display driver information for each device attached to the board.
-     */
-    cp = boardp->prtbuf;
-    cplen = asc_prt_board_devices(shp, cp, ASC_PRTBUF_SIZE);
-    ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
-    cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-    totcnt += cnt;
-    leftlen -= cnt;
-    if (leftlen == 0) {
-        ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-        return totcnt;
-    }
-    advoffset += cplen;
-    curbuf += cnt;
+       /* Find the specified board. */
+       for (i = 0; i < asc_board_count; i++) {
+               if (asc_host[i]->host_no == shost->host_no) {
+                       break;
+               }
+       }
+       if (i == asc_board_count) {
+               return (-ENOENT);
+       }
 
-    /*
-     * Display EEPROM configuration for the board.
-     */
-    cp = boardp->prtbuf;
-    if (ASC_NARROW_BOARD(boardp)) {
-        cplen = asc_prt_asc_board_eeprom(shp, cp, ASC_PRTBUF_SIZE);
-    } else {
-        cplen = asc_prt_adv_board_eeprom(shp, cp, ASC_PRTBUF_SIZE);
-    }
-    ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
-    cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-    totcnt += cnt;
-    leftlen -= cnt;
-    if (leftlen == 0) {
-        ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-        return totcnt;
-    }
-    advoffset += cplen;
-    curbuf += cnt;
+       shp = asc_host[i];
+       boardp = ASC_BOARDP(shp);
+
+       /* Copy read data starting at the beginning of the buffer. */
+       *start = buffer;
+       curbuf = buffer;
+       advoffset = 0;
+       totcnt = 0;
+       leftlen = length;
+
+       /*
+        * Get board configuration information.
+        *
+        * advansys_info() returns the board string from its own static buffer.
+        */
+       cp = (char *)advansys_info(shp);
+       strcat(cp, "\n");
+       cplen = strlen(cp);
+       /* Copy board information. */
+       cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
+       totcnt += cnt;
+       leftlen -= cnt;
+       if (leftlen == 0) {
+               ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+               return totcnt;
+       }
+       advoffset += cplen;
+       curbuf += cnt;
+
+       /*
+        * Display Wide Board BIOS Information.
+        */
+       if (ASC_WIDE_BOARD(boardp)) {
+               cp = boardp->prtbuf;
+               cplen = asc_prt_adv_bios(shp, cp, ASC_PRTBUF_SIZE);
+               ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
+               cnt =
+                   asc_proc_copy(advoffset, offset, curbuf, leftlen, cp,
+                                 cplen);
+               totcnt += cnt;
+               leftlen -= cnt;
+               if (leftlen == 0) {
+                       ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+                       return totcnt;
+               }
+               advoffset += cplen;
+               curbuf += cnt;
+       }
 
-    /*
-     * Display driver configuration and information for the board.
-     */
-    cp = boardp->prtbuf;
-    cplen = asc_prt_driver_conf(shp, cp, ASC_PRTBUF_SIZE);
-    ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
-    cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-    totcnt += cnt;
-    leftlen -= cnt;
-    if (leftlen == 0) {
-        ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-        return totcnt;
-    }
-    advoffset += cplen;
-    curbuf += cnt;
+       /*
+        * Display driver information for each device attached to the board.
+        */
+       cp = boardp->prtbuf;
+       cplen = asc_prt_board_devices(shp, cp, ASC_PRTBUF_SIZE);
+       ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
+       cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
+       totcnt += cnt;
+       leftlen -= cnt;
+       if (leftlen == 0) {
+               ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+               return totcnt;
+       }
+       advoffset += cplen;
+       curbuf += cnt;
+
+       /*
+        * Display EEPROM configuration for the board.
+        */
+       cp = boardp->prtbuf;
+       if (ASC_NARROW_BOARD(boardp)) {
+               cplen = asc_prt_asc_board_eeprom(shp, cp, ASC_PRTBUF_SIZE);
+       } else {
+               cplen = asc_prt_adv_board_eeprom(shp, cp, ASC_PRTBUF_SIZE);
+       }
+       ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
+       cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
+       totcnt += cnt;
+       leftlen -= cnt;
+       if (leftlen == 0) {
+               ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+               return totcnt;
+       }
+       advoffset += cplen;
+       curbuf += cnt;
+
+       /*
+        * Display driver configuration and information for the board.
+        */
+       cp = boardp->prtbuf;
+       cplen = asc_prt_driver_conf(shp, cp, ASC_PRTBUF_SIZE);
+       ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
+       cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
+       totcnt += cnt;
+       leftlen -= cnt;
+       if (leftlen == 0) {
+               ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+               return totcnt;
+       }
+       advoffset += cplen;
+       curbuf += cnt;
 
 #ifdef ADVANSYS_STATS
-    /*
-     * Display driver statistics for the board.
-     */
-    cp = boardp->prtbuf;
-    cplen = asc_prt_board_stats(shp, cp, ASC_PRTBUF_SIZE);
-    ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE);
-    cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-    totcnt += cnt;
-    leftlen -= cnt;
-    if (leftlen == 0) {
-        ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-        return totcnt;
-    }
-    advoffset += cplen;
-    curbuf += cnt;
-
-    /*
-     * Display driver statistics for each target.
-     */
-    for (tgt_id = 0; tgt_id <= ADV_MAX_TID; tgt_id++) {
-      cp = boardp->prtbuf;
-      cplen = asc_prt_target_stats(shp, tgt_id, cp, ASC_PRTBUF_SIZE);
-      ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE);
-      cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-      totcnt += cnt;
-      leftlen -= cnt;
-      if (leftlen == 0) {
-        ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-        return totcnt;
-      }
-      advoffset += cplen;
-      curbuf += cnt;
-    }
+       /*
+        * Display driver statistics for the board.
+        */
+       cp = boardp->prtbuf;
+       cplen = asc_prt_board_stats(shp, cp, ASC_PRTBUF_SIZE);
+       ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE);
+       cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
+       totcnt += cnt;
+       leftlen -= cnt;
+       if (leftlen == 0) {
+               ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+               return totcnt;
+       }
+       advoffset += cplen;
+       curbuf += cnt;
+
+       /*
+        * Display driver statistics for each target.
+        */
+       for (tgt_id = 0; tgt_id <= ADV_MAX_TID; tgt_id++) {
+               cp = boardp->prtbuf;
+               cplen = asc_prt_target_stats(shp, tgt_id, cp, ASC_PRTBUF_SIZE);
+               ASC_ASSERT(cplen <= ASC_PRTBUF_SIZE);
+               cnt =
+                   asc_proc_copy(advoffset, offset, curbuf, leftlen, cp,
+                                 cplen);
+               totcnt += cnt;
+               leftlen -= cnt;
+               if (leftlen == 0) {
+                       ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+                       return totcnt;
+               }
+               advoffset += cplen;
+               curbuf += cnt;
+       }
 #endif /* ADVANSYS_STATS */
 
-    /*
-     * Display Asc Library dynamic configuration information
-     * for the board.
-     */
-    cp = boardp->prtbuf;
-    if (ASC_NARROW_BOARD(boardp)) {
-        cplen = asc_prt_asc_board_info(shp, cp, ASC_PRTBUF_SIZE);
-    } else {
-        cplen = asc_prt_adv_board_info(shp, cp, ASC_PRTBUF_SIZE);
-    }
-    ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
-    cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
-    totcnt += cnt;
-    leftlen -= cnt;
-    if (leftlen == 0) {
-        ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-        return totcnt;
-    }
-    advoffset += cplen;
-    curbuf += cnt;
-
-    ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
-
-    return totcnt;
-}
-#endif /* CONFIG_PROC_FS */
-
-/*
- * advansys_detect()
- *
- * Detect function for AdvanSys adapters.
- *
- * Argument is a pointer to the host driver's scsi_hosts entry.
- *
- * Return number of adapters found.
- *
- * Note: Because this function is called during system initialization
- * it must not call SCSI mid-level functions including scsi_malloc()
- * and scsi_free().
- */
-static int __init
-advansys_detect(struct scsi_host_template *tpnt)
-{
-    static int          detect_called = ASC_FALSE;
-    int                 iop;
-    int                 bus;
-    struct Scsi_Host    *shp = NULL;
-    asc_board_t         *boardp = NULL;
-    ASC_DVC_VAR         *asc_dvc_varp = NULL;
-    ADV_DVC_VAR         *adv_dvc_varp = NULL;
-    adv_sgblk_t         *sgp = NULL;
-    int                 ioport = 0;
-    int                 share_irq = FALSE;
-    int                 iolen = 0;
-    struct device      *dev = NULL;
-#ifdef CONFIG_PCI
-    int                 pci_init_search = 0;
-    struct pci_dev      *pci_devicep[ASC_NUM_BOARD_SUPPORTED];
-    int                 pci_card_cnt_max = 0;
-    int                 pci_card_cnt = 0;
-    struct pci_dev      *pci_devp = NULL;
-    int                 pci_device_id_cnt = 0;
-    unsigned int        pci_device_id[ASC_PCI_DEVICE_ID_CNT] = {
-                                    PCI_DEVICE_ID_ASP_1200A,
-                                    PCI_DEVICE_ID_ASP_ABP940,
-                                    PCI_DEVICE_ID_ASP_ABP940U,
-                                    PCI_DEVICE_ID_ASP_ABP940UW,
-                                    PCI_DEVICE_ID_38C0800_REV1,
-                                    PCI_DEVICE_ID_38C1600_REV1
-                        };
-    ADV_PADDR           pci_memory_address;
-#endif /* CONFIG_PCI */
-    int                 warn_code, err_code;
-    int                 ret;
-
-    if (detect_called == ASC_FALSE) {
-        detect_called = ASC_TRUE;
-    } else {
-        printk("AdvanSys SCSI: advansys_detect() multiple calls ignored\n");
-        return 0;
-    }
-
-    ASC_DBG(1, "advansys_detect: begin\n");
-
-    asc_board_count = 0;
-
-    /*
-     * If I/O port probing has been modified, then verify and
-     * clean-up the 'asc_ioport' list.
-     */
-    if (asc_iopflag == ASC_TRUE) {
-        for (ioport = 0; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
-            ASC_DBG2(1, "advansys_detect: asc_ioport[%d] 0x%x\n",
-                ioport, asc_ioport[ioport]);
-            if (asc_ioport[ioport] != 0) {
-                for (iop = 0; iop < ASC_IOADR_TABLE_MAX_IX; iop++) {
-                    if (_asc_def_iop_base[iop] == asc_ioport[ioport]) {
-                        break;
-                    }
-                }
-                if (iop == ASC_IOADR_TABLE_MAX_IX) {
-                    printk(
-"AdvanSys SCSI: specified I/O Port 0x%X is invalid\n",
-                        asc_ioport[ioport]);
-                    asc_ioport[ioport] = 0;
-                }
-            }
-        }
-        ioport = 0;
-    }
-
-    for (bus = 0; bus < ASC_NUM_BUS; bus++) {
-
-        ASC_DBG2(1, "advansys_detect: bus search type %d (%s)\n",
-            bus, asc_bus_name[bus]);
-        iop = 0;
-
-        while (asc_board_count < ASC_NUM_BOARD_SUPPORTED) {
-
-            ASC_DBG1(2, "advansys_detect: asc_board_count %d\n",
-                asc_board_count);
-
-            switch (asc_bus[bus]) {
-            case ASC_IS_ISA:
-            case ASC_IS_VL:
-#ifdef CONFIG_ISA
-                if (asc_iopflag == ASC_FALSE) {
-                    iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
-                } else {
-                    /*
-                     * ISA and VL I/O port scanning has either been
-                     * eliminated or limited to selected ports on
-                     * the LILO command line, /etc/lilo.conf, or
-                     * by setting variables when the module was loaded.
-                     */
-                    ASC_DBG(1, "advansys_detect: I/O port scanning modified\n");
-                ioport_try_again:
-                    iop = 0;
-                    for (; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
-                        if ((iop = asc_ioport[ioport]) != 0) {
-                            break;
-                        }
-                    }
-                    if (iop) {
-                        ASC_DBG1(1,
-                                "advansys_detect: probing I/O port 0x%x...\n",
-                            iop);
-                       if (!request_region(iop, ASC_IOADR_GAP, "advansys")){
-                            printk(
-"AdvanSys SCSI: specified I/O Port 0x%X is busy\n", iop);
-                            /* Don't try this I/O port twice. */
-                            asc_ioport[ioport] = 0;
-                            goto ioport_try_again;
-                        } else if (AscFindSignature(iop) == ASC_FALSE) {
-                            printk(
-"AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n", iop);
-                            /* Don't try this I/O port twice. */
-                           release_region(iop, ASC_IOADR_GAP);
-                            asc_ioport[ioport] = 0;
-                            goto ioport_try_again;
-                        } else {
-                            /*
-                             * If this isn't an ISA board, then it must be
-                             * a VL board. If currently looking an ISA
-                             * board is being looked for then try for
-                             * another ISA board in 'asc_ioport'.
-                             */
-                            if (asc_bus[bus] == ASC_IS_ISA &&
-                                (AscGetChipVersion(iop, ASC_IS_ISA) &
-                                 ASC_CHIP_VER_ISA_BIT) == 0) {
-                                 /*
-                                  * Don't clear 'asc_ioport[ioport]'. Try
-                                  * this board again for VL. Increment
-                                  * 'ioport' past this board.
-                                  */
-                                 ioport++;
-                                release_region(iop, ASC_IOADR_GAP);
-                                 goto ioport_try_again;
-                            }
-                        }
-                        /*
-                         * This board appears good, don't try the I/O port
-                         * again by clearing its value. Increment 'ioport'
-                         * for the next iteration.
-                         */
-                        asc_ioport[ioport++] = 0;
-                    }
-                }
-#endif /* CONFIG_ISA */
-                break;
-
-            case ASC_IS_EISA:
-#ifdef CONFIG_ISA
-                iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
-#endif /* CONFIG_ISA */
-                break;
-
-            case ASC_IS_PCI:
-#ifdef CONFIG_PCI
-                if (pci_init_search == 0) {
-                    int i, j;
-
-                    pci_init_search = 1;
-
-                    /* Find all PCI cards. */
-                    while (pci_device_id_cnt < ASC_PCI_DEVICE_ID_CNT) {
-                        if ((pci_devp = pci_find_device(PCI_VENDOR_ID_ASP,
-                            pci_device_id[pci_device_id_cnt], pci_devp)) ==
-                            NULL) {
-                            pci_device_id_cnt++;
-                        } else {
-                            if (pci_enable_device(pci_devp) == 0) {
-                                pci_devicep[pci_card_cnt_max++] = pci_devp;
-                            }
-                        }
-                    }
-
-                    /*
-                     * Sort PCI cards in ascending order by PCI Bus, Slot,
-                     * and Device Number.
-                     */
-                    for (i = 0; i < pci_card_cnt_max - 1; i++)
-                    {
-                        for (j = i + 1; j < pci_card_cnt_max; j++) {
-                            if ((pci_devicep[j]->bus->number <
-                                 pci_devicep[i]->bus->number) ||
-                                ((pci_devicep[j]->bus->number ==
-                                  pci_devicep[i]->bus->number) &&
-                                  (pci_devicep[j]->devfn <
-                                   pci_devicep[i]->devfn))) {
-                                pci_devp = pci_devicep[i];
-                                pci_devicep[i] = pci_devicep[j];
-                                pci_devicep[j] = pci_devp;
-                            }
-                        }
-                    }
-
-                    pci_card_cnt = 0;
-                } else {
-                    pci_card_cnt++;
-                }
-
-                if (pci_card_cnt == pci_card_cnt_max) {
-                    iop = 0;
-                } else {
-                    pci_devp = pci_devicep[pci_card_cnt];
-
-                    ASC_DBG2(2,
-                        "advansys_detect: devfn %d, bus number %d\n",
-                        pci_devp->devfn, pci_devp->bus->number);
-                    iop = pci_resource_start(pci_devp, 0);
-                    ASC_DBG2(1,
-                        "advansys_detect: vendorID %X, deviceID %X\n",
-                        pci_devp->vendor, pci_devp->device);
-                    ASC_DBG2(2, "advansys_detect: iop %X, irqLine %d\n",
-                        iop, pci_devp->irq);
-                }
-               if(pci_devp)
-                   dev = &pci_devp->dev;
-
-#endif /* CONFIG_PCI */
-                break;
-
-            default:
-                ASC_PRINT1("advansys_detect: unknown bus type: %d\n",
-                    asc_bus[bus]);
-                break;
-            }
-            ASC_DBG1(1, "advansys_detect: iop 0x%x\n", iop);
-
-            /*
-             * Adapter not found, try next bus type.
-             */
-            if (iop == 0) {
-                break;
-            }
-
-            /*
-             * Adapter found.
-             *
-             * Register the adapter, get its configuration, and
-             * initialize it.
-             */
-            ASC_DBG(2, "advansys_detect: scsi_register()\n");
-            shp = scsi_register(tpnt, sizeof(asc_board_t));
-
-            if (shp == NULL) {
-                continue;
-            }
-
-            /* Save a pointer to the Scsi_Host of each board found. */
-            asc_host[asc_board_count++] = shp;
-
-            /* Initialize private per board data */
-            boardp = ASC_BOARDP(shp);
-            memset(boardp, 0, sizeof(asc_board_t));
-            boardp->id = asc_board_count - 1;
-
-            /* Initialize spinlock. */
-            spin_lock_init(&boardp->lock);
-
-            /*
-             * Handle both narrow and wide boards.
-             *
-             * If a Wide board was detected, set the board structure
-             * wide board flag. Set-up the board structure based on
-             * the board type.
-             */
-#ifdef CONFIG_PCI
-            if (asc_bus[bus] == ASC_IS_PCI &&
-                (pci_devp->device == PCI_DEVICE_ID_ASP_ABP940UW ||
-                 pci_devp->device == PCI_DEVICE_ID_38C0800_REV1 ||
-                 pci_devp->device == PCI_DEVICE_ID_38C1600_REV1))
-            {
-                boardp->flags |= ASC_IS_WIDE_BOARD;
-            }
-#endif /* CONFIG_PCI */
-
-            if (ASC_NARROW_BOARD(boardp)) {
-                ASC_DBG(1, "advansys_detect: narrow board\n");
-                asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
-                asc_dvc_varp->bus_type = asc_bus[bus];
-                asc_dvc_varp->drv_ptr = boardp;
-                asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg;
-                asc_dvc_varp->cfg->overrun_buf = &overrun_buf[0];
-                asc_dvc_varp->iop_base = iop;
-                asc_dvc_varp->isr_callback = asc_isr_callback;
-            } else {
-                ASC_DBG(1, "advansys_detect: wide board\n");
-                adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
-                adv_dvc_varp->drv_ptr = boardp;
-                adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg;
-                adv_dvc_varp->isr_callback = adv_isr_callback;
-                adv_dvc_varp->async_callback = adv_async_callback;
-#ifdef CONFIG_PCI
-                if (pci_devp->device == PCI_DEVICE_ID_ASP_ABP940UW)
-                {
-                    ASC_DBG(1, "advansys_detect: ASC-3550\n");
-                    adv_dvc_varp->chip_type = ADV_CHIP_ASC3550;
-                } else if (pci_devp->device == PCI_DEVICE_ID_38C0800_REV1)
-                {
-                    ASC_DBG(1, "advansys_detect: ASC-38C0800\n");
-                    adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800;
-                } else
-                {
-                    ASC_DBG(1, "advansys_detect: ASC-38C1600\n");
-                    adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600;
-                }
-#endif /* CONFIG_PCI */
-
-                /*
-                 * Map the board's registers into virtual memory for
-                 * PCI slave access. Only memory accesses are used to
-                 * access the board's registers.
-                 *
-                 * Note: The PCI register base address is not always
-                 * page aligned, but the address passed to ioremap()
-                 * must be page aligned. It is guaranteed that the
-                 * PCI register base address will not cross a page
-                 * boundary.
-                 */
-                if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-                {
-                    iolen = ADV_3550_IOLEN;
-                } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-                {
-                    iolen = ADV_38C0800_IOLEN;
-                } else
-                {
-                    iolen = ADV_38C1600_IOLEN;
-                }
-#ifdef CONFIG_PCI
-                pci_memory_address = pci_resource_start(pci_devp, 1);
-                ASC_DBG1(1, "advansys_detect: pci_memory_address: 0x%lx\n",
-                    (ulong) pci_memory_address);
-                if ((boardp->ioremap_addr =
-                    ioremap(pci_memory_address & PAGE_MASK,
-                         PAGE_SIZE)) == 0) {
-                   ASC_PRINT3(
-"advansys_detect: board %d: ioremap(%x, %d) returned NULL\n",
-                       boardp->id, pci_memory_address, iolen);
-                   scsi_unregister(shp);
-                   asc_board_count--;
-                   continue;
-                }
-                ASC_DBG1(1, "advansys_detect: ioremap_addr: 0x%lx\n",
-                    (ulong) boardp->ioremap_addr);
-                adv_dvc_varp->iop_base = (AdvPortAddr)
-                    (boardp->ioremap_addr +
-                     (pci_memory_address - (pci_memory_address & PAGE_MASK)));
-                ASC_DBG1(1, "advansys_detect: iop_base: 0x%lx\n",
-                    adv_dvc_varp->iop_base);
-#endif /* CONFIG_PCI */
-
-                /*
-                 * Even though it isn't used to access wide boards, other
-                 * than for the debug line below, save I/O Port address so
-                 * that it can be reported.
-                 */
-                boardp->ioport = iop;
-
-                ASC_DBG2(1,
-"advansys_detect: iopb_chip_id_1 0x%x, iopw_chip_id_0 0x%x\n",
-                    (ushort) inp(iop + 1), (ushort) inpw(iop));
-            }
-
-#ifdef CONFIG_PROC_FS
-            /*
-             * Allocate buffer for printing information from
-             * /proc/scsi/advansys/[0...].
-             */
-            if ((boardp->prtbuf =
-                kmalloc(ASC_PRTBUF_SIZE, GFP_ATOMIC)) == NULL) {
-                ASC_PRINT3(
-"advansys_detect: board %d: kmalloc(%d, %d) returned NULL\n",
-                    boardp->id, ASC_PRTBUF_SIZE, GFP_ATOMIC);
-                scsi_unregister(shp);
-                asc_board_count--;
-                continue;
-            }
-#endif /* CONFIG_PROC_FS */
-
-            if (ASC_NARROW_BOARD(boardp)) {
-               asc_dvc_varp->cfg->dev = dev;
-               /*
-                 * Set the board bus type and PCI IRQ before
-                 * calling AscInitGetConfig().
-                 */
-                switch (asc_dvc_varp->bus_type) {
-#ifdef CONFIG_ISA
-                case ASC_IS_ISA:
-                    shp->unchecked_isa_dma = TRUE;
-                    share_irq = FALSE;
-                    break;
-                case ASC_IS_VL:
-                    shp->unchecked_isa_dma = FALSE;
-                    share_irq = FALSE;
-                    break;
-                case ASC_IS_EISA:
-                    shp->unchecked_isa_dma = FALSE;
-                    share_irq = TRUE;
-                    break;
-#endif /* CONFIG_ISA */
-#ifdef CONFIG_PCI
-                case ASC_IS_PCI:
-                    shp->irq = asc_dvc_varp->irq_no = pci_devp->irq;
-                    asc_dvc_varp->cfg->pci_slot_info =
-                        ASC_PCI_MKID(pci_devp->bus->number,
-                            PCI_SLOT(pci_devp->devfn),
-                            PCI_FUNC(pci_devp->devfn));
-                    shp->unchecked_isa_dma = FALSE;
-                    share_irq = TRUE;
-                    break;
-#endif /* CONFIG_PCI */
-                default:
-                    ASC_PRINT2(
-"advansys_detect: board %d: unknown adapter type: %d\n",
-                        boardp->id, asc_dvc_varp->bus_type);
-                    shp->unchecked_isa_dma = TRUE;
-                    share_irq = FALSE;
-                    break;
-                }
-            } else {
-                adv_dvc_varp->cfg->dev = dev;
-                /*
-                 * For Wide boards set PCI information before calling
-                 * AdvInitGetConfig().
-                 */
-#ifdef CONFIG_PCI
-                shp->irq = adv_dvc_varp->irq_no = pci_devp->irq;
-                adv_dvc_varp->cfg->pci_slot_info =
-                    ASC_PCI_MKID(pci_devp->bus->number,
-                        PCI_SLOT(pci_devp->devfn),
-                        PCI_FUNC(pci_devp->devfn));
-                shp->unchecked_isa_dma = FALSE;
-                share_irq = TRUE;
-#endif /* CONFIG_PCI */
-            }
-
-            /*
-             * Read the board configuration.
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-                 /*
-                  * NOTE: AscInitGetConfig() may change the board's
-                  * bus_type value. The asc_bus[bus] value should no
-                  * longer be used. If the bus_type field must be
-                  * referenced only use the bit-wise AND operator "&".
-                  */
-                ASC_DBG(2, "advansys_detect: AscInitGetConfig()\n");
-                switch(ret = AscInitGetConfig(asc_dvc_varp)) {
-                case 0:    /* No error */
-                    break;
-                case ASC_WARN_IO_PORT_ROTATE:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: I/O port address modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_AUTO_CONFIG:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: I/O port increment switch enabled\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_EEPROM_CHKSUM:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: EEPROM checksum error\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_IRQ_MODIFIED:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: IRQ modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_CMD_QNG_CONFLICT:
-                    ASC_PRINT1(
-"AscInitGetConfig: board %d: tag queuing enabled w/o disconnects\n",
-                        boardp->id);
-                    break;
-                default:
-                    ASC_PRINT2(
-"AscInitGetConfig: board %d: unknown warning: 0x%x\n",
-                        boardp->id, ret);
-                    break;
-                }
-                if ((err_code = asc_dvc_varp->err_code) != 0) {
-                    ASC_PRINT3(
-"AscInitGetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
-                        boardp->id, asc_dvc_varp->init_state,
-                        asc_dvc_varp->err_code);
-                }
-            } else {
-                ASC_DBG(2, "advansys_detect: AdvInitGetConfig()\n");
-                if ((ret = AdvInitGetConfig(adv_dvc_varp)) != 0) {
-                    ASC_PRINT2("AdvInitGetConfig: board %d: warning: 0x%x\n",
-                        boardp->id, ret);
-                }
-                if ((err_code = adv_dvc_varp->err_code) != 0) {
-                    ASC_PRINT2(
-"AdvInitGetConfig: board %d error: err_code 0x%x\n",
-                        boardp->id, adv_dvc_varp->err_code);
-                }
-            }
-
-            if (err_code != 0) {
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                scsi_unregister(shp);
-                asc_board_count--;
-                continue;
-            }
-
-            /*
-             * Save the EEPROM configuration so that it can be displayed
-             * from /proc/scsi/advansys/[0...].
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-
-                ASCEEP_CONFIG *ep;
-
-                /*
-                 * Set the adapter's target id bit in the 'init_tidmask' field.
-                 */
-                boardp->init_tidmask |=
-                    ADV_TID_TO_TIDMASK(asc_dvc_varp->cfg->chip_scsi_id);
-
-                /*
-                 * Save EEPROM settings for the board.
-                 */
-                ep = &boardp->eep_config.asc_eep;
-
-                ep->init_sdtr = asc_dvc_varp->cfg->sdtr_enable;
-                ep->disc_enable = asc_dvc_varp->cfg->disc_enable;
-                ep->use_cmd_qng = asc_dvc_varp->cfg->cmd_qng_enabled;
-                ASC_EEP_SET_DMA_SPD(ep, asc_dvc_varp->cfg->isa_dma_speed);
-                ep->start_motor = asc_dvc_varp->start_motor;
-                ep->cntl = asc_dvc_varp->dvc_cntl;
-                ep->no_scam = asc_dvc_varp->no_scam;
-                ep->max_total_qng = asc_dvc_varp->max_total_qng;
-                ASC_EEP_SET_CHIP_ID(ep, asc_dvc_varp->cfg->chip_scsi_id);
-                /* 'max_tag_qng' is set to the same value for every device. */
-                ep->max_tag_qng = asc_dvc_varp->cfg->max_tag_qng[0];
-                ep->adapter_info[0] = asc_dvc_varp->cfg->adapter_info[0];
-                ep->adapter_info[1] = asc_dvc_varp->cfg->adapter_info[1];
-                ep->adapter_info[2] = asc_dvc_varp->cfg->adapter_info[2];
-                ep->adapter_info[3] = asc_dvc_varp->cfg->adapter_info[3];
-                ep->adapter_info[4] = asc_dvc_varp->cfg->adapter_info[4];
-                ep->adapter_info[5] = asc_dvc_varp->cfg->adapter_info[5];
-
-               /*
-                * Modify board configuration.
-                */
-                ASC_DBG(2, "advansys_detect: AscInitSetConfig()\n");
-                switch (ret = AscInitSetConfig(asc_dvc_varp)) {
-                case 0:    /* No error. */
-                    break;
-                case ASC_WARN_IO_PORT_ROTATE:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: I/O port address modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_AUTO_CONFIG:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: I/O port increment switch enabled\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_EEPROM_CHKSUM:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: EEPROM checksum error\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_IRQ_MODIFIED:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: IRQ modified\n",
-                        boardp->id);
-                    break;
-                case ASC_WARN_CMD_QNG_CONFLICT:
-                    ASC_PRINT1(
-"AscInitSetConfig: board %d: tag queuing w/o disconnects\n",
-                        boardp->id);
-                    break;
-                default:
-                    ASC_PRINT2(
-"AscInitSetConfig: board %d: unknown warning: 0x%x\n",
-                        boardp->id, ret);
-                    break;
-                }
-                if (asc_dvc_varp->err_code != 0) {
-                    ASC_PRINT3(
-"AscInitSetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
-                        boardp->id, asc_dvc_varp->init_state,
-                        asc_dvc_varp->err_code);
-#ifdef CONFIG_PROC_FS
-                    kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                    scsi_unregister(shp);
-                    asc_board_count--;
-                    continue;
-                }
-
-                /*
-                 * Finish initializing the 'Scsi_Host' structure.
-                 */
-                /* AscInitSetConfig() will set the IRQ for non-PCI boards. */
-                if ((asc_dvc_varp->bus_type & ASC_IS_PCI) == 0) {
-                    shp->irq = asc_dvc_varp->irq_no;
-                }
-            } else {
-                ADVEEP_3550_CONFIG      *ep_3550;
-                ADVEEP_38C0800_CONFIG   *ep_38C0800;
-                ADVEEP_38C1600_CONFIG   *ep_38C1600;
-
-                /*
-                 * Save Wide EEP Configuration Information.
-                 */
-                if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-                {
-                    ep_3550 = &boardp->eep_config.adv_3550_eep;
-
-                    ep_3550->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
-                    ep_3550->max_host_qng = adv_dvc_varp->max_host_qng;
-                    ep_3550->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
-                    ep_3550->termination = adv_dvc_varp->cfg->termination;
-                    ep_3550->disc_enable = adv_dvc_varp->cfg->disc_enable;
-                    ep_3550->bios_ctrl = adv_dvc_varp->bios_ctrl;
-                    ep_3550->wdtr_able = adv_dvc_varp->wdtr_able;
-                    ep_3550->sdtr_able = adv_dvc_varp->sdtr_able;
-                    ep_3550->ultra_able = adv_dvc_varp->ultra_able;
-                    ep_3550->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_3550->start_motor = adv_dvc_varp->start_motor;
-                    ep_3550->scsi_reset_delay = adv_dvc_varp->scsi_reset_wait;
-                    ep_3550->serial_number_word1 =
-                        adv_dvc_varp->cfg->serial1;
-                    ep_3550->serial_number_word2 =
-                        adv_dvc_varp->cfg->serial2;
-                    ep_3550->serial_number_word3 =
-                        adv_dvc_varp->cfg->serial3;
-                } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-                {
-                    ep_38C0800 = &boardp->eep_config.adv_38C0800_eep;
-
-                    ep_38C0800->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
-                    ep_38C0800->max_host_qng = adv_dvc_varp->max_host_qng;
-                    ep_38C0800->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
-                    ep_38C0800->termination_lvd =
-                        adv_dvc_varp->cfg->termination;
-                    ep_38C0800->disc_enable = adv_dvc_varp->cfg->disc_enable;
-                    ep_38C0800->bios_ctrl = adv_dvc_varp->bios_ctrl;
-                    ep_38C0800->wdtr_able = adv_dvc_varp->wdtr_able;
-                    ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C0800->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
-                    ep_38C0800->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
-                    ep_38C0800->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
-                    ep_38C0800->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
-                    ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C0800->start_motor = adv_dvc_varp->start_motor;
-                    ep_38C0800->scsi_reset_delay =
-                        adv_dvc_varp->scsi_reset_wait;
-                    ep_38C0800->serial_number_word1 =
-                        adv_dvc_varp->cfg->serial1;
-                    ep_38C0800->serial_number_word2 =
-                        adv_dvc_varp->cfg->serial2;
-                    ep_38C0800->serial_number_word3 =
-                        adv_dvc_varp->cfg->serial3;
-                } else
-                {
-                    ep_38C1600 = &boardp->eep_config.adv_38C1600_eep;
-
-                    ep_38C1600->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
-                    ep_38C1600->max_host_qng = adv_dvc_varp->max_host_qng;
-                    ep_38C1600->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
-                    ep_38C1600->termination_lvd =
-                        adv_dvc_varp->cfg->termination;
-                    ep_38C1600->disc_enable = adv_dvc_varp->cfg->disc_enable;
-                    ep_38C1600->bios_ctrl = adv_dvc_varp->bios_ctrl;
-                    ep_38C1600->wdtr_able = adv_dvc_varp->wdtr_able;
-                    ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C1600->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
-                    ep_38C1600->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
-                    ep_38C1600->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
-                    ep_38C1600->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
-                    ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
-                    ep_38C1600->start_motor = adv_dvc_varp->start_motor;
-                    ep_38C1600->scsi_reset_delay =
-                        adv_dvc_varp->scsi_reset_wait;
-                    ep_38C1600->serial_number_word1 =
-                        adv_dvc_varp->cfg->serial1;
-                    ep_38C1600->serial_number_word2 =
-                        adv_dvc_varp->cfg->serial2;
-                    ep_38C1600->serial_number_word3 =
-                        adv_dvc_varp->cfg->serial3;
-                }
-
-                /*
-                 * Set the adapter's target id bit in the 'init_tidmask' field.
-                 */
-                boardp->init_tidmask |=
-                    ADV_TID_TO_TIDMASK(adv_dvc_varp->chip_scsi_id);
-
-                /*
-                 * Finish initializing the 'Scsi_Host' structure.
-                 */
-                shp->irq = adv_dvc_varp->irq_no;
-            }
-
-            /*
-             * Channels are numbered beginning with 0. For AdvanSys one host
-             * structure supports one channel. Multi-channel boards have a
-             * separate host structure for each channel.
-             */
-            shp->max_channel = 0;
-            if (ASC_NARROW_BOARD(boardp)) {
-                shp->max_id = ASC_MAX_TID + 1;
-                shp->max_lun = ASC_MAX_LUN + 1;
-
-                shp->io_port = asc_dvc_varp->iop_base;
-                boardp->asc_n_io_port = ASC_IOADR_GAP;
-                shp->this_id = asc_dvc_varp->cfg->chip_scsi_id;
-
-                /* Set maximum number of queues the adapter can handle. */
-                shp->can_queue = asc_dvc_varp->max_total_qng;
-            } else {
-                shp->max_id = ADV_MAX_TID + 1;
-                shp->max_lun = ADV_MAX_LUN + 1;
-
-                /*
-                 * Save the I/O Port address and length even though
-                 * I/O ports are not used to access Wide boards.
-                 * Instead the Wide boards are accessed with
-                 * PCI Memory Mapped I/O.
-                 */
-                shp->io_port = iop;
-                boardp->asc_n_io_port = iolen;
-
-                shp->this_id = adv_dvc_varp->chip_scsi_id;
-
-                /* Set maximum number of queues the adapter can handle. */
-                shp->can_queue = adv_dvc_varp->max_host_qng;
-            }
-
-            /*
-             * 'n_io_port' currently is one byte.
-             *
-             * Set a value to 'n_io_port', but never referenced it because
-             * it may be truncated.
-             */
-            shp->n_io_port = boardp->asc_n_io_port <= 255 ?
-                boardp->asc_n_io_port : 255;
-
-            /*
-             * Following v1.3.89, 'cmd_per_lun' is no longer needed
-             * and should be set to zero.
-             *
-             * But because of a bug introduced in v1.3.89 if the driver is
-             * compiled as a module and 'cmd_per_lun' is zero, the Mid-Level
-             * SCSI function 'allocate_device' will panic. To allow the driver
-             * to work as a module in these kernels set 'cmd_per_lun' to 1.
-            *
-            * Note: This is wrong.  cmd_per_lun should be set to the depth
-            * you want on untagged devices always.
-#ifdef MODULE
-             */
-            shp->cmd_per_lun = 1;
-/* #else
-            shp->cmd_per_lun = 0;
-#endif */
-
-            /*
-             * Set the maximum number of scatter-gather elements the
-             * adapter can handle.
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-                /*
-                 * Allow two commands with 'sg_tablesize' scatter-gather
-                 * elements to be executed simultaneously. This value is
-                 * the theoretical hardware limit. It may be decreased
-                 * below.
-                 */
-                shp->sg_tablesize =
-                    (((asc_dvc_varp->max_total_qng - 2) / 2) *
-                    ASC_SG_LIST_PER_Q) + 1;
-            } else {
-                shp->sg_tablesize = ADV_MAX_SG_LIST;
-            }
-
-            /*
-             * The value of 'sg_tablesize' can not exceed the SCSI
-             * mid-level driver definition of SG_ALL. SG_ALL also
-             * must not be exceeded, because it is used to define the
-             * size of the scatter-gather table in 'struct asc_sg_head'.
-             */
-            if (shp->sg_tablesize > SG_ALL) {
-                shp->sg_tablesize = SG_ALL;
-            }
-
-            ASC_DBG1(1, "advansys_detect: sg_tablesize: %d\n",
-                shp->sg_tablesize);
-
-            /* BIOS start address. */
-            if (ASC_NARROW_BOARD(boardp)) {
-                shp->base =
-                        ((ulong) AscGetChipBiosAddress(
-                            asc_dvc_varp->iop_base,
-                            asc_dvc_varp->bus_type));
-            } else {
-                /*
-                 * Fill-in BIOS board variables. The Wide BIOS saves
-                 * information in LRAM that is used by the driver.
-                 */
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_SIGNATURE,
-                    boardp->bios_signature);
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_VERSION,
-                    boardp->bios_version);
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_CODESEG,
-                    boardp->bios_codeseg);
-                AdvReadWordLram(adv_dvc_varp->iop_base, BIOS_CODELEN,
-                    boardp->bios_codelen);
-
-                ASC_DBG2(1,
-                    "advansys_detect: bios_signature 0x%x, bios_version 0x%x\n",
-                    boardp->bios_signature, boardp->bios_version);
-
-                ASC_DBG2(1,
-                    "advansys_detect: bios_codeseg 0x%x, bios_codelen 0x%x\n",
-                    boardp->bios_codeseg, boardp->bios_codelen);
-
-                /*
-                 * If the BIOS saved a valid signature, then fill in
-                 * the BIOS code segment base address.
-                 */
-                if (boardp->bios_signature == 0x55AA) {
-                    /*
-                     * Convert x86 realmode code segment to a linear
-                     * address by shifting left 4.
-                     */
-                    shp->base = ((ulong) boardp->bios_codeseg << 4);
-                } else {
-                    shp->base = 0;
-                }
-            }
-
-            /*
-             * Register Board Resources - I/O Port, DMA, IRQ
-             */
-
-            /*
-             * Register I/O port range.
-             *
-             * For Wide boards the I/O ports are not used to access
-             * the board, but request the region anyway.
-             *
-             * 'shp->n_io_port' is not referenced, because it may be truncated.
-             */
-            ASC_DBG2(2,
-                "advansys_detect: request_region port 0x%lx, len 0x%x\n",
-                (ulong) shp->io_port, boardp->asc_n_io_port);
-            if (request_region(shp->io_port, boardp->asc_n_io_port,
-                               "advansys") == NULL) {
-                ASC_PRINT3(
-"advansys_detect: board %d: request_region() failed, port 0x%lx, len 0x%x\n",
-                    boardp->id, (ulong) shp->io_port, boardp->asc_n_io_port);
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                scsi_unregister(shp);
-                asc_board_count--;
-                continue;
-            }
-
-            /* Register DMA Channel for Narrow boards. */
-            shp->dma_channel = NO_ISA_DMA; /* Default to no ISA DMA. */
-#ifdef CONFIG_ISA
-            if (ASC_NARROW_BOARD(boardp)) {
-                /* Register DMA channel for ISA bus. */
-                if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
-                    shp->dma_channel = asc_dvc_varp->cfg->isa_dma_channel;
-                    if ((ret =
-                         request_dma(shp->dma_channel, "advansys")) != 0) {
-                        ASC_PRINT3(
-"advansys_detect: board %d: request_dma() %d failed %d\n",
-                            boardp->id, shp->dma_channel, ret);
-                        release_region(shp->io_port, boardp->asc_n_io_port);
-#ifdef CONFIG_PROC_FS
-                        kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                        scsi_unregister(shp);
-                        asc_board_count--;
-                        continue;
-                    }
-                    AscEnableIsaDma(shp->dma_channel);
-                }
-            }
-#endif /* CONFIG_ISA */
+       /*
+        * Display Asc Library dynamic configuration information
+        * for the board.
+        */
+       cp = boardp->prtbuf;
+       if (ASC_NARROW_BOARD(boardp)) {
+               cplen = asc_prt_asc_board_info(shp, cp, ASC_PRTBUF_SIZE);
+       } else {
+               cplen = asc_prt_adv_board_info(shp, cp, ASC_PRTBUF_SIZE);
+       }
+       ASC_ASSERT(cplen < ASC_PRTBUF_SIZE);
+       cnt = asc_proc_copy(advoffset, offset, curbuf, leftlen, cp, cplen);
+       totcnt += cnt;
+       leftlen -= cnt;
+       if (leftlen == 0) {
+               ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
+               return totcnt;
+       }
+       advoffset += cplen;
+       curbuf += cnt;
 
-            /* Register IRQ Number. */
-            ASC_DBG1(2, "advansys_detect: request_irq() %d\n", shp->irq);
-           /*
-            * If request_irq() fails with the IRQF_DISABLED flag set,
-            * then try again without the IRQF_DISABLED flag set. This
-            * allows IRQ sharing to work even with other drivers that
-            * do not set the IRQF_DISABLED flag.
-            *
-            * If IRQF_DISABLED is not set, then interrupts are enabled
-            * before the driver interrupt function is called.
-            */
-            if (((ret = request_irq(shp->irq, advansys_interrupt,
-                            IRQF_DISABLED | (share_irq == TRUE ? IRQF_SHARED : 0),
-                            "advansys", boardp)) != 0) &&
-                ((ret = request_irq(shp->irq, advansys_interrupt,
-                            (share_irq == TRUE ? IRQF_SHARED : 0),
-                            "advansys", boardp)) != 0))
-            {
-                if (ret == -EBUSY) {
-                    ASC_PRINT2(
-"advansys_detect: board %d: request_irq(): IRQ 0x%x already in use.\n",
-                        boardp->id, shp->irq);
-                } else if (ret == -EINVAL) {
-                    ASC_PRINT2(
-"advansys_detect: board %d: request_irq(): IRQ 0x%x not valid.\n",
-                        boardp->id, shp->irq);
-                } else {
-                    ASC_PRINT3(
-"advansys_detect: board %d: request_irq(): IRQ 0x%x failed with %d\n",
-                        boardp->id, shp->irq, ret);
-                }
-                release_region(shp->io_port, boardp->asc_n_io_port);
-                iounmap(boardp->ioremap_addr);
-                if (shp->dma_channel != NO_ISA_DMA) {
-                    free_dma(shp->dma_channel);
-                }
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                scsi_unregister(shp);
-                asc_board_count--;
-                continue;
-            }
-
-            /*
-             * Initialize board RISC chip and enable interrupts.
-             */
-            if (ASC_NARROW_BOARD(boardp)) {
-                ASC_DBG(2, "advansys_detect: AscInitAsc1000Driver()\n");
-                warn_code = AscInitAsc1000Driver(asc_dvc_varp);
-                err_code = asc_dvc_varp->err_code;
-
-                if (warn_code || err_code) {
-                    ASC_PRINT4(
-"advansys_detect: board %d error: init_state 0x%x, warn 0x%x, error 0x%x\n",
-                        boardp->id, asc_dvc_varp->init_state,
-                        warn_code, err_code);
-                }
-            } else {
-                ADV_CARR_T      *carrp;
-                int             req_cnt = 0;
-                adv_req_t       *reqp = NULL;
-                int             sg_cnt = 0;
-
-                /*
-                 * Allocate buffer carrier structures. The total size
-                 * is about 4 KB, so allocate all at once.
-                 */
-                carrp =
-                    (ADV_CARR_T *) kmalloc(ADV_CARRIER_BUFSIZE, GFP_ATOMIC);
-                ASC_DBG1(1, "advansys_detect: carrp 0x%lx\n", (ulong) carrp);
-
-                if (carrp == NULL) {
-                    goto kmalloc_error;
-                }
-
-                /*
-                 * Allocate up to 'max_host_qng' request structures for
-                 * the Wide board. The total size is about 16 KB, so
-                 * allocate all at once. If the allocation fails decrement
-                 * and try again.
-                 */
-                for (req_cnt = adv_dvc_varp->max_host_qng;
-                    req_cnt > 0; req_cnt--) {
-
-                    reqp = (adv_req_t *)
-                        kmalloc(sizeof(adv_req_t) * req_cnt, GFP_ATOMIC);
-
-                    ASC_DBG3(1,
-                        "advansys_detect: reqp 0x%lx, req_cnt %d, bytes %lu\n",
-                        (ulong) reqp, req_cnt,
-                        (ulong) sizeof(adv_req_t) * req_cnt);
-
-                    if (reqp != NULL) {
-                        break;
-                    }
-                }
-                if (reqp == NULL)
-                {
-                    goto kmalloc_error;
-                }
-
-                /*
-                 * Allocate up to ADV_TOT_SG_BLOCK request structures for
-                 * the Wide board. Each structure is about 136 bytes.
-                 */
-                boardp->adv_sgblkp = NULL;
-                for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) {
-
-                    sgp = (adv_sgblk_t *)
-                        kmalloc(sizeof(adv_sgblk_t), GFP_ATOMIC);
-
-                    if (sgp == NULL) {
-                        break;
-                    }
-
-                    sgp->next_sgblkp = boardp->adv_sgblkp;
-                    boardp->adv_sgblkp = sgp;
-
-                }
-                ASC_DBG3(1,
-                    "advansys_detect: sg_cnt %d * %u = %u bytes\n",
-                    sg_cnt, sizeof(adv_sgblk_t),
-                    (unsigned) (sizeof(adv_sgblk_t) * sg_cnt));
-
-                /*
-                 * If no request structures or scatter-gather structures could
-                 * be allocated, then return an error. Otherwise continue with
-                 * initialization.
-                 */
-    kmalloc_error:
-                if (carrp == NULL)
-                {
-                    ASC_PRINT1(
-"advansys_detect: board %d error: failed to kmalloc() carrier buffer.\n",
-                        boardp->id);
-                    err_code = ADV_ERROR;
-                } else if (reqp == NULL) {
-                    kfree(carrp);
-                    ASC_PRINT1(
-"advansys_detect: board %d error: failed to kmalloc() adv_req_t buffer.\n",
-                        boardp->id);
-                    err_code = ADV_ERROR;
-                } else if (boardp->adv_sgblkp == NULL) {
-                    kfree(carrp);
-                    kfree(reqp);
-                    ASC_PRINT1(
-"advansys_detect: board %d error: failed to kmalloc() adv_sgblk_t buffers.\n",
-                        boardp->id);
-                    err_code = ADV_ERROR;
-                } else {
-
-                    /* Save carrier buffer pointer. */
-                    boardp->orig_carrp = carrp;
-
-                    /*
-                     * Save original pointer for kfree() in case the
-                     * driver is built as a module and can be unloaded.
-                     */
-                    boardp->orig_reqp = reqp;
-
-                    adv_dvc_varp->carrier_buf = carrp;
-
-                    /*
-                     * Point 'adv_reqp' to the request structures and
-                     * link them together.
-                     */
-                    req_cnt--;
-                    reqp[req_cnt].next_reqp = NULL;
-                    for (; req_cnt > 0; req_cnt--) {
-                        reqp[req_cnt - 1].next_reqp = &reqp[req_cnt];
-                    }
-                    boardp->adv_reqp = &reqp[0];
-
-                    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-                    {
-                        ASC_DBG(2,
-                            "advansys_detect: AdvInitAsc3550Driver()\n");
-                        warn_code = AdvInitAsc3550Driver(adv_dvc_varp);
-                    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
-                        ASC_DBG(2,
-                            "advansys_detect: AdvInitAsc38C0800Driver()\n");
-                        warn_code = AdvInitAsc38C0800Driver(adv_dvc_varp);
-                    } else {
-                        ASC_DBG(2,
-                            "advansys_detect: AdvInitAsc38C1600Driver()\n");
-                        warn_code = AdvInitAsc38C1600Driver(adv_dvc_varp);
-                    }
-                    err_code = adv_dvc_varp->err_code;
-
-                    if (warn_code || err_code) {
-                        ASC_PRINT3(
-"advansys_detect: board %d error: warn 0x%x, error 0x%x\n",
-                            boardp->id, warn_code, err_code);
-                    }
-                }
-            }
-
-            if (err_code != 0) {
-                release_region(shp->io_port, boardp->asc_n_io_port);
-                if (ASC_WIDE_BOARD(boardp)) {
-                    iounmap(boardp->ioremap_addr);
-                    kfree(boardp->orig_carrp);
-                    boardp->orig_carrp = NULL;
-                    if (boardp->orig_reqp) {
-                        kfree(boardp->orig_reqp);
-                        boardp->orig_reqp = boardp->adv_reqp = NULL;
-                    }
-                    while ((sgp = boardp->adv_sgblkp) != NULL)
-                    {
-                        boardp->adv_sgblkp = sgp->next_sgblkp;
-                        kfree(sgp);
-                    }
-                }
-                if (shp->dma_channel != NO_ISA_DMA) {
-                    free_dma(shp->dma_channel);
-                }
-#ifdef CONFIG_PROC_FS
-                kfree(boardp->prtbuf);
-#endif /* CONFIG_PROC_FS */
-                free_irq(shp->irq, boardp);
-                scsi_unregister(shp);
-                asc_board_count--;
-                continue;
-            }
-            ASC_DBG_PRT_SCSI_HOST(2, shp);
-        }
-    }
+       ASC_DBG1(1, "advansys_proc_info: totcnt %d\n", totcnt);
 
-    ASC_DBG1(1, "advansys_detect: done: asc_board_count %d\n", asc_board_count);
-    return asc_board_count;
+       return totcnt;
 }
-
-/*
- * advansys_release()
- *
- * Release resources allocated for a single AdvanSys adapter.
- */
-static int
-advansys_release(struct Scsi_Host *shp)
-{
-    asc_board_t    *boardp;
-
-    ASC_DBG(1, "advansys_release: begin\n");
-    boardp = ASC_BOARDP(shp);
-    free_irq(shp->irq, boardp);
-    if (shp->dma_channel != NO_ISA_DMA) {
-        ASC_DBG(1, "advansys_release: free_dma()\n");
-        free_dma(shp->dma_channel);
-    }
-    release_region(shp->io_port, boardp->asc_n_io_port);
-    if (ASC_WIDE_BOARD(boardp)) {
-        adv_sgblk_t    *sgp = NULL;
-
-        iounmap(boardp->ioremap_addr);
-        kfree(boardp->orig_carrp);
-        boardp->orig_carrp = NULL;
-        if (boardp->orig_reqp) {
-            kfree(boardp->orig_reqp);
-            boardp->orig_reqp = boardp->adv_reqp = NULL;
-        }
-        while ((sgp = boardp->adv_sgblkp) != NULL)
-        {
-            boardp->adv_sgblkp = sgp->next_sgblkp;
-            kfree(sgp);
-        }
-    }
-#ifdef CONFIG_PROC_FS
-    ASC_ASSERT(boardp->prtbuf != NULL);
-    kfree(boardp->prtbuf);
 #endif /* CONFIG_PROC_FS */
-    scsi_unregister(shp);
-    ASC_DBG(1, "advansys_release: end\n");
-    return 0;
-}
 
 /*
  * advansys_info()
@@ -5466,91 +4248,87 @@ advansys_release(struct Scsi_Host *shp)
  * Note: The information line should not exceed ASC_INFO_SIZE bytes,
  * otherwise the static 'info' array will be overrun.
  */
-static const char *
-advansys_info(struct Scsi_Host *shp)
+static const char *advansys_info(struct Scsi_Host *shost)
 {
-    static char     info[ASC_INFO_SIZE];
-    asc_board_t     *boardp;
-    ASC_DVC_VAR     *asc_dvc_varp;
-    ADV_DVC_VAR     *adv_dvc_varp;
-    char            *busname;
-    int             iolen;
-    char            *widename = NULL;
-
-    boardp = ASC_BOARDP(shp);
-    if (ASC_NARROW_BOARD(boardp)) {
-        asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
-        ASC_DBG(1, "advansys_info: begin\n");
-        if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
-            if ((asc_dvc_varp->bus_type & ASC_IS_ISAPNP) == ASC_IS_ISAPNP) {
-                busname = "ISA PnP";
-            } else {
-                busname = "ISA";
-            }
-            /* Don't reference 'shp->n_io_port'; It may be truncated. */
-            sprintf(info,
-"AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X, DMA 0x%X",
-                ASC_VERSION, busname,
-                (ulong) shp->io_port,
-                (ulong) shp->io_port + boardp->asc_n_io_port - 1,
-                shp->irq, shp->dma_channel);
-        } else {
-            if (asc_dvc_varp->bus_type & ASC_IS_VL) {
-                busname = "VL";
-            } else if (asc_dvc_varp->bus_type & ASC_IS_EISA) {
-                busname = "EISA";
-            } else if (asc_dvc_varp->bus_type & ASC_IS_PCI) {
-                if ((asc_dvc_varp->bus_type & ASC_IS_PCI_ULTRA)
-                    == ASC_IS_PCI_ULTRA) {
-                    busname = "PCI Ultra";
-                } else {
-                    busname = "PCI";
-                }
-            } else {
-                busname = "?";
-                ASC_PRINT2( "advansys_info: board %d: unknown bus type %d\n",
-                    boardp->id, asc_dvc_varp->bus_type);
-            }
-            /* Don't reference 'shp->n_io_port'; It may be truncated. */
-            sprintf(info,
-                "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X",
-                ASC_VERSION, busname,
-                (ulong) shp->io_port,
-                (ulong) shp->io_port + boardp->asc_n_io_port - 1,
-                shp->irq);
-        }
-    } else {
-        /*
-         * Wide Adapter Information
-         *
-         * Memory-mapped I/O is used instead of I/O space to access
-         * the adapter, but display the I/O Port range. The Memory
-         * I/O address is displayed through the driver /proc file.
-         */
-        adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
-        if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-        {
-            iolen = ADV_3550_IOLEN;
-            widename = "Ultra-Wide";
-        } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-        {
-            iolen = ADV_38C0800_IOLEN;
-            widename = "Ultra2-Wide";
-        } else
-        {
-            iolen = ADV_38C1600_IOLEN;
-            widename = "Ultra3-Wide";
-        }
-        sprintf(info, "AdvanSys SCSI %s: PCI %s: PCIMEM 0x%lX-0x%lX, IRQ 0x%X",
-            ASC_VERSION,
-            widename,
-            (ulong) adv_dvc_varp->iop_base,
-            (ulong) adv_dvc_varp->iop_base + iolen - 1,
-            shp->irq);
-    }
-    ASC_ASSERT(strlen(info) < ASC_INFO_SIZE);
-    ASC_DBG(1, "advansys_info: end\n");
-    return info;
+       static char info[ASC_INFO_SIZE];
+       asc_board_t *boardp;
+       ASC_DVC_VAR *asc_dvc_varp;
+       ADV_DVC_VAR *adv_dvc_varp;
+       char *busname;
+       int iolen;
+       char *widename = NULL;
+
+       boardp = ASC_BOARDP(shost);
+       if (ASC_NARROW_BOARD(boardp)) {
+               asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
+               ASC_DBG(1, "advansys_info: begin\n");
+               if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
+                       if ((asc_dvc_varp->bus_type & ASC_IS_ISAPNP) ==
+                           ASC_IS_ISAPNP) {
+                               busname = "ISA PnP";
+                       } else {
+                               busname = "ISA";
+                       }
+                       /* Don't reference 'shost->n_io_port'; It may be truncated. */
+                       sprintf(info,
+                               "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X, DMA 0x%X",
+                               ASC_VERSION, busname,
+                               (ulong)shost->io_port,
+                               (ulong)shost->io_port + boardp->asc_n_io_port -
+                               1, shost->irq, shost->dma_channel);
+               } else {
+                       if (asc_dvc_varp->bus_type & ASC_IS_VL) {
+                               busname = "VL";
+                       } else if (asc_dvc_varp->bus_type & ASC_IS_EISA) {
+                               busname = "EISA";
+                       } else if (asc_dvc_varp->bus_type & ASC_IS_PCI) {
+                               if ((asc_dvc_varp->bus_type & ASC_IS_PCI_ULTRA)
+                                   == ASC_IS_PCI_ULTRA) {
+                                       busname = "PCI Ultra";
+                               } else {
+                                       busname = "PCI";
+                               }
+                       } else {
+                               busname = "?";
+                               ASC_PRINT2
+                                   ("advansys_info: board %d: unknown bus type %d\n",
+                                    boardp->id, asc_dvc_varp->bus_type);
+                       }
+                       /* Don't reference 'shost->n_io_port'; It may be truncated. */
+                       sprintf(info,
+                               "AdvanSys SCSI %s: %s: IO 0x%lX-0x%lX, IRQ 0x%X",
+                               ASC_VERSION, busname,
+                               (ulong)shost->io_port,
+                               (ulong)shost->io_port + boardp->asc_n_io_port -
+                               1, shost->irq);
+               }
+       } else {
+               /*
+                * Wide Adapter Information
+                *
+                * Memory-mapped I/O is used instead of I/O space to access
+                * the adapter, but display the I/O Port range. The Memory
+                * I/O address is displayed through the driver /proc file.
+                */
+               adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
+               if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+                       iolen = ADV_3550_IOLEN;
+                       widename = "Ultra-Wide";
+               } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+                       iolen = ADV_38C0800_IOLEN;
+                       widename = "Ultra2-Wide";
+               } else {
+                       iolen = ADV_38C1600_IOLEN;
+                       widename = "Ultra3-Wide";
+               }
+               sprintf(info,
+                       "AdvanSys SCSI %s: PCI %s: PCIMEM 0x%lX-0x%lX, IRQ 0x%X",
+                       ASC_VERSION, widename, (ulong)adv_dvc_varp->iop_base,
+                       (ulong)adv_dvc_varp->iop_base + iolen - 1, shost->irq);
+       }
+       ASC_ASSERT(strlen(info) < ASC_INFO_SIZE);
+       ASC_DBG(1, "advansys_info: end\n");
+       return info;
 }
 
 /*
@@ -5560,82 +4338,82 @@ advansys_info(struct Scsi_Host *shp)
  * in the 'scp' result field.
  */
 static int
-advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
+advansys_queuecommand(struct scsi_cmnd *scp, void (*done) (struct scsi_cmnd *))
 {
-    struct Scsi_Host    *shp;
-    asc_board_t         *boardp;
-    ulong               flags;
-    struct scsi_cmnd           *done_scp;
+       struct Scsi_Host *shost;
+       asc_board_t *boardp;
+       ulong flags;
+       struct scsi_cmnd *done_scp;
 
-    shp = scp->device->host;
-    boardp = ASC_BOARDP(shp);
-    ASC_STATS(shp, queuecommand);
+       shost = scp->device->host;
+       boardp = ASC_BOARDP(shost);
+       ASC_STATS(shost, queuecommand);
 
-    /* host_lock taken by mid-level prior to call but need to protect */
-    /* against own ISR */
-    spin_lock_irqsave(&boardp->lock, flags);
+       /* host_lock taken by mid-level prior to call but need to protect */
+       /* against own ISR */
+       spin_lock_irqsave(&boardp->lock, flags);
 
-    /*
-     * Block new commands while handling a reset or abort request.
-     */
-    if (boardp->flags & ASC_HOST_IN_RESET) {
-        ASC_DBG1(1,
-            "advansys_queuecommand: scp 0x%lx blocked for reset request\n",
-            (ulong) scp);
-        scp->result = HOST_BYTE(DID_RESET);
-
-        /*
-         * Add blocked requests to the board's 'done' queue. The queued
-         * requests will be completed at the end of the abort or reset
-         * handling.
-         */
-        asc_enqueue(&boardp->done, scp, ASC_BACK);
-       spin_unlock_irqrestore(&boardp->lock, flags);
-        return 0;
-    }
+       /*
+        * Block new commands while handling a reset or abort request.
+        */
+       if (boardp->flags & ASC_HOST_IN_RESET) {
+               ASC_DBG1(1,
+                        "advansys_queuecommand: scp 0x%lx blocked for reset request\n",
+                        (ulong)scp);
+               scp->result = HOST_BYTE(DID_RESET);
 
-    /*
-     * Attempt to execute any waiting commands for the board.
-     */
-    if (!ASC_QUEUE_EMPTY(&boardp->waiting)) {
-        ASC_DBG(1,
-            "advansys_queuecommand: before asc_execute_queue() waiting\n");
-        asc_execute_queue(&boardp->waiting);
-    }
+               /*
+                * Add blocked requests to the board's 'done' queue. The queued
+                * requests will be completed at the end of the abort or reset
+                * handling.
+                */
+               asc_enqueue(&boardp->done, scp, ASC_BACK);
+               spin_unlock_irqrestore(&boardp->lock, flags);
+               return 0;
+       }
 
-    /*
-     * Save the function pointer to Linux mid-level 'done' function
-     * and attempt to execute the command.
-     *
-     * If ASC_NOERROR is returned the request has been added to the
-     * board's 'active' queue and will be completed by the interrupt
-     * handler.
-     *
-     * If ASC_BUSY is returned add the request to the board's per
-     * target waiting list. This is the first time the request has
-     * been tried. Add it to the back of the waiting list. It will be
-     * retried later.
-     *
-     * If an error occurred, the request will have been placed on the
-     * board's 'done' queue and must be completed before returning.
-     */
-    scp->scsi_done = done;
-    switch (asc_execute_scsi_cmnd(scp)) {
-    case ASC_NOERROR:
-        break;
-    case ASC_BUSY:
-        asc_enqueue(&boardp->waiting, scp, ASC_BACK);
-        break;
-    case ASC_ERROR:
-    default:
-        done_scp = asc_dequeue_list(&boardp->done, NULL, ASC_TID_ALL);
-        /* Interrupts could be enabled here. */
-        asc_scsi_done_list(done_scp);
-        break;
-    }
-    spin_unlock_irqrestore(&boardp->lock, flags);
+       /*
+        * Attempt to execute any waiting commands for the board.
+        */
+       if (!ASC_QUEUE_EMPTY(&boardp->waiting)) {
+               ASC_DBG(1,
+                       "advansys_queuecommand: before asc_execute_queue() waiting\n");
+               asc_execute_queue(&boardp->waiting);
+       }
+
+       /*
+        * Save the function pointer to Linux mid-level 'done' function
+        * and attempt to execute the command.
+        *
+        * If ASC_NOERROR is returned the request has been added to the
+        * board's 'active' queue and will be completed by the interrupt
+        * handler.
+        *
+        * If ASC_BUSY is returned add the request to the board's per
+        * target waiting list. This is the first time the request has
+        * been tried. Add it to the back of the waiting list. It will be
+        * retried later.
+        *
+        * If an error occurred, the request will have been placed on the
+        * board's 'done' queue and must be completed before returning.
+        */
+       scp->scsi_done = done;
+       switch (asc_execute_scsi_cmnd(scp)) {
+       case ASC_NOERROR:
+               break;
+       case ASC_BUSY:
+               asc_enqueue(&boardp->waiting, scp, ASC_BACK);
+               break;
+       case ASC_ERROR:
+       default:
+               done_scp = asc_dequeue_list(&boardp->done, NULL, ASC_TID_ALL);
+               /* Interrupts could be enabled here. */
+               asc_scsi_done_list(done_scp);
+               break;
+       }
+       spin_unlock_irqrestore(&boardp->lock, flags);
 
-    return 0;
+       return 0;
 }
 
 /*
@@ -5647,178 +4425,187 @@ advansys_queuecommand(struct scsi_cmnd *scp, void (*done)(struct scsi_cmnd *))
  * sleeping is allowed and no locking other than for host structures is
  * required. Returns SUCCESS or FAILED.
  */
-static int
-advansys_reset(struct scsi_cmnd *scp)
+static int advansys_reset(struct scsi_cmnd *scp)
 {
-    struct Scsi_Host     *shp;
-    asc_board_t          *boardp;
-    ASC_DVC_VAR          *asc_dvc_varp;
-    ADV_DVC_VAR          *adv_dvc_varp;
-    ulong                flags;
-    struct scsi_cmnd            *done_scp = NULL, *last_scp = NULL;
-    struct scsi_cmnd            *tscp, *new_last_scp;
-    int                  status;
-    int                  ret = SUCCESS;
-
-    ASC_DBG1(1, "advansys_reset: 0x%lx\n", (ulong) scp);
+       struct Scsi_Host *shost;
+       asc_board_t *boardp;
+       ASC_DVC_VAR *asc_dvc_varp;
+       ADV_DVC_VAR *adv_dvc_varp;
+       ulong flags;
+       struct scsi_cmnd *done_scp = NULL, *last_scp = NULL;
+       struct scsi_cmnd *tscp, *new_last_scp;
+       int status;
+       int ret = SUCCESS;
+
+       ASC_DBG1(1, "advansys_reset: 0x%lx\n", (ulong)scp);
 
 #ifdef ADVANSYS_STATS
-    if (scp->device->host != NULL) {
-        ASC_STATS(scp->device->host, reset);
-    }
+       if (scp->device->host != NULL) {
+               ASC_STATS(scp->device->host, reset);
+       }
 #endif /* ADVANSYS_STATS */
 
-    if ((shp = scp->device->host) == NULL) {
-        scp->result = HOST_BYTE(DID_ERROR);
-        return FAILED;
-    }
+       if ((shost = scp->device->host) == NULL) {
+               scp->result = HOST_BYTE(DID_ERROR);
+               return FAILED;
+       }
 
-    boardp = ASC_BOARDP(shp);
+       boardp = ASC_BOARDP(shost);
 
-    ASC_PRINT1("advansys_reset: board %d: SCSI bus reset started...\n",
-        boardp->id);
-    /*
-     * Check for re-entrancy.
-     */
-    spin_lock_irqsave(&boardp->lock, flags);
-    if (boardp->flags & ASC_HOST_IN_RESET) {
-       spin_unlock_irqrestore(&boardp->lock, flags);
-        return FAILED;
-    }
-    boardp->flags |= ASC_HOST_IN_RESET;
-    spin_unlock_irqrestore(&boardp->lock, flags);
-
-    if (ASC_NARROW_BOARD(boardp)) {
-        /*
-         * Narrow Board
-         */
-        asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
-
-        /*
-         * Reset the chip and SCSI bus.
-         */
-        ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n");
-        status = AscInitAsc1000Driver(asc_dvc_varp);
-
-        /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */
-        if (asc_dvc_varp->err_code) {
-            ASC_PRINT2(
-                "advansys_reset: board %d: SCSI bus reset error: 0x%x\n",
-                boardp->id, asc_dvc_varp->err_code);
-            ret = FAILED;
-        } else if (status) {
-            ASC_PRINT2(
-                "advansys_reset: board %d: SCSI bus reset warning: 0x%x\n",
-                boardp->id, status);
-        } else {
-            ASC_PRINT1(
-                "advansys_reset: board %d: SCSI bus reset successful.\n",
-                boardp->id);
-        }
-
-        ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n");
+       ASC_PRINT1("advansys_reset: board %d: SCSI bus reset started...\n",
+                  boardp->id);
+       /*
+        * Check for re-entrancy.
+        */
        spin_lock_irqsave(&boardp->lock, flags);
+       if (boardp->flags & ASC_HOST_IN_RESET) {
+               spin_unlock_irqrestore(&boardp->lock, flags);
+               return FAILED;
+       }
+       boardp->flags |= ASC_HOST_IN_RESET;
+       spin_unlock_irqrestore(&boardp->lock, flags);
 
-    } else {
-        /*
-         * Wide Board
-         *
-         * If the suggest reset bus flags are set, then reset the bus.
-         * Otherwise only reset the device.
-         */
-        adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
-
-        /*
-         * Reset the target's SCSI bus.
-         */
-        ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n");
-        switch (AdvResetChipAndSB(adv_dvc_varp)) {
-        case ASC_TRUE:
-            ASC_PRINT1("advansys_reset: board %d: SCSI bus reset successful.\n",
-                boardp->id);
-            break;
-        case ASC_FALSE:
-        default:
-            ASC_PRINT1("advansys_reset: board %d: SCSI bus reset error.\n",
-                boardp->id);
-            ret = FAILED;
-            break;
-        }
-       spin_lock_irqsave(&boardp->lock, flags);
-        (void) AdvISR(adv_dvc_varp);
-    }
-    /* Board lock is held. */
+       if (ASC_NARROW_BOARD(boardp)) {
+               /*
+                * Narrow Board
+                */
+               asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
 
-    /*
-     * Dequeue all board 'done' requests. A pointer to the last request
-     * is returned in 'last_scp'.
-     */
-    done_scp = asc_dequeue_list(&boardp->done, &last_scp, ASC_TID_ALL);
+               /*
+                * Reset the chip and SCSI bus.
+                */
+               ASC_DBG(1, "advansys_reset: before AscInitAsc1000Driver()\n");
+               status = AscInitAsc1000Driver(asc_dvc_varp);
+
+               /* Refer to ASC_IERR_* defintions for meaning of 'err_code'. */
+               if (asc_dvc_varp->err_code) {
+                       ASC_PRINT2
+                           ("advansys_reset: board %d: SCSI bus reset error: 0x%x\n",
+                            boardp->id, asc_dvc_varp->err_code);
+                       ret = FAILED;
+               } else if (status) {
+                       ASC_PRINT2
+                           ("advansys_reset: board %d: SCSI bus reset warning: 0x%x\n",
+                            boardp->id, status);
+               } else {
+                       ASC_PRINT1
+                           ("advansys_reset: board %d: SCSI bus reset successful.\n",
+                            boardp->id);
+               }
+
+               ASC_DBG(1, "advansys_reset: after AscInitAsc1000Driver()\n");
+               spin_lock_irqsave(&boardp->lock, flags);
 
-    /*
-     * Dequeue all board 'active' requests for all devices and set
-     * the request status to DID_RESET. A pointer to the last request
-     * is returned in 'last_scp'.
-     */
-    if (done_scp == NULL) {
-        done_scp = asc_dequeue_list(&boardp->active, &last_scp, ASC_TID_ALL);
-        for (tscp = done_scp; tscp; tscp = REQPNEXT(tscp)) {
-            tscp->result = HOST_BYTE(DID_RESET);
-        }
-    } else {
-        /* Append to 'done_scp' at the end with 'last_scp'. */
-        ASC_ASSERT(last_scp != NULL);
-        last_scp->host_scribble = (unsigned char *)asc_dequeue_list(
-                       &boardp->active, &new_last_scp, ASC_TID_ALL);
-        if (new_last_scp != NULL) {
-            ASC_ASSERT(REQPNEXT(last_scp) != NULL);
-            for (tscp = REQPNEXT(last_scp); tscp; tscp = REQPNEXT(tscp)) {
-                tscp->result = HOST_BYTE(DID_RESET);
-            }
-            last_scp = new_last_scp;
-        }
-    }
+       } else {
+               /*
+                * Wide Board
+                *
+                * If the suggest reset bus flags are set, then reset the bus.
+                * Otherwise only reset the device.
+                */
+               adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
 
-    /*
-     * Dequeue all 'waiting' requests and set the request status
-     * to DID_RESET.
-     */
-    if (done_scp == NULL) {
-        done_scp = asc_dequeue_list(&boardp->waiting, &last_scp, ASC_TID_ALL);
-        for (tscp = done_scp; tscp; tscp = REQPNEXT(tscp)) {
-            tscp->result = HOST_BYTE(DID_RESET);
-        }
-    } else {
-        /* Append to 'done_scp' at the end with 'last_scp'. */
-        ASC_ASSERT(last_scp != NULL);
-        last_scp->host_scribble = (unsigned char *)asc_dequeue_list(
-                       &boardp->waiting, &new_last_scp, ASC_TID_ALL);
-        if (new_last_scp != NULL) {
-            ASC_ASSERT(REQPNEXT(last_scp) != NULL);
-            for (tscp = REQPNEXT(last_scp); tscp; tscp = REQPNEXT(tscp)) {
-                tscp->result = HOST_BYTE(DID_RESET);
-            }
-            last_scp = new_last_scp;
-        }
-    }
+               /*
+                * Reset the target's SCSI bus.
+                */
+               ASC_DBG(1, "advansys_reset: before AdvResetChipAndSB()\n");
+               switch (AdvResetChipAndSB(adv_dvc_varp)) {
+               case ASC_TRUE:
+                       ASC_PRINT1
+                           ("advansys_reset: board %d: SCSI bus reset successful.\n",
+                            boardp->id);
+                       break;
+               case ASC_FALSE:
+               default:
+                       ASC_PRINT1
+                           ("advansys_reset: board %d: SCSI bus reset error.\n",
+                            boardp->id);
+                       ret = FAILED;
+                       break;
+               }
+               spin_lock_irqsave(&boardp->lock, flags);
+               (void)AdvISR(adv_dvc_varp);
+       }
+       /* Board lock is held. */
+
+       /*
+        * Dequeue all board 'done' requests. A pointer to the last request
+        * is returned in 'last_scp'.
+        */
+       done_scp = asc_dequeue_list(&boardp->done, &last_scp, ASC_TID_ALL);
+
+       /*
+        * Dequeue all board 'active' requests for all devices and set
+        * the request status to DID_RESET. A pointer to the last request
+        * is returned in 'last_scp'.
+        */
+       if (done_scp == NULL) {
+               done_scp =
+                   asc_dequeue_list(&boardp->active, &last_scp, ASC_TID_ALL);
+               for (tscp = done_scp; tscp; tscp = REQPNEXT(tscp)) {
+                       tscp->result = HOST_BYTE(DID_RESET);
+               }
+       } else {
+               /* Append to 'done_scp' at the end with 'last_scp'. */
+               ASC_ASSERT(last_scp != NULL);
+               last_scp->host_scribble =
+                   (unsigned char *)asc_dequeue_list(&boardp->active,
+                                                     &new_last_scp,
+                                                     ASC_TID_ALL);
+               if (new_last_scp != NULL) {
+                       ASC_ASSERT(REQPNEXT(last_scp) != NULL);
+                       for (tscp = REQPNEXT(last_scp); tscp;
+                            tscp = REQPNEXT(tscp)) {
+                               tscp->result = HOST_BYTE(DID_RESET);
+                       }
+                       last_scp = new_last_scp;
+               }
+       }
 
-    /* Save the time of the most recently completed reset. */
-    boardp->last_reset = jiffies;
+       /*
+        * Dequeue all 'waiting' requests and set the request status
+        * to DID_RESET.
+        */
+       if (done_scp == NULL) {
+               done_scp =
+                   asc_dequeue_list(&boardp->waiting, &last_scp, ASC_TID_ALL);
+               for (tscp = done_scp; tscp; tscp = REQPNEXT(tscp)) {
+                       tscp->result = HOST_BYTE(DID_RESET);
+               }
+       } else {
+               /* Append to 'done_scp' at the end with 'last_scp'. */
+               ASC_ASSERT(last_scp != NULL);
+               last_scp->host_scribble =
+                   (unsigned char *)asc_dequeue_list(&boardp->waiting,
+                                                     &new_last_scp,
+                                                     ASC_TID_ALL);
+               if (new_last_scp != NULL) {
+                       ASC_ASSERT(REQPNEXT(last_scp) != NULL);
+                       for (tscp = REQPNEXT(last_scp); tscp;
+                            tscp = REQPNEXT(tscp)) {
+                               tscp->result = HOST_BYTE(DID_RESET);
+                       }
+                       last_scp = new_last_scp;
+               }
+       }
 
-    /* Clear reset flag. */
-    boardp->flags &= ~ASC_HOST_IN_RESET;
-    spin_unlock_irqrestore(&boardp->lock, flags);
+       /* Save the time of the most recently completed reset. */
+       boardp->last_reset = jiffies;
 
-    /*
-     * Complete all the 'done_scp' requests.
-     */
-    if (done_scp != NULL) {
-        asc_scsi_done_list(done_scp);
-    }
+       /* Clear reset flag. */
+       boardp->flags &= ~ASC_HOST_IN_RESET;
+       spin_unlock_irqrestore(&boardp->lock, flags);
+
+       /*
+        * Complete all the 'done_scp' requests.
+        */
+       if (done_scp != NULL) {
+               asc_scsi_done_list(done_scp);
+       }
 
-    ASC_DBG1(1, "advansys_reset: ret %d\n", ret);
+       ASC_DBG1(1, "advansys_reset: ret %d\n", ret);
 
-    return ret;
+       return ret;
 }
 
 /*
@@ -5834,71 +4621,70 @@ advansys_reset(struct scsi_cmnd *scp)
  */
 static int
 advansys_biosparam(struct scsi_device *sdev, struct block_device *bdev,
-               sector_t capacity, int ip[])
+                  sector_t capacity, int ip[])
 {
-    asc_board_t     *boardp;
-
-    ASC_DBG(1, "advansys_biosparam: begin\n");
-    ASC_STATS(sdev->host, biosparam);
-    boardp = ASC_BOARDP(sdev->host);
-    if (ASC_NARROW_BOARD(boardp)) {
-        if ((boardp->dvc_var.asc_dvc_var.dvc_cntl &
-             ASC_CNTL_BIOS_GT_1GB) && capacity > 0x200000) {
-                ip[0] = 255;
-                ip[1] = 63;
-        } else {
-                ip[0] = 64;
-                ip[1] = 32;
-        }
-    } else {
-        if ((boardp->dvc_var.adv_dvc_var.bios_ctrl &
-             BIOS_CTRL_EXTENDED_XLAT) && capacity > 0x200000) {
-                ip[0] = 255;
-                ip[1] = 63;
-        } else {
-                ip[0] = 64;
-                ip[1] = 32;
-        }
-    }
-    ip[2] = (unsigned long)capacity / (ip[0] * ip[1]);
-    ASC_DBG(1, "advansys_biosparam: end\n");
-    return 0;
+       asc_board_t *boardp;
+
+       ASC_DBG(1, "advansys_biosparam: begin\n");
+       ASC_STATS(sdev->host, biosparam);
+       boardp = ASC_BOARDP(sdev->host);
+       if (ASC_NARROW_BOARD(boardp)) {
+               if ((boardp->dvc_var.asc_dvc_var.dvc_cntl &
+                    ASC_CNTL_BIOS_GT_1GB) && capacity > 0x200000) {
+                       ip[0] = 255;
+                       ip[1] = 63;
+               } else {
+                       ip[0] = 64;
+                       ip[1] = 32;
+               }
+       } else {
+               if ((boardp->dvc_var.adv_dvc_var.bios_ctrl &
+                    BIOS_CTRL_EXTENDED_XLAT) && capacity > 0x200000) {
+                       ip[0] = 255;
+                       ip[1] = 63;
+               } else {
+                       ip[0] = 64;
+                       ip[1] = 32;
+               }
+       }
+       ip[2] = (unsigned long)capacity / (ip[0] * ip[1]);
+       ASC_DBG(1, "advansys_biosparam: end\n");
+       return 0;
 }
 
-/*
- * --- Loadable Driver Support
- */
+static int __init advansys_detect(struct scsi_host_template *tpnt);
+static int advansys_release(struct Scsi_Host *shp);
 
 static struct scsi_host_template driver_template = {
-    .proc_name                  = "advansys",
+       .proc_name = "advansys",
 #ifdef CONFIG_PROC_FS
-    .proc_info                  = advansys_proc_info,
+       .proc_info = advansys_proc_info,
 #endif
-    .name                       = "advansys",
-    .detect                     = advansys_detect, 
-    .release                    = advansys_release,
-    .info                       = advansys_info,
-    .queuecommand               = advansys_queuecommand,
-    .eh_bus_reset_handler      = advansys_reset,
-    .bios_param                 = advansys_biosparam,
-    .slave_configure           = advansys_slave_configure,
-    /*
-     * Because the driver may control an ISA adapter 'unchecked_isa_dma'
-     * must be set. The flag will be cleared in advansys_detect for non-ISA
-     * adapters. Refer to the comment in scsi_module.c for more information.
-     */
-    .unchecked_isa_dma          = 1,
-    /*
-     * All adapters controlled by this driver are capable of large
-     * scatter-gather lists. According to the mid-level SCSI documentation
-     * this obviates any performance gain provided by setting
-     * 'use_clustering'. But empirically while CPU utilization is increased
-     * by enabling clustering, I/O throughput increases as well.
-     */
-    .use_clustering             = ENABLE_CLUSTERING,
+       .name = "advansys",
+       .detect = advansys_detect,
+       .release = advansys_release,
+       .info = advansys_info,
+       .queuecommand = advansys_queuecommand,
+       .eh_bus_reset_handler = advansys_reset,
+       .bios_param = advansys_biosparam,
+       .slave_configure = advansys_slave_configure,
+       /*
+        * Because the driver may control an ISA adapter 'unchecked_isa_dma'
+        * must be set. The flag will be cleared in advansys_detect for non-ISA
+        * adapters. Refer to the comment in scsi_module.c for more information.
+        */
+       .unchecked_isa_dma = 1,
+       /*
+        * All adapters controlled by this driver are capable of large
+        * scatter-gather lists. According to the mid-level SCSI documentation
+        * this obviates any performance gain provided by setting
+        * 'use_clustering'. But empirically while CPU utilization is increased
+        * by enabling clustering, I/O throughput increases as well.
+        */
+       .use_clustering = ENABLE_CLUSTERING,
 };
-#include "scsi_module.c"
 
+#include "scsi_module.c"
 
 /*
  * --- Miscellaneous Driver Functions
@@ -5913,130 +4699,138 @@ static struct scsi_host_template driver_template = {
  * to the AdvanSys driver which is for a device sharing an interrupt with
  * an AdvanSys adapter.
  */
-STATIC irqreturn_t
-advansys_interrupt(int irq, void *dev_id)
+static irqreturn_t advansys_interrupt(int irq, void *dev_id)
 {
-    ulong           flags;
-    int             i;
-    asc_board_t     *boardp;
-    struct scsi_cmnd       *done_scp = NULL, *last_scp = NULL;
-    struct scsi_cmnd       *new_last_scp;
-    struct Scsi_Host *shp;
-
-    ASC_DBG(1, "advansys_interrupt: begin\n");
+       ulong flags;
+       int i;
+       asc_board_t *boardp;
+       struct scsi_cmnd *done_scp = NULL, *last_scp = NULL;
+       struct scsi_cmnd *new_last_scp;
+       struct Scsi_Host *shost;
+
+       ASC_DBG(1, "advansys_interrupt: begin\n");
+
+       /*
+        * Check for interrupts on all boards.
+        * AscISR() will call asc_isr_callback().
+        */
+       for (i = 0; i < asc_board_count; i++) {
+               shost = asc_host[i];
+               boardp = ASC_BOARDP(shost);
+               ASC_DBG2(2, "advansys_interrupt: i %d, boardp 0x%lx\n",
+                        i, (ulong)boardp);
+               spin_lock_irqsave(&boardp->lock, flags);
+               if (ASC_NARROW_BOARD(boardp)) {
+                       /*
+                        * Narrow Board
+                        */
+                       if (AscIsIntPending(shost->io_port)) {
+                               ASC_STATS(shost, interrupt);
+                               ASC_DBG(1,
+                                       "advansys_interrupt: before AscISR()\n");
+                               AscISR(&boardp->dvc_var.asc_dvc_var);
+                       }
+               } else {
+                       /*
+                        * Wide Board
+                        */
+                       ASC_DBG(1, "advansys_interrupt: before AdvISR()\n");
+                       if (AdvISR(&boardp->dvc_var.adv_dvc_var)) {
+                               ASC_STATS(shost, interrupt);
+                       }
+               }
 
-    /*
-     * Check for interrupts on all boards.
-     * AscISR() will call asc_isr_callback().
-     */
-    for (i = 0; i < asc_board_count; i++) {
-       shp = asc_host[i];
-        boardp = ASC_BOARDP(shp);
-        ASC_DBG2(2, "advansys_interrupt: i %d, boardp 0x%lx\n",
-            i, (ulong) boardp);
-        spin_lock_irqsave(&boardp->lock, flags);
-        if (ASC_NARROW_BOARD(boardp)) {
-            /*
-             * Narrow Board
-             */
-            if (AscIsIntPending(shp->io_port)) {
-                ASC_STATS(shp, interrupt);
-                ASC_DBG(1, "advansys_interrupt: before AscISR()\n");
-                AscISR(&boardp->dvc_var.asc_dvc_var);
-            }
-        } else {
-            /*
-             * Wide Board
-             */
-            ASC_DBG(1, "advansys_interrupt: before AdvISR()\n");
-            if (AdvISR(&boardp->dvc_var.adv_dvc_var)) {
-                ASC_STATS(shp, interrupt);
-            }
-        }
-
-        /*
-         * Start waiting requests and create a list of completed requests.
-         *
-         * If a reset request is being performed for the board, the reset
-         * handler will complete pending requests after it has completed.
-         */
-        if ((boardp->flags & ASC_HOST_IN_RESET) == 0) {
-            ASC_DBG2(1, "advansys_interrupt: done_scp 0x%lx, last_scp 0x%lx\n",
-                (ulong) done_scp, (ulong) last_scp);
-
-            /* Start any waiting commands for the board. */
-            if (!ASC_QUEUE_EMPTY(&boardp->waiting)) {
-                ASC_DBG(1, "advansys_interrupt: before asc_execute_queue()\n");
-                asc_execute_queue(&boardp->waiting);
-            }
-
-             /*
-              * Add to the list of requests that must be completed.
-              *
-              * 'done_scp' will always be NULL on the first iteration
-              * of this loop. 'last_scp' is set at the same time as
-              * 'done_scp'.
-              */
-            if (done_scp == NULL) {
-                done_scp = asc_dequeue_list(&boardp->done, &last_scp,
-                    ASC_TID_ALL);
-            } else {
-                ASC_ASSERT(last_scp != NULL);
-                last_scp->host_scribble = (unsigned char *)asc_dequeue_list(
-                       &boardp->done, &new_last_scp, ASC_TID_ALL);
-                if (new_last_scp != NULL) {
-                    ASC_ASSERT(REQPNEXT(last_scp) != NULL);
-                    last_scp = new_last_scp;
-                }
-            }
-        }
-        spin_unlock_irqrestore(&boardp->lock, flags);
-    }
+               /*
+                * Start waiting requests and create a list of completed requests.
+                *
+                * If a reset request is being performed for the board, the reset
+                * handler will complete pending requests after it has completed.
+                */
+               if ((boardp->flags & ASC_HOST_IN_RESET) == 0) {
+                       ASC_DBG2(1,
+                                "advansys_interrupt: done_scp 0x%lx, last_scp 0x%lx\n",
+                                (ulong)done_scp, (ulong)last_scp);
+
+                       /* Start any waiting commands for the board. */
+                       if (!ASC_QUEUE_EMPTY(&boardp->waiting)) {
+                               ASC_DBG(1,
+                                       "advansys_interrupt: before asc_execute_queue()\n");
+                               asc_execute_queue(&boardp->waiting);
+                       }
+
+                       /*
+                        * Add to the list of requests that must be completed.
+                        *
+                        * 'done_scp' will always be NULL on the first iteration
+                        * of this loop. 'last_scp' is set at the same time as
+                        * 'done_scp'.
+                        */
+                       if (done_scp == NULL) {
+                               done_scp =
+                                   asc_dequeue_list(&boardp->done, &last_scp,
+                                                    ASC_TID_ALL);
+                       } else {
+                               ASC_ASSERT(last_scp != NULL);
+                               last_scp->host_scribble =
+                                   (unsigned char *)asc_dequeue_list(&boardp->
+                                                                     done,
+                                                                     &new_last_scp,
+                                                                     ASC_TID_ALL);
+                               if (new_last_scp != NULL) {
+                                       ASC_ASSERT(REQPNEXT(last_scp) != NULL);
+                                       last_scp = new_last_scp;
+                               }
+                       }
+               }
+               spin_unlock_irqrestore(&boardp->lock, flags);
+       }
 
-    /*
-     * If interrupts were enabled on entry, then they
-     * are now enabled here.
-     *
-     * Complete all requests on the done list.
-     */
+       /*
+        * If interrupts were enabled on entry, then they
+        * are now enabled here.
+        *
+        * Complete all requests on the done list.
+        */
 
-    asc_scsi_done_list(done_scp);
+       asc_scsi_done_list(done_scp);
 
-    ASC_DBG(1, "advansys_interrupt: end\n");
-    return IRQ_HANDLED;
+       ASC_DBG(1, "advansys_interrupt: end\n");
+       return IRQ_HANDLED;
 }
 
 /*
  * Set the number of commands to queue per device for the
  * specified host adapter.
  */
-STATIC int
-advansys_slave_configure(struct scsi_device *device)
+static int advansys_slave_configure(struct scsi_device *device)
 {
-    asc_board_t        *boardp;
+       asc_board_t *boardp;
 
-    boardp = ASC_BOARDP(device->host);
-    boardp->flags |= ASC_SELECT_QUEUE_DEPTHS;
-    /*
-     * Save a pointer to the device and set its initial/maximum
-     * queue depth.  Only save the pointer for a lun0 dev though.
-     */
-    if(device->lun == 0)
-        boardp->device[device->id] = device;
-    if(device->tagged_supported) {
-        if (ASC_NARROW_BOARD(boardp)) {
-           scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
-                boardp->dvc_var.asc_dvc_var.max_dvc_qng[device->id]);
-        } else {
-           scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
-                boardp->dvc_var.adv_dvc_var.max_dvc_qng);
-        }
-    } else {
-       scsi_adjust_queue_depth(device, 0, device->host->cmd_per_lun);
-    }
-    ASC_DBG4(1, "advansys_slave_configure: device 0x%lx, boardp 0x%lx, id %d, depth %d\n",
-            (ulong) device, (ulong) boardp, device->id, device->queue_depth);
-    return 0;
+       boardp = ASC_BOARDP(device->host);
+       boardp->flags |= ASC_SELECT_QUEUE_DEPTHS;
+       /*
+        * Save a pointer to the device and set its initial/maximum
+        * queue depth.  Only save the pointer for a lun0 dev though.
+        */
+       if (device->lun == 0)
+               boardp->device[device->id] = device;
+       if (device->tagged_supported) {
+               if (ASC_NARROW_BOARD(boardp)) {
+                       scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
+                                               boardp->dvc_var.asc_dvc_var.
+                                               max_dvc_qng[device->id]);
+               } else {
+                       scsi_adjust_queue_depth(device, MSG_ORDERED_TAG,
+                                               boardp->dvc_var.adv_dvc_var.
+                                               max_dvc_qng);
+               }
+       } else {
+               scsi_adjust_queue_depth(device, 0, device->host->cmd_per_lun);
+       }
+       ASC_DBG4(1,
+                "advansys_slave_configure: device 0x%lx, boardp 0x%lx, id %d, depth %d\n",
+                (ulong)device, (ulong)boardp, device->id, device->queue_depth);
+       return 0;
 }
 
 /*
@@ -6045,43 +4839,44 @@ advansys_slave_configure(struct scsi_device *device)
  *
  * Interrupts can be enabled on entry.
  */
-STATIC void
-asc_scsi_done_list(struct scsi_cmnd *scp)
+static void asc_scsi_done_list(struct scsi_cmnd *scp)
 {
-    struct scsi_cmnd    *tscp;
+       struct scsi_cmnd *tscp;
 
-    ASC_DBG(2, "asc_scsi_done_list: begin\n");
-    while (scp != NULL) {
-       asc_board_t *boardp;
-       struct device *dev;
+       ASC_DBG(2, "asc_scsi_done_list: begin\n");
+       while (scp != NULL) {
+               asc_board_t *boardp;
+               struct device *dev;
 
-        ASC_DBG1(3, "asc_scsi_done_list: scp 0x%lx\n", (ulong) scp);
-        tscp = REQPNEXT(scp);
-        scp->host_scribble = NULL;
+               ASC_DBG1(3, "asc_scsi_done_list: scp 0x%lx\n", (ulong)scp);
+               tscp = REQPNEXT(scp);
+               scp->host_scribble = NULL;
 
-       boardp = ASC_BOARDP(scp->device->host);
+               boardp = ASC_BOARDP(scp->device->host);
 
-       if (ASC_NARROW_BOARD(boardp))
-           dev = boardp->dvc_cfg.asc_dvc_cfg.dev;
-       else
-           dev = boardp->dvc_cfg.adv_dvc_cfg.dev;
+               if (ASC_NARROW_BOARD(boardp))
+                       dev = boardp->dvc_cfg.asc_dvc_cfg.dev;
+               else
+                       dev = boardp->dvc_cfg.adv_dvc_cfg.dev;
 
-       if (scp->use_sg)
-           dma_unmap_sg(dev, (struct scatterlist *)scp->request_buffer,
-                        scp->use_sg, scp->sc_data_direction);
-       else if (scp->request_bufflen)
-           dma_unmap_single(dev, scp->SCp.dma_handle,
-                            scp->request_bufflen, scp->sc_data_direction);
+               if (scp->use_sg)
+                       dma_unmap_sg(dev,
+                                    (struct scatterlist *)scp->request_buffer,
+                                    scp->use_sg, scp->sc_data_direction);
+               else if (scp->request_bufflen)
+                       dma_unmap_single(dev, scp->SCp.dma_handle,
+                                        scp->request_bufflen,
+                                        scp->sc_data_direction);
 
-        ASC_STATS(scp->device->host, done);
-        ASC_ASSERT(scp->scsi_done != NULL);
+               ASC_STATS(scp->device->host, done);
+               ASC_ASSERT(scp->scsi_done != NULL);
 
-        scp->scsi_done(scp);
+               scp->scsi_done(scp);
 
-        scp = tscp;
-    }
-    ASC_DBG(2, "asc_scsi_done_list: done\n");
-    return;
+               scp = tscp;
+       }
+       ASC_DBG(2, "asc_scsi_done_list: done\n");
+       return;
 }
 
 /*
@@ -6130,168 +4925,170 @@ asc_scsi_done_list(struct scsi_cmnd *scp)
  * If ASC_BUSY is returned the request will be enqueued by the
  * caller on the target's waiting queue and re-tried later.
  */
-STATIC int
-asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
+static int asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
 {
-    asc_board_t        *boardp;
-    ASC_DVC_VAR        *asc_dvc_varp;
-    ADV_DVC_VAR        *adv_dvc_varp;
-    ADV_SCSI_REQ_Q     *adv_scsiqp;
-    struct scsi_device *device;
-    int                ret;
-
-    ASC_DBG2(1, "asc_execute_scsi_cmnd: scp 0x%lx, done 0x%lx\n",
-        (ulong) scp, (ulong) scp->scsi_done);
-
-    boardp = ASC_BOARDP(scp->device->host);
-    device = boardp->device[scp->device->id];
-
-    if (ASC_NARROW_BOARD(boardp)) {
-        /*
-         * Build and execute Narrow Board request.
-         */
-
-        asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
-
-        /*
-         * Build Asc Library request structure using the
-         * global structures 'asc_scsi_req' and 'asc_sg_head'.
-         *
-         * If an error is returned, then the request has been
-         * queued on the board done queue. It will be completed
-         * by the caller.
-         *
-         * asc_build_req() can not return ASC_BUSY.
-         */
-        if (asc_build_req(boardp, scp) == ASC_ERROR) {
-            ASC_STATS(scp->device->host, build_error);
-            return ASC_ERROR;
-        }
-
-        /*
-         * Execute the command. If there is no error, add the command
-         * to the active queue.
-         */
-        switch (ret = AscExeScsiQueue(asc_dvc_varp, &asc_scsi_q)) {
-        case ASC_NOERROR:
-            ASC_STATS(scp->device->host, exe_noerror);
-            /*
-             * Increment monotonically increasing per device successful
-             * request counter. Wrapping doesn't matter.
-             */
-            boardp->reqcnt[scp->device->id]++;
-            asc_enqueue(&boardp->active, scp, ASC_BACK);
-            ASC_DBG(1,
-                "asc_execute_scsi_cmnd: AscExeScsiQueue(), ASC_NOERROR\n");
-            break;
-        case ASC_BUSY:
-            /*
-             * Caller will enqueue request on the target's waiting queue
-             * and retry later.
-             */
-            ASC_STATS(scp->device->host, exe_busy);
-            break;
-        case ASC_ERROR:
-            ASC_PRINT2(
-"asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
-                boardp->id, asc_dvc_varp->err_code);
-            ASC_STATS(scp->device->host, exe_error);
-            scp->result = HOST_BYTE(DID_ERROR);
-            asc_enqueue(&boardp->done, scp, ASC_BACK);
-            break;
-        default:
-            ASC_PRINT2(
-"asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() unknown, err_code 0x%x\n",
-                boardp->id, asc_dvc_varp->err_code);
-            ASC_STATS(scp->device->host, exe_unknown);
-            scp->result = HOST_BYTE(DID_ERROR);
-            asc_enqueue(&boardp->done, scp, ASC_BACK);
-            break;
-        }
-    } else {
-        /*
-         * Build and execute Wide Board request.
-         */
-        adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
-
-        /*
-         * Build and get a pointer to an Adv Library request structure.
-         *
-         * If the request is successfully built then send it below,
-         * otherwise return with an error.
-         */
-        switch (adv_build_req(boardp, scp, &adv_scsiqp)) {
-        case ASC_NOERROR:
-            ASC_DBG(3, "asc_execute_scsi_cmnd: adv_build_req ASC_NOERROR\n");
-            break;
-        case ASC_BUSY:
-            ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req ASC_BUSY\n");
-            /*
-             * If busy is returned the request has not been enqueued.
-             * It will be enqueued by the caller on the target's waiting
-             * queue and retried later.
-             *
-             * The asc_stats fields 'adv_build_noreq' and 'adv_build_nosg'
-             * count wide board busy conditions. They are updated in
-             * adv_build_req and adv_get_sglist, respectively.
-             */
-            return ASC_BUSY;
-        case ASC_ERROR:
-             /* 
-              * If an error is returned, then the request has been
-              * queued on the board done queue. It will be completed
-              * by the caller.
-              */
-        default:
-            ASC_DBG(1, "asc_execute_scsi_cmnd: adv_build_req ASC_ERROR\n");
-            ASC_STATS(scp->device->host, build_error);
-            return ASC_ERROR;
-        }
-
-        /*
-         * Execute the command. If there is no error, add the command
-         * to the active queue.
-         */
-        switch (ret = AdvExeScsiQueue(adv_dvc_varp, adv_scsiqp)) {
-        case ASC_NOERROR:
-            ASC_STATS(scp->device->host, exe_noerror);
-            /*
-             * Increment monotonically increasing per device successful
-             * request counter. Wrapping doesn't matter.
-             */
-            boardp->reqcnt[scp->device->id]++;
-            asc_enqueue(&boardp->active, scp, ASC_BACK);
-            ASC_DBG(1,
-                "asc_execute_scsi_cmnd: AdvExeScsiQueue(), ASC_NOERROR\n");
-            break;
-        case ASC_BUSY:
-            /*
-             * Caller will enqueue request on the target's waiting queue
-             * and retry later.
-             */
-            ASC_STATS(scp->device->host, exe_busy);
-            break;
-        case ASC_ERROR:
-            ASC_PRINT2(
-"asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
-                boardp->id, adv_dvc_varp->err_code);
-            ASC_STATS(scp->device->host, exe_error);
-            scp->result = HOST_BYTE(DID_ERROR);
-            asc_enqueue(&boardp->done, scp, ASC_BACK);
-            break;
-        default:
-            ASC_PRINT2(
-"asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() unknown, err_code 0x%x\n",
-                boardp->id, adv_dvc_varp->err_code);
-            ASC_STATS(scp->device->host, exe_unknown);
-            scp->result = HOST_BYTE(DID_ERROR);
-            asc_enqueue(&boardp->done, scp, ASC_BACK);
-            break;
-        }
-    }
+       asc_board_t *boardp;
+       ASC_DVC_VAR *asc_dvc_varp;
+       ADV_DVC_VAR *adv_dvc_varp;
+       ADV_SCSI_REQ_Q *adv_scsiqp;
+       struct scsi_device *device;
+       int ret;
+
+       ASC_DBG2(1, "asc_execute_scsi_cmnd: scp 0x%lx, done 0x%lx\n",
+                (ulong)scp, (ulong)scp->scsi_done);
+
+       boardp = ASC_BOARDP(scp->device->host);
+       device = boardp->device[scp->device->id];
+
+       if (ASC_NARROW_BOARD(boardp)) {
+               /*
+                * Build and execute Narrow Board request.
+                */
+
+               asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
+
+               /*
+                * Build Asc Library request structure using the
+                * global structures 'asc_scsi_req' and 'asc_sg_head'.
+                *
+                * If an error is returned, then the request has been
+                * queued on the board done queue. It will be completed
+                * by the caller.
+                *
+                * asc_build_req() can not return ASC_BUSY.
+                */
+               if (asc_build_req(boardp, scp) == ASC_ERROR) {
+                       ASC_STATS(scp->device->host, build_error);
+                       return ASC_ERROR;
+               }
+
+               /*
+                * Execute the command. If there is no error, add the command
+                * to the active queue.
+                */
+               switch (ret = AscExeScsiQueue(asc_dvc_varp, &asc_scsi_q)) {
+               case ASC_NOERROR:
+                       ASC_STATS(scp->device->host, exe_noerror);
+                       /*
+                        * Increment monotonically increasing per device successful
+                        * request counter. Wrapping doesn't matter.
+                        */
+                       boardp->reqcnt[scp->device->id]++;
+                       asc_enqueue(&boardp->active, scp, ASC_BACK);
+                       ASC_DBG(1,
+                               "asc_execute_scsi_cmnd: AscExeScsiQueue(), ASC_NOERROR\n");
+                       break;
+               case ASC_BUSY:
+                       /*
+                        * Caller will enqueue request on the target's waiting queue
+                        * and retry later.
+                        */
+                       ASC_STATS(scp->device->host, exe_busy);
+                       break;
+               case ASC_ERROR:
+                       ASC_PRINT2
+                           ("asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
+                            boardp->id, asc_dvc_varp->err_code);
+                       ASC_STATS(scp->device->host, exe_error);
+                       scp->result = HOST_BYTE(DID_ERROR);
+                       asc_enqueue(&boardp->done, scp, ASC_BACK);
+                       break;
+               default:
+                       ASC_PRINT2
+                           ("asc_execute_scsi_cmnd: board %d: AscExeScsiQueue() unknown, err_code 0x%x\n",
+                            boardp->id, asc_dvc_varp->err_code);
+                       ASC_STATS(scp->device->host, exe_unknown);
+                       scp->result = HOST_BYTE(DID_ERROR);
+                       asc_enqueue(&boardp->done, scp, ASC_BACK);
+                       break;
+               }
+       } else {
+               /*
+                * Build and execute Wide Board request.
+                */
+               adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
+
+               /*
+                * Build and get a pointer to an Adv Library request structure.
+                *
+                * If the request is successfully built then send it below,
+                * otherwise return with an error.
+                */
+               switch (adv_build_req(boardp, scp, &adv_scsiqp)) {
+               case ASC_NOERROR:
+                       ASC_DBG(3,
+                               "asc_execute_scsi_cmnd: adv_build_req ASC_NOERROR\n");
+                       break;
+               case ASC_BUSY:
+                       ASC_DBG(1,
+                               "asc_execute_scsi_cmnd: adv_build_req ASC_BUSY\n");
+                       /*
+                        * If busy is returned the request has not been enqueued.
+                        * It will be enqueued by the caller on the target's waiting
+                        * queue and retried later.
+                        *
+                        * The asc_stats fields 'adv_build_noreq' and 'adv_build_nosg'
+                        * count wide board busy conditions. They are updated in
+                        * adv_build_req and adv_get_sglist, respectively.
+                        */
+                       return ASC_BUSY;
+               case ASC_ERROR:
+                       /* 
+                        * If an error is returned, then the request has been
+                        * queued on the board done queue. It will be completed
+                        * by the caller.
+                        */
+               default:
+                       ASC_DBG(1,
+                               "asc_execute_scsi_cmnd: adv_build_req ASC_ERROR\n");
+                       ASC_STATS(scp->device->host, build_error);
+                       return ASC_ERROR;
+               }
 
-    ASC_DBG(1, "asc_execute_scsi_cmnd: end\n");
-    return ret;
+               /*
+                * Execute the command. If there is no error, add the command
+                * to the active queue.
+                */
+               switch (ret = AdvExeScsiQueue(adv_dvc_varp, adv_scsiqp)) {
+               case ASC_NOERROR:
+                       ASC_STATS(scp->device->host, exe_noerror);
+                       /*
+                        * Increment monotonically increasing per device successful
+                        * request counter. Wrapping doesn't matter.
+                        */
+                       boardp->reqcnt[scp->device->id]++;
+                       asc_enqueue(&boardp->active, scp, ASC_BACK);
+                       ASC_DBG(1,
+                               "asc_execute_scsi_cmnd: AdvExeScsiQueue(), ASC_NOERROR\n");
+                       break;
+               case ASC_BUSY:
+                       /*
+                        * Caller will enqueue request on the target's waiting queue
+                        * and retry later.
+                        */
+                       ASC_STATS(scp->device->host, exe_busy);
+                       break;
+               case ASC_ERROR:
+                       ASC_PRINT2
+                           ("asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() ASC_ERROR, err_code 0x%x\n",
+                            boardp->id, adv_dvc_varp->err_code);
+                       ASC_STATS(scp->device->host, exe_error);
+                       scp->result = HOST_BYTE(DID_ERROR);
+                       asc_enqueue(&boardp->done, scp, ASC_BACK);
+                       break;
+               default:
+                       ASC_PRINT2
+                           ("asc_execute_scsi_cmnd: board %d: AdvExeScsiQueue() unknown, err_code 0x%x\n",
+                            boardp->id, adv_dvc_varp->err_code);
+                       ASC_STATS(scp->device->host, exe_unknown);
+                       scp->result = HOST_BYTE(DID_ERROR);
+                       asc_enqueue(&boardp->done, scp, ASC_BACK);
+                       break;
+               }
+       }
+
+       ASC_DBG(1, "asc_execute_scsi_cmnd: end\n");
+       return ret;
 }
 
 /*
@@ -6303,131 +5100,140 @@ asc_execute_scsi_cmnd(struct scsi_cmnd *scp)
  * If an error occurs, then queue the request on the board done
  * queue and return ASC_ERROR.
  */
-STATIC int
-asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp)
+static int asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp)
 {
-    struct device *dev = boardp->dvc_cfg.asc_dvc_cfg.dev;
-
-    /*
-     * Mutually exclusive access is required to 'asc_scsi_q' and
-     * 'asc_sg_head' until after the request is started.
-     */
-    memset(&asc_scsi_q, 0, sizeof(ASC_SCSI_Q));
-
-    /*
-     * Point the ASC_SCSI_Q to the 'struct scsi_cmnd'.
-     */
-    asc_scsi_q.q2.srb_ptr = ASC_VADDR_TO_U32(scp);
-
-    /*
-     * Build the ASC_SCSI_Q request.
-     *
-     * For narrow boards a CDB length maximum of 12 bytes
-     * is supported.
-     */
-    if (scp->cmd_len > ASC_MAX_CDB_LEN) {
-        ASC_PRINT3(
-"asc_build_req: board %d: cmd_len %d > ASC_MAX_CDB_LEN  %d\n",
-            boardp->id, scp->cmd_len, ASC_MAX_CDB_LEN);
-        scp->result = HOST_BYTE(DID_ERROR);
-        asc_enqueue(&boardp->done, scp, ASC_BACK);
-        return ASC_ERROR;
-    }
-    asc_scsi_q.cdbptr = &scp->cmnd[0];
-    asc_scsi_q.q2.cdb_len = scp->cmd_len;
-    asc_scsi_q.q1.target_id = ASC_TID_TO_TARGET_ID(scp->device->id);
-    asc_scsi_q.q1.target_lun = scp->device->lun;
-    asc_scsi_q.q2.target_ix = ASC_TIDLUN_TO_IX(scp->device->id, scp->device->lun);
-    asc_scsi_q.q1.sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0]));
-    asc_scsi_q.q1.sense_len = sizeof(scp->sense_buffer);
+       struct device *dev = boardp->dvc_cfg.asc_dvc_cfg.dev;
+
+       /*
+        * Mutually exclusive access is required to 'asc_scsi_q' and
+        * 'asc_sg_head' until after the request is started.
+        */
+       memset(&asc_scsi_q, 0, sizeof(ASC_SCSI_Q));
+
+       /*
+        * Point the ASC_SCSI_Q to the 'struct scsi_cmnd'.
+        */
+       asc_scsi_q.q2.srb_ptr = ASC_VADDR_TO_U32(scp);
+
+       /*
+        * Build the ASC_SCSI_Q request.
+        *
+        * For narrow boards a CDB length maximum of 12 bytes
+        * is supported.
+        */
+       if (scp->cmd_len > ASC_MAX_CDB_LEN) {
+               ASC_PRINT3
+                   ("asc_build_req: board %d: cmd_len %d > ASC_MAX_CDB_LEN  %d\n",
+                    boardp->id, scp->cmd_len, ASC_MAX_CDB_LEN);
+               scp->result = HOST_BYTE(DID_ERROR);
+               asc_enqueue(&boardp->done, scp, ASC_BACK);
+               return ASC_ERROR;
+       }
+       asc_scsi_q.cdbptr = &scp->cmnd[0];
+       asc_scsi_q.q2.cdb_len = scp->cmd_len;
+       asc_scsi_q.q1.target_id = ASC_TID_TO_TARGET_ID(scp->device->id);
+       asc_scsi_q.q1.target_lun = scp->device->lun;
+       asc_scsi_q.q2.target_ix =
+           ASC_TIDLUN_TO_IX(scp->device->id, scp->device->lun);
+       asc_scsi_q.q1.sense_addr =
+           cpu_to_le32(virt_to_bus(&scp->sense_buffer[0]));
+       asc_scsi_q.q1.sense_len = sizeof(scp->sense_buffer);
+
+       /*
+        * If there are any outstanding requests for the current target,
+        * then every 255th request send an ORDERED request. This heuristic
+        * tries to retain the benefit of request sorting while preventing
+        * request starvation. 255 is the max number of tags or pending commands
+        * a device may have outstanding.
+        *
+        * The request count is incremented below for every successfully
+        * started request.
+        *
+        */
+       if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->device->id] > 0) &&
+           (boardp->reqcnt[scp->device->id] % 255) == 0) {
+               asc_scsi_q.q2.tag_code = MSG_ORDERED_TAG;
+       } else {
+               asc_scsi_q.q2.tag_code = MSG_SIMPLE_TAG;
+       }
 
-    /*
-     * If there are any outstanding requests for the current target,
-     * then every 255th request send an ORDERED request. This heuristic
-     * tries to retain the benefit of request sorting while preventing
-     * request starvation. 255 is the max number of tags or pending commands
-     * a device may have outstanding.
-     *
-     * The request count is incremented below for every successfully
-     * started request.
-     *
-     */
-    if ((boardp->dvc_var.asc_dvc_var.cur_dvc_qng[scp->device->id] > 0) &&
-        (boardp->reqcnt[scp->device->id] % 255) == 0) {
-        asc_scsi_q.q2.tag_code = MSG_ORDERED_TAG;
-    } else {
-        asc_scsi_q.q2.tag_code = MSG_SIMPLE_TAG;
-    }
+       /*
+        * Build ASC_SCSI_Q for a contiguous buffer or a scatter-gather
+        * buffer command.
+        */
+       if (scp->use_sg == 0) {
+               /*
+                * CDB request of single contiguous buffer.
+                */
+               ASC_STATS(scp->device->host, cont_cnt);
+               scp->SCp.dma_handle = scp->request_bufflen ?
+                   dma_map_single(dev, scp->request_buffer,
+                                  scp->request_bufflen,
+                                  scp->sc_data_direction) : 0;
+               asc_scsi_q.q1.data_addr = cpu_to_le32(scp->SCp.dma_handle);
+               asc_scsi_q.q1.data_cnt = cpu_to_le32(scp->request_bufflen);
+               ASC_STATS_ADD(scp->device->host, cont_xfer,
+                             ASC_CEILING(scp->request_bufflen, 512));
+               asc_scsi_q.q1.sg_queue_cnt = 0;
+               asc_scsi_q.sg_head = NULL;
+       } else {
+               /*
+                * CDB scatter-gather request list.
+                */
+               int sgcnt;
+               int use_sg;
+               struct scatterlist *slp;
+
+               slp = (struct scatterlist *)scp->request_buffer;
+               use_sg =
+                   dma_map_sg(dev, slp, scp->use_sg, scp->sc_data_direction);
+
+               if (use_sg > scp->device->host->sg_tablesize) {
+                       ASC_PRINT3
+                           ("asc_build_req: board %d: use_sg %d > sg_tablesize %d\n",
+                            boardp->id, use_sg,
+                            scp->device->host->sg_tablesize);
+                       dma_unmap_sg(dev, slp, scp->use_sg,
+                                    scp->sc_data_direction);
+                       scp->result = HOST_BYTE(DID_ERROR);
+                       asc_enqueue(&boardp->done, scp, ASC_BACK);
+                       return ASC_ERROR;
+               }
+
+               ASC_STATS(scp->device->host, sg_cnt);
 
-    /*
-     * Build ASC_SCSI_Q for a contiguous buffer or a scatter-gather
-     * buffer command.
-     */
-    if (scp->use_sg == 0) {
-        /*
-         * CDB request of single contiguous buffer.
-         */
-        ASC_STATS(scp->device->host, cont_cnt);
-       scp->SCp.dma_handle = scp->request_bufflen ?
-           dma_map_single(dev, scp->request_buffer,
-                          scp->request_bufflen, scp->sc_data_direction) : 0;
-       asc_scsi_q.q1.data_addr = cpu_to_le32(scp->SCp.dma_handle);
-        asc_scsi_q.q1.data_cnt = cpu_to_le32(scp->request_bufflen);
-        ASC_STATS_ADD(scp->device->host, cont_xfer,
-                      ASC_CEILING(scp->request_bufflen, 512));
-        asc_scsi_q.q1.sg_queue_cnt = 0;
-        asc_scsi_q.sg_head = NULL;
-    } else {
-        /*
-         * CDB scatter-gather request list.
-         */
-        int                     sgcnt;
-       int                     use_sg;
-        struct scatterlist      *slp;
+               /*
+                * Use global ASC_SG_HEAD structure and set the ASC_SCSI_Q
+                * structure to point to it.
+                */
+               memset(&asc_sg_head, 0, sizeof(ASC_SG_HEAD));
+
+               asc_scsi_q.q1.cntl |= QC_SG_HEAD;
+               asc_scsi_q.sg_head = &asc_sg_head;
+               asc_scsi_q.q1.data_cnt = 0;
+               asc_scsi_q.q1.data_addr = 0;
+               /* This is a byte value, otherwise it would need to be swapped. */
+               asc_sg_head.entry_cnt = asc_scsi_q.q1.sg_queue_cnt = use_sg;
+               ASC_STATS_ADD(scp->device->host, sg_elem,
+                             asc_sg_head.entry_cnt);
 
-       slp = (struct scatterlist *)scp->request_buffer;
-       use_sg = dma_map_sg(dev, slp, scp->use_sg, scp->sc_data_direction);
-
-       if (use_sg > scp->device->host->sg_tablesize) {
-            ASC_PRINT3(
-"asc_build_req: board %d: use_sg %d > sg_tablesize %d\n",
-               boardp->id, use_sg, scp->device->host->sg_tablesize);
-           dma_unmap_sg(dev, slp, scp->use_sg, scp->sc_data_direction);
-            scp->result = HOST_BYTE(DID_ERROR);
-            asc_enqueue(&boardp->done, scp, ASC_BACK);
-            return ASC_ERROR;
-        }
-
-        ASC_STATS(scp->device->host, sg_cnt);
-
-        /*
-         * Use global ASC_SG_HEAD structure and set the ASC_SCSI_Q
-         * structure to point to it.
-         */
-        memset(&asc_sg_head, 0, sizeof(ASC_SG_HEAD));
-
-        asc_scsi_q.q1.cntl |= QC_SG_HEAD;
-        asc_scsi_q.sg_head = &asc_sg_head;
-        asc_scsi_q.q1.data_cnt = 0;
-        asc_scsi_q.q1.data_addr = 0;
-        /* This is a byte value, otherwise it would need to be swapped. */
-       asc_sg_head.entry_cnt = asc_scsi_q.q1.sg_queue_cnt = use_sg;
-        ASC_STATS_ADD(scp->device->host, sg_elem, asc_sg_head.entry_cnt);
-
-        /*
-         * Convert scatter-gather list into ASC_SG_HEAD list.
-         */
-       for (sgcnt = 0; sgcnt < use_sg; sgcnt++, slp++) {
-           asc_sg_head.sg_list[sgcnt].addr = cpu_to_le32(sg_dma_address(slp));
-           asc_sg_head.sg_list[sgcnt].bytes = cpu_to_le32(sg_dma_len(slp));
-           ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(sg_dma_len(slp), 512));
-        }
-    }
+               /*
+                * Convert scatter-gather list into ASC_SG_HEAD list.
+                */
+               for (sgcnt = 0; sgcnt < use_sg; sgcnt++, slp++) {
+                       asc_sg_head.sg_list[sgcnt].addr =
+                           cpu_to_le32(sg_dma_address(slp));
+                       asc_sg_head.sg_list[sgcnt].bytes =
+                           cpu_to_le32(sg_dma_len(slp));
+                       ASC_STATS_ADD(scp->device->host, sg_xfer,
+                                     ASC_CEILING(sg_dma_len(slp), 512));
+               }
+       }
 
-    ASC_DBG_PRT_ASC_SCSI_Q(2, &asc_scsi_q);
-    ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len);
+       ASC_DBG_PRT_ASC_SCSI_Q(2, &asc_scsi_q);
+       ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len);
 
-    return ASC_NOERROR;
+       return ASC_NOERROR;
 }
 
 /*
@@ -6440,162 +5246,168 @@ asc_build_req(asc_board_t *boardp, struct scsi_cmnd *scp)
  * microcode for DMA addresses or math operations are byte swapped
  * to little-endian order.
  */
-STATIC int
+static int
 adv_build_req(asc_board_t *boardp, struct scsi_cmnd *scp,
-    ADV_SCSI_REQ_Q **adv_scsiqpp)
+             ADV_SCSI_REQ_Q **adv_scsiqpp)
 {
-    adv_req_t           *reqp;
-    ADV_SCSI_REQ_Q      *scsiqp;
-    int                 i;
-    int                 ret;
-    struct device      *dev = boardp->dvc_cfg.adv_dvc_cfg.dev;
-
-    /*
-     * Allocate an adv_req_t structure from the board to execute
-     * the command.
-     */
-    if (boardp->adv_reqp == NULL) {
-        ASC_DBG(1, "adv_build_req: no free adv_req_t\n");
-        ASC_STATS(scp->device->host, adv_build_noreq);
-        return ASC_BUSY;
-    } else {
-        reqp = boardp->adv_reqp;
-        boardp->adv_reqp = reqp->next_reqp;
-        reqp->next_reqp = NULL;
-    }
-
-    /*
-     * Get 32-byte aligned ADV_SCSI_REQ_Q and ADV_SG_BLOCK pointers.
-     */
-    scsiqp = (ADV_SCSI_REQ_Q *) ADV_32BALIGN(&reqp->scsi_req_q);
-
-    /*
-     * Initialize the structure.
-     */
-    scsiqp->cntl = scsiqp->scsi_cntl = scsiqp->done_status = 0;
-
-    /*
-     * Set the ADV_SCSI_REQ_Q 'srb_ptr' to point to the adv_req_t structure.
-     */
-    scsiqp->srb_ptr = ASC_VADDR_TO_U32(reqp);
-
-    /*
-     * Set the adv_req_t 'cmndp' to point to the struct scsi_cmnd structure.
-     */
-    reqp->cmndp = scp;
+       adv_req_t *reqp;
+       ADV_SCSI_REQ_Q *scsiqp;
+       int i;
+       int ret;
+       struct device *dev = boardp->dvc_cfg.adv_dvc_cfg.dev;
+
+       /*
+        * Allocate an adv_req_t structure from the board to execute
+        * the command.
+        */
+       if (boardp->adv_reqp == NULL) {
+               ASC_DBG(1, "adv_build_req: no free adv_req_t\n");
+               ASC_STATS(scp->device->host, adv_build_noreq);
+               return ASC_BUSY;
+       } else {
+               reqp = boardp->adv_reqp;
+               boardp->adv_reqp = reqp->next_reqp;
+               reqp->next_reqp = NULL;
+       }
 
-    /*
-     * Build the ADV_SCSI_REQ_Q request.
-     */
+       /*
+        * Get 32-byte aligned ADV_SCSI_REQ_Q and ADV_SG_BLOCK pointers.
+        */
+       scsiqp = (ADV_SCSI_REQ_Q *)ADV_32BALIGN(&reqp->scsi_req_q);
+
+       /*
+        * Initialize the structure.
+        */
+       scsiqp->cntl = scsiqp->scsi_cntl = scsiqp->done_status = 0;
+
+       /*
+        * Set the ADV_SCSI_REQ_Q 'srb_ptr' to point to the adv_req_t structure.
+        */
+       scsiqp->srb_ptr = ASC_VADDR_TO_U32(reqp);
+
+       /*
+        * Set the adv_req_t 'cmndp' to point to the struct scsi_cmnd structure.
+        */
+       reqp->cmndp = scp;
+
+       /*
+        * Build the ADV_SCSI_REQ_Q request.
+        */
+
+       /*
+        * Set CDB length and copy it to the request structure.
+        * For wide  boards a CDB length maximum of 16 bytes
+        * is supported.
+        */
+       if (scp->cmd_len > ADV_MAX_CDB_LEN) {
+               ASC_PRINT3
+                   ("adv_build_req: board %d: cmd_len %d > ADV_MAX_CDB_LEN  %d\n",
+                    boardp->id, scp->cmd_len, ADV_MAX_CDB_LEN);
+               scp->result = HOST_BYTE(DID_ERROR);
+               asc_enqueue(&boardp->done, scp, ASC_BACK);
+               return ASC_ERROR;
+       }
+       scsiqp->cdb_len = scp->cmd_len;
+       /* Copy first 12 CDB bytes to cdb[]. */
+       for (i = 0; i < scp->cmd_len && i < 12; i++) {
+               scsiqp->cdb[i] = scp->cmnd[i];
+       }
+       /* Copy last 4 CDB bytes, if present, to cdb16[]. */
+       for (; i < scp->cmd_len; i++) {
+               scsiqp->cdb16[i - 12] = scp->cmnd[i];
+       }
 
-    /*
-     * Set CDB length and copy it to the request structure.
-     * For wide  boards a CDB length maximum of 16 bytes
-     * is supported.
-     */
-    if (scp->cmd_len > ADV_MAX_CDB_LEN) {
-        ASC_PRINT3(
-"adv_build_req: board %d: cmd_len %d > ADV_MAX_CDB_LEN  %d\n",
-            boardp->id, scp->cmd_len, ADV_MAX_CDB_LEN);
-        scp->result = HOST_BYTE(DID_ERROR);
-        asc_enqueue(&boardp->done, scp, ASC_BACK);
-        return ASC_ERROR;
-    }
-    scsiqp->cdb_len = scp->cmd_len;
-    /* Copy first 12 CDB bytes to cdb[]. */
-    for (i = 0; i < scp->cmd_len && i < 12; i++) {
-        scsiqp->cdb[i] = scp->cmnd[i];
-    }
-    /* Copy last 4 CDB bytes, if present, to cdb16[]. */
-    for (; i < scp->cmd_len; i++) {
-        scsiqp->cdb16[i - 12] = scp->cmnd[i];
-    }
+       scsiqp->target_id = scp->device->id;
+       scsiqp->target_lun = scp->device->lun;
 
-    scsiqp->target_id = scp->device->id;
-    scsiqp->target_lun = scp->device->lun;
+       scsiqp->sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0]));
+       scsiqp->sense_len = sizeof(scp->sense_buffer);
 
-    scsiqp->sense_addr = cpu_to_le32(virt_to_bus(&scp->sense_buffer[0]));
-    scsiqp->sense_len = sizeof(scp->sense_buffer);
+       /*
+        * Build ADV_SCSI_REQ_Q for a contiguous buffer or a scatter-gather
+        * buffer command.
+        */
 
-    /*
-     * Build ADV_SCSI_REQ_Q for a contiguous buffer or a scatter-gather
-     * buffer command.
-     */
-
-    scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen);
-    scsiqp->vdata_addr = scp->request_buffer;
-    scsiqp->data_addr = cpu_to_le32(virt_to_bus(scp->request_buffer));
-
-    if (scp->use_sg == 0) {
-        /*
-         * CDB request of single contiguous buffer.
-         */
-        reqp->sgblkp = NULL;
        scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen);
-       if (scp->request_bufflen) {
-           scsiqp->vdata_addr = scp->request_buffer;
-           scp->SCp.dma_handle =
-               dma_map_single(dev, scp->request_buffer,
-                              scp->request_bufflen, scp->sc_data_direction);
-       } else {
-           scsiqp->vdata_addr = NULL;
-           scp->SCp.dma_handle = 0;
-       }
-       scsiqp->data_addr = cpu_to_le32(scp->SCp.dma_handle);
-        scsiqp->sg_list_ptr = NULL;
-        scsiqp->sg_real_addr = 0;
-        ASC_STATS(scp->device->host, cont_cnt);
-        ASC_STATS_ADD(scp->device->host, cont_xfer,
-                      ASC_CEILING(scp->request_bufflen, 512));
-    } else {
-        /*
-         * CDB scatter-gather request list.
-         */
-       struct scatterlist *slp;
-       int use_sg;
+       scsiqp->vdata_addr = scp->request_buffer;
+       scsiqp->data_addr = cpu_to_le32(virt_to_bus(scp->request_buffer));
 
-       slp = (struct scatterlist *)scp->request_buffer;
-       use_sg = dma_map_sg(dev, slp, scp->use_sg, scp->sc_data_direction);
-
-       if (use_sg > ADV_MAX_SG_LIST) {
-            ASC_PRINT3(
-"adv_build_req: board %d: use_sg %d > ADV_MAX_SG_LIST %d\n",
-               boardp->id, use_sg, scp->device->host->sg_tablesize);
-           dma_unmap_sg(dev, slp, scp->use_sg, scp->sc_data_direction);
-            scp->result = HOST_BYTE(DID_ERROR);
-            asc_enqueue(&boardp->done, scp, ASC_BACK);
-
-            /*
-             * Free the 'adv_req_t' structure by adding it back to the
-             * board free list.
-             */
-            reqp->next_reqp = boardp->adv_reqp;
-            boardp->adv_reqp = reqp;
-
-            return ASC_ERROR;
-        }
-
-       if ((ret = adv_get_sglist(boardp, reqp, scp, use_sg)) != ADV_SUCCESS) {
-            /*
-             * Free the adv_req_t structure by adding it back to the
-             * board free list.
-             */
-            reqp->next_reqp = boardp->adv_reqp;
-            boardp->adv_reqp = reqp;
-
-            return ret;
-        }
-
-        ASC_STATS(scp->device->host, sg_cnt);
-       ASC_STATS_ADD(scp->device->host, sg_elem, use_sg);
-    }
+       if (scp->use_sg == 0) {
+               /*
+                * CDB request of single contiguous buffer.
+                */
+               reqp->sgblkp = NULL;
+               scsiqp->data_cnt = cpu_to_le32(scp->request_bufflen);
+               if (scp->request_bufflen) {
+                       scsiqp->vdata_addr = scp->request_buffer;
+                       scp->SCp.dma_handle =
+                           dma_map_single(dev, scp->request_buffer,
+                                          scp->request_bufflen,
+                                          scp->sc_data_direction);
+               } else {
+                       scsiqp->vdata_addr = NULL;
+                       scp->SCp.dma_handle = 0;
+               }
+               scsiqp->data_addr = cpu_to_le32(scp->SCp.dma_handle);
+               scsiqp->sg_list_ptr = NULL;
+               scsiqp->sg_real_addr = 0;
+               ASC_STATS(scp->device->host, cont_cnt);
+               ASC_STATS_ADD(scp->device->host, cont_xfer,
+                             ASC_CEILING(scp->request_bufflen, 512));
+       } else {
+               /*
+                * CDB scatter-gather request list.
+                */
+               struct scatterlist *slp;
+               int use_sg;
+
+               slp = (struct scatterlist *)scp->request_buffer;
+               use_sg =
+                   dma_map_sg(dev, slp, scp->use_sg, scp->sc_data_direction);
+
+               if (use_sg > ADV_MAX_SG_LIST) {
+                       ASC_PRINT3
+                           ("adv_build_req: board %d: use_sg %d > ADV_MAX_SG_LIST %d\n",
+                            boardp->id, use_sg,
+                            scp->device->host->sg_tablesize);
+                       dma_unmap_sg(dev, slp, scp->use_sg,
+                                    scp->sc_data_direction);
+                       scp->result = HOST_BYTE(DID_ERROR);
+                       asc_enqueue(&boardp->done, scp, ASC_BACK);
+
+                       /*
+                        * Free the 'adv_req_t' structure by adding it back to the
+                        * board free list.
+                        */
+                       reqp->next_reqp = boardp->adv_reqp;
+                       boardp->adv_reqp = reqp;
+
+                       return ASC_ERROR;
+               }
+
+               if ((ret =
+                    adv_get_sglist(boardp, reqp, scp,
+                                   use_sg)) != ADV_SUCCESS) {
+                       /*
+                        * Free the adv_req_t structure by adding it back to the
+                        * board free list.
+                        */
+                       reqp->next_reqp = boardp->adv_reqp;
+                       boardp->adv_reqp = reqp;
+
+                       return ret;
+               }
+
+               ASC_STATS(scp->device->host, sg_cnt);
+               ASC_STATS_ADD(scp->device->host, sg_elem, use_sg);
+       }
 
-    ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp);
-    ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len);
+       ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp);
+       ASC_DBG_PRT_CDB(1, scp->cmnd, scp->cmd_len);
 
-    *adv_scsiqpp = scsiqp;
+       *adv_scsiqpp = scsiqp;
 
-    return ASC_NOERROR;
+       return ASC_NOERROR;
 }
 
 /*
@@ -6610,108 +5422,109 @@ adv_build_req(asc_board_t *boardp, struct scsi_cmnd *scp,
  *      ADV_SUCCESS(1) - SG List successfully created
  *      ADV_ERROR(-1) - SG List creation failed
  */
-STATIC int
-adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp, int use_sg)
+static int
+adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp,
+              int use_sg)
 {
-    adv_sgblk_t         *sgblkp;
-    ADV_SCSI_REQ_Q      *scsiqp;
-    struct scatterlist  *slp;
-    int                 sg_elem_cnt;
-    ADV_SG_BLOCK        *sg_block, *prev_sg_block;
-    ADV_PADDR           sg_block_paddr;
-    int                 i;
-
-    scsiqp = (ADV_SCSI_REQ_Q *) ADV_32BALIGN(&reqp->scsi_req_q);
-    slp = (struct scatterlist *) scp->request_buffer;
-    sg_elem_cnt = use_sg;
-    prev_sg_block = NULL;
-    reqp->sgblkp = NULL;
-
-    do
-    {
-        /*
-         * Allocate a 'adv_sgblk_t' structure from the board free
-         * list. One 'adv_sgblk_t' structure holds NO_OF_SG_PER_BLOCK
-         * (15) scatter-gather elements.
-         */
-        if ((sgblkp = boardp->adv_sgblkp) == NULL) {
-            ASC_DBG(1, "adv_get_sglist: no free adv_sgblk_t\n");
-            ASC_STATS(scp->device->host, adv_build_nosg);
-
-            /*
-             * Allocation failed. Free 'adv_sgblk_t' structures already
-             * allocated for the request.
-             */
-            while ((sgblkp = reqp->sgblkp) != NULL)
-            {
-                /* Remove 'sgblkp' from the request list. */
-                reqp->sgblkp = sgblkp->next_sgblkp;
-
-                /* Add 'sgblkp' to the board free list. */
-                sgblkp->next_sgblkp = boardp->adv_sgblkp;
-                boardp->adv_sgblkp = sgblkp;
-            }
-            return ASC_BUSY;
-        } else {
-            /* Complete 'adv_sgblk_t' board allocation. */
-            boardp->adv_sgblkp = sgblkp->next_sgblkp;
-            sgblkp->next_sgblkp = NULL;
-
-            /*
-             * Get 8 byte aligned virtual and physical addresses for
-             * the allocated ADV_SG_BLOCK structure.
-             */
-            sg_block = (ADV_SG_BLOCK *) ADV_8BALIGN(&sgblkp->sg_block);
-            sg_block_paddr = virt_to_bus(sg_block);
-
-            /*
-             * Check if this is the first 'adv_sgblk_t' for the request.
-             */
-            if (reqp->sgblkp == NULL)
-            {
-                /* Request's first scatter-gather block. */
-                reqp->sgblkp = sgblkp;
-
-                /*
-                 * Set ADV_SCSI_REQ_T ADV_SG_BLOCK virtual and physical
-                 * address pointers.
-                 */
-                scsiqp->sg_list_ptr = sg_block;
-                scsiqp->sg_real_addr = cpu_to_le32(sg_block_paddr);
-            } else
-            {
-                /* Request's second or later scatter-gather block. */
-                sgblkp->next_sgblkp = reqp->sgblkp;
-                reqp->sgblkp = sgblkp;
-
-                /*
-                 * Point the previous ADV_SG_BLOCK structure to
-                 * the newly allocated ADV_SG_BLOCK structure.
-                 */
-                ASC_ASSERT(prev_sg_block != NULL);
-                prev_sg_block->sg_ptr = cpu_to_le32(sg_block_paddr);
-            }
-        }
-
-        for (i = 0; i < NO_OF_SG_PER_BLOCK; i++)
-        {
-           sg_block->sg_list[i].sg_addr = cpu_to_le32(sg_dma_address(slp));
-           sg_block->sg_list[i].sg_count = cpu_to_le32(sg_dma_len(slp));
-           ASC_STATS_ADD(scp->device->host, sg_xfer, ASC_CEILING(sg_dma_len(slp), 512));
-
-            if (--sg_elem_cnt == 0)
-            {   /* Last ADV_SG_BLOCK and scatter-gather entry. */
-                sg_block->sg_cnt = i + 1;
-                sg_block->sg_ptr = 0L;    /* Last ADV_SG_BLOCK in list. */
-                return ADV_SUCCESS;
-            }
-            slp++;
-        }
-        sg_block->sg_cnt = NO_OF_SG_PER_BLOCK;
-        prev_sg_block = sg_block;
-    }
-    while (1);
-    /* NOTREACHED */
+       adv_sgblk_t *sgblkp;
+       ADV_SCSI_REQ_Q *scsiqp;
+       struct scatterlist *slp;
+       int sg_elem_cnt;
+       ADV_SG_BLOCK *sg_block, *prev_sg_block;
+       ADV_PADDR sg_block_paddr;
+       int i;
+
+       scsiqp = (ADV_SCSI_REQ_Q *)ADV_32BALIGN(&reqp->scsi_req_q);
+       slp = (struct scatterlist *)scp->request_buffer;
+       sg_elem_cnt = use_sg;
+       prev_sg_block = NULL;
+       reqp->sgblkp = NULL;
+
+       do {
+               /*
+                * Allocate a 'adv_sgblk_t' structure from the board free
+                * list. One 'adv_sgblk_t' structure holds NO_OF_SG_PER_BLOCK
+                * (15) scatter-gather elements.
+                */
+               if ((sgblkp = boardp->adv_sgblkp) == NULL) {
+                       ASC_DBG(1, "adv_get_sglist: no free adv_sgblk_t\n");
+                       ASC_STATS(scp->device->host, adv_build_nosg);
+
+                       /*
+                        * Allocation failed. Free 'adv_sgblk_t' structures already
+                        * allocated for the request.
+                        */
+                       while ((sgblkp = reqp->sgblkp) != NULL) {
+                               /* Remove 'sgblkp' from the request list. */
+                               reqp->sgblkp = sgblkp->next_sgblkp;
+
+                               /* Add 'sgblkp' to the board free list. */
+                               sgblkp->next_sgblkp = boardp->adv_sgblkp;
+                               boardp->adv_sgblkp = sgblkp;
+                       }
+                       return ASC_BUSY;
+               } else {
+                       /* Complete 'adv_sgblk_t' board allocation. */
+                       boardp->adv_sgblkp = sgblkp->next_sgblkp;
+                       sgblkp->next_sgblkp = NULL;
+
+                       /*
+                        * Get 8 byte aligned virtual and physical addresses for
+                        * the allocated ADV_SG_BLOCK structure.
+                        */
+                       sg_block =
+                           (ADV_SG_BLOCK *)ADV_8BALIGN(&sgblkp->sg_block);
+                       sg_block_paddr = virt_to_bus(sg_block);
+
+                       /*
+                        * Check if this is the first 'adv_sgblk_t' for the request.
+                        */
+                       if (reqp->sgblkp == NULL) {
+                               /* Request's first scatter-gather block. */
+                               reqp->sgblkp = sgblkp;
+
+                               /*
+                                * Set ADV_SCSI_REQ_T ADV_SG_BLOCK virtual and physical
+                                * address pointers.
+                                */
+                               scsiqp->sg_list_ptr = sg_block;
+                               scsiqp->sg_real_addr =
+                                   cpu_to_le32(sg_block_paddr);
+                       } else {
+                               /* Request's second or later scatter-gather block. */
+                               sgblkp->next_sgblkp = reqp->sgblkp;
+                               reqp->sgblkp = sgblkp;
+
+                               /*
+                                * Point the previous ADV_SG_BLOCK structure to
+                                * the newly allocated ADV_SG_BLOCK structure.
+                                */
+                               ASC_ASSERT(prev_sg_block != NULL);
+                               prev_sg_block->sg_ptr =
+                                   cpu_to_le32(sg_block_paddr);
+                       }
+               }
+
+               for (i = 0; i < NO_OF_SG_PER_BLOCK; i++) {
+                       sg_block->sg_list[i].sg_addr =
+                           cpu_to_le32(sg_dma_address(slp));
+                       sg_block->sg_list[i].sg_count =
+                           cpu_to_le32(sg_dma_len(slp));
+                       ASC_STATS_ADD(scp->device->host, sg_xfer,
+                                     ASC_CEILING(sg_dma_len(slp), 512));
+
+                       if (--sg_elem_cnt == 0) {       /* Last ADV_SG_BLOCK and scatter-gather entry. */
+                               sg_block->sg_cnt = i + 1;
+                               sg_block->sg_ptr = 0L;  /* Last ADV_SG_BLOCK in list. */
+                               return ADV_SUCCESS;
+                       }
+                       slp++;
+               }
+               sg_block->sg_cnt = NO_OF_SG_PER_BLOCK;
+               prev_sg_block = sg_block;
+       }
+       while (1);
+       /* NOTREACHED */
 }
 
 /*
@@ -6719,165 +5532,171 @@ adv_get_sglist(asc_board_t *boardp, adv_req_t *reqp, struct scsi_cmnd *scp, int
  *
  * Interrupt callback function for the Narrow SCSI Asc Library.
  */
-STATIC void
-asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
+static void asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
 {
-    asc_board_t         *boardp;
-    struct scsi_cmnd           *scp;
-    struct Scsi_Host    *shp;
-    int                 i;
-
-    ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp 0x%lx, qdonep 0x%lx\n",
-        (ulong) asc_dvc_varp, (ulong) qdonep);
-    ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep);
+       asc_board_t *boardp;
+       struct scsi_cmnd *scp;
+       struct Scsi_Host *shost;
+       int i;
+
+       ASC_DBG2(1, "asc_isr_callback: asc_dvc_varp 0x%lx, qdonep 0x%lx\n",
+                (ulong)asc_dvc_varp, (ulong)qdonep);
+       ASC_DBG_PRT_ASC_QDONE_INFO(2, qdonep);
+
+       /*
+        * Get the struct scsi_cmnd structure and Scsi_Host structure for the
+        * command that has been completed.
+        */
+       scp = (struct scsi_cmnd *)ASC_U32_TO_VADDR(qdonep->d2.srb_ptr);
+       ASC_DBG1(1, "asc_isr_callback: scp 0x%lx\n", (ulong)scp);
+
+       if (scp == NULL) {
+               ASC_PRINT("asc_isr_callback: scp is NULL\n");
+               return;
+       }
+       ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len);
+
+       /*
+        * If the request's host pointer is not valid, display a
+        * message and return.
+        */
+       shost = scp->device->host;
+       for (i = 0; i < asc_board_count; i++) {
+               if (asc_host[i] == shost) {
+                       break;
+               }
+       }
+       if (i == asc_board_count) {
+               ASC_PRINT2
+                   ("asc_isr_callback: scp 0x%lx has bad host pointer, host 0x%lx\n",
+                    (ulong)scp, (ulong)shost);
+               return;
+       }
 
-    /*
-     * Get the struct scsi_cmnd structure and Scsi_Host structure for the
-     * command that has been completed.
-     */
-    scp = (struct scsi_cmnd *) ASC_U32_TO_VADDR(qdonep->d2.srb_ptr);
-    ASC_DBG1(1, "asc_isr_callback: scp 0x%lx\n", (ulong) scp);
-
-    if (scp == NULL) {
-        ASC_PRINT("asc_isr_callback: scp is NULL\n");
-        return;
-    }
-    ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len);
+       ASC_STATS(shost, callback);
+       ASC_DBG1(1, "asc_isr_callback: shost 0x%lx\n", (ulong)shost);
+
+       /*
+        * If the request isn't found on the active queue, it may
+        * have been removed to handle a reset request.
+        * Display a message and return.
+        */
+       boardp = ASC_BOARDP(shost);
+       ASC_ASSERT(asc_dvc_varp == &boardp->dvc_var.asc_dvc_var);
+       if (asc_rmqueue(&boardp->active, scp) == ASC_FALSE) {
+               ASC_PRINT2
+                   ("asc_isr_callback: board %d: scp 0x%lx not on active queue\n",
+                    boardp->id, (ulong)scp);
+               return;
+       }
 
-    /*
-     * If the request's host pointer is not valid, display a
-     * message and return.
-     */
-    shp = scp->device->host;
-    for (i = 0; i < asc_board_count; i++) {
-        if (asc_host[i] == shp) {
-            break;
-        }
-    }
-    if (i == asc_board_count) {
-        ASC_PRINT2(
-            "asc_isr_callback: scp 0x%lx has bad host pointer, host 0x%lx\n",
-            (ulong) scp, (ulong) shp);
-        return;
-    }
+       /*
+        * 'qdonep' contains the command's ending status.
+        */
+       switch (qdonep->d3.done_stat) {
+       case QD_NO_ERROR:
+               ASC_DBG(2, "asc_isr_callback: QD_NO_ERROR\n");
+               scp->result = 0;
 
-    ASC_STATS(shp, callback);
-    ASC_DBG1(1, "asc_isr_callback: shp 0x%lx\n", (ulong) shp);
+               /*
+                * If an INQUIRY command completed successfully, then call
+                * the AscInquiryHandling() function to set-up the device.
+                */
+               if (scp->cmnd[0] == INQUIRY && scp->device->lun == 0 &&
+                   (scp->request_bufflen - qdonep->remain_bytes) >= 8) {
+                       AscInquiryHandling(asc_dvc_varp, scp->device->id & 0x7,
+                                          (ASC_SCSI_INQUIRY *)scp->
+                                          request_buffer);
+               }
 
-    /*
-     * If the request isn't found on the active queue, it may
-     * have been removed to handle a reset request.
-     * Display a message and return.
-     */
-    boardp = ASC_BOARDP(shp);
-    ASC_ASSERT(asc_dvc_varp == &boardp->dvc_var.asc_dvc_var);
-    if (asc_rmqueue(&boardp->active, scp) == ASC_FALSE) {
-        ASC_PRINT2(
-            "asc_isr_callback: board %d: scp 0x%lx not on active queue\n",
-            boardp->id, (ulong) scp);
-        return;
-    }
+               /*
+                * Check for an underrun condition.
+                *
+                * If there was no error and an underrun condition, then
+                * then return the number of underrun bytes.
+                */
+               if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 &&
+                   qdonep->remain_bytes <= scp->request_bufflen) {
+                       ASC_DBG1(1,
+                                "asc_isr_callback: underrun condition %u bytes\n",
+                                (unsigned)qdonep->remain_bytes);
+                       scp->resid = qdonep->remain_bytes;
+               }
+               break;
+
+       case QD_WITH_ERROR:
+               ASC_DBG(2, "asc_isr_callback: QD_WITH_ERROR\n");
+               switch (qdonep->d3.host_stat) {
+               case QHSTA_NO_ERROR:
+                       if (qdonep->d3.scsi_stat == SAM_STAT_CHECK_CONDITION) {
+                               ASC_DBG(2,
+                                       "asc_isr_callback: SAM_STAT_CHECK_CONDITION\n");
+                               ASC_DBG_PRT_SENSE(2, scp->sense_buffer,
+                                                 sizeof(scp->sense_buffer));
+                               /*
+                                * Note: The 'status_byte()' macro used by target drivers
+                                * defined in scsi.h shifts the status byte returned by
+                                * host drivers right by 1 bit. This is why target drivers
+                                * also use right shifted status byte definitions. For
+                                * instance target drivers use CHECK_CONDITION, defined to
+                                * 0x1, instead of the SCSI defined check condition value
+                                * of 0x2. Host drivers are supposed to return the status
+                                * byte as it is defined by SCSI.
+                                */
+                               scp->result = DRIVER_BYTE(DRIVER_SENSE) |
+                                   STATUS_BYTE(qdonep->d3.scsi_stat);
+                       } else {
+                               scp->result = STATUS_BYTE(qdonep->d3.scsi_stat);
+                       }
+                       break;
+
+               default:
+                       /* QHSTA error occurred */
+                       ASC_DBG1(1, "asc_isr_callback: host_stat 0x%x\n",
+                                qdonep->d3.host_stat);
+                       scp->result = HOST_BYTE(DID_BAD_TARGET);
+                       break;
+               }
+               break;
+
+       case QD_ABORTED_BY_HOST:
+               ASC_DBG(1, "asc_isr_callback: QD_ABORTED_BY_HOST\n");
+               scp->result =
+                   HOST_BYTE(DID_ABORT) | MSG_BYTE(qdonep->d3.
+                                                   scsi_msg) |
+                   STATUS_BYTE(qdonep->d3.scsi_stat);
+               break;
+
+       default:
+               ASC_DBG1(1, "asc_isr_callback: done_stat 0x%x\n",
+                        qdonep->d3.done_stat);
+               scp->result =
+                   HOST_BYTE(DID_ERROR) | MSG_BYTE(qdonep->d3.
+                                                   scsi_msg) |
+                   STATUS_BYTE(qdonep->d3.scsi_stat);
+               break;
+       }
 
-    /*
-     * 'qdonep' contains the command's ending status.
-     */
-    switch (qdonep->d3.done_stat) {
-    case QD_NO_ERROR:
-        ASC_DBG(2, "asc_isr_callback: QD_NO_ERROR\n");
-        scp->result = 0;
-
-        /*
-         * If an INQUIRY command completed successfully, then call
-         * the AscInquiryHandling() function to set-up the device.
-         */
-        if (scp->cmnd[0] == INQUIRY && scp->device->lun == 0 &&
-            (scp->request_bufflen - qdonep->remain_bytes) >= 8)
-        {
-            AscInquiryHandling(asc_dvc_varp, scp->device->id & 0x7,
-                (ASC_SCSI_INQUIRY *) scp->request_buffer);
-        }
-
-        /*
-         * Check for an underrun condition.
-         *
-         * If there was no error and an underrun condition, then
-         * then return the number of underrun bytes.
-         */
-        if (scp->request_bufflen != 0 && qdonep->remain_bytes != 0 &&
-            qdonep->remain_bytes <= scp->request_bufflen) {
-            ASC_DBG1(1, "asc_isr_callback: underrun condition %u bytes\n",
-            (unsigned) qdonep->remain_bytes);
-            scp->resid = qdonep->remain_bytes;
-        }
-        break;
-
-    case QD_WITH_ERROR:
-        ASC_DBG(2, "asc_isr_callback: QD_WITH_ERROR\n");
-        switch (qdonep->d3.host_stat) {
-        case QHSTA_NO_ERROR:
-            if (qdonep->d3.scsi_stat == SAM_STAT_CHECK_CONDITION) {
-                ASC_DBG(2, "asc_isr_callback: SAM_STAT_CHECK_CONDITION\n");
-                ASC_DBG_PRT_SENSE(2, scp->sense_buffer,
-                    sizeof(scp->sense_buffer));
-                /*
-                 * Note: The 'status_byte()' macro used by target drivers
-                 * defined in scsi.h shifts the status byte returned by
-                 * host drivers right by 1 bit. This is why target drivers
-                 * also use right shifted status byte definitions. For
-                 * instance target drivers use CHECK_CONDITION, defined to
-                 * 0x1, instead of the SCSI defined check condition value
-                 * of 0x2. Host drivers are supposed to return the status
-                 * byte as it is defined by SCSI.
-                 */
-                scp->result = DRIVER_BYTE(DRIVER_SENSE) |
-                    STATUS_BYTE(qdonep->d3.scsi_stat);
-            } else {
-                scp->result = STATUS_BYTE(qdonep->d3.scsi_stat);
-            }
-            break;
-
-        default:
-            /* QHSTA error occurred */
-            ASC_DBG1(1, "asc_isr_callback: host_stat 0x%x\n",
-                qdonep->d3.host_stat);
-            scp->result = HOST_BYTE(DID_BAD_TARGET);
-            break;
-        }
-        break;
-
-    case QD_ABORTED_BY_HOST:
-        ASC_DBG(1, "asc_isr_callback: QD_ABORTED_BY_HOST\n");
-        scp->result = HOST_BYTE(DID_ABORT) | MSG_BYTE(qdonep->d3.scsi_msg) |
-                STATUS_BYTE(qdonep->d3.scsi_stat);
-        break;
-
-    default:
-        ASC_DBG1(1, "asc_isr_callback: done_stat 0x%x\n", qdonep->d3.done_stat);
-        scp->result = HOST_BYTE(DID_ERROR) | MSG_BYTE(qdonep->d3.scsi_msg) |
-                STATUS_BYTE(qdonep->d3.scsi_stat);
-        break;
-    }
+       /*
+        * If the 'init_tidmask' bit isn't already set for the target and the
+        * current request finished normally, then set the bit for the target
+        * to indicate that a device is present.
+        */
+       if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 &&
+           qdonep->d3.done_stat == QD_NO_ERROR &&
+           qdonep->d3.host_stat == QHSTA_NO_ERROR) {
+               boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
+       }
 
-    /*
-     * If the 'init_tidmask' bit isn't already set for the target and the
-     * current request finished normally, then set the bit for the target
-     * to indicate that a device is present.
-     */
-    if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 &&
-        qdonep->d3.done_stat == QD_NO_ERROR &&
-        qdonep->d3.host_stat == QHSTA_NO_ERROR) {
-        boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
-    }
+       /*
+        * Because interrupts may be enabled by the 'struct scsi_cmnd' done
+        * function, add the command to the end of the board's done queue.
+        * The done function for the command will be called from
+        * advansys_interrupt().
+        */
+       asc_enqueue(&boardp->done, scp, ASC_BACK);
 
-    /*
-     * Because interrupts may be enabled by the 'struct scsi_cmnd' done
-     * function, add the command to the end of the board's done queue.
-     * The done function for the command will be called from
-     * advansys_interrupt().
-     */
-    asc_enqueue(&boardp->done, scp, ASC_BACK);
-
-    return;
+       return;
 }
 
 /*
@@ -6885,238 +5704,240 @@ asc_isr_callback(ASC_DVC_VAR *asc_dvc_varp, ASC_QDONE_INFO *qdonep)
  *
  * Callback function for the Wide SCSI Adv Library.
  */
-STATIC void
-adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
+static void adv_isr_callback(ADV_DVC_VAR *adv_dvc_varp, ADV_SCSI_REQ_Q *scsiqp)
 {
-    asc_board_t         *boardp;
-    adv_req_t           *reqp;
-    adv_sgblk_t         *sgblkp;
-    struct scsi_cmnd           *scp;
-    struct Scsi_Host    *shp;
-    int                 i;
-    ADV_DCNT            resid_cnt;
-
-
-    ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp 0x%lx, scsiqp 0x%lx\n",
-        (ulong) adv_dvc_varp, (ulong) scsiqp);
-    ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp);
-
-    /*
-     * Get the adv_req_t structure for the command that has been
-     * completed. The adv_req_t structure actually contains the
-     * completed ADV_SCSI_REQ_Q structure.
-     */
-    reqp = (adv_req_t *) ADV_U32_TO_VADDR(scsiqp->srb_ptr);
-    ASC_DBG1(1, "adv_isr_callback: reqp 0x%lx\n", (ulong) reqp);
-    if (reqp == NULL) {
-        ASC_PRINT("adv_isr_callback: reqp is NULL\n");
-        return;
-    }
-
-    /*
-     * Get the struct scsi_cmnd structure and Scsi_Host structure for the
-     * command that has been completed.
-     *
-     * Note: The adv_req_t request structure and adv_sgblk_t structure,
-     * if any, are dropped, because a board structure pointer can not be
-     * determined.
-     */
-    scp = reqp->cmndp;
-    ASC_DBG1(1, "adv_isr_callback: scp 0x%lx\n", (ulong) scp);
-    if (scp == NULL) {
-        ASC_PRINT("adv_isr_callback: scp is NULL; adv_req_t dropped.\n");
-        return;
-    }
-    ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len);
-
-    /*
-     * If the request's host pointer is not valid, display a message
-     * and return.
-     */
-    shp = scp->device->host;
-    for (i = 0; i < asc_board_count; i++) {
-        if (asc_host[i] == shp) {
-            break;
-        }
-    }
-    /*
-     * Note: If the host structure is not found, the adv_req_t request
-     * structure and adv_sgblk_t structure, if any, is dropped.
-     */
-    if (i == asc_board_count) {
-        ASC_PRINT2(
-            "adv_isr_callback: scp 0x%lx has bad host pointer, host 0x%lx\n",
-            (ulong) scp, (ulong) shp);
-        return;
-    }
+       asc_board_t *boardp;
+       adv_req_t *reqp;
+       adv_sgblk_t *sgblkp;
+       struct scsi_cmnd *scp;
+       struct Scsi_Host *shost;
+       int i;
+       ADV_DCNT resid_cnt;
+
+       ASC_DBG2(1, "adv_isr_callback: adv_dvc_varp 0x%lx, scsiqp 0x%lx\n",
+                (ulong)adv_dvc_varp, (ulong)scsiqp);
+       ASC_DBG_PRT_ADV_SCSI_REQ_Q(2, scsiqp);
+
+       /*
+        * Get the adv_req_t structure for the command that has been
+        * completed. The adv_req_t structure actually contains the
+        * completed ADV_SCSI_REQ_Q structure.
+        */
+       reqp = (adv_req_t *)ADV_U32_TO_VADDR(scsiqp->srb_ptr);
+       ASC_DBG1(1, "adv_isr_callback: reqp 0x%lx\n", (ulong)reqp);
+       if (reqp == NULL) {
+               ASC_PRINT("adv_isr_callback: reqp is NULL\n");
+               return;
+       }
 
-    ASC_STATS(shp, callback);
-    ASC_DBG1(1, "adv_isr_callback: shp 0x%lx\n", (ulong) shp);
+       /*
+        * Get the struct scsi_cmnd structure and Scsi_Host structure for the
+        * command that has been completed.
+        *
+        * Note: The adv_req_t request structure and adv_sgblk_t structure,
+        * if any, are dropped, because a board structure pointer can not be
+        * determined.
+        */
+       scp = reqp->cmndp;
+       ASC_DBG1(1, "adv_isr_callback: scp 0x%lx\n", (ulong)scp);
+       if (scp == NULL) {
+               ASC_PRINT
+                   ("adv_isr_callback: scp is NULL; adv_req_t dropped.\n");
+               return;
+       }
+       ASC_DBG_PRT_CDB(2, scp->cmnd, scp->cmd_len);
+
+       /*
+        * If the request's host pointer is not valid, display a message
+        * and return.
+        */
+       shost = scp->device->host;
+       for (i = 0; i < asc_board_count; i++) {
+               if (asc_host[i] == shost) {
+                       break;
+               }
+       }
+       /*
+        * Note: If the host structure is not found, the adv_req_t request
+        * structure and adv_sgblk_t structure, if any, is dropped.
+        */
+       if (i == asc_board_count) {
+               ASC_PRINT2
+                   ("adv_isr_callback: scp 0x%lx has bad host pointer, host 0x%lx\n",
+                    (ulong)scp, (ulong)shost);
+               return;
+       }
 
-    /*
-     * If the request isn't found on the active queue, it may have been
-     * removed to handle a reset request. Display a message and return.
-     *
-     * Note: Because the structure may still be in use don't attempt
-     * to free the adv_req_t and adv_sgblk_t, if any, structures.
-     */
-    boardp = ASC_BOARDP(shp);
-    ASC_ASSERT(adv_dvc_varp == &boardp->dvc_var.adv_dvc_var);
-    if (asc_rmqueue(&boardp->active, scp) == ASC_FALSE) {
-        ASC_PRINT2(
-            "adv_isr_callback: board %d: scp 0x%lx not on active queue\n",
-            boardp->id, (ulong) scp);
-        return;
-    }
+       ASC_STATS(shost, callback);
+       ASC_DBG1(1, "adv_isr_callback: shost 0x%lx\n", (ulong)shost);
+
+       /*
+        * If the request isn't found on the active queue, it may have been
+        * removed to handle a reset request. Display a message and return.
+        *
+        * Note: Because the structure may still be in use don't attempt
+        * to free the adv_req_t and adv_sgblk_t, if any, structures.
+        */
+       boardp = ASC_BOARDP(shost);
+       ASC_ASSERT(adv_dvc_varp == &boardp->dvc_var.adv_dvc_var);
+       if (asc_rmqueue(&boardp->active, scp) == ASC_FALSE) {
+               ASC_PRINT2
+                   ("adv_isr_callback: board %d: scp 0x%lx not on active queue\n",
+                    boardp->id, (ulong)scp);
+               return;
+       }
 
-    /*
-     * 'done_status' contains the command's ending status.
-     */
-    switch (scsiqp->done_status) {
-    case QD_NO_ERROR:
-        ASC_DBG(2, "adv_isr_callback: QD_NO_ERROR\n");
-        scp->result = 0;
-
-        /*
-         * Check for an underrun condition.
-         *
-         * If there was no error and an underrun condition, then
-         * then return the number of underrun bytes.
-         */
-        resid_cnt = le32_to_cpu(scsiqp->data_cnt);
-        if (scp->request_bufflen != 0 && resid_cnt != 0 &&
-            resid_cnt <= scp->request_bufflen) {
-            ASC_DBG1(1, "adv_isr_callback: underrun condition %lu bytes\n",
-                (ulong) resid_cnt);
-            scp->resid = resid_cnt;
-        }
-        break;
-
-    case QD_WITH_ERROR:
-        ASC_DBG(2, "adv_isr_callback: QD_WITH_ERROR\n");
-        switch (scsiqp->host_status) {
-        case QHSTA_NO_ERROR:
-            if (scsiqp->scsi_status == SAM_STAT_CHECK_CONDITION) {
-                ASC_DBG(2, "adv_isr_callback: SAM_STAT_CHECK_CONDITION\n");
-                ASC_DBG_PRT_SENSE(2, scp->sense_buffer,
-                    sizeof(scp->sense_buffer));
-                /*
-                 * Note: The 'status_byte()' macro used by target drivers
-                 * defined in scsi.h shifts the status byte returned by
-                 * host drivers right by 1 bit. This is why target drivers
-                 * also use right shifted status byte definitions. For
-                 * instance target drivers use CHECK_CONDITION, defined to
-                 * 0x1, instead of the SCSI defined check condition value
-                 * of 0x2. Host drivers are supposed to return the status
-                 * byte as it is defined by SCSI.
-                 */
-                scp->result = DRIVER_BYTE(DRIVER_SENSE) |
-                    STATUS_BYTE(scsiqp->scsi_status);
-            } else {
-                scp->result = STATUS_BYTE(scsiqp->scsi_status);
-            }
-            break;
-
-        default:
-            /* Some other QHSTA error occurred. */
-            ASC_DBG1(1, "adv_isr_callback: host_status 0x%x\n",
-                scsiqp->host_status);
-            scp->result = HOST_BYTE(DID_BAD_TARGET);
-            break;
-        }
-        break;
-
-    case QD_ABORTED_BY_HOST:
-        ASC_DBG(1, "adv_isr_callback: QD_ABORTED_BY_HOST\n");
-        scp->result = HOST_BYTE(DID_ABORT) | STATUS_BYTE(scsiqp->scsi_status);
-        break;
-
-    default:
-        ASC_DBG1(1, "adv_isr_callback: done_status 0x%x\n", scsiqp->done_status);
-        scp->result = HOST_BYTE(DID_ERROR) | STATUS_BYTE(scsiqp->scsi_status);
-        break;
-    }
+       /*
+        * 'done_status' contains the command's ending status.
+        */
+       switch (scsiqp->done_status) {
+       case QD_NO_ERROR:
+               ASC_DBG(2, "adv_isr_callback: QD_NO_ERROR\n");
+               scp->result = 0;
 
-    /*
-     * If the 'init_tidmask' bit isn't already set for the target and the
-     * current request finished normally, then set the bit for the target
-     * to indicate that a device is present.
-     */
-    if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 &&
-        scsiqp->done_status == QD_NO_ERROR &&
-        scsiqp->host_status == QHSTA_NO_ERROR) {
-        boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
-    }
+               /*
+                * Check for an underrun condition.
+                *
+                * If there was no error and an underrun condition, then
+                * then return the number of underrun bytes.
+                */
+               resid_cnt = le32_to_cpu(scsiqp->data_cnt);
+               if (scp->request_bufflen != 0 && resid_cnt != 0 &&
+                   resid_cnt <= scp->request_bufflen) {
+                       ASC_DBG1(1,
+                                "adv_isr_callback: underrun condition %lu bytes\n",
+                                (ulong)resid_cnt);
+                       scp->resid = resid_cnt;
+               }
+               break;
+
+       case QD_WITH_ERROR:
+               ASC_DBG(2, "adv_isr_callback: QD_WITH_ERROR\n");
+               switch (scsiqp->host_status) {
+               case QHSTA_NO_ERROR:
+                       if (scsiqp->scsi_status == SAM_STAT_CHECK_CONDITION) {
+                               ASC_DBG(2,
+                                       "adv_isr_callback: SAM_STAT_CHECK_CONDITION\n");
+                               ASC_DBG_PRT_SENSE(2, scp->sense_buffer,
+                                                 sizeof(scp->sense_buffer));
+                               /*
+                                * Note: The 'status_byte()' macro used by target drivers
+                                * defined in scsi.h shifts the status byte returned by
+                                * host drivers right by 1 bit. This is why target drivers
+                                * also use right shifted status byte definitions. For
+                                * instance target drivers use CHECK_CONDITION, defined to
+                                * 0x1, instead of the SCSI defined check condition value
+                                * of 0x2. Host drivers are supposed to return the status
+                                * byte as it is defined by SCSI.
+                                */
+                               scp->result = DRIVER_BYTE(DRIVER_SENSE) |
+                                   STATUS_BYTE(scsiqp->scsi_status);
+                       } else {
+                               scp->result = STATUS_BYTE(scsiqp->scsi_status);
+                       }
+                       break;
+
+               default:
+                       /* Some other QHSTA error occurred. */
+                       ASC_DBG1(1, "adv_isr_callback: host_status 0x%x\n",
+                                scsiqp->host_status);
+                       scp->result = HOST_BYTE(DID_BAD_TARGET);
+                       break;
+               }
+               break;
+
+       case QD_ABORTED_BY_HOST:
+               ASC_DBG(1, "adv_isr_callback: QD_ABORTED_BY_HOST\n");
+               scp->result =
+                   HOST_BYTE(DID_ABORT) | STATUS_BYTE(scsiqp->scsi_status);
+               break;
+
+       default:
+               ASC_DBG1(1, "adv_isr_callback: done_status 0x%x\n",
+                        scsiqp->done_status);
+               scp->result =
+                   HOST_BYTE(DID_ERROR) | STATUS_BYTE(scsiqp->scsi_status);
+               break;
+       }
 
-    /*
-     * Because interrupts may be enabled by the 'struct scsi_cmnd' done
-     * function, add the command to the end of the board's done queue.
-     * The done function for the command will be called from
-     * advansys_interrupt().
-     */
-    asc_enqueue(&boardp->done, scp, ASC_BACK);
+       /*
+        * If the 'init_tidmask' bit isn't already set for the target and the
+        * current request finished normally, then set the bit for the target
+        * to indicate that a device is present.
+        */
+       if ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(scp->device->id)) == 0 &&
+           scsiqp->done_status == QD_NO_ERROR &&
+           scsiqp->host_status == QHSTA_NO_ERROR) {
+               boardp->init_tidmask |= ADV_TID_TO_TIDMASK(scp->device->id);
+       }
 
-    /*
-     * Free all 'adv_sgblk_t' structures allocated for the request.
-     */
-    while ((sgblkp = reqp->sgblkp) != NULL)
-    {
-        /* Remove 'sgblkp' from the request list. */
-        reqp->sgblkp = sgblkp->next_sgblkp;
-
-        /* Add 'sgblkp' to the board free list. */
-        sgblkp->next_sgblkp = boardp->adv_sgblkp;
-        boardp->adv_sgblkp = sgblkp;
-    }
+       /*
+        * Because interrupts may be enabled by the 'struct scsi_cmnd' done
+        * function, add the command to the end of the board's done queue.
+        * The done function for the command will be called from
+        * advansys_interrupt().
+        */
+       asc_enqueue(&boardp->done, scp, ASC_BACK);
+
+       /*
+        * Free all 'adv_sgblk_t' structures allocated for the request.
+        */
+       while ((sgblkp = reqp->sgblkp) != NULL) {
+               /* Remove 'sgblkp' from the request list. */
+               reqp->sgblkp = sgblkp->next_sgblkp;
+
+               /* Add 'sgblkp' to the board free list. */
+               sgblkp->next_sgblkp = boardp->adv_sgblkp;
+               boardp->adv_sgblkp = sgblkp;
+       }
 
-    /*
-     * Free the adv_req_t structure used with the command by adding
-     * it back to the board free list.
-     */
-    reqp->next_reqp = boardp->adv_reqp;
-    boardp->adv_reqp = reqp;
+       /*
+        * Free the adv_req_t structure used with the command by adding
+        * it back to the board free list.
+        */
+       reqp->next_reqp = boardp->adv_reqp;
+       boardp->adv_reqp = reqp;
 
-    ASC_DBG(1, "adv_isr_callback: done\n");
+       ASC_DBG(1, "adv_isr_callback: done\n");
 
-    return;
+       return;
 }
 
 /*
  * adv_async_callback() - Adv Library asynchronous event callback function.
  */
-STATIC void
-adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
+static void adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
 {
-    switch (code)
-    {
-    case ADV_ASYNC_SCSI_BUS_RESET_DET:
-        /*
-         * The firmware detected a SCSI Bus reset.
-         */
-        ASC_DBG(0, "adv_async_callback: ADV_ASYNC_SCSI_BUS_RESET_DET\n");
-        break;
-
-    case ADV_ASYNC_RDMA_FAILURE:
-        /*
-         * Handle RDMA failure by resetting the SCSI Bus and
-         * possibly the chip if it is unresponsive. Log the error
-         * with a unique code.
-         */
-        ASC_DBG(0, "adv_async_callback: ADV_ASYNC_RDMA_FAILURE\n");
-        AdvResetChipAndSB(adv_dvc_varp);
-        break;
-
-    case ADV_HOST_SCSI_BUS_RESET:
-        /*
-         * Host generated SCSI bus reset occurred.
-         */
-        ASC_DBG(0, "adv_async_callback: ADV_HOST_SCSI_BUS_RESET\n");
-        break;
-
-    default:
-        ASC_DBG1(0, "DvcAsyncCallBack: unknown code 0x%x\n", code);
-        break;
-    }
+       switch (code) {
+       case ADV_ASYNC_SCSI_BUS_RESET_DET:
+               /*
+                * The firmware detected a SCSI Bus reset.
+                */
+               ASC_DBG(0,
+                       "adv_async_callback: ADV_ASYNC_SCSI_BUS_RESET_DET\n");
+               break;
+
+       case ADV_ASYNC_RDMA_FAILURE:
+               /*
+                * Handle RDMA failure by resetting the SCSI Bus and
+                * possibly the chip if it is unresponsive. Log the error
+                * with a unique code.
+                */
+               ASC_DBG(0, "adv_async_callback: ADV_ASYNC_RDMA_FAILURE\n");
+               AdvResetChipAndSB(adv_dvc_varp);
+               break;
+
+       case ADV_HOST_SCSI_BUS_RESET:
+               /*
+                * Host generated SCSI bus reset occurred.
+                */
+               ASC_DBG(0, "adv_async_callback: ADV_HOST_SCSI_BUS_RESET\n");
+               break;
+
+       default:
+               ASC_DBG1(0, "DvcAsyncCallBack: unknown code 0x%x\n", code);
+               break;
+       }
 }
 
 /*
@@ -7127,50 +5948,50 @@ adv_async_callback(ADV_DVC_VAR *adv_dvc_varp, uchar code)
  *
  * 'REQPNEXT(reqp)' returns reqp's next pointer.
  */
-STATIC void
-asc_enqueue(asc_queue_t *ascq, REQP reqp, int flag)
+static void asc_enqueue(asc_queue_t *ascq, REQP reqp, int flag)
 {
-    int        tid;
-
-    ASC_DBG3(3, "asc_enqueue: ascq 0x%lx, reqp 0x%lx, flag %d\n",
-        (ulong) ascq, (ulong) reqp, flag);
-    ASC_ASSERT(reqp != NULL);
-    ASC_ASSERT(flag == ASC_FRONT || flag == ASC_BACK);
-    tid = REQPTID(reqp);
-    ASC_ASSERT(tid >= 0 && tid <= ADV_MAX_TID);
-    if (flag == ASC_FRONT) {
-        reqp->host_scribble = (unsigned char *)ascq->q_first[tid];
-        ascq->q_first[tid] = reqp;
-        /* If the queue was empty, set the last pointer. */
-        if (ascq->q_last[tid] == NULL) {
-            ascq->q_last[tid] = reqp;
-        }
-    } else { /* ASC_BACK */
-        if (ascq->q_last[tid] != NULL) {
-            ascq->q_last[tid]->host_scribble = (unsigned char *)reqp;
-        }
-        ascq->q_last[tid] = reqp;
-        reqp->host_scribble = NULL;
-        /* If the queue was empty, set the first pointer. */
-        if (ascq->q_first[tid] == NULL) {
-            ascq->q_first[tid] = reqp;
-        }
-    }
-    /* The queue has at least one entry, set its bit. */
-    ascq->q_tidmask |= ADV_TID_TO_TIDMASK(tid);
+       int tid;
+
+       ASC_DBG3(3, "asc_enqueue: ascq 0x%lx, reqp 0x%lx, flag %d\n",
+                (ulong)ascq, (ulong)reqp, flag);
+       ASC_ASSERT(reqp != NULL);
+       ASC_ASSERT(flag == ASC_FRONT || flag == ASC_BACK);
+       tid = REQPTID(reqp);
+       ASC_ASSERT(tid >= 0 && tid <= ADV_MAX_TID);
+       if (flag == ASC_FRONT) {
+               reqp->host_scribble = (unsigned char *)ascq->q_first[tid];
+               ascq->q_first[tid] = reqp;
+               /* If the queue was empty, set the last pointer. */
+               if (ascq->q_last[tid] == NULL) {
+                       ascq->q_last[tid] = reqp;
+               }
+       } else {                /* ASC_BACK */
+               if (ascq->q_last[tid] != NULL) {
+                       ascq->q_last[tid]->host_scribble =
+                           (unsigned char *)reqp;
+               }
+               ascq->q_last[tid] = reqp;
+               reqp->host_scribble = NULL;
+               /* If the queue was empty, set the first pointer. */
+               if (ascq->q_first[tid] == NULL) {
+                       ascq->q_first[tid] = reqp;
+               }
+       }
+       /* The queue has at least one entry, set its bit. */
+       ascq->q_tidmask |= ADV_TID_TO_TIDMASK(tid);
 #ifdef ADVANSYS_STATS
-    /* Maintain request queue statistics. */
-    ascq->q_tot_cnt[tid]++;
-    ascq->q_cur_cnt[tid]++;
-    if (ascq->q_cur_cnt[tid] > ascq->q_max_cnt[tid]) {
-        ascq->q_max_cnt[tid] = ascq->q_cur_cnt[tid];
-        ASC_DBG2(2, "asc_enqueue: new q_max_cnt[%d] %d\n",
-            tid, ascq->q_max_cnt[tid]);
-    }
-    REQPTIME(reqp) = REQTIMESTAMP();
+       /* Maintain request queue statistics. */
+       ascq->q_tot_cnt[tid]++;
+       ascq->q_cur_cnt[tid]++;
+       if (ascq->q_cur_cnt[tid] > ascq->q_max_cnt[tid]) {
+               ascq->q_max_cnt[tid] = ascq->q_cur_cnt[tid];
+               ASC_DBG2(2, "asc_enqueue: new q_max_cnt[%d] %d\n",
+                        tid, ascq->q_max_cnt[tid]);
+       }
+       REQPTIME(reqp) = REQTIMESTAMP();
 #endif /* ADVANSYS_STATS */
-    ASC_DBG1(3, "asc_enqueue: reqp 0x%lx\n", (ulong) reqp);
-    return;
+       ASC_DBG1(3, "asc_enqueue: reqp 0x%lx\n", (ulong)reqp);
+       return;
 }
 
 /*
@@ -7180,31 +6001,30 @@ asc_enqueue(asc_queue_t *ascq, REQP reqp, int flag)
  *
  * 'REQPNEXT(reqp)' returns reqp's next pointer.
  */
-STATIC REQP
-asc_dequeue(asc_queue_t *ascq, int tid)
+static REQP asc_dequeue(asc_queue_t *ascq, int tid)
 {
-    REQP    reqp;
-
-    ASC_DBG2(3, "asc_dequeue: ascq 0x%lx, tid %d\n", (ulong) ascq, tid);
-    ASC_ASSERT(tid >= 0 && tid <= ADV_MAX_TID);
-    if ((reqp = ascq->q_first[tid]) != NULL) {
-        ASC_ASSERT(ascq->q_tidmask & ADV_TID_TO_TIDMASK(tid));
-        ascq->q_first[tid] = REQPNEXT(reqp);
-        /* If the queue is empty, clear its bit and the last pointer. */
-        if (ascq->q_first[tid] == NULL) {
-            ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(tid);
-            ASC_ASSERT(ascq->q_last[tid] == reqp);
-            ascq->q_last[tid] = NULL;
-        }
+       REQP reqp;
+
+       ASC_DBG2(3, "asc_dequeue: ascq 0x%lx, tid %d\n", (ulong)ascq, tid);
+       ASC_ASSERT(tid >= 0 && tid <= ADV_MAX_TID);
+       if ((reqp = ascq->q_first[tid]) != NULL) {
+               ASC_ASSERT(ascq->q_tidmask & ADV_TID_TO_TIDMASK(tid));
+               ascq->q_first[tid] = REQPNEXT(reqp);
+               /* If the queue is empty, clear its bit and the last pointer. */
+               if (ascq->q_first[tid] == NULL) {
+                       ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(tid);
+                       ASC_ASSERT(ascq->q_last[tid] == reqp);
+                       ascq->q_last[tid] = NULL;
+               }
 #ifdef ADVANSYS_STATS
-        /* Maintain request queue statistics. */
-        ascq->q_cur_cnt[tid]--;
-        ASC_ASSERT(ascq->q_cur_cnt[tid] >= 0);
-        REQTIMESTAT("asc_dequeue", ascq, reqp, tid);
+               /* Maintain request queue statistics. */
+               ascq->q_cur_cnt[tid]--;
+               ASC_ASSERT(ascq->q_cur_cnt[tid] >= 0);
+               REQTIMESTAT("asc_dequeue", ascq, reqp, tid);
 #endif /* ADVANSYS_STATS */
-    }
-    ASC_DBG1(3, "asc_dequeue: reqp 0x%lx\n", (ulong) reqp);
-    return reqp;
+       }
+       ASC_DBG1(3, "asc_dequeue: reqp 0x%lx\n", (ulong)reqp);
+       return reqp;
 }
 
 /*
@@ -7227,74 +6047,76 @@ asc_dequeue(asc_queue_t *ascq, int tid)
  * Unfortunately collecting queuing time statistics adds overhead to
  * the function that isn't inherent to the function's algorithm.
  */
-STATIC REQP
-asc_dequeue_list(asc_queue_t *ascq, REQP *lastpp, int tid)
+static REQP asc_dequeue_list(asc_queue_t *ascq, REQP *lastpp, int tid)
 {
-    REQP    firstp, lastp;
-    int     i;
-
-    ASC_DBG2(3, "asc_dequeue_list: ascq 0x%lx, tid %d\n", (ulong) ascq, tid);
-    ASC_ASSERT((tid == ASC_TID_ALL) || (tid >= 0 && tid <= ADV_MAX_TID));
-
-    /*
-     * If 'tid' is not ASC_TID_ALL, return requests only for
-     * the specified 'tid'. If 'tid' is ASC_TID_ALL, return all
-     * requests for all tids.
-     */
-    if (tid != ASC_TID_ALL) {
-        /* Return all requests for the specified 'tid'. */
-        if ((ascq->q_tidmask & ADV_TID_TO_TIDMASK(tid)) == 0) {
-            /* List is empty; Set first and last return pointers to NULL. */
-            firstp = lastp = NULL;
-        } else {
-            firstp = ascq->q_first[tid];
-            lastp = ascq->q_last[tid];
-            ascq->q_first[tid] = ascq->q_last[tid] = NULL;
-            ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(tid);
+       REQP firstp, lastp;
+       int i;
+
+       ASC_DBG2(3, "asc_dequeue_list: ascq 0x%lx, tid %d\n", (ulong)ascq, tid);
+       ASC_ASSERT((tid == ASC_TID_ALL) || (tid >= 0 && tid <= ADV_MAX_TID));
+
+       /*
+        * If 'tid' is not ASC_TID_ALL, return requests only for
+        * the specified 'tid'. If 'tid' is ASC_TID_ALL, return all
+        * requests for all tids.
+        */
+       if (tid != ASC_TID_ALL) {
+               /* Return all requests for the specified 'tid'. */
+               if ((ascq->q_tidmask & ADV_TID_TO_TIDMASK(tid)) == 0) {
+                       /* List is empty; Set first and last return pointers to NULL. */
+                       firstp = lastp = NULL;
+               } else {
+                       firstp = ascq->q_first[tid];
+                       lastp = ascq->q_last[tid];
+                       ascq->q_first[tid] = ascq->q_last[tid] = NULL;
+                       ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(tid);
 #ifdef ADVANSYS_STATS
-            {
-                REQP reqp;
-                ascq->q_cur_cnt[tid] = 0;
-                for (reqp = firstp; reqp; reqp = REQPNEXT(reqp)) {
-                    REQTIMESTAT("asc_dequeue_list", ascq, reqp, tid);
-                }
-            }
+                       {
+                               REQP reqp;
+                               ascq->q_cur_cnt[tid] = 0;
+                               for (reqp = firstp; reqp; reqp = REQPNEXT(reqp)) {
+                                       REQTIMESTAT("asc_dequeue_list", ascq,
+                                                   reqp, tid);
+                               }
+                       }
 #endif /* ADVANSYS_STATS */
-        }
-    } else {
-        /* Return all requests for all tids. */
-        firstp = lastp = NULL;
-        for (i = 0; i <= ADV_MAX_TID; i++) {
-            if (ascq->q_tidmask & ADV_TID_TO_TIDMASK(i)) {
-                if (firstp == NULL) {
-                    firstp = ascq->q_first[i];
-                    lastp = ascq->q_last[i];
-                } else {
-                    ASC_ASSERT(lastp != NULL);
-                    lastp->host_scribble = (unsigned char *)ascq->q_first[i];
-                    lastp = ascq->q_last[i];
-                }
-                ascq->q_first[i] = ascq->q_last[i] = NULL;
-                ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(i);
+               }
+       } else {
+               /* Return all requests for all tids. */
+               firstp = lastp = NULL;
+               for (i = 0; i <= ADV_MAX_TID; i++) {
+                       if (ascq->q_tidmask & ADV_TID_TO_TIDMASK(i)) {
+                               if (firstp == NULL) {
+                                       firstp = ascq->q_first[i];
+                                       lastp = ascq->q_last[i];
+                               } else {
+                                       ASC_ASSERT(lastp != NULL);
+                                       lastp->host_scribble =
+                                           (unsigned char *)ascq->q_first[i];
+                                       lastp = ascq->q_last[i];
+                               }
+                               ascq->q_first[i] = ascq->q_last[i] = NULL;
+                               ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(i);
 #ifdef ADVANSYS_STATS
-                ascq->q_cur_cnt[i] = 0;
+                               ascq->q_cur_cnt[i] = 0;
 #endif /* ADVANSYS_STATS */
-            }
-        }
+                       }
+               }
 #ifdef ADVANSYS_STATS
-        {
-            REQP reqp;
-            for (reqp = firstp; reqp; reqp = REQPNEXT(reqp)) {
-                REQTIMESTAT("asc_dequeue_list", ascq, reqp, reqp->device->id);
-            }
-        }
+               {
+                       REQP reqp;
+                       for (reqp = firstp; reqp; reqp = REQPNEXT(reqp)) {
+                               REQTIMESTAT("asc_dequeue_list", ascq, reqp,
+                                           reqp->device->id);
+                       }
+               }
 #endif /* ADVANSYS_STATS */
-    }
-    if (lastpp) {
-        *lastpp = lastp;
-    }
-    ASC_DBG1(3, "asc_dequeue_list: firstp 0x%lx\n", (ulong) firstp);
-    return firstp;
+       }
+       if (lastpp) {
+               *lastpp = lastp;
+       }
+       ASC_DBG1(3, "asc_dequeue_list: firstp 0x%lx\n", (ulong)firstp);
+       return firstp;
 }
 
 /*
@@ -7307,67 +6129,67 @@ asc_dequeue_list(asc_queue_t *ascq, REQP *lastpp, int tid)
  * Return ASC_TRUE if the command was found and removed,
  * otherwise return ASC_FALSE.
  */
-STATIC int
-asc_rmqueue(asc_queue_t *ascq, REQP reqp)
+static int asc_rmqueue(asc_queue_t *ascq, REQP reqp)
 {
-    REQP        currp, prevp;
-    int         tid;
-    int         ret = ASC_FALSE;
-
-    ASC_DBG2(3, "asc_rmqueue: ascq 0x%lx, reqp 0x%lx\n",
-        (ulong) ascq, (ulong) reqp);
-    ASC_ASSERT(reqp != NULL);
-
-    tid = REQPTID(reqp);
-    ASC_ASSERT(tid >= 0 && tid <= ADV_MAX_TID);
-
-    /*
-     * Handle the common case of 'reqp' being the first
-     * entry on the queue.
-     */
-    if (reqp == ascq->q_first[tid]) {
-        ret = ASC_TRUE;
-        ascq->q_first[tid] = REQPNEXT(reqp);
-        /* If the queue is now empty, clear its bit and the last pointer. */
-        if (ascq->q_first[tid] == NULL) {
-            ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(tid);
-            ASC_ASSERT(ascq->q_last[tid] == reqp);
-            ascq->q_last[tid] = NULL;
-        }
-    } else if (ascq->q_first[tid] != NULL) {
-        ASC_ASSERT(ascq->q_last[tid] != NULL);
-        /*
-         * Because the case of 'reqp' being the first entry has been
-         * handled above and it is known the queue is not empty, if
-         * 'reqp' is found on the queue it is guaranteed the queue will
-         * not become empty and that 'q_first[tid]' will not be changed.
-         *
-         * Set 'prevp' to the first entry, 'currp' to the second entry,
-         * and search for 'reqp'.
-         */
-        for (prevp = ascq->q_first[tid], currp = REQPNEXT(prevp);
-             currp; prevp = currp, currp = REQPNEXT(currp)) {
-            if (currp == reqp) {
-                ret = ASC_TRUE;
-                prevp->host_scribble = (unsigned char *)REQPNEXT(currp);
-                reqp->host_scribble = NULL;
-                if (ascq->q_last[tid] == reqp) {
-                    ascq->q_last[tid] = prevp;
-                }
-                break;
-            }
-        }
-    }
+       REQP currp, prevp;
+       int tid;
+       int ret = ASC_FALSE;
+
+       ASC_DBG2(3, "asc_rmqueue: ascq 0x%lx, reqp 0x%lx\n",
+                (ulong)ascq, (ulong)reqp);
+       ASC_ASSERT(reqp != NULL);
+
+       tid = REQPTID(reqp);
+       ASC_ASSERT(tid >= 0 && tid <= ADV_MAX_TID);
+
+       /*
+        * Handle the common case of 'reqp' being the first
+        * entry on the queue.
+        */
+       if (reqp == ascq->q_first[tid]) {
+               ret = ASC_TRUE;
+               ascq->q_first[tid] = REQPNEXT(reqp);
+               /* If the queue is now empty, clear its bit and the last pointer. */
+               if (ascq->q_first[tid] == NULL) {
+                       ascq->q_tidmask &= ~ADV_TID_TO_TIDMASK(tid);
+                       ASC_ASSERT(ascq->q_last[tid] == reqp);
+                       ascq->q_last[tid] = NULL;
+               }
+       } else if (ascq->q_first[tid] != NULL) {
+               ASC_ASSERT(ascq->q_last[tid] != NULL);
+               /*
+                * Because the case of 'reqp' being the first entry has been
+                * handled above and it is known the queue is not empty, if
+                * 'reqp' is found on the queue it is guaranteed the queue will
+                * not become empty and that 'q_first[tid]' will not be changed.
+                *
+                * Set 'prevp' to the first entry, 'currp' to the second entry,
+                * and search for 'reqp'.
+                */
+               for (prevp = ascq->q_first[tid], currp = REQPNEXT(prevp);
+                    currp; prevp = currp, currp = REQPNEXT(currp)) {
+                       if (currp == reqp) {
+                               ret = ASC_TRUE;
+                               prevp->host_scribble =
+                                   (unsigned char *)REQPNEXT(currp);
+                               reqp->host_scribble = NULL;
+                               if (ascq->q_last[tid] == reqp) {
+                                       ascq->q_last[tid] = prevp;
+                               }
+                               break;
+                       }
+               }
+       }
 #ifdef ADVANSYS_STATS
-    /* Maintain request queue statistics. */
-    if (ret == ASC_TRUE) {
-        ascq->q_cur_cnt[tid]--;
-        REQTIMESTAT("asc_rmqueue", ascq, reqp, tid);
-    }
-    ASC_ASSERT(ascq->q_cur_cnt[tid] >= 0);
+       /* Maintain request queue statistics. */
+       if (ret == ASC_TRUE) {
+               ascq->q_cur_cnt[tid]--;
+               REQTIMESTAT("asc_rmqueue", ascq, reqp, tid);
+       }
+       ASC_ASSERT(ascq->q_cur_cnt[tid] >= 0);
 #endif /* ADVANSYS_STATS */
-    ASC_DBG2(3, "asc_rmqueue: reqp 0x%lx, ret %d\n", (ulong) reqp, ret);
-    return ret;
+       ASC_DBG2(3, "asc_rmqueue: reqp 0x%lx, ret %d\n", (ulong)reqp, ret);
+       return ret;
 }
 
 /*
@@ -7375,37 +6197,38 @@ asc_rmqueue(asc_queue_t *ascq, REQP reqp)
  *
  * Calls asc_execute_scsi_cmnd() to execute a REQP/struct scsi_cmnd.
  */
-STATIC void
-asc_execute_queue(asc_queue_t *ascq)
+static void asc_execute_queue(asc_queue_t *ascq)
 {
-    ADV_SCSI_BIT_ID_TYPE    scan_tidmask;
-    REQP                    reqp;
-    int                     i;
-
-    ASC_DBG1(1, "asc_execute_queue: ascq 0x%lx\n", (ulong) ascq);
-    /*
-     * Execute queued commands for devices attached to
-     * the current board in round-robin fashion.
-     */
-    scan_tidmask = ascq->q_tidmask;
-    do {
-        for (i = 0; i <= ADV_MAX_TID; i++) {
-            if (scan_tidmask & ADV_TID_TO_TIDMASK(i)) {
-                if ((reqp = asc_dequeue(ascq, i)) == NULL) {
-                    scan_tidmask &= ~ADV_TID_TO_TIDMASK(i);
-                } else if (asc_execute_scsi_cmnd((struct scsi_cmnd *) reqp)
-                            == ASC_BUSY) {
-                    scan_tidmask &= ~ADV_TID_TO_TIDMASK(i);
-                    /*
-                     * The request returned ASC_BUSY. Enqueue at the front of
-                     * target's waiting list to maintain correct ordering.
-                     */
-                    asc_enqueue(ascq, reqp, ASC_FRONT);
-                }
-            }
-        }
-    } while (scan_tidmask);
-    return;
+       ADV_SCSI_BIT_ID_TYPE scan_tidmask;
+       REQP reqp;
+       int i;
+
+       ASC_DBG1(1, "asc_execute_queue: ascq 0x%lx\n", (ulong)ascq);
+       /*
+        * Execute queued commands for devices attached to
+        * the current board in round-robin fashion.
+        */
+       scan_tidmask = ascq->q_tidmask;
+       do {
+               for (i = 0; i <= ADV_MAX_TID; i++) {
+                       if (scan_tidmask & ADV_TID_TO_TIDMASK(i)) {
+                               if ((reqp = asc_dequeue(ascq, i)) == NULL) {
+                                       scan_tidmask &= ~ADV_TID_TO_TIDMASK(i);
+                               } else
+                                   if (asc_execute_scsi_cmnd
+                                       ((struct scsi_cmnd *)reqp)
+                                       == ASC_BUSY) {
+                                       scan_tidmask &= ~ADV_TID_TO_TIDMASK(i);
+                                       /*
+                                        * The request returned ASC_BUSY. Enqueue at the front of
+                                        * target's waiting list to maintain correct ordering.
+                                        */
+                                       asc_enqueue(ascq, reqp, ASC_FRONT);
+                               }
+                       }
+               }
+       } while (scan_tidmask);
+       return;
 }
 
 #ifdef CONFIG_PROC_FS
@@ -7420,102 +6243,102 @@ asc_execute_queue(asc_queue_t *ascq)
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_board_devices(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_board_devices(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    asc_board_t        *boardp;
-    int                leftlen;
-    int                totlen;
-    int                len;
-    int                chip_scsi_id;
-    int                i;
-
-    boardp = ASC_BOARDP(shp);
-    leftlen = cplen;
-    totlen = len = 0;
-
-    len = asc_prt_line(cp, leftlen,
-"\nDevice Information for AdvanSys SCSI Host %d:\n", shp->host_no);
-    ASC_PRT_NEXT();
-
-    if (ASC_NARROW_BOARD(boardp)) {
-        chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id;
-    } else {
-        chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
-    }
+       asc_board_t *boardp;
+       int leftlen;
+       int totlen;
+       int len;
+       int chip_scsi_id;
+       int i;
+
+       boardp = ASC_BOARDP(shost);
+       leftlen = cplen;
+       totlen = len = 0;
+
+       len = asc_prt_line(cp, leftlen,
+                          "\nDevice Information for AdvanSys SCSI Host %d:\n",
+                          shost->host_no);
+       ASC_PRT_NEXT();
+
+       if (ASC_NARROW_BOARD(boardp)) {
+               chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id;
+       } else {
+               chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
+       }
 
-    len = asc_prt_line(cp, leftlen, "Target IDs Detected:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) {
-            len = asc_prt_line(cp, leftlen, " %X,", i);
-            ASC_PRT_NEXT();
-        }
-    }
-    len = asc_prt_line(cp, leftlen, " (%X=Host Adapter)\n", chip_scsi_id);
-    ASC_PRT_NEXT();
+       len = asc_prt_line(cp, leftlen, "Target IDs Detected:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               if (boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) {
+                       len = asc_prt_line(cp, leftlen, " %X,", i);
+                       ASC_PRT_NEXT();
+               }
+       }
+       len = asc_prt_line(cp, leftlen, " (%X=Host Adapter)\n", chip_scsi_id);
+       ASC_PRT_NEXT();
 
-    return totlen;
+       return totlen;
 }
 
 /*
  * Display Wide Board BIOS Information.
  */
-STATIC int
-asc_prt_adv_bios(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_adv_bios(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    asc_board_t        *boardp;
-    int                leftlen;
-    int                totlen;
-    int                len;
-    ushort             major, minor, letter;
-
-    boardp = ASC_BOARDP(shp);
-    leftlen = cplen;
-    totlen = len = 0;
+       asc_board_t *boardp;
+       int leftlen;
+       int totlen;
+       int len;
+       ushort major, minor, letter;
+
+       boardp = ASC_BOARDP(shost);
+       leftlen = cplen;
+       totlen = len = 0;
+
+       len = asc_prt_line(cp, leftlen, "\nROM BIOS Version: ");
+       ASC_PRT_NEXT();
+
+       /*
+        * If the BIOS saved a valid signature, then fill in
+        * the BIOS code segment base address.
+        */
+       if (boardp->bios_signature != 0x55AA) {
+               len = asc_prt_line(cp, leftlen, "Disabled or Pre-3.1\n");
+               ASC_PRT_NEXT();
+               len = asc_prt_line(cp, leftlen,
+                                  "BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
+               ASC_PRT_NEXT();
+               len = asc_prt_line(cp, leftlen,
+                                  "can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
+               ASC_PRT_NEXT();
+       } else {
+               major = (boardp->bios_version >> 12) & 0xF;
+               minor = (boardp->bios_version >> 8) & 0xF;
+               letter = (boardp->bios_version & 0xFF);
 
-    len = asc_prt_line(cp, leftlen, "\nROM BIOS Version: ");
-    ASC_PRT_NEXT();
+               len = asc_prt_line(cp, leftlen, "%d.%d%c\n",
+                                  major, minor,
+                                  letter >= 26 ? '?' : letter + 'A');
+               ASC_PRT_NEXT();
 
-    /*
-     * If the BIOS saved a valid signature, then fill in
-     * the BIOS code segment base address.
-     */
-    if (boardp->bios_signature != 0x55AA) {
-        len = asc_prt_line(cp, leftlen, "Disabled or Pre-3.1\n");
-        ASC_PRT_NEXT();
-        len = asc_prt_line(cp, leftlen,
-"BIOS either disabled or Pre-3.1. If it is pre-3.1, then a newer version\n");
-        ASC_PRT_NEXT();
-        len = asc_prt_line(cp, leftlen,
-"can be found at the ConnectCom FTP site: ftp://ftp.connectcom.net/pub\n");
-        ASC_PRT_NEXT();
-    } else {
-        major = (boardp->bios_version >> 12) & 0xF;
-        minor = (boardp->bios_version >> 8) & 0xF;
-        letter = (boardp->bios_version & 0xFF);
-
-        len = asc_prt_line(cp, leftlen, "%d.%d%c\n",
-            major, minor, letter >= 26 ? '?' : letter + 'A');
-        ASC_PRT_NEXT();
-
-        /*
-         * Current available ROM BIOS release is 3.1I for UW
-         * and 3.2I for U2W. This code doesn't differentiate
-         * UW and U2W boards.
-         */
-        if (major < 3 || (major <= 3 && minor < 1) ||
-            (major <= 3 && minor <= 1 && letter < ('I'- 'A'))) {
-            len = asc_prt_line(cp, leftlen,
-"Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
-            ASC_PRT_NEXT();
-            len = asc_prt_line(cp, leftlen,
-"ftp://ftp.connectcom.net/pub\n");
-            ASC_PRT_NEXT();
-        }
-    }
+               /*
+                * Current available ROM BIOS release is 3.1I for UW
+                * and 3.2I for U2W. This code doesn't differentiate
+                * UW and U2W boards.
+                */
+               if (major < 3 || (major <= 3 && minor < 1) ||
+                   (major <= 3 && minor <= 1 && letter < ('I' - 'A'))) {
+                       len = asc_prt_line(cp, leftlen,
+                                          "Newer version of ROM BIOS is available at the ConnectCom FTP site:\n");
+                       ASC_PRT_NEXT();
+                       len = asc_prt_line(cp, leftlen,
+                                          "ftp://ftp.connectcom.net/pub\n");
+                       ASC_PRT_NEXT();
+               }
+       }
 
-    return totlen;
+       return totlen;
 }
 
 /*
@@ -7541,80 +6364,79 @@ asc_prt_adv_bios(struct Scsi_Host *shp, char *cp, int cplen)
  *
  * Returns ASC_TRUE if serial number found, otherwise returns ASC_FALSE.
  */
-STATIC int
-asc_get_eeprom_string(ushort *serialnum, uchar *cp)
+static int asc_get_eeprom_string(ushort *serialnum, uchar *cp)
 {
-    ushort      w, num;
-
-    if ((serialnum[1] & 0xFE00) != ((ushort) 0xAA << 8)) {
-        return ASC_FALSE;
-    } else {
-        /*
-         * First word - 6 digits.
-         */
-        w = serialnum[0];
-
-        /* Product type - 1st digit. */
-        if ((*cp = 'A' + ((w & 0xE000) >> 13)) == 'H') {
-            /* Product type is P=Prototype */
-            *cp += 0x8;
-        }
-        cp++;
-
-        /* Manufacturing location - 2nd digit. */
-        *cp++ = 'A' + ((w & 0x1C00) >> 10);
-
-        /* Product ID - 3rd, 4th digits. */
-        num = w & 0x3FF;
-        *cp++ = '0' + (num / 100);
-        num %= 100;
-        *cp++ = '0' + (num / 10);
-
-        /* Product revision - 5th digit. */
-        *cp++ = 'A' + (num % 10);
-
-        /*
-         * Second word
-         */
-        w = serialnum[1];
-
-        /*
-         * Year - 6th digit.
-         *
-         * If bit 15 of third word is set, then the
-         * last digit of the year is greater than 7.
-         */
-        if (serialnum[2] & 0x8000) {
-            *cp++ = '8' + ((w & 0x1C0) >> 6);
-        } else {
-            *cp++ = '0' + ((w & 0x1C0) >> 6);
-        }
-
-        /* Week of year - 7th, 8th digits. */
-        num = w & 0x003F;
-        *cp++ = '0' + num / 10;
-        num %= 10;
-        *cp++ = '0' + num;
-
-        /*
-         * Third word
-         */
-        w = serialnum[2] & 0x7FFF;
-
-        /* Serial number - 9th digit. */
-        *cp++ = 'A' + (w / 1000);
-
-        /* 10th, 11th, 12th digits. */
-        num = w % 1000;
-        *cp++ = '0' + num / 100;
-        num %= 100;
-        *cp++ = '0' + num / 10;
-        num %= 10;
-        *cp++ = '0' + num;
-
-        *cp = '\0';     /* Null Terminate the string. */
-        return ASC_TRUE;
-    }
+       ushort w, num;
+
+       if ((serialnum[1] & 0xFE00) != ((ushort)0xAA << 8)) {
+               return ASC_FALSE;
+       } else {
+               /*
+                * First word - 6 digits.
+                */
+               w = serialnum[0];
+
+               /* Product type - 1st digit. */
+               if ((*cp = 'A' + ((w & 0xE000) >> 13)) == 'H') {
+                       /* Product type is P=Prototype */
+                       *cp += 0x8;
+               }
+               cp++;
+
+               /* Manufacturing location - 2nd digit. */
+               *cp++ = 'A' + ((w & 0x1C00) >> 10);
+
+               /* Product ID - 3rd, 4th digits. */
+               num = w & 0x3FF;
+               *cp++ = '0' + (num / 100);
+               num %= 100;
+               *cp++ = '0' + (num / 10);
+
+               /* Product revision - 5th digit. */
+               *cp++ = 'A' + (num % 10);
+
+               /*
+                * Second word
+                */
+               w = serialnum[1];
+
+               /*
+                * Year - 6th digit.
+                *
+                * If bit 15 of third word is set, then the
+                * last digit of the year is greater than 7.
+                */
+               if (serialnum[2] & 0x8000) {
+                       *cp++ = '8' + ((w & 0x1C0) >> 6);
+               } else {
+                       *cp++ = '0' + ((w & 0x1C0) >> 6);
+               }
+
+               /* Week of year - 7th, 8th digits. */
+               num = w & 0x003F;
+               *cp++ = '0' + num / 10;
+               num %= 10;
+               *cp++ = '0' + num;
+
+               /*
+                * Third word
+                */
+               w = serialnum[2] & 0x7FFF;
+
+               /* Serial number - 9th digit. */
+               *cp++ = 'A' + (w / 1000);
+
+               /* 10th, 11th, 12th digits. */
+               num = w % 1000;
+               *cp++ = '0' + num / 100;
+               num %= 100;
+               *cp++ = '0' + num / 10;
+               num %= 10;
+               *cp++ = '0' + num;
+
+               *cp = '\0';     /* Null Terminate the string. */
+               return ASC_TRUE;
+       }
 }
 
 /*
@@ -7628,122 +6450,127 @@ asc_get_eeprom_string(ushort *serialnum, uchar *cp)
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_asc_board_eeprom(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_asc_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    asc_board_t        *boardp;
-    ASC_DVC_VAR        *asc_dvc_varp;
-    int                leftlen;
-    int                totlen;
-    int                len;
-    ASCEEP_CONFIG      *ep;
-    int                i;
+       asc_board_t *boardp;
+       ASC_DVC_VAR *asc_dvc_varp;
+       int leftlen;
+       int totlen;
+       int len;
+       ASCEEP_CONFIG *ep;
+       int i;
 #ifdef CONFIG_ISA
-    int                isa_dma_speed[] = { 10, 8, 7, 6, 5, 4, 3, 2 };
+       int isa_dma_speed[] = { 10, 8, 7, 6, 5, 4, 3, 2 };
 #endif /* CONFIG_ISA */
-    uchar              serialstr[13];
-
-    boardp = ASC_BOARDP(shp);
-    asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
-    ep = &boardp->eep_config.asc_eep;
-
-    leftlen = cplen;
-    totlen = len = 0;
-
-    len = asc_prt_line(cp, leftlen,
-"\nEEPROM Settings for AdvanSys SCSI Host %d:\n", shp->host_no);
-    ASC_PRT_NEXT();
-
-    if (asc_get_eeprom_string((ushort *) &ep->adapter_info[0], serialstr) ==
-        ASC_TRUE) {
-        len = asc_prt_line(cp, leftlen, " Serial Number: %s\n", serialstr);
-        ASC_PRT_NEXT();
-    } else {
-        if (ep->adapter_info[5] == 0xBB) {
-            len = asc_prt_line(cp, leftlen,
-                " Default Settings Used for EEPROM-less Adapter.\n");
-            ASC_PRT_NEXT();
-        } else {
-            len = asc_prt_line(cp, leftlen,
-                " Serial Number Signature Not Present.\n");
-            ASC_PRT_NEXT();
-        }
-    }
+       uchar serialstr[13];
+
+       boardp = ASC_BOARDP(shost);
+       asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
+       ep = &boardp->eep_config.asc_eep;
+
+       leftlen = cplen;
+       totlen = len = 0;
+
+       len = asc_prt_line(cp, leftlen,
+                          "\nEEPROM Settings for AdvanSys SCSI Host %d:\n",
+                          shost->host_no);
+       ASC_PRT_NEXT();
+
+       if (asc_get_eeprom_string((ushort *)&ep->adapter_info[0], serialstr)
+           == ASC_TRUE) {
+               len =
+                   asc_prt_line(cp, leftlen, " Serial Number: %s\n",
+                                serialstr);
+               ASC_PRT_NEXT();
+       } else {
+               if (ep->adapter_info[5] == 0xBB) {
+                       len = asc_prt_line(cp, leftlen,
+                                          " Default Settings Used for EEPROM-less Adapter.\n");
+                       ASC_PRT_NEXT();
+               } else {
+                       len = asc_prt_line(cp, leftlen,
+                                          " Serial Number Signature Not Present.\n");
+                       ASC_PRT_NEXT();
+               }
+       }
 
-    len = asc_prt_line(cp, leftlen,
-" Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
-        ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng, ep->max_tag_qng);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" cntl 0x%x, no_scam 0x%x\n",
-        ep->cntl, ep->no_scam);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Target ID:           ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %d", i);
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Disconnects:         ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (ep->disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Command Queuing:     ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (ep->use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Start Motor:         ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (ep->start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Synchronous Transfer:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (ep->init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
+       len = asc_prt_line(cp, leftlen,
+                          " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
+                          ASC_EEP_GET_CHIP_ID(ep), ep->max_total_qng,
+                          ep->max_tag_qng);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " cntl 0x%x, no_scam 0x%x\n", ep->cntl, ep->no_scam);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Target ID:           ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %d", i);
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Disconnects:         ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (ep->
+                                   disc_enable & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Command Queuing:     ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (ep->
+                                   use_cmd_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Start Motor:         ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (ep->
+                                   start_motor & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Synchronous Transfer:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (ep->
+                                   init_sdtr & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
 
 #ifdef CONFIG_ISA
-    if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
-        len = asc_prt_line(cp, leftlen,
-" Host ISA DMA speed:   %d MB/S\n",
-            isa_dma_speed[ASC_EEP_GET_DMA_SPD(ep)]);
-        ASC_PRT_NEXT();
-    }
+       if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
+               len = asc_prt_line(cp, leftlen,
+                                  " Host ISA DMA speed:   %d MB/S\n",
+                                  isa_dma_speed[ASC_EEP_GET_DMA_SPD(ep)]);
+               ASC_PRT_NEXT();
+       }
 #endif /* CONFIG_ISA */
 
-     return totlen;
+       return totlen;
 }
 
 /*
@@ -7757,365 +6584,347 @@ asc_prt_asc_board_eeprom(struct Scsi_Host *shp, char *cp, int cplen)
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_adv_board_eeprom(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_adv_board_eeprom(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    asc_board_t                 *boardp;
-    ADV_DVC_VAR                 *adv_dvc_varp;
-    int                         leftlen;
-    int                         totlen;
-    int                         len;
-    int                         i;
-    char                        *termstr;
-    uchar                       serialstr[13];
-    ADVEEP_3550_CONFIG          *ep_3550 = NULL;
-    ADVEEP_38C0800_CONFIG       *ep_38C0800 = NULL;
-    ADVEEP_38C1600_CONFIG       *ep_38C1600 = NULL;
-    ushort                      word;
-    ushort                      *wordp;
-    ushort                      sdtr_speed = 0;
-
-    boardp = ASC_BOARDP(shp);
-    adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        ep_3550 = &boardp->eep_config.adv_3550_eep;
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        ep_38C0800 = &boardp->eep_config.adv_38C0800_eep;
-    } else
-    {
-        ep_38C1600 = &boardp->eep_config.adv_38C1600_eep;
-    }
+       asc_board_t *boardp;
+       ADV_DVC_VAR *adv_dvc_varp;
+       int leftlen;
+       int totlen;
+       int len;
+       int i;
+       char *termstr;
+       uchar serialstr[13];
+       ADVEEP_3550_CONFIG *ep_3550 = NULL;
+       ADVEEP_38C0800_CONFIG *ep_38C0800 = NULL;
+       ADVEEP_38C1600_CONFIG *ep_38C1600 = NULL;
+       ushort word;
+       ushort *wordp;
+       ushort sdtr_speed = 0;
+
+       boardp = ASC_BOARDP(shost);
+       adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               ep_3550 = &boardp->eep_config.adv_3550_eep;
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               ep_38C0800 = &boardp->eep_config.adv_38C0800_eep;
+       } else {
+               ep_38C1600 = &boardp->eep_config.adv_38C1600_eep;
+       }
 
-    leftlen = cplen;
-    totlen = len = 0;
-
-    len = asc_prt_line(cp, leftlen,
-"\nEEPROM Settings for AdvanSys SCSI Host %d:\n", shp->host_no);
-    ASC_PRT_NEXT();
-
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        wordp = &ep_3550->serial_number_word1;
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        wordp = &ep_38C0800->serial_number_word1;
-    } else
-    {
-        wordp = &ep_38C1600->serial_number_word1;
-    }
+       leftlen = cplen;
+       totlen = len = 0;
 
-    if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE) {
-        len = asc_prt_line(cp, leftlen, " Serial Number: %s\n", serialstr);
-        ASC_PRT_NEXT();
-    } else {
-        len = asc_prt_line(cp, leftlen,
-            " Serial Number Signature Not Present.\n");
-        ASC_PRT_NEXT();
-    }
+       len = asc_prt_line(cp, leftlen,
+                          "\nEEPROM Settings for AdvanSys SCSI Host %d:\n",
+                          shost->host_no);
+       ASC_PRT_NEXT();
 
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        len = asc_prt_line(cp, leftlen,
-" Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
-            ep_3550->adapter_scsi_id, ep_3550->max_host_qng,
-            ep_3550->max_dvc_qng);
-        ASC_PRT_NEXT();
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        len = asc_prt_line(cp, leftlen,
-" Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
-            ep_38C0800->adapter_scsi_id, ep_38C0800->max_host_qng,
-            ep_38C0800->max_dvc_qng);
-        ASC_PRT_NEXT();
-    } else
-    {
-        len = asc_prt_line(cp, leftlen,
-" Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
-            ep_38C1600->adapter_scsi_id, ep_38C1600->max_host_qng,
-            ep_38C1600->max_dvc_qng);
-        ASC_PRT_NEXT();
-    }
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        word = ep_3550->termination;
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        word = ep_38C0800->termination_lvd;
-    } else
-    {
-        word = ep_38C1600->termination_lvd;
-    }
-    switch (word) {
-        case 1:
-            termstr = "Low Off/High Off";
-            break;
-        case 2:
-            termstr = "Low Off/High On";
-            break;
-        case 3:
-            termstr = "Low On/High On";
-            break;
-        default:
-        case 0:
-            termstr = "Automatic";
-            break;
-    }
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               wordp = &ep_3550->serial_number_word1;
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               wordp = &ep_38C0800->serial_number_word1;
+       } else {
+               wordp = &ep_38C1600->serial_number_word1;
+       }
 
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        len = asc_prt_line(cp, leftlen,
-" termination: %u (%s), bios_ctrl: 0x%x\n",
-            ep_3550->termination, termstr, ep_3550->bios_ctrl);
-        ASC_PRT_NEXT();
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        len = asc_prt_line(cp, leftlen,
-" termination: %u (%s), bios_ctrl: 0x%x\n",
-            ep_38C0800->termination_lvd, termstr, ep_38C0800->bios_ctrl);
-        ASC_PRT_NEXT();
-    } else
-    {
-        len = asc_prt_line(cp, leftlen,
-" termination: %u (%s), bios_ctrl: 0x%x\n",
-            ep_38C1600->termination_lvd, termstr, ep_38C1600->bios_ctrl);
-        ASC_PRT_NEXT();
-    }
+       if (asc_get_eeprom_string(wordp, serialstr) == ASC_TRUE) {
+               len =
+                   asc_prt_line(cp, leftlen, " Serial Number: %s\n",
+                                serialstr);
+               ASC_PRT_NEXT();
+       } else {
+               len = asc_prt_line(cp, leftlen,
+                                  " Serial Number Signature Not Present.\n");
+               ASC_PRT_NEXT();
+       }
 
-    len = asc_prt_line(cp, leftlen,
-" Target ID:           ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %X", i);
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        word = ep_3550->disc_enable;
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        word = ep_38C0800->disc_enable;
-    } else
-    {
-        word = ep_38C1600->disc_enable;
-    }
-    len = asc_prt_line(cp, leftlen,
-" Disconnects:         ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        word = ep_3550->tagqng_able;
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        word = ep_38C0800->tagqng_able;
-    } else
-    {
-        word = ep_38C1600->tagqng_able;
-    }
-    len = asc_prt_line(cp, leftlen,
-" Command Queuing:     ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        word = ep_3550->start_motor;
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        word = ep_38C0800->start_motor;
-    } else
-    {
-        word = ep_38C1600->start_motor;
-    }
-    len = asc_prt_line(cp, leftlen,
-" Start Motor:         ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        len = asc_prt_line(cp, leftlen,
-" Synchronous Transfer:");
-        ASC_PRT_NEXT();
-        for (i = 0; i <= ADV_MAX_TID; i++) {
-            len = asc_prt_line(cp, leftlen, " %c",
-                (ep_3550->sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-            ASC_PRT_NEXT();
-        }
-        len = asc_prt_line(cp, leftlen, "\n");
-        ASC_PRT_NEXT();
-    }
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               len = asc_prt_line(cp, leftlen,
+                                  " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
+                                  ep_3550->adapter_scsi_id,
+                                  ep_3550->max_host_qng, ep_3550->max_dvc_qng);
+               ASC_PRT_NEXT();
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               len = asc_prt_line(cp, leftlen,
+                                  " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
+                                  ep_38C0800->adapter_scsi_id,
+                                  ep_38C0800->max_host_qng,
+                                  ep_38C0800->max_dvc_qng);
+               ASC_PRT_NEXT();
+       } else {
+               len = asc_prt_line(cp, leftlen,
+                                  " Host SCSI ID: %u, Host Queue Size: %u, Device Queue Size: %u\n",
+                                  ep_38C1600->adapter_scsi_id,
+                                  ep_38C1600->max_host_qng,
+                                  ep_38C1600->max_dvc_qng);
+               ASC_PRT_NEXT();
+       }
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               word = ep_3550->termination;
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               word = ep_38C0800->termination_lvd;
+       } else {
+               word = ep_38C1600->termination_lvd;
+       }
+       switch (word) {
+       case 1:
+               termstr = "Low Off/High Off";
+               break;
+       case 2:
+               termstr = "Low Off/High On";
+               break;
+       case 3:
+               termstr = "Low On/High On";
+               break;
+       default:
+       case 0:
+               termstr = "Automatic";
+               break;
+       }
 
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        len = asc_prt_line(cp, leftlen,
-" Ultra Transfer:      ");
-    ASC_PRT_NEXT();
-        for (i = 0; i <= ADV_MAX_TID; i++) {
-            len = asc_prt_line(cp, leftlen, " %c",
-                (ep_3550->ultra_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-            ASC_PRT_NEXT();
-        }
-        len = asc_prt_line(cp, leftlen, "\n");
-        ASC_PRT_NEXT();
-    }
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               len = asc_prt_line(cp, leftlen,
+                                  " termination: %u (%s), bios_ctrl: 0x%x\n",
+                                  ep_3550->termination, termstr,
+                                  ep_3550->bios_ctrl);
+               ASC_PRT_NEXT();
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               len = asc_prt_line(cp, leftlen,
+                                  " termination: %u (%s), bios_ctrl: 0x%x\n",
+                                  ep_38C0800->termination_lvd, termstr,
+                                  ep_38C0800->bios_ctrl);
+               ASC_PRT_NEXT();
+       } else {
+               len = asc_prt_line(cp, leftlen,
+                                  " termination: %u (%s), bios_ctrl: 0x%x\n",
+                                  ep_38C1600->termination_lvd, termstr,
+                                  ep_38C1600->bios_ctrl);
+               ASC_PRT_NEXT();
+       }
 
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550)
-    {
-        word = ep_3550->wdtr_able;
-    } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        word = ep_38C0800->wdtr_able;
-    } else
-    {
-        word = ep_38C1600->wdtr_able;
-    }
-    len = asc_prt_line(cp, leftlen,
-" Wide Transfer:       ");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        len = asc_prt_line(cp, leftlen, " %c",
-            (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
-        adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600)
-    {
-        len = asc_prt_line(cp, leftlen,
-" Synchronous Transfer Speed (Mhz):\n  ");
-        ASC_PRT_NEXT();
-        for (i = 0; i <= ADV_MAX_TID; i++) {
-            char *speed_str;
-
-            if (i == 0)
-            {
-                sdtr_speed = adv_dvc_varp->sdtr_speed1;
-            } else if (i == 4)
-            {
-                sdtr_speed = adv_dvc_varp->sdtr_speed2;
-            } else if (i == 8)
-            {
-                sdtr_speed = adv_dvc_varp->sdtr_speed3;
-            } else if (i == 12)
-            {
-                sdtr_speed = adv_dvc_varp->sdtr_speed4;
-            }
-            switch (sdtr_speed & ADV_MAX_TID)
-            {
-                case 0:  speed_str = "Off"; break;
-                case 1:  speed_str = "  5"; break;
-                case 2:  speed_str = " 10"; break;
-                case 3:  speed_str = " 20"; break;
-                case 4:  speed_str = " 40"; break;
-                case 5:  speed_str = " 80"; break;
-                default: speed_str = "Unk"; break;
-            }
-            len = asc_prt_line(cp, leftlen, "%X:%s ", i, speed_str);
-            ASC_PRT_NEXT();
-            if (i == 7)
-            {
-                len = asc_prt_line(cp, leftlen, "\n  ");
-                ASC_PRT_NEXT();
-            }
-            sdtr_speed >>= 4;
-        }
-        len = asc_prt_line(cp, leftlen, "\n");
-        ASC_PRT_NEXT();
-    }
+       len = asc_prt_line(cp, leftlen, " Target ID:           ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %X", i);
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
 
-    return totlen;
-}
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               word = ep_3550->disc_enable;
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               word = ep_38C0800->disc_enable;
+       } else {
+               word = ep_38C1600->disc_enable;
+       }
+       len = asc_prt_line(cp, leftlen, " Disconnects:         ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
 
-/*
- * asc_prt_driver_conf()
- *
- * Note: no single line should be greater than ASC_PRTLINE_SIZE,
- * cf. asc_prt_line().
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               word = ep_3550->tagqng_able;
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               word = ep_38C0800->tagqng_able;
+       } else {
+               word = ep_38C1600->tagqng_able;
+       }
+       len = asc_prt_line(cp, leftlen, " Command Queuing:     ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               word = ep_3550->start_motor;
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               word = ep_38C0800->start_motor;
+       } else {
+               word = ep_38C1600->start_motor;
+       }
+       len = asc_prt_line(cp, leftlen, " Start Motor:         ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               len = asc_prt_line(cp, leftlen, " Synchronous Transfer:");
+               ASC_PRT_NEXT();
+               for (i = 0; i <= ADV_MAX_TID; i++) {
+                       len = asc_prt_line(cp, leftlen, " %c",
+                                          (ep_3550->
+                                           sdtr_able & ADV_TID_TO_TIDMASK(i)) ?
+                                          'Y' : 'N');
+                       ASC_PRT_NEXT();
+               }
+               len = asc_prt_line(cp, leftlen, "\n");
+               ASC_PRT_NEXT();
+       }
+
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               len = asc_prt_line(cp, leftlen, " Ultra Transfer:      ");
+               ASC_PRT_NEXT();
+               for (i = 0; i <= ADV_MAX_TID; i++) {
+                       len = asc_prt_line(cp, leftlen, " %c",
+                                          (ep_3550->
+                                           ultra_able & ADV_TID_TO_TIDMASK(i))
+                                          ? 'Y' : 'N');
+                       ASC_PRT_NEXT();
+               }
+               len = asc_prt_line(cp, leftlen, "\n");
+               ASC_PRT_NEXT();
+       }
+
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+               word = ep_3550->wdtr_able;
+       } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+               word = ep_38C0800->wdtr_able;
+       } else {
+               word = ep_38C1600->wdtr_able;
+       }
+       len = asc_prt_line(cp, leftlen, " Wide Transfer:       ");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               len = asc_prt_line(cp, leftlen, " %c",
+                                  (word & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800 ||
+           adv_dvc_varp->chip_type == ADV_CHIP_ASC38C1600) {
+               len = asc_prt_line(cp, leftlen,
+                                  " Synchronous Transfer Speed (Mhz):\n  ");
+               ASC_PRT_NEXT();
+               for (i = 0; i <= ADV_MAX_TID; i++) {
+                       char *speed_str;
+
+                       if (i == 0) {
+                               sdtr_speed = adv_dvc_varp->sdtr_speed1;
+                       } else if (i == 4) {
+                               sdtr_speed = adv_dvc_varp->sdtr_speed2;
+                       } else if (i == 8) {
+                               sdtr_speed = adv_dvc_varp->sdtr_speed3;
+                       } else if (i == 12) {
+                               sdtr_speed = adv_dvc_varp->sdtr_speed4;
+                       }
+                       switch (sdtr_speed & ADV_MAX_TID) {
+                       case 0:
+                               speed_str = "Off";
+                               break;
+                       case 1:
+                               speed_str = "  5";
+                               break;
+                       case 2:
+                               speed_str = " 10";
+                               break;
+                       case 3:
+                               speed_str = " 20";
+                               break;
+                       case 4:
+                               speed_str = " 40";
+                               break;
+                       case 5:
+                               speed_str = " 80";
+                               break;
+                       default:
+                               speed_str = "Unk";
+                               break;
+                       }
+                       len = asc_prt_line(cp, leftlen, "%X:%s ", i, speed_str);
+                       ASC_PRT_NEXT();
+                       if (i == 7) {
+                               len = asc_prt_line(cp, leftlen, "\n  ");
+                               ASC_PRT_NEXT();
+                       }
+                       sdtr_speed >>= 4;
+               }
+               len = asc_prt_line(cp, leftlen, "\n");
+               ASC_PRT_NEXT();
+       }
+
+       return totlen;
+}
+
+/*
+ * asc_prt_driver_conf()
+ *
+ * Note: no single line should be greater than ASC_PRTLINE_SIZE,
+ * cf. asc_prt_line().
  *
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_driver_conf(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_driver_conf(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    asc_board_t            *boardp;
-    int                    leftlen;
-    int                    totlen;
-    int                    len;
-    int                    chip_scsi_id;
-
-    boardp = ASC_BOARDP(shp);
-
-    leftlen = cplen;
-    totlen = len = 0;
-
-    len = asc_prt_line(cp, leftlen,
-"\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n",
-        shp->host_no);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" host_busy %u, last_reset %u, max_id %u, max_lun %u, max_channel %u\n",
-        shp->host_busy, shp->last_reset, shp->max_id, shp->max_lun,
-        shp->max_channel);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n",
-        shp->unique_id, shp->can_queue, shp->this_id, shp->sg_tablesize,
-        shp->cmd_per_lun);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" unchecked_isa_dma %d, use_clustering %d\n",
-        shp->unchecked_isa_dma, shp->use_clustering);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" flags 0x%x, last_reset 0x%x, jiffies 0x%x, asc_n_io_port 0x%x\n",
-        boardp->flags, boardp->last_reset, jiffies, boardp->asc_n_io_port);
-    ASC_PRT_NEXT();
-
-     /* 'shp->n_io_port' may be truncated because it is only one byte. */
-    len = asc_prt_line(cp, leftlen,
-" io_port 0x%x, n_io_port 0x%x\n",
-        shp->io_port, shp->n_io_port);
-    ASC_PRT_NEXT();
-
-    if (ASC_NARROW_BOARD(boardp)) {
-        chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id;
-    } else {
-        chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
-    }
+       asc_board_t *boardp;
+       int leftlen;
+       int totlen;
+       int len;
+       int chip_scsi_id;
+
+       boardp = ASC_BOARDP(shost);
+
+       leftlen = cplen;
+       totlen = len = 0;
+
+       len = asc_prt_line(cp, leftlen,
+                          "\nLinux Driver Configuration and Information for AdvanSys SCSI Host %d:\n",
+                          shost->host_no);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " host_busy %u, last_reset %u, max_id %u, max_lun %u, max_channel %u\n",
+                          shost->host_busy, shost->last_reset, shost->max_id,
+                          shost->max_lun, shost->max_channel);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " unique_id %d, can_queue %d, this_id %d, sg_tablesize %u, cmd_per_lun %u\n",
+                          shost->unique_id, shost->can_queue, shost->this_id,
+                          shost->sg_tablesize, shost->cmd_per_lun);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " unchecked_isa_dma %d, use_clustering %d\n",
+                          shost->unchecked_isa_dma, shost->use_clustering);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " flags 0x%x, last_reset 0x%x, jiffies 0x%x, asc_n_io_port 0x%x\n",
+                          boardp->flags, boardp->last_reset, jiffies,
+                          boardp->asc_n_io_port);
+       ASC_PRT_NEXT();
+
+       /* 'shost->n_io_port' may be truncated because it is only one byte. */
+       len = asc_prt_line(cp, leftlen,
+                          " io_port 0x%x, n_io_port 0x%x\n",
+                          shost->io_port, shost->n_io_port);
+       ASC_PRT_NEXT();
+
+       if (ASC_NARROW_BOARD(boardp)) {
+               chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id;
+       } else {
+               chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
+       }
 
-    return totlen;
+       return totlen;
 }
 
 /*
@@ -8129,178 +6938,181 @@ asc_prt_driver_conf(struct Scsi_Host *shp, char *cp, int cplen)
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_asc_board_info(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_asc_board_info(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    asc_board_t            *boardp;
-    int                    chip_scsi_id;
-    int                    leftlen;
-    int                    totlen;
-    int                    len;
-    ASC_DVC_VAR            *v;
-    ASC_DVC_CFG            *c;
-    int                    i;
-    int                    renegotiate = 0;
-
-    boardp = ASC_BOARDP(shp);
-    v = &boardp->dvc_var.asc_dvc_var;
-    c = &boardp->dvc_cfg.asc_dvc_cfg;
-    chip_scsi_id = c->chip_scsi_id;
-
-    leftlen = cplen;
-    totlen = len = 0;
-
-    len = asc_prt_line(cp, leftlen,
-"\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n",
-    shp->host_no);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" chip_version %u, lib_version 0x%x, lib_serial_no %u, mcode_date 0x%x\n",
-        c->chip_version, c->lib_version, c->lib_serial_no, c->mcode_date);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" mcode_version 0x%x, err_code %u\n",
-         c->mcode_version, v->err_code);
-    ASC_PRT_NEXT();
-
-    /* Current number of commands waiting for the host. */
-    len = asc_prt_line(cp, leftlen,
-" Total Command Pending: %d\n", v->cur_total_qng);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Command Queuing:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-        len = asc_prt_line(cp, leftlen, " %X:%c",
-            i, (v->use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    /* Current number of commands waiting for a device. */
-    len = asc_prt_line(cp, leftlen,
-" Command Queue Pending:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-        len = asc_prt_line(cp, leftlen, " %X:%u", i, v->cur_dvc_qng[i]);
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    /* Current limit on number of commands that can be sent to a device. */
-    len = asc_prt_line(cp, leftlen,
-" Command Queue Limit:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-        len = asc_prt_line(cp, leftlen, " %X:%u", i, v->max_dvc_qng[i]);
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    /* Indicate whether the device has returned queue full status. */
-    len = asc_prt_line(cp, leftlen,
-" Command Queue Full:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-        if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) {
-            len = asc_prt_line(cp, leftlen, " %X:Y-%d",
-                i, boardp->queue_full_cnt[i]);
-        } else {
-            len = asc_prt_line(cp, leftlen, " %X:N", i);
-        }
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Synchronous Transfer:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-        len = asc_prt_line(cp, leftlen, " %X:%c",
-            i, (v->sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        uchar syn_period_ix;
-
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) ||
-            ((v->init_sdtr & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        len = asc_prt_line(cp, leftlen, "  %X:", i);
-        ASC_PRT_NEXT();
-
-        if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0)
-        {
-            len = asc_prt_line(cp, leftlen, " Asynchronous");
-            ASC_PRT_NEXT();
-        } else
-        {
-            syn_period_ix =
-                (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index - 1);
-
-            len = asc_prt_line(cp, leftlen,
-                " Transfer Period Factor: %d (%d.%d Mhz),",
-                v->sdtr_period_tbl[syn_period_ix],
-                250 / v->sdtr_period_tbl[syn_period_ix],
-                ASC_TENTHS(250, v->sdtr_period_tbl[syn_period_ix]));
-            ASC_PRT_NEXT();
-
-            len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d",
-                boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET);
-            ASC_PRT_NEXT();
-        }
-
-        if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-            len = asc_prt_line(cp, leftlen, "*\n");
-            renegotiate = 1;
-        } else
-        {
-            len = asc_prt_line(cp, leftlen, "\n");
-        }
-        ASC_PRT_NEXT();
-    }
+       asc_board_t *boardp;
+       int chip_scsi_id;
+       int leftlen;
+       int totlen;
+       int len;
+       ASC_DVC_VAR *v;
+       ASC_DVC_CFG *c;
+       int i;
+       int renegotiate = 0;
+
+       boardp = ASC_BOARDP(shost);
+       v = &boardp->dvc_var.asc_dvc_var;
+       c = &boardp->dvc_cfg.asc_dvc_cfg;
+       chip_scsi_id = c->chip_scsi_id;
+
+       leftlen = cplen;
+       totlen = len = 0;
+
+       len = asc_prt_line(cp, leftlen,
+                          "\nAsc Library Configuration and Statistics for AdvanSys SCSI Host %d:\n",
+                          shost->host_no);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " chip_version %u, lib_version 0x%x, lib_serial_no %u, mcode_date 0x%x\n",
+                          c->chip_version, c->lib_version, c->lib_serial_no,
+                          c->mcode_date);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " mcode_version 0x%x, err_code %u\n",
+                          c->mcode_version, v->err_code);
+       ASC_PRT_NEXT();
+
+       /* Current number of commands waiting for the host. */
+       len = asc_prt_line(cp, leftlen,
+                          " Total Command Pending: %d\n", v->cur_total_qng);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Command Queuing:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+               len = asc_prt_line(cp, leftlen, " %X:%c",
+                                  i,
+                                  (v->
+                                   use_tagged_qng & ADV_TID_TO_TIDMASK(i)) ?
+                                  'Y' : 'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       /* Current number of commands waiting for a device. */
+       len = asc_prt_line(cp, leftlen, " Command Queue Pending:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+               len = asc_prt_line(cp, leftlen, " %X:%u", i, v->cur_dvc_qng[i]);
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       /* Current limit on number of commands that can be sent to a device. */
+       len = asc_prt_line(cp, leftlen, " Command Queue Limit:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+               len = asc_prt_line(cp, leftlen, " %X:%u", i, v->max_dvc_qng[i]);
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       /* Indicate whether the device has returned queue full status. */
+       len = asc_prt_line(cp, leftlen, " Command Queue Full:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+               if (boardp->queue_full & ADV_TID_TO_TIDMASK(i)) {
+                       len = asc_prt_line(cp, leftlen, " %X:Y-%d",
+                                          i, boardp->queue_full_cnt[i]);
+               } else {
+                       len = asc_prt_line(cp, leftlen, " %X:N", i);
+               }
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Synchronous Transfer:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+               len = asc_prt_line(cp, leftlen, " %X:%c",
+                                  i,
+                                  (v->
+                                   sdtr_done & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               uchar syn_period_ix;
+
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) ||
+                   ((v->init_sdtr & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               len = asc_prt_line(cp, leftlen, "  %X:", i);
+               ASC_PRT_NEXT();
+
+               if ((boardp->sdtr_data[i] & ASC_SYN_MAX_OFFSET) == 0) {
+                       len = asc_prt_line(cp, leftlen, " Asynchronous");
+                       ASC_PRT_NEXT();
+               } else {
+                       syn_period_ix =
+                           (boardp->sdtr_data[i] >> 4) & (v->max_sdtr_index -
+                                                          1);
+
+                       len = asc_prt_line(cp, leftlen,
+                                          " Transfer Period Factor: %d (%d.%d Mhz),",
+                                          v->sdtr_period_tbl[syn_period_ix],
+                                          250 /
+                                          v->sdtr_period_tbl[syn_period_ix],
+                                          ASC_TENTHS(250,
+                                                     v->
+                                                     sdtr_period_tbl
+                                                     [syn_period_ix]));
+                       ASC_PRT_NEXT();
+
+                       len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d",
+                                          boardp->
+                                          sdtr_data[i] & ASC_SYN_MAX_OFFSET);
+                       ASC_PRT_NEXT();
+               }
+
+               if ((v->sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
+                       len = asc_prt_line(cp, leftlen, "*\n");
+                       renegotiate = 1;
+               } else {
+                       len = asc_prt_line(cp, leftlen, "\n");
+               }
+               ASC_PRT_NEXT();
+       }
 
-    if (renegotiate)
-    {
-        len = asc_prt_line(cp, leftlen,
-            " * = Re-negotiation pending before next command.\n");
-        ASC_PRT_NEXT();
-    }
+       if (renegotiate) {
+               len = asc_prt_line(cp, leftlen,
+                                  " * = Re-negotiation pending before next command.\n");
+               ASC_PRT_NEXT();
+       }
 
-    return totlen;
+       return totlen;
 }
 
 /*
@@ -8314,237 +7126,242 @@ asc_prt_asc_board_info(struct Scsi_Host *shp, char *cp, int cplen)
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_adv_board_info(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_adv_board_info(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    asc_board_t            *boardp;
-    int                    leftlen;
-    int                    totlen;
-    int                    len;
-    int                    i;
-    ADV_DVC_VAR            *v;
-    ADV_DVC_CFG            *c;
-    AdvPortAddr            iop_base;
-    ushort                 chip_scsi_id;
-    ushort                 lramword;
-    uchar                  lrambyte;
-    ushort                 tagqng_able;
-    ushort                 sdtr_able, wdtr_able;
-    ushort                 wdtr_done, sdtr_done;
-    ushort                 period = 0;
-    int                    renegotiate = 0;
-
-    boardp = ASC_BOARDP(shp);
-    v = &boardp->dvc_var.adv_dvc_var;
-    c = &boardp->dvc_cfg.adv_dvc_cfg;
-    iop_base = v->iop_base;
-    chip_scsi_id = v->chip_scsi_id;
-
-    leftlen = cplen;
-    totlen = len = 0;
-
-    len = asc_prt_line(cp, leftlen,
-"\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n",
-    shp->host_no);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" iop_base 0x%lx, cable_detect: %X, err_code %u\n",
-         v->iop_base,
-         AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1) & CABLE_DETECT,
-         v->err_code);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" chip_version %u, lib_version 0x%x, mcode_date 0x%x, mcode_version 0x%x\n",
-        c->chip_version, c->lib_version, c->mcode_date, c->mcode_version);
-    ASC_PRT_NEXT();
-
-    AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-    len = asc_prt_line(cp, leftlen,
-" Queuing Enabled:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        len = asc_prt_line(cp, leftlen, " %X:%c",
-            i, (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Queue Limit:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + i, lrambyte);
-
-        len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte);
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" Command Pending:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_QUEUED_CMD + i, lrambyte);
-
-        len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte);
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-    len = asc_prt_line(cp, leftlen,
-" Wide Enabled:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        len = asc_prt_line(cp, leftlen, " %X:%c",
-            i, (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
-    len = asc_prt_line(cp, leftlen,
-" Transfer Bit Width:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        AdvReadWordLram(iop_base, ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i),
-            lramword);
-
-        len = asc_prt_line(cp, leftlen, " %X:%d",
-            i, (lramword & 0x8000) ? 16 : 8);
-        ASC_PRT_NEXT();
-
-        if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
-            (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-            len = asc_prt_line(cp, leftlen, "*");
-            ASC_PRT_NEXT();
-            renegotiate = 1;
-        }
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-    len = asc_prt_line(cp, leftlen,
-" Synchronous Enabled:");
-    ASC_PRT_NEXT();
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        len = asc_prt_line(cp, leftlen, " %X:%c",
-            i, (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' : 'N');
-        ASC_PRT_NEXT();
-    }
-    len = asc_prt_line(cp, leftlen, "\n");
-    ASC_PRT_NEXT();
-
-    AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
-    for (i = 0; i <= ADV_MAX_TID; i++) {
-
-        AdvReadWordLram(iop_base, ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i),
-            lramword);
-        lramword &= ~0x8000;
-
-        if ((chip_scsi_id == i) ||
-            ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) ||
-            ((sdtr_able & ADV_TID_TO_TIDMASK(i)) == 0)) {
-            continue;
-        }
-
-        len = asc_prt_line(cp, leftlen, "  %X:", i);
-        ASC_PRT_NEXT();
-
-        if ((lramword & 0x1F) == 0) /* Check for REQ/ACK Offset 0. */
-        {
-            len = asc_prt_line(cp, leftlen, " Asynchronous");
-            ASC_PRT_NEXT();
-        } else
-        {
-            len = asc_prt_line(cp, leftlen, " Transfer Period Factor: ");
-            ASC_PRT_NEXT();
-
-            if ((lramword & 0x1F00) == 0x1100) /* 80 Mhz */
-            {
-                len = asc_prt_line(cp, leftlen, "9 (80.0 Mhz),");
-                ASC_PRT_NEXT();
-            } else if ((lramword & 0x1F00) == 0x1000) /* 40 Mhz */
-            {
-                len = asc_prt_line(cp, leftlen, "10 (40.0 Mhz),");
-                ASC_PRT_NEXT();
-            } else /* 20 Mhz or below. */
-            {
-                period = (((lramword >> 8) * 25) + 50)/4;
-
-                if (period == 0) /* Should never happen. */
-                {
-                    len = asc_prt_line(cp, leftlen, "%d (? Mhz), ");
-                    ASC_PRT_NEXT();
-                } else
-                {
-                    len = asc_prt_line(cp, leftlen,
-                        "%d (%d.%d Mhz),",
-                        period, 250/period, ASC_TENTHS(250, period));
-                    ASC_PRT_NEXT();
-                }
-            }
-
-            len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d",
-                lramword & 0x1F);
-            ASC_PRT_NEXT();
-        }
-
-        if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
-            len = asc_prt_line(cp, leftlen, "*\n");
-            renegotiate = 1;
-        } else
-        {
-            len = asc_prt_line(cp, leftlen, "\n");
-        }
-        ASC_PRT_NEXT();
-    }
+       asc_board_t *boardp;
+       int leftlen;
+       int totlen;
+       int len;
+       int i;
+       ADV_DVC_VAR *v;
+       ADV_DVC_CFG *c;
+       AdvPortAddr iop_base;
+       ushort chip_scsi_id;
+       ushort lramword;
+       uchar lrambyte;
+       ushort tagqng_able;
+       ushort sdtr_able, wdtr_able;
+       ushort wdtr_done, sdtr_done;
+       ushort period = 0;
+       int renegotiate = 0;
+
+       boardp = ASC_BOARDP(shost);
+       v = &boardp->dvc_var.adv_dvc_var;
+       c = &boardp->dvc_cfg.adv_dvc_cfg;
+       iop_base = v->iop_base;
+       chip_scsi_id = v->chip_scsi_id;
+
+       leftlen = cplen;
+       totlen = len = 0;
+
+       len = asc_prt_line(cp, leftlen,
+                          "\nAdv Library Configuration and Statistics for AdvanSys SCSI Host %d:\n",
+                          shost->host_no);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " iop_base 0x%lx, cable_detect: %X, err_code %u\n",
+                          v->iop_base,
+                          AdvReadWordRegister(iop_base,
+                                              IOPW_SCSI_CFG1) & CABLE_DETECT,
+                          v->err_code);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " chip_version %u, lib_version 0x%x, mcode_date 0x%x, mcode_version 0x%x\n",
+                          c->chip_version, c->lib_version, c->mcode_date,
+                          c->mcode_version);
+       ASC_PRT_NEXT();
+
+       AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
+       len = asc_prt_line(cp, leftlen, " Queuing Enabled:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               len = asc_prt_line(cp, leftlen, " %X:%c",
+                                  i,
+                                  (tagqng_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Queue Limit:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + i,
+                               lrambyte);
+
+               len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte);
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen, " Command Pending:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_QUEUED_CMD + i,
+                               lrambyte);
+
+               len = asc_prt_line(cp, leftlen, " %X:%d", i, lrambyte);
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+       len = asc_prt_line(cp, leftlen, " Wide Enabled:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               len = asc_prt_line(cp, leftlen, " %X:%c",
+                                  i,
+                                  (wdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, wdtr_done);
+       len = asc_prt_line(cp, leftlen, " Transfer Bit Width:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               AdvReadWordLram(iop_base,
+                               ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i),
+                               lramword);
+
+               len = asc_prt_line(cp, leftlen, " %X:%d",
+                                  i, (lramword & 0x8000) ? 16 : 8);
+               ASC_PRT_NEXT();
+
+               if ((wdtr_able & ADV_TID_TO_TIDMASK(i)) &&
+                   (wdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
+                       len = asc_prt_line(cp, leftlen, "*");
+                       ASC_PRT_NEXT();
+                       renegotiate = 1;
+               }
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+       len = asc_prt_line(cp, leftlen, " Synchronous Enabled:");
+       ASC_PRT_NEXT();
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               len = asc_prt_line(cp, leftlen, " %X:%c",
+                                  i,
+                                  (sdtr_able & ADV_TID_TO_TIDMASK(i)) ? 'Y' :
+                                  'N');
+               ASC_PRT_NEXT();
+       }
+       len = asc_prt_line(cp, leftlen, "\n");
+       ASC_PRT_NEXT();
+
+       AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, sdtr_done);
+       for (i = 0; i <= ADV_MAX_TID; i++) {
+
+               AdvReadWordLram(iop_base,
+                               ASC_MC_DEVICE_HSHK_CFG_TABLE + (2 * i),
+                               lramword);
+               lramword &= ~0x8000;
+
+               if ((chip_scsi_id == i) ||
+                   ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(i)) == 0) ||
+                   ((sdtr_able & ADV_TID_TO_TIDMASK(i)) == 0)) {
+                       continue;
+               }
+
+               len = asc_prt_line(cp, leftlen, "  %X:", i);
+               ASC_PRT_NEXT();
+
+               if ((lramword & 0x1F) == 0) {   /* Check for REQ/ACK Offset 0. */
+                       len = asc_prt_line(cp, leftlen, " Asynchronous");
+                       ASC_PRT_NEXT();
+               } else {
+                       len =
+                           asc_prt_line(cp, leftlen,
+                                        " Transfer Period Factor: ");
+                       ASC_PRT_NEXT();
+
+                       if ((lramword & 0x1F00) == 0x1100) {    /* 80 Mhz */
+                               len =
+                                   asc_prt_line(cp, leftlen, "9 (80.0 Mhz),");
+                               ASC_PRT_NEXT();
+                       } else if ((lramword & 0x1F00) == 0x1000) {     /* 40 Mhz */
+                               len =
+                                   asc_prt_line(cp, leftlen, "10 (40.0 Mhz),");
+                               ASC_PRT_NEXT();
+                       } else {        /* 20 Mhz or below. */
+
+                               period = (((lramword >> 8) * 25) + 50) / 4;
+
+                               if (period == 0) {      /* Should never happen. */
+                                       len =
+                                           asc_prt_line(cp, leftlen,
+                                                        "%d (? Mhz), ");
+                                       ASC_PRT_NEXT();
+                               } else {
+                                       len = asc_prt_line(cp, leftlen,
+                                                          "%d (%d.%d Mhz),",
+                                                          period, 250 / period,
+                                                          ASC_TENTHS(250,
+                                                                     period));
+                                       ASC_PRT_NEXT();
+                               }
+                       }
+
+                       len = asc_prt_line(cp, leftlen, " REQ/ACK Offset: %d",
+                                          lramword & 0x1F);
+                       ASC_PRT_NEXT();
+               }
+
+               if ((sdtr_done & ADV_TID_TO_TIDMASK(i)) == 0) {
+                       len = asc_prt_line(cp, leftlen, "*\n");
+                       renegotiate = 1;
+               } else {
+                       len = asc_prt_line(cp, leftlen, "\n");
+               }
+               ASC_PRT_NEXT();
+       }
 
-    if (renegotiate)
-    {
-        len = asc_prt_line(cp, leftlen,
-            " * = Re-negotiation pending before next command.\n");
-        ASC_PRT_NEXT();
-    }
+       if (renegotiate) {
+               len = asc_prt_line(cp, leftlen,
+                                  " * = Re-negotiation pending before next command.\n");
+               ASC_PRT_NEXT();
+       }
 
-    return totlen;
+       return totlen;
 }
 
 /*
@@ -8553,30 +7370,30 @@ asc_prt_adv_board_info(struct Scsi_Host *shp, char *cp, int cplen)
  * Copy proc information to a read buffer taking into account the current
  * read offset in the file and the remaining space in the read buffer.
  */
-STATIC int
+static int
 asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen,
-              char *cp, int cplen)
+             char *cp, int cplen)
 {
-    int cnt = 0;
-
-    ASC_DBG3(2, "asc_proc_copy: offset %d, advoffset %d, cplen %d\n",
-            (unsigned) offset, (unsigned) advoffset, cplen);
-    if (offset <= advoffset) {
-        /* Read offset below current offset, copy everything. */
-        cnt = min(cplen, leftlen);
-        ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n",
-                (ulong) curbuf, (ulong) cp, cnt);
-        memcpy(curbuf, cp, cnt);
-    } else if (offset < advoffset + cplen) {
-        /* Read offset within current range, partial copy. */
-        cnt = (advoffset + cplen) - offset;
-        cp = (cp + cplen) - cnt;
-        cnt = min(cnt, leftlen);
-        ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n",
-                (ulong) curbuf, (ulong) cp, cnt);
-        memcpy(curbuf, cp, cnt);
-    }
-    return cnt;
+       int cnt = 0;
+
+       ASC_DBG3(2, "asc_proc_copy: offset %d, advoffset %d, cplen %d\n",
+                (unsigned)offset, (unsigned)advoffset, cplen);
+       if (offset <= advoffset) {
+               /* Read offset below current offset, copy everything. */
+               cnt = min(cplen, leftlen);
+               ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n",
+                        (ulong)curbuf, (ulong)cp, cnt);
+               memcpy(curbuf, cp, cnt);
+       } else if (offset < advoffset + cplen) {
+               /* Read offset within current range, partial copy. */
+               cnt = (advoffset + cplen) - offset;
+               cp = (cp + cplen) - cnt;
+               cnt = min(cnt, leftlen);
+               ASC_DBG3(2, "asc_proc_copy: curbuf 0x%lx, cp 0x%lx, cnt %d\n",
+                        (ulong)curbuf, (ulong)cp, cnt);
+               memcpy(curbuf, cp, cnt);
+       }
+       return cnt;
 }
 
 /*
@@ -8590,29 +7407,27 @@ asc_proc_copy(off_t advoffset, off_t offset, char *curbuf, int leftlen,
  * Note: If any single line is greater than ASC_PRTLINE_SIZE bytes the stack
  * will be corrupted. 's[]' is defined to be ASC_PRTLINE_SIZE bytes.
  */
-STATIC int
-asc_prt_line(char *buf, int buflen, char *fmt, ...)
+static int asc_prt_line(char *buf, int buflen, char *fmt, ...)
 {
-    va_list        args;
-    int            ret;
-    char           s[ASC_PRTLINE_SIZE];
-
-    va_start(args, fmt);
-    ret = vsprintf(s, fmt, args);
-    ASC_ASSERT(ret < ASC_PRTLINE_SIZE);
-    if (buf == NULL) {
-        (void) printk(s);
-        ret = 0;
-    } else {
-        ret = min(buflen, ret);
-        memcpy(buf, s, ret);
-    }
-    va_end(args);
-    return ret;
+       va_list args;
+       int ret;
+       char s[ASC_PRTLINE_SIZE];
+
+       va_start(args, fmt);
+       ret = vsprintf(s, fmt, args);
+       ASC_ASSERT(ret < ASC_PRTLINE_SIZE);
+       if (buf == NULL) {
+               (void)printk(s);
+               ret = 0;
+       } else {
+               ret = min(buflen, ret);
+               memcpy(buf, s, ret);
+       }
+       va_end(args);
+       return ret;
 }
 #endif /* CONFIG_PROC_FS */
 
-
 /*
  * --- Functions Required by the Asc Library
  */
@@ -8623,31 +7438,28 @@ asc_prt_line(char *buf, int buflen, char *fmt, ...)
  * from a timer interrupt, because this function may be
  * called when interrupts are disabled.
  */
-STATIC void
-DvcSleepMilliSecond(ADV_DCNT n)
+static void DvcSleepMilliSecond(ADV_DCNT n)
 {
-    ASC_DBG1(4, "DvcSleepMilliSecond: %lu\n", (ulong) n);
-    mdelay(n);
+       ASC_DBG1(4, "DvcSleepMilliSecond: %lu\n", (ulong)n);
+       mdelay(n);
 }
 
 /*
  * Currently and inline noop but leave as a placeholder.
  * Leave DvcEnterCritical() as a noop placeholder.
  */
-STATIC inline ulong
-DvcEnterCritical(void)
+static inline ulong DvcEnterCritical(void)
 {
-    return 0;
+       return 0;
 }
 
 /*
  * Critical sections are all protected by the board spinlock.
  * Leave DvcLeaveCritical() as a noop placeholder.
  */
-STATIC inline void
-DvcLeaveCritical(ulong flags)
+static inline void DvcLeaveCritical(ulong flags)
 {
-    return;
+       return;
 }
 
 /*
@@ -8660,20 +7472,20 @@ DvcLeaveCritical(ulong flags)
  * Description:
  *     Output an ASC_SCSI_Q structure to the chip
  */
-STATIC void
+static void
 DvcPutScsiQ(PortAddr iop_base, ushort s_addr, uchar *outbuf, int words)
 {
-    int    i;
-
-    ASC_DBG_PRT_HEX(2, "DvcPutScsiQ", outbuf, 2 * words);
-    AscSetChipLramAddr(iop_base, s_addr);
-    for (i = 0; i < 2 * words; i += 2) {
-        if (i == 4 || i == 20) {
-            continue;
-        }
-        outpw(iop_base + IOP_RAM_DATA,
-            ((ushort) outbuf[i + 1] << 8) | outbuf[i]);
-    }
+       int i;
+
+       ASC_DBG_PRT_HEX(2, "DvcPutScsiQ", outbuf, 2 * words);
+       AscSetChipLramAddr(iop_base, s_addr);
+       for (i = 0; i < 2 * words; i += 2) {
+               if (i == 4 || i == 20) {
+                       continue;
+               }
+               outpw(iop_base + IOP_RAM_DATA,
+                     ((ushort)outbuf[i + 1] << 8) | outbuf[i]);
+       }
 }
 
 /*
@@ -8686,52 +7498,46 @@ DvcPutScsiQ(PortAddr iop_base, ushort s_addr, uchar *outbuf, int words)
  * Description:
  *     Input an ASC_QDONE_INFO structure from the chip
  */
-STATIC void
+static void
 DvcGetQinfo(PortAddr iop_base, ushort s_addr, uchar *inbuf, int words)
 {
-    int    i;
-    ushort word;
-
-    AscSetChipLramAddr(iop_base, s_addr);
-    for (i = 0; i < 2 * words; i += 2) {
-        if (i == 10) {
-            continue;
-        }
-        word = inpw(iop_base + IOP_RAM_DATA);
-        inbuf[i] = word & 0xff;
-        inbuf[i + 1] = (word >> 8) & 0xff;
-    }
-    ASC_DBG_PRT_HEX(2, "DvcGetQinfo", inbuf, 2 * words);
+       int i;
+       ushort word;
+
+       AscSetChipLramAddr(iop_base, s_addr);
+       for (i = 0; i < 2 * words; i += 2) {
+               if (i == 10) {
+                       continue;
+               }
+               word = inpw(iop_base + IOP_RAM_DATA);
+               inbuf[i] = word & 0xff;
+               inbuf[i + 1] = (word >> 8) & 0xff;
+       }
+       ASC_DBG_PRT_HEX(2, "DvcGetQinfo", inbuf, 2 * words);
 }
 
 /*
  * Read a PCI configuration byte.
  */
-STATIC uchar __init
-DvcReadPCIConfigByte(
-        ASC_DVC_VAR *asc_dvc,
-        ushort offset)
+static uchar __init DvcReadPCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset)
 {
 #ifdef CONFIG_PCI
-    uchar byte_data;
-    pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data);
-    return byte_data;
+       uchar byte_data;
+       pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data);
+       return byte_data;
 #else /* !defined(CONFIG_PCI) */
-    return 0;
+       return 0;
 #endif /* !defined(CONFIG_PCI) */
 }
 
 /*
  * Write a PCI configuration byte.
  */
-STATIC void __init
-DvcWritePCIConfigByte(
-        ASC_DVC_VAR *asc_dvc,
-        ushort offset,
-        uchar  byte_data)
+static void __init
+DvcWritePCIConfigByte(ASC_DVC_VAR *asc_dvc, ushort offset, uchar byte_data)
 {
 #ifdef CONFIG_PCI
-    pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data);
+       pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data);
 #endif /* CONFIG_PCI */
 }
 
@@ -8739,51 +7545,43 @@ DvcWritePCIConfigByte(
  * Return the BIOS address of the adapter at the specified
  * I/O port and with the specified bus type.
  */
-STATIC ushort __init
-AscGetChipBiosAddress(
-        PortAddr iop_base,
-        ushort bus_type)
+static ushort __init AscGetChipBiosAddress(PortAddr iop_base, ushort bus_type)
 {
-    ushort  cfg_lsw;
-    ushort  bios_addr;
-
-    /*
-     * The PCI BIOS is re-located by the motherboard BIOS. Because
-     * of this the driver can not determine where a PCI BIOS is
-     * loaded and executes.
-     */
-    if (bus_type & ASC_IS_PCI)
-    {
-        return(0);
-    }
-
+       ushort cfg_lsw;
+       ushort bios_addr;
+
+       /*
+        * The PCI BIOS is re-located by the motherboard BIOS. Because
+        * of this the driver can not determine where a PCI BIOS is
+        * loaded and executes.
+        */
+       if (bus_type & ASC_IS_PCI) {
+               return (0);
+       }
 #ifdef CONFIG_ISA
-    if((bus_type & ASC_IS_EISA) != 0)
-    {
-        cfg_lsw = AscGetEisaChipCfg(iop_base);
-        cfg_lsw &= 0x000F;
-        bios_addr = (ushort)(ASC_BIOS_MIN_ADDR  +
-                                (cfg_lsw * ASC_BIOS_BANK_SIZE));
-        return(bios_addr);
-    }/* if */
+       if ((bus_type & ASC_IS_EISA) != 0) {
+               cfg_lsw = AscGetEisaChipCfg(iop_base);
+               cfg_lsw &= 0x000F;
+               bios_addr = (ushort)(ASC_BIOS_MIN_ADDR +
+                                    (cfg_lsw * ASC_BIOS_BANK_SIZE));
+               return (bios_addr);
+       }                       /* if */
 #endif /* CONFIG_ISA */
 
-    cfg_lsw = AscGetChipCfgLsw(iop_base);
+       cfg_lsw = AscGetChipCfgLsw(iop_base);
 
-    /*
-    *  ISA PnP uses the top bit as the 32K BIOS flag
-    */
-    if (bus_type == ASC_IS_ISAPNP)
-    {
-        cfg_lsw &= 0x7FFF;
-    }/* if */
-
-    bios_addr = (ushort)(((cfg_lsw >> 12) * ASC_BIOS_BANK_SIZE) +
-            ASC_BIOS_MIN_ADDR);
-    return(bios_addr);
+       /*
+        *  ISA PnP uses the top bit as the 32K BIOS flag
+        */
+       if (bus_type == ASC_IS_ISAPNP) {
+               cfg_lsw &= 0x7FFF;
+       }
+       /* if */
+       bios_addr = (ushort)(((cfg_lsw >> 12) * ASC_BIOS_BANK_SIZE) +
+                            ASC_BIOS_MIN_ADDR);
+       return (bios_addr);
 }
 
-
 /*
  * --- Functions Required by the Adv Library
  */
@@ -8801,49 +7599,44 @@ AscGetChipBiosAddress(
  */
 ADV_PADDR
 DvcGetPhyAddr(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq,
-        uchar *vaddr, ADV_SDCNT *lenp, int flag)
+             uchar *vaddr, ADV_SDCNT *lenp, int flag)
 {
-    ADV_PADDR           paddr;
+       ADV_PADDR paddr;
 
-    paddr = virt_to_bus(vaddr);
+       paddr = virt_to_bus(vaddr);
 
-    ASC_DBG4(4,
-        "DvcGetPhyAddr: vaddr 0x%lx, lenp 0x%lx *lenp %lu, paddr 0x%lx\n",
-        (ulong) vaddr, (ulong) lenp, (ulong) *((ulong *) lenp), (ulong) paddr);
+       ASC_DBG4(4,
+                "DvcGetPhyAddr: vaddr 0x%lx, lenp 0x%lx *lenp %lu, paddr 0x%lx\n",
+                (ulong)vaddr, (ulong)lenp, (ulong)*((ulong *)lenp),
+                (ulong)paddr);
 
-    return paddr;
+       return paddr;
 }
 
 /*
  * Read a PCI configuration byte.
  */
-STATIC uchar __init
-DvcAdvReadPCIConfigByte(
-        ADV_DVC_VAR *asc_dvc,
-        ushort offset)
+static uchar __init DvcAdvReadPCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset)
 {
 #ifdef CONFIG_PCI
-    uchar byte_data;
-    pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data);
-    return byte_data;
+       uchar byte_data;
+       pci_read_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, &byte_data);
+       return byte_data;
 #else /* CONFIG_PCI */
-    return 0;
+       return 0;
 #endif /* CONFIG_PCI */
 }
 
 /*
  * Write a PCI configuration byte.
  */
-STATIC void __init
-DvcAdvWritePCIConfigByte(
-        ADV_DVC_VAR *asc_dvc,
-        ushort offset,
-        uchar  byte_data)
+static void __init
+DvcAdvWritePCIConfigByte(ADV_DVC_VAR *asc_dvc, ushort offset, uchar byte_data)
 {
 #ifdef CONFIG_PCI
-    pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data);
+       pci_write_config_byte(to_pci_dev(asc_dvc->cfg->dev), offset, byte_data);
 #else /* CONFIG_PCI */
-    return;
+       return;
 #endif /* CONFIG_PCI */
 }
 
@@ -8862,97 +7655,98 @@ DvcAdvWritePCIConfigByte(
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_board_stats(struct Scsi_Host *shp, char *cp, int cplen)
+static int asc_prt_board_stats(struct Scsi_Host *shost, char *cp, int cplen)
 {
-    int                    leftlen;
-    int                    totlen;
-    int                    len;
-    struct asc_stats       *s;
-    asc_board_t            *boardp;
-
-    leftlen = cplen;
-    totlen = len = 0;
-
-    boardp = ASC_BOARDP(shp);
-    s = &boardp->asc_stats;
-
-    len = asc_prt_line(cp, leftlen,
-"\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n", shp->host_no);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" queuecommand %lu, reset %lu, biosparam %lu, interrupt %lu\n",
-        s->queuecommand, s->reset, s->biosparam, s->interrupt);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" callback %lu, done %lu, build_error %lu, build_noreq %lu, build_nosg %lu\n",
-        s->callback, s->done, s->build_error, s->adv_build_noreq,
-        s->adv_build_nosg);
-    ASC_PRT_NEXT();
-
-    len = asc_prt_line(cp, leftlen,
-" exe_noerror %lu, exe_busy %lu, exe_error %lu, exe_unknown %lu\n",
-        s->exe_noerror, s->exe_busy, s->exe_error, s->exe_unknown);
-    ASC_PRT_NEXT();
-
-    /*
-     * Display data transfer statistics.
-     */
-    if (s->cont_cnt > 0) {
-        len = asc_prt_line(cp, leftlen, " cont_cnt %lu, ", s->cont_cnt);
-        ASC_PRT_NEXT();
-
-        len = asc_prt_line(cp, leftlen, "cont_xfer %lu.%01lu kb ",
-                    s->cont_xfer/2,
-                    ASC_TENTHS(s->cont_xfer, 2));
-        ASC_PRT_NEXT();
-
-        /* Contiguous transfer average size */
-        len = asc_prt_line(cp, leftlen, "avg_xfer %lu.%01lu kb\n",
-                    (s->cont_xfer/2)/s->cont_cnt,
-                    ASC_TENTHS((s->cont_xfer/2), s->cont_cnt));
-        ASC_PRT_NEXT();
-    }
+       int leftlen;
+       int totlen;
+       int len;
+       struct asc_stats *s;
+       asc_board_t *boardp;
 
-    if (s->sg_cnt > 0) {
+       leftlen = cplen;
+       totlen = len = 0;
+
+       boardp = ASC_BOARDP(shost);
+       s = &boardp->asc_stats;
+
+       len = asc_prt_line(cp, leftlen,
+                          "\nLinux Driver Statistics for AdvanSys SCSI Host %d:\n",
+                          shost->host_no);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " queuecommand %lu, reset %lu, biosparam %lu, interrupt %lu\n",
+                          s->queuecommand, s->reset, s->biosparam,
+                          s->interrupt);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " callback %lu, done %lu, build_error %lu, build_noreq %lu, build_nosg %lu\n",
+                          s->callback, s->done, s->build_error,
+                          s->adv_build_noreq, s->adv_build_nosg);
+       ASC_PRT_NEXT();
+
+       len = asc_prt_line(cp, leftlen,
+                          " exe_noerror %lu, exe_busy %lu, exe_error %lu, exe_unknown %lu\n",
+                          s->exe_noerror, s->exe_busy, s->exe_error,
+                          s->exe_unknown);
+       ASC_PRT_NEXT();
+
+       /*
+        * Display data transfer statistics.
+        */
+       if (s->cont_cnt > 0) {
+               len = asc_prt_line(cp, leftlen, " cont_cnt %lu, ", s->cont_cnt);
+               ASC_PRT_NEXT();
+
+               len = asc_prt_line(cp, leftlen, "cont_xfer %lu.%01lu kb ",
+                                  s->cont_xfer / 2,
+                                  ASC_TENTHS(s->cont_xfer, 2));
+               ASC_PRT_NEXT();
+
+               /* Contiguous transfer average size */
+               len = asc_prt_line(cp, leftlen, "avg_xfer %lu.%01lu kb\n",
+                                  (s->cont_xfer / 2) / s->cont_cnt,
+                                  ASC_TENTHS((s->cont_xfer / 2), s->cont_cnt));
+               ASC_PRT_NEXT();
+       }
 
-        len = asc_prt_line(cp, leftlen, " sg_cnt %lu, sg_elem %lu, ",
-                    s->sg_cnt, s->sg_elem);
-        ASC_PRT_NEXT();
+       if (s->sg_cnt > 0) {
 
-        len = asc_prt_line(cp, leftlen, "sg_xfer %lu.%01lu kb\n",
-                    s->sg_xfer/2,
-                    ASC_TENTHS(s->sg_xfer, 2));
-        ASC_PRT_NEXT();
+               len = asc_prt_line(cp, leftlen, " sg_cnt %lu, sg_elem %lu, ",
+                                  s->sg_cnt, s->sg_elem);
+               ASC_PRT_NEXT();
 
-        /* Scatter gather transfer statistics */
-        len = asc_prt_line(cp, leftlen, " avg_num_elem %lu.%01lu, ",
-                    s->sg_elem/s->sg_cnt,
-                    ASC_TENTHS(s->sg_elem, s->sg_cnt));
-        ASC_PRT_NEXT();
+               len = asc_prt_line(cp, leftlen, "sg_xfer %lu.%01lu kb\n",
+                                  s->sg_xfer / 2, ASC_TENTHS(s->sg_xfer, 2));
+               ASC_PRT_NEXT();
 
-        len = asc_prt_line(cp, leftlen, "avg_elem_size %lu.%01lu kb, ",
-                    (s->sg_xfer/2)/s->sg_elem,
-                    ASC_TENTHS((s->sg_xfer/2), s->sg_elem));
-        ASC_PRT_NEXT();
+               /* Scatter gather transfer statistics */
+               len = asc_prt_line(cp, leftlen, " avg_num_elem %lu.%01lu, ",
+                                  s->sg_elem / s->sg_cnt,
+                                  ASC_TENTHS(s->sg_elem, s->sg_cnt));
+               ASC_PRT_NEXT();
 
-        len = asc_prt_line(cp, leftlen, "avg_xfer_size %lu.%01lu kb\n",
-                    (s->sg_xfer/2)/s->sg_cnt,
-                    ASC_TENTHS((s->sg_xfer/2), s->sg_cnt));
-        ASC_PRT_NEXT();
-    }
+               len = asc_prt_line(cp, leftlen, "avg_elem_size %lu.%01lu kb, ",
+                                  (s->sg_xfer / 2) / s->sg_elem,
+                                  ASC_TENTHS((s->sg_xfer / 2), s->sg_elem));
+               ASC_PRT_NEXT();
 
-    /*
-     * Display request queuing statistics.
-     */
-    len = asc_prt_line(cp, leftlen,
-" Active and Waiting Request Queues (Time Unit: %d HZ):\n", HZ);
-    ASC_PRT_NEXT();
+               len = asc_prt_line(cp, leftlen, "avg_xfer_size %lu.%01lu kb\n",
+                                  (s->sg_xfer / 2) / s->sg_cnt,
+                                  ASC_TENTHS((s->sg_xfer / 2), s->sg_cnt));
+               ASC_PRT_NEXT();
+       }
 
+       /*
+        * Display request queuing statistics.
+        */
+       len = asc_prt_line(cp, leftlen,
+                          " Active and Waiting Request Queues (Time Unit: %d HZ):\n",
+                          HZ);
+       ASC_PRT_NEXT();
 
-     return totlen;
+       return totlen;
 }
 
 /*
@@ -8967,70 +7761,89 @@ asc_prt_board_stats(struct Scsi_Host *shp, char *cp, int cplen)
  * Return the number of characters copied into 'cp'. No more than
  * 'cplen' characters will be copied to 'cp'.
  */
-STATIC int
-asc_prt_target_stats(struct Scsi_Host *shp, int tgt_id, char *cp, int cplen)
+static int
+asc_prt_target_stats(struct Scsi_Host *shost, int tgt_id, char *cp, int cplen)
 {
-    int                    leftlen;
-    int                    totlen;
-    int                    len;
-    struct asc_stats       *s;
-    ushort                 chip_scsi_id;
-    asc_board_t            *boardp;
-    asc_queue_t            *active;
-    asc_queue_t            *waiting;
-
-    leftlen = cplen;
-    totlen = len = 0;
-
-    boardp = ASC_BOARDP(shp);
-    s = &boardp->asc_stats;
-
-    active = &ASC_BOARDP(shp)->active;
-    waiting = &ASC_BOARDP(shp)->waiting;
-
-    if (ASC_NARROW_BOARD(boardp)) {
-        chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id;
-    } else {
-        chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
-    }
+       int leftlen;
+       int totlen;
+       int len;
+       struct asc_stats *s;
+       ushort chip_scsi_id;
+       asc_board_t *boardp;
+       asc_queue_t *active;
+       asc_queue_t *waiting;
 
-    if ((chip_scsi_id == tgt_id) ||
-        ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(tgt_id)) == 0)) {
-        return 0;
-    }
+       leftlen = cplen;
+       totlen = len = 0;
+
+       boardp = ASC_BOARDP(shost);
+       s = &boardp->asc_stats;
+
+       active = &ASC_BOARDP(shost)->active;
+       waiting = &ASC_BOARDP(shost)->waiting;
+
+       if (ASC_NARROW_BOARD(boardp)) {
+               chip_scsi_id = boardp->dvc_cfg.asc_dvc_cfg.chip_scsi_id;
+       } else {
+               chip_scsi_id = boardp->dvc_var.adv_dvc_var.chip_scsi_id;
+       }
+
+       if ((chip_scsi_id == tgt_id) ||
+           ((boardp->init_tidmask & ADV_TID_TO_TIDMASK(tgt_id)) == 0)) {
+               return 0;
+       }
 
-    do {
-        if (active->q_tot_cnt[tgt_id] > 0 || waiting->q_tot_cnt[tgt_id] > 0) {
-            len = asc_prt_line(cp, leftlen, " target %d\n", tgt_id);
-            ASC_PRT_NEXT();
-
-            len = asc_prt_line(cp, leftlen,
-"   active: cnt [cur %d, max %d, tot %u], time [min %d, max %d, avg %lu.%01lu]\n",
-                active->q_cur_cnt[tgt_id], active->q_max_cnt[tgt_id],
-                active->q_tot_cnt[tgt_id],
-                active->q_min_tim[tgt_id], active->q_max_tim[tgt_id],
-                (active->q_tot_cnt[tgt_id] == 0) ? 0 :
-                (active->q_tot_tim[tgt_id]/active->q_tot_cnt[tgt_id]),
-                (active->q_tot_cnt[tgt_id] == 0) ? 0 :
-                ASC_TENTHS(active->q_tot_tim[tgt_id],
-                active->q_tot_cnt[tgt_id]));
-             ASC_PRT_NEXT();
-
-             len = asc_prt_line(cp, leftlen,
-"   waiting: cnt [cur %d, max %d, tot %u], time [min %u, max %u, avg %lu.%01lu]\n",
-                waiting->q_cur_cnt[tgt_id], waiting->q_max_cnt[tgt_id],
-                waiting->q_tot_cnt[tgt_id],
-                waiting->q_min_tim[tgt_id], waiting->q_max_tim[tgt_id],
-                (waiting->q_tot_cnt[tgt_id] == 0) ? 0 :
-                (waiting->q_tot_tim[tgt_id]/waiting->q_tot_cnt[tgt_id]),
-                (waiting->q_tot_cnt[tgt_id] == 0) ? 0 :
-                ASC_TENTHS(waiting->q_tot_tim[tgt_id],
-                waiting->q_tot_cnt[tgt_id]));
-             ASC_PRT_NEXT();
-        }
-    } while (0);
-
-     return totlen;
+       do {
+               if (active->q_tot_cnt[tgt_id] > 0
+                   || waiting->q_tot_cnt[tgt_id] > 0) {
+                       len = asc_prt_line(cp, leftlen, " target %d\n", tgt_id);
+                       ASC_PRT_NEXT();
+
+                       len = asc_prt_line(cp, leftlen,
+                                          "   active: cnt [cur %d, max %d, tot %u], time [min %d, max %d, avg %lu.%01lu]\n",
+                                          active->q_cur_cnt[tgt_id],
+                                          active->q_max_cnt[tgt_id],
+                                          active->q_tot_cnt[tgt_id],
+                                          active->q_min_tim[tgt_id],
+                                          active->q_max_tim[tgt_id],
+                                          (active->q_tot_cnt[tgt_id] ==
+                                           0) ? 0 : (active->
+                                                     q_tot_tim[tgt_id] /
+                                                     active->
+                                                     q_tot_cnt[tgt_id]),
+                                          (active->q_tot_cnt[tgt_id] ==
+                                           0) ? 0 : ASC_TENTHS(active->
+                                                               q_tot_tim
+                                                               [tgt_id],
+                                                               active->
+                                                               q_tot_cnt
+                                                               [tgt_id]));
+                       ASC_PRT_NEXT();
+
+                       len = asc_prt_line(cp, leftlen,
+                                          "   waiting: cnt [cur %d, max %d, tot %u], time [min %u, max %u, avg %lu.%01lu]\n",
+                                          waiting->q_cur_cnt[tgt_id],
+                                          waiting->q_max_cnt[tgt_id],
+                                          waiting->q_tot_cnt[tgt_id],
+                                          waiting->q_min_tim[tgt_id],
+                                          waiting->q_max_tim[tgt_id],
+                                          (waiting->q_tot_cnt[tgt_id] ==
+                                           0) ? 0 : (waiting->
+                                                     q_tot_tim[tgt_id] /
+                                                     waiting->
+                                                     q_tot_cnt[tgt_id]),
+                                          (waiting->q_tot_cnt[tgt_id] ==
+                                           0) ? 0 : ASC_TENTHS(waiting->
+                                                               q_tot_tim
+                                                               [tgt_id],
+                                                               waiting->
+                                                               q_tot_cnt
+                                                               [tgt_id]));
+                       ASC_PRT_NEXT();
+               }
+       } while (0);
+
+       return totlen;
 }
 #endif /* CONFIG_PROC_FS */
 #endif /* ADVANSYS_STATS */
@@ -9039,207 +7852,181 @@ asc_prt_target_stats(struct Scsi_Host *shp, int tgt_id, char *cp, int cplen)
 /*
  * asc_prt_scsi_host()
  */
-STATIC void
-asc_prt_scsi_host(struct Scsi_Host *s)
+static void asc_prt_scsi_host(struct Scsi_Host *s)
 {
-    asc_board_t         *boardp;
-
-    boardp = ASC_BOARDP(s);
-
-    printk("Scsi_Host at addr 0x%lx\n", (ulong) s);
-    printk(
-" host_busy %u, host_no %d, last_reset %d,\n",
-        s->host_busy, s->host_no,
-        (unsigned) s->last_reset);
-
-    printk(
-" base 0x%lx, io_port 0x%lx, n_io_port %u, irq 0x%x,\n",
-        (ulong) s->base, (ulong) s->io_port, s->n_io_port, s->irq);
-
-    printk(
-" dma_channel %d, this_id %d, can_queue %d,\n",
-        s->dma_channel, s->this_id, s->can_queue);
-
-    printk(
-" cmd_per_lun %d, sg_tablesize %d, unchecked_isa_dma %d\n",
-        s->cmd_per_lun, s->sg_tablesize, s->unchecked_isa_dma);
-
-    if (ASC_NARROW_BOARD(boardp)) {
-        asc_prt_asc_dvc_var(&ASC_BOARDP(s)->dvc_var.asc_dvc_var);
-        asc_prt_asc_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.asc_dvc_cfg);
-    } else {
-        asc_prt_adv_dvc_var(&ASC_BOARDP(s)->dvc_var.adv_dvc_var);
-        asc_prt_adv_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.adv_dvc_cfg);
-    }
+       asc_board_t *boardp;
+
+       boardp = ASC_BOARDP(s);
+
+       printk("Scsi_Host at addr 0x%lx\n", (ulong)s);
+       printk(" host_busy %u, host_no %d, last_reset %d,\n",
+              s->host_busy, s->host_no, (unsigned)s->last_reset);
+
+       printk(" base 0x%lx, io_port 0x%lx, n_io_port %u, irq 0x%x,\n",
+              (ulong)s->base, (ulong)s->io_port, s->n_io_port, s->irq);
+
+       printk(" dma_channel %d, this_id %d, can_queue %d,\n",
+              s->dma_channel, s->this_id, s->can_queue);
+
+       printk(" cmd_per_lun %d, sg_tablesize %d, unchecked_isa_dma %d\n",
+              s->cmd_per_lun, s->sg_tablesize, s->unchecked_isa_dma);
+
+       if (ASC_NARROW_BOARD(boardp)) {
+               asc_prt_asc_dvc_var(&ASC_BOARDP(s)->dvc_var.asc_dvc_var);
+               asc_prt_asc_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.asc_dvc_cfg);
+       } else {
+               asc_prt_adv_dvc_var(&ASC_BOARDP(s)->dvc_var.adv_dvc_var);
+               asc_prt_adv_dvc_cfg(&ASC_BOARDP(s)->dvc_cfg.adv_dvc_cfg);
+       }
 }
 
 /*
  * asc_prt_scsi_cmnd()
  */
-STATIC void
-asc_prt_scsi_cmnd(struct scsi_cmnd *s)
+static void asc_prt_scsi_cmnd(struct scsi_cmnd *s)
 {
-    printk("struct scsi_cmnd at addr 0x%lx\n", (ulong) s);
+       printk("struct scsi_cmnd at addr 0x%lx\n", (ulong)s);
 
-    printk(
-" host 0x%lx, device 0x%lx, target %u, lun %u, channel %u,\n",
-        (ulong) s->device->host, (ulong) s->device, s->device->id, s->device->lun,
-        s->device->channel);
+       printk(" host 0x%lx, device 0x%lx, target %u, lun %u, channel %u,\n",
+              (ulong)s->device->host, (ulong)s->device, s->device->id,
+              s->device->lun, s->device->channel);
 
-    asc_prt_hex(" CDB", s->cmnd, s->cmd_len);
+       asc_prt_hex(" CDB", s->cmnd, s->cmd_len);
 
-    printk (
-"sc_data_direction %u, resid %d\n",
-        s->sc_data_direction, s->resid);
+       printk("sc_data_direction %u, resid %d\n",
+              s->sc_data_direction, s->resid);
 
-    printk(
-" use_sg %u, sglist_len %u\n",
-        s->use_sg, s->sglist_len);
+       printk(" use_sg %u, sglist_len %u\n", s->use_sg, s->sglist_len);
 
-    printk(
-" serial_number 0x%x, retries %d, allowed %d\n",
-        (unsigned) s->serial_number, s->retries, s->allowed);
+       printk(" serial_number 0x%x, retries %d, allowed %d\n",
+              (unsigned)s->serial_number, s->retries, s->allowed);
 
-    printk(
-" timeout_per_command %d\n",
-        s->timeout_per_command);
+       printk(" timeout_per_command %d\n", s->timeout_per_command);
 
-    printk(
-" scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n",
-        (ulong) s->scsi_done, (ulong) s->done,
-        (ulong) s->host_scribble, s->result);
+       printk
+           (" scsi_done 0x%lx, done 0x%lx, host_scribble 0x%lx, result 0x%x\n",
+            (ulong)s->scsi_done, (ulong)s->done, (ulong)s->host_scribble,
+            s->result);
 
-    printk(
-" tag %u, pid %u\n",
-        (unsigned) s->tag, (unsigned) s->pid);
+       printk(" tag %u, pid %u\n", (unsigned)s->tag, (unsigned)s->pid);
 }
 
 /*
  * asc_prt_asc_dvc_var()
  */
-STATIC void
-asc_prt_asc_dvc_var(ASC_DVC_VAR *h)
+static void asc_prt_asc_dvc_var(ASC_DVC_VAR *h)
 {
-    printk("ASC_DVC_VAR at addr 0x%lx\n", (ulong) h);
-
-    printk(
-" iop_base 0x%x, err_code 0x%x, dvc_cntl 0x%x, bug_fix_cntl %d,\n",
-        h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl);
-
-    printk(
-" bus_type %d, isr_callback 0x%lx, exe_callback 0x%lx, init_sdtr 0x%x,\n",
-        h->bus_type, (ulong) h->isr_callback, (ulong) h->exe_callback,
-        (unsigned) h->init_sdtr);
-
-    printk(
-" sdtr_done 0x%x, use_tagged_qng 0x%x, unit_not_ready 0x%x, chip_no 0x%x,\n",
-        (unsigned) h->sdtr_done, (unsigned) h->use_tagged_qng,
-        (unsigned) h->unit_not_ready, (unsigned) h->chip_no);
-
-    printk(
-" queue_full_or_busy 0x%x, start_motor 0x%x, scsi_reset_wait %u,\n",
-        (unsigned) h->queue_full_or_busy, (unsigned) h->start_motor,
-        (unsigned) h->scsi_reset_wait);
-
-    printk(
-" is_in_int %u, max_total_qng %u, cur_total_qng %u, in_critical_cnt %u,\n",
-        (unsigned) h->is_in_int, (unsigned) h->max_total_qng,
-        (unsigned) h->cur_total_qng, (unsigned) h->in_critical_cnt);
-
-    printk(
-" last_q_shortage %u, init_state 0x%x, no_scam 0x%x, pci_fix_asyn_xfer 0x%x,\n",
-        (unsigned) h->last_q_shortage, (unsigned) h->init_state,
-        (unsigned) h->no_scam, (unsigned) h->pci_fix_asyn_xfer);
-
-    printk(
-" cfg 0x%lx, irq_no 0x%x\n",
-        (ulong) h->cfg, (unsigned) h->irq_no);
+       printk("ASC_DVC_VAR at addr 0x%lx\n", (ulong)h);
+
+       printk
+           (" iop_base 0x%x, err_code 0x%x, dvc_cntl 0x%x, bug_fix_cntl %d,\n",
+            h->iop_base, h->err_code, h->dvc_cntl, h->bug_fix_cntl);
+
+       printk
+           (" bus_type %d, isr_callback 0x%lx, exe_callback 0x%lx, init_sdtr 0x%x,\n",
+            h->bus_type, (ulong)h->isr_callback, (ulong)h->exe_callback,
+            (unsigned)h->init_sdtr);
+
+       printk
+           (" sdtr_done 0x%x, use_tagged_qng 0x%x, unit_not_ready 0x%x, chip_no 0x%x,\n",
+            (unsigned)h->sdtr_done, (unsigned)h->use_tagged_qng,
+            (unsigned)h->unit_not_ready, (unsigned)h->chip_no);
+
+       printk
+           (" queue_full_or_busy 0x%x, start_motor 0x%x, scsi_reset_wait %u,\n",
+            (unsigned)h->queue_full_or_busy, (unsigned)h->start_motor,
+            (unsigned)h->scsi_reset_wait);
+
+       printk
+           (" is_in_int %u, max_total_qng %u, cur_total_qng %u, in_critical_cnt %u,\n",
+            (unsigned)h->is_in_int, (unsigned)h->max_total_qng,
+            (unsigned)h->cur_total_qng, (unsigned)h->in_critical_cnt);
+
+       printk
+           (" last_q_shortage %u, init_state 0x%x, no_scam 0x%x, pci_fix_asyn_xfer 0x%x,\n",
+            (unsigned)h->last_q_shortage, (unsigned)h->init_state,
+            (unsigned)h->no_scam, (unsigned)h->pci_fix_asyn_xfer);
+
+       printk(" cfg 0x%lx, irq_no 0x%x\n", (ulong)h->cfg, (unsigned)h->irq_no);
 }
 
 /*
  * asc_prt_asc_dvc_cfg()
  */
-STATIC void
-asc_prt_asc_dvc_cfg(ASC_DVC_CFG *h)
+static void asc_prt_asc_dvc_cfg(ASC_DVC_CFG *h)
 {
-    printk("ASC_DVC_CFG at addr 0x%lx\n", (ulong) h);
-
-    printk(
-" can_tagged_qng 0x%x, cmd_qng_enabled 0x%x,\n",
-            h->can_tagged_qng, h->cmd_qng_enabled);
-    printk(
-" disc_enable 0x%x, sdtr_enable 0x%x,\n",
-            h->disc_enable, h->sdtr_enable);
-
-    printk(
-" chip_scsi_id %d, isa_dma_speed %d, isa_dma_channel %d, chip_version %d,\n",
-             h->chip_scsi_id, h->isa_dma_speed, h->isa_dma_channel,
-             h->chip_version);
-
-    printk(
-" pci_device_id %d, lib_serial_no %u, lib_version %u, mcode_date 0x%x,\n",
-          to_pci_dev(h->dev)->device, h->lib_serial_no, h->lib_version,
-          h->mcode_date);
-
-    printk(
-" mcode_version %d, overrun_buf 0x%lx\n",
-            h->mcode_version, (ulong) h->overrun_buf);
+       printk("ASC_DVC_CFG at addr 0x%lx\n", (ulong)h);
+
+       printk(" can_tagged_qng 0x%x, cmd_qng_enabled 0x%x,\n",
+              h->can_tagged_qng, h->cmd_qng_enabled);
+       printk(" disc_enable 0x%x, sdtr_enable 0x%x,\n",
+              h->disc_enable, h->sdtr_enable);
+
+       printk
+           (" chip_scsi_id %d, isa_dma_speed %d, isa_dma_channel %d, chip_version %d,\n",
+            h->chip_scsi_id, h->isa_dma_speed, h->isa_dma_channel,
+            h->chip_version);
+
+       printk
+           (" pci_device_id %d, lib_serial_no %u, lib_version %u, mcode_date 0x%x,\n",
+            to_pci_dev(h->dev)->device, h->lib_serial_no, h->lib_version,
+            h->mcode_date);
+
+       printk(" mcode_version %d, overrun_buf 0x%lx\n",
+              h->mcode_version, (ulong)h->overrun_buf);
 }
 
 /*
  * asc_prt_asc_scsi_q()
  */
-STATIC void
-asc_prt_asc_scsi_q(ASC_SCSI_Q *q)
+static void asc_prt_asc_scsi_q(ASC_SCSI_Q *q)
 {
-    ASC_SG_HEAD    *sgp;
-    int i;
-
-    printk("ASC_SCSI_Q at addr 0x%lx\n", (ulong) q);
-
-    printk(
-" target_ix 0x%x, target_lun %u, srb_ptr 0x%lx, tag_code 0x%x,\n",
-            q->q2.target_ix, q->q1.target_lun,
-            (ulong) q->q2.srb_ptr, q->q2.tag_code);
-
-    printk(
-" data_addr 0x%lx, data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
-            (ulong) le32_to_cpu(q->q1.data_addr),
-            (ulong) le32_to_cpu(q->q1.data_cnt),
-            (ulong) le32_to_cpu(q->q1.sense_addr), q->q1.sense_len);
-
-    printk(
-" cdbptr 0x%lx, cdb_len %u, sg_head 0x%lx, sg_queue_cnt %u\n",
-            (ulong) q->cdbptr, q->q2.cdb_len,
-            (ulong) q->sg_head, q->q1.sg_queue_cnt);
-
-    if (q->sg_head) {
-        sgp = q->sg_head;
-        printk("ASC_SG_HEAD at addr 0x%lx\n", (ulong) sgp);
-        printk(" entry_cnt %u, queue_cnt %u\n", sgp->entry_cnt, sgp->queue_cnt);
-        for (i = 0; i < sgp->entry_cnt; i++) {
-            printk(" [%u]: addr 0x%lx, bytes %lu\n",
-                i, (ulong) le32_to_cpu(sgp->sg_list[i].addr),
-                (ulong) le32_to_cpu(sgp->sg_list[i].bytes));
-        }
+       ASC_SG_HEAD *sgp;
+       int i;
+
+       printk("ASC_SCSI_Q at addr 0x%lx\n", (ulong)q);
+
+       printk
+           (" target_ix 0x%x, target_lun %u, srb_ptr 0x%lx, tag_code 0x%x,\n",
+            q->q2.target_ix, q->q1.target_lun, (ulong)q->q2.srb_ptr,
+            q->q2.tag_code);
+
+       printk
+           (" data_addr 0x%lx, data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
+            (ulong)le32_to_cpu(q->q1.data_addr),
+            (ulong)le32_to_cpu(q->q1.data_cnt),
+            (ulong)le32_to_cpu(q->q1.sense_addr), q->q1.sense_len);
+
+       printk(" cdbptr 0x%lx, cdb_len %u, sg_head 0x%lx, sg_queue_cnt %u\n",
+              (ulong)q->cdbptr, q->q2.cdb_len,
+              (ulong)q->sg_head, q->q1.sg_queue_cnt);
+
+       if (q->sg_head) {
+               sgp = q->sg_head;
+               printk("ASC_SG_HEAD at addr 0x%lx\n", (ulong)sgp);
+               printk(" entry_cnt %u, queue_cnt %u\n", sgp->entry_cnt,
+                      sgp->queue_cnt);
+               for (i = 0; i < sgp->entry_cnt; i++) {
+                       printk(" [%u]: addr 0x%lx, bytes %lu\n",
+                              i, (ulong)le32_to_cpu(sgp->sg_list[i].addr),
+                              (ulong)le32_to_cpu(sgp->sg_list[i].bytes));
+               }
 
-    }
+       }
 }
 
 /*
  * asc_prt_asc_qdone_info()
  */
-STATIC void
-asc_prt_asc_qdone_info(ASC_QDONE_INFO *q)
+static void asc_prt_asc_qdone_info(ASC_QDONE_INFO *q)
 {
-    printk("ASC_QDONE_INFO at addr 0x%lx\n", (ulong) q);
-    printk(
-" srb_ptr 0x%lx, target_ix %u, cdb_len %u, tag_code %u,\n",
-            (ulong) q->d2.srb_ptr, q->d2.target_ix, q->d2.cdb_len,
-            q->d2.tag_code);
-    printk(
-" done_stat 0x%x, host_stat 0x%x, scsi_stat 0x%x, scsi_msg 0x%x\n",
-            q->d3.done_stat, q->d3.host_stat, q->d3.scsi_stat, q->d3.scsi_msg);
+       printk("ASC_QDONE_INFO at addr 0x%lx\n", (ulong)q);
+       printk(" srb_ptr 0x%lx, target_ix %u, cdb_len %u, tag_code %u,\n",
+              (ulong)q->d2.srb_ptr, q->d2.target_ix, q->d2.cdb_len,
+              q->d2.tag_code);
+       printk
+           (" done_stat 0x%x, host_stat 0x%x, scsi_stat 0x%x, scsi_msg 0x%x\n",
+            q->d3.done_stat, q->d3.host_stat, q->d3.scsi_stat, q->d3.scsi_msg);
 }
 
 /*
@@ -9247,41 +8034,33 @@ asc_prt_asc_qdone_info(ASC_QDONE_INFO *q)
  *
  * Display an ADV_DVC_VAR structure.
  */
-STATIC void
-asc_prt_adv_dvc_var(ADV_DVC_VAR *h)
+static void asc_prt_adv_dvc_var(ADV_DVC_VAR *h)
 {
-    printk(" ADV_DVC_VAR at addr 0x%lx\n", (ulong) h);
-
-    printk(
-"  iop_base 0x%lx, err_code 0x%x, ultra_able 0x%x\n",
-        (ulong) h->iop_base, h->err_code, (unsigned) h->ultra_able);
-
-    printk(
-"  isr_callback 0x%lx, sdtr_able 0x%x, wdtr_able 0x%x\n",
-        (ulong) h->isr_callback, (unsigned) h->sdtr_able,
-        (unsigned) h->wdtr_able);
-
-    printk(
-"  start_motor 0x%x, scsi_reset_wait 0x%x, irq_no 0x%x,\n",
-        (unsigned) h->start_motor,
-        (unsigned) h->scsi_reset_wait, (unsigned) h->irq_no);
-
-    printk(
-"  max_host_qng %u, max_dvc_qng %u, carr_freelist 0x%lxn\n",
-        (unsigned) h->max_host_qng, (unsigned) h->max_dvc_qng,
-        (ulong) h->carr_freelist);
-
-    printk(
-"  icq_sp 0x%lx, irq_sp 0x%lx\n",
-        (ulong) h->icq_sp, (ulong) h->irq_sp);
-
-    printk(
-"  no_scam 0x%x, tagqng_able 0x%x\n",
-        (unsigned) h->no_scam, (unsigned) h->tagqng_able);
-
-    printk(
-"  chip_scsi_id 0x%x, cfg 0x%lx\n",
-        (unsigned) h->chip_scsi_id, (ulong) h->cfg);
+       printk(" ADV_DVC_VAR at addr 0x%lx\n", (ulong)h);
+
+       printk("  iop_base 0x%lx, err_code 0x%x, ultra_able 0x%x\n",
+              (ulong)h->iop_base, h->err_code, (unsigned)h->ultra_able);
+
+       printk("  isr_callback 0x%lx, sdtr_able 0x%x, wdtr_able 0x%x\n",
+              (ulong)h->isr_callback, (unsigned)h->sdtr_able,
+              (unsigned)h->wdtr_able);
+
+       printk("  start_motor 0x%x, scsi_reset_wait 0x%x, irq_no 0x%x,\n",
+              (unsigned)h->start_motor,
+              (unsigned)h->scsi_reset_wait, (unsigned)h->irq_no);
+
+       printk("  max_host_qng %u, max_dvc_qng %u, carr_freelist 0x%lxn\n",
+              (unsigned)h->max_host_qng, (unsigned)h->max_dvc_qng,
+              (ulong)h->carr_freelist);
+
+       printk("  icq_sp 0x%lx, irq_sp 0x%lx\n",
+              (ulong)h->icq_sp, (ulong)h->irq_sp);
+
+       printk("  no_scam 0x%x, tagqng_able 0x%x\n",
+              (unsigned)h->no_scam, (unsigned)h->tagqng_able);
+
+       printk("  chip_scsi_id 0x%x, cfg 0x%lx\n",
+              (unsigned)h->chip_scsi_id, (ulong)h->cfg);
 }
 
 /*
@@ -9289,26 +8068,21 @@ asc_prt_adv_dvc_var(ADV_DVC_VAR *h)
  *
  * Display an ADV_DVC_CFG structure.
  */
-STATIC void
-asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h)
+static void asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h)
 {
-    printk(" ADV_DVC_CFG at addr 0x%lx\n", (ulong) h);
+       printk(" ADV_DVC_CFG at addr 0x%lx\n", (ulong)h);
 
-    printk(
-"  disc_enable 0x%x, termination 0x%x\n",
-        h->disc_enable, h->termination);
+       printk("  disc_enable 0x%x, termination 0x%x\n",
+              h->disc_enable, h->termination);
 
-    printk(
-"  chip_version 0x%x, mcode_date 0x%x\n",
-        h->chip_version, h->mcode_date);
+       printk("  chip_version 0x%x, mcode_date 0x%x\n",
+              h->chip_version, h->mcode_date);
 
-    printk(
-"  mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n",
-       h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version);
+       printk("  mcode_version 0x%x, pci_device_id 0x%x, lib_version %u\n",
+              h->mcode_version, to_pci_dev(h->dev)->device, h->lib_version);
 
-    printk(
-"  control_flag 0x%x, pci_slot_info 0x%x\n",
-       h->control_flag, h->pci_slot_info);
+       printk("  control_flag 0x%x, pci_slot_info 0x%x\n",
+              h->control_flag, h->pci_slot_info);
 }
 
 /*
@@ -9316,60 +8090,54 @@ asc_prt_adv_dvc_cfg(ADV_DVC_CFG *h)
  *
  * Display an ADV_SCSI_REQ_Q structure.
  */
-STATIC void
-asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *q)
+static void asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *q)
 {
-    int                 sg_blk_cnt;
-    struct asc_sg_block *sg_ptr;
-
-    printk("ADV_SCSI_REQ_Q at addr 0x%lx\n", (ulong) q);
-
-    printk(
-"  target_id %u, target_lun %u, srb_ptr 0x%lx, a_flag 0x%x\n",
-            q->target_id, q->target_lun, (ulong) q->srb_ptr, q->a_flag);
-
-    printk("  cntl 0x%x, data_addr 0x%lx, vdata_addr 0x%lx\n",
-            q->cntl, (ulong) le32_to_cpu(q->data_addr), (ulong) q->vdata_addr);
-
-    printk(
-"  data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
-            (ulong) le32_to_cpu(q->data_cnt),
-            (ulong) le32_to_cpu(q->sense_addr), q->sense_len);
-
-    printk(
-"  cdb_len %u, done_status 0x%x, host_status 0x%x, scsi_status 0x%x\n",
-            q->cdb_len, q->done_status, q->host_status, q->scsi_status);
-
-    printk(
-"  sg_working_ix 0x%x, target_cmd %u\n",
-            q->sg_working_ix, q->target_cmd);
-
-    printk(
-"  scsiq_rptr 0x%lx, sg_real_addr 0x%lx, sg_list_ptr 0x%lx\n",
-            (ulong) le32_to_cpu(q->scsiq_rptr),
-            (ulong) le32_to_cpu(q->sg_real_addr), (ulong) q->sg_list_ptr);
-
-    /* Display the request's ADV_SG_BLOCK structures. */
-    if (q->sg_list_ptr != NULL)
-    {
-        sg_blk_cnt = 0;
-        while (1) {
-            /*
-             * 'sg_ptr' is a physical address. Convert it to a virtual
-             * address by indexing 'sg_blk_cnt' into the virtual address
-             * array 'sg_list_ptr'.
-             *
-             * XXX - Assumes all SG physical blocks are virtually contiguous.
-             */
-            sg_ptr = &(((ADV_SG_BLOCK *) (q->sg_list_ptr))[sg_blk_cnt]);
-            asc_prt_adv_sgblock(sg_blk_cnt, sg_ptr);
-            if (sg_ptr->sg_ptr == 0)
-            {
-                break;
-            }
-            sg_blk_cnt++;
-        }
-    }
+       int sg_blk_cnt;
+       struct asc_sg_block *sg_ptr;
+
+       printk("ADV_SCSI_REQ_Q at addr 0x%lx\n", (ulong)q);
+
+       printk("  target_id %u, target_lun %u, srb_ptr 0x%lx, a_flag 0x%x\n",
+              q->target_id, q->target_lun, (ulong)q->srb_ptr, q->a_flag);
+
+       printk("  cntl 0x%x, data_addr 0x%lx, vdata_addr 0x%lx\n",
+              q->cntl, (ulong)le32_to_cpu(q->data_addr), (ulong)q->vdata_addr);
+
+       printk("  data_cnt %lu, sense_addr 0x%lx, sense_len %u,\n",
+              (ulong)le32_to_cpu(q->data_cnt),
+              (ulong)le32_to_cpu(q->sense_addr), q->sense_len);
+
+       printk
+           ("  cdb_len %u, done_status 0x%x, host_status 0x%x, scsi_status 0x%x\n",
+            q->cdb_len, q->done_status, q->host_status, q->scsi_status);
+
+       printk("  sg_working_ix 0x%x, target_cmd %u\n",
+              q->sg_working_ix, q->target_cmd);
+
+       printk("  scsiq_rptr 0x%lx, sg_real_addr 0x%lx, sg_list_ptr 0x%lx\n",
+              (ulong)le32_to_cpu(q->scsiq_rptr),
+              (ulong)le32_to_cpu(q->sg_real_addr), (ulong)q->sg_list_ptr);
+
+       /* Display the request's ADV_SG_BLOCK structures. */
+       if (q->sg_list_ptr != NULL) {
+               sg_blk_cnt = 0;
+               while (1) {
+                       /*
+                        * 'sg_ptr' is a physical address. Convert it to a virtual
+                        * address by indexing 'sg_blk_cnt' into the virtual address
+                        * array 'sg_list_ptr'.
+                        *
+                        * XXX - Assumes all SG physical blocks are virtually contiguous.
+                        */
+                       sg_ptr =
+                           &(((ADV_SG_BLOCK *)(q->sg_list_ptr))[sg_blk_cnt]);
+                       asc_prt_adv_sgblock(sg_blk_cnt, sg_ptr);
+                       if (sg_ptr->sg_ptr == 0) {
+                               break;
+                       }
+                       sg_blk_cnt++;
+               }
+       }
 }
 
 /*
@@ -9377,24 +8145,23 @@ asc_prt_adv_scsi_req_q(ADV_SCSI_REQ_Q *q)
  *
  * Display an ADV_SG_BLOCK structure.
  */
-STATIC void
-asc_prt_adv_sgblock(int sgblockno, ADV_SG_BLOCK *b)
+static void asc_prt_adv_sgblock(int sgblockno, ADV_SG_BLOCK *b)
 {
-    int i;
-
-    printk(" ASC_SG_BLOCK at addr 0x%lx (sgblockno %d)\n",
-        (ulong) b, sgblockno);
-    printk("  sg_cnt %u, sg_ptr 0x%lx\n",
-        b->sg_cnt, (ulong) le32_to_cpu(b->sg_ptr));
-    ASC_ASSERT(b->sg_cnt <= NO_OF_SG_PER_BLOCK);
-    if (b->sg_ptr != 0)
-    {
-        ASC_ASSERT(b->sg_cnt == NO_OF_SG_PER_BLOCK);
-    }
-    for (i = 0; i < b->sg_cnt; i++) {
-        printk("  [%u]: sg_addr 0x%lx, sg_count 0x%lx\n",
-            i, (ulong) b->sg_list[i].sg_addr, (ulong) b->sg_list[i].sg_count);
-    }
+       int i;
+
+       printk(" ASC_SG_BLOCK at addr 0x%lx (sgblockno %d)\n",
+              (ulong)b, sgblockno);
+       printk("  sg_cnt %u, sg_ptr 0x%lx\n",
+              b->sg_cnt, (ulong)le32_to_cpu(b->sg_ptr));
+       ASC_ASSERT(b->sg_cnt <= NO_OF_SG_PER_BLOCK);
+       if (b->sg_ptr != 0) {
+               ASC_ASSERT(b->sg_cnt == NO_OF_SG_PER_BLOCK);
+       }
+       for (i = 0; i < b->sg_cnt; i++) {
+               printk("  [%u]: sg_addr 0x%lx, sg_count 0x%lx\n",
+                      i, (ulong)b->sg_list[i].sg_addr,
+                      (ulong)b->sg_list[i].sg_count);
+       }
 }
 
 /*
@@ -9403,55 +8170,55 @@ asc_prt_adv_sgblock(int sgblockno, ADV_SG_BLOCK *b)
  * Print hexadecimal output in 4 byte groupings 32 bytes
  * or 8 double-words per line.
  */
-STATIC void
-asc_prt_hex(char *f, uchar *s, int l)
+static void asc_prt_hex(char *f, uchar *s, int l)
 {
-    int            i;
-    int            j;
-    int            k;
-    int            m;
-
-    printk("%s: (%d bytes)\n", f, l);
-
-    for (i = 0; i < l; i += 32) {
-
-        /* Display a maximum of 8 double-words per line. */
-        if ((k = (l - i) / 4) >= 8) {
-            k = 8;
-            m = 0;
-        } else {
-            m = (l - i) % 4;
-        }
-
-        for (j = 0; j < k; j++) {
-            printk(" %2.2X%2.2X%2.2X%2.2X",
-                (unsigned) s[i+(j*4)], (unsigned) s[i+(j*4)+1],
-                (unsigned) s[i+(j*4)+2], (unsigned) s[i+(j*4)+3]);
-        }
-
-        switch (m) {
-        case 0:
-        default:
-            break;
-        case 1:
-            printk(" %2.2X",
-                (unsigned) s[i+(j*4)]);
-            break;
-        case 2:
-            printk(" %2.2X%2.2X",
-                (unsigned) s[i+(j*4)],
-                (unsigned) s[i+(j*4)+1]);
-            break;
-        case 3:
-            printk(" %2.2X%2.2X%2.2X",
-                (unsigned) s[i+(j*4)+1],
-                (unsigned) s[i+(j*4)+2],
-                (unsigned) s[i+(j*4)+3]);
-            break;
-        }
-
-        printk("\n");
-    }
+       int i;
+       int j;
+       int k;
+       int m;
+
+       printk("%s: (%d bytes)\n", f, l);
+
+       for (i = 0; i < l; i += 32) {
+
+               /* Display a maximum of 8 double-words per line. */
+               if ((k = (l - i) / 4) >= 8) {
+                       k = 8;
+                       m = 0;
+               } else {
+                       m = (l - i) % 4;
+               }
+
+               for (j = 0; j < k; j++) {
+                       printk(" %2.2X%2.2X%2.2X%2.2X",
+                              (unsigned)s[i + (j * 4)],
+                              (unsigned)s[i + (j * 4) + 1],
+                              (unsigned)s[i + (j * 4) + 2],
+                              (unsigned)s[i + (j * 4) + 3]);
+               }
+
+               switch (m) {
+               case 0:
+               default:
+                       break;
+               case 1:
+                       printk(" %2.2X", (unsigned)s[i + (j * 4)]);
+                       break;
+               case 2:
+                       printk(" %2.2X%2.2X",
+                              (unsigned)s[i + (j * 4)],
+                              (unsigned)s[i + (j * 4) + 1]);
+                       break;
+               case 3:
+                       printk(" %2.2X%2.2X%2.2X",
+                              (unsigned)s[i + (j * 4) + 1],
+                              (unsigned)s[i + (j * 4) + 2],
+                              (unsigned)s[i + (j * 4) + 3]);
+                       break;
+               }
+
+               printk("\n");
+       }
 }
 #endif /* ADVANSYS_DEBUG */
 
@@ -9459,3380 +8226,3400 @@ asc_prt_hex(char *f, uchar *s, int l)
  * --- Asc Library Functions
  */
 
-STATIC ushort __init
-AscGetEisaChipCfg(
-                     PortAddr iop_base)
+static ushort __init AscGetEisaChipCfg(PortAddr iop_base)
 {
-    PortAddr            eisa_cfg_iop;
+       PortAddr eisa_cfg_iop;
 
-    eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) |
-      (PortAddr) (ASC_EISA_CFG_IOP_MASK);
-    return (inpw(eisa_cfg_iop));
+       eisa_cfg_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) |
+           (PortAddr) (ASC_EISA_CFG_IOP_MASK);
+       return (inpw(eisa_cfg_iop));
 }
 
-STATIC uchar __init
-AscSetChipScsiID(
-                    PortAddr iop_base,
-                    uchar new_host_id
-)
+static uchar __init AscSetChipScsiID(PortAddr iop_base, uchar new_host_id)
 {
-    ushort              cfg_lsw;
+       ushort cfg_lsw;
 
-    if (AscGetChipScsiID(iop_base) == new_host_id) {
-        return (new_host_id);
-    }
-    cfg_lsw = AscGetChipCfgLsw(iop_base);
-    cfg_lsw &= 0xF8FF;
-    cfg_lsw |= (ushort) ((new_host_id & ASC_MAX_TID) << 8);
-    AscSetChipCfgLsw(iop_base, cfg_lsw);
-    return (AscGetChipScsiID(iop_base));
+       if (AscGetChipScsiID(iop_base) == new_host_id) {
+               return (new_host_id);
+       }
+       cfg_lsw = AscGetChipCfgLsw(iop_base);
+       cfg_lsw &= 0xF8FF;
+       cfg_lsw |= (ushort)((new_host_id & ASC_MAX_TID) << 8);
+       AscSetChipCfgLsw(iop_base, cfg_lsw);
+       return (AscGetChipScsiID(iop_base));
 }
 
-STATIC uchar __init
-AscGetChipScsiCtrl(
-               PortAddr iop_base)
+static uchar __init AscGetChipScsiCtrl(PortAddr iop_base)
 {
-    uchar               sc;
+       uchar sc;
 
-    AscSetBank(iop_base, 1);
-    sc = inp(iop_base + IOP_REG_SC);
-    AscSetBank(iop_base, 0);
-    return (sc);
+       AscSetBank(iop_base, 1);
+       sc = inp(iop_base + IOP_REG_SC);
+       AscSetBank(iop_base, 0);
+       return (sc);
 }
 
-STATIC uchar __init
-AscGetChipVersion(
-                     PortAddr iop_base,
-                     ushort bus_type
-)
+static uchar __init AscGetChipVersion(PortAddr iop_base, ushort bus_type)
 {
-    if ((bus_type & ASC_IS_EISA) != 0) {
-        PortAddr            eisa_iop;
-        uchar               revision;
-        eisa_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) |
-          (PortAddr) ASC_EISA_REV_IOP_MASK;
-        revision = inp(eisa_iop);
-        return ((uchar) ((ASC_CHIP_MIN_VER_EISA - 1) + revision));
-    }
-    return (AscGetChipVerNo(iop_base));
+       if ((bus_type & ASC_IS_EISA) != 0) {
+               PortAddr eisa_iop;
+               uchar revision;
+               eisa_iop = (PortAddr) ASC_GET_EISA_SLOT(iop_base) |
+                   (PortAddr) ASC_EISA_REV_IOP_MASK;
+               revision = inp(eisa_iop);
+               return ((uchar)((ASC_CHIP_MIN_VER_EISA - 1) + revision));
+       }
+       return (AscGetChipVerNo(iop_base));
 }
 
-STATIC ushort __init
-AscGetChipBusType(
-                     PortAddr iop_base)
+static ushort __init AscGetChipBusType(PortAddr iop_base)
 {
-    ushort              chip_ver;
-
-    chip_ver = AscGetChipVerNo(iop_base);
-    if (
-           (chip_ver >= ASC_CHIP_MIN_VER_VL)
-           && (chip_ver <= ASC_CHIP_MAX_VER_VL)
-) {
-        if (
-               ((iop_base & 0x0C30) == 0x0C30)
-               || ((iop_base & 0x0C50) == 0x0C50)
-) {
-            return (ASC_IS_EISA);
-        }
-        return (ASC_IS_VL);
-    }
-    if ((chip_ver >= ASC_CHIP_MIN_VER_ISA) &&
-        (chip_ver <= ASC_CHIP_MAX_VER_ISA)) {
-        if (chip_ver >= ASC_CHIP_MIN_VER_ISA_PNP) {
-            return (ASC_IS_ISAPNP);
-        }
-        return (ASC_IS_ISA);
-    } else if ((chip_ver >= ASC_CHIP_MIN_VER_PCI) &&
-               (chip_ver <= ASC_CHIP_MAX_VER_PCI)) {
-        return (ASC_IS_PCI);
-    }
-    return (0);
+       ushort chip_ver;
+
+       chip_ver = AscGetChipVerNo(iop_base);
+       if ((chip_ver >= ASC_CHIP_MIN_VER_VL)
+           && (chip_ver <= ASC_CHIP_MAX_VER_VL)
+           ) {
+               if (((iop_base & 0x0C30) == 0x0C30)
+                   || ((iop_base & 0x0C50) == 0x0C50)
+                   ) {
+                       return (ASC_IS_EISA);
+               }
+               return (ASC_IS_VL);
+       }
+       if ((chip_ver >= ASC_CHIP_MIN_VER_ISA) &&
+           (chip_ver <= ASC_CHIP_MAX_VER_ISA)) {
+               if (chip_ver >= ASC_CHIP_MIN_VER_ISA_PNP) {
+                       return (ASC_IS_ISAPNP);
+               }
+               return (ASC_IS_ISA);
+       } else if ((chip_ver >= ASC_CHIP_MIN_VER_PCI) &&
+                  (chip_ver <= ASC_CHIP_MAX_VER_PCI)) {
+               return (ASC_IS_PCI);
+       }
+       return (0);
 }
 
-STATIC ASC_DCNT
-AscLoadMicroCode(
-                    PortAddr iop_base,
-                    ushort s_addr,
-                    uchar *mcode_buf,
-                    ushort mcode_size
-)
+static ASC_DCNT
+AscLoadMicroCode(PortAddr iop_base,
+                ushort s_addr, uchar *mcode_buf, ushort mcode_size)
 {
-    ASC_DCNT            chksum;
-    ushort              mcode_word_size;
-    ushort              mcode_chksum;
-
-    /* Write the microcode buffer starting at LRAM address 0. */
-    mcode_word_size = (ushort) (mcode_size >> 1);
-    AscMemWordSetLram(iop_base, s_addr, 0, mcode_word_size);
-    AscMemWordCopyPtrToLram(iop_base, s_addr, mcode_buf, mcode_word_size);
-
-    chksum = AscMemSumLramWord(iop_base, s_addr, mcode_word_size);
-    ASC_DBG1(1, "AscLoadMicroCode: chksum 0x%lx\n", (ulong) chksum);
-    mcode_chksum = (ushort) AscMemSumLramWord(iop_base,
-          (ushort) ASC_CODE_SEC_BEG,
-          (ushort) ((mcode_size - s_addr - (ushort) ASC_CODE_SEC_BEG) / 2));
-    ASC_DBG1(1, "AscLoadMicroCode: mcode_chksum 0x%lx\n",
-        (ulong) mcode_chksum);
-    AscWriteLramWord(iop_base, ASCV_MCODE_CHKSUM_W, mcode_chksum);
-    AscWriteLramWord(iop_base, ASCV_MCODE_SIZE_W, mcode_size);
-    return (chksum);
+       ASC_DCNT chksum;
+       ushort mcode_word_size;
+       ushort mcode_chksum;
+
+       /* Write the microcode buffer starting at LRAM address 0. */
+       mcode_word_size = (ushort)(mcode_size >> 1);
+       AscMemWordSetLram(iop_base, s_addr, 0, mcode_word_size);
+       AscMemWordCopyPtrToLram(iop_base, s_addr, mcode_buf, mcode_word_size);
+
+       chksum = AscMemSumLramWord(iop_base, s_addr, mcode_word_size);
+       ASC_DBG1(1, "AscLoadMicroCode: chksum 0x%lx\n", (ulong)chksum);
+       mcode_chksum = (ushort)AscMemSumLramWord(iop_base,
+                                                (ushort)ASC_CODE_SEC_BEG,
+                                                (ushort)((mcode_size -
+                                                          s_addr - (ushort)
+                                                          ASC_CODE_SEC_BEG) /
+                                                         2));
+       ASC_DBG1(1, "AscLoadMicroCode: mcode_chksum 0x%lx\n",
+                (ulong)mcode_chksum);
+       AscWriteLramWord(iop_base, ASCV_MCODE_CHKSUM_W, mcode_chksum);
+       AscWriteLramWord(iop_base, ASCV_MCODE_SIZE_W, mcode_size);
+       return (chksum);
 }
 
-STATIC int
-AscFindSignature(
-                    PortAddr iop_base
-)
+static int AscFindSignature(PortAddr iop_base)
 {
-    ushort              sig_word;
-
-    ASC_DBG2(1, "AscFindSignature: AscGetChipSignatureByte(0x%x) 0x%x\n",
-        iop_base, AscGetChipSignatureByte(iop_base));
-    if (AscGetChipSignatureByte(iop_base) == (uchar) ASC_1000_ID1B) {
-        ASC_DBG2(1, "AscFindSignature: AscGetChipSignatureWord(0x%x) 0x%x\n",
-            iop_base, AscGetChipSignatureWord(iop_base));
-        sig_word = AscGetChipSignatureWord(iop_base);
-        if ((sig_word == (ushort) ASC_1000_ID0W) ||
-            (sig_word == (ushort) ASC_1000_ID0W_FIX)) {
-            return (1);
-        }
-    }
-    return (0);
+       ushort sig_word;
+
+       ASC_DBG2(1, "AscFindSignature: AscGetChipSignatureByte(0x%x) 0x%x\n",
+                iop_base, AscGetChipSignatureByte(iop_base));
+       if (AscGetChipSignatureByte(iop_base) == (uchar)ASC_1000_ID1B) {
+               ASC_DBG2(1,
+                        "AscFindSignature: AscGetChipSignatureWord(0x%x) 0x%x\n",
+                        iop_base, AscGetChipSignatureWord(iop_base));
+               sig_word = AscGetChipSignatureWord(iop_base);
+               if ((sig_word == (ushort)ASC_1000_ID0W) ||
+                   (sig_word == (ushort)ASC_1000_ID0W_FIX)) {
+                       return (1);
+               }
+       }
+       return (0);
 }
 
-STATIC PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __initdata =
-{
-    0x100, ASC_IOADR_1, 0x120, ASC_IOADR_2, 0x140, ASC_IOADR_3, ASC_IOADR_4,
-    ASC_IOADR_5, ASC_IOADR_6, ASC_IOADR_7, ASC_IOADR_8
+static PortAddr _asc_def_iop_base[ASC_IOADR_TABLE_MAX_IX] __initdata = {
+       0x100, ASC_IOADR_1, 0x120, ASC_IOADR_2, 0x140, ASC_IOADR_3, ASC_IOADR_4,
+       ASC_IOADR_5, ASC_IOADR_6, ASC_IOADR_7, ASC_IOADR_8
 };
 
 #ifdef CONFIG_ISA
-STATIC uchar _isa_pnp_inited __initdata = 0;
+static uchar _isa_pnp_inited __initdata = 0;
 
-STATIC PortAddr __init
-AscSearchIOPortAddr(
-                       PortAddr iop_beg,
-                       ushort bus_type)
+static PortAddr __init AscSearchIOPortAddr(PortAddr iop_beg, ushort bus_type)
 {
-    if (bus_type & ASC_IS_VL) {
-        while ((iop_beg = AscSearchIOPortAddr11(iop_beg)) != 0) {
-            if (AscGetChipVersion(iop_beg, bus_type) <= ASC_CHIP_MAX_VER_VL) {
-                return (iop_beg);
-            }
-        }
-        return (0);
-    }
-    if (bus_type & ASC_IS_ISA) {
-        if (_isa_pnp_inited == 0) {
-            AscSetISAPNPWaitForKey();
-            _isa_pnp_inited++;
-        }
-        while ((iop_beg = AscSearchIOPortAddr11(iop_beg)) != 0) {
-            if ((AscGetChipVersion(iop_beg, bus_type) & ASC_CHIP_VER_ISA_BIT) != 0) {
-                return (iop_beg);
-            }
-        }
-        return (0);
-    }
-    if (bus_type & ASC_IS_EISA) {
-        if ((iop_beg = AscSearchIOPortAddrEISA(iop_beg)) != 0) {
-            return (iop_beg);
-        }
-        return (0);
-    }
-    return (0);
+       if (bus_type & ASC_IS_VL) {
+               while ((iop_beg = AscSearchIOPortAddr11(iop_beg)) != 0) {
+                       if (AscGetChipVersion(iop_beg, bus_type) <=
+                           ASC_CHIP_MAX_VER_VL) {
+                               return (iop_beg);
+                       }
+               }
+               return (0);
+       }
+       if (bus_type & ASC_IS_ISA) {
+               if (_isa_pnp_inited == 0) {
+                       AscSetISAPNPWaitForKey();
+                       _isa_pnp_inited++;
+               }
+               while ((iop_beg = AscSearchIOPortAddr11(iop_beg)) != 0) {
+                       if ((AscGetChipVersion(iop_beg, bus_type) &
+                            ASC_CHIP_VER_ISA_BIT) != 0) {
+                               return (iop_beg);
+                       }
+               }
+               return (0);
+       }
+       if (bus_type & ASC_IS_EISA) {
+               if ((iop_beg = AscSearchIOPortAddrEISA(iop_beg)) != 0) {
+                       return (iop_beg);
+               }
+               return (0);
+       }
+       return (0);
 }
 
-STATIC PortAddr __init
-AscSearchIOPortAddr11(
-                         PortAddr s_addr
-)
+static PortAddr __init AscSearchIOPortAddr11(PortAddr s_addr)
 {
-    int                 i;
-    PortAddr            iop_base;
+       int i;
+       PortAddr iop_base;
 
-    for (i = 0; i < ASC_IOADR_TABLE_MAX_IX; i++) {
-        if (_asc_def_iop_base[i] > s_addr) {
-            break;
-        }
-    }
-    for (; i < ASC_IOADR_TABLE_MAX_IX; i++) {
-        iop_base = _asc_def_iop_base[i];
-       if (!request_region(iop_base, ASC_IOADR_GAP, "advansys")){
-            ASC_DBG1(1,
-               "AscSearchIOPortAddr11: check_region() failed I/O port 0x%x\n",
-                     iop_base);
-            continue;
-        }
-        ASC_DBG1(1, "AscSearchIOPortAddr11: probing I/O port 0x%x\n", iop_base);
-       release_region(iop_base, ASC_IOADR_GAP);
-        if (AscFindSignature(iop_base)) {
-            return (iop_base);
-        }
-    }
-    return (0);
+       for (i = 0; i < ASC_IOADR_TABLE_MAX_IX; i++) {
+               if (_asc_def_iop_base[i] > s_addr) {
+                       break;
+               }
+       }
+       for (; i < ASC_IOADR_TABLE_MAX_IX; i++) {
+               iop_base = _asc_def_iop_base[i];
+               if (!request_region(iop_base, ASC_IOADR_GAP, "advansys")) {
+                       ASC_DBG1(1,
+                                "AscSearchIOPortAddr11: check_region() failed I/O port 0x%x\n",
+                                iop_base);
+                       continue;
+               }
+               ASC_DBG1(1, "AscSearchIOPortAddr11: probing I/O port 0x%x\n",
+                        iop_base);
+               release_region(iop_base, ASC_IOADR_GAP);
+               if (AscFindSignature(iop_base)) {
+                       return (iop_base);
+               }
+       }
+       return (0);
 }
 
-STATIC void __init
-AscSetISAPNPWaitForKey(void)
+static void __init AscSetISAPNPWaitForKey(void)
 {
-    outp(ASC_ISA_PNP_PORT_ADDR, 0x02);
-    outp(ASC_ISA_PNP_PORT_WRITE, 0x02);
-    return;
+       outp(ASC_ISA_PNP_PORT_ADDR, 0x02);
+       outp(ASC_ISA_PNP_PORT_WRITE, 0x02);
+       return;
 }
 #endif /* CONFIG_ISA */
 
-STATIC void __init
-AscToggleIRQAct(
-                   PortAddr iop_base
-)
+static void __init AscToggleIRQAct(PortAddr iop_base)
 {
-    AscSetChipStatus(iop_base, CIW_IRQ_ACT);
-    AscSetChipStatus(iop_base, 0);
-    return;
+       AscSetChipStatus(iop_base, CIW_IRQ_ACT);
+       AscSetChipStatus(iop_base, 0);
+       return;
 }
 
-STATIC uchar __init
-AscGetChipIRQ(
-                 PortAddr iop_base,
-                 ushort bus_type)
+static uchar __init AscGetChipIRQ(PortAddr iop_base, ushort bus_type)
 {
-    ushort              cfg_lsw;
-    uchar               chip_irq;
-
-    if ((bus_type & ASC_IS_EISA) != 0) {
-        cfg_lsw = AscGetEisaChipCfg(iop_base);
-        chip_irq = (uchar) (((cfg_lsw >> 8) & 0x07) + 10);
-        if ((chip_irq == 13) || (chip_irq > 15)) {
-            return (0);
-        }
-        return (chip_irq);
-    }
-    if ((bus_type & ASC_IS_VL) != 0) {
-        cfg_lsw = AscGetChipCfgLsw(iop_base);
-        chip_irq = (uchar) (((cfg_lsw >> 2) & 0x07));
-        if ((chip_irq == 0) ||
-            (chip_irq == 4) ||
-            (chip_irq == 7)) {
-            return (0);
-        }
-        return ((uchar) (chip_irq + (ASC_MIN_IRQ_NO - 1)));
-    }
-    cfg_lsw = AscGetChipCfgLsw(iop_base);
-    chip_irq = (uchar) (((cfg_lsw >> 2) & 0x03));
-    if (chip_irq == 3)
-        chip_irq += (uchar) 2;
-    return ((uchar) (chip_irq + ASC_MIN_IRQ_NO));
+       ushort cfg_lsw;
+       uchar chip_irq;
+
+       if ((bus_type & ASC_IS_EISA) != 0) {
+               cfg_lsw = AscGetEisaChipCfg(iop_base);
+               chip_irq = (uchar)(((cfg_lsw >> 8) & 0x07) + 10);
+               if ((chip_irq == 13) || (chip_irq > 15)) {
+                       return (0);
+               }
+               return (chip_irq);
+       }
+       if ((bus_type & ASC_IS_VL) != 0) {
+               cfg_lsw = AscGetChipCfgLsw(iop_base);
+               chip_irq = (uchar)(((cfg_lsw >> 2) & 0x07));
+               if ((chip_irq == 0) || (chip_irq == 4) || (chip_irq == 7)) {
+                       return (0);
+               }
+               return ((uchar)(chip_irq + (ASC_MIN_IRQ_NO - 1)));
+       }
+       cfg_lsw = AscGetChipCfgLsw(iop_base);
+       chip_irq = (uchar)(((cfg_lsw >> 2) & 0x03));
+       if (chip_irq == 3)
+               chip_irq += (uchar)2;
+       return ((uchar)(chip_irq + ASC_MIN_IRQ_NO));
 }
 
-STATIC uchar __init
-AscSetChipIRQ(
-                 PortAddr iop_base,
-                 uchar irq_no,
-                 ushort bus_type)
+static uchar __init
+AscSetChipIRQ(PortAddr iop_base, uchar irq_no, ushort bus_type)
 {
-    ushort              cfg_lsw;
-
-    if ((bus_type & ASC_IS_VL) != 0) {
-        if (irq_no != 0) {
-            if ((irq_no < ASC_MIN_IRQ_NO) || (irq_no > ASC_MAX_IRQ_NO)) {
-                irq_no = 0;
-            } else {
-                irq_no -= (uchar) ((ASC_MIN_IRQ_NO - 1));
-            }
-        }
-        cfg_lsw = (ushort) (AscGetChipCfgLsw(iop_base) & 0xFFE3);
-        cfg_lsw |= (ushort) 0x0010;
-        AscSetChipCfgLsw(iop_base, cfg_lsw);
-        AscToggleIRQAct(iop_base);
-        cfg_lsw = (ushort) (AscGetChipCfgLsw(iop_base) & 0xFFE0);
-        cfg_lsw |= (ushort) ((irq_no & 0x07) << 2);
-        AscSetChipCfgLsw(iop_base, cfg_lsw);
-        AscToggleIRQAct(iop_base);
-        return (AscGetChipIRQ(iop_base, bus_type));
-    }
-    if ((bus_type & (ASC_IS_ISA)) != 0) {
-        if (irq_no == 15)
-            irq_no -= (uchar) 2;
-        irq_no -= (uchar) ASC_MIN_IRQ_NO;
-        cfg_lsw = (ushort) (AscGetChipCfgLsw(iop_base) & 0xFFF3);
-        cfg_lsw |= (ushort) ((irq_no & 0x03) << 2);
-        AscSetChipCfgLsw(iop_base, cfg_lsw);
-        return (AscGetChipIRQ(iop_base, bus_type));
-    }
-    return (0);
+       ushort cfg_lsw;
+
+       if ((bus_type & ASC_IS_VL) != 0) {
+               if (irq_no != 0) {
+                       if ((irq_no < ASC_MIN_IRQ_NO)
+                           || (irq_no > ASC_MAX_IRQ_NO)) {
+                               irq_no = 0;
+                       } else {
+                               irq_no -= (uchar)((ASC_MIN_IRQ_NO - 1));
+                       }
+               }
+               cfg_lsw = (ushort)(AscGetChipCfgLsw(iop_base) & 0xFFE3);
+               cfg_lsw |= (ushort)0x0010;
+               AscSetChipCfgLsw(iop_base, cfg_lsw);
+               AscToggleIRQAct(iop_base);
+               cfg_lsw = (ushort)(AscGetChipCfgLsw(iop_base) & 0xFFE0);
+               cfg_lsw |= (ushort)((irq_no & 0x07) << 2);
+               AscSetChipCfgLsw(iop_base, cfg_lsw);
+               AscToggleIRQAct(iop_base);
+               return (AscGetChipIRQ(iop_base, bus_type));
+       }
+       if ((bus_type & (ASC_IS_ISA)) != 0) {
+               if (irq_no == 15)
+                       irq_no -= (uchar)2;
+               irq_no -= (uchar)ASC_MIN_IRQ_NO;
+               cfg_lsw = (ushort)(AscGetChipCfgLsw(iop_base) & 0xFFF3);
+               cfg_lsw |= (ushort)((irq_no & 0x03) << 2);
+               AscSetChipCfgLsw(iop_base, cfg_lsw);
+               return (AscGetChipIRQ(iop_base, bus_type));
+       }
+       return (0);
 }
 
 #ifdef CONFIG_ISA
-STATIC void __init
-AscEnableIsaDma(
-                   uchar dma_channel)
+static void __init AscEnableIsaDma(uchar dma_channel)
 {
-    if (dma_channel < 4) {
-        outp(0x000B, (ushort) (0xC0 | dma_channel));
-        outp(0x000A, dma_channel);
-    } else if (dma_channel < 8) {
-        outp(0x00D6, (ushort) (0xC0 | (dma_channel - 4)));
-        outp(0x00D4, (ushort) (dma_channel - 4));
-    }
-    return;
+       if (dma_channel < 4) {
+               outp(0x000B, (ushort)(0xC0 | dma_channel));
+               outp(0x000A, dma_channel);
+       } else if (dma_channel < 8) {
+               outp(0x00D6, (ushort)(0xC0 | (dma_channel - 4)));
+               outp(0x00D4, (ushort)(dma_channel - 4));
+       }
+       return;
 }
 #endif /* CONFIG_ISA */
 
-STATIC int
-AscIsrChipHalted(
-                    ASC_DVC_VAR *asc_dvc
-)
+static int AscIsrChipHalted(ASC_DVC_VAR *asc_dvc)
 {
-    EXT_MSG             ext_msg;
-    EXT_MSG             out_msg;
-    ushort              halt_q_addr;
-    int                 sdtr_accept;
-    ushort              int_halt_code;
-    ASC_SCSI_BIT_ID_TYPE scsi_busy;
-    ASC_SCSI_BIT_ID_TYPE target_id;
-    PortAddr            iop_base;
-    uchar               tag_code;
-    uchar               q_status;
-    uchar               halt_qp;
-    uchar               sdtr_data;
-    uchar               target_ix;
-    uchar               q_cntl, tid_no;
-    uchar               cur_dvc_qng;
-    uchar               asyn_sdtr;
-    uchar               scsi_status;
-    asc_board_t         *boardp;
-
-    ASC_ASSERT(asc_dvc->drv_ptr != NULL);
-    boardp = asc_dvc->drv_ptr;
-
-    iop_base = asc_dvc->iop_base;
-    int_halt_code = AscReadLramWord(iop_base, ASCV_HALTCODE_W);
-
-    halt_qp = AscReadLramByte(iop_base, ASCV_CURCDB_B);
-    halt_q_addr = ASC_QNO_TO_QADDR(halt_qp);
-    target_ix = AscReadLramByte(iop_base,
-                   (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_TARGET_IX));
-    q_cntl = AscReadLramByte(iop_base,
-                        (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_CNTL));
-    tid_no = ASC_TIX_TO_TID(target_ix);
-    target_id = (uchar) ASC_TID_TO_TARGET_ID(tid_no);
-    if (asc_dvc->pci_fix_asyn_xfer & target_id) {
-        asyn_sdtr = ASYN_SDTR_DATA_FIX_PCI_REV_AB;
-    } else {
-        asyn_sdtr = 0;
-    }
-    if (int_halt_code == ASC_HALT_DISABLE_ASYN_USE_SYN_FIX) {
-        if (asc_dvc->pci_fix_asyn_xfer & target_id) {
-            AscSetChipSDTR(iop_base, 0, tid_no);
-            boardp->sdtr_data[tid_no] = 0;
-        }
-        AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-        return (0);
-    } else if (int_halt_code == ASC_HALT_ENABLE_ASYN_USE_SYN_FIX) {
-        if (asc_dvc->pci_fix_asyn_xfer & target_id) {
-            AscSetChipSDTR(iop_base, asyn_sdtr, tid_no);
-            boardp->sdtr_data[tid_no] = asyn_sdtr;
-        }
-        AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-        return (0);
-    } else if (int_halt_code == ASC_HALT_EXTMSG_IN) {
-
-        AscMemWordCopyPtrFromLram(iop_base,
-                               ASCV_MSGIN_BEG,
-                               (uchar *) &ext_msg,
-                               sizeof(EXT_MSG) >> 1);
-
-        if (ext_msg.msg_type == MS_EXTEND &&
-            ext_msg.msg_req == MS_SDTR_CODE &&
-            ext_msg.msg_len == MS_SDTR_LEN) {
-            sdtr_accept = TRUE;
-            if ((ext_msg.req_ack_offset > ASC_SYN_MAX_OFFSET)) {
-
-                sdtr_accept = FALSE;
-                ext_msg.req_ack_offset = ASC_SYN_MAX_OFFSET;
-            }
-            if ((ext_msg.xfer_period <
-                 asc_dvc->sdtr_period_tbl[asc_dvc->host_init_sdtr_index]) ||
-                (ext_msg.xfer_period >
-                 asc_dvc->sdtr_period_tbl[asc_dvc->max_sdtr_index])) {
-                sdtr_accept = FALSE;
-                ext_msg.xfer_period =
-                    asc_dvc->sdtr_period_tbl[asc_dvc->host_init_sdtr_index];
-            }
-            if (sdtr_accept) {
-                sdtr_data = AscCalSDTRData(asc_dvc, ext_msg.xfer_period,
-                                           ext_msg.req_ack_offset);
-                if ((sdtr_data == 0xFF)) {
-
-                    q_cntl |= QC_MSG_OUT;
-                    asc_dvc->init_sdtr &= ~target_id;
-                    asc_dvc->sdtr_done &= ~target_id;
-                    AscSetChipSDTR(iop_base, asyn_sdtr, tid_no);
-                    boardp->sdtr_data[tid_no] = asyn_sdtr;
-                }
-            }
-            if (ext_msg.req_ack_offset == 0) {
-
-                q_cntl &= ~QC_MSG_OUT;
-                asc_dvc->init_sdtr &= ~target_id;
-                asc_dvc->sdtr_done &= ~target_id;
-                AscSetChipSDTR(iop_base, asyn_sdtr, tid_no);
-            } else {
-                if (sdtr_accept && (q_cntl & QC_MSG_OUT)) {
-
-                    q_cntl &= ~QC_MSG_OUT;
-                    asc_dvc->sdtr_done |= target_id;
-                    asc_dvc->init_sdtr |= target_id;
-                    asc_dvc->pci_fix_asyn_xfer &= ~target_id;
-                    sdtr_data = AscCalSDTRData(asc_dvc, ext_msg.xfer_period,
-                                               ext_msg.req_ack_offset);
-                    AscSetChipSDTR(iop_base, sdtr_data, tid_no);
-                    boardp->sdtr_data[tid_no] = sdtr_data;
-                } else {
-
-                    q_cntl |= QC_MSG_OUT;
-                    AscMsgOutSDTR(asc_dvc,
-                                  ext_msg.xfer_period,
-                                  ext_msg.req_ack_offset);
-                    asc_dvc->pci_fix_asyn_xfer &= ~target_id;
-                    sdtr_data = AscCalSDTRData(asc_dvc, ext_msg.xfer_period,
-                                               ext_msg.req_ack_offset);
-                    AscSetChipSDTR(iop_base, sdtr_data, tid_no);
-                    boardp->sdtr_data[tid_no] = sdtr_data;
-                    asc_dvc->sdtr_done |= target_id;
-                    asc_dvc->init_sdtr |= target_id;
-                }
-            }
-
-            AscWriteLramByte(iop_base,
-                         (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_CNTL),
-                             q_cntl);
-            AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-            return (0);
-        } else if (ext_msg.msg_type == MS_EXTEND &&
-                   ext_msg.msg_req == MS_WDTR_CODE &&
-                   ext_msg.msg_len == MS_WDTR_LEN) {
-
-            ext_msg.wdtr_width = 0;
-            AscMemWordCopyPtrToLram(iop_base,
-                                 ASCV_MSGOUT_BEG,
-                                 (uchar *) &ext_msg,
-                                 sizeof(EXT_MSG) >> 1);
-            q_cntl |= QC_MSG_OUT;
-            AscWriteLramByte(iop_base,
-                         (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_CNTL),
-                             q_cntl);
-            AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-            return (0);
-        } else {
-
-            ext_msg.msg_type = MESSAGE_REJECT;
-            AscMemWordCopyPtrToLram(iop_base,
-                                 ASCV_MSGOUT_BEG,
-                                 (uchar *) &ext_msg,
-                                 sizeof(EXT_MSG) >> 1);
-            q_cntl |= QC_MSG_OUT;
-            AscWriteLramByte(iop_base,
-                         (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_CNTL),
-                             q_cntl);
-            AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-            return (0);
-        }
-    } else if (int_halt_code == ASC_HALT_CHK_CONDITION) {
-
-        q_cntl |= QC_REQ_SENSE;
-
-        if ((asc_dvc->init_sdtr & target_id) != 0) {
-
-            asc_dvc->sdtr_done &= ~target_id;
-
-            sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no);
-            q_cntl |= QC_MSG_OUT;
-            AscMsgOutSDTR(asc_dvc,
-                          asc_dvc->sdtr_period_tbl[(sdtr_data >> 4) &
-                           (uchar) (asc_dvc->max_sdtr_index - 1)],
-                          (uchar) (sdtr_data & (uchar) ASC_SYN_MAX_OFFSET));
-        }
-
-        AscWriteLramByte(iop_base,
-                         (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_CNTL),
-                         q_cntl);
-
-        tag_code = AscReadLramByte(iop_base,
-                    (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_TAG_CODE));
-        tag_code &= 0xDC;
-        if (
-               (asc_dvc->pci_fix_asyn_xfer & target_id)
-               && !(asc_dvc->pci_fix_asyn_xfer_always & target_id)
-) {
-
-            tag_code |= (ASC_TAG_FLAG_DISABLE_DISCONNECT
-                         | ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX);
-
-        }
-        AscWriteLramByte(iop_base,
-                     (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_TAG_CODE),
-                         tag_code);
-
-        q_status = AscReadLramByte(iop_base,
-                      (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_STATUS));
-        q_status |= (QS_READY | QS_BUSY);
-        AscWriteLramByte(iop_base,
-                       (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_STATUS),
-                         q_status);
-
-        scsi_busy = AscReadLramByte(iop_base,
-                                    (ushort) ASCV_SCSIBUSY_B);
-        scsi_busy &= ~target_id;
-        AscWriteLramByte(iop_base, (ushort) ASCV_SCSIBUSY_B, scsi_busy);
-
-        AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-        return (0);
-    } else if (int_halt_code == ASC_HALT_SDTR_REJECTED) {
-
-        AscMemWordCopyPtrFromLram(iop_base,
-                               ASCV_MSGOUT_BEG,
-                               (uchar *) &out_msg,
-                               sizeof(EXT_MSG) >> 1);
-
-        if ((out_msg.msg_type == MS_EXTEND) &&
-            (out_msg.msg_len == MS_SDTR_LEN) &&
-            (out_msg.msg_req == MS_SDTR_CODE)) {
-
-            asc_dvc->init_sdtr &= ~target_id;
-            asc_dvc->sdtr_done &= ~target_id;
-            AscSetChipSDTR(iop_base, asyn_sdtr, tid_no);
-            boardp->sdtr_data[tid_no] = asyn_sdtr;
-        }
-        q_cntl &= ~QC_MSG_OUT;
-        AscWriteLramByte(iop_base,
-                         (ushort) (halt_q_addr + (ushort) ASC_SCSIQ_B_CNTL),
-                         q_cntl);
-        AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-        return (0);
-    } else if (int_halt_code == ASC_HALT_SS_QUEUE_FULL) {
-
-        scsi_status = AscReadLramByte(iop_base,
-          (ushort) ((ushort) halt_q_addr + (ushort) ASC_SCSIQ_SCSI_STATUS));
-        cur_dvc_qng = AscReadLramByte(iop_base,
-                     (ushort) ((ushort) ASC_QADR_BEG + (ushort) target_ix));
-        if ((cur_dvc_qng > 0) &&
-            (asc_dvc->cur_dvc_qng[tid_no] > 0)) {
-
-            scsi_busy = AscReadLramByte(iop_base,
-                                        (ushort) ASCV_SCSIBUSY_B);
-            scsi_busy |= target_id;
-            AscWriteLramByte(iop_base,
-                             (ushort) ASCV_SCSIBUSY_B, scsi_busy);
-            asc_dvc->queue_full_or_busy |= target_id;
-
-            if (scsi_status == SAM_STAT_TASK_SET_FULL) {
-                if (cur_dvc_qng > ASC_MIN_TAGGED_CMD) {
-                    cur_dvc_qng -= 1;
-                    asc_dvc->max_dvc_qng[tid_no] = cur_dvc_qng;
-
-                    AscWriteLramByte(iop_base,
-                          (ushort) ((ushort) ASCV_MAX_DVC_QNG_BEG +
-                           (ushort) tid_no),
-                          cur_dvc_qng);
-
-                    /*
-                     * Set the device queue depth to the number of
-                     * active requests when the QUEUE FULL condition
-                     * was encountered.
-                     */
-                    boardp->queue_full |= target_id;
-                    boardp->queue_full_cnt[tid_no] = cur_dvc_qng;
-                }
-            }
-        }
-        AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-        return (0);
-    }
+       EXT_MSG ext_msg;
+       EXT_MSG out_msg;
+       ushort halt_q_addr;
+       int sdtr_accept;
+       ushort int_halt_code;
+       ASC_SCSI_BIT_ID_TYPE scsi_busy;
+       ASC_SCSI_BIT_ID_TYPE target_id;
+       PortAddr iop_base;
+       uchar tag_code;
+       uchar q_status;
+       uchar halt_qp;
+       uchar sdtr_data;
+       uchar target_ix;
+       uchar q_cntl, tid_no;
+       uchar cur_dvc_qng;
+       uchar asyn_sdtr;
+       uchar scsi_status;
+       asc_board_t *boardp;
+
+       ASC_ASSERT(asc_dvc->drv_ptr != NULL);
+       boardp = asc_dvc->drv_ptr;
+
+       iop_base = asc_dvc->iop_base;
+       int_halt_code = AscReadLramWord(iop_base, ASCV_HALTCODE_W);
+
+       halt_qp = AscReadLramByte(iop_base, ASCV_CURCDB_B);
+       halt_q_addr = ASC_QNO_TO_QADDR(halt_qp);
+       target_ix = AscReadLramByte(iop_base,
+                                   (ushort)(halt_q_addr +
+                                            (ushort)ASC_SCSIQ_B_TARGET_IX));
+       q_cntl =
+           AscReadLramByte(iop_base,
+                           (ushort)(halt_q_addr + (ushort)ASC_SCSIQ_B_CNTL));
+       tid_no = ASC_TIX_TO_TID(target_ix);
+       target_id = (uchar)ASC_TID_TO_TARGET_ID(tid_no);
+       if (asc_dvc->pci_fix_asyn_xfer & target_id) {
+               asyn_sdtr = ASYN_SDTR_DATA_FIX_PCI_REV_AB;
+       } else {
+               asyn_sdtr = 0;
+       }
+       if (int_halt_code == ASC_HALT_DISABLE_ASYN_USE_SYN_FIX) {
+               if (asc_dvc->pci_fix_asyn_xfer & target_id) {
+                       AscSetChipSDTR(iop_base, 0, tid_no);
+                       boardp->sdtr_data[tid_no] = 0;
+               }
+               AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+               return (0);
+       } else if (int_halt_code == ASC_HALT_ENABLE_ASYN_USE_SYN_FIX) {
+               if (asc_dvc->pci_fix_asyn_xfer & target_id) {
+                       AscSetChipSDTR(iop_base, asyn_sdtr, tid_no);
+                       boardp->sdtr_data[tid_no] = asyn_sdtr;
+               }
+               AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+               return (0);
+       } else if (int_halt_code == ASC_HALT_EXTMSG_IN) {
+
+               AscMemWordCopyPtrFromLram(iop_base,
+                                         ASCV_MSGIN_BEG,
+                                         (uchar *)&ext_msg,
+                                         sizeof(EXT_MSG) >> 1);
+
+               if (ext_msg.msg_type == MS_EXTEND &&
+                   ext_msg.msg_req == MS_SDTR_CODE &&
+                   ext_msg.msg_len == MS_SDTR_LEN) {
+                       sdtr_accept = TRUE;
+                       if ((ext_msg.req_ack_offset > ASC_SYN_MAX_OFFSET)) {
+
+                               sdtr_accept = FALSE;
+                               ext_msg.req_ack_offset = ASC_SYN_MAX_OFFSET;
+                       }
+                       if ((ext_msg.xfer_period <
+                            asc_dvc->sdtr_period_tbl[asc_dvc->
+                                                     host_init_sdtr_index])
+                           || (ext_msg.xfer_period >
+                               asc_dvc->sdtr_period_tbl[asc_dvc->
+                                                        max_sdtr_index])) {
+                               sdtr_accept = FALSE;
+                               ext_msg.xfer_period =
+                                   asc_dvc->sdtr_period_tbl[asc_dvc->
+                                                            host_init_sdtr_index];
+                       }
+                       if (sdtr_accept) {
+                               sdtr_data =
+                                   AscCalSDTRData(asc_dvc, ext_msg.xfer_period,
+                                                  ext_msg.req_ack_offset);
+                               if ((sdtr_data == 0xFF)) {
+
+                                       q_cntl |= QC_MSG_OUT;
+                                       asc_dvc->init_sdtr &= ~target_id;
+                                       asc_dvc->sdtr_done &= ~target_id;
+                                       AscSetChipSDTR(iop_base, asyn_sdtr,
+                                                      tid_no);
+                                       boardp->sdtr_data[tid_no] = asyn_sdtr;
+                               }
+                       }
+                       if (ext_msg.req_ack_offset == 0) {
+
+                               q_cntl &= ~QC_MSG_OUT;
+                               asc_dvc->init_sdtr &= ~target_id;
+                               asc_dvc->sdtr_done &= ~target_id;
+                               AscSetChipSDTR(iop_base, asyn_sdtr, tid_no);
+                       } else {
+                               if (sdtr_accept && (q_cntl & QC_MSG_OUT)) {
+
+                                       q_cntl &= ~QC_MSG_OUT;
+                                       asc_dvc->sdtr_done |= target_id;
+                                       asc_dvc->init_sdtr |= target_id;
+                                       asc_dvc->pci_fix_asyn_xfer &=
+                                           ~target_id;
+                                       sdtr_data =
+                                           AscCalSDTRData(asc_dvc,
+                                                          ext_msg.xfer_period,
+                                                          ext_msg.
+                                                          req_ack_offset);
+                                       AscSetChipSDTR(iop_base, sdtr_data,
+                                                      tid_no);
+                                       boardp->sdtr_data[tid_no] = sdtr_data;
+                               } else {
+
+                                       q_cntl |= QC_MSG_OUT;
+                                       AscMsgOutSDTR(asc_dvc,
+                                                     ext_msg.xfer_period,
+                                                     ext_msg.req_ack_offset);
+                                       asc_dvc->pci_fix_asyn_xfer &=
+                                           ~target_id;
+                                       sdtr_data =
+                                           AscCalSDTRData(asc_dvc,
+                                                          ext_msg.xfer_period,
+                                                          ext_msg.
+                                                          req_ack_offset);
+                                       AscSetChipSDTR(iop_base, sdtr_data,
+                                                      tid_no);
+                                       boardp->sdtr_data[tid_no] = sdtr_data;
+                                       asc_dvc->sdtr_done |= target_id;
+                                       asc_dvc->init_sdtr |= target_id;
+                               }
+                       }
+
+                       AscWriteLramByte(iop_base,
+                                        (ushort)(halt_q_addr +
+                                                 (ushort)ASC_SCSIQ_B_CNTL),
+                                        q_cntl);
+                       AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+                       return (0);
+               } else if (ext_msg.msg_type == MS_EXTEND &&
+                          ext_msg.msg_req == MS_WDTR_CODE &&
+                          ext_msg.msg_len == MS_WDTR_LEN) {
+
+                       ext_msg.wdtr_width = 0;
+                       AscMemWordCopyPtrToLram(iop_base,
+                                               ASCV_MSGOUT_BEG,
+                                               (uchar *)&ext_msg,
+                                               sizeof(EXT_MSG) >> 1);
+                       q_cntl |= QC_MSG_OUT;
+                       AscWriteLramByte(iop_base,
+                                        (ushort)(halt_q_addr +
+                                                 (ushort)ASC_SCSIQ_B_CNTL),
+                                        q_cntl);
+                       AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+                       return (0);
+               } else {
+
+                       ext_msg.msg_type = MESSAGE_REJECT;
+                       AscMemWordCopyPtrToLram(iop_base,
+                                               ASCV_MSGOUT_BEG,
+                                               (uchar *)&ext_msg,
+                                               sizeof(EXT_MSG) >> 1);
+                       q_cntl |= QC_MSG_OUT;
+                       AscWriteLramByte(iop_base,
+                                        (ushort)(halt_q_addr +
+                                                 (ushort)ASC_SCSIQ_B_CNTL),
+                                        q_cntl);
+                       AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+                       return (0);
+               }
+       } else if (int_halt_code == ASC_HALT_CHK_CONDITION) {
+
+               q_cntl |= QC_REQ_SENSE;
+
+               if ((asc_dvc->init_sdtr & target_id) != 0) {
+
+                       asc_dvc->sdtr_done &= ~target_id;
+
+                       sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no);
+                       q_cntl |= QC_MSG_OUT;
+                       AscMsgOutSDTR(asc_dvc,
+                                     asc_dvc->
+                                     sdtr_period_tbl[(sdtr_data >> 4) &
+                                                     (uchar)(asc_dvc->
+                                                             max_sdtr_index -
+                                                             1)],
+                                     (uchar)(sdtr_data & (uchar)
+                                             ASC_SYN_MAX_OFFSET));
+               }
+
+               AscWriteLramByte(iop_base,
+                                (ushort)(halt_q_addr +
+                                         (ushort)ASC_SCSIQ_B_CNTL), q_cntl);
+
+               tag_code = AscReadLramByte(iop_base,
+                                          (ushort)(halt_q_addr + (ushort)
+                                                   ASC_SCSIQ_B_TAG_CODE));
+               tag_code &= 0xDC;
+               if ((asc_dvc->pci_fix_asyn_xfer & target_id)
+                   && !(asc_dvc->pci_fix_asyn_xfer_always & target_id)
+                   ) {
+
+                       tag_code |= (ASC_TAG_FLAG_DISABLE_DISCONNECT
+                                    | ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX);
+
+               }
+               AscWriteLramByte(iop_base,
+                                (ushort)(halt_q_addr +
+                                         (ushort)ASC_SCSIQ_B_TAG_CODE),
+                                tag_code);
+
+               q_status = AscReadLramByte(iop_base,
+                                          (ushort)(halt_q_addr + (ushort)
+                                                   ASC_SCSIQ_B_STATUS));
+               q_status |= (QS_READY | QS_BUSY);
+               AscWriteLramByte(iop_base,
+                                (ushort)(halt_q_addr +
+                                         (ushort)ASC_SCSIQ_B_STATUS),
+                                q_status);
+
+               scsi_busy = AscReadLramByte(iop_base, (ushort)ASCV_SCSIBUSY_B);
+               scsi_busy &= ~target_id;
+               AscWriteLramByte(iop_base, (ushort)ASCV_SCSIBUSY_B, scsi_busy);
+
+               AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+               return (0);
+       } else if (int_halt_code == ASC_HALT_SDTR_REJECTED) {
+
+               AscMemWordCopyPtrFromLram(iop_base,
+                                         ASCV_MSGOUT_BEG,
+                                         (uchar *)&out_msg,
+                                         sizeof(EXT_MSG) >> 1);
+
+               if ((out_msg.msg_type == MS_EXTEND) &&
+                   (out_msg.msg_len == MS_SDTR_LEN) &&
+                   (out_msg.msg_req == MS_SDTR_CODE)) {
+
+                       asc_dvc->init_sdtr &= ~target_id;
+                       asc_dvc->sdtr_done &= ~target_id;
+                       AscSetChipSDTR(iop_base, asyn_sdtr, tid_no);
+                       boardp->sdtr_data[tid_no] = asyn_sdtr;
+               }
+               q_cntl &= ~QC_MSG_OUT;
+               AscWriteLramByte(iop_base,
+                                (ushort)(halt_q_addr +
+                                         (ushort)ASC_SCSIQ_B_CNTL), q_cntl);
+               AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+               return (0);
+       } else if (int_halt_code == ASC_HALT_SS_QUEUE_FULL) {
+
+               scsi_status = AscReadLramByte(iop_base,
+                                             (ushort)((ushort)halt_q_addr +
+                                                      (ushort)
+                                                      ASC_SCSIQ_SCSI_STATUS));
+               cur_dvc_qng =
+                   AscReadLramByte(iop_base,
+                                   (ushort)((ushort)ASC_QADR_BEG +
+                                            (ushort)target_ix));
+               if ((cur_dvc_qng > 0) && (asc_dvc->cur_dvc_qng[tid_no] > 0)) {
+
+                       scsi_busy = AscReadLramByte(iop_base,
+                                                   (ushort)ASCV_SCSIBUSY_B);
+                       scsi_busy |= target_id;
+                       AscWriteLramByte(iop_base,
+                                        (ushort)ASCV_SCSIBUSY_B, scsi_busy);
+                       asc_dvc->queue_full_or_busy |= target_id;
+
+                       if (scsi_status == SAM_STAT_TASK_SET_FULL) {
+                               if (cur_dvc_qng > ASC_MIN_TAGGED_CMD) {
+                                       cur_dvc_qng -= 1;
+                                       asc_dvc->max_dvc_qng[tid_no] =
+                                           cur_dvc_qng;
+
+                                       AscWriteLramByte(iop_base,
+                                                        (ushort)((ushort)
+                                                                 ASCV_MAX_DVC_QNG_BEG
+                                                                 + (ushort)
+                                                                 tid_no),
+                                                        cur_dvc_qng);
+
+                                       /*
+                                        * Set the device queue depth to the number of
+                                        * active requests when the QUEUE FULL condition
+                                        * was encountered.
+                                        */
+                                       boardp->queue_full |= target_id;
+                                       boardp->queue_full_cnt[tid_no] =
+                                           cur_dvc_qng;
+                               }
+                       }
+               }
+               AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+               return (0);
+       }
 #if CC_VERY_LONG_SG_LIST
-    else if (int_halt_code == ASC_HALT_HOST_COPY_SG_LIST_TO_RISC)
-    {
-        uchar              q_no;
-        ushort             q_addr;
-        uchar              sg_wk_q_no;
-        uchar              first_sg_wk_q_no;
-        ASC_SCSI_Q         *scsiq; /* Ptr to driver request. */
-        ASC_SG_HEAD        *sg_head; /* Ptr to driver SG request. */
-        ASC_SG_LIST_Q      scsi_sg_q; /* Structure written to queue. */
-        ushort             sg_list_dwords;
-        ushort             sg_entry_cnt;
-        uchar              next_qp;
-        int                i;
-
-        q_no = AscReadLramByte(iop_base, (ushort) ASCV_REQ_SG_LIST_QP);
-        if (q_no == ASC_QLINK_END)
-        {
-            return(0);
-        }
-
-        q_addr = ASC_QNO_TO_QADDR(q_no);
-
-        /*
-         * Convert the request's SRB pointer to a host ASC_SCSI_REQ
-         * structure pointer using a macro provided by the driver.
-         * The ASC_SCSI_REQ pointer provides a pointer to the
-         * host ASC_SG_HEAD structure.
-         */
-        /* Read request's SRB pointer. */
-        scsiq = (ASC_SCSI_Q *)
-           ASC_SRB2SCSIQ(
-               ASC_U32_TO_VADDR(AscReadLramDWord(iop_base,
-               (ushort) (q_addr + ASC_SCSIQ_D_SRBPTR))));
-
-        /*
-         * Get request's first and working SG queue.
-         */
-        sg_wk_q_no = AscReadLramByte(iop_base,
-            (ushort) (q_addr + ASC_SCSIQ_B_SG_WK_QP));
-
-        first_sg_wk_q_no = AscReadLramByte(iop_base,
-            (ushort) (q_addr + ASC_SCSIQ_B_FIRST_SG_WK_QP));
-
-        /*
-         * Reset request's working SG queue back to the
-         * first SG queue.
-         */
-        AscWriteLramByte(iop_base,
-            (ushort) (q_addr + (ushort) ASC_SCSIQ_B_SG_WK_QP),
-            first_sg_wk_q_no);
-
-        sg_head = scsiq->sg_head;
-
-        /*
-         * Set sg_entry_cnt to the number of SG elements
-         * that will be completed on this interrupt.
-         *
-         * Note: The allocated SG queues contain ASC_MAX_SG_LIST - 1
-         * SG elements. The data_cnt and data_addr fields which
-         * add 1 to the SG element capacity are not used when
-         * restarting SG handling after a halt.
-         */
-        if (scsiq->remain_sg_entry_cnt > (ASC_MAX_SG_LIST - 1))
-        {
-             sg_entry_cnt = ASC_MAX_SG_LIST - 1;
-
-             /*
-              * Keep track of remaining number of SG elements that will
-              * need to be handled on the next interrupt.
-              */
-             scsiq->remain_sg_entry_cnt -= (ASC_MAX_SG_LIST - 1);
-        } else
-        {
-             sg_entry_cnt = scsiq->remain_sg_entry_cnt;
-             scsiq->remain_sg_entry_cnt = 0;
-        }
-
-        /*
-         * Copy SG elements into the list of allocated SG queues.
-         *
-         * Last index completed is saved in scsiq->next_sg_index.
-         */
-        next_qp = first_sg_wk_q_no;
-        q_addr = ASC_QNO_TO_QADDR(next_qp);
-        scsi_sg_q.sg_head_qp = q_no;
-        scsi_sg_q.cntl = QCSG_SG_XFER_LIST;
-        for( i = 0; i < sg_head->queue_cnt; i++)
-        {
-             scsi_sg_q.seq_no = i + 1;
-             if (sg_entry_cnt > ASC_SG_LIST_PER_Q)
-             {
-                 sg_list_dwords = (uchar) (ASC_SG_LIST_PER_Q * 2);
-                 sg_entry_cnt -= ASC_SG_LIST_PER_Q;
-                 /*
-                  * After very first SG queue RISC FW uses next
-                  * SG queue first element then checks sg_list_cnt
-                  * against zero and then decrements, so set
-                  * sg_list_cnt 1 less than number of SG elements
-                  * in each SG queue.
-                  */
-                 scsi_sg_q.sg_list_cnt = ASC_SG_LIST_PER_Q - 1;
-                 scsi_sg_q.sg_cur_list_cnt = ASC_SG_LIST_PER_Q - 1;
-             } else {
-                 /*
-                  * This is the last SG queue in the list of
-                  * allocated SG queues. If there are more
-                  * SG elements than will fit in the allocated
-                  * queues, then set the QCSG_SG_XFER_MORE flag.
-                  */
-                 if (scsiq->remain_sg_entry_cnt != 0)
-                 {
-                     scsi_sg_q.cntl |= QCSG_SG_XFER_MORE;
-                 } else
-                 {
-                     scsi_sg_q.cntl |= QCSG_SG_XFER_END;
-                 }
-                 /* equals sg_entry_cnt * 2 */
-                 sg_list_dwords = sg_entry_cnt << 1;
-                 scsi_sg_q.sg_list_cnt = sg_entry_cnt - 1;
-                 scsi_sg_q.sg_cur_list_cnt = sg_entry_cnt - 1;
-                 sg_entry_cnt = 0;
-             }
-
-             scsi_sg_q.q_no = next_qp;
-             AscMemWordCopyPtrToLram(iop_base,
-                          q_addr + ASC_SCSIQ_SGHD_CPY_BEG,
-                          (uchar *) &scsi_sg_q,
-                          sizeof(ASC_SG_LIST_Q) >> 1);
-
-             AscMemDWordCopyPtrToLram(iop_base,
-                          q_addr + ASC_SGQ_LIST_BEG,
-                          (uchar *) &sg_head->sg_list[scsiq->next_sg_index],
-                          sg_list_dwords);
-
-             scsiq->next_sg_index += ASC_SG_LIST_PER_Q;
-
-             /*
-              * If the just completed SG queue contained the
-              * last SG element, then no more SG queues need
-              * to be written.
-              */
-             if (scsi_sg_q.cntl & QCSG_SG_XFER_END)
-             {
-                 break;
-             }
-
-             next_qp = AscReadLramByte( iop_base,
-                          ( ushort )( q_addr+ASC_SCSIQ_B_FWD ) );
-             q_addr = ASC_QNO_TO_QADDR( next_qp );
-        }
-
-        /*
-         * Clear the halt condition so the RISC will be restarted
-         * after the return.
-         */
-        AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-        return(0);
-    }
+       else if (int_halt_code == ASC_HALT_HOST_COPY_SG_LIST_TO_RISC) {
+               uchar q_no;
+               ushort q_addr;
+               uchar sg_wk_q_no;
+               uchar first_sg_wk_q_no;
+               ASC_SCSI_Q *scsiq;      /* Ptr to driver request. */
+               ASC_SG_HEAD *sg_head;   /* Ptr to driver SG request. */
+               ASC_SG_LIST_Q scsi_sg_q;        /* Structure written to queue. */
+               ushort sg_list_dwords;
+               ushort sg_entry_cnt;
+               uchar next_qp;
+               int i;
+
+               q_no = AscReadLramByte(iop_base, (ushort)ASCV_REQ_SG_LIST_QP);
+               if (q_no == ASC_QLINK_END) {
+                       return (0);
+               }
+
+               q_addr = ASC_QNO_TO_QADDR(q_no);
+
+               /*
+                * Convert the request's SRB pointer to a host ASC_SCSI_REQ
+                * structure pointer using a macro provided by the driver.
+                * The ASC_SCSI_REQ pointer provides a pointer to the
+                * host ASC_SG_HEAD structure.
+                */
+               /* Read request's SRB pointer. */
+               scsiq = (ASC_SCSI_Q *)
+                   ASC_SRB2SCSIQ(ASC_U32_TO_VADDR(AscReadLramDWord(iop_base,
+                                                                   (ushort)
+                                                                   (q_addr +
+                                                                    ASC_SCSIQ_D_SRBPTR))));
+
+               /*
+                * Get request's first and working SG queue.
+                */
+               sg_wk_q_no = AscReadLramByte(iop_base,
+                                            (ushort)(q_addr +
+                                                     ASC_SCSIQ_B_SG_WK_QP));
+
+               first_sg_wk_q_no = AscReadLramByte(iop_base,
+                                                  (ushort)(q_addr +
+                                                           ASC_SCSIQ_B_FIRST_SG_WK_QP));
+
+               /*
+                * Reset request's working SG queue back to the
+                * first SG queue.
+                */
+               AscWriteLramByte(iop_base,
+                                (ushort)(q_addr +
+                                         (ushort)ASC_SCSIQ_B_SG_WK_QP),
+                                first_sg_wk_q_no);
+
+               sg_head = scsiq->sg_head;
+
+               /*
+                * Set sg_entry_cnt to the number of SG elements
+                * that will be completed on this interrupt.
+                *
+                * Note: The allocated SG queues contain ASC_MAX_SG_LIST - 1
+                * SG elements. The data_cnt and data_addr fields which
+                * add 1 to the SG element capacity are not used when
+                * restarting SG handling after a halt.
+                */
+               if (scsiq->remain_sg_entry_cnt > (ASC_MAX_SG_LIST - 1)) {
+                       sg_entry_cnt = ASC_MAX_SG_LIST - 1;
+
+                       /*
+                        * Keep track of remaining number of SG elements that will
+                        * need to be handled on the next interrupt.
+                        */
+                       scsiq->remain_sg_entry_cnt -= (ASC_MAX_SG_LIST - 1);
+               } else {
+                       sg_entry_cnt = scsiq->remain_sg_entry_cnt;
+                       scsiq->remain_sg_entry_cnt = 0;
+               }
+
+               /*
+                * Copy SG elements into the list of allocated SG queues.
+                *
+                * Last index completed is saved in scsiq->next_sg_index.
+                */
+               next_qp = first_sg_wk_q_no;
+               q_addr = ASC_QNO_TO_QADDR(next_qp);
+               scsi_sg_q.sg_head_qp = q_no;
+               scsi_sg_q.cntl = QCSG_SG_XFER_LIST;
+               for (i = 0; i < sg_head->queue_cnt; i++) {
+                       scsi_sg_q.seq_no = i + 1;
+                       if (sg_entry_cnt > ASC_SG_LIST_PER_Q) {
+                               sg_list_dwords = (uchar)(ASC_SG_LIST_PER_Q * 2);
+                               sg_entry_cnt -= ASC_SG_LIST_PER_Q;
+                               /*
+                                * After very first SG queue RISC FW uses next
+                                * SG queue first element then checks sg_list_cnt
+                                * against zero and then decrements, so set
+                                * sg_list_cnt 1 less than number of SG elements
+                                * in each SG queue.
+                                */
+                               scsi_sg_q.sg_list_cnt = ASC_SG_LIST_PER_Q - 1;
+                               scsi_sg_q.sg_cur_list_cnt =
+                                   ASC_SG_LIST_PER_Q - 1;
+                       } else {
+                               /*
+                                * This is the last SG queue in the list of
+                                * allocated SG queues. If there are more
+                                * SG elements than will fit in the allocated
+                                * queues, then set the QCSG_SG_XFER_MORE flag.
+                                */
+                               if (scsiq->remain_sg_entry_cnt != 0) {
+                                       scsi_sg_q.cntl |= QCSG_SG_XFER_MORE;
+                               } else {
+                                       scsi_sg_q.cntl |= QCSG_SG_XFER_END;
+                               }
+                               /* equals sg_entry_cnt * 2 */
+                               sg_list_dwords = sg_entry_cnt << 1;
+                               scsi_sg_q.sg_list_cnt = sg_entry_cnt - 1;
+                               scsi_sg_q.sg_cur_list_cnt = sg_entry_cnt - 1;
+                               sg_entry_cnt = 0;
+                       }
+
+                       scsi_sg_q.q_no = next_qp;
+                       AscMemWordCopyPtrToLram(iop_base,
+                                               q_addr + ASC_SCSIQ_SGHD_CPY_BEG,
+                                               (uchar *)&scsi_sg_q,
+                                               sizeof(ASC_SG_LIST_Q) >> 1);
+
+                       AscMemDWordCopyPtrToLram(iop_base,
+                                                q_addr + ASC_SGQ_LIST_BEG,
+                                                (uchar *)&sg_head->
+                                                sg_list[scsiq->next_sg_index],
+                                                sg_list_dwords);
+
+                       scsiq->next_sg_index += ASC_SG_LIST_PER_Q;
+
+                       /*
+                        * If the just completed SG queue contained the
+                        * last SG element, then no more SG queues need
+                        * to be written.
+                        */
+                       if (scsi_sg_q.cntl & QCSG_SG_XFER_END) {
+                               break;
+                       }
+
+                       next_qp = AscReadLramByte(iop_base,
+                                                 (ushort)(q_addr +
+                                                          ASC_SCSIQ_B_FWD));
+                       q_addr = ASC_QNO_TO_QADDR(next_qp);
+               }
+
+               /*
+                * Clear the halt condition so the RISC will be restarted
+                * after the return.
+                */
+               AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+               return (0);
+       }
 #endif /* CC_VERY_LONG_SG_LIST */
-    return (0);
+       return (0);
 }
 
-STATIC uchar
-_AscCopyLramScsiDoneQ(
-                         PortAddr iop_base,
-                         ushort q_addr,
-                         ASC_QDONE_INFO * scsiq,
-                         ASC_DCNT max_dma_count
-)
+static uchar
+_AscCopyLramScsiDoneQ(PortAddr iop_base,
+                     ushort q_addr,
+                     ASC_QDONE_INFO *scsiq, ASC_DCNT max_dma_count)
 {
-    ushort              _val;
-    uchar               sg_queue_cnt;
-
-    DvcGetQinfo(iop_base,
-                q_addr + ASC_SCSIQ_DONE_INFO_BEG,
-                (uchar *) scsiq,
-                (sizeof (ASC_SCSIQ_2) + sizeof (ASC_SCSIQ_3)) / 2);
-
-    _val = AscReadLramWord(iop_base,
-                           (ushort) (q_addr + (ushort) ASC_SCSIQ_B_STATUS));
-    scsiq->q_status = (uchar) _val;
-    scsiq->q_no = (uchar) (_val >> 8);
-    _val = AscReadLramWord(iop_base,
-                           (ushort) (q_addr + (ushort) ASC_SCSIQ_B_CNTL));
-    scsiq->cntl = (uchar) _val;
-    sg_queue_cnt = (uchar) (_val >> 8);
-    _val = AscReadLramWord(iop_base,
-                        (ushort) (q_addr + (ushort) ASC_SCSIQ_B_SENSE_LEN));
-    scsiq->sense_len = (uchar) _val;
-    scsiq->extra_bytes = (uchar) (_val >> 8);
-
-    /*
-     * Read high word of remain bytes from alternate location.
-     */
-    scsiq->remain_bytes = (((ADV_DCNT) AscReadLramWord( iop_base,
-                      (ushort) (q_addr+ (ushort) ASC_SCSIQ_W_ALT_DC1))) << 16);
-    /*
-     * Read low word of remain bytes from original location.
-     */
-    scsiq->remain_bytes += AscReadLramWord(iop_base,
-        (ushort) (q_addr+ (ushort) ASC_SCSIQ_DW_REMAIN_XFER_CNT));
-
-    scsiq->remain_bytes &= max_dma_count;
-    return (sg_queue_cnt);
+       ushort _val;
+       uchar sg_queue_cnt;
+
+       DvcGetQinfo(iop_base,
+                   q_addr + ASC_SCSIQ_DONE_INFO_BEG,
+                   (uchar *)scsiq,
+                   (sizeof(ASC_SCSIQ_2) + sizeof(ASC_SCSIQ_3)) / 2);
+
+       _val = AscReadLramWord(iop_base,
+                              (ushort)(q_addr + (ushort)ASC_SCSIQ_B_STATUS));
+       scsiq->q_status = (uchar)_val;
+       scsiq->q_no = (uchar)(_val >> 8);
+       _val = AscReadLramWord(iop_base,
+                              (ushort)(q_addr + (ushort)ASC_SCSIQ_B_CNTL));
+       scsiq->cntl = (uchar)_val;
+       sg_queue_cnt = (uchar)(_val >> 8);
+       _val = AscReadLramWord(iop_base,
+                              (ushort)(q_addr +
+                                       (ushort)ASC_SCSIQ_B_SENSE_LEN));
+       scsiq->sense_len = (uchar)_val;
+       scsiq->extra_bytes = (uchar)(_val >> 8);
+
+       /*
+        * Read high word of remain bytes from alternate location.
+        */
+       scsiq->remain_bytes = (((ADV_DCNT)AscReadLramWord(iop_base,
+                                                         (ushort)(q_addr +
+                                                                  (ushort)
+                                                                  ASC_SCSIQ_W_ALT_DC1)))
+                              << 16);
+       /*
+        * Read low word of remain bytes from original location.
+        */
+       scsiq->remain_bytes += AscReadLramWord(iop_base,
+                                              (ushort)(q_addr + (ushort)
+                                                       ASC_SCSIQ_DW_REMAIN_XFER_CNT));
+
+       scsiq->remain_bytes &= max_dma_count;
+       return (sg_queue_cnt);
 }
 
-STATIC int
-AscIsrQDone(
-               ASC_DVC_VAR *asc_dvc
-)
+static int AscIsrQDone(ASC_DVC_VAR *asc_dvc)
 {
-    uchar               next_qp;
-    uchar               n_q_used;
-    uchar               sg_list_qp;
-    uchar               sg_queue_cnt;
-    uchar               q_cnt;
-    uchar               done_q_tail;
-    uchar               tid_no;
-    ASC_SCSI_BIT_ID_TYPE scsi_busy;
-    ASC_SCSI_BIT_ID_TYPE target_id;
-    PortAddr            iop_base;
-    ushort              q_addr;
-    ushort              sg_q_addr;
-    uchar               cur_target_qng;
-    ASC_QDONE_INFO      scsiq_buf;
-    ASC_QDONE_INFO *scsiq;
-    int                 false_overrun;
-    ASC_ISR_CALLBACK    asc_isr_callback;
-
-    iop_base = asc_dvc->iop_base;
-    asc_isr_callback = asc_dvc->isr_callback;
-    n_q_used = 1;
-    scsiq = (ASC_QDONE_INFO *) & scsiq_buf;
-    done_q_tail = (uchar) AscGetVarDoneQTail(iop_base);
-    q_addr = ASC_QNO_TO_QADDR(done_q_tail);
-    next_qp = AscReadLramByte(iop_base,
-                              (ushort) (q_addr + (ushort) ASC_SCSIQ_B_FWD));
-    if (next_qp != ASC_QLINK_END) {
-        AscPutVarDoneQTail(iop_base, next_qp);
-        q_addr = ASC_QNO_TO_QADDR(next_qp);
-        sg_queue_cnt = _AscCopyLramScsiDoneQ(iop_base, q_addr, scsiq,
-            asc_dvc->max_dma_count);
-        AscWriteLramByte(iop_base,
-                         (ushort) (q_addr + (ushort) ASC_SCSIQ_B_STATUS),
-             (uchar) (scsiq->q_status & (uchar) ~ (QS_READY | QS_ABORTED)));
-        tid_no = ASC_TIX_TO_TID(scsiq->d2.target_ix);
-        target_id = ASC_TIX_TO_TARGET_ID(scsiq->d2.target_ix);
-        if ((scsiq->cntl & QC_SG_HEAD) != 0) {
-            sg_q_addr = q_addr;
-            sg_list_qp = next_qp;
-            for (q_cnt = 0; q_cnt < sg_queue_cnt; q_cnt++) {
-                sg_list_qp = AscReadLramByte(iop_base,
-                           (ushort) (sg_q_addr + (ushort) ASC_SCSIQ_B_FWD));
-                sg_q_addr = ASC_QNO_TO_QADDR(sg_list_qp);
-                if (sg_list_qp == ASC_QLINK_END) {
-                    AscSetLibErrorCode(asc_dvc, ASCQ_ERR_SG_Q_LINKS);
-                    scsiq->d3.done_stat = QD_WITH_ERROR;
-                    scsiq->d3.host_stat = QHSTA_D_QDONE_SG_LIST_CORRUPTED;
-                    goto FATAL_ERR_QDONE;
-                }
-                AscWriteLramByte(iop_base,
-                         (ushort) (sg_q_addr + (ushort) ASC_SCSIQ_B_STATUS),
-                                 QS_FREE);
-            }
-            n_q_used = sg_queue_cnt + 1;
-            AscPutVarDoneQTail(iop_base, sg_list_qp);
-        }
-        if (asc_dvc->queue_full_or_busy & target_id) {
-            cur_target_qng = AscReadLramByte(iop_base,
-            (ushort) ((ushort) ASC_QADR_BEG + (ushort) scsiq->d2.target_ix));
-            if (cur_target_qng < asc_dvc->max_dvc_qng[tid_no]) {
-                scsi_busy = AscReadLramByte(iop_base,
-                                            (ushort) ASCV_SCSIBUSY_B);
-                scsi_busy &= ~target_id;
-                AscWriteLramByte(iop_base,
-                                 (ushort) ASCV_SCSIBUSY_B, scsi_busy);
-                asc_dvc->queue_full_or_busy &= ~target_id;
-            }
-        }
-        if (asc_dvc->cur_total_qng >= n_q_used) {
-            asc_dvc->cur_total_qng -= n_q_used;
-            if (asc_dvc->cur_dvc_qng[tid_no] != 0) {
-                asc_dvc->cur_dvc_qng[tid_no]--;
-            }
-        } else {
-            AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CUR_QNG);
-            scsiq->d3.done_stat = QD_WITH_ERROR;
-            goto FATAL_ERR_QDONE;
-        }
-        if ((scsiq->d2.srb_ptr == 0UL) ||
-            ((scsiq->q_status & QS_ABORTED) != 0)) {
-            return (0x11);
-        } else if (scsiq->q_status == QS_DONE) {
-            false_overrun = FALSE;
-            if (scsiq->extra_bytes != 0) {
-                scsiq->remain_bytes += (ADV_DCNT) scsiq->extra_bytes;
-            }
-            if (scsiq->d3.done_stat == QD_WITH_ERROR) {
-                if (scsiq->d3.host_stat == QHSTA_M_DATA_OVER_RUN) {
-                    if ((scsiq->cntl & (QC_DATA_IN | QC_DATA_OUT)) == 0) {
-                        scsiq->d3.done_stat = QD_NO_ERROR;
-                        scsiq->d3.host_stat = QHSTA_NO_ERROR;
-                    } else if (false_overrun) {
-                        scsiq->d3.done_stat = QD_NO_ERROR;
-                        scsiq->d3.host_stat = QHSTA_NO_ERROR;
-                    }
-                } else if (scsiq->d3.host_stat ==
-                           QHSTA_M_HUNG_REQ_SCSI_BUS_RESET) {
-                    AscStopChip(iop_base);
-                    AscSetChipControl(iop_base,
-                        (uchar) (CC_SCSI_RESET | CC_HALT));
-                    DvcDelayNanoSecond(asc_dvc, 60000);
-                    AscSetChipControl(iop_base, CC_HALT);
-                    AscSetChipStatus(iop_base, CIW_CLR_SCSI_RESET_INT);
-                    AscSetChipStatus(iop_base, 0);
-                    AscSetChipControl(iop_base, 0);
-                }
-            }
-            if ((scsiq->cntl & QC_NO_CALLBACK) == 0) {
-                (*asc_isr_callback) (asc_dvc, scsiq);
-            } else {
-                if ((AscReadLramByte(iop_base,
-                          (ushort) (q_addr + (ushort) ASC_SCSIQ_CDB_BEG)) ==
-                     START_STOP)) {
-                    asc_dvc->unit_not_ready &= ~target_id;
-                    if (scsiq->d3.done_stat != QD_NO_ERROR) {
-                        asc_dvc->start_motor &= ~target_id;
-                    }
-                }
-            }
-            return (1);
-        } else {
-            AscSetLibErrorCode(asc_dvc, ASCQ_ERR_Q_STATUS);
-          FATAL_ERR_QDONE:
-            if ((scsiq->cntl & QC_NO_CALLBACK) == 0) {
-                (*asc_isr_callback) (asc_dvc, scsiq);
-            }
-            return (0x80);
-        }
-    }
-    return (0);
+       uchar next_qp;
+       uchar n_q_used;
+       uchar sg_list_qp;
+       uchar sg_queue_cnt;
+       uchar q_cnt;
+       uchar done_q_tail;
+       uchar tid_no;
+       ASC_SCSI_BIT_ID_TYPE scsi_busy;
+       ASC_SCSI_BIT_ID_TYPE target_id;
+       PortAddr iop_base;
+       ushort q_addr;
+       ushort sg_q_addr;
+       uchar cur_target_qng;
+       ASC_QDONE_INFO scsiq_buf;
+       ASC_QDONE_INFO *scsiq;
+       int false_overrun;
+       ASC_ISR_CALLBACK asc_isr_callback;
+
+       iop_base = asc_dvc->iop_base;
+       asc_isr_callback = asc_dvc->isr_callback;
+       n_q_used = 1;
+       scsiq = (ASC_QDONE_INFO *)&scsiq_buf;
+       done_q_tail = (uchar)AscGetVarDoneQTail(iop_base);
+       q_addr = ASC_QNO_TO_QADDR(done_q_tail);
+       next_qp = AscReadLramByte(iop_base,
+                                 (ushort)(q_addr + (ushort)ASC_SCSIQ_B_FWD));
+       if (next_qp != ASC_QLINK_END) {
+               AscPutVarDoneQTail(iop_base, next_qp);
+               q_addr = ASC_QNO_TO_QADDR(next_qp);
+               sg_queue_cnt = _AscCopyLramScsiDoneQ(iop_base, q_addr, scsiq,
+                                                    asc_dvc->max_dma_count);
+               AscWriteLramByte(iop_base,
+                                (ushort)(q_addr +
+                                         (ushort)ASC_SCSIQ_B_STATUS),
+                                (uchar)(scsiq->
+                                        q_status & (uchar)~(QS_READY |
+                                                            QS_ABORTED)));
+               tid_no = ASC_TIX_TO_TID(scsiq->d2.target_ix);
+               target_id = ASC_TIX_TO_TARGET_ID(scsiq->d2.target_ix);
+               if ((scsiq->cntl & QC_SG_HEAD) != 0) {
+                       sg_q_addr = q_addr;
+                       sg_list_qp = next_qp;
+                       for (q_cnt = 0; q_cnt < sg_queue_cnt; q_cnt++) {
+                               sg_list_qp = AscReadLramByte(iop_base,
+                                                            (ushort)(sg_q_addr
+                                                                     + (ushort)
+                                                                     ASC_SCSIQ_B_FWD));
+                               sg_q_addr = ASC_QNO_TO_QADDR(sg_list_qp);
+                               if (sg_list_qp == ASC_QLINK_END) {
+                                       AscSetLibErrorCode(asc_dvc,
+                                                          ASCQ_ERR_SG_Q_LINKS);
+                                       scsiq->d3.done_stat = QD_WITH_ERROR;
+                                       scsiq->d3.host_stat =
+                                           QHSTA_D_QDONE_SG_LIST_CORRUPTED;
+                                       goto FATAL_ERR_QDONE;
+                               }
+                               AscWriteLramByte(iop_base,
+                                                (ushort)(sg_q_addr + (ushort)
+                                                         ASC_SCSIQ_B_STATUS),
+                                                QS_FREE);
+                       }
+                       n_q_used = sg_queue_cnt + 1;
+                       AscPutVarDoneQTail(iop_base, sg_list_qp);
+               }
+               if (asc_dvc->queue_full_or_busy & target_id) {
+                       cur_target_qng = AscReadLramByte(iop_base,
+                                                        (ushort)((ushort)
+                                                                 ASC_QADR_BEG
+                                                                 + (ushort)
+                                                                 scsiq->d2.
+                                                                 target_ix));
+                       if (cur_target_qng < asc_dvc->max_dvc_qng[tid_no]) {
+                               scsi_busy = AscReadLramByte(iop_base, (ushort)
+                                                           ASCV_SCSIBUSY_B);
+                               scsi_busy &= ~target_id;
+                               AscWriteLramByte(iop_base,
+                                                (ushort)ASCV_SCSIBUSY_B,
+                                                scsi_busy);
+                               asc_dvc->queue_full_or_busy &= ~target_id;
+                       }
+               }
+               if (asc_dvc->cur_total_qng >= n_q_used) {
+                       asc_dvc->cur_total_qng -= n_q_used;
+                       if (asc_dvc->cur_dvc_qng[tid_no] != 0) {
+                               asc_dvc->cur_dvc_qng[tid_no]--;
+                       }
+               } else {
+                       AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CUR_QNG);
+                       scsiq->d3.done_stat = QD_WITH_ERROR;
+                       goto FATAL_ERR_QDONE;
+               }
+               if ((scsiq->d2.srb_ptr == 0UL) ||
+                   ((scsiq->q_status & QS_ABORTED) != 0)) {
+                       return (0x11);
+               } else if (scsiq->q_status == QS_DONE) {
+                       false_overrun = FALSE;
+                       if (scsiq->extra_bytes != 0) {
+                               scsiq->remain_bytes +=
+                                   (ADV_DCNT)scsiq->extra_bytes;
+                       }
+                       if (scsiq->d3.done_stat == QD_WITH_ERROR) {
+                               if (scsiq->d3.host_stat ==
+                                   QHSTA_M_DATA_OVER_RUN) {
+                                       if ((scsiq->
+                                            cntl & (QC_DATA_IN | QC_DATA_OUT))
+                                           == 0) {
+                                               scsiq->d3.done_stat =
+                                                   QD_NO_ERROR;
+                                               scsiq->d3.host_stat =
+                                                   QHSTA_NO_ERROR;
+                                       } else if (false_overrun) {
+                                               scsiq->d3.done_stat =
+                                                   QD_NO_ERROR;
+                                               scsiq->d3.host_stat =
+                                                   QHSTA_NO_ERROR;
+                                       }
+                               } else if (scsiq->d3.host_stat ==
+                                          QHSTA_M_HUNG_REQ_SCSI_BUS_RESET) {
+                                       AscStopChip(iop_base);
+                                       AscSetChipControl(iop_base,
+                                                         (uchar)(CC_SCSI_RESET
+                                                                 | CC_HALT));
+                                       DvcDelayNanoSecond(asc_dvc, 60000);
+                                       AscSetChipControl(iop_base, CC_HALT);
+                                       AscSetChipStatus(iop_base,
+                                                        CIW_CLR_SCSI_RESET_INT);
+                                       AscSetChipStatus(iop_base, 0);
+                                       AscSetChipControl(iop_base, 0);
+                               }
+                       }
+                       if ((scsiq->cntl & QC_NO_CALLBACK) == 0) {
+                               (*asc_isr_callback) (asc_dvc, scsiq);
+                       } else {
+                               if ((AscReadLramByte(iop_base,
+                                                    (ushort)(q_addr + (ushort)
+                                                             ASC_SCSIQ_CDB_BEG))
+                                    == START_STOP)) {
+                                       asc_dvc->unit_not_ready &= ~target_id;
+                                       if (scsiq->d3.done_stat != QD_NO_ERROR) {
+                                               asc_dvc->start_motor &=
+                                                   ~target_id;
+                                       }
+                               }
+                       }
+                       return (1);
+               } else {
+                       AscSetLibErrorCode(asc_dvc, ASCQ_ERR_Q_STATUS);
+ FATAL_ERR_QDONE:
+                       if ((scsiq->cntl & QC_NO_CALLBACK) == 0) {
+                               (*asc_isr_callback) (asc_dvc, scsiq);
+                       }
+                       return (0x80);
+               }
+       }
+       return (0);
 }
 
-STATIC int
-AscISR(
-          ASC_DVC_VAR *asc_dvc
-)
+static int AscISR(ASC_DVC_VAR *asc_dvc)
 {
-    ASC_CS_TYPE         chipstat;
-    PortAddr            iop_base;
-    ushort              saved_ram_addr;
-    uchar               ctrl_reg;
-    uchar               saved_ctrl_reg;
-    int                 int_pending;
-    int                 status;
-    uchar               host_flag;
-
-    iop_base = asc_dvc->iop_base;
-    int_pending = FALSE;
-
-    if (AscIsIntPending(iop_base) == 0)
-    {
-        return int_pending;
-    }
+       ASC_CS_TYPE chipstat;
+       PortAddr iop_base;
+       ushort saved_ram_addr;
+       uchar ctrl_reg;
+       uchar saved_ctrl_reg;
+       int int_pending;
+       int status;
+       uchar host_flag;
+
+       iop_base = asc_dvc->iop_base;
+       int_pending = FALSE;
+
+       if (AscIsIntPending(iop_base) == 0) {
+               return int_pending;
+       }
 
-    if (((asc_dvc->init_state & ASC_INIT_STATE_END_LOAD_MC) == 0)
-        || (asc_dvc->isr_callback == 0)
-) {
-        return (ERR);
-    }
-    if (asc_dvc->in_critical_cnt != 0) {
-        AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_ON_CRITICAL);
-        return (ERR);
-    }
-    if (asc_dvc->is_in_int) {
-        AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_RE_ENTRY);
-        return (ERR);
-    }
-    asc_dvc->is_in_int = TRUE;
-    ctrl_reg = AscGetChipControl(iop_base);
-    saved_ctrl_reg = ctrl_reg & (~(CC_SCSI_RESET | CC_CHIP_RESET |
-                                   CC_SINGLE_STEP | CC_DIAG | CC_TEST));
-    chipstat = AscGetChipStatus(iop_base);
-    if (chipstat & CSW_SCSI_RESET_LATCH) {
-        if (!(asc_dvc->bus_type & (ASC_IS_VL | ASC_IS_EISA))) {
-            int i = 10;
-            int_pending = TRUE;
-            asc_dvc->sdtr_done = 0;
-            saved_ctrl_reg &= (uchar) (~CC_HALT);
-            while ((AscGetChipStatus(iop_base) & CSW_SCSI_RESET_ACTIVE) &&
-                   (i-- > 0))
-            {
-                  DvcSleepMilliSecond(100);
-            }
-            AscSetChipControl(iop_base, (CC_CHIP_RESET | CC_HALT));
-            AscSetChipControl(iop_base, CC_HALT);
-            AscSetChipStatus(iop_base, CIW_CLR_SCSI_RESET_INT);
-            AscSetChipStatus(iop_base, 0);
-            chipstat = AscGetChipStatus(iop_base);
-        }
-    }
-    saved_ram_addr = AscGetChipLramAddr(iop_base);
-    host_flag = AscReadLramByte(iop_base,
-        ASCV_HOST_FLAG_B) & (uchar) (~ASC_HOST_FLAG_IN_ISR);
-    AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B,
-                     (uchar) (host_flag | (uchar) ASC_HOST_FLAG_IN_ISR));
-    if ((chipstat & CSW_INT_PENDING)
-        || (int_pending)
-) {
-        AscAckInterrupt(iop_base);
-        int_pending = TRUE;
-        if ((chipstat & CSW_HALTED) &&
-            (ctrl_reg & CC_SINGLE_STEP)) {
-            if (AscIsrChipHalted(asc_dvc) == ERR) {
-                goto ISR_REPORT_QDONE_FATAL_ERROR;
-            } else {
-                saved_ctrl_reg &= (uchar) (~CC_HALT);
-            }
-        } else {
-          ISR_REPORT_QDONE_FATAL_ERROR:
-            if ((asc_dvc->dvc_cntl & ASC_CNTL_INT_MULTI_Q) != 0) {
-                while (((status = AscIsrQDone(asc_dvc)) & 0x01) != 0) {
-                }
-            } else {
-                do {
-                    if ((status = AscIsrQDone(asc_dvc)) == 1) {
-                        break;
-                    }
-                } while (status == 0x11);
-            }
-            if ((status & 0x80) != 0)
-                int_pending = ERR;
-        }
-    }
-    AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag);
-    AscSetChipLramAddr(iop_base, saved_ram_addr);
-    AscSetChipControl(iop_base, saved_ctrl_reg);
-    asc_dvc->is_in_int = FALSE;
-    return (int_pending);
+       if (((asc_dvc->init_state & ASC_INIT_STATE_END_LOAD_MC) == 0)
+           || (asc_dvc->isr_callback == 0)
+           ) {
+               return (ERR);
+       }
+       if (asc_dvc->in_critical_cnt != 0) {
+               AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_ON_CRITICAL);
+               return (ERR);
+       }
+       if (asc_dvc->is_in_int) {
+               AscSetLibErrorCode(asc_dvc, ASCQ_ERR_ISR_RE_ENTRY);
+               return (ERR);
+       }
+       asc_dvc->is_in_int = TRUE;
+       ctrl_reg = AscGetChipControl(iop_base);
+       saved_ctrl_reg = ctrl_reg & (~(CC_SCSI_RESET | CC_CHIP_RESET |
+                                      CC_SINGLE_STEP | CC_DIAG | CC_TEST));
+       chipstat = AscGetChipStatus(iop_base);
+       if (chipstat & CSW_SCSI_RESET_LATCH) {
+               if (!(asc_dvc->bus_type & (ASC_IS_VL | ASC_IS_EISA))) {
+                       int i = 10;
+                       int_pending = TRUE;
+                       asc_dvc->sdtr_done = 0;
+                       saved_ctrl_reg &= (uchar)(~CC_HALT);
+                       while ((AscGetChipStatus(iop_base) &
+                               CSW_SCSI_RESET_ACTIVE) && (i-- > 0)) {
+                               DvcSleepMilliSecond(100);
+                       }
+                       AscSetChipControl(iop_base, (CC_CHIP_RESET | CC_HALT));
+                       AscSetChipControl(iop_base, CC_HALT);
+                       AscSetChipStatus(iop_base, CIW_CLR_SCSI_RESET_INT);
+                       AscSetChipStatus(iop_base, 0);
+                       chipstat = AscGetChipStatus(iop_base);
+               }
+       }
+       saved_ram_addr = AscGetChipLramAddr(iop_base);
+       host_flag = AscReadLramByte(iop_base,
+                                   ASCV_HOST_FLAG_B) &
+           (uchar)(~ASC_HOST_FLAG_IN_ISR);
+       AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B,
+                        (uchar)(host_flag | (uchar)ASC_HOST_FLAG_IN_ISR));
+       if ((chipstat & CSW_INT_PENDING)
+           || (int_pending)
+           ) {
+               AscAckInterrupt(iop_base);
+               int_pending = TRUE;
+               if ((chipstat & CSW_HALTED) && (ctrl_reg & CC_SINGLE_STEP)) {
+                       if (AscIsrChipHalted(asc_dvc) == ERR) {
+                               goto ISR_REPORT_QDONE_FATAL_ERROR;
+                       } else {
+                               saved_ctrl_reg &= (uchar)(~CC_HALT);
+                       }
+               } else {
+ ISR_REPORT_QDONE_FATAL_ERROR:
+                       if ((asc_dvc->dvc_cntl & ASC_CNTL_INT_MULTI_Q) != 0) {
+                               while (((status =
+                                        AscIsrQDone(asc_dvc)) & 0x01) != 0) {
+                               }
+                       } else {
+                               do {
+                                       if ((status =
+                                            AscIsrQDone(asc_dvc)) == 1) {
+                                               break;
+                                       }
+                               } while (status == 0x11);
+                       }
+                       if ((status & 0x80) != 0)
+                               int_pending = ERR;
+               }
+       }
+       AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag);
+       AscSetChipLramAddr(iop_base, saved_ram_addr);
+       AscSetChipControl(iop_base, saved_ctrl_reg);
+       asc_dvc->is_in_int = FALSE;
+       return (int_pending);
 }
 
 /* Microcode buffer is kept after initialization for error recovery. */
-STATIC uchar _asc_mcode_buf[] =
-{
-  0x01,  0x03,  0x01,  0x19,  0x0F,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-  0x0F,  0x0F,  0x0F,  0x0F,  0x0F,  0x0F,  0x0F,  0x0F,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-  0x00,  0x00,  0x00,  0x00,  0xC3,  0x12,  0x0D,  0x05,  0x01,  0x00,  0x00,  0x00,  0x00,  0xFF,  0x00,  0x00,
-  0x00,  0x00,  0x00,  0x00,  0xFF,  0x80,  0xFF,  0xFF,  0x01,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,
-  0x00,  0x00,  0x00,  0x23,  0x00,  0x00,  0x00,  0x00,  0x00,  0x07,  0x00,  0xFF,  0x00,  0x00,  0x00,  0x00,
-  0xFF,  0xFF,  0xFF,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0x00,  0xE4,  0x88,  0x00,  0x00,  0x00,  0x00,
-  0x80,  0x73,  0x48,  0x04,  0x36,  0x00,  0x00,  0xA2,  0xC2,  0x00,  0x80,  0x73,  0x03,  0x23,  0x36,  0x40,
-  0xB6,  0x00,  0x36,  0x00,  0x05,  0xD6,  0x0C,  0xD2,  0x12,  0xDA,  0x00,  0xA2,  0xC2,  0x00,  0x92,  0x80,
-  0x1E,  0x98,  0x50,  0x00,  0xF5,  0x00,  0x48,  0x98,  0xDF,  0x23,  0x36,  0x60,  0xB6,  0x00,  0x92,  0x80,
-  0x4F,  0x00,  0xF5,  0x00,  0x48,  0x98,  0xEF,  0x23,  0x36,  0x60,  0xB6,  0x00,  0x92,  0x80,  0x80,  0x62,
-  0x92,  0x80,  0x00,  0x46,  0x15,  0xEE,  0x13,  0xEA,  0x02,  0x01,  0x09,  0xD8,  0xCD,  0x04,  0x4D,  0x00,
-  0x00,  0xA3,  0xD6,  0x00,  0xA6,  0x97,  0x7F,  0x23,  0x04,  0x61,  0x84,  0x01,  0xE6,  0x84,  0xD2,  0xC1,
-  0x80,  0x73,  0xCD,  0x04,  0x4D,  0x00,  0x00,  0xA3,  0xDA,  0x01,  0xA6,  0x97,  0xC6,  0x81,  0xC2,  0x88,
-  0x80,  0x73,  0x80,  0x77,  0x00,  0x01,  0x01,  0xA1,  0xFE,  0x00,  0x4F,  0x00,  0x84,  0x97,  0x07,  0xA6,
-  0x08,  0x01,  0x00,  0x33,  0x03,  0x00,  0xC2,  0x88,  0x03,  0x03,  0x01,  0xDE,  0xC2,  0x88,  0xCE,  0x00,
-  0x69,  0x60,  0xCE,  0x00,  0x02,  0x03,  0x4A,  0x60,  0x00,  0xA2,  0x78,  0x01,  0x80,  0x63,  0x07,  0xA6,
-  0x24,  0x01,  0x78,  0x81,  0x03,  0x03,  0x80,  0x63,  0xE2,  0x00,  0x07,  0xA6,  0x34,  0x01,  0x00,  0x33,
-  0x04,  0x00,  0xC2,  0x88,  0x03,  0x07,  0x02,  0x01,  0x04,  0xCA,  0x0D,  0x23,  0x68,  0x98,  0x4D,  0x04,
-  0x04,  0x85,  0x05,  0xD8,  0x0D,  0x23,  0x68,  0x98,  0xCD,  0x04,  0x15,  0x23,  0xF8,  0x88,  0xFB,  0x23,
-  0x02,  0x61,  0x82,  0x01,  0x80,  0x63,  0x02,  0x03,  0x06,  0xA3,  0x62,  0x01,  0x00,  0x33,  0x0A,  0x00,
-  0xC2,  0x88,  0x4E,  0x00,  0x07,  0xA3,  0x6E,  0x01,  0x00,  0x33,  0x0B,  0x00,  0xC2,  0x88,  0xCD,  0x04,
-  0x36,  0x2D,  0x00,  0x33,  0x1A,  0x00,  0xC2,  0x88,  0x50,  0x04,  0x88,  0x81,  0x06,  0xAB,  0x82,  0x01,
-  0x88,  0x81,  0x4E,  0x00,  0x07,  0xA3,  0x92,  0x01,  0x50,  0x00,  0x00,  0xA3,  0x3C,  0x01,  0x00,  0x05,
-  0x7C,  0x81,  0x46,  0x97,  0x02,  0x01,  0x05,  0xC6,  0x04,  0x23,  0xA0,  0x01,  0x15,  0x23,  0xA1,  0x01,
-  0xBE,  0x81,  0xFD,  0x23,  0x02,  0x61,  0x82,  0x01,  0x0A,  0xDA,  0x4A,  0x00,  0x06,  0x61,  0x00,  0xA0,
-  0xB4,  0x01,  0x80,  0x63,  0xCD,  0x04,  0x36,  0x2D,  0x00,  0x33,  0x1B,  0x00,  0xC2,  0x88,  0x06,  0x23,
-  0x68,  0x98,  0xCD,  0x04,  0xE6,  0x84,  0x06,  0x01,  0x00,  0xA2,  0xD4,  0x01,  0x57,  0x60,  0x00,  0xA0,
-  0xDA,  0x01,  0xE6,  0x84,  0x80,  0x23,  0xA0,  0x01,  0xE6,  0x84,  0x80,  0x73,  0x4B,  0x00,  0x06,  0x61,
-  0x00,  0xA2,  0x00,  0x02,  0x04,  0x01,  0x0C,  0xDE,  0x02,  0x01,  0x03,  0xCC,  0x4F,  0x00,  0x84,  0x97,
-  0xFC,  0x81,  0x08,  0x23,  0x02,  0x41,  0x82,  0x01,  0x4F,  0x00,  0x62,  0x97,  0x48,  0x04,  0x84,  0x80,
-  0xF0,  0x97,  0x00,  0x46,  0x56,  0x00,  0x03,  0xC0,  0x01,  0x23,  0xE8,  0x00,  0x81,  0x73,  0x06,  0x29,
-  0x03,  0x42,  0x06,  0xE2,  0x03,  0xEE,  0x6B,  0xEB,  0x11,  0x23,  0xF8,  0x88,  0x04,  0x98,  0xF0,  0x80,
-  0x80,  0x73,  0x80,  0x77,  0x07,  0xA4,  0x2A,  0x02,  0x7C,  0x95,  0x06,  0xA6,  0x34,  0x02,  0x03,  0xA6,
-  0x4C,  0x04,  0x46,  0x82,  0x04,  0x01,  0x03,  0xD8,  0xB4,  0x98,  0x6A,  0x96,  0x46,  0x82,  0xFE,  0x95,
-  0x80,  0x67,  0x83,  0x03,  0x80,  0x63,  0xB6,  0x2D,  0x02,  0xA6,  0x6C,  0x02,  0x07,  0xA6,  0x5A,  0x02,
-  0x06,  0xA6,  0x5E,  0x02,  0x03,  0xA6,  0x62,  0x02,  0xC2,  0x88,  0x7C,  0x95,  0x48,  0x82,  0x60,  0x96,
-  0x48,  0x82,  0x04,  0x23,  0xA0,  0x01,  0x14,  0x23,  0xA1,  0x01,  0x3C,  0x84,  0x04,  0x01,  0x0C,  0xDC,
-  0xE0,  0x23,  0x25,  0x61,  0xEF,  0x00,  0x14,  0x01,  0x4F,  0x04,  0xA8,  0x01,  0x6F,  0x00,  0xA5,  0x01,
-  0x03,  0x23,  0xA4,  0x01,  0x06,  0x23,  0x9C,  0x01,  0x24,  0x2B,  0x1C,  0x01,  0x02,  0xA6,  0xAA,  0x02,
-  0x07,  0xA6,  0x5A,  0x02,  0x06,  0xA6,  0x5E,  0x02,  0x03,  0xA6,  0x20,  0x04,  0x01,  0xA6,  0xB4,  0x02,
-  0x00,  0xA6,  0xB4,  0x02,  0x00,  0x33,  0x12,  0x00,  0xC2,  0x88,  0x00,  0x0E,  0x80,  0x63,  0x00,  0x43,
-  0x00,  0xA0,  0x8C,  0x02,  0x4D,  0x04,  0x04,  0x01,  0x0B,  0xDC,  0xE7,  0x23,  0x04,  0x61,  0x84,  0x01,
-  0x10,  0x31,  0x12,  0x35,  0x14,  0x01,  0xEC,  0x00,  0x6C,  0x38,  0x00,  0x3F,  0x00,  0x00,  0xEA,  0x82,
-  0x18,  0x23,  0x04,  0x61,  0x18,  0xA0,  0xE2,  0x02,  0x04,  0x01,  0xA2,  0xC8,  0x00,  0x33,  0x1F,  0x00,
-  0xC2,  0x88,  0x08,  0x31,  0x0A,  0x35,  0x0C,  0x39,  0x0E,  0x3D,  0x7E,  0x98,  0xB6,  0x2D,  0x01,  0xA6,
-  0x14,  0x03,  0x00,  0xA6,  0x14,  0x03,  0x07,  0xA6,  0x0C,  0x03,  0x06,  0xA6,  0x10,  0x03,  0x03,  0xA6,
-  0x20,  0x04,  0x02,  0xA6,  0x6C,  0x02,  0x00,  0x33,  0x33,  0x00,  0xC2,  0x88,  0x7C,  0x95,  0xEE,  0x82,
-  0x60,  0x96,  0xEE,  0x82,  0x82,  0x98,  0x80,  0x42,  0x7E,  0x98,  0x64,  0xE4,  0x04,  0x01,  0x2D,  0xC8,
-  0x31,  0x05,  0x07,  0x01,  0x00,  0xA2,  0x54,  0x03,  0x00,  0x43,  0x87,  0x01,  0x05,  0x05,  0x86,  0x98,
-  0x7E,  0x98,  0x00,  0xA6,  0x16,  0x03,  0x07,  0xA6,  0x4C,  0x03,  0x03,  0xA6,  0x3C,  0x04,  0x06,  0xA6,
-  0x50,  0x03,  0x01,  0xA6,  0x16,  0x03,  0x00,  0x33,  0x25,  0x00,  0xC2,  0x88,  0x7C,  0x95,  0x32,  0x83,
-  0x60,  0x96,  0x32,  0x83,  0x04,  0x01,  0x10,  0xCE,  0x07,  0xC8,  0x05,  0x05,  0xEB,  0x04,  0x00,  0x33,
-  0x00,  0x20,  0xC0,  0x20,  0x81,  0x62,  0x72,  0x83,  0x00,  0x01,  0x05,  0x05,  0xFF,  0xA2,  0x7A,  0x03,
-  0xB1,  0x01,  0x08,  0x23,  0xB2,  0x01,  0x2E,  0x83,  0x05,  0x05,  0x15,  0x01,  0x00,  0xA2,  0x9A,  0x03,
-  0xEC,  0x00,  0x6E,  0x00,  0x95,  0x01,  0x6C,  0x38,  0x00,  0x3F,  0x00,  0x00,  0x01,  0xA6,  0x96,  0x03,
-  0x00,  0xA6,  0x96,  0x03,  0x10,  0x84,  0x80,  0x42,  0x7E,  0x98,  0x01,  0xA6,  0xA4,  0x03,  0x00,  0xA6,
-  0xBC,  0x03,  0x10,  0x84,  0xA8,  0x98,  0x80,  0x42,  0x01,  0xA6,  0xA4,  0x03,  0x07,  0xA6,  0xB2,  0x03,
-  0xD4,  0x83,  0x7C,  0x95,  0xA8,  0x83,  0x00,  0x33,  0x2F,  0x00,  0xC2,  0x88,  0xA8,  0x98,  0x80,  0x42,
-  0x00,  0xA6,  0xBC,  0x03,  0x07,  0xA6,  0xCA,  0x03,  0xD4,  0x83,  0x7C,  0x95,  0xC0,  0x83,  0x00,  0x33,
-  0x26,  0x00,  0xC2,  0x88,  0x38,  0x2B,  0x80,  0x32,  0x80,  0x36,  0x04,  0x23,  0xA0,  0x01,  0x12,  0x23,
-  0xA1,  0x01,  0x10,  0x84,  0x07,  0xF0,  0x06,  0xA4,  0xF4,  0x03,  0x80,  0x6B,  0x80,  0x67,  0x05,  0x23,
-  0x83,  0x03,  0x80,  0x63,  0x03,  0xA6,  0x0E,  0x04,  0x07,  0xA6,  0x06,  0x04,  0x06,  0xA6,  0x0A,  0x04,
-  0x00,  0x33,  0x17,  0x00,  0xC2,  0x88,  0x7C,  0x95,  0xF4,  0x83,  0x60,  0x96,  0xF4,  0x83,  0x20,  0x84,
-  0x07,  0xF0,  0x06,  0xA4,  0x20,  0x04,  0x80,  0x6B,  0x80,  0x67,  0x05,  0x23,  0x83,  0x03,  0x80,  0x63,
-  0xB6,  0x2D,  0x03,  0xA6,  0x3C,  0x04,  0x07,  0xA6,  0x34,  0x04,  0x06,  0xA6,  0x38,  0x04,  0x00,  0x33,
-  0x30,  0x00,  0xC2,  0x88,  0x7C,  0x95,  0x20,  0x84,  0x60,  0x96,  0x20,  0x84,  0x1D,  0x01,  0x06,  0xCC,
-  0x00,  0x33,  0x00,  0x84,  0xC0,  0x20,  0x00,  0x23,  0xEA,  0x00,  0x81,  0x62,  0xA2,  0x0D,  0x80,  0x63,
-  0x07,  0xA6,  0x5A,  0x04,  0x00,  0x33,  0x18,  0x00,  0xC2,  0x88,  0x03,  0x03,  0x80,  0x63,  0xA3,  0x01,
-  0x07,  0xA4,  0x64,  0x04,  0x23,  0x01,  0x00,  0xA2,  0x86,  0x04,  0x0A,  0xA0,  0x76,  0x04,  0xE0,  0x00,
-  0x00,  0x33,  0x1D,  0x00,  0xC2,  0x88,  0x0B,  0xA0,  0x82,  0x04,  0xE0,  0x00,  0x00,  0x33,  0x1E,  0x00,
-  0xC2,  0x88,  0x42,  0x23,  0xF8,  0x88,  0x00,  0x23,  0x22,  0xA3,  0xE6,  0x04,  0x08,  0x23,  0x22,  0xA3,
-  0xA2,  0x04,  0x28,  0x23,  0x22,  0xA3,  0xAE,  0x04,  0x02,  0x23,  0x22,  0xA3,  0xC4,  0x04,  0x42,  0x23,
-  0xF8,  0x88,  0x4A,  0x00,  0x06,  0x61,  0x00,  0xA0,  0xAE,  0x04,  0x45,  0x23,  0xF8,  0x88,  0x04,  0x98,
-  0x00,  0xA2,  0xC0,  0x04,  0xB4,  0x98,  0x00,  0x33,  0x00,  0x82,  0xC0,  0x20,  0x81,  0x62,  0xE8,  0x81,
-  0x47,  0x23,  0xF8,  0x88,  0x04,  0x01,  0x0B,  0xDE,  0x04,  0x98,  0xB4,  0x98,  0x00,  0x33,  0x00,  0x81,
-  0xC0,  0x20,  0x81,  0x62,  0x14,  0x01,  0x00,  0xA0,  0x00,  0x02,  0x43,  0x23,  0xF8,  0x88,  0x04,  0x23,
-  0xA0,  0x01,  0x44,  0x23,  0xA1,  0x01,  0x80,  0x73,  0x4D,  0x00,  0x03,  0xA3,  0xF4,  0x04,  0x00,  0x33,
-  0x27,  0x00,  0xC2,  0x88,  0x04,  0x01,  0x04,  0xDC,  0x02,  0x23,  0xA2,  0x01,  0x04,  0x23,  0xA0,  0x01,
-  0x04,  0x98,  0x26,  0x95,  0x4B,  0x00,  0xF6,  0x00,  0x4F,  0x04,  0x4F,  0x00,  0x00,  0xA3,  0x22,  0x05,
-  0x00,  0x05,  0x76,  0x00,  0x06,  0x61,  0x00,  0xA2,  0x1C,  0x05,  0x0A,  0x85,  0x46,  0x97,  0xCD,  0x04,
-  0x24,  0x85,  0x48,  0x04,  0x84,  0x80,  0x02,  0x01,  0x03,  0xDA,  0x80,  0x23,  0x82,  0x01,  0x34,  0x85,
-  0x02,  0x23,  0xA0,  0x01,  0x4A,  0x00,  0x06,  0x61,  0x00,  0xA2,  0x40,  0x05,  0x1D,  0x01,  0x04,  0xD6,
-  0xFF,  0x23,  0x86,  0x41,  0x4B,  0x60,  0xCB,  0x00,  0xFF,  0x23,  0x80,  0x01,  0x49,  0x00,  0x81,  0x01,
-  0x04,  0x01,  0x02,  0xC8,  0x30,  0x01,  0x80,  0x01,  0xF7,  0x04,  0x03,  0x01,  0x49,  0x04,  0x80,  0x01,
-  0xC9,  0x00,  0x00,  0x05,  0x00,  0x01,  0xFF,  0xA0,  0x60,  0x05,  0x77,  0x04,  0x01,  0x23,  0xEA,  0x00,
-  0x5D,  0x00,  0xFE,  0xC7,  0x00,  0x62,  0x00,  0x23,  0xEA,  0x00,  0x00,  0x63,  0x07,  0xA4,  0xF8,  0x05,
-  0x03,  0x03,  0x02,  0xA0,  0x8E,  0x05,  0xF4,  0x85,  0x00,  0x33,  0x2D,  0x00,  0xC2,  0x88,  0x04,  0xA0,
-  0xB8,  0x05,  0x80,  0x63,  0x00,  0x23,  0xDF,  0x00,  0x4A,  0x00,  0x06,  0x61,  0x00,  0xA2,  0xA4,  0x05,
-  0x1D,  0x01,  0x06,  0xD6,  0x02,  0x23,  0x02,  0x41,  0x82,  0x01,  0x50,  0x00,  0x62,  0x97,  0x04,  0x85,
-  0x04,  0x23,  0x02,  0x41,  0x82,  0x01,  0x04,  0x85,  0x08,  0xA0,  0xBE,  0x05,  0xF4,  0x85,  0x03,  0xA0,
-  0xC4,  0x05,  0xF4,  0x85,  0x01,  0xA0,  0xCE,  0x05,  0x88,  0x00,  0x80,  0x63,  0xCC,  0x86,  0x07,  0xA0,
-  0xEE,  0x05,  0x5F,  0x00,  0x00,  0x2B,  0xDF,  0x08,  0x00,  0xA2,  0xE6,  0x05,  0x80,  0x67,  0x80,  0x63,
-  0x01,  0xA2,  0x7A,  0x06,  0x7C,  0x85,  0x06,  0x23,  0x68,  0x98,  0x48,  0x23,  0xF8,  0x88,  0x07,  0x23,
-  0x80,  0x00,  0x06,  0x87,  0x80,  0x63,  0x7C,  0x85,  0x00,  0x23,  0xDF,  0x00,  0x00,  0x63,  0x4A,  0x00,
-  0x06,  0x61,  0x00,  0xA2,  0x36,  0x06,  0x1D,  0x01,  0x16,  0xD4,  0xC0,  0x23,  0x07,  0x41,  0x83,  0x03,
-  0x80,  0x63,  0x06,  0xA6,  0x1C,  0x06,  0x00,  0x33,  0x37,  0x00,  0xC2,  0x88,  0x1D,  0x01,  0x01,  0xD6,
-  0x20,  0x23,  0x63,  0x60,  0x83,  0x03,  0x80,  0x63,  0x02,  0x23,  0xDF,  0x00,  0x07,  0xA6,  0x7C,  0x05,
-  0xEF,  0x04,  0x6F,  0x00,  0x00,  0x63,  0x4B,  0x00,  0x06,  0x41,  0xCB,  0x00,  0x52,  0x00,  0x06,  0x61,
-  0x00,  0xA2,  0x4E,  0x06,  0x1D,  0x01,  0x03,  0xCA,  0xC0,  0x23,  0x07,  0x41,  0x00,  0x63,  0x1D,  0x01,
-  0x04,  0xCC,  0x00,  0x33,  0x00,  0x83,  0xC0,  0x20,  0x81,  0x62,  0x80,  0x23,  0x07,  0x41,  0x00,  0x63,
-  0x80,  0x67,  0x08,  0x23,  0x83,  0x03,  0x80,  0x63,  0x00,  0x63,  0x01,  0x23,  0xDF,  0x00,  0x06,  0xA6,
-  0x84,  0x06,  0x07,  0xA6,  0x7C,  0x05,  0x80,  0x67,  0x80,  0x63,  0x00,  0x33,  0x00,  0x40,  0xC0,  0x20,
-  0x81,  0x62,  0x00,  0x63,  0x00,  0x00,  0xFE,  0x95,  0x83,  0x03,  0x80,  0x63,  0x06,  0xA6,  0x94,  0x06,
-  0x07,  0xA6,  0x7C,  0x05,  0x00,  0x00,  0x01,  0xA0,  0x14,  0x07,  0x00,  0x2B,  0x40,  0x0E,  0x80,  0x63,
-  0x01,  0x00,  0x06,  0xA6,  0xAA,  0x06,  0x07,  0xA6,  0x7C,  0x05,  0x40,  0x0E,  0x80,  0x63,  0x00,  0x43,
-  0x00,  0xA0,  0xA2,  0x06,  0x06,  0xA6,  0xBC,  0x06,  0x07,  0xA6,  0x7C,  0x05,  0x80,  0x67,  0x40,  0x0E,
-  0x80,  0x63,  0x07,  0xA6,  0x7C,  0x05,  0x00,  0x23,  0xDF,  0x00,  0x00,  0x63,  0x07,  0xA6,  0xD6,  0x06,
-  0x00,  0x33,  0x2A,  0x00,  0xC2,  0x88,  0x03,  0x03,  0x80,  0x63,  0x89,  0x00,  0x0A,  0x2B,  0x07,  0xA6,
-  0xE8,  0x06,  0x00,  0x33,  0x29,  0x00,  0xC2,  0x88,  0x00,  0x43,  0x00,  0xA2,  0xF4,  0x06,  0xC0,  0x0E,
-  0x80,  0x63,  0xDE,  0x86,  0xC0,  0x0E,  0x00,  0x33,  0x00,  0x80,  0xC0,  0x20,  0x81,  0x62,  0x04,  0x01,
-  0x02,  0xDA,  0x80,  0x63,  0x7C,  0x85,  0x80,  0x7B,  0x80,  0x63,  0x06,  0xA6,  0x8C,  0x06,  0x00,  0x33,
-  0x2C,  0x00,  0xC2,  0x88,  0x0C,  0xA2,  0x2E,  0x07,  0xFE,  0x95,  0x83,  0x03,  0x80,  0x63,  0x06,  0xA6,
-  0x2C,  0x07,  0x07,  0xA6,  0x7C,  0x05,  0x00,  0x33,  0x3D,  0x00,  0xC2,  0x88,  0x00,  0x00,  0x80,  0x67,
-  0x83,  0x03,  0x80,  0x63,  0x0C,  0xA0,  0x44,  0x07,  0x07,  0xA6,  0x7C,  0x05,  0xBF,  0x23,  0x04,  0x61,
-  0x84,  0x01,  0xE6,  0x84,  0x00,  0x63,  0xF0,  0x04,  0x01,  0x01,  0xF1,  0x00,  0x00,  0x01,  0xF2,  0x00,
-  0x01,  0x05,  0x80,  0x01,  0x72,  0x04,  0x71,  0x00,  0x81,  0x01,  0x70,  0x04,  0x80,  0x05,  0x81,  0x05,
-  0x00,  0x63,  0xF0,  0x04,  0xF2,  0x00,  0x72,  0x04,  0x01,  0x01,  0xF1,  0x00,  0x70,  0x00,  0x81,  0x01,
-  0x70,  0x04,  0x71,  0x00,  0x81,  0x01,  0x72,  0x00,  0x80,  0x01,  0x71,  0x04,  0x70,  0x00,  0x80,  0x01,
-  0x70,  0x04,  0x00,  0x63,  0xF0,  0x04,  0xF2,  0x00,  0x72,  0x04,  0x00,  0x01,  0xF1,  0x00,  0x70,  0x00,
-  0x80,  0x01,  0x70,  0x04,  0x71,  0x00,  0x80,  0x01,  0x72,  0x00,  0x81,  0x01,  0x71,  0x04,  0x70,  0x00,
-  0x81,  0x01,  0x70,  0x04,  0x00,  0x63,  0x00,  0x23,  0xB3,  0x01,  0x83,  0x05,  0xA3,  0x01,  0xA2,  0x01,
-  0xA1,  0x01,  0x01,  0x23,  0xA0,  0x01,  0x00,  0x01,  0xC8,  0x00,  0x03,  0xA1,  0xC4,  0x07,  0x00,  0x33,
-  0x07,  0x00,  0xC2,  0x88,  0x80,  0x05,  0x81,  0x05,  0x04,  0x01,  0x11,  0xC8,  0x48,  0x00,  0xB0,  0x01,
-  0xB1,  0x01,  0x08,  0x23,  0xB2,  0x01,  0x05,  0x01,  0x48,  0x04,  0x00,  0x43,  0x00,  0xA2,  0xE4,  0x07,
-  0x00,  0x05,  0xDA,  0x87,  0x00,  0x01,  0xC8,  0x00,  0xFF,  0x23,  0x80,  0x01,  0x05,  0x05,  0x00,  0x63,
-  0xF7,  0x04,  0x1A,  0x09,  0xF6,  0x08,  0x6E,  0x04,  0x00,  0x02,  0x80,  0x43,  0x76,  0x08,  0x80,  0x02,
-  0x77,  0x04,  0x00,  0x63,  0xF7,  0x04,  0x1A,  0x09,  0xF6,  0x08,  0x6E,  0x04,  0x00,  0x02,  0x00,  0xA0,
-  0x14,  0x08,  0x16,  0x88,  0x00,  0x43,  0x76,  0x08,  0x80,  0x02,  0x77,  0x04,  0x00,  0x63,  0xF3,  0x04,
-  0x00,  0x23,  0xF4,  0x00,  0x74,  0x00,  0x80,  0x43,  0xF4,  0x00,  0xCF,  0x40,  0x00,  0xA2,  0x44,  0x08,
-  0x74,  0x04,  0x02,  0x01,  0xF7,  0xC9,  0xF6,  0xD9,  0x00,  0x01,  0x01,  0xA1,  0x24,  0x08,  0x04,  0x98,
-  0x26,  0x95,  0x24,  0x88,  0x73,  0x04,  0x00,  0x63,  0xF3,  0x04,  0x75,  0x04,  0x5A,  0x88,  0x02,  0x01,
-  0x04,  0xD8,  0x46,  0x97,  0x04,  0x98,  0x26,  0x95,  0x4A,  0x88,  0x75,  0x00,  0x00,  0xA3,  0x64,  0x08,
-  0x00,  0x05,  0x4E,  0x88,  0x73,  0x04,  0x00,  0x63,  0x80,  0x7B,  0x80,  0x63,  0x06,  0xA6,  0x76,  0x08,
-  0x00,  0x33,  0x3E,  0x00,  0xC2,  0x88,  0x80,  0x67,  0x83,  0x03,  0x80,  0x63,  0x00,  0x63,  0x38,  0x2B,
-  0x9C,  0x88,  0x38,  0x2B,  0x92,  0x88,  0x32,  0x09,  0x31,  0x05,  0x92,  0x98,  0x05,  0x05,  0xB2,  0x09,
-  0x00,  0x63,  0x00,  0x32,  0x00,  0x36,  0x00,  0x3A,  0x00,  0x3E,  0x00,  0x63,  0x80,  0x32,  0x80,  0x36,
-  0x80,  0x3A,  0x80,  0x3E,  0xB4,  0x3D,  0x00,  0x63,  0x38,  0x2B,  0x40,  0x32,  0x40,  0x36,  0x40,  0x3A,
-  0x40,  0x3E,  0x00,  0x63,  0x5A,  0x20,  0xC9,  0x40,  0x00,  0xA0,  0xB4,  0x08,  0x5D,  0x00,  0xFE,  0xC3,
-  0x00,  0x63,  0x80,  0x73,  0xE6,  0x20,  0x02,  0x23,  0xE8,  0x00,  0x82,  0x73,  0xFF,  0xFD,  0x80,  0x73,
-  0x13,  0x23,  0xF8,  0x88,  0x66,  0x20,  0xC0,  0x20,  0x04,  0x23,  0xA0,  0x01,  0xA1,  0x23,  0xA1,  0x01,
-  0x81,  0x62,  0xE2,  0x88,  0x80,  0x73,  0x80,  0x77,  0x68,  0x00,  0x00,  0xA2,  0x80,  0x00,  0x03,  0xC2,
-  0xF1,  0xC7,  0x41,  0x23,  0xF8,  0x88,  0x11,  0x23,  0xA1,  0x01,  0x04,  0x23,  0xA0,  0x01,  0xE6,  0x84,
+static uchar _asc_mcode_buf[] = {
+       0x01, 0x03, 0x01, 0x19, 0x0F, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x0F, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0xC3, 0x12, 0x0D, 0x05, 0x01, 0x00, 0x00, 0x00,
+       0x00, 0xFF, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00, 0xFF, 0x80, 0xFF, 0xFF, 0x01, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x00,
+       0x00, 0x00, 0x00, 0x23, 0x00, 0x00, 0x00, 0x00, 0x00, 0x07, 0x00, 0xFF,
+       0x00, 0x00, 0x00, 0x00,
+       0xFF, 0xFF, 0xFF, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xE4, 0x88,
+       0x00, 0x00, 0x00, 0x00,
+       0x80, 0x73, 0x48, 0x04, 0x36, 0x00, 0x00, 0xA2, 0xC2, 0x00, 0x80, 0x73,
+       0x03, 0x23, 0x36, 0x40,
+       0xB6, 0x00, 0x36, 0x00, 0x05, 0xD6, 0x0C, 0xD2, 0x12, 0xDA, 0x00, 0xA2,
+       0xC2, 0x00, 0x92, 0x80,
+       0x1E, 0x98, 0x50, 0x00, 0xF5, 0x00, 0x48, 0x98, 0xDF, 0x23, 0x36, 0x60,
+       0xB6, 0x00, 0x92, 0x80,
+       0x4F, 0x00, 0xF5, 0x00, 0x48, 0x98, 0xEF, 0x23, 0x36, 0x60, 0xB6, 0x00,
+       0x92, 0x80, 0x80, 0x62,
+       0x92, 0x80, 0x00, 0x46, 0x15, 0xEE, 0x13, 0xEA, 0x02, 0x01, 0x09, 0xD8,
+       0xCD, 0x04, 0x4D, 0x00,
+       0x00, 0xA3, 0xD6, 0x00, 0xA6, 0x97, 0x7F, 0x23, 0x04, 0x61, 0x84, 0x01,
+       0xE6, 0x84, 0xD2, 0xC1,
+       0x80, 0x73, 0xCD, 0x04, 0x4D, 0x00, 0x00, 0xA3, 0xDA, 0x01, 0xA6, 0x97,
+       0xC6, 0x81, 0xC2, 0x88,
+       0x80, 0x73, 0x80, 0x77, 0x00, 0x01, 0x01, 0xA1, 0xFE, 0x00, 0x4F, 0x00,
+       0x84, 0x97, 0x07, 0xA6,
+       0x08, 0x01, 0x00, 0x33, 0x03, 0x00, 0xC2, 0x88, 0x03, 0x03, 0x01, 0xDE,
+       0xC2, 0x88, 0xCE, 0x00,
+       0x69, 0x60, 0xCE, 0x00, 0x02, 0x03, 0x4A, 0x60, 0x00, 0xA2, 0x78, 0x01,
+       0x80, 0x63, 0x07, 0xA6,
+       0x24, 0x01, 0x78, 0x81, 0x03, 0x03, 0x80, 0x63, 0xE2, 0x00, 0x07, 0xA6,
+       0x34, 0x01, 0x00, 0x33,
+       0x04, 0x00, 0xC2, 0x88, 0x03, 0x07, 0x02, 0x01, 0x04, 0xCA, 0x0D, 0x23,
+       0x68, 0x98, 0x4D, 0x04,
+       0x04, 0x85, 0x05, 0xD8, 0x0D, 0x23, 0x68, 0x98, 0xCD, 0x04, 0x15, 0x23,
+       0xF8, 0x88, 0xFB, 0x23,
+       0x02, 0x61, 0x82, 0x01, 0x80, 0x63, 0x02, 0x03, 0x06, 0xA3, 0x62, 0x01,
+       0x00, 0x33, 0x0A, 0x00,
+       0xC2, 0x88, 0x4E, 0x00, 0x07, 0xA3, 0x6E, 0x01, 0x00, 0x33, 0x0B, 0x00,
+       0xC2, 0x88, 0xCD, 0x04,
+       0x36, 0x2D, 0x00, 0x33, 0x1A, 0x00, 0xC2, 0x88, 0x50, 0x04, 0x88, 0x81,
+       0x06, 0xAB, 0x82, 0x01,
+       0x88, 0x81, 0x4E, 0x00, 0x07, 0xA3, 0x92, 0x01, 0x50, 0x00, 0x00, 0xA3,
+       0x3C, 0x01, 0x00, 0x05,
+       0x7C, 0x81, 0x46, 0x97, 0x02, 0x01, 0x05, 0xC6, 0x04, 0x23, 0xA0, 0x01,
+       0x15, 0x23, 0xA1, 0x01,
+       0xBE, 0x81, 0xFD, 0x23, 0x02, 0x61, 0x82, 0x01, 0x0A, 0xDA, 0x4A, 0x00,
+       0x06, 0x61, 0x00, 0xA0,
+       0xB4, 0x01, 0x80, 0x63, 0xCD, 0x04, 0x36, 0x2D, 0x00, 0x33, 0x1B, 0x00,
+       0xC2, 0x88, 0x06, 0x23,
+       0x68, 0x98, 0xCD, 0x04, 0xE6, 0x84, 0x06, 0x01, 0x00, 0xA2, 0xD4, 0x01,
+       0x57, 0x60, 0x00, 0xA0,
+       0xDA, 0x01, 0xE6, 0x84, 0x80, 0x23, 0xA0, 0x01, 0xE6, 0x84, 0x80, 0x73,
+       0x4B, 0x00, 0x06, 0x61,
+       0x00, 0xA2, 0x00, 0x02, 0x04, 0x01, 0x0C, 0xDE, 0x02, 0x01, 0x03, 0xCC,
+       0x4F, 0x00, 0x84, 0x97,
+       0xFC, 0x81, 0x08, 0x23, 0x02, 0x41, 0x82, 0x01, 0x4F, 0x00, 0x62, 0x97,
+       0x48, 0x04, 0x84, 0x80,
+       0xF0, 0x97, 0x00, 0x46, 0x56, 0x00, 0x03, 0xC0, 0x01, 0x23, 0xE8, 0x00,
+       0x81, 0x73, 0x06, 0x29,
+       0x03, 0x42, 0x06, 0xE2, 0x03, 0xEE, 0x6B, 0xEB, 0x11, 0x23, 0xF8, 0x88,
+       0x04, 0x98, 0xF0, 0x80,
+       0x80, 0x73, 0x80, 0x77, 0x07, 0xA4, 0x2A, 0x02, 0x7C, 0x95, 0x06, 0xA6,
+       0x34, 0x02, 0x03, 0xA6,
+       0x4C, 0x04, 0x46, 0x82, 0x04, 0x01, 0x03, 0xD8, 0xB4, 0x98, 0x6A, 0x96,
+       0x46, 0x82, 0xFE, 0x95,
+       0x80, 0x67, 0x83, 0x03, 0x80, 0x63, 0xB6, 0x2D, 0x02, 0xA6, 0x6C, 0x02,
+       0x07, 0xA6, 0x5A, 0x02,
+       0x06, 0xA6, 0x5E, 0x02, 0x03, 0xA6, 0x62, 0x02, 0xC2, 0x88, 0x7C, 0x95,
+       0x48, 0x82, 0x60, 0x96,
+       0x48, 0x82, 0x04, 0x23, 0xA0, 0x01, 0x14, 0x23, 0xA1, 0x01, 0x3C, 0x84,
+       0x04, 0x01, 0x0C, 0xDC,
+       0xE0, 0x23, 0x25, 0x61, 0xEF, 0x00, 0x14, 0x01, 0x4F, 0x04, 0xA8, 0x01,
+       0x6F, 0x00, 0xA5, 0x01,
+       0x03, 0x23, 0xA4, 0x01, 0x06, 0x23, 0x9C, 0x01, 0x24, 0x2B, 0x1C, 0x01,
+       0x02, 0xA6, 0xAA, 0x02,
+       0x07, 0xA6, 0x5A, 0x02, 0x06, 0xA6, 0x5E, 0x02, 0x03, 0xA6, 0x20, 0x04,
+       0x01, 0xA6, 0xB4, 0x02,
+       0x00, 0xA6, 0xB4, 0x02, 0x00, 0x33, 0x12, 0x00, 0xC2, 0x88, 0x00, 0x0E,
+       0x80, 0x63, 0x00, 0x43,
+       0x00, 0xA0, 0x8C, 0x02, 0x4D, 0x04, 0x04, 0x01, 0x0B, 0xDC, 0xE7, 0x23,
+       0x04, 0x61, 0x84, 0x01,
+       0x10, 0x31, 0x12, 0x35, 0x14, 0x01, 0xEC, 0x00, 0x6C, 0x38, 0x00, 0x3F,
+       0x00, 0x00, 0xEA, 0x82,
+       0x18, 0x23, 0x04, 0x61, 0x18, 0xA0, 0xE2, 0x02, 0x04, 0x01, 0xA2, 0xC8,
+       0x00, 0x33, 0x1F, 0x00,
+       0xC2, 0x88, 0x08, 0x31, 0x0A, 0x35, 0x0C, 0x39, 0x0E, 0x3D, 0x7E, 0x98,
+       0xB6, 0x2D, 0x01, 0xA6,
+       0x14, 0x03, 0x00, 0xA6, 0x14, 0x03, 0x07, 0xA6, 0x0C, 0x03, 0x06, 0xA6,
+       0x10, 0x03, 0x03, 0xA6,
+       0x20, 0x04, 0x02, 0xA6, 0x6C, 0x02, 0x00, 0x33, 0x33, 0x00, 0xC2, 0x88,
+       0x7C, 0x95, 0xEE, 0x82,
+       0x60, 0x96, 0xEE, 0x82, 0x82, 0x98, 0x80, 0x42, 0x7E, 0x98, 0x64, 0xE4,
+       0x04, 0x01, 0x2D, 0xC8,
+       0x31, 0x05, 0x07, 0x01, 0x00, 0xA2, 0x54, 0x03, 0x00, 0x43, 0x87, 0x01,
+       0x05, 0x05, 0x86, 0x98,
+       0x7E, 0x98, 0x00, 0xA6, 0x16, 0x03, 0x07, 0xA6, 0x4C, 0x03, 0x03, 0xA6,
+       0x3C, 0x04, 0x06, 0xA6,
+       0x50, 0x03, 0x01, 0xA6, 0x16, 0x03, 0x00, 0x33, 0x25, 0x00, 0xC2, 0x88,
+       0x7C, 0x95, 0x32, 0x83,
+       0x60, 0x96, 0x32, 0x83, 0x04, 0x01, 0x10, 0xCE, 0x07, 0xC8, 0x05, 0x05,
+       0xEB, 0x04, 0x00, 0x33,
+       0x00, 0x20, 0xC0, 0x20, 0x81, 0x62, 0x72, 0x83, 0x00, 0x01, 0x05, 0x05,
+       0xFF, 0xA2, 0x7A, 0x03,
+       0xB1, 0x01, 0x08, 0x23, 0xB2, 0x01, 0x2E, 0x83, 0x05, 0x05, 0x15, 0x01,
+       0x00, 0xA2, 0x9A, 0x03,
+       0xEC, 0x00, 0x6E, 0x00, 0x95, 0x01, 0x6C, 0x38, 0x00, 0x3F, 0x00, 0x00,
+       0x01, 0xA6, 0x96, 0x03,
+       0x00, 0xA6, 0x96, 0x03, 0x10, 0x84, 0x80, 0x42, 0x7E, 0x98, 0x01, 0xA6,
+       0xA4, 0x03, 0x00, 0xA6,
+       0xBC, 0x03, 0x10, 0x84, 0xA8, 0x98, 0x80, 0x42, 0x01, 0xA6, 0xA4, 0x03,
+       0x07, 0xA6, 0xB2, 0x03,
+       0xD4, 0x83, 0x7C, 0x95, 0xA8, 0x83, 0x00, 0x33, 0x2F, 0x00, 0xC2, 0x88,
+       0xA8, 0x98, 0x80, 0x42,
+       0x00, 0xA6, 0xBC, 0x03, 0x07, 0xA6, 0xCA, 0x03, 0xD4, 0x83, 0x7C, 0x95,
+       0xC0, 0x83, 0x00, 0x33,
+       0x26, 0x00, 0xC2, 0x88, 0x38, 0x2B, 0x80, 0x32, 0x80, 0x36, 0x04, 0x23,
+       0xA0, 0x01, 0x12, 0x23,
+       0xA1, 0x01, 0x10, 0x84, 0x07, 0xF0, 0x06, 0xA4, 0xF4, 0x03, 0x80, 0x6B,
+       0x80, 0x67, 0x05, 0x23,
+       0x83, 0x03, 0x80, 0x63, 0x03, 0xA6, 0x0E, 0x04, 0x07, 0xA6, 0x06, 0x04,
+       0x06, 0xA6, 0x0A, 0x04,
+       0x00, 0x33, 0x17, 0x00, 0xC2, 0x88, 0x7C, 0x95, 0xF4, 0x83, 0x60, 0x96,
+       0xF4, 0x83, 0x20, 0x84,
+       0x07, 0xF0, 0x06, 0xA4, 0x20, 0x04, 0x80, 0x6B, 0x80, 0x67, 0x05, 0x23,
+       0x83, 0x03, 0x80, 0x63,
+       0xB6, 0x2D, 0x03, 0xA6, 0x3C, 0x04, 0x07, 0xA6, 0x34, 0x04, 0x06, 0xA6,
+       0x38, 0x04, 0x00, 0x33,
+       0x30, 0x00, 0xC2, 0x88, 0x7C, 0x95, 0x20, 0x84, 0x60, 0x96, 0x20, 0x84,
+       0x1D, 0x01, 0x06, 0xCC,
+       0x00, 0x33, 0x00, 0x84, 0xC0, 0x20, 0x00, 0x23, 0xEA, 0x00, 0x81, 0x62,
+       0xA2, 0x0D, 0x80, 0x63,
+       0x07, 0xA6, 0x5A, 0x04, 0x00, 0x33, 0x18, 0x00, 0xC2, 0x88, 0x03, 0x03,
+       0x80, 0x63, 0xA3, 0x01,
+       0x07, 0xA4, 0x64, 0x04, 0x23, 0x01, 0x00, 0xA2, 0x86, 0x04, 0x0A, 0xA0,
+       0x76, 0x04, 0xE0, 0x00,
+       0x00, 0x33, 0x1D, 0x00, 0xC2, 0x88, 0x0B, 0xA0, 0x82, 0x04, 0xE0, 0x00,
+       0x00, 0x33, 0x1E, 0x00,
+       0xC2, 0x88, 0x42, 0x23, 0xF8, 0x88, 0x00, 0x23, 0x22, 0xA3, 0xE6, 0x04,
+       0x08, 0x23, 0x22, 0xA3,
+       0xA2, 0x04, 0x28, 0x23, 0x22, 0xA3, 0xAE, 0x04, 0x02, 0x23, 0x22, 0xA3,
+       0xC4, 0x04, 0x42, 0x23,
+       0xF8, 0x88, 0x4A, 0x00, 0x06, 0x61, 0x00, 0xA0, 0xAE, 0x04, 0x45, 0x23,
+       0xF8, 0x88, 0x04, 0x98,
+       0x00, 0xA2, 0xC0, 0x04, 0xB4, 0x98, 0x00, 0x33, 0x00, 0x82, 0xC0, 0x20,
+       0x81, 0x62, 0xE8, 0x81,
+       0x47, 0x23, 0xF8, 0x88, 0x04, 0x01, 0x0B, 0xDE, 0x04, 0x98, 0xB4, 0x98,
+       0x00, 0x33, 0x00, 0x81,
+       0xC0, 0x20, 0x81, 0x62, 0x14, 0x01, 0x00, 0xA0, 0x00, 0x02, 0x43, 0x23,
+       0xF8, 0x88, 0x04, 0x23,
+       0xA0, 0x01, 0x44, 0x23, 0xA1, 0x01, 0x80, 0x73, 0x4D, 0x00, 0x03, 0xA3,
+       0xF4, 0x04, 0x00, 0x33,
+       0x27, 0x00, 0xC2, 0x88, 0x04, 0x01, 0x04, 0xDC, 0x02, 0x23, 0xA2, 0x01,
+       0x04, 0x23, 0xA0, 0x01,
+       0x04, 0x98, 0x26, 0x95, 0x4B, 0x00, 0xF6, 0x00, 0x4F, 0x04, 0x4F, 0x00,
+       0x00, 0xA3, 0x22, 0x05,
+       0x00, 0x05, 0x76, 0x00, 0x06, 0x61, 0x00, 0xA2, 0x1C, 0x05, 0x0A, 0x85,
+       0x46, 0x97, 0xCD, 0x04,
+       0x24, 0x85, 0x48, 0x04, 0x84, 0x80, 0x02, 0x01, 0x03, 0xDA, 0x80, 0x23,
+       0x82, 0x01, 0x34, 0x85,
+       0x02, 0x23, 0xA0, 0x01, 0x4A, 0x00, 0x06, 0x61, 0x00, 0xA2, 0x40, 0x05,
+       0x1D, 0x01, 0x04, 0xD6,
+       0xFF, 0x23, 0x86, 0x41, 0x4B, 0x60, 0xCB, 0x00, 0xFF, 0x23, 0x80, 0x01,
+       0x49, 0x00, 0x81, 0x01,
+       0x04, 0x01, 0x02, 0xC8, 0x30, 0x01, 0x80, 0x01, 0xF7, 0x04, 0x03, 0x01,
+       0x49, 0x04, 0x80, 0x01,
+       0xC9, 0x00, 0x00, 0x05, 0x00, 0x01, 0xFF, 0xA0, 0x60, 0x05, 0x77, 0x04,
+       0x01, 0x23, 0xEA, 0x00,
+       0x5D, 0x00, 0xFE, 0xC7, 0x00, 0x62, 0x00, 0x23, 0xEA, 0x00, 0x00, 0x63,
+       0x07, 0xA4, 0xF8, 0x05,
+       0x03, 0x03, 0x02, 0xA0, 0x8E, 0x05, 0xF4, 0x85, 0x00, 0x33, 0x2D, 0x00,
+       0xC2, 0x88, 0x04, 0xA0,
+       0xB8, 0x05, 0x80, 0x63, 0x00, 0x23, 0xDF, 0x00, 0x4A, 0x00, 0x06, 0x61,
+       0x00, 0xA2, 0xA4, 0x05,
+       0x1D, 0x01, 0x06, 0xD6, 0x02, 0x23, 0x02, 0x41, 0x82, 0x01, 0x50, 0x00,
+       0x62, 0x97, 0x04, 0x85,
+       0x04, 0x23, 0x02, 0x41, 0x82, 0x01, 0x04, 0x85, 0x08, 0xA0, 0xBE, 0x05,
+       0xF4, 0x85, 0x03, 0xA0,
+       0xC4, 0x05, 0xF4, 0x85, 0x01, 0xA0, 0xCE, 0x05, 0x88, 0x00, 0x80, 0x63,
+       0xCC, 0x86, 0x07, 0xA0,
+       0xEE, 0x05, 0x5F, 0x00, 0x00, 0x2B, 0xDF, 0x08, 0x00, 0xA2, 0xE6, 0x05,
+       0x80, 0x67, 0x80, 0x63,
+       0x01, 0xA2, 0x7A, 0x06, 0x7C, 0x85, 0x06, 0x23, 0x68, 0x98, 0x48, 0x23,
+       0xF8, 0x88, 0x07, 0x23,
+       0x80, 0x00, 0x06, 0x87, 0x80, 0x63, 0x7C, 0x85, 0x00, 0x23, 0xDF, 0x00,
+       0x00, 0x63, 0x4A, 0x00,
+       0x06, 0x61, 0x00, 0xA2, 0x36, 0x06, 0x1D, 0x01, 0x16, 0xD4, 0xC0, 0x23,
+       0x07, 0x41, 0x83, 0x03,
+       0x80, 0x63, 0x06, 0xA6, 0x1C, 0x06, 0x00, 0x33, 0x37, 0x00, 0xC2, 0x88,
+       0x1D, 0x01, 0x01, 0xD6,
+       0x20, 0x23, 0x63, 0x60, 0x83, 0x03, 0x80, 0x63, 0x02, 0x23, 0xDF, 0x00,
+       0x07, 0xA6, 0x7C, 0x05,
+       0xEF, 0x04, 0x6F, 0x00, 0x00, 0x63, 0x4B, 0x00, 0x06, 0x41, 0xCB, 0x00,
+       0x52, 0x00, 0x06, 0x61,
+       0x00, 0xA2, 0x4E, 0x06, 0x1D, 0x01, 0x03, 0xCA, 0xC0, 0x23, 0x07, 0x41,
+       0x00, 0x63, 0x1D, 0x01,
+       0x04, 0xCC, 0x00, 0x33, 0x00, 0x83, 0xC0, 0x20, 0x81, 0x62, 0x80, 0x23,
+       0x07, 0x41, 0x00, 0x63,
+       0x80, 0x67, 0x08, 0x23, 0x83, 0x03, 0x80, 0x63, 0x00, 0x63, 0x01, 0x23,
+       0xDF, 0x00, 0x06, 0xA6,
+       0x84, 0x06, 0x07, 0xA6, 0x7C, 0x05, 0x80, 0x67, 0x80, 0x63, 0x00, 0x33,
+       0x00, 0x40, 0xC0, 0x20,
+       0x81, 0x62, 0x00, 0x63, 0x00, 0x00, 0xFE, 0x95, 0x83, 0x03, 0x80, 0x63,
+       0x06, 0xA6, 0x94, 0x06,
+       0x07, 0xA6, 0x7C, 0x05, 0x00, 0x00, 0x01, 0xA0, 0x14, 0x07, 0x00, 0x2B,
+       0x40, 0x0E, 0x80, 0x63,
+       0x01, 0x00, 0x06, 0xA6, 0xAA, 0x06, 0x07, 0xA6, 0x7C, 0x05, 0x40, 0x0E,
+       0x80, 0x63, 0x00, 0x43,
+       0x00, 0xA0, 0xA2, 0x06, 0x06, 0xA6, 0xBC, 0x06, 0x07, 0xA6, 0x7C, 0x05,
+       0x80, 0x67, 0x40, 0x0E,
+       0x80, 0x63, 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x23, 0xDF, 0x00, 0x00, 0x63,
+       0x07, 0xA6, 0xD6, 0x06,
+       0x00, 0x33, 0x2A, 0x00, 0xC2, 0x88, 0x03, 0x03, 0x80, 0x63, 0x89, 0x00,
+       0x0A, 0x2B, 0x07, 0xA6,
+       0xE8, 0x06, 0x00, 0x33, 0x29, 0x00, 0xC2, 0x88, 0x00, 0x43, 0x00, 0xA2,
+       0xF4, 0x06, 0xC0, 0x0E,
+       0x80, 0x63, 0xDE, 0x86, 0xC0, 0x0E, 0x00, 0x33, 0x00, 0x80, 0xC0, 0x20,
+       0x81, 0x62, 0x04, 0x01,
+       0x02, 0xDA, 0x80, 0x63, 0x7C, 0x85, 0x80, 0x7B, 0x80, 0x63, 0x06, 0xA6,
+       0x8C, 0x06, 0x00, 0x33,
+       0x2C, 0x00, 0xC2, 0x88, 0x0C, 0xA2, 0x2E, 0x07, 0xFE, 0x95, 0x83, 0x03,
+       0x80, 0x63, 0x06, 0xA6,
+       0x2C, 0x07, 0x07, 0xA6, 0x7C, 0x05, 0x00, 0x33, 0x3D, 0x00, 0xC2, 0x88,
+       0x00, 0x00, 0x80, 0x67,
+       0x83, 0x03, 0x80, 0x63, 0x0C, 0xA0, 0x44, 0x07, 0x07, 0xA6, 0x7C, 0x05,
+       0xBF, 0x23, 0x04, 0x61,
+       0x84, 0x01, 0xE6, 0x84, 0x00, 0x63, 0xF0, 0x04, 0x01, 0x01, 0xF1, 0x00,
+       0x00, 0x01, 0xF2, 0x00,
+       0x01, 0x05, 0x80, 0x01, 0x72, 0x04, 0x71, 0x00, 0x81, 0x01, 0x70, 0x04,
+       0x80, 0x05, 0x81, 0x05,
+       0x00, 0x63, 0xF0, 0x04, 0xF2, 0x00, 0x72, 0x04, 0x01, 0x01, 0xF1, 0x00,
+       0x70, 0x00, 0x81, 0x01,
+       0x70, 0x04, 0x71, 0x00, 0x81, 0x01, 0x72, 0x00, 0x80, 0x01, 0x71, 0x04,
+       0x70, 0x00, 0x80, 0x01,
+       0x70, 0x04, 0x00, 0x63, 0xF0, 0x04, 0xF2, 0x00, 0x72, 0x04, 0x00, 0x01,
+       0xF1, 0x00, 0x70, 0x00,
+       0x80, 0x01, 0x70, 0x04, 0x71, 0x00, 0x80, 0x01, 0x72, 0x00, 0x81, 0x01,
+       0x71, 0x04, 0x70, 0x00,
+       0x81, 0x01, 0x70, 0x04, 0x00, 0x63, 0x00, 0x23, 0xB3, 0x01, 0x83, 0x05,
+       0xA3, 0x01, 0xA2, 0x01,
+       0xA1, 0x01, 0x01, 0x23, 0xA0, 0x01, 0x00, 0x01, 0xC8, 0x00, 0x03, 0xA1,
+       0xC4, 0x07, 0x00, 0x33,
+       0x07, 0x00, 0xC2, 0x88, 0x80, 0x05, 0x81, 0x05, 0x04, 0x01, 0x11, 0xC8,
+       0x48, 0x00, 0xB0, 0x01,
+       0xB1, 0x01, 0x08, 0x23, 0xB2, 0x01, 0x05, 0x01, 0x48, 0x04, 0x00, 0x43,
+       0x00, 0xA2, 0xE4, 0x07,
+       0x00, 0x05, 0xDA, 0x87, 0x00, 0x01, 0xC8, 0x00, 0xFF, 0x23, 0x80, 0x01,
+       0x05, 0x05, 0x00, 0x63,
+       0xF7, 0x04, 0x1A, 0x09, 0xF6, 0x08, 0x6E, 0x04, 0x00, 0x02, 0x80, 0x43,
+       0x76, 0x08, 0x80, 0x02,
+       0x77, 0x04, 0x00, 0x63, 0xF7, 0x04, 0x1A, 0x09, 0xF6, 0x08, 0x6E, 0x04,
+       0x00, 0x02, 0x00, 0xA0,
+       0x14, 0x08, 0x16, 0x88, 0x00, 0x43, 0x76, 0x08, 0x80, 0x02, 0x77, 0x04,
+       0x00, 0x63, 0xF3, 0x04,
+       0x00, 0x23, 0xF4, 0x00, 0x74, 0x00, 0x80, 0x43, 0xF4, 0x00, 0xCF, 0x40,
+       0x00, 0xA2, 0x44, 0x08,
+       0x74, 0x04, 0x02, 0x01, 0xF7, 0xC9, 0xF6, 0xD9, 0x00, 0x01, 0x01, 0xA1,
+       0x24, 0x08, 0x04, 0x98,
+       0x26, 0x95, 0x24, 0x88, 0x73, 0x04, 0x00, 0x63, 0xF3, 0x04, 0x75, 0x04,
+       0x5A, 0x88, 0x02, 0x01,
+       0x04, 0xD8, 0x46, 0x97, 0x04, 0x98, 0x26, 0x95, 0x4A, 0x88, 0x75, 0x00,
+       0x00, 0xA3, 0x64, 0x08,
+       0x00, 0x05, 0x4E, 0x88, 0x73, 0x04, 0x00, 0x63, 0x80, 0x7B, 0x80, 0x63,
+       0x06, 0xA6, 0x76, 0x08,
+       0x00, 0x33, 0x3E, 0x00, 0xC2, 0x88, 0x80, 0x67, 0x83, 0x03, 0x80, 0x63,
+       0x00, 0x63, 0x38, 0x2B,
+       0x9C, 0x88, 0x38, 0x2B, 0x92, 0x88, 0x32, 0x09, 0x31, 0x05, 0x92, 0x98,
+       0x05, 0x05, 0xB2, 0x09,
+       0x00, 0x63, 0x00, 0x32, 0x00, 0x36, 0x00, 0x3A, 0x00, 0x3E, 0x00, 0x63,
+       0x80, 0x32, 0x80, 0x36,
+       0x80, 0x3A, 0x80, 0x3E, 0xB4, 0x3D, 0x00, 0x63, 0x38, 0x2B, 0x40, 0x32,
+       0x40, 0x36, 0x40, 0x3A,
+       0x40, 0x3E, 0x00, 0x63, 0x5A, 0x20, 0xC9, 0x40, 0x00, 0xA0, 0xB4, 0x08,
+       0x5D, 0x00, 0xFE, 0xC3,
+       0x00, 0x63, 0x80, 0x73, 0xE6, 0x20, 0x02, 0x23, 0xE8, 0x00, 0x82, 0x73,
+       0xFF, 0xFD, 0x80, 0x73,
+       0x13, 0x23, 0xF8, 0x88, 0x66, 0x20, 0xC0, 0x20, 0x04, 0x23, 0xA0, 0x01,
+       0xA1, 0x23, 0xA1, 0x01,
+       0x81, 0x62, 0xE2, 0x88, 0x80, 0x73, 0x80, 0x77, 0x68, 0x00, 0x00, 0xA2,
+       0x80, 0x00, 0x03, 0xC2,
+       0xF1, 0xC7, 0x41, 0x23, 0xF8, 0x88, 0x11, 0x23, 0xA1, 0x01, 0x04, 0x23,
+       0xA0, 0x01, 0xE6, 0x84,
 };
 
-STATIC ushort _asc_mcode_size = sizeof(_asc_mcode_buf);
-STATIC ADV_DCNT _asc_mcode_chksum = 0x012C453FUL;
+static ushort _asc_mcode_size = sizeof(_asc_mcode_buf);
+static ADV_DCNT _asc_mcode_chksum = 0x012C453FUL;
 
 #define ASC_SYN_OFFSET_ONE_DISABLE_LIST  16
-STATIC uchar _syn_offset_one_disable_cmd[ASC_SYN_OFFSET_ONE_DISABLE_LIST] =
-{
-    INQUIRY,
-    REQUEST_SENSE,
-    READ_CAPACITY,
-    READ_TOC,
-    MODE_SELECT,
-    MODE_SENSE,
-    MODE_SELECT_10,
-    MODE_SENSE_10,
-    0xFF,
-    0xFF,
-    0xFF,
-    0xFF,
-    0xFF,
-    0xFF,
-    0xFF,
-    0xFF
+static uchar _syn_offset_one_disable_cmd[ASC_SYN_OFFSET_ONE_DISABLE_LIST] = {
+       INQUIRY,
+       REQUEST_SENSE,
+       READ_CAPACITY,
+       READ_TOC,
+       MODE_SELECT,
+       MODE_SENSE,
+       MODE_SELECT_10,
+       MODE_SENSE_10,
+       0xFF,
+       0xFF,
+       0xFF,
+       0xFF,
+       0xFF,
+       0xFF,
+       0xFF,
+       0xFF
 };
 
-STATIC int
-AscExeScsiQueue(
-                   ASC_DVC_VAR *asc_dvc,
-                   ASC_SCSI_Q *scsiq
-)
+static int AscExeScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq)
 {
-    PortAddr            iop_base;
-    ulong               last_int_level;
-    int                 sta;
-    int                 n_q_required;
-    int                 disable_syn_offset_one_fix;
-    int                 i;
-    ASC_PADDR           addr;
-    ASC_EXE_CALLBACK    asc_exe_callback;
-    ushort              sg_entry_cnt = 0;
-    ushort              sg_entry_cnt_minus_one = 0;
-    uchar               target_ix;
-    uchar               tid_no;
-    uchar               sdtr_data;
-    uchar               extra_bytes;
-    uchar               scsi_cmd;
-    uchar               disable_cmd;
-    ASC_SG_HEAD         *sg_head;
-    ASC_DCNT            data_cnt;
-
-    iop_base = asc_dvc->iop_base;
-    sg_head = scsiq->sg_head;
-    asc_exe_callback = asc_dvc->exe_callback;
-    if (asc_dvc->err_code != 0)
-        return (ERR);
-    if (scsiq == (ASC_SCSI_Q *) 0L) {
-        AscSetLibErrorCode(asc_dvc, ASCQ_ERR_SCSIQ_NULL_PTR);
-        return (ERR);
-    }
-    scsiq->q1.q_no = 0;
-    if ((scsiq->q2.tag_code & ASC_TAG_FLAG_EXTRA_BYTES) == 0) {
-        scsiq->q1.extra_bytes = 0;
-    }
-    sta = 0;
-    target_ix = scsiq->q2.target_ix;
-    tid_no = ASC_TIX_TO_TID(target_ix);
-    n_q_required = 1;
-    if (scsiq->cdbptr[0] == REQUEST_SENSE) {
-        if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) {
-            asc_dvc->sdtr_done &= ~scsiq->q1.target_id;
-            sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no);
-            AscMsgOutSDTR(asc_dvc,
-                          asc_dvc->sdtr_period_tbl[(sdtr_data >> 4) &
-                          (uchar) (asc_dvc->max_sdtr_index - 1)],
-                          (uchar) (sdtr_data & (uchar) ASC_SYN_MAX_OFFSET));
-            scsiq->q1.cntl |= (QC_MSG_OUT | QC_URGENT);
-        }
-    }
-    last_int_level = DvcEnterCritical();
-    if (asc_dvc->in_critical_cnt != 0) {
-        DvcLeaveCritical(last_int_level);
-        AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CRITICAL_RE_ENTRY);
-        return (ERR);
-    }
-    asc_dvc->in_critical_cnt++;
-    if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) {
-        if ((sg_entry_cnt = sg_head->entry_cnt) == 0) {
-            asc_dvc->in_critical_cnt--;
-            DvcLeaveCritical(last_int_level);
-            return (ERR);
-        }
+       PortAddr iop_base;
+       ulong last_int_level;
+       int sta;
+       int n_q_required;
+       int disable_syn_offset_one_fix;
+       int i;
+       ASC_PADDR addr;
+       ASC_EXE_CALLBACK asc_exe_callback;
+       ushort sg_entry_cnt = 0;
+       ushort sg_entry_cnt_minus_one = 0;
+       uchar target_ix;
+       uchar tid_no;
+       uchar sdtr_data;
+       uchar extra_bytes;
+       uchar scsi_cmd;
+       uchar disable_cmd;
+       ASC_SG_HEAD *sg_head;
+       ASC_DCNT data_cnt;
+
+       iop_base = asc_dvc->iop_base;
+       sg_head = scsiq->sg_head;
+       asc_exe_callback = asc_dvc->exe_callback;
+       if (asc_dvc->err_code != 0)
+               return (ERR);
+       if (scsiq == (ASC_SCSI_Q *)0L) {
+               AscSetLibErrorCode(asc_dvc, ASCQ_ERR_SCSIQ_NULL_PTR);
+               return (ERR);
+       }
+       scsiq->q1.q_no = 0;
+       if ((scsiq->q2.tag_code & ASC_TAG_FLAG_EXTRA_BYTES) == 0) {
+               scsiq->q1.extra_bytes = 0;
+       }
+       sta = 0;
+       target_ix = scsiq->q2.target_ix;
+       tid_no = ASC_TIX_TO_TID(target_ix);
+       n_q_required = 1;
+       if (scsiq->cdbptr[0] == REQUEST_SENSE) {
+               if ((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) {
+                       asc_dvc->sdtr_done &= ~scsiq->q1.target_id;
+                       sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no);
+                       AscMsgOutSDTR(asc_dvc,
+                                     asc_dvc->
+                                     sdtr_period_tbl[(sdtr_data >> 4) &
+                                                     (uchar)(asc_dvc->
+                                                             max_sdtr_index -
+                                                             1)],
+                                     (uchar)(sdtr_data & (uchar)
+                                             ASC_SYN_MAX_OFFSET));
+                       scsiq->q1.cntl |= (QC_MSG_OUT | QC_URGENT);
+               }
+       }
+       last_int_level = DvcEnterCritical();
+       if (asc_dvc->in_critical_cnt != 0) {
+               DvcLeaveCritical(last_int_level);
+               AscSetLibErrorCode(asc_dvc, ASCQ_ERR_CRITICAL_RE_ENTRY);
+               return (ERR);
+       }
+       asc_dvc->in_critical_cnt++;
+       if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) {
+               if ((sg_entry_cnt = sg_head->entry_cnt) == 0) {
+                       asc_dvc->in_critical_cnt--;
+                       DvcLeaveCritical(last_int_level);
+                       return (ERR);
+               }
 #if !CC_VERY_LONG_SG_LIST
-        if (sg_entry_cnt > ASC_MAX_SG_LIST)
-        {
-            asc_dvc->in_critical_cnt--;
-            DvcLeaveCritical(last_int_level);
-            return(ERR);
-        }
+               if (sg_entry_cnt > ASC_MAX_SG_LIST) {
+                       asc_dvc->in_critical_cnt--;
+                       DvcLeaveCritical(last_int_level);
+                       return (ERR);
+               }
 #endif /* !CC_VERY_LONG_SG_LIST */
-        if (sg_entry_cnt == 1) {
-            scsiq->q1.data_addr = (ADV_PADDR) sg_head->sg_list[0].addr;
-            scsiq->q1.data_cnt = (ADV_DCNT) sg_head->sg_list[0].bytes;
-            scsiq->q1.cntl &= ~(QC_SG_HEAD | QC_SG_SWAP_QUEUE);
-        }
-        sg_entry_cnt_minus_one = sg_entry_cnt - 1;
-    }
-    scsi_cmd = scsiq->cdbptr[0];
-    disable_syn_offset_one_fix = FALSE;
-    if ((asc_dvc->pci_fix_asyn_xfer & scsiq->q1.target_id) &&
-        !(asc_dvc->pci_fix_asyn_xfer_always & scsiq->q1.target_id)) {
-        if (scsiq->q1.cntl & QC_SG_HEAD) {
-            data_cnt = 0;
-            for (i = 0; i < sg_entry_cnt; i++) {
-                data_cnt += (ADV_DCNT) le32_to_cpu(sg_head->sg_list[i].bytes);
-            }
-        } else {
-            data_cnt = le32_to_cpu(scsiq->q1.data_cnt);
-        }
-        if (data_cnt != 0UL) {
-            if (data_cnt < 512UL) {
-                disable_syn_offset_one_fix = TRUE;
-            } else {
-                for (i = 0; i < ASC_SYN_OFFSET_ONE_DISABLE_LIST; i++) {
-                    disable_cmd = _syn_offset_one_disable_cmd[i];
-                    if (disable_cmd == 0xFF) {
-                        break;
-                    }
-                    if (scsi_cmd == disable_cmd) {
-                        disable_syn_offset_one_fix = TRUE;
-                        break;
-                    }
-                }
-            }
-        }
-    }
-    if (disable_syn_offset_one_fix) {
-        scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG;
-        scsiq->q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX |
-                               ASC_TAG_FLAG_DISABLE_DISCONNECT);
-    } else {
-        scsiq->q2.tag_code &= 0x27;
-    }
-    if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) {
-        if (asc_dvc->bug_fix_cntl) {
-            if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) {
-                if ((scsi_cmd == READ_6) ||
-                    (scsi_cmd == READ_10)) {
-                    addr =
-                        (ADV_PADDR) le32_to_cpu(
-                            sg_head->sg_list[sg_entry_cnt_minus_one].addr) +
-                        (ADV_DCNT) le32_to_cpu(
-                            sg_head->sg_list[sg_entry_cnt_minus_one].bytes);
-                    extra_bytes = (uchar) ((ushort) addr & 0x0003);
-                    if ((extra_bytes != 0) &&
-                        ((scsiq->q2.tag_code & ASC_TAG_FLAG_EXTRA_BYTES)
-                         == 0)) {
-                        scsiq->q2.tag_code |= ASC_TAG_FLAG_EXTRA_BYTES;
-                        scsiq->q1.extra_bytes = extra_bytes;
-                        data_cnt = le32_to_cpu(
-                            sg_head->sg_list[sg_entry_cnt_minus_one].bytes);
-                        data_cnt -= (ASC_DCNT) extra_bytes;
-                        sg_head->sg_list[sg_entry_cnt_minus_one].bytes =
-                            cpu_to_le32(data_cnt);
-                    }
-                }
-            }
-        }
-        sg_head->entry_to_copy = sg_head->entry_cnt;
+               if (sg_entry_cnt == 1) {
+                       scsiq->q1.data_addr =
+                           (ADV_PADDR)sg_head->sg_list[0].addr;
+                       scsiq->q1.data_cnt =
+                           (ADV_DCNT)sg_head->sg_list[0].bytes;
+                       scsiq->q1.cntl &= ~(QC_SG_HEAD | QC_SG_SWAP_QUEUE);
+               }
+               sg_entry_cnt_minus_one = sg_entry_cnt - 1;
+       }
+       scsi_cmd = scsiq->cdbptr[0];
+       disable_syn_offset_one_fix = FALSE;
+       if ((asc_dvc->pci_fix_asyn_xfer & scsiq->q1.target_id) &&
+           !(asc_dvc->pci_fix_asyn_xfer_always & scsiq->q1.target_id)) {
+               if (scsiq->q1.cntl & QC_SG_HEAD) {
+                       data_cnt = 0;
+                       for (i = 0; i < sg_entry_cnt; i++) {
+                               data_cnt +=
+                                   (ADV_DCNT)le32_to_cpu(sg_head->sg_list[i].
+                                                         bytes);
+                       }
+               } else {
+                       data_cnt = le32_to_cpu(scsiq->q1.data_cnt);
+               }
+               if (data_cnt != 0UL) {
+                       if (data_cnt < 512UL) {
+                               disable_syn_offset_one_fix = TRUE;
+                       } else {
+                               for (i = 0; i < ASC_SYN_OFFSET_ONE_DISABLE_LIST;
+                                    i++) {
+                                       disable_cmd =
+                                           _syn_offset_one_disable_cmd[i];
+                                       if (disable_cmd == 0xFF) {
+                                               break;
+                                       }
+                                       if (scsi_cmd == disable_cmd) {
+                                               disable_syn_offset_one_fix =
+                                                   TRUE;
+                                               break;
+                                       }
+                               }
+                       }
+               }
+       }
+       if (disable_syn_offset_one_fix) {
+               scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG;
+               scsiq->q2.tag_code |= (ASC_TAG_FLAG_DISABLE_ASYN_USE_SYN_FIX |
+                                      ASC_TAG_FLAG_DISABLE_DISCONNECT);
+       } else {
+               scsiq->q2.tag_code &= 0x27;
+       }
+       if ((scsiq->q1.cntl & QC_SG_HEAD) != 0) {
+               if (asc_dvc->bug_fix_cntl) {
+                       if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) {
+                               if ((scsi_cmd == READ_6) ||
+                                   (scsi_cmd == READ_10)) {
+                                       addr =
+                                           (ADV_PADDR)le32_to_cpu(sg_head->
+                                                                  sg_list
+                                                                  [sg_entry_cnt_minus_one].
+                                                                  addr) +
+                                           (ADV_DCNT)le32_to_cpu(sg_head->
+                                                                 sg_list
+                                                                 [sg_entry_cnt_minus_one].
+                                                                 bytes);
+                                       extra_bytes =
+                                           (uchar)((ushort)addr & 0x0003);
+                                       if ((extra_bytes != 0)
+                                           &&
+                                           ((scsiq->q2.
+                                             tag_code &
+                                             ASC_TAG_FLAG_EXTRA_BYTES)
+                                            == 0)) {
+                                               scsiq->q2.tag_code |=
+                                                   ASC_TAG_FLAG_EXTRA_BYTES;
+                                               scsiq->q1.extra_bytes =
+                                                   extra_bytes;
+                                               data_cnt =
+                                                   le32_to_cpu(sg_head->
+                                                               sg_list
+                                                               [sg_entry_cnt_minus_one].
+                                                               bytes);
+                                               data_cnt -=
+                                                   (ASC_DCNT) extra_bytes;
+                                               sg_head->
+                                                   sg_list
+                                                   [sg_entry_cnt_minus_one].
+                                                   bytes =
+                                                   cpu_to_le32(data_cnt);
+                                       }
+                               }
+                       }
+               }
+               sg_head->entry_to_copy = sg_head->entry_cnt;
 #if CC_VERY_LONG_SG_LIST
-        /*
-         * Set the sg_entry_cnt to the maximum possible. The rest of
-         * the SG elements will be copied when the RISC completes the
-         * SG elements that fit and halts.
-         */
-        if (sg_entry_cnt > ASC_MAX_SG_LIST)
-        {
-             sg_entry_cnt = ASC_MAX_SG_LIST;
-        }
+               /*
+                * Set the sg_entry_cnt to the maximum possible. The rest of
+                * the SG elements will be copied when the RISC completes the
+                * SG elements that fit and halts.
+                */
+               if (sg_entry_cnt > ASC_MAX_SG_LIST) {
+                       sg_entry_cnt = ASC_MAX_SG_LIST;
+               }
 #endif /* CC_VERY_LONG_SG_LIST */
-        n_q_required = AscSgListToQueue(sg_entry_cnt);
-        if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, n_q_required) >=
-            (uint) n_q_required) || ((scsiq->q1.cntl & QC_URGENT) != 0)) {
-            if ((sta = AscSendScsiQueue(asc_dvc, scsiq,
-                                        n_q_required)) == 1) {
-                asc_dvc->in_critical_cnt--;
-                if (asc_exe_callback != 0) {
-                    (*asc_exe_callback) (asc_dvc, scsiq);
-                }
-                DvcLeaveCritical(last_int_level);
-                return (sta);
-            }
-        }
-    } else {
-        if (asc_dvc->bug_fix_cntl) {
-            if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) {
-                if ((scsi_cmd == READ_6) ||
-                    (scsi_cmd == READ_10)) {
-                    addr = le32_to_cpu(scsiq->q1.data_addr) +
-                        le32_to_cpu(scsiq->q1.data_cnt);
-                    extra_bytes = (uchar) ((ushort) addr & 0x0003);
-                    if ((extra_bytes != 0) &&
-                        ((scsiq->q2.tag_code & ASC_TAG_FLAG_EXTRA_BYTES)
-                          == 0)) {
-                        data_cnt = le32_to_cpu(scsiq->q1.data_cnt);
-                        if (((ushort) data_cnt & 0x01FF) == 0) {
-                            scsiq->q2.tag_code |= ASC_TAG_FLAG_EXTRA_BYTES;
-                            data_cnt -= (ASC_DCNT) extra_bytes;
-                            scsiq->q1.data_cnt = cpu_to_le32(data_cnt);
-                            scsiq->q1.extra_bytes = extra_bytes;
-                        }
-                    }
-                }
-            }
-        }
-        n_q_required = 1;
-        if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, 1) >= 1) ||
-            ((scsiq->q1.cntl & QC_URGENT) != 0)) {
-            if ((sta = AscSendScsiQueue(asc_dvc, scsiq,
-                                        n_q_required)) == 1) {
-                asc_dvc->in_critical_cnt--;
-                if (asc_exe_callback != 0) {
-                    (*asc_exe_callback) (asc_dvc, scsiq);
-                }
-                DvcLeaveCritical(last_int_level);
-                return (sta);
-            }
-        }
-    }
-    asc_dvc->in_critical_cnt--;
-    DvcLeaveCritical(last_int_level);
-    return (sta);
+               n_q_required = AscSgListToQueue(sg_entry_cnt);
+               if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, n_q_required) >=
+                    (uint) n_q_required)
+                   || ((scsiq->q1.cntl & QC_URGENT) != 0)) {
+                       if ((sta =
+                            AscSendScsiQueue(asc_dvc, scsiq,
+                                             n_q_required)) == 1) {
+                               asc_dvc->in_critical_cnt--;
+                               if (asc_exe_callback != 0) {
+                                       (*asc_exe_callback) (asc_dvc, scsiq);
+                               }
+                               DvcLeaveCritical(last_int_level);
+                               return (sta);
+                       }
+               }
+       } else {
+               if (asc_dvc->bug_fix_cntl) {
+                       if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_IF_NOT_DWB) {
+                               if ((scsi_cmd == READ_6) ||
+                                   (scsi_cmd == READ_10)) {
+                                       addr =
+                                           le32_to_cpu(scsiq->q1.data_addr) +
+                                           le32_to_cpu(scsiq->q1.data_cnt);
+                                       extra_bytes =
+                                           (uchar)((ushort)addr & 0x0003);
+                                       if ((extra_bytes != 0)
+                                           &&
+                                           ((scsiq->q2.
+                                             tag_code &
+                                             ASC_TAG_FLAG_EXTRA_BYTES)
+                                            == 0)) {
+                                               data_cnt =
+                                                   le32_to_cpu(scsiq->q1.
+                                                               data_cnt);
+                                               if (((ushort)data_cnt & 0x01FF)
+                                                   == 0) {
+                                                       scsiq->q2.tag_code |=
+                                                           ASC_TAG_FLAG_EXTRA_BYTES;
+                                                       data_cnt -= (ASC_DCNT)
+                                                           extra_bytes;
+                                                       scsiq->q1.data_cnt =
+                                                           cpu_to_le32
+                                                           (data_cnt);
+                                                       scsiq->q1.extra_bytes =
+                                                           extra_bytes;
+                                               }
+                                       }
+                               }
+                       }
+               }
+               n_q_required = 1;
+               if ((AscGetNumOfFreeQueue(asc_dvc, target_ix, 1) >= 1) ||
+                   ((scsiq->q1.cntl & QC_URGENT) != 0)) {
+                       if ((sta = AscSendScsiQueue(asc_dvc, scsiq,
+                                                   n_q_required)) == 1) {
+                               asc_dvc->in_critical_cnt--;
+                               if (asc_exe_callback != 0) {
+                                       (*asc_exe_callback) (asc_dvc, scsiq);
+                               }
+                               DvcLeaveCritical(last_int_level);
+                               return (sta);
+                       }
+               }
+       }
+       asc_dvc->in_critical_cnt--;
+       DvcLeaveCritical(last_int_level);
+       return (sta);
 }
 
-STATIC int
-AscSendScsiQueue(
-                    ASC_DVC_VAR *asc_dvc,
-                    ASC_SCSI_Q *scsiq,
-                    uchar n_q_required
-)
+static int
+AscSendScsiQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar n_q_required)
 {
-    PortAddr            iop_base;
-    uchar               free_q_head;
-    uchar               next_qp;
-    uchar               tid_no;
-    uchar               target_ix;
-    int                 sta;
-
-    iop_base = asc_dvc->iop_base;
-    target_ix = scsiq->q2.target_ix;
-    tid_no = ASC_TIX_TO_TID(target_ix);
-    sta = 0;
-    free_q_head = (uchar) AscGetVarFreeQHead(iop_base);
-    if (n_q_required > 1) {
-        if ((next_qp = AscAllocMultipleFreeQueue(iop_base,
-                                       free_q_head, (uchar) (n_q_required)))
-            != (uchar) ASC_QLINK_END) {
-            asc_dvc->last_q_shortage = 0;
-            scsiq->sg_head->queue_cnt = n_q_required - 1;
-            scsiq->q1.q_no = free_q_head;
-            if ((sta = AscPutReadySgListQueue(asc_dvc, scsiq,
-                                              free_q_head)) == 1) {
-                AscPutVarFreeQHead(iop_base, next_qp);
-                asc_dvc->cur_total_qng += (uchar) (n_q_required);
-                asc_dvc->cur_dvc_qng[tid_no]++;
-            }
-            return (sta);
-        }
-    } else if (n_q_required == 1) {
-        if ((next_qp = AscAllocFreeQueue(iop_base,
-                                         free_q_head)) != ASC_QLINK_END) {
-            scsiq->q1.q_no = free_q_head;
-            if ((sta = AscPutReadyQueue(asc_dvc, scsiq,
-                                        free_q_head)) == 1) {
-                AscPutVarFreeQHead(iop_base, next_qp);
-                asc_dvc->cur_total_qng++;
-                asc_dvc->cur_dvc_qng[tid_no]++;
-            }
-            return (sta);
-        }
-    }
-    return (sta);
+       PortAddr iop_base;
+       uchar free_q_head;
+       uchar next_qp;
+       uchar tid_no;
+       uchar target_ix;
+       int sta;
+
+       iop_base = asc_dvc->iop_base;
+       target_ix = scsiq->q2.target_ix;
+       tid_no = ASC_TIX_TO_TID(target_ix);
+       sta = 0;
+       free_q_head = (uchar)AscGetVarFreeQHead(iop_base);
+       if (n_q_required > 1) {
+               if ((next_qp = AscAllocMultipleFreeQueue(iop_base,
+                                                        free_q_head, (uchar)
+                                                        (n_q_required)))
+                   != (uchar)ASC_QLINK_END) {
+                       asc_dvc->last_q_shortage = 0;
+                       scsiq->sg_head->queue_cnt = n_q_required - 1;
+                       scsiq->q1.q_no = free_q_head;
+                       if ((sta = AscPutReadySgListQueue(asc_dvc, scsiq,
+                                                         free_q_head)) == 1) {
+                               AscPutVarFreeQHead(iop_base, next_qp);
+                               asc_dvc->cur_total_qng += (uchar)(n_q_required);
+                               asc_dvc->cur_dvc_qng[tid_no]++;
+                       }
+                       return (sta);
+               }
+       } else if (n_q_required == 1) {
+               if ((next_qp = AscAllocFreeQueue(iop_base,
+                                                free_q_head)) !=
+                   ASC_QLINK_END) {
+                       scsiq->q1.q_no = free_q_head;
+                       if ((sta = AscPutReadyQueue(asc_dvc, scsiq,
+                                                   free_q_head)) == 1) {
+                               AscPutVarFreeQHead(iop_base, next_qp);
+                               asc_dvc->cur_total_qng++;
+                               asc_dvc->cur_dvc_qng[tid_no]++;
+                       }
+                       return (sta);
+               }
+       }
+       return (sta);
 }
 
-STATIC int
-AscSgListToQueue(
-                    int sg_list
-)
+static int AscSgListToQueue(int sg_list)
 {
-    int                 n_sg_list_qs;
+       int n_sg_list_qs;
 
-    n_sg_list_qs = ((sg_list - 1) / ASC_SG_LIST_PER_Q);
-    if (((sg_list - 1) % ASC_SG_LIST_PER_Q) != 0)
-        n_sg_list_qs++;
-    return (n_sg_list_qs + 1);
+       n_sg_list_qs = ((sg_list - 1) / ASC_SG_LIST_PER_Q);
+       if (((sg_list - 1) % ASC_SG_LIST_PER_Q) != 0)
+               n_sg_list_qs++;
+       return (n_sg_list_qs + 1);
 }
 
-
-STATIC uint
-AscGetNumOfFreeQueue(
-                        ASC_DVC_VAR *asc_dvc,
-                        uchar target_ix,
-                        uchar n_qs
-)
+static uint
+AscGetNumOfFreeQueue(ASC_DVC_VAR *asc_dvc, uchar target_ix, uchar n_qs)
 {
-    uint                cur_used_qs;
-    uint                cur_free_qs;
-    ASC_SCSI_BIT_ID_TYPE target_id;
-    uchar               tid_no;
-
-    target_id = ASC_TIX_TO_TARGET_ID(target_ix);
-    tid_no = ASC_TIX_TO_TID(target_ix);
-    if ((asc_dvc->unit_not_ready & target_id) ||
-        (asc_dvc->queue_full_or_busy & target_id)) {
-        return (0);
-    }
-    if (n_qs == 1) {
-        cur_used_qs = (uint) asc_dvc->cur_total_qng +
-          (uint) asc_dvc->last_q_shortage +
-          (uint) ASC_MIN_FREE_Q;
-    } else {
-        cur_used_qs = (uint) asc_dvc->cur_total_qng +
-          (uint) ASC_MIN_FREE_Q;
-    }
-    if ((uint) (cur_used_qs + n_qs) <= (uint) asc_dvc->max_total_qng) {
-        cur_free_qs = (uint) asc_dvc->max_total_qng - cur_used_qs;
-        if (asc_dvc->cur_dvc_qng[tid_no] >=
-            asc_dvc->max_dvc_qng[tid_no]) {
-            return (0);
-        }
-        return (cur_free_qs);
-    }
-    if (n_qs > 1) {
-        if ((n_qs > asc_dvc->last_q_shortage) && (n_qs <= (asc_dvc->max_total_qng - ASC_MIN_FREE_Q))) {
-            asc_dvc->last_q_shortage = n_qs;
-        }
-    }
-    return (0);
+       uint cur_used_qs;
+       uint cur_free_qs;
+       ASC_SCSI_BIT_ID_TYPE target_id;
+       uchar tid_no;
+
+       target_id = ASC_TIX_TO_TARGET_ID(target_ix);
+       tid_no = ASC_TIX_TO_TID(target_ix);
+       if ((asc_dvc->unit_not_ready & target_id) ||
+           (asc_dvc->queue_full_or_busy & target_id)) {
+               return (0);
+       }
+       if (n_qs == 1) {
+               cur_used_qs = (uint) asc_dvc->cur_total_qng +
+                   (uint) asc_dvc->last_q_shortage + (uint) ASC_MIN_FREE_Q;
+       } else {
+               cur_used_qs = (uint) asc_dvc->cur_total_qng +
+                   (uint) ASC_MIN_FREE_Q;
+       }
+       if ((uint) (cur_used_qs + n_qs) <= (uint) asc_dvc->max_total_qng) {
+               cur_free_qs = (uint) asc_dvc->max_total_qng - cur_used_qs;
+               if (asc_dvc->cur_dvc_qng[tid_no] >=
+                   asc_dvc->max_dvc_qng[tid_no]) {
+                       return (0);
+               }
+               return (cur_free_qs);
+       }
+       if (n_qs > 1) {
+               if ((n_qs > asc_dvc->last_q_shortage)
+                   && (n_qs <= (asc_dvc->max_total_qng - ASC_MIN_FREE_Q))) {
+                       asc_dvc->last_q_shortage = n_qs;
+               }
+       }
+       return (0);
 }
 
-STATIC int
-AscPutReadyQueue(
-                    ASC_DVC_VAR *asc_dvc,
-                    ASC_SCSI_Q *scsiq,
-                    uchar q_no
-)
+static int AscPutReadyQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no)
 {
-    ushort              q_addr;
-    uchar               tid_no;
-    uchar               sdtr_data;
-    uchar               syn_period_ix;
-    uchar               syn_offset;
-    PortAddr            iop_base;
-
-    iop_base = asc_dvc->iop_base;
-    if (((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) &&
-        ((asc_dvc->sdtr_done & scsiq->q1.target_id) == 0)) {
-        tid_no = ASC_TIX_TO_TID(scsiq->q2.target_ix);
-        sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no);
-        syn_period_ix = (sdtr_data >> 4) & (asc_dvc->max_sdtr_index - 1);
-        syn_offset = sdtr_data & ASC_SYN_MAX_OFFSET;
-        AscMsgOutSDTR(asc_dvc,
-                      asc_dvc->sdtr_period_tbl[syn_period_ix],
-                      syn_offset);
-        scsiq->q1.cntl |= QC_MSG_OUT;
-    }
-    q_addr = ASC_QNO_TO_QADDR(q_no);
-    if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) {
-        scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG ;
-    }
-    scsiq->q1.status = QS_FREE;
-    AscMemWordCopyPtrToLram(iop_base,
-                         q_addr + ASC_SCSIQ_CDB_BEG,
-                         (uchar *) scsiq->cdbptr,
-                         scsiq->q2.cdb_len >> 1);
-
-    DvcPutScsiQ(iop_base,
-                q_addr + ASC_SCSIQ_CPY_BEG,
-                (uchar *) &scsiq->q1.cntl,
-                ((sizeof(ASC_SCSIQ_1) + sizeof(ASC_SCSIQ_2)) / 2) - 1);
-    AscWriteLramWord(iop_base,
-                     (ushort) (q_addr + (ushort) ASC_SCSIQ_B_STATUS),
-             (ushort) (((ushort) scsiq->q1.q_no << 8) | (ushort) QS_READY));
-    return (1);
+       ushort q_addr;
+       uchar tid_no;
+       uchar sdtr_data;
+       uchar syn_period_ix;
+       uchar syn_offset;
+       PortAddr iop_base;
+
+       iop_base = asc_dvc->iop_base;
+       if (((asc_dvc->init_sdtr & scsiq->q1.target_id) != 0) &&
+           ((asc_dvc->sdtr_done & scsiq->q1.target_id) == 0)) {
+               tid_no = ASC_TIX_TO_TID(scsiq->q2.target_ix);
+               sdtr_data = AscGetMCodeInitSDTRAtID(iop_base, tid_no);
+               syn_period_ix =
+                   (sdtr_data >> 4) & (asc_dvc->max_sdtr_index - 1);
+               syn_offset = sdtr_data & ASC_SYN_MAX_OFFSET;
+               AscMsgOutSDTR(asc_dvc,
+                             asc_dvc->sdtr_period_tbl[syn_period_ix],
+                             syn_offset);
+               scsiq->q1.cntl |= QC_MSG_OUT;
+       }
+       q_addr = ASC_QNO_TO_QADDR(q_no);
+       if ((scsiq->q1.target_id & asc_dvc->use_tagged_qng) == 0) {
+               scsiq->q2.tag_code &= ~MSG_SIMPLE_TAG;
+       }
+       scsiq->q1.status = QS_FREE;
+       AscMemWordCopyPtrToLram(iop_base,
+                               q_addr + ASC_SCSIQ_CDB_BEG,
+                               (uchar *)scsiq->cdbptr, scsiq->q2.cdb_len >> 1);
+
+       DvcPutScsiQ(iop_base,
+                   q_addr + ASC_SCSIQ_CPY_BEG,
+                   (uchar *)&scsiq->q1.cntl,
+                   ((sizeof(ASC_SCSIQ_1) + sizeof(ASC_SCSIQ_2)) / 2) - 1);
+       AscWriteLramWord(iop_base,
+                        (ushort)(q_addr + (ushort)ASC_SCSIQ_B_STATUS),
+                        (ushort)(((ushort)scsiq->q1.
+                                  q_no << 8) | (ushort)QS_READY));
+       return (1);
 }
 
-STATIC int
-AscPutReadySgListQueue(
-                          ASC_DVC_VAR *asc_dvc,
-                          ASC_SCSI_Q *scsiq,
-                          uchar q_no
-)
+static int
+AscPutReadySgListQueue(ASC_DVC_VAR *asc_dvc, ASC_SCSI_Q *scsiq, uchar q_no)
 {
-    int                 sta;
-    int                 i;
-    ASC_SG_HEAD *sg_head;
-    ASC_SG_LIST_Q       scsi_sg_q;
-    ASC_DCNT            saved_data_addr;
-    ASC_DCNT            saved_data_cnt;
-    PortAddr            iop_base;
-    ushort              sg_list_dwords;
-    ushort              sg_index;
-    ushort              sg_entry_cnt;
-    ushort              q_addr;
-    uchar               next_qp;
-
-    iop_base = asc_dvc->iop_base;
-    sg_head = scsiq->sg_head;
-    saved_data_addr = scsiq->q1.data_addr;
-    saved_data_cnt = scsiq->q1.data_cnt;
-    scsiq->q1.data_addr = (ASC_PADDR) sg_head->sg_list[0].addr;
-    scsiq->q1.data_cnt = (ASC_DCNT) sg_head->sg_list[0].bytes;
+       int sta;
+       int i;
+       ASC_SG_HEAD *sg_head;
+       ASC_SG_LIST_Q scsi_sg_q;
+       ASC_DCNT saved_data_addr;
+       ASC_DCNT saved_data_cnt;
+       PortAddr iop_base;
+       ushort sg_list_dwords;
+       ushort sg_index;
+       ushort sg_entry_cnt;
+       ushort q_addr;
+       uchar next_qp;
+
+       iop_base = asc_dvc->iop_base;
+       sg_head = scsiq->sg_head;
+       saved_data_addr = scsiq->q1.data_addr;
+       saved_data_cnt = scsiq->q1.data_cnt;
+       scsiq->q1.data_addr = (ASC_PADDR) sg_head->sg_list[0].addr;
+       scsiq->q1.data_cnt = (ASC_DCNT) sg_head->sg_list[0].bytes;
 #if CC_VERY_LONG_SG_LIST
-    /*
-     * If sg_head->entry_cnt is greater than ASC_MAX_SG_LIST
-     * then not all SG elements will fit in the allocated queues.
-     * The rest of the SG elements will be copied when the RISC
-     * completes the SG elements that fit and halts.
-     */
-    if (sg_head->entry_cnt > ASC_MAX_SG_LIST)
-    {
-         /*
-          * Set sg_entry_cnt to be the number of SG elements that
-          * will fit in the allocated SG queues. It is minus 1, because
-          * the first SG element is handled above. ASC_MAX_SG_LIST is
-          * already inflated by 1 to account for this. For example it
-          * may be 50 which is 1 + 7 queues * 7 SG elements.
-          */
-         sg_entry_cnt = ASC_MAX_SG_LIST - 1;
-
-         /*
-          * Keep track of remaining number of SG elements that will
-          * need to be handled from a_isr.c.
-          */
-         scsiq->remain_sg_entry_cnt = sg_head->entry_cnt - ASC_MAX_SG_LIST;
-    } else
-    {
+       /*
+        * If sg_head->entry_cnt is greater than ASC_MAX_SG_LIST
+        * then not all SG elements will fit in the allocated queues.
+        * The rest of the SG elements will be copied when the RISC
+        * completes the SG elements that fit and halts.
+        */
+       if (sg_head->entry_cnt > ASC_MAX_SG_LIST) {
+               /*
+                * Set sg_entry_cnt to be the number of SG elements that
+                * will fit in the allocated SG queues. It is minus 1, because
+                * the first SG element is handled above. ASC_MAX_SG_LIST is
+                * already inflated by 1 to account for this. For example it
+                * may be 50 which is 1 + 7 queues * 7 SG elements.
+                */
+               sg_entry_cnt = ASC_MAX_SG_LIST - 1;
+
+               /*
+                * Keep track of remaining number of SG elements that will
+                * need to be handled from a_isr.c.
+                */
+               scsiq->remain_sg_entry_cnt =
+                   sg_head->entry_cnt - ASC_MAX_SG_LIST;
+       } else {
 #endif /* CC_VERY_LONG_SG_LIST */
-         /*
-          * Set sg_entry_cnt to be the number of SG elements that
-          * will fit in the allocated SG queues. It is minus 1, because
-          * the first SG element is handled above.
-          */
-         sg_entry_cnt = sg_head->entry_cnt - 1;
+               /*
+                * Set sg_entry_cnt to be the number of SG elements that
+                * will fit in the allocated SG queues. It is minus 1, because
+                * the first SG element is handled above.
+                */
+               sg_entry_cnt = sg_head->entry_cnt - 1;
 #if CC_VERY_LONG_SG_LIST
-    }
+       }
 #endif /* CC_VERY_LONG_SG_LIST */
-    if (sg_entry_cnt != 0) {
-        scsiq->q1.cntl |= QC_SG_HEAD;
-        q_addr = ASC_QNO_TO_QADDR(q_no);
-        sg_index = 1;
-        scsiq->q1.sg_queue_cnt = sg_head->queue_cnt;
-        scsi_sg_q.sg_head_qp = q_no;
-        scsi_sg_q.cntl = QCSG_SG_XFER_LIST;
-        for (i = 0; i < sg_head->queue_cnt; i++) {
-            scsi_sg_q.seq_no = i + 1;
-            if (sg_entry_cnt > ASC_SG_LIST_PER_Q) {
-                sg_list_dwords = (uchar) (ASC_SG_LIST_PER_Q * 2);
-                sg_entry_cnt -= ASC_SG_LIST_PER_Q;
-                if (i == 0) {
-                    scsi_sg_q.sg_list_cnt = ASC_SG_LIST_PER_Q;
-                    scsi_sg_q.sg_cur_list_cnt = ASC_SG_LIST_PER_Q;
-                } else {
-                    scsi_sg_q.sg_list_cnt = ASC_SG_LIST_PER_Q - 1;
-                    scsi_sg_q.sg_cur_list_cnt = ASC_SG_LIST_PER_Q - 1;
-                }
-            } else {
+       if (sg_entry_cnt != 0) {
+               scsiq->q1.cntl |= QC_SG_HEAD;
+               q_addr = ASC_QNO_TO_QADDR(q_no);
+               sg_index = 1;
+               scsiq->q1.sg_queue_cnt = sg_head->queue_cnt;
+               scsi_sg_q.sg_head_qp = q_no;
+               scsi_sg_q.cntl = QCSG_SG_XFER_LIST;
+               for (i = 0; i < sg_head->queue_cnt; i++) {
+                       scsi_sg_q.seq_no = i + 1;
+                       if (sg_entry_cnt > ASC_SG_LIST_PER_Q) {
+                               sg_list_dwords = (uchar)(ASC_SG_LIST_PER_Q * 2);
+                               sg_entry_cnt -= ASC_SG_LIST_PER_Q;
+                               if (i == 0) {
+                                       scsi_sg_q.sg_list_cnt =
+                                           ASC_SG_LIST_PER_Q;
+                                       scsi_sg_q.sg_cur_list_cnt =
+                                           ASC_SG_LIST_PER_Q;
+                               } else {
+                                       scsi_sg_q.sg_list_cnt =
+                                           ASC_SG_LIST_PER_Q - 1;
+                                       scsi_sg_q.sg_cur_list_cnt =
+                                           ASC_SG_LIST_PER_Q - 1;
+                               }
+                       } else {
 #if CC_VERY_LONG_SG_LIST
-                /*
-                 * This is the last SG queue in the list of
-                 * allocated SG queues. If there are more
-                 * SG elements than will fit in the allocated
-                 * queues, then set the QCSG_SG_XFER_MORE flag.
-                 */
-                if (sg_head->entry_cnt > ASC_MAX_SG_LIST)
-                {
-                    scsi_sg_q.cntl |= QCSG_SG_XFER_MORE;
-                } else
-                {
+                               /*
+                                * This is the last SG queue in the list of
+                                * allocated SG queues. If there are more
+                                * SG elements than will fit in the allocated
+                                * queues, then set the QCSG_SG_XFER_MORE flag.
+                                */
+                               if (sg_head->entry_cnt > ASC_MAX_SG_LIST) {
+                                       scsi_sg_q.cntl |= QCSG_SG_XFER_MORE;
+                               } else {
 #endif /* CC_VERY_LONG_SG_LIST */
-                    scsi_sg_q.cntl |= QCSG_SG_XFER_END;
+                                       scsi_sg_q.cntl |= QCSG_SG_XFER_END;
 #if CC_VERY_LONG_SG_LIST
-                }
+                               }
 #endif /* CC_VERY_LONG_SG_LIST */
-                sg_list_dwords = sg_entry_cnt << 1;
-                if (i == 0) {
-                    scsi_sg_q.sg_list_cnt = sg_entry_cnt;
-                    scsi_sg_q.sg_cur_list_cnt = sg_entry_cnt;
-                } else {
-                    scsi_sg_q.sg_list_cnt = sg_entry_cnt - 1;
-                    scsi_sg_q.sg_cur_list_cnt = sg_entry_cnt - 1;
-                }
-                sg_entry_cnt = 0;
-            }
-            next_qp = AscReadLramByte(iop_base,
-                                      (ushort) (q_addr + ASC_SCSIQ_B_FWD));
-            scsi_sg_q.q_no = next_qp;
-            q_addr = ASC_QNO_TO_QADDR(next_qp);
-            AscMemWordCopyPtrToLram(iop_base,
-                                q_addr + ASC_SCSIQ_SGHD_CPY_BEG,
-                                (uchar *) &scsi_sg_q,
-                                sizeof(ASC_SG_LIST_Q) >> 1);
-            AscMemDWordCopyPtrToLram(iop_base,
-                                q_addr + ASC_SGQ_LIST_BEG,
-                                (uchar *) &sg_head->sg_list[sg_index],
-                                sg_list_dwords);
-            sg_index += ASC_SG_LIST_PER_Q;
-            scsiq->next_sg_index = sg_index;
-        }
-    } else {
-        scsiq->q1.cntl &= ~QC_SG_HEAD;
-    }
-    sta = AscPutReadyQueue(asc_dvc, scsiq, q_no);
-    scsiq->q1.data_addr = saved_data_addr;
-    scsiq->q1.data_cnt = saved_data_cnt;
-    return (sta);
+                               sg_list_dwords = sg_entry_cnt << 1;
+                               if (i == 0) {
+                                       scsi_sg_q.sg_list_cnt = sg_entry_cnt;
+                                       scsi_sg_q.sg_cur_list_cnt =
+                                           sg_entry_cnt;
+                               } else {
+                                       scsi_sg_q.sg_list_cnt =
+                                           sg_entry_cnt - 1;
+                                       scsi_sg_q.sg_cur_list_cnt =
+                                           sg_entry_cnt - 1;
+                               }
+                               sg_entry_cnt = 0;
+                       }
+                       next_qp = AscReadLramByte(iop_base,
+                                                 (ushort)(q_addr +
+                                                          ASC_SCSIQ_B_FWD));
+                       scsi_sg_q.q_no = next_qp;
+                       q_addr = ASC_QNO_TO_QADDR(next_qp);
+                       AscMemWordCopyPtrToLram(iop_base,
+                                               q_addr + ASC_SCSIQ_SGHD_CPY_BEG,
+                                               (uchar *)&scsi_sg_q,
+                                               sizeof(ASC_SG_LIST_Q) >> 1);
+                       AscMemDWordCopyPtrToLram(iop_base,
+                                                q_addr + ASC_SGQ_LIST_BEG,
+                                                (uchar *)&sg_head->
+                                                sg_list[sg_index],
+                                                sg_list_dwords);
+                       sg_index += ASC_SG_LIST_PER_Q;
+                       scsiq->next_sg_index = sg_index;
+               }
+       } else {
+               scsiq->q1.cntl &= ~QC_SG_HEAD;
+       }
+       sta = AscPutReadyQueue(asc_dvc, scsiq, q_no);
+       scsiq->q1.data_addr = saved_data_addr;
+       scsiq->q1.data_cnt = saved_data_cnt;
+       return (sta);
 }
 
-STATIC int
-AscSetRunChipSynRegAtID(
-                           PortAddr iop_base,
-                           uchar tid_no,
-                           uchar sdtr_data
-)
+static int
+AscSetRunChipSynRegAtID(PortAddr iop_base, uchar tid_no, uchar sdtr_data)
 {
-    int                 sta = FALSE;
+       int sta = FALSE;
 
-    if (AscHostReqRiscHalt(iop_base)) {
-        sta = AscSetChipSynRegAtID(iop_base, tid_no, sdtr_data);
-        AscStartChip(iop_base);
-        return (sta);
-    }
-    return (sta);
+       if (AscHostReqRiscHalt(iop_base)) {
+               sta = AscSetChipSynRegAtID(iop_base, tid_no, sdtr_data);
+               AscStartChip(iop_base);
+               return (sta);
+       }
+       return (sta);
 }
 
-STATIC int
-AscSetChipSynRegAtID(
-                        PortAddr iop_base,
-                        uchar id,
-                        uchar sdtr_data
-)
+static int AscSetChipSynRegAtID(PortAddr iop_base, uchar id, uchar sdtr_data)
 {
-    ASC_SCSI_BIT_ID_TYPE org_id;
-    int                 i;
-    int                 sta = TRUE;
-
-    AscSetBank(iop_base, 1);
-    org_id = AscReadChipDvcID(iop_base);
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        if (org_id == (0x01 << i))
-            break;
-    }
-    org_id = (ASC_SCSI_BIT_ID_TYPE) i;
-    AscWriteChipDvcID(iop_base, id);
-    if (AscReadChipDvcID(iop_base) == (0x01 << id)) {
-        AscSetBank(iop_base, 0);
-        AscSetChipSyn(iop_base, sdtr_data);
-        if (AscGetChipSyn(iop_base) != sdtr_data) {
-            sta = FALSE;
-        }
-    } else {
-        sta = FALSE;
-    }
-    AscSetBank(iop_base, 1);
-    AscWriteChipDvcID(iop_base, org_id);
-    AscSetBank(iop_base, 0);
-    return (sta);
-}
+       ASC_SCSI_BIT_ID_TYPE org_id;
+       int i;
+       int sta = TRUE;
+
+       AscSetBank(iop_base, 1);
+       org_id = AscReadChipDvcID(iop_base);
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               if (org_id == (0x01 << i))
+                       break;
+       }
+       org_id = (ASC_SCSI_BIT_ID_TYPE) i;
+       AscWriteChipDvcID(iop_base, id);
+       if (AscReadChipDvcID(iop_base) == (0x01 << id)) {
+               AscSetBank(iop_base, 0);
+               AscSetChipSyn(iop_base, sdtr_data);
+               if (AscGetChipSyn(iop_base) != sdtr_data) {
+                       sta = FALSE;
+               }
+       } else {
+               sta = FALSE;
+       }
+       AscSetBank(iop_base, 1);
+       AscWriteChipDvcID(iop_base, org_id);
+       AscSetBank(iop_base, 0);
+       return (sta);
+}
 
-STATIC ushort
-AscInitLram(
-               ASC_DVC_VAR *asc_dvc
-)
+static ushort AscInitLram(ASC_DVC_VAR *asc_dvc)
 {
-    uchar               i;
-    ushort              s_addr;
-    PortAddr            iop_base;
-    ushort              warn_code;
-
-    iop_base = asc_dvc->iop_base;
-    warn_code = 0;
-    AscMemWordSetLram(iop_base, ASC_QADR_BEG, 0,
-               (ushort) (((int) (asc_dvc->max_total_qng + 2 + 1) * 64) >> 1)
-);
-    i = ASC_MIN_ACTIVE_QNO;
-    s_addr = ASC_QADR_BEG + ASC_QBLK_SIZE;
-    AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_FWD),
-                     (uchar) (i + 1));
-    AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_BWD),
-                     (uchar) (asc_dvc->max_total_qng));
-    AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_QNO),
-                     (uchar) i);
-    i++;
-    s_addr += ASC_QBLK_SIZE;
-    for (; i < asc_dvc->max_total_qng; i++, s_addr += ASC_QBLK_SIZE) {
-        AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_FWD),
-                         (uchar) (i + 1));
-        AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_BWD),
-                         (uchar) (i - 1));
-        AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_QNO),
-                         (uchar) i);
-    }
-    AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_FWD),
-                     (uchar) ASC_QLINK_END);
-    AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_BWD),
-                     (uchar) (asc_dvc->max_total_qng - 1));
-    AscWriteLramByte(iop_base, (ushort) (s_addr + ASC_SCSIQ_B_QNO),
-                     (uchar) asc_dvc->max_total_qng);
-    i++;
-    s_addr += ASC_QBLK_SIZE;
-    for (; i <= (uchar) (asc_dvc->max_total_qng + 3);
-         i++, s_addr += ASC_QBLK_SIZE) {
-        AscWriteLramByte(iop_base,
-                         (ushort) (s_addr + (ushort) ASC_SCSIQ_B_FWD), i);
-        AscWriteLramByte(iop_base,
-                         (ushort) (s_addr + (ushort) ASC_SCSIQ_B_BWD), i);
-        AscWriteLramByte(iop_base,
-                         (ushort) (s_addr + (ushort) ASC_SCSIQ_B_QNO), i);
-    }
-    return (warn_code);
+       uchar i;
+       ushort s_addr;
+       PortAddr iop_base;
+       ushort warn_code;
+
+       iop_base = asc_dvc->iop_base;
+       warn_code = 0;
+       AscMemWordSetLram(iop_base, ASC_QADR_BEG, 0,
+                         (ushort)(((int)(asc_dvc->max_total_qng + 2 + 1) *
+                                   64) >> 1)
+           );
+       i = ASC_MIN_ACTIVE_QNO;
+       s_addr = ASC_QADR_BEG + ASC_QBLK_SIZE;
+       AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_FWD),
+                        (uchar)(i + 1));
+       AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_BWD),
+                        (uchar)(asc_dvc->max_total_qng));
+       AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_QNO),
+                        (uchar)i);
+       i++;
+       s_addr += ASC_QBLK_SIZE;
+       for (; i < asc_dvc->max_total_qng; i++, s_addr += ASC_QBLK_SIZE) {
+               AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_FWD),
+                                (uchar)(i + 1));
+               AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_BWD),
+                                (uchar)(i - 1));
+               AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_QNO),
+                                (uchar)i);
+       }
+       AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_FWD),
+                        (uchar)ASC_QLINK_END);
+       AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_BWD),
+                        (uchar)(asc_dvc->max_total_qng - 1));
+       AscWriteLramByte(iop_base, (ushort)(s_addr + ASC_SCSIQ_B_QNO),
+                        (uchar)asc_dvc->max_total_qng);
+       i++;
+       s_addr += ASC_QBLK_SIZE;
+       for (; i <= (uchar)(asc_dvc->max_total_qng + 3);
+            i++, s_addr += ASC_QBLK_SIZE) {
+               AscWriteLramByte(iop_base,
+                                (ushort)(s_addr + (ushort)ASC_SCSIQ_B_FWD), i);
+               AscWriteLramByte(iop_base,
+                                (ushort)(s_addr + (ushort)ASC_SCSIQ_B_BWD), i);
+               AscWriteLramByte(iop_base,
+                                (ushort)(s_addr + (ushort)ASC_SCSIQ_B_QNO), i);
+       }
+       return (warn_code);
 }
 
-STATIC ushort
-AscInitQLinkVar(
-                   ASC_DVC_VAR *asc_dvc
-)
+static ushort AscInitQLinkVar(ASC_DVC_VAR *asc_dvc)
 {
-    PortAddr            iop_base;
-    int                 i;
-    ushort              lram_addr;
-
-    iop_base = asc_dvc->iop_base;
-    AscPutRiscVarFreeQHead(iop_base, 1);
-    AscPutRiscVarDoneQTail(iop_base, asc_dvc->max_total_qng);
-    AscPutVarFreeQHead(iop_base, 1);
-    AscPutVarDoneQTail(iop_base, asc_dvc->max_total_qng);
-    AscWriteLramByte(iop_base, ASCV_BUSY_QHEAD_B,
-                     (uchar) ((int) asc_dvc->max_total_qng + 1));
-    AscWriteLramByte(iop_base, ASCV_DISC1_QHEAD_B,
-                     (uchar) ((int) asc_dvc->max_total_qng + 2));
-    AscWriteLramByte(iop_base, (ushort) ASCV_TOTAL_READY_Q_B,
-                     asc_dvc->max_total_qng);
-    AscWriteLramWord(iop_base, ASCV_ASCDVC_ERR_CODE_W, 0);
-    AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
-    AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, 0);
-    AscWriteLramByte(iop_base, ASCV_SCSIBUSY_B, 0);
-    AscWriteLramByte(iop_base, ASCV_WTM_FLAG_B, 0);
-    AscPutQDoneInProgress(iop_base, 0);
-    lram_addr = ASC_QADR_BEG;
-    for (i = 0; i < 32; i++, lram_addr += 2) {
-        AscWriteLramWord(iop_base, lram_addr, 0);
-    }
-    return (0);
+       PortAddr iop_base;
+       int i;
+       ushort lram_addr;
+
+       iop_base = asc_dvc->iop_base;
+       AscPutRiscVarFreeQHead(iop_base, 1);
+       AscPutRiscVarDoneQTail(iop_base, asc_dvc->max_total_qng);
+       AscPutVarFreeQHead(iop_base, 1);
+       AscPutVarDoneQTail(iop_base, asc_dvc->max_total_qng);
+       AscWriteLramByte(iop_base, ASCV_BUSY_QHEAD_B,
+                        (uchar)((int)asc_dvc->max_total_qng + 1));
+       AscWriteLramByte(iop_base, ASCV_DISC1_QHEAD_B,
+                        (uchar)((int)asc_dvc->max_total_qng + 2));
+       AscWriteLramByte(iop_base, (ushort)ASCV_TOTAL_READY_Q_B,
+                        asc_dvc->max_total_qng);
+       AscWriteLramWord(iop_base, ASCV_ASCDVC_ERR_CODE_W, 0);
+       AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0);
+       AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, 0);
+       AscWriteLramByte(iop_base, ASCV_SCSIBUSY_B, 0);
+       AscWriteLramByte(iop_base, ASCV_WTM_FLAG_B, 0);
+       AscPutQDoneInProgress(iop_base, 0);
+       lram_addr = ASC_QADR_BEG;
+       for (i = 0; i < 32; i++, lram_addr += 2) {
+               AscWriteLramWord(iop_base, lram_addr, 0);
+       }
+       return (0);
 }
 
-STATIC int
-AscSetLibErrorCode(
-                      ASC_DVC_VAR *asc_dvc,
-                      ushort err_code
-)
+static int AscSetLibErrorCode(ASC_DVC_VAR *asc_dvc, ushort err_code)
 {
-    if (asc_dvc->err_code == 0) {
-        asc_dvc->err_code = err_code;
-        AscWriteLramWord(asc_dvc->iop_base, ASCV_ASCDVC_ERR_CODE_W,
-                         err_code);
-    }
-    return (err_code);
+       if (asc_dvc->err_code == 0) {
+               asc_dvc->err_code = err_code;
+               AscWriteLramWord(asc_dvc->iop_base, ASCV_ASCDVC_ERR_CODE_W,
+                                err_code);
+       }
+       return (err_code);
 }
 
-
-STATIC uchar
-AscMsgOutSDTR(
-                 ASC_DVC_VAR *asc_dvc,
-                 uchar sdtr_period,
-                 uchar sdtr_offset
-)
+static uchar
+AscMsgOutSDTR(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar sdtr_offset)
 {
-    EXT_MSG             sdtr_buf;
-    uchar               sdtr_period_index;
-    PortAddr            iop_base;
-
-    iop_base = asc_dvc->iop_base;
-    sdtr_buf.msg_type = MS_EXTEND;
-    sdtr_buf.msg_len = MS_SDTR_LEN;
-    sdtr_buf.msg_req = MS_SDTR_CODE;
-    sdtr_buf.xfer_period = sdtr_period;
-    sdtr_offset &= ASC_SYN_MAX_OFFSET;
-    sdtr_buf.req_ack_offset = sdtr_offset;
-    if ((sdtr_period_index =
-         AscGetSynPeriodIndex(asc_dvc, sdtr_period)) <=
-        asc_dvc->max_sdtr_index) {
-        AscMemWordCopyPtrToLram(iop_base,
-                             ASCV_MSGOUT_BEG,
-                             (uchar *) &sdtr_buf,
-                             sizeof (EXT_MSG) >> 1);
-        return ((sdtr_period_index << 4) | sdtr_offset);
-    } else {
-
-        sdtr_buf.req_ack_offset = 0;
-        AscMemWordCopyPtrToLram(iop_base,
-                             ASCV_MSGOUT_BEG,
-                             (uchar *) &sdtr_buf,
-                             sizeof (EXT_MSG) >> 1);
-        return (0);
-    }
+       EXT_MSG sdtr_buf;
+       uchar sdtr_period_index;
+       PortAddr iop_base;
+
+       iop_base = asc_dvc->iop_base;
+       sdtr_buf.msg_type = MS_EXTEND;
+       sdtr_buf.msg_len = MS_SDTR_LEN;
+       sdtr_buf.msg_req = MS_SDTR_CODE;
+       sdtr_buf.xfer_period = sdtr_period;
+       sdtr_offset &= ASC_SYN_MAX_OFFSET;
+       sdtr_buf.req_ack_offset = sdtr_offset;
+       if ((sdtr_period_index =
+            AscGetSynPeriodIndex(asc_dvc, sdtr_period)) <=
+           asc_dvc->max_sdtr_index) {
+               AscMemWordCopyPtrToLram(iop_base,
+                                       ASCV_MSGOUT_BEG,
+                                       (uchar *)&sdtr_buf,
+                                       sizeof(EXT_MSG) >> 1);
+               return ((sdtr_period_index << 4) | sdtr_offset);
+       } else {
+
+               sdtr_buf.req_ack_offset = 0;
+               AscMemWordCopyPtrToLram(iop_base,
+                                       ASCV_MSGOUT_BEG,
+                                       (uchar *)&sdtr_buf,
+                                       sizeof(EXT_MSG) >> 1);
+               return (0);
+       }
 }
 
-STATIC uchar
-AscCalSDTRData(
-                  ASC_DVC_VAR *asc_dvc,
-                  uchar sdtr_period,
-                  uchar syn_offset
-)
+static uchar
+AscCalSDTRData(ASC_DVC_VAR *asc_dvc, uchar sdtr_period, uchar syn_offset)
 {
-    uchar               byte;
-    uchar               sdtr_period_ix;
-
-    sdtr_period_ix = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
-    if (
-           (sdtr_period_ix > asc_dvc->max_sdtr_index)
-) {
-        return (0xFF);
-    }
-    byte = (sdtr_period_ix << 4) | (syn_offset & ASC_SYN_MAX_OFFSET);
-    return (byte);
+       uchar byte;
+       uchar sdtr_period_ix;
+
+       sdtr_period_ix = AscGetSynPeriodIndex(asc_dvc, sdtr_period);
+       if ((sdtr_period_ix > asc_dvc->max_sdtr_index)
+           ) {
+               return (0xFF);
+       }
+       byte = (sdtr_period_ix << 4) | (syn_offset & ASC_SYN_MAX_OFFSET);
+       return (byte);
 }
 
-STATIC void
-AscSetChipSDTR(
-                  PortAddr iop_base,
-                  uchar sdtr_data,
-                  uchar tid_no
-)
+static void AscSetChipSDTR(PortAddr iop_base, uchar sdtr_data, uchar tid_no)
 {
-    AscSetChipSynRegAtID(iop_base, tid_no, sdtr_data);
-    AscPutMCodeSDTRDoneAtID(iop_base, tid_no, sdtr_data);
-    return;
+       AscSetChipSynRegAtID(iop_base, tid_no, sdtr_data);
+       AscPutMCodeSDTRDoneAtID(iop_base, tid_no, sdtr_data);
+       return;
 }
 
-STATIC uchar
-AscGetSynPeriodIndex(
-                        ASC_DVC_VAR *asc_dvc,
-                        uchar syn_time
-)
+static uchar AscGetSynPeriodIndex(ASC_DVC_VAR *asc_dvc, uchar syn_time)
 {
-    uchar             *period_table;
-    int                 max_index;
-    int                 min_index;
-    int                 i;
-
-    period_table = asc_dvc->sdtr_period_tbl;
-    max_index = (int) asc_dvc->max_sdtr_index;
-    min_index = (int)asc_dvc->host_init_sdtr_index;
-    if ((syn_time <= period_table[max_index])) {
-        for (i = min_index; i < (max_index - 1); i++) {
-            if (syn_time <= period_table[i]) {
-                return ((uchar) i);
-            }
-        }
-        return ((uchar) max_index);
-    } else {
-        return ((uchar) (max_index + 1));
-    }
+       uchar *period_table;
+       int max_index;
+       int min_index;
+       int i;
+
+       period_table = asc_dvc->sdtr_period_tbl;
+       max_index = (int)asc_dvc->max_sdtr_index;
+       min_index = (int)asc_dvc->host_init_sdtr_index;
+       if ((syn_time <= period_table[max_index])) {
+               for (i = min_index; i < (max_index - 1); i++) {
+                       if (syn_time <= period_table[i]) {
+                               return ((uchar)i);
+                       }
+               }
+               return ((uchar)max_index);
+       } else {
+               return ((uchar)(max_index + 1));
+       }
 }
 
-STATIC uchar
-AscAllocFreeQueue(
-                     PortAddr iop_base,
-                     uchar free_q_head
-)
+static uchar AscAllocFreeQueue(PortAddr iop_base, uchar free_q_head)
 {
-    ushort              q_addr;
-    uchar               next_qp;
-    uchar               q_status;
-
-    q_addr = ASC_QNO_TO_QADDR(free_q_head);
-    q_status = (uchar) AscReadLramByte(iop_base,
-                                    (ushort) (q_addr + ASC_SCSIQ_B_STATUS));
-    next_qp = AscReadLramByte(iop_base,
-                              (ushort) (q_addr + ASC_SCSIQ_B_FWD));
-    if (((q_status & QS_READY) == 0) && (next_qp != ASC_QLINK_END)) {
-        return (next_qp);
-    }
-    return (ASC_QLINK_END);
+       ushort q_addr;
+       uchar next_qp;
+       uchar q_status;
+
+       q_addr = ASC_QNO_TO_QADDR(free_q_head);
+       q_status = (uchar)AscReadLramByte(iop_base,
+                                         (ushort)(q_addr +
+                                                  ASC_SCSIQ_B_STATUS));
+       next_qp = AscReadLramByte(iop_base, (ushort)(q_addr + ASC_SCSIQ_B_FWD));
+       if (((q_status & QS_READY) == 0) && (next_qp != ASC_QLINK_END)) {
+               return (next_qp);
+       }
+       return (ASC_QLINK_END);
 }
 
-STATIC uchar
-AscAllocMultipleFreeQueue(
-                             PortAddr iop_base,
-                             uchar free_q_head,
-                             uchar n_free_q
-)
+static uchar
+AscAllocMultipleFreeQueue(PortAddr iop_base, uchar free_q_head, uchar n_free_q)
 {
-    uchar               i;
+       uchar i;
 
-    for (i = 0; i < n_free_q; i++) {
-        if ((free_q_head = AscAllocFreeQueue(iop_base, free_q_head))
-            == ASC_QLINK_END) {
-            return (ASC_QLINK_END);
-        }
-    }
-    return (free_q_head);
+       for (i = 0; i < n_free_q; i++) {
+               if ((free_q_head = AscAllocFreeQueue(iop_base, free_q_head))
+                   == ASC_QLINK_END) {
+                       return (ASC_QLINK_END);
+               }
+       }
+       return (free_q_head);
 }
 
-STATIC int
-AscHostReqRiscHalt(
-                      PortAddr iop_base
-)
+static int AscHostReqRiscHalt(PortAddr iop_base)
 {
-    int                 count = 0;
-    int                 sta = 0;
-    uchar               saved_stop_code;
-
-    if (AscIsChipHalted(iop_base))
-        return (1);
-    saved_stop_code = AscReadLramByte(iop_base, ASCV_STOP_CODE_B);
-    AscWriteLramByte(iop_base, ASCV_STOP_CODE_B,
-                     ASC_STOP_HOST_REQ_RISC_HALT | ASC_STOP_REQ_RISC_STOP
-);
-    do {
-        if (AscIsChipHalted(iop_base)) {
-            sta = 1;
-            break;
-        }
-        DvcSleepMilliSecond(100);
-    } while (count++ < 20);
-    AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, saved_stop_code);
-    return (sta);
+       int count = 0;
+       int sta = 0;
+       uchar saved_stop_code;
+
+       if (AscIsChipHalted(iop_base))
+               return (1);
+       saved_stop_code = AscReadLramByte(iop_base, ASCV_STOP_CODE_B);
+       AscWriteLramByte(iop_base, ASCV_STOP_CODE_B,
+                        ASC_STOP_HOST_REQ_RISC_HALT | ASC_STOP_REQ_RISC_STOP);
+       do {
+               if (AscIsChipHalted(iop_base)) {
+                       sta = 1;
+                       break;
+               }
+               DvcSleepMilliSecond(100);
+       } while (count++ < 20);
+       AscWriteLramByte(iop_base, ASCV_STOP_CODE_B, saved_stop_code);
+       return (sta);
 }
 
-STATIC int
-AscStopQueueExe(
-                   PortAddr iop_base
-)
+static int AscStopQueueExe(PortAddr iop_base)
 {
-    int                 count = 0;
-
-    if (AscReadLramByte(iop_base, ASCV_STOP_CODE_B) == 0) {
-        AscWriteLramByte(iop_base, ASCV_STOP_CODE_B,
-                         ASC_STOP_REQ_RISC_STOP);
-        do {
-            if (
-                   AscReadLramByte(iop_base, ASCV_STOP_CODE_B) &
-                   ASC_STOP_ACK_RISC_STOP) {
-                return (1);
-            }
-            DvcSleepMilliSecond(100);
-        } while (count++ < 20);
-    }
-    return (0);
+       int count = 0;
+
+       if (AscReadLramByte(iop_base, ASCV_STOP_CODE_B) == 0) {
+               AscWriteLramByte(iop_base, ASCV_STOP_CODE_B,
+                                ASC_STOP_REQ_RISC_STOP);
+               do {
+                       if (AscReadLramByte(iop_base, ASCV_STOP_CODE_B) &
+                           ASC_STOP_ACK_RISC_STOP) {
+                               return (1);
+                       }
+                       DvcSleepMilliSecond(100);
+               } while (count++ < 20);
+       }
+       return (0);
 }
 
-STATIC void
-DvcDelayMicroSecond(ADV_DVC_VAR *asc_dvc, ushort micro_sec)
+static void DvcDelayMicroSecond(ADV_DVC_VAR *asc_dvc, ushort micro_sec)
 {
-    udelay(micro_sec);
+       udelay(micro_sec);
 }
 
-STATIC void
-DvcDelayNanoSecond(ASC_DVC_VAR *asc_dvc, ASC_DCNT nano_sec)
+static void DvcDelayNanoSecond(ASC_DVC_VAR *asc_dvc, ASC_DCNT nano_sec)
 {
-    udelay((nano_sec + 999)/1000);
+       udelay((nano_sec + 999) / 1000);
 }
 
 #ifdef CONFIG_ISA
-STATIC ASC_DCNT __init
-AscGetEisaProductID(
-                       PortAddr iop_base)
+static ASC_DCNT __init AscGetEisaProductID(PortAddr iop_base)
 {
-    PortAddr            eisa_iop;
-    ushort              product_id_high, product_id_low;
-    ASC_DCNT            product_id;
-
-    eisa_iop = ASC_GET_EISA_SLOT(iop_base) | ASC_EISA_PID_IOP_MASK;
-    product_id_low = inpw(eisa_iop);
-    product_id_high = inpw(eisa_iop + 2);
-    product_id = ((ASC_DCNT) product_id_high << 16) |
-        (ASC_DCNT) product_id_low;
-    return (product_id);
+       PortAddr eisa_iop;
+       ushort product_id_high, product_id_low;
+       ASC_DCNT product_id;
+
+       eisa_iop = ASC_GET_EISA_SLOT(iop_base) | ASC_EISA_PID_IOP_MASK;
+       product_id_low = inpw(eisa_iop);
+       product_id_high = inpw(eisa_iop + 2);
+       product_id = ((ASC_DCNT) product_id_high << 16) |
+           (ASC_DCNT) product_id_low;
+       return (product_id);
 }
 
-STATIC PortAddr __init
-AscSearchIOPortAddrEISA(
-                           PortAddr iop_base)
+static PortAddr __init AscSearchIOPortAddrEISA(PortAddr iop_base)
 {
-    ASC_DCNT            eisa_product_id;
-
-    if (iop_base == 0) {
-        iop_base = ASC_EISA_MIN_IOP_ADDR;
-    } else {
-        if (iop_base == ASC_EISA_MAX_IOP_ADDR)
-            return (0);
-        if ((iop_base & 0x0050) == 0x0050) {
-            iop_base += ASC_EISA_BIG_IOP_GAP;
-        } else {
-            iop_base += ASC_EISA_SMALL_IOP_GAP;
-        }
-    }
-    while (iop_base <= ASC_EISA_MAX_IOP_ADDR) {
-        eisa_product_id = AscGetEisaProductID(iop_base);
-        if ((eisa_product_id == ASC_EISA_ID_740) ||
-            (eisa_product_id == ASC_EISA_ID_750)) {
-            if (AscFindSignature(iop_base)) {
-                inpw(iop_base + 4);
-                return (iop_base);
-            }
-        }
-        if (iop_base == ASC_EISA_MAX_IOP_ADDR)
-            return (0);
-        if ((iop_base & 0x0050) == 0x0050) {
-            iop_base += ASC_EISA_BIG_IOP_GAP;
-        } else {
-            iop_base += ASC_EISA_SMALL_IOP_GAP;
-        }
-    }
-    return (0);
+       ASC_DCNT eisa_product_id;
+
+       if (iop_base == 0) {
+               iop_base = ASC_EISA_MIN_IOP_ADDR;
+       } else {
+               if (iop_base == ASC_EISA_MAX_IOP_ADDR)
+                       return (0);
+               if ((iop_base & 0x0050) == 0x0050) {
+                       iop_base += ASC_EISA_BIG_IOP_GAP;
+               } else {
+                       iop_base += ASC_EISA_SMALL_IOP_GAP;
+               }
+       }
+       while (iop_base <= ASC_EISA_MAX_IOP_ADDR) {
+               eisa_product_id = AscGetEisaProductID(iop_base);
+               if ((eisa_product_id == ASC_EISA_ID_740) ||
+                   (eisa_product_id == ASC_EISA_ID_750)) {
+                       if (AscFindSignature(iop_base)) {
+                               inpw(iop_base + 4);
+                               return (iop_base);
+                       }
+               }
+               if (iop_base == ASC_EISA_MAX_IOP_ADDR)
+                       return (0);
+               if ((iop_base & 0x0050) == 0x0050) {
+                       iop_base += ASC_EISA_BIG_IOP_GAP;
+               } else {
+                       iop_base += ASC_EISA_SMALL_IOP_GAP;
+               }
+       }
+       return (0);
 }
 #endif /* CONFIG_ISA */
 
-STATIC int
-AscStartChip(
-                PortAddr iop_base
-)
+static int AscStartChip(PortAddr iop_base)
 {
-    AscSetChipControl(iop_base, 0);
-    if ((AscGetChipStatus(iop_base) & CSW_HALTED) != 0) {
-        return (0);
-    }
-    return (1);
+       AscSetChipControl(iop_base, 0);
+       if ((AscGetChipStatus(iop_base) & CSW_HALTED) != 0) {
+               return (0);
+       }
+       return (1);
 }
 
-STATIC int
-AscStopChip(
-               PortAddr iop_base
-)
+static int AscStopChip(PortAddr iop_base)
 {
-    uchar               cc_val;
-
-    cc_val = AscGetChipControl(iop_base) & (~(CC_SINGLE_STEP | CC_TEST | CC_DIAG));
-    AscSetChipControl(iop_base, (uchar) (cc_val | CC_HALT));
-    AscSetChipIH(iop_base, INS_HALT);
-    AscSetChipIH(iop_base, INS_RFLAG_WTM);
-    if ((AscGetChipStatus(iop_base) & CSW_HALTED) == 0) {
-        return (0);
-    }
-    return (1);
+       uchar cc_val;
+
+       cc_val =
+           AscGetChipControl(iop_base) &
+           (~(CC_SINGLE_STEP | CC_TEST | CC_DIAG));
+       AscSetChipControl(iop_base, (uchar)(cc_val | CC_HALT));
+       AscSetChipIH(iop_base, INS_HALT);
+       AscSetChipIH(iop_base, INS_RFLAG_WTM);
+       if ((AscGetChipStatus(iop_base) & CSW_HALTED) == 0) {
+               return (0);
+       }
+       return (1);
 }
 
-STATIC int
-AscIsChipHalted(
-                   PortAddr iop_base
-)
+static int AscIsChipHalted(PortAddr iop_base)
 {
-    if ((AscGetChipStatus(iop_base) & CSW_HALTED) != 0) {
-        if ((AscGetChipControl(iop_base) & CC_HALT) != 0) {
-            return (1);
-        }
-    }
-    return (0);
+       if ((AscGetChipStatus(iop_base) & CSW_HALTED) != 0) {
+               if ((AscGetChipControl(iop_base) & CC_HALT) != 0) {
+                       return (1);
+               }
+       }
+       return (0);
 }
 
-STATIC void
-AscSetChipIH(
-                PortAddr iop_base,
-                ushort ins_code
-)
+static void AscSetChipIH(PortAddr iop_base, ushort ins_code)
 {
-    AscSetBank(iop_base, 1);
-    AscWriteChipIH(iop_base, ins_code);
-    AscSetBank(iop_base, 0);
-    return;
+       AscSetBank(iop_base, 1);
+       AscWriteChipIH(iop_base, ins_code);
+       AscSetBank(iop_base, 0);
+       return;
 }
 
-STATIC void
-AscAckInterrupt(
-                   PortAddr iop_base
-)
+static void AscAckInterrupt(PortAddr iop_base)
 {
-    uchar               host_flag;
-    uchar               risc_flag;
-    ushort              loop;
-
-    loop = 0;
-    do {
-        risc_flag = AscReadLramByte(iop_base, ASCV_RISC_FLAG_B);
-        if (loop++ > 0x7FFF) {
-            break;
-        }
-    } while ((risc_flag & ASC_RISC_FLAG_GEN_INT) != 0);
-    host_flag = AscReadLramByte(iop_base, ASCV_HOST_FLAG_B) & (~ASC_HOST_FLAG_ACK_INT);
-    AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B,
-                     (uchar) (host_flag | ASC_HOST_FLAG_ACK_INT));
-    AscSetChipStatus(iop_base, CIW_INT_ACK);
-    loop = 0;
-    while (AscGetChipStatus(iop_base) & CSW_INT_PENDING) {
-        AscSetChipStatus(iop_base, CIW_INT_ACK);
-        if (loop++ > 3) {
-            break;
-        }
-    }
-    AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag);
-    return;
+       uchar host_flag;
+       uchar risc_flag;
+       ushort loop;
+
+       loop = 0;
+       do {
+               risc_flag = AscReadLramByte(iop_base, ASCV_RISC_FLAG_B);
+               if (loop++ > 0x7FFF) {
+                       break;
+               }
+       } while ((risc_flag & ASC_RISC_FLAG_GEN_INT) != 0);
+       host_flag =
+           AscReadLramByte(iop_base,
+                           ASCV_HOST_FLAG_B) & (~ASC_HOST_FLAG_ACK_INT);
+       AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B,
+                        (uchar)(host_flag | ASC_HOST_FLAG_ACK_INT));
+       AscSetChipStatus(iop_base, CIW_INT_ACK);
+       loop = 0;
+       while (AscGetChipStatus(iop_base) & CSW_INT_PENDING) {
+               AscSetChipStatus(iop_base, CIW_INT_ACK);
+               if (loop++ > 3) {
+                       break;
+               }
+       }
+       AscWriteLramByte(iop_base, ASCV_HOST_FLAG_B, host_flag);
+       return;
 }
 
-STATIC void
-AscDisableInterrupt(
-                       PortAddr iop_base
-)
+static void AscDisableInterrupt(PortAddr iop_base)
 {
-    ushort              cfg;
+       ushort cfg;
 
-    cfg = AscGetChipCfgLsw(iop_base);
-    AscSetChipCfgLsw(iop_base, cfg & (~ASC_CFG0_HOST_INT_ON));
-    return;
+       cfg = AscGetChipCfgLsw(iop_base);
+       AscSetChipCfgLsw(iop_base, cfg & (~ASC_CFG0_HOST_INT_ON));
+       return;
 }
 
-STATIC void
-AscEnableInterrupt(
-                      PortAddr iop_base
-)
+static void AscEnableInterrupt(PortAddr iop_base)
 {
-    ushort              cfg;
+       ushort cfg;
 
-    cfg = AscGetChipCfgLsw(iop_base);
-    AscSetChipCfgLsw(iop_base, cfg | ASC_CFG0_HOST_INT_ON);
-    return;
+       cfg = AscGetChipCfgLsw(iop_base);
+       AscSetChipCfgLsw(iop_base, cfg | ASC_CFG0_HOST_INT_ON);
+       return;
 }
 
-
-
-STATIC void
-AscSetBank(
-              PortAddr iop_base,
-              uchar bank
-)
+static void AscSetBank(PortAddr iop_base, uchar bank)
 {
-    uchar               val;
-
-    val = AscGetChipControl(iop_base) &
-      (~(CC_SINGLE_STEP | CC_TEST | CC_DIAG | CC_SCSI_RESET | CC_CHIP_RESET));
-    if (bank == 1) {
-        val |= CC_BANK_ONE;
-    } else if (bank == 2) {
-        val |= CC_DIAG | CC_BANK_ONE;
-    } else {
-        val &= ~CC_BANK_ONE;
-    }
-    AscSetChipControl(iop_base, val);
-    return;
+       uchar val;
+
+       val = AscGetChipControl(iop_base) &
+           (~
+            (CC_SINGLE_STEP | CC_TEST | CC_DIAG | CC_SCSI_RESET |
+             CC_CHIP_RESET));
+       if (bank == 1) {
+               val |= CC_BANK_ONE;
+       } else if (bank == 2) {
+               val |= CC_DIAG | CC_BANK_ONE;
+       } else {
+               val &= ~CC_BANK_ONE;
+       }
+       AscSetChipControl(iop_base, val);
+       return;
 }
 
-STATIC int
-AscResetChipAndScsiBus(
-                          ASC_DVC_VAR *asc_dvc
-)
+static int AscResetChipAndScsiBus(ASC_DVC_VAR *asc_dvc)
 {
-    PortAddr    iop_base;
-    int         i = 10;
+       PortAddr iop_base;
+       int i = 10;
 
-    iop_base = asc_dvc->iop_base;
-    while ((AscGetChipStatus(iop_base) & CSW_SCSI_RESET_ACTIVE) && (i-- > 0))
-    {
-          DvcSleepMilliSecond(100);
-    }
-    AscStopChip(iop_base);
-    AscSetChipControl(iop_base, CC_CHIP_RESET | CC_SCSI_RESET | CC_HALT);
-    DvcDelayNanoSecond(asc_dvc, 60000);
-    AscSetChipIH(iop_base, INS_RFLAG_WTM);
-    AscSetChipIH(iop_base, INS_HALT);
-    AscSetChipControl(iop_base, CC_CHIP_RESET | CC_HALT);
-    AscSetChipControl(iop_base, CC_HALT);
-    DvcSleepMilliSecond(200);
-    AscSetChipStatus(iop_base, CIW_CLR_SCSI_RESET_INT);
-    AscSetChipStatus(iop_base, 0);
-    return (AscIsChipHalted(iop_base));
+       iop_base = asc_dvc->iop_base;
+       while ((AscGetChipStatus(iop_base) & CSW_SCSI_RESET_ACTIVE)
+              && (i-- > 0)) {
+               DvcSleepMilliSecond(100);
+       }
+       AscStopChip(iop_base);
+       AscSetChipControl(iop_base, CC_CHIP_RESET | CC_SCSI_RESET | CC_HALT);
+       DvcDelayNanoSecond(asc_dvc, 60000);
+       AscSetChipIH(iop_base, INS_RFLAG_WTM);
+       AscSetChipIH(iop_base, INS_HALT);
+       AscSetChipControl(iop_base, CC_CHIP_RESET | CC_HALT);
+       AscSetChipControl(iop_base, CC_HALT);
+       DvcSleepMilliSecond(200);
+       AscSetChipStatus(iop_base, CIW_CLR_SCSI_RESET_INT);
+       AscSetChipStatus(iop_base, 0);
+       return (AscIsChipHalted(iop_base));
 }
 
-STATIC ASC_DCNT __init
-AscGetMaxDmaCount(
-                     ushort bus_type)
+static ASC_DCNT __init AscGetMaxDmaCount(ushort bus_type)
 {
-    if (bus_type & ASC_IS_ISA)
-        return (ASC_MAX_ISA_DMA_COUNT);
-    else if (bus_type & (ASC_IS_EISA | ASC_IS_VL))
-        return (ASC_MAX_VL_DMA_COUNT);
-    return (ASC_MAX_PCI_DMA_COUNT);
+       if (bus_type & ASC_IS_ISA)
+               return (ASC_MAX_ISA_DMA_COUNT);
+       else if (bus_type & (ASC_IS_EISA | ASC_IS_VL))
+               return (ASC_MAX_VL_DMA_COUNT);
+       return (ASC_MAX_PCI_DMA_COUNT);
 }
 
 #ifdef CONFIG_ISA
-STATIC ushort __init
-AscGetIsaDmaChannel(
-                       PortAddr iop_base)
+static ushort __init AscGetIsaDmaChannel(PortAddr iop_base)
 {
-    ushort              channel;
-
-    channel = AscGetChipCfgLsw(iop_base) & 0x0003;
-    if (channel == 0x03)
-        return (0);
-    else if (channel == 0x00)
-        return (7);
-    return (channel + 4);
+       ushort channel;
+
+       channel = AscGetChipCfgLsw(iop_base) & 0x0003;
+       if (channel == 0x03)
+               return (0);
+       else if (channel == 0x00)
+               return (7);
+       return (channel + 4);
 }
 
-STATIC ushort __init
-AscSetIsaDmaChannel(
-                       PortAddr iop_base,
-                       ushort dma_channel)
+static ushort __init AscSetIsaDmaChannel(PortAddr iop_base, ushort dma_channel)
 {
-    ushort              cfg_lsw;
-    uchar               value;
-
-    if ((dma_channel >= 5) && (dma_channel <= 7)) {
-        if (dma_channel == 7)
-            value = 0x00;
-        else
-            value = dma_channel - 4;
-        cfg_lsw = AscGetChipCfgLsw(iop_base) & 0xFFFC;
-        cfg_lsw |= value;
-        AscSetChipCfgLsw(iop_base, cfg_lsw);
-        return (AscGetIsaDmaChannel(iop_base));
-    }
-    return (0);
+       ushort cfg_lsw;
+       uchar value;
+
+       if ((dma_channel >= 5) && (dma_channel <= 7)) {
+               if (dma_channel == 7)
+                       value = 0x00;
+               else
+                       value = dma_channel - 4;
+               cfg_lsw = AscGetChipCfgLsw(iop_base) & 0xFFFC;
+               cfg_lsw |= value;
+               AscSetChipCfgLsw(iop_base, cfg_lsw);
+               return (AscGetIsaDmaChannel(iop_base));
+       }
+       return (0);
 }
 
-STATIC uchar __init
-AscSetIsaDmaSpeed(
-                     PortAddr iop_base,
-                     uchar speed_value)
+static uchar __init AscSetIsaDmaSpeed(PortAddr iop_base, uchar speed_value)
 {
-    speed_value &= 0x07;
-    AscSetBank(iop_base, 1);
-    AscWriteChipDmaSpeed(iop_base, speed_value);
-    AscSetBank(iop_base, 0);
-    return (AscGetIsaDmaSpeed(iop_base));
+       speed_value &= 0x07;
+       AscSetBank(iop_base, 1);
+       AscWriteChipDmaSpeed(iop_base, speed_value);
+       AscSetBank(iop_base, 0);
+       return (AscGetIsaDmaSpeed(iop_base));
 }
 
-STATIC uchar __init
-AscGetIsaDmaSpeed(
-                     PortAddr iop_base
-)
+static uchar __init AscGetIsaDmaSpeed(PortAddr iop_base)
 {
-    uchar               speed_value;
+       uchar speed_value;
 
-    AscSetBank(iop_base, 1);
-    speed_value = AscReadChipDmaSpeed(iop_base);
-    speed_value &= 0x07;
-    AscSetBank(iop_base, 0);
-    return (speed_value);
+       AscSetBank(iop_base, 1);
+       speed_value = AscReadChipDmaSpeed(iop_base);
+       speed_value &= 0x07;
+       AscSetBank(iop_base, 0);
+       return (speed_value);
 }
 #endif /* CONFIG_ISA */
 
-STATIC ushort __init
-AscReadPCIConfigWord(
-    ASC_DVC_VAR *asc_dvc,
-    ushort pci_config_offset)
+static ushort __init
+AscReadPCIConfigWord(ASC_DVC_VAR *asc_dvc, ushort pci_config_offset)
 {
-    uchar       lsb, msb;
+       uchar lsb, msb;
 
-    lsb = DvcReadPCIConfigByte(asc_dvc, pci_config_offset);
-    msb = DvcReadPCIConfigByte(asc_dvc, pci_config_offset + 1);
-    return ((ushort) ((msb << 8) | lsb));
+       lsb = DvcReadPCIConfigByte(asc_dvc, pci_config_offset);
+       msb = DvcReadPCIConfigByte(asc_dvc, pci_config_offset + 1);
+       return ((ushort)((msb << 8) | lsb));
 }
 
-STATIC ushort __init
-AscInitGetConfig(
-        ASC_DVC_VAR *asc_dvc
-)
+static ushort __init AscInitGetConfig(ASC_DVC_VAR *asc_dvc)
 {
-    ushort              warn_code;
-    PortAddr            iop_base;
-    ushort              PCIDeviceID;
-    ushort              PCIVendorID;
-    uchar               PCIRevisionID;
-    uchar               prevCmdRegBits;
-
-    warn_code = 0;
-    iop_base = asc_dvc->iop_base;
-    asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG;
-    if (asc_dvc->err_code != 0) {
-        return (UW_ERR);
-    }
-    if (asc_dvc->bus_type == ASC_IS_PCI) {
-        PCIVendorID = AscReadPCIConfigWord(asc_dvc,
-                                    AscPCIConfigVendorIDRegister);
-
-        PCIDeviceID = AscReadPCIConfigWord(asc_dvc,
-                                    AscPCIConfigDeviceIDRegister);
-
-        PCIRevisionID = DvcReadPCIConfigByte(asc_dvc,
-                                    AscPCIConfigRevisionIDRegister);
-
-        if (PCIVendorID != PCI_VENDOR_ID_ASP) {
-            warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
-        }
-        prevCmdRegBits = DvcReadPCIConfigByte(asc_dvc,
-                                    AscPCIConfigCommandRegister);
-
-        if ((prevCmdRegBits & AscPCICmdRegBits_IOMemBusMaster) !=
-            AscPCICmdRegBits_IOMemBusMaster) {
-            DvcWritePCIConfigByte(asc_dvc,
-                            AscPCIConfigCommandRegister,
-                            (prevCmdRegBits |
-                             AscPCICmdRegBits_IOMemBusMaster));
-
-            if ((DvcReadPCIConfigByte(asc_dvc,
-                                AscPCIConfigCommandRegister)
-                 & AscPCICmdRegBits_IOMemBusMaster)
-                != AscPCICmdRegBits_IOMemBusMaster) {
-                warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
-            }
-        }
-        if ((PCIDeviceID == PCI_DEVICE_ID_ASP_1200A) ||
-            (PCIDeviceID == PCI_DEVICE_ID_ASP_ABP940)) {
-            DvcWritePCIConfigByte(asc_dvc,
-                            AscPCIConfigLatencyTimer, 0x00);
-            if (DvcReadPCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer)
-                != 0x00) {
-                warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
-            }
-        } else if (PCIDeviceID == PCI_DEVICE_ID_ASP_ABP940U) {
-            if (DvcReadPCIConfigByte(asc_dvc,
-                                AscPCIConfigLatencyTimer) < 0x20) {
-                DvcWritePCIConfigByte(asc_dvc,
-                                    AscPCIConfigLatencyTimer, 0x20);
-
-                if (DvcReadPCIConfigByte(asc_dvc,
-                                    AscPCIConfigLatencyTimer) < 0x20) {
-                    warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
-                }
-            }
-        }
-    }
+       ushort warn_code;
+       PortAddr iop_base;
+       ushort PCIDeviceID;
+       ushort PCIVendorID;
+       uchar PCIRevisionID;
+       uchar prevCmdRegBits;
+
+       warn_code = 0;
+       iop_base = asc_dvc->iop_base;
+       asc_dvc->init_state = ASC_INIT_STATE_BEG_GET_CFG;
+       if (asc_dvc->err_code != 0) {
+               return (UW_ERR);
+       }
+       if (asc_dvc->bus_type == ASC_IS_PCI) {
+               PCIVendorID = AscReadPCIConfigWord(asc_dvc,
+                                                  AscPCIConfigVendorIDRegister);
+
+               PCIDeviceID = AscReadPCIConfigWord(asc_dvc,
+                                                  AscPCIConfigDeviceIDRegister);
+
+               PCIRevisionID = DvcReadPCIConfigByte(asc_dvc,
+                                                    AscPCIConfigRevisionIDRegister);
+
+               if (PCIVendorID != PCI_VENDOR_ID_ASP) {
+                       warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
+               }
+               prevCmdRegBits = DvcReadPCIConfigByte(asc_dvc,
+                                                     AscPCIConfigCommandRegister);
+
+               if ((prevCmdRegBits & AscPCICmdRegBits_IOMemBusMaster) !=
+                   AscPCICmdRegBits_IOMemBusMaster) {
+                       DvcWritePCIConfigByte(asc_dvc,
+                                             AscPCIConfigCommandRegister,
+                                             (prevCmdRegBits |
+                                              AscPCICmdRegBits_IOMemBusMaster));
+
+                       if ((DvcReadPCIConfigByte(asc_dvc,
+                                                 AscPCIConfigCommandRegister)
+                            & AscPCICmdRegBits_IOMemBusMaster)
+                           != AscPCICmdRegBits_IOMemBusMaster) {
+                               warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
+                       }
+               }
+               if ((PCIDeviceID == PCI_DEVICE_ID_ASP_1200A) ||
+                   (PCIDeviceID == PCI_DEVICE_ID_ASP_ABP940)) {
+                       DvcWritePCIConfigByte(asc_dvc,
+                                             AscPCIConfigLatencyTimer, 0x00);
+                       if (DvcReadPCIConfigByte
+                           (asc_dvc, AscPCIConfigLatencyTimer)
+                           != 0x00) {
+                               warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
+                       }
+               } else if (PCIDeviceID == PCI_DEVICE_ID_ASP_ABP940U) {
+                       if (DvcReadPCIConfigByte(asc_dvc,
+                                                AscPCIConfigLatencyTimer) <
+                           0x20) {
+                               DvcWritePCIConfigByte(asc_dvc,
+                                                     AscPCIConfigLatencyTimer,
+                                                     0x20);
+
+                               if (DvcReadPCIConfigByte(asc_dvc,
+                                                        AscPCIConfigLatencyTimer)
+                                   < 0x20) {
+                                       warn_code |=
+                                           ASC_WARN_SET_PCI_CONFIG_SPACE;
+                               }
+                       }
+               }
+       }
 
-    if (AscFindSignature(iop_base)) {
-        warn_code |= AscInitAscDvcVar(asc_dvc);
-        warn_code |= AscInitFromEEP(asc_dvc);
-        asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG;
-        if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT) {
-            asc_dvc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT;
-        }
-    } else {
-        asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
-    }
-    return(warn_code);
+       if (AscFindSignature(iop_base)) {
+               warn_code |= AscInitAscDvcVar(asc_dvc);
+               warn_code |= AscInitFromEEP(asc_dvc);
+               asc_dvc->init_state |= ASC_INIT_STATE_END_GET_CFG;
+               if (asc_dvc->scsi_reset_wait > ASC_MAX_SCSI_RESET_WAIT) {
+                       asc_dvc->scsi_reset_wait = ASC_MAX_SCSI_RESET_WAIT;
+               }
+       } else {
+               asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
+       }
+       return (warn_code);
 }
 
-STATIC ushort __init
-AscInitSetConfig(
-                    ASC_DVC_VAR *asc_dvc
-)
+static ushort __init AscInitSetConfig(ASC_DVC_VAR *asc_dvc)
 {
-    ushort              warn_code = 0;
-
-    asc_dvc->init_state |= ASC_INIT_STATE_BEG_SET_CFG;
-    if (asc_dvc->err_code != 0)
-        return (UW_ERR);
-    if (AscFindSignature(asc_dvc->iop_base)) {
-        warn_code |= AscInitFromAscDvcVar(asc_dvc);
-        asc_dvc->init_state |= ASC_INIT_STATE_END_SET_CFG;
-    } else {
-        asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
-    }
-    return (warn_code);
+       ushort warn_code = 0;
+
+       asc_dvc->init_state |= ASC_INIT_STATE_BEG_SET_CFG;
+       if (asc_dvc->err_code != 0)
+               return (UW_ERR);
+       if (AscFindSignature(asc_dvc->iop_base)) {
+               warn_code |= AscInitFromAscDvcVar(asc_dvc);
+               asc_dvc->init_state |= ASC_INIT_STATE_END_SET_CFG;
+       } else {
+               asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
+       }
+       return (warn_code);
 }
 
-STATIC ushort __init
-AscInitFromAscDvcVar(
-                        ASC_DVC_VAR *asc_dvc
-)
+static ushort __init AscInitFromAscDvcVar(ASC_DVC_VAR *asc_dvc)
 {
-    PortAddr            iop_base;
-    ushort              cfg_msw;
-    ushort              warn_code;
-    ushort              pci_device_id = 0;
+       PortAddr iop_base;
+       ushort cfg_msw;
+       ushort warn_code;
+       ushort pci_device_id = 0;
 
-    iop_base = asc_dvc->iop_base;
+       iop_base = asc_dvc->iop_base;
 #ifdef CONFIG_PCI
-    if (asc_dvc->cfg->dev)
-        pci_device_id = to_pci_dev(asc_dvc->cfg->dev)->device;
+       if (asc_dvc->cfg->dev)
+               pci_device_id = to_pci_dev(asc_dvc->cfg->dev)->device;
 #endif
-    warn_code = 0;
-    cfg_msw = AscGetChipCfgMsw(iop_base);
-    if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) {
-        cfg_msw &= (~(ASC_CFG_MSW_CLR_MASK));
-        warn_code |= ASC_WARN_CFG_MSW_RECOVER;
-        AscSetChipCfgMsw(iop_base, cfg_msw);
-    }
-    if ((asc_dvc->cfg->cmd_qng_enabled & asc_dvc->cfg->disc_enable) !=
-        asc_dvc->cfg->cmd_qng_enabled) {
-        asc_dvc->cfg->disc_enable = asc_dvc->cfg->cmd_qng_enabled;
-        warn_code |= ASC_WARN_CMD_QNG_CONFLICT;
-    }
-    if (AscGetChipStatus(iop_base) & CSW_AUTO_CONFIG) {
-        warn_code |= ASC_WARN_AUTO_CONFIG;
-    }
-    if ((asc_dvc->bus_type & (ASC_IS_ISA | ASC_IS_VL)) != 0) {
-        if (AscSetChipIRQ(iop_base, asc_dvc->irq_no, asc_dvc->bus_type)
-            != asc_dvc->irq_no) {
-            asc_dvc->err_code |= ASC_IERR_SET_IRQ_NO;
-        }
-    }
-    if (asc_dvc->bus_type & ASC_IS_PCI) {
-        cfg_msw &= 0xFFC0;
-        AscSetChipCfgMsw(iop_base, cfg_msw);
-        if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) {
-        } else {
-            if ((pci_device_id == PCI_DEVICE_ID_ASP_1200A) ||
-                (pci_device_id == PCI_DEVICE_ID_ASP_ABP940)) {
-                asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB;
-                asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN;
-            }
-        }
-    } else if (asc_dvc->bus_type == ASC_IS_ISAPNP) {
-        if (AscGetChipVersion(iop_base, asc_dvc->bus_type)
-            == ASC_CHIP_VER_ASYN_BUG) {
-            asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN;
-        }
-    }
-    if (AscSetChipScsiID(iop_base, asc_dvc->cfg->chip_scsi_id) !=
-        asc_dvc->cfg->chip_scsi_id) {
-        asc_dvc->err_code |= ASC_IERR_SET_SCSI_ID;
-    }
+       warn_code = 0;
+       cfg_msw = AscGetChipCfgMsw(iop_base);
+       if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) {
+               cfg_msw &= (~(ASC_CFG_MSW_CLR_MASK));
+               warn_code |= ASC_WARN_CFG_MSW_RECOVER;
+               AscSetChipCfgMsw(iop_base, cfg_msw);
+       }
+       if ((asc_dvc->cfg->cmd_qng_enabled & asc_dvc->cfg->disc_enable) !=
+           asc_dvc->cfg->cmd_qng_enabled) {
+               asc_dvc->cfg->disc_enable = asc_dvc->cfg->cmd_qng_enabled;
+               warn_code |= ASC_WARN_CMD_QNG_CONFLICT;
+       }
+       if (AscGetChipStatus(iop_base) & CSW_AUTO_CONFIG) {
+               warn_code |= ASC_WARN_AUTO_CONFIG;
+       }
+       if ((asc_dvc->bus_type & (ASC_IS_ISA | ASC_IS_VL)) != 0) {
+               if (AscSetChipIRQ(iop_base, asc_dvc->irq_no, asc_dvc->bus_type)
+                   != asc_dvc->irq_no) {
+                       asc_dvc->err_code |= ASC_IERR_SET_IRQ_NO;
+               }
+       }
+       if (asc_dvc->bus_type & ASC_IS_PCI) {
+               cfg_msw &= 0xFFC0;
+               AscSetChipCfgMsw(iop_base, cfg_msw);
+               if ((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) {
+               } else {
+                       if ((pci_device_id == PCI_DEVICE_ID_ASP_1200A) ||
+                           (pci_device_id == PCI_DEVICE_ID_ASP_ABP940)) {
+                               asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_IF_NOT_DWB;
+                               asc_dvc->bug_fix_cntl |=
+                                   ASC_BUG_FIX_ASYN_USE_SYN;
+                       }
+               }
+       } else if (asc_dvc->bus_type == ASC_IS_ISAPNP) {
+               if (AscGetChipVersion(iop_base, asc_dvc->bus_type)
+                   == ASC_CHIP_VER_ASYN_BUG) {
+                       asc_dvc->bug_fix_cntl |= ASC_BUG_FIX_ASYN_USE_SYN;
+               }
+       }
+       if (AscSetChipScsiID(iop_base, asc_dvc->cfg->chip_scsi_id) !=
+           asc_dvc->cfg->chip_scsi_id) {
+               asc_dvc->err_code |= ASC_IERR_SET_SCSI_ID;
+       }
 #ifdef CONFIG_ISA
-    if (asc_dvc->bus_type & ASC_IS_ISA) {
-        AscSetIsaDmaChannel(iop_base, asc_dvc->cfg->isa_dma_channel);
-        AscSetIsaDmaSpeed(iop_base, asc_dvc->cfg->isa_dma_speed);
-    }
+       if (asc_dvc->bus_type & ASC_IS_ISA) {
+               AscSetIsaDmaChannel(iop_base, asc_dvc->cfg->isa_dma_channel);
+               AscSetIsaDmaSpeed(iop_base, asc_dvc->cfg->isa_dma_speed);
+       }
 #endif /* CONFIG_ISA */
-    return (warn_code);
+       return (warn_code);
 }
 
-STATIC ushort
-AscInitAsc1000Driver(
-                        ASC_DVC_VAR *asc_dvc
-)
+static ushort AscInitAsc1000Driver(ASC_DVC_VAR *asc_dvc)
 {
-    ushort              warn_code;
-    PortAddr            iop_base;
-
-    iop_base = asc_dvc->iop_base;
-    warn_code = 0;
-    if ((asc_dvc->dvc_cntl & ASC_CNTL_RESET_SCSI) &&
-        !(asc_dvc->init_state & ASC_INIT_RESET_SCSI_DONE)) {
-        AscResetChipAndScsiBus(asc_dvc);
-        DvcSleepMilliSecond((ASC_DCNT)
-            ((ushort) asc_dvc->scsi_reset_wait * 1000));
-    }
-    asc_dvc->init_state |= ASC_INIT_STATE_BEG_LOAD_MC;
-    if (asc_dvc->err_code != 0)
-        return (UW_ERR);
-    if (!AscFindSignature(asc_dvc->iop_base)) {
-        asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
-        return (warn_code);
-    }
-    AscDisableInterrupt(iop_base);
-    warn_code |= AscInitLram(asc_dvc);
-    if (asc_dvc->err_code != 0)
-        return (UW_ERR);
-    ASC_DBG1(1, "AscInitAsc1000Driver: _asc_mcode_chksum 0x%lx\n",
-        (ulong) _asc_mcode_chksum);
-    if (AscLoadMicroCode(iop_base, 0, _asc_mcode_buf,
-                         _asc_mcode_size) != _asc_mcode_chksum) {
-        asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
-        return (warn_code);
-    }
-    warn_code |= AscInitMicroCodeVar(asc_dvc);
-    asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC;
-    AscEnableInterrupt(iop_base);
-    return (warn_code);
+       ushort warn_code;
+       PortAddr iop_base;
+
+       iop_base = asc_dvc->iop_base;
+       warn_code = 0;
+       if ((asc_dvc->dvc_cntl & ASC_CNTL_RESET_SCSI) &&
+           !(asc_dvc->init_state & ASC_INIT_RESET_SCSI_DONE)) {
+               AscResetChipAndScsiBus(asc_dvc);
+               DvcSleepMilliSecond((ASC_DCNT)
+                                   ((ushort)asc_dvc->scsi_reset_wait * 1000));
+       }
+       asc_dvc->init_state |= ASC_INIT_STATE_BEG_LOAD_MC;
+       if (asc_dvc->err_code != 0)
+               return (UW_ERR);
+       if (!AscFindSignature(asc_dvc->iop_base)) {
+               asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
+               return (warn_code);
+       }
+       AscDisableInterrupt(iop_base);
+       warn_code |= AscInitLram(asc_dvc);
+       if (asc_dvc->err_code != 0)
+               return (UW_ERR);
+       ASC_DBG1(1, "AscInitAsc1000Driver: _asc_mcode_chksum 0x%lx\n",
+                (ulong)_asc_mcode_chksum);
+       if (AscLoadMicroCode(iop_base, 0, _asc_mcode_buf,
+                            _asc_mcode_size) != _asc_mcode_chksum) {
+               asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
+               return (warn_code);
+       }
+       warn_code |= AscInitMicroCodeVar(asc_dvc);
+       asc_dvc->init_state |= ASC_INIT_STATE_END_LOAD_MC;
+       AscEnableInterrupt(iop_base);
+       return (warn_code);
 }
 
-STATIC ushort __init
-AscInitAscDvcVar(
-                    ASC_DVC_VAR *asc_dvc)
+static ushort __init AscInitAscDvcVar(ASC_DVC_VAR *asc_dvc)
 {
-    int                 i;
-    PortAddr            iop_base;
-    ushort              warn_code;
-    uchar               chip_version;
-
-    iop_base = asc_dvc->iop_base;
-    warn_code = 0;
-    asc_dvc->err_code = 0;
-    if ((asc_dvc->bus_type &
-         (ASC_IS_ISA | ASC_IS_PCI | ASC_IS_EISA | ASC_IS_VL)) == 0) {
-        asc_dvc->err_code |= ASC_IERR_NO_BUS_TYPE;
-    }
-    AscSetChipControl(iop_base, CC_HALT);
-    AscSetChipStatus(iop_base, 0);
-    asc_dvc->bug_fix_cntl = 0;
-    asc_dvc->pci_fix_asyn_xfer = 0;
-    asc_dvc->pci_fix_asyn_xfer_always = 0;
-    /* asc_dvc->init_state initalized in AscInitGetConfig(). */
-    asc_dvc->sdtr_done = 0;
-    asc_dvc->cur_total_qng = 0;
-    asc_dvc->is_in_int = 0;
-    asc_dvc->in_critical_cnt = 0;
-    asc_dvc->last_q_shortage = 0;
-    asc_dvc->use_tagged_qng = 0;
-    asc_dvc->no_scam = 0;
-    asc_dvc->unit_not_ready = 0;
-    asc_dvc->queue_full_or_busy = 0;
-    asc_dvc->redo_scam = 0;
-    asc_dvc->res2 = 0;
-    asc_dvc->host_init_sdtr_index = 0;
-    asc_dvc->cfg->can_tagged_qng = 0;
-    asc_dvc->cfg->cmd_qng_enabled = 0;
-    asc_dvc->dvc_cntl = ASC_DEF_DVC_CNTL;
-    asc_dvc->init_sdtr = 0;
-    asc_dvc->max_total_qng = ASC_DEF_MAX_TOTAL_QNG;
-    asc_dvc->scsi_reset_wait = 3;
-    asc_dvc->start_motor = ASC_SCSI_WIDTH_BIT_SET;
-    asc_dvc->max_dma_count = AscGetMaxDmaCount(asc_dvc->bus_type);
-    asc_dvc->cfg->sdtr_enable = ASC_SCSI_WIDTH_BIT_SET;
-    asc_dvc->cfg->disc_enable = ASC_SCSI_WIDTH_BIT_SET;
-    asc_dvc->cfg->chip_scsi_id = ASC_DEF_CHIP_SCSI_ID;
-    asc_dvc->cfg->lib_serial_no = ASC_LIB_SERIAL_NUMBER;
-    asc_dvc->cfg->lib_version = (ASC_LIB_VERSION_MAJOR << 8) |
-      ASC_LIB_VERSION_MINOR;
-    chip_version = AscGetChipVersion(iop_base, asc_dvc->bus_type);
-    asc_dvc->cfg->chip_version = chip_version;
-    asc_dvc->sdtr_period_tbl[0] = SYN_XFER_NS_0;
-    asc_dvc->sdtr_period_tbl[1] = SYN_XFER_NS_1;
-    asc_dvc->sdtr_period_tbl[2] = SYN_XFER_NS_2;
-    asc_dvc->sdtr_period_tbl[3] = SYN_XFER_NS_3;
-    asc_dvc->sdtr_period_tbl[4] = SYN_XFER_NS_4;
-    asc_dvc->sdtr_period_tbl[5] = SYN_XFER_NS_5;
-    asc_dvc->sdtr_period_tbl[6] = SYN_XFER_NS_6;
-    asc_dvc->sdtr_period_tbl[7] = SYN_XFER_NS_7;
-    asc_dvc->max_sdtr_index = 7;
-    if ((asc_dvc->bus_type & ASC_IS_PCI) &&
-        (chip_version >= ASC_CHIP_VER_PCI_ULTRA_3150)) {
-        asc_dvc->bus_type = ASC_IS_PCI_ULTRA;
-        asc_dvc->sdtr_period_tbl[0] = SYN_ULTRA_XFER_NS_0;
-        asc_dvc->sdtr_period_tbl[1] = SYN_ULTRA_XFER_NS_1;
-        asc_dvc->sdtr_period_tbl[2] = SYN_ULTRA_XFER_NS_2;
-        asc_dvc->sdtr_period_tbl[3] = SYN_ULTRA_XFER_NS_3;
-        asc_dvc->sdtr_period_tbl[4] = SYN_ULTRA_XFER_NS_4;
-        asc_dvc->sdtr_period_tbl[5] = SYN_ULTRA_XFER_NS_5;
-        asc_dvc->sdtr_period_tbl[6] = SYN_ULTRA_XFER_NS_6;
-        asc_dvc->sdtr_period_tbl[7] = SYN_ULTRA_XFER_NS_7;
-        asc_dvc->sdtr_period_tbl[8] = SYN_ULTRA_XFER_NS_8;
-        asc_dvc->sdtr_period_tbl[9] = SYN_ULTRA_XFER_NS_9;
-        asc_dvc->sdtr_period_tbl[10] = SYN_ULTRA_XFER_NS_10;
-        asc_dvc->sdtr_period_tbl[11] = SYN_ULTRA_XFER_NS_11;
-        asc_dvc->sdtr_period_tbl[12] = SYN_ULTRA_XFER_NS_12;
-        asc_dvc->sdtr_period_tbl[13] = SYN_ULTRA_XFER_NS_13;
-        asc_dvc->sdtr_period_tbl[14] = SYN_ULTRA_XFER_NS_14;
-        asc_dvc->sdtr_period_tbl[15] = SYN_ULTRA_XFER_NS_15;
-        asc_dvc->max_sdtr_index = 15;
-        if (chip_version == ASC_CHIP_VER_PCI_ULTRA_3150)
-        {
-            AscSetExtraControl(iop_base,
-                (SEC_ACTIVE_NEGATE | SEC_SLEW_RATE));
-        } else if (chip_version >= ASC_CHIP_VER_PCI_ULTRA_3050) {
-            AscSetExtraControl(iop_base,
-                (SEC_ACTIVE_NEGATE | SEC_ENABLE_FILTER));
-        }
-    }
-    if (asc_dvc->bus_type == ASC_IS_PCI) {
-           AscSetExtraControl(iop_base, (SEC_ACTIVE_NEGATE | SEC_SLEW_RATE));
-    }
+       int i;
+       PortAddr iop_base;
+       ushort warn_code;
+       uchar chip_version;
+
+       iop_base = asc_dvc->iop_base;
+       warn_code = 0;
+       asc_dvc->err_code = 0;
+       if ((asc_dvc->bus_type &
+            (ASC_IS_ISA | ASC_IS_PCI | ASC_IS_EISA | ASC_IS_VL)) == 0) {
+               asc_dvc->err_code |= ASC_IERR_NO_BUS_TYPE;
+       }
+       AscSetChipControl(iop_base, CC_HALT);
+       AscSetChipStatus(iop_base, 0);
+       asc_dvc->bug_fix_cntl = 0;
+       asc_dvc->pci_fix_asyn_xfer = 0;
+       asc_dvc->pci_fix_asyn_xfer_always = 0;
+       /* asc_dvc->init_state initalized in AscInitGetConfig(). */
+       asc_dvc->sdtr_done = 0;
+       asc_dvc->cur_total_qng = 0;
+       asc_dvc->is_in_int = 0;
+       asc_dvc->in_critical_cnt = 0;
+       asc_dvc->last_q_shortage = 0;
+       asc_dvc->use_tagged_qng = 0;
+       asc_dvc->no_scam = 0;
+       asc_dvc->unit_not_ready = 0;
+       asc_dvc->queue_full_or_busy = 0;
+       asc_dvc->redo_scam = 0;
+       asc_dvc->res2 = 0;
+       asc_dvc->host_init_sdtr_index = 0;
+       asc_dvc->cfg->can_tagged_qng = 0;
+       asc_dvc->cfg->cmd_qng_enabled = 0;
+       asc_dvc->dvc_cntl = ASC_DEF_DVC_CNTL;
+       asc_dvc->init_sdtr = 0;
+       asc_dvc->max_total_qng = ASC_DEF_MAX_TOTAL_QNG;
+       asc_dvc->scsi_reset_wait = 3;
+       asc_dvc->start_motor = ASC_SCSI_WIDTH_BIT_SET;
+       asc_dvc->max_dma_count = AscGetMaxDmaCount(asc_dvc->bus_type);
+       asc_dvc->cfg->sdtr_enable = ASC_SCSI_WIDTH_BIT_SET;
+       asc_dvc->cfg->disc_enable = ASC_SCSI_WIDTH_BIT_SET;
+       asc_dvc->cfg->chip_scsi_id = ASC_DEF_CHIP_SCSI_ID;
+       asc_dvc->cfg->lib_serial_no = ASC_LIB_SERIAL_NUMBER;
+       asc_dvc->cfg->lib_version = (ASC_LIB_VERSION_MAJOR << 8) |
+           ASC_LIB_VERSION_MINOR;
+       chip_version = AscGetChipVersion(iop_base, asc_dvc->bus_type);
+       asc_dvc->cfg->chip_version = chip_version;
+       asc_dvc->sdtr_period_tbl[0] = SYN_XFER_NS_0;
+       asc_dvc->sdtr_period_tbl[1] = SYN_XFER_NS_1;
+       asc_dvc->sdtr_period_tbl[2] = SYN_XFER_NS_2;
+       asc_dvc->sdtr_period_tbl[3] = SYN_XFER_NS_3;
+       asc_dvc->sdtr_period_tbl[4] = SYN_XFER_NS_4;
+       asc_dvc->sdtr_period_tbl[5] = SYN_XFER_NS_5;
+       asc_dvc->sdtr_period_tbl[6] = SYN_XFER_NS_6;
+       asc_dvc->sdtr_period_tbl[7] = SYN_XFER_NS_7;
+       asc_dvc->max_sdtr_index = 7;
+       if ((asc_dvc->bus_type & ASC_IS_PCI) &&
+           (chip_version >= ASC_CHIP_VER_PCI_ULTRA_3150)) {
+               asc_dvc->bus_type = ASC_IS_PCI_ULTRA;
+               asc_dvc->sdtr_period_tbl[0] = SYN_ULTRA_XFER_NS_0;
+               asc_dvc->sdtr_period_tbl[1] = SYN_ULTRA_XFER_NS_1;
+               asc_dvc->sdtr_period_tbl[2] = SYN_ULTRA_XFER_NS_2;
+               asc_dvc->sdtr_period_tbl[3] = SYN_ULTRA_XFER_NS_3;
+               asc_dvc->sdtr_period_tbl[4] = SYN_ULTRA_XFER_NS_4;
+               asc_dvc->sdtr_period_tbl[5] = SYN_ULTRA_XFER_NS_5;
+               asc_dvc->sdtr_period_tbl[6] = SYN_ULTRA_XFER_NS_6;
+               asc_dvc->sdtr_period_tbl[7] = SYN_ULTRA_XFER_NS_7;
+               asc_dvc->sdtr_period_tbl[8] = SYN_ULTRA_XFER_NS_8;
+               asc_dvc->sdtr_period_tbl[9] = SYN_ULTRA_XFER_NS_9;
+               asc_dvc->sdtr_period_tbl[10] = SYN_ULTRA_XFER_NS_10;
+               asc_dvc->sdtr_period_tbl[11] = SYN_ULTRA_XFER_NS_11;
+               asc_dvc->sdtr_period_tbl[12] = SYN_ULTRA_XFER_NS_12;
+               asc_dvc->sdtr_period_tbl[13] = SYN_ULTRA_XFER_NS_13;
+               asc_dvc->sdtr_period_tbl[14] = SYN_ULTRA_XFER_NS_14;
+               asc_dvc->sdtr_period_tbl[15] = SYN_ULTRA_XFER_NS_15;
+               asc_dvc->max_sdtr_index = 15;
+               if (chip_version == ASC_CHIP_VER_PCI_ULTRA_3150) {
+                       AscSetExtraControl(iop_base,
+                                          (SEC_ACTIVE_NEGATE | SEC_SLEW_RATE));
+               } else if (chip_version >= ASC_CHIP_VER_PCI_ULTRA_3050) {
+                       AscSetExtraControl(iop_base,
+                                          (SEC_ACTIVE_NEGATE |
+                                           SEC_ENABLE_FILTER));
+               }
+       }
+       if (asc_dvc->bus_type == ASC_IS_PCI) {
+               AscSetExtraControl(iop_base,
+                                  (SEC_ACTIVE_NEGATE | SEC_SLEW_RATE));
+       }
 
-    asc_dvc->cfg->isa_dma_speed = ASC_DEF_ISA_DMA_SPEED;
-    if (AscGetChipBusType(iop_base) == ASC_IS_ISAPNP) {
-        AscSetChipIFC(iop_base, IFC_INIT_DEFAULT);
-        asc_dvc->bus_type = ASC_IS_ISAPNP;
-    }
+       asc_dvc->cfg->isa_dma_speed = ASC_DEF_ISA_DMA_SPEED;
+       if (AscGetChipBusType(iop_base) == ASC_IS_ISAPNP) {
+               AscSetChipIFC(iop_base, IFC_INIT_DEFAULT);
+               asc_dvc->bus_type = ASC_IS_ISAPNP;
+       }
 #ifdef CONFIG_ISA
-    if ((asc_dvc->bus_type & ASC_IS_ISA) != 0) {
-        asc_dvc->cfg->isa_dma_channel = (uchar) AscGetIsaDmaChannel(iop_base);
-    }
+       if ((asc_dvc->bus_type & ASC_IS_ISA) != 0) {
+               asc_dvc->cfg->isa_dma_channel =
+                   (uchar)AscGetIsaDmaChannel(iop_base);
+       }
 #endif /* CONFIG_ISA */
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        asc_dvc->cur_dvc_qng[i] = 0;
-        asc_dvc->max_dvc_qng[i] = ASC_MAX_SCSI1_QNG;
-        asc_dvc->scsiq_busy_head[i] = (ASC_SCSI_Q *) 0L;
-        asc_dvc->scsiq_busy_tail[i] = (ASC_SCSI_Q *) 0L;
-        asc_dvc->cfg->max_tag_qng[i] = ASC_MAX_INRAM_TAG_QNG;
-    }
-    return (warn_code);
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               asc_dvc->cur_dvc_qng[i] = 0;
+               asc_dvc->max_dvc_qng[i] = ASC_MAX_SCSI1_QNG;
+               asc_dvc->scsiq_busy_head[i] = (ASC_SCSI_Q *)0L;
+               asc_dvc->scsiq_busy_tail[i] = (ASC_SCSI_Q *)0L;
+               asc_dvc->cfg->max_tag_qng[i] = ASC_MAX_INRAM_TAG_QNG;
+       }
+       return (warn_code);
 }
 
-STATIC ushort __init
-AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
+static ushort __init AscInitFromEEP(ASC_DVC_VAR *asc_dvc)
 {
-    ASCEEP_CONFIG       eep_config_buf;
-    ASCEEP_CONFIG       *eep_config;
-    PortAddr            iop_base;
-    ushort              chksum;
-    ushort              warn_code;
-    ushort              cfg_msw, cfg_lsw;
-    int                 i;
-    int                 write_eep = 0;
-
-    iop_base = asc_dvc->iop_base;
-    warn_code = 0;
-    AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0x00FE);
-    AscStopQueueExe(iop_base);
-    if ((AscStopChip(iop_base) == FALSE) ||
-        (AscGetChipScsiCtrl(iop_base) != 0)) {
-        asc_dvc->init_state |= ASC_INIT_RESET_SCSI_DONE;
-        AscResetChipAndScsiBus(asc_dvc);
-        DvcSleepMilliSecond((ASC_DCNT)
-            ((ushort) asc_dvc->scsi_reset_wait * 1000));
-    }
-    if (AscIsChipHalted(iop_base) == FALSE) {
-        asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
-        return (warn_code);
-    }
-    AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR);
-    if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) {
-        asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
-        return (warn_code);
-    }
-    eep_config = (ASCEEP_CONFIG *) &eep_config_buf;
-    cfg_msw = AscGetChipCfgMsw(iop_base);
-    cfg_lsw = AscGetChipCfgLsw(iop_base);
-    if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) {
-        cfg_msw &= (~(ASC_CFG_MSW_CLR_MASK));
-        warn_code |= ASC_WARN_CFG_MSW_RECOVER;
-        AscSetChipCfgMsw(iop_base, cfg_msw);
-    }
-    chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type);
-    ASC_DBG1(1, "AscInitFromEEP: chksum 0x%x\n", chksum);
-    if (chksum == 0) {
-        chksum = 0xaa55;
-    }
-    if (AscGetChipStatus(iop_base) & CSW_AUTO_CONFIG) {
-        warn_code |= ASC_WARN_AUTO_CONFIG;
-        if (asc_dvc->cfg->chip_version == 3) {
-            if (eep_config->cfg_lsw != cfg_lsw) {
-                warn_code |= ASC_WARN_EEPROM_RECOVER;
-                eep_config->cfg_lsw = AscGetChipCfgLsw(iop_base);
-            }
-            if (eep_config->cfg_msw != cfg_msw) {
-                warn_code |= ASC_WARN_EEPROM_RECOVER;
-                eep_config->cfg_msw = AscGetChipCfgMsw(iop_base);
-            }
-        }
-    }
-    eep_config->cfg_msw &= ~ASC_CFG_MSW_CLR_MASK;
-    eep_config->cfg_lsw |= ASC_CFG0_HOST_INT_ON;
-    ASC_DBG1(1, "AscInitFromEEP: eep_config->chksum 0x%x\n",
-        eep_config->chksum);
-    if (chksum != eep_config->chksum) {
-            if (AscGetChipVersion(iop_base, asc_dvc->bus_type) ==
-                    ASC_CHIP_VER_PCI_ULTRA_3050 )
-            {
-                ASC_DBG(1,
-"AscInitFromEEP: chksum error ignored; EEPROM-less board\n");
-                eep_config->init_sdtr = 0xFF;
-                eep_config->disc_enable = 0xFF;
-                eep_config->start_motor = 0xFF;
-                eep_config->use_cmd_qng = 0;
-                eep_config->max_total_qng = 0xF0;
-                eep_config->max_tag_qng = 0x20;
-                eep_config->cntl = 0xBFFF;
-                ASC_EEP_SET_CHIP_ID(eep_config, 7);
-                eep_config->no_scam = 0;
-                eep_config->adapter_info[0] = 0;
-                eep_config->adapter_info[1] = 0;
-                eep_config->adapter_info[2] = 0;
-                eep_config->adapter_info[3] = 0;
-                eep_config->adapter_info[4] = 0;
-                /* Indicate EEPROM-less board. */
-                eep_config->adapter_info[5] = 0xBB;
-            } else {
-                ASC_PRINT(
-"AscInitFromEEP: EEPROM checksum error; Will try to re-write EEPROM.\n");
-                write_eep = 1;
-                warn_code |= ASC_WARN_EEPROM_CHKSUM;
-            }
-    }
-    asc_dvc->cfg->sdtr_enable = eep_config->init_sdtr;
-    asc_dvc->cfg->disc_enable = eep_config->disc_enable;
-    asc_dvc->cfg->cmd_qng_enabled = eep_config->use_cmd_qng;
-    asc_dvc->cfg->isa_dma_speed = ASC_EEP_GET_DMA_SPD(eep_config);
-    asc_dvc->start_motor = eep_config->start_motor;
-    asc_dvc->dvc_cntl = eep_config->cntl;
-    asc_dvc->no_scam = eep_config->no_scam;
-    asc_dvc->cfg->adapter_info[0] = eep_config->adapter_info[0];
-    asc_dvc->cfg->adapter_info[1] = eep_config->adapter_info[1];
-    asc_dvc->cfg->adapter_info[2] = eep_config->adapter_info[2];
-    asc_dvc->cfg->adapter_info[3] = eep_config->adapter_info[3];
-    asc_dvc->cfg->adapter_info[4] = eep_config->adapter_info[4];
-    asc_dvc->cfg->adapter_info[5] = eep_config->adapter_info[5];
-    if (!AscTestExternalLram(asc_dvc)) {
-        if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA)) {
-            eep_config->max_total_qng = ASC_MAX_PCI_ULTRA_INRAM_TOTAL_QNG;
-            eep_config->max_tag_qng = ASC_MAX_PCI_ULTRA_INRAM_TAG_QNG;
-        } else {
-            eep_config->cfg_msw |= 0x0800;
-            cfg_msw |= 0x0800;
-            AscSetChipCfgMsw(iop_base, cfg_msw);
-            eep_config->max_total_qng = ASC_MAX_PCI_INRAM_TOTAL_QNG;
-            eep_config->max_tag_qng = ASC_MAX_INRAM_TAG_QNG;
-        }
-    } else {
-    }
-    if (eep_config->max_total_qng < ASC_MIN_TOTAL_QNG) {
-        eep_config->max_total_qng = ASC_MIN_TOTAL_QNG;
-    }
-    if (eep_config->max_total_qng > ASC_MAX_TOTAL_QNG) {
-        eep_config->max_total_qng = ASC_MAX_TOTAL_QNG;
-    }
-    if (eep_config->max_tag_qng > eep_config->max_total_qng) {
-        eep_config->max_tag_qng = eep_config->max_total_qng;
-    }
-    if (eep_config->max_tag_qng < ASC_MIN_TAG_Q_PER_DVC) {
-        eep_config->max_tag_qng = ASC_MIN_TAG_Q_PER_DVC;
-    }
-    asc_dvc->max_total_qng = eep_config->max_total_qng;
-    if ((eep_config->use_cmd_qng & eep_config->disc_enable) !=
-        eep_config->use_cmd_qng) {
-        eep_config->disc_enable = eep_config->use_cmd_qng;
-        warn_code |= ASC_WARN_CMD_QNG_CONFLICT;
-    }
-    if (asc_dvc->bus_type & (ASC_IS_ISA | ASC_IS_VL | ASC_IS_EISA)) {
-        asc_dvc->irq_no = AscGetChipIRQ(iop_base, asc_dvc->bus_type);
-    }
-    ASC_EEP_SET_CHIP_ID(eep_config, ASC_EEP_GET_CHIP_ID(eep_config) & ASC_MAX_TID);
-    asc_dvc->cfg->chip_scsi_id = ASC_EEP_GET_CHIP_ID(eep_config);
-    if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) &&
-        !(asc_dvc->dvc_cntl & ASC_CNTL_SDTR_ENABLE_ULTRA)) {
-        asc_dvc->host_init_sdtr_index = ASC_SDTR_ULTRA_PCI_10MB_INDEX;
-    }
+       ASCEEP_CONFIG eep_config_buf;
+       ASCEEP_CONFIG *eep_config;
+       PortAddr iop_base;
+       ushort chksum;
+       ushort warn_code;
+       ushort cfg_msw, cfg_lsw;
+       int i;
+       int write_eep = 0;
+
+       iop_base = asc_dvc->iop_base;
+       warn_code = 0;
+       AscWriteLramWord(iop_base, ASCV_HALTCODE_W, 0x00FE);
+       AscStopQueueExe(iop_base);
+       if ((AscStopChip(iop_base) == FALSE) ||
+           (AscGetChipScsiCtrl(iop_base) != 0)) {
+               asc_dvc->init_state |= ASC_INIT_RESET_SCSI_DONE;
+               AscResetChipAndScsiBus(asc_dvc);
+               DvcSleepMilliSecond((ASC_DCNT)
+                                   ((ushort)asc_dvc->scsi_reset_wait * 1000));
+       }
+       if (AscIsChipHalted(iop_base) == FALSE) {
+               asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
+               return (warn_code);
+       }
+       AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR);
+       if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) {
+               asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
+               return (warn_code);
+       }
+       eep_config = (ASCEEP_CONFIG *)&eep_config_buf;
+       cfg_msw = AscGetChipCfgMsw(iop_base);
+       cfg_lsw = AscGetChipCfgLsw(iop_base);
+       if ((cfg_msw & ASC_CFG_MSW_CLR_MASK) != 0) {
+               cfg_msw &= (~(ASC_CFG_MSW_CLR_MASK));
+               warn_code |= ASC_WARN_CFG_MSW_RECOVER;
+               AscSetChipCfgMsw(iop_base, cfg_msw);
+       }
+       chksum = AscGetEEPConfig(iop_base, eep_config, asc_dvc->bus_type);
+       ASC_DBG1(1, "AscInitFromEEP: chksum 0x%x\n", chksum);
+       if (chksum == 0) {
+               chksum = 0xaa55;
+       }
+       if (AscGetChipStatus(iop_base) & CSW_AUTO_CONFIG) {
+               warn_code |= ASC_WARN_AUTO_CONFIG;
+               if (asc_dvc->cfg->chip_version == 3) {
+                       if (eep_config->cfg_lsw != cfg_lsw) {
+                               warn_code |= ASC_WARN_EEPROM_RECOVER;
+                               eep_config->cfg_lsw =
+                                   AscGetChipCfgLsw(iop_base);
+                       }
+                       if (eep_config->cfg_msw != cfg_msw) {
+                               warn_code |= ASC_WARN_EEPROM_RECOVER;
+                               eep_config->cfg_msw =
+                                   AscGetChipCfgMsw(iop_base);
+                       }
+               }
+       }
+       eep_config->cfg_msw &= ~ASC_CFG_MSW_CLR_MASK;
+       eep_config->cfg_lsw |= ASC_CFG0_HOST_INT_ON;
+       ASC_DBG1(1, "AscInitFromEEP: eep_config->chksum 0x%x\n",
+                eep_config->chksum);
+       if (chksum != eep_config->chksum) {
+               if (AscGetChipVersion(iop_base, asc_dvc->bus_type) ==
+                   ASC_CHIP_VER_PCI_ULTRA_3050) {
+                       ASC_DBG(1,
+                               "AscInitFromEEP: chksum error ignored; EEPROM-less board\n");
+                       eep_config->init_sdtr = 0xFF;
+                       eep_config->disc_enable = 0xFF;
+                       eep_config->start_motor = 0xFF;
+                       eep_config->use_cmd_qng = 0;
+                       eep_config->max_total_qng = 0xF0;
+                       eep_config->max_tag_qng = 0x20;
+                       eep_config->cntl = 0xBFFF;
+                       ASC_EEP_SET_CHIP_ID(eep_config, 7);
+                       eep_config->no_scam = 0;
+                       eep_config->adapter_info[0] = 0;
+                       eep_config->adapter_info[1] = 0;
+                       eep_config->adapter_info[2] = 0;
+                       eep_config->adapter_info[3] = 0;
+                       eep_config->adapter_info[4] = 0;
+                       /* Indicate EEPROM-less board. */
+                       eep_config->adapter_info[5] = 0xBB;
+               } else {
+                       ASC_PRINT
+                           ("AscInitFromEEP: EEPROM checksum error; Will try to re-write EEPROM.\n");
+                       write_eep = 1;
+                       warn_code |= ASC_WARN_EEPROM_CHKSUM;
+               }
+       }
+       asc_dvc->cfg->sdtr_enable = eep_config->init_sdtr;
+       asc_dvc->cfg->disc_enable = eep_config->disc_enable;
+       asc_dvc->cfg->cmd_qng_enabled = eep_config->use_cmd_qng;
+       asc_dvc->cfg->isa_dma_speed = ASC_EEP_GET_DMA_SPD(eep_config);
+       asc_dvc->start_motor = eep_config->start_motor;
+       asc_dvc->dvc_cntl = eep_config->cntl;
+       asc_dvc->no_scam = eep_config->no_scam;
+       asc_dvc->cfg->adapter_info[0] = eep_config->adapter_info[0];
+       asc_dvc->cfg->adapter_info[1] = eep_config->adapter_info[1];
+       asc_dvc->cfg->adapter_info[2] = eep_config->adapter_info[2];
+       asc_dvc->cfg->adapter_info[3] = eep_config->adapter_info[3];
+       asc_dvc->cfg->adapter_info[4] = eep_config->adapter_info[4];
+       asc_dvc->cfg->adapter_info[5] = eep_config->adapter_info[5];
+       if (!AscTestExternalLram(asc_dvc)) {
+               if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) ==
+                    ASC_IS_PCI_ULTRA)) {
+                       eep_config->max_total_qng =
+                           ASC_MAX_PCI_ULTRA_INRAM_TOTAL_QNG;
+                       eep_config->max_tag_qng =
+                           ASC_MAX_PCI_ULTRA_INRAM_TAG_QNG;
+               } else {
+                       eep_config->cfg_msw |= 0x0800;
+                       cfg_msw |= 0x0800;
+                       AscSetChipCfgMsw(iop_base, cfg_msw);
+                       eep_config->max_total_qng = ASC_MAX_PCI_INRAM_TOTAL_QNG;
+                       eep_config->max_tag_qng = ASC_MAX_INRAM_TAG_QNG;
+               }
+       } else {
+       }
+       if (eep_config->max_total_qng < ASC_MIN_TOTAL_QNG) {
+               eep_config->max_total_qng = ASC_MIN_TOTAL_QNG;
+       }
+       if (eep_config->max_total_qng > ASC_MAX_TOTAL_QNG) {
+               eep_config->max_total_qng = ASC_MAX_TOTAL_QNG;
+       }
+       if (eep_config->max_tag_qng > eep_config->max_total_qng) {
+               eep_config->max_tag_qng = eep_config->max_total_qng;
+       }
+       if (eep_config->max_tag_qng < ASC_MIN_TAG_Q_PER_DVC) {
+               eep_config->max_tag_qng = ASC_MIN_TAG_Q_PER_DVC;
+       }
+       asc_dvc->max_total_qng = eep_config->max_total_qng;
+       if ((eep_config->use_cmd_qng & eep_config->disc_enable) !=
+           eep_config->use_cmd_qng) {
+               eep_config->disc_enable = eep_config->use_cmd_qng;
+               warn_code |= ASC_WARN_CMD_QNG_CONFLICT;
+       }
+       if (asc_dvc->bus_type & (ASC_IS_ISA | ASC_IS_VL | ASC_IS_EISA)) {
+               asc_dvc->irq_no = AscGetChipIRQ(iop_base, asc_dvc->bus_type);
+       }
+       ASC_EEP_SET_CHIP_ID(eep_config,
+                           ASC_EEP_GET_CHIP_ID(eep_config) & ASC_MAX_TID);
+       asc_dvc->cfg->chip_scsi_id = ASC_EEP_GET_CHIP_ID(eep_config);
+       if (((asc_dvc->bus_type & ASC_IS_PCI_ULTRA) == ASC_IS_PCI_ULTRA) &&
+           !(asc_dvc->dvc_cntl & ASC_CNTL_SDTR_ENABLE_ULTRA)) {
+               asc_dvc->host_init_sdtr_index = ASC_SDTR_ULTRA_PCI_10MB_INDEX;
+       }
 
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        asc_dvc->dos_int13_table[i] = eep_config->dos_int13_table[i];
-        asc_dvc->cfg->max_tag_qng[i] = eep_config->max_tag_qng;
-        asc_dvc->cfg->sdtr_period_offset[i] =
-            (uchar) (ASC_DEF_SDTR_OFFSET |
-                     (asc_dvc->host_init_sdtr_index << 4));
-    }
-    eep_config->cfg_msw = AscGetChipCfgMsw(iop_base);
-    if (write_eep) {
-        if ((i = AscSetEEPConfig(iop_base, eep_config, asc_dvc->bus_type)) !=
-             0) {
-                ASC_PRINT1(
-"AscInitFromEEP: Failed to re-write EEPROM with %d errors.\n", i);
-        } else {
-                ASC_PRINT("AscInitFromEEP: Successfully re-wrote EEPROM.\n");
-        }
-    }
-    return (warn_code);
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               asc_dvc->dos_int13_table[i] = eep_config->dos_int13_table[i];
+               asc_dvc->cfg->max_tag_qng[i] = eep_config->max_tag_qng;
+               asc_dvc->cfg->sdtr_period_offset[i] =
+                   (uchar)(ASC_DEF_SDTR_OFFSET |
+                           (asc_dvc->host_init_sdtr_index << 4));
+       }
+       eep_config->cfg_msw = AscGetChipCfgMsw(iop_base);
+       if (write_eep) {
+               if ((i =
+                    AscSetEEPConfig(iop_base, eep_config,
+                                    asc_dvc->bus_type)) != 0) {
+                       ASC_PRINT1
+                           ("AscInitFromEEP: Failed to re-write EEPROM with %d errors.\n",
+                            i);
+               } else {
+                       ASC_PRINT
+                           ("AscInitFromEEP: Successfully re-wrote EEPROM.\n");
+               }
+       }
+       return (warn_code);
 }
 
-STATIC ushort
-AscInitMicroCodeVar(
-                       ASC_DVC_VAR *asc_dvc
-)
+static ushort AscInitMicroCodeVar(ASC_DVC_VAR *asc_dvc)
 {
-    int                 i;
-    ushort              warn_code;
-    PortAddr            iop_base;
-    ASC_PADDR           phy_addr;
-    ASC_DCNT            phy_size;
-
-    iop_base = asc_dvc->iop_base;
-    warn_code = 0;
-    for (i = 0; i <= ASC_MAX_TID; i++) {
-        AscPutMCodeInitSDTRAtID(iop_base, i,
-                                asc_dvc->cfg->sdtr_period_offset[i]
-);
-    }
+       int i;
+       ushort warn_code;
+       PortAddr iop_base;
+       ASC_PADDR phy_addr;
+       ASC_DCNT phy_size;
+
+       iop_base = asc_dvc->iop_base;
+       warn_code = 0;
+       for (i = 0; i <= ASC_MAX_TID; i++) {
+               AscPutMCodeInitSDTRAtID(iop_base, i,
+                                       asc_dvc->cfg->sdtr_period_offset[i]
+                   );
+       }
 
-    AscInitQLinkVar(asc_dvc);
-    AscWriteLramByte(iop_base, ASCV_DISC_ENABLE_B,
-                     asc_dvc->cfg->disc_enable);
-    AscWriteLramByte(iop_base, ASCV_HOSTSCSI_ID_B,
-                     ASC_TID_TO_TARGET_ID(asc_dvc->cfg->chip_scsi_id));
-
-    /* Align overrun buffer on an 8 byte boundary. */
-    phy_addr = virt_to_bus(asc_dvc->cfg->overrun_buf);
-    phy_addr = cpu_to_le32((phy_addr + 7) & ~0x7);
-    AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D,
-        (uchar *) &phy_addr, 1);
-    phy_size = cpu_to_le32(ASC_OVERRUN_BSIZE - 8);
-    AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_BSIZE_D,
-        (uchar *) &phy_size, 1);
-
-    asc_dvc->cfg->mcode_date =
-        AscReadLramWord(iop_base, (ushort) ASCV_MC_DATE_W);
-    asc_dvc->cfg->mcode_version =
-        AscReadLramWord(iop_base, (ushort) ASCV_MC_VER_W);
-
-    AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR);
-    if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) {
-        asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
-        return (warn_code);
-    }
-    if (AscStartChip(iop_base) != 1) {
-        asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
-        return (warn_code);
-    }
+       AscInitQLinkVar(asc_dvc);
+       AscWriteLramByte(iop_base, ASCV_DISC_ENABLE_B,
+                        asc_dvc->cfg->disc_enable);
+       AscWriteLramByte(iop_base, ASCV_HOSTSCSI_ID_B,
+                        ASC_TID_TO_TARGET_ID(asc_dvc->cfg->chip_scsi_id));
+
+       /* Align overrun buffer on an 8 byte boundary. */
+       phy_addr = virt_to_bus(asc_dvc->cfg->overrun_buf);
+       phy_addr = cpu_to_le32((phy_addr + 7) & ~0x7);
+       AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_PADDR_D,
+                                (uchar *)&phy_addr, 1);
+       phy_size = cpu_to_le32(ASC_OVERRUN_BSIZE - 8);
+       AscMemDWordCopyPtrToLram(iop_base, ASCV_OVERRUN_BSIZE_D,
+                                (uchar *)&phy_size, 1);
+
+       asc_dvc->cfg->mcode_date =
+           AscReadLramWord(iop_base, (ushort)ASCV_MC_DATE_W);
+       asc_dvc->cfg->mcode_version =
+           AscReadLramWord(iop_base, (ushort)ASCV_MC_VER_W);
+
+       AscSetPCAddr(iop_base, ASC_MCODE_START_ADDR);
+       if (AscGetPCAddr(iop_base) != ASC_MCODE_START_ADDR) {
+               asc_dvc->err_code |= ASC_IERR_SET_PC_ADDR;
+               return (warn_code);
+       }
+       if (AscStartChip(iop_base) != 1) {
+               asc_dvc->err_code |= ASC_IERR_START_STOP_CHIP;
+               return (warn_code);
+       }
 
-    return (warn_code);
+       return (warn_code);
 }
 
-STATIC int __init
-AscTestExternalLram(
-                       ASC_DVC_VAR *asc_dvc)
+static int __init AscTestExternalLram(ASC_DVC_VAR *asc_dvc)
 {
-    PortAddr            iop_base;
-    ushort              q_addr;
-    ushort              saved_word;
-    int                 sta;
-
-    iop_base = asc_dvc->iop_base;
-    sta = 0;
-    q_addr = ASC_QNO_TO_QADDR(241);
-    saved_word = AscReadLramWord(iop_base, q_addr);
-    AscSetChipLramAddr(iop_base, q_addr);
-    AscSetChipLramData(iop_base, 0x55AA);
-    DvcSleepMilliSecond(10);
-    AscSetChipLramAddr(iop_base, q_addr);
-    if (AscGetChipLramData(iop_base) == 0x55AA) {
-        sta = 1;
-        AscWriteLramWord(iop_base, q_addr, saved_word);
-    }
-    return (sta);
+       PortAddr iop_base;
+       ushort q_addr;
+       ushort saved_word;
+       int sta;
+
+       iop_base = asc_dvc->iop_base;
+       sta = 0;
+       q_addr = ASC_QNO_TO_QADDR(241);
+       saved_word = AscReadLramWord(iop_base, q_addr);
+       AscSetChipLramAddr(iop_base, q_addr);
+       AscSetChipLramData(iop_base, 0x55AA);
+       DvcSleepMilliSecond(10);
+       AscSetChipLramAddr(iop_base, q_addr);
+       if (AscGetChipLramData(iop_base) == 0x55AA) {
+               sta = 1;
+               AscWriteLramWord(iop_base, q_addr, saved_word);
+       }
+       return (sta);
 }
 
-STATIC int __init
-AscWriteEEPCmdReg(
-                     PortAddr iop_base,
-                     uchar cmd_reg
-)
+static int __init AscWriteEEPCmdReg(PortAddr iop_base, uchar cmd_reg)
 {
-    uchar               read_back;
-    int                 retry;
-
-    retry = 0;
-    while (TRUE) {
-        AscSetChipEEPCmd(iop_base, cmd_reg);
-        DvcSleepMilliSecond(1);
-        read_back = AscGetChipEEPCmd(iop_base);
-        if (read_back == cmd_reg) {
-            return (1);
-        }
-        if (retry++ > ASC_EEP_MAX_RETRY) {
-            return (0);
-        }
-    }
+       uchar read_back;
+       int retry;
+
+       retry = 0;
+       while (TRUE) {
+               AscSetChipEEPCmd(iop_base, cmd_reg);
+               DvcSleepMilliSecond(1);
+               read_back = AscGetChipEEPCmd(iop_base);
+               if (read_back == cmd_reg) {
+                       return (1);
+               }
+               if (retry++ > ASC_EEP_MAX_RETRY) {
+                       return (0);
+               }
+       }
 }
 
-STATIC int __init
-AscWriteEEPDataReg(
-                      PortAddr iop_base,
-                      ushort data_reg
-)
+static int __init AscWriteEEPDataReg(PortAddr iop_base, ushort data_reg)
 {
-    ushort              read_back;
-    int                 retry;
-
-    retry = 0;
-    while (TRUE) {
-        AscSetChipEEPData(iop_base, data_reg);
-        DvcSleepMilliSecond(1);
-        read_back = AscGetChipEEPData(iop_base);
-        if (read_back == data_reg) {
-            return (1);
-        }
-        if (retry++ > ASC_EEP_MAX_RETRY) {
-            return (0);
-        }
-    }
+       ushort read_back;
+       int retry;
+
+       retry = 0;
+       while (TRUE) {
+               AscSetChipEEPData(iop_base, data_reg);
+               DvcSleepMilliSecond(1);
+               read_back = AscGetChipEEPData(iop_base);
+               if (read_back == data_reg) {
+                       return (1);
+               }
+               if (retry++ > ASC_EEP_MAX_RETRY) {
+                       return (0);
+               }
+       }
 }
 
-STATIC void __init
-AscWaitEEPRead(void)
+static void __init AscWaitEEPRead(void)
 {
-    DvcSleepMilliSecond(1);
-    return;
+       DvcSleepMilliSecond(1);
+       return;
 }
 
-STATIC void __init
-AscWaitEEPWrite(void)
+static void __init AscWaitEEPWrite(void)
 {
-    DvcSleepMilliSecond(20);
-    return;
+       DvcSleepMilliSecond(20);
+       return;
 }
 
-STATIC ushort __init
-AscReadEEPWord(
-                  PortAddr iop_base,
-                  uchar addr)
+static ushort __init AscReadEEPWord(PortAddr iop_base, uchar addr)
 {
-    ushort              read_wval;
-    uchar               cmd_reg;
-
-    AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_DISABLE);
-    AscWaitEEPRead();
-    cmd_reg = addr | ASC_EEP_CMD_READ;
-    AscWriteEEPCmdReg(iop_base, cmd_reg);
-    AscWaitEEPRead();
-    read_wval = AscGetChipEEPData(iop_base);
-    AscWaitEEPRead();
-    return (read_wval);
+       ushort read_wval;
+       uchar cmd_reg;
+
+       AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_DISABLE);
+       AscWaitEEPRead();
+       cmd_reg = addr | ASC_EEP_CMD_READ;
+       AscWriteEEPCmdReg(iop_base, cmd_reg);
+       AscWaitEEPRead();
+       read_wval = AscGetChipEEPData(iop_base);
+       AscWaitEEPRead();
+       return (read_wval);
 }
 
-STATIC ushort __init
-AscWriteEEPWord(
-                   PortAddr iop_base,
-                   uchar addr,
-                   ushort word_val)
+static ushort __init
+AscWriteEEPWord(PortAddr iop_base, uchar addr, ushort word_val)
 {
-    ushort              read_wval;
-
-    read_wval = AscReadEEPWord(iop_base, addr);
-    if (read_wval != word_val) {
-        AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_ABLE);
-        AscWaitEEPRead();
-        AscWriteEEPDataReg(iop_base, word_val);
-        AscWaitEEPRead();
-        AscWriteEEPCmdReg(iop_base,
-                          (uchar) ((uchar) ASC_EEP_CMD_WRITE | addr));
-        AscWaitEEPWrite();
-        AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_DISABLE);
-        AscWaitEEPRead();
-        return (AscReadEEPWord(iop_base, addr));
-    }
-    return (read_wval);
+       ushort read_wval;
+
+       read_wval = AscReadEEPWord(iop_base, addr);
+       if (read_wval != word_val) {
+               AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_ABLE);
+               AscWaitEEPRead();
+               AscWriteEEPDataReg(iop_base, word_val);
+               AscWaitEEPRead();
+               AscWriteEEPCmdReg(iop_base,
+                                 (uchar)((uchar)ASC_EEP_CMD_WRITE | addr));
+               AscWaitEEPWrite();
+               AscWriteEEPCmdReg(iop_base, ASC_EEP_CMD_WRITE_DISABLE);
+               AscWaitEEPRead();
+               return (AscReadEEPWord(iop_base, addr));
+       }
+       return (read_wval);
 }
 
-STATIC ushort __init
-AscGetEEPConfig(
-                   PortAddr iop_base,
-                   ASCEEP_CONFIG * cfg_buf, ushort bus_type)
+static ushort __init
+AscGetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type)
 {
-    ushort              wval;
-    ushort              sum;
-    ushort              *wbuf;
-    int                 cfg_beg;
-    int                 cfg_end;
-    int                 uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2;
-    int                 s_addr;
-
-    wbuf = (ushort *) cfg_buf;
-    sum = 0;
-    /* Read two config words; Byte-swapping done by AscReadEEPWord(). */
-    for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) {
-        *wbuf = AscReadEEPWord(iop_base, (uchar) s_addr);
-        sum += *wbuf;
-    }
-    if (bus_type & ASC_IS_VL) {
-        cfg_beg = ASC_EEP_DVC_CFG_BEG_VL;
-        cfg_end = ASC_EEP_MAX_DVC_ADDR_VL;
-    } else {
-        cfg_beg = ASC_EEP_DVC_CFG_BEG;
-        cfg_end = ASC_EEP_MAX_DVC_ADDR;
-    }
-    for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) {
-        wval = AscReadEEPWord( iop_base, ( uchar )s_addr ) ;
-        if (s_addr <= uchar_end_in_config) {
-            /*
-             * Swap all char fields - must unswap bytes already swapped
-             * by AscReadEEPWord().
-             */
-            *wbuf = le16_to_cpu(wval);
-        } else {
-            /* Don't swap word field at the end - cntl field. */
-            *wbuf = wval;
-        }
-        sum += wval; /* Checksum treats all EEPROM data as words. */
-    }
-    /*
-     * Read the checksum word which will be compared against 'sum'
-     * by the caller. Word field already swapped.
-     */
-    *wbuf = AscReadEEPWord(iop_base, (uchar) s_addr);
-    return (sum);
+       ushort wval;
+       ushort sum;
+       ushort *wbuf;
+       int cfg_beg;
+       int cfg_end;
+       int uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2;
+       int s_addr;
+
+       wbuf = (ushort *)cfg_buf;
+       sum = 0;
+       /* Read two config words; Byte-swapping done by AscReadEEPWord(). */
+       for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) {
+               *wbuf = AscReadEEPWord(iop_base, (uchar)s_addr);
+               sum += *wbuf;
+       }
+       if (bus_type & ASC_IS_VL) {
+               cfg_beg = ASC_EEP_DVC_CFG_BEG_VL;
+               cfg_end = ASC_EEP_MAX_DVC_ADDR_VL;
+       } else {
+               cfg_beg = ASC_EEP_DVC_CFG_BEG;
+               cfg_end = ASC_EEP_MAX_DVC_ADDR;
+       }
+       for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) {
+               wval = AscReadEEPWord(iop_base, (uchar)s_addr);
+               if (s_addr <= uchar_end_in_config) {
+                       /*
+                        * Swap all char fields - must unswap bytes already swapped
+                        * by AscReadEEPWord().
+                        */
+                       *wbuf = le16_to_cpu(wval);
+               } else {
+                       /* Don't swap word field at the end - cntl field. */
+                       *wbuf = wval;
+               }
+               sum += wval;    /* Checksum treats all EEPROM data as words. */
+       }
+       /*
+        * Read the checksum word which will be compared against 'sum'
+        * by the caller. Word field already swapped.
+        */
+       *wbuf = AscReadEEPWord(iop_base, (uchar)s_addr);
+       return (sum);
 }
 
-STATIC int __init
-AscSetEEPConfigOnce(
-                       PortAddr iop_base,
-                       ASCEEP_CONFIG * cfg_buf, ushort bus_type)
+static int __init
+AscSetEEPConfigOnce(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type)
 {
-    int                 n_error;
-    ushort              *wbuf;
-    ushort              word;
-    ushort              sum;
-    int                 s_addr;
-    int                 cfg_beg;
-    int                 cfg_end;
-    int                 uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2;
-
-
-    wbuf = (ushort *) cfg_buf;
-    n_error = 0;
-    sum = 0;
-    /* Write two config words; AscWriteEEPWord() will swap bytes. */
-    for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) {
-        sum += *wbuf;
-        if (*wbuf != AscWriteEEPWord(iop_base, (uchar) s_addr, *wbuf)) {
-            n_error++;
-        }
-    }
-    if (bus_type & ASC_IS_VL) {
-        cfg_beg = ASC_EEP_DVC_CFG_BEG_VL;
-        cfg_end = ASC_EEP_MAX_DVC_ADDR_VL;
-    } else {
-        cfg_beg = ASC_EEP_DVC_CFG_BEG;
-        cfg_end = ASC_EEP_MAX_DVC_ADDR;
-    }
-    for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) {
-        if (s_addr <= uchar_end_in_config) {
-            /*
-             * This is a char field. Swap char fields before they are
-             * swapped again by AscWriteEEPWord().
-             */
-            word = cpu_to_le16(*wbuf);
-            if (word != AscWriteEEPWord( iop_base, (uchar) s_addr, word)) {
-                n_error++;
-            }
-        } else {
-            /* Don't swap word field at the end - cntl field. */
-            if (*wbuf != AscWriteEEPWord(iop_base, (uchar) s_addr, *wbuf)) {
-                n_error++;
-            }
-        }
-        sum += *wbuf; /* Checksum calculated from word values. */
-    }
-    /* Write checksum word. It will be swapped by AscWriteEEPWord(). */
-    *wbuf = sum;
-    if (sum != AscWriteEEPWord(iop_base, (uchar) s_addr, sum)) {
-        n_error++;
-    }
+       int n_error;
+       ushort *wbuf;
+       ushort word;
+       ushort sum;
+       int s_addr;
+       int cfg_beg;
+       int cfg_end;
+       int uchar_end_in_config = ASC_EEP_MAX_DVC_ADDR - 2;
+
+       wbuf = (ushort *)cfg_buf;
+       n_error = 0;
+       sum = 0;
+       /* Write two config words; AscWriteEEPWord() will swap bytes. */
+       for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) {
+               sum += *wbuf;
+               if (*wbuf != AscWriteEEPWord(iop_base, (uchar)s_addr, *wbuf)) {
+                       n_error++;
+               }
+       }
+       if (bus_type & ASC_IS_VL) {
+               cfg_beg = ASC_EEP_DVC_CFG_BEG_VL;
+               cfg_end = ASC_EEP_MAX_DVC_ADDR_VL;
+       } else {
+               cfg_beg = ASC_EEP_DVC_CFG_BEG;
+               cfg_end = ASC_EEP_MAX_DVC_ADDR;
+       }
+       for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) {
+               if (s_addr <= uchar_end_in_config) {
+                       /*
+                        * This is a char field. Swap char fields before they are
+                        * swapped again by AscWriteEEPWord().
+                        */
+                       word = cpu_to_le16(*wbuf);
+                       if (word !=
+                           AscWriteEEPWord(iop_base, (uchar)s_addr, word)) {
+                               n_error++;
+                       }
+               } else {
+                       /* Don't swap word field at the end - cntl field. */
+                       if (*wbuf !=
+                           AscWriteEEPWord(iop_base, (uchar)s_addr, *wbuf)) {
+                               n_error++;
+                       }
+               }
+               sum += *wbuf;   /* Checksum calculated from word values. */
+       }
+       /* Write checksum word. It will be swapped by AscWriteEEPWord(). */
+       *wbuf = sum;
+       if (sum != AscWriteEEPWord(iop_base, (uchar)s_addr, sum)) {
+               n_error++;
+       }
 
-    /* Read EEPROM back again. */
-    wbuf = (ushort *) cfg_buf;
-    /*
-     * Read two config words; Byte-swapping done by AscReadEEPWord().
-     */
-    for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) {
-        if (*wbuf != AscReadEEPWord(iop_base, (uchar) s_addr)) {
-            n_error++;
-        }
-    }
-    if (bus_type & ASC_IS_VL) {
-        cfg_beg = ASC_EEP_DVC_CFG_BEG_VL;
-        cfg_end = ASC_EEP_MAX_DVC_ADDR_VL;
-    } else {
-        cfg_beg = ASC_EEP_DVC_CFG_BEG;
-        cfg_end = ASC_EEP_MAX_DVC_ADDR;
-    }
-    for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) {
-        if (s_addr <= uchar_end_in_config) {
-            /*
-             * Swap all char fields. Must unswap bytes already swapped
-             * by AscReadEEPWord().
-             */
-            word = le16_to_cpu(AscReadEEPWord(iop_base, (uchar) s_addr));
-        } else {
-            /* Don't swap word field at the end - cntl field. */
-            word = AscReadEEPWord(iop_base, (uchar) s_addr);
-        }
-        if (*wbuf != word) {
-            n_error++;
-        }
-    }
-    /* Read checksum; Byte swapping not needed. */
-    if (AscReadEEPWord(iop_base, (uchar) s_addr) != sum) {
-        n_error++;
-    }
-    return (n_error);
+       /* Read EEPROM back again. */
+       wbuf = (ushort *)cfg_buf;
+       /*
+        * Read two config words; Byte-swapping done by AscReadEEPWord().
+        */
+       for (s_addr = 0; s_addr < 2; s_addr++, wbuf++) {
+               if (*wbuf != AscReadEEPWord(iop_base, (uchar)s_addr)) {
+                       n_error++;
+               }
+       }
+       if (bus_type & ASC_IS_VL) {
+               cfg_beg = ASC_EEP_DVC_CFG_BEG_VL;
+               cfg_end = ASC_EEP_MAX_DVC_ADDR_VL;
+       } else {
+               cfg_beg = ASC_EEP_DVC_CFG_BEG;
+               cfg_end = ASC_EEP_MAX_DVC_ADDR;
+       }
+       for (s_addr = cfg_beg; s_addr <= (cfg_end - 1); s_addr++, wbuf++) {
+               if (s_addr <= uchar_end_in_config) {
+                       /*
+                        * Swap all char fields. Must unswap bytes already swapped
+                        * by AscReadEEPWord().
+                        */
+                       word =
+                           le16_to_cpu(AscReadEEPWord
+                                       (iop_base, (uchar)s_addr));
+               } else {
+                       /* Don't swap word field at the end - cntl field. */
+                       word = AscReadEEPWord(iop_base, (uchar)s_addr);
+               }
+               if (*wbuf != word) {
+                       n_error++;
+               }
+       }
+       /* Read checksum; Byte swapping not needed. */
+       if (AscReadEEPWord(iop_base, (uchar)s_addr) != sum) {
+               n_error++;
+       }
+       return (n_error);
 }
 
-STATIC int __init
-AscSetEEPConfig(
-                   PortAddr iop_base,
-                   ASCEEP_CONFIG * cfg_buf, ushort bus_type
-)
+static int __init
+AscSetEEPConfig(PortAddr iop_base, ASCEEP_CONFIG *cfg_buf, ushort bus_type)
 {
-    int            retry;
-    int            n_error;
-
-    retry = 0;
-    while (TRUE) {
-        if ((n_error = AscSetEEPConfigOnce(iop_base, cfg_buf,
-                                           bus_type)) == 0) {
-            break;
-        }
-        if (++retry > ASC_EEP_MAX_RETRY) {
-            break;
-        }
-    }
-    return (n_error);
+       int retry;
+       int n_error;
+
+       retry = 0;
+       while (TRUE) {
+               if ((n_error = AscSetEEPConfigOnce(iop_base, cfg_buf,
+                                                  bus_type)) == 0) {
+                       break;
+               }
+               if (++retry > ASC_EEP_MAX_RETRY) {
+                       break;
+               }
+       }
+       return (n_error);
 }
 
-STATIC void
-AscAsyncFix(
-               ASC_DVC_VAR *asc_dvc,
-               uchar tid_no,
-               ASC_SCSI_INQUIRY *inq)
+static void
+AscAsyncFix(ASC_DVC_VAR *asc_dvc, uchar tid_no, ASC_SCSI_INQUIRY *inq)
 {
-    uchar                       dvc_type;
-    ASC_SCSI_BIT_ID_TYPE        tid_bits;
-
-    dvc_type = ASC_INQ_DVC_TYPE(inq);
-    tid_bits = ASC_TIX_TO_TARGET_ID(tid_no);
-
-    if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_ASYN_USE_SYN)
-    {
-        if (!(asc_dvc->init_sdtr & tid_bits))
-        {
-            if ((dvc_type == TYPE_ROM) &&
-                (AscCompareString((uchar *) inq->vendor_id,
-                    (uchar *) "HP ", 3) == 0))
-            {
-                asc_dvc->pci_fix_asyn_xfer_always |= tid_bits;
-            }
-            asc_dvc->pci_fix_asyn_xfer |= tid_bits;
-            if ((dvc_type == TYPE_PROCESSOR) ||
-                (dvc_type == TYPE_SCANNER) ||
-                (dvc_type == TYPE_ROM) ||
-                (dvc_type == TYPE_TAPE))
-            {
-                asc_dvc->pci_fix_asyn_xfer &= ~tid_bits;
-            }
-
-            if (asc_dvc->pci_fix_asyn_xfer & tid_bits)
-            {
-                AscSetRunChipSynRegAtID(asc_dvc->iop_base, tid_no,
-                    ASYN_SDTR_DATA_FIX_PCI_REV_AB);
-            }
-        }
-    }
-    return;
+       uchar dvc_type;
+       ASC_SCSI_BIT_ID_TYPE tid_bits;
+
+       dvc_type = ASC_INQ_DVC_TYPE(inq);
+       tid_bits = ASC_TIX_TO_TARGET_ID(tid_no);
+
+       if (asc_dvc->bug_fix_cntl & ASC_BUG_FIX_ASYN_USE_SYN) {
+               if (!(asc_dvc->init_sdtr & tid_bits)) {
+                       if ((dvc_type == TYPE_ROM) &&
+                           (AscCompareString((uchar *)inq->vendor_id,
+                                             (uchar *)"HP ", 3) == 0)) {
+                               asc_dvc->pci_fix_asyn_xfer_always |= tid_bits;
+                       }
+                       asc_dvc->pci_fix_asyn_xfer |= tid_bits;
+                       if ((dvc_type == TYPE_PROCESSOR) ||
+                           (dvc_type == TYPE_SCANNER) ||
+                           (dvc_type == TYPE_ROM) || (dvc_type == TYPE_TAPE)) {
+                               asc_dvc->pci_fix_asyn_xfer &= ~tid_bits;
+                       }
+
+                       if (asc_dvc->pci_fix_asyn_xfer & tid_bits) {
+                               AscSetRunChipSynRegAtID(asc_dvc->iop_base,
+                                                       tid_no,
+                                                       ASYN_SDTR_DATA_FIX_PCI_REV_AB);
+                       }
+               }
+       }
+       return;
 }
 
-STATIC int
-AscTagQueuingSafe(ASC_SCSI_INQUIRY *inq)
+static int AscTagQueuingSafe(ASC_SCSI_INQUIRY *inq)
 {
-    if ((inq->add_len >= 32) &&
-        (AscCompareString((uchar *) inq->vendor_id,
-            (uchar *) "QUANTUM XP34301", 15) == 0) &&
-        (AscCompareString((uchar *) inq->product_rev_level,
-            (uchar *) "1071", 4) == 0))
-    {
-        return 0;
-    }
-    return 1;
+       if ((inq->add_len >= 32) &&
+           (AscCompareString((uchar *)inq->vendor_id,
+                             (uchar *)"QUANTUM XP34301", 15) == 0) &&
+           (AscCompareString((uchar *)inq->product_rev_level,
+                             (uchar *)"1071", 4) == 0)) {
+               return 0;
+       }
+       return 1;
 }
 
-STATIC void
-AscInquiryHandling(ASC_DVC_VAR *asc_dvc,
-                   uchar tid_no, ASC_SCSI_INQUIRY *inq)
+static void
+AscInquiryHandling(ASC_DVC_VAR *asc_dvc, uchar tid_no, ASC_SCSI_INQUIRY *inq)
 {
-    ASC_SCSI_BIT_ID_TYPE tid_bit = ASC_TIX_TO_TARGET_ID(tid_no);
-    ASC_SCSI_BIT_ID_TYPE orig_init_sdtr, orig_use_tagged_qng;
-
-    orig_init_sdtr = asc_dvc->init_sdtr;
-    orig_use_tagged_qng = asc_dvc->use_tagged_qng;
-
-    asc_dvc->init_sdtr &= ~tid_bit;
-    asc_dvc->cfg->can_tagged_qng &= ~tid_bit;
-    asc_dvc->use_tagged_qng &= ~tid_bit;
-
-    if (ASC_INQ_RESPONSE_FMT(inq) >= 2 || ASC_INQ_ANSI_VER(inq) >= 2) {
-        if ((asc_dvc->cfg->sdtr_enable & tid_bit) && ASC_INQ_SYNC(inq)) {
-            asc_dvc->init_sdtr |= tid_bit;
-        }
-        if ((asc_dvc->cfg->cmd_qng_enabled & tid_bit) &&
-             ASC_INQ_CMD_QUEUE(inq)) {
-            if (AscTagQueuingSafe(inq)) {
-                asc_dvc->use_tagged_qng |= tid_bit;
-                asc_dvc->cfg->can_tagged_qng |= tid_bit;
-            }
-        }
-    }
-    if (orig_use_tagged_qng != asc_dvc->use_tagged_qng) {
-        AscWriteLramByte(asc_dvc->iop_base, ASCV_DISC_ENABLE_B,
-                         asc_dvc->cfg->disc_enable);
-        AscWriteLramByte(asc_dvc->iop_base, ASCV_USE_TAGGED_QNG_B,
-                         asc_dvc->use_tagged_qng);
-        AscWriteLramByte(asc_dvc->iop_base, ASCV_CAN_TAGGED_QNG_B,
-                         asc_dvc->cfg->can_tagged_qng);
-
-        asc_dvc->max_dvc_qng[tid_no] =
-          asc_dvc->cfg->max_tag_qng[tid_no];
-        AscWriteLramByte(asc_dvc->iop_base,
-                         (ushort) (ASCV_MAX_DVC_QNG_BEG + tid_no),
-                         asc_dvc->max_dvc_qng[tid_no]);
-    }
-    if (orig_init_sdtr != asc_dvc->init_sdtr) {
-        AscAsyncFix(asc_dvc, tid_no, inq);
-    }
-    return;
+       ASC_SCSI_BIT_ID_TYPE tid_bit = ASC_TIX_TO_TARGET_ID(tid_no);
+       ASC_SCSI_BIT_ID_TYPE orig_init_sdtr, orig_use_tagged_qng;
+
+       orig_init_sdtr = asc_dvc->init_sdtr;
+       orig_use_tagged_qng = asc_dvc->use_tagged_qng;
+
+       asc_dvc->init_sdtr &= ~tid_bit;
+       asc_dvc->cfg->can_tagged_qng &= ~tid_bit;
+       asc_dvc->use_tagged_qng &= ~tid_bit;
+
+       if (ASC_INQ_RESPONSE_FMT(inq) >= 2 || ASC_INQ_ANSI_VER(inq) >= 2) {
+               if ((asc_dvc->cfg->sdtr_enable & tid_bit) && ASC_INQ_SYNC(inq)) {
+                       asc_dvc->init_sdtr |= tid_bit;
+               }
+               if ((asc_dvc->cfg->cmd_qng_enabled & tid_bit) &&
+                   ASC_INQ_CMD_QUEUE(inq)) {
+                       if (AscTagQueuingSafe(inq)) {
+                               asc_dvc->use_tagged_qng |= tid_bit;
+                               asc_dvc->cfg->can_tagged_qng |= tid_bit;
+                       }
+               }
+       }
+       if (orig_use_tagged_qng != asc_dvc->use_tagged_qng) {
+               AscWriteLramByte(asc_dvc->iop_base, ASCV_DISC_ENABLE_B,
+                                asc_dvc->cfg->disc_enable);
+               AscWriteLramByte(asc_dvc->iop_base, ASCV_USE_TAGGED_QNG_B,
+                                asc_dvc->use_tagged_qng);
+               AscWriteLramByte(asc_dvc->iop_base, ASCV_CAN_TAGGED_QNG_B,
+                                asc_dvc->cfg->can_tagged_qng);
+
+               asc_dvc->max_dvc_qng[tid_no] =
+                   asc_dvc->cfg->max_tag_qng[tid_no];
+               AscWriteLramByte(asc_dvc->iop_base,
+                                (ushort)(ASCV_MAX_DVC_QNG_BEG + tid_no),
+                                asc_dvc->max_dvc_qng[tid_no]);
+       }
+       if (orig_init_sdtr != asc_dvc->init_sdtr) {
+               AscAsyncFix(asc_dvc, tid_no, inq);
+       }
+       return;
 }
 
-STATIC int
-AscCompareString(
-                    uchar *str1,
-                    uchar *str2,
-                    int len
-)
+static int AscCompareString(uchar *str1, uchar *str2, int len)
 {
-    int                 i;
-    int                 diff;
+       int i;
+       int diff;
 
-    for (i = 0; i < len; i++) {
-        diff = (int) (str1[i] - str2[i]);
-        if (diff != 0)
-            return (diff);
-    }
-    return (0);
+       for (i = 0; i < len; i++) {
+               diff = (int)(str1[i] - str2[i]);
+               if (diff != 0)
+                       return (diff);
+       }
+       return (0);
 }
 
-STATIC uchar
-AscReadLramByte(
-                   PortAddr iop_base,
-                   ushort addr
-)
+static uchar AscReadLramByte(PortAddr iop_base, ushort addr)
 {
-    uchar               byte_data;
-    ushort              word_data;
-
-    if (isodd_word(addr)) {
-        AscSetChipLramAddr(iop_base, addr - 1);
-        word_data = AscGetChipLramData(iop_base);
-        byte_data = (uchar) ((word_data >> 8) & 0xFF);
-    } else {
-        AscSetChipLramAddr(iop_base, addr);
-        word_data = AscGetChipLramData(iop_base);
-        byte_data = (uchar) (word_data & 0xFF);
-    }
-    return (byte_data);
+       uchar byte_data;
+       ushort word_data;
+
+       if (isodd_word(addr)) {
+               AscSetChipLramAddr(iop_base, addr - 1);
+               word_data = AscGetChipLramData(iop_base);
+               byte_data = (uchar)((word_data >> 8) & 0xFF);
+       } else {
+               AscSetChipLramAddr(iop_base, addr);
+               word_data = AscGetChipLramData(iop_base);
+               byte_data = (uchar)(word_data & 0xFF);
+       }
+       return (byte_data);
 }
-STATIC ushort
-AscReadLramWord(
-                   PortAddr iop_base,
-                   ushort addr
-)
+
+static ushort AscReadLramWord(PortAddr iop_base, ushort addr)
 {
-    ushort              word_data;
+       ushort word_data;
 
-    AscSetChipLramAddr(iop_base, addr);
-    word_data = AscGetChipLramData(iop_base);
-    return (word_data);
+       AscSetChipLramAddr(iop_base, addr);
+       word_data = AscGetChipLramData(iop_base);
+       return (word_data);
 }
 
 #if CC_VERY_LONG_SG_LIST
-STATIC ASC_DCNT
-AscReadLramDWord(
-                    PortAddr iop_base,
-                    ushort addr
-)
+static ASC_DCNT AscReadLramDWord(PortAddr iop_base, ushort addr)
 {
-    ushort              val_low, val_high;
-    ASC_DCNT            dword_data;
-
-    AscSetChipLramAddr(iop_base, addr);
-    val_low = AscGetChipLramData(iop_base);
-    val_high = AscGetChipLramData(iop_base);
-    dword_data = ((ASC_DCNT) val_high << 16) | (ASC_DCNT) val_low;
-    return (dword_data);
+       ushort val_low, val_high;
+       ASC_DCNT dword_data;
+
+       AscSetChipLramAddr(iop_base, addr);
+       val_low = AscGetChipLramData(iop_base);
+       val_high = AscGetChipLramData(iop_base);
+       dword_data = ((ASC_DCNT) val_high << 16) | (ASC_DCNT) val_low;
+       return (dword_data);
 }
 #endif /* CC_VERY_LONG_SG_LIST */
 
-STATIC void
-AscWriteLramWord(
-                    PortAddr iop_base,
-                    ushort addr,
-                    ushort word_val
-)
+static void AscWriteLramWord(PortAddr iop_base, ushort addr, ushort word_val)
 {
-    AscSetChipLramAddr(iop_base, addr);
-    AscSetChipLramData(iop_base, word_val);
-    return;
+       AscSetChipLramAddr(iop_base, addr);
+       AscSetChipLramData(iop_base, word_val);
+       return;
 }
 
-STATIC void
-AscWriteLramByte(
-                    PortAddr iop_base,
-                    ushort addr,
-                    uchar byte_val
-)
+static void AscWriteLramByte(PortAddr iop_base, ushort addr, uchar byte_val)
 {
-    ushort              word_data;
-
-    if (isodd_word(addr)) {
-        addr--;
-        word_data = AscReadLramWord(iop_base, addr);
-        word_data &= 0x00FF;
-        word_data |= (((ushort) byte_val << 8) & 0xFF00);
-    } else {
-        word_data = AscReadLramWord(iop_base, addr);
-        word_data &= 0xFF00;
-        word_data |= ((ushort) byte_val & 0x00FF);
-    }
-    AscWriteLramWord(iop_base, addr, word_data);
-    return;
+       ushort word_data;
+
+       if (isodd_word(addr)) {
+               addr--;
+               word_data = AscReadLramWord(iop_base, addr);
+               word_data &= 0x00FF;
+               word_data |= (((ushort)byte_val << 8) & 0xFF00);
+       } else {
+               word_data = AscReadLramWord(iop_base, addr);
+               word_data &= 0xFF00;
+               word_data |= ((ushort)byte_val & 0x00FF);
+       }
+       AscWriteLramWord(iop_base, addr, word_data);
+       return;
 }
 
 /*
@@ -12841,30 +11628,26 @@ AscWriteLramByte(
  * The source data is assumed to be in little-endian order in memory
  * and is maintained in little-endian order when written to LRAM.
  */
-STATIC void
-AscMemWordCopyPtrToLram(
-                        PortAddr iop_base,
-                        ushort s_addr,
-                        uchar *s_buffer,
-                        int words
-)
+static void
+AscMemWordCopyPtrToLram(PortAddr iop_base,
+                       ushort s_addr, uchar *s_buffer, int words)
 {
-    int    i;
-
-    AscSetChipLramAddr(iop_base, s_addr);
-    for (i = 0; i < 2 * words; i += 2) {
-        /*
-         * On a little-endian system the second argument below
-         * produces a little-endian ushort which is written to
-         * LRAM in little-endian order. On a big-endian system
-         * the second argument produces a big-endian ushort which
-         * is "transparently" byte-swapped by outpw() and written
-         * in little-endian order to LRAM.
-         */
-        outpw(iop_base + IOP_RAM_DATA,
-            ((ushort) s_buffer[i + 1] << 8) | s_buffer[i]);
-    }
-    return;
+       int i;
+
+       AscSetChipLramAddr(iop_base, s_addr);
+       for (i = 0; i < 2 * words; i += 2) {
+               /*
+                * On a little-endian system the second argument below
+                * produces a little-endian ushort which is written to
+                * LRAM in little-endian order. On a big-endian system
+                * the second argument produces a big-endian ushort which
+                * is "transparently" byte-swapped by outpw() and written
+                * in little-endian order to LRAM.
+                */
+               outpw(iop_base + IOP_RAM_DATA,
+                     ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);
+       }
+       return;
 }
 
 /*
@@ -12873,24 +11656,18 @@ AscMemWordCopyPtrToLram(
  * The source data is assumed to be in little-endian order in memory
  * and is maintained in little-endian order when writen to LRAM.
  */
-STATIC void
-AscMemDWordCopyPtrToLram(
-                         PortAddr iop_base,
-                         ushort s_addr,
-                         uchar *s_buffer,
-                         int dwords
-)
+static void
+AscMemDWordCopyPtrToLram(PortAddr iop_base,
+                        ushort s_addr, uchar *s_buffer, int dwords)
 {
-    int       i;
-
-    AscSetChipLramAddr(iop_base, s_addr);
-    for (i = 0; i < 4 * dwords; i += 4) {
-        outpw(iop_base + IOP_RAM_DATA,
-            ((ushort) s_buffer[i + 1] << 8) | s_buffer[i]); /* LSW */
-        outpw(iop_base + IOP_RAM_DATA,
-            ((ushort) s_buffer[i + 3] << 8) | s_buffer[i + 2]); /* MSW */
-    }
-    return;
+       int i;
+
+       AscSetChipLramAddr(iop_base, s_addr);
+       for (i = 0; i < 4 * dwords; i += 4) {
+               outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 1] << 8) | s_buffer[i]);   /* LSW */
+               outpw(iop_base + IOP_RAM_DATA, ((ushort)s_buffer[i + 3] << 8) | s_buffer[i + 2]);       /* MSW */
+       }
+       return;
 }
 
 /*
@@ -12899,61 +11676,46 @@ AscMemDWordCopyPtrToLram(
  * The source data is assumed to be in little-endian order in LRAM
  * and is maintained in little-endian order when written to memory.
  */
-STATIC void
-AscMemWordCopyPtrFromLram(
-                          PortAddr iop_base,
-                          ushort s_addr,
-                          uchar *d_buffer,
-                          int words
-)
+static void
+AscMemWordCopyPtrFromLram(PortAddr iop_base,
+                         ushort s_addr, uchar *d_buffer, int words)
 {
-    int i;
-    ushort word;
-
-    AscSetChipLramAddr(iop_base, s_addr);
-    for (i = 0; i < 2 * words; i += 2) {
-        word = inpw(iop_base + IOP_RAM_DATA);
-        d_buffer[i] = word & 0xff;
-        d_buffer[i + 1] = (word >> 8) & 0xff;
-    }
-    return;
+       int i;
+       ushort word;
+
+       AscSetChipLramAddr(iop_base, s_addr);
+       for (i = 0; i < 2 * words; i += 2) {
+               word = inpw(iop_base + IOP_RAM_DATA);
+               d_buffer[i] = word & 0xff;
+               d_buffer[i + 1] = (word >> 8) & 0xff;
+       }
+       return;
 }
 
-STATIC ASC_DCNT
-AscMemSumLramWord(
-                     PortAddr iop_base,
-                     ushort s_addr,
-                     int words
-)
+static ASC_DCNT AscMemSumLramWord(PortAddr iop_base, ushort s_addr, int words)
 {
-    ASC_DCNT         sum;
-    int              i;
+       ASC_DCNT sum;
+       int i;
 
-    sum = 0L;
-    for (i = 0; i < words; i++, s_addr += 2) {
-        sum += AscReadLramWord(iop_base, s_addr);
-    }
-    return (sum);
+       sum = 0L;
+       for (i = 0; i < words; i++, s_addr += 2) {
+               sum += AscReadLramWord(iop_base, s_addr);
+       }
+       return (sum);
 }
 
-STATIC void
-AscMemWordSetLram(
-                     PortAddr iop_base,
-                     ushort s_addr,
-                     ushort set_wval,
-                     int words
-)
+static void
+AscMemWordSetLram(PortAddr iop_base, ushort s_addr, ushort set_wval, int words)
 {
-    int             i;
+       int i;
 
-    AscSetChipLramAddr(iop_base, s_addr);
-    for (i = 0; i < words; i++) {
-        AscSetChipLramData(iop_base, set_wval);
-    }
-    return;
+       AscSetChipLramAddr(iop_base, s_addr);
+       for (i = 0; i < words; i++) {
+               AscSetChipLramData(iop_base, set_wval);
+       }
+       return;
 }
 
-
 /*
  * --- Adv Library Functions
  */
@@ -12961,1076 +11723,2112 @@ AscMemWordSetLram(
 /* a_mcode.h */
 
 /* Microcode buffer is kept after initialization for error recovery. */
-STATIC unsigned char _adv_asc3550_buf[] = {
-  0x00,  0x00,  0x00,  0xf2,  0x00,  0xf0,  0x00,  0x16,  0x18,  0xe4,  0x00,  0xfc,  0x01,  0x00,  0x48,  0xe4,
-  0xbe,  0x18,  0x18,  0x80,  0x03,  0xf6,  0x02,  0x00,  0x00,  0xfa,  0xff,  0xff,  0x28,  0x0e,  0x9e,  0xe7,
-  0xff,  0x00,  0x82,  0xe7,  0x00,  0xea,  0x00,  0xf6,  0x01,  0xe6,  0x09,  0xe7,  0x55,  0xf0,  0x01,  0xf6,
-  0x01,  0xfa,  0x08,  0x00,  0x03,  0x00,  0x04,  0x00,  0x18,  0xf4,  0x10,  0x00,  0x00,  0xec,  0x85,  0xf0,
-  0xbc,  0x00,  0xd5,  0xf0,  0x8e,  0x0c,  0x38,  0x54,  0x00,  0xe6,  0x1e,  0xf0,  0x86,  0xf0,  0xb4,  0x00,
-  0x98,  0x57,  0xd0,  0x01,  0x0c,  0x1c,  0x3e,  0x1c,  0x0c,  0x00,  0xbb,  0x00,  0xaa,  0x18,  0x02,  0x80,
-  0x32,  0xf0,  0x01,  0xfc,  0x88,  0x0c,  0xc6,  0x12,  0x02,  0x13,  0x18,  0x40,  0x00,  0x57,  0x01,  0xea,
-  0x3c,  0x00,  0x6c,  0x01,  0x6e,  0x01,  0x04,  0x12,  0x3e,  0x57,  0x00,  0x80,  0x03,  0xe6,  0xb6,  0x00,
-  0xc0,  0x00,  0x01,  0x01,  0x3e,  0x01,  0xda,  0x0f,  0x22,  0x10,  0x08,  0x12,  0x02,  0x4a,  0xb9,  0x54,
-  0x03,  0x58,  0x1b,  0x80,  0x30,  0xe4,  0x4b,  0xe4,  0x20,  0x00,  0x32,  0x00,  0x3e,  0x00,  0x80,  0x00,
-  0x24,  0x01,  0x3c,  0x01,  0x68,  0x01,  0x6a,  0x01,  0x70,  0x01,  0x72,  0x01,  0x74,  0x01,  0x76,  0x01,
-  0x78,  0x01,  0x62,  0x0a,  0x92,  0x0c,  0x2c,  0x10,  0x2e,  0x10,  0x06,  0x13,  0x4c,  0x1c,  0xbb,  0x55,
-  0x3c,  0x56,  0x04,  0x80,  0x4a,  0xe4,  0x02,  0xee,  0x5b,  0xf0,  0xb1,  0xf0,  0x03,  0xf7,  0x06,  0xf7,
-  0x03,  0xfc,  0x0f,  0x00,  0x40,  0x00,  0xbe,  0x00,  0x00,  0x01,  0xb0,  0x08,  0x30,  0x13,  0x64,  0x15,
-  0x32,  0x1c,  0x38,  0x1c,  0x4e,  0x1c,  0x10,  0x44,  0x02,  0x48,  0x00,  0x4c,  0x04,  0xea,  0x5d,  0xf0,
-  0x04,  0xf6,  0x02,  0xfc,  0x05,  0x00,  0x34,  0x00,  0x36,  0x00,  0x98,  0x00,  0xcc,  0x00,  0x20,  0x01,
-  0x4e,  0x01,  0x4e,  0x0b,  0x1e,  0x0e,  0x0c,  0x10,  0x0a,  0x12,  0x04,  0x13,  0x40,  0x13,  0x30,  0x1c,
-  0x00,  0x4e,  0xbd,  0x56,  0x06,  0x83,  0x00,  0xdc,  0x05,  0xf0,  0x09,  0xf0,  0x59,  0xf0,  0xa7,  0xf0,
-  0xb8,  0xf0,  0x0e,  0xf7,  0x06,  0x00,  0x19,  0x00,  0x33,  0x00,  0x9b,  0x00,  0xa4,  0x00,  0xb5,  0x00,
-  0xba,  0x00,  0xd0,  0x00,  0xe1,  0x00,  0xe7,  0x00,  0xde,  0x03,  0x56,  0x0a,  0x14,  0x0e,  0x02,  0x10,
-  0x04,  0x10,  0x0a,  0x10,  0x36,  0x10,  0x0a,  0x13,  0x12,  0x13,  0x52,  0x13,  0x10,  0x15,  0x14,  0x15,
-  0xac,  0x16,  0x20,  0x1c,  0x34,  0x1c,  0x36,  0x1c,  0x08,  0x44,  0x38,  0x44,  0x91,  0x44,  0x0a,  0x45,
-  0x48,  0x46,  0x01,  0x48,  0x68,  0x54,  0x83,  0x55,  0xb0,  0x57,  0x01,  0x58,  0x83,  0x59,  0x05,  0xe6,
-  0x0b,  0xf0,  0x0c,  0xf0,  0x5c,  0xf0,  0x4b,  0xf4,  0x04,  0xf8,  0x05,  0xf8,  0x02,  0xfa,  0x03,  0xfa,
-  0x04,  0xfc,  0x05,  0xfc,  0x07,  0x00,  0x0a,  0x00,  0x0d,  0x00,  0x1c,  0x00,  0x9e,  0x00,  0xa8,  0x00,
-  0xaa,  0x00,  0xb9,  0x00,  0xe0,  0x00,  0x22,  0x01,  0x26,  0x01,  0x79,  0x01,  0x7a,  0x01,  0xc0,  0x01,
-  0xc2,  0x01,  0x7c,  0x02,  0x5a,  0x03,  0xea,  0x04,  0xe8,  0x07,  0x68,  0x08,  0x69,  0x08,  0xba,  0x08,
-  0xe9,  0x09,  0x06,  0x0b,  0x3a,  0x0e,  0x00,  0x10,  0x1a,  0x10,  0xed,  0x10,  0xf1,  0x10,  0x06,  0x12,
-  0x0c,  0x13,  0x16,  0x13,  0x1e,  0x13,  0x82,  0x13,  0x42,  0x14,  0xd6,  0x14,  0x8a,  0x15,  0xc6,  0x17,
-  0xd2,  0x17,  0x6b,  0x18,  0x12,  0x1c,  0x46,  0x1c,  0x9c,  0x32,  0x00,  0x40,  0x0e,  0x47,  0x48,  0x47,
-  0x41,  0x48,  0x89,  0x48,  0x80,  0x4c,  0x00,  0x54,  0x44,  0x55,  0xe5,  0x55,  0x14,  0x56,  0x77,  0x57,
-  0xbf,  0x57,  0x40,  0x5c,  0x06,  0x80,  0x08,  0x90,  0x03,  0xa1,  0xfe,  0x9c,  0xf0,  0x29,  0x02,  0xfe,
-  0xb8,  0x0c,  0xff,  0x10,  0x00,  0x00,  0xd0,  0xfe,  0xcc,  0x18,  0x00,  0xcf,  0xfe,  0x80,  0x01,  0xff,
-  0x03,  0x00,  0x00,  0xfe,  0x93,  0x15,  0xfe,  0x0f,  0x05,  0xff,  0x38,  0x00,  0x00,  0xfe,  0x57,  0x24,
-  0x00,  0xfe,  0x48,  0x00,  0x4f,  0xff,  0x04,  0x00,  0x00,  0x10,  0xff,  0x09,  0x00,  0x00,  0xff,  0x08,
-  0x01,  0x01,  0xff,  0x08,  0xff,  0xff,  0xff,  0x27,  0x00,  0x00,  0xff,  0x10,  0xff,  0xff,  0xff,  0x0f,
-  0x00,  0x00,  0xfe,  0x78,  0x56,  0xfe,  0x34,  0x12,  0xff,  0x21,  0x00,  0x00,  0xfe,  0x04,  0xf7,  0xcf,
-  0x2a,  0x67,  0x0b,  0x01,  0xfe,  0xce,  0x0e,  0xfe,  0x04,  0xf7,  0xcf,  0x67,  0x0b,  0x3c,  0x2a,  0xfe,
-  0x3d,  0xf0,  0xfe,  0x02,  0x02,  0xfe,  0x20,  0xf0,  0x9c,  0xfe,  0x91,  0xf0,  0xfe,  0xf0,  0x01,  0xfe,
-  0x90,  0xf0,  0xfe,  0xf0,  0x01,  0xfe,  0x8f,  0xf0,  0x9c,  0x05,  0x51,  0x3b,  0x02,  0xfe,  0xd4,  0x0c,
-  0x01,  0xfe,  0x44,  0x0d,  0xfe,  0xdd,  0x12,  0xfe,  0xfc,  0x10,  0xfe,  0x28,  0x1c,  0x05,  0xfe,  0xa6,
-  0x00,  0xfe,  0xd3,  0x12,  0x47,  0x18,  0xfe,  0xa6,  0x00,  0xb5,  0xfe,  0x48,  0xf0,  0xfe,  0x86,  0x02,
-  0xfe,  0x49,  0xf0,  0xfe,  0xa0,  0x02,  0xfe,  0x4a,  0xf0,  0xfe,  0xbe,  0x02,  0xfe,  0x46,  0xf0,  0xfe,
-  0x50,  0x02,  0xfe,  0x47,  0xf0,  0xfe,  0x56,  0x02,  0xfe,  0x43,  0xf0,  0xfe,  0x44,  0x02,  0xfe,  0x44,
-  0xf0,  0xfe,  0x48,  0x02,  0xfe,  0x45,  0xf0,  0xfe,  0x4c,  0x02,  0x17,  0x0b,  0xa0,  0x17,  0x06,  0x18,
-  0x96,  0x02,  0x29,  0xfe,  0x00,  0x1c,  0xde,  0xfe,  0x02,  0x1c,  0xdd,  0xfe,  0x1e,  0x1c,  0xfe,  0xe9,
-  0x10,  0x01,  0xfe,  0x20,  0x17,  0xfe,  0xe7,  0x10,  0xfe,  0x06,  0xfc,  0xc7,  0x0a,  0x6b,  0x01,  0x9e,
-  0x02,  0x29,  0x14,  0x4d,  0x37,  0x97,  0x01,  0xfe,  0x64,  0x0f,  0x0a,  0x6b,  0x01,  0x82,  0xfe,  0xbd,
-  0x10,  0x0a,  0x6b,  0x01,  0x82,  0xfe,  0xad,  0x10,  0xfe,  0x16,  0x1c,  0xfe,  0x58,  0x1c,  0x17,  0x06,
-  0x18,  0x96,  0x2a,  0x25,  0x29,  0xfe,  0x3d,  0xf0,  0xfe,  0x02,  0x02,  0x21,  0xfe,  0x94,  0x02,  0xfe,
-  0x5a,  0x1c,  0xea,  0xfe,  0x14,  0x1c,  0x14,  0xfe,  0x30,  0x00,  0x37,  0x97,  0x01,  0xfe,  0x54,  0x0f,
-  0x17,  0x06,  0x18,  0x96,  0x02,  0xd0,  0x1e,  0x20,  0x07,  0x10,  0x34,  0xfe,  0x69,  0x10,  0x17,  0x06,
-  0x18,  0x96,  0xfe,  0x04,  0xec,  0x20,  0x46,  0x3d,  0x12,  0x20,  0xfe,  0x05,  0xf6,  0xc7,  0x01,  0xfe,
-  0x52,  0x16,  0x09,  0x4a,  0x4c,  0x35,  0x11,  0x2d,  0x3c,  0x8a,  0x01,  0xe6,  0x02,  0x29,  0x0a,  0x40,
-  0x01,  0x0e,  0x07,  0x00,  0x5d,  0x01,  0x6f,  0xfe,  0x18,  0x10,  0xfe,  0x41,  0x58,  0x0a,  0x99,  0x01,
-  0x0e,  0xfe,  0xc8,  0x54,  0x64,  0xfe,  0x0c,  0x03,  0x01,  0xe6,  0x02,  0x29,  0x2a,  0x46,  0xfe,  0x02,
-  0xe8,  0x27,  0xf8,  0xfe,  0x9e,  0x43,  0xf7,  0xfe,  0x27,  0xf0,  0xfe,  0xdc,  0x01,  0xfe,  0x07,  0x4b,
-  0xfe,  0x20,  0xf0,  0x9c,  0xfe,  0x40,  0x1c,  0x25,  0xd2,  0xfe,  0x26,  0xf0,  0xfe,  0x56,  0x03,  0xfe,
-  0xa0,  0xf0,  0xfe,  0x44,  0x03,  0xfe,  0x11,  0xf0,  0x9c,  0xfe,  0xef,  0x10,  0xfe,  0x9f,  0xf0,  0xfe,
-  0x64,  0x03,  0xeb,  0x0f,  0xfe,  0x11,  0x00,  0x02,  0x5a,  0x2a,  0xfe,  0x48,  0x1c,  0xeb,  0x09,  0x04,
-  0x1d,  0xfe,  0x18,  0x13,  0x23,  0x1e,  0x98,  0xac,  0x12,  0x98,  0x0a,  0x40,  0x01,  0x0e,  0xac,  0x75,
-  0x01,  0xfe,  0xbc,  0x15,  0x11,  0xca,  0x25,  0xd2,  0xfe,  0x01,  0xf0,  0xd2,  0xfe,  0x82,  0xf0,  0xfe,
-  0x92,  0x03,  0xec,  0x11,  0xfe,  0xe4,  0x00,  0x65,  0xfe,  0xa4,  0x03,  0x25,  0x32,  0x1f,  0xfe,  0xb4,
-  0x03,  0x01,  0x43,  0xfe,  0x06,  0xf0,  0xfe,  0xc4,  0x03,  0x8d,  0x81,  0xfe,  0x0a,  0xf0,  0xfe,  0x7a,
-  0x06,  0x02,  0x22,  0x05,  0x6b,  0x28,  0x16,  0xfe,  0xf6,  0x04,  0x14,  0x2c,  0x01,  0x33,  0x8f,  0xfe,
-  0x66,  0x02,  0x02,  0xd1,  0xeb,  0x2a,  0x67,  0x1a,  0xfe,  0x67,  0x1b,  0xf8,  0xf7,  0xfe,  0x48,  0x1c,
-  0x70,  0x01,  0x6e,  0x87,  0x0a,  0x40,  0x01,  0x0e,  0x07,  0x00,  0x16,  0xd3,  0x0a,  0xca,  0x01,  0x0e,
-  0x74,  0x60,  0x59,  0x76,  0x27,  0x05,  0x6b,  0x28,  0xfe,  0x10,  0x12,  0x14,  0x2c,  0x01,  0x33,  0x8f,
-  0xfe,  0x66,  0x02,  0x02,  0xd1,  0xbc,  0x7d,  0xbd,  0x7f,  0x25,  0x22,  0x65,  0xfe,  0x3c,  0x04,  0x1f,
-  0xfe,  0x38,  0x04,  0x68,  0xfe,  0xa0,  0x00,  0xfe,  0x9b,  0x57,  0xfe,  0x4e,  0x12,  0x2b,  0xff,  0x02,
-  0x00,  0x10,  0x01,  0x08,  0x1f,  0xfe,  0xe0,  0x04,  0x2b,  0x01,  0x08,  0x1f,  0x22,  0x30,  0x2e,  0xd5,
-  0xfe,  0x4c,  0x44,  0xfe,  0x4c,  0x12,  0x60,  0xfe,  0x44,  0x48,  0x13,  0x2c,  0xfe,  0x4c,  0x54,  0x64,
-  0xd3,  0x46,  0x76,  0x27,  0xfa,  0xef,  0xfe,  0x62,  0x13,  0x09,  0x04,  0x1d,  0xfe,  0x2a,  0x13,  0x2f,
-  0x07,  0x7e,  0xa5,  0xfe,  0x20,  0x10,  0x13,  0x2c,  0xfe,  0x4c,  0x54,  0x64,  0xd3,  0xfa,  0xef,  0x86,
-  0x09,  0x04,  0x1d,  0xfe,  0x08,  0x13,  0x2f,  0x07,  0x7e,  0x6e,  0x09,  0x04,  0x1d,  0xfe,  0x1c,  0x12,
-  0x14,  0x92,  0x09,  0x04,  0x06,  0x3b,  0x14,  0xc4,  0x01,  0x33,  0x8f,  0xfe,  0x70,  0x0c,  0x02,  0x22,
-  0x2b,  0x11,  0xfe,  0xe6,  0x00,  0xfe,  0x1c,  0x90,  0xf9,  0x03,  0x14,  0x92,  0x01,  0x33,  0x02,  0x29,
-  0xfe,  0x42,  0x5b,  0x67,  0x1a,  0xfe,  0x46,  0x59,  0xf8,  0xf7,  0xfe,  0x87,  0x80,  0xfe,  0x31,  0xe4,
-  0x4f,  0x09,  0x04,  0x0b,  0xfe,  0x78,  0x13,  0xfe,  0x20,  0x80,  0x07,  0x1a,  0xfe,  0x70,  0x12,  0x49,
-  0x04,  0x06,  0xfe,  0x60,  0x13,  0x05,  0xfe,  0xa2,  0x00,  0x28,  0x16,  0xfe,  0x80,  0x05,  0xfe,  0x31,
-  0xe4,  0x6a,  0x49,  0x04,  0x0b,  0xfe,  0x4a,  0x13,  0x05,  0xfe,  0xa0,  0x00,  0x28,  0xfe,  0x42,  0x12,
-  0x5e,  0x01,  0x08,  0x25,  0x32,  0xf1,  0x01,  0x08,  0x26,  0xfe,  0x98,  0x05,  0x11,  0xfe,  0xe3,  0x00,
-  0x23,  0x49,  0xfe,  0x4a,  0xf0,  0xfe,  0x6a,  0x05,  0xfe,  0x49,  0xf0,  0xfe,  0x64,  0x05,  0x83,  0x24,
-  0xfe,  0x21,  0x00,  0xa1,  0x24,  0xfe,  0x22,  0x00,  0xa0,  0x24,  0x4c,  0xfe,  0x09,  0x48,  0x01,  0x08,
-  0x26,  0xfe,  0x98,  0x05,  0xfe,  0xe2,  0x08,  0x49,  0x04,  0xc5,  0x3b,  0x01,  0x86,  0x24,  0x06,  0x12,
-  0xcc,  0x37,  0xfe,  0x27,  0x01,  0x09,  0x04,  0x1d,  0xfe,  0x22,  0x12,  0x47,  0x01,  0xa7,  0x14,  0x92,
-  0x09,  0x04,  0x06,  0x3b,  0x14,  0xc4,  0x01,  0x33,  0x8f,  0xfe,  0x70,  0x0c,  0x02,  0x22,  0x05,  0xfe,
-  0x9c,  0x00,  0x28,  0xfe,  0x3e,  0x12,  0x05,  0x50,  0x28,  0xfe,  0x36,  0x13,  0x47,  0x01,  0xa7,  0x26,
-  0xfe,  0x08,  0x06,  0x0a,  0x06,  0x49,  0x04,  0x19,  0xfe,  0x02,  0x12,  0x5f,  0x01,  0xfe,  0xaa,  0x14,
-  0x1f,  0xfe,  0xfe,  0x05,  0x11,  0x9a,  0x01,  0x43,  0x11,  0xfe,  0xe5,  0x00,  0x05,  0x50,  0xb4,  0x0c,
-  0x50,  0x05,  0xc6,  0x28,  0xfe,  0x62,  0x12,  0x05,  0x3f,  0x28,  0xfe,  0x5a,  0x13,  0x01,  0xfe,  0x14,
-  0x18,  0x01,  0xfe,  0x66,  0x18,  0xfe,  0x43,  0x48,  0xb7,  0x19,  0x13,  0x6c,  0xff,  0x02,  0x00,  0x57,
-  0x48,  0x8b,  0x1c,  0x3d,  0x85,  0xb7,  0x69,  0x47,  0x01,  0xa7,  0x26,  0xfe,  0x72,  0x06,  0x49,  0x04,
-  0x1b,  0xdf,  0x89,  0x0a,  0x4d,  0x01,  0xfe,  0xd8,  0x14,  0x1f,  0xfe,  0x68,  0x06,  0x11,  0x9a,  0x01,
-  0x43,  0x11,  0xfe,  0xe5,  0x00,  0x05,  0x3f,  0xb4,  0x0c,  0x3f,  0x17,  0x06,  0x01,  0xa7,  0xec,  0x72,
-  0x70,  0x01,  0x6e,  0x87,  0x11,  0xfe,  0xe2,  0x00,  0x01,  0x08,  0x25,  0x32,  0xfe,  0x0a,  0xf0,  0xfe,
-  0xa6,  0x06,  0x8c,  0xfe,  0x5c,  0x07,  0xfe,  0x06,  0xf0,  0xfe,  0x64,  0x07,  0x8d,  0x81,  0x02,  0x22,
-  0x09,  0x04,  0x0b,  0xfe,  0x2e,  0x12,  0x15,  0x1a,  0x01,  0x08,  0x15,  0x00,  0x01,  0x08,  0x15,  0x00,
-  0x01,  0x08,  0x15,  0x00,  0x01,  0x08,  0xfe,  0x99,  0xa4,  0x01,  0x08,  0x15,  0x00,  0x02,  0xfe,  0x32,
-  0x08,  0x61,  0x04,  0x1b,  0xfe,  0x38,  0x12,  0x09,  0x04,  0x1b,  0x6e,  0x15,  0xfe,  0x1b,  0x00,  0x01,
-  0x08,  0x15,  0x00,  0x01,  0x08,  0x15,  0x00,  0x01,  0x08,  0x15,  0x00,  0x01,  0x08,  0x15,  0x06,  0x01,
-  0x08,  0x15,  0x00,  0x02,  0xd9,  0x66,  0x4c,  0xfe,  0x3a,  0x55,  0x5f,  0xfe,  0x9a,  0x81,  0x4b,  0x1d,
-  0xba,  0xfe,  0x32,  0x07,  0x0a,  0x1d,  0xfe,  0x09,  0x6f,  0xaf,  0xfe,  0xca,  0x45,  0xfe,  0x32,  0x12,
-  0x62,  0x2c,  0x85,  0x66,  0x7b,  0x01,  0x08,  0x25,  0x32,  0xfe,  0x0a,  0xf0,  0xfe,  0x32,  0x07,  0x8d,
-  0x81,  0x8c,  0xfe,  0x5c,  0x07,  0x02,  0x22,  0x01,  0x43,  0x02,  0xfe,  0x8a,  0x06,  0x15,  0x19,  0x02,
-  0xfe,  0x8a,  0x06,  0xfe,  0x9c,  0xf7,  0xd4,  0xfe,  0x2c,  0x90,  0xfe,  0xae,  0x90,  0x77,  0xfe,  0xca,
-  0x07,  0x0c,  0x54,  0x18,  0x55,  0x09,  0x4a,  0x6a,  0x35,  0x1e,  0x20,  0x07,  0x10,  0xfe,  0x0e,  0x12,
-  0x74,  0xfe,  0x80,  0x80,  0x37,  0x20,  0x63,  0x27,  0xfe,  0x06,  0x10,  0xfe,  0x83,  0xe7,  0xc4,  0xa1,
-  0xfe,  0x03,  0x40,  0x09,  0x4a,  0x4f,  0x35,  0x01,  0xa8,  0xad,  0xfe,  0x1f,  0x40,  0x12,  0x58,  0x01,
-  0xa5,  0xfe,  0x08,  0x50,  0xfe,  0x8a,  0x50,  0xfe,  0x44,  0x51,  0xfe,  0xc6,  0x51,  0x83,  0xfb,  0xfe,
-  0x8a,  0x90,  0x0c,  0x52,  0x18,  0x53,  0xfe,  0x0c,  0x90,  0xfe,  0x8e,  0x90,  0xfe,  0x40,  0x50,  0xfe,
-  0xc2,  0x50,  0x0c,  0x39,  0x18,  0x3a,  0xfe,  0x4a,  0x10,  0x09,  0x04,  0x6a,  0xfe,  0x2a,  0x12,  0xfe,
-  0x2c,  0x90,  0xfe,  0xae,  0x90,  0x0c,  0x54,  0x18,  0x55,  0x09,  0x04,  0x4f,  0x85,  0x01,  0xa8,  0xfe,
-  0x1f,  0x80,  0x12,  0x58,  0xfe,  0x44,  0x90,  0xfe,  0xc6,  0x90,  0x0c,  0x56,  0x18,  0x57,  0xfb,  0xfe,
-  0x8a,  0x90,  0x0c,  0x52,  0x18,  0x53,  0xfe,  0x40,  0x90,  0xfe,  0xc2,  0x90,  0x0c,  0x39,  0x18,  0x3a,
-  0x0c,  0x38,  0x18,  0x4e,  0x09,  0x4a,  0x19,  0x35,  0x2a,  0x13,  0xfe,  0x4e,  0x11,  0x65,  0xfe,  0x48,
-  0x08,  0xfe,  0x9e,  0xf0,  0xfe,  0x5c,  0x08,  0xb1,  0x16,  0x32,  0x2a,  0x73,  0xdd,  0xb8,  0xfe,  0x80,
-  0x08,  0xb9,  0xfe,  0x9e,  0x08,  0x8c,  0xfe,  0x74,  0x08,  0xfe,  0x06,  0xf0,  0xfe,  0x7a,  0x08,  0x8d,
-  0x81,  0x02,  0x22,  0x01,  0x43,  0xfe,  0xc9,  0x10,  0x15,  0x19,  0xfe,  0xc9,  0x10,  0x61,  0x04,  0x06,
-  0xfe,  0x10,  0x12,  0x61,  0x04,  0x0b,  0x45,  0x09,  0x04,  0x0b,  0xfe,  0x68,  0x12,  0xfe,  0x2e,  0x1c,
-  0x02,  0xfe,  0x24,  0x0a,  0x61,  0x04,  0x06,  0x45,  0x61,  0x04,  0x0b,  0xfe,  0x52,  0x12,  0xfe,  0x2c,
-  0x1c,  0xfe,  0xaa,  0xf0,  0xfe,  0x1e,  0x09,  0xfe,  0xac,  0xf0,  0xfe,  0xbe,  0x08,  0xfe,  0x8a,  0x10,
-  0xaa,  0xfe,  0xf3,  0x10,  0xfe,  0xad,  0xf0,  0xfe,  0xca,  0x08,  0x02,  0xfe,  0x24,  0x0a,  0xab,  0xfe,
-  0xe7,  0x10,  0xfe,  0x2b,  0xf0,  0x9d,  0xe9,  0x1c,  0xfe,  0x00,  0xfe,  0xfe,  0x1c,  0x12,  0xb5,  0xfe,
-  0xd2,  0xf0,  0x9d,  0xfe,  0x76,  0x18,  0x1c,  0x1a,  0x16,  0x9d,  0x05,  0xcb,  0x1c,  0x06,  0x16,  0x9d,
-  0xb8,  0x6d,  0xb9,  0x6d,  0xaa,  0xab,  0xfe,  0xb1,  0x10,  0x70,  0x5e,  0x2b,  0x14,  0x92,  0x01,  0x33,
-  0x0f,  0xfe,  0x35,  0x00,  0xfe,  0x01,  0xf0,  0x5a,  0x0f,  0x7c,  0x02,  0x5a,  0xfe,  0x74,  0x18,  0x1c,
-  0xfe,  0x00,  0xf8,  0x16,  0x6d,  0x67,  0x1b,  0x01,  0xfe,  0x44,  0x0d,  0x3b,  0x01,  0xe6,  0x1e,  0x27,
-  0x74,  0x67,  0x1a,  0x02,  0x6d,  0x09,  0x04,  0x0b,  0x21,  0xfe,  0x06,  0x0a,  0x09,  0x04,  0x6a,  0xfe,
-  0x82,  0x12,  0x09,  0x04,  0x19,  0xfe,  0x66,  0x13,  0x1e,  0x58,  0xac,  0xfc,  0xfe,  0x83,  0x80,  0xfe,
-  0xc8,  0x44,  0xfe,  0x2e,  0x13,  0xfe,  0x04,  0x91,  0xfe,  0x86,  0x91,  0x63,  0x27,  0xfe,  0x40,  0x59,
-  0xfe,  0xc1,  0x59,  0x77,  0xd7,  0x05,  0x54,  0x31,  0x55,  0x0c,  0x7b,  0x18,  0x7c,  0xbe,  0x54,  0xbf,
-  0x55,  0x01,  0xa8,  0xad,  0x63,  0x27,  0x12,  0x58,  0xc0,  0x38,  0xc1,  0x4e,  0x79,  0x56,  0x68,  0x57,
-  0xf4,  0xf5,  0xfe,  0x04,  0xfa,  0x38,  0xfe,  0x05,  0xfa,  0x4e,  0x01,  0xa5,  0xa2,  0x23,  0x0c,  0x7b,
-  0x0c,  0x7c,  0x79,  0x56,  0x68,  0x57,  0xfe,  0x12,  0x10,  0x09,  0x04,  0x19,  0x16,  0xd7,  0x79,  0x39,
-  0x68,  0x3a,  0x09,  0x04,  0xfe,  0xf7,  0x00,  0x35,  0x05,  0x52,  0x31,  0x53,  0xfe,  0x10,  0x58,  0xfe,
-  0x91,  0x58,  0xfe,  0x14,  0x59,  0xfe,  0x95,  0x59,  0x02,  0x6d,  0x09,  0x04,  0x19,  0x16,  0xd7,  0x09,
-  0x04,  0xfe,  0xf7,  0x00,  0x35,  0xfe,  0x3a,  0x55,  0xfe,  0x19,  0x81,  0x5f,  0xfe,  0x10,  0x90,  0xfe,
-  0x92,  0x90,  0xfe,  0xd7,  0x10,  0x2f,  0x07,  0x9b,  0x16,  0xfe,  0xc6,  0x08,  0x11,  0x9b,  0x09,  0x04,
-  0x0b,  0xfe,  0x14,  0x13,  0x05,  0x39,  0x31,  0x3a,  0x77,  0xfe,  0xc6,  0x08,  0xfe,  0x0c,  0x58,  0xfe,
-  0x8d,  0x58,  0x02,  0x6d,  0x23,  0x47,  0xfe,  0x19,  0x80,  0xde,  0x09,  0x04,  0x0b,  0xfe,  0x1a,  0x12,
-  0xfe,  0x6c,  0x19,  0xfe,  0x19,  0x41,  0xe9,  0xb5,  0xfe,  0xd1,  0xf0,  0xd9,  0x14,  0x7a,  0x01,  0x33,
-  0x0f,  0xfe,  0x44,  0x00,  0xfe,  0x8e,  0x10,  0xfe,  0x6c,  0x19,  0xbe,  0x39,  0xfe,  0xed,  0x19,  0xbf,
-  0x3a,  0xfe,  0x0c,  0x51,  0xfe,  0x8e,  0x51,  0xe9,  0x1c,  0xfe,  0x00,  0xff,  0x34,  0xfe,  0x74,  0x10,
-  0xb5,  0xfe,  0xd2,  0xf0,  0xfe,  0xb2,  0x0a,  0xfe,  0x76,  0x18,  0x1c,  0x1a,  0x84,  0x05,  0xcb,  0x1c,
-  0x06,  0xfe,  0x08,  0x13,  0x0f,  0xfe,  0x16,  0x00,  0x02,  0x5a,  0xfe,  0xd1,  0xf0,  0xfe,  0xc4,  0x0a,
-  0x14,  0x7a,  0x01,  0x33,  0x0f,  0xfe,  0x17,  0x00,  0xfe,  0x42,  0x10,  0xfe,  0xce,  0xf0,  0xfe,  0xca,
-  0x0a,  0xfe,  0x3c,  0x10,  0xfe,  0xcd,  0xf0,  0xfe,  0xd6,  0x0a,  0x0f,  0xfe,  0x22,  0x00,  0x02,  0x5a,
-  0xfe,  0xcb,  0xf0,  0xfe,  0xe2,  0x0a,  0x0f,  0xfe,  0x24,  0x00,  0x02,  0x5a,  0xfe,  0xd0,  0xf0,  0xfe,
-  0xec,  0x0a,  0x0f,  0x93,  0xdc,  0xfe,  0xcf,  0xf0,  0xfe,  0xf6,  0x0a,  0x0f,  0x4c,  0xfe,  0x10,  0x10,
-  0xfe,  0xcc,  0xf0,  0xd9,  0x61,  0x04,  0x19,  0x3b,  0x0f,  0xfe,  0x12,  0x00,  0x2a,  0x13,  0xfe,  0x4e,
-  0x11,  0x65,  0xfe,  0x0c,  0x0b,  0xfe,  0x9e,  0xf0,  0xfe,  0x20,  0x0b,  0xb1,  0x16,  0x32,  0x2a,  0x73,
-  0xdd,  0xb8,  0x22,  0xb9,  0x22,  0x2a,  0xec,  0x65,  0xfe,  0x2c,  0x0b,  0x25,  0x32,  0x8c,  0xfe,  0x48,
-  0x0b,  0x8d,  0x81,  0xb8,  0xd4,  0xb9,  0xd4,  0x02,  0x22,  0x01,  0x43,  0xfe,  0xdb,  0x10,  0x11,  0xfe,
-  0xe8,  0x00,  0xaa,  0xab,  0x70,  0xbc,  0x7d,  0xbd,  0x7f,  0xfe,  0x89,  0xf0,  0x22,  0x30,  0x2e,  0xd8,
-  0xbc,  0x7d,  0xbd,  0x7f,  0x01,  0x08,  0x1f,  0x22,  0x30,  0x2e,  0xd6,  0xb1,  0x45,  0x0f,  0xfe,  0x42,
-  0x00,  0x02,  0x5a,  0x78,  0x06,  0xfe,  0x81,  0x49,  0x16,  0xfe,  0x38,  0x0c,  0x09,  0x04,  0x0b,  0xfe,
-  0x44,  0x13,  0x0f,  0x00,  0x4b,  0x0b,  0xfe,  0x54,  0x12,  0x4b,  0xfe,  0x28,  0x00,  0x21,  0xfe,  0xa6,
-  0x0c,  0x0a,  0x40,  0x01,  0x0e,  0x07,  0x00,  0x5d,  0x3e,  0xfe,  0x28,  0x00,  0xfe,  0xe2,  0x10,  0x01,
-  0xe7,  0x01,  0xe8,  0x0a,  0x99,  0x01,  0xfe,  0x32,  0x0e,  0x59,  0x11,  0x2d,  0x01,  0x6f,  0x02,  0x29,
-  0x0f,  0xfe,  0x44,  0x00,  0x4b,  0x0b,  0xdf,  0x3e,  0x0b,  0xfe,  0xb4,  0x10,  0x01,  0x86,  0x3e,  0x0b,
-  0xfe,  0xaa,  0x10,  0x01,  0x86,  0xfe,  0x19,  0x82,  0xfe,  0x34,  0x46,  0xa3,  0x3e,  0x0b,  0x0f,  0xfe,
-  0x43,  0x00,  0xfe,  0x96,  0x10,  0x09,  0x4a,  0x0b,  0x35,  0x01,  0xe7,  0x01,  0xe8,  0x59,  0x11,  0x2d,
-  0x01,  0x6f,  0x67,  0x0b,  0x59,  0x3c,  0x8a,  0x02,  0xfe,  0x2a,  0x03,  0x09,  0x04,  0x0b,  0x84,  0x3e,
-  0x0b,  0x0f,  0x00,  0xfe,  0x5c,  0x10,  0x61,  0x04,  0x1b,  0xfe,  0x58,  0x12,  0x09,  0x04,  0x1b,  0xfe,
-  0x50,  0x13,  0xfe,  0x1c,  0x1c,  0xfe,  0x9d,  0xf0,  0xfe,  0x5c,  0x0c,  0xfe,  0x1c,  0x1c,  0xfe,  0x9d,
-  0xf0,  0xfe,  0x62,  0x0c,  0x09,  0x4a,  0x1b,  0x35,  0xfe,  0xa9,  0x10,  0x0f,  0xfe,  0x15,  0x00,  0xfe,
-  0x04,  0xe6,  0x0b,  0x5f,  0x5c,  0x0f,  0xfe,  0x13,  0x00,  0xfe,  0x10,  0x10,  0x0f,  0xfe,  0x47,  0x00,
-  0xa1,  0x0f,  0xfe,  0x41,  0x00,  0xa0,  0x0f,  0xfe,  0x24,  0x00,  0x87,  0xaa,  0xab,  0x70,  0x05,  0x6b,
-  0x28,  0x21,  0xd1,  0x5f,  0xfe,  0x04,  0xe6,  0x1b,  0xfe,  0x9d,  0x41,  0xfe,  0x1c,  0x42,  0x59,  0x01,
-  0xda,  0x02,  0x29,  0xea,  0x14,  0x0b,  0x37,  0x95,  0xa9,  0x14,  0xfe,  0x31,  0x00,  0x37,  0x97,  0x01,
-  0xfe,  0x54,  0x0f,  0x02,  0xd0,  0x3c,  0xfe,  0x06,  0xec,  0xc9,  0xee,  0x3e,  0x1d,  0xfe,  0xce,  0x45,
-  0x34,  0x3c,  0xfe,  0x06,  0xea,  0xc9,  0xfe,  0x47,  0x4b,  0x89,  0xfe,  0x75,  0x57,  0x05,  0x51,  0xfe,
-  0x98,  0x56,  0xfe,  0x38,  0x12,  0x0a,  0x42,  0x01,  0x0e,  0xfe,  0x44,  0x48,  0x46,  0x09,  0x04,  0x1d,
-  0xfe,  0x1a,  0x13,  0x0a,  0x40,  0x01,  0x0e,  0x47,  0xfe,  0x41,  0x58,  0x0a,  0x99,  0x01,  0x0e,  0xfe,
-  0x49,  0x54,  0x8e,  0xfe,  0x2a,  0x0d,  0x02,  0xfe,  0x2a,  0x03,  0x0a,  0x51,  0xfe,  0xee,  0x14,  0xee,
-  0x3e,  0x1d,  0xfe,  0xce,  0x45,  0x34,  0x3c,  0xfe,  0xce,  0x47,  0xfe,  0xad,  0x13,  0x02,  0x29,  0x1e,
-  0x20,  0x07,  0x10,  0xfe,  0x9e,  0x12,  0x23,  0x12,  0x4d,  0x12,  0x94,  0x12,  0xce,  0x1e,  0x2d,  0x47,
-  0x37,  0x2d,  0xb1,  0xe0,  0xfe,  0xbc,  0xf0,  0xfe,  0xec,  0x0d,  0x13,  0x06,  0x12,  0x4d,  0x01,  0xfe,
-  0xe2,  0x15,  0x05,  0xfe,  0x38,  0x01,  0x31,  0xfe,  0x3a,  0x01,  0x77,  0xfe,  0xf0,  0x0d,  0xfe,  0x02,
-  0xec,  0xce,  0x62,  0x00,  0x5d,  0xfe,  0x04,  0xec,  0x20,  0x46,  0xfe,  0x05,  0xf6,  0xfe,  0x34,  0x01,
-  0x01,  0xfe,  0x52,  0x16,  0xfb,  0xfe,  0x48,  0xf4,  0x0d,  0xfe,  0x18,  0x13,  0xaf,  0xfe,  0x02,  0xea,
-  0xce,  0x62,  0x7a,  0xfe,  0xc5,  0x13,  0x14,  0x1b,  0x37,  0x95,  0xa9,  0x5c,  0x05,  0xfe,  0x38,  0x01,
-  0x1c,  0xfe,  0xf0,  0xff,  0x0c,  0xfe,  0x60,  0x01,  0x05,  0xfe,  0x3a,  0x01,  0x0c,  0xfe,  0x62,  0x01,
-  0x3d,  0x12,  0x20,  0x24,  0x06,  0x12,  0x2d,  0x11,  0x2d,  0x8a,  0x13,  0x06,  0x03,  0x23,  0x03,  0x1e,
-  0x4d,  0xfe,  0xf7,  0x12,  0x1e,  0x94,  0xac,  0x12,  0x94,  0x07,  0x7a,  0xfe,  0x71,  0x13,  0xfe,  0x24,
-  0x1c,  0x14,  0x1a,  0x37,  0x95,  0xa9,  0xfe,  0xd9,  0x10,  0xb6,  0xfe,  0x03,  0xdc,  0xfe,  0x73,  0x57,
-  0xfe,  0x80,  0x5d,  0x03,  0xb6,  0xfe,  0x03,  0xdc,  0xfe,  0x5b,  0x57,  0xfe,  0x80,  0x5d,  0x03,  0xfe,
-  0x03,  0x57,  0xb6,  0x23,  0xfe,  0x00,  0xcc,  0x03,  0xfe,  0x03,  0x57,  0xb6,  0x75,  0x03,  0x09,  0x04,
-  0x4c,  0xfe,  0x22,  0x13,  0xfe,  0x1c,  0x80,  0x07,  0x06,  0xfe,  0x1a,  0x13,  0xfe,  0x1e,  0x80,  0xe1,
-  0xfe,  0x1d,  0x80,  0xa4,  0xfe,  0x0c,  0x90,  0xfe,  0x0e,  0x13,  0xfe,  0x0e,  0x90,  0xa3,  0xfe,  0x3c,
-  0x90,  0xfe,  0x30,  0xf4,  0x0b,  0xfe,  0x3c,  0x50,  0xa0,  0x01,  0xfe,  0x82,  0x16,  0x2f,  0x07,  0x2d,
-  0xe0,  0x01,  0xfe,  0xbc,  0x15,  0x09,  0x04,  0x1d,  0x45,  0x01,  0xe7,  0x01,  0xe8,  0x11,  0xfe,  0xe9,
-  0x00,  0x09,  0x04,  0x4c,  0xfe,  0x2c,  0x13,  0x01,  0xfe,  0x14,  0x16,  0xfe,  0x1e,  0x1c,  0xfe,  0x14,
-  0x90,  0xfe,  0x96,  0x90,  0x0c,  0xfe,  0x64,  0x01,  0x18,  0xfe,  0x66,  0x01,  0x09,  0x04,  0x4f,  0xfe,
-  0x12,  0x12,  0xfe,  0x03,  0x80,  0x74,  0xfe,  0x01,  0xec,  0x20,  0xfe,  0x80,  0x40,  0x12,  0x20,  0x63,
-  0x27,  0x11,  0xc8,  0x59,  0x1e,  0x20,  0xed,  0x76,  0x20,  0x03,  0xfe,  0x08,  0x1c,  0x05,  0xfe,  0xac,
-  0x00,  0xfe,  0x06,  0x58,  0x05,  0xfe,  0xae,  0x00,  0xfe,  0x07,  0x58,  0x05,  0xfe,  0xb0,  0x00,  0xfe,
-  0x08,  0x58,  0x05,  0xfe,  0xb2,  0x00,  0xfe,  0x09,  0x58,  0xfe,  0x0a,  0x1c,  0x24,  0x69,  0x12,  0xc9,
-  0x23,  0x0c,  0x50,  0x0c,  0x3f,  0x13,  0x40,  0x48,  0x5f,  0x17,  0x1d,  0xfe,  0x90,  0x4d,  0xfe,  0x91,
-  0x54,  0x21,  0xfe,  0x08,  0x0f,  0x3e,  0x10,  0x13,  0x42,  0x48,  0x17,  0x4c,  0xfe,  0x90,  0x4d,  0xfe,
-  0x91,  0x54,  0x21,  0xfe,  0x1e,  0x0f,  0x24,  0x10,  0x12,  0x20,  0x78,  0x2c,  0x46,  0x1e,  0x20,  0xed,
-  0x76,  0x20,  0x11,  0xc8,  0xf6,  0xfe,  0xd6,  0xf0,  0xfe,  0x32,  0x0f,  0xea,  0x70,  0xfe,  0x14,  0x1c,
-  0xfe,  0x10,  0x1c,  0xfe,  0x18,  0x1c,  0x03,  0x3c,  0xfe,  0x0c,  0x14,  0xee,  0xfe,  0x07,  0xe6,  0x1d,
-  0xfe,  0xce,  0x47,  0xfe,  0xf5,  0x13,  0x03,  0x01,  0x86,  0x78,  0x2c,  0x46,  0xfa,  0xef,  0xfe,  0x42,
-  0x13,  0x2f,  0x07,  0x2d,  0xfe,  0x34,  0x13,  0x0a,  0x42,  0x01,  0x0e,  0xb0,  0xfe,  0x36,  0x12,  0xf0,
-  0xfe,  0x45,  0x48,  0x01,  0xe3,  0xfe,  0x00,  0xcc,  0xb0,  0xfe,  0xf3,  0x13,  0x3d,  0x75,  0x07,  0x10,
-  0xa3,  0x0a,  0x80,  0x01,  0x0e,  0xfe,  0x80,  0x5c,  0x01,  0x6f,  0xfe,  0x0e,  0x10,  0x07,  0x7e,  0x45,
-  0xf6,  0xfe,  0xd6,  0xf0,  0xfe,  0x6c,  0x0f,  0x03,  0xfe,  0x44,  0x58,  0x74,  0xfe,  0x01,  0xec,  0x97,
-  0xfe,  0x9e,  0x40,  0xfe,  0x9d,  0xe7,  0x00,  0xfe,  0x9c,  0xe7,  0x1b,  0x76,  0x27,  0x01,  0xda,  0xfe,
-  0xdd,  0x10,  0x2a,  0xbc,  0x7d,  0xbd,  0x7f,  0x30,  0x2e,  0xd5,  0x07,  0x1b,  0xfe,  0x48,  0x12,  0x07,
-  0x0b,  0xfe,  0x56,  0x12,  0x07,  0x1a,  0xfe,  0x30,  0x12,  0x07,  0xc2,  0x16,  0xfe,  0x3e,  0x11,  0x07,
-  0xfe,  0x23,  0x00,  0x16,  0xfe,  0x4a,  0x11,  0x07,  0x06,  0x16,  0xfe,  0xa8,  0x11,  0x07,  0x19,  0xfe,
-  0x12,  0x12,  0x07,  0x00,  0x16,  0x22,  0x14,  0xc2,  0x01,  0x33,  0x9f,  0x2b,  0x01,  0x08,  0x8c,  0x43,
-  0x03,  0x2b,  0xfe,  0x62,  0x08,  0x0a,  0xca,  0x01,  0xfe,  0x32,  0x0e,  0x11,  0x7e,  0x02,  0x29,  0x2b,
-  0x2f,  0x07,  0x9b,  0xfe,  0xd9,  0x13,  0x79,  0x39,  0x68,  0x3a,  0x77,  0xfe,  0xfc,  0x10,  0x09,  0x04,
-  0x6a,  0xfe,  0x72,  0x12,  0xc0,  0x38,  0xc1,  0x4e,  0xf4,  0xf5,  0x8e,  0xfe,  0xc6,  0x10,  0x1e,  0x58,
-  0xfe,  0x26,  0x13,  0x05,  0x7b,  0x31,  0x7c,  0x77,  0xfe,  0x82,  0x0c,  0x0c,  0x54,  0x18,  0x55,  0x23,
-  0x0c,  0x7b,  0x0c,  0x7c,  0x01,  0xa8,  0x24,  0x69,  0x73,  0x12,  0x58,  0x01,  0xa5,  0xc0,  0x38,  0xc1,
-  0x4e,  0xfe,  0x04,  0x55,  0xfe,  0xa5,  0x55,  0xfe,  0x04,  0xfa,  0x38,  0xfe,  0x05,  0xfa,  0x4e,  0xfe,
-  0x91,  0x10,  0x05,  0x56,  0x31,  0x57,  0xfe,  0x40,  0x56,  0xfe,  0xe1,  0x56,  0x0c,  0x56,  0x18,  0x57,
-  0x83,  0xc0,  0x38,  0xc1,  0x4e,  0xf4,  0xf5,  0x05,  0x52,  0x31,  0x53,  0xfe,  0x00,  0x56,  0xfe,  0xa1,
-  0x56,  0x0c,  0x52,  0x18,  0x53,  0x09,  0x04,  0x6a,  0xfe,  0x1e,  0x12,  0x1e,  0x58,  0xfe,  0x1f,  0x40,
-  0x05,  0x54,  0x31,  0x55,  0xfe,  0x2c,  0x50,  0xfe,  0xae,  0x50,  0x05,  0x56,  0x31,  0x57,  0xfe,  0x44,
-  0x50,  0xfe,  0xc6,  0x50,  0x05,  0x52,  0x31,  0x53,  0xfe,  0x08,  0x50,  0xfe,  0x8a,  0x50,  0x05,  0x39,
-  0x31,  0x3a,  0xfe,  0x40,  0x50,  0xfe,  0xc2,  0x50,  0x02,  0x5c,  0x24,  0x06,  0x12,  0xcd,  0x02,  0x5b,
-  0x2b,  0x01,  0x08,  0x1f,  0x44,  0x30,  0x2e,  0xd5,  0x07,  0x06,  0x21,  0x44,  0x2f,  0x07,  0x9b,  0x21,
-  0x5b,  0x01,  0x6e,  0x1c,  0x3d,  0x16,  0x44,  0x09,  0x04,  0x0b,  0xe2,  0x79,  0x39,  0x68,  0x3a,  0xfe,
-  0x0a,  0x55,  0x34,  0xfe,  0x8b,  0x55,  0xbe,  0x39,  0xbf,  0x3a,  0xfe,  0x0c,  0x51,  0xfe,  0x8e,  0x51,
-  0x02,  0x5b,  0xfe,  0x19,  0x81,  0xaf,  0xfe,  0x19,  0x41,  0x02,  0x5b,  0x2b,  0x01,  0x08,  0x25,  0x32,
-  0x1f,  0xa2,  0x30,  0x2e,  0xd8,  0x4b,  0x1a,  0xfe,  0xa6,  0x12,  0x4b,  0x0b,  0x3b,  0x02,  0x44,  0x01,
-  0x08,  0x25,  0x32,  0x1f,  0xa2,  0x30,  0x2e,  0xd6,  0x07,  0x1a,  0x21,  0x44,  0x01,  0x08,  0x1f,  0xa2,
-  0x30,  0x2e,  0xfe,  0xe8,  0x09,  0xfe,  0xc2,  0x49,  0x60,  0x05,  0xfe,  0x9c,  0x00,  0x28,  0x84,  0x49,
-  0x04,  0x19,  0x34,  0x9f,  0xfe,  0xbb,  0x45,  0x4b,  0x00,  0x45,  0x3e,  0x06,  0x78,  0x3d,  0xfe,  0xda,
-  0x14,  0x01,  0x6e,  0x87,  0xfe,  0x4b,  0x45,  0xe2,  0x2f,  0x07,  0x9a,  0xe1,  0x05,  0xc6,  0x28,  0x84,
-  0x05,  0x3f,  0x28,  0x34,  0x5e,  0x02,  0x5b,  0xfe,  0xc0,  0x5d,  0xfe,  0xf8,  0x14,  0xfe,  0x03,  0x17,
-  0x05,  0x50,  0xb4,  0x0c,  0x50,  0x5e,  0x2b,  0x01,  0x08,  0x26,  0x5c,  0x01,  0xfe,  0xaa,  0x14,  0x02,
-  0x5c,  0x01,  0x08,  0x25,  0x32,  0x1f,  0x44,  0x30,  0x2e,  0xd6,  0x07,  0x06,  0x21,  0x44,  0x01,  0xfe,
-  0x8e,  0x13,  0xfe,  0x42,  0x58,  0xfe,  0x82,  0x14,  0xfe,  0xa4,  0x14,  0x87,  0xfe,  0x4a,  0xf4,  0x0b,
-  0x16,  0x44,  0xfe,  0x4a,  0xf4,  0x06,  0xfe,  0x0c,  0x12,  0x2f,  0x07,  0x9a,  0x85,  0x02,  0x5b,  0x05,
-  0x3f,  0xb4,  0x0c,  0x3f,  0x5e,  0x2b,  0x01,  0x08,  0x26,  0x5c,  0x01,  0xfe,  0xd8,  0x14,  0x02,  0x5c,
-  0x13,  0x06,  0x65,  0xfe,  0xca,  0x12,  0x26,  0xfe,  0xe0,  0x12,  0x72,  0xf1,  0x01,  0x08,  0x23,  0x72,
-  0x03,  0x8f,  0xfe,  0xdc,  0x12,  0x25,  0xfe,  0xdc,  0x12,  0x1f,  0xfe,  0xca,  0x12,  0x5e,  0x2b,  0x01,
-  0x08,  0xfe,  0xd5,  0x10,  0x13,  0x6c,  0xff,  0x02,  0x00,  0x57,  0x48,  0x8b,  0x1c,  0xfe,  0xff,  0x7f,
-  0xfe,  0x30,  0x56,  0xfe,  0x00,  0x5c,  0x03,  0x13,  0x6c,  0xff,  0x02,  0x00,  0x57,  0x48,  0x8b,  0x1c,
-  0x3d,  0xfe,  0x30,  0x56,  0xfe,  0x00,  0x5c,  0x03,  0x13,  0x6c,  0xff,  0x02,  0x00,  0x57,  0x48,  0x8b,
-  0x03,  0x13,  0x6c,  0xff,  0x02,  0x00,  0x57,  0x48,  0x8b,  0xfe,  0x0b,  0x58,  0x03,  0x0a,  0x50,  0x01,
-  0x82,  0x0a,  0x3f,  0x01,  0x82,  0x03,  0xfc,  0x1c,  0x10,  0xff,  0x03,  0x00,  0x54,  0xfe,  0x00,  0xf4,
-  0x19,  0x48,  0xfe,  0x00,  0x7d,  0xfe,  0x01,  0x7d,  0xfe,  0x02,  0x7d,  0xfe,  0x03,  0x7c,  0x63,  0x27,
-  0x0c,  0x52,  0x18,  0x53,  0xbe,  0x56,  0xbf,  0x57,  0x03,  0xfe,  0x62,  0x08,  0xfe,  0x82,  0x4a,  0xfe,
-  0xe1,  0x1a,  0xfe,  0x83,  0x5a,  0x74,  0x03,  0x01,  0xfe,  0x14,  0x18,  0xfe,  0x42,  0x48,  0x5f,  0x60,
-  0x89,  0x01,  0x08,  0x1f,  0xfe,  0xa2,  0x14,  0x30,  0x2e,  0xd8,  0x01,  0x08,  0x1f,  0xfe,  0xa2,  0x14,
-  0x30,  0x2e,  0xfe,  0xe8,  0x0a,  0xfe,  0xc1,  0x59,  0x05,  0xc6,  0x28,  0xfe,  0xcc,  0x12,  0x49,  0x04,
-  0x1b,  0xfe,  0xc4,  0x13,  0x23,  0x62,  0x1b,  0xe2,  0x4b,  0xc3,  0x64,  0xfe,  0xe8,  0x13,  0x3b,  0x13,
-  0x06,  0x17,  0xc3,  0x78,  0xdb,  0xfe,  0x78,  0x10,  0xff,  0x02,  0x83,  0x55,  0xa1,  0xff,  0x02,  0x83,
-  0x55,  0x62,  0x1a,  0xa4,  0xbb,  0xfe,  0x30,  0x00,  0x8e,  0xe4,  0x17,  0x2c,  0x13,  0x06,  0xfe,  0x56,
-  0x10,  0x62,  0x0b,  0xe1,  0xbb,  0xfe,  0x64,  0x00,  0x8e,  0xe4,  0x0a,  0xfe,  0x64,  0x00,  0x17,  0x93,
-  0x13,  0x06,  0xfe,  0x28,  0x10,  0x62,  0x06,  0xfe,  0x60,  0x13,  0xbb,  0xfe,  0xc8,  0x00,  0x8e,  0xe4,
-  0x0a,  0xfe,  0xc8,  0x00,  0x17,  0x4d,  0x13,  0x06,  0x83,  0xbb,  0xfe,  0x90,  0x01,  0xba,  0xfe,  0x4e,
-  0x14,  0x89,  0xfe,  0x12,  0x10,  0xfe,  0x43,  0xf4,  0x94,  0xfe,  0x56,  0xf0,  0xfe,  0x60,  0x14,  0xfe,
-  0x04,  0xf4,  0x6c,  0xfe,  0x43,  0xf4,  0x93,  0xfe,  0xf3,  0x10,  0xf9,  0x01,  0xfe,  0x22,  0x13,  0x1c,
-  0x3d,  0xfe,  0x10,  0x13,  0xfe,  0x00,  0x17,  0xfe,  0x4d,  0xe4,  0x69,  0xba,  0xfe,  0x9c,  0x14,  0xb7,
-  0x69,  0xfe,  0x1c,  0x10,  0xfe,  0x00,  0x17,  0xfe,  0x4d,  0xe4,  0x19,  0xba,  0xfe,  0x9c,  0x14,  0xb7,
-  0x19,  0x83,  0x60,  0x23,  0xfe,  0x4d,  0xf4,  0x00,  0xdf,  0x89,  0x13,  0x06,  0xfe,  0xb4,  0x56,  0xfe,
-  0xc3,  0x58,  0x03,  0x60,  0x13,  0x0b,  0x03,  0x15,  0x06,  0x01,  0x08,  0x26,  0xe5,  0x15,  0x0b,  0x01,
-  0x08,  0x26,  0xe5,  0x15,  0x1a,  0x01,  0x08,  0x26,  0xe5,  0x72,  0xfe,  0x89,  0x49,  0x01,  0x08,  0x03,
-  0x15,  0x06,  0x01,  0x08,  0x26,  0xa6,  0x15,  0x1a,  0x01,  0x08,  0x26,  0xa6,  0x15,  0x06,  0x01,  0x08,
-  0x26,  0xa6,  0xfe,  0x89,  0x49,  0x01,  0x08,  0x26,  0xa6,  0x72,  0xfe,  0x89,  0x4a,  0x01,  0x08,  0x03,
-  0x60,  0x03,  0x1e,  0xcc,  0x07,  0x06,  0xfe,  0x44,  0x13,  0xad,  0x12,  0xcc,  0xfe,  0x49,  0xf4,  0x00,
-  0x3b,  0x72,  0x9f,  0x5e,  0xfe,  0x01,  0xec,  0xfe,  0x27,  0x01,  0xf1,  0x01,  0x08,  0x2f,  0x07,  0xfe,
-  0xe3,  0x00,  0xfe,  0x20,  0x13,  0x1f,  0xfe,  0x5a,  0x15,  0x23,  0x12,  0xcd,  0x01,  0x43,  0x1e,  0xcd,
-  0x07,  0x06,  0x45,  0x09,  0x4a,  0x06,  0x35,  0x03,  0x0a,  0x42,  0x01,  0x0e,  0xed,  0x88,  0x07,  0x10,
-  0xa4,  0x0a,  0x80,  0x01,  0x0e,  0x88,  0x0a,  0x51,  0x01,  0x9e,  0x03,  0x0a,  0x80,  0x01,  0x0e,  0x88,
-  0xfe,  0x80,  0xe7,  0x10,  0x07,  0x10,  0x84,  0xfe,  0x45,  0x58,  0x01,  0xe3,  0x88,  0x03,  0x0a,  0x42,
-  0x01,  0x0e,  0x88,  0x0a,  0x51,  0x01,  0x9e,  0x03,  0x0a,  0x42,  0x01,  0x0e,  0xfe,  0x80,  0x80,  0xf2,
-  0xfe,  0x49,  0xe4,  0x10,  0xa4,  0x0a,  0x80,  0x01,  0x0e,  0xf2,  0x0a,  0x51,  0x01,  0x82,  0x03,  0x17,
-  0x10,  0x71,  0x66,  0xfe,  0x60,  0x01,  0xfe,  0x18,  0xdf,  0xfe,  0x19,  0xde,  0xfe,  0x24,  0x1c,  0xfe,
-  0x1d,  0xf7,  0x1d,  0x90,  0xfe,  0xf6,  0x15,  0x01,  0xfe,  0xfc,  0x16,  0xe0,  0x91,  0x1d,  0x66,  0xfe,
-  0x2c,  0x01,  0xfe,  0x2f,  0x19,  0x03,  0xae,  0x21,  0xfe,  0xe6,  0x15,  0xfe,  0xda,  0x10,  0x17,  0x10,
-  0x71,  0x05,  0xfe,  0x64,  0x01,  0xfe,  0x00,  0xf4,  0x19,  0xfe,  0x18,  0x58,  0x05,  0xfe,  0x66,  0x01,
-  0xfe,  0x19,  0x58,  0x91,  0x19,  0xfe,  0x3c,  0x90,  0xfe,  0x30,  0xf4,  0x06,  0xfe,  0x3c,  0x50,  0x66,
-  0xfe,  0x38,  0x00,  0xfe,  0x0f,  0x79,  0xfe,  0x1c,  0xf7,  0x19,  0x90,  0xfe,  0x40,  0x16,  0xfe,  0xb6,
-  0x14,  0x34,  0x03,  0xae,  0x21,  0xfe,  0x18,  0x16,  0xfe,  0x9c,  0x10,  0x17,  0x10,  0x71,  0xfe,  0x83,
-  0x5a,  0xfe,  0x18,  0xdf,  0xfe,  0x19,  0xde,  0xfe,  0x1d,  0xf7,  0x38,  0x90,  0xfe,  0x62,  0x16,  0xfe,
-  0x94,  0x14,  0xfe,  0x10,  0x13,  0x91,  0x38,  0x66,  0x1b,  0xfe,  0xaf,  0x19,  0xfe,  0x98,  0xe7,  0x00,
-  0x03,  0xae,  0x21,  0xfe,  0x56,  0x16,  0xfe,  0x6c,  0x10,  0x17,  0x10,  0x71,  0xfe,  0x30,  0xbc,  0xfe,
-  0xb2,  0xbc,  0x91,  0xc5,  0x66,  0x1b,  0xfe,  0x0f,  0x79,  0xfe,  0x1c,  0xf7,  0xc5,  0x90,  0xfe,  0x9a,
-  0x16,  0xfe,  0x5c,  0x14,  0x34,  0x03,  0xae,  0x21,  0xfe,  0x86,  0x16,  0xfe,  0x42,  0x10,  0xfe,  0x02,
-  0xf6,  0x10,  0x71,  0xfe,  0x18,  0xfe,  0x54,  0xfe,  0x19,  0xfe,  0x55,  0xfc,  0xfe,  0x1d,  0xf7,  0x4f,
-  0x90,  0xfe,  0xc0,  0x16,  0xfe,  0x36,  0x14,  0xfe,  0x1c,  0x13,  0x91,  0x4f,  0x47,  0xfe,  0x83,  0x58,
-  0xfe,  0xaf,  0x19,  0xfe,  0x80,  0xe7,  0x10,  0xfe,  0x81,  0xe7,  0x10,  0x11,  0xfe,  0xdd,  0x00,  0x63,
-  0x27,  0x03,  0x63,  0x27,  0xfe,  0x12,  0x45,  0x21,  0xfe,  0xb0,  0x16,  0x14,  0x06,  0x37,  0x95,  0xa9,
-  0x02,  0x29,  0xfe,  0x39,  0xf0,  0xfe,  0x04,  0x17,  0x23,  0x03,  0xfe,  0x7e,  0x18,  0x1c,  0x1a,  0x5d,
-  0x13,  0x0d,  0x03,  0x71,  0x05,  0xcb,  0x1c,  0x06,  0xfe,  0xef,  0x12,  0xfe,  0xe1,  0x10,  0x78,  0x2c,
-  0x46,  0x2f,  0x07,  0x2d,  0xfe,  0x3c,  0x13,  0xfe,  0x82,  0x14,  0xfe,  0x42,  0x13,  0x3c,  0x8a,  0x0a,
-  0x42,  0x01,  0x0e,  0xb0,  0xfe,  0x3e,  0x12,  0xf0,  0xfe,  0x45,  0x48,  0x01,  0xe3,  0xfe,  0x00,  0xcc,
-  0xb0,  0xfe,  0xf3,  0x13,  0x3d,  0x75,  0x07,  0x10,  0xa3,  0x0a,  0x80,  0x01,  0x0e,  0xf2,  0x01,  0x6f,
-  0xfe,  0x16,  0x10,  0x07,  0x7e,  0x85,  0xfe,  0x40,  0x14,  0xfe,  0x24,  0x12,  0xf6,  0xfe,  0xd6,  0xf0,
-  0xfe,  0x24,  0x17,  0x17,  0x0b,  0x03,  0xfe,  0x9c,  0xe7,  0x0b,  0x0f,  0xfe,  0x15,  0x00,  0x59,  0x76,
-  0x27,  0x01,  0xda,  0x17,  0x06,  0x03,  0x3c,  0x8a,  0x09,  0x4a,  0x1d,  0x35,  0x11,  0x2d,  0x01,  0x6f,
-  0x17,  0x06,  0x03,  0xfe,  0x38,  0x90,  0xfe,  0xba,  0x90,  0x79,  0xc7,  0x68,  0xc8,  0xfe,  0x48,  0x55,
-  0x34,  0xfe,  0xc9,  0x55,  0x03,  0x1e,  0x98,  0x73,  0x12,  0x98,  0x03,  0x0a,  0x99,  0x01,  0x0e,  0xf0,
-  0x0a,  0x40,  0x01,  0x0e,  0xfe,  0x49,  0x44,  0x16,  0xfe,  0xf0,  0x17,  0x73,  0x75,  0x03,  0x0a,  0x42,
-  0x01,  0x0e,  0x07,  0x10,  0x45,  0x0a,  0x51,  0x01,  0x9e,  0x0a,  0x40,  0x01,  0x0e,  0x73,  0x75,  0x03,
-  0xfe,  0x4e,  0xe4,  0x1a,  0x64,  0xfe,  0x24,  0x18,  0x05,  0xfe,  0x90,  0x00,  0xfe,  0x3a,  0x45,  0x5b,
-  0xfe,  0x4e,  0xe4,  0xc2,  0x64,  0xfe,  0x36,  0x18,  0x05,  0xfe,  0x92,  0x00,  0xfe,  0x02,  0xe6,  0x1b,
-  0xdc,  0xfe,  0x4e,  0xe4,  0xfe,  0x0b,  0x00,  0x64,  0xfe,  0x48,  0x18,  0x05,  0xfe,  0x94,  0x00,  0xfe,
-  0x02,  0xe6,  0x19,  0xfe,  0x08,  0x10,  0x05,  0xfe,  0x96,  0x00,  0xfe,  0x02,  0xe6,  0x2c,  0xfe,  0x4e,
-  0x45,  0xfe,  0x0c,  0x12,  0xaf,  0xff,  0x04,  0x68,  0x54,  0xde,  0x1c,  0x69,  0x03,  0x07,  0x7a,  0xfe,
-  0x5a,  0xf0,  0xfe,  0x74,  0x18,  0x24,  0xfe,  0x09,  0x00,  0xfe,  0x34,  0x10,  0x07,  0x1b,  0xfe,  0x5a,
-  0xf0,  0xfe,  0x82,  0x18,  0x24,  0xc3,  0xfe,  0x26,  0x10,  0x07,  0x1a,  0x5d,  0x24,  0x2c,  0xdc,  0x07,
-  0x0b,  0x5d,  0x24,  0x93,  0xfe,  0x0e,  0x10,  0x07,  0x06,  0x5d,  0x24,  0x4d,  0x9f,  0xad,  0x03,  0x14,
-  0xfe,  0x09,  0x00,  0x01,  0x33,  0xfe,  0x04,  0xfe,  0x7d,  0x05,  0x7f,  0xf9,  0x03,  0x25,  0xfe,  0xca,
-  0x18,  0xfe,  0x14,  0xf0,  0x08,  0x65,  0xfe,  0xc6,  0x18,  0x03,  0xff,  0x1a,  0x00,  0x00,
+static unsigned char _adv_asc3550_buf[] = {
+       0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0x16, 0x18, 0xe4, 0x00, 0xfc,
+       0x01, 0x00, 0x48, 0xe4,
+       0xbe, 0x18, 0x18, 0x80, 0x03, 0xf6, 0x02, 0x00, 0x00, 0xfa, 0xff, 0xff,
+       0x28, 0x0e, 0x9e, 0xe7,
+       0xff, 0x00, 0x82, 0xe7, 0x00, 0xea, 0x00, 0xf6, 0x01, 0xe6, 0x09, 0xe7,
+       0x55, 0xf0, 0x01, 0xf6,
+       0x01, 0xfa, 0x08, 0x00, 0x03, 0x00, 0x04, 0x00, 0x18, 0xf4, 0x10, 0x00,
+       0x00, 0xec, 0x85, 0xf0,
+       0xbc, 0x00, 0xd5, 0xf0, 0x8e, 0x0c, 0x38, 0x54, 0x00, 0xe6, 0x1e, 0xf0,
+       0x86, 0xf0, 0xb4, 0x00,
+       0x98, 0x57, 0xd0, 0x01, 0x0c, 0x1c, 0x3e, 0x1c, 0x0c, 0x00, 0xbb, 0x00,
+       0xaa, 0x18, 0x02, 0x80,
+       0x32, 0xf0, 0x01, 0xfc, 0x88, 0x0c, 0xc6, 0x12, 0x02, 0x13, 0x18, 0x40,
+       0x00, 0x57, 0x01, 0xea,
+       0x3c, 0x00, 0x6c, 0x01, 0x6e, 0x01, 0x04, 0x12, 0x3e, 0x57, 0x00, 0x80,
+       0x03, 0xe6, 0xb6, 0x00,
+       0xc0, 0x00, 0x01, 0x01, 0x3e, 0x01, 0xda, 0x0f, 0x22, 0x10, 0x08, 0x12,
+       0x02, 0x4a, 0xb9, 0x54,
+       0x03, 0x58, 0x1b, 0x80, 0x30, 0xe4, 0x4b, 0xe4, 0x20, 0x00, 0x32, 0x00,
+       0x3e, 0x00, 0x80, 0x00,
+       0x24, 0x01, 0x3c, 0x01, 0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01,
+       0x74, 0x01, 0x76, 0x01,
+       0x78, 0x01, 0x62, 0x0a, 0x92, 0x0c, 0x2c, 0x10, 0x2e, 0x10, 0x06, 0x13,
+       0x4c, 0x1c, 0xbb, 0x55,
+       0x3c, 0x56, 0x04, 0x80, 0x4a, 0xe4, 0x02, 0xee, 0x5b, 0xf0, 0xb1, 0xf0,
+       0x03, 0xf7, 0x06, 0xf7,
+       0x03, 0xfc, 0x0f, 0x00, 0x40, 0x00, 0xbe, 0x00, 0x00, 0x01, 0xb0, 0x08,
+       0x30, 0x13, 0x64, 0x15,
+       0x32, 0x1c, 0x38, 0x1c, 0x4e, 0x1c, 0x10, 0x44, 0x02, 0x48, 0x00, 0x4c,
+       0x04, 0xea, 0x5d, 0xf0,
+       0x04, 0xf6, 0x02, 0xfc, 0x05, 0x00, 0x34, 0x00, 0x36, 0x00, 0x98, 0x00,
+       0xcc, 0x00, 0x20, 0x01,
+       0x4e, 0x01, 0x4e, 0x0b, 0x1e, 0x0e, 0x0c, 0x10, 0x0a, 0x12, 0x04, 0x13,
+       0x40, 0x13, 0x30, 0x1c,
+       0x00, 0x4e, 0xbd, 0x56, 0x06, 0x83, 0x00, 0xdc, 0x05, 0xf0, 0x09, 0xf0,
+       0x59, 0xf0, 0xa7, 0xf0,
+       0xb8, 0xf0, 0x0e, 0xf7, 0x06, 0x00, 0x19, 0x00, 0x33, 0x00, 0x9b, 0x00,
+       0xa4, 0x00, 0xb5, 0x00,
+       0xba, 0x00, 0xd0, 0x00, 0xe1, 0x00, 0xe7, 0x00, 0xde, 0x03, 0x56, 0x0a,
+       0x14, 0x0e, 0x02, 0x10,
+       0x04, 0x10, 0x0a, 0x10, 0x36, 0x10, 0x0a, 0x13, 0x12, 0x13, 0x52, 0x13,
+       0x10, 0x15, 0x14, 0x15,
+       0xac, 0x16, 0x20, 0x1c, 0x34, 0x1c, 0x36, 0x1c, 0x08, 0x44, 0x38, 0x44,
+       0x91, 0x44, 0x0a, 0x45,
+       0x48, 0x46, 0x01, 0x48, 0x68, 0x54, 0x83, 0x55, 0xb0, 0x57, 0x01, 0x58,
+       0x83, 0x59, 0x05, 0xe6,
+       0x0b, 0xf0, 0x0c, 0xf0, 0x5c, 0xf0, 0x4b, 0xf4, 0x04, 0xf8, 0x05, 0xf8,
+       0x02, 0xfa, 0x03, 0xfa,
+       0x04, 0xfc, 0x05, 0xfc, 0x07, 0x00, 0x0a, 0x00, 0x0d, 0x00, 0x1c, 0x00,
+       0x9e, 0x00, 0xa8, 0x00,
+       0xaa, 0x00, 0xb9, 0x00, 0xe0, 0x00, 0x22, 0x01, 0x26, 0x01, 0x79, 0x01,
+       0x7a, 0x01, 0xc0, 0x01,
+       0xc2, 0x01, 0x7c, 0x02, 0x5a, 0x03, 0xea, 0x04, 0xe8, 0x07, 0x68, 0x08,
+       0x69, 0x08, 0xba, 0x08,
+       0xe9, 0x09, 0x06, 0x0b, 0x3a, 0x0e, 0x00, 0x10, 0x1a, 0x10, 0xed, 0x10,
+       0xf1, 0x10, 0x06, 0x12,
+       0x0c, 0x13, 0x16, 0x13, 0x1e, 0x13, 0x82, 0x13, 0x42, 0x14, 0xd6, 0x14,
+       0x8a, 0x15, 0xc6, 0x17,
+       0xd2, 0x17, 0x6b, 0x18, 0x12, 0x1c, 0x46, 0x1c, 0x9c, 0x32, 0x00, 0x40,
+       0x0e, 0x47, 0x48, 0x47,
+       0x41, 0x48, 0x89, 0x48, 0x80, 0x4c, 0x00, 0x54, 0x44, 0x55, 0xe5, 0x55,
+       0x14, 0x56, 0x77, 0x57,
+       0xbf, 0x57, 0x40, 0x5c, 0x06, 0x80, 0x08, 0x90, 0x03, 0xa1, 0xfe, 0x9c,
+       0xf0, 0x29, 0x02, 0xfe,
+       0xb8, 0x0c, 0xff, 0x10, 0x00, 0x00, 0xd0, 0xfe, 0xcc, 0x18, 0x00, 0xcf,
+       0xfe, 0x80, 0x01, 0xff,
+       0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00,
+       0x00, 0xfe, 0x57, 0x24,
+       0x00, 0xfe, 0x48, 0x00, 0x4f, 0xff, 0x04, 0x00, 0x00, 0x10, 0xff, 0x09,
+       0x00, 0x00, 0xff, 0x08,
+       0x01, 0x01, 0xff, 0x08, 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10,
+       0xff, 0xff, 0xff, 0x0f,
+       0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00,
+       0xfe, 0x04, 0xf7, 0xcf,
+       0x2a, 0x67, 0x0b, 0x01, 0xfe, 0xce, 0x0e, 0xfe, 0x04, 0xf7, 0xcf, 0x67,
+       0x0b, 0x3c, 0x2a, 0xfe,
+       0x3d, 0xf0, 0xfe, 0x02, 0x02, 0xfe, 0x20, 0xf0, 0x9c, 0xfe, 0x91, 0xf0,
+       0xfe, 0xf0, 0x01, 0xfe,
+       0x90, 0xf0, 0xfe, 0xf0, 0x01, 0xfe, 0x8f, 0xf0, 0x9c, 0x05, 0x51, 0x3b,
+       0x02, 0xfe, 0xd4, 0x0c,
+       0x01, 0xfe, 0x44, 0x0d, 0xfe, 0xdd, 0x12, 0xfe, 0xfc, 0x10, 0xfe, 0x28,
+       0x1c, 0x05, 0xfe, 0xa6,
+       0x00, 0xfe, 0xd3, 0x12, 0x47, 0x18, 0xfe, 0xa6, 0x00, 0xb5, 0xfe, 0x48,
+       0xf0, 0xfe, 0x86, 0x02,
+       0xfe, 0x49, 0xf0, 0xfe, 0xa0, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xbe, 0x02,
+       0xfe, 0x46, 0xf0, 0xfe,
+       0x50, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x56, 0x02, 0xfe, 0x43, 0xf0, 0xfe,
+       0x44, 0x02, 0xfe, 0x44,
+       0xf0, 0xfe, 0x48, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x4c, 0x02, 0x17, 0x0b,
+       0xa0, 0x17, 0x06, 0x18,
+       0x96, 0x02, 0x29, 0xfe, 0x00, 0x1c, 0xde, 0xfe, 0x02, 0x1c, 0xdd, 0xfe,
+       0x1e, 0x1c, 0xfe, 0xe9,
+       0x10, 0x01, 0xfe, 0x20, 0x17, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc, 0xc7,
+       0x0a, 0x6b, 0x01, 0x9e,
+       0x02, 0x29, 0x14, 0x4d, 0x37, 0x97, 0x01, 0xfe, 0x64, 0x0f, 0x0a, 0x6b,
+       0x01, 0x82, 0xfe, 0xbd,
+       0x10, 0x0a, 0x6b, 0x01, 0x82, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe,
+       0x58, 0x1c, 0x17, 0x06,
+       0x18, 0x96, 0x2a, 0x25, 0x29, 0xfe, 0x3d, 0xf0, 0xfe, 0x02, 0x02, 0x21,
+       0xfe, 0x94, 0x02, 0xfe,
+       0x5a, 0x1c, 0xea, 0xfe, 0x14, 0x1c, 0x14, 0xfe, 0x30, 0x00, 0x37, 0x97,
+       0x01, 0xfe, 0x54, 0x0f,
+       0x17, 0x06, 0x18, 0x96, 0x02, 0xd0, 0x1e, 0x20, 0x07, 0x10, 0x34, 0xfe,
+       0x69, 0x10, 0x17, 0x06,
+       0x18, 0x96, 0xfe, 0x04, 0xec, 0x20, 0x46, 0x3d, 0x12, 0x20, 0xfe, 0x05,
+       0xf6, 0xc7, 0x01, 0xfe,
+       0x52, 0x16, 0x09, 0x4a, 0x4c, 0x35, 0x11, 0x2d, 0x3c, 0x8a, 0x01, 0xe6,
+       0x02, 0x29, 0x0a, 0x40,
+       0x01, 0x0e, 0x07, 0x00, 0x5d, 0x01, 0x6f, 0xfe, 0x18, 0x10, 0xfe, 0x41,
+       0x58, 0x0a, 0x99, 0x01,
+       0x0e, 0xfe, 0xc8, 0x54, 0x64, 0xfe, 0x0c, 0x03, 0x01, 0xe6, 0x02, 0x29,
+       0x2a, 0x46, 0xfe, 0x02,
+       0xe8, 0x27, 0xf8, 0xfe, 0x9e, 0x43, 0xf7, 0xfe, 0x27, 0xf0, 0xfe, 0xdc,
+       0x01, 0xfe, 0x07, 0x4b,
+       0xfe, 0x20, 0xf0, 0x9c, 0xfe, 0x40, 0x1c, 0x25, 0xd2, 0xfe, 0x26, 0xf0,
+       0xfe, 0x56, 0x03, 0xfe,
+       0xa0, 0xf0, 0xfe, 0x44, 0x03, 0xfe, 0x11, 0xf0, 0x9c, 0xfe, 0xef, 0x10,
+       0xfe, 0x9f, 0xf0, 0xfe,
+       0x64, 0x03, 0xeb, 0x0f, 0xfe, 0x11, 0x00, 0x02, 0x5a, 0x2a, 0xfe, 0x48,
+       0x1c, 0xeb, 0x09, 0x04,
+       0x1d, 0xfe, 0x18, 0x13, 0x23, 0x1e, 0x98, 0xac, 0x12, 0x98, 0x0a, 0x40,
+       0x01, 0x0e, 0xac, 0x75,
+       0x01, 0xfe, 0xbc, 0x15, 0x11, 0xca, 0x25, 0xd2, 0xfe, 0x01, 0xf0, 0xd2,
+       0xfe, 0x82, 0xf0, 0xfe,
+       0x92, 0x03, 0xec, 0x11, 0xfe, 0xe4, 0x00, 0x65, 0xfe, 0xa4, 0x03, 0x25,
+       0x32, 0x1f, 0xfe, 0xb4,
+       0x03, 0x01, 0x43, 0xfe, 0x06, 0xf0, 0xfe, 0xc4, 0x03, 0x8d, 0x81, 0xfe,
+       0x0a, 0xf0, 0xfe, 0x7a,
+       0x06, 0x02, 0x22, 0x05, 0x6b, 0x28, 0x16, 0xfe, 0xf6, 0x04, 0x14, 0x2c,
+       0x01, 0x33, 0x8f, 0xfe,
+       0x66, 0x02, 0x02, 0xd1, 0xeb, 0x2a, 0x67, 0x1a, 0xfe, 0x67, 0x1b, 0xf8,
+       0xf7, 0xfe, 0x48, 0x1c,
+       0x70, 0x01, 0x6e, 0x87, 0x0a, 0x40, 0x01, 0x0e, 0x07, 0x00, 0x16, 0xd3,
+       0x0a, 0xca, 0x01, 0x0e,
+       0x74, 0x60, 0x59, 0x76, 0x27, 0x05, 0x6b, 0x28, 0xfe, 0x10, 0x12, 0x14,
+       0x2c, 0x01, 0x33, 0x8f,
+       0xfe, 0x66, 0x02, 0x02, 0xd1, 0xbc, 0x7d, 0xbd, 0x7f, 0x25, 0x22, 0x65,
+       0xfe, 0x3c, 0x04, 0x1f,
+       0xfe, 0x38, 0x04, 0x68, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x4e,
+       0x12, 0x2b, 0xff, 0x02,
+       0x00, 0x10, 0x01, 0x08, 0x1f, 0xfe, 0xe0, 0x04, 0x2b, 0x01, 0x08, 0x1f,
+       0x22, 0x30, 0x2e, 0xd5,
+       0xfe, 0x4c, 0x44, 0xfe, 0x4c, 0x12, 0x60, 0xfe, 0x44, 0x48, 0x13, 0x2c,
+       0xfe, 0x4c, 0x54, 0x64,
+       0xd3, 0x46, 0x76, 0x27, 0xfa, 0xef, 0xfe, 0x62, 0x13, 0x09, 0x04, 0x1d,
+       0xfe, 0x2a, 0x13, 0x2f,
+       0x07, 0x7e, 0xa5, 0xfe, 0x20, 0x10, 0x13, 0x2c, 0xfe, 0x4c, 0x54, 0x64,
+       0xd3, 0xfa, 0xef, 0x86,
+       0x09, 0x04, 0x1d, 0xfe, 0x08, 0x13, 0x2f, 0x07, 0x7e, 0x6e, 0x09, 0x04,
+       0x1d, 0xfe, 0x1c, 0x12,
+       0x14, 0x92, 0x09, 0x04, 0x06, 0x3b, 0x14, 0xc4, 0x01, 0x33, 0x8f, 0xfe,
+       0x70, 0x0c, 0x02, 0x22,
+       0x2b, 0x11, 0xfe, 0xe6, 0x00, 0xfe, 0x1c, 0x90, 0xf9, 0x03, 0x14, 0x92,
+       0x01, 0x33, 0x02, 0x29,
+       0xfe, 0x42, 0x5b, 0x67, 0x1a, 0xfe, 0x46, 0x59, 0xf8, 0xf7, 0xfe, 0x87,
+       0x80, 0xfe, 0x31, 0xe4,
+       0x4f, 0x09, 0x04, 0x0b, 0xfe, 0x78, 0x13, 0xfe, 0x20, 0x80, 0x07, 0x1a,
+       0xfe, 0x70, 0x12, 0x49,
+       0x04, 0x06, 0xfe, 0x60, 0x13, 0x05, 0xfe, 0xa2, 0x00, 0x28, 0x16, 0xfe,
+       0x80, 0x05, 0xfe, 0x31,
+       0xe4, 0x6a, 0x49, 0x04, 0x0b, 0xfe, 0x4a, 0x13, 0x05, 0xfe, 0xa0, 0x00,
+       0x28, 0xfe, 0x42, 0x12,
+       0x5e, 0x01, 0x08, 0x25, 0x32, 0xf1, 0x01, 0x08, 0x26, 0xfe, 0x98, 0x05,
+       0x11, 0xfe, 0xe3, 0x00,
+       0x23, 0x49, 0xfe, 0x4a, 0xf0, 0xfe, 0x6a, 0x05, 0xfe, 0x49, 0xf0, 0xfe,
+       0x64, 0x05, 0x83, 0x24,
+       0xfe, 0x21, 0x00, 0xa1, 0x24, 0xfe, 0x22, 0x00, 0xa0, 0x24, 0x4c, 0xfe,
+       0x09, 0x48, 0x01, 0x08,
+       0x26, 0xfe, 0x98, 0x05, 0xfe, 0xe2, 0x08, 0x49, 0x04, 0xc5, 0x3b, 0x01,
+       0x86, 0x24, 0x06, 0x12,
+       0xcc, 0x37, 0xfe, 0x27, 0x01, 0x09, 0x04, 0x1d, 0xfe, 0x22, 0x12, 0x47,
+       0x01, 0xa7, 0x14, 0x92,
+       0x09, 0x04, 0x06, 0x3b, 0x14, 0xc4, 0x01, 0x33, 0x8f, 0xfe, 0x70, 0x0c,
+       0x02, 0x22, 0x05, 0xfe,
+       0x9c, 0x00, 0x28, 0xfe, 0x3e, 0x12, 0x05, 0x50, 0x28, 0xfe, 0x36, 0x13,
+       0x47, 0x01, 0xa7, 0x26,
+       0xfe, 0x08, 0x06, 0x0a, 0x06, 0x49, 0x04, 0x19, 0xfe, 0x02, 0x12, 0x5f,
+       0x01, 0xfe, 0xaa, 0x14,
+       0x1f, 0xfe, 0xfe, 0x05, 0x11, 0x9a, 0x01, 0x43, 0x11, 0xfe, 0xe5, 0x00,
+       0x05, 0x50, 0xb4, 0x0c,
+       0x50, 0x05, 0xc6, 0x28, 0xfe, 0x62, 0x12, 0x05, 0x3f, 0x28, 0xfe, 0x5a,
+       0x13, 0x01, 0xfe, 0x14,
+       0x18, 0x01, 0xfe, 0x66, 0x18, 0xfe, 0x43, 0x48, 0xb7, 0x19, 0x13, 0x6c,
+       0xff, 0x02, 0x00, 0x57,
+       0x48, 0x8b, 0x1c, 0x3d, 0x85, 0xb7, 0x69, 0x47, 0x01, 0xa7, 0x26, 0xfe,
+       0x72, 0x06, 0x49, 0x04,
+       0x1b, 0xdf, 0x89, 0x0a, 0x4d, 0x01, 0xfe, 0xd8, 0x14, 0x1f, 0xfe, 0x68,
+       0x06, 0x11, 0x9a, 0x01,
+       0x43, 0x11, 0xfe, 0xe5, 0x00, 0x05, 0x3f, 0xb4, 0x0c, 0x3f, 0x17, 0x06,
+       0x01, 0xa7, 0xec, 0x72,
+       0x70, 0x01, 0x6e, 0x87, 0x11, 0xfe, 0xe2, 0x00, 0x01, 0x08, 0x25, 0x32,
+       0xfe, 0x0a, 0xf0, 0xfe,
+       0xa6, 0x06, 0x8c, 0xfe, 0x5c, 0x07, 0xfe, 0x06, 0xf0, 0xfe, 0x64, 0x07,
+       0x8d, 0x81, 0x02, 0x22,
+       0x09, 0x04, 0x0b, 0xfe, 0x2e, 0x12, 0x15, 0x1a, 0x01, 0x08, 0x15, 0x00,
+       0x01, 0x08, 0x15, 0x00,
+       0x01, 0x08, 0x15, 0x00, 0x01, 0x08, 0xfe, 0x99, 0xa4, 0x01, 0x08, 0x15,
+       0x00, 0x02, 0xfe, 0x32,
+       0x08, 0x61, 0x04, 0x1b, 0xfe, 0x38, 0x12, 0x09, 0x04, 0x1b, 0x6e, 0x15,
+       0xfe, 0x1b, 0x00, 0x01,
+       0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x00, 0x01, 0x08, 0x15, 0x00, 0x01,
+       0x08, 0x15, 0x06, 0x01,
+       0x08, 0x15, 0x00, 0x02, 0xd9, 0x66, 0x4c, 0xfe, 0x3a, 0x55, 0x5f, 0xfe,
+       0x9a, 0x81, 0x4b, 0x1d,
+       0xba, 0xfe, 0x32, 0x07, 0x0a, 0x1d, 0xfe, 0x09, 0x6f, 0xaf, 0xfe, 0xca,
+       0x45, 0xfe, 0x32, 0x12,
+       0x62, 0x2c, 0x85, 0x66, 0x7b, 0x01, 0x08, 0x25, 0x32, 0xfe, 0x0a, 0xf0,
+       0xfe, 0x32, 0x07, 0x8d,
+       0x81, 0x8c, 0xfe, 0x5c, 0x07, 0x02, 0x22, 0x01, 0x43, 0x02, 0xfe, 0x8a,
+       0x06, 0x15, 0x19, 0x02,
+       0xfe, 0x8a, 0x06, 0xfe, 0x9c, 0xf7, 0xd4, 0xfe, 0x2c, 0x90, 0xfe, 0xae,
+       0x90, 0x77, 0xfe, 0xca,
+       0x07, 0x0c, 0x54, 0x18, 0x55, 0x09, 0x4a, 0x6a, 0x35, 0x1e, 0x20, 0x07,
+       0x10, 0xfe, 0x0e, 0x12,
+       0x74, 0xfe, 0x80, 0x80, 0x37, 0x20, 0x63, 0x27, 0xfe, 0x06, 0x10, 0xfe,
+       0x83, 0xe7, 0xc4, 0xa1,
+       0xfe, 0x03, 0x40, 0x09, 0x4a, 0x4f, 0x35, 0x01, 0xa8, 0xad, 0xfe, 0x1f,
+       0x40, 0x12, 0x58, 0x01,
+       0xa5, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0xfe, 0x44, 0x51, 0xfe, 0xc6,
+       0x51, 0x83, 0xfb, 0xfe,
+       0x8a, 0x90, 0x0c, 0x52, 0x18, 0x53, 0xfe, 0x0c, 0x90, 0xfe, 0x8e, 0x90,
+       0xfe, 0x40, 0x50, 0xfe,
+       0xc2, 0x50, 0x0c, 0x39, 0x18, 0x3a, 0xfe, 0x4a, 0x10, 0x09, 0x04, 0x6a,
+       0xfe, 0x2a, 0x12, 0xfe,
+       0x2c, 0x90, 0xfe, 0xae, 0x90, 0x0c, 0x54, 0x18, 0x55, 0x09, 0x04, 0x4f,
+       0x85, 0x01, 0xa8, 0xfe,
+       0x1f, 0x80, 0x12, 0x58, 0xfe, 0x44, 0x90, 0xfe, 0xc6, 0x90, 0x0c, 0x56,
+       0x18, 0x57, 0xfb, 0xfe,
+       0x8a, 0x90, 0x0c, 0x52, 0x18, 0x53, 0xfe, 0x40, 0x90, 0xfe, 0xc2, 0x90,
+       0x0c, 0x39, 0x18, 0x3a,
+       0x0c, 0x38, 0x18, 0x4e, 0x09, 0x4a, 0x19, 0x35, 0x2a, 0x13, 0xfe, 0x4e,
+       0x11, 0x65, 0xfe, 0x48,
+       0x08, 0xfe, 0x9e, 0xf0, 0xfe, 0x5c, 0x08, 0xb1, 0x16, 0x32, 0x2a, 0x73,
+       0xdd, 0xb8, 0xfe, 0x80,
+       0x08, 0xb9, 0xfe, 0x9e, 0x08, 0x8c, 0xfe, 0x74, 0x08, 0xfe, 0x06, 0xf0,
+       0xfe, 0x7a, 0x08, 0x8d,
+       0x81, 0x02, 0x22, 0x01, 0x43, 0xfe, 0xc9, 0x10, 0x15, 0x19, 0xfe, 0xc9,
+       0x10, 0x61, 0x04, 0x06,
+       0xfe, 0x10, 0x12, 0x61, 0x04, 0x0b, 0x45, 0x09, 0x04, 0x0b, 0xfe, 0x68,
+       0x12, 0xfe, 0x2e, 0x1c,
+       0x02, 0xfe, 0x24, 0x0a, 0x61, 0x04, 0x06, 0x45, 0x61, 0x04, 0x0b, 0xfe,
+       0x52, 0x12, 0xfe, 0x2c,
+       0x1c, 0xfe, 0xaa, 0xf0, 0xfe, 0x1e, 0x09, 0xfe, 0xac, 0xf0, 0xfe, 0xbe,
+       0x08, 0xfe, 0x8a, 0x10,
+       0xaa, 0xfe, 0xf3, 0x10, 0xfe, 0xad, 0xf0, 0xfe, 0xca, 0x08, 0x02, 0xfe,
+       0x24, 0x0a, 0xab, 0xfe,
+       0xe7, 0x10, 0xfe, 0x2b, 0xf0, 0x9d, 0xe9, 0x1c, 0xfe, 0x00, 0xfe, 0xfe,
+       0x1c, 0x12, 0xb5, 0xfe,
+       0xd2, 0xf0, 0x9d, 0xfe, 0x76, 0x18, 0x1c, 0x1a, 0x16, 0x9d, 0x05, 0xcb,
+       0x1c, 0x06, 0x16, 0x9d,
+       0xb8, 0x6d, 0xb9, 0x6d, 0xaa, 0xab, 0xfe, 0xb1, 0x10, 0x70, 0x5e, 0x2b,
+       0x14, 0x92, 0x01, 0x33,
+       0x0f, 0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x5a, 0x0f, 0x7c, 0x02, 0x5a,
+       0xfe, 0x74, 0x18, 0x1c,
+       0xfe, 0x00, 0xf8, 0x16, 0x6d, 0x67, 0x1b, 0x01, 0xfe, 0x44, 0x0d, 0x3b,
+       0x01, 0xe6, 0x1e, 0x27,
+       0x74, 0x67, 0x1a, 0x02, 0x6d, 0x09, 0x04, 0x0b, 0x21, 0xfe, 0x06, 0x0a,
+       0x09, 0x04, 0x6a, 0xfe,
+       0x82, 0x12, 0x09, 0x04, 0x19, 0xfe, 0x66, 0x13, 0x1e, 0x58, 0xac, 0xfc,
+       0xfe, 0x83, 0x80, 0xfe,
+       0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, 0x04, 0x91, 0xfe, 0x86, 0x91, 0x63,
+       0x27, 0xfe, 0x40, 0x59,
+       0xfe, 0xc1, 0x59, 0x77, 0xd7, 0x05, 0x54, 0x31, 0x55, 0x0c, 0x7b, 0x18,
+       0x7c, 0xbe, 0x54, 0xbf,
+       0x55, 0x01, 0xa8, 0xad, 0x63, 0x27, 0x12, 0x58, 0xc0, 0x38, 0xc1, 0x4e,
+       0x79, 0x56, 0x68, 0x57,
+       0xf4, 0xf5, 0xfe, 0x04, 0xfa, 0x38, 0xfe, 0x05, 0xfa, 0x4e, 0x01, 0xa5,
+       0xa2, 0x23, 0x0c, 0x7b,
+       0x0c, 0x7c, 0x79, 0x56, 0x68, 0x57, 0xfe, 0x12, 0x10, 0x09, 0x04, 0x19,
+       0x16, 0xd7, 0x79, 0x39,
+       0x68, 0x3a, 0x09, 0x04, 0xfe, 0xf7, 0x00, 0x35, 0x05, 0x52, 0x31, 0x53,
+       0xfe, 0x10, 0x58, 0xfe,
+       0x91, 0x58, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x02, 0x6d, 0x09, 0x04,
+       0x19, 0x16, 0xd7, 0x09,
+       0x04, 0xfe, 0xf7, 0x00, 0x35, 0xfe, 0x3a, 0x55, 0xfe, 0x19, 0x81, 0x5f,
+       0xfe, 0x10, 0x90, 0xfe,
+       0x92, 0x90, 0xfe, 0xd7, 0x10, 0x2f, 0x07, 0x9b, 0x16, 0xfe, 0xc6, 0x08,
+       0x11, 0x9b, 0x09, 0x04,
+       0x0b, 0xfe, 0x14, 0x13, 0x05, 0x39, 0x31, 0x3a, 0x77, 0xfe, 0xc6, 0x08,
+       0xfe, 0x0c, 0x58, 0xfe,
+       0x8d, 0x58, 0x02, 0x6d, 0x23, 0x47, 0xfe, 0x19, 0x80, 0xde, 0x09, 0x04,
+       0x0b, 0xfe, 0x1a, 0x12,
+       0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xe9, 0xb5, 0xfe, 0xd1, 0xf0, 0xd9,
+       0x14, 0x7a, 0x01, 0x33,
+       0x0f, 0xfe, 0x44, 0x00, 0xfe, 0x8e, 0x10, 0xfe, 0x6c, 0x19, 0xbe, 0x39,
+       0xfe, 0xed, 0x19, 0xbf,
+       0x3a, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xe9, 0x1c, 0xfe, 0x00, 0xff,
+       0x34, 0xfe, 0x74, 0x10,
+       0xb5, 0xfe, 0xd2, 0xf0, 0xfe, 0xb2, 0x0a, 0xfe, 0x76, 0x18, 0x1c, 0x1a,
+       0x84, 0x05, 0xcb, 0x1c,
+       0x06, 0xfe, 0x08, 0x13, 0x0f, 0xfe, 0x16, 0x00, 0x02, 0x5a, 0xfe, 0xd1,
+       0xf0, 0xfe, 0xc4, 0x0a,
+       0x14, 0x7a, 0x01, 0x33, 0x0f, 0xfe, 0x17, 0x00, 0xfe, 0x42, 0x10, 0xfe,
+       0xce, 0xf0, 0xfe, 0xca,
+       0x0a, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xd6, 0x0a, 0x0f, 0xfe,
+       0x22, 0x00, 0x02, 0x5a,
+       0xfe, 0xcb, 0xf0, 0xfe, 0xe2, 0x0a, 0x0f, 0xfe, 0x24, 0x00, 0x02, 0x5a,
+       0xfe, 0xd0, 0xf0, 0xfe,
+       0xec, 0x0a, 0x0f, 0x93, 0xdc, 0xfe, 0xcf, 0xf0, 0xfe, 0xf6, 0x0a, 0x0f,
+       0x4c, 0xfe, 0x10, 0x10,
+       0xfe, 0xcc, 0xf0, 0xd9, 0x61, 0x04, 0x19, 0x3b, 0x0f, 0xfe, 0x12, 0x00,
+       0x2a, 0x13, 0xfe, 0x4e,
+       0x11, 0x65, 0xfe, 0x0c, 0x0b, 0xfe, 0x9e, 0xf0, 0xfe, 0x20, 0x0b, 0xb1,
+       0x16, 0x32, 0x2a, 0x73,
+       0xdd, 0xb8, 0x22, 0xb9, 0x22, 0x2a, 0xec, 0x65, 0xfe, 0x2c, 0x0b, 0x25,
+       0x32, 0x8c, 0xfe, 0x48,
+       0x0b, 0x8d, 0x81, 0xb8, 0xd4, 0xb9, 0xd4, 0x02, 0x22, 0x01, 0x43, 0xfe,
+       0xdb, 0x10, 0x11, 0xfe,
+       0xe8, 0x00, 0xaa, 0xab, 0x70, 0xbc, 0x7d, 0xbd, 0x7f, 0xfe, 0x89, 0xf0,
+       0x22, 0x30, 0x2e, 0xd8,
+       0xbc, 0x7d, 0xbd, 0x7f, 0x01, 0x08, 0x1f, 0x22, 0x30, 0x2e, 0xd6, 0xb1,
+       0x45, 0x0f, 0xfe, 0x42,
+       0x00, 0x02, 0x5a, 0x78, 0x06, 0xfe, 0x81, 0x49, 0x16, 0xfe, 0x38, 0x0c,
+       0x09, 0x04, 0x0b, 0xfe,
+       0x44, 0x13, 0x0f, 0x00, 0x4b, 0x0b, 0xfe, 0x54, 0x12, 0x4b, 0xfe, 0x28,
+       0x00, 0x21, 0xfe, 0xa6,
+       0x0c, 0x0a, 0x40, 0x01, 0x0e, 0x07, 0x00, 0x5d, 0x3e, 0xfe, 0x28, 0x00,
+       0xfe, 0xe2, 0x10, 0x01,
+       0xe7, 0x01, 0xe8, 0x0a, 0x99, 0x01, 0xfe, 0x32, 0x0e, 0x59, 0x11, 0x2d,
+       0x01, 0x6f, 0x02, 0x29,
+       0x0f, 0xfe, 0x44, 0x00, 0x4b, 0x0b, 0xdf, 0x3e, 0x0b, 0xfe, 0xb4, 0x10,
+       0x01, 0x86, 0x3e, 0x0b,
+       0xfe, 0xaa, 0x10, 0x01, 0x86, 0xfe, 0x19, 0x82, 0xfe, 0x34, 0x46, 0xa3,
+       0x3e, 0x0b, 0x0f, 0xfe,
+       0x43, 0x00, 0xfe, 0x96, 0x10, 0x09, 0x4a, 0x0b, 0x35, 0x01, 0xe7, 0x01,
+       0xe8, 0x59, 0x11, 0x2d,
+       0x01, 0x6f, 0x67, 0x0b, 0x59, 0x3c, 0x8a, 0x02, 0xfe, 0x2a, 0x03, 0x09,
+       0x04, 0x0b, 0x84, 0x3e,
+       0x0b, 0x0f, 0x00, 0xfe, 0x5c, 0x10, 0x61, 0x04, 0x1b, 0xfe, 0x58, 0x12,
+       0x09, 0x04, 0x1b, 0xfe,
+       0x50, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x5c, 0x0c, 0xfe,
+       0x1c, 0x1c, 0xfe, 0x9d,
+       0xf0, 0xfe, 0x62, 0x0c, 0x09, 0x4a, 0x1b, 0x35, 0xfe, 0xa9, 0x10, 0x0f,
+       0xfe, 0x15, 0x00, 0xfe,
+       0x04, 0xe6, 0x0b, 0x5f, 0x5c, 0x0f, 0xfe, 0x13, 0x00, 0xfe, 0x10, 0x10,
+       0x0f, 0xfe, 0x47, 0x00,
+       0xa1, 0x0f, 0xfe, 0x41, 0x00, 0xa0, 0x0f, 0xfe, 0x24, 0x00, 0x87, 0xaa,
+       0xab, 0x70, 0x05, 0x6b,
+       0x28, 0x21, 0xd1, 0x5f, 0xfe, 0x04, 0xe6, 0x1b, 0xfe, 0x9d, 0x41, 0xfe,
+       0x1c, 0x42, 0x59, 0x01,
+       0xda, 0x02, 0x29, 0xea, 0x14, 0x0b, 0x37, 0x95, 0xa9, 0x14, 0xfe, 0x31,
+       0x00, 0x37, 0x97, 0x01,
+       0xfe, 0x54, 0x0f, 0x02, 0xd0, 0x3c, 0xfe, 0x06, 0xec, 0xc9, 0xee, 0x3e,
+       0x1d, 0xfe, 0xce, 0x45,
+       0x34, 0x3c, 0xfe, 0x06, 0xea, 0xc9, 0xfe, 0x47, 0x4b, 0x89, 0xfe, 0x75,
+       0x57, 0x05, 0x51, 0xfe,
+       0x98, 0x56, 0xfe, 0x38, 0x12, 0x0a, 0x42, 0x01, 0x0e, 0xfe, 0x44, 0x48,
+       0x46, 0x09, 0x04, 0x1d,
+       0xfe, 0x1a, 0x13, 0x0a, 0x40, 0x01, 0x0e, 0x47, 0xfe, 0x41, 0x58, 0x0a,
+       0x99, 0x01, 0x0e, 0xfe,
+       0x49, 0x54, 0x8e, 0xfe, 0x2a, 0x0d, 0x02, 0xfe, 0x2a, 0x03, 0x0a, 0x51,
+       0xfe, 0xee, 0x14, 0xee,
+       0x3e, 0x1d, 0xfe, 0xce, 0x45, 0x34, 0x3c, 0xfe, 0xce, 0x47, 0xfe, 0xad,
+       0x13, 0x02, 0x29, 0x1e,
+       0x20, 0x07, 0x10, 0xfe, 0x9e, 0x12, 0x23, 0x12, 0x4d, 0x12, 0x94, 0x12,
+       0xce, 0x1e, 0x2d, 0x47,
+       0x37, 0x2d, 0xb1, 0xe0, 0xfe, 0xbc, 0xf0, 0xfe, 0xec, 0x0d, 0x13, 0x06,
+       0x12, 0x4d, 0x01, 0xfe,
+       0xe2, 0x15, 0x05, 0xfe, 0x38, 0x01, 0x31, 0xfe, 0x3a, 0x01, 0x77, 0xfe,
+       0xf0, 0x0d, 0xfe, 0x02,
+       0xec, 0xce, 0x62, 0x00, 0x5d, 0xfe, 0x04, 0xec, 0x20, 0x46, 0xfe, 0x05,
+       0xf6, 0xfe, 0x34, 0x01,
+       0x01, 0xfe, 0x52, 0x16, 0xfb, 0xfe, 0x48, 0xf4, 0x0d, 0xfe, 0x18, 0x13,
+       0xaf, 0xfe, 0x02, 0xea,
+       0xce, 0x62, 0x7a, 0xfe, 0xc5, 0x13, 0x14, 0x1b, 0x37, 0x95, 0xa9, 0x5c,
+       0x05, 0xfe, 0x38, 0x01,
+       0x1c, 0xfe, 0xf0, 0xff, 0x0c, 0xfe, 0x60, 0x01, 0x05, 0xfe, 0x3a, 0x01,
+       0x0c, 0xfe, 0x62, 0x01,
+       0x3d, 0x12, 0x20, 0x24, 0x06, 0x12, 0x2d, 0x11, 0x2d, 0x8a, 0x13, 0x06,
+       0x03, 0x23, 0x03, 0x1e,
+       0x4d, 0xfe, 0xf7, 0x12, 0x1e, 0x94, 0xac, 0x12, 0x94, 0x07, 0x7a, 0xfe,
+       0x71, 0x13, 0xfe, 0x24,
+       0x1c, 0x14, 0x1a, 0x37, 0x95, 0xa9, 0xfe, 0xd9, 0x10, 0xb6, 0xfe, 0x03,
+       0xdc, 0xfe, 0x73, 0x57,
+       0xfe, 0x80, 0x5d, 0x03, 0xb6, 0xfe, 0x03, 0xdc, 0xfe, 0x5b, 0x57, 0xfe,
+       0x80, 0x5d, 0x03, 0xfe,
+       0x03, 0x57, 0xb6, 0x23, 0xfe, 0x00, 0xcc, 0x03, 0xfe, 0x03, 0x57, 0xb6,
+       0x75, 0x03, 0x09, 0x04,
+       0x4c, 0xfe, 0x22, 0x13, 0xfe, 0x1c, 0x80, 0x07, 0x06, 0xfe, 0x1a, 0x13,
+       0xfe, 0x1e, 0x80, 0xe1,
+       0xfe, 0x1d, 0x80, 0xa4, 0xfe, 0x0c, 0x90, 0xfe, 0x0e, 0x13, 0xfe, 0x0e,
+       0x90, 0xa3, 0xfe, 0x3c,
+       0x90, 0xfe, 0x30, 0xf4, 0x0b, 0xfe, 0x3c, 0x50, 0xa0, 0x01, 0xfe, 0x82,
+       0x16, 0x2f, 0x07, 0x2d,
+       0xe0, 0x01, 0xfe, 0xbc, 0x15, 0x09, 0x04, 0x1d, 0x45, 0x01, 0xe7, 0x01,
+       0xe8, 0x11, 0xfe, 0xe9,
+       0x00, 0x09, 0x04, 0x4c, 0xfe, 0x2c, 0x13, 0x01, 0xfe, 0x14, 0x16, 0xfe,
+       0x1e, 0x1c, 0xfe, 0x14,
+       0x90, 0xfe, 0x96, 0x90, 0x0c, 0xfe, 0x64, 0x01, 0x18, 0xfe, 0x66, 0x01,
+       0x09, 0x04, 0x4f, 0xfe,
+       0x12, 0x12, 0xfe, 0x03, 0x80, 0x74, 0xfe, 0x01, 0xec, 0x20, 0xfe, 0x80,
+       0x40, 0x12, 0x20, 0x63,
+       0x27, 0x11, 0xc8, 0x59, 0x1e, 0x20, 0xed, 0x76, 0x20, 0x03, 0xfe, 0x08,
+       0x1c, 0x05, 0xfe, 0xac,
+       0x00, 0xfe, 0x06, 0x58, 0x05, 0xfe, 0xae, 0x00, 0xfe, 0x07, 0x58, 0x05,
+       0xfe, 0xb0, 0x00, 0xfe,
+       0x08, 0x58, 0x05, 0xfe, 0xb2, 0x00, 0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c,
+       0x24, 0x69, 0x12, 0xc9,
+       0x23, 0x0c, 0x50, 0x0c, 0x3f, 0x13, 0x40, 0x48, 0x5f, 0x17, 0x1d, 0xfe,
+       0x90, 0x4d, 0xfe, 0x91,
+       0x54, 0x21, 0xfe, 0x08, 0x0f, 0x3e, 0x10, 0x13, 0x42, 0x48, 0x17, 0x4c,
+       0xfe, 0x90, 0x4d, 0xfe,
+       0x91, 0x54, 0x21, 0xfe, 0x1e, 0x0f, 0x24, 0x10, 0x12, 0x20, 0x78, 0x2c,
+       0x46, 0x1e, 0x20, 0xed,
+       0x76, 0x20, 0x11, 0xc8, 0xf6, 0xfe, 0xd6, 0xf0, 0xfe, 0x32, 0x0f, 0xea,
+       0x70, 0xfe, 0x14, 0x1c,
+       0xfe, 0x10, 0x1c, 0xfe, 0x18, 0x1c, 0x03, 0x3c, 0xfe, 0x0c, 0x14, 0xee,
+       0xfe, 0x07, 0xe6, 0x1d,
+       0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x03, 0x01, 0x86, 0x78, 0x2c, 0x46,
+       0xfa, 0xef, 0xfe, 0x42,
+       0x13, 0x2f, 0x07, 0x2d, 0xfe, 0x34, 0x13, 0x0a, 0x42, 0x01, 0x0e, 0xb0,
+       0xfe, 0x36, 0x12, 0xf0,
+       0xfe, 0x45, 0x48, 0x01, 0xe3, 0xfe, 0x00, 0xcc, 0xb0, 0xfe, 0xf3, 0x13,
+       0x3d, 0x75, 0x07, 0x10,
+       0xa3, 0x0a, 0x80, 0x01, 0x0e, 0xfe, 0x80, 0x5c, 0x01, 0x6f, 0xfe, 0x0e,
+       0x10, 0x07, 0x7e, 0x45,
+       0xf6, 0xfe, 0xd6, 0xf0, 0xfe, 0x6c, 0x0f, 0x03, 0xfe, 0x44, 0x58, 0x74,
+       0xfe, 0x01, 0xec, 0x97,
+       0xfe, 0x9e, 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1b, 0x76,
+       0x27, 0x01, 0xda, 0xfe,
+       0xdd, 0x10, 0x2a, 0xbc, 0x7d, 0xbd, 0x7f, 0x30, 0x2e, 0xd5, 0x07, 0x1b,
+       0xfe, 0x48, 0x12, 0x07,
+       0x0b, 0xfe, 0x56, 0x12, 0x07, 0x1a, 0xfe, 0x30, 0x12, 0x07, 0xc2, 0x16,
+       0xfe, 0x3e, 0x11, 0x07,
+       0xfe, 0x23, 0x00, 0x16, 0xfe, 0x4a, 0x11, 0x07, 0x06, 0x16, 0xfe, 0xa8,
+       0x11, 0x07, 0x19, 0xfe,
+       0x12, 0x12, 0x07, 0x00, 0x16, 0x22, 0x14, 0xc2, 0x01, 0x33, 0x9f, 0x2b,
+       0x01, 0x08, 0x8c, 0x43,
+       0x03, 0x2b, 0xfe, 0x62, 0x08, 0x0a, 0xca, 0x01, 0xfe, 0x32, 0x0e, 0x11,
+       0x7e, 0x02, 0x29, 0x2b,
+       0x2f, 0x07, 0x9b, 0xfe, 0xd9, 0x13, 0x79, 0x39, 0x68, 0x3a, 0x77, 0xfe,
+       0xfc, 0x10, 0x09, 0x04,
+       0x6a, 0xfe, 0x72, 0x12, 0xc0, 0x38, 0xc1, 0x4e, 0xf4, 0xf5, 0x8e, 0xfe,
+       0xc6, 0x10, 0x1e, 0x58,
+       0xfe, 0x26, 0x13, 0x05, 0x7b, 0x31, 0x7c, 0x77, 0xfe, 0x82, 0x0c, 0x0c,
+       0x54, 0x18, 0x55, 0x23,
+       0x0c, 0x7b, 0x0c, 0x7c, 0x01, 0xa8, 0x24, 0x69, 0x73, 0x12, 0x58, 0x01,
+       0xa5, 0xc0, 0x38, 0xc1,
+       0x4e, 0xfe, 0x04, 0x55, 0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x38, 0xfe,
+       0x05, 0xfa, 0x4e, 0xfe,
+       0x91, 0x10, 0x05, 0x56, 0x31, 0x57, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56,
+       0x0c, 0x56, 0x18, 0x57,
+       0x83, 0xc0, 0x38, 0xc1, 0x4e, 0xf4, 0xf5, 0x05, 0x52, 0x31, 0x53, 0xfe,
+       0x00, 0x56, 0xfe, 0xa1,
+       0x56, 0x0c, 0x52, 0x18, 0x53, 0x09, 0x04, 0x6a, 0xfe, 0x1e, 0x12, 0x1e,
+       0x58, 0xfe, 0x1f, 0x40,
+       0x05, 0x54, 0x31, 0x55, 0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x05, 0x56,
+       0x31, 0x57, 0xfe, 0x44,
+       0x50, 0xfe, 0xc6, 0x50, 0x05, 0x52, 0x31, 0x53, 0xfe, 0x08, 0x50, 0xfe,
+       0x8a, 0x50, 0x05, 0x39,
+       0x31, 0x3a, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x02, 0x5c, 0x24, 0x06,
+       0x12, 0xcd, 0x02, 0x5b,
+       0x2b, 0x01, 0x08, 0x1f, 0x44, 0x30, 0x2e, 0xd5, 0x07, 0x06, 0x21, 0x44,
+       0x2f, 0x07, 0x9b, 0x21,
+       0x5b, 0x01, 0x6e, 0x1c, 0x3d, 0x16, 0x44, 0x09, 0x04, 0x0b, 0xe2, 0x79,
+       0x39, 0x68, 0x3a, 0xfe,
+       0x0a, 0x55, 0x34, 0xfe, 0x8b, 0x55, 0xbe, 0x39, 0xbf, 0x3a, 0xfe, 0x0c,
+       0x51, 0xfe, 0x8e, 0x51,
+       0x02, 0x5b, 0xfe, 0x19, 0x81, 0xaf, 0xfe, 0x19, 0x41, 0x02, 0x5b, 0x2b,
+       0x01, 0x08, 0x25, 0x32,
+       0x1f, 0xa2, 0x30, 0x2e, 0xd8, 0x4b, 0x1a, 0xfe, 0xa6, 0x12, 0x4b, 0x0b,
+       0x3b, 0x02, 0x44, 0x01,
+       0x08, 0x25, 0x32, 0x1f, 0xa2, 0x30, 0x2e, 0xd6, 0x07, 0x1a, 0x21, 0x44,
+       0x01, 0x08, 0x1f, 0xa2,
+       0x30, 0x2e, 0xfe, 0xe8, 0x09, 0xfe, 0xc2, 0x49, 0x60, 0x05, 0xfe, 0x9c,
+       0x00, 0x28, 0x84, 0x49,
+       0x04, 0x19, 0x34, 0x9f, 0xfe, 0xbb, 0x45, 0x4b, 0x00, 0x45, 0x3e, 0x06,
+       0x78, 0x3d, 0xfe, 0xda,
+       0x14, 0x01, 0x6e, 0x87, 0xfe, 0x4b, 0x45, 0xe2, 0x2f, 0x07, 0x9a, 0xe1,
+       0x05, 0xc6, 0x28, 0x84,
+       0x05, 0x3f, 0x28, 0x34, 0x5e, 0x02, 0x5b, 0xfe, 0xc0, 0x5d, 0xfe, 0xf8,
+       0x14, 0xfe, 0x03, 0x17,
+       0x05, 0x50, 0xb4, 0x0c, 0x50, 0x5e, 0x2b, 0x01, 0x08, 0x26, 0x5c, 0x01,
+       0xfe, 0xaa, 0x14, 0x02,
+       0x5c, 0x01, 0x08, 0x25, 0x32, 0x1f, 0x44, 0x30, 0x2e, 0xd6, 0x07, 0x06,
+       0x21, 0x44, 0x01, 0xfe,
+       0x8e, 0x13, 0xfe, 0x42, 0x58, 0xfe, 0x82, 0x14, 0xfe, 0xa4, 0x14, 0x87,
+       0xfe, 0x4a, 0xf4, 0x0b,
+       0x16, 0x44, 0xfe, 0x4a, 0xf4, 0x06, 0xfe, 0x0c, 0x12, 0x2f, 0x07, 0x9a,
+       0x85, 0x02, 0x5b, 0x05,
+       0x3f, 0xb4, 0x0c, 0x3f, 0x5e, 0x2b, 0x01, 0x08, 0x26, 0x5c, 0x01, 0xfe,
+       0xd8, 0x14, 0x02, 0x5c,
+       0x13, 0x06, 0x65, 0xfe, 0xca, 0x12, 0x26, 0xfe, 0xe0, 0x12, 0x72, 0xf1,
+       0x01, 0x08, 0x23, 0x72,
+       0x03, 0x8f, 0xfe, 0xdc, 0x12, 0x25, 0xfe, 0xdc, 0x12, 0x1f, 0xfe, 0xca,
+       0x12, 0x5e, 0x2b, 0x01,
+       0x08, 0xfe, 0xd5, 0x10, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b,
+       0x1c, 0xfe, 0xff, 0x7f,
+       0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x13, 0x6c, 0xff, 0x02, 0x00,
+       0x57, 0x48, 0x8b, 0x1c,
+       0x3d, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x03, 0x13, 0x6c, 0xff, 0x02,
+       0x00, 0x57, 0x48, 0x8b,
+       0x03, 0x13, 0x6c, 0xff, 0x02, 0x00, 0x57, 0x48, 0x8b, 0xfe, 0x0b, 0x58,
+       0x03, 0x0a, 0x50, 0x01,
+       0x82, 0x0a, 0x3f, 0x01, 0x82, 0x03, 0xfc, 0x1c, 0x10, 0xff, 0x03, 0x00,
+       0x54, 0xfe, 0x00, 0xf4,
+       0x19, 0x48, 0xfe, 0x00, 0x7d, 0xfe, 0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe,
+       0x03, 0x7c, 0x63, 0x27,
+       0x0c, 0x52, 0x18, 0x53, 0xbe, 0x56, 0xbf, 0x57, 0x03, 0xfe, 0x62, 0x08,
+       0xfe, 0x82, 0x4a, 0xfe,
+       0xe1, 0x1a, 0xfe, 0x83, 0x5a, 0x74, 0x03, 0x01, 0xfe, 0x14, 0x18, 0xfe,
+       0x42, 0x48, 0x5f, 0x60,
+       0x89, 0x01, 0x08, 0x1f, 0xfe, 0xa2, 0x14, 0x30, 0x2e, 0xd8, 0x01, 0x08,
+       0x1f, 0xfe, 0xa2, 0x14,
+       0x30, 0x2e, 0xfe, 0xe8, 0x0a, 0xfe, 0xc1, 0x59, 0x05, 0xc6, 0x28, 0xfe,
+       0xcc, 0x12, 0x49, 0x04,
+       0x1b, 0xfe, 0xc4, 0x13, 0x23, 0x62, 0x1b, 0xe2, 0x4b, 0xc3, 0x64, 0xfe,
+       0xe8, 0x13, 0x3b, 0x13,
+       0x06, 0x17, 0xc3, 0x78, 0xdb, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55,
+       0xa1, 0xff, 0x02, 0x83,
+       0x55, 0x62, 0x1a, 0xa4, 0xbb, 0xfe, 0x30, 0x00, 0x8e, 0xe4, 0x17, 0x2c,
+       0x13, 0x06, 0xfe, 0x56,
+       0x10, 0x62, 0x0b, 0xe1, 0xbb, 0xfe, 0x64, 0x00, 0x8e, 0xe4, 0x0a, 0xfe,
+       0x64, 0x00, 0x17, 0x93,
+       0x13, 0x06, 0xfe, 0x28, 0x10, 0x62, 0x06, 0xfe, 0x60, 0x13, 0xbb, 0xfe,
+       0xc8, 0x00, 0x8e, 0xe4,
+       0x0a, 0xfe, 0xc8, 0x00, 0x17, 0x4d, 0x13, 0x06, 0x83, 0xbb, 0xfe, 0x90,
+       0x01, 0xba, 0xfe, 0x4e,
+       0x14, 0x89, 0xfe, 0x12, 0x10, 0xfe, 0x43, 0xf4, 0x94, 0xfe, 0x56, 0xf0,
+       0xfe, 0x60, 0x14, 0xfe,
+       0x04, 0xf4, 0x6c, 0xfe, 0x43, 0xf4, 0x93, 0xfe, 0xf3, 0x10, 0xf9, 0x01,
+       0xfe, 0x22, 0x13, 0x1c,
+       0x3d, 0xfe, 0x10, 0x13, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x69, 0xba,
+       0xfe, 0x9c, 0x14, 0xb7,
+       0x69, 0xfe, 0x1c, 0x10, 0xfe, 0x00, 0x17, 0xfe, 0x4d, 0xe4, 0x19, 0xba,
+       0xfe, 0x9c, 0x14, 0xb7,
+       0x19, 0x83, 0x60, 0x23, 0xfe, 0x4d, 0xf4, 0x00, 0xdf, 0x89, 0x13, 0x06,
+       0xfe, 0xb4, 0x56, 0xfe,
+       0xc3, 0x58, 0x03, 0x60, 0x13, 0x0b, 0x03, 0x15, 0x06, 0x01, 0x08, 0x26,
+       0xe5, 0x15, 0x0b, 0x01,
+       0x08, 0x26, 0xe5, 0x15, 0x1a, 0x01, 0x08, 0x26, 0xe5, 0x72, 0xfe, 0x89,
+       0x49, 0x01, 0x08, 0x03,
+       0x15, 0x06, 0x01, 0x08, 0x26, 0xa6, 0x15, 0x1a, 0x01, 0x08, 0x26, 0xa6,
+       0x15, 0x06, 0x01, 0x08,
+       0x26, 0xa6, 0xfe, 0x89, 0x49, 0x01, 0x08, 0x26, 0xa6, 0x72, 0xfe, 0x89,
+       0x4a, 0x01, 0x08, 0x03,
+       0x60, 0x03, 0x1e, 0xcc, 0x07, 0x06, 0xfe, 0x44, 0x13, 0xad, 0x12, 0xcc,
+       0xfe, 0x49, 0xf4, 0x00,
+       0x3b, 0x72, 0x9f, 0x5e, 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xf1, 0x01,
+       0x08, 0x2f, 0x07, 0xfe,
+       0xe3, 0x00, 0xfe, 0x20, 0x13, 0x1f, 0xfe, 0x5a, 0x15, 0x23, 0x12, 0xcd,
+       0x01, 0x43, 0x1e, 0xcd,
+       0x07, 0x06, 0x45, 0x09, 0x4a, 0x06, 0x35, 0x03, 0x0a, 0x42, 0x01, 0x0e,
+       0xed, 0x88, 0x07, 0x10,
+       0xa4, 0x0a, 0x80, 0x01, 0x0e, 0x88, 0x0a, 0x51, 0x01, 0x9e, 0x03, 0x0a,
+       0x80, 0x01, 0x0e, 0x88,
+       0xfe, 0x80, 0xe7, 0x10, 0x07, 0x10, 0x84, 0xfe, 0x45, 0x58, 0x01, 0xe3,
+       0x88, 0x03, 0x0a, 0x42,
+       0x01, 0x0e, 0x88, 0x0a, 0x51, 0x01, 0x9e, 0x03, 0x0a, 0x42, 0x01, 0x0e,
+       0xfe, 0x80, 0x80, 0xf2,
+       0xfe, 0x49, 0xe4, 0x10, 0xa4, 0x0a, 0x80, 0x01, 0x0e, 0xf2, 0x0a, 0x51,
+       0x01, 0x82, 0x03, 0x17,
+       0x10, 0x71, 0x66, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde,
+       0xfe, 0x24, 0x1c, 0xfe,
+       0x1d, 0xf7, 0x1d, 0x90, 0xfe, 0xf6, 0x15, 0x01, 0xfe, 0xfc, 0x16, 0xe0,
+       0x91, 0x1d, 0x66, 0xfe,
+       0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x03, 0xae, 0x21, 0xfe, 0xe6, 0x15, 0xfe,
+       0xda, 0x10, 0x17, 0x10,
+       0x71, 0x05, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x19, 0xfe, 0x18, 0x58,
+       0x05, 0xfe, 0x66, 0x01,
+       0xfe, 0x19, 0x58, 0x91, 0x19, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4, 0x06,
+       0xfe, 0x3c, 0x50, 0x66,
+       0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x19, 0x90, 0xfe,
+       0x40, 0x16, 0xfe, 0xb6,
+       0x14, 0x34, 0x03, 0xae, 0x21, 0xfe, 0x18, 0x16, 0xfe, 0x9c, 0x10, 0x17,
+       0x10, 0x71, 0xfe, 0x83,
+       0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x1d, 0xf7, 0x38, 0x90,
+       0xfe, 0x62, 0x16, 0xfe,
+       0x94, 0x14, 0xfe, 0x10, 0x13, 0x91, 0x38, 0x66, 0x1b, 0xfe, 0xaf, 0x19,
+       0xfe, 0x98, 0xe7, 0x00,
+       0x03, 0xae, 0x21, 0xfe, 0x56, 0x16, 0xfe, 0x6c, 0x10, 0x17, 0x10, 0x71,
+       0xfe, 0x30, 0xbc, 0xfe,
+       0xb2, 0xbc, 0x91, 0xc5, 0x66, 0x1b, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7,
+       0xc5, 0x90, 0xfe, 0x9a,
+       0x16, 0xfe, 0x5c, 0x14, 0x34, 0x03, 0xae, 0x21, 0xfe, 0x86, 0x16, 0xfe,
+       0x42, 0x10, 0xfe, 0x02,
+       0xf6, 0x10, 0x71, 0xfe, 0x18, 0xfe, 0x54, 0xfe, 0x19, 0xfe, 0x55, 0xfc,
+       0xfe, 0x1d, 0xf7, 0x4f,
+       0x90, 0xfe, 0xc0, 0x16, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13, 0x91, 0x4f,
+       0x47, 0xfe, 0x83, 0x58,
+       0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x10, 0xfe, 0x81, 0xe7, 0x10, 0x11,
+       0xfe, 0xdd, 0x00, 0x63,
+       0x27, 0x03, 0x63, 0x27, 0xfe, 0x12, 0x45, 0x21, 0xfe, 0xb0, 0x16, 0x14,
+       0x06, 0x37, 0x95, 0xa9,
+       0x02, 0x29, 0xfe, 0x39, 0xf0, 0xfe, 0x04, 0x17, 0x23, 0x03, 0xfe, 0x7e,
+       0x18, 0x1c, 0x1a, 0x5d,
+       0x13, 0x0d, 0x03, 0x71, 0x05, 0xcb, 0x1c, 0x06, 0xfe, 0xef, 0x12, 0xfe,
+       0xe1, 0x10, 0x78, 0x2c,
+       0x46, 0x2f, 0x07, 0x2d, 0xfe, 0x3c, 0x13, 0xfe, 0x82, 0x14, 0xfe, 0x42,
+       0x13, 0x3c, 0x8a, 0x0a,
+       0x42, 0x01, 0x0e, 0xb0, 0xfe, 0x3e, 0x12, 0xf0, 0xfe, 0x45, 0x48, 0x01,
+       0xe3, 0xfe, 0x00, 0xcc,
+       0xb0, 0xfe, 0xf3, 0x13, 0x3d, 0x75, 0x07, 0x10, 0xa3, 0x0a, 0x80, 0x01,
+       0x0e, 0xf2, 0x01, 0x6f,
+       0xfe, 0x16, 0x10, 0x07, 0x7e, 0x85, 0xfe, 0x40, 0x14, 0xfe, 0x24, 0x12,
+       0xf6, 0xfe, 0xd6, 0xf0,
+       0xfe, 0x24, 0x17, 0x17, 0x0b, 0x03, 0xfe, 0x9c, 0xe7, 0x0b, 0x0f, 0xfe,
+       0x15, 0x00, 0x59, 0x76,
+       0x27, 0x01, 0xda, 0x17, 0x06, 0x03, 0x3c, 0x8a, 0x09, 0x4a, 0x1d, 0x35,
+       0x11, 0x2d, 0x01, 0x6f,
+       0x17, 0x06, 0x03, 0xfe, 0x38, 0x90, 0xfe, 0xba, 0x90, 0x79, 0xc7, 0x68,
+       0xc8, 0xfe, 0x48, 0x55,
+       0x34, 0xfe, 0xc9, 0x55, 0x03, 0x1e, 0x98, 0x73, 0x12, 0x98, 0x03, 0x0a,
+       0x99, 0x01, 0x0e, 0xf0,
+       0x0a, 0x40, 0x01, 0x0e, 0xfe, 0x49, 0x44, 0x16, 0xfe, 0xf0, 0x17, 0x73,
+       0x75, 0x03, 0x0a, 0x42,
+       0x01, 0x0e, 0x07, 0x10, 0x45, 0x0a, 0x51, 0x01, 0x9e, 0x0a, 0x40, 0x01,
+       0x0e, 0x73, 0x75, 0x03,
+       0xfe, 0x4e, 0xe4, 0x1a, 0x64, 0xfe, 0x24, 0x18, 0x05, 0xfe, 0x90, 0x00,
+       0xfe, 0x3a, 0x45, 0x5b,
+       0xfe, 0x4e, 0xe4, 0xc2, 0x64, 0xfe, 0x36, 0x18, 0x05, 0xfe, 0x92, 0x00,
+       0xfe, 0x02, 0xe6, 0x1b,
+       0xdc, 0xfe, 0x4e, 0xe4, 0xfe, 0x0b, 0x00, 0x64, 0xfe, 0x48, 0x18, 0x05,
+       0xfe, 0x94, 0x00, 0xfe,
+       0x02, 0xe6, 0x19, 0xfe, 0x08, 0x10, 0x05, 0xfe, 0x96, 0x00, 0xfe, 0x02,
+       0xe6, 0x2c, 0xfe, 0x4e,
+       0x45, 0xfe, 0x0c, 0x12, 0xaf, 0xff, 0x04, 0x68, 0x54, 0xde, 0x1c, 0x69,
+       0x03, 0x07, 0x7a, 0xfe,
+       0x5a, 0xf0, 0xfe, 0x74, 0x18, 0x24, 0xfe, 0x09, 0x00, 0xfe, 0x34, 0x10,
+       0x07, 0x1b, 0xfe, 0x5a,
+       0xf0, 0xfe, 0x82, 0x18, 0x24, 0xc3, 0xfe, 0x26, 0x10, 0x07, 0x1a, 0x5d,
+       0x24, 0x2c, 0xdc, 0x07,
+       0x0b, 0x5d, 0x24, 0x93, 0xfe, 0x0e, 0x10, 0x07, 0x06, 0x5d, 0x24, 0x4d,
+       0x9f, 0xad, 0x03, 0x14,
+       0xfe, 0x09, 0x00, 0x01, 0x33, 0xfe, 0x04, 0xfe, 0x7d, 0x05, 0x7f, 0xf9,
+       0x03, 0x25, 0xfe, 0xca,
+       0x18, 0xfe, 0x14, 0xf0, 0x08, 0x65, 0xfe, 0xc6, 0x18, 0x03, 0xff, 0x1a,
+       0x00, 0x00,
 };
 
-STATIC unsigned short _adv_asc3550_size =
-        sizeof(_adv_asc3550_buf); /* 0x13AD */
-STATIC ADV_DCNT _adv_asc3550_chksum =
-        0x04D52DDDUL; /* Expanded little-endian checksum. */
+static unsigned short _adv_asc3550_size = sizeof(_adv_asc3550_buf);    /* 0x13AD */
+static ADV_DCNT _adv_asc3550_chksum = 0x04D52DDDUL;    /* Expanded little-endian checksum. */
 
 /* Microcode buffer is kept after initialization for error recovery. */
-STATIC unsigned char _adv_asc38C0800_buf[] = {
-  0x00,  0x00,  0x00,  0xf2,  0x00,  0xf0,  0x00,  0xfc,  0x00,  0x16,  0x18,  0xe4,  0x01,  0x00,  0x48,  0xe4,
-  0x18,  0x80,  0x03,  0xf6,  0x02,  0x00,  0xce,  0x19,  0x00,  0xfa,  0xff,  0xff,  0x1c,  0x0f,  0x00,  0xf6,
-  0x9e,  0xe7,  0xff,  0x00,  0x82,  0xe7,  0x00,  0xea,  0x01,  0xfa,  0x01,  0xe6,  0x09,  0xe7,  0x55,  0xf0,
-  0x01,  0xf6,  0x03,  0x00,  0x04,  0x00,  0x10,  0x00,  0x1e,  0xf0,  0x85,  0xf0,  0x18,  0xf4,  0x08,  0x00,
-  0xbc,  0x00,  0x38,  0x54,  0x00,  0xec,  0xd5,  0xf0,  0x82,  0x0d,  0x00,  0xe6,  0x86,  0xf0,  0xb1,  0xf0,
-  0x98,  0x57,  0x01,  0xfc,  0xb4,  0x00,  0xd4,  0x01,  0x0c,  0x1c,  0x3e,  0x1c,  0x3c,  0x00,  0xbb,  0x00,
-  0x00,  0x10,  0xba,  0x19,  0x02,  0x80,  0x32,  0xf0,  0x7c,  0x0d,  0x02,  0x13,  0xba,  0x13,  0x18,  0x40,
-  0x00,  0x57,  0x01,  0xea,  0x02,  0xfc,  0x03,  0xfc,  0x3e,  0x00,  0x6c,  0x01,  0x6e,  0x01,  0x74,  0x01,
-  0x76,  0x01,  0xb9,  0x54,  0x3e,  0x57,  0x00,  0x80,  0x03,  0xe6,  0xb6,  0x00,  0xc0,  0x00,  0x01,  0x01,
-  0x3e,  0x01,  0x7a,  0x01,  0xca,  0x08,  0xce,  0x10,  0x16,  0x11,  0x04,  0x12,  0x08,  0x12,  0x02,  0x4a,
-  0xbb,  0x55,  0x3c,  0x56,  0x03,  0x58,  0x1b,  0x80,  0x30,  0xe4,  0x4b,  0xe4,  0x5d,  0xf0,  0x02,  0xfa,
-  0x20,  0x00,  0x32,  0x00,  0x40,  0x00,  0x80,  0x00,  0x24,  0x01,  0x3c,  0x01,  0x68,  0x01,  0x6a,  0x01,
-  0x70,  0x01,  0x72,  0x01,  0x78,  0x01,  0x7c,  0x01,  0x62,  0x0a,  0x86,  0x0d,  0x06,  0x13,  0x4c,  0x1c,
-  0x04,  0x80,  0x4a,  0xe4,  0x02,  0xee,  0x5b,  0xf0,  0x03,  0xf7,  0x0c,  0x00,  0x0f,  0x00,  0x47,  0x00,
-  0xbe,  0x00,  0x00,  0x01,  0x20,  0x11,  0x5c,  0x16,  0x32,  0x1c,  0x38,  0x1c,  0x4e,  0x1c,  0x10,  0x44,
-  0x00,  0x4c,  0x04,  0xea,  0x5c,  0xf0,  0xa7,  0xf0,  0x04,  0xf6,  0x03,  0xfa,  0x05,  0x00,  0x34,  0x00,
-  0x36,  0x00,  0x98,  0x00,  0xcc,  0x00,  0x20,  0x01,  0x4e,  0x01,  0x4a,  0x0b,  0x42,  0x0c,  0x12,  0x0f,
-  0x0c,  0x10,  0x22,  0x11,  0x0a,  0x12,  0x04,  0x13,  0x30,  0x1c,  0x02,  0x48,  0x00,  0x4e,  0x42,  0x54,
-  0x44,  0x55,  0xbd,  0x56,  0x06,  0x83,  0x00,  0xdc,  0x05,  0xf0,  0x09,  0xf0,  0x59,  0xf0,  0xb8,  0xf0,
-  0x4b,  0xf4,  0x06,  0xf7,  0x0e,  0xf7,  0x04,  0xfc,  0x05,  0xfc,  0x06,  0x00,  0x19,  0x00,  0x33,  0x00,
-  0x9b,  0x00,  0xa4,  0x00,  0xb5,  0x00,  0xba,  0x00,  0xd0,  0x00,  0xe1,  0x00,  0xe7,  0x00,  0xe2,  0x03,
-  0x08,  0x0f,  0x02,  0x10,  0x04,  0x10,  0x0a,  0x10,  0x0a,  0x13,  0x0c,  0x13,  0x12,  0x13,  0x24,  0x14,
-  0x34,  0x14,  0x04,  0x16,  0x08,  0x16,  0xa4,  0x17,  0x20,  0x1c,  0x34,  0x1c,  0x36,  0x1c,  0x08,  0x44,
-  0x38,  0x44,  0x91,  0x44,  0x0a,  0x45,  0x48,  0x46,  0x01,  0x48,  0x68,  0x54,  0x3a,  0x55,  0x83,  0x55,
-  0xe5,  0x55,  0xb0,  0x57,  0x01,  0x58,  0x83,  0x59,  0x05,  0xe6,  0x0b,  0xf0,  0x0c,  0xf0,  0x04,  0xf8,
-  0x05,  0xf8,  0x07,  0x00,  0x0a,  0x00,  0x1c,  0x00,  0x1e,  0x00,  0x9e,  0x00,  0xa8,  0x00,  0xaa,  0x00,
-  0xb9,  0x00,  0xe0,  0x00,  0x22,  0x01,  0x26,  0x01,  0x79,  0x01,  0x7e,  0x01,  0xc4,  0x01,  0xc6,  0x01,
-  0x80,  0x02,  0x5e,  0x03,  0xee,  0x04,  0x9a,  0x06,  0xf8,  0x07,  0x62,  0x08,  0x68,  0x08,  0x69,  0x08,
-  0xd6,  0x08,  0xe9,  0x09,  0xfa,  0x0b,  0x2e,  0x0f,  0x12,  0x10,  0x1a,  0x10,  0xed,  0x10,  0xf1,  0x10,
-  0x2a,  0x11,  0x06,  0x12,  0x0c,  0x12,  0x3e,  0x12,  0x10,  0x13,  0x16,  0x13,  0x1e,  0x13,  0x46,  0x14,
-  0x76,  0x14,  0x82,  0x14,  0x36,  0x15,  0xca,  0x15,  0x6b,  0x18,  0xbe,  0x18,  0xca,  0x18,  0xe6,  0x19,
-  0x12,  0x1c,  0x46,  0x1c,  0x9c,  0x32,  0x00,  0x40,  0x0e,  0x47,  0xfe,  0x9c,  0xf0,  0x2b,  0x02,  0xfe,
-  0xac,  0x0d,  0xff,  0x10,  0x00,  0x00,  0xd7,  0xfe,  0xe8,  0x19,  0x00,  0xd6,  0xfe,  0x84,  0x01,  0xff,
-  0x03,  0x00,  0x00,  0xfe,  0x93,  0x15,  0xfe,  0x0f,  0x05,  0xff,  0x38,  0x00,  0x00,  0xfe,  0x57,  0x24,
-  0x00,  0xfe,  0x4c,  0x00,  0x5b,  0xff,  0x04,  0x00,  0x00,  0x11,  0xff,  0x09,  0x00,  0x00,  0xff,  0x08,
-  0x01,  0x01,  0xff,  0x08,  0xff,  0xff,  0xff,  0x27,  0x00,  0x00,  0xff,  0x10,  0xff,  0xff,  0xff,  0x11,
-  0x00,  0x00,  0xfe,  0x78,  0x56,  0xfe,  0x34,  0x12,  0xff,  0x21,  0x00,  0x00,  0xfe,  0x04,  0xf7,  0xd6,
-  0x2c,  0x99,  0x0a,  0x01,  0xfe,  0xc2,  0x0f,  0xfe,  0x04,  0xf7,  0xd6,  0x99,  0x0a,  0x42,  0x2c,  0xfe,
-  0x3d,  0xf0,  0xfe,  0x06,  0x02,  0xfe,  0x20,  0xf0,  0xa7,  0xfe,  0x91,  0xf0,  0xfe,  0xf4,  0x01,  0xfe,
-  0x90,  0xf0,  0xfe,  0xf4,  0x01,  0xfe,  0x8f,  0xf0,  0xa7,  0x03,  0x5d,  0x4d,  0x02,  0xfe,  0xc8,  0x0d,
-  0x01,  0xfe,  0x38,  0x0e,  0xfe,  0xdd,  0x12,  0xfe,  0xfc,  0x10,  0xfe,  0x28,  0x1c,  0x03,  0xfe,  0xa6,
-  0x00,  0xfe,  0xd3,  0x12,  0x41,  0x14,  0xfe,  0xa6,  0x00,  0xc2,  0xfe,  0x48,  0xf0,  0xfe,  0x8a,  0x02,
-  0xfe,  0x49,  0xf0,  0xfe,  0xa4,  0x02,  0xfe,  0x4a,  0xf0,  0xfe,  0xc2,  0x02,  0xfe,  0x46,  0xf0,  0xfe,
-  0x54,  0x02,  0xfe,  0x47,  0xf0,  0xfe,  0x5a,  0x02,  0xfe,  0x43,  0xf0,  0xfe,  0x48,  0x02,  0xfe,  0x44,
-  0xf0,  0xfe,  0x4c,  0x02,  0xfe,  0x45,  0xf0,  0xfe,  0x50,  0x02,  0x18,  0x0a,  0xaa,  0x18,  0x06,  0x14,
-  0xa1,  0x02,  0x2b,  0xfe,  0x00,  0x1c,  0xe7,  0xfe,  0x02,  0x1c,  0xe6,  0xfe,  0x1e,  0x1c,  0xfe,  0xe9,
-  0x10,  0x01,  0xfe,  0x18,  0x18,  0xfe,  0xe7,  0x10,  0xfe,  0x06,  0xfc,  0xce,  0x09,  0x70,  0x01,  0xa8,
-  0x02,  0x2b,  0x15,  0x59,  0x39,  0xa2,  0x01,  0xfe,  0x58,  0x10,  0x09,  0x70,  0x01,  0x87,  0xfe,  0xbd,
-  0x10,  0x09,  0x70,  0x01,  0x87,  0xfe,  0xad,  0x10,  0xfe,  0x16,  0x1c,  0xfe,  0x58,  0x1c,  0x18,  0x06,
-  0x14,  0xa1,  0x2c,  0x1c,  0x2b,  0xfe,  0x3d,  0xf0,  0xfe,  0x06,  0x02,  0x23,  0xfe,  0x98,  0x02,  0xfe,
-  0x5a,  0x1c,  0xf8,  0xfe,  0x14,  0x1c,  0x15,  0xfe,  0x30,  0x00,  0x39,  0xa2,  0x01,  0xfe,  0x48,  0x10,
-  0x18,  0x06,  0x14,  0xa1,  0x02,  0xd7,  0x22,  0x20,  0x07,  0x11,  0x35,  0xfe,  0x69,  0x10,  0x18,  0x06,
-  0x14,  0xa1,  0xfe,  0x04,  0xec,  0x20,  0x4f,  0x43,  0x13,  0x20,  0xfe,  0x05,  0xf6,  0xce,  0x01,  0xfe,
-  0x4a,  0x17,  0x08,  0x54,  0x58,  0x37,  0x12,  0x2f,  0x42,  0x92,  0x01,  0xfe,  0x82,  0x16,  0x02,  0x2b,
-  0x09,  0x46,  0x01,  0x0e,  0x07,  0x00,  0x66,  0x01,  0x73,  0xfe,  0x18,  0x10,  0xfe,  0x41,  0x58,  0x09,
-  0xa4,  0x01,  0x0e,  0xfe,  0xc8,  0x54,  0x6b,  0xfe,  0x10,  0x03,  0x01,  0xfe,  0x82,  0x16,  0x02,  0x2b,
-  0x2c,  0x4f,  0xfe,  0x02,  0xe8,  0x2a,  0xfe,  0xbf,  0x57,  0xfe,  0x9e,  0x43,  0xfe,  0x77,  0x57,  0xfe,
-  0x27,  0xf0,  0xfe,  0xe0,  0x01,  0xfe,  0x07,  0x4b,  0xfe,  0x20,  0xf0,  0xa7,  0xfe,  0x40,  0x1c,  0x1c,
-  0xd9,  0xfe,  0x26,  0xf0,  0xfe,  0x5a,  0x03,  0xfe,  0xa0,  0xf0,  0xfe,  0x48,  0x03,  0xfe,  0x11,  0xf0,
-  0xa7,  0xfe,  0xef,  0x10,  0xfe,  0x9f,  0xf0,  0xfe,  0x68,  0x03,  0xf9,  0x10,  0xfe,  0x11,  0x00,  0x02,
-  0x65,  0x2c,  0xfe,  0x48,  0x1c,  0xf9,  0x08,  0x05,  0x1b,  0xfe,  0x18,  0x13,  0x21,  0x22,  0xa3,  0xb7,
-  0x13,  0xa3,  0x09,  0x46,  0x01,  0x0e,  0xb7,  0x78,  0x01,  0xfe,  0xb4,  0x16,  0x12,  0xd1,  0x1c,  0xd9,
-  0xfe,  0x01,  0xf0,  0xd9,  0xfe,  0x82,  0xf0,  0xfe,  0x96,  0x03,  0xfa,  0x12,  0xfe,  0xe4,  0x00,  0x27,
-  0xfe,  0xa8,  0x03,  0x1c,  0x34,  0x1d,  0xfe,  0xb8,  0x03,  0x01,  0x4b,  0xfe,  0x06,  0xf0,  0xfe,  0xc8,
-  0x03,  0x95,  0x86,  0xfe,  0x0a,  0xf0,  0xfe,  0x8a,  0x06,  0x02,  0x24,  0x03,  0x70,  0x28,  0x17,  0xfe,
-  0xfa,  0x04,  0x15,  0x6d,  0x01,  0x36,  0x7b,  0xfe,  0x6a,  0x02,  0x02,  0xd8,  0xf9,  0x2c,  0x99,  0x19,
-  0xfe,  0x67,  0x1b,  0xfe,  0xbf,  0x57,  0xfe,  0x77,  0x57,  0xfe,  0x48,  0x1c,  0x74,  0x01,  0xaf,  0x8c,
-  0x09,  0x46,  0x01,  0x0e,  0x07,  0x00,  0x17,  0xda,  0x09,  0xd1,  0x01,  0x0e,  0x8d,  0x51,  0x64,  0x79,
-  0x2a,  0x03,  0x70,  0x28,  0xfe,  0x10,  0x12,  0x15,  0x6d,  0x01,  0x36,  0x7b,  0xfe,  0x6a,  0x02,  0x02,
-  0xd8,  0xc7,  0x81,  0xc8,  0x83,  0x1c,  0x24,  0x27,  0xfe,  0x40,  0x04,  0x1d,  0xfe,  0x3c,  0x04,  0x3b,
-  0xfe,  0xa0,  0x00,  0xfe,  0x9b,  0x57,  0xfe,  0x4e,  0x12,  0x2d,  0xff,  0x02,  0x00,  0x10,  0x01,  0x0b,
-  0x1d,  0xfe,  0xe4,  0x04,  0x2d,  0x01,  0x0b,  0x1d,  0x24,  0x33,  0x31,  0xde,  0xfe,  0x4c,  0x44,  0xfe,
-  0x4c,  0x12,  0x51,  0xfe,  0x44,  0x48,  0x0f,  0x6f,  0xfe,  0x4c,  0x54,  0x6b,  0xda,  0x4f,  0x79,  0x2a,
-  0xfe,  0x06,  0x80,  0xfe,  0x48,  0x47,  0xfe,  0x62,  0x13,  0x08,  0x05,  0x1b,  0xfe,  0x2a,  0x13,  0x32,
-  0x07,  0x82,  0xfe,  0x52,  0x13,  0xfe,  0x20,  0x10,  0x0f,  0x6f,  0xfe,  0x4c,  0x54,  0x6b,  0xda,  0xfe,
-  0x06,  0x80,  0xfe,  0x48,  0x47,  0xfe,  0x40,  0x13,  0x08,  0x05,  0x1b,  0xfe,  0x08,  0x13,  0x32,  0x07,
-  0x82,  0xfe,  0x30,  0x13,  0x08,  0x05,  0x1b,  0xfe,  0x1c,  0x12,  0x15,  0x9d,  0x08,  0x05,  0x06,  0x4d,
-  0x15,  0xfe,  0x0d,  0x00,  0x01,  0x36,  0x7b,  0xfe,  0x64,  0x0d,  0x02,  0x24,  0x2d,  0x12,  0xfe,  0xe6,
-  0x00,  0xfe,  0x1c,  0x90,  0xfe,  0x40,  0x5c,  0x04,  0x15,  0x9d,  0x01,  0x36,  0x02,  0x2b,  0xfe,  0x42,
-  0x5b,  0x99,  0x19,  0xfe,  0x46,  0x59,  0xfe,  0xbf,  0x57,  0xfe,  0x77,  0x57,  0xfe,  0x87,  0x80,  0xfe,
-  0x31,  0xe4,  0x5b,  0x08,  0x05,  0x0a,  0xfe,  0x84,  0x13,  0xfe,  0x20,  0x80,  0x07,  0x19,  0xfe,  0x7c,
-  0x12,  0x53,  0x05,  0x06,  0xfe,  0x6c,  0x13,  0x03,  0xfe,  0xa2,  0x00,  0x28,  0x17,  0xfe,  0x90,  0x05,
-  0xfe,  0x31,  0xe4,  0x5a,  0x53,  0x05,  0x0a,  0xfe,  0x56,  0x13,  0x03,  0xfe,  0xa0,  0x00,  0x28,  0xfe,
-  0x4e,  0x12,  0x67,  0xff,  0x02,  0x00,  0x10,  0x27,  0xfe,  0x48,  0x05,  0x1c,  0x34,  0xfe,  0x89,  0x48,
-  0xff,  0x02,  0x00,  0x10,  0x27,  0xfe,  0x56,  0x05,  0x26,  0xfe,  0xa8,  0x05,  0x12,  0xfe,  0xe3,  0x00,
-  0x21,  0x53,  0xfe,  0x4a,  0xf0,  0xfe,  0x76,  0x05,  0xfe,  0x49,  0xf0,  0xfe,  0x70,  0x05,  0x88,  0x25,
-  0xfe,  0x21,  0x00,  0xab,  0x25,  0xfe,  0x22,  0x00,  0xaa,  0x25,  0x58,  0xfe,  0x09,  0x48,  0xff,  0x02,
-  0x00,  0x10,  0x27,  0xfe,  0x86,  0x05,  0x26,  0xfe,  0xa8,  0x05,  0xfe,  0xe2,  0x08,  0x53,  0x05,  0xcb,
-  0x4d,  0x01,  0xb0,  0x25,  0x06,  0x13,  0xd3,  0x39,  0xfe,  0x27,  0x01,  0x08,  0x05,  0x1b,  0xfe,  0x22,
-  0x12,  0x41,  0x01,  0xb2,  0x15,  0x9d,  0x08,  0x05,  0x06,  0x4d,  0x15,  0xfe,  0x0d,  0x00,  0x01,  0x36,
-  0x7b,  0xfe,  0x64,  0x0d,  0x02,  0x24,  0x03,  0xfe,  0x9c,  0x00,  0x28,  0xeb,  0x03,  0x5c,  0x28,  0xfe,
-  0x36,  0x13,  0x41,  0x01,  0xb2,  0x26,  0xfe,  0x18,  0x06,  0x09,  0x06,  0x53,  0x05,  0x1f,  0xfe,  0x02,
-  0x12,  0x50,  0x01,  0xfe,  0x9e,  0x15,  0x1d,  0xfe,  0x0e,  0x06,  0x12,  0xa5,  0x01,  0x4b,  0x12,  0xfe,
-  0xe5,  0x00,  0x03,  0x5c,  0xc1,  0x0c,  0x5c,  0x03,  0xcd,  0x28,  0xfe,  0x62,  0x12,  0x03,  0x45,  0x28,
-  0xfe,  0x5a,  0x13,  0x01,  0xfe,  0x0c,  0x19,  0x01,  0xfe,  0x76,  0x19,  0xfe,  0x43,  0x48,  0xc4,  0xcc,
-  0x0f,  0x71,  0xff,  0x02,  0x00,  0x57,  0x52,  0x93,  0x1e,  0x43,  0x8b,  0xc4,  0x6e,  0x41,  0x01,  0xb2,
-  0x26,  0xfe,  0x82,  0x06,  0x53,  0x05,  0x1a,  0xe9,  0x91,  0x09,  0x59,  0x01,  0xfe,  0xcc,  0x15,  0x1d,
-  0xfe,  0x78,  0x06,  0x12,  0xa5,  0x01,  0x4b,  0x12,  0xfe,  0xe5,  0x00,  0x03,  0x45,  0xc1,  0x0c,  0x45,
-  0x18,  0x06,  0x01,  0xb2,  0xfa,  0x76,  0x74,  0x01,  0xaf,  0x8c,  0x12,  0xfe,  0xe2,  0x00,  0x27,  0xdb,
-  0x1c,  0x34,  0xfe,  0x0a,  0xf0,  0xfe,  0xb6,  0x06,  0x94,  0xfe,  0x6c,  0x07,  0xfe,  0x06,  0xf0,  0xfe,
-  0x74,  0x07,  0x95,  0x86,  0x02,  0x24,  0x08,  0x05,  0x0a,  0xfe,  0x2e,  0x12,  0x16,  0x19,  0x01,  0x0b,
-  0x16,  0x00,  0x01,  0x0b,  0x16,  0x00,  0x01,  0x0b,  0x16,  0x00,  0x01,  0x0b,  0xfe,  0x99,  0xa4,  0x01,
-  0x0b,  0x16,  0x00,  0x02,  0xfe,  0x42,  0x08,  0x68,  0x05,  0x1a,  0xfe,  0x38,  0x12,  0x08,  0x05,  0x1a,
-  0xfe,  0x30,  0x13,  0x16,  0xfe,  0x1b,  0x00,  0x01,  0x0b,  0x16,  0x00,  0x01,  0x0b,  0x16,  0x00,  0x01,
-  0x0b,  0x16,  0x00,  0x01,  0x0b,  0x16,  0x06,  0x01,  0x0b,  0x16,  0x00,  0x02,  0xe2,  0x6c,  0x58,  0xbe,
-  0x50,  0xfe,  0x9a,  0x81,  0x55,  0x1b,  0x7a,  0xfe,  0x42,  0x07,  0x09,  0x1b,  0xfe,  0x09,  0x6f,  0xba,
-  0xfe,  0xca,  0x45,  0xfe,  0x32,  0x12,  0x69,  0x6d,  0x8b,  0x6c,  0x7f,  0x27,  0xfe,  0x54,  0x07,  0x1c,
-  0x34,  0xfe,  0x0a,  0xf0,  0xfe,  0x42,  0x07,  0x95,  0x86,  0x94,  0xfe,  0x6c,  0x07,  0x02,  0x24,  0x01,
-  0x4b,  0x02,  0xdb,  0x16,  0x1f,  0x02,  0xdb,  0xfe,  0x9c,  0xf7,  0xdc,  0xfe,  0x2c,  0x90,  0xfe,  0xae,
-  0x90,  0x56,  0xfe,  0xda,  0x07,  0x0c,  0x60,  0x14,  0x61,  0x08,  0x54,  0x5a,  0x37,  0x22,  0x20,  0x07,
-  0x11,  0xfe,  0x0e,  0x12,  0x8d,  0xfe,  0x80,  0x80,  0x39,  0x20,  0x6a,  0x2a,  0xfe,  0x06,  0x10,  0xfe,
-  0x83,  0xe7,  0xfe,  0x48,  0x00,  0xab,  0xfe,  0x03,  0x40,  0x08,  0x54,  0x5b,  0x37,  0x01,  0xb3,  0xb8,
-  0xfe,  0x1f,  0x40,  0x13,  0x62,  0x01,  0xef,  0xfe,  0x08,  0x50,  0xfe,  0x8a,  0x50,  0xfe,  0x44,  0x51,
-  0xfe,  0xc6,  0x51,  0x88,  0xfe,  0x08,  0x90,  0xfe,  0x8a,  0x90,  0x0c,  0x5e,  0x14,  0x5f,  0xfe,  0x0c,
-  0x90,  0xfe,  0x8e,  0x90,  0xfe,  0x40,  0x50,  0xfe,  0xc2,  0x50,  0x0c,  0x3d,  0x14,  0x3e,  0xfe,  0x4a,
-  0x10,  0x08,  0x05,  0x5a,  0xfe,  0x2a,  0x12,  0xfe,  0x2c,  0x90,  0xfe,  0xae,  0x90,  0x0c,  0x60,  0x14,
-  0x61,  0x08,  0x05,  0x5b,  0x8b,  0x01,  0xb3,  0xfe,  0x1f,  0x80,  0x13,  0x62,  0xfe,  0x44,  0x90,  0xfe,
-  0xc6,  0x90,  0x0c,  0x3f,  0x14,  0x40,  0xfe,  0x08,  0x90,  0xfe,  0x8a,  0x90,  0x0c,  0x5e,  0x14,  0x5f,
-  0xfe,  0x40,  0x90,  0xfe,  0xc2,  0x90,  0x0c,  0x3d,  0x14,  0x3e,  0x0c,  0x2e,  0x14,  0x3c,  0x21,  0x0c,
-  0x49,  0x0c,  0x63,  0x08,  0x54,  0x1f,  0x37,  0x2c,  0x0f,  0xfe,  0x4e,  0x11,  0x27,  0xdd,  0xfe,  0x9e,
-  0xf0,  0xfe,  0x76,  0x08,  0xbc,  0x17,  0x34,  0x2c,  0x77,  0xe6,  0xc5,  0xfe,  0x9a,  0x08,  0xc6,  0xfe,
-  0xb8,  0x08,  0x94,  0xfe,  0x8e,  0x08,  0xfe,  0x06,  0xf0,  0xfe,  0x94,  0x08,  0x95,  0x86,  0x02,  0x24,
-  0x01,  0x4b,  0xfe,  0xc9,  0x10,  0x16,  0x1f,  0xfe,  0xc9,  0x10,  0x68,  0x05,  0x06,  0xfe,  0x10,  0x12,
-  0x68,  0x05,  0x0a,  0x4e,  0x08,  0x05,  0x0a,  0xfe,  0x90,  0x12,  0xfe,  0x2e,  0x1c,  0x02,  0xfe,  0x18,
-  0x0b,  0x68,  0x05,  0x06,  0x4e,  0x68,  0x05,  0x0a,  0xfe,  0x7a,  0x12,  0xfe,  0x2c,  0x1c,  0xfe,  0xaa,
-  0xf0,  0xfe,  0xd2,  0x09,  0xfe,  0xac,  0xf0,  0xfe,  0x00,  0x09,  0x02,  0xfe,  0xde,  0x09,  0xfe,  0xb7,
-  0xf0,  0xfe,  0xfc,  0x08,  0xfe,  0x02,  0xf6,  0x1a,  0x50,  0xfe,  0x70,  0x18,  0xfe,  0xf1,  0x18,  0xfe,
-  0x40,  0x55,  0xfe,  0xe1,  0x55,  0xfe,  0x10,  0x58,  0xfe,  0x91,  0x58,  0xfe,  0x14,  0x59,  0xfe,  0x95,
-  0x59,  0x1c,  0x85,  0xfe,  0x8c,  0xf0,  0xfe,  0xfc,  0x08,  0xfe,  0xac,  0xf0,  0xfe,  0xf0,  0x08,  0xb5,
-  0xfe,  0xcb,  0x10,  0xfe,  0xad,  0xf0,  0xfe,  0x0c,  0x09,  0x02,  0xfe,  0x18,  0x0b,  0xb6,  0xfe,  0xbf,
-  0x10,  0xfe,  0x2b,  0xf0,  0x85,  0xf4,  0x1e,  0xfe,  0x00,  0xfe,  0xfe,  0x1c,  0x12,  0xc2,  0xfe,  0xd2,
-  0xf0,  0x85,  0xfe,  0x76,  0x18,  0x1e,  0x19,  0x17,  0x85,  0x03,  0xd2,  0x1e,  0x06,  0x17,  0x85,  0xc5,
-  0x4a,  0xc6,  0x4a,  0xb5,  0xb6,  0xfe,  0x89,  0x10,  0x74,  0x67,  0x2d,  0x15,  0x9d,  0x01,  0x36,  0x10,
-  0xfe,  0x35,  0x00,  0xfe,  0x01,  0xf0,  0x65,  0x10,  0x80,  0x02,  0x65,  0xfe,  0x98,  0x80,  0xfe,  0x19,
-  0xe4,  0x0a,  0xfe,  0x1a,  0x12,  0x51,  0xfe,  0x19,  0x82,  0xfe,  0x6c,  0x18,  0xfe,  0x44,  0x54,  0xbe,
-  0xfe,  0x19,  0x81,  0xfe,  0x74,  0x18,  0x8f,  0x90,  0x17,  0xfe,  0xce,  0x08,  0x02,  0x4a,  0x08,  0x05,
-  0x5a,  0xec,  0x03,  0x2e,  0x29,  0x3c,  0x0c,  0x3f,  0x14,  0x40,  0x9b,  0x2e,  0x9c,  0x3c,  0xfe,  0x6c,
-  0x18,  0xfe,  0xed,  0x18,  0xfe,  0x44,  0x54,  0xfe,  0xe5,  0x54,  0x3a,  0x3f,  0x3b,  0x40,  0x03,  0x49,
-  0x29,  0x63,  0x8f,  0xfe,  0xe3,  0x54,  0xfe,  0x74,  0x18,  0xfe,  0xf5,  0x18,  0x8f,  0xfe,  0xe3,  0x54,
-  0x90,  0xc0,  0x56,  0xfe,  0xce,  0x08,  0x02,  0x4a,  0xfe,  0x37,  0xf0,  0xfe,  0xda,  0x09,  0xfe,  0x8b,
-  0xf0,  0xfe,  0x60,  0x09,  0x02,  0x4a,  0x08,  0x05,  0x0a,  0x23,  0xfe,  0xfa,  0x0a,  0x3a,  0x49,  0x3b,
-  0x63,  0x56,  0xfe,  0x3e,  0x0a,  0x0f,  0xfe,  0xc0,  0x07,  0x41,  0x98,  0x00,  0xad,  0xfe,  0x01,  0x59,
-  0xfe,  0x52,  0xf0,  0xfe,  0x0c,  0x0a,  0x8f,  0x7a,  0xfe,  0x24,  0x0a,  0x3a,  0x49,  0x8f,  0xfe,  0xe3,
-  0x54,  0x57,  0x49,  0x7d,  0x63,  0xfe,  0x14,  0x58,  0xfe,  0x95,  0x58,  0x02,  0x4a,  0x3a,  0x49,  0x3b,
-  0x63,  0xfe,  0x14,  0x59,  0xfe,  0x95,  0x59,  0xbe,  0x57,  0x49,  0x57,  0x63,  0x02,  0x4a,  0x08,  0x05,
-  0x5a,  0xfe,  0x82,  0x12,  0x08,  0x05,  0x1f,  0xfe,  0x66,  0x13,  0x22,  0x62,  0xb7,  0xfe,  0x03,  0xa1,
-  0xfe,  0x83,  0x80,  0xfe,  0xc8,  0x44,  0xfe,  0x2e,  0x13,  0xfe,  0x04,  0x91,  0xfe,  0x86,  0x91,  0x6a,
-  0x2a,  0xfe,  0x40,  0x59,  0xfe,  0xc1,  0x59,  0x56,  0xe0,  0x03,  0x60,  0x29,  0x61,  0x0c,  0x7f,  0x14,
-  0x80,  0x57,  0x60,  0x7d,  0x61,  0x01,  0xb3,  0xb8,  0x6a,  0x2a,  0x13,  0x62,  0x9b,  0x2e,  0x9c,  0x3c,
-  0x3a,  0x3f,  0x3b,  0x40,  0x90,  0xc0,  0xfe,  0x04,  0xfa,  0x2e,  0xfe,  0x05,  0xfa,  0x3c,  0x01,  0xef,
-  0xfe,  0x36,  0x10,  0x21,  0x0c,  0x7f,  0x0c,  0x80,  0x3a,  0x3f,  0x3b,  0x40,  0xe4,  0x08,  0x05,  0x1f,
-  0x17,  0xe0,  0x3a,  0x3d,  0x3b,  0x3e,  0x08,  0x05,  0xfe,  0xf7,  0x00,  0x37,  0x03,  0x5e,  0x29,  0x5f,
-  0xfe,  0x10,  0x58,  0xfe,  0x91,  0x58,  0x57,  0x49,  0x7d,  0x63,  0x02,  0xfe,  0xf4,  0x09,  0x08,  0x05,
-  0x1f,  0x17,  0xe0,  0x08,  0x05,  0xfe,  0xf7,  0x00,  0x37,  0xbe,  0xfe,  0x19,  0x81,  0x50,  0xfe,  0x10,
-  0x90,  0xfe,  0x92,  0x90,  0xfe,  0xd3,  0x10,  0x32,  0x07,  0xa6,  0x17,  0xfe,  0x08,  0x09,  0x12,  0xa6,
-  0x08,  0x05,  0x0a,  0xfe,  0x14,  0x13,  0x03,  0x3d,  0x29,  0x3e,  0x56,  0xfe,  0x08,  0x09,  0xfe,  0x0c,
-  0x58,  0xfe,  0x8d,  0x58,  0x02,  0x4a,  0x21,  0x41,  0xfe,  0x19,  0x80,  0xe7,  0x08,  0x05,  0x0a,  0xfe,
-  0x1a,  0x12,  0xfe,  0x6c,  0x19,  0xfe,  0x19,  0x41,  0xf4,  0xc2,  0xfe,  0xd1,  0xf0,  0xe2,  0x15,  0x7e,
-  0x01,  0x36,  0x10,  0xfe,  0x44,  0x00,  0xfe,  0x8e,  0x10,  0xfe,  0x6c,  0x19,  0x57,  0x3d,  0xfe,  0xed,
-  0x19,  0x7d,  0x3e,  0xfe,  0x0c,  0x51,  0xfe,  0x8e,  0x51,  0xf4,  0x1e,  0xfe,  0x00,  0xff,  0x35,  0xfe,
-  0x74,  0x10,  0xc2,  0xfe,  0xd2,  0xf0,  0xfe,  0xa6,  0x0b,  0xfe,  0x76,  0x18,  0x1e,  0x19,  0x8a,  0x03,
-  0xd2,  0x1e,  0x06,  0xfe,  0x08,  0x13,  0x10,  0xfe,  0x16,  0x00,  0x02,  0x65,  0xfe,  0xd1,  0xf0,  0xfe,
-  0xb8,  0x0b,  0x15,  0x7e,  0x01,  0x36,  0x10,  0xfe,  0x17,  0x00,  0xfe,  0x42,  0x10,  0xfe,  0xce,  0xf0,
-  0xfe,  0xbe,  0x0b,  0xfe,  0x3c,  0x10,  0xfe,  0xcd,  0xf0,  0xfe,  0xca,  0x0b,  0x10,  0xfe,  0x22,  0x00,
-  0x02,  0x65,  0xfe,  0xcb,  0xf0,  0xfe,  0xd6,  0x0b,  0x10,  0xfe,  0x24,  0x00,  0x02,  0x65,  0xfe,  0xd0,
-  0xf0,  0xfe,  0xe0,  0x0b,  0x10,  0x9e,  0xe5,  0xfe,  0xcf,  0xf0,  0xfe,  0xea,  0x0b,  0x10,  0x58,  0xfe,
-  0x10,  0x10,  0xfe,  0xcc,  0xf0,  0xe2,  0x68,  0x05,  0x1f,  0x4d,  0x10,  0xfe,  0x12,  0x00,  0x2c,  0x0f,
-  0xfe,  0x4e,  0x11,  0x27,  0xfe,  0x00,  0x0c,  0xfe,  0x9e,  0xf0,  0xfe,  0x14,  0x0c,  0xbc,  0x17,  0x34,
-  0x2c,  0x77,  0xe6,  0xc5,  0x24,  0xc6,  0x24,  0x2c,  0xfa,  0x27,  0xfe,  0x20,  0x0c,  0x1c,  0x34,  0x94,
-  0xfe,  0x3c,  0x0c,  0x95,  0x86,  0xc5,  0xdc,  0xc6,  0xdc,  0x02,  0x24,  0x01,  0x4b,  0xfe,  0xdb,  0x10,
-  0x12,  0xfe,  0xe8,  0x00,  0xb5,  0xb6,  0x74,  0xc7,  0x81,  0xc8,  0x83,  0xfe,  0x89,  0xf0,  0x24,  0x33,
-  0x31,  0xe1,  0xc7,  0x81,  0xc8,  0x83,  0x27,  0xfe,  0x66,  0x0c,  0x1d,  0x24,  0x33,  0x31,  0xdf,  0xbc,
-  0x4e,  0x10,  0xfe,  0x42,  0x00,  0x02,  0x65,  0x7c,  0x06,  0xfe,  0x81,  0x49,  0x17,  0xfe,  0x2c,  0x0d,
-  0x08,  0x05,  0x0a,  0xfe,  0x44,  0x13,  0x10,  0x00,  0x55,  0x0a,  0xfe,  0x54,  0x12,  0x55,  0xfe,  0x28,
-  0x00,  0x23,  0xfe,  0x9a,  0x0d,  0x09,  0x46,  0x01,  0x0e,  0x07,  0x00,  0x66,  0x44,  0xfe,  0x28,  0x00,
-  0xfe,  0xe2,  0x10,  0x01,  0xf5,  0x01,  0xf6,  0x09,  0xa4,  0x01,  0xfe,  0x26,  0x0f,  0x64,  0x12,  0x2f,
-  0x01,  0x73,  0x02,  0x2b,  0x10,  0xfe,  0x44,  0x00,  0x55,  0x0a,  0xe9,  0x44,  0x0a,  0xfe,  0xb4,  0x10,
-  0x01,  0xb0,  0x44,  0x0a,  0xfe,  0xaa,  0x10,  0x01,  0xb0,  0xfe,  0x19,  0x82,  0xfe,  0x34,  0x46,  0xac,
-  0x44,  0x0a,  0x10,  0xfe,  0x43,  0x00,  0xfe,  0x96,  0x10,  0x08,  0x54,  0x0a,  0x37,  0x01,  0xf5,  0x01,
-  0xf6,  0x64,  0x12,  0x2f,  0x01,  0x73,  0x99,  0x0a,  0x64,  0x42,  0x92,  0x02,  0xfe,  0x2e,  0x03,  0x08,
-  0x05,  0x0a,  0x8a,  0x44,  0x0a,  0x10,  0x00,  0xfe,  0x5c,  0x10,  0x68,  0x05,  0x1a,  0xfe,  0x58,  0x12,
-  0x08,  0x05,  0x1a,  0xfe,  0x50,  0x13,  0xfe,  0x1c,  0x1c,  0xfe,  0x9d,  0xf0,  0xfe,  0x50,  0x0d,  0xfe,
-  0x1c,  0x1c,  0xfe,  0x9d,  0xf0,  0xfe,  0x56,  0x0d,  0x08,  0x54,  0x1a,  0x37,  0xfe,  0xa9,  0x10,  0x10,
-  0xfe,  0x15,  0x00,  0xfe,  0x04,  0xe6,  0x0a,  0x50,  0xfe,  0x2e,  0x10,  0x10,  0xfe,  0x13,  0x00,  0xfe,
-  0x10,  0x10,  0x10,  0x6f,  0xab,  0x10,  0xfe,  0x41,  0x00,  0xaa,  0x10,  0xfe,  0x24,  0x00,  0x8c,  0xb5,
-  0xb6,  0x74,  0x03,  0x70,  0x28,  0x23,  0xd8,  0x50,  0xfe,  0x04,  0xe6,  0x1a,  0xfe,  0x9d,  0x41,  0xfe,
-  0x1c,  0x42,  0x64,  0x01,  0xe3,  0x02,  0x2b,  0xf8,  0x15,  0x0a,  0x39,  0xa0,  0xb4,  0x15,  0xfe,  0x31,
-  0x00,  0x39,  0xa2,  0x01,  0xfe,  0x48,  0x10,  0x02,  0xd7,  0x42,  0xfe,  0x06,  0xec,  0xd0,  0xfc,  0x44,
-  0x1b,  0xfe,  0xce,  0x45,  0x35,  0x42,  0xfe,  0x06,  0xea,  0xd0,  0xfe,  0x47,  0x4b,  0x91,  0xfe,  0x75,
-  0x57,  0x03,  0x5d,  0xfe,  0x98,  0x56,  0xfe,  0x38,  0x12,  0x09,  0x48,  0x01,  0x0e,  0xfe,  0x44,  0x48,
-  0x4f,  0x08,  0x05,  0x1b,  0xfe,  0x1a,  0x13,  0x09,  0x46,  0x01,  0x0e,  0x41,  0xfe,  0x41,  0x58,  0x09,
-  0xa4,  0x01,  0x0e,  0xfe,  0x49,  0x54,  0x96,  0xfe,  0x1e,  0x0e,  0x02,  0xfe,  0x2e,  0x03,  0x09,  0x5d,
-  0xfe,  0xee,  0x14,  0xfc,  0x44,  0x1b,  0xfe,  0xce,  0x45,  0x35,  0x42,  0xfe,  0xce,  0x47,  0xfe,  0xad,
-  0x13,  0x02,  0x2b,  0x22,  0x20,  0x07,  0x11,  0xfe,  0x9e,  0x12,  0x21,  0x13,  0x59,  0x13,  0x9f,  0x13,
-  0xd5,  0x22,  0x2f,  0x41,  0x39,  0x2f,  0xbc,  0xad,  0xfe,  0xbc,  0xf0,  0xfe,  0xe0,  0x0e,  0x0f,  0x06,
-  0x13,  0x59,  0x01,  0xfe,  0xda,  0x16,  0x03,  0xfe,  0x38,  0x01,  0x29,  0xfe,  0x3a,  0x01,  0x56,  0xfe,
-  0xe4,  0x0e,  0xfe,  0x02,  0xec,  0xd5,  0x69,  0x00,  0x66,  0xfe,  0x04,  0xec,  0x20,  0x4f,  0xfe,  0x05,
-  0xf6,  0xfe,  0x34,  0x01,  0x01,  0xfe,  0x4a,  0x17,  0xfe,  0x08,  0x90,  0xfe,  0x48,  0xf4,  0x0d,  0xfe,
-  0x18,  0x13,  0xba,  0xfe,  0x02,  0xea,  0xd5,  0x69,  0x7e,  0xfe,  0xc5,  0x13,  0x15,  0x1a,  0x39,  0xa0,
-  0xb4,  0xfe,  0x2e,  0x10,  0x03,  0xfe,  0x38,  0x01,  0x1e,  0xfe,  0xf0,  0xff,  0x0c,  0xfe,  0x60,  0x01,
-  0x03,  0xfe,  0x3a,  0x01,  0x0c,  0xfe,  0x62,  0x01,  0x43,  0x13,  0x20,  0x25,  0x06,  0x13,  0x2f,  0x12,
-  0x2f,  0x92,  0x0f,  0x06,  0x04,  0x21,  0x04,  0x22,  0x59,  0xfe,  0xf7,  0x12,  0x22,  0x9f,  0xb7,  0x13,
-  0x9f,  0x07,  0x7e,  0xfe,  0x71,  0x13,  0xfe,  0x24,  0x1c,  0x15,  0x19,  0x39,  0xa0,  0xb4,  0xfe,  0xd9,
-  0x10,  0xc3,  0xfe,  0x03,  0xdc,  0xfe,  0x73,  0x57,  0xfe,  0x80,  0x5d,  0x04,  0xc3,  0xfe,  0x03,  0xdc,
-  0xfe,  0x5b,  0x57,  0xfe,  0x80,  0x5d,  0x04,  0xfe,  0x03,  0x57,  0xc3,  0x21,  0xfe,  0x00,  0xcc,  0x04,
-  0xfe,  0x03,  0x57,  0xc3,  0x78,  0x04,  0x08,  0x05,  0x58,  0xfe,  0x22,  0x13,  0xfe,  0x1c,  0x80,  0x07,
-  0x06,  0xfe,  0x1a,  0x13,  0xfe,  0x1e,  0x80,  0xed,  0xfe,  0x1d,  0x80,  0xae,  0xfe,  0x0c,  0x90,  0xfe,
-  0x0e,  0x13,  0xfe,  0x0e,  0x90,  0xac,  0xfe,  0x3c,  0x90,  0xfe,  0x30,  0xf4,  0x0a,  0xfe,  0x3c,  0x50,
-  0xaa,  0x01,  0xfe,  0x7a,  0x17,  0x32,  0x07,  0x2f,  0xad,  0x01,  0xfe,  0xb4,  0x16,  0x08,  0x05,  0x1b,
-  0x4e,  0x01,  0xf5,  0x01,  0xf6,  0x12,  0xfe,  0xe9,  0x00,  0x08,  0x05,  0x58,  0xfe,  0x2c,  0x13,  0x01,
-  0xfe,  0x0c,  0x17,  0xfe,  0x1e,  0x1c,  0xfe,  0x14,  0x90,  0xfe,  0x96,  0x90,  0x0c,  0xfe,  0x64,  0x01,
-  0x14,  0xfe,  0x66,  0x01,  0x08,  0x05,  0x5b,  0xfe,  0x12,  0x12,  0xfe,  0x03,  0x80,  0x8d,  0xfe,  0x01,
-  0xec,  0x20,  0xfe,  0x80,  0x40,  0x13,  0x20,  0x6a,  0x2a,  0x12,  0xcf,  0x64,  0x22,  0x20,  0xfb,  0x79,
-  0x20,  0x04,  0xfe,  0x08,  0x1c,  0x03,  0xfe,  0xac,  0x00,  0xfe,  0x06,  0x58,  0x03,  0xfe,  0xae,  0x00,
-
-  0xfe,  0x07,  0x58,  0x03,  0xfe,  0xb0,  0x00,  0xfe,  0x08,  0x58,  0x03,  0xfe,  0xb2,  0x00,  0xfe,  0x09,
-  0x58,  0xfe,  0x0a,  0x1c,  0x25,  0x6e,  0x13,  0xd0,  0x21,  0x0c,  0x5c,  0x0c,  0x45,  0x0f,  0x46,  0x52,
-  0x50,  0x18,  0x1b,  0xfe,  0x90,  0x4d,  0xfe,  0x91,  0x54,  0x23,  0xfe,  0xfc,  0x0f,  0x44,  0x11,  0x0f,
-  0x48,  0x52,  0x18,  0x58,  0xfe,  0x90,  0x4d,  0xfe,  0x91,  0x54,  0x23,  0xe4,  0x25,  0x11,  0x13,  0x20,
-  0x7c,  0x6f,  0x4f,  0x22,  0x20,  0xfb,  0x79,  0x20,  0x12,  0xcf,  0xfe,  0x14,  0x56,  0xfe,  0xd6,  0xf0,
-  0xfe,  0x26,  0x10,  0xf8,  0x74,  0xfe,  0x14,  0x1c,  0xfe,  0x10,  0x1c,  0xfe,  0x18,  0x1c,  0x04,  0x42,
-  0xfe,  0x0c,  0x14,  0xfc,  0xfe,  0x07,  0xe6,  0x1b,  0xfe,  0xce,  0x47,  0xfe,  0xf5,  0x13,  0x04,  0x01,
-  0xb0,  0x7c,  0x6f,  0x4f,  0xfe,  0x06,  0x80,  0xfe,  0x48,  0x47,  0xfe,  0x42,  0x13,  0x32,  0x07,  0x2f,
-  0xfe,  0x34,  0x13,  0x09,  0x48,  0x01,  0x0e,  0xbb,  0xfe,  0x36,  0x12,  0xfe,  0x41,  0x48,  0xfe,  0x45,
-  0x48,  0x01,  0xf0,  0xfe,  0x00,  0xcc,  0xbb,  0xfe,  0xf3,  0x13,  0x43,  0x78,  0x07,  0x11,  0xac,  0x09,
-  0x84,  0x01,  0x0e,  0xfe,  0x80,  0x5c,  0x01,  0x73,  0xfe,  0x0e,  0x10,  0x07,  0x82,  0x4e,  0xfe,  0x14,
-  0x56,  0xfe,  0xd6,  0xf0,  0xfe,  0x60,  0x10,  0x04,  0xfe,  0x44,  0x58,  0x8d,  0xfe,  0x01,  0xec,  0xa2,
-  0xfe,  0x9e,  0x40,  0xfe,  0x9d,  0xe7,  0x00,  0xfe,  0x9c,  0xe7,  0x1a,  0x79,  0x2a,  0x01,  0xe3,  0xfe,
-  0xdd,  0x10,  0x2c,  0xc7,  0x81,  0xc8,  0x83,  0x33,  0x31,  0xde,  0x07,  0x1a,  0xfe,  0x48,  0x12,  0x07,
-  0x0a,  0xfe,  0x56,  0x12,  0x07,  0x19,  0xfe,  0x30,  0x12,  0x07,  0xc9,  0x17,  0xfe,  0x32,  0x12,  0x07,
-  0xfe,  0x23,  0x00,  0x17,  0xeb,  0x07,  0x06,  0x17,  0xfe,  0x9c,  0x12,  0x07,  0x1f,  0xfe,  0x12,  0x12,
-  0x07,  0x00,  0x17,  0x24,  0x15,  0xc9,  0x01,  0x36,  0xa9,  0x2d,  0x01,  0x0b,  0x94,  0x4b,  0x04,  0x2d,
-  0xdd,  0x09,  0xd1,  0x01,  0xfe,  0x26,  0x0f,  0x12,  0x82,  0x02,  0x2b,  0x2d,  0x32,  0x07,  0xa6,  0xfe,
-  0xd9,  0x13,  0x3a,  0x3d,  0x3b,  0x3e,  0x56,  0xfe,  0xf0,  0x11,  0x08,  0x05,  0x5a,  0xfe,  0x72,  0x12,
-  0x9b,  0x2e,  0x9c,  0x3c,  0x90,  0xc0,  0x96,  0xfe,  0xba,  0x11,  0x22,  0x62,  0xfe,  0x26,  0x13,  0x03,
-  0x7f,  0x29,  0x80,  0x56,  0xfe,  0x76,  0x0d,  0x0c,  0x60,  0x14,  0x61,  0x21,  0x0c,  0x7f,  0x0c,  0x80,
-  0x01,  0xb3,  0x25,  0x6e,  0x77,  0x13,  0x62,  0x01,  0xef,  0x9b,  0x2e,  0x9c,  0x3c,  0xfe,  0x04,  0x55,
-  0xfe,  0xa5,  0x55,  0xfe,  0x04,  0xfa,  0x2e,  0xfe,  0x05,  0xfa,  0x3c,  0xfe,  0x91,  0x10,  0x03,  0x3f,
-  0x29,  0x40,  0xfe,  0x40,  0x56,  0xfe,  0xe1,  0x56,  0x0c,  0x3f,  0x14,  0x40,  0x88,  0x9b,  0x2e,  0x9c,
-  0x3c,  0x90,  0xc0,  0x03,  0x5e,  0x29,  0x5f,  0xfe,  0x00,  0x56,  0xfe,  0xa1,  0x56,  0x0c,  0x5e,  0x14,
-  0x5f,  0x08,  0x05,  0x5a,  0xfe,  0x1e,  0x12,  0x22,  0x62,  0xfe,  0x1f,  0x40,  0x03,  0x60,  0x29,  0x61,
-  0xfe,  0x2c,  0x50,  0xfe,  0xae,  0x50,  0x03,  0x3f,  0x29,  0x40,  0xfe,  0x44,  0x50,  0xfe,  0xc6,  0x50,
-  0x03,  0x5e,  0x29,  0x5f,  0xfe,  0x08,  0x50,  0xfe,  0x8a,  0x50,  0x03,  0x3d,  0x29,  0x3e,  0xfe,  0x40,
-  0x50,  0xfe,  0xc2,  0x50,  0x02,  0x89,  0x25,  0x06,  0x13,  0xd4,  0x02,  0x72,  0x2d,  0x01,  0x0b,  0x1d,
-  0x4c,  0x33,  0x31,  0xde,  0x07,  0x06,  0x23,  0x4c,  0x32,  0x07,  0xa6,  0x23,  0x72,  0x01,  0xaf,  0x1e,
-  0x43,  0x17,  0x4c,  0x08,  0x05,  0x0a,  0xee,  0x3a,  0x3d,  0x3b,  0x3e,  0xfe,  0x0a,  0x55,  0x35,  0xfe,
-  0x8b,  0x55,  0x57,  0x3d,  0x7d,  0x3e,  0xfe,  0x0c,  0x51,  0xfe,  0x8e,  0x51,  0x02,  0x72,  0xfe,  0x19,
-  0x81,  0xba,  0xfe,  0x19,  0x41,  0x02,  0x72,  0x2d,  0x01,  0x0b,  0x1c,  0x34,  0x1d,  0xe8,  0x33,  0x31,
-  0xe1,  0x55,  0x19,  0xfe,  0xa6,  0x12,  0x55,  0x0a,  0x4d,  0x02,  0x4c,  0x01,  0x0b,  0x1c,  0x34,  0x1d,
-  0xe8,  0x33,  0x31,  0xdf,  0x07,  0x19,  0x23,  0x4c,  0x01,  0x0b,  0x1d,  0xe8,  0x33,  0x31,  0xfe,  0xe8,
-  0x09,  0xfe,  0xc2,  0x49,  0x51,  0x03,  0xfe,  0x9c,  0x00,  0x28,  0x8a,  0x53,  0x05,  0x1f,  0x35,  0xa9,
-  0xfe,  0xbb,  0x45,  0x55,  0x00,  0x4e,  0x44,  0x06,  0x7c,  0x43,  0xfe,  0xda,  0x14,  0x01,  0xaf,  0x8c,
-  0xfe,  0x4b,  0x45,  0xee,  0x32,  0x07,  0xa5,  0xed,  0x03,  0xcd,  0x28,  0x8a,  0x03,  0x45,  0x28,  0x35,
-  0x67,  0x02,  0x72,  0xfe,  0xc0,  0x5d,  0xfe,  0xf8,  0x14,  0xfe,  0x03,  0x17,  0x03,  0x5c,  0xc1,  0x0c,
-  0x5c,  0x67,  0x2d,  0x01,  0x0b,  0x26,  0x89,  0x01,  0xfe,  0x9e,  0x15,  0x02,  0x89,  0x01,  0x0b,  0x1c,
-  0x34,  0x1d,  0x4c,  0x33,  0x31,  0xdf,  0x07,  0x06,  0x23,  0x4c,  0x01,  0xf1,  0xfe,  0x42,  0x58,  0xf1,
-  0xfe,  0xa4,  0x14,  0x8c,  0xfe,  0x4a,  0xf4,  0x0a,  0x17,  0x4c,  0xfe,  0x4a,  0xf4,  0x06,  0xea,  0x32,
-  0x07,  0xa5,  0x8b,  0x02,  0x72,  0x03,  0x45,  0xc1,  0x0c,  0x45,  0x67,  0x2d,  0x01,  0x0b,  0x26,  0x89,
-  0x01,  0xfe,  0xcc,  0x15,  0x02,  0x89,  0x0f,  0x06,  0x27,  0xfe,  0xbe,  0x13,  0x26,  0xfe,  0xd4,  0x13,
-  0x76,  0xfe,  0x89,  0x48,  0x01,  0x0b,  0x21,  0x76,  0x04,  0x7b,  0xfe,  0xd0,  0x13,  0x1c,  0xfe,  0xd0,
-  0x13,  0x1d,  0xfe,  0xbe,  0x13,  0x67,  0x2d,  0x01,  0x0b,  0xfe,  0xd5,  0x10,  0x0f,  0x71,  0xff,  0x02,
-  0x00,  0x57,  0x52,  0x93,  0x1e,  0xfe,  0xff,  0x7f,  0xfe,  0x30,  0x56,  0xfe,  0x00,  0x5c,  0x04,  0x0f,
-  0x71,  0xff,  0x02,  0x00,  0x57,  0x52,  0x93,  0x1e,  0x43,  0xfe,  0x30,  0x56,  0xfe,  0x00,  0x5c,  0x04,
-  0x0f,  0x71,  0xff,  0x02,  0x00,  0x57,  0x52,  0x93,  0x04,  0x0f,  0x71,  0xff,  0x02,  0x00,  0x57,  0x52,
-  0x93,  0xfe,  0x0b,  0x58,  0x04,  0x09,  0x5c,  0x01,  0x87,  0x09,  0x45,  0x01,  0x87,  0x04,  0xfe,  0x03,
-  0xa1,  0x1e,  0x11,  0xff,  0x03,  0x00,  0x54,  0xfe,  0x00,  0xf4,  0x1f,  0x52,  0xfe,  0x00,  0x7d,  0xfe,
-  0x01,  0x7d,  0xfe,  0x02,  0x7d,  0xfe,  0x03,  0x7c,  0x6a,  0x2a,  0x0c,  0x5e,  0x14,  0x5f,  0x57,  0x3f,
-  0x7d,  0x40,  0x04,  0xdd,  0xfe,  0x82,  0x4a,  0xfe,  0xe1,  0x1a,  0xfe,  0x83,  0x5a,  0x8d,  0x04,  0x01,
-  0xfe,  0x0c,  0x19,  0xfe,  0x42,  0x48,  0x50,  0x51,  0x91,  0x01,  0x0b,  0x1d,  0xfe,  0x96,  0x15,  0x33,
-  0x31,  0xe1,  0x01,  0x0b,  0x1d,  0xfe,  0x96,  0x15,  0x33,  0x31,  0xfe,  0xe8,  0x0a,  0xfe,  0xc1,  0x59,
-  0x03,  0xcd,  0x28,  0xfe,  0xcc,  0x12,  0x53,  0x05,  0x1a,  0xfe,  0xc4,  0x13,  0x21,  0x69,  0x1a,  0xee,
-  0x55,  0xca,  0x6b,  0xfe,  0xdc,  0x14,  0x4d,  0x0f,  0x06,  0x18,  0xca,  0x7c,  0x30,  0xfe,  0x78,  0x10,
-  0xff,  0x02,  0x83,  0x55,  0xab,  0xff,  0x02,  0x83,  0x55,  0x69,  0x19,  0xae,  0x98,  0xfe,  0x30,  0x00,
-  0x96,  0xf2,  0x18,  0x6d,  0x0f,  0x06,  0xfe,  0x56,  0x10,  0x69,  0x0a,  0xed,  0x98,  0xfe,  0x64,  0x00,
-  0x96,  0xf2,  0x09,  0xfe,  0x64,  0x00,  0x18,  0x9e,  0x0f,  0x06,  0xfe,  0x28,  0x10,  0x69,  0x06,  0xfe,
-  0x60,  0x13,  0x98,  0xfe,  0xc8,  0x00,  0x96,  0xf2,  0x09,  0xfe,  0xc8,  0x00,  0x18,  0x59,  0x0f,  0x06,
-  0x88,  0x98,  0xfe,  0x90,  0x01,  0x7a,  0xfe,  0x42,  0x15,  0x91,  0xe4,  0xfe,  0x43,  0xf4,  0x9f,  0xfe,
-  0x56,  0xf0,  0xfe,  0x54,  0x15,  0xfe,  0x04,  0xf4,  0x71,  0xfe,  0x43,  0xf4,  0x9e,  0xfe,  0xf3,  0x10,
-  0xfe,  0x40,  0x5c,  0x01,  0xfe,  0x16,  0x14,  0x1e,  0x43,  0xec,  0xfe,  0x00,  0x17,  0xfe,  0x4d,  0xe4,
-  0x6e,  0x7a,  0xfe,  0x90,  0x15,  0xc4,  0x6e,  0xfe,  0x1c,  0x10,  0xfe,  0x00,  0x17,  0xfe,  0x4d,  0xe4,
-  0xcc,  0x7a,  0xfe,  0x90,  0x15,  0xc4,  0xcc,  0x88,  0x51,  0x21,  0xfe,  0x4d,  0xf4,  0x00,  0xe9,  0x91,
-  0x0f,  0x06,  0xfe,  0xb4,  0x56,  0xfe,  0xc3,  0x58,  0x04,  0x51,  0x0f,  0x0a,  0x04,  0x16,  0x06,  0x01,
-  0x0b,  0x26,  0xf3,  0x16,  0x0a,  0x01,  0x0b,  0x26,  0xf3,  0x16,  0x19,  0x01,  0x0b,  0x26,  0xf3,  0x76,
-  0xfe,  0x89,  0x49,  0x01,  0x0b,  0x04,  0x16,  0x06,  0x01,  0x0b,  0x26,  0xb1,  0x16,  0x19,  0x01,  0x0b,
-  0x26,  0xb1,  0x16,  0x06,  0x01,  0x0b,  0x26,  0xb1,  0xfe,  0x89,  0x49,  0x01,  0x0b,  0x26,  0xb1,  0x76,
-  0xfe,  0x89,  0x4a,  0x01,  0x0b,  0x04,  0x51,  0x04,  0x22,  0xd3,  0x07,  0x06,  0xfe,  0x48,  0x13,  0xb8,
-  0x13,  0xd3,  0xfe,  0x49,  0xf4,  0x00,  0x4d,  0x76,  0xa9,  0x67,  0xfe,  0x01,  0xec,  0xfe,  0x27,  0x01,
-  0xfe,  0x89,  0x48,  0xff,  0x02,  0x00,  0x10,  0x27,  0xfe,  0x2e,  0x16,  0x32,  0x07,  0xfe,  0xe3,  0x00,
-  0xfe,  0x20,  0x13,  0x1d,  0xfe,  0x52,  0x16,  0x21,  0x13,  0xd4,  0x01,  0x4b,  0x22,  0xd4,  0x07,  0x06,
-  0x4e,  0x08,  0x54,  0x06,  0x37,  0x04,  0x09,  0x48,  0x01,  0x0e,  0xfb,  0x8e,  0x07,  0x11,  0xae,  0x09,
-  0x84,  0x01,  0x0e,  0x8e,  0x09,  0x5d,  0x01,  0xa8,  0x04,  0x09,  0x84,  0x01,  0x0e,  0x8e,  0xfe,  0x80,
-  0xe7,  0x11,  0x07,  0x11,  0x8a,  0xfe,  0x45,  0x58,  0x01,  0xf0,  0x8e,  0x04,  0x09,  0x48,  0x01,  0x0e,
-  0x8e,  0x09,  0x5d,  0x01,  0xa8,  0x04,  0x09,  0x48,  0x01,  0x0e,  0xfe,  0x80,  0x80,  0xfe,  0x80,  0x4c,
-  0xfe,  0x49,  0xe4,  0x11,  0xae,  0x09,  0x84,  0x01,  0x0e,  0xfe,  0x80,  0x4c,  0x09,  0x5d,  0x01,  0x87,
-  0x04,  0x18,  0x11,  0x75,  0x6c,  0xfe,  0x60,  0x01,  0xfe,  0x18,  0xdf,  0xfe,  0x19,  0xde,  0xfe,  0x24,
-  0x1c,  0xfe,  0x1d,  0xf7,  0x1b,  0x97,  0xfe,  0xee,  0x16,  0x01,  0xfe,  0xf4,  0x17,  0xad,  0x9a,  0x1b,
-  0x6c,  0xfe,  0x2c,  0x01,  0xfe,  0x2f,  0x19,  0x04,  0xb9,  0x23,  0xfe,  0xde,  0x16,  0xfe,  0xda,  0x10,
-  0x18,  0x11,  0x75,  0x03,  0xfe,  0x64,  0x01,  0xfe,  0x00,  0xf4,  0x1f,  0xfe,  0x18,  0x58,  0x03,  0xfe,
-  0x66,  0x01,  0xfe,  0x19,  0x58,  0x9a,  0x1f,  0xfe,  0x3c,  0x90,  0xfe,  0x30,  0xf4,  0x06,  0xfe,  0x3c,
-  0x50,  0x6c,  0xfe,  0x38,  0x00,  0xfe,  0x0f,  0x79,  0xfe,  0x1c,  0xf7,  0x1f,  0x97,  0xfe,  0x38,  0x17,
-  0xfe,  0xb6,  0x14,  0x35,  0x04,  0xb9,  0x23,  0xfe,  0x10,  0x17,  0xfe,  0x9c,  0x10,  0x18,  0x11,  0x75,
-  0xfe,  0x83,  0x5a,  0xfe,  0x18,  0xdf,  0xfe,  0x19,  0xde,  0xfe,  0x1d,  0xf7,  0x2e,  0x97,  0xfe,  0x5a,
-  0x17,  0xfe,  0x94,  0x14,  0xec,  0x9a,  0x2e,  0x6c,  0x1a,  0xfe,  0xaf,  0x19,  0xfe,  0x98,  0xe7,  0x00,
-  0x04,  0xb9,  0x23,  0xfe,  0x4e,  0x17,  0xfe,  0x6c,  0x10,  0x18,  0x11,  0x75,  0xfe,  0x30,  0xbc,  0xfe,
-  0xb2,  0xbc,  0x9a,  0xcb,  0x6c,  0x1a,  0xfe,  0x0f,  0x79,  0xfe,  0x1c,  0xf7,  0xcb,  0x97,  0xfe,  0x92,
-  0x17,  0xfe,  0x5c,  0x14,  0x35,  0x04,  0xb9,  0x23,  0xfe,  0x7e,  0x17,  0xfe,  0x42,  0x10,  0xfe,  0x02,
-  0xf6,  0x11,  0x75,  0xfe,  0x18,  0xfe,  0x60,  0xfe,  0x19,  0xfe,  0x61,  0xfe,  0x03,  0xa1,  0xfe,  0x1d,
-  0xf7,  0x5b,  0x97,  0xfe,  0xb8,  0x17,  0xfe,  0x36,  0x14,  0xfe,  0x1c,  0x13,  0x9a,  0x5b,  0x41,  0xfe,
-  0x83,  0x58,  0xfe,  0xaf,  0x19,  0xfe,  0x80,  0xe7,  0x11,  0xfe,  0x81,  0xe7,  0x11,  0x12,  0xfe,  0xdd,
-  0x00,  0x6a,  0x2a,  0x04,  0x6a,  0x2a,  0xfe,  0x12,  0x45,  0x23,  0xfe,  0xa8,  0x17,  0x15,  0x06,  0x39,
-  0xa0,  0xb4,  0x02,  0x2b,  0xfe,  0x39,  0xf0,  0xfe,  0xfc,  0x17,  0x21,  0x04,  0xfe,  0x7e,  0x18,  0x1e,
-  0x19,  0x66,  0x0f,  0x0d,  0x04,  0x75,  0x03,  0xd2,  0x1e,  0x06,  0xfe,  0xef,  0x12,  0xfe,  0xe1,  0x10,
-  0x7c,  0x6f,  0x4f,  0x32,  0x07,  0x2f,  0xfe,  0x3c,  0x13,  0xf1,  0xfe,  0x42,  0x13,  0x42,  0x92,  0x09,
-  0x48,  0x01,  0x0e,  0xbb,  0xeb,  0xfe,  0x41,  0x48,  0xfe,  0x45,  0x48,  0x01,  0xf0,  0xfe,  0x00,  0xcc,
-  0xbb,  0xfe,  0xf3,  0x13,  0x43,  0x78,  0x07,  0x11,  0xac,  0x09,  0x84,  0x01,  0x0e,  0xfe,  0x80,  0x4c,
-  0x01,  0x73,  0xfe,  0x16,  0x10,  0x07,  0x82,  0x8b,  0xfe,  0x40,  0x14,  0xfe,  0x24,  0x12,  0xfe,  0x14,
-  0x56,  0xfe,  0xd6,  0xf0,  0xfe,  0x1c,  0x18,  0x18,  0x0a,  0x04,  0xfe,  0x9c,  0xe7,  0x0a,  0x10,  0xfe,
-  0x15,  0x00,  0x64,  0x79,  0x2a,  0x01,  0xe3,  0x18,  0x06,  0x04,  0x42,  0x92,  0x08,  0x54,  0x1b,  0x37,
-  0x12,  0x2f,  0x01,  0x73,  0x18,  0x06,  0x04,  0xfe,  0x38,  0x90,  0xfe,  0xba,  0x90,  0x3a,  0xce,  0x3b,
-  0xcf,  0xfe,  0x48,  0x55,  0x35,  0xfe,  0xc9,  0x55,  0x04,  0x22,  0xa3,  0x77,  0x13,  0xa3,  0x04,  0x09,
-  0xa4,  0x01,  0x0e,  0xfe,  0x41,  0x48,  0x09,  0x46,  0x01,  0x0e,  0xfe,  0x49,  0x44,  0x17,  0xfe,  0xe8,
-  0x18,  0x77,  0x78,  0x04,  0x09,  0x48,  0x01,  0x0e,  0x07,  0x11,  0x4e,  0x09,  0x5d,  0x01,  0xa8,  0x09,
-  0x46,  0x01,  0x0e,  0x77,  0x78,  0x04,  0xfe,  0x4e,  0xe4,  0x19,  0x6b,  0xfe,  0x1c,  0x19,  0x03,  0xfe,
-  0x90,  0x00,  0xfe,  0x3a,  0x45,  0xfe,  0x2c,  0x10,  0xfe,  0x4e,  0xe4,  0xc9,  0x6b,  0xfe,  0x2e,  0x19,
-  0x03,  0xfe,  0x92,  0x00,  0xfe,  0x02,  0xe6,  0x1a,  0xe5,  0xfe,  0x4e,  0xe4,  0xfe,  0x0b,  0x00,  0x6b,
-  0xfe,  0x40,  0x19,  0x03,  0xfe,  0x94,  0x00,  0xfe,  0x02,  0xe6,  0x1f,  0xfe,  0x08,  0x10,  0x03,  0xfe,
-  0x96,  0x00,  0xfe,  0x02,  0xe6,  0x6d,  0xfe,  0x4e,  0x45,  0xea,  0xba,  0xff,  0x04,  0x68,  0x54,  0xe7,
-  0x1e,  0x6e,  0xfe,  0x08,  0x1c,  0xfe,  0x67,  0x19,  0xfe,  0x0a,  0x1c,  0xfe,  0x1a,  0xf4,  0xfe,  0x00,
-  0x04,  0xea,  0xfe,  0x48,  0xf4,  0x19,  0x7a,  0xfe,  0x74,  0x19,  0x0f,  0x19,  0x04,  0x07,  0x7e,  0xfe,
-  0x5a,  0xf0,  0xfe,  0x84,  0x19,  0x25,  0xfe,  0x09,  0x00,  0xfe,  0x34,  0x10,  0x07,  0x1a,  0xfe,  0x5a,
-  0xf0,  0xfe,  0x92,  0x19,  0x25,  0xca,  0xfe,  0x26,  0x10,  0x07,  0x19,  0x66,  0x25,  0x6d,  0xe5,  0x07,
-  0x0a,  0x66,  0x25,  0x9e,  0xfe,  0x0e,  0x10,  0x07,  0x06,  0x66,  0x25,  0x59,  0xa9,  0xb8,  0x04,  0x15,
-  0xfe,  0x09,  0x00,  0x01,  0x36,  0xfe,  0x04,  0xfe,  0x81,  0x03,  0x83,  0xfe,  0x40,  0x5c,  0x04,  0x1c,
-  0xf7,  0xfe,  0x14,  0xf0,  0x0b,  0x27,  0xfe,  0xd6,  0x19,  0x1c,  0xf7,  0x7b,  0xf7,  0xfe,  0x82,  0xf0,
-  0xfe,  0xda,  0x19,  0x04,  0xff,  0xcc,  0x00,  0x00,
+static unsigned char _adv_asc38C0800_buf[] = {
+       0x00, 0x00, 0x00, 0xf2, 0x00, 0xf0, 0x00, 0xfc, 0x00, 0x16, 0x18, 0xe4,
+       0x01, 0x00, 0x48, 0xe4,
+       0x18, 0x80, 0x03, 0xf6, 0x02, 0x00, 0xce, 0x19, 0x00, 0xfa, 0xff, 0xff,
+       0x1c, 0x0f, 0x00, 0xf6,
+       0x9e, 0xe7, 0xff, 0x00, 0x82, 0xe7, 0x00, 0xea, 0x01, 0xfa, 0x01, 0xe6,
+       0x09, 0xe7, 0x55, 0xf0,
+       0x01, 0xf6, 0x03, 0x00, 0x04, 0x00, 0x10, 0x00, 0x1e, 0xf0, 0x85, 0xf0,
+       0x18, 0xf4, 0x08, 0x00,
+       0xbc, 0x00, 0x38, 0x54, 0x00, 0xec, 0xd5, 0xf0, 0x82, 0x0d, 0x00, 0xe6,
+       0x86, 0xf0, 0xb1, 0xf0,
+       0x98, 0x57, 0x01, 0xfc, 0xb4, 0x00, 0xd4, 0x01, 0x0c, 0x1c, 0x3e, 0x1c,
+       0x3c, 0x00, 0xbb, 0x00,
+       0x00, 0x10, 0xba, 0x19, 0x02, 0x80, 0x32, 0xf0, 0x7c, 0x0d, 0x02, 0x13,
+       0xba, 0x13, 0x18, 0x40,
+       0x00, 0x57, 0x01, 0xea, 0x02, 0xfc, 0x03, 0xfc, 0x3e, 0x00, 0x6c, 0x01,
+       0x6e, 0x01, 0x74, 0x01,
+       0x76, 0x01, 0xb9, 0x54, 0x3e, 0x57, 0x00, 0x80, 0x03, 0xe6, 0xb6, 0x00,
+       0xc0, 0x00, 0x01, 0x01,
+       0x3e, 0x01, 0x7a, 0x01, 0xca, 0x08, 0xce, 0x10, 0x16, 0x11, 0x04, 0x12,
+       0x08, 0x12, 0x02, 0x4a,
+       0xbb, 0x55, 0x3c, 0x56, 0x03, 0x58, 0x1b, 0x80, 0x30, 0xe4, 0x4b, 0xe4,
+       0x5d, 0xf0, 0x02, 0xfa,
+       0x20, 0x00, 0x32, 0x00, 0x40, 0x00, 0x80, 0x00, 0x24, 0x01, 0x3c, 0x01,
+       0x68, 0x01, 0x6a, 0x01,
+       0x70, 0x01, 0x72, 0x01, 0x78, 0x01, 0x7c, 0x01, 0x62, 0x0a, 0x86, 0x0d,
+       0x06, 0x13, 0x4c, 0x1c,
+       0x04, 0x80, 0x4a, 0xe4, 0x02, 0xee, 0x5b, 0xf0, 0x03, 0xf7, 0x0c, 0x00,
+       0x0f, 0x00, 0x47, 0x00,
+       0xbe, 0x00, 0x00, 0x01, 0x20, 0x11, 0x5c, 0x16, 0x32, 0x1c, 0x38, 0x1c,
+       0x4e, 0x1c, 0x10, 0x44,
+       0x00, 0x4c, 0x04, 0xea, 0x5c, 0xf0, 0xa7, 0xf0, 0x04, 0xf6, 0x03, 0xfa,
+       0x05, 0x00, 0x34, 0x00,
+       0x36, 0x00, 0x98, 0x00, 0xcc, 0x00, 0x20, 0x01, 0x4e, 0x01, 0x4a, 0x0b,
+       0x42, 0x0c, 0x12, 0x0f,
+       0x0c, 0x10, 0x22, 0x11, 0x0a, 0x12, 0x04, 0x13, 0x30, 0x1c, 0x02, 0x48,
+       0x00, 0x4e, 0x42, 0x54,
+       0x44, 0x55, 0xbd, 0x56, 0x06, 0x83, 0x00, 0xdc, 0x05, 0xf0, 0x09, 0xf0,
+       0x59, 0xf0, 0xb8, 0xf0,
+       0x4b, 0xf4, 0x06, 0xf7, 0x0e, 0xf7, 0x04, 0xfc, 0x05, 0xfc, 0x06, 0x00,
+       0x19, 0x00, 0x33, 0x00,
+       0x9b, 0x00, 0xa4, 0x00, 0xb5, 0x00, 0xba, 0x00, 0xd0, 0x00, 0xe1, 0x00,
+       0xe7, 0x00, 0xe2, 0x03,
+       0x08, 0x0f, 0x02, 0x10, 0x04, 0x10, 0x0a, 0x10, 0x0a, 0x13, 0x0c, 0x13,
+       0x12, 0x13, 0x24, 0x14,
+       0x34, 0x14, 0x04, 0x16, 0x08, 0x16, 0xa4, 0x17, 0x20, 0x1c, 0x34, 0x1c,
+       0x36, 0x1c, 0x08, 0x44,
+       0x38, 0x44, 0x91, 0x44, 0x0a, 0x45, 0x48, 0x46, 0x01, 0x48, 0x68, 0x54,
+       0x3a, 0x55, 0x83, 0x55,
+       0xe5, 0x55, 0xb0, 0x57, 0x01, 0x58, 0x83, 0x59, 0x05, 0xe6, 0x0b, 0xf0,
+       0x0c, 0xf0, 0x04, 0xf8,
+       0x05, 0xf8, 0x07, 0x00, 0x0a, 0x00, 0x1c, 0x00, 0x1e, 0x00, 0x9e, 0x00,
+       0xa8, 0x00, 0xaa, 0x00,
+       0xb9, 0x00, 0xe0, 0x00, 0x22, 0x01, 0x26, 0x01, 0x79, 0x01, 0x7e, 0x01,
+       0xc4, 0x01, 0xc6, 0x01,
+       0x80, 0x02, 0x5e, 0x03, 0xee, 0x04, 0x9a, 0x06, 0xf8, 0x07, 0x62, 0x08,
+       0x68, 0x08, 0x69, 0x08,
+       0xd6, 0x08, 0xe9, 0x09, 0xfa, 0x0b, 0x2e, 0x0f, 0x12, 0x10, 0x1a, 0x10,
+       0xed, 0x10, 0xf1, 0x10,
+       0x2a, 0x11, 0x06, 0x12, 0x0c, 0x12, 0x3e, 0x12, 0x10, 0x13, 0x16, 0x13,
+       0x1e, 0x13, 0x46, 0x14,
+       0x76, 0x14, 0x82, 0x14, 0x36, 0x15, 0xca, 0x15, 0x6b, 0x18, 0xbe, 0x18,
+       0xca, 0x18, 0xe6, 0x19,
+       0x12, 0x1c, 0x46, 0x1c, 0x9c, 0x32, 0x00, 0x40, 0x0e, 0x47, 0xfe, 0x9c,
+       0xf0, 0x2b, 0x02, 0xfe,
+       0xac, 0x0d, 0xff, 0x10, 0x00, 0x00, 0xd7, 0xfe, 0xe8, 0x19, 0x00, 0xd6,
+       0xfe, 0x84, 0x01, 0xff,
+       0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00,
+       0x00, 0xfe, 0x57, 0x24,
+       0x00, 0xfe, 0x4c, 0x00, 0x5b, 0xff, 0x04, 0x00, 0x00, 0x11, 0xff, 0x09,
+       0x00, 0x00, 0xff, 0x08,
+       0x01, 0x01, 0xff, 0x08, 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10,
+       0xff, 0xff, 0xff, 0x11,
+       0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00,
+       0xfe, 0x04, 0xf7, 0xd6,
+       0x2c, 0x99, 0x0a, 0x01, 0xfe, 0xc2, 0x0f, 0xfe, 0x04, 0xf7, 0xd6, 0x99,
+       0x0a, 0x42, 0x2c, 0xfe,
+       0x3d, 0xf0, 0xfe, 0x06, 0x02, 0xfe, 0x20, 0xf0, 0xa7, 0xfe, 0x91, 0xf0,
+       0xfe, 0xf4, 0x01, 0xfe,
+       0x90, 0xf0, 0xfe, 0xf4, 0x01, 0xfe, 0x8f, 0xf0, 0xa7, 0x03, 0x5d, 0x4d,
+       0x02, 0xfe, 0xc8, 0x0d,
+       0x01, 0xfe, 0x38, 0x0e, 0xfe, 0xdd, 0x12, 0xfe, 0xfc, 0x10, 0xfe, 0x28,
+       0x1c, 0x03, 0xfe, 0xa6,
+       0x00, 0xfe, 0xd3, 0x12, 0x41, 0x14, 0xfe, 0xa6, 0x00, 0xc2, 0xfe, 0x48,
+       0xf0, 0xfe, 0x8a, 0x02,
+       0xfe, 0x49, 0xf0, 0xfe, 0xa4, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xc2, 0x02,
+       0xfe, 0x46, 0xf0, 0xfe,
+       0x54, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x5a, 0x02, 0xfe, 0x43, 0xf0, 0xfe,
+       0x48, 0x02, 0xfe, 0x44,
+       0xf0, 0xfe, 0x4c, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x50, 0x02, 0x18, 0x0a,
+       0xaa, 0x18, 0x06, 0x14,
+       0xa1, 0x02, 0x2b, 0xfe, 0x00, 0x1c, 0xe7, 0xfe, 0x02, 0x1c, 0xe6, 0xfe,
+       0x1e, 0x1c, 0xfe, 0xe9,
+       0x10, 0x01, 0xfe, 0x18, 0x18, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc, 0xce,
+       0x09, 0x70, 0x01, 0xa8,
+       0x02, 0x2b, 0x15, 0x59, 0x39, 0xa2, 0x01, 0xfe, 0x58, 0x10, 0x09, 0x70,
+       0x01, 0x87, 0xfe, 0xbd,
+       0x10, 0x09, 0x70, 0x01, 0x87, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c, 0xfe,
+       0x58, 0x1c, 0x18, 0x06,
+       0x14, 0xa1, 0x2c, 0x1c, 0x2b, 0xfe, 0x3d, 0xf0, 0xfe, 0x06, 0x02, 0x23,
+       0xfe, 0x98, 0x02, 0xfe,
+       0x5a, 0x1c, 0xf8, 0xfe, 0x14, 0x1c, 0x15, 0xfe, 0x30, 0x00, 0x39, 0xa2,
+       0x01, 0xfe, 0x48, 0x10,
+       0x18, 0x06, 0x14, 0xa1, 0x02, 0xd7, 0x22, 0x20, 0x07, 0x11, 0x35, 0xfe,
+       0x69, 0x10, 0x18, 0x06,
+       0x14, 0xa1, 0xfe, 0x04, 0xec, 0x20, 0x4f, 0x43, 0x13, 0x20, 0xfe, 0x05,
+       0xf6, 0xce, 0x01, 0xfe,
+       0x4a, 0x17, 0x08, 0x54, 0x58, 0x37, 0x12, 0x2f, 0x42, 0x92, 0x01, 0xfe,
+       0x82, 0x16, 0x02, 0x2b,
+       0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x66, 0x01, 0x73, 0xfe, 0x18, 0x10,
+       0xfe, 0x41, 0x58, 0x09,
+       0xa4, 0x01, 0x0e, 0xfe, 0xc8, 0x54, 0x6b, 0xfe, 0x10, 0x03, 0x01, 0xfe,
+       0x82, 0x16, 0x02, 0x2b,
+       0x2c, 0x4f, 0xfe, 0x02, 0xe8, 0x2a, 0xfe, 0xbf, 0x57, 0xfe, 0x9e, 0x43,
+       0xfe, 0x77, 0x57, 0xfe,
+       0x27, 0xf0, 0xfe, 0xe0, 0x01, 0xfe, 0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xa7,
+       0xfe, 0x40, 0x1c, 0x1c,
+       0xd9, 0xfe, 0x26, 0xf0, 0xfe, 0x5a, 0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x48,
+       0x03, 0xfe, 0x11, 0xf0,
+       0xa7, 0xfe, 0xef, 0x10, 0xfe, 0x9f, 0xf0, 0xfe, 0x68, 0x03, 0xf9, 0x10,
+       0xfe, 0x11, 0x00, 0x02,
+       0x65, 0x2c, 0xfe, 0x48, 0x1c, 0xf9, 0x08, 0x05, 0x1b, 0xfe, 0x18, 0x13,
+       0x21, 0x22, 0xa3, 0xb7,
+       0x13, 0xa3, 0x09, 0x46, 0x01, 0x0e, 0xb7, 0x78, 0x01, 0xfe, 0xb4, 0x16,
+       0x12, 0xd1, 0x1c, 0xd9,
+       0xfe, 0x01, 0xf0, 0xd9, 0xfe, 0x82, 0xf0, 0xfe, 0x96, 0x03, 0xfa, 0x12,
+       0xfe, 0xe4, 0x00, 0x27,
+       0xfe, 0xa8, 0x03, 0x1c, 0x34, 0x1d, 0xfe, 0xb8, 0x03, 0x01, 0x4b, 0xfe,
+       0x06, 0xf0, 0xfe, 0xc8,
+       0x03, 0x95, 0x86, 0xfe, 0x0a, 0xf0, 0xfe, 0x8a, 0x06, 0x02, 0x24, 0x03,
+       0x70, 0x28, 0x17, 0xfe,
+       0xfa, 0x04, 0x15, 0x6d, 0x01, 0x36, 0x7b, 0xfe, 0x6a, 0x02, 0x02, 0xd8,
+       0xf9, 0x2c, 0x99, 0x19,
+       0xfe, 0x67, 0x1b, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57, 0xfe, 0x48, 0x1c,
+       0x74, 0x01, 0xaf, 0x8c,
+       0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x17, 0xda, 0x09, 0xd1, 0x01, 0x0e,
+       0x8d, 0x51, 0x64, 0x79,
+       0x2a, 0x03, 0x70, 0x28, 0xfe, 0x10, 0x12, 0x15, 0x6d, 0x01, 0x36, 0x7b,
+       0xfe, 0x6a, 0x02, 0x02,
+       0xd8, 0xc7, 0x81, 0xc8, 0x83, 0x1c, 0x24, 0x27, 0xfe, 0x40, 0x04, 0x1d,
+       0xfe, 0x3c, 0x04, 0x3b,
+       0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x4e, 0x12, 0x2d, 0xff, 0x02,
+       0x00, 0x10, 0x01, 0x0b,
+       0x1d, 0xfe, 0xe4, 0x04, 0x2d, 0x01, 0x0b, 0x1d, 0x24, 0x33, 0x31, 0xde,
+       0xfe, 0x4c, 0x44, 0xfe,
+       0x4c, 0x12, 0x51, 0xfe, 0x44, 0x48, 0x0f, 0x6f, 0xfe, 0x4c, 0x54, 0x6b,
+       0xda, 0x4f, 0x79, 0x2a,
+       0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x62, 0x13, 0x08, 0x05, 0x1b,
+       0xfe, 0x2a, 0x13, 0x32,
+       0x07, 0x82, 0xfe, 0x52, 0x13, 0xfe, 0x20, 0x10, 0x0f, 0x6f, 0xfe, 0x4c,
+       0x54, 0x6b, 0xda, 0xfe,
+       0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x40, 0x13, 0x08, 0x05, 0x1b, 0xfe,
+       0x08, 0x13, 0x32, 0x07,
+       0x82, 0xfe, 0x30, 0x13, 0x08, 0x05, 0x1b, 0xfe, 0x1c, 0x12, 0x15, 0x9d,
+       0x08, 0x05, 0x06, 0x4d,
+       0x15, 0xfe, 0x0d, 0x00, 0x01, 0x36, 0x7b, 0xfe, 0x64, 0x0d, 0x02, 0x24,
+       0x2d, 0x12, 0xfe, 0xe6,
+       0x00, 0xfe, 0x1c, 0x90, 0xfe, 0x40, 0x5c, 0x04, 0x15, 0x9d, 0x01, 0x36,
+       0x02, 0x2b, 0xfe, 0x42,
+       0x5b, 0x99, 0x19, 0xfe, 0x46, 0x59, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57,
+       0xfe, 0x87, 0x80, 0xfe,
+       0x31, 0xe4, 0x5b, 0x08, 0x05, 0x0a, 0xfe, 0x84, 0x13, 0xfe, 0x20, 0x80,
+       0x07, 0x19, 0xfe, 0x7c,
+       0x12, 0x53, 0x05, 0x06, 0xfe, 0x6c, 0x13, 0x03, 0xfe, 0xa2, 0x00, 0x28,
+       0x17, 0xfe, 0x90, 0x05,
+       0xfe, 0x31, 0xe4, 0x5a, 0x53, 0x05, 0x0a, 0xfe, 0x56, 0x13, 0x03, 0xfe,
+       0xa0, 0x00, 0x28, 0xfe,
+       0x4e, 0x12, 0x67, 0xff, 0x02, 0x00, 0x10, 0x27, 0xfe, 0x48, 0x05, 0x1c,
+       0x34, 0xfe, 0x89, 0x48,
+       0xff, 0x02, 0x00, 0x10, 0x27, 0xfe, 0x56, 0x05, 0x26, 0xfe, 0xa8, 0x05,
+       0x12, 0xfe, 0xe3, 0x00,
+       0x21, 0x53, 0xfe, 0x4a, 0xf0, 0xfe, 0x76, 0x05, 0xfe, 0x49, 0xf0, 0xfe,
+       0x70, 0x05, 0x88, 0x25,
+       0xfe, 0x21, 0x00, 0xab, 0x25, 0xfe, 0x22, 0x00, 0xaa, 0x25, 0x58, 0xfe,
+       0x09, 0x48, 0xff, 0x02,
+       0x00, 0x10, 0x27, 0xfe, 0x86, 0x05, 0x26, 0xfe, 0xa8, 0x05, 0xfe, 0xe2,
+       0x08, 0x53, 0x05, 0xcb,
+       0x4d, 0x01, 0xb0, 0x25, 0x06, 0x13, 0xd3, 0x39, 0xfe, 0x27, 0x01, 0x08,
+       0x05, 0x1b, 0xfe, 0x22,
+       0x12, 0x41, 0x01, 0xb2, 0x15, 0x9d, 0x08, 0x05, 0x06, 0x4d, 0x15, 0xfe,
+       0x0d, 0x00, 0x01, 0x36,
+       0x7b, 0xfe, 0x64, 0x0d, 0x02, 0x24, 0x03, 0xfe, 0x9c, 0x00, 0x28, 0xeb,
+       0x03, 0x5c, 0x28, 0xfe,
+       0x36, 0x13, 0x41, 0x01, 0xb2, 0x26, 0xfe, 0x18, 0x06, 0x09, 0x06, 0x53,
+       0x05, 0x1f, 0xfe, 0x02,
+       0x12, 0x50, 0x01, 0xfe, 0x9e, 0x15, 0x1d, 0xfe, 0x0e, 0x06, 0x12, 0xa5,
+       0x01, 0x4b, 0x12, 0xfe,
+       0xe5, 0x00, 0x03, 0x5c, 0xc1, 0x0c, 0x5c, 0x03, 0xcd, 0x28, 0xfe, 0x62,
+       0x12, 0x03, 0x45, 0x28,
+       0xfe, 0x5a, 0x13, 0x01, 0xfe, 0x0c, 0x19, 0x01, 0xfe, 0x76, 0x19, 0xfe,
+       0x43, 0x48, 0xc4, 0xcc,
+       0x0f, 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0x1e, 0x43, 0x8b, 0xc4,
+       0x6e, 0x41, 0x01, 0xb2,
+       0x26, 0xfe, 0x82, 0x06, 0x53, 0x05, 0x1a, 0xe9, 0x91, 0x09, 0x59, 0x01,
+       0xfe, 0xcc, 0x15, 0x1d,
+       0xfe, 0x78, 0x06, 0x12, 0xa5, 0x01, 0x4b, 0x12, 0xfe, 0xe5, 0x00, 0x03,
+       0x45, 0xc1, 0x0c, 0x45,
+       0x18, 0x06, 0x01, 0xb2, 0xfa, 0x76, 0x74, 0x01, 0xaf, 0x8c, 0x12, 0xfe,
+       0xe2, 0x00, 0x27, 0xdb,
+       0x1c, 0x34, 0xfe, 0x0a, 0xf0, 0xfe, 0xb6, 0x06, 0x94, 0xfe, 0x6c, 0x07,
+       0xfe, 0x06, 0xf0, 0xfe,
+       0x74, 0x07, 0x95, 0x86, 0x02, 0x24, 0x08, 0x05, 0x0a, 0xfe, 0x2e, 0x12,
+       0x16, 0x19, 0x01, 0x0b,
+       0x16, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01, 0x0b,
+       0xfe, 0x99, 0xa4, 0x01,
+       0x0b, 0x16, 0x00, 0x02, 0xfe, 0x42, 0x08, 0x68, 0x05, 0x1a, 0xfe, 0x38,
+       0x12, 0x08, 0x05, 0x1a,
+       0xfe, 0x30, 0x13, 0x16, 0xfe, 0x1b, 0x00, 0x01, 0x0b, 0x16, 0x00, 0x01,
+       0x0b, 0x16, 0x00, 0x01,
+       0x0b, 0x16, 0x00, 0x01, 0x0b, 0x16, 0x06, 0x01, 0x0b, 0x16, 0x00, 0x02,
+       0xe2, 0x6c, 0x58, 0xbe,
+       0x50, 0xfe, 0x9a, 0x81, 0x55, 0x1b, 0x7a, 0xfe, 0x42, 0x07, 0x09, 0x1b,
+       0xfe, 0x09, 0x6f, 0xba,
+       0xfe, 0xca, 0x45, 0xfe, 0x32, 0x12, 0x69, 0x6d, 0x8b, 0x6c, 0x7f, 0x27,
+       0xfe, 0x54, 0x07, 0x1c,
+       0x34, 0xfe, 0x0a, 0xf0, 0xfe, 0x42, 0x07, 0x95, 0x86, 0x94, 0xfe, 0x6c,
+       0x07, 0x02, 0x24, 0x01,
+       0x4b, 0x02, 0xdb, 0x16, 0x1f, 0x02, 0xdb, 0xfe, 0x9c, 0xf7, 0xdc, 0xfe,
+       0x2c, 0x90, 0xfe, 0xae,
+       0x90, 0x56, 0xfe, 0xda, 0x07, 0x0c, 0x60, 0x14, 0x61, 0x08, 0x54, 0x5a,
+       0x37, 0x22, 0x20, 0x07,
+       0x11, 0xfe, 0x0e, 0x12, 0x8d, 0xfe, 0x80, 0x80, 0x39, 0x20, 0x6a, 0x2a,
+       0xfe, 0x06, 0x10, 0xfe,
+       0x83, 0xe7, 0xfe, 0x48, 0x00, 0xab, 0xfe, 0x03, 0x40, 0x08, 0x54, 0x5b,
+       0x37, 0x01, 0xb3, 0xb8,
+       0xfe, 0x1f, 0x40, 0x13, 0x62, 0x01, 0xef, 0xfe, 0x08, 0x50, 0xfe, 0x8a,
+       0x50, 0xfe, 0x44, 0x51,
+       0xfe, 0xc6, 0x51, 0x88, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90, 0x0c, 0x5e,
+       0x14, 0x5f, 0xfe, 0x0c,
+       0x90, 0xfe, 0x8e, 0x90, 0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x0c, 0x3d,
+       0x14, 0x3e, 0xfe, 0x4a,
+       0x10, 0x08, 0x05, 0x5a, 0xfe, 0x2a, 0x12, 0xfe, 0x2c, 0x90, 0xfe, 0xae,
+       0x90, 0x0c, 0x60, 0x14,
+       0x61, 0x08, 0x05, 0x5b, 0x8b, 0x01, 0xb3, 0xfe, 0x1f, 0x80, 0x13, 0x62,
+       0xfe, 0x44, 0x90, 0xfe,
+       0xc6, 0x90, 0x0c, 0x3f, 0x14, 0x40, 0xfe, 0x08, 0x90, 0xfe, 0x8a, 0x90,
+       0x0c, 0x5e, 0x14, 0x5f,
+       0xfe, 0x40, 0x90, 0xfe, 0xc2, 0x90, 0x0c, 0x3d, 0x14, 0x3e, 0x0c, 0x2e,
+       0x14, 0x3c, 0x21, 0x0c,
+       0x49, 0x0c, 0x63, 0x08, 0x54, 0x1f, 0x37, 0x2c, 0x0f, 0xfe, 0x4e, 0x11,
+       0x27, 0xdd, 0xfe, 0x9e,
+       0xf0, 0xfe, 0x76, 0x08, 0xbc, 0x17, 0x34, 0x2c, 0x77, 0xe6, 0xc5, 0xfe,
+       0x9a, 0x08, 0xc6, 0xfe,
+       0xb8, 0x08, 0x94, 0xfe, 0x8e, 0x08, 0xfe, 0x06, 0xf0, 0xfe, 0x94, 0x08,
+       0x95, 0x86, 0x02, 0x24,
+       0x01, 0x4b, 0xfe, 0xc9, 0x10, 0x16, 0x1f, 0xfe, 0xc9, 0x10, 0x68, 0x05,
+       0x06, 0xfe, 0x10, 0x12,
+       0x68, 0x05, 0x0a, 0x4e, 0x08, 0x05, 0x0a, 0xfe, 0x90, 0x12, 0xfe, 0x2e,
+       0x1c, 0x02, 0xfe, 0x18,
+       0x0b, 0x68, 0x05, 0x06, 0x4e, 0x68, 0x05, 0x0a, 0xfe, 0x7a, 0x12, 0xfe,
+       0x2c, 0x1c, 0xfe, 0xaa,
+       0xf0, 0xfe, 0xd2, 0x09, 0xfe, 0xac, 0xf0, 0xfe, 0x00, 0x09, 0x02, 0xfe,
+       0xde, 0x09, 0xfe, 0xb7,
+       0xf0, 0xfe, 0xfc, 0x08, 0xfe, 0x02, 0xf6, 0x1a, 0x50, 0xfe, 0x70, 0x18,
+       0xfe, 0xf1, 0x18, 0xfe,
+       0x40, 0x55, 0xfe, 0xe1, 0x55, 0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0xfe,
+       0x14, 0x59, 0xfe, 0x95,
+       0x59, 0x1c, 0x85, 0xfe, 0x8c, 0xf0, 0xfe, 0xfc, 0x08, 0xfe, 0xac, 0xf0,
+       0xfe, 0xf0, 0x08, 0xb5,
+       0xfe, 0xcb, 0x10, 0xfe, 0xad, 0xf0, 0xfe, 0x0c, 0x09, 0x02, 0xfe, 0x18,
+       0x0b, 0xb6, 0xfe, 0xbf,
+       0x10, 0xfe, 0x2b, 0xf0, 0x85, 0xf4, 0x1e, 0xfe, 0x00, 0xfe, 0xfe, 0x1c,
+       0x12, 0xc2, 0xfe, 0xd2,
+       0xf0, 0x85, 0xfe, 0x76, 0x18, 0x1e, 0x19, 0x17, 0x85, 0x03, 0xd2, 0x1e,
+       0x06, 0x17, 0x85, 0xc5,
+       0x4a, 0xc6, 0x4a, 0xb5, 0xb6, 0xfe, 0x89, 0x10, 0x74, 0x67, 0x2d, 0x15,
+       0x9d, 0x01, 0x36, 0x10,
+       0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x65, 0x10, 0x80, 0x02, 0x65, 0xfe,
+       0x98, 0x80, 0xfe, 0x19,
+       0xe4, 0x0a, 0xfe, 0x1a, 0x12, 0x51, 0xfe, 0x19, 0x82, 0xfe, 0x6c, 0x18,
+       0xfe, 0x44, 0x54, 0xbe,
+       0xfe, 0x19, 0x81, 0xfe, 0x74, 0x18, 0x8f, 0x90, 0x17, 0xfe, 0xce, 0x08,
+       0x02, 0x4a, 0x08, 0x05,
+       0x5a, 0xec, 0x03, 0x2e, 0x29, 0x3c, 0x0c, 0x3f, 0x14, 0x40, 0x9b, 0x2e,
+       0x9c, 0x3c, 0xfe, 0x6c,
+       0x18, 0xfe, 0xed, 0x18, 0xfe, 0x44, 0x54, 0xfe, 0xe5, 0x54, 0x3a, 0x3f,
+       0x3b, 0x40, 0x03, 0x49,
+       0x29, 0x63, 0x8f, 0xfe, 0xe3, 0x54, 0xfe, 0x74, 0x18, 0xfe, 0xf5, 0x18,
+       0x8f, 0xfe, 0xe3, 0x54,
+       0x90, 0xc0, 0x56, 0xfe, 0xce, 0x08, 0x02, 0x4a, 0xfe, 0x37, 0xf0, 0xfe,
+       0xda, 0x09, 0xfe, 0x8b,
+       0xf0, 0xfe, 0x60, 0x09, 0x02, 0x4a, 0x08, 0x05, 0x0a, 0x23, 0xfe, 0xfa,
+       0x0a, 0x3a, 0x49, 0x3b,
+       0x63, 0x56, 0xfe, 0x3e, 0x0a, 0x0f, 0xfe, 0xc0, 0x07, 0x41, 0x98, 0x00,
+       0xad, 0xfe, 0x01, 0x59,
+       0xfe, 0x52, 0xf0, 0xfe, 0x0c, 0x0a, 0x8f, 0x7a, 0xfe, 0x24, 0x0a, 0x3a,
+       0x49, 0x8f, 0xfe, 0xe3,
+       0x54, 0x57, 0x49, 0x7d, 0x63, 0xfe, 0x14, 0x58, 0xfe, 0x95, 0x58, 0x02,
+       0x4a, 0x3a, 0x49, 0x3b,
+       0x63, 0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0xbe, 0x57, 0x49, 0x57, 0x63,
+       0x02, 0x4a, 0x08, 0x05,
+       0x5a, 0xfe, 0x82, 0x12, 0x08, 0x05, 0x1f, 0xfe, 0x66, 0x13, 0x22, 0x62,
+       0xb7, 0xfe, 0x03, 0xa1,
+       0xfe, 0x83, 0x80, 0xfe, 0xc8, 0x44, 0xfe, 0x2e, 0x13, 0xfe, 0x04, 0x91,
+       0xfe, 0x86, 0x91, 0x6a,
+       0x2a, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x56, 0xe0, 0x03, 0x60, 0x29,
+       0x61, 0x0c, 0x7f, 0x14,
+       0x80, 0x57, 0x60, 0x7d, 0x61, 0x01, 0xb3, 0xb8, 0x6a, 0x2a, 0x13, 0x62,
+       0x9b, 0x2e, 0x9c, 0x3c,
+       0x3a, 0x3f, 0x3b, 0x40, 0x90, 0xc0, 0xfe, 0x04, 0xfa, 0x2e, 0xfe, 0x05,
+       0xfa, 0x3c, 0x01, 0xef,
+       0xfe, 0x36, 0x10, 0x21, 0x0c, 0x7f, 0x0c, 0x80, 0x3a, 0x3f, 0x3b, 0x40,
+       0xe4, 0x08, 0x05, 0x1f,
+       0x17, 0xe0, 0x3a, 0x3d, 0x3b, 0x3e, 0x08, 0x05, 0xfe, 0xf7, 0x00, 0x37,
+       0x03, 0x5e, 0x29, 0x5f,
+       0xfe, 0x10, 0x58, 0xfe, 0x91, 0x58, 0x57, 0x49, 0x7d, 0x63, 0x02, 0xfe,
+       0xf4, 0x09, 0x08, 0x05,
+       0x1f, 0x17, 0xe0, 0x08, 0x05, 0xfe, 0xf7, 0x00, 0x37, 0xbe, 0xfe, 0x19,
+       0x81, 0x50, 0xfe, 0x10,
+       0x90, 0xfe, 0x92, 0x90, 0xfe, 0xd3, 0x10, 0x32, 0x07, 0xa6, 0x17, 0xfe,
+       0x08, 0x09, 0x12, 0xa6,
+       0x08, 0x05, 0x0a, 0xfe, 0x14, 0x13, 0x03, 0x3d, 0x29, 0x3e, 0x56, 0xfe,
+       0x08, 0x09, 0xfe, 0x0c,
+       0x58, 0xfe, 0x8d, 0x58, 0x02, 0x4a, 0x21, 0x41, 0xfe, 0x19, 0x80, 0xe7,
+       0x08, 0x05, 0x0a, 0xfe,
+       0x1a, 0x12, 0xfe, 0x6c, 0x19, 0xfe, 0x19, 0x41, 0xf4, 0xc2, 0xfe, 0xd1,
+       0xf0, 0xe2, 0x15, 0x7e,
+       0x01, 0x36, 0x10, 0xfe, 0x44, 0x00, 0xfe, 0x8e, 0x10, 0xfe, 0x6c, 0x19,
+       0x57, 0x3d, 0xfe, 0xed,
+       0x19, 0x7d, 0x3e, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51, 0xf4, 0x1e, 0xfe,
+       0x00, 0xff, 0x35, 0xfe,
+       0x74, 0x10, 0xc2, 0xfe, 0xd2, 0xf0, 0xfe, 0xa6, 0x0b, 0xfe, 0x76, 0x18,
+       0x1e, 0x19, 0x8a, 0x03,
+       0xd2, 0x1e, 0x06, 0xfe, 0x08, 0x13, 0x10, 0xfe, 0x16, 0x00, 0x02, 0x65,
+       0xfe, 0xd1, 0xf0, 0xfe,
+       0xb8, 0x0b, 0x15, 0x7e, 0x01, 0x36, 0x10, 0xfe, 0x17, 0x00, 0xfe, 0x42,
+       0x10, 0xfe, 0xce, 0xf0,
+       0xfe, 0xbe, 0x0b, 0xfe, 0x3c, 0x10, 0xfe, 0xcd, 0xf0, 0xfe, 0xca, 0x0b,
+       0x10, 0xfe, 0x22, 0x00,
+       0x02, 0x65, 0xfe, 0xcb, 0xf0, 0xfe, 0xd6, 0x0b, 0x10, 0xfe, 0x24, 0x00,
+       0x02, 0x65, 0xfe, 0xd0,
+       0xf0, 0xfe, 0xe0, 0x0b, 0x10, 0x9e, 0xe5, 0xfe, 0xcf, 0xf0, 0xfe, 0xea,
+       0x0b, 0x10, 0x58, 0xfe,
+       0x10, 0x10, 0xfe, 0xcc, 0xf0, 0xe2, 0x68, 0x05, 0x1f, 0x4d, 0x10, 0xfe,
+       0x12, 0x00, 0x2c, 0x0f,
+       0xfe, 0x4e, 0x11, 0x27, 0xfe, 0x00, 0x0c, 0xfe, 0x9e, 0xf0, 0xfe, 0x14,
+       0x0c, 0xbc, 0x17, 0x34,
+       0x2c, 0x77, 0xe6, 0xc5, 0x24, 0xc6, 0x24, 0x2c, 0xfa, 0x27, 0xfe, 0x20,
+       0x0c, 0x1c, 0x34, 0x94,
+       0xfe, 0x3c, 0x0c, 0x95, 0x86, 0xc5, 0xdc, 0xc6, 0xdc, 0x02, 0x24, 0x01,
+       0x4b, 0xfe, 0xdb, 0x10,
+       0x12, 0xfe, 0xe8, 0x00, 0xb5, 0xb6, 0x74, 0xc7, 0x81, 0xc8, 0x83, 0xfe,
+       0x89, 0xf0, 0x24, 0x33,
+       0x31, 0xe1, 0xc7, 0x81, 0xc8, 0x83, 0x27, 0xfe, 0x66, 0x0c, 0x1d, 0x24,
+       0x33, 0x31, 0xdf, 0xbc,
+       0x4e, 0x10, 0xfe, 0x42, 0x00, 0x02, 0x65, 0x7c, 0x06, 0xfe, 0x81, 0x49,
+       0x17, 0xfe, 0x2c, 0x0d,
+       0x08, 0x05, 0x0a, 0xfe, 0x44, 0x13, 0x10, 0x00, 0x55, 0x0a, 0xfe, 0x54,
+       0x12, 0x55, 0xfe, 0x28,
+       0x00, 0x23, 0xfe, 0x9a, 0x0d, 0x09, 0x46, 0x01, 0x0e, 0x07, 0x00, 0x66,
+       0x44, 0xfe, 0x28, 0x00,
+       0xfe, 0xe2, 0x10, 0x01, 0xf5, 0x01, 0xf6, 0x09, 0xa4, 0x01, 0xfe, 0x26,
+       0x0f, 0x64, 0x12, 0x2f,
+       0x01, 0x73, 0x02, 0x2b, 0x10, 0xfe, 0x44, 0x00, 0x55, 0x0a, 0xe9, 0x44,
+       0x0a, 0xfe, 0xb4, 0x10,
+       0x01, 0xb0, 0x44, 0x0a, 0xfe, 0xaa, 0x10, 0x01, 0xb0, 0xfe, 0x19, 0x82,
+       0xfe, 0x34, 0x46, 0xac,
+       0x44, 0x0a, 0x10, 0xfe, 0x43, 0x00, 0xfe, 0x96, 0x10, 0x08, 0x54, 0x0a,
+       0x37, 0x01, 0xf5, 0x01,
+       0xf6, 0x64, 0x12, 0x2f, 0x01, 0x73, 0x99, 0x0a, 0x64, 0x42, 0x92, 0x02,
+       0xfe, 0x2e, 0x03, 0x08,
+       0x05, 0x0a, 0x8a, 0x44, 0x0a, 0x10, 0x00, 0xfe, 0x5c, 0x10, 0x68, 0x05,
+       0x1a, 0xfe, 0x58, 0x12,
+       0x08, 0x05, 0x1a, 0xfe, 0x50, 0x13, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0,
+       0xfe, 0x50, 0x0d, 0xfe,
+       0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x56, 0x0d, 0x08, 0x54, 0x1a, 0x37,
+       0xfe, 0xa9, 0x10, 0x10,
+       0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0a, 0x50, 0xfe, 0x2e, 0x10, 0x10,
+       0xfe, 0x13, 0x00, 0xfe,
+       0x10, 0x10, 0x10, 0x6f, 0xab, 0x10, 0xfe, 0x41, 0x00, 0xaa, 0x10, 0xfe,
+       0x24, 0x00, 0x8c, 0xb5,
+       0xb6, 0x74, 0x03, 0x70, 0x28, 0x23, 0xd8, 0x50, 0xfe, 0x04, 0xe6, 0x1a,
+       0xfe, 0x9d, 0x41, 0xfe,
+       0x1c, 0x42, 0x64, 0x01, 0xe3, 0x02, 0x2b, 0xf8, 0x15, 0x0a, 0x39, 0xa0,
+       0xb4, 0x15, 0xfe, 0x31,
+       0x00, 0x39, 0xa2, 0x01, 0xfe, 0x48, 0x10, 0x02, 0xd7, 0x42, 0xfe, 0x06,
+       0xec, 0xd0, 0xfc, 0x44,
+       0x1b, 0xfe, 0xce, 0x45, 0x35, 0x42, 0xfe, 0x06, 0xea, 0xd0, 0xfe, 0x47,
+       0x4b, 0x91, 0xfe, 0x75,
+       0x57, 0x03, 0x5d, 0xfe, 0x98, 0x56, 0xfe, 0x38, 0x12, 0x09, 0x48, 0x01,
+       0x0e, 0xfe, 0x44, 0x48,
+       0x4f, 0x08, 0x05, 0x1b, 0xfe, 0x1a, 0x13, 0x09, 0x46, 0x01, 0x0e, 0x41,
+       0xfe, 0x41, 0x58, 0x09,
+       0xa4, 0x01, 0x0e, 0xfe, 0x49, 0x54, 0x96, 0xfe, 0x1e, 0x0e, 0x02, 0xfe,
+       0x2e, 0x03, 0x09, 0x5d,
+       0xfe, 0xee, 0x14, 0xfc, 0x44, 0x1b, 0xfe, 0xce, 0x45, 0x35, 0x42, 0xfe,
+       0xce, 0x47, 0xfe, 0xad,
+       0x13, 0x02, 0x2b, 0x22, 0x20, 0x07, 0x11, 0xfe, 0x9e, 0x12, 0x21, 0x13,
+       0x59, 0x13, 0x9f, 0x13,
+       0xd5, 0x22, 0x2f, 0x41, 0x39, 0x2f, 0xbc, 0xad, 0xfe, 0xbc, 0xf0, 0xfe,
+       0xe0, 0x0e, 0x0f, 0x06,
+       0x13, 0x59, 0x01, 0xfe, 0xda, 0x16, 0x03, 0xfe, 0x38, 0x01, 0x29, 0xfe,
+       0x3a, 0x01, 0x56, 0xfe,
+       0xe4, 0x0e, 0xfe, 0x02, 0xec, 0xd5, 0x69, 0x00, 0x66, 0xfe, 0x04, 0xec,
+       0x20, 0x4f, 0xfe, 0x05,
+       0xf6, 0xfe, 0x34, 0x01, 0x01, 0xfe, 0x4a, 0x17, 0xfe, 0x08, 0x90, 0xfe,
+       0x48, 0xf4, 0x0d, 0xfe,
+       0x18, 0x13, 0xba, 0xfe, 0x02, 0xea, 0xd5, 0x69, 0x7e, 0xfe, 0xc5, 0x13,
+       0x15, 0x1a, 0x39, 0xa0,
+       0xb4, 0xfe, 0x2e, 0x10, 0x03, 0xfe, 0x38, 0x01, 0x1e, 0xfe, 0xf0, 0xff,
+       0x0c, 0xfe, 0x60, 0x01,
+       0x03, 0xfe, 0x3a, 0x01, 0x0c, 0xfe, 0x62, 0x01, 0x43, 0x13, 0x20, 0x25,
+       0x06, 0x13, 0x2f, 0x12,
+       0x2f, 0x92, 0x0f, 0x06, 0x04, 0x21, 0x04, 0x22, 0x59, 0xfe, 0xf7, 0x12,
+       0x22, 0x9f, 0xb7, 0x13,
+       0x9f, 0x07, 0x7e, 0xfe, 0x71, 0x13, 0xfe, 0x24, 0x1c, 0x15, 0x19, 0x39,
+       0xa0, 0xb4, 0xfe, 0xd9,
+       0x10, 0xc3, 0xfe, 0x03, 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x04,
+       0xc3, 0xfe, 0x03, 0xdc,
+       0xfe, 0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x04, 0xfe, 0x03, 0x57, 0xc3, 0x21,
+       0xfe, 0x00, 0xcc, 0x04,
+       0xfe, 0x03, 0x57, 0xc3, 0x78, 0x04, 0x08, 0x05, 0x58, 0xfe, 0x22, 0x13,
+       0xfe, 0x1c, 0x80, 0x07,
+       0x06, 0xfe, 0x1a, 0x13, 0xfe, 0x1e, 0x80, 0xed, 0xfe, 0x1d, 0x80, 0xae,
+       0xfe, 0x0c, 0x90, 0xfe,
+       0x0e, 0x13, 0xfe, 0x0e, 0x90, 0xac, 0xfe, 0x3c, 0x90, 0xfe, 0x30, 0xf4,
+       0x0a, 0xfe, 0x3c, 0x50,
+       0xaa, 0x01, 0xfe, 0x7a, 0x17, 0x32, 0x07, 0x2f, 0xad, 0x01, 0xfe, 0xb4,
+       0x16, 0x08, 0x05, 0x1b,
+       0x4e, 0x01, 0xf5, 0x01, 0xf6, 0x12, 0xfe, 0xe9, 0x00, 0x08, 0x05, 0x58,
+       0xfe, 0x2c, 0x13, 0x01,
+       0xfe, 0x0c, 0x17, 0xfe, 0x1e, 0x1c, 0xfe, 0x14, 0x90, 0xfe, 0x96, 0x90,
+       0x0c, 0xfe, 0x64, 0x01,
+       0x14, 0xfe, 0x66, 0x01, 0x08, 0x05, 0x5b, 0xfe, 0x12, 0x12, 0xfe, 0x03,
+       0x80, 0x8d, 0xfe, 0x01,
+       0xec, 0x20, 0xfe, 0x80, 0x40, 0x13, 0x20, 0x6a, 0x2a, 0x12, 0xcf, 0x64,
+       0x22, 0x20, 0xfb, 0x79,
+       0x20, 0x04, 0xfe, 0x08, 0x1c, 0x03, 0xfe, 0xac, 0x00, 0xfe, 0x06, 0x58,
+       0x03, 0xfe, 0xae, 0x00,
+
+       0xfe, 0x07, 0x58, 0x03, 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58, 0x03, 0xfe,
+       0xb2, 0x00, 0xfe, 0x09,
+       0x58, 0xfe, 0x0a, 0x1c, 0x25, 0x6e, 0x13, 0xd0, 0x21, 0x0c, 0x5c, 0x0c,
+       0x45, 0x0f, 0x46, 0x52,
+       0x50, 0x18, 0x1b, 0xfe, 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x23, 0xfe, 0xfc,
+       0x0f, 0x44, 0x11, 0x0f,
+       0x48, 0x52, 0x18, 0x58, 0xfe, 0x90, 0x4d, 0xfe, 0x91, 0x54, 0x23, 0xe4,
+       0x25, 0x11, 0x13, 0x20,
+       0x7c, 0x6f, 0x4f, 0x22, 0x20, 0xfb, 0x79, 0x20, 0x12, 0xcf, 0xfe, 0x14,
+       0x56, 0xfe, 0xd6, 0xf0,
+       0xfe, 0x26, 0x10, 0xf8, 0x74, 0xfe, 0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe,
+       0x18, 0x1c, 0x04, 0x42,
+       0xfe, 0x0c, 0x14, 0xfc, 0xfe, 0x07, 0xe6, 0x1b, 0xfe, 0xce, 0x47, 0xfe,
+       0xf5, 0x13, 0x04, 0x01,
+       0xb0, 0x7c, 0x6f, 0x4f, 0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x42,
+       0x13, 0x32, 0x07, 0x2f,
+       0xfe, 0x34, 0x13, 0x09, 0x48, 0x01, 0x0e, 0xbb, 0xfe, 0x36, 0x12, 0xfe,
+       0x41, 0x48, 0xfe, 0x45,
+       0x48, 0x01, 0xf0, 0xfe, 0x00, 0xcc, 0xbb, 0xfe, 0xf3, 0x13, 0x43, 0x78,
+       0x07, 0x11, 0xac, 0x09,
+       0x84, 0x01, 0x0e, 0xfe, 0x80, 0x5c, 0x01, 0x73, 0xfe, 0x0e, 0x10, 0x07,
+       0x82, 0x4e, 0xfe, 0x14,
+       0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x60, 0x10, 0x04, 0xfe, 0x44, 0x58, 0x8d,
+       0xfe, 0x01, 0xec, 0xa2,
+       0xfe, 0x9e, 0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x1a, 0x79,
+       0x2a, 0x01, 0xe3, 0xfe,
+       0xdd, 0x10, 0x2c, 0xc7, 0x81, 0xc8, 0x83, 0x33, 0x31, 0xde, 0x07, 0x1a,
+       0xfe, 0x48, 0x12, 0x07,
+       0x0a, 0xfe, 0x56, 0x12, 0x07, 0x19, 0xfe, 0x30, 0x12, 0x07, 0xc9, 0x17,
+       0xfe, 0x32, 0x12, 0x07,
+       0xfe, 0x23, 0x00, 0x17, 0xeb, 0x07, 0x06, 0x17, 0xfe, 0x9c, 0x12, 0x07,
+       0x1f, 0xfe, 0x12, 0x12,
+       0x07, 0x00, 0x17, 0x24, 0x15, 0xc9, 0x01, 0x36, 0xa9, 0x2d, 0x01, 0x0b,
+       0x94, 0x4b, 0x04, 0x2d,
+       0xdd, 0x09, 0xd1, 0x01, 0xfe, 0x26, 0x0f, 0x12, 0x82, 0x02, 0x2b, 0x2d,
+       0x32, 0x07, 0xa6, 0xfe,
+       0xd9, 0x13, 0x3a, 0x3d, 0x3b, 0x3e, 0x56, 0xfe, 0xf0, 0x11, 0x08, 0x05,
+       0x5a, 0xfe, 0x72, 0x12,
+       0x9b, 0x2e, 0x9c, 0x3c, 0x90, 0xc0, 0x96, 0xfe, 0xba, 0x11, 0x22, 0x62,
+       0xfe, 0x26, 0x13, 0x03,
+       0x7f, 0x29, 0x80, 0x56, 0xfe, 0x76, 0x0d, 0x0c, 0x60, 0x14, 0x61, 0x21,
+       0x0c, 0x7f, 0x0c, 0x80,
+       0x01, 0xb3, 0x25, 0x6e, 0x77, 0x13, 0x62, 0x01, 0xef, 0x9b, 0x2e, 0x9c,
+       0x3c, 0xfe, 0x04, 0x55,
+       0xfe, 0xa5, 0x55, 0xfe, 0x04, 0xfa, 0x2e, 0xfe, 0x05, 0xfa, 0x3c, 0xfe,
+       0x91, 0x10, 0x03, 0x3f,
+       0x29, 0x40, 0xfe, 0x40, 0x56, 0xfe, 0xe1, 0x56, 0x0c, 0x3f, 0x14, 0x40,
+       0x88, 0x9b, 0x2e, 0x9c,
+       0x3c, 0x90, 0xc0, 0x03, 0x5e, 0x29, 0x5f, 0xfe, 0x00, 0x56, 0xfe, 0xa1,
+       0x56, 0x0c, 0x5e, 0x14,
+       0x5f, 0x08, 0x05, 0x5a, 0xfe, 0x1e, 0x12, 0x22, 0x62, 0xfe, 0x1f, 0x40,
+       0x03, 0x60, 0x29, 0x61,
+       0xfe, 0x2c, 0x50, 0xfe, 0xae, 0x50, 0x03, 0x3f, 0x29, 0x40, 0xfe, 0x44,
+       0x50, 0xfe, 0xc6, 0x50,
+       0x03, 0x5e, 0x29, 0x5f, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x03, 0x3d,
+       0x29, 0x3e, 0xfe, 0x40,
+       0x50, 0xfe, 0xc2, 0x50, 0x02, 0x89, 0x25, 0x06, 0x13, 0xd4, 0x02, 0x72,
+       0x2d, 0x01, 0x0b, 0x1d,
+       0x4c, 0x33, 0x31, 0xde, 0x07, 0x06, 0x23, 0x4c, 0x32, 0x07, 0xa6, 0x23,
+       0x72, 0x01, 0xaf, 0x1e,
+       0x43, 0x17, 0x4c, 0x08, 0x05, 0x0a, 0xee, 0x3a, 0x3d, 0x3b, 0x3e, 0xfe,
+       0x0a, 0x55, 0x35, 0xfe,
+       0x8b, 0x55, 0x57, 0x3d, 0x7d, 0x3e, 0xfe, 0x0c, 0x51, 0xfe, 0x8e, 0x51,
+       0x02, 0x72, 0xfe, 0x19,
+       0x81, 0xba, 0xfe, 0x19, 0x41, 0x02, 0x72, 0x2d, 0x01, 0x0b, 0x1c, 0x34,
+       0x1d, 0xe8, 0x33, 0x31,
+       0xe1, 0x55, 0x19, 0xfe, 0xa6, 0x12, 0x55, 0x0a, 0x4d, 0x02, 0x4c, 0x01,
+       0x0b, 0x1c, 0x34, 0x1d,
+       0xe8, 0x33, 0x31, 0xdf, 0x07, 0x19, 0x23, 0x4c, 0x01, 0x0b, 0x1d, 0xe8,
+       0x33, 0x31, 0xfe, 0xe8,
+       0x09, 0xfe, 0xc2, 0x49, 0x51, 0x03, 0xfe, 0x9c, 0x00, 0x28, 0x8a, 0x53,
+       0x05, 0x1f, 0x35, 0xa9,
+       0xfe, 0xbb, 0x45, 0x55, 0x00, 0x4e, 0x44, 0x06, 0x7c, 0x43, 0xfe, 0xda,
+       0x14, 0x01, 0xaf, 0x8c,
+       0xfe, 0x4b, 0x45, 0xee, 0x32, 0x07, 0xa5, 0xed, 0x03, 0xcd, 0x28, 0x8a,
+       0x03, 0x45, 0x28, 0x35,
+       0x67, 0x02, 0x72, 0xfe, 0xc0, 0x5d, 0xfe, 0xf8, 0x14, 0xfe, 0x03, 0x17,
+       0x03, 0x5c, 0xc1, 0x0c,
+       0x5c, 0x67, 0x2d, 0x01, 0x0b, 0x26, 0x89, 0x01, 0xfe, 0x9e, 0x15, 0x02,
+       0x89, 0x01, 0x0b, 0x1c,
+       0x34, 0x1d, 0x4c, 0x33, 0x31, 0xdf, 0x07, 0x06, 0x23, 0x4c, 0x01, 0xf1,
+       0xfe, 0x42, 0x58, 0xf1,
+       0xfe, 0xa4, 0x14, 0x8c, 0xfe, 0x4a, 0xf4, 0x0a, 0x17, 0x4c, 0xfe, 0x4a,
+       0xf4, 0x06, 0xea, 0x32,
+       0x07, 0xa5, 0x8b, 0x02, 0x72, 0x03, 0x45, 0xc1, 0x0c, 0x45, 0x67, 0x2d,
+       0x01, 0x0b, 0x26, 0x89,
+       0x01, 0xfe, 0xcc, 0x15, 0x02, 0x89, 0x0f, 0x06, 0x27, 0xfe, 0xbe, 0x13,
+       0x26, 0xfe, 0xd4, 0x13,
+       0x76, 0xfe, 0x89, 0x48, 0x01, 0x0b, 0x21, 0x76, 0x04, 0x7b, 0xfe, 0xd0,
+       0x13, 0x1c, 0xfe, 0xd0,
+       0x13, 0x1d, 0xfe, 0xbe, 0x13, 0x67, 0x2d, 0x01, 0x0b, 0xfe, 0xd5, 0x10,
+       0x0f, 0x71, 0xff, 0x02,
+       0x00, 0x57, 0x52, 0x93, 0x1e, 0xfe, 0xff, 0x7f, 0xfe, 0x30, 0x56, 0xfe,
+       0x00, 0x5c, 0x04, 0x0f,
+       0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0x1e, 0x43, 0xfe, 0x30, 0x56,
+       0xfe, 0x00, 0x5c, 0x04,
+       0x0f, 0x71, 0xff, 0x02, 0x00, 0x57, 0x52, 0x93, 0x04, 0x0f, 0x71, 0xff,
+       0x02, 0x00, 0x57, 0x52,
+       0x93, 0xfe, 0x0b, 0x58, 0x04, 0x09, 0x5c, 0x01, 0x87, 0x09, 0x45, 0x01,
+       0x87, 0x04, 0xfe, 0x03,
+       0xa1, 0x1e, 0x11, 0xff, 0x03, 0x00, 0x54, 0xfe, 0x00, 0xf4, 0x1f, 0x52,
+       0xfe, 0x00, 0x7d, 0xfe,
+       0x01, 0x7d, 0xfe, 0x02, 0x7d, 0xfe, 0x03, 0x7c, 0x6a, 0x2a, 0x0c, 0x5e,
+       0x14, 0x5f, 0x57, 0x3f,
+       0x7d, 0x40, 0x04, 0xdd, 0xfe, 0x82, 0x4a, 0xfe, 0xe1, 0x1a, 0xfe, 0x83,
+       0x5a, 0x8d, 0x04, 0x01,
+       0xfe, 0x0c, 0x19, 0xfe, 0x42, 0x48, 0x50, 0x51, 0x91, 0x01, 0x0b, 0x1d,
+       0xfe, 0x96, 0x15, 0x33,
+       0x31, 0xe1, 0x01, 0x0b, 0x1d, 0xfe, 0x96, 0x15, 0x33, 0x31, 0xfe, 0xe8,
+       0x0a, 0xfe, 0xc1, 0x59,
+       0x03, 0xcd, 0x28, 0xfe, 0xcc, 0x12, 0x53, 0x05, 0x1a, 0xfe, 0xc4, 0x13,
+       0x21, 0x69, 0x1a, 0xee,
+       0x55, 0xca, 0x6b, 0xfe, 0xdc, 0x14, 0x4d, 0x0f, 0x06, 0x18, 0xca, 0x7c,
+       0x30, 0xfe, 0x78, 0x10,
+       0xff, 0x02, 0x83, 0x55, 0xab, 0xff, 0x02, 0x83, 0x55, 0x69, 0x19, 0xae,
+       0x98, 0xfe, 0x30, 0x00,
+       0x96, 0xf2, 0x18, 0x6d, 0x0f, 0x06, 0xfe, 0x56, 0x10, 0x69, 0x0a, 0xed,
+       0x98, 0xfe, 0x64, 0x00,
+       0x96, 0xf2, 0x09, 0xfe, 0x64, 0x00, 0x18, 0x9e, 0x0f, 0x06, 0xfe, 0x28,
+       0x10, 0x69, 0x06, 0xfe,
+       0x60, 0x13, 0x98, 0xfe, 0xc8, 0x00, 0x96, 0xf2, 0x09, 0xfe, 0xc8, 0x00,
+       0x18, 0x59, 0x0f, 0x06,
+       0x88, 0x98, 0xfe, 0x90, 0x01, 0x7a, 0xfe, 0x42, 0x15, 0x91, 0xe4, 0xfe,
+       0x43, 0xf4, 0x9f, 0xfe,
+       0x56, 0xf0, 0xfe, 0x54, 0x15, 0xfe, 0x04, 0xf4, 0x71, 0xfe, 0x43, 0xf4,
+       0x9e, 0xfe, 0xf3, 0x10,
+       0xfe, 0x40, 0x5c, 0x01, 0xfe, 0x16, 0x14, 0x1e, 0x43, 0xec, 0xfe, 0x00,
+       0x17, 0xfe, 0x4d, 0xe4,
+       0x6e, 0x7a, 0xfe, 0x90, 0x15, 0xc4, 0x6e, 0xfe, 0x1c, 0x10, 0xfe, 0x00,
+       0x17, 0xfe, 0x4d, 0xe4,
+       0xcc, 0x7a, 0xfe, 0x90, 0x15, 0xc4, 0xcc, 0x88, 0x51, 0x21, 0xfe, 0x4d,
+       0xf4, 0x00, 0xe9, 0x91,
+       0x0f, 0x06, 0xfe, 0xb4, 0x56, 0xfe, 0xc3, 0x58, 0x04, 0x51, 0x0f, 0x0a,
+       0x04, 0x16, 0x06, 0x01,
+       0x0b, 0x26, 0xf3, 0x16, 0x0a, 0x01, 0x0b, 0x26, 0xf3, 0x16, 0x19, 0x01,
+       0x0b, 0x26, 0xf3, 0x76,
+       0xfe, 0x89, 0x49, 0x01, 0x0b, 0x04, 0x16, 0x06, 0x01, 0x0b, 0x26, 0xb1,
+       0x16, 0x19, 0x01, 0x0b,
+       0x26, 0xb1, 0x16, 0x06, 0x01, 0x0b, 0x26, 0xb1, 0xfe, 0x89, 0x49, 0x01,
+       0x0b, 0x26, 0xb1, 0x76,
+       0xfe, 0x89, 0x4a, 0x01, 0x0b, 0x04, 0x51, 0x04, 0x22, 0xd3, 0x07, 0x06,
+       0xfe, 0x48, 0x13, 0xb8,
+       0x13, 0xd3, 0xfe, 0x49, 0xf4, 0x00, 0x4d, 0x76, 0xa9, 0x67, 0xfe, 0x01,
+       0xec, 0xfe, 0x27, 0x01,
+       0xfe, 0x89, 0x48, 0xff, 0x02, 0x00, 0x10, 0x27, 0xfe, 0x2e, 0x16, 0x32,
+       0x07, 0xfe, 0xe3, 0x00,
+       0xfe, 0x20, 0x13, 0x1d, 0xfe, 0x52, 0x16, 0x21, 0x13, 0xd4, 0x01, 0x4b,
+       0x22, 0xd4, 0x07, 0x06,
+       0x4e, 0x08, 0x54, 0x06, 0x37, 0x04, 0x09, 0x48, 0x01, 0x0e, 0xfb, 0x8e,
+       0x07, 0x11, 0xae, 0x09,
+       0x84, 0x01, 0x0e, 0x8e, 0x09, 0x5d, 0x01, 0xa8, 0x04, 0x09, 0x84, 0x01,
+       0x0e, 0x8e, 0xfe, 0x80,
+       0xe7, 0x11, 0x07, 0x11, 0x8a, 0xfe, 0x45, 0x58, 0x01, 0xf0, 0x8e, 0x04,
+       0x09, 0x48, 0x01, 0x0e,
+       0x8e, 0x09, 0x5d, 0x01, 0xa8, 0x04, 0x09, 0x48, 0x01, 0x0e, 0xfe, 0x80,
+       0x80, 0xfe, 0x80, 0x4c,
+       0xfe, 0x49, 0xe4, 0x11, 0xae, 0x09, 0x84, 0x01, 0x0e, 0xfe, 0x80, 0x4c,
+       0x09, 0x5d, 0x01, 0x87,
+       0x04, 0x18, 0x11, 0x75, 0x6c, 0xfe, 0x60, 0x01, 0xfe, 0x18, 0xdf, 0xfe,
+       0x19, 0xde, 0xfe, 0x24,
+       0x1c, 0xfe, 0x1d, 0xf7, 0x1b, 0x97, 0xfe, 0xee, 0x16, 0x01, 0xfe, 0xf4,
+       0x17, 0xad, 0x9a, 0x1b,
+       0x6c, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x04, 0xb9, 0x23, 0xfe, 0xde,
+       0x16, 0xfe, 0xda, 0x10,
+       0x18, 0x11, 0x75, 0x03, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x1f, 0xfe,
+       0x18, 0x58, 0x03, 0xfe,
+       0x66, 0x01, 0xfe, 0x19, 0x58, 0x9a, 0x1f, 0xfe, 0x3c, 0x90, 0xfe, 0x30,
+       0xf4, 0x06, 0xfe, 0x3c,
+       0x50, 0x6c, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7, 0x1f,
+       0x97, 0xfe, 0x38, 0x17,
+       0xfe, 0xb6, 0x14, 0x35, 0x04, 0xb9, 0x23, 0xfe, 0x10, 0x17, 0xfe, 0x9c,
+       0x10, 0x18, 0x11, 0x75,
+       0xfe, 0x83, 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe, 0x1d, 0xf7,
+       0x2e, 0x97, 0xfe, 0x5a,
+       0x17, 0xfe, 0x94, 0x14, 0xec, 0x9a, 0x2e, 0x6c, 0x1a, 0xfe, 0xaf, 0x19,
+       0xfe, 0x98, 0xe7, 0x00,
+       0x04, 0xb9, 0x23, 0xfe, 0x4e, 0x17, 0xfe, 0x6c, 0x10, 0x18, 0x11, 0x75,
+       0xfe, 0x30, 0xbc, 0xfe,
+       0xb2, 0xbc, 0x9a, 0xcb, 0x6c, 0x1a, 0xfe, 0x0f, 0x79, 0xfe, 0x1c, 0xf7,
+       0xcb, 0x97, 0xfe, 0x92,
+       0x17, 0xfe, 0x5c, 0x14, 0x35, 0x04, 0xb9, 0x23, 0xfe, 0x7e, 0x17, 0xfe,
+       0x42, 0x10, 0xfe, 0x02,
+       0xf6, 0x11, 0x75, 0xfe, 0x18, 0xfe, 0x60, 0xfe, 0x19, 0xfe, 0x61, 0xfe,
+       0x03, 0xa1, 0xfe, 0x1d,
+       0xf7, 0x5b, 0x97, 0xfe, 0xb8, 0x17, 0xfe, 0x36, 0x14, 0xfe, 0x1c, 0x13,
+       0x9a, 0x5b, 0x41, 0xfe,
+       0x83, 0x58, 0xfe, 0xaf, 0x19, 0xfe, 0x80, 0xe7, 0x11, 0xfe, 0x81, 0xe7,
+       0x11, 0x12, 0xfe, 0xdd,
+       0x00, 0x6a, 0x2a, 0x04, 0x6a, 0x2a, 0xfe, 0x12, 0x45, 0x23, 0xfe, 0xa8,
+       0x17, 0x15, 0x06, 0x39,
+       0xa0, 0xb4, 0x02, 0x2b, 0xfe, 0x39, 0xf0, 0xfe, 0xfc, 0x17, 0x21, 0x04,
+       0xfe, 0x7e, 0x18, 0x1e,
+       0x19, 0x66, 0x0f, 0x0d, 0x04, 0x75, 0x03, 0xd2, 0x1e, 0x06, 0xfe, 0xef,
+       0x12, 0xfe, 0xe1, 0x10,
+       0x7c, 0x6f, 0x4f, 0x32, 0x07, 0x2f, 0xfe, 0x3c, 0x13, 0xf1, 0xfe, 0x42,
+       0x13, 0x42, 0x92, 0x09,
+       0x48, 0x01, 0x0e, 0xbb, 0xeb, 0xfe, 0x41, 0x48, 0xfe, 0x45, 0x48, 0x01,
+       0xf0, 0xfe, 0x00, 0xcc,
+       0xbb, 0xfe, 0xf3, 0x13, 0x43, 0x78, 0x07, 0x11, 0xac, 0x09, 0x84, 0x01,
+       0x0e, 0xfe, 0x80, 0x4c,
+       0x01, 0x73, 0xfe, 0x16, 0x10, 0x07, 0x82, 0x8b, 0xfe, 0x40, 0x14, 0xfe,
+       0x24, 0x12, 0xfe, 0x14,
+       0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0x1c, 0x18, 0x18, 0x0a, 0x04, 0xfe, 0x9c,
+       0xe7, 0x0a, 0x10, 0xfe,
+       0x15, 0x00, 0x64, 0x79, 0x2a, 0x01, 0xe3, 0x18, 0x06, 0x04, 0x42, 0x92,
+       0x08, 0x54, 0x1b, 0x37,
+       0x12, 0x2f, 0x01, 0x73, 0x18, 0x06, 0x04, 0xfe, 0x38, 0x90, 0xfe, 0xba,
+       0x90, 0x3a, 0xce, 0x3b,
+       0xcf, 0xfe, 0x48, 0x55, 0x35, 0xfe, 0xc9, 0x55, 0x04, 0x22, 0xa3, 0x77,
+       0x13, 0xa3, 0x04, 0x09,
+       0xa4, 0x01, 0x0e, 0xfe, 0x41, 0x48, 0x09, 0x46, 0x01, 0x0e, 0xfe, 0x49,
+       0x44, 0x17, 0xfe, 0xe8,
+       0x18, 0x77, 0x78, 0x04, 0x09, 0x48, 0x01, 0x0e, 0x07, 0x11, 0x4e, 0x09,
+       0x5d, 0x01, 0xa8, 0x09,
+       0x46, 0x01, 0x0e, 0x77, 0x78, 0x04, 0xfe, 0x4e, 0xe4, 0x19, 0x6b, 0xfe,
+       0x1c, 0x19, 0x03, 0xfe,
+       0x90, 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, 0xfe, 0x4e, 0xe4, 0xc9,
+       0x6b, 0xfe, 0x2e, 0x19,
+       0x03, 0xfe, 0x92, 0x00, 0xfe, 0x02, 0xe6, 0x1a, 0xe5, 0xfe, 0x4e, 0xe4,
+       0xfe, 0x0b, 0x00, 0x6b,
+       0xfe, 0x40, 0x19, 0x03, 0xfe, 0x94, 0x00, 0xfe, 0x02, 0xe6, 0x1f, 0xfe,
+       0x08, 0x10, 0x03, 0xfe,
+       0x96, 0x00, 0xfe, 0x02, 0xe6, 0x6d, 0xfe, 0x4e, 0x45, 0xea, 0xba, 0xff,
+       0x04, 0x68, 0x54, 0xe7,
+       0x1e, 0x6e, 0xfe, 0x08, 0x1c, 0xfe, 0x67, 0x19, 0xfe, 0x0a, 0x1c, 0xfe,
+       0x1a, 0xf4, 0xfe, 0x00,
+       0x04, 0xea, 0xfe, 0x48, 0xf4, 0x19, 0x7a, 0xfe, 0x74, 0x19, 0x0f, 0x19,
+       0x04, 0x07, 0x7e, 0xfe,
+       0x5a, 0xf0, 0xfe, 0x84, 0x19, 0x25, 0xfe, 0x09, 0x00, 0xfe, 0x34, 0x10,
+       0x07, 0x1a, 0xfe, 0x5a,
+       0xf0, 0xfe, 0x92, 0x19, 0x25, 0xca, 0xfe, 0x26, 0x10, 0x07, 0x19, 0x66,
+       0x25, 0x6d, 0xe5, 0x07,
+       0x0a, 0x66, 0x25, 0x9e, 0xfe, 0x0e, 0x10, 0x07, 0x06, 0x66, 0x25, 0x59,
+       0xa9, 0xb8, 0x04, 0x15,
+       0xfe, 0x09, 0x00, 0x01, 0x36, 0xfe, 0x04, 0xfe, 0x81, 0x03, 0x83, 0xfe,
+       0x40, 0x5c, 0x04, 0x1c,
+       0xf7, 0xfe, 0x14, 0xf0, 0x0b, 0x27, 0xfe, 0xd6, 0x19, 0x1c, 0xf7, 0x7b,
+       0xf7, 0xfe, 0x82, 0xf0,
+       0xfe, 0xda, 0x19, 0x04, 0xff, 0xcc, 0x00, 0x00,
 };
 
-STATIC unsigned short _adv_asc38C0800_size =
-        sizeof(_adv_asc38C0800_buf); /* 0x14E1 */
-STATIC ADV_DCNT _adv_asc38C0800_chksum =
-        0x050D3FD8UL; /* Expanded little-endian checksum. */
+static unsigned short _adv_asc38C0800_size = sizeof(_adv_asc38C0800_buf);      /* 0x14E1 */
+static ADV_DCNT _adv_asc38C0800_chksum = 0x050D3FD8UL; /* Expanded little-endian checksum. */
 
 /* Microcode buffer is kept after initialization for error recovery. */
-STATIC unsigned char _adv_asc38C1600_buf[] = {
-  0x00,  0x00,  0x00,  0xf2,  0x00,  0x16,  0x00,  0xfc,  0x00,  0x10,  0x00,  0xf0,  0x18,  0xe4,  0x01,  0x00,
-  0x04,  0x1e,  0x48,  0xe4,  0x03,  0xf6,  0xf7,  0x13,  0x2e,  0x1e,  0x02,  0x00,  0x07,  0x17,  0xc0,  0x5f,
-  0x00,  0xfa,  0xff,  0xff,  0x04,  0x00,  0x00,  0xf6,  0x09,  0xe7,  0x82,  0xe7,  0x85,  0xf0,  0x86,  0xf0,
-  0x4e,  0x10,  0x9e,  0xe7,  0xff,  0x00,  0x55,  0xf0,  0x01,  0xf6,  0x03,  0x00,  0x98,  0x57,  0x01,  0xe6,
-  0x00,  0xea,  0x00,  0xec,  0x01,  0xfa,  0x18,  0xf4,  0x08,  0x00,  0xf0,  0x1d,  0x38,  0x54,  0x32,  0xf0,
-  0x10,  0x00,  0xc2,  0x0e,  0x1e,  0xf0,  0xd5,  0xf0,  0xbc,  0x00,  0x4b,  0xe4,  0x00,  0xe6,  0xb1,  0xf0,
-  0xb4,  0x00,  0x02,  0x13,  0x3e,  0x1c,  0xc8,  0x47,  0x3e,  0x00,  0xd8,  0x01,  0x06,  0x13,  0x0c,  0x1c,
-  0x5e,  0x1e,  0x00,  0x57,  0xc8,  0x57,  0x01,  0xfc,  0xbc,  0x0e,  0xa2,  0x12,  0xb9,  0x54,  0x00,  0x80,
-  0x62,  0x0a,  0x5a,  0x12,  0xc8,  0x15,  0x3e,  0x1e,  0x18,  0x40,  0xbd,  0x56,  0x03,  0xe6,  0x01,  0xea,
-  0x5c,  0xf0,  0x0f,  0x00,  0x20,  0x00,  0x6c,  0x01,  0x6e,  0x01,  0x04,  0x12,  0x04,  0x13,  0xbb,  0x55,
-  0x3c,  0x56,  0x3e,  0x57,  0x03,  0x58,  0x4a,  0xe4,  0x40,  0x00,  0xb6,  0x00,  0xbb,  0x00,  0xc0,  0x00,
-  0x00,  0x01,  0x01,  0x01,  0x3e,  0x01,  0x58,  0x0a,  0x44,  0x10,  0x0a,  0x12,  0x4c,  0x1c,  0x4e,  0x1c,
-  0x02,  0x4a,  0x30,  0xe4,  0x05,  0xe6,  0x0c,  0x00,  0x3c,  0x00,  0x80,  0x00,  0x24,  0x01,  0x3c,  0x01,
-  0x68,  0x01,  0x6a,  0x01,  0x70,  0x01,  0x72,  0x01,  0x74,  0x01,  0x76,  0x01,  0x78,  0x01,  0x7c,  0x01,
-  0xc6,  0x0e,  0x0c,  0x10,  0xac,  0x12,  0xae,  0x12,  0x16,  0x1a,  0x32,  0x1c,  0x6e,  0x1e,  0x02,  0x48,
-  0x3a,  0x55,  0xc9,  0x57,  0x02,  0xee,  0x5b,  0xf0,  0x03,  0xf7,  0x06,  0xf7,  0x03,  0xfc,  0x06,  0x00,
-  0x1e,  0x00,  0xbe,  0x00,  0xe1,  0x00,  0x0c,  0x12,  0x18,  0x1a,  0x70,  0x1a,  0x30,  0x1c,  0x38,  0x1c,
-  0x10,  0x44,  0x00,  0x4c,  0xb0,  0x57,  0x40,  0x5c,  0x4d,  0xe4,  0x04,  0xea,  0x5d,  0xf0,  0xa7,  0xf0,
-  0x04,  0xf6,  0x02,  0xfc,  0x05,  0x00,  0x09,  0x00,  0x19,  0x00,  0x32,  0x00,  0x33,  0x00,  0x34,  0x00,
-  0x36,  0x00,  0x98,  0x00,  0x9e,  0x00,  0xcc,  0x00,  0x20,  0x01,  0x4e,  0x01,  0x79,  0x01,  0x3c,  0x09,
-  0x68,  0x0d,  0x02,  0x10,  0x04,  0x10,  0x3a,  0x10,  0x08,  0x12,  0x0a,  0x13,  0x40,  0x16,  0x50,  0x16,
-  0x00,  0x17,  0x4a,  0x19,  0x00,  0x4e,  0x00,  0x54,  0x01,  0x58,  0x00,  0xdc,  0x05,  0xf0,  0x09,  0xf0,
-  0x59,  0xf0,  0xb8,  0xf0,  0x48,  0xf4,  0x0e,  0xf7,  0x0a,  0x00,  0x9b,  0x00,  0x9c,  0x00,  0xa4,  0x00,
-  0xb5,  0x00,  0xba,  0x00,  0xd0,  0x00,  0xe7,  0x00,  0xf0,  0x03,  0x69,  0x08,  0xe9,  0x09,  0x5c,  0x0c,
-  0xb6,  0x12,  0xbc,  0x19,  0xd8,  0x1b,  0x20,  0x1c,  0x34,  0x1c,  0x36,  0x1c,  0x42,  0x1d,  0x08,  0x44,
-  0x38,  0x44,  0x91,  0x44,  0x0a,  0x45,  0x48,  0x46,  0x89,  0x48,  0x68,  0x54,  0x83,  0x55,  0x83,  0x59,
-  0x31,  0xe4,  0x02,  0xe6,  0x07,  0xf0,  0x08,  0xf0,  0x0b,  0xf0,  0x0c,  0xf0,  0x4b,  0xf4,  0x04,  0xf8,
-  0x05,  0xf8,  0x02,  0xfa,  0x03,  0xfa,  0x04,  0xfc,  0x05,  0xfc,  0x07,  0x00,  0xa8,  0x00,  0xaa,  0x00,
-  0xb9,  0x00,  0xe0,  0x00,  0xe5,  0x00,  0x22,  0x01,  0x26,  0x01,  0x60,  0x01,  0x7a,  0x01,  0x82,  0x01,
-  0xc8,  0x01,  0xca,  0x01,  0x86,  0x02,  0x6a,  0x03,  0x18,  0x05,  0xb2,  0x07,  0x68,  0x08,  0x10,  0x0d,
-  0x06,  0x10,  0x0a,  0x10,  0x0e,  0x10,  0x12,  0x10,  0x60,  0x10,  0xed,  0x10,  0xf3,  0x10,  0x06,  0x12,
-  0x10,  0x12,  0x1e,  0x12,  0x0c,  0x13,  0x0e,  0x13,  0x10,  0x13,  0xfe,  0x9c,  0xf0,  0x35,  0x05,  0xfe,
-  0xec,  0x0e,  0xff,  0x10,  0x00,  0x00,  0xe9,  0xfe,  0x34,  0x1f,  0x00,  0xe8,  0xfe,  0x88,  0x01,  0xff,
-  0x03,  0x00,  0x00,  0xfe,  0x93,  0x15,  0xfe,  0x0f,  0x05,  0xff,  0x38,  0x00,  0x00,  0xfe,  0x57,  0x24,
-  0x00,  0xfe,  0x4c,  0x00,  0x65,  0xff,  0x04,  0x00,  0x00,  0x1a,  0xff,  0x09,  0x00,  0x00,  0xff,  0x08,
-  0x01,  0x01,  0xff,  0x08,  0xff,  0xff,  0xff,  0x27,  0x00,  0x00,  0xff,  0x10,  0xff,  0xff,  0xff,  0x13,
-  0x00,  0x00,  0xfe,  0x78,  0x56,  0xfe,  0x34,  0x12,  0xff,  0x21,  0x00,  0x00,  0xfe,  0x04,  0xf7,  0xe8,
-  0x37,  0x7d,  0x0d,  0x01,  0xfe,  0x4a,  0x11,  0xfe,  0x04,  0xf7,  0xe8,  0x7d,  0x0d,  0x51,  0x37,  0xfe,
-  0x3d,  0xf0,  0xfe,  0x0c,  0x02,  0xfe,  0x20,  0xf0,  0xbc,  0xfe,  0x91,  0xf0,  0xfe,  0xf8,  0x01,  0xfe,
-  0x90,  0xf0,  0xfe,  0xf8,  0x01,  0xfe,  0x8f,  0xf0,  0xbc,  0x03,  0x67,  0x4d,  0x05,  0xfe,  0x08,  0x0f,
-  0x01,  0xfe,  0x78,  0x0f,  0xfe,  0xdd,  0x12,  0x05,  0xfe,  0x0e,  0x03,  0xfe,  0x28,  0x1c,  0x03,  0xfe,
-  0xa6,  0x00,  0xfe,  0xd1,  0x12,  0x3e,  0x22,  0xfe,  0xa6,  0x00,  0xac,  0xfe,  0x48,  0xf0,  0xfe,  0x90,
-  0x02,  0xfe,  0x49,  0xf0,  0xfe,  0xaa,  0x02,  0xfe,  0x4a,  0xf0,  0xfe,  0xc8,  0x02,  0xfe,  0x46,  0xf0,
-  0xfe,  0x5a,  0x02,  0xfe,  0x47,  0xf0,  0xfe,  0x60,  0x02,  0xfe,  0x43,  0xf0,  0xfe,  0x4e,  0x02,  0xfe,
-  0x44,  0xf0,  0xfe,  0x52,  0x02,  0xfe,  0x45,  0xf0,  0xfe,  0x56,  0x02,  0x1c,  0x0d,  0xa2,  0x1c,  0x07,
-  0x22,  0xb7,  0x05,  0x35,  0xfe,  0x00,  0x1c,  0xfe,  0xf1,  0x10,  0xfe,  0x02,  0x1c,  0xf5,  0xfe,  0x1e,
-  0x1c,  0xfe,  0xe9,  0x10,  0x01,  0x5f,  0xfe,  0xe7,  0x10,  0xfe,  0x06,  0xfc,  0xde,  0x0a,  0x81,  0x01,
-  0xa3,  0x05,  0x35,  0x1f,  0x95,  0x47,  0xb8,  0x01,  0xfe,  0xe4,  0x11,  0x0a,  0x81,  0x01,  0x5c,  0xfe,
-  0xbd,  0x10,  0x0a,  0x81,  0x01,  0x5c,  0xfe,  0xad,  0x10,  0xfe,  0x16,  0x1c,  0xfe,  0x58,  0x1c,  0x1c,
-  0x07,  0x22,  0xb7,  0x37,  0x2a,  0x35,  0xfe,  0x3d,  0xf0,  0xfe,  0x0c,  0x02,  0x2b,  0xfe,  0x9e,  0x02,
-  0xfe,  0x5a,  0x1c,  0xfe,  0x12,  0x1c,  0xfe,  0x14,  0x1c,  0x1f,  0xfe,  0x30,  0x00,  0x47,  0xb8,  0x01,
-  0xfe,  0xd4,  0x11,  0x1c,  0x07,  0x22,  0xb7,  0x05,  0xe9,  0x21,  0x2c,  0x09,  0x1a,  0x31,  0xfe,  0x69,
-  0x10,  0x1c,  0x07,  0x22,  0xb7,  0xfe,  0x04,  0xec,  0x2c,  0x60,  0x01,  0xfe,  0x1e,  0x1e,  0x20,  0x2c,
-  0xfe,  0x05,  0xf6,  0xde,  0x01,  0xfe,  0x62,  0x1b,  0x01,  0x0c,  0x61,  0x4a,  0x44,  0x15,  0x56,  0x51,
-  0x01,  0xfe,  0x9e,  0x1e,  0x01,  0xfe,  0x96,  0x1a,  0x05,  0x35,  0x0a,  0x57,  0x01,  0x18,  0x09,  0x00,
-  0x36,  0x01,  0x85,  0xfe,  0x18,  0x10,  0xfe,  0x41,  0x58,  0x0a,  0xba,  0x01,  0x18,  0xfe,  0xc8,  0x54,
-  0x7b,  0xfe,  0x1c,  0x03,  0x01,  0xfe,  0x96,  0x1a,  0x05,  0x35,  0x37,  0x60,  0xfe,  0x02,  0xe8,  0x30,
-  0xfe,  0xbf,  0x57,  0xfe,  0x9e,  0x43,  0xfe,  0x77,  0x57,  0xfe,  0x27,  0xf0,  0xfe,  0xe4,  0x01,  0xfe,
-  0x07,  0x4b,  0xfe,  0x20,  0xf0,  0xbc,  0xfe,  0x40,  0x1c,  0x2a,  0xeb,  0xfe,  0x26,  0xf0,  0xfe,  0x66,
-  0x03,  0xfe,  0xa0,  0xf0,  0xfe,  0x54,  0x03,  0xfe,  0x11,  0xf0,  0xbc,  0xfe,  0xef,  0x10,  0xfe,  0x9f,
-  0xf0,  0xfe,  0x74,  0x03,  0xfe,  0x46,  0x1c,  0x19,  0xfe,  0x11,  0x00,  0x05,  0x70,  0x37,  0xfe,  0x48,
-  0x1c,  0xfe,  0x46,  0x1c,  0x01,  0x0c,  0x06,  0x28,  0xfe,  0x18,  0x13,  0x26,  0x21,  0xb9,  0xc7,  0x20,
-  0xb9,  0x0a,  0x57,  0x01,  0x18,  0xc7,  0x89,  0x01,  0xfe,  0xc8,  0x1a,  0x15,  0xe1,  0x2a,  0xeb,  0xfe,
-  0x01,  0xf0,  0xeb,  0xfe,  0x82,  0xf0,  0xfe,  0xa4,  0x03,  0xfe,  0x9c,  0x32,  0x15,  0xfe,  0xe4,  0x00,
-  0x2f,  0xfe,  0xb6,  0x03,  0x2a,  0x3c,  0x16,  0xfe,  0xc6,  0x03,  0x01,  0x41,  0xfe,  0x06,  0xf0,  0xfe,
-  0xd6,  0x03,  0xaf,  0xa0,  0xfe,  0x0a,  0xf0,  0xfe,  0xa2,  0x07,  0x05,  0x29,  0x03,  0x81,  0x1e,  0x1b,
-  0xfe,  0x24,  0x05,  0x1f,  0x63,  0x01,  0x42,  0x8f,  0xfe,  0x70,  0x02,  0x05,  0xea,  0xfe,  0x46,  0x1c,
-  0x37,  0x7d,  0x1d,  0xfe,  0x67,  0x1b,  0xfe,  0xbf,  0x57,  0xfe,  0x77,  0x57,  0xfe,  0x48,  0x1c,  0x75,
-  0x01,  0xa6,  0x86,  0x0a,  0x57,  0x01,  0x18,  0x09,  0x00,  0x1b,  0xec,  0x0a,  0xe1,  0x01,  0x18,  0x77,
-  0x50,  0x40,  0x8d,  0x30,  0x03,  0x81,  0x1e,  0xf8,  0x1f,  0x63,  0x01,  0x42,  0x8f,  0xfe,  0x70,  0x02,
-  0x05,  0xea,  0xd7,  0x99,  0xd8,  0x9c,  0x2a,  0x29,  0x2f,  0xfe,  0x4e,  0x04,  0x16,  0xfe,  0x4a,  0x04,
-  0x7e,  0xfe,  0xa0,  0x00,  0xfe,  0x9b,  0x57,  0xfe,  0x54,  0x12,  0x32,  0xff,  0x02,  0x00,  0x10,  0x01,
-  0x08,  0x16,  0xfe,  0x02,  0x05,  0x32,  0x01,  0x08,  0x16,  0x29,  0x27,  0x25,  0xee,  0xfe,  0x4c,  0x44,
-  0xfe,  0x58,  0x12,  0x50,  0xfe,  0x44,  0x48,  0x13,  0x34,  0xfe,  0x4c,  0x54,  0x7b,  0xec,  0x60,  0x8d,
-  0x30,  0x01,  0xfe,  0x4e,  0x1e,  0xfe,  0x48,  0x47,  0xfe,  0x7c,  0x13,  0x01,  0x0c,  0x06,  0x28,  0xfe,
-  0x32,  0x13,  0x01,  0x43,  0x09,  0x9b,  0xfe,  0x68,  0x13,  0xfe,  0x26,  0x10,  0x13,  0x34,  0xfe,  0x4c,
-  0x54,  0x7b,  0xec,  0x01,  0xfe,  0x4e,  0x1e,  0xfe,  0x48,  0x47,  0xfe,  0x54,  0x13,  0x01,  0x0c,  0x06,
-  0x28,  0xa5,  0x01,  0x43,  0x09,  0x9b,  0xfe,  0x40,  0x13,  0x01,  0x0c,  0x06,  0x28,  0xf9,  0x1f,  0x7f,
-  0x01,  0x0c,  0x06,  0x07,  0x4d,  0x1f,  0xfe,  0x0d,  0x00,  0x01,  0x42,  0x8f,  0xfe,  0xa4,  0x0e,  0x05,
-  0x29,  0x32,  0x15,  0xfe,  0xe6,  0x00,  0x0f,  0xfe,  0x1c,  0x90,  0x04,  0xfe,  0x9c,  0x93,  0x3a,  0x0b,
-  0x0e,  0x8b,  0x02,  0x1f,  0x7f,  0x01,  0x42,  0x05,  0x35,  0xfe,  0x42,  0x5b,  0x7d,  0x1d,  0xfe,  0x46,
-  0x59,  0xfe,  0xbf,  0x57,  0xfe,  0x77,  0x57,  0x0f,  0xfe,  0x87,  0x80,  0x04,  0xfe,  0x87,  0x83,  0xfe,
-  0xc9,  0x47,  0x0b,  0x0e,  0xd0,  0x65,  0x01,  0x0c,  0x06,  0x0d,  0xfe,  0x98,  0x13,  0x0f,  0xfe,  0x20,
-  0x80,  0x04,  0xfe,  0xa0,  0x83,  0x33,  0x0b,  0x0e,  0x09,  0x1d,  0xfe,  0x84,  0x12,  0x01,  0x38,  0x06,
-  0x07,  0xfe,  0x70,  0x13,  0x03,  0xfe,  0xa2,  0x00,  0x1e,  0x1b,  0xfe,  0xda,  0x05,  0xd0,  0x54,  0x01,
-  0x38,  0x06,  0x0d,  0xfe,  0x58,  0x13,  0x03,  0xfe,  0xa0,  0x00,  0x1e,  0xfe,  0x50,  0x12,  0x5e,  0xff,
-  0x02,  0x00,  0x10,  0x2f,  0xfe,  0x90,  0x05,  0x2a,  0x3c,  0xcc,  0xff,  0x02,  0x00,  0x10,  0x2f,  0xfe,
-  0x9e,  0x05,  0x17,  0xfe,  0xf4,  0x05,  0x15,  0xfe,  0xe3,  0x00,  0x26,  0x01,  0x38,  0xfe,  0x4a,  0xf0,
-  0xfe,  0xc0,  0x05,  0xfe,  0x49,  0xf0,  0xfe,  0xba,  0x05,  0x71,  0x2e,  0xfe,  0x21,  0x00,  0xf1,  0x2e,
-  0xfe,  0x22,  0x00,  0xa2,  0x2e,  0x4a,  0xfe,  0x09,  0x48,  0xff,  0x02,  0x00,  0x10,  0x2f,  0xfe,  0xd0,
-  0x05,  0x17,  0xfe,  0xf4,  0x05,  0xfe,  0xe2,  0x08,  0x01,  0x38,  0x06,  0xfe,  0x1c,  0x00,  0x4d,  0x01,
-  0xa7,  0x2e,  0x07,  0x20,  0xe4,  0x47,  0xfe,  0x27,  0x01,  0x01,  0x0c,  0x06,  0x28,  0xfe,  0x24,  0x12,
-  0x3e,  0x01,  0x84,  0x1f,  0x7f,  0x01,  0x0c,  0x06,  0x07,  0x4d,  0x1f,  0xfe,  0x0d,  0x00,  0x01,  0x42,
-  0x8f,  0xfe,  0xa4,  0x0e,  0x05,  0x29,  0x03,  0xe6,  0x1e,  0xfe,  0xca,  0x13,  0x03,  0xb6,  0x1e,  0xfe,
-  0x40,  0x12,  0x03,  0x66,  0x1e,  0xfe,  0x38,  0x13,  0x3e,  0x01,  0x84,  0x17,  0xfe,  0x72,  0x06,  0x0a,
-  0x07,  0x01,  0x38,  0x06,  0x24,  0xfe,  0x02,  0x12,  0x4f,  0x01,  0xfe,  0x56,  0x19,  0x16,  0xfe,  0x68,
-  0x06,  0x15,  0x82,  0x01,  0x41,  0x15,  0xe2,  0x03,  0x66,  0x8a,  0x10,  0x66,  0x03,  0x9a,  0x1e,  0xfe,
-  0x70,  0x12,  0x03,  0x55,  0x1e,  0xfe,  0x68,  0x13,  0x01,  0xc6,  0x09,  0x12,  0x48,  0xfe,  0x92,  0x06,
-  0x2e,  0x12,  0x01,  0xfe,  0xac,  0x1d,  0xfe,  0x43,  0x48,  0x62,  0x80,  0x13,  0x58,  0xff,  0x02,  0x00,
-  0x57,  0x52,  0xad,  0x23,  0x3f,  0x4e,  0x62,  0x49,  0x3e,  0x01,  0x84,  0x17,  0xfe,  0xea,  0x06,  0x01,
-  0x38,  0x06,  0x12,  0xf7,  0x45,  0x0a,  0x95,  0x01,  0xfe,  0x84,  0x19,  0x16,  0xfe,  0xe0,  0x06,  0x15,
-  0x82,  0x01,  0x41,  0x15,  0xe2,  0x03,  0x55,  0x8a,  0x10,  0x55,  0x1c,  0x07,  0x01,  0x84,  0xfe,  0xae,
-  0x10,  0x03,  0x6f,  0x1e,  0xfe,  0x9e,  0x13,  0x3e,  0x01,  0x84,  0x03,  0x9a,  0x1e,  0xfe,  0x1a,  0x12,
-  0x01,  0x38,  0x06,  0x12,  0xfc,  0x01,  0xc6,  0x01,  0xfe,  0xac,  0x1d,  0xfe,  0x43,  0x48,  0x62,  0x80,
-  0xf0,  0x45,  0x0a,  0x95,  0x03,  0xb6,  0x1e,  0xf8,  0x01,  0x38,  0x06,  0x24,  0x36,  0xfe,  0x02,  0xf6,
-  0x07,  0x71,  0x78,  0x8c,  0x00,  0x4d,  0x62,  0x49,  0x3e,  0x2d,  0x93,  0x4e,  0xd0,  0x0d,  0x17,  0xfe,
-  0x9a,  0x07,  0x01,  0xfe,  0xc0,  0x19,  0x16,  0xfe,  0x90,  0x07,  0x26,  0x20,  0x9e,  0x15,  0x82,  0x01,
-  0x41,  0x15,  0xe2,  0x21,  0x9e,  0x09,  0x07,  0xfb,  0x03,  0xe6,  0xfe,  0x58,  0x57,  0x10,  0xe6,  0x05,
-  0xfe,  0x2a,  0x06,  0x03,  0x6f,  0x8a,  0x10,  0x6f,  0x1c,  0x07,  0x01,  0x84,  0xfe,  0x9c,  0x32,  0x5f,
-  0x75,  0x01,  0xa6,  0x86,  0x15,  0xfe,  0xe2,  0x00,  0x2f,  0xed,  0x2a,  0x3c,  0xfe,  0x0a,  0xf0,  0xfe,
-  0xce,  0x07,  0xae,  0xfe,  0x96,  0x08,  0xfe,  0x06,  0xf0,  0xfe,  0x9e,  0x08,  0xaf,  0xa0,  0x05,  0x29,
-  0x01,  0x0c,  0x06,  0x0d,  0xfe,  0x2e,  0x12,  0x14,  0x1d,  0x01,  0x08,  0x14,  0x00,  0x01,  0x08,  0x14,
-  0x00,  0x01,  0x08,  0x14,  0x00,  0x01,  0x08,  0xfe,  0x99,  0xa4,  0x01,  0x08,  0x14,  0x00,  0x05,  0xfe,
-  0xc6,  0x09,  0x01,  0x76,  0x06,  0x12,  0xfe,  0x3a,  0x12,  0x01,  0x0c,  0x06,  0x12,  0xfe,  0x30,  0x13,
-  0x14,  0xfe,  0x1b,  0x00,  0x01,  0x08,  0x14,  0x00,  0x01,  0x08,  0x14,  0x00,  0x01,  0x08,  0x14,  0x00,
-  0x01,  0x08,  0x14,  0x07,  0x01,  0x08,  0x14,  0x00,  0x05,  0xef,  0x7c,  0x4a,  0x78,  0x4f,  0x0f,  0xfe,
-  0x9a,  0x81,  0x04,  0xfe,  0x9a,  0x83,  0xfe,  0xcb,  0x47,  0x0b,  0x0e,  0x2d,  0x28,  0x48,  0xfe,  0x6c,
-  0x08,  0x0a,  0x28,  0xfe,  0x09,  0x6f,  0xca,  0xfe,  0xca,  0x45,  0xfe,  0x32,  0x12,  0x53,  0x63,  0x4e,
-  0x7c,  0x97,  0x2f,  0xfe,  0x7e,  0x08,  0x2a,  0x3c,  0xfe,  0x0a,  0xf0,  0xfe,  0x6c,  0x08,  0xaf,  0xa0,
-  0xae,  0xfe,  0x96,  0x08,  0x05,  0x29,  0x01,  0x41,  0x05,  0xed,  0x14,  0x24,  0x05,  0xed,  0xfe,  0x9c,
-  0xf7,  0x9f,  0x01,  0xfe,  0xae,  0x1e,  0xfe,  0x18,  0x58,  0x01,  0xfe,  0xbe,  0x1e,  0xfe,  0x99,  0x58,
-  0xfe,  0x78,  0x18,  0xfe,  0xf9,  0x18,  0x8e,  0xfe,  0x16,  0x09,  0x10,  0x6a,  0x22,  0x6b,  0x01,  0x0c,
-  0x61,  0x54,  0x44,  0x21,  0x2c,  0x09,  0x1a,  0xf8,  0x77,  0x01,  0xfe,  0x7e,  0x1e,  0x47,  0x2c,  0x7a,
-  0x30,  0xf0,  0xfe,  0x83,  0xe7,  0xfe,  0x3f,  0x00,  0x71,  0xfe,  0x03,  0x40,  0x01,  0x0c,  0x61,  0x65,
-  0x44,  0x01,  0xc2,  0xc8,  0xfe,  0x1f,  0x40,  0x20,  0x6e,  0x01,  0xfe,  0x6a,  0x16,  0xfe,  0x08,  0x50,
-  0xfe,  0x8a,  0x50,  0xfe,  0x44,  0x51,  0xfe,  0xc6,  0x51,  0xfe,  0x10,  0x10,  0x01,  0xfe,  0xce,  0x1e,
-  0x01,  0xfe,  0xde,  0x1e,  0x10,  0x68,  0x22,  0x69,  0x01,  0xfe,  0xee,  0x1e,  0x01,  0xfe,  0xfe,  0x1e,
-  0xfe,  0x40,  0x50,  0xfe,  0xc2,  0x50,  0x10,  0x4b,  0x22,  0x4c,  0xfe,  0x8a,  0x10,  0x01,  0x0c,  0x06,
-  0x54,  0xfe,  0x50,  0x12,  0x01,  0xfe,  0xae,  0x1e,  0x01,  0xfe,  0xbe,  0x1e,  0x10,  0x6a,  0x22,  0x6b,
-  0x01,  0x0c,  0x06,  0x65,  0x4e,  0x01,  0xc2,  0x0f,  0xfe,  0x1f,  0x80,  0x04,  0xfe,  0x9f,  0x83,  0x33,
-  0x0b,  0x0e,  0x20,  0x6e,  0x0f,  0xfe,  0x44,  0x90,  0x04,  0xfe,  0xc4,  0x93,  0x3a,  0x0b,  0xfe,  0xc6,
-  0x90,  0x04,  0xfe,  0xc6,  0x93,  0x79,  0x0b,  0x0e,  0x10,  0x6c,  0x22,  0x6d,  0x01,  0xfe,  0xce,  0x1e,
-  0x01,  0xfe,  0xde,  0x1e,  0x10,  0x68,  0x22,  0x69,  0x0f,  0xfe,  0x40,  0x90,  0x04,  0xfe,  0xc0,  0x93,
-  0x3a,  0x0b,  0xfe,  0xc2,  0x90,  0x04,  0xfe,  0xc2,  0x93,  0x79,  0x0b,  0x0e,  0x10,  0x4b,  0x22,  0x4c,
-  0x10,  0x64,  0x22,  0x34,  0x01,  0x0c,  0x61,  0x24,  0x44,  0x37,  0x13,  0xfe,  0x4e,  0x11,  0x2f,  0xfe,
-  0xde,  0x09,  0xfe,  0x9e,  0xf0,  0xfe,  0xf2,  0x09,  0xfe,  0x01,  0x48,  0x1b,  0x3c,  0x37,  0x88,  0xf5,
-  0xd4,  0xfe,  0x1e,  0x0a,  0xd5,  0xfe,  0x42,  0x0a,  0xd2,  0xfe,  0x1e,  0x0a,  0xd3,  0xfe,  0x42,  0x0a,
-  0xae,  0xfe,  0x12,  0x0a,  0xfe,  0x06,  0xf0,  0xfe,  0x18,  0x0a,  0xaf,  0xa0,  0x05,  0x29,  0x01,  0x41,
-  0xfe,  0xc1,  0x10,  0x14,  0x24,  0xfe,  0xc1,  0x10,  0x01,  0x76,  0x06,  0x07,  0xfe,  0x14,  0x12,  0x01,
-  0x76,  0x06,  0x0d,  0x5d,  0x01,  0x0c,  0x06,  0x0d,  0xfe,  0x74,  0x12,  0xfe,  0x2e,  0x1c,  0x05,  0xfe,
-  0x1a,  0x0c,  0x01,  0x76,  0x06,  0x07,  0x5d,  0x01,  0x76,  0x06,  0x0d,  0x41,  0xfe,  0x2c,  0x1c,  0xfe,
-  0xaa,  0xf0,  0xfe,  0xce,  0x0a,  0xfe,  0xac,  0xf0,  0xfe,  0x66,  0x0a,  0xfe,  0x92,  0x10,  0xc4,  0xf6,
-  0xfe,  0xad,  0xf0,  0xfe,  0x72,  0x0a,  0x05,  0xfe,  0x1a,  0x0c,  0xc5,  0xfe,  0xe7,  0x10,  0xfe,  0x2b,
-  0xf0,  0xbf,  0xfe,  0x6b,  0x18,  0x23,  0xfe,  0x00,  0xfe,  0xfe,  0x1c,  0x12,  0xac,  0xfe,  0xd2,  0xf0,
-  0xbf,  0xfe,  0x76,  0x18,  0x23,  0x1d,  0x1b,  0xbf,  0x03,  0xe3,  0x23,  0x07,  0x1b,  0xbf,  0xd4,  0x5b,
-  0xd5,  0x5b,  0xd2,  0x5b,  0xd3,  0x5b,  0xc4,  0xc5,  0xfe,  0xa9,  0x10,  0x75,  0x5e,  0x32,  0x1f,  0x7f,
-  0x01,  0x42,  0x19,  0xfe,  0x35,  0x00,  0xfe,  0x01,  0xf0,  0x70,  0x19,  0x98,  0x05,  0x70,  0xfe,  0x74,
-  0x18,  0x23,  0xfe,  0x00,  0xf8,  0x1b,  0x5b,  0x7d,  0x12,  0x01,  0xfe,  0x78,  0x0f,  0x4d,  0x01,  0xfe,
-  0x96,  0x1a,  0x21,  0x30,  0x77,  0x7d,  0x1d,  0x05,  0x5b,  0x01,  0x0c,  0x06,  0x0d,  0x2b,  0xfe,  0xe2,
-  0x0b,  0x01,  0x0c,  0x06,  0x54,  0xfe,  0xa6,  0x12,  0x01,  0x0c,  0x06,  0x24,  0xfe,  0x88,  0x13,  0x21,
-  0x6e,  0xc7,  0x01,  0xfe,  0x1e,  0x1f,  0x0f,  0xfe,  0x83,  0x80,  0x04,  0xfe,  0x83,  0x83,  0xfe,  0xc9,
-  0x47,  0x0b,  0x0e,  0xfe,  0xc8,  0x44,  0xfe,  0x42,  0x13,  0x0f,  0xfe,  0x04,  0x91,  0x04,  0xfe,  0x84,
-  0x93,  0xfe,  0xca,  0x57,  0x0b,  0xfe,  0x86,  0x91,  0x04,  0xfe,  0x86,  0x93,  0xfe,  0xcb,  0x57,  0x0b,
-  0x0e,  0x7a,  0x30,  0xfe,  0x40,  0x59,  0xfe,  0xc1,  0x59,  0x8e,  0x40,  0x03,  0x6a,  0x3b,  0x6b,  0x10,
-  0x97,  0x22,  0x98,  0xd9,  0x6a,  0xda,  0x6b,  0x01,  0xc2,  0xc8,  0x7a,  0x30,  0x20,  0x6e,  0xdb,  0x64,
-  0xdc,  0x34,  0x91,  0x6c,  0x7e,  0x6d,  0xfe,  0x44,  0x55,  0xfe,  0xe5,  0x55,  0xfe,  0x04,  0xfa,  0x64,
-  0xfe,  0x05,  0xfa,  0x34,  0x01,  0xfe,  0x6a,  0x16,  0xa3,  0x26,  0x10,  0x97,  0x10,  0x98,  0x91,  0x6c,
-  0x7e,  0x6d,  0xfe,  0x14,  0x10,  0x01,  0x0c,  0x06,  0x24,  0x1b,  0x40,  0x91,  0x4b,  0x7e,  0x4c,  0x01,
-  0x0c,  0x06,  0xfe,  0xf7,  0x00,  0x44,  0x03,  0x68,  0x3b,  0x69,  0xfe,  0x10,  0x58,  0xfe,  0x91,  0x58,
-  0xfe,  0x14,  0x59,  0xfe,  0x95,  0x59,  0x05,  0x5b,  0x01,  0x0c,  0x06,  0x24,  0x1b,  0x40,  0x01,  0x0c,
-  0x06,  0xfe,  0xf7,  0x00,  0x44,  0x78,  0x01,  0xfe,  0x8e,  0x1e,  0x4f,  0x0f,  0xfe,  0x10,  0x90,  0x04,
-  0xfe,  0x90,  0x93,  0x3a,  0x0b,  0xfe,  0x92,  0x90,  0x04,  0xfe,  0x92,  0x93,  0x79,  0x0b,  0x0e,  0xfe,
-  0xbd,  0x10,  0x01,  0x43,  0x09,  0xbb,  0x1b,  0xfe,  0x6e,  0x0a,  0x15,  0xbb,  0x01,  0x0c,  0x06,  0x0d,
-  0xfe,  0x14,  0x13,  0x03,  0x4b,  0x3b,  0x4c,  0x8e,  0xfe,  0x6e,  0x0a,  0xfe,  0x0c,  0x58,  0xfe,  0x8d,
-  0x58,  0x05,  0x5b,  0x26,  0x3e,  0x0f,  0xfe,  0x19,  0x80,  0x04,  0xfe,  0x99,  0x83,  0x33,  0x0b,  0x0e,
-  0xfe,  0xe5,  0x10,  0x01,  0x0c,  0x06,  0x0d,  0xfe,  0x1a,  0x12,  0xfe,  0x6c,  0x19,  0xfe,  0x19,  0x41,
-  0xfe,  0x6b,  0x18,  0xac,  0xfe,  0xd1,  0xf0,  0xef,  0x1f,  0x92,  0x01,  0x42,  0x19,  0xfe,  0x44,  0x00,
-  0xfe,  0x90,  0x10,  0xfe,  0x6c,  0x19,  0xd9,  0x4b,  0xfe,  0xed,  0x19,  0xda,  0x4c,  0xfe,  0x0c,  0x51,
-  0xfe,  0x8e,  0x51,  0xfe,  0x6b,  0x18,  0x23,  0xfe,  0x00,  0xff,  0x31,  0xfe,  0x76,  0x10,  0xac,  0xfe,
-  0xd2,  0xf0,  0xfe,  0xba,  0x0c,  0xfe,  0x76,  0x18,  0x23,  0x1d,  0x5d,  0x03,  0xe3,  0x23,  0x07,  0xfe,
-  0x08,  0x13,  0x19,  0xfe,  0x16,  0x00,  0x05,  0x70,  0xfe,  0xd1,  0xf0,  0xfe,  0xcc,  0x0c,  0x1f,  0x92,
-  0x01,  0x42,  0x19,  0xfe,  0x17,  0x00,  0x5c,  0xfe,  0xce,  0xf0,  0xfe,  0xd2,  0x0c,  0xfe,  0x3e,  0x10,
-  0xfe,  0xcd,  0xf0,  0xfe,  0xde,  0x0c,  0x19,  0xfe,  0x22,  0x00,  0x05,  0x70,  0xfe,  0xcb,  0xf0,  0xfe,
-  0xea,  0x0c,  0x19,  0xfe,  0x24,  0x00,  0x05,  0x70,  0xfe,  0xd0,  0xf0,  0xfe,  0xf4,  0x0c,  0x19,  0x94,
-  0xfe,  0x1c,  0x10,  0xfe,  0xcf,  0xf0,  0xfe,  0xfe,  0x0c,  0x19,  0x4a,  0xf3,  0xfe,  0xcc,  0xf0,  0xef,
-  0x01,  0x76,  0x06,  0x24,  0x4d,  0x19,  0xfe,  0x12,  0x00,  0x37,  0x13,  0xfe,  0x4e,  0x11,  0x2f,  0xfe,
-  0x16,  0x0d,  0xfe,  0x9e,  0xf0,  0xfe,  0x2a,  0x0d,  0xfe,  0x01,  0x48,  0x1b,  0x3c,  0x37,  0x88,  0xf5,
-  0xd4,  0x29,  0xd5,  0x29,  0xd2,  0x29,  0xd3,  0x29,  0x37,  0xfe,  0x9c,  0x32,  0x2f,  0xfe,  0x3e,  0x0d,
-  0x2a,  0x3c,  0xae,  0xfe,  0x62,  0x0d,  0xaf,  0xa0,  0xd4,  0x9f,  0xd5,  0x9f,  0xd2,  0x9f,  0xd3,  0x9f,
-  0x05,  0x29,  0x01,  0x41,  0xfe,  0xd3,  0x10,  0x15,  0xfe,  0xe8,  0x00,  0xc4,  0xc5,  0x75,  0xd7,  0x99,
-  0xd8,  0x9c,  0xfe,  0x89,  0xf0,  0x29,  0x27,  0x25,  0xbe,  0xd7,  0x99,  0xd8,  0x9c,  0x2f,  0xfe,  0x8c,
-  0x0d,  0x16,  0x29,  0x27,  0x25,  0xbd,  0xfe,  0x01,  0x48,  0xa4,  0x19,  0xfe,  0x42,  0x00,  0x05,  0x70,
-  0x90,  0x07,  0xfe,  0x81,  0x49,  0x1b,  0xfe,  0x64,  0x0e,  0x01,  0x0c,  0x06,  0x0d,  0xfe,  0x44,  0x13,
-  0x19,  0x00,  0x2d,  0x0d,  0xfe,  0x54,  0x12,  0x2d,  0xfe,  0x28,  0x00,  0x2b,  0xfe,  0xda,  0x0e,  0x0a,
-  0x57,  0x01,  0x18,  0x09,  0x00,  0x36,  0x46,  0xfe,  0x28,  0x00,  0xfe,  0xfa,  0x10,  0x01,  0xfe,  0xf4,
-  0x1c,  0x01,  0xfe,  0x00,  0x1d,  0x0a,  0xba,  0x01,  0xfe,  0x58,  0x10,  0x40,  0x15,  0x56,  0x01,  0x85,
-  0x05,  0x35,  0x19,  0xfe,  0x44,  0x00,  0x2d,  0x0d,  0xf7,  0x46,  0x0d,  0xfe,  0xcc,  0x10,  0x01,  0xa7,
-  0x46,  0x0d,  0xfe,  0xc2,  0x10,  0x01,  0xa7,  0x0f,  0xfe,  0x19,  0x82,  0x04,  0xfe,  0x99,  0x83,  0xfe,
-  0xcc,  0x47,  0x0b,  0x0e,  0xfe,  0x34,  0x46,  0xa5,  0x46,  0x0d,  0x19,  0xfe,  0x43,  0x00,  0xfe,  0xa2,
-  0x10,  0x01,  0x0c,  0x61,  0x0d,  0x44,  0x01,  0xfe,  0xf4,  0x1c,  0x01,  0xfe,  0x00,  0x1d,  0x40,  0x15,
-  0x56,  0x01,  0x85,  0x7d,  0x0d,  0x40,  0x51,  0x01,  0xfe,  0x9e,  0x1e,  0x05,  0xfe,  0x3a,  0x03,  0x01,
-  0x0c,  0x06,  0x0d,  0x5d,  0x46,  0x0d,  0x19,  0x00,  0xfe,  0x62,  0x10,  0x01,  0x76,  0x06,  0x12,  0xfe,
-  0x5c,  0x12,  0x01,  0x0c,  0x06,  0x12,  0xfe,  0x52,  0x13,  0xfe,  0x1c,  0x1c,  0xfe,  0x9d,  0xf0,  0xfe,
-  0x8e,  0x0e,  0xfe,  0x1c,  0x1c,  0xfe,  0x9d,  0xf0,  0xfe,  0x94,  0x0e,  0x01,  0x0c,  0x61,  0x12,  0x44,
-  0xfe,  0x9f,  0x10,  0x19,  0xfe,  0x15,  0x00,  0xfe,  0x04,  0xe6,  0x0d,  0x4f,  0xfe,  0x2e,  0x10,  0x19,
-  0xfe,  0x13,  0x00,  0xfe,  0x10,  0x10,  0x19,  0xfe,  0x47,  0x00,  0xf1,  0x19,  0xfe,  0x41,  0x00,  0xa2,
-  0x19,  0xfe,  0x24,  0x00,  0x86,  0xc4,  0xc5,  0x75,  0x03,  0x81,  0x1e,  0x2b,  0xea,  0x4f,  0xfe,  0x04,
-  0xe6,  0x12,  0xfe,  0x9d,  0x41,  0xfe,  0x1c,  0x42,  0x40,  0x01,  0xf4,  0x05,  0x35,  0xfe,  0x12,  0x1c,
-  0x1f,  0x0d,  0x47,  0xb5,  0xc3,  0x1f,  0xfe,  0x31,  0x00,  0x47,  0xb8,  0x01,  0xfe,  0xd4,  0x11,  0x05,
-  0xe9,  0x51,  0xfe,  0x06,  0xec,  0xe0,  0xfe,  0x0e,  0x47,  0x46,  0x28,  0xfe,  0xce,  0x45,  0x31,  0x51,
-  0xfe,  0x06,  0xea,  0xe0,  0xfe,  0x47,  0x4b,  0x45,  0xfe,  0x75,  0x57,  0x03,  0x67,  0xfe,  0x98,  0x56,
-  0xfe,  0x38,  0x12,  0x0a,  0x5a,  0x01,  0x18,  0xfe,  0x44,  0x48,  0x60,  0x01,  0x0c,  0x06,  0x28,  0xfe,
-  0x18,  0x13,  0x0a,  0x57,  0x01,  0x18,  0x3e,  0xfe,  0x41,  0x58,  0x0a,  0xba,  0xfe,  0xfa,  0x14,  0xfe,
-  0x49,  0x54,  0xb0,  0xfe,  0x5e,  0x0f,  0x05,  0xfe,  0x3a,  0x03,  0x0a,  0x67,  0xfe,  0xe0,  0x14,  0xfe,
-  0x0e,  0x47,  0x46,  0x28,  0xfe,  0xce,  0x45,  0x31,  0x51,  0xfe,  0xce,  0x47,  0xfe,  0xad,  0x13,  0x05,
-  0x35,  0x21,  0x2c,  0x09,  0x1a,  0xfe,  0x98,  0x12,  0x26,  0x20,  0x96,  0x20,  0xe7,  0xfe,  0x08,  0x1c,
-  0xfe,  0x7c,  0x19,  0xfe,  0xfd,  0x19,  0xfe,  0x0a,  0x1c,  0x03,  0xe5,  0xfe,  0x48,  0x55,  0xa5,  0x3b,
-  0xfe,  0x62,  0x01,  0xfe,  0xc9,  0x55,  0x31,  0xfe,  0x74,  0x10,  0x01,  0xfe,  0xf0,  0x1a,  0x03,  0xfe,
-  0x38,  0x01,  0x3b,  0xfe,  0x3a,  0x01,  0x8e,  0xfe,  0x1e,  0x10,  0xfe,  0x02,  0xec,  0xe7,  0x53,  0x00,
-  0x36,  0xfe,  0x04,  0xec,  0x2c,  0x60,  0xfe,  0x05,  0xf6,  0xfe,  0x34,  0x01,  0x01,  0xfe,  0x62,  0x1b,
-  0x01,  0xfe,  0xce,  0x1e,  0xb2,  0x11,  0xfe,  0x18,  0x13,  0xca,  0xfe,  0x02,  0xea,  0xe7,  0x53,  0x92,
-  0xfe,  0xc3,  0x13,  0x1f,  0x12,  0x47,  0xb5,  0xc3,  0xfe,  0x2a,  0x10,  0x03,  0xfe,  0x38,  0x01,  0x23,
-  0xfe,  0xf0,  0xff,  0x10,  0xe5,  0x03,  0xfe,  0x3a,  0x01,  0x10,  0xfe,  0x62,  0x01,  0x01,  0xfe,  0x1e,
-  0x1e,  0x20,  0x2c,  0x15,  0x56,  0x01,  0xfe,  0x9e,  0x1e,  0x13,  0x07,  0x02,  0x26,  0x02,  0x21,  0x96,
-  0xc7,  0x20,  0x96,  0x09,  0x92,  0xfe,  0x79,  0x13,  0x1f,  0x1d,  0x47,  0xb5,  0xc3,  0xfe,  0xe1,  0x10,
-  0xcf,  0xfe,  0x03,  0xdc,  0xfe,  0x73,  0x57,  0xfe,  0x80,  0x5d,  0x02,  0xcf,  0xfe,  0x03,  0xdc,  0xfe,
-  0x5b,  0x57,  0xfe,  0x80,  0x5d,  0x02,  0xfe,  0x03,  0x57,  0xcf,  0x26,  0xfe,  0x00,  0xcc,  0x02,  0xfe,
-  0x03,  0x57,  0xcf,  0x89,  0x02,  0x01,  0x0c,  0x06,  0x4a,  0xfe,  0x4e,  0x13,  0x0f,  0xfe,  0x1c,  0x80,
-  0x04,  0xfe,  0x9c,  0x83,  0x33,  0x0b,  0x0e,  0x09,  0x07,  0xfe,  0x3a,  0x13,  0x0f,  0xfe,  0x1e,  0x80,
-  0x04,  0xfe,  0x9e,  0x83,  0x33,  0x0b,  0x0e,  0xfe,  0x2a,  0x13,  0x0f,  0xfe,  0x1d,  0x80,  0x04,  0xfe,
-  0x9d,  0x83,  0xfe,  0xf9,  0x13,  0x0e,  0xfe,  0x1c,  0x13,  0x01,  0xfe,  0xee,  0x1e,  0xac,  0xfe,  0x14,
-  0x13,  0x01,  0xfe,  0xfe,  0x1e,  0xfe,  0x81,  0x58,  0xfa,  0x01,  0xfe,  0x0e,  0x1f,  0xfe,  0x30,  0xf4,
-  0x0d,  0xfe,  0x3c,  0x50,  0xa2,  0x01,  0xfe,  0x92,  0x1b,  0x01,  0x43,  0x09,  0x56,  0xfb,  0x01,  0xfe,
-  0xc8,  0x1a,  0x01,  0x0c,  0x06,  0x28,  0xa4,  0x01,  0xfe,  0xf4,  0x1c,  0x01,  0xfe,  0x00,  0x1d,  0x15,
-  0xfe,  0xe9,  0x00,  0x01,  0x0c,  0x06,  0x4a,  0xfe,  0x4e,  0x13,  0x01,  0xfe,  0x22,  0x1b,  0xfe,  0x1e,
-  0x1c,  0x0f,  0xfe,  0x14,  0x90,  0x04,  0xfe,  0x94,  0x93,  0x3a,  0x0b,  0xfe,  0x96,  0x90,  0x04,  0xfe,
-  0x96,  0x93,  0x79,  0x0b,  0x0e,  0x10,  0xfe,  0x64,  0x01,  0x22,  0xfe,  0x66,  0x01,  0x01,  0x0c,  0x06,
-  0x65,  0xf9,  0x0f,  0xfe,  0x03,  0x80,  0x04,  0xfe,  0x83,  0x83,  0x33,  0x0b,  0x0e,  0x77,  0xfe,  0x01,
-  0xec,  0x2c,  0xfe,  0x80,  0x40,  0x20,  0x2c,  0x7a,  0x30,  0x15,  0xdf,  0x40,  0x21,  0x2c,  0xfe,  0x00,
-  0x40,  0x8d,  0x2c,  0x02,  0xfe,  0x08,  0x1c,  0x03,  0xfe,  0xac,  0x00,  0xfe,  0x06,  0x58,  0x03,  0xfe,
-  0xae,  0x00,  0xfe,  0x07,  0x58,  0x03,  0xfe,  0xb0,  0x00,  0xfe,  0x08,  0x58,  0x03,  0xfe,  0xb2,  0x00,
-  0xfe,  0x09,  0x58,  0xfe,  0x0a,  0x1c,  0x2e,  0x49,  0x20,  0xe0,  0x26,  0x10,  0x66,  0x10,  0x55,  0x10,
-  0x6f,  0x13,  0x57,  0x52,  0x4f,  0x1c,  0x28,  0xfe,  0x90,  0x4d,  0xfe,  0x91,  0x54,  0x2b,  0xfe,  0x88,
-  0x11,  0x46,  0x1a,  0x13,  0x5a,  0x52,  0x1c,  0x4a,  0xfe,  0x90,  0x4d,  0xfe,  0x91,  0x54,  0x2b,  0xfe,
-  0x9e,  0x11,  0x2e,  0x1a,  0x20,  0x2c,  0x90,  0x34,  0x60,  0x21,  0x2c,  0xfe,  0x00,  0x40,  0x8d,  0x2c,
-  0x15,  0xdf,  0xfe,  0x14,  0x56,  0xfe,  0xd6,  0xf0,  0xfe,  0xb2,  0x11,  0xfe,  0x12,  0x1c,  0x75,  0xfe,
-  0x14,  0x1c,  0xfe,  0x10,  0x1c,  0xfe,  0x18,  0x1c,  0x02,  0x51,  0xfe,  0x0c,  0x14,  0xfe,  0x0e,  0x47,
-  0xfe,  0x07,  0xe6,  0x28,  0xfe,  0xce,  0x47,  0xfe,  0xf5,  0x13,  0x02,  0x01,  0xa7,  0x90,  0x34,  0x60,
-  0xfe,  0x06,  0x80,  0xfe,  0x48,  0x47,  0xfe,  0x42,  0x13,  0xfe,  0x02,  0x80,  0x09,  0x56,  0xfe,  0x34,
-  0x13,  0x0a,  0x5a,  0x01,  0x18,  0xcb,  0xfe,  0x36,  0x12,  0xfe,  0x41,  0x48,  0xfe,  0x45,  0x48,  0x01,
-  0xfe,  0xb2,  0x16,  0xfe,  0x00,  0xcc,  0xcb,  0xfe,  0xf3,  0x13,  0x3f,  0x89,  0x09,  0x1a,  0xa5,  0x0a,
-  0x9d,  0x01,  0x18,  0xfe,  0x80,  0x5c,  0x01,  0x85,  0xf2,  0x09,  0x9b,  0xa4,  0xfe,  0x14,  0x56,  0xfe,
-  0xd6,  0xf0,  0xfe,  0xec,  0x11,  0x02,  0xfe,  0x44,  0x58,  0x77,  0xfe,  0x01,  0xec,  0xb8,  0xfe,  0x9e,
-  0x40,  0xfe,  0x9d,  0xe7,  0x00,  0xfe,  0x9c,  0xe7,  0x12,  0x8d,  0x30,  0x01,  0xf4,  0xfe,  0xdd,  0x10,
-  0x37,  0xd7,  0x99,  0xd8,  0x9c,  0x27,  0x25,  0xee,  0x09,  0x12,  0xfe,  0x48,  0x12,  0x09,  0x0d,  0xfe,
-  0x56,  0x12,  0x09,  0x1d,  0xfe,  0x30,  0x12,  0x09,  0xdd,  0x1b,  0xfe,  0xc4,  0x13,  0x09,  0xfe,  0x23,
-  0x00,  0x1b,  0xfe,  0xd0,  0x13,  0x09,  0x07,  0x1b,  0xfe,  0x34,  0x14,  0x09,  0x24,  0xfe,  0x12,  0x12,
-  0x09,  0x00,  0x1b,  0x29,  0x1f,  0xdd,  0x01,  0x42,  0xa1,  0x32,  0x01,  0x08,  0xae,  0x41,  0x02,  0x32,
-  0xfe,  0x62,  0x08,  0x0a,  0xe1,  0x01,  0xfe,  0x58,  0x10,  0x15,  0x9b,  0x05,  0x35,  0x32,  0x01,  0x43,
-  0x09,  0xbb,  0xfe,  0xd7,  0x13,  0x91,  0x4b,  0x7e,  0x4c,  0x8e,  0xfe,  0x80,  0x13,  0x01,  0x0c,  0x06,
-  0x54,  0xfe,  0x72,  0x12,  0xdb,  0x64,  0xdc,  0x34,  0xfe,  0x44,  0x55,  0xfe,  0xe5,  0x55,  0xb0,  0xfe,
-  0x4a,  0x13,  0x21,  0x6e,  0xfe,  0x26,  0x13,  0x03,  0x97,  0x3b,  0x98,  0x8e,  0xfe,  0xb6,  0x0e,  0x10,
-  0x6a,  0x22,  0x6b,  0x26,  0x10,  0x97,  0x10,  0x98,  0x01,  0xc2,  0x2e,  0x49,  0x88,  0x20,  0x6e,  0x01,
-  0xfe,  0x6a,  0x16,  0xdb,  0x64,  0xdc,  0x34,  0xfe,  0x04,  0x55,  0xfe,  0xa5,  0x55,  0xfe,  0x04,  0xfa,
-  0x64,  0xfe,  0x05,  0xfa,  0x34,  0xfe,  0x8f,  0x10,  0x03,  0x6c,  0x3b,  0x6d,  0xfe,  0x40,  0x56,  0xfe,
-  0xe1,  0x56,  0x10,  0x6c,  0x22,  0x6d,  0x71,  0xdb,  0x64,  0xdc,  0x34,  0xfe,  0x44,  0x55,  0xfe,  0xe5,
-  0x55,  0x03,  0x68,  0x3b,  0x69,  0xfe,  0x00,  0x56,  0xfe,  0xa1,  0x56,  0x10,  0x68,  0x22,  0x69,  0x01,
-  0x0c,  0x06,  0x54,  0xf9,  0x21,  0x6e,  0xfe,  0x1f,  0x40,  0x03,  0x6a,  0x3b,  0x6b,  0xfe,  0x2c,  0x50,
-  0xfe,  0xae,  0x50,  0x03,  0x6c,  0x3b,  0x6d,  0xfe,  0x44,  0x50,  0xfe,  0xc6,  0x50,  0x03,  0x68,  0x3b,
-  0x69,  0xfe,  0x08,  0x50,  0xfe,  0x8a,  0x50,  0x03,  0x4b,  0x3b,  0x4c,  0xfe,  0x40,  0x50,  0xfe,  0xc2,
-  0x50,  0x05,  0x73,  0x2e,  0x07,  0x20,  0x9e,  0x05,  0x72,  0x32,  0x01,  0x08,  0x16,  0x3d,  0x27,  0x25,
-  0xee,  0x09,  0x07,  0x2b,  0x3d,  0x01,  0x43,  0x09,  0xbb,  0x2b,  0x72,  0x01,  0xa6,  0x23,  0x3f,  0x1b,
-  0x3d,  0x01,  0x0c,  0x06,  0x0d,  0xfe,  0x1e,  0x13,  0x91,  0x4b,  0x7e,  0x4c,  0xfe,  0x0a,  0x55,  0x31,
-  0xfe,  0x8b,  0x55,  0xd9,  0x4b,  0xda,  0x4c,  0xfe,  0x0c,  0x51,  0xfe,  0x8e,  0x51,  0x05,  0x72,  0x01,
-  0xfe,  0x8e,  0x1e,  0xca,  0xfe,  0x19,  0x41,  0x05,  0x72,  0x32,  0x01,  0x08,  0x2a,  0x3c,  0x16,  0xc0,
-  0x27,  0x25,  0xbe,  0x2d,  0x1d,  0xc0,  0x2d,  0x0d,  0x83,  0x2d,  0x7f,  0x1b,  0xfe,  0x66,  0x15,  0x05,
-  0x3d,  0x01,  0x08,  0x2a,  0x3c,  0x16,  0xc0,  0x27,  0x25,  0xbd,  0x09,  0x1d,  0x2b,  0x3d,  0x01,  0x08,
-  0x16,  0xc0,  0x27,  0x25,  0xfe,  0xe8,  0x09,  0xfe,  0xc2,  0x49,  0x50,  0x03,  0xb6,  0x1e,  0x83,  0x01,
-  0x38,  0x06,  0x24,  0x31,  0xa1,  0xfe,  0xbb,  0x45,  0x2d,  0x00,  0xa4,  0x46,  0x07,  0x90,  0x3f,  0x01,
-  0xfe,  0xf8,  0x15,  0x01,  0xa6,  0x86,  0xfe,  0x4b,  0x45,  0xfe,  0x20,  0x13,  0x01,  0x43,  0x09,  0x82,
-  0xfe,  0x16,  0x13,  0x03,  0x9a,  0x1e,  0x5d,  0x03,  0x55,  0x1e,  0x31,  0x5e,  0x05,  0x72,  0xfe,  0xc0,
-  0x5d,  0x01,  0xa7,  0xfe,  0x03,  0x17,  0x03,  0x66,  0x8a,  0x10,  0x66,  0x5e,  0x32,  0x01,  0x08,  0x17,
-  0x73,  0x01,  0xfe,  0x56,  0x19,  0x05,  0x73,  0x01,  0x08,  0x2a,  0x3c,  0x16,  0x3d,  0x27,  0x25,  0xbd,
-  0x09,  0x07,  0x2b,  0x3d,  0x01,  0xfe,  0xbe,  0x16,  0xfe,  0x42,  0x58,  0xfe,  0xe8,  0x14,  0x01,  0xa6,
-  0x86,  0xfe,  0x4a,  0xf4,  0x0d,  0x1b,  0x3d,  0xfe,  0x4a,  0xf4,  0x07,  0xfe,  0x0e,  0x12,  0x01,  0x43,
-  0x09,  0x82,  0x4e,  0x05,  0x72,  0x03,  0x55,  0x8a,  0x10,  0x55,  0x5e,  0x32,  0x01,  0x08,  0x17,  0x73,
-  0x01,  0xfe,  0x84,  0x19,  0x05,  0x73,  0x01,  0x08,  0x2a,  0x3c,  0x16,  0x3d,  0x27,  0x25,  0xbd,  0x09,
-  0x12,  0x2b,  0x3d,  0x01,  0xfe,  0xe8,  0x17,  0x8b,  0xfe,  0xaa,  0x14,  0xfe,  0xb6,  0x14,  0x86,  0xa8,
-  0xb2,  0x0d,  0x1b,  0x3d,  0xb2,  0x07,  0xfe,  0x0e,  0x12,  0x01,  0x43,  0x09,  0x82,  0x4e,  0x05,  0x72,
-  0x03,  0x6f,  0x8a,  0x10,  0x6f,  0x5e,  0x32,  0x01,  0x08,  0x17,  0x73,  0x01,  0xfe,  0xc0,  0x19,  0x05,
-  0x73,  0x13,  0x07,  0x2f,  0xfe,  0xcc,  0x15,  0x17,  0xfe,  0xe2,  0x15,  0x5f,  0xcc,  0x01,  0x08,  0x26,
-  0x5f,  0x02,  0x8f,  0xfe,  0xde,  0x15,  0x2a,  0xfe,  0xde,  0x15,  0x16,  0xfe,  0xcc,  0x15,  0x5e,  0x32,
-  0x01,  0x08,  0xfe,  0xd5,  0x10,  0x13,  0x58,  0xff,  0x02,  0x00,  0x57,  0x52,  0xad,  0x23,  0xfe,  0xff,
-  0x7f,  0xfe,  0x30,  0x56,  0xfe,  0x00,  0x5c,  0x02,  0x13,  0x58,  0xff,  0x02,  0x00,  0x57,  0x52,  0xad,
-  0x23,  0x3f,  0xfe,  0x30,  0x56,  0xfe,  0x00,  0x5c,  0x02,  0x13,  0x58,  0xff,  0x02,  0x00,  0x57,  0x52,
-  0xad,  0x02,  0x13,  0x58,  0xff,  0x02,  0x00,  0x57,  0x52,  0xfe,  0x00,  0x5e,  0x02,  0x13,  0x58,  0xff,
-  0x02,  0x00,  0x57,  0x52,  0xad,  0xfe,  0x0b,  0x58,  0x02,  0x0a,  0x66,  0x01,  0x5c,  0x0a,  0x55,  0x01,
-  0x5c,  0x0a,  0x6f,  0x01,  0x5c,  0x02,  0x01,  0xfe,  0x1e,  0x1f,  0x23,  0x1a,  0xff,  0x03,  0x00,  0x54,
-  0xfe,  0x00,  0xf4,  0x24,  0x52,  0x0f,  0xfe,  0x00,  0x7c,  0x04,  0xfe,  0x07,  0x7c,  0x3a,  0x0b,  0x0e,
-  0xfe,  0x00,  0x71,  0xfe,  0xf9,  0x18,  0xfe,  0x7a,  0x19,  0xfe,  0xfb,  0x19,  0xfe,  0x1a,  0xf7,  0x00,
-  0xfe,  0x1b,  0xf7,  0x00,  0x7a,  0x30,  0x10,  0x68,  0x22,  0x69,  0xd9,  0x6c,  0xda,  0x6d,  0x02,  0xfe,
-  0x62,  0x08,  0xfe,  0x82,  0x4a,  0xfe,  0xe1,  0x1a,  0xfe,  0x83,  0x5a,  0x77,  0x02,  0x01,  0xc6,  0xfe,
-  0x42,  0x48,  0x4f,  0x50,  0x45,  0x01,  0x08,  0x16,  0xfe,  0xe0,  0x17,  0x27,  0x25,  0xbe,  0x01,  0x08,
-  0x16,  0xfe,  0xe0,  0x17,  0x27,  0x25,  0xfe,  0xe8,  0x0a,  0xfe,  0xc1,  0x59,  0x03,  0x9a,  0x1e,  0xfe,
-  0xda,  0x12,  0x01,  0x38,  0x06,  0x12,  0xfe,  0xd0,  0x13,  0x26,  0x53,  0x12,  0x48,  0xfe,  0x08,  0x17,
-  0xd1,  0x12,  0x53,  0x12,  0xfe,  0x1e,  0x13,  0x2d,  0xb4,  0x7b,  0xfe,  0x26,  0x17,  0x4d,  0x13,  0x07,
-  0x1c,  0xb4,  0x90,  0x04,  0xfe,  0x78,  0x10,  0xff,  0x02,  0x83,  0x55,  0xf1,  0xff,  0x02,  0x83,  0x55,
-  0x53,  0x1d,  0xfe,  0x12,  0x13,  0xd6,  0xfe,  0x30,  0x00,  0xb0,  0xfe,  0x80,  0x17,  0x1c,  0x63,  0x13,
-  0x07,  0xfe,  0x56,  0x10,  0x53,  0x0d,  0xfe,  0x16,  0x13,  0xd6,  0xfe,  0x64,  0x00,  0xb0,  0xfe,  0x80,
-  0x17,  0x0a,  0xfe,  0x64,  0x00,  0x1c,  0x94,  0x13,  0x07,  0xfe,  0x28,  0x10,  0x53,  0x07,  0xfe,  0x60,
-  0x13,  0xd6,  0xfe,  0xc8,  0x00,  0xb0,  0xfe,  0x80,  0x17,  0x0a,  0xfe,  0xc8,  0x00,  0x1c,  0x95,  0x13,
-  0x07,  0x71,  0xd6,  0xfe,  0x90,  0x01,  0x48,  0xfe,  0x8c,  0x17,  0x45,  0xf3,  0xfe,  0x43,  0xf4,  0x96,
-  0xfe,  0x56,  0xf0,  0xfe,  0x9e,  0x17,  0xfe,  0x04,  0xf4,  0x58,  0xfe,  0x43,  0xf4,  0x94,  0xf6,  0x8b,
-  0x01,  0xfe,  0x24,  0x16,  0x23,  0x3f,  0xfc,  0xa8,  0x8c,  0x49,  0x48,  0xfe,  0xda,  0x17,  0x62,  0x49,
-  0xfe,  0x1c,  0x10,  0xa8,  0x8c,  0x80,  0x48,  0xfe,  0xda,  0x17,  0x62,  0x80,  0x71,  0x50,  0x26,  0xfe,
-  0x4d,  0xf4,  0x00,  0xf7,  0x45,  0x13,  0x07,  0xfe,  0xb4,  0x56,  0xfe,  0xc3,  0x58,  0x02,  0x50,  0x13,
-  0x0d,  0x02,  0x50,  0x3e,  0x78,  0x4f,  0x45,  0x01,  0x08,  0x16,  0xa9,  0x27,  0x25,  0xbe,  0xfe,  0x03,
-  0xea,  0xfe,  0x7e,  0x01,  0x01,  0x08,  0x16,  0xa9,  0x27,  0x25,  0xfe,  0xe9,  0x0a,  0x01,  0x08,  0x16,
-  0xa9,  0x27,  0x25,  0xfe,  0xe9,  0x0a,  0xfe,  0x05,  0xea,  0xfe,  0x7f,  0x01,  0x01,  0x08,  0x16,  0xa9,
-  0x27,  0x25,  0xfe,  0x69,  0x09,  0xfe,  0x02,  0xea,  0xfe,  0x80,  0x01,  0x01,  0x08,  0x16,  0xa9,  0x27,
-  0x25,  0xfe,  0xe8,  0x08,  0x47,  0xfe,  0x81,  0x01,  0x03,  0xb6,  0x1e,  0x83,  0x01,  0x38,  0x06,  0x24,
-  0x31,  0xa2,  0x78,  0xf2,  0x53,  0x07,  0x36,  0xfe,  0x34,  0xf4,  0x3f,  0xa1,  0x78,  0x03,  0x9a,  0x1e,
-  0x83,  0x01,  0x38,  0x06,  0x12,  0x31,  0xf0,  0x4f,  0x45,  0xfe,  0x90,  0x10,  0xfe,  0x40,  0x5a,  0x23,
-  0x3f,  0xfb,  0x8c,  0x49,  0x48,  0xfe,  0xaa,  0x18,  0x62,  0x49,  0x71,  0x8c,  0x80,  0x48,  0xfe,  0xaa,
-  0x18,  0x62,  0x80,  0xfe,  0xb4,  0x56,  0xfe,  0x40,  0x5d,  0x01,  0xc6,  0x01,  0xfe,  0xac,  0x1d,  0xfe,
-  0x02,  0x17,  0xfe,  0xc8,  0x45,  0xfe,  0x5a,  0xf0,  0xfe,  0xc0,  0x18,  0xfe,  0x43,  0x48,  0x2d,  0x93,
-  0x36,  0xfe,  0x34,  0xf4,  0xfe,  0x00,  0x11,  0xfe,  0x40,  0x10,  0x2d,  0xb4,  0x36,  0xfe,  0x34,  0xf4,
-  0x04,  0xfe,  0x34,  0x10,  0x2d,  0xfe,  0x0b,  0x00,  0x36,  0x46,  0x63,  0xfe,  0x28,  0x10,  0xfe,  0xc0,
-  0x49,  0xff,  0x02,  0x00,  0x54,  0xb2,  0xfe,  0x90,  0x01,  0x48,  0xfe,  0xfa,  0x18,  0x45,  0xfe,  0x1c,
-  0xf4,  0x3f,  0xf3,  0xfe,  0x40,  0xf4,  0x96,  0xfe,  0x56,  0xf0,  0xfe,  0x0c,  0x19,  0xfe,  0x04,  0xf4,
-  0x58,  0xfe,  0x40,  0xf4,  0x94,  0xf6,  0x3e,  0x2d,  0x93,  0x4e,  0xd0,  0x0d,  0x21,  0xfe,  0x7f,  0x01,
-  0xfe,  0xc8,  0x46,  0xfe,  0x24,  0x13,  0x8c,  0x00,  0x5d,  0x26,  0x21,  0xfe,  0x7e,  0x01,  0xfe,  0xc8,
-  0x45,  0xfe,  0x14,  0x13,  0x21,  0xfe,  0x80,  0x01,  0xfe,  0x48,  0x45,  0xfa,  0x21,  0xfe,  0x81,  0x01,
-  0xfe,  0xc8,  0x44,  0x4e,  0x26,  0x02,  0x13,  0x07,  0x02,  0x78,  0x45,  0x50,  0x13,  0x0d,  0x02,  0x14,
-  0x07,  0x01,  0x08,  0x17,  0xfe,  0x82,  0x19,  0x14,  0x0d,  0x01,  0x08,  0x17,  0xfe,  0x82,  0x19,  0x14,
-  0x1d,  0x01,  0x08,  0x17,  0xfe,  0x82,  0x19,  0x5f,  0xfe,  0x89,  0x49,  0x01,  0x08,  0x02,  0x14,  0x07,
-  0x01,  0x08,  0x17,  0xc1,  0x14,  0x1d,  0x01,  0x08,  0x17,  0xc1,  0x14,  0x07,  0x01,  0x08,  0x17,  0xc1,
-  0xfe,  0x89,  0x49,  0x01,  0x08,  0x17,  0xc1,  0x5f,  0xfe,  0x89,  0x4a,  0x01,  0x08,  0x02,  0x50,  0x02,
-  0x14,  0x07,  0x01,  0x08,  0x17,  0x74,  0x14,  0x7f,  0x01,  0x08,  0x17,  0x74,  0x14,  0x12,  0x01,  0x08,
-  0x17,  0x74,  0xfe,  0x89,  0x49,  0x01,  0x08,  0x17,  0x74,  0x14,  0x00,  0x01,  0x08,  0x17,  0x74,  0xfe,
-  0x89,  0x4a,  0x01,  0x08,  0x17,  0x74,  0xfe,  0x09,  0x49,  0x01,  0x08,  0x17,  0x74,  0x5f,  0xcc,  0x01,
-  0x08,  0x02,  0x21,  0xe4,  0x09,  0x07,  0xfe,  0x4c,  0x13,  0xc8,  0x20,  0xe4,  0xfe,  0x49,  0xf4,  0x00,
-  0x4d,  0x5f,  0xa1,  0x5e,  0xfe,  0x01,  0xec,  0xfe,  0x27,  0x01,  0xcc,  0xff,  0x02,  0x00,  0x10,  0x2f,
-  0xfe,  0x3e,  0x1a,  0x01,  0x43,  0x09,  0xfe,  0xe3,  0x00,  0xfe,  0x22,  0x13,  0x16,  0xfe,  0x64,  0x1a,
-  0x26,  0x20,  0x9e,  0x01,  0x41,  0x21,  0x9e,  0x09,  0x07,  0x5d,  0x01,  0x0c,  0x61,  0x07,  0x44,  0x02,
-  0x0a,  0x5a,  0x01,  0x18,  0xfe,  0x00,  0x40,  0xaa,  0x09,  0x1a,  0xfe,  0x12,  0x13,  0x0a,  0x9d,  0x01,
-  0x18,  0xaa,  0x0a,  0x67,  0x01,  0xa3,  0x02,  0x0a,  0x9d,  0x01,  0x18,  0xaa,  0xfe,  0x80,  0xe7,  0x1a,
-  0x09,  0x1a,  0x5d,  0xfe,  0x45,  0x58,  0x01,  0xfe,  0xb2,  0x16,  0xaa,  0x02,  0x0a,  0x5a,  0x01,  0x18,
-  0xaa,  0x0a,  0x67,  0x01,  0xa3,  0x02,  0x0a,  0x5a,  0x01,  0x18,  0x01,  0xfe,  0x7e,  0x1e,  0xfe,  0x80,
-  0x4c,  0xfe,  0x49,  0xe4,  0x1a,  0xfe,  0x12,  0x13,  0x0a,  0x9d,  0x01,  0x18,  0xfe,  0x80,  0x4c,  0x0a,
-  0x67,  0x01,  0x5c,  0x02,  0x1c,  0x1a,  0x87,  0x7c,  0xe5,  0xfe,  0x18,  0xdf,  0xfe,  0x19,  0xde,  0xfe,
-  0x24,  0x1c,  0xfe,  0x1d,  0xf7,  0x28,  0xb1,  0xfe,  0x04,  0x1b,  0x01,  0xfe,  0x2a,  0x1c,  0xfa,  0xb3,
-  0x28,  0x7c,  0xfe,  0x2c,  0x01,  0xfe,  0x2f,  0x19,  0x02,  0xc9,  0x2b,  0xfe,  0xf4,  0x1a,  0xfe,  0xfa,
-  0x10,  0x1c,  0x1a,  0x87,  0x03,  0xfe,  0x64,  0x01,  0xfe,  0x00,  0xf4,  0x24,  0xfe,  0x18,  0x58,  0x03,
-  0xfe,  0x66,  0x01,  0xfe,  0x19,  0x58,  0xb3,  0x24,  0x01,  0xfe,  0x0e,  0x1f,  0xfe,  0x30,  0xf4,  0x07,
-  0xfe,  0x3c,  0x50,  0x7c,  0xfe,  0x38,  0x00,  0xfe,  0x0f,  0x79,  0xfe,  0x1c,  0xf7,  0x24,  0xb1,  0xfe,
-  0x50,  0x1b,  0xfe,  0xd4,  0x14,  0x31,  0x02,  0xc9,  0x2b,  0xfe,  0x26,  0x1b,  0xfe,  0xba,  0x10,  0x1c,
-  0x1a,  0x87,  0xfe,  0x83,  0x5a,  0xfe,  0x18,  0xdf,  0xfe,  0x19,  0xde,  0xfe,  0x1d,  0xf7,  0x54,  0xb1,
-  0xfe,  0x72,  0x1b,  0xfe,  0xb2,  0x14,  0xfc,  0xb3,  0x54,  0x7c,  0x12,  0xfe,  0xaf,  0x19,  0xfe,  0x98,
-  0xe7,  0x00,  0x02,  0xc9,  0x2b,  0xfe,  0x66,  0x1b,  0xfe,  0x8a,  0x10,  0x1c,  0x1a,  0x87,  0x8b,  0x0f,
-  0xfe,  0x30,  0x90,  0x04,  0xfe,  0xb0,  0x93,  0x3a,  0x0b,  0xfe,  0x18,  0x58,  0xfe,  0x32,  0x90,  0x04,
-  0xfe,  0xb2,  0x93,  0x3a,  0x0b,  0xfe,  0x19,  0x58,  0x0e,  0xa8,  0xb3,  0x4a,  0x7c,  0x12,  0xfe,  0x0f,
-  0x79,  0xfe,  0x1c,  0xf7,  0x4a,  0xb1,  0xfe,  0xc6,  0x1b,  0xfe,  0x5e,  0x14,  0x31,  0x02,  0xc9,  0x2b,
-  0xfe,  0x96,  0x1b,  0x5c,  0xfe,  0x02,  0xf6,  0x1a,  0x87,  0xfe,  0x18,  0xfe,  0x6a,  0xfe,  0x19,  0xfe,
-  0x6b,  0x01,  0xfe,  0x1e,  0x1f,  0xfe,  0x1d,  0xf7,  0x65,  0xb1,  0xfe,  0xee,  0x1b,  0xfe,  0x36,  0x14,
-  0xfe,  0x1c,  0x13,  0xb3,  0x65,  0x3e,  0xfe,  0x83,  0x58,  0xfe,  0xaf,  0x19,  0xfe,  0x80,  0xe7,  0x1a,
-  0xfe,  0x81,  0xe7,  0x1a,  0x15,  0xfe,  0xdd,  0x00,  0x7a,  0x30,  0x02,  0x7a,  0x30,  0xfe,  0x12,  0x45,
-  0x2b,  0xfe,  0xdc,  0x1b,  0x1f,  0x07,  0x47,  0xb5,  0xc3,  0x05,  0x35,  0xfe,  0x39,  0xf0,  0x75,  0x26,
-  0x02,  0xfe,  0x7e,  0x18,  0x23,  0x1d,  0x36,  0x13,  0x11,  0x02,  0x87,  0x03,  0xe3,  0x23,  0x07,  0xfe,
-  0xef,  0x12,  0xfe,  0xe1,  0x10,  0x90,  0x34,  0x60,  0xfe,  0x02,  0x80,  0x09,  0x56,  0xfe,  0x3c,  0x13,
-  0xfe,  0x82,  0x14,  0xfe,  0x42,  0x13,  0x51,  0xfe,  0x06,  0x83,  0x0a,  0x5a,  0x01,  0x18,  0xcb,  0xfe,
-  0x3e,  0x12,  0xfe,  0x41,  0x48,  0xfe,  0x45,  0x48,  0x01,  0xfe,  0xb2,  0x16,  0xfe,  0x00,  0xcc,  0xcb,
-  0xfe,  0xf3,  0x13,  0x3f,  0x89,  0x09,  0x1a,  0xa5,  0x0a,  0x9d,  0x01,  0x18,  0xfe,  0x80,  0x4c,  0x01,
-  0x85,  0xfe,  0x16,  0x10,  0x09,  0x9b,  0x4e,  0xfe,  0x40,  0x14,  0xfe,  0x24,  0x12,  0xfe,  0x14,  0x56,
-  0xfe,  0xd6,  0xf0,  0xfe,  0x52,  0x1c,  0x1c,  0x0d,  0x02,  0xfe,  0x9c,  0xe7,  0x0d,  0x19,  0xfe,  0x15,
-  0x00,  0x40,  0x8d,  0x30,  0x01,  0xf4,  0x1c,  0x07,  0x02,  0x51,  0xfe,  0x06,  0x83,  0xfe,  0x18,  0x80,
-  0x61,  0x28,  0x44,  0x15,  0x56,  0x01,  0x85,  0x1c,  0x07,  0x02,  0xfe,  0x38,  0x90,  0xfe,  0xba,  0x90,
-  0x91,  0xde,  0x7e,  0xdf,  0xfe,  0x48,  0x55,  0x31,  0xfe,  0xc9,  0x55,  0x02,  0x21,  0xb9,  0x88,  0x20,
-  0xb9,  0x02,  0x0a,  0xba,  0x01,  0x18,  0xfe,  0x41,  0x48,  0x0a,  0x57,  0x01,  0x18,  0xfe,  0x49,  0x44,
-  0x1b,  0xfe,  0x1e,  0x1d,  0x88,  0x89,  0x02,  0x0a,  0x5a,  0x01,  0x18,  0x09,  0x1a,  0xa4,  0x0a,  0x67,
-  0x01,  0xa3,  0x0a,  0x57,  0x01,  0x18,  0x88,  0x89,  0x02,  0xfe,  0x4e,  0xe4,  0x1d,  0x7b,  0xfe,  0x52,
-  0x1d,  0x03,  0xfe,  0x90,  0x00,  0xfe,  0x3a,  0x45,  0xfe,  0x2c,  0x10,  0xfe,  0x4e,  0xe4,  0xdd,  0x7b,
-  0xfe,  0x64,  0x1d,  0x03,  0xfe,  0x92,  0x00,  0xd1,  0x12,  0xfe,  0x1a,  0x10,  0xfe,  0x4e,  0xe4,  0xfe,
-  0x0b,  0x00,  0x7b,  0xfe,  0x76,  0x1d,  0x03,  0xfe,  0x94,  0x00,  0xd1,  0x24,  0xfe,  0x08,  0x10,  0x03,
-  0xfe,  0x96,  0x00,  0xd1,  0x63,  0xfe,  0x4e,  0x45,  0x83,  0xca,  0xff,  0x04,  0x68,  0x54,  0xfe,  0xf1,
-  0x10,  0x23,  0x49,  0xfe,  0x08,  0x1c,  0xfe,  0x67,  0x19,  0xfe,  0x0a,  0x1c,  0xfe,  0x1a,  0xf4,  0xfe,
-  0x00,  0x04,  0x83,  0xb2,  0x1d,  0x48,  0xfe,  0xaa,  0x1d,  0x13,  0x1d,  0x02,  0x09,  0x92,  0xfe,  0x5a,
-  0xf0,  0xfe,  0xba,  0x1d,  0x2e,  0x93,  0xfe,  0x34,  0x10,  0x09,  0x12,  0xfe,  0x5a,  0xf0,  0xfe,  0xc8,
-  0x1d,  0x2e,  0xb4,  0xfe,  0x26,  0x10,  0x09,  0x1d,  0x36,  0x2e,  0x63,  0xfe,  0x1a,  0x10,  0x09,  0x0d,
-  0x36,  0x2e,  0x94,  0xf2,  0x09,  0x07,  0x36,  0x2e,  0x95,  0xa1,  0xc8,  0x02,  0x1f,  0x93,  0x01,  0x42,
-  0xfe,  0x04,  0xfe,  0x99,  0x03,  0x9c,  0x8b,  0x02,  0x2a,  0xfe,  0x1c,  0x1e,  0xfe,  0x14,  0xf0,  0x08,
-  0x2f,  0xfe,  0x0c,  0x1e,  0x2a,  0xfe,  0x1c,  0x1e,  0x8f,  0xfe,  0x1c,  0x1e,  0xfe,  0x82,  0xf0,  0xfe,
-  0x10,  0x1e,  0x02,  0x0f,  0x3f,  0x04,  0xfe,  0x80,  0x83,  0x33,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x18,
-  0x80,  0x04,  0xfe,  0x98,  0x83,  0x33,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x02,  0x80,  0x04,  0xfe,  0x82,
-  0x83,  0x33,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x06,  0x80,  0x04,  0xfe,  0x86,  0x83,  0x33,  0x0b,  0x0e,
-  0x02,  0x0f,  0xfe,  0x1b,  0x80,  0x04,  0xfe,  0x9b,  0x83,  0x33,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x04,
-  0x80,  0x04,  0xfe,  0x84,  0x83,  0x33,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x80,  0x80,  0x04,  0xfe,  0x80,
-  0x83,  0xfe,  0xc9,  0x47,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x19,  0x81,  0x04,  0xfe,  0x99,  0x83,  0xfe,
-  0xca,  0x47,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x06,  0x83,  0x04,  0xfe,  0x86,  0x83,  0xfe,  0xce,  0x47,
-  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x2c,  0x90,  0x04,  0xfe,  0xac,  0x93,  0x3a,  0x0b,  0x0e,  0x02,  0x0f,
-  0xfe,  0xae,  0x90,  0x04,  0xfe,  0xae,  0x93,  0x79,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x08,  0x90,  0x04,
-  0xfe,  0x88,  0x93,  0x3a,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x8a,  0x90,  0x04,  0xfe,  0x8a,  0x93,  0x79,
-  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x0c,  0x90,  0x04,  0xfe,  0x8c,  0x93,  0x3a,  0x0b,  0x0e,  0x02,  0x0f,
-  0xfe,  0x8e,  0x90,  0x04,  0xfe,  0x8e,  0x93,  0x79,  0x0b,  0x0e,  0x02,  0x0f,  0xfe,  0x3c,  0x90,  0x04,
-  0xfe,  0xbc,  0x93,  0x3a,  0x0b,  0x0e,  0x02,  0x8b,  0x0f,  0xfe,  0x03,  0x80,  0x04,  0xfe,  0x83,  0x83,
-  0x33,  0x0b,  0x77,  0x0e,  0xa8,  0x02,  0xff,  0x66,  0x00,  0x00,
+static unsigned char _adv_asc38C1600_buf[] = {
+       0x00, 0x00, 0x00, 0xf2, 0x00, 0x16, 0x00, 0xfc, 0x00, 0x10, 0x00, 0xf0,
+       0x18, 0xe4, 0x01, 0x00,
+       0x04, 0x1e, 0x48, 0xe4, 0x03, 0xf6, 0xf7, 0x13, 0x2e, 0x1e, 0x02, 0x00,
+       0x07, 0x17, 0xc0, 0x5f,
+       0x00, 0xfa, 0xff, 0xff, 0x04, 0x00, 0x00, 0xf6, 0x09, 0xe7, 0x82, 0xe7,
+       0x85, 0xf0, 0x86, 0xf0,
+       0x4e, 0x10, 0x9e, 0xe7, 0xff, 0x00, 0x55, 0xf0, 0x01, 0xf6, 0x03, 0x00,
+       0x98, 0x57, 0x01, 0xe6,
+       0x00, 0xea, 0x00, 0xec, 0x01, 0xfa, 0x18, 0xf4, 0x08, 0x00, 0xf0, 0x1d,
+       0x38, 0x54, 0x32, 0xf0,
+       0x10, 0x00, 0xc2, 0x0e, 0x1e, 0xf0, 0xd5, 0xf0, 0xbc, 0x00, 0x4b, 0xe4,
+       0x00, 0xe6, 0xb1, 0xf0,
+       0xb4, 0x00, 0x02, 0x13, 0x3e, 0x1c, 0xc8, 0x47, 0x3e, 0x00, 0xd8, 0x01,
+       0x06, 0x13, 0x0c, 0x1c,
+       0x5e, 0x1e, 0x00, 0x57, 0xc8, 0x57, 0x01, 0xfc, 0xbc, 0x0e, 0xa2, 0x12,
+       0xb9, 0x54, 0x00, 0x80,
+       0x62, 0x0a, 0x5a, 0x12, 0xc8, 0x15, 0x3e, 0x1e, 0x18, 0x40, 0xbd, 0x56,
+       0x03, 0xe6, 0x01, 0xea,
+       0x5c, 0xf0, 0x0f, 0x00, 0x20, 0x00, 0x6c, 0x01, 0x6e, 0x01, 0x04, 0x12,
+       0x04, 0x13, 0xbb, 0x55,
+       0x3c, 0x56, 0x3e, 0x57, 0x03, 0x58, 0x4a, 0xe4, 0x40, 0x00, 0xb6, 0x00,
+       0xbb, 0x00, 0xc0, 0x00,
+       0x00, 0x01, 0x01, 0x01, 0x3e, 0x01, 0x58, 0x0a, 0x44, 0x10, 0x0a, 0x12,
+       0x4c, 0x1c, 0x4e, 0x1c,
+       0x02, 0x4a, 0x30, 0xe4, 0x05, 0xe6, 0x0c, 0x00, 0x3c, 0x00, 0x80, 0x00,
+       0x24, 0x01, 0x3c, 0x01,
+       0x68, 0x01, 0x6a, 0x01, 0x70, 0x01, 0x72, 0x01, 0x74, 0x01, 0x76, 0x01,
+       0x78, 0x01, 0x7c, 0x01,
+       0xc6, 0x0e, 0x0c, 0x10, 0xac, 0x12, 0xae, 0x12, 0x16, 0x1a, 0x32, 0x1c,
+       0x6e, 0x1e, 0x02, 0x48,
+       0x3a, 0x55, 0xc9, 0x57, 0x02, 0xee, 0x5b, 0xf0, 0x03, 0xf7, 0x06, 0xf7,
+       0x03, 0xfc, 0x06, 0x00,
+       0x1e, 0x00, 0xbe, 0x00, 0xe1, 0x00, 0x0c, 0x12, 0x18, 0x1a, 0x70, 0x1a,
+       0x30, 0x1c, 0x38, 0x1c,
+       0x10, 0x44, 0x00, 0x4c, 0xb0, 0x57, 0x40, 0x5c, 0x4d, 0xe4, 0x04, 0xea,
+       0x5d, 0xf0, 0xa7, 0xf0,
+       0x04, 0xf6, 0x02, 0xfc, 0x05, 0x00, 0x09, 0x00, 0x19, 0x00, 0x32, 0x00,
+       0x33, 0x00, 0x34, 0x00,
+       0x36, 0x00, 0x98, 0x00, 0x9e, 0x00, 0xcc, 0x00, 0x20, 0x01, 0x4e, 0x01,
+       0x79, 0x01, 0x3c, 0x09,
+       0x68, 0x0d, 0x02, 0x10, 0x04, 0x10, 0x3a, 0x10, 0x08, 0x12, 0x0a, 0x13,
+       0x40, 0x16, 0x50, 0x16,
+       0x00, 0x17, 0x4a, 0x19, 0x00, 0x4e, 0x00, 0x54, 0x01, 0x58, 0x00, 0xdc,
+       0x05, 0xf0, 0x09, 0xf0,
+       0x59, 0xf0, 0xb8, 0xf0, 0x48, 0xf4, 0x0e, 0xf7, 0x0a, 0x00, 0x9b, 0x00,
+       0x9c, 0x00, 0xa4, 0x00,
+       0xb5, 0x00, 0xba, 0x00, 0xd0, 0x00, 0xe7, 0x00, 0xf0, 0x03, 0x69, 0x08,
+       0xe9, 0x09, 0x5c, 0x0c,
+       0xb6, 0x12, 0xbc, 0x19, 0xd8, 0x1b, 0x20, 0x1c, 0x34, 0x1c, 0x36, 0x1c,
+       0x42, 0x1d, 0x08, 0x44,
+       0x38, 0x44, 0x91, 0x44, 0x0a, 0x45, 0x48, 0x46, 0x89, 0x48, 0x68, 0x54,
+       0x83, 0x55, 0x83, 0x59,
+       0x31, 0xe4, 0x02, 0xe6, 0x07, 0xf0, 0x08, 0xf0, 0x0b, 0xf0, 0x0c, 0xf0,
+       0x4b, 0xf4, 0x04, 0xf8,
+       0x05, 0xf8, 0x02, 0xfa, 0x03, 0xfa, 0x04, 0xfc, 0x05, 0xfc, 0x07, 0x00,
+       0xa8, 0x00, 0xaa, 0x00,
+       0xb9, 0x00, 0xe0, 0x00, 0xe5, 0x00, 0x22, 0x01, 0x26, 0x01, 0x60, 0x01,
+       0x7a, 0x01, 0x82, 0x01,
+       0xc8, 0x01, 0xca, 0x01, 0x86, 0x02, 0x6a, 0x03, 0x18, 0x05, 0xb2, 0x07,
+       0x68, 0x08, 0x10, 0x0d,
+       0x06, 0x10, 0x0a, 0x10, 0x0e, 0x10, 0x12, 0x10, 0x60, 0x10, 0xed, 0x10,
+       0xf3, 0x10, 0x06, 0x12,
+       0x10, 0x12, 0x1e, 0x12, 0x0c, 0x13, 0x0e, 0x13, 0x10, 0x13, 0xfe, 0x9c,
+       0xf0, 0x35, 0x05, 0xfe,
+       0xec, 0x0e, 0xff, 0x10, 0x00, 0x00, 0xe9, 0xfe, 0x34, 0x1f, 0x00, 0xe8,
+       0xfe, 0x88, 0x01, 0xff,
+       0x03, 0x00, 0x00, 0xfe, 0x93, 0x15, 0xfe, 0x0f, 0x05, 0xff, 0x38, 0x00,
+       0x00, 0xfe, 0x57, 0x24,
+       0x00, 0xfe, 0x4c, 0x00, 0x65, 0xff, 0x04, 0x00, 0x00, 0x1a, 0xff, 0x09,
+       0x00, 0x00, 0xff, 0x08,
+       0x01, 0x01, 0xff, 0x08, 0xff, 0xff, 0xff, 0x27, 0x00, 0x00, 0xff, 0x10,
+       0xff, 0xff, 0xff, 0x13,
+       0x00, 0x00, 0xfe, 0x78, 0x56, 0xfe, 0x34, 0x12, 0xff, 0x21, 0x00, 0x00,
+       0xfe, 0x04, 0xf7, 0xe8,
+       0x37, 0x7d, 0x0d, 0x01, 0xfe, 0x4a, 0x11, 0xfe, 0x04, 0xf7, 0xe8, 0x7d,
+       0x0d, 0x51, 0x37, 0xfe,
+       0x3d, 0xf0, 0xfe, 0x0c, 0x02, 0xfe, 0x20, 0xf0, 0xbc, 0xfe, 0x91, 0xf0,
+       0xfe, 0xf8, 0x01, 0xfe,
+       0x90, 0xf0, 0xfe, 0xf8, 0x01, 0xfe, 0x8f, 0xf0, 0xbc, 0x03, 0x67, 0x4d,
+       0x05, 0xfe, 0x08, 0x0f,
+       0x01, 0xfe, 0x78, 0x0f, 0xfe, 0xdd, 0x12, 0x05, 0xfe, 0x0e, 0x03, 0xfe,
+       0x28, 0x1c, 0x03, 0xfe,
+       0xa6, 0x00, 0xfe, 0xd1, 0x12, 0x3e, 0x22, 0xfe, 0xa6, 0x00, 0xac, 0xfe,
+       0x48, 0xf0, 0xfe, 0x90,
+       0x02, 0xfe, 0x49, 0xf0, 0xfe, 0xaa, 0x02, 0xfe, 0x4a, 0xf0, 0xfe, 0xc8,
+       0x02, 0xfe, 0x46, 0xf0,
+       0xfe, 0x5a, 0x02, 0xfe, 0x47, 0xf0, 0xfe, 0x60, 0x02, 0xfe, 0x43, 0xf0,
+       0xfe, 0x4e, 0x02, 0xfe,
+       0x44, 0xf0, 0xfe, 0x52, 0x02, 0xfe, 0x45, 0xf0, 0xfe, 0x56, 0x02, 0x1c,
+       0x0d, 0xa2, 0x1c, 0x07,
+       0x22, 0xb7, 0x05, 0x35, 0xfe, 0x00, 0x1c, 0xfe, 0xf1, 0x10, 0xfe, 0x02,
+       0x1c, 0xf5, 0xfe, 0x1e,
+       0x1c, 0xfe, 0xe9, 0x10, 0x01, 0x5f, 0xfe, 0xe7, 0x10, 0xfe, 0x06, 0xfc,
+       0xde, 0x0a, 0x81, 0x01,
+       0xa3, 0x05, 0x35, 0x1f, 0x95, 0x47, 0xb8, 0x01, 0xfe, 0xe4, 0x11, 0x0a,
+       0x81, 0x01, 0x5c, 0xfe,
+       0xbd, 0x10, 0x0a, 0x81, 0x01, 0x5c, 0xfe, 0xad, 0x10, 0xfe, 0x16, 0x1c,
+       0xfe, 0x58, 0x1c, 0x1c,
+       0x07, 0x22, 0xb7, 0x37, 0x2a, 0x35, 0xfe, 0x3d, 0xf0, 0xfe, 0x0c, 0x02,
+       0x2b, 0xfe, 0x9e, 0x02,
+       0xfe, 0x5a, 0x1c, 0xfe, 0x12, 0x1c, 0xfe, 0x14, 0x1c, 0x1f, 0xfe, 0x30,
+       0x00, 0x47, 0xb8, 0x01,
+       0xfe, 0xd4, 0x11, 0x1c, 0x07, 0x22, 0xb7, 0x05, 0xe9, 0x21, 0x2c, 0x09,
+       0x1a, 0x31, 0xfe, 0x69,
+       0x10, 0x1c, 0x07, 0x22, 0xb7, 0xfe, 0x04, 0xec, 0x2c, 0x60, 0x01, 0xfe,
+       0x1e, 0x1e, 0x20, 0x2c,
+       0xfe, 0x05, 0xf6, 0xde, 0x01, 0xfe, 0x62, 0x1b, 0x01, 0x0c, 0x61, 0x4a,
+       0x44, 0x15, 0x56, 0x51,
+       0x01, 0xfe, 0x9e, 0x1e, 0x01, 0xfe, 0x96, 0x1a, 0x05, 0x35, 0x0a, 0x57,
+       0x01, 0x18, 0x09, 0x00,
+       0x36, 0x01, 0x85, 0xfe, 0x18, 0x10, 0xfe, 0x41, 0x58, 0x0a, 0xba, 0x01,
+       0x18, 0xfe, 0xc8, 0x54,
+       0x7b, 0xfe, 0x1c, 0x03, 0x01, 0xfe, 0x96, 0x1a, 0x05, 0x35, 0x37, 0x60,
+       0xfe, 0x02, 0xe8, 0x30,
+       0xfe, 0xbf, 0x57, 0xfe, 0x9e, 0x43, 0xfe, 0x77, 0x57, 0xfe, 0x27, 0xf0,
+       0xfe, 0xe4, 0x01, 0xfe,
+       0x07, 0x4b, 0xfe, 0x20, 0xf0, 0xbc, 0xfe, 0x40, 0x1c, 0x2a, 0xeb, 0xfe,
+       0x26, 0xf0, 0xfe, 0x66,
+       0x03, 0xfe, 0xa0, 0xf0, 0xfe, 0x54, 0x03, 0xfe, 0x11, 0xf0, 0xbc, 0xfe,
+       0xef, 0x10, 0xfe, 0x9f,
+       0xf0, 0xfe, 0x74, 0x03, 0xfe, 0x46, 0x1c, 0x19, 0xfe, 0x11, 0x00, 0x05,
+       0x70, 0x37, 0xfe, 0x48,
+       0x1c, 0xfe, 0x46, 0x1c, 0x01, 0x0c, 0x06, 0x28, 0xfe, 0x18, 0x13, 0x26,
+       0x21, 0xb9, 0xc7, 0x20,
+       0xb9, 0x0a, 0x57, 0x01, 0x18, 0xc7, 0x89, 0x01, 0xfe, 0xc8, 0x1a, 0x15,
+       0xe1, 0x2a, 0xeb, 0xfe,
+       0x01, 0xf0, 0xeb, 0xfe, 0x82, 0xf0, 0xfe, 0xa4, 0x03, 0xfe, 0x9c, 0x32,
+       0x15, 0xfe, 0xe4, 0x00,
+       0x2f, 0xfe, 0xb6, 0x03, 0x2a, 0x3c, 0x16, 0xfe, 0xc6, 0x03, 0x01, 0x41,
+       0xfe, 0x06, 0xf0, 0xfe,
+       0xd6, 0x03, 0xaf, 0xa0, 0xfe, 0x0a, 0xf0, 0xfe, 0xa2, 0x07, 0x05, 0x29,
+       0x03, 0x81, 0x1e, 0x1b,
+       0xfe, 0x24, 0x05, 0x1f, 0x63, 0x01, 0x42, 0x8f, 0xfe, 0x70, 0x02, 0x05,
+       0xea, 0xfe, 0x46, 0x1c,
+       0x37, 0x7d, 0x1d, 0xfe, 0x67, 0x1b, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57,
+       0xfe, 0x48, 0x1c, 0x75,
+       0x01, 0xa6, 0x86, 0x0a, 0x57, 0x01, 0x18, 0x09, 0x00, 0x1b, 0xec, 0x0a,
+       0xe1, 0x01, 0x18, 0x77,
+       0x50, 0x40, 0x8d, 0x30, 0x03, 0x81, 0x1e, 0xf8, 0x1f, 0x63, 0x01, 0x42,
+       0x8f, 0xfe, 0x70, 0x02,
+       0x05, 0xea, 0xd7, 0x99, 0xd8, 0x9c, 0x2a, 0x29, 0x2f, 0xfe, 0x4e, 0x04,
+       0x16, 0xfe, 0x4a, 0x04,
+       0x7e, 0xfe, 0xa0, 0x00, 0xfe, 0x9b, 0x57, 0xfe, 0x54, 0x12, 0x32, 0xff,
+       0x02, 0x00, 0x10, 0x01,
+       0x08, 0x16, 0xfe, 0x02, 0x05, 0x32, 0x01, 0x08, 0x16, 0x29, 0x27, 0x25,
+       0xee, 0xfe, 0x4c, 0x44,
+       0xfe, 0x58, 0x12, 0x50, 0xfe, 0x44, 0x48, 0x13, 0x34, 0xfe, 0x4c, 0x54,
+       0x7b, 0xec, 0x60, 0x8d,
+       0x30, 0x01, 0xfe, 0x4e, 0x1e, 0xfe, 0x48, 0x47, 0xfe, 0x7c, 0x13, 0x01,
+       0x0c, 0x06, 0x28, 0xfe,
+       0x32, 0x13, 0x01, 0x43, 0x09, 0x9b, 0xfe, 0x68, 0x13, 0xfe, 0x26, 0x10,
+       0x13, 0x34, 0xfe, 0x4c,
+       0x54, 0x7b, 0xec, 0x01, 0xfe, 0x4e, 0x1e, 0xfe, 0x48, 0x47, 0xfe, 0x54,
+       0x13, 0x01, 0x0c, 0x06,
+       0x28, 0xa5, 0x01, 0x43, 0x09, 0x9b, 0xfe, 0x40, 0x13, 0x01, 0x0c, 0x06,
+       0x28, 0xf9, 0x1f, 0x7f,
+       0x01, 0x0c, 0x06, 0x07, 0x4d, 0x1f, 0xfe, 0x0d, 0x00, 0x01, 0x42, 0x8f,
+       0xfe, 0xa4, 0x0e, 0x05,
+       0x29, 0x32, 0x15, 0xfe, 0xe6, 0x00, 0x0f, 0xfe, 0x1c, 0x90, 0x04, 0xfe,
+       0x9c, 0x93, 0x3a, 0x0b,
+       0x0e, 0x8b, 0x02, 0x1f, 0x7f, 0x01, 0x42, 0x05, 0x35, 0xfe, 0x42, 0x5b,
+       0x7d, 0x1d, 0xfe, 0x46,
+       0x59, 0xfe, 0xbf, 0x57, 0xfe, 0x77, 0x57, 0x0f, 0xfe, 0x87, 0x80, 0x04,
+       0xfe, 0x87, 0x83, 0xfe,
+       0xc9, 0x47, 0x0b, 0x0e, 0xd0, 0x65, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x98,
+       0x13, 0x0f, 0xfe, 0x20,
+       0x80, 0x04, 0xfe, 0xa0, 0x83, 0x33, 0x0b, 0x0e, 0x09, 0x1d, 0xfe, 0x84,
+       0x12, 0x01, 0x38, 0x06,
+       0x07, 0xfe, 0x70, 0x13, 0x03, 0xfe, 0xa2, 0x00, 0x1e, 0x1b, 0xfe, 0xda,
+       0x05, 0xd0, 0x54, 0x01,
+       0x38, 0x06, 0x0d, 0xfe, 0x58, 0x13, 0x03, 0xfe, 0xa0, 0x00, 0x1e, 0xfe,
+       0x50, 0x12, 0x5e, 0xff,
+       0x02, 0x00, 0x10, 0x2f, 0xfe, 0x90, 0x05, 0x2a, 0x3c, 0xcc, 0xff, 0x02,
+       0x00, 0x10, 0x2f, 0xfe,
+       0x9e, 0x05, 0x17, 0xfe, 0xf4, 0x05, 0x15, 0xfe, 0xe3, 0x00, 0x26, 0x01,
+       0x38, 0xfe, 0x4a, 0xf0,
+       0xfe, 0xc0, 0x05, 0xfe, 0x49, 0xf0, 0xfe, 0xba, 0x05, 0x71, 0x2e, 0xfe,
+       0x21, 0x00, 0xf1, 0x2e,
+       0xfe, 0x22, 0x00, 0xa2, 0x2e, 0x4a, 0xfe, 0x09, 0x48, 0xff, 0x02, 0x00,
+       0x10, 0x2f, 0xfe, 0xd0,
+       0x05, 0x17, 0xfe, 0xf4, 0x05, 0xfe, 0xe2, 0x08, 0x01, 0x38, 0x06, 0xfe,
+       0x1c, 0x00, 0x4d, 0x01,
+       0xa7, 0x2e, 0x07, 0x20, 0xe4, 0x47, 0xfe, 0x27, 0x01, 0x01, 0x0c, 0x06,
+       0x28, 0xfe, 0x24, 0x12,
+       0x3e, 0x01, 0x84, 0x1f, 0x7f, 0x01, 0x0c, 0x06, 0x07, 0x4d, 0x1f, 0xfe,
+       0x0d, 0x00, 0x01, 0x42,
+       0x8f, 0xfe, 0xa4, 0x0e, 0x05, 0x29, 0x03, 0xe6, 0x1e, 0xfe, 0xca, 0x13,
+       0x03, 0xb6, 0x1e, 0xfe,
+       0x40, 0x12, 0x03, 0x66, 0x1e, 0xfe, 0x38, 0x13, 0x3e, 0x01, 0x84, 0x17,
+       0xfe, 0x72, 0x06, 0x0a,
+       0x07, 0x01, 0x38, 0x06, 0x24, 0xfe, 0x02, 0x12, 0x4f, 0x01, 0xfe, 0x56,
+       0x19, 0x16, 0xfe, 0x68,
+       0x06, 0x15, 0x82, 0x01, 0x41, 0x15, 0xe2, 0x03, 0x66, 0x8a, 0x10, 0x66,
+       0x03, 0x9a, 0x1e, 0xfe,
+       0x70, 0x12, 0x03, 0x55, 0x1e, 0xfe, 0x68, 0x13, 0x01, 0xc6, 0x09, 0x12,
+       0x48, 0xfe, 0x92, 0x06,
+       0x2e, 0x12, 0x01, 0xfe, 0xac, 0x1d, 0xfe, 0x43, 0x48, 0x62, 0x80, 0x13,
+       0x58, 0xff, 0x02, 0x00,
+       0x57, 0x52, 0xad, 0x23, 0x3f, 0x4e, 0x62, 0x49, 0x3e, 0x01, 0x84, 0x17,
+       0xfe, 0xea, 0x06, 0x01,
+       0x38, 0x06, 0x12, 0xf7, 0x45, 0x0a, 0x95, 0x01, 0xfe, 0x84, 0x19, 0x16,
+       0xfe, 0xe0, 0x06, 0x15,
+       0x82, 0x01, 0x41, 0x15, 0xe2, 0x03, 0x55, 0x8a, 0x10, 0x55, 0x1c, 0x07,
+       0x01, 0x84, 0xfe, 0xae,
+       0x10, 0x03, 0x6f, 0x1e, 0xfe, 0x9e, 0x13, 0x3e, 0x01, 0x84, 0x03, 0x9a,
+       0x1e, 0xfe, 0x1a, 0x12,
+       0x01, 0x38, 0x06, 0x12, 0xfc, 0x01, 0xc6, 0x01, 0xfe, 0xac, 0x1d, 0xfe,
+       0x43, 0x48, 0x62, 0x80,
+       0xf0, 0x45, 0x0a, 0x95, 0x03, 0xb6, 0x1e, 0xf8, 0x01, 0x38, 0x06, 0x24,
+       0x36, 0xfe, 0x02, 0xf6,
+       0x07, 0x71, 0x78, 0x8c, 0x00, 0x4d, 0x62, 0x49, 0x3e, 0x2d, 0x93, 0x4e,
+       0xd0, 0x0d, 0x17, 0xfe,
+       0x9a, 0x07, 0x01, 0xfe, 0xc0, 0x19, 0x16, 0xfe, 0x90, 0x07, 0x26, 0x20,
+       0x9e, 0x15, 0x82, 0x01,
+       0x41, 0x15, 0xe2, 0x21, 0x9e, 0x09, 0x07, 0xfb, 0x03, 0xe6, 0xfe, 0x58,
+       0x57, 0x10, 0xe6, 0x05,
+       0xfe, 0x2a, 0x06, 0x03, 0x6f, 0x8a, 0x10, 0x6f, 0x1c, 0x07, 0x01, 0x84,
+       0xfe, 0x9c, 0x32, 0x5f,
+       0x75, 0x01, 0xa6, 0x86, 0x15, 0xfe, 0xe2, 0x00, 0x2f, 0xed, 0x2a, 0x3c,
+       0xfe, 0x0a, 0xf0, 0xfe,
+       0xce, 0x07, 0xae, 0xfe, 0x96, 0x08, 0xfe, 0x06, 0xf0, 0xfe, 0x9e, 0x08,
+       0xaf, 0xa0, 0x05, 0x29,
+       0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x2e, 0x12, 0x14, 0x1d, 0x01, 0x08, 0x14,
+       0x00, 0x01, 0x08, 0x14,
+       0x00, 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0xfe, 0x99, 0xa4, 0x01, 0x08,
+       0x14, 0x00, 0x05, 0xfe,
+       0xc6, 0x09, 0x01, 0x76, 0x06, 0x12, 0xfe, 0x3a, 0x12, 0x01, 0x0c, 0x06,
+       0x12, 0xfe, 0x30, 0x13,
+       0x14, 0xfe, 0x1b, 0x00, 0x01, 0x08, 0x14, 0x00, 0x01, 0x08, 0x14, 0x00,
+       0x01, 0x08, 0x14, 0x00,
+       0x01, 0x08, 0x14, 0x07, 0x01, 0x08, 0x14, 0x00, 0x05, 0xef, 0x7c, 0x4a,
+       0x78, 0x4f, 0x0f, 0xfe,
+       0x9a, 0x81, 0x04, 0xfe, 0x9a, 0x83, 0xfe, 0xcb, 0x47, 0x0b, 0x0e, 0x2d,
+       0x28, 0x48, 0xfe, 0x6c,
+       0x08, 0x0a, 0x28, 0xfe, 0x09, 0x6f, 0xca, 0xfe, 0xca, 0x45, 0xfe, 0x32,
+       0x12, 0x53, 0x63, 0x4e,
+       0x7c, 0x97, 0x2f, 0xfe, 0x7e, 0x08, 0x2a, 0x3c, 0xfe, 0x0a, 0xf0, 0xfe,
+       0x6c, 0x08, 0xaf, 0xa0,
+       0xae, 0xfe, 0x96, 0x08, 0x05, 0x29, 0x01, 0x41, 0x05, 0xed, 0x14, 0x24,
+       0x05, 0xed, 0xfe, 0x9c,
+       0xf7, 0x9f, 0x01, 0xfe, 0xae, 0x1e, 0xfe, 0x18, 0x58, 0x01, 0xfe, 0xbe,
+       0x1e, 0xfe, 0x99, 0x58,
+       0xfe, 0x78, 0x18, 0xfe, 0xf9, 0x18, 0x8e, 0xfe, 0x16, 0x09, 0x10, 0x6a,
+       0x22, 0x6b, 0x01, 0x0c,
+       0x61, 0x54, 0x44, 0x21, 0x2c, 0x09, 0x1a, 0xf8, 0x77, 0x01, 0xfe, 0x7e,
+       0x1e, 0x47, 0x2c, 0x7a,
+       0x30, 0xf0, 0xfe, 0x83, 0xe7, 0xfe, 0x3f, 0x00, 0x71, 0xfe, 0x03, 0x40,
+       0x01, 0x0c, 0x61, 0x65,
+       0x44, 0x01, 0xc2, 0xc8, 0xfe, 0x1f, 0x40, 0x20, 0x6e, 0x01, 0xfe, 0x6a,
+       0x16, 0xfe, 0x08, 0x50,
+       0xfe, 0x8a, 0x50, 0xfe, 0x44, 0x51, 0xfe, 0xc6, 0x51, 0xfe, 0x10, 0x10,
+       0x01, 0xfe, 0xce, 0x1e,
+       0x01, 0xfe, 0xde, 0x1e, 0x10, 0x68, 0x22, 0x69, 0x01, 0xfe, 0xee, 0x1e,
+       0x01, 0xfe, 0xfe, 0x1e,
+       0xfe, 0x40, 0x50, 0xfe, 0xc2, 0x50, 0x10, 0x4b, 0x22, 0x4c, 0xfe, 0x8a,
+       0x10, 0x01, 0x0c, 0x06,
+       0x54, 0xfe, 0x50, 0x12, 0x01, 0xfe, 0xae, 0x1e, 0x01, 0xfe, 0xbe, 0x1e,
+       0x10, 0x6a, 0x22, 0x6b,
+       0x01, 0x0c, 0x06, 0x65, 0x4e, 0x01, 0xc2, 0x0f, 0xfe, 0x1f, 0x80, 0x04,
+       0xfe, 0x9f, 0x83, 0x33,
+       0x0b, 0x0e, 0x20, 0x6e, 0x0f, 0xfe, 0x44, 0x90, 0x04, 0xfe, 0xc4, 0x93,
+       0x3a, 0x0b, 0xfe, 0xc6,
+       0x90, 0x04, 0xfe, 0xc6, 0x93, 0x79, 0x0b, 0x0e, 0x10, 0x6c, 0x22, 0x6d,
+       0x01, 0xfe, 0xce, 0x1e,
+       0x01, 0xfe, 0xde, 0x1e, 0x10, 0x68, 0x22, 0x69, 0x0f, 0xfe, 0x40, 0x90,
+       0x04, 0xfe, 0xc0, 0x93,
+       0x3a, 0x0b, 0xfe, 0xc2, 0x90, 0x04, 0xfe, 0xc2, 0x93, 0x79, 0x0b, 0x0e,
+       0x10, 0x4b, 0x22, 0x4c,
+       0x10, 0x64, 0x22, 0x34, 0x01, 0x0c, 0x61, 0x24, 0x44, 0x37, 0x13, 0xfe,
+       0x4e, 0x11, 0x2f, 0xfe,
+       0xde, 0x09, 0xfe, 0x9e, 0xf0, 0xfe, 0xf2, 0x09, 0xfe, 0x01, 0x48, 0x1b,
+       0x3c, 0x37, 0x88, 0xf5,
+       0xd4, 0xfe, 0x1e, 0x0a, 0xd5, 0xfe, 0x42, 0x0a, 0xd2, 0xfe, 0x1e, 0x0a,
+       0xd3, 0xfe, 0x42, 0x0a,
+       0xae, 0xfe, 0x12, 0x0a, 0xfe, 0x06, 0xf0, 0xfe, 0x18, 0x0a, 0xaf, 0xa0,
+       0x05, 0x29, 0x01, 0x41,
+       0xfe, 0xc1, 0x10, 0x14, 0x24, 0xfe, 0xc1, 0x10, 0x01, 0x76, 0x06, 0x07,
+       0xfe, 0x14, 0x12, 0x01,
+       0x76, 0x06, 0x0d, 0x5d, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x74, 0x12, 0xfe,
+       0x2e, 0x1c, 0x05, 0xfe,
+       0x1a, 0x0c, 0x01, 0x76, 0x06, 0x07, 0x5d, 0x01, 0x76, 0x06, 0x0d, 0x41,
+       0xfe, 0x2c, 0x1c, 0xfe,
+       0xaa, 0xf0, 0xfe, 0xce, 0x0a, 0xfe, 0xac, 0xf0, 0xfe, 0x66, 0x0a, 0xfe,
+       0x92, 0x10, 0xc4, 0xf6,
+       0xfe, 0xad, 0xf0, 0xfe, 0x72, 0x0a, 0x05, 0xfe, 0x1a, 0x0c, 0xc5, 0xfe,
+       0xe7, 0x10, 0xfe, 0x2b,
+       0xf0, 0xbf, 0xfe, 0x6b, 0x18, 0x23, 0xfe, 0x00, 0xfe, 0xfe, 0x1c, 0x12,
+       0xac, 0xfe, 0xd2, 0xf0,
+       0xbf, 0xfe, 0x76, 0x18, 0x23, 0x1d, 0x1b, 0xbf, 0x03, 0xe3, 0x23, 0x07,
+       0x1b, 0xbf, 0xd4, 0x5b,
+       0xd5, 0x5b, 0xd2, 0x5b, 0xd3, 0x5b, 0xc4, 0xc5, 0xfe, 0xa9, 0x10, 0x75,
+       0x5e, 0x32, 0x1f, 0x7f,
+       0x01, 0x42, 0x19, 0xfe, 0x35, 0x00, 0xfe, 0x01, 0xf0, 0x70, 0x19, 0x98,
+       0x05, 0x70, 0xfe, 0x74,
+       0x18, 0x23, 0xfe, 0x00, 0xf8, 0x1b, 0x5b, 0x7d, 0x12, 0x01, 0xfe, 0x78,
+       0x0f, 0x4d, 0x01, 0xfe,
+       0x96, 0x1a, 0x21, 0x30, 0x77, 0x7d, 0x1d, 0x05, 0x5b, 0x01, 0x0c, 0x06,
+       0x0d, 0x2b, 0xfe, 0xe2,
+       0x0b, 0x01, 0x0c, 0x06, 0x54, 0xfe, 0xa6, 0x12, 0x01, 0x0c, 0x06, 0x24,
+       0xfe, 0x88, 0x13, 0x21,
+       0x6e, 0xc7, 0x01, 0xfe, 0x1e, 0x1f, 0x0f, 0xfe, 0x83, 0x80, 0x04, 0xfe,
+       0x83, 0x83, 0xfe, 0xc9,
+       0x47, 0x0b, 0x0e, 0xfe, 0xc8, 0x44, 0xfe, 0x42, 0x13, 0x0f, 0xfe, 0x04,
+       0x91, 0x04, 0xfe, 0x84,
+       0x93, 0xfe, 0xca, 0x57, 0x0b, 0xfe, 0x86, 0x91, 0x04, 0xfe, 0x86, 0x93,
+       0xfe, 0xcb, 0x57, 0x0b,
+       0x0e, 0x7a, 0x30, 0xfe, 0x40, 0x59, 0xfe, 0xc1, 0x59, 0x8e, 0x40, 0x03,
+       0x6a, 0x3b, 0x6b, 0x10,
+       0x97, 0x22, 0x98, 0xd9, 0x6a, 0xda, 0x6b, 0x01, 0xc2, 0xc8, 0x7a, 0x30,
+       0x20, 0x6e, 0xdb, 0x64,
+       0xdc, 0x34, 0x91, 0x6c, 0x7e, 0x6d, 0xfe, 0x44, 0x55, 0xfe, 0xe5, 0x55,
+       0xfe, 0x04, 0xfa, 0x64,
+       0xfe, 0x05, 0xfa, 0x34, 0x01, 0xfe, 0x6a, 0x16, 0xa3, 0x26, 0x10, 0x97,
+       0x10, 0x98, 0x91, 0x6c,
+       0x7e, 0x6d, 0xfe, 0x14, 0x10, 0x01, 0x0c, 0x06, 0x24, 0x1b, 0x40, 0x91,
+       0x4b, 0x7e, 0x4c, 0x01,
+       0x0c, 0x06, 0xfe, 0xf7, 0x00, 0x44, 0x03, 0x68, 0x3b, 0x69, 0xfe, 0x10,
+       0x58, 0xfe, 0x91, 0x58,
+       0xfe, 0x14, 0x59, 0xfe, 0x95, 0x59, 0x05, 0x5b, 0x01, 0x0c, 0x06, 0x24,
+       0x1b, 0x40, 0x01, 0x0c,
+       0x06, 0xfe, 0xf7, 0x00, 0x44, 0x78, 0x01, 0xfe, 0x8e, 0x1e, 0x4f, 0x0f,
+       0xfe, 0x10, 0x90, 0x04,
+       0xfe, 0x90, 0x93, 0x3a, 0x0b, 0xfe, 0x92, 0x90, 0x04, 0xfe, 0x92, 0x93,
+       0x79, 0x0b, 0x0e, 0xfe,
+       0xbd, 0x10, 0x01, 0x43, 0x09, 0xbb, 0x1b, 0xfe, 0x6e, 0x0a, 0x15, 0xbb,
+       0x01, 0x0c, 0x06, 0x0d,
+       0xfe, 0x14, 0x13, 0x03, 0x4b, 0x3b, 0x4c, 0x8e, 0xfe, 0x6e, 0x0a, 0xfe,
+       0x0c, 0x58, 0xfe, 0x8d,
+       0x58, 0x05, 0x5b, 0x26, 0x3e, 0x0f, 0xfe, 0x19, 0x80, 0x04, 0xfe, 0x99,
+       0x83, 0x33, 0x0b, 0x0e,
+       0xfe, 0xe5, 0x10, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x1a, 0x12, 0xfe, 0x6c,
+       0x19, 0xfe, 0x19, 0x41,
+       0xfe, 0x6b, 0x18, 0xac, 0xfe, 0xd1, 0xf0, 0xef, 0x1f, 0x92, 0x01, 0x42,
+       0x19, 0xfe, 0x44, 0x00,
+       0xfe, 0x90, 0x10, 0xfe, 0x6c, 0x19, 0xd9, 0x4b, 0xfe, 0xed, 0x19, 0xda,
+       0x4c, 0xfe, 0x0c, 0x51,
+       0xfe, 0x8e, 0x51, 0xfe, 0x6b, 0x18, 0x23, 0xfe, 0x00, 0xff, 0x31, 0xfe,
+       0x76, 0x10, 0xac, 0xfe,
+       0xd2, 0xf0, 0xfe, 0xba, 0x0c, 0xfe, 0x76, 0x18, 0x23, 0x1d, 0x5d, 0x03,
+       0xe3, 0x23, 0x07, 0xfe,
+       0x08, 0x13, 0x19, 0xfe, 0x16, 0x00, 0x05, 0x70, 0xfe, 0xd1, 0xf0, 0xfe,
+       0xcc, 0x0c, 0x1f, 0x92,
+       0x01, 0x42, 0x19, 0xfe, 0x17, 0x00, 0x5c, 0xfe, 0xce, 0xf0, 0xfe, 0xd2,
+       0x0c, 0xfe, 0x3e, 0x10,
+       0xfe, 0xcd, 0xf0, 0xfe, 0xde, 0x0c, 0x19, 0xfe, 0x22, 0x00, 0x05, 0x70,
+       0xfe, 0xcb, 0xf0, 0xfe,
+       0xea, 0x0c, 0x19, 0xfe, 0x24, 0x00, 0x05, 0x70, 0xfe, 0xd0, 0xf0, 0xfe,
+       0xf4, 0x0c, 0x19, 0x94,
+       0xfe, 0x1c, 0x10, 0xfe, 0xcf, 0xf0, 0xfe, 0xfe, 0x0c, 0x19, 0x4a, 0xf3,
+       0xfe, 0xcc, 0xf0, 0xef,
+       0x01, 0x76, 0x06, 0x24, 0x4d, 0x19, 0xfe, 0x12, 0x00, 0x37, 0x13, 0xfe,
+       0x4e, 0x11, 0x2f, 0xfe,
+       0x16, 0x0d, 0xfe, 0x9e, 0xf0, 0xfe, 0x2a, 0x0d, 0xfe, 0x01, 0x48, 0x1b,
+       0x3c, 0x37, 0x88, 0xf5,
+       0xd4, 0x29, 0xd5, 0x29, 0xd2, 0x29, 0xd3, 0x29, 0x37, 0xfe, 0x9c, 0x32,
+       0x2f, 0xfe, 0x3e, 0x0d,
+       0x2a, 0x3c, 0xae, 0xfe, 0x62, 0x0d, 0xaf, 0xa0, 0xd4, 0x9f, 0xd5, 0x9f,
+       0xd2, 0x9f, 0xd3, 0x9f,
+       0x05, 0x29, 0x01, 0x41, 0xfe, 0xd3, 0x10, 0x15, 0xfe, 0xe8, 0x00, 0xc4,
+       0xc5, 0x75, 0xd7, 0x99,
+       0xd8, 0x9c, 0xfe, 0x89, 0xf0, 0x29, 0x27, 0x25, 0xbe, 0xd7, 0x99, 0xd8,
+       0x9c, 0x2f, 0xfe, 0x8c,
+       0x0d, 0x16, 0x29, 0x27, 0x25, 0xbd, 0xfe, 0x01, 0x48, 0xa4, 0x19, 0xfe,
+       0x42, 0x00, 0x05, 0x70,
+       0x90, 0x07, 0xfe, 0x81, 0x49, 0x1b, 0xfe, 0x64, 0x0e, 0x01, 0x0c, 0x06,
+       0x0d, 0xfe, 0x44, 0x13,
+       0x19, 0x00, 0x2d, 0x0d, 0xfe, 0x54, 0x12, 0x2d, 0xfe, 0x28, 0x00, 0x2b,
+       0xfe, 0xda, 0x0e, 0x0a,
+       0x57, 0x01, 0x18, 0x09, 0x00, 0x36, 0x46, 0xfe, 0x28, 0x00, 0xfe, 0xfa,
+       0x10, 0x01, 0xfe, 0xf4,
+       0x1c, 0x01, 0xfe, 0x00, 0x1d, 0x0a, 0xba, 0x01, 0xfe, 0x58, 0x10, 0x40,
+       0x15, 0x56, 0x01, 0x85,
+       0x05, 0x35, 0x19, 0xfe, 0x44, 0x00, 0x2d, 0x0d, 0xf7, 0x46, 0x0d, 0xfe,
+       0xcc, 0x10, 0x01, 0xa7,
+       0x46, 0x0d, 0xfe, 0xc2, 0x10, 0x01, 0xa7, 0x0f, 0xfe, 0x19, 0x82, 0x04,
+       0xfe, 0x99, 0x83, 0xfe,
+       0xcc, 0x47, 0x0b, 0x0e, 0xfe, 0x34, 0x46, 0xa5, 0x46, 0x0d, 0x19, 0xfe,
+       0x43, 0x00, 0xfe, 0xa2,
+       0x10, 0x01, 0x0c, 0x61, 0x0d, 0x44, 0x01, 0xfe, 0xf4, 0x1c, 0x01, 0xfe,
+       0x00, 0x1d, 0x40, 0x15,
+       0x56, 0x01, 0x85, 0x7d, 0x0d, 0x40, 0x51, 0x01, 0xfe, 0x9e, 0x1e, 0x05,
+       0xfe, 0x3a, 0x03, 0x01,
+       0x0c, 0x06, 0x0d, 0x5d, 0x46, 0x0d, 0x19, 0x00, 0xfe, 0x62, 0x10, 0x01,
+       0x76, 0x06, 0x12, 0xfe,
+       0x5c, 0x12, 0x01, 0x0c, 0x06, 0x12, 0xfe, 0x52, 0x13, 0xfe, 0x1c, 0x1c,
+       0xfe, 0x9d, 0xf0, 0xfe,
+       0x8e, 0x0e, 0xfe, 0x1c, 0x1c, 0xfe, 0x9d, 0xf0, 0xfe, 0x94, 0x0e, 0x01,
+       0x0c, 0x61, 0x12, 0x44,
+       0xfe, 0x9f, 0x10, 0x19, 0xfe, 0x15, 0x00, 0xfe, 0x04, 0xe6, 0x0d, 0x4f,
+       0xfe, 0x2e, 0x10, 0x19,
+       0xfe, 0x13, 0x00, 0xfe, 0x10, 0x10, 0x19, 0xfe, 0x47, 0x00, 0xf1, 0x19,
+       0xfe, 0x41, 0x00, 0xa2,
+       0x19, 0xfe, 0x24, 0x00, 0x86, 0xc4, 0xc5, 0x75, 0x03, 0x81, 0x1e, 0x2b,
+       0xea, 0x4f, 0xfe, 0x04,
+       0xe6, 0x12, 0xfe, 0x9d, 0x41, 0xfe, 0x1c, 0x42, 0x40, 0x01, 0xf4, 0x05,
+       0x35, 0xfe, 0x12, 0x1c,
+       0x1f, 0x0d, 0x47, 0xb5, 0xc3, 0x1f, 0xfe, 0x31, 0x00, 0x47, 0xb8, 0x01,
+       0xfe, 0xd4, 0x11, 0x05,
+       0xe9, 0x51, 0xfe, 0x06, 0xec, 0xe0, 0xfe, 0x0e, 0x47, 0x46, 0x28, 0xfe,
+       0xce, 0x45, 0x31, 0x51,
+       0xfe, 0x06, 0xea, 0xe0, 0xfe, 0x47, 0x4b, 0x45, 0xfe, 0x75, 0x57, 0x03,
+       0x67, 0xfe, 0x98, 0x56,
+       0xfe, 0x38, 0x12, 0x0a, 0x5a, 0x01, 0x18, 0xfe, 0x44, 0x48, 0x60, 0x01,
+       0x0c, 0x06, 0x28, 0xfe,
+       0x18, 0x13, 0x0a, 0x57, 0x01, 0x18, 0x3e, 0xfe, 0x41, 0x58, 0x0a, 0xba,
+       0xfe, 0xfa, 0x14, 0xfe,
+       0x49, 0x54, 0xb0, 0xfe, 0x5e, 0x0f, 0x05, 0xfe, 0x3a, 0x03, 0x0a, 0x67,
+       0xfe, 0xe0, 0x14, 0xfe,
+       0x0e, 0x47, 0x46, 0x28, 0xfe, 0xce, 0x45, 0x31, 0x51, 0xfe, 0xce, 0x47,
+       0xfe, 0xad, 0x13, 0x05,
+       0x35, 0x21, 0x2c, 0x09, 0x1a, 0xfe, 0x98, 0x12, 0x26, 0x20, 0x96, 0x20,
+       0xe7, 0xfe, 0x08, 0x1c,
+       0xfe, 0x7c, 0x19, 0xfe, 0xfd, 0x19, 0xfe, 0x0a, 0x1c, 0x03, 0xe5, 0xfe,
+       0x48, 0x55, 0xa5, 0x3b,
+       0xfe, 0x62, 0x01, 0xfe, 0xc9, 0x55, 0x31, 0xfe, 0x74, 0x10, 0x01, 0xfe,
+       0xf0, 0x1a, 0x03, 0xfe,
+       0x38, 0x01, 0x3b, 0xfe, 0x3a, 0x01, 0x8e, 0xfe, 0x1e, 0x10, 0xfe, 0x02,
+       0xec, 0xe7, 0x53, 0x00,
+       0x36, 0xfe, 0x04, 0xec, 0x2c, 0x60, 0xfe, 0x05, 0xf6, 0xfe, 0x34, 0x01,
+       0x01, 0xfe, 0x62, 0x1b,
+       0x01, 0xfe, 0xce, 0x1e, 0xb2, 0x11, 0xfe, 0x18, 0x13, 0xca, 0xfe, 0x02,
+       0xea, 0xe7, 0x53, 0x92,
+       0xfe, 0xc3, 0x13, 0x1f, 0x12, 0x47, 0xb5, 0xc3, 0xfe, 0x2a, 0x10, 0x03,
+       0xfe, 0x38, 0x01, 0x23,
+       0xfe, 0xf0, 0xff, 0x10, 0xe5, 0x03, 0xfe, 0x3a, 0x01, 0x10, 0xfe, 0x62,
+       0x01, 0x01, 0xfe, 0x1e,
+       0x1e, 0x20, 0x2c, 0x15, 0x56, 0x01, 0xfe, 0x9e, 0x1e, 0x13, 0x07, 0x02,
+       0x26, 0x02, 0x21, 0x96,
+       0xc7, 0x20, 0x96, 0x09, 0x92, 0xfe, 0x79, 0x13, 0x1f, 0x1d, 0x47, 0xb5,
+       0xc3, 0xfe, 0xe1, 0x10,
+       0xcf, 0xfe, 0x03, 0xdc, 0xfe, 0x73, 0x57, 0xfe, 0x80, 0x5d, 0x02, 0xcf,
+       0xfe, 0x03, 0xdc, 0xfe,
+       0x5b, 0x57, 0xfe, 0x80, 0x5d, 0x02, 0xfe, 0x03, 0x57, 0xcf, 0x26, 0xfe,
+       0x00, 0xcc, 0x02, 0xfe,
+       0x03, 0x57, 0xcf, 0x89, 0x02, 0x01, 0x0c, 0x06, 0x4a, 0xfe, 0x4e, 0x13,
+       0x0f, 0xfe, 0x1c, 0x80,
+       0x04, 0xfe, 0x9c, 0x83, 0x33, 0x0b, 0x0e, 0x09, 0x07, 0xfe, 0x3a, 0x13,
+       0x0f, 0xfe, 0x1e, 0x80,
+       0x04, 0xfe, 0x9e, 0x83, 0x33, 0x0b, 0x0e, 0xfe, 0x2a, 0x13, 0x0f, 0xfe,
+       0x1d, 0x80, 0x04, 0xfe,
+       0x9d, 0x83, 0xfe, 0xf9, 0x13, 0x0e, 0xfe, 0x1c, 0x13, 0x01, 0xfe, 0xee,
+       0x1e, 0xac, 0xfe, 0x14,
+       0x13, 0x01, 0xfe, 0xfe, 0x1e, 0xfe, 0x81, 0x58, 0xfa, 0x01, 0xfe, 0x0e,
+       0x1f, 0xfe, 0x30, 0xf4,
+       0x0d, 0xfe, 0x3c, 0x50, 0xa2, 0x01, 0xfe, 0x92, 0x1b, 0x01, 0x43, 0x09,
+       0x56, 0xfb, 0x01, 0xfe,
+       0xc8, 0x1a, 0x01, 0x0c, 0x06, 0x28, 0xa4, 0x01, 0xfe, 0xf4, 0x1c, 0x01,
+       0xfe, 0x00, 0x1d, 0x15,
+       0xfe, 0xe9, 0x00, 0x01, 0x0c, 0x06, 0x4a, 0xfe, 0x4e, 0x13, 0x01, 0xfe,
+       0x22, 0x1b, 0xfe, 0x1e,
+       0x1c, 0x0f, 0xfe, 0x14, 0x90, 0x04, 0xfe, 0x94, 0x93, 0x3a, 0x0b, 0xfe,
+       0x96, 0x90, 0x04, 0xfe,
+       0x96, 0x93, 0x79, 0x0b, 0x0e, 0x10, 0xfe, 0x64, 0x01, 0x22, 0xfe, 0x66,
+       0x01, 0x01, 0x0c, 0x06,
+       0x65, 0xf9, 0x0f, 0xfe, 0x03, 0x80, 0x04, 0xfe, 0x83, 0x83, 0x33, 0x0b,
+       0x0e, 0x77, 0xfe, 0x01,
+       0xec, 0x2c, 0xfe, 0x80, 0x40, 0x20, 0x2c, 0x7a, 0x30, 0x15, 0xdf, 0x40,
+       0x21, 0x2c, 0xfe, 0x00,
+       0x40, 0x8d, 0x2c, 0x02, 0xfe, 0x08, 0x1c, 0x03, 0xfe, 0xac, 0x00, 0xfe,
+       0x06, 0x58, 0x03, 0xfe,
+       0xae, 0x00, 0xfe, 0x07, 0x58, 0x03, 0xfe, 0xb0, 0x00, 0xfe, 0x08, 0x58,
+       0x03, 0xfe, 0xb2, 0x00,
+       0xfe, 0x09, 0x58, 0xfe, 0x0a, 0x1c, 0x2e, 0x49, 0x20, 0xe0, 0x26, 0x10,
+       0x66, 0x10, 0x55, 0x10,
+       0x6f, 0x13, 0x57, 0x52, 0x4f, 0x1c, 0x28, 0xfe, 0x90, 0x4d, 0xfe, 0x91,
+       0x54, 0x2b, 0xfe, 0x88,
+       0x11, 0x46, 0x1a, 0x13, 0x5a, 0x52, 0x1c, 0x4a, 0xfe, 0x90, 0x4d, 0xfe,
+       0x91, 0x54, 0x2b, 0xfe,
+       0x9e, 0x11, 0x2e, 0x1a, 0x20, 0x2c, 0x90, 0x34, 0x60, 0x21, 0x2c, 0xfe,
+       0x00, 0x40, 0x8d, 0x2c,
+       0x15, 0xdf, 0xfe, 0x14, 0x56, 0xfe, 0xd6, 0xf0, 0xfe, 0xb2, 0x11, 0xfe,
+       0x12, 0x1c, 0x75, 0xfe,
+       0x14, 0x1c, 0xfe, 0x10, 0x1c, 0xfe, 0x18, 0x1c, 0x02, 0x51, 0xfe, 0x0c,
+       0x14, 0xfe, 0x0e, 0x47,
+       0xfe, 0x07, 0xe6, 0x28, 0xfe, 0xce, 0x47, 0xfe, 0xf5, 0x13, 0x02, 0x01,
+       0xa7, 0x90, 0x34, 0x60,
+       0xfe, 0x06, 0x80, 0xfe, 0x48, 0x47, 0xfe, 0x42, 0x13, 0xfe, 0x02, 0x80,
+       0x09, 0x56, 0xfe, 0x34,
+       0x13, 0x0a, 0x5a, 0x01, 0x18, 0xcb, 0xfe, 0x36, 0x12, 0xfe, 0x41, 0x48,
+       0xfe, 0x45, 0x48, 0x01,
+       0xfe, 0xb2, 0x16, 0xfe, 0x00, 0xcc, 0xcb, 0xfe, 0xf3, 0x13, 0x3f, 0x89,
+       0x09, 0x1a, 0xa5, 0x0a,
+       0x9d, 0x01, 0x18, 0xfe, 0x80, 0x5c, 0x01, 0x85, 0xf2, 0x09, 0x9b, 0xa4,
+       0xfe, 0x14, 0x56, 0xfe,
+       0xd6, 0xf0, 0xfe, 0xec, 0x11, 0x02, 0xfe, 0x44, 0x58, 0x77, 0xfe, 0x01,
+       0xec, 0xb8, 0xfe, 0x9e,
+       0x40, 0xfe, 0x9d, 0xe7, 0x00, 0xfe, 0x9c, 0xe7, 0x12, 0x8d, 0x30, 0x01,
+       0xf4, 0xfe, 0xdd, 0x10,
+       0x37, 0xd7, 0x99, 0xd8, 0x9c, 0x27, 0x25, 0xee, 0x09, 0x12, 0xfe, 0x48,
+       0x12, 0x09, 0x0d, 0xfe,
+       0x56, 0x12, 0x09, 0x1d, 0xfe, 0x30, 0x12, 0x09, 0xdd, 0x1b, 0xfe, 0xc4,
+       0x13, 0x09, 0xfe, 0x23,
+       0x00, 0x1b, 0xfe, 0xd0, 0x13, 0x09, 0x07, 0x1b, 0xfe, 0x34, 0x14, 0x09,
+       0x24, 0xfe, 0x12, 0x12,
+       0x09, 0x00, 0x1b, 0x29, 0x1f, 0xdd, 0x01, 0x42, 0xa1, 0x32, 0x01, 0x08,
+       0xae, 0x41, 0x02, 0x32,
+       0xfe, 0x62, 0x08, 0x0a, 0xe1, 0x01, 0xfe, 0x58, 0x10, 0x15, 0x9b, 0x05,
+       0x35, 0x32, 0x01, 0x43,
+       0x09, 0xbb, 0xfe, 0xd7, 0x13, 0x91, 0x4b, 0x7e, 0x4c, 0x8e, 0xfe, 0x80,
+       0x13, 0x01, 0x0c, 0x06,
+       0x54, 0xfe, 0x72, 0x12, 0xdb, 0x64, 0xdc, 0x34, 0xfe, 0x44, 0x55, 0xfe,
+       0xe5, 0x55, 0xb0, 0xfe,
+       0x4a, 0x13, 0x21, 0x6e, 0xfe, 0x26, 0x13, 0x03, 0x97, 0x3b, 0x98, 0x8e,
+       0xfe, 0xb6, 0x0e, 0x10,
+       0x6a, 0x22, 0x6b, 0x26, 0x10, 0x97, 0x10, 0x98, 0x01, 0xc2, 0x2e, 0x49,
+       0x88, 0x20, 0x6e, 0x01,
+       0xfe, 0x6a, 0x16, 0xdb, 0x64, 0xdc, 0x34, 0xfe, 0x04, 0x55, 0xfe, 0xa5,
+       0x55, 0xfe, 0x04, 0xfa,
+       0x64, 0xfe, 0x05, 0xfa, 0x34, 0xfe, 0x8f, 0x10, 0x03, 0x6c, 0x3b, 0x6d,
+       0xfe, 0x40, 0x56, 0xfe,
+       0xe1, 0x56, 0x10, 0x6c, 0x22, 0x6d, 0x71, 0xdb, 0x64, 0xdc, 0x34, 0xfe,
+       0x44, 0x55, 0xfe, 0xe5,
+       0x55, 0x03, 0x68, 0x3b, 0x69, 0xfe, 0x00, 0x56, 0xfe, 0xa1, 0x56, 0x10,
+       0x68, 0x22, 0x69, 0x01,
+       0x0c, 0x06, 0x54, 0xf9, 0x21, 0x6e, 0xfe, 0x1f, 0x40, 0x03, 0x6a, 0x3b,
+       0x6b, 0xfe, 0x2c, 0x50,
+       0xfe, 0xae, 0x50, 0x03, 0x6c, 0x3b, 0x6d, 0xfe, 0x44, 0x50, 0xfe, 0xc6,
+       0x50, 0x03, 0x68, 0x3b,
+       0x69, 0xfe, 0x08, 0x50, 0xfe, 0x8a, 0x50, 0x03, 0x4b, 0x3b, 0x4c, 0xfe,
+       0x40, 0x50, 0xfe, 0xc2,
+       0x50, 0x05, 0x73, 0x2e, 0x07, 0x20, 0x9e, 0x05, 0x72, 0x32, 0x01, 0x08,
+       0x16, 0x3d, 0x27, 0x25,
+       0xee, 0x09, 0x07, 0x2b, 0x3d, 0x01, 0x43, 0x09, 0xbb, 0x2b, 0x72, 0x01,
+       0xa6, 0x23, 0x3f, 0x1b,
+       0x3d, 0x01, 0x0c, 0x06, 0x0d, 0xfe, 0x1e, 0x13, 0x91, 0x4b, 0x7e, 0x4c,
+       0xfe, 0x0a, 0x55, 0x31,
+       0xfe, 0x8b, 0x55, 0xd9, 0x4b, 0xda, 0x4c, 0xfe, 0x0c, 0x51, 0xfe, 0x8e,
+       0x51, 0x05, 0x72, 0x01,
+       0xfe, 0x8e, 0x1e, 0xca, 0xfe, 0x19, 0x41, 0x05, 0x72, 0x32, 0x01, 0x08,
+       0x2a, 0x3c, 0x16, 0xc0,
+       0x27, 0x25, 0xbe, 0x2d, 0x1d, 0xc0, 0x2d, 0x0d, 0x83, 0x2d, 0x7f, 0x1b,
+       0xfe, 0x66, 0x15, 0x05,
+       0x3d, 0x01, 0x08, 0x2a, 0x3c, 0x16, 0xc0, 0x27, 0x25, 0xbd, 0x09, 0x1d,
+       0x2b, 0x3d, 0x01, 0x08,
+       0x16, 0xc0, 0x27, 0x25, 0xfe, 0xe8, 0x09, 0xfe, 0xc2, 0x49, 0x50, 0x03,
+       0xb6, 0x1e, 0x83, 0x01,
+       0x38, 0x06, 0x24, 0x31, 0xa1, 0xfe, 0xbb, 0x45, 0x2d, 0x00, 0xa4, 0x46,
+       0x07, 0x90, 0x3f, 0x01,
+       0xfe, 0xf8, 0x15, 0x01, 0xa6, 0x86, 0xfe, 0x4b, 0x45, 0xfe, 0x20, 0x13,
+       0x01, 0x43, 0x09, 0x82,
+       0xfe, 0x16, 0x13, 0x03, 0x9a, 0x1e, 0x5d, 0x03, 0x55, 0x1e, 0x31, 0x5e,
+       0x05, 0x72, 0xfe, 0xc0,
+       0x5d, 0x01, 0xa7, 0xfe, 0x03, 0x17, 0x03, 0x66, 0x8a, 0x10, 0x66, 0x5e,
+       0x32, 0x01, 0x08, 0x17,
+       0x73, 0x01, 0xfe, 0x56, 0x19, 0x05, 0x73, 0x01, 0x08, 0x2a, 0x3c, 0x16,
+       0x3d, 0x27, 0x25, 0xbd,
+       0x09, 0x07, 0x2b, 0x3d, 0x01, 0xfe, 0xbe, 0x16, 0xfe, 0x42, 0x58, 0xfe,
+       0xe8, 0x14, 0x01, 0xa6,
+       0x86, 0xfe, 0x4a, 0xf4, 0x0d, 0x1b, 0x3d, 0xfe, 0x4a, 0xf4, 0x07, 0xfe,
+       0x0e, 0x12, 0x01, 0x43,
+       0x09, 0x82, 0x4e, 0x05, 0x72, 0x03, 0x55, 0x8a, 0x10, 0x55, 0x5e, 0x32,
+       0x01, 0x08, 0x17, 0x73,
+       0x01, 0xfe, 0x84, 0x19, 0x05, 0x73, 0x01, 0x08, 0x2a, 0x3c, 0x16, 0x3d,
+       0x27, 0x25, 0xbd, 0x09,
+       0x12, 0x2b, 0x3d, 0x01, 0xfe, 0xe8, 0x17, 0x8b, 0xfe, 0xaa, 0x14, 0xfe,
+       0xb6, 0x14, 0x86, 0xa8,
+       0xb2, 0x0d, 0x1b, 0x3d, 0xb2, 0x07, 0xfe, 0x0e, 0x12, 0x01, 0x43, 0x09,
+       0x82, 0x4e, 0x05, 0x72,
+       0x03, 0x6f, 0x8a, 0x10, 0x6f, 0x5e, 0x32, 0x01, 0x08, 0x17, 0x73, 0x01,
+       0xfe, 0xc0, 0x19, 0x05,
+       0x73, 0x13, 0x07, 0x2f, 0xfe, 0xcc, 0x15, 0x17, 0xfe, 0xe2, 0x15, 0x5f,
+       0xcc, 0x01, 0x08, 0x26,
+       0x5f, 0x02, 0x8f, 0xfe, 0xde, 0x15, 0x2a, 0xfe, 0xde, 0x15, 0x16, 0xfe,
+       0xcc, 0x15, 0x5e, 0x32,
+       0x01, 0x08, 0xfe, 0xd5, 0x10, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52,
+       0xad, 0x23, 0xfe, 0xff,
+       0x7f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x02, 0x13, 0x58, 0xff, 0x02,
+       0x00, 0x57, 0x52, 0xad,
+       0x23, 0x3f, 0xfe, 0x30, 0x56, 0xfe, 0x00, 0x5c, 0x02, 0x13, 0x58, 0xff,
+       0x02, 0x00, 0x57, 0x52,
+       0xad, 0x02, 0x13, 0x58, 0xff, 0x02, 0x00, 0x57, 0x52, 0xfe, 0x00, 0x5e,
+       0x02, 0x13, 0x58, 0xff,
+       0x02, 0x00, 0x57, 0x52, 0xad, 0xfe, 0x0b, 0x58, 0x02, 0x0a, 0x66, 0x01,
+       0x5c, 0x0a, 0x55, 0x01,
+       0x5c, 0x0a, 0x6f, 0x01, 0x5c, 0x02, 0x01, 0xfe, 0x1e, 0x1f, 0x23, 0x1a,
+       0xff, 0x03, 0x00, 0x54,
+       0xfe, 0x00, 0xf4, 0x24, 0x52, 0x0f, 0xfe, 0x00, 0x7c, 0x04, 0xfe, 0x07,
+       0x7c, 0x3a, 0x0b, 0x0e,
+       0xfe, 0x00, 0x71, 0xfe, 0xf9, 0x18, 0xfe, 0x7a, 0x19, 0xfe, 0xfb, 0x19,
+       0xfe, 0x1a, 0xf7, 0x00,
+       0xfe, 0x1b, 0xf7, 0x00, 0x7a, 0x30, 0x10, 0x68, 0x22, 0x69, 0xd9, 0x6c,
+       0xda, 0x6d, 0x02, 0xfe,
+       0x62, 0x08, 0xfe, 0x82, 0x4a, 0xfe, 0xe1, 0x1a, 0xfe, 0x83, 0x5a, 0x77,
+       0x02, 0x01, 0xc6, 0xfe,
+       0x42, 0x48, 0x4f, 0x50, 0x45, 0x01, 0x08, 0x16, 0xfe, 0xe0, 0x17, 0x27,
+       0x25, 0xbe, 0x01, 0x08,
+       0x16, 0xfe, 0xe0, 0x17, 0x27, 0x25, 0xfe, 0xe8, 0x0a, 0xfe, 0xc1, 0x59,
+       0x03, 0x9a, 0x1e, 0xfe,
+       0xda, 0x12, 0x01, 0x38, 0x06, 0x12, 0xfe, 0xd0, 0x13, 0x26, 0x53, 0x12,
+       0x48, 0xfe, 0x08, 0x17,
+       0xd1, 0x12, 0x53, 0x12, 0xfe, 0x1e, 0x13, 0x2d, 0xb4, 0x7b, 0xfe, 0x26,
+       0x17, 0x4d, 0x13, 0x07,
+       0x1c, 0xb4, 0x90, 0x04, 0xfe, 0x78, 0x10, 0xff, 0x02, 0x83, 0x55, 0xf1,
+       0xff, 0x02, 0x83, 0x55,
+       0x53, 0x1d, 0xfe, 0x12, 0x13, 0xd6, 0xfe, 0x30, 0x00, 0xb0, 0xfe, 0x80,
+       0x17, 0x1c, 0x63, 0x13,
+       0x07, 0xfe, 0x56, 0x10, 0x53, 0x0d, 0xfe, 0x16, 0x13, 0xd6, 0xfe, 0x64,
+       0x00, 0xb0, 0xfe, 0x80,
+       0x17, 0x0a, 0xfe, 0x64, 0x00, 0x1c, 0x94, 0x13, 0x07, 0xfe, 0x28, 0x10,
+       0x53, 0x07, 0xfe, 0x60,
+       0x13, 0xd6, 0xfe, 0xc8, 0x00, 0xb0, 0xfe, 0x80, 0x17, 0x0a, 0xfe, 0xc8,
+       0x00, 0x1c, 0x95, 0x13,
+       0x07, 0x71, 0xd6, 0xfe, 0x90, 0x01, 0x48, 0xfe, 0x8c, 0x17, 0x45, 0xf3,
+       0xfe, 0x43, 0xf4, 0x96,
+       0xfe, 0x56, 0xf0, 0xfe, 0x9e, 0x17, 0xfe, 0x04, 0xf4, 0x58, 0xfe, 0x43,
+       0xf4, 0x94, 0xf6, 0x8b,
+       0x01, 0xfe, 0x24, 0x16, 0x23, 0x3f, 0xfc, 0xa8, 0x8c, 0x49, 0x48, 0xfe,
+       0xda, 0x17, 0x62, 0x49,
+       0xfe, 0x1c, 0x10, 0xa8, 0x8c, 0x80, 0x48, 0xfe, 0xda, 0x17, 0x62, 0x80,
+       0x71, 0x50, 0x26, 0xfe,
+       0x4d, 0xf4, 0x00, 0xf7, 0x45, 0x13, 0x07, 0xfe, 0xb4, 0x56, 0xfe, 0xc3,
+       0x58, 0x02, 0x50, 0x13,
+       0x0d, 0x02, 0x50, 0x3e, 0x78, 0x4f, 0x45, 0x01, 0x08, 0x16, 0xa9, 0x27,
+       0x25, 0xbe, 0xfe, 0x03,
+       0xea, 0xfe, 0x7e, 0x01, 0x01, 0x08, 0x16, 0xa9, 0x27, 0x25, 0xfe, 0xe9,
+       0x0a, 0x01, 0x08, 0x16,
+       0xa9, 0x27, 0x25, 0xfe, 0xe9, 0x0a, 0xfe, 0x05, 0xea, 0xfe, 0x7f, 0x01,
+       0x01, 0x08, 0x16, 0xa9,
+       0x27, 0x25, 0xfe, 0x69, 0x09, 0xfe, 0x02, 0xea, 0xfe, 0x80, 0x01, 0x01,
+       0x08, 0x16, 0xa9, 0x27,
+       0x25, 0xfe, 0xe8, 0x08, 0x47, 0xfe, 0x81, 0x01, 0x03, 0xb6, 0x1e, 0x83,
+       0x01, 0x38, 0x06, 0x24,
+       0x31, 0xa2, 0x78, 0xf2, 0x53, 0x07, 0x36, 0xfe, 0x34, 0xf4, 0x3f, 0xa1,
+       0x78, 0x03, 0x9a, 0x1e,
+       0x83, 0x01, 0x38, 0x06, 0x12, 0x31, 0xf0, 0x4f, 0x45, 0xfe, 0x90, 0x10,
+       0xfe, 0x40, 0x5a, 0x23,
+       0x3f, 0xfb, 0x8c, 0x49, 0x48, 0xfe, 0xaa, 0x18, 0x62, 0x49, 0x71, 0x8c,
+       0x80, 0x48, 0xfe, 0xaa,
+       0x18, 0x62, 0x80, 0xfe, 0xb4, 0x56, 0xfe, 0x40, 0x5d, 0x01, 0xc6, 0x01,
+       0xfe, 0xac, 0x1d, 0xfe,
+       0x02, 0x17, 0xfe, 0xc8, 0x45, 0xfe, 0x5a, 0xf0, 0xfe, 0xc0, 0x18, 0xfe,
+       0x43, 0x48, 0x2d, 0x93,
+       0x36, 0xfe, 0x34, 0xf4, 0xfe, 0x00, 0x11, 0xfe, 0x40, 0x10, 0x2d, 0xb4,
+       0x36, 0xfe, 0x34, 0xf4,
+       0x04, 0xfe, 0x34, 0x10, 0x2d, 0xfe, 0x0b, 0x00, 0x36, 0x46, 0x63, 0xfe,
+       0x28, 0x10, 0xfe, 0xc0,
+       0x49, 0xff, 0x02, 0x00, 0x54, 0xb2, 0xfe, 0x90, 0x01, 0x48, 0xfe, 0xfa,
+       0x18, 0x45, 0xfe, 0x1c,
+       0xf4, 0x3f, 0xf3, 0xfe, 0x40, 0xf4, 0x96, 0xfe, 0x56, 0xf0, 0xfe, 0x0c,
+       0x19, 0xfe, 0x04, 0xf4,
+       0x58, 0xfe, 0x40, 0xf4, 0x94, 0xf6, 0x3e, 0x2d, 0x93, 0x4e, 0xd0, 0x0d,
+       0x21, 0xfe, 0x7f, 0x01,
+       0xfe, 0xc8, 0x46, 0xfe, 0x24, 0x13, 0x8c, 0x00, 0x5d, 0x26, 0x21, 0xfe,
+       0x7e, 0x01, 0xfe, 0xc8,
+       0x45, 0xfe, 0x14, 0x13, 0x21, 0xfe, 0x80, 0x01, 0xfe, 0x48, 0x45, 0xfa,
+       0x21, 0xfe, 0x81, 0x01,
+       0xfe, 0xc8, 0x44, 0x4e, 0x26, 0x02, 0x13, 0x07, 0x02, 0x78, 0x45, 0x50,
+       0x13, 0x0d, 0x02, 0x14,
+       0x07, 0x01, 0x08, 0x17, 0xfe, 0x82, 0x19, 0x14, 0x0d, 0x01, 0x08, 0x17,
+       0xfe, 0x82, 0x19, 0x14,
+       0x1d, 0x01, 0x08, 0x17, 0xfe, 0x82, 0x19, 0x5f, 0xfe, 0x89, 0x49, 0x01,
+       0x08, 0x02, 0x14, 0x07,
+       0x01, 0x08, 0x17, 0xc1, 0x14, 0x1d, 0x01, 0x08, 0x17, 0xc1, 0x14, 0x07,
+       0x01, 0x08, 0x17, 0xc1,
+       0xfe, 0x89, 0x49, 0x01, 0x08, 0x17, 0xc1, 0x5f, 0xfe, 0x89, 0x4a, 0x01,
+       0x08, 0x02, 0x50, 0x02,
+       0x14, 0x07, 0x01, 0x08, 0x17, 0x74, 0x14, 0x7f, 0x01, 0x08, 0x17, 0x74,
+       0x14, 0x12, 0x01, 0x08,
+       0x17, 0x74, 0xfe, 0x89, 0x49, 0x01, 0x08, 0x17, 0x74, 0x14, 0x00, 0x01,
+       0x08, 0x17, 0x74, 0xfe,
+       0x89, 0x4a, 0x01, 0x08, 0x17, 0x74, 0xfe, 0x09, 0x49, 0x01, 0x08, 0x17,
+       0x74, 0x5f, 0xcc, 0x01,
+       0x08, 0x02, 0x21, 0xe4, 0x09, 0x07, 0xfe, 0x4c, 0x13, 0xc8, 0x20, 0xe4,
+       0xfe, 0x49, 0xf4, 0x00,
+       0x4d, 0x5f, 0xa1, 0x5e, 0xfe, 0x01, 0xec, 0xfe, 0x27, 0x01, 0xcc, 0xff,
+       0x02, 0x00, 0x10, 0x2f,
+       0xfe, 0x3e, 0x1a, 0x01, 0x43, 0x09, 0xfe, 0xe3, 0x00, 0xfe, 0x22, 0x13,
+       0x16, 0xfe, 0x64, 0x1a,
+       0x26, 0x20, 0x9e, 0x01, 0x41, 0x21, 0x9e, 0x09, 0x07, 0x5d, 0x01, 0x0c,
+       0x61, 0x07, 0x44, 0x02,
+       0x0a, 0x5a, 0x01, 0x18, 0xfe, 0x00, 0x40, 0xaa, 0x09, 0x1a, 0xfe, 0x12,
+       0x13, 0x0a, 0x9d, 0x01,
+       0x18, 0xaa, 0x0a, 0x67, 0x01, 0xa3, 0x02, 0x0a, 0x9d, 0x01, 0x18, 0xaa,
+       0xfe, 0x80, 0xe7, 0x1a,
+       0x09, 0x1a, 0x5d, 0xfe, 0x45, 0x58, 0x01, 0xfe, 0xb2, 0x16, 0xaa, 0x02,
+       0x0a, 0x5a, 0x01, 0x18,
+       0xaa, 0x0a, 0x67, 0x01, 0xa3, 0x02, 0x0a, 0x5a, 0x01, 0x18, 0x01, 0xfe,
+       0x7e, 0x1e, 0xfe, 0x80,
+       0x4c, 0xfe, 0x49, 0xe4, 0x1a, 0xfe, 0x12, 0x13, 0x0a, 0x9d, 0x01, 0x18,
+       0xfe, 0x80, 0x4c, 0x0a,
+       0x67, 0x01, 0x5c, 0x02, 0x1c, 0x1a, 0x87, 0x7c, 0xe5, 0xfe, 0x18, 0xdf,
+       0xfe, 0x19, 0xde, 0xfe,
+       0x24, 0x1c, 0xfe, 0x1d, 0xf7, 0x28, 0xb1, 0xfe, 0x04, 0x1b, 0x01, 0xfe,
+       0x2a, 0x1c, 0xfa, 0xb3,
+       0x28, 0x7c, 0xfe, 0x2c, 0x01, 0xfe, 0x2f, 0x19, 0x02, 0xc9, 0x2b, 0xfe,
+       0xf4, 0x1a, 0xfe, 0xfa,
+       0x10, 0x1c, 0x1a, 0x87, 0x03, 0xfe, 0x64, 0x01, 0xfe, 0x00, 0xf4, 0x24,
+       0xfe, 0x18, 0x58, 0x03,
+       0xfe, 0x66, 0x01, 0xfe, 0x19, 0x58, 0xb3, 0x24, 0x01, 0xfe, 0x0e, 0x1f,
+       0xfe, 0x30, 0xf4, 0x07,
+       0xfe, 0x3c, 0x50, 0x7c, 0xfe, 0x38, 0x00, 0xfe, 0x0f, 0x79, 0xfe, 0x1c,
+       0xf7, 0x24, 0xb1, 0xfe,
+       0x50, 0x1b, 0xfe, 0xd4, 0x14, 0x31, 0x02, 0xc9, 0x2b, 0xfe, 0x26, 0x1b,
+       0xfe, 0xba, 0x10, 0x1c,
+       0x1a, 0x87, 0xfe, 0x83, 0x5a, 0xfe, 0x18, 0xdf, 0xfe, 0x19, 0xde, 0xfe,
+       0x1d, 0xf7, 0x54, 0xb1,
+       0xfe, 0x72, 0x1b, 0xfe, 0xb2, 0x14, 0xfc, 0xb3, 0x54, 0x7c, 0x12, 0xfe,
+       0xaf, 0x19, 0xfe, 0x98,
+       0xe7, 0x00, 0x02, 0xc9, 0x2b, 0xfe, 0x66, 0x1b, 0xfe, 0x8a, 0x10, 0x1c,
+       0x1a, 0x87, 0x8b, 0x0f,
+       0xfe, 0x30, 0x90, 0x04, 0xfe, 0xb0, 0x93, 0x3a, 0x0b, 0xfe, 0x18, 0x58,
+       0xfe, 0x32, 0x90, 0x04,
+       0xfe, 0xb2, 0x93, 0x3a, 0x0b, 0xfe, 0x19, 0x58, 0x0e, 0xa8, 0xb3, 0x4a,
+       0x7c, 0x12, 0xfe, 0x0f,
+       0x79, 0xfe, 0x1c, 0xf7, 0x4a, 0xb1, 0xfe, 0xc6, 0x1b, 0xfe, 0x5e, 0x14,
+       0x31, 0x02, 0xc9, 0x2b,
+       0xfe, 0x96, 0x1b, 0x5c, 0xfe, 0x02, 0xf6, 0x1a, 0x87, 0xfe, 0x18, 0xfe,
+       0x6a, 0xfe, 0x19, 0xfe,
+       0x6b, 0x01, 0xfe, 0x1e, 0x1f, 0xfe, 0x1d, 0xf7, 0x65, 0xb1, 0xfe, 0xee,
+       0x1b, 0xfe, 0x36, 0x14,
+       0xfe, 0x1c, 0x13, 0xb3, 0x65, 0x3e, 0xfe, 0x83, 0x58, 0xfe, 0xaf, 0x19,
+       0xfe, 0x80, 0xe7, 0x1a,
+       0xfe, 0x81, 0xe7, 0x1a, 0x15, 0xfe, 0xdd, 0x00, 0x7a, 0x30, 0x02, 0x7a,
+       0x30, 0xfe, 0x12, 0x45,
+       0x2b, 0xfe, 0xdc, 0x1b, 0x1f, 0x07, 0x47, 0xb5, 0xc3, 0x05, 0x35, 0xfe,
+       0x39, 0xf0, 0x75, 0x26,
+       0x02, 0xfe, 0x7e, 0x18, 0x23, 0x1d, 0x36, 0x13, 0x11, 0x02, 0x87, 0x03,
+       0xe3, 0x23, 0x07, 0xfe,
+       0xef, 0x12, 0xfe, 0xe1, 0x10, 0x90, 0x34, 0x60, 0xfe, 0x02, 0x80, 0x09,
+       0x56, 0xfe, 0x3c, 0x13,
+       0xfe, 0x82, 0x14, 0xfe, 0x42, 0x13, 0x51, 0xfe, 0x06, 0x83, 0x0a, 0x5a,
+       0x01, 0x18, 0xcb, 0xfe,
+       0x3e, 0x12, 0xfe, 0x41, 0x48, 0xfe, 0x45, 0x48, 0x01, 0xfe, 0xb2, 0x16,
+       0xfe, 0x00, 0xcc, 0xcb,
+       0xfe, 0xf3, 0x13, 0x3f, 0x89, 0x09, 0x1a, 0xa5, 0x0a, 0x9d, 0x01, 0x18,
+       0xfe, 0x80, 0x4c, 0x01,
+       0x85, 0xfe, 0x16, 0x10, 0x09, 0x9b, 0x4e, 0xfe, 0x40, 0x14, 0xfe, 0x24,
+       0x12, 0xfe, 0x14, 0x56,
+       0xfe, 0xd6, 0xf0, 0xfe, 0x52, 0x1c, 0x1c, 0x0d, 0x02, 0xfe, 0x9c, 0xe7,
+       0x0d, 0x19, 0xfe, 0x15,
+       0x00, 0x40, 0x8d, 0x30, 0x01, 0xf4, 0x1c, 0x07, 0x02, 0x51, 0xfe, 0x06,
+       0x83, 0xfe, 0x18, 0x80,
+       0x61, 0x28, 0x44, 0x15, 0x56, 0x01, 0x85, 0x1c, 0x07, 0x02, 0xfe, 0x38,
+       0x90, 0xfe, 0xba, 0x90,
+       0x91, 0xde, 0x7e, 0xdf, 0xfe, 0x48, 0x55, 0x31, 0xfe, 0xc9, 0x55, 0x02,
+       0x21, 0xb9, 0x88, 0x20,
+       0xb9, 0x02, 0x0a, 0xba, 0x01, 0x18, 0xfe, 0x41, 0x48, 0x0a, 0x57, 0x01,
+       0x18, 0xfe, 0x49, 0x44,
+       0x1b, 0xfe, 0x1e, 0x1d, 0x88, 0x89, 0x02, 0x0a, 0x5a, 0x01, 0x18, 0x09,
+       0x1a, 0xa4, 0x0a, 0x67,
+       0x01, 0xa3, 0x0a, 0x57, 0x01, 0x18, 0x88, 0x89, 0x02, 0xfe, 0x4e, 0xe4,
+       0x1d, 0x7b, 0xfe, 0x52,
+       0x1d, 0x03, 0xfe, 0x90, 0x00, 0xfe, 0x3a, 0x45, 0xfe, 0x2c, 0x10, 0xfe,
+       0x4e, 0xe4, 0xdd, 0x7b,
+       0xfe, 0x64, 0x1d, 0x03, 0xfe, 0x92, 0x00, 0xd1, 0x12, 0xfe, 0x1a, 0x10,
+       0xfe, 0x4e, 0xe4, 0xfe,
+       0x0b, 0x00, 0x7b, 0xfe, 0x76, 0x1d, 0x03, 0xfe, 0x94, 0x00, 0xd1, 0x24,
+       0xfe, 0x08, 0x10, 0x03,
+       0xfe, 0x96, 0x00, 0xd1, 0x63, 0xfe, 0x4e, 0x45, 0x83, 0xca, 0xff, 0x04,
+       0x68, 0x54, 0xfe, 0xf1,
+       0x10, 0x23, 0x49, 0xfe, 0x08, 0x1c, 0xfe, 0x67, 0x19, 0xfe, 0x0a, 0x1c,
+       0xfe, 0x1a, 0xf4, 0xfe,
+       0x00, 0x04, 0x83, 0xb2, 0x1d, 0x48, 0xfe, 0xaa, 0x1d, 0x13, 0x1d, 0x02,
+       0x09, 0x92, 0xfe, 0x5a,
+       0xf0, 0xfe, 0xba, 0x1d, 0x2e, 0x93, 0xfe, 0x34, 0x10, 0x09, 0x12, 0xfe,
+       0x5a, 0xf0, 0xfe, 0xc8,
+       0x1d, 0x2e, 0xb4, 0xfe, 0x26, 0x10, 0x09, 0x1d, 0x36, 0x2e, 0x63, 0xfe,
+       0x1a, 0x10, 0x09, 0x0d,
+       0x36, 0x2e, 0x94, 0xf2, 0x09, 0x07, 0x36, 0x2e, 0x95, 0xa1, 0xc8, 0x02,
+       0x1f, 0x93, 0x01, 0x42,
+       0xfe, 0x04, 0xfe, 0x99, 0x03, 0x9c, 0x8b, 0x02, 0x2a, 0xfe, 0x1c, 0x1e,
+       0xfe, 0x14, 0xf0, 0x08,
+       0x2f, 0xfe, 0x0c, 0x1e, 0x2a, 0xfe, 0x1c, 0x1e, 0x8f, 0xfe, 0x1c, 0x1e,
+       0xfe, 0x82, 0xf0, 0xfe,
+       0x10, 0x1e, 0x02, 0x0f, 0x3f, 0x04, 0xfe, 0x80, 0x83, 0x33, 0x0b, 0x0e,
+       0x02, 0x0f, 0xfe, 0x18,
+       0x80, 0x04, 0xfe, 0x98, 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x02,
+       0x80, 0x04, 0xfe, 0x82,
+       0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x06, 0x80, 0x04, 0xfe, 0x86,
+       0x83, 0x33, 0x0b, 0x0e,
+       0x02, 0x0f, 0xfe, 0x1b, 0x80, 0x04, 0xfe, 0x9b, 0x83, 0x33, 0x0b, 0x0e,
+       0x02, 0x0f, 0xfe, 0x04,
+       0x80, 0x04, 0xfe, 0x84, 0x83, 0x33, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x80,
+       0x80, 0x04, 0xfe, 0x80,
+       0x83, 0xfe, 0xc9, 0x47, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x19, 0x81, 0x04,
+       0xfe, 0x99, 0x83, 0xfe,
+       0xca, 0x47, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x06, 0x83, 0x04, 0xfe, 0x86,
+       0x83, 0xfe, 0xce, 0x47,
+       0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x2c, 0x90, 0x04, 0xfe, 0xac, 0x93, 0x3a,
+       0x0b, 0x0e, 0x02, 0x0f,
+       0xfe, 0xae, 0x90, 0x04, 0xfe, 0xae, 0x93, 0x79, 0x0b, 0x0e, 0x02, 0x0f,
+       0xfe, 0x08, 0x90, 0x04,
+       0xfe, 0x88, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x8a, 0x90, 0x04,
+       0xfe, 0x8a, 0x93, 0x79,
+       0x0b, 0x0e, 0x02, 0x0f, 0xfe, 0x0c, 0x90, 0x04, 0xfe, 0x8c, 0x93, 0x3a,
+       0x0b, 0x0e, 0x02, 0x0f,
+       0xfe, 0x8e, 0x90, 0x04, 0xfe, 0x8e, 0x93, 0x79, 0x0b, 0x0e, 0x02, 0x0f,
+       0xfe, 0x3c, 0x90, 0x04,
+       0xfe, 0xbc, 0x93, 0x3a, 0x0b, 0x0e, 0x02, 0x8b, 0x0f, 0xfe, 0x03, 0x80,
+       0x04, 0xfe, 0x83, 0x83,
+       0x33, 0x0b, 0x77, 0x0e, 0xa8, 0x02, 0xff, 0x66, 0x00, 0x00,
 };
 
-STATIC unsigned short _adv_asc38C1600_size =
-        sizeof(_adv_asc38C1600_buf); /* 0x1673 */
-STATIC ADV_DCNT _adv_asc38C1600_chksum =
-        0x0604EF77UL; /* Expanded little-endian checksum. */
+static unsigned short _adv_asc38C1600_size = sizeof(_adv_asc38C1600_buf);      /* 0x1673 */
+static ADV_DCNT _adv_asc38C1600_chksum = 0x0604EF77UL; /* Expanded little-endian checksum. */
 
 /* a_init.c */
 /*
@@ -14049,340 +13847,340 @@ STATIC ADV_DCNT _adv_asc38C1600_chksum =
  * on big-endian platforms so char fields read as words are actually being
  * unswapped on big-endian platforms.
  */
-STATIC ADVEEP_3550_CONFIG
-Default_3550_EEPROM_Config __initdata = {
-    ADV_EEPROM_BIOS_ENABLE,     /* cfg_lsw */
-    0x0000,                     /* cfg_msw */
-    0xFFFF,                     /* disc_enable */
-    0xFFFF,                     /* wdtr_able */
-    0xFFFF,                     /* sdtr_able */
-    0xFFFF,                     /* start_motor */
-    0xFFFF,                     /* tagqng_able */
-    0xFFFF,                     /* bios_scan */
-    0,                          /* scam_tolerant */
-    7,                          /* adapter_scsi_id */
-    0,                          /* bios_boot_delay */
-    3,                          /* scsi_reset_delay */
-    0,                          /* bios_id_lun */
-    0,                          /* termination */
-    0,                          /* reserved1 */
-    0xFFE7,                     /* bios_ctrl */
-    0xFFFF,                     /* ultra_able */
-    0,                          /* reserved2 */
-    ASC_DEF_MAX_HOST_QNG,       /* max_host_qng */
-    ASC_DEF_MAX_DVC_QNG,        /* max_dvc_qng */
-    0,                          /* dvc_cntl */
-    0,                          /* bug_fix */
-    0,                          /* serial_number_word1 */
-    0,                          /* serial_number_word2 */
-    0,                          /* serial_number_word3 */
-    0,                          /* check_sum */
-    { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* oem_name[16] */
-    0,                          /* dvc_err_code */
-    0,                          /* adv_err_code */
-    0,                          /* adv_err_addr */
-    0,                          /* saved_dvc_err_code */
-    0,                          /* saved_adv_err_code */
-    0,                          /* saved_adv_err_addr */
-    0                           /* num_of_err */
+static ADVEEP_3550_CONFIG Default_3550_EEPROM_Config __initdata = {
+       ADV_EEPROM_BIOS_ENABLE, /* cfg_lsw */
+       0x0000,                 /* cfg_msw */
+       0xFFFF,                 /* disc_enable */
+       0xFFFF,                 /* wdtr_able */
+       0xFFFF,                 /* sdtr_able */
+       0xFFFF,                 /* start_motor */
+       0xFFFF,                 /* tagqng_able */
+       0xFFFF,                 /* bios_scan */
+       0,                      /* scam_tolerant */
+       7,                      /* adapter_scsi_id */
+       0,                      /* bios_boot_delay */
+       3,                      /* scsi_reset_delay */
+       0,                      /* bios_id_lun */
+       0,                      /* termination */
+       0,                      /* reserved1 */
+       0xFFE7,                 /* bios_ctrl */
+       0xFFFF,                 /* ultra_able */
+       0,                      /* reserved2 */
+       ASC_DEF_MAX_HOST_QNG,   /* max_host_qng */
+       ASC_DEF_MAX_DVC_QNG,    /* max_dvc_qng */
+       0,                      /* dvc_cntl */
+       0,                      /* bug_fix */
+       0,                      /* serial_number_word1 */
+       0,                      /* serial_number_word2 */
+       0,                      /* serial_number_word3 */
+       0,                      /* check_sum */
+       {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+       ,                       /* oem_name[16] */
+       0,                      /* dvc_err_code */
+       0,                      /* adv_err_code */
+       0,                      /* adv_err_addr */
+       0,                      /* saved_dvc_err_code */
+       0,                      /* saved_adv_err_code */
+       0,                      /* saved_adv_err_addr */
+       0                       /* num_of_err */
 };
 
-STATIC ADVEEP_3550_CONFIG
-ADVEEP_3550_Config_Field_IsChar __initdata = {
-    0,                          /* cfg_lsw */
-    0,                          /* cfg_msw */
-    0,                          /* -disc_enable */
-    0,                          /* wdtr_able */
-    0,                          /* sdtr_able */
-    0,                          /* start_motor */
-    0,                          /* tagqng_able */
-    0,                          /* bios_scan */
-    0,                          /* scam_tolerant */
-    1,                          /* adapter_scsi_id */
-    1,                          /* bios_boot_delay */
-    1,                          /* scsi_reset_delay */
-    1,                          /* bios_id_lun */
-    1,                          /* termination */
-    1,                          /* reserved1 */
-    0,                          /* bios_ctrl */
-    0,                          /* ultra_able */
-    0,                          /* reserved2 */
-    1,                          /* max_host_qng */
-    1,                          /* max_dvc_qng */
-    0,                          /* dvc_cntl */
-    0,                          /* bug_fix */
-    0,                          /* serial_number_word1 */
-    0,                          /* serial_number_word2 */
-    0,                          /* serial_number_word3 */
-    0,                          /* check_sum */
-    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, /* oem_name[16] */
-    0,                          /* dvc_err_code */
-    0,                          /* adv_err_code */
-    0,                          /* adv_err_addr */
-    0,                          /* saved_dvc_err_code */
-    0,                          /* saved_adv_err_code */
-    0,                          /* saved_adv_err_addr */
-    0                           /* num_of_err */
+static ADVEEP_3550_CONFIG ADVEEP_3550_Config_Field_IsChar __initdata = {
+       0,                      /* cfg_lsw */
+       0,                      /* cfg_msw */
+       0,                      /* -disc_enable */
+       0,                      /* wdtr_able */
+       0,                      /* sdtr_able */
+       0,                      /* start_motor */
+       0,                      /* tagqng_able */
+       0,                      /* bios_scan */
+       0,                      /* scam_tolerant */
+       1,                      /* adapter_scsi_id */
+       1,                      /* bios_boot_delay */
+       1,                      /* scsi_reset_delay */
+       1,                      /* bios_id_lun */
+       1,                      /* termination */
+       1,                      /* reserved1 */
+       0,                      /* bios_ctrl */
+       0,                      /* ultra_able */
+       0,                      /* reserved2 */
+       1,                      /* max_host_qng */
+       1,                      /* max_dvc_qng */
+       0,                      /* dvc_cntl */
+       0,                      /* bug_fix */
+       0,                      /* serial_number_word1 */
+       0,                      /* serial_number_word2 */
+       0,                      /* serial_number_word3 */
+       0,                      /* check_sum */
+       {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
+       ,                       /* oem_name[16] */
+       0,                      /* dvc_err_code */
+       0,                      /* adv_err_code */
+       0,                      /* adv_err_addr */
+       0,                      /* saved_dvc_err_code */
+       0,                      /* saved_adv_err_code */
+       0,                      /* saved_adv_err_addr */
+       0                       /* num_of_err */
 };
 
-STATIC ADVEEP_38C0800_CONFIG
-Default_38C0800_EEPROM_Config __initdata = {
-    ADV_EEPROM_BIOS_ENABLE,     /* 00 cfg_lsw */
-    0x0000,                     /* 01 cfg_msw */
-    0xFFFF,                     /* 02 disc_enable */
-    0xFFFF,                     /* 03 wdtr_able */
-    0x4444,                     /* 04 sdtr_speed1 */
-    0xFFFF,                     /* 05 start_motor */
-    0xFFFF,                     /* 06 tagqng_able */
-    0xFFFF,                     /* 07 bios_scan */
-    0,                          /* 08 scam_tolerant */
-    7,                          /* 09 adapter_scsi_id */
-    0,                          /*    bios_boot_delay */
-    3,                          /* 10 scsi_reset_delay */
-    0,                          /*    bios_id_lun */
-    0,                          /* 11 termination_se */
-    0,                          /*    termination_lvd */
-    0xFFE7,                     /* 12 bios_ctrl */
-    0x4444,                     /* 13 sdtr_speed2 */
-    0x4444,                     /* 14 sdtr_speed3 */
-    ASC_DEF_MAX_HOST_QNG,       /* 15 max_host_qng */
-    ASC_DEF_MAX_DVC_QNG,        /*    max_dvc_qng */
-    0,                          /* 16 dvc_cntl */
-    0x4444,                     /* 17 sdtr_speed4 */
-    0,                          /* 18 serial_number_word1 */
-    0,                          /* 19 serial_number_word2 */
-    0,                          /* 20 serial_number_word3 */
-    0,                          /* 21 check_sum */
-    { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* 22-29 oem_name[16] */
-    0,                          /* 30 dvc_err_code */
-    0,                          /* 31 adv_err_code */
-    0,                          /* 32 adv_err_addr */
-    0,                          /* 33 saved_dvc_err_code */
-    0,                          /* 34 saved_adv_err_code */
-    0,                          /* 35 saved_adv_err_addr */
-    0,                          /* 36 reserved */
-    0,                          /* 37 reserved */
-    0,                          /* 38 reserved */
-    0,                          /* 39 reserved */
-    0,                          /* 40 reserved */
-    0,                          /* 41 reserved */
-    0,                          /* 42 reserved */
-    0,                          /* 43 reserved */
-    0,                          /* 44 reserved */
-    0,                          /* 45 reserved */
-    0,                          /* 46 reserved */
-    0,                          /* 47 reserved */
-    0,                          /* 48 reserved */
-    0,                          /* 49 reserved */
-    0,                          /* 50 reserved */
-    0,                          /* 51 reserved */
-    0,                          /* 52 reserved */
-    0,                          /* 53 reserved */
-    0,                          /* 54 reserved */
-    0,                          /* 55 reserved */
-    0,                          /* 56 cisptr_lsw */
-    0,                          /* 57 cisprt_msw */
-    PCI_VENDOR_ID_ASP,          /* 58 subsysvid */
-    PCI_DEVICE_ID_38C0800_REV1, /* 59 subsysid */
-    0,                          /* 60 reserved */
-    0,                          /* 61 reserved */
-    0,                          /* 62 reserved */
-    0                           /* 63 reserved */
+static ADVEEP_38C0800_CONFIG Default_38C0800_EEPROM_Config __initdata = {
+       ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
+       0x0000,                 /* 01 cfg_msw */
+       0xFFFF,                 /* 02 disc_enable */
+       0xFFFF,                 /* 03 wdtr_able */
+       0x4444,                 /* 04 sdtr_speed1 */
+       0xFFFF,                 /* 05 start_motor */
+       0xFFFF,                 /* 06 tagqng_able */
+       0xFFFF,                 /* 07 bios_scan */
+       0,                      /* 08 scam_tolerant */
+       7,                      /* 09 adapter_scsi_id */
+       0,                      /*    bios_boot_delay */
+       3,                      /* 10 scsi_reset_delay */
+       0,                      /*    bios_id_lun */
+       0,                      /* 11 termination_se */
+       0,                      /*    termination_lvd */
+       0xFFE7,                 /* 12 bios_ctrl */
+       0x4444,                 /* 13 sdtr_speed2 */
+       0x4444,                 /* 14 sdtr_speed3 */
+       ASC_DEF_MAX_HOST_QNG,   /* 15 max_host_qng */
+       ASC_DEF_MAX_DVC_QNG,    /*    max_dvc_qng */
+       0,                      /* 16 dvc_cntl */
+       0x4444,                 /* 17 sdtr_speed4 */
+       0,                      /* 18 serial_number_word1 */
+       0,                      /* 19 serial_number_word2 */
+       0,                      /* 20 serial_number_word3 */
+       0,                      /* 21 check_sum */
+       {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+       ,                       /* 22-29 oem_name[16] */
+       0,                      /* 30 dvc_err_code */
+       0,                      /* 31 adv_err_code */
+       0,                      /* 32 adv_err_addr */
+       0,                      /* 33 saved_dvc_err_code */
+       0,                      /* 34 saved_adv_err_code */
+       0,                      /* 35 saved_adv_err_addr */
+       0,                      /* 36 reserved */
+       0,                      /* 37 reserved */
+       0,                      /* 38 reserved */
+       0,                      /* 39 reserved */
+       0,                      /* 40 reserved */
+       0,                      /* 41 reserved */
+       0,                      /* 42 reserved */
+       0,                      /* 43 reserved */
+       0,                      /* 44 reserved */
+       0,                      /* 45 reserved */
+       0,                      /* 46 reserved */
+       0,                      /* 47 reserved */
+       0,                      /* 48 reserved */
+       0,                      /* 49 reserved */
+       0,                      /* 50 reserved */
+       0,                      /* 51 reserved */
+       0,                      /* 52 reserved */
+       0,                      /* 53 reserved */
+       0,                      /* 54 reserved */
+       0,                      /* 55 reserved */
+       0,                      /* 56 cisptr_lsw */
+       0,                      /* 57 cisprt_msw */
+       PCI_VENDOR_ID_ASP,      /* 58 subsysvid */
+       PCI_DEVICE_ID_38C0800_REV1,     /* 59 subsysid */
+       0,                      /* 60 reserved */
+       0,                      /* 61 reserved */
+       0,                      /* 62 reserved */
+       0                       /* 63 reserved */
 };
 
-STATIC ADVEEP_38C0800_CONFIG
-ADVEEP_38C0800_Config_Field_IsChar __initdata = {
-    0,                          /* 00 cfg_lsw */
-    0,                          /* 01 cfg_msw */
-    0,                          /* 02 disc_enable */
-    0,                          /* 03 wdtr_able */
-    0,                          /* 04 sdtr_speed1 */
-    0,                          /* 05 start_motor */
-    0,                          /* 06 tagqng_able */
-    0,                          /* 07 bios_scan */
-    0,                          /* 08 scam_tolerant */
-    1,                          /* 09 adapter_scsi_id */
-    1,                          /*    bios_boot_delay */
-    1,                          /* 10 scsi_reset_delay */
-    1,                          /*    bios_id_lun */
-    1,                          /* 11 termination_se */
-    1,                          /*    termination_lvd */
-    0,                          /* 12 bios_ctrl */
-    0,                          /* 13 sdtr_speed2 */
-    0,                          /* 14 sdtr_speed3 */
-    1,                          /* 15 max_host_qng */
-    1,                          /*    max_dvc_qng */
-    0,                          /* 16 dvc_cntl */
-    0,                          /* 17 sdtr_speed4 */
-    0,                          /* 18 serial_number_word1 */
-    0,                          /* 19 serial_number_word2 */
-    0,                          /* 20 serial_number_word3 */
-    0,                          /* 21 check_sum */
-    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, /* 22-29 oem_name[16] */
-    0,                          /* 30 dvc_err_code */
-    0,                          /* 31 adv_err_code */
-    0,                          /* 32 adv_err_addr */
-    0,                          /* 33 saved_dvc_err_code */
-    0,                          /* 34 saved_adv_err_code */
-    0,                          /* 35 saved_adv_err_addr */
-    0,                          /* 36 reserved */
-    0,                          /* 37 reserved */
-    0,                          /* 38 reserved */
-    0,                          /* 39 reserved */
-    0,                          /* 40 reserved */
-    0,                          /* 41 reserved */
-    0,                          /* 42 reserved */
-    0,                          /* 43 reserved */
-    0,                          /* 44 reserved */
-    0,                          /* 45 reserved */
-    0,                          /* 46 reserved */
-    0,                          /* 47 reserved */
-    0,                          /* 48 reserved */
-    0,                          /* 49 reserved */
-    0,                          /* 50 reserved */
-    0,                          /* 51 reserved */
-    0,                          /* 52 reserved */
-    0,                          /* 53 reserved */
-    0,                          /* 54 reserved */
-    0,                          /* 55 reserved */
-    0,                          /* 56 cisptr_lsw */
-    0,                          /* 57 cisprt_msw */
-    0,                          /* 58 subsysvid */
-    0,                          /* 59 subsysid */
-    0,                          /* 60 reserved */
-    0,                          /* 61 reserved */
-    0,                          /* 62 reserved */
-    0                           /* 63 reserved */
+static ADVEEP_38C0800_CONFIG ADVEEP_38C0800_Config_Field_IsChar __initdata = {
+       0,                      /* 00 cfg_lsw */
+       0,                      /* 01 cfg_msw */
+       0,                      /* 02 disc_enable */
+       0,                      /* 03 wdtr_able */
+       0,                      /* 04 sdtr_speed1 */
+       0,                      /* 05 start_motor */
+       0,                      /* 06 tagqng_able */
+       0,                      /* 07 bios_scan */
+       0,                      /* 08 scam_tolerant */
+       1,                      /* 09 adapter_scsi_id */
+       1,                      /*    bios_boot_delay */
+       1,                      /* 10 scsi_reset_delay */
+       1,                      /*    bios_id_lun */
+       1,                      /* 11 termination_se */
+       1,                      /*    termination_lvd */
+       0,                      /* 12 bios_ctrl */
+       0,                      /* 13 sdtr_speed2 */
+       0,                      /* 14 sdtr_speed3 */
+       1,                      /* 15 max_host_qng */
+       1,                      /*    max_dvc_qng */
+       0,                      /* 16 dvc_cntl */
+       0,                      /* 17 sdtr_speed4 */
+       0,                      /* 18 serial_number_word1 */
+       0,                      /* 19 serial_number_word2 */
+       0,                      /* 20 serial_number_word3 */
+       0,                      /* 21 check_sum */
+       {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
+       ,                       /* 22-29 oem_name[16] */
+       0,                      /* 30 dvc_err_code */
+       0,                      /* 31 adv_err_code */
+       0,                      /* 32 adv_err_addr */
+       0,                      /* 33 saved_dvc_err_code */
+       0,                      /* 34 saved_adv_err_code */
+       0,                      /* 35 saved_adv_err_addr */
+       0,                      /* 36 reserved */
+       0,                      /* 37 reserved */
+       0,                      /* 38 reserved */
+       0,                      /* 39 reserved */
+       0,                      /* 40 reserved */
+       0,                      /* 41 reserved */
+       0,                      /* 42 reserved */
+       0,                      /* 43 reserved */
+       0,                      /* 44 reserved */
+       0,                      /* 45 reserved */
+       0,                      /* 46 reserved */
+       0,                      /* 47 reserved */
+       0,                      /* 48 reserved */
+       0,                      /* 49 reserved */
+       0,                      /* 50 reserved */
+       0,                      /* 51 reserved */
+       0,                      /* 52 reserved */
+       0,                      /* 53 reserved */
+       0,                      /* 54 reserved */
+       0,                      /* 55 reserved */
+       0,                      /* 56 cisptr_lsw */
+       0,                      /* 57 cisprt_msw */
+       0,                      /* 58 subsysvid */
+       0,                      /* 59 subsysid */
+       0,                      /* 60 reserved */
+       0,                      /* 61 reserved */
+       0,                      /* 62 reserved */
+       0                       /* 63 reserved */
 };
 
-STATIC ADVEEP_38C1600_CONFIG
-Default_38C1600_EEPROM_Config __initdata = {
-    ADV_EEPROM_BIOS_ENABLE,     /* 00 cfg_lsw */
-    0x0000,                     /* 01 cfg_msw */
-    0xFFFF,                     /* 02 disc_enable */
-    0xFFFF,                     /* 03 wdtr_able */
-    0x5555,                     /* 04 sdtr_speed1 */
-    0xFFFF,                     /* 05 start_motor */
-    0xFFFF,                     /* 06 tagqng_able */
-    0xFFFF,                     /* 07 bios_scan */
-    0,                          /* 08 scam_tolerant */
-    7,                          /* 09 adapter_scsi_id */
-    0,                          /*    bios_boot_delay */
-    3,                          /* 10 scsi_reset_delay */
-    0,                          /*    bios_id_lun */
-    0,                          /* 11 termination_se */
-    0,                          /*    termination_lvd */
-    0xFFE7,                     /* 12 bios_ctrl */
-    0x5555,                     /* 13 sdtr_speed2 */
-    0x5555,                     /* 14 sdtr_speed3 */
-    ASC_DEF_MAX_HOST_QNG,       /* 15 max_host_qng */
-    ASC_DEF_MAX_DVC_QNG,        /*    max_dvc_qng */
-    0,                          /* 16 dvc_cntl */
-    0x5555,                     /* 17 sdtr_speed4 */
-    0,                          /* 18 serial_number_word1 */
-    0,                          /* 19 serial_number_word2 */
-    0,                          /* 20 serial_number_word3 */
-    0,                          /* 21 check_sum */
-    { 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 }, /* 22-29 oem_name[16] */
-    0,                          /* 30 dvc_err_code */
-    0,                          /* 31 adv_err_code */
-    0,                          /* 32 adv_err_addr */
-    0,                          /* 33 saved_dvc_err_code */
-    0,                          /* 34 saved_adv_err_code */
-    0,                          /* 35 saved_adv_err_addr */
-    0,                          /* 36 reserved */
-    0,                          /* 37 reserved */
-    0,                          /* 38 reserved */
-    0,                          /* 39 reserved */
-    0,                          /* 40 reserved */
-    0,                          /* 41 reserved */
-    0,                          /* 42 reserved */
-    0,                          /* 43 reserved */
-    0,                          /* 44 reserved */
-    0,                          /* 45 reserved */
-    0,                          /* 46 reserved */
-    0,                          /* 47 reserved */
-    0,                          /* 48 reserved */
-    0,                          /* 49 reserved */
-    0,                          /* 50 reserved */
-    0,                          /* 51 reserved */
-    0,                          /* 52 reserved */
-    0,                          /* 53 reserved */
-    0,                          /* 54 reserved */
-    0,                          /* 55 reserved */
-    0,                          /* 56 cisptr_lsw */
-    0,                          /* 57 cisprt_msw */
-    PCI_VENDOR_ID_ASP,          /* 58 subsysvid */
-    PCI_DEVICE_ID_38C1600_REV1, /* 59 subsysid */
-    0,                          /* 60 reserved */
-    0,                          /* 61 reserved */
-    0,                          /* 62 reserved */
-    0                           /* 63 reserved */
+static ADVEEP_38C1600_CONFIG Default_38C1600_EEPROM_Config __initdata = {
+       ADV_EEPROM_BIOS_ENABLE, /* 00 cfg_lsw */
+       0x0000,                 /* 01 cfg_msw */
+       0xFFFF,                 /* 02 disc_enable */
+       0xFFFF,                 /* 03 wdtr_able */
+       0x5555,                 /* 04 sdtr_speed1 */
+       0xFFFF,                 /* 05 start_motor */
+       0xFFFF,                 /* 06 tagqng_able */
+       0xFFFF,                 /* 07 bios_scan */
+       0,                      /* 08 scam_tolerant */
+       7,                      /* 09 adapter_scsi_id */
+       0,                      /*    bios_boot_delay */
+       3,                      /* 10 scsi_reset_delay */
+       0,                      /*    bios_id_lun */
+       0,                      /* 11 termination_se */
+       0,                      /*    termination_lvd */
+       0xFFE7,                 /* 12 bios_ctrl */
+       0x5555,                 /* 13 sdtr_speed2 */
+       0x5555,                 /* 14 sdtr_speed3 */
+       ASC_DEF_MAX_HOST_QNG,   /* 15 max_host_qng */
+       ASC_DEF_MAX_DVC_QNG,    /*    max_dvc_qng */
+       0,                      /* 16 dvc_cntl */
+       0x5555,                 /* 17 sdtr_speed4 */
+       0,                      /* 18 serial_number_word1 */
+       0,                      /* 19 serial_number_word2 */
+       0,                      /* 20 serial_number_word3 */
+       0,                      /* 21 check_sum */
+       {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}
+       ,                       /* 22-29 oem_name[16] */
+       0,                      /* 30 dvc_err_code */
+       0,                      /* 31 adv_err_code */
+       0,                      /* 32 adv_err_addr */
+       0,                      /* 33 saved_dvc_err_code */
+       0,                      /* 34 saved_adv_err_code */
+       0,                      /* 35 saved_adv_err_addr */
+       0,                      /* 36 reserved */
+       0,                      /* 37 reserved */
+       0,                      /* 38 reserved */
+       0,                      /* 39 reserved */
+       0,                      /* 40 reserved */
+       0,                      /* 41 reserved */
+       0,                      /* 42 reserved */
+       0,                      /* 43 reserved */
+       0,                      /* 44 reserved */
+       0,                      /* 45 reserved */
+       0,                      /* 46 reserved */
+       0,                      /* 47 reserved */
+       0,                      /* 48 reserved */
+       0,                      /* 49 reserved */
+       0,                      /* 50 reserved */
+       0,                      /* 51 reserved */
+       0,                      /* 52 reserved */
+       0,                      /* 53 reserved */
+       0,                      /* 54 reserved */
+       0,                      /* 55 reserved */
+       0,                      /* 56 cisptr_lsw */
+       0,                      /* 57 cisprt_msw */
+       PCI_VENDOR_ID_ASP,      /* 58 subsysvid */
+       PCI_DEVICE_ID_38C1600_REV1,     /* 59 subsysid */
+       0,                      /* 60 reserved */
+       0,                      /* 61 reserved */
+       0,                      /* 62 reserved */
+       0                       /* 63 reserved */
 };
 
-STATIC ADVEEP_38C1600_CONFIG
-ADVEEP_38C1600_Config_Field_IsChar __initdata = {
-    0,                          /* 00 cfg_lsw */
-    0,                          /* 01 cfg_msw */
-    0,                          /* 02 disc_enable */
-    0,                          /* 03 wdtr_able */
-    0,                          /* 04 sdtr_speed1 */
-    0,                          /* 05 start_motor */
-    0,                          /* 06 tagqng_able */
-    0,                          /* 07 bios_scan */
-    0,                          /* 08 scam_tolerant */
-    1,                          /* 09 adapter_scsi_id */
-    1,                          /*    bios_boot_delay */
-    1,                          /* 10 scsi_reset_delay */
-    1,                          /*    bios_id_lun */
-    1,                          /* 11 termination_se */
-    1,                          /*    termination_lvd */
-    0,                          /* 12 bios_ctrl */
-    0,                          /* 13 sdtr_speed2 */
-    0,                          /* 14 sdtr_speed3 */
-    1,                          /* 15 max_host_qng */
-    1,                          /*    max_dvc_qng */
-    0,                          /* 16 dvc_cntl */
-    0,                          /* 17 sdtr_speed4 */
-    0,                          /* 18 serial_number_word1 */
-    0,                          /* 19 serial_number_word2 */
-    0,                          /* 20 serial_number_word3 */
-    0,                          /* 21 check_sum */
-    { 1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1 }, /* 22-29 oem_name[16] */
-    0,                          /* 30 dvc_err_code */
-    0,                          /* 31 adv_err_code */
-    0,                          /* 32 adv_err_addr */
-    0,                          /* 33 saved_dvc_err_code */
-    0,                          /* 34 saved_adv_err_code */
-    0,                          /* 35 saved_adv_err_addr */
-    0,                          /* 36 reserved */
-    0,                          /* 37 reserved */
-    0,                          /* 38 reserved */
-    0,                          /* 39 reserved */
-    0,                          /* 40 reserved */
-    0,                          /* 41 reserved */
-    0,                          /* 42 reserved */
-    0,                          /* 43 reserved */
-    0,                          /* 44 reserved */
-    0,                          /* 45 reserved */
-    0,                          /* 46 reserved */
-    0,                          /* 47 reserved */
-    0,                          /* 48 reserved */
-    0,                          /* 49 reserved */
-    0,                          /* 50 reserved */
-    0,                          /* 51 reserved */
-    0,                          /* 52 reserved */
-    0,                          /* 53 reserved */
-    0,                          /* 54 reserved */
-    0,                          /* 55 reserved */
-    0,                          /* 56 cisptr_lsw */
-    0,                          /* 57 cisprt_msw */
-    0,                          /* 58 subsysvid */
-    0,                          /* 59 subsysid */
-    0,                          /* 60 reserved */
-    0,                          /* 61 reserved */
-    0,                          /* 62 reserved */
-    0                           /* 63 reserved */
+static ADVEEP_38C1600_CONFIG ADVEEP_38C1600_Config_Field_IsChar __initdata = {
+       0,                      /* 00 cfg_lsw */
+       0,                      /* 01 cfg_msw */
+       0,                      /* 02 disc_enable */
+       0,                      /* 03 wdtr_able */
+       0,                      /* 04 sdtr_speed1 */
+       0,                      /* 05 start_motor */
+       0,                      /* 06 tagqng_able */
+       0,                      /* 07 bios_scan */
+       0,                      /* 08 scam_tolerant */
+       1,                      /* 09 adapter_scsi_id */
+       1,                      /*    bios_boot_delay */
+       1,                      /* 10 scsi_reset_delay */
+       1,                      /*    bios_id_lun */
+       1,                      /* 11 termination_se */
+       1,                      /*    termination_lvd */
+       0,                      /* 12 bios_ctrl */
+       0,                      /* 13 sdtr_speed2 */
+       0,                      /* 14 sdtr_speed3 */
+       1,                      /* 15 max_host_qng */
+       1,                      /*    max_dvc_qng */
+       0,                      /* 16 dvc_cntl */
+       0,                      /* 17 sdtr_speed4 */
+       0,                      /* 18 serial_number_word1 */
+       0,                      /* 19 serial_number_word2 */
+       0,                      /* 20 serial_number_word3 */
+       0,                      /* 21 check_sum */
+       {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1}
+       ,                       /* 22-29 oem_name[16] */
+       0,                      /* 30 dvc_err_code */
+       0,                      /* 31 adv_err_code */
+       0,                      /* 32 adv_err_addr */
+       0,                      /* 33 saved_dvc_err_code */
+       0,                      /* 34 saved_adv_err_code */
+       0,                      /* 35 saved_adv_err_addr */
+       0,                      /* 36 reserved */
+       0,                      /* 37 reserved */
+       0,                      /* 38 reserved */
+       0,                      /* 39 reserved */
+       0,                      /* 40 reserved */
+       0,                      /* 41 reserved */
+       0,                      /* 42 reserved */
+       0,                      /* 43 reserved */
+       0,                      /* 44 reserved */
+       0,                      /* 45 reserved */
+       0,                      /* 46 reserved */
+       0,                      /* 47 reserved */
+       0,                      /* 48 reserved */
+       0,                      /* 49 reserved */
+       0,                      /* 50 reserved */
+       0,                      /* 51 reserved */
+       0,                      /* 52 reserved */
+       0,                      /* 53 reserved */
+       0,                      /* 54 reserved */
+       0,                      /* 55 reserved */
+       0,                      /* 56 cisptr_lsw */
+       0,                      /* 57 cisprt_msw */
+       0,                      /* 58 subsysvid */
+       0,                      /* 59 subsysid */
+       0,                      /* 60 reserved */
+       0,                      /* 61 reserved */
+       0,                      /* 62 reserved */
+       0                       /* 63 reserved */
 };
 
 /*
@@ -14393,136 +14191,128 @@ ADVEEP_38C1600_Config_Field_IsChar __initdata = {
  * For a non-fatal error return a warning code. If there are no warnings
  * then 0 is returned.
  */
-STATIC int __init
-AdvInitGetConfig(ADV_DVC_VAR *asc_dvc)
+static int __init AdvInitGetConfig(ADV_DVC_VAR *asc_dvc)
 {
-    ushort      warn_code;
-    AdvPortAddr iop_base;
-    uchar       pci_cmd_reg;
-    int         status;
-
-    warn_code = 0;
-    asc_dvc->err_code = 0;
-    iop_base = asc_dvc->iop_base;
-
-    /*
-     * PCI Command Register
-     *
-     * Note: AscPCICmdRegBits_BusMastering definition (0x0007) includes
-     * I/O Space Control, Memory Space Control and Bus Master Control bits.
-     */
-
-    if (((pci_cmd_reg = DvcAdvReadPCIConfigByte(asc_dvc,
-                            AscPCIConfigCommandRegister))
-         & AscPCICmdRegBits_BusMastering)
-        != AscPCICmdRegBits_BusMastering)
-    {
-        pci_cmd_reg |= AscPCICmdRegBits_BusMastering;
-
-        DvcAdvWritePCIConfigByte(asc_dvc,
-                AscPCIConfigCommandRegister, pci_cmd_reg);
-
-        if (((DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigCommandRegister))
-             & AscPCICmdRegBits_BusMastering)
-            != AscPCICmdRegBits_BusMastering)
-        {
-            warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
-        }
-    }
-
-    /*
-     * PCI Latency Timer
-     *
-     * If the "latency timer" register is 0x20 or above, then we don't need
-     * to change it.  Otherwise, set it to 0x20 (i.e. set it to 0x20 if it
-     * comes up less than 0x20).
-     */
-    if (DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer) < 0x20) {
-        DvcAdvWritePCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer, 0x20);
-        if (DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer) < 0x20)
-        {
-            warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
-        }
-    }
-
-    /*
-     * Save the state of the PCI Configuration Command Register
-     * "Parity Error Response Control" Bit. If the bit is clear (0),
-     * in AdvInitAsc3550/38C0800Driver() tell the microcode to ignore
-     * DMA parity errors.
-     */
-    asc_dvc->cfg->control_flag = 0;
-    if (((DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigCommandRegister)
-         & AscPCICmdRegBits_ParErrRespCtrl)) == 0)
-    {
-        asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR;
-    }
+       ushort warn_code;
+       AdvPortAddr iop_base;
+       uchar pci_cmd_reg;
+       int status;
+
+       warn_code = 0;
+       asc_dvc->err_code = 0;
+       iop_base = asc_dvc->iop_base;
+
+       /*
+        * PCI Command Register
+        *
+        * Note: AscPCICmdRegBits_BusMastering definition (0x0007) includes
+        * I/O Space Control, Memory Space Control and Bus Master Control bits.
+        */
+
+       if (((pci_cmd_reg = DvcAdvReadPCIConfigByte(asc_dvc,
+                                                   AscPCIConfigCommandRegister))
+            & AscPCICmdRegBits_BusMastering)
+           != AscPCICmdRegBits_BusMastering) {
+               pci_cmd_reg |= AscPCICmdRegBits_BusMastering;
+
+               DvcAdvWritePCIConfigByte(asc_dvc,
+                                        AscPCIConfigCommandRegister,
+                                        pci_cmd_reg);
+
+               if (((DvcAdvReadPCIConfigByte
+                     (asc_dvc, AscPCIConfigCommandRegister))
+                    & AscPCICmdRegBits_BusMastering)
+                   != AscPCICmdRegBits_BusMastering) {
+                       warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
+               }
+       }
 
-    asc_dvc->cfg->lib_version = (ADV_LIB_VERSION_MAJOR << 8) |
-      ADV_LIB_VERSION_MINOR;
-    asc_dvc->cfg->chip_version =
-      AdvGetChipVersion(iop_base, asc_dvc->bus_type);
+       /*
+        * PCI Latency Timer
+        *
+        * If the "latency timer" register is 0x20 or above, then we don't need
+        * to change it.  Otherwise, set it to 0x20 (i.e. set it to 0x20 if it
+        * comes up less than 0x20).
+        */
+       if (DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer) < 0x20) {
+               DvcAdvWritePCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer,
+                                        0x20);
+               if (DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigLatencyTimer) <
+                   0x20) {
+                       warn_code |= ASC_WARN_SET_PCI_CONFIG_SPACE;
+               }
+       }
 
-    ASC_DBG2(1, "AdvInitGetConfig: iopb_chip_id_1: 0x%x 0x%x\n",
-        (ushort) AdvReadByteRegister(iop_base, IOPB_CHIP_ID_1),
-        (ushort) ADV_CHIP_ID_BYTE);
+       /*
+        * Save the state of the PCI Configuration Command Register
+        * "Parity Error Response Control" Bit. If the bit is clear (0),
+        * in AdvInitAsc3550/38C0800Driver() tell the microcode to ignore
+        * DMA parity errors.
+        */
+       asc_dvc->cfg->control_flag = 0;
+       if (((DvcAdvReadPCIConfigByte(asc_dvc, AscPCIConfigCommandRegister)
+             & AscPCICmdRegBits_ParErrRespCtrl)) == 0) {
+               asc_dvc->cfg->control_flag |= CONTROL_FLAG_IGNORE_PERR;
+       }
 
-    ASC_DBG2(1, "AdvInitGetConfig: iopw_chip_id_0: 0x%x 0x%x\n",
-        (ushort) AdvReadWordRegister(iop_base, IOPW_CHIP_ID_0),
-        (ushort) ADV_CHIP_ID_WORD);
+       asc_dvc->cfg->lib_version = (ADV_LIB_VERSION_MAJOR << 8) |
+           ADV_LIB_VERSION_MINOR;
+       asc_dvc->cfg->chip_version =
+           AdvGetChipVersion(iop_base, asc_dvc->bus_type);
+
+       ASC_DBG2(1, "AdvInitGetConfig: iopb_chip_id_1: 0x%x 0x%x\n",
+                (ushort)AdvReadByteRegister(iop_base, IOPB_CHIP_ID_1),
+                (ushort)ADV_CHIP_ID_BYTE);
+
+       ASC_DBG2(1, "AdvInitGetConfig: iopw_chip_id_0: 0x%x 0x%x\n",
+                (ushort)AdvReadWordRegister(iop_base, IOPW_CHIP_ID_0),
+                (ushort)ADV_CHIP_ID_WORD);
+
+       /*
+        * Reset the chip to start and allow register writes.
+        */
+       if (AdvFindSignature(iop_base) == 0) {
+               asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
+               return ADV_ERROR;
+       } else {
+               /*
+                * The caller must set 'chip_type' to a valid setting.
+                */
+               if (asc_dvc->chip_type != ADV_CHIP_ASC3550 &&
+                   asc_dvc->chip_type != ADV_CHIP_ASC38C0800 &&
+                   asc_dvc->chip_type != ADV_CHIP_ASC38C1600) {
+                       asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE;
+                       return ADV_ERROR;
+               }
 
-    /*
-     * Reset the chip to start and allow register writes.
-     */
-    if (AdvFindSignature(iop_base) == 0)
-    {
-        asc_dvc->err_code = ASC_IERR_BAD_SIGNATURE;
-        return ADV_ERROR;
-    }
-    else {
-        /*
-         * The caller must set 'chip_type' to a valid setting.
-         */
-        if (asc_dvc->chip_type != ADV_CHIP_ASC3550 &&
-            asc_dvc->chip_type != ADV_CHIP_ASC38C0800 &&
-            asc_dvc->chip_type != ADV_CHIP_ASC38C1600)
-        {
-            asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE;
-            return ADV_ERROR;
-        }
-
-        /*
-         * Reset Chip.
-         */
-        AdvWriteWordRegister(iop_base, IOPW_CTRL_REG,
-            ADV_CTRL_REG_CMD_RESET);
-        DvcSleepMilliSecond(100);
-        AdvWriteWordRegister(iop_base, IOPW_CTRL_REG,
-            ADV_CTRL_REG_CMD_WR_IO_REG);
-
-        if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600)
-        {
-            if ((status = AdvInitFrom38C1600EEP(asc_dvc)) == ADV_ERROR)
-            {
-                return ADV_ERROR;
-            }
-        } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800)
-        {
-            if ((status = AdvInitFrom38C0800EEP(asc_dvc)) == ADV_ERROR)
-            {
-                return ADV_ERROR;
-            }
-        } else
-        {
-            if ((status = AdvInitFrom3550EEP(asc_dvc)) == ADV_ERROR)
-            {
-                return ADV_ERROR;
-            }
-        }
-        warn_code |= status;
-    }
+               /*
+                * Reset Chip.
+                */
+               AdvWriteWordRegister(iop_base, IOPW_CTRL_REG,
+                                    ADV_CTRL_REG_CMD_RESET);
+               DvcSleepMilliSecond(100);
+               AdvWriteWordRegister(iop_base, IOPW_CTRL_REG,
+                                    ADV_CTRL_REG_CMD_WR_IO_REG);
+
+               if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
+                       if ((status =
+                            AdvInitFrom38C1600EEP(asc_dvc)) == ADV_ERROR) {
+                               return ADV_ERROR;
+                       }
+               } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
+                       if ((status =
+                            AdvInitFrom38C0800EEP(asc_dvc)) == ADV_ERROR) {
+                               return ADV_ERROR;
+                       }
+               } else {
+                       if ((status = AdvInitFrom3550EEP(asc_dvc)) == ADV_ERROR) {
+                               return ADV_ERROR;
+                       }
+               }
+               warn_code |= status;
+       }
 
-    return warn_code;
+       return warn_code;
 }
 
 /*
@@ -14535,2513 +14325,2407 @@ AdvInitGetConfig(ADV_DVC_VAR *asc_dvc)
  *
  * Needed after initialization for error recovery.
  */
-STATIC int
-AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc)
+static int AdvInitAsc3550Driver(ADV_DVC_VAR *asc_dvc)
 {
-    AdvPortAddr iop_base;
-    ushort      warn_code;
-    ADV_DCNT    sum;
-    int         begin_addr;
-    int         end_addr;
-    ushort      code_sum;
-    int         word;
-    int         j;
-    int         adv_asc3550_expanded_size;
-    ADV_CARR_T  *carrp;
-    ADV_DCNT    contig_len;
-    ADV_SDCNT   buf_size;
-    ADV_PADDR   carr_paddr;
-    int         i;
-    ushort      scsi_cfg1;
-    uchar       tid;
-    ushort      bios_mem[ASC_MC_BIOSLEN/2]; /* BIOS RISC Memory 0x40-0x8F. */
-    ushort      wdtr_able = 0, sdtr_able, tagqng_able;
-    uchar       max_cmd[ADV_MAX_TID + 1];
-
-    /* If there is already an error, don't continue. */
-    if (asc_dvc->err_code != 0)
-    {
-        return ADV_ERROR;
-    }
+       AdvPortAddr iop_base;
+       ushort warn_code;
+       ADV_DCNT sum;
+       int begin_addr;
+       int end_addr;
+       ushort code_sum;
+       int word;
+       int j;
+       int adv_asc3550_expanded_size;
+       ADV_CARR_T *carrp;
+       ADV_DCNT contig_len;
+       ADV_SDCNT buf_size;
+       ADV_PADDR carr_paddr;
+       int i;
+       ushort scsi_cfg1;
+       uchar tid;
+       ushort bios_mem[ASC_MC_BIOSLEN / 2];    /* BIOS RISC Memory 0x40-0x8F. */
+       ushort wdtr_able = 0, sdtr_able, tagqng_able;
+       uchar max_cmd[ADV_MAX_TID + 1];
+
+       /* If there is already an error, don't continue. */
+       if (asc_dvc->err_code != 0) {
+               return ADV_ERROR;
+       }
 
-    /*
-     * The caller must set 'chip_type' to ADV_CHIP_ASC3550.
-     */
-    if (asc_dvc->chip_type != ADV_CHIP_ASC3550)
-    {
-        asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE;
-        return ADV_ERROR;
-    }
+       /*
+        * The caller must set 'chip_type' to ADV_CHIP_ASC3550.
+        */
+       if (asc_dvc->chip_type != ADV_CHIP_ASC3550) {
+               asc_dvc->err_code |= ASC_IERR_BAD_CHIPTYPE;
+               return ADV_ERROR;
+       }
 
-    warn_code = 0;
-    iop_base = asc_dvc->iop_base;
+       warn_code = 0;
+       iop_base = asc_dvc->iop_base;
+
+       /*
+        * Save the RISC memory BIOS region before writing the microcode.
+        * The BIOS may already be loaded and using its RISC LRAM region
+        * so its region must be saved and restored.
+        *
+        * Note: This code makes the assumption, which is currently true,
+        * that a chip reset does not clear RISC LRAM.
+        */
+       for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) {
+               AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i),
+                               bios_mem[i]);
+       }
 
-    /*
-     * Save the RISC memory BIOS region before writing the microcode.
-     * The BIOS may already be loaded and using its RISC LRAM region
-     * so its region must be saved and restored.
-     *
-     * Note: This code makes the assumption, which is currently true,
-     * that a chip reset does not clear RISC LRAM.
-     */
-    for (i = 0; i < ASC_MC_BIOSLEN/2; i++)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), bios_mem[i]);
-    }
+       /*
+        * Save current per TID negotiated values.
+        */
+       if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] == 0x55AA) {
+               ushort bios_version, major, minor;
+
+               bios_version =
+                   bios_mem[(ASC_MC_BIOS_VERSION - ASC_MC_BIOSMEM) / 2];
+               major = (bios_version >> 12) & 0xF;
+               minor = (bios_version >> 8) & 0xF;
+               if (major < 3 || (major == 3 && minor == 1)) {
+                       /* BIOS 3.1 and earlier location of 'wdtr_able' variable. */
+                       AdvReadWordLram(iop_base, 0x120, wdtr_able);
+               } else {
+                       AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+               }
+       }
+       AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+       AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
+       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+               AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                               max_cmd[tid]);
+       }
 
-    /*
-     * Save current per TID negotiated values.
-     */
-    if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM)/2] == 0x55AA)
-    {
-        ushort  bios_version, major, minor;
-
-        bios_version = bios_mem[(ASC_MC_BIOS_VERSION - ASC_MC_BIOSMEM)/2];
-        major = (bios_version  >> 12) & 0xF;
-        minor = (bios_version  >> 8) & 0xF;
-        if (major < 3 || (major == 3 && minor == 1))
-        {
-            /* BIOS 3.1 and earlier location of 'wdtr_able' variable. */
-            AdvReadWordLram(iop_base, 0x120, wdtr_able);
-        } else
-        {
-            AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-        }
-    }
-    AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-    AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-    for (tid = 0; tid <= ADV_MAX_TID; tid++)
-    {
-        AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-            max_cmd[tid]);
-    }
+       /*
+        * Load the Microcode
+        *
+        * Write the microcode image to RISC memory starting at address 0.
+        */
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
+       /* Assume the following compressed format of the microcode buffer:
+        *
+        *  254 word (508 byte) table indexed by byte code followed
+        *  by the following byte codes:
+        *
+        *    1-Byte Code:
+        *      00: Emit word 0 in table.
+        *      01: Emit word 1 in table.
+        *      .
+        *      FD: Emit word 253 in table.
+        *
+        *    Multi-Byte Code:
+        *      FE WW WW: (3 byte code) Word to emit is the next word WW WW.
+        *      FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
+        */
+       word = 0;
+       for (i = 253 * 2; i < _adv_asc3550_size; i++) {
+               if (_adv_asc3550_buf[i] == 0xff) {
+                       for (j = 0; j < _adv_asc3550_buf[i + 1]; j++) {
+                               AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                                   _adv_asc3550_buf
+                                                                   [i +
+                                                                    3] << 8) |
+                                                                  _adv_asc3550_buf
+                                                                  [i + 2]));
+                               word++;
+                       }
+                       i += 3;
+               } else if (_adv_asc3550_buf[i] == 0xfe) {
+                       AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                           _adv_asc3550_buf[i +
+                                                                            2]
+                                                           << 8) |
+                                                          _adv_asc3550_buf[i +
+                                                                           1]));
+                       i += 2;
+                       word++;
+               } else {
+                       AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                           _adv_asc3550_buf[(_adv_asc3550_buf[i] * 2) + 1] << 8) | _adv_asc3550_buf[_adv_asc3550_buf[i] * 2]));
+                       word++;
+               }
+       }
 
-    /*
-     * Load the Microcode
-     *
-     * Write the microcode image to RISC memory starting at address 0.
-     */
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
-    /* Assume the following compressed format of the microcode buffer:
-     *
-     *  254 word (508 byte) table indexed by byte code followed
-     *  by the following byte codes:
-     *
-     *    1-Byte Code:
-     *      00: Emit word 0 in table.
-     *      01: Emit word 1 in table.
-     *      .
-     *      FD: Emit word 253 in table.
-     *
-     *    Multi-Byte Code:
-     *      FE WW WW: (3 byte code) Word to emit is the next word WW WW.
-     *      FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
-     */
-    word = 0;
-    for (i = 253 * 2; i < _adv_asc3550_size; i++)
-    {
-        if (_adv_asc3550_buf[i] == 0xff)
-        {
-            for (j = 0; j < _adv_asc3550_buf[i + 1]; j++)
-            {
-                AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                    _adv_asc3550_buf[i + 3] << 8) |
-                _adv_asc3550_buf[i + 2]));
-                word++;
-            }
-            i += 3;
-        } else if (_adv_asc3550_buf[i] == 0xfe)
-        {
-            AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                _adv_asc3550_buf[i + 2] << 8) |
-                _adv_asc3550_buf[i + 1]));
-            i += 2;
-            word++;
-        } else
-        {
-            AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                _adv_asc3550_buf[(_adv_asc3550_buf[i] * 2) + 1] << 8) |
-                _adv_asc3550_buf[_adv_asc3550_buf[i] * 2]));
-            word++;
-        }
-    }
+       /*
+        * Set 'word' for later use to clear the rest of memory and save
+        * the expanded mcode size.
+        */
+       word *= 2;
+       adv_asc3550_expanded_size = word;
+
+       /*
+        * Clear the rest of ASC-3550 Internal RAM (8KB).
+        */
+       for (; word < ADV_3550_MEMSIZE; word += 2) {
+               AdvWriteWordAutoIncLram(iop_base, 0);
+       }
 
-    /*
-     * Set 'word' for later use to clear the rest of memory and save
-     * the expanded mcode size.
-     */
-    word *= 2;
-    adv_asc3550_expanded_size = word;
+       /*
+        * Verify the microcode checksum.
+        */
+       sum = 0;
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
 
-    /*
-     * Clear the rest of ASC-3550 Internal RAM (8KB).
-     */
-    for (; word < ADV_3550_MEMSIZE; word += 2)
-    {
-        AdvWriteWordAutoIncLram(iop_base, 0);
-    }
+       for (word = 0; word < adv_asc3550_expanded_size; word += 2) {
+               sum += AdvReadWordAutoIncLram(iop_base);
+       }
 
-    /*
-     * Verify the microcode checksum.
-     */
-    sum = 0;
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
-
-    for (word = 0; word < adv_asc3550_expanded_size; word += 2)
-    {
-        sum += AdvReadWordAutoIncLram(iop_base);
-    }
+       if (sum != _adv_asc3550_chksum) {
+               asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
+               return ADV_ERROR;
+       }
 
-    if (sum != _adv_asc3550_chksum)
-    {
-        asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
-        return ADV_ERROR;
-    }
+       /*
+        * Restore the RISC memory BIOS region.
+        */
+       for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) {
+               AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i),
+                                bios_mem[i]);
+       }
 
-    /*
-     * Restore the RISC memory BIOS region.
-     */
-    for (i = 0; i < ASC_MC_BIOSLEN/2; i++)
-    {
-        AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), bios_mem[i]);
-    }
+       /*
+        * Calculate and write the microcode code checksum to the microcode
+        * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
+        */
+       AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr);
+       AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr);
+       code_sum = 0;
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr);
+       for (word = begin_addr; word < end_addr; word += 2) {
+               code_sum += AdvReadWordAutoIncLram(iop_base);
+       }
+       AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum);
+
+       /*
+        * Read and save microcode version and date.
+        */
+       AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE,
+                       asc_dvc->cfg->mcode_date);
+       AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM,
+                       asc_dvc->cfg->mcode_version);
+
+       /*
+        * Set the chip type to indicate the ASC3550.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC3550);
+
+       /*
+        * If the PCI Configuration Command Register "Parity Error Response
+        * Control" Bit was clear (0), then set the microcode variable
+        * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
+        * to ignore DMA parity errors.
+        */
+       if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) {
+               AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+               word |= CONTROL_FLAG_IGNORE_PERR;
+               AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+       }
 
-    /*
-     * Calculate and write the microcode code checksum to the microcode
-     * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
-     */
-    AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr);
-    AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr);
-    code_sum = 0;
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr);
-    for (word = begin_addr; word < end_addr; word += 2)
-    {
-        code_sum += AdvReadWordAutoIncLram(iop_base);
-    }
-    AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum);
+       /*
+        * For ASC-3550, setting the START_CTL_EMFU [3:2] bits sets a FIFO
+        * threshold of 128 bytes. This register is only accessible to the host.
+        */
+       AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0,
+                            START_CTL_EMFU | READ_CMD_MRM);
+
+       /*
+        * Microcode operating variables for WDTR, SDTR, and command tag
+        * queuing will be set in AdvInquiryHandling() based on what a
+        * device reports it is capable of in Inquiry byte 7.
+        *
+        * If SCSI Bus Resets have been disabled, then directly set
+        * SDTR and WDTR from the EEPROM configuration. This will allow
+        * the BIOS and warm boot to work without a SCSI bus hang on
+        * the Inquiry caused by host and target mismatched DTR values.
+        * Without the SCSI Bus Reset, before an Inquiry a device can't
+        * be assumed to be in Asynchronous, Narrow mode.
+        */
+       if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) {
+               AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE,
+                                asc_dvc->wdtr_able);
+               AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE,
+                                asc_dvc->sdtr_able);
+       }
 
-    /*
-     * Read and save microcode version and date.
-     */
-    AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE, asc_dvc->cfg->mcode_date);
-    AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM, asc_dvc->cfg->mcode_version);
+       /*
+        * Set microcode operating variables for SDTR_SPEED1, SDTR_SPEED2,
+        * SDTR_SPEED3, and SDTR_SPEED4 based on the ULTRA EEPROM per TID
+        * bitmask. These values determine the maximum SDTR speed negotiated
+        * with a device.
+        *
+        * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
+        * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
+        * without determining here whether the device supports SDTR.
+        *
+        * 4-bit speed  SDTR speed name
+        * ===========  ===============
+        * 0000b (0x0)  SDTR disabled
+        * 0001b (0x1)  5 Mhz
+        * 0010b (0x2)  10 Mhz
+        * 0011b (0x3)  20 Mhz (Ultra)
+        * 0100b (0x4)  40 Mhz (LVD/Ultra2)
+        * 0101b (0x5)  80 Mhz (LVD2/Ultra3)
+        * 0110b (0x6)  Undefined
+        * .
+        * 1111b (0xF)  Undefined
+        */
+       word = 0;
+       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+               if (ADV_TID_TO_TIDMASK(tid) & asc_dvc->ultra_able) {
+                       /* Set Ultra speed for TID 'tid'. */
+                       word |= (0x3 << (4 * (tid % 4)));
+               } else {
+                       /* Set Fast speed for TID 'tid'. */
+                       word |= (0x2 << (4 * (tid % 4)));
+               }
+               if (tid == 3) { /* Check if done with sdtr_speed1. */
+                       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, word);
+                       word = 0;
+               } else if (tid == 7) {  /* Check if done with sdtr_speed2. */
+                       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, word);
+                       word = 0;
+               } else if (tid == 11) { /* Check if done with sdtr_speed3. */
+                       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, word);
+                       word = 0;
+               } else if (tid == 15) { /* Check if done with sdtr_speed4. */
+                       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, word);
+                       /* End of loop. */
+               }
+       }
 
-    /*
-     * Set the chip type to indicate the ASC3550.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC3550);
+       /*
+        * Set microcode operating variable for the disconnect per TID bitmask.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE,
+                        asc_dvc->cfg->disc_enable);
+
+       /*
+        * Set SCSI_CFG0 Microcode Default Value.
+        *
+        * The microcode will set the SCSI_CFG0 register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0,
+                        PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN |
+                        asc_dvc->chip_scsi_id);
+
+       /*
+        * Determine SCSI_CFG1 Microcode Default Value.
+        *
+        * The microcode will set the SCSI_CFG1 register using this value
+        * after it is started below.
+        */
+
+       /* Read current SCSI_CFG1 Register value. */
+       scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
+
+       /*
+        * If all three connectors are in use, return an error.
+        */
+       if ((scsi_cfg1 & CABLE_ILLEGAL_A) == 0 ||
+           (scsi_cfg1 & CABLE_ILLEGAL_B) == 0) {
+               asc_dvc->err_code |= ASC_IERR_ILLEGAL_CONNECTION;
+               return ADV_ERROR;
+       }
 
-    /*
-     * If the PCI Configuration Command Register "Parity Error Response
-     * Control" Bit was clear (0), then set the microcode variable
-     * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
-     * to ignore DMA parity errors.
-     */
-    if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-        word |= CONTROL_FLAG_IGNORE_PERR;
-        AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-    }
+       /*
+        * If the internal narrow cable is reversed all of the SCSI_CTRL
+        * register signals will be set. Check for and return an error if
+        * this condition is found.
+        */
+       if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07) {
+               asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
+               return ADV_ERROR;
+       }
 
-    /*
-     * For ASC-3550, setting the START_CTL_EMFU [3:2] bits sets a FIFO
-     * threshold of 128 bytes. This register is only accessible to the host.
-     */
-    AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0,
-        START_CTL_EMFU | READ_CMD_MRM);
+       /*
+        * If this is a differential board and a single-ended device
+        * is attached to one of the connectors, return an error.
+        */
+       if ((scsi_cfg1 & DIFF_MODE) && (scsi_cfg1 & DIFF_SENSE) == 0) {
+               asc_dvc->err_code |= ASC_IERR_SINGLE_END_DEVICE;
+               return ADV_ERROR;
+       }
 
-    /*
-     * Microcode operating variables for WDTR, SDTR, and command tag
-     * queuing will be set in AdvInquiryHandling() based on what a
-     * device reports it is capable of in Inquiry byte 7.
-     *
-     * If SCSI Bus Resets have been disabled, then directly set
-     * SDTR and WDTR from the EEPROM configuration. This will allow
-     * the BIOS and warm boot to work without a SCSI bus hang on
-     * the Inquiry caused by host and target mismatched DTR values.
-     * Without the SCSI Bus Reset, before an Inquiry a device can't
-     * be assumed to be in Asynchronous, Narrow mode.
-     */
-    if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0)
-    {
-        AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, asc_dvc->wdtr_able);
-        AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, asc_dvc->sdtr_able);
-    }
+       /*
+        * If automatic termination control is enabled, then set the
+        * termination value based on a table listed in a_condor.h.
+        *
+        * If manual termination was specified with an EEPROM setting
+        * then 'termination' was set-up in AdvInitFrom3550EEPROM() and
+        * is ready to be 'ored' into SCSI_CFG1.
+        */
+       if (asc_dvc->cfg->termination == 0) {
+               /*
+                * The software always controls termination by setting TERM_CTL_SEL.
+                * If TERM_CTL_SEL were set to 0, the hardware would set termination.
+                */
+               asc_dvc->cfg->termination |= TERM_CTL_SEL;
+
+               switch (scsi_cfg1 & CABLE_DETECT) {
+                       /* TERM_CTL_H: on, TERM_CTL_L: on */
+               case 0x3:
+               case 0x7:
+               case 0xB:
+               case 0xD:
+               case 0xE:
+               case 0xF:
+                       asc_dvc->cfg->termination |= (TERM_CTL_H | TERM_CTL_L);
+                       break;
+
+                       /* TERM_CTL_H: on, TERM_CTL_L: off */
+               case 0x1:
+               case 0x5:
+               case 0x9:
+               case 0xA:
+               case 0xC:
+                       asc_dvc->cfg->termination |= TERM_CTL_H;
+                       break;
+
+                       /* TERM_CTL_H: off, TERM_CTL_L: off */
+               case 0x2:
+               case 0x6:
+                       break;
+               }
+       }
 
-    /*
-     * Set microcode operating variables for SDTR_SPEED1, SDTR_SPEED2,
-     * SDTR_SPEED3, and SDTR_SPEED4 based on the ULTRA EEPROM per TID
-     * bitmask. These values determine the maximum SDTR speed negotiated
-     * with a device.
-     *
-     * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
-     * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
-     * without determining here whether the device supports SDTR.
-     *
-     * 4-bit speed  SDTR speed name
-     * ===========  ===============
-     * 0000b (0x0)  SDTR disabled
-     * 0001b (0x1)  5 Mhz
-     * 0010b (0x2)  10 Mhz
-     * 0011b (0x3)  20 Mhz (Ultra)
-     * 0100b (0x4)  40 Mhz (LVD/Ultra2)
-     * 0101b (0x5)  80 Mhz (LVD2/Ultra3)
-     * 0110b (0x6)  Undefined
-     * .
-     * 1111b (0xF)  Undefined
-     */
-    word = 0;
-    for (tid = 0; tid <= ADV_MAX_TID; tid++)
-    {
-        if (ADV_TID_TO_TIDMASK(tid) & asc_dvc->ultra_able)
-        {
-            /* Set Ultra speed for TID 'tid'. */
-            word |= (0x3 << (4 * (tid % 4)));
-        } else
-        {
-            /* Set Fast speed for TID 'tid'. */
-            word |= (0x2 << (4 * (tid % 4)));
-        }
-        if (tid == 3) /* Check if done with sdtr_speed1. */
-        {
-            AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, word);
-            word = 0;
-        } else if (tid == 7) /* Check if done with sdtr_speed2. */
-        {
-            AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, word);
-            word = 0;
-        } else if (tid == 11) /* Check if done with sdtr_speed3. */
-        {
-            AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, word);
-            word = 0;
-        } else if (tid == 15) /* Check if done with sdtr_speed4. */
-        {
-            AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, word);
-            /* End of loop. */
-        }
-    }
+       /*
+        * Clear any set TERM_CTL_H and TERM_CTL_L bits.
+        */
+       scsi_cfg1 &= ~TERM_CTL;
+
+       /*
+        * Invert the TERM_CTL_H and TERM_CTL_L bits and then
+        * set 'scsi_cfg1'. The TERM_POL bit does not need to be
+        * referenced, because the hardware internally inverts
+        * the Termination High and Low bits if TERM_POL is set.
+        */
+       scsi_cfg1 |= (TERM_CTL_SEL | (~asc_dvc->cfg->termination & TERM_CTL));
+
+       /*
+        * Set SCSI_CFG1 Microcode Default Value
+        *
+        * Set filter value and possibly modified termination control
+        * bits in the Microcode SCSI_CFG1 Register Value.
+        *
+        * The microcode will set the SCSI_CFG1 register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1,
+                        FLTR_DISABLE | scsi_cfg1);
+
+       /*
+        * Set MEM_CFG Microcode Default Value
+        *
+        * The microcode will set the MEM_CFG register using this value
+        * after it is started below.
+        *
+        * MEM_CFG may be accessed as a word or byte, but only bits 0-7
+        * are defined.
+        *
+        * ASC-3550 has 8KB internal memory.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
+                        BIOS_EN | RAM_SZ_8KB);
+
+       /*
+        * Set SEL_MASK Microcode Default Value
+        *
+        * The microcode will set the SEL_MASK register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
+                        ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
+
+       /*
+        * Build carrier freelist.
+        *
+        * Driver must have already allocated memory and set 'carrier_buf'.
+        */
+       ASC_ASSERT(asc_dvc->carrier_buf != NULL);
+
+       carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
+       asc_dvc->carr_freelist = NULL;
+       if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf) {
+               buf_size = ADV_CARRIER_BUFSIZE;
+       } else {
+               buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
+       }
 
-    /*
-     * Set microcode operating variable for the disconnect per TID bitmask.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE, asc_dvc->cfg->disc_enable);
+       do {
+               /*
+                * Get physical address of the carrier 'carrp'.
+                */
+               contig_len = sizeof(ADV_CARR_T);
+               carr_paddr =
+                   cpu_to_le32(DvcGetPhyAddr
+                               (asc_dvc, NULL, (uchar *)carrp,
+                                (ADV_SDCNT *)&contig_len,
+                                ADV_IS_CARRIER_FLAG));
 
-    /*
-     * Set SCSI_CFG0 Microcode Default Value.
-     *
-     * The microcode will set the SCSI_CFG0 register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0,
-        PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN |
-        asc_dvc->chip_scsi_id);
+               buf_size -= sizeof(ADV_CARR_T);
 
-    /*
-     * Determine SCSI_CFG1 Microcode Default Value.
-     *
-     * The microcode will set the SCSI_CFG1 register using this value
-     * after it is started below.
-     */
+               /*
+                * If the current carrier is not physically contiguous, then
+                * maybe there was a page crossing. Try the next carrier aligned
+                * start address.
+                */
+               if (contig_len < sizeof(ADV_CARR_T)) {
+                       carrp++;
+                       continue;
+               }
+
+               carrp->carr_pa = carr_paddr;
+               carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));
 
-    /* Read current SCSI_CFG1 Register value. */
-    scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
+               /*
+                * Insert the carrier at the beginning of the freelist.
+                */
+               carrp->next_vpa =
+                   cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
+               asc_dvc->carr_freelist = carrp;
 
-    /*
-     * If all three connectors are in use, return an error.
-     */
-    if ((scsi_cfg1 & CABLE_ILLEGAL_A) == 0 ||
-        (scsi_cfg1 & CABLE_ILLEGAL_B) == 0)
-    {
-            asc_dvc->err_code |= ASC_IERR_ILLEGAL_CONNECTION;
-            return ADV_ERROR;
-    }
+               carrp++;
+       }
+       while (buf_size > 0);
 
-    /*
-     * If the internal narrow cable is reversed all of the SCSI_CTRL
-     * register signals will be set. Check for and return an error if
-     * this condition is found.
-     */
-    if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07)
-    {
-        asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
-        return ADV_ERROR;
-    }
+       /*
+        * Set-up the Host->RISC Initiator Command Queue (ICQ).
+        */
 
-    /*
-     * If this is a differential board and a single-ended device
-     * is attached to one of the connectors, return an error.
-     */
-    if ((scsi_cfg1 & DIFF_MODE) && (scsi_cfg1 & DIFF_SENSE) == 0)
-    {
-        asc_dvc->err_code |= ASC_IERR_SINGLE_END_DEVICE;
-        return ADV_ERROR;
-    }
+       if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL) {
+               asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
+               return ADV_ERROR;
+       }
+       asc_dvc->carr_freelist = (ADV_CARR_T *)
+           ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa));
+
+       /*
+        * The first command issued will be placed in the stopper carrier.
+        */
+       asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+
+       /*
+        * Set RISC ICQ physical address start value.
+        */
+       AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
+
+       /*
+        * Set-up the RISC->Host Initiator Response Queue (IRQ).
+        */
+       if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL) {
+               asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
+               return ADV_ERROR;
+       }
+       asc_dvc->carr_freelist = (ADV_CARR_T *)
+           ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa));
+
+       /*
+        * The first command completed by the RISC will be placed in
+        * the stopper.
+        *
+        * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
+        * completed the RISC will set the ASC_RQ_STOPPER bit.
+        */
+       asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+
+       /*
+        * Set RISC IRQ physical address start value.
+        */
+       AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
+       asc_dvc->carr_pending_cnt = 0;
+
+       AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES,
+                            (ADV_INTR_ENABLE_HOST_INTR |
+                             ADV_INTR_ENABLE_GLOBAL_INTR));
+
+       AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word);
+       AdvWriteWordRegister(iop_base, IOPW_PC, word);
+
+       /* finally, finally, gentlemen, start your engine */
+       AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN);
+
+       /*
+        * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
+        * Resets should be performed. The RISC has to be running
+        * to issue a SCSI Bus Reset.
+        */
+       if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) {
+               /*
+                * If the BIOS Signature is present in memory, restore the
+                * BIOS Handshake Configuration Table and do not perform
+                * a SCSI Bus Reset.
+                */
+               if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] ==
+                   0x55AA) {
+                       /*
+                        * Restore per TID negotiated values.
+                        */
+                       AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+                       AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+                       AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE,
+                                        tagqng_able);
+                       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+                               AdvWriteByteLram(iop_base,
+                                                ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                                                max_cmd[tid]);
+                       }
+               } else {
+                       if (AdvResetSB(asc_dvc) != ADV_TRUE) {
+                               warn_code = ASC_WARN_BUSRESET_ERROR;
+                       }
+               }
+       }
 
-    /*
-     * If automatic termination control is enabled, then set the
-     * termination value based on a table listed in a_condor.h.
-     *
-     * If manual termination was specified with an EEPROM setting
-     * then 'termination' was set-up in AdvInitFrom3550EEPROM() and
-     * is ready to be 'ored' into SCSI_CFG1.
-     */
-    if (asc_dvc->cfg->termination == 0)
-    {
-        /*
-         * The software always controls termination by setting TERM_CTL_SEL.
-         * If TERM_CTL_SEL were set to 0, the hardware would set termination.
-         */
-        asc_dvc->cfg->termination |= TERM_CTL_SEL;
-
-        switch(scsi_cfg1 & CABLE_DETECT)
-        {
-            /* TERM_CTL_H: on, TERM_CTL_L: on */
-            case 0x3: case 0x7: case 0xB: case 0xD: case 0xE: case 0xF:
-                asc_dvc->cfg->termination |= (TERM_CTL_H | TERM_CTL_L);
-                break;
-
-            /* TERM_CTL_H: on, TERM_CTL_L: off */
-            case 0x1: case 0x5: case 0x9: case 0xA: case 0xC:
-                asc_dvc->cfg->termination |= TERM_CTL_H;
-                break;
-
-            /* TERM_CTL_H: off, TERM_CTL_L: off */
-            case 0x2: case 0x6:
-                break;
-        }
-    }
+       return warn_code;
+}
 
-    /*
-     * Clear any set TERM_CTL_H and TERM_CTL_L bits.
-     */
-    scsi_cfg1 &= ~TERM_CTL;
+/*
+ * Initialize the ASC-38C0800.
+ *
+ * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
+ *
+ * For a non-fatal error return a warning code. If there are no warnings
+ * then 0 is returned.
+ *
+ * Needed after initialization for error recovery.
+ */
+static int AdvInitAsc38C0800Driver(ADV_DVC_VAR *asc_dvc)
+{
+       AdvPortAddr iop_base;
+       ushort warn_code;
+       ADV_DCNT sum;
+       int begin_addr;
+       int end_addr;
+       ushort code_sum;
+       int word;
+       int j;
+       int adv_asc38C0800_expanded_size;
+       ADV_CARR_T *carrp;
+       ADV_DCNT contig_len;
+       ADV_SDCNT buf_size;
+       ADV_PADDR carr_paddr;
+       int i;
+       ushort scsi_cfg1;
+       uchar byte;
+       uchar tid;
+       ushort bios_mem[ASC_MC_BIOSLEN / 2];    /* BIOS RISC Memory 0x40-0x8F. */
+       ushort wdtr_able, sdtr_able, tagqng_able;
+       uchar max_cmd[ADV_MAX_TID + 1];
+
+       /* If there is already an error, don't continue. */
+       if (asc_dvc->err_code != 0) {
+               return ADV_ERROR;
+       }
 
-    /*
-     * Invert the TERM_CTL_H and TERM_CTL_L bits and then
-     * set 'scsi_cfg1'. The TERM_POL bit does not need to be
-     * referenced, because the hardware internally inverts
-     * the Termination High and Low bits if TERM_POL is set.
-     */
-    scsi_cfg1 |= (TERM_CTL_SEL | (~asc_dvc->cfg->termination & TERM_CTL));
+       /*
+        * The caller must set 'chip_type' to ADV_CHIP_ASC38C0800.
+        */
+       if (asc_dvc->chip_type != ADV_CHIP_ASC38C0800) {
+               asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE;
+               return ADV_ERROR;
+       }
 
-    /*
-     * Set SCSI_CFG1 Microcode Default Value
-     *
-     * Set filter value and possibly modified termination control
-     * bits in the Microcode SCSI_CFG1 Register Value.
-     *
-     * The microcode will set the SCSI_CFG1 register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1,
-        FLTR_DISABLE | scsi_cfg1);
+       warn_code = 0;
+       iop_base = asc_dvc->iop_base;
+
+       /*
+        * Save the RISC memory BIOS region before writing the microcode.
+        * The BIOS may already be loaded and using its RISC LRAM region
+        * so its region must be saved and restored.
+        *
+        * Note: This code makes the assumption, which is currently true,
+        * that a chip reset does not clear RISC LRAM.
+        */
+       for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) {
+               AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i),
+                               bios_mem[i]);
+       }
 
-    /*
-     * Set MEM_CFG Microcode Default Value
-     *
-     * The microcode will set the MEM_CFG register using this value
-     * after it is started below.
-     *
-     * MEM_CFG may be accessed as a word or byte, but only bits 0-7
-     * are defined.
-     *
-     * ASC-3550 has 8KB internal memory.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
-        BIOS_EN | RAM_SZ_8KB);
+       /*
+        * Save current per TID negotiated values.
+        */
+       AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+       AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+       AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
+       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+               AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                               max_cmd[tid]);
+       }
 
-    /*
-     * Set SEL_MASK Microcode Default Value
-     *
-     * The microcode will set the SEL_MASK register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
-        ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
+       /*
+        * RAM BIST (RAM Built-In Self Test)
+        *
+        * Address : I/O base + offset 0x38h register (byte).
+        * Function: Bit 7-6(RW) : RAM mode
+        *                          Normal Mode   : 0x00
+        *                          Pre-test Mode : 0x40
+        *                          RAM Test Mode : 0x80
+        *           Bit 5       : unused
+        *           Bit 4(RO)   : Done bit
+        *           Bit 3-0(RO) : Status
+        *                          Host Error    : 0x08
+        *                          Int_RAM Error : 0x04
+        *                          RISC Error    : 0x02
+        *                          SCSI Error    : 0x01
+        *                          No Error      : 0x00
+        *
+        * Note: RAM BIST code should be put right here, before loading the
+        * microcode and after saving the RISC memory BIOS region.
+        */
+
+       /*
+        * LRAM Pre-test
+        *
+        * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds.
+        * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return
+        * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset
+        * to NORMAL_MODE, return an error too.
+        */
+       for (i = 0; i < 2; i++) {
+               AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, PRE_TEST_MODE);
+               DvcSleepMilliSecond(10);        /* Wait for 10ms before reading back. */
+               byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
+               if ((byte & RAM_TEST_DONE) == 0
+                   || (byte & 0x0F) != PRE_TEST_VALUE) {
+                       asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
+                       return ADV_ERROR;
+               }
+
+               AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
+               DvcSleepMilliSecond(10);        /* Wait for 10ms before reading back. */
+               if (AdvReadByteRegister(iop_base, IOPB_RAM_BIST)
+                   != NORMAL_VALUE) {
+                       asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
+                       return ADV_ERROR;
+               }
+       }
 
-    /*
-     * Build carrier freelist.
-     *
-     * Driver must have already allocated memory and set 'carrier_buf'.
-     */
-    ASC_ASSERT(asc_dvc->carrier_buf != NULL);
-
-    carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
-    asc_dvc->carr_freelist = NULL;
-    if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf)
-    {
-        buf_size = ADV_CARRIER_BUFSIZE;
-    } else
-    {
-        buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
-    }
+       /*
+        * LRAM Test - It takes about 1.5 ms to run through the test.
+        *
+        * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds.
+        * If Done bit not set or Status not 0, save register byte, set the
+        * err_code, and return an error.
+        */
+       AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, RAM_TEST_MODE);
+       DvcSleepMilliSecond(10);        /* Wait for 10ms before checking status. */
+
+       byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
+       if ((byte & RAM_TEST_DONE) == 0 || (byte & RAM_TEST_STATUS) != 0) {
+               /* Get here if Done bit not set or Status not 0. */
+               asc_dvc->bist_err_code = byte;  /* for BIOS display message */
+               asc_dvc->err_code |= ASC_IERR_BIST_RAM_TEST;
+               return ADV_ERROR;
+       }
 
-    do {
-        /*
-         * Get physical address of the carrier 'carrp'.
-         */
-        contig_len = sizeof(ADV_CARR_T);
-        carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL, (uchar *) carrp,
-            (ADV_SDCNT *) &contig_len, ADV_IS_CARRIER_FLAG));
-
-        buf_size -= sizeof(ADV_CARR_T);
-
-        /*
-         * If the current carrier is not physically contiguous, then
-         * maybe there was a page crossing. Try the next carrier aligned
-         * start address.
-         */
-        if (contig_len < sizeof(ADV_CARR_T))
-        {
-            carrp++;
-            continue;
-        }
-
-        carrp->carr_pa = carr_paddr;
-        carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));
-
-        /*
-         * Insert the carrier at the beginning of the freelist.
-         */
-        carrp->next_vpa = cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
-        asc_dvc->carr_freelist = carrp;
-
-        carrp++;
-    }
-    while (buf_size > 0);
+       /* We need to reset back to normal mode after LRAM test passes. */
+       AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
+
+       /*
+        * Load the Microcode
+        *
+        * Write the microcode image to RISC memory starting at address 0.
+        *
+        */
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
+
+       /* Assume the following compressed format of the microcode buffer:
+        *
+        *  254 word (508 byte) table indexed by byte code followed
+        *  by the following byte codes:
+        *
+        *    1-Byte Code:
+        *      00: Emit word 0 in table.
+        *      01: Emit word 1 in table.
+        *      .
+        *      FD: Emit word 253 in table.
+        *
+        *    Multi-Byte Code:
+        *      FE WW WW: (3 byte code) Word to emit is the next word WW WW.
+        *      FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
+        */
+       word = 0;
+       for (i = 253 * 2; i < _adv_asc38C0800_size; i++) {
+               if (_adv_asc38C0800_buf[i] == 0xff) {
+                       for (j = 0; j < _adv_asc38C0800_buf[i + 1]; j++) {
+                               AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                                   _adv_asc38C0800_buf
+                                                                   [i +
+                                                                    3] << 8) |
+                                                                  _adv_asc38C0800_buf
+                                                                  [i + 2]));
+                               word++;
+                       }
+                       i += 3;
+               } else if (_adv_asc38C0800_buf[i] == 0xfe) {
+                       AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                           _adv_asc38C0800_buf
+                                                           [i +
+                                                            2] << 8) |
+                                                          _adv_asc38C0800_buf[i
+                                                                              +
+                                                                              1]));
+                       i += 2;
+                       word++;
+               } else {
+                       AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                           _adv_asc38C0800_buf[(_adv_asc38C0800_buf[i] * 2) + 1] << 8) | _adv_asc38C0800_buf[_adv_asc38C0800_buf[i] * 2]));
+                       word++;
+               }
+       }
 
-    /*
-     * Set-up the Host->RISC Initiator Command Queue (ICQ).
-     */
+       /*
+        * Set 'word' for later use to clear the rest of memory and save
+        * the expanded mcode size.
+        */
+       word *= 2;
+       adv_asc38C0800_expanded_size = word;
+
+       /*
+        * Clear the rest of ASC-38C0800 Internal RAM (16KB).
+        */
+       for (; word < ADV_38C0800_MEMSIZE; word += 2) {
+               AdvWriteWordAutoIncLram(iop_base, 0);
+       }
 
-    if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL)
-    {
-        asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
-        return ADV_ERROR;
-    }
-    asc_dvc->carr_freelist = (ADV_CARR_T *)
-        ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa));
+       /*
+        * Verify the microcode checksum.
+        */
+       sum = 0;
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
 
-    /*
-     * The first command issued will be placed in the stopper carrier.
-     */
-    asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+       for (word = 0; word < adv_asc38C0800_expanded_size; word += 2) {
+               sum += AdvReadWordAutoIncLram(iop_base);
+       }
+       ASC_DBG2(1, "AdvInitAsc38C0800Driver: word %d, i %d\n", word, i);
 
-    /*
-     * Set RISC ICQ physical address start value.
-     */
-    AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
+       ASC_DBG2(1,
+                "AdvInitAsc38C0800Driver: sum 0x%lx, _adv_asc38C0800_chksum 0x%lx\n",
+                (ulong)sum, (ulong)_adv_asc38C0800_chksum);
 
-    /*
-     * Set-up the RISC->Host Initiator Response Queue (IRQ).
-     */
-    if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL)
-    {
-        asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
-        return ADV_ERROR;
-    }
-    asc_dvc->carr_freelist = (ADV_CARR_T *)
-         ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa));
+       if (sum != _adv_asc38C0800_chksum) {
+               asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
+               return ADV_ERROR;
+       }
 
-    /*
-     * The first command completed by the RISC will be placed in
-     * the stopper.
-     *
-     * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
-     * completed the RISC will set the ASC_RQ_STOPPER bit.
-     */
-    asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+       /*
+        * Restore the RISC memory BIOS region.
+        */
+       for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) {
+               AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i),
+                                bios_mem[i]);
+       }
 
-    /*
-     * Set RISC IRQ physical address start value.
-     */
-    AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
-    asc_dvc->carr_pending_cnt = 0;
+       /*
+        * Calculate and write the microcode code checksum to the microcode
+        * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
+        */
+       AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr);
+       AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr);
+       code_sum = 0;
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr);
+       for (word = begin_addr; word < end_addr; word += 2) {
+               code_sum += AdvReadWordAutoIncLram(iop_base);
+       }
+       AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum);
+
+       /*
+        * Read microcode version and date.
+        */
+       AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE,
+                       asc_dvc->cfg->mcode_date);
+       AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM,
+                       asc_dvc->cfg->mcode_version);
+
+       /*
+        * Set the chip type to indicate the ASC38C0800.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC38C0800);
+
+       /*
+        * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register.
+        * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current
+        * cable detection and then we are able to read C_DET[3:0].
+        *
+        * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1
+        * Microcode Default Value' section below.
+        */
+       scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
+       AdvWriteWordRegister(iop_base, IOPW_SCSI_CFG1,
+                            scsi_cfg1 | DIS_TERM_DRV);
+
+       /*
+        * If the PCI Configuration Command Register "Parity Error Response
+        * Control" Bit was clear (0), then set the microcode variable
+        * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
+        * to ignore DMA parity errors.
+        */
+       if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) {
+               AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+               word |= CONTROL_FLAG_IGNORE_PERR;
+               AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+       }
 
-    AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES,
-        (ADV_INTR_ENABLE_HOST_INTR | ADV_INTR_ENABLE_GLOBAL_INTR));
+       /*
+        * For ASC-38C0800, set FIFO_THRESH_80B [6:4] bits and START_CTL_TH [3:2]
+        * bits for the default FIFO threshold.
+        *
+        * Note: ASC-38C0800 FIFO threshold has been changed to 256 bytes.
+        *
+        * For DMA Errata #4 set the BC_THRESH_ENB bit.
+        */
+       AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0,
+                            BC_THRESH_ENB | FIFO_THRESH_80B | START_CTL_TH |
+                            READ_CMD_MRM);
+
+       /*
+        * Microcode operating variables for WDTR, SDTR, and command tag
+        * queuing will be set in AdvInquiryHandling() based on what a
+        * device reports it is capable of in Inquiry byte 7.
+        *
+        * If SCSI Bus Resets have been disabled, then directly set
+        * SDTR and WDTR from the EEPROM configuration. This will allow
+        * the BIOS and warm boot to work without a SCSI bus hang on
+        * the Inquiry caused by host and target mismatched DTR values.
+        * Without the SCSI Bus Reset, before an Inquiry a device can't
+        * be assumed to be in Asynchronous, Narrow mode.
+        */
+       if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) {
+               AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE,
+                                asc_dvc->wdtr_able);
+               AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE,
+                                asc_dvc->sdtr_able);
+       }
 
-    AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word);
-    AdvWriteWordRegister(iop_base, IOPW_PC, word);
+       /*
+        * Set microcode operating variables for DISC and SDTR_SPEED1,
+        * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM
+        * configuration values.
+        *
+        * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
+        * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
+        * without determining here whether the device supports SDTR.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE,
+                        asc_dvc->cfg->disc_enable);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4);
+
+       /*
+        * Set SCSI_CFG0 Microcode Default Value.
+        *
+        * The microcode will set the SCSI_CFG0 register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0,
+                        PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN |
+                        asc_dvc->chip_scsi_id);
+
+       /*
+        * Determine SCSI_CFG1 Microcode Default Value.
+        *
+        * The microcode will set the SCSI_CFG1 register using this value
+        * after it is started below.
+        */
+
+       /* Read current SCSI_CFG1 Register value. */
+       scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
+
+       /*
+        * If the internal narrow cable is reversed all of the SCSI_CTRL
+        * register signals will be set. Check for and return an error if
+        * this condition is found.
+        */
+       if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07) {
+               asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
+               return ADV_ERROR;
+       }
 
-    /* finally, finally, gentlemen, start your engine */
-    AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN);
+       /*
+        * All kind of combinations of devices attached to one of four connectors
+        * are acceptable except HVD device attached. For example, LVD device can
+        * be attached to SE connector while SE device attached to LVD connector.
+        * If LVD device attached to SE connector, it only runs up to Ultra speed.
+        *
+        * If an HVD device is attached to one of LVD connectors, return an error.
+        * However, there is no way to detect HVD device attached to SE connectors.
+        */
+       if (scsi_cfg1 & HVD) {
+               asc_dvc->err_code |= ASC_IERR_HVD_DEVICE;
+               return ADV_ERROR;
+       }
 
-    /*
-     * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
-     * Resets should be performed. The RISC has to be running
-     * to issue a SCSI Bus Reset.
-     */
-    if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS)
-    {
-        /*
-         * If the BIOS Signature is present in memory, restore the
-         * BIOS Handshake Configuration Table and do not perform
-         * a SCSI Bus Reset.
-         */
-        if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM)/2] == 0x55AA)
-        {
-            /*
-             * Restore per TID negotiated values.
-             */
-            AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-            AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-            AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-            for (tid = 0; tid <= ADV_MAX_TID; tid++)
-            {
-                AdvWriteByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-                    max_cmd[tid]);
-            }
-        } else
-        {
-            if (AdvResetSB(asc_dvc) != ADV_TRUE)
-            {
-                warn_code = ASC_WARN_BUSRESET_ERROR;
-            }
-        }
-    }
+       /*
+        * If either SE or LVD automatic termination control is enabled, then
+        * set the termination value based on a table listed in a_condor.h.
+        *
+        * If manual termination was specified with an EEPROM setting then
+        * 'termination' was set-up in AdvInitFrom38C0800EEPROM() and is ready to
+        * be 'ored' into SCSI_CFG1.
+        */
+       if ((asc_dvc->cfg->termination & TERM_SE) == 0) {
+               /* SE automatic termination control is enabled. */
+               switch (scsi_cfg1 & C_DET_SE) {
+                       /* TERM_SE_HI: on, TERM_SE_LO: on */
+               case 0x1:
+               case 0x2:
+               case 0x3:
+                       asc_dvc->cfg->termination |= TERM_SE;
+                       break;
+
+                       /* TERM_SE_HI: on, TERM_SE_LO: off */
+               case 0x0:
+                       asc_dvc->cfg->termination |= TERM_SE_HI;
+                       break;
+               }
+       }
+
+       if ((asc_dvc->cfg->termination & TERM_LVD) == 0) {
+               /* LVD automatic termination control is enabled. */
+               switch (scsi_cfg1 & C_DET_LVD) {
+                       /* TERM_LVD_HI: on, TERM_LVD_LO: on */
+               case 0x4:
+               case 0x8:
+               case 0xC:
+                       asc_dvc->cfg->termination |= TERM_LVD;
+                       break;
+
+                       /* TERM_LVD_HI: off, TERM_LVD_LO: off */
+               case 0x0:
+                       break;
+               }
+       }
+
+       /*
+        * Clear any set TERM_SE and TERM_LVD bits.
+        */
+       scsi_cfg1 &= (~TERM_SE & ~TERM_LVD);
+
+       /*
+        * Invert the TERM_SE and TERM_LVD bits and then set 'scsi_cfg1'.
+        */
+       scsi_cfg1 |= (~asc_dvc->cfg->termination & 0xF0);
+
+       /*
+        * Clear BIG_ENDIAN, DIS_TERM_DRV, Terminator Polarity and HVD/LVD/SE bits
+        * and set possibly modified termination control bits in the Microcode
+        * SCSI_CFG1 Register Value.
+        */
+       scsi_cfg1 &= (~BIG_ENDIAN & ~DIS_TERM_DRV & ~TERM_POL & ~HVD_LVD_SE);
+
+       /*
+        * Set SCSI_CFG1 Microcode Default Value
+        *
+        * Set possibly modified termination control and reset DIS_TERM_DRV
+        * bits in the Microcode SCSI_CFG1 Register Value.
+        *
+        * The microcode will set the SCSI_CFG1 register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, scsi_cfg1);
+
+       /*
+        * Set MEM_CFG Microcode Default Value
+        *
+        * The microcode will set the MEM_CFG register using this value
+        * after it is started below.
+        *
+        * MEM_CFG may be accessed as a word or byte, but only bits 0-7
+        * are defined.
+        *
+        * ASC-38C0800 has 16KB internal memory.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
+                        BIOS_EN | RAM_SZ_16KB);
+
+       /*
+        * Set SEL_MASK Microcode Default Value
+        *
+        * The microcode will set the SEL_MASK register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
+                        ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
+
+       /*
+        * Build the carrier freelist.
+        *
+        * Driver must have already allocated memory and set 'carrier_buf'.
+        */
+       ASC_ASSERT(asc_dvc->carrier_buf != NULL);
+
+       carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
+       asc_dvc->carr_freelist = NULL;
+       if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf) {
+               buf_size = ADV_CARRIER_BUFSIZE;
+       } else {
+               buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
+       }
+
+       do {
+               /*
+                * Get physical address for the carrier 'carrp'.
+                */
+               contig_len = sizeof(ADV_CARR_T);
+               carr_paddr =
+                   cpu_to_le32(DvcGetPhyAddr
+                               (asc_dvc, NULL, (uchar *)carrp,
+                                (ADV_SDCNT *)&contig_len,
+                                ADV_IS_CARRIER_FLAG));
 
-    return warn_code;
+               buf_size -= sizeof(ADV_CARR_T);
+
+               /*
+                * If the current carrier is not physically contiguous, then
+                * maybe there was a page crossing. Try the next carrier aligned
+                * start address.
+                */
+               if (contig_len < sizeof(ADV_CARR_T)) {
+                       carrp++;
+                       continue;
+               }
+
+               carrp->carr_pa = carr_paddr;
+               carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));
+
+               /*
+                * Insert the carrier at the beginning of the freelist.
+                */
+               carrp->next_vpa =
+                   cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
+               asc_dvc->carr_freelist = carrp;
+
+               carrp++;
+       }
+       while (buf_size > 0);
+
+       /*
+        * Set-up the Host->RISC Initiator Command Queue (ICQ).
+        */
+
+       if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL) {
+               asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
+               return ADV_ERROR;
+       }
+       asc_dvc->carr_freelist = (ADV_CARR_T *)
+           ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa));
+
+       /*
+        * The first command issued will be placed in the stopper carrier.
+        */
+       asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+
+       /*
+        * Set RISC ICQ physical address start value.
+        * carr_pa is LE, must be native before write
+        */
+       AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
+
+       /*
+        * Set-up the RISC->Host Initiator Response Queue (IRQ).
+        */
+       if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL) {
+               asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
+               return ADV_ERROR;
+       }
+       asc_dvc->carr_freelist = (ADV_CARR_T *)
+           ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa));
+
+       /*
+        * The first command completed by the RISC will be placed in
+        * the stopper.
+        *
+        * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
+        * completed the RISC will set the ASC_RQ_STOPPER bit.
+        */
+       asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+
+       /*
+        * Set RISC IRQ physical address start value.
+        *
+        * carr_pa is LE, must be native before write *
+        */
+       AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
+       asc_dvc->carr_pending_cnt = 0;
+
+       AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES,
+                            (ADV_INTR_ENABLE_HOST_INTR |
+                             ADV_INTR_ENABLE_GLOBAL_INTR));
+
+       AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word);
+       AdvWriteWordRegister(iop_base, IOPW_PC, word);
+
+       /* finally, finally, gentlemen, start your engine */
+       AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN);
+
+       /*
+        * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
+        * Resets should be performed. The RISC has to be running
+        * to issue a SCSI Bus Reset.
+        */
+       if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) {
+               /*
+                * If the BIOS Signature is present in memory, restore the
+                * BIOS Handshake Configuration Table and do not perform
+                * a SCSI Bus Reset.
+                */
+               if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] ==
+                   0x55AA) {
+                       /*
+                        * Restore per TID negotiated values.
+                        */
+                       AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+                       AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+                       AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE,
+                                        tagqng_able);
+                       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+                               AdvWriteByteLram(iop_base,
+                                                ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                                                max_cmd[tid]);
+                       }
+               } else {
+                       if (AdvResetSB(asc_dvc) != ADV_TRUE) {
+                               warn_code = ASC_WARN_BUSRESET_ERROR;
+                       }
+               }
+       }
+
+       return warn_code;
 }
 
 /*
- * Initialize the ASC-38C0800.
+ * Initialize the ASC-38C1600.
  *
- * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
+ * On failure set the ASC_DVC_VAR field 'err_code' and return ADV_ERROR.
  *
  * For a non-fatal error return a warning code. If there are no warnings
  * then 0 is returned.
  *
  * Needed after initialization for error recovery.
  */
-STATIC int
-AdvInitAsc38C0800Driver(ADV_DVC_VAR *asc_dvc)
+static int AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc)
 {
-    AdvPortAddr iop_base;
-    ushort      warn_code;
-    ADV_DCNT    sum;
-    int         begin_addr;
-    int         end_addr;
-    ushort      code_sum;
-    int         word;
-    int         j;
-    int         adv_asc38C0800_expanded_size;
-    ADV_CARR_T  *carrp;
-    ADV_DCNT    contig_len;
-    ADV_SDCNT   buf_size;
-    ADV_PADDR   carr_paddr;
-    int         i;
-    ushort      scsi_cfg1;
-    uchar       byte;
-    uchar       tid;
-    ushort      bios_mem[ASC_MC_BIOSLEN/2]; /* BIOS RISC Memory 0x40-0x8F. */
-    ushort      wdtr_able, sdtr_able, tagqng_able;
-    uchar       max_cmd[ADV_MAX_TID + 1];
-
-    /* If there is already an error, don't continue. */
-    if (asc_dvc->err_code != 0)
-    {
-        return ADV_ERROR;
-    }
-
-    /*
-     * The caller must set 'chip_type' to ADV_CHIP_ASC38C0800.
-     */
-    if (asc_dvc->chip_type != ADV_CHIP_ASC38C0800)
-    {
-        asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE;
-        return ADV_ERROR;
-    }
+       AdvPortAddr iop_base;
+       ushort warn_code;
+       ADV_DCNT sum;
+       int begin_addr;
+       int end_addr;
+       ushort code_sum;
+       long word;
+       int j;
+       int adv_asc38C1600_expanded_size;
+       ADV_CARR_T *carrp;
+       ADV_DCNT contig_len;
+       ADV_SDCNT buf_size;
+       ADV_PADDR carr_paddr;
+       int i;
+       ushort scsi_cfg1;
+       uchar byte;
+       uchar tid;
+       ushort bios_mem[ASC_MC_BIOSLEN / 2];    /* BIOS RISC Memory 0x40-0x8F. */
+       ushort wdtr_able, sdtr_able, ppr_able, tagqng_able;
+       uchar max_cmd[ASC_MAX_TID + 1];
+
+       /* If there is already an error, don't continue. */
+       if (asc_dvc->err_code != 0) {
+               return ADV_ERROR;
+       }
 
-    warn_code = 0;
-    iop_base = asc_dvc->iop_base;
+       /*
+        * The caller must set 'chip_type' to ADV_CHIP_ASC38C1600.
+        */
+       if (asc_dvc->chip_type != ADV_CHIP_ASC38C1600) {
+               asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE;
+               return ADV_ERROR;
+       }
 
-    /*
-     * Save the RISC memory BIOS region before writing the microcode.
-     * The BIOS may already be loaded and using its RISC LRAM region
-     * so its region must be saved and restored.
-     *
-     * Note: This code makes the assumption, which is currently true,
-     * that a chip reset does not clear RISC LRAM.
-     */
-    for (i = 0; i < ASC_MC_BIOSLEN/2; i++)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), bios_mem[i]);
-    }
+       warn_code = 0;
+       iop_base = asc_dvc->iop_base;
+
+       /*
+        * Save the RISC memory BIOS region before writing the microcode.
+        * The BIOS may already be loaded and using its RISC LRAM region
+        * so its region must be saved and restored.
+        *
+        * Note: This code makes the assumption, which is currently true,
+        * that a chip reset does not clear RISC LRAM.
+        */
+       for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) {
+               AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i),
+                               bios_mem[i]);
+       }
 
-    /*
-     * Save current per TID negotiated values.
-     */
-    AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-    AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-    AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-    for (tid = 0; tid <= ADV_MAX_TID; tid++)
-    {
-        AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-            max_cmd[tid]);
-    }
+       /*
+        * Save current per TID negotiated values.
+        */
+       AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+       AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+       AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
+       AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
+       for (tid = 0; tid <= ASC_MAX_TID; tid++) {
+               AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                               max_cmd[tid]);
+       }
 
-    /*
-     * RAM BIST (RAM Built-In Self Test)
-     *
-     * Address : I/O base + offset 0x38h register (byte).
-     * Function: Bit 7-6(RW) : RAM mode
-     *                          Normal Mode   : 0x00
-     *                          Pre-test Mode : 0x40
-     *                          RAM Test Mode : 0x80
-     *           Bit 5       : unused
-     *           Bit 4(RO)   : Done bit
-     *           Bit 3-0(RO) : Status
-     *                          Host Error    : 0x08
-     *                          Int_RAM Error : 0x04
-     *                          RISC Error    : 0x02
-     *                          SCSI Error    : 0x01
-     *                          No Error      : 0x00
-     *
-     * Note: RAM BIST code should be put right here, before loading the
-     * microcode and after saving the RISC memory BIOS region.
-     */
+       /*
+        * RAM BIST (Built-In Self Test)
+        *
+        * Address : I/O base + offset 0x38h register (byte).
+        * Function: Bit 7-6(RW) : RAM mode
+        *                          Normal Mode   : 0x00
+        *                          Pre-test Mode : 0x40
+        *                          RAM Test Mode : 0x80
+        *           Bit 5       : unused
+        *           Bit 4(RO)   : Done bit
+        *           Bit 3-0(RO) : Status
+        *                          Host Error    : 0x08
+        *                          Int_RAM Error : 0x04
+        *                          RISC Error    : 0x02
+        *                          SCSI Error    : 0x01
+        *                          No Error      : 0x00
+        *
+        * Note: RAM BIST code should be put right here, before loading the
+        * microcode and after saving the RISC memory BIOS region.
+        */
+
+       /*
+        * LRAM Pre-test
+        *
+        * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds.
+        * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return
+        * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset
+        * to NORMAL_MODE, return an error too.
+        */
+       for (i = 0; i < 2; i++) {
+               AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, PRE_TEST_MODE);
+               DvcSleepMilliSecond(10);        /* Wait for 10ms before reading back. */
+               byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
+               if ((byte & RAM_TEST_DONE) == 0
+                   || (byte & 0x0F) != PRE_TEST_VALUE) {
+                       asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
+                       return ADV_ERROR;
+               }
+
+               AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
+               DvcSleepMilliSecond(10);        /* Wait for 10ms before reading back. */
+               if (AdvReadByteRegister(iop_base, IOPB_RAM_BIST)
+                   != NORMAL_VALUE) {
+                       asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
+                       return ADV_ERROR;
+               }
+       }
 
-    /*
-     * LRAM Pre-test
-     *
-     * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds.
-     * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return
-     * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset
-     * to NORMAL_MODE, return an error too.
-     */
-    for (i = 0; i < 2; i++)
-    {
-        AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, PRE_TEST_MODE);
-        DvcSleepMilliSecond(10);  /* Wait for 10ms before reading back. */
-        byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
-        if ((byte & RAM_TEST_DONE) == 0 || (byte & 0x0F) != PRE_TEST_VALUE)
-        {
-            asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
-            return ADV_ERROR;
-        }
-
-        AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
-        DvcSleepMilliSecond(10);  /* Wait for 10ms before reading back. */
-        if (AdvReadByteRegister(iop_base, IOPB_RAM_BIST)
-            != NORMAL_VALUE)
-        {
-            asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
-            return ADV_ERROR;
-        }
-    }
+       /*
+        * LRAM Test - It takes about 1.5 ms to run through the test.
+        *
+        * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds.
+        * If Done bit not set or Status not 0, save register byte, set the
+        * err_code, and return an error.
+        */
+       AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, RAM_TEST_MODE);
+       DvcSleepMilliSecond(10);        /* Wait for 10ms before checking status. */
+
+       byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
+       if ((byte & RAM_TEST_DONE) == 0 || (byte & RAM_TEST_STATUS) != 0) {
+               /* Get here if Done bit not set or Status not 0. */
+               asc_dvc->bist_err_code = byte;  /* for BIOS display message */
+               asc_dvc->err_code |= ASC_IERR_BIST_RAM_TEST;
+               return ADV_ERROR;
+       }
 
-    /*
-     * LRAM Test - It takes about 1.5 ms to run through the test.
-     *
-     * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds.
-     * If Done bit not set or Status not 0, save register byte, set the
-     * err_code, and return an error.
-     */
-    AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, RAM_TEST_MODE);
-    DvcSleepMilliSecond(10);  /* Wait for 10ms before checking status. */
-
-    byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
-    if ((byte & RAM_TEST_DONE) == 0 || (byte & RAM_TEST_STATUS) != 0)
-    {
-        /* Get here if Done bit not set or Status not 0. */
-        asc_dvc->bist_err_code = byte;  /* for BIOS display message */
-        asc_dvc->err_code |= ASC_IERR_BIST_RAM_TEST;
-        return ADV_ERROR;
-    }
+       /* We need to reset back to normal mode after LRAM test passes. */
+       AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
+
+       /*
+        * Load the Microcode
+        *
+        * Write the microcode image to RISC memory starting at address 0.
+        *
+        */
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
+
+       /*
+        * Assume the following compressed format of the microcode buffer:
+        *
+        *  254 word (508 byte) table indexed by byte code followed
+        *  by the following byte codes:
+        *
+        *    1-Byte Code:
+        *      00: Emit word 0 in table.
+        *      01: Emit word 1 in table.
+        *      .
+        *      FD: Emit word 253 in table.
+        *
+        *    Multi-Byte Code:
+        *      FE WW WW: (3 byte code) Word to emit is the next word WW WW.
+        *      FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
+        */
+       word = 0;
+       for (i = 253 * 2; i < _adv_asc38C1600_size; i++) {
+               if (_adv_asc38C1600_buf[i] == 0xff) {
+                       for (j = 0; j < _adv_asc38C1600_buf[i + 1]; j++) {
+                               AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                                   _adv_asc38C1600_buf
+                                                                   [i +
+                                                                    3] << 8) |
+                                                                  _adv_asc38C1600_buf
+                                                                  [i + 2]));
+                               word++;
+                       }
+                       i += 3;
+               } else if (_adv_asc38C1600_buf[i] == 0xfe) {
+                       AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                           _adv_asc38C1600_buf
+                                                           [i +
+                                                            2] << 8) |
+                                                          _adv_asc38C1600_buf[i
+                                                                              +
+                                                                              1]));
+                       i += 2;
+                       word++;
+               } else {
+                       AdvWriteWordAutoIncLram(iop_base, (((ushort)
+                                                           _adv_asc38C1600_buf[(_adv_asc38C1600_buf[i] * 2) + 1] << 8) | _adv_asc38C1600_buf[_adv_asc38C1600_buf[i] * 2]));
+                       word++;
+               }
+       }
 
-    /* We need to reset back to normal mode after LRAM test passes. */
-    AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
+       /*
+        * Set 'word' for later use to clear the rest of memory and save
+        * the expanded mcode size.
+        */
+       word *= 2;
+       adv_asc38C1600_expanded_size = word;
+
+       /*
+        * Clear the rest of ASC-38C1600 Internal RAM (32KB).
+        */
+       for (; word < ADV_38C1600_MEMSIZE; word += 2) {
+               AdvWriteWordAutoIncLram(iop_base, 0);
+       }
 
-    /*
-     * Load the Microcode
-     *
-     * Write the microcode image to RISC memory starting at address 0.
-     *
-     */
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
-
-    /* Assume the following compressed format of the microcode buffer:
-     *
-     *  254 word (508 byte) table indexed by byte code followed
-     *  by the following byte codes:
-     *
-     *    1-Byte Code:
-     *      00: Emit word 0 in table.
-     *      01: Emit word 1 in table.
-     *      .
-     *      FD: Emit word 253 in table.
-     *
-     *    Multi-Byte Code:
-     *      FE WW WW: (3 byte code) Word to emit is the next word WW WW.
-     *      FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
-     */
-    word = 0;
-    for (i = 253 * 2; i < _adv_asc38C0800_size; i++)
-    {
-        if (_adv_asc38C0800_buf[i] == 0xff)
-        {
-            for (j = 0; j < _adv_asc38C0800_buf[i + 1]; j++)
-            {
-                AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                    _adv_asc38C0800_buf[i + 3] << 8) |
-                    _adv_asc38C0800_buf[i + 2]));
-                word++;
-            }
-            i += 3;
-        } else if (_adv_asc38C0800_buf[i] == 0xfe)
-        {
-            AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                _adv_asc38C0800_buf[i + 2] << 8) |
-                _adv_asc38C0800_buf[i + 1]));
-            i += 2;
-            word++;
-        } else
-        {
-            AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                _adv_asc38C0800_buf[(_adv_asc38C0800_buf[i] * 2) + 1] << 8) |
-                _adv_asc38C0800_buf[_adv_asc38C0800_buf[i] * 2]));
-            word++;
-        }
-    }
+       /*
+        * Verify the microcode checksum.
+        */
+       sum = 0;
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
 
-    /*
-     * Set 'word' for later use to clear the rest of memory and save
-     * the expanded mcode size.
-     */
-    word *= 2;
-    adv_asc38C0800_expanded_size = word;
+       for (word = 0; word < adv_asc38C1600_expanded_size; word += 2) {
+               sum += AdvReadWordAutoIncLram(iop_base);
+       }
 
-    /*
-     * Clear the rest of ASC-38C0800 Internal RAM (16KB).
-     */
-    for (; word < ADV_38C0800_MEMSIZE; word += 2)
-    {
-        AdvWriteWordAutoIncLram(iop_base, 0);
-    }
+       if (sum != _adv_asc38C1600_chksum) {
+               asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
+               return ADV_ERROR;
+       }
 
-    /*
-     * Verify the microcode checksum.
-     */
-    sum = 0;
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
-
-    for (word = 0; word < adv_asc38C0800_expanded_size; word += 2)
-    {
-        sum += AdvReadWordAutoIncLram(iop_base);
-    }
-    ASC_DBG2(1, "AdvInitAsc38C0800Driver: word %d, i %d\n", word, i);
+       /*
+        * Restore the RISC memory BIOS region.
+        */
+       for (i = 0; i < ASC_MC_BIOSLEN / 2; i++) {
+               AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i),
+                                bios_mem[i]);
+       }
 
-    ASC_DBG2(1,
-        "AdvInitAsc38C0800Driver: sum 0x%lx, _adv_asc38C0800_chksum 0x%lx\n",
-        (ulong) sum, (ulong) _adv_asc38C0800_chksum);
+       /*
+        * Calculate and write the microcode code checksum to the microcode
+        * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
+        */
+       AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr);
+       AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr);
+       code_sum = 0;
+       AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr);
+       for (word = begin_addr; word < end_addr; word += 2) {
+               code_sum += AdvReadWordAutoIncLram(iop_base);
+       }
+       AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum);
+
+       /*
+        * Read microcode version and date.
+        */
+       AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE,
+                       asc_dvc->cfg->mcode_date);
+       AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM,
+                       asc_dvc->cfg->mcode_version);
+
+       /*
+        * Set the chip type to indicate the ASC38C1600.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC38C1600);
+
+       /*
+        * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register.
+        * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current
+        * cable detection and then we are able to read C_DET[3:0].
+        *
+        * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1
+        * Microcode Default Value' section below.
+        */
+       scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
+       AdvWriteWordRegister(iop_base, IOPW_SCSI_CFG1,
+                            scsi_cfg1 | DIS_TERM_DRV);
+
+       /*
+        * If the PCI Configuration Command Register "Parity Error Response
+        * Control" Bit was clear (0), then set the microcode variable
+        * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
+        * to ignore DMA parity errors.
+        */
+       if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR) {
+               AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+               word |= CONTROL_FLAG_IGNORE_PERR;
+               AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+       }
 
-    if (sum != _adv_asc38C0800_chksum)
-    {
-        asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
-        return ADV_ERROR;
-    }
+       /*
+        * If the BIOS control flag AIPP (Asynchronous Information
+        * Phase Protection) disable bit is not set, then set the firmware
+        * 'control_flag' CONTROL_FLAG_ENABLE_AIPP bit to enable
+        * AIPP checking and encoding.
+        */
+       if ((asc_dvc->bios_ctrl & BIOS_CTRL_AIPP_DIS) == 0) {
+               AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+               word |= CONTROL_FLAG_ENABLE_AIPP;
+               AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
+       }
 
-    /*
-     * Restore the RISC memory BIOS region.
-     */
-    for (i = 0; i < ASC_MC_BIOSLEN/2; i++)
-    {
-        AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), bios_mem[i]);
-    }
+       /*
+        * For ASC-38C1600 use DMA_CFG0 default values: FIFO_THRESH_80B [6:4],
+        * and START_CTL_TH [3:2].
+        */
+       AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0,
+                            FIFO_THRESH_80B | START_CTL_TH | READ_CMD_MRM);
+
+       /*
+        * Microcode operating variables for WDTR, SDTR, and command tag
+        * queuing will be set in AdvInquiryHandling() based on what a
+        * device reports it is capable of in Inquiry byte 7.
+        *
+        * If SCSI Bus Resets have been disabled, then directly set
+        * SDTR and WDTR from the EEPROM configuration. This will allow
+        * the BIOS and warm boot to work without a SCSI bus hang on
+        * the Inquiry caused by host and target mismatched DTR values.
+        * Without the SCSI Bus Reset, before an Inquiry a device can't
+        * be assumed to be in Asynchronous, Narrow mode.
+        */
+       if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0) {
+               AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE,
+                                asc_dvc->wdtr_able);
+               AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE,
+                                asc_dvc->sdtr_able);
+       }
 
-    /*
-     * Calculate and write the microcode code checksum to the microcode
-     * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
-     */
-    AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr);
-    AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr);
-    code_sum = 0;
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr);
-    for (word = begin_addr; word < end_addr; word += 2)
-    {
-        code_sum += AdvReadWordAutoIncLram(iop_base);
-    }
-    AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum);
+       /*
+        * Set microcode operating variables for DISC and SDTR_SPEED1,
+        * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM
+        * configuration values.
+        *
+        * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
+        * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
+        * without determining here whether the device supports SDTR.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE,
+                        asc_dvc->cfg->disc_enable);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4);
+
+       /*
+        * Set SCSI_CFG0 Microcode Default Value.
+        *
+        * The microcode will set the SCSI_CFG0 register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0,
+                        PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN |
+                        asc_dvc->chip_scsi_id);
+
+       /*
+        * Calculate SCSI_CFG1 Microcode Default Value.
+        *
+        * The microcode will set the SCSI_CFG1 register using this value
+        * after it is started below.
+        *
+        * Each ASC-38C1600 function has only two cable detect bits.
+        * The bus mode override bits are in IOPB_SOFT_OVER_WR.
+        */
+       scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
+
+       /*
+        * If the cable is reversed all of the SCSI_CTRL register signals
+        * will be set. Check for and return an error if this condition is
+        * found.
+        */
+       if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07) {
+               asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
+               return ADV_ERROR;
+       }
 
-    /*
-     * Read microcode version and date.
-     */
-    AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE, asc_dvc->cfg->mcode_date);
-    AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM, asc_dvc->cfg->mcode_version);
+       /*
+        * Each ASC-38C1600 function has two connectors. Only an HVD device
+        * can not be connected to either connector. An LVD device or SE device
+        * may be connected to either connecor. If an SE device is connected,
+        * then at most Ultra speed (20 Mhz) can be used on both connectors.
+        *
+        * If an HVD device is attached, return an error.
+        */
+       if (scsi_cfg1 & HVD) {
+               asc_dvc->err_code |= ASC_IERR_HVD_DEVICE;
+               return ADV_ERROR;
+       }
 
-    /*
-     * Set the chip type to indicate the ASC38C0800.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC38C0800);
+       /*
+        * Each function in the ASC-38C1600 uses only the SE cable detect and
+        * termination because there are two connectors for each function. Each
+        * function may use either LVD or SE mode. Corresponding the SE automatic
+        * termination control EEPROM bits are used for each function. Each
+        * function has its own EEPROM. If SE automatic control is enabled for
+        * the function, then set the termination value based on a table listed
+        * in a_condor.h.
+        *
+        * If manual termination is specified in the EEPROM for the function,
+        * then 'termination' was set-up in AscInitFrom38C1600EEPROM() and is
+        * ready to be 'ored' into SCSI_CFG1.
+        */
+       if ((asc_dvc->cfg->termination & TERM_SE) == 0) {
+               /* SE automatic termination control is enabled. */
+               switch (scsi_cfg1 & C_DET_SE) {
+                       /* TERM_SE_HI: on, TERM_SE_LO: on */
+               case 0x1:
+               case 0x2:
+               case 0x3:
+                       asc_dvc->cfg->termination |= TERM_SE;
+                       break;
+
+               case 0x0:
+                       if (ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) == 0) {
+                               /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */
+                       } else {
+                               /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */
+                               asc_dvc->cfg->termination |= TERM_SE_HI;
+                       }
+                       break;
+               }
+       }
 
-    /*
-     * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register.
-     * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current
-     * cable detection and then we are able to read C_DET[3:0].
-     *
-     * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1
-     * Microcode Default Value' section below.
-     */
-    scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
-    AdvWriteWordRegister(iop_base, IOPW_SCSI_CFG1, scsi_cfg1 | DIS_TERM_DRV);
+       /*
+        * Clear any set TERM_SE bits.
+        */
+       scsi_cfg1 &= ~TERM_SE;
+
+       /*
+        * Invert the TERM_SE bits and then set 'scsi_cfg1'.
+        */
+       scsi_cfg1 |= (~asc_dvc->cfg->termination & TERM_SE);
+
+       /*
+        * Clear Big Endian and Terminator Polarity bits and set possibly
+        * modified termination control bits in the Microcode SCSI_CFG1
+        * Register Value.
+        *
+        * Big Endian bit is not used even on big endian machines.
+        */
+       scsi_cfg1 &= (~BIG_ENDIAN & ~DIS_TERM_DRV & ~TERM_POL);
+
+       /*
+        * Set SCSI_CFG1 Microcode Default Value
+        *
+        * Set possibly modified termination control bits in the Microcode
+        * SCSI_CFG1 Register Value.
+        *
+        * The microcode will set the SCSI_CFG1 register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, scsi_cfg1);
+
+       /*
+        * Set MEM_CFG Microcode Default Value
+        *
+        * The microcode will set the MEM_CFG register using this value
+        * after it is started below.
+        *
+        * MEM_CFG may be accessed as a word or byte, but only bits 0-7
+        * are defined.
+        *
+        * ASC-38C1600 has 32KB internal memory.
+        *
+        * XXX - Since ASC38C1600 Rev.3 has a Local RAM failure issue, we come
+        * out a special 16K Adv Library and Microcode version. After the issue
+        * resolved, we should turn back to the 32K support. Both a_condor.h and
+        * mcode.sas files also need to be updated.
+        *
+        * AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
+        *  BIOS_EN | RAM_SZ_32KB);
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
+                        BIOS_EN | RAM_SZ_16KB);
+
+       /*
+        * Set SEL_MASK Microcode Default Value
+        *
+        * The microcode will set the SEL_MASK register using this value
+        * after it is started below.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
+                        ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
+
+       /*
+        * Build the carrier freelist.
+        *
+        * Driver must have already allocated memory and set 'carrier_buf'.
+        */
+
+       ASC_ASSERT(asc_dvc->carrier_buf != NULL);
+
+       carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
+       asc_dvc->carr_freelist = NULL;
+       if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf) {
+               buf_size = ADV_CARRIER_BUFSIZE;
+       } else {
+               buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
+       }
 
-    /*
-     * If the PCI Configuration Command Register "Parity Error Response
-     * Control" Bit was clear (0), then set the microcode variable
-     * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
-     * to ignore DMA parity errors.
-     */
-    if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-        word |= CONTROL_FLAG_IGNORE_PERR;
-        AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-    }
+       do {
+               /*
+                * Get physical address for the carrier 'carrp'.
+                */
+               contig_len = sizeof(ADV_CARR_T);
+               carr_paddr =
+                   cpu_to_le32(DvcGetPhyAddr
+                               (asc_dvc, NULL, (uchar *)carrp,
+                                (ADV_SDCNT *)&contig_len,
+                                ADV_IS_CARRIER_FLAG));
 
-    /*
-     * For ASC-38C0800, set FIFO_THRESH_80B [6:4] bits and START_CTL_TH [3:2]
-     * bits for the default FIFO threshold.
-     *
-     * Note: ASC-38C0800 FIFO threshold has been changed to 256 bytes.
-     *
-     * For DMA Errata #4 set the BC_THRESH_ENB bit.
-     */
-    AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0,
-        BC_THRESH_ENB | FIFO_THRESH_80B | START_CTL_TH | READ_CMD_MRM);
+               buf_size -= sizeof(ADV_CARR_T);
 
-    /*
-     * Microcode operating variables for WDTR, SDTR, and command tag
-     * queuing will be set in AdvInquiryHandling() based on what a
-     * device reports it is capable of in Inquiry byte 7.
-     *
-     * If SCSI Bus Resets have been disabled, then directly set
-     * SDTR and WDTR from the EEPROM configuration. This will allow
-     * the BIOS and warm boot to work without a SCSI bus hang on
-     * the Inquiry caused by host and target mismatched DTR values.
-     * Without the SCSI Bus Reset, before an Inquiry a device can't
-     * be assumed to be in Asynchronous, Narrow mode.
-     */
-    if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0)
-    {
-        AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, asc_dvc->wdtr_able);
-        AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, asc_dvc->sdtr_able);
-    }
+               /*
+                * If the current carrier is not physically contiguous, then
+                * maybe there was a page crossing. Try the next carrier aligned
+                * start address.
+                */
+               if (contig_len < sizeof(ADV_CARR_T)) {
+                       carrp++;
+                       continue;
+               }
+
+               carrp->carr_pa = carr_paddr;
+               carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));
 
-    /*
-     * Set microcode operating variables for DISC and SDTR_SPEED1,
-     * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM
-     * configuration values.
-     *
-     * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
-     * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
-     * without determining here whether the device supports SDTR.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE, asc_dvc->cfg->disc_enable);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4);
+               /*
+                * Insert the carrier at the beginning of the freelist.
+                */
+               carrp->next_vpa =
+                   cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
+               asc_dvc->carr_freelist = carrp;
 
-    /*
-     * Set SCSI_CFG0 Microcode Default Value.
-     *
-     * The microcode will set the SCSI_CFG0 register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0,
-        PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN |
-        asc_dvc->chip_scsi_id);
+               carrp++;
+       }
+       while (buf_size > 0);
+
+       /*
+        * Set-up the Host->RISC Initiator Command Queue (ICQ).
+        */
+       if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL) {
+               asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
+               return ADV_ERROR;
+       }
+       asc_dvc->carr_freelist = (ADV_CARR_T *)
+           ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa));
+
+       /*
+        * The first command issued will be placed in the stopper carrier.
+        */
+       asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+
+       /*
+        * Set RISC ICQ physical address start value. Initialize the
+        * COMMA register to the same value otherwise the RISC will
+        * prematurely detect a command is available.
+        */
+       AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
+       AdvWriteDWordRegister(iop_base, IOPDW_COMMA,
+                             le32_to_cpu(asc_dvc->icq_sp->carr_pa));
+
+       /*
+        * Set-up the RISC->Host Initiator Response Queue (IRQ).
+        */
+       if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL) {
+               asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
+               return ADV_ERROR;
+       }
+       asc_dvc->carr_freelist = (ADV_CARR_T *)
+           ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa));
+
+       /*
+        * The first command completed by the RISC will be placed in
+        * the stopper.
+        *
+        * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
+        * completed the RISC will set the ASC_RQ_STOPPER bit.
+        */
+       asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+
+       /*
+        * Set RISC IRQ physical address start value.
+        */
+       AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
+       asc_dvc->carr_pending_cnt = 0;
+
+       AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES,
+                            (ADV_INTR_ENABLE_HOST_INTR |
+                             ADV_INTR_ENABLE_GLOBAL_INTR));
+       AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word);
+       AdvWriteWordRegister(iop_base, IOPW_PC, word);
+
+       /* finally, finally, gentlemen, start your engine */
+       AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN);
+
+       /*
+        * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
+        * Resets should be performed. The RISC has to be running
+        * to issue a SCSI Bus Reset.
+        */
+       if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) {
+               /*
+                * If the BIOS Signature is present in memory, restore the
+                * per TID microcode operating variables.
+                */
+               if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM) / 2] ==
+                   0x55AA) {
+                       /*
+                        * Restore per TID negotiated values.
+                        */
+                       AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+                       AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+                       AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
+                       AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE,
+                                        tagqng_able);
+                       for (tid = 0; tid <= ASC_MAX_TID; tid++) {
+                               AdvWriteByteLram(iop_base,
+                                                ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                                                max_cmd[tid]);
+                       }
+               } else {
+                       if (AdvResetSB(asc_dvc) != ADV_TRUE) {
+                               warn_code = ASC_WARN_BUSRESET_ERROR;
+                       }
+               }
+       }
 
-    /*
-     * Determine SCSI_CFG1 Microcode Default Value.
-     *
-     * The microcode will set the SCSI_CFG1 register using this value
-     * after it is started below.
-     */
+       return warn_code;
+}
 
-    /* Read current SCSI_CFG1 Register value. */
-    scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
+/*
+ * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and
+ * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while
+ * all of this is done.
+ *
+ * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
+ *
+ * For a non-fatal error return a warning code. If there are no warnings
+ * then 0 is returned.
+ *
+ * Note: Chip is stopped on entry.
+ */
+static int __init AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc)
+{
+       AdvPortAddr iop_base;
+       ushort warn_code;
+       ADVEEP_3550_CONFIG eep_config;
+       int i;
 
-    /*
-     * If the internal narrow cable is reversed all of the SCSI_CTRL
-     * register signals will be set. Check for and return an error if
-     * this condition is found.
-     */
-    if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07)
-    {
-        asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
-        return ADV_ERROR;
-    }
+       iop_base = asc_dvc->iop_base;
 
-    /*
-     * All kind of combinations of devices attached to one of four connectors
-     * are acceptable except HVD device attached. For example, LVD device can
-     * be attached to SE connector while SE device attached to LVD connector.
-     * If LVD device attached to SE connector, it only runs up to Ultra speed.
-     *
-     * If an HVD device is attached to one of LVD connectors, return an error.
-     * However, there is no way to detect HVD device attached to SE connectors.
-     */
-    if (scsi_cfg1 & HVD)
-    {
-        asc_dvc->err_code |= ASC_IERR_HVD_DEVICE;
-        return ADV_ERROR;
-    }
+       warn_code = 0;
 
-    /*
-     * If either SE or LVD automatic termination control is enabled, then
-     * set the termination value based on a table listed in a_condor.h.
-     *
-     * If manual termination was specified with an EEPROM setting then
-     * 'termination' was set-up in AdvInitFrom38C0800EEPROM() and is ready to
-     * be 'ored' into SCSI_CFG1.
-     */
-    if ((asc_dvc->cfg->termination & TERM_SE) == 0)
-    {
-        /* SE automatic termination control is enabled. */
-        switch(scsi_cfg1 & C_DET_SE)
-        {
-            /* TERM_SE_HI: on, TERM_SE_LO: on */
-            case 0x1: case 0x2: case 0x3:
-                asc_dvc->cfg->termination |= TERM_SE;
-                break;
-
-            /* TERM_SE_HI: on, TERM_SE_LO: off */
-            case 0x0:
-                asc_dvc->cfg->termination |= TERM_SE_HI;
-                break;
-        }
-    }
+       /*
+        * Read the board's EEPROM configuration.
+        *
+        * Set default values if a bad checksum is found.
+        */
+       if (AdvGet3550EEPConfig(iop_base, &eep_config) != eep_config.check_sum) {
+               warn_code |= ASC_WARN_EEPROM_CHKSUM;
 
-    if ((asc_dvc->cfg->termination & TERM_LVD) == 0)
-    {
-        /* LVD automatic termination control is enabled. */
-        switch(scsi_cfg1 & C_DET_LVD)
-        {
-            /* TERM_LVD_HI: on, TERM_LVD_LO: on */
-            case 0x4: case 0x8: case 0xC:
-                asc_dvc->cfg->termination |= TERM_LVD;
-                break;
-
-            /* TERM_LVD_HI: off, TERM_LVD_LO: off */
-            case 0x0:
-                break;
-        }
-    }
+               /*
+                * Set EEPROM default values.
+                */
+               for (i = 0; i < sizeof(ADVEEP_3550_CONFIG); i++) {
+                       *((uchar *)&eep_config + i) =
+                           *((uchar *)&Default_3550_EEPROM_Config + i);
+               }
 
-    /*
-     * Clear any set TERM_SE and TERM_LVD bits.
-     */
-    scsi_cfg1 &= (~TERM_SE & ~TERM_LVD);
+               /*
+                * Assume the 6 byte board serial number that was read
+                * from EEPROM is correct even if the EEPROM checksum
+                * failed.
+                */
+               eep_config.serial_number_word3 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1);
 
-    /*
-     * Invert the TERM_SE and TERM_LVD bits and then set 'scsi_cfg1'.
-     */
-    scsi_cfg1 |= (~asc_dvc->cfg->termination & 0xF0);
+               eep_config.serial_number_word2 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2);
 
-    /*
-     * Clear BIG_ENDIAN, DIS_TERM_DRV, Terminator Polarity and HVD/LVD/SE bits
-     * and set possibly modified termination control bits in the Microcode
-     * SCSI_CFG1 Register Value.
-     */
-    scsi_cfg1 &= (~BIG_ENDIAN & ~DIS_TERM_DRV & ~TERM_POL & ~HVD_LVD_SE);
+               eep_config.serial_number_word1 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3);
 
-    /*
-     * Set SCSI_CFG1 Microcode Default Value
-     *
-     * Set possibly modified termination control and reset DIS_TERM_DRV
-     * bits in the Microcode SCSI_CFG1 Register Value.
-     *
-     * The microcode will set the SCSI_CFG1 register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, scsi_cfg1);
+               AdvSet3550EEPConfig(iop_base, &eep_config);
+       }
+       /*
+        * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the
+        * EEPROM configuration that was read.
+        *
+        * This is the mapping of EEPROM fields to Adv Library fields.
+        */
+       asc_dvc->wdtr_able = eep_config.wdtr_able;
+       asc_dvc->sdtr_able = eep_config.sdtr_able;
+       asc_dvc->ultra_able = eep_config.ultra_able;
+       asc_dvc->tagqng_able = eep_config.tagqng_able;
+       asc_dvc->cfg->disc_enable = eep_config.disc_enable;
+       asc_dvc->max_host_qng = eep_config.max_host_qng;
+       asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
+       asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID);
+       asc_dvc->start_motor = eep_config.start_motor;
+       asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
+       asc_dvc->bios_ctrl = eep_config.bios_ctrl;
+       asc_dvc->no_scam = eep_config.scam_tolerant;
+       asc_dvc->cfg->serial1 = eep_config.serial_number_word1;
+       asc_dvc->cfg->serial2 = eep_config.serial_number_word2;
+       asc_dvc->cfg->serial3 = eep_config.serial_number_word3;
+
+       /*
+        * Set the host maximum queuing (max. 253, min. 16) and the per device
+        * maximum queuing (max. 63, min. 4).
+        */
+       if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG) {
+               eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
+       } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG) {
+               /* If the value is zero, assume it is uninitialized. */
+               if (eep_config.max_host_qng == 0) {
+                       eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
+               } else {
+                       eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG;
+               }
+       }
 
-    /*
-     * Set MEM_CFG Microcode Default Value
-     *
-     * The microcode will set the MEM_CFG register using this value
-     * after it is started below.
-     *
-     * MEM_CFG may be accessed as a word or byte, but only bits 0-7
-     * are defined.
-     *
-     * ASC-38C0800 has 16KB internal memory.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
-        BIOS_EN | RAM_SZ_16KB);
+       if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG) {
+               eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
+       } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG) {
+               /* If the value is zero, assume it is uninitialized. */
+               if (eep_config.max_dvc_qng == 0) {
+                       eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
+               } else {
+                       eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG;
+               }
+       }
 
-    /*
-     * Set SEL_MASK Microcode Default Value
-     *
-     * The microcode will set the SEL_MASK register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
-        ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
+       /*
+        * If 'max_dvc_qng' is greater than 'max_host_qng', then
+        * set 'max_dvc_qng' to 'max_host_qng'.
+        */
+       if (eep_config.max_dvc_qng > eep_config.max_host_qng) {
+               eep_config.max_dvc_qng = eep_config.max_host_qng;
+       }
 
-    /*
-     * Build the carrier freelist.
-     *
-     * Driver must have already allocated memory and set 'carrier_buf'.
-     */
-    ASC_ASSERT(asc_dvc->carrier_buf != NULL);
-
-    carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
-    asc_dvc->carr_freelist = NULL;
-    if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf)
-    {
-        buf_size = ADV_CARRIER_BUFSIZE;
-    } else
-    {
-        buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
-    }
+       /*
+        * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng'
+        * values based on possibly adjusted EEPROM values.
+        */
+       asc_dvc->max_host_qng = eep_config.max_host_qng;
+       asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
+
+       /*
+        * If the EEPROM 'termination' field is set to automatic (0), then set
+        * the ADV_DVC_CFG 'termination' field to automatic also.
+        *
+        * If the termination is specified with a non-zero 'termination'
+        * value check that a legal value is set and set the ADV_DVC_CFG
+        * 'termination' field appropriately.
+        */
+       if (eep_config.termination == 0) {
+               asc_dvc->cfg->termination = 0;  /* auto termination */
+       } else {
+               /* Enable manual control with low off / high off. */
+               if (eep_config.termination == 1) {
+                       asc_dvc->cfg->termination = TERM_CTL_SEL;
+
+                       /* Enable manual control with low off / high on. */
+               } else if (eep_config.termination == 2) {
+                       asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H;
+
+                       /* Enable manual control with low on / high on. */
+               } else if (eep_config.termination == 3) {
+                       asc_dvc->cfg->termination =
+                           TERM_CTL_SEL | TERM_CTL_H | TERM_CTL_L;
+               } else {
+                       /*
+                        * The EEPROM 'termination' field contains a bad value. Use
+                        * automatic termination instead.
+                        */
+                       asc_dvc->cfg->termination = 0;
+                       warn_code |= ASC_WARN_EEPROM_TERMINATION;
+               }
+       }
 
-    do {
-        /*
-         * Get physical address for the carrier 'carrp'.
-         */
-        contig_len = sizeof(ADV_CARR_T);
-        carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL, (uchar *) carrp,
-            (ADV_SDCNT *) &contig_len, ADV_IS_CARRIER_FLAG));
-
-        buf_size -= sizeof(ADV_CARR_T);
-
-        /*
-         * If the current carrier is not physically contiguous, then
-         * maybe there was a page crossing. Try the next carrier aligned
-         * start address.
-         */
-        if (contig_len < sizeof(ADV_CARR_T))
-        {
-            carrp++;
-            continue;
-        }
-
-        carrp->carr_pa = carr_paddr;
-        carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));
-
-        /*
-         * Insert the carrier at the beginning of the freelist.
-         */
-        carrp->next_vpa = cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
-        asc_dvc->carr_freelist = carrp;
-
-        carrp++;
-    }
-    while (buf_size > 0);
+       return warn_code;
+}
 
-    /*
-     * Set-up the Host->RISC Initiator Command Queue (ICQ).
-     */
+/*
+ * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and
+ * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while
+ * all of this is done.
+ *
+ * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
+ *
+ * For a non-fatal error return a warning code. If there are no warnings
+ * then 0 is returned.
+ *
+ * Note: Chip is stopped on entry.
+ */
+static int __init AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc)
+{
+       AdvPortAddr iop_base;
+       ushort warn_code;
+       ADVEEP_38C0800_CONFIG eep_config;
+       int i;
+       uchar tid, termination;
+       ushort sdtr_speed = 0;
+
+       iop_base = asc_dvc->iop_base;
+
+       warn_code = 0;
+
+       /*
+        * Read the board's EEPROM configuration.
+        *
+        * Set default values if a bad checksum is found.
+        */
+       if (AdvGet38C0800EEPConfig(iop_base, &eep_config) !=
+           eep_config.check_sum) {
+               warn_code |= ASC_WARN_EEPROM_CHKSUM;
 
-    if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL)
-    {
-        asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
-        return ADV_ERROR;
-    }
-    asc_dvc->carr_freelist = (ADV_CARR_T *)
-        ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa));
+               /*
+                * Set EEPROM default values.
+                */
+               for (i = 0; i < sizeof(ADVEEP_38C0800_CONFIG); i++) {
+                       *((uchar *)&eep_config + i) =
+                           *((uchar *)&Default_38C0800_EEPROM_Config + i);
+               }
 
-    /*
-     * The first command issued will be placed in the stopper carrier.
-     */
-    asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+               /*
+                * Assume the 6 byte board serial number that was read
+                * from EEPROM is correct even if the EEPROM checksum
+                * failed.
+                */
+               eep_config.serial_number_word3 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1);
 
-    /*
-     * Set RISC ICQ physical address start value.
-     * carr_pa is LE, must be native before write
-     */
-    AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
+               eep_config.serial_number_word2 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2);
 
-    /*
-     * Set-up the RISC->Host Initiator Response Queue (IRQ).
-     */
-    if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL)
-    {
-        asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
-        return ADV_ERROR;
-    }
-    asc_dvc->carr_freelist = (ADV_CARR_T *)
-        ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa));
+               eep_config.serial_number_word1 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3);
 
-    /*
-     * The first command completed by the RISC will be placed in
-     * the stopper.
-     *
-     * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
-     * completed the RISC will set the ASC_RQ_STOPPER bit.
-     */
-    asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+               AdvSet38C0800EEPConfig(iop_base, &eep_config);
+       }
+       /*
+        * Set ADV_DVC_VAR and ADV_DVC_CFG variables from the
+        * EEPROM configuration that was read.
+        *
+        * This is the mapping of EEPROM fields to Adv Library fields.
+        */
+       asc_dvc->wdtr_able = eep_config.wdtr_able;
+       asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1;
+       asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2;
+       asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3;
+       asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4;
+       asc_dvc->tagqng_able = eep_config.tagqng_able;
+       asc_dvc->cfg->disc_enable = eep_config.disc_enable;
+       asc_dvc->max_host_qng = eep_config.max_host_qng;
+       asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
+       asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID);
+       asc_dvc->start_motor = eep_config.start_motor;
+       asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
+       asc_dvc->bios_ctrl = eep_config.bios_ctrl;
+       asc_dvc->no_scam = eep_config.scam_tolerant;
+       asc_dvc->cfg->serial1 = eep_config.serial_number_word1;
+       asc_dvc->cfg->serial2 = eep_config.serial_number_word2;
+       asc_dvc->cfg->serial3 = eep_config.serial_number_word3;
+
+       /*
+        * For every Target ID if any of its 'sdtr_speed[1234]' bits
+        * are set, then set an 'sdtr_able' bit for it.
+        */
+       asc_dvc->sdtr_able = 0;
+       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+               if (tid == 0) {
+                       sdtr_speed = asc_dvc->sdtr_speed1;
+               } else if (tid == 4) {
+                       sdtr_speed = asc_dvc->sdtr_speed2;
+               } else if (tid == 8) {
+                       sdtr_speed = asc_dvc->sdtr_speed3;
+               } else if (tid == 12) {
+                       sdtr_speed = asc_dvc->sdtr_speed4;
+               }
+               if (sdtr_speed & ADV_MAX_TID) {
+                       asc_dvc->sdtr_able |= (1 << tid);
+               }
+               sdtr_speed >>= 4;
+       }
 
-    /*
-     * Set RISC IRQ physical address start value.
-     *
-     * carr_pa is LE, must be native before write *
-     */
-    AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
-    asc_dvc->carr_pending_cnt = 0;
+       /*
+        * Set the host maximum queuing (max. 253, min. 16) and the per device
+        * maximum queuing (max. 63, min. 4).
+        */
+       if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG) {
+               eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
+       } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG) {
+               /* If the value is zero, assume it is uninitialized. */
+               if (eep_config.max_host_qng == 0) {
+                       eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
+               } else {
+                       eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG;
+               }
+       }
 
-    AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES,
-        (ADV_INTR_ENABLE_HOST_INTR | ADV_INTR_ENABLE_GLOBAL_INTR));
+       if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG) {
+               eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
+       } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG) {
+               /* If the value is zero, assume it is uninitialized. */
+               if (eep_config.max_dvc_qng == 0) {
+                       eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
+               } else {
+                       eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG;
+               }
+       }
 
-    AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word);
-    AdvWriteWordRegister(iop_base, IOPW_PC, word);
+       /*
+        * If 'max_dvc_qng' is greater than 'max_host_qng', then
+        * set 'max_dvc_qng' to 'max_host_qng'.
+        */
+       if (eep_config.max_dvc_qng > eep_config.max_host_qng) {
+               eep_config.max_dvc_qng = eep_config.max_host_qng;
+       }
 
-    /* finally, finally, gentlemen, start your engine */
-    AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN);
+       /*
+        * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng'
+        * values based on possibly adjusted EEPROM values.
+        */
+       asc_dvc->max_host_qng = eep_config.max_host_qng;
+       asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
+
+       /*
+        * If the EEPROM 'termination' field is set to automatic (0), then set
+        * the ADV_DVC_CFG 'termination' field to automatic also.
+        *
+        * If the termination is specified with a non-zero 'termination'
+        * value check that a legal value is set and set the ADV_DVC_CFG
+        * 'termination' field appropriately.
+        */
+       if (eep_config.termination_se == 0) {
+               termination = 0;        /* auto termination for SE */
+       } else {
+               /* Enable manual control with low off / high off. */
+               if (eep_config.termination_se == 1) {
+                       termination = 0;
+
+                       /* Enable manual control with low off / high on. */
+               } else if (eep_config.termination_se == 2) {
+                       termination = TERM_SE_HI;
+
+                       /* Enable manual control with low on / high on. */
+               } else if (eep_config.termination_se == 3) {
+                       termination = TERM_SE;
+               } else {
+                       /*
+                        * The EEPROM 'termination_se' field contains a bad value.
+                        * Use automatic termination instead.
+                        */
+                       termination = 0;
+                       warn_code |= ASC_WARN_EEPROM_TERMINATION;
+               }
+       }
 
-    /*
-     * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
-     * Resets should be performed. The RISC has to be running
-     * to issue a SCSI Bus Reset.
-     */
-    if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS)
-    {
-        /*
-         * If the BIOS Signature is present in memory, restore the
-         * BIOS Handshake Configuration Table and do not perform
-         * a SCSI Bus Reset.
-         */
-        if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM)/2] == 0x55AA)
-        {
-            /*
-             * Restore per TID negotiated values.
-             */
-            AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-            AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-            AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-            for (tid = 0; tid <= ADV_MAX_TID; tid++)
-            {
-                AdvWriteByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-                    max_cmd[tid]);
-            }
-        } else
-        {
-            if (AdvResetSB(asc_dvc) != ADV_TRUE)
-            {
-                warn_code = ASC_WARN_BUSRESET_ERROR;
-            }
-        }
-    }
+       if (eep_config.termination_lvd == 0) {
+               asc_dvc->cfg->termination = termination;        /* auto termination for LVD */
+       } else {
+               /* Enable manual control with low off / high off. */
+               if (eep_config.termination_lvd == 1) {
+                       asc_dvc->cfg->termination = termination;
+
+                       /* Enable manual control with low off / high on. */
+               } else if (eep_config.termination_lvd == 2) {
+                       asc_dvc->cfg->termination = termination | TERM_LVD_HI;
+
+                       /* Enable manual control with low on / high on. */
+               } else if (eep_config.termination_lvd == 3) {
+                       asc_dvc->cfg->termination = termination | TERM_LVD;
+               } else {
+                       /*
+                        * The EEPROM 'termination_lvd' field contains a bad value.
+                        * Use automatic termination instead.
+                        */
+                       asc_dvc->cfg->termination = termination;
+                       warn_code |= ASC_WARN_EEPROM_TERMINATION;
+               }
+       }
 
-    return warn_code;
+       return warn_code;
 }
 
 /*
- * Initialize the ASC-38C1600.
+ * Read the board's EEPROM configuration. Set fields in ASC_DVC_VAR and
+ * ASC_DVC_CFG based on the EEPROM settings. The chip is stopped while
+ * all of this is done.
  *
  * On failure set the ASC_DVC_VAR field 'err_code' and return ADV_ERROR.
  *
  * For a non-fatal error return a warning code. If there are no warnings
  * then 0 is returned.
  *
- * Needed after initialization for error recovery.
+ * Note: Chip is stopped on entry.
  */
-STATIC int
-AdvInitAsc38C1600Driver(ADV_DVC_VAR *asc_dvc)
+static int __init AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
 {
-    AdvPortAddr iop_base;
-    ushort      warn_code;
-    ADV_DCNT    sum;
-    int         begin_addr;
-    int         end_addr;
-    ushort      code_sum;
-    long        word;
-    int         j;
-    int         adv_asc38C1600_expanded_size;
-    ADV_CARR_T  *carrp;
-    ADV_DCNT    contig_len;
-    ADV_SDCNT   buf_size;
-    ADV_PADDR   carr_paddr;
-    int         i;
-    ushort      scsi_cfg1;
-    uchar       byte;
-    uchar       tid;
-    ushort      bios_mem[ASC_MC_BIOSLEN/2]; /* BIOS RISC Memory 0x40-0x8F. */
-    ushort      wdtr_able, sdtr_able, ppr_able, tagqng_able;
-    uchar       max_cmd[ASC_MAX_TID + 1];
-
-    /* If there is already an error, don't continue. */
-    if (asc_dvc->err_code != 0)
-    {
-        return ADV_ERROR;
-    }
-
-    /*
-     * The caller must set 'chip_type' to ADV_CHIP_ASC38C1600.
-     */
-    if (asc_dvc->chip_type != ADV_CHIP_ASC38C1600)
-    {
-        asc_dvc->err_code = ASC_IERR_BAD_CHIPTYPE;
-        return ADV_ERROR;
-    }
-
-    warn_code = 0;
-    iop_base = asc_dvc->iop_base;
-
-    /*
-     * Save the RISC memory BIOS region before writing the microcode.
-     * The BIOS may already be loaded and using its RISC LRAM region
-     * so its region must be saved and restored.
-     *
-     * Note: This code makes the assumption, which is currently true,
-     * that a chip reset does not clear RISC LRAM.
-     */
-    for (i = 0; i < ASC_MC_BIOSLEN/2; i++)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), bios_mem[i]);
-    }
-
-    /*
-     * Save current per TID negotiated values.
-     */
-    AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-    AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-    AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
-    AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-    for (tid = 0; tid <= ASC_MAX_TID; tid++)
-    {
-        AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-            max_cmd[tid]);
-    }
-
-    /*
-     * RAM BIST (Built-In Self Test)
-     *
-     * Address : I/O base + offset 0x38h register (byte).
-     * Function: Bit 7-6(RW) : RAM mode
-     *                          Normal Mode   : 0x00
-     *                          Pre-test Mode : 0x40
-     *                          RAM Test Mode : 0x80
-     *           Bit 5       : unused
-     *           Bit 4(RO)   : Done bit
-     *           Bit 3-0(RO) : Status
-     *                          Host Error    : 0x08
-     *                          Int_RAM Error : 0x04
-     *                          RISC Error    : 0x02
-     *                          SCSI Error    : 0x01
-     *                          No Error      : 0x00
-     *
-     * Note: RAM BIST code should be put right here, before loading the
-     * microcode and after saving the RISC memory BIOS region.
-     */
-
-    /*
-     * LRAM Pre-test
-     *
-     * Write PRE_TEST_MODE (0x40) to register and wait for 10 milliseconds.
-     * If Done bit not set or low nibble not PRE_TEST_VALUE (0x05), return
-     * an error. Reset to NORMAL_MODE (0x00) and do again. If cannot reset
-     * to NORMAL_MODE, return an error too.
-     */
-    for (i = 0; i < 2; i++)
-    {
-        AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, PRE_TEST_MODE);
-        DvcSleepMilliSecond(10);  /* Wait for 10ms before reading back. */
-        byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
-        if ((byte & RAM_TEST_DONE) == 0 || (byte & 0x0F) != PRE_TEST_VALUE)
-        {
-            asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
-            return ADV_ERROR;
-        }
-
-        AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
-        DvcSleepMilliSecond(10);  /* Wait for 10ms before reading back. */
-        if (AdvReadByteRegister(iop_base, IOPB_RAM_BIST)
-            != NORMAL_VALUE)
-        {
-            asc_dvc->err_code |= ASC_IERR_BIST_PRE_TEST;
-            return ADV_ERROR;
-        }
-    }
-
-    /*
-     * LRAM Test - It takes about 1.5 ms to run through the test.
-     *
-     * Write RAM_TEST_MODE (0x80) to register and wait for 10 milliseconds.
-     * If Done bit not set or Status not 0, save register byte, set the
-     * err_code, and return an error.
-     */
-    AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, RAM_TEST_MODE);
-    DvcSleepMilliSecond(10);  /* Wait for 10ms before checking status. */
-
-    byte = AdvReadByteRegister(iop_base, IOPB_RAM_BIST);
-    if ((byte & RAM_TEST_DONE) == 0 || (byte & RAM_TEST_STATUS) != 0)
-    {
-        /* Get here if Done bit not set or Status not 0. */
-        asc_dvc->bist_err_code = byte;  /* for BIOS display message */
-        asc_dvc->err_code |= ASC_IERR_BIST_RAM_TEST;
-        return ADV_ERROR;
-    }
-
-    /* We need to reset back to normal mode after LRAM test passes. */
-    AdvWriteByteRegister(iop_base, IOPB_RAM_BIST, NORMAL_MODE);
-
-    /*
-     * Load the Microcode
-     *
-     * Write the microcode image to RISC memory starting at address 0.
-     *
-     */
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
-
-    /*
-     * Assume the following compressed format of the microcode buffer:
-     *
-     *  254 word (508 byte) table indexed by byte code followed
-     *  by the following byte codes:
-     *
-     *    1-Byte Code:
-     *      00: Emit word 0 in table.
-     *      01: Emit word 1 in table.
-     *      .
-     *      FD: Emit word 253 in table.
-     *
-     *    Multi-Byte Code:
-     *      FE WW WW: (3 byte code) Word to emit is the next word WW WW.
-     *      FF BB WW WW: (4 byte code) Emit BB count times next word WW WW.
-     */
-    word = 0;
-    for (i = 253 * 2; i < _adv_asc38C1600_size; i++)
-    {
-        if (_adv_asc38C1600_buf[i] == 0xff)
-        {
-            for (j = 0; j < _adv_asc38C1600_buf[i + 1]; j++)
-            {
-                AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                     _adv_asc38C1600_buf[i + 3] << 8) |
-                     _adv_asc38C1600_buf[i + 2]));
-                word++;
-            }
-           i += 3;
-        } else if (_adv_asc38C1600_buf[i] == 0xfe)
-        {
-                AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                     _adv_asc38C1600_buf[i + 2] << 8) |
-                     _adv_asc38C1600_buf[i + 1]));
-            i += 2;
-            word++;
-        } else
-        {
-            AdvWriteWordAutoIncLram(iop_base, (((ushort)
-                 _adv_asc38C1600_buf[(_adv_asc38C1600_buf[i] * 2) + 1] << 8) |
-                 _adv_asc38C1600_buf[_adv_asc38C1600_buf[i] * 2]));
-            word++;
-        }
-    }
-
-    /*
-     * Set 'word' for later use to clear the rest of memory and save
-     * the expanded mcode size.
-     */
-    word *= 2;
-    adv_asc38C1600_expanded_size = word;
-
-    /*
-     * Clear the rest of ASC-38C1600 Internal RAM (32KB).
-     */
-    for (; word < ADV_38C1600_MEMSIZE; word += 2)
-    {
-        AdvWriteWordAutoIncLram(iop_base, 0);
-    }
-
-    /*
-     * Verify the microcode checksum.
-     */
-    sum = 0;
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, 0);
-
-    for (word = 0; word < adv_asc38C1600_expanded_size; word += 2)
-    {
-        sum += AdvReadWordAutoIncLram(iop_base);
-    }
-
-    if (sum != _adv_asc38C1600_chksum)
-    {
-        asc_dvc->err_code |= ASC_IERR_MCODE_CHKSUM;
-        return ADV_ERROR;
-    }
-
-    /*
-     * Restore the RISC memory BIOS region.
-     */
-    for (i = 0; i < ASC_MC_BIOSLEN/2; i++)
-    {
-        AdvWriteWordLram(iop_base, ASC_MC_BIOSMEM + (2 * i), bios_mem[i]);
-    }
-
-    /*
-     * Calculate and write the microcode code checksum to the microcode
-     * code checksum location ASC_MC_CODE_CHK_SUM (0x2C).
-     */
-    AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, begin_addr);
-    AdvReadWordLram(iop_base, ASC_MC_CODE_END_ADDR, end_addr);
-    code_sum = 0;
-    AdvWriteWordRegister(iop_base, IOPW_RAM_ADDR, begin_addr);
-    for (word = begin_addr; word < end_addr; word += 2)
-    {
-        code_sum += AdvReadWordAutoIncLram(iop_base);
-    }
-    AdvWriteWordLram(iop_base, ASC_MC_CODE_CHK_SUM, code_sum);
-
-    /*
-     * Read microcode version and date.
-     */
-    AdvReadWordLram(iop_base, ASC_MC_VERSION_DATE, asc_dvc->cfg->mcode_date);
-    AdvReadWordLram(iop_base, ASC_MC_VERSION_NUM, asc_dvc->cfg->mcode_version);
-
-    /*
-     * Set the chip type to indicate the ASC38C1600.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_CHIP_TYPE, ADV_CHIP_ASC38C1600);
-
-    /*
-     * Write 1 to bit 14 'DIS_TERM_DRV' in the SCSI_CFG1 register.
-     * When DIS_TERM_DRV set to 1, C_DET[3:0] will reflect current
-     * cable detection and then we are able to read C_DET[3:0].
-     *
-     * Note: We will reset DIS_TERM_DRV to 0 in the 'Set SCSI_CFG1
-     * Microcode Default Value' section below.
-     */
-    scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
-    AdvWriteWordRegister(iop_base, IOPW_SCSI_CFG1, scsi_cfg1 | DIS_TERM_DRV);
-
-    /*
-     * If the PCI Configuration Command Register "Parity Error Response
-     * Control" Bit was clear (0), then set the microcode variable
-     * 'control_flag' CONTROL_FLAG_IGNORE_PERR flag to tell the microcode
-     * to ignore DMA parity errors.
-     */
-    if (asc_dvc->cfg->control_flag & CONTROL_FLAG_IGNORE_PERR)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-        word |= CONTROL_FLAG_IGNORE_PERR;
-        AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-    }
-
-    /*
-     * If the BIOS control flag AIPP (Asynchronous Information
-     * Phase Protection) disable bit is not set, then set the firmware
-     * 'control_flag' CONTROL_FLAG_ENABLE_AIPP bit to enable
-     * AIPP checking and encoding.
-     */
-    if ((asc_dvc->bios_ctrl & BIOS_CTRL_AIPP_DIS) == 0)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-        word |= CONTROL_FLAG_ENABLE_AIPP;
-        AdvWriteWordLram(iop_base, ASC_MC_CONTROL_FLAG, word);
-    }
-
-    /*
-     * For ASC-38C1600 use DMA_CFG0 default values: FIFO_THRESH_80B [6:4],
-     * and START_CTL_TH [3:2].
-     */
-    AdvWriteByteRegister(iop_base, IOPB_DMA_CFG0,
-        FIFO_THRESH_80B | START_CTL_TH | READ_CMD_MRM);
-
-    /*
-     * Microcode operating variables for WDTR, SDTR, and command tag
-     * queuing will be set in AdvInquiryHandling() based on what a
-     * device reports it is capable of in Inquiry byte 7.
-     *
-     * If SCSI Bus Resets have been disabled, then directly set
-     * SDTR and WDTR from the EEPROM configuration. This will allow
-     * the BIOS and warm boot to work without a SCSI bus hang on
-     * the Inquiry caused by host and target mismatched DTR values.
-     * Without the SCSI Bus Reset, before an Inquiry a device can't
-     * be assumed to be in Asynchronous, Narrow mode.
-     */
-    if ((asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS) == 0)
-    {
-        AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, asc_dvc->wdtr_able);
-        AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, asc_dvc->sdtr_able);
-    }
-
-    /*
-     * Set microcode operating variables for DISC and SDTR_SPEED1,
-     * SDTR_SPEED2, SDTR_SPEED3, and SDTR_SPEED4 based on the EEPROM
-     * configuration values.
-     *
-     * The SDTR per TID bitmask overrides the SDTR_SPEED1, SDTR_SPEED2,
-     * SDTR_SPEED3, and SDTR_SPEED4 values so it is safe to set them
-     * without determining here whether the device supports SDTR.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DISC_ENABLE, asc_dvc->cfg->disc_enable);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED1, asc_dvc->sdtr_speed1);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED2, asc_dvc->sdtr_speed2);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED3, asc_dvc->sdtr_speed3);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_SPEED4, asc_dvc->sdtr_speed4);
-
-    /*
-     * Set SCSI_CFG0 Microcode Default Value.
-     *
-     * The microcode will set the SCSI_CFG0 register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG0,
-        PARITY_EN | QUEUE_128 | SEL_TMO_LONG | OUR_ID_EN |
-        asc_dvc->chip_scsi_id);
-
-    /*
-     * Calculate SCSI_CFG1 Microcode Default Value.
-     *
-     * The microcode will set the SCSI_CFG1 register using this value
-     * after it is started below.
-     *
-     * Each ASC-38C1600 function has only two cable detect bits.
-     * The bus mode override bits are in IOPB_SOFT_OVER_WR.
-     */
-    scsi_cfg1 = AdvReadWordRegister(iop_base, IOPW_SCSI_CFG1);
-
-    /*
-     * If the cable is reversed all of the SCSI_CTRL register signals
-     * will be set. Check for and return an error if this condition is
-     * found.
-     */
-    if ((AdvReadWordRegister(iop_base, IOPW_SCSI_CTRL) & 0x3F07) == 0x3F07)
-    {
-        asc_dvc->err_code |= ASC_IERR_REVERSED_CABLE;
-        return ADV_ERROR;
-    }
-
-    /*
-     * Each ASC-38C1600 function has two connectors. Only an HVD device
-     * can not be connected to either connector. An LVD device or SE device
-     * may be connected to either connecor. If an SE device is connected,
-     * then at most Ultra speed (20 Mhz) can be used on both connectors.
-     *
-     * If an HVD device is attached, return an error.
-     */
-    if (scsi_cfg1 & HVD)
-    {
-        asc_dvc->err_code |= ASC_IERR_HVD_DEVICE;
-        return ADV_ERROR;
-    }
-
-    /*
-     * Each function in the ASC-38C1600 uses only the SE cable detect and
-     * termination because there are two connectors for each function. Each
-     * function may use either LVD or SE mode. Corresponding the SE automatic
-     * termination control EEPROM bits are used for each function. Each
-     * function has its own EEPROM. If SE automatic control is enabled for
-     * the function, then set the termination value based on a table listed
-     * in a_condor.h.
-     *
-     * If manual termination is specified in the EEPROM for the function,
-     * then 'termination' was set-up in AscInitFrom38C1600EEPROM() and is
-     * ready to be 'ored' into SCSI_CFG1.
-     */
-    if ((asc_dvc->cfg->termination & TERM_SE) == 0)
-    {
-        /* SE automatic termination control is enabled. */
-        switch(scsi_cfg1 & C_DET_SE)
-        {
-            /* TERM_SE_HI: on, TERM_SE_LO: on */
-            case 0x1: case 0x2: case 0x3:
-                asc_dvc->cfg->termination |= TERM_SE;
-                break;
-
-            case 0x0:
-                if (ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) == 0)
-                {
-                    /* Function 0 - TERM_SE_HI: off, TERM_SE_LO: off */
-                }
-                else
-                {
-                    /* Function 1 - TERM_SE_HI: on, TERM_SE_LO: off */
-                    asc_dvc->cfg->termination |= TERM_SE_HI;
-                }
-                break;
-        }
-    }
-
-    /*
-     * Clear any set TERM_SE bits.
-     */
-    scsi_cfg1 &= ~TERM_SE;
-
-    /*
-     * Invert the TERM_SE bits and then set 'scsi_cfg1'.
-     */
-    scsi_cfg1 |= (~asc_dvc->cfg->termination & TERM_SE);
-
-    /*
-     * Clear Big Endian and Terminator Polarity bits and set possibly
-     * modified termination control bits in the Microcode SCSI_CFG1
-     * Register Value.
-     *
-     * Big Endian bit is not used even on big endian machines.
-     */
-    scsi_cfg1 &= (~BIG_ENDIAN & ~DIS_TERM_DRV & ~TERM_POL);
-
-    /*
-     * Set SCSI_CFG1 Microcode Default Value
-     *
-     * Set possibly modified termination control bits in the Microcode
-     * SCSI_CFG1 Register Value.
-     *
-     * The microcode will set the SCSI_CFG1 register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SCSI_CFG1, scsi_cfg1);
-
-    /*
-     * Set MEM_CFG Microcode Default Value
-     *
-     * The microcode will set the MEM_CFG register using this value
-     * after it is started below.
-     *
-     * MEM_CFG may be accessed as a word or byte, but only bits 0-7
-     * are defined.
-     *
-     * ASC-38C1600 has 32KB internal memory.
-     *
-     * XXX - Since ASC38C1600 Rev.3 has a Local RAM failure issue, we come
-     * out a special 16K Adv Library and Microcode version. After the issue
-     * resolved, we should turn back to the 32K support. Both a_condor.h and
-     * mcode.sas files also need to be updated.
-     *
-     * AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG,
-     *  BIOS_EN | RAM_SZ_32KB);
-     */
-     AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_MEM_CFG, BIOS_EN | RAM_SZ_16KB);
-
-    /*
-     * Set SEL_MASK Microcode Default Value
-     *
-     * The microcode will set the SEL_MASK register using this value
-     * after it is started below.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_DEFAULT_SEL_MASK,
-        ADV_TID_TO_TIDMASK(asc_dvc->chip_scsi_id));
-
-    /*
-     * Build the carrier freelist.
-     *
-     * Driver must have already allocated memory and set 'carrier_buf'.
-     */
-
-    ASC_ASSERT(asc_dvc->carrier_buf != NULL);
-
-    carrp = (ADV_CARR_T *) ADV_16BALIGN(asc_dvc->carrier_buf);
-    asc_dvc->carr_freelist = NULL;
-    if (carrp == (ADV_CARR_T *) asc_dvc->carrier_buf)
-    {
-        buf_size = ADV_CARRIER_BUFSIZE;
-    } else
-    {
-        buf_size = ADV_CARRIER_BUFSIZE - sizeof(ADV_CARR_T);
-    }
-
-    do {
-        /*
-         * Get physical address for the carrier 'carrp'.
-         */
-        contig_len = sizeof(ADV_CARR_T);
-        carr_paddr = cpu_to_le32(DvcGetPhyAddr(asc_dvc, NULL, (uchar *) carrp,
-            (ADV_SDCNT *) &contig_len, ADV_IS_CARRIER_FLAG));
-
-        buf_size -= sizeof(ADV_CARR_T);
-
-        /*
-         * If the current carrier is not physically contiguous, then
-         * maybe there was a page crossing. Try the next carrier aligned
-         * start address.
-         */
-        if (contig_len < sizeof(ADV_CARR_T))
-        {
-            carrp++;
-            continue;
-        }
-
-        carrp->carr_pa = carr_paddr;
-        carrp->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(carrp));
-
-        /*
-         * Insert the carrier at the beginning of the freelist.
-         */
-        carrp->next_vpa = cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
-        asc_dvc->carr_freelist = carrp;
-
-        carrp++;
-    }
-    while (buf_size > 0);
-
-    /*
-     * Set-up the Host->RISC Initiator Command Queue (ICQ).
-     */
-    if ((asc_dvc->icq_sp = asc_dvc->carr_freelist) == NULL)
-    {
-        asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
-        return ADV_ERROR;
-    }
-    asc_dvc->carr_freelist = (ADV_CARR_T *)
-        ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->icq_sp->next_vpa));
-
-    /*
-     * The first command issued will be placed in the stopper carrier.
-     */
-    asc_dvc->icq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
-
-    /*
-     * Set RISC ICQ physical address start value. Initialize the
-     * COMMA register to the same value otherwise the RISC will
-     * prematurely detect a command is available.
-     */
-    AdvWriteDWordLramNoSwap(iop_base, ASC_MC_ICQ, asc_dvc->icq_sp->carr_pa);
-    AdvWriteDWordRegister(iop_base, IOPDW_COMMA,
-        le32_to_cpu(asc_dvc->icq_sp->carr_pa));
-
-    /*
-     * Set-up the RISC->Host Initiator Response Queue (IRQ).
-     */
-    if ((asc_dvc->irq_sp = asc_dvc->carr_freelist) == NULL)
-    {
-        asc_dvc->err_code |= ASC_IERR_NO_CARRIER;
-        return ADV_ERROR;
-    }
-    asc_dvc->carr_freelist = (ADV_CARR_T *)
-        ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->next_vpa));
-
-    /*
-     * The first command completed by the RISC will be placed in
-     * the stopper.
-     *
-     * Note: Set 'next_vpa' to ASC_CQ_STOPPER. When the request is
-     * completed the RISC will set the ASC_RQ_STOPPER bit.
-     */
-    asc_dvc->irq_sp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
-
-    /*
-     * Set RISC IRQ physical address start value.
-     */
-    AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IRQ, asc_dvc->irq_sp->carr_pa);
-    asc_dvc->carr_pending_cnt = 0;
-
-    AdvWriteByteRegister(iop_base, IOPB_INTR_ENABLES,
-        (ADV_INTR_ENABLE_HOST_INTR | ADV_INTR_ENABLE_GLOBAL_INTR));
-    AdvReadWordLram(iop_base, ASC_MC_CODE_BEGIN_ADDR, word);
-    AdvWriteWordRegister(iop_base, IOPW_PC, word);
-
-    /* finally, finally, gentlemen, start your engine */
-    AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_RUN);
-
-    /*
-     * Reset the SCSI Bus if the EEPROM indicates that SCSI Bus
-     * Resets should be performed. The RISC has to be running
-     * to issue a SCSI Bus Reset.
-     */
-    if (asc_dvc->bios_ctrl & BIOS_CTRL_RESET_SCSI_BUS)
-    {
-        /*
-         * If the BIOS Signature is present in memory, restore the
-         * per TID microcode operating variables.
-         */
-        if (bios_mem[(ASC_MC_BIOS_SIGNATURE - ASC_MC_BIOSMEM)/2] == 0x55AA)
-        {
-            /*
-             * Restore per TID negotiated values.
-             */
-            AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-            AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-            AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
-            AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-            for (tid = 0; tid <= ASC_MAX_TID; tid++)
-            {
-                AdvWriteByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-                    max_cmd[tid]);
-            }
-        } else
-        {
-            if (AdvResetSB(asc_dvc) != ADV_TRUE)
-            {
-                warn_code = ASC_WARN_BUSRESET_ERROR;
-            }
-        }
-    }
-
-    return warn_code;
-}
-
-/*
- * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and
- * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while
- * all of this is done.
- *
- * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
- *
- * For a non-fatal error return a warning code. If there are no warnings
- * then 0 is returned.
- *
- * Note: Chip is stopped on entry.
- */
-STATIC int __init
-AdvInitFrom3550EEP(ADV_DVC_VAR *asc_dvc)
-{
-    AdvPortAddr         iop_base;
-    ushort              warn_code;
-    ADVEEP_3550_CONFIG  eep_config;
-    int                 i;
-
-    iop_base = asc_dvc->iop_base;
-
-    warn_code = 0;
-
-    /*
-     * Read the board's EEPROM configuration.
-     *
-     * Set default values if a bad checksum is found.
-     */
-    if (AdvGet3550EEPConfig(iop_base, &eep_config) != eep_config.check_sum)
-    {
-        warn_code |= ASC_WARN_EEPROM_CHKSUM;
-
-        /*
-         * Set EEPROM default values.
-         */
-        for (i = 0; i < sizeof(ADVEEP_3550_CONFIG); i++)
-        {
-            *((uchar *) &eep_config + i) =
-                *((uchar *) &Default_3550_EEPROM_Config + i);
-        }
-
-        /*
-         * Assume the 6 byte board serial number that was read
-         * from EEPROM is correct even if the EEPROM checksum
-         * failed.
-         */
-        eep_config.serial_number_word3 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1);
-
-        eep_config.serial_number_word2 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2);
-
-        eep_config.serial_number_word1 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3);
-
-        AdvSet3550EEPConfig(iop_base, &eep_config);
-    }
-    /*
-     * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the
-     * EEPROM configuration that was read.
-     *
-     * This is the mapping of EEPROM fields to Adv Library fields.
-     */
-    asc_dvc->wdtr_able = eep_config.wdtr_able;
-    asc_dvc->sdtr_able = eep_config.sdtr_able;
-    asc_dvc->ultra_able = eep_config.ultra_able;
-    asc_dvc->tagqng_able = eep_config.tagqng_able;
-    asc_dvc->cfg->disc_enable = eep_config.disc_enable;
-    asc_dvc->max_host_qng = eep_config.max_host_qng;
-    asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
-    asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID);
-    asc_dvc->start_motor = eep_config.start_motor;
-    asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
-    asc_dvc->bios_ctrl = eep_config.bios_ctrl;
-    asc_dvc->no_scam = eep_config.scam_tolerant;
-    asc_dvc->cfg->serial1 = eep_config.serial_number_word1;
-    asc_dvc->cfg->serial2 = eep_config.serial_number_word2;
-    asc_dvc->cfg->serial3 = eep_config.serial_number_word3;
-
-    /*
-     * Set the host maximum queuing (max. 253, min. 16) and the per device
-     * maximum queuing (max. 63, min. 4).
-     */
-    if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG)
-    {
-        eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
-    } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG)
-    {
-        /* If the value is zero, assume it is uninitialized. */
-        if (eep_config.max_host_qng == 0)
-        {
-            eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
-        } else
-        {
-            eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG;
-        }
-    }
-
-    if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG)
-    {
-        eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
-    } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG)
-    {
-        /* If the value is zero, assume it is uninitialized. */
-        if (eep_config.max_dvc_qng == 0)
-        {
-            eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
-        } else
-        {
-            eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG;
-        }
-    }
-
-    /*
-     * If 'max_dvc_qng' is greater than 'max_host_qng', then
-     * set 'max_dvc_qng' to 'max_host_qng'.
-     */
-    if (eep_config.max_dvc_qng > eep_config.max_host_qng)
-    {
-        eep_config.max_dvc_qng = eep_config.max_host_qng;
-    }
-
-    /*
-     * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng'
-     * values based on possibly adjusted EEPROM values.
-     */
-    asc_dvc->max_host_qng = eep_config.max_host_qng;
-    asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
-
-
-    /*
-     * If the EEPROM 'termination' field is set to automatic (0), then set
-     * the ADV_DVC_CFG 'termination' field to automatic also.
-     *
-     * If the termination is specified with a non-zero 'termination'
-     * value check that a legal value is set and set the ADV_DVC_CFG
-     * 'termination' field appropriately.
-     */
-    if (eep_config.termination == 0)
-    {
-        asc_dvc->cfg->termination = 0;    /* auto termination */
-    } else
-    {
-        /* Enable manual control with low off / high off. */
-        if (eep_config.termination == 1)
-        {
-            asc_dvc->cfg->termination = TERM_CTL_SEL;
-
-        /* Enable manual control with low off / high on. */
-        } else if (eep_config.termination == 2)
-        {
-            asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H;
-
-        /* Enable manual control with low on / high on. */
-        } else if (eep_config.termination == 3)
-        {
-            asc_dvc->cfg->termination = TERM_CTL_SEL | TERM_CTL_H | TERM_CTL_L;
-        } else
-        {
-            /*
-             * The EEPROM 'termination' field contains a bad value. Use
-             * automatic termination instead.
-             */
-            asc_dvc->cfg->termination = 0;
-            warn_code |= ASC_WARN_EEPROM_TERMINATION;
-        }
-    }
-
-    return warn_code;
-}
-
-/*
- * Read the board's EEPROM configuration. Set fields in ADV_DVC_VAR and
- * ADV_DVC_CFG based on the EEPROM settings. The chip is stopped while
- * all of this is done.
- *
- * On failure set the ADV_DVC_VAR field 'err_code' and return ADV_ERROR.
- *
- * For a non-fatal error return a warning code. If there are no warnings
- * then 0 is returned.
- *
- * Note: Chip is stopped on entry.
- */
-STATIC int __init
-AdvInitFrom38C0800EEP(ADV_DVC_VAR *asc_dvc)
-{
-    AdvPortAddr              iop_base;
-    ushort                   warn_code;
-    ADVEEP_38C0800_CONFIG    eep_config;
-    int                      i;
-    uchar                    tid, termination;
-    ushort                   sdtr_speed = 0;
-
-    iop_base = asc_dvc->iop_base;
-
-    warn_code = 0;
-
-    /*
-     * Read the board's EEPROM configuration.
-     *
-     * Set default values if a bad checksum is found.
-     */
-    if (AdvGet38C0800EEPConfig(iop_base, &eep_config) != eep_config.check_sum)
-    {
-        warn_code |= ASC_WARN_EEPROM_CHKSUM;
-
-        /*
-         * Set EEPROM default values.
-         */
-        for (i = 0; i < sizeof(ADVEEP_38C0800_CONFIG); i++)
-        {
-            *((uchar *) &eep_config + i) =
-                *((uchar *) &Default_38C0800_EEPROM_Config + i);
-        }
-
-        /*
-         * Assume the 6 byte board serial number that was read
-         * from EEPROM is correct even if the EEPROM checksum
-         * failed.
-         */
-        eep_config.serial_number_word3 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1);
-
-        eep_config.serial_number_word2 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2);
-
-        eep_config.serial_number_word1 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3);
-
-        AdvSet38C0800EEPConfig(iop_base, &eep_config);
-    }
-    /*
-     * Set ADV_DVC_VAR and ADV_DVC_CFG variables from the
-     * EEPROM configuration that was read.
-     *
-     * This is the mapping of EEPROM fields to Adv Library fields.
-     */
-    asc_dvc->wdtr_able = eep_config.wdtr_able;
-    asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1;
-    asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2;
-    asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3;
-    asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4;
-    asc_dvc->tagqng_able = eep_config.tagqng_able;
-    asc_dvc->cfg->disc_enable = eep_config.disc_enable;
-    asc_dvc->max_host_qng = eep_config.max_host_qng;
-    asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
-    asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ADV_MAX_TID);
-    asc_dvc->start_motor = eep_config.start_motor;
-    asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
-    asc_dvc->bios_ctrl = eep_config.bios_ctrl;
-    asc_dvc->no_scam = eep_config.scam_tolerant;
-    asc_dvc->cfg->serial1 = eep_config.serial_number_word1;
-    asc_dvc->cfg->serial2 = eep_config.serial_number_word2;
-    asc_dvc->cfg->serial3 = eep_config.serial_number_word3;
-
-    /*
-     * For every Target ID if any of its 'sdtr_speed[1234]' bits
-     * are set, then set an 'sdtr_able' bit for it.
-     */
-    asc_dvc->sdtr_able = 0;
-    for (tid = 0; tid <= ADV_MAX_TID; tid++)
-    {
-        if (tid == 0)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed1;
-        } else if (tid == 4)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed2;
-        } else if (tid == 8)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed3;
-        } else if (tid == 12)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed4;
-        }
-        if (sdtr_speed & ADV_MAX_TID)
-        {
-            asc_dvc->sdtr_able |= (1 << tid);
-        }
-        sdtr_speed >>= 4;
-    }
-
-    /*
-     * Set the host maximum queuing (max. 253, min. 16) and the per device
-     * maximum queuing (max. 63, min. 4).
-     */
-    if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG)
-    {
-        eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
-    } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG)
-    {
-        /* If the value is zero, assume it is uninitialized. */
-        if (eep_config.max_host_qng == 0)
-        {
-            eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
-        } else
-        {
-            eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG;
-        }
-    }
-
-    if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG)
-    {
-        eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
-    } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG)
-    {
-        /* If the value is zero, assume it is uninitialized. */
-        if (eep_config.max_dvc_qng == 0)
-        {
-            eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
-        } else
-        {
-            eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG;
-        }
-    }
-
-    /*
-     * If 'max_dvc_qng' is greater than 'max_host_qng', then
-     * set 'max_dvc_qng' to 'max_host_qng'.
-     */
-    if (eep_config.max_dvc_qng > eep_config.max_host_qng)
-    {
-        eep_config.max_dvc_qng = eep_config.max_host_qng;
-    }
-
-    /*
-     * Set ADV_DVC_VAR 'max_host_qng' and ADV_DVC_VAR 'max_dvc_qng'
-     * values based on possibly adjusted EEPROM values.
-     */
-    asc_dvc->max_host_qng = eep_config.max_host_qng;
-    asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
-
-    /*
-     * If the EEPROM 'termination' field is set to automatic (0), then set
-     * the ADV_DVC_CFG 'termination' field to automatic also.
-     *
-     * If the termination is specified with a non-zero 'termination'
-     * value check that a legal value is set and set the ADV_DVC_CFG
-     * 'termination' field appropriately.
-     */
-    if (eep_config.termination_se == 0)
-    {
-        termination = 0;                         /* auto termination for SE */
-    } else
-    {
-        /* Enable manual control with low off / high off. */
-        if (eep_config.termination_se == 1)
-        {
-            termination = 0;
-
-        /* Enable manual control with low off / high on. */
-        } else if (eep_config.termination_se == 2)
-        {
-            termination = TERM_SE_HI;
-
-        /* Enable manual control with low on / high on. */
-        } else if (eep_config.termination_se == 3)
-        {
-            termination = TERM_SE;
-        } else
-        {
-            /*
-             * The EEPROM 'termination_se' field contains a bad value.
-             * Use automatic termination instead.
-             */
-            termination = 0;
-            warn_code |= ASC_WARN_EEPROM_TERMINATION;
-        }
-    }
-
-    if (eep_config.termination_lvd == 0)
-    {
-        asc_dvc->cfg->termination = termination; /* auto termination for LVD */
-    } else
-    {
-        /* Enable manual control with low off / high off. */
-        if (eep_config.termination_lvd == 1)
-        {
-            asc_dvc->cfg->termination = termination;
-
-        /* Enable manual control with low off / high on. */
-        } else if (eep_config.termination_lvd == 2)
-        {
-            asc_dvc->cfg->termination = termination | TERM_LVD_HI;
-
-        /* Enable manual control with low on / high on. */
-        } else if (eep_config.termination_lvd == 3)
-        {
-            asc_dvc->cfg->termination =
-                termination | TERM_LVD;
-        } else
-        {
-            /*
-             * The EEPROM 'termination_lvd' field contains a bad value.
-             * Use automatic termination instead.
-             */
-            asc_dvc->cfg->termination = termination;
-            warn_code |= ASC_WARN_EEPROM_TERMINATION;
-        }
-    }
-
-    return warn_code;
-}
-
-/*
- * Read the board's EEPROM configuration. Set fields in ASC_DVC_VAR and
- * ASC_DVC_CFG based on the EEPROM settings. The chip is stopped while
- * all of this is done.
- *
- * On failure set the ASC_DVC_VAR field 'err_code' and return ADV_ERROR.
- *
- * For a non-fatal error return a warning code. If there are no warnings
- * then 0 is returned.
- *
- * Note: Chip is stopped on entry.
- */
-STATIC int __init
-AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
-{
-    AdvPortAddr              iop_base;
-    ushort                   warn_code;
-    ADVEEP_38C1600_CONFIG    eep_config;
-    int                      i;
-    uchar                    tid, termination;
-    ushort                   sdtr_speed = 0;
+       AdvPortAddr iop_base;
+       ushort warn_code;
+       ADVEEP_38C1600_CONFIG eep_config;
+       int i;
+       uchar tid, termination;
+       ushort sdtr_speed = 0;
+
+       iop_base = asc_dvc->iop_base;
+
+       warn_code = 0;
+
+       /*
+        * Read the board's EEPROM configuration.
+        *
+        * Set default values if a bad checksum is found.
+        */
+       if (AdvGet38C1600EEPConfig(iop_base, &eep_config) !=
+           eep_config.check_sum) {
+               warn_code |= ASC_WARN_EEPROM_CHKSUM;
 
-    iop_base = asc_dvc->iop_base;
+               /*
+                * Set EEPROM default values.
+                */
+               for (i = 0; i < sizeof(ADVEEP_38C1600_CONFIG); i++) {
+                       if (i == 1
+                           && ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) !=
+                           0) {
+                               /*
+                                * Set Function 1 EEPROM Word 0 MSB
+                                *
+                                * Clear the BIOS_ENABLE (bit 14) and INTAB (bit 11)
+                                * EEPROM bits.
+                                *
+                                * Disable Bit 14 (BIOS_ENABLE) to fix SPARC Ultra 60 and
+                                * old Mac system booting problem. The Expansion ROM must
+                                * be disabled in Function 1 for these systems.
+                                *
+                                */
+                               *((uchar *)&eep_config + i) =
+                                   ((*
+                                     ((uchar *)&Default_38C1600_EEPROM_Config
+                                      +
+                                      i)) &
+                                    (~
+                                     (((ADV_EEPROM_BIOS_ENABLE |
+                                        ADV_EEPROM_INTAB) >> 8) & 0xFF)));
+
+                               /*
+                                * Set the INTAB (bit 11) if the GPIO 0 input indicates
+                                * the Function 1 interrupt line is wired to INTA.
+                                *
+                                * Set/Clear Bit 11 (INTAB) from the GPIO bit 0 input:
+                                *   1 - Function 1 interrupt line wired to INT A.
+                                *   0 - Function 1 interrupt line wired to INT B.
+                                *
+                                * Note: Adapter boards always have Function 0 wired to INTA.
+                                * Put all 5 GPIO bits in input mode and then read
+                                * their input values.
+                                */
+                               AdvWriteByteRegister(iop_base, IOPB_GPIO_CNTL,
+                                                    0);
+                               if (AdvReadByteRegister
+                                   (iop_base, IOPB_GPIO_DATA) & 0x01) {
+                                       /* Function 1 interrupt wired to INTA; Set EEPROM bit. */
+                                       *((uchar *)&eep_config + i) |=
+                                           ((ADV_EEPROM_INTAB >> 8) & 0xFF);
+                               }
+                       } else {
+                               *((uchar *)&eep_config + i) =
+                                   *((uchar *)&Default_38C1600_EEPROM_Config
+                                     + i);
+                       }
+               }
 
-    warn_code = 0;
+               /*
+                * Assume the 6 byte board serial number that was read
+                * from EEPROM is correct even if the EEPROM checksum
+                * failed.
+                */
+               eep_config.serial_number_word3 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1);
 
-    /*
-     * Read the board's EEPROM configuration.
-     *
-     * Set default values if a bad checksum is found.
-     */
-    if (AdvGet38C1600EEPConfig(iop_base, &eep_config) != eep_config.check_sum)
-    {
-        warn_code |= ASC_WARN_EEPROM_CHKSUM;
-
-        /*
-         * Set EEPROM default values.
-         */
-        for (i = 0; i < sizeof(ADVEEP_38C1600_CONFIG); i++)
-        {
-            if (i == 1 && ASC_PCI_ID2FUNC(asc_dvc->cfg->pci_slot_info) != 0)
-            {
-                /*
-                 * Set Function 1 EEPROM Word 0 MSB
-                 *
-                 * Clear the BIOS_ENABLE (bit 14) and INTAB (bit 11)
-                 * EEPROM bits.
-                 *
-                 * Disable Bit 14 (BIOS_ENABLE) to fix SPARC Ultra 60 and
-                 * old Mac system booting problem. The Expansion ROM must
-                 * be disabled in Function 1 for these systems.
-                 *
-                 */
-                *((uchar *) &eep_config + i) =
-                ((*((uchar *) &Default_38C1600_EEPROM_Config + i)) &
-                    (~(((ADV_EEPROM_BIOS_ENABLE | ADV_EEPROM_INTAB) >> 8) &
-                     0xFF)));
-
-                /*
-                 * Set the INTAB (bit 11) if the GPIO 0 input indicates
-                 * the Function 1 interrupt line is wired to INTA.
-                 *
-                 * Set/Clear Bit 11 (INTAB) from the GPIO bit 0 input:
-                 *   1 - Function 1 interrupt line wired to INT A.
-                 *   0 - Function 1 interrupt line wired to INT B.
-                 *
-                 * Note: Adapter boards always have Function 0 wired to INTA.
-                 * Put all 5 GPIO bits in input mode and then read
-                 * their input values.
-                 */
-                AdvWriteByteRegister(iop_base, IOPB_GPIO_CNTL, 0);
-                if (AdvReadByteRegister(iop_base, IOPB_GPIO_DATA) & 0x01)
-                {
-                    /* Function 1 interrupt wired to INTA; Set EEPROM bit. */
-                *((uchar *) &eep_config + i) |=
-                    ((ADV_EEPROM_INTAB >> 8) & 0xFF);
-                }
-            }
-            else
-            {
-                *((uchar *) &eep_config + i) =
-                *((uchar *) &Default_38C1600_EEPROM_Config + i);
-            }
-        }
-
-        /*
-         * Assume the 6 byte board serial number that was read
-         * from EEPROM is correct even if the EEPROM checksum
-         * failed.
-         */
-        eep_config.serial_number_word3 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 1);
-
-        eep_config.serial_number_word2 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2);
-
-        eep_config.serial_number_word1 =
-            AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3);
-
-        AdvSet38C1600EEPConfig(iop_base, &eep_config);
-    }
+               eep_config.serial_number_word2 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 2);
 
-    /*
-     * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the
-     * EEPROM configuration that was read.
-     *
-     * This is the mapping of EEPROM fields to Adv Library fields.
-     */
-    asc_dvc->wdtr_able = eep_config.wdtr_able;
-    asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1;
-    asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2;
-    asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3;
-    asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4;
-    asc_dvc->ppr_able = 0;
-    asc_dvc->tagqng_able = eep_config.tagqng_able;
-    asc_dvc->cfg->disc_enable = eep_config.disc_enable;
-    asc_dvc->max_host_qng = eep_config.max_host_qng;
-    asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
-    asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ASC_MAX_TID);
-    asc_dvc->start_motor = eep_config.start_motor;
-    asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
-    asc_dvc->bios_ctrl = eep_config.bios_ctrl;
-    asc_dvc->no_scam = eep_config.scam_tolerant;
+               eep_config.serial_number_word1 =
+                   AdvReadEEPWord(iop_base, ADV_EEP_DVC_CFG_END - 3);
 
-    /*
-     * For every Target ID if any of its 'sdtr_speed[1234]' bits
-     * are set, then set an 'sdtr_able' bit for it.
-     */
-    asc_dvc->sdtr_able = 0;
-    for (tid = 0; tid <= ASC_MAX_TID; tid++)
-    {
-        if (tid == 0)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed1;
-        } else if (tid == 4)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed2;
-        } else if (tid == 8)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed3;
-        } else if (tid == 12)
-        {
-            sdtr_speed = asc_dvc->sdtr_speed4;
-        }
-        if (sdtr_speed & ASC_MAX_TID)
-        {
-            asc_dvc->sdtr_able |= (1 << tid);
-        }
-        sdtr_speed >>= 4;
-    }
+               AdvSet38C1600EEPConfig(iop_base, &eep_config);
+       }
 
-    /*
-     * Set the host maximum queuing (max. 253, min. 16) and the per device
-     * maximum queuing (max. 63, min. 4).
-     */
-    if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG)
-    {
-        eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
-    } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG)
-    {
-        /* If the value is zero, assume it is uninitialized. */
-        if (eep_config.max_host_qng == 0)
-        {
-            eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
-        } else
-        {
-            eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG;
-        }
-    }
+       /*
+        * Set ASC_DVC_VAR and ASC_DVC_CFG variables from the
+        * EEPROM configuration that was read.
+        *
+        * This is the mapping of EEPROM fields to Adv Library fields.
+        */
+       asc_dvc->wdtr_able = eep_config.wdtr_able;
+       asc_dvc->sdtr_speed1 = eep_config.sdtr_speed1;
+       asc_dvc->sdtr_speed2 = eep_config.sdtr_speed2;
+       asc_dvc->sdtr_speed3 = eep_config.sdtr_speed3;
+       asc_dvc->sdtr_speed4 = eep_config.sdtr_speed4;
+       asc_dvc->ppr_able = 0;
+       asc_dvc->tagqng_able = eep_config.tagqng_able;
+       asc_dvc->cfg->disc_enable = eep_config.disc_enable;
+       asc_dvc->max_host_qng = eep_config.max_host_qng;
+       asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
+       asc_dvc->chip_scsi_id = (eep_config.adapter_scsi_id & ASC_MAX_TID);
+       asc_dvc->start_motor = eep_config.start_motor;
+       asc_dvc->scsi_reset_wait = eep_config.scsi_reset_delay;
+       asc_dvc->bios_ctrl = eep_config.bios_ctrl;
+       asc_dvc->no_scam = eep_config.scam_tolerant;
+
+       /*
+        * For every Target ID if any of its 'sdtr_speed[1234]' bits
+        * are set, then set an 'sdtr_able' bit for it.
+        */
+       asc_dvc->sdtr_able = 0;
+       for (tid = 0; tid <= ASC_MAX_TID; tid++) {
+               if (tid == 0) {
+                       sdtr_speed = asc_dvc->sdtr_speed1;
+               } else if (tid == 4) {
+                       sdtr_speed = asc_dvc->sdtr_speed2;
+               } else if (tid == 8) {
+                       sdtr_speed = asc_dvc->sdtr_speed3;
+               } else if (tid == 12) {
+                       sdtr_speed = asc_dvc->sdtr_speed4;
+               }
+               if (sdtr_speed & ASC_MAX_TID) {
+                       asc_dvc->sdtr_able |= (1 << tid);
+               }
+               sdtr_speed >>= 4;
+       }
 
-    if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG)
-    {
-        eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
-    } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG)
-    {
-        /* If the value is zero, assume it is uninitialized. */
-        if (eep_config.max_dvc_qng == 0)
-        {
-            eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
-        } else
-        {
-            eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG;
-        }
-    }
+       /*
+        * Set the host maximum queuing (max. 253, min. 16) and the per device
+        * maximum queuing (max. 63, min. 4).
+        */
+       if (eep_config.max_host_qng > ASC_DEF_MAX_HOST_QNG) {
+               eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
+       } else if (eep_config.max_host_qng < ASC_DEF_MIN_HOST_QNG) {
+               /* If the value is zero, assume it is uninitialized. */
+               if (eep_config.max_host_qng == 0) {
+                       eep_config.max_host_qng = ASC_DEF_MAX_HOST_QNG;
+               } else {
+                       eep_config.max_host_qng = ASC_DEF_MIN_HOST_QNG;
+               }
+       }
 
-    /*
-     * If 'max_dvc_qng' is greater than 'max_host_qng', then
-     * set 'max_dvc_qng' to 'max_host_qng'.
-     */
-    if (eep_config.max_dvc_qng > eep_config.max_host_qng)
-    {
-        eep_config.max_dvc_qng = eep_config.max_host_qng;
-    }
+       if (eep_config.max_dvc_qng > ASC_DEF_MAX_DVC_QNG) {
+               eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
+       } else if (eep_config.max_dvc_qng < ASC_DEF_MIN_DVC_QNG) {
+               /* If the value is zero, assume it is uninitialized. */
+               if (eep_config.max_dvc_qng == 0) {
+                       eep_config.max_dvc_qng = ASC_DEF_MAX_DVC_QNG;
+               } else {
+                       eep_config.max_dvc_qng = ASC_DEF_MIN_DVC_QNG;
+               }
+       }
 
-    /*
-     * Set ASC_DVC_VAR 'max_host_qng' and ASC_DVC_VAR 'max_dvc_qng'
-     * values based on possibly adjusted EEPROM values.
-     */
-    asc_dvc->max_host_qng = eep_config.max_host_qng;
-    asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
+       /*
+        * If 'max_dvc_qng' is greater than 'max_host_qng', then
+        * set 'max_dvc_qng' to 'max_host_qng'.
+        */
+       if (eep_config.max_dvc_qng > eep_config.max_host_qng) {
+               eep_config.max_dvc_qng = eep_config.max_host_qng;
+       }
 
-    /*
-     * If the EEPROM 'termination' field is set to automatic (0), then set
-     * the ASC_DVC_CFG 'termination' field to automatic also.
-     *
-     * If the termination is specified with a non-zero 'termination'
-     * value check that a legal value is set and set the ASC_DVC_CFG
-     * 'termination' field appropriately.
-     */
-    if (eep_config.termination_se == 0)
-    {
-        termination = 0;                         /* auto termination for SE */
-    } else
-    {
-        /* Enable manual control with low off / high off. */
-        if (eep_config.termination_se == 1)
-        {
-            termination = 0;
-
-        /* Enable manual control with low off / high on. */
-        } else if (eep_config.termination_se == 2)
-        {
-            termination = TERM_SE_HI;
-
-        /* Enable manual control with low on / high on. */
-        } else if (eep_config.termination_se == 3)
-        {
-            termination = TERM_SE;
-        } else
-        {
-            /*
-             * The EEPROM 'termination_se' field contains a bad value.
-             * Use automatic termination instead.
-             */
-            termination = 0;
-            warn_code |= ASC_WARN_EEPROM_TERMINATION;
-        }
-    }
+       /*
+        * Set ASC_DVC_VAR 'max_host_qng' and ASC_DVC_VAR 'max_dvc_qng'
+        * values based on possibly adjusted EEPROM values.
+        */
+       asc_dvc->max_host_qng = eep_config.max_host_qng;
+       asc_dvc->max_dvc_qng = eep_config.max_dvc_qng;
+
+       /*
+        * If the EEPROM 'termination' field is set to automatic (0), then set
+        * the ASC_DVC_CFG 'termination' field to automatic also.
+        *
+        * If the termination is specified with a non-zero 'termination'
+        * value check that a legal value is set and set the ASC_DVC_CFG
+        * 'termination' field appropriately.
+        */
+       if (eep_config.termination_se == 0) {
+               termination = 0;        /* auto termination for SE */
+       } else {
+               /* Enable manual control with low off / high off. */
+               if (eep_config.termination_se == 1) {
+                       termination = 0;
+
+                       /* Enable manual control with low off / high on. */
+               } else if (eep_config.termination_se == 2) {
+                       termination = TERM_SE_HI;
+
+                       /* Enable manual control with low on / high on. */
+               } else if (eep_config.termination_se == 3) {
+                       termination = TERM_SE;
+               } else {
+                       /*
+                        * The EEPROM 'termination_se' field contains a bad value.
+                        * Use automatic termination instead.
+                        */
+                       termination = 0;
+                       warn_code |= ASC_WARN_EEPROM_TERMINATION;
+               }
+       }
 
-    if (eep_config.termination_lvd == 0)
-    {
-        asc_dvc->cfg->termination = termination; /* auto termination for LVD */
-    } else
-    {
-        /* Enable manual control with low off / high off. */
-        if (eep_config.termination_lvd == 1)
-        {
-            asc_dvc->cfg->termination = termination;
-
-        /* Enable manual control with low off / high on. */
-        } else if (eep_config.termination_lvd == 2)
-        {
-            asc_dvc->cfg->termination = termination | TERM_LVD_HI;
-
-        /* Enable manual control with low on / high on. */
-        } else if (eep_config.termination_lvd == 3)
-        {
-            asc_dvc->cfg->termination =
-                termination | TERM_LVD;
-        } else
-        {
-            /*
-             * The EEPROM 'termination_lvd' field contains a bad value.
-             * Use automatic termination instead.
-             */
-            asc_dvc->cfg->termination = termination;
-            warn_code |= ASC_WARN_EEPROM_TERMINATION;
-        }
-    }
+       if (eep_config.termination_lvd == 0) {
+               asc_dvc->cfg->termination = termination;        /* auto termination for LVD */
+       } else {
+               /* Enable manual control with low off / high off. */
+               if (eep_config.termination_lvd == 1) {
+                       asc_dvc->cfg->termination = termination;
+
+                       /* Enable manual control with low off / high on. */
+               } else if (eep_config.termination_lvd == 2) {
+                       asc_dvc->cfg->termination = termination | TERM_LVD_HI;
+
+                       /* Enable manual control with low on / high on. */
+               } else if (eep_config.termination_lvd == 3) {
+                       asc_dvc->cfg->termination = termination | TERM_LVD;
+               } else {
+                       /*
+                        * The EEPROM 'termination_lvd' field contains a bad value.
+                        * Use automatic termination instead.
+                        */
+                       asc_dvc->cfg->termination = termination;
+                       warn_code |= ASC_WARN_EEPROM_TERMINATION;
+               }
+       }
 
-    return warn_code;
+       return warn_code;
 }
 
 /*
@@ -17049,45 +16733,42 @@ AdvInitFrom38C1600EEP(ADV_DVC_VAR *asc_dvc)
  *
  * Return a checksum based on the EEPROM configuration read.
  */
-STATIC ushort __init
+static ushort __init
 AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf)
 {
-    ushort              wval, chksum;
-    ushort              *wbuf;
-    int                 eep_addr;
-    ushort              *charfields;
-
-    charfields = (ushort *) &ADVEEP_3550_Config_Field_IsChar;
-    wbuf = (ushort *) cfg_buf;
-    chksum = 0;
-
-    for (eep_addr = ADV_EEP_DVC_CFG_BEGIN;
-         eep_addr < ADV_EEP_DVC_CFG_END;
-         eep_addr++, wbuf++)
-    {
-        wval = AdvReadEEPWord(iop_base, eep_addr);
-        chksum += wval; /* Checksum is calculated from word values. */
-        if (*charfields++) {
-            *wbuf = le16_to_cpu(wval);
-        } else {
-            *wbuf = wval;
-        }
-    }
-    /* Read checksum word. */
-    *wbuf = AdvReadEEPWord(iop_base, eep_addr);
-    wbuf++; charfields++;
-
-    /* Read rest of EEPROM not covered by the checksum. */
-    for (eep_addr = ADV_EEP_DVC_CTL_BEGIN;
-         eep_addr < ADV_EEP_MAX_WORD_ADDR;
-         eep_addr++, wbuf++)
-    {
-        *wbuf = AdvReadEEPWord(iop_base, eep_addr);
-        if (*charfields++) {
-            *wbuf = le16_to_cpu(*wbuf);
-        }
-    }
-    return chksum;
+       ushort wval, chksum;
+       ushort *wbuf;
+       int eep_addr;
+       ushort *charfields;
+
+       charfields = (ushort *)&ADVEEP_3550_Config_Field_IsChar;
+       wbuf = (ushort *)cfg_buf;
+       chksum = 0;
+
+       for (eep_addr = ADV_EEP_DVC_CFG_BEGIN;
+            eep_addr < ADV_EEP_DVC_CFG_END; eep_addr++, wbuf++) {
+               wval = AdvReadEEPWord(iop_base, eep_addr);
+               chksum += wval; /* Checksum is calculated from word values. */
+               if (*charfields++) {
+                       *wbuf = le16_to_cpu(wval);
+               } else {
+                       *wbuf = wval;
+               }
+       }
+       /* Read checksum word. */
+       *wbuf = AdvReadEEPWord(iop_base, eep_addr);
+       wbuf++;
+       charfields++;
+
+       /* Read rest of EEPROM not covered by the checksum. */
+       for (eep_addr = ADV_EEP_DVC_CTL_BEGIN;
+            eep_addr < ADV_EEP_MAX_WORD_ADDR; eep_addr++, wbuf++) {
+               *wbuf = AdvReadEEPWord(iop_base, eep_addr);
+               if (*charfields++) {
+                       *wbuf = le16_to_cpu(*wbuf);
+               }
+       }
+       return chksum;
 }
 
 /*
@@ -17095,46 +16776,42 @@ AdvGet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf)
  *
  * Return a checksum based on the EEPROM configuration read.
  */
-STATIC ushort __init
-AdvGet38C0800EEPConfig(AdvPortAddr iop_base,
-                       ADVEEP_38C0800_CONFIG *cfg_buf)
+static ushort __init
+AdvGet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf)
 {
-    ushort              wval, chksum;
-    ushort              *wbuf;
-    int                 eep_addr;
-    ushort              *charfields;
-
-    charfields = (ushort *) &ADVEEP_38C0800_Config_Field_IsChar;
-    wbuf = (ushort *) cfg_buf;
-    chksum = 0;
-
-    for (eep_addr = ADV_EEP_DVC_CFG_BEGIN;
-         eep_addr < ADV_EEP_DVC_CFG_END;
-         eep_addr++, wbuf++)
-    {
-        wval = AdvReadEEPWord(iop_base, eep_addr);
-        chksum += wval; /* Checksum is calculated from word values. */
-        if (*charfields++) {
-            *wbuf = le16_to_cpu(wval);
-        } else {
-            *wbuf = wval;
-        }
-    }
-    /* Read checksum word. */
-    *wbuf = AdvReadEEPWord(iop_base, eep_addr);
-    wbuf++; charfields++;
-
-    /* Read rest of EEPROM not covered by the checksum. */
-    for (eep_addr = ADV_EEP_DVC_CTL_BEGIN;
-         eep_addr < ADV_EEP_MAX_WORD_ADDR;
-         eep_addr++, wbuf++)
-    {
-        *wbuf = AdvReadEEPWord(iop_base, eep_addr);
-        if (*charfields++) {
-            *wbuf = le16_to_cpu(*wbuf);
-        }
-    }
-    return chksum;
+       ushort wval, chksum;
+       ushort *wbuf;
+       int eep_addr;
+       ushort *charfields;
+
+       charfields = (ushort *)&ADVEEP_38C0800_Config_Field_IsChar;
+       wbuf = (ushort *)cfg_buf;
+       chksum = 0;
+
+       for (eep_addr = ADV_EEP_DVC_CFG_BEGIN;
+            eep_addr < ADV_EEP_DVC_CFG_END; eep_addr++, wbuf++) {
+               wval = AdvReadEEPWord(iop_base, eep_addr);
+               chksum += wval; /* Checksum is calculated from word values. */
+               if (*charfields++) {
+                       *wbuf = le16_to_cpu(wval);
+               } else {
+                       *wbuf = wval;
+               }
+       }
+       /* Read checksum word. */
+       *wbuf = AdvReadEEPWord(iop_base, eep_addr);
+       wbuf++;
+       charfields++;
+
+       /* Read rest of EEPROM not covered by the checksum. */
+       for (eep_addr = ADV_EEP_DVC_CTL_BEGIN;
+            eep_addr < ADV_EEP_MAX_WORD_ADDR; eep_addr++, wbuf++) {
+               *wbuf = AdvReadEEPWord(iop_base, eep_addr);
+               if (*charfields++) {
+                       *wbuf = le16_to_cpu(*wbuf);
+               }
+       }
+       return chksum;
 }
 
 /*
@@ -17142,81 +16819,74 @@ AdvGet38C0800EEPConfig(AdvPortAddr iop_base,
  *
  * Return a checksum based on the EEPROM configuration read.
  */
-STATIC ushort __init
-AdvGet38C1600EEPConfig(AdvPortAddr iop_base,
-                       ADVEEP_38C1600_CONFIG *cfg_buf)
+static ushort __init
+AdvGet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf)
 {
-    ushort              wval, chksum;
-    ushort              *wbuf;
-    int                 eep_addr;
-    ushort              *charfields;
-
-    charfields = (ushort*) &ADVEEP_38C1600_Config_Field_IsChar;
-    wbuf = (ushort *) cfg_buf;
-    chksum = 0;
-
-    for (eep_addr = ADV_EEP_DVC_CFG_BEGIN;
-         eep_addr < ADV_EEP_DVC_CFG_END;
-         eep_addr++, wbuf++)
-    {
-        wval = AdvReadEEPWord(iop_base, eep_addr);
-        chksum += wval; /* Checksum is calculated from word values. */
-        if (*charfields++) {
-            *wbuf = le16_to_cpu(wval);
-        } else {
-            *wbuf = wval;
-        }
-    }
-    /* Read checksum word. */
-    *wbuf = AdvReadEEPWord(iop_base, eep_addr);
-    wbuf++; charfields++;
-
-    /* Read rest of EEPROM not covered by the checksum. */
-    for (eep_addr = ADV_EEP_DVC_CTL_BEGIN;
-         eep_addr < ADV_EEP_MAX_WORD_ADDR;
-         eep_addr++, wbuf++)
-    {
-        *wbuf = AdvReadEEPWord(iop_base, eep_addr);
-        if (*charfields++) {
-            *wbuf = le16_to_cpu(*wbuf);
-        }
-    }
-    return chksum;
+       ushort wval, chksum;
+       ushort *wbuf;
+       int eep_addr;
+       ushort *charfields;
+
+       charfields = (ushort *)&ADVEEP_38C1600_Config_Field_IsChar;
+       wbuf = (ushort *)cfg_buf;
+       chksum = 0;
+
+       for (eep_addr = ADV_EEP_DVC_CFG_BEGIN;
+            eep_addr < ADV_EEP_DVC_CFG_END; eep_addr++, wbuf++) {
+               wval = AdvReadEEPWord(iop_base, eep_addr);
+               chksum += wval; /* Checksum is calculated from word values. */
+               if (*charfields++) {
+                       *wbuf = le16_to_cpu(wval);
+               } else {
+                       *wbuf = wval;
+               }
+       }
+       /* Read checksum word. */
+       *wbuf = AdvReadEEPWord(iop_base, eep_addr);
+       wbuf++;
+       charfields++;
+
+       /* Read rest of EEPROM not covered by the checksum. */
+       for (eep_addr = ADV_EEP_DVC_CTL_BEGIN;
+            eep_addr < ADV_EEP_MAX_WORD_ADDR; eep_addr++, wbuf++) {
+               *wbuf = AdvReadEEPWord(iop_base, eep_addr);
+               if (*charfields++) {
+                       *wbuf = le16_to_cpu(*wbuf);
+               }
+       }
+       return chksum;
 }
 
 /*
  * Read the EEPROM from specified location
  */
-STATIC ushort __init
-AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr)
+static ushort __init AdvReadEEPWord(AdvPortAddr iop_base, int eep_word_addr)
 {
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
-        ASC_EEP_CMD_READ | eep_word_addr);
-    AdvWaitEEPCmd(iop_base);
-    return AdvReadWordRegister(iop_base, IOPW_EE_DATA);
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
+                            ASC_EEP_CMD_READ | eep_word_addr);
+       AdvWaitEEPCmd(iop_base);
+       return AdvReadWordRegister(iop_base, IOPW_EE_DATA);
 }
 
 /*
  * Wait for EEPROM command to complete
  */
-STATIC void __init
-AdvWaitEEPCmd(AdvPortAddr iop_base)
+static void __init AdvWaitEEPCmd(AdvPortAddr iop_base)
 {
-    int eep_delay_ms;
-
-    for (eep_delay_ms = 0; eep_delay_ms < ADV_EEP_DELAY_MS; eep_delay_ms++)
-    {
-        if (AdvReadWordRegister(iop_base, IOPW_EE_CMD) & ASC_EEP_CMD_DONE)
-        {
-            break;
-        }
-        DvcSleepMilliSecond(1);
-    }
-    if ((AdvReadWordRegister(iop_base, IOPW_EE_CMD) & ASC_EEP_CMD_DONE) == 0)
-    {
-        ASC_ASSERT(0);
-    }
-    return;
+       int eep_delay_ms;
+
+       for (eep_delay_ms = 0; eep_delay_ms < ADV_EEP_DELAY_MS; eep_delay_ms++) {
+               if (AdvReadWordRegister(iop_base, IOPW_EE_CMD) &
+                   ASC_EEP_CMD_DONE) {
+                       break;
+               }
+               DvcSleepMilliSecond(1);
+       }
+       if ((AdvReadWordRegister(iop_base, IOPW_EE_CMD) & ASC_EEP_CMD_DONE) ==
+           0) {
+               ASC_ASSERT(0);
+       }
+       return;
 }
 
 /*
@@ -17225,201 +16895,202 @@ AdvWaitEEPCmd(AdvPortAddr iop_base)
 void __init
 AdvSet3550EEPConfig(AdvPortAddr iop_base, ADVEEP_3550_CONFIG *cfg_buf)
 {
-    ushort *wbuf;
-    ushort addr, chksum;
-    ushort *charfields;
-
-    wbuf = (ushort *) cfg_buf;
-    charfields = (ushort *) &ADVEEP_3550_Config_Field_IsChar;
-    chksum = 0;
-
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE);
-    AdvWaitEEPCmd(iop_base);
-
-    /*
-     * Write EEPROM from word 0 to word 20.
-     */
-    for (addr = ADV_EEP_DVC_CFG_BEGIN;
-         addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++)
-    {
-        ushort word;
-
-        if (*charfields++) {
-            word = cpu_to_le16(*wbuf);
-        } else {
-            word = *wbuf;
-        }
-        chksum += *wbuf; /* Checksum is calculated from word values. */
-        AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
-        AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-        AdvWaitEEPCmd(iop_base);
-        DvcSleepMilliSecond(ADV_EEP_DELAY_MS);
-    }
-
-    /*
-     * Write EEPROM checksum at word 21.
-     */
-    AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum);
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-    AdvWaitEEPCmd(iop_base);
-    wbuf++; charfields++;
+       ushort *wbuf;
+       ushort addr, chksum;
+       ushort *charfields;
+
+       wbuf = (ushort *)cfg_buf;
+       charfields = (ushort *)&ADVEEP_3550_Config_Field_IsChar;
+       chksum = 0;
+
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE);
+       AdvWaitEEPCmd(iop_base);
+
+       /*
+        * Write EEPROM from word 0 to word 20.
+        */
+       for (addr = ADV_EEP_DVC_CFG_BEGIN;
+            addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++) {
+               ushort word;
+
+               if (*charfields++) {
+                       word = cpu_to_le16(*wbuf);
+               } else {
+                       word = *wbuf;
+               }
+               chksum += *wbuf;        /* Checksum is calculated from word values. */
+               AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
+               AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
+                                    ASC_EEP_CMD_WRITE | addr);
+               AdvWaitEEPCmd(iop_base);
+               DvcSleepMilliSecond(ADV_EEP_DELAY_MS);
+       }
 
-    /*
-     * Write EEPROM OEM name at words 22 to 29.
-     */
-    for (addr = ADV_EEP_DVC_CTL_BEGIN;
-         addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++)
-    {
-        ushort word;
-
-        if (*charfields++) {
-            word = cpu_to_le16(*wbuf);
-        } else {
-            word = *wbuf;
-        }
-        AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
-        AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-        AdvWaitEEPCmd(iop_base);
-    }
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE);
-    AdvWaitEEPCmd(iop_base);
-    return;
+       /*
+        * Write EEPROM checksum at word 21.
+        */
+       AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum);
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
+       AdvWaitEEPCmd(iop_base);
+       wbuf++;
+       charfields++;
+
+       /*
+        * Write EEPROM OEM name at words 22 to 29.
+        */
+       for (addr = ADV_EEP_DVC_CTL_BEGIN;
+            addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++) {
+               ushort word;
+
+               if (*charfields++) {
+                       word = cpu_to_le16(*wbuf);
+               } else {
+                       word = *wbuf;
+               }
+               AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
+               AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
+                                    ASC_EEP_CMD_WRITE | addr);
+               AdvWaitEEPCmd(iop_base);
+       }
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE);
+       AdvWaitEEPCmd(iop_base);
+       return;
 }
 
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
 void __init
-AdvSet38C0800EEPConfig(AdvPortAddr iop_base,
-                       ADVEEP_38C0800_CONFIG *cfg_buf)
+AdvSet38C0800EEPConfig(AdvPortAddr iop_base, ADVEEP_38C0800_CONFIG *cfg_buf)
 {
-    ushort *wbuf;
-    ushort *charfields;
-    ushort addr, chksum;
-
-    wbuf = (ushort *) cfg_buf;
-    charfields = (ushort *) &ADVEEP_38C0800_Config_Field_IsChar;
-    chksum = 0;
-
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE);
-    AdvWaitEEPCmd(iop_base);
-
-    /*
-     * Write EEPROM from word 0 to word 20.
-     */
-    for (addr = ADV_EEP_DVC_CFG_BEGIN;
-         addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++)
-    {
-        ushort word;
-
-        if (*charfields++) {
-            word = cpu_to_le16(*wbuf);
-        } else {
-            word = *wbuf;
-        }
-        chksum += *wbuf; /* Checksum is calculated from word values. */
-        AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
-        AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-        AdvWaitEEPCmd(iop_base);
-        DvcSleepMilliSecond(ADV_EEP_DELAY_MS);
-    }
-
-    /*
-     * Write EEPROM checksum at word 21.
-     */
-    AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum);
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-    AdvWaitEEPCmd(iop_base);
-    wbuf++; charfields++;
+       ushort *wbuf;
+       ushort *charfields;
+       ushort addr, chksum;
+
+       wbuf = (ushort *)cfg_buf;
+       charfields = (ushort *)&ADVEEP_38C0800_Config_Field_IsChar;
+       chksum = 0;
+
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE);
+       AdvWaitEEPCmd(iop_base);
+
+       /*
+        * Write EEPROM from word 0 to word 20.
+        */
+       for (addr = ADV_EEP_DVC_CFG_BEGIN;
+            addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++) {
+               ushort word;
+
+               if (*charfields++) {
+                       word = cpu_to_le16(*wbuf);
+               } else {
+                       word = *wbuf;
+               }
+               chksum += *wbuf;        /* Checksum is calculated from word values. */
+               AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
+               AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
+                                    ASC_EEP_CMD_WRITE | addr);
+               AdvWaitEEPCmd(iop_base);
+               DvcSleepMilliSecond(ADV_EEP_DELAY_MS);
+       }
 
-    /*
-     * Write EEPROM OEM name at words 22 to 29.
-     */
-    for (addr = ADV_EEP_DVC_CTL_BEGIN;
-         addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++)
-    {
-        ushort word;
-
-        if (*charfields++) {
-            word = cpu_to_le16(*wbuf);
-        } else {
-            word = *wbuf;
-        }
-        AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
-        AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-        AdvWaitEEPCmd(iop_base);
-    }
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE);
-    AdvWaitEEPCmd(iop_base);
-    return;
+       /*
+        * Write EEPROM checksum at word 21.
+        */
+       AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum);
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
+       AdvWaitEEPCmd(iop_base);
+       wbuf++;
+       charfields++;
+
+       /*
+        * Write EEPROM OEM name at words 22 to 29.
+        */
+       for (addr = ADV_EEP_DVC_CTL_BEGIN;
+            addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++) {
+               ushort word;
+
+               if (*charfields++) {
+                       word = cpu_to_le16(*wbuf);
+               } else {
+                       word = *wbuf;
+               }
+               AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
+               AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
+                                    ASC_EEP_CMD_WRITE | addr);
+               AdvWaitEEPCmd(iop_base);
+       }
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE);
+       AdvWaitEEPCmd(iop_base);
+       return;
 }
 
 /*
  * Write the EEPROM from 'cfg_buf'.
  */
 void __init
-AdvSet38C1600EEPConfig(AdvPortAddr iop_base,
-                       ADVEEP_38C1600_CONFIG *cfg_buf)
+AdvSet38C1600EEPConfig(AdvPortAddr iop_base, ADVEEP_38C1600_CONFIG *cfg_buf)
 {
-    ushort              *wbuf;
-    ushort              *charfields;
-    ushort              addr, chksum;
-
-    wbuf = (ushort *) cfg_buf;
-    charfields = (ushort *) &ADVEEP_38C1600_Config_Field_IsChar;
-    chksum = 0;
-
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE);
-    AdvWaitEEPCmd(iop_base);
-
-    /*
-     * Write EEPROM from word 0 to word 20.
-     */
-    for (addr = ADV_EEP_DVC_CFG_BEGIN;
-         addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++)
-    {
-        ushort word;
-
-        if (*charfields++) {
-            word = cpu_to_le16(*wbuf);
-        } else {
-            word = *wbuf;
-        }
-        chksum += *wbuf; /* Checksum is calculated from word values. */
-        AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
-        AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-        AdvWaitEEPCmd(iop_base);
-        DvcSleepMilliSecond(ADV_EEP_DELAY_MS);
-    }
-
-    /*
-     * Write EEPROM checksum at word 21.
-     */
-    AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum);
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-    AdvWaitEEPCmd(iop_base);
-    wbuf++; charfields++;
+       ushort *wbuf;
+       ushort *charfields;
+       ushort addr, chksum;
+
+       wbuf = (ushort *)cfg_buf;
+       charfields = (ushort *)&ADVEEP_38C1600_Config_Field_IsChar;
+       chksum = 0;
+
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_ABLE);
+       AdvWaitEEPCmd(iop_base);
+
+       /*
+        * Write EEPROM from word 0 to word 20.
+        */
+       for (addr = ADV_EEP_DVC_CFG_BEGIN;
+            addr < ADV_EEP_DVC_CFG_END; addr++, wbuf++) {
+               ushort word;
+
+               if (*charfields++) {
+                       word = cpu_to_le16(*wbuf);
+               } else {
+                       word = *wbuf;
+               }
+               chksum += *wbuf;        /* Checksum is calculated from word values. */
+               AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
+               AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
+                                    ASC_EEP_CMD_WRITE | addr);
+               AdvWaitEEPCmd(iop_base);
+               DvcSleepMilliSecond(ADV_EEP_DELAY_MS);
+       }
 
-    /*
-     * Write EEPROM OEM name at words 22 to 29.
-     */
-    for (addr = ADV_EEP_DVC_CTL_BEGIN;
-         addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++)
-    {
-        ushort word;
-
-        if (*charfields++) {
-            word = cpu_to_le16(*wbuf);
-        } else {
-            word = *wbuf;
-        }
-        AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
-        AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
-        AdvWaitEEPCmd(iop_base);
-    }
-    AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE);
-    AdvWaitEEPCmd(iop_base);
-    return;
+       /*
+        * Write EEPROM checksum at word 21.
+        */
+       AdvWriteWordRegister(iop_base, IOPW_EE_DATA, chksum);
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE | addr);
+       AdvWaitEEPCmd(iop_base);
+       wbuf++;
+       charfields++;
+
+       /*
+        * Write EEPROM OEM name at words 22 to 29.
+        */
+       for (addr = ADV_EEP_DVC_CTL_BEGIN;
+            addr < ADV_EEP_MAX_WORD_ADDR; addr++, wbuf++) {
+               ushort word;
+
+               if (*charfields++) {
+                       word = cpu_to_le16(*wbuf);
+               } else {
+                       word = *wbuf;
+               }
+               AdvWriteWordRegister(iop_base, IOPW_EE_DATA, word);
+               AdvWriteWordRegister(iop_base, IOPW_EE_CMD,
+                                    ASC_EEP_CMD_WRITE | addr);
+               AdvWaitEEPCmd(iop_base);
+       }
+       AdvWriteWordRegister(iop_base, IOPW_EE_CMD, ASC_EEP_CMD_WRITE_DISABLE);
+       AdvWaitEEPCmd(iop_base);
+       return;
 }
 
 /* a_advlib.c */
@@ -17444,126 +17115,120 @@ AdvSet38C1600EEPConfig(AdvPortAddr iop_base,
  *      ADV_ERROR(-1) -  Invalid ADV_SCSI_REQ_Q request structure
  *                       host IC error.
  */
-STATIC int
-AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc,
-                ADV_SCSI_REQ_Q *scsiq)
+static int AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq)
 {
-    ulong                  last_int_level;
-    AdvPortAddr            iop_base;
-    ADV_DCNT               req_size;
-    ADV_PADDR              req_paddr;
-    ADV_CARR_T             *new_carrp;
-
-    ASC_ASSERT(scsiq != NULL); /* 'scsiq' should never be NULL. */
-
-    /*
-     * The ADV_SCSI_REQ_Q 'target_id' field should never exceed ADV_MAX_TID.
-     */
-    if (scsiq->target_id > ADV_MAX_TID)
-    {
-        scsiq->host_status = QHSTA_M_INVALID_DEVICE;
-        scsiq->done_status = QD_WITH_ERROR;
-        return ADV_ERROR;
-    }
-
-    iop_base = asc_dvc->iop_base;
-
-    last_int_level = DvcEnterCritical();
-
-    /*
-     * Allocate a carrier ensuring at least one carrier always
-     * remains on the freelist and initialize fields.
-     */
-    if ((new_carrp = asc_dvc->carr_freelist) == NULL)
-    {
-       DvcLeaveCritical(last_int_level);
-       return ADV_BUSY;
-    }
-    asc_dvc->carr_freelist = (ADV_CARR_T *)
-        ADV_U32_TO_VADDR(le32_to_cpu(new_carrp->next_vpa));
-    asc_dvc->carr_pending_cnt++;
-
-    /*
-     * Set the carrier to be a stopper by setting 'next_vpa'
-     * to the stopper value. The current stopper will be changed
-     * below to point to the new stopper.
-     */
-    new_carrp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
-
-    /*
-     * Clear the ADV_SCSI_REQ_Q done flag.
-     */
-    scsiq->a_flag &= ~ADV_SCSIQ_DONE;
-
-    req_size = sizeof(ADV_SCSI_REQ_Q);
-    req_paddr = DvcGetPhyAddr(asc_dvc, scsiq, (uchar *) scsiq,
-        (ADV_SDCNT *) &req_size, ADV_IS_SCSIQ_FLAG);
-
-    ASC_ASSERT(ADV_32BALIGN(req_paddr) == req_paddr);
-    ASC_ASSERT(req_size >= sizeof(ADV_SCSI_REQ_Q));
-
-    /* Wait for assertion before making little-endian */
-    req_paddr = cpu_to_le32(req_paddr);
+       ulong last_int_level;
+       AdvPortAddr iop_base;
+       ADV_DCNT req_size;
+       ADV_PADDR req_paddr;
+       ADV_CARR_T *new_carrp;
+
+       ASC_ASSERT(scsiq != NULL);      /* 'scsiq' should never be NULL. */
+
+       /*
+        * The ADV_SCSI_REQ_Q 'target_id' field should never exceed ADV_MAX_TID.
+        */
+       if (scsiq->target_id > ADV_MAX_TID) {
+               scsiq->host_status = QHSTA_M_INVALID_DEVICE;
+               scsiq->done_status = QD_WITH_ERROR;
+               return ADV_ERROR;
+       }
 
-    /* Save virtual and physical address of ADV_SCSI_REQ_Q and carrier. */
-    scsiq->scsiq_ptr = cpu_to_le32(ADV_VADDR_TO_U32(scsiq));
-    scsiq->scsiq_rptr = req_paddr;
+       iop_base = asc_dvc->iop_base;
 
-    scsiq->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->icq_sp));
-    /*
-     * Every ADV_CARR_T.carr_pa is byte swapped to little-endian
-     * order during initialization.
-     */
-    scsiq->carr_pa = asc_dvc->icq_sp->carr_pa;
-
-   /*
-    * Use the current stopper to send the ADV_SCSI_REQ_Q command to
-    * the microcode. The newly allocated stopper will become the new
-    * stopper.
-    */
-    asc_dvc->icq_sp->areq_vpa = req_paddr;
+       last_int_level = DvcEnterCritical();
 
-    /*
-     * Set the 'next_vpa' pointer for the old stopper to be the
-     * physical address of the new stopper. The RISC can only
-     * follow physical addresses.
-     */
-    asc_dvc->icq_sp->next_vpa = new_carrp->carr_pa;
-
-    /*
-     * Set the host adapter stopper pointer to point to the new carrier.
-     */
-    asc_dvc->icq_sp = new_carrp;
-
-    if (asc_dvc->chip_type == ADV_CHIP_ASC3550 ||
-        asc_dvc->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        /*
-         * Tickle the RISC to tell it to read its Command Queue Head pointer.
-         */
-        AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_A);
-        if (asc_dvc->chip_type == ADV_CHIP_ASC3550)
-        {
-            /*
-             * Clear the tickle value. In the ASC-3550 the RISC flag
-             * command 'clr_tickle_a' does not work unless the host
-             * value is cleared.
-             */
-            AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_NOP);
-        }
-    } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600)
-    {
-        /*
-         * Notify the RISC a carrier is ready by writing the physical
-         * address of the new carrier stopper to the COMMA register.
-         */
-        AdvWriteDWordRegister(iop_base, IOPDW_COMMA,
-                le32_to_cpu(new_carrp->carr_pa));
-    }
+       /*
+        * Allocate a carrier ensuring at least one carrier always
+        * remains on the freelist and initialize fields.
+        */
+       if ((new_carrp = asc_dvc->carr_freelist) == NULL) {
+               DvcLeaveCritical(last_int_level);
+               return ADV_BUSY;
+       }
+       asc_dvc->carr_freelist = (ADV_CARR_T *)
+           ADV_U32_TO_VADDR(le32_to_cpu(new_carrp->next_vpa));
+       asc_dvc->carr_pending_cnt++;
+
+       /*
+        * Set the carrier to be a stopper by setting 'next_vpa'
+        * to the stopper value. The current stopper will be changed
+        * below to point to the new stopper.
+        */
+       new_carrp->next_vpa = cpu_to_le32(ASC_CQ_STOPPER);
+
+       /*
+        * Clear the ADV_SCSI_REQ_Q done flag.
+        */
+       scsiq->a_flag &= ~ADV_SCSIQ_DONE;
+
+       req_size = sizeof(ADV_SCSI_REQ_Q);
+       req_paddr = DvcGetPhyAddr(asc_dvc, scsiq, (uchar *)scsiq,
+                                 (ADV_SDCNT *)&req_size, ADV_IS_SCSIQ_FLAG);
+
+       ASC_ASSERT(ADV_32BALIGN(req_paddr) == req_paddr);
+       ASC_ASSERT(req_size >= sizeof(ADV_SCSI_REQ_Q));
+
+       /* Wait for assertion before making little-endian */
+       req_paddr = cpu_to_le32(req_paddr);
+
+       /* Save virtual and physical address of ADV_SCSI_REQ_Q and carrier. */
+       scsiq->scsiq_ptr = cpu_to_le32(ADV_VADDR_TO_U32(scsiq));
+       scsiq->scsiq_rptr = req_paddr;
+
+       scsiq->carr_va = cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->icq_sp));
+       /*
+        * Every ADV_CARR_T.carr_pa is byte swapped to little-endian
+        * order during initialization.
+        */
+       scsiq->carr_pa = asc_dvc->icq_sp->carr_pa;
+
+       /*
+        * Use the current stopper to send the ADV_SCSI_REQ_Q command to
+        * the microcode. The newly allocated stopper will become the new
+        * stopper.
+        */
+       asc_dvc->icq_sp->areq_vpa = req_paddr;
+
+       /*
+        * Set the 'next_vpa' pointer for the old stopper to be the
+        * physical address of the new stopper. The RISC can only
+        * follow physical addresses.
+        */
+       asc_dvc->icq_sp->next_vpa = new_carrp->carr_pa;
+
+       /*
+        * Set the host adapter stopper pointer to point to the new carrier.
+        */
+       asc_dvc->icq_sp = new_carrp;
+
+       if (asc_dvc->chip_type == ADV_CHIP_ASC3550 ||
+           asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
+               /*
+                * Tickle the RISC to tell it to read its Command Queue Head pointer.
+                */
+               AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_A);
+               if (asc_dvc->chip_type == ADV_CHIP_ASC3550) {
+                       /*
+                        * Clear the tickle value. In the ASC-3550 the RISC flag
+                        * command 'clr_tickle_a' does not work unless the host
+                        * value is cleared.
+                        */
+                       AdvWriteByteRegister(iop_base, IOPB_TICKLE,
+                                            ADV_TICKLE_NOP);
+               }
+       } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
+               /*
+                * Notify the RISC a carrier is ready by writing the physical
+                * address of the new carrier stopper to the COMMA register.
+                */
+               AdvWriteDWordRegister(iop_base, IOPDW_COMMA,
+                                     le32_to_cpu(new_carrp->carr_pa));
+       }
 
-    DvcLeaveCritical(last_int_level);
+       DvcLeaveCritical(last_int_level);
 
-    return ADV_SUCCESS;
+       return ADV_SUCCESS;
 }
 
 /*
@@ -17575,42 +17240,39 @@ AdvExeScsiQueue(ADV_DVC_VAR *asc_dvc,
  *      ADV_ERROR(-1) - Microcode command timed-out. Microcode or IC
  *                      may be hung which requires driver recovery.
  */
-STATIC int
-AdvResetSB(ADV_DVC_VAR *asc_dvc)
+static int AdvResetSB(ADV_DVC_VAR *asc_dvc)
 {
-    int         status;
-
-    /*
-     * Send the SCSI Bus Reset idle start idle command which asserts
-     * the SCSI Bus Reset signal.
-     */
-    status = AdvSendIdleCmd(asc_dvc, (ushort) IDLE_CMD_SCSI_RESET_START, 0L);
-    if (status != ADV_TRUE)
-    {
-        return status;
-    }
-
-    /*
-     * Delay for the specified SCSI Bus Reset hold time.
-     *
-     * The hold time delay is done on the host because the RISC has no
-     * microsecond accurate timer.
-     */
-    DvcDelayMicroSecond(asc_dvc, (ushort) ASC_SCSI_RESET_HOLD_TIME_US);
-
-    /*
-     * Send the SCSI Bus Reset end idle command which de-asserts
-     * the SCSI Bus Reset signal and purges any pending requests.
-     */
-    status = AdvSendIdleCmd(asc_dvc, (ushort) IDLE_CMD_SCSI_RESET_END, 0L);
-    if (status != ADV_TRUE)
-    {
-        return status;
-    }
+       int status;
+
+       /*
+        * Send the SCSI Bus Reset idle start idle command which asserts
+        * the SCSI Bus Reset signal.
+        */
+       status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_START, 0L);
+       if (status != ADV_TRUE) {
+               return status;
+       }
 
-    DvcSleepMilliSecond((ADV_DCNT) asc_dvc->scsi_reset_wait * 1000);
+       /*
+        * Delay for the specified SCSI Bus Reset hold time.
+        *
+        * The hold time delay is done on the host because the RISC has no
+        * microsecond accurate timer.
+        */
+       DvcDelayMicroSecond(asc_dvc, (ushort)ASC_SCSI_RESET_HOLD_TIME_US);
+
+       /*
+        * Send the SCSI Bus Reset end idle command which de-asserts
+        * the SCSI Bus Reset signal and purges any pending requests.
+        */
+       status = AdvSendIdleCmd(asc_dvc, (ushort)IDLE_CMD_SCSI_RESET_END, 0L);
+       if (status != ADV_TRUE) {
+               return status;
+       }
+
+       DvcSleepMilliSecond((ADV_DCNT)asc_dvc->scsi_reset_wait * 1000);
 
-    return status;
+       return status;
 }
 
 /*
@@ -17620,99 +17282,89 @@ AdvResetSB(ADV_DVC_VAR *asc_dvc)
  *      ADV_TRUE(1) -   Chip re-initialization and SCSI Bus Reset successful.
  *      ADV_FALSE(0) -  Chip re-initialization and SCSI Bus Reset failure.
  */
-STATIC int
-AdvResetChipAndSB(ADV_DVC_VAR *asc_dvc)
+static int AdvResetChipAndSB(ADV_DVC_VAR *asc_dvc)
 {
-    int         status;
-    ushort      wdtr_able, sdtr_able, tagqng_able;
-    ushort      ppr_able = 0;
-    uchar       tid, max_cmd[ADV_MAX_TID + 1];
-    AdvPortAddr iop_base;
-    ushort      bios_sig;
-
-    iop_base = asc_dvc->iop_base;
-
-    /*
-     * Save current per TID negotiated values.
-     */
-    AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-    AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-    if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600)
-    {
-        AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
-    }
-    AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-    for (tid = 0; tid <= ADV_MAX_TID; tid++)
-    {
-        AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-            max_cmd[tid]);
-    }
-
-    /*
-     * Force the AdvInitAsc3550/38C0800Driver() function to
-     * perform a SCSI Bus Reset by clearing the BIOS signature word.
-     * The initialization functions assumes a SCSI Bus Reset is not
-     * needed if the BIOS signature word is present.
-     */
-    AdvReadWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, bios_sig);
-    AdvWriteWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, 0);
-
-    /*
-     * Stop chip and reset it.
-     */
-    AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_STOP);
-    AdvWriteWordRegister(iop_base, IOPW_CTRL_REG, ADV_CTRL_REG_CMD_RESET);
-    DvcSleepMilliSecond(100);
-    AdvWriteWordRegister(iop_base, IOPW_CTRL_REG, ADV_CTRL_REG_CMD_WR_IO_REG);
-
-    /*
-     * Reset Adv Library error code, if any, and try
-     * re-initializing the chip.
-     */
-    asc_dvc->err_code = 0;
-    if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600)
-    {
-        status = AdvInitAsc38C1600Driver(asc_dvc);
-    }
-    else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800)
-    {
-        status = AdvInitAsc38C0800Driver(asc_dvc);
-    } else
-    {
-        status = AdvInitAsc3550Driver(asc_dvc);
-    }
+       int status;
+       ushort wdtr_able, sdtr_able, tagqng_able;
+       ushort ppr_able = 0;
+       uchar tid, max_cmd[ADV_MAX_TID + 1];
+       AdvPortAddr iop_base;
+       ushort bios_sig;
+
+       iop_base = asc_dvc->iop_base;
+
+       /*
+        * Save current per TID negotiated values.
+        */
+       AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+       AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+       if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
+               AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
+       }
+       AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
+       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+               AdvReadByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                               max_cmd[tid]);
+       }
 
-    /* Translate initialization return value to status value. */
-    if (status == 0)
-    {
-        status = ADV_TRUE;
-    } else
-    {
-        status = ADV_FALSE;
-    }
+       /*
+        * Force the AdvInitAsc3550/38C0800Driver() function to
+        * perform a SCSI Bus Reset by clearing the BIOS signature word.
+        * The initialization functions assumes a SCSI Bus Reset is not
+        * needed if the BIOS signature word is present.
+        */
+       AdvReadWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, bios_sig);
+       AdvWriteWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, 0);
+
+       /*
+        * Stop chip and reset it.
+        */
+       AdvWriteWordRegister(iop_base, IOPW_RISC_CSR, ADV_RISC_CSR_STOP);
+       AdvWriteWordRegister(iop_base, IOPW_CTRL_REG, ADV_CTRL_REG_CMD_RESET);
+       DvcSleepMilliSecond(100);
+       AdvWriteWordRegister(iop_base, IOPW_CTRL_REG,
+                            ADV_CTRL_REG_CMD_WR_IO_REG);
+
+       /*
+        * Reset Adv Library error code, if any, and try
+        * re-initializing the chip.
+        */
+       asc_dvc->err_code = 0;
+       if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
+               status = AdvInitAsc38C1600Driver(asc_dvc);
+       } else if (asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
+               status = AdvInitAsc38C0800Driver(asc_dvc);
+       } else {
+               status = AdvInitAsc3550Driver(asc_dvc);
+       }
 
-    /*
-     * Restore the BIOS signature word.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, bios_sig);
+       /* Translate initialization return value to status value. */
+       if (status == 0) {
+               status = ADV_TRUE;
+       } else {
+               status = ADV_FALSE;
+       }
 
-    /*
-     * Restore per TID negotiated values.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
-    AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
-    if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600)
-    {
-        AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
-    }
-    AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
-    for (tid = 0; tid <= ADV_MAX_TID; tid++)
-    {
-        AdvWriteByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-            max_cmd[tid]);
-    }
+       /*
+        * Restore the BIOS signature word.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_BIOS_SIGNATURE, bios_sig);
+
+       /*
+        * Restore per TID negotiated values.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, wdtr_able);
+       AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, sdtr_able);
+       if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600) {
+               AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, ppr_able);
+       }
+       AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, tagqng_able);
+       for (tid = 0; tid <= ADV_MAX_TID; tid++) {
+               AdvWriteByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                                max_cmd[tid]);
+       }
 
-    return status;
+       return status;
 }
 
 /*
@@ -17734,158 +17386,151 @@ AdvResetChipAndSB(ADV_DVC_VAR *asc_dvc)
  *   ADV_TRUE(1) - interrupt was pending
  *   ADV_FALSE(0) - no interrupt was pending
  */
-STATIC int
-AdvISR(ADV_DVC_VAR *asc_dvc)
+static int AdvISR(ADV_DVC_VAR *asc_dvc)
 {
-    AdvPortAddr                 iop_base;
-    uchar                       int_stat;
-    ushort                      target_bit;
-    ADV_CARR_T                  *free_carrp;
-    ADV_VADDR                   irq_next_vpa;
-    int                         flags;
-    ADV_SCSI_REQ_Q              *scsiq;
-
-    flags = DvcEnterCritical();
-
-    iop_base = asc_dvc->iop_base;
-
-    /* Reading the register clears the interrupt. */
-    int_stat = AdvReadByteRegister(iop_base, IOPB_INTR_STATUS_REG);
-
-    if ((int_stat & (ADV_INTR_STATUS_INTRA | ADV_INTR_STATUS_INTRB |
-         ADV_INTR_STATUS_INTRC)) == 0)
-    {
-        DvcLeaveCritical(flags);
-        return ADV_FALSE;
-    }
+       AdvPortAddr iop_base;
+       uchar int_stat;
+       ushort target_bit;
+       ADV_CARR_T *free_carrp;
+       ADV_VADDR irq_next_vpa;
+       int flags;
+       ADV_SCSI_REQ_Q *scsiq;
 
-    /*
-     * Notify the driver of an asynchronous microcode condition by
-     * calling the ADV_DVC_VAR.async_callback function. The function
-     * is passed the microcode ASC_MC_INTRB_CODE byte value.
-     */
-    if (int_stat & ADV_INTR_STATUS_INTRB)
-    {
-        uchar intrb_code;
-
-        AdvReadByteLram(iop_base, ASC_MC_INTRB_CODE, intrb_code);
-
-        if (asc_dvc->chip_type == ADV_CHIP_ASC3550 ||
-            asc_dvc->chip_type == ADV_CHIP_ASC38C0800)
-        {
-            if (intrb_code == ADV_ASYNC_CARRIER_READY_FAILURE &&
-                asc_dvc->carr_pending_cnt != 0)
-            {
-                AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_A);
-                if (asc_dvc->chip_type == ADV_CHIP_ASC3550)
-                {
-                    AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_NOP);
-                }
-            }
-        }
-
-        if (asc_dvc->async_callback != 0)
-        {
-            (*asc_dvc->async_callback)(asc_dvc, intrb_code);
-        }
-    }
+       flags = DvcEnterCritical();
 
-    /*
-     * Check if the IRQ stopper carrier contains a completed request.
-     */
-    while (((irq_next_vpa =
-             le32_to_cpu(asc_dvc->irq_sp->next_vpa)) & ASC_RQ_DONE) != 0)
-    {
-        /*
-         * Get a pointer to the newly completed ADV_SCSI_REQ_Q structure.
-         * The RISC will have set 'areq_vpa' to a virtual address.
-         *
-         * The firmware will have copied the ASC_SCSI_REQ_Q.scsiq_ptr
-         * field to the carrier ADV_CARR_T.areq_vpa field. The conversion
-         * below complements the conversion of ASC_SCSI_REQ_Q.scsiq_ptr'
-         * in AdvExeScsiQueue().
-         */
-        scsiq = (ADV_SCSI_REQ_Q *)
-            ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->areq_vpa));
-
-        /*
-         * Request finished with good status and the queue was not
-         * DMAed to host memory by the firmware. Set all status fields
-         * to indicate good status.
-         */
-        if ((irq_next_vpa & ASC_RQ_GOOD) != 0)
-        {
-            scsiq->done_status = QD_NO_ERROR;
-            scsiq->host_status = scsiq->scsi_status = 0;
-            scsiq->data_cnt = 0L;
-        }
-
-        /*
-         * Advance the stopper pointer to the next carrier
-         * ignoring the lower four bits. Free the previous
-         * stopper carrier.
-         */
-        free_carrp = asc_dvc->irq_sp;
-        asc_dvc->irq_sp = (ADV_CARR_T *)
-            ADV_U32_TO_VADDR(ASC_GET_CARRP(irq_next_vpa));
-
-        free_carrp->next_vpa =
-                cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
-        asc_dvc->carr_freelist = free_carrp;
-        asc_dvc->carr_pending_cnt--;
-
-        ASC_ASSERT(scsiq != NULL);
-        target_bit = ADV_TID_TO_TIDMASK(scsiq->target_id);
-
-        /*
-         * Clear request microcode control flag.
-         */
-        scsiq->cntl = 0;
-
-        /*
-         * If the command that completed was a SCSI INQUIRY and
-         * LUN 0 was sent the command, then process the INQUIRY
-         * command information for the device.
-         *
-         * Note: If data returned were either VPD or CmdDt data,
-         * don't process the INQUIRY command information for
-         * the device, otherwise may erroneously set *_able bits.
-         */
-        if (scsiq->done_status == QD_NO_ERROR &&
-            scsiq->cdb[0] == INQUIRY &&
-            scsiq->target_lun == 0 &&
-            (scsiq->cdb[1] & ADV_INQ_RTN_VPD_AND_CMDDT)
-                == ADV_INQ_RTN_STD_INQUIRY_DATA)
-        {
-            AdvInquiryHandling(asc_dvc, scsiq);
-        }
-
-        /*
-         * Notify the driver of the completed request by passing
-         * the ADV_SCSI_REQ_Q pointer to its callback function.
-         */
-        scsiq->a_flag |= ADV_SCSIQ_DONE;
-        (*asc_dvc->isr_callback)(asc_dvc, scsiq);
-        /*
-         * Note: After the driver callback function is called, 'scsiq'
-         * can no longer be referenced.
-         *
-         * Fall through and continue processing other completed
-         * requests...
-         */
-
-        /*
-         * Disable interrupts again in case the driver inadvertently
-         * enabled interrupts in its callback function.
-         *
-         * The DvcEnterCritical() return value is ignored, because
-         * the 'flags' saved when AdvISR() was first entered will be
-         * used to restore the interrupt flag on exit.
-         */
-        (void) DvcEnterCritical();
-    }
-    DvcLeaveCritical(flags);
-    return ADV_TRUE;
+       iop_base = asc_dvc->iop_base;
+
+       /* Reading the register clears the interrupt. */
+       int_stat = AdvReadByteRegister(iop_base, IOPB_INTR_STATUS_REG);
+
+       if ((int_stat & (ADV_INTR_STATUS_INTRA | ADV_INTR_STATUS_INTRB |
+                        ADV_INTR_STATUS_INTRC)) == 0) {
+               DvcLeaveCritical(flags);
+               return ADV_FALSE;
+       }
+
+       /*
+        * Notify the driver of an asynchronous microcode condition by
+        * calling the ADV_DVC_VAR.async_callback function. The function
+        * is passed the microcode ASC_MC_INTRB_CODE byte value.
+        */
+       if (int_stat & ADV_INTR_STATUS_INTRB) {
+               uchar intrb_code;
+
+               AdvReadByteLram(iop_base, ASC_MC_INTRB_CODE, intrb_code);
+
+               if (asc_dvc->chip_type == ADV_CHIP_ASC3550 ||
+                   asc_dvc->chip_type == ADV_CHIP_ASC38C0800) {
+                       if (intrb_code == ADV_ASYNC_CARRIER_READY_FAILURE &&
+                           asc_dvc->carr_pending_cnt != 0) {
+                               AdvWriteByteRegister(iop_base, IOPB_TICKLE,
+                                                    ADV_TICKLE_A);
+                               if (asc_dvc->chip_type == ADV_CHIP_ASC3550) {
+                                       AdvWriteByteRegister(iop_base,
+                                                            IOPB_TICKLE,
+                                                            ADV_TICKLE_NOP);
+                               }
+                       }
+               }
+
+               if (asc_dvc->async_callback != 0) {
+                       (*asc_dvc->async_callback) (asc_dvc, intrb_code);
+               }
+       }
+
+       /*
+        * Check if the IRQ stopper carrier contains a completed request.
+        */
+       while (((irq_next_vpa =
+                le32_to_cpu(asc_dvc->irq_sp->next_vpa)) & ASC_RQ_DONE) != 0) {
+               /*
+                * Get a pointer to the newly completed ADV_SCSI_REQ_Q structure.
+                * The RISC will have set 'areq_vpa' to a virtual address.
+                *
+                * The firmware will have copied the ASC_SCSI_REQ_Q.scsiq_ptr
+                * field to the carrier ADV_CARR_T.areq_vpa field. The conversion
+                * below complements the conversion of ASC_SCSI_REQ_Q.scsiq_ptr'
+                * in AdvExeScsiQueue().
+                */
+               scsiq = (ADV_SCSI_REQ_Q *)
+                   ADV_U32_TO_VADDR(le32_to_cpu(asc_dvc->irq_sp->areq_vpa));
+
+               /*
+                * Request finished with good status and the queue was not
+                * DMAed to host memory by the firmware. Set all status fields
+                * to indicate good status.
+                */
+               if ((irq_next_vpa & ASC_RQ_GOOD) != 0) {
+                       scsiq->done_status = QD_NO_ERROR;
+                       scsiq->host_status = scsiq->scsi_status = 0;
+                       scsiq->data_cnt = 0L;
+               }
+
+               /*
+                * Advance the stopper pointer to the next carrier
+                * ignoring the lower four bits. Free the previous
+                * stopper carrier.
+                */
+               free_carrp = asc_dvc->irq_sp;
+               asc_dvc->irq_sp = (ADV_CARR_T *)
+                   ADV_U32_TO_VADDR(ASC_GET_CARRP(irq_next_vpa));
+
+               free_carrp->next_vpa =
+                   cpu_to_le32(ADV_VADDR_TO_U32(asc_dvc->carr_freelist));
+               asc_dvc->carr_freelist = free_carrp;
+               asc_dvc->carr_pending_cnt--;
+
+               ASC_ASSERT(scsiq != NULL);
+               target_bit = ADV_TID_TO_TIDMASK(scsiq->target_id);
+
+               /*
+                * Clear request microcode control flag.
+                */
+               scsiq->cntl = 0;
+
+               /*
+                * If the command that completed was a SCSI INQUIRY and
+                * LUN 0 was sent the command, then process the INQUIRY
+                * command information for the device.
+                *
+                * Note: If data returned were either VPD or CmdDt data,
+                * don't process the INQUIRY command information for
+                * the device, otherwise may erroneously set *_able bits.
+                */
+               if (scsiq->done_status == QD_NO_ERROR &&
+                   scsiq->cdb[0] == INQUIRY &&
+                   scsiq->target_lun == 0 &&
+                   (scsiq->cdb[1] & ADV_INQ_RTN_VPD_AND_CMDDT)
+                   == ADV_INQ_RTN_STD_INQUIRY_DATA) {
+                       AdvInquiryHandling(asc_dvc, scsiq);
+               }
+
+               /*
+                * Notify the driver of the completed request by passing
+                * the ADV_SCSI_REQ_Q pointer to its callback function.
+                */
+               scsiq->a_flag |= ADV_SCSIQ_DONE;
+               (*asc_dvc->isr_callback) (asc_dvc, scsiq);
+               /*
+                * Note: After the driver callback function is called, 'scsiq'
+                * can no longer be referenced.
+                *
+                * Fall through and continue processing other completed
+                * requests...
+                */
+
+               /*
+                * Disable interrupts again in case the driver inadvertently
+                * enabled interrupts in its callback function.
+                *
+                * The DvcEnterCritical() return value is ignored, because
+                * the 'flags' saved when AdvISR() was first entered will be
+                * used to restore the interrupt flag on exit.
+                */
+               (void)DvcEnterCritical();
+       }
+       DvcLeaveCritical(flags);
+       return ADV_TRUE;
 }
 
 /*
@@ -17902,71 +17547,67 @@ AdvISR(ADV_DVC_VAR *asc_dvc)
  *   ADV_FALSE - command failed
  *   ADV_ERROR - command timed out
  */
-STATIC int
+static int
 AdvSendIdleCmd(ADV_DVC_VAR *asc_dvc,
-               ushort idle_cmd,
-               ADV_DCNT idle_cmd_parameter)
+              ushort idle_cmd, ADV_DCNT idle_cmd_parameter)
 {
-    ulong       last_int_level;
-    int         result;
-    ADV_DCNT    i, j;
-    AdvPortAddr iop_base;
-
-    last_int_level = DvcEnterCritical();
-
-    iop_base = asc_dvc->iop_base;
-
-    /*
-     * Clear the idle command status which is set by the microcode
-     * to a non-zero value to indicate when the command is completed.
-     * The non-zero result is one of the IDLE_CMD_STATUS_* values
-     * defined in a_advlib.h.
-     */
-    AdvWriteWordLram(iop_base, ASC_MC_IDLE_CMD_STATUS, (ushort) 0);
-
-    /*
-     * Write the idle command value after the idle command parameter
-     * has been written to avoid a race condition. If the order is not
-     * followed, the microcode may process the idle command before the
-     * parameters have been written to LRAM.
-     */
-    AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IDLE_CMD_PARAMETER,
-        cpu_to_le32(idle_cmd_parameter));
-    AdvWriteWordLram(iop_base, ASC_MC_IDLE_CMD, idle_cmd);
-
-    /*
-     * Tickle the RISC to tell it to process the idle command.
-     */
-    AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_B);
-    if (asc_dvc->chip_type == ADV_CHIP_ASC3550)
-    {
-        /*
-         * Clear the tickle value. In the ASC-3550 the RISC flag
-         * command 'clr_tickle_b' does not work unless the host
-         * value is cleared.
-         */
-        AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_NOP);
-    }
+       ulong last_int_level;
+       int result;
+       ADV_DCNT i, j;
+       AdvPortAddr iop_base;
+
+       last_int_level = DvcEnterCritical();
+
+       iop_base = asc_dvc->iop_base;
+
+       /*
+        * Clear the idle command status which is set by the microcode
+        * to a non-zero value to indicate when the command is completed.
+        * The non-zero result is one of the IDLE_CMD_STATUS_* values
+        * defined in a_advlib.h.
+        */
+       AdvWriteWordLram(iop_base, ASC_MC_IDLE_CMD_STATUS, (ushort)0);
+
+       /*
+        * Write the idle command value after the idle command parameter
+        * has been written to avoid a race condition. If the order is not
+        * followed, the microcode may process the idle command before the
+        * parameters have been written to LRAM.
+        */
+       AdvWriteDWordLramNoSwap(iop_base, ASC_MC_IDLE_CMD_PARAMETER,
+                               cpu_to_le32(idle_cmd_parameter));
+       AdvWriteWordLram(iop_base, ASC_MC_IDLE_CMD, idle_cmd);
+
+       /*
+        * Tickle the RISC to tell it to process the idle command.
+        */
+       AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_B);
+       if (asc_dvc->chip_type == ADV_CHIP_ASC3550) {
+               /*
+                * Clear the tickle value. In the ASC-3550 the RISC flag
+                * command 'clr_tickle_b' does not work unless the host
+                * value is cleared.
+                */
+               AdvWriteByteRegister(iop_base, IOPB_TICKLE, ADV_TICKLE_NOP);
+       }
 
-    /* Wait for up to 100 millisecond for the idle command to timeout. */
-    for (i = 0; i < SCSI_WAIT_100_MSEC; i++)
-    {
-        /* Poll once each microsecond for command completion. */
-        for (j = 0; j < SCSI_US_PER_MSEC; j++)
-        {
-            AdvReadWordLram(iop_base, ASC_MC_IDLE_CMD_STATUS, result);
-            if (result != 0)
-            {
-                DvcLeaveCritical(last_int_level);
-                return result;
-            }
-            DvcDelayMicroSecond(asc_dvc, (ushort) 1);
-        }
-    }
+       /* Wait for up to 100 millisecond for the idle command to timeout. */
+       for (i = 0; i < SCSI_WAIT_100_MSEC; i++) {
+               /* Poll once each microsecond for command completion. */
+               for (j = 0; j < SCSI_US_PER_MSEC; j++) {
+                       AdvReadWordLram(iop_base, ASC_MC_IDLE_CMD_STATUS,
+                                       result);
+                       if (result != 0) {
+                               DvcLeaveCritical(last_int_level);
+                               return result;
+                       }
+                       DvcDelayMicroSecond(asc_dvc, (ushort)1);
+               }
+       }
 
-    ASC_ASSERT(0); /* The idle command should never timeout. */
-    DvcLeaveCritical(last_int_level);
-    return ADV_ERROR;
+       ASC_ASSERT(0);          /* The idle command should never timeout. */
+       DvcLeaveCritical(last_int_level);
+       return ADV_ERROR;
 }
 
 /*
@@ -17976,179 +17617,1415 @@ AdvSendIdleCmd(ADV_DVC_VAR *asc_dvc,
  * microcode operating variables that affect WDTR, SDTR, and Tag
  * Queuing.
  */
-STATIC void
-AdvInquiryHandling(
-    ADV_DVC_VAR                 *asc_dvc,
-    ADV_SCSI_REQ_Q              *scsiq)
+static void AdvInquiryHandling(ADV_DVC_VAR *asc_dvc, ADV_SCSI_REQ_Q *scsiq)
 {
-    AdvPortAddr                 iop_base;
-    uchar                       tid;
-    ADV_SCSI_INQUIRY            *inq;
-    ushort                      tidmask;
-    ushort                      cfg_word;
+       AdvPortAddr iop_base;
+       uchar tid;
+       ADV_SCSI_INQUIRY *inq;
+       ushort tidmask;
+       ushort cfg_word;
+
+       /*
+        * AdvInquiryHandling() requires up to INQUIRY information Byte 7
+        * to be available.
+        *
+        * If less than 8 bytes of INQUIRY information were requested or less
+        * than 8 bytes were transferred, then return. cdb[4] is the request
+        * length and the ADV_SCSI_REQ_Q 'data_cnt' field is set by the
+        * microcode to the transfer residual count.
+        */
+
+       if (scsiq->cdb[4] < 8 ||
+           (scsiq->cdb[4] - le32_to_cpu(scsiq->data_cnt)) < 8) {
+               return;
+       }
 
-    /*
-     * AdvInquiryHandling() requires up to INQUIRY information Byte 7
-     * to be available.
-     *
-     * If less than 8 bytes of INQUIRY information were requested or less
-     * than 8 bytes were transferred, then return. cdb[4] is the request
-     * length and the ADV_SCSI_REQ_Q 'data_cnt' field is set by the
-     * microcode to the transfer residual count.
-     */
-
-    if (scsiq->cdb[4] < 8 ||
-        (scsiq->cdb[4] - le32_to_cpu(scsiq->data_cnt)) < 8)
-    {
-        return;
-    }
+       iop_base = asc_dvc->iop_base;
+       tid = scsiq->target_id;
+
+       inq = (ADV_SCSI_INQUIRY *) scsiq->vdata_addr;
 
-    iop_base = asc_dvc->iop_base;
-    tid = scsiq->target_id;
+       /*
+        * WDTR, SDTR, and Tag Queuing cannot be enabled for old devices.
+        */
+       if (ADV_INQ_RESPONSE_FMT(inq) < 2 && ADV_INQ_ANSI_VER(inq) < 2) {
+               return;
+       } else {
+               /*
+                * INQUIRY Byte 7 Handling
+                *
+                * Use a device's INQUIRY byte 7 to determine whether it
+                * supports WDTR, SDTR, and Tag Queuing. If the feature
+                * is enabled in the EEPROM and the device supports the
+                * feature, then enable it in the microcode.
+                */
 
-    inq = (ADV_SCSI_INQUIRY *) scsiq->vdata_addr;
+               tidmask = ADV_TID_TO_TIDMASK(tid);
 
-    /*
-     * WDTR, SDTR, and Tag Queuing cannot be enabled for old devices.
-     */
-    if (ADV_INQ_RESPONSE_FMT(inq) < 2 && ADV_INQ_ANSI_VER(inq) < 2)
-    {
-        return;
-    } else
-    {
-        /*
-         * INQUIRY Byte 7 Handling
-         *
-         * Use a device's INQUIRY byte 7 to determine whether it
-         * supports WDTR, SDTR, and Tag Queuing. If the feature
-         * is enabled in the EEPROM and the device supports the
-         * feature, then enable it in the microcode.
-         */
-
-        tidmask = ADV_TID_TO_TIDMASK(tid);
-
-        /*
-         * Wide Transfers
-         *
-         * If the EEPROM enabled WDTR for the device and the device
-         * supports wide bus (16 bit) transfers, then turn on the
-         * device's 'wdtr_able' bit and write the new value to the
-         * microcode.
-         */
-        if ((asc_dvc->wdtr_able & tidmask) && ADV_INQ_WIDE16(inq))
-        {
-            AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, cfg_word);
-            if ((cfg_word & tidmask) == 0)
-            {
-                cfg_word |= tidmask;
-                AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE, cfg_word);
-
-                /*
-                 * Clear the microcode "SDTR negotiation" and "WDTR
-                 * negotiation" done indicators for the target to cause
-                 * it to negotiate with the new setting set above.
-                 * WDTR when accepted causes the target to enter
-                 * asynchronous mode, so SDTR must be negotiated.
-                 */
-                AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word);
-                cfg_word &= ~tidmask;
-                AdvWriteWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word);
-                AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE, cfg_word);
-                cfg_word &= ~tidmask;
-                AdvWriteWordLram(iop_base, ASC_MC_WDTR_DONE, cfg_word);
-            }
-        }
-
-        /*
-         * Synchronous Transfers
-         *
-         * If the EEPROM enabled SDTR for the device and the device
-         * supports synchronous transfers, then turn on the device's
-         * 'sdtr_able' bit. Write the new value to the microcode.
-         */
-        if ((asc_dvc->sdtr_able & tidmask) && ADV_INQ_SYNC(inq))
-        {
-            AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, cfg_word);
-            if ((cfg_word & tidmask) == 0)
-            {
-                cfg_word |= tidmask;
-                AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE, cfg_word);
-
-                /*
-                 * Clear the microcode "SDTR negotiation" done indicator
-                 * for the target to cause it to negotiate with the new
-                 * setting set above.
-                 */
-                AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word);
-                cfg_word &= ~tidmask;
-                AdvWriteWordLram(iop_base, ASC_MC_SDTR_DONE, cfg_word);
-            }
-        }
-        /*
-         * If the Inquiry data included enough space for the SPI-3
-         * Clocking field, then check if DT mode is supported.
-         */
-        if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600 &&
-            (scsiq->cdb[4] >= 57 ||
-            (scsiq->cdb[4] - le32_to_cpu(scsiq->data_cnt)) >= 57))
-        {
-            /*
-             * PPR (Parallel Protocol Request) Capable
-             *
-             * If the device supports DT mode, then it must be PPR capable.
-             * The PPR message will be used in place of the SDTR and WDTR
-             * messages to negotiate synchronous speed and offset, transfer
-             * width, and protocol options.
-             */
-            if (ADV_INQ_CLOCKING(inq) & ADV_INQ_CLOCKING_DT_ONLY)
-            {
-                AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE, asc_dvc->ppr_able);
-                asc_dvc->ppr_able |= tidmask;
-                AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE, asc_dvc->ppr_able);
-            }
-        }
-
-        /*
-         * If the EEPROM enabled Tag Queuing for the device and the
-         * device supports Tag Queueing, then turn on the device's
-         * 'tagqng_enable' bit in the microcode and set the microcode
-         * maximum command count to the ADV_DVC_VAR 'max_dvc_qng'
-         * value.
-         *
-         * Tag Queuing is disabled for the BIOS which runs in polled
-         * mode and would see no benefit from Tag Queuing. Also by
-         * disabling Tag Queuing in the BIOS devices with Tag Queuing
-         * bugs will at least work with the BIOS.
-         */
-        if ((asc_dvc->tagqng_able & tidmask) && ADV_INQ_CMD_QUEUE(inq))
-        {
-            AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, cfg_word);
-            cfg_word |= tidmask;
-            AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE, cfg_word);
-
-            AdvWriteByteLram(iop_base, ASC_MC_NUMBER_OF_MAX_CMD + tid,
-                asc_dvc->max_dvc_qng);
-        }
-    }
+               /*
+                * Wide Transfers
+                *
+                * If the EEPROM enabled WDTR for the device and the device
+                * supports wide bus (16 bit) transfers, then turn on the
+                * device's 'wdtr_able' bit and write the new value to the
+                * microcode.
+                */
+               if ((asc_dvc->wdtr_able & tidmask) && ADV_INQ_WIDE16(inq)) {
+                       AdvReadWordLram(iop_base, ASC_MC_WDTR_ABLE, cfg_word);
+                       if ((cfg_word & tidmask) == 0) {
+                               cfg_word |= tidmask;
+                               AdvWriteWordLram(iop_base, ASC_MC_WDTR_ABLE,
+                                                cfg_word);
+
+                               /*
+                                * Clear the microcode "SDTR negotiation" and "WDTR
+                                * negotiation" done indicators for the target to cause
+                                * it to negotiate with the new setting set above.
+                                * WDTR when accepted causes the target to enter
+                                * asynchronous mode, so SDTR must be negotiated.
+                                */
+                               AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE,
+                                               cfg_word);
+                               cfg_word &= ~tidmask;
+                               AdvWriteWordLram(iop_base, ASC_MC_SDTR_DONE,
+                                                cfg_word);
+                               AdvReadWordLram(iop_base, ASC_MC_WDTR_DONE,
+                                               cfg_word);
+                               cfg_word &= ~tidmask;
+                               AdvWriteWordLram(iop_base, ASC_MC_WDTR_DONE,
+                                                cfg_word);
+                       }
+               }
+
+               /*
+                * Synchronous Transfers
+                *
+                * If the EEPROM enabled SDTR for the device and the device
+                * supports synchronous transfers, then turn on the device's
+                * 'sdtr_able' bit. Write the new value to the microcode.
+                */
+               if ((asc_dvc->sdtr_able & tidmask) && ADV_INQ_SYNC(inq)) {
+                       AdvReadWordLram(iop_base, ASC_MC_SDTR_ABLE, cfg_word);
+                       if ((cfg_word & tidmask) == 0) {
+                               cfg_word |= tidmask;
+                               AdvWriteWordLram(iop_base, ASC_MC_SDTR_ABLE,
+                                                cfg_word);
+
+                               /*
+                                * Clear the microcode "SDTR negotiation" done indicator
+                                * for the target to cause it to negotiate with the new
+                                * setting set above.
+                                */
+                               AdvReadWordLram(iop_base, ASC_MC_SDTR_DONE,
+                                               cfg_word);
+                               cfg_word &= ~tidmask;
+                               AdvWriteWordLram(iop_base, ASC_MC_SDTR_DONE,
+                                                cfg_word);
+                       }
+               }
+               /*
+                * If the Inquiry data included enough space for the SPI-3
+                * Clocking field, then check if DT mode is supported.
+                */
+               if (asc_dvc->chip_type == ADV_CHIP_ASC38C1600 &&
+                   (scsiq->cdb[4] >= 57 ||
+                    (scsiq->cdb[4] - le32_to_cpu(scsiq->data_cnt)) >= 57)) {
+                       /*
+                        * PPR (Parallel Protocol Request) Capable
+                        *
+                        * If the device supports DT mode, then it must be PPR capable.
+                        * The PPR message will be used in place of the SDTR and WDTR
+                        * messages to negotiate synchronous speed and offset, transfer
+                        * width, and protocol options.
+                        */
+                       if (ADV_INQ_CLOCKING(inq) & ADV_INQ_CLOCKING_DT_ONLY) {
+                               AdvReadWordLram(iop_base, ASC_MC_PPR_ABLE,
+                                               asc_dvc->ppr_able);
+                               asc_dvc->ppr_able |= tidmask;
+                               AdvWriteWordLram(iop_base, ASC_MC_PPR_ABLE,
+                                                asc_dvc->ppr_able);
+                       }
+               }
+
+               /*
+                * If the EEPROM enabled Tag Queuing for the device and the
+                * device supports Tag Queueing, then turn on the device's
+                * 'tagqng_enable' bit in the microcode and set the microcode
+                * maximum command count to the ADV_DVC_VAR 'max_dvc_qng'
+                * value.
+                *
+                * Tag Queuing is disabled for the BIOS which runs in polled
+                * mode and would see no benefit from Tag Queuing. Also by
+                * disabling Tag Queuing in the BIOS devices with Tag Queuing
+                * bugs will at least work with the BIOS.
+                */
+               if ((asc_dvc->tagqng_able & tidmask) && ADV_INQ_CMD_QUEUE(inq)) {
+                       AdvReadWordLram(iop_base, ASC_MC_TAGQNG_ABLE, cfg_word);
+                       cfg_word |= tidmask;
+                       AdvWriteWordLram(iop_base, ASC_MC_TAGQNG_ABLE,
+                                        cfg_word);
+
+                       AdvWriteByteLram(iop_base,
+                                        ASC_MC_NUMBER_OF_MAX_CMD + tid,
+                                        asc_dvc->max_dvc_qng);
+               }
+       }
 }
+
 MODULE_LICENSE("Dual BSD/GPL");
 
+static struct Scsi_Host *__devinit
+advansys_board_found(int iop, struct device *dev, int bus_type)
+{
+       struct Scsi_Host *shost;
+       struct pci_dev *pdev = bus_type == ASC_IS_PCI ? to_pci_dev(dev) : NULL;
+       asc_board_t *boardp;
+       ASC_DVC_VAR *asc_dvc_varp = NULL;
+       ADV_DVC_VAR *adv_dvc_varp = NULL;
+       adv_sgblk_t *sgp = NULL;
+       int share_irq = FALSE;
+       int iolen = 0;
+       ADV_PADDR pci_memory_address;
+       int warn_code, err_code;
+       int ret;
+
+       /*
+        * Adapter found.
+        *
+        * Register the adapter, get its configuration, and
+        * initialize it.
+        */
+       ASC_DBG(2, "advansys_board_found: scsi_register()\n");
+       shost = scsi_register(&driver_template, sizeof(asc_board_t));
+
+       if (!shost)
+               return NULL;
+
+       /* Save a pointer to the Scsi_Host of each board found. */
+       asc_host[asc_board_count++] = shost;
+
+       /* Initialize private per board data */
+       boardp = ASC_BOARDP(shost);
+       memset(boardp, 0, sizeof(asc_board_t));
+       boardp->id = asc_board_count - 1;
+
+       /* Initialize spinlock. */
+       spin_lock_init(&boardp->lock);
+
+       /*
+        * Handle both narrow and wide boards.
+        *
+        * If a Wide board was detected, set the board structure
+        * wide board flag. Set-up the board structure based on
+        * the board type.
+        */
+#ifdef CONFIG_PCI
+       if (bus_type == ASC_IS_PCI &&
+           (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW ||
+            pdev->device == PCI_DEVICE_ID_38C0800_REV1 ||
+            pdev->device == PCI_DEVICE_ID_38C1600_REV1)) {
+               boardp->flags |= ASC_IS_WIDE_BOARD;
+       }
+#endif /* CONFIG_PCI */
+
+       if (ASC_NARROW_BOARD(boardp)) {
+               ASC_DBG(1, "advansys_board_found: narrow board\n");
+               asc_dvc_varp = &boardp->dvc_var.asc_dvc_var;
+               asc_dvc_varp->bus_type = bus_type;
+               asc_dvc_varp->drv_ptr = boardp;
+               asc_dvc_varp->cfg = &boardp->dvc_cfg.asc_dvc_cfg;
+               asc_dvc_varp->cfg->overrun_buf = &overrun_buf[0];
+               asc_dvc_varp->iop_base = iop;
+               asc_dvc_varp->isr_callback = asc_isr_callback;
+       } else {
+               ASC_DBG(1, "advansys_board_found: wide board\n");
+               adv_dvc_varp = &boardp->dvc_var.adv_dvc_var;
+               adv_dvc_varp->drv_ptr = boardp;
+               adv_dvc_varp->cfg = &boardp->dvc_cfg.adv_dvc_cfg;
+               adv_dvc_varp->isr_callback = adv_isr_callback;
+               adv_dvc_varp->async_callback = adv_async_callback;
+#ifdef CONFIG_PCI
+               if (pdev->device == PCI_DEVICE_ID_ASP_ABP940UW) {
+                       ASC_DBG(1, "advansys_board_found: ASC-3550\n");
+                       adv_dvc_varp->chip_type = ADV_CHIP_ASC3550;
+               } else if (pdev->device == PCI_DEVICE_ID_38C0800_REV1) {
+                       ASC_DBG(1, "advansys_board_found: ASC-38C0800\n");
+                       adv_dvc_varp->chip_type = ADV_CHIP_ASC38C0800;
+               } else {
+                       ASC_DBG(1, "advansys_board_found: ASC-38C1600\n");
+                       adv_dvc_varp->chip_type = ADV_CHIP_ASC38C1600;
+               }
+#endif /* CONFIG_PCI */
+
+               /*
+                * Map the board's registers into virtual memory for
+                * PCI slave access. Only memory accesses are used to
+                * access the board's registers.
+                *
+                * Note: The PCI register base address is not always
+                * page aligned, but the address passed to ioremap()
+                * must be page aligned. It is guaranteed that the
+                * PCI register base address will not cross a page
+                * boundary.
+                */
+               if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+                       iolen = ADV_3550_IOLEN;
+               } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+                       iolen = ADV_38C0800_IOLEN;
+               } else {
+                       iolen = ADV_38C1600_IOLEN;
+               }
+#ifdef CONFIG_PCI
+               pci_memory_address = pci_resource_start(pdev, 1);
+               ASC_DBG1(1,
+                        "advansys_board_found: pci_memory_address: 0x%lx\n",
+                        (ulong)pci_memory_address);
+               if ((boardp->ioremap_addr =
+                    ioremap(pci_memory_address & PAGE_MASK, PAGE_SIZE)) == 0) {
+                       ASC_PRINT3
+                           ("advansys_board_found: board %d: ioremap(%x, %d) returned NULL\n",
+                            boardp->id, pci_memory_address, iolen);
+                       scsi_unregister(shost);
+                       asc_board_count--;
+                       return NULL;
+               }
+               ASC_DBG1(1,
+                        "advansys_board_found: ioremap_addr: 0x%lx\n",
+                        (ulong)boardp->ioremap_addr);
+               adv_dvc_varp->iop_base = (AdvPortAddr)
+                   (boardp->ioremap_addr +
+                    (pci_memory_address - (pci_memory_address & PAGE_MASK)));
+               ASC_DBG1(1,
+                        "advansys_board_found: iop_base: 0x%lx\n",
+                        adv_dvc_varp->iop_base);
+#endif /* CONFIG_PCI */
+
+               /*
+                * Even though it isn't used to access wide boards, other
+                * than for the debug line below, save I/O Port address so
+                * that it can be reported.
+                */
+               boardp->ioport = iop;
+
+               ASC_DBG2(1,
+                        "advansys_board_found: iopb_chip_id_1 0x%x, iopw_chip_id_0 0x%x\n",
+                        (ushort)inp(iop + 1), (ushort)inpw(iop));
+       }
+
+#ifdef CONFIG_PROC_FS
+       /*
+        * Allocate buffer for printing information from
+        * /proc/scsi/advansys/[0...].
+        */
+       if ((boardp->prtbuf = kmalloc(ASC_PRTBUF_SIZE, GFP_ATOMIC)) == NULL) {
+               ASC_PRINT3
+                   ("advansys_board_found: board %d: kmalloc(%d, %d) returned NULL\n",
+                    boardp->id, ASC_PRTBUF_SIZE, GFP_ATOMIC);
+               scsi_unregister(shost);
+               asc_board_count--;
+               return NULL;
+       }
+#endif /* CONFIG_PROC_FS */
+
+       if (ASC_NARROW_BOARD(boardp)) {
+               asc_dvc_varp->cfg->dev = dev;
+               /*
+                * Set the board bus type and PCI IRQ before
+                * calling AscInitGetConfig().
+                */
+               switch (asc_dvc_varp->bus_type) {
+#ifdef CONFIG_ISA
+               case ASC_IS_ISA:
+                       shost->unchecked_isa_dma = TRUE;
+                       share_irq = FALSE;
+                       break;
+               case ASC_IS_VL:
+                       shost->unchecked_isa_dma = FALSE;
+                       share_irq = FALSE;
+                       break;
+               case ASC_IS_EISA:
+                       shost->unchecked_isa_dma = FALSE;
+                       share_irq = TRUE;
+                       break;
+#endif /* CONFIG_ISA */
+#ifdef CONFIG_PCI
+               case ASC_IS_PCI:
+                       shost->irq = asc_dvc_varp->irq_no = pdev->irq;
+                       asc_dvc_varp->cfg->pci_slot_info =
+                           ASC_PCI_MKID(pdev->bus->number,
+                                        PCI_SLOT(pdev->devfn),
+                                        PCI_FUNC(pdev->devfn));
+                       shost->unchecked_isa_dma = FALSE;
+                       share_irq = TRUE;
+                       break;
+#endif /* CONFIG_PCI */
+               default:
+                       ASC_PRINT2
+                           ("advansys_board_found: board %d: unknown adapter type: %d\n",
+                            boardp->id, asc_dvc_varp->bus_type);
+                       shost->unchecked_isa_dma = TRUE;
+                       share_irq = FALSE;
+                       break;
+               }
+       } else {
+               adv_dvc_varp->cfg->dev = dev;
+               /*
+                * For Wide boards set PCI information before calling
+                * AdvInitGetConfig().
+                */
+#ifdef CONFIG_PCI
+               shost->irq = adv_dvc_varp->irq_no = pdev->irq;
+               adv_dvc_varp->cfg->pci_slot_info =
+                   ASC_PCI_MKID(pdev->bus->number,
+                                PCI_SLOT(pdev->devfn),
+                                PCI_FUNC(pdev->devfn));
+               shost->unchecked_isa_dma = FALSE;
+               share_irq = TRUE;
+#endif /* CONFIG_PCI */
+       }
+
+       /*
+        * Read the board configuration.
+        */
+       if (ASC_NARROW_BOARD(boardp)) {
+               /*
+                * NOTE: AscInitGetConfig() may change the board's
+                * bus_type value. The bus_type value should no
+                * longer be used. If the bus_type field must be
+                * referenced only use the bit-wise AND operator "&".
+                */
+               ASC_DBG(2, "advansys_board_found: AscInitGetConfig()\n");
+               switch (ret = AscInitGetConfig(asc_dvc_varp)) {
+               case 0: /* No error */
+                       break;
+               case ASC_WARN_IO_PORT_ROTATE:
+                       ASC_PRINT1
+                           ("AscInitGetConfig: board %d: I/O port address modified\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_AUTO_CONFIG:
+                       ASC_PRINT1
+                           ("AscInitGetConfig: board %d: I/O port increment switch enabled\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_EEPROM_CHKSUM:
+                       ASC_PRINT1
+                           ("AscInitGetConfig: board %d: EEPROM checksum error\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_IRQ_MODIFIED:
+                       ASC_PRINT1
+                           ("AscInitGetConfig: board %d: IRQ modified\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_CMD_QNG_CONFLICT:
+                       ASC_PRINT1
+                           ("AscInitGetConfig: board %d: tag queuing enabled w/o disconnects\n",
+                            boardp->id);
+                       break;
+               default:
+                       ASC_PRINT2
+                           ("AscInitGetConfig: board %d: unknown warning: 0x%x\n",
+                            boardp->id, ret);
+                       break;
+               }
+               if ((err_code = asc_dvc_varp->err_code) != 0) {
+                       ASC_PRINT3
+                           ("AscInitGetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
+                            boardp->id,
+                            asc_dvc_varp->init_state, asc_dvc_varp->err_code);
+               }
+       } else {
+               ASC_DBG(2, "advansys_board_found: AdvInitGetConfig()\n");
+               if ((ret = AdvInitGetConfig(adv_dvc_varp)) != 0) {
+                       ASC_PRINT2
+                           ("AdvInitGetConfig: board %d: warning: 0x%x\n",
+                            boardp->id, ret);
+               }
+               if ((err_code = adv_dvc_varp->err_code) != 0) {
+                       ASC_PRINT2
+                           ("AdvInitGetConfig: board %d error: err_code 0x%x\n",
+                            boardp->id, adv_dvc_varp->err_code);
+               }
+       }
+
+       if (err_code != 0) {
+#ifdef CONFIG_PROC_FS
+               kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+               scsi_unregister(shost);
+               asc_board_count--;
+               return NULL;
+       }
+
+       /*
+        * Save the EEPROM configuration so that it can be displayed
+        * from /proc/scsi/advansys/[0...].
+        */
+       if (ASC_NARROW_BOARD(boardp)) {
+
+               ASCEEP_CONFIG *ep;
+
+               /*
+                * Set the adapter's target id bit in the 'init_tidmask' field.
+                */
+               boardp->init_tidmask |=
+                   ADV_TID_TO_TIDMASK(asc_dvc_varp->cfg->chip_scsi_id);
+
+               /*
+                * Save EEPROM settings for the board.
+                */
+               ep = &boardp->eep_config.asc_eep;
+
+               ep->init_sdtr = asc_dvc_varp->cfg->sdtr_enable;
+               ep->disc_enable = asc_dvc_varp->cfg->disc_enable;
+               ep->use_cmd_qng = asc_dvc_varp->cfg->cmd_qng_enabled;
+               ASC_EEP_SET_DMA_SPD(ep, asc_dvc_varp->cfg->isa_dma_speed);
+               ep->start_motor = asc_dvc_varp->start_motor;
+               ep->cntl = asc_dvc_varp->dvc_cntl;
+               ep->no_scam = asc_dvc_varp->no_scam;
+               ep->max_total_qng = asc_dvc_varp->max_total_qng;
+               ASC_EEP_SET_CHIP_ID(ep, asc_dvc_varp->cfg->chip_scsi_id);
+               /* 'max_tag_qng' is set to the same value for every device. */
+               ep->max_tag_qng = asc_dvc_varp->cfg->max_tag_qng[0];
+               ep->adapter_info[0] = asc_dvc_varp->cfg->adapter_info[0];
+               ep->adapter_info[1] = asc_dvc_varp->cfg->adapter_info[1];
+               ep->adapter_info[2] = asc_dvc_varp->cfg->adapter_info[2];
+               ep->adapter_info[3] = asc_dvc_varp->cfg->adapter_info[3];
+               ep->adapter_info[4] = asc_dvc_varp->cfg->adapter_info[4];
+               ep->adapter_info[5] = asc_dvc_varp->cfg->adapter_info[5];
+
+               /*
+                * Modify board configuration.
+                */
+               ASC_DBG(2, "advansys_board_found: AscInitSetConfig()\n");
+               switch (ret = AscInitSetConfig(asc_dvc_varp)) {
+               case 0: /* No error. */
+                       break;
+               case ASC_WARN_IO_PORT_ROTATE:
+                       ASC_PRINT1
+                           ("AscInitSetConfig: board %d: I/O port address modified\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_AUTO_CONFIG:
+                       ASC_PRINT1
+                           ("AscInitSetConfig: board %d: I/O port increment switch enabled\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_EEPROM_CHKSUM:
+                       ASC_PRINT1
+                           ("AscInitSetConfig: board %d: EEPROM checksum error\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_IRQ_MODIFIED:
+                       ASC_PRINT1
+                           ("AscInitSetConfig: board %d: IRQ modified\n",
+                            boardp->id);
+                       break;
+               case ASC_WARN_CMD_QNG_CONFLICT:
+                       ASC_PRINT1
+                           ("AscInitSetConfig: board %d: tag queuing w/o disconnects\n",
+                            boardp->id);
+                       break;
+               default:
+                       ASC_PRINT2
+                           ("AscInitSetConfig: board %d: unknown warning: 0x%x\n",
+                            boardp->id, ret);
+                       break;
+               }
+               if (asc_dvc_varp->err_code != 0) {
+                       ASC_PRINT3
+                           ("AscInitSetConfig: board %d error: init_state 0x%x, err_code 0x%x\n",
+                            boardp->id,
+                            asc_dvc_varp->init_state, asc_dvc_varp->err_code);
+#ifdef CONFIG_PROC_FS
+                       kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+                       scsi_unregister(shost);
+                       asc_board_count--;
+                       return NULL;
+               }
+
+               /*
+                * Finish initializing the 'Scsi_Host' structure.
+                */
+               /* AscInitSetConfig() will set the IRQ for non-PCI boards. */
+               if ((asc_dvc_varp->bus_type & ASC_IS_PCI) == 0) {
+                       shost->irq = asc_dvc_varp->irq_no;
+               }
+       } else {
+               ADVEEP_3550_CONFIG *ep_3550;
+               ADVEEP_38C0800_CONFIG *ep_38C0800;
+               ADVEEP_38C1600_CONFIG *ep_38C1600;
+
+               /*
+                * Save Wide EEP Configuration Information.
+                */
+               if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+                       ep_3550 = &boardp->eep_config.adv_3550_eep;
+
+                       ep_3550->adapter_scsi_id = adv_dvc_varp->chip_scsi_id;
+                       ep_3550->max_host_qng = adv_dvc_varp->max_host_qng;
+                       ep_3550->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
+                       ep_3550->termination = adv_dvc_varp->cfg->termination;
+                       ep_3550->disc_enable = adv_dvc_varp->cfg->disc_enable;
+                       ep_3550->bios_ctrl = adv_dvc_varp->bios_ctrl;
+                       ep_3550->wdtr_able = adv_dvc_varp->wdtr_able;
+                       ep_3550->sdtr_able = adv_dvc_varp->sdtr_able;
+                       ep_3550->ultra_able = adv_dvc_varp->ultra_able;
+                       ep_3550->tagqng_able = adv_dvc_varp->tagqng_able;
+                       ep_3550->start_motor = adv_dvc_varp->start_motor;
+                       ep_3550->scsi_reset_delay =
+                           adv_dvc_varp->scsi_reset_wait;
+                       ep_3550->serial_number_word1 =
+                           adv_dvc_varp->cfg->serial1;
+                       ep_3550->serial_number_word2 =
+                           adv_dvc_varp->cfg->serial2;
+                       ep_3550->serial_number_word3 =
+                           adv_dvc_varp->cfg->serial3;
+               } else if (adv_dvc_varp->chip_type == ADV_CHIP_ASC38C0800) {
+                       ep_38C0800 = &boardp->eep_config.adv_38C0800_eep;
+
+                       ep_38C0800->adapter_scsi_id =
+                           adv_dvc_varp->chip_scsi_id;
+                       ep_38C0800->max_host_qng = adv_dvc_varp->max_host_qng;
+                       ep_38C0800->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
+                       ep_38C0800->termination_lvd =
+                           adv_dvc_varp->cfg->termination;
+                       ep_38C0800->disc_enable =
+                           adv_dvc_varp->cfg->disc_enable;
+                       ep_38C0800->bios_ctrl = adv_dvc_varp->bios_ctrl;
+                       ep_38C0800->wdtr_able = adv_dvc_varp->wdtr_able;
+                       ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
+                       ep_38C0800->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
+                       ep_38C0800->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
+                       ep_38C0800->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
+                       ep_38C0800->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
+                       ep_38C0800->tagqng_able = adv_dvc_varp->tagqng_able;
+                       ep_38C0800->start_motor = adv_dvc_varp->start_motor;
+                       ep_38C0800->scsi_reset_delay =
+                           adv_dvc_varp->scsi_reset_wait;
+                       ep_38C0800->serial_number_word1 =
+                           adv_dvc_varp->cfg->serial1;
+                       ep_38C0800->serial_number_word2 =
+                           adv_dvc_varp->cfg->serial2;
+                       ep_38C0800->serial_number_word3 =
+                           adv_dvc_varp->cfg->serial3;
+               } else {
+                       ep_38C1600 = &boardp->eep_config.adv_38C1600_eep;
+
+                       ep_38C1600->adapter_scsi_id =
+                           adv_dvc_varp->chip_scsi_id;
+                       ep_38C1600->max_host_qng = adv_dvc_varp->max_host_qng;
+                       ep_38C1600->max_dvc_qng = adv_dvc_varp->max_dvc_qng;
+                       ep_38C1600->termination_lvd =
+                           adv_dvc_varp->cfg->termination;
+                       ep_38C1600->disc_enable =
+                           adv_dvc_varp->cfg->disc_enable;
+                       ep_38C1600->bios_ctrl = adv_dvc_varp->bios_ctrl;
+                       ep_38C1600->wdtr_able = adv_dvc_varp->wdtr_able;
+                       ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
+                       ep_38C1600->sdtr_speed1 = adv_dvc_varp->sdtr_speed1;
+                       ep_38C1600->sdtr_speed2 = adv_dvc_varp->sdtr_speed2;
+                       ep_38C1600->sdtr_speed3 = adv_dvc_varp->sdtr_speed3;
+                       ep_38C1600->sdtr_speed4 = adv_dvc_varp->sdtr_speed4;
+                       ep_38C1600->tagqng_able = adv_dvc_varp->tagqng_able;
+                       ep_38C1600->start_motor = adv_dvc_varp->start_motor;
+                       ep_38C1600->scsi_reset_delay =
+                           adv_dvc_varp->scsi_reset_wait;
+                       ep_38C1600->serial_number_word1 =
+                           adv_dvc_varp->cfg->serial1;
+                       ep_38C1600->serial_number_word2 =
+                           adv_dvc_varp->cfg->serial2;
+                       ep_38C1600->serial_number_word3 =
+                           adv_dvc_varp->cfg->serial3;
+               }
+
+               /*
+                * Set the adapter's target id bit in the 'init_tidmask' field.
+                */
+               boardp->init_tidmask |=
+                   ADV_TID_TO_TIDMASK(adv_dvc_varp->chip_scsi_id);
+
+               /*
+                * Finish initializing the 'Scsi_Host' structure.
+                */
+               shost->irq = adv_dvc_varp->irq_no;
+       }
+
+       /*
+        * Channels are numbered beginning with 0. For AdvanSys one host
+        * structure supports one channel. Multi-channel boards have a
+        * separate host structure for each channel.
+        */
+       shost->max_channel = 0;
+       if (ASC_NARROW_BOARD(boardp)) {
+               shost->max_id = ASC_MAX_TID + 1;
+               shost->max_lun = ASC_MAX_LUN + 1;
+
+               shost->io_port = asc_dvc_varp->iop_base;
+               boardp->asc_n_io_port = ASC_IOADR_GAP;
+               shost->this_id = asc_dvc_varp->cfg->chip_scsi_id;
+
+               /* Set maximum number of queues the adapter can handle. */
+               shost->can_queue = asc_dvc_varp->max_total_qng;
+       } else {
+               shost->max_id = ADV_MAX_TID + 1;
+               shost->max_lun = ADV_MAX_LUN + 1;
+
+               /*
+                * Save the I/O Port address and length even though
+                * I/O ports are not used to access Wide boards.
+                * Instead the Wide boards are accessed with
+                * PCI Memory Mapped I/O.
+                */
+               shost->io_port = iop;
+               boardp->asc_n_io_port = iolen;
+
+               shost->this_id = adv_dvc_varp->chip_scsi_id;
+
+               /* Set maximum number of queues the adapter can handle. */
+               shost->can_queue = adv_dvc_varp->max_host_qng;
+       }
+
+       /*
+        * 'n_io_port' currently is one byte.
+        *
+        * Set a value to 'n_io_port', but never referenced it because
+        * it may be truncated.
+        */
+       shost->n_io_port = boardp->asc_n_io_port <= 255 ?
+           boardp->asc_n_io_port : 255;
+
+       /*
+        * Following v1.3.89, 'cmd_per_lun' is no longer needed
+        * and should be set to zero.
+        *
+        * But because of a bug introduced in v1.3.89 if the driver is
+        * compiled as a module and 'cmd_per_lun' is zero, the Mid-Level
+        * SCSI function 'allocate_device' will panic. To allow the driver
+        * to work as a module in these kernels set 'cmd_per_lun' to 1.
+        *
+        * Note: This is wrong.  cmd_per_lun should be set to the depth
+        * you want on untagged devices always.
+        #ifdef MODULE
+        */
+       shost->cmd_per_lun = 1;
+/* #else
+            shost->cmd_per_lun = 0;
+#endif */
+
+       /*
+        * Set the maximum number of scatter-gather elements the
+        * adapter can handle.
+        */
+       if (ASC_NARROW_BOARD(boardp)) {
+               /*
+                * Allow two commands with 'sg_tablesize' scatter-gather
+                * elements to be executed simultaneously. This value is
+                * the theoretical hardware limit. It may be decreased
+                * below.
+                */
+               shost->sg_tablesize =
+                   (((asc_dvc_varp->max_total_qng - 2) / 2) *
+                    ASC_SG_LIST_PER_Q) + 1;
+       } else {
+               shost->sg_tablesize = ADV_MAX_SG_LIST;
+       }
+
+       /*
+        * The value of 'sg_tablesize' can not exceed the SCSI
+        * mid-level driver definition of SG_ALL. SG_ALL also
+        * must not be exceeded, because it is used to define the
+        * size of the scatter-gather table in 'struct asc_sg_head'.
+        */
+       if (shost->sg_tablesize > SG_ALL) {
+               shost->sg_tablesize = SG_ALL;
+       }
+
+       ASC_DBG1(1, "advansys_board_found: sg_tablesize: %d\n", shost->sg_tablesize);
+
+       /* BIOS start address. */
+       if (ASC_NARROW_BOARD(boardp)) {
+               shost->base = ((ulong)
+                            AscGetChipBiosAddress(asc_dvc_varp->
+                                                  iop_base,
+                                                  asc_dvc_varp->bus_type));
+       } else {
+               /*
+                * Fill-in BIOS board variables. The Wide BIOS saves
+                * information in LRAM that is used by the driver.
+                */
+               AdvReadWordLram(adv_dvc_varp->iop_base,
+                               BIOS_SIGNATURE, boardp->bios_signature);
+               AdvReadWordLram(adv_dvc_varp->iop_base,
+                               BIOS_VERSION, boardp->bios_version);
+               AdvReadWordLram(adv_dvc_varp->iop_base,
+                               BIOS_CODESEG, boardp->bios_codeseg);
+               AdvReadWordLram(adv_dvc_varp->iop_base,
+                               BIOS_CODELEN, boardp->bios_codelen);
+
+               ASC_DBG2(1,
+                        "advansys_board_found: bios_signature 0x%x, bios_version 0x%x\n",
+                        boardp->bios_signature, boardp->bios_version);
+
+               ASC_DBG2(1,
+                        "advansys_board_found: bios_codeseg 0x%x, bios_codelen 0x%x\n",
+                        boardp->bios_codeseg, boardp->bios_codelen);
+
+               /*
+                * If the BIOS saved a valid signature, then fill in
+                * the BIOS code segment base address.
+                */
+               if (boardp->bios_signature == 0x55AA) {
+                       /*
+                        * Convert x86 realmode code segment to a linear
+                        * address by shifting left 4.
+                        */
+                       shost->base = ((ulong)boardp->bios_codeseg << 4);
+               } else {
+                       shost->base = 0;
+               }
+       }
+
+       /*
+        * Register Board Resources - I/O Port, DMA, IRQ
+        */
+
+       /*
+        * Register I/O port range.
+        *
+        * For Wide boards the I/O ports are not used to access
+        * the board, but request the region anyway.
+        *
+        * 'shost->n_io_port' is not referenced, because it may be truncated.
+        */
+       ASC_DBG2(2,
+                "advansys_board_found: request_region port 0x%lx, len 0x%x\n",
+                (ulong)shost->io_port, boardp->asc_n_io_port);
+       if (request_region(shost->io_port, boardp->asc_n_io_port,
+                          "advansys") == NULL) {
+               ASC_PRINT3
+                   ("advansys_board_found: board %d: request_region() failed, port 0x%lx, len 0x%x\n",
+                    boardp->id, (ulong)shost->io_port, boardp->asc_n_io_port);
+#ifdef CONFIG_PROC_FS
+               kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+               scsi_unregister(shost);
+               asc_board_count--;
+               return NULL;
+       }
+
+       /* Register DMA Channel for Narrow boards. */
+       shost->dma_channel = NO_ISA_DMA;        /* Default to no ISA DMA. */
+#ifdef CONFIG_ISA
+       if (ASC_NARROW_BOARD(boardp)) {
+               /* Register DMA channel for ISA bus. */
+               if (asc_dvc_varp->bus_type & ASC_IS_ISA) {
+                       shost->dma_channel = asc_dvc_varp->cfg->isa_dma_channel;
+                       if ((ret =
+                            request_dma(shost->dma_channel, "advansys")) != 0) {
+                               ASC_PRINT3
+                                   ("advansys_board_found: board %d: request_dma() %d failed %d\n",
+                                    boardp->id, shost->dma_channel, ret);
+                               release_region(shost->io_port,
+                                              boardp->asc_n_io_port);
+#ifdef CONFIG_PROC_FS
+                               kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+                               scsi_unregister(shost);
+                               asc_board_count--;
+                               return NULL;
+                       }
+                       AscEnableIsaDma(shost->dma_channel);
+               }
+       }
+#endif /* CONFIG_ISA */
+
+       /* Register IRQ Number. */
+       ASC_DBG1(2, "advansys_board_found: request_irq() %d\n", shost->irq);
+       /*
+        * If request_irq() fails with the IRQF_DISABLED flag set,
+        * then try again without the IRQF_DISABLED flag set. This
+        * allows IRQ sharing to work even with other drivers that
+        * do not set the IRQF_DISABLED flag.
+        *
+        * If IRQF_DISABLED is not set, then interrupts are enabled
+        * before the driver interrupt function is called.
+        */
+       if (((ret = request_irq(shost->irq, advansys_interrupt,
+                               IRQF_DISABLED | (share_irq ==
+                                                TRUE ?
+                                                IRQF_SHARED :
+                                                0), "advansys", boardp)) != 0)
+           &&
+           ((ret =
+             request_irq(shost->irq, advansys_interrupt,
+                         (share_irq == TRUE ? IRQF_SHARED : 0),
+                         "advansys", boardp)) != 0)) {
+               if (ret == -EBUSY) {
+                       ASC_PRINT2
+                           ("advansys_board_found: board %d: request_irq(): IRQ 0x%x already in use.\n",
+                            boardp->id, shost->irq);
+               } else if (ret == -EINVAL) {
+                       ASC_PRINT2
+                           ("advansys_board_found: board %d: request_irq(): IRQ 0x%x not valid.\n",
+                            boardp->id, shost->irq);
+               } else {
+                       ASC_PRINT3
+                           ("advansys_board_found: board %d: request_irq(): IRQ 0x%x failed with %d\n",
+                            boardp->id, shost->irq, ret);
+               }
+               release_region(shost->io_port, boardp->asc_n_io_port);
+               iounmap(boardp->ioremap_addr);
+               if (shost->dma_channel != NO_ISA_DMA) {
+                       free_dma(shost->dma_channel);
+               }
+#ifdef CONFIG_PROC_FS
+               kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+               scsi_unregister(shost);
+               asc_board_count--;
+               return NULL;
+       }
+
+       /*
+        * Initialize board RISC chip and enable interrupts.
+        */
+       if (ASC_NARROW_BOARD(boardp)) {
+               ASC_DBG(2, "advansys_board_found: AscInitAsc1000Driver()\n");
+               warn_code = AscInitAsc1000Driver(asc_dvc_varp);
+               err_code = asc_dvc_varp->err_code;
+
+               if (warn_code || err_code) {
+                       ASC_PRINT4
+                           ("advansys_board_found: board %d error: init_state 0x%x, warn 0x%x, error 0x%x\n",
+                            boardp->id,
+                            asc_dvc_varp->init_state, warn_code, err_code);
+               }
+       } else {
+               ADV_CARR_T *carrp;
+               int req_cnt = 0;
+               adv_req_t *reqp = NULL;
+               int sg_cnt = 0;
+
+               /*
+                * Allocate buffer carrier structures. The total size
+                * is about 4 KB, so allocate all at once.
+                */
+               carrp = (ADV_CARR_T *) kmalloc(ADV_CARRIER_BUFSIZE, GFP_ATOMIC);
+               ASC_DBG1(1, "advansys_board_found: carrp 0x%lx\n", (ulong)carrp);
+
+               if (carrp == NULL) {
+                       goto kmalloc_error;
+               }
+
+               /*
+                * Allocate up to 'max_host_qng' request structures for
+                * the Wide board. The total size is about 16 KB, so
+                * allocate all at once. If the allocation fails decrement
+                * and try again.
+                */
+               for (req_cnt = adv_dvc_varp->max_host_qng;
+                    req_cnt > 0; req_cnt--) {
+
+                       reqp = (adv_req_t *)
+                           kmalloc(sizeof(adv_req_t) * req_cnt, GFP_ATOMIC);
+
+                       ASC_DBG3(1,
+                                "advansys_board_found: reqp 0x%lx, req_cnt %d, bytes %lu\n",
+                                (ulong)reqp, req_cnt,
+                                (ulong)sizeof(adv_req_t) * req_cnt);
+
+                       if (reqp != NULL) {
+                               break;
+                       }
+               }
+               if (reqp == NULL) {
+                       goto kmalloc_error;
+               }
+
+               /*
+                * Allocate up to ADV_TOT_SG_BLOCK request structures for
+                * the Wide board. Each structure is about 136 bytes.
+                */
+               boardp->adv_sgblkp = NULL;
+               for (sg_cnt = 0; sg_cnt < ADV_TOT_SG_BLOCK; sg_cnt++) {
+
+                       sgp = (adv_sgblk_t *)
+                           kmalloc(sizeof(adv_sgblk_t), GFP_ATOMIC);
+
+                       if (sgp == NULL) {
+                               break;
+                       }
+
+                       sgp->next_sgblkp = boardp->adv_sgblkp;
+                       boardp->adv_sgblkp = sgp;
+
+               }
+               ASC_DBG3(1,
+                        "advansys_board_found: sg_cnt %d * %u = %u bytes\n",
+                        sg_cnt, sizeof(adv_sgblk_t),
+                        (unsigned)(sizeof(adv_sgblk_t) * sg_cnt));
+
+               /*
+                * If no request structures or scatter-gather structures could
+                * be allocated, then return an error. Otherwise continue with
+                * initialization.
+                */
+ kmalloc_error:
+               if (carrp == NULL) {
+                       ASC_PRINT1
+                           ("advansys_board_found: board %d error: failed to kmalloc() carrier buffer.\n",
+                            boardp->id);
+                       err_code = ADV_ERROR;
+               } else if (reqp == NULL) {
+                       kfree(carrp);
+                       ASC_PRINT1
+                           ("advansys_board_found: board %d error: failed to kmalloc() adv_req_t buffer.\n",
+                            boardp->id);
+                       err_code = ADV_ERROR;
+               } else if (boardp->adv_sgblkp == NULL) {
+                       kfree(carrp);
+                       kfree(reqp);
+                       ASC_PRINT1
+                           ("advansys_board_found: board %d error: failed to kmalloc() adv_sgblk_t buffers.\n",
+                            boardp->id);
+                       err_code = ADV_ERROR;
+               } else {
+
+                       /* Save carrier buffer pointer. */
+                       boardp->orig_carrp = carrp;
+
+                       /*
+                        * Save original pointer for kfree() in case the
+                        * driver is built as a module and can be unloaded.
+                        */
+                       boardp->orig_reqp = reqp;
+
+                       adv_dvc_varp->carrier_buf = carrp;
+
+                       /*
+                        * Point 'adv_reqp' to the request structures and
+                        * link them together.
+                        */
+                       req_cnt--;
+                       reqp[req_cnt].next_reqp = NULL;
+                       for (; req_cnt > 0; req_cnt--) {
+                               reqp[req_cnt - 1].next_reqp = &reqp[req_cnt];
+                       }
+                       boardp->adv_reqp = &reqp[0];
+
+                       if (adv_dvc_varp->chip_type == ADV_CHIP_ASC3550) {
+                               ASC_DBG(2,
+                                       "advansys_board_found: AdvInitAsc3550Driver()\n");
+                               warn_code = AdvInitAsc3550Driver(adv_dvc_varp);
+                       } else if (adv_dvc_varp->chip_type ==
+                                  ADV_CHIP_ASC38C0800) {
+                               ASC_DBG(2,
+                                       "advansys_board_found: AdvInitAsc38C0800Driver()\n");
+                               warn_code =
+                                   AdvInitAsc38C0800Driver(adv_dvc_varp);
+                       } else {
+                               ASC_DBG(2,
+                                       "advansys_board_found: AdvInitAsc38C1600Driver()\n");
+                               warn_code =
+                                   AdvInitAsc38C1600Driver(adv_dvc_varp);
+                       }
+                       err_code = adv_dvc_varp->err_code;
+
+                       if (warn_code || err_code) {
+                               ASC_PRINT3
+                                   ("advansys_board_found: board %d error: warn 0x%x, error 0x%x\n",
+                                    boardp->id, warn_code, err_code);
+                       }
+               }
+       }
+
+       if (err_code != 0) {
+               release_region(shost->io_port, boardp->asc_n_io_port);
+               if (ASC_WIDE_BOARD(boardp)) {
+                       iounmap(boardp->ioremap_addr);
+                       kfree(boardp->orig_carrp);
+                       boardp->orig_carrp = NULL;
+                       if (boardp->orig_reqp) {
+                               kfree(boardp->orig_reqp);
+                               boardp->orig_reqp = boardp->adv_reqp = NULL;
+                       }
+                       while ((sgp = boardp->adv_sgblkp) != NULL) {
+                               boardp->adv_sgblkp = sgp->next_sgblkp;
+                               kfree(sgp);
+                       }
+               }
+               if (shost->dma_channel != NO_ISA_DMA) {
+                       free_dma(shost->dma_channel);
+               }
+#ifdef CONFIG_PROC_FS
+               kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+               free_irq(shost->irq, boardp);
+               scsi_unregister(shost);
+               asc_board_count--;
+               return NULL;
+       }
+       ASC_DBG_PRT_SCSI_HOST(2, shost);
+
+       return shost;
+}
+
+/*
+ * advansys_detect()
+ *
+ * Detect function for AdvanSys adapters.
+ *
+ * Argument is a pointer to the host driver's scsi_hosts entry.
+ *
+ * Return number of adapters found.
+ *
+ * Note: Because this function is called during system initialization
+ * it must not call SCSI mid-level functions including scsi_malloc()
+ * and scsi_free().
+ */
+static int __init advansys_detect(struct scsi_host_template *tpnt)
+{
+       static int detect_called = ASC_FALSE;
+       int iop;
+       int bus;
+       int ioport = 0;
+       struct device *dev = NULL;
+#ifdef CONFIG_PCI
+       int pci_init_search = 0;
+       struct pci_dev *pci_devicep[ASC_NUM_BOARD_SUPPORTED];
+       int pci_card_cnt_max = 0;
+       int pci_card_cnt = 0;
+       struct pci_dev *pdev = NULL;
+       int pci_device_id_cnt = 0;
+       unsigned int pci_device_id[ASC_PCI_DEVICE_ID_CNT] = {
+               PCI_DEVICE_ID_ASP_1200A,
+               PCI_DEVICE_ID_ASP_ABP940,
+               PCI_DEVICE_ID_ASP_ABP940U,
+               PCI_DEVICE_ID_ASP_ABP940UW,
+               PCI_DEVICE_ID_38C0800_REV1,
+               PCI_DEVICE_ID_38C1600_REV1
+       };
+#endif /* CONFIG_PCI */
+
+       if (detect_called == ASC_FALSE) {
+               detect_called = ASC_TRUE;
+       } else {
+               printk
+                   ("AdvanSys SCSI: advansys_detect() multiple calls ignored\n");
+               return 0;
+       }
+
+       ASC_DBG(1, "advansys_detect: begin\n");
+
+       asc_board_count = 0;
+
+       /*
+        * If I/O port probing has been modified, then verify and
+        * clean-up the 'asc_ioport' list.
+        */
+       if (asc_iopflag == ASC_TRUE) {
+               for (ioport = 0; ioport < ASC_NUM_IOPORT_PROBE; ioport++) {
+                       ASC_DBG2(1, "advansys_detect: asc_ioport[%d] 0x%x\n",
+                                ioport, asc_ioport[ioport]);
+                       if (asc_ioport[ioport] != 0) {
+                               for (iop = 0; iop < ASC_IOADR_TABLE_MAX_IX;
+                                    iop++) {
+                                       if (_asc_def_iop_base[iop] ==
+                                           asc_ioport[ioport]) {
+                                               break;
+                                       }
+                               }
+                               if (iop == ASC_IOADR_TABLE_MAX_IX) {
+                                       printk
+                                           ("AdvanSys SCSI: specified I/O Port 0x%X is invalid\n",
+                                            asc_ioport[ioport]);
+                                       asc_ioport[ioport] = 0;
+                               }
+                       }
+               }
+               ioport = 0;
+       }
+
+       for (bus = 0; bus < ASC_NUM_BUS; bus++) {
+
+               ASC_DBG2(1, "advansys_detect: bus search type %d (%s)\n",
+                        bus, asc_bus_name[bus]);
+               iop = 0;
+
+               while (asc_board_count < ASC_NUM_BOARD_SUPPORTED) {
+
+                       ASC_DBG1(2, "advansys_detect: asc_board_count %d\n",
+                                asc_board_count);
+
+                       switch (asc_bus[bus]) {
+                       case ASC_IS_ISA:
+                       case ASC_IS_VL:
+#ifdef CONFIG_ISA
+                               if (asc_iopflag == ASC_FALSE) {
+                                       iop =
+                                           AscSearchIOPortAddr(iop,
+                                                               asc_bus[bus]);
+                               } else {
+                                       /*
+                                        * ISA and VL I/O port scanning has either been
+                                        * eliminated or limited to selected ports on
+                                        * the LILO command line, /etc/lilo.conf, or
+                                        * by setting variables when the module was loaded.
+                                        */
+                                       ASC_DBG(1,
+                                               "advansys_detect: I/O port scanning modified\n");
+ ioport_try_again:
+                                       iop = 0;
+                                       for (; ioport < ASC_NUM_IOPORT_PROBE;
+                                            ioport++) {
+                                               if ((iop =
+                                                    asc_ioport[ioport]) != 0) {
+                                                       break;
+                                               }
+                                       }
+                                       if (iop) {
+                                               ASC_DBG1(1,
+                                                        "advansys_detect: probing I/O port 0x%x...\n",
+                                                        iop);
+                                               if (!request_region
+                                                   (iop, ASC_IOADR_GAP,
+                                                    "advansys")) {
+                                                       printk
+                                                           ("AdvanSys SCSI: specified I/O Port 0x%X is busy\n",
+                                                            iop);
+                                                       /* Don't try this I/O port twice. */
+                                                       asc_ioport[ioport] = 0;
+                                                       goto ioport_try_again;
+                                               } else if (AscFindSignature(iop)
+                                                          == ASC_FALSE) {
+                                                       printk
+                                                           ("AdvanSys SCSI: specified I/O Port 0x%X has no adapter\n",
+                                                            iop);
+                                                       /* Don't try this I/O port twice. */
+                                                       release_region(iop,
+                                                                      ASC_IOADR_GAP);
+                                                       asc_ioport[ioport] = 0;
+                                                       goto ioport_try_again;
+                                               } else {
+                                                       /*
+                                                        * If this isn't an ISA board, then it must be
+                                                        * a VL board. If currently looking an ISA
+                                                        * board is being looked for then try for
+                                                        * another ISA board in 'asc_ioport'.
+                                                        */
+                                                       if (asc_bus[bus] ==
+                                                           ASC_IS_ISA
+                                                           &&
+                                                           (AscGetChipVersion
+                                                            (iop,
+                                                             ASC_IS_ISA) &
+                                                            ASC_CHIP_VER_ISA_BIT)
+                                                           == 0) {
+                                                               /*
+                                                                * Don't clear 'asc_ioport[ioport]'. Try
+                                                                * this board again for VL. Increment
+                                                                * 'ioport' past this board.
+                                                                */
+                                                               ioport++;
+                                                               release_region
+                                                                   (iop,
+                                                                    ASC_IOADR_GAP);
+                                                               goto ioport_try_again;
+                                                       }
+                                               }
+                                               /*
+                                                * This board appears good, don't try the I/O port
+                                                * again by clearing its value. Increment 'ioport'
+                                                * for the next iteration.
+                                                */
+                                               asc_ioport[ioport++] = 0;
+                                       }
+                               }
+#endif /* CONFIG_ISA */
+                               break;
+
+                       case ASC_IS_EISA:
+#ifdef CONFIG_ISA
+                               iop = AscSearchIOPortAddr(iop, asc_bus[bus]);
+#endif /* CONFIG_ISA */
+                               break;
+
+                       case ASC_IS_PCI:
+#ifdef CONFIG_PCI
+                               if (pci_init_search == 0) {
+                                       int i, j;
+
+                                       pci_init_search = 1;
+
+                                       /* Find all PCI cards. */
+                                       while (pci_device_id_cnt <
+                                              ASC_PCI_DEVICE_ID_CNT) {
+                                               if ((pdev =
+                                                    pci_find_device
+                                                    (PCI_VENDOR_ID_ASP,
+                                                     pci_device_id
+                                                     [pci_device_id_cnt],
+                                                     pdev)) == NULL) {
+                                                       pci_device_id_cnt++;
+                                               } else {
+                                                       if (pci_enable_device
+                                                           (pdev) == 0) {
+                                                               pci_devicep
+                                                                   [pci_card_cnt_max++]
+                                                                   = pdev;
+                                                       }
+                                               }
+                                       }
+
+                                       /*
+                                        * Sort PCI cards in ascending order by PCI Bus, Slot,
+                                        * and Device Number.
+                                        */
+                                       for (i = 0; i < pci_card_cnt_max - 1;
+                                            i++) {
+                                               for (j = i + 1;
+                                                    j < pci_card_cnt_max;
+                                                    j++) {
+                                                       if ((pci_devicep[j]->
+                                                            bus->number <
+                                                            pci_devicep[i]->
+                                                            bus->number)
+                                                           ||
+                                                           ((pci_devicep[j]->
+                                                             bus->number ==
+                                                             pci_devicep[i]->
+                                                             bus->number)
+                                                            &&
+                                                            (pci_devicep[j]->
+                                                             devfn <
+                                                             pci_devicep[i]->
+                                                             devfn))) {
+                                                               pdev =
+                                                                   pci_devicep
+                                                                   [i];
+                                                               pci_devicep[i] =
+                                                                   pci_devicep
+                                                                   [j];
+                                                               pci_devicep[j] =
+                                                                   pdev;
+                                                       }
+                                               }
+                                       }
+
+                                       pci_card_cnt = 0;
+                               } else {
+                                       pci_card_cnt++;
+                               }
+
+                               if (pci_card_cnt == pci_card_cnt_max) {
+                                       iop = 0;
+                               } else {
+                                       pdev = pci_devicep[pci_card_cnt];
+
+                                       ASC_DBG2(2,
+                                                "advansys_detect: devfn %d, bus number %d\n",
+                                                pdev->devfn,
+                                                pdev->bus->number);
+                                       iop = pci_resource_start(pdev, 0);
+                                       ASC_DBG2(1,
+                                                "advansys_detect: vendorID %X, deviceID %X\n",
+                                                pdev->vendor,
+                                                pdev->device);
+                                       ASC_DBG2(2,
+                                                "advansys_detect: iop %X, irqLine %d\n",
+                                                iop, pdev->irq);
+                               }
+                               if (pdev)
+                                       dev = &pdev->dev;
+
+#endif /* CONFIG_PCI */
+                               break;
+
+                       default:
+                               ASC_PRINT1
+                                   ("advansys_detect: unknown bus type: %d\n",
+                                    asc_bus[bus]);
+                               break;
+                       }
+                       ASC_DBG1(1, "advansys_detect: iop 0x%x\n", iop);
+
+                       /*
+                        * Adapter not found, try next bus type.
+                        */
+                       if (iop == 0) {
+                               break;
+                       }
+
+                       advansys_board_found(iop, dev, asc_bus[bus]);
+               }
+       }
+
+       ASC_DBG1(1, "advansys_detect: done: asc_board_count %d\n",
+                asc_board_count);
+       return asc_board_count;
+}
+
+/*
+ * advansys_release()
+ *
+ * Release resources allocated for a single AdvanSys adapter.
+ */
+static int advansys_release(struct Scsi_Host *shost)
+{
+       asc_board_t *boardp;
+
+       ASC_DBG(1, "advansys_release: begin\n");
+       boardp = ASC_BOARDP(shost);
+       free_irq(shost->irq, boardp);
+       if (shost->dma_channel != NO_ISA_DMA) {
+               ASC_DBG(1, "advansys_release: free_dma()\n");
+               free_dma(shost->dma_channel);
+       }
+       release_region(shost->io_port, boardp->asc_n_io_port);
+       if (ASC_WIDE_BOARD(boardp)) {
+               adv_sgblk_t *sgp = NULL;
+
+               iounmap(boardp->ioremap_addr);
+               kfree(boardp->orig_carrp);
+               boardp->orig_carrp = NULL;
+               if (boardp->orig_reqp) {
+                       kfree(boardp->orig_reqp);
+                       boardp->orig_reqp = boardp->adv_reqp = NULL;
+               }
+               while ((sgp = boardp->adv_sgblkp) != NULL) {
+                       boardp->adv_sgblkp = sgp->next_sgblkp;
+                       kfree(sgp);
+               }
+       }
+#ifdef CONFIG_PROC_FS
+       ASC_ASSERT(boardp->prtbuf != NULL);
+       kfree(boardp->prtbuf);
+#endif /* CONFIG_PROC_FS */
+       scsi_unregister(shost);
+       ASC_DBG(1, "advansys_release: end\n");
+       return 0;
+}
+
 #ifdef CONFIG_PCI
 /* PCI Devices supported by this driver */
 static struct pci_device_id advansys_pci_tbl[] __devinitdata = {
-       { PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A,
-       PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940,
-       PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940U,
-       PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940UW,
-       PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C0800_REV1,
-       PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C1600_REV1,
-       PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
-       { }
+       {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_1200A,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940U,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_ASP_ABP940UW,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C0800_REV1,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {PCI_VENDOR_ID_ASP, PCI_DEVICE_ID_38C1600_REV1,
+        PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
+       {}
 };
+
 MODULE_DEVICE_TABLE(pci, advansys_pci_tbl);
 #endif /* CONFIG_PCI */
index 85f2394ffc3e352042ef1bb26c0da5f97198f8a4..d30a30786ddaaa976e3517472918f410707796ba 100644 (file)
@@ -289,18 +289,18 @@ static LIST_HEAD(aha152x_host_list);
                if(spin_is_locked(&QLOCK)) { \
                        DPRINTK(debug_intr, DEBUG_LEAD "(%s:%d) already locked at %s:%d\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \
                } \
-               DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locking\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
                spin_lock_irqsave(&QLOCK,flags); \
-               DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) locked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
                QLOCKER=__FUNCTION__; \
                QLOCKERL=__LINE__; \
        } while(0)
 
 #define DO_UNLOCK(flags)       \
        do { \
-               DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocking (locked at %s:%d)\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__, QLOCKER, QLOCKERL); \
                spin_unlock_irqrestore(&QLOCK,flags); \
-               DPRINTK(debug_locks, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
+               DPRINTK(debug_locking, DEBUG_LEAD "(%s:%d) unlocked\n", CMDINFO(CURRENT_SC), __FUNCTION__, __LINE__); \
                QLOCKER="(not locked)"; \
                QLOCKERL=0; \
        } while(0)
@@ -322,6 +322,12 @@ static LIST_HEAD(aha152x_host_list);
                         (cmd) ? ((cmd)->device->id & 0x0f) : -1, \
                        (cmd) ? ((cmd)->device->lun & 0x07) : -1
 
+static inline void
+CMD_INC_RESID(struct scsi_cmnd *cmd, int inc)
+{
+       scsi_set_resid(cmd, scsi_get_resid(cmd) + inc);
+}
+
 #define DELAY_DEFAULT 1000
 
 #if defined(PCMCIA)
@@ -552,14 +558,11 @@ struct aha152x_hostdata {
 struct aha152x_scdata {
        Scsi_Cmnd *next;        /* next sc in queue */
        struct completion *done;/* semaphore to block on */
-       unsigned char cmd_len;
-       unsigned char cmnd[MAX_COMMAND_SIZE];
-       unsigned short use_sg;
-       unsigned request_bufflen;
-       void *request_buffer;
+       unsigned char aha_orig_cmd_len;
+       unsigned char aha_orig_cmnd[MAX_COMMAND_SIZE];
+       int aha_orig_resid;
 };
 
-
 /* access macros for hostdata */
 
 #define HOSTDATA(shpnt)                ((struct aha152x_hostdata *) &shpnt->hostdata)
@@ -978,15 +981,15 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
 #if defined(AHA152X_DEBUG)
        if (HOSTDATA(shpnt)->debug & debug_queue) {
                printk(INFO_LEAD "queue: %p; cmd_len=%d pieces=%d size=%u cmnd=",
-                      CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len, SCpnt->use_sg, SCpnt->request_bufflen);
+                      CMDINFO(SCpnt), SCpnt, SCpnt->cmd_len,
+                      scsi_sg_count(SCpnt), scsi_bufflen(SCpnt));
                __scsi_print_command(SCpnt->cmnd);
        }
 #endif
 
        SCpnt->scsi_done        = done;
-       SCpnt->resid            = SCpnt->request_bufflen;
        SCpnt->SCp.phase        = not_issued | phase;
-       SCpnt->SCp.Status       = CHECK_CONDITION;
+       SCpnt->SCp.Status       = 0x1; /* Ilegal status by SCSI standard */
        SCpnt->SCp.Message      = 0;
        SCpnt->SCp.have_data_in = 0;
        SCpnt->SCp.sent_command = 0;
@@ -997,20 +1000,11 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
                        return FAILED;
                }
        } else {
-               struct aha152x_scdata *sc;
-
                SCpnt->host_scribble = kmalloc(sizeof(struct aha152x_scdata), GFP_ATOMIC);
                if(SCpnt->host_scribble==0) {
                        printk(ERR_LEAD "allocation failed\n", CMDINFO(SCpnt));
                        return FAILED;
                }
-
-               sc = SCDATA(SCpnt);
-               memcpy(sc->cmnd, SCpnt->cmnd, sizeof(sc->cmnd));
-               sc->request_buffer  = SCpnt->request_buffer;
-               sc->request_bufflen = SCpnt->request_bufflen;
-               sc->use_sg          = SCpnt->use_sg;
-               sc->cmd_len         = SCpnt->cmd_len;
        }
 
        SCNEXT(SCpnt)           = NULL;
@@ -1022,16 +1016,25 @@ static int aha152x_internal_queue(Scsi_Cmnd *SCpnt, struct completion *complete,
           SCp.buffer           : next buffer
           SCp.buffers_residual : left buffers in list
           SCp.phase            : current state of the command */
-       if (SCpnt->use_sg) {
-               SCpnt->SCp.buffer           = (struct scatterlist *) SCpnt->request_buffer;
-               SCpnt->SCp.ptr              = SG_ADDRESS(SCpnt->SCp.buffer);
-               SCpnt->SCp.this_residual    = SCpnt->SCp.buffer->length;
-               SCpnt->SCp.buffers_residual = SCpnt->use_sg - 1;
-       } else {
-               SCpnt->SCp.ptr              = (char *) SCpnt->request_buffer;
-               SCpnt->SCp.this_residual    = SCpnt->request_bufflen;
+
+       if ((phase & (check_condition|resetting)) || !scsi_sglist(SCpnt)) {
+               if (phase & check_condition) {
+                       SCpnt->SCp.ptr           = SCpnt->sense_buffer;
+                       SCpnt->SCp.this_residual = sizeof(SCpnt->sense_buffer);
+                       scsi_set_resid(SCpnt, sizeof(SCpnt->sense_buffer));
+               } else {
+                       SCpnt->SCp.ptr           = NULL;
+                       SCpnt->SCp.this_residual = 0;
+                       scsi_set_resid(SCpnt, 0);
+               }
                SCpnt->SCp.buffer           = NULL;
                SCpnt->SCp.buffers_residual = 0;
+       } else {
+               scsi_set_resid(SCpnt, scsi_bufflen(SCpnt));
+               SCpnt->SCp.buffer           = scsi_sglist(SCpnt);
+               SCpnt->SCp.ptr              = SG_ADDRESS(SCpnt->SCp.buffer);
+               SCpnt->SCp.this_residual    = SCpnt->SCp.buffer->length;
+               SCpnt->SCp.buffers_residual = scsi_sg_count(SCpnt) - 1;
        }
 
        DO_LOCK(flags);
@@ -1150,9 +1153,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
        DECLARE_COMPLETION(done);
        int ret, issued, disconnected;
        unsigned char old_cmd_len = SCpnt->cmd_len;
-       unsigned short old_use_sg = SCpnt->use_sg;
-       void *old_buffer = SCpnt->request_buffer;
-       unsigned old_bufflen = SCpnt->request_bufflen;
        unsigned long flags;
        unsigned long timeleft;
 
@@ -1174,9 +1174,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
        DO_UNLOCK(flags);
 
        SCpnt->cmd_len         = 0;
-       SCpnt->use_sg          = 0;
-       SCpnt->request_buffer  = NULL;
-       SCpnt->request_bufflen = 0;
 
        aha152x_internal_queue(SCpnt, &done, resetting, reset_done);
 
@@ -1189,9 +1186,6 @@ static int aha152x_device_reset(Scsi_Cmnd * SCpnt)
        }
 
        SCpnt->cmd_len         = old_cmd_len;
-       SCpnt->use_sg          = old_use_sg;
-       SCpnt->request_buffer  = old_buffer;
-               SCpnt->request_bufflen = old_bufflen;
 
        DO_LOCK(flags);
 
@@ -1531,8 +1525,8 @@ static void busfree_run(struct Scsi_Host *shpnt)
                        /* target sent DISCONNECT */
                        DPRINTK(debug_selection, DEBUG_LEAD "target disconnected at %d/%d\n",
                                CMDINFO(CURRENT_SC),
-                               CURRENT_SC->resid,
-                               CURRENT_SC->request_bufflen);
+                               scsi_get_resid(CURRENT_SC),
+                               scsi_bufflen(CURRENT_SC));
 #if defined(AHA152X_STAT)
                        HOSTDATA(shpnt)->disconnections++;
 #endif
@@ -1568,18 +1562,16 @@ static void busfree_run(struct Scsi_Host *shpnt)
 #endif
 
                        /* restore old command */
-                       memcpy(cmd->cmnd, sc->cmnd, sizeof(sc->cmnd));
-                       cmd->request_buffer  = sc->request_buffer;
-                       cmd->request_bufflen = sc->request_bufflen;
-                       cmd->use_sg          = sc->use_sg;
-                       cmd->cmd_len         = sc->cmd_len;
+                       memcpy(cmd->cmnd, sc->aha_orig_cmnd, sizeof(cmd->cmnd));
+                       cmd->cmd_len = sc->aha_orig_cmd_len;
+                       scsi_set_resid(cmd, sc->aha_orig_resid);
 
-                       cmd->SCp.Status = 0x02;
+                       cmd->SCp.Status = SAM_STAT_CHECK_CONDITION;
 
                        HOSTDATA(shpnt)->commands--;
                        if (!HOSTDATA(shpnt)->commands)
                                SETPORT(PORTA, 0);      /* turn led off */
-               } else if(DONE_SC->SCp.Status==0x02) {
+               } else if(DONE_SC->SCp.Status==SAM_STAT_CHECK_CONDITION) {
 #if defined(AHA152X_STAT)
                        HOSTDATA(shpnt)->busfree_with_check_condition++;
 #endif
@@ -1587,13 +1579,23 @@ static void busfree_run(struct Scsi_Host *shpnt)
                        DPRINTK(debug_eh, ERR_LEAD "CHECK CONDITION found\n", CMDINFO(DONE_SC));
 #endif
 
-                       if(!(DONE_SC->SCp.Status & not_issued)) {
+                       if(!(DONE_SC->SCp.phase & not_issued)) {
+                               struct aha152x_scdata *sc;
                                Scsi_Cmnd *ptr = DONE_SC;
                                DONE_SC=NULL;
 #if 0
                                DPRINTK(debug_eh, ERR_LEAD "requesting sense\n", CMDINFO(ptr));
 #endif
 
+                               /* save old command */
+                               sc = SCDATA(ptr);
+                               /* It was allocated in aha152x_internal_queue? */
+                               BUG_ON(!sc);
+                               memcpy(sc->aha_orig_cmnd, ptr->cmnd,
+                                                           sizeof(ptr->cmnd));
+                               sc->aha_orig_cmd_len = ptr->cmd_len;
+                               sc->aha_orig_resid = scsi_get_resid(ptr);
+
                                ptr->cmnd[0]         = REQUEST_SENSE;
                                ptr->cmnd[1]         = 0;
                                ptr->cmnd[2]         = 0;
@@ -1601,10 +1603,7 @@ static void busfree_run(struct Scsi_Host *shpnt)
                                ptr->cmnd[4]         = sizeof(ptr->sense_buffer);
                                ptr->cmnd[5]         = 0;
                                ptr->cmd_len         = 6;
-                               ptr->use_sg          = 0; 
-                               ptr->request_buffer  = ptr->sense_buffer;
-                               ptr->request_bufflen = sizeof(ptr->sense_buffer);
-                       
+
                                DO_UNLOCK(flags);
                                aha152x_internal_queue(ptr, NULL, check_condition, ptr->scsi_done);
                                DO_LOCK(flags);
@@ -2180,7 +2179,8 @@ static void datai_init(struct Scsi_Host *shpnt)
        DATA_LEN=0;
        DPRINTK(debug_datai,
                DEBUG_LEAD "datai_init: request_bufflen=%d resid=%d\n",
-               CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid);
+               CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC),
+               scsi_get_resid(CURRENT_SC));
 }
 
 static void datai_run(struct Scsi_Host *shpnt)
@@ -2293,11 +2293,12 @@ static void datai_run(struct Scsi_Host *shpnt)
 
 static void datai_end(struct Scsi_Host *shpnt)
 {
-       CURRENT_SC->resid -= GETSTCNT();
+       CMD_INC_RESID(CURRENT_SC, -GETSTCNT());
 
        DPRINTK(debug_datai,
                DEBUG_LEAD "datai_end: request_bufflen=%d resid=%d stcnt=%d\n",
-               CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid, GETSTCNT());
+               CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC),
+               scsi_get_resid(CURRENT_SC), GETSTCNT());
 
        SETPORT(SXFRCTL0, CH1|CLRSTCNT);
        SETPORT(DMACNTRL0, 0);
@@ -2318,11 +2319,12 @@ static void datao_init(struct Scsi_Host *shpnt)
        SETPORT(SIMODE0, 0);
        SETPORT(SIMODE1, ENSCSIPERR | ENSCSIRST | ENPHASEMIS | ENBUSFREE );
 
-       DATA_LEN = CURRENT_SC->resid;
+       DATA_LEN = scsi_get_resid(CURRENT_SC);
 
        DPRINTK(debug_datao,
                DEBUG_LEAD "datao_init: request_bufflen=%d; resid=%d\n",
-               CMDINFO(CURRENT_SC), CURRENT_SC->request_bufflen, CURRENT_SC->resid);
+               CMDINFO(CURRENT_SC), scsi_bufflen(CURRENT_SC),
+               scsi_get_resid(CURRENT_SC));
 }
 
 static void datao_run(struct Scsi_Host *shpnt)
@@ -2346,7 +2348,7 @@ static void datao_run(struct Scsi_Host *shpnt)
                        SETPORT(DMACNTRL0,WRITE_READ|ENDMA|_8BIT);
                        SETPORT(DATAPORT, *CURRENT_SC->SCp.ptr++);
                        CURRENT_SC->SCp.this_residual--;
-                       CURRENT_SC->resid--;
+                       CMD_INC_RESID(CURRENT_SC, -1);
                        SETPORT(DMACNTRL0,WRITE_READ|ENDMA);
                }
 
@@ -2355,7 +2357,7 @@ static void datao_run(struct Scsi_Host *shpnt)
                        outsw(DATAPORT, CURRENT_SC->SCp.ptr, data_count);
                        CURRENT_SC->SCp.ptr           += 2 * data_count;
                        CURRENT_SC->SCp.this_residual -= 2 * data_count;
-                       CURRENT_SC->resid             -= 2 * data_count;
+                       CMD_INC_RESID(CURRENT_SC, -2 * data_count);
                }
 
                if(CURRENT_SC->SCp.this_residual==0 && CURRENT_SC->SCp.buffers_residual>0) {
@@ -2381,35 +2383,34 @@ static void datao_run(struct Scsi_Host *shpnt)
 static void datao_end(struct Scsi_Host *shpnt)
 {
        if(TESTLO(DMASTAT, DFIFOEMP)) {
-               int data_count = (DATA_LEN - CURRENT_SC->resid) - GETSTCNT();
+               int data_count = (DATA_LEN - scsi_get_resid(CURRENT_SC)) -
+                                                                   GETSTCNT();
 
                DPRINTK(debug_datao, DEBUG_LEAD "datao: %d bytes to resend (%d written, %d transferred)\n",
                        CMDINFO(CURRENT_SC),
                        data_count,
-                       DATA_LEN-CURRENT_SC->resid,
+                       DATA_LEN - scsi_get_resid(CURRENT_SC),
                        GETSTCNT());
 
-               CURRENT_SC->resid += data_count;
+               CMD_INC_RESID(CURRENT_SC, data_count);
 
-               if(CURRENT_SC->use_sg) {
-                       data_count -= CURRENT_SC->SCp.ptr - SG_ADDRESS(CURRENT_SC->SCp.buffer);
-                       while(data_count>0) {
-                               CURRENT_SC->SCp.buffer--;
-                               CURRENT_SC->SCp.buffers_residual++;
-                               data_count -= CURRENT_SC->SCp.buffer->length;
-                       }
-                       CURRENT_SC->SCp.ptr           = SG_ADDRESS(CURRENT_SC->SCp.buffer) - data_count;
-                       CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length + data_count;
-               } else {
-                       CURRENT_SC->SCp.ptr           -= data_count;
-                       CURRENT_SC->SCp.this_residual += data_count;
+               data_count -= CURRENT_SC->SCp.ptr -
+                                            SG_ADDRESS(CURRENT_SC->SCp.buffer);
+               while(data_count>0) {
+                       CURRENT_SC->SCp.buffer--;
+                       CURRENT_SC->SCp.buffers_residual++;
+                       data_count -= CURRENT_SC->SCp.buffer->length;
                }
+               CURRENT_SC->SCp.ptr = SG_ADDRESS(CURRENT_SC->SCp.buffer) -
+                                                                    data_count;
+               CURRENT_SC->SCp.this_residual = CURRENT_SC->SCp.buffer->length +
+                                                                    data_count;
        }
 
        DPRINTK(debug_datao, DEBUG_LEAD "datao_end: request_bufflen=%d; resid=%d; stcnt=%d\n",
                CMDINFO(CURRENT_SC),
-               CURRENT_SC->request_bufflen,
-               CURRENT_SC->resid,
+               scsi_bufflen(CURRENT_SC),
+               scsi_get_resid(CURRENT_SC),
                GETSTCNT());
 
        SETPORT(SXFRCTL0, CH1|CLRCH1|CLRSTCNT);
@@ -2936,7 +2937,7 @@ static void show_command(Scsi_Cmnd *ptr)
        __scsi_print_command(ptr->cmnd);
 
        printk(KERN_DEBUG "); request_bufflen=%d; resid=%d; phase |",
-              ptr->request_bufflen, ptr->resid);
+              scsi_bufflen(ptr), scsi_get_resid(ptr));
 
        if (ptr->SCp.phase & not_issued)
                printk("not issued|");
@@ -3006,7 +3007,8 @@ static int get_command(char *pos, Scsi_Cmnd * ptr)
                SPRINTF("0x%02x ", ptr->cmnd[i]);
 
        SPRINTF("); resid=%d; residual=%d; buffers=%d; phase |",
-               ptr->resid, ptr->SCp.this_residual, ptr->SCp.buffers_residual);
+               scsi_get_resid(ptr), ptr->SCp.this_residual,
+               ptr->SCp.buffers_residual);
 
        if (ptr->SCp.phase & not_issued)
                SPRINTF("not issued|");
@@ -3395,7 +3397,7 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start
        PDEBUG(debug_datai, "data in");
        PDEBUG(debug_datao, "data out");
        PDEBUG(debug_eh, "eh");
-       PDEBUG(debug_locks, "locks");
+       PDEBUG(debug_locking, "locks");
        PDEBUG(debug_phases, "phases");
 
        SPRINTF("\n");
@@ -3474,6 +3476,12 @@ static int aha152x_proc_info(struct Scsi_Host *shpnt, char *buffer, char **start
        return thislength < length ? thislength : length;
 }
 
+static int aha152x_adjust_queue(struct scsi_device *device)
+{
+       blk_queue_bounce_limit(device->request_queue, BLK_BOUNCE_HIGH);
+       return 0;
+}
+
 static struct scsi_host_template aha152x_driver_template = {
        .module                         = THIS_MODULE,
        .name                           = AHA152X_REVID,
@@ -3490,6 +3498,7 @@ static struct scsi_host_template aha152x_driver_template = {
        .sg_tablesize                   = SG_ALL,
        .cmd_per_lun                    = 1,
        .use_clustering                 = DISABLE_CLUSTERING,
+       .slave_alloc                    = aha152x_adjust_queue,
 };
 
 #if !defined(PCMCIA)
index d2add24d02a3712041f3e39199b37d67b1a8b957..ac4bfa438bf2c119939a40176c097fae3fa40932 100644 (file)
@@ -298,7 +298,7 @@ typedef union {
 enum {
   debug_procinfo  = 0x0001,
   debug_queue     = 0x0002,
-  debug_locks     = 0x0004,
+  debug_locking   = 0x0004,
   debug_intr      = 0x0008,
   debug_selection = 0x0010,
   debug_msgo      = 0x0020,
index 286ab83116f92eb3f6ea3304aa47baf8b98b32b7..a055a96e3ad34e9185f10a214f798788928e6260 100644 (file)
@@ -2284,9 +2284,12 @@ static void ahd_linux_set_period(struct scsi_target *starget, int period)
        if (period < 8)
                period = 8;
        if (period < 10) {
-               ppr_options |= MSG_EXT_PPR_DT_REQ;
-               if (period == 8)
-                       ppr_options |= MSG_EXT_PPR_IU_REQ;
+               if (spi_max_width(starget)) {
+                       ppr_options |= MSG_EXT_PPR_DT_REQ;
+                       if (period == 8)
+                               ppr_options |= MSG_EXT_PPR_IU_REQ;
+               } else
+                       period = 10;
        }
 
        dt = ppr_options & MSG_EXT_PPR_DT_REQ;
@@ -2365,7 +2368,7 @@ static void ahd_linux_set_dt(struct scsi_target *starget, int dt)
                printf("%s: %s DT\n", ahd_name(ahd), 
                       dt ? "enabling" : "disabling");
 #endif
-       if (dt) {
+       if (dt && spi_max_width(starget)) {
                ppr_options |= MSG_EXT_PPR_DT_REQ;
                if (!width)
                        ahd_linux_set_width(starget, 1);
@@ -2447,7 +2450,7 @@ static void ahd_linux_set_iu(struct scsi_target *starget, int iu)
                       iu ? "enabling" : "disabling");
 #endif
 
-       if (iu) {
+       if (iu && spi_max_width(starget)) {
                ppr_options |= MSG_EXT_PPR_IU_REQ;
                ppr_options |= MSG_EXT_PPR_DT_REQ; /* IU requires DT */
        }
@@ -2487,7 +2490,7 @@ static void ahd_linux_set_rd_strm(struct scsi_target *starget, int rdstrm)
                       rdstrm  ? "enabling" : "disabling");
 #endif
 
-       if (rdstrm)
+       if (rdstrm && spi_max_width(starget))
                ppr_options |= MSG_EXT_PPR_RD_STRM;
 
        ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
@@ -2523,7 +2526,7 @@ static void ahd_linux_set_wr_flow(struct scsi_target *starget, int wrflow)
                       wrflow ? "enabling" : "disabling");
 #endif
 
-       if (wrflow)
+       if (wrflow && spi_max_width(starget))
                ppr_options |= MSG_EXT_PPR_WR_FLOW;
 
        ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
@@ -2567,7 +2570,7 @@ static void ahd_linux_set_rti(struct scsi_target *starget, int rti)
                       rti ? "enabling" : "disabling");
 #endif
 
-       if (rti)
+       if (rti && spi_max_width(starget))
                ppr_options |= MSG_EXT_PPR_RTI;
 
        ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
@@ -2603,7 +2606,7 @@ static void ahd_linux_set_pcomp_en(struct scsi_target *starget, int pcomp)
                       pcomp ? "Enable" : "Disable");
 #endif
 
-       if (pcomp) {
+       if (pcomp && spi_max_width(starget)) {
                uint8_t precomp;
 
                if (ahd->unit < ARRAY_SIZE(aic79xx_iocell_info)) {
@@ -2647,7 +2650,7 @@ static void ahd_linux_set_hold_mcs(struct scsi_target *starget, int hold)
        unsigned int dt = ppr_options & MSG_EXT_PPR_DT_REQ;
        unsigned long flags;
 
-       if (hold)
+       if (hold && spi_max_width(starget))
                ppr_options |= MSG_EXT_PPR_HOLD_MCS;
 
        ahd_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
index 75733b09f27a747dc1ee454ece9d8262a8c29227..f350b5e89e76d01485cb9fb22cb16c8a8d2c967c 100644 (file)
@@ -1701,7 +1701,16 @@ ahc_find_syncrate(struct ahc_softc *ahc, u_int *period,
        if ((*ppr_options & MSG_EXT_PPR_DT_REQ) == 0
         && maxsync < AHC_SYNCRATE_ULTRA2)
                maxsync = AHC_SYNCRATE_ULTRA2;
-       
+
+       /* Now set the maxsync based on the card capabilities
+        * DT is already done above */
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0
+           && maxsync < AHC_SYNCRATE_ULTRA)
+               maxsync = AHC_SYNCRATE_ULTRA;
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0
+           && maxsync < AHC_SYNCRATE_FAST)
+               maxsync = AHC_SYNCRATE_FAST;
+
        for (syncrate = &ahc_syncrates[maxsync];
             syncrate->rate != NULL;
             syncrate++) {
@@ -1765,6 +1774,17 @@ ahc_find_period(struct ahc_softc *ahc, u_int scsirate, u_int maxsync)
        else
                scsirate &= SXFR;
 
+       /* now set maxsync based on card capabilities */
+       if ((ahc->features & AHC_DT) == 0 && maxsync < AHC_SYNCRATE_ULTRA2)
+               maxsync = AHC_SYNCRATE_ULTRA2;
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2)) == 0
+           && maxsync < AHC_SYNCRATE_ULTRA)
+               maxsync = AHC_SYNCRATE_ULTRA;
+       if ((ahc->features & (AHC_DT | AHC_ULTRA2 | AHC_ULTRA)) == 0
+           && maxsync < AHC_SYNCRATE_FAST)
+               maxsync = AHC_SYNCRATE_FAST;
+
+
        syncrate = &ahc_syncrates[maxsync];
        while (syncrate->rate != NULL) {
 
index 1803ab6fc21c49ac0ad158e42567b04651d52a82..2e9c38f2e8a68d1065be272baa7174fa2eb06e90 100644 (file)
@@ -2317,8 +2317,13 @@ static void ahc_linux_set_period(struct scsi_target *starget, int period)
 
        if (period < 9)
                period = 9;     /* 12.5ns is our minimum */
-       if (period == 9)
-               ppr_options |= MSG_EXT_PPR_DT_REQ;
+       if (period == 9) {
+               if (spi_max_width(starget))
+                       ppr_options |= MSG_EXT_PPR_DT_REQ;
+               else
+                       /* need wide for DT and need DT for 12.5 ns */
+                       period = 10;
+       }
 
        ahc_compile_devinfo(&devinfo, shost->this_id, starget->id, 0,
                            starget->channel + 'A', ROLE_INITIATOR);
@@ -2381,7 +2386,7 @@ static void ahc_linux_set_dt(struct scsi_target *starget, int dt)
        unsigned long flags;
        struct ahc_syncrate *syncrate;
 
-       if (dt) {
+       if (dt && spi_max_width(starget)) {
                ppr_options |= MSG_EXT_PPR_DT_REQ;
                if (!width)
                        ahc_linux_set_width(starget, 1);
index ab00aecc5466ec018d621e7a9ab60466de37d5d9..63bcde24644740baeadb8b956c6c0ab68f88b16e 100644 (file)
@@ -586,7 +586,7 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
                goto Err;
        }
        asd_ha->pcidev = dev;
-       asd_ha->sas_ha.pcidev = asd_ha->pcidev;
+       asd_ha->sas_ha.dev = &asd_ha->pcidev->dev;
        asd_ha->sas_ha.lldd_ha = asd_ha;
 
        asd_ha->name = asd_dev->name;
@@ -605,8 +605,6 @@ static int __devinit asd_pci_probe(struct pci_dev *dev,
                goto Err_free;
        }
 
-
-
        err = asd_dev->setup(asd_ha);
        if (err)
                goto Err_free;
index d006a8cb4a7451fd439b97f6cd725efd3f5db001..7236143941f340cf1aba493079274369ac95bb5e 100644 (file)
@@ -74,15 +74,6 @@ config SCSI_CUMANA_1
          This enables support for the Cumana SCSI I card. If you have an
          Acorn system with one of these, say Y. If unsure, say N.
 
-config SCSI_ECOSCSI
-       tristate "EcoScsi support (EXPERIMENTAL)"
-       depends on ARCH_ACORN && EXPERIMENTAL && (ARCH_ARC || ARCH_A5K) && SCSI
-       select SCSI_SPI_ATTRS
-       help
-         This enables support for the EcoSCSI card -- a small card that sits
-         in the Econet socket. If you have an Acorn system with one of these,
-         say Y. If unsure, say N.
-
 config SCSI_OAK1
        tristate "Oak SCSI support (EXPERIMENTAL)"
        depends on ARCH_ACORN && EXPERIMENTAL && SCSI
index e8db17924c1df27a10164e335aa4aa2257a7a564..16c3e86a6b1b948f84ca661920bd8a4c6388a56b 100644 (file)
@@ -8,7 +8,6 @@ obj-$(CONFIG_SCSI_ACORNSCSI_3)  += acornscsi_mod.o queue.o msgqueue.o
 obj-$(CONFIG_SCSI_ARXESCSI)    += arxescsi.o fas216.o queue.o msgqueue.o
 obj-$(CONFIG_SCSI_CUMANA_1)    += cumana_1.o
 obj-$(CONFIG_SCSI_CUMANA_2)    += cumana_2.o fas216.o queue.o msgqueue.o
-obj-$(CONFIG_SCSI_ECOSCSI)     += ecoscsi.o
 obj-$(CONFIG_SCSI_OAK1)                += oak.o
 obj-$(CONFIG_SCSI_POWERTECSCSI)        += powertec.o fas216.o queue.o msgqueue.o
 obj-$(CONFIG_SCSI_EESOXSCSI)   += eesox.o fas216.o queue.o msgqueue.o
diff --git a/drivers/scsi/arm/ecoscsi.c b/drivers/scsi/arm/ecoscsi.c
deleted file mode 100644 (file)
index 5265a98..0000000
+++ /dev/null
@@ -1,166 +0,0 @@
-#define AUTOSENSE
-/* #define PSEUDO_DMA */
-
-/*
- * EcoSCSI Generic NCR5380 driver
- *
- * Copyright 1995, Russell King
- *
- * ALPHA RELEASE 1.
- *
- * For more information, please consult
- *
- * NCR 5380 Family
- * SCSI Protocol Controller
- * Databook
- *
- * NCR Microelectronics
- * 1635 Aeroplaza Drive
- * Colorado Springs, CO 80916
- * 1+ (719) 578-3400
- * 1+ (800) 334-5454
- */
-
-#include <linux/module.h>
-#include <linux/signal.h>
-#include <linux/ioport.h>
-#include <linux/delay.h>
-#include <linux/init.h>
-#include <linux/blkdev.h>
-
-#include <asm/io.h>
-#include <asm/system.h>
-
-#include "../scsi.h"
-#include <scsi/scsi_host.h>
-
-#define priv(host)                     ((struct NCR5380_hostdata *)(host)->hostdata)
-
-#define NCR5380_local_declare()                void __iomem *_base
-#define NCR5380_setup(host)            _base = priv(host)->base
-
-#define NCR5380_read(reg)              ({ writeb(reg | 8, _base); readb(_base + 4); })
-#define NCR5380_write(reg, value)      ({ writeb(reg | 8, _base); writeb(value, _base + 4); })
-
-#define NCR5380_intr                   ecoscsi_intr
-#define NCR5380_queue_command          ecoscsi_queue_command
-#define NCR5380_proc_info              ecoscsi_proc_info
-
-#define NCR5380_implementation_fields  \
-       void __iomem *base
-
-#include "../NCR5380.h"
-
-#define ECOSCSI_PUBLIC_RELEASE 1
-
-/*
- * Function : ecoscsi_setup(char *str, int *ints)
- *
- * Purpose : LILO command line initialization of the overrides array,
- *
- * Inputs : str - unused, ints - array of integer parameters with ints[0]
- *     equal to the number of ints.
- *
- */
-
-void ecoscsi_setup(char *str, int *ints)
-{
-}
-
-const char * ecoscsi_info (struct Scsi_Host *spnt)
-{
-       return "";
-}
-
-#define BOARD_NORMAL   0
-#define BOARD_NCR53C400        1
-
-#include "../NCR5380.c"
-
-static struct scsi_host_template ecoscsi_template =  {
-       .module         = THIS_MODULE,
-       .name           = "Serial Port EcoSCSI NCR5380",
-       .proc_name      = "ecoscsi",
-       .info           = ecoscsi_info,
-       .queuecommand   = ecoscsi_queue_command,
-       .eh_abort_handler       = NCR5380_abort,
-       .eh_bus_reset_handler   = NCR5380_bus_reset,
-       .can_queue      = 16,
-       .this_id        = 7,
-       .sg_tablesize   = SG_ALL,
-       .cmd_per_lun    = 2,
-       .use_clustering = DISABLE_CLUSTERING
-};
-
-static struct Scsi_Host *host;
-
-static int __init ecoscsi_init(void)
-{
-       void __iomem *_base;
-       int ret;
-
-       if (!request_mem_region(0x33a0000, 4096, "ecoscsi")) {
-               ret = -EBUSY;
-               goto out;
-       }
-
-       _base = ioremap(0x33a0000, 4096);
-       if (!_base) {
-               ret = -ENOMEM;
-               goto out_release;
-       }
-
-       NCR5380_write(MODE_REG, 0x20);          /* Is it really SCSI? */
-       if (NCR5380_read(MODE_REG) != 0x20)     /* Write to a reg.    */
-               goto out_unmap;
-
-       NCR5380_write(MODE_REG, 0x00);          /* it back.           */
-       if (NCR5380_read(MODE_REG) != 0x00)
-               goto out_unmap;
-
-       host = scsi_host_alloc(tpnt, sizeof(struct NCR5380_hostdata));
-       if (!host) {
-               ret = -ENOMEM;
-               goto out_unmap;
-       }
-
-       priv(host)->base = _base;
-       host->irq = IRQ_NONE;
-
-       NCR5380_init(host, 0);
-
-       printk("scsi%d: at port 0x%08lx irqs disabled", host->host_no, host->io_port);
-       printk(" options CAN_QUEUE=%d CMD_PER_LUN=%d release=%d",
-               host->can_queue, host->cmd_per_lun, ECOSCSI_PUBLIC_RELEASE);
-       printk("\nscsi%d:", host->host_no);
-       NCR5380_print_options(host);
-       printk("\n");
-
-       scsi_add_host(host, NULL); /* XXX handle failure */
-       scsi_scan_host(host);
-       return 0;
-
- out_unmap:
-       iounmap(_base);
- out_release:
-       release_mem_region(0x33a0000, 4096);
- out:
-       return ret;
-}
-
-static void __exit ecoscsi_exit(void)
-{
-       scsi_remove_host(host);
-       NCR5380_exit(host);
-       scsi_host_put(host);
-       release_mem_region(0x33a0000, 4096);
-       return 0;
-}
-
-module_init(ecoscsi_init);
-module_exit(ecoscsi_exit);
-
-MODULE_AUTHOR("Russell King");
-MODULE_DESCRIPTION("Econet-SCSI driver for Acorn machines");
-MODULE_LICENSE("GPL");
-
index 2e2362d787ca54037ea0687da2df08526173317c..502732ac270ddcfa7cbecec1e282f9ff0c944c42 100644 (file)
@@ -173,20 +173,20 @@ static struct pci_device_id dptids[] = {
 };
 MODULE_DEVICE_TABLE(pci,dptids);
 
-static int adpt_detect(struct scsi_host_template* sht)
+static void adpt_exit(void);
+
+static int adpt_detect(void)
 {
        struct pci_dev *pDev = NULL;
        adpt_hba* pHba;
 
-       adpt_init();
-
        PINFO("Detecting Adaptec I2O RAID controllers...\n");
 
         /* search for all Adatpec I2O RAID cards */
        while ((pDev = pci_get_device( PCI_DPT_VENDOR_ID, PCI_ANY_ID, pDev))) {
                if(pDev->device == PCI_DPT_DEVICE_ID ||
                   pDev->device == PCI_DPT_RAPTOR_DEVICE_ID){
-                       if(adpt_install_hba(sht, pDev) ){
+                       if(adpt_install_hba(pDev) ){
                                PERROR("Could not Init an I2O RAID device\n");
                                PERROR("Will not try to detect others.\n");
                                return hba_count-1;
@@ -248,34 +248,33 @@ rebuild_sys_tab:
        }
 
        for (pHba = hba_chain; pHba; pHba = pHba->next) {
-               if( adpt_scsi_register(pHba,sht) < 0){
+               if (adpt_scsi_register(pHba) < 0) {
                        adpt_i2o_delete_hba(pHba);
                        continue;
                }
                pHba->initialized = TRUE;
                pHba->state &= ~DPTI_STATE_RESET;
+               scsi_scan_host(pHba->host);
        }
 
        // Register our control device node
        // nodes will need to be created in /dev to access this
        // the nodes can not be created from within the driver
        if (hba_count && register_chrdev(DPTI_I2O_MAJOR, DPT_DRIVER, &adpt_fops)) {
-               adpt_i2o_sys_shutdown();
+               adpt_exit();
                return 0;
        }
        return hba_count;
 }
 
 
-/*
- * scsi_unregister will be called AFTER we return. 
- */
-static int adpt_release(struct Scsi_Host *host)
+static int adpt_release(adpt_hba *pHba)
 {
-       adpt_hba* pHba = (adpt_hba*) host->hostdata[0];
+       struct Scsi_Host *shost = pHba->host;
+       scsi_remove_host(shost);
 //     adpt_i2o_quiesce_hba(pHba);
        adpt_i2o_delete_hba(pHba);
-       scsi_unregister(host);
+       scsi_host_put(shost);
        return 0;
 }
 
@@ -882,7 +881,7 @@ static int adpt_reboot_event(struct notifier_block *n, ulong code, void *p)
 #endif
 
 
-static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) 
+static int adpt_install_hba(struct pci_dev* pDev)
 {
 
        adpt_hba* pHba = NULL;
@@ -1031,8 +1030,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
 
 
        mutex_lock(&adpt_configuration_lock);
-       // scsi_unregister calls our adpt_release which
-       // does a quiese
        if(pHba->host){
                free_irq(pHba->host->irq, pHba);
        }
@@ -1084,17 +1081,6 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba)
 }
 
 
-static int adpt_init(void)
-{
-       printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
-#ifdef REBOOT_NOTIFIER
-       register_reboot_notifier(&adpt_reboot_notifier);
-#endif
-
-       return 0;
-}
-
-
 static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun)
 {
        struct adpt_device* d;
@@ -2180,37 +2166,6 @@ static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_d
 }
 
 
-static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht)
-{
-       struct Scsi_Host *host = NULL;
-
-       host = scsi_register(sht, sizeof(adpt_hba*));
-       if (host == NULL) {
-               printk ("%s: scsi_register returned NULL\n",pHba->name);
-               return -1;
-       }
-       host->hostdata[0] = (unsigned long)pHba;
-       pHba->host = host;
-
-       host->irq = pHba->pDev->irq;
-       /* no IO ports, so don't have to set host->io_port and 
-        * host->n_io_port
-        */
-       host->io_port = 0;
-       host->n_io_port = 0;
-                               /* see comments in scsi_host.h */
-       host->max_id = 16;
-       host->max_lun = 256;
-       host->max_channel = pHba->top_scsi_channel + 1;
-       host->cmd_per_lun = 1;
-       host->unique_id = (uint) pHba;
-       host->sg_tablesize = pHba->sg_tablesize;
-       host->can_queue = pHba->post_fifo_size;
-
-       return 0;
-}
-
-
 static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd)
 {
        adpt_hba* pHba;
@@ -3329,12 +3284,10 @@ static static void adpt_delay(int millisec)
 
 #endif
 
-static struct scsi_host_template driver_template = {
+static struct scsi_host_template adpt_template = {
        .name                   = "dpt_i2o",
        .proc_name              = "dpt_i2o",
        .proc_info              = adpt_proc_info,
-       .detect                 = adpt_detect,  
-       .release                = adpt_release,
        .info                   = adpt_info,
        .queuecommand           = adpt_queue,
        .eh_abort_handler       = adpt_abort,
@@ -3348,5 +3301,62 @@ static struct scsi_host_template driver_template = {
        .cmd_per_lun            = 1,
        .use_clustering         = ENABLE_CLUSTERING,
 };
-#include "scsi_module.c"
+
+static s32 adpt_scsi_register(adpt_hba* pHba)
+{
+       struct Scsi_Host *host;
+
+       host = scsi_host_alloc(&adpt_template, sizeof(adpt_hba*));
+       if (host == NULL) {
+               printk ("%s: scsi_host_alloc returned NULL\n",pHba->name);
+               return -1;
+       }
+       host->hostdata[0] = (unsigned long)pHba;
+       pHba->host = host;
+
+       host->irq = pHba->pDev->irq;
+       /* no IO ports, so don't have to set host->io_port and
+        * host->n_io_port
+        */
+       host->io_port = 0;
+       host->n_io_port = 0;
+                               /* see comments in scsi_host.h */
+       host->max_id = 16;
+       host->max_lun = 256;
+       host->max_channel = pHba->top_scsi_channel + 1;
+       host->cmd_per_lun = 1;
+       host->unique_id = (uint) pHba;
+       host->sg_tablesize = pHba->sg_tablesize;
+       host->can_queue = pHba->post_fifo_size;
+
+       if (scsi_add_host(host, &pHba->pDev->dev)) {
+               scsi_host_put(host);
+               return -1;
+       }
+
+       return 0;
+}
+
+static int __init adpt_init(void)
+{
+       int count;
+
+       printk("Loading Adaptec I2O RAID: Version " DPT_I2O_VERSION "\n");
+#ifdef REBOOT_NOTIFIER
+       register_reboot_notifier(&adpt_reboot_notifier);
+#endif
+
+       count = adpt_detect();
+
+       return count > 0 ? 0 : -ENODEV;
+}
+
+static void __exit adpt_exit(void)
+{
+       while (hba_chain)
+               adpt_release(hba_chain);
+}
+
+module_init(adpt_init);
+module_exit(adpt_exit);
 MODULE_LICENSE("GPL");
index fd79068c586931b640eb2f1814b96eaa84bae76b..0892f6c703199bff7b060b1fef5cf71c46fe2a2b 100644 (file)
  * SCSI interface function Prototypes
  */
 
-static int adpt_detect(struct scsi_host_template * sht);
 static int adpt_queue(struct scsi_cmnd * cmd, void (*cmdcomplete) (struct scsi_cmnd *));
 static int adpt_abort(struct scsi_cmnd * cmd);
 static int adpt_reset(struct scsi_cmnd* cmd);
-static int adpt_release(struct Scsi_Host *host);
 static int adpt_slave_configure(struct scsi_device *);
 
 static const char *adpt_info(struct Scsi_Host *pSHost);
@@ -49,8 +47,6 @@ static int adpt_device_reset(struct scsi_cmnd* cmd);
 
 #define DPT_DRIVER_NAME        "Adaptec I2O RAID"
 
-#ifndef HOSTS_C
-
 #include "dpt/sys_info.h"
 #include <linux/wait.h>
 #include "dpt/dpti_i2o.h"
@@ -289,7 +285,7 @@ static s32 adpt_i2o_init_outbound_q(adpt_hba* pHba);
 static s32 adpt_i2o_hrt_get(adpt_hba* pHba);
 static s32 adpt_scsi_to_i2o(adpt_hba* pHba, struct scsi_cmnd* cmd, struct adpt_device* dptdevice);
 static s32 adpt_i2o_to_scsi(void __iomem *reply, struct scsi_cmnd* cmd);
-static s32 adpt_scsi_register(adpt_hba* pHba,struct scsi_host_template * sht);
+static s32 adpt_scsi_register(adpt_hba* pHba);
 static s32 adpt_hba_reset(adpt_hba* pHba);
 static s32 adpt_i2o_reset_hba(adpt_hba* pHba);
 static s32 adpt_rescan(adpt_hba* pHba);
@@ -299,7 +295,7 @@ static void adpt_i2o_delete_hba(adpt_hba* pHba);
 static void adpt_inquiry(adpt_hba* pHba);
 static void adpt_fail_posted_scbs(adpt_hba* pHba);
 static struct adpt_device* adpt_find_device(adpt_hba* pHba, u32 chan, u32 id, u32 lun);
-static int adpt_install_hba(struct scsi_host_template* sht, struct pci_dev* pDev) ;
+static int adpt_install_hba(struct pci_dev* pDev) ;
 static int adpt_i2o_online_hba(adpt_hba* pHba);
 static void adpt_i2o_post_wait_complete(u32, int);
 static int adpt_i2o_systab_send(adpt_hba* pHba);
@@ -343,5 +339,4 @@ static void adpt_i386_info(sysInfo_S* si);
 #define FW_DEBUG_BLED_OFFSET       8
 
 #define FW_DEBUG_FLAGS_NO_HEADERS_B    0x01
-#endif                         /* !HOSTS_C */
 #endif                         /* _DPT_H */
index 856e38b14861c6614bb72a81cc0a88a236e00db7..d5576d54ce768f6e801e174c29f69901f36bc111 100644 (file)
 #define ESP_BUSID_RESELID     0x10
 #define ESP_BUSID_CTR32BIT    0x40
 
-#define ESP_BUS_TIMEOUT        275     /* In milli-seconds */
+#define ESP_BUS_TIMEOUT        250     /* In milli-seconds */
 #define ESP_TIMEO_CONST       8192
 #define ESP_NEG_DEFP(mhz, cfact) \
         ((ESP_BUS_TIMEOUT * ((mhz) / 1000)) / (8192 * (cfact)))
index d0b95ce0ba00171ae8759ba1e3291d1347d9c524..55e4d2dc2bbe227ea62dcb730d7a50516e27f3c1 100644 (file)
@@ -902,11 +902,6 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
             return;
         /* GDT PCI controller found, resources are already in pdev */
         pcistr[*cnt].pdev = pdev;
-        pcistr[*cnt].vendor_id = vendor;
-        pcistr[*cnt].device_id = device;
-        pcistr[*cnt].subdevice_id = pdev->subsystem_device;
-        pcistr[*cnt].bus = pdev->bus->number;
-        pcistr[*cnt].device_fn = pdev->devfn;
         pcistr[*cnt].irq = pdev->irq;
         base0 = pci_resource_flags(pdev, 0);
         base1 = pci_resource_flags(pdev, 1);
@@ -926,7 +921,8 @@ static void __init gdth_search_dev(gdth_pci_str *pcistr, ushort *cnt,
             pcistr[*cnt].io    = pci_resource_start(pdev, 1);
         }
         TRACE2(("Controller found at %d/%d, irq %d, dpmem 0x%lx\n",
-                pcistr[*cnt].bus, PCI_SLOT(pcistr[*cnt].device_fn), 
+                pcistr[*cnt].pdev->bus->number,
+               PCI_SLOT(pcistr[*cnt].pdev->devfn),
                 pcistr[*cnt].irq, pcistr[*cnt].dpmem));
         (*cnt)++;
     }       
@@ -946,20 +942,20 @@ static void __init gdth_sort_pci(gdth_pci_str *pcistr, int cnt)
         changed = FALSE;
         for (i = 0; i < cnt-1; ++i) {
             if (!reverse_scan) {
-                if ((pcistr[i].bus > pcistr[i+1].bus) ||
-                    (pcistr[i].bus == pcistr[i+1].bus &&
-                     PCI_SLOT(pcistr[i].device_fn) > 
-                     PCI_SLOT(pcistr[i+1].device_fn))) {
+                if ((pcistr[i].pdev->bus->number > pcistr[i+1].pdev->bus->number) ||
+                    (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number &&
+                     PCI_SLOT(pcistr[i].pdev->devfn) >
+                     PCI_SLOT(pcistr[i+1].pdev->devfn))) {
                     temp = pcistr[i];
                     pcistr[i] = pcistr[i+1];
                     pcistr[i+1] = temp;
                     changed = TRUE;
                 }
             } else {
-                if ((pcistr[i].bus < pcistr[i+1].bus) ||
-                    (pcistr[i].bus == pcistr[i+1].bus &&
-                     PCI_SLOT(pcistr[i].device_fn) < 
-                     PCI_SLOT(pcistr[i+1].device_fn))) {
+                if ((pcistr[i].pdev->bus->number < pcistr[i+1].pdev->bus->number) ||
+                    (pcistr[i].pdev->bus->number == pcistr[i+1].pdev->bus->number &&
+                     PCI_SLOT(pcistr[i].pdev->devfn) <
+                     PCI_SLOT(pcistr[i+1].pdev->devfn))) {
                     temp = pcistr[i];
                     pcistr[i] = pcistr[i+1];
                     pcistr[i+1] = temp;
@@ -1176,17 +1172,16 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
 
     TRACE(("gdth_init_pci()\n"));
 
-    if (pcistr->vendor_id == PCI_VENDOR_ID_INTEL)
+    if (pcistr->pdev->vendor == PCI_VENDOR_ID_INTEL)
         ha->oem_id = OEM_ID_INTEL;
     else
         ha->oem_id = OEM_ID_ICP;
-    ha->brd_phys = (pcistr->bus << 8) | (pcistr->device_fn & 0xf8);
-    ha->stype = (ulong32)pcistr->device_id;
-    ha->subdevice_id = pcistr->subdevice_id;
+    ha->brd_phys = (pcistr->pdev->bus->number << 8) | (pcistr->pdev->devfn & 0xf8);
+    ha->stype = (ulong32)pcistr->pdev->device;
     ha->irq = pcistr->irq;
     ha->pdev = pcistr->pdev;
     
-    if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6000B) {  /* GDT6000/B */
+    if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6000B) {  /* GDT6000/B */
         TRACE2(("init_pci() dpmem %lx irq %d\n",pcistr->dpmem,ha->irq));
         ha->brd = ioremap(pcistr->dpmem, sizeof(gdt6_dpram_str));
         if (ha->brd == NULL) {
@@ -1293,7 +1288,7 @@ static int __init gdth_init_pci(gdth_pci_str *pcistr,gdth_ha_str *ha)
 
         ha->dma64_support = 0;
 
-    } else if (ha->stype <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */
+    } else if (ha->pdev->device <= PCI_DEVICE_ID_VORTEX_GDT6555) { /* GDT6110, ... */
         ha->plx = (gdt6c_plx_regs *)pcistr->io;
         TRACE2(("init_pci_new() dpmem %lx irq %d\n",
             pcistr->dpmem,ha->irq));
@@ -4601,7 +4596,8 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
         }
         /* controller found and initialized */
         printk("Configuring GDT-PCI HA at %d/%d IRQ %u\n",
-               pcistr[ctr].bus,PCI_SLOT(pcistr[ctr].device_fn),ha->irq);
+               pcistr[ctr].pdev->bus->number,
+              PCI_SLOT(pcistr[ctr].pdev->devfn), ha->irq);
 
         if (request_irq(ha->irq, gdth_interrupt,
                         IRQF_DISABLED|IRQF_SHARED, "gdth", ha))
@@ -4637,7 +4633,7 @@ static int __init gdth_detect(Scsi_Host_Template *shtp)
 #endif
         ha->scratch_busy = FALSE;
         ha->req_first = NULL;
-        ha->tid_cnt = pcistr[ctr].device_id >= 0x200 ? MAXID : MAX_HDRIVES;
+        ha->tid_cnt = pcistr[ctr].pdev->device >= 0x200 ? MAXID : MAX_HDRIVES;
         if (max_ids > 0 && max_ids < ha->tid_cnt)
             ha->tid_cnt = max_ids;
         for (i=0; i<GDTH_MAXCMDS; ++i)
@@ -4810,7 +4806,7 @@ static const char *gdth_ctr_name(int hanum)
     } else if (ha->type == GDT_ISA) {
         return("GDT2000/2020");
     } else if (ha->type == GDT_PCI) {
-        switch (ha->stype) {
+        switch (ha->pdev->device) {
           case PCI_DEVICE_ID_VORTEX_GDT60x0:
             return("GDT6000/6020/6050");
           case PCI_DEVICE_ID_VORTEX_GDT6000B:
@@ -5448,12 +5444,12 @@ static int gdth_ioctl(struct inode *inode, struct file *filep,
                 ctrt.type = 
                     (ha->oem_id == OEM_ID_INTEL ? 0xfd : 0xfe);
                 if (ha->stype >= 0x300)
-                    ctrt.ext_type = 0x6000 | ha->subdevice_id;
+                    ctrt.ext_type = 0x6000 | ha->pdev->subsystem_device;
                 else 
                     ctrt.ext_type = 0x6000 | ha->stype;
             }
-            ctrt.device_id = ha->stype;
-            ctrt.sub_device_id = ha->subdevice_id;
+            ctrt.device_id = ha->pdev->device;
+            ctrt.sub_device_id = ha->pdev->subsystem_device;
         }
         ctrt.info = ha->brd_phys;
         ctrt.oem_id = ha->oem_id;
index 8c29eafd51c5f34fe57cf582e9eccc9f1e57b9c4..37423300592e68825b38798023fffbaf9d572331 100644 (file)
@@ -845,11 +845,6 @@ typedef struct {
 /* PCI resources */
 typedef struct {
     struct pci_dev      *pdev;
-    ushort              vendor_id;              /* vendor (ICP, Intel, ..) */
-    ushort              device_id;              /* device ID (0,..,9) */
-    ushort              subdevice_id;           /* sub device ID */
-    unchar              bus;                    /* PCI bus */
-    unchar              device_fn;              /* PCI device/function no. */
     ulong               dpmem;                  /* DPRAM address */
     ulong               io;                     /* IO address */
     ulong               io_mm;                  /* IO address mem. mapped */
@@ -862,7 +857,6 @@ typedef struct {
     ushort              oem_id;                 /* OEM */
     ushort              type;                   /* controller class */
     ulong32             stype;                  /* subtype (PCI: device ID) */
-    ushort              subdevice_id;           /* sub device ID (PCI) */
     ushort              fw_vers;                /* firmware version */
     ushort              cache_feat;             /* feat. cache serv. (s/g,..)*/
     ushort              raw_feat;               /* feat. raw service (s/g,..)*/
index bd8e7f323c69fcd607ba6124f7a83339809a8abd..96bc31266c98a258aefbcbd6ff54fde95f80a560 100644 (file)
@@ -220,7 +220,7 @@ int scsi_add_host(struct Scsi_Host *shost, struct device *dev)
        get_device(&shost->shost_gendev);
 
        if (shost->transportt->host_size &&
-           (shost->shost_data = kmalloc(shost->transportt->host_size,
+           (shost->shost_data = kzalloc(shost->transportt->host_size,
                                         GFP_KERNEL)) == NULL)
                goto out_del_classdev;
 
index 5870866abc99e96410999261b0cdfd4cb31c710d..5ecc63d1b43602e10f9a64ecad246dbcd1403c52 100644 (file)
@@ -393,12 +393,6 @@ static int map_sg_data(struct scsi_cmnd *cmd,
                return 1;
        else if (sg_mapped < 0)
                return 0;
-       else if (sg_mapped > SG_ALL) {
-               printk(KERN_ERR
-                      "ibmvscsi: More than %d mapped sg entries, got %d\n",
-                      SG_ALL, sg_mapped);
-               return 0;
-       }
 
        set_srp_direction(cmd, srp_cmd, sg_mapped);
 
@@ -708,8 +702,7 @@ static int ibmvscsi_queuecommand(struct scsi_cmnd *cmnd,
        struct srp_cmd *srp_cmd;
        struct srp_event_struct *evt_struct;
        struct srp_indirect_buf *indirect;
-       struct ibmvscsi_host_data *hostdata =
-               (struct ibmvscsi_host_data *)&cmnd->device->host->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(cmnd->device->host);
        u16 lun = lun_from_dev(cmnd->device);
        u8 out_fmt, in_fmt;
 
@@ -960,8 +953,7 @@ static void sync_completion(struct srp_event_struct *evt_struct)
  */
 static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
 {
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
        struct srp_tsk_mgmt *tsk_mgmt;
        struct srp_event_struct *evt;
        struct srp_event_struct *tmp_evt, *found_evt;
@@ -1084,9 +1076,7 @@ static int ibmvscsi_eh_abort_handler(struct scsi_cmnd *cmd)
  */
 static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
 {
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
-
+       struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
        struct srp_tsk_mgmt *tsk_mgmt;
        struct srp_event_struct *evt;
        struct srp_event_struct *tmp_evt, *pos;
@@ -1183,8 +1173,7 @@ static int ibmvscsi_eh_device_reset_handler(struct scsi_cmnd *cmd)
 static int ibmvscsi_eh_host_reset_handler(struct scsi_cmnd *cmd)
 {
        unsigned long wait_switch = 0;
-       struct ibmvscsi_host_data *hostdata =
-               (struct ibmvscsi_host_data *)cmd->device->host->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(cmd->device->host);
 
        dev_err(hostdata->dev, "Resetting connection due to error recovery\n");
 
@@ -1412,8 +1401,7 @@ static int ibmvscsi_change_queue_depth(struct scsi_device *sdev, int qdepth)
 static ssize_t show_host_srp_version(struct class_device *class_dev, char *buf)
 {
        struct Scsi_Host *shost = class_to_shost(class_dev);
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)shost->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(shost);
        int len;
 
        len = snprintf(buf, PAGE_SIZE, "%s\n",
@@ -1433,8 +1421,7 @@ static ssize_t show_host_partition_name(struct class_device *class_dev,
                                        char *buf)
 {
        struct Scsi_Host *shost = class_to_shost(class_dev);
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)shost->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(shost);
        int len;
 
        len = snprintf(buf, PAGE_SIZE, "%s\n",
@@ -1454,8 +1441,7 @@ static ssize_t show_host_partition_number(struct class_device *class_dev,
                                          char *buf)
 {
        struct Scsi_Host *shost = class_to_shost(class_dev);
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)shost->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(shost);
        int len;
 
        len = snprintf(buf, PAGE_SIZE, "%d\n",
@@ -1474,8 +1460,7 @@ static struct class_device_attribute ibmvscsi_host_partition_number = {
 static ssize_t show_host_mad_version(struct class_device *class_dev, char *buf)
 {
        struct Scsi_Host *shost = class_to_shost(class_dev);
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)shost->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(shost);
        int len;
 
        len = snprintf(buf, PAGE_SIZE, "%d\n",
@@ -1494,8 +1479,7 @@ static struct class_device_attribute ibmvscsi_host_mad_version = {
 static ssize_t show_host_os_type(struct class_device *class_dev, char *buf)
 {
        struct Scsi_Host *shost = class_to_shost(class_dev);
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)shost->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(shost);
        int len;
 
        len = snprintf(buf, PAGE_SIZE, "%d\n", hostdata->madapter_info.os_type);
@@ -1513,8 +1497,7 @@ static struct class_device_attribute ibmvscsi_host_os_type = {
 static ssize_t show_host_config(struct class_device *class_dev, char *buf)
 {
        struct Scsi_Host *shost = class_to_shost(class_dev);
-       struct ibmvscsi_host_data *hostdata =
-           (struct ibmvscsi_host_data *)shost->hostdata;
+       struct ibmvscsi_host_data *hostdata = shost_priv(shost);
 
        /* returns null-terminated host config data */
        if (ibmvscsi_do_host_config(hostdata, buf, PAGE_SIZE) == 0)
@@ -1582,7 +1565,7 @@ static int ibmvscsi_probe(struct vio_dev *vdev, const struct vio_device_id *id)
                goto scsi_host_alloc_failed;
        }
 
-       hostdata = (struct ibmvscsi_host_data *)host->hostdata;
+       hostdata = shost_priv(host);
        memset(hostdata, 0x00, sizeof(*hostdata));
        INIT_LIST_HEAD(&hostdata->sent);
        hostdata->host = host;
index bb90df8bdce4ef7c204f8e93bc664e85649eedfc..1cc01acc28089060b6aa39f677e630b06c3a83f9 100644 (file)
@@ -328,17 +328,15 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co
        u8             *buf;
 
        /* stuff a sense request in front of our current request */
-       pc = kmalloc (sizeof (idescsi_pc_t), GFP_ATOMIC);
-       rq = kmalloc (sizeof (struct request), GFP_ATOMIC);
-       buf = kmalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC);
-       if (pc == NULL || rq == NULL || buf == NULL) {
+       pc = kzalloc(sizeof(idescsi_pc_t), GFP_ATOMIC);
+       rq = kmalloc(sizeof(struct request), GFP_ATOMIC);
+       buf = kzalloc(SCSI_SENSE_BUFFERSIZE, GFP_ATOMIC);
+       if (!pc || !rq || !buf) {
                kfree(buf);
                kfree(rq);
                kfree(pc);
                return -ENOMEM;
        }
-       memset (pc, 0, sizeof (idescsi_pc_t));
-       memset (buf, 0, SCSI_SENSE_BUFFERSIZE);
        ide_init_drive_cmd(rq);
        rq->special = (char *) pc;
        pc->rq = rq;
index 7829ab1e2fb46d5bf350c9c6d54d0ff9dec4a01a..a21455d0274cb5d634a40baf768726ff4daf1472 100644 (file)
@@ -2216,11 +2216,13 @@ static void iscsi_tcp_session_destroy(struct iscsi_cls_session *cls_session)
 
 static int iscsi_tcp_slave_configure(struct scsi_device *sdev)
 {
+       blk_queue_bounce_limit(sdev->request_queue, BLK_BOUNCE_ANY);
        blk_queue_dma_alignment(sdev->request_queue, 0);
        return 0;
 }
 
 static struct scsi_host_template iscsi_sht = {
+       .module                 = THIS_MODULE,
        .name                   = "iSCSI Initiator over TCP/IP",
        .queuecommand           = iscsi_queuecommand,
        .change_queue_depth     = iscsi_change_queue_depth,
index 4d85ce1001922819e40ea48e6ea46c86680dcb99..5606d1e62978433e7ca763e917b15e1c8af4c8e6 100644 (file)
@@ -596,9 +596,16 @@ static void iscsi_prep_mtask(struct iscsi_conn *conn,
        nop->cmdsn = cpu_to_be32(session->cmdsn);
        if (hdr->itt != RESERVED_ITT) {
                hdr->itt = build_itt(mtask->itt, conn->id, session->age);
+               /*
+                * TODO: We always use immediate, so we never hit this.
+                * If we start to send tmfs or nops as non-immediate then
+                * we should start checking the cmdsn numbers for mgmt tasks.
+                */
                if (conn->c_stage == ISCSI_CONN_STARTED &&
-                   !(hdr->opcode & ISCSI_OP_IMMEDIATE))
+                   !(hdr->opcode & ISCSI_OP_IMMEDIATE)) {
+                       session->queued_cmdsn++;
                        session->cmdsn++;
+               }
        }
 
        if (session->tt->init_mgmt_task)
@@ -641,9 +648,11 @@ static int iscsi_check_cmdsn_window_closed(struct iscsi_conn *conn)
        /*
         * Check for iSCSI window and take care of CmdSN wrap-around
         */
-       if (!iscsi_sna_lte(session->cmdsn, session->max_cmdsn)) {
-               debug_scsi("iSCSI CmdSN closed. MaxCmdSN %u CmdSN %u\n",
-                          session->max_cmdsn, session->cmdsn);
+       if (!iscsi_sna_lte(session->queued_cmdsn, session->max_cmdsn)) {
+               debug_scsi("iSCSI CmdSN closed. ExpCmdSn %u MaxCmdSN %u "
+                          "CmdSN %u/%u\n", session->exp_cmdsn,
+                          session->max_cmdsn, session->cmdsn,
+                          session->queued_cmdsn);
                return -ENOSPC;
        }
        return 0;
@@ -722,11 +731,6 @@ check_mgmt:
 
        /* process command queue */
        while (!list_empty(&conn->xmitqueue)) {
-               rc = iscsi_check_cmdsn_window_closed(conn);
-               if (rc) {
-                       spin_unlock_bh(&conn->session->lock);
-                       return rc;
-               }
                /*
                 * iscsi tcp may readd the task to the xmitqueue to send
                 * write data
@@ -834,12 +838,6 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
                goto fault;
        }
 
-       /*
-        * We check this here and in data xmit, because if we get to the point
-        * that this check is hitting the window then we have enough IO in
-        * flight and enough IO waiting to be transmitted it is better
-        * to let the scsi/block layer queue up.
-        */
        if (iscsi_check_cmdsn_window_closed(conn)) {
                reason = FAILURE_WINDOW_CLOSED;
                goto reject;
@@ -850,6 +848,8 @@ int iscsi_queuecommand(struct scsi_cmnd *sc, void (*done)(struct scsi_cmnd *))
                reason = FAILURE_OOM;
                goto reject;
        }
+       session->queued_cmdsn++;
+
        sc->SCp.phase = session->age;
        sc->SCp.ptr = (char *)ctask;
 
@@ -1140,7 +1140,13 @@ static void fail_command(struct iscsi_conn *conn, struct iscsi_cmd_task *ctask,
        if (!sc)
                return;
 
-       if (ctask->state != ISCSI_TASK_PENDING)
+       if (ctask->state == ISCSI_TASK_PENDING)
+               /*
+                * cmd never made it to the xmit thread, so we should not count
+                * the cmd in the sequencing
+                */
+               conn->session->queued_cmdsn--;
+       else
                conn->session->tt->cleanup_cmd_task(conn, ctask);
        iscsi_ctask_mtask_cleanup(ctask);
 
@@ -1392,7 +1398,7 @@ iscsi_session_setup(struct iscsi_transport *iscsit,
        session->state = ISCSI_STATE_FREE;
        session->mgmtpool_max = ISCSI_MGMT_CMDS_MAX;
        session->cmds_max = cmds_max;
-       session->cmdsn = initial_cmdsn;
+       session->queued_cmdsn = session->cmdsn = initial_cmdsn;
        session->exp_cmdsn = initial_cmdsn + 1;
        session->max_cmdsn = initial_cmdsn + 1;
        session->max_r2t = 1;
@@ -1473,6 +1479,7 @@ void iscsi_session_teardown(struct iscsi_cls_session *cls_session)
        struct iscsi_session *session = iscsi_hostdata(shost->hostdata);
        struct module *owner = cls_session->transport->owner;
 
+       iscsi_unblock_session(cls_session);
        scsi_remove_host(shost);
 
        iscsi_pool_free(&session->mgmtpool, (void**)session->mgmt_cmds);
@@ -1615,11 +1622,8 @@ void iscsi_conn_teardown(struct iscsi_cls_conn *cls_conn)
        kfree(conn->persistent_address);
        __kfifo_put(session->mgmtpool.queue, (void*)&conn->login_mtask,
                    sizeof(void*));
-       if (session->leadconn == conn) {
+       if (session->leadconn == conn)
                session->leadconn = NULL;
-               /* no connections exits.. reset sequencing */
-               session->cmdsn = session->max_cmdsn = session->exp_cmdsn = 1;
-       }
        spin_unlock_bh(&session->lock);
 
        kfifo_free(conn->mgmtqueue);
@@ -1649,6 +1653,7 @@ int iscsi_conn_start(struct iscsi_cls_conn *cls_conn)
        spin_lock_bh(&session->lock);
        conn->c_stage = ISCSI_CONN_STARTED;
        session->state = ISCSI_STATE_LOGGED_IN;
+       session->queued_cmdsn = session->cmdsn;
 
        switch(conn->stop_stage) {
        case STOP_CONN_RECOVER:
index 3a3c1ac9c6cdcd495d477e7219d4eddc0f51bbc8..c01a40d321d43530b02e814b3cd335d7f0b54797 100644 (file)
@@ -32,7 +32,8 @@ config SCSI_SAS_LIBSAS
 
 config SCSI_SAS_ATA
        bool "ATA support for libsas (requires libata)"
-       depends on SCSI_SAS_LIBSAS && ATA
+       depends on SCSI_SAS_LIBSAS
+       depends on ATA = y || ATA = SCSI_SAS_LIBSAS
        help
                Builds in ATA support into libsas.  Will necessitate
                the loading of libata along with libsas.
index ced2de32c5117af2676196bfdad42df43231bcfd..5e573efcf0a70f90232ac916aa8897f85c5f713b 100644 (file)
@@ -382,7 +382,7 @@ int sas_ata_init_host_and_port(struct domain_device *found_dev,
        struct ata_port *ap;
 
        ata_host_init(&found_dev->sata_dev.ata_host,
-                     &ha->pcidev->dev,
+                     ha->dev,
                      sata_port_info.flags,
                      &sas_sata_ops);
        ap = ata_sas_port_alloc(&found_dev->sata_dev.ata_host,
@@ -448,10 +448,10 @@ static void sas_disc_task_done(struct sas_task *task)
  * @task: the task to be executed
  * @buffer: pointer to buffer to do I/O
  * @size: size of @buffer
- * @pci_dma_dir: PCI_DMA_...
+ * @dma_dir: DMA direction.  DMA_xxx
  */
 static int sas_execute_task(struct sas_task *task, void *buffer, int size,
-                           int pci_dma_dir)
+                           enum dma_data_direction dma_dir)
 {
        int res = 0;
        struct scatterlist *scatter = NULL;
@@ -461,7 +461,7 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
        struct sas_internal *i =
                to_sas_internal(task->dev->port->ha->core.shost->transportt);
 
-       if (pci_dma_dir != PCI_DMA_NONE) {
+       if (dma_dir != DMA_NONE) {
                scatter = kzalloc(sizeof(*scatter), GFP_KERNEL);
                if (!scatter)
                        goto out;
@@ -474,11 +474,11 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
        task->scatter = scatter;
        task->num_scatter = num_scatter;
        task->total_xfer_len = size;
-       task->data_dir = pci_dma_dir;
+       task->data_dir = dma_dir;
        task->task_done = sas_disc_task_done;
-       if (pci_dma_dir != PCI_DMA_NONE &&
+       if (dma_dir != DMA_NONE &&
            sas_protocol_ata(task->task_proto)) {
-               task->num_scatter = pci_map_sg(task->dev->port->ha->pcidev,
+               task->num_scatter = dma_map_sg(task->dev->port->ha->dev,
                                               task->scatter,
                                               task->num_scatter,
                                               task->data_dir);
@@ -565,9 +565,9 @@ static int sas_execute_task(struct sas_task *task, void *buffer, int size,
                }
        }
 ex_err:
-       if (pci_dma_dir != PCI_DMA_NONE) {
+       if (dma_dir != DMA_NONE) {
                if (sas_protocol_ata(task->task_proto))
-                       pci_unmap_sg(task->dev->port->ha->pcidev,
+                       dma_unmap_sg(task->dev->port->ha->dev,
                                     task->scatter, task->num_scatter,
                                     task->data_dir);
                kfree(scatter);
@@ -628,11 +628,11 @@ static void sas_get_ata_command_set(struct domain_device *dev)
  * @features: the features register
  * @buffer: pointer to buffer to do I/O
  * @size: size of @buffer
- * @pci_dma_dir: PCI_DMA_...
+ * @dma_dir: DMA direction.  DMA_xxx
  */
 static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
                             u8 features, void *buffer, int size,
-                            int pci_dma_dir)
+                            enum dma_data_direction dma_dir)
 {
        int res = 0;
        struct sas_task *task;
@@ -652,7 +652,7 @@ static int sas_issue_ata_cmd(struct domain_device *dev, u8 command,
        task->ata_task.fis.device = d2h_fis->device;
        task->ata_task.retry_count = 1;
 
-       res = sas_execute_task(task, buffer, size, pci_dma_dir);
+       res = sas_execute_task(task, buffer, size, dma_dir);
 
        sas_free_task(task);
 out:
@@ -707,7 +707,7 @@ static int sas_discover_sata_dev(struct domain_device *dev)
        }
 
        res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
-                               PCI_DMA_FROMDEVICE);
+                               DMA_FROM_DEVICE);
        if (res)
                goto out_err;
 
@@ -720,13 +720,13 @@ static int sas_discover_sata_dev(struct domain_device *dev)
                        goto cont1;
                res = sas_issue_ata_cmd(dev, ATA_SET_FEATURES,
                                        ATA_FEATURE_PUP_STBY_SPIN_UP,
-                                       NULL, 0, PCI_DMA_NONE);
+                                       NULL, 0, DMA_NONE);
                if (res)
                        goto cont1;
 
                schedule_timeout_interruptible(5*HZ); /* More time? */
                res = sas_issue_ata_cmd(dev, command, 0, identify_x, 512,
-                                       PCI_DMA_FROMDEVICE);
+                                       DMA_FROM_DEVICE);
                if (res)
                        goto out_err;
        }
index 6ac9f61d006a5616c4f882088eaac4948a5c6d4e..7ef0afc3cd68b7f848a7b635af3c30fb8a6690ad 100644 (file)
@@ -22,7 +22,6 @@
  *
  */
 
-#include <linux/pci.h>
 #include <linux/scatterlist.h>
 #include <scsi/scsi_host.h>
 #include <scsi/scsi_eh.h>
@@ -170,7 +169,7 @@ int sas_notify_lldd_dev_found(struct domain_device *dev)
                if (res) {
                        printk("sas: driver on pcidev %s cannot handle "
                               "device %llx, error:%d\n",
-                              pci_name(sas_ha->pcidev),
+                              sas_ha->dev->bus_id,
                               SAS_ADDR(dev->sas_addr), res);
                }
        }
index f1246d2c9bef83a90847fd5399c546d078149391..bf34a236f946b62711f4b3111e476eac6594f5c1 100644 (file)
@@ -56,7 +56,7 @@ void sas_dprint_phye(int phyid, enum phy_event pe)
 
 void sas_dprint_hae(struct sas_ha_struct *sas_ha, enum ha_event he)
 {
-       SAS_DPRINTK("ha %s: %s event\n", pci_name(sas_ha->pcidev),
+       SAS_DPRINTK("ha %s: %s event\n", sas_ha->dev->bus_id,
                    sas_hae_str[he]);
 }
 
index b500f0c1449c5d7da0a8b9005541556d4b757ac3..8727436b222d340f269556d2b7054a31416700c6 100644 (file)
@@ -507,14 +507,21 @@ static int sas_dev_present_in_domain(struct asd_sas_port *port,
 int sas_smp_get_phy_events(struct sas_phy *phy)
 {
        int res;
+       u8 *req;
+       u8 *resp;
        struct sas_rphy *rphy = dev_to_rphy(phy->dev.parent);
        struct domain_device *dev = sas_find_dev_by_rphy(rphy);
-       u8 *req = alloc_smp_req(RPEL_REQ_SIZE);
-       u8 *resp = kzalloc(RPEL_RESP_SIZE, GFP_KERNEL);
 
-       if (!resp)
+       req = alloc_smp_req(RPEL_REQ_SIZE);
+       if (!req)
                return -ENOMEM;
 
+       resp = alloc_smp_resp(RPEL_RESP_SIZE);
+       if (!resp) {
+               kfree(req);
+               return -ENOMEM;
+       }
+
        req[1] = SMP_REPORT_PHY_ERR_LOG;
        req[9] = phy->number;
 
@@ -1879,7 +1886,7 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
                    struct request *req)
 {
        struct domain_device *dev;
-       int ret, type = rphy->identify.device_type;
+       int ret, type;
        struct request *rsp = req->next_rq;
 
        if (!rsp) {
@@ -1888,12 +1895,13 @@ int sas_smp_handler(struct Scsi_Host *shost, struct sas_rphy *rphy,
                return -EINVAL;
        }
 
-       /* seems aic94xx doesn't support */
+       /* no rphy means no smp target support (ie aic94xx host) */
        if (!rphy) {
                printk("%s: can we send a smp request to a host?\n",
                       __FUNCTION__);
                return -EINVAL;
        }
+       type = rphy->identify.device_type;
 
        if (type != SAS_EDGE_EXPANDER_DEVICE &&
            type != SAS_FANOUT_EXPANDER_DEVICE) {
index f8f64d6485cdacbfdd88c4b86389c796deeeecb6..ba3ecab9baf3857cca02ab670d059ad5ad877b6c 100644 (file)
@@ -45,7 +45,7 @@ struct lpfc_sli2_slim;
 #define LPFC_DISC_IOCB_BUFF_COUNT 20
 
 #define LPFC_HB_MBOX_INTERVAL   5      /* Heart beat interval in seconds. */
-#define LPFC_HB_MBOX_TIMEOUT    30     /* Heart beat timeout  in seconds. */
+#define LPFC_HB_MBOX_TIMEOUT    30     /* Heart beat timeout  in seconds. */
 
 /* Define macros for 64 bit support */
 #define putPaddrLow(addr)    ((uint32_t) (0xffffffff & (u64)(addr)))
@@ -78,6 +78,7 @@ struct lpfc_dma_pool {
 
 struct hbq_dmabuf {
        struct lpfc_dmabuf dbuf;
+       uint32_t size;
        uint32_t tag;
 };
 
@@ -329,13 +330,30 @@ struct lpfc_vport {
 #define FC_LOADING             0x1     /* HBA in process of loading drvr */
 #define FC_UNLOADING           0x2     /* HBA in process of unloading drvr */
        char  *vname;                   /* Application assigned name */
+
+       /* Vport Config Parameters */
+       uint32_t cfg_scan_down;
+       uint32_t cfg_lun_queue_depth;
+       uint32_t cfg_nodev_tmo;
+       uint32_t cfg_devloss_tmo;
+       uint32_t cfg_restrict_login;
+       uint32_t cfg_peer_port_login;
+       uint32_t cfg_fcp_class;
+       uint32_t cfg_use_adisc;
+       uint32_t cfg_fdmi_on;
+       uint32_t cfg_discovery_threads;
+       uint32_t cfg_log_verbose;
+       uint32_t cfg_max_luns;
+
+       uint32_t dev_loss_tmo_changed;
+
        struct fc_vport *fc_vport;
 
 #ifdef CONFIG_LPFC_DEBUG_FS
        struct dentry *debug_disc_trc;
        struct dentry *debug_nodelist;
        struct dentry *vport_debugfs_root;
-       struct lpfc_disc_trc *disc_trc;
+       struct lpfc_debugfs_trc *disc_trc;
        atomic_t disc_trc_cnt;
 #endif
 };
@@ -345,17 +363,25 @@ struct hbq_s {
        uint32_t next_hbqPutIdx;  /* Index to next HBQ slot to use */
        uint32_t hbqPutIdx;       /* HBQ slot to use */
        uint32_t local_hbqGetIdx; /* Local copy of Get index from Port */
+       void    *hbq_virt;        /* Virtual ptr to this hbq */
+       struct list_head hbq_buffer_list;  /* buffers assigned to this HBQ */
+                                 /* Callback for HBQ buffer allocation */
+       struct hbq_dmabuf *(*hbq_alloc_buffer) (struct lpfc_hba *);
+                                 /* Callback for HBQ buffer free */
+       void               (*hbq_free_buffer) (struct lpfc_hba *,
+                                              struct hbq_dmabuf *);
 };
 
-#define LPFC_MAX_HBQS  16
-/* this matches the possition in the lpfc_hbq_defs array */
+#define LPFC_MAX_HBQS  4
+/* this matches the position in the lpfc_hbq_defs array */
 #define LPFC_ELS_HBQ   0
+#define LPFC_EXTRA_HBQ 1
 
 struct lpfc_hba {
        struct lpfc_sli sli;
        uint32_t sli_rev;               /* SLI2 or SLI3 */
        uint32_t sli3_options;          /* Mask of enabled SLI3 options */
-#define LPFC_SLI3_ENABLED       0x01
+#define LPFC_SLI3_ENABLED       0x01
 #define LPFC_SLI3_HBQ_ENABLED   0x02
 #define LPFC_SLI3_NPIV_ENABLED  0x04
 #define LPFC_SLI3_VPORT_TEARDOWN 0x08
@@ -364,7 +390,7 @@ struct lpfc_hba {
 
        enum hba_state link_state;
        uint32_t link_flag;     /* link state flags */
-#define LS_LOOPBACK_MODE      0x1      /* NPort is in Loopback mode */
+#define LS_LOOPBACK_MODE      0x1      /* NPort is in Loopback mode */
                                        /* This flag is set while issuing */
                                        /* INIT_LINK mailbox command */
 #define LS_NPIV_FAB_SUPPORTED 0x2      /* Fabric supports NPIV */
@@ -413,28 +439,16 @@ struct lpfc_hba {
        uint8_t  wwpn[8];
        uint32_t RandomData[7];
 
-       uint32_t cfg_log_verbose;
-       uint32_t cfg_lun_queue_depth;
-       uint32_t cfg_nodev_tmo;
-       uint32_t cfg_devloss_tmo;
-       uint32_t cfg_hba_queue_depth;
-       uint32_t cfg_peer_port_login;
-       uint32_t cfg_vport_restrict_login;
-       uint32_t cfg_npiv_enable;
-       uint32_t cfg_fcp_class;
-       uint32_t cfg_use_adisc;
+       /* HBA Config Parameters */
        uint32_t cfg_ack0;
+       uint32_t cfg_enable_npiv;
        uint32_t cfg_topology;
-       uint32_t cfg_scan_down;
        uint32_t cfg_link_speed;
        uint32_t cfg_cr_delay;
        uint32_t cfg_cr_count;
        uint32_t cfg_multi_ring_support;
        uint32_t cfg_multi_ring_rctl;
        uint32_t cfg_multi_ring_type;
-       uint32_t cfg_fdmi_on;
-       uint32_t cfg_discovery_threads;
-       uint32_t cfg_max_luns;
        uint32_t cfg_poll;
        uint32_t cfg_poll_tmo;
        uint32_t cfg_use_msi;
@@ -442,8 +456,8 @@ struct lpfc_hba {
        uint32_t cfg_sg_dma_buf_size;
        uint64_t cfg_soft_wwnn;
        uint64_t cfg_soft_wwpn;
+       uint32_t cfg_hba_queue_depth;
 
-       uint32_t dev_loss_tmo_changed;
 
        lpfc_vpd_t vpd;         /* vital product data */
 
@@ -457,7 +471,6 @@ struct lpfc_hba {
        wait_queue_head_t    *work_wait;
        struct task_struct   *worker_thread;
 
-       struct list_head hbq_buffer_list;
        uint32_t hbq_count;             /* Count of configured HBQs */
        struct hbq_s hbqs[LPFC_MAX_HBQS]; /* local copy of hbq indicies  */
 
@@ -526,12 +539,14 @@ struct lpfc_hba {
        mempool_t *nlp_mem_pool;
 
        struct fc_host_statistics link_stats;
+       uint8_t using_msi;
 
        struct list_head port_list;
-       struct lpfc_vport *pport; /* physical lpfc_vport pointer */
-       uint16_t max_vpi;       /* Maximum virtual nports */
-#define LPFC_MAX_VPI 100  /* Max number of VPorts supported */
-       unsigned long *vpi_bmask; /* vpi allocation table */
+       struct lpfc_vport *pport;       /* physical lpfc_vport pointer */
+       uint16_t max_vpi;               /* Maximum virtual nports */
+#define LPFC_MAX_VPI 100               /* Max number of VPI supported */
+#define LPFC_MAX_VPORTS (LPFC_MAX_VPI+1)/* Max number of VPorts supported */
+       unsigned long *vpi_bmask;       /* vpi allocation table */
 
        /* Data structure used by fabric iocb scheduler */
        struct list_head fabric_iocb_list;
@@ -547,6 +562,11 @@ struct lpfc_hba {
 #ifdef CONFIG_LPFC_DEBUG_FS
        struct dentry *hba_debugfs_root;
        atomic_t debugfs_vport_count;
+       struct dentry *debug_hbqinfo;
+       struct dentry *debug_dumpslim;
+       struct dentry *debug_slow_ring_trc;
+       struct lpfc_debugfs_trc *slow_ring_trc;
+       atomic_t slow_ring_trc_cnt;
 #endif
 
        /* Fields used for heart beat. */
index 860a52c090f408fb4bbdccad73675a72bc78a361..80a11218b9bbe8ddafe5d44ce896ecd1115d9bc6 100644 (file)
@@ -67,12 +67,6 @@ lpfc_drvr_version_show(struct class_device *cdev, char *buf)
        return snprintf(buf, PAGE_SIZE, LPFC_MODULE_DESC "\n");
 }
 
-static ssize_t
-management_version_show(struct class_device *cdev, char *buf)
-{
-       return snprintf(buf, PAGE_SIZE, DFC_API_VERSION "\n");
-}
-
 static ssize_t
 lpfc_info_show(struct class_device *cdev, char *buf)
 {
@@ -319,9 +313,8 @@ lpfc_do_offline(struct lpfc_hba *phba, uint32_t type)
                        if (cnt++ > 3000) {
                                lpfc_printf_log(phba,
                                        KERN_WARNING, LOG_INIT,
-                                       "%d:0466 Outstanding IO when "
-                                       "bringing Adapter offline\n",
-                                       phba->brd_no);
+                                       "0466 Outstanding IO when "
+                                       "bringing Adapter offline\n");
                                break;
                        }
                }
@@ -437,7 +430,7 @@ lpfc_board_mode_store(struct class_device *cdev, const char *buf, size_t count)
                return -EIO;
 }
 
-int
+static int
 lpfc_get_hba_info(struct lpfc_hba *phba,
                  uint32_t *mxri, uint32_t *axri,
                  uint32_t *mrpi, uint32_t *arpi,
@@ -694,9 +687,8 @@ lpfc_##attr##_init(struct lpfc_hba *phba, int val) \
                return 0;\
        }\
        lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
-                       "%d:0449 lpfc_"#attr" attribute cannot be set to %d, "\
-                       "allowed range is ["#minval", "#maxval"]\n", \
-                       phba->brd_no, val); \
+                       "0449 lpfc_"#attr" attribute cannot be set to %d, "\
+                       "allowed range is ["#minval", "#maxval"]\n", val); \
        phba->cfg_##attr = default;\
        return -EINVAL;\
 }
@@ -710,9 +702,8 @@ lpfc_##attr##_set(struct lpfc_hba *phba, int val) \
                return 0;\
        }\
        lpfc_printf_log(phba, KERN_ERR, LOG_INIT, \
-                       "%d:0450 lpfc_"#attr" attribute cannot be set to %d, "\
-                       "allowed range is ["#minval", "#maxval"]\n", \
-                       phba->brd_no, val); \
+                       "0450 lpfc_"#attr" attribute cannot be set to %d, "\
+                       "allowed range is ["#minval", "#maxval"]\n", val); \
        return -EINVAL;\
 }
 
@@ -734,6 +725,75 @@ lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \
                return -EINVAL;\
 }
 
+#define lpfc_vport_param_show(attr)    \
+static ssize_t \
+lpfc_##attr##_show(struct class_device *cdev, char *buf) \
+{ \
+       struct Scsi_Host  *shost = class_to_shost(cdev);\
+       struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
+       int val = 0;\
+       val = vport->cfg_##attr;\
+       return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_##attr);\
+}
+
+#define lpfc_vport_param_hex_show(attr)        \
+static ssize_t \
+lpfc_##attr##_show(struct class_device *cdev, char *buf) \
+{ \
+       struct Scsi_Host  *shost = class_to_shost(cdev);\
+       struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
+       int val = 0;\
+       val = vport->cfg_##attr;\
+       return snprintf(buf, PAGE_SIZE, "%#x\n", vport->cfg_##attr);\
+}
+
+#define lpfc_vport_param_init(attr, default, minval, maxval)   \
+static int \
+lpfc_##attr##_init(struct lpfc_vport *vport, int val) \
+{ \
+       if (val >= minval && val <= maxval) {\
+               vport->cfg_##attr = val;\
+               return 0;\
+       }\
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
+                        "0449 lpfc_"#attr" attribute cannot be set to %d, "\
+                        "allowed range is ["#minval", "#maxval"]\n", val); \
+       vport->cfg_##attr = default;\
+       return -EINVAL;\
+}
+
+#define lpfc_vport_param_set(attr, default, minval, maxval)    \
+static int \
+lpfc_##attr##_set(struct lpfc_vport *vport, int val) \
+{ \
+       if (val >= minval && val <= maxval) {\
+               vport->cfg_##attr = val;\
+               return 0;\
+       }\
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT, \
+                        "0450 lpfc_"#attr" attribute cannot be set to %d, "\
+                        "allowed range is ["#minval", "#maxval"]\n", val); \
+       return -EINVAL;\
+}
+
+#define lpfc_vport_param_store(attr)   \
+static ssize_t \
+lpfc_##attr##_store(struct class_device *cdev, const char *buf, size_t count) \
+{ \
+       struct Scsi_Host  *shost = class_to_shost(cdev);\
+       struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;\
+       int val=0;\
+       if (!isdigit(buf[0]))\
+               return -EINVAL;\
+       if (sscanf(buf, "%i", &val) != 1)\
+               return -EINVAL;\
+       if (lpfc_##attr##_set(vport, val) == 0) \
+               return strlen(buf);\
+       else \
+               return -EINVAL;\
+}
+
+
 #define LPFC_ATTR(name, defval, minval, maxval, desc) \
 static int lpfc_##name = defval;\
 module_param(lpfc_##name, int, 0);\
@@ -778,6 +838,50 @@ lpfc_param_store(name)\
 static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
                         lpfc_##name##_show, lpfc_##name##_store)
 
+#define LPFC_VPORT_ATTR(name, defval, minval, maxval, desc) \
+static int lpfc_##name = defval;\
+module_param(lpfc_##name, int, 0);\
+MODULE_PARM_DESC(lpfc_##name, desc);\
+lpfc_vport_param_init(name, defval, minval, maxval)
+
+#define LPFC_VPORT_ATTR_R(name, defval, minval, maxval, desc) \
+static int lpfc_##name = defval;\
+module_param(lpfc_##name, int, 0);\
+MODULE_PARM_DESC(lpfc_##name, desc);\
+lpfc_vport_param_show(name)\
+lpfc_vport_param_init(name, defval, minval, maxval)\
+static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
+
+#define LPFC_VPORT_ATTR_RW(name, defval, minval, maxval, desc) \
+static int lpfc_##name = defval;\
+module_param(lpfc_##name, int, 0);\
+MODULE_PARM_DESC(lpfc_##name, desc);\
+lpfc_vport_param_show(name)\
+lpfc_vport_param_init(name, defval, minval, maxval)\
+lpfc_vport_param_set(name, defval, minval, maxval)\
+lpfc_vport_param_store(name)\
+static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
+                        lpfc_##name##_show, lpfc_##name##_store)
+
+#define LPFC_VPORT_ATTR_HEX_R(name, defval, minval, maxval, desc) \
+static int lpfc_##name = defval;\
+module_param(lpfc_##name, int, 0);\
+MODULE_PARM_DESC(lpfc_##name, desc);\
+lpfc_vport_param_hex_show(name)\
+lpfc_vport_param_init(name, defval, minval, maxval)\
+static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO , lpfc_##name##_show, NULL)
+
+#define LPFC_VPORT_ATTR_HEX_RW(name, defval, minval, maxval, desc) \
+static int lpfc_##name = defval;\
+module_param(lpfc_##name, int, 0);\
+MODULE_PARM_DESC(lpfc_##name, desc);\
+lpfc_vport_param_hex_show(name)\
+lpfc_vport_param_init(name, defval, minval, maxval)\
+lpfc_vport_param_set(name, defval, minval, maxval)\
+lpfc_vport_param_store(name)\
+static CLASS_DEVICE_ATTR(lpfc_##name, S_IRUGO | S_IWUSR,\
+                        lpfc_##name##_show, lpfc_##name##_store)
+
 static CLASS_DEVICE_ATTR(info, S_IRUGO, lpfc_info_show, NULL);
 static CLASS_DEVICE_ATTR(serialnum, S_IRUGO, lpfc_serialnum_show, NULL);
 static CLASS_DEVICE_ATTR(modeldesc, S_IRUGO, lpfc_modeldesc_show, NULL);
@@ -794,8 +898,6 @@ static CLASS_DEVICE_ATTR(num_discovered_ports, S_IRUGO,
 static CLASS_DEVICE_ATTR(nport_evt_cnt, S_IRUGO, lpfc_nport_evt_cnt_show, NULL);
 static CLASS_DEVICE_ATTR(lpfc_drvr_version, S_IRUGO, lpfc_drvr_version_show,
                         NULL);
-static CLASS_DEVICE_ATTR(management_version, S_IRUGO, management_version_show,
-                        NULL);
 static CLASS_DEVICE_ATTR(board_mode, S_IRUGO | S_IWUSR,
                         lpfc_board_mode_show, lpfc_board_mode_store);
 static CLASS_DEVICE_ATTR(issue_reset, S_IWUSR, NULL, lpfc_issue_reset);
@@ -908,17 +1010,15 @@ lpfc_soft_wwpn_store(struct class_device *cdev, const char *buf, size_t count)
        stat1 = lpfc_do_offline(phba, LPFC_EVT_OFFLINE);
        if (stat1)
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0463 lpfc_soft_wwpn attribute set failed to reinit "
-                       "adapter - %d\n", phba->brd_no, stat1);
-
+                               "0463 lpfc_soft_wwpn attribute set failed to "
+                               "reinit adapter - %d\n", stat1);
        init_completion(&online_compl);
        lpfc_workq_post_event(phba, &stat2, &online_compl, LPFC_EVT_ONLINE);
        wait_for_completion(&online_compl);
        if (stat2)
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0464 lpfc_soft_wwpn attribute set failed to reinit "
-                       "adapter - %d\n", phba->brd_no, stat2);
-
+                               "0464 lpfc_soft_wwpn attribute set failed to "
+                               "reinit adapter - %d\n", stat2);
        return (stat1 || stat2) ? -EIO : count;
 }
 static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
@@ -927,8 +1027,8 @@ static CLASS_DEVICE_ATTR(lpfc_soft_wwpn, S_IRUGO | S_IWUSR,\
 static ssize_t
 lpfc_soft_wwnn_show(struct class_device *cdev, char *buf)
 {
-       struct Scsi_Host *host = class_to_shost(cdev);
-       struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
+       struct Scsi_Host *shost = class_to_shost(cdev);
+       struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
        return snprintf(buf, PAGE_SIZE, "0x%llx\n",
                        (unsigned long long)phba->cfg_soft_wwnn);
 }
@@ -937,8 +1037,8 @@ lpfc_soft_wwnn_show(struct class_device *cdev, char *buf)
 static ssize_t
 lpfc_soft_wwnn_store(struct class_device *cdev, const char *buf, size_t count)
 {
-       struct Scsi_Host *host = class_to_shost(cdev);
-       struct lpfc_hba *phba = (struct lpfc_hba*)host->hostdata;
+       struct Scsi_Host *shost = class_to_shost(cdev);
+       struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
        unsigned int i, j, cnt=count;
        u8 wwnn[8];
 
@@ -1002,7 +1102,7 @@ MODULE_PARM_DESC(lpfc_sli_mode, "SLI mode selector:"
                 " 2 - select SLI-2 even on SLI-3 capable HBAs,"
                 " 3 - select SLI-3");
 
-LPFC_ATTR_R(npiv_enable, 0, 0, 1, "Enable NPIV functionality");
+LPFC_ATTR_R(enable_npiv, 0, 0, 1, "Enable NPIV functionality");
 
 /*
 # lpfc_nodev_tmo: If set, it will hold all I/O errors on devices that disappear
@@ -1019,90 +1119,75 @@ lpfc_nodev_tmo_show(struct class_device *cdev, char *buf)
 {
        struct Scsi_Host  *shost = class_to_shost(cdev);
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
-       struct lpfc_hba   *phba = vport->phba;
        int val = 0;
-       val = phba->cfg_devloss_tmo;
-       return snprintf(buf, PAGE_SIZE, "%d\n",
-                       phba->cfg_devloss_tmo);
+       val = vport->cfg_devloss_tmo;
+       return snprintf(buf, PAGE_SIZE, "%d\n", vport->cfg_devloss_tmo);
 }
 
 static int
-lpfc_nodev_tmo_init(struct lpfc_hba *phba, int val)
+lpfc_nodev_tmo_init(struct lpfc_vport *vport, int val)
 {
-       static int warned;
-       if (phba->cfg_devloss_tmo !=  LPFC_DEF_DEVLOSS_TMO) {
-               phba->cfg_nodev_tmo = phba->cfg_devloss_tmo;
-               if (!warned && val != LPFC_DEF_DEVLOSS_TMO) {
-                       warned = 1;
-                       lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                                       "%d:0402 Ignoring nodev_tmo module "
-                                       "parameter because devloss_tmo is"
-                                       " set.\n",
-                                       phba->brd_no);
-               }
+       if (vport->cfg_devloss_tmo != LPFC_DEF_DEVLOSS_TMO) {
+               vport->cfg_nodev_tmo = vport->cfg_devloss_tmo;
+               if (val != LPFC_DEF_DEVLOSS_TMO)
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                        "0402 Ignoring nodev_tmo module "
+                                        "parameter because devloss_tmo is "
+                                        "set.\n");
                return 0;
        }
 
        if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
-               phba->cfg_nodev_tmo = val;
-               phba->cfg_devloss_tmo = val;
+               vport->cfg_nodev_tmo = val;
+               vport->cfg_devloss_tmo = val;
                return 0;
        }
-       lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0400 lpfc_nodev_tmo attribute cannot be set to %d, "
-                       "allowed range is [%d, %d]\n",
-                       phba->brd_no, val,
-                       LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
-       phba->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO;
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                        "0400 lpfc_nodev_tmo attribute cannot be set to"
+                        " %d, allowed range is [%d, %d]\n",
+                        val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
+       vport->cfg_nodev_tmo = LPFC_DEF_DEVLOSS_TMO;
        return -EINVAL;
 }
 
 static void
-lpfc_update_rport_devloss_tmo(struct lpfc_hba *phba)
+lpfc_update_rport_devloss_tmo(struct lpfc_vport *vport)
 {
-       struct lpfc_vport *vport;
        struct Scsi_Host  *shost;
        struct lpfc_nodelist  *ndlp;
 
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               shost = lpfc_shost_from_vport(vport);
-               spin_lock_irq(shost->host_lock);
-               list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp)
-                       if (ndlp->rport)
-                               ndlp->rport->dev_loss_tmo =
-                                       phba->cfg_devloss_tmo;
-               spin_unlock_irq(shost->host_lock);
-       }
+       shost = lpfc_shost_from_vport(vport);
+       spin_lock_irq(shost->host_lock);
+       list_for_each_entry(ndlp, &vport->fc_nodes, nlp_listp)
+               if (ndlp->rport)
+                       ndlp->rport->dev_loss_tmo = vport->cfg_devloss_tmo;
+       spin_unlock_irq(shost->host_lock);
 }
 
 static int
-lpfc_nodev_tmo_set(struct lpfc_hba *phba, int val)
+lpfc_nodev_tmo_set(struct lpfc_vport *vport, int val)
 {
-       if (phba->dev_loss_tmo_changed ||
-               (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0401 Ignoring change to nodev_tmo "
-                               "because devloss_tmo is set.\n",
-                               phba->brd_no);
+       if (vport->dev_loss_tmo_changed ||
+           (lpfc_devloss_tmo != LPFC_DEF_DEVLOSS_TMO)) {
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                "0401 Ignoring change to nodev_tmo "
+                                "because devloss_tmo is set.\n");
                return 0;
        }
-
        if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
-               phba->cfg_nodev_tmo = val;
-               phba->cfg_devloss_tmo = val;
-               lpfc_update_rport_devloss_tmo(phba);
+               vport->cfg_nodev_tmo = val;
+               vport->cfg_devloss_tmo = val;
+               lpfc_update_rport_devloss_tmo(vport);
                return 0;
        }
-
-       lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0403 lpfc_nodev_tmo attribute cannot be set to %d, "
-                       "allowed range is [%d, %d]\n",
-                       phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO,
-                       LPFC_MAX_DEVLOSS_TMO);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                        "0403 lpfc_nodev_tmo attribute cannot be set to"
+                        "%d, allowed range is [%d, %d]\n",
+                        val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
        return -EINVAL;
 }
 
-lpfc_param_store(nodev_tmo)
+lpfc_vport_param_store(nodev_tmo)
 
 static CLASS_DEVICE_ATTR(lpfc_nodev_tmo, S_IRUGO | S_IWUSR,
                         lpfc_nodev_tmo_show, lpfc_nodev_tmo_store);
@@ -1116,29 +1201,28 @@ module_param(lpfc_devloss_tmo, int, 0);
 MODULE_PARM_DESC(lpfc_devloss_tmo,
                 "Seconds driver will hold I/O waiting "
                 "for a device to come back");
-lpfc_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO,
-               LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO)
-lpfc_param_show(devloss_tmo)
+lpfc_vport_param_init(devloss_tmo, LPFC_DEF_DEVLOSS_TMO,
+                     LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO)
+lpfc_vport_param_show(devloss_tmo)
 static int
-lpfc_devloss_tmo_set(struct lpfc_hba *phba, int val)
+lpfc_devloss_tmo_set(struct lpfc_vport *vport, int val)
 {
        if (val >= LPFC_MIN_DEVLOSS_TMO && val <= LPFC_MAX_DEVLOSS_TMO) {
-               phba->cfg_nodev_tmo = val;
-               phba->cfg_devloss_tmo = val;
-               phba->dev_loss_tmo_changed = 1;
-               lpfc_update_rport_devloss_tmo(phba);
+               vport->cfg_nodev_tmo = val;
+               vport->cfg_devloss_tmo = val;
+               vport->dev_loss_tmo_changed = 1;
+               lpfc_update_rport_devloss_tmo(vport);
                return 0;
        }
 
-       lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0404 lpfc_devloss_tmo attribute cannot be set to"
-                       " %d, allowed range is [%d, %d]\n",
-                       phba->brd_no, val, LPFC_MIN_DEVLOSS_TMO,
-                       LPFC_MAX_DEVLOSS_TMO);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                        "0404 lpfc_devloss_tmo attribute cannot be set to"
+                        " %d, allowed range is [%d, %d]\n",
+                        val, LPFC_MIN_DEVLOSS_TMO, LPFC_MAX_DEVLOSS_TMO);
        return -EINVAL;
 }
 
-lpfc_param_store(devloss_tmo)
+lpfc_vport_param_store(devloss_tmo)
 static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
        lpfc_devloss_tmo_show, lpfc_devloss_tmo_store);
 
@@ -1160,14 +1244,15 @@ static CLASS_DEVICE_ATTR(lpfc_devloss_tmo, S_IRUGO | S_IWUSR,
 # LOG_LIBDFC                    0x2000     LIBDFC events
 # LOG_ALL_MSG                   0xffff     LOG all messages
 */
-LPFC_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff, "Verbose logging bit-mask");
+LPFC_VPORT_ATTR_HEX_RW(log_verbose, 0x0, 0x0, 0xffff,
+                      "Verbose logging bit-mask");
 
 /*
 # lun_queue_depth:  This parameter is used to limit the number of outstanding
 # commands per FCP LUN. Value range is [1,128]. Default value is 30.
 */
-LPFC_ATTR_R(lun_queue_depth, 30, 1, 128,
-           "Max number of FCP commands we can queue to a specific LUN");
+LPFC_VPORT_ATTR_R(lun_queue_depth, 30, 1, 128,
+                 "Max number of FCP commands we can queue to a specific LUN");
 
 /*
 # hba_queue_depth:  This parameter is used to limit the number of outstanding
@@ -1188,12 +1273,12 @@ LPFC_ATTR_R(hba_queue_depth, 8192, 32, 8192,
 # are allowed to login to each other.
 # Default value of this parameter is 0.
 */
-LPFC_ATTR_R(peer_port_login, 0, 0, 1,
-           "Allow peer ports on the same physical port to login to each "
-           "other.");
+LPFC_VPORT_ATTR_R(peer_port_login, 0, 0, 1,
+                 "Allow peer ports on the same physical port to login to each "
+                 "other.");
 
 /*
-# vport_restrict_login:  This parameter allows/prevents logins
+# restrict_login:  This parameter allows/prevents logins
 # between Virtual Ports and remote initiators.
 # When this parameter is not set (0) Virtual Ports will accept PLOGIs from
 # other initiators and will attempt to PLOGI all remote ports.
@@ -1203,8 +1288,55 @@ LPFC_ATTR_R(peer_port_login, 0, 0, 1,
 # This parameter does not restrict logins to Fabric resident remote ports.
 # Default value of this parameter is 1.
 */
-LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1,
-           "Restrict virtual ports login to remote initiators.");
+static int lpfc_restrict_login = 1;
+module_param(lpfc_restrict_login, int, 0);
+MODULE_PARM_DESC(lpfc_restrict_login,
+                "Restrict virtual ports login to remote initiators.");
+lpfc_vport_param_show(restrict_login);
+
+static int
+lpfc_restrict_login_init(struct lpfc_vport *vport, int val)
+{
+       if (val < 0 || val > 1) {
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                "0449 lpfc_restrict_login attribute cannot "
+                                "be set to %d, allowed range is [0, 1]\n",
+                                val);
+               vport->cfg_restrict_login = 1;
+               return -EINVAL;
+       }
+       if (vport->port_type == LPFC_PHYSICAL_PORT) {
+               vport->cfg_restrict_login = 0;
+               return 0;
+       }
+       vport->cfg_restrict_login = val;
+       return 0;
+}
+
+static int
+lpfc_restrict_login_set(struct lpfc_vport *vport, int val)
+{
+       if (val < 0 || val > 1) {
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                "0450 lpfc_restrict_login attribute cannot "
+                                "be set to %d, allowed range is [0, 1]\n",
+                                val);
+               vport->cfg_restrict_login = 1;
+               return -EINVAL;
+       }
+       if (vport->port_type == LPFC_PHYSICAL_PORT && val != 0) {
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                "0468 lpfc_restrict_login must be 0 for "
+                                "Physical ports.\n");
+               vport->cfg_restrict_login = 0;
+               return 0;
+       }
+       vport->cfg_restrict_login = val;
+       return 0;
+}
+lpfc_vport_param_store(restrict_login);
+static CLASS_DEVICE_ATTR(lpfc_restrict_login, S_IRUGO | S_IWUSR,
+                        lpfc_restrict_login_show, lpfc_restrict_login_store);
 
 /*
 # Some disk devices have a "select ID" or "select Target" capability.
@@ -1223,8 +1355,8 @@ LPFC_ATTR_RW(vport_restrict_login, 1, 0, 1,
 # and will not work across a fabric. Also this parameter will take
 # effect only in the case when ALPA map is not available.)
 */
-LPFC_ATTR_R(scan_down, 1, 0, 1,
-            "Start scanning for devices from highest ALPA to lowest");
+LPFC_VPORT_ATTR_R(scan_down, 1, 0, 1,
+                 "Start scanning for devices from highest ALPA to lowest");
 
 /*
 # lpfc_topology:  link topology for init link
@@ -1255,15 +1387,15 @@ LPFC_ATTR_R(link_speed, 0, 0, 8, "Select link speed");
 # lpfc_fcp_class:  Determines FC class to use for the FCP protocol.
 # Value range is [2,3]. Default value is 3.
 */
-LPFC_ATTR_R(fcp_class, 3, 2, 3,
-            "Select Fibre Channel class of service for FCP sequences");
+LPFC_VPORT_ATTR_R(fcp_class, 3, 2, 3,
+                 "Select Fibre Channel class of service for FCP sequences");
 
 /*
 # lpfc_use_adisc: Use ADISC for FCP rediscovery instead of PLOGI. Value range
 # is [0,1]. Default value is 0.
 */
-LPFC_ATTR_RW(use_adisc, 0, 0, 1,
-            "Use ADISC on rediscovery to authenticate FCP devices");
+LPFC_VPORT_ATTR_RW(use_adisc, 0, 0, 1,
+                  "Use ADISC on rediscovery to authenticate FCP devices");
 
 /*
 # lpfc_ack0: Use ACK0, instead of ACK1 for class 2 acknowledgement. Value
@@ -1315,13 +1447,13 @@ LPFC_ATTR_R(multi_ring_type, FC_LLC_SNAP, 1,
 #       2 = support FDMI with attribute of hostname
 # Value range [0,2]. Default value is 0.
 */
-LPFC_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support");
+LPFC_VPORT_ATTR_RW(fdmi_on, 0, 0, 2, "Enable FDMI support");
 
 /*
 # Specifies the maximum number of ELS cmds we can have outstanding (for
 # discovery). Value range is [1,64]. Default value = 32.
 */
-LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands "
+LPFC_VPORT_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands "
                 "during discovery");
 
 /*
@@ -1329,8 +1461,7 @@ LPFC_ATTR(discovery_threads, 32, 1, 64, "Maximum number of ELS commands "
 # Value range is [0,65535]. Default value is 255.
 # NOTE: The SCSI layer might probe all allowed LUN on some old targets.
 */
-LPFC_ATTR_R(max_luns, 255, 0, 65535,
-            "Maximum allowed LUN");
+LPFC_VPORT_ATTR_R(max_luns, 255, 0, 65535, "Maximum allowed LUN");
 
 /*
 # lpfc_poll_tmo: .Milliseconds driver will wait between polling FCP ring.
@@ -1367,7 +1498,6 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
        &class_device_attr_lpfc_lun_queue_depth,
        &class_device_attr_lpfc_hba_queue_depth,
        &class_device_attr_lpfc_peer_port_login,
-       &class_device_attr_lpfc_vport_restrict_login,
        &class_device_attr_lpfc_nodev_tmo,
        &class_device_attr_lpfc_devloss_tmo,
        &class_device_attr_lpfc_fcp_class,
@@ -1383,9 +1513,8 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
        &class_device_attr_lpfc_multi_ring_type,
        &class_device_attr_lpfc_fdmi_on,
        &class_device_attr_lpfc_max_luns,
-       &class_device_attr_lpfc_npiv_enable,
+       &class_device_attr_lpfc_enable_npiv,
        &class_device_attr_nport_evt_cnt,
-       &class_device_attr_management_version,
        &class_device_attr_board_mode,
        &class_device_attr_max_vpi,
        &class_device_attr_used_vpi,
@@ -1404,6 +1533,28 @@ struct class_device_attribute *lpfc_hba_attrs[] = {
        NULL,
 };
 
+struct class_device_attribute *lpfc_vport_attrs[] = {
+       &class_device_attr_info,
+       &class_device_attr_state,
+       &class_device_attr_num_discovered_ports,
+       &class_device_attr_lpfc_drvr_version,
+
+       &class_device_attr_lpfc_log_verbose,
+       &class_device_attr_lpfc_lun_queue_depth,
+       &class_device_attr_lpfc_nodev_tmo,
+       &class_device_attr_lpfc_devloss_tmo,
+       &class_device_attr_lpfc_hba_queue_depth,
+       &class_device_attr_lpfc_peer_port_login,
+       &class_device_attr_lpfc_restrict_login,
+       &class_device_attr_lpfc_fcp_class,
+       &class_device_attr_lpfc_use_adisc,
+       &class_device_attr_lpfc_fdmi_on,
+       &class_device_attr_lpfc_max_luns,
+       &class_device_attr_nport_evt_cnt,
+       &class_device_attr_npiv_info,
+       NULL,
+};
+
 static ssize_t
 sysfs_ctlreg_write(struct kobject *kobj, struct bin_attribute *bin_attr,
                   char *buf, loff_t off, size_t count)
@@ -2243,7 +2394,6 @@ struct fc_function_template lpfc_vport_transport_functions = {
        .get_starget_port_name = lpfc_get_starget_port_name,
        .show_starget_port_name = 1,
 
-       .issue_fc_host_lip = lpfc_issue_lip,
        .dev_loss_tmo_callbk = lpfc_dev_loss_tmo_callbk,
        .terminate_rport_io = lpfc_terminate_rport_io,
 
@@ -2253,39 +2403,25 @@ struct fc_function_template lpfc_vport_transport_functions = {
 void
 lpfc_get_cfgparam(struct lpfc_hba *phba)
 {
-       lpfc_log_verbose_init(phba, lpfc_log_verbose);
        lpfc_cr_delay_init(phba, lpfc_cr_delay);
        lpfc_cr_count_init(phba, lpfc_cr_count);
        lpfc_multi_ring_support_init(phba, lpfc_multi_ring_support);
        lpfc_multi_ring_rctl_init(phba, lpfc_multi_ring_rctl);
        lpfc_multi_ring_type_init(phba, lpfc_multi_ring_type);
-       lpfc_lun_queue_depth_init(phba, lpfc_lun_queue_depth);
-       lpfc_fcp_class_init(phba, lpfc_fcp_class);
-       lpfc_use_adisc_init(phba, lpfc_use_adisc);
        lpfc_ack0_init(phba, lpfc_ack0);
        lpfc_topology_init(phba, lpfc_topology);
-       lpfc_scan_down_init(phba, lpfc_scan_down);
        lpfc_link_speed_init(phba, lpfc_link_speed);
-       lpfc_fdmi_on_init(phba, lpfc_fdmi_on);
-       lpfc_discovery_threads_init(phba, lpfc_discovery_threads);
-       lpfc_max_luns_init(phba, lpfc_max_luns);
        lpfc_poll_tmo_init(phba, lpfc_poll_tmo);
-       lpfc_peer_port_login_init(phba, lpfc_peer_port_login);
-       lpfc_npiv_enable_init(phba, lpfc_npiv_enable);
-       lpfc_vport_restrict_login_init(phba, lpfc_vport_restrict_login);
+       lpfc_enable_npiv_init(phba, lpfc_enable_npiv);
        lpfc_use_msi_init(phba, lpfc_use_msi);
-       lpfc_devloss_tmo_init(phba, lpfc_devloss_tmo);
-       lpfc_nodev_tmo_init(phba, lpfc_nodev_tmo);
        phba->cfg_poll = lpfc_poll;
        phba->cfg_soft_wwnn = 0L;
        phba->cfg_soft_wwpn = 0L;
-
        /*
         * The total number of segments is the configuration value plus 2
         * since the IOCB need a command and response bde.
         */
        phba->cfg_sg_seg_cnt = LPFC_SG_SEG_CNT + 2;
-
        /*
         * Since the sg_tablesize is module parameter, the sg_dma_buf_size
         * used to create the sg_dma_buf_pool must be dynamically calculated
@@ -2293,9 +2429,24 @@ lpfc_get_cfgparam(struct lpfc_hba *phba)
        phba->cfg_sg_dma_buf_size = sizeof(struct fcp_cmnd) +
                        sizeof(struct fcp_rsp) +
                        (phba->cfg_sg_seg_cnt * sizeof(struct ulp_bde64));
-
-
        lpfc_hba_queue_depth_init(phba, lpfc_hba_queue_depth);
+       return;
+}
 
+void
+lpfc_get_vport_cfgparam(struct lpfc_vport *vport)
+{
+       lpfc_log_verbose_init(vport, lpfc_log_verbose);
+       lpfc_lun_queue_depth_init(vport, lpfc_lun_queue_depth);
+       lpfc_devloss_tmo_init(vport, lpfc_devloss_tmo);
+       lpfc_nodev_tmo_init(vport, lpfc_nodev_tmo);
+       lpfc_peer_port_login_init(vport, lpfc_peer_port_login);
+       lpfc_restrict_login_init(vport, lpfc_restrict_login);
+       lpfc_fcp_class_init(vport, lpfc_fcp_class);
+       lpfc_use_adisc_init(vport, lpfc_use_adisc);
+       lpfc_fdmi_on_init(vport, lpfc_fdmi_on);
+       lpfc_discovery_threads_init(vport, lpfc_discovery_threads);
+       lpfc_max_luns_init(vport, lpfc_max_luns);
+       lpfc_scan_down_init(vport, lpfc_scan_down);
        return;
 }
index e19d1a746586ecb624540e7f0844390ee9d98764..a599e15107104071dd2315829923ea9311cb3bc1 100644 (file)
@@ -40,6 +40,7 @@ void lpfc_reg_vpi(struct lpfc_hba *, uint16_t, uint32_t, LPFC_MBOXQ_t *);
 void lpfc_unreg_vpi(struct lpfc_hba *, uint16_t, LPFC_MBOXQ_t *);
 void lpfc_init_link(struct lpfc_hba *, LPFC_MBOXQ_t *, uint32_t, uint32_t);
 
+struct lpfc_vport *lpfc_find_vport_by_did(struct lpfc_hba *, uint32_t);
 void lpfc_cleanup_rpis(struct lpfc_vport *vport, int remove);
 int lpfc_linkdown(struct lpfc_hba *);
 void lpfc_mbx_cmpl_read_la(struct lpfc_hba *, LPFC_MBOXQ_t *);
@@ -101,7 +102,7 @@ int lpfc_issue_els_scr(struct lpfc_vport *, uint32_t, uint8_t);
 int lpfc_els_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
 int lpfc_ct_free_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
 int lpfc_els_rsp_acc(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
-                    struct lpfc_nodelist *, LPFC_MBOXQ_t *, uint8_t);
+                    struct lpfc_nodelist *, LPFC_MBOXQ_t *);
 int lpfc_els_rsp_reject(struct lpfc_vport *, uint32_t, struct lpfc_iocbq *,
                        struct lpfc_nodelist *, LPFC_MBOXQ_t *);
 int lpfc_els_rsp_adisc_acc(struct lpfc_vport *, struct lpfc_iocbq *,
@@ -117,6 +118,7 @@ void lpfc_els_unsol_event(struct lpfc_hba *, struct lpfc_sli_ring *,
 int lpfc_els_handle_rscn(struct lpfc_vport *);
 void lpfc_els_flush_rscn(struct lpfc_vport *);
 int lpfc_rscn_payload_check(struct lpfc_vport *, uint32_t);
+void lpfc_els_flush_all_cmd(struct lpfc_hba *);
 void lpfc_els_flush_cmd(struct lpfc_vport *);
 int lpfc_els_disc_adisc(struct lpfc_vport *);
 int lpfc_els_disc_plogi(struct lpfc_vport *);
@@ -161,9 +163,11 @@ LPFC_MBOXQ_t *lpfc_mbox_get(struct lpfc_hba *);
 void lpfc_mbox_cmpl_put(struct lpfc_hba *, LPFC_MBOXQ_t *);
 int lpfc_mbox_tmo_val(struct lpfc_hba *, int);
 
-void lpfc_config_hbq(struct lpfc_hba *, struct lpfc_hbq_init *, uint32_t ,
-                    LPFC_MBOXQ_t *);
+void lpfc_config_hbq(struct lpfc_hba *, uint32_t, struct lpfc_hbq_init *,
+       uint32_t , LPFC_MBOXQ_t *);
 struct lpfc_hbq_entry * lpfc_sli_next_hbq_slot(struct lpfc_hba *, uint32_t);
+struct hbq_dmabuf *lpfc_els_hbq_alloc(struct lpfc_hba *);
+void lpfc_els_hbq_free(struct lpfc_hba *, struct hbq_dmabuf *);
 
 int lpfc_mem_alloc(struct lpfc_hba *);
 void lpfc_mem_free(struct lpfc_hba *);
@@ -200,6 +204,7 @@ int lpfc_sli_ringpostbuf_put(struct lpfc_hba *, struct lpfc_sli_ring *,
 struct lpfc_dmabuf *lpfc_sli_ringpostbuf_get(struct lpfc_hba *,
                                             struct lpfc_sli_ring *,
                                             dma_addr_t);
+int lpfc_sli_hbq_count(void);
 int lpfc_sli_hbqbuf_init_hbqs(struct lpfc_hba *, uint32_t);
 int lpfc_sli_hbqbuf_add_hbqs(struct lpfc_hba *, uint32_t);
 void lpfc_sli_hbqbuf_free_all(struct lpfc_hba *);
@@ -207,10 +212,9 @@ struct hbq_dmabuf *lpfc_sli_hbqbuf_find(struct lpfc_hba *, uint32_t);
 int lpfc_sli_hbq_size(void);
 int lpfc_sli_issue_abort_iotag(struct lpfc_hba *, struct lpfc_sli_ring *,
                               struct lpfc_iocbq *);
-int lpfc_sli_sum_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t,
-                     uint64_t, lpfc_ctx_cmd);
-int lpfc_sli_abort_iocb(struct lpfc_hba *, struct lpfc_sli_ring *, uint16_t,
-                       uint64_t, uint32_t, lpfc_ctx_cmd);
+int lpfc_sli_sum_iocb(struct lpfc_vport *, uint16_t, uint64_t, lpfc_ctx_cmd);
+int lpfc_sli_abort_iocb(struct lpfc_vport *, struct lpfc_sli_ring *, uint16_t,
+                       uint64_t, lpfc_ctx_cmd);
 
 void lpfc_mbox_timeout(unsigned long);
 void lpfc_mbox_timeout_handler(struct lpfc_hba *);
@@ -234,8 +238,6 @@ void lpfc_sli_abort_fcp_cmpl(struct lpfc_hba * phba,
                             struct lpfc_iocbq * cmdiocb,
                             struct lpfc_iocbq * rspiocb);
 
-void *lpfc_hbq_alloc(struct lpfc_hba *, int, dma_addr_t *);
-void lpfc_hbq_free(struct lpfc_hba *, void *, dma_addr_t);
 void lpfc_sli_free_hbq(struct lpfc_hba *, struct hbq_dmabuf *);
 
 void *lpfc_mbuf_alloc(struct lpfc_hba *, int, dma_addr_t *);
@@ -248,10 +250,13 @@ const char* lpfc_info(struct Scsi_Host *);
 int lpfc_scan_finished(struct Scsi_Host *, unsigned long);
 
 void lpfc_get_cfgparam(struct lpfc_hba *);
+void lpfc_get_vport_cfgparam(struct lpfc_vport *);
 int lpfc_alloc_sysfs_attr(struct lpfc_vport *);
 void lpfc_free_sysfs_attr(struct lpfc_vport *);
 extern struct class_device_attribute *lpfc_hba_attrs[];
+extern struct class_device_attribute *lpfc_vport_attrs[];
 extern struct scsi_host_template lpfc_template;
+extern struct scsi_host_template lpfc_vport_template;
 extern struct fc_function_template lpfc_transport_functions;
 extern struct fc_function_template lpfc_vport_transport_functions;
 extern int lpfc_sli_mode;
@@ -260,7 +265,7 @@ int  lpfc_vport_symbolic_node_name(struct lpfc_vport *, char *, size_t);
 void lpfc_terminate_rport_io(struct fc_rport *);
 void lpfc_dev_loss_tmo_callbk(struct fc_rport *rport);
 
-struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct fc_vport *);
+struct lpfc_vport *lpfc_create_port(struct lpfc_hba *, int, struct device *);
 int  lpfc_vport_disable(struct fc_vport *fc_vport, bool disable);
 void lpfc_mbx_unreg_vpi(struct lpfc_vport *);
 void destroy_port(struct lpfc_vport *);
@@ -271,6 +276,9 @@ extern void lpfc_debugfs_initialize(struct lpfc_vport *);
 extern void lpfc_debugfs_terminate(struct lpfc_vport *);
 extern void lpfc_debugfs_disc_trc(struct lpfc_vport *, int, char *, uint32_t,
        uint32_t, uint32_t);
+extern void lpfc_debugfs_slow_ring_trc(struct lpfc_hba *, char *, uint32_t,
+       uint32_t, uint32_t);
+extern struct lpfc_hbq_init *lpfc_hbq_defs[];
 
 /* Interface exported by fabric iocb scheduler */
 int lpfc_issue_fabric_iocb(struct lpfc_hba *, struct lpfc_iocbq *);
index ae9d6f385a6c11c6acc0369e7e70a4f3c196dd9e..c701e4d611a9a105e65566405047624900135d29 100644 (file)
@@ -257,6 +257,10 @@ lpfc_ct_free_iocb(struct lpfc_hba *phba, struct lpfc_iocbq *ctiocb)
 {
        struct lpfc_dmabuf *buf_ptr;
 
+       if (ctiocb->context_un.ndlp) {
+               lpfc_nlp_put(ctiocb->context_un.ndlp);
+               ctiocb->context_un.ndlp = NULL;
+       }
        if (ctiocb->context1) {
                buf_ptr = (struct lpfc_dmabuf *) ctiocb->context1;
                lpfc_mbuf_free(phba, buf_ptr->virt, buf_ptr->phys);
@@ -314,6 +318,7 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
        /* Save for completion so we can release these resources */
        geniocb->context1 = (uint8_t *) inp;
        geniocb->context2 = (uint8_t *) outp;
+       geniocb->context_un.ndlp = ndlp;
 
        /* Fill in payload, bp points to frame payload */
        icmd->ulpCommand = CMD_GEN_REQUEST64_CR;
@@ -341,11 +346,11 @@ lpfc_gen_req(struct lpfc_vport *vport, struct lpfc_dmabuf *bmp,
        }
 
        /* Issue GEN REQ IOCB for NPORT <did> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0119 Issue GEN REQ IOCB to NPORT x%x "
-                       "Data: x%x x%x\n", phba->brd_no, vport->vpi,
-                       ndlp->nlp_DID, icmd->ulpIoTag,
-                       vport->port_state);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0119 Issue GEN REQ IOCB to NPORT x%x "
+                        "Data: x%x x%x\n",
+                        ndlp->nlp_DID, icmd->ulpIoTag,
+                        vport->port_state);
        geniocb->iocb_cmpl = cmpl;
        geniocb->drvrTimeout = icmd->ulpTimeout + LPFC_DRVR_TIMEOUT;
        geniocb->vport = vport;
@@ -390,17 +395,19 @@ lpfc_ct_cmd(struct lpfc_vport *vport, struct lpfc_dmabuf *inmp,
        return 0;
 }
 
-static struct lpfc_vport *
+struct lpfc_vport *
 lpfc_find_vport_by_did(struct lpfc_hba *phba, uint32_t did) {
-
        struct lpfc_vport *vport_curr;
+       unsigned long flags;
 
+       spin_lock_irqsave(&phba->hbalock, flags);
        list_for_each_entry(vport_curr, &phba->port_list, listentry) {
-               if ((vport_curr->fc_myDID) &&
-                       (vport_curr->fc_myDID == did))
+               if ((vport_curr->fc_myDID) && (vport_curr->fc_myDID == did)) {
+                       spin_unlock_irqrestore(&phba->hbalock, flags);
                        return vport_curr;
+               }
        }
-
+       spin_unlock_irqrestore(&phba->hbalock, flags);
        return NULL;
 }
 
@@ -449,10 +456,10 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
                         */
                        if ((Did != vport->fc_myDID) &&
                            ((lpfc_find_vport_by_did(phba, Did) == NULL) ||
-                            phba->cfg_peer_port_login)) {
+                            vport->cfg_peer_port_login)) {
                                if ((vport->port_type != LPFC_NPIV_PORT) ||
                                    (vport->fc_flag & FC_RFF_NOT_SUPPORTED) ||
-                                   (!phba->cfg_vport_restrict_login)) {
+                                   (!vport->cfg_restrict_login)) {
                                        ndlp = lpfc_setup_disc_node(vport, Did);
                                        if (ndlp) {
                                                lpfc_debugfs_disc_trc(vport,
@@ -462,14 +469,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
                                                Did, ndlp->nlp_flag,
                                                vport->fc_flag);
 
-                                               lpfc_printf_log(phba, KERN_INFO,
+                                               lpfc_printf_vlog(vport,
+                                                       KERN_INFO,
                                                        LOG_DISCOVERY,
-                                                       "%d (%d):0238 Process "
+                                                       "0238 Process "
                                                        "x%x NameServer Rsp"
                                                        "Data: x%x x%x x%x\n",
-                                                       phba->brd_no,
-                                                       vport->vpi, Did,
-                                                       ndlp->nlp_flag,
+                                                       Did, ndlp->nlp_flag,
                                                        vport->fc_flag,
                                                        vport->fc_rscn_id_cnt);
                                        } else {
@@ -480,14 +486,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
                                                Did, vport->fc_flag,
                                                vport->fc_rscn_id_cnt);
 
-                                               lpfc_printf_log(phba, KERN_INFO,
+                                               lpfc_printf_vlog(vport,
+                                                       KERN_INFO,
                                                        LOG_DISCOVERY,
-                                                       "%d (%d):0239 Skip x%x "
+                                                       "0239 Skip x%x "
                                                        "NameServer Rsp Data: "
                                                        "x%x x%x\n",
-                                                       phba->brd_no,
-                                                       vport->vpi, Did,
-                                                       vport->fc_flag,
+                                                       Did, vport->fc_flag,
                                                        vport->fc_rscn_id_cnt);
                                        }
 
@@ -514,14 +519,13 @@ lpfc_ns_rsp(struct lpfc_vport *vport, struct lpfc_dmabuf *mp, uint32_t Size)
                                                Did, vport->fc_flag,
                                                vport->fc_rscn_id_cnt);
 
-                                               lpfc_printf_log(phba, KERN_INFO,
+                                               lpfc_printf_vlog(vport,
+                                                       KERN_INFO,
                                                        LOG_DISCOVERY,
-                                                       "%d (%d):0245 Skip x%x "
+                                                       "0245 Skip x%x "
                                                        "NameServer Rsp Data: "
                                                        "x%x x%x\n",
-                                                       phba->brd_no,
-                                                       vport->vpi, Did,
-                                                       vport->fc_flag,
+                                                       Did, vport->fc_flag,
                                                        vport->fc_rscn_id_cnt);
                                        }
                                }
@@ -549,8 +553,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        struct lpfc_dmabuf *bmp;
        struct lpfc_dmabuf *outp;
        struct lpfc_sli_ct_request *CTrsp;
+       struct lpfc_nodelist *ndlp;
        int rc;
 
+       /* First save ndlp, before we overwrite it */
+       ndlp = cmdiocb->context_un.ndlp;
+
        /* we pass cmdiocb to state machine which needs rspiocb as well */
        cmdiocb->context_un.rsp_iocb = rspiocb;
 
@@ -568,9 +576,8 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 
 
        if (lpfc_els_chk_latt(vport) || lpfc_error_lost_link(irsp)) {
-               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                               "%d (%d):0216 Link event during NS query\n",
-                               phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                "0216 Link event during NS query\n");
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
                goto out;
        }
@@ -588,46 +595,61 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                                goto out;
                }
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0257 GID_FT Query error: 0x%x 0x%x\n",
-                       phba->brd_no, vport->vpi, irsp->ulpStatus,
-                       vport->fc_ns_retry);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0257 GID_FT Query error: 0x%x 0x%x\n",
+                                irsp->ulpStatus, vport->fc_ns_retry);
        } else {
                /* Good status, continue checking */
                CTrsp = (struct lpfc_sli_ct_request *) outp->virt;
                if (CTrsp->CommandResponse.bits.CmdRsp ==
                    be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) {
-                       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                                       "%d (%d):0208 NameServer Rsp "
-                                       "Data: x%x\n",
-                                       phba->brd_no, vport->vpi,
-                                       vport->fc_flag);
+                       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                        "0208 NameServer Rsp Data: x%x\n",
+                                        vport->fc_flag);
                        lpfc_ns_rsp(vport, outp,
                                    (uint32_t) (irsp->un.genreq64.bdl.bdeSize));
                } else if (CTrsp->CommandResponse.bits.CmdRsp ==
                           be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) {
                        /* NameServer Rsp Error */
-                       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                                       "%d (%d):0240 NameServer Rsp Error "
+                       if ((CTrsp->ReasonCode == SLI_CT_UNABLE_TO_PERFORM_REQ)
+                           && (CTrsp->Explanation == SLI_CT_NO_FC4_TYPES)) {
+                               lpfc_printf_vlog(vport, KERN_INFO,
+                                       LOG_DISCOVERY,
+                                       "0269 No NameServer Entries "
                                        "Data: x%x x%x x%x x%x\n",
-                                       phba->brd_no, vport->vpi,
                                        CTrsp->CommandResponse.bits.CmdRsp,
                                        (uint32_t) CTrsp->ReasonCode,
                                        (uint32_t) CTrsp->Explanation,
                                        vport->fc_flag);
 
-                       lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
+                               lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
+                               "GID_FT no entry  cmd:x%x rsn:x%x exp:x%x",
+                               (uint32_t)CTrsp->CommandResponse.bits.CmdRsp,
+                               (uint32_t) CTrsp->ReasonCode,
+                               (uint32_t) CTrsp->Explanation);
+                       } else {
+                               lpfc_printf_vlog(vport, KERN_INFO,
+                                       LOG_DISCOVERY,
+                                       "0240 NameServer Rsp Error "
+                                       "Data: x%x x%x x%x x%x\n",
+                                       CTrsp->CommandResponse.bits.CmdRsp,
+                                       (uint32_t) CTrsp->ReasonCode,
+                                       (uint32_t) CTrsp->Explanation,
+                                       vport->fc_flag);
+
+                               lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
                                "GID_FT rsp err1  cmd:x%x rsn:x%x exp:x%x",
                                (uint32_t)CTrsp->CommandResponse.bits.CmdRsp,
                                (uint32_t) CTrsp->ReasonCode,
                                (uint32_t) CTrsp->Explanation);
+                       }
+
 
                } else {
                        /* NameServer Rsp Error */
-                       lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                                       "%d (%d):0241 NameServer Rsp Error "
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                       "0241 NameServer Rsp Error "
                                        "Data: x%x x%x x%x x%x\n",
-                                       phba->brd_no, vport->vpi,
                                        CTrsp->CommandResponse.bits.CmdRsp,
                                        (uint32_t) CTrsp->ReasonCode,
                                        (uint32_t) CTrsp->Explanation,
@@ -661,11 +683,12 @@ lpfc_cmpl_ct_cmd_gid_ft(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                lpfc_disc_start(vport);
        }
 out:
+       cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */
        lpfc_ct_free_iocb(phba, cmdiocb);
        return;
 }
 
-void
+static void
 lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        struct lpfc_iocbq *rspiocb)
 {
@@ -695,40 +718,37 @@ lpfc_cmpl_ct_cmd_gff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                    be16_to_cpu(SLI_CT_RESPONSE_FS_ACC)) {
                        if ((fbits & FC4_FEATURE_INIT) &&
                            !(fbits & FC4_FEATURE_TARGET)) {
-                               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                                               "%d (%d):0245 Skip x%x GFF "
-                                               "NameServer Rsp Data: (init) "
-                                               "x%x x%x\n", phba->brd_no,
-                                               vport->vpi, did, fbits,
-                                               vport->fc_rscn_id_cnt);
+                               lpfc_printf_vlog(vport, KERN_INFO,
+                                                LOG_DISCOVERY,
+                                                "0270 Skip x%x GFF "
+                                                "NameServer Rsp Data: (init) "
+                                                "x%x x%x\n", did, fbits,
+                                                vport->fc_rscn_id_cnt);
                                goto out;
                        }
                }
        }
        else {
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0267 NameServer GFF Rsp"
-                               " x%x Error (%d %d) Data: x%x x%x\n",
-                               phba->brd_no, vport->vpi, did,
-                               irsp->ulpStatus, irsp->un.ulpWord[4],
-                               vport->fc_flag, vport->fc_rscn_id_cnt)
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0267 NameServer GFF Rsp "
+                                "x%x Error (%d %d) Data: x%x x%x\n",
+                                did, irsp->ulpStatus, irsp->un.ulpWord[4],
+                                vport->fc_flag, vport->fc_rscn_id_cnt)
        }
 
        /* This is a target port, unregistered port, or the GFF_ID failed */
        ndlp = lpfc_setup_disc_node(vport, did);
        if (ndlp) {
-               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                               "%d (%d):0242 Process x%x GFF "
-                               "NameServer Rsp Data: x%x x%x x%x\n",
-                               phba->brd_no, vport->vpi,
-                               did, ndlp->nlp_flag, vport->fc_flag,
-                               vport->fc_rscn_id_cnt);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                "0242 Process x%x GFF "
+                                "NameServer Rsp Data: x%x x%x x%x\n",
+                                did, ndlp->nlp_flag, vport->fc_flag,
+                                vport->fc_rscn_id_cnt);
        } else {
-               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                               "%d (%d):0243 Skip x%x GFF "
-                               "NameServer Rsp Data: x%x x%x\n",
-                               phba->brd_no, vport->vpi, did,
-                               vport->fc_flag, vport->fc_rscn_id_cnt);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                "0243 Skip x%x GFF "
+                                "NameServer Rsp Data: x%x x%x\n", did,
+                                vport->fc_flag, vport->fc_rscn_id_cnt);
        }
 out:
        /* Link up / RSCN discovery */
@@ -766,10 +786,14 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        struct lpfc_dmabuf *outp;
        IOCB_t *irsp;
        struct lpfc_sli_ct_request *CTrsp;
+       struct lpfc_nodelist *ndlp;
        int cmdcode, rc;
        uint8_t retry;
        uint32_t latt;
 
+       /* First save ndlp, before we overwrite it */
+       ndlp = cmdiocb->context_un.ndlp;
+
        /* we pass cmdiocb to state machine which needs rspiocb as well */
        cmdiocb->context_un.rsp_iocb = rspiocb;
 
@@ -784,22 +808,21 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        latt = lpfc_els_chk_latt(vport);
 
        /* RFT request completes status <ulpStatus> CmdRsp <CmdRsp> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0209 RFT request completes, latt %d, "
-                       "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n",
-                       phba->brd_no, vport->vpi, latt, irsp->ulpStatus,
-                       CTrsp->CommandResponse.bits.CmdRsp,
-                       cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0209 RFT request completes, latt %d, "
+                        "ulpStatus x%x CmdRsp x%x, Context x%x, Tag x%x\n",
+                        latt, irsp->ulpStatus,
+                        CTrsp->CommandResponse.bits.CmdRsp,
+                        cmdiocb->iocb.ulpContext, cmdiocb->iocb.ulpIoTag);
 
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_CT,
                "CT cmd cmpl:     status:x%x/x%x cmd:x%x",
                irsp->ulpStatus, irsp->un.ulpWord[4], cmdcode);
 
        if (irsp->ulpStatus) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                       "%d (%d):0268 NS cmd %x Error (%d %d)\n",
-                       phba->brd_no, vport->vpi, cmdcode,
-                       irsp->ulpStatus, irsp->un.ulpWord[4]);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0268 NS cmd %x Error (%d %d)\n",
+                                cmdcode, irsp->ulpStatus, irsp->un.ulpWord[4]);
 
                if ((irsp->ulpStatus == IOSTAT_LOCAL_REJECT) &&
                        ((irsp->un.ulpWord[4] == IOERR_SLI_DOWN) ||
@@ -811,15 +834,15 @@ lpfc_cmpl_ct_cmd_rft_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        goto out;
 
                retry++;
-               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                               "%d (%d):0216 Retrying NS cmd %x\n",
-                               phba->brd_no, vport->vpi, cmdcode);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                "0216 Retrying NS cmd %x\n", cmdcode);
                rc = lpfc_ns_cmd(vport, cmdcode, retry, 0);
                if (rc == 0)
                        goto out;
        }
 
 out:
+       cmdiocb->context_un.ndlp = ndlp; /* Now restore ndlp for free */
        lpfc_ct_free_iocb(phba, cmdiocb);
        return;
 }
@@ -862,7 +885,7 @@ lpfc_cmpl_ct_cmd_rff_id(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        return;
 }
 
-int
+static int
 lpfc_vport_symbolic_port_name(struct lpfc_vport *vport, char *symbol,
        size_t size)
 {
@@ -957,10 +980,9 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
        }
 
        /* NameServer Req */
-       lpfc_printf_log(phba, KERN_INFO ,LOG_DISCOVERY,
-                       "%d (%d):0236 NameServer Req Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, cmdcode, vport->fc_flag,
-                       vport->fc_rscn_id_cnt);
+       lpfc_printf_vlog(vport, KERN_INFO ,LOG_DISCOVERY,
+                        "0236 NameServer Req Data: x%x x%x x%x\n",
+                        cmdcode, vport->fc_flag, vport->fc_rscn_id_cnt);
 
        bpl = (struct ulp_bde64 *) bmp->virt;
        memset(bpl, 0, sizeof(struct ulp_bde64));
@@ -1059,6 +1081,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
                cmpl = lpfc_cmpl_ct_cmd_rff_id;
                break;
        }
+       lpfc_nlp_get(ndlp);
 
        if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, rsp_size, retry)) {
                /* On success, The cmpl function will free the buffers */
@@ -1069,6 +1092,7 @@ lpfc_ns_cmd(struct lpfc_vport *vport, int cmdcode,
        }
 
        rc=6;
+       lpfc_nlp_put(ndlp);
        lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
 ns_cmd_free_bmp:
        kfree(bmp);
@@ -1077,10 +1101,9 @@ ns_cmd_free_mpvirt:
 ns_cmd_free_mp:
        kfree(mp);
 ns_cmd_exit:
-       lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-               "%d (%d):0266 Issue NameServer Req x%x err %d Data: x%x x%x\n",
-                       phba->brd_no, vport->vpi, cmdcode, rc, vport->fc_flag,
-                       vport->fc_rscn_id_cnt);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                        "0266 Issue NameServer Req x%x err %d Data: x%x x%x\n",
+                        cmdcode, rc, vport->fc_flag, vport->fc_rscn_id_cnt);
        return 1;
 }
 
@@ -1106,12 +1129,11 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                irsp->ulpStatus, irsp->un.ulpWord[4], latt);
 
        if (latt || irsp->ulpStatus) {
-               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                               "%d (%d):0229 FDMI cmd %04x failed, latt = %d "
-                               "ulpStatus: x%x, rid x%x\n",
-                               phba->brd_no, vport->vpi,
-                               be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus,
-                               irsp->un.ulpWord[4]);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                "0229 FDMI cmd %04x failed, latt = %d "
+                                "ulpStatus: x%x, rid x%x\n",
+                                be16_to_cpu(fdmi_cmd), latt, irsp->ulpStatus,
+                                irsp->un.ulpWord[4]);
                lpfc_ct_free_iocb(phba, cmdiocb);
                return;
        }
@@ -1119,10 +1141,9 @@ lpfc_cmpl_ct_cmd_fdmi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        ndlp = lpfc_findnode_did(vport, FDMI_DID);
        if (fdmi_rsp == be16_to_cpu(SLI_CT_RESPONSE_FS_RJT)) {
                /* FDMI rsp failed */
-               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                               "%d (%d):0220 FDMI rsp failed Data: x%x\n",
-                               phba->brd_no, vport->vpi,
-                               be16_to_cpu(fdmi_cmd));
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                "0220 FDMI rsp failed Data: x%x\n",
+                                be16_to_cpu(fdmi_cmd));
        }
 
        switch (be16_to_cpu(fdmi_cmd)) {
@@ -1185,11 +1206,9 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
        INIT_LIST_HEAD(&bmp->list);
 
        /* FDMI request */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0218 FDMI Request Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, vport->fc_flag,
-                       vport->port_state, cmdcode);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0218 FDMI Request Data: x%x x%x x%x\n",
+                        vport->fc_flag, vport->port_state, cmdcode);
        CtReq = (struct lpfc_sli_ct_request *) mp->virt;
 
        memset(CtReq, 0, sizeof(struct lpfc_sli_ct_request));
@@ -1449,7 +1468,7 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
                        pab->ab.EntryCnt++;
                        size += FOURBYTES + len;
 
-                       if (phba->cfg_fdmi_on == 2) {
+                       if (vport->cfg_fdmi_on == 2) {
                                /* #6 Port attribute entry */
                                ae = (ATTRIBUTE_ENTRY *) ((uint8_t *) pab +
                                                          size);
@@ -1499,10 +1518,12 @@ lpfc_fdmi_cmd(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp, int cmdcode)
        bpl->tus.w = le32_to_cpu(bpl->tus.w);
 
        cmpl = lpfc_cmpl_ct_cmd_fdmi;
+       lpfc_nlp_get(ndlp);
 
        if (!lpfc_ct_cmd(vport, mp, bmp, ndlp, cmpl, FC_MAX_NS_RSP, 0))
                return 0;
 
+       lpfc_nlp_put(ndlp);
        lpfc_mbuf_free(phba, bmp->virt, bmp->phys);
 fdmi_cmd_free_bmp:
        kfree(bmp);
@@ -1512,9 +1533,9 @@ fdmi_cmd_free_mp:
        kfree(mp);
 fdmi_cmd_exit:
        /* Issue FDMI request failed */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0244 Issue FDMI request failed Data: x%x\n",
-                       phba->brd_no, vport->vpi, cmdcode);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0244 Issue FDMI request failed Data: x%x\n",
+                        cmdcode);
        return 1;
 }
 
index 673cfe11cc2be74d67588bfd01e140ba6ebc8e6e..2e3c01bebed6801541ffab6c63c9c0a2f0f50d13 100644 (file)
  * lpfc_debugfs_mask_disc_trc=Y  Where Y is an event mask as defined in
  *                               lpfc_debugfs.h .
  */
-static int lpfc_debugfs_enable = 0;
+static int lpfc_debugfs_enable = 1;
 module_param(lpfc_debugfs_enable, int, 0);
 MODULE_PARM_DESC(lpfc_debugfs_enable, "Enable debugfs services");
 
-static int lpfc_debugfs_max_disc_trc = 0;  /* This MUST be a power of 2 */
+/* This MUST be a power of 2 */
+static int lpfc_debugfs_max_disc_trc = 0;
 module_param(lpfc_debugfs_max_disc_trc, int, 0);
 MODULE_PARM_DESC(lpfc_debugfs_max_disc_trc,
        "Set debugfs discovery trace depth");
 
+/* This MUST be a power of 2 */
+static int lpfc_debugfs_max_slow_ring_trc = 0;
+module_param(lpfc_debugfs_max_slow_ring_trc, int, 0);
+MODULE_PARM_DESC(lpfc_debugfs_max_slow_ring_trc,
+       "Set debugfs slow ring trace depth");
+
 static int lpfc_debugfs_mask_disc_trc = 0;
 module_param(lpfc_debugfs_mask_disc_trc, int, 0);
 MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc,
@@ -87,28 +94,34 @@ MODULE_PARM_DESC(lpfc_debugfs_mask_disc_trc,
 
 #include <linux/debugfs.h>
 
-/* size of discovery_trace output line */
-#define LPFC_DISC_TRC_ENTRY_SIZE 80
+/* size of output line, for discovery_trace and slow_ring_trace */
+#define LPFC_DEBUG_TRC_ENTRY_SIZE 100
 
 /* nodelist output buffer size */
 #define LPFC_NODELIST_SIZE 8192
 #define LPFC_NODELIST_ENTRY_SIZE 120
 
+/* dumpslim output buffer size */
+#define LPFC_DUMPSLIM_SIZE 4096
+
+/* hbqinfo output buffer size */
+#define LPFC_HBQINFO_SIZE 8192
+
 struct lpfc_debug {
        char *buffer;
        int  len;
 };
 
-atomic_t lpfc_debugfs_disc_trc_cnt = ATOMIC_INIT(0);
-unsigned long lpfc_debugfs_start_time = 0L;
+static atomic_t lpfc_debugfs_seq_trc_cnt = ATOMIC_INIT(0);
+static unsigned long lpfc_debugfs_start_time = 0L;
 
 static int
 lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
 {
        int i, index, len, enable;
        uint32_t ms;
-       struct lpfc_disc_trc *dtp;
-       char buffer[80];
+       struct lpfc_debugfs_trc *dtp;
+       char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE];
 
 
        enable = lpfc_debugfs_enable;
@@ -122,7 +135,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
                if (!dtp->fmt)
                        continue;
                ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
-               snprintf(buffer, 80, "%010d:%010d ms:%s\n",
+               snprintf(buffer,
+                       LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
                        dtp->seq_cnt, ms, dtp->fmt);
                len +=  snprintf(buf+len, size-len, buffer,
                        dtp->data1, dtp->data2, dtp->data3);
@@ -132,7 +146,8 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
                if (!dtp->fmt)
                        continue;
                ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
-               snprintf(buffer, 80, "%010d:%010d ms:%s\n",
+               snprintf(buffer,
+                       LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
                        dtp->seq_cnt, ms, dtp->fmt);
                len +=  snprintf(buf+len, size-len, buffer,
                        dtp->data1, dtp->data2, dtp->data3);
@@ -142,6 +157,236 @@ lpfc_debugfs_disc_trc_data(struct lpfc_vport *vport, char *buf, int size)
        return len;
 }
 
+static int
+lpfc_debugfs_slow_ring_trc_data(struct lpfc_hba *phba, char *buf, int size)
+{
+       int i, index, len, enable;
+       uint32_t ms;
+       struct lpfc_debugfs_trc *dtp;
+       char buffer[LPFC_DEBUG_TRC_ENTRY_SIZE];
+
+
+       enable = lpfc_debugfs_enable;
+       lpfc_debugfs_enable = 0;
+
+       len = 0;
+       index = (atomic_read(&phba->slow_ring_trc_cnt) + 1) &
+               (lpfc_debugfs_max_slow_ring_trc - 1);
+       for (i = index; i < lpfc_debugfs_max_slow_ring_trc; i++) {
+               dtp = phba->slow_ring_trc + i;
+               if (!dtp->fmt)
+                       continue;
+               ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
+               snprintf(buffer,
+                       LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
+                       dtp->seq_cnt, ms, dtp->fmt);
+               len +=  snprintf(buf+len, size-len, buffer,
+                       dtp->data1, dtp->data2, dtp->data3);
+       }
+       for (i = 0; i < index; i++) {
+               dtp = phba->slow_ring_trc + i;
+               if (!dtp->fmt)
+                       continue;
+               ms = jiffies_to_msecs(dtp->jif - lpfc_debugfs_start_time);
+               snprintf(buffer,
+                       LPFC_DEBUG_TRC_ENTRY_SIZE, "%010d:%010d ms:%s\n",
+                       dtp->seq_cnt, ms, dtp->fmt);
+               len +=  snprintf(buf+len, size-len, buffer,
+                       dtp->data1, dtp->data2, dtp->data3);
+       }
+
+       lpfc_debugfs_enable = enable;
+       return len;
+}
+
+static int lpfc_debugfs_last_hbq = -1;
+
+static int
+lpfc_debugfs_hbqinfo_data(struct lpfc_hba *phba, char *buf, int size)
+{
+       int len = 0;
+       int cnt, i, j, found, posted, low;
+       uint32_t phys, raw_index, getidx;
+       struct lpfc_hbq_init *hip;
+       struct hbq_s *hbqs;
+       struct lpfc_hbq_entry *hbqe;
+       struct lpfc_dmabuf *d_buf;
+       struct hbq_dmabuf *hbq_buf;
+
+       cnt = LPFC_HBQINFO_SIZE;
+       spin_lock_irq(&phba->hbalock);
+
+       /* toggle between multiple hbqs, if any */
+       i = lpfc_sli_hbq_count();
+       if (i > 1) {
+                lpfc_debugfs_last_hbq++;
+                if (lpfc_debugfs_last_hbq >= i)
+                       lpfc_debugfs_last_hbq = 0;
+       }
+       else
+               lpfc_debugfs_last_hbq = 0;
+
+       i = lpfc_debugfs_last_hbq;
+
+       len +=  snprintf(buf+len, size-len, "HBQ %d Info\n", i);
+
+       hbqs =  &phba->hbqs[i];
+       posted = 0;
+       list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list)
+               posted++;
+
+       hip =  lpfc_hbq_defs[i];
+       len +=  snprintf(buf+len, size-len,
+               "idx:%d prof:%d rn:%d bufcnt:%d icnt:%d acnt:%d posted %d\n",
+               hip->hbq_index, hip->profile, hip->rn,
+               hip->buffer_count, hip->init_count, hip->add_count, posted);
+
+       raw_index = phba->hbq_get[i];
+       getidx = le32_to_cpu(raw_index);
+       len +=  snprintf(buf+len, size-len,
+               "entrys:%d Put:%d nPut:%d localGet:%d hbaGet:%d\n",
+               hbqs->entry_count, hbqs->hbqPutIdx, hbqs->next_hbqPutIdx,
+               hbqs->local_hbqGetIdx, getidx);
+
+       hbqe = (struct lpfc_hbq_entry *) phba->hbqs[i].hbq_virt;
+       for (j=0; j<hbqs->entry_count; j++) {
+               len +=  snprintf(buf+len, size-len,
+                       "%03d: %08x %04x %05x ", j,
+                       hbqe->bde.addrLow, hbqe->bde.tus.w, hbqe->buffer_tag);
+
+               i = 0;
+               found = 0;
+
+               /* First calculate if slot has an associated posted buffer */
+               low = hbqs->hbqPutIdx - posted;
+               if (low >= 0) {
+                       if ((j >= hbqs->hbqPutIdx) || (j < low)) {
+                               len +=  snprintf(buf+len, size-len, "Unused\n");
+                               goto skipit;
+                       }
+               }
+               else {
+                       if ((j >= hbqs->hbqPutIdx) &&
+                               (j < (hbqs->entry_count+low))) {
+                               len +=  snprintf(buf+len, size-len, "Unused\n");
+                               goto skipit;
+                       }
+               }
+
+               /* Get the Buffer info for the posted buffer */
+               list_for_each_entry(d_buf, &hbqs->hbq_buffer_list, list) {
+                       hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
+                       phys = ((uint64_t)hbq_buf->dbuf.phys & 0xffffffff);
+                       if (phys == hbqe->bde.addrLow) {
+                               len +=  snprintf(buf+len, size-len,
+                                       "Buf%d: %p %06x\n", i,
+                                       hbq_buf->dbuf.virt, hbq_buf->tag);
+                               found = 1;
+                               break;
+                       }
+                       i++;
+               }
+               if (!found) {
+                       len +=  snprintf(buf+len, size-len, "No DMAinfo?\n");
+               }
+skipit:
+               hbqe++;
+               if (len > LPFC_HBQINFO_SIZE - 54)
+                       break;
+       }
+       spin_unlock_irq(&phba->hbalock);
+       return len;
+}
+
+static int
+lpfc_debugfs_dumpslim_data(struct lpfc_hba *phba, char *buf, int size)
+{
+       int len = 0;
+       int cnt, i, off;
+       uint32_t word0, word1, word2, word3;
+       uint32_t *ptr;
+       struct lpfc_pgp *pgpp;
+       struct lpfc_sli *psli = &phba->sli;
+       struct lpfc_sli_ring *pring;
+
+       cnt = LPFC_DUMPSLIM_SIZE;
+       off = 0;
+       spin_lock_irq(&phba->hbalock);
+
+       len +=  snprintf(buf+len, size-len, "SLIM Mailbox\n");
+       ptr = (uint32_t *)phba->slim2p;
+       i = sizeof(MAILBOX_t);
+       while (i > 0) {
+               len +=  snprintf(buf+len, size-len,
+               "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+               off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
+               *(ptr+5), *(ptr+6), *(ptr+7));
+               ptr += 8;
+               i -= (8 * sizeof(uint32_t));
+               off += (8 * sizeof(uint32_t));
+       }
+
+       len +=  snprintf(buf+len, size-len, "SLIM PCB\n");
+       ptr = (uint32_t *)&phba->slim2p->pcb;
+       i = sizeof(PCB_t);
+       while (i > 0) {
+               len +=  snprintf(buf+len, size-len,
+               "%08x: %08x %08x %08x %08x %08x %08x %08x %08x\n",
+               off, *ptr, *(ptr+1), *(ptr+2), *(ptr+3), *(ptr+4),
+               *(ptr+5), *(ptr+6), *(ptr+7));
+               ptr += 8;
+               i -= (8 * sizeof(uint32_t));
+               off += (8 * sizeof(uint32_t));
+       }
+
+       pgpp = (struct lpfc_pgp *)&phba->slim2p->mbx.us.s3_pgp.port;
+       pring = &psli->ring[0];
+       len +=  snprintf(buf+len, size-len,
+               "Ring 0: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x)  "
+               "RSP PutInx:%d Max:%d\n",
+               pgpp->cmdGetInx, pring->numCiocb,
+               pring->next_cmdidx, pring->local_getidx, pring->flag,
+               pgpp->rspPutInx, pring->numRiocb);
+       pgpp++;
+
+       pring = &psli->ring[1];
+       len +=  snprintf(buf+len, size-len,
+               "Ring 1: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x)  "
+               "RSP PutInx:%d Max:%d\n",
+               pgpp->cmdGetInx, pring->numCiocb,
+               pring->next_cmdidx, pring->local_getidx, pring->flag,
+               pgpp->rspPutInx, pring->numRiocb);
+       pgpp++;
+
+       pring = &psli->ring[2];
+       len +=  snprintf(buf+len, size-len,
+               "Ring 2: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x)  "
+               "RSP PutInx:%d Max:%d\n",
+               pgpp->cmdGetInx, pring->numCiocb,
+               pring->next_cmdidx, pring->local_getidx, pring->flag,
+               pgpp->rspPutInx, pring->numRiocb);
+       pgpp++;
+
+       pring = &psli->ring[3];
+       len +=  snprintf(buf+len, size-len,
+               "Ring 3: CMD GetInx:%d (Max:%d Next:%d Local:%d flg:x%x)  "
+               "RSP PutInx:%d Max:%d\n",
+               pgpp->cmdGetInx, pring->numCiocb,
+               pring->next_cmdidx, pring->local_getidx, pring->flag,
+               pgpp->rspPutInx, pring->numRiocb);
+
+
+       ptr = (uint32_t *)&phba->slim2p->mbx.us.s3_pgp.hbq_get;
+       word0 = readl(phba->HAregaddr);
+       word1 = readl(phba->CAregaddr);
+       word2 = readl(phba->HSregaddr);
+       word3 = readl(phba->HCregaddr);
+       len +=  snprintf(buf+len, size-len, "HA:%08x CA:%08x HS:%08x HC:%08x\n",
+       word0, word1, word2, word3);
+       spin_unlock_irq(&phba->hbalock);
+       return len;
+}
+
 static int
 lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
 {
@@ -204,7 +449,7 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
                len +=  snprintf(buf+len, size-len, "RPI:%03d flag:x%08x ",
                        ndlp->nlp_rpi, ndlp->nlp_flag);
                if (!ndlp->nlp_type)
-                       len +=  snprintf(buf+len, size-len, "UNKNOWN_TYPE");
+                       len +=  snprintf(buf+len, size-len, "UNKNOWN_TYPE ");
                if (ndlp->nlp_type & NLP_FC_NODE)
                        len +=  snprintf(buf+len, size-len, "FC_NODE ");
                if (ndlp->nlp_type & NLP_FABRIC)
@@ -213,7 +458,9 @@ lpfc_debugfs_nodelist_data(struct lpfc_vport *vport, char *buf, int size)
                        len +=  snprintf(buf+len, size-len, "FCP_TGT sid:%d ",
                                ndlp->nlp_sid);
                if (ndlp->nlp_type & NLP_FCP_INITIATOR)
-                       len +=  snprintf(buf+len, size-len, "FCP_INITIATOR");
+                       len +=  snprintf(buf+len, size-len, "FCP_INITIATOR ");
+               len += snprintf(buf+len, size-len, "refcnt:%x",
+                       atomic_read(&ndlp->kref.refcount));
                len +=  snprintf(buf+len, size-len, "\n");
        }
        spin_unlock_irq(shost->host_lock);
@@ -227,7 +474,7 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt,
        uint32_t data1, uint32_t data2, uint32_t data3)
 {
 #ifdef CONFIG_LPFC_DEBUG_FS
-       struct lpfc_disc_trc *dtp;
+       struct lpfc_debugfs_trc *dtp;
        int index;
 
        if (!(lpfc_debugfs_mask_disc_trc & mask))
@@ -244,7 +491,32 @@ lpfc_debugfs_disc_trc(struct lpfc_vport *vport, int mask, char *fmt,
        dtp->data1 = data1;
        dtp->data2 = data2;
        dtp->data3 = data3;
-       dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_disc_trc_cnt);
+       dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt);
+       dtp->jif = jiffies;
+#endif
+       return;
+}
+
+inline void
+lpfc_debugfs_slow_ring_trc(struct lpfc_hba *phba, char *fmt,
+       uint32_t data1, uint32_t data2, uint32_t data3)
+{
+#ifdef CONFIG_LPFC_DEBUG_FS
+       struct lpfc_debugfs_trc *dtp;
+       int index;
+
+       if (!lpfc_debugfs_enable || !lpfc_debugfs_max_slow_ring_trc ||
+               !phba || !phba->slow_ring_trc)
+               return;
+
+       index = atomic_inc_return(&phba->slow_ring_trc_cnt) &
+               (lpfc_debugfs_max_slow_ring_trc - 1);
+       dtp = phba->slow_ring_trc + index;
+       dtp->fmt = fmt;
+       dtp->data1 = data1;
+       dtp->data2 = data2;
+       dtp->data3 = data3;
+       dtp->seq_cnt = atomic_inc_return(&lpfc_debugfs_seq_trc_cnt);
        dtp->jif = jiffies;
 #endif
        return;
@@ -269,7 +541,7 @@ lpfc_debugfs_disc_trc_open(struct inode *inode, struct file *file)
                goto out;
 
        /* Round to page boundry */
-       size =  (lpfc_debugfs_max_disc_trc * LPFC_DISC_TRC_ENTRY_SIZE);
+       size =  (lpfc_debugfs_max_disc_trc * LPFC_DEBUG_TRC_ENTRY_SIZE);
        size = PAGE_ALIGN(size);
 
        debug->buffer = kmalloc(size, GFP_KERNEL);
@@ -286,6 +558,95 @@ out:
        return rc;
 }
 
+static int
+lpfc_debugfs_slow_ring_trc_open(struct inode *inode, struct file *file)
+{
+       struct lpfc_hba *phba = inode->i_private;
+       struct lpfc_debug *debug;
+       int size;
+       int rc = -ENOMEM;
+
+       if (!lpfc_debugfs_max_slow_ring_trc) {
+                rc = -ENOSPC;
+               goto out;
+       }
+
+       debug = kmalloc(sizeof(*debug), GFP_KERNEL);
+       if (!debug)
+               goto out;
+
+       /* Round to page boundry */
+       size =  (lpfc_debugfs_max_slow_ring_trc * LPFC_DEBUG_TRC_ENTRY_SIZE);
+       size = PAGE_ALIGN(size);
+
+       debug->buffer = kmalloc(size, GFP_KERNEL);
+       if (!debug->buffer) {
+               kfree(debug);
+               goto out;
+       }
+
+       debug->len = lpfc_debugfs_slow_ring_trc_data(phba, debug->buffer, size);
+       file->private_data = debug;
+
+       rc = 0;
+out:
+       return rc;
+}
+
+static int
+lpfc_debugfs_hbqinfo_open(struct inode *inode, struct file *file)
+{
+       struct lpfc_hba *phba = inode->i_private;
+       struct lpfc_debug *debug;
+       int rc = -ENOMEM;
+
+       debug = kmalloc(sizeof(*debug), GFP_KERNEL);
+       if (!debug)
+               goto out;
+
+       /* Round to page boundry */
+       debug->buffer = kmalloc(LPFC_HBQINFO_SIZE, GFP_KERNEL);
+       if (!debug->buffer) {
+               kfree(debug);
+               goto out;
+       }
+
+       debug->len = lpfc_debugfs_hbqinfo_data(phba, debug->buffer,
+               LPFC_HBQINFO_SIZE);
+       file->private_data = debug;
+
+       rc = 0;
+out:
+       return rc;
+}
+
+static int
+lpfc_debugfs_dumpslim_open(struct inode *inode, struct file *file)
+{
+       struct lpfc_hba *phba = inode->i_private;
+       struct lpfc_debug *debug;
+       int rc = -ENOMEM;
+
+       debug = kmalloc(sizeof(*debug), GFP_KERNEL);
+       if (!debug)
+               goto out;
+
+       /* Round to page boundry */
+       debug->buffer = kmalloc(LPFC_DUMPSLIM_SIZE, GFP_KERNEL);
+       if (!debug->buffer) {
+               kfree(debug);
+               goto out;
+       }
+
+       debug->len = lpfc_debugfs_dumpslim_data(phba, debug->buffer,
+               LPFC_DUMPSLIM_SIZE);
+       file->private_data = debug;
+
+       rc = 0;
+out:
+       return rc;
+}
+
 static int
 lpfc_debugfs_nodelist_open(struct inode *inode, struct file *file)
 {
@@ -372,6 +733,33 @@ static struct file_operations lpfc_debugfs_op_nodelist = {
        .release =      lpfc_debugfs_release,
 };
 
+#undef lpfc_debugfs_op_hbqinfo
+static struct file_operations lpfc_debugfs_op_hbqinfo = {
+       .owner =        THIS_MODULE,
+       .open =         lpfc_debugfs_hbqinfo_open,
+       .llseek =       lpfc_debugfs_lseek,
+       .read =         lpfc_debugfs_read,
+       .release =      lpfc_debugfs_release,
+};
+
+#undef lpfc_debugfs_op_dumpslim
+static struct file_operations lpfc_debugfs_op_dumpslim = {
+       .owner =        THIS_MODULE,
+       .open =         lpfc_debugfs_dumpslim_open,
+       .llseek =       lpfc_debugfs_lseek,
+       .read =         lpfc_debugfs_read,
+       .release =      lpfc_debugfs_release,
+};
+
+#undef lpfc_debugfs_op_slow_ring_trc
+static struct file_operations lpfc_debugfs_op_slow_ring_trc = {
+       .owner =        THIS_MODULE,
+       .open =         lpfc_debugfs_slow_ring_trc_open,
+       .llseek =       lpfc_debugfs_lseek,
+       .read =         lpfc_debugfs_read,
+       .release =      lpfc_debugfs_release,
+};
+
 static struct dentry *lpfc_debugfs_root = NULL;
 static atomic_t lpfc_debugfs_hba_count;
 #endif
@@ -387,60 +775,146 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
        if (!lpfc_debugfs_enable)
                return;
 
-       if (lpfc_debugfs_max_disc_trc) {
-               num = lpfc_debugfs_max_disc_trc - 1;
-               if (num & lpfc_debugfs_max_disc_trc) {
-                       /* Change to be a power of 2 */
-                       num = lpfc_debugfs_max_disc_trc;
-                       i = 0;
-                       while (num > 1) {
-                               num = num >> 1;
-                               i++;
-                       }
-                       lpfc_debugfs_max_disc_trc = (1 << i);
-                       printk(KERN_ERR
-                               "lpfc_debugfs_max_disc_trc changed to %d\n",
-                               lpfc_debugfs_max_disc_trc);
-               }
-       }
-
+       /* Setup lpfc root directory */
        if (!lpfc_debugfs_root) {
                lpfc_debugfs_root = debugfs_create_dir("lpfc", NULL);
                atomic_set(&lpfc_debugfs_hba_count, 0);
-               if (!lpfc_debugfs_root)
+               if (!lpfc_debugfs_root) {
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                        "0409 Cannot create debugfs root\n");
                        goto debug_failed;
+               }
        }
+       if (!lpfc_debugfs_start_time)
+               lpfc_debugfs_start_time = jiffies;
 
+       /* Setup lpfcX directory for specific HBA */
        snprintf(name, sizeof(name), "lpfc%d", phba->brd_no);
        if (!phba->hba_debugfs_root) {
                phba->hba_debugfs_root =
                        debugfs_create_dir(name, lpfc_debugfs_root);
-               if (!phba->hba_debugfs_root)
+               if (!phba->hba_debugfs_root) {
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                        "0409 Cannot create debugfs hba\n");
                        goto debug_failed;
+               }
                atomic_inc(&lpfc_debugfs_hba_count);
                atomic_set(&phba->debugfs_vport_count, 0);
+
+               /* Setup hbqinfo */
+               snprintf(name, sizeof(name), "hbqinfo");
+               phba->debug_hbqinfo =
+                       debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+                                phba->hba_debugfs_root,
+                                phba, &lpfc_debugfs_op_hbqinfo);
+               if (!phba->debug_hbqinfo) {
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                               "0409 Cannot create debugfs hbqinfo\n");
+                       goto debug_failed;
+               }
+
+               /* Setup dumpslim */
+               snprintf(name, sizeof(name), "dumpslim");
+               phba->debug_dumpslim =
+                       debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+                                phba->hba_debugfs_root,
+                                phba, &lpfc_debugfs_op_dumpslim);
+               if (!phba->debug_dumpslim) {
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                               "0409 Cannot create debugfs dumpslim\n");
+                       goto debug_failed;
+               }
+
+               /* Setup slow ring trace */
+               if (lpfc_debugfs_max_slow_ring_trc) {
+                       num = lpfc_debugfs_max_slow_ring_trc - 1;
+                       if (num & lpfc_debugfs_max_slow_ring_trc) {
+                               /* Change to be a power of 2 */
+                               num = lpfc_debugfs_max_slow_ring_trc;
+                               i = 0;
+                               while (num > 1) {
+                                       num = num >> 1;
+                                       i++;
+                               }
+                               lpfc_debugfs_max_slow_ring_trc = (1 << i);
+                               printk(KERN_ERR
+                                      "lpfc_debugfs_max_disc_trc changed to "
+                                      "%d\n", lpfc_debugfs_max_disc_trc);
+                       }
+               }
+
+
+               snprintf(name, sizeof(name), "slow_ring_trace");
+               phba->debug_slow_ring_trc =
+                       debugfs_create_file(name, S_IFREG|S_IRUGO|S_IWUSR,
+                                phba->hba_debugfs_root,
+                                phba, &lpfc_debugfs_op_slow_ring_trc);
+               if (!phba->debug_slow_ring_trc) {
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                        "0409 Cannot create debugfs "
+                                        "slow_ring_trace\n");
+                       goto debug_failed;
+               }
+               if (!phba->slow_ring_trc) {
+                       phba->slow_ring_trc = kmalloc(
+                               (sizeof(struct lpfc_debugfs_trc) *
+                               lpfc_debugfs_max_slow_ring_trc),
+                               GFP_KERNEL);
+                       if (!phba->slow_ring_trc) {
+                               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                                "0409 Cannot create debugfs "
+                                                "slow_ring buffer\n");
+                               goto debug_failed;
+                       }
+                       atomic_set(&phba->slow_ring_trc_cnt, 0);
+                       memset(phba->slow_ring_trc, 0,
+                               (sizeof(struct lpfc_debugfs_trc) *
+                               lpfc_debugfs_max_slow_ring_trc));
+               }
        }
 
        snprintf(name, sizeof(name), "vport%d", vport->vpi);
        if (!vport->vport_debugfs_root) {
                vport->vport_debugfs_root =
                        debugfs_create_dir(name, phba->hba_debugfs_root);
-               if (!vport->vport_debugfs_root)
+               if (!vport->vport_debugfs_root) {
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                        "0409 Cant create debugfs");
                        goto debug_failed;
+               }
                atomic_inc(&phba->debugfs_vport_count);
        }
 
-       if (!lpfc_debugfs_start_time)
-               lpfc_debugfs_start_time = jiffies;
+       if (lpfc_debugfs_max_disc_trc) {
+               num = lpfc_debugfs_max_disc_trc - 1;
+               if (num & lpfc_debugfs_max_disc_trc) {
+                       /* Change to be a power of 2 */
+                       num = lpfc_debugfs_max_disc_trc;
+                       i = 0;
+                       while (num > 1) {
+                               num = num >> 1;
+                               i++;
+                       }
+                       lpfc_debugfs_max_disc_trc = (1 << i);
+                       printk(KERN_ERR
+                              "lpfc_debugfs_max_disc_trc changed to %d\n",
+                              lpfc_debugfs_max_disc_trc);
+               }
+       }
 
        vport->disc_trc = kmalloc(
-               (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc),
+               (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc),
                GFP_KERNEL);
 
-       if (!vport->disc_trc)
+       if (!vport->disc_trc) {
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                "0409 Cannot create debugfs disc trace "
+                                "buffer\n");
                goto debug_failed;
+       }
+       atomic_set(&vport->disc_trc_cnt, 0);
        memset(vport->disc_trc, 0,
-               (sizeof(struct lpfc_disc_trc) * lpfc_debugfs_max_disc_trc));
+               (sizeof(struct lpfc_debugfs_trc) * lpfc_debugfs_max_disc_trc));
 
        snprintf(name, sizeof(name), "discovery_trace");
        vport->debug_disc_trc =
@@ -448,9 +922,9 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                                 vport->vport_debugfs_root,
                                 vport, &lpfc_debugfs_op_disc_trc);
        if (!vport->debug_disc_trc) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0409 Cannot create debugfs",
-                               phba->brd_no);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                "0409 Cannot create debugfs "
+                                "discovery_trace\n");
                goto debug_failed;
        }
        snprintf(name, sizeof(name), "nodelist");
@@ -459,9 +933,8 @@ lpfc_debugfs_initialize(struct lpfc_vport *vport)
                                 vport->vport_debugfs_root,
                                 vport, &lpfc_debugfs_op_nodelist);
        if (!vport->debug_nodelist) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0409 Cannot create debugfs",
-                               phba->brd_no);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT,
+                                "0409 Cant create debugfs nodelist");
                goto debug_failed;
        }
 debug_failed:
@@ -488,21 +961,45 @@ lpfc_debugfs_terminate(struct lpfc_vport *vport)
                debugfs_remove(vport->debug_nodelist); /* nodelist */
                vport->debug_nodelist = NULL;
        }
+
        if (vport->vport_debugfs_root) {
                debugfs_remove(vport->vport_debugfs_root); /* vportX */
                vport->vport_debugfs_root = NULL;
                atomic_dec(&phba->debugfs_vport_count);
        }
        if (atomic_read(&phba->debugfs_vport_count) == 0) {
-               debugfs_remove(vport->phba->hba_debugfs_root); /* lpfcX */
-               vport->phba->hba_debugfs_root = NULL;
-               atomic_dec(&lpfc_debugfs_hba_count);
+
+               if (phba->debug_hbqinfo) {
+                       debugfs_remove(phba->debug_hbqinfo); /* hbqinfo */
+                       phba->debug_hbqinfo = NULL;
+               }
+               if (phba->debug_dumpslim) {
+                       debugfs_remove(phba->debug_dumpslim); /* dumpslim */
+                       phba->debug_dumpslim = NULL;
+               }
+               if (phba->slow_ring_trc) {
+                       kfree(phba->slow_ring_trc);
+                       phba->slow_ring_trc = NULL;
+               }
+               if (phba->debug_slow_ring_trc) {
+                       /* slow_ring_trace */
+                       debugfs_remove(phba->debug_slow_ring_trc);
+                       phba->debug_slow_ring_trc = NULL;
+               }
+
+               if (phba->hba_debugfs_root) {
+                       debugfs_remove(phba->hba_debugfs_root); /* lpfcX */
+                       phba->hba_debugfs_root = NULL;
+                       atomic_dec(&lpfc_debugfs_hba_count);
+               }
+
                if (atomic_read(&lpfc_debugfs_hba_count) == 0) {
                        debugfs_remove(lpfc_debugfs_root); /* lpfc */
                        lpfc_debugfs_root = NULL;
                }
        }
 #endif
+       return;
 }
 
 
index fffb678426a4f65b18c81c6e384b92daf79ff5a1..31e86a55391df7fa40b1a74ef2ef1ad46ba4d3af 100644 (file)
@@ -22,7 +22,7 @@
 #define _H_LPFC_DEBUG_FS
 
 #ifdef CONFIG_LPFC_DEBUG_FS
-struct lpfc_disc_trc {
+struct lpfc_debugfs_trc {
        char *fmt;
        uint32_t data1;
        uint32_t data2;
index 33fbc166694678a2f5ed82f62575197e95eb32cd..8085900635d4876fd100b7930f41651af584abd1 100644 (file)
@@ -63,10 +63,10 @@ lpfc_els_chk_latt(struct lpfc_vport *vport)
                return 0;
 
        /* Pending Link Event during Discovery */
-       lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                       "%d (%d):0237 Pending Link Event during "
-                       "Discovery: State x%x\n",
-                       phba->brd_no, vport->vpi,  phba->pport->port_state);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                        "0237 Pending Link Event during "
+                        "Discovery: State x%x\n",
+                        phba->pport->port_state);
 
        /* CLEAR_LA should re-enable link attention events and
         * we should then imediately take a LATT event. The
@@ -196,9 +196,7 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
                bpl->tus.w = le32_to_cpu(bpl->tus.w);
        }
 
-       /* Save for completion so we can release these resources */
-       if (elscmd != ELS_CMD_LS_RJT)
-               elsiocb->context1 = lpfc_nlp_get(ndlp);
+       elsiocb->context1 = lpfc_nlp_get(ndlp);
        elsiocb->context2 = pcmd;
        elsiocb->context3 = pbuflist;
        elsiocb->retry = retry;
@@ -208,23 +206,21 @@ lpfc_prep_els_iocb(struct lpfc_vport *vport, uint8_t expectRsp,
        if (prsp) {
                list_add(&prsp->list, &pcmd->list);
        }
-
        if (expectRsp) {
                /* Xmit ELS command <elsCmd> to remote NPORT <did> */
-               lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                               "%d (%d):0116 Xmit ELS command x%x to remote "
-                               "NPORT x%x I/O tag: x%x, port state: x%x\n",
-                               phba->brd_no, vport->vpi,  elscmd, did,
-                               elsiocb->iotag, vport->port_state);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                                "0116 Xmit ELS command x%x to remote "
+                                "NPORT x%x I/O tag: x%x, port state: x%x\n",
+                                elscmd, did, elsiocb->iotag,
+                                vport->port_state);
        } else {
                /* Xmit ELS response <elsCmd> to remote NPORT <did> */
-               lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                               "%d (%d):0117 Xmit ELS response x%x to remote "
-                               "NPORT x%x I/O tag: x%x, size: x%x\n",
-                               phba->brd_no, vport->vpi, elscmd,
-                               ndlp->nlp_DID, elsiocb->iotag, cmdSize);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                                "0117 Xmit ELS response x%x to remote "
+                                "NPORT x%x I/O tag: x%x, size: x%x\n",
+                                elscmd, ndlp->nlp_DID, elsiocb->iotag,
+                                cmdSize);
        }
-
        return elsiocb;
 }
 
@@ -285,9 +281,8 @@ fail_free_mbox:
 
 fail:
        lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-       lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-               "%d (%d):0249 Cannot issue Register Fabric login\n",
-               phba->brd_no, vport->vpi);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+               "0249 Cannot issue Register Fabric login\n");
        return -ENXIO;
 }
 
@@ -340,20 +335,19 @@ lpfc_cmpl_els_flogi_fabric(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 
        if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) {
                if (sp->cmn.response_multiple_NPort) {
-                       lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT,
-                                       "%d:1816 FLOGI NPIV supported, "
-                                       "response data 0x%x\n",
-                                       phba->brd_no,
-                                       sp->cmn.response_multiple_NPort);
+                       lpfc_printf_vlog(vport, KERN_WARNING,
+                                        LOG_ELS | LOG_VPORT,
+                                        "1816 FLOGI NPIV supported, "
+                                        "response data 0x%x\n",
+                                        sp->cmn.response_multiple_NPort);
                        phba->link_flag |= LS_NPIV_FAB_SUPPORTED;
-
                } else {
                        /* Because we asked f/w for NPIV it still expects us
-                          to call reg_vnpid atleast for the physcial host */
-                       lpfc_printf_log(phba, KERN_WARNING, LOG_ELS | LOG_VPORT,
-                                       "%d:1817 Fabric does not support NPIV "
-                                       "- configuring single port mode.\n",
-                                       phba->brd_no);
+                       to call reg_vnpid atleast for the physcial host */
+                       lpfc_printf_vlog(vport, KERN_WARNING,
+                                        LOG_ELS | LOG_VPORT,
+                                        "1817 Fabric does not support NPIV "
+                                        "- configuring single port mode.\n");
                        phba->link_flag &= ~LS_NPIV_FAB_SUPPORTED;
                }
        }
@@ -518,16 +512,15 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                 * alpa map would take too long otherwise.
                 */
                if (phba->alpa_map[0] == 0) {
-                       phba->cfg_discovery_threads = LPFC_MAX_DISC_THREADS;
+                       vport->cfg_discovery_threads = LPFC_MAX_DISC_THREADS;
                }
 
                /* FLOGI failure */
-               lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                               "%d (%d):0100 FLOGI failure Data: x%x x%x "
-                               "x%x\n",
-                               phba->brd_no, vport->vpi,
-                               irsp->ulpStatus, irsp->un.ulpWord[4],
-                               irsp->ulpTimeout);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                                "0100 FLOGI failure Data: x%x x%x "
+                                "x%x\n",
+                                irsp->ulpStatus, irsp->un.ulpWord[4],
+                                irsp->ulpTimeout);
                goto flogifail;
        }
 
@@ -540,12 +533,11 @@ lpfc_cmpl_els_flogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        sp = prsp->virt + sizeof(uint32_t);
 
        /* FLOGI completes successfully */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0101 FLOGI completes sucessfully "
-                       "Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
-                       irsp->un.ulpWord[4], sp->cmn.e_d_tov,
-                       sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0101 FLOGI completes sucessfully "
+                        "Data: x%x x%x x%x x%x\n",
+                        irsp->un.ulpWord[4], sp->cmn.e_d_tov,
+                        sp->cmn.w2.r_a_tov, sp->cmn.edtovResolution);
 
        if (vport->port_state == LPFC_FLOGI) {
                /*
@@ -662,8 +654,8 @@ lpfc_els_abort_flogi(struct lpfc_hba *phba)
 
        /* Abort outstanding I/O on NPort <nlp_DID> */
        lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d:0201 Abort outstanding I/O on NPort x%x\n",
-                       phba->brd_no, Fabric_DID);
+                       "0201 Abort outstanding I/O on NPort x%x\n",
+                       Fabric_DID);
 
        pring = &phba->sli.ring[LPFC_ELS_RING];
 
@@ -736,18 +728,16 @@ static void
 lpfc_more_plogi(struct lpfc_vport *vport)
 {
        int sentplogi;
-       struct lpfc_hba *phba = vport->phba;
 
        if (vport->num_disc_nodes)
                vport->num_disc_nodes--;
 
        /* Continue discovery with <num_disc_nodes> PLOGIs to go */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0232 Continue discovery with %d PLOGIs to go "
-                       "Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, vport->num_disc_nodes,
-                       vport->fc_plogi_cnt, vport->fc_flag, vport->port_state);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0232 Continue discovery with %d PLOGIs to go "
+                        "Data: x%x x%x x%x\n",
+                        vport->num_disc_nodes, vport->fc_plogi_cnt,
+                        vport->fc_flag, vport->port_state);
        /* Check to see if there are more PLOGIs to be sent */
        if (vport->fc_flag & FC_NLP_MORE)
                /* go thru NPR nodes and issue any remaining ELS PLOGIs */
@@ -833,11 +823,12 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 
        ndlp = lpfc_findnode_did(vport, irsp->un.elsreq64.remoteID);
        if (!ndlp) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0136 PLOGI completes to NPort x%x "
-                       "with no ndlp. Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, irsp->un.elsreq64.remoteID,
-                       irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpIoTag);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0136 PLOGI completes to NPort x%x "
+                                "with no ndlp. Data: x%x x%x x%x\n",
+                                irsp->un.elsreq64.remoteID,
+                                irsp->ulpStatus, irsp->un.ulpWord[4],
+                                irsp->ulpIoTag);
                goto out;
        }
 
@@ -851,13 +842,11 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        rc   = 0;
 
        /* PLOGI completes to NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0102 PLOGI completes to NPort x%x "
-                       "Data: x%x x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, ndlp->nlp_DID,
-                       irsp->ulpStatus, irsp->un.ulpWord[4],
-                       irsp->ulpTimeout, disc, vport->num_disc_nodes);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0102 PLOGI completes to NPort x%x "
+                        "Data: x%x x%x x%x x%x x%x\n",
+                        ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
+                        irsp->ulpTimeout, disc, vport->num_disc_nodes);
        /* Check to see if link went down during discovery */
        if (lpfc_els_chk_latt(vport)) {
                spin_lock_irq(shost->host_lock);
@@ -881,17 +870,14 @@ lpfc_cmpl_els_plogi(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        }
                        goto out;
                }
-
                /* PLOGI failed */
                if (ndlp->nlp_DID == NameServer_DID) {
                        lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-                       lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0250 Nameserver login error: "
-                               "0x%x / 0x%x\n",
-                               phba->brd_no, vport->vpi,
-                               irsp->ulpStatus, irsp->un.ulpWord[4]);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                        "0250 Nameserver login error: "
+                                        "0x%x / 0x%x\n",
+                                        irsp->ulpStatus, irsp->un.ulpWord[4]);
                }
-
                /* Do not call DSM for lpfc_els_abort'ed ELS cmds */
                if (lpfc_error_lost_link(irsp)) {
                        rc = NLP_STE_FREED_NODE;
@@ -1017,14 +1003,12 @@ lpfc_cmpl_els_prli(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                "PRLI cmpl:       status:x%x/x%x did:x%x",
                irsp->ulpStatus, irsp->un.ulpWord[4],
                ndlp->nlp_DID);
-
        /* PRLI completes to NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0103 PRLI completes to NPort x%x "
-                       "Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, ndlp->nlp_DID,
-                       irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout,
-                       vport->num_disc_nodes);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0103 PRLI completes to NPort x%x "
+                        "Data: x%x x%x x%x x%x\n",
+                        ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
+                        irsp->ulpTimeout, vport->num_disc_nodes);
 
        vport->fc_prli_sent--;
        /* Check to see if link went down during discovery */
@@ -1129,18 +1113,15 @@ static void
 lpfc_more_adisc(struct lpfc_vport *vport)
 {
        int sentadisc;
-       struct lpfc_hba *phba = vport->phba;
 
        if (vport->num_disc_nodes)
                vport->num_disc_nodes--;
-
        /* Continue discovery with <num_disc_nodes> ADISCs to go */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0210 Continue discovery with %d ADISCs to go "
-                       "Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, vport->num_disc_nodes,
-                       vport->fc_adisc_cnt, vport->fc_flag, vport->port_state);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0210 Continue discovery with %d ADISCs to go "
+                        "Data: x%x x%x x%x\n",
+                        vport->num_disc_nodes, vport->fc_adisc_cnt,
+                        vport->fc_flag, vport->port_state);
        /* Check to see if there are more ADISCs to be sent */
        if (vport->fc_flag & FC_NLP_MORE) {
                lpfc_set_disctmo(vport);
@@ -1206,15 +1187,12 @@ lpfc_cmpl_els_adisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        disc = (ndlp->nlp_flag & NLP_NPR_2B_DISC);
        ndlp->nlp_flag &= ~(NLP_ADISC_SND | NLP_NPR_2B_DISC);
        spin_unlock_irq(shost->host_lock);
-
        /* ADISC completes to NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0104 ADISC completes to NPort x%x "
-                       "Data: x%x x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, ndlp->nlp_DID,
-                       irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout,
-                       disc, vport->num_disc_nodes);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0104 ADISC completes to NPort x%x "
+                        "Data: x%x x%x x%x x%x x%x\n",
+                        ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
+                        irsp->ulpTimeout, disc, vport->num_disc_nodes);
        /* Check to see if link went down during discovery */
        if (lpfc_els_chk_latt(vport)) {
                spin_lock_irq(shost->host_lock);
@@ -1374,15 +1352,12 @@ lpfc_cmpl_els_logo(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                "LOGO cmpl:       status:x%x/x%x did:x%x",
                irsp->ulpStatus, irsp->un.ulpWord[4],
                ndlp->nlp_DID);
-
        /* LOGO completes to NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0105 LOGO completes to NPort x%x "
-                       "Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, ndlp->nlp_DID,
-                       irsp->ulpStatus, irsp->un.ulpWord[4], irsp->ulpTimeout,
-                       vport->num_disc_nodes);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0105 LOGO completes to NPort x%x "
+                        "Data: x%x x%x x%x x%x\n",
+                        ndlp->nlp_DID, irsp->ulpStatus, irsp->un.ulpWord[4],
+                        irsp->ulpTimeout, vport->num_disc_nodes);
        /* Check to see if link went down during discovery */
        if (lpfc_els_chk_latt(vport))
                goto out;
@@ -1488,15 +1463,11 @@ lpfc_cmpl_els_cmd(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                "ELS cmd cmpl:    status:x%x/x%x did:x%x",
                irsp->ulpStatus, irsp->un.ulpWord[4],
                irsp->un.elsreq64.remoteID);
-
        /* ELS cmd tag <ulpIoTag> completes */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0106 ELS cmd tag x%x completes Data: x%x x%x "
-                       "x%x\n",
-                       phba->brd_no, vport->vpi,
-                       irsp->ulpIoTag, irsp->ulpStatus,
-                       irsp->un.ulpWord[4], irsp->ulpTimeout);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0106 ELS cmd tag x%x completes Data: x%x x%x x%x\n",
+                        irsp->ulpIoTag, irsp->ulpStatus,
+                        irsp->un.ulpWord[4], irsp->ulpTimeout);
        /* Check to see if link went down during discovery */
        lpfc_els_chk_latt(vport);
        lpfc_els_free_iocb(phba, cmdiocb);
@@ -1831,13 +1802,15 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                case IOERR_ILLEGAL_COMMAND:
                        if ((phba->sli3_options & LPFC_SLI3_VPORT_TEARDOWN) &&
                            (cmd == ELS_CMD_FDISC)) {
-                               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0124 FDISC failed (3/6) retrying...\n",
-                                       phba->brd_no, vport->vpi);
+                               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                                "0124 FDISC failed (3/6) "
+                                                "retrying...\n");
                                lpfc_mbx_unreg_vpi(vport);
                                retry = 1;
-                               /* Always retry for this case */
-                               cmdiocb->retry = 0;
+                               /* FDISC retry policy */
+                               maxretry = 48;
+                               if (cmdiocb->retry >= 32)
+                                       delay = 1000;
                        }
                        break;
 
@@ -1898,10 +1871,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
                          (cmd == ELS_CMD_FDISC) &&
                          (stat.un.b.lsRjtRsnCodeExp == LSEXP_OUT_OF_RESOURCE)){
-                               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0125 FDISC Failed (x%x)."
-                               Fabric out of resources\n",
-                               phba->brd_no, vport->vpi, stat.un.lsRjtError);
+                               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                                "0125 FDISC Failed (x%x). "
+                                                "Fabric out of resources\n",
+                                                stat.un.lsRjtError);
                                lpfc_vport_set_state(vport,
                                                     FC_VPORT_NO_FABRIC_RSCS);
                        }
@@ -1913,8 +1886,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                                delay = 1000;
                                maxretry = 48;
                        } else if (cmd == ELS_CMD_FDISC) {
-                               /* Always retry for this case */
-                               cmdiocb->retry = 0;
+                               /* FDISC retry policy */
+                               maxretry = 48;
+                               if (cmdiocb->retry >= 32)
+                                       delay = 1000;
                        }
                        retry = 1;
                        break;
@@ -1926,10 +1901,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                          ((stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_PNAME) ||
                          (stat.un.b.lsRjtRsnCodeExp == LSEXP_INVALID_NPORT_ID))
                          ) {
-                               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0123 FDISC Failed (x%x)."
-                               Fabric Detected Bad WWN\n",
-                               phba->brd_no, vport->vpi, stat.un.lsRjtError);
+                               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                                "0123 FDISC Failed (x%x). "
+                                                "Fabric Detected Bad WWN\n",
+                                                stat.un.lsRjtError);
                                lpfc_vport_set_state(vport,
                                                     FC_VPORT_FABRIC_REJ_WWN);
                        }
@@ -1959,11 +1934,10 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        if (retry) {
 
                /* Retry ELS command <elsCmd> to remote NPORT <did> */
-               lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                               "%d (%d):0107 Retry ELS command x%x to remote "
-                               "NPORT x%x Data: x%x x%x\n",
-                               phba->brd_no, vport->vpi,
-                               cmd, did, cmdiocb->retry, delay);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                                "0107 Retry ELS command x%x to remote "
+                                "NPORT x%x Data: x%x x%x\n",
+                                cmd, did, cmdiocb->retry, delay);
 
                if (((cmd == ELS_CMD_PLOGI) || (cmd == ELS_CMD_ADISC)) &&
                        ((irsp->ulpStatus != IOSTAT_LOCAL_REJECT) ||
@@ -2031,14 +2005,12 @@ lpfc_els_retry(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        return 1;
                }
        }
-
        /* No retry ELS command <elsCmd> to remote NPORT <did> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0108 No retry ELS command x%x to remote "
-                       "NPORT x%x Data: x%x\n",
-                       phba->brd_no, vport->vpi,
-                       cmd, did, cmdiocb->retry);
-
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                        "0108 No retry ELS command x%x to remote "
+                        "NPORT x%x Retried:%d Error:x%x/%x\n",
+                        cmd, did, cmdiocb->retry, irsp->ulpStatus,
+                        irsp->un.ulpWord[4]);
        return 0;
 }
 
@@ -2087,14 +2059,12 @@ lpfc_cmpl_els_logo_acc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
                "ACC LOGO cmpl:   status:x%x/x%x did:x%x",
                irsp->ulpStatus, irsp->un.ulpWord[4], ndlp->nlp_DID);
-
        /* ACC to LOGO completes to NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0109 ACC to LOGO completes to NPort x%x "
-                       "Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0109 ACC to LOGO completes to NPort x%x "
+                        "Data: x%x x%x x%x\n",
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
        switch (ndlp->nlp_state) {
        case NLP_STE_UNUSED_NODE:       /* node is just allocated */
                lpfc_drop_node(vport, ndlp);
@@ -2153,20 +2123,17 @@ lpfc_cmpl_els_rsp(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        }
 
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
-               "ACC cmpl:        status:x%x/x%x did:x%x",
+               "ELS rsp cmpl:    status:x%x/x%x did:x%x",
                irsp->ulpStatus, irsp->un.ulpWord[4],
-               irsp->un.rcvels.remoteID);
-
+               cmdiocb->iocb.un.elsreq64.remoteID);
        /* ELS response tag <ulpIoTag> completes */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0110 ELS response tag x%x completes "
-                       "Data: x%x x%x x%x x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
-                       cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus,
-                       rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout,
-                       ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
-                       ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0110 ELS response tag x%x completes "
+                        "Data: x%x x%x x%x x%x x%x x%x x%x\n",
+                        cmdiocb->iocb.ulpIoTag, rspiocb->iocb.ulpStatus,
+                        rspiocb->iocb.un.ulpWord[4], rspiocb->iocb.ulpTimeout,
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
        if (mbox) {
                if ((rspiocb->iocb.ulpStatus == 0)
                    && (ndlp->nlp_flag & NLP_ACC_REGLOGIN)) {
@@ -2219,7 +2186,7 @@ out:
 int
 lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
                 struct lpfc_iocbq *oldiocb, struct lpfc_nodelist *ndlp,
-                LPFC_MBOXQ_t *mbox, uint8_t newnode)
+                LPFC_MBOXQ_t *mbox)
 {
        struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
        struct lpfc_hba  *phba = vport->phba;
@@ -2305,20 +2272,13 @@ lpfc_els_rsp_acc(struct lpfc_vport *vport, uint32_t flag,
        default:
                return 1;
        }
-
-       if (newnode) {
-               lpfc_nlp_put(ndlp);
-               elsiocb->context1 = NULL;
-       }
-
        /* Xmit ELS ACC response tag <ulpIoTag> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0128 Xmit ELS ACC response tag x%x, XRI: x%x, "
-                       "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n",
-                       phba->brd_no, vport->vpi, elsiocb->iotag,
-                       elsiocb->iocb.ulpContext, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0128 Xmit ELS ACC response tag x%x, XRI: x%x, "
+                        "DID: x%x, nlp_flag: x%x nlp_state: x%x RPI: x%x\n",
+                        elsiocb->iotag, elsiocb->iocb.ulpContext,
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
        if (ndlp->nlp_flag & NLP_LOGO_ACC) {
                spin_lock_irq(shost->host_lock);
                ndlp->nlp_flag &= ~NLP_LOGO_ACC;
@@ -2370,20 +2330,17 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError,
        pcmd += sizeof(uint32_t);
        *((uint32_t *) (pcmd)) = rejectError;
 
-       if (mbox) {
+       if (mbox)
                elsiocb->context_un.mbox = mbox;
-               elsiocb->context1 = lpfc_nlp_get(ndlp);
-       }
 
        /* Xmit ELS RJT <err> response tag <ulpIoTag> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0129 Xmit ELS RJT x%x response tag x%x "
-                       "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, "
-                       "rpi x%x\n",
-                       phba->brd_no, vport->vpi, rejectError, elsiocb->iotag,
-                       elsiocb->iocb.ulpContext, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0129 Xmit ELS RJT x%x response tag x%x "
+                        "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, "
+                        "rpi x%x\n",
+                        rejectError, elsiocb->iotag,
+                        elsiocb->iocb.ulpContext, ndlp->nlp_DID,
+                        ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_RSP,
                "Issue LS_RJT:    did:x%x flg:x%x err:x%x",
                ndlp->nlp_DID, ndlp->nlp_flag, rejectError);
@@ -2391,6 +2348,15 @@ lpfc_els_rsp_reject(struct lpfc_vport *vport, uint32_t rejectError,
        phba->fc_stat.elsXmitLSRJT++;
        elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
        rc = lpfc_sli_issue_iocb(phba, pring, elsiocb, 0);
+
+       /* If the node is in the UNUSED state, and we are sending
+        * a reject, we are done with it.  Release driver reference
+        * count here.  The outstanding els will release its reference on
+        * completion and the node can be freed then.
+        */
+       if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
+               lpfc_nlp_put(ndlp);
+
        if (rc == IOCB_ERROR) {
                lpfc_els_free_iocb(phba, elsiocb);
                return 1;
@@ -2423,13 +2389,12 @@ lpfc_els_rsp_adisc_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb,
        icmd->ulpContext = oldcmd->ulpContext;  /* Xri */
 
        /* Xmit ADISC ACC response tag <ulpIoTag> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0130 Xmit ADISC ACC response iotag x%x xri: "
-                       "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n",
-                       phba->brd_no, vport->vpi, elsiocb->iotag,
-                       elsiocb->iocb.ulpContext, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0130 Xmit ADISC ACC response iotag x%x xri: "
+                        "x%x, did x%x, nlp_flag x%x, nlp_state x%x rpi x%x\n",
+                        elsiocb->iotag, elsiocb->iocb.ulpContext,
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
        pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
 
        *((uint32_t *) (pcmd)) = ELS_CMD_ACC;
@@ -2483,15 +2448,13 @@ lpfc_els_rsp_prli_acc(struct lpfc_vport *vport, struct lpfc_iocbq *oldiocb,
        icmd = &elsiocb->iocb;
        oldcmd = &oldiocb->iocb;
        icmd->ulpContext = oldcmd->ulpContext;  /* Xri */
-
        /* Xmit PRLI ACC response tag <ulpIoTag> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0131 Xmit PRLI ACC response tag x%x xri x%x, "
-                       "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n",
-                       phba->brd_no, vport->vpi, elsiocb->iotag,
-                       elsiocb->iocb.ulpContext, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0131 Xmit PRLI ACC response tag x%x xri x%x, "
+                        "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n",
+                        elsiocb->iotag, elsiocb->iocb.ulpContext,
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
        pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
 
        *((uint32_t *) (pcmd)) = (ELS_CMD_ACC | (ELS_CMD_PRLI & ~ELS_RSP_MASK));
@@ -2565,16 +2528,11 @@ lpfc_els_rsp_rnid_acc(struct lpfc_vport *vport, uint8_t format,
        icmd = &elsiocb->iocb;
        oldcmd = &oldiocb->iocb;
        icmd->ulpContext = oldcmd->ulpContext;  /* Xri */
-
        /* Xmit RNID ACC response tag <ulpIoTag> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0132 Xmit RNID ACC response tag x%x "
-                       "xri x%x\n",
-                       phba->brd_no, vport->vpi, elsiocb->iotag,
-                       elsiocb->iocb.ulpContext);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0132 Xmit RNID ACC response tag x%x xri x%x\n",
+                        elsiocb->iotag, elsiocb->iocb.ulpContext);
        pcmd = (uint8_t *) (((struct lpfc_dmabuf *) elsiocb->context2)->virt);
-
        *((uint32_t *) (pcmd)) = ELS_CMD_ACC;
        pcmd += sizeof(uint32_t);
 
@@ -2641,7 +2599,7 @@ lpfc_els_disc_adisc(struct lpfc_vport *vport)
                        sentadisc++;
                        vport->num_disc_nodes++;
                        if (vport->num_disc_nodes >=
-                           vport->phba->cfg_discovery_threads) {
+                           vport->cfg_discovery_threads) {
                                spin_lock_irq(shost->host_lock);
                                vport->fc_flag |= FC_NLP_MORE;
                                spin_unlock_irq(shost->host_lock);
@@ -2676,7 +2634,7 @@ lpfc_els_disc_plogi(struct lpfc_vport *vport)
                        sentplogi++;
                        vport->num_disc_nodes++;
                        if (vport->num_disc_nodes >=
-                           vport->phba->cfg_discovery_threads) {
+                           vport->cfg_discovery_threads) {
                                spin_lock_irq(shost->host_lock);
                                vport->fc_flag |= FC_NLP_MORE;
                                spin_unlock_irq(shost->host_lock);
@@ -2717,7 +2675,6 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
        D_ID rscn_did;
        uint32_t *lp;
        uint32_t payload_len, i;
-       struct lpfc_hba *phba = vport->phba;
 
        ns_did.un.word = did;
 
@@ -2752,12 +2709,10 @@ lpfc_rscn_payload_check(struct lpfc_vport *vport, uint32_t did)
                                break;
                        default:
                                /* Unknown Identifier in RSCN node */
-                               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                                               "%d (%d):0217 Unknown "
-                                               "Identifier in RSCN payload "
-                                               "Data: x%x\n",
-                                               phba->brd_no, vport->vpi,
-                                               rscn_did.un.word);
+                               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                                "0217 Unknown Identifier in "
+                                                "RSCN payload Data: x%x\n",
+                                                rscn_did.un.word);
                        case 3: /* Whole Fabric effected */
                                return did;
                        }
@@ -2796,12 +2751,11 @@ lpfc_rscn_recovery_check(struct lpfc_vport *vport)
 
 static int
 lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
-                 struct lpfc_nodelist *ndlp, uint8_t newnode)
+                 struct lpfc_nodelist *ndlp)
 {
        struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
        struct lpfc_hba  *phba = vport->phba;
        struct lpfc_dmabuf *pcmd;
-       struct lpfc_vport *next_vport;
        uint32_t *lp, *datap;
        IOCB_t *icmd;
        uint32_t payload_len, length, nportid, *cmd;
@@ -2815,13 +2769,10 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 
        payload_len = be32_to_cpu(*lp++ & ~ELS_CMD_MASK);
        payload_len -= sizeof(uint32_t);        /* take off word 0 */
-
        /* RSCN received */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0214 RSCN received Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, vport->fc_flag, payload_len,
-                       *lp, rscn_cnt);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0214 RSCN received Data: x%x x%x x%x x%x\n",
+                        vport->fc_flag, payload_len, *lp, rscn_cnt);
        for (i = 0; i < payload_len/sizeof(uint32_t); i++)
                fc_host_post_event(shost, fc_get_event_number(),
                        FCH_EVT_RSCN, lp[i]);
@@ -2834,8 +2785,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
                        "RCV RSCN ignore: did:x%x/ste:x%x flg:x%x",
                        ndlp->nlp_DID, vport->port_state, ndlp->nlp_flag);
 
-               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL,
-                                newnode);
+               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
                return 0;
        }
 
@@ -2843,7 +2793,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
         * just ACC and ignore it.
         */
        if ((phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) &&
-               !(phba->cfg_peer_port_login)) {
+               !(vport->cfg_peer_port_login)) {
                i = payload_len;
                datap = lp;
                while (i > 0) {
@@ -2851,28 +2801,23 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
                        nportid = ((be32_to_cpu(nportid)) & Mask_DID);
                        i -= sizeof(uint32_t);
                        rscn_id++;
-                       list_for_each_entry(next_vport, &phba->port_list,
-                               listentry) {
-                               if (nportid == next_vport->fc_myDID) {
-                                       hba_id++;
-                                       break;
-                               }
-                       }
+                       if (lpfc_find_vport_by_did(phba, nportid))
+                               hba_id++;
                }
                if (rscn_id == hba_id) {
                        /* ALL NPortIDs in RSCN are on HBA */
-                       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                         "%d (%d):0214 Ignore RSCN Data: x%x x%x x%x x%x\n",
-                         phba->brd_no, vport->vpi, vport->fc_flag, payload_len,
-                         *lp, rscn_cnt);
-
+                       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                        "0214 Ignore RSCN "
+                                        "Data: x%x x%x x%x x%x\n",
+                                        vport->fc_flag, payload_len,
+                                        *lp, rscn_cnt);
                        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
                                "RCV RSCN vport:  did:x%x/ste:x%x flg:x%x",
                                ndlp->nlp_DID, vport->port_state,
                                ndlp->nlp_flag);
 
                        lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb,
-                               ndlp, NULL, newnode);
+                               ndlp, NULL);
                        return 0;
                }
        }
@@ -2911,27 +2856,24 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
                        }
 
                        /* Deferred RSCN */
-                       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                                       "%d (%d):0235 Deferred RSCN "
-                                       "Data: x%x x%x x%x\n",
-                                       phba->brd_no, vport->vpi,
-                                       vport->fc_rscn_id_cnt, vport->fc_flag,
-                                       vport->port_state);
+                       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                        "0235 Deferred RSCN "
+                                        "Data: x%x x%x x%x\n",
+                                        vport->fc_rscn_id_cnt, vport->fc_flag,
+                                        vport->port_state);
                } else {
                        spin_lock_irq(shost->host_lock);
                        vport->fc_flag |= FC_RSCN_DISCOVERY;
                        spin_unlock_irq(shost->host_lock);
                        /* ReDiscovery RSCN */
-                       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                                       "%d (%d):0234 ReDiscovery RSCN "
-                                       "Data: x%x x%x x%x\n",
-                                       phba->brd_no, vport->vpi,
-                                       vport->fc_rscn_id_cnt, vport->fc_flag,
-                                       vport->port_state);
+                       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                        "0234 ReDiscovery RSCN "
+                                        "Data: x%x x%x x%x\n",
+                                        vport->fc_rscn_id_cnt, vport->fc_flag,
+                                        vport->port_state);
                }
                /* Send back ACC */
-               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL,
-                                                               newnode);
+               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
 
                /* send RECOVERY event for ALL nodes that match RSCN payload */
                lpfc_rscn_recovery_check(vport);
@@ -2956,7 +2898,7 @@ lpfc_els_rcv_rscn(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
        lpfc_set_disctmo(vport);
 
        /* Send back ACC */
-       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, newnode);
+       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
 
        /* send RECOVERY event for ALL nodes that match RSCN payload */
        lpfc_rscn_recovery_check(vport);
@@ -2980,11 +2922,10 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport)
        lpfc_set_disctmo(vport);
 
        /* RSCN processed */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0215 RSCN processed Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
-                       vport->fc_flag, 0, vport->fc_rscn_id_cnt,
-                       vport->port_state);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0215 RSCN processed Data: x%x x%x x%x x%x\n",
+                        vport->fc_flag, 0, vport->fc_rscn_id_cnt,
+                        vport->port_state);
 
        /* To process RSCN, first compare RSCN data with NameServer */
        vport->fc_ns_retry = 0;
@@ -3026,7 +2967,7 @@ lpfc_els_handle_rscn(struct lpfc_vport *vport)
 
 static int
 lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
-                  struct lpfc_nodelist *ndlp, uint8_t newnode)
+                  struct lpfc_nodelist *ndlp)
 {
        struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
        struct lpfc_hba  *phba = vport->phba;
@@ -3052,10 +2993,10 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 
                /* An FLOGI ELS command <elsCmd> was received from DID <did> in
                   Loop Mode */
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0113 An FLOGI ELS command x%x was "
-                               "received from DID x%x in Loop Mode\n",
-                               phba->brd_no, vport->vpi, cmd, did);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0113 An FLOGI ELS command x%x was "
+                                "received from DID x%x in Loop Mode\n",
+                                cmd, did);
                return 1;
        }
 
@@ -3109,7 +3050,7 @@ lpfc_els_rcv_flogi(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
        }
 
        /* Send back ACC */
-       lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, newnode);
+       lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL);
 
        return 0;
 }
@@ -3226,16 +3167,13 @@ lpfc_els_rsp_rps_acc(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        rps_rsp->primSeqErrCnt = be32_to_cpu(mb->un.varRdLnk.primSeqErrCnt);
        rps_rsp->invalidXmitWord = be32_to_cpu(mb->un.varRdLnk.invalidXmitWord);
        rps_rsp->crcCnt = be32_to_cpu(mb->un.varRdLnk.crcCnt);
-
        /* Xmit ELS RPS ACC response tag <ulpIoTag> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0118 Xmit ELS RPS ACC response tag x%x "
-                       "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, "
-                       "rpi x%x\n",
-                       phba->brd_no, ndlp->vport->vpi, elsiocb->iotag,
-                       elsiocb->iocb.ulpContext, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_ELS,
+                        "0118 Xmit ELS RPS ACC response tag x%x xri x%x, "
+                        "did x%x, nlp_flag x%x, nlp_state x%x, rpi x%x\n",
+                        elsiocb->iotag, elsiocb->iocb.ulpContext,
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
        elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
        phba->fc_stat.elsXmitACC++;
        if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR)
@@ -3337,21 +3275,16 @@ lpfc_els_rsp_rpl_acc(struct lpfc_vport *vport, uint16_t cmdsize,
        rpl_rsp.port_num_blk.portID = be32_to_cpu(vport->fc_myDID);
        memcpy(&rpl_rsp.port_num_blk.portName, &vport->fc_portname,
            sizeof(struct lpfc_name));
-
        memcpy(pcmd, &rpl_rsp, cmdsize - sizeof(uint32_t));
-
-
        /* Xmit ELS RPL ACC response tag <ulpIoTag> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0120 Xmit ELS RPL ACC response tag x%x "
-                       "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, "
-                       "rpi x%x\n",
-                       phba->brd_no, vport->vpi, elsiocb->iotag,
-                       elsiocb->iocb.ulpContext, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0120 Xmit ELS RPL ACC response tag x%x "
+                        "xri x%x, did x%x, nlp_flag x%x, nlp_state x%x, "
+                        "rpi x%x\n",
+                        elsiocb->iotag, elsiocb->iocb.ulpContext,
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
        elsiocb->iocb_cmpl = lpfc_cmpl_els_rsp;
-
        phba->fc_stat.elsXmitACC++;
        if (lpfc_sli_issue_iocb(phba, pring, elsiocb, 0) == IOCB_ERROR) {
                lpfc_els_free_iocb(phba, elsiocb);
@@ -3404,7 +3337,6 @@ static int
 lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
                  struct lpfc_nodelist *ndlp)
 {
-       struct lpfc_hba *phba = vport->phba;
        struct lpfc_dmabuf *pcmd;
        uint32_t *lp;
        IOCB_t *icmd;
@@ -3418,12 +3350,9 @@ lpfc_els_rcv_farp(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 
        cmd = *lp++;
        fp = (FARP *) lp;
-
        /* FARP-REQ received from DID <did> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0601 FARP-REQ received from DID x%x\n",
-                       phba->brd_no, vport->vpi, did);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0601 FARP-REQ received from DID x%x\n", did);
        /* We will only support match on WWPN or WWNN */
        if (fp->Mflags & ~(FARP_MATCH_NODE | FARP_MATCH_PORT)) {
                return 0;
@@ -3471,7 +3400,6 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
        uint32_t *lp;
        IOCB_t *icmd;
        uint32_t cmd, did;
-       struct lpfc_hba *phba = vport->phba;
 
        icmd = &cmdiocb->iocb;
        did = icmd->un.elsreq64.remoteID;
@@ -3480,11 +3408,10 @@ lpfc_els_rcv_farpr(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
 
        cmd = *lp++;
        /* FARP-RSP received from DID <did> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0600 FARP-RSP received from DID x%x\n",
-                       phba->brd_no, vport->vpi, did);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0600 FARP-RSP received from DID x%x\n", did);
        /* ACCEPT the Farp resp request */
-       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
+       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
 
        return 0;
 }
@@ -3502,10 +3429,8 @@ lpfc_els_rcv_fan(struct lpfc_vport *vport, struct lpfc_iocbq *cmdiocb,
        struct lpfc_hba *phba = vport->phba;
 
        /* FAN received */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0265 FAN received\n",
-                       phba->brd_no, vport->vpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0265 FAN received\n");
        icmd = &cmdiocb->iocb;
        did = icmd->un.elsreq64.remoteID;
        pcmd = (struct lpfc_dmabuf *)cmdiocb->context2;
@@ -3664,13 +3589,10 @@ lpfc_els_timeout_handler(struct lpfc_vport *vport)
                        if (ndlp)
                                remote_ID = ndlp->nlp_DID;
                }
-
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0127 ELS timeout Data: x%x x%x x%x "
-                               "x%x\n",
-                               phba->brd_no, vport->vpi, els_command,
-                               remote_ID, cmd->ulpCommand, cmd->ulpIoTag);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0127 ELS timeout Data: x%x x%x x%x "
+                                "x%x\n", els_command,
+                                remote_ID, cmd->ulpCommand, cmd->ulpIoTag);
                lpfc_sli_issue_abort_iotag(phba, pring, piocb);
        }
        spin_unlock_irq(&phba->hbalock);
@@ -3741,6 +3663,50 @@ lpfc_els_flush_cmd(struct lpfc_vport *vport)
        return;
 }
 
+void
+lpfc_els_flush_all_cmd(struct lpfc_hba  *phba)
+{
+       LIST_HEAD(completions);
+       struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
+       struct lpfc_iocbq *tmp_iocb, *piocb;
+       IOCB_t *cmd = NULL;
+
+       lpfc_fabric_abort_hba(phba);
+       spin_lock_irq(&phba->hbalock);
+       list_for_each_entry_safe(piocb, tmp_iocb, &pring->txq, list) {
+               cmd = &piocb->iocb;
+               if (piocb->iocb_flag & LPFC_IO_LIBDFC)
+                       continue;
+               /* Do not flush out the QUE_RING and ABORT/CLOSE iocbs */
+               if (cmd->ulpCommand == CMD_QUE_RING_BUF_CN ||
+                   cmd->ulpCommand == CMD_QUE_RING_BUF64_CN ||
+                   cmd->ulpCommand == CMD_CLOSE_XRI_CN ||
+                   cmd->ulpCommand == CMD_ABORT_XRI_CN)
+                       continue;
+               list_move_tail(&piocb->list, &completions);
+               pring->txq_cnt--;
+       }
+       list_for_each_entry_safe(piocb, tmp_iocb, &pring->txcmplq, list) {
+               if (piocb->iocb_flag & LPFC_IO_LIBDFC)
+                       continue;
+               lpfc_sli_issue_abort_iotag(phba, pring, piocb);
+       }
+       spin_unlock_irq(&phba->hbalock);
+       while (!list_empty(&completions)) {
+               piocb = list_get_first(&completions, struct lpfc_iocbq, list);
+               cmd = &piocb->iocb;
+               list_del_init(&piocb->list);
+               if (!piocb->iocb_cmpl)
+                       lpfc_sli_release_iocbq(phba, piocb);
+               else {
+                       cmd->ulpStatus = IOSTAT_LOCAL_REJECT;
+                       cmd->un.ulpWord[4] = IOERR_SLI_ABORTED;
+                       (piocb->iocb_cmpl) (phba, piocb, piocb);
+               }
+       }
+       return;
+}
+
 static void
 lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                      struct lpfc_vport *vport, struct lpfc_iocbq *elsiocb)
@@ -3801,11 +3767,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                cmd &= ELS_CMD_MASK;
        }
        /* ELS command <elsCmd> received from NPORT <did> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0112 ELS command x%x received from NPORT x%x "
-                       "Data: x%x\n", phba->brd_no, vport->vpi, cmd, did,
-                       vport->port_state);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0112 ELS command x%x received from NPORT x%x "
+                        "Data: x%x\n", cmd, did, vport->port_state);
        switch (cmd) {
        case ELS_CMD_PLOGI:
                lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_UNSOL,
@@ -3829,7 +3793,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                        did, vport->port_state, ndlp->nlp_flag);
 
                phba->fc_stat.elsRcvFLOGI++;
-               lpfc_els_rcv_flogi(vport, elsiocb, ndlp, newnode);
+               lpfc_els_rcv_flogi(vport, elsiocb, ndlp);
                if (newnode)
                        lpfc_drop_node(vport, ndlp);
                break;
@@ -3859,7 +3823,7 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                break;
        case ELS_CMD_RSCN:
                phba->fc_stat.elsRcvRSCN++;
-               lpfc_els_rcv_rscn(vport, elsiocb, ndlp, newnode);
+               lpfc_els_rcv_rscn(vport, elsiocb, ndlp);
                if (newnode)
                        lpfc_drop_node(vport, ndlp);
                break;
@@ -3974,10 +3938,9 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                rjt_err = LSRJT_INVALID_CMD;
 
                /* Unknown ELS command <elsCmd> received from NPORT <did> */
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0115 Unknown ELS command x%x "
-                               "received from NPORT x%x\n",
-                               phba->brd_no, vport->vpi, cmd, did);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0115 Unknown ELS command x%x "
+                                "received from NPORT x%x\n", cmd, did);
                if (newnode)
                        lpfc_drop_node(vport, ndlp);
                break;
@@ -3990,19 +3953,16 @@ lpfc_els_unsol_buffer(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                stat.un.b.lsRjtRsnCodeExp = LSEXP_NOTHING_MORE;
                lpfc_els_rsp_reject(vport, stat.un.lsRjtError, elsiocb, ndlp,
                        NULL);
-               if (newnode)
-                       lpfc_drop_node(vport, ndlp);
        }
 
        return;
 
 dropit:
        lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0111 Dropping received ELS cmd "
+                       "(%d):0111 Dropping received ELS cmd "
                        "Data: x%x x%x x%x\n",
-                       phba->brd_no, vport ? vport->vpi : 0xffff,
-                       icmd->ulpStatus, icmd->un.ulpWord[4],
-                       icmd->ulpTimeout);
+                       vport ? vport->vpi : 0xffff, icmd->ulpStatus,
+                       icmd->un.ulpWord[4], icmd->ulpTimeout);
        phba->fc_stat.elsRcvDrop++;
 }
 
@@ -4010,11 +3970,16 @@ static struct lpfc_vport *
 lpfc_find_vport_by_vpid(struct lpfc_hba *phba, uint16_t vpi)
 {
        struct lpfc_vport *vport;
+       unsigned long flags;
 
+       spin_lock_irqsave(&phba->hbalock, flags);
        list_for_each_entry(vport, &phba->port_list, listentry) {
-               if (vport->vpi == vpi)
+               if (vport->vpi == vpi) {
+                       spin_unlock_irqrestore(&phba->hbalock, flags);
                        return vport;
+               }
        }
+       spin_unlock_irqrestore(&phba->hbalock, flags);
        return NULL;
 }
 
@@ -4109,9 +4074,8 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
                                return;
                        }
                        lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-                       lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                               "%d (%d):0251 NameServer login: no memory\n",
-                               phba->brd_no, vport->vpi);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                        "0251 NameServer login: no memory\n");
                        return;
                }
                lpfc_nlp_init(vport, ndlp, NameServer_DID);
@@ -4122,13 +4086,12 @@ lpfc_do_scr_ns_plogi(struct lpfc_hba *phba, struct lpfc_vport *vport)
 
        if (lpfc_issue_els_plogi(vport, ndlp->nlp_DID, 0)) {
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0252 Cannot issue NameServer login\n",
-                       phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0252 Cannot issue NameServer login\n");
                return;
        }
 
-       if (phba->cfg_fdmi_on) {
+       if (vport->cfg_fdmi_on) {
                ndlp_fdmi = mempool_alloc(phba->nlp_mem_pool,
                                          GFP_KERNEL);
                if (ndlp_fdmi) {
@@ -4155,9 +4118,9 @@ lpfc_cmpl_reg_new_vport(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        lpfc_nlp_put(ndlp);
 
        if (mb->mbxStatus) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                               "%d (%d):0915 Register VPI failed: 0x%x\n",
-                               phba->brd_no, vport->vpi, mb->mbxStatus);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                                "0915 Register VPI failed: 0x%x\n",
+                                mb->mbxStatus);
 
                switch (mb->mbxStatus) {
                case 0x11:      /* unsupported feature */
@@ -4206,17 +4169,14 @@ lpfc_register_new_vport(struct lpfc_hba *phba, struct lpfc_vport *vport,
                        vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
 
                        lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-
-                       lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                               "%d (%d):0253 Register VPI: Cannot send mbox\n",
-                               phba->brd_no, vport->vpi);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                               "0253 Register VPI: Can't send mbox\n");
                }
        } else {
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
 
-               lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                       "%d (%d):0254 Register VPI: no memory\n",
-                       phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                                "0254 Register VPI: no memory\n");
 
                vport->fc_flag &= ~FC_VPORT_NEEDS_REG_VPI;
                lpfc_nlp_put(ndlp);
@@ -4235,11 +4195,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
        IOCB_t *irsp = &rspiocb->iocb;
        struct lpfc_iocbq *piocb;
 
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-               "%d (%d):0123 FDISC completes. x%x/x%x prevDID: x%x\n",
-               phba->brd_no, vport->vpi,
-               irsp->ulpStatus, irsp->un.ulpWord[4], vport->fc_prevDID);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0123 FDISC completes. x%x/x%x prevDID: x%x\n",
+                        irsp->ulpStatus, irsp->un.ulpWord[4],
+                        vport->fc_prevDID);
        /* Since all FDISCs are being single threaded, we
         * must reset the discovery timer for ALL vports
         * waiting to send FDISC when one completes.
@@ -4256,13 +4215,10 @@ lpfc_cmpl_els_fdisc(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                /* Check for retry */
                if (lpfc_els_retry(phba, cmdiocb, rspiocb))
                        goto out;
-
                /* FDISC failed */
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0124 FDISC failed. (%d/%d)\n",
-                       phba->brd_no, vport->vpi,
-                       irsp->ulpStatus, irsp->un.ulpWord[4]);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0124 FDISC failed. (%d/%d)\n",
+                                irsp->ulpStatus, irsp->un.ulpWord[4]);
                if (vport->fc_vport->vport_state == FC_VPORT_INITIALIZING)
                        lpfc_vport_set_state(vport, FC_VPORT_FAILED);
 
@@ -4328,10 +4284,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                                     ELS_CMD_FDISC);
        if (!elsiocb) {
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0255 Issue FDISC: no IOCB\n",
-                       phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0255 Issue FDISC: no IOCB\n");
                return 1;
        }
 
@@ -4377,11 +4331,8 @@ lpfc_issue_els_fdisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        if (rc == IOCB_ERROR) {
                lpfc_els_free_iocb(phba, elsiocb);
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0256 Issue FDISC: Cannot send IOCB\n",
-                       phba->brd_no, vport->vpi);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0256 Issue FDISC: Cannot send IOCB\n");
                return 1;
        }
        lpfc_vport_set_state(vport, FC_VPORT_INITIALIZING);
index f2f4639eab592466c6c2c919b9800b56b3c21c3f..c81c2b3228d637c9047f56e5224e9014d182c281 100644 (file)
@@ -83,10 +83,17 @@ lpfc_terminate_rport_io(struct fc_rport *rport)
                ndlp->nlp_sid, ndlp->nlp_DID, ndlp->nlp_flag);
 
        if (ndlp->nlp_sid != NLP_NO_SID) {
-               lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
-                       ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT);
+               lpfc_sli_abort_iocb(ndlp->vport,
+                       &phba->sli.ring[phba->sli.fcp_ring],
+                       ndlp->nlp_sid, 0, LPFC_CTX_TGT);
        }
 
+       /*
+        * A device is normally blocked for rediscovery and unblocked when
+        * devloss timeout happens.  In case a vport is removed or driver
+        * unloaded before devloss timeout happens, we need to unblock here.
+        */
+       scsi_target_unblock(&rport->dev);
        return;
 }
 
@@ -194,32 +201,30 @@ lpfc_dev_loss_tmo_handler(struct lpfc_nodelist *ndlp)
        if (ndlp->nlp_sid != NLP_NO_SID) {
                warn_on = 1;
                /* flush the target */
-               lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
-                                   ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT);
+               lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
+                                   ndlp->nlp_sid, 0, LPFC_CTX_TGT);
        }
        if (vport->load_flag & FC_UNLOADING)
                warn_on = 0;
 
        if (warn_on) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0203 Devloss timeout on "
-                               "WWPN %x:%x:%x:%x:%x:%x:%x:%x "
-                               "NPort x%x Data: x%x x%x x%x\n",
-                               phba->brd_no, vport->vpi,
-                               *name, *(name+1), *(name+2), *(name+3),
-                               *(name+4), *(name+5), *(name+6), *(name+7),
-                               ndlp->nlp_DID, ndlp->nlp_flag,
-                               ndlp->nlp_state, ndlp->nlp_rpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0203 Devloss timeout on "
+                                "WWPN %x:%x:%x:%x:%x:%x:%x:%x "
+                                "NPort x%x Data: x%x x%x x%x\n",
+                                *name, *(name+1), *(name+2), *(name+3),
+                                *(name+4), *(name+5), *(name+6), *(name+7),
+                                ndlp->nlp_DID, ndlp->nlp_flag,
+                                ndlp->nlp_state, ndlp->nlp_rpi);
        } else {
-               lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                               "%d (%d):0204 Devloss timeout on "
-                               "WWPN %x:%x:%x:%x:%x:%x:%x:%x "
-                               "NPort x%x Data: x%x x%x x%x\n",
-                               phba->brd_no, vport->vpi,
-                               *name, *(name+1), *(name+2), *(name+3),
-                               *(name+4), *(name+5), *(name+6), *(name+7),
-                               ndlp->nlp_DID, ndlp->nlp_flag,
-                               ndlp->nlp_state, ndlp->nlp_rpi);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                                "0204 Devloss timeout on "
+                                "WWPN %x:%x:%x:%x:%x:%x:%x:%x "
+                                "NPort x%x Data: x%x x%x x%x\n",
+                                *name, *(name+1), *(name+2), *(name+3),
+                                *(name+4), *(name+5), *(name+6), *(name+7),
+                                ndlp->nlp_DID, ndlp->nlp_flag,
+                                ndlp->nlp_state, ndlp->nlp_rpi);
        }
 
        if (!(vport->load_flag & FC_UNLOADING) &&
@@ -344,12 +349,14 @@ lpfc_work_list_done(struct lpfc_hba *phba)
 
 }
 
-void
+static void
 lpfc_work_done(struct lpfc_hba *phba)
 {
        struct lpfc_sli_ring *pring;
        uint32_t ha_copy, status, control, work_port_events;
+       struct lpfc_vport **vports;
        struct lpfc_vport *vport;
+       int i;
 
        spin_lock_irq(&phba->hbalock);
        ha_copy = phba->work_ha;
@@ -364,48 +371,41 @@ lpfc_work_done(struct lpfc_hba *phba)
 
        if (ha_copy & HA_LATT)
                lpfc_handle_latt(phba);
-
-       spin_lock_irq(&phba->hbalock);
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               struct Scsi_Host  *shost = lpfc_shost_from_vport(vport);
-
-               if (!scsi_host_get(shost)) {
-                       continue;
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS; i++) {
+                       /*
+                        * We could have no vports in array if unloading, so if
+                        * this happens then just use the pport
+                        */
+                       if (vports[i] == NULL && i == 0)
+                               vport = phba->pport;
+                       else
+                               vport = vports[i];
+                       if (vport == NULL)
+                               break;
+                       work_port_events = vport->work_port_events;
+                       if (work_port_events & WORKER_DISC_TMO)
+                               lpfc_disc_timeout_handler(vport);
+                       if (work_port_events & WORKER_ELS_TMO)
+                               lpfc_els_timeout_handler(vport);
+                       if (work_port_events & WORKER_HB_TMO)
+                               lpfc_hb_timeout_handler(phba);
+                       if (work_port_events & WORKER_MBOX_TMO)
+                               lpfc_mbox_timeout_handler(phba);
+                       if (work_port_events & WORKER_FABRIC_BLOCK_TMO)
+                               lpfc_unblock_fabric_iocbs(phba);
+                       if (work_port_events & WORKER_FDMI_TMO)
+                               lpfc_fdmi_timeout_handler(vport);
+                       if (work_port_events & WORKER_RAMP_DOWN_QUEUE)
+                               lpfc_ramp_down_queue_handler(phba);
+                       if (work_port_events & WORKER_RAMP_UP_QUEUE)
+                               lpfc_ramp_up_queue_handler(phba);
+                       spin_lock_irq(&vport->work_port_lock);
+                       vport->work_port_events &= ~work_port_events;
+                       spin_unlock_irq(&vport->work_port_lock);
                }
-               spin_unlock_irq(&phba->hbalock);
-               work_port_events = vport->work_port_events;
-
-               if (work_port_events & WORKER_DISC_TMO)
-                       lpfc_disc_timeout_handler(vport);
-
-               if (work_port_events & WORKER_ELS_TMO)
-                       lpfc_els_timeout_handler(vport);
-
-               if (work_port_events & WORKER_HB_TMO)
-                       lpfc_hb_timeout_handler(phba);
-
-               if (work_port_events & WORKER_MBOX_TMO)
-                       lpfc_mbox_timeout_handler(phba);
-
-               if (work_port_events & WORKER_FABRIC_BLOCK_TMO)
-                       lpfc_unblock_fabric_iocbs(phba);
-
-               if (work_port_events & WORKER_FDMI_TMO)
-                       lpfc_fdmi_timeout_handler(vport);
-
-               if (work_port_events & WORKER_RAMP_DOWN_QUEUE)
-                       lpfc_ramp_down_queue_handler(phba);
-
-               if (work_port_events & WORKER_RAMP_UP_QUEUE)
-                       lpfc_ramp_up_queue_handler(phba);
-
-               spin_lock_irq(&vport->work_port_lock);
-               vport->work_port_events &= ~work_port_events;
-               spin_unlock_irq(&vport->work_port_lock);
-               scsi_host_put(shost);
-               spin_lock_irq(&phba->hbalock);
-       }
-       spin_unlock_irq(&phba->hbalock);
+       lpfc_destroy_vport_work_array(vports);
 
        pring = &phba->sli.ring[LPFC_ELS_RING];
        status = (ha_copy & (HA_RXMASK  << (4*LPFC_ELS_RING)));
@@ -426,10 +426,19 @@ lpfc_work_done(struct lpfc_hba *phba)
                spin_lock_irq(&phba->hbalock);
                control = readl(phba->HCregaddr);
                if (!(control & (HC_R0INT_ENA << LPFC_ELS_RING))) {
+                       lpfc_debugfs_slow_ring_trc(phba,
+                               "WRK Enable ring: cntl:x%x hacopy:x%x",
+                               control, ha_copy, 0);
+
                        control |= (HC_R0INT_ENA << LPFC_ELS_RING);
                        writel(control, phba->HCregaddr);
                        readl(phba->HCregaddr); /* flush */
                }
+               else {
+                       lpfc_debugfs_slow_ring_trc(phba,
+                               "WRK Ring ok:     cntl:x%x hacopy:x%x",
+                               control, ha_copy, 0);
+               }
                spin_unlock_irq(&phba->hbalock);
        }
        lpfc_work_list_done(phba);
@@ -439,32 +448,22 @@ static int
 check_work_wait_done(struct lpfc_hba *phba)
 {
        struct lpfc_vport *vport;
-       struct lpfc_sli_ring *pring;
+       struct lpfc_sli_ring *pring = &phba->sli.ring[LPFC_ELS_RING];
        int rc = 0;
 
        spin_lock_irq(&phba->hbalock);
        list_for_each_entry(vport, &phba->port_list, listentry) {
                if (vport->work_port_events) {
                        rc = 1;
-                       goto exit;
+                       break;
                }
        }
-
-       if (phba->work_ha || (!list_empty(&phba->work_list)) ||
-           kthread_should_stop()) {
-               rc = 1;
-               goto exit;
-       }
-
-       pring = &phba->sli.ring[LPFC_ELS_RING];
-       if (pring->flag & LPFC_DEFERRED_RING_EVENT)
+       if (rc || phba->work_ha || (!list_empty(&phba->work_list)) ||
+           kthread_should_stop() || pring->flag & LPFC_DEFERRED_RING_EVENT) {
                rc = 1;
-exit:
-       if (rc)
                phba->work_found++;
-       else
+       else
                phba->work_found = 0;
-
        spin_unlock_irq(&phba->hbalock);
        return rc;
 }
@@ -592,7 +591,6 @@ lpfc_linkdown_port(struct lpfc_vport *vport)
 
        /* free any ndlp's on unused list */
        list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes, nlp_listp)
-                               /* free any ndlp's in unused state */
                if (ndlp->nlp_state == NLP_STE_UNUSED_NODE)
                        lpfc_drop_node(vport, ndlp);
 
@@ -605,8 +603,9 @@ lpfc_linkdown(struct lpfc_hba *phba)
 {
        struct lpfc_vport *vport = phba->pport;
        struct Scsi_Host  *shost = lpfc_shost_from_vport(vport);
-       struct lpfc_vport *port_iterator;
+       struct lpfc_vport **vports;
        LPFC_MBOXQ_t          *mb;
+       int i;
 
        if (phba->link_state == LPFC_LINK_DOWN) {
                return 0;
@@ -617,13 +616,13 @@ lpfc_linkdown(struct lpfc_hba *phba)
                phba->pport->fc_flag &= ~FC_LBIT;
        }
        spin_unlock_irq(&phba->hbalock);
-
-       list_for_each_entry(port_iterator, &phba->port_list, listentry) {
-
-                               /* Issue a LINK DOWN event to all nodes */
-               lpfc_linkdown_port(port_iterator);
-       }
-
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
+                       /* Issue a LINK DOWN event to all nodes */
+                       lpfc_linkdown_port(vports[i]);
+               }
+       lpfc_destroy_vport_work_array(vports);
        /* Clean up any firmware default rpi's */
        mb = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
        if (mb) {
@@ -724,7 +723,8 @@ lpfc_linkup_port(struct lpfc_vport *vport)
 static int
 lpfc_linkup(struct lpfc_hba *phba)
 {
-       struct lpfc_vport *vport;
+       struct lpfc_vport **vports;
+       int i;
 
        phba->link_state = LPFC_LINK_UP;
 
@@ -732,9 +732,11 @@ lpfc_linkup(struct lpfc_hba *phba)
        clear_bit(FABRIC_COMANDS_BLOCKED, &phba->bit_flags);
        del_timer_sync(&phba->fabric_block_timer);
 
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               lpfc_linkup_port(vport);
-       }
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++)
+                       lpfc_linkup_port(vports[i]);
+       lpfc_destroy_vport_work_array(vports);
        if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)
                lpfc_issue_clear_la(phba, phba->pport);
 
@@ -764,12 +766,10 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        /* Check for error */
        if ((mb->mbxStatus) && (mb->mbxStatus != 0x1601)) {
                /* CLEAR_LA mbox error <mbxStatus> state <hba_state> */
-               lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                               "%d (%d):0320 CLEAR_LA mbxStatus error x%x hba "
-                               "state x%x\n",
-                               phba->brd_no, vport->vpi, mb->mbxStatus,
-                               vport->port_state);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                                "0320 CLEAR_LA mbxStatus error x%x hba "
+                                "state x%x\n",
+                                mb->mbxStatus, vport->port_state);
                phba->link_state = LPFC_HBA_ERROR;
                goto out;
        }
@@ -801,10 +801,8 @@ lpfc_mbx_cmpl_clear_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 
 out:
        /* Device Discovery completes */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0225 Device Discovery completes\n",
-                       phba->brd_no, vport->vpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0225 Device Discovery completes\n");
        mempool_free(pmb, phba->mbox_mem_pool);
 
        spin_lock_irq(shost->host_lock);
@@ -861,19 +859,17 @@ lpfc_mbx_cmpl_local_config_link(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        return;
 
 out:
-       lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                       "%d (%d):0306 CONFIG_LINK mbxStatus error x%x "
-                       "HBA state x%x\n",
-                       phba->brd_no, vport->vpi, pmb->mb.mbxStatus,
-                       vport->port_state);
-
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                        "0306 CONFIG_LINK mbxStatus error x%x "
+                        "HBA state x%x\n",
+                        pmb->mb.mbxStatus, vport->port_state);
        mempool_free(pmb, phba->mbox_mem_pool);
 
        lpfc_linkdown(phba);
 
-       lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                       "%d (%d):0200 CONFIG_LINK bad hba state x%x\n",
-                       phba->brd_no, vport->vpi, vport->port_state);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                        "0200 CONFIG_LINK bad hba state x%x\n",
+                        vport->port_state);
 
        lpfc_issue_clear_la(phba, vport);
        return;
@@ -890,12 +886,10 @@ lpfc_mbx_cmpl_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        /* Check for error */
        if (mb->mbxStatus) {
                /* READ_SPARAM mbox error <mbxStatus> state <hba_state> */
-               lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                               "%d (%d):0319 READ_SPARAM mbxStatus error x%x "
-                               "hba state x%x>\n",
-                               phba->brd_no, vport->vpi, mb->mbxStatus,
-                               vport->port_state);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                                "0319 READ_SPARAM mbxStatus error x%x "
+                                "hba state x%x>\n",
+                                mb->mbxStatus, vport->port_state);
                lpfc_linkdown(phba);
                goto out;
        }
@@ -978,7 +972,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
                if (i == 0) {
                        phba->alpa_map[0] = 0;
                } else {
-                       if (phba->cfg_log_verbose & LOG_LINK_EVENT) {
+                       if (vport->cfg_log_verbose & LOG_LINK_EVENT) {
                                int numalpa, j, k;
                                union {
                                        uint8_t pamap[16];
@@ -1004,10 +998,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
                                        lpfc_printf_log(phba,
                                                        KERN_WARNING,
                                                        LOG_LINK_EVENT,
-                                                       "%d:1304 Link Up Event "
+                                                       "1304 Link Up Event "
                                                        "ALPA map Data: x%x "
                                                        "x%x x%x x%x\n",
-                                                       phba->brd_no,
                                                        un.pa.wd1, un.pa.wd2,
                                                        un.pa.wd3, un.pa.wd4);
                                }
@@ -1015,7 +1008,7 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
                }
        } else {
                if (!(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) {
-                       if (phba->max_vpi && phba->cfg_npiv_enable &&
+                       if (phba->max_vpi && phba->cfg_enable_npiv &&
                           (phba->sli_rev == 3))
                                phba->sli3_options |= LPFC_SLI3_NPIV_ENABLED;
                }
@@ -1055,11 +1048,9 @@ lpfc_mbx_process_link_up(struct lpfc_hba *phba, READ_LA_VAR *la)
        }
 out:
        lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-       lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-               "%d (%d):0263 Discovery Mailbox error: state: 0x%x : %p %p\n",
-               phba->brd_no, vport->vpi,
-               vport->port_state, sparam_mbox, cfglink_mbox);
-
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                        "0263 Discovery Mailbox error: state: 0x%x : %p %p\n",
+                        vport->port_state, sparam_mbox, cfglink_mbox);
        lpfc_issue_clear_la(phba, vport);
        return;
 }
@@ -1100,8 +1091,8 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        /* Check for error */
        if (mb->mbxStatus) {
                lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
-                               "%d:1307 READ_LA mbox error x%x state x%x\n",
-                               phba->brd_no, mb->mbxStatus, vport->port_state);
+                               "1307 READ_LA mbox error x%x state x%x\n",
+                               mb->mbxStatus, vport->port_state);
                lpfc_mbx_issue_link_down(phba);
                phba->link_state = LPFC_HBA_ERROR;
                goto lpfc_mbx_cmpl_read_la_free_mbuf;
@@ -1132,26 +1123,26 @@ lpfc_mbx_cmpl_read_la(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                phba->fc_stat.LinkUp++;
                if (phba->link_flag & LS_LOOPBACK_MODE) {
                        lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
-                               "%d:1306 Link Up Event in loop back mode "
-                               "x%x received Data: x%x x%x x%x x%x\n",
-                               phba->brd_no, la->eventTag, phba->fc_eventTag,
-                               la->granted_AL_PA, la->UlnkSpeed,
-                               phba->alpa_map[0]);
+                                       "1306 Link Up Event in loop back mode "
+                                       "x%x received Data: x%x x%x x%x x%x\n",
+                                       la->eventTag, phba->fc_eventTag,
+                                       la->granted_AL_PA, la->UlnkSpeed,
+                                       phba->alpa_map[0]);
                } else {
                        lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
-                               "%d:1303 Link Up Event x%x received "
-                               "Data: x%x x%x x%x x%x\n",
-                               phba->brd_no, la->eventTag, phba->fc_eventTag,
-                               la->granted_AL_PA, la->UlnkSpeed,
-                               phba->alpa_map[0]);
+                                       "1303 Link Up Event x%x received "
+                                       "Data: x%x x%x x%x x%x\n",
+                                       la->eventTag, phba->fc_eventTag,
+                                       la->granted_AL_PA, la->UlnkSpeed,
+                                       phba->alpa_map[0]);
                }
                lpfc_mbx_process_link_up(phba, la);
        } else {
                phba->fc_stat.LinkDown++;
                lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
-                               "%d:1305 Link Down Event x%x received "
+                               "1305 Link Down Event x%x received "
                                "Data: x%x x%x x%x\n",
-                               phba->brd_no, la->eventTag, phba->fc_eventTag,
+                               la->eventTag, phba->fc_eventTag,
                                phba->pport->port_state, vport->fc_flag);
                lpfc_mbx_issue_link_down(phba);
        }
@@ -1199,10 +1190,9 @@ lpfc_mbx_cmpl_unreg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        case 0x0011:
        case 0x0020:
        case 0x9700:
-               lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                               "%d (%d):0911 cmpl_unreg_vpi, "
-                               "mb status = 0x%x\n",
-                               phba->brd_no, vport->vpi, mb->mbxStatus);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
+                                "0911 cmpl_unreg_vpi, mb status = 0x%x\n",
+                                mb->mbxStatus);
                break;
        }
        vport->unreg_vpi_cmpl = VPORT_OK;
@@ -1231,9 +1221,8 @@ lpfc_mbx_unreg_vpi(struct lpfc_vport *vport)
        mbox->mbox_cmpl = lpfc_mbx_cmpl_unreg_vpi;
        rc = lpfc_sli_issue_mbox(phba, mbox, (MBX_NOWAIT | MBX_STOP_IOCB));
        if (rc == MBX_NOT_FINISHED) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT,
-                               "%d (%d):1800 Could not issue unreg_vpi\n",
-                               phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
+                                "1800 Could not issue unreg_vpi\n");
                mempool_free(mbox, phba->mbox_mem_pool);
                vport->unreg_vpi_cmpl = VPORT_ERROR;
        }
@@ -1250,9 +1239,9 @@ lpfc_mbx_cmpl_reg_vpi(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        case 0x0011:
        case 0x9601:
        case 0x9602:
-               lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                               "%d (%d):0912 cmpl_reg_vpi, mb status = 0x%x\n",
-                               phba->brd_no, vport->vpi, mb->mbxStatus);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
+                                "0912 cmpl_reg_vpi, mb status = 0x%x\n",
+                                mb->mbxStatus);
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
                spin_lock_irq(shost->host_lock);
                vport->fc_flag &= ~(FC_FABRIC | FC_PUBLIC_LOOP);
@@ -1289,15 +1278,15 @@ void
 lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 {
        struct lpfc_vport *vport = pmb->vport;
-       struct lpfc_vport *next_vport;
        MAILBOX_t *mb = &pmb->mb;
        struct lpfc_dmabuf *mp = (struct lpfc_dmabuf *) (pmb->context1);
        struct lpfc_nodelist *ndlp;
-       ndlp = (struct lpfc_nodelist *) pmb->context2;
+       struct lpfc_vport **vports;
+       int i;
 
+       ndlp = (struct lpfc_nodelist *) pmb->context2;
        pmb->context1 = NULL;
        pmb->context2 = NULL;
-
        if (mb->mbxStatus) {
                lpfc_mbuf_free(phba, mp->virt, mp->phys);
                kfree(mp);
@@ -1314,10 +1303,9 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
                }
 
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-               lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                       "%d (%d):0258 Register Fabric login error: 0x%x\n",
-                       phba->brd_no, vport->vpi, mb->mbxStatus);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX,
+                                "0258 Register Fabric login error: 0x%x\n",
+                                mb->mbxStatus);
                return;
        }
 
@@ -1328,21 +1316,26 @@ lpfc_mbx_cmpl_fabric_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
        lpfc_nlp_put(ndlp);     /* Drop the reference from the mbox */
 
        if (vport->port_state == LPFC_FABRIC_CFG_LINK) {
-               list_for_each_entry(next_vport, &phba->port_list, listentry) {
-                       if (next_vport->port_type == LPFC_PHYSICAL_PORT)
-                               continue;
-
-                       if (phba->link_flag & LS_NPIV_FAB_SUPPORTED)
-                               lpfc_initial_fdisc(next_vport);
-                       else if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED) {
-                               lpfc_vport_set_state(vport,
-                                                    FC_VPORT_NO_FABRIC_SUPP);
-                               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                                               "%d (%d):0259 No NPIV Fabric "
-                                               "support\n",
-                                               phba->brd_no, vport->vpi);
+               vports = lpfc_create_vport_work_array(phba);
+               if (vports != NULL)
+                       for(i = 0;
+                           i < LPFC_MAX_VPORTS && vports[i] != NULL;
+                           i++) {
+                               if (vports[i]->port_type == LPFC_PHYSICAL_PORT)
+                                       continue;
+                               if (phba->link_flag & LS_NPIV_FAB_SUPPORTED)
+                                       lpfc_initial_fdisc(vports[i]);
+                               else if (phba->sli3_options &
+                                               LPFC_SLI3_NPIV_ENABLED) {
+                                       lpfc_vport_set_state(vports[i],
+                                               FC_VPORT_NO_FABRIC_SUPP);
+                                       lpfc_printf_vlog(vport, KERN_ERR,
+                                                        LOG_ELS,
+                                                       "0259 No NPIV "
+                                                       "Fabric support\n");
+                               }
                        }
-               }
+               lpfc_destroy_vport_work_array(vports);
                lpfc_do_scr_ns_plogi(phba, vport);
        }
 
@@ -1386,9 +1379,9 @@ out:
                        return;
                }
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0260 Register NameServer error: 0x%x\n",
-                       phba->brd_no, vport->vpi, mb->mbxStatus);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0260 Register NameServer error: 0x%x\n",
+                                mb->mbxStatus);
                return;
        }
 
@@ -1598,7 +1591,7 @@ lpfc_nlp_state_name(char *buffer, size_t size, int state)
                [NLP_STE_NPR_NODE] = "NPR",
        };
 
-       if (state < ARRAY_SIZE(states) && states[state])
+       if (state < NLP_STE_MAX_STATE && states[state])
                strlcpy(buffer, states[state], size);
        else
                snprintf(buffer, size, "unknown (%d)", state);
@@ -1613,12 +1606,11 @@ lpfc_nlp_set_state(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        int  old_state = ndlp->nlp_state;
        char name1[16], name2[16];
 
-       lpfc_printf_log(vport->phba, KERN_INFO, LOG_NODE,
-                       "%d (%d):0904 NPort state transition x%06x, %s -> %s\n",
-                       vport->phba->brd_no, vport->vpi,
-                       ndlp->nlp_DID,
-                       lpfc_nlp_state_name(name1, sizeof(name1), old_state),
-                       lpfc_nlp_state_name(name2, sizeof(name2), state));
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
+                        "0904 NPort state transition x%06x, %s -> %s\n",
+                        ndlp->nlp_DID,
+                        lpfc_nlp_state_name(name1, sizeof(name1), old_state),
+                        lpfc_nlp_state_name(name2, sizeof(name2), state));
 
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_NODE,
                "node statechg    did:x%x old:%d ste:%d",
@@ -1664,16 +1656,7 @@ lpfc_dequeue_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 void
 lpfc_drop_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 {
-       struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
-
-       if ((ndlp->nlp_flag & NLP_DELAY_TMO) != 0)
-               lpfc_cancel_retry_delay_tmo(vport, ndlp);
-       if (ndlp->nlp_state && !list_empty(&ndlp->nlp_listp))
-               lpfc_nlp_counters(vport, ndlp->nlp_state, -1);
-       spin_lock_irq(shost->host_lock);
-       list_del_init(&ndlp->nlp_listp);
-       ndlp->nlp_flag &= ~NLP_TARGET_REMOVE;
-       spin_unlock_irq(shost->host_lock);
+       lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE);
        lpfc_nlp_put(ndlp);
 }
 
@@ -1710,12 +1693,12 @@ lpfc_set_disctmo(struct lpfc_vport *vport)
        spin_unlock_irq(shost->host_lock);
 
        /* Start Discovery Timer state <hba_state> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0247 Start Discovery Timer state x%x "
-                       "Data: x%x x%lx x%x x%x\n",
-                       phba->brd_no, vport->vpi, vport->port_state, tmo,
-                       (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt,
-                       vport->fc_adisc_cnt);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0247 Start Discovery Timer state x%x "
+                        "Data: x%x x%lx x%x x%x\n",
+                        vport->port_state, tmo,
+                        (unsigned long)&vport->fc_disctmo, vport->fc_plogi_cnt,
+                        vport->fc_adisc_cnt);
 
        return;
 }
@@ -1727,7 +1710,6 @@ int
 lpfc_can_disctmo(struct lpfc_vport *vport)
 {
        struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
-       struct lpfc_hba  *phba = vport->phba;
        unsigned long iflags;
 
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_ELS_CMD,
@@ -1746,13 +1728,11 @@ lpfc_can_disctmo(struct lpfc_vport *vport)
        }
 
        /* Cancel Discovery Timer state <hba_state> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0248 Cancel Discovery Timer state x%x "
-                       "Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, vport->port_state,
-                       vport->fc_flag, vport->fc_plogi_cnt,
-                       vport->fc_adisc_cnt);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0248 Cancel Discovery Timer state x%x "
+                        "Data: x%x x%x x%x\n",
+                        vport->port_state, vport->fc_flag,
+                        vport->fc_plogi_cnt, vport->fc_adisc_cnt);
        return 0;
 }
 
@@ -1935,10 +1915,9 @@ lpfc_unreg_default_rpis(struct lpfc_vport *vport)
                rc = lpfc_sli_issue_mbox(phba, mbox,
                                         (MBX_NOWAIT | MBX_STOP_IOCB));
                if (rc == MBX_NOT_FINISHED) {
-                       lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_VPORT,
-                                       "%d (%d):1815 Could not issue "
-                                       "unreg_did (default rpis)\n",
-                                       phba->brd_no, vport->vpi);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_MBOX | LOG_VPORT,
+                                        "1815 Could not issue "
+                                        "unreg_did (default rpis)\n");
                        mempool_free(mbox, phba->mbox_mem_pool);
                }
        }
@@ -1957,12 +1936,11 @@ lpfc_cleanup_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
        struct lpfc_dmabuf *mp;
 
        /* Cleanup node for NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                       "%d (%d):0900 Cleanup node for NPort x%x "
-                       "Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, ndlp->nlp_DID, ndlp->nlp_flag,
-                       ndlp->nlp_state, ndlp->nlp_rpi);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
+                        "0900 Cleanup node for NPort x%x "
+                        "Data: x%x x%x x%x\n",
+                        ndlp->nlp_DID, ndlp->nlp_flag,
+                        ndlp->nlp_state, ndlp->nlp_rpi);
        lpfc_dequeue_node(vport, ndlp);
 
        /* cleanup any ndlp on mbox q waiting for reglogin cmpl */
@@ -2094,7 +2072,6 @@ lpfc_matchdid(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 static struct lpfc_nodelist *
 __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
 {
-       struct lpfc_hba  *phba = vport->phba;
        struct lpfc_nodelist *ndlp;
        uint32_t data1;
 
@@ -2104,20 +2081,18 @@ __lpfc_findnode_did(struct lpfc_vport *vport, uint32_t did)
                                 ((uint32_t) ndlp->nlp_xri << 16) |
                                 ((uint32_t) ndlp->nlp_type << 8) |
                                 ((uint32_t) ndlp->nlp_rpi & 0xff));
-                       lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                                       "%d (%d):0929 FIND node DID "
-                                       " Data: x%p x%x x%x x%x\n",
-                                       phba->brd_no, vport->vpi,
-                                       ndlp, ndlp->nlp_DID,
-                                       ndlp->nlp_flag, data1);
+                       lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
+                                        "0929 FIND node DID "
+                                        "Data: x%p x%x x%x x%x\n",
+                                        ndlp, ndlp->nlp_DID,
+                                        ndlp->nlp_flag, data1);
                        return ndlp;
                }
        }
 
        /* FIND node did <did> NOT FOUND */
-       lpfc_printf_log(phba, KERN_INFO, LOG_NODE,
-                       "%d (%d):0932 FIND node did x%x NOT FOUND.\n",
-                       phba->brd_no, vport->vpi, did);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_NODE,
+                        "0932 FIND node did x%x NOT FOUND.\n", did);
        return NULL;
 }
 
@@ -2208,7 +2183,7 @@ lpfc_disc_list_loopmap(struct lpfc_vport *vport)
                        /* If cfg_scan_down is set, start from highest
                         * ALPA (0xef) to lowest (0x1).
                         */
-                       if (phba->cfg_scan_down)
+                       if (vport->cfg_scan_down)
                                index = j;
                        else
                                index = FC_MAXLOOP - j - 1;
@@ -2309,12 +2284,11 @@ lpfc_disc_start(struct lpfc_vport *vport)
        vport->num_disc_nodes = 0;
 
        /* Start Discovery state <hba_state> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0202 Start Discovery hba state x%x "
-                       "Data: x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi, vport->port_state,
-                       vport->fc_flag, vport->fc_plogi_cnt,
-                       vport->fc_adisc_cnt);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0202 Start Discovery hba state x%x "
+                        "Data: x%x x%x x%x\n",
+                        vport->port_state, vport->fc_flag, vport->fc_plogi_cnt,
+                        vport->fc_adisc_cnt);
 
        /* First do ADISCs - if any */
        num_sent = lpfc_els_disc_adisc(vport);
@@ -2532,10 +2506,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
         * FAN
         */
                                /* FAN timeout */
-               lpfc_printf_log(phba, KERN_WARNING, LOG_DISCOVERY,
-                               "%d (%d):0221 FAN timeout\n",
-                               phba->brd_no, vport->vpi);
-
+               lpfc_printf_vlog(vport, KERN_WARNING, LOG_DISCOVERY,
+                                "0221 FAN timeout\n");
                /* Start discovery by sending FLOGI, clean up old rpis */
                list_for_each_entry_safe(ndlp, next_ndlp, &vport->fc_nodes,
                                         nlp_listp) {
@@ -2562,10 +2534,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
        case LPFC_FLOGI:
        /* port_state is identically LPFC_FLOGI while waiting for FLOGI cmpl */
                /* Initial FLOGI timeout */
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0222 Initial %s timeout\n",
-                               phba->brd_no, vport->vpi,
-                               vport->vpi ? "FLOGI" : "FDISC");
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0222 Initial %s timeout\n",
+                                vport->vpi ? "FLOGI" : "FDISC");
 
                /* Assume no Fabric and go on with discovery.
                 * Check for outstanding ELS FLOGI to abort.
@@ -2581,11 +2552,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
        case LPFC_FABRIC_CFG_LINK:
        /* hba_state is identically LPFC_FABRIC_CFG_LINK while waiting for
           NameServer login */
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0223 Timeout while waiting for "
-                               "NameServer login\n",
-                               phba->brd_no, vport->vpi);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0223 Timeout while waiting for "
+                                "NameServer login\n");
                /* Next look for NameServer ndlp */
                ndlp = lpfc_findnode_did(vport, NameServer_DID);
                if (ndlp)
@@ -2596,11 +2565,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
 
        case LPFC_NS_QRY:
        /* Check for wait for NameServer Rsp timeout */
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0224 NameServer Query timeout "
-                               "Data: x%x x%x\n",
-                               phba->brd_no, vport->vpi,
-                               vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0224 NameServer Query timeout "
+                                "Data: x%x x%x\n",
+                                vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
 
                if (vport->fc_ns_retry < LPFC_MAX_NS_RETRY) {
                        /* Try it one more time */
@@ -2627,10 +2595,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
                /* Setup and issue mailbox INITIALIZE LINK command */
                initlinkmbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
                if (!initlinkmbox) {
-                       lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                                       "%d (%d):0206 Device Discovery "
-                                       "completion error\n",
-                                       phba->brd_no, vport->vpi);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                        "0206 Device Discovery "
+                                        "completion error\n");
                        phba->link_state = LPFC_HBA_ERROR;
                        break;
                }
@@ -2651,9 +2618,8 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
 
        case LPFC_DISC_AUTH:
        /* Node Authentication timeout */
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0227 Node Authentication timeout\n",
-                               phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0227 Node Authentication timeout\n");
                lpfc_disc_flush_list(vport);
 
                /*
@@ -2670,11 +2636,10 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
 
        case LPFC_VPORT_READY:
                if (vport->fc_flag & FC_RSCN_MODE) {
-                       lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                                       "%d (%d):0231 RSCN timeout Data: x%x "
-                                       "x%x\n",
-                                       phba->brd_no, vport->vpi,
-                                       vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                        "0231 RSCN timeout Data: x%x "
+                                        "x%x\n",
+                                        vport->fc_ns_retry, LPFC_MAX_NS_RETRY);
 
                        /* Cleanup any outstanding ELS commands */
                        lpfc_els_flush_cmd(vport);
@@ -2685,20 +2650,17 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
                break;
 
        default:
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0229 Unexpected discovery timeout, "
-                               "vport State x%x\n",
-                               phba->brd_no, vport->vpi, vport->port_state);
-
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0229 Unexpected discovery timeout, "
+                                "vport State x%x\n", vport->port_state);
                break;
        }
 
        switch (phba->link_state) {
        case LPFC_CLEAR_LA:
                                /* CLEAR LA timeout */
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0228 CLEAR LA timeout\n",
-                               phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0228 CLEAR LA timeout\n");
                clrlaerr = 1;
                break;
 
@@ -2709,10 +2671,9 @@ lpfc_disc_timeout_handler(struct lpfc_vport *vport)
        case LPFC_LINK_DOWN:
        case LPFC_LINK_UP:
        case LPFC_HBA_ERROR:
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0230 Unexpected timeout, hba link "
-                               "state x%x\n",
-                               phba->brd_no, vport->vpi, phba->link_state);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                                "0230 Unexpected timeout, hba link "
+                                "state x%x\n", phba->link_state);
                clrlaerr = 1;
                break;
 
@@ -2757,7 +2718,7 @@ lpfc_mbx_cmpl_fdmi_reg_login(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
         * fdmi-on=2 (supporting RPA/hostnmae)
         */
 
-       if (phba->cfg_fdmi_on == 1)
+       if (vport->cfg_fdmi_on == 1)
                lpfc_fdmi_cmd(vport, ndlp, SLI_MGMT_DHBA);
        else
                mod_timer(&vport->fc_fdmitmo, jiffies + HZ * 60);
@@ -2853,32 +2814,6 @@ lpfc_findnode_wwpn(struct lpfc_vport *vport, struct lpfc_name *wwpn)
        return ndlp;
 }
 
-void
-lpfc_dev_loss_delay(unsigned long ptr)
-{
-       struct lpfc_nodelist *ndlp = (struct lpfc_nodelist *) ptr;
-       struct lpfc_vport *vport = ndlp->vport;
-       struct lpfc_hba   *phba = vport->phba;
-       struct lpfc_work_evt  *evtp = &ndlp->dev_loss_evt;
-       unsigned long flags;
-
-       evtp = &ndlp->dev_loss_evt;
-
-       spin_lock_irqsave(&phba->hbalock, flags);
-       if (!list_empty(&evtp->evt_listp)) {
-               spin_unlock_irqrestore(&phba->hbalock, flags);
-               return;
-       }
-
-       evtp->evt_arg1  = ndlp;
-       evtp->evt       = LPFC_EVT_DEV_LOSS_DELAY;
-       list_add_tail(&evtp->evt_listp, &phba->work_list);
-       if (phba->work_wait)
-               lpfc_worker_wake_up(phba);
-       spin_unlock_irqrestore(&phba->hbalock, flags);
-       return;
-}
-
 void
 lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
              uint32_t did)
@@ -2902,7 +2837,7 @@ lpfc_nlp_init(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        return;
 }
 
-void
+static void
 lpfc_nlp_release(struct kref *kref)
 {
        struct lpfc_nodelist *ndlp = container_of(kref, struct lpfc_nodelist,
index c2fb59f595f3ec58c699eaa133735e8450a89933..451accd5564b23b3f72870d51895f7f2f7d7947e 100644 (file)
@@ -150,7 +150,11 @@ struct lpfc_sli_ct_request {
                struct gff_acc {
                        uint8_t fbits[128];
                } gff_acc;
+#ifdef __BIG_ENDIAN_BITFIELD
+#define FCP_TYPE_FEATURE_OFFSET 7
+#else  /*  __LITTLE_ENDIAN_BITFIELD */
 #define FCP_TYPE_FEATURE_OFFSET 4
+#endif
                struct rff {
                        uint32_t PortId;
                        uint8_t reserved[2];
@@ -805,7 +809,7 @@ typedef struct _RNID {              /* Structure is in Big Endian format */
        } un;
 } RNID;
 
-typedef struct  _RPS {         /* Structure is in Big Endian format */
+typedef struct  _RPS {         /* Structure is in Big Endian format */
        union {
                uint32_t portNum;
                struct lpfc_name portName;
@@ -823,7 +827,7 @@ typedef struct  _RPS_RSP {  /* Structure is in Big Endian format */
        uint32_t crcCnt;
 } RPS_RSP;
 
-typedef struct  _RPL {         /* Structure is in Big Endian format */
+typedef struct  _RPL {         /* Structure is in Big Endian format */
        uint32_t maxsize;
        uint32_t index;
 } RPL;
@@ -834,7 +838,7 @@ typedef struct  _PORT_NUM_BLK {
        struct lpfc_name portName;
 } PORT_NUM_BLK;
 
-typedef struct  _RPL_RSP {     /* Structure is in Big Endian format */
+typedef struct  _RPL_RSP {     /* Structure is in Big Endian format */
        uint32_t listLen;
        uint32_t index;
        PORT_NUM_BLK port_num_blk;
@@ -2613,8 +2617,8 @@ typedef union {
        LOAD_SM_VAR varLdSM;            /* cmd =  1 (LOAD_SM)        */
        READ_NV_VAR varRDnvp;           /* cmd =  2 (READ_NVPARMS)   */
        WRITE_NV_VAR varWTnvp;          /* cmd =  3 (WRITE_NVPARMS)  */
-       BIU_DIAG_VAR varBIUdiag;        /* cmd =  4 (RUN_BIU_DIAG)   */
-       INIT_LINK_VAR varInitLnk;       /* cmd =  5 (INIT_LINK)      */
+       BIU_DIAG_VAR varBIUdiag;        /* cmd =  4 (RUN_BIU_DIAG)   */
+       INIT_LINK_VAR varInitLnk;       /* cmd =  5 (INIT_LINK)      */
        DOWN_LINK_VAR varDwnLnk;        /* cmd =  6 (DOWN_LINK)      */
        CONFIG_LINK varCfgLnk;          /* cmd =  7 (CONFIG_LINK)    */
        PART_SLIM_VAR varSlim;          /* cmd =  8 (PART_SLIM)      */
index 07bd0dcdf0d65dc4b9a4a4b704b41e12399ec71a..414350ab584e4f755f7c2ff0d5264f7170d94839 100644 (file)
@@ -53,8 +53,6 @@ static struct scsi_transport_template *lpfc_transport_template = NULL;
 static struct scsi_transport_template *lpfc_vport_transport_template = NULL;
 static DEFINE_IDR(lpfc_hba_index);
 
-
-
 /************************************************************************/
 /*                                                                      */
 /*    lpfc_config_port_prep                                             */
@@ -107,10 +105,9 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
 
                if (rc != MBX_SUCCESS) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_MBOX,
-                                       "%d:0324 Config Port initialization "
+                                       "0324 Config Port initialization "
                                        "error, mbxCmd x%x READ_NVPARM, "
                                        "mbxStatus x%x\n",
-                                       phba->brd_no,
                                        mb->mbxCommand, mb->mbxStatus);
                        mempool_free(pmb, phba->mbox_mem_pool);
                        return -ERESTART;
@@ -128,9 +125,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
        rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
        if (rc != MBX_SUCCESS) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0439 Adapter failed to init, mbxCmd x%x "
+                               "0439 Adapter failed to init, mbxCmd x%x "
                                "READ_REV, mbxStatus x%x\n",
-                               phba->brd_no,
                                mb->mbxCommand, mb->mbxStatus);
                mempool_free( pmb, phba->mbox_mem_pool);
                return -ERESTART;
@@ -144,9 +140,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
        if (mb->un.varRdRev.rr == 0) {
                vp->rev.rBit = 0;
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0440 Adapter failed to init, READ_REV has "
-                               "missing revision information.\n",
-                               phba->brd_no);
+                               "0440 Adapter failed to init, READ_REV has "
+                               "missing revision information.\n");
                mempool_free(pmb, phba->mbox_mem_pool);
                return -ERESTART;
        }
@@ -197,9 +192,8 @@ lpfc_config_port_prep(struct lpfc_hba *phba)
 
                if (rc != MBX_SUCCESS) {
                        lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                                       "%d:0441 VPD not present on adapter, "
+                                       "0441 VPD not present on adapter, "
                                        "mbxCmd x%x DUMP VPD, mbxStatus x%x\n",
-                                       phba->brd_no,
                                        mb->mbxCommand, mb->mbxStatus);
                        mb->un.varDmp.word_cnt = 0;
                }
@@ -253,9 +247,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
        pmb->vport = vport;
        if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0448 Adapter failed init, mbxCmd x%x "
+                               "0448 Adapter failed init, mbxCmd x%x "
                                "READ_SPARM mbxStatus x%x\n",
-                               phba->brd_no,
                                mb->mbxCommand, mb->mbxStatus);
                phba->link_state = LPFC_HBA_ERROR;
                mp = (struct lpfc_dmabuf *) pmb->context1;
@@ -312,9 +305,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
        pmb->vport = vport;
        if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0453 Adapter failed to init, mbxCmd x%x "
+                               "0453 Adapter failed to init, mbxCmd x%x "
                                "READ_CONFIG, mbxStatus x%x\n",
-                               phba->brd_no,
                                mb->mbxCommand, mb->mbxStatus);
                phba->link_state = LPFC_HBA_ERROR;
                mempool_free( pmb, phba->mbox_mem_pool);
@@ -344,9 +336,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
                && !(phba->lmt & LMT_10Gb))) {
                /* Reset link speed to auto */
                lpfc_printf_log(phba, KERN_WARNING, LOG_LINK_EVENT,
-                       "%d:1302 Invalid speed for this board: "
+                       "1302 Invalid speed for this board: "
                        "Reset link speed to auto: x%x\n",
-                       phba->brd_no,
                        phba->cfg_link_speed);
                        phba->cfg_link_speed = LINK_SPEED_AUTO;
        }
@@ -402,9 +393,8 @@ lpfc_config_port_post(struct lpfc_hba *phba)
        lpfc_set_loopback_flag(phba);
        if (rc != MBX_SUCCESS) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0454 Adapter failed to init, mbxCmd x%x "
+                               "0454 Adapter failed to init, mbxCmd x%x "
                                "INIT_LINK, mbxStatus x%x\n",
-                               phba->brd_no,
                                mb->mbxCommand, mb->mbxStatus);
 
                /* Clear all interrupt enable conditions */
@@ -437,16 +427,11 @@ lpfc_config_port_post(struct lpfc_hba *phba)
 int
 lpfc_hba_down_prep(struct lpfc_hba *phba)
 {
-       struct lpfc_vport *vport = phba->pport;
-
        /* Disable interrupts */
        writel(0, phba->HCregaddr);
        readl(phba->HCregaddr); /* flush */
 
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               lpfc_cleanup_discovery_resources(vport);
-       }
-
+       lpfc_cleanup_discovery_resources(phba->pport);
        return 0;
 }
 
@@ -518,7 +503,7 @@ lpfc_hb_mbox_cmpl(struct lpfc_hba * phba, LPFC_MBOXQ_t * pmboxq)
        mempool_free(pmboxq, phba->mbox_mem_pool);
        if (!(phba->pport->fc_flag & FC_OFFLINE_MODE) &&
                !(phba->link_state == LPFC_HBA_ERROR) &&
-               !(phba->pport->fc_flag & FC_UNLOADING))
+               !(phba->pport->load_flag & FC_UNLOADING))
                mod_timer(&phba->hb_tmofunc,
                        jiffies + HZ * LPFC_HB_MBOX_INTERVAL);
        return;
@@ -532,7 +517,7 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
        struct lpfc_sli *psli = &phba->sli;
 
        if ((phba->link_state == LPFC_HBA_ERROR) ||
-               (phba->pport->fc_flag & FC_UNLOADING) ||
+               (phba->pport->load_flag & FC_UNLOADING) ||
                (phba->pport->fc_flag & FC_OFFLINE_MODE))
                return;
 
@@ -586,8 +571,8 @@ lpfc_hb_timeout_handler(struct lpfc_hba *phba)
                 * need to take the HBA offline.
                 */
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0459 Adapter heartbeat failure, taking "
-                       "this port offline.\n", phba->brd_no);
+                               "0459 Adapter heartbeat failure, taking "
+                               "this port offline.\n");
 
                spin_lock_irq(&phba->hbalock);
                psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
@@ -615,9 +600,10 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
        struct lpfc_vport *vport = phba->pport;
        struct lpfc_sli   *psli = &phba->sli;
        struct lpfc_sli_ring  *pring;
-       struct lpfc_vport *port_iterator;
+       struct lpfc_vport **vports;
        uint32_t event_data;
        struct Scsi_Host  *shost;
+       int i;
 
        /* If the pci channel is offline, ignore possible errors,
         * since we cannot communicate with the pci card anyway. */
@@ -628,18 +614,21 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
            phba->work_hs & HS_FFER5) {
                /* Re-establishing Link */
                lpfc_printf_log(phba, KERN_INFO, LOG_LINK_EVENT,
-                               "%d:1301 Re-establishing Link "
+                               "1301 Re-establishing Link "
                                "Data: x%x x%x x%x\n",
-                               phba->brd_no, phba->work_hs,
+                               phba->work_hs,
                                phba->work_status[0], phba->work_status[1]);
-               list_for_each_entry(port_iterator, &phba->port_list,
-                                   listentry) {
-                       shost = lpfc_shost_from_vport(port_iterator);
-
-                       spin_lock_irq(shost->host_lock);
-                       port_iterator->fc_flag |= FC_ESTABLISH_LINK;
-                       spin_unlock_irq(shost->host_lock);
-               }
+               vports = lpfc_create_vport_work_array(phba);
+               if (vports != NULL)
+                       for(i = 0;
+                           i < LPFC_MAX_VPORTS && vports[i] != NULL;
+                           i++){
+                               shost = lpfc_shost_from_vport(vports[i]);
+                               spin_lock_irq(shost->host_lock);
+                               vports[i]->fc_flag |= FC_ESTABLISH_LINK;
+                               spin_unlock_irq(shost->host_lock);
+                       }
+               lpfc_destroy_vport_work_array(vports);
                spin_lock_irq(&phba->hbalock);
                psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
                spin_unlock_irq(&phba->hbalock);
@@ -673,9 +662,9 @@ lpfc_handle_eratt(struct lpfc_hba *phba)
                 *  twice. This is the adapter hardware error path.
                 */
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0457 Adapter Hardware Error "
+                               "0457 Adapter Hardware Error "
                                "Data: x%x x%x x%x\n",
-                               phba->brd_no, phba->work_hs,
+                               phba->work_hs,
                                phba->work_status[0], phba->work_status[1]);
 
                event_data = FC_REG_DUMP_EVENT;
@@ -708,7 +697,6 @@ lpfc_handle_latt(struct lpfc_hba *phba)
 {
        struct lpfc_vport *vport = phba->pport;
        struct lpfc_sli   *psli = &phba->sli;
-       struct lpfc_vport *port_iterator;
        LPFC_MBOXQ_t *pmb;
        volatile uint32_t control;
        struct lpfc_dmabuf *mp;
@@ -729,8 +717,7 @@ lpfc_handle_latt(struct lpfc_hba *phba)
        rc = -EIO;
 
        /* Cleanup any outstanding ELS commands */
-       list_for_each_entry(port_iterator, &phba->port_list, listentry)
-               lpfc_els_flush_cmd(port_iterator);
+       lpfc_els_flush_all_cmd(phba);
 
        psli->slistat.link_event++;
        lpfc_read_la(phba, pmb, mp);
@@ -773,8 +760,7 @@ lpfc_handle_latt_err_exit:
        /* The other case is an error from issue_mbox */
        if (rc == -ENOMEM)
                lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
-                               "%d:0300 READ_LA: no buffers\n",
-                               phba->brd_no);
+                               "0300 READ_LA: no buffers\n");
 
        return;
 }
@@ -799,8 +785,7 @@ lpfc_parse_vpd(struct lpfc_hba *phba, uint8_t *vpd, int len)
 
        /* Vital Product */
        lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                       "%d:0455 Vital Product Data: x%x x%x x%x x%x\n",
-                       phba->brd_no,
+                       "0455 Vital Product Data: x%x x%x x%x x%x\n",
                        (uint32_t) vpd[0], (uint32_t) vpd[1], (uint32_t) vpd[2],
                        (uint32_t) vpd[3]);
        while (!finished && (index < (len - 4))) {
@@ -1313,22 +1298,25 @@ static void
 lpfc_establish_link_tmo(unsigned long ptr)
 {
        struct lpfc_hba   *phba = (struct lpfc_hba *) ptr;
-       struct lpfc_vport *vport = phba->pport;
+       struct lpfc_vport **vports;
        unsigned long iflag;
+       int i;
 
        /* Re-establishing Link, timer expired */
        lpfc_printf_log(phba, KERN_ERR, LOG_LINK_EVENT,
-                       "%d:1300 Re-establishing Link, timer expired "
+                       "1300 Re-establishing Link, timer expired "
                        "Data: x%x x%x\n",
-                       phba->brd_no, vport->fc_flag,
-                       vport->port_state);
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
-
-               spin_lock_irqsave(shost->host_lock, iflag);
-               vport->fc_flag &= ~FC_ESTABLISH_LINK;
-               spin_unlock_irqrestore(shost->host_lock, iflag);
-       }
+                       phba->pport->fc_flag, phba->pport->port_state);
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
+                       struct Scsi_Host *shost;
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       spin_lock_irqsave(shost->host_lock, iflag);
+                       vports[i]->fc_flag &= ~FC_ESTABLISH_LINK;
+                       spin_unlock_irqrestore(shost->host_lock, iflag);
+               }
+       lpfc_destroy_vport_work_array(vports);
 }
 
 void
@@ -1343,12 +1331,9 @@ lpfc_stop_vport_timers(struct lpfc_vport *vport)
 static void
 lpfc_stop_phba_timers(struct lpfc_hba *phba)
 {
-       struct lpfc_vport *vport;
-
        del_timer_sync(&phba->fcp_poll_timer);
        del_timer_sync(&phba->fc_estabtmo);
-       list_for_each_entry(vport, &phba->port_list, listentry)
-               lpfc_stop_vport_timers(vport);
+       lpfc_stop_vport_timers(phba->pport);
        del_timer_sync(&phba->sli.mbox_tmo);
        del_timer_sync(&phba->fabric_block_timer);
        phba->hb_outstanding = 0;
@@ -1360,6 +1345,8 @@ int
 lpfc_online(struct lpfc_hba *phba)
 {
        struct lpfc_vport *vport = phba->pport;
+       struct lpfc_vport **vports;
+       int i;
 
        if (!phba)
                return 0;
@@ -1368,8 +1355,7 @@ lpfc_online(struct lpfc_hba *phba)
                return 0;
 
        lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
-                      "%d:0458 Bring Adapter online\n",
-                      phba->brd_no);
+                       "0458 Bring Adapter online\n");
 
        lpfc_block_mgmt_io(phba);
 
@@ -1383,14 +1369,18 @@ lpfc_online(struct lpfc_hba *phba)
                return 1;
        }
 
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               struct Scsi_Host  *shost = lpfc_shost_from_vport(vport);
-               spin_lock_irq(shost->host_lock);
-               vport->fc_flag &= ~FC_OFFLINE_MODE;
-               if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)
-                       vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
-               spin_unlock_irq(shost->host_lock);
-       }
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
+                       struct Scsi_Host *shost;
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       spin_lock_irq(shost->host_lock);
+                       vports[i]->fc_flag &= ~FC_OFFLINE_MODE;
+                       if (phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)
+                               vports[i]->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
+                       spin_unlock_irq(shost->host_lock);
+               }
+               lpfc_destroy_vport_work_array(vports);
 
        lpfc_unblock_mgmt_io(phba);
        return 0;
@@ -1440,39 +1430,39 @@ lpfc_offline_prep(struct lpfc_hba * phba)
 void
 lpfc_offline(struct lpfc_hba *phba)
 {
-       struct lpfc_vport *vport = phba->pport;
-       struct Scsi_Host  *shost = lpfc_shost_from_vport(vport);
-       struct lpfc_vport *port_iterator;
+       struct Scsi_Host  *shost;
+       struct lpfc_vport **vports;
+       int i;
 
-       if (vport->fc_flag & FC_OFFLINE_MODE)
+       if (phba->pport->fc_flag & FC_OFFLINE_MODE)
                return;
 
        /* stop all timers associated with this hba */
        lpfc_stop_phba_timers(phba);
-       list_for_each_entry(port_iterator, &phba->port_list, listentry) {
-               port_iterator->work_port_events = 0;
-       }
-
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++)
+                       lpfc_stop_vport_timers(vports[i]);
+       lpfc_destroy_vport_work_array(vports);
        lpfc_printf_log(phba, KERN_WARNING, LOG_INIT,
-                      "%d:0460 Bring Adapter offline\n",
-                      phba->brd_no);
-
+                       "0460 Bring Adapter offline\n");
        /* Bring down the SLI Layer and cleanup.  The HBA is offline
           now.  */
        lpfc_sli_hba_down(phba);
        spin_lock_irq(&phba->hbalock);
        phba->work_ha = 0;
-       vport->fc_flag |= FC_OFFLINE_MODE;
        spin_unlock_irq(&phba->hbalock);
-       list_for_each_entry(port_iterator, &phba->port_list, listentry) {
-               shost = lpfc_shost_from_vport(port_iterator);
-
-               lpfc_cleanup(port_iterator);
-               spin_lock_irq(shost->host_lock);
-               vport->work_port_events = 0;
-               vport->fc_flag |= FC_OFFLINE_MODE;
-               spin_unlock_irq(shost->host_lock);
-       }
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       lpfc_cleanup(vports[i]);
+                       spin_lock_irq(shost->host_lock);
+                       vports[i]->work_port_events = 0;
+                       vports[i]->fc_flag |= FC_OFFLINE_MODE;
+                       spin_unlock_irq(shost->host_lock);
+               }
+       lpfc_destroy_vport_work_array(vports);
 }
 
 /******************************************************************************
@@ -1509,15 +1499,19 @@ lpfc_scsi_free(struct lpfc_hba *phba)
        return 0;
 }
 
-
 struct lpfc_vport *
-lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
+lpfc_create_port(struct lpfc_hba *phba, int instance, struct device *dev)
 {
        struct lpfc_vport *vport;
        struct Scsi_Host  *shost;
        int error = 0;
 
-       shost = scsi_host_alloc(&lpfc_template, sizeof(struct lpfc_vport));
+       if (dev != &phba->pcidev->dev)
+               shost = scsi_host_alloc(&lpfc_vport_template,
+                                       sizeof(struct lpfc_vport));
+       else
+               shost = scsi_host_alloc(&lpfc_template,
+                                       sizeof(struct lpfc_vport));
        if (!shost)
                goto out;
 
@@ -1527,9 +1521,10 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
        vport->load_flag |= FC_LOADING;
        vport->fc_flag |= FC_VPORT_NEEDS_REG_VPI;
 
+       lpfc_get_vport_cfgparam(vport);
        shost->unique_id = instance;
        shost->max_id = LPFC_MAX_TARGET;
-       shost->max_lun = phba->cfg_max_luns;
+       shost->max_lun = vport->cfg_max_luns;
        shost->this_id = -1;
        shost->max_cmd_len = 16;
        /*
@@ -1538,7 +1533,7 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
         * max xri value determined in hba setup.
         */
        shost->can_queue = phba->cfg_hba_queue_depth - 10;
-       if (fc_vport != NULL) {
+       if (dev != &phba->pcidev->dev) {
                shost->transportt = lpfc_vport_transport_template;
                vport->port_type = LPFC_NPIV_PORT;
        } else {
@@ -1562,15 +1557,13 @@ lpfc_create_port(struct lpfc_hba *phba, int instance, struct fc_vport *fc_vport)
        vport->els_tmofunc.function = lpfc_els_timeout;
        vport->els_tmofunc.data = (unsigned long)vport;
 
-       if (fc_vport != NULL) {
-               error = scsi_add_host(shost, &fc_vport->dev);
-       } else {
-               error = scsi_add_host(shost, &phba->pcidev->dev);
-       }
+       error = scsi_add_host(shost, dev);
        if (error)
                goto out_put_shost;
 
+       spin_lock_irq(&phba->hbalock);
        list_add_tail(&vport->listentry, &phba->port_list);
+       spin_unlock_irq(&phba->hbalock);
        return vport;
 
 out_put_shost:
@@ -1625,23 +1618,21 @@ int lpfc_scan_finished(struct Scsi_Host *shost, unsigned long time)
 
        spin_lock_irq(shost->host_lock);
 
-       if (vport->fc_flag & FC_UNLOADING) {
+       if (vport->load_flag & FC_UNLOADING) {
                stat = 1;
                goto finished;
        }
        if (time >= 30 * HZ) {
                lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                               "%d:0461 Scanning longer than 30 "
-                               "seconds.  Continuing initialization\n",
-                               phba->brd_no);
+                               "0461 Scanning longer than 30 "
+                               "seconds.  Continuing initialization\n");
                stat = 1;
                goto finished;
        }
        if (time >= 15 * HZ && phba->link_state <= LPFC_LINK_DOWN) {
                lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                               "%d:0465 Link down longer than 15 "
-                               "seconds.  Continuing initialization\n",
-                               phba->brd_no);
+                               "0465 Link down longer than 15 "
+                               "seconds.  Continuing initialization\n");
                stat = 1;
                goto finished;
        }
@@ -1704,7 +1695,7 @@ void lpfc_host_attrib_init(struct Scsi_Host *shost)
 
        fc_host_max_npiv_vports(shost) = phba->max_vpi;
        spin_lock_irq(shost->host_lock);
-       vport->fc_flag &= ~FC_LOADING;
+       vport->load_flag &= ~FC_LOADING;
        spin_unlock_irq(shost->host_lock);
 }
 
@@ -1716,9 +1707,10 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        struct lpfc_sli   *psli;
        struct lpfc_iocbq *iocbq_entry = NULL, *iocbq_next = NULL;
        struct Scsi_Host  *shost = NULL;
+       void *ptr;
        unsigned long bar0map_len, bar2map_len;
        int error = -ENODEV;
-       int i;
+       int  i, hbq_count;
        uint16_t iotag;
 
        if (pci_enable_device(pdev))
@@ -1739,7 +1731,6 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
                goto out_free_phba;
 
        INIT_LIST_HEAD(&phba->port_list);
-       INIT_LIST_HEAD(&phba->hbq_buffer_list);
        /*
         * Get all the module params for configuring this host and then
         * establish the host.
@@ -1817,6 +1808,17 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        if (!phba->hbqslimp.virt)
                goto out_free_slim;
 
+       hbq_count = lpfc_sli_hbq_count();
+       ptr = phba->hbqslimp.virt;
+       for (i = 0; i < hbq_count; ++i) {
+               phba->hbqs[i].hbq_virt = ptr;
+               INIT_LIST_HEAD(&phba->hbqs[i].hbq_buffer_list);
+               ptr += (lpfc_hbq_defs[i]->entry_count *
+                       sizeof(struct lpfc_hbq_entry));
+       }
+       phba->hbqs[LPFC_ELS_HBQ].hbq_alloc_buffer = lpfc_els_hbq_alloc;
+       phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer  = lpfc_els_hbq_free;
+
        memset(phba->hbqslimp.virt, 0, lpfc_sli_hbq_size());
 
        /* Initialize the SLI Layer to run with lpfc HBAs. */
@@ -1880,7 +1882,7 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
        /* Initialize list of fabric iocbs */
        INIT_LIST_HEAD(&phba->fabric_iocb_list);
 
-       vport = lpfc_create_port(phba, phba->brd_no, NULL);
+       vport = lpfc_create_port(phba, phba->brd_no, &phba->pcidev->dev);
        if (!vport)
                goto out_kthread_stop;
 
@@ -1892,18 +1894,19 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
 
        if (phba->cfg_use_msi) {
                error = pci_enable_msi(phba->pcidev);
-               if (error)
-                       lpfc_printf_log(phba, KERN_INFO, LOG_INIT, "%d:0452 "
-                                       "Enable MSI failed, continuing with "
-                                       "IRQ\n", phba->brd_no);
+               if (!error)
+                       phba->using_msi = 1;
+               else
+                       lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
+                                       "0452 Enable MSI failed, continuing "
+                                       "with IRQ\n");
        }
 
        error = request_irq(phba->pcidev->irq, lpfc_intr_handler, IRQF_SHARED,
                            LPFC_DRIVER_NAME, phba);
        if (error) {
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0451 Enable interrupt handler failed\n",
-                       phba->brd_no);
+                       "0451 Enable interrupt handler failed\n");
                goto out_disable_msi;
        }
 
@@ -1940,14 +1943,15 @@ lpfc_pci_probe_one(struct pci_dev *pdev, const struct pci_device_id *pid)
 out_remove_device:
        lpfc_free_sysfs_attr(vport);
        spin_lock_irq(shost->host_lock);
-       vport->fc_flag |= FC_UNLOADING;
+       vport->load_flag |= FC_UNLOADING;
        spin_unlock_irq(shost->host_lock);
 out_free_irq:
        lpfc_stop_phba_timers(phba);
        phba->pport->work_port_events = 0;
        free_irq(phba->pcidev->irq, phba);
 out_disable_msi:
-       pci_disable_msi(phba->pcidev);
+       if (phba->using_msi)
+               pci_disable_msi(phba->pcidev);
        destroy_port(vport);
 out_kthread_stop:
        kthread_stop(phba->worker_thread);
@@ -1989,16 +1993,15 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
        struct Scsi_Host  *shost = pci_get_drvdata(pdev);
        struct lpfc_vport *vport = (struct lpfc_vport *) shost->hostdata;
        struct lpfc_hba   *phba = vport->phba;
-       struct lpfc_vport *port_iterator;
-       list_for_each_entry(port_iterator, &phba->port_list, listentry)
-               port_iterator->load_flag |= FC_UNLOADING;
+       spin_lock_irq(&phba->hbalock);
+       vport->load_flag |= FC_UNLOADING;
+       spin_unlock_irq(&phba->hbalock);
 
        kfree(vport->vname);
        lpfc_free_sysfs_attr(vport);
 
        fc_remove_host(shost);
        scsi_remove_host(shost);
-
        /*
         * Bring down the SLI Layer. This step disable all interrupts,
         * clears the rings, discards all mailbox commands, and resets
@@ -2012,7 +2015,6 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
        list_del_init(&vport->listentry);
        spin_unlock_irq(&phba->hbalock);
 
-
        lpfc_debugfs_terminate(vport);
        lpfc_cleanup(vport);
 
@@ -2020,7 +2022,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
 
        /* Release the irq reservation */
        free_irq(phba->pcidev->irq, phba);
-       pci_disable_msi(phba->pcidev);
+       if (phba->using_msi)
+               pci_disable_msi(phba->pcidev);
 
        pci_set_drvdata(pdev, NULL);
        scsi_host_put(shost);
@@ -2062,8 +2065,8 @@ lpfc_pci_remove_one(struct pci_dev *pdev)
 static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
                                pci_channel_state_t state)
 {
-       struct Scsi_Host *host = pci_get_drvdata(pdev);
-       struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata;
+       struct Scsi_Host *shost = pci_get_drvdata(pdev);
+       struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
        struct lpfc_sli *psli = &phba->sli;
        struct lpfc_sli_ring  *pring;
 
@@ -2079,6 +2082,11 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
        pring = &psli->ring[psli->fcp_ring];
        lpfc_sli_abort_iocb_ring(phba, pring);
 
+       /* Release the irq reservation */
+       free_irq(phba->pcidev->irq, phba);
+       if (phba->using_msi)
+               pci_disable_msi(phba->pcidev);
+
        /* Request a slot reset. */
        return PCI_ERS_RESULT_NEED_RESET;
 }
@@ -2091,8 +2099,8 @@ static pci_ers_result_t lpfc_io_error_detected(struct pci_dev *pdev,
  */
 static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
 {
-       struct Scsi_Host *host = pci_get_drvdata(pdev);
-       struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata;
+       struct Scsi_Host *shost = pci_get_drvdata(pdev);
+       struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
        struct lpfc_sli *psli = &phba->sli;
        int bars = pci_select_bars(pdev, IORESOURCE_MEM);
 
@@ -2106,9 +2114,9 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
        pci_set_master(pdev);
 
        /* Re-establishing Link */
-       spin_lock_irq(host->host_lock);
+       spin_lock_irq(shost->host_lock);
        phba->pport->fc_flag |= FC_ESTABLISH_LINK;
-       spin_unlock_irq(host->host_lock);
+       spin_unlock_irq(shost->host_lock);
 
        spin_lock_irq(&phba->hbalock);
        psli->sli_flag &= ~LPFC_SLI2_ACTIVE;
@@ -2131,8 +2139,8 @@ static pci_ers_result_t lpfc_io_slot_reset(struct pci_dev *pdev)
  */
 static void lpfc_io_resume(struct pci_dev *pdev)
 {
-       struct Scsi_Host *host = pci_get_drvdata(pdev);
-       struct lpfc_hba *phba = (struct lpfc_hba *)host->hostdata;
+       struct Scsi_Host *shost = pci_get_drvdata(pdev);
+       struct lpfc_hba *phba = ((struct lpfc_vport *)shost->hostdata)->phba;
 
        if (lpfc_online(phba) == 0) {
                mod_timer(&phba->fc_estabtmo, jiffies + HZ * 60);
index 8a6ceffeabcf7e24831af599317e8e08e829937e..626e4d878725d48d6860025dff8587cae99c7a3c 100644 (file)
 #define LOG_VPORT                     0x4000   /* NPIV events */
 #define LOG_ALL_MSG                   0xffff   /* LOG all messages */
 
+#define lpfc_printf_vlog(vport, level, mask, fmt, arg...) \
+       { if (((mask) &(vport)->cfg_log_verbose) || (level[1] <= '3')) \
+               dev_printk(level, &((vport)->phba->pcidev)->dev, "%d:(%d):" \
+                          fmt, (vport)->phba->brd_no, vport->vpi, ##arg); }
+
 #define lpfc_printf_log(phba, level, mask, fmt, arg...) \
-       { if (((mask) &(phba)->cfg_log_verbose) || (level[1] <= '3')) \
-               dev_printk(level, &((phba)->pcidev)->dev, fmt, ##arg); }
+       { if (((mask) &(phba)->pport->cfg_log_verbose) || (level[1] <= '3')) \
+               dev_printk(level, &((phba)->pcidev)->dev, "%d:" \
+                          fmt, phba->brd_no, ##arg); }
index 8f42fbfdd29e5cb19f43d4a2a49d63bdb67cefd2..a592733664e9c14a183534602affa6f1c6d42cb4 100644 (file)
@@ -275,11 +275,8 @@ lpfc_read_sparam(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb, int vpi)
                kfree(mp);
                mb->mbxCommand = MBX_READ_SPARM64;
                /* READ_SPARAM: no buffers */
-               lpfc_printf_log(phba,
-                               KERN_WARNING,
-                               LOG_MBOX,
-                               "%d:0301 READ_SPARAM: no buffers\n",
-                               phba->brd_no);
+               lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
+                               "0301 READ_SPARAM: no buffers\n");
                return (1);
        }
        INIT_LIST_HEAD(&mp->list);
@@ -378,9 +375,8 @@ lpfc_reg_login(struct lpfc_hba *phba, uint16_t vpi, uint32_t did,
                mb->mbxCommand = MBX_REG_LOGIN64;
                /* REG_LOGIN: no buffers */
                lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX,
-                               "%d (%d):0302 REG_LOGIN: no buffers, DID x%x, "
-                               "flag x%x\n",
-                               phba->brd_no, vpi, did, flag);
+                               "0302 REG_LOGIN: no buffers, VPI:%d DID:x%x, "
+                               "flag x%x\n", vpi, did, flag);
                return (1);
        }
        INIT_LIST_HEAD(&mp->list);
@@ -564,7 +560,8 @@ lpfc_build_hbq_profile5(struct config_hbq_var *hbqmb,
 }
 
 void
-lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc,
+lpfc_config_hbq(struct lpfc_hba *phba, uint32_t id,
+                struct lpfc_hbq_init *hbq_desc,
                uint32_t hbq_entry_index, LPFC_MBOXQ_t *pmb)
 {
        int i;
@@ -572,6 +569,7 @@ lpfc_config_hbq(struct lpfc_hba *phba, struct lpfc_hbq_init *hbq_desc,
        struct config_hbq_var *hbqmb = &mb->un.varCfgHbq;
 
        memset(pmb, 0, sizeof (LPFC_MBOXQ_t));
+       hbqmb->hbqId = id;
        hbqmb->entry_count = hbq_desc->entry_count;   /* # entries in HBQ */
        hbqmb->recvNotify = hbq_desc->rn;             /* Receive
                                                       * Notification */
@@ -691,8 +689,8 @@ lpfc_config_port(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmb)
 
        if (phba->sli_rev == 3 && phba->vpd.sli3Feat.cerbm) {
                mb->un.varCfgPort.cerbm = 1; /* Request HBQs */
-               mb->un.varCfgPort.max_hbq = 1; /* Requesting 2 HBQs */
-               if (phba->max_vpi && phba->cfg_npiv_enable &&
+               mb->un.varCfgPort.max_hbq = lpfc_sli_hbq_count();
+               if (phba->max_vpi && phba->cfg_enable_npiv &&
                    phba->vpd.sli3Feat.cmv) {
                        mb->un.varCfgPort.max_vpi = phba->max_vpi;
                        mb->un.varCfgPort.cmv = 1;
index 3594c469494face18a422e6811516cda4574d35a..43c3b8a0d76a5642418afbefc7e2209eef2e72bd 100644 (file)
@@ -231,21 +231,34 @@ lpfc_mbuf_free(struct lpfc_hba * phba, void *virt, dma_addr_t dma)
        return;
 }
 
-void *
-lpfc_hbq_alloc(struct lpfc_hba *phba, int mem_flags, dma_addr_t *handle)
+struct hbq_dmabuf *
+lpfc_els_hbq_alloc(struct lpfc_hba *phba)
 {
-       void *ret;
-       ret = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_ATOMIC, handle);
-       return ret;
+       struct hbq_dmabuf *hbqbp;
+
+       hbqbp = kmalloc(sizeof(struct hbq_dmabuf), GFP_KERNEL);
+       if (!hbqbp)
+               return NULL;
+
+       hbqbp->dbuf.virt = pci_pool_alloc(phba->lpfc_hbq_pool, GFP_KERNEL,
+                                         &hbqbp->dbuf.phys);
+       if (!hbqbp->dbuf.virt) {
+               kfree(hbqbp);
+               return NULL;
+       }
+       hbqbp->size = LPFC_BPL_SIZE;
+       return hbqbp;
 }
 
 void
-lpfc_hbq_free(struct lpfc_hba *phba, void *virt, dma_addr_t dma)
+lpfc_els_hbq_free(struct lpfc_hba *phba, struct hbq_dmabuf *hbqbp)
 {
-       pci_pool_free(phba->lpfc_hbq_pool, virt, dma);
+       pci_pool_free(phba->lpfc_hbq_pool, hbqbp->dbuf.virt, hbqbp->dbuf.phys);
+       kfree(hbqbp);
        return;
 }
 
+/* This is ONLY called for the LPFC_ELS_HBQ */
 void
 lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
 {
@@ -254,9 +267,8 @@ lpfc_in_buf_free(struct lpfc_hba *phba, struct lpfc_dmabuf *mp)
        if (phba->sli3_options & LPFC_SLI3_HBQ_ENABLED) {
                hbq_entry = container_of(mp, struct hbq_dmabuf, dbuf);
                if (hbq_entry->tag == -1) {
-                       lpfc_hbq_free(phba, hbq_entry->dbuf.virt,
-                                     hbq_entry->dbuf.phys);
-                       kfree(hbq_entry);
+                       (phba->hbqs[LPFC_ELS_HBQ].hbq_free_buffer)
+                               (phba, hbq_entry);
                } else {
                        lpfc_sli_free_hbq(phba, hbq_entry);
                }
index bca2f5c9b4baa9f7724800f7b7560972383a08cd..880af0cd463dbbe163c43ec379fa68e903a2242e 100644 (file)
@@ -133,15 +133,15 @@ lpfc_check_sparm(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        memcpy(&ndlp->nlp_portname, &sp->portName, sizeof (struct lpfc_name));
        return 1;
 bad_service_param:
-       lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY,
-                       "%d (%d):0207 Device %x "
-                       "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent "
-                       "invalid service parameters.  Ignoring device.\n",
-                       vport->phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID,
-                       sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1],
-                       sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3],
-                       sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5],
-                       sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                        "0207 Device %x "
+                        "(%02x:%02x:%02x:%02x:%02x:%02x:%02x:%02x) sent "
+                        "invalid service parameters.  Ignoring device.\n",
+                        ndlp->nlp_DID,
+                        sp->nodeName.u.wwn[0], sp->nodeName.u.wwn[1],
+                        sp->nodeName.u.wwn[2], sp->nodeName.u.wwn[3],
+                        sp->nodeName.u.wwn[4], sp->nodeName.u.wwn[5],
+                        sp->nodeName.u.wwn[6], sp->nodeName.u.wwn[7]);
        return 0;
 }
 
@@ -194,11 +194,11 @@ lpfc_els_abort(struct lpfc_hba *phba, struct lpfc_nodelist *ndlp)
        IOCB_t *cmd;
 
        /* Abort outstanding I/O on NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0205 Abort outstanding I/O on NPort x%x "
-                       "Data: x%x x%x x%x\n",
-                       phba->brd_no, ndlp->vport->vpi, ndlp->nlp_DID,
-                       ndlp->nlp_flag, ndlp->nlp_state, ndlp->nlp_rpi);
+       lpfc_printf_vlog(ndlp->vport, KERN_INFO, LOG_DISCOVERY,
+                        "0205 Abort outstanding I/O on NPort x%x "
+                        "Data: x%x x%x x%x\n",
+                        ndlp->nlp_DID, ndlp->nlp_flag, ndlp->nlp_state,
+                        ndlp->nlp_rpi);
 
        lpfc_fabric_abort_nport(ndlp);
 
@@ -298,13 +298,12 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        icmd = &cmdiocb->iocb;
 
        /* PLOGI chkparm OK */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
-                       ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag,
-                       ndlp->nlp_rpi);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0114 PLOGI chkparm OK Data: x%x x%x x%x x%x\n",
+                        ndlp->nlp_DID, ndlp->nlp_state, ndlp->nlp_flag,
+                        ndlp->nlp_rpi);
 
-       if (phba->cfg_fcp_class == 2 && sp->cls2.classValid)
+       if (vport->cfg_fcp_class == 2 && sp->cls2.classValid)
                ndlp->nlp_fcp_info |= CLASS2;
        else
                ndlp->nlp_fcp_info |= CLASS3;
@@ -330,7 +329,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        case  NLP_STE_PRLI_ISSUE:
        case  NLP_STE_UNMAPPED_NODE:
        case  NLP_STE_MAPPED_NODE:
-               lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL, 0);
+               lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, NULL);
                return 1;
        }
 
@@ -392,7 +391,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        }
 
        if ((vport->port_type == LPFC_NPIV_PORT &&
-             phba->cfg_vport_restrict_login)) {
+            vport->cfg_restrict_login)) {
 
                /* In order to preserve RPIs, we want to cleanup
                 * the default RPI the firmware created to rcv
@@ -408,7 +407,7 @@ lpfc_rcv_plogi(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                        ndlp, mbox);
                return 1;
        }
-       lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox, 0);
+       lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp, mbox);
        return 1;
 
 out:
@@ -452,7 +451,7 @@ lpfc_rcv_padisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                        lpfc_els_rsp_adisc_acc(vport, cmdiocb, ndlp);
                } else {
                        lpfc_els_rsp_acc(vport, ELS_CMD_PLOGI, cmdiocb, ndlp,
-                                        NULL, 0);
+                                        NULL);
                }
                return 1;
        }
@@ -489,9 +488,9 @@ lpfc_rcv_logo(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        ndlp->nlp_flag |= NLP_LOGO_ACC;
        spin_unlock_irq(shost->host_lock);
        if (els_cmd == ELS_CMD_PRLO)
-               lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
+               lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
        else
-               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
+               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
 
        if (!(ndlp->nlp_type & NLP_FABRIC) ||
            (ndlp->nlp_state == NLP_STE_ADISC_ISSUE)) {
@@ -564,10 +563,14 @@ static uint32_t
 lpfc_disc_set_adisc(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp)
 {
        struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
-       struct lpfc_hba  *phba = vport->phba;
+
+       if (!ndlp->nlp_rpi) {
+               ndlp->nlp_flag &= ~NLP_NPR_ADISC;
+               return 0;
+       }
 
        /* Check config parameter use-adisc or FCP-2 */
-       if ((phba->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) ||
+       if ((vport->cfg_use_adisc && (vport->fc_flag & FC_RSCN_MODE)) ||
            ndlp->nlp_fcp_info & NLP_FCP_2_DEVICE) {
                spin_lock_irq(shost->host_lock);
                ndlp->nlp_flag |= NLP_NPR_ADISC;
@@ -583,12 +586,11 @@ static uint32_t
 lpfc_disc_illegal(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                  void *arg, uint32_t evt)
 {
-       lpfc_printf_log(vport->phba, KERN_ERR, LOG_DISCOVERY,
-                       "%d (%d):0253 Illegal State Transition: node x%x "
-                       "event x%x, state x%x Data: x%x x%x\n",
-                       vport->phba->brd_no, vport->vpi,
-                       ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
-                       ndlp->nlp_flag);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                        "0253 Illegal State Transition: node x%x "
+                        "event x%x, state x%x Data: x%x x%x\n",
+                        ndlp->nlp_DID, evt, ndlp->nlp_state, ndlp->nlp_rpi,
+                        ndlp->nlp_flag);
        return ndlp->nlp_state;
 }
 
@@ -630,7 +632,7 @@ lpfc_rcv_logo_unused_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        spin_lock_irq(shost->host_lock);
        ndlp->nlp_flag |= NLP_LOGO_ACC;
        spin_unlock_irq(shost->host_lock);
-       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
+       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
        lpfc_nlp_set_state(vport, ndlp, NLP_STE_UNUSED_NODE);
 
        return ndlp->nlp_state;
@@ -726,7 +728,7 @@ lpfc_rcv_els_plogi_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        lpfc_els_abort(phba, ndlp);
 
        if (evt == NLP_EVT_RCV_LOGO) {
-               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
+               lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
        } else {
                lpfc_issue_els_logo(vport, ndlp, 0);
        }
@@ -778,16 +780,12 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
        sp = (struct serv_parm *) ((uint8_t *) lp + sizeof (uint32_t));
        if (!lpfc_check_sparm(vport, ndlp, sp, CLASS3))
                goto out;
-
        /* PLOGI chkparm OK */
-       lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (%d):0121 PLOGI chkparm OK "
-                       "Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
-                       ndlp->nlp_DID, ndlp->nlp_state,
-                       ndlp->nlp_flag, ndlp->nlp_rpi);
-
-       if (phba->cfg_fcp_class == 2 && (sp->cls2.classValid))
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_ELS,
+                        "0121 PLOGI chkparm OK Data: x%x x%x x%x x%x\n",
+                        ndlp->nlp_DID, ndlp->nlp_state,
+                        ndlp->nlp_flag, ndlp->nlp_rpi);
+       if (vport->cfg_fcp_class == 2 && (sp->cls2.classValid))
                ndlp->nlp_fcp_info |= CLASS2;
        else
                ndlp->nlp_fcp_info |= CLASS3;
@@ -806,10 +804,9 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
 
        mbox = mempool_alloc(phba->mbox_mem_pool, GFP_KERNEL);
        if (!mbox) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0133 PLOGI: no memory for reg_login "
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                       "0133 PLOGI: no memory for reg_login "
                        "Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
                        ndlp->nlp_DID, ndlp->nlp_state,
                        ndlp->nlp_flag, ndlp->nlp_rpi);
                goto out;
@@ -844,30 +841,27 @@ lpfc_cmpl_plogi_plogi_issue(struct lpfc_vport *vport,
                kfree(mp);
                mempool_free(mbox, phba->mbox_mem_pool);
 
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0134 PLOGI: cannot issue reg_login "
-                       "Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
-                       ndlp->nlp_DID, ndlp->nlp_state,
-                       ndlp->nlp_flag, ndlp->nlp_rpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0134 PLOGI: cannot issue reg_login "
+                                "Data: x%x x%x x%x x%x\n",
+                                ndlp->nlp_DID, ndlp->nlp_state,
+                                ndlp->nlp_flag, ndlp->nlp_rpi);
        } else {
                mempool_free(mbox, phba->mbox_mem_pool);
 
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0135 PLOGI: cannot format reg_login "
-                       "Data: x%x x%x x%x x%x\n",
-                       phba->brd_no, vport->vpi,
-                       ndlp->nlp_DID, ndlp->nlp_state,
-                       ndlp->nlp_flag, ndlp->nlp_rpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0135 PLOGI: cannot format reg_login "
+                                "Data: x%x x%x x%x x%x\n",
+                                ndlp->nlp_DID, ndlp->nlp_state,
+                                ndlp->nlp_flag, ndlp->nlp_rpi);
        }
 
 
 out:
        if (ndlp->nlp_DID == NameServer_DID) {
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
-               lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                       "%d (%d):0261 Cannot Register NameServer login\n",
-                       phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                "0261 Cannot Register NameServer login\n");
        }
 
        /* Free this node since the driver cannot login or has the wrong
@@ -1178,7 +1172,7 @@ lpfc_rcv_prlo_reglogin_issue(struct lpfc_vport *vport,
        struct lpfc_iocbq *cmdiocb;
 
        cmdiocb = (struct lpfc_iocbq *) arg;
-       lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
+       lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
        return ndlp->nlp_state;
 }
 
@@ -1189,19 +1183,15 @@ lpfc_cmpl_reglogin_reglogin_issue(struct lpfc_vport *vport,
                                  uint32_t evt)
 {
        struct Scsi_Host *shost = lpfc_shost_from_vport(vport);
-       struct lpfc_hba  *phba = vport->phba;
        LPFC_MBOXQ_t *pmb = (LPFC_MBOXQ_t *) arg;
        MAILBOX_t *mb = &pmb->mb;
        uint32_t did  = mb->un.varWords[1];
 
        if (mb->mbxStatus) {
                /* RegLogin failed */
-               lpfc_printf_log(phba, KERN_ERR, LOG_DISCOVERY,
-                               "%d (%d):0246 RegLogin failed Data: x%x x%x "
-                               "x%x\n",
-                               phba->brd_no, vport->vpi,
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_DISCOVERY,
+                               "0246 RegLogin failed Data: x%x x%x x%x\n",
                                did, mb->mbxStatus, vport->port_state);
-
                /*
                 * If RegLogin failed due to lack of HBA resources do not
                 * retry discovery.
@@ -1337,7 +1327,7 @@ lpfc_rcv_prlo_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 {
        struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
 
-       lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
+       lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
        return ndlp->nlp_state;
 }
 
@@ -1358,7 +1348,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        irsp = &rspiocb->iocb;
        if (irsp->ulpStatus) {
                if ((vport->port_type == LPFC_NPIV_PORT) &&
-                       phba->cfg_vport_restrict_login) {
+                   vport->cfg_restrict_login) {
                        goto out;
                }
                ndlp->nlp_prev_state = NLP_STE_PRLI_ISSUE;
@@ -1380,7 +1370,7 @@ lpfc_cmpl_prli_prli_issue(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        }
        if (!(ndlp->nlp_type & NLP_FCP_TARGET) &&
            (vport->port_type == LPFC_NPIV_PORT) &&
-            phba->cfg_vport_restrict_login) {
+            vport->cfg_restrict_login) {
 out:
                spin_lock_irq(shost->host_lock);
                ndlp->nlp_flag |= NLP_TARGET_REMOVE;
@@ -1529,7 +1519,7 @@ lpfc_rcv_prlo_unmap_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
 {
        struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
 
-       lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL, 0);
+       lpfc_els_rsp_acc(vport, ELS_CMD_PRLO, cmdiocb, ndlp, NULL);
        return ndlp->nlp_state;
 }
 
@@ -1600,8 +1590,8 @@ lpfc_rcv_prlo_mapped_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        struct lpfc_iocbq *cmdiocb = (struct lpfc_iocbq *) arg;
 
        /* flush the target */
-       lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
-                           ndlp->nlp_sid, 0, 0, LPFC_CTX_TGT);
+       lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
+                           ndlp->nlp_sid, 0, LPFC_CTX_TGT);
 
        /* Treat like rcv logo */
        lpfc_rcv_logo(vport, ndlp, cmdiocb, ELS_CMD_PRLO);
@@ -1734,7 +1724,7 @@ lpfc_rcv_prlo_npr_node(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        ndlp->nlp_flag |= NLP_LOGO_ACC;
        spin_unlock_irq(shost->host_lock);
 
-       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL, 0);
+       lpfc_els_rsp_acc(vport, ELS_CMD_ACC, cmdiocb, ndlp, NULL);
 
        if ((ndlp->nlp_flag & NLP_DELAY_TMO) == 0) {
                mod_timer(&ndlp->nlp_delayfunc, jiffies + HZ * 1);
@@ -2047,7 +2037,6 @@ int
 lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
                        void *arg, uint32_t evt)
 {
-       struct lpfc_hba  *phba = vport->phba;
        uint32_t cur_state, rc;
        uint32_t(*func) (struct lpfc_vport *, struct lpfc_nodelist *, void *,
                         uint32_t);
@@ -2056,11 +2045,10 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        cur_state = ndlp->nlp_state;
 
        /* DSM in event <evt> on NPort <nlp_DID> in state <cur_state> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0211 DSM in event x%x on NPort x%x in "
-                       "state %d Data: x%x\n",
-                       phba->brd_no, vport->vpi,
-                       evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0211 DSM in event x%x on NPort x%x in "
+                        "state %d Data: x%x\n",
+                        evt, ndlp->nlp_DID, cur_state, ndlp->nlp_flag);
 
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
                 "DSM in:          evt:%d ste:%d did:x%x",
@@ -2070,11 +2058,9 @@ lpfc_disc_state_machine(struct lpfc_vport *vport, struct lpfc_nodelist *ndlp,
        rc = (func) (vport, ndlp, arg, evt);
 
        /* DSM out state <rc> on NPort <nlp_DID> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_DISCOVERY,
-                       "%d (%d):0212 DSM out state %d on NPort x%x "
-                       "Data: x%x\n",
-                       phba->brd_no, vport->vpi,
-                       rc, ndlp->nlp_DID, ndlp->nlp_flag);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_DISCOVERY,
+                        "0212 DSM out state %d on NPort x%x Data: x%x\n",
+                        rc, ndlp->nlp_DID, ndlp->nlp_flag);
 
        lpfc_debugfs_disc_trc(vport, LPFC_DISC_TRC_DSM,
                 "DSM out:         ste:%d did:x%x flg:x%x",
index 8f45bbc421268d8f23eb48b97eff011d6389f95f..17d7dc05149b29a232680a85906b292d848c84a3 100644 (file)
@@ -84,22 +84,21 @@ lpfc_adjust_queue_depth(struct lpfc_hba *phba)
  * SCSI command completion.
  */
 static inline void
-lpfc_rampup_queue_depth(struct lpfc_hba *phba,
+lpfc_rampup_queue_depth(struct lpfc_vport  *vport,
                        struct scsi_device *sdev)
 {
        unsigned long flags;
+       struct lpfc_hba *phba = vport->phba;
        atomic_inc(&phba->num_cmd_success);
 
-       if (phba->cfg_lun_queue_depth <= sdev->queue_depth)
+       if (vport->cfg_lun_queue_depth <= sdev->queue_depth)
                return;
-
        spin_lock_irqsave(&phba->hbalock, flags);
        if (((phba->last_ramp_up_time + QUEUE_RAMP_UP_INTERVAL) > jiffies) ||
         ((phba->last_rsrc_error_time + QUEUE_RAMP_UP_INTERVAL ) > jiffies)) {
                spin_unlock_irqrestore(&phba->hbalock, flags);
                return;
        }
-
        phba->last_ramp_up_time = jiffies;
        spin_unlock_irqrestore(&phba->hbalock, flags);
 
@@ -119,43 +118,40 @@ lpfc_rampup_queue_depth(struct lpfc_hba *phba,
 void
 lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
 {
-       struct lpfc_vport *vport;
-       struct Scsi_Host  *host;
+       struct lpfc_vport **vports;
+       struct Scsi_Host  *shost;
        struct scsi_device *sdev;
        unsigned long new_queue_depth;
        unsigned long num_rsrc_err, num_cmd_success;
+       int i;
 
        num_rsrc_err = atomic_read(&phba->num_rsrc_err);
        num_cmd_success = atomic_read(&phba->num_cmd_success);
 
-       spin_lock_irq(&phba->hbalock);
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               host = lpfc_shost_from_vport(vport);
-               if (!scsi_host_get(host))
-                       continue;
-
-               spin_unlock_irq(&phba->hbalock);
-
-               shost_for_each_device(sdev, host) {
-                       new_queue_depth = sdev->queue_depth * num_rsrc_err /
-                       (num_rsrc_err + num_cmd_success);
-                       if (!new_queue_depth)
-                               new_queue_depth = sdev->queue_depth - 1;
-                       else
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       shost_for_each_device(sdev, shost) {
                                new_queue_depth =
-                                       sdev->queue_depth - new_queue_depth;
-
-                       if (sdev->ordered_tags)
-                               scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
-                                       new_queue_depth);
-                       else
-                               scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
-                                       new_queue_depth);
+                                       sdev->queue_depth * num_rsrc_err /
+                                       (num_rsrc_err + num_cmd_success);
+                               if (!new_queue_depth)
+                                       new_queue_depth = sdev->queue_depth - 1;
+                               else
+                                       new_queue_depth = sdev->queue_depth -
+                                                               new_queue_depth;
+                               if (sdev->ordered_tags)
+                                       scsi_adjust_queue_depth(sdev,
+                                                       MSG_ORDERED_TAG,
+                                                       new_queue_depth);
+                               else
+                                       scsi_adjust_queue_depth(sdev,
+                                                       MSG_SIMPLE_TAG,
+                                                       new_queue_depth);
+                       }
                }
-               spin_lock_irq(&phba->hbalock);
-               scsi_host_put(host);
-       }
-       spin_unlock_irq(&phba->hbalock);
+       lpfc_destroy_vport_work_array(vports);
        atomic_set(&phba->num_rsrc_err, 0);
        atomic_set(&phba->num_cmd_success, 0);
 }
@@ -163,29 +159,27 @@ lpfc_ramp_down_queue_handler(struct lpfc_hba *phba)
 void
 lpfc_ramp_up_queue_handler(struct lpfc_hba *phba)
 {
-       struct lpfc_vport *vport;
-       struct Scsi_Host  *host;
+       struct lpfc_vport **vports;
+       struct Scsi_Host  *shost;
        struct scsi_device *sdev;
-
-       spin_lock_irq(&phba->hbalock);
-       list_for_each_entry(vport, &phba->port_list, listentry) {
-               host = lpfc_shost_from_vport(vport);
-               if (!scsi_host_get(host))
-                       continue;
-
-               spin_unlock_irq(&phba->hbalock);
-               shost_for_each_device(sdev, host) {
-                       if (sdev->ordered_tags)
-                               scsi_adjust_queue_depth(sdev, MSG_ORDERED_TAG,
-                                       sdev->queue_depth+1);
-                       else
-                               scsi_adjust_queue_depth(sdev, MSG_SIMPLE_TAG,
-                                       sdev->queue_depth+1);
+       int i;
+
+       vports = lpfc_create_vport_work_array(phba);
+       if (vports != NULL)
+               for(i = 0; i < LPFC_MAX_VPORTS && vports[i] != NULL; i++) {
+                       shost = lpfc_shost_from_vport(vports[i]);
+                       shost_for_each_device(sdev, shost) {
+                               if (sdev->ordered_tags)
+                                       scsi_adjust_queue_depth(sdev,
+                                                       MSG_ORDERED_TAG,
+                                                       sdev->queue_depth+1);
+                               else
+                                       scsi_adjust_queue_depth(sdev,
+                                                       MSG_SIMPLE_TAG,
+                                                       sdev->queue_depth+1);
+                       }
                }
-               spin_lock_irq(&phba->hbalock);
-               scsi_host_put(host);
-       }
-       spin_unlock_irq(&phba->hbalock);
+       lpfc_destroy_vport_work_array(vports);
        atomic_set(&phba->num_rsrc_err, 0);
        atomic_set(&phba->num_cmd_success, 0);
 }
@@ -411,9 +405,7 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
        struct scsi_cmnd *cmnd = lpfc_cmd->pCmd;
        struct fcp_cmnd *fcpcmd = lpfc_cmd->fcp_cmnd;
        struct fcp_rsp *fcprsp = lpfc_cmd->fcp_rsp;
-       struct lpfc_hba *phba = vport->phba;
        uint32_t fcpi_parm = rsp_iocb->iocb.un.fcpi.fcpi_parm;
-       uint32_t vpi = vport->vpi;
        uint32_t resp_info = fcprsp->rspStatus2;
        uint32_t scsi_status = fcprsp->rspStatus3;
        uint32_t *lp;
@@ -445,15 +437,15 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
        if (!scsi_status && (resp_info & RESID_UNDER))
                logit = LOG_FCP;
 
-       lpfc_printf_log(phba, KERN_WARNING, logit,
-                       "%d (%d):0730 FCP command x%x failed: x%x SNS x%x x%x "
-                       "Data: x%x x%x x%x x%x x%x\n",
-                       phba->brd_no, vpi, cmnd->cmnd[0], scsi_status,
-                       be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info,
-                       be32_to_cpu(fcprsp->rspResId),
-                       be32_to_cpu(fcprsp->rspSnsLen),
-                       be32_to_cpu(fcprsp->rspRspLen),
-                       fcprsp->rspInfo3);
+       lpfc_printf_vlog(vport, KERN_WARNING, logit,
+                        "0730 FCP command x%x failed: x%x SNS x%x x%x "
+                        "Data: x%x x%x x%x x%x x%x\n",
+                        cmnd->cmnd[0], scsi_status,
+                        be32_to_cpu(*lp), be32_to_cpu(*(lp + 3)), resp_info,
+                        be32_to_cpu(fcprsp->rspResId),
+                        be32_to_cpu(fcprsp->rspSnsLen),
+                        be32_to_cpu(fcprsp->rspRspLen),
+                        fcprsp->rspInfo3);
 
        if (resp_info & RSP_LEN_VALID) {
                rsplen = be32_to_cpu(fcprsp->rspRspLen);
@@ -468,12 +460,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
        if (resp_info & RESID_UNDER) {
                scsi_set_resid(cmnd, be32_to_cpu(fcprsp->rspResId));
 
-               lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
-                               "%d (%d):0716 FCP Read Underrun, expected %d, "
-                               "residual %d Data: x%x x%x x%x\n",
-                               phba->brd_no, vpi, be32_to_cpu(fcpcmd->fcpDl),
-                               scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0],
-                               cmnd->underflow);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
+                                "0716 FCP Read Underrun, expected %d, "
+                                "residual %d Data: x%x x%x x%x\n",
+                                be32_to_cpu(fcpcmd->fcpDl),
+                                scsi_get_resid(cmnd), fcpi_parm, cmnd->cmnd[0],
+                                cmnd->underflow);
 
                /*
                 * If there is an under run check if under run reported by
@@ -483,14 +475,13 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
                if ((cmnd->sc_data_direction == DMA_FROM_DEVICE) &&
                        fcpi_parm &&
                        (scsi_get_resid(cmnd) != fcpi_parm)) {
-                       lpfc_printf_log(phba, KERN_WARNING,
-                                       LOG_FCP | LOG_FCP_ERROR,
-                                       "%d (%d):0735 FCP Read Check Error "
-                                       "and Underrun Data: x%x x%x x%x x%x\n",
-                                       phba->brd_no, vpi,
-                                       be32_to_cpu(fcpcmd->fcpDl),
-                                       scsi_get_resid(cmnd), fcpi_parm,
-                                       cmnd->cmnd[0]);
+                       lpfc_printf_vlog(vport, KERN_WARNING,
+                                        LOG_FCP | LOG_FCP_ERROR,
+                                        "0735 FCP Read Check Error "
+                                        "and Underrun Data: x%x x%x x%x x%x\n",
+                                        be32_to_cpu(fcpcmd->fcpDl),
+                                        scsi_get_resid(cmnd), fcpi_parm,
+                                        cmnd->cmnd[0]);
                        scsi_set_resid(cmnd, scsi_bufflen(cmnd));
                        host_status = DID_ERROR;
                }
@@ -504,21 +495,19 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
                    (scsi_status == SAM_STAT_GOOD) &&
                    (scsi_bufflen(cmnd) - scsi_get_resid(cmnd)
                     < cmnd->underflow)) {
-                       lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
-                                       "%d (%d):0717 FCP command x%x residual "
-                                       "underrun converted to error "
-                                       "Data: x%x x%x x%x\n",
-                                       phba->brd_no, vpi, cmnd->cmnd[0],
-                                       scsi_bufflen(cmnd),
-                                       scsi_get_resid(cmnd), cmnd->underflow);
+                       lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
+                                        "0717 FCP command x%x residual "
+                                        "underrun converted to error "
+                                        "Data: x%x x%x x%x\n",
+                                        cmnd->cmnd[0], scsi_bufflen(cmnd),
+                                        scsi_get_resid(cmnd), cmnd->underflow);
                        host_status = DID_ERROR;
                }
        } else if (resp_info & RESID_OVER) {
-               lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
-                               "%d (%d):0720 FCP command x%x residual "
-                               "overrun error. Data: x%x x%x \n",
-                               phba->brd_no, vpi, cmnd->cmnd[0],
-                               scsi_bufflen(cmnd), scsi_get_resid(cmnd));
+               lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+                                "0720 FCP command x%x residual overrun error. "
+                                "Data: x%x x%x \n", cmnd->cmnd[0],
+                                scsi_bufflen(cmnd), scsi_get_resid(cmnd));
                host_status = DID_ERROR;
 
        /*
@@ -527,13 +516,12 @@ lpfc_handle_fcp_err(struct lpfc_vport *vport, struct lpfc_scsi_buf *lpfc_cmd,
         */
        } else if ((scsi_status == SAM_STAT_GOOD) && fcpi_parm &&
                        (cmnd->sc_data_direction == DMA_FROM_DEVICE)) {
-               lpfc_printf_log(phba, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR,
-                               "%d (%d):0734 FCP Read Check Error Data: "
-                               "x%x x%x x%x x%x\n",
-                               phba->brd_no, vpi,
-                               be32_to_cpu(fcpcmd->fcpDl),
-                               be32_to_cpu(fcprsp->rspResId),
-                               fcpi_parm, cmnd->cmnd[0]);
+               lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP | LOG_FCP_ERROR,
+                                "0734 FCP Read Check Error Data: "
+                                "x%x x%x x%x x%x\n",
+                                be32_to_cpu(fcpcmd->fcpDl),
+                                be32_to_cpu(fcprsp->rspResId),
+                                fcpi_parm, cmnd->cmnd[0]);
                host_status = DID_ERROR;
                scsi_set_resid(cmnd, scsi_bufflen(cmnd));
        }
@@ -552,9 +540,6 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
        struct lpfc_rport_data *rdata = lpfc_cmd->rdata;
        struct lpfc_nodelist *pnode = rdata->pnode;
        struct scsi_cmnd *cmd = lpfc_cmd->pCmd;
-       uint32_t vpi = (lpfc_cmd->cur_iocbq.vport
-                       ? lpfc_cmd->cur_iocbq.vport->vpi
-                       : 0);
        int result;
        struct scsi_device *sdev, *tmp_sdev;
        int depth = 0;
@@ -569,15 +554,15 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                else if (lpfc_cmd->status >= IOSTAT_CNT)
                        lpfc_cmd->status = IOSTAT_DEFAULT;
 
-               lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
-                               "%d (%d):0729 FCP cmd x%x failed <%d/%d> "
-                               "status: x%x result: x%x Data: x%x x%x\n",
-                               phba->brd_no, vpi, cmd->cmnd[0],
-                               cmd->device ? cmd->device->id : 0xffff,
-                               cmd->device ? cmd->device->lun : 0xffff,
-                               lpfc_cmd->status, lpfc_cmd->result,
-                               pIocbOut->iocb.ulpContext,
-                               lpfc_cmd->cur_iocbq.iocb.ulpIoTag);
+               lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+                                "0729 FCP cmd x%x failed <%d/%d> "
+                                "status: x%x result: x%x Data: x%x x%x\n",
+                                cmd->cmnd[0],
+                                cmd->device ? cmd->device->id : 0xffff,
+                                cmd->device ? cmd->device->lun : 0xffff,
+                                lpfc_cmd->status, lpfc_cmd->result,
+                                pIocbOut->iocb.ulpContext,
+                                lpfc_cmd->cur_iocbq.iocb.ulpIoTag);
 
                switch (lpfc_cmd->status) {
                case IOSTAT_FCP_RSP_ERROR:
@@ -610,13 +595,12 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
        if (cmd->result || lpfc_cmd->fcp_rsp->rspSnsLen) {
                uint32_t *lp = (uint32_t *)cmd->sense_buffer;
 
-               lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
-                               "%d (%d):0710 Iodone <%d/%d> cmd %p, error "
-                               "x%x SNS x%x x%x Data: x%x x%x\n",
-                               phba->brd_no, vpi, cmd->device->id,
-                               cmd->device->lun, cmd, cmd->result,
-                               *lp, *(lp + 3), cmd->retries,
-                               scsi_get_resid(cmd));
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
+                                "0710 Iodone <%d/%d> cmd %p, error "
+                                "x%x SNS x%x x%x Data: x%x x%x\n",
+                                cmd->device->id, cmd->device->lun, cmd,
+                                cmd->result, *lp, *(lp + 3), cmd->retries,
+                                scsi_get_resid(cmd));
        }
 
        result = cmd->result;
@@ -631,16 +615,16 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
 
 
        if (!result)
-               lpfc_rampup_queue_depth(phba, sdev);
+               lpfc_rampup_queue_depth(vport, sdev);
 
        if (!result && pnode != NULL &&
           ((jiffies - pnode->last_ramp_up_time) >
                LPFC_Q_RAMP_UP_INTERVAL * HZ) &&
           ((jiffies - pnode->last_q_full_time) >
                LPFC_Q_RAMP_UP_INTERVAL * HZ) &&
-          (phba->cfg_lun_queue_depth > sdev->queue_depth)) {
+          (vport->cfg_lun_queue_depth > sdev->queue_depth)) {
                shost_for_each_device(tmp_sdev, sdev->host) {
-                       if (phba->cfg_lun_queue_depth > tmp_sdev->queue_depth) {
+                       if (vport->cfg_lun_queue_depth > tmp_sdev->queue_depth){
                                if (tmp_sdev->id != sdev->id)
                                        continue;
                                if (tmp_sdev->ordered_tags)
@@ -680,10 +664,9 @@ lpfc_scsi_cmd_iocb_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *pIocbIn,
                        depth = sdev->host->cmd_per_lun;
 
                if (depth) {
-                       lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
-                                       "%d (%d):0711 detected queue full - "
-                                       "lun queue depth  adjusted to %d.\n",
-                                       phba->brd_no, vpi, depth);
+                       lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+                                        "0711 detected queue full - lun queue "
+                                        "depth adjusted to %d.\n", depth);
                }
        }
 
@@ -853,12 +836,9 @@ lpfc_scsi_tgt_reset(struct lpfc_scsi_buf *lpfc_cmd, struct lpfc_vport *vport,
                return FAILED;
 
        /* Issue Target Reset to TGT <num> */
-       lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
-                       "%d (%d):0702 Issue Target Reset to TGT %d "
-                       "Data: x%x x%x\n",
-                       phba->brd_no, vport->vpi, tgt_id,
-                       rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
+                        "0702 Issue Target Reset to TGT %d Data: x%x x%x\n",
+                        tgt_id, rdata->pnode->nlp_rpi, rdata->pnode->nlp_flag);
        ret = lpfc_sli_issue_iocb_wait(phba,
                                       &phba->sli.ring[phba->sli.fcp_ring],
                                       iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -965,10 +945,9 @@ lpfc_queuecommand(struct scsi_cmnd *cmnd, void (*done) (struct scsi_cmnd *))
        if (lpfc_cmd == NULL) {
                lpfc_adjust_queue_depth(phba);
 
-               lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
-                               "%d (%d):0707 driver's buffer pool is empty, "
-                               "IO busied\n",
-                               phba->brd_no, vport->vpi);
+               lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
+                                "0707 driver's buffer pool is empty, "
+                                "IO busied\n");
                goto out_host_busy;
        }
 
@@ -1103,28 +1082,25 @@ lpfc_abort_handler(struct scsi_cmnd *cmnd)
 
                schedule_timeout_uninterruptible(LPFC_ABORT_WAIT * HZ);
                if (++loop_count
-                   > (2 * phba->cfg_devloss_tmo)/LPFC_ABORT_WAIT)
+                   > (2 * vport->cfg_devloss_tmo)/LPFC_ABORT_WAIT)
                        break;
        }
 
        if (lpfc_cmd->pCmd == cmnd) {
                ret = FAILED;
-               lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                               "%d (%d):0748 abort handler timed out waiting "
-                               "for abort to complete: ret %#x, ID %d, "
-                               "LUN %d, snum %#lx\n",
-                               phba->brd_no, vport->vpi, ret,
-                               cmnd->device->id, cmnd->device->lun,
-                               cmnd->serial_number);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                                "0748 abort handler timed out waiting "
+                                "for abort to complete: ret %#x, ID %d, "
+                                "LUN %d, snum %#lx\n",
+                                ret, cmnd->device->id, cmnd->device->lun,
+                                cmnd->serial_number);
        }
 
  out:
-       lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
-                       "%d (%d):0749 SCSI Layer I/O Abort Request "
-                       "Status x%x ID %d LUN %d snum %#lx\n",
-                       phba->brd_no, vport->vpi, ret, cmnd->device->id,
-                       cmnd->device->lun, cmnd->serial_number);
-
+       lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+                        "0749 SCSI Layer I/O Abort Request Status x%x ID %d "
+                        "LUN %d snum %#lx\n", ret, cmnd->device->id,
+                        cmnd->device->lun, cmnd->serial_number);
        return ret;
 }
 
@@ -1158,12 +1134,11 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
                        loopcnt++;
                        rdata = cmnd->device->hostdata;
                        if (!rdata ||
-                               (loopcnt > ((phba->cfg_devloss_tmo * 2) + 1))) {
-                               lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                                               "%d (%d):0721 LUN Reset rport "
-                                               "failure: cnt x%x rdata x%p\n",
-                                               phba->brd_no, vport->vpi,
-                                               loopcnt, rdata);
+                               (loopcnt > ((vport->cfg_devloss_tmo * 2) + 1))){
+                               lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                                                "0721 LUN Reset rport "
+                                                "failure: cnt x%x rdata x%p\n",
+                                                loopcnt, rdata);
                                goto out;
                        }
                        pnode = rdata->pnode;
@@ -1193,12 +1168,10 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
        if (iocbqrsp == NULL)
                goto out_free_scsi_buf;
 
-       lpfc_printf_log(phba, KERN_INFO, LOG_FCP,
-                       "%d (%d):0703 Issue target reset to TGT %d LUN %d "
-                       "rpi x%x nlp_flag x%x\n",
-                       phba->brd_no, vport->vpi, cmnd->device->id,
-                       cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag);
-
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_FCP,
+                        "0703 Issue target reset to TGT %d LUN %d "
+                        "rpi x%x nlp_flag x%x\n", cmnd->device->id,
+                        cmnd->device->lun, pnode->nlp_rpi, pnode->nlp_flag);
        iocb_status = lpfc_sli_issue_iocb_wait(phba,
                                       &phba->sli.ring[phba->sli.fcp_ring],
                                       iocbq, iocbqrsp, lpfc_cmd->timeout);
@@ -1221,33 +1194,28 @@ lpfc_device_reset_handler(struct scsi_cmnd *cmnd)
         * Unfortunately, some targets do not abide by this forcing the driver
         * to double check.
         */
-       cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
-                               cmnd->device->id, cmnd->device->lun,
+       cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id, cmnd->device->lun,
                                LPFC_CTX_LUN);
        if (cnt)
-               lpfc_sli_abort_iocb(phba,
-                                   &phba->sli.ring[phba->sli.fcp_ring],
+               lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
                                    cmnd->device->id, cmnd->device->lun,
-                                   0, LPFC_CTX_LUN);
+                                   LPFC_CTX_LUN);
        loopcnt = 0;
        while(cnt) {
                schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
 
                if (++loopcnt
-                   > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT)
+                   > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT)
                        break;
 
-               cnt = lpfc_sli_sum_iocb(phba,
-                                       &phba->sli.ring[phba->sli.fcp_ring],
-                                       cmnd->device->id, cmnd->device->lun,
-                                       LPFC_CTX_LUN);
+               cnt = lpfc_sli_sum_iocb(vport, cmnd->device->id,
+                                       cmnd->device->lun, LPFC_CTX_LUN);
        }
 
        if (cnt) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                               "%d (%d):0719 device reset I/O flush failure: "
-                               "cnt x%x\n",
-                               phba->brd_no, vport->vpi, cnt);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                                "0719 device reset I/O flush failure: "
+                                "cnt x%x\n", cnt);
                ret = FAILED;
        }
 
@@ -1255,12 +1223,11 @@ out_free_scsi_buf:
        if (iocb_status != IOCB_TIMEDOUT) {
                lpfc_release_scsi_buf(phba, lpfc_cmd);
        }
-       lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                       "%d (%d):0713 SCSI layer issued device reset (%d, %d) "
-                       "return x%x status x%x result x%x\n",
-                       phba->brd_no, vport->vpi, cmnd->device->id,
-                       cmnd->device->lun, ret, cmd_status, cmd_result);
-
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                        "0713 SCSI layer issued device reset (%d, %d) "
+                        "return x%x status x%x result x%x\n",
+                        cmnd->device->id, cmnd->device->lun, ret,
+                        cmd_status, cmd_result);
 out:
        return ret;
 }
@@ -1311,10 +1278,9 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
                                          cmnd->device->lun,
                                          ndlp->rport->dd_data);
                if (ret != SUCCESS) {
-                       lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                                       "%d (%d):0700 Bus Reset on target %d "
-                                       "failed\n",
-                                       phba->brd_no, vport->vpi, i);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                                        "0700 Bus Reset on target %d failed\n",
+                                        i);
                        err_count++;
                        break;
                }
@@ -1333,35 +1299,30 @@ lpfc_bus_reset_handler(struct scsi_cmnd *cmnd)
         * the targets.  Unfortunately, some targets do not abide by
         * this forcing the driver to double check.
         */
-       cnt = lpfc_sli_sum_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
-                               0, 0, LPFC_CTX_HOST);
+       cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST);
        if (cnt)
-               lpfc_sli_abort_iocb(phba, &phba->sli.ring[phba->sli.fcp_ring],
-                                   0, 0, 0, LPFC_CTX_HOST);
+               lpfc_sli_abort_iocb(vport, &phba->sli.ring[phba->sli.fcp_ring],
+                                   0, 0, LPFC_CTX_HOST);
        loopcnt = 0;
        while(cnt) {
                schedule_timeout_uninterruptible(LPFC_RESET_WAIT*HZ);
 
                if (++loopcnt
-                   > (2 * phba->cfg_devloss_tmo)/LPFC_RESET_WAIT)
+                   > (2 * vport->cfg_devloss_tmo)/LPFC_RESET_WAIT)
                        break;
 
-               cnt = lpfc_sli_sum_iocb(phba,
-                                       &phba->sli.ring[phba->sli.fcp_ring],
-                                       0, 0, LPFC_CTX_HOST);
+               cnt = lpfc_sli_sum_iocb(vport, 0, 0, LPFC_CTX_HOST);
        }
 
        if (cnt) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                               "%d (%d):0715 Bus Reset I/O flush failure: "
-                               "cnt x%x left x%x\n",
-                               phba->brd_no, vport->vpi, cnt, i);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                                "0715 Bus Reset I/O flush failure: "
+                                "cnt x%x left x%x\n", cnt, i);
                ret = FAILED;
        }
 
-       lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                       "%d (%d):0714 SCSI layer issued Bus Reset Data: x%x\n",
-                       phba->brd_no, vport->vpi, ret);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                        "0714 SCSI layer issued Bus Reset Data: x%x\n", ret);
 out:
        return ret;
 }
@@ -1390,36 +1351,32 @@ lpfc_slave_alloc(struct scsi_device *sdev)
         * extra.  This list of scsi bufs exists for the lifetime of the driver.
         */
        total = phba->total_scsi_bufs;
-       num_to_alloc = phba->cfg_lun_queue_depth + 2;
+       num_to_alloc = vport->cfg_lun_queue_depth + 2;
 
        /* Allow some exchanges to be available always to complete discovery */
        if (total >= phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) {
-               lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
-                               "%d (%d):0704 At limitation of %d "
-                               "preallocated command buffers\n",
-                               phba->brd_no, vport->vpi, total);
+               lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+                                "0704 At limitation of %d preallocated "
+                                "command buffers\n", total);
                return 0;
-
        /* Allow some exchanges to be available always to complete discovery */
        } else if (total + num_to_alloc >
                phba->cfg_hba_queue_depth - LPFC_DISC_IOCB_BUFF_COUNT ) {
-               lpfc_printf_log(phba, KERN_WARNING, LOG_FCP,
-                               "%d (%d):0705 Allocation request of %d "
-                               "command buffers will exceed max of %d.  "
-                               "Reducing allocation request to %d.\n",
-                               phba->brd_no, vport->vpi, num_to_alloc,
-                               phba->cfg_hba_queue_depth,
-                               (phba->cfg_hba_queue_depth - total));
+               lpfc_printf_vlog(vport, KERN_WARNING, LOG_FCP,
+                                "0705 Allocation request of %d "
+                                "command buffers will exceed max of %d.  "
+                                "Reducing allocation request to %d.\n",
+                                num_to_alloc, phba->cfg_hba_queue_depth,
+                                (phba->cfg_hba_queue_depth - total));
                num_to_alloc = phba->cfg_hba_queue_depth - total;
        }
 
        for (i = 0; i < num_to_alloc; i++) {
                scsi_buf = lpfc_new_scsi_buf(vport);
                if (!scsi_buf) {
-                       lpfc_printf_log(phba, KERN_ERR, LOG_FCP,
-                                       "%d (%d):0706 Failed to allocate "
-                                       "command buffer\n",
-                                       phba->brd_no, vport->vpi);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_FCP,
+                                        "0706 Failed to allocate "
+                                        "command buffer\n");
                        break;
                }
 
@@ -1439,9 +1396,9 @@ lpfc_slave_configure(struct scsi_device *sdev)
        struct fc_rport   *rport = starget_to_rport(sdev->sdev_target);
 
        if (sdev->tagged_supported)
-               scsi_activate_tcq(sdev, phba->cfg_lun_queue_depth);
+               scsi_activate_tcq(sdev, vport->cfg_lun_queue_depth);
        else
-               scsi_deactivate_tcq(sdev, phba->cfg_lun_queue_depth);
+               scsi_deactivate_tcq(sdev, vport->cfg_lun_queue_depth);
 
        /*
         * Initialize the fc transport attributes for the target
@@ -1449,7 +1406,7 @@ lpfc_slave_configure(struct scsi_device *sdev)
         * target pointer is stored in the starget_data for the
         * driver's sysfs entry point functions.
         */
-       rport->dev_loss_tmo = phba->cfg_devloss_tmo;
+       rport->dev_loss_tmo = vport->cfg_devloss_tmo;
 
        if (phba->cfg_poll & ENABLE_FCP_RING_POLLING) {
                lpfc_sli_poll_fcp_ring(phba);
@@ -1487,3 +1444,23 @@ struct scsi_host_template lpfc_template = {
        .shost_attrs            = lpfc_hba_attrs,
        .max_sectors            = 0xFFFF,
 };
+
+struct scsi_host_template lpfc_vport_template = {
+       .module                 = THIS_MODULE,
+       .name                   = LPFC_DRIVER_NAME,
+       .info                   = lpfc_info,
+       .queuecommand           = lpfc_queuecommand,
+       .eh_abort_handler       = lpfc_abort_handler,
+       .eh_device_reset_handler= lpfc_device_reset_handler,
+       .eh_bus_reset_handler   = lpfc_bus_reset_handler,
+       .slave_alloc            = lpfc_slave_alloc,
+       .slave_configure        = lpfc_slave_configure,
+       .slave_destroy          = lpfc_slave_destroy,
+       .scan_finished          = lpfc_scan_finished,
+       .this_id                = -1,
+       .sg_tablesize           = LPFC_SG_SEG_CNT,
+       .cmd_per_lun            = LPFC_CMD_PER_LUN,
+       .use_clustering         = ENABLE_CLUSTERING,
+       .shost_attrs            = lpfc_vport_attrs,
+       .max_sectors            = 0xFFFF,
+};
index f4d5a6b00fde92c3234337c3576a410ad6124313..ce5ff2bccba68198f0a3570029bb8a4cdec6441e 100644 (file)
@@ -49,9 +49,8 @@
                        lpfc_printf_log(phba, \
                                KERN_INFO, \
                                LOG_MBOX | LOG_SLI, \
-                               "%d (%d):0311 Mailbox command x%x cannot " \
+                               "(%d):0311 Mailbox command x%x cannot " \
                                "issue Data: x%x x%x x%x\n", \
-                               phba->brd_no, \
                                pmbox->vport ? pmbox->vport->vpi : 0, \
                                pmbox->mb.mbxCommand,           \
                                phba->pport->port_state,        \
@@ -231,13 +230,11 @@ lpfc_sli_ring_map(struct lpfc_hba *phba)
                rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
                if (rc != MBX_SUCCESS) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                                       "%d:0446 Adapter failed to init (%d), "
+                                       "0446 Adapter failed to init (%d), "
                                        "mbxCmd x%x CFG_RING, mbxStatus x%x, "
                                        "ring %d\n",
-                                       phba->brd_no, rc,
-                                       pmbox->mbxCommand,
-                                       pmbox->mbxStatus,
-                                       i);
+                                       rc, pmbox->mbxCommand,
+                                       pmbox->mbxStatus, i);
                        phba->link_state = LPFC_HBA_ERROR;
                        ret = -ENXIO;
                        break;
@@ -296,9 +293,9 @@ lpfc_sli_next_iocb_slot (struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
 
                if (unlikely(pring->local_getidx >= max_cmd_idx)) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                                       "%d:0315 Ring %d issue: portCmdGet %d "
+                                       "0315 Ring %d issue: portCmdGet %d "
                                        "is bigger then cmd ring %d\n",
-                                       phba->brd_no, pring->ringno,
+                                       pring->ringno,
                                        pring->local_getidx, max_cmd_idx);
 
                        phba->link_state = LPFC_HBA_ERROR;
@@ -366,7 +363,7 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
                        if (psli->iocbq_lookup)
                                memcpy(new_arr, old_arr,
                                       ((psli->last_iotag  + 1) *
-                                       sizeof (struct lpfc_iocbq *)));
+                                       sizeof (struct lpfc_iocbq *)));
                        psli->iocbq_lookup = new_arr;
                        psli->iocbq_lookup_len = new_len;
                        psli->last_iotag = iotag;
@@ -380,8 +377,8 @@ lpfc_sli_next_iotag(struct lpfc_hba *phba, struct lpfc_iocbq *iocbq)
                spin_unlock_irq(&phba->hbalock);
 
        lpfc_printf_log(phba, KERN_ERR,LOG_SLI,
-                       "%d:0318 Failed to allocate IOTAG.last IOTAG is %d\n",
-                       phba->brd_no, psli->last_iotag);
+                       "0318 Failed to allocate IOTAG.last IOTAG is %d\n",
+                       psli->last_iotag);
 
        return 0;
 }
@@ -395,6 +392,14 @@ lpfc_sli_submit_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
         */
        nextiocb->iocb.ulpIoTag = (nextiocb->iocb_cmpl) ? nextiocb->iotag : 0;
 
+       if (pring->ringno == LPFC_ELS_RING) {
+               lpfc_debugfs_slow_ring_trc(phba,
+                       "IOCB cmd ring:   wd4:x%08x wd6:x%08x wd7:x%08x",
+                       *(((uint32_t *) &nextiocb->iocb) + 4),
+                       *(((uint32_t *) &nextiocb->iocb) + 6),
+                       *(((uint32_t *) &nextiocb->iocb) + 7));
+       }
+
        /*
         * Issue iocb command to adapter
         */
@@ -527,10 +532,9 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno)
                if (unlikely(hbqp->local_hbqGetIdx >= hbqp->entry_count)) {
                        lpfc_printf_log(phba, KERN_ERR,
                                        LOG_SLI | LOG_VPORT,
-                                       "%d:1802 HBQ %d: local_hbqGetIdx "
+                                       "1802 HBQ %d: local_hbqGetIdx "
                                        "%u is > than hbqp->entry_count %u\n",
-                                       phba->brd_no, hbqno,
-                                       hbqp->local_hbqGetIdx,
+                                       hbqno, hbqp->local_hbqGetIdx,
                                        hbqp->entry_count);
 
                        phba->link_state = LPFC_HBA_ERROR;
@@ -541,7 +545,8 @@ lpfc_sli_next_hbq_slot(struct lpfc_hba *phba, uint32_t hbqno)
                        return NULL;
        }
 
-       return (struct lpfc_hbq_entry *) phba->hbqslimp.virt + hbqp->hbqPutIdx;
+       return (struct lpfc_hbq_entry *) phba->hbqs[hbqno].hbq_virt +
+                       hbqp->hbqPutIdx;
 }
 
 void
@@ -549,18 +554,21 @@ lpfc_sli_hbqbuf_free_all(struct lpfc_hba *phba)
 {
        struct lpfc_dmabuf *dmabuf, *next_dmabuf;
        struct hbq_dmabuf *hbq_buf;
+       int i, hbq_count;
 
+       hbq_count = lpfc_sli_hbq_count();
        /* Return all memory used by all HBQs */
-       list_for_each_entry_safe(dmabuf, next_dmabuf,
-                                &phba->hbq_buffer_list, list) {
-               hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf);
-               list_del(&hbq_buf->dbuf.list);
-               lpfc_hbq_free(phba, hbq_buf->dbuf.virt, hbq_buf->dbuf.phys);
-               kfree(hbq_buf);
+       for (i = 0; i < hbq_count; ++i) {
+               list_for_each_entry_safe(dmabuf, next_dmabuf,
+                               &phba->hbqs[i].hbq_buffer_list, list) {
+                       hbq_buf = container_of(dmabuf, struct hbq_dmabuf, dbuf);
+                       list_del(&hbq_buf->dbuf.list);
+                       (phba->hbqs[i].hbq_free_buffer)(phba, hbq_buf);
+               }
        }
 }
 
-static void
+static struct lpfc_hbq_entry *
 lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno,
                         struct hbq_dmabuf *hbq_buf)
 {
@@ -574,7 +582,7 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno,
 
                hbqe->bde.addrHigh = le32_to_cpu(putPaddrHigh(physaddr));
                hbqe->bde.addrLow  = le32_to_cpu(putPaddrLow(physaddr));
-               hbqe->bde.tus.f.bdeSize = FCELSSIZE;
+               hbqe->bde.tus.f.bdeSize = hbq_buf->size;
                hbqe->bde.tus.f.bdeFlags = 0;
                hbqe->bde.tus.w = le32_to_cpu(hbqe->bde.tus.w);
                hbqe->buffer_tag = le32_to_cpu(hbq_buf->tag);
@@ -583,8 +591,9 @@ lpfc_sli_hbq_to_firmware(struct lpfc_hba *phba, uint32_t hbqno,
                writel(hbqp->hbqPutIdx, phba->hbq_put + hbqno);
                                /* flush */
                readl(phba->hbq_put + hbqno);
-               list_add_tail(&hbq_buf->dbuf.list, &phba->hbq_buffer_list);
+               list_add_tail(&hbq_buf->dbuf.list, &hbqp->hbq_buffer_list);
        }
+       return hbqe;
 }
 
 static struct lpfc_hbq_init lpfc_els_hbq = {
@@ -592,22 +601,38 @@ static struct lpfc_hbq_init lpfc_els_hbq = {
        .entry_count = 200,
        .mask_count = 0,
        .profile = 0,
-       .ring_mask = 1 << LPFC_ELS_RING,
+       .ring_mask = (1 << LPFC_ELS_RING),
        .buffer_count = 0,
        .init_count = 20,
        .add_count = 5,
 };
 
-static struct lpfc_hbq_init *lpfc_hbq_defs[] = {
+static struct lpfc_hbq_init lpfc_extra_hbq = {
+       .rn = 1,
+       .entry_count = 200,
+       .mask_count = 0,
+       .profile = 0,
+       .ring_mask = (1 << LPFC_EXTRA_RING),
+       .buffer_count = 0,
+       .init_count = 0,
+       .add_count = 5,
+};
+
+struct lpfc_hbq_init *lpfc_hbq_defs[] = {
        &lpfc_els_hbq,
+       &lpfc_extra_hbq,
 };
 
-int
+static int
 lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
 {
        uint32_t i, start, end;
        struct hbq_dmabuf *hbq_buffer;
 
+       if (!phba->hbqs[hbqno].hbq_alloc_buffer) {
+               return 0;
+       }
+
        start = lpfc_hbq_defs[hbqno]->buffer_count;
        end = count + lpfc_hbq_defs[hbqno]->buffer_count;
        if (end > lpfc_hbq_defs[hbqno]->entry_count) {
@@ -616,17 +641,14 @@ lpfc_sli_hbqbuf_fill_hbqs(struct lpfc_hba *phba, uint32_t hbqno, uint32_t count)
 
        /* Populate HBQ entries */
        for (i = start; i < end; i++) {
-               hbq_buffer = kmalloc(sizeof(struct hbq_dmabuf),
-                                    GFP_KERNEL);
+               hbq_buffer = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
                if (!hbq_buffer)
                        return 1;
-               hbq_buffer->dbuf.virt = lpfc_hbq_alloc(phba, MEM_PRI,
-                                                       &hbq_buffer->dbuf.phys);
-               if (hbq_buffer->dbuf.virt == NULL)
-                       return 1;
                hbq_buffer->tag = (i | (hbqno << 16));
-               lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer);
-               lpfc_hbq_defs[hbqno]->buffer_count++;
+               if (lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer))
+                       lpfc_hbq_defs[hbqno]->buffer_count++;
+               else
+                       (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
        }
        return 0;
 }
@@ -650,28 +672,34 @@ lpfc_sli_hbqbuf_find(struct lpfc_hba *phba, uint32_t tag)
 {
        struct lpfc_dmabuf *d_buf;
        struct hbq_dmabuf *hbq_buf;
+       uint32_t hbqno;
+
+       hbqno = tag >> 16;
+       if (hbqno > LPFC_MAX_HBQS)
+               return NULL;
 
-       list_for_each_entry(d_buf, &phba->hbq_buffer_list, list) {
+       list_for_each_entry(d_buf, &phba->hbqs[hbqno].hbq_buffer_list, list) {
                hbq_buf = container_of(d_buf, struct hbq_dmabuf, dbuf);
-               if ((hbq_buf->tag & 0xffff) == tag) {
+               if (hbq_buf->tag == tag) {
                        return hbq_buf;
                }
        }
        lpfc_printf_log(phba, KERN_ERR, LOG_SLI | LOG_VPORT,
-                       "%d:1803 Bad hbq tag. Data: x%x x%x\n",
-                       phba->brd_no, tag,
-                       lpfc_hbq_defs[tag >> 16]->buffer_count);
+                       "1803 Bad hbq tag. Data: x%x x%x\n",
+                       tag, lpfc_hbq_defs[tag >> 16]->buffer_count);
        return NULL;
 }
 
 void
-lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *sp)
+lpfc_sli_free_hbq(struct lpfc_hba *phba, struct hbq_dmabuf *hbq_buffer)
 {
        uint32_t hbqno;
 
-       if (sp) {
-               hbqno = sp->tag >> 16;
-               lpfc_sli_hbq_to_firmware(phba, hbqno, sp);
+       if (hbq_buffer) {
+               hbqno = hbq_buffer->tag >> 16;
+               if (!lpfc_sli_hbq_to_firmware(phba, hbqno, hbq_buffer)) {
+                       (phba->hbqs[hbqno].hbq_free_buffer)(phba, hbq_buffer);
+               }
        }
 }
 
@@ -837,12 +865,10 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
                 */
                if (lpfc_sli_chk_mbx_command(pmbox->mbxCommand) ==
                    MBX_SHUTDOWN) {
-
                        /* Unknow mailbox command compl */
                        lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
-                                       "%d (%d):0323 Unknown Mailbox command "
+                                       "(%d):0323 Unknown Mailbox command "
                                        "%x Cmpl\n",
-                                       phba->brd_no,
                                        pmb->vport ? pmb->vport->vpi : 0,
                                        pmbox->mbxCommand);
                        phba->link_state = LPFC_HBA_ERROR;
@@ -857,10 +883,9 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
                                /* Mbox cmd cmpl error - RETRYing */
                                lpfc_printf_log(phba, KERN_INFO,
                                                LOG_MBOX | LOG_SLI,
-                                               "%d (%d):0305 Mbox cmd cmpl "
+                                               "(%d):0305 Mbox cmd cmpl "
                                                "error - RETRYing Data: x%x "
                                                "x%x x%x x%x\n",
-                                               phba->brd_no,
                                                pmb->vport ? pmb->vport->vpi :0,
                                                pmbox->mbxCommand,
                                                pmbox->mbxStatus,
@@ -879,9 +904,8 @@ lpfc_sli_handle_mb_event(struct lpfc_hba *phba)
 
                /* Mailbox cmd <cmd> Cmpl <cmpl> */
                lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
-                               "%d (%d):0307 Mailbox cmd x%x Cmpl x%p "
+                               "(%d):0307 Mailbox cmd x%x Cmpl x%p "
                                "Data: x%x x%x x%x x%x x%x x%x x%x x%x x%x\n",
-                               phba->brd_no,
                                pmb->vport ? pmb->vport->vpi : 0,
                                pmbox->mbxCommand,
                                pmb->mbox_cmpl,
@@ -905,21 +929,26 @@ static struct lpfc_dmabuf *
 lpfc_sli_replace_hbqbuff(struct lpfc_hba *phba, uint32_t tag)
 {
        struct hbq_dmabuf *hbq_entry, *new_hbq_entry;
+       uint32_t hbqno;
+       void *virt;             /* virtual address ptr */
+       dma_addr_t phys;        /* mapped address */
 
        hbq_entry = lpfc_sli_hbqbuf_find(phba, tag);
        if (hbq_entry == NULL)
                return NULL;
        list_del(&hbq_entry->dbuf.list);
-       new_hbq_entry = kmalloc(sizeof(struct hbq_dmabuf), GFP_ATOMIC);
+
+       hbqno = tag >> 16;
+       new_hbq_entry = (phba->hbqs[hbqno].hbq_alloc_buffer)(phba);
        if (new_hbq_entry == NULL)
                return &hbq_entry->dbuf;
-       new_hbq_entry->dbuf = hbq_entry->dbuf;
        new_hbq_entry->tag = -1;
-       hbq_entry->dbuf.virt = lpfc_hbq_alloc(phba, 0, &hbq_entry->dbuf.phys);
-       if (hbq_entry->dbuf.virt == NULL) {
-               kfree(new_hbq_entry);
-               return &hbq_entry->dbuf;
-       }
+       phys = new_hbq_entry->dbuf.phys;
+       virt = new_hbq_entry->dbuf.virt;
+       new_hbq_entry->dbuf.phys = hbq_entry->dbuf.phys;
+       new_hbq_entry->dbuf.virt = hbq_entry->dbuf.virt;
+       hbq_entry->dbuf.phys = phys;
+       hbq_entry->dbuf.virt = virt;
        lpfc_sli_free_hbq(phba, hbq_entry);
        return &new_hbq_entry->dbuf;
 }
@@ -965,7 +994,7 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                                                irsp->un.ulpWord[3]);
                if (irsp->ulpBdeCount == 2)
                        saveq->context3 = lpfc_sli_replace_hbqbuff(phba,
-                                               irsp->un.ulpWord[15]);
+                                               irsp->unsli3.sli3Words[7]);
        }
 
        /* unSolicited Responses */
@@ -996,12 +1025,9 @@ lpfc_sli_process_unsol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                /* Ring <ringno> handler: unexpected
                   Rctl <Rctl> Type <Type> received */
                lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
-                               "%d:0313 Ring %d handler: unexpected Rctl x%x "
+                               "0313 Ring %d handler: unexpected Rctl x%x "
                                "Type x%x received\n",
-                               phba->brd_no,
-                               pring->ringno,
-                               Rctl,
-                               Type);
+                               pring->ringno, Rctl, Type);
        }
        return 1;
 }
@@ -1024,10 +1050,9 @@ lpfc_sli_iocbq_lookup(struct lpfc_hba *phba,
        }
 
        lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                       "%d:0317 iotag x%x is out off "
+                       "0317 iotag x%x is out off "
                        "range: max iotag x%x wd0 x%x\n",
-                       phba->brd_no, iotag,
-                       phba->sli.last_iotag,
+                       iotag, phba->sli.last_iotag,
                        *(((uint32_t *) &prspiocb->iocb) + 7));
        return NULL;
 }
@@ -1075,18 +1100,16 @@ lpfc_sli_process_sol_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
                         * Ring <ringno> handler: unexpected completion IoTag
                         * <IoTag>
                         */
-                       lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
-                                       "%d (%d):0322 Ring %d handler: "
-                                       "unexpected completion IoTag x%x "
-                                       "Data: x%x x%x x%x x%x\n",
-                                       phba->brd_no,
-                                       cmdiocbp->vport->vpi,
-                                       pring->ringno,
-                                       saveq->iocb.ulpIoTag,
-                                       saveq->iocb.ulpStatus,
-                                       saveq->iocb.un.ulpWord[4],
-                                       saveq->iocb.ulpCommand,
-                                       saveq->iocb.ulpContext);
+                       lpfc_printf_vlog(cmdiocbp->vport, KERN_WARNING, LOG_SLI,
+                                        "0322 Ring %d handler: "
+                                        "unexpected completion IoTag x%x "
+                                        "Data: x%x x%x x%x x%x\n",
+                                        pring->ringno,
+                                        saveq->iocb.ulpIoTag,
+                                        saveq->iocb.ulpStatus,
+                                        saveq->iocb.un.ulpWord[4],
+                                        saveq->iocb.ulpCommand,
+                                        saveq->iocb.ulpContext);
                }
        }
 
@@ -1104,10 +1127,9 @@ lpfc_sli_rsp_pointers_error(struct lpfc_hba *phba, struct lpfc_sli_ring *pring)
         * rsp ring <portRspMax>
         */
        lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                       "%d:0312 Ring %d handler: portRspPut %d "
+                       "0312 Ring %d handler: portRspPut %d "
                        "is bigger then rsp ring %d\n",
-                       phba->brd_no, pring->ringno,
-                       le32_to_cpu(pgp->rspPutInx),
+                       pring->ringno, le32_to_cpu(pgp->rspPutInx),
                        pring->numRiocb);
 
        phba->link_state = LPFC_HBA_ERROR;
@@ -1177,9 +1199,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
                if (unlikely(irsp->ulpStatus)) {
                        /* Rsp ring <ringno> error: IOCB */
                        lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
-                                       "%d:0326 Rsp Ring %d error: IOCB Data: "
+                                       "0326 Rsp Ring %d error: IOCB Data: "
                                        "x%x x%x x%x x%x x%x x%x x%x x%x\n",
-                                       phba->brd_no, pring->ringno,
+                                       pring->ringno,
                                        irsp->un.ulpWord[0],
                                        irsp->un.ulpWord[1],
                                        irsp->un.ulpWord[2],
@@ -1199,9 +1221,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
                         */
                        if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {
                                lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                                               "%d:0314 IOCB cmd 0x%x"
-                                               " processed. Skipping"
-                                               " completion", phba->brd_no,
+                                               "0314 IOCB cmd 0x%x "
+                                               "processed. Skipping "
+                                               "completion",
                                                irsp->ulpCommand);
                                break;
                        }
@@ -1226,10 +1248,9 @@ void lpfc_sli_poll_fcp_ring(struct lpfc_hba *phba)
                        } else {
                                /* Unknown IOCB command */
                                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                                               "%d:0321 Unknown IOCB command "
+                                               "0321 Unknown IOCB command "
                                                "Data: x%x, x%x x%x x%x x%x\n",
-                                               phba->brd_no, type,
-                                               irsp->ulpCommand,
+                                               type, irsp->ulpCommand,
                                                irsp->ulpStatus,
                                                irsp->ulpIoTag,
                                                irsp->ulpContext);
@@ -1353,9 +1374,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
 
                        /* Rsp ring <ringno> error: IOCB */
                        lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
-                                       "%d:0336 Rsp Ring %d error: IOCB Data: "
+                                       "0336 Rsp Ring %d error: IOCB Data: "
                                        "x%x x%x x%x x%x x%x x%x x%x x%x\n",
-                                       phba->brd_no, pring->ringno,
+                                       pring->ringno,
                                        irsp->un.ulpWord[0],
                                        irsp->un.ulpWord[1],
                                        irsp->un.ulpWord[2],
@@ -1375,10 +1396,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
                         */
                        if (unlikely(irsp->ulpCommand == CMD_XRI_ABORTED_CX)) {
                                lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                                               "%d:0333 IOCB cmd 0x%x"
+                                               "0333 IOCB cmd 0x%x"
                                                " processed. Skipping"
                                                " completion\n",
-                                               phba->brd_no,
                                                irsp->ulpCommand);
                                break;
                        }
@@ -1415,10 +1435,9 @@ lpfc_sli_handle_fast_ring_event(struct lpfc_hba *phba,
                        } else {
                                /* Unknown IOCB command */
                                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                                               "%d:0334 Unknown IOCB command "
+                                               "0334 Unknown IOCB command "
                                                "Data: x%x, x%x x%x x%x x%x\n",
-                                               phba->brd_no, type,
-                                               irsp->ulpCommand,
+                                               type, irsp->ulpCommand,
                                                irsp->ulpStatus,
                                                irsp->ulpIoTag,
                                                irsp->ulpContext);
@@ -1496,10 +1515,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
                 * rsp ring <portRspMax>
                 */
                lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                               "%d:0303 Ring %d handler: portRspPut %d "
+                               "0303 Ring %d handler: portRspPut %d "
                                "is bigger then rsp ring %d\n",
-                               phba->brd_no, pring->ringno, portRspPut,
-                               portRspMax);
+                               pring->ringno, portRspPut, portRspMax);
 
                phba->link_state = LPFC_HBA_ERROR;
                spin_unlock_irqrestore(&phba->hbalock, iflag);
@@ -1542,6 +1560,14 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
                if (++pring->rspidx >= portRspMax)
                        pring->rspidx = 0;
 
+               if (pring->ringno == LPFC_ELS_RING) {
+                       lpfc_debugfs_slow_ring_trc(phba,
+                       "IOCB rsp ring:   wd4:x%08x wd6:x%08x wd7:x%08x",
+                               *(((uint32_t *) irsp) + 4),
+                               *(((uint32_t *) irsp) + 6),
+                               *(((uint32_t *) irsp) + 7));
+               }
+
                writel(pring->rspidx, &phba->host_gp[pring->ringno].rspGetInx);
 
                if (list_empty(&(pring->iocb_continueq))) {
@@ -1580,13 +1606,12 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
                        if (irsp->ulpStatus) {
                                /* Rsp ring <ringno> error: IOCB */
                                lpfc_printf_log(phba, KERN_WARNING, LOG_SLI,
-                                               "%d:0328 Rsp Ring %d error: "
+                                               "0328 Rsp Ring %d error: "
                                                "IOCB Data: "
                                                "x%x x%x x%x x%x "
                                                "x%x x%x x%x x%x "
                                                "x%x x%x x%x x%x "
                                                "x%x x%x x%x x%x\n",
-                                               phba->brd_no,
                                                pring->ringno,
                                                irsp->un.ulpWord[0],
                                                irsp->un.ulpWord[1],
@@ -1661,10 +1686,9 @@ lpfc_sli_handle_slow_ring_event(struct lpfc_hba *phba,
                                } else {
                                        /* Unknown IOCB command */
                                        lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                                                       "%d:0335 Unknown IOCB "
+                                                       "0335 Unknown IOCB "
                                                        "command Data: x%x "
                                                        "x%x x%x x%x\n",
-                                                       phba->brd_no,
                                                        irsp->ulpCommand,
                                                        irsp->ulpStatus,
                                                        irsp->ulpIoTag,
@@ -1892,8 +1916,8 @@ lpfc_sli_brdkill(struct lpfc_hba *phba)
 
        /* Kill HBA */
        lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                       "%d:0329 Kill HBA Data: x%x x%x\n",
-                       phba->brd_no, phba->pport->port_state, psli->sli_flag);
+                       "0329 Kill HBA Data: x%x x%x\n",
+                       phba->pport->port_state, psli->sli_flag);
 
        if ((pmb = (LPFC_MBOXQ_t *) mempool_alloc(phba->mbox_mem_pool,
                                                  GFP_KERNEL)) == 0)
@@ -1966,7 +1990,7 @@ lpfc_sli_brdreset(struct lpfc_hba *phba)
 
        /* Reset HBA */
        lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                       "%d:0325 Reset HBA Data: x%x x%x\n", phba->brd_no,
+                       "0325 Reset HBA Data: x%x x%x\n",
                        phba->pport->port_state, psli->sli_flag);
 
        /* perform board reset */
@@ -2021,7 +2045,7 @@ lpfc_sli_brdrestart(struct lpfc_hba *phba)
 
        /* Restart HBA */
        lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                       "%d:0337 Restart HBA Data: x%x x%x\n", phba->brd_no,
+                       "0337 Restart HBA Data: x%x x%x\n",
                        phba->pport->port_state, psli->sli_flag);
 
        word0 = 0;
@@ -2086,9 +2110,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
                        /* Adapter failed to init, timeout, status reg
                           <status> */
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                                       "%d:0436 Adapter failed to init, "
-                                       "timeout, status reg x%x\n",
-                                       phba->brd_no, status);
+                                       "0436 Adapter failed to init, "
+                                       "timeout, status reg x%x\n", status);
                        phba->link_state = LPFC_HBA_ERROR;
                        return -ETIMEDOUT;
                }
@@ -2099,10 +2122,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
                        /* Adapter failed to init, chipset, status reg
                           <status> */
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                                       "%d:0437 Adapter failed to init, "
-                                       "chipset, status reg x%x\n",
-                                       phba->brd_no,
-                                       status);
+                                       "0437 Adapter failed to init, "
+                                       "chipset, status reg x%x\n", status);
                        phba->link_state = LPFC_HBA_ERROR;
                        return -EIO;
                }
@@ -2129,10 +2150,8 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
                /* ERROR: During chipset initialization */
                /* Adapter failed to init, chipset, status reg <status> */
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0438 Adapter failed to init, chipset, "
-                               "status reg x%x\n",
-                               phba->brd_no,
-                               status);
+                               "0438 Adapter failed to init, chipset, "
+                               "status reg x%x\n", status);
                phba->link_state = LPFC_HBA_ERROR;
                return -EIO;
        }
@@ -2147,7 +2166,7 @@ lpfc_sli_chipset_init(struct lpfc_hba *phba)
        return 0;
 }
 
-static int
+int
 lpfc_sli_hbq_count(void)
 {
        return ARRAY_SIZE(lpfc_hbq_defs);
@@ -2200,8 +2219,8 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba)
                phba->hbqs[hbqno].local_hbqGetIdx   = 0;
                phba->hbqs[hbqno].entry_count =
                        lpfc_hbq_defs[hbqno]->entry_count;
-               lpfc_config_hbq(phba, lpfc_hbq_defs[hbqno], hbq_entry_index,
-                               pmb);
+               lpfc_config_hbq(phba, hbqno, lpfc_hbq_defs[hbqno],
+                       hbq_entry_index, pmb);
                hbq_entry_index += phba->hbqs[hbqno].entry_count;
 
                if (lpfc_sli_issue_mbox(phba, pmb, MBX_POLL) != MBX_SUCCESS) {
@@ -2210,9 +2229,9 @@ lpfc_sli_hbq_setup(struct lpfc_hba *phba)
 
                        lpfc_printf_log(phba, KERN_ERR,
                                        LOG_SLI | LOG_VPORT,
-                                       "%d:1805 Adapter failed to init. "
+                                       "1805 Adapter failed to init. "
                                        "Data: x%x x%x x%x\n",
-                                       phba->brd_no, pmbox->mbxCommand,
+                                       pmbox->mbxCommand,
                                        pmbox->mbxStatus, hbqno);
 
                        phba->link_state = LPFC_HBA_ERROR;
@@ -2279,10 +2298,9 @@ lpfc_do_config_port(struct lpfc_hba *phba, int sli_mode)
                rc = lpfc_sli_issue_mbox(phba, pmb, MBX_POLL);
                if (rc != MBX_SUCCESS) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0442 Adapter failed to init, mbxCmd x%x "
+                               "0442 Adapter failed to init, mbxCmd x%x "
                                "CONFIG_PORT, mbxStatus x%x Data: x%x\n",
-                               phba->brd_no, pmb->mb.mbxCommand,
-                               pmb->mb.mbxStatus, 0);
+                               pmb->mb.mbxCommand, pmb->mb.mbxStatus, 0);
                        spin_lock_irq(&phba->hbalock);
                        phba->sli.sli_flag &= ~LPFC_SLI2_ACTIVE;
                        spin_unlock_irq(&phba->hbalock);
@@ -2321,11 +2339,11 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
 
        switch (lpfc_sli_mode) {
        case 2:
-               if (phba->cfg_npiv_enable) {
+               if (phba->cfg_enable_npiv) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
-                               "%d:1824 NPIV enabled: Override lpfc_sli_mode "
+                               "1824 NPIV enabled: Override lpfc_sli_mode "
                                "parameter (%d) to auto (0).\n",
-                               phba->brd_no, lpfc_sli_mode);
+                               lpfc_sli_mode);
                        break;
                }
                mode = 2;
@@ -2335,9 +2353,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
                break;
        default:
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
-                               "%d:1819 Unrecognized lpfc_sli_mode "
-                               "parameter: %d.\n",
-                               phba->brd_no, lpfc_sli_mode);
+                               "1819 Unrecognized lpfc_sli_mode "
+                               "parameter: %d.\n", lpfc_sli_mode);
 
                break;
        }
@@ -2345,9 +2362,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
        rc = lpfc_do_config_port(phba, mode);
        if (rc && lpfc_sli_mode == 3)
                lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
-                               "%d:1820 Unable to select SLI-3.  "
-                               "Not supported by adapter.\n",
-                               phba->brd_no);
+                               "1820 Unable to select SLI-3.  "
+                               "Not supported by adapter.\n");
        if (rc && mode != 2)
                rc = lpfc_do_config_port(phba, 2);
        if (rc)
@@ -2366,8 +2382,8 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
        }
 
        lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                       "%d:0444 Firmware in SLI %x mode. Max_vpi %d\n",
-                       phba->brd_no, phba->sli_rev, phba->max_vpi);
+                       "0444 Firmware in SLI %x mode. Max_vpi %d\n",
+                       phba->sli_rev, phba->max_vpi);
        rc = lpfc_sli_ring_map(phba);
 
        if (rc)
@@ -2392,8 +2408,7 @@ lpfc_sli_hba_setup(struct lpfc_hba *phba)
 lpfc_sli_hba_setup_error:
        phba->link_state = LPFC_HBA_ERROR;
        lpfc_printf_log(phba, KERN_INFO, LOG_INIT,
-                       "%d:0445 Firmware initialization failed\n",
-                       phba->brd_no);
+                       "0445 Firmware initialization failed\n");
        return rc;
 }
 
@@ -2445,9 +2460,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
 
        /* Mbox cmd <mbxCommand> timeout */
        lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
-                       "%d:0310 Mailbox command x%x timeout Data: x%x x%x "
-                       "x%p\n",
-                       phba->brd_no,
+                       "0310 Mailbox command x%x timeout Data: x%x x%x x%p\n",
                        mb->mbxCommand,
                        phba->pport->port_state,
                        phba->sli.sli_flag,
@@ -2470,8 +2483,7 @@ lpfc_mbox_timeout_handler(struct lpfc_hba *phba)
        lpfc_sli_abort_iocb_ring(phba, pring);
 
        lpfc_printf_log(phba, KERN_ERR, LOG_MBOX | LOG_SLI,
-                       "%d:0316 Resetting board due to mailbox timeout\n",
-                       phba->brd_no);
+                       "0316 Resetting board due to mailbox timeout\n");
        /*
         * lpfc_offline calls lpfc_sli_hba_down which will clean up
         * on oustanding mailbox commands.
@@ -2502,8 +2514,7 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
                if(!pmbox->vport) {
                        lpfc_printf_log(phba, KERN_ERR,
                                        LOG_MBOX | LOG_VPORT,
-                                       "%d:1806 Mbox x%x failed. No vport\n",
-                                       phba->brd_no,
+                                       "1806 Mbox x%x failed. No vport\n",
                                        pmbox->mb.mbxCommand);
                        dump_stack();
                        return MBXERR_ERROR;
@@ -2580,9 +2591,8 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
 
                /* Mbox cmd issue - BUSY */
                lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
-                               "%d (%d):0308 Mbox cmd issue - BUSY Data: "
+                               "(%d):0308 Mbox cmd issue - BUSY Data: "
                                "x%x x%x x%x x%x\n",
-                               phba->brd_no,
                                pmbox->vport ? pmbox->vport->vpi : 0xffffff,
                                mb->mbxCommand, phba->pport->port_state,
                                psli->sli_flag, flag);
@@ -2644,9 +2654,9 @@ lpfc_sli_issue_mbox(struct lpfc_hba *phba, LPFC_MBOXQ_t *pmbox, uint32_t flag)
 
        /* Mailbox cmd <cmd> issue */
        lpfc_printf_log(phba, KERN_INFO, LOG_MBOX | LOG_SLI,
-                       "%d (%d):0309 Mailbox cmd x%x issue Data: x%x x%x "
+                       "(%d):0309 Mailbox cmd x%x issue Data: x%x x%x "
                        "x%x\n",
-                       phba->brd_no, pmbox->vport ? pmbox->vport->vpi : 0,
+                       pmbox->vport ? pmbox->vport->vpi : 0,
                        mb->mbxCommand, phba->pport->port_state,
                        psli->sli_flag, flag);
 
@@ -2848,8 +2858,7 @@ __lpfc_sli_issue_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
           (piocb->iocb.ulpCommand != CMD_CLOSE_XRI_CN)) {
                lpfc_printf_log(phba, KERN_ERR,
                                LOG_SLI | LOG_VPORT,
-                               "%d:1807 IOCB x%x failed. No vport\n",
-                               phba->brd_no,
+                               "1807 IOCB x%x failed. No vport\n",
                                piocb->iocb.ulpCommand);
                dump_stack();
                return IOCB_ERROR;
@@ -3080,11 +3089,10 @@ lpfc_sli_setup(struct lpfc_hba *phba)
        }
        if (totiocbsize > MAX_SLIM_IOCB_SIZE) {
                /* Too many cmd / rsp ring entries in SLI2 SLIM */
-               lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                               "%d:0462 Too many cmd / rsp ring entries in "
-                               "SLI2 SLIM Data: x%x x%lx\n",
-                               phba->brd_no, totiocbsize,
-                               (unsigned long) MAX_SLIM_IOCB_SIZE);
+               printk(KERN_ERR "%d:0462 Too many cmd / rsp ring entries in "
+                      "SLI2 SLIM Data: x%x x%lx\n",
+                      phba->brd_no, totiocbsize,
+                      (unsigned long) MAX_SLIM_IOCB_SIZE);
        }
        if (phba->cfg_multi_ring_support == 2)
                lpfc_extra_ring_setup(phba);
@@ -3305,9 +3313,9 @@ lpfc_sli_ringpostbuf_get(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
 
        spin_unlock_irq(&phba->hbalock);
        lpfc_printf_log(phba, KERN_ERR, LOG_INIT,
-                       "%d:0410 Cannot find virtual addr for mapped buf on "
+                       "0410 Cannot find virtual addr for mapped buf on "
                        "ring %d Data x%llx x%p x%p x%x\n",
-                       phba->brd_no, pring->ringno, (unsigned long long)phys,
+                       pring->ringno, (unsigned long long)phys,
                        slp->next, slp->prev, pring->postbufq_cnt);
        return NULL;
 }
@@ -3332,12 +3340,11 @@ lpfc_sli_abort_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
                        abort_iocb = phba->sli.iocbq_lookup[abort_iotag];
 
                lpfc_printf_log(phba, KERN_INFO, LOG_ELS | LOG_SLI,
-                               "%d:0327 Cannot abort els iocb %p "
+                               "0327 Cannot abort els iocb %p "
                                "with tag %x context %x, abort status %x, "
                                "abort code %x\n",
-                               phba->brd_no, abort_iocb, abort_iotag,
-                               abort_context, irsp->ulpStatus,
-                               irsp->un.ulpWord[4]);
+                               abort_iocb, abort_iotag, abort_context,
+                               irsp->ulpStatus, irsp->un.ulpWord[4]);
 
                /*
                 * make sure we have the right iocbq before taking it
@@ -3371,9 +3378,9 @@ lpfc_ignore_els_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 
        /* ELS cmd tag <ulpIoTag> completes */
        lpfc_printf_log(phba, KERN_INFO, LOG_ELS,
-                       "%d (X):0133 Ignoring ELS cmd tag x%x completion Data: "
+                       "0133 Ignoring ELS cmd tag x%x completion Data: "
                        "x%x x%x x%x\n",
-                       phba->brd_no, irsp->ulpIoTag, irsp->ulpStatus,
+                       irsp->ulpIoTag, irsp->ulpStatus,
                        irsp->un.ulpWord[4], irsp->ulpTimeout);
        if (cmdiocb->iocb.ulpCommand == CMD_GEN_REQUEST64_CR)
                lpfc_ct_free_iocb(phba, cmdiocb);
@@ -3439,12 +3446,11 @@ lpfc_sli_issue_abort_iotag(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
 
        abtsiocbp->iocb_cmpl = lpfc_sli_abort_els_cmpl;
 
-       lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                       "%d (%d):0339 Abort xri x%x, original iotag x%x, "
-                       "abort cmd iotag x%x\n",
-                       phba->brd_no, vport->vpi,
-                       iabt->un.acxri.abortContextTag,
-                       iabt->un.acxri.abortIoTag, abtsiocbp->iotag);
+       lpfc_printf_vlog(vport, KERN_INFO, LOG_SLI,
+                        "0339 Abort xri x%x, original iotag x%x, "
+                        "abort cmd iotag x%x\n",
+                        iabt->un.acxri.abortContextTag,
+                        iabt->un.acxri.abortIoTag, abtsiocbp->iotag);
        retval = __lpfc_sli_issue_iocb(phba, pring, abtsiocbp, 0);
 
 abort_iotag_exit:
@@ -3457,8 +3463,8 @@ abort_iotag_exit:
 }
 
 static int
-lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id,
-                          uint64_t lun_id, uint32_t ctx,
+lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, struct lpfc_vport *vport,
+                          uint16_t tgt_id, uint64_t lun_id,
                           lpfc_ctx_cmd ctx_cmd)
 {
        struct lpfc_scsi_buf *lpfc_cmd;
@@ -3468,6 +3474,9 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id,
        if (!(iocbq->iocb_flag &  LPFC_IO_FCP))
                return rc;
 
+       if (iocbq->vport != vport)
+               return rc;
+
        lpfc_cmd = container_of(iocbq, struct lpfc_scsi_buf, cur_iocbq);
        cmnd = lpfc_cmd->pCmd;
 
@@ -3484,10 +3493,6 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id,
                if (cmnd->device->id == tgt_id)
                        rc = 0;
                break;
-       case LPFC_CTX_CTX:
-               if (iocbq->iocb.ulpContext == ctx)
-                       rc = 0;
-               break;
        case LPFC_CTX_HOST:
                rc = 0;
                break;
@@ -3501,17 +3506,18 @@ lpfc_sli_validate_fcp_iocb(struct lpfc_iocbq *iocbq, uint16_t tgt_id,
 }
 
 int
-lpfc_sli_sum_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
-                 uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd ctx_cmd)
+lpfc_sli_sum_iocb(struct lpfc_vport *vport, uint16_t tgt_id, uint64_t lun_id,
+                 lpfc_ctx_cmd ctx_cmd)
 {
+       struct lpfc_hba *phba = vport->phba;
        struct lpfc_iocbq *iocbq;
        int sum, i;
 
        for (i = 1, sum = 0; i <= phba->sli.last_iotag; i++) {
                iocbq = phba->sli.iocbq_lookup[i];
 
-               if (lpfc_sli_validate_fcp_iocb (iocbq, tgt_id, lun_id,
-                                               0, ctx_cmd) == 0)
+               if (lpfc_sli_validate_fcp_iocb (iocbq, vport, tgt_id, lun_id,
+                                               ctx_cmd) == 0)
                        sum++;
        }
 
@@ -3527,10 +3533,10 @@ lpfc_sli_abort_fcp_cmpl(struct lpfc_hba *phba, struct lpfc_iocbq *cmdiocb,
 }
 
 int
-lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
-                   uint16_t tgt_id, uint64_t lun_id, uint32_t ctx,
-                   lpfc_ctx_cmd abort_cmd)
+lpfc_sli_abort_iocb(struct lpfc_vport *vport, struct lpfc_sli_ring *pring,
+                   uint16_t tgt_id, uint64_t lun_id, lpfc_ctx_cmd abort_cmd)
 {
+       struct lpfc_hba *phba = vport->phba;
        struct lpfc_iocbq *iocbq;
        struct lpfc_iocbq *abtsiocb;
        IOCB_t *cmd = NULL;
@@ -3540,7 +3546,7 @@ lpfc_sli_abort_iocb(struct lpfc_hba *phba, struct lpfc_sli_ring *pring,
        for (i = 1; i <= phba->sli.last_iotag; i++) {
                iocbq = phba->sli.iocbq_lookup[i];
 
-               if (lpfc_sli_validate_fcp_iocb(iocbq, tgt_id, lun_id, 0,
+               if (lpfc_sli_validate_fcp_iocb(iocbq, vport, tgt_id, lun_id,
                                               abort_cmd) != 0)
                        continue;
 
@@ -3647,25 +3653,23 @@ lpfc_sli_issue_iocb_wait(struct lpfc_hba *phba,
 
                if (piocb->iocb_flag & LPFC_IO_WAKE) {
                        lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                                       "%d:0331 IOCB wake signaled\n",
-                                       phba->brd_no);
+                                       "0331 IOCB wake signaled\n");
                } else if (timeleft == 0) {
                        lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                                       "%d:0338 IOCB wait timeout error - no "
-                                       "wake response Data x%x\n",
-                                       phba->brd_no, timeout);
+                                       "0338 IOCB wait timeout error - no "
+                                       "wake response Data x%x\n", timeout);
                        retval = IOCB_TIMEDOUT;
                } else {
                        lpfc_printf_log(phba, KERN_ERR, LOG_SLI,
-                                       "%d:0330 IOCB wake NOT set, "
-                                       "Data x%x x%lx\n", phba->brd_no,
+                                       "0330 IOCB wake NOT set, "
+                                       "Data x%x x%lx\n",
                                        timeout, (timeleft / jiffies));
                        retval = IOCB_TIMEDOUT;
                }
        } else {
                lpfc_printf_log(phba, KERN_INFO, LOG_SLI,
-                               "%d:0332 IOCB wait issue failed, Data x%x\n",
-                               phba->brd_no, retval);
+                               ":0332 IOCB wait issue failed, Data x%x\n",
+                               retval);
                retval = IOCB_ERROR;
        }
 
@@ -3850,12 +3854,33 @@ lpfc_intr_handler(int irq, void *dev_id)
                        if (status & HA_RXMASK) {
                                spin_lock(&phba->hbalock);
                                control = readl(phba->HCregaddr);
+
+                               lpfc_debugfs_slow_ring_trc(phba,
+                               "ISR slow ring:   ctl:x%x stat:x%x isrcnt:x%x",
+                               control, status,
+                               (uint32_t)phba->sli.slistat.sli_intr);
+
                                if (control & (HC_R0INT_ENA << LPFC_ELS_RING)) {
+                                       lpfc_debugfs_slow_ring_trc(phba,
+                                               "ISR Disable ring:"
+                                               "pwork:x%x hawork:x%x wait:x%x",
+                                               phba->work_ha, work_ha_copy,
+                                               (uint32_t)((unsigned long)
+                                               phba->work_wait));
+
                                        control &=
                                            ~(HC_R0INT_ENA << LPFC_ELS_RING);
                                        writel(control, phba->HCregaddr);
                                        readl(phba->HCregaddr); /* flush */
                                }
+                               else {
+                                       lpfc_debugfs_slow_ring_trc(phba,
+                                               "ISR slow ring:   pwork:"
+                                               "x%x hawork:x%x wait:x%x",
+                                               phba->work_ha, work_ha_copy,
+                                               (uint32_t)((unsigned long)
+                                               phba->work_wait));
+                               }
                                spin_unlock(&phba->hbalock);
                        }
                }
@@ -3895,12 +3920,10 @@ lpfc_intr_handler(int irq, void *dev_id)
                                 */
                                lpfc_printf_log(phba, KERN_WARNING, LOG_MBOX |
                                                LOG_SLI,
-                                               "%d (%d):0304 Stray Mailbox "
+                                               "(%d):0304 Stray Mailbox "
                                                "Interrupt mbxCommand x%x "
                                                "mbxStatus x%x\n",
-                                               phba->brd_no,
-                                               (vport
-                                                ? vport->vpi : 0),
+                                               (vport ? vport->vpi : 0),
                                                pmbox->mbxCommand,
                                                pmbox->mbxStatus);
                        }
index 76058505795ef55f87fb421b66385f726969d164..51b2b6b949be498fa710b2cecee55a3be5b9b3f6 100644 (file)
@@ -26,7 +26,6 @@ struct lpfc_vport;
 typedef enum _lpfc_ctx_cmd {
        LPFC_CTX_LUN,
        LPFC_CTX_TGT,
-       LPFC_CTX_CTX,
        LPFC_CTX_HOST
 } lpfc_ctx_cmd;
 
@@ -54,9 +53,10 @@ struct lpfc_iocbq {
        void *context2;         /* caller context information */
        void *context3;         /* caller context information */
        union {
-               wait_queue_head_t  *wait_queue;
-               struct lpfc_iocbq  *rsp_iocb;
-               struct lpfcMboxq   *mbox;
+               wait_queue_head_t    *wait_queue;
+               struct lpfc_iocbq    *rsp_iocb;
+               struct lpfcMboxq     *mbox;
+               struct lpfc_nodelist *ndlp;
        } context_un;
 
        void (*fabric_iocb_cmpl) (struct lpfc_hba *, struct lpfc_iocbq *,
@@ -143,7 +143,7 @@ struct lpfc_sli_ring {
        uint16_t numCiocb;      /* number of command iocb's per ring */
        uint16_t numRiocb;      /* number of rsp iocb's per ring */
        uint16_t sizeCiocb;     /* Size of command iocb's in this ring */
-       uint16_t sizeRiocb;     /* Size of response iocb's in this ring */
+       uint16_t sizeRiocb;     /* Size of response iocb's in this ring */
 
        uint32_t fast_iotag;    /* max fastlookup based iotag           */
        uint32_t iotag_ctr;     /* keeps track of the next iotag to use */
index a5bc79eef0525c564aea2dafc65c9112181f5f53..0081f49286bc131f5f358a12886b87091e1ff24d 100644 (file)
  * included with this package.                                     *
  *******************************************************************/
 
-#define LPFC_DRIVER_VERSION "8.2.1"
+#define LPFC_DRIVER_VERSION "8.2.2"
 
 #define LPFC_DRIVER_NAME "lpfc"
 
 #define LPFC_MODULE_DESC "Emulex LightPulse Fibre Channel SCSI driver " \
                LPFC_DRIVER_VERSION
 #define LPFC_COPYRIGHT "Copyright(c) 2004-2007 Emulex.  All rights reserved."
-
-#define DFC_API_VERSION "0.0.0"
index 85797dbf54789bbf7bad9959590547fa9131afb0..dcb415e717c372230aefaf0ff384294d0edfe63d 100644 (file)
@@ -125,11 +125,10 @@ lpfc_vport_sparm(struct lpfc_hba *phba, struct lpfc_vport *vport)
        pmb->vport = vport;
        rc = lpfc_sli_issue_mbox_wait(phba, pmb, phba->fc_ratov * 2);
        if (rc != MBX_SUCCESS) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_INIT | LOG_VPORT,
-                               "%d (%d):1818 VPort failed init, mbxCmd x%x "
-                               "READ_SPARM mbxStatus x%x, rc = x%x\n",
-                               phba->brd_no, vport->vpi,
-                               mb->mbxCommand, mb->mbxStatus, rc);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_INIT | LOG_VPORT,
+                                "1818 VPort failed init, mbxCmd x%x "
+                                "READ_SPARM mbxStatus x%x, rc = x%x\n",
+                                mb->mbxCommand, mb->mbxStatus, rc);
                lpfc_mbuf_free(phba, mp->virt, mp->phys);
                kfree(mp);
                if (rc != MBX_TIMEOUT)
@@ -162,9 +161,9 @@ lpfc_valid_wwn_format(struct lpfc_hba *phba, struct lpfc_name *wwn,
                return 1;
 
        lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                       "%d:1822 Invalid %s: %02x:%02x:%02x:%02x:"
+                       "1822 Invalid %s: %02x:%02x:%02x:%02x:"
                        "%02x:%02x:%02x:%02x\n",
-                       phba->brd_no, name_type,
+                       name_type,
                        wwn->u.wwn[0], wwn->u.wwn[1],
                        wwn->u.wwn[2], wwn->u.wwn[3],
                        wwn->u.wwn[4], wwn->u.wwn[5],
@@ -176,16 +175,21 @@ static int
 lpfc_unique_wwpn(struct lpfc_hba *phba, struct lpfc_vport *new_vport)
 {
        struct lpfc_vport *vport;
+       unsigned long flags;
 
+       spin_lock_irqsave(&phba->hbalock, flags);
        list_for_each_entry(vport, &phba->port_list, listentry) {
                if (vport == new_vport)
                        continue;
                /* If they match, return not unique */
                if (memcmp(&vport->fc_sparam.portName,
-                       &new_vport->fc_sparam.portName,
-                       sizeof(struct lpfc_name)) == 0)
+                          &new_vport->fc_sparam.portName,
+                          sizeof(struct lpfc_name)) == 0) {
+                       spin_unlock_irqrestore(&phba->hbalock, flags);
                        return 0;
+               }
        }
+       spin_unlock_irqrestore(&phba->hbalock, flags);
        return 1;
 }
 
@@ -193,8 +197,8 @@ int
 lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
 {
        struct lpfc_nodelist *ndlp;
-       struct lpfc_vport *pport =
-               (struct lpfc_vport *) fc_vport->shost->hostdata;
+       struct Scsi_Host *shost = fc_vport->shost;
+       struct lpfc_vport *pport = (struct lpfc_vport *) shost->hostdata;
        struct lpfc_hba   *phba = pport->phba;
        struct lpfc_vport *vport = NULL;
        int instance;
@@ -204,9 +208,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        if ((phba->sli_rev < 3) ||
                !(phba->sli3_options & LPFC_SLI3_NPIV_ENABLED)) {
                lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1808 Create VPORT failed: "
+                               "1808 Create VPORT failed: "
                                "NPIV is not enabled: SLImode:%d\n",
-                               phba->brd_no, phba->sli_rev);
+                               phba->sli_rev);
                rc = VPORT_INVAL;
                goto error_out;
        }
@@ -214,9 +218,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        vpi = lpfc_alloc_vpi(phba);
        if (vpi == 0) {
                lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1809 Create VPORT failed: "
+                               "1809 Create VPORT failed: "
                                "Max VPORTs (%d) exceeded\n",
-                               phba->brd_no, phba->max_vpi);
+                               phba->max_vpi);
                rc = VPORT_NORESOURCES;
                goto error_out;
        }
@@ -225,18 +229,17 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        /* Assign an unused board number */
        if ((instance = lpfc_get_instance()) < 0) {
                lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1810 Create VPORT failed: Cannot get "
-                               "instance number\n", phba->brd_no);
+                               "1810 Create VPORT failed: Cannot get "
+                               "instance number\n");
                lpfc_free_vpi(phba, vpi);
                rc = VPORT_NORESOURCES;
                goto error_out;
        }
 
-       vport = lpfc_create_port(phba, instance, fc_vport);
+       vport = lpfc_create_port(phba, instance, &fc_vport->dev);
        if (!vport) {
                lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1811 Create VPORT failed: vpi x%x\n",
-                               phba->brd_no, vpi);
+                               "1811 Create VPORT failed: vpi x%x\n", vpi);
                lpfc_free_vpi(phba, vpi);
                rc = VPORT_NORESOURCES;
                goto error_out;
@@ -246,10 +249,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        lpfc_debugfs_initialize(vport);
 
        if (lpfc_vport_sparm(phba, vport)) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1813 Create VPORT failed: vpi:%d "
-                               "Cannot get sparam\n",
-                               phba->brd_no, vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                                "1813 Create VPORT failed. "
+                                "Cannot get sparam\n");
                lpfc_free_vpi(phba, vpi);
                destroy_port(vport);
                rc = VPORT_NORESOURCES;
@@ -269,10 +271,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
 
        if (!lpfc_valid_wwn_format(phba, &vport->fc_sparam.nodeName, "WWNN") ||
            !lpfc_valid_wwn_format(phba, &vport->fc_sparam.portName, "WWPN")) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1821 Create VPORT failed: vpi:%d "
-                               "Invalid WWN format\n",
-                               phba->brd_no, vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                                "1821 Create VPORT failed. "
+                                "Invalid WWN format\n");
                lpfc_free_vpi(phba, vpi);
                destroy_port(vport);
                rc = VPORT_INVAL;
@@ -280,10 +281,9 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        }
 
        if (!lpfc_unique_wwpn(phba, vport)) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1823 Create VPORT failed: vpi:%d "
-                               "Duplicate WWN on HBA\n",
-                               phba->brd_no, vpi);
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                                "1823 Create VPORT failed. "
+                                "Duplicate WWN on HBA\n");
                lpfc_free_vpi(phba, vpi);
                destroy_port(vport);
                rc = VPORT_INVAL;
@@ -315,10 +315,8 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
                        lpfc_initial_fdisc(vport);
                } else {
                        lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
-                       lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                                       "%d (%d):0262 No NPIV Fabric "
-                                       "support\n",
-                                       phba->brd_no, vport->vpi);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                        "0262 No NPIV Fabric support\n");
                }
        } else {
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
@@ -326,12 +324,14 @@ lpfc_vport_create(struct fc_vport *fc_vport, bool disable)
        rc = VPORT_OK;
 
 out:
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                       "1825 Vport Created.\n");
        lpfc_host_attrib_init(lpfc_shost_from_vport(vport));
 error_out:
        return rc;
 }
 
-int
+static int
 disable_vport(struct fc_vport *fc_vport)
 {
        struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
@@ -371,10 +371,12 @@ disable_vport(struct fc_vport *fc_vport)
        lpfc_mbx_unreg_vpi(vport);
 
        lpfc_vport_set_state(vport, FC_VPORT_DISABLED);
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                        "1826 Vport Disabled.\n");
        return VPORT_OK;
 }
 
-int
+static int
 enable_vport(struct fc_vport *fc_vport)
 {
        struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
@@ -400,15 +402,14 @@ enable_vport(struct fc_vport *fc_vport)
                        lpfc_initial_fdisc(vport);
                } else {
                        lpfc_vport_set_state(vport, FC_VPORT_NO_FABRIC_SUPP);
-                       lpfc_printf_log(phba, KERN_ERR, LOG_ELS,
-                                       "%d (%d):0264 No NPIV Fabric "
-                                       "support\n",
-                                       phba->brd_no, vport->vpi);
+                       lpfc_printf_vlog(vport, KERN_ERR, LOG_ELS,
+                                        "0264 No NPIV Fabric support\n");
                }
        } else {
                lpfc_vport_set_state(vport, FC_VPORT_FAILED);
        }
-
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                        "1827 Vport Enabled.\n");
        return VPORT_OK;
 }
 
@@ -431,8 +432,29 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
        struct lpfc_vport *vport = *(struct lpfc_vport **)fc_vport->dd_data;
        struct lpfc_hba   *phba = vport->phba;
        long timeout;
-       int rc = VPORT_ERROR;
 
+       if (vport->port_type == LPFC_PHYSICAL_PORT) {
+               lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                                "1812 vport_delete failed: Cannot delete "
+                                "physical host\n");
+               return VPORT_ERROR;
+       }
+       /*
+        * If we are not unloading the driver then prevent the vport_delete
+        * from happening until after this vport's discovery is finished.
+        */
+       if (!(phba->pport->load_flag & FC_UNLOADING)) {
+               int check_count = 0;
+               while (check_count < ((phba->fc_ratov * 3) + 3) &&
+                      vport->port_state > LPFC_VPORT_FAILED &&
+                      vport->port_state < LPFC_VPORT_READY) {
+                       check_count++;
+                       msleep(1000);
+               }
+               if (vport->port_state > LPFC_VPORT_FAILED &&
+                   vport->port_state < LPFC_VPORT_READY)
+                       return -EAGAIN;
+       }
        /*
         * This is a bit of a mess.  We want to ensure the shost doesn't get
         * torn down until we're done with the embedded lpfc_vport structure.
@@ -450,16 +472,9 @@ lpfc_vport_delete(struct fc_vport *fc_vport)
         */
        if (!scsi_host_get(shost) || !scsi_host_get(shost))
                return VPORT_INVAL;
-
-       if (vport->port_type == LPFC_PHYSICAL_PORT) {
-               lpfc_printf_log(phba, KERN_ERR, LOG_VPORT,
-                               "%d:1812 vport_delete failed: Cannot delete "
-                               "physical host\n", phba->brd_no);
-               goto out;
-       }
-
+       spin_lock_irq(&phba->hbalock);
        vport->load_flag |= FC_UNLOADING;
-
+       spin_unlock_irq(&phba->hbalock);
        kfree(vport->vname);
        lpfc_debugfs_terminate(vport);
        fc_remove_host(lpfc_shost_from_vport(vport));
@@ -511,13 +526,46 @@ skip_logo:
        spin_lock_irq(&phba->hbalock);
        list_del_init(&vport->listentry);
        spin_unlock_irq(&phba->hbalock);
-
-       rc = VPORT_OK;
-out:
+       lpfc_printf_vlog(vport, KERN_ERR, LOG_VPORT,
+                        "1828 Vport Deleted.\n");
        scsi_host_put(shost);
-       return rc;
+       return VPORT_OK;
 }
 
-
 EXPORT_SYMBOL(lpfc_vport_create);
 EXPORT_SYMBOL(lpfc_vport_delete);
+
+struct lpfc_vport **
+lpfc_create_vport_work_array(struct lpfc_hba *phba)
+{
+       struct lpfc_vport *port_iterator;
+       struct lpfc_vport **vports;
+       int index = 0;
+       vports = kzalloc(LPFC_MAX_VPORTS * sizeof(struct lpfc_vport *),
+                        GFP_KERNEL);
+       if (vports == NULL)
+               return NULL;
+       spin_lock_irq(&phba->hbalock);
+       list_for_each_entry(port_iterator, &phba->port_list, listentry) {
+               if (!scsi_host_get(lpfc_shost_from_vport(port_iterator))) {
+                       lpfc_printf_vlog(port_iterator, KERN_WARNING, LOG_VPORT,
+                                        "1801 Create vport work array FAILED: "
+                                        "cannot do scsi_host_get\n");
+                       continue;
+               }
+               vports[index++] = port_iterator;
+       }
+       spin_unlock_irq(&phba->hbalock);
+       return vports;
+}
+
+void
+lpfc_destroy_vport_work_array(struct lpfc_vport **vports)
+{
+       int i;
+       if (vports == NULL)
+               return;
+       for (i=0; vports[i] != NULL && i < LPFC_MAX_VPORTS; i++)
+               scsi_host_put(lpfc_shost_from_vport(vports[i]));
+       kfree(vports);
+}
index f223550f8cba48d618da7ec1516bc749c61a2b7b..91da17751a37273419ce5e95f09eef98daa07126 100644 (file)
@@ -88,6 +88,8 @@ int lpfc_vport_create(struct fc_vport *, bool);
 int lpfc_vport_delete(struct fc_vport *);
 int lpfc_vport_getinfo(struct Scsi_Host *, struct vport_info *);
 int lpfc_vport_tgt_remove(struct Scsi_Host *, uint, uint);
+struct lpfc_vport **lpfc_create_vport_work_array(struct lpfc_hba *);
+void lpfc_destroy_vport_work_array(struct lpfc_vport **);
 
 /*
  *  queuecommand  VPORT-specific return codes. Specified in  the host byte code.
index 1612f9200a524f575b01f017f870668752594c8a..0f2a9f5d801c77efb918dd140c3941051e7f41c4 100644 (file)
@@ -91,18 +91,20 @@ qla2x00_sysfs_read_nvram(struct kobject *kobj,
 {
        struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
            struct device, kobj)));
-       unsigned long   flags;
+       int             size = ha->nvram_size;
+       char            *nvram_cache = ha->nvram;
 
-       if (!capable(CAP_SYS_ADMIN) || off != 0)
+       if (!capable(CAP_SYS_ADMIN) || off > size || count == 0)
                return 0;
+       if (off + count > size) {
+               size -= off;
+               count = size;
+       }
 
-       /* Read NVRAM. */
-       spin_lock_irqsave(&ha->hardware_lock, flags);
-       ha->isp_ops->read_nvram(ha, (uint8_t *)buf, ha->nvram_base,
-           ha->nvram_size);
-       spin_unlock_irqrestore(&ha->hardware_lock, flags);
+       /* Read NVRAM data from cache. */
+       memcpy(buf, &nvram_cache[off], count);
 
-       return ha->nvram_size;
+       return count;
 }
 
 static ssize_t
@@ -144,6 +146,8 @@ qla2x00_sysfs_write_nvram(struct kobject *kobj,
        /* Write NVRAM. */
        spin_lock_irqsave(&ha->hardware_lock, flags);
        ha->isp_ops->write_nvram(ha, (uint8_t *)buf, ha->nvram_base, count);
+       ha->isp_ops->read_nvram(ha, (uint8_t *)&ha->nvram, ha->nvram_base,
+           count);
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        set_bit(ISP_ABORT_NEEDED, &ha->dpc_flags);
@@ -298,18 +302,20 @@ qla2x00_sysfs_read_vpd(struct kobject *kobj,
 {
        struct scsi_qla_host *ha = to_qla_host(dev_to_shost(container_of(kobj,
            struct device, kobj)));
-       unsigned long flags;
+       int           size = ha->vpd_size;
+       char          *vpd_cache = ha->vpd;
 
-       if (!capable(CAP_SYS_ADMIN) || off != 0)
+       if (!capable(CAP_SYS_ADMIN) || off > size || count == 0)
                return 0;
+       if (off + count > size) {
+               size -= off;
+               count = size;
+       }
 
-       /* Read NVRAM. */
-       spin_lock_irqsave(&ha->hardware_lock, flags);
-       ha->isp_ops->read_nvram(ha, (uint8_t *)buf, ha->vpd_base,
-           ha->vpd_size);
-       spin_unlock_irqrestore(&ha->hardware_lock, flags);
+       /* Read NVRAM data from cache. */
+       memcpy(buf, &vpd_cache[off], count);
 
-       return ha->vpd_size;
+       return count;
 }
 
 static ssize_t
@@ -327,6 +333,7 @@ qla2x00_sysfs_write_vpd(struct kobject *kobj,
        /* Write NVRAM. */
        spin_lock_irqsave(&ha->hardware_lock, flags);
        ha->isp_ops->write_nvram(ha, (uint8_t *)buf, ha->vpd_base, count);
+       ha->isp_ops->read_nvram(ha, (uint8_t *)ha->vpd, ha->vpd_base, count);
        spin_unlock_irqrestore(&ha->hardware_lock, flags);
 
        return count;
index 0c9f36c8a24870dadd6c20f8e61bf099686a0562..27ae3a532a55f0cc1d8abec4c8c9498c3deec699 100644 (file)
@@ -2340,10 +2340,14 @@ typedef struct scsi_qla_host {
        uint8_t         serial2;
 
        /* NVRAM configuration data */
+#define MAX_NVRAM_SIZE 4096
+#define VPD_OFFSET     MAX_NVRAM_SIZE / 2
        uint16_t        nvram_size;
        uint16_t        nvram_base;
+       void            *nvram;
        uint16_t        vpd_size;
        uint16_t        vpd_base;
+       void            *vpd;
 
        uint16_t        loop_reset_delay;
        uint8_t         retry_count;
index 5ec798c2bf13d4f0404d10d3b4409db9ec3a07e6..374abe19b5474f3ff18115604c76d230522f6e46 100644 (file)
@@ -1461,8 +1461,8 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
        uint16_t        cnt;
        uint8_t         *dptr1, *dptr2;
        init_cb_t       *icb = ha->init_cb;
-       nvram_t         *nv = (nvram_t *)ha->request_ring;
-       uint8_t         *ptr = (uint8_t *)ha->request_ring;
+       nvram_t         *nv = ha->nvram;
+       uint8_t         *ptr = ha->nvram;
        struct device_reg_2xxx __iomem *reg = &ha->iobase->isp;
 
        rval = QLA_SUCCESS;
@@ -1480,8 +1480,7 @@ qla2x00_nvram_config(scsi_qla_host_t *ha)
                chksum += *ptr++;
 
        DEBUG5(printk("scsi(%ld): Contents of NVRAM\n", ha->host_no));
-       DEBUG5(qla2x00_dump_buffer((uint8_t *)ha->request_ring,
-           ha->nvram_size));
+       DEBUG5(qla2x00_dump_buffer((uint8_t *)nv, ha->nvram_size));
 
        /* Bad NVRAM data, set defaults parameters. */
        if (chksum || nv->id[0] != 'I' || nv->id[1] != 'S' ||
@@ -3500,7 +3499,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
 
        rval = QLA_SUCCESS;
        icb = (struct init_cb_24xx *)ha->init_cb;
-       nv = (struct nvram_24xx *)ha->request_ring;
+       nv = ha->nvram;
 
        /* Determine NVRAM starting address. */
        ha->nvram_size = sizeof(struct nvram_24xx);
@@ -3512,7 +3511,12 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
                ha->vpd_base = FA_NVRAM_VPD1_ADDR;
        }
 
-       /* Get NVRAM data and calculate checksum. */
+       /* Get VPD data into cache */
+       ha->vpd = ha->nvram + VPD_OFFSET;
+       ha->isp_ops->read_nvram(ha, (uint8_t *)ha->vpd,
+           ha->nvram_base - FA_NVRAM_FUNC0_ADDR, FA_NVRAM_VPD_SIZE * 4);
+
+       /* Get NVRAM data into cache and calculate checksum. */
        dptr = (uint32_t *)nv;
        ha->isp_ops->read_nvram(ha, (uint8_t *)dptr, ha->nvram_base,
            ha->nvram_size);
@@ -3520,8 +3524,7 @@ qla24xx_nvram_config(scsi_qla_host_t *ha)
                chksum += le32_to_cpu(*dptr++);
 
        DEBUG5(printk("scsi(%ld): Contents of NVRAM\n", ha->host_no));
-       DEBUG5(qla2x00_dump_buffer((uint8_t *)ha->request_ring,
-           ha->nvram_size));
+       DEBUG5(qla2x00_dump_buffer((uint8_t *)nv, ha->nvram_size));
 
        /* Bad NVRAM data, set defaults parameters. */
        if (chksum || nv->id[0] != 'I' || nv->id[1] != 'S' || nv->id[2] != 'P'
index b8f226ae26334290eb9698bd3524eae2eba683a4..50539da467bf0dcebcd49d0bd0711e2d8e0205b5 100644 (file)
@@ -1068,7 +1068,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
                         * values.
                         */
                        if (resid &&
-                           ((unsigned)(cp->request_bufflen - resid) <
+                           ((unsigned)(scsi_bufflen(cp) - resid) <
                             cp->underflow)) {
                                DEBUG2(qla_printk(KERN_INFO, ha,
                                    "scsi(%ld:%d:%d:%d): Mid-layer underflow "
@@ -1076,7 +1076,7 @@ qla2x00_status_entry(scsi_qla_host_t *ha, void *pkt)
                                    "error status.\n", ha->host_no,
                                    cp->device->channel, cp->device->id,
                                    cp->device->lun, resid,
-                                   cp->request_bufflen));
+                                   scsi_bufflen(cp)));
 
                                cp->result = DID_ERROR << 16 | lscsi_status;
                        }
index c488996cb95873503ef544ba9b4328ee7ae60a17..93c0c7e4f08f0c2a98e20e5121b5b2eb422d722f 100644 (file)
@@ -2154,6 +2154,19 @@ qla2x00_mem_alloc(scsi_qla_host_t *ha)
                        }
                }
 
+               /* Get memory for cached NVRAM */
+               ha->nvram = kzalloc(MAX_NVRAM_SIZE, GFP_KERNEL);
+               if (ha->nvram == NULL) {
+                       /* error */
+                       qla_printk(KERN_WARNING, ha,
+                           "Memory Allocation failed - nvram cache\n");
+
+                       qla2x00_mem_free(ha);
+                       msleep(100);
+
+                       continue;
+               }
+
                /* Done all allocations without any error. */
                status = 0;
 
@@ -2266,6 +2279,7 @@ qla2x00_mem_free(scsi_qla_host_t *ha)
        ha->fw_dump_reading = 0;
 
        vfree(ha->optrom_buffer);
+       kfree(ha->nvram);
 }
 
 /*
index c4195ea869e9a4b54e08588737dd83d3be20bbc1..594887205b0fe7876a3fea97493a89f9402d9fb9 100644 (file)
@@ -193,7 +193,8 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
                cpu_relax();
        }
        if (!loop_count)
-               printk(KERN_EMERG "qlogicpti: mbox_command loop timeout #1\n");
+               printk(KERN_EMERG "qlogicpti%d: mbox_command loop timeout #1\n",
+                      qpti->qpti_id);
 
        /* Write mailbox command registers. */
        switch (mbox_param[param[0]] >> 4) {
@@ -224,8 +225,8 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
               (sbus_readw(qpti->qregs + HCCTRL) & HCCTRL_CRIRQ))
                udelay(20);
        if (!loop_count)
-               printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #2\n",
-                      param[0]);
+               printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #2\n",
+                      qpti->qpti_id, param[0]);
 
        /* Wait for SBUS semaphore to get set. */
        loop_count = DEFAULT_LOOP_COUNT;
@@ -238,16 +239,16 @@ static int qlogicpti_mbox_command(struct qlogicpti *qpti, u_short param[], int f
                        break;
        }
        if (!loop_count)
-               printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #3\n",
-                      param[0]);
+               printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #3\n",
+                      qpti->qpti_id, param[0]);
 
        /* Wait for MBOX busy condition to go away. */
        loop_count = DEFAULT_LOOP_COUNT;
        while (--loop_count && (sbus_readw(qpti->qregs + MBOX0) == 0x04))
                udelay(20);
        if (!loop_count)
-               printk(KERN_EMERG "qlogicpti: mbox_command[%04x] loop timeout #4\n",
-                      param[0]);
+               printk(KERN_EMERG "qlogicpti%d: mbox_command[%04x] loop timeout #4\n",
+                      qpti->qpti_id, param[0]);
 
        /* Read back output parameters. */
        switch (mbox_param[param[0]] & 0xf) {
@@ -342,7 +343,8 @@ static int qlogicpti_reset_hardware(struct Scsi_Host *host)
        while (--loop_count && ((sbus_readw(qpti->qregs + MBOX0) & 0xff) == 0x04))
                udelay(20);
        if (!loop_count)
-               printk(KERN_EMERG "qlogicpti: reset_hardware loop timeout\n");
+               printk(KERN_EMERG "qlogicpti%d: reset_hardware loop timeout\n",
+                      qpti->qpti_id);
 
        sbus_writew(HCCTRL_PAUSE, qpti->qregs + HCCTRL);
        set_sbus_cfg1(qpti);
@@ -721,12 +723,12 @@ static int __init qpti_register_irq(struct qlogicpti *qpti)
                        IRQF_SHARED, "Qlogic/PTI", qpti))
                goto fail;
 
-       printk("qpti%d: IRQ %d ", qpti->qpti_id, qpti->irq);
+       printk("qlogicpti%d: IRQ %d ", qpti->qpti_id, qpti->irq);
 
        return 0;
 
 fail:
-       printk("qpti%d: Cannot acquire irq line\n", qpti->qpti_id);
+       printk("qlogicpti%d: Cannot acquire irq line\n", qpti->qpti_id);
        return -1;
 }
 
@@ -1210,7 +1212,7 @@ static int qlogicpti_return_status(struct Status_Entry *sts, int id)
                host_status = DID_OK;
                break;
              default:
-               printk(KERN_EMERG "qpti%d: unknown completion status 0x%04x\n",
+               printk(KERN_EMERG "qlogicpti%d: unknown completion status 0x%04x\n",
                       id, sts->completion_status);
                host_status = DID_ERROR;
                break;
@@ -1329,8 +1331,8 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd)
        u32 cmd_cookie;
        int i;
 
-       printk(KERN_WARNING "qlogicpti : Aborting cmd for tgt[%d] lun[%d]\n",
-              (int)Cmnd->device->id, (int)Cmnd->device->lun);
+       printk(KERN_WARNING "qlogicpti%d: Aborting cmd for tgt[%d] lun[%d]\n",
+              qpti->qpti_id, (int)Cmnd->device->id, (int)Cmnd->device->lun);
 
        qlogicpti_disable_irqs(qpti);
 
@@ -1348,7 +1350,8 @@ static int qlogicpti_abort(struct scsi_cmnd *Cmnd)
        param[3] = cmd_cookie & 0xffff;
        if (qlogicpti_mbox_command(qpti, param, 0) ||
            (param[0] != MBOX_COMMAND_COMPLETE)) {
-               printk(KERN_EMERG "qlogicpti : scsi abort failure: %x\n", param[0]);
+               printk(KERN_EMERG "qlogicpti%d: scsi abort failure: %x\n",
+                      qpti->qpti_id, param[0]);
                return_status = FAILED;
        }
 
@@ -1364,7 +1367,8 @@ static int qlogicpti_reset(struct scsi_cmnd *Cmnd)
        struct qlogicpti *qpti = (struct qlogicpti *) host->hostdata;
        int return_status = SUCCESS;
 
-       printk(KERN_WARNING "qlogicpti : Resetting SCSI bus!\n");
+       printk(KERN_WARNING "qlogicpti%d: Resetting SCSI bus!\n",
+              qpti->qpti_id);
 
        qlogicpti_disable_irqs(qpti);
 
@@ -1372,7 +1376,8 @@ static int qlogicpti_reset(struct scsi_cmnd *Cmnd)
        param[1] = qpti->host_param.bus_reset_delay;
        if (qlogicpti_mbox_command(qpti, param, 0) ||
           (param[0] != MBOX_COMMAND_COMPLETE)) {
-               printk(KERN_EMERG "qlogicisp : scsi bus reset failure: %x\n", param[0]);
+               printk(KERN_EMERG "qlogicisp%d: scsi bus reset failure: %x\n",
+                      qpti->qpti_id, param[0]);
                return_status = FAILED;
        }
 
@@ -1454,22 +1459,25 @@ static int __devinit qpti_sbus_probe(struct of_device *dev, const struct of_devi
        if (qlogicpti_reset_hardware(host))
                goto fail_unmap_queues;
 
-       if (scsi_add_host(host, &dev->dev))
-               goto fail_unmap_queues;
-
        printk("(Firmware v%d.%d.%d)", qpti->fware_majrev,
               qpti->fware_minrev, qpti->fware_micrev);
 
        fcode = of_get_property(dp, "isp-fcode", NULL);
        if (fcode && fcode[0])
-               printk("(Firmware %s)", fcode);
+               printk("(FCode %s)", fcode);
        if (of_find_property(dp, "differential", NULL) != NULL)
                qpti->differential = 1;
                        
-       printk (" [%s Wide, using %s interface]\n",
+       printk("\nqlogicpti%d: [%s Wide, using %s interface]\n",
+               qpti->qpti_id,
                (qpti->ultra ? "Ultra" : "Fast"),
                (qpti->differential ? "differential" : "single ended"));
 
+       if (scsi_add_host(host, &dev->dev)) {
+               printk("qlogicpti%d: Failed scsi_add_host\n", qpti->qpti_id);
+               goto fail_unmap_queues;
+       }
+
        dev_set_drvdata(&sdev->ofdev.dev, qpti);
 
        qpti_chain_add(qpti);
index 19c44f0781fd7d478858c2295d232f6f5ebe7f4c..e2ea739e33df121dae6b91b25339efee7cdf3696 100644 (file)
@@ -154,6 +154,9 @@ static struct {
        {"EMC",  "Invista", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
        {"EMC", "SYMMETRIX", NULL, BLIST_SPARSELUN | BLIST_LARGELUN | BLIST_FORCELUN},
        {"EMULEX", "MD21/S2     ESDI", NULL, BLIST_SINGLELUN},
+       {"easyRAID", "16P", NULL, BLIST_NOREPORTLUN},
+       {"easyRAID", "X6P", NULL, BLIST_NOREPORTLUN},
+       {"easyRAID", "F8", NULL, BLIST_NOREPORTLUN},
        {"FSC", "CentricStor", "*", BLIST_SPARSELUN | BLIST_LARGELUN},
        {"Generic", "USB SD Reader", "1.00", BLIST_FORCELUN | BLIST_INQUIRY_36},
        {"Generic", "USB Storage-SMC", "0180", BLIST_FORCELUN | BLIST_INQUIRY_36},
index 21c075d44db131726e002ead6e4e707c932a2ee8..a417a6ff9f97aee1e1a044c2c736c48f62722540 100644 (file)
@@ -1038,22 +1038,6 @@ static int scsi_init_io(struct scsi_cmnd *cmd)
        return BLKPREP_KILL;
 }
 
-static int scsi_issue_flush_fn(struct request_queue *q, struct gendisk *disk,
-                              sector_t *error_sector)
-{
-       struct scsi_device *sdev = q->queuedata;
-       struct scsi_driver *drv;
-
-       if (sdev->sdev_state != SDEV_RUNNING)
-               return -ENXIO;
-
-       drv = *(struct scsi_driver **) disk->private_data;
-       if (drv->issue_flush)
-               return drv->issue_flush(&sdev->sdev_gendev, error_sector);
-
-       return -EOPNOTSUPP;
-}
-
 static struct scsi_cmnd *scsi_get_cmd_from_req(struct scsi_device *sdev,
                struct request *req)
 {
@@ -1596,7 +1580,6 @@ struct request_queue *scsi_alloc_queue(struct scsi_device *sdev)
                return NULL;
 
        blk_queue_prep_rq(q, scsi_prep_fn);
-       blk_queue_issue_flush_fn(q, scsi_issue_flush_fn);
        blk_queue_softirq_done(q, scsi_softirq_done);
        return q;
 }
index e21c7142a3ea957bee7c58cde38e58fcfea925a3..2c6116fd457818a27be8552119425030a6143e68 100644 (file)
@@ -241,7 +241,6 @@ static struct scsi_driver sd_template = {
        },
        .rescan                 = sd_rescan,
        .init_command           = sd_init_command,
-       .issue_flush            = sd_issue_flush,
 };
 
 /*
@@ -800,10 +799,17 @@ static int sd_sync_cache(struct scsi_disk *sdkp)
        return 0;
 }
 
-static int sd_issue_flush(struct device *dev, sector_t *error_sector)
+static int sd_issue_flush(struct request_queue *q, struct gendisk *disk,
+                         sector_t *error_sector)
 {
        int ret = 0;
-       struct scsi_disk *sdkp = scsi_disk_get_from_dev(dev);
+       struct scsi_device *sdp = q->queuedata;
+       struct scsi_disk *sdkp;
+
+       if (sdp->sdev_state != SDEV_RUNNING)
+               return -ENXIO;
+
+       sdkp = scsi_disk_get_from_dev(&sdp->sdev_gendev);
 
        if (!sdkp)
                return -ENODEV;
@@ -1663,6 +1669,8 @@ static int sd_probe(struct device *dev)
 
        sd_revalidate_disk(gd);
 
+       blk_queue_issue_flush_fn(sdp->request_queue, sd_issue_flush);
+
        gd->driverfs_dev = &sdp->sdev_gendev;
        gd->flags = GENHD_FL_DRIVERFS;
        if (sdp->removable)
index a4f7b8465773c00a5f56f085c119585199f3f811..73c44cbdea478411d5edad39f308fb97f942f2fb 100644 (file)
@@ -1485,7 +1485,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        struct st_buffer *STbp;
        char *name = tape_name(STp);
 
-       if (down_interruptible(&STp->lock))
+       if (mutex_lock_interruptible(&STp->lock))
                return -ERESTARTSYS;
 
        retval = rw_checks(STp, filp, count);
@@ -1736,7 +1736,7 @@ st_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        if (SRpnt != NULL)
                st_release_request(SRpnt);
        release_buffering(STp, 0);
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
 
        return retval;
 }
@@ -1942,7 +1942,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
        struct st_buffer *STbp = STp->buffer;
        DEB( char *name = tape_name(STp); )
 
-       if (down_interruptible(&STp->lock))
+       if (mutex_lock_interruptible(&STp->lock))
                return -ERESTARTSYS;
 
        retval = rw_checks(STp, filp, count);
@@ -2069,7 +2069,7 @@ st_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
                release_buffering(STp, 1);
                STbp->buffer_bytes = 0;
        }
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
 
        return retval;
 }
@@ -3226,7 +3226,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
        char *name = tape_name(STp);
        void __user *p = (void __user *)arg;
 
-       if (down_interruptible(&STp->lock))
+       if (mutex_lock_interruptible(&STp->lock))
                return -ERESTARTSYS;
 
         DEB(
@@ -3537,7 +3537,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
                        retval = (-EFAULT);
                goto out;
        }
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
        switch (cmd_in) {
                case SCSI_IOCTL_GET_IDLUN:
                case SCSI_IOCTL_GET_BUS_NUMBER:
@@ -3563,7 +3563,7 @@ static int st_ioctl(struct inode *inode, struct file *file,
        return retval;
 
  out:
-       up(&STp->lock);
+       mutex_unlock(&STp->lock);
        return retval;
 }
 
@@ -4029,7 +4029,7 @@ static int st_probe(struct device *dev)
 
        tpnt->density_changed = tpnt->compression_changed =
            tpnt->blksize_changed = 0;
-       init_MUTEX(&tpnt->lock);
+       mutex_init(&tpnt->lock);
 
        st_nr_dev++;
        write_unlock(&st_dev_arr_lock);
index 50f3deb1f9ed92fcaf06bcc8c62329e966db8750..6c8075712974af0db0da977dbba3b47b6cb35f7d 100644 (file)
@@ -3,6 +3,7 @@
 #define _ST_H
 
 #include <linux/completion.h>
+#include <linux/mutex.h>
 #include <linux/kref.h>
 #include <scsi/scsi_cmnd.h>
 
@@ -98,7 +99,7 @@ struct st_partstat {
 struct scsi_tape {
        struct scsi_driver *driver;
        struct scsi_device *device;
-       struct semaphore lock;  /* For serialization */
+       struct mutex lock;      /* For serialization */
        struct completion wait; /* For SCSI commands */
        struct st_buffer *buffer;
 
index 15a51459c81fbafb0d77d97f62542185cecb28e8..3db22325ea2cdf55a76b0dca34e59a2f579495e6 100644 (file)
@@ -2033,7 +2033,7 @@ static struct pci_device_id sym2_id_table[] __devinitdata = {
        { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C875,
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
        { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_NCR_53C1510,
-         PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL }, /* new */
+         PCI_ANY_ID, PCI_ANY_ID,  PCI_CLASS_STORAGE_SCSI<<8,  0xffff00, 0UL }, /* new */
        { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C895A,
          PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0UL },
        { PCI_VENDOR_ID_LSI_LOGIC, PCI_DEVICE_ID_LSI_53C875A,
index 2f5a5ac1b271d009ea69ac6b85608fd23406499c..301313002f6b3abc0d1fa67c1ec59d11c8c7ffab 100644 (file)
@@ -2514,7 +2514,7 @@ static int __init serial8250_console_setup(struct console *co, char *options)
        return uart_set_options(port, co, baud, parity, bits, flow);
 }
 
-static int __init serial8250_console_early_setup(void)
+static int serial8250_console_early_setup(void)
 {
        return serial8250_find_port_for_earlycon();
 }
index 150cad5c2eba1adecd0896854cfa83b7c2161639..4d4c9f01be8da7dbde5fa1951cbfbf5ab8bfb593 100644 (file)
@@ -227,7 +227,7 @@ int __init setup_early_serial8250_console(char *cmdline)
        return 0;
 }
 
-int __init serial8250_find_port_for_earlycon(void)
+int serial8250_find_port_for_earlycon(void)
 {
        struct early_serial8250_device *device = &early_device;
        struct uart_port *port = &device->port;
index 6d7d616e9ccde48400049a84f62125d1914358fd..5e485876f54c740004457ee0f4bbb5a020e9c50d 100644 (file)
@@ -976,7 +976,6 @@ enum pci_board_num_t {
        pbn_oxsemi,
        pbn_intel_i960,
        pbn_sgi_ioc3,
-       pbn_nec_nile4,
        pbn_computone_4,
        pbn_computone_6,
        pbn_computone_8,
@@ -1442,18 +1441,6 @@ static struct pciserial_board pci_boards[] __devinitdata = {
                .first_offset   = 0x20178,
        },
 
-       /*
-        * NEC Vrc-5074 (Nile 4) builtin UART.
-        */
-       [pbn_nec_nile4] = {
-               .flags          = FL_BASE0,
-               .num_ports      = 1,
-               .base_baud      = 520833,
-               .uart_offset    = 8 << 3,
-               .reg_shift      = 3,
-               .first_offset   = 0x300,
-       },
-
        /*
         * Computone - uses IOMEM.
         */
@@ -2345,13 +2332,6 @@ static struct pci_device_id serial_pci_tbl[] = {
                PCI_ANY_ID, PCI_ANY_ID, 0, 0,
                pbn_b2_1_115200 },
 
-       /*
-        * NEC Vrc-5074 (Nile 4) builtin UART.
-        */
-       {       PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_NILE4,
-               PCI_ANY_ID, PCI_ANY_ID, 0, 0,
-               pbn_nec_nile4 },
-
        {       PCI_VENDOR_ID_DCI, PCI_DEVICE_ID_DCI_PCCOM2,
                PCI_ANY_ID, PCI_ANY_ID, 0, 0,
                pbn_b3_2_115200 },
index 18f6297064482864bad07b269bf8ebe2bab0db8f..64ff6a5f6afd0d3a5fdff7be3f4e9f8079e3624d 100644 (file)
@@ -88,21 +88,17 @@ config SERIAL_8250_PCI
        depends on SERIAL_8250 && PCI
        default SERIAL_8250
        help
-         Say Y here if you have PCI serial ports.
-
-         To compile this driver as a module, choose M here: the module
-         will be called 8250_pci.
+         This builds standard PCI serial support. You may be able to
+         disable this feature if you only need legacy serial support.
+         Saves about 9K.
 
 config SERIAL_8250_PNP
        tristate "8250/16550 PNP device support" if EMBEDDED
        depends on SERIAL_8250 && PNP
        default SERIAL_8250
        help
-         Say Y here if you have serial ports described by PNPBIOS or ACPI.
-         These are typically ports built into the system board.
-
-         To compile this driver as a module, choose M here: the module
-         will be called 8250_pnp.
+         This builds standard PNP serial support. You may be able to
+         disable this feature if you only need legacy serial support.
 
 config SERIAL_8250_HP300
        tristate
@@ -1195,7 +1191,7 @@ config SERIAL_VR41XX
 
 config SERIAL_VR41XX_CONSOLE
        bool "Enable NEC VR4100 series Serial Interface Unit console"
-       depends on SERIAL_VR41XX
+       depends on SERIAL_VR41XX=y
        select SERIAL_CORE_CONSOLE
        help
          If you have a NEC VR4100 series processor and you want to use
index 00924feaf621831caa46267ad8b9b278a48a8552..4d643c9266578d86defb7e9a5b05a138dd161a5b 100644 (file)
 #include <asm/io.h>
 #include <asm/irq.h>
 
-#if defined(CONFIG_SERIAL_MPSC_CONSOLE) && defined(CONFIG_MAGIC_SYSRQ)
-#define SUPPORT_SYSRQ
-#endif
-
 #define        MPSC_NUM_CTLRS          2
 
 /*
@@ -97,9 +93,8 @@
 #define        MPSC_TXBE_SIZE          dma_get_cache_alignment()
 #define        MPSC_TXB_SIZE           (MPSC_TXR_ENTRIES * MPSC_TXBE_SIZE)
 
-#define        MPSC_DMA_ALLOC_SIZE     (MPSC_RXR_SIZE + MPSC_RXB_SIZE +        \
-                               MPSC_TXR_SIZE + MPSC_TXB_SIZE +         \
-                               dma_get_cache_alignment() /* for alignment */)
+#define        MPSC_DMA_ALLOC_SIZE     (MPSC_RXR_SIZE + MPSC_RXB_SIZE + MPSC_TXR_SIZE \
+               + MPSC_TXB_SIZE + dma_get_cache_alignment() /* for alignment */)
 
 /* Rx and Tx Ring entry descriptors -- assume entry size is <= cacheline size */
 struct mpsc_rx_desc {
@@ -270,8 +265,8 @@ struct mpsc_port_info *mpsc_device_remove(int index);
 #define        SDMA_DESC_CMDSTAT_EI            (1<<23)
 #define        SDMA_DESC_CMDSTAT_O             (1<<31)
 
-#define SDMA_DESC_DFLT                 (SDMA_DESC_CMDSTAT_O |  \
-                                       SDMA_DESC_CMDSTAT_EI)
+#define SDMA_DESC_DFLT                 (SDMA_DESC_CMDSTAT_O \
+               | SDMA_DESC_CMDSTAT_EI)
 
 #define        SDMA_SDC_RFT                    (1<<0)
 #define        SDMA_SDC_SFM                    (1<<1)
@@ -295,10 +290,10 @@ struct mpsc_port_info *mpsc_device_remove(int index);
 #define        SDMA_1_CAUSE_TXBUF              (1<<10)
 #define        SDMA_1_CAUSE_TXEND              (1<<11)
 
-#define        SDMA_CAUSE_RX_MASK      (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR \
-       SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR)
-#define        SDMA_CAUSE_TX_MASK      (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND \
-       SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND)
+#define        SDMA_CAUSE_RX_MASK      (SDMA_0_CAUSE_RXBUF | SDMA_0_CAUSE_RXERR \
+               | SDMA_1_CAUSE_RXBUF | SDMA_1_CAUSE_RXERR)
+#define        SDMA_CAUSE_TX_MASK      (SDMA_0_CAUSE_TXBUF | SDMA_0_CAUSE_TXEND \
+               | SDMA_1_CAUSE_TXBUF | SDMA_1_CAUSE_TXEND)
 
 /* SDMA Interrupt registers */
 #define        SDMA_INTR_CAUSE                 0x0000
@@ -312,11 +307,11 @@ struct mpsc_port_info *mpsc_device_remove(int index);
  * Define how this driver is known to the outside (we've been assigned a
  * range on the "Low-density serial ports" major).
  */
-#define MPSC_MAJOR             204
-#define MPSC_MINOR_START       44
-#define        MPSC_DRIVER_NAME        "MPSC"
-#define        MPSC_DEV_NAME           "ttyMM"
-#define        MPSC_VERSION            "1.00"
+#define MPSC_MAJOR                     204
+#define MPSC_MINOR_START               44
+#define        MPSC_DRIVER_NAME                "MPSC"
+#define        MPSC_DEV_NAME                   "ttyMM"
+#define        MPSC_VERSION                    "1.00"
 
 static struct mpsc_port_info mpsc_ports[MPSC_NUM_CTLRS];
 static struct mpsc_shared_regs mpsc_shared_regs;
@@ -332,8 +327,7 @@ static void mpsc_release_port(struct uart_port *port);
  *
  ******************************************************************************
  */
-static void
-mpsc_brg_init(struct mpsc_port_info *pi, u32 clk_src)
+static void mpsc_brg_init(struct mpsc_port_info *pi, u32 clk_src)
 {
        u32     v;
 
@@ -349,11 +343,9 @@ mpsc_brg_init(struct mpsc_port_info *pi, u32 clk_src)
 
        writel(readl(pi->brg_base + BRG_BTR) & 0xffff0000,
                pi->brg_base + BRG_BTR);
-       return;
 }
 
-static void
-mpsc_brg_enable(struct mpsc_port_info *pi)
+static void mpsc_brg_enable(struct mpsc_port_info *pi)
 {
        u32     v;
 
@@ -363,11 +355,9 @@ mpsc_brg_enable(struct mpsc_port_info *pi)
        if (pi->mirror_regs)
                pi->BRG_BCR_m = v;
        writel(v, pi->brg_base + BRG_BCR);
-       return;
 }
 
-static void
-mpsc_brg_disable(struct mpsc_port_info *pi)
+static void mpsc_brg_disable(struct mpsc_port_info *pi)
 {
        u32     v;
 
@@ -377,21 +367,19 @@ mpsc_brg_disable(struct mpsc_port_info *pi)
        if (pi->mirror_regs)
                pi->BRG_BCR_m = v;
        writel(v, pi->brg_base + BRG_BCR);
-       return;
 }
 
-static inline void
-mpsc_set_baudrate(struct mpsc_port_info *pi, u32 baud)
+/*
+ * To set the baud, we adjust the CDV field in the BRG_BCR reg.
+ * From manual: Baud = clk / ((CDV+1)*2) ==> CDV = (clk / (baud*2)) - 1.
+ * However, the input clock is divided by 16 in the MPSC b/c of how
+ * 'MPSC_MMCRH' was set up so we have to divide the 'clk' used in our
+ * calculation by 16 to account for that.  So the real calculation
+ * that accounts for the way the mpsc is set up is:
+ * CDV = (clk / (baud*2*16)) - 1 ==> CDV = (clk / (baud << 5)) - 1.
+ */
+static void mpsc_set_baudrate(struct mpsc_port_info *pi, u32 baud)
 {
-       /*
-        * To set the baud, we adjust the CDV field in the BRG_BCR reg.
-        * From manual: Baud = clk / ((CDV+1)*2) ==> CDV = (clk / (baud*2)) - 1.
-        * However, the input clock is divided by 16 in the MPSC b/c of how
-        * 'MPSC_MMCRH' was set up so we have to divide the 'clk' used in our
-        * calculation by 16 to account for that.  So the real calculation
-        * that accounts for the way the mpsc is set up is:
-        * CDV = (clk / (baud*2*16)) - 1 ==> CDV = (clk / (baud << 5)) - 1.
-        */
        u32     cdv = (pi->port.uartclk / (baud << 5)) - 1;
        u32     v;
 
@@ -403,8 +391,6 @@ mpsc_set_baudrate(struct mpsc_port_info *pi, u32 baud)
                pi->BRG_BCR_m = v;
        writel(v, pi->brg_base + BRG_BCR);
        mpsc_brg_enable(pi);
-
-       return;
 }
 
 /*
@@ -415,13 +401,12 @@ mpsc_set_baudrate(struct mpsc_port_info *pi, u32 baud)
  ******************************************************************************
  */
 
-static void
-mpsc_sdma_burstsize(struct mpsc_port_info *pi, u32 burst_size)
+static void mpsc_sdma_burstsize(struct mpsc_port_info *pi, u32 burst_size)
 {
        u32     v;
 
        pr_debug("mpsc_sdma_burstsize[%d]: burst_size: %d\n",
-           pi->port.line, burst_size);
+                       pi->port.line, burst_size);
 
        burst_size >>= 3; /* Divide by 8 b/c reg values are 8-byte chunks */
 
@@ -436,11 +421,9 @@ mpsc_sdma_burstsize(struct mpsc_port_info *pi, u32 burst_size)
 
        writel((readl(pi->sdma_base + SDMA_SDC) & (0x3 << 12)) | (v << 12),
                pi->sdma_base + SDMA_SDC);
-       return;
 }
 
-static void
-mpsc_sdma_init(struct mpsc_port_info *pi, u32 burst_size)
+static void mpsc_sdma_init(struct mpsc_port_info *pi, u32 burst_size)
 {
        pr_debug("mpsc_sdma_init[%d]: burst_size: %d\n", pi->port.line,
                burst_size);
@@ -448,11 +431,9 @@ mpsc_sdma_init(struct mpsc_port_info *pi, u32 burst_size)
        writel((readl(pi->sdma_base + SDMA_SDC) & 0x3ff) | 0x03f,
                pi->sdma_base + SDMA_SDC);
        mpsc_sdma_burstsize(pi, burst_size);
-       return;
 }
 
-static inline u32
-mpsc_sdma_intr_mask(struct mpsc_port_info *pi, u32 mask)
+static u32 mpsc_sdma_intr_mask(struct mpsc_port_info *pi, u32 mask)
 {
        u32     old, v;
 
@@ -475,15 +456,14 @@ mpsc_sdma_intr_mask(struct mpsc_port_info *pi, u32 mask)
        return old & 0xf;
 }
 
-static inline void
-mpsc_sdma_intr_unmask(struct mpsc_port_info *pi, u32 mask)
+static void mpsc_sdma_intr_unmask(struct mpsc_port_info *pi, u32 mask)
 {
        u32     v;
 
        pr_debug("mpsc_sdma_intr_unmask[%d]: mask: 0x%x\n", pi->port.line,mask);
 
-       v = (pi->mirror_regs) ? pi->shared_regs->SDMA_INTR_MASK_m :
-               readl(pi->shared_regs->sdma_intr_base + SDMA_INTR_MASK);
+       v = (pi->mirror_regs) ? pi->shared_regs->SDMA_INTR_MASK_m
+               readl(pi->shared_regs->sdma_intr_base + SDMA_INTR_MASK);
 
        mask &= 0xf;
        if (pi->port.line)
@@ -493,41 +473,35 @@ mpsc_sdma_intr_unmask(struct mpsc_port_info *pi, u32 mask)
        if (pi->mirror_regs)
                pi->shared_regs->SDMA_INTR_MASK_m = v;
        writel(v, pi->shared_regs->sdma_intr_base + SDMA_INTR_MASK);
-       return;
 }
 
-static inline void
-mpsc_sdma_intr_ack(struct mpsc_port_info *pi)
+static void mpsc_sdma_intr_ack(struct mpsc_port_info *pi)
 {
        pr_debug("mpsc_sdma_intr_ack[%d]: Acknowledging IRQ\n", pi->port.line);
 
        if (pi->mirror_regs)
                pi->shared_regs->SDMA_INTR_CAUSE_m = 0;
-       writeb(0x00, pi->shared_regs->sdma_intr_base + SDMA_INTR_CAUSE +
-              pi->port.line);
-       return;
+       writeb(0x00, pi->shared_regs->sdma_intr_base + SDMA_INTR_CAUSE
+                       + pi->port.line);
 }
 
-static inline void
-mpsc_sdma_set_rx_ring(struct mpsc_port_info *pi, struct mpsc_rx_desc *rxre_p)
+static void mpsc_sdma_set_rx_ring(struct mpsc_port_info *pi,
+               struct mpsc_rx_desc *rxre_p)
 {
        pr_debug("mpsc_sdma_set_rx_ring[%d]: rxre_p: 0x%x\n",
-               pi->port.line, (u32) rxre_p);
+               pi->port.line, (u32)rxre_p);
 
        writel((u32)rxre_p, pi->sdma_base + SDMA_SCRDP);
-       return;
 }
 
-static inline void
-mpsc_sdma_set_tx_ring(struct mpsc_port_info *pi, struct mpsc_tx_desc *txre_p)
+static void mpsc_sdma_set_tx_ring(struct mpsc_port_info *pi,
+               struct mpsc_tx_desc *txre_p)
 {
        writel((u32)txre_p, pi->sdma_base + SDMA_SFTDP);
        writel((u32)txre_p, pi->sdma_base + SDMA_SCTDP);
-       return;
 }
 
-static inline void
-mpsc_sdma_cmd(struct mpsc_port_info *pi, u32 val)
+static void mpsc_sdma_cmd(struct mpsc_port_info *pi, u32 val)
 {
        u32     v;
 
@@ -539,46 +513,40 @@ mpsc_sdma_cmd(struct mpsc_port_info *pi, u32 val)
        wmb();
        writel(v, pi->sdma_base + SDMA_SDCM);
        wmb();
-       return;
 }
 
-static inline uint
-mpsc_sdma_tx_active(struct mpsc_port_info *pi)
+static uint mpsc_sdma_tx_active(struct mpsc_port_info *pi)
 {
        return readl(pi->sdma_base + SDMA_SDCM) & SDMA_SDCM_TXD;
 }
 
-static inline void
-mpsc_sdma_start_tx(struct mpsc_port_info *pi)
+static void mpsc_sdma_start_tx(struct mpsc_port_info *pi)
 {
        struct mpsc_tx_desc *txre, *txre_p;
 
        /* If tx isn't running & there's a desc ready to go, start it */
        if (!mpsc_sdma_tx_active(pi)) {
-               txre = (struct mpsc_tx_desc *)(pi->txr +
-                       (pi->txr_tail * MPSC_TXRE_SIZE));
-               dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE, DMA_FROM_DEVICE);
+               txre = (struct mpsc_tx_desc *)(pi->txr
+                               + (pi->txr_tail * MPSC_TXRE_SIZE));
+               dma_cache_sync(pi->port.dev, (void *)txre, MPSC_TXRE_SIZE,
+                               DMA_FROM_DEVICE);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        invalidate_dcache_range((ulong)txre,
-                               (ulong)txre + MPSC_TXRE_SIZE);
+                                       (ulong)txre + MPSC_TXRE_SIZE);
 #endif
 
                if (be32_to_cpu(txre->cmdstat) & SDMA_DESC_CMDSTAT_O) {
-                       txre_p = (struct mpsc_tx_desc *)(pi->txr_p +
-                                                        (pi->txr_tail *
-                                                         MPSC_TXRE_SIZE));
+                       txre_p = (struct mpsc_tx_desc *)
+                               (pi->txr_p + (pi->txr_tail * MPSC_TXRE_SIZE));
 
                        mpsc_sdma_set_tx_ring(pi, txre_p);
                        mpsc_sdma_cmd(pi, SDMA_SDCM_STD | SDMA_SDCM_TXD);
                }
        }
-
-       return;
 }
 
-static inline void
-mpsc_sdma_stop(struct mpsc_port_info *pi)
+static void mpsc_sdma_stop(struct mpsc_port_info *pi)
 {
        pr_debug("mpsc_sdma_stop[%d]: Stopping SDMA\n", pi->port.line);
 
@@ -593,8 +561,6 @@ mpsc_sdma_stop(struct mpsc_port_info *pi)
        /* Disable interrupts */
        mpsc_sdma_intr_mask(pi, 0xf);
        mpsc_sdma_intr_ack(pi);
-
-       return;
 }
 
 /*
@@ -605,8 +571,7 @@ mpsc_sdma_stop(struct mpsc_port_info *pi)
  ******************************************************************************
  */
 
-static void
-mpsc_hw_init(struct mpsc_port_info *pi)
+static void mpsc_hw_init(struct mpsc_port_info *pi)
 {
        u32     v;
 
@@ -628,8 +593,7 @@ mpsc_hw_init(struct mpsc_port_info *pi)
                v = (v & ~0xf0f) | 0x100;
                pi->shared_regs->MPSC_TCRR_m = v;
                writel(v, pi->shared_regs->mpsc_routing_base + MPSC_TCRR);
-       }
-       else {
+       } else {
                v = readl(pi->shared_regs->mpsc_routing_base + MPSC_MRR);
                v &= ~0x1c7;
                writel(v, pi->shared_regs->mpsc_routing_base + MPSC_MRR);
@@ -646,7 +610,7 @@ mpsc_hw_init(struct mpsc_port_info *pi)
        /* Put MPSC in UART mode & enabel Tx/Rx egines */
        writel(0x000004c4, pi->mpsc_base + MPSC_MMCRL);
 
-       /* No preamble, 16x divider, low-latency,  */
+       /* No preamble, 16x divider, low-latency, */
        writel(0x04400400, pi->mpsc_base + MPSC_MMCRH);
 
        if (pi->mirror_regs) {
@@ -663,12 +627,9 @@ mpsc_hw_init(struct mpsc_port_info *pi)
        writel(0, pi->mpsc_base + MPSC_CHR_8);
        writel(0, pi->mpsc_base + MPSC_CHR_9);
        writel(0, pi->mpsc_base + MPSC_CHR_10);
-
-       return;
 }
 
-static inline void
-mpsc_enter_hunt(struct mpsc_port_info *pi)
+static void mpsc_enter_hunt(struct mpsc_port_info *pi)
 {
        pr_debug("mpsc_enter_hunt[%d]: Hunting...\n", pi->port.line);
 
@@ -677,20 +638,16 @@ mpsc_enter_hunt(struct mpsc_port_info *pi)
                        pi->mpsc_base + MPSC_CHR_2);
                /* Erratum prevents reading CHR_2 so just delay for a while */
                udelay(100);
-       }
-       else {
+       } else {
                writel(readl(pi->mpsc_base + MPSC_CHR_2) | MPSC_CHR_2_EH,
-                       pi->mpsc_base + MPSC_CHR_2);
+                               pi->mpsc_base + MPSC_CHR_2);
 
                while (readl(pi->mpsc_base + MPSC_CHR_2) & MPSC_CHR_2_EH)
                        udelay(10);
        }
-
-       return;
 }
 
-static inline void
-mpsc_freeze(struct mpsc_port_info *pi)
+static void mpsc_freeze(struct mpsc_port_info *pi)
 {
        u32     v;
 
@@ -703,11 +660,9 @@ mpsc_freeze(struct mpsc_port_info *pi)
        if (pi->mirror_regs)
                pi->MPSC_MPCR_m = v;
        writel(v, pi->mpsc_base + MPSC_MPCR);
-       return;
 }
 
-static inline void
-mpsc_unfreeze(struct mpsc_port_info *pi)
+static void mpsc_unfreeze(struct mpsc_port_info *pi)
 {
        u32     v;
 
@@ -720,11 +675,9 @@ mpsc_unfreeze(struct mpsc_port_info *pi)
        writel(v, pi->mpsc_base + MPSC_MPCR);
 
        pr_debug("mpsc_unfreeze[%d]: Unfrozen\n", pi->port.line);
-       return;
 }
 
-static inline void
-mpsc_set_char_length(struct mpsc_port_info *pi, u32 len)
+static void mpsc_set_char_length(struct mpsc_port_info *pi, u32 len)
 {
        u32     v;
 
@@ -737,11 +690,9 @@ mpsc_set_char_length(struct mpsc_port_info *pi, u32 len)
        if (pi->mirror_regs)
                pi->MPSC_MPCR_m = v;
        writel(v, pi->mpsc_base + MPSC_MPCR);
-       return;
 }
 
-static inline void
-mpsc_set_stop_bit_length(struct mpsc_port_info *pi, u32 len)
+static void mpsc_set_stop_bit_length(struct mpsc_port_info *pi, u32 len)
 {
        u32     v;
 
@@ -756,11 +707,9 @@ mpsc_set_stop_bit_length(struct mpsc_port_info *pi, u32 len)
        if (pi->mirror_regs)
                pi->MPSC_MPCR_m = v;
        writel(v, pi->mpsc_base + MPSC_MPCR);
-       return;
 }
 
-static inline void
-mpsc_set_parity(struct mpsc_port_info *pi, u32 p)
+static void mpsc_set_parity(struct mpsc_port_info *pi, u32 p)
 {
        u32     v;
 
@@ -775,7 +724,6 @@ mpsc_set_parity(struct mpsc_port_info *pi, u32 p)
        if (pi->mirror_regs)
                pi->MPSC_CHR_2_m = v;
        writel(v, pi->mpsc_base + MPSC_CHR_2);
-       return;
 }
 
 /*
@@ -786,8 +734,7 @@ mpsc_set_parity(struct mpsc_port_info *pi, u32 p)
  ******************************************************************************
  */
 
-static void
-mpsc_init_hw(struct mpsc_port_info *pi)
+static void mpsc_init_hw(struct mpsc_port_info *pi)
 {
        pr_debug("mpsc_init_hw[%d]: Initializing\n", pi->port.line);
 
@@ -796,12 +743,9 @@ mpsc_init_hw(struct mpsc_port_info *pi)
        mpsc_sdma_init(pi, dma_get_cache_alignment());  /* burst a cacheline */
        mpsc_sdma_stop(pi);
        mpsc_hw_init(pi);
-
-       return;
 }
 
-static int
-mpsc_alloc_ring_mem(struct mpsc_port_info *pi)
+static int mpsc_alloc_ring_mem(struct mpsc_port_info *pi)
 {
        int rc = 0;
 
@@ -812,11 +756,10 @@ mpsc_alloc_ring_mem(struct mpsc_port_info *pi)
                if (!dma_supported(pi->port.dev, 0xffffffff)) {
                        printk(KERN_ERR "MPSC: Inadequate DMA support\n");
                        rc = -ENXIO;
-               }
-               else if ((pi->dma_region = dma_alloc_noncoherent(pi->port.dev,
-                       MPSC_DMA_ALLOC_SIZE, &pi->dma_region_p, GFP_KERNEL))
-                       == NULL) {
-
+               } else if ((pi->dma_region = dma_alloc_noncoherent(pi->port.dev,
+                                               MPSC_DMA_ALLOC_SIZE,
+                                               &pi->dma_region_p, GFP_KERNEL))
+                               == NULL) {
                        printk(KERN_ERR "MPSC: Can't alloc Desc region\n");
                        rc = -ENOMEM;
                }
@@ -825,23 +768,19 @@ mpsc_alloc_ring_mem(struct mpsc_port_info *pi)
        return rc;
 }
 
-static void
-mpsc_free_ring_mem(struct mpsc_port_info *pi)
+static void mpsc_free_ring_mem(struct mpsc_port_info *pi)
 {
        pr_debug("mpsc_free_ring_mem[%d]: Freeing ring mem\n", pi->port.line);
 
        if (pi->dma_region) {
                dma_free_noncoherent(pi->port.dev, MPSC_DMA_ALLOC_SIZE,
-                         pi->dma_region, pi->dma_region_p);
+                               pi->dma_region, pi->dma_region_p);
                pi->dma_region = NULL;
-               pi->dma_region_p = (dma_addr_t) NULL;
+               pi->dma_region_p = (dma_addr_t)NULL;
        }
-
-       return;
 }
 
-static void
-mpsc_init_rings(struct mpsc_port_info *pi)
+static void mpsc_init_rings(struct mpsc_port_info *pi)
 {
        struct mpsc_rx_desc *rxre;
        struct mpsc_tx_desc *txre;
@@ -859,8 +798,8 @@ mpsc_init_rings(struct mpsc_port_info *pi)
         * Descriptors & buffers are multiples of cacheline size and must be
         * cacheline aligned.
         */
-       dp = ALIGN((u32) pi->dma_region, dma_get_cache_alignment());
-       dp_p = ALIGN((u32) pi->dma_region_p, dma_get_cache_alignment());
+       dp = ALIGN((u32)pi->dma_region, dma_get_cache_alignment());
+       dp_p = ALIGN((u32)pi->dma_region_p, dma_get_cache_alignment());
 
        /*
         * Partition dma region into rx ring descriptor, rx buffers,
@@ -871,8 +810,8 @@ mpsc_init_rings(struct mpsc_port_info *pi)
        dp += MPSC_RXR_SIZE;
        dp_p += MPSC_RXR_SIZE;
 
-       pi->rxb = (u8 *) dp;
-       pi->rxb_p = (u8 *) dp_p;
+       pi->rxb = (u8 *)dp;
+       pi->rxb_p = (u8 *)dp_p;
        dp += MPSC_RXB_SIZE;
        dp_p += MPSC_RXB_SIZE;
 
@@ -883,8 +822,8 @@ mpsc_init_rings(struct mpsc_port_info *pi)
        dp += MPSC_TXR_SIZE;
        dp_p += MPSC_TXR_SIZE;
 
-       pi->txb = (u8 *) dp;
-       pi->txb_p = (u8 *) dp_p;
+       pi->txb = (u8 *)dp;
+       pi->txb_p = (u8 *)dp_p;
 
        pi->txr_head = 0;
        pi->txr_tail = 0;
@@ -900,10 +839,9 @@ mpsc_init_rings(struct mpsc_port_info *pi)
 
                rxre->bufsize = cpu_to_be16(MPSC_RXBE_SIZE);
                rxre->bytecnt = cpu_to_be16(0);
-               rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O |
-                                           SDMA_DESC_CMDSTAT_EI |
-                                           SDMA_DESC_CMDSTAT_F |
-                                           SDMA_DESC_CMDSTAT_L);
+               rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O
+                               | SDMA_DESC_CMDSTAT_EI | SDMA_DESC_CMDSTAT_F
+                               | SDMA_DESC_CMDSTAT_L);
                rxre->link = cpu_to_be32(dp_p + MPSC_RXRE_SIZE);
                rxre->buf_ptr = cpu_to_be32(bp_p);
 
@@ -933,19 +871,19 @@ mpsc_init_rings(struct mpsc_port_info *pi)
        }
        txre->link = cpu_to_be32(pi->txr_p);    /* Wrap last back to first */
 
-       dma_cache_sync(pi->port.dev, (void *) pi->dma_region, MPSC_DMA_ALLOC_SIZE,
-               DMA_BIDIRECTIONAL);
+       dma_cache_sync(pi->port.dev, (void *)pi->dma_region,
+                       MPSC_DMA_ALLOC_SIZE, DMA_BIDIRECTIONAL);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        flush_dcache_range((ulong)pi->dma_region,
-                               (ulong)pi->dma_region + MPSC_DMA_ALLOC_SIZE);
+                                       (ulong)pi->dma_region
+                                       + MPSC_DMA_ALLOC_SIZE);
 #endif
 
        return;
 }
 
-static void
-mpsc_uninit_rings(struct mpsc_port_info *pi)
+static void mpsc_uninit_rings(struct mpsc_port_info *pi)
 {
        pr_debug("mpsc_uninit_rings[%d]: Uninitializing rings\n",pi->port.line);
 
@@ -963,12 +901,9 @@ mpsc_uninit_rings(struct mpsc_port_info *pi)
        pi->txb_p = NULL;
        pi->txr_head = 0;
        pi->txr_tail = 0;
-
-       return;
 }
 
-static int
-mpsc_make_ready(struct mpsc_port_info *pi)
+static int mpsc_make_ready(struct mpsc_port_info *pi)
 {
        int rc;
 
@@ -993,8 +928,7 @@ mpsc_make_ready(struct mpsc_port_info *pi)
  ******************************************************************************
  */
 
-static inline int
-mpsc_rx_intr(struct mpsc_port_info *pi)
+static int mpsc_rx_intr(struct mpsc_port_info *pi)
 {
        struct mpsc_rx_desc *rxre;
        struct tty_struct *tty = pi->port.info->tty;
@@ -1007,21 +941,24 @@ mpsc_rx_intr(struct mpsc_port_info *pi)
 
        rxre = (struct mpsc_rx_desc *)(pi->rxr + (pi->rxr_posn*MPSC_RXRE_SIZE));
 
-       dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE);
+       dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE,
+                       DMA_FROM_DEVICE);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
        if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                invalidate_dcache_range((ulong)rxre,
-                       (ulong)rxre + MPSC_RXRE_SIZE);
+                               (ulong)rxre + MPSC_RXRE_SIZE);
 #endif
 
        /*
         * Loop through Rx descriptors handling ones that have been completed.
         */
-       while (!((cmdstat = be32_to_cpu(rxre->cmdstat)) & SDMA_DESC_CMDSTAT_O)){
+       while (!((cmdstat = be32_to_cpu(rxre->cmdstat))
+                               & SDMA_DESC_CMDSTAT_O)) {
                bytes_in = be16_to_cpu(rxre->bytecnt);
 
                /* Following use of tty struct directly is deprecated */
-               if (unlikely(tty_buffer_request_room(tty, bytes_in) < bytes_in)) {
+               if (unlikely(tty_buffer_request_room(tty, bytes_in)
+                                       < bytes_in)) {
                        if (tty->low_latency)
                                tty_flip_buffer_push(tty);
                        /*
@@ -1031,11 +968,12 @@ mpsc_rx_intr(struct mpsc_port_info *pi)
                }
 
                bp = pi->rxb + (pi->rxr_posn * MPSC_RXBE_SIZE);
-               dma_cache_sync(pi->port.dev, (void *) bp, MPSC_RXBE_SIZE, DMA_FROM_DEVICE);
+               dma_cache_sync(pi->port.dev, (void *)bp, MPSC_RXBE_SIZE,
+                               DMA_FROM_DEVICE);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        invalidate_dcache_range((ulong)bp,
-                               (ulong)bp + MPSC_RXBE_SIZE);
+                                       (ulong)bp + MPSC_RXBE_SIZE);
 #endif
 
                /*
@@ -1046,8 +984,9 @@ mpsc_rx_intr(struct mpsc_port_info *pi)
                 * we'll assume there is no data in the buffer.
                 * If there is...it gets lost.
                 */
-               if (unlikely(cmdstat & (SDMA_DESC_CMDSTAT_BR |
-                       SDMA_DESC_CMDSTAT_FR | SDMA_DESC_CMDSTAT_OR))) {
+               if (unlikely(cmdstat & (SDMA_DESC_CMDSTAT_BR
+                                               | SDMA_DESC_CMDSTAT_FR
+                                               | SDMA_DESC_CMDSTAT_OR))) {
 
                        pi->port.icount.rx++;
 
@@ -1056,11 +995,11 @@ mpsc_rx_intr(struct mpsc_port_info *pi)
 
                                if (uart_handle_break(&pi->port))
                                        goto next_frame;
-                       }
-                       else if (cmdstat & SDMA_DESC_CMDSTAT_FR)/* Framing */
+                       } else if (cmdstat & SDMA_DESC_CMDSTAT_FR) {
                                pi->port.icount.frame++;
-                       else if (cmdstat & SDMA_DESC_CMDSTAT_OR) /* Overrun */
+                       } else if (cmdstat & SDMA_DESC_CMDSTAT_OR) {
                                pi->port.icount.overrun++;
+                       }
 
                        cmdstat &= pi->port.read_status_mask;
 
@@ -1080,12 +1019,12 @@ mpsc_rx_intr(struct mpsc_port_info *pi)
                        goto next_frame;
                }
 
-               if ((unlikely(cmdstat & (SDMA_DESC_CMDSTAT_BR |
-                       SDMA_DESC_CMDSTAT_FR | SDMA_DESC_CMDSTAT_OR))) &&
-                       !(cmdstat & pi->port.ignore_status_mask))
-
+               if ((unlikely(cmdstat & (SDMA_DESC_CMDSTAT_BR
+                                               | SDMA_DESC_CMDSTAT_FR
+                                               | SDMA_DESC_CMDSTAT_OR)))
+                               && !(cmdstat & pi->port.ignore_status_mask)) {
                        tty_insert_flip_char(tty, *bp, flag);
-               else {
+               else {
                        for (i=0; i<bytes_in; i++)
                                tty_insert_flip_char(tty, *bp++, TTY_NORMAL);
 
@@ -1095,29 +1034,29 @@ mpsc_rx_intr(struct mpsc_port_info *pi)
 next_frame:
                rxre->bytecnt = cpu_to_be16(0);
                wmb();
-               rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O |
-                                           SDMA_DESC_CMDSTAT_EI |
-                                           SDMA_DESC_CMDSTAT_F |
-                                           SDMA_DESC_CMDSTAT_L);
+               rxre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O
+                               | SDMA_DESC_CMDSTAT_EI | SDMA_DESC_CMDSTAT_F
+                               | SDMA_DESC_CMDSTAT_L);
                wmb();
-               dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE, DMA_BIDIRECTIONAL);
+               dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE,
+                               DMA_BIDIRECTIONAL);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        flush_dcache_range((ulong)rxre,
-                               (ulong)rxre + MPSC_RXRE_SIZE);
+                                       (ulong)rxre + MPSC_RXRE_SIZE);
 #endif
 
                /* Advance to next descriptor */
                pi->rxr_posn = (pi->rxr_posn + 1) & (MPSC_RXR_ENTRIES - 1);
-               rxre = (struct mpsc_rx_desc *)(pi->rxr +
-                       (pi->rxr_posn * MPSC_RXRE_SIZE));
-               dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE, DMA_FROM_DEVICE);
+               rxre = (struct mpsc_rx_desc *)
+                       (pi->rxr + (pi->rxr_posn * MPSC_RXRE_SIZE));
+               dma_cache_sync(pi->port.dev, (void *)rxre, MPSC_RXRE_SIZE,
+                               DMA_FROM_DEVICE);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        invalidate_dcache_range((ulong)rxre,
-                               (ulong)rxre + MPSC_RXRE_SIZE);
+                                       (ulong)rxre + MPSC_RXRE_SIZE);
 #endif
-
                rc = 1;
        }
 
@@ -1129,42 +1068,38 @@ next_frame:
        return rc;
 }
 
-static inline void
-mpsc_setup_tx_desc(struct mpsc_port_info *pi, u32 count, u32 intr)
+static void mpsc_setup_tx_desc(struct mpsc_port_info *pi, u32 count, u32 intr)
 {
        struct mpsc_tx_desc *txre;
 
-       txre = (struct mpsc_tx_desc *)(pi->txr +
-               (pi->txr_head * MPSC_TXRE_SIZE));
+       txre = (struct mpsc_tx_desc *)(pi->txr
+                       + (pi->txr_head * MPSC_TXRE_SIZE));
 
        txre->bytecnt = cpu_to_be16(count);
        txre->shadow = txre->bytecnt;
        wmb();                  /* ensure cmdstat is last field updated */
-       txre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O | SDMA_DESC_CMDSTAT_F |
-                                   SDMA_DESC_CMDSTAT_L | ((intr) ?
-                                                          SDMA_DESC_CMDSTAT_EI
-                                                          : 0));
+       txre->cmdstat = cpu_to_be32(SDMA_DESC_CMDSTAT_O | SDMA_DESC_CMDSTAT_F
+                       | SDMA_DESC_CMDSTAT_L
+                       | ((intr) ? SDMA_DESC_CMDSTAT_EI : 0));
        wmb();
-       dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE, DMA_BIDIRECTIONAL);
+       dma_cache_sync(pi->port.dev, (void *)txre, MPSC_TXRE_SIZE,
+                       DMA_BIDIRECTIONAL);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
        if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                flush_dcache_range((ulong)txre,
-                       (ulong)txre + MPSC_TXRE_SIZE);
+                               (ulong)txre + MPSC_TXRE_SIZE);
 #endif
-
-       return;
 }
 
-static inline void
-mpsc_copy_tx_data(struct mpsc_port_info *pi)
+static void mpsc_copy_tx_data(struct mpsc_port_info *pi)
 {
        struct circ_buf *xmit = &pi->port.info->xmit;
        u8 *bp;
        u32 i;
 
        /* Make sure the desc ring isn't full */
-       while (CIRC_CNT(pi->txr_head, pi->txr_tail, MPSC_TXR_ENTRIES) <
-              (MPSC_TXR_ENTRIES - 1)) {
+       while (CIRC_CNT(pi->txr_head, pi->txr_tail, MPSC_TXR_ENTRIES)
+                       < (MPSC_TXR_ENTRIES - 1)) {
                if (pi->port.x_char) {
                        /*
                         * Ideally, we should use the TCS field in
@@ -1178,11 +1113,11 @@ mpsc_copy_tx_data(struct mpsc_port_info *pi)
                        *bp = pi->port.x_char;
                        pi->port.x_char = 0;
                        i = 1;
-               }
-               else if (!uart_circ_empty(xmit) && !uart_tx_stopped(&pi->port)){
-                       i = min((u32) MPSC_TXBE_SIZE,
-                               (u32) uart_circ_chars_pending(xmit));
-                       i = min(i, (u32) CIRC_CNT_TO_END(xmit->head, xmit->tail,
+               } else if (!uart_circ_empty(xmit)
+                               && !uart_tx_stopped(&pi->port)) {
+                       i = min((u32)MPSC_TXBE_SIZE,
+                               (u32)uart_circ_chars_pending(xmit));
+                       i = min(i, (u32)CIRC_CNT_TO_END(xmit->head, xmit->tail,
                                UART_XMIT_SIZE));
                        bp = pi->txb + (pi->txr_head * MPSC_TXBE_SIZE);
                        memcpy(bp, &xmit->buf[xmit->tail], i);
@@ -1190,27 +1125,25 @@ mpsc_copy_tx_data(struct mpsc_port_info *pi)
 
                        if (uart_circ_chars_pending(xmit) < WAKEUP_CHARS)
                                uart_write_wakeup(&pi->port);
-               }
-               else /* All tx data copied into ring bufs */
+               } else { /* All tx data copied into ring bufs */
                        return;
+               }
 
-               dma_cache_sync(pi->port.dev, (void *) bp, MPSC_TXBE_SIZE, DMA_BIDIRECTIONAL);
+               dma_cache_sync(pi->port.dev, (void *)bp, MPSC_TXBE_SIZE,
+                               DMA_BIDIRECTIONAL);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        flush_dcache_range((ulong)bp,
-                               (ulong)bp + MPSC_TXBE_SIZE);
+                                       (ulong)bp + MPSC_TXBE_SIZE);
 #endif
                mpsc_setup_tx_desc(pi, i, 1);
 
                /* Advance to next descriptor */
                pi->txr_head = (pi->txr_head + 1) & (MPSC_TXR_ENTRIES - 1);
        }
-
-       return;
 }
 
-static inline int
-mpsc_tx_intr(struct mpsc_port_info *pi)
+static int mpsc_tx_intr(struct mpsc_port_info *pi)
 {
        struct mpsc_tx_desc *txre;
        int rc = 0;
@@ -1219,14 +1152,15 @@ mpsc_tx_intr(struct mpsc_port_info *pi)
        spin_lock_irqsave(&pi->tx_lock, iflags);
 
        if (!mpsc_sdma_tx_active(pi)) {
-               txre = (struct mpsc_tx_desc *)(pi->txr +
-                       (pi->txr_tail * MPSC_TXRE_SIZE));
+               txre = (struct mpsc_tx_desc *)(pi->txr
+                               + (pi->txr_tail * MPSC_TXRE_SIZE));
 
-               dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE, DMA_FROM_DEVICE);
+               dma_cache_sync(pi->port.dev, (void *)txre, MPSC_TXRE_SIZE,
+                               DMA_FROM_DEVICE);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        invalidate_dcache_range((ulong)txre,
-                               (ulong)txre + MPSC_TXRE_SIZE);
+                                       (ulong)txre + MPSC_TXRE_SIZE);
 #endif
 
                while (!(be32_to_cpu(txre->cmdstat) & SDMA_DESC_CMDSTAT_O)) {
@@ -1238,14 +1172,14 @@ mpsc_tx_intr(struct mpsc_port_info *pi)
                        if (pi->txr_head == pi->txr_tail)
                                break;
 
-                       txre = (struct mpsc_tx_desc *)(pi->txr +
-                               (pi->txr_tail * MPSC_TXRE_SIZE));
-                       dma_cache_sync(pi->port.dev, (void *) txre, MPSC_TXRE_SIZE,
-                               DMA_FROM_DEVICE);
+                       txre = (struct mpsc_tx_desc *)(pi->txr
+                                       + (pi->txr_tail * MPSC_TXRE_SIZE));
+                       dma_cache_sync(pi->port.dev, (void *)txre,
+                                       MPSC_TXRE_SIZE, DMA_FROM_DEVICE);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                        if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                                invalidate_dcache_range((ulong)txre,
-                                       (ulong)txre + MPSC_TXRE_SIZE);
+                                               (ulong)txre + MPSC_TXRE_SIZE);
 #endif
                }
 
@@ -1262,8 +1196,7 @@ mpsc_tx_intr(struct mpsc_port_info *pi)
  * the interrupt, then handle any completed Rx/Tx descriptors.  When done
  * handling those descriptors, we restart the Rx/Tx engines if they're stopped.
  */
-static irqreturn_t
-mpsc_sdma_intr(int irq, void *dev_id)
+static irqreturn_t mpsc_sdma_intr(int irq, void *dev_id)
 {
        struct mpsc_port_info *pi = dev_id;
        ulong iflags;
@@ -1290,8 +1223,7 @@ mpsc_sdma_intr(int irq, void *dev_id)
  *
  ******************************************************************************
  */
-static uint
-mpsc_tx_empty(struct uart_port *port)
+static uint mpsc_tx_empty(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
        ulong iflags;
@@ -1304,21 +1236,18 @@ mpsc_tx_empty(struct uart_port *port)
        return rc;
 }
 
-static void
-mpsc_set_mctrl(struct uart_port *port, uint mctrl)
+static void mpsc_set_mctrl(struct uart_port *port, uint mctrl)
 {
        /* Have no way to set modem control lines AFAICT */
-       return;
 }
 
-static uint
-mpsc_get_mctrl(struct uart_port *port)
+static uint mpsc_get_mctrl(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
        u32 mflags, status;
 
-       status = (pi->mirror_regs) ? pi->MPSC_CHR_10_m :
-               readl(pi->mpsc_base + MPSC_CHR_10);
+       status = (pi->mirror_regs) ? pi->MPSC_CHR_10_m
+               readl(pi->mpsc_base + MPSC_CHR_10);
 
        mflags = 0;
        if (status & 0x1)
@@ -1329,19 +1258,16 @@ mpsc_get_mctrl(struct uart_port *port)
        return mflags | TIOCM_DSR;      /* No way to tell if DSR asserted */
 }
 
-static void
-mpsc_stop_tx(struct uart_port *port)
+static void mpsc_stop_tx(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
 
        pr_debug("mpsc_stop_tx[%d]\n", port->line);
 
        mpsc_freeze(pi);
-       return;
 }
 
-static void
-mpsc_start_tx(struct uart_port *port)
+static void mpsc_start_tx(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
        unsigned long iflags;
@@ -1355,42 +1281,45 @@ mpsc_start_tx(struct uart_port *port)
        spin_unlock_irqrestore(&pi->tx_lock, iflags);
 
        pr_debug("mpsc_start_tx[%d]\n", port->line);
-       return;
 }
 
-static void
-mpsc_start_rx(struct mpsc_port_info *pi)
+static void mpsc_start_rx(struct mpsc_port_info *pi)
 {
        pr_debug("mpsc_start_rx[%d]: Starting...\n", pi->port.line);
 
-       /* Issue a Receive Abort to clear any receive errors */
-       writel(MPSC_CHR_2_RA, pi->mpsc_base + MPSC_CHR_2);
        if (pi->rcv_data) {
                mpsc_enter_hunt(pi);
                mpsc_sdma_cmd(pi, SDMA_SDCM_ERD);
        }
-       return;
 }
 
-static void
-mpsc_stop_rx(struct uart_port *port)
+static void mpsc_stop_rx(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
 
        pr_debug("mpsc_stop_rx[%d]: Stopping...\n", port->line);
 
+       if (pi->mirror_regs) {
+               writel(pi->MPSC_CHR_2_m | MPSC_CHR_2_RA,
+                               pi->mpsc_base + MPSC_CHR_2);
+               /* Erratum prevents reading CHR_2 so just delay for a while */
+               udelay(100);
+       } else {
+               writel(readl(pi->mpsc_base + MPSC_CHR_2) | MPSC_CHR_2_RA,
+                               pi->mpsc_base + MPSC_CHR_2);
+
+               while (readl(pi->mpsc_base + MPSC_CHR_2) & MPSC_CHR_2_RA)
+                       udelay(10);
+       }
+
        mpsc_sdma_cmd(pi, SDMA_SDCM_AR);
-       return;
 }
 
-static void
-mpsc_enable_ms(struct uart_port *port)
+static void mpsc_enable_ms(struct uart_port *port)
 {
-       return;                 /* Not supported */
 }
 
-static void
-mpsc_break_ctl(struct uart_port *port, int ctl)
+static void mpsc_break_ctl(struct uart_port *port, int ctl)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
        ulong   flags;
@@ -1403,12 +1332,9 @@ mpsc_break_ctl(struct uart_port *port, int ctl)
                pi->MPSC_CHR_1_m = v;
        writel(v, pi->mpsc_base + MPSC_CHR_1);
        spin_unlock_irqrestore(&pi->port.lock, flags);
-
-       return;
 }
 
-static int
-mpsc_startup(struct uart_port *port)
+static int mpsc_startup(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
        u32 flag = 0;
@@ -1426,20 +1352,19 @@ mpsc_startup(struct uart_port *port)
                        flag = IRQF_SHARED;
 
                if (request_irq(pi->port.irq, mpsc_sdma_intr, flag,
-                               "mpsc-sdma", pi))
+                                       "mpsc-sdma", pi))
                        printk(KERN_ERR "MPSC: Can't get SDMA IRQ %d\n",
-                              pi->port.irq);
+                                       pi->port.irq);
 
                mpsc_sdma_intr_unmask(pi, 0xf);
-               mpsc_sdma_set_rx_ring(pi, (struct mpsc_rx_desc *)(pi->rxr_p +
-                       (pi->rxr_posn * MPSC_RXRE_SIZE)));
+               mpsc_sdma_set_rx_ring(pi, (struct mpsc_rx_desc *)(pi->rxr_p
+                                       + (pi->rxr_posn * MPSC_RXRE_SIZE)));
        }
 
        return rc;
 }
 
-static void
-mpsc_shutdown(struct uart_port *port)
+static void mpsc_shutdown(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
 
@@ -1447,11 +1372,9 @@ mpsc_shutdown(struct uart_port *port)
 
        mpsc_sdma_stop(pi);
        free_irq(pi->port.irq, pi);
-       return;
 }
 
-static void
-mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
+static void mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
                 struct ktermios *old)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
@@ -1508,12 +1431,11 @@ mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
        mpsc_set_baudrate(pi, baud);
 
        /* Characters/events to read */
-       pi->rcv_data = 1;
        pi->port.read_status_mask = SDMA_DESC_CMDSTAT_OR;
 
        if (termios->c_iflag & INPCK)
-               pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE |
-                   SDMA_DESC_CMDSTAT_FR;
+               pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_PE
+                       | SDMA_DESC_CMDSTAT_FR;
 
        if (termios->c_iflag & (BRKINT | PARMRK))
                pi->port.read_status_mask |= SDMA_DESC_CMDSTAT_BR;
@@ -1522,8 +1444,8 @@ mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
        pi->port.ignore_status_mask = 0;
 
        if (termios->c_iflag & IGNPAR)
-               pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_PE |
-                   SDMA_DESC_CMDSTAT_FR;
+               pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_PE
+                       | SDMA_DESC_CMDSTAT_FR;
 
        if (termios->c_iflag & IGNBRK) {
                pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_BR;
@@ -1532,32 +1454,32 @@ mpsc_set_termios(struct uart_port *port, struct ktermios *termios,
                        pi->port.ignore_status_mask |= SDMA_DESC_CMDSTAT_OR;
        }
 
-       /* Ignore all chars if CREAD not set */
-       if (!(termios->c_cflag & CREAD))
+       if ((termios->c_cflag & CREAD)) {
+               if (!pi->rcv_data) {
+                       pi->rcv_data = 1;
+                       mpsc_start_rx(pi);
+               }
+       } else if (pi->rcv_data) {
+               mpsc_stop_rx(port);
                pi->rcv_data = 0;
-       else
-               mpsc_start_rx(pi);
+       }
 
        spin_unlock_irqrestore(&pi->port.lock, flags);
-       return;
 }
 
-static const char *
-mpsc_type(struct uart_port *port)
+static const char *mpsc_type(struct uart_port *port)
 {
        pr_debug("mpsc_type[%d]: port type: %s\n", port->line,MPSC_DRIVER_NAME);
        return MPSC_DRIVER_NAME;
 }
 
-static int
-mpsc_request_port(struct uart_port *port)
+static int mpsc_request_port(struct uart_port *port)
 {
        /* Should make chip/platform specific call */
        return 0;
 }
 
-static void
-mpsc_release_port(struct uart_port *port)
+static void mpsc_release_port(struct uart_port *port)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
 
@@ -1566,18 +1488,13 @@ mpsc_release_port(struct uart_port *port)
                mpsc_free_ring_mem(pi);
                pi->ready = 0;
        }
-
-       return;
 }
 
-static void
-mpsc_config_port(struct uart_port *port, int flags)
+static void mpsc_config_port(struct uart_port *port, int flags)
 {
-       return;
 }
 
-static int
-mpsc_verify_port(struct uart_port *port, struct serial_struct *ser)
+static int mpsc_verify_port(struct uart_port *port, struct serial_struct *ser)
 {
        struct mpsc_port_info *pi = (struct mpsc_port_info *)port;
        int rc = 0;
@@ -1603,22 +1520,22 @@ mpsc_verify_port(struct uart_port *port, struct serial_struct *ser)
 }
 
 static struct uart_ops mpsc_pops = {
-       .tx_empty     = mpsc_tx_empty,
-       .set_mctrl    = mpsc_set_mctrl,
-       .get_mctrl    = mpsc_get_mctrl,
-       .stop_tx      = mpsc_stop_tx,
-       .start_tx     = mpsc_start_tx,
-       .stop_rx      = mpsc_stop_rx,
-       .enable_ms    = mpsc_enable_ms,
-       .break_ctl    = mpsc_break_ctl,
-       .startup      = mpsc_startup,
-       .shutdown     = mpsc_shutdown,
-       .set_termios  = mpsc_set_termios,
-       .type         = mpsc_type,
-       .release_port = mpsc_release_port,
-       .request_port = mpsc_request_port,
-       .config_port  = mpsc_config_port,
-       .verify_port  = mpsc_verify_port,
+       .tx_empty       = mpsc_tx_empty,
+       .set_mctrl      = mpsc_set_mctrl,
+       .get_mctrl      = mpsc_get_mctrl,
+       .stop_tx        = mpsc_stop_tx,
+       .start_tx       = mpsc_start_tx,
+       .stop_rx        = mpsc_stop_rx,
+       .enable_ms      = mpsc_enable_ms,
+       .break_ctl      = mpsc_break_ctl,
+       .startup        = mpsc_startup,
+       .shutdown       = mpsc_shutdown,
+       .set_termios    = mpsc_set_termios,
+       .type           = mpsc_type,
+       .release_port   = mpsc_release_port,
+       .request_port   = mpsc_request_port,
+       .config_port    = mpsc_config_port,
+       .verify_port    = mpsc_verify_port,
 };
 
 /*
@@ -1630,8 +1547,7 @@ static struct uart_ops mpsc_pops = {
  */
 
 #ifdef CONFIG_SERIAL_MPSC_CONSOLE
-static void
-mpsc_console_write(struct console *co, const char *s, uint count)
+static void mpsc_console_write(struct console *co, const char *s, uint count)
 {
        struct mpsc_port_info *pi = &mpsc_ports[co->index];
        u8 *bp, *dp, add_cr = 0;
@@ -1660,8 +1576,7 @@ mpsc_console_write(struct console *co, const char *s, uint count)
                        if (add_cr) {
                                *(dp++) = '\r';
                                add_cr = 0;
-                       }
-                       else {
+                       } else {
                                *(dp++) = *s;
 
                                if (*(s++) == '\n') { /* add '\r' after '\n' */
@@ -1673,11 +1588,12 @@ mpsc_console_write(struct console *co, const char *s, uint count)
                        count--;
                }
 
-               dma_cache_sync(pi->port.dev, (void *) bp, MPSC_TXBE_SIZE, DMA_BIDIRECTIONAL);
+               dma_cache_sync(pi->port.dev, (void *)bp, MPSC_TXBE_SIZE,
+                               DMA_BIDIRECTIONAL);
 #if defined(CONFIG_PPC32) && !defined(CONFIG_NOT_COHERENT_CACHE)
                if (pi->cache_mgmt) /* GT642[46]0 Res #COMM-2 */
                        flush_dcache_range((ulong)bp,
-                               (ulong)bp + MPSC_TXBE_SIZE);
+                                       (ulong)bp + MPSC_TXBE_SIZE);
 #endif
                mpsc_setup_tx_desc(pi, i, 0);
                pi->txr_head = (pi->txr_head + 1) & (MPSC_TXR_ENTRIES - 1);
@@ -1690,11 +1606,9 @@ mpsc_console_write(struct console *co, const char *s, uint count)
        }
 
        spin_unlock_irqrestore(&pi->tx_lock, iflags);
-       return;
 }
 
-static int __init
-mpsc_console_setup(struct console *co, char *options)
+static int __init mpsc_console_setup(struct console *co, char *options)
 {
        struct mpsc_port_info *pi;
        int baud, bits, parity, flow;
@@ -1723,17 +1637,16 @@ mpsc_console_setup(struct console *co, char *options)
 }
 
 static struct console mpsc_console = {
-       .name   = MPSC_DEV_NAME,
-       .write  = mpsc_console_write,
-       .device = uart_console_device,
-       .setup  = mpsc_console_setup,
-       .flags  = CON_PRINTBUFFER,
-       .index  = -1,
-       .data   = &mpsc_reg,
+       .name   = MPSC_DEV_NAME,
+       .write  = mpsc_console_write,
+       .device = uart_console_device,
+       .setup  = mpsc_console_setup,
+       .flags  = CON_PRINTBUFFER,
+       .index  = -1,
+       .data   = &mpsc_reg,
 };
 
-static int __init
-mpsc_late_console_init(void)
+static int __init mpsc_late_console_init(void)
 {
        pr_debug("mpsc_late_console_init: Enter\n");
 
@@ -1755,43 +1668,40 @@ late_initcall(mpsc_late_console_init);
  *
  ******************************************************************************
  */
-static void
-mpsc_resource_err(char *s)
+static void mpsc_resource_err(char *s)
 {
        printk(KERN_WARNING "MPSC: Platform device resource error in %s\n", s);
-       return;
 }
 
-static int
-mpsc_shared_map_regs(struct platform_device *pd)
+static int mpsc_shared_map_regs(struct platform_device *pd)
 {
        struct resource *r;
 
        if ((r = platform_get_resource(pd, IORESOURCE_MEM,
-               MPSC_ROUTING_BASE_ORDER)) && request_mem_region(r->start,
-               MPSC_ROUTING_REG_BLOCK_SIZE, "mpsc_routing_regs")) {
-
+                                       MPSC_ROUTING_BASE_ORDER))
+                       && request_mem_region(r->start,
+                               MPSC_ROUTING_REG_BLOCK_SIZE,
+                               "mpsc_routing_regs")) {
                mpsc_shared_regs.mpsc_routing_base = ioremap(r->start,
-                       MPSC_ROUTING_REG_BLOCK_SIZE);
+                               MPSC_ROUTING_REG_BLOCK_SIZE);
                mpsc_shared_regs.mpsc_routing_base_p = r->start;
-       }
-       else {
+       } else {
                mpsc_resource_err("MPSC routing base");
                return -ENOMEM;
        }
 
        if ((r = platform_get_resource(pd, IORESOURCE_MEM,
-               MPSC_SDMA_INTR_BASE_ORDER)) && request_mem_region(r->start,
-               MPSC_SDMA_INTR_REG_BLOCK_SIZE, "sdma_intr_regs")) {
-
+                                       MPSC_SDMA_INTR_BASE_ORDER))
+                       && request_mem_region(r->start,
+                               MPSC_SDMA_INTR_REG_BLOCK_SIZE,
+                               "sdma_intr_regs")) {
                mpsc_shared_regs.sdma_intr_base = ioremap(r->start,
                        MPSC_SDMA_INTR_REG_BLOCK_SIZE);
                mpsc_shared_regs.sdma_intr_base_p = r->start;
-       }
-       else {
+       } else {
                iounmap(mpsc_shared_regs.mpsc_routing_base);
                release_mem_region(mpsc_shared_regs.mpsc_routing_base_p,
-                       MPSC_ROUTING_REG_BLOCK_SIZE);
+                               MPSC_ROUTING_REG_BLOCK_SIZE);
                mpsc_resource_err("SDMA intr base");
                return -ENOMEM;
        }
@@ -1799,18 +1709,17 @@ mpsc_shared_map_regs(struct platform_device *pd)
        return 0;
 }
 
-static void
-mpsc_shared_unmap_regs(void)
+static void mpsc_shared_unmap_regs(void)
 {
        if (!mpsc_shared_regs.mpsc_routing_base) {
                iounmap(mpsc_shared_regs.mpsc_routing_base);
                release_mem_region(mpsc_shared_regs.mpsc_routing_base_p,
-                       MPSC_ROUTING_REG_BLOCK_SIZE);
+                               MPSC_ROUTING_REG_BLOCK_SIZE);
        }
        if (!mpsc_shared_regs.sdma_intr_base) {
                iounmap(mpsc_shared_regs.sdma_intr_base);
                release_mem_region(mpsc_shared_regs.sdma_intr_base_p,
-                       MPSC_SDMA_INTR_REG_BLOCK_SIZE);
+                               MPSC_SDMA_INTR_REG_BLOCK_SIZE);
        }
 
        mpsc_shared_regs.mpsc_routing_base = NULL;
@@ -1818,19 +1727,17 @@ mpsc_shared_unmap_regs(void)
 
        mpsc_shared_regs.mpsc_routing_base_p = 0;
        mpsc_shared_regs.sdma_intr_base_p = 0;
-
-       return;
 }
 
-static int
-mpsc_shared_drv_probe(struct platform_device *dev)
+static int mpsc_shared_drv_probe(struct platform_device *dev)
 {
        struct mpsc_shared_pdata        *pdata;
        int                              rc = -ENODEV;
 
        if (dev->id == 0) {
-               if (!(rc = mpsc_shared_map_regs(dev)))  {
-                       pdata = (struct mpsc_shared_pdata *)dev->dev.platform_data;
+               if (!(rc = mpsc_shared_map_regs(dev))) {
+                       pdata = (struct mpsc_shared_pdata *)
+                               dev->dev.platform_data;
 
                        mpsc_shared_regs.MPSC_MRR_m = pdata->mrr_val;
                        mpsc_shared_regs.MPSC_RCRR_m= pdata->rcrr_val;
@@ -1847,8 +1754,7 @@ mpsc_shared_drv_probe(struct platform_device *dev)
        return rc;
 }
 
-static int
-mpsc_shared_drv_remove(struct platform_device *dev)
+static int mpsc_shared_drv_remove(struct platform_device *dev)
 {
        int     rc = -ENODEV;
 
@@ -1869,7 +1775,7 @@ static struct platform_driver mpsc_shared_driver = {
        .probe  = mpsc_shared_drv_probe,
        .remove = mpsc_shared_drv_remove,
        .driver = {
-               .name = MPSC_SHARED_NAME,
+               .name   = MPSC_SHARED_NAME,
        },
 };
 
@@ -1881,55 +1787,51 @@ static struct platform_driver mpsc_shared_driver = {
  ******************************************************************************
  */
 static struct uart_driver mpsc_reg = {
-       .owner       = THIS_MODULE,
-       .driver_name = MPSC_DRIVER_NAME,
-       .dev_name    = MPSC_DEV_NAME,
-       .major       = MPSC_MAJOR,
-       .minor       = MPSC_MINOR_START,
-       .nr          = MPSC_NUM_CTLRS,
-       .cons        = MPSC_CONSOLE,
+       .owner          = THIS_MODULE,
+       .driver_name    = MPSC_DRIVER_NAME,
+       .dev_name       = MPSC_DEV_NAME,
+       .major          = MPSC_MAJOR,
+       .minor          = MPSC_MINOR_START,
+       .nr             = MPSC_NUM_CTLRS,
+       .cons           = MPSC_CONSOLE,
 };
 
-static int
-mpsc_drv_map_regs(struct mpsc_port_info *pi, struct platform_device *pd)
+static int mpsc_drv_map_regs(struct mpsc_port_info *pi,
+               struct platform_device *pd)
 {
        struct resource *r;
 
-       if ((r = platform_get_resource(pd, IORESOURCE_MEM, MPSC_BASE_ORDER)) &&
-               request_mem_region(r->start, MPSC_REG_BLOCK_SIZE, "mpsc_regs")){
-
+       if ((r = platform_get_resource(pd, IORESOURCE_MEM, MPSC_BASE_ORDER))
+                       && request_mem_region(r->start, MPSC_REG_BLOCK_SIZE,
+                       "mpsc_regs")) {
                pi->mpsc_base = ioremap(r->start, MPSC_REG_BLOCK_SIZE);
                pi->mpsc_base_p = r->start;
-       }
-       else {
+       } else {
                mpsc_resource_err("MPSC base");
-               return -ENOMEM;
+               goto err;
        }
 
        if ((r = platform_get_resource(pd, IORESOURCE_MEM,
-               MPSC_SDMA_BASE_ORDER)) && request_mem_region(r->start,
-               MPSC_SDMA_REG_BLOCK_SIZE, "sdma_regs")) {
-
+                                       MPSC_SDMA_BASE_ORDER))
+                       && request_mem_region(r->start,
+                               MPSC_SDMA_REG_BLOCK_SIZE, "sdma_regs")) {
                pi->sdma_base = ioremap(r->start,MPSC_SDMA_REG_BLOCK_SIZE);
                pi->sdma_base_p = r->start;
-       }
-       else {
+       } else {
                mpsc_resource_err("SDMA base");
                if (pi->mpsc_base) {
                        iounmap(pi->mpsc_base);
                        pi->mpsc_base = NULL;
                }
-               return -ENOMEM;
+               goto err;
        }
 
        if ((r = platform_get_resource(pd,IORESOURCE_MEM,MPSC_BRG_BASE_ORDER))
-               && request_mem_region(r->start, MPSC_BRG_REG_BLOCK_SIZE,
-               "brg_regs")) {
-
+                       && request_mem_region(r->start,
+                               MPSC_BRG_REG_BLOCK_SIZE, "brg_regs")) {
                pi->brg_base = ioremap(r->start, MPSC_BRG_REG_BLOCK_SIZE);
                pi->brg_base_p = r->start;
-       }
-       else {
+       } else {
                mpsc_resource_err("BRG base");
                if (pi->mpsc_base) {
                        iounmap(pi->mpsc_base);
@@ -1939,14 +1841,15 @@ mpsc_drv_map_regs(struct mpsc_port_info *pi, struct platform_device *pd)
                        iounmap(pi->sdma_base);
                        pi->sdma_base = NULL;
                }
-               return -ENOMEM;
+               goto err;
        }
-
        return 0;
+
+err:
+       return -ENOMEM;
 }
 
-static void
-mpsc_drv_unmap_regs(struct mpsc_port_info *pi)
+static void mpsc_drv_unmap_regs(struct mpsc_port_info *pi)
 {
        if (!pi->mpsc_base) {
                iounmap(pi->mpsc_base);
@@ -1968,13 +1871,10 @@ mpsc_drv_unmap_regs(struct mpsc_port_info *pi)
        pi->mpsc_base_p = 0;
        pi->sdma_base_p = 0;
        pi->brg_base_p = 0;
-
-       return;
 }
 
-static void
-mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
-       struct platform_device *pd, int num)
+static void mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
+               struct platform_device *pd, int num)
 {
        struct mpsc_pdata       *pdata;
 
@@ -2009,12 +1909,9 @@ mpsc_drv_get_platform_data(struct mpsc_port_info *pi,
        pi->shared_regs = &mpsc_shared_regs;
 
        pi->port.irq = platform_get_irq(pd, 0);
-
-       return;
 }
 
-static int
-mpsc_drv_probe(struct platform_device *dev)
+static int mpsc_drv_probe(struct platform_device *dev)
 {
        struct mpsc_port_info   *pi;
        int                     rc = -ENODEV;
@@ -2030,47 +1927,46 @@ mpsc_drv_probe(struct platform_device *dev)
                        if (!(rc = mpsc_make_ready(pi))) {
                                spin_lock_init(&pi->tx_lock);
                                if (!(rc = uart_add_one_port(&mpsc_reg,
-                                       &pi->port)))
+                                                               &pi->port))) {
                                        rc = 0;
-                               else {
-                                       mpsc_release_port(
-                                               (struct uart_port *)pi);
+                               else {
+                                       mpsc_release_port((struct uart_port *)
+                                                       pi);
                                        mpsc_drv_unmap_regs(pi);
                                }
-                       }
-                       else
+                       } else {
                                mpsc_drv_unmap_regs(pi);
+                       }
                }
        }
 
        return rc;
 }
 
-static int
-mpsc_drv_remove(struct platform_device *dev)
+static int mpsc_drv_remove(struct platform_device *dev)
 {
        pr_debug("mpsc_drv_exit: Removing MPSC %d\n", dev->id);
 
        if (dev->id < MPSC_NUM_CTLRS) {
                uart_remove_one_port(&mpsc_reg, &mpsc_ports[dev->id].port);
-               mpsc_release_port((struct uart_port *)&mpsc_ports[dev->id].port);
+               mpsc_release_port((struct uart_port *)
+                               &mpsc_ports[dev->id].port);
                mpsc_drv_unmap_regs(&mpsc_ports[dev->id]);
                return 0;
-       }
-       else
+       } else {
                return -ENODEV;
+       }
 }
 
 static struct platform_driver mpsc_driver = {
        .probe  = mpsc_drv_probe,
        .remove = mpsc_drv_remove,
        .driver = {
-               .name = MPSC_CTLR_NAME,
+               .name   = MPSC_CTLR_NAME,
        },
 };
 
-static int __init
-mpsc_drv_init(void)
+static int __init mpsc_drv_init(void)
 {
        int     rc;
 
@@ -2085,24 +1981,21 @@ mpsc_drv_init(void)
                                platform_driver_unregister(&mpsc_shared_driver);
                                uart_unregister_driver(&mpsc_reg);
                        }
-               }
-               else
+               } else {
                        uart_unregister_driver(&mpsc_reg);
+               }
        }
 
        return rc;
-
 }
 
-static void __exit
-mpsc_drv_exit(void)
+static void __exit mpsc_drv_exit(void)
 {
        platform_driver_unregister(&mpsc_driver);
        platform_driver_unregister(&mpsc_shared_driver);
        uart_unregister_driver(&mpsc_reg);
        memset(mpsc_ports, 0, sizeof(mpsc_ports));
        memset(&mpsc_shared_regs, 0, sizeof(mpsc_shared_regs));
-       return;
 }
 
 module_init(mpsc_drv_init);
index 1d9d7285172a46cf4662ef48bf0761c396d04894..201253755011c457180937522a88ae0ad7b60e68 100644 (file)
@@ -25,6 +25,7 @@
 #define SUPPORT_SYSRQ
 #endif
 
+#include <linux/compiler.h>
 #include <linux/console.h>
 #include <linux/delay.h>
 #include <linux/errno.h>
@@ -103,8 +104,6 @@ struct sbd_duart {
 
 static struct sbd_duart sbd_duarts[DUART_MAX_CHIP];
 
-#define __unused __attribute__((__unused__))
-
 
 /*
  * Reading and writing SB1250 DUART registers.
@@ -204,12 +203,12 @@ static int sbd_receive_drain(struct sbd_port *sport)
        return loops;
 }
 
-static int __unused sbd_transmit_ready(struct sbd_port *sport)
+static int __maybe_unused sbd_transmit_ready(struct sbd_port *sport)
 {
        return read_sbdchn(sport, R_DUART_STATUS) & M_DUART_TX_RDY;
 }
 
-static int __unused sbd_transmit_drain(struct sbd_port *sport)
+static int __maybe_unused sbd_transmit_drain(struct sbd_port *sport)
 {
        int loops = 10000;
 
@@ -664,7 +663,7 @@ static void sbd_release_port(struct uart_port *uport)
 
 static int sbd_map_port(struct uart_port *uport)
 {
-       static const char *err = KERN_ERR "sbd: Cannot map MMIO\n";
+       const char *err = KERN_ERR "sbd: Cannot map MMIO\n";
        struct sbd_port *sport = to_sport(uport);
        struct sbd_duart *duart = sport->duart;
 
@@ -691,8 +690,7 @@ static int sbd_map_port(struct uart_port *uport)
 
 static int sbd_request_port(struct uart_port *uport)
 {
-       static const char *err = KERN_ERR
-                                "sbd: Unable to reserve MMIO resource\n";
+       const char *err = KERN_ERR "sbd: Unable to reserve MMIO resource\n";
        struct sbd_duart *duart = to_sport(uport)->duart;
        int map_guard;
        int ret = 0;
@@ -755,7 +753,7 @@ static int sbd_verify_port(struct uart_port *uport, struct serial_struct *ser)
 }
 
 
-static struct uart_ops sbd_ops = {
+static const struct uart_ops sbd_ops = {
        .tx_empty       = sbd_tx_empty,
        .set_mctrl      = sbd_set_mctrl,
        .get_mctrl      = sbd_get_mctrl,
index 1deb5764326d089aabe09f4b54fae1290e72be2a..b8f91e018b216be2945f7ced663071e087d2a335 100644 (file)
@@ -1043,8 +1043,9 @@ static int __devinit serial_txx9_probe(struct platform_device *dev)
                ret = serial_txx9_register_port(&port);
                if (ret < 0) {
                        dev_err(&dev->dev, "unable to register port at index %d "
-                               "(IO%x MEM%lx IRQ%d): %d\n", i,
-                               p->iobase, p->mapbase, p->irq, ret);
+                               "(IO%x MEM%llx IRQ%d): %d\n", i,
+                               p->iobase, (unsigned long long)p->mapbase,
+                               p->irq, ret);
                }
        }
        return 0;
index 672cd104253968451af42759fdb2320a2791d922..053fca41b08a325f48b0575795309c3c217a00b5 100644 (file)
@@ -12,6 +12,7 @@
  *   Modified to support multiple serial ports. Stuart Menefy (May 2000).
  *   Modified to support SecureEdge. David McCullough (2002)
  *   Modified to support SH7300 SCIF. Takashi Kusuda (Jun 2003).
+ *   Removed SH7300 support (Jul 2007).
  *
  * This file is subject to the terms and conditions of the GNU General Public
  * License.  See the file "COPYING" in the main directory of this archive
@@ -289,13 +290,7 @@ static void sci_init_pins_irda(struct uart_port *port, unsigned int cflag)
 #endif
 
 #if defined(SCIF_ONLY) || defined(SCI_AND_SCIF)
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) 
-/* SH7300 doesn't use RTS/CTS */
-static void sci_init_pins_scif(struct uart_port *port, unsigned int cflag)
-{
-       sci_out(port, SCFCR, 0);
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
+#if defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
 static void sci_init_pins_scif(struct uart_port* port, unsigned int cflag)
 {
        unsigned int fcr_val = 0;
index 247fb66bf0f41e7a4de7685f4e72077bb244c7d6..cf75466ebf57eb19835f89d99788605a9d5b397f 100644 (file)
@@ -9,6 +9,7 @@
  *  Modified to support multiple serial ports. Stuart Menefy (May 2000).
  *  Modified to support SH7300(SH-Mobile) SCIF. Takashi Kusuda (Jun 2003).
  *  Modified to support H8/300 Series Yoshinori Sato (Feb 2004).
+ *  Removed SH7300 support (Jul 2007).
  */
 #include <linux/serial_core.h>
 #include <asm/io.h>
 #endif
 #endif
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7708)
-# define SCSPTR 0xffffff7c /* 8 bit */
-# define SCSCR_INIT(port)          0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCI_ONLY
-#elif defined(CONFIG_CPU_SUBTYPE_SH7707) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7709) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7706)
+#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7707) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7708) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7709)
 # define SCPCR  0xA4000116 /* 16 bit SCI and SCIF */
 # define SCPDR  0xA4000136 /* 8  bit SCI and SCIF */
 # define SCSCR_INIT(port)          0x30 /* TIE=0,RIE=0,TE=1,RE=1 */
 # define SCIF_ORER 0x0001  /* overrun error bit */
 # define SCSCR_INIT(port)          0x38 /* TIE=0,RIE=0,TE=1,RE=1,REIE=1 */
 # define SCIF_ONLY
-#elif defined(CONFIG_CPU_SUBTYPE_SH7300)
-# define SCPCR  0xA4050116        /* 16 bit SCIF */
-# define SCPDR  0xA4050136        /* 16 bit SCIF */
-# define SCSCR_INIT(port)  0x0030 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCIF_ONLY
 #elif defined(CONFIG_CPU_SUBTYPE_SH7710) || defined(CONFIG_CPU_SUBTYPE_SH7712)
 # define SCSPTR0 0xA4400000      /* 16 bit SCIF */
 # define SCI_NPORTS 2
 # define PBCR 0xa4050102
 # define SCSCR_INIT(port)          0x3B
 # define SCIF_ONLY
-#elif defined(CONFIG_CPU_SUBTYPE_SH73180)
-# define SCPDR  0xA4050138        /* 16 bit SCIF */
-# define SCSPTR2 SCPDR
-# define SCIF_ORER 0x0001   /* overrun error bit */
-# define SCSCR_INIT(port)  0x0038 /* TIE=0,RIE=0,TE=1,RE=1 */
-# define SCIF_ONLY
 #elif defined(CONFIG_CPU_SUBTYPE_SH7343)
 # define SCSPTR0 0xffe00010    /* 16 bit SCIF */
 # define SCSPTR1 0xffe10010    /* 16 bit SCIF */
 #define SCIF_RDF   0x0002 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
 #define SCIF_DR    0x0001 /* 7705 SCIF, 7707 SCIF, 7709 SCIF, 7750 SCIF */
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705)
+#if defined(CONFIG_CPU_SUBTYPE_SH7705)
 #define SCIF_ORER    0x0200
 #define SCIF_ERRORS ( SCIF_PER | SCIF_FER | SCIF_ER | SCIF_BRK | SCIF_ORER)
 #define SCIF_RFDC_MASK 0x007f
 # define SCxSR_ERRORS(port)            SCIF_ERRORS
 # define SCxSR_RDxF(port)               SCIF_RDF
 # define SCxSR_TDxE(port)               SCIF_TDFE
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705)
+#if defined(CONFIG_CPU_SUBTYPE_SH7705)
 # define SCxSR_ORER(port)              SCIF_ORER
 #else
 # define SCxSR_ORER(port)              0x0000
 # define SCxSR_FER(port)               SCIF_FER
 # define SCxSR_PER(port)               SCIF_PER
 # define SCxSR_BRK(port)               SCIF_BRK
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7705)
+#if defined(CONFIG_CPU_SUBTYPE_SH7705)
 # define SCxSR_RDxF_CLEAR(port)         (sci_in(port,SCxSR)&0xfffc)
 # define SCxSR_ERROR_CLEAR(port)        (sci_in(port,SCxSR)&0xfd73)
 # define SCxSR_TDxE_CLEAR(port)         (sci_in(port,SCxSR)&0xffdf)
 # define SCxSR_BREAK_CLEAR(port)        (sci_in(port,SCxSR)&0xffe3)
 #else
-/* SH7705 can also use this, clearing is same between 7705 and 7709 and 7300 */
+/* SH7705 can also use this, clearing is same between 7705 and 7709 */
 # define SCxSR_RDxF_CLEAR(port)                0x00fc
 # define SCxSR_ERROR_CLEAR(port)       0x0073
 # define SCxSR_TDxE_CLEAR(port)                0x00df
   CPU_SCIx_FNS(name, sh4_sci_offset, sh4_sci_size, sh4_scif_offset, sh4_scif_size)
 #define SCIF_FNS(name, sh3_scif_offset, sh3_scif_size, sh4_scif_offset, sh4_scif_size) \
          CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
-#elif defined(CONFIG_CPU_SUBTYPE_SH7300) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7705) 
+#elif defined(CONFIG_CPU_SUBTYPE_SH7705)
 #define SCIF_FNS(name, scif_offset, scif_size) \
   CPU_SCIF_FNS(name, scif_offset, scif_size)
 #else
   CPU_SCIF_FNS(name, sh4_scif_offset, sh4_scif_size)
 #endif
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7705) 
+#if defined(CONFIG_CPU_SUBTYPE_SH7705)
 
 SCIF_FNS(SCSMR,  0x00, 16)
 SCIF_FNS(SCBRR,  0x04,  8)
@@ -485,16 +470,10 @@ static const struct __attribute__((packed)) {
 };
 #endif
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7708)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       if (port->mapbase == 0xfffffe80)
-               return ctrl_inb(SCSPTR)&0x01 ? 1 : 0; /* SCI */
-       return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH7707) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7709) || \
-      defined(CONFIG_CPU_SUBTYPE_SH7706)
+#if defined(CONFIG_CPU_SUBTYPE_SH7706) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7707) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7708) || \
+    defined(CONFIG_CPU_SUBTYPE_SH7709)
 static inline int sci_rxd_in(struct uart_port *port)
 {
        if (port->mapbase == 0xfffffe80)
@@ -562,18 +541,6 @@ static inline int sci_rxd_in(struct uart_port *port)
                return ctrl_inw(SCSPTR2) & 0x0001 ? 1 : 0; /* SCIF */
        return 1;
 }
-#elif defined(CONFIG_CPU_SUBTYPE_SH7300)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-        if (port->mapbase == 0xa4430000)
-                return ctrl_inb(SCPDR)&0x01 ? 1 : 0; /* SCIF0 */
-        return 1;
-}
-#elif defined(CONFIG_CPU_SUBTYPE_SH73180)
-static inline int sci_rxd_in(struct uart_port *port)
-{
-       return ctrl_inb(SCPDR)&0x01 ? 1 : 0; /* SCIF0 */
-}
 #elif defined(CONFIG_CPU_SUBTYPE_SH7343)
 static inline int sci_rxd_in(struct uart_port *port)
 {
@@ -721,8 +688,7 @@ static inline int sci_rxd_in(struct uart_port *port)
  * -- Mitch Davis - 15 Jul 2000
  */
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7780) || \
+#if defined(CONFIG_CPU_SUBTYPE_SH7780) || \
     defined(CONFIG_CPU_SUBTYPE_SH7785)
 #define SCBRR_VALUE(bps, clk) ((clk+16*bps)/(16*bps)-1)
 #elif defined(CONFIG_CPU_SUBTYPE_SH7705)
index 85309acb75f634da4e3ef3b97590dc5d559ecb79..6fd51b0022caabc3b11ddc60eda522c2bdcf1e62 100644 (file)
@@ -65,7 +65,9 @@ static struct uart_port siu_uart_ports[SIU_PORTS_MAX] = {
        },
 };
 
+#ifdef CONFIG_SERIAL_VR41XX_CONSOLE
 static uint8_t lsr_break_flag[SIU_PORTS_MAX];
+#endif
 
 #define siu_read(port, offset)         readb((port)->membase + (offset))
 #define siu_write(port, offset, value) writeb((value), (port)->membase + (offset))
@@ -782,7 +784,7 @@ static void siu_console_write(struct console *con, const char *s, unsigned count
        siu_write(port, UART_IER, ier);
 }
 
-static int siu_console_setup(struct console *con, char *options)
+static int __init siu_console_setup(struct console *con, char *options)
 {
        struct uart_port *port;
        int baud = 9600;
@@ -800,7 +802,8 @@ static int siu_console_setup(struct console *con, char *options)
                port->membase = ioremap(port->mapbase, siu_port_size(port));
        }
 
-       vr41xx_select_siu_interface(SIU_INTERFACE_RS232C);
+       if (port->type == PORT_VR41XX_SIU)
+               vr41xx_select_siu_interface(SIU_INTERFACE_RS232C);
 
        if (options != NULL)
                uart_parse_options(options, &baud, &parity, &bits, &flow);
index b05de30b5d9bbf4af1991ca8bc514b12acc8290d..e84d21597943d85d1752270526f43232221f1e7c 100644 (file)
@@ -200,6 +200,8 @@ static DEFINE_MUTEX(board_lock);
  * platforms may not be able to use spi_register_board_info though, and
  * this is exported so that for example a USB or parport based adapter
  * driver could add devices (which it would learn about out-of-band).
+ *
+ * Returns the new device, or NULL.
  */
 struct spi_device *spi_new_device(struct spi_master *master,
                                  struct spi_board_info *chip)
@@ -208,7 +210,20 @@ struct spi_device *spi_new_device(struct spi_master *master,
        struct device           *dev = master->cdev.dev;
        int                     status;
 
-       /* NOTE:  caller did any chip->bus_num checks necessary */
+       /* NOTE:  caller did any chip->bus_num checks necessary.
+        *
+        * Also, unless we change the return value convention to use
+        * error-or-pointer (not NULL-or-pointer), troubleshootability
+        * suggests syslogged diagnostics are best here (ugh).
+        */
+
+       /* Chipselects are numbered 0..max; validate. */
+       if (chip->chip_select >= master->num_chipselect) {
+               dev_err(dev, "cs%d > max %d\n",
+                       chip->chip_select,
+                       master->num_chipselect);
+               return NULL;
+       }
 
        if (!spi_master_get(master))
                return NULL;
@@ -236,10 +251,10 @@ struct spi_device *spi_new_device(struct spi_master *master,
        proxy->controller_state = NULL;
        proxy->dev.release = spidev_release;
 
-       /* drivers may modify this default i/o setup */
+       /* drivers may modify this initial i/o setup */
        status = master->setup(proxy);
        if (status < 0) {
-               dev_dbg(dev, "can't %s %s, status %d\n",
+               dev_err(dev, "can't %s %s, status %d\n",
                                "setup", proxy->dev.bus_id, status);
                goto fail;
        }
@@ -249,7 +264,7 @@ struct spi_device *spi_new_device(struct spi_master *master,
         */
        status = device_register(&proxy->dev);
        if (status < 0) {
-               dev_dbg(dev, "can't %s %s, status %d\n",
+               dev_err(dev, "can't %s %s, status %d\n",
                                "add", proxy->dev.bus_id, status);
                goto fail;
        }
@@ -306,7 +321,6 @@ spi_register_board_info(struct spi_board_info const *info, unsigned n)
 static void scan_boardinfo(struct spi_master *master)
 {
        struct boardinfo        *bi;
-       struct device           *dev = master->cdev.dev;
 
        mutex_lock(&board_lock);
        list_for_each_entry(bi, &board_list, list) {
@@ -316,17 +330,9 @@ static void scan_boardinfo(struct spi_master *master)
                for (n = bi->n_board_info; n > 0; n--, chip++) {
                        if (chip->bus_num != master->bus_num)
                                continue;
-                       /* some controllers only have one chip, so they
-                        * might not use chipselects.  otherwise, the
-                        * chipselects are numbered 0..max.
+                       /* NOTE: this relies on spi_new_device to
+                        * issue diagnostics when given bogus inputs
                         */
-                       if (chip->chip_select >= master->num_chipselect
-                                       && master->num_chipselect) {
-                               dev_dbg(dev, "cs%d > max %d\n",
-                                       chip->chip_select,
-                                       master->num_chipselect);
-                               continue;
-                       }
                        (void) spi_new_device(master, chip);
                }
        }
@@ -419,8 +425,17 @@ int spi_register_master(struct spi_master *master)
        if (!dev)
                return -ENODEV;
 
+       /* even if it's just one always-selected device, there must
+        * be at least one chipselect
+        */
+       if (master->num_chipselect == 0)
+               return -EINVAL;
+
        /* convention:  dynamically assigned bus IDs count down from the max */
        if (master->bus_num < 0) {
+               /* FIXME switch to an IDR based scheme, something like
+                * I2C now uses, so we can't run out of "dynamic" IDs
+                */
                master->bus_num = atomic_dec_return(&dyn_bus_id);
                dynamic = 1;
        }
index 3295cfcc9f2060ce321550e0b6bebdcd50f4eec9..2adf856e44c2bf0d91d6081adfc25b9549559384 100644 (file)
@@ -39,6 +39,7 @@ struct mpc83xx_spi_reg {
 };
 
 /* SPI Controller mode register definitions */
+#define        SPMODE_LOOP             (1 << 30)
 #define        SPMODE_CI_INACTIVEHIGH  (1 << 29)
 #define        SPMODE_CP_BEGIN_EDGECLK (1 << 28)
 #define        SPMODE_DIV16            (1 << 27)
@@ -85,7 +86,7 @@ struct mpc83xx_spi {
 
        unsigned nsecs;         /* (clock cycle time)/2 */
 
-       u32 sysclk;
+       u32 spibrg;             /* SPIBRG input clock */
        u32 rx_shift;           /* RX data reg shift when in qe mode */
        u32 tx_shift;           /* TX data reg shift when in qe mode */
 
@@ -147,35 +148,48 @@ static void mpc83xx_spi_chipselect(struct spi_device *spi, int value)
        if (value == BITBANG_CS_ACTIVE) {
                u32 regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
                u32 len = spi->bits_per_word;
+               u8 pm;
+
                if (len == 32)
                        len = 0;
                else
                        len = len - 1;
 
                /* mask out bits we are going to set */
-               regval &= ~0x38ff0000;
+               regval &= ~(SPMODE_CP_BEGIN_EDGECLK | SPMODE_CI_INACTIVEHIGH
+                               | SPMODE_LEN(0xF) | SPMODE_DIV16
+                               | SPMODE_PM(0xF) | SPMODE_REV | SPMODE_LOOP);
 
                if (spi->mode & SPI_CPHA)
                        regval |= SPMODE_CP_BEGIN_EDGECLK;
                if (spi->mode & SPI_CPOL)
                        regval |= SPMODE_CI_INACTIVEHIGH;
+               if (!(spi->mode & SPI_LSB_FIRST))
+                       regval |= SPMODE_REV;
+               if (spi->mode & SPI_LOOP)
+                       regval |= SPMODE_LOOP;
 
                regval |= SPMODE_LEN(len);
 
-               if ((mpc83xx_spi->sysclk / spi->max_speed_hz) >= 64) {
-                       u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 64);
+               if ((mpc83xx_spi->spibrg / spi->max_speed_hz) >= 64) {
+                       pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 64) - 1;
                        if (pm > 0x0f) {
-                               printk(KERN_WARNING "MPC83xx SPI: SPICLK can't be less then a SYSCLK/1024!\n"
-                                               "Requested SPICLK is %d Hz. Will use %d Hz instead.\n",
-                                               spi->max_speed_hz, mpc83xx_spi->sysclk / 1024);
+                               dev_err(&spi->dev, "Requested speed is too "
+                                       "low: %d Hz. Will use %d Hz instead.\n",
+                                       spi->max_speed_hz,
+                                       mpc83xx_spi->spibrg / 1024);
                                pm = 0x0f;
                        }
                        regval |= SPMODE_PM(pm) | SPMODE_DIV16;
                } else {
-                       u8 pm = mpc83xx_spi->sysclk / (spi->max_speed_hz * 4);
+                       pm = mpc83xx_spi->spibrg / (spi->max_speed_hz * 4);
+                       if (pm)
+                               pm--;
                        regval |= SPMODE_PM(pm);
                }
 
+               /* Turn off SPI unit prior changing mode */
+               mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
                mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
                if (mpc83xx_spi->activate_cs)
                        mpc83xx_spi->activate_cs(spi->chip_select, pol);
@@ -231,6 +245,14 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
        } else
                return -EINVAL;
 
+       if (mpc83xx_spi->qe_mode && spi->mode & SPI_LSB_FIRST) {
+               mpc83xx_spi->tx_shift = 0;
+               if (bits_per_word <= 8)
+                       mpc83xx_spi->rx_shift = 8;
+               else
+                       mpc83xx_spi->rx_shift = 0;
+       }
+
        /* nsecs = (clock period)/2 */
        if (!hz)
                hz = spi->max_speed_hz;
@@ -245,17 +267,22 @@ int mpc83xx_spi_setup_transfer(struct spi_device *spi, struct spi_transfer *t)
 
        regval = mpc83xx_spi_read_reg(&mpc83xx_spi->base->mode);
 
-       /* Mask out bits_per_wordgth */
-       regval &= 0xff0fffff;
+       /* mask out bits we are going to set */
+       regval &= ~(SPMODE_LEN(0xF) | SPMODE_REV);
        regval |= SPMODE_LEN(bits_per_word);
+       if (!(spi->mode & SPI_LSB_FIRST))
+               regval |= SPMODE_REV;
 
+       /* Turn off SPI unit prior changing mode */
+       mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, 0);
        mpc83xx_spi_write_reg(&mpc83xx_spi->base->mode, regval);
 
        return 0;
 }
 
 /* the spi->mode bits understood by this driver: */
-#define MODEBITS (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH)
+#define MODEBITS       (SPI_CPOL | SPI_CPHA | SPI_CS_HIGH \
+                       | SPI_LSB_FIRST | SPI_LOOP)
 
 static int mpc83xx_spi_setup(struct spi_device *spi)
 {
@@ -407,13 +434,17 @@ static int __init mpc83xx_spi_probe(struct platform_device *dev)
        mpc83xx_spi->bitbang.chipselect = mpc83xx_spi_chipselect;
        mpc83xx_spi->bitbang.setup_transfer = mpc83xx_spi_setup_transfer;
        mpc83xx_spi->bitbang.txrx_bufs = mpc83xx_spi_bufs;
-       mpc83xx_spi->sysclk = pdata->sysclk;
        mpc83xx_spi->activate_cs = pdata->activate_cs;
        mpc83xx_spi->deactivate_cs = pdata->deactivate_cs;
        mpc83xx_spi->qe_mode = pdata->qe_mode;
        mpc83xx_spi->get_rx = mpc83xx_spi_rx_buf_u8;
        mpc83xx_spi->get_tx = mpc83xx_spi_tx_buf_u8;
 
+       if (mpc83xx_spi->qe_mode)
+               mpc83xx_spi->spibrg = pdata->sysclk / 2;
+       else
+               mpc83xx_spi->spibrg = pdata->sysclk;
+
        mpc83xx_spi->rx_shift = 0;
        mpc83xx_spi->tx_shift = 0;
        if (mpc83xx_spi->qe_mode) {
index 7071ff8da63e47328fc55bab105a3e11ca27932d..5cf48123e0efbb42612d3c94e59b730b6c00ee79 100644 (file)
@@ -28,7 +28,7 @@
 #include <asm/hardware.h>
 
 #include <asm/arch/regs-gpio.h>
-#include <asm/arch/regs-spi.h>
+#include <asm/plat-s3c24xx/regs-spi.h>
 #include <asm/arch/spi.h>
 
 struct s3c24xx_spi {
index 38b60ad0eda0c605ec474c88bd5ca7f2f4113f40..c55459c592b855f04bd2aeb180d06df04ae0a4d8 100644 (file)
 static unsigned long   minors[N_SPI_MINORS / BITS_PER_LONG];
 
 
-/* Bit masks for spi_device.mode management */
-#define SPI_MODE_MASK                  (SPI_CPHA | SPI_CPOL)
-
+/* Bit masks for spi_device.mode management.  Note that incorrect
+ * settings for CS_HIGH and 3WIRE can cause *lots* of trouble for other
+ * devices on a shared bus:  CS_HIGH, because this device will be
+ * active when it shouldn't be;  3WIRE, because when active it won't
+ * behave as it should.
+ *
+ * REVISIT should changing those two modes be privileged?
+ */
+#define SPI_MODE_MASK          (SPI_CPHA | SPI_CPOL | SPI_CS_HIGH \
+                               | SPI_LSB_FIRST | SPI_3WIRE | SPI_LOOP)
 
 struct spidev_data {
        struct device           dev;
@@ -176,7 +183,9 @@ static int spidev_message(struct spidev_data *spidev,
 
                if (u_tmp->rx_buf) {
                        k_tmp->rx_buf = buf;
-                       if (!access_ok(VERIFY_WRITE, u_tmp->rx_buf, u_tmp->len))
+                       if (!access_ok(VERIFY_WRITE, (u8 __user *)
+                                               (ptrdiff_t) u_tmp->rx_buf,
+                                               u_tmp->len))
                                goto done;
                }
                if (u_tmp->tx_buf) {
index befff5f9d58c59ce1b5fc19545382ca8b9116b69..ac49b15fa76840ba74c986ee9d44c8ed7b17bf43 100644 (file)
@@ -48,6 +48,7 @@ obj-$(CONFIG_USB_SISUSBVGA)   += misc/
 obj-$(CONFIG_USB_TEST)         += misc/
 obj-$(CONFIG_USB_TRANCEVIBRATOR)+= misc/
 obj-$(CONFIG_USB_USS720)       += misc/
+obj-$(CONFIG_USB_IOWARRIOR)    += misc/
 
 obj-$(CONFIG_USB_ATM)          += atm/
 obj-$(CONFIG_USB_SPEEDTOUCH)   += atm/
index 25f63f1096b43d4d9a6da4e266e212cf09d48549..b6bd05e3d439eb41f6c87633d9bba10960d45498 100644 (file)
 #include "hcd.h"       /* for usbcore internals */
 #include "usb.h"
 
+struct api_context {
+       struct completion       done;
+       int                     status;
+};
+
 static void usb_api_blocking_completion(struct urb *urb)
 {
-       complete((struct completion *)urb->context);
+       struct api_context *ctx = urb->context;
+
+       ctx->status = urb->status;
+       complete(&ctx->done);
 }
 
 
@@ -32,20 +40,21 @@ static void usb_api_blocking_completion(struct urb *urb)
  */
 static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
 { 
-       struct completion done;
+       struct api_context ctx;
        unsigned long expire;
        int retval;
-       int status = urb->status;
 
-       init_completion(&done);         
-       urb->context = &done;
+       init_completion(&ctx.done);
+       urb->context = &ctx;
        urb->actual_length = 0;
        retval = usb_submit_urb(urb, GFP_NOIO);
        if (unlikely(retval))
                goto out;
 
        expire = timeout ? msecs_to_jiffies(timeout) : MAX_SCHEDULE_TIMEOUT;
-       if (!wait_for_completion_timeout(&done, expire)) {
+       if (!wait_for_completion_timeout(&ctx.done, expire)) {
+               usb_kill_urb(urb);
+               retval = (ctx.status == -ENOENT ? -ETIMEDOUT : ctx.status);
 
                dev_dbg(&urb->dev->dev,
                        "%s timed out on ep%d%s len=%d/%d\n",
@@ -54,11 +63,8 @@ static int usb_start_wait_urb(struct urb *urb, int timeout, int *actual_length)
                        usb_pipein(urb->pipe) ? "in" : "out",
                        urb->actual_length,
                        urb->transfer_buffer_length);
-
-               usb_kill_urb(urb);
-               retval = status == -ENOENT ? -ETIMEDOUT : status;
        } else
-               retval = status;
+               retval = ctx.status;
 out:
        if (actual_length)
                *actual_length = urb->actual_length;
@@ -411,15 +417,22 @@ int usb_sg_init (
                 * Some systems need to revert to PIO when DMA is temporarily
                 * unavailable.  For their sakes, both transfer_buffer and
                 * transfer_dma are set when possible.  However this can only
-                * work on systems without HIGHMEM, since DMA buffers located
-                * in high memory are not directly addressable by the CPU for
-                * PIO ... so when HIGHMEM is in use, transfer_buffer is NULL
+                * work on systems without:
+                *
+                *  - HIGHMEM, since DMA buffers located in high memory are
+                *    not directly addressable by the CPU for PIO;
+                *
+                *  - IOMMU, since dma_map_sg() is allowed to use an IOMMU to
+                *    make virtually discontiguous buffers be "dma-contiguous"
+                *    so that PIO and DMA need diferent numbers of URBs.
+                *
+                * So when HIGHMEM or IOMMU are in use, transfer_buffer is NULL
                 * to prevent stale pointers and to help spot bugs.
                 */
                if (dma) {
                        io->urbs [i]->transfer_dma = sg_dma_address (sg + i);
                        len = sg_dma_len (sg + i);
-#ifdef CONFIG_HIGHMEM
+#if defined(CONFIG_HIGHMEM) || defined(CONFIG_IOMMU)
                        io->urbs[i]->transfer_buffer = NULL;
 #else
                        io->urbs[i]->transfer_buffer =
index aa21b38a31cee53bca3af2cb0ca9ea8fd89ac64c..b7917c5a3c6f4182f6f085e8186790b17577f8d1 100644 (file)
 static const struct usb_device_id usb_quirk_list[] = {
        /* HP 5300/5370C scanner */
        { USB_DEVICE(0x03f0, 0x0701), .driver_info = USB_QUIRK_STRING_FETCH_255 },
+       /* Acer Peripherals Inc. (now BenQ Corp.) Prisa 640BU */
+       { USB_DEVICE(0x04a5, 0x207e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Benq S2W 3300U */
        { USB_DEVICE(0x04a5, 0x20b0), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Canon, Inc. CanoScan N1240U/LiDE30 */
+       { USB_DEVICE(0x04a9, 0x220e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Canon, Inc. CanoScan N650U/N656U */
+       { USB_DEVICE(0x04a9, 0x2206), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Canon, Inc. CanoScan 1220U */
+       { USB_DEVICE(0x04a9, 0x2207), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Canon, Inc. CanoScan N670U/N676U/LiDE 20 */
+       { USB_DEVICE(0x04a9, 0x220d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* old Cannon scanner */
+       { USB_DEVICE(0x04a9, 0x2220), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Seiko Epson Corp. Perfection 1200 */
        { USB_DEVICE(0x04b8, 0x0104), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Seiko Epson Corp. Perfection 660 */
+       { USB_DEVICE(0x04b8, 0x0114), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Epson Perfection 1260 Photo */
+       { USB_DEVICE(0x04b8, 0x011d), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Seiko Epson Corp - Perfection 1670 */
        { USB_DEVICE(0x04b8, 0x011f), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* EPSON Perfection 2480 */
+       { USB_DEVICE(0x04b8, 0x0121), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Seiko Epson Corp.*/
+       { USB_DEVICE(0x04b8, 0x0122), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Samsung ML-2510 Series printer */
        { USB_DEVICE(0x04e8, 0x327e), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Elsa MicroLink 56k (V.250) */
        { USB_DEVICE(0x05cc, 0x2267), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Ultima Electronics Corp.*/
        { USB_DEVICE(0x05d8, 0x4005), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
+       /* Agfa Snapscan1212u */
+       { USB_DEVICE(0x06bd, 0x2061), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
        /* Umax [hex] Astra 3400U */
        { USB_DEVICE(0x1606, 0x0060), .driver_info = USB_QUIRK_NO_AUTOSUSPEND },
 
index d18901b92cdaf191146156126f18b514730d47fd..c6760aee1e5c0e7e4449c1e66515e0ff7c109d63 100644 (file)
@@ -50,7 +50,7 @@ usb_descriptor_fillbuf(void *buf, unsigned buflen,
                return -EINVAL;
 
        /* fill buffer from src[] until null descriptor ptr */
-       for (; 0 != *src; src++) {
+       for (; NULL != *src; src++) {
                unsigned                len = (*src)->bLength;
 
                if (len > buflen)
index 6042364402b8fb0b4fe1551fe8b5c57b8ae190c5..3aa46cfa66bae3fdae225ad3fd4e862514903e9e 100644 (file)
@@ -71,7 +71,7 @@ ep_matches (
        u16             max;
 
        /* endpoint already claimed? */
-       if (0 != ep->driver_data)
+       if (NULL != ep->driver_data)
                return 0;
 
        /* only support ep0 for portable CONTROL traffic */
index a3376739a81b0cb839ea01f292ca34535ce68197..593e23507b1a79cff9b63fc0986d0ae088ac3d93 100644 (file)
@@ -1723,7 +1723,8 @@ rx_submit (struct eth_dev *dev, struct usb_request *req, gfp_t gfp_flags)
                size += sizeof (struct rndis_packet_msg_type);
        size -= size % dev->out_ep->maxpacket;
 
-       if ((skb = alloc_skb (size + NET_IP_ALIGN, gfp_flags)) == 0) {
+       skb = alloc_skb(size + NET_IP_ALIGN, gfp_flags);
+       if (skb == NULL) {
                DEBUG (dev, "no rx skb\n");
                goto enomem;
        }
index e60745ffaf8e382b71cab4203db168025475077b..173004f60feaca1a74b395bbb109141d9ec0d781 100644 (file)
@@ -964,7 +964,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len)
        }
        if (len > sizeof (dev->rbuf))
                req->buf = kmalloc(len, GFP_ATOMIC);
-       if (req->buf == 0) {
+       if (req->buf == NULL) {
                req->buf = dev->rbuf;
                return -ENOMEM;
        }
@@ -1394,7 +1394,7 @@ gadgetfs_setup (struct usb_gadget *gadget, const struct usb_ctrlrequest *ctrl)
        dev->setup_abort = 0;
        if (dev->state == STATE_DEV_UNCONNECTED) {
 #ifdef CONFIG_USB_GADGET_DUALSPEED
-               if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == 0) {
+               if (gadget->speed == USB_SPEED_HIGH && dev->hs_config == NULL) {
                        spin_unlock(&dev->lock);
                        ERROR (dev, "no high speed config??\n");
                        return -EINVAL;
index 700dda8a91579666cf04af70416e2dae6fb01912..4b27d12f049db022b7ca8287d5a8f816d4f4cdf0 100644 (file)
@@ -1299,7 +1299,7 @@ static int m66592_queue(struct usb_ep *_ep, struct usb_request *_req,
        req->req.actual = 0;
        req->req.status = -EINPROGRESS;
 
-       if (ep->desc == 0)      /* control */
+       if (ep->desc == NULL)   /* control */
                start_ep0(ep, req);
        else {
                if (request && !ep->busy)
index 63b9521c1322018a4c494f32c0174cb190a11181..72b4ebbf132d1ed636b2ebc60953f97b23fe99cc 100644 (file)
@@ -93,8 +93,6 @@ static const char driver_name [] = "pxa2xx_udc";
 static const char ep0name [] = "ep0";
 
 
-// #define     DISABLE_TEST_MODE
-
 #ifdef CONFIG_ARCH_IXP4XX
 
 /* cpu-specific register addresses are compiled in to this code */
@@ -113,17 +111,6 @@ static const char ep0name [] = "ep0";
 #define SIZE_STR       ""
 #endif
 
-#ifdef DISABLE_TEST_MODE
-/* (mode == 0) == no undocumented chip tweaks
- * (mode & 1)  == double buffer bulk IN
- * (mode & 2)  == double buffer bulk OUT
- * ... so mode = 3 (or 7, 15, etc) does it for both
- */
-static ushort fifo_mode = 0;
-module_param(fifo_mode, ushort, 0);
-MODULE_PARM_DESC (fifo_mode, "pxa2xx udc fifo mode");
-#endif
-
 /* ---------------------------------------------------------------------------
  *     endpoint related parts of the api to the usb controller hardware,
  *     used by gadget driver; and the inner talker-to-hardware core.
@@ -1252,23 +1239,6 @@ static void udc_enable (struct pxa2xx_udc *dev)
                UDC_RES2 = 0x00;
        }
 
-#ifdef DISABLE_TEST_MODE
-       /* "test mode" seems to have become the default in later chip
-        * revs, preventing double buffering (and invalidating docs).
-        * this EXPERIMENT enables it for bulk endpoints by tweaking
-        * undefined/reserved register bits (that other drivers clear).
-        * Belcarra code comments noted this usage.
-        */
-       if (fifo_mode & 1) {    /* IN endpoints */
-               UDC_RES1 |= USIR0_IR1|USIR0_IR6;
-               UDC_RES2 |= USIR1_IR11;
-       }
-       if (fifo_mode & 2) {    /* OUT endpoints */
-               UDC_RES1 |= USIR0_IR2|USIR0_IR7;
-               UDC_RES2 |= USIR1_IR12;
-       }
-#endif
-
        /* enable suspend/resume and reset irqs */
        udc_clear_mask_UDCCR(UDCCR_SRM | UDCCR_REM);
 
index a2e6e3fc8c8d731b516ec3880ea3a987f3098438..fcfe869acb942bb36dcb742666d285f7de0cd931 100644 (file)
@@ -653,7 +653,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags)
                        result = usb_ep_enable (ep, d);
                        if (result == 0) {
                                ep->driver_data = dev;
-                               if (source_sink_start_ep (ep, gfp_flags) != 0) {
+                               if (source_sink_start_ep(ep, gfp_flags)
+                                               != NULL) {
                                        dev->in_ep = ep;
                                        continue;
                                }
@@ -667,7 +668,8 @@ set_source_sink_config (struct zero_dev *dev, gfp_t gfp_flags)
                        result = usb_ep_enable (ep, d);
                        if (result == 0) {
                                ep->driver_data = dev;
-                               if (source_sink_start_ep (ep, gfp_flags) != 0) {
+                               if (source_sink_start_ep(ep, gfp_flags)
+                                               != NULL) {
                                        dev->out_ep = ep;
                                        continue;
                                }
index e831cb7f64fd00eb590812fae00b53298112b807..33f6ee50b8d34b5c0ca5fc83d368d8325d11e235 100644 (file)
@@ -356,7 +356,7 @@ static void cp2101_get_termios (struct usb_serial_port *port)
 
        dbg("%s - port %d", __FUNCTION__, port->number);
 
-       if ((!port->tty) || (!port->tty->termios)) {
+       if (!port->tty || !port->tty->termios) {
                dbg("%s - no tty structures", __FUNCTION__);
                return;
        }
@@ -526,50 +526,35 @@ static void cp2101_set_termios (struct usb_serial_port *port,
                return;
        }
        cflag = port->tty->termios->c_cflag;
-
-       /* Check that they really want us to change something */
-       if (old_termios) {
-               if ((cflag == old_termios->c_cflag) &&
-                               (RELEVANT_IFLAG(port->tty->termios->c_iflag)
-                               == RELEVANT_IFLAG(old_termios->c_iflag))) {
-                       dbg("%s - nothing to change...", __FUNCTION__);
-                       return;
-               }
-
-               old_cflag = old_termios->c_cflag;
-       }
+       old_cflag = old_termios->c_cflag;
+       baud = tty_get_baud_rate(port->tty);
 
        /* If the baud rate is to be updated*/
-       if ((cflag & CBAUD) != (old_cflag & CBAUD)) {
-               switch (cflag & CBAUD) {
-                       /*
-                        * The baud rates which are commented out below
-                        * appear to be supported by the device
-                        * but are non-standard
-                        */
-                       case B0:        baud = 0;       break;
-                       case B600:      baud = 600;     break;
-                       case B1200:     baud = 1200;    break;
-                       case B1800:     baud = 1800;    break;
-                       case B2400:     baud = 2400;    break;
-                       case B4800:     baud = 4800;    break;
-                       /*case B7200:   baud = 7200;    break;*/
-                       case B9600:     baud = 9600;    break;
-                       /*ase B14400:   baud = 14400;   break;*/
-                       case B19200:    baud = 19200;   break;
-                       /*case B28800:  baud = 28800;   break;*/
-                       case B38400:    baud = 38400;   break;
-                       /*case B55854:  baud = 55054;   break;*/
-                       case B57600:    baud = 57600;   break;
-                       case B115200:   baud = 115200;  break;
-                       /*case B127117: baud = 127117;  break;*/
-                       case B230400:   baud = 230400;  break;
-                       case B460800:   baud = 460800;  break;
-                       case B921600:   baud = 921600;  break;
-                       /*case B3686400:        baud = 3686400; break;*/
+       if (baud != tty_termios_baud_rate(old_termios)) {
+               switch (baud) {
+                       case 0:
+                       case 600:
+                       case 1200:
+                       case 1800:
+                       case 2400:
+                       case 4800:
+                       case 7200:
+                       case 9600:
+                       case 14400:
+                       case 19200:
+                       case 28800:
+                       case 38400:
+                       case 55854:
+                       case 57600:
+                       case 115200:
+                       case 127117:
+                       case 230400:
+                       case 460800:
+                       case 921600:
+                       case 3686400:
+                               break;
                        default:
-                               dev_err(&port->dev, "cp2101 driver does not "
-                                       "support the baudrate requested\n");
+                               baud = 9600;
                                break;
                }
 
index 976f54ec26e66e0529f10a2c6d6879953a1b7f67..dab2e66d111dbb8692fe717615965784cc110b31 100644 (file)
@@ -433,38 +433,38 @@ struct digi_port {
 
 /* Local Function Declarations */
 
-static void digi_wakeup_write( struct usb_serial_port *port );
+static void digi_wakeup_write(struct usb_serial_port *port);
 static void digi_wakeup_write_lock(struct work_struct *work);
-static int digi_write_oob_command( struct usb_serial_port *port,
-       unsigned char *buf, int count, int interruptible );
-static int digi_write_inb_command( struct usb_serial_port *port,
-       unsigned char *buf, int count, unsigned long timeout );
-static int digi_set_modem_signals( struct usb_serial_port *port,
-       unsigned int modem_signals, int interruptible );
-static int digi_transmit_idle( struct usb_serial_port *port,
-       unsigned long timeout );
+static int digi_write_oob_command(struct usb_serial_port *port,
+       unsigned char *buf, int count, int interruptible);
+static int digi_write_inb_command(struct usb_serial_port *port,
+       unsigned char *buf, int count, unsigned long timeout);
+static int digi_set_modem_signals(struct usb_serial_port *port,
+       unsigned int modem_signals, int interruptible);
+static int digi_transmit_idle(struct usb_serial_port *port,
+       unsigned long timeout);
 static void digi_rx_throttle (struct usb_serial_port *port);
 static void digi_rx_unthrottle (struct usb_serial_port *port);
-static void digi_set_termios( struct usb_serial_port *port, 
-       struct ktermios *old_termios );
-static void digi_break_ctl( struct usb_serial_port *port, int break_state );
-static int digi_ioctl( struct usb_serial_port *port, struct file *file,
-       unsigned int cmd, unsigned long arg );
-static int digi_tiocmget( struct usb_serial_port *port, struct file *file );
-static int digi_tiocmset( struct usb_serial_port *port, struct file *file,
-       unsigned int set, unsigned int clear );
-static int digi_write( struct usb_serial_port *port, const unsigned char *buf, int count );
-static void digi_write_bulk_callback( struct urb *urb );
-static int digi_write_room( struct usb_serial_port *port );
-static int digi_chars_in_buffer( struct usb_serial_port *port );
-static int digi_open( struct usb_serial_port *port, struct file *filp );
-static void digi_close( struct usb_serial_port *port, struct file *filp );
-static int digi_startup_device( struct usb_serial *serial );
-static int digi_startup( struct usb_serial *serial );
-static void digi_shutdown( struct usb_serial *serial );
-static void digi_read_bulk_callback( struct urb *urb );
-static int digi_read_inb_callback( struct urb *urb );
-static int digi_read_oob_callback( struct urb *urb );
+static void digi_set_termios(struct usb_serial_port *port,
+       struct ktermios *old_termios);
+static void digi_break_ctl(struct usb_serial_port *port, int break_state);
+static int digi_ioctl(struct usb_serial_port *port, struct file *file,
+       unsigned int cmd, unsigned long arg);
+static int digi_tiocmget(struct usb_serial_port *port, struct file *file);
+static int digi_tiocmset(struct usb_serial_port *port, struct file *file,
+       unsigned int set, unsigned int clear);
+static int digi_write(struct usb_serial_port *port, const unsigned char *buf, int count);
+static void digi_write_bulk_callback(struct urb *urb);
+static int digi_write_room(struct usb_serial_port *port);
+static int digi_chars_in_buffer(struct usb_serial_port *port);
+static int digi_open(struct usb_serial_port *port, struct file *filp);
+static void digi_close(struct usb_serial_port *port, struct file *filp);
+static int digi_startup_device(struct usb_serial *serial);
+static int digi_startup(struct usb_serial *serial);
+static void digi_shutdown(struct usb_serial *serial);
+static void digi_read_bulk_callback(struct urb *urb);
+static int digi_read_inb_callback(struct urb *urb);
+static int digi_read_oob_callback(struct urb *urb);
 
 
 /* Statics */
@@ -576,9 +576,9 @@ static struct usb_serial_driver digi_acceleport_4_device = {
 *  with the equivalent code.
 */
 
-static inline long cond_wait_interruptible_timeout_irqrestore(
+static long cond_wait_interruptible_timeout_irqrestore(
        wait_queue_head_t *q, long timeout,
-       spinlock_t *lock, unsigned long flags )
+       spinlock_t *lock, unsigned long flags)
 {
        DEFINE_WAIT(wait);
 
@@ -600,18 +600,16 @@ static inline long cond_wait_interruptible_timeout_irqrestore(
 
 static void digi_wakeup_write_lock(struct work_struct *work)
 {
-       struct digi_port *priv =
-               container_of(work, struct digi_port, dp_wakeup_work);
+       struct digi_port *priv = container_of(work, struct digi_port, dp_wakeup_work);
        struct usb_serial_port *port = priv->dp_port;
        unsigned long flags;
 
-
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
-       digi_wakeup_write( port );
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
+       digi_wakeup_write(port);
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 }
 
-static void digi_wakeup_write( struct usb_serial_port *port )
+static void digi_wakeup_write(struct usb_serial_port *port)
 {
        tty_wakeup(port->tty);
 }
@@ -628,8 +626,8 @@ static void digi_wakeup_write( struct usb_serial_port *port )
 *  returned by usb_submit_urb.
 */
 
-static int digi_write_oob_command( struct usb_serial_port *port,
-       unsigned char *buf, int count, int interruptible )
+static int digi_write_oob_command(struct usb_serial_port *port,
+       unsigned char *buf, int count, int interruptible)
 {
 
        int ret = 0;
@@ -638,49 +636,37 @@ static int digi_write_oob_command( struct usb_serial_port *port,
        struct digi_port *oob_priv = usb_get_serial_port_data(oob_port);
        unsigned long flags = 0;
 
+       dbg("digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, count);
 
-dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, count );
-
-       spin_lock_irqsave( &oob_priv->dp_port_lock, flags );
-
-       while( count > 0 ) {
-
-               while( oob_port->write_urb->status == -EINPROGRESS
-               || oob_priv->dp_write_urb_in_use ) {
+       spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
+       while(count > 0) {
+               while(oob_port->write_urb->status == -EINPROGRESS
+                       || oob_priv->dp_write_urb_in_use) {
                        cond_wait_interruptible_timeout_irqrestore(
                                &oob_port->write_wait, DIGI_RETRY_TIMEOUT,
-                               &oob_priv->dp_port_lock, flags );
-                       if( interruptible && signal_pending(current) ) {
-                               return( -EINTR );
-                       }
-                       spin_lock_irqsave( &oob_priv->dp_port_lock, flags );
+                               &oob_priv->dp_port_lock, flags);
+                       if (interruptible && signal_pending(current))
+                               return -EINTR;
+                       spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
                }
 
                /* len must be a multiple of 4, so commands are not split */
-               len = min(count, oob_port->bulk_out_size );
-               if( len > 4 )
+               len = min(count, oob_port->bulk_out_size);
+               if (len > 4)
                        len &= ~3;
-
-               memcpy( oob_port->write_urb->transfer_buffer, buf, len );
+               memcpy(oob_port->write_urb->transfer_buffer, buf, len);
                oob_port->write_urb->transfer_buffer_length = len;
                oob_port->write_urb->dev = port->serial->dev;
-
-               if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) {
+               if ((ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0) {
                        oob_priv->dp_write_urb_in_use = 1;
                        count -= len;
                        buf += len;
                }
-
-       }
-
-       spin_unlock_irqrestore( &oob_priv->dp_port_lock, flags );
-
-       if( ret ) {
-               err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__,
-                       ret );
        }
-
-       return( ret );
+       spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags);
+       if (ret)
+               err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret);
+       return ret;
 
 }
 
@@ -697,63 +683,58 @@ dbg( "digi_write_oob_command: TOP: port=%d, count=%d", oob_priv->dp_port_num, co
 *  error returned by digi_write.
 */
 
-static int digi_write_inb_command( struct usb_serial_port *port,
-       unsigned char *buf, int count, unsigned long timeout )
+static int digi_write_inb_command(struct usb_serial_port *port,
+       unsigned char *buf, int count, unsigned long timeout)
 {
-
        int ret = 0;
        int len;
        struct digi_port *priv = usb_get_serial_port_data(port);
        unsigned char *data = port->write_urb->transfer_buffer;
        unsigned long flags = 0;
 
+       dbg("digi_write_inb_command: TOP: port=%d, count=%d",
+               priv->dp_port_num, count);
 
-dbg( "digi_write_inb_command: TOP: port=%d, count=%d", priv->dp_port_num,
-count );
-
-       if( timeout )
+       if (timeout)
                timeout += jiffies;
        else
                timeout = ULONG_MAX;
 
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
-
-       while( count > 0 && ret == 0 ) {
-
-               while( (port->write_urb->status == -EINPROGRESS
-               || priv->dp_write_urb_in_use) && time_before(jiffies, timeout)) {
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
+       while(count > 0 && ret == 0) {
+               while((port->write_urb->status == -EINPROGRESS
+                       || priv->dp_write_urb_in_use) && time_before(jiffies, timeout)) {
                        cond_wait_interruptible_timeout_irqrestore(
                                &port->write_wait, DIGI_RETRY_TIMEOUT,
-                               &priv->dp_port_lock, flags );
-                       if( signal_pending(current) ) {
-                               return( -EINTR );
-                       }
-                       spin_lock_irqsave( &priv->dp_port_lock, flags );
+                               &priv->dp_port_lock, flags);
+                       if (signal_pending(current))
+                               return -EINTR;
+                       spin_lock_irqsave(&priv->dp_port_lock, flags);
                }
 
                /* len must be a multiple of 4 and small enough to */
                /* guarantee the write will send buffered data first, */
                /* so commands are in order with data and not split */
-               len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len );
-               if( len > 4 )
+               len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len);
+               if (len > 4)
                        len &= ~3;
 
                /* write any buffered data first */
-               if( priv->dp_out_buf_len > 0 ) {
+               if (priv->dp_out_buf_len > 0) {
                        data[0] = DIGI_CMD_SEND_DATA;
                        data[1] = priv->dp_out_buf_len;
-                       memcpy( data+2, priv->dp_out_buf,
-                               priv->dp_out_buf_len );
-                       memcpy( data+2+priv->dp_out_buf_len, buf, len );
+                       memcpy(data + 2, priv->dp_out_buf,
+                               priv->dp_out_buf_len);
+                       memcpy(data + 2 + priv->dp_out_buf_len, buf, len);
                        port->write_urb->transfer_buffer_length
-                               = priv->dp_out_buf_len+2+len;
+                               = priv->dp_out_buf_len + 2 + len;
                } else {
-                       memcpy( data, buf, len );
+                       memcpy(data, buf, len);
                        port->write_urb->transfer_buffer_length = len;
                }
                port->write_urb->dev = port->serial->dev;
 
-               if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
+               if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) {
                        priv->dp_write_urb_in_use = 1;
                        priv->dp_out_buf_len = 0;
                        count -= len;
@@ -761,16 +742,12 @@ count );
                }
 
        }
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-
-       if( ret ) {
-               err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__,
-               ret, priv->dp_port_num );
-       }
-
-       return( ret );
-
+       if (ret)
+               err("%s: usb_submit_urb failed, ret=%d, port=%d",
+                       __FUNCTION__, ret, priv->dp_port_num);
+       return ret;
 }
 
 
@@ -784,8 +761,8 @@ count );
 *  returned by usb_submit_urb.
 */
 
-static int digi_set_modem_signals( struct usb_serial_port *port,
-       unsigned int modem_signals, int interruptible )
+static int digi_set_modem_signals(struct usb_serial_port *port,
+       unsigned int modem_signals, int interruptible)
 {
 
        int ret;
@@ -796,60 +773,47 @@ static int digi_set_modem_signals( struct usb_serial_port *port,
        unsigned long flags = 0;
 
 
-dbg( "digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x",
-port_priv->dp_port_num, modem_signals );
+       dbg("digi_set_modem_signals: TOP: port=%d, modem_signals=0x%x",
+               port_priv->dp_port_num, modem_signals);
 
-       spin_lock_irqsave( &oob_priv->dp_port_lock, flags );
-       spin_lock( &port_priv->dp_port_lock );
+       spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
+       spin_lock(&port_priv->dp_port_lock);
 
-       while( oob_port->write_urb->status == -EINPROGRESS
-       || oob_priv->dp_write_urb_in_use ) {
-               spin_unlock( &port_priv->dp_port_lock );
+       while(oob_port->write_urb->status == -EINPROGRESS || oob_priv->dp_write_urb_in_use) {
+               spin_unlock(&port_priv->dp_port_lock);
                cond_wait_interruptible_timeout_irqrestore(
                        &oob_port->write_wait, DIGI_RETRY_TIMEOUT,
-                       &oob_priv->dp_port_lock, flags );
-               if( interruptible && signal_pending(current) ) {
-                       return( -EINTR );
-               }
-               spin_lock_irqsave( &oob_priv->dp_port_lock, flags );
-               spin_lock( &port_priv->dp_port_lock );
+                       &oob_priv->dp_port_lock, flags);
+               if (interruptible && signal_pending(current))
+                       return -EINTR;
+               spin_lock_irqsave(&oob_priv->dp_port_lock, flags);
+               spin_lock(&port_priv->dp_port_lock);
        }
-
        data[0] = DIGI_CMD_SET_DTR_SIGNAL;
        data[1] = port_priv->dp_port_num;
-       data[2] = (modem_signals&TIOCM_DTR) ?
-               DIGI_DTR_ACTIVE : DIGI_DTR_INACTIVE;
+       data[2] = (modem_signals&TIOCM_DTR) ? DIGI_DTR_ACTIVE : DIGI_DTR_INACTIVE;
        data[3] = 0;
-
        data[4] = DIGI_CMD_SET_RTS_SIGNAL;
        data[5] = port_priv->dp_port_num;
-       data[6] = (modem_signals&TIOCM_RTS) ?
-               DIGI_RTS_ACTIVE : DIGI_RTS_INACTIVE;
+       data[6] = (modem_signals&TIOCM_RTS) ? DIGI_RTS_ACTIVE : DIGI_RTS_INACTIVE;
        data[7] = 0;
 
        oob_port->write_urb->transfer_buffer_length = 8;
        oob_port->write_urb->dev = port->serial->dev;
 
-       if( (ret=usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0 ) {
+       if ((ret = usb_submit_urb(oob_port->write_urb, GFP_ATOMIC)) == 0) {
                oob_priv->dp_write_urb_in_use = 1;
                port_priv->dp_modem_signals =
                        (port_priv->dp_modem_signals&~(TIOCM_DTR|TIOCM_RTS))
                        | (modem_signals&(TIOCM_DTR|TIOCM_RTS));
        }
-
-       spin_unlock( &port_priv->dp_port_lock );
-       spin_unlock_irqrestore( &oob_priv->dp_port_lock, flags );
-
-       if( ret ) {
-               err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__,
-               ret );
-       }
-
-       return( ret );
-
+       spin_unlock(&port_priv->dp_port_lock);
+       spin_unlock_irqrestore(&oob_priv->dp_port_lock, flags);
+       if (ret)
+               err("%s: usb_submit_urb failed, ret=%d", __FUNCTION__, ret);
+       return ret;
 }
 
-
 /*
 *  Digi Transmit Idle
 *
@@ -862,203 +826,182 @@ port_priv->dp_port_num, modem_signals );
 *  port at a time, so its ok.
 */
 
-static int digi_transmit_idle( struct usb_serial_port *port,
-       unsigned long timeout )
+static int digi_transmit_idle(struct usb_serial_port *port,
+       unsigned long timeout)
 {
-
        int ret;
        unsigned char buf[2];
        struct digi_port *priv = usb_get_serial_port_data(port);
        unsigned long flags = 0;
 
-
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
        priv->dp_transmit_idle = 0;
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 
        buf[0] = DIGI_CMD_TRANSMIT_IDLE;
        buf[1] = 0;
 
        timeout += jiffies;
 
-       if( (ret=digi_write_inb_command( port, buf, 2, timeout-jiffies )) != 0 )
-               return( ret );
+       if ((ret = digi_write_inb_command(port, buf, 2, timeout - jiffies)) != 0)
+               return ret;
 
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
 
-       while( time_before(jiffies, timeout) && !priv->dp_transmit_idle ) {
+       while(time_before(jiffies, timeout) && !priv->dp_transmit_idle) {
                cond_wait_interruptible_timeout_irqrestore(
                        &priv->dp_transmit_idle_wait, DIGI_RETRY_TIMEOUT,
-                       &priv->dp_port_lock, flags );
-               if( signal_pending(current) ) {
-                       return( -EINTR );
-               }
-               spin_lock_irqsave( &priv->dp_port_lock, flags );
+                       &priv->dp_port_lock, flags);
+               if (signal_pending(current))
+                       return -EINTR;
+               spin_lock_irqsave(&priv->dp_port_lock, flags);
        }
-
        priv->dp_transmit_idle = 0;
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-
-       return( 0 );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+       return 0;
 
 }
 
 
-static void digi_rx_throttle( struct usb_serial_port *port )
+static void digi_rx_throttle(struct usb_serial_port *port)
 {
-
        unsigned long flags;
        struct digi_port *priv = usb_get_serial_port_data(port);
 
 
-dbg( "digi_rx_throttle: TOP: port=%d", priv->dp_port_num );
+       dbg("digi_rx_throttle: TOP: port=%d", priv->dp_port_num);
 
        /* stop receiving characters by not resubmitting the read urb */
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
        priv->dp_throttled = 1;
        priv->dp_throttle_restart = 0;
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 }
 
 
-static void digi_rx_unthrottle( struct usb_serial_port *port )
+static void digi_rx_unthrottle(struct usb_serial_port *port)
 {
-
        int ret = 0;
        unsigned long flags;
        struct digi_port *priv = usb_get_serial_port_data(port);
 
-dbg( "digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num );
+       dbg("digi_rx_unthrottle: TOP: port=%d", priv->dp_port_num);
 
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
 
        /* turn throttle off */
        priv->dp_throttled = 0;
        priv->dp_throttle_restart = 0;
 
        /* restart read chain */
-       if( priv->dp_throttle_restart ) {
+       if (priv->dp_throttle_restart) {
                port->read_urb->dev = port->serial->dev;
-               ret = usb_submit_urb( port->read_urb, GFP_ATOMIC );
+               ret = usb_submit_urb(port->read_urb, GFP_ATOMIC);
        }
 
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-
-       if( ret ) {
-               err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__,
-                       ret, priv->dp_port_num );
-       }
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 
+       if (ret)
+               err("%s: usb_submit_urb failed, ret=%d, port=%d",
+                       __FUNCTION__, ret, priv->dp_port_num);
 }
 
 
-static void digi_set_termios( struct usb_serial_port *port, 
-       struct ktermios *old_termios )
+static void digi_set_termios(struct usb_serial_port *port,
+                                       struct ktermios *old_termios)
 {
 
        struct digi_port *priv = usb_get_serial_port_data(port);
-       unsigned int iflag = port->tty->termios->c_iflag;
-       unsigned int cflag = port->tty->termios->c_cflag;
+       struct tty_struct *tty = port->tty;
+       unsigned int iflag = tty->termios->c_iflag;
+       unsigned int cflag = tty->termios->c_cflag;
        unsigned int old_iflag = old_termios->c_iflag;
        unsigned int old_cflag = old_termios->c_cflag;
        unsigned char buf[32];
        unsigned int modem_signals;
        int arg,ret;
        int i = 0;
+       speed_t baud;
 
-
-dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", priv->dp_port_num, iflag, old_iflag, cflag, old_cflag );
+       dbg("digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, old_cflag=0x%x", priv->dp_port_num, iflag, old_iflag, cflag, old_cflag);
 
        /* set baud rate */
-       if( (cflag&CBAUD) != (old_cflag&CBAUD) ) {
-
+       if ((baud = tty_get_baud_rate(tty)) != tty_termios_baud_rate(old_termios)) {
                arg = -1;
 
                /* reassert DTR and (maybe) RTS on transition from B0 */
-               if( (old_cflag&CBAUD) == B0 ) {
+               if ((old_cflag&CBAUD) == B0) {
                        /* don't set RTS if using hardware flow control */
                        /* and throttling input */
                        modem_signals = TIOCM_DTR;
-                       if( !(port->tty->termios->c_cflag & CRTSCTS) ||
-                       !test_bit(TTY_THROTTLED, &port->tty->flags) ) {
+                       if (!(tty->termios->c_cflag & CRTSCTS) ||
+                           !test_bit(TTY_THROTTLED, &tty->flags))
                                modem_signals |= TIOCM_RTS;
-                       }
-                       digi_set_modem_signals( port, modem_signals, 1 );
+                       digi_set_modem_signals(port, modem_signals, 1);
                }
-
-               switch( (cflag&CBAUD) ) {
+               switch (baud) {
                        /* drop DTR and RTS on transition to B0 */
-               case B0: digi_set_modem_signals( port, 0, 1 ); break;
-               case B50: arg = DIGI_BAUD_50; break;
-               case B75: arg = DIGI_BAUD_75; break;
-               case B110: arg = DIGI_BAUD_110; break;
-               case B150: arg = DIGI_BAUD_150; break;
-               case B200: arg = DIGI_BAUD_200; break;
-               case B300: arg = DIGI_BAUD_300; break;
-               case B600: arg = DIGI_BAUD_600; break;
-               case B1200: arg = DIGI_BAUD_1200; break;
-               case B1800: arg = DIGI_BAUD_1800; break;
-               case B2400: arg = DIGI_BAUD_2400; break;
-               case B4800: arg = DIGI_BAUD_4800; break;
-               case B9600: arg = DIGI_BAUD_9600; break;
-               case B19200: arg = DIGI_BAUD_19200; break;
-               case B38400: arg = DIGI_BAUD_38400; break;
-               case B57600: arg = DIGI_BAUD_57600; break;
-               case B115200: arg = DIGI_BAUD_115200; break;
-               case B230400: arg = DIGI_BAUD_230400; break;
-               case B460800: arg = DIGI_BAUD_460800; break;
-               default:
-                       dbg( "digi_set_termios: can't handle baud rate 0x%x",
-                               (cflag&CBAUD) );
-                       break;
+                       case 0: digi_set_modem_signals(port, 0, 1); break;
+                       case 50: arg = DIGI_BAUD_50; break;
+                       case 75: arg = DIGI_BAUD_75; break;
+                       case 110: arg = DIGI_BAUD_110; break;
+                       case 150: arg = DIGI_BAUD_150; break;
+                       case 200: arg = DIGI_BAUD_200; break;
+                       case 300: arg = DIGI_BAUD_300; break;
+                       case 600: arg = DIGI_BAUD_600; break;
+                       case 1200: arg = DIGI_BAUD_1200; break;
+                       case 1800: arg = DIGI_BAUD_1800; break;
+                       case 2400: arg = DIGI_BAUD_2400; break;
+                       case 4800: arg = DIGI_BAUD_4800; break;
+                       case 9600: arg = DIGI_BAUD_9600; break;
+                       case 19200: arg = DIGI_BAUD_19200; break;
+                       case 38400: arg = DIGI_BAUD_38400; break;
+                       case 57600: arg = DIGI_BAUD_57600; break;
+                       case 115200: arg = DIGI_BAUD_115200; break;
+                       case 230400: arg = DIGI_BAUD_230400; break;
+                       case 460800: arg = DIGI_BAUD_460800; break;
+                       default:
+                               arg = DIGI_BAUD_9600;
+                               baud = 9600;
+                               break;
                }
-
-               if( arg != -1 ) {
+               if (arg != -1) {
                        buf[i++] = DIGI_CMD_SET_BAUD_RATE;
                        buf[i++] = priv->dp_port_num;
                        buf[i++] = arg;
                        buf[i++] = 0;
                }
-
        }
-
        /* set parity */
-       if( (cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD)) ) {
-
-               if( (cflag&PARENB) ) {
-                       if( (cflag&PARODD) )
+       if ((cflag&(PARENB|PARODD)) != (old_cflag&(PARENB|PARODD))) {
+               if (cflag&PARENB) {
+                       if (cflag&PARODD)
                                arg = DIGI_PARITY_ODD;
                        else
                                arg = DIGI_PARITY_EVEN;
                } else {
                        arg = DIGI_PARITY_NONE;
                }
-
                buf[i++] = DIGI_CMD_SET_PARITY;
                buf[i++] = priv->dp_port_num;
                buf[i++] = arg;
                buf[i++] = 0;
-
        }
-
        /* set word size */
-       if( (cflag&CSIZE) != (old_cflag&CSIZE) ) {
-
+       if ((cflag&CSIZE) != (old_cflag&CSIZE)) {
                arg = -1;
-
-               switch( (cflag&CSIZE) ) {
+               switch (cflag&CSIZE) {
                case CS5: arg = DIGI_WORD_SIZE_5; break;
                case CS6: arg = DIGI_WORD_SIZE_6; break;
                case CS7: arg = DIGI_WORD_SIZE_7; break;
                case CS8: arg = DIGI_WORD_SIZE_8; break;
                default:
-                       dbg( "digi_set_termios: can't handle word size %d",
-                               (cflag&CSIZE) );
+                       dbg("digi_set_termios: can't handle word size %d",
+                               (cflag&CSIZE));
                        break;
                }
 
-               if( arg != -1 ) {
+               if (arg != -1) {
                        buf[i++] = DIGI_CMD_SET_WORD_SIZE;
                        buf[i++] = priv->dp_port_num;
                        buf[i++] = arg;
@@ -1068,9 +1011,9 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol
        }
 
        /* set stop bits */
-       if( (cflag&CSTOPB) != (old_cflag&CSTOPB) ) {
+       if ((cflag&CSTOPB) != (old_cflag&CSTOPB)) {
 
-               if( (cflag&CSTOPB) )
+               if ((cflag&CSTOPB))
                        arg = DIGI_STOP_BITS_2;
                else
                        arg = DIGI_STOP_BITS_1;
@@ -1083,18 +1026,15 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol
        }
 
        /* set input flow control */
-       if( (iflag&IXOFF) != (old_iflag&IXOFF)
-       || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) {
-
+       if ((iflag&IXOFF) != (old_iflag&IXOFF)
+           || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) {
                arg = 0;
-
-               if( (iflag&IXOFF) )
+               if (iflag&IXOFF)
                        arg |= DIGI_INPUT_FLOW_CONTROL_XON_XOFF;
                else
                        arg &= ~DIGI_INPUT_FLOW_CONTROL_XON_XOFF;
 
-               if( (cflag&CRTSCTS) ) {
-
+               if (cflag&CRTSCTS) {
                        arg |= DIGI_INPUT_FLOW_CONTROL_RTS;
 
                        /* On USB-4 it is necessary to assert RTS prior */
@@ -1107,43 +1047,37 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol
                } else {
                        arg &= ~DIGI_INPUT_FLOW_CONTROL_RTS;
                }
-
                buf[i++] = DIGI_CMD_SET_INPUT_FLOW_CONTROL;
                buf[i++] = priv->dp_port_num;
                buf[i++] = arg;
                buf[i++] = 0;
-
        }
 
        /* set output flow control */
-       if( (iflag&IXON) != (old_iflag&IXON)
-       || (cflag&CRTSCTS) != (old_cflag&CRTSCTS) ) {
-
+       if ((iflag&IXON) != (old_iflag&IXON)
+           || (cflag&CRTSCTS) != (old_cflag&CRTSCTS)) {
                arg = 0;
-
-               if( (iflag&IXON) )
+               if (iflag&IXON)
                        arg |= DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF;
                else
                        arg &= ~DIGI_OUTPUT_FLOW_CONTROL_XON_XOFF;
 
-               if( (cflag&CRTSCTS) ) {
+               if (cflag&CRTSCTS) {
                        arg |= DIGI_OUTPUT_FLOW_CONTROL_CTS;
                } else {
                        arg &= ~DIGI_OUTPUT_FLOW_CONTROL_CTS;
-                       port->tty->hw_stopped = 0;
+                       tty->hw_stopped = 0;
                }
 
                buf[i++] = DIGI_CMD_SET_OUTPUT_FLOW_CONTROL;
                buf[i++] = priv->dp_port_num;
                buf[i++] = arg;
                buf[i++] = 0;
-
        }
 
        /* set receive enable/disable */
-       if( (cflag&CREAD) != (old_cflag&CREAD) ) {
-
-               if( (cflag&CREAD) )
+       if ((cflag&CREAD) != (old_cflag&CREAD)) {
+               if (cflag&CREAD)
                        arg = DIGI_ENABLE;
                else
                        arg = DIGI_DISABLE;
@@ -1152,32 +1086,26 @@ dbg( "digi_set_termios: TOP: port=%d, iflag=0x%x, old_iflag=0x%x, cflag=0x%x, ol
                buf[i++] = priv->dp_port_num;
                buf[i++] = arg;
                buf[i++] = 0;
-
        }
-
-       if( (ret=digi_write_oob_command( port, buf, i, 1 )) != 0 )
-               dbg( "digi_set_termios: write oob failed, ret=%d", ret );
+       if ((ret = digi_write_oob_command(port, buf, i, 1)) != 0)
+               dbg("digi_set_termios: write oob failed, ret=%d", ret);
 
 }
 
 
-static void digi_break_ctl( struct usb_serial_port *port, int break_state )
+static void digi_break_ctl(struct usb_serial_port *port, int break_state)
 {
-
        unsigned char buf[4];
 
-
        buf[0] = DIGI_CMD_BREAK_CONTROL;
        buf[1] = 2;                             /* length */
        buf[2] = break_state ? 1 : 0;
        buf[3] = 0;                             /* pad */
-
-       digi_write_inb_command( port, buf, 4, 0 );
-
+       digi_write_inb_command(port, buf, 4, 0);
 }
 
 
-static int digi_tiocmget( struct usb_serial_port *port, struct file *file )
+static int digi_tiocmget(struct usb_serial_port *port, struct file *file)
 {
        struct digi_port *priv = usb_get_serial_port_data(port);
        unsigned int val;
@@ -1185,15 +1113,15 @@ static int digi_tiocmget( struct usb_serial_port *port, struct file *file )
 
        dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num);
 
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
        val = priv->dp_modem_signals;
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
        return val;
 }
 
 
-static int digi_tiocmset( struct usb_serial_port *port, struct file *file,
-       unsigned int set, unsigned int clear )
+static int digi_tiocmset(struct usb_serial_port *port, struct file *file,
+       unsigned int set, unsigned int clear)
 {
        struct digi_port *priv = usb_get_serial_port_data(port);
        unsigned int val;
@@ -1201,41 +1129,34 @@ static int digi_tiocmset( struct usb_serial_port *port, struct file *file,
 
        dbg("%s: TOP: port=%d", __FUNCTION__, priv->dp_port_num);
 
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
        val = (priv->dp_modem_signals & ~clear) | set;
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-       return digi_set_modem_signals( port, val, 1 );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+       return digi_set_modem_signals(port, val, 1);
 }
 
 
-static int digi_ioctl( struct usb_serial_port *port, struct file *file,
-       unsigned int cmd, unsigned long arg )
+static int digi_ioctl(struct usb_serial_port *port, struct file *file,
+       unsigned int cmd, unsigned long arg)
 {
-
        struct digi_port *priv = usb_get_serial_port_data(port);
-
-dbg( "digi_ioctl: TOP: port=%d, cmd=0x%x", priv->dp_port_num, cmd );
+       dbg("digi_ioctl: TOP: port=%d, cmd=0x%x", priv->dp_port_num, cmd);
 
        switch (cmd) {
-
        case TIOCMIWAIT:
                /* wait for any of the 4 modem inputs (DCD,RI,DSR,CTS)*/
                /* TODO */
-               return( 0 );
-
+               return 0;
        case TIOCGICOUNT:
                /* return count of modemline transitions */
                /* TODO */
                return 0;
-
        }
-
-       return( -ENOIOCTLCMD );
+       return -ENOIOCTLCMD;
 
 }
 
-
-static int digi_write( struct usb_serial_port *port, const unsigned char *buf, int count )
+static int digi_write(struct usb_serial_port *port, const unsigned char *buf, int count)
 {
 
        int ret,data_len,new_len;
@@ -1243,35 +1164,29 @@ static int digi_write( struct usb_serial_port *port, const unsigned char *buf, i
        unsigned char *data = port->write_urb->transfer_buffer;
        unsigned long flags = 0;
 
-
-dbg( "digi_write: TOP: port=%d, count=%d, in_interrupt=%ld",
-priv->dp_port_num, count, in_interrupt() );
+       dbg("digi_write: TOP: port=%d, count=%d, in_interrupt=%ld",
+               priv->dp_port_num, count, in_interrupt());
 
        /* copy user data (which can sleep) before getting spin lock */
-       count = min( count, port->bulk_out_size-2 );
-       count = min( 64, count);
+       count = min(count, port->bulk_out_size-2);
+       count = min(64, count);
 
        /* be sure only one write proceeds at a time */
        /* there are races on the port private buffer */
        /* and races to check write_urb->status */
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
 
        /* wait for urb status clear to submit another urb */
-       if( port->write_urb->status == -EINPROGRESS
-       || priv->dp_write_urb_in_use ) {
-
+       if (port->write_urb->status == -EINPROGRESS || priv->dp_write_urb_in_use) {
                /* buffer data if count is 1 (probably put_char) if possible */
-               if( count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE ) {
+               if (count == 1 && priv->dp_out_buf_len < DIGI_OUT_BUF_SIZE) {
                        priv->dp_out_buf[priv->dp_out_buf_len++] = *buf;
                        new_len = 1;
                } else {
                        new_len = 0;
                }
-
-               spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-
-               return( new_len );
-
+               spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+               return new_len;
        }
 
        /* allow space for any buffered data and for new data, up to */
@@ -1279,9 +1194,9 @@ priv->dp_port_num, count, in_interrupt() );
        new_len = min(count, port->bulk_out_size-2-priv->dp_out_buf_len);
        data_len = new_len + priv->dp_out_buf_len;
 
-       if( data_len == 0 ) {
-               spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-               return( 0 );
+       if (data_len == 0) {
+               spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+               return 0;
        }
 
        port->write_urb->transfer_buffer_length = data_len+2;
@@ -1291,32 +1206,29 @@ priv->dp_port_num, count, in_interrupt() );
        *data++ = data_len;
 
        /* copy in buffered data first */
-       memcpy( data, priv->dp_out_buf, priv->dp_out_buf_len );
+       memcpy(data, priv->dp_out_buf, priv->dp_out_buf_len);
        data += priv->dp_out_buf_len;
 
        /* copy in new data */
-       memcpy( data, buf, new_len );
+       memcpy(data, buf, new_len);
 
-       if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
+       if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) {
                priv->dp_write_urb_in_use = 1;
                ret = new_len;
                priv->dp_out_buf_len = 0;
        }
 
        /* return length of new data written, or error */
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-       if( ret < 0 ) {
-               err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__,
-                       ret, priv->dp_port_num );
-       }
-
-dbg( "digi_write: returning %d", ret );
-       return( ret );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+       if (ret < 0)
+               err("%s: usb_submit_urb failed, ret=%d, port=%d",
+                       __FUNCTION__, ret, priv->dp_port_num);
+       dbg("digi_write: returning %d", ret);
+       return ret;
 
 } 
 
-
-static void digi_write_bulk_callback( struct urb *urb )
+static void digi_write_bulk_callback(struct urb *urb)
 {
 
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
@@ -1326,153 +1238,136 @@ static void digi_write_bulk_callback( struct urb *urb )
        int ret = 0;
        int status = urb->status;
 
-
-       dbg("digi_write_bulk_callback: TOP, urb status=%d", status);
+       dbg("digi_write_bulk_callback: TOP, urb->status=%d", status);
 
        /* port and serial sanity check */
-       if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) {
+       if (port == NULL || (priv=usb_get_serial_port_data(port)) == NULL) {
                err("%s: port or port->private is NULL, status=%d",
                    __FUNCTION__, status);
                return;
        }
        serial = port->serial;
-       if( serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL ) {
+       if (serial == NULL || (serial_priv=usb_get_serial_data(serial)) == NULL) {
                err("%s: serial or serial->private is NULL, status=%d",
                    __FUNCTION__, status);
                return;
        }
 
        /* handle oob callback */
-       if( priv->dp_port_num == serial_priv->ds_oob_port_num ) {
-               dbg( "digi_write_bulk_callback: oob callback" );
-               spin_lock( &priv->dp_port_lock );
+       if (priv->dp_port_num == serial_priv->ds_oob_port_num) {
+               dbg("digi_write_bulk_callback: oob callback");
+               spin_lock(&priv->dp_port_lock);
                priv->dp_write_urb_in_use = 0;
-               wake_up_interruptible( &port->write_wait );
-               spin_unlock( &priv->dp_port_lock );
+               wake_up_interruptible(&port->write_wait);
+               spin_unlock(&priv->dp_port_lock);
                return;
        }
 
        /* try to send any buffered data on this port, if it is open */
-       spin_lock( &priv->dp_port_lock );
+       spin_lock(&priv->dp_port_lock);
        priv->dp_write_urb_in_use = 0;
-       if( port->open_count && port->write_urb->status != -EINPROGRESS
-       && priv->dp_out_buf_len > 0 ) {
-
+       if (port->open_count && port->write_urb->status != -EINPROGRESS
+           && priv->dp_out_buf_len > 0) {
                *((unsigned char *)(port->write_urb->transfer_buffer))
                        = (unsigned char)DIGI_CMD_SEND_DATA;
                *((unsigned char *)(port->write_urb->transfer_buffer)+1)
                        = (unsigned char)priv->dp_out_buf_len;
-
-               port->write_urb->transfer_buffer_length
-                       = priv->dp_out_buf_len+2;
+               port->write_urb->transfer_buffer_length = priv->dp_out_buf_len+2;
                port->write_urb->dev = serial->dev;
-
-               memcpy( port->write_urb->transfer_buffer+2, priv->dp_out_buf,
-                       priv->dp_out_buf_len );
-
-               if( (ret=usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0 ) {
+               memcpy(port->write_urb->transfer_buffer+2, priv->dp_out_buf,
+                       priv->dp_out_buf_len);
+               if ((ret = usb_submit_urb(port->write_urb, GFP_ATOMIC)) == 0) {
                        priv->dp_write_urb_in_use = 1;
                        priv->dp_out_buf_len = 0;
                }
-
        }
-
        /* wake up processes sleeping on writes immediately */
-       digi_wakeup_write( port );
-
+       digi_wakeup_write(port);
        /* also queue up a wakeup at scheduler time, in case we */
        /* lost the race in write_chan(). */
        schedule_work(&priv->dp_wakeup_work);
 
-       spin_unlock( &priv->dp_port_lock );
-
-       if( ret ) {
-               err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__,
-                       ret, priv->dp_port_num );
-       }
-
+       spin_unlock(&priv->dp_port_lock);
+       if (ret)
+               err("%s: usb_submit_urb failed, ret=%d, port=%d",
+                       __FUNCTION__, ret, priv->dp_port_num);
 }
 
-
-static int digi_write_room( struct usb_serial_port *port )
+static int digi_write_room(struct usb_serial_port *port)
 {
 
        int room;
        struct digi_port *priv = usb_get_serial_port_data(port);
        unsigned long flags = 0;
 
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
 
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
-
-       if( port->write_urb->status == -EINPROGRESS
-       || priv->dp_write_urb_in_use )
+       if (port->write_urb->status == -EINPROGRESS || priv->dp_write_urb_in_use)
                room = 0;
        else
                room = port->bulk_out_size - 2 - priv->dp_out_buf_len;
 
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-
-dbg( "digi_write_room: port=%d, room=%d", priv->dp_port_num, room );
-       return( room );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+       dbg("digi_write_room: port=%d, room=%d", priv->dp_port_num, room);
+       return room;
 
 }
 
-
-static int digi_chars_in_buffer( struct usb_serial_port *port )
+static int digi_chars_in_buffer(struct usb_serial_port *port)
 {
 
        struct digi_port *priv = usb_get_serial_port_data(port);
 
 
-       if( port->write_urb->status == -EINPROGRESS
-       || priv->dp_write_urb_in_use ) {
-dbg( "digi_chars_in_buffer: port=%d, chars=%d", priv->dp_port_num, port->bulk_out_size - 2 );
-               /* return( port->bulk_out_size - 2 ); */
-               return( 256 );
+       if (port->write_urb->status == -EINPROGRESS
+           || priv->dp_write_urb_in_use) {
+               dbg("digi_chars_in_buffer: port=%d, chars=%d",
+                       priv->dp_port_num, port->bulk_out_size - 2);
+               /* return(port->bulk_out_size - 2); */
+               return 256;
        } else {
-dbg( "digi_chars_in_buffer: port=%d, chars=%d", priv->dp_port_num, priv->dp_out_buf_len );
-               return( priv->dp_out_buf_len );
+               dbg("digi_chars_in_buffer: port=%d, chars=%d",
+                       priv->dp_port_num, priv->dp_out_buf_len);
+               return priv->dp_out_buf_len;
        }
 
 }
 
 
-static int digi_open( struct usb_serial_port *port, struct file *filp )
+static int digi_open(struct usb_serial_port *port, struct file *filp)
 {
-
        int ret;
        unsigned char buf[32];
        struct digi_port *priv = usb_get_serial_port_data(port);
        struct ktermios not_termios;
        unsigned long flags = 0;
 
-
-dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count );
+       dbg("digi_open: TOP: port=%d, open_count=%d",
+               priv->dp_port_num, port->open_count);
 
        /* be sure the device is started up */
-       if( digi_startup_device( port->serial ) != 0 )
-               return( -ENXIO );
+       if (digi_startup_device(port->serial) != 0)
+               return -ENXIO;
 
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
 
        /* don't wait on a close in progress for non-blocking opens */
-       if( priv->dp_in_close && (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) {
-               spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-               return( -EAGAIN );
+       if (priv->dp_in_close && (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) {
+               spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+               return -EAGAIN;
        }
 
        /* wait for a close in progress to finish */
-       while( priv->dp_in_close ) {
+       while(priv->dp_in_close) {
                cond_wait_interruptible_timeout_irqrestore(
                        &priv->dp_close_wait, DIGI_RETRY_TIMEOUT,
-                       &priv->dp_port_lock, flags );
-               if( signal_pending(current) ) {
-                       return( -EINTR );
-               }
-               spin_lock_irqsave( &priv->dp_port_lock, flags );
+                       &priv->dp_port_lock, flags);
+               if (signal_pending(current))
+                       return -EINTR;
+               spin_lock_irqsave(&priv->dp_port_lock, flags);
        }
 
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
  
        /* read modem signals automatically whenever they change */
        buf[0] = DIGI_CMD_READ_INPUT_SIGNALS;
@@ -1486,23 +1381,22 @@ dbg( "digi_open: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_cou
        buf[6] = DIGI_FLUSH_TX | DIGI_FLUSH_RX;
        buf[7] = 0;
 
-       if( (ret=digi_write_oob_command( port, buf, 8, 1 )) != 0 )
-               dbg( "digi_open: write oob failed, ret=%d", ret );
+       if ((ret = digi_write_oob_command(port, buf, 8, 1)) != 0)
+               dbg("digi_open: write oob failed, ret=%d", ret);
 
        /* set termios settings */
        not_termios.c_cflag = ~port->tty->termios->c_cflag;
        not_termios.c_iflag = ~port->tty->termios->c_iflag;
-       digi_set_termios( port, &not_termios );
+       digi_set_termios(port, &not_termios);
 
        /* set DTR and RTS */
-       digi_set_modem_signals( port, TIOCM_DTR|TIOCM_RTS, 1 );
-
-       return( 0 );
+       digi_set_modem_signals(port, TIOCM_DTR|TIOCM_RTS, 1);
 
+       return 0;
 }
 
 
-static void digi_close( struct usb_serial_port *port, struct file *filp )
+static void digi_close(struct usb_serial_port *port, struct file *filp)
 {
        DEFINE_WAIT(wait);
        int ret;
@@ -1511,40 +1405,37 @@ static void digi_close( struct usb_serial_port *port, struct file *filp )
        struct digi_port *priv = usb_get_serial_port_data(port);
        unsigned long flags = 0;
 
-
-dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_count );
-
+       dbg("digi_close: TOP: port=%d, open_count=%d",
+               priv->dp_port_num, port->open_count);
 
        /* if disconnected, just clear flags */
        if (!usb_get_intfdata(port->serial->interface))
                goto exit;
 
        /* do cleanup only after final close on this port */
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
        priv->dp_in_close = 1;
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
 
        /* tell line discipline to process only XON/XOFF */
        tty->closing = 1;
 
        /* wait for output to drain */
-       if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) {
-               tty_wait_until_sent( tty, DIGI_CLOSE_TIMEOUT );
-       }
+       if ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0)
+               tty_wait_until_sent(tty, DIGI_CLOSE_TIMEOUT);
 
        /* flush driver and line discipline buffers */
-       if( tty->driver->flush_buffer )
-               tty->driver->flush_buffer( tty );
+       if (tty->driver->flush_buffer)
+               tty->driver->flush_buffer(tty);
        tty_ldisc_flush(tty);
 
        if (port->serial->dev) {
                /* wait for transmit idle */
-               if( (filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0 ) {
-                       digi_transmit_idle( port, DIGI_CLOSE_TIMEOUT );
+               if ((filp->f_flags&(O_NDELAY|O_NONBLOCK)) == 0) {
+                       digi_transmit_idle(port, DIGI_CLOSE_TIMEOUT);
                }
-
                /* drop DTR and RTS */
-               digi_set_modem_signals( port, 0, 0 );
+               digi_set_modem_signals(port, 0, 0);
 
                /* disable input flow control */
                buf[0] = DIGI_CMD_SET_INPUT_FLOW_CONTROL;
@@ -1576,8 +1467,8 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
                buf[18] = DIGI_FLUSH_TX | DIGI_FLUSH_RX;
                buf[19] = 0;
 
-               if( (ret=digi_write_oob_command( port, buf, 20, 0 )) != 0 )
-                       dbg( "digi_close: write oob failed, ret=%d", ret );
+               if ((ret = digi_write_oob_command(port, buf, 20, 0)) != 0)
+                       dbg("digi_close: write oob failed, ret=%d", ret);
 
                /* wait for final commands on oob port to complete */
                prepare_to_wait(&priv->dp_flush_wait, &wait, TASK_INTERRUPTIBLE);
@@ -1587,17 +1478,14 @@ dbg( "digi_close: TOP: port=%d, open_count=%d", priv->dp_port_num, port->open_co
                /* shutdown any outstanding bulk writes */
                usb_kill_urb(port->write_urb);
        }
-
        tty->closing = 0;
-
 exit:
-       spin_lock_irqsave( &priv->dp_port_lock, flags );
+       spin_lock_irqsave(&priv->dp_port_lock, flags);
        priv->dp_write_urb_in_use = 0;
        priv->dp_in_close = 0;
-       wake_up_interruptible( &priv->dp_close_wait );
-       spin_unlock_irqrestore( &priv->dp_port_lock, flags );
-
-dbg( "digi_close: done" );
+       wake_up_interruptible(&priv->dp_close_wait);
+       spin_unlock_irqrestore(&priv->dp_port_lock, flags);
+       dbg("digi_close: done");
 }
 
 
@@ -1608,155 +1496,136 @@ dbg( "digi_close: done" );
 *  urbs initialized.  Returns 0 if successful, non-zero error otherwise.
 */
 
-static int digi_startup_device( struct usb_serial *serial )
+static int digi_startup_device(struct usb_serial *serial)
 {
-
        int i,ret = 0;
        struct digi_serial *serial_priv = usb_get_serial_data(serial);
        struct usb_serial_port *port;
 
-
        /* be sure this happens exactly once */
-       spin_lock( &serial_priv->ds_serial_lock );
-       if( serial_priv->ds_device_started ) {
-               spin_unlock( &serial_priv->ds_serial_lock );
-               return( 0 );
+       spin_lock(&serial_priv->ds_serial_lock);
+       if (serial_priv->ds_device_started) {
+               spin_unlock(&serial_priv->ds_serial_lock);
+               return 0;
        }
        serial_priv->ds_device_started = 1;
-       spin_unlock( &serial_priv->ds_serial_lock );
+       spin_unlock(&serial_priv->ds_serial_lock);
 
        /* start reading from each bulk in endpoint for the device */
        /* set USB_DISABLE_SPD flag for write bulk urbs */
-       for( i=0; i<serial->type->num_ports+1; i++ ) {
-
+       for (i = 0; i < serial->type->num_ports + 1; i++) {
                port = serial->port[i];
-
                port->write_urb->dev = port->serial->dev;
-
-               if( (ret=usb_submit_urb(port->read_urb, GFP_KERNEL)) != 0 ) {
-                       err("%s: usb_submit_urb failed, ret=%d, port=%d", __FUNCTION__,
-                       ret, i );
+               if ((ret = usb_submit_urb(port->read_urb, GFP_KERNEL)) != 0) {
+                       err("%s: usb_submit_urb failed, ret=%d, port=%d",
+                                       __FUNCTION__, ret, i);
                        break;
                }
-
        }
-
-       return( ret );
-
+       return ret;
 }
 
 
-static int digi_startup( struct usb_serial *serial )
+static int digi_startup(struct usb_serial *serial)
 {
 
        int i;
        struct digi_port *priv;
        struct digi_serial *serial_priv;
 
-
-dbg( "digi_startup: TOP" );
+       dbg("digi_startup: TOP");
 
        /* allocate the private data structures for all ports */
        /* number of regular ports + 1 for the out-of-band port */
-       for( i=0; i<serial->type->num_ports+1; i++ ) {
-
+       for(i = 0; i < serial->type->num_ports + 1; i++) {
                /* allocate port private structure */
-               priv = kmalloc( sizeof(struct digi_port),
-                       GFP_KERNEL );
-               if( priv == (struct digi_port *)0 ) {
-                       while( --i >= 0 )
-                               kfree( usb_get_serial_port_data(serial->port[i]) );
-                       return( 1 );                    /* error */
+               priv = kmalloc(sizeof(struct digi_port), GFP_KERNEL);
+               if (priv == NULL) {
+                       while (--i >= 0)
+                               kfree(usb_get_serial_port_data(serial->port[i]));
+                       return 1;                       /* error */
                }
 
                /* initialize port private structure */
-               spin_lock_init( &priv->dp_port_lock );
+               spin_lock_init(&priv->dp_port_lock);
                priv->dp_port_num = i;
                priv->dp_out_buf_len = 0;
                priv->dp_write_urb_in_use = 0;
                priv->dp_modem_signals = 0;
-               init_waitqueue_head( &priv->dp_modem_change_wait );
+               init_waitqueue_head(&priv->dp_modem_change_wait);
                priv->dp_transmit_idle = 0;
-               init_waitqueue_head( &priv->dp_transmit_idle_wait );
+               init_waitqueue_head(&priv->dp_transmit_idle_wait);
                priv->dp_throttled = 0;
                priv->dp_throttle_restart = 0;
-               init_waitqueue_head( &priv->dp_flush_wait );
+               init_waitqueue_head(&priv->dp_flush_wait);
                priv->dp_in_close = 0;
-               init_waitqueue_head( &priv->dp_close_wait );
+               init_waitqueue_head(&priv->dp_close_wait);
                INIT_WORK(&priv->dp_wakeup_work, digi_wakeup_write_lock);
                priv->dp_port = serial->port[i];
-
                /* initialize write wait queue for this port */
-               init_waitqueue_head( &serial->port[i]->write_wait );
+               init_waitqueue_head(&serial->port[i]->write_wait);
 
                usb_set_serial_port_data(serial->port[i], priv);
        }
 
        /* allocate serial private structure */
-       serial_priv = kmalloc( sizeof(struct digi_serial),
-               GFP_KERNEL );
-       if( serial_priv == (struct digi_serial *)0 ) {
-               for( i=0; i<serial->type->num_ports+1; i++ )
-                       kfree( usb_get_serial_port_data(serial->port[i]) );
-               return( 1 );                    /* error */
+       serial_priv = kmalloc(sizeof(struct digi_serial), GFP_KERNEL);
+       if (serial_priv == NULL) {
+               for (i = 0; i < serial->type->num_ports + 1; i++)
+                       kfree(usb_get_serial_port_data(serial->port[i]));
+               return 1;                       /* error */
        }
 
        /* initialize serial private structure */
-       spin_lock_init( &serial_priv->ds_serial_lock );
+       spin_lock_init(&serial_priv->ds_serial_lock);
        serial_priv->ds_oob_port_num = serial->type->num_ports;
        serial_priv->ds_oob_port = serial->port[serial_priv->ds_oob_port_num];
        serial_priv->ds_device_started = 0;
        usb_set_serial_data(serial, serial_priv);
 
-       return( 0 );
-
+       return 0;
 }
 
 
-static void digi_shutdown( struct usb_serial *serial )
+static void digi_shutdown(struct usb_serial *serial)
 {
-
        int i;
-
-
-dbg( "digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt() );
+       dbg("digi_shutdown: TOP, in_interrupt()=%ld", in_interrupt());
 
        /* stop reads and writes on all ports */
-       for( i=0; i<serial->type->num_ports+1; i++ ) {
+       for (i = 0; i < serial->type->num_ports + 1; i++) {
                usb_kill_urb(serial->port[i]->read_urb);
                usb_kill_urb(serial->port[i]->write_urb);
        }
 
        /* free the private data structures for all ports */
        /* number of regular ports + 1 for the out-of-band port */
-       for( i=0; i<serial->type->num_ports+1; i++ )
-               kfree( usb_get_serial_port_data(serial->port[i]) );
-       kfree( usb_get_serial_data(serial) );
+       for(i = 0; i < serial->type->num_ports + 1; i++)
+               kfree(usb_get_serial_port_data(serial->port[i]));
+       kfree(usb_get_serial_data(serial));
 }
 
 
-static void digi_read_bulk_callback( struct urb *urb )
+static void digi_read_bulk_callback(struct urb *urb)
 {
-
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
        struct digi_port *priv;
        struct digi_serial *serial_priv;
        int ret;
        int status = urb->status;
 
-
-dbg( "digi_read_bulk_callback: TOP" );
+       dbg("digi_read_bulk_callback: TOP");
 
        /* port sanity check, do not resubmit if port is not valid */
-       if( port == NULL || (priv=usb_get_serial_port_data(port)) == NULL ) {
+       if (port == NULL || (priv = usb_get_serial_port_data(port)) == NULL) {
                err("%s: port or port->private is NULL, status=%d",
                    __FUNCTION__, status);
                return;
        }
-       if( port->serial == NULL
-       || (serial_priv=usb_get_serial_data(port->serial)) == NULL ) {
+       if (port->serial == NULL ||
+               (serial_priv=usb_get_serial_data(port->serial)) == NULL) {
                err("%s: serial is bad or serial->private is NULL, status=%d",
-                   __FUNCTION__, status);
+                       __FUNCTION__, status);
                return;
        }
 
@@ -1768,24 +1637,23 @@ dbg( "digi_read_bulk_callback: TOP" );
        }
 
        /* handle oob or inb callback, do not resubmit if error */
-       if( priv->dp_port_num == serial_priv->ds_oob_port_num ) {
-               if( digi_read_oob_callback( urb ) != 0 )
+       if (priv->dp_port_num == serial_priv->ds_oob_port_num) {
+               if (digi_read_oob_callback(urb) != 0)
                        return;
        } else {
-               if( digi_read_inb_callback( urb ) != 0 )
+               if (digi_read_inb_callback(urb) != 0)
                        return;
        }
 
        /* continue read */
        urb->dev = port->serial->dev;
-       if( (ret=usb_submit_urb(urb, GFP_ATOMIC)) != 0 ) {
-               err("%s: failed resubmitting urb, ret=%d, port=%d", __FUNCTION__,
-                       ret, priv->dp_port_num );
+       if ((ret = usb_submit_urb(urb, GFP_ATOMIC)) != 0) {
+               err("%s: failed resubmitting urb, ret=%d, port=%d",
+                   __FUNCTION__, ret, priv->dp_port_num);
        }
 
 }
 
-
 /* 
 *  Digi Read INB Callback
 *
@@ -1796,7 +1664,7 @@ dbg( "digi_read_bulk_callback: TOP" );
 *  throttled, and -1 if the sanity checks failed.
 */
 
-static int digi_read_inb_callback( struct urb *urb )
+static int digi_read_inb_callback(struct urb *urb)
 {
 
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
@@ -1812,72 +1680,67 @@ static int digi_read_inb_callback( struct urb *urb )
 
        /* do not process callbacks on closed ports */
        /* but do continue the read chain */
-       if( port->open_count == 0 )
-               return( 0 );
+       if (port->open_count == 0)
+               return 0;
 
        /* short/multiple packet check */
-       if( urb->actual_length != len + 2 ) {
-               err("%s: INCOMPLETE OR MULTIPLE PACKET, urb status=%d, "
+       if (urb->actual_length != len + 2) {
+               err("%s: INCOMPLETE OR MULTIPLE PACKET, urb->status=%d, "
                    "port=%d, opcode=%d, len=%d, actual_length=%d, "
-                   "port_status=%d", __FUNCTION__, status, priv->dp_port_num,
+                   "status=%d", __FUNCTION__, status, priv->dp_port_num,
                    opcode, len, urb->actual_length, port_status);
-               return( -1 );
+               return -1;
        }
 
-       spin_lock( &priv->dp_port_lock );
+       spin_lock(&priv->dp_port_lock);
 
        /* check for throttle; if set, do not resubmit read urb */
        /* indicate the read chain needs to be restarted on unthrottle */
        throttled = priv->dp_throttled;
-       if( throttled )
+       if (throttled)
                priv->dp_throttle_restart = 1;
 
        /* receive data */
-       if( opcode == DIGI_CMD_RECEIVE_DATA ) {
-
+       if (opcode == DIGI_CMD_RECEIVE_DATA) {
                /* get flag from port_status */
                flag = 0;
 
                /* overrun is special, not associated with a char */
-               if (port_status & DIGI_OVERRUN_ERROR) {
-                       tty_insert_flip_char( tty, 0, TTY_OVERRUN );
-               }
+               if (port_status & DIGI_OVERRUN_ERROR)
+                       tty_insert_flip_char(tty, 0, TTY_OVERRUN);
 
                /* break takes precedence over parity, */
                /* which takes precedence over framing errors */
-               if (port_status & DIGI_BREAK_ERROR) {
+               if (port_status & DIGI_BREAK_ERROR)
                        flag = TTY_BREAK;
-               } else if (port_status & DIGI_PARITY_ERROR) {
+               else if (port_status & DIGI_PARITY_ERROR)
                        flag = TTY_PARITY;
-               } else if (port_status & DIGI_FRAMING_ERROR) {
+               else if (port_status & DIGI_FRAMING_ERROR)
                        flag = TTY_FRAME;
-               }
 
                /* data length is len-1 (one byte of len is port_status) */
                --len;
 
                len = tty_buffer_request_room(tty, len);
-               if( len > 0 ) {
+               if (len > 0) {
                        /* Hot path */
-                       if(flag == TTY_NORMAL)
+                       if (flag == TTY_NORMAL)
                                tty_insert_flip_string(tty, data, len);
                        else {
                                for(i = 0; i < len; i++)
                                        tty_insert_flip_char(tty, data[i], flag);
                        }
-                       tty_flip_buffer_push( tty );
+                       tty_flip_buffer_push(tty);
                }
        }
+       spin_unlock(&priv->dp_port_lock);
 
-       spin_unlock( &priv->dp_port_lock );
-
-       if( opcode == DIGI_CMD_RECEIVE_DISABLE ) {
-               dbg("%s: got RECEIVE_DISABLE", __FUNCTION__ );
-       } else if( opcode != DIGI_CMD_RECEIVE_DATA ) {
-               dbg("%s: unknown opcode: %d", __FUNCTION__, opcode );
-       }
+       if (opcode == DIGI_CMD_RECEIVE_DISABLE)
+               dbg("%s: got RECEIVE_DISABLE", __FUNCTION__);
+       else if (opcode != DIGI_CMD_RECEIVE_DATA)
+               dbg("%s: unknown opcode: %d", __FUNCTION__, opcode);
 
-       return( throttled ? 1 : 0 );
+       return(throttled ? 1 : 0);
 
 }
 
@@ -1891,7 +1754,7 @@ static int digi_read_inb_callback( struct urb *urb )
 *  -1 if the sanity checks failed.
 */
 
-static int digi_read_oob_callback( struct urb *urb )
+static int digi_read_oob_callback(struct urb *urb)
 {
 
        struct usb_serial_port *port = (struct usb_serial_port *)urb->context;
@@ -1900,87 +1763,75 @@ static int digi_read_oob_callback( struct urb *urb )
        int opcode, line, status, val;
        int i;
 
-
-dbg( "digi_read_oob_callback: port=%d, len=%d", priv->dp_port_num,
-urb->actual_length );
+       dbg("digi_read_oob_callback: port=%d, len=%d",
+                       priv->dp_port_num, urb->actual_length);
 
        /* handle each oob command */
-       for( i=0; i<urb->actual_length-3; ) {
-
+       for(i = 0; i < urb->actual_length - 3;) {
                opcode = ((unsigned char *)urb->transfer_buffer)[i++];
                line = ((unsigned char *)urb->transfer_buffer)[i++];
                status = ((unsigned char *)urb->transfer_buffer)[i++];
                val = ((unsigned char *)urb->transfer_buffer)[i++];
 
-dbg( "digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d",
-opcode, line, status, val );
+               dbg("digi_read_oob_callback: opcode=%d, line=%d, status=%d, val=%d",
+                       opcode, line, status, val);
 
-               if( status != 0 || line >= serial->type->num_ports )
+               if (status != 0 || line >= serial->type->num_ports)
                        continue;
 
                port = serial->port[line];
 
-               if ((priv=usb_get_serial_port_data(port)) == NULL )
+               if ((priv=usb_get_serial_port_data(port)) == NULL)
                        return -1;
 
-               if( opcode == DIGI_CMD_READ_INPUT_SIGNALS ) {
-
-                       spin_lock( &priv->dp_port_lock );
-
+               if (opcode == DIGI_CMD_READ_INPUT_SIGNALS) {
+                       spin_lock(&priv->dp_port_lock);
                        /* convert from digi flags to termiox flags */
-                       if( val & DIGI_READ_INPUT_SIGNALS_CTS ) {
+                       if (val & DIGI_READ_INPUT_SIGNALS_CTS) {
                                priv->dp_modem_signals |= TIOCM_CTS;
                                /* port must be open to use tty struct */
-                               ifport->open_count
-                               && port->tty->termios->c_cflag & CRTSCTS ) {
+                               if (port->open_count
+                                       && port->tty->termios->c_cflag & CRTSCTS) {
                                        port->tty->hw_stopped = 0;
-                                       digi_wakeup_write( port );
+                                       digi_wakeup_write(port);
                                }
                        } else {
                                priv->dp_modem_signals &= ~TIOCM_CTS;
                                /* port must be open to use tty struct */
-                               ifport->open_count
-                               && port->tty->termios->c_cflag & CRTSCTS ) {
+                               if (port->open_count
+                                       && port->tty->termios->c_cflag & CRTSCTS) {
                                        port->tty->hw_stopped = 1;
                                }
                        }
-                       if( val & DIGI_READ_INPUT_SIGNALS_DSR )
+                       if (val & DIGI_READ_INPUT_SIGNALS_DSR)
                                priv->dp_modem_signals |= TIOCM_DSR;
                        else
                                priv->dp_modem_signals &= ~TIOCM_DSR;
-                       if( val & DIGI_READ_INPUT_SIGNALS_RI )
+                       if (val & DIGI_READ_INPUT_SIGNALS_RI)
                                priv->dp_modem_signals |= TIOCM_RI;
                        else
                                priv->dp_modem_signals &= ~TIOCM_RI;
-                       if( val & DIGI_READ_INPUT_SIGNALS_DCD )
+                       if (val & DIGI_READ_INPUT_SIGNALS_DCD)
                                priv->dp_modem_signals |= TIOCM_CD;
                        else
                                priv->dp_modem_signals &= ~TIOCM_CD;
 
-                       wake_up_interruptible( &priv->dp_modem_change_wait );
-                       spin_unlock( &priv->dp_port_lock );
-
-               } else if( opcode == DIGI_CMD_TRANSMIT_IDLE ) {
-
-                       spin_lock( &priv->dp_port_lock );
+                       wake_up_interruptible(&priv->dp_modem_change_wait);
+                       spin_unlock(&priv->dp_port_lock);
+               } else if (opcode == DIGI_CMD_TRANSMIT_IDLE) {
+                       spin_lock(&priv->dp_port_lock);
                        priv->dp_transmit_idle = 1;
-                       wake_up_interruptible( &priv->dp_transmit_idle_wait );
-                       spin_unlock( &priv->dp_port_lock );
-
-               } else if( opcode == DIGI_CMD_IFLUSH_FIFO ) {
-
-                       wake_up_interruptible( &priv->dp_flush_wait );
-
+                       wake_up_interruptible(&priv->dp_transmit_idle_wait);
+                       spin_unlock(&priv->dp_port_lock);
+               } else if (opcode == DIGI_CMD_IFLUSH_FIFO) {
+                       wake_up_interruptible(&priv->dp_flush_wait);
                }
-
        }
-
-       return( 0 );
+       return 0;
 
 }
 
-
-static int __init digi_init (void)
+static int __init digi_init(void)
 {
        int retval;
        retval = usb_serial_register(&digi_acceleport_2_device);
@@ -2002,12 +1853,11 @@ failed_acceleport_2_device:
        return retval;
 }
 
-
 static void __exit digi_exit (void)
 {
-       usb_deregister (&digi_driver);
-       usb_serial_deregister (&digi_acceleport_2_device);
-       usb_serial_deregister (&digi_acceleport_4_device);
+       usb_deregister(&digi_driver);
+       usb_serial_deregister(&digi_acceleport_2_device);
+       usb_serial_deregister(&digi_acceleport_4_device);
 }
 
 
@@ -2015,8 +1865,8 @@ module_init(digi_init);
 module_exit(digi_exit);
 
 
-MODULE_AUTHOR( DRIVER_AUTHOR );
-MODULE_DESCRIPTION( DRIVER_DESC );
+MODULE_AUTHOR(DRIVER_AUTHOR);
+MODULE_DESCRIPTION(DRIVER_DESC);
 MODULE_LICENSE("GPL");
 
 module_param(debug, bool, S_IRUGO | S_IWUSR);
index dd42f57089ffea3a97ee86357113079d00a972a9..2ecb1d2a034d0aa03dc08af168ae09a2f918efea 100644 (file)
@@ -2366,9 +2366,8 @@ static int send_cmd_write_baud_rate (struct edgeport_port *edge_port, int baudRa
        int status;
        unsigned char number = edge_port->port->number - edge_port->port->serial->minor;
 
-       if ((!edge_serial->is_epic) ||
-           ((edge_serial->is_epic) &&
-            (!edge_serial->epic_descriptor.Supports.IOSPSetBaudRate))) {
+       if (edge_serial->is_epic &&
+           !edge_serial->epic_descriptor.Supports.IOSPSetBaudRate) {
                dbg("SendCmdWriteBaudRate - NOT Setting baud rate for port = %d, baud = %d",
                    edge_port->port->number, baudRate);
                return 0;
@@ -2461,18 +2460,16 @@ static int send_cmd_write_uart_register (struct edgeport_port *edge_port, __u8 r
 
        dbg("%s - write to %s register 0x%02x", (regNum == MCR) ? "MCR" : "LCR", __FUNCTION__, regValue);
 
-       if ((!edge_serial->is_epic) ||
-           ((edge_serial->is_epic) &&
-            (!edge_serial->epic_descriptor.Supports.IOSPWriteMCR) &&
-            (regNum == MCR))) {
+       if (edge_serial->is_epic &&
+           !edge_serial->epic_descriptor.Supports.IOSPWriteMCR &&
+           regNum == MCR) {
                dbg("SendCmdWriteUartReg - Not writing to MCR Register");
                return 0;
        }
 
-       if ((!edge_serial->is_epic) ||
-           ((edge_serial->is_epic) &&
-            (!edge_serial->epic_descriptor.Supports.IOSPWriteLCR) &&
-            (regNum == LCR))) {
+       if (edge_serial->is_epic &&
+           !edge_serial->epic_descriptor.Supports.IOSPWriteLCR &&
+           regNum == LCR) {
                dbg ("SendCmdWriteUartReg - Not writing to LCR Register");
                return 0;
        }
index 2a3fabcf5186aa2179b88f4cc64acaa90fba1411..e08c9bb403d88544709108174ce610b51962a340 100644 (file)
@@ -184,21 +184,21 @@ struct mct_u232_private {
  * we do not know how to support. We ignore them for the moment.
  * XXX Rate-limit the error message, it's user triggerable.
  */
-static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value)
+static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value)
 {
        if (le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_SITECOM_PID
          || le16_to_cpu(serial->dev->descriptor.idProduct) == MCT_U232_BELKIN_F5U109_PID) {
                switch (value) {
-               case    B300: return 0x01;
-               case    B600: return 0x02; /* this one not tested */
-               case   B1200: return 0x03;
-               case   B2400: return 0x04;
-               case   B4800: return 0x06;
-               case   B9600: return 0x08;
-               case  B19200: return 0x09;
-               case  B38400: return 0x0a;
-               case  B57600: return 0x0b;
-               case B115200: return 0x0c;
+               case    300: return 0x01;
+               case    600: return 0x02; /* this one not tested */
+               case   1200: return 0x03;
+               case   2400: return 0x04;
+               case   4800: return 0x06;
+               case   9600: return 0x08;
+               case  19200: return 0x09;
+               case  38400: return 0x0a;
+               case  57600: return 0x0b;
+               case 115200: return 0x0c;
                default:
                        err("MCT USB-RS232: unsupported baudrate request 0x%x,"
                            " using default of B9600", value);
@@ -206,27 +206,27 @@ static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value)
                }
        } else {
                switch (value) {
-               case    B300: value =     300; break;
-               case    B600: value =     600; break;
-               case   B1200: value =    1200; break;
-               case   B2400: value =    2400; break;
-               case   B4800: value =    4800; break;
-               case   B9600: value =    9600; break;
-               case  B19200: value =   19200; break;
-               case  B38400: value =   38400; break;
-               case  B57600: value =   57600; break;
-               case B115200: value =  115200; break;
-               default:
-                       err("MCT USB-RS232: unsupported baudrate request 0x%x,"
-                           " using default of B9600", value);
-                       value = 9600;
+                       case 300: break;
+                       case 600: break;
+                       case 1200: break;
+                       case 2400: break;
+                       case 4800: break;
+                       case 9600: break;
+                       case 19200: break;
+                       case 38400: break;
+                       case 57600: break;
+                       case 115200: break;
+                       default:
+                               err("MCT USB-RS232: unsupported baudrate request 0x%x,"
+                                   " using default of B9600", value);
+                               value = 9600;
                }
                return 115200/value;
        }
 }
 
 static int mct_u232_set_baud_rate(struct usb_serial *serial, struct usb_serial_port *port,
-                                 int value)
+                                 speed_t value)
 {
        __le32 divisor;
         int rc;
@@ -634,7 +634,7 @@ static void mct_u232_set_termios (struct usb_serial_port *port,
                mct_u232_set_modem_ctrl(serial, control_state);
        }
 
-       mct_u232_set_baud_rate(serial, port, cflag & CBAUD);
+       mct_u232_set_baud_rate(serial, port, tty_get_baud_rate(port->tty));
 
        if ((cflag & CBAUD) == B0 ) {
                dbg("%s: baud is B0", __FUNCTION__);
index a61bac8f224aded9acfca8b794d385c6bcf79811..aae10c8174d6bb0fd51abd7fb397999bce64f237 100644 (file)
@@ -79,7 +79,7 @@
  * and "Intel solution". They are the regular MCT and "Sitecom" for us.
  * This is pointless to document in the header, see the code for the bits.
  */
-static int mct_u232_calculate_baud_rate(struct usb_serial *serial, int value);
+static int mct_u232_calculate_baud_rate(struct usb_serial *serial, speed_t value);
 
 /*
  * Line Control Register (LCR)
index 0794ccdebfd402a94fd4b71c8f661901dc873e56..0bb8de4cc5241a2b4071095b7c6b3b57049fe357 100644 (file)
@@ -45,7 +45,7 @@ enum devicetype {
        DEVICE_INSTALLER =      2,
 };
 
-int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
+static int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
 {
        int result;
        dev_dbg(&udev->dev, "%s", "SET POWER STATE");
@@ -60,7 +60,7 @@ int sierra_set_power_state(struct usb_device *udev, __u16 swiState)
        return result;
 }
 
-int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
+static int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
 {
        int result;
        dev_dbg(&udev->dev, "%s", "DEVICE MODE SWITCH");
@@ -75,7 +75,8 @@ int sierra_set_ms_mode(struct usb_device *udev, __u16 eSocMode)
        return result;
 }
 
-int sierra_probe(struct usb_interface *iface, const struct usb_device_id *id)
+static int sierra_probe(struct usb_interface *iface,
+                       const struct usb_device_id *id)
 {
        int result;
        struct usb_device *udev;
index a3665659d13b32636914368429c0be0d6998e35d..9bf01a5efc84adaaec0145ca24076421b64db558 100644 (file)
@@ -60,19 +60,19 @@ static struct usb_driver usb_serial_driver = {
 
 static int debug;
 static struct usb_serial *serial_table[SERIAL_TTY_MINORS];     /* initially all NULL */
-static spinlock_t table_lock;
+static DEFINE_MUTEX(table_lock);
 static LIST_HEAD(usb_serial_driver_list);
 
 struct usb_serial *usb_serial_get_by_index(unsigned index)
 {
        struct usb_serial *serial;
 
-       spin_lock(&table_lock);
+       mutex_lock(&table_lock);
        serial = serial_table[index];
 
        if (serial)
                kref_get(&serial->kref);
-       spin_unlock(&table_lock);
+       mutex_unlock(&table_lock);
        return serial;
 }
 
@@ -84,7 +84,7 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
        dbg("%s %d", __FUNCTION__, num_ports);
 
        *minor = 0;
-       spin_lock(&table_lock);
+       mutex_lock(&table_lock);
        for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
                if (serial_table[i])
                        continue;
@@ -106,10 +106,10 @@ static struct usb_serial *get_free_serial (struct usb_serial *serial, int num_po
                        serial_table[i] = serial;
                        serial->port[j++]->number = i;
                }
-               spin_unlock(&table_lock);
+               mutex_unlock(&table_lock);
                return serial;
        }
-       spin_unlock(&table_lock);
+       mutex_unlock(&table_lock);
        return NULL;
 }
 
@@ -172,9 +172,9 @@ static void destroy_serial(struct kref *kref)
 
 void usb_serial_put(struct usb_serial *serial)
 {
-       spin_lock(&table_lock);
+       mutex_lock(&table_lock);
        kref_put(&serial->kref, destroy_serial);
-       spin_unlock(&table_lock);
+       mutex_unlock(&table_lock);
 }
 
 /*****************************************************************************
@@ -1077,16 +1077,17 @@ int usb_serial_suspend(struct usb_interface *intf, pm_message_t message)
        struct usb_serial_port *port;
        int i, r = 0;
 
-       if (serial) {
-               for (i = 0; i < serial->num_ports; ++i) {
-                       port = serial->port[i];
-                       if (port)
-                               kill_traffic(port);
-               }
+       if (!serial) /* device has been disconnected */
+               return 0;
+
+       for (i = 0; i < serial->num_ports; ++i) {
+               port = serial->port[i];
+               if (port)
+                       kill_traffic(port);
        }
 
        if (serial->type->suspend)
-               serial->type->suspend(serial, message);
+               r = serial->type->suspend(serial, message);
 
        return r;
 }
@@ -1128,7 +1129,6 @@ static int __init usb_serial_init(void)
                return -ENOMEM;
 
        /* Initialize our global data */
-       spin_lock_init(&table_lock);
        for (i = 0; i < SERIAL_TTY_MINORS; ++i) {
                serial_table[i] = NULL;
        }
index a624e72f81dc39a41bf79236d0f24707251b7c41..d8d008d4294643419b52c798eea81fd941fdc1f9 100644 (file)
@@ -320,6 +320,13 @@ UNUSUAL_DEV(  0x04b0, 0x0401, 0x0200, 0x0200,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_FIX_CAPACITY),
 
+/* Reported by Milinevsky Dmitry <niam.niam@gmail.com> */
+UNUSUAL_DEV(  0x04b0, 0x0409, 0x0100, 0x0100,
+               "NIKON",
+               "NIKON DSC D50",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_FIX_CAPACITY),
+
 /* Reported by Andreas Bockhold <andreas@bockionline.de> */
 UNUSUAL_DEV(  0x04b0, 0x0405, 0x0100, 0x0100,
                "NIKON",
@@ -1357,6 +1364,20 @@ UNUSUAL_DEV(  0x0f19, 0x0105, 0x0100, 0x0100,
                US_SC_DEVICE, US_PR_DEVICE, NULL,
                US_FL_IGNORE_RESIDUE ),
 
+/* Jeremy Katz <katzj@redhat.com>:
+ * The Blackberry Pearl can run in two modes; a usb-storage only mode
+ * and a mode that allows access via mass storage and to its database.
+ * The berry_charge module will set the device to dual mode and thus we
+ * should ignore its native mode if that module is built
+ */
+#ifdef CONFIG_USB_BERRY_CHARGE
+UNUSUAL_DEV(  0x0fca, 0x0006, 0x0001, 0x0001,
+               "RIM",
+               "Blackberry Pearl",
+               US_SC_DEVICE, US_PR_DEVICE, NULL,
+               US_FL_IGNORE_DEVICE ),
+#endif
+
 /* Reported by Michael Stattmann <michael@stattmann.com> */
 UNUSUAL_DEV(  0x0fce, 0xd008, 0x0000, 0x0000,
                "Sony Ericsson",
index a7231d171bd5c51dd259114652e2a041df7d089a..5216c11d4decadf5d93c0876caea5d35d8a2e346 100644 (file)
@@ -1645,18 +1645,6 @@ config FB_MAXINE
          DECstation series (Personal DECstation 5000/20, /25, /33, /50,
          Codename "Maxine").
 
-config FB_TX3912
-       bool "TMPTX3912/PR31700 frame buffer support"
-       depends on (FB = y) && NINO
-       select FB_CFB_FILLRECT
-       select FB_CFB_COPYAREA
-       select FB_CFB_IMAGEBLIT
-       help
-         The TX3912 is a Toshiba RISC processor based on the MIPS 3900 core
-         see <http://www.toshiba.com/taec/components/Generic/risc/tx3912.htm>.
-
-         Say Y here to enable kernel support for the on-board framebuffer.
-
 config FB_G364
        bool "G364 frame buffer support"
        depends on (FB = y) && (MIPS_MAGNUM_4000 || OLIVETTI_M700)
index 518933d4905f4f97098dac3608d13ccb81503ec4..06eec7b182b75b190ad57793a507adc5092e9470 100644 (file)
@@ -103,7 +103,6 @@ obj-$(CONFIG_FB_PMAG_AA)      += pmag-aa-fb.o
 obj-$(CONFIG_FB_PMAG_BA)         += pmag-ba-fb.o
 obj-$(CONFIG_FB_PMAGB_B)         += pmagb-b-fb.o
 obj-$(CONFIG_FB_MAXINE)                  += maxinefb.o
-obj-$(CONFIG_FB_TX3912)                  += tx3912fb.o
 obj-$(CONFIG_FB_S1D13XXX)        += s1d13xxxfb.o
 obj-$(CONFIG_FB_IMX)              += imxfb.o
 obj-$(CONFIG_FB_S3C2410)         += s3c2410fb.o
index 61a8bf159cb0d2eb0464915b3be43ec7381c45fb..eedb8285e32fa389930152148d32224db3ac947a 100644 (file)
@@ -138,17 +138,6 @@ static struct pixclock arc_clocks[] = {
        {  41250,  42083, VIDC_CTRL_DIV1,   VID_CTL_24MHz },    /* 24.000MHz */
 };
 
-#ifdef CONFIG_ARCH_A5K
-static struct pixclock a5k_clocks[] = {
-       { 117974, 120357, VIDC_CTRL_DIV3,   VID_CTL_25MHz },    /*  8.392MHz */
-       {  78649,  80238, VIDC_CTRL_DIV2,   VID_CTL_25MHz },    /* 12.588MHz */
-       {  58987,  60178, VIDC_CTRL_DIV1_5, VID_CTL_25MHz },    /* 16.588MHz */
-       {  55000,  56111, VIDC_CTRL_DIV2,   VID_CTL_36MHz },    /* 18.000MHz */
-       {  39325,  40119, VIDC_CTRL_DIV1,   VID_CTL_25MHz },    /* 25.175MHz */
-       {  27500,  28055, VIDC_CTRL_DIV1,   VID_CTL_36MHz },    /* 36.000MHz */
-};
-#endif
-
 static struct pixclock *
 acornfb_valid_pixrate(struct fb_var_screeninfo *var)
 {
@@ -163,15 +152,6 @@ acornfb_valid_pixrate(struct fb_var_screeninfo *var)
                    pixclock < arc_clocks[i].max_clock)
                        return arc_clocks + i;
 
-#ifdef CONFIG_ARCH_A5K
-       if (machine_is_a5k()) {
-               for (i = 0; i < ARRAY_SIZE(a5k_clocks); i++)
-                       if (pixclock > a5k_clocks[i].min_clock &&
-                           pixclock < a5k_clocks[i].max_clock)
-                               return a5k_clocks + i;
-       }
-#endif
-
        return NULL;
 }
 
index b0b2e40bbd9f8c07b8f37ab71e85d6dae4314fac..718b9f83736e51f81bfca1db17d3dc452435ea74 100644 (file)
@@ -279,90 +279,91 @@ static void __devinit bw2_do_default_mode(struct bw2_par *par,
        }
 }
 
-struct all_info {
-       struct fb_info info;
-       struct bw2_par par;
-};
-
-static int __devinit bw2_init_one(struct of_device *op)
+static int __devinit bw2_probe(struct of_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->node;
-       struct all_info *all;
+       struct fb_info *info;
+       struct bw2_par *par;
        int linebytes, err;
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       info = framebuffer_alloc(sizeof(struct bw2_par), &op->dev);
 
-       spin_lock_init(&all->par.lock);
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
+       par = info->par;
 
-       all->par.physbase = op->resource[0].start;
-       all->par.which_io = op->resource[0].flags & IORESOURCE_BITS;
+       spin_lock_init(&par->lock);
 
-       sbusfb_fill_var(&all->info.var, dp->node, 1);
+       par->physbase = op->resource[0].start;
+       par->which_io = op->resource[0].flags & IORESOURCE_BITS;
+
+       sbusfb_fill_var(&info->var, dp->node, 1);
        linebytes = of_getintprop_default(dp, "linebytes",
-                                         all->info.var.xres);
+                                         info->var.xres);
 
-       all->info.var.red.length = all->info.var.green.length =
-               all->info.var.blue.length = all->info.var.bits_per_pixel;
-       all->info.var.red.offset = all->info.var.green.offset =
-               all->info.var.blue.offset = 0;
+       info->var.red.length = info->var.green.length =
+               info->var.blue.length = info->var.bits_per_pixel;
+       info->var.red.offset = info->var.green.offset =
+               info->var.blue.offset = 0;
 
-       all->par.regs = of_ioremap(&op->resource[0], BWTWO_REGISTER_OFFSET,
-                                  sizeof(struct bw2_regs), "bw2 regs");
+       par->regs = of_ioremap(&op->resource[0], BWTWO_REGISTER_OFFSET,
+                              sizeof(struct bw2_regs), "bw2 regs");
+       if (!par->regs)
+               goto out_release_fb;
 
        if (!of_find_property(dp, "width", NULL))
-               bw2_do_default_mode(&all->par, &all->info, &linebytes);
+               bw2_do_default_mode(par, info, &linebytes);
 
-       all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
+       par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
-       all->info.flags = FBINFO_DEFAULT;
-       all->info.fbops = &bw2_ops;
+       info->flags = FBINFO_DEFAULT;
+       info->fbops = &bw2_ops;
 
-       all->info.screen_base =
-               of_ioremap(&op->resource[0], 0, all->par.fbsize, "bw2 ram");
-       all->info.par = &all->par;
+       info->screen_base = of_ioremap(&op->resource[0], 0,
+                                      par->fbsize, "bw2 ram");
+       if (!info->screen_base)
+               goto out_unmap_regs;
 
-       bw2_blank(0, &all->info);
+       bw2_blank(0, info);
 
-       bw2_init_fix(&all->info, linebytes);
+       bw2_init_fix(info, linebytes);
 
-       err= register_framebuffer(&all->info);
-       if (err < 0) {
-               of_iounmap(&op->resource[0],
-                          all->par.regs, sizeof(struct bw2_regs));
-               of_iounmap(&op->resource[0],
-                          all->info.screen_base, all->par.fbsize);
-               kfree(all);
-               return err;
-       }
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_unmap_screen;
 
-       dev_set_drvdata(&op->dev, all);
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: bwtwo at %lx:%lx\n",
-              dp->full_name,
-              all->par.which_io, all->par.physbase);
+              dp->full_name, par->which_io, par->physbase);
 
        return 0;
-}
 
-static int __devinit bw2_probe(struct of_device *dev, const struct of_device_id *match)
-{
-       struct of_device *op = to_of_device(&dev->dev);
+out_unmap_screen:
+       of_iounmap(&op->resource[0], info->screen_base, par->fbsize);
+
+out_unmap_regs:
+       of_iounmap(&op->resource[0], par->regs, sizeof(struct bw2_regs));
+
+out_release_fb:
+       framebuffer_release(info);
 
-       return bw2_init_one(op);
+out_err:
+       return err;
 }
 
 static int __devexit bw2_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct bw2_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
+       unregister_framebuffer(info);
 
-       of_iounmap(&op->resource[0], all->par.regs, sizeof(struct bw2_regs));
-       of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize);
+       of_iounmap(&op->resource[0], par->regs, sizeof(struct bw2_regs));
+       of_iounmap(&op->resource[0], info->screen_base, par->fbsize);
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index b071bb632b9748c02eff25b178d0e61708f8ac70..41f6dbf61be7108108b0e174400fc7c58fb77199 100644 (file)
@@ -448,81 +448,79 @@ static struct sbus_mmap_map __cg14_mmap_map[CG14_MMAP_ENTRIES] __devinitdata = {
        { .size = 0 }
 };
 
-struct all_info {
-       struct fb_info info;
-       struct cg14_par par;
-};
-
-static void cg14_unmap_regs(struct of_device *op, struct all_info *all)
+static void cg14_unmap_regs(struct of_device *op, struct fb_info *info,
+                           struct cg14_par *par)
 {
-       if (all->par.regs)
+       if (par->regs)
                of_iounmap(&op->resource[0],
-                          all->par.regs, sizeof(struct cg14_regs));
-       if (all->par.clut)
+                          par->regs, sizeof(struct cg14_regs));
+       if (par->clut)
                of_iounmap(&op->resource[0],
-                          all->par.clut, sizeof(struct cg14_clut));
-       if (all->par.cursor)
+                          par->clut, sizeof(struct cg14_clut));
+       if (par->cursor)
                of_iounmap(&op->resource[0],
-                          all->par.cursor, sizeof(struct cg14_cursor));
-       if (all->info.screen_base)
+                          par->cursor, sizeof(struct cg14_cursor));
+       if (info->screen_base)
                of_iounmap(&op->resource[1],
-                          all->info.screen_base, all->par.fbsize);
+                          info->screen_base, par->fbsize);
 }
 
-static int __devinit cg14_init_one(struct of_device *op)
+static int __devinit cg14_probe(struct of_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->node;
-       struct all_info *all;
+       struct fb_info *info;
+       struct cg14_par *par;
        int is_8mb, linebytes, i, err;
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       info = framebuffer_alloc(sizeof(struct cg14_par), &op->dev);
+
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
+       par = info->par;
 
-       spin_lock_init(&all->par.lock);
+       spin_lock_init(&par->lock);
 
-       sbusfb_fill_var(&all->info.var, dp->node, 8);
-       all->info.var.red.length = 8;
-       all->info.var.green.length = 8;
-       all->info.var.blue.length = 8;
+       sbusfb_fill_var(&info->var, dp->node, 8);
+       info->var.red.length = 8;
+       info->var.green.length = 8;
+       info->var.blue.length = 8;
 
        linebytes = of_getintprop_default(dp, "linebytes",
-                                         all->info.var.xres);
-       all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
+                                         info->var.xres);
+       par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
        if (!strcmp(dp->parent->name, "sbus") ||
            !strcmp(dp->parent->name, "sbi")) {
-               all->par.physbase = op->resource[0].start;
-               all->par.iospace = op->resource[0].flags & IORESOURCE_BITS;
+               par->physbase = op->resource[0].start;
+               par->iospace = op->resource[0].flags & IORESOURCE_BITS;
        } else {
-               all->par.physbase = op->resource[1].start;
-               all->par.iospace = op->resource[0].flags & IORESOURCE_BITS;
+               par->physbase = op->resource[1].start;
+               par->iospace = op->resource[0].flags & IORESOURCE_BITS;
        }
 
-       all->par.regs = of_ioremap(&op->resource[0], 0,
-                                  sizeof(struct cg14_regs), "cg14 regs");
-       all->par.clut = of_ioremap(&op->resource[0], CG14_CLUT1,
-                                  sizeof(struct cg14_clut), "cg14 clut");
-       all->par.cursor = of_ioremap(&op->resource[0], CG14_CURSORREGS,
-                                  sizeof(struct cg14_cursor), "cg14 cursor");
+       par->regs = of_ioremap(&op->resource[0], 0,
+                              sizeof(struct cg14_regs), "cg14 regs");
+       par->clut = of_ioremap(&op->resource[0], CG14_CLUT1,
+                              sizeof(struct cg14_clut), "cg14 clut");
+       par->cursor = of_ioremap(&op->resource[0], CG14_CURSORREGS,
+                                sizeof(struct cg14_cursor), "cg14 cursor");
 
-       all->info.screen_base = of_ioremap(&op->resource[1], 0,
-                                          all->par.fbsize, "cg14 ram");
+       info->screen_base = of_ioremap(&op->resource[1], 0,
+                                      par->fbsize, "cg14 ram");
 
-       if (!all->par.regs || !all->par.clut || !all->par.cursor ||
-           !all->info.screen_base)
-               cg14_unmap_regs(op, all);
+       if (!par->regs || !par->clut || !par->cursor || !info->screen_base)
+               goto out_unmap_regs;
 
        is_8mb = (((op->resource[1].end - op->resource[1].start) + 1) ==
                  (8 * 1024 * 1024));
 
-       BUILD_BUG_ON(sizeof(all->par.mmap_map) != sizeof(__cg14_mmap_map));
+       BUILD_BUG_ON(sizeof(par->mmap_map) != sizeof(__cg14_mmap_map));
                
-       memcpy(&all->par.mmap_map, &__cg14_mmap_map,
-              sizeof(all->par.mmap_map));
+       memcpy(&par->mmap_map, &__cg14_mmap_map, sizeof(par->mmap_map));
 
        for (i = 0; i < CG14_MMAP_ENTRIES; i++) {
-               struct sbus_mmap_map *map = &all->par.mmap_map[i];
+               struct sbus_mmap_map *map = &par->mmap_map[i];
 
                if (!map->size)
                        break;
@@ -536,59 +534,55 @@ static int __devinit cg14_init_one(struct of_device *op)
                        map->size *= 2;
        }
 
-       all->par.mode = MDI_8_PIX;
-       all->par.ramsize = (is_8mb ? 0x800000 : 0x400000);
+       par->mode = MDI_8_PIX;
+       par->ramsize = (is_8mb ? 0x800000 : 0x400000);
 
-       all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
-       all->info.fbops = &cg14_ops;
-       all->info.par = &all->par;
+       info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+       info->fbops = &cg14_ops;
 
-       __cg14_reset(&all->par);
+       __cg14_reset(par);
 
-       if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
-               cg14_unmap_regs(op, all);
-               kfree(all);
-               return -ENOMEM;
-       }
-       fb_set_cmap(&all->info.cmap, &all->info);
+       if (fb_alloc_cmap(&info->cmap, 256, 0))
+               goto out_unmap_regs;
 
-       cg14_init_fix(&all->info, linebytes, dp);
+       fb_set_cmap(&info->cmap, info);
 
-       err = register_framebuffer(&all->info);
-       if (err < 0) {
-               fb_dealloc_cmap(&all->info.cmap);
-               cg14_unmap_regs(op, all);
-               kfree(all);
-               return err;
-       }
+       cg14_init_fix(info, linebytes, dp);
+
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_dealloc_cmap;
 
-       dev_set_drvdata(&op->dev, all);
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: cgfourteen at %lx:%lx, %dMB\n",
               dp->full_name,
-              all->par.iospace, all->par.physbase,
-              all->par.ramsize >> 20);
+              par->iospace, par->physbase,
+              par->ramsize >> 20);
 
        return 0;
-}
 
-static int __devinit cg14_probe(struct of_device *dev, const struct of_device_id *match)
-{
-       struct of_device *op = to_of_device(&dev->dev);
+out_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+
+out_unmap_regs:
+       cg14_unmap_regs(op, info, par);
 
-       return cg14_init_one(op);
+out_err:
+       return err;
 }
 
 static int __devexit cg14_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct cg14_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
-       fb_dealloc_cmap(&all->info.cmap);
+       unregister_framebuffer(info);
+       fb_dealloc_cmap(&info->cmap);
 
-       cg14_unmap_regs(op, all);
+       cg14_unmap_regs(op, info, par);
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index f042428a84f4485214a5ca1d95c38001bf0d9e8a..5741b46ade1be0b0780d07a79f8e02cd41de98be 100644 (file)
@@ -353,104 +353,102 @@ static void __devinit cg3_do_default_mode(struct cg3_par *par)
        }
 }
 
-struct all_info {
-       struct fb_info info;
-       struct cg3_par par;
-};
-
-static int __devinit cg3_init_one(struct of_device *op)
+static int __devinit cg3_probe(struct of_device *op,
+                              const struct of_device_id *match)
 {
        struct device_node *dp = op->node;
-       struct all_info *all;
+       struct fb_info *info;
+       struct cg3_par *par;
        int linebytes, err;
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       info = framebuffer_alloc(sizeof(struct cg3_par), &op->dev);
 
-       spin_lock_init(&all->par.lock);
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
+       par = info->par;
 
-       all->par.physbase = op->resource[0].start;
-       all->par.which_io = op->resource[0].flags & IORESOURCE_BITS;
+       spin_lock_init(&par->lock);
 
-       sbusfb_fill_var(&all->info.var, dp->node, 8);
-       all->info.var.red.length = 8;
-       all->info.var.green.length = 8;
-       all->info.var.blue.length = 8;
+       par->physbase = op->resource[0].start;
+       par->which_io = op->resource[0].flags & IORESOURCE_BITS;
+
+       sbusfb_fill_var(&info->var, dp->node, 8);
+       info->var.red.length = 8;
+       info->var.green.length = 8;
+       info->var.blue.length = 8;
        if (!strcmp(dp->name, "cgRDI"))
-               all->par.flags |= CG3_FLAG_RDI;
-       if (all->par.flags & CG3_FLAG_RDI)
-               cg3_rdi_maybe_fixup_var(&all->info.var, dp);
+               par->flags |= CG3_FLAG_RDI;
+       if (par->flags & CG3_FLAG_RDI)
+               cg3_rdi_maybe_fixup_var(&info->var, dp);
 
        linebytes = of_getintprop_default(dp, "linebytes",
-                                         all->info.var.xres);
-       all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
+                                         info->var.xres);
+       par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
-       all->par.regs = of_ioremap(&op->resource[0], CG3_REGS_OFFSET,
-                                  sizeof(struct cg3_regs), "cg3 regs");
+       par->regs = of_ioremap(&op->resource[0], CG3_REGS_OFFSET,
+                              sizeof(struct cg3_regs), "cg3 regs");
+       if (!par->regs)
+               goto out_release_fb;
 
-       all->info.flags = FBINFO_DEFAULT;
-       all->info.fbops = &cg3_ops;
-       all->info.screen_base =
-               of_ioremap(&op->resource[0], CG3_RAM_OFFSET,
-                          all->par.fbsize, "cg3 ram");
-       all->info.par = &all->par;
+       info->flags = FBINFO_DEFAULT;
+       info->fbops = &cg3_ops;
+       info->screen_base = of_ioremap(&op->resource[0], CG3_RAM_OFFSET,
+                                      par->fbsize, "cg3 ram");
+       if (!info->screen_base)
+               goto out_unmap_regs;
 
-       cg3_blank(0, &all->info);
+       cg3_blank(0, info);
 
        if (!of_find_property(dp, "width", NULL))
-               cg3_do_default_mode(&all->par);
-
-       if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
-               of_iounmap(&op->resource[0],
-                          all->par.regs, sizeof(struct cg3_regs));
-               of_iounmap(&op->resource[0],
-                          all->info.screen_base, all->par.fbsize);
-               kfree(all);
-               return -ENOMEM;
-       }
-       fb_set_cmap(&all->info.cmap, &all->info);
-
-       cg3_init_fix(&all->info, linebytes, dp);
-
-       err = register_framebuffer(&all->info);
-       if (err < 0) {
-               fb_dealloc_cmap(&all->info.cmap);
-               of_iounmap(&op->resource[0],
-                          all->par.regs, sizeof(struct cg3_regs));
-               of_iounmap(&op->resource[0],
-                          all->info.screen_base, all->par.fbsize);
-               kfree(all);
-               return err;
-       }
+               cg3_do_default_mode(par);
+
+       if (fb_alloc_cmap(&info->cmap, 256, 0))
+               goto out_unmap_screen;
+
+       fb_set_cmap(&info->cmap, info);
 
-       dev_set_drvdata(&op->dev, all);
+       cg3_init_fix(info, linebytes, dp);
+
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_dealloc_cmap;
+
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: cg3 at %lx:%lx\n",
-              dp->full_name, all->par.which_io, all->par.physbase);
+              dp->full_name, par->which_io, par->physbase);
 
        return 0;
-}
 
-static int __devinit cg3_probe(struct of_device *dev,
-                              const struct of_device_id *match)
-{
-       struct of_device *op = to_of_device(&dev->dev);
+out_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+
+out_unmap_screen:
+       of_iounmap(&op->resource[0], info->screen_base, par->fbsize);
+
+out_unmap_regs:
+       of_iounmap(&op->resource[0], par->regs, sizeof(struct cg3_regs));
+
+out_release_fb:
+       framebuffer_release(info);
 
-       return cg3_init_one(op);
+out_err:
+       return err;
 }
 
 static int __devexit cg3_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct cg3_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
-       fb_dealloc_cmap(&all->info.cmap);
+       unregister_framebuffer(info);
+       fb_dealloc_cmap(&info->cmap);
 
-       of_iounmap(&op->resource[0], all->par.regs, sizeof(struct cg3_regs));
-       of_iounmap(&op->resource[0], all->info.screen_base, all->par.fbsize);
+       of_iounmap(&op->resource[0], par->regs, sizeof(struct cg3_regs));
+       of_iounmap(&op->resource[0], info->screen_base, par->fbsize);
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index 4dad23a28f58eb0c42b28907de817b5d246cd2ba..ee9046db9c7da58c4fe110a070a1ab28bb8cd1db 100644 (file)
@@ -653,135 +653,123 @@ static void cg6_chip_init(struct fb_info *info)
        sbus_writel(info->var.yres - 1, &fbc->clipmaxy);
 }
 
-struct all_info {
-       struct fb_info info;
-       struct cg6_par par;
-};
-
-static void cg6_unmap_regs(struct of_device *op, struct all_info *all)
+static void cg6_unmap_regs(struct of_device *op, struct fb_info *info,
+                          struct cg6_par *par)
 {
-       if (all->par.fbc)
-               of_iounmap(&op->resource[0], all->par.fbc, 4096);
-       if (all->par.tec)
-               of_iounmap(&op->resource[0],
-                          all->par.tec, sizeof(struct cg6_tec));
-       if (all->par.thc)
-               of_iounmap(&op->resource[0],
-                          all->par.thc, sizeof(struct cg6_thc));
-       if (all->par.bt)
-               of_iounmap(&op->resource[0],
-                          all->par.bt, sizeof(struct bt_regs));
-       if (all->par.fhc)
-               of_iounmap(&op->resource[0],
-                          all->par.fhc, sizeof(u32));
-
-       if (all->info.screen_base)
-               of_iounmap(&op->resource[0],
-                          all->info.screen_base, all->par.fbsize);
+       if (par->fbc)
+               of_iounmap(&op->resource[0], par->fbc, 4096);
+       if (par->tec)
+               of_iounmap(&op->resource[0], par->tec, sizeof(struct cg6_tec));
+       if (par->thc)
+               of_iounmap(&op->resource[0], par->thc, sizeof(struct cg6_thc));
+       if (par->bt)
+               of_iounmap(&op->resource[0], par->bt, sizeof(struct bt_regs));
+       if (par->fhc)
+               of_iounmap(&op->resource[0], par->fhc, sizeof(u32));
+
+       if (info->screen_base)
+               of_iounmap(&op->resource[0], info->screen_base, par->fbsize);
 }
 
-static int __devinit cg6_init_one(struct of_device *op)
+static int __devinit cg6_probe(struct of_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->node;
-       struct all_info *all;
+       struct fb_info *info;
+       struct cg6_par *par;
        int linebytes, err;
+       int dblbuf;
+
+       info = framebuffer_alloc(sizeof(struct cg6_par), &op->dev);
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
+       par = info->par;
 
-       spin_lock_init(&all->par.lock);
+       spin_lock_init(&par->lock);
 
-       all->par.physbase = op->resource[0].start;
-       all->par.which_io = op->resource[0].flags & IORESOURCE_BITS;
+       par->physbase = op->resource[0].start;
+       par->which_io = op->resource[0].flags & IORESOURCE_BITS;
 
-       sbusfb_fill_var(&all->info.var, dp->node, 8);
-       all->info.var.red.length = 8;
-       all->info.var.green.length = 8;
-       all->info.var.blue.length = 8;
+       sbusfb_fill_var(&info->var, dp->node, 8);
+       info->var.red.length = 8;
+       info->var.green.length = 8;
+       info->var.blue.length = 8;
 
        linebytes = of_getintprop_default(dp, "linebytes",
-                                         all->info.var.xres);
-       all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
-       if (of_find_property(dp, "dblbuf", NULL))
-               all->par.fbsize *= 4;
+                                         info->var.xres);
+       par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
-       all->par.fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET,
+       dblbuf = of_getintprop_default(dp, "dblbuf", 0);
+       if (dblbuf)
+               par->fbsize *= 4;
+
+       par->fbc = of_ioremap(&op->resource[0], CG6_FBC_OFFSET,
                                  4096, "cgsix fbc");
-       all->par.tec = of_ioremap(&op->resource[0], CG6_TEC_OFFSET,
+       par->tec = of_ioremap(&op->resource[0], CG6_TEC_OFFSET,
                                  sizeof(struct cg6_tec), "cgsix tec");
-       all->par.thc = of_ioremap(&op->resource[0], CG6_THC_OFFSET,
+       par->thc = of_ioremap(&op->resource[0], CG6_THC_OFFSET,
                                  sizeof(struct cg6_thc), "cgsix thc");
-       all->par.bt = of_ioremap(&op->resource[0], CG6_BROOKTREE_OFFSET,
+       par->bt = of_ioremap(&op->resource[0], CG6_BROOKTREE_OFFSET,
                                 sizeof(struct bt_regs), "cgsix dac");
-       all->par.fhc = of_ioremap(&op->resource[0], CG6_FHC_OFFSET,
+       par->fhc = of_ioremap(&op->resource[0], CG6_FHC_OFFSET,
                                  sizeof(u32), "cgsix fhc");
 
-       all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_IMAGEBLIT |
+       info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_IMAGEBLIT |
                           FBINFO_HWACCEL_COPYAREA | FBINFO_HWACCEL_FILLRECT;
-       all->info.fbops = &cg6_ops;
-
-       all->info.screen_base =  of_ioremap(&op->resource[0], CG6_RAM_OFFSET,
-                                           all->par.fbsize, "cgsix ram");
-       if (!all->par.fbc || !all->par.tec || !all->par.thc ||
-           !all->par.bt || !all->par.fhc || !all->info.screen_base) {
-               cg6_unmap_regs(op, all);
-               kfree(all);
-               return -ENOMEM;
-       }
+       info->fbops = &cg6_ops;
 
-       all->info.par = &all->par;
+       info->screen_base =  of_ioremap(&op->resource[0], CG6_RAM_OFFSET,
+                                           par->fbsize, "cgsix ram");
+       if (!par->fbc || !par->tec || !par->thc ||
+           !par->bt || !par->fhc || !info->screen_base)
+               goto out_unmap_regs;
 
-       all->info.var.accel_flags = FB_ACCELF_TEXT;
+       info->var.accel_flags = FB_ACCELF_TEXT;
 
-       cg6_bt_init(&all->par);
-       cg6_chip_init(&all->info);
-       cg6_blank(0, &all->info);
+       cg6_bt_init(par);
+       cg6_chip_init(info);
+       cg6_blank(0, info);
 
-       if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
-               cg6_unmap_regs(op, all);
-               kfree(all);
-               return -ENOMEM;
-       }
+       if (fb_alloc_cmap(&info->cmap, 256, 0))
+               goto out_unmap_regs;
 
-       fb_set_cmap(&all->info.cmap, &all->info);
-       cg6_init_fix(&all->info, linebytes);
+       fb_set_cmap(&info->cmap, info);
+       cg6_init_fix(info, linebytes);
 
-       err = register_framebuffer(&all->info);
-       if (err < 0) {
-               cg6_unmap_regs(op, all);
-               fb_dealloc_cmap(&all->info.cmap);
-               kfree(all);
-               return err;
-       }
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_dealloc_cmap;
 
-       dev_set_drvdata(&op->dev, all);
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: CGsix [%s] at %lx:%lx\n",
-              dp->full_name,
-              all->info.fix.id,
-              all->par.which_io, all->par.physbase);
+              dp->full_name, info->fix.id,
+              par->which_io, par->physbase);
 
        return 0;
-}
 
-static int __devinit cg6_probe(struct of_device *dev, const struct of_device_id *match)
-{
-       struct of_device *op = to_of_device(&dev->dev);
+out_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+
+out_unmap_regs:
+       cg6_unmap_regs(op, info, par);
 
-       return cg6_init_one(op);
+out_err:
+       return err;
 }
 
 static int __devexit cg6_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct cg6_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
-       fb_dealloc_cmap(&all->info.cmap);
+       unregister_framebuffer(info);
+       fb_dealloc_cmap(&info->cmap);
 
-       cg6_unmap_regs(op, all);
+       cg6_unmap_regs(op, info, par);
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index f48e8c534c8797f228c1a75162735b602a71e94a..6796ba62c3c6ca849d599e1ff74075168aad6855 100644 (file)
@@ -24,6 +24,7 @@
 #include <linux/delay.h>
 #include <linux/interrupt.h>
 #include <linux/fb.h>
+#include <linux/pm.h>
 #include <linux/init.h>
 #include <linux/pci.h>
 #include <linux/console.h>
@@ -458,7 +459,7 @@ static int chipsfb_pci_suspend(struct pci_dev *pdev, pm_message_t state)
 
        if (state.event == pdev->dev.power.power_state.event)
                return 0;
-       if (state.event != PM_SUSPEND_MEM)
+       if (state.event != PM_EVENT_SUSPEND)
                goto done;
 
        acquire_console_sem();
index decfdc8eb9cc8b255572bd28376570ea102a08e7..e58c87b3e3a0f74cf45bab3c930f509b30ca3cfa 100644 (file)
@@ -127,8 +127,20 @@ static int last_fb_vc = MAX_NR_CONSOLES - 1;
 static int fbcon_is_default = 1; 
 static int fbcon_has_exited;
 static int primary_device = -1;
+
+#ifdef CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY
 static int map_override;
 
+static inline void fbcon_map_override(void)
+{
+       map_override = 1;
+}
+#else
+static inline void fbcon_map_override(void)
+{
+}
+#endif /* CONFIG_FRAMEBUFFER_CONSOLE_DETECT_PRIMARY */
+
 /* font data */
 static char fontname[40];
 
@@ -506,7 +518,7 @@ static int __init fb_console_setup(char *this_opt)
                                                (options[j++]-'0') % FB_MAX;
                                }
 
-                               map_override = 1;
+                               fbcon_map_override();
                        }
 
                        return 1;
index a6828d0a4c5674d3553fda2e65b1c6fd1f4ddc7f..96979c37751846f9143a218401d0eb6a5ec02182 100644 (file)
@@ -133,8 +133,8 @@ const struct font_desc *get_default_font(int xres, int yres, u32 font_w,
        if ((yres < 400) == (f->height <= 8))
            c += 1000;
 
-       if (!(font_w & (1 << (f->width - 1))) ||
-           !(font_w & (1 << (f->height - 1))))
+       if ((font_w & (1 << (f->width - 1))) &&
+           (font_h & (1 << (f->height - 1))))
            c += 1000;
 
        if (c > cc) {
index 215ac579f901674c1fc242e5d0681d4a0e206985..0740272047022a01977bfe704821b476ecc0ab38 100644 (file)
@@ -244,8 +244,17 @@ static void fb_set_logo(struct fb_info *info,
        u8 xor = (info->fix.visual == FB_VISUAL_MONO01) ? 0xff : 0;
        u8 fg = 1, d;
 
-       if (fb_get_color_depth(&info->var, &info->fix) == 3)
+       switch (fb_get_color_depth(&info->var, &info->fix)) {
+       case 1:
+               fg = 1;
+               break;
+       case 2:
+               fg = 3;
+               break;
+       default:
                fg = 7;
+               break;
+       }
 
        if (info->fix.visual == FB_VISUAL_MONO01 ||
            info->fix.visual == FB_VISUAL_MONO10)
@@ -564,21 +573,6 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
                depth = 4;
        }
 
-       if (depth >= 8) {
-               switch (info->fix.visual) {
-               case FB_VISUAL_TRUECOLOR:
-                       fb_logo.needs_truepalette = 1;
-                       break;
-               case FB_VISUAL_DIRECTCOLOR:
-                       fb_logo.needs_directpalette = 1;
-                       fb_logo.needs_cmapreset = 1;
-                       break;
-               case FB_VISUAL_PSEUDOCOLOR:
-                       fb_logo.needs_cmapreset = 1;
-                       break;
-               }
-       }
-
        /* Return if no suitable logo was found */
        fb_logo.logo = fb_find_logo(depth);
 
@@ -604,6 +598,22 @@ int fb_prepare_logo(struct fb_info *info, int rotate)
        else
                fb_logo.depth = 1;
 
+
+       if (fb_logo.depth > 4 && depth > 4) {
+               switch (info->fix.visual) {
+               case FB_VISUAL_TRUECOLOR:
+                       fb_logo.needs_truepalette = 1;
+                       break;
+               case FB_VISUAL_DIRECTCOLOR:
+                       fb_logo.needs_directpalette = 1;
+                       fb_logo.needs_cmapreset = 1;
+                       break;
+               case FB_VISUAL_PSEUDOCOLOR:
+                       fb_logo.needs_cmapreset = 1;
+                       break;
+               }
+       }
+
        return fb_prepare_extra_logos(info, fb_logo.logo->height, yres);
 }
 
index 3f6c98fad437fca8f542dbd11a29a19e55d52bce..4b520b573911f96d617935a2741898204b46b153 100644 (file)
@@ -371,6 +371,8 @@ struct ffb_par {
        unsigned long           fbsize;
 
        int                     board_type;
+
+       u32                     pseudo_palette[16];
 };
 
 static void FFBFifo(struct ffb_par *par, int n)
@@ -900,75 +902,67 @@ ffb_init_fix(struct fb_info *info)
        info->fix.accel = FB_ACCEL_SUN_CREATOR;
 }
 
-struct all_info {
-       struct fb_info info;
-       struct ffb_par par;
-       u32 pseudo_palette[16];
-};
-
-static int ffb_init_one(struct of_device *op)
+static int __devinit ffb_probe(struct of_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->node;
        struct ffb_fbc __iomem *fbc;
        struct ffb_dac __iomem *dac;
-       struct all_info *all;
-       int err;
+       struct fb_info *info;
+       struct ffb_par *par;
        u32 dac_pnum, dac_rev, dac_mrev;
+       int err;
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       info = framebuffer_alloc(sizeof(struct ffb_par), &op->dev);
 
-       spin_lock_init(&all->par.lock);
-       all->par.fbc = of_ioremap(&op->resource[2], 0,
-                                 sizeof(struct ffb_fbc), "ffb fbc");
-       if (!all->par.fbc) {
-               kfree(all);
-               return -ENOMEM;
-       }
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
 
-       all->par.dac = of_ioremap(&op->resource[1], 0,
-                                 sizeof(struct ffb_dac), "ffb dac");
-       if (!all->par.dac) {
-               of_iounmap(&op->resource[2],
-                          all->par.fbc, sizeof(struct ffb_fbc));
-               kfree(all);
-               return -ENOMEM;
-       }
+       par = info->par;
+
+       spin_lock_init(&par->lock);
+       par->fbc = of_ioremap(&op->resource[2], 0,
+                             sizeof(struct ffb_fbc), "ffb fbc");
+       if (!par->fbc)
+               goto out_release_fb;
+
+       par->dac = of_ioremap(&op->resource[1], 0,
+                             sizeof(struct ffb_dac), "ffb dac");
+       if (!par->dac)
+               goto out_unmap_fbc;
 
-       all->par.rop_cache = FFB_ROP_NEW;
-       all->par.physbase = op->resource[0].start;
+       par->rop_cache = FFB_ROP_NEW;
+       par->physbase = op->resource[0].start;
 
        /* Don't mention copyarea, so SCROLL_REDRAW is always
         * used.  It is the fastest on this chip.
         */
-       all->info.flags = (FBINFO_DEFAULT |
-                          /* FBINFO_HWACCEL_COPYAREA | */
-                          FBINFO_HWACCEL_FILLRECT |
-                          FBINFO_HWACCEL_IMAGEBLIT);
-       all->info.fbops = &ffb_ops;
-       all->info.screen_base = (char *) all->par.physbase + FFB_DFB24_POFF;
-       all->info.par = &all->par;
-       all->info.pseudo_palette = all->pseudo_palette;
-
-       sbusfb_fill_var(&all->info.var, dp->node, 32);
-       all->par.fbsize = PAGE_ALIGN(all->info.var.xres *
-                                    all->info.var.yres *
-                                    4);
-       ffb_fixup_var_rgb(&all->info.var);
-
-       all->info.var.accel_flags = FB_ACCELF_TEXT;
+       info->flags = (FBINFO_DEFAULT |
+                      /* FBINFO_HWACCEL_COPYAREA | */
+                      FBINFO_HWACCEL_FILLRECT |
+                      FBINFO_HWACCEL_IMAGEBLIT);
+
+       info->fbops = &ffb_ops;
+
+       info->screen_base = (char *) par->physbase + FFB_DFB24_POFF;
+       info->pseudo_palette = par->pseudo_palette;
+
+       sbusfb_fill_var(&info->var, dp->node, 32);
+       par->fbsize = PAGE_ALIGN(info->var.xres * info->var.yres * 4);
+       ffb_fixup_var_rgb(&info->var);
+
+       info->var.accel_flags = FB_ACCELF_TEXT;
 
        if (!strcmp(dp->name, "SUNW,afb"))
-               all->par.flags |= FFB_FLAG_AFB;
+               par->flags |= FFB_FLAG_AFB;
 
-       all->par.board_type = of_getintprop_default(dp, "board_type", 0);
+       par->board_type = of_getintprop_default(dp, "board_type", 0);
 
-       fbc = all->par.fbc;
+       fbc = par->fbc;
        if ((upa_readl(&fbc->ucsr) & FFB_UCSR_ALL_ERRORS) != 0)
                upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr);
 
-       dac = all->par.dac;
+       dac = par->dac;
        upa_writel(FFB_DAC_DID, &dac->type);
        dac_pnum = upa_readl(&dac->value);
        dac_rev = (dac_pnum & FFB_DAC_DID_REV) >> FFB_DAC_DID_REV_SHIFT;
@@ -985,76 +979,70 @@ static int ffb_init_one(struct of_device *op)
         * cursor logic.  We identify Pacifica 1 as not Pacifica 2, the
         * latter having a part number value of 0x236e.
         */
-       if ((all->par.flags & FFB_FLAG_AFB) || dac_pnum == 0x236e) {
-               all->par.flags &= ~FFB_FLAG_INVCURSOR;
+       if ((par->flags & FFB_FLAG_AFB) || dac_pnum == 0x236e) {
+               par->flags &= ~FFB_FLAG_INVCURSOR;
        } else {
                if (dac_mrev < 3)
-                       all->par.flags |= FFB_FLAG_INVCURSOR;
+                       par->flags |= FFB_FLAG_INVCURSOR;
        }
 
-       ffb_switch_from_graph(&all->par);
+       ffb_switch_from_graph(par);
 
        /* Unblank it just to be sure.  When there are multiple
         * FFB/AFB cards in the system, or it is not the OBP
         * chosen console, it will have video outputs off in
         * the DAC.
         */
-       ffb_blank(0, &all->info);
-
-       if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
-               printk(KERN_ERR "ffb: Could not allocate color map.\n");
-               of_iounmap(&op->resource[2],
-                          all->par.fbc, sizeof(struct ffb_fbc));
-               of_iounmap(&op->resource[1],
-                          all->par.dac, sizeof(struct ffb_dac));
-               kfree(all);
-               return -ENOMEM;
-       }
+       ffb_blank(0, info);
 
-       ffb_init_fix(&all->info);
-
-       err = register_framebuffer(&all->info);
-       if (err < 0) {
-               printk(KERN_ERR "ffb: Could not register framebuffer.\n");
-               fb_dealloc_cmap(&all->info.cmap);
-               of_iounmap(&op->resource[2],
-                          all->par.fbc, sizeof(struct ffb_fbc));
-               of_iounmap(&op->resource[1],
-                          all->par.dac, sizeof(struct ffb_dac));
-               kfree(all);
-               return err;
-       }
+       if (fb_alloc_cmap(&info->cmap, 256, 0))
+               goto out_unmap_dac;
+
+       ffb_init_fix(info);
 
-       dev_set_drvdata(&op->dev, all);
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_dealloc_cmap;
+
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: %s at %016lx, type %d, "
               "DAC pnum[%x] rev[%d] manuf_rev[%d]\n",
               dp->full_name,
-              ((all->par.flags & FFB_FLAG_AFB) ? "AFB" : "FFB"),
-              all->par.physbase, all->par.board_type,
+              ((par->flags & FFB_FLAG_AFB) ? "AFB" : "FFB"),
+              par->physbase, par->board_type,
               dac_pnum, dac_rev, dac_mrev);
 
        return 0;
-}
 
-static int __devinit ffb_probe(struct of_device *dev, const struct of_device_id *match)
-{
-       struct of_device *op = to_of_device(&dev->dev);
+out_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+
+out_unmap_dac:
+       of_iounmap(&op->resource[2], par->fbc, sizeof(struct ffb_fbc));
+
+out_unmap_fbc:
+       of_iounmap(&op->resource[2], par->fbc, sizeof(struct ffb_fbc));
+
+out_release_fb:
+       framebuffer_release(info);
 
-       return ffb_init_one(op);
+out_err:
+       return err;
 }
 
 static int __devexit ffb_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct ffb_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
-       fb_dealloc_cmap(&all->info.cmap);
+       unregister_framebuffer(info);
+       fb_dealloc_cmap(&info->cmap);
 
-       of_iounmap(&op->resource[2], all->par.fbc, sizeof(struct ffb_fbc));
-       of_iounmap(&op->resource[1], all->par.dac, sizeof(struct ffb_dac));
+       of_iounmap(&op->resource[2], par->fbc, sizeof(struct ffb_fbc));
+       of_iounmap(&op->resource[1], par->dac, sizeof(struct ffb_dac));
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index a814b6c2605c77574164ba2f527e3647db03cbd4..7608429b39435219c284591df123cbe4032e85ec 100644 (file)
@@ -8,6 +8,21 @@ config FB_GEODE
          Say 'Y' here to allow you to select framebuffer drivers for
          the AMD Geode family of processors.
 
+config FB_GEODE_LX
+       tristate "AMD Geode LX framebuffer support (EXPERIMENTAL)"
+       depends on FB && FB_GEODE
+       select FB_CFB_FILLRECT
+       select FB_CFB_COPYAREA
+       select FB_CFB_IMAGEBLIT
+       ---help---
+         Framebuffer driver for the display controller integrated into the
+         AMD Geode LX processors.
+
+         To compile this driver as a module, choose M here: the module will
+         be called lxfb.
+
+         If unsure, say N.
+
 config FB_GEODE_GX
        tristate "AMD Geode GX framebuffer support (EXPERIMENTAL)"
        depends on FB && FB_GEODE && EXPERIMENTAL
index f896565bc3123ebac8ab06d0a8cdbe39edee6b36..957304b45fbaa39ce1813b70adb230f87646b100 100644 (file)
@@ -2,6 +2,8 @@
 
 obj-$(CONFIG_FB_GEODE_GX1) += gx1fb.o
 obj-$(CONFIG_FB_GEODE_GX)  += gxfb.o
+obj-$(CONFIG_FB_GEODE_LX)  += lxfb.o
 
 gx1fb-objs := gx1fb_core.o display_gx1.o video_cs5530.o
 gxfb-objs  := gxfb_core.o display_gx.o video_gx.o
+lxfb-objs  := lxfb_core.o lxfb_ops.o
diff --git a/drivers/video/geode/lxfb.h b/drivers/video/geode/lxfb.h
new file mode 100644 (file)
index 0000000..6c227f9
--- /dev/null
@@ -0,0 +1,199 @@
+#ifndef _LXFB_H_
+#define _LXFB_H_
+
+#include <linux/fb.h>
+
+#define OUTPUT_CRT   0x01
+#define OUTPUT_PANEL 0x02
+
+struct lxfb_par {
+       int output;
+       int panel_width;
+       int panel_height;
+
+       void __iomem *gp_regs;
+       void __iomem *dc_regs;
+       void __iomem *df_regs;
+};
+
+static inline unsigned int lx_get_pitch(unsigned int xres, int bpp)
+{
+       return (((xres * (bpp >> 3)) + 7) & ~7);
+}
+
+void lx_set_mode(struct fb_info *);
+void lx_get_gamma(struct fb_info *, unsigned int *, int);
+void lx_set_gamma(struct fb_info *, unsigned int *, int);
+unsigned int lx_framebuffer_size(void);
+int lx_blank_display(struct fb_info *, int);
+void lx_set_palette_reg(struct fb_info *, unsigned int, unsigned int,
+                       unsigned int, unsigned int);
+
+/* MSRS */
+
+#define MSR_LX_GLD_CONFIG    0x48002001
+#define MSR_LX_GLCP_DOTPLL   0x4c000015
+#define MSR_LX_DF_PADSEL     0x48000011
+#define MSR_LX_DC_SPARE      0x80000011
+#define MSR_LX_DF_GLCONFIG   0x48002001
+
+#define MSR_LX_GLIU0_P2D_RO0 0x10000029
+
+#define GLCP_DOTPLL_RESET    (1 << 0)
+#define GLCP_DOTPLL_BYPASS   (1 << 15)
+#define GLCP_DOTPLL_HALFPIX  (1 << 24)
+#define GLCP_DOTPLL_LOCK     (1 << 25)
+
+#define DF_CONFIG_OUTPUT_MASK       0x38
+#define DF_OUTPUT_PANEL             0x08
+#define DF_OUTPUT_CRT               0x00
+#define DF_SIMULTANEOUS_CRT_AND_FP  (1 << 15)
+
+#define DF_DEFAULT_TFT_PAD_SEL_LOW  0xDFFFFFFF
+#define DF_DEFAULT_TFT_PAD_SEL_HIGH 0x0000003F
+
+#define DC_SPARE_DISABLE_CFIFO_HGO         0x00000800
+#define DC_SPARE_VFIFO_ARB_SELECT          0x00000400
+#define DC_SPARE_WM_LPEN_OVRD              0x00000200
+#define DC_SPARE_LOAD_WM_LPEN_MASK         0x00000100
+#define DC_SPARE_DISABLE_INIT_VID_PRI      0x00000080
+#define DC_SPARE_DISABLE_VFIFO_WM          0x00000040
+#define DC_SPARE_DISABLE_CWD_CHECK         0x00000020
+#define DC_SPARE_PIX8_PAN_FIX              0x00000010
+#define DC_SPARE_FIRST_REQ_MASK            0x00000002
+
+/* Registers */
+
+#define DC_UNLOCK         0x00
+#define  DC_UNLOCK_CODE   0x4758
+
+#define DC_GENERAL_CFG    0x04
+#define  DC_GCFG_DFLE     (1 << 0)
+#define  DC_GCFG_VIDE     (1 << 3)
+#define  DC_GCFG_VGAE     (1 << 7)
+#define  DC_GCFG_CMPE     (1 << 5)
+#define  DC_GCFG_DECE     (1 << 6)
+#define  DC_GCFG_FDTY     (1 << 17)
+
+#define DC_DISPLAY_CFG    0x08
+#define  DC_DCFG_TGEN     (1 << 0)
+#define  DC_DCFG_GDEN     (1 << 3)
+#define  DC_DCFG_VDEN     (1 << 4)
+#define  DC_DCFG_TRUP     (1 << 6)
+#define  DC_DCFG_DCEN     (1 << 24)
+#define  DC_DCFG_PALB     (1 << 25)
+#define  DC_DCFG_VISL     (1 << 27)
+
+#define  DC_DCFG_16BPP           0x0
+
+#define  DC_DCFG_DISP_MODE_MASK  0x00000300
+#define  DC_DCFG_DISP_MODE_8BPP  0x00000000
+#define  DC_DCFG_DISP_MODE_16BPP 0x00000100
+#define  DC_DCFG_DISP_MODE_24BPP 0x00000200
+#define  DC_DCFG_DISP_MODE_32BPP 0x00000300
+
+
+#define DC_ARB_CFG        0x0C
+
+#define DC_FB_START       0x10
+#define DC_CB_START       0x14
+#define DC_CURSOR_START   0x18
+
+#define DC_DV_TOP          0x2C
+#define DC_DV_TOP_ENABLE   (1 << 0)
+
+#define DC_LINE_SIZE       0x30
+#define DC_GRAPHICS_PITCH  0x34
+#define DC_H_ACTIVE_TIMING 0x40
+#define DC_H_BLANK_TIMING  0x44
+#define DC_H_SYNC_TIMING   0x48
+#define DC_V_ACTIVE_TIMING 0x50
+#define DC_V_BLANK_TIMING  0x54
+#define DC_V_SYNC_TIMING   0x58
+#define DC_FB_ACTIVE       0x5C
+
+#define DC_PAL_ADDRESS     0x70
+#define DC_PAL_DATA        0x74
+
+#define DC_PHY_MEM_OFFSET  0x84
+
+#define DC_DV_CTL          0x88
+#define DC_DV_LINE_SIZE_MASK               0x00000C00
+#define DC_DV_LINE_SIZE_1024               0x00000000
+#define DC_DV_LINE_SIZE_2048               0x00000400
+#define DC_DV_LINE_SIZE_4096               0x00000800
+#define DC_DV_LINE_SIZE_8192               0x00000C00
+
+
+#define DC_GFX_SCALE       0x90
+#define DC_IRQ_FILT_CTL    0x94
+
+
+#define DC_IRQ               0xC8
+#define  DC_IRQ_MASK         (1 << 0)
+#define  DC_VSYNC_IRQ_MASK   (1 << 1)
+#define  DC_IRQ_STATUS       (1 << 20)
+#define  DC_VSYNC_IRQ_STATUS (1 << 21)
+
+#define DC_GENLCK_CTRL      0xD4
+#define  DC_GENLCK_ENABLE   (1 << 18)
+#define  DC_GC_ALPHA_FLICK_ENABLE  (1 << 25)
+#define  DC_GC_FLICKER_FILTER_ENABLE (1 << 24)
+#define  DC_GC_FLICKER_FILTER_MASK (0x0F << 28)
+
+#define DC_COLOR_KEY       0xB8
+#define DC_CLR_KEY_ENABLE (1 << 24)
+
+
+#define DC3_DV_LINE_SIZE_MASK               0x00000C00
+#define DC3_DV_LINE_SIZE_1024               0x00000000
+#define DC3_DV_LINE_SIZE_2048               0x00000400
+#define DC3_DV_LINE_SIZE_4096               0x00000800
+#define DC3_DV_LINE_SIZE_8192               0x00000C00
+
+#define DF_VIDEO_CFG       0x0
+#define  DF_VCFG_VID_EN    (1 << 0)
+
+#define DF_DISPLAY_CFG     0x08
+
+#define DF_DCFG_CRT_EN     (1 << 0)
+#define DF_DCFG_HSYNC_EN   (1 << 1)
+#define DF_DCFG_VSYNC_EN   (1 << 2)
+#define DF_DCFG_DAC_BL_EN  (1 << 3)
+#define DF_DCFG_CRT_HSYNC_POL  (1 << 8)
+#define DF_DCFG_CRT_VSYNC_POL  (1 << 9)
+#define DF_DCFG_GV_PAL_BYP     (1 << 21)
+
+#define DF_DCFG_CRT_SYNC_SKW_INIT 0x10000
+#define DF_DCFG_CRT_SYNC_SKW_MASK  0x1c000
+
+#define DF_DCFG_PWR_SEQ_DLY_INIT     0x80000
+#define DF_DCFG_PWR_SEQ_DLY_MASK     0xe0000
+
+#define DF_MISC            0x50
+
+#define  DF_MISC_GAM_BYPASS (1 << 0)
+#define  DF_MISC_DAC_PWRDN  (1 << 10)
+#define  DF_MISC_A_PWRDN    (1 << 11)
+
+#define DF_PAR             0x38
+#define DF_PDR             0x40
+#define DF_ALPHA_CONTROL_1 0xD8
+#define DF_VIDEO_REQUEST   0x120
+
+#define DF_PANEL_TIM1      0x400
+#define DF_DEFAULT_TFT_PMTIM1 0x0
+
+#define DF_PANEL_TIM2      0x408
+#define DF_DEFAULT_TFT_PMTIM2 0x08000000
+
+#define DF_FP_PM             0x410
+#define  DF_FP_PM_P          (1 << 24)
+
+#define DF_DITHER_CONTROL    0x418
+#define DF_DEFAULT_TFT_DITHCTL                  0x00000070
+#define GP_BLT_STATUS      0x44
+#define  GP_BS_BLT_BUSY    (1 << 0)
+#define  GP_BS_CB_EMPTY    (1 << 4)
+
+#endif
diff --git a/drivers/video/geode/lxfb_core.c b/drivers/video/geode/lxfb_core.c
new file mode 100644 (file)
index 0000000..5e30b40
--- /dev/null
@@ -0,0 +1,621 @@
+/*
+ * Geode LX framebuffer driver.
+ *
+ * Copyright (C) 2007 Advanced Micro Devices, Inc.
+ * Built from gxfb (which is Copyright (C) 2006 Arcom Control Systems Ltd.)
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/module.h>
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/string.h>
+#include <linux/console.h>
+#include <linux/mm.h>
+#include <linux/slab.h>
+#include <linux/delay.h>
+#include <linux/fb.h>
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/uaccess.h>
+
+#include "lxfb.h"
+
+static char *mode_option;
+static int noclear, nopanel, nocrt;
+static int fbsize;
+
+/* Most of these modes are sorted in ascending order, but
+ * since the first entry in this table is the "default" mode,
+ * we try to make it something sane - 640x480-60 is sane
+ */
+
+const struct fb_videomode geode_modedb[] __initdata = {
+       /* 640x480-60 */
+       { NULL, 60, 640, 480, 39682, 48, 8, 25, 2, 88, 2,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 640x400-70 */
+       { NULL, 70, 640, 400, 39770, 40, 8, 28, 5, 96, 2,
+         FB_SYNC_HOR_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 640x480-70 */
+       { NULL, 70, 640, 480, 35014, 88, 24, 15, 2, 64, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 640x480-72 */
+       { NULL, 72, 640, 480, 32102, 120, 16, 20, 1, 40, 3,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 640x480-75 */
+       { NULL, 75, 640, 480, 31746, 120, 16, 16, 1, 64, 3,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 640x480-85 */
+       { NULL, 85, 640, 480, 27780, 80, 56, 25, 1, 56, 3,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 640x480-90 */
+       { NULL, 90, 640, 480, 26392, 96, 32, 22, 1, 64, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 640x480-100 */
+       { NULL, 100, 640, 480, 23167, 104, 40, 25, 1, 64, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 640x480-60 */
+       { NULL, 60, 640, 480, 39682, 48, 16, 25, 10, 88, 2,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-56 */
+       { NULL, 56, 800, 600, 27901, 128, 24, 22, 1, 72, 2,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-60 */
+       { NULL, 60, 800, 600, 25131, 72, 32, 23, 1, 136, 4,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-70 */
+       { NULL, 70, 800, 600, 21873, 120, 40, 21, 4, 80, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-72 */
+       { NULL, 72, 800, 600, 20052, 64, 56, 23, 37, 120, 6,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-75 */
+       { NULL, 75, 800, 600, 20202, 160, 16, 21, 1, 80, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-85 */
+       { NULL, 85, 800, 600, 17790, 152, 32, 27, 1, 64, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-90 */
+       { NULL, 90, 800, 600, 16648, 128, 40, 28, 1, 88, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-100 */
+       { NULL, 100, 800, 600, 14667, 136, 48, 27, 1, 88, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 800x600-60 */
+       { NULL, 60, 800, 600, 25131, 88, 40, 23, 1, 128, 4,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-60 */
+       { NULL, 60, 1024, 768, 15385, 160, 24, 29, 3, 136, 6,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-70 */
+       { NULL, 70, 1024, 768, 13346, 144, 24, 29, 3, 136, 6,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-72 */
+       { NULL, 72, 1024, 768, 12702, 168, 56, 29, 4, 112, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-75 */
+       { NULL, 75, 1024, 768, 12703, 176, 16, 28, 1, 96, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-85 */
+       { NULL, 85, 1024, 768, 10581, 208, 48, 36, 1, 96, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-90 */
+       { NULL, 90, 1024, 768, 9981, 176, 64, 37, 1, 112, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-100 */
+       { NULL, 100, 1024, 768, 8825, 184, 72, 42, 1, 112, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1024x768-60 */
+       { NULL, 60, 1024, 768, 15385, 160, 24, 29, 3, 136, 6,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-60 */
+       { NULL, 60, 1152, 864, 12251, 184, 64, 27, 1, 120, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-70 */
+       { NULL, 70, 1152, 864, 10254, 192, 72, 32, 8, 120, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-72 */
+       { NULL, 72, 1152, 864, 9866, 200, 72, 33, 7, 128, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-75 */
+       { NULL, 75, 1152, 864, 9259, 256, 64, 32, 1, 128, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-85 */
+       { NULL, 85, 1152, 864, 8357, 200, 72, 37, 3, 128, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-90 */
+       { NULL, 90, 1152, 864, 7719, 208, 80, 42, 9, 128, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-100 */
+       { NULL, 100, 1152, 864, 6947, 208, 80, 48, 3, 128, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1152x864-60 */
+       { NULL, 60, 1152, 864, 12251, 184, 64, 27, 1, 120, 3,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-60 */
+       { NULL, 60, 1280, 1024, 9262, 248, 48, 38, 1, 112, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-70 */
+       { NULL, 70, 1280, 1024, 7719, 224, 88, 38, 6, 136, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-72 */
+       { NULL, 72, 1280, 1024, 7490, 224, 88, 39, 7, 136, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-75 */
+       { NULL, 75, 1280, 1024, 7409, 248, 16, 38, 1, 144, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-85 */
+       { NULL, 85, 1280, 1024, 6351, 224, 64, 44, 1, 160, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-90 */
+       { NULL, 90, 1280, 1024, 5791, 240, 96, 51, 12, 144, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-100 */
+       { NULL, 100, 1280, 1024, 5212, 240, 96, 57, 6, 144, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1280x1024-60 */
+       { NULL, 60, 1280, 1024, 9262, 248, 48, 38, 1, 112, 3,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-60 */
+       { NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-70 */
+       { NULL, 70, 1600, 1200, 5291, 304, 64, 46, 1, 192, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-72 */
+       { NULL, 72, 1600, 1200, 5053, 288, 112, 47, 13, 176, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-75 */
+       { NULL, 75, 1600, 1200, 4938, 304, 64, 46, 1, 192, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-85 */
+       { NULL, 85, 1600, 1200, 4357, 304, 64, 46, 1, 192, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-90 */
+       { NULL, 90, 1600, 1200, 3981, 304, 128, 60, 1, 176, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-100 */
+       { NULL, 100, 1600, 1200, 3563, 304, 128, 67, 1, 176, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1600x1200-60 */
+       { NULL, 60, 1600, 1200, 6172, 304, 64, 46, 1, 192, 3,
+         FB_SYNC_HOR_HIGH_ACT | FB_SYNC_VERT_HIGH_ACT,
+         FB_VMODE_NONINTERLACED, 0 },
+       /* 1920x1440-60 */
+       { NULL, 60, 1920, 1440, 4273, 344, 128, 56, 1, 208, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1920x1440-70 */
+       { NULL, 70, 1920, 1440, 3593, 360, 152, 55, 8, 208, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1920x1440-72 */
+       { NULL, 72, 1920, 1440, 3472, 360, 152, 68, 4, 208, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1920x1440-75 */
+       { NULL, 75, 1920, 1440, 3367, 352, 144, 56, 1, 224, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+       /* 1920x1440-85 */
+       { NULL, 85, 1920, 1440, 2929, 368, 152, 68, 1, 216, 3,
+         0, FB_VMODE_NONINTERLACED, 0 },
+};
+
+static int lxfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
+{
+       if (var->xres > 1920 || var->yres > 1440)
+               return -EINVAL;
+
+       if (var->bits_per_pixel == 32) {
+               var->red.offset   = 16; var->red.length   = 8;
+               var->green.offset =  8; var->green.length = 8;
+               var->blue.offset  =  0; var->blue.length  = 8;
+       } else if (var->bits_per_pixel == 16) {
+               var->red.offset   = 11; var->red.length   = 5;
+               var->green.offset =  5; var->green.length = 6;
+               var->blue.offset  =  0; var->blue.length  = 5;
+       } else if (var->bits_per_pixel == 8) {
+               var->red.offset   = 0; var->red.length   = 8;
+               var->green.offset = 0; var->green.length = 8;
+               var->blue.offset  = 0; var->blue.length  = 8;
+       } else
+               return -EINVAL;
+
+       var->transp.offset = 0; var->transp.length = 0;
+
+       /* Enough video memory? */
+       if ((lx_get_pitch(var->xres, var->bits_per_pixel) * var->yres)
+           > info->fix.smem_len)
+         return -EINVAL;
+
+       return 0;
+}
+
+static int lxfb_set_par(struct fb_info *info)
+{
+       if (info->var.bits_per_pixel > 8) {
+               info->fix.visual = FB_VISUAL_TRUECOLOR;
+               fb_dealloc_cmap(&info->cmap);
+       } else {
+               info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
+               fb_alloc_cmap(&info->cmap, 1<<info->var.bits_per_pixel, 0);
+       }
+
+       info->fix.line_length = lx_get_pitch(info->var.xres,
+               info->var.bits_per_pixel);
+
+       lx_set_mode(info);
+       return 0;
+}
+
+static inline u_int chan_to_field(u_int chan, struct fb_bitfield *bf)
+{
+       chan &= 0xffff;
+       chan >>= 16 - bf->length;
+       return chan << bf->offset;
+}
+
+static int lxfb_setcolreg(unsigned regno, unsigned red, unsigned green,
+                          unsigned blue, unsigned transp,
+                          struct fb_info *info)
+{
+       if (info->var.grayscale) {
+               /* grayscale = 0.30*R + 0.59*G + 0.11*B */
+               red = green = blue = (red * 77 + green * 151 + blue * 28) >> 8;
+       }
+
+       /* Truecolor has hardware independent palette */
+       if (info->fix.visual == FB_VISUAL_TRUECOLOR) {
+               u32 *pal = info->pseudo_palette;
+               u32 v;
+
+               if (regno >= 16)
+                       return -EINVAL;
+
+               v  = chan_to_field(red, &info->var.red);
+               v |= chan_to_field(green, &info->var.green);
+               v |= chan_to_field(blue, &info->var.blue);
+
+               pal[regno] = v;
+       } else {
+               if (regno >= 256)
+                       return -EINVAL;
+
+               lx_set_palette_reg(info, regno, red, green, blue);
+       }
+
+       return 0;
+}
+
+static int lxfb_blank(int blank_mode, struct fb_info *info)
+{
+       return lx_blank_display(info, blank_mode);
+}
+
+
+static int __init lxfb_map_video_memory(struct fb_info *info,
+                                       struct pci_dev *dev)
+{
+       struct lxfb_par *par = info->par;
+       int ret;
+
+       ret = pci_enable_device(dev);
+
+       if (ret)
+               return ret;
+
+       ret = pci_request_region(dev, 0, "lxfb-framebuffer");
+
+       if (ret)
+               return ret;
+
+       ret = pci_request_region(dev, 1, "lxfb-gp");
+
+       if (ret)
+               return ret;
+
+       ret = pci_request_region(dev, 2, "lxfb-vg");
+
+       if (ret)
+               return ret;
+
+       ret = pci_request_region(dev, 3, "lxfb-vip");
+
+       if (ret)
+               return ret;
+
+       info->fix.smem_start = pci_resource_start(dev, 0);
+       info->fix.smem_len = fbsize ? fbsize : lx_framebuffer_size();
+
+       info->screen_base = ioremap(info->fix.smem_start, info->fix.smem_len);
+
+       ret = -ENOMEM;
+
+       if (info->screen_base == NULL)
+               return ret;
+
+       par->gp_regs = ioremap(pci_resource_start(dev, 1),
+                               pci_resource_len(dev, 1));
+
+       if (par->gp_regs == NULL)
+               return ret;
+
+       par->dc_regs = ioremap(pci_resource_start(dev, 2),
+                              pci_resource_len(dev, 2));
+
+       if (par->dc_regs == NULL)
+               return ret;
+
+       par->df_regs = ioremap(pci_resource_start(dev, 3),
+                              pci_resource_len(dev, 3));
+
+       if (par->df_regs == NULL)
+               return ret;
+
+       writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK);
+
+       writel(info->fix.smem_start & 0xFF000000,
+              par->dc_regs + DC_PHY_MEM_OFFSET);
+
+       writel(0, par->dc_regs + DC_UNLOCK);
+
+       dev_info(&dev->dev, "%d KB of video memory at 0x%lx\n",
+                info->fix.smem_len / 1024, info->fix.smem_start);
+
+       return 0;
+}
+
+static struct fb_ops lxfb_ops = {
+       .owner          = THIS_MODULE,
+       .fb_check_var   = lxfb_check_var,
+       .fb_set_par     = lxfb_set_par,
+       .fb_setcolreg   = lxfb_setcolreg,
+       .fb_blank       = lxfb_blank,
+       /* No HW acceleration for now. */
+       .fb_fillrect    = cfb_fillrect,
+       .fb_copyarea    = cfb_copyarea,
+       .fb_imageblit   = cfb_imageblit,
+};
+
+static struct fb_info * __init lxfb_init_fbinfo(struct device *dev)
+{
+       struct lxfb_par *par;
+       struct fb_info *info;
+
+       /* Alloc enough space for the pseudo palette. */
+       info = framebuffer_alloc(sizeof(struct lxfb_par) + sizeof(u32) * 16,
+                                dev);
+       if (!info)
+               return NULL;
+
+       par = info->par;
+
+       strcpy(info->fix.id, "Geode LX");
+
+       info->fix.type          = FB_TYPE_PACKED_PIXELS;
+       info->fix.type_aux      = 0;
+       info->fix.xpanstep      = 0;
+       info->fix.ypanstep      = 0;
+       info->fix.ywrapstep     = 0;
+       info->fix.accel         = FB_ACCEL_NONE;
+
+       info->var.nonstd        = 0;
+       info->var.activate      = FB_ACTIVATE_NOW;
+       info->var.height        = -1;
+       info->var.width = -1;
+       info->var.accel_flags = 0;
+       info->var.vmode = FB_VMODE_NONINTERLACED;
+
+       info->fbops             = &lxfb_ops;
+       info->flags             = FBINFO_DEFAULT;
+       info->node              = -1;
+
+       info->pseudo_palette    = (void *)par + sizeof(struct lxfb_par);
+
+       info->var.grayscale     = 0;
+
+       return info;
+}
+
+static int __init lxfb_probe(struct pci_dev *pdev,
+                            const struct pci_device_id *id)
+{
+       struct lxfb_par *par;
+       struct fb_info *info;
+       int ret;
+
+       struct fb_videomode *modedb_ptr;
+       int modedb_size;
+
+       info = lxfb_init_fbinfo(&pdev->dev);
+
+       if (info == NULL)
+               return -ENOMEM;
+
+       par = info->par;
+
+       ret = lxfb_map_video_memory(info, pdev);
+
+       if (ret < 0) {
+               dev_err(&pdev->dev,
+                       "failed to map frame buffer or controller registers\n");
+               goto err;
+       }
+
+       /* Set up the desired outputs */
+
+       par->output = 0;
+       par->output |= (nopanel) ? 0 : OUTPUT_PANEL;
+       par->output |= (nocrt) ? 0 : OUTPUT_CRT;
+
+       /* Set up the mode database */
+
+       modedb_ptr = (struct fb_videomode *) geode_modedb;
+       modedb_size = ARRAY_SIZE(geode_modedb);
+
+       ret = fb_find_mode(&info->var, info, mode_option,
+                          modedb_ptr, modedb_size, NULL, 16);
+
+       if (ret == 0 || ret == 4) {
+               dev_err(&pdev->dev, "could not find valid video mode\n");
+               ret = -EINVAL;
+               goto err;
+       }
+
+       /* Clear the screen of garbage, unless noclear was specified,
+        * in which case we assume the user knows what he is doing */
+
+       if (!noclear)
+               memset_io(info->screen_base, 0, info->fix.smem_len);
+
+       /* Set the mode */
+
+       lxfb_check_var(&info->var, info);
+       lxfb_set_par(info);
+
+       if (register_framebuffer(info) < 0) {
+               ret = -EINVAL;
+               goto err;
+       }
+       pci_set_drvdata(pdev, info);
+       printk(KERN_INFO "fb%d: %s frame buffer device\n",
+               info->node, info->fix.id);
+
+       return 0;
+
+err:
+       if (info->screen_base) {
+               iounmap(info->screen_base);
+               pci_release_region(pdev, 0);
+       }
+       if (par->gp_regs) {
+               iounmap(par->gp_regs);
+               pci_release_region(pdev, 1);
+       }
+       if (par->dc_regs) {
+               iounmap(par->dc_regs);
+               pci_release_region(pdev, 2);
+       }
+       if (par->df_regs) {
+               iounmap(par->df_regs);
+               pci_release_region(pdev, 3);
+       }
+
+       if (info)
+               framebuffer_release(info);
+
+       return ret;
+}
+
+static void lxfb_remove(struct pci_dev *pdev)
+{
+       struct fb_info *info = pci_get_drvdata(pdev);
+       struct lxfb_par *par = info->par;
+
+       unregister_framebuffer(info);
+
+       iounmap(info->screen_base);
+       pci_release_region(pdev, 0);
+
+       iounmap(par->gp_regs);
+       pci_release_region(pdev, 1);
+
+       iounmap(par->dc_regs);
+       pci_release_region(pdev, 2);
+
+       iounmap(par->df_regs);
+       pci_release_region(pdev, 3);
+
+       pci_set_drvdata(pdev, NULL);
+       framebuffer_release(info);
+}
+
+static struct pci_device_id lxfb_id_table[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_LX_VIDEO) },
+       { 0, }
+};
+
+MODULE_DEVICE_TABLE(pci, lxfb_id_table);
+
+static struct pci_driver lxfb_driver = {
+       .name           = "lxfb",
+       .id_table       = lxfb_id_table,
+       .probe          = lxfb_probe,
+       .remove         = lxfb_remove,
+};
+
+#ifndef MODULE
+static int __init lxfb_setup(char *options)
+{
+       char *opt;
+
+       if (!options || !*options)
+               return 0;
+
+       while (1) {
+               char *opt = strsep(&options, ",");
+
+               if (opt == NULL)
+                       break;
+
+               if (!*opt)
+                       continue;
+
+               if (!strncmp(opt, "fbsize:", 7))
+                       fbsize = simple_strtoul(opt+7, NULL, 0);
+               else if (!strcmp(opt, "noclear"))
+                       noclear = 1;
+               else if (!strcmp(opt, "nopanel"))
+                       nopanel = 1;
+               else if (!strcmp(opt, "nocrt"))
+                       nocrt = 1;
+               else
+                       mode_option = opt;
+       }
+
+       return 0;
+}
+#endif
+
+static int __init lxfb_init(void)
+{
+#ifndef MODULE
+       char *option = NULL;
+
+       if (fb_get_options("lxfb", &option))
+               return -ENODEV;
+
+       lxfb_setup(option);
+#endif
+       return pci_register_driver(&lxfb_driver);
+}
+static void __exit lxfb_cleanup(void)
+{
+       pci_unregister_driver(&lxfb_driver);
+}
+
+module_init(lxfb_init);
+module_exit(lxfb_cleanup);
+
+module_param(mode_option, charp, 0);
+MODULE_PARM_DESC(mode_option, "video mode (<x>x<y>[-<bpp>][@<refr>])");
+
+module_param(fbsize, int, 0);
+MODULE_PARM_DESC(fbsize, "video memory size");
+
+MODULE_DESCRIPTION("Framebuffer driver for the AMD Geode LX");
+MODULE_LICENSE("GPL");
diff --git a/drivers/video/geode/lxfb_ops.c b/drivers/video/geode/lxfb_ops.c
new file mode 100644 (file)
index 0000000..4fbc99b
--- /dev/null
@@ -0,0 +1,536 @@
+/* Geode LX framebuffer driver
+ *
+ * Copyright (C) 2006-2007, Advanced Micro Devices,Inc.
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License as published by the
+ * Free Software Foundation; either version 2 of the License, or (at your
+ * option) any later version.
+ */
+
+#include <linux/kernel.h>
+#include <linux/errno.h>
+#include <linux/fb.h>
+#include <linux/uaccess.h>
+#include <linux/delay.h>
+
+#include "lxfb.h"
+
+/* TODO
+ * Support panel scaling
+ * Add acceleration
+ * Add support for interlacing (TV out)
+ * Support compression
+ */
+
+/* This is the complete list of PLL frequencies that we can set -
+ * we will choose the closest match to the incoming clock.
+ * freq is the frequency of the dotclock * 1000 (for example,
+ * 24823 = 24.983 Mhz).
+ * pllval is the corresponding PLL value
+*/
+
+static const struct {
+  unsigned int pllval;
+  unsigned int freq;
+} pll_table[] = {
+  { 0x000031AC, 24923 },
+  { 0x0000215D, 25175 },
+  { 0x00001087, 27000 },
+  { 0x0000216C, 28322 },
+  { 0x0000218D, 28560 },
+  { 0x000010C9, 31200 },
+  { 0x00003147, 31500 },
+  { 0x000010A7, 33032 },
+  { 0x00002159, 35112 },
+  { 0x00004249, 35500 },
+  { 0x00000057, 36000 },
+  { 0x0000219A, 37889 },
+  { 0x00002158, 39168 },
+  { 0x00000045, 40000 },
+  { 0x00000089, 43163 },
+  { 0x000010E7, 44900 },
+  { 0x00002136, 45720 },
+  { 0x00003207, 49500 },
+  { 0x00002187, 50000 },
+  { 0x00004286, 56250 },
+  { 0x000010E5, 60065 },
+  { 0x00004214, 65000 },
+  { 0x00001105, 68179 },
+  { 0x000031E4, 74250 },
+  { 0x00003183, 75000 },
+  { 0x00004284, 78750 },
+  { 0x00001104, 81600 },
+  { 0x00006363, 94500 },
+  { 0x00005303, 97520 },
+  { 0x00002183, 100187 },
+  { 0x00002122, 101420 },
+  { 0x00001081, 108000 },
+  { 0x00006201, 113310 },
+  { 0x00000041, 119650 },
+  { 0x000041A1, 129600 },
+  { 0x00002182, 133500 },
+  { 0x000041B1, 135000 },
+  { 0x00000051, 144000 },
+  { 0x000041E1, 148500 },
+  { 0x000062D1, 157500 },
+  { 0x000031A1, 162000 },
+  { 0x00000061, 169203 },
+  { 0x00004231, 172800 },
+  { 0x00002151, 175500 },
+  { 0x000052E1, 189000 },
+  { 0x00000071, 192000 },
+  { 0x00003201, 198000 },
+  { 0x00004291, 202500 },
+  { 0x00001101, 204750 },
+  { 0x00007481, 218250 },
+  { 0x00004170, 229500 },
+  { 0x00006210, 234000 },
+  { 0x00003140, 251182 },
+  { 0x00006250, 261000 },
+  { 0x000041C0, 278400 },
+  { 0x00005220, 280640 },
+  { 0x00000050, 288000 },
+  { 0x000041E0, 297000 },
+  { 0x00002130, 320207 }
+};
+
+
+static void lx_set_dotpll(u32 pllval)
+{
+       u32 dotpll_lo, dotpll_hi;
+       int i;
+
+       rdmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi);
+
+       if ((dotpll_lo & GLCP_DOTPLL_LOCK) && (dotpll_hi == pllval))
+               return;
+
+       dotpll_hi = pllval;
+       dotpll_lo &= ~(GLCP_DOTPLL_BYPASS | GLCP_DOTPLL_HALFPIX);
+       dotpll_lo |= GLCP_DOTPLL_RESET;
+
+       wrmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi);
+
+       /* Wait 100us for the PLL to lock */
+
+       udelay(100);
+
+       /* Now, loop for the lock bit */
+
+       for (i = 0; i < 1000; i++) {
+               rdmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi);
+               if (dotpll_lo & GLCP_DOTPLL_LOCK)
+                       break;
+       }
+
+       /* Clear the reset bit */
+
+       dotpll_lo &= ~GLCP_DOTPLL_RESET;
+       wrmsr(MSR_LX_GLCP_DOTPLL, dotpll_lo, dotpll_hi);
+}
+
+/* Set the clock based on the frequency specified by the current mode */
+
+static void lx_set_clock(struct fb_info *info)
+{
+       unsigned int diff, min, best = 0;
+       unsigned int freq, i;
+
+       freq = (unsigned int) (0x3b9aca00 / info->var.pixclock);
+
+       min = abs(pll_table[0].freq - freq);
+
+       for (i = 0; i < ARRAY_SIZE(pll_table); i++) {
+               diff = abs(pll_table[i].freq - freq);
+               if (diff < min) {
+                       min = diff;
+                       best = i;
+               }
+       }
+
+       lx_set_dotpll(pll_table[best].pllval & 0x7FFF);
+}
+
+static void lx_graphics_disable(struct fb_info *info)
+{
+       struct lxfb_par *par = info->par;
+       unsigned int val, gcfg;
+
+       /* Note:  This assumes that the video is in a quitet state */
+
+       writel(0, par->df_regs + DF_ALPHA_CONTROL_1);
+       writel(0, par->df_regs + DF_ALPHA_CONTROL_1 + 32);
+       writel(0, par->df_regs + DF_ALPHA_CONTROL_1 + 64);
+
+       /* Turn off the VGA and video enable */
+       val = readl (par->dc_regs + DC_GENERAL_CFG) &
+               ~(DC_GCFG_VGAE | DC_GCFG_VIDE);
+
+       writel(val, par->dc_regs + DC_GENERAL_CFG);
+
+       val = readl(par->df_regs + DF_VIDEO_CFG) & ~DF_VCFG_VID_EN;
+       writel(val, par->df_regs + DF_VIDEO_CFG);
+
+       writel( DC_IRQ_MASK | DC_VSYNC_IRQ_MASK |
+               DC_IRQ_STATUS | DC_VSYNC_IRQ_STATUS,
+               par->dc_regs + DC_IRQ);
+
+       val = readl(par->dc_regs + DC_GENLCK_CTRL) & ~DC_GENLCK_ENABLE;
+       writel(val, par->dc_regs + DC_GENLCK_CTRL);
+
+       val = readl(par->dc_regs + DC_COLOR_KEY) & ~DC_CLR_KEY_ENABLE;
+       writel(val & ~DC_CLR_KEY_ENABLE, par->dc_regs + DC_COLOR_KEY);
+
+       /* We don't actually blank the panel, due to the long latency
+          involved with bringing it back */
+
+       val = readl(par->df_regs + DF_MISC) | DF_MISC_DAC_PWRDN;
+       writel(val, par->df_regs + DF_MISC);
+
+       /* Turn off the display */
+
+       val = readl(par->df_regs + DF_DISPLAY_CFG);
+       writel(val & ~(DF_DCFG_CRT_EN | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN |
+                      DF_DCFG_DAC_BL_EN), par->df_regs + DF_DISPLAY_CFG);
+
+       gcfg = readl(par->dc_regs + DC_GENERAL_CFG);
+       gcfg &= ~(DC_GCFG_CMPE | DC_GCFG_DECE);
+       writel(gcfg, par->dc_regs + DC_GENERAL_CFG);
+
+       /* Turn off the TGEN */
+       val = readl(par->dc_regs + DC_DISPLAY_CFG);
+       val &= ~DC_DCFG_TGEN;
+       writel(val, par->dc_regs + DC_DISPLAY_CFG);
+
+       /* Wait 1000 usecs to ensure that the TGEN is clear */
+       udelay(1000);
+
+       /* Turn off the FIFO loader */
+
+       gcfg &= ~DC_GCFG_DFLE;
+       writel(gcfg, par->dc_regs + DC_GENERAL_CFG);
+
+       /* Lastly, wait for the GP to go idle */
+
+       do {
+               val = readl(par->gp_regs + GP_BLT_STATUS);
+       } while ((val & GP_BS_BLT_BUSY) || !(val & GP_BS_CB_EMPTY));
+}
+
+static void lx_graphics_enable(struct fb_info *info)
+{
+       struct lxfb_par *par = info->par;
+       u32 temp, config;
+
+       /* Set the video request register */
+       writel(0, par->df_regs + DF_VIDEO_REQUEST);
+
+       /* Set up the polarities */
+
+       config = readl(par->df_regs + DF_DISPLAY_CFG);
+
+       config &= ~(DF_DCFG_CRT_SYNC_SKW_MASK | DF_DCFG_PWR_SEQ_DLY_MASK |
+                 DF_DCFG_CRT_HSYNC_POL     | DF_DCFG_CRT_VSYNC_POL);
+
+       config |= (DF_DCFG_CRT_SYNC_SKW_INIT | DF_DCFG_PWR_SEQ_DLY_INIT  |
+                  DF_DCFG_GV_PAL_BYP);
+
+       if (info->var.sync & FB_SYNC_HOR_HIGH_ACT)
+               config |= DF_DCFG_CRT_HSYNC_POL;
+
+       if (info->var.sync & FB_SYNC_VERT_HIGH_ACT)
+               config |= DF_DCFG_CRT_VSYNC_POL;
+
+       if (par->output & OUTPUT_PANEL) {
+               u32 msrlo, msrhi;
+
+               writel(DF_DEFAULT_TFT_PMTIM1,
+                      par->df_regs + DF_PANEL_TIM1);
+               writel(DF_DEFAULT_TFT_PMTIM2,
+                      par->df_regs + DF_PANEL_TIM2);
+               writel(DF_DEFAULT_TFT_DITHCTL,
+                      par->df_regs + DF_DITHER_CONTROL);
+
+               msrlo = DF_DEFAULT_TFT_PAD_SEL_LOW;
+               msrhi = DF_DEFAULT_TFT_PAD_SEL_HIGH;
+
+               wrmsr(MSR_LX_DF_PADSEL, msrlo, msrhi);
+       }
+
+       if (par->output & OUTPUT_CRT) {
+               config |= DF_DCFG_CRT_EN   | DF_DCFG_HSYNC_EN |
+                       DF_DCFG_VSYNC_EN | DF_DCFG_DAC_BL_EN;
+       }
+
+       writel(config, par->df_regs + DF_DISPLAY_CFG);
+
+       /* Turn the CRT dacs back on */
+
+       if (par->output & OUTPUT_CRT) {
+               temp = readl(par->df_regs + DF_MISC);
+               temp &= ~(DF_MISC_DAC_PWRDN  | DF_MISC_A_PWRDN);
+               writel(temp, par->df_regs + DF_MISC);
+       }
+
+       /* Turn the panel on (if it isn't already) */
+
+       if (par->output & OUTPUT_PANEL) {
+               temp = readl(par->df_regs + DF_FP_PM);
+
+               if (!(temp & 0x09))
+                       writel(temp | DF_FP_PM_P, par->df_regs + DF_FP_PM);
+       }
+
+       temp = readl(par->df_regs + DF_MISC);
+       temp = readl(par->df_regs + DF_DISPLAY_CFG);
+}
+
+unsigned int lx_framebuffer_size(void)
+{
+       unsigned int val;
+
+       /* The frame buffer size is reported by a VSM in VSA II */
+       /* Virtual Register Class    = 0x02                     */
+       /* VG_MEM_SIZE (1MB units)   = 0x00                     */
+
+       outw(0xFC53, 0xAC1C);
+       outw(0x0200, 0xAC1C);
+
+       val = (unsigned int)(inw(0xAC1E)) & 0xFE;
+       return (val << 20);
+}
+
+void lx_set_mode(struct fb_info *info)
+{
+       struct lxfb_par *par = info->par;
+       u64 msrval;
+
+       unsigned int max, dv, val, size;
+
+       unsigned int gcfg, dcfg;
+       int hactive, hblankstart, hsyncstart, hsyncend, hblankend, htotal;
+       int vactive, vblankstart, vsyncstart, vsyncend, vblankend, vtotal;
+
+       /* Unlock the DC registers */
+       writel(DC_UNLOCK_CODE, par->dc_regs + DC_UNLOCK);
+
+       lx_graphics_disable(info);
+
+       lx_set_clock(info);
+
+       /* Set output mode */
+
+       rdmsrl(MSR_LX_DF_GLCONFIG, msrval);
+       msrval &= ~DF_CONFIG_OUTPUT_MASK;
+
+       if (par->output & OUTPUT_PANEL) {
+               msrval |= DF_OUTPUT_PANEL;
+
+               if (par->output & OUTPUT_CRT)
+                       msrval |= DF_SIMULTANEOUS_CRT_AND_FP;
+               else
+                       msrval &= ~DF_SIMULTANEOUS_CRT_AND_FP;
+       } else {
+               msrval |= DF_OUTPUT_CRT;
+       }
+
+       wrmsrl(MSR_LX_DF_GLCONFIG, msrval);
+
+       /* Clear the various buffers */
+       /* FIXME:  Adjust for panning here */
+
+       writel(0, par->dc_regs + DC_FB_START);
+       writel(0, par->dc_regs + DC_CB_START);
+       writel(0, par->dc_regs + DC_CURSOR_START);
+
+       /* FIXME: Add support for interlacing */
+       /* FIXME: Add support for scaling */
+
+       val = readl(par->dc_regs + DC_GENLCK_CTRL);
+       val &= ~(DC_GC_ALPHA_FLICK_ENABLE |
+                DC_GC_FLICKER_FILTER_ENABLE | DC_GC_FLICKER_FILTER_MASK);
+
+       /* Default scaling params */
+
+       writel((0x4000 << 16) | 0x4000, par->dc_regs + DC_GFX_SCALE);
+       writel(0, par->dc_regs + DC_IRQ_FILT_CTL);
+       writel(val, par->dc_regs + DC_GENLCK_CTRL);
+
+       /* FIXME:  Support compression */
+
+       if (info->fix.line_length > 4096)
+               dv = DC_DV_LINE_SIZE_8192;
+       else if (info->fix.line_length > 2048)
+               dv = DC_DV_LINE_SIZE_4096;
+       else if (info->fix.line_length > 1024)
+               dv = DC_DV_LINE_SIZE_2048;
+       else
+               dv = DC_DV_LINE_SIZE_1024;
+
+       max = info->fix.line_length * info->var.yres;
+       max = (max + 0x3FF) & 0xFFFFFC00;
+
+       writel(max | DC_DV_TOP_ENABLE, par->dc_regs + DC_DV_TOP);
+
+       val = readl(par->dc_regs + DC_DV_CTL) & ~DC_DV_LINE_SIZE_MASK;
+       writel(val | dv, par->dc_regs + DC_DV_CTL);
+
+       size = info->var.xres * (info->var.bits_per_pixel >> 3);
+
+       writel(info->fix.line_length >> 3, par->dc_regs + DC_GRAPHICS_PITCH);
+       writel((size + 7) >> 3, par->dc_regs + DC_LINE_SIZE);
+
+       /* Set default watermark values */
+
+       rdmsrl(MSR_LX_DC_SPARE, msrval);
+
+       msrval &= ~(DC_SPARE_DISABLE_CFIFO_HGO | DC_SPARE_VFIFO_ARB_SELECT |
+                   DC_SPARE_LOAD_WM_LPEN_MASK | DC_SPARE_WM_LPEN_OVRD |
+                   DC_SPARE_DISABLE_INIT_VID_PRI | DC_SPARE_DISABLE_VFIFO_WM);
+       msrval |= DC_SPARE_DISABLE_VFIFO_WM | DC_SPARE_DISABLE_INIT_VID_PRI;
+       wrmsrl(MSR_LX_DC_SPARE, msrval);
+
+       gcfg = DC_GCFG_DFLE;   /* Display fifo enable */
+       gcfg |= 0xB600;         /* Set default priority */
+       gcfg |= DC_GCFG_FDTY;  /* Set the frame dirty mode */
+
+       dcfg  = DC_DCFG_VDEN;  /* Enable video data */
+       dcfg |= DC_DCFG_GDEN;  /* Enable graphics */
+       dcfg |= DC_DCFG_TGEN;  /* Turn on the timing generator */
+       dcfg |= DC_DCFG_TRUP;  /* Update timings immediately */
+       dcfg |= DC_DCFG_PALB;  /* Palette bypass in > 8 bpp modes */
+       dcfg |= DC_DCFG_VISL;
+       dcfg |= DC_DCFG_DCEN;  /* Always center the display */
+
+       /* Set the current BPP mode */
+
+       switch (info->var.bits_per_pixel) {
+       case 8:
+               dcfg |= DC_DCFG_DISP_MODE_8BPP;
+               break;
+
+       case 16:
+               dcfg |= DC_DCFG_DISP_MODE_16BPP | DC_DCFG_16BPP;
+               break;
+
+       case 32:
+       case 24:
+               dcfg |= DC_DCFG_DISP_MODE_24BPP;
+               break;
+       }
+
+       /* Now - set up the timings */
+
+       hactive = info->var.xres;
+       hblankstart = hactive;
+       hsyncstart = hblankstart + info->var.right_margin;
+       hsyncend =  hsyncstart + info->var.hsync_len;
+       hblankend = hsyncend + info->var.left_margin;
+       htotal = hblankend;
+
+       vactive = info->var.yres;
+       vblankstart = vactive;
+       vsyncstart = vblankstart + info->var.lower_margin;
+       vsyncend =  vsyncstart + info->var.vsync_len;
+       vblankend = vsyncend + info->var.upper_margin;
+       vtotal = vblankend;
+
+       writel((hactive - 1) | ((htotal - 1) << 16),
+              par->dc_regs + DC_H_ACTIVE_TIMING);
+       writel((hblankstart - 1) | ((hblankend - 1) << 16),
+              par->dc_regs + DC_H_BLANK_TIMING);
+       writel((hsyncstart - 1) | ((hsyncend - 1) << 16),
+              par->dc_regs + DC_H_SYNC_TIMING);
+
+       writel((vactive - 1) | ((vtotal - 1) << 16),
+              par->dc_regs + DC_V_ACTIVE_TIMING);
+
+       writel((vblankstart - 1) | ((vblankend - 1) << 16),
+              par->dc_regs + DC_V_BLANK_TIMING);
+
+       writel((vsyncstart - 1)  | ((vsyncend - 1) << 16),
+              par->dc_regs + DC_V_SYNC_TIMING);
+
+       writel( (info->var.xres - 1) << 16 | (info->var.yres - 1),
+               par->dc_regs + DC_FB_ACTIVE);
+
+       /* And re-enable the graphics output */
+       lx_graphics_enable(info);
+
+       /* Write the two main configuration registers */
+       writel(dcfg, par->dc_regs + DC_DISPLAY_CFG);
+       writel(0, par->dc_regs + DC_ARB_CFG);
+       writel(gcfg, par->dc_regs + DC_GENERAL_CFG);
+
+       /* Lock the DC registers */
+       writel(0, par->dc_regs + DC_UNLOCK);
+}
+
+void lx_set_palette_reg(struct fb_info *info, unsigned regno,
+                       unsigned red, unsigned green, unsigned blue)
+{
+       struct lxfb_par *par = info->par;
+       int val;
+
+       /* Hardware palette is in RGB 8-8-8 format. */
+
+       val  = (red   << 8) & 0xff0000;
+       val |= (green)      & 0x00ff00;
+       val |= (blue  >> 8) & 0x0000ff;
+
+       writel(regno, par->dc_regs + DC_PAL_ADDRESS);
+       writel(val, par->dc_regs + DC_PAL_DATA);
+}
+
+int lx_blank_display(struct fb_info *info, int blank_mode)
+{
+       struct lxfb_par *par = info->par;
+       u32 dcfg, fp_pm;
+       int blank, hsync, vsync;
+
+       /* CRT power saving modes. */
+       switch (blank_mode) {
+       case FB_BLANK_UNBLANK:
+               blank = 0; hsync = 1; vsync = 1;
+               break;
+       case FB_BLANK_NORMAL:
+               blank = 1; hsync = 1; vsync = 1;
+               break;
+       case FB_BLANK_VSYNC_SUSPEND:
+               blank = 1; hsync = 1; vsync = 0;
+               break;
+       case FB_BLANK_HSYNC_SUSPEND:
+               blank = 1; hsync = 0; vsync = 1;
+               break;
+       case FB_BLANK_POWERDOWN:
+               blank = 1; hsync = 0; vsync = 0;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       dcfg = readl(par->df_regs + DF_DISPLAY_CFG);
+       dcfg &= ~(DF_DCFG_DAC_BL_EN
+                 | DF_DCFG_HSYNC_EN | DF_DCFG_VSYNC_EN);
+       if (!blank)
+               dcfg |= DF_DCFG_DAC_BL_EN;
+       if (hsync)
+               dcfg |= DF_DCFG_HSYNC_EN;
+       if (vsync)
+               dcfg |= DF_DCFG_VSYNC_EN;
+       writel(dcfg, par->df_regs + DF_DISPLAY_CFG);
+
+       /* Power on/off flat panel */
+
+       if (par->output & OUTPUT_PANEL) {
+               fp_pm = readl(par->df_regs + DF_FP_PM);
+               if (blank_mode == FB_BLANK_POWERDOWN)
+                       fp_pm &= ~DF_FP_PM_P;
+               else
+                       fp_pm |= DF_FP_PM_P;
+               writel(fp_pm, par->df_regs + DF_FP_PM);
+       }
+
+       return 0;
+}
index a038aa5a9e1ccbed66d9e403adf1eaa684235c15..45b9a5d55dec97d7f7ae3303fedb2a71e569afff 100644 (file)
@@ -525,130 +525,123 @@ static void leo_fixup_var_rgb(struct fb_var_screeninfo *var)
        var->transp.length = 0;
 }
 
-struct all_info {
-       struct fb_info info;
-       struct leo_par par;
-};
-
-static void leo_unmap_regs(struct of_device *op, struct all_info *all)
+static void leo_unmap_regs(struct of_device *op, struct fb_info *info,
+                          struct leo_par *par)
 {
-       if (all->par.lc_ss0_usr)
-               of_iounmap(&op->resource[0], all->par.lc_ss0_usr, 0x1000);
-       if (all->par.ld_ss0)
-               of_iounmap(&op->resource[0], all->par.ld_ss0, 0x1000);
-       if (all->par.ld_ss1)
-               of_iounmap(&op->resource[0], all->par.ld_ss1, 0x1000);
-       if (all->par.lx_krn)
-               of_iounmap(&op->resource[0], all->par.lx_krn, 0x1000);
-       if (all->par.cursor)
+       if (par->lc_ss0_usr)
+               of_iounmap(&op->resource[0], par->lc_ss0_usr, 0x1000);
+       if (par->ld_ss0)
+               of_iounmap(&op->resource[0], par->ld_ss0, 0x1000);
+       if (par->ld_ss1)
+               of_iounmap(&op->resource[0], par->ld_ss1, 0x1000);
+       if (par->lx_krn)
+               of_iounmap(&op->resource[0], par->lx_krn, 0x1000);
+       if (par->cursor)
                of_iounmap(&op->resource[0],
-                          all->par.cursor, sizeof(struct leo_cursor));
-       if (all->info.screen_base)
-               of_iounmap(&op->resource[0], all->info.screen_base, 0x800000);
+                          par->cursor, sizeof(struct leo_cursor));
+       if (info->screen_base)
+               of_iounmap(&op->resource[0], info->screen_base, 0x800000);
 }
 
-static int __devinit leo_init_one(struct of_device *op)
+static int __devinit leo_probe(struct of_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->node;
-       struct all_info *all;
+       struct fb_info *info;
+       struct leo_par *par;
        int linebytes, err;
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       info = framebuffer_alloc(sizeof(struct leo_par), &op->dev);
+
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
+       par = info->par;
 
-       spin_lock_init(&all->par.lock);
+       spin_lock_init(&par->lock);
 
-       all->par.physbase = op->resource[0].start;
-       all->par.which_io = op->resource[0].flags & IORESOURCE_BITS;
+       par->physbase = op->resource[0].start;
+       par->which_io = op->resource[0].flags & IORESOURCE_BITS;
 
-       sbusfb_fill_var(&all->info.var, dp->node, 32);
-       leo_fixup_var_rgb(&all->info.var);
+       sbusfb_fill_var(&info->var, dp->node, 32);
+       leo_fixup_var_rgb(&info->var);
 
        linebytes = of_getintprop_default(dp, "linebytes",
-                                         all->info.var.xres);
-       all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
+                                         info->var.xres);
+       par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
-       all->par.lc_ss0_usr =
+       par->lc_ss0_usr =
                of_ioremap(&op->resource[0], LEO_OFF_LC_SS0_USR,
                           0x1000, "leolc ss0usr");
-       all->par.ld_ss0 =
+       par->ld_ss0 =
                of_ioremap(&op->resource[0], LEO_OFF_LD_SS0,
                           0x1000, "leold ss0");
-       all->par.ld_ss1 =
+       par->ld_ss1 =
                of_ioremap(&op->resource[0], LEO_OFF_LD_SS1,
                           0x1000, "leold ss1");
-       all->par.lx_krn =
+       par->lx_krn =
                of_ioremap(&op->resource[0], LEO_OFF_LX_KRN,
                           0x1000, "leolx krn");
-       all->par.cursor =
+       par->cursor =
                of_ioremap(&op->resource[0], LEO_OFF_LX_CURSOR,
                           sizeof(struct leo_cursor), "leolx cursor");
-       all->info.screen_base = 
+       info->screen_base =
                of_ioremap(&op->resource[0], LEO_OFF_SS0,
                           0x800000, "leo ram");
-       if (!all->par.lc_ss0_usr ||
-           !all->par.ld_ss0 ||
-           !all->par.ld_ss1 ||
-           !all->par.lx_krn ||
-           !all->par.cursor ||
-           !all->info.screen_base) {
-               leo_unmap_regs(op, all);
-               kfree(all);
-               return -ENOMEM;
-       }
+       if (!par->lc_ss0_usr ||
+           !par->ld_ss0 ||
+           !par->ld_ss1 ||
+           !par->lx_krn ||
+           !par->cursor ||
+           !info->screen_base)
+               goto out_unmap_regs;
 
-       all->info.flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
-       all->info.fbops = &leo_ops;
-       all->info.par = &all->par;
+       info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
+       info->fbops = &leo_ops;
 
-       leo_init_wids(&all->info);
-       leo_init_hw(&all->info);
+       leo_init_wids(info);
+       leo_init_hw(info);
 
-       leo_blank(0, &all->info);
+       leo_blank(0, info);
 
-       if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
-               leo_unmap_regs(op, all);
-               kfree(all);
-               return -ENOMEM;;
-       }
+       if (fb_alloc_cmap(&info->cmap, 256, 0))
+               goto out_unmap_regs;
 
-       leo_init_fix(&all->info, dp);
+       leo_init_fix(info, dp);
 
-       err = register_framebuffer(&all->info);
-       if (err < 0) {
-               fb_dealloc_cmap(&all->info.cmap);
-               leo_unmap_regs(op, all);
-               kfree(all);
-               return err;
-       }
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_dealloc_cmap;
 
-       dev_set_drvdata(&op->dev, all);
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: leo at %lx:%lx\n",
               dp->full_name,
-              all->par.which_io, all->par.physbase);
+              par->which_io, par->physbase);
 
        return 0;
-}
 
-static int __devinit leo_probe(struct of_device *dev, const struct of_device_id *match)
-{
-       struct of_device *op = to_of_device(&dev->dev);
+out_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+
+out_unmap_regs:
+       leo_unmap_regs(op, info, par);
+       framebuffer_release(info);
 
-       return leo_init_one(op);
+out_err:
+       return err;
 }
 
 static int __devexit leo_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct leo_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
-       fb_dealloc_cmap(&all->info.cmap);
+       unregister_framebuffer(info);
+       fb_dealloc_cmap(&info->cmap);
 
-       leo_unmap_regs(op, all);
+       leo_unmap_regs(op, info, par);
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index 7c76e079ca7d378495f4d4b27e583531e0da172a..d42346e7fdda104da9e64776c21f3b8332812a7a 100644 (file)
@@ -331,16 +331,19 @@ static int __g450_setclk(WPMINFO unsigned int fout, unsigned int pll,
                                        tmp |= M1064_XPIXCLKCTRL_PLL_UP;
                                }
                                matroxfb_DAC_out(PMINFO M1064_XPIXCLKCTRL, tmp);
-#ifdef __powerpc__
-                               /* This is necessary to avoid jitter on PowerPC
-                                * (OpenFirmware) systems, but apparently
-                                * introduces jitter, at least on a x86-64
-                                * using DVI.
-                                * A simple workaround is disable for non-PPC.
-                                */
-                               matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL, 0);
-#endif /* __powerpc__ */
-                               matroxfb_DAC_out(PMINFO M1064_XPWRCTRL, xpwrctrl);
+                               /* DVI PLL preferred for frequencies up to
+                                  panel link max, standard PLL otherwise */
+                               if (fout >= MINFO->max_pixel_clock_panellink)
+                                       tmp = 0;
+                               else tmp =
+                                       M1064_XDVICLKCTRL_DVIDATAPATHSEL |
+                                       M1064_XDVICLKCTRL_C1DVICLKSEL |
+                                       M1064_XDVICLKCTRL_C1DVICLKEN |
+                                       M1064_XDVICLKCTRL_DVILOOPCTL |
+                                       M1064_XDVICLKCTRL_P1LOOPBWDTCTL;
+                               matroxfb_DAC_out(PMINFO M1064_XDVICLKCTRL,tmp);
+                               matroxfb_DAC_out(PMINFO M1064_XPWRCTRL,
+                                                xpwrctrl);
 
                                matroxfb_DAC_unlock_irqrestore(flags);
                        }
index df39c3193735743ce21043a92c6aefce81d7cd37..7a98ce8043d7a95ca4abfd91c5e09a2349a4f716 100644 (file)
@@ -33,6 +33,21 @@ void DAC1064_global_restore(WPMINFO2);
 #define     M1064_XCURCTRL_3COLOR      0x01    /* transparent, 0, 1, 2 */
 #define     M1064_XCURCTRL_XGA         0x02    /* 0, 1, transparent, complement */
 #define     M1064_XCURCTRL_XWIN                0x03    /* transparent, transparent, 0, 1 */
+       /* drive DVI by standard(0)/DVI(1) PLL */
+       /* if set(1), C?DVICLKEN and C?DVICLKSEL must be set(1) */
+#define      M1064_XDVICLKCTRL_DVIDATAPATHSEL   0x01
+       /* drive CRTC1 by standard(0)/DVI(1) PLL */
+#define      M1064_XDVICLKCTRL_C1DVICLKSEL      0x02
+       /* drive CRTC2 by standard(0)/DVI(1) PLL */
+#define      M1064_XDVICLKCTRL_C2DVICLKSEL      0x04
+       /* pixel clock allowed to(0)/blocked from(1) driving CRTC1 */
+#define      M1064_XDVICLKCTRL_C1DVICLKEN       0x08
+       /* DVI PLL loop filter bandwidth selection bits */
+#define      M1064_XDVICLKCTRL_DVILOOPCTL       0x30
+       /* CRTC2 pixel clock allowed to(0)/blocked from(1) driving CRTC2 */
+#define      M1064_XDVICLKCTRL_C2DVICLKEN       0x40
+       /* P1PLL loop filter bandwith selection */
+#define      M1064_XDVICLKCTRL_P1LOOPBWDTCTL    0x80
 #define M1064_XCURCOL0RED      0x08
 #define M1064_XCURCOL0GREEN    0x09
 #define M1064_XCURCOL0BLUE     0x0A
index d59577c8de86b2f50e765609d7e3a1d028f345cc..f3107ad7e54561f78492b50c6ce6353168c1420f 100644 (file)
@@ -424,6 +424,7 @@ struct matrox_fb_info {
                      } mmio;
 
        unsigned int    max_pixel_clock;
+       unsigned int    max_pixel_clock_panellink;
 
        struct matrox_switch*   hw_switch;
 
index 5948e54b9ef9ceb68e2914a30f7600667c771569..ab7fb50bc1deb32ffef63984ff82bbde56feb764 100644 (file)
@@ -658,6 +658,7 @@ static int parse_pins5(WPMINFO const struct matrox_bios* bd) {
                MINFO->values.reg.mctlwtst_core = (MINFO->values.reg.mctlwtst & ~7) |
                                                  wtst_xlat[MINFO->values.reg.mctlwtst & 7];
        }
+       MINFO->max_pixel_clock_panellink = bd->pins[47] * 4000;
        return 0;
 }
 
index 637b78bb4bf79d62f2798d81cd0181623eb6aef2..58496061142de6e90d2a27e79381ac55d1d0b29f 100644 (file)
@@ -255,107 +255,95 @@ static void p9100_init_fix(struct fb_info *info, int linebytes, struct device_no
        info->fix.accel = FB_ACCEL_SUN_CGTHREE;
 }
 
-struct all_info {
-       struct fb_info info;
-       struct p9100_par par;
-};
-
-static int __devinit p9100_init_one(struct of_device *op)
+static int __devinit p9100_probe(struct of_device *op, const struct of_device_id *match)
 {
        struct device_node *dp = op->node;
-       struct all_info *all;
+       struct fb_info *info;
+       struct p9100_par *par;
        int linebytes, err;
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       info = framebuffer_alloc(sizeof(struct p9100_par), &op->dev);
+
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
+       par = info->par;
 
-       spin_lock_init(&all->par.lock);
+       spin_lock_init(&par->lock);
 
        /* This is the framebuffer and the only resource apps can mmap.  */
-       all->par.physbase = op->resource[2].start;
-       all->par.which_io = op->resource[2].flags & IORESOURCE_BITS;
-
-       sbusfb_fill_var(&all->info.var, dp->node, 8);
-       all->info.var.red.length = 8;
-       all->info.var.green.length = 8;
-       all->info.var.blue.length = 8;
-
-       linebytes = of_getintprop_default(dp, "linebytes",
-                                         all->info.var.xres);
-       all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
-
-       all->par.regs = of_ioremap(&op->resource[0], 0,
-                                  sizeof(struct p9100_regs), "p9100 regs");
-       if (!all->par.regs) {
-               kfree(all);
-               return -ENOMEM;
-       }
+       par->physbase = op->resource[2].start;
+       par->which_io = op->resource[2].flags & IORESOURCE_BITS;
 
-       all->info.flags = FBINFO_DEFAULT;
-       all->info.fbops = &p9100_ops;
-       all->info.screen_base = of_ioremap(&op->resource[2], 0,
-                                          all->par.fbsize, "p9100 ram");
-       if (!all->info.screen_base) {
-               of_iounmap(&op->resource[0],
-                          all->par.regs, sizeof(struct p9100_regs));
-               kfree(all);
-               return -ENOMEM;
-       }
-       all->info.par = &all->par;
+       sbusfb_fill_var(&info->var, dp->node, 8);
+       info->var.red.length = 8;
+       info->var.green.length = 8;
+       info->var.blue.length = 8;
 
-       p9100_blank(0, &all->info);
+       linebytes = of_getintprop_default(dp, "linebytes", info->var.xres);
+       par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
-       if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
-               of_iounmap(&op->resource[0],
-                          all->par.regs, sizeof(struct p9100_regs));
-               of_iounmap(&op->resource[2],
-                          all->info.screen_base, all->par.fbsize);
-               kfree(all);
-               return -ENOMEM;
-       }
+       par->regs = of_ioremap(&op->resource[0], 0,
+                              sizeof(struct p9100_regs), "p9100 regs");
+       if (!par->regs)
+               goto out_release_fb;
 
-       p9100_init_fix(&all->info, linebytes, dp);
-
-       err = register_framebuffer(&all->info);
-       if (err < 0) {
-               fb_dealloc_cmap(&all->info.cmap);
-               of_iounmap(&op->resource[0],
-                          all->par.regs, sizeof(struct p9100_regs));
-               of_iounmap(&op->resource[2],
-                          all->info.screen_base, all->par.fbsize);
-               kfree(all);
-               return err;
-       }
-       fb_set_cmap(&all->info.cmap, &all->info);
+       info->flags = FBINFO_DEFAULT;
+       info->fbops = &p9100_ops;
+       info->screen_base = of_ioremap(&op->resource[2], 0,
+                                      par->fbsize, "p9100 ram");
+       if (!info->screen_base)
+               goto out_unmap_regs;
+
+       p9100_blank(0, info);
+
+       if (fb_alloc_cmap(&info->cmap, 256, 0))
+               goto out_unmap_screen;
 
-       dev_set_drvdata(&op->dev, all);
+       p9100_init_fix(info, linebytes, dp);
+
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_dealloc_cmap;
+
+       fb_set_cmap(&info->cmap, info);
+
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: p9100 at %lx:%lx\n",
               dp->full_name,
-              all->par.which_io, all->par.physbase);
+              par->which_io, par->physbase);
 
        return 0;
-}
 
-static int __devinit p9100_probe(struct of_device *dev, const struct of_device_id *match)
-{
-       struct of_device *op = to_of_device(&dev->dev);
+out_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+
+out_unmap_screen:
+       of_iounmap(&op->resource[2], info->screen_base, par->fbsize);
+
+out_unmap_regs:
+       of_iounmap(&op->resource[0], par->regs, sizeof(struct p9100_regs));
+
+out_release_fb:
+       framebuffer_release(info);
 
-       return p9100_init_one(op);
+out_err:
+       return err;
 }
 
 static int __devexit p9100_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct p9100_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
-       fb_dealloc_cmap(&all->info.cmap);
+       unregister_framebuffer(info);
+       fb_dealloc_cmap(&info->cmap);
 
-       of_iounmap(&op->resource[0], all->par.regs, sizeof(struct p9100_regs));
-       of_iounmap(&op->resource[2], all->info.screen_base, all->par.fbsize);
+       of_iounmap(&op->resource[0], par->regs, sizeof(struct p9100_regs));
+       of_iounmap(&op->resource[2], info->screen_base, par->fbsize);
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index f9300266044d8f8e910e1421cad7484f8ef181c7..7d6c29800d14fd64ed6d0c7077308311b0c0f950 100644 (file)
@@ -94,6 +94,7 @@
 #define DISP_DIWCONF (DISP_BASE + 0xe8)
 #define DISP_DIWHSTRT (DISP_BASE + 0xec)
 #define DISP_DIWVSTRT (DISP_BASE + 0xf0)
+#define DISP_PIXDEPTH (DISP_BASE + 0x108)
 
 /* Pixel clocks, one for TV output, doubled for VGA output */
 #define TV_CLK 74239
@@ -143,6 +144,7 @@ static struct pvr2fb_par {
        unsigned char is_lowres;        /* Is horizontal pixel-doubling enabled? */
 
        unsigned long mmio_base;        /* MMIO base */
+       u32 palette[16];
 } *currentpar;
 
 static struct fb_info *fb_info;
@@ -599,6 +601,7 @@ static void pvr2_init_display(struct fb_info *info)
 
        /* bits per pixel */
        fb_writel(fb_readl(DISP_DIWMODE) | (--bytesperpixel << 2), DISP_DIWMODE);
+       fb_writel(bytesperpixel << 2, DISP_PIXDEPTH);
 
        /* video enable, color sync, interlace,
         * hsync and vsync polarity (currently unused) */
@@ -790,7 +793,7 @@ static int __devinit pvr2fb_common_init(void)
        fb_info->fbops          = &pvr2fb_ops;
        fb_info->fix            = pvr2_fix;
        fb_info->par            = currentpar;
-       fb_info->pseudo_palette = (void *)(fb_info->par + 1);
+       fb_info->pseudo_palette = currentpar->palette;
        fb_info->flags          = FBINFO_DEFAULT | FBINFO_HWACCEL_YPAN;
 
        if (video_output == VO_VGA)
@@ -807,6 +810,8 @@ static int __devinit pvr2fb_common_init(void)
 
        if (register_framebuffer(fb_info) < 0)
                goto out_err;
+       /*Must write PIXDEPTH to register before anything is displayed - so force init */
+       pvr2_init_display(fb_info);
 
        modememused = get_line_length(fb_info->var.xres_virtual,
                                      fb_info->var.bits_per_pixel);
@@ -1082,14 +1087,15 @@ static int __init pvr2fb_init(void)
 #endif
        size = sizeof(struct fb_info) + sizeof(struct pvr2fb_par) + 16 * sizeof(u32);
 
-       fb_info = kzalloc(size, GFP_KERNEL);
+       fb_info = framebuffer_alloc(sizeof(struct pvr2fb_par), NULL);
+
        if (!fb_info) {
                printk(KERN_ERR "Failed to allocate memory for fb_info\n");
                return -ENOMEM;
        }
 
 
-       currentpar = (struct pvr2fb_par *)(fb_info + 1);
+       currentpar = fb_info->par;
 
        for (i = 0; i < ARRAY_SIZE(board_driver); i++) {
                struct pvr2_board *pvr_board = board_driver + i;
@@ -1102,7 +1108,7 @@ static int __init pvr2fb_init(void)
                if (ret != 0) {
                        printk(KERN_ERR "pvr2fb: Failed init of %s device\n",
                                pvr_board->name);
-                       kfree(fb_info);
+                       framebuffer_release(fb_info);
                        break;
                }
        }
@@ -1126,7 +1132,7 @@ static void __exit pvr2fb_exit(void)
 #endif
 
        unregister_framebuffer(fb_info);
-       kfree(fb_info);
+       framebuffer_release(fb_info);
 }
 
 module_init(pvr2fb_init);
index ed3426062a8b5c136784b988f7abaa2c52c043b7..8a4c6470d79941ab497f8dcf227af8c19f0a0eb8 100644 (file)
@@ -474,6 +474,7 @@ static void schedule_palette_update(struct s3c2410fb_info *fbi,
 {
        unsigned long flags;
        unsigned long irqen;
+       void __iomem *regs = fbi->io;
 
        local_irq_save(flags);
 
@@ -483,9 +484,9 @@ static void schedule_palette_update(struct s3c2410fb_info *fbi,
                fbi->palette_ready = 1;
 
                /* enable IRQ */
-               irqen = readl(S3C2410_LCDINTMSK);
+               irqen = readl(regs + S3C2410_LCDINTMSK);
                irqen &= ~S3C2410_LCDINT_FRSYNC;
-               writel(irqen, S3C2410_LCDINTMSK);
+               writel(irqen, regs + S3C2410_LCDINTMSK);
        }
 
        local_irq_restore(flags);
@@ -680,6 +681,7 @@ static inline void modify_gpio(void __iomem *reg,
 static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi)
 {
        unsigned long flags;
+       void __iomem *regs = fbi->io;
 
        /* Initialise LCD with values from haret */
 
@@ -694,25 +696,25 @@ static int s3c2410fb_init_registers(struct s3c2410fb_info *fbi)
 
        local_irq_restore(flags);
 
-       writel(fbi->regs.lcdcon1, S3C2410_LCDCON1);
-       writel(fbi->regs.lcdcon2, S3C2410_LCDCON2);
-       writel(fbi->regs.lcdcon3, S3C2410_LCDCON3);
-       writel(fbi->regs.lcdcon4, S3C2410_LCDCON4);
-       writel(fbi->regs.lcdcon5, S3C2410_LCDCON5);
+       writel(fbi->regs.lcdcon1, regs + S3C2410_LCDCON1);
+       writel(fbi->regs.lcdcon2, regs + S3C2410_LCDCON2);
+       writel(fbi->regs.lcdcon3, regs + S3C2410_LCDCON3);
+       writel(fbi->regs.lcdcon4, regs + S3C2410_LCDCON4);
+       writel(fbi->regs.lcdcon5, regs + S3C2410_LCDCON5);
 
        s3c2410fb_set_lcdaddr(fbi);
 
        dprintk("LPCSEL    = 0x%08lx\n", mach_info->lpcsel);
-       writel(mach_info->lpcsel, S3C2410_LPCSEL);
+       writel(mach_info->lpcsel, regs + S3C2410_LPCSEL);
 
-       dprintk("replacing TPAL %08x\n", readl(S3C2410_TPAL));
+       dprintk("replacing TPAL %08x\n", readl(regs + S3C2410_TPAL));
 
        /* ensure temporary palette disabled */
-       writel(0x00, S3C2410_TPAL);
+       writel(0x00, regs + S3C2410_TPAL);
 
        /* Enable video by setting the ENVID bit to 1 */
        fbi->regs.lcdcon1 |= S3C2410_LCDCON1_ENVID;
-       writel(fbi->regs.lcdcon1, S3C2410_LCDCON1);
+       writel(fbi->regs.lcdcon1, regs + S3C2410_LCDCON1);
        return 0;
 }
 
@@ -720,6 +722,7 @@ static void s3c2410fb_write_palette(struct s3c2410fb_info *fbi)
 {
        unsigned int i;
        unsigned long ent;
+       void __iomem *regs = fbi->io;
 
        fbi->palette_ready = 0;
 
@@ -727,14 +730,14 @@ static void s3c2410fb_write_palette(struct s3c2410fb_info *fbi)
                if ((ent = fbi->palette_buffer[i]) == PALETTE_BUFF_CLEAR)
                        continue;
 
-               writel(ent, S3C2410_TFTPAL(i));
+               writel(ent, regs + S3C2410_TFTPAL(i));
 
                /* it seems the only way to know exactly
                 * if the palette wrote ok, is to check
                 * to see if the value verifies ok
                 */
 
-               if (readw(S3C2410_TFTPAL(i)) == ent)
+               if (readw(regs + S3C2410_TFTPAL(i)) == ent)
                        fbi->palette_buffer[i] = PALETTE_BUFF_CLEAR;
                else
                        fbi->palette_ready = 1;   /* retry */
@@ -744,14 +747,15 @@ static void s3c2410fb_write_palette(struct s3c2410fb_info *fbi)
 static irqreturn_t s3c2410fb_irq(int irq, void *dev_id)
 {
        struct s3c2410fb_info *fbi = dev_id;
-       unsigned long lcdirq = readl(S3C2410_LCDINTPND);
+       void __iomem *regs = fbi->io;
+       unsigned long lcdirq = readl(regs + S3C2410_LCDINTPND);
 
        if (lcdirq & S3C2410_LCDINT_FRSYNC) {
                if (fbi->palette_ready)
                        s3c2410fb_write_palette(fbi);
 
-               writel(S3C2410_LCDINT_FRSYNC, S3C2410_LCDINTPND);
-               writel(S3C2410_LCDINT_FRSYNC, S3C2410_LCDSRCPND);
+               writel(S3C2410_LCDINT_FRSYNC, regs + S3C2410_LCDINTPND);
+               writel(S3C2410_LCDINT_FRSYNC, regs + S3C2410_LCDSRCPND);
        }
 
        return IRQ_HANDLED;
@@ -764,9 +768,11 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
        struct s3c2410fb_info *info;
        struct fb_info     *fbinfo;
        struct s3c2410fb_hw *mregs;
+       struct resource *res;
        int ret;
        int irq;
        int i;
+       int size;
        u32 lcdcon1;
 
        mach_info = pdev->dev.platform_data;
@@ -788,11 +794,32 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
                return -ENOMEM;
        }
 
-
        info = fbinfo->par;
        info->fb = fbinfo;
        info->dev = &pdev->dev;
 
+       res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       if (res == NULL) {
+               dev_err(&pdev->dev, "failed to get memory registersn");
+               ret = -ENXIO;
+               goto dealloc_fb;
+       }
+
+       size = (res->end - res->start)+1;
+       info->mem = request_mem_region(res->start, size, pdev->name);
+       if (info->mem == NULL) {
+               dev_err(&pdev->dev, "failed to get memory region\n");
+               ret = -ENOENT;
+               goto dealloc_fb;
+       }
+
+       info->io = ioremap(res->start, size);
+       if (info->io == NULL) {
+               dev_err(&pdev->dev, "ioremap() of registers failed\n");
+               ret = -ENXIO;
+               goto release_mem;
+       }
+
        platform_set_drvdata(pdev, fbinfo);
 
        dprintk("devinit\n");
@@ -803,8 +830,8 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
 
        /* Stop the video and unset ENVID if set */
        info->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
-       lcdcon1 = readl(S3C2410_LCDCON1);
-       writel(lcdcon1 & ~S3C2410_LCDCON1_ENVID, S3C2410_LCDCON1);
+       lcdcon1 = readl(info->io + S3C2410_LCDCON1);
+       writel(lcdcon1 & ~S3C2410_LCDCON1_ENVID, info->io + S3C2410_LCDCON1);
 
        info->mach_info             = pdev->dev.platform_data;
 
@@ -855,19 +882,11 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
        for (i = 0; i < 256; i++)
                info->palette_buffer[i] = PALETTE_BUFF_CLEAR;
 
-       if (!request_mem_region((unsigned long)S3C24XX_VA_LCD, SZ_1M, "s3c2410-lcd")) {
-               ret = -EBUSY;
-               goto dealloc_fb;
-       }
-
-
-       dprintk("got LCD region\n");
-
        ret = request_irq(irq, s3c2410fb_irq, IRQF_DISABLED, pdev->name, info);
        if (ret) {
                dev_err(&pdev->dev, "cannot get irq %d - err %d\n", irq, ret);
                ret = -EBUSY;
-               goto release_mem;
+               goto release_regs;
        }
 
        info->clk = clk_get(NULL, "lcd");
@@ -889,6 +908,7 @@ static int __init s3c2410fb_probe(struct platform_device *pdev)
                ret = -ENOMEM;
                goto release_clock;
        }
+
        dprintk("got video memory\n");
 
        ret = s3c2410fb_init_registers(info);
@@ -916,8 +936,11 @@ release_clock:
        clk_put(info->clk);
 release_irq:
        free_irq(irq,info);
+release_regs:
+       iounmap(info->io);
 release_mem:
-       release_mem_region((unsigned long)S3C24XX_VA_LCD, S3C24XX_SZ_LCD);
+       release_resource(info->mem);
+       kfree(info->mem);
 dealloc_fb:
        framebuffer_release(fbinfo);
        return ret;
@@ -935,7 +958,7 @@ static void s3c2410fb_stop_lcd(struct s3c2410fb_info *fbi)
        local_irq_save(flags);
 
        fbi->regs.lcdcon1 &= ~S3C2410_LCDCON1_ENVID;
-       writel(fbi->regs.lcdcon1, S3C2410_LCDCON1);
+       writel(fbi->regs.lcdcon1, fbi->io + S3C2410_LCDCON1);
 
        local_irq_restore(flags);
 }
@@ -962,7 +985,10 @@ static int s3c2410fb_remove(struct platform_device *pdev)
 
        irq = platform_get_irq(pdev, 0);
        free_irq(irq,info);
-       release_mem_region((unsigned long)S3C24XX_VA_LCD, S3C24XX_SZ_LCD);
+
+       release_resource(info->mem);
+       kfree(info->mem);
+       iounmap(info->io);
        unregister_framebuffer(fbinfo);
 
        return 0;
index f3f8a8e15012af2f7544a56eec2945a9032e3055..17c7915b7acde81c90c0ea1f67a2576689e601e8 100644 (file)
@@ -30,6 +30,9 @@ struct s3c2410fb_info {
        struct device           *dev;
        struct clk              *clk;
 
+       struct resource         *mem;
+       void __iomem            *io;
+
        struct s3c2410fb_mach_info *mach_info;
 
        /* raw memory addresses */
index 34ef859ee41440ec80492e70038307f7e08cc8c1..963a454b70741ecb696802c98bd5e73dd83e146d 100644 (file)
@@ -190,17 +190,6 @@ int sbusfb_ioctl_helper(unsigned long cmd, unsigned long arg,
 EXPORT_SYMBOL(sbusfb_ioctl_helper);
 
 #ifdef CONFIG_COMPAT
-struct  fbcmap32 {
-       int             index;          /* first element (0 origin) */
-       int             count;
-       u32             red;
-       u32             green;
-       u32             blue;
-};
-
-#define FBIOPUTCMAP32  _IOW('F', 3, struct fbcmap32)
-#define FBIOGETCMAP32  _IOW('F', 4, struct fbcmap32)
-
 static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned long arg)
 {
        struct fbcmap32 __user *argp = (void __user *)arg;
@@ -223,20 +212,6 @@ static int fbiogetputcmap(struct fb_info *info, unsigned int cmd, unsigned long
                        (unsigned long)p);
 }
 
-struct fbcursor32 {
-       short set;              /* what to set, choose from the list above */
-       short enable;           /* cursor on/off */
-       struct fbcurpos pos;    /* cursor position */
-       struct fbcurpos hot;    /* cursor hot spot */
-       struct fbcmap32 cmap;   /* color map info */
-       struct fbcurpos size;   /* cursor bit map size */
-       u32     image;          /* cursor image bits */
-       u32     mask;           /* cursor mask bits */
-};
-
-#define FBIOSCURSOR32  _IOW('F', 24, struct fbcursor32)
-#define FBIOGCURSOR32  _IOW('F', 25, struct fbcursor32)
-
 static int fbiogscursor(struct fb_info *info, unsigned long arg)
 {
        struct fbcursor __user *p = compat_alloc_user_space(sizeof(*p));
index c97709ecbad0af458a66532ffcd5f70397bd9c86..e7c8db2eb49b31f4c3553adf72863728795a5e9f 100644 (file)
@@ -1100,13 +1100,18 @@ stifb_init_fb(struct sti_struct *sti, int bpp_pref)
        /* only supported cards are allowed */
        switch (fb->id) {
        case CRT_ID_VISUALIZE_EG:
-               /* look for a double buffering device like e.g. the 
-                  "INTERNAL_EG_DX1024" in the RDI precisionbook laptop
-                  which won't work. The same device in non-double 
-                  buffering mode returns "INTERNAL_EG_X1024". */
-               if (strstr(sti->outptr.dev_name, "EG_DX")) {
-                  printk(KERN_WARNING 
-                       "stifb: ignoring '%s'. Disable double buffering in IPL menu.\n",
+               /* Visualize cards can run either in "double buffer" or
+                 "standard" mode. Depending on the mode, the card reports
+                 a different device name, e.g. "INTERNAL_EG_DX1024" in double
+                 buffer mode and "INTERNAL_EG_X1024" in standard mode.
+                 Since this driver only supports standard mode, we check
+                 if the device name contains the string "DX" and tell the
+                 user how to reconfigure the card. */
+               if (strstr(sti->outptr.dev_name, "DX")) {
+                  printk(KERN_WARNING "WARNING: stifb framebuffer driver does not "
+                       "support '%s' in double-buffer mode.\n"
+                       KERN_WARNING "WARNING: Please disable the double-buffer mode "
+                       "in IPL menu (the PARISC-BIOS).\n",
                        sti->outptr.dev_name);
                   goto out_err0;
                }
index 5a99669232ce51dc042655ee53f4edabbe540c3f..e5a9ddb3c8be4d9386a63aa758429074fc1ed176 100644 (file)
@@ -345,88 +345,82 @@ tcx_init_fix(struct fb_info *info, int linebytes)
        info->fix.accel = FB_ACCEL_SUN_TCX;
 }
 
-struct all_info {
-       struct fb_info info;
-       struct tcx_par par;
-};
-
-static void tcx_unmap_regs(struct of_device *op, struct all_info *all)
+static void tcx_unmap_regs(struct of_device *op, struct fb_info *info,
+                          struct tcx_par *par)
 {
-       if (all->par.tec)
+       if (par->tec)
                of_iounmap(&op->resource[7],
-                          all->par.tec, sizeof(struct tcx_tec));
-       if (all->par.thc)
+                          par->tec, sizeof(struct tcx_tec));
+       if (par->thc)
                of_iounmap(&op->resource[9],
-                          all->par.thc, sizeof(struct tcx_thc));
-       if (all->par.bt)
+                          par->thc, sizeof(struct tcx_thc));
+       if (par->bt)
                of_iounmap(&op->resource[8],
-                          all->par.bt, sizeof(struct bt_regs));
-       if (all->par.cplane)
+                          par->bt, sizeof(struct bt_regs));
+       if (par->cplane)
                of_iounmap(&op->resource[4],
-                          all->par.cplane, all->par.fbsize * sizeof(u32));
-       if (all->info.screen_base)
+                          par->cplane, par->fbsize * sizeof(u32));
+       if (info->screen_base)
                of_iounmap(&op->resource[0],
-                          all->info.screen_base, all->par.fbsize);
+                          info->screen_base, par->fbsize);
 }
 
 static int __devinit tcx_init_one(struct of_device *op)
 {
        struct device_node *dp = op->node;
-       struct all_info *all;
+       struct fb_info *info;
+       struct tcx_par *par;
        int linebytes, i, err;
 
-       all = kzalloc(sizeof(*all), GFP_KERNEL);
-       if (!all)
-               return -ENOMEM;
+       info = framebuffer_alloc(sizeof(struct tcx_par), &op->dev);
 
-       spin_lock_init(&all->par.lock);
+       err = -ENOMEM;
+       if (!info)
+               goto out_err;
+       par = info->par;
 
-       all->par.lowdepth =
+       spin_lock_init(&par->lock);
+
+       par->lowdepth =
                (of_find_property(dp, "tcx-8-bit", NULL) != NULL);
 
-       sbusfb_fill_var(&all->info.var, dp->node, 8);
-       all->info.var.red.length = 8;
-       all->info.var.green.length = 8;
-       all->info.var.blue.length = 8;
+       sbusfb_fill_var(&info->var, dp->node, 8);
+       info->var.red.length = 8;
+       info->var.green.length = 8;
+       info->var.blue.length = 8;
 
        linebytes = of_getintprop_default(dp, "linebytes",
-                                         all->info.var.xres);
-       all->par.fbsize = PAGE_ALIGN(linebytes * all->info.var.yres);
+                                         info->var.xres);
+       par->fbsize = PAGE_ALIGN(linebytes * info->var.yres);
 
-       all->par.tec = of_ioremap(&op->resource[7], 0,
+       par->tec = of_ioremap(&op->resource[7], 0,
                                  sizeof(struct tcx_tec), "tcx tec");
-       all->par.thc = of_ioremap(&op->resource[9], 0,
+       par->thc = of_ioremap(&op->resource[9], 0,
                                  sizeof(struct tcx_thc), "tcx thc");
-       all->par.bt = of_ioremap(&op->resource[8], 0,
+       par->bt = of_ioremap(&op->resource[8], 0,
                                 sizeof(struct bt_regs), "tcx dac");
-       all->info.screen_base = of_ioremap(&op->resource[0], 0,
-                                          all->par.fbsize, "tcx ram");
-       if (!all->par.tec || !all->par.thc ||
-           !all->par.bt || !all->info.screen_base) {
-               tcx_unmap_regs(op, all);
-               kfree(all);
-               return -ENOMEM;
-       }
-
-       memcpy(&all->par.mmap_map, &__tcx_mmap_map, sizeof(all->par.mmap_map));
-       if (!all->par.lowdepth) {
-               all->par.cplane = of_ioremap(&op->resource[4], 0,
-                                            all->par.fbsize * sizeof(u32),
+       info->screen_base = of_ioremap(&op->resource[0], 0,
+                                          par->fbsize, "tcx ram");
+       if (!par->tec || !par->thc ||
+           !par->bt || !info->screen_base)
+               goto out_unmap_regs;
+
+       memcpy(&par->mmap_map, &__tcx_mmap_map, sizeof(par->mmap_map));
+       if (!par->lowdepth) {
+               par->cplane = of_ioremap(&op->resource[4], 0,
+                                            par->fbsize * sizeof(u32),
                                             "tcx cplane");
-               if (!all->par.cplane) {
-                       tcx_unmap_regs(op, all);
-                       kfree(all);
-                       return -ENOMEM;
-               }
+               if (!par->cplane)
+                       goto out_unmap_regs;
        } else {
-               all->par.mmap_map[1].size = SBUS_MMAP_EMPTY;
-               all->par.mmap_map[4].size = SBUS_MMAP_EMPTY;
-               all->par.mmap_map[5].size = SBUS_MMAP_EMPTY;
-               all->par.mmap_map[6].size = SBUS_MMAP_EMPTY;
+               par->mmap_map[1].size = SBUS_MMAP_EMPTY;
+               par->mmap_map[4].size = SBUS_MMAP_EMPTY;
+               par->mmap_map[5].size = SBUS_MMAP_EMPTY;
+               par->mmap_map[6].size = SBUS_MMAP_EMPTY;
        }
 
-       all->par.physbase = 0;
-       all->par.which_io = op->resource[0].flags & IORESOURCE_BITS;
+       par->physbase = 0;
+       par->which_io = op->resource[0].flags & IORESOURCE_BITS;
 
        for (i = 0; i < TCX_MMAP_ENTRIES; i++) {
                int j;
@@ -444,53 +438,54 @@ static int __devinit tcx_init_one(struct of_device *op)
                        j = i;
                        break;
                };
-               all->par.mmap_map[i].poff = op->resource[j].start;
+               par->mmap_map[i].poff = op->resource[j].start;
        }
 
-       all->info.flags = FBINFO_DEFAULT;
-       all->info.fbops = &tcx_ops;
-       all->info.par = &all->par;
+       info->flags = FBINFO_DEFAULT;
+       info->fbops = &tcx_ops;
 
        /* Initialize brooktree DAC. */
-       sbus_writel(0x04 << 24, &all->par.bt->addr);         /* color planes */
-       sbus_writel(0xff << 24, &all->par.bt->control);
-       sbus_writel(0x05 << 24, &all->par.bt->addr);
-       sbus_writel(0x00 << 24, &all->par.bt->control);
-       sbus_writel(0x06 << 24, &all->par.bt->addr);         /* overlay plane */
-       sbus_writel(0x73 << 24, &all->par.bt->control);
-       sbus_writel(0x07 << 24, &all->par.bt->addr);
-       sbus_writel(0x00 << 24, &all->par.bt->control);
-
-       tcx_reset(&all->info);
-
-       tcx_blank(FB_BLANK_UNBLANK, &all->info);
-
-       if (fb_alloc_cmap(&all->info.cmap, 256, 0)) {
-               tcx_unmap_regs(op, all);
-               kfree(all);
-               return -ENOMEM;
-       }
+       sbus_writel(0x04 << 24, &par->bt->addr);         /* color planes */
+       sbus_writel(0xff << 24, &par->bt->control);
+       sbus_writel(0x05 << 24, &par->bt->addr);
+       sbus_writel(0x00 << 24, &par->bt->control);
+       sbus_writel(0x06 << 24, &par->bt->addr);         /* overlay plane */
+       sbus_writel(0x73 << 24, &par->bt->control);
+       sbus_writel(0x07 << 24, &par->bt->addr);
+       sbus_writel(0x00 << 24, &par->bt->control);
+
+       tcx_reset(info);
 
-       fb_set_cmap(&all->info.cmap, &all->info);
-       tcx_init_fix(&all->info, linebytes);
+       tcx_blank(FB_BLANK_UNBLANK, info);
 
-       err = register_framebuffer(&all->info);
-       if (err < 0) {
-               fb_dealloc_cmap(&all->info.cmap);
-               tcx_unmap_regs(op, all);
-               kfree(all);
-               return err;
-       }
+       if (fb_alloc_cmap(&info->cmap, 256, 0))
+               goto out_unmap_regs;
+
+       fb_set_cmap(&info->cmap, info);
+       tcx_init_fix(info, linebytes);
+
+       err = register_framebuffer(info);
+       if (err < 0)
+               goto out_dealloc_cmap;
 
-       dev_set_drvdata(&op->dev, all);
+       dev_set_drvdata(&op->dev, info);
 
        printk("%s: TCX at %lx:%lx, %s\n",
               dp->full_name,
-              all->par.which_io,
+              par->which_io,
               op->resource[0].start,
-              all->par.lowdepth ? "8-bit only" : "24-bit depth");
+              par->lowdepth ? "8-bit only" : "24-bit depth");
 
        return 0;
+
+out_dealloc_cmap:
+       fb_dealloc_cmap(&info->cmap);
+
+out_unmap_regs:
+       tcx_unmap_regs(op, info, par);
+
+out_err:
+       return err;
 }
 
 static int __devinit tcx_probe(struct of_device *dev, const struct of_device_id *match)
@@ -502,14 +497,15 @@ static int __devinit tcx_probe(struct of_device *dev, const struct of_device_id
 
 static int __devexit tcx_remove(struct of_device *op)
 {
-       struct all_info *all = dev_get_drvdata(&op->dev);
+       struct fb_info *info = dev_get_drvdata(&op->dev);
+       struct tcx_par *par = info->par;
 
-       unregister_framebuffer(&all->info);
-       fb_dealloc_cmap(&all->info.cmap);
+       unregister_framebuffer(info);
+       fb_dealloc_cmap(&info->cmap);
 
-       tcx_unmap_regs(op, all);
+       tcx_unmap_regs(op, info, par);
 
-       kfree(all);
+       framebuffer_release(info);
 
        dev_set_drvdata(&op->dev, NULL);
 
index 89facb73edfcfff079ece1b6ce0aa140efd4b697..d292a37ec7d64a2d74e15eac5329fdc0bcf1c371 100644 (file)
@@ -849,7 +849,7 @@ tgafb_clut_imageblit(struct fb_info *info, const struct fb_image *image)
        u32 *palette = ((u32 *)info->pseudo_palette);
        unsigned long pos, line_length, i, j;
        const unsigned char *data;
-       void *regs_base, *fb_base;
+       void __iomem *regs_base, *fb_base;
 
        dx = image->dx;
        dy = image->dy;
diff --git a/drivers/video/tx3912fb.c b/drivers/video/tx3912fb.c
deleted file mode 100644 (file)
index e6f7c78..0000000
+++ /dev/null
@@ -1,326 +0,0 @@
-/*
- *  drivers/video/tx3912fb.c
- *
- *  Copyright (C) 1999 Harald Koerfgen
- *  Copyright (C) 2001 Steven Hill (sjhill@realitydiluted.com)
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file COPYING in the main directory of this archive for
- * more details.
- *
- *  Framebuffer for LCD controller in TMPR3912/05 and PR31700 processors
- */
-#include <linux/module.h>
-#include <linux/kernel.h>
-#include <linux/errno.h>
-#include <linux/string.h>
-#include <linux/delay.h>
-#include <linux/interrupt.h>
-#include <linux/init.h>
-#include <linux/pm.h>
-#include <linux/fb.h>
-#include <asm/io.h>
-#include <asm/bootinfo.h>
-#include <asm/uaccess.h>
-#include <asm/tx3912.h>
-#include <video/tx3912.h>
-
-/*
- * Frame buffer, palette and console structures
- */
-static struct fb_info fb_info;
-static u32 cfb8[16];
-
-static struct fb_fix_screeninfo tx3912fb_fix __initdata = {
-       .id =           "tx3912fb",
-       .smem_len =     ((240 * 320)/2),
-       .type =         FB_TYPE_PACKED_PIXELS,
-       .visual =       FB_VISUAL_TRUECOLOR, 
-       .xpanstep =     1,
-       .ypanstep =     1,
-       .ywrapstep =    1,
-       .accel =        FB_ACCEL_NONE,
-};
-
-static struct fb_var_screeninfo tx3912fb_var = {
-       .xres =         240,
-       .yres =         320,
-       .xres_virtual = 240,
-       .yres_virtual = 320,
-       .bits_per_pixel =4,
-       .red =          { 0, 4, 0 },    /* ??? */
-       .green =        { 0, 4, 0 },
-       .blue =         { 0, 4, 0 },
-       .activate =     FB_ACTIVATE_NOW,
-       .width =        -1,
-       .height =       -1,
-       .pixclock =     20000,
-       .left_margin =  64,
-       .right_margin = 64,
-       .upper_margin = 32,
-       .lower_margin = 32,
-       .hsync_len =    64,
-       .vsync_len =    2,
-       .vmode =        FB_VMODE_NONINTERLACED,
-};
-
-/*
- * Interface used by the world
- */
-int tx3912fb_init(void);
-
-static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green,
-                             u_int blue, u_int transp,
-                             struct fb_info *info);
-
-/*
- * Macros
- */
-#define get_line_length(xres_virtual, bpp) \
-                (u_long) (((int) xres_virtual * (int) bpp + 7) >> 3)
-
-/*
- * Frame buffer operations structure used by console driver
- */
-static struct fb_ops tx3912fb_ops = {
-       .owner          = THIS_MODULE,
-       .fb_setcolreg   = tx3912fb_setcolreg,
-       .fb_fillrect    = cfb_fillrect,
-       .fb_copyarea    = cfb_copyarea,
-       .fb_imageblit   = cfb_imageblit,
-};
-
-static int tx3912fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
-{
-       /*
-        * Memory limit
-        */
-       line_length =
-           get_line_length(var->xres_virtual, var->bits_per_pixel);
-       if ((line_length * var->yres_virtual) > info->fix.smem_len)
-               return -ENOMEM;
-
-       return 0;
-}
-
-static int tx3912fb_set_par(struct fb_info *info)
-{
-       u_long tx3912fb_paddr = 0;
-
-       /* Disable the video logic */
-       outl(inl(TX3912_VIDEO_CTRL1) &
-            ~(TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON),
-            TX3912_VIDEO_CTRL1);
-       udelay(200);
-
-       /* Set start address for DMA transfer */
-       outl(tx3912fb_paddr, TX3912_VIDEO_CTRL3);
-
-       /* Set end address for DMA transfer */
-       outl((tx3912fb_paddr + tx3912fb_fix.smem_len + 1), TX3912_VIDEO_CTRL4);
-
-       /* Set the pixel depth */
-       switch (info->var.bits_per_pixel) {
-       case 1:
-               /* Monochrome */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               info->fix.visual = FB_VISUAL_MONO10;
-               break;
-       case 4:
-               /* 4-bit gray */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               outl(inl(TX3912_VIDEO_CTRL1) |
-                    TX3912_VIDEO_CTRL1_BITSEL_4BIT_GRAY,
-                    TX3912_VIDEO_CTRL1);
-               info->fix.visual = FB_VISUAL_TRUECOLOR;
-               break;
-       case 8:
-               /* 8-bit color */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               outl(inl(TX3912_VIDEO_CTRL1) |
-                    TX3912_VIDEO_CTRL1_BITSEL_8BIT_COLOR,
-                    TX3912_VIDEO_CTRL1);
-               info->fix.visual = FB_VISUAL_TRUECOLOR;
-               break;
-       case 2:
-       default:
-               /* 2-bit gray */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               outl(inl(TX3912_VIDEO_CTRL1) |
-                    TX3912_VIDEO_CTRL1_BITSEL_2BIT_GRAY,
-                    TX3912_VIDEO_CTRL1);
-               info->fix.visual = FB_VISUAL_PSEUDOCOLOR;
-               break;
-       }
-
-       /* Enable the video clock */
-       outl(inl(TX3912_CLK_CTRL) | TX3912_CLK_CTRL_ENVIDCLK,
-            TX3912_CLK_CTRL);
-
-       /* Unfreeze video logic and enable DF toggle */
-       outl(inl(TX3912_VIDEO_CTRL1) &
-            ~(TX3912_VIDEO_CTRL1_ENFREEZEFRAME |
-              TX3912_VIDEO_CTRL1_DFMODE)
-            , TX3912_VIDEO_CTRL1);
-       udelay(200);
-
-       /* Enable the video logic */
-       outl(inl(TX3912_VIDEO_CTRL1) |
-            (TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON),
-            TX3912_VIDEO_CTRL1);
-
-       info->fix.line_length = get_line_length(var->xres_virtual,
-                                           var->bits_per_pixel);
-}
-
-/*
- * Set a single color register
- */
-static int tx3912fb_setcolreg(u_int regno, u_int red, u_int green,
-                             u_int blue, u_int transp,
-                             struct fb_info *info)
-{
-       if (regno > 255)
-               return 1;
-
-       if (regno < 16)
-               ((u32 *)(info->pseudo_palette))[regno] = ((red & 0xe000) >> 8)
-                   | ((green & 0xe000) >> 11)
-                   | ((blue & 0xc000) >> 14);
-       return 0;
-}
-
-int __init tx3912fb_setup(char *options);
-
-/*
- * Initialization of the framebuffer
- */
-int __init tx3912fb_init(void)
-{
-       u_long tx3912fb_paddr = 0;
-       int size = (info->var.bits_per_pixel == 8) ? 256 : 16;
-       char *option = NULL;
-
-       if (fb_get_options("tx3912fb", &option))
-               return -ENODEV;
-       tx3912fb_setup(option);
-
-       /* Disable the video logic */
-       outl(inl(TX3912_VIDEO_CTRL1) &
-            ~(TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON),
-            TX3912_VIDEO_CTRL1);
-       udelay(200);
-
-       /* Set start address for DMA transfer */
-       outl(tx3912fb_paddr, TX3912_VIDEO_CTRL3);
-
-       /* Set end address for DMA transfer */
-       outl((tx3912fb_paddr + tx3912fb_fix.smem_len + 1), TX3912_VIDEO_CTRL4);
-
-       /* Set the pixel depth */
-       switch (tx3912fb_var.bits_per_pixel) {
-       case 1:
-               /* Monochrome */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               tx3912fb_fix.visual = FB_VISUAL_MONO10;
-               break;
-       case 4:
-               /* 4-bit gray */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               outl(inl(TX3912_VIDEO_CTRL1) |
-                    TX3912_VIDEO_CTRL1_BITSEL_4BIT_GRAY,
-                    TX3912_VIDEO_CTRL1);
-               tx3912fb_fix.visual = FB_VISUAL_TRUECOLOR;
-               tx3912fb_fix.grayscale = 1;
-               break;
-       case 8:
-               /* 8-bit color */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               outl(inl(TX3912_VIDEO_CTRL1) |
-                    TX3912_VIDEO_CTRL1_BITSEL_8BIT_COLOR,
-                    TX3912_VIDEO_CTRL1);
-               tx3912fb_fix.visual = FB_VISUAL_TRUECOLOR;
-               break;
-       case 2:
-       default:
-               /* 2-bit gray */
-               outl(inl(TX3912_VIDEO_CTRL1) &
-                    ~TX3912_VIDEO_CTRL1_BITSEL_MASK, TX3912_VIDEO_CTRL1);
-               outl(inl(TX3912_VIDEO_CTRL1) |
-                    TX3912_VIDEO_CTRL1_BITSEL_2BIT_GRAY,
-                    TX3912_VIDEO_CTRL1);
-               tx3912fb_fix.visual = FB_VISUAL_PSEUDOCOLOR;
-               tx3912fb_fix.grayscale = 1;
-               break;
-       }
-
-       /* Enable the video clock */
-       outl(inl(TX3912_CLK_CTRL) | TX3912_CLK_CTRL_ENVIDCLK,
-               TX3912_CLK_CTRL);
-
-       /* Unfreeze video logic and enable DF toggle */
-       outl(inl(TX3912_VIDEO_CTRL1) &
-               ~(TX3912_VIDEO_CTRL1_ENFREEZEFRAME | TX3912_VIDEO_CTRL1_DFMODE),
-               TX3912_VIDEO_CTRL1);
-       udelay(200);
-
-       /* Clear the framebuffer */
-       memset((void *) tx3912fb_fix.smem_start, 0xff, tx3912fb_fix.smem_len);
-       udelay(200);
-
-       /* Enable the video logic */
-       outl(inl(TX3912_VIDEO_CTRL1) |
-               (TX3912_VIDEO_CTRL1_ENVID | TX3912_VIDEO_CTRL1_DISPON),
-               TX3912_VIDEO_CTRL1);
-
-       /*
-        * Memory limit
-        */
-       tx3912fb_fix.line_length =
-           get_line_length(tx3912fb_var.xres_virtual, tx3912fb_var.bits_per_pixel);
-       if ((tx3912fb_fix.line_length * tx3912fb_var.yres_virtual) > tx3912fb_fix.smem_len)
-               return -ENOMEM;
-
-       fb_info.fbops = &tx3912fb_ops;
-       fb_info.var = tx3912fb_var;
-       fb_info.fix = tx3912fb_fix;
-       fb_info.pseudo_palette = cfb8;
-       fb_info.flags = FBINFO_DEFAULT;
-
-       /* Clear the framebuffer */
-       memset((void *) fb_info.fix.smem_start, 0xff, fb_info.fix.smem_len);
-       udelay(200);
-
-       fb_alloc_cmap(&info->cmap, size, 0);
-
-       if (register_framebuffer(&fb_info) < 0)
-               return -1;
-
-       printk(KERN_INFO "fb%d: TX3912 frame buffer using %uKB.\n",
-              fb_info.node, (u_int) (fb_info.fix.smem_len >> 10));
-       return 0;
-}
-
-int __init tx3912fb_setup(char *options)
-{
-       char *this_opt;
-
-       if (!options || !*options)
-               return 0;
-
-       while ((this_opt = strsep(&options, ","))) {
-               if (!strncmp(options, "bpp:", 4))       
-                       tx3912fb_var.bits_per_pixel = simple_strtoul(options+4, NULL, 0);
-       }       
-       return 0;
-}
-
-module_init(tx3912fb_init);
-MODULE_LICENSE("GPL");
index 1d29a89a86b468da702c56f5d22372ae285ee57c..6ef9733a18d4ca2aa7294a803006e319993d48c5 100644 (file)
@@ -79,7 +79,7 @@
 /*
  * Here are the default fb_fix_screeninfo and fb_var_screeninfo structures
  */
-static struct fb_fix_screeninfo xilinx_fb_fix __initdata = {
+static struct fb_fix_screeninfo xilinx_fb_fix = {
        .id =           "Xilinx",
        .type =         FB_TYPE_PACKED_PIXELS,
        .visual =       FB_VISUAL_TRUECOLOR,
@@ -88,7 +88,7 @@ static struct fb_fix_screeninfo xilinx_fb_fix __initdata = {
        .accel =        FB_ACCEL_NONE
 };
 
-static struct fb_var_screeninfo xilinx_fb_var __initdata = {
+static struct fb_var_screeninfo xilinx_fb_var = {
        .xres =                 XRES,
        .yres =                 YRES,
        .xres_virtual =         XRES_VIRTUAL,
@@ -212,11 +212,6 @@ xilinxfb_drv_probe(struct device *dev)
        pdev = to_platform_device(dev);
        pdata = pdev->dev.platform_data;
 
-       if (pdata == NULL) {
-               printk(KERN_ERR "Couldn't find platform data.\n");
-               return -EFAULT;
-       }
-
        drvdata = kzalloc(sizeof(*drvdata), GFP_KERNEL);
        if (!drvdata) {
                printk(KERN_ERR "Couldn't allocate device private record\n");
@@ -258,11 +253,9 @@ xilinxfb_drv_probe(struct device *dev)
        xilinx_fb_out_be32(drvdata, REG_FB_ADDR, drvdata->fb_phys);
 
        /* Turn on the display */
-       if (pdata->rotate_screen) {
-               drvdata->reg_ctrl_default = REG_CTRL_ENABLE | REG_CTRL_ROTATE;
-       } else {
-               drvdata->reg_ctrl_default = REG_CTRL_ENABLE;
-       }
+       drvdata->reg_ctrl_default = REG_CTRL_ENABLE;
+       if (pdata && pdata->rotate_screen)
+               drvdata->reg_ctrl_default |= REG_CTRL_ROTATE;
        xilinx_fb_out_be32(drvdata, REG_CTRL, drvdata->reg_ctrl_default);
 
        /* Fill struct fb_info */
@@ -281,8 +274,10 @@ xilinxfb_drv_probe(struct device *dev)
        }
 
        drvdata->info.flags = FBINFO_DEFAULT;
-       xilinx_fb_var.height = pdata->screen_height_mm;
-       xilinx_fb_var.width = pdata->screen_width_mm;
+       if (pdata) {
+               xilinx_fb_var.height = pdata->screen_height_mm;
+               xilinx_fb_var.width = pdata->screen_width_mm;
+       }
        drvdata->info.var = xilinx_fb_var;
 
        /* Register new frame buffer */
index 763bc73e50708daa47362c17cd6c6c45964a89dc..4b696641ce33a94d7ba3ae36fc86b45114f0e690 100644 (file)
@@ -85,7 +85,7 @@ static struct {
 };
 
 struct ds1wm_data {
-       void            *map;
+       void            __iomem *map;
        int             bus_shift; /* # of shifts to calc register offsets */
        struct platform_device *pdev;
        struct ds1wm_platform_data *pdata;
index 9e943fbce81b7a58a38c06fcde362bae7999d1de..227d53b12a5cc05490687f6e9f3c9e5725b147f2 100644 (file)
@@ -782,8 +782,8 @@ static int process_msg(void)
                msg->u.watch.vec = split(body, msg->hdr.len,
                                         &msg->u.watch.vec_size);
                if (IS_ERR(msg->u.watch.vec)) {
-                       kfree(msg);
                        err = PTR_ERR(msg->u.watch.vec);
+                       kfree(msg);
                        goto out;
                }
 
index 4f77f3caee97469f73694b74cd69cb8df3b25d3c..af6952e39a186c2fd9bbc05411320eb81415575c 100644 (file)
@@ -19,6 +19,7 @@ static void afs_fl_copy_lock(struct file_lock *new, struct file_lock *fl);
 static void afs_fl_release_private(struct file_lock *fl);
 
 static struct workqueue_struct *afs_lock_manager;
+static DEFINE_MUTEX(afs_lock_manager_mutex);
 
 static struct file_lock_operations afs_lock_ops = {
        .fl_copy_lock           = afs_fl_copy_lock,
@@ -30,12 +31,20 @@ static struct file_lock_operations afs_lock_ops = {
  */
 static int afs_init_lock_manager(void)
 {
+       int ret;
+
+       ret = 0;
        if (!afs_lock_manager) {
-               afs_lock_manager = create_singlethread_workqueue("kafs_lockd");
-               if (!afs_lock_manager)
-                       return -ENOMEM;
+               mutex_lock(&afs_lock_manager_mutex);
+               if (!afs_lock_manager) {
+                       afs_lock_manager =
+                               create_singlethread_workqueue("kafs_lockd");
+                       if (!afs_lock_manager)
+                               ret = -ENOMEM;
+               }
+               mutex_unlock(&afs_lock_manager_mutex);
        }
-       return 0;
+       return ret;
 }
 
 /*
@@ -67,6 +76,29 @@ static void afs_schedule_lock_extension(struct afs_vnode *vnode)
                           AFS_LOCKWAIT * HZ / 2);
 }
 
+/*
+ * grant one or more locks (readlocks are allowed to jump the queue if the
+ * first lock in the queue is itself a readlock)
+ * - the caller must hold the vnode lock
+ */
+static void afs_grant_locks(struct afs_vnode *vnode, struct file_lock *fl)
+{
+       struct file_lock *p, *_p;
+
+       list_move_tail(&fl->fl_u.afs.link, &vnode->granted_locks);
+       if (fl->fl_type == F_RDLCK) {
+               list_for_each_entry_safe(p, _p, &vnode->pending_locks,
+                                        fl_u.afs.link) {
+                       if (p->fl_type == F_RDLCK) {
+                               p->fl_u.afs.state = AFS_LOCK_GRANTED;
+                               list_move_tail(&p->fl_u.afs.link,
+                                              &vnode->granted_locks);
+                               wake_up(&p->fl_wait);
+                       }
+               }
+       }
+}
+
 /*
  * do work for a lock, including:
  * - probing for a lock we're waiting on but didn't get immediately
@@ -172,8 +204,7 @@ void afs_lock_work(struct work_struct *work)
                                       struct file_lock, fl_u.afs.link) == fl) {
                                fl->fl_u.afs.state = ret;
                                if (ret == AFS_LOCK_GRANTED)
-                                       list_move_tail(&fl->fl_u.afs.link,
-                                                      &vnode->granted_locks);
+                                       afs_grant_locks(vnode, fl);
                                else
                                        list_del_init(&fl->fl_u.afs.link);
                                wake_up(&fl->fl_wait);
@@ -258,49 +289,50 @@ static int afs_do_setlk(struct file *file, struct file_lock *fl)
 
        spin_lock(&vnode->lock);
 
-       if (list_empty(&vnode->pending_locks)) {
-               /* if there's no-one else with a lock on this vnode, then we
-                * need to ask the server for a lock */
-               if (list_empty(&vnode->granted_locks)) {
-                       _debug("not locked");
-                       ASSERTCMP(vnode->flags &
-                                 ((1 << AFS_VNODE_LOCKING) |
-                                  (1 << AFS_VNODE_READLOCKED) |
-                                  (1 << AFS_VNODE_WRITELOCKED)), ==, 0);
-                       list_add_tail(&fl->fl_u.afs.link, &vnode->pending_locks);
-                       set_bit(AFS_VNODE_LOCKING, &vnode->flags);
-                       spin_unlock(&vnode->lock);
+       /* if we've already got a readlock on the server then we can instantly
+        * grant another readlock, irrespective of whether there are any
+        * pending writelocks */
+       if (type == AFS_LOCK_READ &&
+           vnode->flags & (1 << AFS_VNODE_READLOCKED)) {
+               _debug("instant readlock");
+               ASSERTCMP(vnode->flags &
+                         ((1 << AFS_VNODE_LOCKING) |
+                          (1 << AFS_VNODE_WRITELOCKED)), ==, 0);
+               ASSERT(!list_empty(&vnode->granted_locks));
+               goto sharing_existing_lock;
+       }
 
-                       ret = afs_vnode_set_lock(vnode, key, type);
-                       clear_bit(AFS_VNODE_LOCKING, &vnode->flags);
-                       switch (ret) {
-                       case 0:
-                               goto acquired_server_lock;
-                       case -EWOULDBLOCK:
-                               spin_lock(&vnode->lock);
-                               ASSERT(list_empty(&vnode->granted_locks));
-                               ASSERTCMP(vnode->pending_locks.next, ==,
-                                         &fl->fl_u.afs.link);
-                               goto wait;
-                       default:
-                               spin_lock(&vnode->lock);
-                               list_del_init(&fl->fl_u.afs.link);
-                               spin_unlock(&vnode->lock);
-                               goto error;
-                       }
-               }
+       /* if there's no-one else with a lock on this vnode, then we need to
+        * ask the server for a lock */
+       if (list_empty(&vnode->pending_locks) &&
+           list_empty(&vnode->granted_locks)) {
+               _debug("not locked");
+               ASSERTCMP(vnode->flags &
+                         ((1 << AFS_VNODE_LOCKING) |
+                          (1 << AFS_VNODE_READLOCKED) |
+                          (1 << AFS_VNODE_WRITELOCKED)), ==, 0);
+               list_add_tail(&fl->fl_u.afs.link, &vnode->pending_locks);
+               set_bit(AFS_VNODE_LOCKING, &vnode->flags);
+               spin_unlock(&vnode->lock);
 
-               /* if we've already got a readlock on the server and no waiting
-                * writelocks, then we might be able to instantly grant another
-                * readlock */
-               if (type == AFS_LOCK_READ &&
-                   vnode->flags & (1 << AFS_VNODE_READLOCKED)) {
-                       _debug("instant readlock");
-                       ASSERTCMP(vnode->flags &
-                                 ((1 << AFS_VNODE_LOCKING) |
-                                  (1 << AFS_VNODE_WRITELOCKED)), ==, 0);
-                       ASSERT(!list_empty(&vnode->granted_locks));
-                       goto sharing_existing_lock;
+               ret = afs_vnode_set_lock(vnode, key, type);
+               clear_bit(AFS_VNODE_LOCKING, &vnode->flags);
+               switch (ret) {
+               case 0:
+                       _debug("acquired");
+                       goto acquired_server_lock;
+               case -EWOULDBLOCK:
+                       _debug("would block");
+                       spin_lock(&vnode->lock);
+                       ASSERT(list_empty(&vnode->granted_locks));
+                       ASSERTCMP(vnode->pending_locks.next, ==,
+                                 &fl->fl_u.afs.link);
+                       goto wait;
+               default:
+                       spin_lock(&vnode->lock);
+                       list_del_init(&fl->fl_u.afs.link);
+                       spin_unlock(&vnode->lock);
+                       goto error;
                }
        }
 
index e440a7b95d0275769f5f89124c69c39259785c2f..a6c9078af124b1af134c1adb6d0d229ae55e9c12 100644 (file)
 #include <linux/dvb/video.h>
 #include <linux/lp.h>
 
+#ifdef CONFIG_SPARC
+#include <asm/fbio.h>
+#endif
+
 static int do_ioctl32_pointer(unsigned int fd, unsigned int cmd,
                              unsigned long arg, struct file *f)
 {
@@ -3157,12 +3161,9 @@ COMPATIBLE_IOCTL(SIOCSIWSENS)
 COMPATIBLE_IOCTL(SIOCGIWSENS)
 COMPATIBLE_IOCTL(SIOCSIWRANGE)
 COMPATIBLE_IOCTL(SIOCSIWPRIV)
-COMPATIBLE_IOCTL(SIOCGIWPRIV)
 COMPATIBLE_IOCTL(SIOCSIWSTATS)
-COMPATIBLE_IOCTL(SIOCGIWSTATS)
 COMPATIBLE_IOCTL(SIOCSIWAP)
 COMPATIBLE_IOCTL(SIOCGIWAP)
-COMPATIBLE_IOCTL(SIOCSIWSCAN)
 COMPATIBLE_IOCTL(SIOCSIWRATE)
 COMPATIBLE_IOCTL(SIOCGIWRATE)
 COMPATIBLE_IOCTL(SIOCSIWRTS)
@@ -3493,6 +3494,22 @@ IGNORE_IOCTL(VFAT_IOCTL_READDIR_SHORT32)
 
 /* loop */
 IGNORE_IOCTL(LOOP_CLR_FD)
+
+#ifdef CONFIG_SPARC
+/* Sparc framebuffers, handled in sbusfb_compat_ioctl() */
+IGNORE_IOCTL(FBIOGTYPE)
+IGNORE_IOCTL(FBIOSATTR)
+IGNORE_IOCTL(FBIOGATTR)
+IGNORE_IOCTL(FBIOSVIDEO)
+IGNORE_IOCTL(FBIOGVIDEO)
+IGNORE_IOCTL(FBIOSCURPOS)
+IGNORE_IOCTL(FBIOGCURPOS)
+IGNORE_IOCTL(FBIOGCURMAX)
+IGNORE_IOCTL(FBIOPUTCMAP32)
+IGNORE_IOCTL(FBIOGETCMAP32)
+IGNORE_IOCTL(FBIOSCURSOR32)
+IGNORE_IOCTL(FBIOGCURSOR32)
+#endif
 };
 
 #define IOCTL_HASHSIZE 256
index c1208f53bd74596c74423f085886c859bf51cf3e..792cbf55fa9592cefbd6b2446ed26d573301beee 100644 (file)
@@ -20,6 +20,7 @@
 #include <linux/capability.h>
 #include <linux/dcache.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/errno.h>
 #include <linux/dcookies.h>
 #include <linux/mutex.h>
index 52bb2638f7ab703e9a3d5205b097ddbf90a071e2..6874785bb65a846bafc6eb4242875bac9439ba3c 100644 (file)
@@ -974,6 +974,7 @@ direct_io_worker(int rw, struct kiocb *iocb, struct inode *inode,
        dio->get_block = get_block;
        dio->end_io = end_io;
        dio->map_bh.b_private = NULL;
+       dio->map_bh.b_state = 0;
        dio->final_block_in_bio = -1;
        dio->next_block_for_io = -1;
 
index b455919c19984ad408d4ca498ad72f40a7d33d1f..2082daf083d86cdec3b3697e061f8f3ff703e867 100644 (file)
@@ -1670,9 +1670,10 @@ static int can_be_granted(struct dlm_rsb *r, struct dlm_lkb *lkb, int now,
    with a deadlk here, we'd have to generate something like grant_lock with
    the deadlk error.) */
 
-/* returns the highest requested mode of all blocked conversions */
+/* Returns the highest requested mode of all blocked conversions; sets
+   cw if there's a blocked conversion to DLM_LOCK_CW. */
 
-static int grant_pending_convert(struct dlm_rsb *r, int high)
+static int grant_pending_convert(struct dlm_rsb *r, int high, int *cw)
 {
        struct dlm_lkb *lkb, *s;
        int hi, demoted, quit, grant_restart, demote_restart;
@@ -1709,6 +1710,9 @@ static int grant_pending_convert(struct dlm_rsb *r, int high)
                }
 
                hi = max_t(int, lkb->lkb_rqmode, hi);
+
+               if (cw && lkb->lkb_rqmode == DLM_LOCK_CW)
+                       *cw = 1;
        }
 
        if (grant_restart)
@@ -1721,29 +1725,52 @@ static int grant_pending_convert(struct dlm_rsb *r, int high)
        return max_t(int, high, hi);
 }
 
-static int grant_pending_wait(struct dlm_rsb *r, int high)
+static int grant_pending_wait(struct dlm_rsb *r, int high, int *cw)
 {
        struct dlm_lkb *lkb, *s;
 
        list_for_each_entry_safe(lkb, s, &r->res_waitqueue, lkb_statequeue) {
                if (can_be_granted(r, lkb, 0, NULL))
                        grant_lock_pending(r, lkb);
-                else
+                else {
                        high = max_t(int, lkb->lkb_rqmode, high);
+                       if (lkb->lkb_rqmode == DLM_LOCK_CW)
+                               *cw = 1;
+               }
        }
 
        return high;
 }
 
+/* cw of 1 means there's a lock with a rqmode of DLM_LOCK_CW that's blocked
+   on either the convert or waiting queue.
+   high is the largest rqmode of all locks blocked on the convert or
+   waiting queue. */
+
+static int lock_requires_bast(struct dlm_lkb *gr, int high, int cw)
+{
+       if (gr->lkb_grmode == DLM_LOCK_PR && cw) {
+               if (gr->lkb_highbast < DLM_LOCK_EX)
+                       return 1;
+               return 0;
+       }
+
+       if (gr->lkb_highbast < high &&
+           !__dlm_compat_matrix[gr->lkb_grmode+1][high+1])
+               return 1;
+       return 0;
+}
+
 static void grant_pending_locks(struct dlm_rsb *r)
 {
        struct dlm_lkb *lkb, *s;
        int high = DLM_LOCK_IV;
+       int cw = 0;
 
        DLM_ASSERT(is_master(r), dlm_dump_rsb(r););
 
-       high = grant_pending_convert(r, high);
-       high = grant_pending_wait(r, high);
+       high = grant_pending_convert(r, high, &cw);
+       high = grant_pending_wait(r, high, &cw);
 
        if (high == DLM_LOCK_IV)
                return;
@@ -1751,27 +1778,41 @@ static void grant_pending_locks(struct dlm_rsb *r)
        /*
         * If there are locks left on the wait/convert queue then send blocking
         * ASTs to granted locks based on the largest requested mode (high)
-        * found above. FIXME: highbast < high comparison not valid for PR/CW.
+        * found above.
         */
 
        list_for_each_entry_safe(lkb, s, &r->res_grantqueue, lkb_statequeue) {
-               if (lkb->lkb_bastaddr && (lkb->lkb_highbast < high) &&
-                   !__dlm_compat_matrix[lkb->lkb_grmode+1][high+1]) {
-                       queue_bast(r, lkb, high);
+               if (lkb->lkb_bastaddr && lock_requires_bast(lkb, high, cw)) {
+                       if (cw && high == DLM_LOCK_PR)
+                               queue_bast(r, lkb, DLM_LOCK_CW);
+                       else
+                               queue_bast(r, lkb, high);
                        lkb->lkb_highbast = high;
                }
        }
 }
 
+static int modes_require_bast(struct dlm_lkb *gr, struct dlm_lkb *rq)
+{
+       if ((gr->lkb_grmode == DLM_LOCK_PR && rq->lkb_rqmode == DLM_LOCK_CW) ||
+           (gr->lkb_grmode == DLM_LOCK_CW && rq->lkb_rqmode == DLM_LOCK_PR)) {
+               if (gr->lkb_highbast < DLM_LOCK_EX)
+                       return 1;
+               return 0;
+       }
+
+       if (gr->lkb_highbast < rq->lkb_rqmode && !modes_compat(gr, rq))
+               return 1;
+       return 0;
+}
+
 static void send_bast_queue(struct dlm_rsb *r, struct list_head *head,
                            struct dlm_lkb *lkb)
 {
        struct dlm_lkb *gr;
 
        list_for_each_entry(gr, head, lkb_statequeue) {
-               if (gr->lkb_bastaddr &&
-                   gr->lkb_highbast < lkb->lkb_rqmode &&
-                   !modes_compat(gr, lkb)) {
+               if (gr->lkb_bastaddr && modes_require_bast(gr, lkb)) {
                        queue_bast(r, gr, lkb->lkb_rqmode);
                        gr->lkb_highbast = lkb->lkb_rqmode;
                }
@@ -2235,7 +2276,7 @@ static int do_convert(struct dlm_rsb *r, struct dlm_lkb *lkb)
           before we try again to grant this one. */
 
        if (is_demoted(lkb)) {
-               grant_pending_convert(r, DLM_LOCK_IV);
+               grant_pending_convert(r, DLM_LOCK_IV, NULL);
                if (_can_be_granted(r, lkb, 1)) {
                        grant_lock(r, lkb);
                        queue_cast(r, lkb, 0);
index dd362739d291e8a5d125ec2d2172e19d497bdecc..9e9d2e82f40fb36a62307e92b5ab48285a3c4654 100644 (file)
@@ -313,6 +313,7 @@ static void make_sockaddr(struct sockaddr_storage *saddr, uint16_t port,
                in6_addr->sin6_port = cpu_to_be16(port);
                *addr_len = sizeof(struct sockaddr_in6);
        }
+       memset((char *)saddr + *addr_len, 0, sizeof(struct sockaddr_storage) - *addr_len);
 }
 
 /* Close a remote connection and tidy up */
@@ -332,8 +333,19 @@ static void close_connection(struct connection *con, bool and_other)
                __free_page(con->rx_page);
                con->rx_page = NULL;
        }
-       con->retries = 0;
-       mutex_unlock(&con->sock_mutex);
+
+       /* If we are an 'othercon' then NULL the pointer to us
+          from the parent and tidy ourself up */
+       if (test_bit(CF_IS_OTHERCON, &con->flags)) {
+               struct connection *parent = __nodeid2con(con->nodeid, 0);
+               parent->othercon = NULL;
+               kmem_cache_free(con_cache, con);
+       }
+       else {
+               /* Parent connections get reused */
+               con->retries = 0;
+               mutex_unlock(&con->sock_mutex);
+       }
 }
 
 /* We only send shutdown messages to nodes that are not part of the cluster */
@@ -631,7 +643,7 @@ out_resched:
 
 out_close:
        mutex_unlock(&con->sock_mutex);
-       if (ret != -EAGAIN && !test_bit(CF_IS_OTHERCON, &con->flags)) {
+       if (ret != -EAGAIN) {
                close_connection(con, false);
                /* Reconnect when there is something to send */
        }
@@ -1122,8 +1134,6 @@ static int tcp_listen_for_all(void)
 
        log_print("Using TCP for communications");
 
-       set_bit(CF_IS_OTHERCON, &con->flags);
-
        sock = tcp_create_listen_sock(con, dlm_local_addr[0]);
        if (sock) {
                add_sock(sock, con);
@@ -1407,7 +1417,7 @@ void dlm_lowcomms_stop(void)
        for (i = 0; i <= max_nodeid; i++) {
                con = __nodeid2con(i, 0);
                if (con) {
-                       con->flags |= 0xFF;
+                       con->flags |= 0x0F;
                        if (con->sock)
                                con->sock->sk->sk_user_data = NULL;
                }
@@ -1423,8 +1433,6 @@ void dlm_lowcomms_stop(void)
                con = __nodeid2con(i, 0);
                if (con) {
                        close_connection(con, true);
-                       if (con->othercon)
-                               kmem_cache_free(con_cache, con->othercon);
                        kmem_cache_free(con_cache, con);
                }
        }
index 073599dced2ab4b2562f8f7df44db66aeaa079cc..d09977528f692c7e133a9d7702cae88411536e75 100644 (file)
@@ -56,8 +56,10 @@ static int dlm_add_member(struct dlm_ls *ls, int nodeid)
                return -ENOMEM;
 
        w = dlm_node_weight(ls->ls_name, nodeid);
-       if (w < 0)
+       if (w < 0) {
+               kfree(memb);
                return w;
+       }
 
        memb->nodeid = nodeid;
        memb->weight = w;
index e3a1527cbdbe7c8cd4bb0a8b6605e486b8ea538c..188b91c027e4b16a811c30b398654018ad63a771 100644 (file)
@@ -386,8 +386,7 @@ static void receive_rcom_lock_reply(struct dlm_ls *ls, struct dlm_rcom *rc_in)
        dlm_recover_process_copy(ls, rc_in);
 }
 
-static int send_ls_not_ready(struct dlm_ls *ls, int nodeid,
-                            struct dlm_rcom *rc_in)
+static int send_ls_not_ready(int nodeid, struct dlm_rcom *rc_in)
 {
        struct dlm_rcom *rc;
        struct rcom_config *rf;
@@ -395,7 +394,7 @@ static int send_ls_not_ready(struct dlm_ls *ls, int nodeid,
        char *mb;
        int mb_len = sizeof(struct dlm_rcom) + sizeof(struct rcom_config);
 
-       mh = dlm_lowcomms_get_buffer(nodeid, mb_len, ls->ls_allocation, &mb);
+       mh = dlm_lowcomms_get_buffer(nodeid, mb_len, GFP_NOFS, &mb);
        if (!mh)
                return -ENOBUFS;
        memset(mb, 0, mb_len);
@@ -465,7 +464,7 @@ void dlm_receive_rcom(struct dlm_header *hd, int nodeid)
                log_print("lockspace %x from %d type %x not found",
                          hd->h_lockspace, nodeid, rc->rc_type);
                if (rc->rc_type == DLM_RCOM_STATUS)
-                       send_ls_not_ready(ls, nodeid, rc);
+                       send_ls_not_ready(nodeid, rc);
                return;
        }
 
index 0a50942b4378479d5a9dee07a6d815a628468c2d..131954b3fb98b588db1802301c70ffe2c0196963 100644 (file)
@@ -353,6 +353,10 @@ static struct dentry *ecryptfs_lookup(struct inode *dir, struct dentry *dentry,
                ecryptfs_printk(KERN_DEBUG, "Is a symlink; returning\n");
                goto out;
        }
+       if (special_file(lower_inode->i_mode)) {
+               ecryptfs_printk(KERN_DEBUG, "Is a special file; returning\n");
+               goto out;
+       }
        if (!nd) {
                ecryptfs_printk(KERN_DEBUG, "We have a NULL nd, just leave"
                                "as we *think* we are about to unlink\n");
index e557a676692734193b85d091aceb04694d274716..a98497264fe8594d696ccaf9ffec4595133b9f87 100644 (file)
@@ -813,6 +813,15 @@ out:
        return rc;
 }
 
+static void do_sysfs_unregistration(void)
+{
+       sysfs_remove_file(&ecryptfs_subsys.kobj,
+                         &sysfs_attr_version.attr);
+       sysfs_remove_file(&ecryptfs_subsys.kobj,
+                         &sysfs_attr_version_str.attr);
+       subsystem_unregister(&ecryptfs_subsys);
+}
+
 static int __init ecryptfs_init(void)
 {
        int rc;
@@ -851,6 +860,9 @@ static int __init ecryptfs_init(void)
        if (rc) {
                ecryptfs_printk(KERN_ERR, "Failure occured while attempting to "
                                "initialize the eCryptfs netlink socket\n");
+               do_sysfs_unregistration();
+               unregister_filesystem(&ecryptfs_fs_type);
+               ecryptfs_free_kmem_caches();
        }
 out:
        return rc;
@@ -858,11 +870,7 @@ out:
 
 static void __exit ecryptfs_exit(void)
 {
-       sysfs_remove_file(&ecryptfs_subsys.kobj,
-                         &sysfs_attr_version.attr);
-       sysfs_remove_file(&ecryptfs_subsys.kobj,
-                         &sysfs_attr_version_str.attr);
-       subsystem_unregister(&ecryptfs_subsys);
+       do_sysfs_unregistration();
        ecryptfs_release_messaging(ecryptfs_transport);
        unregister_filesystem(&ecryptfs_fs_type);
        ecryptfs_free_kmem_caches();
index 7bdea7937ee896179e34b3fe0102f76803fedecb..ce62f7b65f17aa3963c67c8ff095974489b4f033 100644 (file)
--- a/fs/exec.c
+++ b/fs/exec.c
@@ -1084,9 +1084,12 @@ int flush_old_exec(struct linux_binprm * bprm)
         */
        current->mm->task_size = TASK_SIZE;
 
-       if (bprm->e_uid != current->euid || bprm->e_gid != current->egid || 
-           file_permission(bprm->file, MAY_READ) ||
-           (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
+       if (bprm->e_uid != current->euid || bprm->e_gid != current->egid) {
+               suid_keys(current);
+               set_dumpable(current->mm, suid_dumpable);
+               current->pdeath_signal = 0;
+       } else if (file_permission(bprm->file, MAY_READ) ||
+                       (bprm->interp_flags & BINPRM_FLAGS_ENFORCE_NONDUMP)) {
                suid_keys(current);
                set_dumpable(current->mm, suid_dumpable);
        }
@@ -1177,8 +1180,10 @@ void compute_creds(struct linux_binprm *bprm)
 {
        int unsafe;
 
-       if (bprm->e_uid != current->uid)
+       if (bprm->e_uid != current->uid) {
                suid_keys(current);
+               current->pdeath_signal = 0;
+       }
        exec_keys(current);
 
        task_lock(current);
index 68579a0ed3f0a6617b8ecbe59e9ce826f5be2f2d..639a32c3c9c1cea8a3da126c334284bd5be4e21d 100644 (file)
@@ -580,7 +580,7 @@ static int ext2_check_descriptors (struct super_block * sb)
                        return 0;
                }
                if (le32_to_cpu(gdp->bg_inode_table) < first_block ||
-                   le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group >
+                   le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 >
                    last_block)
                {
                        ext2_error (sb, "ext2_check_descriptors",
index f0614e3f1fe82dc927fb604c1be4ce30b2be2df9..22cfdd61c060eb88dbb22a91695a61e6a9c8e540 100644 (file)
@@ -1221,7 +1221,7 @@ static int ext3_check_descriptors (struct super_block * sb)
                        return 0;
                }
                if (le32_to_cpu(gdp->bg_inode_table) < first_block ||
-                   le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group >
+                   le32_to_cpu(gdp->bg_inode_table) + sbi->s_itb_per_group - 1 >
                    last_block)
                {
                        ext3_error (sb, "ext3_check_descriptors",
index 750c46f7d89345ab7a35742ec528612b7a2192ad..78beb096f57dd616d39d294b681930c4959bfc89 100644 (file)
@@ -1544,7 +1544,7 @@ int ext4_ext_walk_space(struct inode *inode, unsigned long block,
 
 static void
 ext4_ext_put_in_cache(struct inode *inode, __u32 block,
-                       __u32 len, __u32 start, int type)
+                       __u32 len, ext4_fsblk_t start, int type)
 {
        struct ext4_ext_cache *cex;
        BUG_ON(len == 0);
index 75adbb64e028e6c1e3d3acfb9baabdd2601ac9cd..4550b83ab1c99056db69654fc43539e4cce7e7aa 100644 (file)
@@ -1283,7 +1283,7 @@ static int ext4_check_descriptors (struct super_block * sb)
                }
                inode_table = ext4_inode_table(sb, gdp);
                if (inode_table < first_block ||
-                   inode_table + sbi->s_itb_per_group > last_block)
+                   inode_table + sbi->s_itb_per_group - 1 > last_block)
                {
                        ext4_error (sb, "ext4_check_descriptors",
                                    "Inode table for group %d"
index aff70f0698fdd887799e3d23a0057ea715714112..3b395c41b2f3f9acefc623e6e008949231b1e8d3 100644 (file)
@@ -486,8 +486,8 @@ static void databuf_lo_add(struct gfs2_sbd *sdp, struct gfs2_log_element *le)
                gfs2_pin(sdp, bd->bd_bh);
                tr->tr_num_databuf_new++;
        }
-       sdp->sd_log_num_databuf++;
        gfs2_log_lock(sdp);
+       sdp->sd_log_num_databuf++;
        list_add(&le->le_list, &sdp->sd_log_le_databuf);
        gfs2_log_unlock(sdp);
 }
@@ -523,7 +523,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
        struct buffer_head *bh = NULL,*bh1 = NULL;
        struct gfs2_log_descriptor *ld;
        unsigned int limit;
-       unsigned int total_dbuf = sdp->sd_log_num_databuf;
+       unsigned int total_dbuf;
        unsigned int total_jdata = sdp->sd_log_num_jdata;
        unsigned int num, n;
        __be64 *ptr = NULL;
@@ -535,6 +535,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
         * into the log along with a header
         */
        gfs2_log_lock(sdp);
+       total_dbuf = sdp->sd_log_num_databuf;
        bd2 = bd1 = list_prepare_entry(bd1, &sdp->sd_log_le_databuf,
                                       bd_le.le_list);
        while(total_dbuf) {
@@ -653,6 +654,7 @@ static void databuf_lo_before_commit(struct gfs2_sbd *sdp)
                                break;
                }
                bh = NULL;
+               BUG_ON(total_dbuf < num);
                total_dbuf -= num;
                total_jdata -= num;
        }
index 6f006a804db33c48310c5af608ed4aa53805625c..4864659555d4f94d49132a2727a4acd0b5e1d5e4 100644 (file)
@@ -82,19 +82,20 @@ int gfs2_mount_args(struct gfs2_sbd *sdp, char *data_arg, int remount)
        char *options, *o, *v;
        int error = 0;
 
-       /*  If someone preloaded options, use those instead  */
-       spin_lock(&gfs2_sys_margs_lock);
-       if (!remount && gfs2_sys_margs) {
-               data = gfs2_sys_margs;
-               gfs2_sys_margs = NULL;
-       }
-       spin_unlock(&gfs2_sys_margs_lock);
+       if (!remount) {
+               /*  If someone preloaded options, use those instead  */
+               spin_lock(&gfs2_sys_margs_lock);
+               if (gfs2_sys_margs) {
+                       data = gfs2_sys_margs;
+                       gfs2_sys_margs = NULL;
+               }
+               spin_unlock(&gfs2_sys_margs_lock);
 
-       /*  Set some defaults  */
-       memset(args, 0, sizeof(struct gfs2_args));
-       args->ar_num_glockd = GFS2_GLOCKD_DEFAULT;
-       args->ar_quota = GFS2_QUOTA_DEFAULT;
-       args->ar_data = GFS2_DATA_DEFAULT;
+               /*  Set some defaults  */
+               args->ar_num_glockd = GFS2_GLOCKD_DEFAULT;
+               args->ar_quota = GFS2_QUOTA_DEFAULT;
+               args->ar_data = GFS2_DATA_DEFAULT;
+       }
 
        /* Split the options into tokens with the "," character and
           process them */
index ce90032c010ec7176d8f31505a5c859833dc3650..42a5f58f6fca4adf5ad1faae9edec36939b05d2c 100644 (file)
@@ -416,7 +416,7 @@ static int gfs2_prepare_write(struct file *file, struct page *page,
 
        error = gfs2_trans_begin(sdp, rblocks, 0);
        if (error)
-               goto out;
+               goto out_trans_fail;
 
        if (gfs2_is_stuffed(ip)) {
                if (end > sdp->sd_sb.sb_bsize - sizeof(struct gfs2_dinode)) {
@@ -434,6 +434,7 @@ prepare_write:
 out:
        if (error) {
                gfs2_trans_end(sdp);
+out_trans_fail:
                if (alloc_required) {
                        gfs2_inplace_release(ip);
 out_qunlock:
index 1a5e8e893d7529e805ee016f6852a35423e128bf..94d76ace0b95b840427552c33636f3c0bab46fd3 100644 (file)
@@ -177,8 +177,8 @@ static const u32 fsflags_to_gfs2[32] = {
        [5] = GFS2_DIF_APPENDONLY,
        [7] = GFS2_DIF_NOATIME,
        [12] = GFS2_DIF_EXHASH,
-       [14] = GFS2_DIF_JDATA,
-       [20] = GFS2_DIF_DIRECTIO,
+       [14] = GFS2_DIF_INHERIT_JDATA,
+       [20] = GFS2_DIF_INHERIT_DIRECTIO,
 };
 
 static const u32 gfs2_to_fsflags[32] = {
@@ -187,8 +187,6 @@ static const u32 gfs2_to_fsflags[32] = {
        [gfs2fl_AppendOnly] = FS_APPEND_FL,
        [gfs2fl_NoAtime] = FS_NOATIME_FL,
        [gfs2fl_ExHash] = FS_INDEX_FL,
-       [gfs2fl_Jdata] = FS_JOURNAL_DATA_FL,
-       [gfs2fl_Directio] = FS_DIRECTIO_FL,
        [gfs2fl_InheritDirectio] = FS_DIRECTIO_FL,
        [gfs2fl_InheritJdata] = FS_JOURNAL_DATA_FL,
 };
@@ -207,6 +205,12 @@ static int gfs2_get_flags(struct file *filp, u32 __user *ptr)
                return error;
 
        fsflags = fsflags_cvt(gfs2_to_fsflags, ip->i_di.di_flags);
+       if (!S_ISDIR(inode->i_mode)) {
+               if (ip->i_di.di_flags & GFS2_DIF_JDATA)
+                       fsflags |= FS_JOURNAL_DATA_FL;
+               if (ip->i_di.di_flags & GFS2_DIF_DIRECTIO)
+                       fsflags |= FS_DIRECTIO_FL;
+       }
        if (put_user(fsflags, ptr))
                error = -EFAULT;
 
@@ -270,13 +274,6 @@ static int do_gfs2_set_flags(struct file *filp, u32 reqflags, u32 mask)
        if ((new_flags ^ flags) == 0)
                goto out;
 
-       if (S_ISDIR(inode->i_mode)) {
-               if ((new_flags ^ flags) & GFS2_DIF_JDATA)
-                       new_flags ^= (GFS2_DIF_JDATA|GFS2_DIF_INHERIT_JDATA);
-               if ((new_flags ^ flags) & GFS2_DIF_DIRECTIO)
-                       new_flags ^= (GFS2_DIF_DIRECTIO|GFS2_DIF_INHERIT_DIRECTIO);
-       }
-
        error = -EINVAL;
        if ((new_flags ^ flags) & ~GFS2_FLAGS_USER_SET)
                goto out;
@@ -315,11 +312,19 @@ out:
 
 static int gfs2_set_flags(struct file *filp, u32 __user *ptr)
 {
+       struct inode *inode = filp->f_path.dentry->d_inode;
        u32 fsflags, gfsflags;
        if (get_user(fsflags, ptr))
                return -EFAULT;
        gfsflags = fsflags_cvt(fsflags_to_gfs2, fsflags);
-       return do_gfs2_set_flags(filp, gfsflags, ~0);
+       if (!S_ISDIR(inode->i_mode)) {
+               if (gfsflags & GFS2_DIF_INHERIT_JDATA)
+                       gfsflags ^= (GFS2_DIF_JDATA | GFS2_DIF_INHERIT_JDATA);
+               if (gfsflags & GFS2_DIF_INHERIT_DIRECTIO)
+                       gfsflags ^= (GFS2_DIF_DIRECTIO | GFS2_DIF_INHERIT_DIRECTIO);
+               return do_gfs2_set_flags(filp, gfsflags, ~0);
+       }
+       return do_gfs2_set_flags(filp, gfsflags, ~GFS2_DIF_JDATA);
 }
 
 static long gfs2_ioctl(struct file *filp, unsigned int cmd, unsigned long arg)
@@ -508,7 +513,7 @@ static int gfs2_setlease(struct file *file, long arg, struct file_lock **fl)
         */
        if (!sdp->sd_args.ar_localflocks)
                return -EINVAL;
-       return setlease(file, arg, fl);
+       return generic_setlease(file, arg, fl);
 }
 
 /**
index e4e040625153aa29b2254e51276eb6ac9807380e..ce48c4594ec88f9dc9fb64eb8d0413c5a04cc272 100644 (file)
@@ -863,16 +863,19 @@ static struct inode *try_rgrp_unlink(struct gfs2_rgrpd *rgd, u64 *last_unlinked)
        u64 no_addr;
 
        for(;;) {
+               if (goal >= rgd->rd_data)
+                       break;
                goal = rgblk_search(rgd, goal, GFS2_BLKST_UNLINKED,
                                    GFS2_BLKST_UNLINKED);
-               if (goal == 0)
-                       return 0;
+               if (goal == BFITNOENT)
+                       break;
                no_addr = goal + rgd->rd_data0;
-               if (no_addr <= *last_unlinked)
+               goal++;
+               if (no_addr < *last_unlinked)
                        continue;
                *last_unlinked = no_addr;
                inode = gfs2_inode_lookup(rgd->rd_sbd->sd_vfs, DT_UNKNOWN,
-                                       no_addr, -1);
+                                         no_addr, -1);
                if (!IS_ERR(inode))
                        return inode;
        }
@@ -1313,7 +1316,7 @@ static u32 rgblk_search(struct gfs2_rgrpd *rgd, u32 goal,
                                    bi->bi_len, blk, new_state);
        }
 
-       return (blk == BFITNOENT) ? 0 : (bi->bi_start * GFS2_NBBY) + blk;
+       return (blk == BFITNOENT) ? blk : (bi->bi_start * GFS2_NBBY) + blk;
 }
 
 /**
@@ -1393,6 +1396,7 @@ u64 gfs2_alloc_data(struct gfs2_inode *ip)
                goal = rgd->rd_last_alloc_data;
 
        blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED);
+       BUG_ON(blk == BFITNOENT);
        rgd->rd_last_alloc_data = blk;
 
        block = rgd->rd_data0 + blk;
@@ -1437,6 +1441,7 @@ u64 gfs2_alloc_meta(struct gfs2_inode *ip)
                goal = rgd->rd_last_alloc_meta;
 
        blk = rgblk_search(rgd, goal, GFS2_BLKST_FREE, GFS2_BLKST_USED);
+       BUG_ON(blk == BFITNOENT);
        rgd->rd_last_alloc_meta = blk;
 
        block = rgd->rd_data0 + blk;
@@ -1478,6 +1483,7 @@ u64 gfs2_alloc_di(struct gfs2_inode *dip, u64 *generation)
 
        blk = rgblk_search(rgd, rgd->rd_last_alloc_meta,
                           GFS2_BLKST_FREE, GFS2_BLKST_DINODE);
+       BUG_ON(blk == BFITNOENT);
 
        rgd->rd_last_alloc_meta = blk;
 
index 95c72aa818677b9ced909477aa80deedbd9232bb..043b470fd3b67f42c325dbb90997730b2a38c84d 100644 (file)
@@ -846,6 +846,15 @@ root_found:
                goto out_no_root;
        if (!inode->i_op)
                goto out_bad_root;
+
+       /* Make sure the root inode is a directory */
+       if (!S_ISDIR(inode->i_mode)) {
+               printk(KERN_WARNING
+                       "isofs_fill_super: root inode is not a directory. "
+                       "Corrupted media?\n");
+               goto out_iput;
+       }
+
        /* get the root dentry */
        s->s_root = d_alloc_root(inode);
        if (!(s->s_root))
index 143c5530caf35ab48446cc3fbe38c6ace0fac41d..504643f2e98b7c39817cbcea2f944332ccba459d 100644 (file)
@@ -84,7 +84,7 @@ static int jffs2_garbage_collect_thread(void *_c)
        set_freezable();
        for (;;) {
                allow_signal(SIGHUP);
-
+       again:
                if (!jffs2_thread_should_wake(c)) {
                        set_current_state (TASK_INTERRUPTIBLE);
                        D1(printk(KERN_DEBUG "jffs2_garbage_collect_thread sleeping...\n"));
@@ -95,9 +95,6 @@ static int jffs2_garbage_collect_thread(void *_c)
                        schedule();
                }
 
-               if (try_to_freeze())
-                       continue;
-
                /* This thread is purely an optimisation. But if it runs when
                   other things could be running, it actually makes things a
                   lot worse. Use yield() and put it at the back of the runqueue
@@ -112,6 +109,9 @@ static int jffs2_garbage_collect_thread(void *_c)
                        siginfo_t info;
                        unsigned long signr;
 
+                       if (try_to_freeze())
+                               goto again;
+
                        signr = dequeue_signal_lock(current, &current->blocked, &info);
 
                        switch(signr) {
index 25126a062cae6c3927e3e2e9f2df76f21217bdb7..bc5509fe577b878f542ccf3334a412c1a375d258 100644 (file)
@@ -139,6 +139,11 @@ static inline struct jffs2_inode_cache *jffs2_raw_ref_to_ic(struct jffs2_raw_nod
 #define ref_obsolete(ref)      (((ref)->flash_offset & 3) == REF_OBSOLETE)
 #define mark_ref_normal(ref)    do { (ref)->flash_offset = ref_offset(ref) | REF_NORMAL; } while(0)
 
+/* Dirent nodes should be REF_PRISTINE only if they are not a deletion
+   dirent. Deletion dirents should be REF_NORMAL so that GC gets to
+   throw them away when appropriate */
+#define dirent_node_state(rd)  ( (je32_to_cpu((rd)->ino)?REF_PRISTINE:REF_NORMAL) )
+
 /* NB: REF_PRISTINE for an inode-less node (ref->next_in_ino == NULL) indicates
    it is an unknown node of type JFFS2_NODETYPE_RWCOMPAT_COPY, so it'll get
    copied. If you need to do anything different to GC inode-less nodes, then
index 7b363786c2d2f745c30dcd53b0005e18b056df11..b5baa356fed2425317fe5f9616744e122f542948 100644 (file)
@@ -104,7 +104,7 @@ static int check_node_data(struct jffs2_sb_info *c, struct jffs2_tmp_dnode_info
 
        if (crc != tn->data_crc) {
                JFFS2_NOTICE("wrong data CRC in data node at 0x%08x: read %#08x, calculated %#08x.\n",
-                       ofs, tn->data_crc, crc);
+                            ref_offset(ref), tn->data_crc, crc);
                return 1;
        }
 
@@ -613,7 +613,7 @@ static inline int read_direntry(struct jffs2_sb_info *c, struct jffs2_raw_node_r
                jeb->unchecked_size -= len;
                c->used_size += len;
                c->unchecked_size -= len;
-               ref->flash_offset = ref_offset(ref) | REF_PRISTINE;
+               ref->flash_offset = ref_offset(ref) | dirent_node_state(rd);
                spin_unlock(&c->erase_completion_lock);
        }
 
index 2a1c976c7924c8674cda40985a5848cfe9ff02ef..6c75cd4333424347c0f37b410d7ef9e621ddb8c4 100644 (file)
@@ -1049,7 +1049,8 @@ static int jffs2_scan_dirent_node(struct jffs2_sb_info *c, struct jffs2_eraseblo
                return -ENOMEM;
        }
 
-       fd->raw = jffs2_link_node_ref(c, jeb, ofs | REF_PRISTINE, PAD(je32_to_cpu(rd->totlen)), ic);
+       fd->raw = jffs2_link_node_ref(c, jeb, ofs | dirent_node_state(rd),
+                                     PAD(je32_to_cpu(rd->totlen)), ic);
 
        fd->next = NULL;
        fd->version = je32_to_cpu(rd->version);
index c9fe0ab3a3296d782c9eb47a03f6eba88a4d09f3..bc6185933664b68e76694de35ed1df68c6408699 100644 (file)
@@ -173,6 +173,12 @@ struct jffs2_full_dnode *jffs2_write_dnode(struct jffs2_sb_info *c, struct jffs2
                flash_ofs |= REF_NORMAL;
        }
        fn->raw = jffs2_add_physical_node_ref(c, flash_ofs, PAD(sizeof(*ri)+datalen), f->inocache);
+       if (IS_ERR(fn->raw)) {
+               void *hold_err = fn->raw;
+               /* Release the full_dnode which is now useless, and return */
+               jffs2_free_full_dnode(fn);
+               return ERR_PTR(PTR_ERR(hold_err));
+       }
        fn->ofs = je32_to_cpu(ri->offset);
        fn->size = je32_to_cpu(ri->dsize);
        fn->frags = 0;
@@ -290,7 +296,14 @@ struct jffs2_full_dirent *jffs2_write_dirent(struct jffs2_sb_info *c, struct jff
                return ERR_PTR(ret?ret:-EIO);
        }
        /* Mark the space used */
-       fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | REF_PRISTINE, PAD(sizeof(*rd)+namelen), f->inocache);
+       fd->raw = jffs2_add_physical_node_ref(c, flash_ofs | dirent_node_state(rd),
+                                             PAD(sizeof(*rd)+namelen), f->inocache);
+       if (IS_ERR(fd->raw)) {
+               void *hold_err = fd->raw;
+               /* Release the full_dirent which is now useless, and return */
+               jffs2_free_full_dirent(fd);
+               return ERR_PTR(PTR_ERR(hold_err));
+       }
 
        if (retried) {
                jffs2_dbg_acct_sanity_check(c,NULL);
index b3efa4536cc55247487cae272ed45329f7c7a6ea..a21e4bc5444b49058537d810131234771cdfa17f 100644 (file)
@@ -335,10 +335,10 @@ static void nlmsvc_freegrantargs(struct nlm_rqst *call)
 /*
  * Deferred lock request handling for non-blocking lock
  */
-static u32
+static __be32
 nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
 {
-       u32 status = nlm_lck_denied_nolocks;
+       __be32 status = nlm_lck_denied_nolocks;
 
        block->b_flags |= B_QUEUED;
 
@@ -352,7 +352,7 @@ nlmsvc_defer_lock_rqst(struct svc_rqst *rqstp, struct nlm_block *block)
                        status = nlm_drop_reply;
        }
        dprintk("lockd: nlmsvc_defer_lock_rqst block %p flags %d status %d\n",
-               block, block->b_flags, status);
+               block, block->b_flags, ntohl(status));
 
        return status;
 }
index 31051063724786e0780dad4183f72544995f0763..50857d2d3404a821268fb787f74ee1f7335ebd98 100644 (file)
@@ -1324,7 +1324,7 @@ int fcntl_getlease(struct file *filp)
 }
 
 /**
- *     setlease        -       sets a lease on an open file
+ *     generic_setlease        -       sets a lease on an open file
  *     @filp: file pointer
  *     @arg: type of lease to obtain
  *     @flp: input - file_lock to use, output - file_lock inserted
@@ -1334,7 +1334,7 @@ int fcntl_getlease(struct file *filp)
  *
  *     Called with kernel lock held.
  */
-int setlease(struct file *filp, long arg, struct file_lock **flp)
+int generic_setlease(struct file *filp, long arg, struct file_lock **flp)
 {
        struct file_lock *fl, **before, **my_before = NULL, *lease;
        struct dentry *dentry = filp->f_path.dentry;
@@ -1419,7 +1419,7 @@ int setlease(struct file *filp, long arg, struct file_lock **flp)
 out:
        return error;
 }
-EXPORT_SYMBOL(setlease);
+EXPORT_SYMBOL(generic_setlease);
 
  /**
  *     vfs_setlease        -       sets a lease on an open file
@@ -1456,7 +1456,7 @@ int vfs_setlease(struct file *filp, long arg, struct file_lock **lease)
        if (filp->f_op && filp->f_op->setlease)
                error = filp->f_op->setlease(filp, arg, lease);
        else
-               error = setlease(filp, arg, lease);
+               error = generic_setlease(filp, arg, lease);
        unlock_kernel();
 
        return error;
index 551e0bac7aac6fd20476b844c8929e0116002f77..df6d60bdfcd3f0087a8bad1aed6707435ff8c2dc 100644 (file)
@@ -726,9 +726,6 @@ ncp_del_file_or_subdir2(struct ncp_server *server,
        __le32 dirent;
 
        if (!inode) {
-#ifdef CONFIG_NCPFS_DEBUGDENTRY
-               PRINTK("ncpfs: ncpdel2: dentry->d_inode == NULL\n");
-#endif
                return 0xFF;    /* Any error */
        }
        volnum = NCP_FINFO(inode)->volNumber;
index 20ac403469a02b11998d553a6e54af63c92f20c2..c55a761c22bb69eb0b9c8a83f3cb575cff5a0845 100644 (file)
 #include "delegation.h"
 #include "internal.h"
 
-static void nfs_free_delegation(struct nfs_delegation *delegation)
+static void nfs_do_free_delegation(struct nfs_delegation *delegation)
 {
-       if (delegation->cred)
-               put_rpccred(delegation->cred);
        kfree(delegation);
 }
 
@@ -31,7 +29,18 @@ static void nfs_free_delegation_callback(struct rcu_head *head)
 {
        struct nfs_delegation *delegation = container_of(head, struct nfs_delegation, rcu);
 
-       nfs_free_delegation(delegation);
+       nfs_do_free_delegation(delegation);
+}
+
+static void nfs_free_delegation(struct nfs_delegation *delegation)
+{
+       struct rpc_cred *cred;
+
+       cred = rcu_dereference(delegation->cred);
+       rcu_assign_pointer(delegation->cred, NULL);
+       call_rcu(&delegation->rcu, nfs_free_delegation_callback);
+       if (cred)
+               put_rpccred(cred);
 }
 
 static int nfs_delegation_claim_locks(struct nfs_open_context *ctx, struct nfs4_state *state)
@@ -166,7 +175,7 @@ static int nfs_do_return_delegation(struct inode *inode, struct nfs_delegation *
        int res = 0;
 
        res = nfs4_proc_delegreturn(inode, delegation->cred, &delegation->stateid);
-       call_rcu(&delegation->rcu, nfs_free_delegation_callback);
+       nfs_free_delegation(delegation);
        return res;
 }
 
@@ -448,7 +457,7 @@ restart:
                spin_unlock(&clp->cl_lock);
                rcu_read_unlock();
                if (delegation != NULL)
-                       call_rcu(&delegation->rcu, nfs_free_delegation_callback);
+                       nfs_free_delegation(delegation);
                goto restart;
        }
        rcu_read_unlock();
index bca6cdcb9f0dd738a4bb5f6d07d0b27f5a72c3a2..71a49c3acabdb26d941fb5fea5ce41e23e72ff2b 100644 (file)
@@ -468,7 +468,7 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
                ctx->lockowner = current->files;
                ctx->error = 0;
                ctx->dir_cookie = 0;
-               kref_init(&ctx->kref);
+               atomic_set(&ctx->count, 1);
        }
        return ctx;
 }
@@ -476,21 +476,18 @@ static struct nfs_open_context *alloc_nfs_open_context(struct vfsmount *mnt, str
 struct nfs_open_context *get_nfs_open_context(struct nfs_open_context *ctx)
 {
        if (ctx != NULL)
-               kref_get(&ctx->kref);
+               atomic_inc(&ctx->count);
        return ctx;
 }
 
-static void nfs_free_open_context(struct kref *kref)
+void put_nfs_open_context(struct nfs_open_context *ctx)
 {
-       struct nfs_open_context *ctx = container_of(kref,
-                       struct nfs_open_context, kref);
+       struct inode *inode = ctx->path.dentry->d_inode;
 
-       if (!list_empty(&ctx->list)) {
-               struct inode *inode = ctx->path.dentry->d_inode;
-               spin_lock(&inode->i_lock);
-               list_del(&ctx->list);
-               spin_unlock(&inode->i_lock);
-       }
+       if (!atomic_dec_and_lock(&ctx->count, &inode->i_lock))
+               return;
+       list_del(&ctx->list);
+       spin_unlock(&inode->i_lock);
        if (ctx->state != NULL)
                nfs4_close_state(&ctx->path, ctx->state, ctx->mode);
        if (ctx->cred != NULL)
@@ -500,11 +497,6 @@ static void nfs_free_open_context(struct kref *kref)
        kfree(ctx);
 }
 
-void put_nfs_open_context(struct nfs_open_context *ctx)
-{
-       kref_put(&ctx->kref, nfs_free_open_context);
-}
-
 /*
  * Ensure that mmap has a recent RPC credential for use when writing out
  * shared pages
index 7f86e65182e450b528ab7e0a6811ece68c516b56..aea76d0e5fbdf5d9c24dafd89caa94d691277ee4 100644 (file)
@@ -175,10 +175,8 @@ static void nfs_expire_automounts(struct work_struct *work)
 
 void nfs_release_automount_timer(void)
 {
-       if (list_empty(&nfs_automount_list)) {
-               cancel_delayed_work(&nfs_automount_task);
-               flush_scheduled_work();
-       }
+       if (list_empty(&nfs_automount_list))
+               cancel_delayed_work_sync(&nfs_automount_task);
 }
 
 /*
index 6ca2795ccd9c7164f77c2a601841d1637af28550..62b3ae280310386d1bfbb9eaa5da2c254873c3e0 100644 (file)
@@ -332,11 +332,9 @@ static int can_open_cached(struct nfs4_state *state, int mode)
        switch (mode & (FMODE_READ|FMODE_WRITE|O_EXCL)) {
                case FMODE_READ:
                        ret |= test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0;
-                       ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0;
                        break;
                case FMODE_WRITE:
                        ret |= test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0;
-                       ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0;
                        break;
                case FMODE_READ|FMODE_WRITE:
                        ret |= test_bit(NFS_O_RDWR_STATE, &state->flags) != 0;
@@ -1260,7 +1258,7 @@ static void nfs4_close_done(struct rpc_task *task, void *data)
        nfs_increment_open_seqid(task->tk_status, calldata->arg.seqid);
        switch (task->tk_status) {
                case 0:
-                       nfs_set_open_stateid(state, &calldata->res.stateid, calldata->arg.open_flags);
+                       nfs_set_open_stateid(state, &calldata->res.stateid, 0);
                        renew_lease(server, calldata->timestamp);
                        break;
                case -NFS4ERR_STALE_STATEID:
@@ -1286,23 +1284,19 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
                .rpc_cred = state->owner->so_cred,
        };
        int clear_rd, clear_wr, clear_rdwr;
-       int mode;
 
        if (nfs_wait_on_sequence(calldata->arg.seqid, task) != 0)
                return;
 
-       mode = FMODE_READ|FMODE_WRITE;
        clear_rd = clear_wr = clear_rdwr = 0;
        spin_lock(&state->owner->so_lock);
        /* Calculate the change in open mode */
        if (state->n_rdwr == 0) {
                if (state->n_rdonly == 0) {
-                       mode &= ~FMODE_READ;
                        clear_rd |= test_and_clear_bit(NFS_O_RDONLY_STATE, &state->flags);
                        clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags);
                }
                if (state->n_wronly == 0) {
-                       mode &= ~FMODE_WRITE;
                        clear_wr |= test_and_clear_bit(NFS_O_WRONLY_STATE, &state->flags);
                        clear_rdwr |= test_and_clear_bit(NFS_O_RDWR_STATE, &state->flags);
                }
@@ -1314,9 +1308,13 @@ static void nfs4_close_prepare(struct rpc_task *task, void *data)
                return;
        }
        nfs_fattr_init(calldata->res.fattr);
-       if (mode != 0)
+       if (test_bit(NFS_O_RDONLY_STATE, &state->flags) != 0) {
                msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE];
-       calldata->arg.open_flags = mode;
+               calldata->arg.open_flags = FMODE_READ;
+       } else if (test_bit(NFS_O_WRONLY_STATE, &state->flags) != 0) {
+               msg.rpc_proc = &nfs4_procedures[NFSPROC4_CLNT_OPEN_DOWNGRADE];
+               calldata->arg.open_flags = FMODE_WRITE;
+       }
        calldata->timestamp = jiffies;
        rpc_call_setup(task, &msg, 0);
 }
index 0505ca1240344d6096760f83a0d02c37f09c8e6a..3ea352d82eba23dc0db2b2d890904e352d7dba78 100644 (file)
@@ -127,16 +127,15 @@ nfs4_schedule_state_renewal(struct nfs_client *clp)
 void
 nfs4_renewd_prepare_shutdown(struct nfs_server *server)
 {
-       flush_scheduled_work();
+       cancel_delayed_work(&server->nfs_client->cl_renewd);
 }
 
 void
 nfs4_kill_renewd(struct nfs_client *clp)
 {
        down_read(&clp->cl_sem);
-       cancel_delayed_work(&clp->cl_renewd);
+       cancel_delayed_work_sync(&clp->cl_renewd);
        up_read(&clp->cl_sem);
-       flush_scheduled_work();
 }
 
 /*
index e9662ba81d86be1cff5ebef64ffeb7117814936a..3e4adf8c831214aaa7ef56e4abce36a3ef10d439 100644 (file)
@@ -341,8 +341,6 @@ nfs4_state_set_mode_locked(struct nfs4_state *state, mode_t mode)
                else
                        list_move_tail(&state->open_states, &state->owner->so_states);
        }
-       if (mode == 0)
-               list_del_init(&state->inode_states);
        state->state = mode;
 }
 
@@ -415,8 +413,7 @@ void nfs4_put_open_state(struct nfs4_state *state)
        if (!atomic_dec_and_lock(&state->count, &owner->so_lock))
                return;
        spin_lock(&inode->i_lock);
-       if (!list_empty(&state->inode_states))
-               list_del(&state->inode_states);
+       list_del(&state->inode_states);
        list_del(&state->open_states);
        spin_unlock(&inode->i_lock);
        spin_unlock(&owner->so_lock);
index 2d295dda4c1d63c774970f7baa76403658ccae4f..cba899a3494ed56d5e9d9342a617d841ca2bfdd6 100644 (file)
@@ -564,9 +564,10 @@ static int svc_export_parse(struct cache_detail *cd, char *mesg, int mlen)
 
        /* flags */
        err = get_int(&mesg, &an_int);
-       if (err == -ENOENT)
+       if (err == -ENOENT) {
+               err = 0;
                set_bit(CACHE_NEGATIVE, &exp.h.flags);
-       else {
+       else {
                if (err || an_int < 0) goto out;        
                exp.ex_flags= an_int;
        
index 2cf9a9a2d89c4cd47b236a12e56c92f6cc842110..2ccffde81b8430575eb1d803278ba2ceda1f66bb 100644 (file)
@@ -138,7 +138,7 @@ idtoname_request(struct cache_detail *cd, struct cache_head *ch, char **bpp,
        char idstr[11];
 
        qword_add(bpp, blen, ent->authname);
-       snprintf(idstr, sizeof(idstr), "%d", ent->id);
+       snprintf(idstr, sizeof(idstr), "%u", ent->id);
        qword_add(bpp, blen, ent->type == IDMAP_TYPE_GROUP ? "group" : "user");
        qword_add(bpp, blen, idstr);
 
@@ -165,7 +165,7 @@ idtoname_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
                return 0;
        }
        ent = container_of(h, struct ent, h);
-       seq_printf(m, "%s %s %d", ent->authname,
+       seq_printf(m, "%s %s %u", ent->authname,
                        ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
                        ent->id);
        if (test_bit(CACHE_VALID, &h->flags))
@@ -349,7 +349,7 @@ nametoid_show(struct seq_file *m, struct cache_detail *cd, struct cache_head *h)
                        ent->type == IDMAP_TYPE_GROUP ? "group" : "user",
                        ent->name);
        if (test_bit(CACHE_VALID, &h->flags))
-               seq_printf(m, " %d", ent->id);
+               seq_printf(m, " %u", ent->id);
        seq_printf(m, "\n");
        return 0;
 }
index 3c627128e205939244cd42f49cc8cc4f1cedd2c8..29b7e63cb32c42aaf23d4852abdf12f4792557e2 100644 (file)
@@ -100,7 +100,15 @@ do_open_lookup(struct svc_rqst *rqstp, struct svc_fh *current_fh, struct nfsd4_o
                status = nfsd_create_v3(rqstp, current_fh, open->op_fname.data,
                                        open->op_fname.len, &open->op_iattr,
                                        &resfh, open->op_createmode,
-                                       (u32 *)open->op_verf.data, &open->op_truncate, &created);
+                                       (u32 *)open->op_verf.data,
+                                       &open->op_truncate, &created);
+
+               /* If we ever decide to use different attrs to store the
+                * verifier in nfsd_create_v3, then we'll need to change this
+                */
+               if (open->op_createmode == NFS4_CREATE_EXCLUSIVE && status == 0)
+                       open->op_bmval[1] |= (FATTR4_WORD1_TIME_ACCESS |
+                                               FATTR4_WORD1_TIME_MODIFY);
        } else {
                status = nfsd_lookup(rqstp, current_fh,
                                     open->op_fname.data, open->op_fname.len, &resfh);
index b3d55c6747fd9c1cbde4195a60f3c6235cf0a2ff..8ef0964179bcf4482d7123b5a53bf727f79e77d6 100644 (file)
@@ -2450,7 +2450,7 @@ nfsd4_encode_rename(struct nfsd4_compoundres *resp, __be32 nfserr, struct nfsd4_
 }
 
 static void
-nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, int nfserr,
+nfsd4_encode_secinfo(struct nfsd4_compoundres *resp, __be32 nfserr,
                     struct nfsd4_secinfo *secinfo)
 {
        int i = 0;
index ee96a897a29ed93e28f940164192930f3e4ff528..a0c2b253818b89e8a7f8bb1dbfafd1c5988d436b 100644 (file)
@@ -1309,7 +1309,10 @@ nfsd_create_v3(struct svc_rqst *rqstp, struct svc_fh *fhp,
 
        if (createmode == NFS3_CREATE_EXCLUSIVE) {
                /* solaris7 gets confused (bugid 4218508) if these have
-                * the high bit set, so just clear the high bits.
+                * the high bit set, so just clear the high bits. If this is
+                * ever changed to use different attrs for storing the
+                * verifier, then do_open_lookup() will also need to be fixed
+                * accordingly.
                 */
                v_mtime = verifier[0]&0x7fffffff;
                v_atime = verifier[1]&0x7fffffff;
index f5e11f4fa952a424a5259d766a03c1d449c8ec31..4f517665c9a0e4b187985a7c7d745c8ae4ddcc91 100644 (file)
@@ -3731,7 +3731,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
 {
        int status;
        struct buffer_head *last_eb_bh = NULL;
-       struct buffer_head *bh = NULL;
        struct ocfs2_insert_type insert = {0, };
        struct ocfs2_extent_rec rec;
 
@@ -3783,9 +3782,6 @@ int ocfs2_insert_extent(struct ocfs2_super *osb,
                ocfs2_extent_map_insert_rec(inode, &rec);
 
 bail:
-       if (bh)
-               brelse(bh);
-
        if (last_eb_bh)
                brelse(last_eb_bh);
 
index f0bdfd944c44f53f35f7a11e00db26a2c16f87dc..685c18065c82ed3b844fca3226d61b850cb01d66 100644 (file)
@@ -854,17 +854,25 @@ static void o2net_sendpage(struct o2net_sock_container *sc,
        struct o2net_node *nn = o2net_nn_from_num(sc->sc_node->nd_num);
        ssize_t ret;
 
-
-       mutex_lock(&sc->sc_send_lock);
-       ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
-                                        virt_to_page(kmalloced_virt),
-                                        (long)kmalloced_virt & ~PAGE_MASK,
-                                        size, MSG_DONTWAIT);
-       mutex_unlock(&sc->sc_send_lock);
-       if (ret != size) {
+       while (1) {
+               mutex_lock(&sc->sc_send_lock);
+               ret = sc->sc_sock->ops->sendpage(sc->sc_sock,
+                                                virt_to_page(kmalloced_virt),
+                                                (long)kmalloced_virt & ~PAGE_MASK,
+                                                size, MSG_DONTWAIT);
+               mutex_unlock(&sc->sc_send_lock);
+               if (ret == size)
+                       break;
+               if (ret == (ssize_t)-EAGAIN) {
+                       mlog(0, "sendpage of size %zu to " SC_NODEF_FMT
+                            " returned EAGAIN\n", size, SC_NODEF_ARGS(sc));
+                       cond_resched();
+                       continue;
+               }
                mlog(ML_ERROR, "sendpage of size %zu to " SC_NODEF_FMT 
                     " failed with %zd\n", size, SC_NODEF_ARGS(sc), ret);
                o2net_ensure_shutdown(nn, sc, 0);
+               break;
        }
 }
 
index c4034f693e7b29b4ae0716fa54d7b45b02fc2207..4ffa715be09cff4f8243418016c0e0a08e2da40c 100644 (file)
@@ -187,6 +187,7 @@ int ocfs2_update_inode_atime(struct inode *inode,
        int ret;
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        handle_t *handle;
+       struct ocfs2_dinode *di = (struct ocfs2_dinode *) bh->b_data;
 
        mlog_entry_void();
 
@@ -197,11 +198,27 @@ int ocfs2_update_inode_atime(struct inode *inode,
                goto out;
        }
 
+       ret = ocfs2_journal_access(handle, inode, bh,
+                                  OCFS2_JOURNAL_ACCESS_WRITE);
+       if (ret) {
+               mlog_errno(ret);
+               goto out_commit;
+       }
+
+       /*
+        * Don't use ocfs2_mark_inode_dirty() here as we don't always
+        * have i_mutex to guard against concurrent changes to other
+        * inode fields.
+        */
        inode->i_atime = CURRENT_TIME;
-       ret = ocfs2_mark_inode_dirty(handle, inode, bh);
+       di->i_atime = cpu_to_le64(inode->i_atime.tv_sec);
+       di->i_atime_nsec = cpu_to_le32(inode->i_atime.tv_nsec);
+
+       ret = ocfs2_journal_dirty(handle, bh);
        if (ret < 0)
                mlog_errno(ret);
 
+out_commit:
        ocfs2_commit_trans(OCFS2_SB(inode->i_sb), handle);
 out:
        mlog_exit(ret);
@@ -1011,6 +1028,11 @@ int ocfs2_setattr(struct dentry *dentry, struct iattr *attr)
        }
 
        if (size_change && attr->ia_size != i_size_read(inode)) {
+               if (attr->ia_size > sb->s_maxbytes) {
+                       status = -EFBIG;
+                       goto bail_unlock;
+               }
+
                if (i_size_read(inode) > attr->ia_size)
                        status = ocfs2_truncate_file(inode, bh, attr->ia_size);
                else
@@ -1516,7 +1538,7 @@ static int __ocfs2_change_file_space(struct file *file, struct inode *inode,
        struct ocfs2_super *osb = OCFS2_SB(inode->i_sb);
        struct buffer_head *di_bh = NULL;
        handle_t *handle;
-       unsigned long long max_off = ocfs2_max_file_offset(inode->i_sb->s_blocksize_bits);
+       unsigned long long max_off = inode->i_sb->s_maxbytes;
 
        if (ocfs2_is_hard_readonly(osb) || ocfs2_is_soft_readonly(osb))
                return -EROFS;
@@ -1942,7 +1964,7 @@ static ssize_t ocfs2_file_buffered_write(struct file *file, loff_t *ppos,
                }
 
                dst = kmap_atomic(page, KM_USER0);
-               memcpy(dst + (pos & (PAGE_CACHE_SIZE - 1)), buf, bytes);
+               memcpy(dst + (pos & (loff_t)(PAGE_CACHE_SIZE - 1)), buf, bytes);
                kunmap_atomic(dst, KM_USER0);
                flush_dcache_page(page);
                ocfs2_put_write_source(user_page);
index d430fdab16e9ea2e9bdad95bfc8346f87b26bb24..701e6d04ed5d2a7ed45fa9bb6270fa6f7fa91c50 100644 (file)
@@ -1080,6 +1080,7 @@ static int ocfs2_rename(struct inode *old_dir,
        struct buffer_head *old_inode_de_bh = NULL; // if old_dentry is a dir,
                                                    // this is the 1st dirent bh
        nlink_t old_dir_nlink = old_dir->i_nlink;
+       struct ocfs2_dinode *old_di;
 
        /* At some point it might be nice to break this function up a
         * bit. */
@@ -1354,7 +1355,20 @@ static int ocfs2_rename(struct inode *old_dir,
 
        old_inode->i_ctime = CURRENT_TIME;
        mark_inode_dirty(old_inode);
-       ocfs2_mark_inode_dirty(handle, old_inode, old_inode_bh);
+
+       status = ocfs2_journal_access(handle, old_inode, old_inode_bh,
+                                     OCFS2_JOURNAL_ACCESS_WRITE);
+       if (status >= 0) {
+               old_di = (struct ocfs2_dinode *) old_inode_bh->b_data;
+
+               old_di->i_ctime = cpu_to_le64(old_inode->i_ctime.tv_sec);
+               old_di->i_ctime_nsec = cpu_to_le32(old_inode->i_ctime.tv_nsec);
+
+               status = ocfs2_journal_dirty(handle, old_inode_bh);
+               if (status < 0)
+                       mlog_errno(status);
+       } else
+               mlog_errno(status);
 
        /* now that the name has been added to new_dir, remove the old name */
        status = ocfs2_delete_entry(handle, old_dir, old_de, old_de_bh);
index 5cc90a40b3c56a687bf1b7396d252771ecbdbbdf..58307853fb4a5be7100405d720f720202bcec6f6 100644 (file)
@@ -494,16 +494,16 @@ static inline unsigned int ocfs2_page_index_to_clusters(struct super_block *sb,
 /*
  * Find the 1st page index which covers the given clusters.
  */
-static inline unsigned long ocfs2_align_clusters_to_page_index(struct super_block *sb,
+static inline pgoff_t ocfs2_align_clusters_to_page_index(struct super_block *sb,
                                                        u32 clusters)
 {
        unsigned int cbits = OCFS2_SB(sb)->s_clustersize_bits;
-       unsigned long index = clusters;
+        pgoff_t index = clusters;
 
        if (PAGE_CACHE_SHIFT > cbits) {
-               index = clusters >> (PAGE_CACHE_SHIFT - cbits);
+               index = (pgoff_t)clusters >> (PAGE_CACHE_SHIFT - cbits);
        } else if (PAGE_CACHE_SHIFT < cbits) {
-               index = clusters << (cbits - PAGE_CACHE_SHIFT);
+               index = (pgoff_t)clusters << (cbits - PAGE_CACHE_SHIFT);
        }
 
        return index;
index 200c7d4790dc187a7a6e60b30ff4a36b9f55cc59..f2fc9a795debe7b3933ca6277100738beb0ef0e7 100644 (file)
@@ -316,39 +316,51 @@ static void ocfs2_destroy_inode(struct inode *inode)
        kmem_cache_free(ocfs2_inode_cachep, OCFS2_I(inode));
 }
 
-/* From xfs_super.c:xfs_max_file_offset
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.
- */
-unsigned long long ocfs2_max_file_offset(unsigned int blockshift)
+static unsigned long long ocfs2_max_file_offset(unsigned int bbits,
+                                               unsigned int cbits)
 {
-       unsigned int pagefactor = 1;
-       unsigned int bitshift = BITS_PER_LONG - 1;
-
-       /* Figure out maximum filesize, on Linux this can depend on
-        * the filesystem blocksize (on 32 bit platforms).
-        * __block_prepare_write does this in an [unsigned] long...
-        *      page->index << (PAGE_CACHE_SHIFT - bbits)
-        * So, for page sized blocks (4K on 32 bit platforms),
-        * this wraps at around 8Tb (hence MAX_LFS_FILESIZE which is
-        *      (((u64)PAGE_CACHE_SIZE << (BITS_PER_LONG-1))-1)
-        * but for smaller blocksizes it is less (bbits = log2 bsize).
-        * Note1: get_block_t takes a long (implicit cast from above)
-        * Note2: The Large Block Device (LBD and HAVE_SECTOR_T) patch
-        * can optionally convert the [unsigned] long from above into
-        * an [unsigned] long long.
+       unsigned int bytes = 1 << cbits;
+       unsigned int trim = bytes;
+       unsigned int bitshift = 32;
+
+       /*
+        * i_size and all block offsets in ocfs2 are always 64 bits
+        * wide. i_clusters is 32 bits, in cluster-sized units. So on
+        * 64 bit platforms, cluster size will be the limiting factor.
         */
 
 #if BITS_PER_LONG == 32
 # if defined(CONFIG_LBD)
        BUILD_BUG_ON(sizeof(sector_t) != 8);
-       pagefactor = PAGE_CACHE_SIZE;
-       bitshift = BITS_PER_LONG;
+       /*
+        * We might be limited by page cache size.
+        */
+       if (bytes > PAGE_CACHE_SIZE) {
+               bytes = PAGE_CACHE_SIZE;
+               trim = 1;
+               /*
+                * Shift by 31 here so that we don't get larger than
+                * MAX_LFS_FILESIZE
+                */
+               bitshift = 31;
+       }
 # else
-       pagefactor = PAGE_CACHE_SIZE >> (PAGE_CACHE_SHIFT - blockshift);
+       /*
+        * We are limited by the size of sector_t. Use block size, as
+        * that's what we expose to the VFS.
+        */
+       bytes = 1 << bbits;
+       trim = 1;
+       bitshift = 31;
 # endif
 #endif
 
-       return (((unsigned long long)pagefactor) << bitshift) - 1;
+       /*
+        * Trim by a whole cluster when we can actually approach the
+        * on-disk limits. Otherwise we can overflow i_clusters when
+        * an extent start is at the max offset.
+        */
+       return (((unsigned long long)bytes) << bitshift) - trim;
 }
 
 static int ocfs2_remount(struct super_block *sb, int *flags, char *data)
@@ -1259,8 +1271,8 @@ static int ocfs2_initialize_super(struct super_block *sb,
                                  int sector_size)
 {
        int status = 0;
-       int i;
-       struct ocfs2_dinode *di = NULL;
+       int i, cbits, bbits;
+       struct ocfs2_dinode *di = (struct ocfs2_dinode *)bh->b_data;
        struct inode *inode = NULL;
        struct buffer_head *bitmap_bh = NULL;
        struct ocfs2_journal *journal;
@@ -1279,9 +1291,12 @@ static int ocfs2_initialize_super(struct super_block *sb,
        sb->s_fs_info = osb;
        sb->s_op = &ocfs2_sops;
        sb->s_export_op = &ocfs2_export_ops;
+       sb->s_time_gran = 1;
        sb->s_flags |= MS_NOATIME;
        /* this is needed to support O_LARGEFILE */
-       sb->s_maxbytes = ocfs2_max_file_offset(sb->s_blocksize_bits);
+       cbits = le32_to_cpu(di->id2.i_super.s_clustersize_bits);
+       bbits = le32_to_cpu(di->id2.i_super.s_blocksize_bits);
+       sb->s_maxbytes = ocfs2_max_file_offset(bbits, cbits);
 
        osb->sb = sb;
        /* Save off for ocfs2_rw_direct */
@@ -1341,8 +1356,6 @@ static int ocfs2_initialize_super(struct super_block *sb,
                goto bail;
        }
 
-       di = (struct ocfs2_dinode *)bh->b_data;
-
        osb->max_slots = le16_to_cpu(di->id2.i_super.s_max_slots);
        if (osb->max_slots > OCFS2_MAX_SLOTS || osb->max_slots == 0) {
                mlog(ML_ERROR, "Invalid number of node slots (%u)\n",
index 3b9cb3d0b0081e5835306e5eafe36ba2da7f0399..783f5270f2a165c3c90ef1d54d014e9662174b00 100644 (file)
@@ -45,6 +45,4 @@ void __ocfs2_abort(struct super_block *sb,
 
 #define ocfs2_abort(sb, fmt, args...) __ocfs2_abort(sb, __PRETTY_FUNCTION__, fmt, ##args)
 
-unsigned long long ocfs2_max_file_offset(unsigned int blockshift);
-
 #endif /* OCFS2_SUPER_H */
index e27c205364d3efba824538b63a906334688ae56e..1d9e5e98bf4e725615cc3cfcd269dc2cab5101e4 100644 (file)
--- a/fs/open.c
+++ b/fs/open.c
@@ -256,24 +256,26 @@ static long do_sys_truncate(const char __user * path, loff_t length)
        if (IS_IMMUTABLE(inode) || IS_APPEND(inode))
                goto dput_and_out;
 
-       /*
-        * Make sure that there are no leases.
-        */
-       error = break_lease(inode, FMODE_WRITE);
+       error = get_write_access(inode);
        if (error)
                goto dput_and_out;
 
-       error = get_write_access(inode);
+       /*
+        * Make sure that there are no leases.  get_write_access() protects
+        * against the truncate racing with a lease-granting setlease().
+        */
+       error = break_lease(inode, FMODE_WRITE);
        if (error)
-               goto dput_and_out;
+               goto put_write_and_out;
 
        error = locks_verify_truncate(inode, NULL, length);
        if (!error) {
                DQUOT_INIT(inode);
                error = do_truncate(nd.dentry, length, 0, NULL);
        }
-       put_write_access(inode);
 
+put_write_and_out:
+       put_write_access(inode);
 dput_and_out:
        path_release(&nd);
 out:
index 4ccec4cd1367a304bac2c784d0ba7e794b3e98cc..5567ec0d03a3910e931591e72669842cfc2b4591 100644 (file)
@@ -203,6 +203,7 @@ parse_solaris_x86(struct parsed_partitions *state, struct block_device *bdev,
        Sector sect;
        struct solaris_x86_vtoc *v;
        int i;
+       short max_nparts;
 
        v = (struct solaris_x86_vtoc *)read_dev_sector(bdev, offset+1, &sect);
        if (!v)
@@ -218,7 +219,9 @@ parse_solaris_x86(struct parsed_partitions *state, struct block_device *bdev,
                put_dev_sector(sect);
                return;
        }
-       for (i=0; i<SOLARIS_X86_NUMSLICE && state->next<state->limit; i++) {
+       /* Ensure we can handle previous case of VTOC with 8 entries gracefully */
+       max_nparts = le16_to_cpu (v->v_nparts) > 8 ? SOLARIS_X86_NUMSLICE : 8;
+       for (i=0; i<max_nparts && state->next<state->limit; i++) {
                struct solaris_x86_slice *s = &v->v_slice[i];
                if (s->s_size == 0)
                        continue;
index 123f8b46c8ba7cfbfd3676b37b00a8fa07070e38..794118da4ef3ee04877a1bb2122bf81c977f61fd 100644 (file)
@@ -19,34 +19,47 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
        Sector sect;
        struct sun_disklabel {
                unsigned char info[128];   /* Informative text string */
-               unsigned char spare0[14];
-               struct sun_info {
-                       unsigned char spare1;
-                       unsigned char id;
-                       unsigned char spare2;
-                       unsigned char flags;
-               } infos[8];
-               unsigned char spare[246];  /* Boot information etc. */
+               struct sun_vtoc {
+                   __be32 version;     /* Layout version */
+                   char   volume[8];   /* Volume name */
+                   __be16 nparts;      /* Number of partitions */
+                   struct sun_info {           /* Partition hdrs, sec 2 */
+                       __be16 id;
+                       __be16 flags;
+                   } infos[8];
+                   __be16 padding;     /* Alignment padding */
+                   __be32 bootinfo[3];  /* Info needed by mboot */
+                   __be32 sanity;       /* To verify vtoc sanity */
+                   __be32 reserved[10]; /* Free space */
+                   __be32 timestamp[8]; /* Partition timestamp */
+               } vtoc;
+               __be32 write_reinstruct; /* sectors to skip, writes */
+               __be32 read_reinstruct;  /* sectors to skip, reads */
+               unsigned char spare[148]; /* Padding */
                __be16 rspeed;     /* Disk rotational speed */
                __be16 pcylcount;  /* Physical cylinder count */
                __be16 sparecyl;   /* extra sects per cylinder */
-               unsigned char spare2[4];   /* More magic... */
+               __be16 obs1;       /* gap1 */
+               __be16 obs2;       /* gap2 */
                __be16 ilfact;     /* Interleave factor */
                __be16 ncyl;       /* Data cylinder count */
                __be16 nacyl;      /* Alt. cylinder count */
                __be16 ntrks;      /* Tracks per cylinder */
                __be16 nsect;      /* Sectors per track */
-               unsigned char spare3[4];   /* Even more magic... */
+               __be16 obs3;       /* bhead - Label head offset */
+               __be16 obs4;       /* ppart - Physical Partition */
                struct sun_partition {
                        __be32 start_cylinder;
                        __be32 num_sectors;
                } partitions[8];
                __be16 magic;      /* Magic number */
                __be16 csum;       /* Label xor'd checksum */
-       } * label;              
+       } * label;
        struct sun_partition *p;
        unsigned long spc;
        char b[BDEVNAME_SIZE];
+       int use_vtoc;
+       int nparts;
 
        label = (struct sun_disklabel *)read_dev_sector(bdev, 0, &sect);
        if (!label)
@@ -70,9 +83,22 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
                return 0;
        }
 
-       /* All Sun disks have 8 partition entries */
+       /* Check to see if we can use the VTOC table */
+       use_vtoc = ((be32_to_cpu(label->vtoc.sanity) == SUN_VTOC_SANITY) &&
+                   (be32_to_cpu(label->vtoc.version) == 1) &&
+                   (be16_to_cpu(label->vtoc.nparts) <= 8));
+
+       /* Use 8 partition entries if not specified in validated VTOC */
+       nparts = (use_vtoc) ? be16_to_cpu(label->vtoc.nparts) : 8;
+
+       /*
+        * So that old Linux-Sun partitions continue to work,
+        * alow the VTOC to be used under the additional condition ...
+        */
+       use_vtoc = use_vtoc || !(label->vtoc.sanity |
+                                label->vtoc.version | label->vtoc.nparts);
        spc = be16_to_cpu(label->ntrks) * be16_to_cpu(label->nsect);
-       for (i = 0; i < 8; i++, p++) {
+       for (i = 0; i < nparts; i++, p++) {
                unsigned long st_sector;
                unsigned int num_sectors;
 
@@ -81,10 +107,12 @@ int sun_partition(struct parsed_partitions *state, struct block_device *bdev)
                if (num_sectors) {
                        put_partition(state, slot, st_sector, num_sectors);
                        state->parts[slot].flags = 0;
-                       if (label->infos[i].id == LINUX_RAID_PARTITION)
-                               state->parts[slot].flags |= ADDPART_FLAG_RAID;
-                       if (label->infos[i].id == SUN_WHOLE_DISK)
-                               state->parts[slot].flags |= ADDPART_FLAG_WHOLEDISK;
+                       if (use_vtoc) {
+                               if (be16_to_cpu(label->vtoc.infos[i].id) == LINUX_RAID_PARTITION)
+                                       state->parts[slot].flags |= ADDPART_FLAG_RAID;
+                               else if (be16_to_cpu(label->vtoc.infos[i].id) == SUN_WHOLE_DISK)
+                                       state->parts[slot].flags |= ADDPART_FLAG_WHOLEDISK;
+                       }
                }
                slot++;
        }
index b1b19fda7b22c8b742a88c40029db342dd57fd00..7f864d1f86d4747548ad0635cfe171462977226d 100644 (file)
@@ -3,5 +3,6 @@
  */
 
 #define SUN_LABEL_MAGIC          0xDABE
+#define SUN_VTOC_SANITY          0x600DDEEE
 
 int sun_partition(struct parsed_partitions *state, struct block_device *bdev);
index d007830d9c870fabb4b887d3f81afcb8e7160642..6b3d91a691bf146edeeb7934a366e6ab4c0ff100 100644 (file)
--- a/fs/pipe.c
+++ b/fs/pipe.c
@@ -255,7 +255,7 @@ void generic_pipe_buf_get(struct pipe_inode_info *pipe, struct pipe_buffer *buf)
 
 /**
  * generic_pipe_buf_confirm - verify contents of the pipe buffer
- * @pipe:      the pipe that the buffer belongs to
+ * @info:      the pipe that the buffer belongs to
  * @buf:       the buffer to confirm
  *
  * Description:
index 3c77d5a64e7ce6512e896d768d8bb74501372a89..19489b0d5554860e28a1b7e6aeefc5d23fa0d992 100644 (file)
@@ -927,7 +927,7 @@ static const struct file_operations proc_pid_sched_operations = {
        .read           = seq_read,
        .write          = sched_write,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 #endif
index 94e2c1adf184f157413fe9d91def4a0e447850ea..a5b0dfd89a17043b262261b55a55a3a0f284f286 100644 (file)
@@ -386,6 +386,19 @@ static const struct file_operations proc_reg_file_ops = {
        .release        = proc_reg_release,
 };
 
+#ifdef CONFIG_COMPAT
+static const struct file_operations proc_reg_file_ops_no_compat = {
+       .llseek         = proc_reg_llseek,
+       .read           = proc_reg_read,
+       .write          = proc_reg_write,
+       .poll           = proc_reg_poll,
+       .unlocked_ioctl = proc_reg_unlocked_ioctl,
+       .mmap           = proc_reg_mmap,
+       .open           = proc_reg_open,
+       .release        = proc_reg_release,
+};
+#endif
+
 struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
                                struct proc_dir_entry *de)
 {
@@ -413,8 +426,15 @@ struct inode *proc_get_inode(struct super_block *sb, unsigned int ino,
                if (de->proc_iops)
                        inode->i_op = de->proc_iops;
                if (de->proc_fops) {
-                       if (S_ISREG(inode->i_mode))
-                               inode->i_fop = &proc_reg_file_ops;
+                       if (S_ISREG(inode->i_mode)) {
+#ifdef CONFIG_COMPAT
+                               if (!de->proc_fops->compat_ioctl)
+                                       inode->i_fop =
+                                               &proc_reg_file_ops_no_compat;
+                               else
+#endif
+                                       inode->i_fop = &proc_reg_file_ops;
+                       }
                        else
                                inode->i_fop = de->proc_fops;
                }
index e6577ac15a6cd1e2df52890e1338b0392c321f44..99b24b52bfc83cbd8f851044dbe2ae27f8e1fc4b 100644 (file)
@@ -387,7 +387,7 @@ asmlinkage long sys_quotactl(unsigned int cmd, const char __user *special, qid_t
        return ret;
 }
 
-#if defined(CONFIG_X86_64) || defined(CONFIG_IA64)
+#if defined(CONFIG_COMPAT_FOR_U64_ALIGNMENT)
 /*
  * This code works only for 32 bit quota tools over 64 bit OS (x86_64, ia64)
  * and is necessary due to alignment problems.
index cad2b7ace63033bc4aa0e78393e07d3527f296c9..237fe8b8e819de469c6017f7ad5ddf9525ed0e94 100644 (file)
@@ -295,5 +295,10 @@ unsigned long ramfs_nommu_get_unmapped_area(struct file *file,
  */
 int ramfs_nommu_mmap(struct file *file, struct vm_area_struct *vma)
 {
-       return vma->vm_flags & VM_SHARED ? 0 : -ENOSYS;
+       if (!(vma->vm_flags & VM_SHARED))
+               return -ENOSYS;
+
+       file_accessed(file);
+       vma->vm_ops = &generic_file_vm_ops;
+       return 0;
 }
index b6f12593c39dd76a1cd2002c93466a9370f04957..981027d1187bb49f33b0798cd9cfb790a2d8e549 100644 (file)
@@ -1042,7 +1042,8 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
                pos = I_UNFM_NUM(&s_ih);
 
                while (le_ih_k_offset (&s_ih) + (pos - 1) * blk_size > n_new_file_length) {
-                   __u32 *unfm, block;
+                   __le32 *unfm;
+                   __u32 block;
 
                    /* Each unformatted block deletion may involve one additional
                     * bitmap block into the transaction, thereby the initial
@@ -1052,7 +1053,7 @@ static char prepare_for_delete_or_cut(struct reiserfs_transaction_handle *th, st
                        break;
                    }
 
-                   unfm = (__u32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1;
+                   unfm = (__le32 *)B_I_PITEM(p_s_bh, &s_ih) + pos - 1;
                    block = get_block_num(unfm, 0);
 
                    if (block != 0) {
index 3b07f26d984d6bc6ee35eb7bce1e834d1e594da1..7b941abbcde09401404a73c5298b73611eea23da 100644 (file)
@@ -320,7 +320,7 @@ asmlinkage long sys_signalfd(int ufd, sigset_t __user *user_mask, size_t sizemas
 
        if (sizemask != sizeof(sigset_t) ||
            copy_from_user(&sigmask, user_mask, sizeof(sigmask)))
-               return error = -EINVAL;
+               return -EINVAL;
        sigdelsetmask(&sigmask, sigmask(SIGKILL) | sigmask(SIGSTOP));
        signotset(&sigmask);
 
index 0a09732180847ce6cb7d67f91477c2314296003a..c010a72ca2d2a3543fb2a7365b2e8c5b4c73b652 100644 (file)
@@ -164,7 +164,7 @@ static const struct pipe_buf_operations user_page_pipe_buf_ops = {
  * @spd:       data to fill
  *
  * Description:
- *    @spd contains a map of pages and len/offset tupples, a long with
+ *    @spd contains a map of pages and len/offset tuples, along with
  *    the struct pipe_buf_operations associated with these pages. This
  *    function will link that data to the pipe.
  *
@@ -1000,7 +1000,7 @@ static long do_splice_to(struct file *in, loff_t *ppos,
  * Description:
  *    This is a special case helper to splice directly between two
  *    points, without requiring an explicit pipe. Internally an allocated
- *    pipe is cached in the process, and reused during the life time of
+ *    pipe is cached in the process, and reused during the lifetime of
  *    that process.
  *
  */
index af9eca5c02307eeee34cfbd8f9598c3ab24c32b1..61983f3b107c5ee5d12521d3f38255a77bc6f781 100644 (file)
@@ -95,7 +95,7 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
 {
        struct timerfd_ctx *ctx = file->private_data;
        ssize_t res;
-       u32 ticks = 0;
+       u64 ticks = 0;
        DECLARE_WAITQUEUE(wait, current);
 
        if (count < sizeof(ticks))
@@ -130,7 +130,7 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
                         * callback to avoid DoS attacks specifying a very
                         * short timer period.
                         */
-                       ticks = (u32)
+                       ticks = (u64)
                                hrtimer_forward(&ctx->tmr,
                                                hrtimer_cb_get_time(&ctx->tmr),
                                                ctx->tintv);
@@ -140,7 +140,7 @@ static ssize_t timerfd_read(struct file *file, char __user *buf, size_t count,
        }
        spin_unlock_irq(&ctx->wqh.lock);
        if (ticks)
-               res = put_user(ticks, buf) ? -EFAULT: sizeof(ticks);
+               res = put_user(ticks, (u64 __user *) buf) ? -EFAULT: sizeof(ticks);
        return res;
 }
 
index 0d2c41666cd28d877ce10f72e8782ecf0cbeaf81..1652b2c665bb08f1df27eb51d6029ac06fb14d64 100644 (file)
@@ -1127,13 +1127,15 @@ static void udf_fill_inode(struct inode *inode, struct buffer_head *bh)
        }
 
        inode->i_uid = le32_to_cpu(fe->uid);
-       if (inode->i_uid == -1 || UDF_QUERY_FLAG(inode->i_sb,
-                                                UDF_FLAG_UID_IGNORE))
+       if (inode->i_uid == -1 ||
+           UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_IGNORE) ||
+           UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_UID_SET))
                inode->i_uid = UDF_SB(inode->i_sb)->s_uid;
 
        inode->i_gid = le32_to_cpu(fe->gid);
-       if (inode->i_gid == -1 || UDF_QUERY_FLAG(inode->i_sb,
-                                                UDF_FLAG_GID_IGNORE))
+       if (inode->i_gid == -1 ||
+           UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_IGNORE) ||
+           UDF_QUERY_FLAG(inode->i_sb, UDF_FLAG_GID_SET))
                inode->i_gid = UDF_SB(inode->i_sb)->s_gid;
 
        inode->i_nlink = le16_to_cpu(fe->fileLinkCount);
index 7b30964665dbebd7f39002ff26d6cfd9ecd3921f..382be7be5ae34e66b6619d5c7bab8e20852edd48 100644 (file)
@@ -366,11 +366,13 @@ static int udf_parse_options(char *options, struct udf_options *uopt)
                        if (match_int(args, &option))
                                return 0;
                        uopt->gid = option;
+                       uopt->flags |= (1 << UDF_FLAG_GID_SET);
                        break;
                case Opt_uid:
                        if (match_int(args, &option))
                                return 0;
                        uopt->uid = option;
+                       uopt->flags |= (1 << UDF_FLAG_UID_SET);
                        break;
                case Opt_umask:
                        if (match_octal(args, &option))
index 3e937d3fb8f99b12b24515943eec3b30f81815ad..3c2982017c6da50d14437391e1f985d036ffcae8 100644 (file)
@@ -24,6 +24,8 @@
 #define UDF_FLAG_UID_IGNORE     12    /* use sb uid instead of on disk uid */
 #define UDF_FLAG_GID_FORGET     13
 #define UDF_FLAG_GID_IGNORE     14
+#define UDF_FLAG_UID_SET       15
+#define UDF_FLAG_GID_SET       16
 
 #define UDF_PART_FLAG_UNALLOC_BITMAP   0x0001
 #define UDF_PART_FLAG_UNALLOC_TABLE    0x0002
index 141cf15067c28b78bf7f411ae61e5a3ef18f89cc..42319d75aaab1ff2123421c7d7b82bb5d6444240 100644 (file)
@@ -139,7 +139,7 @@ STATIC int xfs_inumbers_fmt_compat(
        long count,
        long *written)
 {
-       compat_xfs_inogrp_t *p32 = ubuffer;
+       compat_xfs_inogrp_t __user *p32 = ubuffer;
        long i;
 
        for (i = 0; i < count; i++) {
@@ -444,7 +444,7 @@ xfs_compat_ioctl(
        case XFS_IOC_FSINUMBERS_32:
                cmd = _NATIVE_IOC(cmd, struct xfs_fsop_bulkreq);
                return xfs_ioc_bulkstat_compat(XFS_BHVTOI(VNHEAD(vp))->i_mount,
-                               cmd, (void*)arg);
+                               cmd, (void __user*)arg);
        case XFS_IOC_FD_TO_HANDLE_32:
        case XFS_IOC_PATH_TO_HANDLE_32:
        case XFS_IOC_PATH_TO_FSHANDLE_32:
index 533ef40f7ccfa8f636acc097d65b4970b022732d..3d0fea235bf341af95fb417dcea94d0872ae643b 100644 (file)
@@ -366,7 +366,16 @@ acpi_handle acpi_get_child(acpi_handle, acpi_integer);
 acpi_handle acpi_get_pci_rootbridge_handle(unsigned int, unsigned int);
 #define DEVICE_ACPI_HANDLE(dev) ((acpi_handle)((dev)->archdata.acpi_handle))
 
+#ifdef CONFIG_PM_SLEEP
 int acpi_pm_device_sleep_state(struct device *, int, int *);
+#else /* !CONFIG_PM_SLEEP */
+static inline int acpi_pm_device_sleep_state(struct device *d, int w, int *p)
+{
+       if (p)
+               *p = ACPI_STATE_D0;
+       return ACPI_STATE_D3;
+}
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif                         /* CONFIG_ACPI */
 
index f85f77a538aa67afb418b4b35ba8c3ccd945516f..202acb9ff4d071299cb0926c8887cc5d3b57bd53 100644 (file)
@@ -147,6 +147,10 @@ static inline void unregister_hotplug_dock_device(acpi_handle handle)
 /*--------------------------------------------------------------------------
                                   Suspend/Resume
   -------------------------------------------------------------------------- */
+#ifdef CONFIG_ACPI_SLEEP
 extern int acpi_sleep_init(void);
+#else
+static inline int acpi_sleep_init(void) { return 0; }
+#endif
 
 #endif /*__ACPI_DRIVERS_H__*/
index f9f987f8e661b9afef361919314363500c05b183..ec3ffdadb4d257c452d091b30e8322c01c049e3f 100644 (file)
@@ -232,7 +232,7 @@ struct acpi_processor_errata {
 
 extern int acpi_processor_preregister_performance(struct
                                                  acpi_processor_performance
-                                                 **performance);
+                                                 *performance);
 
 extern int acpi_processor_register_performance(struct acpi_processor_performance
                                               *performance, unsigned int cpu);
index 3a0cbeb03fa17e01698796ab5edf48fe3af62ab7..9e71201000d58eb8943650bc14c938aca1850513 100644 (file)
@@ -324,7 +324,7 @@ static inline int fls64(unsigned long x)
 {
        unsigned long t, a, r;
 
-       t = __kernel_cmpbge (x, 0x0101010101010101);
+       t = __kernel_cmpbge (x, 0x0101010101010101UL);
        a = __flsm1_tab[t];
        t = __kernel_extbl (x, a);
        r = a*8 + __flsm1_tab[t] + (x != 0);
index 87f2cf459e266367be6f16f10c545f85d41e9bbc..25da0017ec87fb2dd675257d7d16a68cc5f89aff 100644 (file)
@@ -16,6 +16,7 @@
 #define O_LARGEFILE    0400000 /* will be set by the kernel on every open */
 #define O_DIRECT       02000000 /* direct disk access - should check with OSF/1 */
 #define O_NOATIME      04000000
+#define O_CLOEXEC      010000000 /* set close_on_exec */
 
 #define F_GETLK                7
 #define F_SETLK                8
index 48a22e3e6f32166570aac056e27d65159181302b..fb3185196298326ee265f2ef87cb148795896a01 100644 (file)
@@ -67,28 +67,24 @@ register struct thread_info *__current_thread_info __asm__("$8");
  * TIF_SYSCALL_TRACE is known to be 0 via blbs.
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG     4       /* poll_idle is polling NEED_RESCHED */
-#define TIF_DIE_IF_KERNEL      5       /* dik recursion lock */
-#define TIF_UAC_NOPRINT                6       /* see sysinfo.h */
-#define TIF_UAC_NOFIX          7
-#define TIF_UAC_SIGBUS         8
-#define TIF_MEMDIE             9
-#define TIF_RESTORE_SIGMASK    10      /* restore signal mask in do_signal */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     3       /* poll_idle is polling NEED_RESCHED */
+#define TIF_DIE_IF_KERNEL      4       /* dik recursion lock */
+#define TIF_UAC_NOPRINT                5       /* see sysinfo.h */
+#define TIF_UAC_NOFIX          6
+#define TIF_UAC_SIGBUS         7
+#define TIF_MEMDIE             8
+#define TIF_RESTORE_SIGMASK    9       /* restore signal mask in do_signal */
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
 #define _TIF_RESTORE_SIGMASK   (1<<TIF_RESTORE_SIGMASK)
 
 /* Work to do on interrupt/exception return.  */
-#define _TIF_WORK_MASK         (_TIF_NOTIFY_RESUME     \
-                                | _TIF_SIGPENDING      \
-                                | _TIF_NEED_RESCHED)
+#define _TIF_WORK_MASK         (_TIF_SIGPENDING | _TIF_NEED_RESCHED)
 
 /* Work to do on any return to userspace.  */
 #define _TIF_ALLWORK_MASK      (_TIF_WORK_MASK         \
index ec5787d0e78cac6c714b5b5347041a4749625a41..42cc0cb3fefd40343ae2380cb9969d6ea2570f05 100644 (file)
@@ -26,7 +26,6 @@
 #define __MXC_BOOT_UNCOMPRESS
 
 #include <asm/hardware.h>
-#include <asm/processor.h>
 
 #define UART(x) (*(volatile unsigned long *)(serial_port + (x)))
 
@@ -62,7 +61,7 @@ static void putc(int ch)
        }
 
        while (!(UART(USR2) & USR2_TXFE))
-               cpu_relax();
+               barrier();
 
        UART(TXR) = ch;
 }
index b186bc820e30f04c94d1f9ebb36912f045601308..33c83dd879654aa5e3c83f18b4ad022a1603ac3a 100644 (file)
@@ -74,7 +74,6 @@ static inline int pte_file(pte_t pte) { return 0; }
  * These would be in other places but having them here reduces the diffs.
  */
 extern unsigned int kobjsize(const void *objp);
-extern int is_in_rom(unsigned long);
 
 /*
  * No page table caches to initialise.
index 69c65d56a6ac6e1d8d520b55f72c92caf2969705..41784357a2040a8c9636d035c522a50ce941b8f2 100644 (file)
@@ -134,22 +134,19 @@ extern void iwmmxt_task_switch(struct thread_info *);
 /*
  * thread information flags:
  *  TIF_SYSCALL_TRACE  - syscall trace active
- *  TIF_NOTIFY_RESUME  - resumption notification requested
  *  TIF_SIGPENDING     - signal pending
  *  TIF_NEED_RESCHED   - rescheduling necessary
  *  TIF_USEDFPU                - FPU was used by this task this quantum (SMP)
  *  TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED
  */
-#define TIF_NOTIFY_RESUME      0
-#define TIF_SIGPENDING         1
-#define TIF_NEED_RESCHED       2
+#define TIF_SIGPENDING         0
+#define TIF_NEED_RESCHED       1
 #define TIF_SYSCALL_TRACE      8
 #define TIF_POLLING_NRFLAG     16
 #define TIF_USING_IWMMXT       17
 #define TIF_MEMDIE             18
 #define TIF_FREEZE             19
 
-#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
 #define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
index 795b9e5b9e6ab88e07641189eaba1c3110a7cba4..8431f6eed5c6b6a5ebee2c067032e32f40302952 100644 (file)
@@ -60,24 +60,24 @@ extern int __bug_unaligned_x(const void *ptr);
                __get_unaligned_4_be((__p+4)))
 
 #define __get_unaligned_le(ptr)                                                \
-       ({                                                              \
+       ((__force typeof(*(ptr)))({                                     \
                const __u8 *__p = (const __u8 *)(ptr);                  \
                __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p,        \
                  __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_le(__p), \
                  __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_le(__p), \
                  __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_le(__p), \
                    (void)__bug_unaligned_x(__p)))));                   \
-       })
+       }))
 
 #define __get_unaligned_be(ptr)                                                \
-       ({                                                              \
+       ((__force typeof(*(ptr)))({                                     \
                const __u8 *__p = (const __u8 *)(ptr);                  \
                __builtin_choose_expr(sizeof(*(ptr)) == 1, *__p,        \
                  __builtin_choose_expr(sizeof(*(ptr)) == 2, __get_unaligned_2_be(__p), \
                  __builtin_choose_expr(sizeof(*(ptr)) == 4, __get_unaligned_4_be(__p), \
                  __builtin_choose_expr(sizeof(*(ptr)) == 8, __get_unaligned_8_be(__p), \
                    (void)__bug_unaligned_x(__p)))));                   \
-       })
+       }))
 
 
 static inline void __put_unaligned_2_le(__u32 __v, register __u8 *__p)
@@ -131,15 +131,16 @@ static inline void __put_unaligned_8_be(const unsigned long long __v, register _
  */
 #define __put_unaligned_le(val,ptr)                                    \
        ({                                                      \
+               (void)sizeof(*(ptr) = (val));                   \
                switch (sizeof(*(ptr))) {                       \
                case 1:                                         \
                        *(ptr) = (val);                         \
                        break;                                  \
-               case 2: __put_unaligned_2_le((val),(__u8 *)(ptr));      \
+               case 2: __put_unaligned_2_le((__force u16)(val),(__u8 *)(ptr)); \
                        break;                                  \
-               case 4: __put_unaligned_4_le((val),(__u8 *)(ptr));      \
+               case 4: __put_unaligned_4_le((__force u32)(val),(__u8 *)(ptr)); \
                        break;                                  \
-               case 8: __put_unaligned_8_le((val),(__u8 *)(ptr)); \
+               case 8: __put_unaligned_8_le((__force u64)(val),(__u8 *)(ptr)); \
                        break;                                  \
                default: __bug_unaligned_x(ptr);                \
                        break;                                  \
@@ -149,15 +150,16 @@ static inline void __put_unaligned_8_be(const unsigned long long __v, register _
 
 #define __put_unaligned_be(val,ptr)                                    \
        ({                                                      \
+               (void)sizeof(*(ptr) = (val));                   \
                switch (sizeof(*(ptr))) {                       \
                case 1:                                         \
                        *(ptr) = (val);                         \
                        break;                                  \
-               case 2: __put_unaligned_2_be((val),(__u8 *)(ptr));      \
+               case 2: __put_unaligned_2_be((__force u16)(val),(__u8 *)(ptr)); \
                        break;                                  \
-               case 4: __put_unaligned_4_be((val),(__u8 *)(ptr));      \
+               case 4: __put_unaligned_4_be((__force u32)(val),(__u8 *)(ptr)); \
                        break;                                  \
-               case 8: __put_unaligned_8_be((val),(__u8 *)(ptr)); \
+               case 8: __put_unaligned_8_be((__force u64)(val),(__u8 *)(ptr)); \
                        break;                                  \
                default: __bug_unaligned_x(ptr);                \
                        break;                                  \
diff --git a/include/asm-arm26/a.out.h b/include/asm-arm26/a.out.h
deleted file mode 100644 (file)
index 7167f54..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-#ifndef __ARM_A_OUT_H__
-#define __ARM_A_OUT_H__
-
-#include <linux/personality.h>
-#include <asm/types.h>
-
-struct exec
-{
-  __u32 a_info;                /* Use macros N_MAGIC, etc for access */
-  __u32 a_text;                /* length of text, in bytes */
-  __u32 a_data;                /* length of data, in bytes */
-  __u32 a_bss;         /* length of uninitialized data area for file, in bytes */
-  __u32 a_syms;                /* length of symbol table data in file, in bytes */
-  __u32 a_entry;       /* start address */
-  __u32 a_trsize;      /* length of relocation info for text, in bytes */
-  __u32 a_drsize;      /* length of relocation info for data, in bytes */
-};
-
-/*
- * This is always the same
- */
-#define N_TXTADDR(a)   (0x00008000)
-
-#define N_TRSIZE(a)    ((a).a_trsize)
-#define N_DRSIZE(a)    ((a).a_drsize)
-#define N_SYMSIZE(a)   ((a).a_syms)
-
-#define M_ARM 103
-
-#ifdef __KERNEL__
-#define STACK_TOP      TASK_SIZE
-#define STACK_TOP_MAX  STACK_TOP
-#endif
-
-#ifndef LIBRARY_START_TEXT
-#define LIBRARY_START_TEXT     (0x00c00000)
-#endif
-
-#endif /* __A_OUT_GNU_H__ */
diff --git a/include/asm-arm26/assembler.h b/include/asm-arm26/assembler.h
deleted file mode 100644 (file)
index bb507a9..0000000
+++ /dev/null
@@ -1,106 +0,0 @@
-/*
- * linux/include/asm-arm26/assembler.h
- *
- * This file contains arm architecture specific defines
- * for the different processors.
- *
- * Do not include any C declarations in this file - it is included by
- * assembler source.
- */
-#ifndef __ASSEMBLY__
-#error "Only include this from assembly code"
-#endif
-
-/*
- * Endian independent macros for shifting bytes within registers.
- */
-#define pull            lsr
-#define push            lsl
-#define byte(x)         (x*8)
-
-#ifdef __STDC__
-#define LOADREGS(cond, base, reglist...)\
-       ldm##cond       base,reglist^
-
-#define RETINSTR(instr, regs...)\
-       instr##s        regs
-#else
-#define LOADREGS(cond, base, reglist...)\
-       ldm/**/cond     base,reglist^
-
-#define RETINSTR(instr, regs...)\
-       instr/**/s      regs
-#endif
-
-#define MODENOP\
-       mov     r0, r0
-
-#define MODE(savereg,tmpreg,mode) \
-       mov     savereg, pc; \
-       bic     tmpreg, savereg, $0x0c000003; \
-       orr     tmpreg, tmpreg, $mode; \
-       teqp    tmpreg, $0
-
-#define RESTOREMODE(savereg) \
-       teqp    savereg, $0
-
-#define SAVEIRQS(tmpreg)
-
-#define RESTOREIRQS(tmpreg)
-
-#define DISABLEIRQS(tmpreg)\
-       teqp    pc, $0x08000003
-
-#define ENABLEIRQS(tmpreg)\
-       teqp    pc, $0x00000003
-
-#define USERMODE(tmpreg)\
-       teqp    pc, $0x00000000;\
-       mov     r0, r0
-
-#define SVCMODE(tmpreg)\
-       teqp    pc, $0x00000003;\
-       mov     r0, r0
-
-
-/*
- * Save the current IRQ state and disable IRQs
- * Note that this macro assumes FIQs are enabled, and
- * that the processor is in SVC mode.
- */
-       .macro  save_and_disable_irqs, oldcpsr, temp
-  mov \oldcpsr, pc
-  orr \temp, \oldcpsr, #0x08000000
-  teqp \temp, #0
-  .endm
-
-/*
- * Restore interrupt state previously stored in
- * a register
- * ** Actually do nothing on Arc - hope that the caller uses a MOVS PC soon
- * after!
- */
-       .macro  restore_irqs, oldcpsr
-  @ This be restore_irqs
-  .endm
-
-/*
- * These two are used to save LR/restore PC over a user-based access.
- * The old 26-bit architecture requires that we save lr (R14)
- */
-       .macro  save_lr
-       str     lr, [sp, #-4]!
-       .endm
-
-       .macro  restore_pc
-       ldmfd   sp!, {pc}^
-       .endm
-
-#define USER(x...)                             \
-9999:  x;                                      \
-       .section __ex_table,"a";                \
-       .align  3;                              \
-       .long   9999b,9001f;                    \
-       .previous
-
-
diff --git a/include/asm-arm26/atomic.h b/include/asm-arm26/atomic.h
deleted file mode 100644 (file)
index d6dd423..0000000
+++ /dev/null
@@ -1,123 +0,0 @@
-/*
- *  linux/include/asm-arm26/atomic.h
- *
- *  Copyright (c) 1996 Russell King.
- *  Modified for arm26 by Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Changelog:
- *   25-11-2004 IM     Updated for 2.6.9
- *   27-06-1996        RMK     Created
- *   13-04-1997        RMK     Made functions atomic!
- *   07-12-1997        RMK     Upgraded for v2.1.
- *   26-08-1998        PJB     Added #ifdef __KERNEL__
- *
- *  FIXME - its probably worth seeing what these compile into...
- */
-#ifndef __ASM_ARM_ATOMIC_H
-#define __ASM_ARM_ATOMIC_H
-
-#ifdef CONFIG_SMP
-#error SMP is NOT supported
-#endif
-
-typedef struct { volatile int counter; } atomic_t;
-
-#define ATOMIC_INIT(i) { (i) }
-
-#ifdef __KERNEL__
-#include <asm/system.h>
-
-#define atomic_read(v) ((v)->counter)
-#define atomic_set(v,i)        (((v)->counter) = (i))
-
-static inline int atomic_add_return(int i, atomic_t *v)
-{
-        unsigned long flags;
-        int val;
-
-        local_irq_save(flags);
-        val = v->counter;
-        v->counter = val += i;
-        local_irq_restore(flags);
-
-        return val;
-}
-
-static inline int atomic_sub_return(int i, atomic_t *v)
-{
-        unsigned long flags;
-        int val;
-
-        local_irq_save(flags);
-        val = v->counter;
-        v->counter = val -= i;
-        local_irq_restore(flags);
-
-        return val;
-}
-
-static inline int atomic_cmpxchg(atomic_t *v, int old, int new)
-{
-       int ret;
-       unsigned long flags;
-
-       local_irq_save(flags);
-       ret = v->counter;
-       if (likely(ret == old))
-               v->counter = new;
-       local_irq_restore(flags);
-
-       return ret;
-}
-
-#define atomic_xchg(v, new) (xchg(&((v)->counter), new))
-
-static inline int atomic_add_unless(atomic_t *v, int a, int u)
-{
-       int ret;
-       unsigned long flags;
-
-       local_irq_save(flags);
-       ret = v->counter;
-       if (ret != u)
-               v->counter += a;
-       local_irq_restore(flags);
-
-       return ret != u;
-}
-#define atomic_inc_not_zero(v) atomic_add_unless((v), 1, 0)
-
-static inline void atomic_clear_mask(unsigned long mask, unsigned long *addr)
-{
-        unsigned long flags;
-
-        local_irq_save(flags);
-        *addr &= ~mask;
-        local_irq_restore(flags);
-}
-
-#define atomic_add(i, v)        (void) atomic_add_return(i, v)
-#define atomic_inc(v)           (void) atomic_add_return(1, v)
-#define atomic_sub(i, v)        (void) atomic_sub_return(i, v)
-#define atomic_dec(v)           (void) atomic_sub_return(1, v)
-
-#define atomic_inc_and_test(v)  (atomic_add_return(1, v) == 0)
-#define atomic_dec_and_test(v)  (atomic_sub_return(1, v) == 0)
-#define atomic_inc_return(v)    (atomic_add_return(1, v))
-#define atomic_dec_return(v)    (atomic_sub_return(1, v))
-
-#define atomic_add_negative(i,v) (atomic_add_return(i, v) < 0)
-
-/* Atomic operations are already serializing on ARM26 */
-#define smp_mb__before_atomic_dec()    barrier()
-#define smp_mb__after_atomic_dec()     barrier()
-#define smp_mb__before_atomic_inc()    barrier()
-#define smp_mb__after_atomic_inc()     barrier()
-
-#include <asm-generic/atomic.h>
-#endif
-#endif
diff --git a/include/asm-arm26/auxvec.h b/include/asm-arm26/auxvec.h
deleted file mode 100644 (file)
index c0536f6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifndef __ASMARM_AUXVEC_H
-#define __ASMARM_AUXVEC_H
-
-#endif
diff --git a/include/asm-arm26/bitops.h b/include/asm-arm26/bitops.h
deleted file mode 100644 (file)
index 19a6957..0000000
+++ /dev/null
@@ -1,207 +0,0 @@
-/*
- * Copyright 1995, Russell King.
- *
- * Based on the arm32 version by RMK (and others). Their copyrights apply to
- * Those parts.
- * Modified for arm26 by Ian Molton on 25/11/04
- *
- * bit 0 is the LSB of an "unsigned long" quantity.
- *
- * Please note that the code in this file should never be included
- * from user space.  Many of these are not implemented in assembler
- * since they would be too costly.  Also, they require privileged
- * instructions (which are not available from user mode) to ensure
- * that they are atomic.
- */
-
-#ifndef __ASM_ARM_BITOPS_H
-#define __ASM_ARM_BITOPS_H
-
-#ifdef __KERNEL__
-
-#include <linux/compiler.h>
-#include <asm/system.h>
-
-#define smp_mb__before_clear_bit()     do { } while (0)
-#define smp_mb__after_clear_bit()      do { } while (0)
-
-/*
- * These functions are the basis of our bit ops.
- *
- * First, the atomic bitops. These use native endian.
- */
-static inline void ____atomic_set_bit(unsigned int bit, volatile unsigned long *p)
-{
-       unsigned long flags;
-       unsigned long mask = 1UL << (bit & 31);
-
-       p += bit >> 5;
-
-       local_irq_save(flags);
-       *p |= mask;
-       local_irq_restore(flags);
-}
-
-static inline void ____atomic_clear_bit(unsigned int bit, volatile unsigned long *p)
-{
-       unsigned long flags;
-       unsigned long mask = 1UL << (bit & 31);
-
-       p += bit >> 5;
-
-       local_irq_save(flags);
-       *p &= ~mask;
-       local_irq_restore(flags);
-}
-
-static inline void ____atomic_change_bit(unsigned int bit, volatile unsigned long *p)
-{
-       unsigned long flags;
-       unsigned long mask = 1UL << (bit & 31);
-
-       p += bit >> 5;
-
-       local_irq_save(flags);
-       *p ^= mask;
-       local_irq_restore(flags);
-}
-
-static inline int
-____atomic_test_and_set_bit(unsigned int bit, volatile unsigned long *p)
-{
-       unsigned long flags;
-       unsigned int res;
-       unsigned long mask = 1UL << (bit & 31);
-
-       p += bit >> 5;
-
-       local_irq_save(flags);
-       res = *p;
-       *p = res | mask;
-       local_irq_restore(flags);
-
-       return res & mask;
-}
-
-static inline int
-____atomic_test_and_clear_bit(unsigned int bit, volatile unsigned long *p)
-{
-       unsigned long flags;
-       unsigned int res;
-       unsigned long mask = 1UL << (bit & 31);
-
-       p += bit >> 5;
-
-       local_irq_save(flags);
-       res = *p;
-       *p = res & ~mask;
-       local_irq_restore(flags);
-
-       return res & mask;
-}
-
-static inline int
-____atomic_test_and_change_bit(unsigned int bit, volatile unsigned long *p)
-{
-       unsigned long flags;
-       unsigned int res;
-       unsigned long mask = 1UL << (bit & 31);
-
-       p += bit >> 5;
-
-       local_irq_save(flags);
-       res = *p;
-       *p = res ^ mask;
-       local_irq_restore(flags);
-
-       return res & mask;
-}
-
-#include <asm-generic/bitops/non-atomic.h>
-
-/*
- * Little endian assembly bitops.  nr = 0 -> byte 0 bit 0.
- */
-extern void _set_bit_le(int nr, volatile unsigned long * p);
-extern void _clear_bit_le(int nr, volatile unsigned long * p);
-extern void _change_bit_le(int nr, volatile unsigned long * p);
-extern int _test_and_set_bit_le(int nr, volatile unsigned long * p);
-extern int _test_and_clear_bit_le(int nr, volatile unsigned long * p);
-extern int _test_and_change_bit_le(int nr, volatile unsigned long * p);
-extern int _find_first_zero_bit_le(const unsigned long * p, unsigned size);
-extern int _find_next_zero_bit_le(void * p, int size, int offset);
-extern int _find_first_bit_le(const unsigned long *p, unsigned size);
-extern int _find_next_bit_le(const unsigned long *p, int size, int offset);
-
-/*
- * The __* form of bitops are non-atomic and may be reordered.
- */
-#define        ATOMIC_BITOP_LE(name,nr,p)              \
-       (__builtin_constant_p(nr) ?             \
-        ____atomic_##name(nr, p) :             \
-        _##name##_le(nr,p))
-
-#define NONATOMIC_BITOP(name,nr,p)             \
-       (____nonatomic_##name(nr, p))
-
-/*
- * These are the little endian, atomic definitions.
- */
-#define set_bit(nr,p)                  ATOMIC_BITOP_LE(set_bit,nr,p)
-#define clear_bit(nr,p)                        ATOMIC_BITOP_LE(clear_bit,nr,p)
-#define change_bit(nr,p)               ATOMIC_BITOP_LE(change_bit,nr,p)
-#define test_and_set_bit(nr,p)         ATOMIC_BITOP_LE(test_and_set_bit,nr,p)
-#define test_and_clear_bit(nr,p)       ATOMIC_BITOP_LE(test_and_clear_bit,nr,p)
-#define test_and_change_bit(nr,p)      ATOMIC_BITOP_LE(test_and_change_bit,nr,p)
-#define find_first_zero_bit(p,sz)      _find_first_zero_bit_le(p,sz)
-#define find_next_zero_bit(p,sz,off)   _find_next_zero_bit_le(p,sz,off)
-#define find_first_bit(p,sz)           _find_first_bit_le(p,sz)
-#define find_next_bit(p,sz,off)                _find_next_bit_le(p,sz,off)
-
-#define WORD_BITOFF_TO_LE(x)           ((x))
-
-#include <asm-generic/bitops/ffz.h>
-#include <asm-generic/bitops/__ffs.h>
-#include <asm-generic/bitops/fls.h>
-#include <asm-generic/bitops/fls64.h>
-#include <asm-generic/bitops/ffs.h>
-#include <asm-generic/bitops/sched.h>
-#include <asm-generic/bitops/hweight.h>
-
-/*
- * Ext2 is defined to use little-endian byte ordering.
- * These do not need to be atomic.
- */
-#define ext2_set_bit(nr,p)                     \
-               __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define ext2_set_bit_atomic(lock,nr,p)          \
-                test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define ext2_clear_bit(nr,p)                   \
-               __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define ext2_clear_bit_atomic(lock,nr,p)        \
-                test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define ext2_test_bit(nr,p)                    \
-               test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define ext2_find_first_zero_bit(p,sz)         \
-               _find_first_zero_bit_le(p,sz)
-#define ext2_find_next_zero_bit(p,sz,off)      \
-               _find_next_zero_bit_le(p,sz,off)
-
-/*
- * Minix is defined to use little-endian byte ordering.
- * These do not need to be atomic.
- */
-#define minix_set_bit(nr,p)                    \
-               __set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define minix_test_bit(nr,p)                   \
-               test_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define minix_test_and_set_bit(nr,p)           \
-               __test_and_set_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define minix_test_and_clear_bit(nr,p)         \
-               __test_and_clear_bit(WORD_BITOFF_TO_LE(nr), (unsigned long *)(p))
-#define minix_find_first_zero_bit(p,sz)                \
-               _find_first_zero_bit_le((unsigned long *)(p),sz)
-
-#endif /* __KERNEL__ */
-
-#endif /* _ARM_BITOPS_H */
diff --git a/include/asm-arm26/bug.h b/include/asm-arm26/bug.h
deleted file mode 100644 (file)
index 8545d58..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-#ifndef _ASMARM_BUG_H
-#define _ASMARM_BUG_H
-
-
-#ifdef CONFIG_BUG
-#ifdef CONFIG_DEBUG_BUGVERBOSE
-extern volatile void __bug(const char *file, int line, void *data);
-/* give file/line information */
-#define BUG()          __bug(__FILE__, __LINE__, NULL)
-#else
-#define BUG()          (*(int *)0 = 0)
-#endif
-
-#define HAVE_ARCH_BUG
-#endif
-
-#include <asm-generic/bug.h>
-
-#endif
diff --git a/include/asm-arm26/bugs.h b/include/asm-arm26/bugs.h
deleted file mode 100644 (file)
index e99ac2e..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/*
- *  linux/include/asm-arm26/bugs.h
- *
- *  Copyright (C) 1995  Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASM_BUGS_H
-#define __ASM_BUGS_H
-
-#define check_bugs() cpu_check_bugs()
-
-#endif
diff --git a/include/asm-arm26/byteorder.h b/include/asm-arm26/byteorder.h
deleted file mode 100644 (file)
index 0b4af9a..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  linux/include/asm-arm/byteorder.h
- *
- * ARM Endian-ness.  In little endian mode, the data bus is connected such
- * that byte accesses appear as:
- *  0 = d0...d7, 1 = d8...d15, 2 = d16...d23, 3 = d24...d31
- * and word accesses (data or instruction) appear as:
- *  d0...d31
- *
- */
-#ifndef __ASM_ARM_BYTEORDER_H
-#define __ASM_ARM_BYTEORDER_H
-
-#include <asm/types.h>
-
-#if !defined(__STRICT_ANSI__) || defined(__KERNEL__)
-#  define __BYTEORDER_HAS_U64__
-#  define __SWAB_64_THRU_32__
-#endif
-
-#include <linux/byteorder/little_endian.h>
-
-#endif
-
diff --git a/include/asm-arm26/cache.h b/include/asm-arm26/cache.h
deleted file mode 100644 (file)
index 8c3abcf..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/*
- *  linux/include/asm-arm26/cache.h
- */
-#ifndef __ASMARM_CACHE_H
-#define __ASMARM_CACHE_H
-
-#define        L1_CACHE_SHIFT  5
-#define        L1_CACHE_BYTES  (1 << L1_CACHE_SHIFT)
-#define        L1_CACHE_ALIGN(x)       (((x)+(L1_CACHE_BYTES-1))&~(L1_CACHE_BYTES-1))
-#define        SMP_CACHE_BYTES L1_CACHE_BYTES
-
-#endif
diff --git a/include/asm-arm26/cacheflush.h b/include/asm-arm26/cacheflush.h
deleted file mode 100644 (file)
index 14ae15b..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  linux/include/asm-arm/cacheflush.h
- *
- *  Copyright (C) 2000-2002 Russell King
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * ARM26 cache 'functions'
- *
- */
-
-#ifndef _ASMARM_CACHEFLUSH_H
-#define _ASMARM_CACHEFLUSH_H
-
-#if 1     //FIXME - BAD INCLUDES!!!
-#include <linux/sched.h>
-#include <linux/mm.h>
-#endif
-
-#define flush_cache_all()                       do { } while (0)
-#define flush_cache_mm(mm)                      do { } while (0)
-#define flush_cache_dup_mm(mm)                  do { } while (0)
-#define flush_cache_range(vma,start,end)        do { } while (0)
-#define flush_cache_page(vma,vmaddr,pfn)        do { } while (0)
-#define flush_cache_vmap(start, end)           do { } while (0)
-#define flush_cache_vunmap(start, end)         do { } while (0)
-
-#define invalidate_dcache_range(start,end)      do { } while (0)
-#define clean_dcache_range(start,end)           do { } while (0)
-#define flush_dcache_range(start,end)           do { } while (0)
-#define flush_dcache_page(page)                 do { } while (0)
-#define flush_dcache_mmap_lock(mapping)                do { } while (0)
-#define flush_dcache_mmap_unlock(mapping)      do { } while (0)
-#define clean_dcache_entry(_s)                  do { } while (0)
-#define clean_cache_entry(_start)               do { } while (0)
-
-#define flush_icache_user_range(start,end, bob, fred) do { } while (0)
-#define flush_icache_range(start,end)           do { } while (0)
-#define flush_icache_page(vma,page)             do { } while (0)
-
-#define copy_to_user_page(vma, page, vaddr, dst, src, len) \
-       memcpy(dst, src, len)
-#define copy_from_user_page(vma, page, vaddr, dst, src, len) \
-       memcpy(dst, src, len)
-
-/* DAG: ARM3 will flush cache on MEMC updates anyway? so don't bother */
-/* IM : Yes, it will, but only if setup to do so (we do this). */
-#define clean_cache_area(_start,_size)          do { } while (0)
-
-#endif
diff --git a/include/asm-arm26/checksum.h b/include/asm-arm26/checksum.h
deleted file mode 100644 (file)
index f2b4b0a..0000000
+++ /dev/null
@@ -1,151 +0,0 @@
-/*
- *  linux/include/asm-arm/checksum.h
- *
- * IP checksum routines
- *
- * Copyright (C) Original authors of ../asm-i386/checksum.h
- * Copyright (C) 1996-1999 Russell King
- */
-#ifndef __ASM_ARM_CHECKSUM_H
-#define __ASM_ARM_CHECKSUM_H
-
-#include <linux/in6.h>
-
-/*
- * computes the checksum of a memory block at buff, length len,
- * and adds in "sum" (32-bit)
- *
- * returns a 32-bit number suitable for feeding into itself
- * or csum_tcpudp_magic
- *
- * this function must be called with even lengths, except
- * for the last fragment, which may be odd
- *
- * it's best to have buff aligned on a 32-bit boundary
- */
-__wsum csum_partial(const void *buff, int len, __wsum sum);
-
-/*
- * the same as csum_partial, but copies from src while it
- * checksums, and handles user-space pointer exceptions correctly, when needed.
- *
- * here even more important to align src and dst on a 32-bit (or even
- * better 64-bit) boundary
- */
-
-__wsum
-csum_partial_copy_nocheck(const void *src, void *dst, int len, __wsum sum);
-
-__wsum
-csum_partial_copy_from_user(const void __user *src, void *dst, int len, __wsum sum, int *err_ptr);
-
-/*
- *     This is a version of ip_compute_csum() optimized for IP headers,
- *     which always checksum on 4 octet boundaries.
- */
-static inline __sum16
-ip_fast_csum(const void *iph, unsigned int ihl)
-{
-       unsigned int sum, tmp1;
-
-       __asm__ __volatile__(
-       "ldr    %0, [%1], #4            @ ip_fast_csum          \n\
-       ldr     %3, [%1], #4                                    \n\
-       sub     %2, %2, #5                                      \n\
-       adds    %0, %0, %3                                      \n\
-       ldr     %3, [%1], #4                                    \n\
-       adcs    %0, %0, %3                                      \n\
-       ldr     %3, [%1], #4                                    \n\
-1:     adcs    %0, %0, %3                                      \n\
-       ldr     %3, [%1], #4                                    \n\
-       tst     %2, #15                 @ do this carefully     \n\
-       subne   %2, %2, #1              @ without destroying    \n\
-       bne     1b                      @ the carry flag        \n\
-       adcs    %0, %0, %3                                      \n\
-       adc     %0, %0, #0                                      \n\
-       adds    %0, %0, %0, lsl #16                             \n\
-       addcs   %0, %0, #0x10000                                \n\
-       mvn     %0, %0                                          \n\
-       mov     %0, %0, lsr #16"
-       : "=r" (sum), "=r" (iph), "=r" (ihl), "=r" (tmp1)
-       : "1" (iph), "2" (ihl)
-       : "cc");
-       return (__force __sum16)sum;
-}
-
-/*
- *     Fold a partial checksum without adding pseudo headers
- */
-static inline __sum16 csum_fold(__wsum sum)
-{
-       __asm__(
-       "adds   %0, %1, %1, lsl #16     @ csum_fold             \n\
-       addcs   %0, %0, #0x10000"
-       : "=r" (sum)
-       : "r" (sum)
-       : "cc");
-       return (__force __sum16)(~(__force u32)sum >> 16);
-}
-
-static inline __wsum
-csum_tcpudp_nofold(__be32 saddr, __be32 daddr, unsigned short len,
-                  unsigned short proto, __wsum sum)
-{
-       __asm__(
-       "adds   %0, %1, %2              @ csum_tcpudp_nofold    \n\
-       adcs    %0, %0, %3                                      \n\
-       adcs    %0, %0, %4                                      \n\
-       adcs    %0, %0, %5                                      \n\
-       adc     %0, %0, #0"
-       : "=&r"(sum)
-       : "r" (sum), "r" (daddr), "r" (saddr), "r" (htons(len)), "Ir" (htons(proto))
-       : "cc");
-       return sum;
-}      
-/*
- * computes the checksum of the TCP/UDP pseudo-header
- * returns a 16-bit checksum, already complemented
- */
-static inline __sum16
-csum_tcpudp_magic(__be32 saddr, __be32 daddr, unsigned short len,
-                 unsigned short proto, __wsum sum)
-{
-       __asm__(
-       "adds   %0, %1, %2              @ csum_tcpudp_magic     \n\
-       adcs    %0, %0, %3                                      \n\
-       adcs    %0, %0, %4                                      \n\
-       adcs    %0, %0, %5                                      \n\
-       adc     %0, %0, #0                                      \n\
-       adds    %0, %0, %0, lsl #16                             \n\
-       addcs   %0, %0, #0x10000                                \n\
-       mvn     %0, %0"
-       : "=&r"(sum)
-       : "r" (sum), "r" (daddr), "r" (saddr), "r" (htons(len)), "Ir" (htons(proto))
-       : "cc");
-       return (__force __sum16)((__force u32)sum >> 16);
-}
-
-
-/*
- * this routine is used for miscellaneous IP-like checksums, mainly
- * in icmp.c
- */
-static inline __sum16
-ip_compute_csum(const void *buff, int len)
-{
-       return csum_fold(csum_partial(buff, len, 0));
-}
-
-#define _HAVE_ARCH_IPV6_CSUM
-extern __wsum
-__csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __be32 len,
-               __be32 proto, __wsum sum);
-
-static inline __sum16
-csum_ipv6_magic(const struct in6_addr *saddr, const struct in6_addr *daddr, __u32 len,
-               unsigned short proto, __wsum sum)
-{
-       return csum_fold(__csum_ipv6_magic(saddr, daddr, htonl(len),
-                                          htonl(proto), sum));
-}
-#endif
diff --git a/include/asm-arm26/constants.h b/include/asm-arm26/constants.h
deleted file mode 100644 (file)
index 0d0b144..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-#ifndef __ASM_OFFSETS_H__
-#define __ASM_OFFSETS_H__
-/*
- * DO NOT MODIFY.
- *
- * This file was generated by arch/arm26/Makefile
- *
- */
-
-#define TSK_ACTIVE_MM 96 /* offsetof(struct task_struct, active_mm) */
-
-#define VMA_VM_MM 0 /* offsetof(struct vm_area_struct, vm_mm) */
-#define VMA_VM_FLAGS 20 /* offsetof(struct vm_area_struct, vm_flags) */
-
-#define VM_EXEC 4 /* VM_EXEC */
-
-
-#define PAGE_PRESENT 1 /* L_PTE_PRESENT */
-#define PAGE_READONLY 95 /* PAGE_READONLY */
-#define PAGE_NOT_USER 3 /* PAGE_NONE */
-#define PAGE_OLD 3 /* PAGE_NONE */
-#define PAGE_CLEAN 128 /* L_PTE_DIRTY */
-
-#define PAGE_SZ 32768 /* PAGE_SIZE */
-
-#define SYS_ERROR0 10420224 /* 0x9f0000 */
-
-#endif
diff --git a/include/asm-arm26/cputime.h b/include/asm-arm26/cputime.h
deleted file mode 100644 (file)
index d2783a9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ARM26_CPUTIME_H
-#define __ARM26_CPUTIME_H
-
-#include <asm-generic/cputime.h>
-
-#endif /* __ARM26_CPUTIME_H */
diff --git a/include/asm-arm26/current.h b/include/asm-arm26/current.h
deleted file mode 100644 (file)
index 75d21e2..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _ASMARM_CURRENT_H
-#define _ASMARM_CURRENT_H
-
-#include <linux/thread_info.h>
-
-static inline struct task_struct *get_current(void) __attribute_const__;
-
-static inline struct task_struct *get_current(void)
-{
-       return current_thread_info()->task;
-}
-
-#define current (get_current())
-
-#endif /* _ASMARM_CURRENT_H */
diff --git a/include/asm-arm26/delay.h b/include/asm-arm26/delay.h
deleted file mode 100644 (file)
index 40fbf7b..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-#ifndef __ASM_ARM_DELAY_H
-#define __ASM_ARM_DELAY_H
-
-/*
- * Copyright (C) 1995 Russell King
- *
- * Delay routines, using a pre-computed "loops_per_second" value.
- */
-
-extern void __delay(int loops);
-
-/*
- * division by multiplication: you don't have to worry about
- * loss of precision.
- *
- * Use only for very small delays ( < 1 msec).  Should probably use a
- * lookup table, really, as the multiplications take much too long with
- * short delays.  This is a "reasonable" implementation, though (and the
- * first constant multiplications gets optimized away if the delay is
- * a constant)
- *
- * FIXME - lets improve it then...
- */
-extern void udelay(unsigned long usecs);
-
-static inline unsigned long muldiv(unsigned long a, unsigned long b, unsigned long c)
-{
-       return a * b / c;
-}
-
-       
-
-#endif /* defined(_ARM_DELAY_H) */
-
diff --git a/include/asm-arm26/device.h b/include/asm-arm26/device.h
deleted file mode 100644 (file)
index d8f9872..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/*
- * Arch specific extensions to struct device
- *
- * This file is released under the GPLv2
- */
-#include <asm-generic/device.h>
-
diff --git a/include/asm-arm26/div64.h b/include/asm-arm26/div64.h
deleted file mode 100644 (file)
index 6cd978c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/div64.h>
diff --git a/include/asm-arm26/dma.h b/include/asm-arm26/dma.h
deleted file mode 100644 (file)
index 4326ba8..0000000
+++ /dev/null
@@ -1,183 +0,0 @@
-#ifndef __ASM_ARM_DMA_H
-#define __ASM_ARM_DMA_H
-
-typedef unsigned int dmach_t;
-
-#include <linux/spinlock.h>
-#include <asm/system.h>
-#include <asm/memory.h>
-#include <asm/scatterlist.h>
-
-// FIXME - do we really need this? arm26 cant do 'proper' DMA
-
-typedef struct dma_struct dma_t;
-typedef unsigned int dmamode_t;
-
-struct dma_ops {
-        int     (*request)(dmach_t, dma_t *);           /* optional */
-        void    (*free)(dmach_t, dma_t *);              /* optional */
-        void    (*enable)(dmach_t, dma_t *);            /* mandatory */
-        void    (*disable)(dmach_t, dma_t *);           /* mandatory */
-        int     (*residue)(dmach_t, dma_t *);           /* optional */
-        int     (*setspeed)(dmach_t, dma_t *, int);     /* optional */
-        char    *type;
-};
-
-struct dma_struct {
-        struct scatterlist buf;         /* single DMA                   */
-        int             sgcount;        /* number of DMA SG             */
-        struct scatterlist *sg;         /* DMA Scatter-Gather List      */
-
-        unsigned int    active:1;       /* Transfer active              */
-        unsigned int    invalid:1;      /* Address/Count changed        */
-        unsigned int    using_sg:1;     /* using scatter list?          */
-        dmamode_t       dma_mode;       /* DMA mode                     */
-        int             speed;          /* DMA speed                    */
-
-        unsigned int    lock;           /* Device is allocated          */
-        const char      *device_id;     /* Device name                  */
-
-        unsigned int    dma_base;       /* Controller base address      */
-        int             dma_irq;        /* Controller IRQ               */
-        int             state;          /* Controller state             */
-        struct scatterlist cur_sg;      /* Current controller buffer    */
-
-        struct dma_ops  *d_ops;
-};
-
-/* Prototype: void arch_dma_init(dma)
- * Purpose  : Initialise architecture specific DMA
- * Params   : dma - pointer to array of DMA structures
- */
-extern void arch_dma_init(dma_t *dma);
-
-extern void isa_init_dma(dma_t *dma);
-
-
-#define MAX_DMA_ADDRESS         0x03000000
-#define MAX_DMA_CHANNELS        3
-
-/* ARC */
-#define DMA_VIRTUAL_FLOPPY0     0
-#define DMA_VIRTUAL_FLOPPY1     1
-#define DMA_VIRTUAL_SOUND       2
-
-/* A5K */
-#define DMA_FLOPPY              0
-
-/*
- * DMA modes
- */
-#define DMA_MODE_MASK  3
-
-#define DMA_MODE_READ   0
-#define DMA_MODE_WRITE  1
-#define DMA_MODE_CASCADE 2
-#define DMA_AUTOINIT    4
-
-extern spinlock_t  dma_spin_lock;
-
-static inline unsigned long claim_dma_lock(void)
-{
-       unsigned long flags;
-       spin_lock_irqsave(&dma_spin_lock, flags);
-       return flags;
-}
-
-static inline void release_dma_lock(unsigned long flags)
-{
-       spin_unlock_irqrestore(&dma_spin_lock, flags);
-}
-
-/* Clear the 'DMA Pointer Flip Flop'.
- * Write 0 for LSB/MSB, 1 for MSB/LSB access.
- */
-#define clear_dma_ff(channel)
-
-/* Set only the page register bits of the transfer address.
- *
- * NOTE: This is an architecture specific function, and should
- *       be hidden from the drivers
- */
-extern void set_dma_page(dmach_t channel, char pagenr);
-
-/* Request a DMA channel
- *
- * Some architectures may need to do allocate an interrupt
- */
-extern int  request_dma(dmach_t channel, const char * device_id);
-
-/* Free a DMA channel
- *
- * Some architectures may need to do free an interrupt
- */
-extern void free_dma(dmach_t channel);
-
-/* Enable DMA for this channel
- *
- * On some architectures, this may have other side effects like
- * enabling an interrupt and setting the DMA registers.
- */
-extern void enable_dma(dmach_t channel);
-
-/* Disable DMA for this channel
- *
- * On some architectures, this may have other side effects like
- * disabling an interrupt or whatever.
- */
-extern void disable_dma(dmach_t channel);
-
-/* Test whether the specified channel has an active DMA transfer
- */
-extern int dma_channel_active(dmach_t channel);
-
-/* Set the DMA scatter gather list for this channel
- *
- * This should not be called if a DMA channel is enabled,
- * especially since some DMA architectures don't update the
- * DMA address immediately, but defer it to the enable_dma().
- */
-extern void set_dma_sg(dmach_t channel, struct scatterlist *sg, int nr_sg);
-
-/* Set the DMA address for this channel
- *
- * This should not be called if a DMA channel is enabled,
- * especially since some DMA architectures don't update the
- * DMA address immediately, but defer it to the enable_dma().
- */
-extern void set_dma_addr(dmach_t channel, unsigned long physaddr);
-
-/* Set the DMA byte count for this channel
- *
- * This should not be called if a DMA channel is enabled,
- * especially since some DMA architectures don't update the
- * DMA count immediately, but defer it to the enable_dma().
- */
-extern void set_dma_count(dmach_t channel, unsigned long count);
-
-/* Set the transfer direction for this channel
- *
- * This should not be called if a DMA channel is enabled,
- * especially since some DMA architectures don't update the
- * DMA transfer direction immediately, but defer it to the
- * enable_dma().
- */
-extern void set_dma_mode(dmach_t channel, dmamode_t mode);
-
-/* Set the transfer speed for this channel
- */
-extern void set_dma_speed(dmach_t channel, int cycle_ns);
-
-/* Get DMA residue count. After a DMA transfer, this
- * should return zero. Reading this while a DMA transfer is
- * still in progress will return unpredictable results.
- * If called before the channel has been used, it may return 1.
- * Otherwise, it returns the number of _bytes_ left to transfer.
- */
-extern int  get_dma_residue(dmach_t channel);
-
-#ifndef NO_DMA
-#define NO_DMA 255
-#endif
-
-#endif /* _ARM_DMA_H */
diff --git a/include/asm-arm26/ecard.h b/include/asm-arm26/ecard.h
deleted file mode 100644 (file)
index 6669193..0000000
+++ /dev/null
@@ -1,294 +0,0 @@
-/*
- * linux/include/asm-arm26/ecard.h
- *
- * definitions for expansion cards
- *
- * This is a new system as from Linux 1.2.3
- *
- * Changelog:
- *  11-12-1996 RMK     Further minor improvements
- *  12-09-1997 RMK     Added interrupt enable/disable for card level
- *  18-05-2003  IM      Adjusted for ARM26
- *
- * Reference: Acorns Risc OS 3 Programmers Reference Manuals.
- */
-
-#ifndef __ASM_ECARD_H
-#define __ASM_ECARD_H
-
-/*
- * Currently understood cards (but not necessarily
- * supported):
- *                        Manufacturer  Product ID
- */
-#define MANU_ACORN             0x0000
-#define PROD_ACORN_SCSI                        0x0002
-#define PROD_ACORN_ETHER1              0x0003
-#define PROD_ACORN_MFM                 0x000b
-
-#define MANU_CCONCEPTS         0x0009
-#define PROD_CCONCEPTS_COLOURCARD      0x0050
-
-#define MANU_ANT2              0x0011
-#define PROD_ANT_ETHER3                        0x00a4
-
-#define MANU_ATOMWIDE          0x0017
-#define PROD_ATOMWIDE_3PSERIAL         0x0090
-
-#define MANU_IRLAM_INSTRUMENTS 0x001f
-#define MANU_IRLAM_INSTRUMENTS_ETHERN  0x5678
-
-#define MANU_OAK               0x0021
-#define PROD_OAK_SCSI                  0x0058
-
-#define MANU_MORLEY            0x002b
-#define PROD_MORLEY_SCSI_UNCACHED      0x0067
-
-#define MANU_CUMANA            0x003a
-#define PROD_CUMANA_SCSI_2             0x003a
-#define PROD_CUMANA_SCSI_1             0x00a0
-
-#define MANU_ICS               0x003c
-#define PROD_ICS_IDE                   0x00ae
-
-#define MANU_ICS2              0x003d
-#define PROD_ICS2_IDE                  0x00ae
-
-#define MANU_SERPORT           0x003f
-#define PROD_SERPORT_DSPORT            0x00b9
-
-#define MANU_ARXE              0x0041
-#define PROD_ARXE_SCSI                 0x00be
-
-#define MANU_I3                        0x0046
-#define PROD_I3_ETHERLAN500            0x00d4
-#define PROD_I3_ETHERLAN600            0x00ec
-#define PROD_I3_ETHERLAN600A           0x011e
-
-#define MANU_ANT               0x0053
-#define PROD_ANT_ETHERM                        0x00d8
-#define PROD_ANT_ETHERB                        0x00e4
-
-#define MANU_ALSYSTEMS         0x005b
-#define PROD_ALSYS_SCSIATAPI           0x0107
-
-#define MANU_MCS               0x0063
-#define PROD_MCS_CONNECT32             0x0125
-
-#define MANU_EESOX             0x0064
-#define PROD_EESOX_SCSI2               0x008c
-
-#define MANU_YELLOWSTONE       0x0096
-#define PROD_YELLOWSTONE_RAPIDE32      0x0120
-
-#define MANU_SIMTEC             0x005f
-#define PROD_SIMTEC_IDE8                0x0130
-#define PROD_SIMTEC_IDE16               0x0131
-
-
-#ifdef ECARD_C
-#define CONST
-#else
-#define CONST const
-#endif
-
-#define MAX_ECARDS     4
-
-typedef enum {                         /* Cards address space          */
-       ECARD_IOC,
-       ECARD_MEMC,
-       ECARD_EASI
-} card_type_t;
-
-typedef enum {                         /* Speed for ECARD_IOC space    */
-       ECARD_SLOW       = 0,
-       ECARD_MEDIUM     = 1,
-       ECARD_FAST       = 2,
-       ECARD_SYNC       = 3
-} card_speed_t;
-
-struct ecard_id {                      /* Card ID structure            */
-       unsigned short  manufacturer;
-       unsigned short  product;
-       void            *data;
-};
-
-struct in_ecid {                       /* Packed card ID information   */
-       unsigned short  product;        /* Product code                 */
-       unsigned short  manufacturer;   /* Manufacturer code            */
-       unsigned char   id:4;           /* Simple ID                    */
-       unsigned char   cd:1;           /* Chunk dir present            */
-       unsigned char   is:1;           /* Interrupt status pointers    */
-       unsigned char   w:2;            /* Width                        */
-       unsigned char   country;        /* Country                      */
-       unsigned char   irqmask;        /* IRQ mask                     */
-       unsigned char   fiqmask;        /* FIQ mask                     */
-       unsigned long   irqoff;         /* IRQ offset                   */
-       unsigned long   fiqoff;         /* FIQ offset                   */
-};
-
-typedef struct expansion_card ecard_t;
-typedef unsigned long *loader_t;
-
-typedef struct {                       /* Card handler routines        */
-       void (*irqenable)(ecard_t *ec, int irqnr);
-       void (*irqdisable)(ecard_t *ec, int irqnr);
-       int  (*irqpending)(ecard_t *ec);
-       void (*fiqenable)(ecard_t *ec, int fiqnr);
-       void (*fiqdisable)(ecard_t *ec, int fiqnr);
-       int  (*fiqpending)(ecard_t *ec);
-} expansioncard_ops_t;
-
-#define ECARD_NUM_RESOURCES    (6)
-
-#define ECARD_RES_IOCSLOW      (0)
-#define ECARD_RES_IOCMEDIUM    (1)
-#define ECARD_RES_IOCFAST      (2)
-#define ECARD_RES_IOCSYNC      (3)
-#define ECARD_RES_MEMC         (4)
-#define ECARD_RES_EASI         (5)
-
-#define ecard_resource_start(ec,nr)    ((ec)->resource[nr].start)
-#define ecard_resource_end(ec,nr)      ((ec)->resource[nr].end)
-#define ecard_resource_len(ec,nr)      ((ec)->resource[nr].end - \
-                                        (ec)->resource[nr].start + 1)
-
-/*
- * This contains all the info needed on an expansion card
- */
-struct expansion_card {
-       struct expansion_card  *next;
-
-       struct device           dev;
-       struct resource         resource[ECARD_NUM_RESOURCES];
-
-       /* Public data */
-       volatile unsigned char *irqaddr;     /* address of IRQ register */
-       volatile unsigned char *fiqaddr;     /* address of FIQ register */
-       unsigned char           irqmask;     /* IRQ mask */
-       unsigned char           fiqmask;     /* FIQ mask */
-       unsigned char           claimed;     /* Card claimed? */
-
-       void                    *irq_data;   /* Data for use for IRQ by card */
-       void                    *fiq_data;   /* Data for use for FIQ by card */
-       const expansioncard_ops_t *ops;      /* Enable/Disable Ops for card */
-
-       CONST unsigned int      slot_no;     /* Slot number */
-       CONST unsigned int      dma;         /* DMA number (for request_dma) */
-       CONST unsigned int      irq;         /* IRQ number (for request_irq) */
-       CONST unsigned int      fiq;         /* FIQ number (for request_irq) */
-       CONST card_type_t       type;        /* Type of card */
-       CONST struct in_ecid    cid;         /* Card Identification */
-
-       /* Private internal data */
-       const char              *card_desc;  /* Card description */
-       CONST unsigned int      podaddr;     /* Base Linux address for card */
-       CONST loader_t          loader;      /* loader program */
-       u64                     dma_mask;
-};
-
-struct in_chunk_dir {
-       unsigned int start_offset;
-       union {
-               unsigned char string[256];
-               unsigned char data[1];
-       } d;
-};
-
-/*
- * ecard_claim: claim an expansion card entry
- * FIXME - are these atomic / called with interrupts off ?
- */
-#define ecard_claim(ec) ((ec)->claimed = 1)
-
-/*
- * ecard_release: release an expansion card entry
- */
-#define ecard_release(ec) ((ec)->claimed = 0)
-
-/*
- * Read a chunk from an expansion card
- * cd : where to put read data
- * ec : expansion card info struct
- * id : id number to find
- * num: (n+1)'th id to find.
- */
-extern int ecard_readchunk (struct in_chunk_dir *cd, struct expansion_card *ec, int id, int num);
-
-/*
- * Obtain the address of a card
- */
-extern unsigned int ecard_address (struct expansion_card *ec, card_type_t card_type, card_speed_t speed);
-
-#ifdef ECARD_C
-/* Definitions internal to ecard.c - for it's use only!!
- *
- * External expansion card header as read from the card
- */
-struct ex_ecid {
-       unsigned char   r_irq:1;
-       unsigned char   r_zero:1;
-       unsigned char   r_fiq:1;
-       unsigned char   r_id:4;
-       unsigned char   r_a:1;
-
-       unsigned char   r_cd:1;
-       unsigned char   r_is:1;
-       unsigned char   r_w:2;
-       unsigned char   r_r1:4;
-
-       unsigned char   r_r2:8;
-
-       unsigned char   r_prod[2];
-
-       unsigned char   r_manu[2];
-
-       unsigned char   r_country;
-
-       unsigned char   r_irqmask;
-       unsigned char   r_irqoff[3];
-
-       unsigned char   r_fiqmask;
-       unsigned char   r_fiqoff[3];
-};
-
-/*
- * Chunk directory entry as read from the card
- */
-struct ex_chunk_dir {
-       unsigned char r_id;
-       unsigned char r_len[3];
-       unsigned long r_start;
-       union {
-               char string[256];
-               char data[1];
-       } d;
-#define c_id(x)                ((x)->r_id)
-#define c_len(x)       ((x)->r_len[0]|((x)->r_len[1]<<8)|((x)->r_len[2]<<16))
-#define c_start(x)     ((x)->r_start)
-};
-
-#endif
-
-extern struct bus_type ecard_bus_type;
-
-#define ECARD_DEV(_d)  container_of((_d), struct expansion_card, dev)
-
-struct ecard_driver {
-       int                     (*probe)(struct expansion_card *, const struct ecard_id *id);
-       void                    (*remove)(struct expansion_card *);
-       void                    (*shutdown)(struct expansion_card *);
-       const struct ecard_id   *id_table;
-       unsigned int            id;
-       struct device_driver    drv;
-};
-
-#define ECARD_DRV(_d)  container_of((_d), struct ecard_driver, drv)
-
-#define ecard_set_drvdata(ec,data)     dev_set_drvdata(&(ec)->dev, (data))
-#define ecard_get_drvdata(ec)          dev_get_drvdata(&(ec)->dev)
-
-int ecard_register_driver(struct ecard_driver *);
-void ecard_remove_driver(struct ecard_driver *);
-
-#endif
diff --git a/include/asm-arm26/elf.h b/include/asm-arm26/elf.h
deleted file mode 100644 (file)
index 5a47fdb..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef __ASMARM_ELF_H
-#define __ASMARM_ELF_H
-
-/*
- * ELF register definitions..
- */
-
-#include <asm/ptrace.h>
-#include <asm/procinfo.h>
-
-//FIXME - is it always 32K ?
-
-#define ELF_EXEC_PAGESIZE       32768
-#define SET_PERSONALITY(ex,ibcs2) set_personality(PER_LINUX)
-
-typedef unsigned long elf_greg_t;
-typedef unsigned long elf_freg_t[3];
-
-#define ELF_NGREG (sizeof (struct pt_regs) / sizeof(elf_greg_t))
-typedef elf_greg_t elf_gregset_t[ELF_NGREG];
-
-typedef struct { void *null; } elf_fpregset_t;
-
-/*
- * This is used to ensure we don't load something for the wrong architecture.
- * We can only execute 26-bit code.
- */
-
-#define EM_ARM 40
-#define EF_ARM_APCS26 0x08
-
-//#define elf_check_arch(x) ( ((x)->e_machine == EM_ARM) && ((x)->e_flags & EF_ARM_APCS26) )      FIXME!!!!! - this looks OK, but the flags seem to be wrong.
-#define elf_check_arch(x) (1)
-
-/*
- * These are used to set parameters in the core dumps.
- */
-#define ELF_CLASS      ELFCLASS32
-#define ELF_DATA       ELFDATA2LSB
-#define ELF_ARCH       EM_ARM
-
-#define USE_ELF_CORE_DUMP
-
-/* This is the location that an ET_DYN program is loaded if exec'ed.  Typical
-   use of this is to invoke "./ld.so someprog" to test out a new version of
-   the loader.  We need to make sure that it is out of the way of the program
-   that it will "exec", and that there is sufficient room for the brk.  */
-
-#define ELF_ET_DYN_BASE        (2 * TASK_SIZE / 3)
-
-/* When the program starts, a1 contains a pointer to a function to be 
-   registered with atexit, as per the SVR4 ABI.  A value of 0 means we 
-   have no such handler.  */
-#define ELF_PLAT_INIT(_r, load_addr)   (_r)->ARM_r0 = 0
-
-/* This yields a mask that user programs can use to figure out what
-   instruction set this cpu supports. */
-
-extern unsigned int elf_hwcap;
-#define ELF_HWCAP      (elf_hwcap)
-
-/* This yields a string that ld.so will use to load implementation
-   specific libraries for optimization.  This is more specific in
-   intent than poking at uname or /proc/cpuinfo. */
-
-/* For now we just provide a fairly general string that describes the
-   processor family.  This could be made more specific later if someone
-   implemented optimisations that require it.  26-bit CPUs give you
-   "v1l" for ARM2 (no SWP) and "v2l" for anything else (ARM1 isn't
-   supported).
- */
-
-#define ELF_PLATFORM_SIZE 8
-extern char elf_platform[];
-#define ELF_PLATFORM   (elf_platform)
-
-#endif
diff --git a/include/asm-arm26/emergency-restart.h b/include/asm-arm26/emergency-restart.h
deleted file mode 100644 (file)
index 108d8c4..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_EMERGENCY_RESTART_H
-#define _ASM_EMERGENCY_RESTART_H
-
-#include <asm-generic/emergency-restart.h>
-
-#endif /* _ASM_EMERGENCY_RESTART_H */
diff --git a/include/asm-arm26/errno.h b/include/asm-arm26/errno.h
deleted file mode 100644 (file)
index 6e60f06..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ARM_ERRNO_H
-#define _ARM_ERRNO_H
-
-#include <asm-generic/errno.h>
-
-#endif
diff --git a/include/asm-arm26/fb.h b/include/asm-arm26/fb.h
deleted file mode 100644 (file)
index c7df380..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _ASM_FB_H_
-#define _ASM_FB_H_
-#include <linux/fb.h>
-
-#define fb_pgprotect(...) do {} while (0)
-
-static inline int fb_is_primary_device(struct fb_info *info)
-{
-       return 0;
-}
-
-#endif /* _ASM_FB_H_ */
diff --git a/include/asm-arm26/fcntl.h b/include/asm-arm26/fcntl.h
deleted file mode 100644 (file)
index d85995e..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef _ARM_FCNTL_H
-#define _ARM_FCNTL_H
-
-/* open/fcntl - O_SYNC is only implemented on blocks devices and on files
-   located on an ext2 file system */
-#define O_DIRECTORY     040000 /* must be a directory */
-#define O_NOFOLLOW     0100000 /* don't follow links */
-#define O_DIRECT       0200000 /* direct disk access hint - currently ignored */
-#define O_LARGEFILE    0400000
-
-#include <asm-generic/fcntl.h>
-
-#endif
diff --git a/include/asm-arm26/fiq.h b/include/asm-arm26/fiq.h
deleted file mode 100644 (file)
index a3bad09..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  linux/include/asm-arm/fiq.h
- *
- * Support for FIQ on ARM architectures.
- * Written by Philip Blundell <philb@gnu.org>, 1998
- * Re-written by Russell King
- */
-
-#ifndef __ASM_FIQ_H
-#define __ASM_FIQ_H
-
-#include <asm/ptrace.h>
-
-struct fiq_handler {
-       struct fiq_handler *next;
-       /* Name
-        */
-       const char *name;
-       /* Called to ask driver to relinquish/
-        * reacquire FIQ
-        * return zero to accept, or -<errno>
-        */
-       int (*fiq_op)(void *, int relinquish);
-       /* data for the relinquish/reacquire functions
-        */
-       void *dev_id;
-};
-
-extern int claim_fiq(struct fiq_handler *f);
-extern void release_fiq(struct fiq_handler *f);
-extern void set_fiq_handler(void *start, unsigned int length);
-extern void set_fiq_regs(struct pt_regs *regs);
-extern void get_fiq_regs(struct pt_regs *regs);
-extern void enable_fiq(int fiq);
-extern void disable_fiq(int fiq);
-
-#endif
diff --git a/include/asm-arm26/floppy.h b/include/asm-arm26/floppy.h
deleted file mode 100644 (file)
index efb7321..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *  linux/include/asm-arm/floppy.h
- *
- *  Copyright (C) 1996-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Note that we don't touch FLOPPY_DMA nor FLOPPY_IRQ here
- */
-#ifndef __ASM_ARM_FLOPPY_H
-#define __ASM_ARM_FLOPPY_H
-
-#define fd_outb(val,port)                      \
-       do {                                    \
-               if ((port) == FD_DOR)           \
-                       fd_setdor((val));       \
-               else                            \
-                       outb((val),(port));     \
-       } while(0)
-
-#define fd_inb(port)           inb((port))
-#define fd_request_irq()       request_irq(IRQ_FLOPPYDISK,floppy_interrupt,\
-                                       IRQF_DISABLED,"floppy",NULL)
-#define fd_free_irq()          free_irq(IRQ_FLOPPYDISK,NULL)
-#define fd_disable_irq()       disable_irq(IRQ_FLOPPYDISK)
-#define fd_enable_irq()                enable_irq(IRQ_FLOPPYDISK)
-
-#define fd_request_dma()       request_dma(DMA_FLOPPY,"floppy")
-#define fd_free_dma()          free_dma(DMA_FLOPPY)
-#define fd_disable_dma()       disable_dma(DMA_FLOPPY)
-#define fd_enable_dma()                enable_dma(DMA_FLOPPY)
-#define fd_clear_dma_ff()      clear_dma_ff(DMA_FLOPPY)
-#define fd_set_dma_mode(mode)  set_dma_mode(DMA_FLOPPY, (mode))
-#define fd_set_dma_addr(addr)  set_dma_addr(DMA_FLOPPY, virt_to_bus((addr)))
-#define fd_set_dma_count(len)  set_dma_count(DMA_FLOPPY, (len))
-#define fd_cacheflush(addr,sz)
-
-/* need to clean up dma.h */
-#define DMA_FLOPPYDISK         DMA_FLOPPY
-
-/* Floppy_selects is the list of DOR's to select drive fd
- *
- * On initialisation, the floppy list is scanned, and the drives allocated
- * in the order that they are found.  This is done by seeking the drive
- * to a non-zero track, and then restoring it to track 0.  If an error occurs,
- * then there is no floppy drive present.       [to be put back in again]
- */
-static unsigned char floppy_selects[2][4] =
-{
-       { 0x10, 0x21, 0x23, 0x33 },
-       { 0x10, 0x21, 0x23, 0x33 }
-};
-
-#define fd_setdor(dor)                                                         \
-do {                                                                           \
-       int new_dor = (dor);                                                    \
-       if (new_dor & 0xf0)                                                     \
-               new_dor = (new_dor & 0x0c) | floppy_selects[fdc][new_dor & 3];  \
-       else                                                                    \
-               new_dor &= 0x0c;                                                \
-       outb(new_dor, FD_DOR);                                                  \
-} while (0)
-
-/*
- * Someday, we'll automatically detect which drives are present...
- */
-static inline void fd_scandrives (void)
-{
-#if 0
-       int floppy, drive_count;
-
-       fd_disable_irq();
-       raw_cmd = &default_raw_cmd;
-       raw_cmd->flags = FD_RAW_SPIN | FD_RAW_NEED_SEEK;
-       raw_cmd->track = 0;
-       raw_cmd->rate = ?;
-       drive_count = 0;
-       for (floppy = 0; floppy < 4; floppy ++) {
-               current_drive = drive_count;
-               /*
-                * Turn on floppy motor
-                */
-               if (start_motor(redo_fd_request))
-                       continue;
-               /*
-                * Set up FDC
-                */
-               fdc_specify();
-               /*
-                * Tell FDC to recalibrate
-                */
-               output_byte(FD_RECALIBRATE);
-               LAST_OUT(UNIT(floppy));
-               /* wait for command to complete */
-               if (!successful) {
-                       int i;
-                       for (i = drive_count; i < 3; i--)
-                               floppy_selects[fdc][i] = floppy_selects[fdc][i + 1];
-                       floppy_selects[fdc][3] = 0;
-                       floppy -= 1;
-               } else
-                       drive_count++;
-       }
-#else
-       floppy_selects[0][0] = 0x10;
-       floppy_selects[0][1] = 0x21;
-       floppy_selects[0][2] = 0x23;
-       floppy_selects[0][3] = 0x33;
-#endif
-}
-
-#define FDC1 (0x3f0)
-
-#define FLOPPY0_TYPE 4
-#define FLOPPY1_TYPE 4
-
-#define N_FDC 1
-#define N_DRIVE 4
-
-#define FLOPPY_MOTOR_MASK 0xf0
-
-#define CROSS_64KB(a,s) (0)
-
-/*
- * This allows people to reverse the order of
- * fd0 and fd1, in case their hardware is
- * strangely connected (as some RiscPCs
- * and A5000s seem to be).
- */
-static void driveswap(int *ints, int dummy, int dummy2)
-{
-       floppy_selects[0][0] ^= floppy_selects[0][1];
-       floppy_selects[0][1] ^= floppy_selects[0][0];
-       floppy_selects[0][0] ^= floppy_selects[0][1];
-}
-
-#define EXTRA_FLOPPY_PARAMS ,{ "driveswap", &driveswap, NULL, 0, 0 }
-       
-#endif
diff --git a/include/asm-arm26/fpstate.h b/include/asm-arm26/fpstate.h
deleted file mode 100644 (file)
index 785749b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  linux/include/asm-arm/fpstate.h
- *
- *  Copyright (C) 1995 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __ASM_ARM_FPSTATE_H
-#define __ASM_ARM_FPSTATE_H
-
-#define FP_SIZE 35
-
-struct fp_hard_struct {
-       unsigned int save[FP_SIZE];             /* as yet undefined */
-};
-
-struct fp_soft_struct {
-       unsigned int save[FP_SIZE];             /* undefined information */
-};
-
-union fp_state {
-       struct fp_hard_struct   hard;
-       struct fp_soft_struct   soft;
-};
-
-#endif
diff --git a/include/asm-arm26/futex.h b/include/asm-arm26/futex.h
deleted file mode 100644 (file)
index 6a332a9..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_FUTEX_H
-#define _ASM_FUTEX_H
-
-#include <asm-generic/futex.h>
-
-#endif
diff --git a/include/asm-arm26/hardirq.h b/include/asm-arm26/hardirq.h
deleted file mode 100644 (file)
index e717742..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-#ifndef __ASM_HARDIRQ_H
-#define __ASM_HARDIRQ_H
-
-#include <linux/cache.h>
-#include <linux/threads.h>
-#include <asm/irq.h>
-
-typedef struct {
-       unsigned int __softirq_pending;
-} ____cacheline_aligned irq_cpustat_t;
-
-#include <linux/irq_cpustat.h> /* Standard mappings for irq_cpustat_t above */
-
-#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
-
-#ifndef CONFIG_SMP
-
-extern asmlinkage void __do_softirq(void);
-
-#endif
-
-
-#endif /* __ASM_HARDIRQ_H */
diff --git a/include/asm-arm26/hardware.h b/include/asm-arm26/hardware.h
deleted file mode 100644 (file)
index 801df0b..0000000
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-arc/hardware.h
- *
- *  Copyright (C) 1996-1999 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  This file contains the hardware definitions of the
- *  Acorn Archimedes/A5000 machines.
- *
- *  Modifications:
- *   04-04-1998        PJB/RMK Merged arc and a5k versions
- */
-#ifndef __ASM_HARDWARE_H
-#define __ASM_HARDWARE_H
-
-
-
-/*
- * What hardware must be present - these can be tested by the kernel
- * source.
- */
-#define HAS_IOC
-#define HAS_MEMC
-#define HAS_VIDC
-
-#define VDMA_ALIGNMENT  PAGE_SIZE
-#define VDMA_XFERSIZE   16
-#define VDMA_INIT       0
-#define VDMA_START      1
-#define VDMA_END        2
-
-#ifndef __ASSEMBLY__
-extern void memc_write(unsigned int reg, unsigned long val);
-
-#define video_set_dma(start,end,offset)                         \
-do {                                                            \
-        memc_write (VDMA_START, (start >> 2));                  \
-        memc_write (VDMA_END, (end - VDMA_XFERSIZE) >> 2);      \
-        memc_write (VDMA_INIT, (offset >> 2));                  \
-} while (0)
-#endif
-
-
-/* Hardware addresses of major areas.
- *  *_START is the physical address
- *  *_SIZE  is the size of the region
- *  *_BASE  is the virtual address
- */
-#define IO_START               0x03000000
-#define IO_SIZE                        0x01000000
-#define IO_BASE                        0x03000000
-
-/*
- * Screen mapping information
- */
-#define SCREEN_START           0x02000000
-#define SCREEN_END             0x02078000
-#define SCREEN_SIZE            0x00078000
-#define SCREEN_BASE            0x02000000
-
-
-#define EXPMASK_BASE           0x03360000
-#define IOEB_BASE              0x03350000
-#define VIDC_BASE              0x03400000
-#define LATCHA_BASE            0x03250040
-#define LATCHB_BASE            0x03250018
-#define IOC_BASE               0x03200000
-#define FLOPPYDMA_BASE         0x0302a000
-#define PCIO_BASE              0x03010000
-
-// FIXME - are the below correct?
-#define PODSLOT_IOC0_BASE       0x03240000
-#define PODSLOT_IOC_SIZE        (1 << 14)
-#define PODSLOT_MEMC_BASE       0x03000000
-#define PODSLOT_MEMC_SIZE       (1 << 14)
-
-#define vidc_writel(val)       __raw_writel(val, VIDC_BASE)
-
-#ifndef __ASSEMBLY__
-
-/*
- * for use with inb/outb
- */
-#define IOEB_VID_CTL           (IOEB_BASE + 0x48)
-#define IOEB_PRESENT           (IOEB_BASE + 0x50)
-#define IOEB_PSCLR             (IOEB_BASE + 0x58)
-#define IOEB_MONTYPE           (IOEB_BASE + 0x70)
-
-//FIXME - These adresses are weird - ISTR some weirdo address shifting stuff was going on here...
-#define IO_EC_IOC_BASE         0x80090000
-#define IO_EC_MEMC_BASE                0x80000000
-
-#ifdef CONFIG_ARCH_ARC
-/* A680 hardware */
-#define WD1973_BASE            0x03290000
-#define WD1973_LATCH           0x03350000
-#define Z8530_BASE             0x032b0008
-#define SCSI_BASE              0x03100000
-#endif
-
-#endif
-
-#define        EXPMASK_STATUS          (EXPMASK_BASE + 0x00)
-#define EXPMASK_ENABLE         (EXPMASK_BASE + 0x04)
-
-#endif
diff --git a/include/asm-arm26/ide.h b/include/asm-arm26/ide.h
deleted file mode 100644 (file)
index db804d7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/*
- *  linux/include/asm-arm/ide.h
- *
- *  Copyright (C) 1994-1996  Linus Torvalds & authors
- */
-
-/*
- *  This file contains the i386 architecture specific IDE code.
- */
-
-#ifndef __ASMARM_IDE_H
-#define __ASMARM_IDE_H
-
-#ifdef __KERNEL__
-
-#ifndef MAX_HWIFS
-#define MAX_HWIFS      4
-#endif
-
-#include <asm/irq.h>
-#include <asm/mach-types.h>
-
-/* JMA 18.05.03 these will never be needed, but the kernel needs them to compile */
-#define __ide_mm_insw(port,addr,len)    readsw(port,addr,len)
-#define __ide_mm_insl(port,addr,len)    readsl(port,addr,len)
-#define __ide_mm_outsw(port,addr,len)   writesw(port,addr,len)
-#define __ide_mm_outsl(port,addr,len)   writesl(port,addr,len)
-
-#define IDE_ARCH_OBSOLETE_INIT
-#define ide_default_io_ctl(base)       (0)
-
-#endif /* __KERNEL__ */
-
-#endif /* __ASMARM_IDE_H */
diff --git a/include/asm-arm26/io.h b/include/asm-arm26/io.h
deleted file mode 100644 (file)
index a5a7a4d..0000000
+++ /dev/null
@@ -1,434 +0,0 @@
-/*
- *  linux/include/asm-arm/io.h
- *
- *  Copyright (C) 1996-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Modifications:
- *  16-Sep-1996        RMK     Inlined the inx/outx functions & optimised for both
- *                     constant addresses and variable addresses.
- *  04-Dec-1997        RMK     Moved a lot of this stuff to the new architecture
- *                     specific IO header files.
- *  27-Mar-1999        PJB     Second parameter of memcpy_toio is const..
- *  04-Apr-1999        PJB     Added check_signature.
- *  12-Dec-1999        RMK     More cleanups
- *  18-Jun-2000 RMK    Removed virt_to_* and friends definitions
- */
-#ifndef __ASM_ARM_IO_H
-#define __ASM_ARM_IO_H
-
-#ifdef __KERNEL__
-
-#include <linux/types.h>
-#include <asm/byteorder.h>
-#include <asm/memory.h>
-#include <asm/hardware.h>
-
-/*
- * Generic IO read/write.  These perform native-endian accesses.  Note
- * that some architectures will want to re-define __raw_{read,write}w.
- */
-extern void __raw_writesb(unsigned int addr, const void *data, int bytelen);
-extern void __raw_writesw(unsigned int addr, const void *data, int wordlen);
-extern void __raw_writesl(unsigned int addr, const void *data, int longlen);
-
-extern void __raw_readsb(unsigned int addr, void *data, int bytelen);
-extern void __raw_readsw(unsigned int addr, void *data, int wordlen);
-extern void __raw_readsl(unsigned int addr, void *data, int longlen);
-
-#define __raw_writeb(v,a)       (*(volatile unsigned char  *)(a) = (v))
-#define __raw_writew(v,a)       (*(volatile unsigned short *)(a) = (v))
-#define __raw_writel(v,a)       (*(volatile unsigned int   *)(a) = (v))
-
-#define __raw_readb(a)          (*(volatile unsigned char  *)(a))
-#define __raw_readw(a)          (*(volatile unsigned short *)(a))
-#define __raw_readl(a)          (*(volatile unsigned int   *)(a))
-
-
-/*
- * Bad read/write accesses...
- */
-extern void __readwrite_bug(const char *fn);
-
-/*
- * Now, pick up the machine-defined IO definitions
- */
-
-#define IO_SPACE_LIMIT 0xffffffff
-
-/*
- * GCC is totally crap at loading/storing data.  We try to persuade it
- * to do the right thing by using these whereever possible instead of
- * the above.
- */
-#define __arch_base_getb(b,o)                   \
- ({                                             \
-        unsigned int v, r = (b);                \
-        __asm__ __volatile__(                   \
-                "ldrb   %0, [%1, %2]"           \
-                : "=r" (v)                      \
-                : "r" (r), "Ir" (o));           \
-        v;                                      \
- })
-
-#define __arch_base_getl(b,o)                   \
- ({                                             \
-        unsigned int v, r = (b);                \
-        __asm__ __volatile__(                   \
-                "ldr    %0, [%1, %2]"           \
-                : "=r" (v)                      \
-                : "r" (r), "Ir" (o));           \
-        v;                                      \
- })
-
-#define __arch_base_putb(v,b,o)                 \
- ({                                             \
-        unsigned int r = (b);                   \
-        __asm__ __volatile__(                   \
-                "strb   %0, [%1, %2]"           \
-                :                               \
-                : "r" (v), "r" (r), "Ir" (o));  \
- })
-
-#define __arch_base_putl(v,b,o)                 \
- ({                                             \
-        unsigned int r = (b);                   \
-        __asm__ __volatile__(                   \
-                "str    %0, [%1, %2]"           \
-                :                               \
-                : "r" (v), "r" (r), "Ir" (o));  \
- })
-
-/*
- * We use two different types of addressing - PC style addresses, and ARM
- * addresses.  PC style accesses the PC hardware with the normal PC IO
- * addresses, eg 0x3f8 for serial#1.  ARM addresses are 0x80000000+
- * and are translated to the start of IO.  Note that all addresses are
- * shifted left!
- */
-#define __PORT_PCIO(x)  (!((x) & 0x80000000))
-
-/*
- * Dynamic IO functions - let the compiler
- * optimize the expressions
- */
-static inline void __outb (unsigned int value, unsigned int port)
-{
-        unsigned long temp;
-        __asm__ __volatile__(
-        "tst    %2, #0x80000000\n\t"
-        "mov    %0, %4\n\t"
-        "addeq  %0, %0, %3\n\t"
-        "strb   %1, [%0, %2, lsl #2]    @ outb"
-        : "=&r" (temp)
-        : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-        : "cc");
-}
-
-static inline void __outw (unsigned int value, unsigned int port)
-{
-        unsigned long temp;
-        __asm__ __volatile__(
-        "tst    %2, #0x80000000\n\t"
-        "mov    %0, %4\n\t"
-        "addeq  %0, %0, %3\n\t"
-        "str    %1, [%0, %2, lsl #2]    @ outw"
-        : "=&r" (temp)
-        : "r" (value|value<<16), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-        : "cc");
-}
-
-static inline void __outl (unsigned int value, unsigned int port)
-{
-        unsigned long temp;
-        __asm__ __volatile__(
-        "tst    %2, #0x80000000\n\t"
-        "mov    %0, %4\n\t"
-        "addeq  %0, %0, %3\n\t"
-        "str    %1, [%0, %2, lsl #2]    @ outl"
-        : "=&r" (temp)
-        : "r" (value), "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)
-        : "cc");
-}
-
-#define DECLARE_DYN_IN(sz,fnsuffix,instr)                                       \
-static inline unsigned sz __in##fnsuffix (unsigned int port)            \
-{                                                                               \
-        unsigned long temp, value;                                              \
-        __asm__ __volatile__(                                                   \
-        "tst    %2, #0x80000000\n\t"                                            \
-        "mov    %0, %4\n\t"                                                     \
-        "addeq  %0, %0, %3\n\t"                                                 \
-        "ldr" instr "   %1, [%0, %2, lsl #2]    @ in" #fnsuffix                 \
-        : "=&r" (temp), "=r" (value)                                            \
-        : "r" (port), "Ir" (PCIO_BASE - IO_BASE), "Ir" (IO_BASE)                \
-        : "cc");                                                                \
-        return (unsigned sz)value;                                              \
-}
-
-static inline unsigned int __ioaddr (unsigned int port)                 \
-{                                                                               \
-        if (__PORT_PCIO(port))                                                  \
-                return (unsigned int)(PCIO_BASE + (port << 2));                 \
-        else                                                                    \
-                return (unsigned int)(IO_BASE + (port << 2));                   \
-}
-
-#define DECLARE_IO(sz,fnsuffix,instr)   \
-        DECLARE_DYN_IN(sz,fnsuffix,instr)
-
-DECLARE_IO(char,b,"b")
-DECLARE_IO(short,w,"")
-DECLARE_IO(int,l,"")
-
-#undef DECLARE_IO
-#undef DECLARE_DYN_IN
-
-/*
- * Constant address IO functions
- *
- * These have to be macros for the 'J' constraint to work -
- * +/-4096 immediate operand.
- */
-#define __outbc(value,port)                                                     \
-({                                                                              \
-        if (__PORT_PCIO((port)))                                                \
-                __asm__ __volatile__(                                           \
-                "strb   %0, [%1, %2]    @ outbc"                                \
-                : : "r" (value), "r" (PCIO_BASE), "Jr" ((port) << 2));          \
-        else                                                                    \
-                __asm__ __volatile__(                                           \
-                "strb   %0, [%1, %2]    @ outbc"                                \
-                : : "r" (value), "r" (IO_BASE), "r" ((port) << 2));             \
-})
-
-#define __inbc(port)                                                            \
-({                                                                              \
-        unsigned char result;                                                   \
-        if (__PORT_PCIO((port)))                                                \
-                __asm__ __volatile__(                                           \
-                "ldrb   %0, [%1, %2]    @ inbc"                                 \
-                : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));         \
-        else                                                                    \
-                __asm__ __volatile__(                                           \
-                "ldrb   %0, [%1, %2]    @ inbc"                                 \
-                : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));            \
-        result;                                                                 \
-})
-
-#define __outwc(value,port)                                                     \
-({                                                                              \
-        unsigned long v = value;                                                \
-        if (__PORT_PCIO((port)))                                                \
-                __asm__ __volatile__(                                           \
-                "str    %0, [%1, %2]    @ outwc"                                \
-                : : "r" (v|v<<16), "r" (PCIO_BASE), "Jr" ((port) << 2));        \
-        else                                                                    \
-                __asm__ __volatile__(                                           \
-                "str    %0, [%1, %2]    @ outwc"                                \
-                : : "r" (v|v<<16), "r" (IO_BASE), "r" ((port) << 2));           \
-})
-
-#define __inwc(port)                                                            \
-({                                                                              \
-        unsigned short result;                                                  \
-        if (__PORT_PCIO((port)))                                                \
-                __asm__ __volatile__(                                           \
-                "ldr    %0, [%1, %2]    @ inwc"                                 \
-                : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));         \
-        else                                                                    \
-                __asm__ __volatile__(                                           \
-                "ldr    %0, [%1, %2]    @ inwc"                                 \
-                : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));            \
-        result & 0xffff;                                                        \
-})
-
-#define __outlc(value,port)                                                     \
-({                                                                              \
-        unsigned long v = value;                                                \
-        if (__PORT_PCIO((port)))                                                \
-                __asm__ __volatile__(                                           \
-                "str    %0, [%1, %2]    @ outlc"                                \
-                : : "r" (v), "r" (PCIO_BASE), "Jr" ((port) << 2));              \
-        else                                                                    \
-                __asm__ __volatile__(                                           \
-                "str    %0, [%1, %2]    @ outlc"                                \
-                : : "r" (v), "r" (IO_BASE), "r" ((port) << 2));                 \
-})
-
-#define __inlc(port)                                                            \
-({                                                                              \
-        unsigned long result;                                                   \
-        if (__PORT_PCIO((port)))                                                \
-                __asm__ __volatile__(                                           \
-                "ldr    %0, [%1, %2]    @ inlc"                                 \
-                : "=r" (result) : "r" (PCIO_BASE), "Jr" ((port) << 2));         \
-        else                                                                    \
-                __asm__ __volatile__(                                           \
-                "ldr    %0, [%1, %2]    @ inlc"                                 \
-                : "=r" (result) : "r" (IO_BASE), "r" ((port) << 2));            \
-        result;                                                                 \
-})
-
-#define __ioaddrc(port)                                                         \
-({                                                                              \
-        unsigned long addr;                                                     \
-        if (__PORT_PCIO((port)))                                                \
-                addr = PCIO_BASE + ((port) << 2);                               \
-        else                                                                    \
-                addr = IO_BASE + ((port) << 2);                                 \
-        addr;                                                                   \
-})
-
-#define inb(p)          (__builtin_constant_p((p)) ? __inbc(p)    : __inb(p))
-#define inw(p)          (__builtin_constant_p((p)) ? __inwc(p)    : __inw(p))
-#define inl(p)          (__builtin_constant_p((p)) ? __inlc(p)    : __inl(p))
-#define outb(v,p)       (__builtin_constant_p((p)) ? __outbc(v,p) : __outb(v,p))
-#define outw(v,p)       (__builtin_constant_p((p)) ? __outwc(v,p) : __outw(v,p))
-#define outl(v,p)       (__builtin_constant_p((p)) ? __outlc(v,p) : __outl(v,p))
-#define __ioaddr(p)     (__builtin_constant_p((p)) ? __ioaddr(p)  : __ioaddrc(p))
-
-/* JMA 18.02.03 added sb,sl from arm/io.h, changing io to ioaddr */
-
-#define outsb(p,d,l)            __raw_writesb(__ioaddr(p),d,l)
-#define outsw(p,d,l)            __raw_writesw(__ioaddr(p),d,l)
-#define outsl(p,d,l)            __raw_writesl(__ioaddr(p),d,l)
-
-#define insb(p,d,l)             __raw_readsb(__ioaddr(p),d,l)
-#define insw(p,d,l)             __raw_readsw(__ioaddr(p),d,l)
-#define insl(p,d,l)             __raw_readsl(__ioaddr(p),d,l)
-
-#define insw(p,d,l)     __raw_readsw(__ioaddr(p),d,l)
-#define outsw(p,d,l)    __raw_writesw(__ioaddr(p),d,l)
-
-#define readb(c)                        (__readwrite_bug("readb"),0)
-#define readw(c)                        (__readwrite_bug("readw"),0)
-#define readl(c)                        (__readwrite_bug("readl"),0)
-#define readb_relaxed(addr)            readb(addr)
-#define readw_relaxed(addr)            readw(addr)
-#define readl_relaxed(addr)            readl(addr)
-#define writeb(v,c)                     __readwrite_bug("writeb")
-#define writew(v,c)                     __readwrite_bug("writew")
-#define writel(v,c)                     __readwrite_bug("writel")
-
-#define readsw(p,d,l)                 (__readwrite_bug("readsw"),0)
-#define readsl(p,d,l)                 (__readwrite_bug("readsl"),0)
-#define writesw(p,d,l)                        __readwrite_bug("writesw")
-#define writesl(p,d,l)                        __readwrite_bug("writesl")
-
-#define mmiowb()
-
-/* the following macro is deprecated */
-#define ioaddr(port)                    __ioaddr((port))
-
-/*
- * No ioremap support here.
- */
-#define __arch_ioremap(c,s,f,a)   ((void *)(c))
-#define __arch_iounmap(c)       do { }  while (0)
-
-
-#if defined(__arch_putb) || defined(__arch_putw) || defined(__arch_putl) || \
-    defined(__arch_getb) || defined(__arch_getw) || defined(__arch_getl)
-#warning machine class uses old __arch_putw or __arch_getw
-#endif
-
-/*
- *  IO port access primitives
- *  -------------------------
- *
- * The ARM doesn't have special IO access instructions; all IO is memory
- * mapped.  Note that these are defined to perform little endian accesses
- * only.  Their primary purpose is to access PCI and ISA peripherals.
- *
- * Note that for a big endian machine, this implies that the following
- * big endian mode connectivity is in place, as described by numerious
- * ARM documents:
- *
- *    PCI:  D0-D7   D8-D15 D16-D23 D24-D31
- *    ARM: D24-D31 D16-D23  D8-D15  D0-D7
- *
- * The machine specific io.h include defines __io to translate an "IO"
- * address to a memory address.
- *
- * Note that we prevent GCC re-ordering or caching values in expressions
- * by introducing sequence points into the in*() definitions.  Note that
- * __raw_* do not guarantee this behaviour.
- */
-/*
-#define outsb(p,d,l)           __raw_writesb(__io(p),d,l)
-#define outsw(p,d,l)           __raw_writesw(__io(p),d,l)
-
-#define insb(p,d,l)            __raw_readsb(__io(p),d,l)
-#define insw(p,d,l)            __raw_readsw(__io(p),d,l)
-*/
-#define outb_p(val,port)       outb((val),(port))
-#define outw_p(val,port)       outw((val),(port))
-#define inb_p(port)            inb((port))
-#define inw_p(port)            inw((port))
-#define inl_p(port)            inl((port))
-
-#define outsb_p(port,from,len) outsb(port,from,len)
-#define outsw_p(port,from,len) outsw(port,from,len)
-#define insb_p(port,to,len)    insb(port,to,len)
-#define insw_p(port,to,len)    insw(port,to,len)
-
-/*
- * String version of IO memory access ops:
- */
-extern void _memcpy_fromio(void *, unsigned long, size_t);
-extern void _memcpy_toio(unsigned long, const void *, size_t);
-extern void _memset_io(unsigned long, int, size_t);
-
-/*
- * ioremap and friends.
- *
- * ioremap takes a PCI memory address, as specified in
- * Documentation/IO-mapping.txt.
- */
-extern void * __ioremap(unsigned long, size_t, unsigned long, unsigned long);
-extern void __iounmap(void *addr);
-
-#ifndef __arch_ioremap
-#define ioremap(cookie,size)           __ioremap(cookie,size,0,1)
-#define ioremap_nocache(cookie,size)   __ioremap(cookie,size,0,1)
-#define iounmap(cookie)                        __iounmap(cookie)
-#else
-#define ioremap(cookie,size)           __arch_ioremap((cookie),(size),0,1)
-#define ioremap_nocache(cookie,size)   __arch_ioremap((cookie),(size),0,1)
-#define iounmap(cookie)                        __arch_iounmap(cookie)
-#endif
-
-/*
- * DMA-consistent mapping functions.  These allocate/free a region of
- * uncached, unwrite-buffered mapped memory space for use with DMA
- * devices.  This is the "generic" version.  The PCI specific version
- * is in pci.h
- */
-extern void *consistent_alloc(int gfp, size_t size, dma_addr_t *handle);
-extern void consistent_free(void *vaddr, size_t size, dma_addr_t handle);
-extern void consistent_sync(void *vaddr, size_t size, int rw);
-
-/*
- * can the hardware map this into one segment or not, given no other
- * constraints.
- */
-#define BIOVEC_MERGEABLE(vec1, vec2)   \
-       ((bvec_to_phys((vec1)) + (vec1)->bv_len) == bvec_to_phys((vec2)))
-
-/*
- * Convert a physical pointer to a virtual kernel pointer for /dev/mem
- * access
- */
-#define xlate_dev_mem_ptr(p)   __va(p)
-
-/*
- * Convert a virtual cached pointer to an uncached pointer
- */
-#define xlate_dev_kmem_ptr(p)  p
-
-#endif /* __KERNEL__ */
-#endif /* __ASM_ARM_IO_H */
diff --git a/include/asm-arm26/ioc.h b/include/asm-arm26/ioc.h
deleted file mode 100644 (file)
index b3b46ef..0000000
+++ /dev/null
@@ -1,72 +0,0 @@
-/*
- *  linux/include/asm-arm/hardware/ioc.h
- *
- *  Copyright (C) Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Use these macros to read/write the IOC.  All it does is perform the actual
- *  read/write.
- */
-#ifndef __ASMARM_HARDWARE_IOC_H
-#define __ASMARM_HARDWARE_IOC_H
-
-#ifndef __ASSEMBLY__
-
-/*
- * We use __raw_base variants here so that we give the compiler the
- * chance to keep IOC_BASE in a register.
- */
-#define ioc_readb(off)         __raw_readb(IOC_BASE + (off))
-#define ioc_writeb(val,off)    __raw_writeb(val, IOC_BASE + (off))
-
-#endif
-
-#define IOC_CONTROL    (0x00)
-#define IOC_KARTTX     (0x04)
-#define IOC_KARTRX     (0x04)
-
-#define IOC_IRQSTATA   (0x10)
-#define IOC_IRQREQA    (0x14)
-#define IOC_IRQCLRA    (0x14)
-#define IOC_IRQMASKA   (0x18)
-
-#define IOC_IRQSTATB   (0x20)
-#define IOC_IRQREQB    (0x24)
-#define IOC_IRQMASKB   (0x28)
-
-#define IOC_FIQSTAT    (0x30)
-#define IOC_FIQREQ     (0x34)
-#define IOC_FIQMASK    (0x38)
-
-#define IOC_T0CNTL     (0x40)
-#define IOC_T0LTCHL    (0x40)
-#define IOC_T0CNTH     (0x44)
-#define IOC_T0LTCHH    (0x44)
-#define IOC_T0GO       (0x48)
-#define IOC_T0LATCH    (0x4c)
-
-#define IOC_T1CNTL     (0x50)
-#define IOC_T1LTCHL    (0x50)
-#define IOC_T1CNTH     (0x54)
-#define IOC_T1LTCHH    (0x54)
-#define IOC_T1GO       (0x58)
-#define IOC_T1LATCH    (0x5c)
-
-#define IOC_T2CNTL     (0x60)
-#define IOC_T2LTCHL    (0x60)
-#define IOC_T2CNTH     (0x64)
-#define IOC_T2LTCHH    (0x64)
-#define IOC_T2GO       (0x68)
-#define IOC_T2LATCH    (0x6c)
-
-#define IOC_T3CNTL     (0x70)
-#define IOC_T3LTCHL    (0x70)
-#define IOC_T3CNTH     (0x74)
-#define IOC_T3LTCHH    (0x74)
-#define IOC_T3GO       (0x78)
-#define IOC_T3LATCH    (0x7c)
-
-#endif
diff --git a/include/asm-arm26/ioctl.h b/include/asm-arm26/ioctl.h
deleted file mode 100644 (file)
index b279fe0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ioctl.h>
diff --git a/include/asm-arm26/ioctls.h b/include/asm-arm26/ioctls.h
deleted file mode 100644 (file)
index 8a32962..0000000
+++ /dev/null
@@ -1,85 +0,0 @@
-#ifndef __ASM_ARM_IOCTLS_H
-#define __ASM_ARM_IOCTLS_H
-
-#include <asm/ioctl.h>
-
-/* 0x54 is just a magic number to make these relatively unique ('T') */
-
-#define TCGETS         0x5401
-#define TCSETS         0x5402
-#define TCSETSW                0x5403
-#define TCSETSF                0x5404
-#define TCGETA         0x5405
-#define TCSETA         0x5406
-#define TCSETAW                0x5407
-#define TCSETAF                0x5408
-#define TCSBRK         0x5409
-#define TCXONC         0x540A
-#define TCFLSH         0x540B
-#define TIOCEXCL       0x540C
-#define TIOCNXCL       0x540D
-#define TIOCSCTTY      0x540E
-#define TIOCGPGRP      0x540F
-#define TIOCSPGRP      0x5410
-#define TIOCOUTQ       0x5411
-#define TIOCSTI                0x5412
-#define TIOCGWINSZ     0x5413
-#define TIOCSWINSZ     0x5414
-#define TIOCMGET       0x5415
-#define TIOCMBIS       0x5416
-#define TIOCMBIC       0x5417
-#define TIOCMSET       0x5418
-#define TIOCGSOFTCAR   0x5419
-#define TIOCSSOFTCAR   0x541A
-#define FIONREAD       0x541B
-#define TIOCINQ                FIONREAD
-#define TIOCLINUX      0x541C
-#define TIOCCONS       0x541D
-#define TIOCGSERIAL    0x541E
-#define TIOCSSERIAL    0x541F
-#define TIOCPKT                0x5420
-#define FIONBIO                0x5421
-#define TIOCNOTTY      0x5422
-#define TIOCSETD       0x5423
-#define TIOCGETD       0x5424
-#define TCSBRKP                0x5425  /* Needed for POSIX tcsendbreak() */
-#define TIOCTTYGSTRUCT 0x5426  /* For debugging only */
-#define TIOCSBRK       0x5427  /* BSD compatibility */
-#define TIOCCBRK       0x5428  /* BSD compatibility */
-#define TIOCGSID       0x5429  /* Return the session ID of FD */
-#define TCGETS2                _IOR('T',0x2A, struct termios2)
-#define TCSETS2                _IOW('T',0x2B, struct termios2)
-#define TCSETSW2       _IOW('T',0x2C, struct termios2)
-#define TCSETSF2       _IOW('T',0x2D, struct termios2)
-#define TIOCGPTN       _IOR('T',0x30, unsigned int) /* Get Pty Number (of pty-mux device) */
-#define TIOCSPTLCK     _IOW('T',0x31, int)  /* Lock/unlock Pty */
-
-#define FIONCLEX       0x5450  /* these numbers need to be adjusted. */
-#define FIOCLEX                0x5451
-#define FIOASYNC       0x5452
-#define TIOCSERCONFIG  0x5453
-#define TIOCSERGWILD   0x5454
-#define TIOCSERSWILD   0x5455
-#define TIOCGLCKTRMIOS 0x5456
-#define TIOCSLCKTRMIOS 0x5457
-#define TIOCSERGSTRUCT 0x5458 /* For debugging only */
-#define TIOCSERGETLSR   0x5459 /* Get line status register */
-#define TIOCSERGETMULTI 0x545A /* Get multiport config  */
-#define TIOCSERSETMULTI 0x545B /* Set multiport config */
-
-#define TIOCMIWAIT     0x545C  /* wait for a change on serial input line(s) */
-#define TIOCGICOUNT    0x545D  /* read serial port inline interrupt counts */
-#define FIOQSIZE       0x545E
-
-/* Used for packet mode */
-#define TIOCPKT_DATA            0
-#define TIOCPKT_FLUSHREAD       1
-#define TIOCPKT_FLUSHWRITE      2
-#define TIOCPKT_STOP            4
-#define TIOCPKT_START           8
-#define TIOCPKT_NOSTOP         16
-#define TIOCPKT_DOSTOP         32
-
-#define TIOCSER_TEMT   0x01    /* Transmitter physically empty */
-
-#endif
diff --git a/include/asm-arm26/ipc.h b/include/asm-arm26/ipc.h
deleted file mode 100644 (file)
index a46e3d9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/ipc.h>
diff --git a/include/asm-arm26/ipcbuf.h b/include/asm-arm26/ipcbuf.h
deleted file mode 100644 (file)
index 9768397..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#ifndef __ASMARM_IPCBUF_H
-#define __ASMARM_IPCBUF_H
-
-/*
- * The ipc64_perm structure for arm architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 32-bit mode_t and seq
- * - 2 miscellaneous 32-bit values
- */
-
-struct ipc64_perm
-{
-       __kernel_key_t          key;
-       __kernel_uid32_t        uid;
-       __kernel_gid32_t        gid;
-       __kernel_uid32_t        cuid;
-       __kernel_gid32_t        cgid;
-       __kernel_mode_t         mode;
-       unsigned short          __pad1;
-       unsigned short          seq;
-       unsigned short          __pad2;
-       unsigned long           __unused1;
-       unsigned long           __unused2;
-};
-
-#endif /* __ASMARM_IPCBUF_H */
diff --git a/include/asm-arm26/irq.h b/include/asm-arm26/irq.h
deleted file mode 100644 (file)
index 52971b4..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __ASM_ARM_IRQ_H
-#define __ASM_ARM_IRQ_H
-
-#include <asm/sysirq.h>
-
-#ifndef NR_IRQS
-#define NR_IRQS        128
-#endif
-
-
-/* JMA 18.05.02 Copied off arch/arm/irq.h */
-#ifndef irq_canonicalize
-#define irq_canonicalize(i)     (i)
-#endif
-
-
-/*
- * Use this value to indicate lack of interrupt
- * capability
- */
-#ifndef NO_IRQ
-#define NO_IRQ ((unsigned int)(-1))
-#endif
-
-struct irqaction;
-
-#define __IRQT_FALEDGE (1 << 0)
-#define __IRQT_RISEDGE (1 << 1)
-#define __IRQT_LOWLVL  (1 << 2)
-#define __IRQT_HIGHLVL (1 << 3)
-
-#define IRQT_NOEDGE    (0)
-#define IRQT_RISING    (__IRQT_RISEDGE)
-#define IRQT_FALLING   (__IRQT_FALEDGE)
-#define IRQT_BOTHEDGE  (__IRQT_RISEDGE|__IRQT_FALEDGE)
-#define IRQT_LOW       (__IRQT_LOWLVL)
-#define IRQT_HIGH      (__IRQT_HIGHLVL)
-#define IRQT_PROBE     (1 << 4)
-
-int set_irq_type(unsigned int irq, unsigned int type);
-
-#endif
-
diff --git a/include/asm-arm26/irqchip.h b/include/asm-arm26/irqchip.h
deleted file mode 100644 (file)
index 6a007a9..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  linux/include/asm-arm/mach/irq.h
- *
- *  Copyright (C) 1995-2000 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASM_ARM_MACH_IRQ_H
-#define __ASM_ARM_MACH_IRQ_H
-
-struct irqdesc;
-struct pt_regs;
-struct seq_file;
-
-typedef void (*irq_handler_t)(unsigned int, struct irqdesc *, struct pt_regs *);
-typedef void (*irq_control_t)(unsigned int);
-
-struct irqchip {
-       /*
-        * Acknowledge the IRQ.
-        * If this is a level-based IRQ, then it is expected to mask the IRQ
-        * as well.
-        */
-       void (*ack)(unsigned int);
-       /*
-        * Mask the IRQ in hardware.
-        */
-       void (*mask)(unsigned int);
-       /*
-        * Unmask the IRQ in hardware.
-        */
-       void (*unmask)(unsigned int);
-       /*
-        * Re-run the IRQ
-        */
-       void (*rerun)(unsigned int);
-       /*
-        * Set the type of the IRQ.
-        */
-       int (*type)(unsigned int, unsigned int);
-};
-
-struct irqdesc {
-       irq_handler_t   handle;
-       struct irqchip  *chip;
-       struct irqaction *action;
-
-       unsigned int    enabled  : 1;           /* IRQ is currently enabled   */
-       unsigned int    triggered: 1;           /* IRQ has occurred           */
-       unsigned int    running  : 1;           /* IRQ is running             */
-       unsigned int    pending  : 1;           /* IRQ is pending             */
-       unsigned int    probing  : 1;           /* IRQ in use for a probe     */
-       unsigned int    probe_ok : 1;           /* IRQ can be used for probe  */
-       unsigned int    valid    : 1;           /* IRQ claimable              */
-       unsigned int    noautoenable : 1;       /* don't automatically enable IRQ */
-       unsigned int    unused   :23;
-       unsigned int    depth;                  /* disable depth              */
-
-       /*
-        * IRQ lock detection
-        */
-       unsigned int    lck_cnt;
-       unsigned int    lck_pc;
-       unsigned int    lck_jif;
-};
-
-extern struct irqdesc irq_desc[];
-
-/*
- * This is internal.  Do not use it.
- */
-extern void (*init_arch_irq)(void);
-extern void init_FIQ(void);
-extern int show_fiq_list(struct seq_file *, void *);
-void __set_irq_handler(unsigned int irq, irq_handler_t, int);
-
-/*
- * External stuff.
- */
-#define set_irq_handler(irq,handler)           __set_irq_handler(irq,handler,0)
-#define set_irq_chained_handler(irq,handler)   __set_irq_handler(irq,handler,1)
-
-void set_irq_chip(unsigned int irq, struct irqchip *);
-void set_irq_flags(unsigned int irq, unsigned int flags);
-
-#define IRQF_VALID     (1 << 0)
-#define IRQF_PROBE     (1 << 1)
-#define IRQF_NOAUTOEN  (1 << 2)
-
-/*
- * Built-in IRQ handlers.
- */
-void do_level_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
-void do_edge_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
-void do_simple_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
-void do_bad_IRQ(unsigned int irq, struct irqdesc *desc, struct pt_regs *regs);
-void dummy_mask_unmask_irq(unsigned int irq);
-
-#endif
diff --git a/include/asm-arm26/kdebug.h b/include/asm-arm26/kdebug.h
deleted file mode 100644 (file)
index 6ece1b0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-#include <asm-generic/kdebug.h>
diff --git a/include/asm-arm26/kmap_types.h b/include/asm-arm26/kmap_types.h
deleted file mode 100644 (file)
index d5da712..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef __ARM_KMAP_TYPES_H
-#define __ARM_KMAP_TYPES_H
-
-/*
- * This is the "bare minimum".  AIO seems to require this.
- */
-enum km_type {
-        KM_IRQ0,
-        KM_USER1
-};
-
-#endif
diff --git a/include/asm-arm26/leds.h b/include/asm-arm26/leds.h
deleted file mode 100644 (file)
index 12290ea..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- *  linux/include/asm-arm/leds.h
- *
- *  Copyright (C) 1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Event-driven interface for LEDs on machines
- *  Added led_start and led_stop- Alex Holden, 28th Dec 1998.
- */
-#ifndef ASM_ARM_LEDS_H
-#define ASM_ARM_LEDS_H
-
-
-typedef enum {
-       led_idle_start,
-       led_idle_end,
-       led_timer,
-       led_start,
-       led_stop,
-       led_claim,              /* override idle & timer leds */
-       led_release,            /* restore idle & timer leds */
-       led_start_timer_mode,
-       led_stop_timer_mode,
-       led_green_on,
-       led_green_off,
-       led_amber_on,
-       led_amber_off,
-       led_red_on,
-       led_red_off,
-       led_blue_on,
-       led_blue_off,
-       /*
-        * I want this between led_timer and led_start, but
-        * someone has decided to export this to user space
-        */
-       led_halted
-} led_event_t;
-
-/* Use this routine to handle LEDs */
-
-#ifdef CONFIG_LEDS
-extern void (*leds_event)(led_event_t);
-#else
-#define leds_event(e)
-#endif
-
-#endif
diff --git a/include/asm-arm26/limits.h b/include/asm-arm26/limits.h
deleted file mode 100644 (file)
index 08d8c66..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __ASM_PIPE_H
-#define __ASM_PIPE_H
-
-#ifndef PAGE_SIZE
-#include <asm/page.h>
-#endif
-
-#define PIPE_BUF       PAGE_SIZE
-
-#endif
-
diff --git a/include/asm-arm26/linkage.h b/include/asm-arm26/linkage.h
deleted file mode 100644 (file)
index dbe4b4e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef __ASM_LINKAGE_H
-#define __ASM_LINKAGE_H
-
-#define __ALIGN .align 0
-#define __ALIGN_STR ".align 0"
-
-#endif
diff --git a/include/asm-arm26/local.h b/include/asm-arm26/local.h
deleted file mode 100644 (file)
index 6759e91..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-//FIXME - nicked from arm32 - check it is correct...
-#include <asm-generic/local.h>
diff --git a/include/asm-arm26/locks.h b/include/asm-arm26/locks.h
deleted file mode 100644 (file)
index 81b3bda..0000000
+++ /dev/null
@@ -1,161 +0,0 @@
-/*
- *  linux/include/asm-arm/proc-armo/locks.h
- *
- *  Copyright (C) 2000 Russell King
- *  Fixes for 26 bit machines, (C) 2000 Dave Gilbert
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Interrupt safe locking assembler. 
- */
-#ifndef __ASM_PROC_LOCKS_H
-#define __ASM_PROC_LOCKS_H
-
-/* Decrements by 1, fails if value < 0 */
-#define __down_op(ptr,fail)                    \
-       ({                                      \
-       __asm__ __volatile__ (                  \
-       "@ atomic down operation\n"             \
-"      mov     ip, pc\n"                       \
-"      orr     lr, ip, #0x08000000\n"          \
-"      teqp    lr, #0\n"                       \
-"      ldr     lr, [%0]\n"                     \
-"      and     ip, ip, #0x0c000003\n"          \
-"      subs    lr, lr, #1\n"                   \
-"      str     lr, [%0]\n"                     \
-"      orrmi   ip, ip, #0x80000000     @ set N\n" \
-"      teqp    ip, #0\n"                       \
-"      movmi   ip, %0\n"                       \
-"      blmi    " #fail                         \
-       :                                       \
-       : "r" (ptr)                             \
-       : "ip", "lr", "cc");                    \
-       })
-
-#define __down_op_ret(ptr,fail)                        \
-       ({                                      \
-               unsigned int result;            \
-       __asm__ __volatile__ (                  \
-"      @ down_op_ret\n"                        \
-"      mov     ip, pc\n"                       \
-"      orr     lr, ip, #0x08000000\n"          \
-"      teqp    lr, #0\n"                       \
-"      ldr     lr, [%1]\n"                     \
-"      and     ip, ip, #0x0c000003\n"          \
-"      subs    lr, lr, #1\n"                   \
-"      str     lr, [%1]\n"                     \
-"      orrmi   ip, ip, #0x80000000     @ set N\n" \
-"      teqp    ip, #0\n"                       \
-"      movmi   ip, %1\n"                       \
-"      movpl   ip, #0\n"                       \
-"      blmi    " #fail "\n"                    \
-"      mov     %0, ip"                         \
-       : "=&r" (result)                        \
-       : "r" (ptr)                             \
-       : "ip", "lr", "cc");                    \
-       result;                                 \
-       })
-
-#define __up_op(ptr,wake)                      \
-       ({                                      \
-       __asm__ __volatile__ (                  \
-       "@ up_op\n"                             \
-"      mov     ip, pc\n"                       \
-"      orr     lr, ip, #0x08000000\n"          \
-"      teqp    lr, #0\n"                       \
-"      ldr     lr, [%0]\n"                     \
-"      and     ip, ip, #0x0c000003\n"          \
-"      adds    lr, lr, #1\n"                   \
-"      str     lr, [%0]\n"                     \
-"      orrle   ip, ip, #0x80000000     @ set N - should this be mi ??? DAG ! \n" \
-"      teqp    ip, #0\n"                       \
-"      movmi   ip, %0\n"                       \
-"      blmi    " #wake                         \
-       :                                       \
-       : "r" (ptr)                             \
-       : "ip", "lr", "cc");                    \
-       })
-
-/*
- * The value 0x01000000 supports up to 128 processors and
- * lots of processes.  BIAS must be chosen such that sub'ing
- * BIAS once per CPU will result in the long remaining
- * negative.
- */
-#define RW_LOCK_BIAS      0x01000000
-#define RW_LOCK_BIAS_STR "0x01000000"
-
-/* Decrements by RW_LOCK_BIAS rather than 1, fails if value != 0 */
-#define __down_op_write(ptr,fail)              \
-       ({                                      \
-       __asm__ __volatile__(                   \
-       "@ down_op_write\n"                     \
-"      mov     ip, pc\n"                       \
-"      orr     lr, ip, #0x08000000\n"          \
-"      teqp    lr, #0\n"                       \
-"      and     ip, ip, #0x0c000003\n"          \
-\
-"      ldr     lr, [%0]\n"                     \
-"      subs    lr, lr, %1\n"                   \
-"      str     lr, [%0]\n"                     \
-\
-" orreq ip, ip, #0x40000000 @ set Z \n"\
-"      teqp    ip, #0\n"                       \
-"      movne   ip, %0\n"                       \
-"      blne    " #fail                         \
-       :                                       \
-       : "r" (ptr), "I" (RW_LOCK_BIAS)         \
-       : "ip", "lr", "cc");                    \
-       })
-
-/* Increments by RW_LOCK_BIAS, wakes if value >= 0 */
-#define __up_op_write(ptr,wake)                        \
-       ({                                      \
-       __asm__ __volatile__(                   \
-       "@ up_op_read\n"                        \
-"      mov     ip, pc\n"                       \
-"      orr     lr, ip, #0x08000000\n"          \
-"      teqp    lr, #0\n"                       \
-\
-"      ldr     lr, [%0]\n"                     \
-"      and     ip, ip, #0x0c000003\n"          \
-"      adds    lr, lr, %1\n"                   \
-"      str     lr, [%0]\n"                     \
-\
-" orrcs ip, ip, #0x20000000 @ set C\n" \
-"      teqp    ip, #0\n"                       \
-"      movcs   ip, %0\n"                       \
-"      blcs    " #wake                         \
-       :                                       \
-       : "r" (ptr), "I" (RW_LOCK_BIAS)         \
-       : "ip", "lr", "cc");                    \
-       })
-
-#define __down_op_read(ptr,fail)               \
-       __down_op(ptr, fail)
-
-#define __up_op_read(ptr,wake)                 \
-       ({                                      \
-       __asm__ __volatile__(                   \
-       "@ up_op_read\n"                        \
-"      mov     ip, pc\n"                       \
-"      orr     lr, ip, #0x08000000\n"          \
-"      teqp    lr, #0\n"                       \
-\
-"      ldr     lr, [%0]\n"                     \
-"      and     ip, ip, #0x0c000003\n"          \
-"      adds    lr, lr, %1\n"                   \
-"      str     lr, [%0]\n"                     \
-\
-" orreq ip, ip, #0x40000000 @ Set Z \n" \
-"      teqp    ip, #0\n"                       \
-"      moveq   ip, %0\n"                       \
-"      bleq    " #wake                         \
-       :                                       \
-       : "r" (ptr), "I" (1)                    \
-       : "ip", "lr", "cc");                    \
-       })
-
-#endif
diff --git a/include/asm-arm26/mach-types.h b/include/asm-arm26/mach-types.h
deleted file mode 100644 (file)
index 0aeaedc..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Unlike ARM32 this is NOT automatically generated. DONT delete it
- * Instead, consider FIXME-ing it so its auto-detected.
- */
-
-#ifndef __ASM_ARM_MACH_TYPE_H
-#define __ASM_ARM_MACH_TYPE_H
-
-
-#ifndef __ASSEMBLY__
-extern unsigned int __machine_arch_type;
-#endif
-
-#define MACH_TYPE_ARCHIMEDES           10
-#define MACH_TYPE_A5K                  11
-
-#ifdef CONFIG_ARCH_ARC
-# define machine_arch_type             MACH_TYPE_ARCHIMEDES
-# define machine_is_archimedes()       (machine_arch_type == MACH_TYPE_ARCHIMEDES)
-#else
-# define machine_is_archimedes()       (0)
-#endif
-
-#ifdef CONFIG_ARCH_A5K
-# define machine_arch_type             MACH_TYPE_A5K
-# define machine_is_a5k()              (machine_arch_type == MACH_TYPE_A5K)
-#else
-# define machine_is_a5k()      (0)
-#endif
-
-#ifndef machine_arch_type
-#error Unknown machine type
-#define machine_arch_type       __machine_arch_type
-#endif
-
-#endif
diff --git a/include/asm-arm26/map.h b/include/asm-arm26/map.h
deleted file mode 100644 (file)
index 6e12a7f..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/*
- *  linux/include/asm-arm/map.h
- *
- *  Copyright (C) 1999-2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Page table mapping constructs and function prototypes
- */
-struct map_desc {
-       unsigned long virtual;
-       unsigned long physical;
-       unsigned long length;
-       unsigned int type;
-};
-
-struct meminfo;
-
-extern void create_memmap_holes(struct meminfo *);
-extern void memtable_init(struct meminfo *);
-extern void iotable_init(struct map_desc *);
-extern void setup_io_desc(void);
diff --git a/include/asm-arm26/mc146818rtc.h b/include/asm-arm26/mc146818rtc.h
deleted file mode 100644 (file)
index a234130..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-/*
- * Machine dependent access functions for RTC registers.
- */
-#ifndef _ASM_MC146818RTC_H
-#define _ASM_MC146818RTC_H
-
-#include <asm/irq.h>
-#include <asm/io.h>
-
-#ifndef RTC_PORT
-#define RTC_PORT(x)    (0x70 + (x))
-#define RTC_ALWAYS_BCD 1       /* RTC operates in binary mode */
-#endif
-
-/*
- * The yet supported machines all access the RTC index register via
- * an ISA port access but the way to access the date register differs ...
- */
-#define CMOS_READ(addr) ({ \
-outb_p((addr),RTC_PORT(0)); \
-inb_p(RTC_PORT(1)); \
-})
-#define CMOS_WRITE(val, addr) ({ \
-outb_p((addr),RTC_PORT(0)); \
-outb_p((val),RTC_PORT(1)); \
-})
-
-#endif /* _ASM_MC146818RTC_H */
diff --git a/include/asm-arm26/memory.h b/include/asm-arm26/memory.h
deleted file mode 100644 (file)
index 7c1e5be..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- *  linux/include/asm-arm26/memory.h
- *
- *  Copyright (C) 2000-2002 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Note: this file should not be included by non-asm/.h files
- */
-#ifndef __ASM_ARM_MEMORY_H
-#define __ASM_ARM_MEMORY_H
-
-/*
- * User space: 26MB
- */
-#define TASK_SIZE       (0x01a00000UL)
-
-/*
- * This decides where the kernel will search for a free chunk of vm
- * space during mmap's.
- */
-#define TASK_UNMAPPED_BASE (TASK_SIZE / 3)
-
-/*
- * Page offset: 32MB
- */
-#define PAGE_OFFSET     (0x02000000UL)
-#define PHYS_OFFSET     (0x02000000UL)
-
-#define PHYS_TO_NID(addr)       (0)
-
-/*
- * PFNs are used to describe any physical page; this means
- * PFN 0 == physical address 0.
- *
- * This is the PFN of the first RAM page in the kernel
- * direct-mapped view.  We assume this is the first page
- * of RAM in the mem_map as well.
- */
-#define PHYS_PFN_OFFSET        (PHYS_OFFSET >> PAGE_SHIFT)
-
-/*
- * These are *only* valid on the kernel direct mapped RAM memory.
- */
-static inline unsigned long virt_to_phys(void *x)
-{
-       return (unsigned long)x;
-}
-
-static inline void *phys_to_virt(unsigned long x)
-{
-       return (void *)((unsigned long)x);
-}
-
-#define __pa(x)                        (unsigned long)(x)
-#define __va(x)                        ((void *)(unsigned long)(x))
-
-/*
- * Virtual <-> DMA view memory address translations
- * Again, these are *only* valid on the kernel direct mapped RAM
- * memory.  Use of these is *deprecated*.
- */
-#define virt_to_bus(x)         ((unsigned long)(x))
-#define bus_to_virt(x)         ((void *)((unsigned long)(x)))
-
-/*
- * Conversion between a struct page and a physical address.
- *
- * Note: when converting an unknown physical address to a
- * struct page, the resulting pointer must be validated
- * using VALID_PAGE().  It must return an invalid struct page
- * for any physical address not corresponding to a system
- * RAM address.
- *
- *  page_to_pfn(page)  convert a struct page * to a PFN number
- *  pfn_to_page(pfn)   convert a _valid_ PFN number to struct page *
- *  pfn_valid(pfn)     indicates whether a PFN number is valid
- *
- *  virt_to_page(k)    convert a _valid_ virtual address to struct page *
- *  virt_addr_valid(k) indicates whether a virtual address is valid
- */
-#define ARCH_PFN_OFFSET                (PHYS_PFN_OFFSET)
-#define pfn_valid(pfn)         ((pfn) >= PHYS_PFN_OFFSET && (pfn) < (PHYS_PFN_OFFSET + max_mapnr))
-
-#define virt_to_page(kaddr)    (pfn_to_page(__pa(kaddr) >> PAGE_SHIFT))
-#define virt_addr_valid(kaddr) ((int)(kaddr) >= PAGE_OFFSET && (int)(kaddr) < (unsigned long)high_memory)
-
-/*
- * For BIO.  "will die".  Kill me when bio_to_phys() and bvec_to_phys() die.
- */
-#define page_to_phys(page)     (page_to_pfn(page) << PAGE_SHIFT)
-
-/*
- * We should really eliminate virt_to_bus() here - it's deprecated.
- */
-#define page_to_bus(page)      (page_address(page))
-
-#include <asm-generic/memory_model.h>
-#endif
diff --git a/include/asm-arm26/mman.h b/include/asm-arm26/mman.h
deleted file mode 100644 (file)
index 4000a6c..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-#ifndef __ARM_MMAN_H__
-#define __ARM_MMAN_H__
-
-#include <asm-generic/mman.h>
-
-#define MAP_GROWSDOWN  0x0100          /* stack-like segment */
-#define MAP_DENYWRITE  0x0800          /* ETXTBSY */
-#define MAP_EXECUTABLE 0x1000          /* mark it as an executable */
-#define MAP_LOCKED     0x2000          /* pages are locked */
-#define MAP_NORESERVE  0x4000          /* don't check for reservations */
-#define MAP_POPULATE    0x8000          /* populate (prefault) page tables */
-#define MAP_NONBLOCK    0x10000         /* do not block on IO */
-
-#define MCL_CURRENT    1               /* lock all current mappings */
-#define MCL_FUTURE     2               /* lock all future mappings */
-
-#endif /* __ARM_MMAN_H__ */
diff --git a/include/asm-arm26/mmu.h b/include/asm-arm26/mmu.h
deleted file mode 100644 (file)
index 9b8d3d7..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __ARM_MMU_H
-#define __ARM_MMU_H
-
-/*
- * The ARM doesn't have a mmu context
- */
-typedef struct { } mm_context_t;
-
-#endif
diff --git a/include/asm-arm26/mmu_context.h b/include/asm-arm26/mmu_context.h
deleted file mode 100644 (file)
index 16c821f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- *  linux/include/asm-arm/mmu_context.h
- *
- *  Copyright (C) 1996 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Changelog:
- *   27-06-1996        RMK     Created
- */
-#ifndef __ASM_ARM_MMU_CONTEXT_H
-#define __ASM_ARM_MMU_CONTEXT_H
-
-#include <asm-generic/mm_hooks.h>
-
-#define init_new_context(tsk,mm)       0
-#define destroy_context(mm)            do { } while(0)
-
-/*
- * This is called when "tsk" is about to enter lazy TLB mode.
- *
- * mm:  describes the currently active mm context
- * tsk: task which is entering lazy tlb
- * cpu: cpu number which is entering lazy tlb
- *
- * tsk->mm will be NULL
- */
-static inline void
-enter_lazy_tlb(struct mm_struct *mm, struct task_struct *tsk)
-{
-}
-
-/*
- * This is the actual mm switch as far as the scheduler
- * is concerned.  No registers are touched.
- */
-static inline void
-switch_mm(struct mm_struct *prev, struct mm_struct *next,
-         struct task_struct *tsk)
-{
-       cpu_switch_mm(next->pgd, next);
-}
-
-#define deactivate_mm(tsk,mm)   do { } while (0)
-
-static inline void activate_mm(struct mm_struct *prev, struct mm_struct *next)
-{
-       cpu_switch_mm(next->pgd, next);
-}
-
-#endif
diff --git a/include/asm-arm26/module.h b/include/asm-arm26/module.h
deleted file mode 100644 (file)
index 1157f17..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-#ifndef _ASM_ARM_MODULE_H
-#define _ASM_ARM_MODULE_H
-/*
- * This file contains the arm architecture specific module code.
- */
-
-#endif /* _ASM_ARM_MODULE_H */
diff --git a/include/asm-arm26/msgbuf.h b/include/asm-arm26/msgbuf.h
deleted file mode 100644 (file)
index 33b35b9..0000000
+++ /dev/null
@@ -1,31 +0,0 @@
-#ifndef _ASMARM_MSGBUF_H
-#define _ASMARM_MSGBUF_H
-
-/* 
- * The msqid64_ds structure for arm architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct msqid64_ds {
-       struct ipc64_perm msg_perm;
-       __kernel_time_t msg_stime;      /* last msgsnd time */
-       unsigned long   __unused1;
-       __kernel_time_t msg_rtime;      /* last msgrcv time */
-       unsigned long   __unused2;
-       __kernel_time_t msg_ctime;      /* last change time */
-       unsigned long   __unused3;
-       unsigned long  msg_cbytes;      /* current number of bytes on queue */
-       unsigned long  msg_qnum;        /* number of messages in queue */
-       unsigned long  msg_qbytes;      /* max number of bytes on queue */
-       __kernel_pid_t msg_lspid;       /* pid of last msgsnd */
-       __kernel_pid_t msg_lrpid;       /* last receive pid */
-       unsigned long  __unused4;
-       unsigned long  __unused5;
-};
-
-#endif /* _ASMARM_MSGBUF_H */
diff --git a/include/asm-arm26/namei.h b/include/asm-arm26/namei.h
deleted file mode 100644 (file)
index 3f5d340..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/* 
- * linux/include/asm-arm26/namei.h
- *
- * Routines to handle famous /usr/gnemul
- * Derived from the Sparc version of this file
- *
- * Included from linux/fs/namei.c
- */
-
-#ifndef __ASMARM_NAMEI_H
-#define __ASMARM_NAMEI_H
-
-#define ARM_BSD_EMUL "usr/gnemul/bsd/"
-
-static inline char *__emul_prefix(void)
-{
-       switch (current->personality) {
-       case PER_BSD:
-               return ARM_BSD_EMUL;
-       default:
-               return NULL;
-       }
-}
-
-#endif /* __ASMARM_NAMEI_H */
diff --git a/include/asm-arm26/oldlatches.h b/include/asm-arm26/oldlatches.h
deleted file mode 100644 (file)
index bc87089..0000000
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-arc/oldlatches.h
- *
- *  Copyright (C) 1996 Russell King, Dave Gilbert
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Modifications:
- *   04-04-1998        PJB/RMK Merged arc and a5k versions
- */
-#ifndef _ASM_ARCH_OLDLATCH_H
-#define _ASM_ARCH_OLDLATCH_H
-
-#define LATCHA_FDSEL0    (1<<0)
-#define LATCHA_FDSEL1    (1<<1)
-#define LATCHA_FDSEL2    (1<<2)
-#define LATCHA_FDSEL3    (1<<3)
-#define LATCHA_FDSELALL  (0xf)
-#define LATCHA_SIDESEL   (1<<4)
-#define LATCHA_MOTOR     (1<<5)
-#define LATCHA_INUSE     (1<<6)
-#define LATCHA_CHANGERST (1<<7)
-
-#define LATCHB_FDCDENSITY  (1<<1)
-#define LATCHB_FDCRESET    (1<<3)
-#define LATCHB_PRINTSTROBE (1<<4)
-
-/* newval=(oldval & mask)|newdata */
-void oldlatch_bupdate(unsigned char mask,unsigned char newdata);
-
-/* newval=(oldval & mask)|newdata */
-void oldlatch_aupdate(unsigned char mask,unsigned char newdata);
-
-#endif
-
diff --git a/include/asm-arm26/page.h b/include/asm-arm26/page.h
deleted file mode 100644 (file)
index fa19de2..0000000
+++ /dev/null
@@ -1,102 +0,0 @@
-#ifndef _ASMARM_PAGE_H
-#define _ASMARM_PAGE_H
-
-
-#ifdef __KERNEL__
-#ifndef __ASSEMBLY__
-
-extern void __clear_user_page(void *p, unsigned long user);
-extern void __copy_user_page(void *to, const void *from, unsigned long user);
-extern void copy_page(void *to, const void *from);
-
-//FIXME these may be wrong on ARM26
-#define clear_user_page(addr,vaddr,pg)                 \
-       do {                                            \
-               preempt_disable();                      \
-               __clear_user_page(addr, vaddr); \
-               preempt_enable();                       \
-       } while (0)
-
-#define copy_user_page(to,from,vaddr,pg)               \
-       do {                                            \
-               preempt_disable();                      \
-               __copy_user_page(to, from, vaddr);      \
-               preempt_enable();                       \
-       } while (0)
-
-#define clear_page(page)       memzero((void *)(page), PAGE_SIZE)
-#define copy_page(to, from)  __copy_user_page(to, from, 0);
-
-#undef STRICT_MM_TYPECHECKS
-
-#ifdef STRICT_MM_TYPECHECKS
-/*
- * These are used to make use of C type-checking..
- */
-typedef struct { unsigned long pgd; } pgd_t;
-typedef struct { unsigned long pte; } pte_t;
-typedef struct { unsigned long pmd; } pmd_t;
-typedef struct { unsigned long pgprot; } pgprot_t;
-
-#define pgd_val(x)      ((x).pgd)
-#define pte_val(x)      ((x).pte)
-#define pmd_val(x)      ((x).pmd)
-#define pgprot_val(x)   ((x).pgprot)
-
-#define __pte(x)        ((pte_t) { (x) } )
-#define __pmd(x)        ((pmd_t) { (x) } )
-#define __pgprot(x)     ((pgprot_t) { (x) } )
-
-#else
-/*
- * .. while these make it easier on the compiler
- */
-typedef unsigned long pgd_t;
-typedef unsigned long pte_t;
-typedef unsigned long pmd_t;
-typedef unsigned long pgprot_t;
-
-//FIXME - should these cast to unsigned long?
-#define pgd_val(x)      (x)
-#define pte_val(x)      (x)
-#define pmd_val(x)      (x)
-#define pgprot_val(x)   (x)
-
-#define __pte(x)        (x)
-#define __pmd(x)        (x)
-#define __pgprot(x)     (x)
-
-#endif /* STRICT_MM_TYPECHECKS */
-#endif /* !__ASSEMBLY__ */
-#endif /* __KERNEL__ */
-
-/* PAGE_SHIFT determines the page size.  This is configurable. */
-#if defined(CONFIG_PAGESIZE_16)
-#define PAGE_SHIFT      14              /* 16K */
-#else           /* default */
-#define PAGE_SHIFT      15              /* 32K */
-#endif
-
-#define EXEC_PAGESIZE   32768
-
-#define PAGE_SIZE              (1UL << PAGE_SHIFT)
-#define PAGE_MASK              (~(PAGE_SIZE-1))
-
-/* to align the pointer to the (next) page boundary */
-#define PAGE_ALIGN(addr)       (((addr)+PAGE_SIZE-1)&PAGE_MASK)
-
-#ifdef __KERNEL__
-#ifndef __ASSEMBLY__
-
-#include <asm/memory.h>
-
-#endif /* !__ASSEMBLY__ */
-
-#define VM_DATA_DEFAULT_FLAGS  (VM_READ | VM_WRITE | VM_EXEC | \
-                                VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
-
-#endif /* __KERNEL__ */
-
-#include <asm-generic/page.h>
-
-#endif
diff --git a/include/asm-arm26/param.h b/include/asm-arm26/param.h
deleted file mode 100644 (file)
index 6b1e52d..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- *  linux/include/asm-arm/param.h
- *
- *  Copyright (C) 1995-1999 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASM_PARAM_H
-#define __ASM_PARAM_H
-
-#ifndef __KERNEL_HZ
-#define __KERNEL_HZ    100
-#endif
-
-#ifdef __KERNEL__
-# define HZ            __KERNEL_HZ     /* Internal kernel timer frequency */
-# define USER_HZ       100             /* User interfaces are in "ticks" */
-# define CLOCKS_PER_SEC        (USER_HZ)       /* like times() */
-#else
-# define HZ            100
-#endif
-
-#ifndef NOGROUP
-#define NOGROUP         (-1)
-#endif
-
-/* max length of hostname */
-#define MAXHOSTNAMELEN  64
-
-#endif
-
diff --git a/include/asm-arm26/parport.h b/include/asm-arm26/parport.h
deleted file mode 100644 (file)
index f2f90c7..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/*
- *  linux/include/asm-arm/parport.h: ARM-specific parport initialisation
- *
- *  Copyright (C) 1999, 2000  Tim Waugh <tim@cyberelk.demon.co.uk>
- *
- * This file should only be included by drivers/parport/parport_pc.c.
- */
-
-#ifndef __ASMARM_PARPORT_H
-#define __ASMARM_PARPORT_H
-
-static int __devinit parport_pc_find_isa_ports (int autoirq, int autodma);
-static int __devinit parport_pc_find_nonpci_ports (int autoirq, int autodma)
-{
-       return parport_pc_find_isa_ports (autoirq, autodma);
-}
-
-#endif /* !(_ASMARM_PARPORT_H) */
diff --git a/include/asm-arm26/pci.h b/include/asm-arm26/pci.h
deleted file mode 100644 (file)
index 6ac67ed..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/* Should not be needed. IDE stupidity */
-/* JMA 18.05.03 - is kinda needed, if only to tell it we don't have a PCI bus */
-
-#define PCI_DMA_BUS_IS_PHYS            0
-#define pcibios_scan_all_fns(a, b)     0
-
diff --git a/include/asm-arm26/percpu.h b/include/asm-arm26/percpu.h
deleted file mode 100644 (file)
index b4e32d8..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ARM_PERCPU
-#define __ARM_PERCPU
-
-#include <asm-generic/percpu.h>
-
-#endif
diff --git a/include/asm-arm26/pgalloc.h b/include/asm-arm26/pgalloc.h
deleted file mode 100644 (file)
index 7725af3..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-/*
- *  linux/include/asm-arm/pgalloc.h
- *
- *  Copyright (C) 2000-2001 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef _ASMARM_PGALLOC_H
-#define _ASMARM_PGALLOC_H
-
-#include <asm/processor.h>
-#include <asm/cacheflush.h>
-#include <asm/tlbflush.h>
-#include <linux/slab.h>
-
-extern struct kmem_cache *pte_cache;
-
-static inline pte_t *pte_alloc_one_kernel(struct mm_struct *mm, unsigned long addr){
-       return kmem_cache_alloc(pte_cache, GFP_KERNEL);
-}
-
-static inline void pte_free_kernel(pte_t *pte){
-        if (pte)
-                kmem_cache_free(pte_cache, pte);
-}
-
-/*
- * Populate the pmdp entry with a pointer to the pte.  This pmd is part
- * of the mm address space.
- *
- * If 'mm' is the init tasks mm, then we are doing a vmalloc, and we
- * need to set stuff up correctly for it.
- */
-static inline void
-pmd_populate_kernel(struct mm_struct *mm, pmd_t *pmdp, pte_t *ptep)
-{
-//FIXME - is this doing the right thing?
-        set_pmd(pmdp, (unsigned long)ptep | 1/*FIXME _PMD_PRESENT*/);
-}
-
-/*
- * FIXME - We use the old 2.5.5-rmk1 hack for this.
- * This is not truly correct, but should be functional.
- */
-#define pte_alloc_one(mm,addr)  ((struct page *)pte_alloc_one_kernel(mm,addr))
-#define pte_free(pte)           pte_free_kernel((pte_t *)pte)
-#define pmd_populate(mm,pmdp,ptep) pmd_populate_kernel(mm,pmdp,(pte_t *)ptep)
-
-/*
- * Since we have only two-level page tables, these are trivial
- * 
- * trick __pmd_alloc into optimising away. The actual value is irrelevant though as it
- * is thrown away. It just cant be zero. -IM
- */
-
-#define pmd_alloc_one(mm,addr)         ({ BUG(); ((pmd_t *)2); })
-#define pmd_free(pmd)                  do { } while (0)
-#define pgd_populate(mm,pmd,pte)       BUG()
-
-extern pgd_t *get_pgd_slow(struct mm_struct *mm);
-extern void free_pgd_slow(pgd_t *pgd);
-
-#define pgd_alloc(mm)                  get_pgd_slow(mm)
-#define pgd_free(pgd)                  free_pgd_slow(pgd)
-
-#define check_pgt_cache()              do { } while (0)
-
-#endif
diff --git a/include/asm-arm26/pgtable.h b/include/asm-arm26/pgtable.h
deleted file mode 100644 (file)
index 55a1a69..0000000
+++ /dev/null
@@ -1,298 +0,0 @@
-/*
- *  linux/include/asm-arm26/pgtable.h
- *
- *  Copyright (C) 2000-2002 Russell King
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef _ASMARM_PGTABLE_H
-#define _ASMARM_PGTABLE_H
-
-#include <asm-generic/4level-fixup.h>
-
-#include <asm/memory.h>
-
-/*
- * The table below defines the page protection levels that we insert into our
- * Linux page table version.  These get translated into the best that the
- * architecture can perform.  Note that on most ARM hardware:
- *  1) We cannot do execute protection
- *  2) If we could do execute protection, then read is implied
- *  3) write implies read permissions
- */
-#define __P000  PAGE_NONE
-#define __P001  PAGE_READONLY
-#define __P010  PAGE_COPY
-#define __P011  PAGE_COPY
-#define __P100  PAGE_READONLY
-#define __P101  PAGE_READONLY
-#define __P110  PAGE_COPY
-#define __P111  PAGE_COPY
-
-#define __S000  PAGE_NONE
-#define __S001  PAGE_READONLY
-#define __S010  PAGE_SHARED
-#define __S011  PAGE_SHARED
-#define __S100  PAGE_READONLY
-#define __S101  PAGE_READONLY
-#define __S110  PAGE_SHARED
-#define __S111  PAGE_SHARED
-
-/*
- * PMD_SHIFT determines the size of the area a second-level page table can map
- * PGDIR_SHIFT determines what a third-level page table entry can map
- */
-#define PGD_SHIFT              25
-#define PMD_SHIFT              20
-
-#define PGD_SIZE                (1UL << PGD_SHIFT)
-#define PGD_MASK                (~(PGD_SIZE-1))
-#define PMD_SIZE                (1UL << PMD_SHIFT)
-#define PMD_MASK                (~(PMD_SIZE-1))
-
-/* The kernel likes to use these names for the above (ick) */
-#define PGDIR_SIZE PGD_SIZE
-#define PGDIR_MASK PGD_MASK
-
-#define PTRS_PER_PGD            32
-#define PTRS_PER_PMD            1
-#define PTRS_PER_PTE            32
-
-/*
- * This is the lowest virtual address we can permit any user space
- * mapping to be mapped at.  This is particularly important for
- * non-high vector CPUs.
- */
-#define FIRST_USER_ADDRESS     PAGE_SIZE
-
-#define FIRST_USER_PGD_NR       1
-#define USER_PTRS_PER_PGD       ((TASK_SIZE/PGD_SIZE) - FIRST_USER_PGD_NR)
-
-// FIXME - WTF?
-#define LIBRARY_TEXT_START     0x0c000000
-
-
-
-#ifndef __ASSEMBLY__
-extern void __pte_error(const char *file, int line, unsigned long val);
-extern void __pmd_error(const char *file, int line, unsigned long val);
-extern void __pgd_error(const char *file, int line, unsigned long val);
-
-#define pte_ERROR(pte)         __pte_error(__FILE__, __LINE__, pte_val(pte))
-#define pmd_ERROR(pmd)         __pmd_error(__FILE__, __LINE__, pmd_val(pmd))
-#define pgd_ERROR(pgd)         __pgd_error(__FILE__, __LINE__, pgd_val(pgd))
-
-/*
- * ZERO_PAGE is a global shared page that is always zero: used
- * for zero-mapped memory areas etc..
- */
-extern struct page *empty_zero_page;
-#define ZERO_PAGE(vaddr)       (empty_zero_page)
-
-#define pte_pfn(pte)           (pte_val(pte) >> PAGE_SHIFT)
-#define pte_page(pte)           (pfn_to_page(pte_pfn(pte)))
-#define pfn_pte(pfn,prot)      (__pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot)))
-#define pages_to_mb(x)         ((x) >> (20 - PAGE_SHIFT))
-#define mk_pte(page,prot)      pfn_pte(page_to_pfn(page),prot)
-
-/*
- * Terminology: PGD = Page Directory, PMD = Page Middle Directory,
- *              PTE = Page Table Entry
- *
- * on arm26 we have no 2nd level page table. we simulate this by removing the
- * PMD.
- *
- * pgd_none is 0 to prevernt pmd_alloc() calling __pmd_alloc(). This causes it
- * to return pmd_offset(pgd,addr) which is a pointer to the pgd (IOW, a no-op).
- *
- * however, to work this way, whilst we are allocating 32 pgds, containing 32
- * PTEs, the actual work is done on the PMDs, thus:
- *
- * instead of  mm->pgd->pmd->pte
- * we have     mm->pgdpmd->pte
- *
- * IOW, think of PGD operations and PMD ones as being the same thing, just
- * that PGD stuff deals with the mm_struct side of things, wheras PMD stuff
- * deals with the pte side of things.
- *
- * additionally, we store some bits in the PGD and PTE pointers: 
- * PGDs:
- *   o The lowest (1) bit of the PGD is to determine if it is present or swap.
- *   o The 2nd bit of the PGD is unused and must be zero.
- *   o The top 6 bits of the PGD must be zero. 
- * PTEs:
- *   o The lower 5 bits of a pte are flags. bit 1 is the 'present' flag. The
- *     others determine the pages attributes.
- *
- * the pgd_val, pmd_val, and pte_val macros seem to be private to our code.
- * They get the RAW value of the PGD/PMD/PTE entry, including our flags
- * encoded into the pointers.
- * 
- * The pgd_offset, pmd_offset, and pte_offset macros are used by the kernel,
- * so they shouldnt have our flags attached.
- *
- * If you understood that, feel free to explain it to me...
- *
- */
-
-#define _PMD_PRESENT     (0x01)
-
-/* These definitions allow us to optimise out stuff like pmd_alloc() */
-#define pgd_none(pgd)          (0) 
-#define pgd_bad(pgd)           (0)
-#define pgd_present(pgd)       (1)
-#define pgd_clear(pgdp)                do { } while (0)
-
-/* Whilst these handle our actual 'page directory' (the agglomeration of pgd and pmd)
- */
-#define pmd_none(pmd)           (!pmd_val(pmd))
-#define pmd_bad(pmd)            ((pmd_val(pmd) & 0xfc000002))
-#define pmd_present(pmd)        (pmd_val(pmd) & _PMD_PRESENT)
-#define set_pmd(pmd_ptr, pmd)   ((*(pmd_ptr)) = (pmd))
-#define pmd_clear(pmdp)         set_pmd(pmdp, __pmd(0))
-
-/* and these handle our pte tables */
-#define pte_none(pte)           (!pte_val(pte))
-#define pte_present(pte)        (pte_val(pte) & _PAGE_PRESENT)
-#define set_pte(pte_ptr, pte)   ((*(pte_ptr)) = (pte))
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
-#define pte_clear(mm,addr,ptep)        set_pte_at((mm),(addr),(ptep), __pte(0))
-
-/* macros to ease the getting of pointers to stuff... */
-#define pgd_offset(mm, addr)   ((pgd_t *)(mm)->pgd        + __pgd_index(addr))
-#define pmd_offset(pgd, addr)  ((pmd_t *)(pgd))
-#define pte_offset(pmd, addr)   ((pte_t *)pmd_page(*(pmd)) + __pte_index(addr))
-
-/* there is no __pmd_index as we dont use pmds */
-#define __pgd_index(addr)      ((addr) >> PGD_SHIFT)
-#define __pte_index(addr)      (((addr) >> PAGE_SHIFT) & (PTRS_PER_PTE - 1))
-
-
-/* Keep the kernel happy */
-#define pgd_index(addr)         __pgd_index(addr)
-#define pgd_offset_k(addr)     (pgd_offset(&init_mm, addr))
-
-/*
- * The vmalloc() routines leaves a hole of 4kB between each vmalloced
- * area for the same reason. ;) FIXME: surely 1 page not 4k ?
- */
-#define VMALLOC_START     0x01a00000
-#define VMALLOC_END       0x01c00000
-
-/* Is pmd_page supposed to return a pointer to a page in some arches? ours seems to
- * return a pointer to memory (no special alignment)
- */
-#define pmd_page(pmd)  ((struct page *)(pmd_val((pmd)) & ~_PMD_PRESENT))
-#define pmd_page_vaddr(pmd) ((pte_t *)(pmd_val((pmd)) & ~_PMD_PRESENT))
-
-#define pte_offset_kernel(dir,addr)     (pmd_page_vaddr(*(dir)) + __pte_index(addr))
-
-#define pte_offset_map(dir,addr)        (pmd_page_vaddr(*(dir)) + __pte_index(addr))
-#define pte_offset_map_nested(dir,addr) (pmd_page_vaddr(*(dir)) + __pte_index(addr))
-#define pte_unmap(pte)                  do { } while (0)
-#define pte_unmap_nested(pte)           do { } while (0)
-
-
-#define _PAGE_PRESENT   0x01
-#define _PAGE_READONLY  0x02
-#define _PAGE_NOT_USER  0x04
-#define _PAGE_OLD       0x08
-#define _PAGE_CLEAN     0x10
-
-// an old page has never been read.
-// a clean page has never been written.
-
-/*                               -- present --   -- !dirty --  --- !write ---   ---- !user --- */
-#define PAGE_NONE       __pgprot(_PAGE_PRESENT | _PAGE_CLEAN | _PAGE_READONLY | _PAGE_NOT_USER)
-#define PAGE_SHARED     __pgprot(_PAGE_PRESENT | _PAGE_CLEAN                                  )
-#define PAGE_COPY       __pgprot(_PAGE_PRESENT | _PAGE_CLEAN | _PAGE_READONLY                 )
-#define PAGE_READONLY   __pgprot(_PAGE_PRESENT | _PAGE_CLEAN | _PAGE_READONLY                 )
-#define PAGE_KERNEL     __pgprot(_PAGE_PRESENT                                | _PAGE_NOT_USER)
-
-#define _PAGE_CHG_MASK  (PAGE_MASK | _PAGE_OLD | _PAGE_CLEAN)
-
-/*
- * The following only work if pte_present() is true.
- * Undefined behaviour if not..
- */
-#define pte_write(pte)                  (!(pte_val(pte) & _PAGE_READONLY))
-#define pte_dirty(pte)                  (!(pte_val(pte) & _PAGE_CLEAN))
-#define pte_young(pte)                  (!(pte_val(pte) & _PAGE_OLD))
-//ONLY when !pte_present() I think. nicked from arm32 (FIXME!)
-#define pte_file(pte)                   (!(pte_val(pte) & _PAGE_OLD))
-
-#define PTE_BIT_FUNC(fn,op)                     \
-static inline pte_t pte_##fn(pte_t pte) { pte_val(pte) op; return pte; }
-
-PTE_BIT_FUNC(wrprotect, |=  _PAGE_READONLY);
-PTE_BIT_FUNC(mkwrite,   &= ~_PAGE_READONLY);
-PTE_BIT_FUNC(mkclean,   |=  _PAGE_CLEAN);
-PTE_BIT_FUNC(mkdirty,   &= ~_PAGE_CLEAN);
-PTE_BIT_FUNC(mkold,     |=  _PAGE_OLD);
-PTE_BIT_FUNC(mkyoung,   &= ~_PAGE_OLD);
-
-/*
- * We don't store cache state bits in the page table here. FIXME - or do we?
- */
-#define pgprot_noncached(prot)  (prot)
-#define pgprot_writecombine(prot) (prot) //FIXME - is a no-op?
-
-extern void pgtable_cache_init(void);
-
-//FIXME - nicked from arm32 and brutally hacked. probably wrong.
-#define pte_to_pgoff(x) (pte_val(x) >> 2)
-#define pgoff_to_pte(x) __pte(((x) << 2) & ~_PAGE_OLD)
-
-//FIXME - next line borrowed from arm32. is it right?
-#define PTE_FILE_MAX_BITS       30
-
-
-static inline pte_t pte_modify(pte_t pte, pgprot_t newprot)
-{
-       pte_val(pte) = (pte_val(pte) & _PAGE_CHG_MASK) | pgprot_val(newprot);
-       return pte;
-}
-
-extern pgd_t swapper_pg_dir[PTRS_PER_PGD];
-
-/* Encode and decode a swap entry.
- *
- * We support up to 32GB of swap on 4k machines
- */
-#define __swp_type(x)          (((x).val >> 2) & 0x7f)
-#define __swp_offset(x)                ((x).val >> 9)
-#define __swp_entry(type,offset) ((swp_entry_t) { ((type) << 2) | ((offset) << 9) })
-#define __pte_to_swp_entry(pte)        ((swp_entry_t) { pte_val(pte) })
-#define __swp_entry_to_pte(swp)        ((pte_t) { (swp).val })
-
-/* Needs to be defined here and not in linux/mm.h, as it is arch dependent */
-/* FIXME: this is not correct */
-#define kern_addr_valid(addr)  (1)
-
-/*
- * Conversion functions: convert a page and protection to a page entry,
- * and a page entry and page directory to the page they refer to.
- */
-static inline pte_t mk_pte_phys(unsigned long physpage, pgprot_t pgprot)
-{
-        pte_t pte;
-        pte_val(pte) = physpage | pgprot_val(pgprot);
-        return pte;
-}
-
-
-#include <asm-generic/pgtable.h>
-
-/*
- * remap a physical page `pfn' of size `size' with page protection `prot'
- * into virtual address `from'
- */
-#define io_remap_pfn_range(vma,from,pfn,size,prot) \
-               remap_pfn_range(vma, from, pfn, size, prot)
-
-#endif /* !__ASSEMBLY__ */
-
-#endif /* _ASMARM_PGTABLE_H */
diff --git a/include/asm-arm26/poll.h b/include/asm-arm26/poll.h
deleted file mode 100644 (file)
index 1170e70..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef __ASMARM_POLL_H
-#define __ASMARM_POLL_H
-
-#include <asm-generic/poll.h>
-
-#undef POLLREMOVE
-
-#endif
diff --git a/include/asm-arm26/posix_types.h b/include/asm-arm26/posix_types.h
deleted file mode 100644 (file)
index f8d1eb4..0000000
+++ /dev/null
@@ -1,81 +0,0 @@
-/*
- *  linux/include/asm-arm/posix_types.h
- *
- *  Copyright (C) 1996-1998 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Changelog:
- *   27-06-1996        RMK     Created
- */
-#ifndef __ARCH_ARM_POSIX_TYPES_H
-#define __ARCH_ARM_POSIX_TYPES_H
-
-/*
- * This file is generally used by user-level software, so you need to
- * be a little careful about namespace pollution etc.  Also, we cannot
- * assume GCC is being used.
- */
-
-typedef unsigned long          __kernel_ino_t;
-typedef unsigned short         __kernel_mode_t;
-typedef unsigned short         __kernel_nlink_t;
-typedef long                   __kernel_off_t;
-typedef int                    __kernel_pid_t;
-typedef unsigned short         __kernel_ipc_pid_t;
-typedef unsigned short         __kernel_uid_t;
-typedef unsigned short         __kernel_gid_t;
-typedef unsigned int           __kernel_size_t;
-typedef int                    __kernel_ssize_t;
-typedef int                    __kernel_ptrdiff_t;
-typedef long                   __kernel_time_t;
-typedef long                   __kernel_suseconds_t;
-typedef long                   __kernel_clock_t;
-typedef int                    __kernel_timer_t;
-typedef int                    __kernel_clockid_t;
-typedef int                    __kernel_daddr_t;
-typedef char *                 __kernel_caddr_t;
-typedef unsigned short         __kernel_uid16_t;
-typedef unsigned short         __kernel_gid16_t;
-typedef unsigned int           __kernel_uid32_t;
-typedef unsigned int           __kernel_gid32_t;
-
-typedef unsigned short         __kernel_old_uid_t;
-typedef unsigned short         __kernel_old_gid_t;
-typedef unsigned short         __kernel_old_dev_t;
-
-#ifdef __GNUC__
-typedef long long              __kernel_loff_t;
-#endif
-
-typedef struct {
-#if defined(__KERNEL__) || defined(__USE_ALL)
-       int     val[2];
-#else /* !defined(__KERNEL__) && !defined(__USE_ALL) */
-       int     __val[2];
-#endif /* !defined(__KERNEL__) && !defined(__USE_ALL) */
-} __kernel_fsid_t;
-
-#if defined(__KERNEL__) || !defined(__GLIBC__) || (__GLIBC__ < 2)
-
-#undef __FD_SET
-#define __FD_SET(fd, fdsetp) \
-               (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] |= (1<<((fd) & 31)))
-
-#undef __FD_CLR
-#define __FD_CLR(fd, fdsetp) \
-               (((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] &= ~(1<<((fd) & 31)))
-
-#undef __FD_ISSET
-#define __FD_ISSET(fd, fdsetp) \
-               ((((fd_set *)(fdsetp))->fds_bits[(fd) >> 5] & (1<<((fd) & 31))) != 0)
-
-#undef __FD_ZERO
-#define __FD_ZERO(fdsetp) \
-               (memset ((fdsetp), 0, sizeof (*(fd_set *)(fdsetp))))
-
-#endif
-
-#endif
diff --git a/include/asm-arm26/proc-fns.h b/include/asm-arm26/proc-fns.h
deleted file mode 100644 (file)
index a831004..0000000
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- *  linux/include/asm-arm26/proc-fns.h
- *
- *  Copyright (C) 2000 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASSEMBLY__
-
-#include <asm/page.h>
-
-/*
- * Don't change this structure - ASM code
- * relies on it.
- */
-extern struct processor {
-       /* check for any bugs */
-       void (*_check_bugs)(void);
-       /* Set up any processor specifics */
-       void (*_proc_init)(void);
-       /* Disable any processor specifics */
-       void (*_proc_fin)(void);
-       /* set the MEMC hardware mappings */
-       void (*_set_pgd)(pgd_t *pgd);
-       /* XCHG */
-       unsigned long (*_xchg_1)(unsigned long x, volatile void *ptr);
-       unsigned long (*_xchg_4)(unsigned long x, volatile void *ptr);
-} processor;
-
-extern const struct processor arm2_processor_functions;
-extern const struct processor arm250_processor_functions;
-extern const struct processor arm3_processor_functions;
-
-#define cpu_check_bugs()                       processor._check_bugs()
-#define cpu_proc_init()                                processor._proc_init()
-#define cpu_proc_fin()                         processor._proc_fin()
-#define cpu_do_idle()                          do { } while (0)
-#define cpu_switch_mm(pgd,mm)                  processor._set_pgd(pgd)
-#define cpu_xchg_1(x,ptr)                      processor._xchg_1(x,ptr)
-#define cpu_xchg_4(x,ptr)                      processor._xchg_4(x,ptr)
-
-
-//FIXME - these shouldnt be in proc-fn.h
-extern void cpu_memc_update_all(pgd_t *pgd);
-extern void cpu_memc_update_entry(pgd_t *pgd, unsigned long phys_pte, unsigned long log_addr);
-
-#endif
diff --git a/include/asm-arm26/processor.h b/include/asm-arm26/processor.h
deleted file mode 100644 (file)
index 1d2d5f7..0000000
+++ /dev/null
@@ -1,113 +0,0 @@
-/*
- *  linux/include/asm-arm26/processor.h
- *
- *  Copyright (C) 1995 Russell King
- *  Copyright (C) 2003 Ian Molton
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-#ifndef __ASM_ARM_PROCESSOR_H
-#define __ASM_ARM_PROCESSOR_H
-
-/*
- * Default implementation of macro that returns current
- * instruction pointer ("program counter").
- */
-#define current_text_addr() ({ __label__ _l; _l: &&_l;})
-
-#ifdef __KERNEL__
-
-#include <asm/atomic.h>
-#include <asm/ptrace.h>
-#include <linux/string.h>
-
-#define KERNEL_STACK_SIZE 4096
-
-typedef struct {
-        void (*put_byte)(void);               /* Special calling convention */
-        void (*get_byte)(void);               /* Special calling convention */
-        void (*put_half)(void);               /* Special calling convention */
-        void (*get_half)(void);               /* Special calling convention */
-        void (*put_word)(void);               /* Special calling convention */
-        void (*get_word)(void);               /* Special calling convention */
-        void (*put_dword)(void);              /* Special calling convention */
-        unsigned long (*copy_from_user)(void *to, const void *from, unsigned long sz);
-        unsigned long (*copy_to_user)(void *to, const void *from, unsigned long sz);
-        unsigned long (*clear_user)(void *addr, unsigned long sz);
-        unsigned long (*strncpy_from_user)(char *to, const char *from, unsigned long sz);
-        unsigned long (*strnlen_user)(const char *s, long n);
-} uaccess_t;
-
-extern uaccess_t uaccess_user, uaccess_kernel;
-
-#define EXTRA_THREAD_STRUCT                     \
-        uaccess_t       *uaccess;         /* User access functions*/
-
-#define EXTRA_THREAD_STRUCT_INIT                \
-        .uaccess        = &uaccess_kernel,
-
-// FIXME?!!
-
-#define start_thread(regs,pc,sp)                                        \
-({                                                                      \
-        unsigned long *stack = (unsigned long *)sp;                     \
-        set_fs(USER_DS);                                                \
-        memzero(regs->uregs, sizeof (regs->uregs));                     \
-        regs->ARM_pc = pc | ~0xfc000003;        /* pc */                \
-        regs->ARM_sp = sp;              /* sp */                        \
-        regs->ARM_r2 = stack[2];        /* r2 (envp) */                 \
-        regs->ARM_r1 = stack[1];        /* r1 (argv) */                 \
-        regs->ARM_r0 = stack[0];        /* r0 (argc) */                 \
-})
-
-#define KSTK_EIP(tsk)   (((unsigned long *)(4096+(unsigned long)(tsk)))[1020])
-#define KSTK_ESP(tsk)   (((unsigned long *)(4096+(unsigned long)(tsk)))[1018])
-
-struct debug_entry {
-        u32                     address;
-        u32                    insn;
-};
-
-struct debug_info {
-        int                     nsaved;
-        struct debug_entry      bp[2];
-};
-
-struct thread_struct {
-                                                       /* fault info     */
-       unsigned long                   address;
-       unsigned long                   trap_no;
-       unsigned long                   error_code;
-                                                       /* debugging      */
-       struct debug_info               debug;
-       EXTRA_THREAD_STRUCT
-};
-
-#define INIT_THREAD  { \
-EXTRA_THREAD_STRUCT_INIT \
-}
-
-/* Forward declaration, a strange C thing */
-struct task_struct;
-
-/* Free all resources held by a thread. */
-extern void release_thread(struct task_struct *);
-
-unsigned long get_wchan(struct task_struct *p);
-
-#define cpu_relax()                    barrier()
-
-/* Prepare to copy thread state - unlazy all lazy status */
-#define prepare_to_copy(tsk)    do { } while (0)
-
-/*
- * Create a new kernel thread
- */
-extern int kernel_thread(int (*fn)(void *), void *arg, unsigned long flags);
-
-#endif
-
-#endif /* __ASM_ARM_PROCESSOR_H */
diff --git a/include/asm-arm26/procinfo.h b/include/asm-arm26/procinfo.h
deleted file mode 100644 (file)
index b28624d..0000000
+++ /dev/null
@@ -1,56 +0,0 @@
-/*
- *  linux/include/asm-arm/procinfo.h
- *
- *  Copyright (C) 1996-1999 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASM_PROCINFO_H
-#define __ASM_PROCINFO_H
-
-#ifndef __ASSEMBLY__
-
-//struct processor;
-//struct cpu_user_fns;
-
-struct proc_info_item {
-       const char       *manufacturer;
-       const char       *cpu_name;
-};
-
-/*
- * Note!  struct processor is always defined if we're
- * using MULTI_CPU, otherwise this entry is unused,
- * but still exists.
- *
- * NOTE! The following structure is defined by assembly
- * language, NOT C code.  For more information, check:
- *  arch/arm/mm/proc-*.S and arch/arm/kernel/head-armv.S
- */
-struct proc_info_list {
-       unsigned int            cpu_val;
-       unsigned int            cpu_mask;
-       const char              *arch_name;
-       const char              *elf_name;
-       unsigned int            elf_hwcap;
-       struct proc_info_item   *info;
-       struct processor        *proc;
-};
-
-#endif /* __ASSEMBLY__ */
-
-#define PROC_INFO_SZ   48
-
-#define HWCAP_SWP      1
-#define HWCAP_HALF     2
-#define HWCAP_THUMB    4
-#define HWCAP_26BIT    8       /* Play it safe */
-#define HWCAP_FAST_MULT        16
-#define HWCAP_FPA      32
-#define HWCAP_VFP      64
-#define HWCAP_EDSP     128
-#define HWCAP_JAVA     256
-
-#endif
diff --git a/include/asm-arm26/ptrace.h b/include/asm-arm26/ptrace.h
deleted file mode 100644 (file)
index 6a46b5a..0000000
+++ /dev/null
@@ -1,104 +0,0 @@
-#ifndef __ASM_ARM_PTRACE_H
-#define __ASM_ARM_PTRACE_H
-
-#define PTRACE_GETREGS         12
-#define PTRACE_SETREGS         13
-#define PTRACE_GETFPREGS       14
-#define PTRACE_SETFPREGS       15
-#define PTRACE_OLDSETOPTIONS    21
-
-/* options set using PTRACE_SETOPTIONS */
-#define PTRACE_O_TRACESYSGOOD  0x00000001
-
-#define MODE_USR26      0x00000000
-#define MODE_FIQ26      0x00000001
-#define MODE_IRQ26      0x00000002
-#define MODE_SVC26      0x00000003
-#define MODE_MASK       0x00000003
-
-#define PSR_F_BIT       0x04000000
-#define PSR_I_BIT       0x08000000
-#define PSR_V_BIT       0x10000000
-#define PSR_C_BIT       0x20000000
-#define PSR_Z_BIT       0x40000000
-#define PSR_N_BIT       0x80000000
-
-#define PCMASK          0xfc000003
-
-
-#ifndef __ASSEMBLY__
-
-#define pc_pointer(v) ((v) & ~PCMASK)   /* convert v to pc type address */
-#define instruction_pointer(regs) (pc_pointer((regs)->ARM_pc)) /* get pc */
-#define profile_pc(regs) instruction_pointer(regs)
-
-/* this struct defines the way the registers are stored on the
-   stack during a system call. */
-
-struct pt_regs {
-       long uregs[17];
-};
-
-#define ARM_pc         uregs[15]
-#define ARM_lr         uregs[14]
-#define ARM_sp         uregs[13]
-#define ARM_ip         uregs[12]
-#define ARM_fp         uregs[11]
-#define ARM_r10                uregs[10]
-#define ARM_r9         uregs[9]
-#define ARM_r8         uregs[8]
-#define ARM_r7         uregs[7]
-#define ARM_r6         uregs[6]
-#define ARM_r5         uregs[5]
-#define ARM_r4         uregs[4]
-#define ARM_r3         uregs[3]
-#define ARM_r2         uregs[2]
-#define ARM_r1         uregs[1]
-#define ARM_r0         uregs[0]
-#define ARM_ORIG_r0    uregs[16]
-
-#ifdef __KERNEL__
-
-#define processor_mode(regs) \
-       ((regs)->ARM_pc & MODE_MASK)
-
-#define user_mode(regs) \
-       (processor_mode(regs) == MODE_USR26)
-
-#define interrupts_enabled(regs) \
-       (!((regs)->ARM_pc & PSR_I_BIT))
-
-#define fast_interrupts_enabled(regs) \
-       (!((regs)->ARM_pc & PSR_F_BIT))
-
-#define condition_codes(regs) \
-       ((regs)->ARM_pc & (PSR_V_BIT|PSR_C_BIT|PSR_Z_BIT|PSR_N_BIT))
-
-/* Are the current registers suitable for user mode?
- * (used to maintain security in signal handlers)
- */
-static inline int valid_user_regs(struct pt_regs *regs)
-{
-       if (user_mode(regs) &&
-           (regs->ARM_pc & (PSR_F_BIT | PSR_I_BIT)) == 0)
-               return 1;
-
-       /*
-        * force it to be something sensible
-        */
-       regs->ARM_pc &= ~(MODE_MASK | PSR_F_BIT | PSR_I_BIT);
-
-       return 0;
-}
-
-extern void show_regs(struct pt_regs *);
-
-#define predicate(x)    (x & 0xf0000000)
-#define PREDICATE_ALWAYS        0xe0000000
-
-#endif /* __KERNEL__ */
-
-#endif /* __ASSEMBLY__ */
-
-#endif
-
diff --git a/include/asm-arm26/resource.h b/include/asm-arm26/resource.h
deleted file mode 100644 (file)
index 734b581..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ARM_RESOURCE_H
-#define _ARM_RESOURCE_H
-
-#include <asm-generic/resource.h>
-
-#endif
diff --git a/include/asm-arm26/scatterlist.h b/include/asm-arm26/scatterlist.h
deleted file mode 100644 (file)
index d9c056c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-#ifndef _ASMARM_SCATTERLIST_H
-#define _ASMARM_SCATTERLIST_H
-
-#include <asm/types.h>
-
-struct scatterlist {
-       struct page     *page;          /* buffer page                   */
-       unsigned int    offset;         /* buffer offset                 */
-       dma_addr_t      dma_address;    /* dma address                   */
-       unsigned int    length;         /* length                        */
-       char            *__address;     /* for set_dma_addr              */
-};
-
-/*
- * These macros should be used after a pci_map_sg call has been done
- * to get bus addresses of each of the SG entries and their lengths.
- * You should only work with the number of sg entries pci_map_sg
- * returns, or alternatively stop on the first sg_dma_len(sg) which
- * is 0.
- */
-#define sg_dma_address(sg)      ((sg)->dma_address)
-#define sg_dma_len(sg)          ((sg)->length)
-
-#define ISA_DMA_THRESHOLD (0xffffffff)
-
-#endif /* _ASMARM_SCATTERLIST_H */
diff --git a/include/asm-arm26/sections.h b/include/asm-arm26/sections.h
deleted file mode 100644 (file)
index 10b6370..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-//FIXME - nicked from arm32 - check its correct.
-#include <asm-generic/sections.h>
diff --git a/include/asm-arm26/segment.h b/include/asm-arm26/segment.h
deleted file mode 100644 (file)
index 9e24c21..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-#ifndef __ASM_ARM_SEGMENT_H
-#define __ASM_ARM_SEGMENT_H
-
-#define __KERNEL_CS   0x0
-#define __KERNEL_DS   0x0
-
-#define __USER_CS     0x1
-#define __USER_DS     0x1
-
-#endif /* __ASM_ARM_SEGMENT_H */
-
diff --git a/include/asm-arm26/semaphore-helper.h b/include/asm-arm26/semaphore-helper.h
deleted file mode 100644 (file)
index 1d7f198..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef ASMARM_SEMAPHORE_HELPER_H
-#define ASMARM_SEMAPHORE_HELPER_H
-
-/*
- * These two _must_ execute atomically wrt each other.
- */
-static inline void wake_one_more(struct semaphore * sem)
-{
-       unsigned long flags;
-
-       spin_lock_irqsave(&semaphore_wake_lock, flags);
-       if (atomic_read(&sem->count) <= 0)
-               sem->waking++;
-       spin_unlock_irqrestore(&semaphore_wake_lock, flags);
-}
-
-static inline int waking_non_zero(struct semaphore *sem)
-{
-       unsigned long flags;
-       int ret = 0;
-
-       spin_lock_irqsave(&semaphore_wake_lock, flags);
-       if (sem->waking > 0) {
-               sem->waking--;
-               ret = 1;
-       }
-       spin_unlock_irqrestore(&semaphore_wake_lock, flags);
-       return ret;
-}
-
-/*
- * waking non zero interruptible
- *     1       got the lock
- *     0       go to sleep
- *     -EINTR  interrupted
- *
- * We must undo the sem->count down_interruptible() increment while we are
- * protected by the spinlock in order to make this atomic_inc() with the
- * atomic_read() in wake_one_more(), otherwise we can race. -arca
- */
-static inline int waking_non_zero_interruptible(struct semaphore *sem,
-                                               struct task_struct *tsk)
-{
-       unsigned long flags;
-       int ret = 0;
-
-       spin_lock_irqsave(&semaphore_wake_lock, flags);
-       if (sem->waking > 0) {
-               sem->waking--;
-               ret = 1;
-       } else if (signal_pending(tsk)) {
-               atomic_inc(&sem->count);
-               ret = -EINTR;
-       }
-       spin_unlock_irqrestore(&semaphore_wake_lock, flags);
-       return ret;     
-}
-
-/*
- * waking_non_zero_try_lock:
- *     1       failed to lock
- *     0       got the lock
- *
- * We must undo the sem->count down_interruptible() increment while we are
- * protected by the spinlock in order to make this atomic_inc() with the
- * atomic_read() in wake_one_more(), otherwise we can race. -arca
- */
-static inline int waking_non_zero_trylock(struct semaphore *sem)
-{
-       unsigned long flags;
-       int ret = 1;
-
-       spin_lock_irqsave(&semaphore_wake_lock, flags);
-       if (sem->waking <= 0)
-               atomic_inc(&sem->count);
-       else {
-               sem->waking--;
-               ret = 0;
-       }
-       spin_unlock_irqrestore(&semaphore_wake_lock, flags);
-       return ret;
-}
-
-#endif
diff --git a/include/asm-arm26/semaphore.h b/include/asm-arm26/semaphore.h
deleted file mode 100644 (file)
index 1fda543..0000000
+++ /dev/null
@@ -1,100 +0,0 @@
-/*
- * linux/include/asm-arm26/semaphore.h
- */
-#ifndef __ASM_ARM_SEMAPHORE_H
-#define __ASM_ARM_SEMAPHORE_H
-
-#include <linux/linkage.h>
-#include <linux/spinlock.h>
-#include <linux/wait.h>
-#include <linux/rwsem.h>
-
-#include <asm/atomic.h>
-#include <asm/locks.h>
-
-struct semaphore {
-       atomic_t count;
-       int sleepers;
-       wait_queue_head_t wait;
-};
-
-#define __SEMAPHORE_INIT(name, n)                                      \
-{                                                                      \
-       .count          = ATOMIC_INIT(n),                               \
-       .sleepers       = 0,                                            \
-       .wait           = __WAIT_QUEUE_HEAD_INITIALIZER((name).wait),   \
-}
-
-#define __DECLARE_SEMAPHORE_GENERIC(name,count)        \
-       struct semaphore name = __SEMAPHORE_INIT(name,count)
-
-#define DECLARE_MUTEX(name)            __DECLARE_SEMAPHORE_GENERIC(name,1)
-#define DECLARE_MUTEX_LOCKED(name)     __DECLARE_SEMAPHORE_GENERIC(name,0)
-
-static inline void sema_init(struct semaphore *sem, int val)
-{
-       atomic_set(&sem->count, val);
-       sem->sleepers = 0;
-       init_waitqueue_head(&sem->wait);
-}
-
-static inline void init_MUTEX(struct semaphore *sem)
-{
-       sema_init(sem, 1);
-}
-
-static inline void init_MUTEX_LOCKED(struct semaphore *sem)
-{
-       sema_init(sem, 0);
-}
-
-/*
- * special register calling convention
- */
-asmlinkage void __down_failed(void);
-asmlinkage int  __down_interruptible_failed(void);
-asmlinkage int  __down_trylock_failed(void);
-asmlinkage void __up_wakeup(void);
-
-extern void __down(struct semaphore * sem);
-extern int  __down_interruptible(struct semaphore * sem);
-extern int  __down_trylock(struct semaphore * sem);
-extern void __up(struct semaphore * sem);
-
-/*
- * This is ugly, but we want the default case to fall through.
- * "__down" is the actual routine that waits...
- */
-static inline void down(struct semaphore * sem)
-{
-       might_sleep();
-       __down_op(sem, __down_failed);
-}
-
-/*
- * This is ugly, but we want the default case to fall through.
- * "__down_interruptible" is the actual routine that waits...
- */
-static inline int down_interruptible (struct semaphore * sem)
-{
-       might_sleep();
-       return __down_op_ret(sem, __down_interruptible_failed);
-}
-
-static inline int down_trylock(struct semaphore *sem)
-{
-       return __down_op_ret(sem, __down_trylock_failed);
-}
-
-/*
- * Note! This is subtle. We jump to wake people up only if
- * the semaphore was negative (== somebody was waiting on it).
- * The default case (no contention) will result in NO
- * jumps for both down() and up().
- */
-static inline void up(struct semaphore * sem)
-{
-       __up_op(sem, __up_wakeup);
-}
-
-#endif
diff --git a/include/asm-arm26/sembuf.h b/include/asm-arm26/sembuf.h
deleted file mode 100644 (file)
index 1c02839..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-#ifndef _ASMARM_SEMBUF_H
-#define _ASMARM_SEMBUF_H
-
-/* 
- * The semid64_ds structure for arm architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct semid64_ds {
-       struct ipc64_perm sem_perm;             /* permissions .. see ipc.h */
-       __kernel_time_t sem_otime;              /* last semop time */
-       unsigned long   __unused1;
-       __kernel_time_t sem_ctime;              /* last change time */
-       unsigned long   __unused2;
-       unsigned long   sem_nsems;              /* no. of semaphores in array */
-       unsigned long   __unused3;
-       unsigned long   __unused4;
-};
-
-#endif /* _ASMARM_SEMBUF_H */
diff --git a/include/asm-arm26/serial.h b/include/asm-arm26/serial.h
deleted file mode 100644 (file)
index dd86a71..0000000
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- *  linux/include/asm-arm/serial.h
- *
- *  Copyright (C) 1996 Russell King.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Changelog:
- *   15-10-1996        RMK     Created
- */
-
-#ifndef __ASM_SERIAL_H
-#define __ASM_SERIAL_H
-
-
-/*
- * This assumes you have a 1.8432 MHz clock for your UART.
- *
- * It'd be nice if someone built a serial card with a 24.576 MHz
- * clock, since the 16550A is capable of handling a top speed of 1.5
- * megabits/second; but this requires the faster clock.
- */
-#define BASE_BAUD (1843200 / 16)
-
-#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
-
-#if defined(CONFIG_ARCH_A5K)
-     /* UART CLK        PORT  IRQ     FLAGS        */
-
-#define SERIAL_PORT_DFNS                                                \
-        { 0, BASE_BAUD, 0x3F8, 10, STD_COM_FLAGS },     /* ttyS0 */     \
-        { 0, BASE_BAUD, 0x2F8, 10, STD_COM_FLAGS },     /* ttyS1 */
-
-#else
-
-#define SERIAL_PORT_DFNS                                                \
-        { 0, BASE_BAUD, 0    ,  0, STD_COM_FLAGS },     /* ttyS0 */     \
-        { 0, BASE_BAUD, 0    ,  0, STD_COM_FLAGS },     /* ttyS1 */
-
-#endif
-
-#endif
diff --git a/include/asm-arm26/setup.h b/include/asm-arm26/setup.h
deleted file mode 100644 (file)
index e825623..0000000
+++ /dev/null
@@ -1,209 +0,0 @@
-/*
- *  linux/include/asm/setup.h
- *
- *  Copyright (C) 1997-1999 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Structure passed to kernel to tell it about the
- *  hardware it's running on.  See Documentation/arm/Setup
- *  for more info.
- */
-#ifndef __ASMARM_SETUP_H
-#define __ASMARM_SETUP_H
-
-#define COMMAND_LINE_SIZE 1024
-
-#ifdef __KERNEL__
-
-/* The list ends with an ATAG_NONE node. */
-#define ATAG_NONE      0x00000000
-
-struct tag_header {
-       u32 size;
-       u32 tag;
-};
-
-/* The list must start with an ATAG_CORE node */
-#define ATAG_CORE      0x54410001
-
-struct tag_core {
-       u32 flags;              /* bit 0 = read-only */
-       u32 pagesize;
-       u32 rootdev;
-};
-
-/* it is allowed to have multiple ATAG_MEM nodes */
-#define ATAG_MEM       0x54410002
-
-struct tag_mem32 {
-       u32     size;
-       u32     start;  /* physical start address */
-};
-
-/* VGA text type displays */
-#define ATAG_VIDEOTEXT 0x54410003
-
-struct tag_videotext {
-       u8              x;
-       u8              y;
-       u16             video_page;
-       u8              video_mode;
-       u8              video_cols;
-       u16             video_ega_bx;
-       u8              video_lines;
-       u8              video_isvga;
-       u16             video_points;
-};
-
-/* describes how the ramdisk will be used in kernel */
-#define ATAG_RAMDISK   0x54410004
-
-struct tag_ramdisk {
-       u32 flags;      /* bit 0 = load, bit 1 = prompt */
-       u32 size;       /* decompressed ramdisk size in _kilo_ bytes */
-       u32 start;      /* starting block of floppy-based RAM disk image */
-};
-
-/* describes where the compressed ramdisk image lives */
-/*
- * this one accidentally used virtual addresses - as such,
- * it's deprecated.
- */
-#define ATAG_INITRD    0x54410005
-
-/* describes where the compressed ramdisk image lives */
-#define ATAG_INITRD2   0x54420005
-
-struct tag_initrd {
-       u32 start;      /* physical start address */
-       u32 size;       /* size of compressed ramdisk image in bytes */
-};
-
-/* board serial number. "64 bits should be enough for everybody" */
-#define ATAG_SERIAL    0x54410006
-
-struct tag_serialnr {
-       u32 low;
-       u32 high;
-};
-
-/* board revision */
-#define ATAG_REVISION  0x54410007
-
-struct tag_revision {
-       u32 rev;
-};
-
-/* initial values for vesafb-type framebuffers. see struct screen_info
- * in include/linux/tty.h
- */
-#define ATAG_VIDEOLFB  0x54410008
-
-struct tag_videolfb {
-       u16             lfb_width;
-       u16             lfb_height;
-       u16             lfb_depth;
-       u16             lfb_linelength;
-       u32             lfb_base;
-       u32             lfb_size;
-       u8              red_size;
-       u8              red_pos;
-       u8              green_size;
-       u8              green_pos;
-       u8              blue_size;
-       u8              blue_pos;
-       u8              rsvd_size;
-       u8              rsvd_pos;
-};
-
-/* command line: \0 terminated string */
-#define ATAG_CMDLINE   0x54410009
-
-struct tag_cmdline {
-       char    cmdline[1];     /* this is the minimum size */
-};
-
-/* acorn RiscPC specific information */
-#define ATAG_ACORN     0x41000101
-
-struct tag_acorn {
-       u32 memc_control_reg;
-       u32 vram_pages;
-       u8 sounddefault;
-       u8 adfsdrives;
-};
-
-/* footbridge memory clock, see arch/arm/mach-footbridge/arch.c */
-#define ATAG_MEMCLK    0x41000402
-
-struct tag_memclk {
-       u32 fmemclk;
-};
-
-struct tag {
-       struct tag_header hdr;
-       union {
-               struct tag_core         core;
-               struct tag_mem32        mem;
-               struct tag_videotext    videotext;
-               struct tag_ramdisk      ramdisk;
-               struct tag_initrd       initrd;
-               struct tag_serialnr     serialnr;
-               struct tag_revision     revision;
-               struct tag_videolfb     videolfb;
-               struct tag_cmdline      cmdline;
-
-               /*
-                * Acorn specific
-                */
-               struct tag_acorn        acorn;
-
-               /*
-                * DC21285 specific
-                */
-               struct tag_memclk       memclk;
-       } u;
-};
-
-struct tagtable {
-       u32 tag;
-       int (*parse)(const struct tag *);
-};
-
-#define __tag __used __attribute__((__section__(".taglist")))
-#define __tagtable(tag, fn) \
-static struct tagtable __tagtable_##fn __tag = { tag, fn }
-
-#define tag_member_present(tag,member)                         \
-       ((unsigned long)(&((struct tag *)0L)->member + 1)       \
-               <= (tag)->hdr.size * 4)
-
-#define tag_next(t)    ((struct tag *)((u32 *)(t) + (t)->hdr.size))
-#define tag_size(type) ((sizeof(struct tag_header) + sizeof(struct type)) >> 2)
-
-#define for_each_tag(t,base)           \
-       for (t = base; t->hdr.size; t = tag_next(t))
-
-/*
- * Memory map description
- */
-#define NR_BANKS 8
-
-struct meminfo {
-       int nr_banks;
-       unsigned long end;
-       struct {
-               unsigned long start;
-               unsigned long size;
-               int           node;
-       } bank[NR_BANKS];
-};
-
-extern struct meminfo meminfo;
-
-#endif  /*  __KERNEL__  */
-
-#endif
diff --git a/include/asm-arm26/shmbuf.h b/include/asm-arm26/shmbuf.h
deleted file mode 100644 (file)
index 2e5c67b..0000000
+++ /dev/null
@@ -1,42 +0,0 @@
-#ifndef _ASMARM_SHMBUF_H
-#define _ASMARM_SHMBUF_H
-
-/* 
- * The shmid64_ds structure for arm architecture.
- * Note extra padding because this structure is passed back and forth
- * between kernel and user space.
- *
- * Pad space is left for:
- * - 64-bit time_t to solve y2038 problem
- * - 2 miscellaneous 32-bit values
- */
-
-struct shmid64_ds {
-       struct ipc64_perm       shm_perm;       /* operation perms */
-       size_t                  shm_segsz;      /* size of segment (bytes) */
-       __kernel_time_t         shm_atime;      /* last attach time */
-       unsigned long           __unused1;
-       __kernel_time_t         shm_dtime;      /* last detach time */
-       unsigned long           __unused2;
-       __kernel_time_t         shm_ctime;      /* last change time */
-       unsigned long           __unused3;
-       __kernel_pid_t          shm_cpid;       /* pid of creator */
-       __kernel_pid_t          shm_lpid;       /* pid of last operator */
-       unsigned long           shm_nattch;     /* no. of current attaches */
-       unsigned long           __unused4;
-       unsigned long           __unused5;
-};
-
-struct shminfo64 {
-       unsigned long   shmmax;
-       unsigned long   shmmin;
-       unsigned long   shmmni;
-       unsigned long   shmseg;
-       unsigned long   shmall;
-       unsigned long   __unused1;
-       unsigned long   __unused2;
-       unsigned long   __unused3;
-       unsigned long   __unused4;
-};
-
-#endif /* _ASMARM_SHMBUF_H */
diff --git a/include/asm-arm26/shmparam.h b/include/asm-arm26/shmparam.h
deleted file mode 100644 (file)
index d374868..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-#ifndef _ASMARM_SHMPARAM_H
-#define _ASMARM_SHMPARAM_H
-
-#ifndef SHMMAX
-#define SHMMAX          0x003fa000
-#endif
-
-/*
- * This should be the size of the virtually indexed cache/ways,
- * or page size, whichever is greater since the cache aliases
- * every size/ways bytes.
- */
-#define        SHMLBA PAGE_SIZE                 /* attach addr a multiple of this */
-
-#endif /* _ASMARM_SHMPARAM_H */
diff --git a/include/asm-arm26/sigcontext.h b/include/asm-arm26/sigcontext.h
deleted file mode 100644 (file)
index 013ad20..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-#ifndef _ASMARM_SIGCONTEXT_H
-#define _ASMARM_SIGCONTEXT_H
-
-/*
- * Signal context structure - contains all info to do with the state
- * before the signal handler was invoked.  Note: only add new entries
- * to the end of the structure.
- */
-struct sigcontext {
-       unsigned long trap_no;
-       unsigned long error_code;
-       unsigned long oldmask;
-       unsigned long arm_r0;
-       unsigned long arm_r1;
-       unsigned long arm_r2;
-       unsigned long arm_r3;
-       unsigned long arm_r4;
-       unsigned long arm_r5;
-       unsigned long arm_r6;
-       unsigned long arm_r7;
-       unsigned long arm_r8;
-       unsigned long arm_r9;
-       unsigned long arm_r10;
-       unsigned long arm_fp;
-       unsigned long arm_ip;
-       unsigned long arm_sp;
-       unsigned long arm_lr;
-       unsigned long arm_pc;
-       unsigned long fault_address;
-};
-
-
-#endif
diff --git a/include/asm-arm26/siginfo.h b/include/asm-arm26/siginfo.h
deleted file mode 100644 (file)
index 5e21852..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASMARM_SIGINFO_H
-#define _ASMARM_SIGINFO_H
-
-#include <asm-generic/siginfo.h>
-
-#endif
diff --git a/include/asm-arm26/signal.h b/include/asm-arm26/signal.h
deleted file mode 100644 (file)
index 967ba49..0000000
+++ /dev/null
@@ -1,176 +0,0 @@
-#ifndef _ASMARM_SIGNAL_H
-#define _ASMARM_SIGNAL_H
-
-#include <linux/types.h>
-
-/* Avoid too many header ordering problems.  */
-struct siginfo;
-
-#ifdef __KERNEL__
-/* Most things should be clean enough to redefine this at will, if care
-   is taken to make libc match.  */
-
-#define _NSIG          64
-#define _NSIG_BPW      32
-#define _NSIG_WORDS    (_NSIG / _NSIG_BPW)
-
-typedef unsigned long old_sigset_t;            /* at least 32 bits */
-
-typedef struct {
-       unsigned long sig[_NSIG_WORDS];
-} sigset_t;
-
-#else
-/* Here we must cater to libcs that poke about in kernel headers.  */
-
-#define NSIG           32
-typedef unsigned long sigset_t;
-
-#endif /* __KERNEL__ */
-
-#define SIGHUP          1
-#define SIGINT          2
-#define SIGQUIT                 3
-#define SIGILL          4
-#define SIGTRAP                 5
-#define SIGABRT                 6
-#define SIGIOT          6
-#define SIGBUS          7
-#define SIGFPE          8
-#define SIGKILL                 9
-#define SIGUSR1                10
-#define SIGSEGV                11
-#define SIGUSR2                12
-#define SIGPIPE                13
-#define SIGALRM                14
-#define SIGTERM                15
-#define SIGSTKFLT      16
-#define SIGCHLD                17
-#define SIGCONT                18
-#define SIGSTOP                19
-#define SIGTSTP                20
-#define SIGTTIN                21
-#define SIGTTOU                22
-#define SIGURG         23
-#define SIGXCPU                24
-#define SIGXFSZ                25
-#define SIGVTALRM      26
-#define SIGPROF                27
-#define SIGWINCH       28
-#define SIGIO          29
-#define SIGPOLL                SIGIO
-/*
-#define SIGLOST                29
-*/
-#define SIGPWR         30
-#define SIGSYS         31
-#define        SIGUNUSED       31
-
-/* These should not be considered constants from userland.  */
-#define SIGRTMIN       32
-#define SIGRTMAX       _NSIG
-
-#define SIGSWI         32
-
-/*
- * SA_FLAGS values:
- *
- * SA_NOCLDSTOP                flag to turn off SIGCHLD when children stop.
- * SA_NOCLDWAIT                flag on SIGCHLD to inhibit zombies.
- * SA_SIGINFO          deliver the signal with SIGINFO structs
- * SA_THIRTYTWO                delivers the signal in 32-bit mode, even if the task 
- *                     is running in 26-bit.
- * SA_ONSTACK          allows alternate signal stacks (see sigaltstack(2)).
- * SA_RESTART          flag to get restarting signals (which were the default long ago)
- * SA_NODEFER          prevents the current signal from being masked in the handler.
- * SA_RESETHAND                clears the handler when the signal is delivered.
- *
- * SA_ONESHOT and SA_NOMASK are the historical Linux names for the Single
- * Unix names RESETHAND and NODEFER respectively.
- */
-#define SA_NOCLDSTOP   0x00000001
-#define SA_NOCLDWAIT   0x00000002 /* not supported yet */
-#define SA_SIGINFO     0x00000004
-#define SA_THIRTYTWO   0x02000000
-#define SA_RESTORER    0x04000000
-#define SA_ONSTACK     0x08000000
-#define SA_RESTART     0x10000000
-#define SA_NODEFER     0x40000000
-#define SA_RESETHAND   0x80000000
-
-#define SA_NOMASK      SA_NODEFER
-#define SA_ONESHOT     SA_RESETHAND
-
-
-/* 
- * sigaltstack controls
- */
-#define SS_ONSTACK     1
-#define SS_DISABLE     2
-
-#define MINSIGSTKSZ    2048
-#define SIGSTKSZ       8192
-
-#ifdef __KERNEL__
-#define SA_IRQNOMASK           0x08000000
-#endif
-
-#include <asm-generic/signal.h>
-
-#ifdef __KERNEL__
-struct old_sigaction {
-       __sighandler_t sa_handler;
-       old_sigset_t sa_mask;
-       unsigned long sa_flags;
-       void (*sa_restorer)(void);
-};
-
-struct sigaction {
-       __sighandler_t sa_handler;
-       unsigned long sa_flags;
-       void (*sa_restorer)(void);
-       sigset_t sa_mask;               /* mask last for extensibility */
-};
-
-struct k_sigaction {
-       struct sigaction sa;
-};
-
-#else
-/* Here we must cater to libcs that poke about in kernel headers.  */
-
-struct sigaction {
-       union {
-         __sighandler_t _sa_handler;
-         void (*_sa_sigaction)(int, struct siginfo *, void *);
-       } _u;
-       sigset_t sa_mask;
-       unsigned long sa_flags;
-       void (*sa_restorer)(void);
-};
-
-#define sa_handler     _u._sa_handler
-#define sa_sigaction   _u._sa_sigaction
-
-#endif /* __KERNEL__ */
-
-typedef struct sigaltstack {
-       void *ss_sp;
-       int ss_flags;
-       size_t ss_size;
-} stack_t;
-
-#ifdef __KERNEL__
-#include <asm/sigcontext.h>
-
-#define sigmask(sig)   (1UL << ((sig) - 1))
-#endif
-
-
-#ifdef __KERNEL__
-#include <asm/sigcontext.h>
-#define ptrace_signal_deliver(regs, cookie) do { } while (0)
-#endif
-
-
-#endif
diff --git a/include/asm-arm26/sizes.h b/include/asm-arm26/sizes.h
deleted file mode 100644 (file)
index f8d92ca..0000000
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
- */
-/* DO NOT EDIT!! - this file automatically generated
- *                 from .s file by awk -f s2h.awk
- */
-/*  Size defintions
- *  Copyright (C) ARM Limited 1998. All rights reserved.
- */
-
-#ifndef __sizes_h
-#define __sizes_h                       1
-
-/* handy sizes */
-#define SZ_1K                           0x00000400
-#define SZ_4K                           0x00001000
-#define SZ_8K                           0x00002000
-#define SZ_16K                          0x00004000
-#define SZ_64K                          0x00010000
-#define SZ_128K                         0x00020000
-#define SZ_256K                         0x00040000
-#define SZ_512K                         0x00080000
-
-#define SZ_1M                           0x00100000
-#define SZ_2M                           0x00200000
-#define SZ_4M                           0x00400000
-#define SZ_8M                           0x00800000
-#define SZ_16M                          0x01000000
-#define SZ_32M                          0x02000000
-#define SZ_64M                          0x04000000
-#define SZ_128M                         0x08000000
-#define SZ_256M                         0x10000000
-#define SZ_512M                         0x20000000
-
-#define SZ_1G                           0x40000000
-#define SZ_2G                           0x80000000
-
-#endif
-
-/*         END */
diff --git a/include/asm-arm26/smp.h b/include/asm-arm26/smp.h
deleted file mode 100644 (file)
index 38349ec..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-#ifndef __ASM_SMP_H
-#define __ASM_SMP_H
-
-
-#ifdef CONFIG_SMP
-#error SMP not supported
-#endif
-
-#endif
diff --git a/include/asm-arm26/socket.h b/include/asm-arm26/socket.h
deleted file mode 100644 (file)
index 65a1a64..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-#ifndef _ASMARM_SOCKET_H
-#define _ASMARM_SOCKET_H
-
-#include <asm/sockios.h>
-
-/* For setsockopt(2) */
-#define SOL_SOCKET     1
-
-#define SO_DEBUG       1
-#define SO_REUSEADDR   2
-#define SO_TYPE                3
-#define SO_ERROR       4
-#define SO_DONTROUTE   5
-#define SO_BROADCAST   6
-#define SO_SNDBUF      7
-#define SO_RCVBUF      8
-#define SO_SNDBUFFORCE 32
-#define SO_RCVBUFFORCE 33
-#define SO_KEEPALIVE   9
-#define SO_OOBINLINE   10
-#define SO_NO_CHECK    11
-#define SO_PRIORITY    12
-#define SO_LINGER      13
-#define SO_BSDCOMPAT   14
-/* To add :#define SO_REUSEPORT 15 */
-#define SO_PASSCRED    16
-#define SO_PEERCRED    17
-#define SO_RCVLOWAT    18
-#define SO_SNDLOWAT    19
-#define SO_RCVTIMEO    20
-#define SO_SNDTIMEO    21
-
-/* Security levels - as per NRL IPv6 - don't actually do anything */
-#define SO_SECURITY_AUTHENTICATION             22
-#define SO_SECURITY_ENCRYPTION_TRANSPORT       23
-#define SO_SECURITY_ENCRYPTION_NETWORK         24
-
-#define SO_BINDTODEVICE 25
-
-/* Socket filtering */
-#define SO_ATTACH_FILTER        26
-#define SO_DETACH_FILTER        27
-
-#define SO_PEERNAME             28
-#define SO_TIMESTAMP           29
-#define SCM_TIMESTAMP          SO_TIMESTAMP
-
-#define SO_ACCEPTCONN          30
-
-#define SO_PEERSEC             31
-#define SO_PASSSEC             34
-#define SO_TIMESTAMPNS         35
-#define SCM_TIMESTAMPNS                SO_TIMESTAMPNS
-
-#endif /* _ASM_SOCKET_H */
diff --git a/include/asm-arm26/sockios.h b/include/asm-arm26/sockios.h
deleted file mode 100644 (file)
index a2588a2..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-#ifndef __ARCH_ARM_SOCKIOS_H
-#define __ARCH_ARM_SOCKIOS_H
-
-/* Socket-level I/O control calls. */
-#define FIOSETOWN      0x8901
-#define SIOCSPGRP      0x8902
-#define FIOGETOWN      0x8903
-#define SIOCGPGRP      0x8904
-#define SIOCATMARK     0x8905
-#define SIOCGSTAMP     0x8906          /* Get stamp (timeval) */
-#define SIOCGSTAMPNS   0x8907          /* Get stamp (timespec) */
-
-#endif
diff --git a/include/asm-arm26/spinlock.h b/include/asm-arm26/spinlock.h
deleted file mode 100644 (file)
index e92e81d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef __ASM_SPINLOCK_H
-#define __ASM_SPINLOCK_H
-
-#error ARM architecture does not support SMP spin locks
-
-#endif /* __ASM_SPINLOCK_H */
diff --git a/include/asm-arm26/stat.h b/include/asm-arm26/stat.h
deleted file mode 100644 (file)
index e4abc4f..0000000
+++ /dev/null
@@ -1,77 +0,0 @@
-#ifndef _ASMARM_STAT_H
-#define _ASMARM_STAT_H
-
-struct __old_kernel_stat {
-       unsigned short st_dev;
-       unsigned short st_ino;
-       unsigned short st_mode;
-       unsigned short st_nlink;
-       unsigned short st_uid;
-       unsigned short st_gid;
-       unsigned short st_rdev;
-       unsigned long  st_size;
-       unsigned long  st_atime;
-       unsigned long  st_mtime;
-       unsigned long  st_ctime;
-};
-
-struct stat {
-       unsigned short st_dev;
-       unsigned short __pad1;
-       unsigned long st_ino;
-       unsigned short st_mode;
-       unsigned short st_nlink;
-       unsigned short st_uid;
-       unsigned short st_gid;
-       unsigned short st_rdev;
-       unsigned short __pad2;
-       unsigned long  st_size;
-       unsigned long  st_blksize;
-       unsigned long  st_blocks;
-       unsigned long  st_atime;
-       unsigned long  st_atime_nsec;
-       unsigned long  st_mtime;
-       unsigned long  st_mtime_nsec;
-       unsigned long  st_ctime;
-       unsigned long  st_ctime_nsec;
-       unsigned long  __unused4;
-       unsigned long  __unused5;
-};
-
-/* This matches struct stat64 in glibc2.1, hence the absolutely
- * insane amounts of padding around dev_t's.
- */
-struct stat64 {
-       unsigned long long  st_dev;
-       unsigned char   __pad0[4];
-
-#define STAT64_HAS_BROKEN_ST_INO       1
-       unsigned long   __st_ino;
-       unsigned int    st_mode;
-       unsigned int    st_nlink;
-
-       unsigned long   st_uid;
-       unsigned long   st_gid;
-
-       unsigned long long  st_rdev;
-       unsigned char   __pad3[4];
-
-       long long       st_size;
-       unsigned long   st_blksize;
-
-       unsigned long   st_blocks;      /* Number 512-byte blocks allocated. */
-       unsigned long   __pad4;         /* Future possible st_blocks hi bits */
-
-       unsigned long   st_atime;
-       unsigned long   st_atime_nsec;
-
-       unsigned long   st_mtime;
-       unsigned long   st_mtime_nsec;
-
-       unsigned long   st_ctime;
-       unsigned long   st_ctime_nsec;
-
-       unsigned long long      st_ino;
-};
-
-#endif
diff --git a/include/asm-arm26/statfs.h b/include/asm-arm26/statfs.h
deleted file mode 100644 (file)
index 776dbc8..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#ifndef _ASMARM_STATFS_H
-#define _ASMARM_STATFS_H
-
-//FIXME - this may not be appropriate for arm26. check it out.
-
-#include <asm-generic/statfs.h>
-
-#endif
diff --git a/include/asm-arm26/string.h b/include/asm-arm26/string.h
deleted file mode 100644 (file)
index 2a8ab16..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-#ifndef __ASM_ARM_STRING_H
-#define __ASM_ARM_STRING_H
-
-/*
- * We don't do inline string functions, since the
- * optimised inline asm versions are not small.
- */
-
-#define __HAVE_ARCH_STRRCHR
-extern char * strrchr(const char * s, int c);
-
-#define __HAVE_ARCH_STRCHR
-extern char * strchr(const char * s, int c);
-
-#define __HAVE_ARCH_MEMCPY
-extern void * memcpy(void *, const void *, __kernel_size_t);
-
-#define __HAVE_ARCH_MEMMOVE
-extern void * memmove(void *, const void *, __kernel_size_t);
-
-#define __HAVE_ARCH_MEMCHR
-extern void * memchr(const void *, int, __kernel_size_t);
-
-#define __HAVE_ARCH_MEMZERO
-#define __HAVE_ARCH_MEMSET
-extern void * memset(void *, int, __kernel_size_t);
-
-extern void __memzero(void *ptr, __kernel_size_t n);
-
-#define memset(p,v,n)                                                  \
-       ({                                                              \
-               if ((n) != 0) {                                         \
-                       if (__builtin_constant_p((v)) && (v) == 0)      \
-                               __memzero((p),(n));                     \
-                       else                                            \
-                               memset((p),(v),(n));                    \
-               }                                                       \
-               (p);                                                    \
-       })
-
-#define memzero(p,n) ({ if ((n) != 0) __memzero((p),(n)); (p); })
-
-#endif
diff --git a/include/asm-arm26/suspend.h b/include/asm-arm26/suspend.h
deleted file mode 100644 (file)
index 5e4c1cc..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-#ifdef _ASMARM_SUSPEND_H
-#define _ASMARM_SUSPEND_H
-
-#endif
diff --git a/include/asm-arm26/sysirq.h b/include/asm-arm26/sysirq.h
deleted file mode 100644 (file)
index 81dca90..0000000
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-arc/irqs.h
- *
- *  Copyright (C) 1996 Russell King, Dave Gilbert
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Modifications:
- *   04-04-1998 PJB     Merged arc and a5k versions
- */
-
-
-#if defined(CONFIG_ARCH_A5K)
-#define IRQ_PRINTER             0
-#define IRQ_BATLOW              1
-#define IRQ_FLOPPYINDEX         2
-#define IRQ_FLOPPYDISK          12
-#elif defined(CONFIG_ARCH_ARC)
-#define IRQ_PRINTERBUSY         0
-#define IRQ_SERIALRING          1
-#define IRQ_PRINTERACK          2
-#define IRQ_FLOPPYCHANGED       12
-#endif
-
-#define IRQ_VSYNCPULSE          3
-#define IRQ_POWERON             4
-#define IRQ_TIMER0              5
-#define IRQ_TIMER1              6
-#define IRQ_IMMEDIATE           7
-#define IRQ_EXPCARDFIQ          8
-#define IRQ_SOUNDCHANGE         9
-#define IRQ_SERIALPORT          10
-#define IRQ_HARDDISK            11
-#define IRQ_EXPANSIONCARD       13
-#define IRQ_KEYBOARDTX          14
-#define IRQ_KEYBOARDRX          15
-
-#if defined(CONFIG_ARCH_A5K)
-#define FIQ_SERIALPORT          4
-#elif defined(CONFIG_ARCH_ARC)
-#define FIQ_FLOPPYIRQ           1
-#define FIQ_FD1772              FIQ_FLOPPYIRQ
-#endif
-
-#define FIQ_FLOPPYDATA          0
-#define FIQ_ECONET              2
-#define FIQ_EXPANSIONCARD       6
-#define FIQ_FORCE               7
-
-#define IRQ_TIMER               IRQ_TIMER0
-
-/*
- * This is the offset of the FIQ "IRQ" numbers
- */
-#define FIQ_START               64
-
-#define irq_cannonicalize(i)    (i)
-
diff --git a/include/asm-arm26/system.h b/include/asm-arm26/system.h
deleted file mode 100644 (file)
index e09da5f..0000000
+++ /dev/null
@@ -1,247 +0,0 @@
-#ifndef __ASM_ARM_SYSTEM_H
-#define __ASM_ARM_SYSTEM_H
-
-#ifdef __KERNEL__
-
-
-/*
- * This is used to ensure the compiler did actually allocate the register we
- * asked it for some inline assembly sequences.  Apparently we can't trust
- * the compiler from one version to another so a bit of paranoia won't hurt.
- * This string is meant to be concatenated with the inline asm string and
- * will cause compilation to stop on mismatch. (From ARM32 - may come in handy)
- */
-#define __asmeq(x, y)  ".ifnc " x "," y " ; .err ; .endif\n\t"
-
-#ifndef __ASSEMBLY__
-
-#include <linux/linkage.h>
-
-struct thread_info;
-struct task_struct;
-
-#if 0
-/* information about the system we're running on */
-extern unsigned int system_rev;
-extern unsigned int system_serial_low;
-extern unsigned int system_serial_high;
-extern unsigned int mem_fclk_21285;
-
-FIXME - sort this
-/*
- * We need to turn the caches off before calling the reset vector - RiscOS
- * messes up if we don't
- */
-#define proc_hard_reset()       cpu_proc_fin()
-
-#endif
-
-struct pt_regs;
-
-void die(const char *msg, struct pt_regs *regs, int err)
-               __attribute__((noreturn));
-
-void die_if_kernel(const char *str, struct pt_regs *regs, int err);
-
-void hook_fault_code(int nr, int (*fn)(unsigned long, unsigned int,
-                                      struct pt_regs *),
-                    int sig, const char *name);
-
-#include <asm/proc-fns.h>
-
-#define xchg(ptr,x) \
-       ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
-
-extern asmlinkage void __backtrace(void);
-
-#define set_cr(x)                                      \
-       __asm__ __volatile__(                           \
-       "mcr    p15, 0, %0, c1, c0, 0   @ set CR"       \
-       : : "r" (x) : "cc")
-
-#define get_cr()                                       \
-       ({                                              \
-       unsigned int __val;                             \
-       __asm__ __volatile__(                           \
-       "mrc    p15, 0, %0, c1, c0, 0   @ get CR"       \
-       : "=r" (__val) : : "cc");                       \
-       __val;                                          \
-       })
-
-extern unsigned long cr_no_alignment;  /* defined in entry-armv.S */
-extern unsigned long cr_alignment;     /* defined in entry-armv.S */
-
-#define UDBG_UNDEFINED (1 << 0)
-#define UDBG_SYSCALL   (1 << 1)
-#define UDBG_BADABORT  (1 << 2)
-#define UDBG_SEGV      (1 << 3)
-#define UDBG_BUS       (1 << 4)
-
-extern unsigned int user_debug;
-
-#define vectors_base() (0)
-
-#define mb() __asm__ __volatile__ ("" : : : "memory")
-#define rmb() mb()
-#define wmb() mb()
-#define nop() __asm__ __volatile__("mov\tr0,r0\t@ nop\n\t");
-
-#define read_barrier_depends() do { } while(0)
-#define set_mb(var, value)  do { var = value; mb(); } while (0)
-
-/*
- * We assume knowledge of how
- * spin_unlock_irq() and friends are implemented.  This avoids
- * us needlessly decrementing and incrementing the preempt count.
- */
-#define prepare_arch_switch(next)      local_irq_enable()
-#define finish_arch_switch(prev)       spin_unlock(&(rq)->lock)
-
-/*
- * switch_to(prev, next) should switch from task `prev' to `next'
- * `prev' will never be the same as `next'.  schedule() itself
- * contains the memory barrier to tell GCC not to cache `current'.
- */
-extern struct task_struct *__switch_to(struct task_struct *, struct thread_info *, struct thread_info *);
-
-#define switch_to(prev,next,last)                                      \
-do {                                                                   \
-       last = __switch_to(prev,task_thread_info(prev),task_thread_info(next)); \
-} while (0)
-
-/*
- * Save the current interrupt enable state & disable IRQs
- */
-#define local_irq_save(x)                               \
-        do {                                            \
-          unsigned long temp;                           \
-          __asm__ __volatile__(                         \
-"       mov     %0, pc          @ save_flags_cli\n"     \
-"       orr     %1, %0, #0x08000000\n"                  \
-"       and     %0, %0, #0x0c000000\n"                  \
-"       teqp    %1, #0\n"                               \
-          : "=r" (x), "=r" (temp)                       \
-          :                                             \
-          : "memory");                                  \
-        } while (0)
-
-/*
- * Enable IRQs  (sti)
- */
-#define local_irq_enable()                                      \
-        do {                                    \
-          unsigned long temp;                   \
-          __asm__ __volatile__(                 \
-"       mov     %0, pc          @ sti\n"        \
-"       bic     %0, %0, #0x08000000\n"          \
-"       teqp    %0, #0\n"                       \
-          : "=r" (temp)                         \
-          :                                     \
-          : "memory");                          \
-        } while(0)
-
-/*
- * Disable IRQs (cli)
- */
-#define local_irq_disable()                                     \
-        do {                                    \
-          unsigned long temp;                   \
-          __asm__ __volatile__(                 \
-"       mov     %0, pc          @ cli\n"        \
-"       orr     %0, %0, #0x08000000\n"          \
-"       teqp    %0, #0\n"                       \
-          : "=r" (temp)                         \
-          :                                     \
-          : "memory");                          \
-        } while(0)
-
-/* Enable FIQs (stf) */
-
-#define __stf() do {                            \
-        unsigned long temp;                     \
-        __asm__ __volatile__(                   \
-"       mov     %0, pc          @ stf\n"        \
-"       bic     %0, %0, #0x04000000\n"          \
-"       teqp    %0, #0\n"                       \
-        : "=r" (temp));                         \
-    } while(0)
-
-/* Disable FIQs  (clf) */
-
-#define __clf() do {                            \
-        unsigned long temp;                     \
-        __asm__ __volatile__(                   \
-"       mov     %0, pc          @ clf\n"        \
-"       orr     %0, %0, #0x04000000\n"          \
-"       teqp    %0, #0\n"                       \
-        : "=r" (temp));                         \
-    } while(0)
-
-
-/*
- * Save the current interrupt enable state.
- */
-#define local_save_flags(x)                             \
-        do {                                    \
-          __asm__ __volatile__(                 \
-"       mov     %0, pc          @ save_flags\n" \
-"       and     %0, %0, #0x0c000000\n"          \
-          : "=r" (x));                          \
-        } while (0)
-
-
-/*
- * restore saved IRQ & FIQ state
- */
-#define local_irq_restore(x)                            \
-        do {                                            \
-          unsigned long temp;                           \
-          __asm__ __volatile__(                         \
-"       mov     %0, pc          @ restore_flags\n"      \
-"       bic     %0, %0, #0x0c000000\n"                  \
-"       orr     %0, %0, %1\n"                           \
-"       teqp    %0, #0\n"                               \
-          : "=&r" (temp)                                \
-          : "r" (x)                                     \
-          : "memory");                                  \
-        } while (0)
-
-
-#ifdef CONFIG_SMP
-#error SMP not supported
-#endif
-
-#define smp_mb()               barrier()
-#define smp_rmb()              barrier()
-#define smp_wmb()              barrier()
-#define smp_read_barrier_depends()             do { } while(0)
-
-#define clf()                  __clf()
-#define stf()                  __stf()
-
-#define irqs_disabled()                        \
-({                                     \
-       unsigned long flags;            \
-       local_save_flags(flags);        \
-       flags & PSR_I_BIT;              \
-})
-
-static inline unsigned long __xchg(unsigned long x, volatile void *ptr, int size)
-{
-        extern void __bad_xchg(volatile void *, int);
-
-        switch (size) {
-                case 1: return cpu_xchg_1(x, ptr);
-                case 4: return cpu_xchg_4(x, ptr);
-                default: __bad_xchg(ptr, size);
-        }
-        return 0;
-}
-
-#endif /* __ASSEMBLY__ */
-
-#define arch_align_stack(x) (x)
-
-#endif /* __KERNEL__ */
-
-#endif
diff --git a/include/asm-arm26/termbits.h b/include/asm-arm26/termbits.h
deleted file mode 100644 (file)
index 48d2f5c..0000000
+++ /dev/null
@@ -1,196 +0,0 @@
-#ifndef __ASM_ARM_TERMBITS_H
-#define __ASM_ARM_TERMBITS_H
-
-typedef unsigned char  cc_t;
-typedef unsigned int   speed_t;
-typedef unsigned int   tcflag_t;
-
-#define NCCS 19
-struct termios {
-       tcflag_t c_iflag;               /* input mode flags */
-       tcflag_t c_oflag;               /* output mode flags */
-       tcflag_t c_cflag;               /* control mode flags */
-       tcflag_t c_lflag;               /* local mode flags */
-       cc_t c_line;                    /* line discipline */
-       cc_t c_cc[NCCS];                /* control characters */
-};
-
-struct termios2 {
-       tcflag_t c_iflag;               /* input mode flags */
-       tcflag_t c_oflag;               /* output mode flags */
-       tcflag_t c_cflag;               /* control mode flags */
-       tcflag_t c_lflag;               /* local mode flags */
-       cc_t c_line;                    /* line discipline */
-       cc_t c_cc[NCCS];                /* control characters */
-       speed_t c_ispeed;               /* input speed */
-       speed_t c_ospeed;               /* output speed */
-};
-
-struct ktermios {
-       tcflag_t c_iflag;               /* input mode flags */
-       tcflag_t c_oflag;               /* output mode flags */
-       tcflag_t c_cflag;               /* control mode flags */
-       tcflag_t c_lflag;               /* local mode flags */
-       cc_t c_line;                    /* line discipline */
-       cc_t c_cc[NCCS];                /* control characters */
-       speed_t c_ispeed;               /* input speed */
-       speed_t c_ospeed;               /* output speed */
-};
-
-/* c_cc characters */
-#define VINTR 0
-#define VQUIT 1
-#define VERASE 2
-#define VKILL 3
-#define VEOF 4
-#define VTIME 5
-#define VMIN 6
-#define VSWTC 7
-#define VSTART 8
-#define VSTOP 9
-#define VSUSP 10
-#define VEOL 11
-#define VREPRINT 12
-#define VDISCARD 13
-#define VWERASE 14
-#define VLNEXT 15
-#define VEOL2 16
-
-/* c_iflag bits */
-#define IGNBRK 0000001
-#define BRKINT 0000002
-#define IGNPAR 0000004
-#define PARMRK 0000010
-#define INPCK  0000020
-#define ISTRIP 0000040
-#define INLCR  0000100
-#define IGNCR  0000200
-#define ICRNL  0000400
-#define IUCLC  0001000
-#define IXON   0002000
-#define IXANY  0004000
-#define IXOFF  0010000
-#define IMAXBEL        0020000
-#define IUTF8  0040000
-
-/* c_oflag bits */
-#define OPOST  0000001
-#define OLCUC  0000002
-#define ONLCR  0000004
-#define OCRNL  0000010
-#define ONOCR  0000020
-#define ONLRET 0000040
-#define OFILL  0000100
-#define OFDEL  0000200
-#define NLDLY  0000400
-#define   NL0  0000000
-#define   NL1  0000400
-#define CRDLY  0003000
-#define   CR0  0000000
-#define   CR1  0001000
-#define   CR2  0002000
-#define   CR3  0003000
-#define TABDLY 0014000
-#define   TAB0 0000000
-#define   TAB1 0004000
-#define   TAB2 0010000
-#define   TAB3 0014000
-#define   XTABS        0014000
-#define BSDLY  0020000
-#define   BS0  0000000
-#define   BS1  0020000
-#define VTDLY  0040000
-#define   VT0  0000000
-#define   VT1  0040000
-#define FFDLY  0100000
-#define   FF0  0000000
-#define   FF1  0100000
-
-/* c_cflag bit meaning */
-#define CBAUD  0010017
-#define  B0    0000000         /* hang up */
-#define  B50   0000001
-#define  B75   0000002
-#define  B110  0000003
-#define  B134  0000004
-#define  B150  0000005
-#define  B200  0000006
-#define  B300  0000007
-#define  B600  0000010
-#define  B1200 0000011
-#define  B1800 0000012
-#define  B2400 0000013
-#define  B4800 0000014
-#define  B9600 0000015
-#define  B19200        0000016
-#define  B38400        0000017
-#define EXTA B19200
-#define EXTB B38400
-#define CSIZE  0000060
-#define   CS5  0000000
-#define   CS6  0000020
-#define   CS7  0000040
-#define   CS8  0000060
-#define CSTOPB 0000100
-#define CREAD  0000200
-#define PARENB 0000400
-#define PARODD 0001000
-#define HUPCL  0002000
-#define CLOCAL 0004000
-#define CBAUDEX 0010000
-#define   BOTHER  0010000
-#define    B57600 0010001
-#define   B115200 0010002
-#define   B230400 0010003
-#define   B460800 0010004
-#define   B500000 0010005
-#define   B576000 0010006
-#define   B921600 0010007
-#define  B1000000 0010010
-#define  B1152000 0010011
-#define  B1500000 0010012
-#define  B2000000 0010013
-#define  B2500000 0010014
-#define  B3000000 0010015
-#define  B3500000 0010016
-#define  B4000000 0010017
-#define CIBAUD   002003600000          /* input baud rate */
-#define CMSPAR    010000000000         /* mark or space (stick) parity */
-#define CRTSCTS          020000000000          /* flow control */
-
-#define IBSHIFT          16            /* Shift from CBAUD to CIBAUD */
-
-/* c_lflag bits */
-#define ISIG   0000001
-#define ICANON 0000002
-#define XCASE  0000004
-#define ECHO   0000010
-#define ECHOE  0000020
-#define ECHOK  0000040
-#define ECHONL 0000100
-#define NOFLSH 0000200
-#define TOSTOP 0000400
-#define ECHOCTL        0001000
-#define ECHOPRT        0002000
-#define ECHOKE 0004000
-#define FLUSHO 0010000
-#define PENDIN 0040000
-#define IEXTEN 0100000
-
-/* tcflow() and TCXONC use these */
-#define        TCOOFF          0
-#define        TCOON           1
-#define        TCIOFF          2
-#define        TCION           3
-
-/* tcflush() and TCFLSH use these */
-#define        TCIFLUSH        0
-#define        TCOFLUSH        1
-#define        TCIOFLUSH       2
-
-/* tcsetattr uses these */
-#define        TCSANOW         0
-#define        TCSADRAIN       1
-#define        TCSAFLUSH       2
-
-#endif /* __ASM_ARM_TERMBITS_H */
diff --git a/include/asm-arm26/termios.h b/include/asm-arm26/termios.h
deleted file mode 100644 (file)
index 293e3f1..0000000
+++ /dev/null
@@ -1,92 +0,0 @@
-#ifndef __ASM_ARM_TERMIOS_H
-#define __ASM_ARM_TERMIOS_H
-
-#include <asm/termbits.h>
-#include <asm/ioctls.h>
-
-struct winsize {
-       unsigned short ws_row;
-       unsigned short ws_col;
-       unsigned short ws_xpixel;
-       unsigned short ws_ypixel;
-};
-
-#define NCC 8
-struct termio {
-       unsigned short c_iflag;         /* input mode flags */
-       unsigned short c_oflag;         /* output mode flags */
-       unsigned short c_cflag;         /* control mode flags */
-       unsigned short c_lflag;         /* local mode flags */
-       unsigned char c_line;           /* line discipline */
-       unsigned char c_cc[NCC];        /* control characters */
-};
-
-#ifdef __KERNEL__
-/*     intr=^C         quit=^|         erase=del       kill=^U
-       eof=^D          vtime=\0        vmin=\1         sxtc=\0
-       start=^Q        stop=^S         susp=^Z         eol=\0
-       reprint=^R      discard=^U      werase=^W       lnext=^V
-       eol2=\0
-*/
-#define INIT_C_CC "\003\034\177\025\004\0\1\0\021\023\032\0\022\017\027\026\0"
-#endif
-
-/* modem lines */
-#define TIOCM_LE       0x001
-#define TIOCM_DTR      0x002
-#define TIOCM_RTS      0x004
-#define TIOCM_ST       0x008
-#define TIOCM_SR       0x010
-#define TIOCM_CTS      0x020
-#define TIOCM_CAR      0x040
-#define TIOCM_RNG      0x080
-#define TIOCM_DSR      0x100
-#define TIOCM_CD       TIOCM_CAR
-#define TIOCM_RI       TIOCM_RNG
-#define TIOCM_OUT1     0x2000
-#define TIOCM_OUT2     0x4000
-#define TIOCM_LOOP     0x8000
-
-/* ioctl (fd, TIOCSERGETLSR, &result) where result may be as below */
-
-#ifdef __KERNEL__
-
-/*
- * Translate a "termio" structure into a "termios". Ugh.
- */
-#define SET_LOW_TERMIOS_BITS(termios, termio, x) {             \
-       unsigned short __tmp;                                   \
-       get_user(__tmp,&(termio)->x);                           \
-       *(unsigned short *) &(termios)->x = __tmp;              \
-}
-
-#define user_termio_to_kernel_termios(termios, termio) \
-({ \
-       SET_LOW_TERMIOS_BITS(termios, termio, c_iflag); \
-       SET_LOW_TERMIOS_BITS(termios, termio, c_oflag); \
-       SET_LOW_TERMIOS_BITS(termios, termio, c_cflag); \
-       SET_LOW_TERMIOS_BITS(termios, termio, c_lflag); \
-       copy_from_user((termios)->c_cc, (termio)->c_cc, NCC); \
-})
-
-/*
- * Translate a "termios" structure into a "termio". Ugh.
- */
-#define kernel_termios_to_user_termio(termio, termios) \
-({ \
-       put_user((termios)->c_iflag, &(termio)->c_iflag); \
-       put_user((termios)->c_oflag, &(termio)->c_oflag); \
-       put_user((termios)->c_cflag, &(termio)->c_cflag); \
-       put_user((termios)->c_lflag, &(termio)->c_lflag); \
-       put_user((termios)->c_line,  &(termio)->c_line); \
-       copy_to_user((termio)->c_cc, (termios)->c_cc, NCC); \
-})
-
-#define user_termios_to_kernel_termios(k, u) copy_from_user(k, u, sizeof(struct termios2))
-#define kernel_termios_to_user_termios(u, k) copy_to_user(u, k, sizeof(struct termios2))
-#define user_termios_to_kernel_termios_1(k, u) copy_from_user(k, u, sizeof(struct termios))
-#define kernel_termios_to_user_termios_1(u, k) copy_to_user(u, k, sizeof(struct termios))
-
-#endif /* __KERNEL__ */
-
-#endif /* __ASM_ARM_TERMIOS_H */
diff --git a/include/asm-arm26/thread_info.h b/include/asm-arm26/thread_info.h
deleted file mode 100644 (file)
index 9b367eb..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/*
- *  linux/include/asm-arm26/thread_info.h
- *
- *  Copyright (C) 2002 Russell King.
- *  Copyright (C) 2003 Ian Molton.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#ifndef __ASM_ARM_THREAD_INFO_H
-#define __ASM_ARM_THREAD_INFO_H
-
-#ifdef __KERNEL__
-
-#ifndef __ASSEMBLY__
-
-struct task_struct;
-struct exec_domain;
-
-#include <linux/compiler.h>
-#include <asm/fpstate.h>
-#include <asm/ptrace.h>
-#include <asm/types.h>
-
-typedef unsigned long mm_segment_t;
-
-struct cpu_context_save {
-       __u32   r4;
-       __u32   r5;
-       __u32   r6;
-       __u32   r7;
-       __u32   r8;
-       __u32   r9;
-       __u32   sl;
-       __u32   fp;
-       __u32   sp;
-       __u32   pc;
-};
-
-/*
- * low level task data that entry.S needs immediate access to.
- * We assume cpu_context follows immedately after cpu_domain.
- */
-struct thread_info {
-       unsigned long           flags;          /* low level flags */
-       int                     preempt_count;  /* 0 => preemptable, <0 => bug */
-       mm_segment_t            addr_limit;     /* address limit */
-       struct task_struct      *task;          /* main task structure */
-       struct exec_domain      *exec_domain;   /* execution domain */
-       __u32                   cpu;            /* cpu */
-       struct cpu_context_save cpu_context;    /* cpu context */
-       struct restart_block    restart_block;
-       union fp_state          fpstate;
-};
-
-#define INIT_THREAD_INFO(tsk)                  \
-{                                              \
-       .task           &tsk,                   \
-       .exec_domain    &default_exec_domain,   \
-       .flags          0,                      \
-       .preempt_count  0,                      \
-       .addr_limit     KERNEL_DS,              \
-       .restart_block  = {                             \
-               .fn     = do_no_restart_syscall,        \
-       },                                              \
-}
-
-#define init_thread_info       (init_thread_union.thread_info)
-#define init_stack             (init_thread_union.stack)
-
-/*
- * how to get the thread information struct from C
- */
-static inline struct thread_info *current_thread_info(void) __attribute_const__;
-
-static inline struct thread_info *current_thread_info(void)
-{
-       register unsigned long sp asm ("sp");
-       return (struct thread_info *)(sp & ~0x1fff);
-}
-
-#define THREAD_SIZE    PAGE_SIZE
-#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 thread_saved_pc(tsk)   \
-       ((unsigned long)(pc_pointer(task_thread_info(tsk)->cpu_context.pc)))
-#define thread_saved_fp(tsk)   \
-       ((unsigned long)(task_thread_info(tsk)->cpu_context.fp))
-
-#else /* !__ASSEMBLY__ */
-
-#define TI_FLAGS       0
-#define TI_PREEMPT     4
-#define TI_ADDR_LIMIT  8
-#define TI_TASK                12
-#define TI_EXEC_DOMAIN  16
-#define TI_CPU         20
-#define TI_CPU_SAVE    24
-#define TI_RESTART_BLOCK 28
-#define TI_FPSTATE     68
-
-#endif
-
-#define PREEMPT_ACTIVE 0x04000000
-
-/*
- * thread information flags:
- *  TIF_SYSCALL_TRACE  - syscall trace active
- *  TIF_NOTIFY_RESUME  - resumption notification requested
- *  TIF_SIGPENDING     - signal pending
- *  TIF_NEED_RESCHED   - rescheduling necessary
- *  TIF_USEDFPU                - FPU was used by this task this quantum (SMP)
- *  TIF_POLLING_NRFLAG - true if poll_idle() is polling TIF_NEED_RESCHED
- */
-#define TIF_NOTIFY_RESUME      0
-#define TIF_SIGPENDING         1
-#define TIF_NEED_RESCHED       2
-#define TIF_SYSCALL_TRACE      8
-#define TIF_USED_FPU           16
-#define TIF_POLLING_NRFLAG     17
-#define TIF_MEMDIE             18
-
-#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
-#define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
-#define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
-#define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
-#define _TIF_USED_FPU          (1 << TIF_USED_FPU)
-#define _TIF_POLLING_NRFLAG    (1 << TIF_POLLING_NRFLAG)
-
-/*
- * Change these and you break ASM code in entry-common.S
- */
-#define _TIF_WORK_MASK         0x000000ff
-
-#endif /* __KERNEL__ */
-#endif /* __ASM_ARM_THREAD_INFO_H */
diff --git a/include/asm-arm26/timex.h b/include/asm-arm26/timex.h
deleted file mode 100644 (file)
index 68322fb..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-/*
- *  linux/include/asm-arm/timex.h
- *
- *  Copyright (C) 1997,1998 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Architecture Specific TIME specifications
- */
-#ifndef _ASMARM_TIMEX_H
-#define _ASMARM_TIMEX_H
-
-/*
- * On the RiscPC, the clock ticks at 2MHz.
- */
-#define CLOCK_TICK_RATE         2000000
-
-/* IS THAT RIGHT ON A5000? FIXME */
-
-typedef unsigned long cycles_t;
-
-static inline cycles_t get_cycles (void)
-{
-       return 0;
-}
-
-#endif
diff --git a/include/asm-arm26/tlb.h b/include/asm-arm26/tlb.h
deleted file mode 100644 (file)
index 08ddd85..0000000
+++ /dev/null
@@ -1,63 +0,0 @@
-#ifndef __ASMARM_TLB_H
-#define __ASMARM_TLB_H
-
-#include <asm/pgalloc.h>
-#include <asm/tlbflush.h>
-
-/*
- * TLB handling.  This allows us to remove pages from the page
- * tables, and efficiently handle the TLB issues.
- */
-struct mmu_gather {
-        struct mm_struct        *mm;
-        unsigned int            need_flush;
-        unsigned int            fullmm;
-};
-
-DECLARE_PER_CPU(struct mmu_gather, mmu_gathers);
-
-static inline struct mmu_gather *
-tlb_gather_mmu(struct mm_struct *mm, unsigned int full_mm_flush)
-{
-        struct mmu_gather *tlb = &get_cpu_var(mmu_gathers);
-
-        tlb->mm = mm;
-        tlb->need_flush = 0;
-        tlb->fullmm = full_mm_flush;
-
-        return tlb;
-}
-
-static inline void
-tlb_finish_mmu(struct mmu_gather *tlb, unsigned long start, unsigned long end)
-{
-        if (tlb->need_flush)
-                flush_tlb_mm(tlb->mm);
-
-        /* keep the page table cache within bounds */
-        check_pgt_cache();
-
-        put_cpu_var(mmu_gathers);
-}
-
-#define tlb_remove_tlb_entry(tlb,ptep,address)  do { } while (0)
-//#define tlb_start_vma(tlb,vma)                  do { } while (0)
-//FIXME - ARM32 uses this now that things changed in the kernel. seems like it may be pointless on arm26, however to get things compiling...
-#define tlb_start_vma(tlb,vma)                                          \
-        do {                                                            \
-                if (!tlb->fullmm)                                       \
-                        flush_cache_range(vma, vma->vm_start, vma->vm_end); \
-        } while (0)
-#define tlb_end_vma(tlb,vma)                    do { } while (0)
-
-static inline void
-tlb_remove_page(struct mmu_gather *tlb, struct page *page)
-{
-        tlb->need_flush = 1;
-        free_page_and_swap_cache(page);
-}
-
-#define pte_free_tlb(tlb,ptep)          pte_free(ptep)
-#define pmd_free_tlb(tlb,pmdp)          pmd_free(pmdp)
-
-#endif
diff --git a/include/asm-arm26/tlbflush.h b/include/asm-arm26/tlbflush.h
deleted file mode 100644 (file)
index f79c1cb..0000000
+++ /dev/null
@@ -1,70 +0,0 @@
-#ifndef __ASMARM_TLBFLUSH_H
-#define __ASMARM_TLBFLUSH_H
-
-/*
- * TLB flushing:
- *
- *  - flush_tlb_all() flushes all processes TLBs
- *  - flush_tlb_mm(mm) flushes the specified mm context TLB's
- *  - flush_tlb_page(vma, vmaddr) flushes one page
- *  - flush_tlb_range(vma, start, end) flushes a range of pages
- */
-
-#define flush_tlb_all()                                memc_update_all()
-#define flush_tlb_mm(mm)                       memc_update_mm(mm)
-#define flush_tlb_page(vma, vmaddr)            do { printk("flush_tlb_page\n");} while (0)  // IS THIS RIGHT?
-#define flush_tlb_range(vma,start,end)         \
-               do { memc_update_mm(vma->vm_mm); (void)(start); (void)(end); } while (0)
-#define flush_tlb_pgtables(mm,start,end)        do { printk("flush_tlb_pgtables\n");} while (0)
-#define flush_tlb_kernel_range(s,e)             do { printk("flush_tlb_range\n");} while (0)
-
-/*
- * The following handle the weird MEMC chip
- */
-static inline void memc_update_all(void)
-{
-       struct task_struct *p;
-       cpu_memc_update_all(init_mm.pgd);
-       for_each_process(p) {
-               if (!p->mm)
-                       continue;
-               cpu_memc_update_all(p->mm->pgd);
-       }
-       processor._set_pgd(current->active_mm->pgd);
-}
-
-static inline void memc_update_mm(struct mm_struct *mm)
-{
-       cpu_memc_update_all(mm->pgd);
-
-       if (mm == current->active_mm)
-               processor._set_pgd(mm->pgd);
-}
-
-static inline void
-memc_clear(struct mm_struct *mm, struct page *page)
-{
-       cpu_memc_update_entry(mm->pgd, (unsigned long) page_address(page), 0);
-
-       if (mm == current->active_mm)
-               processor._set_pgd(mm->pgd);
-}
-
-static inline void
-memc_update_addr(struct mm_struct *mm, pte_t pte, unsigned long vaddr)
-{
-       cpu_memc_update_entry(mm->pgd, pte_val(pte), vaddr);
-
-       if (mm == current->active_mm)
-               processor._set_pgd(mm->pgd);
-}
-
-static inline void
-update_mmu_cache(struct vm_area_struct *vma, unsigned long addr, pte_t pte)
-{
-       struct mm_struct *mm = vma->vm_mm;
-printk("update_mmu_cache\n");
-       memc_update_addr(mm, pte, addr);
-}
-
-#endif
diff --git a/include/asm-arm26/topology.h b/include/asm-arm26/topology.h
deleted file mode 100644 (file)
index accbd7c..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-#ifndef _ASM_ARM_TOPOLOGY_H
-#define _ASM_ARM_TOPOLOGY_H
-
-#include <asm-generic/topology.h>
-
-#endif /* _ASM_ARM_TOPOLOGY_H */
diff --git a/include/asm-arm26/types.h b/include/asm-arm26/types.h
deleted file mode 100644 (file)
index 81bd357..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-#ifndef __ASM_ARM_TYPES_H
-#define __ASM_ARM_TYPES_H
-
-#ifndef __ASSEMBLY__
-
-typedef unsigned short umode_t;
-
-/*
- * __xx is ok: it doesn't pollute the POSIX namespace. Use these in the
- * header files exported to user space
- */
-
-typedef __signed__ char __s8;
-typedef unsigned char __u8;
-
-typedef __signed__ short __s16;
-typedef unsigned short __u16;
-
-typedef __signed__ int __s32;
-typedef unsigned int __u32;
-
-#if defined(__GNUC__) && !defined(__STRICT_ANSI__)
-typedef __signed__ long long __s64;
-typedef unsigned long long __u64;
-#endif
-
-#endif /* __ASSEMBLY__ */
-
-/*
- * These aren't exported outside the kernel to avoid name space clashes
- */
-#ifdef __KERNEL__
-
-#define BITS_PER_LONG 32
-
-#ifndef __ASSEMBLY__
-
-typedef signed char s8;
-typedef unsigned char u8;
-
-typedef signed short s16;
-typedef unsigned short u16;
-
-typedef signed int s32;
-typedef unsigned int u32;
-
-typedef signed long long s64;
-typedef unsigned long long u64;
-
-/* Dma addresses are 32-bits wide.  */
-
-typedef u32 dma_addr_t;
-typedef u32 dma64_addr_t;
-
-#endif /* __ASSEMBLY__ */
-
-#endif /* __KERNEL__ */
-
-#endif
diff --git a/include/asm-arm26/uaccess-asm.h b/include/asm-arm26/uaccess-asm.h
deleted file mode 100644 (file)
index ade76ec..0000000
+++ /dev/null
@@ -1,153 +0,0 @@
-/*
- *  linux/include/asm-arm/proc-armo/uaccess.h
- *
- *  Copyright (C) 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-
-/*
- * The fs functions are implemented on the ARM2 and ARM3 architectures
- * manually.
- * Use *_user functions to access user memory with faulting behaving
- *   as though the user is accessing the memory.
- * Use set_fs(get_ds()) and then the *_user functions to allow them to
- *   access kernel memory.
- */
-
-/*
- * These are the values used to represent the user `fs' and the kernel `ds'
- * FIXME - the KERNEL_DS should end at 0x03000000 but we want to access ROM at
- * 0x03400000. ideally we want to forbid access to the IO space inbetween.
- */
-#define KERNEL_DS      0x03FFFFFF
-#define USER_DS        0x02000000
-
-extern uaccess_t uaccess_user, uaccess_kernel;
-
-static inline void set_fs (mm_segment_t fs)
-{
-       current_thread_info()->addr_limit = fs;
-       current->thread.uaccess = (fs == USER_DS ? &uaccess_user : &uaccess_kernel);
-}
-
-#define __range_ok(addr,size) ({                                       \
-       unsigned long flag, roksum;                                     \
-       __asm__ __volatile__("subs %1, %0, %3; cmpcs %1, %2; movcs %0, #0" \
-               : "=&r" (flag), "=&r" (roksum)                          \
-               : "r" (addr), "Ir" (size), "0" (current_thread_info()->addr_limit)      \
-               : "cc");                                                \
-       flag; })
-
-#define __addr_ok(addr) ({                                             \
-       unsigned long flag;                                             \
-       __asm__ __volatile__("cmp %2, %0; movlo %0, #0"                 \
-               : "=&r" (flag)                                          \
-               : "0" (current_thread_info()->addr_limit), "r" (addr)   \
-               : "cc");                                                \
-       (flag == 0); })
-
-#define __put_user_asm_byte(x,addr,err)                                        \
-       __asm__ __volatile__(                                           \
-       "       mov     r0, %1\n"                                       \
-       "       mov     r1, %2\n"                                       \
-       "       mov     r2, %0\n"                                       \
-       "       mov     lr, pc\n"                                       \
-       "       mov     pc, %3\n"                                       \
-       "       mov     %0, r2\n"                                       \
-       : "=r" (err)                                                    \
-       : "r" (x), "r" (addr), "r" (current->thread.uaccess->put_byte), \
-         "0" (err)                                                     \
-       : "r0", "r1", "r2", "lr")
-
-#define __put_user_asm_half(x,addr,err)                                        \
-       __asm__ __volatile__(                                           \
-       "       mov     r0, %1\n"                                       \
-       "       mov     r1, %2\n"                                       \
-       "       mov     r2, %0\n"                                       \
-       "       mov     lr, pc\n"                                       \
-       "       mov     pc, %3\n"                                       \
-       "       mov     %0, r2\n"                                       \
-       : "=r" (err)                                                    \
-       : "r" (x), "r" (addr), "r" (current->thread.uaccess->put_half), \
-         "0" (err)                                                     \
-       : "r0", "r1", "r2", "lr")
-
-#define __put_user_asm_word(x,addr,err)                                        \
-       __asm__ __volatile__(                                           \
-       "       mov     r0, %1\n"                                       \
-       "       mov     r1, %2\n"                                       \
-       "       mov     r2, %0\n"                                       \
-       "       mov     lr, pc\n"                                       \
-       "       mov     pc, %3\n"                                       \
-       "       mov     %0, r2\n"                                       \
-       : "=r" (err)                                                    \
-       : "r" (x), "r" (addr), "r" (current->thread.uaccess->put_word), \
-         "0" (err)                                                     \
-       : "r0", "r1", "r2", "lr")
-
-#define __put_user_asm_dword(x,addr,err)                                 \
-        __asm__ __volatile__(                                           \
-        "       mov     r0, %1\n"                                       \
-        "       mov     r1, %2\n"                                       \
-        "       mov     r2, %0\n"                                       \
-        "       mov     lr, pc\n"                                       \
-        "       mov     pc, %3\n"                                       \
-        "       mov     %0, r2\n"                                       \
-        : "=r" (err)                                                    \
-        : "r" (x), "r" (addr), "r" (current->thread.uaccess->put_dword), \
-          "0" (err)                                                     \
-        : "r0", "r1", "r2", "lr")
-
-#define __get_user_asm_byte(x,addr,err)                                        \
-       __asm__ __volatile__(                                           \
-       "       mov     r0, %2\n"                                       \
-       "       mov     r1, %0\n"                                       \
-       "       mov     lr, pc\n"                                       \
-       "       mov     pc, %3\n"                                       \
-       "       mov     %0, r1\n"                                       \
-       "       mov     %1, r0\n"                                       \
-       : "=r" (err), "=r" (x)                                          \
-       : "r" (addr), "r" (current->thread.uaccess->get_byte), "0" (err)        \
-       : "r0", "r1", "r2", "lr")
-
-#define __get_user_asm_half(x,addr,err)                                        \
-       __asm__ __volatile__(                                           \
-       "       mov     r0, %2\n"                                       \
-       "       mov     r1, %0\n"                                       \
-       "       mov     lr, pc\n"                                       \
-       "       mov     pc, %3\n"                                       \
-       "       mov     %0, r1\n"                                       \
-       "       mov     %1, r0\n"                                       \
-       : "=r" (err), "=r" (x)                                          \
-       : "r" (addr), "r" (current->thread.uaccess->get_half), "0" (err)        \
-       : "r0", "r1", "r2", "lr")
-
-#define __get_user_asm_word(x,addr,err)                                        \
-       __asm__ __volatile__(                                           \
-       "       mov     r0, %2\n"                                       \
-       "       mov     r1, %0\n"                                       \
-       "       mov     lr, pc\n"                                       \
-       "       mov     pc, %3\n"                                       \
-       "       mov     %0, r1\n"                                       \
-       "       mov     %1, r0\n"                                       \
-       : "=r" (err), "=r" (x)                                          \
-       : "r" (addr), "r" (current->thread.uaccess->get_word), "0" (err)        \
-       : "r0", "r1", "r2", "lr")
-
-#define __do_copy_from_user(to,from,n)                                 \
-       (n) = current->thread.uaccess->copy_from_user((to),(from),(n))
-
-#define __do_copy_to_user(to,from,n)                                   \
-       (n) = current->thread.uaccess->copy_to_user((to),(from),(n))
-
-#define __do_clear_user(addr,sz)                                       \
-       (sz) = current->thread.uaccess->clear_user((addr),(sz))
-
-#define __do_strncpy_from_user(dst,src,count,res)                      \
-       (res) = current->thread.uaccess->strncpy_from_user(dst,src,count)
-
-#define __do_strnlen_user(s,n,res)                                     \
-       (res) = current->thread.uaccess->strnlen_user(s,n)
diff --git a/include/asm-arm26/uaccess.h b/include/asm-arm26/uaccess.h
deleted file mode 100644 (file)
index d64ed84..0000000
+++ /dev/null
@@ -1,293 +0,0 @@
-#ifndef _ASMARM_UACCESS_H
-#define _ASMARM_UACCESS_H
-
-/*
- * User space memory access functions
- */
-#include <linux/sched.h>
-#include <asm/errno.h>
-
-#define VERIFY_READ 0
-#define VERIFY_WRITE 1
-
-/*
- * The exception table consists of pairs of addresses: the first is the
- * address of an instruction that is allowed to fault, and the second is
- * the address at which the program should continue.  No registers are
- * modified, so it is entirely up to the continuation code to figure out
- * what to do.
- *
- * All the routines below use bits of fixup code that are out of line
- * with the main instruction path.  This means when everything is well,
- * we don't even have to jump over them.  Further, they do not intrude
- * on our cache or tlb entries.
- */
-
-struct exception_table_entry
-{
-       unsigned long insn, fixup;
-};
-
-/* Returns 0 if exception not found and fixup otherwise.  */
-extern unsigned long search_exception_table(unsigned long);
-extern int fixup_exception(struct pt_regs *regs);
-
-#define get_ds()       (KERNEL_DS)
-#define get_fs()       (current_thread_info()->addr_limit)
-#define segment_eq(a,b)        ((a) == (b))
-
-#include <asm/uaccess-asm.h>
-
-#define access_ok(type,addr,size)      (__range_ok(addr,size) == 0)
-
-/*
- * Single-value transfer routines.  They automatically use the right
- * size if we just have the right pointer type.  Note that the functions
- * which read from user space (*get_*) need to take care not to leak
- * kernel data even if the calling code is buggy and fails to check
- * the return value.  This means zeroing out the destination variable
- * or buffer on error.  Normally this is done out of line by the
- * fixup code, but there are a few places where it intrudes on the
- * main code path.  When we only write to user space, there is no
- * problem.
- *
- * The "__xxx" versions of the user access functions do not verify the
- * address space - it must have been done previously with a separate
- * "access_ok()" call.
- *
- * The "xxx_error" versions set the third argument to EFAULT if an
- * error occurs, and leave it unchanged on success.  Note that these
- * versions are void (ie, don't return a value as such).
- */
-
-extern int __get_user_1(void *);
-extern int __get_user_2(void *);
-extern int __get_user_4(void *);
-extern int __get_user_8(void *);
-extern int __get_user_bad(void);
-
-#define __get_user_x(__r1,__p,__e,__s,__i...)                          \
-          __asm__ __volatile__ ("bl    __get_user_" #__s               \
-               : "=&r" (__e), "=r" (__r1)                              \
-               : "0" (__p)                                             \
-               : __i)
-
-#define get_user(x,p)                                                  \
-       ({                                                              \
-               register const typeof(*(p)) *__p asm("r0") = (p);       \
-               register typeof(*(p)) __r1 asm("r1");                   \
-               register int __e asm("r0");                             \
-               switch (sizeof(*(p))) {                                 \
-               case 1:                                                 \
-                       __get_user_x(__r1, __p, __e, 1, "lr");          \
-                       break;                                          \
-               case 2:                                                 \
-                       __get_user_x(__r1, __p, __e, 2, "r2", "lr");    \
-                       break;                                          \
-               case 4:                                                 \
-                       __get_user_x(__r1, __p, __e, 4, "lr");          \
-                       break;                                          \
-               case 8:                                                 \
-                       __get_user_x(__r1, __p, __e, 8, "lr");          \
-                       break;                                          \
-               default: __e = __get_user_bad(); break;                 \
-               }                                                       \
-               x = __r1;                                               \
-               __e;                                                    \
-       })
-
-
-#define __get_user(x,ptr)                                               \
-({                                                                      \
-        long __gu_err = 0;                                              \
-        __get_user_err((x),(ptr),__gu_err);                             \
-        __gu_err;                                                       \
-})
-
-#define __get_user_error(x,ptr,err)                                     \
-({                                                                      \
-        __get_user_err((x),(ptr),err);                                  \
-        (void) 0;                                                       \
-})
-
-#define __get_user_err(x,ptr,err)                                       \
-do {                                                                    \
-        unsigned long __gu_addr = (unsigned long)(ptr);                 \
-        unsigned long __gu_val;                                         \
-        switch (sizeof(*(ptr))) {                                       \
-        case 1: __get_user_asm_byte(__gu_val,__gu_addr,err);    break;  \
-        case 2: __get_user_asm_half(__gu_val,__gu_addr,err);    break;  \
-        case 4: __get_user_asm_word(__gu_val,__gu_addr,err);    break;  \
-        default: (__gu_val) = __get_user_bad();                         \
-        }                                                               \
-        (x) = (__typeof__(*(ptr)))__gu_val;                             \
-} while (0)
-
-extern int __put_user_1(void *, unsigned int);
-extern int __put_user_2(void *, unsigned int);
-extern int __put_user_4(void *, unsigned int);
-extern int __put_user_8(void *, unsigned long long);
-extern int __put_user_bad(void);
-
-#define __put_user_x(__r1,__p,__e,__s)                                  \
-           __asm__ __volatile__ (                                       \
-                __asmeq("%0", "r0") __asmeq("%2", "r1")                 \
-                "bl     __put_user_" #__s                               \
-                : "=&r" (__e)                                           \
-                : "0" (__p), "r" (__r1)                                 \
-                : "ip", "lr", "cc")
-
-#define put_user(x,p)                                                   \
-        ({                                                              \
-                register const typeof(*(p)) __r1 asm("r1") = (x);       \
-                register const typeof(*(p)) *__p asm("r0") = (p);       \
-                register int __e asm("r0");                             \
-                switch (sizeof(*(__p))) {                               \
-                case 1:                                                 \
-                        __put_user_x(__r1, __p, __e, 1);                \
-                        break;                                          \
-                case 2:                                                 \
-                        __put_user_x(__r1, __p, __e, 2);                \
-                        break;                                          \
-                case 4:                                                 \
-                        __put_user_x(__r1, __p, __e, 4);                \
-                        break;                                          \
-                case 8:                                                 \
-                        __put_user_x(__r1, __p, __e, 8);                \
-                        break;                                          \
-                default: __e = __put_user_bad(); break;                 \
-                }                                                       \
-                __e;                                                    \
-        })
-
-#if 0
-/*********************   OLD METHOD *******************/
-#define __put_user_x(__r1,__p,__e,__s,__i...)                          \
-          __asm__ __volatile__ ("bl    __put_user_" #__s               \
-               : "=&r" (__e)                                           \
-               : "0" (__p), "r" (__r1)                                 \
-               : __i)
-
-#define put_user(x,p)                                                  \
-       ({                                                              \
-               register const typeof(*(p)) __r1 asm("r1") = (x);       \
-               register const typeof(*(p)) *__p asm("r0") = (p);       \
-               register int __e asm("r0");                             \
-               switch (sizeof(*(p))) {                                 \
-               case 1:                                                 \
-                       __put_user_x(__r1, __p, __e, 1, "r2", "lr");    \
-                       break;                                          \
-               case 2:                                                 \
-                       __put_user_x(__r1, __p, __e, 2, "r2", "lr");    \
-                       break;                                          \
-               case 4:                                                 \
-                       __put_user_x(__r1, __p, __e, 4, "r2", "lr");    \
-                       break;                                          \
-               case 8:                                                 \
-                       __put_user_x(__r1, __p, __e, 8, "r2", "ip", "lr");      \
-                       break;                                          \
-               default: __e = __put_user_bad(); break;                 \
-               }                                                       \
-               __e;                                                    \
-       })
-/*************************************************/
-#endif
-
-#define __put_user(x,ptr)                                               \
-({                                                                      \
-        long __pu_err = 0;                                              \
-        __put_user_err((x),(ptr),__pu_err);                             \
-        __pu_err;                                                       \
-})
-
-#define __put_user_error(x,ptr,err)                                     \
-({                                                                      \
-        __put_user_err((x),(ptr),err);                                  \
-        (void) 0;                                                       \
-})
-
-#define __put_user_err(x,ptr,err)                                       \
-do {                                                                    \
-        unsigned long __pu_addr = (unsigned long)(ptr);                 \
-        __typeof__(*(ptr)) __pu_val = (x);                              \
-        switch (sizeof(*(ptr))) {                                       \
-        case 1: __put_user_asm_byte(__pu_val,__pu_addr,err);    break;  \
-        case 2: __put_user_asm_half(__pu_val,__pu_addr,err);    break;  \
-        case 4: __put_user_asm_word(__pu_val,__pu_addr,err);    break;  \
-        case 8: __put_user_asm_dword(__pu_val,__pu_addr,err);   break;  \
-        default: __put_user_bad();                                      \
-        }                                                               \
-} while (0)
-
-static __inline__ unsigned long copy_from_user(void *to, const void *from, unsigned long n)
-{
-       if (access_ok(VERIFY_READ, from, n))
-               __do_copy_from_user(to, from, n);
-       else /* security hole - plug it */
-               memzero(to, n);
-       return n;
-}
-
-static __inline__ unsigned long __copy_from_user(void *to, const void *from, unsigned long n)
-{
-       __do_copy_from_user(to, from, n);
-       return n;
-}
-
-static __inline__ unsigned long copy_to_user(void *to, const void *from, unsigned long n)
-{
-       if (access_ok(VERIFY_WRITE, to, n))
-               __do_copy_to_user(to, from, n);
-       return n;
-}
-
-static __inline__ unsigned long __copy_to_user(void *to, const void *from, unsigned long n)
-{
-       __do_copy_to_user(to, from, n);
-       return n;
-}
-
-#define __copy_to_user_inatomic __copy_to_user
-#define __copy_from_user_inatomic __copy_from_user
-
-static __inline__ unsigned long clear_user (void *to, unsigned long n)
-{
-       if (access_ok(VERIFY_WRITE, to, n))
-               __do_clear_user(to, n);
-       return n;
-}
-
-static __inline__ unsigned long __clear_user (void *to, unsigned long n)
-{
-       __do_clear_user(to, n);
-       return n;
-}
-
-static __inline__ long strncpy_from_user (char *dst, const char *src, long count)
-{
-       long res = -EFAULT;
-       if (access_ok(VERIFY_READ, src, 1))
-               __do_strncpy_from_user(dst, src, count, res);
-       return res;
-}
-
-static __inline__ long __strncpy_from_user (char *dst, const char *src, long count)
-{
-       long res;
-       __do_strncpy_from_user(dst, src, count, res);
-       return res;
-}
-
-#define strlen_user(s) strnlen_user(s, ~0UL >> 1)
-
-static inline long strnlen_user(const char *s, long n)
-{
-       unsigned long res = 0;
-
-       if (__addr_ok(s))
-               __do_strnlen_user(s, n, res);
-
-       return res;
-}
-
-#endif /* _ASMARM_UACCESS_H */
diff --git a/include/asm-arm26/ucontext.h b/include/asm-arm26/ucontext.h
deleted file mode 100644 (file)
index f853130..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-#ifndef _ASMARM_UCONTEXT_H
-#define _ASMARM_UCONTEXT_H
-
-struct ucontext {
-       unsigned long     uc_flags;
-       struct ucontext  *uc_link;
-       stack_t           uc_stack;
-       struct sigcontext uc_mcontext;
-       sigset_t          uc_sigmask;   /* mask last for extensibility */
-};
-
-#endif /* !_ASMARM_UCONTEXT_H */
diff --git a/include/asm-arm26/unaligned.h b/include/asm-arm26/unaligned.h
deleted file mode 100644 (file)
index d992782..0000000
+++ /dev/null
@@ -1,118 +0,0 @@
-#ifndef __ASM_ARM_UNALIGNED_H
-#define __ASM_ARM_UNALIGNED_H
-
-#include <asm/types.h>
-
-extern int __bug_unaligned_x(void *ptr);
-
-/*
- * What is the most efficient way of loading/storing an unaligned value?
- *
- * That is the subject of this file.  Efficiency here is defined as
- * minimum code size with minimum register usage for the common cases.
- * It is currently not believed that long longs are common, so we
- * trade efficiency for the chars, shorts and longs against the long
- * longs.
- *
- * Current stats with gcc 2.7.2.2 for these functions:
- *
- *     ptrsize get:    code    regs    put:    code    regs
- *     1               1       1               1       2
- *     2               3       2               3       2
- *     4               7       3               7       3
- *     8               20      6               16      6
- *
- * gcc 2.95.1 seems to code differently:
- *
- *     ptrsize get:    code    regs    put:    code    regs
- *     1               1       1               1       2
- *     2               3       2               3       2
- *     4               7       4               7       4
- *     8               19      8               15      6
- *
- * which may or may not be more efficient (depending upon whether
- * you can afford the extra registers).  Hopefully the gcc 2.95
- * is inteligent enough to decide if it is better to use the
- * extra register, but evidence so far seems to suggest otherwise.
- *
- * Unfortunately, gcc is not able to optimise the high word
- * out of long long >> 32, or the low word from long long << 32
- */
-
-#define __get_unaligned_2_le(__p)                                      \
-       (__p[0] | __p[1] << 8)
-
-#define __get_unaligned_4_le(__p)                                      \
-       (__p[0] | __p[1] << 8 | __p[2] << 16 | __p[3] << 24)
-
-#define __get_unaligned_le(ptr)                                        \
-       ({                                                      \
-               __typeof__(*(ptr)) __v;                         \
-               __u8 *__p = (__u8 *)(ptr);                      \
-               switch (sizeof(*(ptr))) {                       \
-               case 1: __v = *(ptr);                   break;  \
-               case 2: __v = __get_unaligned_2_le(__p);        break;  \
-               case 4: __v = __get_unaligned_4_le(__p);        break;  \
-               case 8: {                                       \
-                               unsigned int __v1, __v2;        \
-                               __v2 = __get_unaligned_4_le((__p+4)); \
-                               __v1 = __get_unaligned_4_le(__p);       \
-                               __v = ((unsigned long long)__v2 << 32 | __v1);  \
-                       }                                       \
-                       break;                                  \
-               default: __v = __bug_unaligned_x(__p);  break;  \
-               }                                               \
-               __v;                                            \
-       })
-
-static inline void __put_unaligned_2_le(__u32 __v, register __u8 *__p)
-{
-       *__p++ = __v;
-       *__p++ = __v >> 8;
-}
-
-static inline void __put_unaligned_4_le(__u32 __v, register __u8 *__p)
-{
-       __put_unaligned_2_le(__v >> 16, __p + 2);
-       __put_unaligned_2_le(__v, __p);
-}
-
-static inline void __put_unaligned_8_le(const unsigned long long __v, register __u8 *__p)
-{
-       /*
-        * tradeoff: 8 bytes of stack for all unaligned puts (2
-        * instructions), or an extra register in the long long
-        * case - go for the extra register.
-        */
-       __put_unaligned_4_le(__v >> 32, __p+4);
-       __put_unaligned_4_le(__v, __p);
-}
-
-/*
- * Try to store an unaligned value as efficiently as possible.
- */
-#define __put_unaligned_le(val,ptr)                                    \
-       ({                                                      \
-               switch (sizeof(*(ptr))) {                       \
-               case 1:                                         \
-                       *(ptr) = (val);                         \
-                       break;                                  \
-               case 2: __put_unaligned_2_le((val),(__u8 *)(ptr));      \
-                       break;                                  \
-               case 4: __put_unaligned_4_le((val),(__u8 *)(ptr));      \
-                       break;                                  \
-               case 8: __put_unaligned_8_le((val),(__u8 *)(ptr)); \
-                       break;                                  \
-               default: __bug_unaligned_x(ptr);                \
-                       break;                                  \
-               }                                               \
-               (void) 0;                                       \
-       })
-
-/*
- * Select endianness
- */
-#define get_unaligned  __get_unaligned_le
-#define put_unaligned  __put_unaligned_le
-
-#endif
diff --git a/include/asm-arm26/uncompress.h b/include/asm-arm26/uncompress.h
deleted file mode 100644 (file)
index df2cba8..0000000
+++ /dev/null
@@ -1,111 +0,0 @@
-/*
- *  linux/include/asm-arm/arch-arc/uncompress.h
- *
- *  Copyright (C) 1996 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#define VIDMEM ((char *)0x02000000)
-int video_num_columns, video_num_lines, video_size_row;
-int white, bytes_per_char_h;
-extern unsigned long con_charconvtable[256];
-
-struct param_struct {
-       unsigned long page_size;
-       unsigned long nr_pages;
-       unsigned long ramdisk_size;
-       unsigned long mountrootrdonly;
-       unsigned long rootdev;
-       unsigned long video_num_cols;
-       unsigned long video_num_rows;
-       unsigned long video_x;
-       unsigned long video_y;
-       unsigned long memc_control_reg;
-       unsigned char sounddefault;
-       unsigned char adfsdrives;
-       unsigned char bytes_per_char_h;
-       unsigned char bytes_per_char_v;
-       unsigned long unused[256/4-11];
-};
-
-static struct param_struct *params = (struct param_struct *)0x0207c000;
-/*
- * This does not append a newline
- */
-static void puts(const char *s)
-{
-       extern void ll_write_char(char *, unsigned long);
-       int x,y;
-       unsigned char c;
-       char *ptr;
-
-       x = params->video_x;
-       y = params->video_y;
-
-       while ( ( c = *(unsigned char *)s++ ) != '\0' ) {
-               if ( c == '\n' ) {
-                       x = 0;
-                       if ( ++y >= video_num_lines ) {
-                               y--;
-                       }
-               } else {
-                       ptr = VIDMEM + ((y*video_num_columns*params->bytes_per_char_v+x)*bytes_per_char_h);
-                       ll_write_char(ptr, c|(white<<16));
-                       if ( ++x >= video_num_columns ) {
-                               x = 0;
-                               if ( ++y >= video_num_lines ) {
-                                       y--;
-                               }
-                       }
-               }
-       }
-
-       params->video_x = x;
-       params->video_y = y;
-}
-
-static void error(char *x);
-
-/*
- * Setup for decompression
- */
-static void arch_decomp_setup(void)
-{
-       int i;
-       
-       video_num_lines = params->video_num_rows;
-       video_num_columns = params->video_num_cols;
-       bytes_per_char_h = params->bytes_per_char_h;
-       video_size_row = video_num_columns * bytes_per_char_h;
-       if (bytes_per_char_h == 4)
-               for (i = 0; i < 256; i++)
-                       con_charconvtable[i] =
-                               (i & 128 ? 1 << 0  : 0) |
-                               (i & 64  ? 1 << 4  : 0) |
-                               (i & 32  ? 1 << 8  : 0) |
-                               (i & 16  ? 1 << 12 : 0) |
-                               (i & 8   ? 1 << 16 : 0) |
-                               (i & 4   ? 1 << 20 : 0) |
-                               (i & 2   ? 1 << 24 : 0) |
-                               (i & 1   ? 1 << 28 : 0);
-       else
-               for (i = 0; i < 16; i++)
-                       con_charconvtable[i] =
-                               (i & 8   ? 1 << 0  : 0) |
-                               (i & 4   ? 1 << 8  : 0) |
-                               (i & 2   ? 1 << 16 : 0) |
-                               (i & 1   ? 1 << 24 : 0);
-
-       white = bytes_per_char_h == 8 ? 0xfc : 7;
-
-       if (params->nr_pages * params->page_size < 4096*1024) error("<4M of mem\n");
-}
-
-/*
- * nothing to do
- */
-#define arch_decomp_wdog()
diff --git a/include/asm-arm26/unistd.h b/include/asm-arm26/unistd.h
deleted file mode 100644 (file)
index 4c3b919..0000000
+++ /dev/null
@@ -1,343 +0,0 @@
-/*
- *  linux/include/asm-arm/unistd.h
- *
- *  Copyright (C) 2001-2003 Russell King
- *  Modified 25/11/04 Ian Molton for arm26.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * Please forward _all_ changes to this file to spyro@f2s.com
- * no matter what the change is.  Thanks!
- */
-#ifndef __ASM_ARM_UNISTD_H
-#define __ASM_ARM_UNISTD_H
-
-#define __NR_SYSCALL_BASE      0x900000
-
-/*
- * This file contains the system call numbers.
- */
-
-#define __NR_restart_syscall           (__NR_SYSCALL_BASE+  0)
-#define __NR_exit                      (__NR_SYSCALL_BASE+  1)
-#define __NR_fork                      (__NR_SYSCALL_BASE+  2)
-#define __NR_read                      (__NR_SYSCALL_BASE+  3)
-#define __NR_write                     (__NR_SYSCALL_BASE+  4)
-#define __NR_open                      (__NR_SYSCALL_BASE+  5)
-#define __NR_close                     (__NR_SYSCALL_BASE+  6)
-                                       /* 7 was sys_waitpid */
-#define __NR_creat                     (__NR_SYSCALL_BASE+  8)
-#define __NR_link                      (__NR_SYSCALL_BASE+  9)
-#define __NR_unlink                    (__NR_SYSCALL_BASE+ 10)
-#define __NR_execve                    (__NR_SYSCALL_BASE+ 11)
-#define __NR_chdir                     (__NR_SYSCALL_BASE+ 12)
-#define __NR_time                      (__NR_SYSCALL_BASE+ 13)
-#define __NR_mknod                     (__NR_SYSCALL_BASE+ 14)
-#define __NR_chmod                     (__NR_SYSCALL_BASE+ 15)
-#define __NR_lchown                    (__NR_SYSCALL_BASE+ 16)
-                                       /* 17 was sys_break */
-                                       /* 18 was sys_stat */
-#define __NR_lseek                     (__NR_SYSCALL_BASE+ 19)
-#define __NR_getpid                    (__NR_SYSCALL_BASE+ 20)
-#define __NR_mount                     (__NR_SYSCALL_BASE+ 21)
-#define __NR_umount                    (__NR_SYSCALL_BASE+ 22)
-#define __NR_setuid                    (__NR_SYSCALL_BASE+ 23)
-#define __NR_getuid                    (__NR_SYSCALL_BASE+ 24)
-#define __NR_stime                     (__NR_SYSCALL_BASE+ 25)
-#define __NR_ptrace                    (__NR_SYSCALL_BASE+ 26)
-#define __NR_alarm                     (__NR_SYSCALL_BASE+ 27)
-                                       /* 28 was sys_fstat */
-#define __NR_pause                     (__NR_SYSCALL_BASE+ 29)
-#define __NR_utime                     (__NR_SYSCALL_BASE+ 30)
-                                       /* 31 was sys_stty */
-                                       /* 32 was sys_gtty */
-#define __NR_access                    (__NR_SYSCALL_BASE+ 33)
-#define __NR_nice                      (__NR_SYSCALL_BASE+ 34)
-                                       /* 35 was sys_ftime */
-#define __NR_sync                      (__NR_SYSCALL_BASE+ 36)
-#define __NR_kill                      (__NR_SYSCALL_BASE+ 37)
-#define __NR_rename                    (__NR_SYSCALL_BASE+ 38)
-#define __NR_mkdir                     (__NR_SYSCALL_BASE+ 39)
-#define __NR_rmdir                     (__NR_SYSCALL_BASE+ 40)
-#define __NR_dup                       (__NR_SYSCALL_BASE+ 41)
-#define __NR_pipe                      (__NR_SYSCALL_BASE+ 42)
-#define __NR_times                     (__NR_SYSCALL_BASE+ 43)
-                                       /* 44 was sys_prof */
-#define __NR_brk                       (__NR_SYSCALL_BASE+ 45)
-#define __NR_setgid                    (__NR_SYSCALL_BASE+ 46)
-#define __NR_getgid                    (__NR_SYSCALL_BASE+ 47)
-                                       /* 48 was sys_signal */
-#define __NR_geteuid                   (__NR_SYSCALL_BASE+ 49)
-#define __NR_getegid                   (__NR_SYSCALL_BASE+ 50)
-#define __NR_acct                      (__NR_SYSCALL_BASE+ 51)
-#define __NR_umount2                   (__NR_SYSCALL_BASE+ 52)
-                                       /* 53 was sys_lock */
-#define __NR_ioctl                     (__NR_SYSCALL_BASE+ 54)
-#define __NR_fcntl                     (__NR_SYSCALL_BASE+ 55)
-                                       /* 56 was sys_mpx */
-#define __NR_setpgid                   (__NR_SYSCALL_BASE+ 57)
-                                       /* 58 was sys_ulimit */
-                                       /* 59 was sys_olduname */
-#define __NR_umask                     (__NR_SYSCALL_BASE+ 60)
-#define __NR_chroot                    (__NR_SYSCALL_BASE+ 61)
-#define __NR_ustat                     (__NR_SYSCALL_BASE+ 62)
-#define __NR_dup2                      (__NR_SYSCALL_BASE+ 63)
-#define __NR_getppid                   (__NR_SYSCALL_BASE+ 64)
-#define __NR_getpgrp                   (__NR_SYSCALL_BASE+ 65)
-#define __NR_setsid                    (__NR_SYSCALL_BASE+ 66)
-#define __NR_sigaction                 (__NR_SYSCALL_BASE+ 67)
-                                       /* 68 was sys_sgetmask */
-                                       /* 69 was sys_ssetmask */
-#define __NR_setreuid                  (__NR_SYSCALL_BASE+ 70)
-#define __NR_setregid                  (__NR_SYSCALL_BASE+ 71)
-#define __NR_sigsuspend                        (__NR_SYSCALL_BASE+ 72)
-#define __NR_sigpending                        (__NR_SYSCALL_BASE+ 73)
-#define __NR_sethostname               (__NR_SYSCALL_BASE+ 74)
-#define __NR_setrlimit                 (__NR_SYSCALL_BASE+ 75)
-#define __NR_getrlimit                 (__NR_SYSCALL_BASE+ 76) /* Back compat 2GB limited rlimit */
-#define __NR_getrusage                 (__NR_SYSCALL_BASE+ 77)
-#define __NR_gettimeofday              (__NR_SYSCALL_BASE+ 78)
-#define __NR_settimeofday              (__NR_SYSCALL_BASE+ 79)
-#define __NR_getgroups                 (__NR_SYSCALL_BASE+ 80)
-#define __NR_setgroups                 (__NR_SYSCALL_BASE+ 81)
-#define __NR_select                    (__NR_SYSCALL_BASE+ 82)
-#define __NR_symlink                   (__NR_SYSCALL_BASE+ 83)
-                                       /* 84 was sys_lstat */
-#define __NR_readlink                  (__NR_SYSCALL_BASE+ 85)
-#define __NR_uselib                    (__NR_SYSCALL_BASE+ 86)
-#define __NR_swapon                    (__NR_SYSCALL_BASE+ 87)
-#define __NR_reboot                    (__NR_SYSCALL_BASE+ 88)
-#define __NR_readdir                   (__NR_SYSCALL_BASE+ 89)
-#define __NR_mmap                      (__NR_SYSCALL_BASE+ 90)
-#define __NR_munmap                    (__NR_SYSCALL_BASE+ 91)
-#define __NR_truncate                  (__NR_SYSCALL_BASE+ 92)
-#define __NR_ftruncate                 (__NR_SYSCALL_BASE+ 93)
-#define __NR_fchmod                    (__NR_SYSCALL_BASE+ 94)
-#define __NR_fchown                    (__NR_SYSCALL_BASE+ 95)
-#define __NR_getpriority               (__NR_SYSCALL_BASE+ 96)
-#define __NR_setpriority               (__NR_SYSCALL_BASE+ 97)
-                                       /* 98 was sys_profil */
-#define __NR_statfs                    (__NR_SYSCALL_BASE+ 99)
-#define __NR_fstatfs                   (__NR_SYSCALL_BASE+100)
-                                       /* 101 was sys_ioperm */
-#define __NR_socketcall                        (__NR_SYSCALL_BASE+102)
-#define __NR_syslog                    (__NR_SYSCALL_BASE+103)
-#define __NR_setitimer                 (__NR_SYSCALL_BASE+104)
-#define __NR_getitimer                 (__NR_SYSCALL_BASE+105)
-#define __NR_stat                      (__NR_SYSCALL_BASE+106)
-#define __NR_lstat                     (__NR_SYSCALL_BASE+107)
-#define __NR_fstat                     (__NR_SYSCALL_BASE+108)
-                                       /* 109 was sys_uname */
-                                       /* 110 was sys_iopl */
-#define __NR_vhangup                   (__NR_SYSCALL_BASE+111)
-                                       /* 112 was sys_idle */
-#define __NR_syscall                   (__NR_SYSCALL_BASE+113) /* syscall to call a syscall! */
-#define __NR_wait4                     (__NR_SYSCALL_BASE+114)
-#define __NR_swapoff                   (__NR_SYSCALL_BASE+115)
-#define __NR_sysinfo                   (__NR_SYSCALL_BASE+116)
-#define __NR_ipc                       (__NR_SYSCALL_BASE+117)
-#define __NR_fsync                     (__NR_SYSCALL_BASE+118)
-#define __NR_sigreturn                 (__NR_SYSCALL_BASE+119)
-#define __NR_clone                     (__NR_SYSCALL_BASE+120)
-#define __NR_setdomainname             (__NR_SYSCALL_BASE+121)
-#define __NR_uname                     (__NR_SYSCALL_BASE+122)
-                                       /* 123 was sys_modify_ldt */
-#define __NR_adjtimex                  (__NR_SYSCALL_BASE+124)
-#define __NR_mprotect                  (__NR_SYSCALL_BASE+125)
-#define __NR_sigprocmask               (__NR_SYSCALL_BASE+126)
-                                       /* 127 was sys_create_module */
-#define __NR_init_module               (__NR_SYSCALL_BASE+128)
-#define __NR_delete_module             (__NR_SYSCALL_BASE+129)
-                                       /* 130 was sys_get_kernel_syms */
-#define __NR_quotactl                  (__NR_SYSCALL_BASE+131)
-#define __NR_getpgid                   (__NR_SYSCALL_BASE+132)
-#define __NR_fchdir                    (__NR_SYSCALL_BASE+133)
-#define __NR_bdflush                   (__NR_SYSCALL_BASE+134)
-#define __NR_sysfs                     (__NR_SYSCALL_BASE+135)
-#define __NR_personality               (__NR_SYSCALL_BASE+136)
-                                       /* 137 was sys_afs_syscall */
-#define __NR_setfsuid                  (__NR_SYSCALL_BASE+138)
-#define __NR_setfsgid                  (__NR_SYSCALL_BASE+139)
-#define __NR__llseek                   (__NR_SYSCALL_BASE+140)
-#define __NR_getdents                  (__NR_SYSCALL_BASE+141)
-#define __NR__newselect                        (__NR_SYSCALL_BASE+142)
-#define __NR_flock                     (__NR_SYSCALL_BASE+143)
-#define __NR_msync                     (__NR_SYSCALL_BASE+144)
-#define __NR_readv                     (__NR_SYSCALL_BASE+145)
-#define __NR_writev                    (__NR_SYSCALL_BASE+146)
-#define __NR_getsid                    (__NR_SYSCALL_BASE+147)
-#define __NR_fdatasync                 (__NR_SYSCALL_BASE+148)
-#define __NR__sysctl                   (__NR_SYSCALL_BASE+149)
-#define __NR_mlock                     (__NR_SYSCALL_BASE+150)
-#define __NR_munlock                   (__NR_SYSCALL_BASE+151)
-#define __NR_mlockall                  (__NR_SYSCALL_BASE+152)
-#define __NR_munlockall                        (__NR_SYSCALL_BASE+153)
-#define __NR_sched_setparam            (__NR_SYSCALL_BASE+154)
-#define __NR_sched_getparam            (__NR_SYSCALL_BASE+155)
-#define __NR_sched_setscheduler                (__NR_SYSCALL_BASE+156)
-#define __NR_sched_getscheduler                (__NR_SYSCALL_BASE+157)
-#define __NR_sched_yield               (__NR_SYSCALL_BASE+158)
-#define __NR_sched_get_priority_max    (__NR_SYSCALL_BASE+159)
-#define __NR_sched_get_priority_min    (__NR_SYSCALL_BASE+160)
-#define __NR_sched_rr_get_interval     (__NR_SYSCALL_BASE+161)
-#define __NR_nanosleep                 (__NR_SYSCALL_BASE+162)
-#define __NR_mremap                    (__NR_SYSCALL_BASE+163)
-#define __NR_setresuid                 (__NR_SYSCALL_BASE+164)
-#define __NR_getresuid                 (__NR_SYSCALL_BASE+165)
-                                       /* 166 was sys_vm86 */
-                                       /* 167 was sys_query_module */
-#define __NR_poll                      (__NR_SYSCALL_BASE+168)
-#define __NR_nfsservctl                        (__NR_SYSCALL_BASE+169)
-#define __NR_setresgid                 (__NR_SYSCALL_BASE+170)
-#define __NR_getresgid                 (__NR_SYSCALL_BASE+171)
-#define __NR_prctl                     (__NR_SYSCALL_BASE+172)
-#define __NR_rt_sigreturn              (__NR_SYSCALL_BASE+173)
-#define __NR_rt_sigaction              (__NR_SYSCALL_BASE+174)
-#define __NR_rt_sigprocmask            (__NR_SYSCALL_BASE+175)
-#define __NR_rt_sigpending             (__NR_SYSCALL_BASE+176)
-#define __NR_rt_sigtimedwait           (__NR_SYSCALL_BASE+177)
-#define __NR_rt_sigqueueinfo           (__NR_SYSCALL_BASE+178)
-#define __NR_rt_sigsuspend             (__NR_SYSCALL_BASE+179)
-#define __NR_pread64                   (__NR_SYSCALL_BASE+180)
-#define __NR_pwrite64                  (__NR_SYSCALL_BASE+181)
-#define __NR_chown                     (__NR_SYSCALL_BASE+182)
-#define __NR_getcwd                    (__NR_SYSCALL_BASE+183)
-#define __NR_capget                    (__NR_SYSCALL_BASE+184)
-#define __NR_capset                    (__NR_SYSCALL_BASE+185)
-#define __NR_sigaltstack               (__NR_SYSCALL_BASE+186)
-#define __NR_sendfile                  (__NR_SYSCALL_BASE+187)
-                                       /* 188 reserved */
-                                       /* 189 reserved */
-#define __NR_vfork                     (__NR_SYSCALL_BASE+190)
-#define __NR_ugetrlimit                        (__NR_SYSCALL_BASE+191) /* SuS compliant getrlimit */
-#define __NR_mmap2                     (__NR_SYSCALL_BASE+192)
-#define __NR_truncate64                        (__NR_SYSCALL_BASE+193)
-#define __NR_ftruncate64               (__NR_SYSCALL_BASE+194)
-#define __NR_stat64                    (__NR_SYSCALL_BASE+195)
-#define __NR_lstat64                   (__NR_SYSCALL_BASE+196)
-#define __NR_fstat64                   (__NR_SYSCALL_BASE+197)
-#define __NR_lchown32                  (__NR_SYSCALL_BASE+198)
-#define __NR_getuid32                  (__NR_SYSCALL_BASE+199)
-#define __NR_getgid32                  (__NR_SYSCALL_BASE+200)
-#define __NR_geteuid32                 (__NR_SYSCALL_BASE+201)
-#define __NR_getegid32                 (__NR_SYSCALL_BASE+202)
-#define __NR_setreuid32                        (__NR_SYSCALL_BASE+203)
-#define __NR_setregid32                        (__NR_SYSCALL_BASE+204)
-#define __NR_getgroups32               (__NR_SYSCALL_BASE+205)
-#define __NR_setgroups32               (__NR_SYSCALL_BASE+206)
-#define __NR_fchown32                  (__NR_SYSCALL_BASE+207)
-#define __NR_setresuid32               (__NR_SYSCALL_BASE+208)
-#define __NR_getresuid32               (__NR_SYSCALL_BASE+209)
-#define __NR_setresgid32               (__NR_SYSCALL_BASE+210)
-#define __NR_getresgid32               (__NR_SYSCALL_BASE+211)
-#define __NR_chown32                   (__NR_SYSCALL_BASE+212)
-#define __NR_setuid32                  (__NR_SYSCALL_BASE+213)
-#define __NR_setgid32                  (__NR_SYSCALL_BASE+214)
-#define __NR_setfsuid32                        (__NR_SYSCALL_BASE+215)
-#define __NR_setfsgid32                        (__NR_SYSCALL_BASE+216)
-#define __NR_getdents64                        (__NR_SYSCALL_BASE+217)
-#define __NR_pivot_root                        (__NR_SYSCALL_BASE+218)
-#define __NR_mincore                   (__NR_SYSCALL_BASE+219)
-#define __NR_madvise                   (__NR_SYSCALL_BASE+220)
-#define __NR_fcntl64                   (__NR_SYSCALL_BASE+221)
-                                       /* 222 for tux */
-                                       /* 223 is unused */
-#define __NR_gettid                    (__NR_SYSCALL_BASE+224)
-#define __NR_readahead                 (__NR_SYSCALL_BASE+225)
-#define __NR_setxattr                  (__NR_SYSCALL_BASE+226)
-#define __NR_lsetxattr                 (__NR_SYSCALL_BASE+227)
-#define __NR_fsetxattr                 (__NR_SYSCALL_BASE+228)
-#define __NR_getxattr                  (__NR_SYSCALL_BASE+229)
-#define __NR_lgetxattr                 (__NR_SYSCALL_BASE+230)
-#define __NR_fgetxattr                 (__NR_SYSCALL_BASE+231)
-#define __NR_listxattr                 (__NR_SYSCALL_BASE+232)
-#define __NR_llistxattr                        (__NR_SYSCALL_BASE+233)
-#define __NR_flistxattr                        (__NR_SYSCALL_BASE+234)
-#define __NR_removexattr               (__NR_SYSCALL_BASE+235)
-#define __NR_lremovexattr              (__NR_SYSCALL_BASE+236)
-#define __NR_fremovexattr              (__NR_SYSCALL_BASE+237)
-#define __NR_tkill                     (__NR_SYSCALL_BASE+238)
-#define __NR_sendfile64                        (__NR_SYSCALL_BASE+239)
-#define __NR_futex                     (__NR_SYSCALL_BASE+240)
-#define __NR_sched_setaffinity         (__NR_SYSCALL_BASE+241)
-#define __NR_sched_getaffinity         (__NR_SYSCALL_BASE+242)
-#define __NR_io_setup                  (__NR_SYSCALL_BASE+243)
-#define __NR_io_destroy                        (__NR_SYSCALL_BASE+244)
-#define __NR_io_getevents              (__NR_SYSCALL_BASE+245)
-#define __NR_io_submit                 (__NR_SYSCALL_BASE+246)
-#define __NR_io_cancel                 (__NR_SYSCALL_BASE+247)
-#define __NR_exit_group                        (__NR_SYSCALL_BASE+248)
-#define __NR_lookup_dcookie            (__NR_SYSCALL_BASE+249)
-#define __NR_epoll_create              (__NR_SYSCALL_BASE+250)
-#define __NR_epoll_ctl                 (__NR_SYSCALL_BASE+251)
-#define __NR_epoll_wait                        (__NR_SYSCALL_BASE+252)
-#define __NR_remap_file_pages          (__NR_SYSCALL_BASE+253)
-                                       /* 254 for set_thread_area */
-                                       /* 255 for get_thread_area */
-                                       /* 256 for set_tid_address */
-#define __NR_timer_create              (__NR_SYSCALL_BASE+257)
-#define __NR_timer_settime             (__NR_SYSCALL_BASE+258)
-#define __NR_timer_gettime             (__NR_SYSCALL_BASE+259)
-#define __NR_timer_getoverrun          (__NR_SYSCALL_BASE+260)
-#define __NR_timer_delete              (__NR_SYSCALL_BASE+261)
-#define __NR_clock_settime             (__NR_SYSCALL_BASE+262)
-#define __NR_clock_gettime             (__NR_SYSCALL_BASE+263)
-#define __NR_clock_getres              (__NR_SYSCALL_BASE+264)
-#define __NR_clock_nanosleep           (__NR_SYSCALL_BASE+265)
-#define __NR_statfs64                  (__NR_SYSCALL_BASE+266)
-#define __NR_fstatfs64                 (__NR_SYSCALL_BASE+267)
-#define __NR_tgkill                    (__NR_SYSCALL_BASE+268)
-#define __NR_utimes                    (__NR_SYSCALL_BASE+269)
-#define __NR_fadvise64_64              (__NR_SYSCALL_BASE+270)
-#define __NR_pciconfig_iobase          (__NR_SYSCALL_BASE+271)
-#define __NR_pciconfig_read            (__NR_SYSCALL_BASE+272)
-#define __NR_pciconfig_write           (__NR_SYSCALL_BASE+273)
-#define __NR_mq_open                   (__NR_SYSCALL_BASE+274)
-#define __NR_mq_unlink                 (__NR_SYSCALL_BASE+275)
-#define __NR_mq_timedsend              (__NR_SYSCALL_BASE+276)
-#define __NR_mq_timedreceive           (__NR_SYSCALL_BASE+277)
-#define __NR_mq_notify                 (__NR_SYSCALL_BASE+278)
-#define __NR_mq_getsetattr             (__NR_SYSCALL_BASE+279)
-#define __NR_waitid                    (__NR_SYSCALL_BASE+280)
-
-/*
- * The following SWIs are ARM private. FIXME - make appropriate for arm26
- */
-#define __ARM_NR_BASE                  (__NR_SYSCALL_BASE+0x0f0000)
-#define __ARM_NR_breakpoint            (__ARM_NR_BASE+1)
-#define __ARM_NR_cacheflush            (__ARM_NR_BASE+2)
-#define __ARM_NR_usr26                 (__ARM_NR_BASE+3)
-
-#ifdef __KERNEL__
-
-#define __ARCH_WANT_IPC_PARSE_VERSION
-#define __ARCH_WANT_OLD_READDIR
-#define __ARCH_WANT_STAT64
-#define __ARCH_WANT_SYS_ALARM
-#define __ARCH_WANT_SYS_GETHOSTNAME
-#define __ARCH_WANT_SYS_PAUSE
-#define __ARCH_WANT_SYS_TIME
-#define __ARCH_WANT_SYS_UTIME
-#define __ARCH_WANT_SYS_SOCKETCALL
-#define __ARCH_WANT_SYS_FADVISE64
-#define __ARCH_WANT_SYS_GETPGRP
-#define __ARCH_WANT_SYS_LLSEEK
-#define __ARCH_WANT_SYS_NICE
-#define __ARCH_WANT_SYS_OLD_GETRLIMIT
-#define __ARCH_WANT_SYS_OLDUMOUNT
-#define __ARCH_WANT_SYS_SIGPENDING
-#define __ARCH_WANT_SYS_SIGPROCMASK
-#define __ARCH_WANT_SYS_RT_SIGACTION
-
-/*
- * "Conditional" syscalls
- *
- * What we want is __attribute__((weak,alias("sys_ni_syscall"))),
- * but it doesn't work on all toolchains, so we just do it by hand
- */
-#define cond_syscall(x) asm(".weak\t" #x "\n\t.set\t" #x ",sys_ni_syscall")
-
-#endif /* __KERNEL__ */
-#endif /* __ASM_ARM_UNISTD_H */
diff --git a/include/asm-arm26/user.h b/include/asm-arm26/user.h
deleted file mode 100644 (file)
index 3e8b0f8..0000000
+++ /dev/null
@@ -1,84 +0,0 @@
-#ifndef _ARM_USER_H
-#define _ARM_USER_H
-
-#include <asm/page.h>
-#include <asm/ptrace.h>
-/* Core file format: The core file is written in such a way that gdb
-   can understand it and provide useful information to the user (under
-   linux we use the 'trad-core' bfd).  There are quite a number of
-   obstacles to being able to view the contents of the floating point
-   registers, and until these are solved you will not be able to view the
-   contents of them.  Actually, you can read in the core file and look at
-   the contents of the user struct to find out what the floating point
-   registers contain.
-   The actual file contents are as follows:
-   UPAGE: 1 page consisting of a user struct that tells gdb what is present
-   in the file.  Directly after this is a copy of the task_struct, which
-   is currently not used by gdb, but it may come in useful at some point.
-   All of the registers are stored as part of the upage.  The upage should
-   always be only one page.
-   DATA: The data area is stored.  We use current->end_text to
-   current->brk to pick up all of the user variables, plus any memory
-   that may have been malloced.  No attempt is made to determine if a page
-   is demand-zero or if a page is totally unused, we just cover the entire
-   range.  All of the addresses are rounded in such a way that an integral
-   number of pages is written.
-   STACK: We need the stack information in order to get a meaningful
-   backtrace.  We need to write the data from (esp) to
-   current->start_stack, so we round each of these off in order to be able
-   to write an integer number of pages.
-   The minimum core file size is 3 pages, or 12288 bytes.
-*/
-
-struct user_fp {
-       struct fp_reg {
-               unsigned int sign1:1;
-               unsigned int unused:15;
-               unsigned int sign2:1;
-               unsigned int exponent:14;
-               unsigned int j:1;
-               unsigned int mantissa1:31;
-               unsigned int mantissa0:32;
-       } fpregs[8];
-       unsigned int fpsr:32;
-       unsigned int fpcr:32;
-       unsigned char ftype[8];
-       unsigned int init_flag;
-};
-
-/* When the kernel dumps core, it starts by dumping the user struct -
-   this will be used by gdb to figure out where the data and stack segments
-   are within the file, and what virtual addresses to use. */
-struct user{
-/* We start with the registers, to mimic the way that "memory" is returned
-   from the ptrace(3,...) function.  */
-  struct pt_regs regs;         /* Where the registers are actually stored */
-/* ptrace does not yet supply these.  Someday.... */
-  int u_fpvalid;               /* True if math co-processor being used. */
-                                /* for this mess. Not yet used. */
-/* The rest of this junk is to help gdb figure out what goes where */
-  unsigned long int u_tsize;   /* Text segment size (pages). */
-  unsigned long int u_dsize;   /* Data segment size (pages). */
-  unsigned long int u_ssize;   /* Stack segment size (pages). */
-  unsigned long start_code;     /* Starting virtual address of text. */
-  unsigned long start_stack;   /* Starting virtual address of stack area.
-                                  This is actually the bottom of the stack,
-                                  the top of the stack is always found in the
-                                  esp register.  */
-  long int signal;                     /* Signal that caused the core dump. */
-  int reserved;                        /* No longer used */
-  struct pt_regs * u_ar0;      /* Used by gdb to help find the values for */
-                               /* the registers. */
-  unsigned long magic;         /* To uniquely identify a core file */
-  char u_comm[32];             /* User command that was responsible */
-  int u_debugreg[8];
-  struct user_fp u_fp;         /* FP state */
-  struct user_fp_struct * u_fp0;/* Used by gdb to help find the values for */
-                               /* the FP registers. */
-};
-#define NBPG PAGE_SIZE
-#define UPAGES 1
-#define HOST_TEXT_START_ADDR (u.start_code)
-#define HOST_STACK_END_ADDR (u.start_stack + u.u_ssize * NBPG)
-
-#endif /* _ARM_USER_H */
diff --git a/include/asm-arm26/xor.h b/include/asm-arm26/xor.h
deleted file mode 100644 (file)
index e7c4cf5..0000000
+++ /dev/null
@@ -1,141 +0,0 @@
-/*
- *  linux/include/asm-arm/xor.h
- *
- *  Copyright (C) 2001 Russell King
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- */
-#include <asm-generic/xor.h>
-
-#define __XOR(a1, a2) a1 ^= a2
-
-#define GET_BLOCK_2(dst) \
-       __asm__("ldmia  %0, {%1, %2}" \
-               : "=r" (dst), "=r" (a1), "=r" (a2) \
-               : "0" (dst))
-
-#define GET_BLOCK_4(dst) \
-       __asm__("ldmia  %0, {%1, %2, %3, %4}" \
-               : "=r" (dst), "=r" (a1), "=r" (a2), "=r" (a3), "=r" (a4) \
-               : "0" (dst))
-
-#define XOR_BLOCK_2(src) \
-       __asm__("ldmia  %0!, {%1, %2}" \
-               : "=r" (src), "=r" (b1), "=r" (b2) \
-               : "0" (src)); \
-       __XOR(a1, b1); __XOR(a2, b2);
-
-#define XOR_BLOCK_4(src) \
-       __asm__("ldmia  %0!, {%1, %2, %3, %4}" \
-               : "=r" (src), "=r" (b1), "=r" (b2), "=r" (b3), "=r" (b4) \
-               : "0" (src)); \
-       __XOR(a1, b1); __XOR(a2, b2); __XOR(a3, b3); __XOR(a4, b4)
-
-#define PUT_BLOCK_2(dst) \
-       __asm__ __volatile__("stmia     %0!, {%2, %3}" \
-               : "=r" (dst) \
-               : "0" (dst), "r" (a1), "r" (a2))
-
-#define PUT_BLOCK_4(dst) \
-       __asm__ __volatile__("stmia     %0!, {%2, %3, %4, %5}" \
-               : "=r" (dst) \
-               : "0" (dst), "r" (a1), "r" (a2), "r" (a3), "r" (a4))
-
-static void
-xor_arm4regs_2(unsigned long bytes, unsigned long *p1, unsigned long *p2)
-{
-       unsigned int lines = bytes / sizeof(unsigned long) / 4;
-       register unsigned int a1 __asm__("r4");
-       register unsigned int a2 __asm__("r5");
-       register unsigned int a3 __asm__("r6");
-       register unsigned int a4 __asm__("r7");
-       register unsigned int b1 __asm__("r8");
-       register unsigned int b2 __asm__("r9");
-       register unsigned int b3 __asm__("ip");
-       register unsigned int b4 __asm__("lr");
-
-       do {
-               GET_BLOCK_4(p1);
-               XOR_BLOCK_4(p2);
-               PUT_BLOCK_4(p1);
-       } while (--lines);
-}
-
-static void
-xor_arm4regs_3(unsigned long bytes, unsigned long *p1, unsigned long *p2,
-               unsigned long *p3)
-{
-       unsigned int lines = bytes / sizeof(unsigned long) / 4;
-       register unsigned int a1 __asm__("r4");
-       register unsigned int a2 __asm__("r5");
-       register unsigned int a3 __asm__("r6");
-       register unsigned int a4 __asm__("r7");
-       register unsigned int b1 __asm__("r8");
-       register unsigned int b2 __asm__("r9");
-       register unsigned int b3 __asm__("ip");
-       register unsigned int b4 __asm__("lr");
-
-       do {
-               GET_BLOCK_4(p1);
-               XOR_BLOCK_4(p2);
-               XOR_BLOCK_4(p3);
-               PUT_BLOCK_4(p1);
-       } while (--lines);
-}
-
-static void
-xor_arm4regs_4(unsigned long bytes, unsigned long *p1, unsigned long *p2,
-               unsigned long *p3, unsigned long *p4)
-{
-       unsigned int lines = bytes / sizeof(unsigned long) / 2;
-       register unsigned int a1 __asm__("r8");
-       register unsigned int a2 __asm__("r9");
-       register unsigned int b1 __asm__("ip");
-       register unsigned int b2 __asm__("lr");
-
-       do {
-               GET_BLOCK_2(p1);
-               XOR_BLOCK_2(p2);
-               XOR_BLOCK_2(p3);
-               XOR_BLOCK_2(p4);
-               PUT_BLOCK_2(p1);
-       } while (--lines);
-}
-
-static void
-xor_arm4regs_5(unsigned long bytes, unsigned long *p1, unsigned long *p2,
-               unsigned long *p3, unsigned long *p4, unsigned long *p5)
-{
-       unsigned int lines = bytes / sizeof(unsigned long) / 2;
-       register unsigned int a1 __asm__("r8");
-       register unsigned int a2 __asm__("r9");
-       register unsigned int b1 __asm__("ip");
-       register unsigned int b2 __asm__("lr");
-
-       do {
-               GET_BLOCK_2(p1);
-               XOR_BLOCK_2(p2);
-               XOR_BLOCK_2(p3);
-               XOR_BLOCK_2(p4);
-               XOR_BLOCK_2(p5);
-               PUT_BLOCK_2(p1);
-       } while (--lines);
-}
-
-static struct xor_block_template xor_block_arm4regs = {
-       .name   = "arm4regs",
-       .do_2   = xor_arm4regs_2,
-       .do_3   = xor_arm4regs_3,
-       .do_4   = xor_arm4regs_4,
-       .do_5   = xor_arm4regs_5,
-};
-
-#undef XOR_TRY_TEMPLATES
-#define XOR_TRY_TEMPLATES                      \
-       do {                                    \
-               xor_speed(&xor_block_arm4regs); \
-               xor_speed(&xor_block_8regs);    \
-               xor_speed(&xor_block_32regs);   \
-       } while (0)
index afdcd79a2966daa220a05b44f181cdf4138fed1a..331d45bab18f3b13e4eaf4faa4aaf6433883f924 100644 (file)
@@ -57,7 +57,7 @@
 
 #define WARN_ON(condition)                                                     \
        ({                                                              \
-               typeof(condition) __ret_warn_on = (condition);          \
+               int __ret_warn_on = !!(condition);                      \
                if (unlikely(__ret_warn_on))                            \
                        _BUG_OR_WARN(BUGFLAG_WARNING);                  \
                unlikely(__ret_warn_on);                                \
index a2e606dd4f4a8bc3ba465fbd205a12cf6475925a..17dacf3f36d39bf8ef820a5a7b5c509dfe1a7a5b 100644 (file)
@@ -74,20 +74,18 @@ static inline struct thread_info *current_thread_info(void)
  * - other flags in MSW
  */
 #define TIF_SYSCALL_TRACE       0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME       1       /* resumption notification requested */
-#define TIF_SIGPENDING          2       /* signal pending */
-#define TIF_NEED_RESCHED        3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG      4       /* true if poll_idle() is polling
+#define TIF_SIGPENDING          1       /* signal pending */
+#define TIF_NEED_RESCHED        2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG      3       /* true if poll_idle() is polling
                                           TIF_NEED_RESCHED */
-#define TIF_BREAKPOINT         5       /* true if we should break after return */
-#define TIF_SINGLE_STEP                6       /* single step after next break */
-#define TIF_MEMDIE             7
-#define TIF_RESTORE_SIGMASK    8       /* restore signal mask in do_signal */
-#define TIF_CPU_GOING_TO_SLEEP 9       /* CPU is entering sleep 0 mode */
+#define TIF_BREAKPOINT         4       /* true if we should break after return */
+#define TIF_SINGLE_STEP                5       /* single step after next break */
+#define TIF_MEMDIE             6
+#define TIF_RESTORE_SIGMASK    7       /* restore signal mask in do_signal */
+#define TIF_CPU_GOING_TO_SLEEP 8       /* CPU is entering sleep 0 mode */
 #define TIF_USERSPACE          31      /* true if FS sets userspace */
 
 #define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1 << TIF_POLLING_NRFLAG)
index c4d6cbbf96d490283df0a12fb6375f63f16a16b1..a970781a0f98a25cad63f9202164f0674d572022 100644 (file)
@@ -61,6 +61,7 @@ extern void bfin_dcache_init(void);
 extern int read_iloc(void);
 extern int bfin_console_init(void);
 extern asmlinkage void lower_to_irq14(void);
+extern void init_exception_vectors(void);
 extern void init_dma(void);
 extern void program_IAR(void);
 extern void evt14_softirq(void);
index 98d35a9291165d61cacc8167ac24b48d5724be1b..cdf29e75ea598922b3091c6e7c526dffd92e31cb 100644 (file)
@@ -242,6 +242,39 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val)
 #define bfin_read_TWI0_RCV_DATA16()            bfin_read16(TWI0_RCV_DATA16)
 #define bfin_write_TWI0_RCV_DATA16(val)                bfin_write16(TWI0_RCV_DATA16, val)
 
+#define bfin_read_TWI_CLKDIV()                 bfin_read16(TWI0_CLKDIV)
+#define bfin_write_TWI_CLKDIV(val)             bfin_write16(TWI0_CLKDIV, val)
+#define bfin_read_TWI_CONTROL()                        bfin_read16(TWI0_CONTROL)
+#define bfin_write_TWI_CONTROL(val)            bfin_write16(TWI0_CONTROL, val)
+#define bfin_read_TWI_SLAVE_CTRL()             bfin_read16(TWI0_SLAVE_CTRL)
+#define bfin_write_TWI_SLAVE_CTRL(val)         bfin_write16(TWI0_SLAVE_CTRL, val)
+#define bfin_read_TWI_SLAVE_STAT()             bfin_read16(TWI0_SLAVE_STAT)
+#define bfin_write_TWI_SLAVE_STAT(val)         bfin_write16(TWI0_SLAVE_STAT, val)
+#define bfin_read_TWI_SLAVE_ADDR()             bfin_read16(TWI0_SLAVE_ADDR)
+#define bfin_write_TWI_SLAVE_ADDR(val)         bfin_write16(TWI0_SLAVE_ADDR, val)
+#define bfin_read_TWI_MASTER_CTL()             bfin_read16(TWI0_MASTER_CTRL)
+#define bfin_write_TWI_MASTER_CTL(val)         bfin_write16(TWI0_MASTER_CTRL, val)
+#define bfin_read_TWI_MASTER_STAT()            bfin_read16(TWI0_MASTER_STAT)
+#define bfin_write_TWI_MASTER_STAT(val)                bfin_write16(TWI0_MASTER_STAT, val)
+#define bfin_read_TWI_MASTER_ADDR()            bfin_read16(TWI0_MASTER_ADDR)
+#define bfin_write_TWI_MASTER_ADDR(val)                bfin_write16(TWI0_MASTER_ADDR, val)
+#define bfin_read_TWI_INT_STAT()               bfin_read16(TWI0_INT_STAT)
+#define bfin_write_TWI_INT_STAT(val)           bfin_write16(TWI0_INT_STAT, val)
+#define bfin_read_TWI_INT_MASK()               bfin_read16(TWI0_INT_MASK)
+#define bfin_write_TWI_INT_MASK(val)           bfin_write16(TWI0_INT_MASK, val)
+#define bfin_read_TWI_FIFO_CTL()               bfin_read16(TWI0_FIFO_CTRL)
+#define bfin_write_TWI_FIFO_CTL(val)           bfin_write16(TWI0_FIFO_CTRL, val)
+#define bfin_read_TWI_FIFO_STAT()              bfin_read16(TWI0_FIFO_STAT)
+#define bfin_write_TWI_FIFO_STAT(val)          bfin_write16(TWI0_FIFO_STAT, val)
+#define bfin_read_TWI_XMT_DATA8()              bfin_read16(TWI0_XMT_DATA8)
+#define bfin_write_TWI_XMT_DATA8(val)          bfin_write16(TWI0_XMT_DATA8, val)
+#define bfin_read_TWI_XMT_DATA16()             bfin_read16(TWI0_XMT_DATA16)
+#define bfin_write_TWI_XMT_DATA16(val)         bfin_write16(TWI0_XMT_DATA16, val)
+#define bfin_read_TWI_RCV_DATA8()              bfin_read16(TWI0_RCV_DATA8)
+#define bfin_write_TWI_RCV_DATA8(val)          bfin_write16(TWI0_RCV_DATA8, val)
+#define bfin_read_TWI_RCV_DATA16()             bfin_read16(TWI0_RCV_DATA16)
+#define bfin_write_TWI_RCV_DATA16(val)         bfin_write16(TWI0_RCV_DATA16, val)
+
 /* SPORT0 is not defined in the shared file because it is not available on the ADSP-BF542 and ADSP-BF544 bfin_read_()rocessors */
 
 /* SPORT1 Registers */
index 0b3325bb1fffa97669d6dd0db9083026f9a19d43..e548d3cd81e31b3b0099f4d25536b763b5ea35a3 100644 (file)
@@ -112,6 +112,7 @@ Events         (highest priority)  EMU         0
 #define IRQ_ATAPI_TX   BFIN_IRQ(44)    /* ATAPI TX (DMA11) Interrupt */
 #define IRQ_TWI0       BFIN_IRQ(45)    /* TWI0 Interrupt */
 #define IRQ_TWI1       BFIN_IRQ(46)    /* TWI1 Interrupt */
+#define IRQ_TWI                IRQ_TWI0        /* TWI Interrupt */
 #define IRQ_CAN0_RX    BFIN_IRQ(47)    /* CAN0 Receive Interrupt */
 #define IRQ_CAN0_TX    BFIN_IRQ(48)    /* CAN0 Transmit Interrupt */
 #define IRQ_MDMAS2     BFIN_IRQ(49)    /* MDMA Stream 2 Interrupt */
index 1a8ec9e46922295ecd513de90bd2a608defe534e..6e87ab269ffe577b6ad301a1b8cf11a6723cd06e 100644 (file)
@@ -81,6 +81,12 @@ static __inline__ void bfin_write_VR_CTL(unsigned int val)
 #define bfin_write_PLL_LOCKCNT(val)          bfin_write16(PLL_LOCKCNT,val)
 #define bfin_read_CHIPID()                   bfin_read32(CHIPID)
 
+/* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */
+#define bfin_read_SWRST()                    bfin_read_SICA_SWRST()
+#define bfin_write_SWRST()                   bfin_write_SICA_SWRST()
+#define bfin_read_SYSCR()                    bfin_read_SICA_SYSCR()
+#define bfin_write_SYSCR()                   bfin_write_SICA_SYSCR()
+
 /* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */
 #define bfin_read_SICA_SWRST()               bfin_read16(SICA_SWRST)
 #define bfin_write_SICA_SWRST(val)           bfin_write16(SICA_SWRST,val)
index 89150ecb909d58c1b30402856adf6911a6fee810..0f2dc6e6335b60b108eedbeeed11b8c6a7d495b7 100644 (file)
 #define PLL_LOCKCNT            0xFFC00010      /* PLL Lock Count register (16-bit) */
 #define CHIPID                 0xFFC00014       /* Chip ID Register */
 
+/* For MMR's that are reserved on Core B, set up defines to better integrate with other ports */
+#define SWRST                   SICA_SWRST
+#define SYSCR                   SICA_SYSCR
+
 /* System Reset and Interrupt Controller registers for core A (0xFFC0 0100-0xFFC0 01FF) */
 #define SICA_SWRST              0xFFC00100     /* Software Reset register */
 #define SICA_SYSCR              0xFFC00104     /* System Reset Configuration register */
index fa8f08cf283e2692f6c5291c229721ba96e05287..15b99cf4f50bbbad4a6cf2fe633bfae25b7043bb 100644 (file)
  */
 #define ALIGN_PAGE_MASK         0xffffe000
 
+/*
+ * Size of kernel stack for each process. This must be a power of 2...
+ */
+#define THREAD_SIZE            8192    /* 2 pages */
+
 #ifndef __ASSEMBLY__
 
 typedef unsigned long mm_segment_t;
@@ -76,11 +81,6 @@ struct thread_info {
 #define init_thread_info       (init_thread_union.thread_info)
 #define init_stack             (init_thread_union.stack)
 
-/*
- * Size of kernel stack for each process. This must be a power of 2...
- */
-#define THREAD_SIZE            8192    /* 2 pages */
-
 /* How to get the thread information struct from C */
 
 static inline struct thread_info *current_thread_info(void)
@@ -94,7 +94,7 @@ static inline struct thread_info *current_thread_info(void)
        struct thread_info *ti;
       __asm__("%0 = sp;": "=&d"(ti):
        );
-       return (struct thread_info *)((long)ti & ~8191UL);
+       return (struct thread_info *)((long)ti & ~((long)THREAD_SIZE-1));
 }
 
 /* thread information allocation */
@@ -118,18 +118,16 @@ static inline struct thread_info *current_thread_info(void)
  * thread information flag bit numbers
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG     4       /* true if poll_idle() is polling
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     3       /* true if poll_idle() is polling
                                           TIF_NEED_RESCHED */
-#define TIF_MEMDIE              5
-#define TIF_RESTORE_SIGMASK    6       /* restore signal mask in do_signal() */
-#define TIF_FREEZE              7       /* is freezing for suspend */
+#define TIF_MEMDIE              4
+#define TIF_RESTORE_SIGMASK    5       /* restore signal mask in do_signal() */
+#define TIF_FREEZE              6       /* is freezing for suspend */
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
index 7ad853c3f74e871afcef861d84685c5360b82dce..fde39f6c49c7780ab96beb0b0fa4e90fe6dae40c 100644 (file)
@@ -79,14 +79,12 @@ struct thread_info {
  * - other flags in MSW
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
 #define TIF_POLLING_NRFLAG     16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE             17
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
index b89fd0b56bb30d66abaa6f479781d2ca5998a6cd..e87ef924bfb484224792ab04eb80eb4a7fb52b91 100644 (file)
@@ -36,4 +36,7 @@
 #define __reg_MB86943_pci_sl_io_base   *(volatile uint32_t *) (__region_CS1 + 0x70)
 #define __reg_MB86943_pci_sl_mem_base  *(volatile uint32_t *) (__region_CS1 + 0x78)
 
+#define __reg_MB86943_pci_arbiter      *(volatile uint32_t *) (__region_CS2 + 0x01300014)
+#define MB86943_PCIARB_EN              0x00000001
+
 #endif /* _ASM_MB86943A_H */
index d881f518e6a9272c0eaedf748cd9cf6171c0a757..cc5433e78b5216dfb5560f6ae57b7b4417cf7b95 100644 (file)
@@ -108,18 +108,16 @@ register struct thread_info *__current_thread_info asm("gr15");
  * - other flags in MSW
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_SINGLESTEP         4       /* restore singlestep on return to user mode */
-#define TIF_IRET               5       /* return with iret */
-#define TIF_RESTORE_SIGMASK    6       /* restore signal mask in do_signal() */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_SINGLESTEP         3       /* restore singlestep on return to user mode */
+#define TIF_IRET               4       /* return with iret */
+#define TIF_RESTORE_SIGMASK    5       /* restore signal mask in do_signal() */
 #define TIF_POLLING_NRFLAG     16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE             17      /* OOM killer killed process */
 #define TIF_FREEZE             18      /* freezing for suspend */
 
 #define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
 #define _TIF_SINGLESTEP                (1 << TIF_SINGLESTEP)
index 7306c71a89262a3fd70c533e8790686ed861bad6..cd84f1771e34b306397b99c1dfad730d2de63d22 100644 (file)
 #define __NR_signalfd          321
 #define __NR_timerfd           322
 #define __NR_eventfd           323
+#define __NR_fallocate         324
 
 #ifdef __KERNEL__
 
-#define NR_syscalls 324
+#define NR_syscalls 325
 
 #define __ARCH_WANT_IPC_PARSE_VERSION
 /* #define __ARCH_WANT_OLD_READDIR */
index 344e3091af24c09832e4a61d64841508b9f9f8a2..d56fedbb457ab5aa5c5bd7a63affbd10afae6161 100644 (file)
@@ -33,7 +33,7 @@ struct bug_entry {
 
 #ifndef HAVE_ARCH_WARN_ON
 #define WARN_ON(condition) ({                                          \
-       typeof(condition) __ret_warn_on = (condition);                  \
+       int __ret_warn_on = !!(condition);                              \
        if (unlikely(__ret_warn_on)) {                                  \
                printk("WARNING: at %s:%d %s()\n", __FILE__,            \
                        __LINE__, __FUNCTION__);                        \
@@ -54,7 +54,7 @@ struct bug_entry {
 
 #ifndef HAVE_ARCH_WARN_ON
 #define WARN_ON(condition) ({                                          \
-       typeof(condition) __ret_warn_on = (condition);                  \
+       int __ret_warn_on = !!(condition);                              \
        unlikely(__ret_warn_on);                                        \
 })
 #endif
@@ -62,7 +62,7 @@ struct bug_entry {
 
 #define WARN_ON_ONCE(condition)        ({                              \
        static int __warned;                                    \
-       typeof(condition) __ret_warn_once = (condition);        \
+       int __ret_warn_once = !!(condition);                    \
                                                                \
        if (unlikely(__ret_warn_once))                          \
                if (WARN_ON(!__warned))                         \
index f605e8d0eed38a194b63cc04208cfc3455351574..5f0d797d33fd9023df37f39ace04f800f0d8189e 100644 (file)
@@ -2,6 +2,7 @@
 #define _ASM_GENERIC_PGTABLE_H
 
 #ifndef __ASSEMBLY__
+#ifdef CONFIG_MMU
 
 #ifndef __HAVE_ARCH_PTEP_SET_ACCESS_FLAGS
 /*
@@ -132,41 +133,6 @@ static inline void ptep_set_wrprotect(struct mm_struct *mm, unsigned long addres
 #define move_pte(pte, prot, old_addr, new_addr)        (pte)
 #endif
 
-/*
- * A facility to provide lazy MMU batching.  This allows PTE updates and
- * page invalidations to be delayed until a call to leave lazy MMU mode
- * is issued.  Some architectures may benefit from doing this, and it is
- * beneficial for both shadow and direct mode hypervisors, which may batch
- * the PTE updates which happen during this window.  Note that using this
- * interface requires that read hazards be removed from the code.  A read
- * hazard could result in the direct mode hypervisor case, since the actual
- * write to the page tables may not yet have taken place, so reads though
- * a raw PTE pointer after it has been modified are not guaranteed to be
- * up to date.  This mode can only be entered and left under the protection of
- * the page table locks for all page tables which may be modified.  In the UP
- * case, this is required so that preemption is disabled, and in the SMP case,
- * it must synchronize the delayed page table writes properly on other CPUs.
- */
-#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
-#define arch_enter_lazy_mmu_mode()     do {} while (0)
-#define arch_leave_lazy_mmu_mode()     do {} while (0)
-#define arch_flush_lazy_mmu_mode()     do {} while (0)
-#endif
-
-/*
- * A facility to provide batching of the reload of page tables with the
- * actual context switch code for paravirtualized guests.  By convention,
- * only one of the lazy modes (CPU, MMU) should be active at any given
- * time, entry should never be nested, and entry and exits should always
- * be paired.  This is for sanity of maintaining and reasoning about the
- * kernel code.
- */
-#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
-#define arch_enter_lazy_cpu_mode()     do {} while (0)
-#define arch_leave_lazy_cpu_mode()     do {} while (0)
-#define arch_flush_lazy_cpu_mode()     do {} while (0)
-#endif
-
 /*
  * When walking page tables, get the address of the next boundary,
  * or the end address of the range if that comes earlier.  Although no
@@ -233,6 +199,43 @@ static inline int pmd_none_or_clear_bad(pmd_t *pmd)
        }
        return 0;
 }
+#endif /* CONFIG_MMU */
+
+/*
+ * A facility to provide lazy MMU batching.  This allows PTE updates and
+ * page invalidations to be delayed until a call to leave lazy MMU mode
+ * is issued.  Some architectures may benefit from doing this, and it is
+ * beneficial for both shadow and direct mode hypervisors, which may batch
+ * the PTE updates which happen during this window.  Note that using this
+ * interface requires that read hazards be removed from the code.  A read
+ * hazard could result in the direct mode hypervisor case, since the actual
+ * write to the page tables may not yet have taken place, so reads though
+ * a raw PTE pointer after it has been modified are not guaranteed to be
+ * up to date.  This mode can only be entered and left under the protection of
+ * the page table locks for all page tables which may be modified.  In the UP
+ * case, this is required so that preemption is disabled, and in the SMP case,
+ * it must synchronize the delayed page table writes properly on other CPUs.
+ */
+#ifndef __HAVE_ARCH_ENTER_LAZY_MMU_MODE
+#define arch_enter_lazy_mmu_mode()     do {} while (0)
+#define arch_leave_lazy_mmu_mode()     do {} while (0)
+#define arch_flush_lazy_mmu_mode()     do {} while (0)
+#endif
+
+/*
+ * A facility to provide batching of the reload of page tables with the
+ * actual context switch code for paravirtualized guests.  By convention,
+ * only one of the lazy modes (CPU, MMU) should be active at any given
+ * time, entry should never be nested, and entry and exits should always
+ * be paired.  This is for sanity of maintaining and reasoning about the
+ * kernel code.
+ */
+#ifndef __HAVE_ARCH_ENTER_LAZY_CPU_MODE
+#define arch_enter_lazy_cpu_mode()     do {} while (0)
+#define arch_leave_lazy_cpu_mode()     do {} while (0)
+#define arch_flush_lazy_cpu_mode()     do {} while (0)
+#endif
+
 #endif /* !__ASSEMBLY__ */
 
 #endif /* _ASM_GENERIC_PGTABLE_H */
index 16a466e50681bf5e6cc8a58f3a47a4b3c2c8acf8..2fe1b2e67f0121b96d0a60f129fcc9f14972c937 100644 (file)
@@ -79,24 +79,24 @@ static inline void __ustw(__u16 val, __u16 *addr)
 
 #define __get_unaligned(ptr, size) ({          \
        const void *__gu_p = ptr;               \
-       __u64 val;                              \
+       __u64 __val;                            \
        switch (size) {                         \
        case 1:                                 \
-               val = *(const __u8 *)__gu_p;    \
+               __val = *(const __u8 *)__gu_p;  \
                break;                          \
        case 2:                                 \
-               val = __uldw(__gu_p);           \
+               __val = __uldw(__gu_p);         \
                break;                          \
        case 4:                                 \
-               val = __uldl(__gu_p);           \
+               __val = __uldl(__gu_p);         \
                break;                          \
        case 8:                                 \
-               val = __uldq(__gu_p);           \
+               __val = __uldq(__gu_p);         \
                break;                          \
        default:                                \
                bad_unaligned_access_length();  \
        };                                      \
-       (__force __typeof__(*(ptr)))val;        \
+       (__force __typeof__(*(ptr)))__val;      \
 })
 
 #define __put_unaligned(val, ptr, size)                \
index aee4009a498ef818037abe7925a13a0d2ed61e38..27bb95e2944c013d8024b58893d17f3585a39c53 100644 (file)
@@ -86,17 +86,15 @@ static inline struct thread_info *current_thread_info(void)
  * thread information flag bit numbers
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG     4       /* true if poll_idle() is polling
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     3       /* true if poll_idle() is polling
                                           TIF_NEED_RESCHED */
-#define TIF_MEMDIE             5
-#define TIF_RESTORE_SIGMASK    6       /* restore signal mask in do_signal() */
+#define TIF_MEMDIE             4
+#define TIF_RESTORE_SIGMASK    5       /* restore signal mask in do_signal() */
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
index 1e8f6f252dd31514407f1451644fa7f393de2b97..4091b33dcb10f28cfbd1ae1013b3477e2512e742 100644 (file)
@@ -116,6 +116,8 @@ extern void enable_NMI_through_LVT0 (void * dummy);
 extern int timer_over_8254;
 extern int local_apic_timer_c2_ok;
 
+extern int local_apic_timer_disabled;
+
 #else /* !CONFIG_X86_LOCAL_APIC */
 static inline void lapic_shutdown(void) { }
 
index c961c03cf1e2c8b451a0a6d67f0420ec3ee3674e..7b3aa28ebc6ea34d9932afd3daeeceab9a43fe34 100644 (file)
@@ -79,7 +79,7 @@
 #define X86_FEATURE_ARCH_PERFMON (3*32+11) /* Intel Architectural PerfMon */
 #define X86_FEATURE_PEBS       (3*32+12)  /* Precise-Event Based Sampling */
 #define X86_FEATURE_BTS                (3*32+13)  /* Branch Trace Store */
-#define X86_FEATURE_LAPIC_TIMER_BROKEN (3*32+ 14) /* lapic timer broken in C1 */
+/* 14 free */
 #define X86_FEATURE_SYNC_RDTSC (3*32+15)  /* RDTSC synchronizes the CPU */
 #define X86_FEATURE_REP_GOOD   (3*32+16) /* rep microcode works well on this CPU */
 
index 43114c824608b21f96c89a814b5499c1d71008d3..cf67dbb1db79a21e8430be37597b3a42196ad948 100644 (file)
@@ -47,7 +47,7 @@ extern void e820_register_memory(void);
 extern void limit_regions(unsigned long long size);
 extern void print_memory_map(char *who);
 
-#if defined(CONFIG_PM) && defined(CONFIG_SOFTWARE_SUSPEND)
+#if defined(CONFIG_PM) && defined(CONFIG_HIBERNATION)
 extern void e820_mark_nosave_regions(void);
 #else
 static inline void e820_mark_nosave_regions(void)
index 7df88be2dd9ed28a200e0e55682dab611419f2e1..9fa3fa9e62d15d77cc0aaa391f4500c7bdc7325a 100644 (file)
@@ -47,7 +47,8 @@ struct paravirt_ops
         * The patch function should return the number of bytes of code
         * generated, as we nop pad the rest in generic code.
         */
-       unsigned (*patch)(u8 type, u16 clobber, void *firstinsn, unsigned len);
+       unsigned (*patch)(u8 type, u16 clobber, void *insnbuf,
+                         unsigned long addr, unsigned len);
 
        /* Basic arch-specific setup */
        void (*arch_setup)(void);
@@ -253,13 +254,16 @@ extern struct paravirt_ops paravirt_ops;
 
 unsigned paravirt_patch_nop(void);
 unsigned paravirt_patch_ignore(unsigned len);
-unsigned paravirt_patch_call(void *target, u16 tgt_clobbers,
-                            void *site, u16 site_clobbers,
+unsigned paravirt_patch_call(void *insnbuf,
+                            const void *target, u16 tgt_clobbers,
+                            unsigned long addr, u16 site_clobbers,
                             unsigned len);
-unsigned paravirt_patch_jmp(void *target, void *site, unsigned len);
-unsigned paravirt_patch_default(u8 type, u16 clobbers, void *site, unsigned len);
+unsigned paravirt_patch_jmp(const void *target, void *insnbuf,
+                           unsigned long addr, unsigned len);
+unsigned paravirt_patch_default(u8 type, u16 clobbers, void *insnbuf,
+                               unsigned long addr, unsigned len);
 
-unsigned paravirt_patch_insns(void *site, unsigned len,
+unsigned paravirt_patch_insns(void *insnbuf, unsigned len,
                              const char *start, const char *end);
 
 int paravirt_disable_iospace(void);
index d790343e9982f3ad2f9919b1f354a5bb01a5e968..4fcacc71138594d4e14f72739e92f511b9506561 100644 (file)
@@ -8,6 +8,9 @@ struct pci_sysdata {
        int             node;           /* NUMA node */
 };
 
+/* scan a bus after allocating a pci_sysdata for it */
+extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
+
 #include <linux/mm.h>          /* for struct page */
 
 /* Can be used to override the logic in pci_scan_bus for skipping
index 57a4306cdf63e33f7a5eea692be606d90bc6cfee..bd67480ca1094f9896aacdf5395d0b541552fb75 100644 (file)
  * megabits/second; but this requires the faster clock.
  */
 #define BASE_BAUD ( 1843200 / 16 )
+
+/* Standard COM flags (except for COM4, because of the 8514 problem) */
+#ifdef CONFIG_SERIAL_DETECT_IRQ
+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
+#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
+#else
+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
+#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
+#endif
+
+#define SERIAL_PORT_DFNS                       \
+       /* UART CLK   PORT IRQ     FLAGS        */                      \
+       { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },      /* ttyS0 */     \
+       { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },      /* ttyS1 */     \
+       { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },      /* ttyS2 */     \
+       { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },     /* ttyS3 */
index 54424e045e01a239da8b7ce2db080c741ff34275..22a8cbcd35e2f11b8446ef2b71179efbaf8291ab 100644 (file)
@@ -124,15 +124,14 @@ static inline struct thread_info *current_thread_info(void)
  * - other flags in MSW
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_SINGLESTEP         4       /* restore singlestep on return to user mode */
-#define TIF_IRET               5       /* return with iret */
-#define TIF_SYSCALL_EMU                6       /* syscall emulation active */
-#define TIF_SYSCALL_AUDIT      7       /* syscall auditing active */
-#define TIF_SECCOMP            8       /* secure computing */
-#define TIF_RESTORE_SIGMASK    9       /* restore signal mask in do_signal() */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_SINGLESTEP         3       /* restore singlestep on return to user mode */
+#define TIF_IRET               4       /* return with iret */
+#define TIF_SYSCALL_EMU                5       /* syscall emulation active */
+#define TIF_SYSCALL_AUDIT      6       /* syscall auditing active */
+#define TIF_SECCOMP            7       /* secure computing */
+#define TIF_RESTORE_SIGMASK    8       /* restore signal mask in do_signal() */
 #define TIF_MEMDIE             16
 #define TIF_DEBUG              17      /* uses debug registers */
 #define TIF_IO_BITMAP          18      /* uses I/O bitmap */
@@ -140,7 +139,6 @@ static inline struct thread_info *current_thread_info(void)
 #define TIF_NOTSC              20      /* TSC is not accessible in userland */
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_SINGLESTEP                (1<<TIF_SINGLESTEP)
index 7d0241db622b0e19f6ca350782b214c348d05e4c..d16031e72efa921417c5e0ec9ef648d5868b21f6 100644 (file)
@@ -79,13 +79,13 @@ struct thread_info {
  * - pending work-to-be-done flags are in least-significant 16 bits, other flags
  *   in top 16 bits
  */
-#define TIF_NOTIFY_RESUME      0       /* resumption notification requested */
-#define TIF_SIGPENDING         1       /* signal pending */
-#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
-#define TIF_SYSCALL_TRACE      3       /* syscall trace active */
-#define TIF_SYSCALL_AUDIT      4       /* syscall auditing active */
-#define TIF_SINGLESTEP         5       /* restore singlestep on return to user mode */
-#define TIF_RESTORE_SIGMASK    6       /* restore signal mask in do_signal() */
+#define TIF_SIGPENDING         0       /* signal pending */
+#define TIF_NEED_RESCHED       1       /* rescheduling necessary */
+#define TIF_SYSCALL_TRACE      2       /* syscall trace active */
+#define TIF_SYSCALL_AUDIT      3       /* syscall auditing active */
+#define TIF_SINGLESTEP         4       /* restore singlestep on return to user mode */
+#define TIF_RESTORE_SIGMASK    5       /* restore signal mask in do_signal() */
+#define TIF_PERFMON_WORK       6       /* work for pfm_handle_work() */
 #define TIF_POLLING_NRFLAG     16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE             17
 #define TIF_MCA_INIT           18      /* this task is processing MCA or INIT */
@@ -96,8 +96,8 @@ struct thread_info {
 #define _TIF_SYSCALL_AUDIT     (1 << TIF_SYSCALL_AUDIT)
 #define _TIF_SINGLESTEP                (1 << TIF_SINGLESTEP)
 #define _TIF_SYSCALL_TRACEAUDIT        (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP)
-#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_RESTORE_SIGMASK   (1 << TIF_RESTORE_SIGMASK)
+#define _TIF_PERFMON_WORK      (1 << TIF_PERFMON_WORK)
 #define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1 << TIF_POLLING_NRFLAG)
@@ -106,7 +106,9 @@ struct thread_info {
 #define _TIF_FREEZE            (1 << TIF_FREEZE)
 
 /* "work to do on user-return" bits */
-#define TIF_ALLWORK_MASK       (_TIF_NOTIFY_RESUME|_TIF_SIGPENDING|_TIF_NEED_RESCHED|_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_RESTORE_SIGMASK)
+#define TIF_ALLWORK_MASK       (_TIF_SIGPENDING|_TIF_PERFMON_WORK|_TIF_SYSCALL_AUDIT|\
+                                _TIF_NEED_RESCHED| _TIF_SYSCALL_TRACE|\
+                                _TIF_RESTORE_SIGMASK)
 /* like TIF_ALLWORK_BITS but sans TIF_SYSCALL_TRACE or TIF_SYSCALL_AUDIT */
 #define TIF_WORK_MASK          (TIF_ALLWORK_MASK&~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT))
 
index 22aff3222d22a3790b22791fcacd1cdc94baf72e..b7ccc3e686047a8fe09814f6b6647bee5371320a 100644 (file)
@@ -146,17 +146,15 @@ static inline unsigned int get_thread_fault_code(void)
  * - other flags in MSW
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_SINGLESTEP         4       /* restore singlestep on return to user mode */
-#define TIF_IRET               5       /* return with iret */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_SINGLESTEP         3       /* restore singlestep on return to user mode */
+#define TIF_IRET               4       /* return with iret */
 #define TIF_POLLING_NRFLAG     16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
                                        /* 31..28 fault code */
 #define TIF_MEMDIE             17
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_SINGLESTEP                (1<<TIF_SINGLESTEP)
index 91c623f0994c958f5fdef6f646314640df10029e..d9eb9834ccc8737677b3d2a1ec5e5547cde6a61d 100644 (file)
@@ -36,15 +36,15 @@ extern void __iounmap(void *addr, unsigned long size);
 #define in_be32(addr) \
     ({ u32 __v = (*(__force volatile u32 *) (addr)); __v; })
 #define in_le16(addr) \
-    ({ u16 __v = le16_to_cpu(*(__force volatile u16 *) (addr)); __v; })
+    ({ u16 __v = le16_to_cpu(*(__force volatile __le16 *) (addr)); __v; })
 #define in_le32(addr) \
-    ({ u32 __v = le32_to_cpu(*(__force volatile u32 *) (addr)); __v; })
+    ({ u32 __v = le32_to_cpu(*(__force volatile __le32 *) (addr)); __v; })
 
 #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 out_le16(addr,w) (void)((*(__force volatile __le16 *) (addr)) = cpu_to_le16(w))
+#define out_le32(addr,l) (void)((*(__force volatile __le32 *) (addr)) = cpu_to_le32(l))
 
 #define raw_inb in_8
 #define raw_inw in_be16
index 198878b53a618c92cf5f37261b0476807754c722..caa9b1663e452d509c9c2055335442ff44631edb 100644 (file)
@@ -46,6 +46,22 @@ asmlinkage void resume(void);
 } while (0)
 
 
+/*
+ * Force strict CPU ordering.
+ * Not really required on m68k...
+ */
+#define nop()          do { asm volatile ("nop"); barrier(); } while (0)
+#define mb()           barrier()
+#define rmb()          barrier()
+#define wmb()          barrier()
+#define read_barrier_depends() ((void)0)
+#define set_mb(var, value)     ({ (var) = (value); wmb(); })
+
+#define smp_mb()       barrier()
+#define smp_rmb()      barrier()
+#define smp_wmb()      barrier()
+#define smp_read_barrier_depends()     ((void)0)
+
 /* interrupt control.. */
 #if 0
 #define local_irq_enable() asm volatile ("andiw %0,%%sr": : "i" (ALLOWINT) : "memory")
@@ -70,23 +86,6 @@ static inline int irqs_disabled(void)
 /* For spinlocks etc */
 #define local_irq_save(x)      ({ local_save_flags(x); local_irq_disable(); })
 
-/*
- * Force strict CPU ordering.
- * Not really required on m68k...
- */
-#define nop()          do { asm volatile ("nop"); barrier(); } while (0)
-#define mb()           barrier()
-#define rmb()          barrier()
-#define wmb()          barrier()
-#define read_barrier_depends() ((void)0)
-#define set_mb(var, value)     ({ (var) = (value); wmb(); })
-
-#define smp_mb()       barrier()
-#define smp_rmb()      barrier()
-#define smp_wmb()      barrier()
-#define smp_read_barrier_depends()     ((void)0)
-
-
 #define xchg(ptr,x) ((__typeof__(*(ptr)))__xchg((unsigned long)(x),(ptr),sizeof(*(ptr))))
 
 struct __xchg_dummy { unsigned long a[100]; };
index 980075bab792741e3ddb253767701062fa3a41cf..bfad28149a49dd4ee46d55f42b43a6a4dc64125c 100644 (file)
@@ -22,4 +22,6 @@ typedef struct {
 # error HARDIRQ_BITS is too low!
 #endif
 
+void ack_bad_irq(unsigned int irq);
+
 #endif /* __M68K_HARDIRQ_H */
index 6ce28f8e0eadd4b7d0a154547922b557cc31a4ee..708d7863ba687624f04a89257f31079283ba8f84 100644 (file)
@@ -1,53 +1,21 @@
 #ifndef _M68KNOMMU_MACHDEP_H
 #define _M68KNOMMU_MACHDEP_H
 
-#include <linux/seq_file.h>
 #include <linux/interrupt.h>
 
-struct pt_regs;
-struct kbd_repeat;
-struct mktime;
-struct hwclk_time;
-struct gendisk;
-struct buffer_head;
-
-extern void (*mach_sched_init) (irqreturn_t (*handler)(int, void *, struct pt_regs *));
-/* machine dependent keyboard functions */
-extern int (*mach_keyb_init) (void);
-extern int (*mach_kbdrate) (struct kbd_repeat *);
-extern void (*mach_kbd_leds) (unsigned int);
-/* machine dependent irq functions */
-extern void (*mach_init_IRQ) (void);
-extern irq_handler_t mach_default_handler;
-extern int (*mach_request_irq) (unsigned int irq, void (*handler)(int, void *, struct pt_regs *),
-                                unsigned long flags, const char *devname, void *dev_id);
-extern void (*mach_free_irq) (unsigned int irq, void *dev_id);
-extern void (*mach_get_model) (char *model);
-extern int (*mach_get_hardware_list) (char *buffer);
-extern int (*mach_get_irq_list) (struct seq_file *p, void *v);
-extern void (*mach_process_int) (int irq, struct pt_regs *fp);
+extern void (*mach_sched_init) (irq_handler_t handler);
 /* machine dependent timer functions */
 extern unsigned long (*mach_gettimeoffset)(void);
 extern void (*mach_gettod)(int *year, int *mon, int *day, int *hour,
                           int *min, int *sec);
-extern int (*mach_hwclk)(int, struct hwclk_time*);
 extern int (*mach_set_clock_mmss)(unsigned long);
+
+/* machine dependent power off functions */
 extern void (*mach_reset)( void );
 extern void (*mach_halt)( void );
 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_eject)(void);
-extern void (*mach_heartbeat) (int);
-extern void (*mach_l2_flush) (int);
-extern int mach_sysrq_key;
-extern int mach_sysrq_shift_state;
-extern int mach_sysrq_shift_mask;
-extern char *mach_sysrq_xlate;
 
 extern void config_BSP(char *command, int len);
 extern void (*mach_tick)(void);
-extern void (*mach_trap_init)(void);
 
 #endif /* _M68KNOMMU_MACHDEP_H */
index b8f009edf2b2cf5a2c88c756a7e3151f68a8e6e9..95996d978bedcf0d9adc3dd27e1e99f121b79881 100644 (file)
@@ -83,16 +83,14 @@ static inline struct thread_info *current_thread_info(void)
  * thread information flag bit numbers
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG     4       /* true if poll_idle() is polling
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     3       /* true if poll_idle() is polling
                                           TIF_NEED_RESCHED */
-#define TIF_MEMDIE             5
+#define TIF_MEMDIE             4
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
index 1ad60ba186d0e6d9a2500f7e98401147190158df..bf55a5b34bef7458c3a69a7b7a05398dec7e8986 100644 (file)
@@ -38,7 +38,8 @@ struct exec
 #define STACK_TOP      TASK_SIZE
 #endif
 #ifdef CONFIG_64BIT
-#define STACK_TOP      (current->thread.mflags & MF_32BIT_ADDR ? TASK_SIZE32 : TASK_SIZE)
+#define STACK_TOP      \
+      (test_thread_flag(TIF_32BIT_ADDR) ? TASK_SIZE32 : TASK_SIZE)
 #endif
 #define STACK_TOP_MAX  TASK_SIZE
 
index 087126a5faf9e84beb8f3cf3a9075e55ef95eb4d..c0f052b37b9e58d334d1b919c098ca58ed8ef43b 100644 (file)
 #define MACH_GROUP_COBALT       7      /* Cobalt servers               */
 #define  MACH_COBALT_27                0       /* Proto "27" hardware          */
 
-/*
- * Valid machtype for group NEC DDB
- */
-#define MACH_GROUP_NEC_DDB     8       /* NEC DDB                      */
-#define  MACH_NEC_DDB5074      0       /* NEC DDB Vrc-5074 */
-#define  MACH_NEC_DDB5476      1       /* NEC DDB Vrc-5476 */
-#define  MACH_NEC_DDB5477      2       /* NEC DDB Vrc-5477 */
-#define  MACH_NEC_ROCKHOPPER   3       /* Rockhopper base board */
-#define  MACH_NEC_ROCKHOPPERII 4       /* Rockhopper II base board */
-
 /*
  * Valid machtype for group BAGET
  */
 #define  MACH_TOSHIBA_RBTX4937 5
 #define  MACH_TOSHIBA_RBTX4938 6
 
-#define GROUP_TOSHIBA_NAMES    { "Pallas", "TopasCE", "JMR", "JMR TX3927", \
-                                 "RBTX4927", "RBTX4937" }
-
 /*
  * Valid machtype for group Alchemy
  */
diff --git a/include/asm-mips/ddb5xxx/ddb5477.h b/include/asm-mips/ddb5xxx/ddb5477.h
deleted file mode 100644 (file)
index 6cf177c..0000000
+++ /dev/null
@@ -1,342 +0,0 @@
-/***********************************************************************
- *
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * include/asm-mips/ddb5xxx/ddb5477.h
- *     DDB 5477 specific definitions and macros.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- ***********************************************************************
- */
-
-#ifndef __ASM_DDB5XXX_DDB5477_H
-#define __ASM_DDB5XXX_DDB5477_H
-
-#include <irq.h>
-
-/*
- * This contains macros that are specific to DDB5477 or renamed from
- * DDB5476.
- */
-
-/*
- * renamed PADRs
- */
-#define        DDB_LCS0        DDB_DCS2
-#define        DDB_LCS1        DDB_DCS3
-#define        DDB_LCS2        DDB_DCS4
-#define        DDB_VRC5477     DDB_INTCS
-
-/*
- * New CPU interface registers
- */
-#define        DDB_INTCTRL0    0x0400  /* Interrupt Control 0 */
-#define        DDB_INTCTRL1    0x0404  /* Interrupt Control 1 */
-#define        DDB_INTCTRL2    0x0408  /* Interrupt Control 2 */
-#define        DDB_INTCTRL3    0x040c  /* Interrupt Control 3 */
-
-#define        DDB_INT0STAT    0x0420  /* INT0 Status [R] */
-#define        DDB_INT1STAT    0x0428  /* INT1 Status [R] */
-#define        DDB_INT2STAT    0x0430  /* INT2 Status [R] */
-#define        DDB_INT3STAT    0x0438  /* INT3 Status [R] */
-#define        DDB_INT4STAT    0x0440  /* INT4 Status [R] */
-#define        DDB_NMISTAT     0x0450  /* NMI Status [R] */
-
-#define        DDB_INTCLR32    0x0468  /* Interrupt Clear */
-
-#define        DDB_INTPPES0    0x0470  /* PCI0 Interrupt Control */
-#define        DDB_INTPPES1    0x0478  /* PCI1 Interrupt Control */
-
-#undef  DDB_CPUSTAT            /* duplicate in Vrc-5477 */
-#define        DDB_CPUSTAT     0x0480  /* CPU Status [R] */
-#define        DDB_BUSCTRL     0x0488  /* Internal Bus Control */
-
-
-/*
- * Timer registers
- */
-#define        DDB_REFCTRL_L   DDB_T0CTRL
-#define        DDB_REFCTRL_H   (DDB_T0CTRL+4)
-#define        DDB_REFCNTR     DDB_T0CNTR
-#define        DDB_SPT0CTRL_L  DDB_T1CTRL
-#define        DDB_SPT0CTRL_H  (DDB_T1CTRL+4)
-#define        DDB_SPT1CTRL_L  DDB_T2CTRL
-#define        DDB_SPT1CTRL_H  (DDB_T2CTRL+4)
-#define DDB_SPT1CNTR   DDB_T1CTRL
-#define        DDB_WDTCTRL_L   DDB_T3CTRL
-#define        DDB_WDTCTRL_H   (DDB_T3CTRL+4)
-#define        DDB_WDTCNTR     DDB_T3CNTR
-
-/*
- * DMA registers are moved.  We don't care about it for now. TODO.
- */
-
-/*
- * BARs for ext PCI (PCI0)
- */
-#undef DDB_BARC
-#undef DDB_BARB
-
-#define DDB_BARC0      0x0210  /* PCI0 Control */
-#define DDB_BARM010    0x0218  /* PCI0 SDRAM bank01 */
-#define        DDB_BARM230     0x0220  /* PCI0 SDRAM bank23 */
-#define        DDB_BAR00       0x0240  /* PCI0 LDCS0 */
-#define        DDB_BAR10       0x0248  /* PCI0 LDCS1 */
-#define        DDB_BAR20       0x0250  /* PCI0 LDCS2 */
-#define        DDB_BAR30       0x0258  /* PCI0 LDCS3 */
-#define        DDB_BAR40       0x0260  /* PCI0 LDCS4 */
-#define        DDB_BAR50       0x0268  /* PCI0 LDCS5 */
-#define        DDB_BARB0       0x0280  /* PCI0 BOOT */
-#define        DDB_BARP00      0x0290  /* PCI0 for IOPCI Window0 */
-#define        DDB_BARP10      0x0298  /* PCI0 for IOPCI Window1 */
-
-/*
- * BARs for IOPIC (PCI1)
- */
-#define DDB_BARC1      0x0610  /* PCI1 Control */
-#define DDB_BARM011    0x0618  /* PCI1 SDRAM bank01 */
-#define        DDB_BARM231     0x0620  /* PCI1 SDRAM bank23 */
-#define        DDB_BAR01       0x0640  /* PCI1 LDCS0 */
-#define        DDB_BAR11       0x0648  /* PCI1 LDCS1 */
-#define        DDB_BAR21       0x0650  /* PCI1 LDCS2 */
-#define        DDB_BAR31       0x0658  /* PCI1 LDCS3 */
-#define        DDB_BAR41       0x0660  /* PCI1 LDCS4 */
-#define        DDB_BAR51       0x0668  /* PCI1 LDCS5 */
-#define        DDB_BARB1       0x0680  /* PCI1 BOOT */
-#define        DDB_BARP01      0x0690  /* PCI1 for ext PCI Window0 */
-#define        DDB_BARP11      0x0698  /* PCI1 for ext PCI Window1 */
-
-/*
- * Other registers for ext PCI (PCI0)
- */
-#define        DDB_PCIINIT00   0x02f0  /* PCI0 Initiator 0 */
-#define        DDB_PCIINIT10   0x02f8  /* PCI0 Initiator 1 */
-
-#define        DDB_PCISWP0     0x02b0  /* PCI0 Swap */
-#define        DDB_PCIERR0     0x02b8  /* PCI0 Error */
-
-#define        DDB_PCICTL0_L   0x02e0  /* PCI0 Control-L */
-#define        DDB_PCICTL0_H   0x02e4  /* PCI0 Control-H */
-#define        DDB_PCIARB0_L   0x02e8  /* PCI0 Arbitration-L */
-#define        DDB_PCIARB0_H   0x02ec  /* PCI0 Arbitration-H */
-
-/*
- * Other registers for IOPCI (PCI1)
- */
-#define DDB_IOPCIW0    0x00d0  /* PCI Address Window 0 [R/W] */
-#define DDB_IOPCIW1    0x00d8  /* PCI Address Window 1 [R/W] */
-
-#define        DDB_PCIINIT01   0x06f0  /* PCI1 Initiator 0 */
-#define        DDB_PCIINIT11   0x06f8  /* PCI1 Initiator 1 */
-
-#define        DDB_PCISWP1     0x06b0  /* PCI1 Swap */
-#define        DDB_PCIERR1     0x06b8  /* PCI1 Error */
-
-#define        DDB_PCICTL1_L   0x06e0  /* PCI1 Control-L */
-#define        DDB_PCICTL1_H   0x06e4  /* PCI1 Control-H */
-#define        DDB_PCIARB1_L   0x06e8  /* PCI1 Arbitration-L */
-#define        DDB_PCIARB1_H   0x06ec  /* PCI1 Arbitration-H */
-
-/*
- * Local Bus
- */
-#define DDB_LCST0      0x0110  /* LB Chip Select Timing 0 */
-#define DDB_LCST1      0x0118  /* LB Chip Select Timing 1 */
-#undef DDB_LCST2
-#define DDB_LCST2      0x0120  /* LB Chip Select Timing 2 */
-#undef DDB_LCST3
-#undef DDB_LCST4
-#undef DDB_LCST5
-#undef DDB_LCST6
-#undef DDB_LCST7
-#undef DDB_LCST8
-#define DDB_ERRADR     0x0150  /* Error Address Register */
-#define DDB_ERRCS       0x0160
-#define DDB_BTM                0x0170  /* Boot Time Mode value */
-
-/*
- * MISC registers
- */
-#define DDB_GIUFUNSEL  0x4040  /* select dual-func pins */
-#define DDB_PIBMISC    0x0750  /* USB buffer enable / power saving */
-
-/*
- *  Memory map (physical address)
- *
- *  Note most of the following address must be properly aligned by the
- *  corresponding size.  For example, if PCI_IO_SIZE is 16MB, then
- *  PCI_IO_BASE must be aligned along 16MB boundary.
- */
-
-/* the actual ram size is detected at run-time */
-#define        DDB_SDRAM_BASE          0x00000000
-#define        DDB_MAX_SDRAM_SIZE      0x08000000      /* less than 128MB */
-
-#define        DDB_PCI0_MEM_BASE       0x08000000
-#define        DDB_PCI0_MEM_SIZE       0x08000000      /* 128 MB */
-
-#define        DDB_PCI1_MEM_BASE       0x10000000
-#define        DDB_PCI1_MEM_SIZE       0x08000000      /* 128 MB */
-
-#define        DDB_PCI0_CONFIG_BASE    0x18000000
-#define        DDB_PCI0_CONFIG_SIZE    0x01000000      /* 16 MB */
-
-#define        DDB_PCI1_CONFIG_BASE    0x19000000
-#define        DDB_PCI1_CONFIG_SIZE    0x01000000      /* 16 MB */
-
-#define        DDB_PCI_IO_BASE         0x1a000000      /* we concatenate two IOs */
-#define        DDB_PCI0_IO_BASE        0x1a000000
-#define        DDB_PCI0_IO_SIZE        0x01000000      /* 16 MB */
-#define        DDB_PCI1_IO_BASE        0x1b000000
-#define        DDB_PCI1_IO_SIZE        0x01000000      /* 16 MB */
-
-#define        DDB_LCS0_BASE           0x1c000000      /* flash memory */
-#define        DDB_LCS0_SIZE           0x01000000      /* 16 MB */
-
-#define        DDB_LCS1_BASE           0x1d000000      /* misc */
-#define        DDB_LCS1_SIZE           0x01000000      /* 16 MB */
-
-#define        DDB_LCS2_BASE           0x1e000000      /* Mezzanine */
-#define        DDB_LCS2_SIZE           0x01000000      /* 16 MB */
-
-#define        DDB_VRC5477_BASE        0x1fa00000      /* VRC5477 control regs */
-#define        DDB_VRC5477_SIZE        0x00200000      /* 2MB */
-
-#define        DDB_BOOTCS_BASE         0x1fc00000      /* Boot ROM / EPROM /Flash */
-#define        DDB_BOOTCS_SIZE         0x00200000      /* 2 MB - doc says 4MB */
-
-#define        DDB_LED                 DDB_LCS1_BASE + 0x10000
-
-
-/*
- * DDB5477 specific functions
- */
-#ifndef __ASSEMBLY__
-extern void ddb5477_irq_setup(void);
-
-/* route irq to cpu int pin */
-extern void ll_vrc5477_irq_route(int vrc5477_irq, int ip);
-
-/* low-level routine for enabling vrc5477 irq, bypassing high-level */
-extern void ll_vrc5477_irq_enable(int vrc5477_irq);
-extern void ll_vrc5477_irq_disable(int vrc5477_irq);
-#endif /* !__ASSEMBLY__ */
-
-/* PCI intr ack share PCIW0 with PCI IO */
-#define        DDB_PCI_IACK_BASE       DDB_PCI_IO_BASE
-
-/*
- * Interrupt mapping
- *
- * We have three interrupt controllers:
- *
- *   . CPU itself - 8 sources
- *   . i8259 - 16 sources
- *   . vrc5477 - 32 sources
- *
- *  They connected as follows:
- *    all vrc5477 interrupts are routed to cpu IP2 (by software setting)
- *    all i8359 are routed to INTC in vrc5477 (by hardware connection)
- *
- *  All VRC5477 PCI interrupts are level-triggered (no ack needed).
- *  All PCI irq but INTC are active low.
- */
-
-/*
- * irq number block assignment
- */
-
-#define        NUM_CPU_IRQ             8
-#define        NUM_VRC5477_IRQ         32
-
-#define        CPU_IRQ_BASE            MIPS_CPU_IRQ_BASE
-#define        VRC5477_IRQ_BASE        (CPU_IRQ_BASE + NUM_CPU_IRQ)
-
-/*
- * vrc5477 irq defs
- */
-
-#define VRC5477_IRQ_CPCE       (0 + VRC5477_IRQ_BASE)  /* cpu parity error */
-#define VRC5477_IRQ_CNTD       (1 + VRC5477_IRQ_BASE)  /* cpu no target */
-#define VRC5477_IRQ_I2C                (2 + VRC5477_IRQ_BASE)  /* I2C */
-#define VRC5477_IRQ_DMA                (3 + VRC5477_IRQ_BASE)  /* DMA */
-#define VRC5477_IRQ_UART0      (4 + VRC5477_IRQ_BASE)
-#define VRC5477_IRQ_WDOG       (5 + VRC5477_IRQ_BASE)  /* watchdog timer */
-#define VRC5477_IRQ_SPT1       (6 + VRC5477_IRQ_BASE)    /* special purpose timer 1 */
-#define VRC5477_IRQ_LBRT       (7 + VRC5477_IRQ_BASE)  /* local bus read timeout */
-#define VRC5477_IRQ_INTA       (8 + VRC5477_IRQ_BASE)  /* PCI INT #A */
-#define VRC5477_IRQ_INTB       (9 + VRC5477_IRQ_BASE)  /* PCI INT #B */
-#define VRC5477_IRQ_INTC       (10 + VRC5477_IRQ_BASE) /* PCI INT #C */
-#define VRC5477_IRQ_INTD       (11 + VRC5477_IRQ_BASE) /* PCI INT #D */
-#define VRC5477_IRQ_INTE       (12 + VRC5477_IRQ_BASE) /* PCI INT #E */
-#define VRC5477_IRQ_RESERVED_13        (13 + VRC5477_IRQ_BASE) /* reserved  */
-#define VRC5477_IRQ_PCIS       (14 + VRC5477_IRQ_BASE) /* PCI SERR #  */
-#define VRC5477_IRQ_PCI                (15 + VRC5477_IRQ_BASE) /* PCI internal error */
-#define VRC5477_IRQ_IOPCI_INTA (16 + VRC5477_IRQ_BASE)      /* USB-H */
-#define VRC5477_IRQ_IOPCI_INTB (17 + VRC5477_IRQ_BASE)      /* USB-P */
-#define VRC5477_IRQ_IOPCI_INTC (18 + VRC5477_IRQ_BASE)      /* AC97 */
-#define VRC5477_IRQ_IOPCI_INTD (19 + VRC5477_IRQ_BASE)      /* Reserved */
-#define VRC5477_IRQ_UART1      (20 + VRC5477_IRQ_BASE)
-#define VRC5477_IRQ_SPT0       (21 + VRC5477_IRQ_BASE)      /* special purpose timer 0 */
-#define VRC5477_IRQ_GPT0       (22 + VRC5477_IRQ_BASE)      /* general purpose timer 0 */
-#define VRC5477_IRQ_GPT1       (23 + VRC5477_IRQ_BASE)      /* general purpose timer 1 */
-#define VRC5477_IRQ_GPT2       (24 + VRC5477_IRQ_BASE)      /* general purpose timer 2 */
-#define VRC5477_IRQ_GPT3       (25 + VRC5477_IRQ_BASE)      /* general purpose timer 3 */
-#define VRC5477_IRQ_GPIO       (26 + VRC5477_IRQ_BASE)
-#define VRC5477_IRQ_SIO0       (27 + VRC5477_IRQ_BASE)
-#define VRC5477_IRQ_SIO1        (28 + VRC5477_IRQ_BASE)
-#define VRC5477_IRQ_RESERVED_29 (29 + VRC5477_IRQ_BASE)      /* reserved */
-#define VRC5477_IRQ_IOPCISERR  (30 + VRC5477_IRQ_BASE)      /* IO PCI SERR # */
-#define VRC5477_IRQ_IOPCI      (31 + VRC5477_IRQ_BASE)
-
-/*
- * i2859 irq assignment
- */
-#define I8259_IRQ_RESERVED_0   (0 + I8259A_IRQ_BASE)
-#define I8259_IRQ_KEYBOARD     (1 + I8259A_IRQ_BASE)   /* M1543 default */
-#define I8259_IRQ_CASCADE      (2 + I8259A_IRQ_BASE)
-#define I8259_IRQ_UART_B       (3 + I8259A_IRQ_BASE)   /* M1543 default, may conflict with RTC according to schematic diagram  */
-#define I8259_IRQ_UART_A       (4 + I8259A_IRQ_BASE)   /* M1543 default */
-#define I8259_IRQ_PARALLEL     (5 + I8259A_IRQ_BASE)   /* M1543 default */
-#define I8259_IRQ_RESERVED_6   (6 + I8259A_IRQ_BASE)
-#define I8259_IRQ_RESERVED_7   (7 + I8259A_IRQ_BASE)
-#define I8259_IRQ_RTC          (8 + I8259A_IRQ_BASE)   /* who set this? */
-#define I8259_IRQ_USB          (9 + I8259A_IRQ_BASE)   /* ddb_setup */
-#define I8259_IRQ_PMU          (10 + I8259A_IRQ_BASE)  /* ddb_setup */
-#define I8259_IRQ_RESERVED_11  (11 + I8259A_IRQ_BASE)
-#define I8259_IRQ_RESERVED_12  (12 + I8259A_IRQ_BASE)  /* m1543_irq_setup */
-#define I8259_IRQ_RESERVED_13  (13 + I8259A_IRQ_BASE)
-#define I8259_IRQ_HDC1         (14 + I8259A_IRQ_BASE)  /* default and ddb_setup */
-#define I8259_IRQ_HDC2         (15 + I8259A_IRQ_BASE)  /* default */
-
-
-/*
- * misc
- */
-#define        VRC5477_I8259_CASCADE   (VRC5477_IRQ_INTC - VRC5477_IRQ_BASE)
-#define        CPU_VRC5477_CASCADE     2
-
-/*
- * debug routines
- */
-#ifndef __ASSEMBLY__
-#if defined(CONFIG_RUNTIME_DEBUG)
-extern void vrc5477_show_pdar_regs(void);
-extern void vrc5477_show_pci_regs(void);
-extern void vrc5477_show_bar_regs(void);
-extern void vrc5477_show_int_regs(void);
-extern void vrc5477_show_all_regs(void);
-#endif
-
-/*
- * RAM size
- */
-extern int board_ram_size;
-#endif /* !__ASSEMBLY__ */
-
-#endif /* __ASM_DDB5XXX_DDB5477_H */
diff --git a/include/asm-mips/ddb5xxx/ddb5xxx.h b/include/asm-mips/ddb5xxx/ddb5xxx.h
deleted file mode 100644 (file)
index e97fcc8..0000000
+++ /dev/null
@@ -1,263 +0,0 @@
-/*
- * Copyright 2001 MontaVista Software Inc.
- * Author: jsun@mvista.com or jsun@junsun.net
- *
- * Copyright (C) 2000 Geert Uytterhoeven <geert@sonycom.com>
- *                    Sony Software Development Center Europe (SDCE), Brussels
- *
- * include/asm-mips/ddb5xxx/ddb5xxx.h
- *     Common header for all NEC DDB 5xxx boards, including 5074, 5476, 5477.
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- *
- */
-
-#ifndef __ASM_DDB5XXX_DDB5XXX_H
-#define __ASM_DDB5XXX_DDB5XXX_H
-
-#include <linux/types.h>
-
-/*
- *  This file is based on the following documentation:
- *
- *     NEC Vrc 5074 System Controller Data Sheet, June 1998
- *
- * [jsun] It is modified so that this file only contains the macros
- * that are true for all DDB 5xxx boards.  The modification is based on
- *
- *     uPD31577(VRC5477) VR5432-SDRAM/PCI Bridge (Luke)
- *     Preliminary Specification Decoment, Rev 1.1, 27 Dec, 2000
- *
- */
-
-
-#define DDB_BASE               0xbfa00000
-#define DDB_SIZE               0x00200000              /* 2 MB */
-
-
-/*
- *  Physical Device Address Registers (PDARs)
- */
-
-#define DDB_SDRAM0     0x0000  /* SDRAM Bank 0 [R/W] */
-#define DDB_SDRAM1     0x0008  /* SDRAM Bank 1 [R/W] */
-#define DDB_DCS2       0x0010  /* Device Chip-Select 2 [R/W] */
-#define DDB_DCS3       0x0018  /* Device Chip-Select 3 [R/W] */
-#define DDB_DCS4       0x0020  /* Device Chip-Select 4 [R/W] */
-#define DDB_DCS5       0x0028  /* Device Chip-Select 5 [R/W] */
-#define DDB_DCS6       0x0030  /* Device Chip-Select 6 [R/W] */
-#define DDB_DCS7       0x0038  /* Device Chip-Select 7 [R/W] */
-#define DDB_DCS8       0x0040  /* Device Chip-Select 8 [R/W] */
-#define DDB_PCIW0      0x0060  /* PCI Address Window 0 [R/W] */
-#define DDB_PCIW1      0x0068  /* PCI Address Window 1 [R/W] */
-#define DDB_INTCS      0x0070  /* Controller Internal Registers and Devices */
-                               /* [R/W] */
-#define DDB_BOOTCS     0x0078  /* Boot ROM Chip-Select [R/W] */
-/* Vrc5477 has two more, IOPCIW0, IOPCIW1 */
-
-/*
- *  CPU Interface Registers
- */
-#define DDB_CPUSTAT    0x0080  /* CPU Status [R/W] */
-#define DDB_INTCTRL    0x0088  /* Interrupt Control [R/W] */
-#define DDB_INTSTAT0   0x0090  /* Interrupt Status 0 [R] */
-#define DDB_INTSTAT1   0x0098  /* Interrupt Status 1 and CPU Interrupt */
-                               /* Enable [R/W] */
-#define DDB_INTCLR     0x00A0  /* Interrupt Clear [R/W] */
-#define DDB_INTPPES    0x00A8  /* PCI Interrupt Control [R/W] */
-
-
-/*
- *  Memory-Interface Registers
- */
-#define DDB_MEMCTRL    0x00C0  /* Memory Control */
-#define DDB_ACSTIME    0x00C8  /* Memory Access Timing [R/W] */
-#define DDB_CHKERR     0x00D0  /* Memory Check Error Status [R] */
-
-
-/*
- *  PCI-Bus Registers
- */
-#define DDB_PCICTRL    0x00E0  /* PCI Control [R/W] */
-#define DDB_PCIARB     0x00E8  /* PCI Arbiter [R/W] */
-#define DDB_PCIINIT0   0x00F0  /* PCI Master (Initiator) 0 [R/W] */
-#define DDB_PCIINIT1   0x00F8  /* PCI Master (Initiator) 1 [R/W] */
-#define DDB_PCIERR     0x00B8  /* PCI Error [R/W] */
-
-
-/*
- *  Local-Bus Registers
- */
-#define DDB_LCNFG      0x0100  /* Local Bus Configuration [R/W] */
-#define DDB_LCST2      0x0110  /* Local Bus Chip-Select Timing 2 [R/W] */
-#define DDB_LCST3      0x0118  /* Local Bus Chip-Select Timing 3 [R/W] */
-#define DDB_LCST4      0x0120  /* Local Bus Chip-Select Timing 4 [R/W] */
-#define DDB_LCST5      0x0128  /* Local Bus Chip-Select Timing 5 [R/W] */
-#define DDB_LCST6      0x0130  /* Local Bus Chip-Select Timing 6 [R/W] */
-#define DDB_LCST7      0x0138  /* Local Bus Chip-Select Timing 7 [R/W] */
-#define DDB_LCST8      0x0140  /* Local Bus Chip-Select Timing 8 [R/W] */
-#define DDB_DCSFN      0x0150  /* Device Chip-Select Muxing and Output */
-                               /* Enables [R/W] */
-#define DDB_DCSIO      0x0158  /* Device Chip-Selects As I/O Bits [R/W] */
-#define DDB_BCST       0x0178  /* Local Boot Chip-Select Timing [R/W] */
-
-
-/*
- *  DMA Registers
- */
-#define DDB_DMACTRL0   0x0180  /* DMA Control 0 [R/W] */
-#define DDB_DMASRCA0   0x0188  /* DMA Source Address 0 [R/W] */
-#define DDB_DMADESA0   0x0190  /* DMA Destination Address 0 [R/W] */
-#define DDB_DMACTRL1   0x0198  /* DMA Control 1 [R/W] */
-#define DDB_DMASRCA1   0x01A0  /* DMA Source Address 1 [R/W] */
-#define DDB_DMADESA1   0x01A8  /* DMA Destination Address 1 [R/W] */
-
-
-/*
- *  Timer Registers
- */
-#define DDB_T0CTRL     0x01C0  /* SDRAM Refresh Control [R/W] */
-#define DDB_T0CNTR     0x01C8  /* SDRAM Refresh Counter [R/W] */
-#define DDB_T1CTRL     0x01D0  /* CPU-Bus Read Time-Out Control [R/W] */
-#define DDB_T1CNTR     0x01D8  /* CPU-Bus Read Time-Out Counter [R/W] */
-#define DDB_T2CTRL     0x01E0  /* General-Purpose Timer Control [R/W] */
-#define DDB_T2CNTR     0x01E8  /* General-Purpose Timer Counter [R/W] */
-#define DDB_T3CTRL     0x01F0  /* Watchdog Timer Control [R/W] */
-#define DDB_T3CNTR     0x01F8  /* Watchdog Timer Counter [R/W] */
-
-
-/*
- *  PCI Configuration Space Registers
- */
-#define DDB_PCI_BASE   0x0200
-
-#define DDB_VID                0x0200  /* PCI Vendor ID [R] */
-#define DDB_DID                0x0202  /* PCI Device ID [R] */
-#define DDB_PCICMD     0x0204  /* PCI Command [R/W] */
-#define DDB_PCISTS     0x0206  /* PCI Status [R/W] */
-#define DDB_REVID      0x0208  /* PCI Revision ID [R] */
-#define DDB_CLASS      0x0209  /* PCI Class Code [R] */
-#define DDB_CLSIZ      0x020C  /* PCI Cache Line Size [R/W] */
-#define DDB_MLTIM      0x020D  /* PCI Latency Timer [R/W] */
-#define DDB_HTYPE      0x020E  /* PCI Header Type [R] */
-#define DDB_BIST       0x020F  /* BIST [R] (unimplemented) */
-#define DDB_BARC       0x0210  /* PCI Base Address Register Control [R/W] */
-#define DDB_BAR0       0x0218  /* PCI Base Address Register 0 [R/W] */
-#define DDB_BAR1       0x0220  /* PCI Base Address Register 1 [R/W] */
-#define DDB_CIS                0x0228  /* PCI Cardbus CIS Pointer [R] */
-                               /* (unimplemented) */
-#define DDB_SSVID      0x022C  /* PCI Sub-System Vendor ID [R/W] */
-#define DDB_SSID       0x022E  /* PCI Sub-System ID [R/W] */
-#define DDB_ROM                0x0230  /* Expansion ROM Base Address [R] */
-                               /* (unimplemented) */
-#define DDB_INTLIN     0x023C  /* PCI Interrupt Line [R/W] */
-#define DDB_INTPIN     0x023D  /* PCI Interrupt Pin [R] */
-#define DDB_MINGNT     0x023E  /* PCI Min_Gnt [R] (unimplemented) */
-#define DDB_MAXLAT     0x023F  /* PCI Max_Lat [R] (unimplemented) */
-#define DDB_BAR2       0x0240  /* PCI Base Address Register 2 [R/W] */
-#define DDB_BAR3       0x0248  /* PCI Base Address Register 3 [R/W] */
-#define DDB_BAR4       0x0250  /* PCI Base Address Register 4 [R/W] */
-#define DDB_BAR5       0x0258  /* PCI Base Address Register 5 [R/W] */
-#define DDB_BAR6       0x0260  /* PCI Base Address Register 6 [R/W] */
-#define DDB_BAR7       0x0268  /* PCI Base Address Register 7 [R/W] */
-#define DDB_BAR8       0x0270  /* PCI Base Address Register 8 [R/W] */
-#define DDB_BARB       0x0278  /* PCI Base Address Register BOOT [R/W] */
-
-
-/*
- *  Nile 4 Register Access
- */
-
-static inline void ddb_sync(void)
-{
-    volatile u32 *p = (volatile u32 *)0xbfc00000;
-    (void)(*p);
-}
-
-static inline void ddb_out32(u32 offset, u32 val)
-{
-    *(volatile u32 *)(DDB_BASE+offset) = val;
-    ddb_sync();
-}
-
-static inline u32 ddb_in32(u32 offset)
-{
-    u32 val = *(volatile u32 *)(DDB_BASE+offset);
-    ddb_sync();
-    return val;
-}
-
-static inline void ddb_out16(u32 offset, u16 val)
-{
-    *(volatile u16 *)(DDB_BASE+offset) = val;
-    ddb_sync();
-}
-
-static inline u16 ddb_in16(u32 offset)
-{
-    u16 val = *(volatile u16 *)(DDB_BASE+offset);
-    ddb_sync();
-    return val;
-}
-
-static inline void ddb_out8(u32 offset, u8 val)
-{
-    *(volatile u8 *)(DDB_BASE+offset) = val;
-    ddb_sync();
-}
-
-static inline u8 ddb_in8(u32 offset)
-{
-    u8 val = *(volatile u8 *)(DDB_BASE+offset);
-    ddb_sync();
-    return val;
-}
-
-
-/*
- *  Physical Device Address Registers
- */
-
-extern u32
-ddb_calc_pdar(u32 phys, u32 size, int width, int on_memory_bus, int pci_visible);
-extern void
-ddb_set_pdar(u32 pdar, u32 phys, u32 size, int width,
-            int on_memory_bus, int pci_visible);
-
-/*
- *  PCI Master Registers
- */
-
-#define DDB_PCICMD_IACK                0       /* PCI Interrupt Acknowledge */
-#define DDB_PCICMD_IO          1       /* PCI I/O Space */
-#define DDB_PCICMD_MEM         3       /* PCI Memory Space */
-#define DDB_PCICMD_CFG         5       /* PCI Configuration Space */
-
-/*
- * additional options for pci init reg (no shifting needed)
- */
-#define DDB_PCI_CFGTYPE1     0x200   /* for pci init0/1 regs */
-#define DDB_PCI_ACCESS_32    0x10    /* for pci init0/1 regs */
-
-
-extern void ddb_set_pmr(u32 pmr, u32 type, u32 addr, u32 options);
-
-/*
- * we need to reset pci bus when we start up and shutdown
- */
-extern void ddb_pci_reset_bus(void);
-
-
-/*
- * include the board dependent part
- */
-#if defined(CONFIG_DDB5477)
-#include <asm/ddb5xxx/ddb5477.h>
-#else
-#error "Unknown DDB board!"
-#endif
-
-#endif /* __ASM_DDB5XXX_DDB5XXX_H */
diff --git a/include/asm-mips/edac.h b/include/asm-mips/edac.h
new file mode 100644 (file)
index 0000000..83719ee
--- /dev/null
@@ -0,0 +1,35 @@
+#ifndef ASM_EDAC_H
+#define ASM_EDAC_H
+
+/* ECC atomic, DMA, SMP and interrupt safe scrub function */
+
+static inline void atomic_scrub(void *va, u32 size)
+{
+       unsigned long *virt_addr = va;
+       unsigned long temp;
+       u32 i;
+
+       for (i = 0; i < size / sizeof(unsigned long); i++, virt_addr++) {
+
+               /*
+                * Very carefully read and write to memory atomically
+                * so we are interrupt, DMA and SMP safe.
+                *
+                * Intel: asm("lock; addl $0, %0"::"m"(*virt_addr));
+                */
+
+               __asm__ __volatile__ (
+               "       .set    mips3                                   \n"
+               "1:     ll      %0, %1          # atomic_add            \n"
+               "       ll      %0, %1          # atomic_add            \n"
+               "       addu    %0, $0                                  \n"
+               "       sc      %0, %1                                  \n"
+               "       beqz    %0, 1b                                  \n"
+               "       .set    mips0                                   \n"
+               : "=&r" (temp), "=m" (*virt_addr)
+               : "m" (*virt_addr));
+
+       }
+}
+
+#endif
index ebd6bfb19d667117f194048db9534885adc4a99c..e7d95d48177d18c93019c163f91d4303cbe7d2f9 100644 (file)
@@ -265,7 +265,7 @@ do {                                                                        \
 #ifdef CONFIG_MIPS32_N32
 #define __SET_PERSONALITY32_N32()                                      \
        do {                                                            \
-               current->thread.mflags |= MF_N32;                       \
+               set_thread_flag(TIF_32BIT_ADDR);                        \
                current->thread.abi = &mips_abi_n32;                    \
        } while (0)
 #else
@@ -276,7 +276,8 @@ do {                                                                        \
 #ifdef CONFIG_MIPS32_O32
 #define __SET_PERSONALITY32_O32()                                      \
        do {                                                            \
-               current->thread.mflags |= MF_O32;                       \
+               set_thread_flag(TIF_32BIT_REGS);                        \
+               set_thread_flag(TIF_32BIT_ADDR);                        \
                current->thread.abi = &mips_abi_32;                     \
        } while (0)
 #else
@@ -299,13 +300,13 @@ do {                                                                      \
 
 #define SET_PERSONALITY(ex, ibcs2)                                     \
 do {                                                                   \
-       current->thread.mflags &= ~MF_ABI_MASK;                         \
+       clear_thread_flag(TIF_32BIT_REGS);                              \
+       clear_thread_flag(TIF_32BIT_ADDR);                              \
+                                                                       \
        if ((ex).e_ident[EI_CLASS] == ELFCLASS32)                       \
                __SET_PERSONALITY32(ex);                                \
-       else {                                                          \
-               current->thread.mflags |= MF_N64;                       \
+       else                                                            \
                current->thread.abi = &mips_abi;                        \
-       }                                                               \
                                                                        \
        if (ibcs2)                                                      \
                set_personality(PER_SVR4);                              \
index d9119f43f9aa1497dbea3e4a2adccdc9a0fa02ba..918a4894b587d10fe8450a96239ad42f0b7e63e5 100644 (file)
@@ -3,7 +3,7 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2003, 2004 Ralf Baechle <ralf@linux-mips.org>
+ * Copyright (C) 2003, 04, 07 Ralf Baechle <ralf@linux-mips.org>
  * Copyright (C) MIPS Technologies, Inc.
  *   written by Ralf Baechle <ralf@linux-mips.org>
  */
@@ -23,6 +23,11 @@ static inline void name(void)                                                \
        __asm__ __volatile__ (#name);                                   \
 }
 
+/*
+ * MIPS R2 instruction hazard barrier.   Needs to be called as a subroutine.
+ */
+extern void mips_ihb(void);
+
 #endif
 
 ASMMACRO(_ssnop,
diff --git a/include/asm-mips/mach-tx49xx/cpu-feature-overrides.h b/include/asm-mips/mach-tx49xx/cpu-feature-overrides.h
new file mode 100644 (file)
index 0000000..275eaf9
--- /dev/null
@@ -0,0 +1,23 @@
+#ifndef __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H
+#define __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H
+
+#define cpu_has_llsc   1
+#define cpu_has_64bits 1
+#define cpu_has_inclusive_pcaches      0
+
+#define cpu_has_mips16         0
+#define cpu_has_mdmx           0
+#define cpu_has_mips3d         0
+#define cpu_has_smartmips      0
+#define cpu_has_vtag_icache    0
+#define cpu_has_ic_fills_f_dc  0
+#define cpu_has_dsp    0
+#define cpu_has_mipsmt 0
+#define cpu_has_userlocal      0
+
+#define cpu_has_mips32r1       0
+#define cpu_has_mips32r2       0
+#define cpu_has_mips64r1       0
+#define cpu_has_mips64r2       0
+
+#endif /* __ASM_MACH_TX49XX_CPU_FEATURE_OVERRIDES_H */
diff --git a/include/asm-mips/mach-tx49xx/kmalloc.h b/include/asm-mips/mach-tx49xx/kmalloc.h
new file mode 100644 (file)
index 0000000..913ff19
--- /dev/null
@@ -0,0 +1,8 @@
+#ifndef __ASM_MACH_TX49XX_KMALLOC_H
+#define __ASM_MACH_TX49XX_KMALLOC_H
+
+/*
+ * All happy, no need to define ARCH_KMALLOC_MINALIGN
+ */
+
+#endif /* __ASM_MACH_TX49XX_KMALLOC_H */
index c8ebcc3e12677cc8eadd22407e7b68ea31e20ca2..d589774835342bbce39b8195d6f6c3b0085cbff9 100644 (file)
@@ -67,6 +67,7 @@
 #define MIPS_REVISION_CORID_CORE_FPGAR2    8
 #define MIPS_REVISION_CORID_CORE_FPGA3     9
 #define MIPS_REVISION_CORID_CORE_24K       10
+#define MIPS_REVISION_CORID_CORE_FPGA4     11
 
 /**** Artificial corid defines ****/
 /*
index 8045abc78d0fc2a6eca35ba721f1e4e923307d36..ac7935203f8993e272f96d54de6d78c5a574f221 100644 (file)
@@ -8,6 +8,12 @@
 
 #include <linux/cpumask.h>
 
+/*
+ * How many VPEs and TCs is Linux allowed to use?  0 means no limit.
+ */
+extern int tclimit;
+extern int vpelimit;
+
 extern cpumask_t mt_fpu_cpumask;
 extern unsigned long mt_fpemul_threshold;
 
index 260f3448ccf1222579036927cece6b5ea8e98a35..6ad519189ce2975fefaee8c8796335a440e4f697 100644 (file)
@@ -22,7 +22,7 @@ struct callvectors {
        char*   (*gets) (char*);
        union {
                int     (*smpfork) (unsigned long cp, char *sp);
-               int     (*cpustart) (long, long, long, long);
+               int     (*cpustart) (long, void (*)(void), void *, long);
        } _s;
        int     (*semlock) (int sem);
        void    (*semunlock) (int sem);
index 1d8b9a8ae324d147923ef6593b9a9995700347b0..83bc94534084a429735e9d6620fdb1a02c2d9f80 100644 (file)
@@ -62,8 +62,9 @@ extern unsigned int vced_count, vcei_count;
  * This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
  */
-#define TASK_UNMAPPED_BASE     ((current->thread.mflags & MF_32BIT_ADDR) ? \
-       PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
+#define TASK_UNMAPPED_BASE                                             \
+       (test_thread_flag(TIF_32BIT_ADDR) ?                             \
+               PAGE_ALIGN(TASK_SIZE32 / 3) : PAGE_ALIGN(TASK_SIZE / 3))
 #endif
 
 #define NUM_FPU_REGS   32
@@ -132,22 +133,11 @@ struct thread_struct {
        unsigned long cp0_baduaddr;     /* Last kernel fault accessing USEG */
        unsigned long error_code;
        unsigned long trap_no;
-#define MF_FIXADE      1               /* Fix address errors in software */
-#define MF_LOGADE      2               /* Log address errors to syslog */
-#define MF_32BIT_REGS  4               /* also implies 16/32 fprs */
-#define MF_32BIT_ADDR  8               /* 32-bit address space (o32/n32) */
-#define MF_FPUBOUND    0x10            /* thread bound to FPU-full CPU set */
-       unsigned long mflags;
        unsigned long irix_trampoline;  /* Wheee... */
        unsigned long irix_oldctx;
        struct mips_abi *abi;
 };
 
-#define MF_ABI_MASK    (MF_32BIT_REGS | MF_32BIT_ADDR)
-#define MF_O32         (MF_32BIT_REGS | MF_32BIT_ADDR)
-#define MF_N32         MF_32BIT_ADDR
-#define MF_N64         0
-
 #ifdef CONFIG_MIPS_MT_FPAFF
 #define FPAFF_INIT                                             \
        .emulated_fp                    = 0,                    \
@@ -200,10 +190,6 @@ struct thread_struct {
        .cp0_baduaddr           = 0,                            \
        .error_code             = 0,                            \
        .trap_no                = 0,                            \
-       /*                                                      \
-        * For now the default is to fix address errors         \
-        */                                                     \
-       .mflags                 = MF_FIXADE,                    \
        .irix_trampoline        = 0,                            \
        .irix_oldctx            = 0,                            \
 }
diff --git a/include/asm-mips/seccomp.h b/include/asm-mips/seccomp.h
new file mode 100644 (file)
index 0000000..36ed440
--- /dev/null
@@ -0,0 +1,37 @@
+#ifndef __ASM_SECCOMP_H
+
+#include <linux/thread_info.h>
+#include <linux/unistd.h>
+
+#define __NR_seccomp_read __NR_read
+#define __NR_seccomp_write __NR_write
+#define __NR_seccomp_exit __NR_exit
+#define __NR_seccomp_sigreturn __NR_rt_sigreturn
+
+/*
+ * Kludge alert:
+ *
+ * The generic seccomp code currently allows only a single compat ABI.  Until
+ * this is fixed we priorize O32 as the compat ABI over N32.
+ */
+#ifdef CONFIG_MIPS32_O32
+
+#define TIF_32BIT TIF_32BIT_REGS
+
+#define __NR_seccomp_read_32           4003
+#define __NR_seccomp_write_32          4004
+#define __NR_seccomp_exit_32           4001
+#define __NR_seccomp_sigreturn_32      4193    /* rt_sigreturn */
+
+#elif defined(CONFIG_MIPS32_N32)
+
+#define TIF_32BIT _TIF_32BIT_ADDR
+
+#define __NR_seccomp_read_32           6000
+#define __NR_seccomp_write_32          6001
+#define __NR_seccomp_exit_32           6058
+#define __NR_seccomp_sigreturn_32      6211    /* rt_sigreturn */
+
+#endif /* CONFIG_MIPS32_O32 */
+
+#endif /* __ASM_SECCOMP_H */
index 8d0b1cd4a45e837989ced15e273b1aef9efb9db9..357251f42518bdb51e7c402ae720140880425007 100644 (file)
@@ -46,10 +46,12 @@ struct task_struct;
 
 #define __mips_mt_fpaff_switch_to(prev)                                        \
 do {                                                                   \
+       struct thread_info *__prev_ti = task_thread_info(prev);         \
+                                                                       \
        if (cpu_has_fpu &&                                              \
-           (prev->thread.mflags & MF_FPUBOUND) &&                      \
-            (!(KSTK_STATUS(prev) & ST0_CU1))) {                        \
-               prev->thread.mflags &= ~MF_FPUBOUND;                    \
+           test_ti_thread_flag(__prev_ti, TIF_FPUBOUND) &&             \
+           (!(KSTK_STATUS(prev) & ST0_CU1))) {                         \
+               clear_ti_thread_flag(__prev_ti, TIF_FPUBOUND);          \
                prev->cpus_allowed = prev->thread.user_cpus_allowed;    \
        }                                                               \
        next->thread.emulated_fp = 0;                                   \
index fbcda82044738b34674f8630aab3905dc2a7bf44..b2772df1a1bd6270a84da3e9d2fcfc5d0ae06ab8 100644 (file)
@@ -46,7 +46,7 @@ struct thread_info {
 {                                              \
        .task           = &tsk,                 \
        .exec_domain    = &default_exec_domain, \
-       .flags          = 0,                    \
+       .flags          = _TIF_FIXADE,          \
        .cpu            = 0,                    \
        .preempt_count  = 1,                    \
        .addr_limit     = KERNEL_DS,            \
@@ -87,9 +87,8 @@ register struct thread_info *__current_thread_info __asm__("$28");
 ({                                                             \
        struct thread_info *ret;                                \
                                                                \
-       ret = kmalloc(THREAD_SIZE, GFP_KERNEL);                 \
-       if (ret)                                                \
-               memset(ret, 0, THREAD_SIZE);                    \
+       ret = kzalloc(THREAD_SIZE, GFP_KERNEL);                 \
+                                                               \
        ret;                                                    \
 })
 #else
@@ -109,20 +108,23 @@ register struct thread_info *__current_thread_info __asm__("$28");
  * - pending work-to-be-done flags are in LSW
  * - other flags in MSW
  */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_SYSCALL_AUDIT      4       /* syscall auditing active */
-#define TIF_SECCOMP            5       /* secure computing */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_SYSCALL_AUDIT      3       /* syscall auditing active */
+#define TIF_SECCOMP            4       /* secure computing */
 #define TIF_RESTORE_SIGMASK    9       /* restore signal mask in do_signal() */
 #define TIF_USEDFPU            16      /* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG     17      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE             18
 #define TIF_FREEZE             19
+#define TIF_FIXADE             20      /* Fix address errors in software */
+#define TIF_LOGADE             21      /* Log address errors to syslog */
+#define TIF_32BIT_REGS         22      /* also implies 16/32 fprs */
+#define TIF_32BIT_ADDR         23      /* 32-bit address space (o32/n32) */
+#define TIF_FPUBOUND           24      /* thread bound to FPU-full CPU set */
 #define TIF_SYSCALL_TRACE      31      /* syscall trace active */
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_SYSCALL_AUDIT     (1<<TIF_SYSCALL_AUDIT)
@@ -131,6 +133,11 @@ register struct thread_info *__current_thread_info __asm__("$28");
 #define _TIF_USEDFPU           (1<<TIF_USEDFPU)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
 #define _TIF_FREEZE            (1<<TIF_FREEZE)
+#define _TIF_FIXADE            (1<<TIF_FIXADE)
+#define _TIF_LOGADE            (1<<TIF_LOGADE)
+#define _TIF_32BIT_REGS                (1<<TIF_32BIT_REGS)
+#define _TIF_32BIT_ADDR                (1<<TIF_32BIT_ADDR)
+#define _TIF_FPUBOUND          (1<<TIF_FPUBOUND)
 
 /* work to do on interrupt/exception return */
 #define _TIF_WORK_MASK         (0x0000ffef & ~_TIF_SECCOMP)
diff --git a/include/asm-mips/tx3912.h b/include/asm-mips/tx3912.h
deleted file mode 100644 (file)
index d709d87..0000000
+++ /dev/null
@@ -1,361 +0,0 @@
-/*
- *  include/asm-mips/tx3912.h
- *
- *  Copyright (C) 2001 Steven J. Hill (sjhill@realitydiluted.com)
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- *  Registers for TMPR3912/05 and PR31700 processors
- */
-#ifndef _TX3912_H_
-#define _TX3912_H_
-
-/*****************************************************************************
- *     Clock Subsystem                                                      *
- *     ---------------                                                      *
- *     Chapter 6 in Philips PR31700 and Toshiba TMPR3905/12 User Manuals    *
- *****************************************************************************/
-#define TX3912_CLK_CTRL                                        0x01c0
-
-/*
- * Clock control register values
- */
-#define TX3912_CLK_CTRL_CHICLKDIV_MASK                 0xff000000
-#define TX3912_CLK_CTRL_ENCLKTEST                      0x00800000
-#define TX3912_CLK_CTRL_CLKTESTSELSIB                  0x00400000
-#define TX3912_CLK_CTRL_CHIMCLKSEL                     0x00200000
-#define TX3912_CLK_CTRL_CHICLKDIR                      0x00100000
-#define TX3912_CLK_CTRL_ENCHIMCLK                      0x00080000
-#define TX3912_CLK_CTRL_ENVIDCLK                       0x00040000
-#define TX3912_CLK_CTRL_ENMBUSCLK                      0x00020000
-#define TX3912_CLK_CTRL_ENSPICLK                       0x00010000
-#define TX3912_CLK_CTRL_ENTIMERCLK                     0x00008000
-#define TX3912_CLK_CTRL_ENFASTTIMERCLK                 0x00004000
-#define TX3912_CLK_CTRL_SIBMCLKDIR                     0x00002000
-#define TX3912_CLK_CTRL_reserved1                      0x00001000
-#define TX3912_CLK_CTRL_ENSIBMCLK                      0x00000800
-#define TX3912_CLK_CTRL_SIBMCLKDIV_6                   0x00000600
-#define TX3912_CLK_CTRL_SIBMCLKDIV_5                   0x00000500
-#define TX3912_CLK_CTRL_SIBMCLKDIV_4                   0x00000400
-#define TX3912_CLK_CTRL_SIBMCLKDIV_3                   0x00000300
-#define TX3912_CLK_CTRL_SIBMCLKDIV_2                   0x00000200
-#define TX3912_CLK_CTRL_SIBMCLKDIV_1                   0x00000100
-#define TX3912_CLK_CTRL_CSERSEL                                0x00000080
-#define TX3912_CLK_CTRL_CSERDIV_6                      0x00000060
-#define TX3912_CLK_CTRL_CSERDIV_5                      0x00000050
-#define TX3912_CLK_CTRL_CSERDIV_4                      0x00000040
-#define TX3912_CLK_CTRL_CSERDIV_3                      0x00000030
-#define TX3912_CLK_CTRL_CSERDIV_2                      0x00000020
-#define TX3912_CLK_CTRL_CSERDIV_1                      0x00000010
-#define TX3912_CLK_CTRL_ENCSERCLK                      0x00000008
-#define TX3912_CLK_CTRL_ENIRCLK                                0x00000004
-#define TX3912_CLK_CTRL_ENUARTACLK                     0x00000002
-#define TX3912_CLK_CTRL_ENUARTBCLK                     0x00000001
-
-
-/*****************************************************************************
- *     Interrupt Subsystem                                                  *
- *     -------------------                                                  *
- *     Chapter 8 in Philips PR31700 and Toshiba TMPR3905/12 User Manuals    *
- *****************************************************************************/
-#define TX3912_INT1_CLEAR                              0x0100
-#define TX3912_INT2_CLEAR                              0x0104
-#define TX3912_INT3_CLEAR                              0x0108
-#define TX3912_INT4_CLEAR                              0x010c
-#define TX3912_INT5_CLEAR                              0x0110
-#define TX3912_INT1_ENABLE                             0x0118
-#define TX3912_INT2_ENABLE                             0x011c
-#define TX3912_INT3_ENABLE                             0x0120
-#define TX3912_INT4_ENABLE                             0x0124
-#define TX3912_INT5_ENABLE                             0x0128
-#define TX3912_INT6_ENABLE                             0x012c
-#define TX3912_INT1_STATUS                             0x0100
-#define TX3912_INT2_STATUS                             0x0104
-#define TX3912_INT3_STATUS                             0x0108
-#define TX3912_INT4_STATUS                             0x010c
-#define TX3912_INT5_STATUS                             0x0110
-#define TX3912_INT6_STATUS                             0x0114
-
-/*
- * Interrupt 2 register values
- */
-#define TX3912_INT2_UARTARXINT                         0x80000000
-#define TX3912_INT2_UARTARXOVERRUNINT                  0x40000000
-#define TX3912_INT2_UARTAFRAMEERRINT                   0x20000000
-#define TX3912_INT2_UARTABREAKINT                      0x10000000
-#define TX3912_INT2_UARTAPARITYINT                     0x08000000
-#define TX3912_INT2_UARTATXINT                         0x04000000
-#define TX3912_INT2_UARTATXOVERRUNINT                  0x02000000
-#define TX3912_INT2_UARTAEMPTYINT                      0x01000000
-#define TX3912_INT2_UARTADMAFULLINT                    0x00800000
-#define TX3912_INT2_UARTADMAHALFINT                    0x00400000
-#define TX3912_INT2_UARTBRXINT                         0x00200000
-#define TX3912_INT2_UARTBRXOVERRUNINT                  0x00100000
-#define TX3912_INT2_UARTBFRAMEERRINT                   0x00080000
-#define TX3912_INT2_UARTBBREAKINT                      0x00040000
-#define TX3912_INT2_UARTBPARITYINT                     0x00020000
-#define TX3912_INT2_UARTBTXINT                         0x00010000
-#define TX3912_INT2_UARTBTXOVERRUNINT                  0x00008000
-#define TX3912_INT2_UARTBEMPTYINT                      0x00004000
-#define TX3912_INT2_UARTBDMAFULLINT                    0x00002000
-#define TX3912_INT2_UARTBDMAHALFINT                    0x00001000
-#define TX3912_INT2_UARTA_RX_BITS                      0xf8000000
-#define TX3912_INT2_UARTA_TX_BITS                      0x07c00000
-#define TX3912_INT2_UARTB_RX_BITS                      0x003e0000
-#define TX3912_INT2_UARTB_TX_BITS                      0x0001f000
-
-/*
- * Interrupt 5 register values
- */
-#define TX3912_INT5_RTCINT                             0x80000000
-#define TX3912_INT5_ALARMINT                           0x40000000
-#define TX3912_INT5_PERINT                             0x20000000
-#define TX3912_INT5_STPTIMERINT                                0x10000000
-#define TX3912_INT5_POSPWRINT                          0x08000000
-#define TX3912_INT5_NEGPWRINT                          0x04000000
-#define TX3912_INT5_POSPWROKINT                                0x02000000
-#define TX3912_INT5_NEGPWROKINT                                0x01000000
-#define TX3912_INT5_POSONBUTINT                                0x00800000
-#define TX3912_INT5_NEGONBUTINT                                0x00400000
-#define TX3912_INT5_SPIBUFAVAILINT                     0x00200000
-#define TX3912_INT5_SPIERRINT                          0x00100000
-#define TX3912_INT5_SPIRCVINT                          0x00080000
-#define TX3912_INT5_SPIEMPTYINT                                0x00040000
-#define TX3912_INT5_IRCONSMINT                         0x00020000
-#define TX3912_INT5_CARSTINT                           0x00010000
-#define TX3912_INT5_POSCARINT                          0x00008000
-#define TX3912_INT5_NEGCARINT                          0x00004000
-#define TX3912_INT5_IOPOSINT6                          0x00002000
-#define TX3912_INT5_IOPOSINT5                          0x00001000
-#define TX3912_INT5_IOPOSINT4                          0x00000800
-#define TX3912_INT5_IOPOSINT3                          0x00000400
-#define TX3912_INT5_IOPOSINT2                          0x00000200
-#define TX3912_INT5_IOPOSINT1                          0x00000100
-#define TX3912_INT5_IOPOSINT0                          0x00000080
-#define TX3912_INT5_IONEGINT6                          0x00000040
-#define TX3912_INT5_IONEGINT5                          0x00000020
-#define TX3912_INT5_IONEGINT4                          0x00000010
-#define TX3912_INT5_IONEGINT3                          0x00000008
-#define TX3912_INT5_IONEGINT2                          0x00000004
-#define TX3912_INT5_IONEGINT1                          0x00000002
-#define TX3912_INT5_IONEGINT0                          0x00000001
-
-/*
- * Interrupt 6 status register values
- */
-#define TX3912_INT6_STATUS_IRQHIGH                     0x80000000
-#define TX3912_INT6_STATUS_IRQLOW                      0x40000000
-#define TX3912_INT6_STATUS_reserved6                   0x3fffffc0
-#define TX3912_INT6_STATUS_INTVEC_POSNEGPWROKINT       0x0000003c
-#define TX3912_INT6_STATUS_INTVEC_ALARMINT             0x00000038
-#define TX3912_INT6_STATUS_INTVEC_PERINT               0x00000034
-#define TX3912_INT6_STATUS_INTVEC_reserved5            0x00000030
-#define TX3912_INT6_STATUS_INTVEC_UARTARXINT           0x0000002c
-#define TX3912_INT6_STATUS_INTVEC_UARTBRXINT           0x00000028
-#define TX3912_INT6_STATUS_INTVEC_reserved4            0x00000024
-#define TX3912_INT6_STATUS_INTVEC_IOPOSINT65           0x00000020
-#define TX3912_INT6_STATUS_INTVEC_reserved3            0x0000001c
-#define TX3912_INT6_STATUS_INTVEC_IONEGINT65           0x00000018
-#define TX3912_INT6_STATUS_INTVEC_reserved2            0x00000014
-#define TX3912_INT6_STATUS_INTVEC_SNDDMACNTINT         0x00000010
-#define TX3912_INT6_STATUS_INTVEC_TELDMACNTINT         0x0000000c
-#define TX3912_INT6_STATUS_INTVEC_CHIDMACNTINT         0x00000008
-#define TX3912_INT6_STATUS_INTVEC_IOPOSNEGINT0         0x00000004
-#define TX3912_INT6_STATUS_INTVEC_STDHANDLER           0x00000000
-#define TX3912_INT6_STATUS_reserved1                   0x00000003
-
-/*
- * Interrupt 6 enable register values
- */
-#define TX3912_INT6_ENABLE_reserved5                   0xfff80000
-#define TX3912_INT6_ENABLE_GLOBALEN                    0x00040000
-#define TX3912_INT6_ENABLE_IRQPRITEST                  0x00020000
-#define TX3912_INT6_ENABLE_IRQTEST                     0x00010000
-#define TX3912_INT6_ENABLE_PRIORITYMASK_POSNEGPWROKINT 0x00008000
-#define TX3912_INT6_ENABLE_PRIORITYMASK_ALARMINT       0x00004000
-#define TX3912_INT6_ENABLE_PRIORITYMASK_PERINT         0x00002000
-#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved4      0x00001000
-#define TX3912_INT6_ENABLE_PRIORITYMASK_UARTARXINT     0x00000800
-#define TX3912_INT6_ENABLE_PRIORITYMASK_UARTBRXINT     0x00000400
-#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved3      0x00000200
-#define TX3912_INT6_ENABLE_PRIORITYMASK_IOPOSINT65     0x00000100
-#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved2      0x00000080
-#define TX3912_INT6_ENABLE_PRIORITYMASK_IONEGINT65     0x00000040
-#define TX3912_INT6_ENABLE_PRIORITYMASK_reserved1      0x00000020
-#define TX3912_INT6_ENABLE_PRIORITYMASK_SNDDMACNTINT   0x00000010
-#define TX3912_INT6_ENABLE_PRIORITYMASK_TELDMACNTINT   0x00000008
-#define TX3912_INT6_ENABLE_PRIORITYMASK_CHIDMACNTINT   0x00000004
-#define TX3912_INT6_ENABLE_PRIORITYMASK_IOPOSNEGINT0   0x00000002
-#define TX3912_INT6_ENABLE_PRIORITYMASK_STDHANDLER     0x00000001
-#define TX3912_INT6_ENABLE_HIGH_PRIORITY               0x0000ffff
-
-
-/*****************************************************************************
- *     Power Subsystem                                                      *
- *     ---------------                                                      *
- *     Chapter 11 in Philips PR31700 User Manual                            *
- *     Chapter 12 in Toshiba TMPR3905/12 User Manual                        *
- *****************************************************************************/
-#define TX3912_POWER_CTRL                              0x01c4
-
-/*
- * Power control register values
- */
-#define TX3912_POWER_CTRL_ONBUTN                       0x80000000
-#define TX3912_POWER_CTRL_PWRINT                       0x40000000
-#define TX3912_POWER_CTRL_PWROK                                0x20000000
-#define TX3912_POWER_CTRL_VIDRF_MASK                   0x18000000
-#define TX3912_POWER_CTRL_SLOWBUS                      0x04000000
-#define TX3912_POWER_CTRL_DIVMOD                       0x02000000
-#define TX3912_POWER_CTRL_reserved2                    0x01ff0000
-#define TX3912_POWER_CTRL_STPTIMERVAL_MASK             0x0000f000
-#define TX3912_POWER_CTRL_ENSTPTIMER                   0x00000800
-#define TX3912_POWER_CTRL_ENFORCESHUTDWN               0x00000400
-#define TX3912_POWER_CTRL_FORCESHUTDWN                 0x00000200
-#define TX3912_POWER_CTRL_FORCESHUTDWNOCC              0x00000100
-#define TX3912_POWER_CTRL_SELC2MS                      0x00000080
-#define TX3912_POWER_CTRL_reserved1                    0x00000040
-#define TX3912_POWER_CTRL_BPDBVCC3                     0x00000020
-#define TX3912_POWER_CTRL_STOPCPU                      0x00000010
-#define TX3912_POWER_CTRL_DBNCONBUTN                   0x00000008
-#define TX3912_POWER_CTRL_COLDSTART                    0x00000004
-#define TX3912_POWER_CTRL_PWRCS                                0x00000002
-#define TX3912_POWER_CTRL_VCCON                                0x00000001
-
-
-/*****************************************************************************
- *     Timer Subsystem                                                      *
- *     ---------------                                                      *
- *     Chapter 14 in Philips PR31700 User Manual                            *
- *     Chapter 15 in Toshiba TMPR3905/12 User Manual                        *
- *****************************************************************************/
-#define TX3912_RTC_HIGH                                        0x0140
-#define TX3912_RTC_LOW                                 0x0144
-#define TX3912_RTC_ALARM_HIGH                          0x0148
-#define TX3912_RTC_ALARM_LOW                           0x014c
-#define TX3912_TIMER_CTRL                              0x0150
-#define TX3912_TIMER_PERIOD                            0x0154
-
-/*
- * Timer control register values
- */
-#define TX3912_TIMER_CTRL_FREEZEPRE                    0x00000080
-#define TX3912_TIMER_CTRL_FREEZERTC                    0x00000040
-#define TX3912_TIMER_CTRL_FREEZETIMER                  0x00000020
-#define TX3912_TIMER_CTRL_ENPERTIMER                   0x00000010
-#define TX3912_TIMER_CTRL_RTCCLEAR                     0x00000008
-#define TX3912_TIMER_CTRL_TESTC8MS                     0x00000004
-#define TX3912_TIMER_CTRL_ENTESTCLK                    0x00000002
-#define TX3912_TIMER_CTRL_ENRTCTST                     0x00000001
-
-/*
- * The periodic timer has granularity of 868 nanoseconds which
- * results in a count of (1.152 x 10^6 / 100) in order to achieve
- * a 10 millisecond periodic system clock.
- */
-#define TX3912_SYS_TIMER_VALUE                         (1152000/HZ)
-
-
-/*****************************************************************************
- *     UART Subsystem                                                       *
- *     --------------                                                       *
- *     Chapter 15 in Philips PR31700 User Manual                            *
- *     Chapter 16 in Toshiba TMPR3905/12 User Manual                        *
- *****************************************************************************/
-#define TX3912_UARTA_CTRL1                             0x00b0
-#define TX3912_UARTA_CTRL2                             0x00b4
-#define TX3912_UARTA_DMA_CTRL1                         0x00b8
-#define TX3912_UARTA_DMA_CTRL2                         0x00bc
-#define TX3912_UARTA_DMA_CNT                           0x00c0
-#define TX3912_UARTA_DATA                              0x00c4
-#define TX3912_UARTB_CTRL1                             0x00c8
-#define TX3912_UARTB_CTRL2                             0x00cc
-#define TX3912_UARTB_DMA_CTRL1                         0x00d0
-#define TX3912_UARTB_DMA_CTRL2                         0x00d4
-#define TX3912_UARTB_DMA_CNT                           0x00d8
-#define TX3912_UARTB_DATA                              0x00dc
-
-/*
- * UART Control Register 1 values
- */
-#define TX3912_UART_CTRL1_UARTON                       0x80000000
-#define TX3912_UART_CTRL1_EMPTY                                0x40000000
-#define TX3912_UART_CTRL1_PRXHOLDFULL                  0x20000000
-#define TX3912_UART_CTRL1_RXHOLDFULL                   0x10000000
-#define TX3912_UART_CTRL1_reserved1                    0x0fff0000
-#define TX3912_UART_CTRL1_ENDMARX                      0x00008000
-#define TX3912_UART_CTRL1_ENDMATX                      0x00004000
-#define TX3912_UART_CTRL1_TESTMODE                     0x00002000
-#define TX3912_UART_CTRL1_ENBREAKHALT                  0x00001000
-#define TX3912_UART_CTRL1_ENDMATEST                    0x00000800
-#define TX3912_UART_CTRL1_ENDMALOOP                    0x00000400
-#define TX3912_UART_CTRL1_PULSEOPT1                    0x00000200
-#define TX3912_UART_CTRL1_PULSEOPT1                    0x00000100
-#define TX3912_UART_CTRL1_DTINVERT                     0x00000080
-#define TX3912_UART_CTRL1_DISTXD                       0x00000040
-#define TX3912_UART_CTRL1_TWOSTOP                      0x00000020
-#define TX3912_UART_CTRL1_LOOPBACK                     0x00000010
-#define TX3912_UART_CTRL1_BIT_7                                0x00000008
-#define TX3912_UART_CTRL1_EVENPARITY                   0x00000004
-#define TX3912_UART_CTRL1_ENPARITY                     0x00000002
-#define TX3912_UART_CTRL1_ENUART                       0x00000001
-
-/*
- * UART Control Register 2 values
- */
-#define TX3912_UART_CTRL2_B230400                      0x0000  /*   0 */
-#define TX3912_UART_CTRL2_B115200                      0x0001  /*   1 */
-#define TX3912_UART_CTRL2_B76800                       0x0002  /*   2 */
-#define TX3912_UART_CTRL2_B57600                       0x0003  /*   3 */
-#define TX3912_UART_CTRL2_B38400                       0x0005  /*   5 */
-#define TX3912_UART_CTRL2_B19200                       0x000b  /*  11 */
-#define TX3912_UART_CTRL2_B9600                                0x0016  /*  22 */
-#define TX3912_UART_CTRL2_B4800                                0x002f  /*  47 */
-#define TX3912_UART_CTRL2_B2400                                0x005f  /*  95 */
-#define TX3912_UART_CTRL2_B1200                                0x00bf  /* 191 */
-#define TX3912_UART_CTRL2_B600                         0x017f  /* 383 */
-#define TX3912_UART_CTRL2_B300                         0x02ff  /* 767 */
-
-/*****************************************************************************
- *     Video Subsystem                                                      *
- *     ---------------                                                      *
- *     Chapter 16 in Philips PR31700 User Manual                            *
- *     Chapter 17 in Toshiba TMPR3905/12 User Manual                        *
- *****************************************************************************/
-#define TX3912_VIDEO_CTRL1                             0x0028
-#define TX3912_VIDEO_CTRL2                             0x002c
-#define TX3912_VIDEO_CTRL3                             0x0030
-#define TX3912_VIDEO_CTRL4                             0x0034
-#define TX3912_VIDEO_CTRL5                             0x0038
-#define TX3912_VIDEO_CTRL6                             0x003c
-#define TX3912_VIDEO_CTRL7                             0x0040
-#define TX3912_VIDEO_CTRL8                             0x0044
-#define TX3912_VIDEO_CTRL9                             0x0048
-#define TX3912_VIDEO_CTRL10                            0x004c
-#define TX3912_VIDEO_CTRL11                            0x0050
-#define TX3912_VIDEO_CTRL12                            0x0054
-#define TX3912_VIDEO_CTRL13                            0x0058
-#define TX3912_VIDEO_CTRL14                            0x005c
-
-/*
- * Video Control Register 1 values
- */
-#define TX3912_VIDEO_CTRL1_LINECNT                     0xffc00000
-#define TX3912_VIDEO_CTRL1_LOADDLY                     0x00200000
-#define TX3912_VIDEO_CTRL1_BAUDVAL                     0x001f0000
-#define TX3912_VIDEO_CTRL1_VIDDONEVAL                  0x0000fe00
-#define TX3912_VIDEO_CTRL1_ENFREEZEFRAME               0x00000100
-#define TX3912_VIDEO_CTRL1_BITSEL_MASK                 0x000000c0
-#define TX3912_VIDEO_CTRL1_BITSEL_8BIT_COLOR           0x000000c0
-#define TX3912_VIDEO_CTRL1_BITSEL_4BIT_GRAY            0x00000080
-#define TX3912_VIDEO_CTRL1_BITSEL_2BIT_GRAY            0x00000040
-#define TX3912_VIDEO_CTRL1_DISPSPLIT                   0x00000020
-#define TX3912_VIDEO_CTRL1_DISP8                       0x00000010
-#define TX3912_VIDEO_CTRL1_DFMODE                      0x00000008
-#define TX3912_VIDEO_CTRL1_INVVID                      0x00000004
-#define TX3912_VIDEO_CTRL1_DISPON                      0x00000002
-#define TX3912_VIDEO_CTRL1_ENVID                       0x00000001
-
-#endif /* _TX3912_H_ */
index 94bef03d96358ba6ca4d8917f84b8758222115f4..5dc40a867774356f543436d8778fc25a8956e2f8 100644 (file)
@@ -52,4 +52,6 @@
 #define RBTX4927_RTL_8019_BASE (0x1c020280-TBTX4927_ISA_IO_OFFSET)
 #define RBTX4927_RTL_8019_IRQ  (29)
 
+int toshiba_rbtx4927_irq_nested(int sw_irq);
+
 #endif /* __ASM_TX4927_TOSHIBA_RBTX4927_H */
index ed16de0a6398b92e7a1912f2db813a6e43fbbc97..fa9a587b3bf18e4b8bef3a1e610116fa3c4dd4e9 100644 (file)
 #define __NR_signalfd                  (__NR_Linux + 317)
 #define __NR_timerfd                   (__NR_Linux + 318)
 #define __NR_eventfd                   (__NR_Linux + 319)
+#define __NR_fallocate                 (__NR_Linux + 320)
 
 /*
  * Offset of the last Linux o32 flavoured syscall
  */
-#define __NR_Linux_syscalls            319
+#define __NR_Linux_syscalls            320
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI32 */
 
 #define __NR_O32_Linux                 4000
-#define __NR_O32_Linux_syscalls                319
+#define __NR_O32_Linux_syscalls                320
 
 #if _MIPS_SIM == _MIPS_SIM_ABI64
 
 #define __NR_signalfd                  (__NR_Linux + 276)
 #define __NR_timerfd                   (__NR_Linux + 277)
 #define __NR_eventfd                   (__NR_Linux + 278)
+#define __NR_fallocate                 (__NR_Linux + 279)
 
 /*
  * Offset of the last Linux 64-bit flavoured syscall
  */
-#define __NR_Linux_syscalls            278
+#define __NR_Linux_syscalls            279
 
 #endif /* _MIPS_SIM == _MIPS_SIM_ABI64 */
 
 #define __NR_64_Linux                  5000
-#define __NR_64_Linux_syscalls         278
+#define __NR_64_Linux_syscalls         279
 
 #if _MIPS_SIM == _MIPS_SIM_NABI32
 
 #define __NR_signalfd                  (__NR_Linux + 280)
 #define __NR_timerfd                   (__NR_Linux + 281)
 #define __NR_eventfd                   (__NR_Linux + 282)
+#define __NR_fallocate                 (__NR_Linux + 283)
 
 /*
  * Offset of the last N32 flavoured syscall
  */
-#define __NR_Linux_syscalls            282
+#define __NR_Linux_syscalls            283
 
 #endif /* _MIPS_SIM == _MIPS_SIM_NABI32 */
 
 #define __NR_N32_Linux                 6000
-#define __NR_N32_Linux_syscalls                282
+#define __NR_N32_Linux_syscalls                283
 
 #ifdef __KERNEL__
 
index 2883ccc69ed004cbd01b75f50033b3f1c65c9455..c0715d0a6b28739a6f83703bdfc7ca1969332a95 100644 (file)
  * exceptions.
  */
 #if defined(CONFIG_BASLER_EXCITE) || defined(CONFIG_MIPS_ATLAS) || \
-    defined(CONFIG_MIPS_MALTA) || defined(CONFIG_MOMENCO_OCELOT) || \
-    defined(CONFIG_PMC_YOSEMITE) || defined(CONFIG_SGI_IP32) || \
-    defined(CONFIG_WR_PPMC)
+    defined(CONFIG_MIPS_MALTA) || defined(CONFIG_PMC_YOSEMITE) || \
+    defined(CONFIG_SGI_IP32) || defined(CONFIG_WR_PPMC)
 #define ICACHE_REFILLS_WORKAROUND_WAR  1
 #endif
 
index 83ba510ed5d874ea77c70ec9d8ed7352fd31b6dc..8cfc553fc837267e2342cbf66f4ef27efacde143 100644 (file)
@@ -74,7 +74,7 @@
 
 
 #define WARN_ON(x) ({                                          \
-       typeof(x) __ret_warn_on = (x);                          \
+       int __ret_warn_on = !!(x);                              \
        if (__builtin_constant_p(__ret_warn_on)) {              \
                if (__ret_warn_on)                              \
                        __WARN();                               \
index 949314cf6188998dae95213b930e79a7edbb4c7b..2d9c7500867b599ade220a0a086d8d055057c675 100644 (file)
@@ -56,23 +56,21 @@ struct thread_info {
  * thread information flags
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG     4       /* true if poll_idle() is polling TIF_NEED_RESCHED */
-#define TIF_32BIT               5       /* 32 bit binary */
-#define TIF_MEMDIE             6
-#define TIF_RESTORE_SIGMASK    7       /* restore saved signal mask */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     3       /* true if poll_idle() is polling TIF_NEED_RESCHED */
+#define TIF_32BIT               4       /* 32 bit binary */
+#define TIF_MEMDIE             5
+#define TIF_RESTORE_SIGMASK    6       /* restore saved signal mask */
 
 #define _TIF_SYSCALL_TRACE     (1 << TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1 << TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1 << TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1 << TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1 << TIF_POLLING_NRFLAG)
 #define _TIF_32BIT             (1 << TIF_32BIT)
 #define _TIF_RESTORE_SIGMASK   (1 << TIF_RESTORE_SIGMASK)
 
-#define _TIF_USER_WORK_MASK     (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
+#define _TIF_USER_WORK_MASK     (_TIF_SIGPENDING | \
                                  _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
 
 #endif /* __KERNEL__ */
index f6fa39474846457f9960c6072f0a43aff16dc5ac..e55d1f66b86fca4646f702355e15beaea10f6b65 100644 (file)
@@ -79,7 +79,7 @@
                _EMIT_BUG_ENTRY                                 \
                : : "i" (__FILE__), "i" (__LINE__), "i" (0),    \
                  "i" (sizeof(struct bug_entry)),               \
-                 "r" ((long)(x)));                             \
+                 "r" ((__force long)(x)));                     \
        }                                                       \
 } while (0)
 
@@ -93,7 +93,7 @@
 } while (0)
 
 #define WARN_ON(x) ({                                          \
-       typeof(x) __ret_warn_on = (x);                          \
+       int __ret_warn_on = !!(x);                              \
        if (__builtin_constant_p(__ret_warn_on)) {              \
                if (__ret_warn_on)                              \
                        __WARN();                               \
index f6bd804d9090e3d714393c284957e428f7a43567..744d6bb2411646ff89ace4b049fbc062ec6cce94 100644 (file)
@@ -95,7 +95,7 @@ static inline int dma_set_mask(struct device *dev, u64 dma_mask)
                return -EIO;
        if (dma_ops->set_dma_mask != NULL)
                return dma_ops->set_dma_mask(dev, dma_mask);
-       if (!dev->dma_mask || !dma_supported(dev, *dev->dma_mask))
+       if (!dev->dma_mask || !dma_supported(dev, dma_mask))
                return -EIO;
        *dev->dma_mask = dma_mask;
        return 0;
index 695962f020597bc5f668ca5c5d06e272eaa0a4f6..3112ad14ad9504b699f6c4e65cc41d4a76dc332d 100644 (file)
@@ -262,6 +262,7 @@ extern void slb_initialize(void);
 extern void slb_flush_and_rebolt(void);
 extern void stab_initialize(unsigned long stab);
 
+extern void slb_vmalloc_update(void);
 #endif /* __ASSEMBLY__ */
 
 /*
index 10c51f457d4887c1e89f9803e1c0e63355f4da6a..236a9210e5fc112b2ba41ab568cc81e4b36ce8e4 100644 (file)
@@ -190,7 +190,6 @@ extern void copy_user_page(void *to, void *from, unsigned long vaddr,
 extern int page_is_ram(unsigned long pfn);
 
 struct vm_area_struct;
-extern const char *arch_vma_name(struct vm_area_struct *vma);
 
 #include <asm-generic/memory_model.h>
 #endif /* __ASSEMBLY__ */
index d53e0eb1de163a77ef879bd86de4e2fa90c089fb..e909769b641046a3b718170a20691fdc5fb2141f 100644 (file)
@@ -71,6 +71,14 @@ static inline struct pci_controller *pci_bus_to_host(struct pci_bus *bus)
        return bus->sysdata;
 }
 
+static inline int isa_vaddr_is_ioport(void __iomem *address)
+{
+       /* No specific ISA handling on ppc32 at this stage, it
+        * all goes through PCI
+        */
+       return 0;
+}
+
 /* These are used for config access before all the PCI probing
    has been done. */
 int early_read_config_byte(struct pci_controller *hose, int bus, int dev_fn,
@@ -241,6 +249,13 @@ extern void pcibios_free_controller(struct pci_controller *phb);
 
 extern void isa_bridge_find_early(struct pci_controller *hose);
 
+static inline int isa_vaddr_is_ioport(void __iomem *address)
+{
+       /* Check if address hits the reserved legacy IO range */
+       unsigned long ea = (unsigned long)address;
+       return ea >= ISA_IO_BASE && ea < ISA_IO_END;
+}
+
 extern int pcibios_unmap_io_space(struct pci_bus *bus);
 extern int pcibios_map_io_space(struct pci_bus *bus);
 
@@ -271,11 +286,16 @@ extern struct pci_controller *
 pcibios_alloc_controller(struct device_node *dev);
 #ifdef CONFIG_PCI
 extern unsigned long pci_address_to_pio(phys_addr_t address);
+extern int pcibios_vaddr_is_ioport(void __iomem *address);
 #else
 static inline unsigned long pci_address_to_pio(phys_addr_t address)
 {
        return (unsigned long)-1;
 }
+static inline int pcibios_vaddr_is_ioport(void __iomem *address)
+{
+       return 0;
+}
 #endif
 
 
index 31cbd3d7fce82b24690e4ed4e0fa6a7b84d5ceda..33ae9018fe7242a303c690c902f658226dd0a5e0 100644 (file)
 
 /* Shift to put page number into pte.
  *
- * That gives us a max RPN of 32 bits, which means a max of 48 bits
- * of addressable physical space.
- * We could get 3 more bits here by setting PTE_RPN_SHIFT to 29 but
- * 32 makes PTEs more readable for debugging for now :)
+ * That gives us a max RPN of 34 bits, which means a max of 50 bits
+ * of addressable physical space, or 46 bits for the special 4k PFNs.
  */
-#define PTE_RPN_SHIFT  (32)
+#define PTE_RPN_SHIFT  (30)
 #define PTE_RPN_MAX    (1UL << (64 - PTE_RPN_SHIFT))
 #define PTE_RPN_MASK   (~((1UL<<PTE_RPN_SHIFT)-1))
 
index fa083d8e46632807b5a206a5ab7fa528e7676fea..65325721446deca505420cfc8dae4cf8c1430847 100644 (file)
@@ -181,6 +181,18 @@ name: \
        .type GLUE(.,name),@function; \
 GLUE(.,name):
 
+#define _INIT_STATIC(name) \
+       .section ".text.init.refok"; \
+       .align 2 ; \
+       .section ".opd","aw"; \
+name: \
+       .quad GLUE(.,name); \
+       .quad .TOC.@tocbase; \
+       .quad 0; \
+       .previous; \
+       .type GLUE(.,name),@function; \
+GLUE(.,name):
+
 #else /* 32-bit */
 
 #define _GLOBAL(n)     \
index 7e78f6a1ab8b0e9fe56606ff945aaa74beef394e..0f37c7c908207ae1d65c374f41f371308bbeef19 100644 (file)
@@ -178,6 +178,7 @@ struct spu_management_ops {
        int (*enumerate_spus)(int (*fn)(void *data));
        int (*create_spu)(struct spu *spu, void *data);
        int (*destroy_spu)(struct spu *spu);
+       int (*init_affinity)(void);
 };
 
 extern const struct spu_management_ops* spu_management_ops;
@@ -200,6 +201,12 @@ spu_destroy_spu (struct spu *spu)
        return spu_management_ops->destroy_spu(spu);
 }
 
+static inline int
+spu_init_affinity (void)
+{
+       return spu_management_ops->init_affinity();
+}
+
 /*
  * The declarations folowing are put here for convenience
  * and only intended to be used by the platform setup code.
index 9d9aeca8ad225f631f6f5e5343801a0ce043158c..40d5f98c44fca2f79fbdae31feb791bfff247bdc 100644 (file)
@@ -107,28 +107,26 @@ static inline struct thread_info *current_thread_info(void)
  * thread information flag bit numbers
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG     4       /* true if poll_idle() is polling
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     3       /* true if poll_idle() is polling
                                           TIF_NEED_RESCHED */
-#define TIF_32BIT              5       /* 32 bit binary */
-#define TIF_PERFMON_WORK       6       /* work for pfm_handle_work() */
-#define TIF_PERFMON_CTXSW      7       /* perfmon needs ctxsw calls */
-#define TIF_SYSCALL_AUDIT      8       /* syscall auditing active */
-#define TIF_SINGLESTEP         9       /* singlestepping active */
-#define TIF_MEMDIE             10
-#define TIF_SECCOMP            11      /* secure computing */
-#define TIF_RESTOREALL         12      /* Restore all regs (implies NOERROR) */
-#define TIF_NOERROR            14      /* Force successful syscall return */
-#define TIF_RESTORE_SIGMASK    15      /* Restore signal mask in do_signal */
-#define TIF_FREEZE             16      /* Freezing for suspend */
-#define TIF_RUNLATCH           17      /* Is the runlatch enabled? */
-#define TIF_ABI_PENDING                18      /* 32/64 bit switch needed */
+#define TIF_32BIT              4       /* 32 bit binary */
+#define TIF_PERFMON_WORK       5       /* work for pfm_handle_work() */
+#define TIF_PERFMON_CTXSW      6       /* perfmon needs ctxsw calls */
+#define TIF_SYSCALL_AUDIT      7       /* syscall auditing active */
+#define TIF_SINGLESTEP         8       /* singlestepping active */
+#define TIF_MEMDIE             9
+#define TIF_SECCOMP            10      /* secure computing */
+#define TIF_RESTOREALL         11      /* Restore all regs (implies NOERROR) */
+#define TIF_NOERROR            12      /* Force successful syscall return */
+#define TIF_RESTORE_SIGMASK    13      /* Restore signal mask in do_signal */
+#define TIF_FREEZE             14      /* Freezing for suspend */
+#define TIF_RUNLATCH           15      /* Is the runlatch enabled? */
+#define TIF_ABI_PENDING                16      /* 32/64 bit switch needed */
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
@@ -146,7 +144,7 @@ static inline struct thread_info *current_thread_info(void)
 #define _TIF_ABI_PENDING       (1<<TIF_ABI_PENDING)
 #define _TIF_SYSCALL_T_OR_A    (_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP)
 
-#define _TIF_USER_WORK_MASK    (_TIF_NOTIFY_RESUME | _TIF_SIGPENDING | \
+#define _TIF_USER_WORK_MASK    ( _TIF_SIGPENDING | \
                                 _TIF_NEED_RESCHED | _TIF_RESTORE_SIGMASK)
 #define _TIF_PERSYSCALL_MASK   (_TIF_RESTOREALL|_TIF_NOERROR)
 
index 0117b544ecbce1ff1c7741f3e55938bd31f34081..3a0975e2adadad1ff673b6880ae04ed33f016449 100644 (file)
@@ -80,6 +80,11 @@ extern const void *vio_get_attribute(struct vio_dev *vdev, char *which,
 extern struct vio_dev *vio_find_node(struct device_node *vnode);
 extern int vio_enable_interrupts(struct vio_dev *dev);
 extern int vio_disable_interrupts(struct vio_dev *dev);
+#else
+static inline int vio_enable_interrupts(struct vio_dev *dev)
+{
+       return 0;
+}
 #endif
 
 static inline struct vio_driver *to_vio_driver(struct device_driver *drv)
index db3776f181989c65df08b11584f29a45b365ee25..2963d6aa3ea551b6b1d6d0228650dc23d4aca234 100644 (file)
@@ -120,14 +120,6 @@ extern spinlock_t mv64x60_lock;
 
 #define        MV64x60_64BIT_WIN_COUNT                 24
 
-/* Watchdog Platform Device, Driver Data */
-#define        MV64x60_WDT_NAME                        "wdt"
-
-struct mv64x60_wdt_pdata {
-       int     timeout;        /* watchdog expiry in seconds, default 10 */
-       int     bus_clk;        /* bus clock in MHz, default 133 */
-};
-
 /*
  * Define a structure that's used to pass in config information to the
  * core routines.
index 838684dc6d35c50a04ccd05afafad9d0a5cd7001..384e3621e3418055feb30164c207f058cf746c58 100644 (file)
@@ -50,7 +50,7 @@
 #define BUG()  __EMIT_BUG(0)
 
 #define WARN_ON(x) ({                                  \
-       typeof(x) __ret_warn_on = (x);                  \
+       int __ret_warn_on = !!(x);                      \
        if (__builtin_constant_p(__ret_warn_on)) {      \
                if (__ret_warn_on)                      \
                        __EMIT_BUG(BUGFLAG_WARNING);    \
index 4c2e1710f15724ad7d170adb25723683245a30e1..1aeda27d5a8bb33e9aae6408391d387b7614699b 100644 (file)
@@ -165,11 +165,6 @@ extern int ccw_device_resume(struct ccw_device *);
 extern int ccw_device_halt(struct ccw_device *, unsigned long);
 extern int ccw_device_clear(struct ccw_device *, unsigned long);
 
-extern int __deprecated read_dev_chars(struct ccw_device *cdev, void **buffer, int length);
-extern int __deprecated read_conf_data(struct ccw_device *cdev, void **buffer, int *length);
-extern int __deprecated read_conf_data_lpm(struct ccw_device *cdev, void **buffer,
-                             int *length, __u8 lpm);
-
 extern int ccw_device_set_online(struct ccw_device *cdev);
 extern int ccw_device_set_offline(struct ccw_device *cdev);
 
index df9b1017b703a6ff9693212f3b170392ce164191..1e72362cad78b6a50e2200325479617a3ac4a06f 100644 (file)
@@ -10,6 +10,8 @@
  *               Martin Schwidefsky (schwidefsky@de.ibm.com)
  */
 
+#include <linux/types.h>
+
 typedef void (*ext_int_handler_t)(__u16 code);
 
 /*
index 76e424f718c63bb98ca8225b50e02bde5a873353..07708c07701e434f9ddaa905864045efe32c07a6 100644 (file)
@@ -36,8 +36,7 @@ extern void machine_halt_smp(void);
 extern void machine_power_off_smp(void);
 
 extern void smp_setup_cpu_possible_map(void);
-extern int smp_call_function_on(void (*func) (void *info), void *info,
-                               int nonatomic, int wait, int cpu);
+
 #define NO_PROC_ID             0xFF            /* No processor magic marker */
 
 /*
@@ -96,14 +95,6 @@ extern int __cpu_up (unsigned int cpu);
 #endif
 
 #ifndef CONFIG_SMP
-static inline int
-smp_call_function_on(void (*func) (void *info), void *info,
-                    int nonatomic, int wait, int cpu)
-{
-       func(info);
-       return 0;
-}
-
 static inline void smp_send_stop(void)
 {
        /* Disable all interrupts/machine checks */
index 790c1c557417bb1330662399350f71fe4b6f05b4..f04acb2670a8121e3d99121e65d00c285cbf34d1 100644 (file)
 #define __NR_getcpu            311
 #define __NR_epoll_pwait       312
 #define __NR_utimes            313
-/* Number 314 is reserved for new sys_fallocate */
+#define __NR_fallocate         314
 #define __NR_utimensat         315
 #define __NR_signalfd          316
 #define __NR_timerfd           317
index 46f925c815aca9918823e4b23607b1e50e833cd4..a78d482e8b2f378969fc86b907f8a1625b83b1bd 100644 (file)
@@ -61,7 +61,7 @@ do {                                                  \
 } while (0)
 
 #define WARN_ON(x) ({                                          \
-       typeof(x) __ret_warn_on = (x);                          \
+       int __ret_warn_on = !!(x);                              \
        if (__builtin_constant_p(__ret_warn_on)) {              \
                if (__ret_warn_on)                              \
                        __WARN();                               \
index aeee8da9c54f57dea4036b12686fcf9ec002951a..b66139ff73fce2fb8d65909e2ef561937ca2f958 100644 (file)
@@ -29,7 +29,7 @@ static void __init check_bugs(void)
                *p++ = '2';
                *p++ = 'a';
                break;
-       case CPU_SH7705 ... CPU_SH7300:
+       case CPU_SH7705 ... CPU_SH7729:
                *p++ = '3';
                break;
        case CPU_SH7750 ... CPU_SH4_501:
@@ -39,7 +39,7 @@ static void __init check_bugs(void)
                *p++ = '4';
                *p++ = 'a';
                break;
-       case CPU_SH73180 ... CPU_SH7722:
+       case CPU_SH7343 ... CPU_SH7722:
                *p++ = '4';
                *p++ = 'a';
                *p++ = 'l';
index 273f3229785cfb93076c9ad810b7b68feb474492..0a054b53b9deeeefc6cbba89ae945c85b0334765 100644 (file)
 #ifndef __ASM_CPU_SH3_FREQ_H
 #define __ASM_CPU_SH3_FREQ_H
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7300)
-#define FRQCR                  0xa415ff80
-#else
 #define FRQCR                  0xffffff80
-#endif
 #define MIN_DIVISOR_NR         0
 #define MAX_DIVISOR_NR         4
 
index 4704e86dff5b725f0d0a944f3be206091b916df7..b20786d42d0919adbd1d14f7e11c7ff07041dd40 100644 (file)
@@ -30,7 +30,6 @@
 #if defined(CONFIG_CPU_SUBTYPE_SH7707) || \
     defined(CONFIG_CPU_SUBTYPE_SH7709) || \
     defined(CONFIG_CPU_SUBTYPE_SH7706) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7300) || \
     defined(CONFIG_CPU_SUBTYPE_SH7705) || \
     defined(CONFIG_CPU_SUBTYPE_SH7712) || \
     defined(CONFIG_CPU_SUBTYPE_SH7710)
index 4928b08f9d193bf7ff04eb771ff192032d7ada05..b6c2020a2ad3b1a6d1f995d189434050353dbf38 100644 (file)
@@ -19,7 +19,6 @@
  *     SH7729R
  *     SH7710
  *     SH7720
- *     SH7300
  *     SH7710
  * ---------------------------------------------------------------------------
  */
@@ -28,7 +27,7 @@
 #define TMU_TOCR       0xfffffe90      /* Byte access */
 #endif
 
-#if defined(CONFIG_CPU_SUBTYPE_SH7300) || defined(CONFIG_CPU_SUBTYPE_SH7710)
+#if defined(CONFIG_CPU_SUBTYPE_SH7710)
 #define TMU_012_TSTR   0xa412fe92      /* Byte access */
 
 #define TMU0_TCOR      0xa412fe94      /* Long access */
index 026025b51ceacb86cdcf7365bb55bd74e6f5327f..dc1d32a86374dadae62912d8a5565c8cbb01d5d5 100644 (file)
@@ -10,7 +10,7 @@
 #ifndef __ASM_CPU_SH4_FREQ_H
 #define __ASM_CPU_SH4_FREQ_H
 
-#if defined(CONFIG_CPU_SUBTYPE_SH73180) || defined(CONFIG_CPU_SUBTYPE_SH7722)
+#if defined(CONFIG_CPU_SUBTYPE_SH7722)
 #define FRQCR                  0xa4150000
 #define VCLKCR                 0xa4150004
 #define SCLKACR                        0xa4150008
index d3bc7818bbbea2e6631f781739266fb740d0bb7e..6f492ac3fa136b8f9fdd55e91e0c21fc9633235b 100644 (file)
@@ -69,11 +69,11 @@ static inline dma_addr_t dma_map_single(struct device *dev,
 {
 #if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
        if (dev->bus == &pci_bus_type)
-               return virt_to_bus(ptr);
+               return virt_to_phys(ptr);
 #endif
        dma_cache_sync(dev, ptr, size, dir);
 
-       return virt_to_bus(ptr);
+       return virt_to_phys(ptr);
 }
 
 #define dma_unmap_single(dev, addr, size, dir) do { } while (0)
@@ -116,7 +116,7 @@ static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle,
        if (dev->bus == &pci_bus_type)
                return;
 #endif
-       dma_cache_sync(dev, bus_to_virt(dma_handle), size, dir);
+       dma_cache_sync(dev, phys_to_virt(dma_handle), size, dir);
 }
 
 static inline void dma_sync_single_range(struct device *dev,
@@ -128,7 +128,7 @@ static inline void dma_sync_single_range(struct device *dev,
        if (dev->bus == &pci_bus_type)
                return;
 #endif
-       dma_cache_sync(dev, bus_to_virt(dma_handle) + offset, size, dir);
+       dma_cache_sync(dev, phys_to_virt(dma_handle) + offset, size, dir);
 }
 
 static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
index 6034d4a29e73151434597f0ee1fd35d855c0738f..4c75b70b64143be6a1cb7de0234e9633b3e06a95 100644 (file)
@@ -111,6 +111,7 @@ struct dma_info {
 
        struct list_head list;
        int first_channel_nr;
+       int first_vchannel_nr;
 };
 
 struct dma_chan_caps {
index 458e9fa59545e309225c10d11a6f1e1575816926..8a566177ad9681126d34d76136b4cc0fbd786fd5 100644 (file)
@@ -46,6 +46,9 @@
  * fix-mapped?
  */
 enum fixed_addresses {
+#define FIX_N_COLOURS 16
+       FIX_CMAP_BEGIN,
+       FIX_CMAP_END = FIX_CMAP_BEGIN + FIX_N_COLOURS,
 #ifdef CONFIG_HIGHMEM
        FIX_KMAP_BEGIN, /* reserved pte's for temporary kernel mappings */
        FIX_KMAP_END = FIX_KMAP_BEGIN+(KM_TYPE_NR*NR_CPUS)-1,
@@ -53,8 +56,8 @@ enum fixed_addresses {
        __end_of_fixed_addresses
 };
 
-extern void __set_fixmap (enum fixed_addresses idx,
-                                       unsigned long phys, pgprot_t flags);
+extern void __set_fixmap(enum fixed_addresses idx,
+                        unsigned long phys, pgprot_t flags);
 
 #define set_fixmap(idx, phys) \
                __set_fixmap(idx, phys, PAGE_KERNEL)
@@ -106,5 +109,4 @@ static inline unsigned long virt_to_fix(const unsigned long vaddr)
        BUG_ON(vaddr >= FIXADDR_TOP || vaddr < FIXADDR_START);
        return __virt_to_fix(vaddr);
 }
-
 #endif
index dc1ad464fa32f2b2fe30f7ba48f0223744e0d34a..3b59b3af777bb16214072e4cb732230c295dbbbd 100644 (file)
@@ -181,7 +181,7 @@ static void _fd_chose_dma_mode(char *addr, unsigned long size)
 {
        if(can_use_virtual_dma == 2) {
                if((unsigned int) addr >= (unsigned int) high_memory ||
-                  virt_to_bus(addr) >= 0x10000000)
+                  virt_to_phys(addr) >= 0x10000000)
                        use_virtual_dma = 1;
                else
                        use_virtual_dma = 0;
@@ -219,7 +219,7 @@ static int hard_dma_setup(char *addr, unsigned long size, int mode, int io)
        doing_pdma = 0;
        clear_dma_ff(FLOPPY_DMA);
        set_dma_mode(FLOPPY_DMA,mode);
-       set_dma_addr(FLOPPY_DMA,virt_to_bus(addr));
+       set_dma_addr(FLOPPY_DMA,virt_to_phys(addr));
        set_dma_count(FLOPPY_DMA,size);
        enable_dma(FLOPPY_DMA);
        return 0;
index aa80930ce8e4ccbc089132c8645309eedd9f7b1e..e6a1877dcb205a79c4b7baa62371c27399a51795 100644 (file)
@@ -241,10 +241,6 @@ static inline void *phys_to_virt(unsigned long address)
 #define virt_to_phys(address)  ((unsigned long)(address))
 #endif
 
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-#define page_to_bus page_to_phys
-
 /*
  * readX/writeX() are used to access memory mapped devices. On some
  * architectures the memory mapped IO stuff needs to be accessed
index 22efffe450195c07c8e42afd825cdd3f6370b198..e3fae12c0e499574f62e0300391ebd7a5328dbf0 100644 (file)
@@ -55,11 +55,7 @@ extern unsigned long empty_zero_page[PAGE_SIZE / sizeof(unsigned long)];
 
 #define PTE_PHYS_MASK          (0x20000000 - PAGE_SIZE)
 
-/*
- * First 1MB map is used by fixed purpose.
- * Currently only 4-entry (16kB) is used (see arch/sh/mm/cache.c)
- */
-#define VMALLOC_START  (P3SEG+0x00100000)
+#define VMALLOC_START  (P3SEG)
 #define VMALLOC_END    (FIXADDR_START-2*PAGE_SIZE)
 
 /*
index 2252e75daa269ffde32379bfb0e68a5537940ad4..26d52174f4b4bed687b67b9e27a96b4251c03730 100644 (file)
@@ -45,7 +45,7 @@ enum cpu_type {
        CPU_SH7705, CPU_SH7706, CPU_SH7707,
        CPU_SH7708, CPU_SH7708S, CPU_SH7708R,
        CPU_SH7709, CPU_SH7709A, CPU_SH7710, CPU_SH7712,
-       CPU_SH7729, CPU_SH7300,
+       CPU_SH7729,
 
        /* SH-4 types */
        CPU_SH7750, CPU_SH7750S, CPU_SH7750R, CPU_SH7751, CPU_SH7751R,
@@ -55,7 +55,7 @@ enum cpu_type {
        CPU_SH7770, CPU_SH7780, CPU_SH7781, CPU_SH7785, CPU_SHX3,
 
        /* SH4AL-DSP types */
-       CPU_SH73180, CPU_SH7343, CPU_SH7722,
+       CPU_SH7343, CPU_SH7722,
 
        /* Unknown subtype */
        CPU_SH_NONE
index 10565ac7966a4f7c5c43ccd534501f60ee3c9f1f..5d7800aa31b514df1954f128481569549388c622 100644 (file)
@@ -37,7 +37,7 @@
 #define PA_VERREG      0xa4000032      /* FPGA Version Register */
 #define PA_INPORT      0xa4000034      /* KEY Input Port control */
 #define PA_OUTPORT     0xa4000036      /* LED control */
-#define PA_DMPORT      0xa4000038      /* DM270 Output Port control */
+#define PA_BVERREG     0xa4000038      /* Board Revision Register */
 
 #define PA_AX88796L    0xaa000400      /* AX88796L Area */
 #define PA_VOYAGER     0xab000000      /* VOYAGER GX Area */
diff --git a/include/asm-sh/se7300.h b/include/asm-sh/se7300.h
deleted file mode 100644 (file)
index 4e24edc..0000000
+++ /dev/null
@@ -1,64 +0,0 @@
-#ifndef __ASM_SH_HITACHI_SE7300_H
-#define __ASM_SH_HITACHI_SE7300_H
-
-/*
- * linux/include/asm-sh/se/se7300.h
- *
- * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
- *
- * SH-Mobile SolutionEngine 7300 support
- */
-
-/* Box specific addresses.  */
-
-/* Area 0 */
-#define PA_ROM         0x00000000      /* EPROM */
-#define PA_ROM_SIZE    0x00400000      /* EPROM size 4M byte(Actually 2MB) */
-#define PA_FROM                0x00400000      /* Flash ROM */
-#define PA_FROM_SIZE   0x00400000      /* Flash size 4M byte */
-#define PA_SRAM                0x00800000      /* SRAM */
-#define PA_FROM_SIZE   0x00400000      /* SRAM size 4M byte */
-/* Area 1 */
-#define PA_EXT1                0x04000000
-#define PA_EXT1_SIZE   0x04000000
-/* Area 2 */
-#define PA_EXT2                0x08000000
-#define PA_EXT2_SIZE   0x04000000
-/* Area 3 */
-#define PA_SDRAM       0x0c000000
-#define PA_SDRAM_SIZE  0x04000000
-/* Area 4 */
-#define PA_PCIC                0x10000000      /* MR-SHPC-01 PCMCIA */
-#define PA_MRSHPC       0xb03fffe0      /* MR-SHPC-01 PCMCIA controller */
-#define PA_MRSHPC_MW1   0xb0400000      /* MR-SHPC-01 memory window base */
-#define PA_MRSHPC_MW2   0xb0500000      /* MR-SHPC-01 attribute window base */
-#define PA_MRSHPC_IO    0xb0600000      /* MR-SHPC-01 I/O window base */
-#define MRSHPC_OPTION   (PA_MRSHPC + 6)
-#define MRSHPC_CSR      (PA_MRSHPC + 8)
-#define MRSHPC_ISR      (PA_MRSHPC + 10)
-#define MRSHPC_ICR      (PA_MRSHPC + 12)
-#define MRSHPC_CPWCR    (PA_MRSHPC + 14)
-#define MRSHPC_MW0CR1   (PA_MRSHPC + 16)
-#define MRSHPC_MW1CR1   (PA_MRSHPC + 18)
-#define MRSHPC_IOWCR1   (PA_MRSHPC + 20)
-#define MRSHPC_MW0CR2   (PA_MRSHPC + 22)
-#define MRSHPC_MW1CR2   (PA_MRSHPC + 24)
-#define MRSHPC_IOWCR2   (PA_MRSHPC + 26)
-#define MRSHPC_CDCR     (PA_MRSHPC + 28)
-#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
-#define PA_LED         0xb0800000      /* LED */
-#define PA_DIPSW       0xb0900000      /* Dip switch 31 */
-#define PA_EPLD_MODESET        0xb0a00000      /* FPGA Mode set register */
-#define PA_EPLD_ST1    0xb0a80000      /* FPGA Interrupt status register1 */
-#define PA_EPLD_ST2    0xb0ac0000      /* FPGA Interrupt status register2 */
-/* Area 5 */
-#define PA_EXT5                0x14000000
-#define PA_EXT5_SIZE   0x04000000
-/* Area 6 */
-#define PA_LCD1                0xb8000000
-#define PA_LCD2                0xb8800000
-
-#define __IO_PREFIX    sh7300se
-#include <asm/io_generic.h>
-
-#endif  /* __ASM_SH_HITACHI_SE7300_H */
diff --git a/include/asm-sh/se73180.h b/include/asm-sh/se73180.h
deleted file mode 100644 (file)
index 907c062..0000000
+++ /dev/null
@@ -1,66 +0,0 @@
-#ifndef __ASM_SH_SE73180_H
-#define __ASM_SH_SE73180_H
-
-/*
- * Copyright (C) 2003 Takashi Kusuda <kusuda-takashi@hitachi-ul.co.jp>
- *
- * SH-Mobile SolutionEngine 73180 support
- */
-
-/* Box specific addresses.  */
-
-/* Area 0 */
-#define PA_ROM         0x00000000      /* EPROM */
-#define PA_ROM_SIZE    0x00400000      /* EPROM size 4M byte(Actually 2MB) */
-#define PA_FROM                0x00400000      /* Flash ROM */
-#define PA_FROM_SIZE   0x00400000      /* Flash size 4M byte */
-#define PA_SRAM                0x00800000      /* SRAM */
-#define PA_FROM_SIZE   0x00400000      /* SRAM size 4M byte */
-/* Area 1 */
-#define PA_EXT1                0x04000000
-#define PA_EXT1_SIZE   0x04000000
-/* Area 2 */
-#define PA_EXT2                0x08000000
-#define PA_EXT2_SIZE   0x04000000
-/* Area 3 */
-#define PA_SDRAM       0x0c000000
-#define PA_SDRAM_SIZE  0x04000000
-/* Area 4 */
-#define PA_PCIC                0x10000000      /* MR-SHPC-01 PCMCIA */
-#define PA_MRSHPC       0xb03fffe0      /* MR-SHPC-01 PCMCIA controller */
-#define PA_MRSHPC_MW1   0xb0400000      /* MR-SHPC-01 memory window base */
-#define PA_MRSHPC_MW2   0xb0500000      /* MR-SHPC-01 attribute window base */
-#define PA_MRSHPC_IO    0xb0600000      /* MR-SHPC-01 I/O window base */
-#define MRSHPC_OPTION   (PA_MRSHPC + 6)
-#define MRSHPC_CSR      (PA_MRSHPC + 8)
-#define MRSHPC_ISR      (PA_MRSHPC + 10)
-#define MRSHPC_ICR      (PA_MRSHPC + 12)
-#define MRSHPC_CPWCR    (PA_MRSHPC + 14)
-#define MRSHPC_MW0CR1   (PA_MRSHPC + 16)
-#define MRSHPC_MW1CR1   (PA_MRSHPC + 18)
-#define MRSHPC_IOWCR1   (PA_MRSHPC + 20)
-#define MRSHPC_MW0CR2   (PA_MRSHPC + 22)
-#define MRSHPC_MW1CR2   (PA_MRSHPC + 24)
-#define MRSHPC_IOWCR2   (PA_MRSHPC + 26)
-#define MRSHPC_CDCR     (PA_MRSHPC + 28)
-#define MRSHPC_PCIC_INFO (PA_MRSHPC + 30)
-#define PA_LED         0xb0C00000      /* LED */
-#define LED_SHIFT       0
-#define PA_DIPSW       0xb0900000      /* Dip switch 31 */
-#define PA_EPLD_MODESET        0xb0a00000      /* FPGA Mode set register */
-#define PA_EPLD_ST1    0xb0a80000      /* FPGA Interrupt status register1 */
-#define PA_EPLD_ST2    0xb0ac0000      /* FPGA Interrupt status register2 */
-/* Area 5 */
-#define PA_EXT5                0x14000000
-#define PA_EXT5_SIZE   0x04000000
-/* Area 6 */
-#define PA_LCD1                0xb8000000
-#define PA_LCD2                0xb8800000
-
-#define __IO_PREFIX    sh73180se
-#include <asm/io_generic.h>
-
-/* arch/sh/boards/se/73180/irq.c */
-int shmse_irq_demux(int irq);
-
-#endif  /* __ASM_SH_SE73180_H */
index 31d55e3782d519571cfa62343d21e67ac13353ac..1f7e1deb8d924bf3efc0be3035503ab7bbcb77ef 100644 (file)
@@ -107,18 +107,16 @@ static inline struct thread_info *current_thread_info(void)
  * - other flags in MSW
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_RESTORE_SIGMASK    4       /* restore signal mask in do_signal() */
-#define TIF_SINGLESTEP         5       /* singlestepping active */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_RESTORE_SIGMASK    3       /* restore signal mask in do_signal() */
+#define TIF_SINGLESTEP         4       /* singlestepping active */
 #define TIF_USEDFPU            16      /* FPU was used by this task this quantum (SMP) */
 #define TIF_POLLING_NRFLAG     17      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 #define TIF_MEMDIE             18
 #define TIF_FREEZE             19
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_RESTORE_SIGMASK   (1<<TIF_RESTORE_SIGMASK)
index 38d46e01b8463dd04e20f664041a0df8d469a039..56f4e30dc49ce7f4916f86483d8777a826ab72d3 100644 (file)
@@ -15,8 +15,7 @@
 #include <asm/cpu/ubc.h>
 
 /* User Break Controller */
-#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709) || \
-    defined(CONFIG_CPU_SUBTYPE_SH7300)
+#if defined(CONFIG_CPU_SUBTYPE_SH7707) || defined(CONFIG_CPU_SUBTYPE_SH7709)
 #define UBC_TYPE_SH7729        (current_cpu_data.type == CPU_SH7729)
 #else
 #define UBC_TYPE_SH7729        0
index c7c0f059cdc4ff57e464d6beccef50e384dd2b17..d505f357f819b61e96023d09e36fae1c2fa2b725 100644 (file)
@@ -51,11 +51,11 @@ static inline dma_addr_t dma_map_single(struct device *dev,
 {
 #if defined(CONFIG_PCI) && !defined(CONFIG_SH_PCIDMA_NONCOHERENT)
        if (dev->bus == &pci_bus_type)
-               return virt_to_bus(ptr);
+               return virt_to_phys(ptr);
 #endif
        dma_cache_sync(dev, ptr, size, dir);
 
-       return virt_to_bus(ptr);
+       return virt_to_phys(ptr);
 }
 
 #define dma_unmap_single(dev, addr, size, dir) do { } while (0)
@@ -98,7 +98,7 @@ static inline void dma_sync_single(struct device *dev, dma_addr_t dma_handle,
        if (dev->bus == &pci_bus_type)
                return;
 #endif
-       dma_cache_sync(dev, bus_to_virt(dma_handle), size, dir);
+       dma_cache_sync(dev, phys_to_virt(dma_handle), size, dir);
 }
 
 static inline void dma_sync_single_range(struct device *dev,
@@ -110,7 +110,7 @@ static inline void dma_sync_single_range(struct device *dev,
        if (dev->bus == &pci_bus_type)
                return;
 #endif
-       dma_cache_sync(dev, bus_to_virt(dma_handle) + offset, size, dir);
+       dma_cache_sync(dev, phys_to_virt(dma_handle) + offset, size, dir);
 }
 
 static inline void dma_sync_sg(struct device *dev, struct scatterlist *sg,
index 14d8e7b4bf4b369254d49a0f458ec7c8b8a17c59..1f37b6931922fe3dc73a0ace95558e447e86cbec 100644 (file)
 #include <asm/page.h>
 #include <asm-generic/iomap.h>
 
-#define virt_to_bus virt_to_phys
-#define bus_to_virt phys_to_virt
-#define page_to_bus page_to_phys
-
 /*
  * Nothing overly special here.. instead of doing the same thing
  * over and over again, we just define a set of sh64_in/out functions
index 4a56d84d69c427d461ff8ba097d21ba75dc4365b..c0a7786d65f7768403f10ab5ce93e93d31490e96 100644 (file)
@@ -10,6 +10,10 @@ struct device_node;
 struct of_device;
 
 struct dev_archdata {
+       void                    *iommu;
+       void                    *stc;
+       void                    *host_controller;
+
        struct device_node      *prom_node;
        struct of_device        *op;
 };
index 5db60b5ae7b09d26812f7dfb1d735183e721aced..5ec546349fc8757da63255da0d142101858137ef 100644 (file)
@@ -16,6 +16,7 @@
 #define O_LARGEFILE    0x40000
 #define O_DIRECT        0x100000 /* direct disk access hint */
 #define O_NOATIME      0x200000
+#define O_CLOEXEC      0x400000
 
 #define F_GETOWN       5       /*  for sockets. */
 #define F_SETOWN       6       /*  for sockets. */
index 9073c84218ce549204aa873d629d0275d47f1b5e..acd06d8ff70a040ba5063ca99b93689c231f24eb 100644 (file)
@@ -48,7 +48,7 @@ struct sun_flpy_controller {
 
 /* You'll only ever find one controller on a SparcStation anyways. */
 static struct sun_flpy_controller *sun_fdc = NULL;
-volatile unsigned char *fdc_status;
+extern volatile unsigned char *fdc_status;
 
 struct sun_floppy_ops {
        unsigned char (*fd_inb)(int port);
@@ -101,6 +101,29 @@ static struct sun_floppy_ops sun_fdops;
 #define CROSS_64KB(a,s) (0)
 
 /* Routines unique to each controller type on a Sun. */
+static void sun_set_dor(unsigned char value, int fdc_82077)
+{
+       if (sparc_cpu_model == sun4c) {
+               unsigned int bits = 0;
+               if (value & 0x10)
+                       bits |= AUXIO_FLPY_DSEL;
+               if ((value & 0x80) == 0)
+                       bits |= AUXIO_FLPY_EJCT;
+               set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT));
+       }
+       if (fdc_82077) {
+               sun_fdc->dor_82077 = value;
+       }
+}
+
+static unsigned char sun_read_dir(void)
+{
+       if (sparc_cpu_model == sun4c)
+               return (get_auxio() & AUXIO_FLPY_DCHG) ? 0x80 : 0;
+       else
+               return sun_fdc->dir_82077;
+}
+
 static unsigned char sun_82072_fd_inb(int port)
 {
        udelay(5);
@@ -113,7 +136,7 @@ static unsigned char sun_82072_fd_inb(int port)
        case 5: /* FD_DATA */
                return sun_fdc->data_82072;
        case 7: /* FD_DIR */
-               return (get_auxio() & AUXIO_FLPY_DCHG)? 0x80: 0;
+               return sun_read_dir();
        };
        panic("sun_82072_fd_inb: How did I get here?");
 }
@@ -126,20 +149,7 @@ static void sun_82072_fd_outb(unsigned char value, int port)
                printk("floppy: Asked to write to unknown port %d\n", port);
                panic("floppy: Port bolixed.");
        case 2: /* FD_DOR */
-               /* Oh geese, 82072 on the Sun has no DOR register,
-                * the functionality is implemented via the AUXIO
-                * I/O register.  So we must emulate the behavior.
-                *
-                * ASSUMPTIONS:  There will only ever be one floppy
-                *               drive attached to a Sun controller
-                *               and it will be at drive zero.
-                */
-               {
-                       unsigned bits = 0;
-                       if (value & 0x10) bits |= AUXIO_FLPY_DSEL;
-                       if ((value & 0x80) == 0) bits |= AUXIO_FLPY_EJCT;
-                       set_auxio(bits, (~bits) & (AUXIO_FLPY_DSEL|AUXIO_FLPY_EJCT));
-               }
+               sun_set_dor(value, 0);
                break;
        case 5: /* FD_DATA */
                sun_fdc->data_82072 = value;
@@ -161,15 +171,22 @@ static unsigned char sun_82077_fd_inb(int port)
        default:
                printk("floppy: Asked to read unknown port %d\n", port);
                panic("floppy: Port bolixed.");
+       case 0: /* FD_STATUS_0 */
+               return sun_fdc->status1_82077;
+       case 1: /* FD_STATUS_1 */
+               return sun_fdc->status2_82077;
+       case 2: /* FD_DOR */
+               return sun_fdc->dor_82077;
+       case 3: /* FD_TDR */
+               return sun_fdc->tapectl_82077;
        case 4: /* FD_STATUS */
                return sun_fdc->status_82077 & ~STATUS_DMA;
        case 5: /* FD_DATA */
                return sun_fdc->data_82077;
        case 7: /* FD_DIR */
-               /* XXX: Is DCL on 0x80 in sun4m? */
-               return sun_fdc->dir_82077;
+               return sun_read_dir();
        };
-       panic("sun_82072_fd_inb: How did I get here?");
+       panic("sun_82077_fd_inb: How did I get here?");
 }
 
 static void sun_82077_fd_outb(unsigned char value, int port)
@@ -180,8 +197,7 @@ static void sun_82077_fd_outb(unsigned char value, int port)
                printk("floppy: Asked to write to unknown port %d\n", port);
                panic("floppy: Port bolixed.");
        case 2: /* FD_DOR */
-               /* Happily, the 82077 has a real DOR register. */
-               sun_fdc->dor_82077 = value;
+               sun_set_dor(value, 1);
                break;
        case 5: /* FD_DATA */
                sun_fdc->data_82077 = value;
@@ -192,6 +208,9 @@ static void sun_82077_fd_outb(unsigned char value, int port)
        case 4: /* FD_STATUS */
                sun_fdc->status_82077 = value;
                break;
+       case 3: /* FD_TDR */
+               sun_fdc->tapectl_82077 = value;
+               break;
        };
        return;
 }
@@ -206,13 +225,13 @@ static void sun_82077_fd_outb(unsigned char value, int port)
  * underruns.  If non-zero, doing_pdma encodes the direction of
  * the transfer for debugging.  1=read 2=write
  */
-char *pdma_vaddr;
-unsigned long pdma_size;
-volatile int doing_pdma = 0;
+extern char *pdma_vaddr;
+extern unsigned long pdma_size;
+extern volatile int doing_pdma;
 
 /* This is software state */
-char *pdma_base = NULL;
-unsigned long pdma_areasize;
+extern char *pdma_base;
+extern unsigned long pdma_areasize;
 
 /* Common routines to all controller types on the Sparc. */
 static __inline__ void virtual_dma_init(void)
@@ -262,7 +281,8 @@ static __inline__ void sun_fd_enable_dma(void)
 }
 
 /* Our low-level entry point in arch/sparc/kernel/entry.S */
-irqreturn_t floppy_hardint(int irq, void *unused);
+extern int sparc_floppy_request_irq(int irq, unsigned long flags,
+                                   irqreturn_t (*irq_handler)(int irq, void *));
 
 static int sun_fd_request_irq(void)
 {
@@ -271,8 +291,9 @@ static int sun_fd_request_irq(void)
 
        if(!once) {
                once = 1;
-               error = request_fast_irq(FLOPPY_IRQ, floppy_hardint,
-                                        IRQF_DISABLED, "floppy");
+               error = sparc_floppy_request_irq(FLOPPY_IRQ,
+                                                IRQF_DISABLED,
+                                                floppy_interrupt);
                return ((error == 0) ? 0 : -1);
        } else return 0;
 }
@@ -332,16 +353,17 @@ static int sun_floppy_init(void)
                goto no_sun_fdc;
        }
 
-        if(sparc_cpu_model == sun4c) {
-                sun_fdops.fd_inb = sun_82072_fd_inb;
-                sun_fdops.fd_outb = sun_82072_fd_outb;
-                fdc_status = &sun_fdc->status_82072;
-                /* printk("AUXIO @0x%lx\n", auxio_register); */ /* P3 */
-        } else {
-                sun_fdops.fd_inb = sun_82077_fd_inb;
-                sun_fdops.fd_outb = sun_82077_fd_outb;
-                fdc_status = &sun_fdc->status_82077;
-                /* printk("DOR @0x%p\n", &sun_fdc->dor_82077); */ /* P3 */
+       sun_fdops.fd_inb = sun_82077_fd_inb;
+       sun_fdops.fd_outb = sun_82077_fd_outb;
+       fdc_status = &sun_fdc->status_82077;
+
+       if (sun_fdc->dor_82077 == 0x80) {
+               sun_fdc->dor_82077 = 0x02;
+               if (sun_fdc->dor_82077 == 0x80) {
+                       sun_fdops.fd_inb = sun_82072_fd_inb;
+                       sun_fdops.fd_outb = sun_82072_fd_outb;
+                       fdc_status = &sun_fdc->status_82072;
+               }
        }
 
        /* Success... */
index 61fb99643afd3a5ba3d9773f79057a39ac558f85..fe205cc444b889619e82612ac3ba7ed00302035a 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: irq.h,v 1.32 2000/08/26 02:42:28 anton Exp $
- * irq.h: IRQ registers on the Sparc.
+/* irq.h: IRQ registers on the Sparc.
  *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
  */
 
 #ifndef _SPARC_IRQ_H
@@ -13,6 +12,4 @@
 
 #define irq_canonicalize(irq)  (irq)
 
-extern int request_fast_irq(unsigned int irq, irq_handler_t handler, unsigned long flags, __const__ char *devname);
-
 #endif
index 350676c589f9d05c6bb659334441b2335f391908..71f2a1998324eb372b16580b81cf743e593d4846 100644 (file)
@@ -67,6 +67,7 @@ extern int of_set_property(struct device_node *node, const char *name, void *val
 extern int of_getintprop_default(struct device_node *np,
                                 const char *name,
                                 int def);
+extern int of_find_in_proplist(const char *list, const char *match, int len);
 
 extern void prom_build_devicetree(void);
 
index c58ec1661df864d69c9ff46ebeed26e247727581..1fc655452b812cba0421f54211ccc451f076478e 100644 (file)
 #ifndef _ASM_SPARC64_DMA_MAPPING_H
 #define _ASM_SPARC64_DMA_MAPPING_H
 
-
-#ifdef CONFIG_PCI
-
-/* we implement the API below in terms of the existing PCI one,
- * so include it */
-#include <linux/pci.h>
-/* need struct page definitions */
+#include <linux/scatterlist.h>
 #include <linux/mm.h>
 
-#include <asm/of_device.h>
-
-static inline int
-dma_supported(struct device *dev, u64 mask)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       return pci_dma_supported(to_pci_dev(dev), mask);
-}
-
-static inline int
-dma_set_mask(struct device *dev, u64 dma_mask)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       return pci_set_dma_mask(to_pci_dev(dev), dma_mask);
-}
-
-static inline void *
-dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle,
-                  gfp_t flag)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       return pci_iommu_ops->alloc_consistent(to_pci_dev(dev), size, dma_handle, flag);
-}
-
-static inline void
-dma_free_coherent(struct device *dev, size_t size, void *cpu_addr,
-                   dma_addr_t dma_handle)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       pci_free_consistent(to_pci_dev(dev), size, cpu_addr, dma_handle);
-}
-
-static inline dma_addr_t
-dma_map_single(struct device *dev, void *cpu_addr, size_t size,
-              enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       return pci_map_single(to_pci_dev(dev), cpu_addr, size, (int)direction);
-}
-
-static inline void
-dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-                enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       pci_unmap_single(to_pci_dev(dev), dma_addr, size, (int)direction);
-}
-
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page,
-            unsigned long offset, size_t size,
-            enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       return pci_map_page(to_pci_dev(dev), page, offset, size, (int)direction);
-}
-
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-              enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       pci_unmap_page(to_pci_dev(dev), dma_address, size, (int)direction);
-}
-
-static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
-          enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       return pci_map_sg(to_pci_dev(dev), sg, nents, (int)direction);
-}
-
-static inline void
-dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
-            enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       pci_unmap_sg(to_pci_dev(dev), sg, nhwentries, (int)direction);
-}
-
-static inline void
-dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
-                       enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       pci_dma_sync_single_for_cpu(to_pci_dev(dev), dma_handle,
-                                   size, (int)direction);
-}
-
-static inline void
-dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
-                          enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
+#define DMA_ERROR_CODE (~(dma_addr_t)0x0)
+
+struct dma_ops {
+       void *(*alloc_coherent)(struct device *dev, size_t size,
+                               dma_addr_t *dma_handle, gfp_t flag);
+       void (*free_coherent)(struct device *dev, size_t size,
+                             void *cpu_addr, dma_addr_t dma_handle);
+       dma_addr_t (*map_single)(struct device *dev, void *cpu_addr,
+                                size_t size,
+                                enum dma_data_direction direction);
+       void (*unmap_single)(struct device *dev, dma_addr_t dma_addr,
+                            size_t size,
+                            enum dma_data_direction direction);
+       int (*map_sg)(struct device *dev, struct scatterlist *sg, int nents,
+                     enum dma_data_direction direction);
+       void (*unmap_sg)(struct device *dev, struct scatterlist *sg,
+                        int nhwentries,
+                        enum dma_data_direction direction);
+       void (*sync_single_for_cpu)(struct device *dev,
+                                   dma_addr_t dma_handle, size_t size,
+                                   enum dma_data_direction direction);
+       void (*sync_single_for_device)(struct device *dev,
+                                      dma_addr_t dma_handle, size_t size,
+                                      enum dma_data_direction direction);
+       void (*sync_sg_for_cpu)(struct device *dev, struct scatterlist *sg,
+                               int nelems,
+                               enum dma_data_direction direction);
+       void (*sync_sg_for_device)(struct device *dev, struct scatterlist *sg,
+                                  int nelems,
+                                  enum dma_data_direction direction);
+};
+extern const struct dma_ops *dma_ops;
+
+extern int dma_supported(struct device *dev, u64 mask);
+extern int dma_set_mask(struct device *dev, u64 dma_mask);
 
-       pci_dma_sync_single_for_device(to_pci_dev(dev), dma_handle,
-                                      size, (int)direction);
-}
-
-static inline void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
-                   enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       pci_dma_sync_sg_for_cpu(to_pci_dev(dev), sg, nelems, (int)direction);
-}
-
-static inline void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
-                      enum dma_data_direction direction)
-{
-       BUG_ON(dev->bus != &pci_bus_type);
-
-       pci_dma_sync_sg_for_device(to_pci_dev(dev), sg, nelems, (int)direction);
-}
-
-static inline int
-dma_mapping_error(dma_addr_t dma_addr)
+static inline void *dma_alloc_coherent(struct device *dev, size_t size,
+                                      dma_addr_t *dma_handle, gfp_t flag)
 {
-       return pci_dma_mapping_error(dma_addr);
+       return dma_ops->alloc_coherent(dev, size, dma_handle, flag);
 }
 
-#else
-
-struct device;
-struct page;
-struct scatterlist;
-
-static inline int
-dma_supported(struct device *dev, u64 mask)
+static inline void dma_free_coherent(struct device *dev, size_t size,
+                                    void *cpu_addr, dma_addr_t dma_handle)
 {
-       BUG();
-       return 0;
+       dma_ops->free_coherent(dev, size, cpu_addr, dma_handle);
 }
 
-static inline int
-dma_set_mask(struct device *dev, u64 dma_mask)
+static inline dma_addr_t dma_map_single(struct device *dev, void *cpu_addr,
+                                       size_t size,
+                                       enum dma_data_direction direction)
 {
-       BUG();
-       return 0;
+       return dma_ops->map_single(dev, cpu_addr, size, direction);
 }
 
-static inline void *dma_alloc_coherent(struct device *dev, size_t size,
-                        dma_addr_t *dma_handle, gfp_t flag)
+static inline void dma_unmap_single(struct device *dev, dma_addr_t dma_addr,
+                                   size_t size,
+                                   enum dma_data_direction direction)
 {
-       BUG();
-       return NULL;
+       dma_ops->unmap_single(dev, dma_addr, size, direction);
 }
 
-static inline void dma_free_coherent(struct device *dev, size_t size,
-                      void *vaddr, dma_addr_t dma_handle)
+static inline dma_addr_t dma_map_page(struct device *dev, struct page *page,
+                                     unsigned long offset, size_t size,
+                                     enum dma_data_direction direction)
 {
-       BUG();
+       return dma_ops->map_single(dev, page_address(page) + offset,
+                                  size, direction);
 }
 
-static inline dma_addr_t
-dma_map_single(struct device *dev, void *cpu_addr, size_t size,
-              enum dma_data_direction direction)
+static inline void dma_unmap_page(struct device *dev, dma_addr_t dma_address,
+                                 size_t size,
+                                 enum dma_data_direction direction)
 {
-       BUG();
-       return 0;
+       dma_ops->unmap_single(dev, dma_address, size, direction);
 }
 
-static inline void
-dma_unmap_single(struct device *dev, dma_addr_t dma_addr, size_t size,
-                enum dma_data_direction direction)
+static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
+                            int nents, enum dma_data_direction direction)
 {
-       BUG();
+       return dma_ops->map_sg(dev, sg, nents, direction);
 }
 
-static inline dma_addr_t
-dma_map_page(struct device *dev, struct page *page,
-            unsigned long offset, size_t size,
-            enum dma_data_direction direction)
+static inline void dma_unmap_sg(struct device *dev, struct scatterlist *sg,
+                               int nents, enum dma_data_direction direction)
 {
-       BUG();
-       return 0;
+       dma_ops->unmap_sg(dev, sg, nents, direction);
 }
 
-static inline void
-dma_unmap_page(struct device *dev, dma_addr_t dma_address, size_t size,
-              enum dma_data_direction direction)
+static inline void dma_sync_single_for_cpu(struct device *dev,
+                                          dma_addr_t dma_handle, size_t size,
+                                          enum dma_data_direction direction)
 {
-       BUG();
+       dma_ops->sync_single_for_cpu(dev, dma_handle, size, direction);
 }
 
-static inline int
-dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
-          enum dma_data_direction direction)
+static inline void dma_sync_single_for_device(struct device *dev,
+                                             dma_addr_t dma_handle,
+                                             size_t size,
+                                             enum dma_data_direction direction)
 {
-       BUG();
-       return 0;
+       dma_ops->sync_single_for_device(dev, dma_handle, size, direction);
 }
 
-static inline void
-dma_unmap_sg(struct device *dev, struct scatterlist *sg, int nhwentries,
-            enum dma_data_direction direction)
+static inline void dma_sync_single_range_for_cpu(struct device *dev,
+                                                dma_addr_t dma_handle,
+                                                unsigned long offset,
+                                                size_t size,
+                                                enum dma_data_direction direction)
 {
-       BUG();
+       dma_sync_single_for_cpu(dev, dma_handle+offset, size, direction);
 }
 
-static inline void
-dma_sync_single_for_cpu(struct device *dev, dma_addr_t dma_handle, size_t size,
-                       enum dma_data_direction direction)
+static inline void dma_sync_single_range_for_device(struct device *dev,
+                                                   dma_addr_t dma_handle,
+                                                   unsigned long offset,
+                                                   size_t size,
+                                                   enum dma_data_direction direction)
 {
-       BUG();
+       dma_sync_single_for_device(dev, dma_handle+offset, size, direction);
 }
 
-static inline void
-dma_sync_single_for_device(struct device *dev, dma_addr_t dma_handle, size_t size,
-                          enum dma_data_direction direction)
-{
-       BUG();
-}
 
-static inline void
-dma_sync_sg_for_cpu(struct device *dev, struct scatterlist *sg, int nelems,
-                   enum dma_data_direction direction)
+static inline void dma_sync_sg_for_cpu(struct device *dev,
+                                      struct scatterlist *sg, int nelems,
+                                      enum dma_data_direction direction)
 {
-       BUG();
+       dma_ops->sync_sg_for_cpu(dev, sg, nelems, direction);
 }
 
-static inline void
-dma_sync_sg_for_device(struct device *dev, struct scatterlist *sg, int nelems,
-                      enum dma_data_direction direction)
+static inline void dma_sync_sg_for_device(struct device *dev,
+                                         struct scatterlist *sg, int nelems,
+                                         enum dma_data_direction direction)
 {
-       BUG();
+       dma_ops->sync_sg_for_device(dev, sg, nelems, direction);
 }
 
-static inline int
-dma_mapping_error(dma_addr_t dma_addr)
+static inline int dma_mapping_error(dma_addr_t dma_addr)
 {
-       BUG();
-       return 0;
+       return (dma_addr == DMA_ERROR_CODE);
 }
 
-#endif /* PCI */
-
-
-/* Now for the API extensions over the pci_ one */
-
-#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)
-#define dma_is_consistent(d, h)        (1)
-
-static inline int
-dma_get_cache_alignment(void)
+static inline int dma_get_cache_alignment(void)
 {
        /* no easy way to get cache size on all processors, so return
         * the maximum possible, to be safe */
        return (1 << INTERNODE_CACHE_SHIFT);
 }
 
-static inline void
-dma_sync_single_range_for_cpu(struct device *dev, dma_addr_t dma_handle,
-                             unsigned long offset, size_t size,
-                             enum dma_data_direction direction)
-{
-       /* just sync everything, that's all the pci API can do */
-       dma_sync_single_for_cpu(dev, dma_handle, offset+size, direction);
-}
-
-static inline void
-dma_sync_single_range_for_device(struct device *dev, dma_addr_t dma_handle,
-                                unsigned long offset, size_t size,
-                                enum dma_data_direction direction)
-{
-       /* just sync everything, that's all the pci API can do */
-       dma_sync_single_for_device(dev, dma_handle, offset+size, direction);
-}
-
-static inline void
-dma_cache_sync(struct device *dev, void *vaddr, size_t size,
-              enum dma_data_direction direction)
-{
-       /* could define this in terms of the dma_cache ... operations,
-        * but if you get this on a platform, you should convert the platform
-        * to using the generic device DMA API */
-       BUG();
-}
+#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)
+#define dma_is_consistent(d, h)        (1)
 
 #endif /* _ASM_SPARC64_DMA_MAPPING_H */
index 500026d9f6e1b524fdc8c313586cd7141abf6e12..b9215a0907d3f429352edd0298dbc12dffbb8dca 100644 (file)
@@ -2,6 +2,7 @@
 #define __LINUX_FBIO_H
 
 #include <linux/compiler.h>
+#include <linux/types.h>
 
 /* Constants used for fbio SunOS compatibility */
 /* (C) 1996 Miguel de Icaza */
@@ -299,4 +300,31 @@ struct fb_clut32 {
 #define LEO_LD_GBL_MAP         0x01009000
 #define LEO_UNK2_MAP           0x0100a000
 
+#ifdef __KERNEL__
+struct  fbcmap32 {
+       int             index;          /* first element (0 origin) */
+       int             count;
+       u32             red;
+       u32             green;
+       u32             blue;
+};
+
+#define FBIOPUTCMAP32  _IOW('F', 3, struct fbcmap32)
+#define FBIOGETCMAP32  _IOW('F', 4, struct fbcmap32)
+
+struct fbcursor32 {
+       short set;              /* what to set, choose from the list above */
+       short enable;           /* cursor on/off */
+       struct fbcurpos pos;    /* cursor position */
+       struct fbcurpos hot;    /* cursor hot spot */
+       struct fbcmap32 cmap;   /* color map info */
+       struct fbcurpos size;   /* cursor bit map size */
+       u32     image;          /* cursor image bits */
+       u32     mask;           /* cursor mask bits */
+};
+
+#define FBIOSCURSOR32  _IOW('F', 24, struct fbcursor32)
+#define FBIOGCURSOR32  _IOW('F', 25, struct fbcursor32)
+#endif
+
 #endif /* __LINUX_FBIO_H */
index b2aecf0054bd2167b990ddc2da53dec57458aca9..111f6b3b8925a4bb30961b1c577072b2ad7724cf 100644 (file)
@@ -16,7 +16,7 @@
 #define O_LARGEFILE    0x40000
 #define O_DIRECT        0x100000 /* direct disk access hint */
 #define O_NOATIME      0x200000
-
+#define O_CLOEXEC      0x400000
 
 #define F_GETOWN       5       /*  for sockets. */
 #define F_SETOWN       6       /*  for sockets. */
index 4aa0925e1b1b6b784bf83850deb28a0be5b5e449..1783239c7b405a18003ea2b2372c73b18effbe1e 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: floppy.h,v 1.32 2001/10/26 17:59:36 davem Exp $
- * asm-sparc64/floppy.h: Sparc specific parts of the Floppy driver.
+/* floppy.h: Sparc specific parts of the Floppy driver.
  *
- * Copyright (C) 1996 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1996, 2007 David S. Miller (davem@davemloft.net)
  * Copyright (C) 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  *
  * Ultra/PCI support added: Sep 1997  Eddie C. Dost  (ecd@skynet.be)
@@ -11,6 +10,7 @@
 #define __ASM_SPARC64_FLOPPY_H
 
 #include <linux/init.h>
+#include <linux/pci.h>
 
 #include <asm/page.h>
 #include <asm/pgtable.h>
index 0b1813f410454983c3936411ac87cf96a1c71c31..9eac6676caf10a5887a749c6a1811f21f6d45b48 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: iommu.h,v 1.10 2001/03/08 09:55:56 davem Exp $
- * iommu.h: Definitions for the sun5 IOMMU.
+/* iommu.h: Definitions for the sun5 IOMMU.
  *
- * Copyright (C) 1996, 1999 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1996, 1999, 2007 David S. Miller (davem@davemloft.net)
  */
 #ifndef _SPARC64_IOMMU_H
 #define _SPARC64_IOMMU_H
@@ -33,6 +32,7 @@ struct iommu {
        unsigned long           iommu_tsbbase;
        unsigned long           iommu_flush;
        unsigned long           iommu_flushinv;
+       unsigned long           iommu_tags;
        unsigned long           iommu_ctxflush;
        unsigned long           write_complete_reg;
        unsigned long           dummy_page;
@@ -54,4 +54,7 @@ struct strbuf {
        volatile unsigned long  __flushflag_buf[(64+(64-1)) / sizeof(long)];
 };
 
-#endif /* !(_SPARC_IOMMU_H) */
+extern int iommu_table_init(struct iommu *iommu, int tsbsize,
+                           u32 dma_offset, u32 dma_addr_mask);
+
+#endif /* !(_SPARC64_IOMMU_H) */
index 3f23c5dc5f2140040db7c13bc66774c0954ce08d..86dc5c018a197f0fdb3b36162ca468337bf8aa7a 100644 (file)
@@ -1,8 +1,7 @@
-/* $Id: oplib.h,v 1.14 2001/12/19 00:29:51 davem Exp $
- * oplib.h:  Describes the interface and available routines in the
+/* oplib.h:  Describes the interface and available routines in the
  *           Linux Prom library.
  *
- * Copyright (C) 1995 David S. Miller (davem@caip.rutgers.edu)
+ * Copyright (C) 1995, 2007 David S. Miller (davem@davemloft.net)
  * Copyright (C) 1996 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
  */
 
@@ -31,8 +30,10 @@ extern int prom_chosen_node;
 extern const char prom_peer_name[];
 extern const char prom_compatible_name[];
 extern const char prom_root_compatible[];
+extern const char prom_cpu_compatible[];
 extern const char prom_finddev_name[];
 extern const char prom_chosen_path[];
+extern const char prom_cpu_path[];
 extern const char prom_getprop_name[];
 extern const char prom_mmu_name[];
 extern const char prom_callmethod_name[];
index 600afe5ae2e3b21955a24ff081f949b6b12e2ded..8116e8f6062cad953e43ba8b7d0dc07743796079 100644 (file)
@@ -117,7 +117,7 @@ static int __devinit ecpp_probe(struct of_device *op, const struct of_device_id
        if (!strcmp(parent->name, "dma")) {
                p = parport_pc_probe_port(base, base + 0x400,
                                          op->irqs[0], PARPORT_DMA_NOFIFO,
-                                         op->dev.parent);
+                                         op->dev.parent->parent);
                if (!p)
                        return -ENOMEM;
                dev_set_drvdata(&op->dev, p);
index e11ac100f043469664c2870b90b3a1731de37e17..1393e57d50fb0c2bbee86edc1fb814d1bca90b39 100644 (file)
@@ -3,8 +3,7 @@
 
 #ifdef __KERNEL__
 
-#include <linux/fs.h>
-#include <linux/mm.h>
+#include <linux/dma-mapping.h>
 
 /* Can be used to override the logic in pci_scan_bus for skipping
  * already-configured bus numbers - to be used for buggy BIOSes
@@ -30,80 +29,42 @@ static inline void pcibios_penalize_isa_irq(int irq, int active)
        /* We don't do dynamic PCI IRQ allocation */
 }
 
-/* Dynamic DMA mapping stuff.
- */
-
 /* The PCI address space does not equal the physical memory
  * address space.  The networking and block device layers use
  * this boolean for bounce buffer decisions.
  */
 #define PCI_DMA_BUS_IS_PHYS    (0)
 
-#include <asm/scatterlist.h>
-
-struct pci_dev;
-
-struct pci_iommu_ops {
-       void *(*alloc_consistent)(struct pci_dev *, size_t, dma_addr_t *, gfp_t);
-       void (*free_consistent)(struct pci_dev *, size_t, void *, dma_addr_t);
-       dma_addr_t (*map_single)(struct pci_dev *, void *, size_t, int);
-       void (*unmap_single)(struct pci_dev *, dma_addr_t, size_t, int);
-       int (*map_sg)(struct pci_dev *, struct scatterlist *, int, int);
-       void (*unmap_sg)(struct pci_dev *, struct scatterlist *, int, int);
-       void (*dma_sync_single_for_cpu)(struct pci_dev *, dma_addr_t, size_t, int);
-       void (*dma_sync_sg_for_cpu)(struct pci_dev *, struct scatterlist *, int, int);
-};
-
-extern const struct pci_iommu_ops *pci_iommu_ops;
-
-/* Allocate and map kernel buffer using consistent mode DMA for a device.
- * hwdev should be valid struct pci_dev pointer for PCI devices.
- */
-static inline void *pci_alloc_consistent(struct pci_dev *hwdev, size_t size, dma_addr_t *dma_handle)
+static inline void *pci_alloc_consistent(struct pci_dev *pdev, size_t size,
+                                        dma_addr_t *dma_handle)
 {
-       return pci_iommu_ops->alloc_consistent(hwdev, size, dma_handle, GFP_ATOMIC);
+       return dma_alloc_coherent(&pdev->dev, size, dma_handle, GFP_ATOMIC);
 }
 
-/* Free and unmap a consistent DMA buffer.
- * cpu_addr is what was returned from pci_alloc_consistent,
- * size must be the same as what as passed into pci_alloc_consistent,
- * and likewise dma_addr must be the same as what *dma_addrp was set to.
- *
- * References to the memory and mappings associated with cpu_addr/dma_addr
- * past this call are illegal.
- */
-static inline void pci_free_consistent(struct pci_dev *hwdev, size_t size, void *vaddr, dma_addr_t dma_handle)
+static inline void pci_free_consistent(struct pci_dev *pdev, size_t size,
+                                      void *vaddr, dma_addr_t dma_handle)
 {
-       return pci_iommu_ops->free_consistent(hwdev, size, vaddr, dma_handle);
+       return dma_free_coherent(&pdev->dev, size, vaddr, dma_handle);
 }
 
-/* Map a single buffer of the indicated size for DMA in streaming mode.
- * The 32-bit bus address to use is returned.
- *
- * Once the device is given the dma address, the device owns this memory
- * until either pci_unmap_single or pci_dma_sync_single_for_cpu is performed.
- */
-static inline dma_addr_t pci_map_single(struct pci_dev *hwdev, void *ptr, size_t size, int direction)
+static inline dma_addr_t pci_map_single(struct pci_dev *pdev, void *ptr,
+                                       size_t size, int direction)
 {
-       return pci_iommu_ops->map_single(hwdev, ptr, size, direction);
+       return dma_map_single(&pdev->dev, ptr, size,
+                             (enum dma_data_direction) direction);
 }
 
-/* Unmap a single streaming mode DMA translation.  The dma_addr and size
- * must match what was provided for in a previous pci_map_single call.  All
- * other usages are undefined.
- *
- * After this call, reads by the cpu to the buffer are guaranteed to see
- * whatever the device wrote there.
- */
-static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr, size_t size, int direction)
+static inline void pci_unmap_single(struct pci_dev *pdev, dma_addr_t dma_addr,
+                                   size_t size, int direction)
 {
-       pci_iommu_ops->unmap_single(hwdev, dma_addr, size, direction);
+       dma_unmap_single(&pdev->dev, dma_addr, size,
+                        (enum dma_data_direction) direction);
 }
 
-/* No highmem on sparc64, plus we have an IOMMU, so mapping pages is easy. */
 #define pci_map_page(dev, page, off, size, dir) \
        pci_map_single(dev, (page_address(page) + (off)), size, dir)
-#define pci_unmap_page(dev,addr,sz,dir) pci_unmap_single(dev,addr,sz,dir)
+#define pci_unmap_page(dev,addr,sz,dir) \
+       pci_unmap_single(dev,addr,sz,dir)
 
 /* pci_unmap_{single,page} is not a nop, thus... */
 #define DECLARE_PCI_UNMAP_ADDR(ADDR_NAME)      \
@@ -119,75 +80,48 @@ static inline void pci_unmap_single(struct pci_dev *hwdev, dma_addr_t dma_addr,
 #define pci_unmap_len_set(PTR, LEN_NAME, VAL)          \
        (((PTR)->LEN_NAME) = (VAL))
 
-/* 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.
- */
-static inline int pci_map_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nents, int direction)
+static inline int pci_map_sg(struct pci_dev *pdev, struct scatterlist *sg,
+                            int nents, int direction)
 {
-       return pci_iommu_ops->map_sg(hwdev, sg, nents, direction);
+       return dma_map_sg(&pdev->dev, sg, nents,
+                         (enum dma_data_direction) direction);
 }
 
-/* Unmap a set of streaming mode DMA translations.
- * Again, cpu read rules concerning calls here are the same as for
- * pci_unmap_single() above.
- */
-static inline void pci_unmap_sg(struct pci_dev *hwdev, struct scatterlist *sg, int nhwents, int direction)
+static inline void pci_unmap_sg(struct pci_dev *pdev, struct scatterlist *sg,
+                               int nents, int direction)
 {
-       pci_iommu_ops->unmap_sg(hwdev, sg, nhwents, direction);
+       dma_unmap_sg(&pdev->dev, sg, nents,
+                    (enum dma_data_direction) direction);
 }
 
-/* Make physical memory consistent for a single
- * streaming mode DMA translation after a transfer.
- *
- * If you perform a pci_map_single() but wish to interrogate the
- * buffer using the cpu, yet do not wish to teardown the PCI dma
- * mapping, you must call this function before doing so.  At the
- * next point you give the PCI dma address back to the card, you
- * must first perform a pci_dma_sync_for_device, and then the
- * device again owns the buffer.
- */
-static inline void pci_dma_sync_single_for_cpu(struct pci_dev *hwdev, dma_addr_t dma_handle, size_t size, int direction)
+static inline void pci_dma_sync_single_for_cpu(struct pci_dev *pdev,
+                                              dma_addr_t dma_handle,
+                                              size_t size, int direction)
 {
-       pci_iommu_ops->dma_sync_single_for_cpu(hwdev, dma_handle, size, direction);
+       dma_sync_single_for_cpu(&pdev->dev, dma_handle, size,
+                               (enum dma_data_direction) direction);
 }
 
-static inline void
-pci_dma_sync_single_for_device(struct pci_dev *hwdev, dma_addr_t dma_handle,
-                              size_t size, int direction)
+static inline void pci_dma_sync_single_for_device(struct pci_dev *pdev,
+                                                 dma_addr_t dma_handle,
+                                                 size_t size, int direction)
 {
        /* No flushing needed to sync cpu writes to the device.  */
-       BUG_ON(direction == PCI_DMA_NONE);
 }
 
-/* Make physical memory consistent for a set of streaming
- * mode DMA translations after a transfer.
- *
- * The same as pci_dma_sync_single_* but for a scatter-gather list,
- * same rules and usage.
- */
-static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *hwdev, struct scatterlist *sg, int nelems, int direction)
+static inline void pci_dma_sync_sg_for_cpu(struct pci_dev *pdev,
+                                          struct scatterlist *sg,
+                                          int nents, int direction)
 {
-       pci_iommu_ops->dma_sync_sg_for_cpu(hwdev, sg, nelems, direction);
+       dma_sync_sg_for_cpu(&pdev->dev, sg, nents,
+                           (enum dma_data_direction) direction);
 }
 
-static inline void
-pci_dma_sync_sg_for_device(struct pci_dev *hwdev, struct scatterlist *sg,
-                       int nelems, int direction)
+static inline void pci_dma_sync_sg_for_device(struct pci_dev *pdev,
+                                             struct scatterlist *sg,
+                                             int nelems, int direction)
 {
        /* No flushing needed to sync cpu writes to the device.  */
-       BUG_ON(direction == PCI_DMA_NONE);
 }
 
 /* Return whether the given PCI device DMA address mask can
@@ -206,11 +140,9 @@ extern int pci_dma_supported(struct pci_dev *hwdev, u64 mask);
 #define PCI64_REQUIRED_MASK    (~(dma64_addr_t)0)
 #define PCI64_ADDR_BASE                0xfffc000000000000UL
 
-#define PCI_DMA_ERROR_CODE     (~(dma_addr_t)0x0)
-
 static inline int pci_dma_mapping_error(dma_addr_t dma_addr)
 {
-       return (dma_addr == PCI_DMA_ERROR_CODE);
+       return dma_mapping_error(dma_addr);
 }
 
 #ifdef CONFIG_PCI
index 31dcb92fbae0cc27039c33c189c3f73d2730a09a..07843f9f05df5771928f8f53285e158f27a919fd 100644 (file)
@@ -76,6 +76,7 @@ extern int of_set_property(struct device_node *node, const char *name, void *val
 extern int of_getintprop_default(struct device_node *np,
                                 const char *name,
                                 int def);
+extern int of_find_in_proplist(const char *list, const char *match, int len);
 
 extern void prom_build_devicetree(void);
 
index 7efd49d31bb8a55a71f9ce9d07dcdf3a2a2e920f..0151cad486f3c86454428d4af9c1ebfd88afc68c 100644 (file)
@@ -1,7 +1,6 @@
-/* $Id: sbus.h,v 1.14 2000/02/18 13:50:55 davem Exp $
- * sbus.h: Defines for the Sun SBus.
+/* sbus.h: Defines for the Sun SBus.
  *
- * Copyright (C) 1996, 1999 David S. Miller (davem@redhat.com)
+ * Copyright (C) 1996, 1999, 2007 David S. Miller (davem@davemloft.net)
  */
 
 #ifndef _SPARC64_SBUS_H
@@ -69,7 +68,6 @@ struct sbus_dev {
 /* This struct describes the SBus(s) found on this machine. */
 struct sbus_bus {
        struct of_device        ofdev;
-       void                    *iommu;         /* Opaque IOMMU cookie  */
        struct sbus_dev         *devices;       /* Tree of SBUS devices */
        struct sbus_bus         *next;          /* Next SBUS in system  */
        int                     prom_node;      /* OBP node of SBUS     */
@@ -102,9 +100,18 @@ extern struct sbus_bus *sbus_root;
 extern void sbus_set_sbus64(struct sbus_dev *, int);
 extern void sbus_fill_device_irq(struct sbus_dev *);
 
-/* These yield IOMMU mappings in consistent mode. */
-extern void *sbus_alloc_consistent(struct sbus_dev *, size_t, dma_addr_t *dma_addrp);
-extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t);
+static inline void *sbus_alloc_consistent(struct sbus_dev *sdev , size_t size,
+                                         dma_addr_t *dma_handle)
+{
+       return dma_alloc_coherent(&sdev->ofdev.dev, size,
+                                 dma_handle, GFP_ATOMIC);
+}
+
+static inline void sbus_free_consistent(struct sbus_dev *sdev, size_t size,
+                                       void *vaddr, dma_addr_t dma_handle)
+{
+       return dma_free_coherent(&sdev->ofdev.dev, size, vaddr, dma_handle);
+}
 
 #define SBUS_DMA_BIDIRECTIONAL DMA_BIDIRECTIONAL
 #define SBUS_DMA_TODEVICE      DMA_TO_DEVICE
@@ -112,18 +119,67 @@ extern void sbus_free_consistent(struct sbus_dev *, size_t, void *, dma_addr_t);
 #define        SBUS_DMA_NONE           DMA_NONE
 
 /* All the rest use streaming mode mappings. */
-extern dma_addr_t sbus_map_single(struct sbus_dev *, void *, size_t, int);
-extern void sbus_unmap_single(struct sbus_dev *, dma_addr_t, size_t, int);
-extern int sbus_map_sg(struct sbus_dev *, struct scatterlist *, int, int);
-extern void sbus_unmap_sg(struct sbus_dev *, struct scatterlist *, int, int);
+static inline dma_addr_t sbus_map_single(struct sbus_dev *sdev, void *ptr,
+                                        size_t size, int direction)
+{
+       return dma_map_single(&sdev->ofdev.dev, ptr, size,
+                             (enum dma_data_direction) direction);
+}
+
+static inline void sbus_unmap_single(struct sbus_dev *sdev,
+                                    dma_addr_t dma_addr, size_t size,
+                                    int direction)
+{
+       dma_unmap_single(&sdev->ofdev.dev, dma_addr, size,
+                        (enum dma_data_direction) direction);
+}
+
+static inline int sbus_map_sg(struct sbus_dev *sdev, struct scatterlist *sg,
+                             int nents, int direction)
+{
+       return dma_map_sg(&sdev->ofdev.dev, sg, nents,
+                         (enum dma_data_direction) direction);
+}
+
+static inline void sbus_unmap_sg(struct sbus_dev *sdev, struct scatterlist *sg,
+                                int nents, int direction)
+{
+       dma_unmap_sg(&sdev->ofdev.dev, sg, nents,
+                    (enum dma_data_direction) direction);
+}
 
 /* Finally, allow explicit synchronization of streamable mappings. */
-extern void sbus_dma_sync_single_for_cpu(struct sbus_dev *, dma_addr_t, size_t, int);
+static inline void sbus_dma_sync_single_for_cpu(struct sbus_dev *sdev,
+                                               dma_addr_t dma_handle,
+                                               size_t size, int direction)
+{
+       dma_sync_single_for_cpu(&sdev->ofdev.dev, dma_handle, size,
+                               (enum dma_data_direction) direction);
+}
 #define sbus_dma_sync_single sbus_dma_sync_single_for_cpu
-extern void sbus_dma_sync_single_for_device(struct sbus_dev *, dma_addr_t, size_t, int);
-extern void sbus_dma_sync_sg_for_cpu(struct sbus_dev *, struct scatterlist *, int, int);
+
+static inline void sbus_dma_sync_single_for_device(struct sbus_dev *sdev,
+                                                  dma_addr_t dma_handle,
+                                                  size_t size, int direction)
+{
+       /* No flushing needed to sync cpu writes to the device.  */
+}
+
+static inline void sbus_dma_sync_sg_for_cpu(struct sbus_dev *sdev,
+                                           struct scatterlist *sg,
+                                           int nents, int direction)
+{
+       dma_sync_sg_for_cpu(&sdev->ofdev.dev, sg, nents,
+                           (enum dma_data_direction) direction);
+}
 #define sbus_dma_sync_sg sbus_dma_sync_sg_for_cpu
-extern void sbus_dma_sync_sg_for_device(struct sbus_dev *, struct scatterlist *, int, int);
+
+static inline void sbus_dma_sync_sg_for_device(struct sbus_dev *sdev,
+                                              struct scatterlist *sg,
+                                              int nents, int direction)
+{
+       /* No flushing needed to sync cpu writes to the device.  */
+}
 
 extern void sbus_arch_bus_ranges_init(struct device_node *, struct sbus_bus *);
 extern void sbus_setup_iommu(struct sbus_bus *, struct device_node *);
index 23ad8a7987adf5b37feda5e56248643c60cd7e28..cf7807813e85fe976e9113cfea4a51fd7ac855c1 100644 (file)
 
 #define L1DCACHE_SIZE          0x4000
 
+#define SUN4V_CHIP_INVALID     0x00
+#define SUN4V_CHIP_NIAGARA1    0x01
+#define SUN4V_CHIP_NIAGARA2    0x02
+#define SUN4V_CHIP_UNKNOWN     0xff
+
 #ifndef __ASSEMBLY__
 
 enum ultra_tlb_layout {
@@ -49,6 +54,8 @@ enum ultra_tlb_layout {
 
 extern enum ultra_tlb_layout tlb_type;
 
+extern int sun4v_chip_type;
+
 extern int cheetah_pcache_forced_on;
 extern void cheetah_enable_pcache(void);
 
index 8ce3f1813e280b9f428d021c647f4891b589658f..a0233884fc94c6084045b7db829c849ba9a06f24 100644 (file)
@@ -63,4 +63,8 @@ static struct xor_block_template xor_block_niagara = {
 
 /* For VIS for everything except Niagara.  */
 #define XOR_SELECT_TEMPLATE(FASTEST) \
-       (tlb_type == hypervisor ? &xor_block_niagara : &xor_block_VIS)
+       ((tlb_type == hypervisor && \
+         (sun4v_chip_type == SUN4V_CHIP_NIAGARA1 || \
+          sun4v_chip_type == SUN4V_CHIP_NIAGARA2)) ? \
+        &xor_block_niagara : \
+        &xor_block_VIS)
index 82b8f2846207519f7d4b0deb7380e857f27dffbc..1a9e6ae0c5fd55e1324aad120a50016e4c1c6fb0 100644 (file)
@@ -77,16 +77,14 @@ struct thread_info {
  * thread information flag bit numbers
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_POLLING_NRFLAG     4       /* true if poll_idle() is polling
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_POLLING_NRFLAG     3       /* true if poll_idle() is polling
                                           TIF_NEED_RESCHED */
-#define TIF_MEMDIE             5
+#define TIF_MEMDIE             4
 
 /* as above, but as bit values */
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_POLLING_NRFLAG    (1<<TIF_POLLING_NRFLAG)
index 88926eb44f5cb764b3a5db8e2ff6046709469b9a..5da8cb0c0599fccc883992354929238aa8700bd1 100644 (file)
@@ -10,6 +10,8 @@ struct pci_sysdata {
        void*           iommu;          /* IOMMU private data */
 };
 
+extern struct pci_bus *pci_scan_bus_with_sysdata(int busno);
+
 #ifdef CONFIG_CALGARY_IOMMU
 static inline void* pci_iommu(struct pci_bus *bus)
 {
index 8ebd765c674a2564cc5dde497a3e60e482ff3427..b0496e0d72a68669cf5a5c1204af07bc1bcee334 100644 (file)
  * megabits/second; but this requires the faster clock.
  */
 #define BASE_BAUD ( 1843200 / 16 )
+
+/* Standard COM flags (except for COM4, because of the 8514 problem) */
+#ifdef CONFIG_SERIAL_DETECT_IRQ
+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST | ASYNC_AUTO_IRQ)
+#define STD_COM4_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_AUTO_IRQ)
+#else
+#define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
+#define STD_COM4_FLAGS ASYNC_BOOT_AUTOCONF
+#endif
+
+#define SERIAL_PORT_DFNS                       \
+       /* UART CLK   PORT IRQ     FLAGS        */                      \
+       { 0, BASE_BAUD, 0x3F8, 4, STD_COM_FLAGS },      /* ttyS0 */     \
+       { 0, BASE_BAUD, 0x2F8, 3, STD_COM_FLAGS },      /* ttyS1 */     \
+       { 0, BASE_BAUD, 0x3E8, 4, STD_COM_FLAGS },      /* ttyS2 */     \
+       { 0, BASE_BAUD, 0x2E8, 3, STD_COM4_FLAGS },     /* ttyS3 */
index dbb047febc5e5ad7ad2a0384d67540f47c9618ee..cd955d3d112f46b4110dac638328b1793d0e7b02 100644 (file)
@@ -41,8 +41,8 @@ struct iommu_table;
 extern void tce_build(struct iommu_table *tbl, unsigned long index,
         unsigned int npages, unsigned long uaddr, int direction);
 extern void tce_free(struct iommu_table *tbl, long index, unsigned int npages);
-extern void* alloc_tce_table(void);
-extern void free_tce_table(void *tbl);
-extern int build_tce_table(struct pci_dev *dev, void __iomem *bbar);
+extern void * __init alloc_tce_table(void);
+extern void __init free_tce_table(void *tbl);
+extern int __init build_tce_table(struct pci_dev *dev, void __iomem *bbar);
 
 #endif /* _ASM_X86_64_TCE_H */
index 33c72ef15a0cddcf1df1a2ae3d7dd4c23df9130a..beae2bfb62cacdc7aa6705be207a59b11edea1ae 100644 (file)
@@ -107,7 +107,6 @@ static inline struct thread_info *stack_thread_info(void)
  * Warning: layout of LSW is hardcoded in entry.S
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
 #define TIF_SIGPENDING         2       /* signal pending */
 #define TIF_NEED_RESCHED       3       /* rescheduling necessary */
 #define TIF_SINGLESTEP         4       /* reenable singlestep on user return*/
@@ -126,7 +125,6 @@ static inline struct thread_info *stack_thread_info(void)
 #define TIF_FREEZE             23      /* is freezing for suspend */
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_SINGLESTEP                (1<<TIF_SINGLESTEP)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
index 9df30b939c4eb1121285e0cad59dd6385ca4ddc4..f4ce8768ad443648fc637bf1cdb128e25a4f8a44 100644 (file)
@@ -100,7 +100,7 @@ struct exception_table_entry
        case 8:  __get_user_x(8,__ret_gu,__val_gu,ptr); break;          \
        default: __get_user_bad(); break;                               \
        }                                                               \
-       (x) = (typeof(*(ptr)))__val_gu;                         \
+       (x) = (__force typeof(*(ptr)))__val_gu;                         \
        __ret_gu;                                                       \
 })
 
@@ -192,7 +192,7 @@ struct __large_struct { unsigned long buf[100]; };
        int __gu_err;                                           \
        unsigned long __gu_val;                                 \
        __get_user_size(__gu_val,(ptr),(size),__gu_err);        \
-       (x) = (typeof(*(ptr)))__gu_val;                 \
+       (x) = (__force typeof(*(ptr)))__gu_val;                 \
        __gu_err;                                               \
 })
 
index 3fa29799b435302e3ca7ddfd4131c4f51d6b2545..52c958285bcbaa919c85c26325cba608bbf8652b 100644 (file)
@@ -110,17 +110,15 @@ static inline struct thread_info *current_thread_info(void)
  * - other flags in MSW
  */
 #define TIF_SYSCALL_TRACE      0       /* syscall trace active */
-#define TIF_NOTIFY_RESUME      1       /* resumption notification requested */
-#define TIF_SIGPENDING         2       /* signal pending */
-#define TIF_NEED_RESCHED       3       /* rescheduling necessary */
-#define TIF_SINGLESTEP         4       /* restore singlestep on return to user mode */
-#define TIF_IRET               5       /* return with iret */
-#define TIF_MEMDIE             6
-#define TIF_RESTORE_SIGMASK    7       /* restore signal mask in do_signal() */
+#define TIF_SIGPENDING         1       /* signal pending */
+#define TIF_NEED_RESCHED       2       /* rescheduling necessary */
+#define TIF_SINGLESTEP         3       /* restore singlestep on return to user mode */
+#define TIF_IRET               4       /* return with iret */
+#define TIF_MEMDIE             5
+#define TIF_RESTORE_SIGMASK    6       /* restore signal mask in do_signal() */
 #define TIF_POLLING_NRFLAG     16      /* true if poll_idle() is polling TIF_NEED_RESCHED */
 
 #define _TIF_SYSCALL_TRACE     (1<<TIF_SYSCALL_TRACE)
-#define _TIF_NOTIFY_RESUME     (1<<TIF_NOTIFY_RESUME)
 #define _TIF_SIGPENDING                (1<<TIF_SIGPENDING)
 #define _TIF_NEED_RESCHED      (1<<TIF_NEED_RESCHED)
 #define _TIF_SINGLESTEP                (1<<TIF_SINGLESTEP)
index bcf875e844fe79fc2bb7e5a93614d8af740bcb51..ad7f71a81b0ae9ce5b8cd51a49a27aef4aeb4386 100644 (file)
@@ -137,6 +137,7 @@ header-y += radeonfb.h
 header-y += raw.h
 header-y += resource.h
 header-y += rose.h
+header-y += serial_reg.h
 header-y += smbno.h
 header-y += snmp.h
 header-y += sockios.h
index 4d85262b4fa4e8a4e9eb984e668f57363fd09183..1ddef34f43c37c3a4153e080fa1c97757fe1ab08 100644 (file)
@@ -24,6 +24,8 @@
 #include <linux/mempool.h>
 #include <linux/ioprio.h>
 
+#ifdef CONFIG_BLOCK
+
 /* Platforms may set this to teach the BIO layer about IOMMU hardware. */
 #include <asm/io.h>
 
@@ -361,4 +363,5 @@ static inline char *__bio_kmap_irq(struct bio *bio, unsigned short idx,
        __bio_kmap_irq((bio), (bio)->bi_idx, (flags))
 #define bio_kunmap_irq(buf,flags)      __bio_kunmap_irq(buf, flags)
 
+#endif /* CONFIG_BLOCK */
 #endif /* __LINUX_BIO_H */
index a1c96d9ee720c1032217a1aa4e06d6d31799eab2..b126c6f68e27b2080fe434fe15847a00058048fe 100644 (file)
@@ -483,8 +483,8 @@ struct request_queue
 #define QUEUE_FLAG_CLUSTER     0       /* cluster several segments into 1 */
 #define QUEUE_FLAG_QUEUED      1       /* uses generic tag queueing */
 #define QUEUE_FLAG_STOPPED     2       /* queue is stopped */
-#define        QUEUE_FLAG_READFULL     3       /* write queue has been filled */
-#define QUEUE_FLAG_WRITEFULL   4       /* read queue has been filled */
+#define        QUEUE_FLAG_READFULL     3       /* read queue has been filled */
+#define QUEUE_FLAG_WRITEFULL   4       /* write queue has been filled */
 #define QUEUE_FLAG_DEAD                5       /* queue being torn down */
 #define QUEUE_FLAG_REENTER     6       /* Re-entrancy avoidance */
 #define QUEUE_FLAG_PLUGGED     7       /* queue is plugged */
index 90874a5d7d780b2a7977674c9ed72c4e272d0328..7b5d56b82b590f2d8b7dfc907e7bc19ec864e867 100644 (file)
@@ -105,7 +105,7 @@ struct blk_io_trace {
  */
 struct blk_io_trace_remap {
        __be32 device;
-       u32 __pad;
+       __be32 device_from;
        __be64 sector;
 };
 
@@ -272,6 +272,7 @@ static inline void blk_add_trace_remap(struct request_queue *q, struct bio *bio,
                return;
 
        r.device = cpu_to_be32(dev);
+       r.device_from = cpu_to_be32(bio->bi_bdev->bd_dev);
        r.sector = cpu_to_be64(to);
 
        __blk_add_trace(bt, from, bio->bi_size, bio->bi_rw, BLK_TA_REMAP, !bio_flagged(bio, BIO_UPTODATE), sizeof(r), &r);
index f415f89e0ac84ae77ba4309bb9eb023007c8f399..60e377b520f8e242c003b2973ac6fc8df4605e40 100644 (file)
@@ -15,14 +15,18 @@ struct sg_io_v4 {
 
        __u32 request_len;      /* [i] in bytes */
        __u64 request;          /* [i], [*i] {SCSI: cdb} */
+       __u64 request_tag;      /* [i] {SCSI: task tag (only if flagged)} */
        __u32 request_attr;     /* [i] {SCSI: task attribute} */
-       __u32 request_tag;      /* [i] {SCSI: task tag (only if flagged)} */
        __u32 request_priority; /* [i] {SCSI: task priority} */
+       __u32 request_extra;    /* [i] {spare, for padding} */
        __u32 max_response_len; /* [i] in bytes */
        __u64 response;         /* [i], [*o] {SCSI: (auto)sense data} */
 
-       /* "din_" for data in (from device); "dout_" for data out (to device) */
+        /* "dout_": data out (to device); "din_": data in (from device) */
+       __u32 dout_iovec_count; /* [i] 0 -> "flat" dout transfer else
+                                  dout_xfer points to array of iovec */
        __u32 dout_xfer_len;    /* [i] bytes to be transferred to device */
+       __u32 din_iovec_count;  /* [i] 0 -> "flat" din transfer */
        __u32 din_xfer_len;     /* [i] bytes to be transferred from device */
        __u64 dout_xferp;       /* [i], [*i] */
        __u64 din_xferp;        /* [i], [*o] */
@@ -39,8 +43,9 @@ struct sg_io_v4 {
        __u32 info;             /* [o] additional information */
        __u32 duration;         /* [o] time to complete, in milliseconds */
        __u32 response_len;     /* [o] bytes of response actually written */
-       __s32 din_resid;        /* [o] actual_din_xfer_len - din_xfer_len */
-       __u32 generated_tag;    /* [o] {SCSI: task tag that transport chose} */
+       __s32 din_resid;        /* [o] din_xfer_len - actual_din_xfer_len */
+       __s32 dout_resid;       /* [o] dout_xfer_len - actual_dout_xfer_len */
+       __u64 generated_tag;    /* [o] {SCSI: transport generated task tag} */
        __u32 spare_out;        /* [o] */
 
        __u32 padding;
@@ -53,15 +58,19 @@ struct bsg_class_device {
        struct class_device *class_dev;
        struct device *dev;
        int minor;
-       struct list_head list;
        struct request_queue *queue;
 };
 
 extern int bsg_register_queue(struct request_queue *, struct device *, const char *);
 extern void bsg_unregister_queue(struct request_queue *);
 #else
-#define bsg_register_queue(disk, dev, name)            (0)
-#define bsg_unregister_queue(disk)     do { } while (0)
+static inline int bsg_register_queue(struct request_queue * rq, struct device *dev, const char *name)
+{
+       return 0;
+}
+static inline void bsg_unregister_queue(struct request_queue *rq)
+{
+}
 #endif
 
 #endif /* __KERNEL__ */
index e0bd46eb24145f0f855d36f3fbd35e3e3359597f..def5a659b8a53653b194844242404bdeb78d916c 100644 (file)
@@ -123,7 +123,6 @@ extern void clockevents_exchange_device(struct clock_event_device *old,
 extern void clockevents_set_mode(struct clock_event_device *dev,
                                 enum clock_event_mode mode);
 extern int clockevents_register_notifier(struct notifier_block *nb);
-extern void clockevents_unregister_notifier(struct notifier_block *nb);
 extern int clockevents_program_event(struct clock_event_device *dev,
                                     ktime_t expires, ktime_t now);
 
index 12a1291855e23cb43f77e61cdf6cdc7b59c28ca6..86f9a3a6137debd41bdb03b8988580cbeb6d1ca7 100644 (file)
@@ -15,8 +15,8 @@
 # define __acquire(x)  __context__(x,1)
 # define __release(x)  __context__(x,-1)
 # define __cond_lock(x,c)      ((c) ? ({ __acquire(x); 1; }) : 0)
-extern void __chk_user_ptr(const void __user *);
-extern void __chk_io_ptr(const void __iomem *);
+extern void __chk_user_ptr(const volatile void __user *);
+extern void __chk_io_ptr(const volatile void __iomem *);
 #else
 # define __user
 # define __kernel
index c2236bbff412cfac46bdd2c1cb84ebd7c3f961ec..1d5ded0836eee2161221b25d3ef7b6f432fd0095 100644 (file)
@@ -41,8 +41,6 @@ extern void cpu_remove_sysdev_attr(struct sysdev_attribute *attr);
 extern int cpu_add_sysdev_attr_group(struct attribute_group *attrs);
 extern void cpu_remove_sysdev_attr_group(struct attribute_group *attrs);
 
-extern struct sysdev_attribute attr_sched_mc_power_savings;
-extern struct sysdev_attribute attr_sched_smt_power_savings;
 extern int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls);
 
 #ifdef CONFIG_HOTPLUG_CPU
index d9f0a57f5a2f1f530e9e63c6f9e7ddb4f395f6c2..3a38d1f70cb7c070faa253a2173db130a43917b6 100644 (file)
@@ -551,6 +551,9 @@ extern void put_device(struct device * dev);
 /* drivers/base/power/shutdown.c */
 extern void device_shutdown(void);
 
+/* drivers/base/sys.c */
+extern void sysdev_shutdown(void);
+
 
 /* drivers/base/firmware.c */
 extern int __must_check firmware_register(struct kset *);
index 93e4c3a6d1903239a3250c06c0cd1b7df007d36a..50839fe9e39e3b615b9acb5e3bc549a603d46a52 100644 (file)
@@ -29,6 +29,7 @@
 #ifdef __KERNEL__
 #include <linux/types.h>
 #else
+#include <asm/types.h>
 #include <stdint.h>
 #include <time.h>
 #endif
index 3a632244f31b16bd49eedb6c936568219bbd0191..23ccea81129738095fddd0fcc2138e13d3832104 100644 (file)
@@ -270,8 +270,6 @@ u32 ethtool_op_get_sg(struct net_device *dev);
 int ethtool_op_set_sg(struct net_device *dev, u32 data);
 u32 ethtool_op_get_tso(struct net_device *dev);
 int ethtool_op_set_tso(struct net_device *dev, u32 data);
-int ethtool_op_get_perm_addr(struct net_device *dev, 
-                            struct ethtool_perm_addr *addr, u8 *data);
 u32 ethtool_op_get_ufo(struct net_device *dev);
 int ethtool_op_set_ufo(struct net_device *dev, u32 data);
 
@@ -309,7 +307,6 @@ int ethtool_op_set_ufo(struct net_device *dev, u32 data);
  * get_strings: Return a set of strings that describe the requested objects 
  * phys_id: Identify the device
  * get_stats: Return statistics about the device
- * get_perm_addr: Gets the permanent hardware address
  * 
  * Description:
  *
@@ -368,7 +365,6 @@ struct ethtool_ops {
        int     (*phys_id)(struct net_device *, u32);
        int     (*get_stats_count)(struct net_device *);
        void    (*get_ethtool_stats)(struct net_device *, struct ethtool_stats *, u64 *);
-       int     (*get_perm_addr)(struct net_device *, struct ethtool_perm_addr *, u8 *);
        int     (*begin)(struct net_device *);
        void    (*complete)(struct net_device *);
        u32     (*get_ufo)(struct net_device *);
index c8e02de737f6b07a3443d53362aee0d3bc507087..efded00ad08c5003bebd89964bb8b8619630a2c2 100644 (file)
@@ -5,7 +5,7 @@
 
 #include <linux/sched.h>
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 /*
  * Check if a process has been frozen
  */
@@ -126,7 +126,7 @@ static inline void set_freezable(void)
        current->flags &= ~PF_NOFREEZE;
 }
 
-#else
+#else /* !CONFIG_PM_SLEEP */
 static inline int frozen(struct task_struct *p) { return 0; }
 static inline int freezing(struct task_struct *p) { return 0; }
 static inline void set_freeze_flag(struct task_struct *p) {}
@@ -143,6 +143,6 @@ static inline void freezer_do_not_count(void) {}
 static inline void freezer_count(void) {}
 static inline int freezer_should_skip(struct task_struct *p) { return 0; }
 static inline void set_freezable(void) {}
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 #endif /* FREEZER_H_INCLUDED */
index d33beadd9a43a0f14a85217d9f0ee852a70e15e0..16421f662a7ad6074e107a47f8d9be92ad185064 100644 (file)
@@ -878,7 +878,7 @@ extern int vfs_cancel_lock(struct file *filp, struct file_lock *fl);
 extern int flock_lock_file_wait(struct file *filp, struct file_lock *fl);
 extern int __break_lease(struct inode *inode, unsigned int flags);
 extern void lease_get_mtime(struct inode *, struct timespec *time);
-extern int setlease(struct file *, long, struct file_lock **);
+extern int generic_setlease(struct file *, long, struct file_lock **);
 extern int vfs_setlease(struct file *, long, struct file_lock **);
 extern int lease_modify(struct file_lock **, int);
 extern int lock_may_read(struct inode *, loff_t start, unsigned long count);
@@ -1659,7 +1659,6 @@ extern int sb_min_blocksize(struct super_block *, int);
 extern int generic_file_mmap(struct file *, struct vm_area_struct *);
 extern int generic_file_readonly_mmap(struct file *, struct vm_area_struct *);
 extern int file_read_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
-extern int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size);
 int generic_write_checks(struct file *file, loff_t *pos, size_t *count, int isblk);
 extern ssize_t generic_file_aio_read(struct kiocb *, const struct iovec *, unsigned long, loff_t);
 extern ssize_t generic_file_aio_write(struct kiocb *, const struct iovec *, unsigned long, loff_t);
index 9756fc102a83f284a1040386bd076d6acca81cff..a47b8025d39935c18a66db9cc975a58fe8f85dda 100644 (file)
@@ -264,7 +264,7 @@ static inline void set_capacity(struct gendisk *disk, sector_t size)
 
 #ifdef CONFIG_SOLARIS_X86_PARTITION
 
-#define SOLARIS_X86_NUMSLICE   8
+#define SOLARIS_X86_NUMSLICE   16
 #define SOLARIS_X86_VTOC_SANE  (0x600DDEEEUL)
 
 struct solaris_x86_slice {
index 49b7053043adde30bcfc8475403fe39ba93ce5f6..e6a71c82d204699b6a18226e261a7beda4463ed7 100644 (file)
@@ -1,6 +1,8 @@
 #ifndef _LINUX_HUGETLB_H
 #define _LINUX_HUGETLB_H
 
+#include <linux/fs.h>
+
 #ifdef CONFIG_HUGETLB_PAGE
 
 #include <linux/mempolicy.h>
index 0c37a737a2b287b54bd068f73293c23be394bb53..2a32f2fd940d56fc6bf4d63ced9f9f75aa13995d 100644 (file)
@@ -156,10 +156,14 @@ struct i2c_driver {
  * @name: Indicates the type of the device, usually a chip name that's
  *     generic enough to hide second-sourcing and compatible revisions.
  * @adapter: manages the bus segment hosting this I2C device
+ * @driver: device's driver, hence pointer to access routines
+ * @usage_count: counts current number of users of this client
  * @dev: Driver model device node for the slave.
  * @irq: indicates the IRQ generated by this device (if any)
  * @driver_name: Identifies new-style driver used with this device; also
  *     used as the module name for hotplug/coldplug modprobe support.
+ * @list: list of active/busy clients
+ * @released: used to synchronize client releases & detaches and references
  *
  * An i2c_client identifies a single device (i.e. chip) connected to an
  * i2c bus. The behaviour exposed to Linux is defined by the driver
index f0d0e3295a9b198e767da6225328776b0c670315..74b1f43bf9825b260be74c1bf71be116f9bd40fc 100644 (file)
@@ -43,7 +43,7 @@
 #define __init         __attribute__ ((__section__ (".init.text"))) __cold
 #define __initdata     __attribute__ ((__section__ (".init.data")))
 #define __exitdata     __attribute__ ((__section__(".exit.data")))
-#define __exit_call    __attribute_used__ __attribute__ ((__section__ (".exitcall.exit"))) __cold
+#define __exit_call    __attribute_used__ __attribute__ ((__section__ (".exitcall.exit")))
 
 /* modpost check for section mismatches during the kernel build.
  * A section mismatch happens when there are references from a
@@ -114,7 +114,7 @@ void prepare_namespace(void);
  *
  * This only exists for built-in code, not for modules.
  */
-#define pure_initcall(fn)              __define_initcall("0",fn,1)
+#define pure_initcall(fn)              __define_initcall("0",fn,0)
 
 #define core_initcall(fn)              __define_initcall("1",fn,1)
 #define core_initcall_sync(fn)         __define_initcall("1s",fn,1s)
index 0a3c2ebf200872f0d716ea2faf0c8ab5f69d9b34..5523f19d88d2930bc97c3b44ad09ef9aa84a049d 100644 (file)
@@ -11,8 +11,6 @@
 #include <linux/hardirq.h>
 #include <linux/sched.h>
 #include <linux/irqflags.h>
-#include <linux/bottom_half.h>
-#include <linux/device.h>
 #include <asm/atomic.h>
 #include <asm/ptrace.h>
 #include <asm/system.h>
@@ -97,6 +95,8 @@ extern int __must_check request_irq(unsigned int, irq_handler_t handler,
                       unsigned long, const char *, void *);
 extern void free_irq(unsigned int, void *);
 
+struct device;
+
 extern int __must_check devm_request_irq(struct device *dev, unsigned int irq,
                            irq_handler_t handler, unsigned long irqflags,
                            const char *devname, void *dev_id);
index 97983dc9df131ada19207e54a0371d700912c41c..4ca60c3320fb6d89b0870c9a2d0cec2031847f73 100644 (file)
@@ -219,7 +219,6 @@ enum {
 #include <linux/tcp.h>
 #include <linux/udp.h>
 
-#include <net/if_inet6.h>       /* struct ipv6_mc_socklist */
 #include <net/inet_sock.h>
 
 static inline struct ipv6hdr *ipv6_hdr(const struct sk_buff *skb)
@@ -273,6 +272,10 @@ struct tcp6_request_sock {
        struct inet6_request_sock tcp6rsk_inet6;
 };
 
+struct ipv6_mc_socklist;
+struct ipv6_ac_socklist;
+struct ipv6_fl_socklist;
+
 /**
  * struct ipv6_pinfo - ipv6 private area
  *
index 44657197fcb03de46c060e7634c73f3e126038d7..efc88538b2bae91a854e9bf3fbffc4832c77d7e4 100644 (file)
@@ -140,6 +140,7 @@ struct irq_chip {
  * @wake_depth:                enable depth, for multiple set_irq_wake() callers
  * @irq_count:         stats field to detect stalled irqs
  * @irqs_unhandled:    stats field for spurious unhandled interrupts
+ * @last_unhandled:    aging timer for unhandled count
  * @lock:              locking for SMP
  * @affinity:          IRQ affinity on SMP
  * @cpu:               cpu index useful for balancing
index 5db38d6d8b92439f0525d6ba047455d4182bb2c1..ed815090b3bc2bc686612697dadbbdd2c4f85d0a 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <asm/kdebug.h>
 
+struct notifier_block;
+
 struct die_args {
        struct pt_regs *regs;
        const char *str;
index 4300bb462d29b8bac102ff2f6c898d22ed8b0386..f592df74b3cfb48637e3806e1e048a384582e53c 100644 (file)
@@ -224,9 +224,9 @@ extern void hex_dump_to_buffer(const void *buf, size_t len,
                                char *linebuf, size_t linebuflen, bool ascii);
 extern void print_hex_dump(const char *level, const char *prefix_str,
                                int prefix_type, int rowsize, int groupsize,
-                               void *buf, size_t len, bool ascii);
+                               const void *buf, size_t len, bool ascii);
 extern void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
-                       void *buf, size_t len);
+                       const void *buf, size_t len);
 #define hex_asc(x)     "0123456789abcdef"[x]
 
 #ifdef DEBUG
index aa2fe22b1baa64aa9e54c8b1bf4d5b3207956ac0..949706c33622dfca669418f4fa3e0551bc79c529 100644 (file)
@@ -56,6 +56,9 @@ enum kobject_action {
        KOBJ_MAX
 };
 
+/* The list of strings defining the valid kobject actions as specified above */
+extern const char *kobject_actions[];
+
 struct kobject {
        const char              * k_name;
        char                    name[KOBJ_NAME_LEN];
@@ -108,9 +111,15 @@ struct kobj_type {
        struct attribute        ** default_attrs;
 };
 
+struct kset_uevent_ops {
+       int (*filter)(struct kset *kset, struct kobject *kobj);
+       const char *(*name)(struct kset *kset, struct kobject *kobj);
+       int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,
+                       int num_envp, char *buffer, int buffer_size);
+};
 
-/**
- *     kset - a set of kobjects of a specific type, belonging
+/*
+ *     struct kset - a set of kobjects of a specific type, belonging
  *     to a specific subsystem.
  *
  *     All kobjects of a kset should be embedded in an identical 
@@ -126,13 +135,6 @@ struct kobj_type {
  *     supress the event generation or add subsystem specific
  *     variables carried with the event.
  */
-struct kset_uevent_ops {
-       int (*filter)(struct kset *kset, struct kobject *kobj);
-       const char *(*name)(struct kset *kset, struct kobject *kobj);
-       int (*uevent)(struct kset *kset, struct kobject *kobj, char **envp,
-                       int num_envp, char *buffer, int buffer_size);
-};
-
 struct kset {
        struct kobj_type        * ktype;
        struct list_head        list;
@@ -173,7 +175,7 @@ static inline struct kobj_type * get_ktype(struct kobject * k)
 extern struct kobject * kset_find_obj(struct kset *, const char *);
 
 
-/**
+/*
  * Use this when initializing an embedded kset with no other 
  * fields to initialize.
  */
@@ -198,7 +200,7 @@ extern struct kset kernel_subsys;
 /* The global /sys/hypervisor/ subsystem  */
 extern struct kset hypervisor_subsys;
 
-/**
+/*
  * Helpers for setting the kset of registered objects.
  * Often, a registered object belongs to a kset embedded in a 
  * subsystem. These do no magic, just make the resulting code
@@ -233,7 +235,7 @@ extern struct kset hypervisor_subsys;
 /**
  *     subsys_set_kset(obj,subsys) - set kset for subsystem
  *     @obj:           ptr to some object type.
- *     @subsys:        a subsystem object (not a ptr).
+ *     @_subsys:       a subsystem object (not a ptr).
  *
  *     Can be used for any object type with an embedded ->subsys.
  *     Sets the kset of @obj's kobject to @subsys.kset. This makes
index 500aace21ca7be6ad96e3455166c21fa4db94617..157ad64aa7ce8e020759db4498a7288d31345662 100644 (file)
@@ -17,7 +17,6 @@
 #define LHCALL_TS              8
 #define LHCALL_SET_CLOCKEVENT  9
 #define LHCALL_HALT            10
-#define LHCALL_GET_WALLCLOCK   11
 #define LHCALL_BIND_DMA                12
 #define LHCALL_SEND_DMA                13
 #define LHCALL_SET_PTE         14
 #define LG_CLOCK_MIN_DELTA     100UL
 #define LG_CLOCK_MAX_DELTA     ULONG_MAX
 
+/*G:031 First, how does our Guest contact the Host to ask for privileged
+ * operations?  There are two ways: the direct way is to make a "hypercall",
+ * to make requests of the Host Itself.
+ *
+ * Our hypercall mechanism uses the highest unused trap code (traps 32 and
+ * above are used by real hardware interrupts).  Seventeen hypercalls are
+ * available: the hypercall number is put in the %eax register, and the
+ * arguments (when required) are placed in %edx, %ebx and %ecx.  If a return
+ * value makes sense, it's returned in %eax.
+ *
+ * Grossly invalid calls result in Sudden Death at the hands of the vengeful
+ * Host, rather than returning failure.  This reflects Winston Churchill's
+ * definition of a gentleman: "someone who is only rude intentionally". */
 #define LGUEST_TRAP_ENTRY 0x1F
 
 static inline unsigned long
 hcall(unsigned long call,
       unsigned long arg1, unsigned long arg2, unsigned long arg3)
 {
+       /* "int" is the Intel instruction to trigger a trap. */
        asm volatile("int $" __stringify(LGUEST_TRAP_ENTRY)
+                      /* The call is in %eax (aka "a"), and can be replaced */
                     : "=a"(call)
+                      /* The other arguments are in %eax, %edx, %ebx & %ecx */
                     : "a"(call), "d"(arg1), "b"(arg2), "c"(arg3)
+                      /* "memory" means this might write somewhere in memory.
+                       * This isn't true for all calls, but it's safe to tell
+                       * gcc that it might happen so it doesn't get clever. */
                     : "memory");
        return call;
 }
+/*:*/
 
 void async_hcall(unsigned long call,
                 unsigned long arg1, unsigned long arg2, unsigned long arg3);
@@ -52,31 +71,43 @@ struct hcall_ring
        u32 eax, edx, ebx, ecx;
 };
 
-/* All the good stuff happens here: guest registers it with LGUEST_INIT */
+/*G:032 The second method of communicating with the Host is to via "struct
+ * lguest_data".  The Guest's very first hypercall is to tell the Host where
+ * this is, and then the Guest and Host both publish information in it. :*/
 struct lguest_data
 {
-/* Fields which change during running: */
-       /* 512 == enabled (same as eflags) */
+       /* 512 == enabled (same as eflags in normal hardware).  The Guest
+        * changes interrupts so often that a hypercall is too slow. */
        unsigned int irq_enabled;
-       /* Interrupts blocked by guest. */
+       /* Fine-grained interrupt disabling by the Guest */
        DECLARE_BITMAP(blocked_interrupts, LGUEST_IRQS);
 
-       /* Virtual address of page fault. */
+       /* The Host writes the virtual address of the last page fault here,
+        * which saves the Guest a hypercall.  CR2 is the native register where
+        * this address would normally be found. */
        unsigned long cr2;
 
-       /* Async hypercall ring.  0xFF == done, 0 == pending. */
+       /* Wallclock time set by the Host. */
+       struct timespec time;
+
+       /* Async hypercall ring.  Instead of directly making hypercalls, we can
+        * place them in here for processing the next time the Host wants.
+        * This batching can be quite efficient. */
+
+       /* 0xFF == done (set by Host), 0 == pending (set by Guest). */
        u8 hcall_status[LHCALL_RING_SIZE];
+       /* The actual registers for the hypercalls. */
        struct hcall_ring hcalls[LHCALL_RING_SIZE];
 
-/* Fields initialized by the hypervisor at boot: */
+/* Fields initialized by the Host at boot: */
        /* Memory not to try to access */
        unsigned long reserve_mem;
-       /* ID of this guest (used by network driver to set ethernet address) */
+       /* ID of this Guest (used by network driver to set ethernet address) */
        u16 guestid;
        /* KHz for the TSC clock. */
        u32 tsc_khz;
 
-/* Fields initialized by the guest at boot: */
+/* Fields initialized by the Guest at boot: */
        /* Instruction range to suppress interrupts even if enabled */
        unsigned long noirq_start, noirq_end;
 };
index c9b4e05fee49a9ebb95ac413cae6411c31edd4b2..d27853ddc644ca8c8e2ba0433a2a1baab98577c3 100644 (file)
@@ -15,11 +15,14 @@ struct lguest_device {
        void *private;
 };
 
-/* By convention, each device can use irq index+1 if it wants to. */
+/*D:380 Since interrupt numbers are arbitrary, we use a convention: each device
+ * can use the interrupt number corresponding to its index.  The +1 is because
+ * interrupt 0 is not usable (it's actually the timer interrupt). */
 static inline int lgdev_irq(const struct lguest_device *dev)
 {
        return dev->index + 1;
 }
+/*:*/
 
 /* dma args must not be vmalloced! */
 void lguest_send_dma(unsigned long key, struct lguest_dma *dma);
index 0ba414a40c8086962a9ad41226b599d1d918618d..6416705794466bea3c1a4e2091ca03e79d980bfa 100644 (file)
@@ -9,14 +9,45 @@
 /* How many devices?  Assume each one wants up to two dma arrays per device. */
 #define LGUEST_MAX_DEVICES (LGUEST_MAX_DMA/2)
 
+/*D:200
+ * Lguest I/O
+ *
+ * The lguest I/O mechanism is the only way Guests can talk to devices.  There
+ * are two hypercalls involved: SEND_DMA for output and BIND_DMA for input.  In
+ * each case, "struct lguest_dma" describes the buffer: this contains 16
+ * addr/len pairs, and if there are fewer buffer elements the len array is
+ * terminated with a 0.
+ *
+ * I/O is organized by keys: BIND_DMA attaches buffers to a particular key, and
+ * SEND_DMA transfers to buffers bound to particular key.  By convention, keys
+ * correspond to a physical address within the device's page.  This means that
+ * devices will never accidentally end up with the same keys, and allows the
+ * Host use The Futex Trick (as we'll see later in our journey).
+ *
+ * SEND_DMA simply indicates a key to send to, and the physical address of the
+ * "struct lguest_dma" to send.  The Host will write the number of bytes
+ * transferred into the "struct lguest_dma"'s used_len member.
+ *
+ * BIND_DMA indicates a key to bind to, a pointer to an array of "struct
+ * lguest_dma"s ready for receiving, the size of that array, and an interrupt
+ * to trigger when data is received.  The Host will only allow transfers into
+ * buffers with a used_len of zero: it then sets used_len to the number of
+ * bytes transferred and triggers the interrupt for the Guest to process the
+ * new input. */
 struct lguest_dma
 {
-       /* 0 if free to be used, filled by hypervisor. */
+       /* 0 if free to be used, filled by the Host. */
        u32 used_len;
        unsigned long addr[LGUEST_MAX_DMA_SECTIONS];
        u16 len[LGUEST_MAX_DMA_SECTIONS];
 };
+/*:*/
 
+/*D:460 This is the layout of a block device memory page.  The Launcher sets up
+ * the num_sectors initially to tell the Guest the size of the disk.  The Guest
+ * puts the type, sector and length of the request in the first three fields,
+ * then DMAs to the Host.  The Host processes the request, sets up the result,
+ * then DMAs back to the Guest. */
 struct lguest_block_page
 {
        /* 0 is a read, 1 is a write. */
@@ -28,27 +59,47 @@ struct lguest_block_page
        u32 num_sectors; /* Disk length = num_sectors * 512 */
 };
 
-/* There is a shared page of these. */
+/*D:520 The network device is basically a memory page where all the Guests on
+ * the network publish their MAC (ethernet) addresses: it's an array of "struct
+ * lguest_net": */
 struct lguest_net
 {
        /* Simply the mac address (with multicast bit meaning promisc). */
        unsigned char mac[6];
 };
+/*:*/
 
 /* Where the Host expects the Guest to SEND_DMA console output to. */
 #define LGUEST_CONSOLE_DMA_KEY 0
 
-/* We have a page of these descriptors in the lguest_device page. */
+/*D:010
+ * Drivers
+ *
+ * The Guest needs devices to do anything useful.  Since we don't let it touch
+ * real devices (think of the damage it could do!) we provide virtual devices.
+ * We could emulate a PCI bus with various devices on it, but that is a fairly
+ * complex burden for the Host and suboptimal for the Guest, so we have our own
+ * "lguest" bus and simple drivers.
+ *
+ * Devices are described by an array of LGUEST_MAX_DEVICES of these structs,
+ * placed by the Launcher just above the top of physical memory:
+ */
 struct lguest_device_desc {
+       /* The device type: console, network, disk etc. */
        u16 type;
 #define LGUEST_DEVICE_T_CONSOLE        1
 #define LGUEST_DEVICE_T_NET    2
 #define LGUEST_DEVICE_T_BLOCK  3
 
+       /* The specific features of this device: these depends on device type
+        * except for LGUEST_DEVICE_F_RANDOMNESS. */
        u16 features;
 #define LGUEST_NET_F_NOCSUM            0x4000 /* Don't bother checksumming */
 #define LGUEST_DEVICE_F_RANDOMNESS     0x8000 /* IRQ is fairly random */
 
+       /* This is how the Guest reports status of the device: the Host can set
+        * LGUEST_DEVICE_S_REMOVED to indicate removal, but the rest are only
+        * ever manipulated by the Guest, and only ever set. */
        u16 status;
 /* 256 and above are device specific. */
 #define LGUEST_DEVICE_S_ACKNOWLEDGE    1 /* We have seen device. */
@@ -58,9 +109,12 @@ struct lguest_device_desc {
 #define LGUEST_DEVICE_S_REMOVED_ACK    16 /* Driver has been told. */
 #define LGUEST_DEVICE_S_FAILED         128 /* Something actually failed */
 
+       /* Each device exists somewhere in Guest physical memory, over some
+        * number of pages. */
        u16 num_pages;
        u32 pfn;
 };
+/*:*/
 
 /* Write command first word is a request. */
 enum lguest_req
index c456c3a1c28e183461bf58ea1a73cb9f6ac2e0a4..655094dc9440fd5e8fdce2ab4f0380b83d72dd0e 100644 (file)
@@ -10,7 +10,6 @@
 #include <linux/mmzone.h>
 #include <linux/rbtree.h>
 #include <linux/prio_tree.h>
-#include <linux/fs.h>
 #include <linux/mutex.h>
 #include <linux/debug_locks.h>
 #include <linux/backing-dev.h>
@@ -18,7 +17,9 @@
 
 struct mempolicy;
 struct anon_vma;
+struct file_ra_state;
 struct user_struct;
+struct writeback_control;
 
 #ifndef CONFIG_DISCONTIGMEM          /* Don't use mapnrs, do it properly */
 extern unsigned long max_mapnr;
@@ -861,38 +862,7 @@ struct shrinker {
 extern void register_shrinker(struct shrinker *);
 extern void unregister_shrinker(struct shrinker *);
 
-/*
- * Some shared mappigns will want the pages marked read-only
- * to track write events. If so, we'll downgrade vm_page_prot
- * to the private version (using protection_map[] without the
- * VM_SHARED bit).
- */
-static inline int vma_wants_writenotify(struct vm_area_struct *vma)
-{
-       unsigned int vm_flags = vma->vm_flags;
-
-       /* If it was private or non-writable, the write bit is already clear */
-       if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
-               return 0;
-
-       /* The backer wishes to know when pages are first written to? */
-       if (vma->vm_ops && vma->vm_ops->page_mkwrite)
-               return 1;
-
-       /* The open routine did something to the protections already? */
-       if (pgprot_val(vma->vm_page_prot) !=
-           pgprot_val(protection_map[vm_flags &
-                   (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
-               return 0;
-
-       /* Specialty mapping? */
-       if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
-               return 0;
-
-       /* Can the mapping track the dirty pages? */
-       return vma->vm_file && vma->vm_file->f_mapping &&
-               mapping_cap_account_dirty(vma->vm_file->f_mapping);
-}
+int vma_wants_writenotify(struct vm_area_struct *vma);
 
 extern pte_t *FASTCALL(get_locked_pte(struct mm_struct *mm, unsigned long addr, spinlock_t **ptl));
 
@@ -1246,7 +1216,7 @@ void drop_slab(void);
 extern int randomize_va_space;
 #endif
 
-__attribute__((weak)) const char *arch_vma_name(struct vm_area_struct *vma);
+const char * arch_vma_name(struct vm_area_struct *vma);
 
 #endif /* __KERNEL__ */
 #endif /* _LINUX_MM_H */
index 04bbe12fae8db5ddf4ef4c673164a70f182e408b..63a80ea611248fe2551243548fe3ebdd883851de 100644 (file)
@@ -99,7 +99,7 @@ struct mmc_request {
 struct mmc_host;
 struct mmc_card;
 
-extern int mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
+extern void mmc_wait_for_req(struct mmc_host *, struct mmc_request *);
 extern int mmc_wait_for_cmd(struct mmc_host *, struct mmc_command *, int);
 extern int mmc_wait_for_app_cmd(struct mmc_host *, struct mmc_card *,
        struct mmc_command *, int);
index da8eb8ad9e9b0a6b8578c845765170c24ad24e8c..3ea68cd3b61f29a04b708c8c8f4043cccf6b2450 100644 (file)
@@ -120,7 +120,6 @@ enum zone_type {
         * ---------------------------
         * parisc, ia64, sparc  <4G
         * s390                 <2G
-        * arm26                <48M
         * arm                  Various
         * alpha                Unlimited or 0-16MB.
         *
index b021b3a2b65a6f847c846105e6547daa2f8877ff..9c8049005052ccb27343e8197e266e7dd8543157 100644 (file)
@@ -1302,4 +1302,12 @@ struct mv643xx_eth_platform_data {
        u8              mac_addr[6];    /* mac address if non-zero*/
 };
 
+/* Watchdog Platform Device, Driver Data */
+#define        MV64x60_WDT_NAME                        "mv64x60_wdt"
+
+struct mv64x60_wdt_pdata {
+       int     timeout;        /* watchdog expiry in seconds, default 10 */
+       int     bus_clk;        /* bus clock in MHz, default 133 */
+};
+
 #endif /* __ASM_MV643XX_H */
index 4a616d73cc259230ca43d542cd81ae60871599cd..e679b27516659699280c42b1e6e15839cfedb787 100644 (file)
@@ -1131,6 +1131,8 @@ extern void dev_seq_stop(struct seq_file *seq, void *v);
 
 extern void linkwatch_run_queue(void);
 
+extern int netdev_compute_features(unsigned long all, unsigned long one);
+
 static inline int net_gso_ok(int features, int gso_type)
 {
        int feature = gso_type << NETIF_F_GSO_SHIFT;
index 43397a414cd6a8b963b086ed89262715d201a9fb..ab57cb7d7c61067fd0bf4f7d0a74a6d348886d60 100644 (file)
@@ -28,6 +28,7 @@ header-y += xt_policy.h
 header-y += xt_realm.h
 header-y += xt_sctp.h
 header-y += xt_state.h
+header-y += xt_statistic.h
 header-y += xt_string.h
 header-y += xt_tcpmss.h
 header-y += xt_tcpudp.h
index 90ae8b474cb87cb9743069acf647b6fc81576662..37e933c9987d0ddf680cc58c3ffb00719d644c67 100644 (file)
@@ -5,8 +5,8 @@ struct xt_connlimit_data;
 
 struct xt_connlimit_info {
        union {
-               u_int32_t v4_mask;
-               u_int32_t v6_mask[4];
+               __be32 v4_mask;
+               __be32 v6_mask[4];
        };
        unsigned int limit, inverse;
 
index 9ba4aec37c5060a081e1bda1c670ac80463cbae8..157dcb055b5ca499bff63580e8f64921f2b85e67 100644 (file)
@@ -71,7 +71,7 @@ struct nfs_access_entry {
 
 struct nfs4_state;
 struct nfs_open_context {
-       struct kref kref;
+       atomic_t count;
        struct path path;
        struct rpc_cred *cred;
        struct nfs4_state *state;
index be3f2bb6fcf39a6b4b911bb71158d04ef246bdb6..fad7ff17e468ded82fc2e797bc42f6bb4a2f95fe 100644 (file)
@@ -157,6 +157,19 @@ extern int __srcu_notifier_call_chain(struct srcu_notifier_head *nh,
  */
 #define NOTIFY_STOP            (NOTIFY_OK|NOTIFY_STOP_MASK)
 
+/* Encapsulate (negative) errno value (in particular, NOTIFY_BAD <=> EPERM). */
+static inline int notifier_from_errno(int err)
+{
+       return NOTIFY_STOP_MASK | (NOTIFY_OK - err);
+}
+
+/* Restore (negative) errno value from notify return value. */
+static inline int notifier_to_errno(int ret)
+{
+       ret &= ~NOTIFY_STOP_MASK;
+       return ret > NOTIFY_OK ? NOTIFY_OK - ret : 0;
+}
+
 /*
  *     Declared notifiers so far. I can imagine quite a few more chains
  *     over time (eg laptop power reset chains, reboot chain (to clean 
index d8f8a3a9664493dc4c22a79d308b3339a37bcc9c..e7d8d4e19a533d3c9056d83aeb3902810a081160 100644 (file)
@@ -534,7 +534,7 @@ static inline int pci_write_config_dword(struct pci_dev *dev, int where, u32 val
 
 int __must_check pci_enable_device(struct pci_dev *dev);
 int __must_check pci_enable_device_bars(struct pci_dev *dev, int mask);
-int __must_check __pci_reenable_device(struct pci_dev *);
+int __must_check pci_reenable_device(struct pci_dev *);
 int __must_check pcim_enable_device(struct pci_dev *pdev);
 void pcim_pin_device(struct pci_dev *pdev);
 
index dc41ad4203b8a3a2a03d7f72d51cdf549ca3805f..07fc57429b58363367ec869a57db397daa0689c8 100644 (file)
 #define PCI_DEVICE_ID_NEC_CBUS_3       0x003b
 #define PCI_DEVICE_ID_NEC_NAPCCARD     0x003e
 #define PCI_DEVICE_ID_NEC_PCX2         0x0046 /* PowerVR */
-#define PCI_DEVICE_ID_NEC_NILE4                0x005a
 #define PCI_DEVICE_ID_NEC_VRC5476       0x009b
 #define PCI_DEVICE_ID_NEC_VRC4173      0x00a5
 #define PCI_DEVICE_ID_NEC_VRC5477_AC97  0x00a6
 #define PCI_VENDOR_ID_ENE              0x1524
 #define PCI_DEVICE_ID_ENE_CB712_SD     0x0550
 #define PCI_DEVICE_ID_ENE_CB712_SD_2   0x0551
+#define PCI_DEVICE_ID_ENE_CB714_SD     0x0750
+#define PCI_DEVICE_ID_ENE_CB714_SD_2   0x0751
 #define PCI_DEVICE_ID_ENE_1211         0x1211
 #define PCI_DEVICE_ID_ENE_1225         0x1225
 #define PCI_DEVICE_ID_ENE_1410         0x1410
index ad3cc2eb0d34d4a4bb1be8f5f68240892142d16b..48b71badfb4c837969fedf91f90cba2cce369587 100644 (file)
@@ -25,6 +25,7 @@
 
 #include <linux/list.h>
 #include <asm/atomic.h>
+#include <asm/errno.h>
 
 /*
  * Power management requests... these are passed to pm_send_all() and friends.
@@ -165,6 +166,7 @@ struct pm_ops {
        int (*finish)(suspend_state_t state);
 };
 
+#ifdef CONFIG_SUSPEND
 extern struct pm_ops *pm_ops;
 
 /**
@@ -193,6 +195,12 @@ extern void arch_suspend_disable_irqs(void);
 extern void arch_suspend_enable_irqs(void);
 
 extern int pm_suspend(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+#define suspend_valid_only_mem NULL
+
+static inline void pm_set_ops(struct pm_ops *pm_ops) {}
+static inline int pm_suspend(suspend_state_t state) { return -ENOSYS; }
+#endif /* !CONFIG_SUSPEND */
 
 /*
  * Device power management
@@ -266,7 +274,7 @@ typedef struct pm_message {
 struct dev_pm_info {
        pm_message_t            power_state;
        unsigned                can_wakeup:1;
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
        unsigned                should_wakeup:1;
        struct list_head        entry;
 #endif
@@ -276,7 +284,7 @@ extern int device_power_down(pm_message_t state);
 extern void device_power_up(void);
 extern void device_resume(void);
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 extern int device_suspend(pm_message_t state);
 extern int device_prepare_suspend(pm_message_t state);
 
@@ -306,7 +314,7 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
        return 0;
 }
 
-#else /* !CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int device_suspend(pm_message_t state)
 {
@@ -323,7 +331,7 @@ static inline int call_platform_enable_wakeup(struct device *dev, int is_on)
        return 0;
 }
 
-#endif
+#endif /* !CONFIG_PM_SLEEP */
 
 /* changes to device_may_wakeup take effect on the next pm state change.
  * by default, devices should wakeup if they can.
index 66edb2293184d05cf5c8b800b81d336f9cfe38c3..16b46aace3490413107532583ebeeb3ca85d7084 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * Linux Plug and Play Support
  * Copyright by Adam Belay <ambx1@neo.rr.com>
- *
  */
 
 #ifndef _LINUX_PNP_H
@@ -23,7 +22,6 @@
 struct pnp_protocol;
 struct pnp_dev;
 
-
 /*
  * Resource Management
  */
@@ -73,37 +71,37 @@ struct pnp_dev;
 #define PNP_PORT_FLAG_FIXED    (1<<1)
 
 struct pnp_port {
-       unsigned short min;             /* min base number */
-       unsigned short max;             /* max base number */
-       unsigned char align;            /* align boundary */
-       unsigned char size;             /* size of range */
-       unsigned char flags;            /* port flags */
-       unsigned char pad;              /* pad */
-       struct pnp_port *next;          /* next port */
+       unsigned short min;     /* min base number */
+       unsigned short max;     /* max base number */
+       unsigned char align;    /* align boundary */
+       unsigned char size;     /* size of range */
+       unsigned char flags;    /* port flags */
+       unsigned char pad;      /* pad */
+       struct pnp_port *next;  /* next port */
 };
 
 #define PNP_IRQ_NR 256
 struct pnp_irq {
-       DECLARE_BITMAP(map, PNP_IRQ_NR); /* bitmaks for IRQ lines */
-       unsigned char flags;            /* IRQ flags */
-       unsigned char pad;              /* pad */
-       struct pnp_irq *next;           /* next IRQ */
+       DECLARE_BITMAP(map, PNP_IRQ_NR);        /* bitmask for IRQ lines */
+       unsigned char flags;    /* IRQ flags */
+       unsigned char pad;      /* pad */
+       struct pnp_irq *next;   /* next IRQ */
 };
 
 struct pnp_dma {
-       unsigned char map;              /* bitmask for DMA channels */
-       unsigned char flags;            /* DMA flags */
-       struct pnp_dma *next;           /* next port */
+       unsigned char map;      /* bitmask for DMA channels */
+       unsigned char flags;    /* DMA flags */
+       struct pnp_dma *next;   /* next port */
 };
 
 struct pnp_mem {
-       unsigned int min;               /* min base number */
-       unsigned int max;               /* max base number */
-       unsigned int align;             /* align boundary */
-       unsigned int size;              /* size of range */
-       unsigned char flags;            /* memory flags */
-       unsigned char pad;              /* pad */
-       struct pnp_mem *next;           /* next memory resource */
+       unsigned int min;       /* min base number */
+       unsigned int max;       /* max base number */
+       unsigned int align;     /* align boundary */
+       unsigned int size;      /* size of range */
+       unsigned char flags;    /* memory flags */
+       unsigned char pad;      /* pad */
+       struct pnp_mem *next;   /* next memory resource */
 };
 
 #define PNP_RES_PRIORITY_PREFERRED     0
@@ -127,7 +125,6 @@ struct pnp_resource_table {
        struct resource irq_resource[PNP_MAX_IRQ];
 };
 
-
 /*
  * Device Managemnt
  */
@@ -139,14 +136,14 @@ struct pnp_card {
        struct list_head protocol_list; /* node in protocol's list of cards */
        struct list_head devices;       /* devices attached to the card */
 
-       struct pnp_protocol * protocol;
-       struct pnp_id * id;             /* contains supported EISA IDs*/
+       struct pnp_protocol *protocol;
+       struct pnp_id *id;              /* contains supported EISA IDs */
 
        char name[PNP_NAME_LEN];        /* contains a human-readable name */
-       unsigned char   pnpver;         /* Plug & Play version */
-       unsigned char   productver;     /* product version */
-       unsigned int    serial;         /* serial number */
-       unsigned char   checksum;       /* if zero - checksum passed */
+       unsigned char pnpver;           /* Plug & Play version */
+       unsigned char productver;       /* product version */
+       unsigned int serial;            /* serial number */
+       unsigned char checksum;         /* if zero - checksum passed */
        struct proc_dir_entry *procdir; /* directory entry in /proc/bus/isapnp */
 };
 
@@ -159,18 +156,18 @@ struct pnp_card {
        (card) = global_to_pnp_card((card)->global_list.next))
 
 struct pnp_card_link {
-       struct pnp_card * card;
-       struct pnp_card_driver * driver;
-       void * driver_data;
+       struct pnp_card *card;
+       struct pnp_card_driver *driver;
+       void *driver_data;
        pm_message_t pm_state;
 };
 
-static inline void *pnp_get_card_drvdata (struct pnp_card_link *pcard)
+static inline void *pnp_get_card_drvdata(struct pnp_card_link *pcard)
 {
        return pcard->driver_data;
 }
 
-static inline void pnp_set_card_drvdata (struct pnp_card_link *pcard, void *data)
+static inline void pnp_set_card_drvdata(struct pnp_card_link *pcard, void *data)
 {
        pcard->driver_data = data;
 }
@@ -186,22 +183,22 @@ struct pnp_dev {
        struct list_head card_list;     /* node in card's list of devices */
        struct list_head rdev_list;     /* node in cards list of requested devices */
 
-       struct pnp_protocol * protocol;
-       struct pnp_card * card;         /* card the device is attached to, none if NULL */
-       struct pnp_driver * driver;
-       struct pnp_card_link * card_link;
+       struct pnp_protocol *protocol;
+       struct pnp_card *card;  /* card the device is attached to, none if NULL */
+       struct pnp_driver *driver;
+       struct pnp_card_link *card_link;
 
-       struct pnp_id   * id;   /* supported EISA IDs*/
+       struct pnp_id *id;              /* supported EISA IDs */
 
        int active;
        int capabilities;
-       struct pnp_option * independent;
-       struct pnp_option * dependent;
+       struct pnp_option *independent;
+       struct pnp_option *dependent;
        struct pnp_resource_table res;
 
        char name[PNP_NAME_LEN];        /* contains a human-readable name */
-       unsigned short  regs;           /* ISAPnP: supported registers */
-       int             flags;          /* used by protocols */
+       unsigned short regs;            /* ISAPnP: supported registers */
+       int flags;                      /* used by protocols */
        struct proc_dir_entry *procent; /* device entry in /proc/bus/isapnp */
        void *data;
 };
@@ -220,19 +217,19 @@ struct pnp_dev {
        (dev) = card_to_pnp_dev((dev)->card_list.next))
 #define pnp_dev_name(dev) (dev)->name
 
-static inline void *pnp_get_drvdata (struct pnp_dev *pdev)
+static inline void *pnp_get_drvdata(struct pnp_dev *pdev)
 {
        return dev_get_drvdata(&pdev->dev);
 }
 
-static inline void pnp_set_drvdata (struct pnp_dev *pdev, void *data)
+static inline void pnp_set_drvdata(struct pnp_dev *pdev, void *data)
 {
        dev_set_drvdata(&pdev->dev, data);
 }
 
 struct pnp_fixup {
        char id[7];
-       void (*quirk_function)(struct pnp_dev *dev);    /* fixup function */
+       void (*quirk_function) (struct pnp_dev * dev);  /* fixup function */
 };
 
 /* config parameters */
@@ -269,7 +266,6 @@ extern struct pnp_protocol pnpbios_protocol;
 #define pnp_device_is_pnpbios(dev) 0
 #endif
 
-
 /* status */
 #define PNP_READY              0x0000
 #define PNP_ATTACHED           0x0001
@@ -287,17 +283,17 @@ extern struct pnp_protocol pnpbios_protocol;
 
 struct pnp_id {
        char id[PNP_ID_LEN];
-       struct pnp_id * next;
+       struct pnp_id *next;
 };
 
 struct pnp_driver {
-       char * name;
+       char *name;
        const struct pnp_device_id *id_table;
        unsigned int flags;
-       int  (*probe)  (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
+       int (*probe) (struct pnp_dev *dev, const struct pnp_device_id *dev_id);
        void (*remove) (struct pnp_dev *dev);
-       int  (*suspend) (struct pnp_dev *dev, pm_message_t state);
-       int  (*resume) (struct pnp_dev *dev);
+       int (*suspend) (struct pnp_dev *dev, pm_message_t state);
+       int (*resume) (struct pnp_dev *dev);
        struct device_driver driver;
 };
 
@@ -305,13 +301,14 @@ struct pnp_driver {
 
 struct pnp_card_driver {
        struct list_head global_list;
-       char * name;
+       char *name;
        const struct pnp_card_device_id *id_table;
        unsigned int flags;
-       int  (*probe)  (struct pnp_card_link *card, const struct pnp_card_device_id *card_id);
+       int (*probe) (struct pnp_card_link *card,
+                     const struct pnp_card_device_id *card_id);
        void (*remove) (struct pnp_card_link *card);
-       int  (*suspend) (struct pnp_card_link *card, pm_message_t state);
-       int  (*resume) (struct pnp_card_link *card);
+       int (*suspend) (struct pnp_card_link *card, pm_message_t state);
+       int (*resume) (struct pnp_card_link *card);
        struct pnp_driver link;
 };
 
@@ -321,29 +318,28 @@ struct pnp_card_driver {
 #define PNP_DRIVER_RES_DO_NOT_CHANGE   0x0001  /* do not change the state of the device */
 #define PNP_DRIVER_RES_DISABLE         0x0003  /* ensure the device is disabled */
 
-
 /*
  * Protocol Management
  */
 
 struct pnp_protocol {
-       struct list_head        protocol_list;
-       char                  * name;
+       struct list_head protocol_list;
+       char *name;
 
        /* resource control functions */
-       int (*get)(struct pnp_dev *dev, struct pnp_resource_table *res);
-       int (*set)(struct pnp_dev *dev, struct pnp_resource_table *res);
-       int (*disable)(struct pnp_dev *dev);
+       int (*get) (struct pnp_dev *dev, struct pnp_resource_table *res);
+       int (*set) (struct pnp_dev *dev, struct pnp_resource_table *res);
+       int (*disable) (struct pnp_dev *dev);
 
        /* protocol specific suspend/resume */
-       int (*suspend)(struct pnp_dev *dev, pm_message_t state);
-       int (*resume)(struct pnp_dev *dev);
+       int (*suspend) (struct pnp_dev * dev, pm_message_t state);
+       int (*resume) (struct pnp_dev * dev);
 
        /* used by pnp layer only (look but don't touch) */
-       unsigned char           number;         /* protocol number*/
-       struct device           dev;            /* link to driver model */
-       struct list_head        cards;
-       struct list_head        devices;
+       unsigned char number;   /* protocol number */
+       struct device dev;      /* link to driver model */
+       struct list_head cards;
+       struct list_head devices;
 };
 
 #define to_pnp_protocol(n) list_entry(n, struct pnp_protocol, protocol_list)
@@ -356,7 +352,6 @@ struct pnp_protocol {
        (dev) != protocol_to_pnp_dev(&(protocol)->devices); \
        (dev) = protocol_to_pnp_dev((dev)->protocol_list.next))
 
-
 extern struct bus_type pnp_bus_type;
 
 #if defined(CONFIG_PNP)
@@ -376,21 +371,25 @@ void pnp_remove_card(struct pnp_card *card);
 int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev);
 void pnp_remove_card_device(struct pnp_dev *dev);
 int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card);
-struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from);
-void pnp_release_card_device(struct pnp_dev * dev);
-int pnp_register_card_driver(struct pnp_card_driver * drv);
-void pnp_unregister_card_driver(struct pnp_card_driver * drv);
+struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
+                                       const char *id, struct pnp_dev *from);
+void pnp_release_card_device(struct pnp_dev *dev);
+int pnp_register_card_driver(struct pnp_card_driver *drv);
+void pnp_unregister_card_driver(struct pnp_card_driver *drv);
 extern struct list_head pnp_cards;
 
 /* resource management */
-struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev);
-struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority);
+struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev);
+struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
+                                                int priority);
 int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data);
 int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data);
-int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data);
+int pnp_register_port_resource(struct pnp_option *option,
+                              struct pnp_port *data);
 int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data);
 void pnp_init_resource_table(struct pnp_resource_table *table);
-int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res, int mode);
+int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
+                         int mode);
 int pnp_auto_config_dev(struct pnp_dev *dev);
 int pnp_validate_config(struct pnp_dev *dev);
 int pnp_start_dev(struct pnp_dev *dev);
@@ -398,11 +397,11 @@ int pnp_stop_dev(struct pnp_dev *dev);
 int pnp_activate_dev(struct pnp_dev *dev);
 int pnp_disable_dev(struct pnp_dev *dev);
 void pnp_resource_change(struct resource *resource, resource_size_t start,
-                               resource_size_t size);
+                        resource_size_t size);
 
 /* protocol helpers */
-int pnp_is_active(struct pnp_dev * dev);
-int compare_pnp_id(struct pnp_id * pos, const char * id);
+int pnp_is_active(struct pnp_dev *dev);
+int compare_pnp_id(struct pnp_id *pos, const char *id);
 int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev);
 int pnp_register_driver(struct pnp_driver *drv);
 void pnp_unregister_driver(struct pnp_driver *drv);
@@ -415,23 +414,24 @@ static inline void pnp_unregister_protocol(struct pnp_protocol *protocol) { }
 static inline int pnp_init_device(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_add_device(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_device_attach(struct pnp_dev *pnp_dev) { return -ENODEV; }
-static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { ; }
+static inline void pnp_device_detach(struct pnp_dev *pnp_dev) { }
+
 #define pnp_platform_devices 0
 
 /* multidevice card support */
 static inline int pnp_add_card(struct pnp_card *card) { return -ENODEV; }
-static inline void pnp_remove_card(struct pnp_card *card) { }
+static inline void pnp_remove_card(struct pnp_card *card) { }
 static inline int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) { return -ENODEV; }
-static inline void pnp_remove_card_device(struct pnp_dev *dev) { }
+static inline void pnp_remove_card_device(struct pnp_dev *dev) { }
 static inline int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) { return -ENODEV; }
-static inline struct pnp_dev * pnp_request_card_device(struct pnp_card_link *clink, const char * id, struct pnp_dev * from) { return NULL; }
-static inline void pnp_release_card_device(struct pnp_dev * dev) { ; }
-static inline int pnp_register_card_driver(struct pnp_card_driver * drv) { return -ENODEV; }
-static inline void pnp_unregister_card_driver(struct pnp_card_driver * drv) { ; }
+static inline struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, const char *id, struct pnp_dev *from) { return NULL; }
+static inline void pnp_release_card_device(struct pnp_dev *dev) { }
+static inline int pnp_register_card_driver(struct pnp_card_driver *drv) { return -ENODEV; }
+static inline void pnp_unregister_card_driver(struct pnp_card_driver *drv) { }
 
 /* resource management */
-static inline struct pnp_option * pnp_register_independent_option(struct pnp_dev *dev) { return NULL; }
-static inline struct pnp_option * pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; }
+static inline struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) { return NULL; }
+static inline struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev, int priority) { return NULL; }
 static inline int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data) { return -ENODEV; }
 static inline int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data) { return -ENODEV; }
 static inline int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data) { return -ENODEV; }
@@ -444,20 +444,17 @@ static inline int pnp_start_dev(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_stop_dev(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_activate_dev(struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_disable_dev(struct pnp_dev *dev) { return -ENODEV; }
-static inline void pnp_resource_change(struct resource *resource,
-                                       resource_size_t start,
-                                       resource_size_t size) { }
+static inline void pnp_resource_change(struct resource *resource, resource_size_t start, resource_size_t size) { }
 
 /* protocol helpers */
-static inline int pnp_is_active(struct pnp_dev * dev) { return 0; }
-static inline int compare_pnp_id(struct pnp_id * pos, const char * id) { return -ENODEV; }
+static inline int pnp_is_active(struct pnp_dev *dev) { return 0; }
+static inline int compare_pnp_id(struct pnp_id *pos, const char *id) { return -ENODEV; }
 static inline int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev) { return -ENODEV; }
 static inline int pnp_register_driver(struct pnp_driver *drv) { return -ENODEV; }
-static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
+static inline void pnp_unregister_driver(struct pnp_driver *drv) { }
 
 #endif /* CONFIG_PNP */
 
-
 #define pnp_err(format, arg...) printk(KERN_ERR "pnp: " format "\n" , ## arg)
 #define pnp_info(format, arg...) printk(KERN_INFO "pnp: " format "\n" , ## arg)
 #define pnp_warn(format, arg...) printk(KERN_WARNING "pnp: " format "\n" , ## arg)
index 0a282ac1f6b22176fd78644689318ce0e5e0ffad..329192adc9dd949d27dee6105c27b2956fd139b1 100644 (file)
 
 #pragma pack(1)
 struct pnp_dev_node_info {
-       __u16   no_nodes;
-       __u16   max_node_size;
+       __u16 no_nodes;
+       __u16 max_node_size;
 };
 struct pnp_docking_station_info {
-       __u32   location_id;
-       __u32   serial;
-       __u16   capabilities;
+       __u32 location_id;
+       __u32 serial;
+       __u16 capabilities;
 };
 struct pnp_isa_config_struc {
-       __u8    revision;
-       __u8    no_csns;
-       __u16   isa_rd_data_port;
-       __u16   reserved;
+       __u8 revision;
+       __u8 no_csns;
+       __u16 isa_rd_data_port;
+       __u16 reserved;
 };
 struct escd_info_struc {
-       __u16   min_escd_write_size;
-       __u16   escd_size;
-       __u32   nv_storage_base;
+       __u16 min_escd_write_size;
+       __u16 escd_size;
+       __u32 nv_storage_base;
 };
 struct pnp_bios_node {
-       __u16   size;
-       __u8    handle;
-       __u32   eisa_id;
-       __u8    type_code[3];
-       __u16   flags;
-       __u8    data[0];
+       __u16 size;
+       __u8 handle;
+       __u32 eisa_id;
+       __u8 type_code[3];
+       __u16 flags;
+       __u8 data[0];
 };
 #pragma pack()
 
@@ -133,22 +133,16 @@ struct pnp_bios_node {
 /* non-exported */
 extern struct pnp_dev_node_info node_info;
 
-extern int pnp_bios_dev_node_info (struct pnp_dev_node_info *data);
-extern int pnp_bios_get_dev_node (u8 *nodenum, char config, struct pnp_bios_node *data);
-extern int pnp_bios_set_dev_node (u8 nodenum, char config, struct pnp_bios_node *data);
-extern int pnp_bios_get_stat_res (char *info);
-extern int pnp_bios_isapnp_config (struct pnp_isa_config_struc *data);
-extern int pnp_bios_escd_info (struct escd_info_struc *data);
-extern int pnp_bios_read_escd (char *data, u32 nvram_base);
+extern int pnp_bios_dev_node_info(struct pnp_dev_node_info *data);
+extern int pnp_bios_get_dev_node(u8 *nodenum, char config,
+                                struct pnp_bios_node *data);
+extern int pnp_bios_set_dev_node(u8 nodenum, char config,
+                                struct pnp_bios_node *data);
+extern int pnp_bios_get_stat_res(char *info);
+extern int pnp_bios_isapnp_config(struct pnp_isa_config_struc *data);
+extern int pnp_bios_escd_info(struct escd_info_struc *data);
+extern int pnp_bios_read_escd(char *data, u32 nvram_base);
 extern int pnp_bios_dock_station_info(struct pnp_docking_station_info *data);
-#define needed 0
-#if needed
-extern int pnp_bios_get_event (u16 *message);
-extern int pnp_bios_send_message (u16 message);
-extern int pnp_bios_set_stat_res (char *info);
-extern int pnp_bios_apm_id_table (char *table, u16 *size);
-extern int pnp_bios_write_escd (char *data, u32 nvram_base);
-#endif
 
 #endif /* CONFIG_PNPBIOS */
 
index d0926d63406ca8e76a3d89ddc3f307a43ef6f391..484988ed301e3fc03741950dc67949148bdb16d8 100644 (file)
@@ -8,6 +8,7 @@
 
 #include <linux/thread_info.h>
 #include <linux/linkage.h>
+#include <linux/list.h>
 
 #ifdef CONFIG_DEBUG_PREEMPT
   extern void fastcall add_preempt_count(int val);
@@ -60,4 +61,47 @@ do { \
 
 #endif
 
+#ifdef CONFIG_PREEMPT_NOTIFIERS
+
+struct preempt_notifier;
+
+/**
+ * preempt_ops - notifiers called when a task is preempted and rescheduled
+ * @sched_in: we're about to be rescheduled:
+ *    notifier: struct preempt_notifier for the task being scheduled
+ *    cpu:  cpu we're scheduled on
+ * @sched_out: we've just been preempted
+ *    notifier: struct preempt_notifier for the task being preempted
+ *    next: the task that's kicking us out
+ */
+struct preempt_ops {
+       void (*sched_in)(struct preempt_notifier *notifier, int cpu);
+       void (*sched_out)(struct preempt_notifier *notifier,
+                         struct task_struct *next);
+};
+
+/**
+ * preempt_notifier - key for installing preemption notifiers
+ * @link: internal use
+ * @ops: defines the notifier functions to be called
+ *
+ * Usually used in conjunction with container_of().
+ */
+struct preempt_notifier {
+       struct hlist_node link;
+       struct preempt_ops *ops;
+};
+
+void preempt_notifier_register(struct preempt_notifier *notifier);
+void preempt_notifier_unregister(struct preempt_notifier *notifier);
+
+static inline void preempt_notifier_init(struct preempt_notifier *notifier,
+                                    struct preempt_ops *ops)
+{
+       INIT_HLIST_NODE(&notifier->link);
+       notifier->ops = ops;
+}
+
+#endif
+
 #endif /* __LINUX_PREEMPT_H */
index 28e3664fdf1b860155157b3e1317b83a0203864f..cd13a78c5db84584c59c130899604c2dfeb40d73 100644 (file)
@@ -75,7 +75,6 @@ struct proc_dir_entry {
        write_proc_t *write_proc;
        atomic_t count;         /* use count */
        int deleted;            /* delete flag */
-       void *set;
        int pde_users;  /* number of callers into module in progress */
        spinlock_t pde_unload_lock; /* proc_fops checks and pde_users bumps */
        struct completion *pde_unload_completion;
index c6b7485eac7ce1e59c7f01cf71221e6637f524ce..fe17d7d750c2be05f545d51e5254f928d613ccca 100644 (file)
@@ -281,7 +281,6 @@ extern void FASTCALL(call_rcu(struct rcu_head *head,
 extern void FASTCALL(call_rcu_bh(struct rcu_head *head,
                                void (*func)(struct rcu_head *head)));
 extern void synchronize_rcu(void);
-void synchronize_idle(void);
 extern void rcu_barrier(void);
 
 #endif /* __KERNEL__ */
index 965d5b3ea9eb3deaf583c4d986d45a9e3b70bc8c..180a9d832dde000f966cee08666235b58690f168 100644 (file)
@@ -81,14 +81,16 @@ void reiserfs_warning(struct super_block *s, const char *fmt, ...);
 /* assertions handling */
 
 /** always check a condition and panic if it's false. */
-#define RASSERT( cond, format, args... )                                       \
+#define __RASSERT( cond, scond, format, args... )                                      \
 if( !( cond ) )                                                                \
-  reiserfs_panic( NULL, "reiserfs[%i]: assertion " #cond " failed at " \
+  reiserfs_panic( NULL, "reiserfs[%i]: assertion " scond " failed at " \
                  __FILE__ ":%i:%s: " format "\n",              \
                  in_interrupt() ? -1 : current -> pid, __LINE__ , __FUNCTION__ , ##args )
 
+#define RASSERT(cond, format, args...) __RASSERT(cond, #cond, format, ##args)
+
 #if defined( CONFIG_REISERFS_CHECK )
-#define RFALSE( cond, format, args... ) RASSERT( !( cond ), format, ##args )
+#define RFALSE(cond, format, args...) __RASSERT(!(cond), "!(" #cond ")", format, ##args)
 #else
 #define RFALSE( cond, format, args... ) do {;} while( 0 )
 #endif
index 33b9b4841ee743ff6ad9239d66d23f80a3c76b3c..682ef87da6eb953348986927598eeaf8b2264ec4 100644 (file)
@@ -139,7 +139,7 @@ struct cfs_rq;
 extern void proc_sched_show_task(struct task_struct *p, struct seq_file *m);
 extern void proc_sched_set_task(struct task_struct *p);
 extern void
-print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now);
+print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq);
 #else
 static inline void
 proc_sched_show_task(struct task_struct *p, struct seq_file *m)
@@ -149,7 +149,7 @@ static inline void proc_sched_set_task(struct task_struct *p)
 {
 }
 static inline void
-print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now)
+print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 {
 }
 #endif
@@ -681,7 +681,7 @@ enum cpu_idle_type {
 #define SCHED_LOAD_SHIFT       10
 #define SCHED_LOAD_SCALE       (1L << SCHED_LOAD_SHIFT)
 
-#define SCHED_LOAD_SCALE_FUZZ  (SCHED_LOAD_SCALE >> 5)
+#define SCHED_LOAD_SCALE_FUZZ  (SCHED_LOAD_SCALE >> 1)
 
 #ifdef CONFIG_SMP
 #define SD_LOAD_BALANCE                1       /* Do load balancing on this domain. */
@@ -734,7 +734,6 @@ struct sched_domain {
        unsigned long max_interval;     /* Maximum balance interval ms */
        unsigned int busy_factor;       /* less balancing by factor if busy */
        unsigned int imbalance_pct;     /* No balance until over watermark */
-       unsigned long long cache_hot_time; /* Task considered cache hot (ns) */
        unsigned int cache_nice_tries;  /* Leave cache hot tasks for # tries */
        unsigned int busy_idx;
        unsigned int idle_idx;
@@ -786,6 +785,22 @@ extern int partition_sched_domains(cpumask_t *partition1,
 
 #endif /* CONFIG_SMP */
 
+/*
+ * A runqueue laden with a single nice 0 task scores a weighted_cpuload of
+ * SCHED_LOAD_SCALE. This function returns 1 if any cpu is laden with a
+ * task of nice 0 or enough lower priority tasks to bring up the
+ * weighted_cpuload
+ */
+static inline int above_background_load(void)
+{
+       unsigned long cpu;
+
+       for_each_online_cpu(cpu) {
+               if (weighted_cpuload(cpu) >= SCHED_LOAD_SCALE)
+                       return 1;
+       }
+       return 0;
+}
 
 struct io_context;                     /* See blkdev.h */
 struct cpuset;
@@ -840,22 +855,20 @@ struct sched_domain;
 struct sched_class {
        struct sched_class *next;
 
-       void (*enqueue_task) (struct rq *rq, struct task_struct *p,
-                             int wakeup, u64 now);
-       void (*dequeue_task) (struct rq *rq, struct task_struct *p,
-                             int sleep, u64 now);
+       void (*enqueue_task) (struct rq *rq, struct task_struct *p, int wakeup);
+       void (*dequeue_task) (struct rq *rq, struct task_struct *p, int sleep);
        void (*yield_task) (struct rq *rq, struct task_struct *p);
 
        void (*check_preempt_curr) (struct rq *rq, struct task_struct *p);
 
-       struct task_struct * (*pick_next_task) (struct rq *rq, u64 now);
-       void (*put_prev_task) (struct rq *rq, struct task_struct *p, u64 now);
+       struct task_struct * (*pick_next_task) (struct rq *rq);
+       void (*put_prev_task) (struct rq *rq, struct task_struct *p);
 
-       int (*load_balance) (struct rq *this_rq, int this_cpu,
+       unsigned long (*load_balance) (struct rq *this_rq, int this_cpu,
                        struct rq *busiest,
                        unsigned long max_nr_move, unsigned long max_load_move,
                        struct sched_domain *sd, enum cpu_idle_type idle,
-                       int *all_pinned, unsigned long *total_load_moved);
+                       int *all_pinned, int *this_best_prio);
 
        void (*set_curr_task) (struct rq *rq);
        void (*task_tick) (struct rq *rq, struct task_struct *p);
@@ -889,23 +902,28 @@ struct sched_entity {
        struct rb_node          run_node;
        unsigned int            on_rq;
 
+       u64                     exec_start;
+       u64                     sum_exec_runtime;
        u64                     wait_start_fair;
+       u64                     sleep_start_fair;
+
+#ifdef CONFIG_SCHEDSTATS
        u64                     wait_start;
-       u64                     exec_start;
+       u64                     wait_max;
+       s64                     sum_wait_runtime;
+
        u64                     sleep_start;
-       u64                     sleep_start_fair;
-       u64                     block_start;
        u64                     sleep_max;
+       s64                     sum_sleep_runtime;
+
+       u64                     block_start;
        u64                     block_max;
        u64                     exec_max;
-       u64                     wait_max;
-       u64                     last_ran;
 
-       u64                     sum_exec_runtime;
-       s64                     sum_wait_runtime;
-       s64                     sum_sleep_runtime;
        unsigned long           wait_runtime_overruns;
        unsigned long           wait_runtime_underruns;
+#endif
+
 #ifdef CONFIG_FAIR_GROUP_SCHED
        struct sched_entity     *parent;
        /* rq on which this entity is (to be) queued: */
@@ -935,6 +953,11 @@ struct task_struct {
        struct sched_class *sched_class;
        struct sched_entity se;
 
+#ifdef CONFIG_PREEMPT_NOTIFIERS
+       /* list of struct preempt_notifier: */
+       struct hlist_head preempt_notifiers;
+#endif
+
        unsigned short ioprio;
 #ifdef CONFIG_BLK_DEV_IO_TRACE
        unsigned int btrace_seq;
index ce256438e6197e5557ef53edd9997594763e82d5..93c27f71122a8d88139cdb8ae251b5e953404485 100644 (file)
@@ -134,8 +134,8 @@ typedef struct skb_frag_struct skb_frag_t;
 
 struct skb_frag_struct {
        struct page *page;
-       __u16 page_offset;
-       __u16 size;
+       __u32 page_offset;
+       __u32 size;
 };
 
 /* This data is invariant across clones and lives at
index 302b81d1d1176999e61dc2b5b5db8ae5b320a21c..002a3cddbdd5b0bede9f6ba9f653623801bc8742 100644 (file)
@@ -77,6 +77,7 @@ struct spi_device {
 #define        SPI_CS_HIGH     0x04                    /* chipselect active high? */
 #define        SPI_LSB_FIRST   0x08                    /* per-word bits-on-wire */
 #define        SPI_3WIRE       0x10                    /* SI/SO signals shared */
+#define        SPI_LOOP        0x20                    /* loopback mode */
        u8                      bits_per_word;
        int                     irq;
        void                    *controller_state;
@@ -138,6 +139,32 @@ struct spi_message;
 
 
 
+/**
+ * struct spi_driver - Host side "protocol" driver
+ * @probe: Binds this driver to the spi device.  Drivers can verify
+ *     that the device is actually present, and may need to configure
+ *     characteristics (such as bits_per_word) which weren't needed for
+ *     the initial configuration done during system setup.
+ * @remove: Unbinds this driver from the spi device
+ * @shutdown: Standard shutdown callback used during system state
+ *     transitions such as powerdown/halt and kexec
+ * @suspend: Standard suspend callback used during system state transitions
+ * @resume: Standard resume callback used during system state transitions
+ * @driver: SPI device drivers should initialize the name and owner
+ *     field of this structure.
+ *
+ * This represents the kind of device driver that uses SPI messages to
+ * interact with the hardware at the other end of a SPI link.  It's called
+ * a "protocol" driver because it works through messages rather than talking
+ * directly to SPI hardware (which is what the underlying SPI controller
+ * driver does to pass those messages).  These protocols are defined in the
+ * specification for the device(s) supported by the driver.
+ *
+ * As a rule, those device protocols represent the lowest level interface
+ * supported by a driver, and it will support upper level interfaces too.
+ * Examples of such upper levels include frameworks like MTD, networking,
+ * MMC, RTC, filesystem character device nodes, and hardware monitoring.
+ */
 struct spi_driver {
        int                     (*probe)(struct spi_device *spi);
        int                     (*remove)(struct spi_device *spi);
@@ -667,7 +694,37 @@ static inline ssize_t spi_w8r16(struct spi_device *spi, u8 cmd)
  * parport adapters, or microcontrollers acting as USB-to-SPI bridges.
  */
 
-/* board-specific information about each SPI device */
+/**
+ * struct spi_board_info - board-specific template for a SPI device
+ * @modalias: Initializes spi_device.modalias; identifies the driver.
+ * @platform_data: Initializes spi_device.platform_data; the particular
+ *     data stored there is driver-specific.
+ * @controller_data: Initializes spi_device.controller_data; some
+ *     controllers need hints about hardware setup, e.g. for DMA.
+ * @irq: Initializes spi_device.irq; depends on how the board is wired.
+ * @max_speed_hz: Initializes spi_device.max_speed_hz; based on limits
+ *     from the chip datasheet and board-specific signal quality issues.
+ * @bus_num: Identifies which spi_master parents the spi_device; unused
+ *     by spi_new_device(), and otherwise depends on board wiring.
+ * @chip_select: Initializes spi_device.chip_select; depends on how
+ *     the board is wired.
+ * @mode: Initializes spi_device.mode; based on the chip datasheet, board
+ *     wiring (some devices support both 3WIRE and standard modes), and
+ *     possibly presence of an inverter in the chipselect path.
+ *
+ * When adding new SPI devices to the device tree, these structures serve
+ * as a partial device template.  They hold information which can't always
+ * be determined by drivers.  Information that probe() can establish (such
+ * as the default transfer wordsize) is not included here.
+ *
+ * These structures are used in two places.  Their primary role is to
+ * be stored in tables of board-specific device descriptors, which are
+ * declared early in board initialization and then used (much later) to
+ * populate a controller's device tree after the that controller's driver
+ * initializes.  A secondary (and atypical) role is as a parameter to
+ * spi_new_device() call, which happens after those controller drivers
+ * are active in some dynamic board configuration models.
+ */
 struct spi_board_info {
        /* the device name and module name are coupled, like platform_bus;
         * "modalias" is normally the driver name.
index 7d700be57490027f8e67436c201260e49c53f591..c93ef9d42a01e48b2ad66fc3bacdf42362844ed1 100644 (file)
 #define SPI_MODE_2             (SPI_CPOL|0)
 #define SPI_MODE_3             (SPI_CPOL|SPI_CPHA)
 
+#define SPI_CS_HIGH            0x04
+#define SPI_LSB_FIRST          0x08
+#define SPI_3WIRE              0x10
+#define SPI_LOOP               0x20
 
 /*---------------------------------------------------------------------------*/
 
index e8e6da394c921572bae24a3aa7e2574138936951..388cace9751f06b9ee9496e2824a79e4bb9d839f 100644 (file)
@@ -24,7 +24,7 @@ struct pbe {
 extern void drain_local_pages(void);
 extern void mark_free_pages(struct zone *zone);
 
-#if defined(CONFIG_PM) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
+#if defined(CONFIG_PM_SLEEP) && defined(CONFIG_VT) && defined(CONFIG_VT_CONSOLE)
 extern int pm_prepare_console(void);
 extern void pm_restore_console(void);
 #else
@@ -54,8 +54,7 @@ struct hibernation_ops {
        void (*restore_cleanup)(void);
 };
 
-#ifdef CONFIG_PM
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /* kernel/power/snapshot.c */
 extern void __register_nosave_region(unsigned long b, unsigned long e, int km);
 static inline void register_nosave_region(unsigned long b, unsigned long e)
@@ -73,15 +72,16 @@ extern unsigned long get_safe_page(gfp_t gfp_mask);
 
 extern void hibernation_set_ops(struct hibernation_ops *ops);
 extern int hibernate(void);
-#else /* CONFIG_SOFTWARE_SUSPEND */
+#else /* CONFIG_HIBERNATION */
 static inline int swsusp_page_is_forbidden(struct page *p) { return 0; }
 static inline void swsusp_set_page_free(struct page *p) {}
 static inline void swsusp_unset_page_free(struct page *p) {}
 
 static inline void hibernation_set_ops(struct hibernation_ops *ops) {}
 static inline int hibernate(void) { return -ENOSYS; }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
+#ifdef CONFIG_PM_SLEEP
 void save_processor_state(void);
 void restore_processor_state(void);
 struct saved_context;
@@ -106,7 +106,7 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
                { .notifier_call = fn, .priority = pri };       \
        register_pm_notifier(&fn##_nb);                 \
 }
-#else /* CONFIG_PM */
+#else /* !CONFIG_PM_SLEEP */
 
 static inline int register_pm_notifier(struct notifier_block *nb)
 {
@@ -119,12 +119,15 @@ static inline int unregister_pm_notifier(struct notifier_block *nb)
 }
 
 #define pm_notifier(fn, pri)   do { (void)(fn); } while (0)
-#endif /* CONFIG_PM */
+#endif /* !CONFIG_PM_SLEEP */
 
-#if !defined CONFIG_SOFTWARE_SUSPEND || !defined(CONFIG_PM)
+#ifndef CONFIG_HIBERNATION
 static inline void register_nosave_region(unsigned long b, unsigned long e)
 {
 }
+static inline void register_nosave_region_late(unsigned long b, unsigned long e)
+{
+}
 #endif
 
 #endif /* _LINUX_SWSUSP_H */
index 47f1c53332ce60faba13dda38c0a36c84c25d451..483050c924c305038a96cbcc4985f3f25b3cfe42 100644 (file)
@@ -62,7 +62,7 @@ enum
        CTL_KERN=1,             /* General kernel info and control */
        CTL_VM=2,               /* VM management */
        CTL_NET=3,              /* Networking */
-       /* was CTL_PROC */
+       CTL_PROC=4,             /* removal breaks strace(1) compilation */
        CTL_FS=5,               /* Filesystems */
        CTL_DEBUG=6,            /* Debugging */
        CTL_DEV=7,              /* Devices */
index d0890a7e5babb1f96b78a04fa6f471df0edbdd8e..525d437b12538ba780f5639a1fa73b3628ea40da 100644 (file)
        .max_interval           = 64*num_online_cpus(), \
        .busy_factor            = 128,                  \
        .imbalance_pct          = 133,                  \
-       .cache_hot_time         = (10*1000000),         \
        .cache_nice_tries       = 1,                    \
        .busy_idx               = 3,                    \
        .idle_idx               = 3,                    \
index 691a1748d9d235a732346711c1ca84aeeb1251f9..6570719eafdf8038056e4ba3562b36e2446b7cb9 100644 (file)
@@ -274,6 +274,8 @@ struct tty_struct {
 #define TTY_PTY_LOCK           16      /* pty private */
 #define TTY_NO_WRITE_SPLIT     17      /* Preserve write boundaries to driver */
 #define TTY_HUPPED             18      /* Post driver->hangup() */
+#define TTY_FLUSHING           19      /* Flushing to ldisc in progress */
+#define TTY_FLUSHPENDING       20      /* Queued buffer flush pending */
 
 #define TTY_WRITE_FLUSH(tty) tty_write_flush((tty))
 
index 7a60946df3b675889f4e4bdc2e5b77ab7fe45a38..4f33a58fa9d1c687baa8e3d76773a4c61d9cc23c 100644 (file)
@@ -94,6 +94,7 @@ enum usb_interface_condition {
  *     endpoint configurations.  They will be in no particular order.
  * @num_altsetting: number of altsettings defined.
  * @cur_altsetting: the current altsetting.
+ * @intf_assoc: interface association descriptor
  * @driver: the USB driver that is bound to this interface.
  * @minor: the minor number assigned to this interface, if this
  *     interface is bound to a driver that uses the USB major number.
@@ -213,6 +214,7 @@ struct usb_interface_cache {
  * @desc: the device's configuration descriptor.
  * @string: pointer to the cached version of the iConfiguration string, if
  *     present for this configuration.
+ * @intf_assoc: list of any interface association descriptors in this config
  * @interface: array of pointers to usb_interface structures, one for each
  *     interface in the configuration.  The number of interfaces is stored
  *     in desc.bNumInterfaces.  These pointers are valid only while the
index 6de1e9e35c73e6dfe97cb44538878bf639d8e4f7..0864a775de24462fb962545da1c91b7b56a860ae 100644 (file)
@@ -12,37 +12,8 @@ extern void unix_gc(void);
 
 #define UNIX_HASH_SIZE 256
 
-extern struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
-extern spinlock_t unix_table_lock;
-
 extern atomic_t unix_tot_inflight;
 
-static inline struct sock *first_unix_socket(int *i)
-{
-       for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
-               if (!hlist_empty(&unix_socket_table[*i]))
-                       return __sk_head(&unix_socket_table[*i]);
-       }
-       return NULL;
-}
-
-static inline struct sock *next_unix_socket(int *i, struct sock *s)
-{
-       struct sock *next = sk_next(s);
-       /* More in this chain? */
-       if (next)
-               return next;
-       /* Look for next non-empty chain. */
-       for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
-               if (!hlist_empty(&unix_socket_table[*i]))
-                       return __sk_head(&unix_socket_table[*i]);
-       }
-       return NULL;
-}
-
-#define forall_unix_sockets(i, s) \
-       for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s)))
-
 struct unix_address {
        atomic_t        refcnt;
        int             len;
index 87df4e87622d0ce19df6c848d160db3fda995e05..70e70f5d3dd61e26a54f46c7c9e59ff8db6c0bf0 100644 (file)
@@ -34,7 +34,7 @@
 /* L2CAP socket address */
 struct sockaddr_l2 {
        sa_family_t     l2_family;
-       unsigned short  l2_psm;
+       __le16          l2_psm;
        bdaddr_t        l2_bdaddr;
 };
 
@@ -76,32 +76,32 @@ struct l2cap_conninfo {
 
 /* L2CAP structures */
 struct l2cap_hdr {
-       __u16      len;
-       __u16      cid;
+       __le16     len;
+       __le16     cid;
 } __attribute__ ((packed));
 #define L2CAP_HDR_SIZE         4
 
 struct l2cap_cmd_hdr {
        __u8       code;
        __u8       ident;
-       __u16      len;
+       __le16     len;
 } __attribute__ ((packed));
 #define L2CAP_CMD_HDR_SIZE     4
 
 struct l2cap_cmd_rej {
-       __u16      reason;
+       __le16     reason;
 } __attribute__ ((packed));
 
 struct l2cap_conn_req {
-       __u16      psm;
-       __u16      scid;
+       __le16     psm;
+       __le16     scid;
 } __attribute__ ((packed));
 
 struct l2cap_conn_rsp {
-       __u16      dcid;
-       __u16      scid;
-       __u16      result;
-       __u16      status;
+       __le16     dcid;
+       __le16     scid;
+       __le16     result;
+       __le16     status;
 } __attribute__ ((packed));
 
 /* connect result */
@@ -117,15 +117,15 @@ struct l2cap_conn_rsp {
 #define L2CAP_CS_AUTHOR_PEND  0x0002
 
 struct l2cap_conf_req {
-       __u16      dcid;
-       __u16      flags;
+       __le16     dcid;
+       __le16     flags;
        __u8       data[0];
 } __attribute__ ((packed));
 
 struct l2cap_conf_rsp {
-       __u16      scid;
-       __u16      flags;
-       __u16      result;
+       __le16     scid;
+       __le16     flags;
+       __le16     result;
        __u8       data[0];
 } __attribute__ ((packed));
 
@@ -149,23 +149,23 @@ struct l2cap_conf_opt {
 #define L2CAP_CONF_MAX_SIZE    22
 
 struct l2cap_disconn_req {
-       __u16      dcid;
-       __u16      scid;
+       __le16     dcid;
+       __le16     scid;
 } __attribute__ ((packed));
 
 struct l2cap_disconn_rsp {
-       __u16      dcid;
-       __u16      scid;
+       __le16     dcid;
+       __le16     scid;
 } __attribute__ ((packed));
 
 struct l2cap_info_req {
-       __u16       type;
+       __le16      type;
        __u8        data[0];
 } __attribute__ ((packed));
 
 struct l2cap_info_rsp {
-       __u16       type;
-       __u16       result;
+       __le16      type;
+       __le16      result;
        __u8        data[0];
 } __attribute__ ((packed));
 
@@ -207,7 +207,7 @@ struct l2cap_conn {
 
 struct l2cap_pinfo {
        struct bt_sock  bt;
-       __u16           psm;
+       __le16          psm;
        __u16           dcid;
        __u16           scid;
 
@@ -225,7 +225,7 @@ struct l2cap_pinfo {
 
        __u8            ident;
 
-       __u16           sport;
+       __le16          sport;
 
        struct l2cap_conn       *conn;
        struct sock             *next_c;
index 46b9dce82f6e3e60255d6bd1efdb413627e00363..9059e0ed7fe375e70d12740a1703526d89aba944 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/ipv6.h>
 #include <linux/hardirq.h>
+#include <net/if_inet6.h>
 #include <net/ndisc.h>
 #include <net/flow.h>
 #include <net/snmp.h>
index 7a671603fca6e3e161b2f015f2d809173fcc4581..9bf059817aec6721d1378998ff9f94f624064c0a 100644 (file)
@@ -21,4 +21,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmp;
 extern int nf_conntrack_ipv4_compat_init(void);
 extern void nf_conntrack_ipv4_compat_fini(void);
 
+extern void need_ipv4_conntrack(void);
+
 #endif /*_NF_CONNTRACK_IPV4_H*/
index 5a89659043777aaf188325ae7d10b2fa8016ad65..070d12cb4634f0e1a87a473d622a3288bbc80ca0 100644 (file)
@@ -7,9 +7,6 @@ extern struct nf_conntrack_l4proto nf_conntrack_l4proto_tcp6;
 extern struct nf_conntrack_l4proto nf_conntrack_l4proto_udp6;
 extern struct nf_conntrack_l4proto nf_conntrack_l4proto_icmpv6;
 
-extern int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start,
-                                 u8 *nexthdrp, int len);
-
 extern int nf_ct_frag6_init(void);
 extern void nf_ct_frag6_cleanup(void);
 extern struct sk_buff *nf_ct_frag6_gather(struct sk_buff *skb);
index 040dae5f0c9e2a595e63c0ca0230ce11925b0ae2..c48e390f4b0f01e4c201d34d6ade08b90dec3755 100644 (file)
@@ -35,7 +35,7 @@ union nf_conntrack_address {
 union nf_conntrack_man_proto
 {
        /* Add other protocols here. */
-       u_int16_t all;
+       __be16 all;
 
        struct {
                __be16 port;
@@ -73,7 +73,7 @@ struct nf_conntrack_tuple
                union nf_conntrack_address u3;
                union {
                        /* Add other protocols here. */
-                       u_int16_t all;
+                       __be16 all;
 
                        struct {
                                __be16 port;
index ffbc7f28335a2c4f915e98b0216dcb49195e8753..2e5b2f6f9fa08467b1eb15a50b3f6448c50aac80 100644 (file)
@@ -132,6 +132,8 @@ struct netlbl_lsm_secattr_catmap {
 #define NETLBL_SECATTR_CACHE            0x00000002
 #define NETLBL_SECATTR_MLS_LVL          0x00000004
 #define NETLBL_SECATTR_MLS_CAT          0x00000008
+#define NETLBL_SECATTR_CACHEABLE        (NETLBL_SECATTR_MLS_LVL | \
+                                        NETLBL_SECATTR_MLS_CAT)
 struct netlbl_lsm_secattr {
        u32 flags;
 
index 16baef4dab7ed813729d9879be38399b85682f6a..d529045c16795b6506618b6cd047d614a0513264 100644 (file)
@@ -189,6 +189,16 @@ int sctp_assocs_proc_init(void);
 void sctp_assocs_proc_exit(void);
 
 
+/*
+ * Module global variables
+ */
+
+ /*
+  * sctp/protocol.c
+  */
+extern struct kmem_cache *sctp_chunk_cachep __read_mostly;
+extern struct kmem_cache *sctp_bucket_cachep __read_mostly;
+
 /*
  *  Section:  Macros, externs, and inlines
  */
index 8b404b1ef7c8ed7ba6025e8e7dab582105b0c1ae..185c7ecce4cc159e845c3e9afa62a7facc7b8bea 100644 (file)
@@ -281,7 +281,7 @@ extern int                  tcp_v4_remember_stamp(struct sock *sk);
 
 extern int                     tcp_v4_tw_remember_stamp(struct inet_timewait_sock *tw);
 
-extern int                     tcp_sendmsg(struct kiocb *iocb, struct sock *sk,
+extern int                     tcp_sendmsg(struct kiocb *iocb, struct socket *sock,
                                            struct msghdr *msg, size_t size);
 extern ssize_t                 tcp_sendpage(struct socket *sock, struct page *page, int offset, size_t size, int flags);
 
@@ -660,7 +660,7 @@ struct tcp_congestion_ops {
        /* new value of cwnd after loss (optional) */
        u32  (*undo_cwnd)(struct sock *sk);
        /* hook for packet ack accounting (optional) */
-       void (*pkts_acked)(struct sock *sk, u32 num_acked, ktime_t last);
+       void (*pkts_acked)(struct sock *sk, u32 num_acked, s32 rtt_us);
        /* get info for inet_diag (optional) */
        void (*get_info)(struct sock *sk, u32 ext, struct sk_buff *skb);
 
index 3f631b08a1ab3a63fd4cc2a9d4291cb87ac4613f..007d442412e2224a987bb36145e6f4f771a4760d 100644 (file)
@@ -210,6 +210,9 @@ struct iscsi_session {
        uint32_t                exp_cmdsn;
        uint32_t                max_cmdsn;
 
+       /* This tracks the reqs queued into the initiator */
+       uint32_t                queued_cmdsn;
+
        /* configuration */
        int                     initial_r2t_en;
        unsigned                max_r2t;
index df36461fe88141829ab60dee48a2ad2f8d973a89..8dda2d66b5b92bcb61fd03c3e5fde16ce4bdb3ff 100644 (file)
@@ -348,7 +348,7 @@ struct sas_ha_struct {
 
 /* public: */
        char *sas_ha_name;
-       struct pci_dev *pcidev;   /* should be set */
+       struct device *dev;       /* should be set */
        struct module *lldd_module; /* should be set */
 
        u8 *sas_addr;             /* must be set */
index 02e26c1672bf25edef324b65ff585969b899d642..3465f31a21c4c5bb83980db6dcf6ab721ff0678e 100644 (file)
@@ -13,8 +13,6 @@ struct scsi_driver {
 
        int (*init_command)(struct scsi_cmnd *);
        void (*rescan)(struct device *);
-       int (*issue_flush)(struct device *, sector_t *);
-       int (*prepare_flush)(struct request_queue *, struct request *);
 };
 #define to_scsi_driver(drv) \
        container_of((drv), struct scsi_driver, gendrv)
index 78583fee0ab2abbc70a721df3b8a1b62c2e497d3..ce02ad1f518569cedefdb3f76fff5d8b055c0dba 100644 (file)
@@ -56,8 +56,6 @@ static int sd_suspend(struct device *dev, pm_message_t state);
 static int sd_resume(struct device *dev);
 static void sd_rescan(struct device *);
 static int  sd_init_command(struct scsi_cmnd *);
-static int  sd_issue_flush(struct device *, sector_t *);
-static void sd_prepare_flush(struct request_queue *, struct request *);
 static void sd_read_capacity(struct scsi_disk *sdkp, unsigned char *buffer);
 static void scsi_disk_release(struct class_device *cdev);
 static void sd_print_sense_hdr(struct scsi_disk *, struct scsi_sense_hdr *);
diff --git a/include/video/tx3912.h b/include/video/tx3912.h
deleted file mode 100644 (file)
index 6b6d006..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * linux/include/video/tx3912.h
- *
- * Copyright (C) 2001 Steven Hill (sjhill@realitydiluted.com)
- *
- * This file is subject to the terms and conditions of the GNU General Public
- * License. See the file COPYING in the main directory of this archive for
- * more details.
- *
- * Includes for TMPR3912/05 and PR31700 LCD controller registers
- */
-#include <asm/tx3912.h>
-
-#define VidCtrl1        REG_AT(0x028)
-#define VidCtrl2        REG_AT(0x02C)
-#define VidCtrl3        REG_AT(0x030)
-#define VidCtrl4        REG_AT(0x034)
-#define VidCtrl5        REG_AT(0x038)
-#define VidCtrl6        REG_AT(0x03C)
-#define VidCtrl7        REG_AT(0x040)
-#define VidCtrl8        REG_AT(0x044)
-#define VidCtrl9        REG_AT(0x048)
-#define VidCtrl10       REG_AT(0x04C)
-#define VidCtrl11       REG_AT(0x050)
-#define VidCtrl12       REG_AT(0x054)
-#define VidCtrl13       REG_AT(0x058)
-#define VidCtrl14       REG_AT(0x05C)
-
-/* Video Control 1 Register */
-#define LINECNT         0xffc00000
-#define LINECNT_SHIFT   22
-#define LOADDLY         BIT(21)
-#define BAUDVAL         (BIT(20) | BIT(19) | BIT(18) | BIT(17) | BIT(16))
-#define BAUDVAL_SHIFT   16
-#define VIDDONEVAL      (BIT(15) | BIT(14) | BIT(13) | BIT(12) | BIT(11) | BIT(10) | BIT(9))
-#define VIDDONEVAL_SHIFT  9
-#define ENFREEZEFRAME   BIT(8)
-#define TX3912_VIDCTRL1_BITSEL_MASK    0x000000c0
-#define TX3912_VIDCTRL1_2BIT_GRAY      0x00000040
-#define TX3912_VIDCTRL1_4BIT_GRAY      0x00000080
-#define TX3912_VIDCTRL1_8BIT_COLOR     0x000000c0
-#define BITSEL_SHIFT    6
-#define DISPSPLIT       BIT(5)
-#define DISP8           BIT(4)
-#define DFMODE          BIT(3)
-#define INVVID          BIT(2)
-#define DISPON          BIT(1)
-#define ENVID           BIT(0)
-
-/* Video Control 2 Register */
-#define VIDRATE_MASK    0xffc00000
-#define VIDRATE_SHIFT   22
-#define HORZVAL_MASK    0x001ff000
-#define HORZVAL_SHIFT   12
-#define LINEVAL_MASK    0x000001ff
-
-/* Video Control 3 Register */
-#define TX3912_VIDCTRL3_VIDBANK_MASK    0xfff00000
-#define TX3912_VIDCTRL3_VIDBASEHI_MASK  0x000ffff0
-
-/* Video Control 4 Register */
-#define TX3912_VIDCTRL4_VIDBASELO_MASK  0x000ffff0
index 1df6c1930578f4d5e05ead6c57dd510a793f0a16..c0c8fcb278999ff50b9f92ce141f0e4281f4ab86 100644 (file)
@@ -4,6 +4,7 @@
 #include <linux/pfn.h>
 
 #include <asm/uaccess.h>
+#include <asm/pgtable.h>
 
 #include <xen/features.h>
 
index e2056828dc64159474cf44b3037e5b2bda54663f..96b54595f1dc16e1809852ca0462184b948b54b4 100644 (file)
@@ -7,7 +7,7 @@ config DEFCONFIG_LIST
        default "/boot/config-$UNAME_RELEASE"
        default "arch/$ARCH/defconfig"
 
-menu "Code maturity level options"
+menu "General setup"
 
 config EXPERIMENTAL
        bool "Prompt for development and/or incomplete code/drivers"
@@ -61,9 +61,6 @@ config INIT_ENV_ARG_LIMIT
          Maximum of each of the number of arguments and environment
          variables passed to init from the kernel command line.
 
-endmenu
-
-menu "General setup"
 
 config LOCALVERSION
        string "Local version - append to kernel release"
@@ -340,7 +337,7 @@ endif
 config CC_OPTIMIZE_FOR_SIZE
        bool "Optimize for size (Look out for broken compilers!)"
        default y
-       depends on ARM || H8300 || EXPERIMENTAL
+       depends on ARM || H8300 || SUPERH || EXPERIMENTAL
        help
          Enabling this option will pass "-Os" instead of "-O2" to gcc
          resulting in a smaller kernel.
@@ -468,25 +465,19 @@ config FUTEX
          run glibc-based applications correctly.
 
 config ANON_INODES
-       bool "Enable anonymous inode source" if EMBEDDED
-       default y
-       help
-         Anonymous inode source for pseudo-files like epoll, signalfd,
-         timerfd and eventfd.
-
-         If unsure, say Y.
+       bool
 
 config EPOLL
        bool "Enable eventpoll support" if EMBEDDED
        default y
-       depends on ANON_INODES
+       select ANON_INODES
        help
          Disabling this option will cause the kernel to be built without
          support for epoll family of system calls.
 
 config SIGNALFD
        bool "Enable signalfd() system call" if EMBEDDED
-       depends on ANON_INODES
+       select ANON_INODES
        default y
        help
          Enable the signalfd() system call that allows to receive signals
@@ -496,7 +487,7 @@ config SIGNALFD
 
 config TIMERFD
        bool "Enable timerfd() system call" if EMBEDDED
-       depends on ANON_INODES
+       select ANON_INODES
        default y
        help
          Enable the timerfd() system call that allows to receive timer
@@ -506,7 +497,7 @@ config TIMERFD
 
 config EVENTFD
        bool "Enable eventfd() system call" if EMBEDDED
-       depends on ANON_INODES
+       select ANON_INODES
        default y
        help
          Enable the eventfd() system call that allows to receive both
index 00eff7a110854d5706ff51205f5ef06a7a267d27..1db02a0025db2a5f805ed78d7f88a8cf30a230df 100644 (file)
@@ -133,7 +133,7 @@ static __initdata loff_t this_header, next_header;
 
 static __initdata int dry_run;
 
-static inline void eat(unsigned n)
+static inline void __init eat(unsigned n)
 {
        victim += n;
        this_header += n;
index d0259e3ad1c00ae0f879e18c91a6945e41c25cdb..a86a3a5c8a19589698dc8b9ec555e1d98891466d 100644 (file)
--- a/ipc/shm.c
+++ b/ipc/shm.c
@@ -268,7 +268,9 @@ static int shm_mmap(struct file * file, struct vm_area_struct * vma)
        if (ret != 0)
                return ret;
        sfd->vm_ops = vma->vm_ops;
+#ifdef CONFIG_MMU
        BUG_ON(!sfd->vm_ops->fault);
+#endif
        vma->vm_ops = &shm_vm_ops;
        shm_open(vma);
 
@@ -714,7 +716,7 @@ asmlinkage long sys_shmctl (int shmid, int cmd, struct shmid_ds __user *buf)
                        struct user_struct * user = current->user;
                        if (!is_file_hugepages(shp->shm_file)) {
                                err = shmem_lock(shp->shm_file, 1, user);
-                               if (!err{
+                               if (!err && !(shp->shm_perm.mode & SHM_LOCKED)){
                                        shp->shm_perm.mode |= SHM_LOCKED;
                                        shp->mlock_user = user;
                                }
index c64ce9c14207644bfc07c5f2c729f5fe9b66c5b6..6b066632e40c2a9f0621d487d0caf5a7700c7b41 100644 (file)
@@ -63,3 +63,6 @@ config PREEMPT_BKL
          Say Y here if you are building a kernel for a desktop system.
          Say N if you are unsure.
 
+config PREEMPT_NOTIFIERS
+       bool
+
index bde1124d590891d42f4fced9ecf0f15a80fe8297..3401293359e82f7bff1c9b3beb3d87e3e23707ae 100644 (file)
@@ -824,12 +824,14 @@ static void audit_log_execve_info(struct audit_buffer *ab,
 {
        int i;
        long len, ret;
-       const char __user *p = (const char __user *)axi->mm->arg_start;
+       const char __user *p;
        char *buf;
 
        if (axi->mm != current->mm)
                return; /* execve failed, no additional info */
 
+       p = (const char __user *)axi->mm->arg_start;
+
        for (i = 0; i < axi->argc; i++, p += len) {
                len = strnlen_user(p, MAX_ARG_STRLEN);
                /*
@@ -855,7 +857,7 @@ static void audit_log_execve_info(struct audit_buffer *ab,
                 * copied them here, and the mm hasn't been exposed to user-
                 * space yet.
                 */
-               if (!ret) {
+               if (ret) {
                        WARN_ON(1);
                        send_sig(SIGKILL, current, 0);
                }
@@ -1990,19 +1992,19 @@ int __audit_signal_info(int sig, struct task_struct *t)
        extern uid_t audit_sig_uid;
        extern u32 audit_sig_sid;
 
-       if (audit_pid && t->tgid == audit_pid &&
-           (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1)) {
-               audit_sig_pid = tsk->pid;
-               if (ctx)
-                       audit_sig_uid = ctx->loginuid;
-               else
-                       audit_sig_uid = tsk->uid;
-               selinux_get_task_sid(tsk, &audit_sig_sid);
+       if (audit_pid && t->tgid == audit_pid) {
+               if (sig == SIGTERM || sig == SIGHUP || sig == SIGUSR1) {
+                       audit_sig_pid = tsk->pid;
+                       if (ctx)
+                               audit_sig_uid = ctx->loginuid;
+                       else
+                               audit_sig_uid = tsk->uid;
+                       selinux_get_task_sid(tsk, &audit_sig_sid);
+               }
+               if (!audit_signals || audit_dummy_context())
+                       return 0;
        }
 
-       if (!audit_signals) /* audit_context checked in wrapper */
-               return 0;
-
        /* optimize the common case by putting first signal recipient directly
         * in audit_context */
        if (!ctx->target_pid) {
index 464c2b172f07477ca27a453edcf93fb6eeebe1c6..9578c1ae19ca9fde7a69e27fe617d3b928438637 100644 (file)
@@ -813,7 +813,7 @@ static void exit_notify(struct task_struct *tsk)
                __kill_pgrp_info(SIGCONT, SEND_SIG_PRIV, pgrp);
        }
 
-       /* Let father know we died 
+       /* Let father know we died
         *
         * Thread signals are configurable, but you aren't going to use
         * that to send signals to arbitary processes. 
@@ -826,9 +826,7 @@ static void exit_notify(struct task_struct *tsk)
         * If our self_exec id doesn't match our parent_exec_id then
         * we have changed execution domain as these two values started
         * the same after a fork.
-        *      
         */
-       
        if (tsk->exit_signal != SIGCHLD && tsk->exit_signal != -1 &&
            ( tsk->parent_exec_id != t->self_exec_id  ||
              tsk->self_exec_id != tsk->parent_exec_id)
@@ -848,9 +846,7 @@ static void exit_notify(struct task_struct *tsk)
        }
 
        state = EXIT_ZOMBIE;
-       if (tsk->exit_signal == -1 &&
-           (likely(tsk->ptrace == 0) ||
-            unlikely(tsk->parent->signal->flags & SIGNAL_GROUP_EXIT)))
+       if (tsk->exit_signal == -1 && likely(!tsk->ptrace))
                state = EXIT_DEAD;
        tsk->exit_state = state;
 
index a12425051ee98f8f51944905ec82244631fffc37..3415e9ad1391adc6422c9324b8efdc1bbd6c7ce2 100644 (file)
@@ -2060,8 +2060,10 @@ asmlinkage long sys_futex(u32 __user *uaddr, int op, u32 val,
        }
        /*
         * requeue parameter in 'utime' if cmd == FUTEX_REQUEUE.
+        * number of waiters to wake in 'utime' if cmd == FUTEX_WAKE_OP.
         */
-       if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE)
+       if (cmd == FUTEX_REQUEUE || cmd == FUTEX_CMP_REQUEUE ||
+           cmd == FUTEX_WAKE_OP)
                val2 = (u32) (unsigned long) utime;
 
        return do_futex(uaddr, op, val, tp, uaddr2, val2, val3);
index 615ce97c6cfd8393e85dbc4fb3b23f0cce762bcb..f1a73f0b54e775d29a9e2184d3d13cfae75af239 100644 (file)
@@ -352,13 +352,10 @@ handle_level_irq(unsigned int irq, struct irq_desc *desc)
         * keep it masked and get out of here
         */
        action = desc->action;
-       if (unlikely(!action || (desc->status & IRQ_DISABLED))) {
-               desc->status |= IRQ_PENDING;
+       if (unlikely(!action || (desc->status & IRQ_DISABLED)))
                goto out_unlock;
-       }
 
        desc->status |= IRQ_INPROGRESS;
-       desc->status &= ~IRQ_PENDING;
        spin_unlock(&desc->lock);
 
        action_ret = handle_IRQ_event(irq, action);
index d8ee241115f56cd741f0db41dc207484d2cb49ec..6d9204f3a370cfa30b35c9712e15dd5c8723d49c 100644 (file)
@@ -1,5 +1,6 @@
 #include <linux/module.h>
 #include <linux/interrupt.h>
+#include <linux/device.h>
 
 /*
  * Device resource management aware IRQ request/free implementation.
index 5bfeaed7e4872850049d40aef740d24b983adebf..a8046791ba2d3fde84853ac7a7bfbb0bbca07b84 100644 (file)
@@ -62,7 +62,12 @@ void check_irq_resend(struct irq_desc *desc, unsigned int irq)
         */
        desc->chip->enable(irq);
 
-       if ((status & (IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
+       /*
+        * We do not resend level type interrupts. Level type
+        * interrupts are resent by hardware when they are still
+        * active.
+        */
+       if ((status & (IRQ_LEVEL | IRQ_PENDING | IRQ_REPLAY)) == IRQ_PENDING) {
                desc->status = (status & ~IRQ_PENDING) | IRQ_REPLAY;
 
                if (!desc->chip || !desc->chip->retrigger ||
index beedbdc646087783cc25fb3d68dcf9226cec4689..9809cc1f33d6c030e63fa2cc9092b4ee608459e5 100644 (file)
@@ -351,11 +351,11 @@ static inline void register_pm_notifier_callback(void) {}
 
 /**
  * call_usermodehelper_setup - prepare to call a usermode helper
- * @path - path to usermode executable
- * @argv - arg vector for process
- * @envp - environment for process
+ * @path: path to usermode executable
+ * @argv: arg vector for process
+ * @envp: environment for process
  *
- * Returns either NULL on allocation failure, or a subprocess_info
+ * Returns either %NULL on allocation failure, or a subprocess_info
  * structure.  This should be passed to call_usermodehelper_exec to
  * exec the process and free the structure.
  */
index 3e9f513a728d4a4211ca819c894c3624d74973c4..4b8a4493c541873a946e9d62161459fa4f94c35c 100644 (file)
@@ -1063,6 +1063,11 @@ EXPORT_SYMBOL_GPL(register_kprobe);
 EXPORT_SYMBOL_GPL(unregister_kprobe);
 EXPORT_SYMBOL_GPL(register_jprobe);
 EXPORT_SYMBOL_GPL(unregister_jprobe);
+#ifdef CONFIG_KPROBES
 EXPORT_SYMBOL_GPL(jprobe_return);
+#endif
+
+#ifdef CONFIG_KPROBES
 EXPORT_SYMBOL_GPL(register_kretprobe);
 EXPORT_SYMBOL_GPL(unregister_kretprobe);
+#endif
index a404f7ee73959a154fddca8b59c5bb79db1773be..dcfe724300eb3cd32c46c2d06de4fc92c7de070b 100644 (file)
@@ -214,23 +214,15 @@ int kthread_stop(struct task_struct *k)
 }
 EXPORT_SYMBOL(kthread_stop);
 
-
-static noinline __init_refok void kthreadd_setup(void)
+int kthreadd(void *unused)
 {
        struct task_struct *tsk = current;
 
+       /* Setup a clean context for our children to inherit. */
        set_task_comm(tsk, "kthreadd");
-
        ignore_signals(tsk);
-
        set_user_nice(tsk, -5);
        set_cpus_allowed(tsk, CPU_MASK_ALL);
-}
-
-int kthreadd(void *unused)
-{
-       /* Setup a clean context for our children to inherit. */
-       kthreadd_setup();
 
        current->flags |= PF_NOFREEZE;
 
index 9f17af4a2490764342a0fe17313b9b32e65ddfc8..c851b2dcc685cc91db6bf16838aaab556517878e 100644 (file)
@@ -346,7 +346,7 @@ static const struct file_operations proc_lockdep_stats_operations = {
        .open           = lockdep_stats_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 #ifdef CONFIG_LOCK_STAT
index effbaaedd7f328ac8a69bc246e60903b5babd271..4e57732fcfb41c03ddb38841d7c1876d5372e862 100644 (file)
@@ -567,7 +567,12 @@ static void __init kernel_param_sysfs_setup(const char *name,
        kobject_set_name(&mk->kobj, name);
        kobject_init(&mk->kobj);
        ret = kobject_add(&mk->kobj);
-       BUG_ON(ret < 0);
+       if (ret) {
+               printk(KERN_ERR "Module '%s' failed to be added to sysfs, "
+                     "error number %d\n", name, ret);
+               printk(KERN_ERR "The system will be unstable now.\n");
+               return;
+       }
        param_sysfs_setup(mk, kparam, num_params, name_skip);
        kobject_uevent(&mk->kobj, KOBJ_ADD);
 }
index c1a106d87d90385407d49ee2c7f3e86cc010935e..412859f8d94abde2edd6248aa8db20764111cc6a 100644 (file)
@@ -46,7 +46,7 @@ config PM_VERBOSE
 
 config DISABLE_CONSOLE_SUSPEND
        bool "Keep console(s) enabled during suspend/resume (DANGEROUS)"
-       depends on PM_DEBUG
+       depends on PM_DEBUG && PM_SLEEP
        default n
        ---help---
        This option turns off the console suspend mechanism that prevents
@@ -57,7 +57,7 @@ config DISABLE_CONSOLE_SUSPEND
 
 config PM_TRACE
        bool "Suspend/resume event tracing"
-       depends on PM_DEBUG && X86 && EXPERIMENTAL
+       depends on PM_DEBUG && X86 && PM_SLEEP && EXPERIMENTAL
        default n
        ---help---
        This enables some cheesy code to save the last PM event point in the
@@ -72,9 +72,37 @@ config PM_TRACE
        CAUTION: this option will cause your machine's real-time clock to be
        set to an invalid time after a resume.
 
-config SOFTWARE_SUSPEND
-       bool "Software Suspend (Hibernation)"
-       depends on PM && SWAP && (((X86 || PPC64_SWSUSP) && (!SMP || SUSPEND_SMP)) || ((FRV || PPC32) && !SMP))
+config SUSPEND_SMP_POSSIBLE
+       bool
+       depends on (X86 && !X86_VOYAGER) || (PPC64 && (PPC_PSERIES || PPC_PMAC))
+       depends on SMP
+       default y
+
+config SUSPEND_SMP
+       bool
+       depends on SUSPEND_SMP_POSSIBLE && PM_SLEEP
+       select HOTPLUG_CPU
+       default y
+
+config PM_SLEEP
+       bool
+       depends on SUSPEND || HIBERNATION
+       default y
+
+config SUSPEND
+       bool "Suspend to RAM and standby"
+       depends on PM
+       depends on !SMP || SUSPEND_SMP_POSSIBLE
+       default y
+       ---help---
+         Allow the system to enter sleep states in which main memory is
+         powered and thus its contents are preserved, such as the
+         suspend-to-RAM state (i.e. the ACPI S3 state).
+
+config HIBERNATION
+       bool "Hibernation (aka 'suspend to disk')"
+       depends on PM && SWAP
+       depends on ((X86 || PPC64_SWSUSP || FRV || PPC32) && !SMP) || SUSPEND_SMP_POSSIBLE
        ---help---
          Enable the suspend to disk (STD) functionality, which is usually
          called "hibernation" in user interfaces.  STD checkpoints the
@@ -112,7 +140,7 @@ config SOFTWARE_SUSPEND
 
 config PM_STD_PARTITION
        string "Default resume partition"
-       depends on SOFTWARE_SUSPEND
+       depends on HIBERNATION
        default ""
        ---help---
          The default resume partition is the partition that the suspend-
@@ -132,11 +160,6 @@ config PM_STD_PARTITION
          suspended image to. It will simply pick the first available swap 
          device.
 
-config SUSPEND_SMP
-       bool
-       depends on HOTPLUG_CPU && (X86 || PPC64) && PM
-       default y
-
 config APM_EMULATION
        tristate "Advanced Power Management Emulation"
        depends on PM && SYS_SUPPORTS_APM_EMULATION
index 38725f526afc6cff3f2071017daeea536e78f801..f7dfff28ecdb7035d290a3f7a9e8649283b5d222 100644 (file)
@@ -3,8 +3,9 @@ ifeq ($(CONFIG_PM_DEBUG),y)
 EXTRA_CFLAGS   +=      -DDEBUG
 endif
 
-obj-y                          := main.o process.o console.o
+obj-y                          := main.o
 obj-$(CONFIG_PM_LEGACY)                += pm.o
-obj-$(CONFIG_SOFTWARE_SUSPEND) += swsusp.o disk.o snapshot.o swap.o user.o
+obj-$(CONFIG_PM_SLEEP)         += process.o console.o
+obj-$(CONFIG_HIBERNATION)      += swsusp.o disk.o snapshot.o swap.o user.o
 
 obj-$(CONFIG_MAGIC_SYSRQ)      += poweroff.o
index 324ac0188ce1cb89608f729f1321813f4bf2339d..eb72255b5c86049d1c31f0c9d6ca09b5b653fdca 100644 (file)
@@ -216,6 +216,7 @@ int hibernation_platform_enter(void)
                 * sleep state after all
                 */
                error = hibernation_ops->prepare();
+               sysdev_shutdown();
                if (!error)
                        error = hibernation_ops->enter();
        } else {
index 32147b57c3bfb419f0950b7abafe88aa207984a5..350b485b3b60bdc7679cbd9963ef4ba4b64ed4f3 100644 (file)
 
 BLOCKING_NOTIFIER_HEAD(pm_chain_head);
 
-/*This is just an arbitrary number */
-#define FREE_PAGE_NUMBER (100)
-
 DEFINE_MUTEX(pm_mutex);
 
+#ifdef CONFIG_SUSPEND
+
+/* This is just an arbitrary number */
+#define FREE_PAGE_NUMBER (100)
+
 struct pm_ops *pm_ops;
 
 /**
@@ -269,6 +271,8 @@ int pm_suspend(suspend_state_t state)
 
 EXPORT_SYMBOL(pm_suspend);
 
+#endif /* CONFIG_SUSPEND */
+
 decl_subsys(power,NULL,NULL);
 
 
@@ -285,14 +289,16 @@ decl_subsys(power,NULL,NULL);
 
 static ssize_t state_show(struct kset *kset, char *buf)
 {
+       char *s = buf;
+#ifdef CONFIG_SUSPEND
        int i;
-       char * s = buf;
 
        for (i = 0; i < PM_SUSPEND_MAX; i++) {
                if (pm_states[i] && valid_state(i))
                        s += sprintf(s,"%s ", pm_states[i]);
        }
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#endif
+#ifdef CONFIG_HIBERNATION
        s += sprintf(s, "%s\n", "disk");
 #else
        if (s != buf)
@@ -304,11 +310,13 @@ static ssize_t state_show(struct kset *kset, char *buf)
 
 static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
 {
+#ifdef CONFIG_SUSPEND
        suspend_state_t state = PM_SUSPEND_STANDBY;
        const char * const *s;
+#endif
        char *p;
-       int error;
        int len;
+       int error = -EINVAL;
 
        p = memchr(buf, '\n', n);
        len = p ? p - buf : n;
@@ -316,17 +324,19 @@ static ssize_t state_store(struct kset *kset, const char *buf, size_t n)
        /* First, check if we are requested to hibernate */
        if (len == 4 && !strncmp(buf, "disk", len)) {
                error = hibernate();
-               return error ? error : n;
+  goto Exit;
        }
 
+#ifdef CONFIG_SUSPEND
        for (s = &pm_states[state]; state < PM_SUSPEND_MAX; s++, state++) {
                if (*s && len == strlen(*s) && !strncmp(buf, *s, len))
                        break;
        }
        if (state < PM_SUSPEND_MAX && *s)
                error = enter_state(state);
-       else
-               error = -EINVAL;
+#endif
+
+ Exit:
        return error ? error : n;
 }
 
index 5f24c786f8ec9bacd0421e95d4113c603a823fd5..95fbf2dd3fe33901be99ef8ce60a3bf2ca9fb833 100644 (file)
@@ -13,7 +13,7 @@ struct swsusp_info {
 
 
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Keep some memory free so that I/O operations can succeed without paging
  * [Might this be more than 4 MB?]
@@ -176,9 +176,17 @@ struct timeval;
 extern void swsusp_show_speed(struct timeval *, struct timeval *,
                                unsigned int, char *);
 
+#ifdef CONFIG_SUSPEND
 /* kernel/power/main.c */
-extern int suspend_enter(suspend_state_t state);
 extern int suspend_devices_and_enter(suspend_state_t state);
+#else /* !CONFIG_SUSPEND */
+static inline int suspend_devices_and_enter(suspend_state_t state)
+{
+       return -ENOSYS;
+}
+#endif /* !CONFIG_SUSPEND */
+
+/* kernel/power/common.c */
 extern struct blocking_notifier_head pm_chain_head;
 
 static inline int pm_notifier_call_chain(unsigned long val)
index a3b7854b8f7c8ea2de21e8940e0f2f3be4ba50ca..a686590d88c1b5def265e84aa9ab9091c4b07290 100644 (file)
@@ -709,7 +709,8 @@ static void mark_nosave_pages(struct memory_bitmap *bm)
                                region->end_pfn << PAGE_SHIFT);
 
                for (pfn = region->start_pfn; pfn < region->end_pfn; pfn++)
-                       memory_bm_set_bit(bm, pfn);
+                       if (pfn_valid(pfn))
+                               memory_bm_set_bit(bm, pfn);
        }
 }
 
index 051d27e36a6c997e95215b90bfd3f50bfa7c9c08..bd2cd062878d6fb1f4b40895ddee7dbe9f9468da 100644 (file)
@@ -732,7 +732,7 @@ int __init add_preferred_console(char *name, int idx, char *options)
        return 0;
 }
 
-int __init update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options)
+int update_console_cmdline(char *name, int idx, char *name_new, int idx_new, char *options)
 {
        struct console_cmdline *c;
        int i;
index 5b20fe977bed0812ccb79f6cd76c43a9e0890720..cb1e37d2dac3d4f3cbd2c1102174f6d7a758c5a6 100644 (file)
@@ -199,11 +199,11 @@ EXPORT_SYMBOL_GPL(register_timer_hook);
 EXPORT_SYMBOL_GPL(unregister_timer_hook);
 EXPORT_SYMBOL_GPL(task_handoff_register);
 EXPORT_SYMBOL_GPL(task_handoff_unregister);
+EXPORT_SYMBOL_GPL(profile_event_register);
+EXPORT_SYMBOL_GPL(profile_event_unregister);
 
 #endif /* CONFIG_PROFILING */
 
-EXPORT_SYMBOL_GPL(profile_event_register);
-EXPORT_SYMBOL_GPL(profile_event_unregister);
 
 #ifdef CONFIG_SMP
 /*
index 510fbbd7b5004e6ccbfd0fa55465621861c5cc8c..ad855017bc59de72ebf592fda7576edf6e245bb4 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * Public API and common code for kernel->userspace relay file support.
  *
- * See Documentation/filesystems/relayfs.txt for an overview of relayfs.
+ * See Documentation/filesystems/relay.txt for an overview.
  *
  * Copyright (C) 2002-2005 - Tom Zanussi (zanussi@us.ibm.com), IBM Corp
  * Copyright (C) 1999-2005 - Karim Yaghmour (karim@opersys.com)
@@ -426,6 +426,7 @@ static struct rchan_buf *relay_open_buf(struct rchan *chan, unsigned int cpu)
 
 free_buf:
        relay_destroy_buf(buf);
+       buf = NULL;
 free_name:
        kfree(tmpname);
 end:
index 93cf241cfbe9b62e4580446552873858dc8967a9..45e17b83b7f10ba8a99bf04e3a3bbd2571a345f3 100644 (file)
@@ -53,6 +53,7 @@
 #include <linux/percpu.h>
 #include <linux/kthread.h>
 #include <linux/seq_file.h>
+#include <linux/sysctl.h>
 #include <linux/syscalls.h>
 #include <linux/times.h>
 #include <linux/tsacct_kern.h>
@@ -262,8 +263,7 @@ struct rq {
 
        unsigned int clock_warps, clock_overflows;
        unsigned int clock_unstable_events;
-
-       struct sched_class *load_balance_class;
+       u64 tick_timestamp;
 
        atomic_t nr_iowait;
 
@@ -319,15 +319,19 @@ static inline int cpu_of(struct rq *rq)
 }
 
 /*
- * Per-runqueue clock, as finegrained as the platform can give us:
+ * Update the per-runqueue clock, as finegrained as the platform can give
+ * us, but without assuming monotonicity, etc.:
  */
-static unsigned long long __rq_clock(struct rq *rq)
+static void __update_rq_clock(struct rq *rq)
 {
        u64 prev_raw = rq->prev_clock_raw;
        u64 now = sched_clock();
        s64 delta = now - prev_raw;
        u64 clock = rq->clock;
 
+#ifdef CONFIG_SCHED_DEBUG
+       WARN_ON_ONCE(cpu_of(rq) != smp_processor_id());
+#endif
        /*
         * Protect against sched_clock() occasionally going backwards:
         */
@@ -338,8 +342,11 @@ static unsigned long long __rq_clock(struct rq *rq)
                /*
                 * Catch too large forward jumps too:
                 */
-               if (unlikely(delta > 2*TICK_NSEC)) {
-                       clock++;
+               if (unlikely(clock + delta > rq->tick_timestamp + TICK_NSEC)) {
+                       if (clock < rq->tick_timestamp + TICK_NSEC)
+                               clock = rq->tick_timestamp + TICK_NSEC;
+                       else
+                               clock++;
                        rq->clock_overflows++;
                } else {
                        if (unlikely(delta > rq->clock_max_delta))
@@ -350,18 +357,12 @@ static unsigned long long __rq_clock(struct rq *rq)
 
        rq->prev_clock_raw = now;
        rq->clock = clock;
-
-       return clock;
 }
 
-static inline unsigned long long rq_clock(struct rq *rq)
+static void update_rq_clock(struct rq *rq)
 {
-       int this_cpu = smp_processor_id();
-
-       if (this_cpu == cpu_of(rq))
-               return __rq_clock(rq);
-
-       return rq->clock;
+       if (likely(smp_processor_id() == cpu_of(rq)))
+               __update_rq_clock(rq);
 }
 
 /*
@@ -385,13 +386,15 @@ static inline unsigned long long rq_clock(struct rq *rq)
  */
 unsigned long long cpu_clock(int cpu)
 {
-       struct rq *rq = cpu_rq(cpu);
        unsigned long long now;
        unsigned long flags;
+       struct rq *rq;
 
-       spin_lock_irqsave(&rq->lock, flags);
-       now = rq_clock(rq);
-       spin_unlock_irqrestore(&rq->lock, flags);
+       local_irq_save(flags);
+       rq = cpu_rq(cpu);
+       update_rq_clock(rq);
+       now = rq->clock;
+       local_irq_restore(flags);
 
        return now;
 }
@@ -639,27 +642,31 @@ static u64 div64_likely32(u64 divident, unsigned long divisor)
 
 #define WMULT_SHIFT    32
 
-static inline unsigned long
+/*
+ * Shift right and round:
+ */
+#define RSR(x, y) (((x) + (1UL << ((y) - 1))) >> (y))
+
+static unsigned long
 calc_delta_mine(unsigned long delta_exec, unsigned long weight,
                struct load_weight *lw)
 {
        u64 tmp;
 
        if (unlikely(!lw->inv_weight))
-               lw->inv_weight = WMULT_CONST / lw->weight;
+               lw->inv_weight = (WMULT_CONST - lw->weight/2) / lw->weight + 1;
 
        tmp = (u64)delta_exec * weight;
        /*
         * Check whether we'd overflow the 64-bit multiplication:
         */
-       if (unlikely(tmp > WMULT_CONST)) {
-               tmp = ((tmp >> WMULT_SHIFT/2) * lw->inv_weight)
-                               >> (WMULT_SHIFT/2);
-       } else {
-               tmp = (tmp * lw->inv_weight) >> WMULT_SHIFT;
-       }
+       if (unlikely(tmp > WMULT_CONST))
+               tmp = RSR(RSR(tmp, WMULT_SHIFT/2) * lw->inv_weight,
+                       WMULT_SHIFT/2);
+       else
+               tmp = RSR(tmp * lw->inv_weight, WMULT_SHIFT);
 
-       return (unsigned long)min(tmp, (u64)sysctl_sched_runtime_limit);
+       return (unsigned long)min(tmp, (u64)(unsigned long)LONG_MAX);
 }
 
 static inline unsigned long
@@ -680,46 +687,6 @@ static void update_load_sub(struct load_weight *lw, unsigned long dec)
        lw->inv_weight = 0;
 }
 
-static void __update_curr_load(struct rq *rq, struct load_stat *ls)
-{
-       if (rq->curr != rq->idle && ls->load.weight) {
-               ls->delta_exec += ls->delta_stat;
-               ls->delta_fair += calc_delta_fair(ls->delta_stat, &ls->load);
-               ls->delta_stat = 0;
-       }
-}
-
-/*
- * Update delta_exec, delta_fair fields for rq.
- *
- * delta_fair clock advances at a rate inversely proportional to
- * total load (rq->ls.load.weight) on the runqueue, while
- * delta_exec advances at the same rate as wall-clock (provided
- * cpu is not idle).
- *
- * delta_exec / delta_fair is a measure of the (smoothened) load on this
- * runqueue over any given interval. This (smoothened) load is used
- * during load balance.
- *
- * This function is called /before/ updating rq->ls.load
- * and when switching tasks.
- */
-static void update_curr_load(struct rq *rq, u64 now)
-{
-       struct load_stat *ls = &rq->ls;
-       u64 start;
-
-       start = ls->load_update_start;
-       ls->load_update_start = now;
-       ls->delta_stat += now - start;
-       /*
-        * Stagger updates to ls->delta_fair. Very frequent updates
-        * can be expensive.
-        */
-       if (ls->delta_stat >= sysctl_sched_stat_granularity)
-               __update_curr_load(rq, ls);
-}
-
 /*
  * To aid in avoiding the subversion of "niceness" due to uneven distribution
  * of tasks with abnormal "nice" values across CPUs the contribution that
@@ -729,19 +696,6 @@ static void update_curr_load(struct rq *rq, u64 now)
  * slice expiry etc.
  */
 
-/*
- * Assume: static_prio_timeslice(NICE_TO_PRIO(0)) == DEF_TIMESLICE
- * If static_prio_timeslice() is ever changed to break this assumption then
- * this code will need modification
- */
-#define TIME_SLICE_NICE_ZERO DEF_TIMESLICE
-#define load_weight(lp) \
-       (((lp) * SCHED_LOAD_SCALE) / TIME_SLICE_NICE_ZERO)
-#define PRIO_TO_LOAD_WEIGHT(prio) \
-       load_weight(static_prio_timeslice(prio))
-#define RTPRIO_TO_LOAD_WEIGHT(rp) \
-       (PRIO_TO_LOAD_WEIGHT(MAX_RT_PRIO) + load_weight(rp))
-
 #define WEIGHT_IDLEPRIO                2
 #define WMULT_IDLEPRIO         (1 << 31)
 
@@ -758,11 +712,14 @@ static void update_curr_load(struct rq *rq, u64 now)
  * the relative distance between them is ~25%.)
  */
 static const int prio_to_weight[40] = {
-/* -20 */ 88818, 71054, 56843, 45475, 36380, 29104, 23283, 18626, 14901, 11921,
-/* -10 */  9537,  7629,  6103,  4883,  3906,  3125,  2500,  2000,  1600,  1280,
-/*   0 */  NICE_0_LOAD /* 1024 */,
-/*   1 */          819,   655,   524,   419,   336,   268,   215,   172,   137,
-/*  10 */   110,    87,    70,    56,    45,    36,    29,    23,    18,    15,
+ /* -20 */     88761,     71755,     56483,     46273,     36291,
+ /* -15 */     29154,     23254,     18705,     14949,     11916,
+ /* -10 */      9548,      7620,      6100,      4904,      3906,
+ /*  -5 */      3121,      2501,      1991,      1586,      1277,
+ /*   0 */      1024,       820,       655,       526,       423,
+ /*   5 */       335,       272,       215,       172,       137,
+ /*  10 */       110,        87,        70,        56,        45,
+ /*  15 */        36,        29,        23,        18,        15,
 };
 
 /*
@@ -773,42 +730,16 @@ static const int prio_to_weight[40] = {
  * into multiplications:
  */
 static const u32 prio_to_wmult[40] = {
-/* -20 */     48356,     60446,     75558,     94446,    118058,
-/* -15 */    147573,    184467,    230589,    288233,    360285,
-/* -10 */    450347,    562979,    703746,    879575,   1099582,
-/*  -5 */   1374389,   1717986,   2147483,   2684354,   3355443,
-/*   0 */   4194304,   5244160,   6557201,   8196502,  10250518,
-/*   5 */  12782640,  16025997,  19976592,  24970740,  31350126,
-/*  10 */  39045157,  49367440,  61356675,  76695844,  95443717,
-/*  15 */ 119304647, 148102320, 186737708, 238609294, 286331153,
+ /* -20 */     48388,     59856,     76040,     92818,    118348,
+ /* -15 */    147320,    184698,    229616,    287308,    360437,
+ /* -10 */    449829,    563644,    704093,    875809,   1099582,
+ /*  -5 */   1376151,   1717300,   2157191,   2708050,   3363326,
+ /*   0 */   4194304,   5237765,   6557202,   8165337,  10153587,
+ /*   5 */  12820798,  15790321,  19976592,  24970740,  31350126,
+ /*  10 */  39045157,  49367440,  61356676,  76695844,  95443717,
+ /*  15 */ 119304647, 148102320, 186737708, 238609294, 286331153,
 };
 
-static inline void
-inc_load(struct rq *rq, const struct task_struct *p, u64 now)
-{
-       update_curr_load(rq, now);
-       update_load_add(&rq->ls.load, p->se.load.weight);
-}
-
-static inline void
-dec_load(struct rq *rq, const struct task_struct *p, u64 now)
-{
-       update_curr_load(rq, now);
-       update_load_sub(&rq->ls.load, p->se.load.weight);
-}
-
-static inline void inc_nr_running(struct task_struct *p, struct rq *rq, u64 now)
-{
-       rq->nr_running++;
-       inc_load(rq, p, now);
-}
-
-static inline void dec_nr_running(struct task_struct *p, struct rq *rq, u64 now)
-{
-       rq->nr_running--;
-       dec_load(rq, p, now);
-}
-
 static void activate_task(struct rq *rq, struct task_struct *p, int wakeup);
 
 /*
@@ -826,8 +757,7 @@ static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
                      unsigned long max_nr_move, unsigned long max_load_move,
                      struct sched_domain *sd, enum cpu_idle_type idle,
                      int *all_pinned, unsigned long *load_moved,
-                     int this_best_prio, int best_prio, int best_prio_seen,
-                     struct rq_iterator *iterator);
+                     int *this_best_prio, struct rq_iterator *iterator);
 
 #include "sched_stats.h"
 #include "sched_rt.c"
@@ -839,6 +769,70 @@ static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
 
 #define sched_class_highest (&rt_sched_class)
 
+static void __update_curr_load(struct rq *rq, struct load_stat *ls)
+{
+       if (rq->curr != rq->idle && ls->load.weight) {
+               ls->delta_exec += ls->delta_stat;
+               ls->delta_fair += calc_delta_fair(ls->delta_stat, &ls->load);
+               ls->delta_stat = 0;
+       }
+}
+
+/*
+ * Update delta_exec, delta_fair fields for rq.
+ *
+ * delta_fair clock advances at a rate inversely proportional to
+ * total load (rq->ls.load.weight) on the runqueue, while
+ * delta_exec advances at the same rate as wall-clock (provided
+ * cpu is not idle).
+ *
+ * delta_exec / delta_fair is a measure of the (smoothened) load on this
+ * runqueue over any given interval. This (smoothened) load is used
+ * during load balance.
+ *
+ * This function is called /before/ updating rq->ls.load
+ * and when switching tasks.
+ */
+static void update_curr_load(struct rq *rq)
+{
+       struct load_stat *ls = &rq->ls;
+       u64 start;
+
+       start = ls->load_update_start;
+       ls->load_update_start = rq->clock;
+       ls->delta_stat += rq->clock - start;
+       /*
+        * Stagger updates to ls->delta_fair. Very frequent updates
+        * can be expensive.
+        */
+       if (ls->delta_stat >= sysctl_sched_stat_granularity)
+               __update_curr_load(rq, ls);
+}
+
+static inline void inc_load(struct rq *rq, const struct task_struct *p)
+{
+       update_curr_load(rq);
+       update_load_add(&rq->ls.load, p->se.load.weight);
+}
+
+static inline void dec_load(struct rq *rq, const struct task_struct *p)
+{
+       update_curr_load(rq);
+       update_load_sub(&rq->ls.load, p->se.load.weight);
+}
+
+static void inc_nr_running(struct task_struct *p, struct rq *rq)
+{
+       rq->nr_running++;
+       inc_load(rq, p);
+}
+
+static void dec_nr_running(struct task_struct *p, struct rq *rq)
+{
+       rq->nr_running--;
+       dec_load(rq, p);
+}
+
 static void set_load_weight(struct task_struct *p)
 {
        task_rq(p)->cfs.wait_runtime -= p->se.wait_runtime;
@@ -863,18 +857,16 @@ static void set_load_weight(struct task_struct *p)
        p->se.load.inv_weight = prio_to_wmult[p->static_prio - MAX_RT_PRIO];
 }
 
-static void
-enqueue_task(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
+static void enqueue_task(struct rq *rq, struct task_struct *p, int wakeup)
 {
        sched_info_queued(p);
-       p->sched_class->enqueue_task(rq, p, wakeup, now);
+       p->sched_class->enqueue_task(rq, p, wakeup);
        p->se.on_rq = 1;
 }
 
-static void
-dequeue_task(struct rq *rq, struct task_struct *p, int sleep, u64 now)
+static void dequeue_task(struct rq *rq, struct task_struct *p, int sleep)
 {
-       p->sched_class->dequeue_task(rq, p, sleep, now);
+       p->sched_class->dequeue_task(rq, p, sleep);
        p->se.on_rq = 0;
 }
 
@@ -929,13 +921,11 @@ static int effective_prio(struct task_struct *p)
  */
 static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
 {
-       u64 now = rq_clock(rq);
-
        if (p->state == TASK_UNINTERRUPTIBLE)
                rq->nr_uninterruptible--;
 
-       enqueue_task(rq, p, wakeup, now);
-       inc_nr_running(p, rq, now);
+       enqueue_task(rq, p, wakeup);
+       inc_nr_running(p, rq);
 }
 
 /*
@@ -943,13 +933,13 @@ static void activate_task(struct rq *rq, struct task_struct *p, int wakeup)
  */
 static inline void activate_idle_task(struct task_struct *p, struct rq *rq)
 {
-       u64 now = rq_clock(rq);
+       update_rq_clock(rq);
 
        if (p->state == TASK_UNINTERRUPTIBLE)
                rq->nr_uninterruptible--;
 
-       enqueue_task(rq, p, 0, now);
-       inc_nr_running(p, rq, now);
+       enqueue_task(rq, p, 0);
+       inc_nr_running(p, rq);
 }
 
 /*
@@ -957,13 +947,11 @@ static inline void activate_idle_task(struct task_struct *p, struct rq *rq)
  */
 static void deactivate_task(struct rq *rq, struct task_struct *p, int sleep)
 {
-       u64 now = rq_clock(rq);
-
        if (p->state == TASK_UNINTERRUPTIBLE)
                rq->nr_uninterruptible++;
 
-       dequeue_task(rq, p, sleep, now);
-       dec_nr_running(p, rq, now);
+       dequeue_task(rq, p, sleep);
+       dec_nr_running(p, rq);
 }
 
 /**
@@ -998,18 +986,21 @@ void set_task_cpu(struct task_struct *p, unsigned int new_cpu)
        u64 clock_offset, fair_clock_offset;
 
        clock_offset = old_rq->clock - new_rq->clock;
-       fair_clock_offset = old_rq->cfs.fair_clock -
-                                                new_rq->cfs.fair_clock;
-       if (p->se.wait_start)
-               p->se.wait_start -= clock_offset;
+       fair_clock_offset = old_rq->cfs.fair_clock - new_rq->cfs.fair_clock;
+
        if (p->se.wait_start_fair)
                p->se.wait_start_fair -= fair_clock_offset;
+       if (p->se.sleep_start_fair)
+               p->se.sleep_start_fair -= fair_clock_offset;
+
+#ifdef CONFIG_SCHEDSTATS
+       if (p->se.wait_start)
+               p->se.wait_start -= clock_offset;
        if (p->se.sleep_start)
                p->se.sleep_start -= clock_offset;
        if (p->se.block_start)
                p->se.block_start -= clock_offset;
-       if (p->se.sleep_start_fair)
-               p->se.sleep_start_fair -= fair_clock_offset;
+#endif
 
        __set_task_cpu(p, new_cpu);
 }
@@ -1528,6 +1519,7 @@ out_set_cpu:
 
 out_activate:
 #endif /* CONFIG_SMP */
+       update_rq_clock(rq);
        activate_task(rq, p, 1);
        /*
         * Sync wakeups (i.e. those types of wakeups where the waker
@@ -1570,17 +1562,19 @@ int fastcall wake_up_state(struct task_struct *p, unsigned int state)
 static void __sched_fork(struct task_struct *p)
 {
        p->se.wait_start_fair           = 0;
-       p->se.wait_start                = 0;
        p->se.exec_start                = 0;
        p->se.sum_exec_runtime          = 0;
        p->se.delta_exec                = 0;
        p->se.delta_fair_run            = 0;
        p->se.delta_fair_sleep          = 0;
        p->se.wait_runtime              = 0;
+       p->se.sleep_start_fair          = 0;
+
+#ifdef CONFIG_SCHEDSTATS
+       p->se.wait_start                = 0;
        p->se.sum_wait_runtime          = 0;
        p->se.sum_sleep_runtime         = 0;
        p->se.sleep_start               = 0;
-       p->se.sleep_start_fair          = 0;
        p->se.block_start               = 0;
        p->se.sleep_max                 = 0;
        p->se.block_max                 = 0;
@@ -1588,10 +1582,15 @@ static void __sched_fork(struct task_struct *p)
        p->se.wait_max                  = 0;
        p->se.wait_runtime_overruns     = 0;
        p->se.wait_runtime_underruns    = 0;
+#endif
 
        INIT_LIST_HEAD(&p->run_list);
        p->se.on_rq = 0;
 
+#ifdef CONFIG_PREEMPT_NOTIFIERS
+       INIT_HLIST_HEAD(&p->preempt_notifiers);
+#endif
+
        /*
         * We mark the process as running here, but have not actually
         * inserted it onto the runqueue yet. This guarantees that
@@ -1656,11 +1655,14 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
        rq = task_rq_lock(p, &flags);
        BUG_ON(p->state != TASK_RUNNING);
        this_cpu = smp_processor_id(); /* parent's CPU */
+       update_rq_clock(rq);
 
        p->prio = effective_prio(p);
 
-       if (!sysctl_sched_child_runs_first || (clone_flags & CLONE_VM) ||
-                       task_cpu(p) != this_cpu || !current->se.on_rq) {
+       if (!p->sched_class->task_new || !sysctl_sched_child_runs_first ||
+                       (clone_flags & CLONE_VM) || task_cpu(p) != this_cpu ||
+                       !current->se.on_rq) {
+
                activate_task(rq, p, 0);
        } else {
                /*
@@ -1668,14 +1670,74 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
                 * management (if any):
                 */
                p->sched_class->task_new(rq, p);
+               inc_nr_running(p, rq);
        }
        check_preempt_curr(rq, p);
        task_rq_unlock(rq, &flags);
 }
 
+#ifdef CONFIG_PREEMPT_NOTIFIERS
+
+/**
+ * preempt_notifier_register - tell me when current is being being preempted & rescheduled
+ * @notifier: notifier struct to register
+ */
+void preempt_notifier_register(struct preempt_notifier *notifier)
+{
+       hlist_add_head(&notifier->link, &current->preempt_notifiers);
+}
+EXPORT_SYMBOL_GPL(preempt_notifier_register);
+
+/**
+ * preempt_notifier_unregister - no longer interested in preemption notifications
+ * @notifier: notifier struct to unregister
+ *
+ * This is safe to call from within a preemption notifier.
+ */
+void preempt_notifier_unregister(struct preempt_notifier *notifier)
+{
+       hlist_del(&notifier->link);
+}
+EXPORT_SYMBOL_GPL(preempt_notifier_unregister);
+
+static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
+{
+       struct preempt_notifier *notifier;
+       struct hlist_node *node;
+
+       hlist_for_each_entry(notifier, node, &curr->preempt_notifiers, link)
+               notifier->ops->sched_in(notifier, raw_smp_processor_id());
+}
+
+static void
+fire_sched_out_preempt_notifiers(struct task_struct *curr,
+                                struct task_struct *next)
+{
+       struct preempt_notifier *notifier;
+       struct hlist_node *node;
+
+       hlist_for_each_entry(notifier, node, &curr->preempt_notifiers, link)
+               notifier->ops->sched_out(notifier, next);
+}
+
+#else
+
+static void fire_sched_in_preempt_notifiers(struct task_struct *curr)
+{
+}
+
+static void
+fire_sched_out_preempt_notifiers(struct task_struct *curr,
+                                struct task_struct *next)
+{
+}
+
+#endif
+
 /**
  * prepare_task_switch - prepare to switch tasks
  * @rq: the runqueue preparing to switch
+ * @prev: the current task that is being switched out
  * @next: the task we are going to switch to.
  *
  * This is called with the rq lock held and interrupts off. It must
@@ -1685,8 +1747,11 @@ void fastcall wake_up_new_task(struct task_struct *p, unsigned long clone_flags)
  * prepare_task_switch sets up locking and calls architecture specific
  * hooks.
  */
-static inline void prepare_task_switch(struct rq *rq, struct task_struct *next)
+static inline void
+prepare_task_switch(struct rq *rq, struct task_struct *prev,
+                   struct task_struct *next)
 {
+       fire_sched_out_preempt_notifiers(prev, next);
        prepare_lock_switch(rq, next);
        prepare_arch_switch(next);
 }
@@ -1728,6 +1793,7 @@ static inline void finish_task_switch(struct rq *rq, struct task_struct *prev)
        prev_state = prev->state;
        finish_arch_switch(prev);
        finish_lock_switch(rq, prev);
+       fire_sched_in_preempt_notifiers(current);
        if (mm)
                mmdrop(mm);
        if (unlikely(prev_state == TASK_DEAD)) {
@@ -1768,7 +1834,7 @@ context_switch(struct rq *rq, struct task_struct *prev,
 {
        struct mm_struct *mm, *oldmm;
 
-       prepare_task_switch(rq, next);
+       prepare_task_switch(rq, prev, next);
        mm = next->mm;
        oldmm = prev->active_mm;
        /*
@@ -1891,7 +1957,6 @@ static void update_cpu_load(struct rq *this_rq)
        unsigned long total_load = this_rq->ls.load.weight;
        unsigned long this_load =  total_load;
        struct load_stat *ls = &this_rq->ls;
-       u64 now = __rq_clock(this_rq);
        int i, scale;
 
        this_rq->nr_load_updates++;
@@ -1899,7 +1964,7 @@ static void update_cpu_load(struct rq *this_rq)
                goto do_avg;
 
        /* Update delta_fair/delta_exec fields first */
-       update_curr_load(this_rq, now);
+       update_curr_load(this_rq);
 
        fair_delta64 = ls->delta_fair + 1;
        ls->delta_fair = 0;
@@ -1907,8 +1972,8 @@ static void update_cpu_load(struct rq *this_rq)
        exec_delta64 = ls->delta_exec + 1;
        ls->delta_exec = 0;
 
-       sample_interval64 = now - ls->load_update_last;
-       ls->load_update_last = now;
+       sample_interval64 = this_rq->clock - ls->load_update_last;
+       ls->load_update_last = this_rq->clock;
 
        if ((s64)sample_interval64 < (s64)TICK_NSEC)
                sample_interval64 = TICK_NSEC;
@@ -1963,6 +2028,8 @@ static void double_rq_lock(struct rq *rq1, struct rq *rq2)
                        spin_lock(&rq1->lock);
                }
        }
+       update_rq_clock(rq1);
+       update_rq_clock(rq2);
 }
 
 /*
@@ -2103,8 +2170,7 @@ static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
                      unsigned long max_nr_move, unsigned long max_load_move,
                      struct sched_domain *sd, enum cpu_idle_type idle,
                      int *all_pinned, unsigned long *load_moved,
-                     int this_best_prio, int best_prio, int best_prio_seen,
-                     struct rq_iterator *iterator)
+                     int *this_best_prio, struct rq_iterator *iterator)
 {
        int pulled = 0, pinned = 0, skip_for_load;
        struct task_struct *p;
@@ -2129,12 +2195,8 @@ next:
         */
        skip_for_load = (p->se.load.weight >> 1) > rem_load_move +
                                                         SCHED_LOAD_SCALE_FUZZ;
-       if (skip_for_load && p->prio < this_best_prio)
-               skip_for_load = !best_prio_seen && p->prio == best_prio;
-       if (skip_for_load ||
+       if ((skip_for_load && p->prio >= *this_best_prio) ||
            !can_migrate_task(p, busiest, this_cpu, sd, idle, &pinned)) {
-
-               best_prio_seen |= p->prio == best_prio;
                p = iterator->next(iterator->arg);
                goto next;
        }
@@ -2148,8 +2210,8 @@ next:
         * and the prescribed amount of weighted load.
         */
        if (pulled < max_nr_move && rem_load_move > 0) {
-               if (p->prio < this_best_prio)
-                       this_best_prio = p->prio;
+               if (p->prio < *this_best_prio)
+                       *this_best_prio = p->prio;
                p = iterator->next(iterator->arg);
                goto next;
        }
@@ -2168,32 +2230,52 @@ out:
 }
 
 /*
- * move_tasks tries to move up to max_nr_move tasks and max_load_move weighted
- * load from busiest to this_rq, as part of a balancing operation within
- * "domain". Returns the number of tasks moved.
+ * move_tasks tries to move up to max_load_move weighted load from busiest to
+ * this_rq, as part of a balancing operation within domain "sd".
+ * Returns 1 if successful and 0 otherwise.
  *
  * Called with both runqueues locked.
  */
 static int move_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                     unsigned long max_nr_move, unsigned long max_load_move,
+                     unsigned long max_load_move,
                      struct sched_domain *sd, enum cpu_idle_type idle,
                      int *all_pinned)
 {
        struct sched_class *class = sched_class_highest;
-       unsigned long load_moved, total_nr_moved = 0, nr_moved;
-       long rem_load_move = max_load_move;
+       unsigned long total_load_moved = 0;
+       int this_best_prio = this_rq->curr->prio;
 
        do {
-               nr_moved = class->load_balance(this_rq, this_cpu, busiest,
-                               max_nr_move, (unsigned long)rem_load_move,
-                               sd, idle, all_pinned, &load_moved);
-               total_nr_moved += nr_moved;
-               max_nr_move -= nr_moved;
-               rem_load_move -= load_moved;
+               total_load_moved +=
+                       class->load_balance(this_rq, this_cpu, busiest,
+                               ULONG_MAX, max_load_move - total_load_moved,
+                               sd, idle, all_pinned, &this_best_prio);
                class = class->next;
-       } while (class && max_nr_move && rem_load_move > 0);
+       } while (class && max_load_move > total_load_moved);
 
-       return total_nr_moved;
+       return total_load_moved > 0;
+}
+
+/*
+ * move_one_task tries to move exactly one task from busiest to this_rq, as
+ * part of active balancing operations within "domain".
+ * Returns 1 if successful and 0 otherwise.
+ *
+ * Called with both runqueues locked.
+ */
+static int move_one_task(struct rq *this_rq, int this_cpu, struct rq *busiest,
+                        struct sched_domain *sd, enum cpu_idle_type idle)
+{
+       struct sched_class *class;
+       int this_best_prio = MAX_PRIO;
+
+       for (class = sched_class_highest; class; class = class->next)
+               if (class->load_balance(this_rq, this_cpu, busiest,
+                                       1, ULONG_MAX, sd, idle, NULL,
+                                       &this_best_prio))
+                       return 1;
+
+       return 0;
 }
 
 /*
@@ -2525,11 +2607,6 @@ find_busiest_queue(struct sched_group *group, enum cpu_idle_type idle,
  */
 #define MAX_PINNED_INTERVAL    512
 
-static inline unsigned long minus_1_or_zero(unsigned long n)
-{
-       return n > 0 ? n - 1 : 0;
-}
-
 /*
  * Check this_cpu to ensure it is balanced within domain. Attempt to move
  * tasks if there is an imbalance.
@@ -2538,7 +2615,7 @@ static int load_balance(int this_cpu, struct rq *this_rq,
                        struct sched_domain *sd, enum cpu_idle_type idle,
                        int *balance)
 {
-       int nr_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
+       int ld_moved, all_pinned = 0, active_balance = 0, sd_idle = 0;
        struct sched_group *group;
        unsigned long imbalance;
        struct rq *busiest;
@@ -2579,18 +2656,17 @@ redo:
 
        schedstat_add(sd, lb_imbalance[idle], imbalance);
 
-       nr_moved = 0;
+       ld_moved = 0;
        if (busiest->nr_running > 1) {
                /*
                 * Attempt to move tasks. If find_busiest_group has found
                 * an imbalance but busiest->nr_running <= 1, the group is
-                * still unbalanced. nr_moved simply stays zero, so it is
+                * still unbalanced. ld_moved simply stays zero, so it is
                 * correctly treated as an imbalance.
                 */
                local_irq_save(flags);
                double_rq_lock(this_rq, busiest);
-               nr_moved = move_tasks(this_rq, this_cpu, busiest,
-                                     minus_1_or_zero(busiest->nr_running),
+               ld_moved = move_tasks(this_rq, this_cpu, busiest,
                                      imbalance, sd, idle, &all_pinned);
                double_rq_unlock(this_rq, busiest);
                local_irq_restore(flags);
@@ -2598,7 +2674,7 @@ redo:
                /*
                 * some other cpu did the load balance for us.
                 */
-               if (nr_moved && this_cpu != smp_processor_id())
+               if (ld_moved && this_cpu != smp_processor_id())
                        resched_cpu(this_cpu);
 
                /* All tasks on this runqueue were pinned by CPU affinity */
@@ -2610,7 +2686,7 @@ redo:
                }
        }
 
-       if (!nr_moved) {
+       if (!ld_moved) {
                schedstat_inc(sd, lb_failed[idle]);
                sd->nr_balance_failed++;
 
@@ -2659,10 +2735,10 @@ redo:
                        sd->balance_interval *= 2;
        }
 
-       if (!nr_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
+       if (!ld_moved && !sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
            !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
                return -1;
-       return nr_moved;
+       return ld_moved;
 
 out_balanced:
        schedstat_inc(sd, lb_balanced[idle]);
@@ -2694,7 +2770,7 @@ load_balance_newidle(int this_cpu, struct rq *this_rq, struct sched_domain *sd)
        struct sched_group *group;
        struct rq *busiest = NULL;
        unsigned long imbalance;
-       int nr_moved = 0;
+       int ld_moved = 0;
        int sd_idle = 0;
        int all_pinned = 0;
        cpumask_t cpus = CPU_MASK_ALL;
@@ -2729,12 +2805,13 @@ redo:
 
        schedstat_add(sd, lb_imbalance[CPU_NEWLY_IDLE], imbalance);
 
-       nr_moved = 0;
+       ld_moved = 0;
        if (busiest->nr_running > 1) {
                /* Attempt to move tasks */
                double_lock_balance(this_rq, busiest);
-               nr_moved = move_tasks(this_rq, this_cpu, busiest,
-                                       minus_1_or_zero(busiest->nr_running),
+               /* this_rq->clock is already updated */
+               update_rq_clock(busiest);
+               ld_moved = move_tasks(this_rq, this_cpu, busiest,
                                        imbalance, sd, CPU_NEWLY_IDLE,
                                        &all_pinned);
                spin_unlock(&busiest->lock);
@@ -2746,7 +2823,7 @@ redo:
                }
        }
 
-       if (!nr_moved) {
+       if (!ld_moved) {
                schedstat_inc(sd, lb_failed[CPU_NEWLY_IDLE]);
                if (!sd_idle && sd->flags & SD_SHARE_CPUPOWER &&
                    !test_sd_parent(sd, SD_POWERSAVINGS_BALANCE))
@@ -2754,7 +2831,7 @@ redo:
        } else
                sd->nr_balance_failed = 0;
 
-       return nr_moved;
+       return ld_moved;
 
 out_balanced:
        schedstat_inc(sd, lb_balanced[CPU_NEWLY_IDLE]);
@@ -2831,6 +2908,8 @@ static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
 
        /* move a task from busiest_rq to target_rq */
        double_lock_balance(busiest_rq, target_rq);
+       update_rq_clock(busiest_rq);
+       update_rq_clock(target_rq);
 
        /* Search for an sd spanning us and the target CPU. */
        for_each_domain(target_cpu, sd) {
@@ -2842,9 +2921,8 @@ static void active_load_balance(struct rq *busiest_rq, int busiest_cpu)
        if (likely(sd)) {
                schedstat_inc(sd, alb_cnt);
 
-               if (move_tasks(target_rq, target_cpu, busiest_rq, 1,
-                              RTPRIO_TO_LOAD_WEIGHT(100), sd, CPU_IDLE,
-                              NULL))
+               if (move_one_task(target_rq, target_cpu, busiest_rq,
+                                 sd, CPU_IDLE))
                        schedstat_inc(sd, alb_pushed);
                else
                        schedstat_inc(sd, alb_failed);
@@ -3028,7 +3106,7 @@ static void run_rebalance_domains(struct softirq_action *h)
                        if (need_resched())
                                break;
 
-                       rebalance_domains(balance_cpu, SCHED_IDLE);
+                       rebalance_domains(balance_cpu, CPU_IDLE);
 
                        rq = cpu_rq(balance_cpu);
                        if (time_after(this_rq->next_balance, rq->next_balance))
@@ -3113,8 +3191,7 @@ static int balance_tasks(struct rq *this_rq, int this_cpu, struct rq *busiest,
                      unsigned long max_nr_move, unsigned long max_load_move,
                      struct sched_domain *sd, enum cpu_idle_type idle,
                      int *all_pinned, unsigned long *load_moved,
-                     int this_best_prio, int best_prio, int best_prio_seen,
-                     struct rq_iterator *iterator)
+                     int *this_best_prio, struct rq_iterator *iterator)
 {
        *load_moved = 0;
 
@@ -3140,7 +3217,8 @@ unsigned long long task_sched_runtime(struct task_struct *p)
        rq = task_rq_lock(p, &flags);
        ns = p->se.sum_exec_runtime;
        if (rq->curr == p) {
-               delta_exec = rq_clock(rq) - p->se.exec_start;
+               update_rq_clock(rq);
+               delta_exec = rq->clock - p->se.exec_start;
                if ((s64)delta_exec > 0)
                        ns += delta_exec;
        }
@@ -3234,11 +3312,19 @@ void scheduler_tick(void)
        int cpu = smp_processor_id();
        struct rq *rq = cpu_rq(cpu);
        struct task_struct *curr = rq->curr;
+       u64 next_tick = rq->tick_timestamp + TICK_NSEC;
 
        spin_lock(&rq->lock);
+       __update_rq_clock(rq);
+       /*
+        * Let rq->clock advance by at least TICK_NSEC:
+        */
+       if (unlikely(rq->clock < next_tick))
+               rq->clock = next_tick;
+       rq->tick_timestamp = rq->clock;
+       update_cpu_load(rq);
        if (curr != rq->idle) /* FIXME: needed? */
                curr->sched_class->task_tick(rq, curr);
-       update_cpu_load(rq);
        spin_unlock(&rq->lock);
 
 #ifdef CONFIG_SMP
@@ -3320,7 +3406,7 @@ static inline void schedule_debug(struct task_struct *prev)
  * Pick up the highest-prio task:
  */
 static inline struct task_struct *
-pick_next_task(struct rq *rq, struct task_struct *prev, u64 now)
+pick_next_task(struct rq *rq, struct task_struct *prev)
 {
        struct sched_class *class;
        struct task_struct *p;
@@ -3330,14 +3416,14 @@ pick_next_task(struct rq *rq, struct task_struct *prev, u64 now)
         * the fair class we can call that function directly:
         */
        if (likely(rq->nr_running == rq->cfs.nr_running)) {
-               p = fair_sched_class.pick_next_task(rq, now);
+               p = fair_sched_class.pick_next_task(rq);
                if (likely(p))
                        return p;
        }
 
        class = sched_class_highest;
        for ( ; ; ) {
-               p = class->pick_next_task(rq, now);
+               p = class->pick_next_task(rq);
                if (p)
                        return p;
                /*
@@ -3356,7 +3442,6 @@ asmlinkage void __sched schedule(void)
        struct task_struct *prev, *next;
        long *switch_count;
        struct rq *rq;
-       u64 now;
        int cpu;
 
 need_resched:
@@ -3374,6 +3459,7 @@ need_resched_nonpreemptible:
 
        spin_lock_irq(&rq->lock);
        clear_tsk_need_resched(prev);
+       __update_rq_clock(rq);
 
        if (prev->state && !(preempt_count() & PREEMPT_ACTIVE)) {
                if (unlikely((prev->state & TASK_INTERRUPTIBLE) &&
@@ -3388,9 +3474,8 @@ need_resched_nonpreemptible:
        if (unlikely(!rq->nr_running))
                idle_balance(cpu, rq);
 
-       now = __rq_clock(rq);
-       prev->sched_class->put_prev_task(rq, prev, now);
-       next = pick_next_task(rq, prev, now);
+       prev->sched_class->put_prev_task(rq, prev);
+       next = pick_next_task(rq, prev);
 
        sched_info_switch(prev, next);
 
@@ -3833,17 +3918,16 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
        unsigned long flags;
        int oldprio, on_rq;
        struct rq *rq;
-       u64 now;
 
        BUG_ON(prio < 0 || prio > MAX_PRIO);
 
        rq = task_rq_lock(p, &flags);
-       now = rq_clock(rq);
+       update_rq_clock(rq);
 
        oldprio = p->prio;
        on_rq = p->se.on_rq;
        if (on_rq)
-               dequeue_task(rq, p, 0, now);
+               dequeue_task(rq, p, 0);
 
        if (rt_prio(prio))
                p->sched_class = &rt_sched_class;
@@ -3853,7 +3937,7 @@ void rt_mutex_setprio(struct task_struct *p, int prio)
        p->prio = prio;
 
        if (on_rq) {
-               enqueue_task(rq, p, 0, now);
+               enqueue_task(rq, p, 0);
                /*
                 * Reschedule if we are currently running on this runqueue and
                 * our priority decreased, or if we are not currently running on
@@ -3876,7 +3960,6 @@ void set_user_nice(struct task_struct *p, long nice)
        int old_prio, delta, on_rq;
        unsigned long flags;
        struct rq *rq;
-       u64 now;
 
        if (TASK_NICE(p) == nice || nice < -20 || nice > 19)
                return;
@@ -3885,7 +3968,7 @@ void set_user_nice(struct task_struct *p, long nice)
         * the task might be in the middle of scheduling on another CPU.
         */
        rq = task_rq_lock(p, &flags);
-       now = rq_clock(rq);
+       update_rq_clock(rq);
        /*
         * The RT priorities are set via sched_setscheduler(), but we still
         * allow the 'normal' nice value to be set - but as expected
@@ -3898,8 +3981,8 @@ void set_user_nice(struct task_struct *p, long nice)
        }
        on_rq = p->se.on_rq;
        if (on_rq) {
-               dequeue_task(rq, p, 0, now);
-               dec_load(rq, p, now);
+               dequeue_task(rq, p, 0);
+               dec_load(rq, p);
        }
 
        p->static_prio = NICE_TO_PRIO(nice);
@@ -3909,8 +3992,8 @@ void set_user_nice(struct task_struct *p, long nice)
        delta = p->prio - old_prio;
 
        if (on_rq) {
-               enqueue_task(rq, p, 0, now);
-               inc_load(rq, p, now);
+               enqueue_task(rq, p, 0);
+               inc_load(rq, p);
                /*
                 * If the task increased its priority or is running and
                 * lowered its priority, then reschedule its CPU:
@@ -4146,6 +4229,7 @@ recheck:
                spin_unlock_irqrestore(&p->pi_lock, flags);
                goto recheck;
        }
+       update_rq_clock(rq);
        on_rq = p->se.on_rq;
        if (on_rq)
                deactivate_task(rq, p, 0);
@@ -4401,10 +4485,8 @@ long sched_getaffinity(pid_t pid, cpumask_t *mask)
 out_unlock:
        read_unlock(&tasklist_lock);
        mutex_unlock(&sched_hotcpu_mutex);
-       if (retval)
-               return retval;
 
-       return 0;
+       return retval;
 }
 
 /**
@@ -4904,6 +4986,7 @@ static int __migrate_task(struct task_struct *p, int src_cpu, int dest_cpu)
        on_rq = p->se.on_rq;
        if (on_rq)
                deactivate_task(rq_src, p, 0);
+
        set_task_cpu(p, dest_cpu);
        if (on_rq) {
                activate_task(rq_dest, p, 0);
@@ -5136,14 +5219,136 @@ static void migrate_dead_tasks(unsigned int dead_cpu)
        for ( ; ; ) {
                if (!rq->nr_running)
                        break;
-               next = pick_next_task(rq, rq->curr, rq_clock(rq));
+               update_rq_clock(rq);
+               next = pick_next_task(rq, rq->curr);
                if (!next)
                        break;
                migrate_dead(dead_cpu, next);
+
        }
 }
 #endif /* CONFIG_HOTPLUG_CPU */
 
+#if defined(CONFIG_SCHED_DEBUG) && defined(CONFIG_SYSCTL)
+
+static struct ctl_table sd_ctl_dir[] = {
+       {
+               .procname       = "sched_domain",
+               .mode           = 0755,
+       },
+       {0,},
+};
+
+static struct ctl_table sd_ctl_root[] = {
+       {
+               .procname       = "kernel",
+               .mode           = 0755,
+               .child          = sd_ctl_dir,
+       },
+       {0,},
+};
+
+static struct ctl_table *sd_alloc_ctl_entry(int n)
+{
+       struct ctl_table *entry =
+               kmalloc(n * sizeof(struct ctl_table), GFP_KERNEL);
+
+       BUG_ON(!entry);
+       memset(entry, 0, n * sizeof(struct ctl_table));
+
+       return entry;
+}
+
+static void
+set_table_entry(struct ctl_table *entry,
+               const char *procname, void *data, int maxlen,
+               mode_t mode, proc_handler *proc_handler)
+{
+       entry->procname = procname;
+       entry->data = data;
+       entry->maxlen = maxlen;
+       entry->mode = mode;
+       entry->proc_handler = proc_handler;
+}
+
+static struct ctl_table *
+sd_alloc_ctl_domain_table(struct sched_domain *sd)
+{
+       struct ctl_table *table = sd_alloc_ctl_entry(14);
+
+       set_table_entry(&table[0], "min_interval", &sd->min_interval,
+               sizeof(long), 0644, proc_doulongvec_minmax);
+       set_table_entry(&table[1], "max_interval", &sd->max_interval,
+               sizeof(long), 0644, proc_doulongvec_minmax);
+       set_table_entry(&table[2], "busy_idx", &sd->busy_idx,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[3], "idle_idx", &sd->idle_idx,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[4], "newidle_idx", &sd->newidle_idx,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[5], "wake_idx", &sd->wake_idx,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[6], "forkexec_idx", &sd->forkexec_idx,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[7], "busy_factor", &sd->busy_factor,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[8], "imbalance_pct", &sd->imbalance_pct,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[10], "cache_nice_tries",
+               &sd->cache_nice_tries,
+               sizeof(int), 0644, proc_dointvec_minmax);
+       set_table_entry(&table[12], "flags", &sd->flags,
+               sizeof(int), 0644, proc_dointvec_minmax);
+
+       return table;
+}
+
+static ctl_table *sd_alloc_ctl_cpu_table(int cpu)
+{
+       struct ctl_table *entry, *table;
+       struct sched_domain *sd;
+       int domain_num = 0, i;
+       char buf[32];
+
+       for_each_domain(cpu, sd)
+               domain_num++;
+       entry = table = sd_alloc_ctl_entry(domain_num + 1);
+
+       i = 0;
+       for_each_domain(cpu, sd) {
+               snprintf(buf, 32, "domain%d", i);
+               entry->procname = kstrdup(buf, GFP_KERNEL);
+               entry->mode = 0755;
+               entry->child = sd_alloc_ctl_domain_table(sd);
+               entry++;
+               i++;
+       }
+       return table;
+}
+
+static struct ctl_table_header *sd_sysctl_header;
+static void init_sched_domain_sysctl(void)
+{
+       int i, cpu_num = num_online_cpus();
+       struct ctl_table *entry = sd_alloc_ctl_entry(cpu_num + 1);
+       char buf[32];
+
+       sd_ctl_dir[0].child = entry;
+
+       for (i = 0; i < cpu_num; i++, entry++) {
+               snprintf(buf, 32, "cpu%d", i);
+               entry->procname = kstrdup(buf, GFP_KERNEL);
+               entry->mode = 0755;
+               entry->child = sd_alloc_ctl_cpu_table(i);
+       }
+       sd_sysctl_header = register_sysctl_table(sd_ctl_root);
+}
+#else
+static void init_sched_domain_sysctl(void)
+{
+}
+#endif
+
 /*
  * migration_call - callback that gets triggered when a CPU is added.
  * Here we can start up the necessary migration thread for the new CPU.
@@ -5200,6 +5405,7 @@ migration_call(struct notifier_block *nfb, unsigned long action, void *hcpu)
                rq->migration_thread = NULL;
                /* Idle task back to normal (off runqueue, low prio) */
                rq = task_rq_lock(rq->idle, &flags);
+               update_rq_clock(rq);
                deactivate_task(rq, rq->idle, 0);
                rq->idle->static_prio = MAX_PRIO;
                __setscheduler(rq, rq->idle, SCHED_NORMAL, 0);
@@ -6122,7 +6328,7 @@ int partition_sched_domains(cpumask_t *partition1, cpumask_t *partition2)
 }
 
 #if defined(CONFIG_SCHED_MC) || defined(CONFIG_SCHED_SMT)
-int arch_reinit_sched_domains(void)
+static int arch_reinit_sched_domains(void)
 {
        int err;
 
@@ -6151,24 +6357,6 @@ static ssize_t sched_power_savings_store(const char *buf, size_t count, int smt)
        return ret ? ret : count;
 }
 
-int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls)
-{
-       int err = 0;
-
-#ifdef CONFIG_SCHED_SMT
-       if (smt_capable())
-               err = sysfs_create_file(&cls->kset.kobj,
-                                       &attr_sched_smt_power_savings.attr);
-#endif
-#ifdef CONFIG_SCHED_MC
-       if (!err && mc_capable())
-               err = sysfs_create_file(&cls->kset.kobj,
-                                       &attr_sched_mc_power_savings.attr);
-#endif
-       return err;
-}
-#endif
-
 #ifdef CONFIG_SCHED_MC
 static ssize_t sched_mc_power_savings_show(struct sys_device *dev, char *page)
 {
@@ -6179,8 +6367,8 @@ static ssize_t sched_mc_power_savings_store(struct sys_device *dev,
 {
        return sched_power_savings_store(buf, count, 0);
 }
-SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show,
-           sched_mc_power_savings_store);
+static SYSDEV_ATTR(sched_mc_power_savings, 0644, sched_mc_power_savings_show,
+                  sched_mc_power_savings_store);
 #endif
 
 #ifdef CONFIG_SCHED_SMT
@@ -6193,8 +6381,26 @@ static ssize_t sched_smt_power_savings_store(struct sys_device *dev,
 {
        return sched_power_savings_store(buf, count, 1);
 }
-SYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show,
-           sched_smt_power_savings_store);
+static SYSDEV_ATTR(sched_smt_power_savings, 0644, sched_smt_power_savings_show,
+                  sched_smt_power_savings_store);
+#endif
+
+int sched_create_sysfs_power_savings_entries(struct sysdev_class *cls)
+{
+       int err = 0;
+
+#ifdef CONFIG_SCHED_SMT
+       if (smt_capable())
+               err = sysfs_create_file(&cls->kset.kobj,
+                                       &attr_sched_smt_power_savings.attr);
+#endif
+#ifdef CONFIG_SCHED_MC
+       if (!err && mc_capable())
+               err = sysfs_create_file(&cls->kset.kobj,
+                                       &attr_sched_mc_power_savings.attr);
+#endif
+       return err;
+}
 #endif
 
 /*
@@ -6249,6 +6455,8 @@ void __init sched_init_smp(void)
        /* XXX: Theoretical race here - CPU may be hotplugged now */
        hotcpu_notifier(update_sched_domains, 0);
 
+       init_sched_domain_sysctl();
+
        /* Move init over to a non-isolated CPU */
        if (set_cpus_allowed(current, non_isolated_cpus) < 0)
                BUG();
@@ -6335,6 +6543,10 @@ void __init sched_init(void)
 
        set_load_weight(&init_task);
 
+#ifdef CONFIG_PREEMPT_NOTIFIERS
+       INIT_HLIST_HEAD(&init_task.preempt_notifiers);
+#endif
+
 #ifdef CONFIG_SMP
        nr_cpu_ids = highest_cpu + 1;
        open_softirq(SCHED_SOFTIRQ, run_rebalance_domains, NULL);
@@ -6400,12 +6612,14 @@ void normalize_rt_tasks(void)
        do_each_thread(g, p) {
                p->se.fair_key                  = 0;
                p->se.wait_runtime              = 0;
+               p->se.exec_start                = 0;
                p->se.wait_start_fair           = 0;
+               p->se.sleep_start_fair          = 0;
+#ifdef CONFIG_SCHEDSTATS
                p->se.wait_start                = 0;
-               p->se.exec_start                = 0;
                p->se.sleep_start               = 0;
-               p->se.sleep_start_fair          = 0;
                p->se.block_start               = 0;
+#endif
                task_rq(p)->cfs.fair_clock      = 0;
                task_rq(p)->clock               = 0;
 
@@ -6429,12 +6643,13 @@ void normalize_rt_tasks(void)
                        goto out_unlock;
 #endif
 
+               update_rq_clock(rq);
                on_rq = p->se.on_rq;
                if (on_rq)
-                       deactivate_task(task_rq(p), p, 0);
+                       deactivate_task(rq, p, 0);
                __setscheduler(rq, p, SCHED_NORMAL, 0);
                if (on_rq) {
-                       activate_task(task_rq(p), p, 0);
+                       activate_task(rq, p, 0);
                        resched_task(rq->curr);
                }
 #ifdef CONFIG_SMP
index 29f2c21e7da231eec8418575e634815b39330f83..87e524762b858725207b540c2f4e51a2f230fde3 100644 (file)
  } while (0)
 
 static void
-print_task(struct seq_file *m, struct rq *rq, struct task_struct *p, u64 now)
+print_task(struct seq_file *m, struct rq *rq, struct task_struct *p)
 {
        if (rq->curr == p)
                SEQ_printf(m, "R");
        else
                SEQ_printf(m, " ");
 
-       SEQ_printf(m, "%15s %5d %15Ld %13Ld %13Ld %9Ld %5d "
-                     "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
+       SEQ_printf(m, "%15s %5d %15Ld %13Ld %13Ld %9Ld %5d ",
                p->comm, p->pid,
                (long long)p->se.fair_key,
                (long long)(p->se.fair_key - rq->cfs.fair_clock),
                (long long)p->se.wait_runtime,
                (long long)(p->nvcsw + p->nivcsw),
-               p->prio,
+               p->prio);
+#ifdef CONFIG_SCHEDSTATS
+       SEQ_printf(m, "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
                (long long)p->se.sum_exec_runtime,
                (long long)p->se.sum_wait_runtime,
                (long long)p->se.sum_sleep_runtime,
                (long long)p->se.wait_runtime_overruns,
                (long long)p->se.wait_runtime_underruns);
+#else
+       SEQ_printf(m, "%15Ld %15Ld %15Ld %15Ld %15Ld\n",
+               0LL, 0LL, 0LL, 0LL, 0LL);
+#endif
 }
 
-static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu, u64 now)
+static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu)
 {
        struct task_struct *g, *p;
 
@@ -72,7 +77,7 @@ static void print_rq(struct seq_file *m, struct rq *rq, int rq_cpu, u64 now)
                if (!p->se.on_rq || task_cpu(p) != rq_cpu)
                        continue;
 
-               print_task(m, rq, p, now);
+               print_task(m, rq, p);
        } while_each_thread(g, p);
 
        read_unlock_irq(&tasklist_lock);
@@ -101,9 +106,9 @@ print_cfs_rq_runtime_sum(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
                (long long)wait_runtime_rq_sum);
 }
 
-void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now)
+void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq)
 {
-       SEQ_printf(m, "\ncfs_rq %p\n", cfs_rq);
+       SEQ_printf(m, "\ncfs_rq\n");
 
 #define P(x) \
        SEQ_printf(m, "  .%-30s: %Ld\n", #x, (long long)(cfs_rq->x))
@@ -119,7 +124,7 @@ void print_cfs_rq(struct seq_file *m, int cpu, struct cfs_rq *cfs_rq, u64 now)
        print_cfs_rq_runtime_sum(m, cpu, cfs_rq);
 }
 
-static void print_cpu(struct seq_file *m, int cpu, u64 now)
+static void print_cpu(struct seq_file *m, int cpu)
 {
        struct rq *rq = &per_cpu(runqueues, cpu);
 
@@ -161,9 +166,9 @@ static void print_cpu(struct seq_file *m, int cpu, u64 now)
        P(cpu_load[4]);
 #undef P
 
-       print_cfs_stats(m, cpu, now);
+       print_cfs_stats(m, cpu);
 
-       print_rq(m, rq, cpu, now);
+       print_rq(m, rq, cpu);
 }
 
 static int sched_debug_show(struct seq_file *m, void *v)
@@ -171,7 +176,7 @@ static int sched_debug_show(struct seq_file *m, void *v)
        u64 now = ktime_to_ns(ktime_get());
        int cpu;
 
-       SEQ_printf(m, "Sched Debug Version: v0.05, %s %.*s\n",
+       SEQ_printf(m, "Sched Debug Version: v0.05-v20, %s %.*s\n",
                init_utsname()->release,
                (int)strcspn(init_utsname()->version, " "),
                init_utsname()->version);
@@ -179,14 +184,14 @@ static int sched_debug_show(struct seq_file *m, void *v)
        SEQ_printf(m, "now at %Lu nsecs\n", (unsigned long long)now);
 
        for_each_online_cpu(cpu)
-               print_cpu(m, cpu, now);
+               print_cpu(m, cpu);
 
        SEQ_printf(m, "\n");
 
        return 0;
 }
 
-void sysrq_sched_debug_show(void)
+static void sysrq_sched_debug_show(void)
 {
        sched_debug_show(NULL, NULL);
 }
@@ -200,7 +205,7 @@ static struct file_operations sched_debug_fops = {
        .open           = sched_debug_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 static int __init init_sched_debug_procfs(void)
@@ -235,21 +240,24 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 #define P(F) \
        SEQ_printf(m, "%-25s:%20Ld\n", #F, (long long)p->F)
 
-       P(se.wait_start);
+       P(se.wait_runtime);
        P(se.wait_start_fair);
        P(se.exec_start);
-       P(se.sleep_start);
        P(se.sleep_start_fair);
+       P(se.sum_exec_runtime);
+
+#ifdef CONFIG_SCHEDSTATS
+       P(se.wait_start);
+       P(se.sleep_start);
        P(se.block_start);
        P(se.sleep_max);
        P(se.block_max);
        P(se.exec_max);
        P(se.wait_max);
-       P(se.wait_runtime);
        P(se.wait_runtime_overruns);
        P(se.wait_runtime_underruns);
        P(se.sum_wait_runtime);
-       P(se.sum_exec_runtime);
+#endif
        SEQ_printf(m, "%-25s:%20Ld\n",
                   "nr_switches", (long long)(p->nvcsw + p->nivcsw));
        P(se.load.weight);
@@ -269,7 +277,9 @@ void proc_sched_show_task(struct task_struct *p, struct seq_file *m)
 
 void proc_sched_set_task(struct task_struct *p)
 {
+#ifdef CONFIG_SCHEDSTATS
        p->se.sleep_max = p->se.block_max = p->se.exec_max = p->se.wait_max = 0;
        p->se.wait_runtime_overruns = p->se.wait_runtime_underruns = 0;
+#endif
        p->se.sum_exec_runtime = 0;
 }
index 6971db0a716013286c713afae081b0f851e14d18..fedbb51bba96fd8ddf294a58cb9871fc8b39b06a 100644 (file)
@@ -75,7 +75,7 @@ enum {
 
 unsigned int sysctl_sched_features __read_mostly =
                SCHED_FEAT_FAIR_SLEEPERS        *1 |
-               SCHED_FEAT_SLEEPER_AVG          *1 |
+               SCHED_FEAT_SLEEPER_AVG          *0 |
                SCHED_FEAT_SLEEPER_LOAD_AVG     *1 |
                SCHED_FEAT_PRECISE_CPU_LOAD     *1 |
                SCHED_FEAT_START_DEBIT          *1 |
@@ -222,21 +222,25 @@ niced_granularity(struct sched_entity *curr, unsigned long granularity)
 {
        u64 tmp;
 
+       if (likely(curr->load.weight == NICE_0_LOAD))
+               return granularity;
        /*
-        * Negative nice levels get the same granularity as nice-0:
+        * Positive nice levels get the same granularity as nice-0:
         */
-       if (likely(curr->load.weight >= NICE_0_LOAD))
-               return granularity;
+       if (likely(curr->load.weight < NICE_0_LOAD)) {
+               tmp = curr->load.weight * (u64)granularity;
+               return (long) (tmp >> NICE_0_SHIFT);
+       }
        /*
-        * Positive nice level tasks get linearly finer
+        * Negative nice level tasks get linearly finer
         * granularity:
         */
-       tmp = curr->load.weight * (u64)granularity;
+       tmp = curr->load.inv_weight * (u64)granularity;
 
        /*
         * It will always fit into 'long':
         */
-       return (long) (tmp >> NICE_0_SHIFT);
+       return (long) (tmp >> WMULT_SHIFT);
 }
 
 static inline void
@@ -281,34 +285,28 @@ add_wait_runtime(struct cfs_rq *cfs_rq, struct sched_entity *se, long delta)
  * are not in our scheduling class.
  */
 static inline void
-__update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr, u64 now)
+__update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr)
 {
-       unsigned long delta, delta_exec, delta_fair;
-       long delta_mine;
+       unsigned long delta, delta_exec, delta_fair, delta_mine;
        struct load_weight *lw = &cfs_rq->load;
        unsigned long load = lw->weight;
 
-       if (unlikely(!load))
-               return;
-
        delta_exec = curr->delta_exec;
-#ifdef CONFIG_SCHEDSTATS
-       if (unlikely(delta_exec > curr->exec_max))
-               curr->exec_max = delta_exec;
-#endif
+       schedstat_set(curr->exec_max, max((u64)delta_exec, curr->exec_max));
 
        curr->sum_exec_runtime += delta_exec;
        cfs_rq->exec_clock += delta_exec;
 
+       if (unlikely(!load))
+               return;
+
        delta_fair = calc_delta_fair(delta_exec, lw);
        delta_mine = calc_delta_mine(delta_exec, curr->load.weight, lw);
 
-       if (cfs_rq->sleeper_bonus > sysctl_sched_stat_granularity) {
-               delta = calc_delta_mine(cfs_rq->sleeper_bonus,
-                                       curr->load.weight, lw);
-               if (unlikely(delta > cfs_rq->sleeper_bonus))
-                       delta = cfs_rq->sleeper_bonus;
-
+       if (cfs_rq->sleeper_bonus > sysctl_sched_granularity) {
+               delta = min(cfs_rq->sleeper_bonus, (u64)delta_exec);
+               delta = calc_delta_mine(delta, curr->load.weight, lw);
+               delta = min((u64)delta, cfs_rq->sleeper_bonus);
                cfs_rq->sleeper_bonus -= delta;
                delta_mine -= delta;
        }
@@ -324,7 +322,7 @@ __update_curr(struct cfs_rq *cfs_rq, struct sched_entity *curr, u64 now)
        add_wait_runtime(cfs_rq, curr, delta_mine - delta_exec);
 }
 
-static void update_curr(struct cfs_rq *cfs_rq, u64 now)
+static void update_curr(struct cfs_rq *cfs_rq)
 {
        struct sched_entity *curr = cfs_rq_curr(cfs_rq);
        unsigned long delta_exec;
@@ -337,22 +335,22 @@ static void update_curr(struct cfs_rq *cfs_rq, u64 now)
         * since the last time we changed load (this cannot
         * overflow on 32 bits):
         */
-       delta_exec = (unsigned long)(now - curr->exec_start);
+       delta_exec = (unsigned long)(rq_of(cfs_rq)->clock - curr->exec_start);
 
        curr->delta_exec += delta_exec;
 
        if (unlikely(curr->delta_exec > sysctl_sched_stat_granularity)) {
-               __update_curr(cfs_rq, curr, now);
+               __update_curr(cfs_rq, curr);
                curr->delta_exec = 0;
        }
-       curr->exec_start = now;
+       curr->exec_start = rq_of(cfs_rq)->clock;
 }
 
 static inline void
-update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+update_stats_wait_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        se->wait_start_fair = cfs_rq->fair_clock;
-       se->wait_start = now;
+       schedstat_set(se->wait_start, rq_of(cfs_rq)->clock);
 }
 
 /*
@@ -380,8 +378,7 @@ calc_weighted(unsigned long delta, unsigned long weight, int shift)
 /*
  * Task is being enqueued - update stats:
  */
-static void
-update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+static void update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        s64 key;
 
@@ -390,7 +387,7 @@ update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
         * a dequeue/enqueue event is a NOP)
         */
        if (se != cfs_rq_curr(cfs_rq))
-               update_stats_wait_start(cfs_rq, se, now);
+               update_stats_wait_start(cfs_rq, se);
        /*
         * Update the key:
         */
@@ -410,7 +407,8 @@ update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
                                        (WMULT_SHIFT - NICE_0_SHIFT);
                } else {
                        tmp = se->wait_runtime;
-                       key -= (tmp * se->load.weight) >> NICE_0_SHIFT;
+                       key -= (tmp * se->load.inv_weight) >>
+                                       (WMULT_SHIFT - NICE_0_SHIFT);
                }
        }
 
@@ -421,17 +419,12 @@ update_stats_enqueue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
  * Note: must be called with a freshly updated rq->fair_clock.
  */
 static inline void
-__update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+__update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        unsigned long delta_fair = se->delta_fair_run;
 
-#ifdef CONFIG_SCHEDSTATS
-       {
-               s64 delta_wait = now - se->wait_start;
-               if (unlikely(delta_wait > se->wait_max))
-                       se->wait_max = delta_wait;
-       }
-#endif
+       schedstat_set(se->wait_max, max(se->wait_max,
+                       rq_of(cfs_rq)->clock - se->wait_start));
 
        if (unlikely(se->load.weight != NICE_0_LOAD))
                delta_fair = calc_weighted(delta_fair, se->load.weight,
@@ -441,7 +434,7 @@ __update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
 }
 
 static void
-update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        unsigned long delta_fair;
 
@@ -451,43 +444,43 @@ update_stats_wait_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
        se->delta_fair_run += delta_fair;
        if (unlikely(abs(se->delta_fair_run) >=
                                sysctl_sched_stat_granularity)) {
-               __update_stats_wait_end(cfs_rq, se, now);
+               __update_stats_wait_end(cfs_rq, se);
                se->delta_fair_run = 0;
        }
 
        se->wait_start_fair = 0;
-       se->wait_start = 0;
+       schedstat_set(se->wait_start, 0);
 }
 
 static inline void
-update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+update_stats_dequeue(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
-       update_curr(cfs_rq, now);
+       update_curr(cfs_rq);
        /*
         * Mark the end of the wait period if dequeueing a
         * waiting task:
         */
        if (se != cfs_rq_curr(cfs_rq))
-               update_stats_wait_end(cfs_rq, se, now);
+               update_stats_wait_end(cfs_rq, se);
 }
 
 /*
  * We are picking a new current task - update its stats:
  */
 static inline void
-update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+update_stats_curr_start(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        /*
         * We are starting a new run period:
         */
-       se->exec_start = now;
+       se->exec_start = rq_of(cfs_rq)->clock;
 }
 
 /*
  * We are descheduling a task - update its stats:
  */
 static inline void
-update_stats_curr_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+update_stats_curr_end(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        se->exec_start = 0;
 }
@@ -496,8 +489,7 @@ update_stats_curr_end(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
  * Scheduling class queueing methods:
  */
 
-static void
-__enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+static void __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        unsigned long load = cfs_rq->load.weight, delta_fair;
        long prev_runtime;
@@ -527,12 +519,13 @@ __enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
         * Track the amount of bonus we've given to sleepers:
         */
        cfs_rq->sleeper_bonus += delta_fair;
+       if (unlikely(cfs_rq->sleeper_bonus > sysctl_sched_runtime_limit))
+               cfs_rq->sleeper_bonus = sysctl_sched_runtime_limit;
 
        schedstat_add(cfs_rq, wait_runtime, se->wait_runtime);
 }
 
-static void
-enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+static void enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        struct task_struct *tsk = task_of(se);
        unsigned long delta_fair;
@@ -547,7 +540,7 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
        se->delta_fair_sleep += delta_fair;
        if (unlikely(abs(se->delta_fair_sleep) >=
                                sysctl_sched_stat_granularity)) {
-               __enqueue_sleeper(cfs_rq, se, now);
+               __enqueue_sleeper(cfs_rq, se);
                se->delta_fair_sleep = 0;
        }
 
@@ -555,7 +548,7 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
 
 #ifdef CONFIG_SCHEDSTATS
        if (se->sleep_start) {
-               u64 delta = now - se->sleep_start;
+               u64 delta = rq_of(cfs_rq)->clock - se->sleep_start;
 
                if ((s64)delta < 0)
                        delta = 0;
@@ -567,7 +560,7 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
                se->sum_sleep_runtime += delta;
        }
        if (se->block_start) {
-               u64 delta = now - se->block_start;
+               u64 delta = rq_of(cfs_rq)->clock - se->block_start;
 
                if ((s64)delta < 0)
                        delta = 0;
@@ -582,26 +575,24 @@ enqueue_sleeper(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
 }
 
 static void
-enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
-              int wakeup, u64 now)
+enqueue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int wakeup)
 {
        /*
         * Update the fair clock.
         */
-       update_curr(cfs_rq, now);
+       update_curr(cfs_rq);
 
        if (wakeup)
-               enqueue_sleeper(cfs_rq, se, now);
+               enqueue_sleeper(cfs_rq, se);
 
-       update_stats_enqueue(cfs_rq, se, now);
+       update_stats_enqueue(cfs_rq, se);
        __enqueue_entity(cfs_rq, se);
 }
 
 static void
-dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
-              int sleep, u64 now)
+dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, int sleep)
 {
-       update_stats_dequeue(cfs_rq, se, now);
+       update_stats_dequeue(cfs_rq, se);
        if (sleep) {
                se->sleep_start_fair = cfs_rq->fair_clock;
 #ifdef CONFIG_SCHEDSTATS
@@ -609,9 +600,9 @@ dequeue_entity(struct cfs_rq *cfs_rq, struct sched_entity *se,
                        struct task_struct *tsk = task_of(se);
 
                        if (tsk->state & TASK_INTERRUPTIBLE)
-                               se->sleep_start = now;
+                               se->sleep_start = rq_of(cfs_rq)->clock;
                        if (tsk->state & TASK_UNINTERRUPTIBLE)
-                               se->block_start = now;
+                               se->block_start = rq_of(cfs_rq)->clock;
                }
                cfs_rq->wait_runtime -= se->wait_runtime;
 #endif
@@ -638,7 +629,7 @@ __check_preempt_curr_fair(struct cfs_rq *cfs_rq, struct sched_entity *se,
 }
 
 static inline void
-set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
+set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se)
 {
        /*
         * Any task has to be enqueued before it get to execute on
@@ -647,49 +638,46 @@ set_next_entity(struct cfs_rq *cfs_rq, struct sched_entity *se, u64 now)
         * done a put_prev_task_fair() shortly before this, which
         * updated rq->fair_clock - used by update_stats_wait_end())
         */
-       update_stats_wait_end(cfs_rq, se, now);
-       update_stats_curr_start(cfs_rq, se, now);
+       update_stats_wait_end(cfs_rq, se);
+       update_stats_curr_start(cfs_rq, se);
        set_cfs_rq_curr(cfs_rq, se);
 }
 
-static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq, u64 now)
+static struct sched_entity *pick_next_entity(struct cfs_rq *cfs_rq)
 {
        struct sched_entity *se = __pick_next_entity(cfs_rq);
 
-       set_next_entity(cfs_rq, se, now);
+       set_next_entity(cfs_rq, se);
 
        return se;
 }
 
-static void
-put_prev_entity(struct cfs_rq *cfs_rq, struct sched_entity *prev, u64 now)
+static void put_prev_entity(struct cfs_rq *cfs_rq, struct sched_entity *prev)
 {
        /*
         * If still on the runqueue then deactivate_task()
         * was not called and update_curr() has to be done:
         */
        if (prev->on_rq)
-               update_curr(cfs_rq, now);
+               update_curr(cfs_rq);
 
-       update_stats_curr_end(cfs_rq, prev, now);
+       update_stats_curr_end(cfs_rq, prev);
 
        if (prev->on_rq)
-               update_stats_wait_start(cfs_rq, prev, now);
+               update_stats_wait_start(cfs_rq, prev);
        set_cfs_rq_curr(cfs_rq, NULL);
 }
 
 static void entity_tick(struct cfs_rq *cfs_rq, struct sched_entity *curr)
 {
-       struct rq *rq = rq_of(cfs_rq);
        struct sched_entity *next;
-       u64 now = __rq_clock(rq);
 
        /*
         * Dequeue and enqueue the task to update its
         * position within the tree:
         */
-       dequeue_entity(cfs_rq, curr, 0, now);
-       enqueue_entity(cfs_rq, curr, 0, now);
+       dequeue_entity(cfs_rq, curr, 0);
+       enqueue_entity(cfs_rq, curr, 0);
 
        /*
         * Reschedule if another task tops the current one.
@@ -794,8 +782,7 @@ static inline int is_same_group(struct task_struct *curr, struct task_struct *p)
  * increased. Here we update the fair scheduling stats and
  * then put the task into the rbtree:
  */
-static void
-enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
+static void enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup)
 {
        struct cfs_rq *cfs_rq;
        struct sched_entity *se = &p->se;
@@ -804,7 +791,7 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
                if (se->on_rq)
                        break;
                cfs_rq = cfs_rq_of(se);
-               enqueue_entity(cfs_rq, se, wakeup, now);
+               enqueue_entity(cfs_rq, se, wakeup);
        }
 }
 
@@ -813,15 +800,14 @@ enqueue_task_fair(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
  * decreased. We remove the task from the rbtree and
  * update the fair scheduling stats:
  */
-static void
-dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep, u64 now)
+static void dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep)
 {
        struct cfs_rq *cfs_rq;
        struct sched_entity *se = &p->se;
 
        for_each_sched_entity(se) {
                cfs_rq = cfs_rq_of(se);
-               dequeue_entity(cfs_rq, se, sleep, now);
+               dequeue_entity(cfs_rq, se, sleep);
                /* Don't dequeue parent if it has other entities besides us */
                if (cfs_rq->load.weight)
                        break;
@@ -834,14 +820,14 @@ dequeue_task_fair(struct rq *rq, struct task_struct *p, int sleep, u64 now)
 static void yield_task_fair(struct rq *rq, struct task_struct *p)
 {
        struct cfs_rq *cfs_rq = task_cfs_rq(p);
-       u64 now = __rq_clock(rq);
 
+       __update_rq_clock(rq);
        /*
         * Dequeue and enqueue the task to update its
         * position within the tree:
         */
-       dequeue_entity(cfs_rq, &p->se, 0, now);
-       enqueue_entity(cfs_rq, &p->se, 0, now);
+       dequeue_entity(cfs_rq, &p->se, 0);
+       enqueue_entity(cfs_rq, &p->se, 0);
 }
 
 /*
@@ -854,7 +840,8 @@ static void check_preempt_curr_fair(struct rq *rq, struct task_struct *p)
        unsigned long gran;
 
        if (unlikely(rt_prio(p->prio))) {
-               update_curr(cfs_rq, rq_clock(rq));
+               update_rq_clock(rq);
+               update_curr(cfs_rq);
                resched_task(curr);
                return;
        }
@@ -870,7 +857,7 @@ static void check_preempt_curr_fair(struct rq *rq, struct task_struct *p)
                __check_preempt_curr_fair(cfs_rq, &p->se, &curr->se, gran);
 }
 
-static struct task_struct *pick_next_task_fair(struct rq *rq, u64 now)
+static struct task_struct *pick_next_task_fair(struct rq *rq)
 {
        struct cfs_rq *cfs_rq = &rq->cfs;
        struct sched_entity *se;
@@ -879,7 +866,7 @@ static struct task_struct *pick_next_task_fair(struct rq *rq, u64 now)
                return NULL;
 
        do {
-               se = pick_next_entity(cfs_rq, now);
+               se = pick_next_entity(cfs_rq);
                cfs_rq = group_cfs_rq(se);
        } while (cfs_rq);
 
@@ -889,14 +876,14 @@ static struct task_struct *pick_next_task_fair(struct rq *rq, u64 now)
 /*
  * Account for a descheduled task:
  */
-static void put_prev_task_fair(struct rq *rq, struct task_struct *prev, u64 now)
+static void put_prev_task_fair(struct rq *rq, struct task_struct *prev)
 {
        struct sched_entity *se = &prev->se;
        struct cfs_rq *cfs_rq;
 
        for_each_sched_entity(se) {
                cfs_rq = cfs_rq_of(se);
-               put_prev_entity(cfs_rq, se, now);
+               put_prev_entity(cfs_rq, se);
        }
 }
 
@@ -939,6 +926,7 @@ static struct task_struct *load_balance_next_fair(void *arg)
        return __load_balance_iterator(cfs_rq, cfs_rq->rb_load_balance_curr);
 }
 
+#ifdef CONFIG_FAIR_GROUP_SCHED
 static int cfs_rq_best_prio(struct cfs_rq *cfs_rq)
 {
        struct sched_entity *curr;
@@ -952,12 +940,13 @@ static int cfs_rq_best_prio(struct cfs_rq *cfs_rq)
 
        return p->prio;
 }
+#endif
 
-static int
+static unsigned long
 load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
-                       unsigned long max_nr_move, unsigned long max_load_move,
-                       struct sched_domain *sd, enum cpu_idle_type idle,
-                       int *all_pinned, unsigned long *total_load_moved)
+                 unsigned long max_nr_move, unsigned long max_load_move,
+                 struct sched_domain *sd, enum cpu_idle_type idle,
+                 int *all_pinned, int *this_best_prio)
 {
        struct cfs_rq *busy_cfs_rq;
        unsigned long load_moved, total_nr_moved = 0, nr_moved;
@@ -968,15 +957,14 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
        cfs_rq_iterator.next = load_balance_next_fair;
 
        for_each_leaf_cfs_rq(busiest, busy_cfs_rq) {
+#ifdef CONFIG_FAIR_GROUP_SCHED
                struct cfs_rq *this_cfs_rq;
                long imbalance;
                unsigned long maxload;
-               int this_best_prio, best_prio, best_prio_seen = 0;
 
                this_cfs_rq = cpu_cfs_rq(busy_cfs_rq, this_cpu);
 
-               imbalance = busy_cfs_rq->load.weight -
-                                                this_cfs_rq->load.weight;
+               imbalance = busy_cfs_rq->load.weight - this_cfs_rq->load.weight;
                /* Don't pull if this_cfs_rq has more load than busy_cfs_rq */
                if (imbalance <= 0)
                        continue;
@@ -985,27 +973,17 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
                imbalance /= 2;
                maxload = min(rem_load_move, imbalance);
 
-               this_best_prio = cfs_rq_best_prio(this_cfs_rq);
-               best_prio = cfs_rq_best_prio(busy_cfs_rq);
-
-               /*
-                * Enable handling of the case where there is more than one task
-                * with the best priority. If the current running task is one
-                * of those with prio==best_prio we know it won't be moved
-                * and therefore it's safe to override the skip (based on load)
-                * of any task we find with that prio.
-                */
-               if (cfs_rq_curr(busy_cfs_rq) == &busiest->curr->se)
-                       best_prio_seen = 1;
-
+               *this_best_prio = cfs_rq_best_prio(this_cfs_rq);
+#else
+# define maxload rem_load_move
+#endif
                /* pass busy_cfs_rq argument into
                 * load_balance_[start|next]_fair iterators
                 */
                cfs_rq_iterator.arg = busy_cfs_rq;
                nr_moved = balance_tasks(this_rq, this_cpu, busiest,
                                max_nr_move, maxload, sd, idle, all_pinned,
-                               &load_moved, this_best_prio, best_prio,
-                               best_prio_seen, &cfs_rq_iterator);
+                               &load_moved, this_best_prio, &cfs_rq_iterator);
 
                total_nr_moved += nr_moved;
                max_nr_move -= nr_moved;
@@ -1015,9 +993,7 @@ load_balance_fair(struct rq *this_rq, int this_cpu, struct rq *busiest,
                        break;
        }
 
-       *total_load_moved = max_load_move - rem_load_move;
-
-       return total_nr_moved;
+       return max_load_move - rem_load_move;
 }
 
 /*
@@ -1045,11 +1021,10 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
 {
        struct cfs_rq *cfs_rq = task_cfs_rq(p);
        struct sched_entity *se = &p->se;
-       u64 now = rq_clock(rq);
 
        sched_info_queued(p);
 
-       update_stats_enqueue(cfs_rq, se, now);
+       update_stats_enqueue(cfs_rq, se);
        /*
         * Child runs first: we let it run before the parent
         * until it reschedules once. We set up the key so that
@@ -1072,7 +1047,6 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
                p->se.wait_runtime = -(sysctl_sched_granularity / 2);
 
        __enqueue_entity(cfs_rq, se);
-       inc_nr_running(p, rq, now);
 }
 
 #ifdef CONFIG_FAIR_GROUP_SCHED
@@ -1083,15 +1057,10 @@ static void task_new_fair(struct rq *rq, struct task_struct *p)
  */
 static void set_curr_task_fair(struct rq *rq)
 {
-       struct task_struct *curr = rq->curr;
-       struct sched_entity *se = &curr->se;
-       u64 now = rq_clock(rq);
-       struct cfs_rq *cfs_rq;
+       struct sched_entity *se = &rq->curr.se;
 
-       for_each_sched_entity(se) {
-               cfs_rq = cfs_rq_of(se);
-               set_next_entity(cfs_rq, se, now);
-       }
+       for_each_sched_entity(se)
+               set_next_entity(cfs_rq_of(se), se);
 }
 #else
 static void set_curr_task_fair(struct rq *rq)
@@ -1120,12 +1089,11 @@ struct sched_class fair_sched_class __read_mostly = {
 };
 
 #ifdef CONFIG_SCHED_DEBUG
-void print_cfs_stats(struct seq_file *m, int cpu, u64 now)
+static void print_cfs_stats(struct seq_file *m, int cpu)
 {
-       struct rq *rq = cpu_rq(cpu);
        struct cfs_rq *cfs_rq;
 
-       for_each_leaf_cfs_rq(rq, cfs_rq)
-               print_cfs_rq(m, cpu, cfs_rq, now);
+       for_each_leaf_cfs_rq(cpu_rq(cpu), cfs_rq)
+               print_cfs_rq(m, cpu, cfs_rq);
 }
 #endif
index 41841e741c4a097fa3db58f2222308af64b6ca34..3503fb2d9f96caa0ee690ddbfaa722a573997ec0 100644 (file)
@@ -13,7 +13,7 @@ static void check_preempt_curr_idle(struct rq *rq, struct task_struct *p)
        resched_task(rq->idle);
 }
 
-static struct task_struct *pick_next_task_idle(struct rq *rq, u64 now)
+static struct task_struct *pick_next_task_idle(struct rq *rq)
 {
        schedstat_inc(rq, sched_goidle);
 
@@ -25,7 +25,7 @@ static struct task_struct *pick_next_task_idle(struct rq *rq, u64 now)
  * message if some code attempts to do it:
  */
 static void
-dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep, u64 now)
+dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep)
 {
        spin_unlock_irq(&rq->lock);
        printk(KERN_ERR "bad: scheduling from the idle thread!\n");
@@ -33,15 +33,15 @@ dequeue_task_idle(struct rq *rq, struct task_struct *p, int sleep, u64 now)
        spin_lock_irq(&rq->lock);
 }
 
-static void put_prev_task_idle(struct rq *rq, struct task_struct *prev, u64 now)
+static void put_prev_task_idle(struct rq *rq, struct task_struct *prev)
 {
 }
 
-static int
+static unsigned long
 load_balance_idle(struct rq *this_rq, int this_cpu, struct rq *busiest,
                        unsigned long max_nr_move, unsigned long max_load_move,
                        struct sched_domain *sd, enum cpu_idle_type idle,
-                       int *all_pinned, unsigned long *total_load_moved)
+                       int *all_pinned, int *this_best_prio)
 {
        return 0;
 }
index 1192a2741b996e924e7a0b21c087d3b70215a4dd..dcdcad632fd9c8a9d9e603f28e70db2acb03fbc5 100644 (file)
@@ -7,7 +7,7 @@
  * Update the current task's runtime statistics. Skip current tasks that
  * are not in our scheduling class.
  */
-static inline void update_curr_rt(struct rq *rq, u64 now)
+static inline void update_curr_rt(struct rq *rq)
 {
        struct task_struct *curr = rq->curr;
        u64 delta_exec;
@@ -15,18 +15,17 @@ static inline void update_curr_rt(struct rq *rq, u64 now)
        if (!task_has_rt_policy(curr))
                return;
 
-       delta_exec = now - curr->se.exec_start;
+       delta_exec = rq->clock - curr->se.exec_start;
        if (unlikely((s64)delta_exec < 0))
                delta_exec = 0;
-       if (unlikely(delta_exec > curr->se.exec_max))
-               curr->se.exec_max = delta_exec;
+
+       schedstat_set(curr->se.exec_max, max(curr->se.exec_max, delta_exec));
 
        curr->se.sum_exec_runtime += delta_exec;
-       curr->se.exec_start = now;
+       curr->se.exec_start = rq->clock;
 }
 
-static void
-enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
+static void enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup)
 {
        struct rt_prio_array *array = &rq->rt.active;
 
@@ -37,12 +36,11 @@ enqueue_task_rt(struct rq *rq, struct task_struct *p, int wakeup, u64 now)
 /*
  * Adding/removing a task to/from a priority array:
  */
-static void
-dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep, u64 now)
+static void dequeue_task_rt(struct rq *rq, struct task_struct *p, int sleep)
 {
        struct rt_prio_array *array = &rq->rt.active;
 
-       update_curr_rt(rq, now);
+       update_curr_rt(rq);
 
        list_del(&p->run_list);
        if (list_empty(array->queue + p->prio))
@@ -75,7 +73,7 @@ static void check_preempt_curr_rt(struct rq *rq, struct task_struct *p)
                resched_task(rq->curr);
 }
 
-static struct task_struct *pick_next_task_rt(struct rq *rq, u64 now)
+static struct task_struct *pick_next_task_rt(struct rq *rq)
 {
        struct rt_prio_array *array = &rq->rt.active;
        struct task_struct *next;
@@ -89,14 +87,14 @@ static struct task_struct *pick_next_task_rt(struct rq *rq, u64 now)
        queue = array->queue + idx;
        next = list_entry(queue->next, struct task_struct, run_list);
 
-       next->se.exec_start = now;
+       next->se.exec_start = rq->clock;
 
        return next;
 }
 
-static void put_prev_task_rt(struct rq *rq, struct task_struct *p, u64 now)
+static void put_prev_task_rt(struct rq *rq, struct task_struct *p)
 {
-       update_curr_rt(rq, now);
+       update_curr_rt(rq);
        p->se.exec_start = 0;
 }
 
@@ -172,28 +170,15 @@ static struct task_struct *load_balance_next_rt(void *arg)
        return p;
 }
 
-static int
+static unsigned long
 load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
                        unsigned long max_nr_move, unsigned long max_load_move,
                        struct sched_domain *sd, enum cpu_idle_type idle,
-                       int *all_pinned, unsigned long *load_moved)
+                       int *all_pinned, int *this_best_prio)
 {
-       int this_best_prio, best_prio, best_prio_seen = 0;
        int nr_moved;
        struct rq_iterator rt_rq_iterator;
-
-       best_prio = sched_find_first_bit(busiest->rt.active.bitmap);
-       this_best_prio = sched_find_first_bit(this_rq->rt.active.bitmap);
-
-       /*
-        * Enable handling of the case where there is more than one task
-        * with the best priority.   If the current running task is one
-        * of those with prio==best_prio we know it won't be moved
-        * and therefore it's safe to override the skip (based on load)
-        * of any task we find with that prio.
-        */
-       if (busiest->curr->prio == best_prio)
-               best_prio_seen = 1;
+       unsigned long load_moved;
 
        rt_rq_iterator.start = load_balance_start_rt;
        rt_rq_iterator.next = load_balance_next_rt;
@@ -203,11 +188,10 @@ load_balance_rt(struct rq *this_rq, int this_cpu, struct rq *busiest,
        rt_rq_iterator.arg = busiest;
 
        nr_moved = balance_tasks(this_rq, this_cpu, busiest, max_nr_move,
-                       max_load_move, sd, idle, all_pinned, load_moved,
-                       this_best_prio, best_prio, best_prio_seen,
-                       &rt_rq_iterator);
+                       max_load_move, sd, idle, all_pinned, &load_moved,
+                       this_best_prio, &rt_rq_iterator);
 
-       return nr_moved;
+       return load_moved;
 }
 
 static void task_tick_rt(struct rq *rq, struct task_struct *p)
@@ -229,15 +213,6 @@ static void task_tick_rt(struct rq *rq, struct task_struct *p)
        requeue_task_rt(rq, p);
 }
 
-/*
- * No parent/child timeslice management necessary for RT tasks,
- * just activate them:
- */
-static void task_new_rt(struct rq *rq, struct task_struct *p)
-{
-       activate_task(rq, p, 1);
-}
-
 static struct sched_class rt_sched_class __read_mostly = {
        .enqueue_task           = enqueue_task_rt,
        .dequeue_task           = dequeue_task_rt,
@@ -251,5 +226,4 @@ static struct sched_class rt_sched_class __read_mostly = {
        .load_balance           = load_balance_rt,
 
        .task_tick              = task_tick_rt,
-       .task_new               = task_new_rt,
 };
index c63c38f6fa6e588600fef2c9ce5fd8a66331740b..c20a94dda61e71c0014fc8945ba6349657e90f9a 100644 (file)
@@ -116,6 +116,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)
 }
 # define schedstat_inc(rq, field)      do { (rq)->field++; } while (0)
 # define schedstat_add(rq, field, amt) do { (rq)->field += (amt); } while (0)
+# define schedstat_set(var, val)       do { var = (val); } while (0)
 #else /* !CONFIG_SCHEDSTATS */
 static inline void
 rq_sched_info_arrive(struct rq *rq, unsigned long long delta)
@@ -125,6 +126,7 @@ rq_sched_info_depart(struct rq *rq, unsigned long long delta)
 {}
 # define schedstat_inc(rq, field)      do { } while (0)
 # define schedstat_add(rq, field, amt) do { } while (0)
+# define schedstat_set(var, val)       do { } while (0)
 #endif
 
 #if defined(CONFIG_SCHEDSTATS) || defined(CONFIG_TASK_DELAY_ACCT)
index ef8156a6aad519014c030f62e856302dacf045e7..b27c01a66448a4bee1e023ccd809b28b0b719b36 100644 (file)
@@ -1561,10 +1561,6 @@ static inline int may_ptrace_stop(void)
                    (current->ptrace & PT_ATTACHED)))
                return 0;
 
-       if (unlikely(current->signal == current->parent->signal) &&
-           unlikely(current->signal->flags & SIGNAL_GROUP_EXIT))
-               return 0;
-
        /*
         * Are we in the middle of do_coredump?
         * If so and our tracer is also part of the coredump stopping
index 08562f419768464c867537cd278ffe8b965e6bbe..449b81b98b3db5b873301ee45f68605296f118c2 100644 (file)
@@ -804,6 +804,7 @@ static void kernel_restart_prepare(char *cmd)
        blocking_notifier_call_chain(&reboot_notifier_list, SYS_RESTART, cmd);
        system_state = SYSTEM_RESTART;
        device_shutdown();
+       sysdev_shutdown();
 }
 
 /**
@@ -860,6 +861,7 @@ void kernel_shutdown_prepare(enum system_states state)
 void kernel_halt(void)
 {
        kernel_shutdown_prepare(SYSTEM_HALT);
+       sysdev_shutdown();
        printk(KERN_EMERG "System halted.\n");
        machine_halt();
 }
@@ -876,6 +878,7 @@ void kernel_power_off(void)
        kernel_shutdown_prepare(SYSTEM_POWER_OFF);
        if (pm_power_off_prepare)
                pm_power_off_prepare();
+       sysdev_shutdown();
        printk(KERN_EMERG "Power down.\n");
        machine_power_off();
 }
@@ -951,7 +954,7 @@ asmlinkage long sys_reboot(int magic1, int magic2, unsigned int cmd, void __user
                unlock_kernel();
                return -EINVAL;
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
        case LINUX_REBOOT_CMD_SW_SUSPEND:
                {
                        int ret = hibernate();
index eb26f2ba51ed33eb30f3be4c359875faad721e9f..8bdb8c07e04f60a7c299b6907bd947bbdfe3f699 100644 (file)
@@ -689,7 +689,7 @@ static ctl_table kern_table[] = {
                .proc_handler   = &proc_dointvec,
        },
 #endif
-#if defined(CONFIG_ACPI) && defined(CONFIG_X86)
+#if    defined(CONFIG_ACPI_SLEEP) && defined(CONFIG_X86)
        {
                .ctl_name       = KERN_ACPI_VIDEO_FLAGS,
                .procname       = "acpi_video_flags",
@@ -1023,6 +1023,7 @@ static ctl_table vm_table[] = {
                .mode           = 0644,
                .proc_handler   = &proc_doulongvec_minmax,
        },
+#endif
 #ifdef CONFIG_NUMA
        {
                .ctl_name       = CTL_UNNUMBERED,
@@ -1034,7 +1035,6 @@ static ctl_table vm_table[] = {
                .strategy       = &sysctl_string,
        },
 #endif
-#endif
 #if defined(CONFIG_X86_32) || \
    (defined(CONFIG_SUPERH) && defined(CONFIG_VSYSCALL))
        {
index 2ad1c37b8dfece3954796d0a6e84d92a1d5c9716..41dd3105ce7fd6846aabecb2f3d1b31410994bc4 100644 (file)
@@ -113,16 +113,6 @@ int clockevents_register_notifier(struct notifier_block *nb)
        return ret;
 }
 
-/**
- * clockevents_unregister_notifier - unregister a clock events change listener
- */
-void clockevents_unregister_notifier(struct notifier_block *nb)
-{
-       spin_lock(&clockevents_lock);
-       raw_notifier_chain_unregister(&clockevents_chain, nb);
-       spin_unlock(&clockevents_lock);
-}
-
 /*
  * Notify about a clock event change. Called with clockevents_lock
  * held.
index e5edc3a22a08d4100d57c6ca30a160b4f50c9c45..fdb2e03d4fe0d40943b72a11050fafefefbf81d9 100644 (file)
@@ -267,7 +267,7 @@ static struct file_operations timer_list_fops = {
        .open           = timer_list_open,
        .read           = seq_read,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 static int __init init_timer_list_procfs(void)
index 8ed62fda16c6c1a4b9a43f70f7bfa40da76c6157..3c38fb5eae1b4a6d5ccaab8b8b079b130af675fe 100644 (file)
@@ -399,7 +399,7 @@ static struct file_operations tstats_fops = {
        .read           = seq_read,
        .write          = tstats_write,
        .llseek         = seq_lseek,
-       .release        = seq_release,
+       .release        = single_release,
 };
 
 void __init init_timer_stats(void)
index f3e0c2abcbd060b69c879ab0e274006735f57a1e..50a94eee4d92565e2f247eac3c92ca80c7d45581 100644 (file)
@@ -349,7 +349,7 @@ config DEBUG_HIGHMEM
 config DEBUG_BUGVERBOSE
        bool "Verbose BUG() reporting (adds 70K)" if DEBUG_KERNEL && EMBEDDED
        depends on BUG
-       depends on ARM || ARM26 || AVR32 || M32R || M68K || SPARC32 || SPARC64 || FRV || SUPERH || GENERIC_BUG || BFIN
+       depends on ARM || AVR32 || M32R || M68K || SPARC32 || SPARC64 || FRV || SUPERH || GENERIC_BUG || BFIN
        default !EMBEDDED
        help
          Say Y here to make BUG() panics output the file name and line number
index 614966387402e57b26e7b9fe4fd51daa7f34f282..d9e5f1cd0bfbb4e4cedae4d68ec7af423c80fa79 100644 (file)
@@ -2,7 +2,7 @@
 # Makefile for some libs needed in the kernel.
 #
 
-lib-y := ctype.o string.o vsprintf.o cmdline.o \
+lib-y := ctype.o string.o vsprintf.o kasprintf.o cmdline.o \
         rbtree.o radix-tree.o dump_stack.o \
         idr.o int_sqrt.o bitmap.o extable.o prio_tree.o \
         sha1.o irq_regs.o reciprocal_div.o argv_split.o
index 473f5aed6caeebe88e813429a6e690e3c4ba42c9..bd5edaeaa80b8c433078e44fda273759c33b80d0 100644 (file)
@@ -145,9 +145,9 @@ EXPORT_SYMBOL(hex_dump_to_buffer);
  */
 void print_hex_dump(const char *level, const char *prefix_str, int prefix_type,
                        int rowsize, int groupsize,
-                       void *buf, size_t len, bool ascii)
+                       const void *buf, size_t len, bool ascii)
 {
-       u8 *ptr = buf;
+       const u8 *ptr = buf;
        int i, linelen, remaining = len;
        unsigned char linebuf[200];
 
@@ -189,7 +189,7 @@ EXPORT_SYMBOL(print_hex_dump);
  * rowsize of 16, groupsize of 1, and ASCII output included.
  */
 void print_hex_dump_bytes(const char *prefix_str, int prefix_type,
-                       void *buf, size_t len)
+                       const void *buf, size_t len)
 {
        print_hex_dump(KERN_DEBUG, prefix_str, prefix_type, 16, 1,
                        buf, len, 1);
index ffd61941e75d805460af6efd6944b06b839eafea..d0f1acdbfa3a6451299867f38143dce6104faf11 100644 (file)
--- a/lib/idr.c
+++ b/lib/idr.c
@@ -405,7 +405,7 @@ EXPORT_SYMBOL(idr_remove);
  */
 void idr_remove_all(struct idr *idp)
 {
-       int n, id, max, error = 0;
+       int n, id, max;
        struct idr_layer *p;
        struct idr_layer *pa[MAX_LEVEL];
        struct idr_layer **paa = &pa[0];
@@ -415,7 +415,7 @@ void idr_remove_all(struct idr *idp)
        max = 1 << n;
 
        id = 0;
-       while (id < max && !error) {
+       while (id < max) {
                while (n > IDR_BITS && p) {
                        n -= IDR_BITS;
                        *paa++ = p;
diff --git a/lib/kasprintf.c b/lib/kasprintf.c
new file mode 100644 (file)
index 0000000..c5ff1fd
--- /dev/null
@@ -0,0 +1,44 @@
+/*
+ *  linux/lib/kasprintf.c
+ *
+ *  Copyright (C) 1991, 1992  Linus Torvalds
+ */
+
+#include <stdarg.h>
+#include <linux/module.h>
+#include <linux/types.h>
+#include <linux/string.h>
+
+/* Simplified asprintf. */
+char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
+{
+       unsigned int len;
+       char *p;
+       va_list aq;
+
+       va_copy(aq, ap);
+       len = vsnprintf(NULL, 0, fmt, aq);
+       va_end(aq);
+
+       p = kmalloc(len+1, gfp);
+       if (!p)
+               return NULL;
+
+       vsnprintf(p, len+1, fmt, ap);
+
+       return p;
+}
+EXPORT_SYMBOL(kvasprintf);
+
+char *kasprintf(gfp_t gfp, const char *fmt, ...)
+{
+       va_list ap;
+       char *p;
+
+       va_start(ap, fmt);
+       p = kvasprintf(gfp, fmt, ap);
+       va_end(ap);
+
+       return p;
+}
+EXPORT_SYMBOL(kasprintf);
index 6a80c784a8fb91f43c6d5f3f833df320be3b2cbb..df02814699d747bc484b89cb22100467f82e0a91 100644 (file)
 #define BUFFER_SIZE    2048    /* buffer for the variables */
 #define NUM_ENVP       32      /* number of env pointers */
 
-#if defined(CONFIG_HOTPLUG)
-u64 uevent_seqnum;
-char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
-static DEFINE_SPINLOCK(sequence_lock);
-#if defined(CONFIG_NET)
-static struct sock *uevent_sock;
-#endif
-
 /* the strings here must match the enum in include/linux/kobject.h */
 const char *kobject_actions[] = {
        "add",
@@ -43,6 +35,14 @@ const char *kobject_actions[] = {
        "offline",
 };
 
+#if defined(CONFIG_HOTPLUG)
+u64 uevent_seqnum;
+char uevent_helper[UEVENT_HELPER_PATH_LEN] = "/sbin/hotplug";
+static DEFINE_SPINLOCK(sequence_lock);
+#if defined(CONFIG_NET)
+static struct sock *uevent_sock;
+#endif
+
 /**
  * kobject_uevent_env - send an uevent with environmental data
  *
index c935f00073e9efe02cf174d5943f976e9d1dcea9..a6040990a62ee36054794b53cc5f91379c2a3be7 100644 (file)
@@ -32,13 +32,13 @@ _lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
        ip += 4;
 
        for (;;) {
-               dindex = ((0x21 * DX3(ip, 5, 5, 6)) >> 5) & D_MASK;
+               dindex = ((size_t)(0x21 * DX3(ip, 5, 5, 6)) >> 5) & D_MASK;
                m_pos = dict[dindex];
 
                if (m_pos < in)
                        goto literal;
 
-               if (ip == m_pos || (ip - m_pos) > M4_MAX_OFFSET)
+               if (ip == m_pos || ((size_t)(ip - m_pos) > M4_MAX_OFFSET))
                        goto literal;
 
                m_off = ip - m_pos;
@@ -51,7 +51,7 @@ _lzo1x_1_do_compress(const unsigned char *in, size_t in_len,
                if (m_pos < in)
                        goto literal;
 
-               if (ip == m_pos || (ip - m_pos) > M4_MAX_OFFSET)
+               if (ip == m_pos || ((size_t)(ip - m_pos) > M4_MAX_OFFSET))
                        goto literal;
 
                m_off = ip - m_pos;
index 6b6734df6d2df692b7d3d180220f9eb663fc3142..7b481cea54ae1a9492d2c59ae3aa795b392ad28b 100644 (file)
@@ -978,38 +978,3 @@ int sscanf(const char * buf, const char * fmt, ...)
 }
 
 EXPORT_SYMBOL(sscanf);
-
-
-/* Simplified asprintf. */
-char *kvasprintf(gfp_t gfp, const char *fmt, va_list ap)
-{
-       unsigned int len;
-       char *p;
-       va_list aq;
-
-       va_copy(aq, ap);
-       len = vsnprintf(NULL, 0, fmt, aq);
-       va_end(aq);
-
-       p = kmalloc(len+1, gfp);
-       if (!p)
-               return NULL;
-
-       vsnprintf(p, len+1, fmt, ap);
-
-       return p;
-}
-EXPORT_SYMBOL(kvasprintf);
-
-char *kasprintf(gfp_t gfp, const char *fmt, ...)
-{
-       va_list ap;
-       char *p;
-
-       va_start(ap, fmt);
-       p = kvasprintf(gfp, fmt, ap);
-       va_end(ap);
-
-       return p;
-}
-EXPORT_SYMBOL(kasprintf);
index 86187221e78fdceb4c572fb310c519ba80554fdb..e24d348083c34da69472bc22a9b7025d562a3ffe 100644 (file)
@@ -116,11 +116,11 @@ config SPARSEMEM_EXTREME
 config MEMORY_HOTPLUG
        bool "Allow for memory hot-add"
        depends on SPARSEMEM || X86_64_ACPI_NUMA
-       depends on HOTPLUG && !SOFTWARE_SUSPEND && ARCH_ENABLE_MEMORY_HOTPLUG
+       depends on HOTPLUG && !HIBERNATION && ARCH_ENABLE_MEMORY_HOTPLUG
        depends on (IA64 || X86 || PPC64 || SUPERH)
 
 comment "Memory hotplug is currently incompatible with Software Suspend"
-       depends on SPARSEMEM && HOTPLUG && SOFTWARE_SUSPEND
+       depends on SPARSEMEM && HOTPLUG && HIBERNATION
 
 config MEMORY_HOTPLUG_SPARSE
        def_bool y
index 49a6fe375d01d285a172bb08fd156fb990734dde..90b657b50f81413a8452313f8a7b225888971f7b 100644 (file)
@@ -1218,26 +1218,6 @@ out:
 }
 EXPORT_SYMBOL(generic_file_aio_read);
 
-int file_send_actor(read_descriptor_t * desc, struct page *page, unsigned long offset, unsigned long size)
-{
-       ssize_t written;
-       unsigned long count = desc->count;
-       struct file *file = desc->arg.data;
-
-       if (size > count)
-               size = count;
-
-       written = file->f_op->sendpage(file, page, offset,
-                                      size, &file->f_pos, size<count);
-       if (written < 0) {
-               desc->error = written;
-               written = 0;
-       }
-       desc->count = count - written;
-       desc->written += written;
-       return written;
-}
-
 static ssize_t
 do_readahead(struct address_space *mapping, struct file *filp,
             unsigned long index, unsigned long nr)
index 34d8ada053e4562a3a7d216a544b4d9195741c16..37c73b902008e1dd2083f71995f2ce67975f6512 100644 (file)
@@ -49,9 +49,8 @@ int isolate_lru_page(struct page *page, struct list_head *pagelist)
                struct zone *zone = page_zone(page);
 
                spin_lock_irq(&zone->lru_lock);
-               if (PageLRU(page)) {
+               if (PageLRU(page) && get_page_unless_zero(page)) {
                        ret = 0;
-                       get_page(page);
                        ClearPageLRU(page);
                        if (PageActive(page))
                                del_page_from_active_list(zone, page);
@@ -632,18 +631,35 @@ static int unmap_and_move(new_page_t get_new_page, unsigned long private,
                        goto unlock;
                wait_on_page_writeback(page);
        }
-
        /*
-        * Establish migration ptes or remove ptes
+        * By try_to_unmap(), page->mapcount goes down to 0 here. In this case,
+        * we cannot notice that anon_vma is freed while we migrates a page.
+        * This rcu_read_lock() delays freeing anon_vma pointer until the end
+        * of migration. File cache pages are no problem because of page_lock()
+        */
+       rcu_read_lock();
+       /*
+        * This is a corner case handling.
+        * When a new swap-cache is read into, it is linked to LRU
+        * and treated as swapcache but has no rmap yet.
+        * Calling try_to_unmap() against a page->mapping==NULL page is
+        * BUG. So handle it here.
         */
+       if (!page->mapping)
+               goto rcu_unlock;
+       /* Establish migration ptes or remove ptes */
        try_to_unmap(page, 1);
+
        if (!page_mapped(page))
                rc = move_to_new_page(newpage, page);
 
        if (rc)
                remove_migration_ptes(page, page);
+rcu_unlock:
+       rcu_read_unlock();
 
 unlock:
+
        unlock_page(page);
 
        if (rc != -EAGAIN) {
index 7afc7a7cec6f681001817ad6656d3a20d9ed53a7..b6537211b9ccfdfcf1f7d9d63c5891ba89e483e7 100644 (file)
--- a/mm/mmap.c
+++ b/mm/mmap.c
@@ -1029,6 +1029,40 @@ unsigned long do_mmap_pgoff(struct file * file, unsigned long addr,
 }
 EXPORT_SYMBOL(do_mmap_pgoff);
 
+/*
+ * Some shared mappigns will want the pages marked read-only
+ * to track write events. If so, we'll downgrade vm_page_prot
+ * to the private version (using protection_map[] without the
+ * VM_SHARED bit).
+ */
+int vma_wants_writenotify(struct vm_area_struct *vma)
+{
+       unsigned int vm_flags = vma->vm_flags;
+
+       /* If it was private or non-writable, the write bit is already clear */
+       if ((vm_flags & (VM_WRITE|VM_SHARED)) != ((VM_WRITE|VM_SHARED)))
+               return 0;
+
+       /* The backer wishes to know when pages are first written to? */
+       if (vma->vm_ops && vma->vm_ops->page_mkwrite)
+               return 1;
+
+       /* The open routine did something to the protections already? */
+       if (pgprot_val(vma->vm_page_prot) !=
+           pgprot_val(protection_map[vm_flags &
+                   (VM_READ|VM_WRITE|VM_EXEC|VM_SHARED)]))
+               return 0;
+
+       /* Specialty mapping? */
+       if (vm_flags & (VM_PFNMAP|VM_INSERTPAGE))
+               return 0;
+
+       /* Can the mapping track the dirty pages? */
+       return vma->vm_file && vma->vm_file->f_mapping &&
+               mapping_cap_account_dirty(vma->vm_file->f_mapping);
+}
+
+
 unsigned long mmap_region(struct file *file, unsigned long addr,
                          unsigned long len, unsigned long flags,
                          unsigned int vm_flags, unsigned long pgoff,
index a7001410ab15964449f2b7188be3ecf05a9876eb..f9b82ad5047f7c7a175afc5c197108fecca48e84 100644 (file)
@@ -17,6 +17,7 @@
 
 #include <linux/oom.h>
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/sched.h>
 #include <linux/swap.h>
 #include <linux/timex.h>
@@ -156,7 +157,7 @@ unsigned long badness(struct task_struct *p, unsigned long uptime)
        }
 
 #ifdef DEBUG
-       printk(KERN_DEBUG "OOMkill: task %d (%s) got %d points\n",
+       printk(KERN_DEBUG "OOMkill: task %d (%s) got %lu points\n",
        p->pid, p->comm, points);
 #endif
        return points;
index 40954fb815988675a8b71c27cbea08c2f13f22e4..3da85b81dabb32608fa065f8086de64f725f5af8 100644 (file)
@@ -726,7 +726,7 @@ static void __drain_pages(unsigned int cpu)
        }
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_HIBERNATION
 
 void mark_free_pages(struct zone *zone)
 {
@@ -772,7 +772,7 @@ void drain_local_pages(void)
        __drain_pages(smp_processor_id());
        local_irq_restore(flags);       
 }
-#endif /* CONFIG_PM */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free a 0-order page
@@ -1350,6 +1350,10 @@ nofail_alloc:
                if (page)
                        goto got_pg;
 
+               /* The OOM killer will not help higher order allocs so fail */
+               if (order > PAGE_ALLOC_COSTLY_ORDER)
+                       goto nopage;
+
                out_of_memory(zonelist, gfp_mask, order);
                goto restart;
        }
@@ -2775,11 +2779,11 @@ unsigned long __meminit __absent_pages_in_range(int nid,
        if (i == -1)
                return 0;
 
+       prev_end_pfn = min(early_node_map[i].start_pfn, range_end_pfn);
+
        /* Account for ranges before physical memory on this node */
        if (early_node_map[i].start_pfn > range_start_pfn)
-               hole_pages = early_node_map[i].start_pfn - range_start_pfn;
-
-       prev_end_pfn = early_node_map[i].start_pfn;
+               hole_pages = prev_end_pfn - range_start_pfn;
 
        /* Find all holes for the zone within the node */
        for (; i != -1; i = next_active_region_index_in_nid(i, nid)) {
index 9b2d6178d06ce7259941c6aafa7b20cf81228e40..69d02e3e439ec260ca273d39156ca31134232e8c 100644 (file)
--- a/mm/slub.c
+++ b/mm/slub.c
@@ -211,7 +211,8 @@ static inline void ClearSlabDebug(struct page *page)
 #define MAX_OBJECTS_PER_SLAB 65535
 
 /* Internal SLUB flags */
-#define __OBJECT_POISON 0x80000000     /* Poison object */
+#define __OBJECT_POISON                0x80000000 /* Poison object */
+#define __SYSFS_ADD_DEFERRED   0x40000000 /* Not yet visible via sysfs */
 
 /* Not all arches define cache_line_size */
 #ifndef cache_line_size
@@ -1131,6 +1132,7 @@ static void __free_slab(struct kmem_cache *s, struct page *page)
                slab_pad_check(s, page);
                for_each_object(p, s, page_address(page))
                        check_object(s, page, p, 0);
+               ClearSlabDebug(page);
        }
 
        mod_zone_page_state(page_zone(page),
@@ -1169,7 +1171,6 @@ static void discard_slab(struct kmem_cache *s, struct page *page)
 
        atomic_long_dec(&n->nr_slabs);
        reset_page_mapcount(page);
-       ClearSlabDebug(page);
        __ClearPageSlab(page);
        free_slab(s, page);
 }
@@ -1656,6 +1657,7 @@ static void __always_inline slab_free(struct kmem_cache *s,
        unsigned long flags;
 
        local_irq_save(flags);
+       debug_check_no_locks_freed(object, s->objsize);
        if (likely(page == s->cpu_slab[smp_processor_id()] &&
                                                !SlabDebug(page))) {
                object[page->offset] = page->lockless_freelist;
@@ -2276,10 +2278,26 @@ panic:
 }
 
 #ifdef CONFIG_ZONE_DMA
+
+static void sysfs_add_func(struct work_struct *w)
+{
+       struct kmem_cache *s;
+
+       down_write(&slub_lock);
+       list_for_each_entry(s, &slab_caches, list) {
+               if (s->flags & __SYSFS_ADD_DEFERRED) {
+                       s->flags &= ~__SYSFS_ADD_DEFERRED;
+                       sysfs_slab_add(s);
+               }
+       }
+       up_write(&slub_lock);
+}
+
+static DECLARE_WORK(sysfs_add_work, sysfs_add_func);
+
 static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
 {
        struct kmem_cache *s;
-       struct kmem_cache *x;
        char *text;
        size_t realsize;
 
@@ -2288,22 +2306,36 @@ static noinline struct kmem_cache *dma_kmalloc_cache(int index, gfp_t flags)
                return s;
 
        /* Dynamically create dma cache */
-       x = kmalloc(kmem_size, flags & ~SLUB_DMA);
-       if (!x)
-               panic("Unable to allocate memory for dma cache\n");
+       if (flags & __GFP_WAIT)
+               down_write(&slub_lock);
+       else {
+               if (!down_write_trylock(&slub_lock))
+                       goto out;
+       }
+
+       if (kmalloc_caches_dma[index])
+               goto unlock_out;
 
        realsize = kmalloc_caches[index].objsize;
-       text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d",
-                       (unsigned int)realsize);
-       s = create_kmalloc_cache(x, text, realsize, flags);
-       down_write(&slub_lock);
-       if (!kmalloc_caches_dma[index]) {
-               kmalloc_caches_dma[index] = s;
-               up_write(&slub_lock);
-               return s;
+       text = kasprintf(flags & ~SLUB_DMA, "kmalloc_dma-%d", (unsigned int)realsize),
+       s = kmalloc(kmem_size, flags & ~SLUB_DMA);
+
+       if (!s || !text || !kmem_cache_open(s, flags, text,
+                       realsize, ARCH_KMALLOC_MINALIGN,
+                       SLAB_CACHE_DMA|__SYSFS_ADD_DEFERRED, NULL)) {
+               kfree(s);
+               kfree(text);
+               goto unlock_out;
        }
+
+       list_add(&s->list, &slab_caches);
+       kmalloc_caches_dma[index] = s;
+
+       schedule_work(&sysfs_add_work);
+
+unlock_out:
        up_write(&slub_lock);
-       kmem_cache_destroy(s);
+out:
        return kmalloc_caches_dma[index];
 }
 #endif
@@ -2499,15 +2531,11 @@ int kmem_cache_shrink(struct kmem_cache *s)
                                slab_unlock(page);
                                discard_slab(s, page);
                        } else {
-                               if (n->nr_partial > MAX_PARTIAL)
-                                       list_move(&page->lru,
-                                       slabs_by_inuse + page->inuse);
+                               list_move(&page->lru,
+                               slabs_by_inuse + page->inuse);
                        }
                }
 
-               if (n->nr_partial <= MAX_PARTIAL)
-                       goto out;
-
                /*
                 * Rebuild the partial list with the slabs filled up most
                 * first and the least used slabs at the end.
@@ -2515,7 +2543,6 @@ int kmem_cache_shrink(struct kmem_cache *s)
                for (i = s->objects - 1; i >= 0; i--)
                        list_splice(slabs_by_inuse + i, n->partial.prev);
 
-       out:
                spin_unlock_irqrestore(&n->list_lock, flags);
        }
 
index 7ff0a81c7b016fc6957288c342eebdd697d020dc..f071648e1360823d06e83b1951a77f1c53a5f998 100644 (file)
@@ -425,7 +425,7 @@ void free_swap_and_cache(swp_entry_t entry)
        }
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Find the swap type that corresponds to given device (if any).
  *
@@ -951,7 +951,7 @@ sector_t map_swap_page(struct swap_info_struct *sis, pgoff_t offset)
        }
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#ifdef CONFIG_HIBERNATION
 /*
  * Get the (PAGE_SIZE) block corresponding to given offset on the swapdev
  * corresponding to given index in swap_info (swap type).
@@ -966,7 +966,7 @@ sector_t swapdev_block(int swap_type, pgoff_t offset)
        sis = swap_info + swap_type;
        return (sis->flags & SWP_WRITEOK) ? map_swap_page(sis, offset) : 0;
 }
-#endif /* CONFIG_SOFTWARE_SUSPEND */
+#endif /* CONFIG_HIBERNATION */
 
 /*
  * Free all of a swapdev's extent information
index fadf791cd7e6828e3a778f7e636786a4dd6c2cbd..c64d169537bfcfe65fc963b009779de85c9b051a 100644 (file)
@@ -10,6 +10,7 @@
  */
 
 #include <linux/mm.h>
+#include <linux/err.h>
 #include <linux/module.h>
 #include <linux/cpu.h>
 #include <linux/sched.h>
index 4d2aa4dd42ac6d78a3cacd458cdc5da59de30907..4bab322c9f8f9266e7c5fe4c5cb4ac7c63257757 100644 (file)
@@ -668,9 +668,6 @@ int vlan_dev_ioctl(struct net_device *dev, struct ifreq *ifr, int cmd)
                if (real_dev->do_ioctl && netif_device_present(real_dev))
                        err = real_dev->do_ioctl(real_dev, &ifrr, cmd);
                break;
-
-       case SIOCETHTOOL:
-               err = dev_ethtool(&ifrr);
        }
 
        if (!err)
index 37451178e7618013eb38ab7c2f9fae79308b3391..f2a041cb508a146264c9230368fa15acdcf9050b 100644 (file)
@@ -763,6 +763,7 @@ struct p9_fcall *p9_create_twrite(u32 fid, u64 offset, u32 count,
        if (err) {
                kfree(fc);
                fc = ERR_PTR(err);
+               goto error;
        }
 
        if (buf_check_overflow(bufp)) {
index 2770fb451ae87dbe089cc32a16eef523fb18a374..59d5aa3366f229636ec7ca7a1ab8d821e8d97b41 100644 (file)
@@ -21,7 +21,6 @@
 #include <net/dst.h>
 #include <linux/proc_fs.h>
 #include <linux/spinlock.h>
-#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 
 /* TokenRing if needed */
index 670ff95ca64b1b30048ce72eb82584ca5b17baa3..c4e4ce4ebb2b1115c6c92b07079fa6be7647c589 100644 (file)
@@ -353,7 +353,7 @@ static inline int l2cap_send_cmd(struct l2cap_conn *conn, u8 ident, u8 code, u16
 }
 
 /* ---- Socket interface ---- */
-static struct sock *__l2cap_get_sock_by_addr(u16 psm, bdaddr_t *src)
+static struct sock *__l2cap_get_sock_by_addr(__le16 psm, bdaddr_t *src)
 {
        struct sock *sk;
        struct hlist_node *node;
@@ -368,7 +368,7 @@ found:
 /* Find socket with psm and source bdaddr.
  * Returns closest match.
  */
-static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src)
+static struct sock *__l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
 {
        struct sock *sk = NULL, *sk1 = NULL;
        struct hlist_node *node;
@@ -392,7 +392,7 @@ static struct sock *__l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src)
 
 /* Find socket with given address (psm, src).
  * Returns locked socket */
-static inline struct sock *l2cap_get_sock_by_psm(int state, u16 psm, bdaddr_t *src)
+static inline struct sock *l2cap_get_sock_by_psm(int state, __le16 psm, bdaddr_t *src)
 {
        struct sock *s;
        read_lock(&l2cap_sk_list.lock);
@@ -586,7 +586,7 @@ static int l2cap_sock_bind(struct socket *sock, struct sockaddr *addr, int addr_
                goto done;
        }
 
-       if (la->l2_psm > 0 && btohs(la->l2_psm) < 0x1001 &&
+       if (la->l2_psm && btohs(la->l2_psm) < 0x1001 &&
                                !capable(CAP_NET_BIND_SERVICE)) {
                err = -EACCES;
                goto done;
@@ -748,7 +748,7 @@ static int l2cap_sock_listen(struct socket *sock, int backlog)
                write_lock_bh(&l2cap_sk_list.lock);
 
                for (psm = 0x1001; psm < 0x1100; psm += 2)
-                       if (!__l2cap_get_sock_by_addr(psm, src)) {
+                       if (!__l2cap_get_sock_by_addr(htobs(psm), src)) {
                                l2cap_pi(sk)->psm   = htobs(psm);
                                l2cap_pi(sk)->sport = htobs(psm);
                                err = 0;
@@ -873,7 +873,7 @@ static inline int l2cap_do_send(struct sock *sk, struct msghdr *msg, int len)
        lh->len = cpu_to_le16(len + (hlen - L2CAP_HDR_SIZE));
 
        if (sk->sk_type == SOCK_DGRAM)
-               put_unaligned(l2cap_pi(sk)->psm, (u16 *) skb_put(skb, 2));
+               put_unaligned(l2cap_pi(sk)->psm, (__le16 *) skb_put(skb, 2));
 
        if (memcpy_fromiovec(skb_put(skb, count), msg->msg_iov, count)) {
                err = -EFAULT;
@@ -1256,11 +1256,11 @@ static inline int l2cap_get_conf_opt(void **ptr, int *type, int *olen, unsigned
                break;
 
        case 2:
-               *val = __le16_to_cpu(*((u16 *)opt->val));
+               *val = __le16_to_cpu(*((__le16 *)opt->val));
                break;
 
        case 4:
-               *val = __le32_to_cpu(*((u32 *)opt->val));
+               *val = __le32_to_cpu(*((__le32 *)opt->val));
                break;
 
        default:
@@ -1287,11 +1287,11 @@ static void l2cap_add_conf_opt(void **ptr, u8 type, u8 len, unsigned long val)
                break;
 
        case 2:
-               *((u16 *) opt->val) = cpu_to_le16(val);
+               *((__le16 *) opt->val) = cpu_to_le16(val);
                break;
 
        case 4:
-               *((u32 *) opt->val) = cpu_to_le32(val);
+               *((__le32 *) opt->val) = cpu_to_le32(val);
                break;
 
        default:
@@ -1406,7 +1406,7 @@ static inline int l2cap_connect_req(struct l2cap_conn *conn, struct l2cap_cmd_hd
        int result = 0, status = 0;
 
        u16 dcid = 0, scid = __le16_to_cpu(req->scid);
-       u16 psm  = req->psm;
+       __le16 psm  = req->psm;
 
        BT_DBG("psm 0x%2.2x scid 0x%4.4x", psm, scid);
 
@@ -1530,7 +1530,7 @@ static inline int l2cap_connect_rsp(struct l2cap_conn *conn, struct l2cap_cmd_hd
        return 0;
 }
 
-static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u8 *data)
+static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr *cmd, u16 cmd_len, u8 *data)
 {
        struct l2cap_conf_req *req = (struct l2cap_conf_req *) data;
        u16 dcid, flags;
@@ -1550,7 +1550,7 @@ static inline int l2cap_config_req(struct l2cap_conn *conn, struct l2cap_cmd_hdr
                goto unlock;
 
        /* Reject if config buffer is too small. */
-       len = cmd->len - sizeof(*req);
+       len = cmd_len - sizeof(*req);
        if (l2cap_pi(sk)->conf_len + len > sizeof(l2cap_pi(sk)->conf_req)) {
                l2cap_send_cmd(conn, cmd->ident, L2CAP_CONF_RSP,
                                l2cap_build_conf_rsp(sk, rsp,
@@ -1748,15 +1748,16 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
        l2cap_raw_recv(conn, skb);
 
        while (len >= L2CAP_CMD_HDR_SIZE) {
+               u16 cmd_len;
                memcpy(&cmd, data, L2CAP_CMD_HDR_SIZE);
                data += L2CAP_CMD_HDR_SIZE;
                len  -= L2CAP_CMD_HDR_SIZE;
 
-               cmd.len = __le16_to_cpu(cmd.len);
+               cmd_len = le16_to_cpu(cmd.len);
 
-               BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd.len, cmd.ident);
+               BT_DBG("code 0x%2.2x len %d id 0x%2.2x", cmd.code, cmd_len, cmd.ident);
 
-               if (cmd.len > len || !cmd.ident) {
+               if (cmd_len > len || !cmd.ident) {
                        BT_DBG("corrupted command");
                        break;
                }
@@ -1775,7 +1776,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
                        break;
 
                case L2CAP_CONF_REQ:
-                       err = l2cap_config_req(conn, &cmd, data);
+                       err = l2cap_config_req(conn, &cmd, cmd_len, data);
                        break;
 
                case L2CAP_CONF_RSP:
@@ -1791,7 +1792,7 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
                        break;
 
                case L2CAP_ECHO_REQ:
-                       l2cap_send_cmd(conn, cmd.ident, L2CAP_ECHO_RSP, cmd.len, data);
+                       l2cap_send_cmd(conn, cmd.ident, L2CAP_ECHO_RSP, cmd_len, data);
                        break;
 
                case L2CAP_ECHO_RSP:
@@ -1820,8 +1821,8 @@ static inline void l2cap_sig_channel(struct l2cap_conn *conn, struct sk_buff *sk
                        l2cap_send_cmd(conn, cmd.ident, L2CAP_COMMAND_REJ, sizeof(rej), &rej);
                }
 
-               data += cmd.len;
-               len  -= cmd.len;
+               data += cmd_len;
+               len  -= cmd_len;
        }
 
        kfree_skb(skb);
@@ -1863,7 +1864,7 @@ done:
        return 0;
 }
 
-static inline int l2cap_conless_channel(struct l2cap_conn *conn, u16 psm, struct sk_buff *skb)
+static inline int l2cap_conless_channel(struct l2cap_conn *conn, __le16 psm, struct sk_buff *skb)
 {
        struct sock *sk;
 
@@ -1893,7 +1894,8 @@ done:
 static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
 {
        struct l2cap_hdr *lh = (void *) skb->data;
-       u16 cid, psm, len;
+       u16 cid, len;
+       __le16 psm;
 
        skb_pull(skb, L2CAP_HDR_SIZE);
        cid = __le16_to_cpu(lh->cid);
@@ -1907,7 +1909,7 @@ static void l2cap_recv_frame(struct l2cap_conn *conn, struct sk_buff *skb)
                break;
 
        case 0x0002:
-               psm = get_unaligned((u16 *) skb->data);
+               psm = get_unaligned((__le16 *) skb->data);
                skb_pull(skb, 2);
                l2cap_conless_channel(conn, psm, skb);
                break;
index 23ba61a13bdd7a2260889b191ced54c0a658a452..22a832098d44057e120ae76cecda07ae2d48ca00 100644 (file)
@@ -267,7 +267,7 @@ static int rfcomm_dev_add(struct rfcomm_dev_req *req, struct rfcomm_dlc *dlc)
 out:
        write_unlock_bh(&rfcomm_dev_lock);
 
-       if (err) {
+       if (err < 0) {
                kfree(dev);
                return err;
        }
@@ -275,9 +275,10 @@ out:
        dev->tty_dev = tty_register_device(rfcomm_tty_driver, dev->id, NULL);
 
        if (IS_ERR(dev->tty_dev)) {
+               err = PTR_ERR(dev->tty_dev);
                list_del(&dev->list);
                kfree(dev);
-               return PTR_ERR(dev->tty_dev);
+               return err;
        }
 
        return dev->id;
index 5e1892d8d874a0eaa8a95c5a697285b11dc25163..0eded176ce99bfa0aa3dd352d8e676b3067d257b 100644 (file)
@@ -179,5 +179,5 @@ void br_dev_setup(struct net_device *dev)
        dev->priv_flags = IFF_EBRIDGE;
 
        dev->features = NETIF_F_SG | NETIF_F_FRAGLIST | NETIF_F_HIGHDMA |
-                       NETIF_F_TSO | NETIF_F_NO_CSUM | NETIF_F_GSO_ROBUST;
+                       NETIF_F_GSO_MASK | NETIF_F_NO_CSUM | NETIF_F_LLTX;
 }
index 7b4ce9113be2e7dafb201ba47ea724e08bb2abb4..749f0e8f541d124f1975e6e6aa5a1e8d06ddb439 100644 (file)
  * Determine initial path cost based on speed.
  * using recommendations from 802.1d standard
  *
- * Need to simulate user ioctl because not all device's that support
- * ethtool, use ethtool_ops.  Also, since driver might sleep need to
- * not be holding any locks.
+ * Since driver might sleep need to not be holding any locks.
  */
 static int port_cost(struct net_device *dev)
 {
-       struct ethtool_cmd ecmd = { ETHTOOL_GSET };
-       struct ifreq ifr;
-       mm_segment_t old_fs;
-       int err;
-
-       strncpy(ifr.ifr_name, dev->name, IFNAMSIZ);
-       ifr.ifr_data = (void __user *) &ecmd;
-
-       old_fs = get_fs();
-       set_fs(KERNEL_DS);
-       err = dev_ethtool(&ifr);
-       set_fs(old_fs);
-
-       if (!err) {
-               switch(ecmd.speed) {
-               case SPEED_100:
-                       return 19;
-               case SPEED_1000:
-                       return 4;
-               case SPEED_10000:
-                       return 2;
-               case SPEED_10:
-                       return 100;
+       if (dev->ethtool_ops->get_settings) {
+               struct ethtool_cmd ecmd = { ETHTOOL_GSET };
+               int err = dev->ethtool_ops->get_settings(dev, &ecmd);
+               if (!err) {
+                       switch(ecmd.speed) {
+                       case SPEED_100:
+                               return 19;
+                       case SPEED_1000:
+                               return 4;
+                       case SPEED_10000:
+                               return 2;
+                       case SPEED_10:
+                               return 100;
+                       }
                }
        }
 
@@ -360,43 +349,15 @@ int br_min_mtu(const struct net_bridge *br)
 void br_features_recompute(struct net_bridge *br)
 {
        struct net_bridge_port *p;
-       unsigned long features, checksum;
+       unsigned long features;
 
-       checksum = br->feature_mask & NETIF_F_ALL_CSUM ? NETIF_F_NO_CSUM : 0;
-       features = br->feature_mask & ~NETIF_F_ALL_CSUM;
+       features = br->feature_mask;
 
        list_for_each_entry(p, &br->port_list, list) {
-               unsigned long feature = p->dev->features;
-
-               /* if device needs checksumming, downgrade to hw checksumming */
-               if (checksum & NETIF_F_NO_CSUM && !(feature & NETIF_F_NO_CSUM))
-                       checksum ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
-
-               /* if device can't do all checksum, downgrade to ipv4/ipv6 */
-               if (checksum & NETIF_F_HW_CSUM && !(feature & NETIF_F_HW_CSUM))
-                       checksum ^= NETIF_F_HW_CSUM
-                               | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
-
-               if (checksum & NETIF_F_IPV6_CSUM && !(feature & NETIF_F_IPV6_CSUM))
-                       checksum &= ~NETIF_F_IPV6_CSUM;
-
-               if (!(feature & NETIF_F_IP_CSUM))
-                       checksum = 0;
-
-               if (feature & NETIF_F_GSO)
-                       feature |= NETIF_F_GSO_SOFTWARE;
-               feature |= NETIF_F_GSO;
-
-               features &= feature;
+               features = netdev_compute_features(features, p->dev->features);
        }
 
-       if (!(checksum & NETIF_F_ALL_CSUM))
-               features &= ~NETIF_F_SG;
-       if (!(features & NETIF_F_SG))
-               features &= ~NETIF_F_GSO_MASK;
-
-       br->dev->features = features | checksum | NETIF_F_LLTX |
-                           NETIF_F_GSO_ROBUST;
+       br->dev->features = features;
 }
 
 /* called with RTNL */
index 420bbb9955e93fa2480393292e7b2705d1cc7a28..5c18595b7616602b7f987b80be7f3ce403617549 100644 (file)
@@ -112,9 +112,9 @@ static int br_handle_local_finish(struct sk_buff *skb)
  */
 static inline int is_link_local(const unsigned char *dest)
 {
-       const u16 *a = (const u16 *) dest;
-       static const u16 *const b = (const u16 *const ) br_group_address;
-       static const u16 m = __constant_cpu_to_be16(0xfff0);
+       __be16 *a = (__be16 *)dest;
+       static const __be16 *b = (const __be16 *)br_group_address;
+       static const __be16 m = __constant_cpu_to_be16(0xfff0);
 
        return ((a[0] ^ b[0]) | (a[1] ^ b[1]) | ((a[2] ^ b[2]) & m)) == 0;
 }
index ee4035571c21b55e119bbf4c6c2f6f1a4ee085ab..a76021c71207a6bf4578cc4995412e68eca18bba 100644 (file)
@@ -817,7 +817,9 @@ int dev_alloc_name(struct net_device *dev, const char *name)
  */
 int dev_change_name(struct net_device *dev, char *newname)
 {
+       char oldname[IFNAMSIZ];
        int err = 0;
+       int ret;
 
        ASSERT_RTNL();
 
@@ -827,6 +829,8 @@ int dev_change_name(struct net_device *dev, char *newname)
        if (!dev_valid_name(newname))
                return -EINVAL;
 
+       memcpy(oldname, dev->name, IFNAMSIZ);
+
        if (strchr(newname, '%')) {
                err = dev_alloc_name(dev, newname);
                if (err < 0)
@@ -838,10 +842,28 @@ int dev_change_name(struct net_device *dev, char *newname)
        else
                strlcpy(dev->name, newname, IFNAMSIZ);
 
+rollback:
        device_rename(&dev->dev, dev->name);
+
+       write_lock_bh(&dev_base_lock);
        hlist_del(&dev->name_hlist);
        hlist_add_head(&dev->name_hlist, dev_name_hash(dev->name));
-       raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
+       write_unlock_bh(&dev_base_lock);
+
+       ret = raw_notifier_call_chain(&netdev_chain, NETDEV_CHANGENAME, dev);
+       ret = notifier_to_errno(ret);
+
+       if (ret) {
+               if (err) {
+                       printk(KERN_ERR
+                              "%s: name change rollback failed: %d.\n",
+                              dev->name, ret);
+               } else {
+                       err = ret;
+                       memcpy(dev->name, oldname, IFNAMSIZ);
+                       goto rollback;
+               }
+       }
 
        return err;
 }
@@ -1054,20 +1076,43 @@ int dev_close(struct net_device *dev)
 int register_netdevice_notifier(struct notifier_block *nb)
 {
        struct net_device *dev;
+       struct net_device *last;
        int err;
 
        rtnl_lock();
        err = raw_notifier_chain_register(&netdev_chain, nb);
-       if (!err) {
-               for_each_netdev(dev) {
-                       nb->notifier_call(nb, NETDEV_REGISTER, dev);
+       if (err)
+               goto unlock;
 
-                       if (dev->flags & IFF_UP)
-                               nb->notifier_call(nb, NETDEV_UP, dev);
-               }
+       for_each_netdev(dev) {
+               err = nb->notifier_call(nb, NETDEV_REGISTER, dev);
+               err = notifier_to_errno(err);
+               if (err)
+                       goto rollback;
+
+               if (!(dev->flags & IFF_UP))
+                       continue;
+
+               nb->notifier_call(nb, NETDEV_UP, dev);
        }
+
+unlock:
        rtnl_unlock();
        return err;
+
+rollback:
+       last = dev;
+       for_each_netdev(dev) {
+               if (dev == last)
+                       break;
+
+               if (dev->flags & IFF_UP) {
+                       nb->notifier_call(nb, NETDEV_GOING_DOWN, dev);
+                       nb->notifier_call(nb, NETDEV_DOWN, dev);
+               }
+               nb->notifier_call(nb, NETDEV_UNREGISTER, dev);
+       }
+       goto unlock;
 }
 
 /**
@@ -2718,9 +2763,11 @@ int __dev_addr_add(struct dev_addr_list **list, int *count,
 /**
  *     dev_unicast_delete      - Release secondary unicast address.
  *     @dev: device
+ *     @addr: address to delete
+ *     @alen: length of @addr
  *
  *     Release reference to a secondary unicast address and remove it
- *     from the device if the reference count drop to zero.
+ *     from the device if the reference count drops to zero.
  *
  *     The caller must hold the rtnl_mutex.
  */
@@ -2742,6 +2789,8 @@ EXPORT_SYMBOL(dev_unicast_delete);
 /**
  *     dev_unicast_add         - add a secondary unicast address
  *     @dev: device
+ *     @addr: address to delete
+ *     @alen: length of @addr
  *
  *     Add a secondary unicast address to the device or increase
  *     the reference count if it already exists.
@@ -3333,7 +3382,7 @@ int register_netdevice(struct net_device *dev)
 
        if (!dev_valid_name(dev->name)) {
                ret = -EINVAL;
-               goto out;
+               goto err_uninit;
        }
 
        dev->ifindex = dev_new_index();
@@ -3347,7 +3396,7 @@ int register_netdevice(struct net_device *dev)
                        = hlist_entry(p, struct net_device, name_hlist);
                if (!strncmp(d->name, dev->name, IFNAMSIZ)) {
                        ret = -EEXIST;
-                       goto out;
+                       goto err_uninit;
                }
        }
 
@@ -3407,7 +3456,7 @@ int register_netdevice(struct net_device *dev)
 
        ret = netdev_register_sysfs(dev);
        if (ret)
-               goto out;
+               goto err_uninit;
        dev->reg_state = NETREG_REGISTERED;
 
        /*
@@ -3426,12 +3475,18 @@ int register_netdevice(struct net_device *dev)
        write_unlock_bh(&dev_base_lock);
 
        /* Notify protocols, that a new device appeared. */
-       raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
-
-       ret = 0;
+       ret = raw_notifier_call_chain(&netdev_chain, NETDEV_REGISTER, dev);
+       ret = notifier_to_errno(ret);
+       if (ret)
+               unregister_netdevice(dev);
 
 out:
        return ret;
+
+err_uninit:
+       if (dev->uninit)
+               dev->uninit(dev);
+       goto out;
 }
 
 /**
@@ -3830,9 +3885,11 @@ static int dev_cpu_callback(struct notifier_block *nfb,
 
 #ifdef CONFIG_NET_DMA
 /**
- * net_dma_rebalance -
- * This is called when the number of channels allocated to the net_dma_client
- * changes.  The net_dma_client tries to have one DMA channel per CPU.
+ * net_dma_rebalance - try to maintain one DMA channel per CPU
+ * @net_dma: DMA client and associated data (lock, channels, channel_mask)
+ *
+ * This is called when the number of channels allocated to the net_dma client
+ * changes.  The net_dma client tries to have one DMA channel per CPU.
  */
 
 static void net_dma_rebalance(struct net_dma *net_dma)
@@ -3869,7 +3926,7 @@ static void net_dma_rebalance(struct net_dma *net_dma)
  * netdev_dma_event - event callback for the net_dma_client
  * @client: should always be net_dma_client
  * @chan: DMA channel for the event
- * @event: event type
+ * @state: DMA state to be handled
  */
 static enum dma_state_client
 netdev_dma_event(struct dma_client *client, struct dma_chan *chan,
@@ -3936,6 +3993,45 @@ static int __init netdev_dma_register(void)
 static int __init netdev_dma_register(void) { return -ENODEV; }
 #endif /* CONFIG_NET_DMA */
 
+/**
+ *     netdev_compute_feature - compute conjunction of two feature sets
+ *     @all: first feature set
+ *     @one: second feature set
+ *
+ *     Computes a new feature set after adding a device with feature set
+ *     @one to the master device with current feature set @all.  Returns
+ *     the new feature set.
+ */
+int netdev_compute_features(unsigned long all, unsigned long one)
+{
+       /* if device needs checksumming, downgrade to hw checksumming */
+       if (all & NETIF_F_NO_CSUM && !(one & NETIF_F_NO_CSUM))
+               all ^= NETIF_F_NO_CSUM | NETIF_F_HW_CSUM;
+
+       /* if device can't do all checksum, downgrade to ipv4/ipv6 */
+       if (all & NETIF_F_HW_CSUM && !(one & NETIF_F_HW_CSUM))
+               all ^= NETIF_F_HW_CSUM
+                       | NETIF_F_IP_CSUM | NETIF_F_IPV6_CSUM;
+
+       if (one & NETIF_F_GSO)
+               one |= NETIF_F_GSO_SOFTWARE;
+       one |= NETIF_F_GSO;
+
+       /* If even one device supports robust GSO, enable it for all. */
+       if (one & NETIF_F_GSO_ROBUST)
+               all |= NETIF_F_GSO_ROBUST;
+
+       all &= one | NETIF_F_LLTX;
+
+       if (!(all & NETIF_F_ALL_CSUM))
+               all &= ~NETIF_F_SG;
+       if (!(all & NETIF_F_SG))
+               all &= ~NETIF_F_GSO_MASK;
+
+       return all;
+}
+EXPORT_SYMBOL(netdev_compute_features);
+
 /*
  *     Initialize the DEV module. At boot time this walks the device list and
  *     unhooks any devices that fail to initialise (normally hardware not
index 0b531e98ec3355c34f837cea2551965abd09d48a..2ab0a60046a5ca9c65a13164f10180a8f8833ced 100644 (file)
@@ -3,10 +3,12 @@
  * Copyright (c) 2003 Matthew Wilcox <matthew@wil.cx>
  *
  * This file is where we call all the ethtool_ops commands to get
- * the information ethtool needs.  We fall back to calling do_ioctl()
- * for drivers which haven't been converted to ethtool_ops yet.
+ * the information ethtool needs.
  *
- * It's GPL, stupid.
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
  */
 
 #include <linux/module.h>
@@ -93,18 +95,6 @@ int ethtool_op_set_tso(struct net_device *dev, u32 data)
        return 0;
 }
 
-int ethtool_op_get_perm_addr(struct net_device *dev, struct ethtool_perm_addr *addr, u8 *data)
-{
-       unsigned char len = dev->addr_len;
-       if ( addr->size < len )
-               return -ETOOSMALL;
-
-       addr->size = len;
-       memcpy(data, dev->perm_addr, len);
-       return 0;
-}
-
-
 u32 ethtool_op_get_ufo(struct net_device *dev)
 {
        return (dev->features & NETIF_F_UFO) != 0;
@@ -777,34 +767,20 @@ static int ethtool_get_stats(struct net_device *dev, void __user *useraddr)
 static int ethtool_get_perm_addr(struct net_device *dev, void __user *useraddr)
 {
        struct ethtool_perm_addr epaddr;
-       u8 *data;
-       int ret;
-
-       if (!dev->ethtool_ops->get_perm_addr)
-               return -EOPNOTSUPP;
 
-       if (copy_from_user(&epaddr,useraddr,sizeof(epaddr)))
+       if (copy_from_user(&epaddr, useraddr, sizeof(epaddr)))
                return -EFAULT;
 
-       data = kmalloc(epaddr.size, GFP_USER);
-       if (!data)
-               return -ENOMEM;
-
-       ret = dev->ethtool_ops->get_perm_addr(dev,&epaddr,data);
-       if (ret)
-               return ret;
+       if (epaddr.size < dev->addr_len)
+               return -ETOOSMALL;
+       epaddr.size = dev->addr_len;
 
-       ret = -EFAULT;
        if (copy_to_user(useraddr, &epaddr, sizeof(epaddr)))
-               goto out;
+               return -EFAULT;
        useraddr += sizeof(epaddr);
-       if (copy_to_user(useraddr, data, epaddr.size))
-               goto out;
-       ret = 0;
-
- out:
-       kfree(data);
-       return ret;
+       if (copy_to_user(useraddr, dev->perm_addr, epaddr.size))
+               return -EFAULT;
+       return 0;
 }
 
 /* The main entry point in this file.  Called from net/core/dev.c */
@@ -821,7 +797,7 @@ int dev_ethtool(struct ifreq *ifr)
                return -ENODEV;
 
        if (!dev->ethtool_ops)
-               goto ioctl;
+               return -EOPNOTSUPP;
 
        if (copy_from_user(&ethcmd, useraddr, sizeof (ethcmd)))
                return -EFAULT;
@@ -960,7 +936,7 @@ int dev_ethtool(struct ifreq *ifr)
                rc = ethtool_set_gso(dev, useraddr);
                break;
        default:
-               rc =  -EOPNOTSUPP;
+               rc = -EOPNOTSUPP;
        }
 
        if (dev->ethtool_ops->complete)
@@ -970,20 +946,10 @@ int dev_ethtool(struct ifreq *ifr)
                netdev_features_change(dev);
 
        return rc;
-
- ioctl:
-       /* Keep existing behaviour for the moment.       */
-       if (!capable(CAP_NET_ADMIN))
-               return -EPERM;
-
-       if (dev->do_ioctl)
-               return dev->do_ioctl(dev, ifr, SIOCETHTOOL);
-       return -EOPNOTSUPP;
 }
 
 EXPORT_SYMBOL(dev_ethtool);
 EXPORT_SYMBOL(ethtool_op_get_link);
-EXPORT_SYMBOL_GPL(ethtool_op_get_perm_addr);
 EXPORT_SYMBOL(ethtool_op_get_sg);
 EXPORT_SYMBOL(ethtool_op_get_tso);
 EXPORT_SYMBOL(ethtool_op_get_tx_csum);
index bca787fdbc51ae9fe77e576ffee89c3f7770faca..7bae576ac115bf19732d878ac7022d5baeb1f0ab 100644 (file)
@@ -567,7 +567,7 @@ static ssize_t pgctrl_write(struct file *file, const char __user * buf,
                pktgen_run_all_threads();
 
        else
-               printk("pktgen: Unknown command: %s\n", data);
+               printk(KERN_WARNING "pktgen: Unknown command: %s\n", data);
 
        err = count;
 
@@ -908,14 +908,14 @@ static ssize_t pktgen_if_write(struct file *file,
        pg_result = &(pkt_dev->result[0]);
 
        if (count < 1) {
-               printk("pktgen: wrong command format\n");
+               printk(KERN_WARNING "pktgen: wrong command format\n");
                return -EINVAL;
        }
 
        max = count - i;
        tmp = count_trail_chars(&user_buffer[i], max);
        if (tmp < 0) {
-               printk("pktgen: illegal format\n");
+               printk(KERN_WARNING "pktgen: illegal format\n");
                return tmp;
        }
        i += tmp;
@@ -943,7 +943,7 @@ static ssize_t pktgen_if_write(struct file *file,
                if (copy_from_user(tb, user_buffer, count))
                        return -EFAULT;
                tb[count] = 0;
-               printk("pktgen: %s,%lu  buffer -:%s:-\n", name,
+               printk(KERN_DEBUG "pktgen: %s,%lu  buffer -:%s:-\n", name,
                       (unsigned long)count, tb);
        }
 
@@ -1248,7 +1248,7 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->cur_daddr = pkt_dev->daddr_min;
                }
                if (debug)
-                       printk("pktgen: dst_min set to: %s\n",
+                       printk(KERN_DEBUG "pktgen: dst_min set to: %s\n",
                               pkt_dev->dst_min);
                i += len;
                sprintf(pg_result, "OK: dst_min=%s", pkt_dev->dst_min);
@@ -1271,7 +1271,7 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->cur_daddr = pkt_dev->daddr_max;
                }
                if (debug)
-                       printk("pktgen: dst_max set to: %s\n",
+                       printk(KERN_DEBUG "pktgen: dst_max set to: %s\n",
                               pkt_dev->dst_max);
                i += len;
                sprintf(pg_result, "OK: dst_max=%s", pkt_dev->dst_max);
@@ -1294,7 +1294,7 @@ static ssize_t pktgen_if_write(struct file *file,
                ipv6_addr_copy(&pkt_dev->cur_in6_daddr, &pkt_dev->in6_daddr);
 
                if (debug)
-                       printk("pktgen: dst6 set to: %s\n", buf);
+                       printk(KERN_DEBUG "pktgen: dst6 set to: %s\n", buf);
 
                i += len;
                sprintf(pg_result, "OK: dst6=%s", buf);
@@ -1317,7 +1317,7 @@ static ssize_t pktgen_if_write(struct file *file,
                ipv6_addr_copy(&pkt_dev->cur_in6_daddr,
                               &pkt_dev->min_in6_daddr);
                if (debug)
-                       printk("pktgen: dst6_min set to: %s\n", buf);
+                       printk(KERN_DEBUG "pktgen: dst6_min set to: %s\n", buf);
 
                i += len;
                sprintf(pg_result, "OK: dst6_min=%s", buf);
@@ -1338,7 +1338,7 @@ static ssize_t pktgen_if_write(struct file *file,
                fmt_ip6(buf, pkt_dev->max_in6_daddr.s6_addr);
 
                if (debug)
-                       printk("pktgen: dst6_max set to: %s\n", buf);
+                       printk(KERN_DEBUG "pktgen: dst6_max set to: %s\n", buf);
 
                i += len;
                sprintf(pg_result, "OK: dst6_max=%s", buf);
@@ -1361,7 +1361,7 @@ static ssize_t pktgen_if_write(struct file *file,
                ipv6_addr_copy(&pkt_dev->cur_in6_saddr, &pkt_dev->in6_saddr);
 
                if (debug)
-                       printk("pktgen: src6 set to: %s\n", buf);
+                       printk(KERN_DEBUG "pktgen: src6 set to: %s\n", buf);
 
                i += len;
                sprintf(pg_result, "OK: src6=%s", buf);
@@ -1382,7 +1382,7 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->cur_saddr = pkt_dev->saddr_min;
                }
                if (debug)
-                       printk("pktgen: src_min set to: %s\n",
+                       printk(KERN_DEBUG "pktgen: src_min set to: %s\n",
                               pkt_dev->src_min);
                i += len;
                sprintf(pg_result, "OK: src_min=%s", pkt_dev->src_min);
@@ -1403,7 +1403,7 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->cur_saddr = pkt_dev->saddr_max;
                }
                if (debug)
-                       printk("pktgen: src_max set to: %s\n",
+                       printk(KERN_DEBUG "pktgen: src_max set to: %s\n",
                               pkt_dev->src_max);
                i += len;
                sprintf(pg_result, "OK: src_max=%s", pkt_dev->src_max);
@@ -1533,7 +1533,7 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->svlan_id = 0xffff;
 
                        if (debug)
-                               printk("pktgen: VLAN/SVLAN auto turned off\n");
+                               printk(KERN_DEBUG "pktgen: VLAN/SVLAN auto turned off\n");
                }
                return count;
        }
@@ -1548,10 +1548,10 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->vlan_id = value;  /* turn on VLAN */
 
                        if (debug)
-                               printk("pktgen: VLAN turned on\n");
+                               printk(KERN_DEBUG "pktgen: VLAN turned on\n");
 
                        if (debug && pkt_dev->nr_labels)
-                               printk("pktgen: MPLS auto turned off\n");
+                               printk(KERN_DEBUG "pktgen: MPLS auto turned off\n");
 
                        pkt_dev->nr_labels = 0;    /* turn off MPLS */
                        sprintf(pg_result, "OK: vlan_id=%u", pkt_dev->vlan_id);
@@ -1560,7 +1560,7 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->svlan_id = 0xffff;
 
                        if (debug)
-                               printk("pktgen: VLAN/SVLAN turned off\n");
+                               printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n");
                }
                return count;
        }
@@ -1605,10 +1605,10 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->svlan_id = value;  /* turn on SVLAN */
 
                        if (debug)
-                               printk("pktgen: SVLAN turned on\n");
+                               printk(KERN_DEBUG "pktgen: SVLAN turned on\n");
 
                        if (debug && pkt_dev->nr_labels)
-                               printk("pktgen: MPLS auto turned off\n");
+                               printk(KERN_DEBUG "pktgen: MPLS auto turned off\n");
 
                        pkt_dev->nr_labels = 0;    /* turn off MPLS */
                        sprintf(pg_result, "OK: svlan_id=%u", pkt_dev->svlan_id);
@@ -1617,7 +1617,7 @@ static ssize_t pktgen_if_write(struct file *file,
                        pkt_dev->svlan_id = 0xffff;
 
                        if (debug)
-                               printk("pktgen: VLAN/SVLAN turned off\n");
+                               printk(KERN_DEBUG "pktgen: VLAN/SVLAN turned off\n");
                }
                return count;
        }
@@ -1777,10 +1777,11 @@ static ssize_t pktgen_thread_write(struct file *file,
        i += len;
 
        if (debug)
-               printk("pktgen: t=%s, count=%lu\n", name, (unsigned long)count);
+               printk(KERN_DEBUG "pktgen: t=%s, count=%lu\n",
+                      name, (unsigned long)count);
 
        if (!t) {
-               printk("pktgen: ERROR: No thread\n");
+               printk(KERN_ERR "pktgen: ERROR: No thread\n");
                ret = -EINVAL;
                goto out;
        }
@@ -1891,8 +1892,8 @@ static void pktgen_mark_device(const char *ifname)
                mutex_lock(&pktgen_thread_lock);
 
                if (++i >= max_tries) {
-                       printk("pktgen_mark_device: timed out after waiting "
-                              "%d msec for device %s to be removed\n",
+                       printk(KERN_ERR "pktgen_mark_device: timed out after "
+                              "waiting %d msec for device %s to be removed\n",
                               msec_per_try * i, ifname);
                        break;
                }
@@ -1962,15 +1963,15 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
 
        odev = dev_get_by_name(ifname);
        if (!odev) {
-               printk("pktgen: no such netdevice: \"%s\"\n", ifname);
+               printk(KERN_ERR "pktgen: no such netdevice: \"%s\"\n", ifname);
                return -ENODEV;
        }
 
        if (odev->type != ARPHRD_ETHER) {
-               printk("pktgen: not an ethernet device: \"%s\"\n", ifname);
+               printk(KERN_ERR "pktgen: not an ethernet device: \"%s\"\n", ifname);
                err = -EINVAL;
        } else if (!netif_running(odev)) {
-               printk("pktgen: device is down: \"%s\"\n", ifname);
+               printk(KERN_ERR "pktgen: device is down: \"%s\"\n", ifname);
                err = -ENETDOWN;
        } else {
                pkt_dev->odev = odev;
@@ -1987,7 +1988,8 @@ static int pktgen_setup_dev(struct pktgen_dev *pkt_dev, const char *ifname)
 static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
 {
        if (!pkt_dev->odev) {
-               printk("pktgen: ERROR: pkt_dev->odev == NULL in setup_inject.\n");
+               printk(KERN_ERR "pktgen: ERROR: pkt_dev->odev == NULL in "
+                      "setup_inject.\n");
                sprintf(pkt_dev->result,
                        "ERROR: pkt_dev->odev == NULL in setup_inject.\n");
                return;
@@ -2049,7 +2051,8 @@ static void pktgen_setup_inject(struct pktgen_dev *pkt_dev)
                        }
                        rcu_read_unlock();
                        if (err)
-                               printk("pktgen: ERROR: IPv6 link address not availble.\n");
+                               printk(KERN_ERR "pktgen: ERROR: IPv6 link "
+                                      "address not availble.\n");
                }
 #endif
        } else {
@@ -2156,8 +2159,7 @@ static inline int f_pick(struct pktgen_dev *pkt_dev)
 /* If there was already an IPSEC SA, we keep it as is, else
  * we go look for it ...
 */
-inline
-void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow)
+static void get_ipsec_sa(struct pktgen_dev *pkt_dev, int flow)
 {
        struct xfrm_state *x = pkt_dev->flows[flow].x;
        if (!x) {
@@ -2441,7 +2443,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
                        if (nhead >0) {
                                ret = pskb_expand_head(skb, nhead, 0, GFP_ATOMIC);
                                if (ret < 0) {
-                                       printk("Error expanding ipsec packet %d\n",ret);
+                                       printk(KERN_ERR "Error expanding "
+                                              "ipsec packet %d\n",ret);
                                        return 0;
                                }
                        }
@@ -2450,7 +2453,8 @@ static inline int process_ipsec(struct pktgen_dev *pkt_dev,
                        skb_pull(skb, ETH_HLEN);
                        ret = pktgen_output_ipsec(skb, pkt_dev);
                        if (ret) {
-                               printk("Error creating ipsec packet %d\n",ret);
+                               printk(KERN_ERR "Error creating ipsec "
+                                      "packet %d\n",ret);
                                kfree_skb(skb);
                                return 0;
                        }
@@ -3184,8 +3188,8 @@ static int pktgen_stop_device(struct pktgen_dev *pkt_dev)
        int nr_frags = pkt_dev->skb ? skb_shinfo(pkt_dev->skb)->nr_frags : -1;
 
        if (!pkt_dev->running) {
-               printk("pktgen: interface: %s is already stopped\n",
-                      pkt_dev->odev->name);
+               printk(KERN_WARNING "pktgen: interface: %s is already "
+                      "stopped\n", pkt_dev->odev->name);
                return -EINVAL;
        }
 
@@ -3360,7 +3364,8 @@ static __inline__ void pktgen_xmit(struct pktgen_dev *pkt_dev)
 
                        pkt_dev->skb = fill_packet(odev, pkt_dev);
                        if (pkt_dev->skb == NULL) {
-                               printk("pktgen: ERROR: couldn't allocate skb in fill_packet.\n");
+                               printk(KERN_ERR "pktgen: ERROR: couldn't "
+                                      "allocate skb in fill_packet.\n");
                                schedule();
                                pkt_dev->clone_count--; /* back out increment, OOM */
                                goto out;
@@ -3565,7 +3570,8 @@ static int add_dev_to_thread(struct pktgen_thread *t,
        if_lock(t);
 
        if (pkt_dev->pg_thread) {
-               printk("pktgen: ERROR:  already assigned to a thread.\n");
+               printk(KERN_ERR "pktgen: ERROR: already assigned "
+                      "to a thread.\n");
                rv = -EBUSY;
                goto out;
        }
@@ -3590,7 +3596,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
 
        pkt_dev = __pktgen_NN_threads(ifname, FIND);
        if (pkt_dev) {
-               printk("pktgen: ERROR: interface already used.\n");
+               printk(KERN_ERR "pktgen: ERROR: interface already used.\n");
                return -EBUSY;
        }
 
@@ -3632,7 +3638,7 @@ static int pktgen_add_device(struct pktgen_thread *t, const char *ifname)
 
        pkt_dev->entry = create_proc_entry(ifname, 0600, pg_proc_dir);
        if (!pkt_dev->entry) {
-               printk("pktgen: cannot create %s/%s procfs entry.\n",
+               printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
                       PG_PROC_DIR, ifname);
                err = -EINVAL;
                goto out2;
@@ -3665,7 +3671,8 @@ static int __init pktgen_create_thread(int cpu)
 
        t = kzalloc(sizeof(struct pktgen_thread), GFP_KERNEL);
        if (!t) {
-               printk("pktgen: ERROR: out of memory, can't create new thread.\n");
+               printk(KERN_ERR "pktgen: ERROR: out of memory, can't "
+                      "create new thread.\n");
                return -ENOMEM;
        }
 
@@ -3678,7 +3685,8 @@ static int __init pktgen_create_thread(int cpu)
 
        p = kthread_create(pktgen_thread_worker, t, "kpktgend_%d", cpu);
        if (IS_ERR(p)) {
-               printk("pktgen: kernel_thread() failed for cpu %d\n", t->cpu);
+               printk(KERN_ERR "pktgen: kernel_thread() failed "
+                      "for cpu %d\n", t->cpu);
                list_del(&t->th_list);
                kfree(t);
                return PTR_ERR(p);
@@ -3688,7 +3696,7 @@ static int __init pktgen_create_thread(int cpu)
 
        pe = create_proc_entry(t->tsk->comm, 0600, pg_proc_dir);
        if (!pe) {
-               printk("pktgen: cannot create %s/%s procfs entry.\n",
+               printk(KERN_ERR "pktgen: cannot create %s/%s procfs entry.\n",
                       PG_PROC_DIR, t->tsk->comm);
                kthread_stop(p);
                list_del(&t->th_list);
@@ -3727,7 +3735,8 @@ static int pktgen_remove_device(struct pktgen_thread *t,
        pr_debug("pktgen: remove_device pkt_dev=%p\n", pkt_dev);
 
        if (pkt_dev->running) {
-               printk("pktgen:WARNING: trying to remove a running interface, stopping it now.\n");
+               printk(KERN_WARNING "pktgen: WARNING: trying to remove a "
+                      "running interface, stopping it now.\n");
                pktgen_stop_device(pkt_dev);
        }
 
@@ -3759,7 +3768,7 @@ static int __init pg_init(void)
        int cpu;
        struct proc_dir_entry *pe;
 
-       printk(version);
+       printk(KERN_INFO "%s", version);
 
        pg_proc_dir = proc_mkdir(PG_PROC_DIR, proc_net);
        if (!pg_proc_dir)
@@ -3768,8 +3777,8 @@ static int __init pg_init(void)
 
        pe = create_proc_entry(PGCTRL, 0600, pg_proc_dir);
        if (pe == NULL) {
-               printk("pktgen: ERROR: cannot create %s procfs entry.\n",
-                      PGCTRL);
+               printk(KERN_ERR "pktgen: ERROR: cannot create %s "
+                      "procfs entry.\n", PGCTRL);
                proc_net_remove(PG_PROC_DIR);
                return -EINVAL;
        }
@@ -3785,12 +3794,13 @@ static int __init pg_init(void)
 
                err = pktgen_create_thread(cpu);
                if (err)
-                       printk("pktgen: WARNING: Cannot create thread for cpu %d (%d)\n",
-                                       cpu, err);
+                       printk(KERN_WARNING "pktgen: WARNING: Cannot create "
+                              "thread for cpu %d (%d)\n", cpu, err);
        }
 
        if (list_empty(&pktgen_threads)) {
-               printk("pktgen: ERROR: Initialization failed for all threads\n");
+               printk(KERN_ERR "pktgen: ERROR: Initialization failed for "
+                      "all threads\n");
                unregister_netdevice_notifier(&pktgen_notifier_block);
                remove_proc_entry(PGCTRL, pg_proc_dir);
                proc_net_remove(PG_PROC_DIR);
index 06eccca8cb5d305e0a6d2750e724cc65f0666235..4756d5857abfb9010a55610423f967d129ae45f4 100644 (file)
@@ -952,7 +952,9 @@ static int rtnl_newlink(struct sk_buff *skb, struct nlmsghdr *nlh, void *arg)
        struct nlattr *linkinfo[IFLA_INFO_MAX+1];
        int err;
 
+#ifdef CONFIG_KMOD
 replay:
+#endif
        err = nlmsg_parse(nlh, sizeof(*ifm), tb, IFLA_MAX, ifla_policy);
        if (err < 0)
                return err;
index 2030bb8c2d30c4c27fccf960f87acd51fc5fac54..0bf17da40d52e0b60158052c20783ea5f5fe24ba 100644 (file)
@@ -25,6 +25,7 @@
 #include <linux/random.h>
 #include <linux/percpu.h>
 #include <linux/init.h>
+#include <net/sock.h>
 
 #include <asm/byteorder.h>
 #include <asm/system.h>
index ccbf72c793b6c61381b40d466073a89f2bfb4575..c45088b5e6fb68f5c8a453561453061dee512d54 100644 (file)
@@ -40,6 +40,7 @@ static inline void ccids_write_unlock(void)
 static inline void ccids_read_lock(void)
 {
        atomic_inc(&ccids_lockct);
+       smp_mb__after_atomic_inc();
        spin_unlock_wait(&ccids_lock);
 }
 
index cd845df5320dbe6bb74d6ee2dfcbad8244a7723e..5ebdd86c1b99f34ae2c86c36e8cbda2b23fed0cc 100644 (file)
@@ -327,10 +327,16 @@ static void dccp_feat_empty_confirm(struct dccp_minisock *dmsk,
        }
 
        switch (type) {
-       case DCCPO_CHANGE_L: opt->dccpop_type = DCCPO_CONFIRM_R; break;
-       case DCCPO_CHANGE_R: opt->dccpop_type = DCCPO_CONFIRM_L; break;
-       default:             DCCP_WARN("invalid type %d\n", type); return;
-
+       case DCCPO_CHANGE_L:
+               opt->dccpop_type = DCCPO_CONFIRM_R;
+               break;
+       case DCCPO_CHANGE_R:
+               opt->dccpop_type = DCCPO_CONFIRM_L;
+               break;
+       default:
+               DCCP_WARN("invalid type %d\n", type);
+               kfree(opt);
+               return;
        }
        opt->dccpop_feat = feature;
        opt->dccpop_val  = NULL;
index f2a61ef2af9cdebde1f5d217d09a8b74be9bc8c7..a4a620971ef02b02355f52bb50a373545c11ddad 100644 (file)
@@ -1737,8 +1737,9 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct dn_rt_cache_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct dn_rt_cache_iter_state *s;
 
+       s = kzalloc(sizeof(*s), GFP_KERNEL);
        if (!s)
                goto out;
        rc = seq_open(file, &dn_rt_cache_seq_ops);
@@ -1746,7 +1747,6 @@ static int dn_rt_cache_seq_open(struct inode *inode, struct file *file)
                goto out_kfree;
        seq             = file->private_data;
        seq->private    = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index f13937bf9e8ce20f3b2c171948593795d082b8ee..d054e9224b3e270110790f08f540df208cbc0556 100644 (file)
@@ -74,8 +74,8 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev,
        struct ieee80211softmac_auth_queue_item *authptr;
        int length = 0;
 
+check_assoc_again:
        mutex_lock(&sm->associnfo.mutex);
-
        /* Check if we're already associating to this or another network
         * If it's another network, cancel and start over with our new network
         * If it's our network, ignore the change, we're already doing it!
@@ -98,13 +98,18 @@ ieee80211softmac_wx_set_essid(struct net_device *net_dev,
                                cancel_delayed_work(&authptr->work);
                        sm->associnfo.bssvalid = 0;
                        sm->associnfo.bssfixed = 0;
-                       flush_scheduled_work();
                        sm->associnfo.associating = 0;
                        sm->associnfo.associated = 0;
+                       /* We must unlock to avoid deadlocks with the assoc workqueue
+                        * on the associnfo.mutex */
+                       mutex_unlock(&sm->associnfo.mutex);
+                       flush_scheduled_work();
+                       /* Avoid race! Check assoc status again. Maybe someone started an
+                        * association while we flushed. */
+                       goto check_assoc_again;
                }
        }
 
-
        sm->associnfo.static_essid = 0;
        sm->associnfo.assoc_wait = 0;
 
index 06c08e5740fbcca5b0aa37dade5a90f88609ee42..e68103475cca2a76a349d270d1db72c62132b4c7 100644 (file)
@@ -831,7 +831,7 @@ const struct proto_ops inet_stream_ops = {
        .shutdown          = inet_shutdown,
        .setsockopt        = sock_common_setsockopt,
        .getsockopt        = sock_common_getsockopt,
-       .sendmsg           = inet_sendmsg,
+       .sendmsg           = tcp_sendmsg,
        .recvmsg           = sock_common_recvmsg,
        .mmap              = sock_no_mmap,
        .sendpage          = tcp_sendpage,
index abf6352f990f33ff380a27f364325b4f57153b56..5b77bdaa57dd2440d85e3e418215276d71605cf7 100644 (file)
@@ -1056,10 +1056,9 @@ static int inetdev_event(struct notifier_block *this, unsigned long event,
        if (!in_dev) {
                if (event == NETDEV_REGISTER) {
                        in_dev = inetdev_init(dev);
+                       if (!in_dev)
+                               return notifier_from_errno(-ENOMEM);
                        if (dev == &loopback_dev) {
-                               if (!in_dev)
-                                       panic("devinet: "
-                                             "Failed to create loopback\n");
                                IN_DEV_CONF_SET(in_dev, NOXFRM, 1);
                                IN_DEV_CONF_SET(in_dev, NOPOLICY, 1);
                        }
index 251346828cb4ceca55d2f3b5622698b4fbd26249..2f14745a9e1fb0aa5bdc779421d9376049963884 100644 (file)
@@ -513,11 +513,8 @@ void ip_options_undo(struct ip_options * opt)
 
 static struct ip_options *ip_options_get_alloc(const int optlen)
 {
-       struct ip_options *opt = kmalloc(sizeof(*opt) + ((optlen + 3) & ~3),
-                                        GFP_KERNEL);
-       if (opt)
-               memset(opt, 0, sizeof(*opt));
-       return opt;
+       return kzalloc(sizeof(struct ip_options) + ((optlen + 3) & ~3),
+                      GFP_KERNEL);
 }
 
 static int ip_options_get_finish(struct ip_options **optp,
index c9e2b5e6305e2288966735800d950814899ca53b..0f1d7beacf782042b4ed9115b4441f88214f29f3 100644 (file)
@@ -75,7 +75,6 @@
 #include <net/icmp.h>
 #include <net/checksum.h>
 #include <net/inetpeer.h>
-#include <net/checksum.h>
 #include <linux/igmp.h>
 #include <linux/netfilter_ipv4.h>
 #include <linux/netfilter_bridge.h>
index 342ca8d89458a7b9aa9edc6124533b0a9a6cd4de..c5b24707753997db84ddcd310ae876f94d8243eb 100644 (file)
@@ -1281,9 +1281,9 @@ static int __init ip_auto_config(void)
         */
        if (ic_myaddr == NONE ||
 #ifdef CONFIG_ROOT_NFS
-           (MAJOR(ROOT_DEV) == UNNAMED_MAJOR
-            && root_server_addr == NONE
-            && ic_servaddr == NONE) ||
+           (root_server_addr == NONE
+            && ic_servaddr == NONE
+            && ROOT_DEV == Root_NFS) ||
 #endif
            ic_first_dev->next) {
 #ifdef IPCONFIG_DYNAMIC
index e1052bcf4ed190ecefc35c7380eaa0be407c6b24..902fd578aa3c1853c034bd7e867566dcdde683f3 100644 (file)
@@ -29,7 +29,6 @@
 #include <linux/proc_fs.h>
 #include <linux/workqueue.h>
 #include <linux/swap.h>
-#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 
 #include <linux/netfilter.h>
@@ -909,7 +908,7 @@ ip_vs_edit_dest(struct ip_vs_service *svc, struct ip_vs_dest_user *udest)
        write_lock_bh(&__ip_vs_svc_lock);
 
        /* Wait until all other svc users go away */
-       while (atomic_read(&svc->usecnt) > 1) {};
+       IP_VS_WAIT_WHILE(atomic_read(&svc->usecnt) > 1);
 
        /* call the update_service, because server weight may be changed */
        svc->scheduler->update_service(svc);
index 900ce29db38276a649661702b81d2711bd7891e4..666e080a74a3ecb271425ec29bbe9ed84f9d57a6 100644 (file)
@@ -128,7 +128,7 @@ ip_vs_dst_reset(struct ip_vs_dest *dest)
 #define IP_VS_XMIT(skb, rt)                            \
 do {                                                   \
        (skb)->ipvs_property = 1;                       \
-       (skb)->ip_summed = CHECKSUM_NONE;               \
+       skb_forward_csum(skb);                          \
        NF_HOOK(PF_INET, NF_IP_LOCAL_OUT, (skb), NULL,  \
                (rt)->u.dst.dev, dst_output);           \
 } while (0)
index dcc12b1834747a513a7468f780604b738124f0c2..69bd362b5fa20d8c1ed42f79aed68f93a431b98f 100644 (file)
@@ -19,7 +19,6 @@
 #include <linux/udp.h>
 #include <linux/icmp.h>
 #include <linux/if_arp.h>
-#include <linux/proc_fs.h>
 #include <linux/seq_file.h>
 #include <linux/netfilter_arp.h>
 #include <linux/netfilter/x_tables.h>
index 3218043156591f874e59deff90f8b5fa7a027d8c..6d0c0f7364adbcac35fc4a332e11f6841e0430b3 100644 (file)
@@ -387,12 +387,17 @@ static int recent_seq_open(struct inode *inode, struct file *file)
        st = kzalloc(sizeof(*st), GFP_KERNEL);
        if (st == NULL)
                return -ENOMEM;
+
        ret = seq_open(file, &recent_seq_ops);
-       if (ret)
+       if (ret) {
                kfree(st);
+               goto out;
+       }
+
        st->table    = pde->data;
        seq          = file->private_data;
        seq->private = st;
+out:
        return ret;
 }
 
index 64552afd01cb9947569e17e706a825ac4431e8c3..d9b5177989c65b14f02b25ace7493f18c2090132 100644 (file)
@@ -509,3 +509,9 @@ static void __exit nf_conntrack_l3proto_ipv4_fini(void)
 
 module_init(nf_conntrack_l3proto_ipv4_init);
 module_exit(nf_conntrack_l3proto_ipv4_fini);
+
+void need_ipv4_conntrack(void)
+{
+       return;
+}
+EXPORT_SYMBOL_GPL(need_ipv4_conntrack);
index 27c7918e442a78f481df21fa0f4b0f0bf3c4a0df..b3dd5de9a25868c26bad3dd97546cbaafbb3fcb7 100644 (file)
@@ -294,15 +294,14 @@ static int exp_open(struct inode *inode, struct file *file)
        struct ct_expect_iter_state *st;
        int ret;
 
-       st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
-       if (st == NULL)
+       st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
+       if (!st)
                return -ENOMEM;
        ret = seq_open(file, &exp_seq_ops);
        if (ret)
                goto out_free;
        seq          = file->private_data;
        seq->private = st;
-       memset(st, 0, sizeof(struct ct_expect_iter_state));
        return ret;
 out_free:
        kfree(st);
index e848d8d6292fc1f3f93431320a4c7fae0c737291..deab27facbad5b2822a79aa9ab80ddddc656a211 100644 (file)
@@ -77,7 +77,8 @@ static inline unsigned int
 hash_by_src(const struct nf_conntrack_tuple *tuple)
 {
        /* Original src, to ensure we map it consistently if poss. */
-       return jhash_3words((__force u32)tuple->src.u3.ip, tuple->src.u.all,
+       return jhash_3words((__force u32)tuple->src.u3.ip,
+                           (__force u32)tuple->src.u.all,
                            tuple->dst.protonum, 0) % nf_nat_htable_size;
 }
 
index 0f45427e5fdc6321018c74b3bf62ddd285afd078..76ec59ae524db65317a9f3ebc419a9c77eadd75b 100644 (file)
@@ -192,7 +192,7 @@ alloc_null_binding_confirmed(struct nf_conn *ct, unsigned int hooknum)
                = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
                   ? ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u3.ip
                   : ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u3.ip);
-       u_int16_t all
+       __be16 all
                = (HOOK2MANIP(hooknum) == IP_NAT_MANIP_SRC
                   ? ct->tuplehash[IP_CT_DIR_REPLY].tuple.dst.u.all
                   : ct->tuplehash[IP_CT_DIR_REPLY].tuple.src.u.all);
index 332814dac5038ad194fae5f53e1c0fccc5f6f20d..46cc99def165fc5e80f5ae3f1596890afa17f6e6 100644 (file)
@@ -328,7 +328,7 @@ static int __init nf_nat_standalone_init(void)
 {
        int ret = 0;
 
-       need_conntrack();
+       need_ipv4_conntrack();
 
 #ifdef CONFIG_XFRM
        BUG_ON(ip_nat_decode_session != NULL);
index 24d7c9f319184aae8a894e25a20eeaad9fa4ce56..c6d71526f625b47c08c3b026fc25e42c1a43f408 100644 (file)
@@ -900,8 +900,9 @@ static int raw_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct raw_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct raw_iter_state *s;
 
+       s = kzalloc(sizeof(*s), GFP_KERNEL);
        if (!s)
                goto out;
        rc = seq_open(file, &raw_seq_ops);
@@ -910,7 +911,6 @@ static int raw_seq_open(struct inode *inode, struct file *file)
 
        seq = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index df42b7fb3268bb119c64f4a94b7c24d68722ec10..c7ca94bd152cc945c99c1ab63fcf7d3985d5f639 100644 (file)
@@ -374,8 +374,9 @@ static int rt_cache_seq_open(struct inode *inode, struct file *file)
 {
        struct seq_file *seq;
        int rc = -ENOMEM;
-       struct rt_cache_iter_state *s = kmalloc(sizeof(*s), GFP_KERNEL);
+       struct rt_cache_iter_state *s;
 
+       s = kzalloc(sizeof(*s), GFP_KERNEL);
        if (!s)
                goto out;
        rc = seq_open(file, &rt_cache_seq_ops);
@@ -383,7 +384,6 @@ static int rt_cache_seq_open(struct inode *inode, struct file *file)
                goto out_kfree;
        seq          = file->private_data;
        seq->private = s;
-       memset(s, 0, sizeof(*s));
 out:
        return rc;
 out_kfree:
index da4c0b6ab79ab5f25b5e9accddf592796c93c4ba..7e740112b2383c93b535a0657baf3f5b6fe75d48 100644 (file)
@@ -658,9 +658,10 @@ static inline int select_size(struct sock *sk)
        return tmp;
 }
 
-int tcp_sendmsg(struct kiocb *iocb, struct sock *sk, struct msghdr *msg,
+int tcp_sendmsg(struct kiocb *iocb, struct socket *sock, struct msghdr *msg,
                size_t size)
 {
+       struct sock *sk = sock->sk;
        struct iovec *iov;
        struct tcp_sock *tp = tcp_sk(sk);
        struct sk_buff *skb;
index 519de091a94d01641f8ae5837abcc8943455fd25..4586211e3757f9b30c78b95bdbe1d1a858ea9070 100644 (file)
@@ -206,7 +206,7 @@ static void bictcp_state(struct sock *sk, u8 new_state)
 /* Track delayed acknowledgment ratio using sliding window
  * ratio = (15*ratio + sample) / 16
  */
-static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last)
+static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
 
index d17da30d82d675545526b55c30228fb03334db26..485d7ea35f75598ed2da741f4a9f376da20284ea 100644 (file)
@@ -246,38 +246,12 @@ static inline void bictcp_update(struct bictcp *ca, u32 cwnd)
                ca->cnt = 1;
 }
 
-
-/* Keep track of minimum rtt */
-static inline void measure_delay(struct sock *sk)
-{
-       const struct tcp_sock *tp = tcp_sk(sk);
-       struct bictcp *ca = inet_csk_ca(sk);
-       u32 delay;
-
-       /* No time stamp */
-       if (!(tp->rx_opt.saw_tstamp && tp->rx_opt.rcv_tsecr) ||
-            /* Discard delay samples right after fast recovery */
-           (s32)(tcp_time_stamp - ca->epoch_start) < HZ)
-               return;
-
-       delay = (tcp_time_stamp - tp->rx_opt.rcv_tsecr)<<3;
-       if (delay == 0)
-               delay = 1;
-
-       /* first time call or link delay decreases */
-       if (ca->delay_min == 0 || ca->delay_min > delay)
-               ca->delay_min = delay;
-}
-
 static void bictcp_cong_avoid(struct sock *sk, u32 ack,
                              u32 in_flight, int data_acked)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        struct bictcp *ca = inet_csk_ca(sk);
 
-       if (data_acked)
-               measure_delay(sk);
-
        if (!tcp_is_cwnd_limited(sk, in_flight))
                return;
 
@@ -334,17 +308,33 @@ static void bictcp_state(struct sock *sk, u8 new_state)
 /* Track delayed acknowledgment ratio using sliding window
  * ratio = (15*ratio + sample) / 16
  */
-static void bictcp_acked(struct sock *sk, u32 cnt, ktime_t last)
+static void bictcp_acked(struct sock *sk, u32 cnt, s32 rtt_us)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
+       struct bictcp *ca = inet_csk_ca(sk);
+       u32 delay;
 
        if (cnt > 0 && icsk->icsk_ca_state == TCP_CA_Open) {
-               struct bictcp *ca = inet_csk_ca(sk);
                cnt -= ca->delayed_ack >> ACK_RATIO_SHIFT;
                ca->delayed_ack += cnt;
        }
-}
 
+       /* Some calls are for duplicates without timetamps */
+       if (rtt_us < 0)
+               return;
+
+       /* Discard delay samples right after fast recovery */
+       if ((s32)(tcp_time_stamp - ca->epoch_start) < HZ)
+               return;
+
+       delay = usecs_to_jiffies(rtt_us) << 3;
+       if (delay == 0)
+               delay = 1;
+
+       /* first time call or link delay decreases */
+       if (ca->delay_min == 0 || ca->delay_min > delay)
+               ca->delay_min = delay;
+}
 
 static struct tcp_congestion_ops cubictcp = {
        .init           = bictcp_init,
index 08a02e6045c9c17733dbdac5c4873ce242bec9c5..5215691f2760e710ac56934e539665f51161fbe2 100644 (file)
@@ -76,20 +76,17 @@ static u32 htcp_cwnd_undo(struct sock *sk)
        return max(tp->snd_cwnd, (tp->snd_ssthresh << 7) / ca->beta);
 }
 
-static inline void measure_rtt(struct sock *sk)
+static inline void measure_rtt(struct sock *sk, u32 srtt)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
-       const struct tcp_sock *tp = tcp_sk(sk);
        struct htcp *ca = inet_csk_ca(sk);
-       u32 srtt = tp->srtt >> 3;
 
        /* keep track of minimum RTT seen so far, minRTT is zero at first */
        if (ca->minRTT > srtt || !ca->minRTT)
                ca->minRTT = srtt;
 
        /* max RTT */
-       if (icsk->icsk_ca_state == TCP_CA_Open
-           && tp->snd_ssthresh < 0xFFFF && htcp_ccount(ca) > 3) {
+       if (icsk->icsk_ca_state == TCP_CA_Open) {
                if (ca->maxRTT < ca->minRTT)
                        ca->maxRTT = ca->minRTT;
                if (ca->maxRTT < srtt
@@ -98,7 +95,7 @@ static inline void measure_rtt(struct sock *sk)
        }
 }
 
-static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, ktime_t last)
+static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, s32 rtt)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
        const struct tcp_sock *tp = tcp_sk(sk);
@@ -108,6 +105,9 @@ static void measure_achieved_throughput(struct sock *sk, u32 pkts_acked, ktime_t
        if (icsk->icsk_ca_state == TCP_CA_Open)
                ca->pkts_acked = pkts_acked;
 
+       if (rtt > 0)
+               measure_rtt(sk, usecs_to_jiffies(rtt));
+
        if (!use_bandwidth_switch)
                return;
 
@@ -237,8 +237,6 @@ static void htcp_cong_avoid(struct sock *sk, u32 ack,
        if (tp->snd_cwnd <= tp->snd_ssthresh)
                tcp_slow_start(tp);
        else {
-               measure_rtt(sk);
-
                /* In dangerous area, increase slowly.
                 * In theory this is tp->snd_cwnd += alpha / tp->snd_cwnd
                 */
index cc5de6f69d46f0e2f4fd81e8c4815780ba609bb4..64f1cbaf96e8a487bba6edc9398aeff535c2ec79 100644 (file)
@@ -83,18 +83,16 @@ static void tcp_illinois_init(struct sock *sk)
 }
 
 /* Measure RTT for each ack. */
-static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
+static void tcp_illinois_acked(struct sock *sk, u32 pkts_acked, s32 rtt)
 {
        struct illinois *ca = inet_csk_ca(sk);
-       u32 rtt;
 
        ca->acked = pkts_acked;
 
-       if (ktime_equal(last, net_invalid_timestamp()))
+       /* dup ack, no rtt sample */
+       if (rtt < 0)
                return;
 
-       rtt = ktime_to_us(net_timedelta(last));
-
        /* ignore bogus values, this prevents wraparound in alpha math */
        if (rtt > RTT_MAX)
                rtt = RTT_MAX;
index fec8a7a4dbaffa3781685fe9203b4c998482dc8d..f030435e0eb4c972178f78053bd6b4028690e141 100644 (file)
@@ -102,11 +102,14 @@ int sysctl_tcp_abc __read_mostly;
 #define FLAG_DATA_LOST         0x80 /* SACK detected data lossage.             */
 #define FLAG_SLOWPATH          0x100 /* Do not skip RFC checks for window update.*/
 #define FLAG_ONLY_ORIG_SACKED  0x200 /* SACKs only non-rexmit sent before RTO */
+#define FLAG_SND_UNA_ADVANCED  0x400 /* Snd_una was changed (!= FLAG_DATA_ACKED) */
+#define FLAG_DSACKING_ACK      0x800 /* SACK blocks contained DSACK info */
 
 #define FLAG_ACKED             (FLAG_DATA_ACKED|FLAG_SYN_ACKED)
 #define FLAG_NOT_DUP           (FLAG_DATA|FLAG_WIN_UPDATE|FLAG_ACKED)
 #define FLAG_CA_ALERT          (FLAG_DATA_SACKED|FLAG_ECE)
 #define FLAG_FORWARD_PROGRESS  (FLAG_ACKED|FLAG_DATA_SACKED)
+#define FLAG_ANY_PROGRESS      (FLAG_FORWARD_PROGRESS|FLAG_SND_UNA_ADVANCED)
 
 #define IsReno(tp) ((tp)->rx_opt.sack_ok == 0)
 #define IsFack(tp) ((tp)->rx_opt.sack_ok & 2)
@@ -964,12 +967,14 @@ tcp_sacktag_write_queue(struct sock *sk, struct sk_buff *ack_skb, u32 prior_snd_
 
        /* Check for D-SACK. */
        if (before(ntohl(sp[0].start_seq), TCP_SKB_CB(ack_skb)->ack_seq)) {
+               flag |= FLAG_DSACKING_ACK;
                found_dup_sack = 1;
                tp->rx_opt.sack_ok |= 4;
                NET_INC_STATS_BH(LINUX_MIB_TCPDSACKRECV);
        } else if (num_sacks > 1 &&
                        !after(ntohl(sp[0].end_seq), ntohl(sp[1].end_seq)) &&
                        !before(ntohl(sp[0].start_seq), ntohl(sp[1].start_seq))) {
+               flag |= FLAG_DSACKING_ACK;
                found_dup_sack = 1;
                tp->rx_opt.sack_ok |= 4;
                NET_INC_STATS_BH(LINUX_MIB_TCPDSACKOFORECV);
@@ -1851,19 +1856,22 @@ static inline u32 tcp_cwnd_min(const struct sock *sk)
 }
 
 /* Decrease cwnd each second ack. */
-static void tcp_cwnd_down(struct sock *sk)
+static void tcp_cwnd_down(struct sock *sk, int flag)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        int decr = tp->snd_cwnd_cnt + 1;
 
-       tp->snd_cwnd_cnt = decr&1;
-       decr >>= 1;
+       if ((flag&(FLAG_ANY_PROGRESS|FLAG_DSACKING_ACK)) ||
+           (IsReno(tp) && !(flag&FLAG_NOT_DUP))) {
+               tp->snd_cwnd_cnt = decr&1;
+               decr >>= 1;
 
-       if (decr && tp->snd_cwnd > tcp_cwnd_min(sk))
-               tp->snd_cwnd -= decr;
+               if (decr && tp->snd_cwnd > tcp_cwnd_min(sk))
+                       tp->snd_cwnd -= decr;
 
-       tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
-       tp->snd_cwnd_stamp = tcp_time_stamp;
+               tp->snd_cwnd = min(tp->snd_cwnd, tcp_packets_in_flight(tp)+1);
+               tp->snd_cwnd_stamp = tcp_time_stamp;
+       }
 }
 
 /* Nothing was retransmitted or returned timestamp is less
@@ -2060,7 +2068,7 @@ static void tcp_try_to_open(struct sock *sk, int flag)
                }
                tcp_moderate_cwnd(tp);
        } else {
-               tcp_cwnd_down(sk);
+               tcp_cwnd_down(sk, flag);
        }
 }
 
@@ -2104,12 +2112,13 @@ static void tcp_mtup_probe_success(struct sock *sk, struct sk_buff *skb)
  * tcp_xmit_retransmit_queue().
  */
 static void
-tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
-                     int prior_packets, int flag)
+tcp_fastretrans_alert(struct sock *sk, int prior_packets, int flag)
 {
        struct inet_connection_sock *icsk = inet_csk(sk);
        struct tcp_sock *tp = tcp_sk(sk);
-       int is_dupack = (tp->snd_una == prior_snd_una && !(flag&FLAG_NOT_DUP));
+       int is_dupack = !(flag&(FLAG_SND_UNA_ADVANCED|FLAG_NOT_DUP));
+       int do_lost = is_dupack || ((flag&FLAG_DATA_SACKED) &&
+                                   (tp->fackets_out > tp->reordering));
 
        /* Some technical things:
         * 1. Reno does not count dupacks (sacked_out) automatically. */
@@ -2186,14 +2195,14 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
        /* F. Process state. */
        switch (icsk->icsk_ca_state) {
        case TCP_CA_Recovery:
-               if (prior_snd_una == tp->snd_una) {
+               if (!(flag & FLAG_SND_UNA_ADVANCED)) {
                        if (IsReno(tp) && is_dupack)
                                tcp_add_reno_sack(sk);
                } else {
                        int acked = prior_packets - tp->packets_out;
                        if (IsReno(tp))
                                tcp_remove_reno_sacks(sk, acked);
-                       is_dupack = tcp_try_undo_partial(sk, acked);
+                       do_lost = tcp_try_undo_partial(sk, acked);
                }
                break;
        case TCP_CA_Loss:
@@ -2209,7 +2218,7 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
                /* Loss is undone; fall through to processing in Open state. */
        default:
                if (IsReno(tp)) {
-                       if (tp->snd_una != prior_snd_una)
+                       if (flag & FLAG_SND_UNA_ADVANCED)
                                tcp_reset_reno_sack(tp);
                        if (is_dupack)
                                tcp_add_reno_sack(sk);
@@ -2258,9 +2267,9 @@ tcp_fastretrans_alert(struct sock *sk, u32 prior_snd_una,
                tcp_set_ca_state(sk, TCP_CA_Recovery);
        }
 
-       if (is_dupack || tcp_head_timedout(sk))
+       if (do_lost || tcp_head_timedout(sk))
                tcp_update_scoreboard(sk);
-       tcp_cwnd_down(sk);
+       tcp_cwnd_down(sk, flag);
        tcp_xmit_retransmit_queue(sk);
 }
 
@@ -2490,12 +2499,23 @@ static int tcp_clean_rtx_queue(struct sock *sk, __s32 *seq_rtt_p)
                tcp_ack_update_rtt(sk, acked, seq_rtt);
                tcp_ack_packets_out(sk);
 
-               /* Is the ACK triggering packet unambiguous? */
-               if (acked & FLAG_RETRANS_DATA_ACKED)
-                       last_ackt = net_invalid_timestamp();
+               if (ca_ops->pkts_acked) {
+                       s32 rtt_us = -1;
+
+                       /* Is the ACK triggering packet unambiguous? */
+                       if (!(acked & FLAG_RETRANS_DATA_ACKED)) {
+                               /* High resolution needed and available? */
+                               if (ca_ops->flags & TCP_CONG_RTT_STAMP &&
+                                   !ktime_equal(last_ackt,
+                                                net_invalid_timestamp()))
+                                       rtt_us = ktime_us_delta(ktime_get_real(),
+                                                               last_ackt);
+                               else if (seq_rtt > 0)
+                                       rtt_us = jiffies_to_usecs(seq_rtt);
+                       }
 
-               if (ca_ops->pkts_acked)
-                       ca_ops->pkts_acked(sk, pkts_acked, last_ackt);
+                       ca_ops->pkts_acked(sk, pkts_acked, rtt_us);
+               }
        }
 
 #if FASTRETRANS_DEBUG > 0
@@ -2667,7 +2687,7 @@ static void tcp_undo_spur_to_response(struct sock *sk, int flag)
  *     to prove that the RTO is indeed spurious. It transfers the control
  *     from F-RTO to the conventional RTO recovery
  */
-static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag)
+static int tcp_process_frto(struct sock *sk, int flag)
 {
        struct tcp_sock *tp = tcp_sk(sk);
 
@@ -2687,8 +2707,7 @@ static int tcp_process_frto(struct sock *sk, u32 prior_snd_una, int flag)
                 * ACK isn't duplicate nor advances window, e.g., opposite dir
                 * data, winupdate
                 */
-               if ((tp->snd_una == prior_snd_una) && (flag&FLAG_NOT_DUP) &&
-                   !(flag&FLAG_FORWARD_PROGRESS))
+               if (!(flag&FLAG_ANY_PROGRESS) && (flag&FLAG_NOT_DUP))
                        return 1;
 
                if (!(flag&FLAG_DATA_ACKED)) {
@@ -2768,6 +2787,9 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
        if (before(ack, prior_snd_una))
                goto old_ack;
 
+       if (after(ack, prior_snd_una))
+               flag |= FLAG_SND_UNA_ADVANCED;
+
        if (sysctl_tcp_abc) {
                if (icsk->icsk_ca_state < TCP_CA_CWR)
                        tp->bytes_acked += ack - prior_snd_una;
@@ -2820,14 +2842,14 @@ static int tcp_ack(struct sock *sk, struct sk_buff *skb, int flag)
        flag |= tcp_clean_rtx_queue(sk, &seq_rtt);
 
        if (tp->frto_counter)
-               frto_cwnd = tcp_process_frto(sk, prior_snd_una, flag);
+               frto_cwnd = tcp_process_frto(sk, flag);
 
        if (tcp_ack_is_dubious(sk, flag)) {
                /* Advance CWND, if state allows this. */
                if ((flag & FLAG_DATA_ACKED) && !frto_cwnd &&
                    tcp_may_raise_cwnd(sk, flag))
                        tcp_cong_avoid(sk, ack, prior_in_flight, 0);
-               tcp_fastretrans_alert(sk, prior_snd_una, prior_packets, flag);
+               tcp_fastretrans_alert(sk, prior_packets, flag);
        } else {
                if ((flag & FLAG_DATA_ACKED) && !frto_cwnd)
                        tcp_cong_avoid(sk, ack, prior_in_flight, 1);
index 3f5f7423b95ca818463938dbaad1c8bed8903bb3..9c94627c8c7e1888c3369f42fde366efbbe6d929 100644 (file)
@@ -2425,7 +2425,6 @@ struct proto tcp_prot = {
        .shutdown               = tcp_shutdown,
        .setsockopt             = tcp_setsockopt,
        .getsockopt             = tcp_getsockopt,
-       .sendmsg                = tcp_sendmsg,
        .recvmsg                = tcp_recvmsg,
        .backlog_rcv            = tcp_v4_do_rcv,
        .hash                   = tcp_v4_hash,
index 80e140e3ec2d6db57529fc73494dc47600a48501..e7f5ef92cbd88ec0fd8f341e8bfed09da7b68dd0 100644 (file)
@@ -260,13 +260,13 @@ static void tcp_lp_rtt_sample(struct sock *sk, u32 rtt)
  * newReno in increase case.
  * We work it out by following the idea from TCP-LP's paper directly
  */
-static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, ktime_t last)
+static void tcp_lp_pkts_acked(struct sock *sk, u32 num_acked, s32 rtt_us)
 {
        struct tcp_sock *tp = tcp_sk(sk);
        struct lp *lp = inet_csk_ca(sk);
 
-       if (!ktime_equal(last, net_invalid_timestamp()))
-               tcp_lp_rtt_sample(sk,  ktime_to_us(net_timedelta(last)));
+       if (rtt_us > 0)
+               tcp_lp_rtt_sample(sk, rtt_us);
 
        /* calc inference */
        if (tcp_time_stamp > tp->rx_opt.rcv_tsecr)
index 914e0307f7af2e89c58e7a29179dee64ebf29f3f..b49dedcda52df949c159db5b12635c9414a1538a 100644 (file)
@@ -112,16 +112,16 @@ EXPORT_SYMBOL_GPL(tcp_vegas_init);
  *   o min-filter RTT samples from a much longer window (forever for now)
  *     to find the propagation delay (baseRTT)
  */
-void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
+void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us)
 {
        struct vegas *vegas = inet_csk_ca(sk);
        u32 vrtt;
 
-       if (ktime_equal(last, net_invalid_timestamp()))
+       if (rtt_us < 0)
                return;
 
        /* Never allow zero rtt or baseRTT */
-       vrtt = ktime_to_us(net_timedelta(last)) + 1;
+       vrtt = rtt_us + 1;
 
        /* Filter to find propagation delay: */
        if (vrtt < vegas->baseRTT)
index 502fa8183634ae94bf5a5621aef666d545baa015..6c0eea2f8249bf6b08c85395c0ad4b4d8ef52b39 100644 (file)
@@ -17,7 +17,7 @@ struct vegas {
 
 extern void tcp_vegas_init(struct sock *sk);
 extern void tcp_vegas_state(struct sock *sk, u8 ca_state);
-extern void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, ktime_t last);
+extern void tcp_vegas_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us);
 extern void tcp_vegas_cwnd_event(struct sock *sk, enum tcp_ca_event event);
 extern void tcp_vegas_get_info(struct sock *sk, u32 ext, struct sk_buff *skb);
 
index 7a55ddf86032bdeab7bd0c48eca7358542c8f037..8fb2aee0b1a408171f43fd9e7b4d4987c6cc5f08 100644 (file)
@@ -69,16 +69,16 @@ static void tcp_veno_init(struct sock *sk)
 }
 
 /* Do rtt sampling needed for Veno. */
-static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
+static void tcp_veno_pkts_acked(struct sock *sk, u32 cnt, s32 rtt_us)
 {
        struct veno *veno = inet_csk_ca(sk);
        u32 vrtt;
 
-       if (ktime_equal(last, net_invalid_timestamp()))
+       if (rtt_us < 0)
                return;
 
        /* Never allow zero rtt or baseRTT */
-       vrtt = ktime_to_us(net_timedelta(last)) + 1;
+       vrtt = rtt_us + 1;
 
        /* Filter to find propagation delay: */
        if (vrtt < veno->basertt)
index e61e09dd513ed55c618ce5e7582ead8c9b99a4e1..20151d6a62413e09e4cb5b95d12fdb253148af61 100644 (file)
@@ -100,11 +100,12 @@ static void westwood_filter(struct westwood *w, u32 delta)
  * Called after processing group of packets.
  * but all westwood needs is the last sample of srtt.
  */
-static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt, ktime_t last)
+static void tcp_westwood_pkts_acked(struct sock *sk, u32 cnt, s32 rtt)
 {
        struct westwood *w = inet_csk_ca(sk);
-       if (cnt > 0)
-               w->rtt = tcp_sk(sk)->srtt >> 3;
+
+       if (rtt > 0)
+               w->rtt = usecs_to_jiffies(rtt);
 }
 
 /*
index c04b7c6ec7027ceb35e11d4ae23d5a4ce68a1479..c107fba7430e6c824c6aff448d0bdaf01e09eb8d 100644 (file)
@@ -58,7 +58,7 @@ static void tcp_yeah_init(struct sock *sk)
 }
 
 
-static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
+static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, s32 rtt_us)
 {
        const struct inet_connection_sock *icsk = inet_csk(sk);
        struct yeah *yeah = inet_csk_ca(sk);
@@ -66,7 +66,7 @@ static void tcp_yeah_pkts_acked(struct sock *sk, u32 pkts_acked, ktime_t last)
        if (icsk->icsk_ca_state == TCP_CA_Open)
                yeah->pkts_acked = pkts_acked;
 
-       tcp_vegas_pkts_acked(sk, pkts_acked, last);
+       tcp_vegas_pkts_acked(sk, pkts_acked, rtt_us);
 }
 
 static void tcp_yeah_cong_avoid(struct sock *sk, u32 ack,
index 06012920912a2f44e4f0b961e7c7108279a180de..91ef3be5abadeab0b778dfaba86cce6b440c3362 100644 (file)
@@ -2256,14 +2256,14 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
        struct net_device *dev = (struct net_device *) data;
        struct inet6_dev *idev = __in6_dev_get(dev);
        int run_pending = 0;
+       int err;
 
        switch(event) {
        case NETDEV_REGISTER:
                if (!idev && dev->mtu >= IPV6_MIN_MTU) {
                        idev = ipv6_add_dev(dev);
                        if (!idev)
-                               printk(KERN_WARNING "IPv6: add_dev failed for %s\n",
-                                       dev->name);
+                               return notifier_from_errno(-ENOMEM);
                }
                break;
        case NETDEV_UP:
@@ -2373,7 +2373,9 @@ static int addrconf_notify(struct notifier_block *this, unsigned long event,
                                              NULL);
                        addrconf_sysctl_register(idev, &idev->cnf);
 #endif
-                       snmp6_register_dev(idev);
+                       err = snmp6_register_dev(idev);
+                       if (err)
+                               return notifier_from_errno(err);
                }
                break;
        }
index faaefb692298152109d1c61b4bff176a6d42c29f..3f82e9542edab8840b7b715cda58e6a719950459 100644 (file)
@@ -50,6 +50,9 @@ int __ipv6_addr_type(const struct in6_addr *addr)
        if ((st & htonl(0xFFC00000)) == htonl(0xFEC00000))
                return (IPV6_ADDR_SITELOCAL | IPV6_ADDR_UNICAST |
                        IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_SITELOCAL));               /* addr-select 3.1 */
+       if ((st & htonl(0xFE000000)) == htonl(0xFC000000))
+               return (IPV6_ADDR_UNICAST |
+                       IPV6_ADDR_SCOPE_TYPE(IPV6_ADDR_SCOPE_GLOBAL));                  /* RFC 4193 */
 
        if ((addr->s6_addr32[0] | addr->s6_addr32[1]) == 0) {
                if (addr->s6_addr32[2] == 0) {
index eed09373a45d8cb9685ae28eebcaa761b5ef557e..b5f96372ad7344b3b815b85a5e29a0b08ac8ad13 100644 (file)
@@ -484,7 +484,7 @@ const struct proto_ops inet6_stream_ops = {
        .shutdown          = inet_shutdown,             /* ok           */
        .setsockopt        = sock_common_setsockopt,    /* ok           */
        .getsockopt        = sock_common_getsockopt,    /* ok           */
-       .sendmsg           = inet_sendmsg,              /* ok           */
+       .sendmsg           = tcp_sendmsg,               /* ok           */
        .recvmsg           = sock_common_recvmsg,       /* ok           */
        .mmap              = sock_no_mmap,
        .sendpage          = tcp_sendpage,
index df30976f6dfd196c7f40511356131c1f9a11c09a..ca774d8e3be35e09c010db9aae493e7db6be997f 100644 (file)
@@ -385,7 +385,7 @@ parse_tlv_tnl_enc_lim(struct sk_buff *skb, __u8 * raw)
 
 static int
 ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
-           int *type, int *code, int *msg, __be32 *info, int offset)
+           int *type, int *code, int *msg, __u32 *info, int offset)
 {
        struct ipv6hdr *ipv6h = (struct ipv6hdr *) skb->data;
        struct ip6_tnl *t;
@@ -435,7 +435,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
                if ((*code) == ICMPV6_HDR_FIELD)
                        teli = parse_tlv_tnl_enc_lim(skb, skb->data);
 
-               if (teli && teli == ntohl(*info) - 2) {
+               if (teli && teli == *info - 2) {
                        tel = (struct ipv6_tlv_tnl_enc_lim *) &skb->data[teli];
                        if (tel->encap_limit == 0) {
                                if (net_ratelimit())
@@ -452,7 +452,7 @@ ip6_tnl_err(struct sk_buff *skb, __u8 ipproto, struct inet6_skb_parm *opt,
                }
                break;
        case ICMPV6_PKT_TOOBIG:
-               mtu = ntohl(*info) - offset;
+               mtu = *info - offset;
                if (mtu < IPV6_MIN_MTU)
                        mtu = IPV6_MIN_MTU;
                t->dev->mtu = mtu;
@@ -478,12 +478,12 @@ out:
 
 static int
 ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
-          int type, int code, int offset, __u32 info)
+          int type, int code, int offset, __be32 info)
 {
        int rel_msg = 0;
        int rel_type = type;
        int rel_code = code;
-       __u32 rel_info = info;
+       __u32 rel_info = ntohl(info);
        int err;
        struct sk_buff *skb2;
        struct iphdr *eiph;
@@ -564,10 +564,9 @@ ip4ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
                        goto out;
 
                skb2->dst->ops->update_pmtu(skb2->dst, rel_info);
-               rel_info = htonl(rel_info);
        }
 
-       icmp_send(skb2, rel_type, rel_code, rel_info);
+       icmp_send(skb2, rel_type, rel_code, htonl(rel_info));
 
 out:
        kfree_skb(skb2);
@@ -576,12 +575,12 @@ out:
 
 static int
 ip6ip6_err(struct sk_buff *skb, struct inet6_skb_parm *opt,
-          int type, int code, int offset, __u32 info)
+          int type, int code, int offset, __be32 info)
 {
        int rel_msg = 0;
        int rel_type = type;
        int rel_code = code;
-       __u32 rel_info = info;
+       __u32 rel_info = ntohl(info);
        int err;
 
        err = ip6_tnl_err(skb, IPPROTO_IPV6, opt, &rel_type, &rel_code,
index 36df2218b669b1df1b3dcdb2b3d1143a040ae85d..3153e15e0f7c4a5e69e22775cc2097daa12d0985 100644 (file)
@@ -86,8 +86,8 @@ static int ipv6_print_conntrack(struct seq_file *s,
  *        - Note also special handling of AUTH header. Thanks to IPsec wizards.
  */
 
-int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start, u8 *nexthdrp,
-                          int len)
+static int nf_ct_ipv6_skip_exthdr(const struct sk_buff *skb, int start,
+                                 u8 *nexthdrp, int len)
 {
        u8 nexthdr = *nexthdrp;
 
index 919de682b3315473ef6f09ecb129febc48af5600..55ea80fac6016929efc6fcbdabfa0289f03f78fa 100644 (file)
@@ -1983,9 +1983,10 @@ static int rt6_mtu_change_route(struct rt6_info *rt, void *p_arg)
            !dst_metric_locked(&rt->u.dst, RTAX_MTU) &&
            (dst_mtu(&rt->u.dst) > arg->mtu ||
             (dst_mtu(&rt->u.dst) < arg->mtu &&
-             dst_mtu(&rt->u.dst) == idev->cnf.mtu6)))
+             dst_mtu(&rt->u.dst) == idev->cnf.mtu6))) {
                rt->u.dst.metrics[RTAX_MTU-1] = arg->mtu;
-       rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu);
+               rt->u.dst.metrics[RTAX_ADVMSS-1] = ipv6_advmss(arg->mtu);
+       }
        return 0;
 }
 
index f10f3689d6710274f90676c8dccc68d1fc1dc43d..0f7defb482e9bf18411eef3d1911d922b6dbda1d 100644 (file)
@@ -56,7 +56,6 @@
 #include <net/inet_ecn.h>
 #include <net/protocol.h>
 #include <net/xfrm.h>
-#include <net/addrconf.h>
 #include <net/snmp.h>
 #include <net/dsfield.h>
 #include <net/timewait_sock.h>
@@ -2115,7 +2114,6 @@ struct proto tcpv6_prot = {
        .shutdown               = tcp_shutdown,
        .setsockopt             = tcp_setsockopt,
        .getsockopt             = tcp_getsockopt,
-       .sendmsg                = tcp_sendmsg,
        .recvmsg                = tcp_recvmsg,
        .backlog_rcv            = tcp_v6_do_rcv,
        .hash                   = tcp_v6_hash,
index ad5150b8dfa9b583a20a73a2d03a348a386e4d10..983058d432dc8c613f63a48af80db1997679dd3f 100644 (file)
@@ -479,7 +479,8 @@ static void iucv_setmask_mp(void)
                /* Enable all cpus with a declared buffer. */
                if (cpu_isset(cpu, iucv_buffer_cpumask) &&
                    !cpu_isset(cpu, iucv_irq_cpumask))
-                       smp_call_function_on(iucv_allow_cpu, NULL, 0, 1, cpu);
+                       smp_call_function_single(cpu, iucv_allow_cpu,
+                                                NULL, 0, 1);
        preempt_enable();
 }
 
@@ -497,7 +498,7 @@ static void iucv_setmask_up(void)
        cpumask = iucv_irq_cpumask;
        cpu_clear(first_cpu(iucv_irq_cpumask), cpumask);
        for_each_cpu_mask(cpu, cpumask)
-               smp_call_function_on(iucv_block_cpu, NULL, 0, 1, cpu);
+               smp_call_function_single(cpu, iucv_block_cpu, NULL, 0, 1);
 }
 
 /**
@@ -522,7 +523,7 @@ static int iucv_enable(void)
        rc = -EIO;
        preempt_disable();
        for_each_online_cpu(cpu)
-               smp_call_function_on(iucv_declare_cpu, NULL, 0, 1, cpu);
+               smp_call_function_single(cpu, iucv_declare_cpu, NULL, 0, 1);
        preempt_enable();
        if (cpus_empty(iucv_buffer_cpumask))
                /* No cpu could declare an iucv buffer. */
@@ -578,7 +579,7 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
        case CPU_ONLINE_FROZEN:
        case CPU_DOWN_FAILED:
        case CPU_DOWN_FAILED_FROZEN:
-               smp_call_function_on(iucv_declare_cpu, NULL, 0, 1, cpu);
+               smp_call_function_single(cpu, iucv_declare_cpu, NULL, 0, 1);
                break;
        case CPU_DOWN_PREPARE:
        case CPU_DOWN_PREPARE_FROZEN:
@@ -587,10 +588,10 @@ static int __cpuinit iucv_cpu_notify(struct notifier_block *self,
                if (cpus_empty(cpumask))
                        /* Can't offline last IUCV enabled cpu. */
                        return NOTIFY_BAD;
-               smp_call_function_on(iucv_retrieve_cpu, NULL, 0, 1, cpu);
+               smp_call_function_single(cpu, iucv_retrieve_cpu, NULL, 0, 1);
                if (cpus_empty(iucv_irq_cpumask))
-                       smp_call_function_on(iucv_allow_cpu, NULL, 0, 1,
-                                            first_cpu(iucv_buffer_cpumask));
+                       smp_call_function_single(first_cpu(iucv_buffer_cpumask),
+                                                iucv_allow_cpu, NULL, 0, 1);
                break;
        }
        return NOTIFY_OK;
index 0f8304b0246bac224f241d7036341bf83db55532..5502df115a633df76ea810bc6b92a8d0baa526cb 100644 (file)
@@ -1206,6 +1206,9 @@ static struct xfrm_state * pfkey_msg2xfrm_state(struct sadb_msg *hdr,
                x->sel.prefixlen_s = addr->sadb_address_prefixlen;
        }
 
+       if (!x->sel.family)
+               x->sel.family = x->props.family;
+
        if (ext_hdrs[SADB_X_EXT_NAT_T_TYPE-1]) {
                struct sadb_x_nat_t_type* n_type;
                struct xfrm_encap_tmpl *natt;
@@ -2540,7 +2543,7 @@ static int pfkey_migrate(struct sock *sk, struct sk_buff *skb,
        sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
        sel.sport = ((struct sockaddr_in *)(sa + 1))->sin_port;
        if (sel.sport)
-               sel.sport_mask = ~0;
+               sel.sport_mask = htons(0xffff);
 
        /* set destination address info of selector */
        sa = ext_hdrs[SADB_EXT_ADDRESS_DST - 1],
@@ -2549,7 +2552,7 @@ static int pfkey_migrate(struct sock *sk, struct sk_buff *skb,
        sel.proto = pfkey_proto_to_xfrm(sa->sadb_address_proto);
        sel.dport = ((struct sockaddr_in *)(sa + 1))->sin_port;
        if (sel.dport)
-               sel.dport_mask = ~0;
+               sel.dport_mask = htons(0xffff);
 
        rq = (struct sadb_x_ipsecrequest *)(pol + 1);
 
index 799a9208c4b47899540196857dcd903052252093..095be91829ca63ba2d660ba2a0b76f6d3f340414 100644 (file)
@@ -271,9 +271,11 @@ static void add_files(struct ieee80211_sub_if_data *sdata)
        }
 }
 
-#define DEBUGFS_DEL(name, type)\
-       debugfs_remove(sdata->debugfs.type.name);\
-       sdata->debugfs.type.name = NULL;
+#define DEBUGFS_DEL(name, type)                                        \
+       do {                                                    \
+               debugfs_remove(sdata->debugfs.type.name);       \
+               sdata->debugfs.type.name = NULL;                \
+       } while (0)
 
 static void del_sta_files(struct ieee80211_sub_if_data *sdata)
 {
index d41e696f398040416bb88a6197f44026eea8c5d8..da34ea70276f828d47f69d790e8b201bcc08937c 100644 (file)
@@ -157,7 +157,7 @@ static ssize_t sta_last_seq_ctrl_read(struct file *file, char __user *userbuf,
        struct sta_info *sta = file->private_data;
        for (i = 0; i < NUM_RX_DATA_QUEUES; i++)
                p += scnprintf(p, sizeof(buf)+buf-p, "%x ",
-                              sta->last_seq_ctrl[i]);
+                              le16_to_cpu(sta->last_seq_ctrl[i]));
        p += scnprintf(p, sizeof(buf)+buf-p, "\n");
        return simple_read_from_buffer(userbuf, count, ppos, buf, p - buf);
 }
index c944b17d0fc0c0c51e22a943774f8b6e3779af02..8ec5ed192b5d889f3211c6a955e656442ebd4fd9 100644 (file)
@@ -1650,6 +1650,7 @@ static int ieee80211_master_start_xmit(struct sk_buff *skb,
        if (skb_headroom(skb) < headroom) {
                if (pskb_expand_head(skb, headroom, 0, GFP_ATOMIC)) {
                        dev_kfree_skb(skb);
+                       dev_put(odev);
                        return 0;
                }
        }
index d0e1ab5589dbbbc0b33c4efcadb47a6c8c6043fb..e7904db553255eb5cf96697ce671e24ea5cc6af5 100644 (file)
@@ -697,17 +697,24 @@ static int ieee80211_ioctl_siwscan(struct net_device *dev,
        if (!netif_running(dev))
                return -ENETDOWN;
 
-       if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
-               if (sdata->type == IEEE80211_IF_TYPE_STA ||
-                   sdata->type == IEEE80211_IF_TYPE_IBSS) {
+       switch (sdata->type) {
+       case IEEE80211_IF_TYPE_STA:
+       case IEEE80211_IF_TYPE_IBSS:
+               if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
                        ssid = sdata->u.sta.ssid;
                        ssid_len = sdata->u.sta.ssid_len;
-               } else if (sdata->type == IEEE80211_IF_TYPE_AP) {
+               }
+               break;
+       case IEEE80211_IF_TYPE_AP:
+               if (local->scan_flags & IEEE80211_SCAN_MATCH_SSID) {
                        ssid = sdata->u.ap.ssid;
                        ssid_len = sdata->u.ap.ssid_len;
-               } else
-                       return -EINVAL;
+               }
+               break;
+       default:
+               return -EOPNOTSUPP;
        }
+
        return ieee80211_sta_req_scan(dev, ssid, ssid_len);
 }
 
index aa086c83af8000e0114cb46fc76fc6c4df4af717..0fe11889ce141c70f9811a5b8fd89a6e9d267265 100644 (file)
@@ -79,7 +79,8 @@ static u_int32_t __hash_conntrack(const struct nf_conntrack_tuple *tuple,
        a = jhash2(tuple->src.u3.all, ARRAY_SIZE(tuple->src.u3.all),
                   (tuple->src.l3num << 16) | tuple->dst.protonum);
        b = jhash2(tuple->dst.u3.all, ARRAY_SIZE(tuple->dst.u3.all),
-                  (tuple->src.u.all << 16) | tuple->dst.u.all);
+                  ((__force __u16)tuple->src.u.all << 16) |
+                   (__force __u16)tuple->dst.u.all);
 
        return jhash_2words(a, b, rnd) % size;
 }
index 1aa6229ca99f66d3e1385d9d87ec6545e315a58b..3ac64e25f10cd45f5629eada35b02a217933159e 100644 (file)
@@ -80,7 +80,7 @@ static unsigned int nf_ct_expect_dst_hash(const struct nf_conntrack_tuple *tuple
 
        return jhash2(tuple->dst.u3.all, ARRAY_SIZE(tuple->dst.u3.all),
                      (((tuple->dst.protonum ^ tuple->src.l3num) << 16) |
-                      tuple->dst.u.all) ^ nf_ct_expect_hash_rnd) %
+                      (__force __u16)tuple->dst.u.all) ^ nf_ct_expect_hash_rnd) %
               nf_ct_expect_hsize;
 }
 
@@ -259,8 +259,8 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, int family,
        }
 
        if (src) {
-               exp->tuple.src.u.all = (__force u16)*src;
-               exp->mask.src.u.all = 0xFFFF;
+               exp->tuple.src.u.all = *src;
+               exp->mask.src.u.all = htons(0xFFFF);
        } else {
                exp->tuple.src.u.all = 0;
                exp->mask.src.u.all = 0;
@@ -272,7 +272,7 @@ void nf_ct_expect_init(struct nf_conntrack_expect *exp, int family,
                memset((void *)&exp->tuple.dst.u3 + len, 0x00,
                       sizeof(exp->tuple.dst.u3) - len);
 
-       exp->tuple.dst.u.all = (__force u16)*dst;
+       exp->tuple.dst.u.all = *dst;
 }
 EXPORT_SYMBOL_GPL(nf_ct_expect_init);
 
@@ -477,15 +477,14 @@ static int exp_open(struct inode *inode, struct file *file)
        struct ct_expect_iter_state *st;
        int ret;
 
-       st = kmalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
-       if (st == NULL)
+       st = kzalloc(sizeof(struct ct_expect_iter_state), GFP_KERNEL);
+       if (!st)
                return -ENOMEM;
        ret = seq_open(file, &exp_seq_ops);
        if (ret)
                goto out_free;
        seq          = file->private_data;
        seq->private = st;
-       memset(st, 0, sizeof(struct ct_expect_iter_state));
        return ret;
 out_free:
        kfree(st);
index ca10df40784f960c820b90ff029a103aeac5185a..96aa637c09327e6c79a85ec6a76cd86228aa908a 100644 (file)
@@ -39,7 +39,7 @@ static int nf_ct_helper_vmalloc;
 static unsigned int helper_hash(const struct nf_conntrack_tuple *tuple)
 {
        return (((tuple->src.l3num << 8) | tuple->dst.protonum) ^
-               tuple->src.u.all) % nf_ct_helper_hsize;
+               (__force __u16)tuple->src.u.all) % nf_ct_helper_hsize;
 }
 
 struct nf_conntrack_helper *
index 6f89b105a20572e1a120eae249ac5389803a7d59..2863e72b40916d74fd7d1ed63a83f1ef16d6bd1d 100644 (file)
@@ -1052,17 +1052,18 @@ ctnetlink_new_conntrack(struct sock *ctnl, struct sk_buff *skb,
        }
        /* implicit 'else' */
 
-       /* we only allow nat config for new conntracks */
-       if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
-               err = -EINVAL;
-               goto out_unlock;
-       }
-
        /* We manipulate the conntrack inside the global conntrack table lock,
         * so there's no need to increase the refcount */
        err = -EEXIST;
-       if (!(nlh->nlmsg_flags & NLM_F_EXCL))
-               err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h), cda);
+       if (!(nlh->nlmsg_flags & NLM_F_EXCL)) {
+               /* we only allow nat config for new conntracks */
+               if (cda[CTA_NAT_SRC-1] || cda[CTA_NAT_DST-1]) {
+                       err = -EINVAL;
+                       goto out_unlock;
+               }
+               err = ctnetlink_change_conntrack(nf_ct_tuplehash_to_ctrack(h),
+                                                cda);
+       }
 
 out_unlock:
        write_unlock_bh(&nf_conntrack_lock);
index 3335dd5be96208e72efe57a08436aaf096ba2d62..06cff1d13690909860a89275fc30dd4a861dbc54 100644 (file)
@@ -42,13 +42,13 @@ struct xt_connlimit_data {
 static u_int32_t connlimit_rnd;
 static bool connlimit_rnd_inited;
 
-static inline unsigned int connlimit_iphash(u_int32_t addr)
+static inline unsigned int connlimit_iphash(__be32 addr)
 {
        if (unlikely(!connlimit_rnd_inited)) {
                get_random_bytes(&connlimit_rnd, sizeof(connlimit_rnd));
                connlimit_rnd_inited = true;
        }
-       return jhash_1word(addr, connlimit_rnd) & 0xFF;
+       return jhash_1word((__force __u32)addr, connlimit_rnd) & 0xFF;
 }
 
 static inline unsigned int
@@ -66,7 +66,7 @@ connlimit_iphash6(const union nf_conntrack_address *addr,
        for (i = 0; i < ARRAY_SIZE(addr->ip6); ++i)
                res.ip6[i] = addr->ip6[i] & mask->ip6[i];
 
-       return jhash2(res.ip6, ARRAY_SIZE(res.ip6), connlimit_rnd) & 0xFF;
+       return jhash2((u32 *)res.ip6, ARRAY_SIZE(res.ip6), connlimit_rnd) & 0xFF;
 }
 
 static inline bool already_closed(const struct nf_conn *conn)
index 04b677ae8daee6e39f1f7e947b82fb5b91774516..74f9b14c012f45e819938e6bb5c2873163d0cd13 100644 (file)
@@ -21,6 +21,7 @@ static bool u32_match_it(const struct xt_u32 *data,
        unsigned int nnums;
        unsigned int nvals;
        unsigned int i;
+       __be32 n;
        u_int32_t pos;
        u_int32_t val;
        u_int32_t at;
@@ -38,9 +39,9 @@ static bool u32_match_it(const struct xt_u32 *data,
                if (skb->len < 4 || pos > skb->len - 4);
                        return false;
 
-               ret   = skb_copy_bits(skb, pos, &val, sizeof(val));
+               ret   = skb_copy_bits(skb, pos, &n, sizeof(n));
                BUG_ON(ret < 0);
-               val   = ntohl(val);
+               val   = ntohl(n);
                nnums = ct->nnums;
 
                /* Inner loop runs over "&", "<<", ">>" and "@" operands */
@@ -65,10 +66,10 @@ static bool u32_match_it(const struct xt_u32 *data,
                                    pos > skb->len - at - 4)
                                        return false;
 
-                               ret = skb_copy_bits(skb, at + pos, &val,
-                                                   sizeof(val));
+                               ret = skb_copy_bits(skb, at + pos, &n,
+                                                   sizeof(n));
                                BUG_ON(ret < 0);
-                               val = ntohl(val);
+                               val = ntohl(n);
                                break;
                        }
                }
index f46a0aeec44fa928febb4d209754d384e3ad521b..b6c844b7e1c148a105fd65c5552393c808a3b29a 100644 (file)
@@ -126,7 +126,9 @@ static struct netlbl_dom_map *netlbl_domhsh_search(const char *domain, u32 def)
 
        if (domain != NULL) {
                bkt = netlbl_domhsh_hash(domain);
-               list_for_each_entry_rcu(iter, &netlbl_domhsh->tbl[bkt], list)
+               list_for_each_entry_rcu(iter,
+                                    &rcu_dereference(netlbl_domhsh)->tbl[bkt],
+                                    list)
                        if (iter->valid && strcmp(iter->domain, domain) == 0)
                                return iter;
        }
@@ -227,7 +229,7 @@ int netlbl_domhsh_add(struct netlbl_dom_map *entry,
                spin_lock(&netlbl_domhsh_lock);
                if (netlbl_domhsh_search(entry->domain, 0) == NULL)
                        list_add_tail_rcu(&entry->list,
-                                         &netlbl_domhsh->tbl[bkt]);
+                                   &rcu_dereference(netlbl_domhsh)->tbl[bkt]);
                else
                        ret_val = -EEXIST;
                spin_unlock(&netlbl_domhsh_lock);
@@ -423,8 +425,8 @@ int netlbl_domhsh_walk(u32 *skip_bkt,
             iter_bkt < rcu_dereference(netlbl_domhsh)->size;
             iter_bkt++, chain_cnt = 0) {
                list_for_each_entry_rcu(iter_entry,
-                                       &netlbl_domhsh->tbl[iter_bkt],
-                                       list)
+                               &rcu_dereference(netlbl_domhsh)->tbl[iter_bkt],
+                               list)
                        if (iter_entry->valid) {
                                if (chain_cnt++ < *skip_chain)
                                        continue;
index 89dcc485653bd6601fb078130396d929c81d9038..85a96a3fddaafdaa016dbdd14aea0f9433d8c22e 100644 (file)
@@ -113,8 +113,10 @@ struct audit_buffer *netlbl_audit_start_common(int type,
        if (audit_info->secid != 0 &&
            security_secid_to_secctx(audit_info->secid,
                                     &secctx,
-                                    &secctx_len) == 0)
+                                    &secctx_len) == 0) {
                audit_log_format(audit_buf, " subj=%s", secctx);
+               security_release_secctx(secctx, secctx_len);
+       }
 
        return audit_buf;
 }
index 372b24466dc768fa1765de0a471e10dc8ba0ad9d..d6667f7bc85edab71ecfa411f87d202d10b5fcd0 100644 (file)
@@ -71,7 +71,7 @@ struct rxrpc_conn_bundle *rxrpc_get_bundle(struct rxrpc_sock *rx,
        struct rb_node *p, *parent, **pp;
 
        _enter("%p{%x},%x,%hx,",
-              rx, key_serial(key), trans->debug_id, ntohl(service_id));
+              rx, key_serial(key), trans->debug_id, ntohs(service_id));
 
        if (rx->trans == trans && rx->bundle) {
                atomic_inc(&rx->bundle->usage);
index bf90e60f8411c1ff49281bef88360a98f2a32188..6085be5784598e1b5c40e712d80b24d2d6643209 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/string.h>
 #include <linux/errno.h>
 #include <linux/skbuff.h>
-#include <linux/module.h>
 #include <linux/rtnetlink.h>
 #include <linux/init.h>
 #include <net/act_api.h>
index 13c09bc32aa32a10af58ec01eab462fab55958ba..dee0d5fb39c555a5f1f60eaaf4f4dd3df9ae666d 100644 (file)
@@ -380,6 +380,10 @@ void qdisc_tree_decrease_qlen(struct Qdisc *sch, unsigned int n)
                return;
        while ((parentid = sch->parent)) {
                sch = qdisc_lookup(sch->dev, TC_H_MAJ(parentid));
+               if (sch == NULL) {
+                       WARN_ON(parentid != TC_H_ROOT);
+                       return;
+               }
                cops = sch->ops->cl_ops;
                if (cops->qlen_notify) {
                        cl = cops->get(sch, parentid);
@@ -420,8 +424,6 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
                        unsigned long cl = cops->get(parent, classid);
                        if (cl) {
                                err = cops->graft(parent, cl, new, old);
-                               if (new)
-                                       new->parent = classid;
                                cops->put(parent, cl);
                        }
                }
@@ -436,7 +438,8 @@ static int qdisc_graft(struct net_device *dev, struct Qdisc *parent,
  */
 
 static struct Qdisc *
-qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
+qdisc_create(struct net_device *dev, u32 parent, u32 handle,
+          struct rtattr **tca, int *errp)
 {
        int err;
        struct rtattr *kind = tca[TCA_KIND-1];
@@ -482,6 +485,8 @@ qdisc_create(struct net_device *dev, u32 handle, struct rtattr **tca, int *errp)
                goto err_out2;
        }
 
+       sch->parent = parent;
+
        if (handle == TC_H_INGRESS) {
                sch->flags |= TCQ_F_INGRESS;
                sch->stats_lock = &dev->ingress_lock;
@@ -758,9 +763,11 @@ create_n_graft:
        if (!(n->nlmsg_flags&NLM_F_CREATE))
                return -ENOENT;
        if (clid == TC_H_INGRESS)
-               q = qdisc_create(dev, tcm->tcm_parent, tca, &err);
+               q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_parent,
+                                tca, &err);
        else
-               q = qdisc_create(dev, tcm->tcm_handle, tca, &err);
+               q = qdisc_create(dev, tcm->tcm_parent, tcm->tcm_handle,
+                                tca, &err);
        if (q == NULL) {
                if (err == -EAGAIN)
                        goto replay;
index 51f16b0af198deb9e7d3810b9b0024b65ab396e2..2d32fd27496ecf8011999827f0450958d0e76486 100644 (file)
@@ -158,9 +158,8 @@ static int ingress_enqueue(struct sk_buff *skb,struct Qdisc *sch)
                        break;
                case TC_ACT_RECLASSIFY:
                case TC_ACT_OK:
-               case TC_ACT_UNSPEC:
-               default:
                        skb->tc_index = TC_H_MIN(res.classid);
+               default:
                        result = TC_ACT_OK;
                        break;
        }
index 2d8c08493d6e9275683161418c0fd26cf4ec5a37..4a49db65772e7c23d60214720d0db5ab4c844a59 100644 (file)
@@ -38,9 +38,11 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
        struct prio_sched_data *q = qdisc_priv(sch);
        u32 band = skb->priority;
        struct tcf_result res;
+       int err;
 
        *qerr = NET_XMIT_BYPASS;
        if (TC_H_MAJ(skb->priority) != sch->handle) {
+               err = tc_classify(skb, q->filter_list, &res);
 #ifdef CONFIG_NET_CLS_ACT
                switch (tc_classify(skb, q->filter_list, &res)) {
                case TC_ACT_STOLEN:
@@ -49,11 +51,8 @@ prio_classify(struct sk_buff *skb, struct Qdisc *sch, int *qerr)
                case TC_ACT_SHOT:
                        return NULL;
                }
-
-               if (!q->filter_list ) {
-#else
-               if (!q->filter_list || tc_classify(skb, q->filter_list, &res)) {
 #endif
+               if (!q->filter_list || err < 0) {
                        if (TC_H_MAJ(band))
                                band = 0;
                        band = q->prio2band[band&TC_PRIO_MAX];
@@ -239,11 +238,13 @@ static int prio_tune(struct Qdisc *sch, struct rtattr *opt)
        /* If we're multiqueue, make sure the number of incoming bands
         * matches the number of queues on the device we're associating with.
         * If the number of bands requested is zero, then set q->bands to
-        * dev->egress_subqueue_count.
+        * dev->egress_subqueue_count.  Also, the root qdisc must be the
+        * only one that is enabled for multiqueue, since it's the only one
+        * that interacts with the underlying device.
         */
        q->mq = RTA_GET_FLAG(tb[TCA_PRIO_MQ - 1]);
        if (q->mq) {
-               if (sch->handle != TC_H_ROOT)
+               if (sch->parent != TC_H_ROOT)
                        return -EINVAL;
                if (netif_is_multiqueue(sch->dev)) {
                        if (q->bands == 0)
index d57ff7f3c5764510e32c8b1812c2c89492df9da8..47e56017f4ce887716e0dee8a4ba87d3ece37ac9 100644 (file)
@@ -590,7 +590,7 @@ out_unlock:
  * Return 0 - If further processing is needed.
  * Return 1 - If the packet can be discarded right away.
  */
-int sctp_rcv_ootb(struct sk_buff *skb)
+static int sctp_rcv_ootb(struct sk_buff *skb)
 {
        sctp_chunkhdr_t *ch;
        __u8 *ch_end;
index 2c29394fd92ebf4367a24d7bb8883b657832c10f..f8aa23dda1c16a30ba07832b526b2904af3adba2 100644 (file)
@@ -641,6 +641,8 @@ static struct sock *sctp_v6_create_accept_sk(struct sock *sk,
        newsctp6sk = (struct sctp6_sock *)newsk;
        inet_sk(newsk)->pinet6 = &newsctp6sk->inet6;
 
+       sctp_sk(newsk)->v4mapped = sctp_sk(sk)->v4mapped;
+
        newinet = inet_sk(newsk);
        newnp = inet6_sk(newsk);
 
index 8d18f570c2e6186598225b330430402b9eab24a1..51c4d7fef1d23137c29fd30aabdeb261ae1e9d86 100644 (file)
@@ -65,8 +65,6 @@
 #include <net/sctp/sctp.h>
 #include <net/sctp/sm.h>
 
-extern struct kmem_cache *sctp_chunk_cachep;
-
 SCTP_STATIC
 struct sctp_chunk *sctp_make_chunk(const struct sctp_association *asoc,
                                   __u8 type, __u8 flags, int paylen);
@@ -115,15 +113,12 @@ void  sctp_init_cause(struct sctp_chunk *chunk, __be16 cause_code,
                      const void *payload, size_t paylen)
 {
        sctp_errhdr_t err;
-       int padlen;
        __u16 len;
 
        /* Cause code constants are now defined in network order.  */
        err.cause = cause_code;
        len = sizeof(sctp_errhdr_t) + paylen;
-       padlen = len % 4;
        err.length  = htons(len);
-       len += padlen;
        chunk->subh.err_hdr = sctp_addto_chunk(chunk, sizeof(sctp_errhdr_t), &err);
        sctp_addto_chunk(chunk, paylen, payload);
 }
@@ -1454,7 +1449,6 @@ no_hmac:
                do_gettimeofday(&tv);
 
        if (!asoc && tv_lt(bear_cookie->expiration, tv)) {
-               __u16 len;
                /*
                 * Section 3.3.10.3 Stale Cookie Error (3)
                 *
index fd2dfdd7d7fd056ff06ea7422ee90186fc1536aa..71cad56dd73fe62e0e1422f23cd7eb56c5f31f70 100644 (file)
@@ -97,6 +97,13 @@ static sctp_disposition_t sctp_stop_t1_and_abort(sctp_cmd_seq_t *commands,
                                           const struct sctp_association *asoc,
                                           struct sctp_transport *transport);
 
+static sctp_disposition_t sctp_sf_abort_violation(
+                                    const struct sctp_association *asoc,
+                                    void *arg,
+                                    sctp_cmd_seq_t *commands,
+                                    const __u8 *payload,
+                                    const size_t paylen);
+
 static sctp_disposition_t sctp_sf_violation_chunklen(
                                     const struct sctp_endpoint *ep,
                                     const struct sctp_association *asoc,
@@ -104,6 +111,13 @@ static sctp_disposition_t sctp_sf_violation_chunklen(
                                     void *arg,
                                     sctp_cmd_seq_t *commands);
 
+static sctp_disposition_t sctp_sf_violation_ctsn(
+                                    const struct sctp_endpoint *ep,
+                                    const struct sctp_association *asoc,
+                                    const sctp_subtype_t type,
+                                    void *arg,
+                                    sctp_cmd_seq_t *commands);
+
 /* Small helper function that checks if the chunk length
  * is of the appropriate length.  The 'required_length' argument
  * is set to be the size of a specific chunk we are testing.
@@ -2880,6 +2894,13 @@ sctp_disposition_t sctp_sf_eat_sack_6_2(const struct sctp_endpoint *ep,
                return SCTP_DISPOSITION_DISCARD;
        }
 
+       /* If Cumulative TSN Ack beyond the max tsn currently
+        * send, terminating the association and respond to the
+        * sender with an ABORT.
+        */
+       if (!TSN_lt(ctsn, asoc->next_tsn))
+               return sctp_sf_violation_ctsn(ep, asoc, type, arg, commands);
+
        /* Return this SACK for further processing.  */
        sctp_add_cmd_sf(commands, SCTP_CMD_PROCESS_SACK, SCTP_SACKH(sackh));
 
@@ -3691,40 +3712,21 @@ sctp_disposition_t sctp_sf_violation(const struct sctp_endpoint *ep,
        return SCTP_DISPOSITION_VIOLATION;
 }
 
-
 /*
- * Handle a protocol violation when the chunk length is invalid.
- * "Invalid" length is identified as smaller then the minimal length a
- * given chunk can be.  For example, a SACK chunk has invalid length
- * if it's length is set to be smaller then the size of sctp_sack_chunk_t.
- *
- * We inform the other end by sending an ABORT with a Protocol Violation
- * error code.
- *
- * Section: Not specified
- * Verification Tag:  Nothing to do
- * Inputs
- * (endpoint, asoc, chunk)
- *
- * Outputs
- * (reply_msg, msg_up, counters)
- *
- * Generate an  ABORT chunk and terminate the association.
+ * Common function to handle a protocol violation.
  */
-static sctp_disposition_t sctp_sf_violation_chunklen(
-                                    const struct sctp_endpoint *ep,
+static sctp_disposition_t sctp_sf_abort_violation(
                                     const struct sctp_association *asoc,
-                                    const sctp_subtype_t type,
                                     void *arg,
-                                    sctp_cmd_seq_t *commands)
+                                    sctp_cmd_seq_t *commands,
+                                    const __u8 *payload,
+                                    const size_t paylen)
 {
        struct sctp_chunk *chunk =  arg;
        struct sctp_chunk *abort = NULL;
-       char               err_str[]="The following chunk had invalid length:";
 
        /* Make the abort chunk. */
-       abort = sctp_make_abort_violation(asoc, chunk, err_str,
-                                         sizeof(err_str));
+       abort = sctp_make_abort_violation(asoc, chunk, payload, paylen);
        if (!abort)
                goto nomem;
 
@@ -3756,6 +3758,57 @@ nomem:
        return SCTP_DISPOSITION_NOMEM;
 }
 
+/*
+ * Handle a protocol violation when the chunk length is invalid.
+ * "Invalid" length is identified as smaller then the minimal length a
+ * given chunk can be.  For example, a SACK chunk has invalid length
+ * if it's length is set to be smaller then the size of sctp_sack_chunk_t.
+ *
+ * We inform the other end by sending an ABORT with a Protocol Violation
+ * error code.
+ *
+ * Section: Not specified
+ * Verification Tag:  Nothing to do
+ * Inputs
+ * (endpoint, asoc, chunk)
+ *
+ * Outputs
+ * (reply_msg, msg_up, counters)
+ *
+ * Generate an  ABORT chunk and terminate the association.
+ */
+static sctp_disposition_t sctp_sf_violation_chunklen(
+                                    const struct sctp_endpoint *ep,
+                                    const struct sctp_association *asoc,
+                                    const sctp_subtype_t type,
+                                    void *arg,
+                                    sctp_cmd_seq_t *commands)
+{
+       char err_str[]="The following chunk had invalid length:";
+
+       return sctp_sf_abort_violation(asoc, arg, commands, err_str,
+                                       sizeof(err_str));
+}
+
+/* Handle a protocol violation when the peer trying to advance the
+ * cumulative tsn ack to a point beyond the max tsn currently sent.
+ *
+ * We inform the other end by sending an ABORT with a Protocol Violation
+ * error code.
+ */
+static sctp_disposition_t sctp_sf_violation_ctsn(
+                                    const struct sctp_endpoint *ep,
+                                    const struct sctp_association *asoc,
+                                    const sctp_subtype_t type,
+                                    void *arg,
+                                    sctp_cmd_seq_t *commands)
+{
+       char err_str[]="The cumulative tsn ack beyond the max tsn currently sent:";
+
+       return sctp_sf_abort_violation(asoc, arg, commands, err_str,
+                                       sizeof(err_str));
+}
+
 /***************************************************************************
  * These are the state functions for handling primitive (Section 10) events.
  ***************************************************************************/
index ee88f2ea5101df0e13c4d11aad349f39143aca46..01c6364245b7081ec1224ef10c8434eebdb971ed 100644 (file)
@@ -107,8 +107,6 @@ static void sctp_sock_migrate(struct sock *, struct sock *,
                              struct sctp_association *, sctp_socket_type_t);
 static char *sctp_hmac_alg = SCTP_COOKIE_HMAC_ALG;
 
-extern struct kmem_cache *sctp_bucket_cachep;
-
 /* Get the sndbuf space available at the time on the association.  */
 static inline int sctp_wspace(struct sctp_association *asoc)
 {
@@ -433,7 +431,7 @@ out:
  *
  * Only sctp_setsockopt_bindx() is supposed to call this function.
  */
-int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt)
+static int sctp_bindx_add(struct sock *sk, struct sockaddr *addrs, int addrcnt)
 {
        int cnt;
        int retval = 0;
@@ -602,7 +600,7 @@ out:
  *
  * Only sctp_setsockopt_bindx() is supposed to call this function.
  */
-int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
+static int sctp_bindx_rem(struct sock *sk, struct sockaddr *addrs, int addrcnt)
 {
        struct sctp_sock *sp = sctp_sk(sk);
        struct sctp_endpoint *ep = sp->ep;
@@ -977,7 +975,7 @@ static int __sctp_connect(struct sock* sk,
        int err = 0;
        int addrcnt = 0;
        int walk_size = 0;
-       union sctp_addr *sa_addr;
+       union sctp_addr *sa_addr = NULL;
        void *addr_buf;
        unsigned short port;
        unsigned int f_flags = 0;
@@ -1011,7 +1009,10 @@ static int __sctp_connect(struct sock* sk,
                        goto out_free;
                }
 
-               err = sctp_verify_addr(sk, sa_addr, af->sockaddr_len);
+               /* Save current address so we can work with it */
+               memcpy(&to, sa_addr, af->sockaddr_len);
+
+               err = sctp_verify_addr(sk, &to, af->sockaddr_len);
                if (err)
                        goto out_free;
 
@@ -1021,12 +1022,11 @@ static int __sctp_connect(struct sock* sk,
                if (asoc && asoc->peer.port && asoc->peer.port != port)
                        goto out_free;
 
-               memcpy(&to, sa_addr, af->sockaddr_len);
 
                /* Check if there already is a matching association on the
                 * endpoint (other than the one created here).
                 */
-               asoc2 = sctp_endpoint_lookup_assoc(ep, sa_addr, &transport);
+               asoc2 = sctp_endpoint_lookup_assoc(ep, &to, &transport);
                if (asoc2 && asoc2 != asoc) {
                        if (asoc2->state >= SCTP_STATE_ESTABLISHED)
                                err = -EISCONN;
@@ -1039,7 +1039,7 @@ static int __sctp_connect(struct sock* sk,
                 * make sure that there is no peeled-off association matching
                 * the peer address even on another socket.
                 */
-               if (sctp_endpoint_is_peeled_off(ep, sa_addr)) {
+               if (sctp_endpoint_is_peeled_off(ep, &to)) {
                        err = -EADDRNOTAVAIL;
                        goto out_free;
                }
@@ -1070,7 +1070,7 @@ static int __sctp_connect(struct sock* sk,
                                }
                        }
 
-                       scope = sctp_scope(sa_addr);
+                       scope = sctp_scope(&to);
                        asoc = sctp_association_new(ep, sk, scope, GFP_KERNEL);
                        if (!asoc) {
                                err = -ENOMEM;
@@ -1079,7 +1079,7 @@ static int __sctp_connect(struct sock* sk,
                }
 
                /* Prime the peer's transport structures.  */
-               transport = sctp_assoc_add_peer(asoc, sa_addr, GFP_KERNEL,
+               transport = sctp_assoc_add_peer(asoc, &to, GFP_KERNEL,
                                                SCTP_UNKNOWN);
                if (!transport) {
                        err = -ENOMEM;
@@ -1103,8 +1103,8 @@ static int __sctp_connect(struct sock* sk,
 
        /* Initialize sk's dport and daddr for getpeername() */
        inet_sk(sk)->dport = htons(asoc->peer.port);
-       af = sctp_get_af_specific(to.sa.sa_family);
-       af->to_sk_daddr(&to, sk);
+       af = sctp_get_af_specific(sa_addr->sa.sa_family);
+       af->to_sk_daddr(sa_addr, sk);
        sk->sk_err = 0;
 
        /* in-kernel sockets don't generally have a file allocated to them
@@ -1531,7 +1531,6 @@ SCTP_STATIC int sctp_sendmsg(struct kiocb *iocb, struct sock *sk,
                        goto out_unlock;
                }
                if (sinfo_flags & SCTP_ABORT) {
-                       struct sctp_chunk *chunk;
 
                        chunk = sctp_make_abort_user(asoc, msg, msg_len);
                        if (!chunk) {
@@ -4353,7 +4352,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
                                                space_left, &bytes_copied);
                        if (cnt < 0) {
                                err = cnt;
-                               goto error;
+                               goto error_lock;
                        }
                        goto copy_getaddrs;
                }
@@ -4367,7 +4366,7 @@ static int sctp_getsockopt_local_addrs(struct sock *sk, int len,
                addrlen = sctp_get_af_specific(temp.sa.sa_family)->sockaddr_len;
                if (space_left < addrlen) {
                        err =  -ENOMEM; /*fixme: right error?*/
-                       goto error;
+                       goto error_lock;
                }
                memcpy(buf, &temp, addrlen);
                buf += addrlen;
@@ -4381,15 +4380,21 @@ copy_getaddrs:
 
        if (copy_to_user(to, addrs, bytes_copied)) {
                err = -EFAULT;
-               goto error;
+               goto out;
        }
        if (put_user(cnt, &((struct sctp_getaddrs __user *)optval)->addr_num)) {
                err = -EFAULT;
-               goto error;
+               goto out;
        }
        if (put_user(bytes_copied, optlen))
                err = -EFAULT;
-error:
+
+       goto out;
+
+error_lock:
+       sctp_read_unlock(addr_lock);
+
+out:
        kfree(addrs);
        return err;
 }
@@ -5964,7 +5969,7 @@ static int sctp_wait_for_accept(struct sock *sk, long timeo)
        return err;
 }
 
-void sctp_wait_for_close(struct sock *sk, long timeout)
+static void sctp_wait_for_close(struct sock *sk, long timeout)
 {
        DEFINE_WAIT(wait);
 
index d3192a1babccb96645c8f3d54db2621a62073fc1..1ff0daade304ae68ddae5630f390faea8a979058 100644 (file)
@@ -161,7 +161,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
                                         __u16 *start, __u16 *end)
 {
        int started, ended;
-       __u16 _start, _end, offset;
+       __u16 start_, end_, offset;
 
        /* We haven't found a gap yet.  */
        started = ended = 0;
@@ -175,7 +175,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
 
                offset = iter->start - map->base_tsn;
                sctp_tsnmap_find_gap_ack(map->tsn_map, offset, map->len, 0,
-                                        &started, &_start, &ended, &_end);
+                                        &started, &start_, &ended, &end_);
        }
 
        /* Do we need to check the overflow map? */
@@ -193,8 +193,8 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
                                         offset,
                                         map->len,
                                         map->len,
-                                        &started, &_start,
-                                        &ended, &_end);
+                                        &started, &start_,
+                                        &ended, &end_);
        }
 
        /* The Gap Ack Block happens to end at the end of the
@@ -202,7 +202,7 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
         */
        if (started && !ended) {
                ended++;
-               _end = map->len + map->len - 1;
+               end_ = map->len + map->len - 1;
        }
 
        /* If we found a Gap Ack Block, return the start and end and
@@ -215,8 +215,8 @@ SCTP_STATIC int sctp_tsnmap_next_gap_ack(const struct sctp_tsnmap *map,
                int gap = map->cumulative_tsn_ack_point -
                        map->base_tsn;
 
-               *start = _start - gap;
-               *end = _end - gap;
+               *start = start_ - gap;
+               *end = end_ - gap;
 
                /* Move the iterator forward.  */
                iter->start = map->cumulative_tsn_ack_point + *end + 1;
index 4bbc59cc237ce8384cb6fc4b3dd0ba38c42ebab1..53995af9ca4b0f3b64708f59025528172ee80d4b 100644 (file)
@@ -736,9 +736,6 @@ gss_do_free_ctx(struct gss_cl_ctx *ctx)
 {
        dprintk("RPC:       gss_free_ctx\n");
 
-       if (ctx->gc_gss_ctx)
-               gss_delete_sec_context(&ctx->gc_gss_ctx);
-
        kfree(ctx->gc_wire_ctx.data);
        kfree(ctx);
 }
@@ -753,7 +750,13 @@ gss_free_ctx_callback(struct rcu_head *head)
 static void
 gss_free_ctx(struct gss_cl_ctx *ctx)
 {
+       struct gss_ctx *gc_gss_ctx;
+
+       gc_gss_ctx = rcu_dereference(ctx->gc_gss_ctx);
+       rcu_assign_pointer(ctx->gc_gss_ctx, NULL);
        call_rcu(&ctx->gc_rcu, gss_free_ctx_callback);
+       if (gc_gss_ctx)
+               gss_delete_sec_context(&gc_gss_ctx);
 }
 
 static void
index dc2f41e9f577dbb657bc9a6fbd8277a8e352f029..7da7050f06c39cfcc79f1383256ebbc66ba7e07b 100644 (file)
@@ -42,7 +42,6 @@
 #include <linux/pagemap.h>
 
 #include <linux/sunrpc/auth_gss.h>
-#include <linux/sunrpc/svcauth.h>
 #include <linux/sunrpc/gss_err.h>
 #include <linux/sunrpc/svcauth.h>
 #include <linux/sunrpc/svcauth_gss.h>
index 01c3c41052048253b309946d62b9d7c65afea0e3..ebe344f34d1ae741c9696db10785d971f49450a4 100644 (file)
@@ -371,8 +371,7 @@ int cache_unregister(struct cache_detail *cd)
        }
        if (list_empty(&cache_list)) {
                /* module must be being unloaded so its safe to kill the worker */
-               cancel_delayed_work(&cache_cleaner);
-               flush_scheduled_work();
+               cancel_delayed_work_sync(&cache_cleaner);
        }
        return 0;
 }
index 650af064ff8da622a612e811c48d24584b212f24..669e12a4ed18a140a0ff94de8647aec344c39c66 100644 (file)
@@ -132,8 +132,7 @@ rpc_close_pipes(struct inode *inode)
                rpci->nwriters = 0;
                if (ops->release_pipe)
                        ops->release_pipe(inode);
-               cancel_delayed_work(&rpci->queue_timeout);
-               flush_workqueue(rpciod_workqueue);
+               cancel_delayed_work_sync(&rpci->queue_timeout);
        }
        rpc_inode_setowner(inode, NULL);
        mutex_unlock(&inode->i_mutex);
index b5723c262a3efd4703ea95f7936994845626f956..954d7ec86c7e201be80f0e19c41f3597125059e8 100644 (file)
@@ -50,8 +50,6 @@ static RPC_WAITQ(delay_queue, "delayq");
 /*
  * rpciod-related stuff
  */
-static DEFINE_MUTEX(rpciod_mutex);
-static atomic_t rpciod_users = ATOMIC_INIT(0);
 struct workqueue_struct *rpciod_workqueue;
 
 /*
@@ -961,60 +959,49 @@ void rpc_killall_tasks(struct rpc_clnt *clnt)
        spin_unlock(&clnt->cl_lock);
 }
 
+int rpciod_up(void)
+{
+       return try_module_get(THIS_MODULE) ? 0 : -EINVAL;
+}
+
+void rpciod_down(void)
+{
+       module_put(THIS_MODULE);
+}
+
 /*
- * Start up the rpciod process if it's not already running.
+ * Start up the rpciod workqueue.
  */
-int
-rpciod_up(void)
+static int rpciod_start(void)
 {
        struct workqueue_struct *wq;
-       int error = 0;
-
-       if (atomic_inc_not_zero(&rpciod_users))
-               return 0;
-
-       mutex_lock(&rpciod_mutex);
 
-       /* Guard against races with rpciod_down() */
-       if (rpciod_workqueue != NULL)
-               goto out_ok;
        /*
         * Create the rpciod thread and wait for it to start.
         */
        dprintk("RPC:       creating workqueue rpciod\n");
-       error = -ENOMEM;
        wq = create_workqueue("rpciod");
-       if (wq == NULL)
-               goto out;
-
        rpciod_workqueue = wq;
-       error = 0;
-out_ok:
-       atomic_inc(&rpciod_users);
-out:
-       mutex_unlock(&rpciod_mutex);
-       return error;
+       return rpciod_workqueue != NULL;
 }
 
-void
-rpciod_down(void)
+static void rpciod_stop(void)
 {
-       if (!atomic_dec_and_test(&rpciod_users))
-               return;
+       struct workqueue_struct *wq = NULL;
 
-       mutex_lock(&rpciod_mutex);
+       if (rpciod_workqueue == NULL)
+               return;
        dprintk("RPC:       destroying workqueue rpciod\n");
 
-       if (atomic_read(&rpciod_users) == 0 && rpciod_workqueue != NULL) {
-               destroy_workqueue(rpciod_workqueue);
-               rpciod_workqueue = NULL;
-       }
-       mutex_unlock(&rpciod_mutex);
+       wq = rpciod_workqueue;
+       rpciod_workqueue = NULL;
+       destroy_workqueue(wq);
 }
 
 void
 rpc_destroy_mempool(void)
 {
+       rpciod_stop();
        if (rpc_buffer_mempool)
                mempool_destroy(rpc_buffer_mempool);
        if (rpc_task_mempool)
@@ -1048,6 +1035,8 @@ rpc_init_mempool(void)
                                                      rpc_buffer_slabp);
        if (!rpc_buffer_mempool)
                goto err_nomem;
+       if (!rpciod_start())
+               goto err_nomem;
        return 0;
 err_nomem:
        rpc_destroy_mempool();
index 64b9b8c743c49b67eedc041ba7a90bcf06abb85b..12ff5da8160e5af375392da32dd13e616edd8667 100644 (file)
@@ -131,13 +131,13 @@ static char *__svc_print_addr(struct sockaddr *addr, char *buf, size_t len)
        case AF_INET:
                snprintf(buf, len, "%u.%u.%u.%u, port=%u",
                        NIPQUAD(((struct sockaddr_in *) addr)->sin_addr),
-                       htons(((struct sockaddr_in *) addr)->sin_port));
+                       ntohs(((struct sockaddr_in *) addr)->sin_port));
                break;
 
        case AF_INET6:
                snprintf(buf, len, "%x:%x:%x:%x:%x:%x:%x:%x, port=%u",
                        NIP6(((struct sockaddr_in6 *) addr)->sin6_addr),
-                       htons(((struct sockaddr_in6 *) addr)->sin6_port));
+                       ntohs(((struct sockaddr_in6 *) addr)->sin6_port));
                break;
 
        default:
index 5adfdfd49d61b65dc0164cd1fcecaff88d4fa558..1b17fecee74784cd2a2f701a374eb0769607fb29 100644 (file)
@@ -423,6 +423,17 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
                return NULL;
        }
 
+       if (LINK_LOG_BUF_SIZE) {
+               char *pb = kmalloc(LINK_LOG_BUF_SIZE, GFP_ATOMIC);
+
+               if (!pb) {
+                       kfree(l_ptr);
+                       warn("Link creation failed, no memory for print buffer\n");
+                       return NULL;
+               }
+               tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
+       }
+
        l_ptr->addr = peer;
        if_name = strchr(b_ptr->publ.name, ':') + 1;
        sprintf(l_ptr->name, "%u.%u.%u:%s-%u.%u.%u:",
@@ -432,8 +443,6 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
                tipc_zone(peer), tipc_cluster(peer), tipc_node(peer));
                /* note: peer i/f is appended to link name by reset/activate */
        memcpy(&l_ptr->media_addr, media_addr, sizeof(*media_addr));
-       k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
-       list_add_tail(&l_ptr->link_list, &b_ptr->links);
        l_ptr->checkpoint = 1;
        l_ptr->b_ptr = b_ptr;
        link_set_supervision_props(l_ptr, b_ptr->media->tolerance);
@@ -459,21 +468,14 @@ struct link *tipc_link_create(struct bearer *b_ptr, const u32 peer,
 
        l_ptr->owner = tipc_node_attach_link(l_ptr);
        if (!l_ptr->owner) {
+               if (LINK_LOG_BUF_SIZE)
+                       kfree(l_ptr->print_buf.buf);
                kfree(l_ptr);
                return NULL;
        }
 
-       if (LINK_LOG_BUF_SIZE) {
-               char *pb = kmalloc(LINK_LOG_BUF_SIZE, GFP_ATOMIC);
-
-               if (!pb) {
-                       kfree(l_ptr);
-                       warn("Link creation failed, no memory for print buffer\n");
-                       return NULL;
-               }
-               tipc_printbuf_init(&l_ptr->print_buf, pb, LINK_LOG_BUF_SIZE);
-       }
-
+       k_init_timer(&l_ptr->timer, (Handler)link_timeout, (unsigned long)l_ptr);
+       list_add_tail(&l_ptr->link_list, &b_ptr->links);
        tipc_k_signal((Handler)tipc_link_start, (unsigned long)l_ptr);
 
        dbg("tipc_link_create(): tolerance = %u,cont intv = %u, abort_limit = %u\n",
@@ -2381,10 +2383,10 @@ void tipc_link_changeover(struct link *l_ptr)
                struct tipc_msg *msg = buf_msg(crs);
 
                if ((msg_user(msg) == MSG_BUNDLER) && split_bundles) {
-                       u32 msgcount = msg_msgcnt(msg);
                        struct tipc_msg *m = msg_get_wrapped(msg);
                        unchar* pos = (unchar*)m;
 
+                       msgcount = msg_msgcnt(msg);
                        while (msgcount--) {
                                msg_set_seqno(m,msg_seqno(msg));
                                tipc_link_tunnel(l_ptr, &tunnel_hdr, m,
index 35d5ba1d4f42b54bb10bcacd64d5fb20f9bc5226..ce2659836374c8341d597bfc43d8dcbacf2b3dcf 100644 (file)
@@ -72,10 +72,8 @@ static inline void msg_set_bits(struct tipc_msg *m, u32 w,
                                u32 pos, u32 mask, u32 val)
 {
        val = (val & mask) << pos;
-       val = htonl(val);
-       mask = htonl(mask << pos);
-       m->hdr[w] &= ~mask;
-       m->hdr[w] |= val;
+       m->hdr[w] &= ~htonl(mask << pos);
+       m->hdr[w] |= htonl(val);
 }
 
 /*
index d8473eefcd2390fca7008b9ac021fa2735f783f6..ac7dfdda79737f652e540dfd0297611a986aba12 100644 (file)
@@ -501,7 +501,7 @@ end_node:
  * sequence overlapping with the requested sequence
  */
 
-void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
+static void tipc_nameseq_subscribe(struct name_seq *nseq, struct subscription *s)
 {
        struct sub_seq *sseq = nseq->sseqs;
 
index e2e452a62ba181238399c7fc3ddc730cd07e8100..598f4d3a0098e4f9b1ba5ae5f166f5166db1e069 100644 (file)
@@ -241,8 +241,6 @@ struct node *tipc_node_attach_link(struct link *l_ptr)
                char addr_string[16];
 
                if (n_ptr->link_cnt >= 2) {
-                       char addr_string[16];
-
                        err("Attempt to create third link to %s\n",
                            addr_string_fill(addr_string, n_ptr->addr));
                        return NULL;
index 5d2b9ce84d0a1016ecc7fe076b31da8b232a6849..76088153524cf2da2d22f20a4ccdef77643a15be 100644 (file)
@@ -41,7 +41,6 @@
 #include "addr.h"
 #include "link.h"
 #include "node.h"
-#include "port.h"
 #include "name_table.h"
 #include "user_reg.h"
 #include "msg.h"
index 65ebccc0a698f31fff7de9c3fa7eebd3689e5969..a05c34260e7005a346e3a507dc97149c82d2b740 100644 (file)
 
 int sysctl_unix_max_dgram_qlen __read_mostly = 10;
 
-struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
-DEFINE_SPINLOCK(unix_table_lock);
+static struct hlist_head unix_socket_table[UNIX_HASH_SIZE + 1];
+static DEFINE_SPINLOCK(unix_table_lock);
 static atomic_t unix_nr_socks = ATOMIC_INIT(0);
 
 #define unix_sockets_unbound   (&unix_socket_table[UNIX_HASH_SIZE])
 
 #define UNIX_ABSTRACT(sk)      (unix_sk(sk)->addr->hash != UNIX_HASH_SIZE)
 
+static struct sock *first_unix_socket(int *i)
+{
+       for (*i = 0; *i <= UNIX_HASH_SIZE; (*i)++) {
+               if (!hlist_empty(&unix_socket_table[*i]))
+                       return __sk_head(&unix_socket_table[*i]);
+       }
+       return NULL;
+}
+
+static struct sock *next_unix_socket(int *i, struct sock *s)
+{
+       struct sock *next = sk_next(s);
+       /* More in this chain? */
+       if (next)
+               return next;
+       /* Look for next non-empty chain. */
+       for ((*i)++; *i <= UNIX_HASH_SIZE; (*i)++) {
+               if (!hlist_empty(&unix_socket_table[*i]))
+                       return __sk_head(&unix_socket_table[*i]);
+       }
+       return NULL;
+}
+
+#define forall_unix_sockets(i, s) \
+       for (s = first_unix_socket(&(i)); s; s = next_unix_socket(&(i),(s)))
+
 #ifdef CONFIG_SECURITY_NETWORK
 static void unix_get_secdata(struct scm_cookie *scm, struct sk_buff *skb)
 {
index 849cc06bd9141a62da44061a230e7bc70c472761..9ab31a3ce3ade9c4a40a3dc0f3d34ce3bfe2b192 100644 (file)
@@ -46,7 +46,6 @@
 #include <linux/capability.h>
 #include <linux/errno.h>       /* return codes */
 #include <linux/kernel.h>
-#include <linux/init.h>
 #include <linux/module.h>      /* support for loadable modules */
 #include <linux/slab.h>                /* kmalloc(), kfree() */
 #include <linux/mm.h>
index c3a4b0a18687e83f0502697ddf59ba66a3d04593..7012891d39f2c6757b1c50784299043d353cc07a 100644 (file)
 #include <linux/netfilter.h>
 #include <linux/module.h>
 #include <linux/cache.h>
+#include <linux/audit.h>
 #include <net/xfrm.h>
 #include <net/ip.h>
-#include <linux/audit.h>
-#include <linux/cache.h>
 
 #include "xfrm_hash.h"
 
@@ -1299,7 +1298,8 @@ xfrm_tmpl_resolve_one(struct xfrm_policy *policy, struct flowi *fl,
                xfrm_address_t *local  = saddr;
                struct xfrm_tmpl *tmpl = &policy->xfrm_vec[i];
 
-               if (tmpl->mode == XFRM_MODE_TUNNEL) {
+               if (tmpl->mode == XFRM_MODE_TUNNEL ||
+                   tmpl->mode == XFRM_MODE_BEET) {
                        remote = &tmpl->id.daddr;
                        local = &tmpl->saddr;
                        family = tmpl->encap_family;
@@ -2194,9 +2194,10 @@ void xfrm_audit_log(uid_t auid, u32 sid, int type, int result,
        }
 
        if (sid != 0 &&
-               security_secid_to_secctx(sid, &secctx, &secctx_len) == 0)
+           security_secid_to_secctx(sid, &secctx, &secctx_len) == 0) {
                audit_log_format(audit_buf, " subj=%s", secctx);
-       else
+               security_release_secctx(secctx, secctx_len);
+       } else
                audit_log_task_context(audit_buf);
 
        if (xp) {
index 38f90ca75b1e5efa1751e86d52234cde4dc307d7..d4356e6f7f9bc65fd67eeba6663b1cc9f321fa55 100644 (file)
@@ -19,9 +19,8 @@
 #include <linux/ipsec.h>
 #include <linux/module.h>
 #include <linux/cache.h>
-#include <asm/uaccess.h>
 #include <linux/audit.h>
-#include <linux/cache.h>
+#include <asm/uaccess.h>
 
 #include "xfrm_hash.h"
 
@@ -611,7 +610,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
                              selector.
                         */
                        if (x->km.state == XFRM_STATE_VALID) {
-                               if (!xfrm_selector_match(&x->sel, fl, family) ||
+                               if (!xfrm_selector_match(&x->sel, fl, x->sel.family) ||
                                    !security_xfrm_state_pol_flow_match(x, pol, fl))
                                        continue;
                                if (!best ||
@@ -623,7 +622,7 @@ xfrm_state_find(xfrm_address_t *daddr, xfrm_address_t *saddr,
                                acquire_in_progress = 1;
                        } else if (x->km.state == XFRM_STATE_ERROR ||
                                   x->km.state == XFRM_STATE_EXPIRED) {
-                               if (xfrm_selector_match(&x->sel, fl, family) &&
+                               if (xfrm_selector_match(&x->sel, fl, x->sel.family) &&
                                    security_xfrm_state_pol_flow_match(x, pol, fl))
                                        error = -ESRCH;
                        }
index c06883bf620ee21fa896654847fc4ee85f445e33..61339e17a0f5dd52bb3ba69f24b47366833d5dc4 100644 (file)
@@ -322,6 +322,13 @@ static void copy_from_user_state(struct xfrm_state *x, struct xfrm_usersa_info *
        x->props.family = p->family;
        memcpy(&x->props.saddr, &p->saddr, sizeof(x->props.saddr));
        x->props.flags = p->flags;
+
+       /*
+        * Set inner address family if the KM left it as zero.
+        * See comment in validate_tmpl.
+        */
+       if (!x->sel.family)
+               x->sel.family = p->family;
 }
 
 /*
index 73751ab6ec0c0fc20adf50dd52ee19fd805a43c7..dae7d30dca0f1886b450311ee0e3c959fc3d40da 100755 (executable)
@@ -9,7 +9,7 @@ use strict;
 my $P = $0;
 $P =~ s@.*/@@g;
 
-my $V = '0.08';
+my $V = '0.09';
 
 use Getopt::Long qw(:config no_auto_abbrev);
 
@@ -311,7 +311,7 @@ sub process {
 
        my $Ident       = qr{[A-Za-z\d_]+};
        my $Storage     = qr{extern|static};
-       my $Sparse      = qr{__user|__kernel|__force|__iomem};
+       my $Sparse      = qr{__user|__kernel|__force|__iomem|__must_check|__init_refok};
        my $NonptrType  = qr{
                                \b
                                (?:const\s+)?
@@ -325,6 +325,7 @@ sub process {
                                        unsigned|
                                        float|
                                        double|
+                                       bool|
                                        long\s+int|
                                        long\s+long|
                                        long\s+long\s+int|
@@ -340,7 +341,8 @@ sub process {
                          }x;
        my $Type        = qr{
                                \b$NonptrType\b
-                               (?:\s*\*+\s*const|\s*\*+)?
+                               (?:\s*\*+\s*const|\s*\*+|(?:\s*\[\s*\])+)?
+                               (?:\s+$Sparse)*
                          }x;
        my $Declare     = qr{(?:$Storage\s+)?$Type};
        my $Attribute   = qr{const|__read_mostly|__init|__initdata|__meminit};
@@ -494,16 +496,15 @@ sub process {
                        ERROR("use tabs not spaces\n" . $herevet);
                }
 
-               #
-               # The rest of our checks refer specifically to C style
-               # only apply those _outside_ comments.
-               #
-               next if ($in_comment);
-
 # Remove comments from the line before processing.
-               $line =~ s@/\*.*\*/@@g;
-               $line =~ s@/\*.*@@;
-               $line =~ s@.*\*/@@;
+               my $comment_edge = ($line =~ s@/\*.*\*/@@g) +
+                                  ($line =~ s@/\*.*@@) +
+                                  ($line =~ s@^(.).*\*/@$1@);
+
+# The rest of our checks refer specifically to C style
+# only apply those _outside_ comments.  Only skip
+# lines in the middle of comments.
+               next if (!$comment_edge && $in_comment);
 
 # Standardise the strings and chars within the input to simplify matching.
                $line = sanitise_line($line);
@@ -599,7 +600,7 @@ sub process {
                        if (($prevline !~ /^}/) &&
                           ($prevline !~ /^\+}/) &&
                           ($prevline !~ /^ }/) &&
-                          ($prevline !~ /\s$name(?:\s+$Attribute)?\s*(?:;|=)/)) {
+                          ($prevline !~ /\b\Q$name\E(?:\s+$Attribute)?\s*(?:;|=)/)) {
                                WARN("EXPORT_SYMBOL(foo); should immediately follow its function/variable\n" . $herecurr);
                        }
                }
@@ -680,9 +681,9 @@ sub process {
 
 # check for spaces between functions and their parentheses.
                if ($line =~ /($Ident)\s+\(/ &&
-                   $1 !~ /^(?:if|for|while|switch|return|volatile)$/ &&
+                   $1 !~ /^(?:if|for|while|switch|return|volatile|__volatile__|__attribute__|format|__extension__|Copyright)$/ &&
                    $line !~ /$Type\s+\(/ && $line !~ /^.\#\s*define\b/) {
-                       ERROR("no space between function name and open parenthesis '('\n" . $herecurr);
+                       WARN("no space between function name and open parenthesis '('\n" . $herecurr);
                }
 # Check operator spacing.
                # Note we expand the line with the leading + as the real
@@ -712,6 +713,7 @@ sub process {
                                        $c = 'W' if ($elements[$n + 2] =~ /^\s/);
                                        $c = 'B' if ($elements[$n + 2] =~ /^(\)|\]|;)/);
                                        $c = 'O' if ($elements[$n + 2] eq '');
+                                       $c = 'E' if ($elements[$n + 2] =~ /\s*\\$/);
                                } else {
                                        $c = 'E';
                                }
@@ -812,7 +814,11 @@ sub process {
 
                                # All the others need spaces both sides.
                                } elsif ($ctx !~ /[EW]x[WE]/) {
-                                       ERROR("need spaces around that '$op' $at\n" . $hereptr);
+                                       # Ignore email addresses <foo@bar>
+                                       if (!($op eq '<' && $cb =~ /$;\S+\@\S+>/) &&
+                                           !($op eq '>' && $cb =~ /<\S+\@\S+$;/)) {
+                                               ERROR("need spaces around that '$op' $at\n" . $hereptr);
+                                       }
                                }
                                $off += length($elements[$n + 1]);
                        }
@@ -823,15 +829,24 @@ sub process {
                        WARN("multiple assignments should be avoided\n" . $herecurr);
                }
 
-# check for multiple declarations, allowing for a function declaration
-# continuation.
-               if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
-                   $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
-                       WARN("declaring multiple variables together should be avoided\n" . $herecurr);
-               }
+## # check for multiple declarations, allowing for a function declaration
+## # continuation.
+##             if ($line =~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Ident.*/ &&
+##                 $line !~ /^.\s*$Type\s+$Ident(?:\s*=[^,{]*)?\s*,\s*$Type\s*$Ident.*/) {
+##
+##                     # Remove any bracketed sections to ensure we do not
+##                     # falsly report the parameters of functions.
+##                     my $ln = $line;
+##                     while ($ln =~ s/\([^\(\)]*\)//g) {
+##                     }
+##                     if ($ln =~ /,/) {
+##                             WARN("declaring multiple variables together should be avoided\n" . $herecurr);
+##                     }
+##             }
 
 #need space before brace following if, while, etc
-               if ($line =~ /\(.*\){/ || $line =~ /do{/) {
+               if (($line =~ /\(.*\){/ && $line !~ /\($Type\){/) ||
+                   $line =~ /do{/) {
                        ERROR("need a space before the open brace '{'\n" . $herecurr);
                }
 
@@ -841,6 +856,22 @@ sub process {
                        ERROR("need a space after that close brace '}'\n" . $herecurr);
                }
 
+# check spacing on square brackets
+               if ($line =~ /\[\s/ && $line !~ /\[\s*$/) {
+                       ERROR("no space after that open square bracket '['\n" . $herecurr);
+               }
+               if ($line =~ /\s\]/) {
+                       ERROR("no space before that close square bracket ']'\n" . $herecurr);
+               }
+
+# check spacing on paretheses
+               if ($line =~ /\(\s/ && $line !~ /\(\s*$/) {
+                       ERROR("no space after that open parenthesis '('\n" . $herecurr);
+               }
+               if ($line =~ /\s\)/) {
+                       ERROR("no space before that close parenthesis ')'\n" . $herecurr);
+               }
+
 #goto labels aren't indented, allow a single space however
                if ($line=~/^.\s+[A-Za-z\d_]+:(?![0-9]+)/ and
                   !($line=~/^. [A-Za-z\d_]+:/) and !($line=~/^.\s+default:/)) {
@@ -910,7 +941,7 @@ sub process {
                        # grabbing the statement after the identifier
                        $prevline =~ m{^(.#\s*define\s*$Ident(?:\([^\)]*\))?\s*)(.*)\\\s*$};
                        ##print "1<$1> 2<$2>\n";
-                       if ($2 ne '') {
+                       if (defined $2 && $2 ne '') {
                                $off = length($1);
                                $ln--;
                                $cnt++;
@@ -950,8 +981,10 @@ sub process {
                                my ($lvl, @block) = ctx_block_level($nr, $cnt);
 
                                my $stmt = join(' ', @block);
-                               $stmt =~ s/^[^{]*{//;
-                               $stmt =~ s/}[^}]*$//;
+                               $stmt =~ s/(^[^{]*){//;
+                               my $before = $1;
+                               $stmt =~ s/}([^}]*$)//;
+                               my $after = $1;
 
                                #print "block<" . join(' ', @block) . "><" . scalar(@block) . ">\n";
                                #print "stmt<$stmt>\n\n";
@@ -963,12 +996,14 @@ sub process {
                                # Also nested if's often require braces to
                                # disambiguate the else binding so shhh there.
                                my @semi = ($stmt =~ /;/g);
+                               push(@semi, "/**/") if ($stmt =~ m@/\*@);
                                ##print "semi<" . scalar(@semi) . ">\n";
                                if ($lvl == 0 && scalar(@semi) < 2 &&
-                                   $stmt !~ /{/ && $stmt !~ /\bif\b/) {
+                                   $stmt !~ /{/ && $stmt !~ /\bif\b/ &&
+                                   $before !~ /}/ && $after !~ /{/) {
                                        my $herectx = "$here\n" . join("\n", @control, @block[1 .. $#block]) . "\n";
                                        shift(@block);
-                                       ERROR("braces {} are not necessary for single statement blocks\n" . $herectx);
+                                       WARN("braces {} are not necessary for single statement blocks\n" . $herectx);
                                }
                        }
                }
@@ -1013,6 +1048,11 @@ sub process {
 #                      $clean = 0;
 #              }
 
+# warn about spacing in #ifdefs
+               if ($line =~ /^.#\s*(ifdef|ifndef|elif)\s\s+/) {
+                       ERROR("exactly one space required after that #$1\n" . $herecurr);
+               }
+
 # check for spinlock_t definitions without a comment.
                if ($line =~ /^.\s*(struct\s+mutex|spinlock_t)\s+\S+;/) {
                        my $which = $1;
@@ -1027,14 +1067,14 @@ sub process {
                        }
                }
 # check of hardware specific defines
-               if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@) {
+               if ($line =~ m@^.#\s*if.*\b(__i386__|__powerpc64__|__sun__|__s390x__)\b@ && $realfile !~ m@include/asm-@) {
                        CHK("architecture specific defines should be avoided\n" .  $herecurr);
                }
 
 # check the location of the inline attribute, that it is between
 # storage class and type.
-               if ($line =~ /$Type\s+(?:inline|__always_inline)\b/ ||
-                   $line =~ /\b(?:inline|always_inline)\s+$Storage/) {
+               if ($line =~ /$Type\s+(?:inline|__always_inline|noinline)\b/ ||
+                   $line =~ /\b(?:inline|__always_inline|noinline)\s+$Storage/) {
                        ERROR("inline keyword should sit between storage class and type\n" . $herecurr);
                }
 
index ee58ded021d77d815eaa350207befda54186c008..6c145d6e89dec73d2b595a9895825a70c9bd6efe 100644 (file)
@@ -1121,6 +1121,7 @@ static int initexit_section_ref_ok(const char *name)
                ".machvec",             /* ia64 + powerpc uses these */
                ".machine.desc",
                ".opd",                 /* See comment [OPD] */
+               "__dbe_table",
                ".parainstructions",
                ".pdr",
                ".plt",                 /* seen on ARCH=um build on x86_64. Harmless */
index 0fac6829c63a7815016f0489c83db5419b990c0a..6237933f7d82c3454c4409a00a1aa779ef5ceee3 100644 (file)
@@ -4658,8 +4658,7 @@ static int selinux_secid_to_secctx(u32 secid, char **secdata, u32 *seclen)
 
 static void selinux_release_secctx(char *secdata, u32 seclen)
 {
-       if (secdata)
-               kfree(secdata);
+       kfree(secdata);
 }
 
 #ifdef CONFIG_KEYS
index 051b14c88e2dbde9b4acef924594b42a3a3e4087..d243ddc723a55c06c507dbc2cdcca14c425d54f9 100644 (file)
@@ -162,9 +162,13 @@ int selinux_netlbl_skbuff_getsid(struct sk_buff *skb, u32 base_sid, u32 *sid)
 
        netlbl_secattr_init(&secattr);
        rc = netlbl_skbuff_getattr(skb, &secattr);
-       if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE)
+       if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) {
                rc = security_netlbl_secattr_to_sid(&secattr, base_sid, sid);
-       else
+               if (rc == 0 &&
+                   (secattr.flags & NETLBL_SECATTR_CACHEABLE) &&
+                   (secattr.flags & NETLBL_SECATTR_CACHE))
+                       netlbl_cache_add(skb, &secattr);
+       } else
                *sid = SECSID_NULL;
        netlbl_secattr_destroy(&secattr);
 
@@ -307,11 +311,15 @@ int selinux_netlbl_sock_rcv_skb(struct sk_security_struct *sksec,
 
        netlbl_secattr_init(&secattr);
        rc = netlbl_skbuff_getattr(skb, &secattr);
-       if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE)
+       if (rc == 0 && secattr.flags != NETLBL_SECATTR_NONE) {
                rc = security_netlbl_secattr_to_sid(&secattr,
                                                    SECINITSID_NETMSG,
                                                    &nlbl_sid);
-       else
+               if (rc == 0 &&
+                   (secattr.flags & NETLBL_SECATTR_CACHEABLE) &&
+                   (secattr.flags & NETLBL_SECATTR_CACHE))
+                       netlbl_cache_add(skb, &secattr);
+       } else
                nlbl_sid = SECINITSID_UNLABELED;
        netlbl_secattr_destroy(&secattr);
        if (rc != 0)
index 0ae032f3876b0717628f84c4df98c2e53c6e400a..f00161ef99ed17450ae395913730ca4154469e2d 100644 (file)
@@ -792,7 +792,7 @@ int security_context_to_sid(char *scontext, u32 scontext_len, u32 *sid)
  * @scontext: security context
  * @scontext_len: length in bytes
  * @sid: security identifier, SID
- * @def_sid: default SID to assign on errror
+ * @def_sid: default SID to assign on error
  *
  * Obtains a SID associated with the security context that
  * has the string representation specified by @scontext.
index 866d4de8d4ab9b9486d4d2cd1ae3e164cf9af201..af37cd09bdddc58f1d09424df5338fd5b68784f1 100644 (file)
@@ -31,14 +31,6 @@ config SOUND_HAL2
          Say Y or M if you have an SGI Indy or Indigo2 system and want to be able to
          use its on-board A2 audio system.
 
-config SOUND_VRC5477
-       tristate "NEC Vrc5477 AC97 sound"
-       depends on SOUND_PRIME && DDB5477
-       help
-         Say Y here to enable sound support for the NEC Vrc5477 chip, an
-         integrated, multi-function controller chip for MIPS CPUs.  Works
-         with the AC97 codec.
-
 config SOUND_AU1550_AC97
        tristate "Au1550/Au1200 AC97 Sound"
        select SND_AC97_CODEC
index 7a2f9ae7b7c5818d13331eaadb2db6dd9e35ca89..1200670017bddf5a5a8ba74f3f95c995f6ec73ab 100644 (file)
@@ -37,7 +37,6 @@ obj-$(CONFIG_SOUND_MSNDPIN)   += msnd.o msnd_pinnacle.o
 obj-$(CONFIG_SOUND_VWSND)      += vwsnd.o
 obj-$(CONFIG_SOUND_ICH)                += i810_audio.o ac97_codec.o
 obj-$(CONFIG_SOUND_ES1371)     += es1371.o ac97_codec.o
-obj-$(CONFIG_SOUND_VRC5477)    += nec_vrc5477.o ac97_codec.o
 obj-$(CONFIG_SOUND_AU1550_AC97)        += au1550_ac97.o ac97_codec.o
 obj-$(CONFIG_SOUND_TRIDENT)    += trident.o ac97_codec.o
 obj-$(CONFIG_SOUND_BCM_CS4297A)        += swarm_cs4297a.o
diff --git a/sound/oss/nec_vrc5477.c b/sound/oss/nec_vrc5477.c
deleted file mode 100644 (file)
index 27b4ba3..0000000
+++ /dev/null
@@ -1,2060 +0,0 @@
-/***********************************************************************
- * Copyright 2001 MontaVista Software Inc.
- * Author: Jun Sun, jsun@mvista.com or jsun@junsun.net
- *
- * drivers/sound/nec_vrc5477.c
- *     AC97 sound dirver for NEC Vrc5477 chip (an integrated, 
- *     multi-function controller chip for MIPS CPUs)
- *
- * VRA support Copyright 2001 Bradley D. LaRonde <brad@ltc.com>
- *
- * This program is free software; you can redistribute  it and/or modify it
- * under  the terms of  the GNU General  Public License as published by the
- * Free Software Foundation;  either version 2 of the  License, or (at your
- * option) any later version.
- ***********************************************************************
- */
-
-/*
- * This code is derived from ite8172.c, which is written by Steve Longerbeam.
- *
- * Features:
- *   Currently we only support the following capabilities:
- *     . mono output to PCM L/R (line out).
- *     . stereo output to PCM L/R (line out).
- *     . mono input from PCM L (line in).
- *     . stereo output from PCM (line in).
- *     . sampling rate at 48k or variable sampling rate 
- *     . support /dev/dsp, /dev/mixer devices, standard OSS devices.
- *     . only support 16-bit PCM format (hardware limit, no software
- *       translation) 
- *     . support duplex, but no trigger or realtime.
- *     
- *   Specifically the following are not supported:
- *     . app-set frag size.
- *     . mmap'ed buffer access
- */
-
-/* 
- * Original comments from ite8172.c file.
- */
-
-/*
- *
- * Notes:
- *
- *  1. Much of the OSS buffer allocation, ioctl's, and mmap'ing are
- *     taken, slightly modified or not at all, from the ES1371 driver,
- *     so refer to the credits in es1371.c for those. The rest of the
- *     code (probe, open, read, write, the ISR, etc.) is new.
- *  2. The following support is untested:
- *      * Memory mapping the audio buffers, and the ioctl controls that go
- *        with it.
- *      * S/PDIF output.
- *  3. The following is not supported:
- *      * I2S input.
- *      * legacy audio mode.
- *  4. Support for volume button interrupts is implemented but doesn't
- *     work yet.
- *
- *  Revision history
- *    02.08.2001  0.1   Initial release
- */
-
-#include <linux/module.h>
-#include <linux/string.h>
-#include <linux/kernel.h>
-#include <linux/ioport.h>
-#include <linux/sched.h>
-#include <linux/delay.h>
-#include <linux/sound.h>
-#include <linux/slab.h>
-#include <linux/soundcard.h>
-#include <linux/pci.h>
-#include <linux/init.h>
-#include <linux/poll.h>
-#include <linux/bitops.h>
-#include <linux/proc_fs.h>
-#include <linux/spinlock.h>
-#include <linux/smp_lock.h>
-#include <linux/ac97_codec.h>
-#include <linux/mutex.h>
-
-#include <asm/io.h>
-#include <asm/dma.h>
-#include <asm/uaccess.h>
-
-/* -------------------debug macros -------------------------------------- */
-/* #undef VRC5477_AC97_DEBUG */
-#define VRC5477_AC97_DEBUG
-
-#undef VRC5477_AC97_VERBOSE_DEBUG
-/* #define VRC5477_AC97_VERBOSE_DEBUG */
-
-#if defined(VRC5477_AC97_VERBOSE_DEBUG)
-#define VRC5477_AC97_DEBUG
-#endif
-
-#if defined(VRC5477_AC97_DEBUG)
-#define ASSERT(x)  if (!(x)) { \
-       panic("assertion failed at %s:%d: %s\n", __FILE__, __LINE__, #x); }
-#else
-#define        ASSERT(x)
-#endif /* VRC5477_AC97_DEBUG */
-
-#if defined(VRC5477_AC97_VERBOSE_DEBUG)
-static u16 inTicket;           /* check sync between intr & write */
-static u16 outTicket;
-#endif
-
-/* --------------------------------------------------------------------- */
-
-#undef OSS_DOCUMENTED_MIXER_SEMANTICS
-
-static const unsigned sample_shift[] = { 0, 1, 1, 2 };
-
-#define         VRC5477_INT_CLR         0x0
-#define         VRC5477_INT_STATUS     0x0
-#define         VRC5477_CODEC_WR        0x4
-#define         VRC5477_CODEC_RD        0x8
-#define         VRC5477_CTRL            0x18
-#define         VRC5477_ACLINK_CTRL     0x1c
-#define         VRC5477_INT_MASK        0x24
-
-#define                VRC5477_DAC1_CTRL       0x30
-#define                VRC5477_DAC1L           0x34
-#define                VRC5477_DAC1_BADDR      0x38
-#define                VRC5477_DAC2_CTRL       0x3c
-#define                VRC5477_DAC2L           0x40
-#define                VRC5477_DAC2_BADDR      0x44
-#define                VRC5477_DAC3_CTRL       0x48
-#define                VRC5477_DAC3L           0x4c
-#define                VRC5477_DAC3_BADDR      0x50
-
-#define                VRC5477_ADC1_CTRL       0x54
-#define                VRC5477_ADC1L           0x58
-#define                VRC5477_ADC1_BADDR      0x5c
-#define                VRC5477_ADC2_CTRL       0x60
-#define                VRC5477_ADC2L           0x64
-#define                VRC5477_ADC2_BADDR      0x68
-#define                VRC5477_ADC3_CTRL       0x6c
-#define                VRC5477_ADC3L           0x70
-#define                VRC5477_ADC3_BADDR      0x74
-
-#define                VRC5477_CODEC_WR_RWC    (1 << 23)
-
-#define                VRC5477_CODEC_RD_RRDYA  (1 << 31)
-#define                VRC5477_CODEC_RD_RRDYD  (1 << 30)
-
-#define                VRC5477_ACLINK_CTRL_RST_ON      (1 << 15)
-#define                VRC5477_ACLINK_CTRL_RST_TIME    0x7f
-#define                VRC5477_ACLINK_CTRL_SYNC_ON     (1 << 30)
-#define                VRC5477_ACLINK_CTRL_CK_STOP_ON  (1 << 31)
-
-#define                VRC5477_CTRL_DAC2ENB            (1 << 15) 
-#define                VRC5477_CTRL_ADC2ENB            (1 << 14) 
-#define                VRC5477_CTRL_DAC1ENB            (1 << 13) 
-#define                VRC5477_CTRL_ADC1ENB            (1 << 12) 
-
-#define                VRC5477_INT_MASK_NMASK          (1 << 31) 
-#define                VRC5477_INT_MASK_DAC1END        (1 << 5) 
-#define                VRC5477_INT_MASK_DAC2END        (1 << 4) 
-#define                VRC5477_INT_MASK_DAC3END        (1 << 3) 
-#define                VRC5477_INT_MASK_ADC1END        (1 << 2) 
-#define                VRC5477_INT_MASK_ADC2END        (1 << 1) 
-#define                VRC5477_INT_MASK_ADC3END        (1 << 0) 
-
-#define                VRC5477_DMA_ACTIVATION          (1 << 31)
-#define                VRC5477_DMA_WIP                 (1 << 30)
-
-
-#define VRC5477_AC97_MODULE_NAME "NEC_Vrc5477_audio"
-#define PFX VRC5477_AC97_MODULE_NAME ": "
-
-/* --------------------------------------------------------------------- */
-
-struct vrc5477_ac97_state {
-       /* list of vrc5477_ac97 devices */
-       struct list_head devs;
-
-       /* the corresponding pci_dev structure */
-       struct pci_dev *dev;
-
-       /* soundcore stuff */
-       int dev_audio;
-
-       /* hardware resources */
-       unsigned long io;
-       unsigned int irq;
-
-#ifdef VRC5477_AC97_DEBUG
-       /* debug /proc entry */
-       struct proc_dir_entry *ps;
-       struct proc_dir_entry *ac97_ps;
-#endif /* VRC5477_AC97_DEBUG */
-
-       struct ac97_codec *codec;
-
-       unsigned dacChannels, adcChannels;
-       unsigned short dacRate, adcRate;
-       unsigned short extended_status;
-
-       spinlock_t lock;
-       struct mutex open_mutex;
-       mode_t open_mode;
-       wait_queue_head_t open_wait;
-
-       struct dmabuf {
-               void *lbuf, *rbuf;
-               dma_addr_t lbufDma, rbufDma;
-               unsigned bufOrder;
-               unsigned numFrag;
-               unsigned fragShift;
-               unsigned fragSize;      /* redundant */
-               unsigned fragTotalSize; /* = numFrag * fragSize(real)  */
-               unsigned nextIn;
-               unsigned nextOut;
-               int count;
-               unsigned error; /* over/underrun */
-               wait_queue_head_t wait;
-               /* OSS stuff */
-               unsigned stopped:1;
-               unsigned ready:1;
-       } dma_dac, dma_adc;
-
-       #define WORK_BUF_SIZE   2048
-       struct {
-               u16 lchannel;
-               u16 rchannel;
-       } workBuf[WORK_BUF_SIZE/4];
-};
-
-/* --------------------------------------------------------------------- */
-
-static LIST_HEAD(devs);
-
-/* --------------------------------------------------------------------- */
-
-static inline unsigned ld2(unsigned int x)
-{
-    unsigned r = 0;
-       
-    if (x >= 0x10000) {
-       x >>= 16;
-       r += 16;
-    }
-    if (x >= 0x100) {
-       x >>= 8;
-       r += 8;
-    }
-    if (x >= 0x10) {
-       x >>= 4;
-       r += 4;
-    }
-    if (x >= 4) {
-       x >>= 2;
-       r += 2;
-    }
-    if (x >= 2)
-       r++;
-    return r;
-}
-
-/* --------------------------------------------------------------------- */
-
-static u16 rdcodec(struct ac97_codec *codec, u8 addr)
-{
-       struct vrc5477_ac97_state *s = 
-               (struct vrc5477_ac97_state *)codec->private_data;
-       unsigned long flags;
-       u32 result;
-
-       spin_lock_irqsave(&s->lock, flags);
-
-       /* wait until we can access codec registers */
-       while (inl(s->io + VRC5477_CODEC_WR) & 0x80000000);
-
-       /* write the address and "read" command to codec */
-       addr = addr & 0x7f;
-       outl((addr << 16) | VRC5477_CODEC_WR_RWC, s->io + VRC5477_CODEC_WR);
-
-       /* get the return result */
-       udelay(100); /* workaround hardware bug */
-       while ( (result = inl(s->io + VRC5477_CODEC_RD)) & 
-                (VRC5477_CODEC_RD_RRDYA | VRC5477_CODEC_RD_RRDYD) ) {
-               /* we get either addr or data, or both */
-               if (result & VRC5477_CODEC_RD_RRDYA) {
-                       ASSERT(addr == ((result >> 16) & 0x7f) );
-               }
-               if (result & VRC5477_CODEC_RD_RRDYD) {
-                       break;
-               }
-       }
-
-       spin_unlock_irqrestore(&s->lock, flags);
-
-       return result & 0xffff;
-}
-
-
-static void wrcodec(struct ac97_codec *codec, u8 addr, u16 data)
-{
-       struct vrc5477_ac97_state *s = 
-               (struct vrc5477_ac97_state *)codec->private_data;
-       unsigned long flags;
-
-       spin_lock_irqsave(&s->lock, flags);
-
-       /* wait until we can access codec registers */
-       while (inl(s->io + VRC5477_CODEC_WR) & 0x80000000);
-
-       /* write the address and value to codec */
-       outl((addr << 16) | data, s->io + VRC5477_CODEC_WR);
-
-       spin_unlock_irqrestore(&s->lock, flags);
-}
-
-
-static void waitcodec(struct ac97_codec *codec)
-{
-       struct vrc5477_ac97_state *s = 
-               (struct vrc5477_ac97_state *)codec->private_data;
-
-       /* wait until we can access codec registers */
-       while (inl(s->io + VRC5477_CODEC_WR) & 0x80000000);
-}
-
-static int ac97_codec_not_present(struct ac97_codec *codec)
-{
-       struct vrc5477_ac97_state *s = 
-               (struct vrc5477_ac97_state *)codec->private_data;
-       unsigned long flags;
-       unsigned short count  = 0xffff; 
-
-       spin_lock_irqsave(&s->lock, flags);
-
-       /* wait until we can access codec registers */
-       do {
-              if (!(inl(s->io + VRC5477_CODEC_WR) & 0x80000000))
-                      break;
-       } while (--count);
-
-       if (count == 0) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return -1;
-       }
-
-       /* write 0 to reset */
-       outl((AC97_RESET << 16) | 0, s->io + VRC5477_CODEC_WR);
-
-       /* test whether we get a response from ac97 chip */
-       count  = 0xffff; 
-       do { 
-              if (!(inl(s->io + VRC5477_CODEC_WR) & 0x80000000))
-                      break;
-       } while (--count);
-
-       if (count == 0) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return -1;
-       }
-       spin_unlock_irqrestore(&s->lock, flags);
-       return 0;
-}
-
-/* --------------------------------------------------------------------- */
-
-static void vrc5477_ac97_delay(int msec)
-{
-       unsigned long tmo;
-       signed long tmo2;
-
-       if (in_interrupt())
-               return;
-    
-       tmo = jiffies + (msec*HZ)/1000;
-       for (;;) {
-               tmo2 = tmo - jiffies;
-               if (tmo2 <= 0)
-                       break;
-               schedule_timeout(tmo2);
-       }
-}
-
-
-static void set_adc_rate(struct vrc5477_ac97_state *s, unsigned rate)
-{
-       wrcodec(s->codec, AC97_PCM_LR_ADC_RATE, rate);
-       s->adcRate = rate;
-}
-
-
-static void set_dac_rate(struct vrc5477_ac97_state *s, unsigned rate)
-{
-       if(s->extended_status & AC97_EXTSTAT_VRA) {
-       wrcodec(s->codec, AC97_PCM_FRONT_DAC_RATE, rate);
-               s->dacRate = rdcodec(s->codec, AC97_PCM_FRONT_DAC_RATE);
-       }
-}
-
-static int ac97_codec_not_present(struct ac97_codec *codec)
-{
-       struct vrc5477_ac97_state *s =
-               (struct vrc5477_ac97_state *)codec->private_data;
-       unsigned long flags;
-       unsigned short count  = 0xffff;
-
-       spin_lock_irqsave(&s->lock, flags);
-
-       /* wait until we can access codec registers */
-       do {
-              if (!(inl(s->io + VRC5477_CODEC_WR) & 0x80000000))
-                      break;
-       } while (--count);
-
-       if (count == 0) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return -1;
-       }
-
-       /* write 0 to reset */
-       outl((AC97_RESET << 16) | 0, s->io + VRC5477_CODEC_WR);
-
-       /* test whether we get a response from ac97 chip */
-       count  = 0xffff;
-       do {
-              if (!(inl(s->io + VRC5477_CODEC_WR) & 0x80000000))
-                      break;
-       } while (--count);
-
-       if (count == 0) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return -1;
-       }
-       spin_unlock_irqrestore(&s->lock, flags);
-       return 0;
-}
-
-/* --------------------------------------------------------------------- */
-
-static inline void
-stop_dac(struct vrc5477_ac97_state *s)
-{
-       struct dmabuf* db = &s->dma_dac;
-       unsigned long flags;
-       u32 temp;
-    
-       spin_lock_irqsave(&s->lock, flags);
-
-       if (db->stopped) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return;
-       }
-
-       /* deactivate the dma */
-       outl(0, s->io + VRC5477_DAC1_CTRL);
-       outl(0, s->io + VRC5477_DAC2_CTRL);
-
-       /* wait for DAM completely stop */
-       while (inl(s->io + VRC5477_DAC1_CTRL) & VRC5477_DMA_WIP);
-       while (inl(s->io + VRC5477_DAC2_CTRL) & VRC5477_DMA_WIP);
-
-       /* disable dac slots in aclink */
-       temp = inl(s->io + VRC5477_CTRL);
-       temp &= ~ (VRC5477_CTRL_DAC1ENB | VRC5477_CTRL_DAC2ENB);
-       outl (temp, s->io + VRC5477_CTRL);
-
-       /* disable interrupts */
-       temp = inl(s->io + VRC5477_INT_MASK);
-       temp &= ~ (VRC5477_INT_MASK_DAC1END | VRC5477_INT_MASK_DAC2END); 
-       outl (temp, s->io + VRC5477_INT_MASK);
-
-       /* clear pending ones */
-       outl(VRC5477_INT_MASK_DAC1END | VRC5477_INT_MASK_DAC2END, 
-            s->io +  VRC5477_INT_CLR);
-    
-       db->stopped = 1;
-    
-       spin_unlock_irqrestore(&s->lock, flags);
-}      
-
-static void start_dac(struct vrc5477_ac97_state *s)
-{
-       struct dmabuf* db = &s->dma_dac;
-       unsigned long flags;
-       u32 dmaLength;
-       u32 temp;
-
-       spin_lock_irqsave(&s->lock, flags);
-
-       if (!db->stopped) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return;
-       }
-
-       /* we should have some data to do the DMA trasnfer */
-       ASSERT(db->count >= db->fragSize);
-
-       /* clear pending fales interrupts */
-       outl(VRC5477_INT_MASK_DAC1END | VRC5477_INT_MASK_DAC2END, 
-            s->io +  VRC5477_INT_CLR);
-
-       /* enable interrupts */
-       temp = inl(s->io + VRC5477_INT_MASK);
-       temp |= VRC5477_INT_MASK_DAC1END | VRC5477_INT_MASK_DAC2END;
-       outl(temp, s->io +  VRC5477_INT_MASK);
-
-       /* setup dma base addr */
-       outl(db->lbufDma + db->nextOut, s->io + VRC5477_DAC1_BADDR);
-       if (s->dacChannels == 1) {
-               outl(db->lbufDma + db->nextOut, s->io + VRC5477_DAC2_BADDR);
-       } else {
-               outl(db->rbufDma + db->nextOut, s->io + VRC5477_DAC2_BADDR);
-       }
-
-       /* set dma length, in the unit of 0x10 bytes */
-       dmaLength = db->fragSize >> 4;
-       outl(dmaLength, s->io + VRC5477_DAC1L);
-       outl(dmaLength, s->io + VRC5477_DAC2L);
-
-       /* activate dma */
-       outl(VRC5477_DMA_ACTIVATION, s->io + VRC5477_DAC1_CTRL);
-       outl(VRC5477_DMA_ACTIVATION, s->io + VRC5477_DAC2_CTRL);
-
-       /* enable dac slots - we should hear the music now! */
-       temp = inl(s->io + VRC5477_CTRL);
-       temp |= (VRC5477_CTRL_DAC1ENB | VRC5477_CTRL_DAC2ENB);
-       outl (temp, s->io + VRC5477_CTRL);
-
-       /* it is time to setup next dma transfer */
-       ASSERT(inl(s->io + VRC5477_DAC1_CTRL) & VRC5477_DMA_WIP);
-       ASSERT(inl(s->io + VRC5477_DAC2_CTRL) & VRC5477_DMA_WIP);
-
-       temp = db->nextOut + db->fragSize;
-       if (temp >= db->fragTotalSize) {
-               ASSERT(temp == db->fragTotalSize);
-               temp = 0;
-       }
-
-       outl(db->lbufDma + temp, s->io + VRC5477_DAC1_BADDR);
-       if (s->dacChannels == 1) {
-               outl(db->lbufDma + temp, s->io + VRC5477_DAC2_BADDR);
-       } else {
-               outl(db->rbufDma + temp, s->io + VRC5477_DAC2_BADDR);
-       }
-
-       db->stopped = 0;
-
-#if defined(VRC5477_AC97_VERBOSE_DEBUG)
-       outTicket = *(u16*)(db->lbuf+db->nextOut);
-       if (db->count > db->fragSize) {
-               ASSERT((u16)(outTicket+1) == *(u16*)(db->lbuf+temp));
-       }
-#endif
-
-       spin_unlock_irqrestore(&s->lock, flags);
-}      
-
-static inline void stop_adc(struct vrc5477_ac97_state *s)
-{
-       struct dmabuf* db = &s->dma_adc;
-       unsigned long flags;
-       u32 temp;
-    
-       spin_lock_irqsave(&s->lock, flags);
-
-       if (db->stopped) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return;
-       }
-
-       /* deactivate the dma */
-       outl(0, s->io + VRC5477_ADC1_CTRL);
-       outl(0, s->io + VRC5477_ADC2_CTRL);
-
-       /* disable adc slots in aclink */
-       temp = inl(s->io + VRC5477_CTRL);
-       temp &= ~ (VRC5477_CTRL_ADC1ENB | VRC5477_CTRL_ADC2ENB);
-       outl (temp, s->io + VRC5477_CTRL);
-
-       /* disable interrupts */
-        temp = inl(s->io + VRC5477_INT_MASK);
-        temp &= ~ (VRC5477_INT_MASK_ADC1END | VRC5477_INT_MASK_ADC2END); 
-        outl (temp, s->io + VRC5477_INT_MASK);
-
-       /* clear pending ones */
-       outl(VRC5477_INT_MASK_ADC1END | VRC5477_INT_MASK_ADC2END, 
-            s->io +  VRC5477_INT_CLR);
-    
-       db->stopped = 1;
-
-       spin_unlock_irqrestore(&s->lock, flags);
-}      
-
-static void start_adc(struct vrc5477_ac97_state *s)
-{
-       struct dmabuf* db = &s->dma_adc;
-       unsigned long flags;
-       u32 dmaLength;
-       u32 temp;
-
-       spin_lock_irqsave(&s->lock, flags);
-
-       if (!db->stopped) {
-               spin_unlock_irqrestore(&s->lock, flags);
-               return;
-       }
-
-       /* we should at least have some free space in the buffer */
-       ASSERT(db->count < db->fragTotalSize - db->fragSize * 2);
-
-       /* clear pending ones */
-       outl(VRC5477_INT_MASK_ADC1END | VRC5477_INT_MASK_ADC2END, 
-            s->io +  VRC5477_INT_CLR);
-
-        /* enable interrupts */
-        temp = inl(s->io + VRC5477_INT_MASK);
-        temp |= VRC5477_INT_MASK_ADC1END | VRC5477_INT_MASK_ADC2END;
-        outl(temp, s->io +  VRC5477_INT_MASK);
-
-       /* setup dma base addr */
-       outl(db->lbufDma + db->nextIn, s->io + VRC5477_ADC1_BADDR);
-       outl(db->rbufDma + db->nextIn, s->io + VRC5477_ADC2_BADDR);
-
-       /* setup dma length */
-       dmaLength = db->fragSize >> 4;
-       outl(dmaLength, s->io + VRC5477_ADC1L);
-       outl(dmaLength, s->io + VRC5477_ADC2L);
-
-       /* activate dma */
-       outl(VRC5477_DMA_ACTIVATION, s->io + VRC5477_ADC1_CTRL);
-       outl(VRC5477_DMA_ACTIVATION, s->io + VRC5477_ADC2_CTRL);
-
-       /* enable adc slots */
-       temp = inl(s->io + VRC5477_CTRL);
-       temp |= (VRC5477_CTRL_ADC1ENB | VRC5477_CTRL_ADC2ENB);
-       outl (temp, s->io + VRC5477_CTRL);
-
-       /* it is time to setup next dma transfer */
-       temp = db->nextIn + db->fragSize;
-       if (temp >= db->fragTotalSize) {
-               ASSERT(temp == db->fragTotalSize);
-               temp = 0;
-       }
-       outl(db->lbufDma + temp, s->io + VRC5477_ADC1_BADDR);
-       outl(db->rbufDma + temp, s->io + VRC5477_ADC2_BADDR);
-
-       db->stopped = 0;
-
-       spin_unlock_irqrestore(&s->lock, flags);
-}      
-
-/* --------------------------------------------------------------------- */
-
-#define DMABUF_DEFAULTORDER (16-PAGE_SHIFT)
-#define DMABUF_MINORDER 1
-
-static inline void dealloc_dmabuf(struct vrc5477_ac97_state *s,
-                                 struct dmabuf *db)
-{
-       if (db->lbuf) {
-               ASSERT(db->rbuf);
-               pci_free_consistent(s->dev, PAGE_SIZE << db->bufOrder,
-                                   db->lbuf, db->lbufDma);
-               pci_free_consistent(s->dev, PAGE_SIZE << db->bufOrder,
-                                   db->rbuf, db->rbufDma);
-               db->lbuf = db->rbuf = NULL;
-       }
-       db->nextIn = db->nextOut = 0;
-       db->ready = 0;
-}
-
-static int prog_dmabuf(struct vrc5477_ac97_state *s, 
-                      struct dmabuf *db,
-                      unsigned rate)
-{
-       int order;
-       unsigned bufsize;
-
-       if (!db->lbuf) {
-               ASSERT(!db->rbuf);
-
-               db->ready = 0;
-               for (order = DMABUF_DEFAULTORDER; 
-                    order >= DMABUF_MINORDER; 
-                    order--) {
-                       db->lbuf = pci_alloc_consistent(s->dev,
-                                                       PAGE_SIZE << order,
-                                                       &db->lbufDma);
-                       db->rbuf = pci_alloc_consistent(s->dev,
-                                                       PAGE_SIZE << order,
-                                                       &db->rbufDma);
-                       if (db->lbuf && db->rbuf) break;
-                       if (db->lbuf) {
-                           ASSERT(!db->rbuf);
-                           pci_free_consistent(s->dev, 
-                                               PAGE_SIZE << order,
-                                               db->lbuf,
-                                               db->lbufDma);
-                       }
-               }
-               if (!db->lbuf) {
-                       ASSERT(!db->rbuf);
-                       return -ENOMEM;
-               }
-
-               db->bufOrder = order;
-       }
-
-       db->count = 0;
-       db->nextIn = db->nextOut = 0;
-    
-       bufsize = PAGE_SIZE << db->bufOrder;
-       db->fragShift = ld2(rate * 2 / 100);
-       if (db->fragShift < 4) db->fragShift = 4;
-
-       db->numFrag = bufsize >> db->fragShift;
-       while (db->numFrag < 4 && db->fragShift > 4) {
-               db->fragShift--;
-               db->numFrag = bufsize >> db->fragShift;
-       }
-       db->fragSize = 1 << db->fragShift;
-       db->fragTotalSize = db->numFrag << db->fragShift;
-       memset(db->lbuf, 0, db->fragTotalSize);
-       memset(db->rbuf, 0, db->fragTotalSize);
-    
-       db->ready = 1;
-
-       return 0;
-}
-
-static inline int prog_dmabuf_adc(struct vrc5477_ac97_state *s)
-{
-    stop_adc(s);
-    return prog_dmabuf(s, &s->dma_adc, s->adcRate);
-}
-
-static inline int prog_dmabuf_dac(struct vrc5477_ac97_state *s)
-{
-    stop_dac(s);
-    return prog_dmabuf(s, &s->dma_dac, s->dacRate);
-}
-
-
-/* --------------------------------------------------------------------- */
-/* hold spinlock for the following! */
-
-static inline void vrc5477_ac97_adc_interrupt(struct vrc5477_ac97_state *s)
-{
-       struct dmabuf* adc = &s->dma_adc;
-       unsigned temp;
-
-       /* we need two frags avaiable because one is already being used
-        * and the other will be used when next interrupt happens.
-        */
-       if (adc->count >= adc->fragTotalSize - adc->fragSize) {
-               stop_adc(s);
-               adc->error++;
-               printk(KERN_INFO PFX "adc overrun\n");
-               return;
-       }
-
-       /* set the base addr for next DMA transfer */
-       temp = adc->nextIn + 2*adc->fragSize;
-       if (temp >= adc->fragTotalSize) {
-               ASSERT( (temp == adc->fragTotalSize) ||
-                             (temp == adc->fragTotalSize + adc->fragSize) );
-               temp -= adc->fragTotalSize;
-       }
-       outl(adc->lbufDma + temp, s->io + VRC5477_ADC1_BADDR);
-       outl(adc->rbufDma + temp, s->io + VRC5477_ADC2_BADDR);
-
-       /* adjust nextIn */
-       adc->nextIn += adc->fragSize;
-       if (adc->nextIn >= adc->fragTotalSize) {
-               ASSERT(adc->nextIn == adc->fragTotalSize);
-               adc->nextIn = 0;
-       }
-
-       /* adjust count */
-       adc->count += adc->fragSize;
-
-       /* wake up anybody listening */
-       if (waitqueue_active(&adc->wait)) {
-               wake_up_interruptible(&adc->wait);
-       }       
-}
-
-static inline void vrc5477_ac97_dac_interrupt(struct vrc5477_ac97_state *s)
-{
-       struct dmabuf* dac = &s->dma_dac;
-       unsigned temp;
-
-       /* next DMA transfer should already started */
-       // ASSERT(inl(s->io + VRC5477_DAC1_CTRL) & VRC5477_DMA_WIP);
-       // ASSERT(inl(s->io + VRC5477_DAC2_CTRL) & VRC5477_DMA_WIP);
-
-       /* let us set for next next DMA transfer */
-       temp = dac->nextOut + dac->fragSize*2;
-       if (temp >= dac->fragTotalSize) {
-               ASSERT( (temp == dac->fragTotalSize) || 
-                             (temp == dac->fragTotalSize + dac->fragSize) );
-               temp -= dac->fragTotalSize;
-       }
-       outl(dac->lbufDma + temp, s->io + VRC5477_DAC1_BADDR);
-       if (s->dacChannels == 1) {
-               outl(dac->lbufDma + temp, s->io + VRC5477_DAC2_BADDR);
-       } else {
-               outl(dac->rbufDma + temp, s->io + VRC5477_DAC2_BADDR);
-       }
-
-#if defined(VRC5477_AC97_VERBOSE_DEBUG)
-       if (*(u16*)(dac->lbuf +  dac->nextOut) != outTicket) {
-               printk("assert fail: - %d vs %d\n", 
-                       *(u16*)(dac->lbuf +  dac->nextOut),
-                        outTicket);
-                ASSERT(1 == 0);
-       }
-#endif
-
-       /* adjust nextOut pointer */
-       dac->nextOut += dac->fragSize;
-       if (dac->nextOut >= dac->fragTotalSize) {
-               ASSERT(dac->nextOut == dac->fragTotalSize);
-               dac->nextOut = 0;
-       }
-
-       /* adjust count */
-       dac->count -= dac->fragSize;
-       if (dac->count <=0 ) {
-               /* buffer under run */
-               dac->count = 0;
-               dac->nextIn = dac->nextOut;
-               stop_dac(s);
-       }
-
-#if defined(VRC5477_AC97_VERBOSE_DEBUG)
-       if (dac->count) {
-               outTicket ++;
-               ASSERT(*(u16*)(dac->lbuf +  dac->nextOut) == outTicket);
-       }
-#endif
-       
-       /* we cannot have both under run and someone is waiting on us */
-       ASSERT(! (waitqueue_active(&dac->wait) && (dac->count <= 0)) );
-
-       /* wake up anybody listening */
-       if (waitqueue_active(&dac->wait))
-               wake_up_interruptible(&dac->wait);
-}
-
-static irqreturn_t vrc5477_ac97_interrupt(int irq, void *dev_id)
-{
-       struct vrc5477_ac97_state *s = (struct vrc5477_ac97_state *)dev_id;
-       u32 irqStatus;
-       u32 adcInterrupts, dacInterrupts;
-
-       spin_lock(&s->lock);
-
-       /* get irqStatus and clear the detected ones */
-       irqStatus = inl(s->io + VRC5477_INT_STATUS);
-       outl(irqStatus, s->io + VRC5477_INT_CLR);
-
-       /* let us see what we get */
-       dacInterrupts = VRC5477_INT_MASK_DAC1END | VRC5477_INT_MASK_DAC2END;
-       adcInterrupts = VRC5477_INT_MASK_ADC1END | VRC5477_INT_MASK_ADC2END;
-       if (irqStatus & dacInterrupts) {
-               /* we should get both interrupts, but just in case ...  */
-               if (irqStatus & VRC5477_INT_MASK_DAC1END) {
-                       vrc5477_ac97_dac_interrupt(s);
-               }
-               if ( (irqStatus & dacInterrupts) != dacInterrupts ) {
-                       printk(KERN_WARNING "vrc5477_ac97 : dac interrupts not in sync!!!\n");
-                       stop_dac(s);
-                       start_dac(s);
-               }
-       } else if (irqStatus & adcInterrupts) {
-               /* we should get both interrupts, but just in case ...  */
-               if(irqStatus & VRC5477_INT_MASK_ADC1END) {
-                       vrc5477_ac97_adc_interrupt(s);
-               } 
-               if ( (irqStatus & adcInterrupts) != adcInterrupts ) {
-                       printk(KERN_WARNING "vrc5477_ac97 : adc interrupts not in sync!!!\n");
-                       stop_adc(s);
-                       start_adc(s);
-               }
-       }
-
-       spin_unlock(&s->lock);
-       return IRQ_HANDLED;
-}
-
-/* --------------------------------------------------------------------- */
-
-static int vrc5477_ac97_open_mixdev(struct inode *inode, struct file *file)
-{
-       int minor = iminor(inode);
-       struct list_head *list;
-       struct vrc5477_ac97_state *s;
-
-       for (list = devs.next; ; list = list->next) {
-               if (list == &devs)
-                       return -ENODEV;
-               s = list_entry(list, struct vrc5477_ac97_state, devs);
-               if (s->codec->dev_mixer == minor)
-                       break;
-       }
-       file->private_data = s;
-       return nonseekable_open(inode, file);
-}
-
-static int vrc5477_ac97_release_mixdev(struct inode *inode, struct file *file)
-{
-       return 0;
-}
-
-
-static int mixdev_ioctl(struct ac97_codec *codec, unsigned int cmd,
-                       unsigned long arg)
-{
-       return codec->mixer_ioctl(codec, cmd, arg);
-}
-
-static int vrc5477_ac97_ioctl_mixdev(struct inode *inode, struct file *file,
-                                    unsigned int cmd, unsigned long arg)
-{
-    struct vrc5477_ac97_state *s = 
-           (struct vrc5477_ac97_state *)file->private_data;
-    struct ac97_codec *codec = s->codec;
-
-    return mixdev_ioctl(codec, cmd, arg);
-}
-
-static /*const*/ struct file_operations vrc5477_ac97_mixer_fops = {
-       .owner          = THIS_MODULE,
-       .llseek         = no_llseek,
-       .ioctl          = vrc5477_ac97_ioctl_mixdev,
-       .open           = vrc5477_ac97_open_mixdev,
-       .release        = vrc5477_ac97_release_mixdev,
-};
-
-/* --------------------------------------------------------------------- */
-
-static int drain_dac(struct vrc5477_ac97_state *s, int nonblock)
-{
-       unsigned long flags;
-       int count, tmo;
-       
-       if (!s->dma_dac.ready)
-               return 0;
-
-       for (;;) {
-               spin_lock_irqsave(&s->lock, flags);
-               count = s->dma_dac.count;
-               spin_unlock_irqrestore(&s->lock, flags);
-               if (count <= 0)
-                       break;
-               if (signal_pending(current))
-                       break;
-               if (nonblock)
-                       return -EBUSY;
-               tmo = 1000 * count / s->dacRate / 2;
-               vrc5477_ac97_delay(tmo);
-       }
-       if (signal_pending(current))
-               return -ERESTARTSYS;
-       return 0;
-}
-
-/* --------------------------------------------------------------------- */
-
-static inline int
-copy_two_channel_adc_to_user(struct vrc5477_ac97_state *s, 
-                            char *buffer, 
-                            int copyCount)
-{
-       struct dmabuf *db = &s->dma_adc;
-       int bufStart = db->nextOut;
-       for (; copyCount > 0; ) {
-               int i;
-               int count = copyCount;
-               if (count > WORK_BUF_SIZE/2) count = WORK_BUF_SIZE/2;
-               for (i=0; i< count/2; i++) {
-                       s->workBuf[i].lchannel = 
-                               *(u16*)(db->lbuf + bufStart + i*2);
-                       s->workBuf[i].rchannel = 
-                               *(u16*)(db->rbuf + bufStart + i*2);
-               }
-               if (copy_to_user(buffer, s->workBuf, count*2)) {
-                       return -1;
-               }
-
-               copyCount -= count;
-               bufStart += count;
-               ASSERT(bufStart <= db->fragTotalSize);
-               buffer += count *2;
-       }
-       return 0;
-}
-
-/* return the total bytes that is copied */
-static inline int
-copy_adc_to_user(struct vrc5477_ac97_state *s,
-                char * buffer,
-                size_t count,
-                int avail)
-{
-       struct dmabuf *db = &s->dma_adc;
-       int copyCount=0;
-       int copyFragCount=0;
-       int totalCopyCount = 0;
-       int totalCopyFragCount = 0;
-       unsigned long flags;
-
-       /* adjust count to signel channel byte count */
-       count >>= s->adcChannels - 1;
-
-       /* we may have to "copy" twice as ring buffer wraps around */
-       for (; (avail > 0) && (count > 0); ) {
-               /* determine max possible copy count for single channel */
-               copyCount = count;
-               if (copyCount > avail) {
-                       copyCount = avail;
-               }
-               if (copyCount + db->nextOut > db->fragTotalSize) {
-                       copyCount = db->fragTotalSize - db->nextOut;
-                       ASSERT((copyCount % db->fragSize) == 0);
-               }
-
-               copyFragCount = (copyCount-1) >> db->fragShift;
-               copyFragCount = (copyFragCount+1) << db->fragShift;
-               ASSERT(copyFragCount >= copyCount);
-
-               /* we copy differently based on adc channels */
-               if (s->adcChannels == 1) {
-                       if (copy_to_user(buffer, 
-                                        db->lbuf + db->nextOut, 
-                                        copyCount)) 
-                               return -1;
-               } else {
-                       /* *sigh* we have to mix two streams into one  */
-                       if (copy_two_channel_adc_to_user(s, buffer, copyCount))
-                               return -1;
-               }       
-
-               count -= copyCount;
-               totalCopyCount += copyCount;
-               avail -= copyFragCount;
-               totalCopyFragCount += copyFragCount;
-
-               buffer += copyCount << (s->adcChannels-1);
-
-               db->nextOut += copyFragCount;
-               if (db->nextOut >= db->fragTotalSize) {
-                       ASSERT(db->nextOut == db->fragTotalSize);
-                       db->nextOut = 0;
-               }
-
-               ASSERT((copyFragCount % db->fragSize) == 0);
-               ASSERT( (count == 0) || (copyCount == copyFragCount));
-       }
-
-       spin_lock_irqsave(&s->lock, flags);
-        db->count -= totalCopyFragCount;
-        spin_unlock_irqrestore(&s->lock, flags);
-
-       return totalCopyCount << (s->adcChannels-1);
-}
-
-static ssize_t 
-vrc5477_ac97_read(struct file *file, 
-                 char *buffer,
-                 size_t count, 
-                 loff_t *ppos)
-{
-       struct vrc5477_ac97_state *s = 
-               (struct vrc5477_ac97_state *)file->private_data;
-       struct dmabuf *db = &s->dma_adc;
-       ssize_t ret = 0;
-       unsigned long flags;
-       int copyCount;
-       size_t avail;
-
-       if (!access_ok(VERIFY_WRITE, buffer, count))
-               return -EFAULT;
-
-       ASSERT(db->ready);
-
-       while (count > 0) {
-               // wait for samples in capture buffer
-               do {
-                       spin_lock_irqsave(&s->lock, flags);
-                       if (db->stopped)
-                               start_adc(s);
-                       avail = db->count;
-                       spin_unlock_irqrestore(&s->lock, flags);
-                       if (avail <= 0) {
-                               if (file->f_flags & O_NONBLOCK) {
-                                       if (!ret)
-                                               ret = -EAGAIN;
-                                       return ret;
-                               }
-                               interruptible_sleep_on(&db->wait);
-                               if (signal_pending(current)) {
-                                       if (!ret)
-                                               ret = -ERESTARTSYS;
-                                       return ret;
-                               }
-                       }
-               } while (avail <= 0);
-
-               ASSERT( (avail % db->fragSize) == 0);
-               copyCount = copy_adc_to_user(s, buffer, count, avail);
-               if (copyCount <=0 ) {
-                       if (!ret) ret = -EFAULT;
-                       return ret;
-               }
-
-               count -= copyCount;
-               buffer += copyCount;
-               ret += copyCount;
-       } // while (count > 0)
-
-       return ret;
-}
-
-static inline int
-copy_two_channel_dac_from_user(struct vrc5477_ac97_state *s, 
-                              const char *buffer, 
-                              int copyCount)
-{
-       struct dmabuf *db = &s->dma_dac;
-       int bufStart = db->nextIn;
-
-       ASSERT(db->ready);
-
-        for (; copyCount > 0; ) {
-                int i;
-                int count = copyCount;
-                if (count > WORK_BUF_SIZE/2) count = WORK_BUF_SIZE/2;
-                if (copy_from_user(s->workBuf, buffer, count*2)) {
-                        return -1;
-                }
-                for (i=0; i< count/2; i++) {
-                       *(u16*)(db->lbuf + bufStart + i*2) = 
-                               s->workBuf[i].lchannel;
-                       *(u16*)(db->rbuf + bufStart + i*2) = 
-                               s->workBuf[i].rchannel;
-                }
-
-                copyCount -= count;
-               bufStart += count;
-               ASSERT(bufStart <= db->fragTotalSize);
-                buffer += count *2;
-        }
-        return 0;
-
-}
-
-/* return the total bytes that is copied */
-static inline int
-copy_dac_from_user(struct vrc5477_ac97_state *s, 
-                  const char *buffer, 
-                  size_t count, 
-                  int avail)
-{      
-        struct dmabuf *db = &s->dma_dac;
-        int copyCount=0;
-        int copyFragCount=0;
-        int totalCopyCount = 0;
-        int totalCopyFragCount = 0;
-        unsigned long flags;
-#if defined(VRC5477_AC97_VERBOSE_DEBUG)
-       int i;
-#endif
-
-        /* adjust count to signel channel byte count */
-        count >>= s->dacChannels - 1;
-
-        /* we may have to "copy" twice as ring buffer wraps around */
-        for (; (avail > 0) && (count > 0); ) {
-                /* determine max possible copy count for single channel */
-                copyCount = count;
-                if (copyCount > avail) {
-                        copyCount = avail;
-               }
-                if (copyCount + db->nextIn > db->fragTotalSize) {
-                        copyCount = db->fragTotalSize - db->nextIn;
-                        ASSERT(copyCount > 0);
-                }
-
-               copyFragCount = copyCount;
-               ASSERT(copyFragCount >= copyCount);
-
-               /* we copy differently based on the number channels */
-               if (s->dacChannels == 1) {
-                       if (copy_from_user(db->lbuf + db->nextIn,
-                                          buffer,
-                                          copyCount)) 
-                               return -1;
-                       /* fill gaps with 0 */
-                       memset(db->lbuf + db->nextIn + copyCount,
-                              0,
-                              copyFragCount - copyCount);
-               } else {
-                       /* we have demux the stream into two separate ones */
-                       if (copy_two_channel_dac_from_user(s, buffer, copyCount))
-                               return -1;
-                       /* fill gaps with 0 */
-                       memset(db->lbuf + db->nextIn + copyCount,
-                              0,
-                              copyFragCount - copyCount);
-                       memset(db->rbuf + db->nextIn + copyCount,
-                              0,
-                              copyFragCount - copyCount);
-               }
-
-#if defined(VRC5477_AC97_VERBOSE_DEBUG)
-               for (i=0; i< copyFragCount; i+= db->fragSize) {
-                       *(u16*)(db->lbuf + db->nextIn + i) = inTicket ++;
-               }
-#endif
-
-               count -= copyCount;
-               totalCopyCount += copyCount;
-               avail -= copyFragCount;
-               totalCopyFragCount += copyFragCount;
-
-               buffer += copyCount << (s->dacChannels - 1);
-
-               db->nextIn += copyFragCount;
-               if (db->nextIn >= db->fragTotalSize) {
-                       ASSERT(db->nextIn == db->fragTotalSize);
-                       db->nextIn = 0;
-               }
-
-               ASSERT( (count == 0) || (copyCount == copyFragCount));
-       }
-
-       spin_lock_irqsave(&s->lock, flags);
-        db->count += totalCopyFragCount;
-       if (db->stopped) {
-               start_dac(s);
-       }
-
-       /* nextIn should not be equal to nextOut unless we are full */
-       ASSERT( ( (db->count == db->fragTotalSize) && 
-                       (db->nextIn == db->nextOut) ) ||
-                     ( (db->count < db->fragTotalSize) &&
-                       (db->nextIn != db->nextOut) ) );
-
-        spin_unlock_irqrestore(&s->lock, flags);
-
-        return totalCopyCount << (s->dacChannels-1);
-
-}
-
-static ssize_t vrc5477_ac97_write(struct file *file, const char *buffer,
-                                 size_t count, loff_t *ppos)
-{
-       struct vrc5477_ac97_state *s = 
-               (struct vrc5477_ac97_state *)file->private_data;
-       struct dmabuf *db = &s->dma_dac;
-       ssize_t ret;
-       unsigned long flags;
-       int copyCount, avail;
-
-       if (!access_ok(VERIFY_READ, buffer, count))
-               return -EFAULT;
-       ret = 0;
-    
-       while (count > 0) {
-               // wait for space in playback buffer
-               do {
-                       spin_lock_irqsave(&s->lock, flags);
-                       avail = db->fragTotalSize - db->count;
-                       spin_unlock_irqrestore(&s->lock, flags);
-                       if (avail <= 0) {
-                               if (file->f_flags & O_NONBLOCK) {
-                                       if (!ret)
-                                               ret = -EAGAIN;
-                                       return ret;
-                               }
-                               interruptible_sleep_on(&db->wait);
-                               if (signal_pending(current)) {
-                                       if (!ret)
-                                               ret = -ERESTARTSYS;
-                                       return ret;
-                               }
-                       }
-               } while (avail <= 0);
-       
-               copyCount = copy_dac_from_user(s, buffer, count, avail);
-               if (copyCount < 0) {
-                       if (!ret) ret = -EFAULT;
-                       return ret;
-               }
-
-               count -= copyCount;
-               buffer += copyCount;
-               ret += copyCount;
-       } // while (count > 0)
-       
-       return ret;
-}
-
-/* No kernel lock - we have our own spinlock */
-static unsigned int vrc5477_ac97_poll(struct file *file,
-                                     struct poll_table_struct *wait)
-{
-       struct vrc5477_ac97_state *s = (struct vrc5477_ac97_state *)file->private_data;
-       unsigned long flags;
-       unsigned int mask = 0;
-
-       if (file->f_mode & FMODE_WRITE)
-               poll_wait(file, &s->dma_dac.wait, wait);
-       if (file->f_mode & FMODE_READ)
-               poll_wait(file, &s->dma_adc.wait, wait);
-       spin_lock_irqsave(&s->lock, flags);
-       if (file->f_mode & FMODE_READ) {
-               if (s->dma_adc.count >= (signed)s->dma_adc.fragSize)
-                       mask |= POLLIN | POLLRDNORM;
-       }
-       if (file->f_mode & FMODE_WRITE) {
-               if ((signed)s->dma_dac.fragTotalSize >=
-                   s->dma_dac.count + (signed)s->dma_dac.fragSize)
-                       mask |= POLLOUT | POLLWRNORM;
-       }
-       spin_unlock_irqrestore(&s->lock, flags);
-       return mask;
-}
-
-#ifdef VRC5477_AC97_DEBUG
-static struct ioctl_str_t {
-    unsigned int cmd;
-    const char* str;
-} ioctl_str[] = {
-    {SNDCTL_DSP_RESET, "SNDCTL_DSP_RESET"},
-    {SNDCTL_DSP_SYNC, "SNDCTL_DSP_SYNC"},
-    {SNDCTL_DSP_SPEED, "SNDCTL_DSP_SPEED"},
-    {SNDCTL_DSP_STEREO, "SNDCTL_DSP_STEREO"},
-    {SNDCTL_DSP_GETBLKSIZE, "SNDCTL_DSP_GETBLKSIZE"},
-    {SNDCTL_DSP_SETFMT, "SNDCTL_DSP_SETFMT"},
-    {SNDCTL_DSP_SAMPLESIZE, "SNDCTL_DSP_SAMPLESIZE"},
-    {SNDCTL_DSP_CHANNELS, "SNDCTL_DSP_CHANNELS"},
-    {SOUND_PCM_WRITE_CHANNELS, "SOUND_PCM_WRITE_CHANNELS"},
-    {SOUND_PCM_WRITE_FILTER, "SOUND_PCM_WRITE_FILTER"},
-    {SNDCTL_DSP_POST, "SNDCTL_DSP_POST"},
-    {SNDCTL_DSP_SUBDIVIDE, "SNDCTL_DSP_SUBDIVIDE"},
-    {SNDCTL_DSP_SETFRAGMENT, "SNDCTL_DSP_SETFRAGMENT"},
-    {SNDCTL_DSP_GETFMTS, "SNDCTL_DSP_GETFMTS"},
-    {SNDCTL_DSP_GETOSPACE, "SNDCTL_DSP_GETOSPACE"},
-    {SNDCTL_DSP_GETISPACE, "SNDCTL_DSP_GETISPACE"},
-    {SNDCTL_DSP_NONBLOCK, "SNDCTL_DSP_NONBLOCK"},
-    {SNDCTL_DSP_GETCAPS, "SNDCTL_DSP_GETCAPS"},
-    {SNDCTL_DSP_GETTRIGGER, "SNDCTL_DSP_GETTRIGGER"},
-    {SNDCTL_DSP_SETTRIGGER, "SNDCTL_DSP_SETTRIGGER"},
-    {SNDCTL_DSP_GETIPTR, "SNDCTL_DSP_GETIPTR"},
-    {SNDCTL_DSP_GETOPTR, "SNDCTL_DSP_GETOPTR"},
-    {SNDCTL_DSP_MAPINBUF, "SNDCTL_DSP_MAPINBUF"},
-    {SNDCTL_DSP_MAPOUTBUF, "SNDCTL_DSP_MAPOUTBUF"},
-    {SNDCTL_DSP_SETSYNCRO, "SNDCTL_DSP_SETSYNCRO"},
-    {SNDCTL_DSP_SETDUPLEX, "SNDCTL_DSP_SETDUPLEX"},
-    {SNDCTL_DSP_GETODELAY, "SNDCTL_DSP_GETODELAY"},
-    {SNDCTL_DSP_GETCHANNELMASK, "SNDCTL_DSP_GETCHANNELMASK"},
-    {SNDCTL_DSP_BIND_CHANNEL, "SNDCTL_DSP_BIND_CHANNEL"},
-    {OSS_GETVERSION, "OSS_GETVERSION"},
-    {SOUND_PCM_READ_RATE, "SOUND_PCM_READ_RATE"},
-    {SOUND_PCM_READ_CHANNELS, "SOUND_PCM_READ_CHANNELS"},
-    {SOUND_PCM_READ_BITS, "SOUND_PCM_READ_BITS"},
-    {SOUND_PCM_READ_FILTER, "SOUND_PCM_READ_FILTER"}
-};
-#endif    
-
-static int vrc5477_ac97_ioctl(struct inode *inode, struct file *file,
-                       unsigned int cmd, unsigned long arg)
-{
-       struct vrc5477_ac97_state *s = (struct vrc5477_ac97_state *)file->private_data;
-       unsigned long flags;
-       audio_buf_info abinfo;
-       int count;
-       int val, ret;
-
-#ifdef VRC5477_AC97_DEBUG
-       for (count = 0; count < ARRAY_SIZE(ioctl_str); count++) {
-               if (ioctl_str[count].cmd == cmd)
-                       break;
-       }
-       if (count < ARRAY_SIZE(ioctl_str))
-               printk(KERN_INFO PFX "ioctl %s\n", ioctl_str[count].str);
-       else
-               printk(KERN_INFO PFX "ioctl unknown, 0x%x\n", cmd);
-#endif
-    
-       switch (cmd) {
-       case OSS_GETVERSION:
-               return put_user(SOUND_VERSION, (int *)arg);
-
-       case SNDCTL_DSP_SYNC:
-               if (file->f_mode & FMODE_WRITE)
-                       return drain_dac(s, file->f_flags & O_NONBLOCK);
-               return 0;
-               
-       case SNDCTL_DSP_SETDUPLEX:
-               return 0;
-
-       case SNDCTL_DSP_GETCAPS:
-               return put_user(DSP_CAP_DUPLEX, (int *)arg);
-               
-       case SNDCTL_DSP_RESET:
-               if (file->f_mode & FMODE_WRITE) {
-                       stop_dac(s);
-                       synchronize_irq(s->irq);
-                       s->dma_dac.count = 0;
-                       s->dma_dac.nextIn = s->dma_dac.nextOut = 0;
-               }
-               if (file->f_mode & FMODE_READ) {
-                       stop_adc(s);
-                       synchronize_irq(s->irq);
-                       s->dma_adc.count = 0;
-                       s->dma_adc.nextIn = s->dma_adc.nextOut = 0;
-               }
-               return 0;
-
-       case SNDCTL_DSP_SPEED:
-               if (get_user(val, (int *)arg))
-                       return -EFAULT;
-               if (val >= 0) {
-                       if (file->f_mode & FMODE_READ) {
-                               stop_adc(s);
-                               set_adc_rate(s, val);
-                               if ((ret = prog_dmabuf_adc(s)))
-                                       return ret;
-                       }
-                       if (file->f_mode & FMODE_WRITE) {
-                               stop_dac(s);
-                               set_dac_rate(s, val);
-                               if ((ret = prog_dmabuf_dac(s)))
-                                       return ret;
-                       }
-               }
-               return put_user((file->f_mode & FMODE_READ) ?
-                               s->adcRate : s->dacRate, (int *)arg);
-
-       case SNDCTL_DSP_STEREO:
-               if (get_user(val, (int *)arg))
-                       return -EFAULT;
-               if (file->f_mode & FMODE_READ) {
-                       stop_adc(s);
-                       if (val)
-                               s->adcChannels = 2;
-                       else
-                               s->adcChannels = 1;
-                       if ((ret = prog_dmabuf_adc(s)))
-                               return ret;
-               }
-               if (file->f_mode & FMODE_WRITE) {
-                       stop_dac(s);
-                       if (val)
-                               s->dacChannels = 2;
-                       else
-                               s->dacChannels = 1;
-                       if ((ret = prog_dmabuf_dac(s)))
-                               return ret;
-               }
-               return 0;
-
-       case SNDCTL_DSP_CHANNELS:
-               if (get_user(val, (int *)arg))
-                       return -EFAULT;
-               if (val != 0) {
-                       if ( (val != 1) && (val != 2)) val = 2;
-
-                       if (file->f_mode & FMODE_READ) {
-                               stop_adc(s);
-                               s->dacChannels = val;
-                               if ((ret = prog_dmabuf_adc(s)))
-                                       return ret;
-                       }
-                       if (file->f_mode & FMODE_WRITE) {
-                               stop_dac(s);
-                               s->dacChannels = val;
-                               if ((ret = prog_dmabuf_dac(s)))
-                                       return ret;
-                       }
-               }
-               return put_user(val, (int *)arg);
-               
-       case SNDCTL_DSP_GETFMTS: /* Returns a mask */
-               return put_user(AFMT_S16_LE, (int *)arg);
-               
-       case SNDCTL_DSP_SETFMT: /* Selects ONE fmt*/
-               if (get_user(val, (int *)arg))
-                       return -EFAULT;
-               if (val != AFMT_QUERY) {
-                       if (val != AFMT_S16_LE) return -EINVAL;
-                       if (file->f_mode & FMODE_READ) {
-                               stop_adc(s);
-                               if ((ret = prog_dmabuf_adc(s)))
-                                       return ret;
-                       }
-                       if (file->f_mode & FMODE_WRITE) {
-                               stop_dac(s);
-                               if ((ret = prog_dmabuf_dac(s)))
-                                       return ret;
-                       }
-               } else {
-                       val = AFMT_S16_LE;
-               }
-               return put_user(val, (int *)arg);
-               
-       case SNDCTL_DSP_POST:
-               return 0;
-
-       case SNDCTL_DSP_GETTRIGGER:
-       case SNDCTL_DSP_SETTRIGGER:
-               /* NO trigger */
-               return -EINVAL;
-
-       case SNDCTL_DSP_GETOSPACE:
-               if (!(file->f_mode & FMODE_WRITE))
-                       return -EINVAL;
-               abinfo.fragsize = s->dma_dac.fragSize << (s->dacChannels-1);
-               spin_lock_irqsave(&s->lock, flags);
-               count = s->dma_dac.count;
-               spin_unlock_irqrestore(&s->lock, flags);
-               abinfo.bytes = (s->dma_dac.fragTotalSize - count) << 
-                       (s->dacChannels-1);
-               abinfo.fragstotal = s->dma_dac.numFrag;
-               abinfo.fragments = abinfo.bytes >> s->dma_dac.fragShift >> 
-                       (s->dacChannels-1);      
-               return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
-
-       case SNDCTL_DSP_GETISPACE:
-               if (!(file->f_mode & FMODE_READ))
-                       return -EINVAL;
-               abinfo.fragsize = s->dma_adc.fragSize << (s->adcChannels-1);
-               spin_lock_irqsave(&s->lock, flags);
-               count = s->dma_adc.count;
-               spin_unlock_irqrestore(&s->lock, flags);
-               if (count < 0)
-                       count = 0;
-               abinfo.bytes = count << (s->adcChannels-1);
-               abinfo.fragstotal = s->dma_adc.numFrag;
-               abinfo.fragments = (abinfo.bytes >> s->dma_adc.fragShift) >>
-                       (s->adcChannels-1);      
-               return copy_to_user((void *)arg, &abinfo, sizeof(abinfo)) ? -EFAULT : 0;
-               
-       case SNDCTL_DSP_NONBLOCK:
-               file->f_flags |= O_NONBLOCK;
-               return 0;
-
-       case SNDCTL_DSP_GETODELAY:
-               if (!(file->f_mode & FMODE_WRITE))
-                       return -EINVAL;
-               spin_lock_irqsave(&s->lock, flags);
-               count = s->dma_dac.count;
-               spin_unlock_irqrestore(&s->lock, flags);
-               return put_user(count, (int *)arg);
-
-       case SNDCTL_DSP_GETIPTR:
-       case SNDCTL_DSP_GETOPTR:
-               /* we cannot get DMA ptr */
-               return -EINVAL;
-
-       case SNDCTL_DSP_GETBLKSIZE:
-               if (file->f_mode & FMODE_WRITE)
-                       return put_user(s->dma_dac.fragSize << (s->dacChannels-1), (int *)arg);
-               else
-                       return put_user(s->dma_adc.fragSize << (s->adcChannels-1), (int *)arg);
-
-       case SNDCTL_DSP_SETFRAGMENT:
-               /* we ignore fragment size request */
-               return 0;
-
-       case SNDCTL_DSP_SUBDIVIDE:
-               /* what is this for? [jsun] */
-               return 0;
-
-       case SOUND_PCM_READ_RATE:
-               return put_user((file->f_mode & FMODE_READ) ?
-                               s->adcRate : s->dacRate, (int *)arg);
-
-       case SOUND_PCM_READ_CHANNELS:
-               if (file->f_mode & FMODE_READ)
-                       return put_user(s->adcChannels, (int *)arg);
-               else
-                       return put_user(s->dacChannels ? 2 : 1, (int *)arg);
-           
-       case SOUND_PCM_READ_BITS:
-               return put_user(16, (int *)arg);
-
-       case SOUND_PCM_WRITE_FILTER:
-       case SNDCTL_DSP_SETSYNCRO:
-       case SOUND_PCM_READ_FILTER:
-               return -EINVAL;
-       }
-
-       return mixdev_ioctl(s->codec, cmd, arg);
-}
-
-
-static int vrc5477_ac97_open(struct inode *inode, struct file *file)
-{
-       int minor = iminor(inode);
-       DECLARE_WAITQUEUE(wait, current);
-       unsigned long flags;
-       struct list_head *list;
-       struct vrc5477_ac97_state *s;
-       int ret=0;
-
-       nonseekable_open(inode, file);    
-       for (list = devs.next; ; list = list->next) {
-               if (list == &devs)
-                       return -ENODEV;
-               s = list_entry(list, struct vrc5477_ac97_state, devs);
-               if (!((s->dev_audio ^ minor) & ~0xf))
-                       break;
-       }
-       file->private_data = s;
-
-       /* wait for device to become free */
-       mutex_lock(&s->open_mutex);
-       while (s->open_mode & file->f_mode) {
-
-               if (file->f_flags & O_NONBLOCK) {
-                       mutex_unlock(&s->open_mutex);
-                       return -EBUSY;
-               }
-               add_wait_queue(&s->open_wait, &wait);
-               __set_current_state(TASK_INTERRUPTIBLE);
-               mutex_unlock(&s->open_mutex);
-               schedule();
-               remove_wait_queue(&s->open_wait, &wait);
-               set_current_state(TASK_RUNNING);
-               if (signal_pending(current))
-                       return -ERESTARTSYS;
-               mutex_lock(&s->open_mutex);
-       }
-
-       spin_lock_irqsave(&s->lock, flags);
-
-       if (file->f_mode & FMODE_READ) {
-               /* set default settings */
-               set_adc_rate(s, 48000);
-               s->adcChannels = 2;
-
-               ret = prog_dmabuf_adc(s);
-               if (ret) goto bailout;
-       }
-       if (file->f_mode & FMODE_WRITE) {
-               /* set default settings */
-               set_dac_rate(s, 48000);
-               s->dacChannels = 2;
-
-               ret = prog_dmabuf_dac(s);
-               if (ret) goto bailout;
-       }
-
-       s->open_mode |= file->f_mode & (FMODE_READ | FMODE_WRITE);
-
- bailout:
-       spin_unlock_irqrestore(&s->lock, flags);
-
-       mutex_unlock(&s->open_mutex);
-       return ret;
-}
-
-static int vrc5477_ac97_release(struct inode *inode, struct file *file)
-{
-       struct vrc5477_ac97_state *s = 
-               (struct vrc5477_ac97_state *)file->private_data;
-
-       lock_kernel();
-       if (file->f_mode & FMODE_WRITE)
-               drain_dac(s, file->f_flags & O_NONBLOCK);
-       mutex_lock(&s->open_mutex);
-       if (file->f_mode & FMODE_WRITE) {
-               stop_dac(s);
-               dealloc_dmabuf(s, &s->dma_dac);
-       }
-       if (file->f_mode & FMODE_READ) {
-               stop_adc(s);
-               dealloc_dmabuf(s, &s->dma_adc);
-       }
-       s->open_mode &= (~file->f_mode) & (FMODE_READ|FMODE_WRITE);
-       mutex_unlock(&s->open_mutex);
-       wake_up(&s->open_wait);
-       unlock_kernel();
-       return 0;
-}
-
-static /*const*/ struct file_operations vrc5477_ac97_audio_fops = {
-       .owner          = THIS_MODULE,
-       .llseek         = no_llseek,
-       .read           = vrc5477_ac97_read,
-       .write          = vrc5477_ac97_write,
-       .poll           = vrc5477_ac97_poll,
-       .ioctl          = vrc5477_ac97_ioctl,
-       // .mmap        = vrc5477_ac97_mmap,
-       .open           = vrc5477_ac97_open,
-       .release        = vrc5477_ac97_release,
-};
-
-
-/* --------------------------------------------------------------------- */
-
-
-/* --------------------------------------------------------------------- */
-
-/*
- * for debugging purposes, we'll create a proc device that dumps the
- * CODEC chipstate
- */
-
-#ifdef VRC5477_AC97_DEBUG
-
-struct {
-       const char *regname;
-       unsigned regaddr;
-} vrc5477_ac97_regs[] = {
-       {"VRC5477_INT_STATUS", VRC5477_INT_STATUS},
-       {"VRC5477_CODEC_WR", VRC5477_CODEC_WR},
-       {"VRC5477_CODEC_RD", VRC5477_CODEC_RD},
-       {"VRC5477_CTRL", VRC5477_CTRL},
-       {"VRC5477_ACLINK_CTRL", VRC5477_ACLINK_CTRL},
-       {"VRC5477_INT_MASK", VRC5477_INT_MASK},
-       {"VRC5477_DAC1_CTRL", VRC5477_DAC1_CTRL},
-       {"VRC5477_DAC1L", VRC5477_DAC1L},
-       {"VRC5477_DAC1_BADDR", VRC5477_DAC1_BADDR},
-       {"VRC5477_DAC2_CTRL", VRC5477_DAC2_CTRL},
-       {"VRC5477_DAC2L", VRC5477_DAC2L},
-       {"VRC5477_DAC2_BADDR", VRC5477_DAC2_BADDR},
-       {"VRC5477_DAC3_CTRL", VRC5477_DAC3_CTRL},
-       {"VRC5477_DAC3L", VRC5477_DAC3L},
-       {"VRC5477_DAC3_BADDR", VRC5477_DAC3_BADDR},
-       {"VRC5477_ADC1_CTRL", VRC5477_ADC1_CTRL},
-       {"VRC5477_ADC1L", VRC5477_ADC1L},
-       {"VRC5477_ADC1_BADDR", VRC5477_ADC1_BADDR},
-       {"VRC5477_ADC2_CTRL", VRC5477_ADC2_CTRL},
-       {"VRC5477_ADC2L", VRC5477_ADC2L},
-       {"VRC5477_ADC2_BADDR", VRC5477_ADC2_BADDR},
-       {"VRC5477_ADC3_CTRL", VRC5477_ADC3_CTRL},
-       {"VRC5477_ADC3L", VRC5477_ADC3L},
-       {"VRC5477_ADC3_BADDR", VRC5477_ADC3_BADDR},
-       {NULL, 0x0}
-};
-
-static int proc_vrc5477_ac97_dump (char *buf, char **start, off_t fpos,
-                                  int length, int *eof, void *data)
-{
-       struct vrc5477_ac97_state *s;
-       int cnt, len = 0;
-
-       if (list_empty(&devs))
-               return 0;
-       s = list_entry(devs.next, struct vrc5477_ac97_state, devs);
-
-       /* print out header */
-       len += sprintf(buf + len, "\n\t\tVrc5477 Audio Debug\n\n");
-
-       // print out digital controller state
-       len += sprintf (buf + len, "NEC Vrc5477 Audio Controller registers\n");
-       len += sprintf (buf + len, "---------------------------------\n");
-       for (cnt=0; vrc5477_ac97_regs[cnt].regname != NULL; cnt++) {
-               len+= sprintf (buf + len, "%-20s = %08x\n",
-                              vrc5477_ac97_regs[cnt].regname,
-                              inl(s->io + vrc5477_ac97_regs[cnt].regaddr));
-       }
-   
-       /* print out driver state */
-       len += sprintf (buf + len, "NEC Vrc5477 Audio driver states\n");
-       len += sprintf (buf + len, "---------------------------------\n");
-       len += sprintf (buf + len, "dacChannels  = %d\n", s->dacChannels);
-       len += sprintf (buf + len, "adcChannels  = %d\n", s->adcChannels);
-       len += sprintf (buf + len, "dacRate  = %d\n", s->dacRate);
-       len += sprintf (buf + len, "adcRate  = %d\n", s->adcRate);
-
-       len += sprintf (buf + len, "dma_dac is %s ready\n",  
-                       s->dma_dac.ready? "" : "not");
-        if (s->dma_dac.ready) {
-               len += sprintf (buf + len, "dma_dac is %s stopped.\n",  
-                               s->dma_dac.stopped? "" : "not");
-               len += sprintf (buf + len, "dma_dac.fragSize = %x\n", 
-                                s->dma_dac.fragSize);
-               len += sprintf (buf + len, "dma_dac.fragShift = %x\n", 
-                                s->dma_dac.fragShift);
-               len += sprintf (buf + len, "dma_dac.numFrag = %x\n", 
-                                s->dma_dac.numFrag);
-               len += sprintf (buf + len, "dma_dac.fragTotalSize = %x\n", 
-                                s->dma_dac.fragTotalSize);
-               len += sprintf (buf + len, "dma_dac.nextIn = %x\n", 
-                                s->dma_dac.nextIn);
-               len += sprintf (buf + len, "dma_dac.nextOut = %x\n", 
-                                s->dma_dac.nextOut);
-               len += sprintf (buf + len, "dma_dac.count = %x\n", 
-                                s->dma_dac.count);
-       }
-
-       len += sprintf (buf + len, "dma_adc is %s ready\n",  
-                       s->dma_adc.ready? "" : "not");
-        if (s->dma_adc.ready) {
-               len += sprintf (buf + len, "dma_adc is %s stopped.\n",  
-                               s->dma_adc.stopped? "" : "not");
-               len += sprintf (buf + len, "dma_adc.fragSize = %x\n", 
-                                s->dma_adc.fragSize);
-               len += sprintf (buf + len, "dma_adc.fragShift = %x\n", 
-                                s->dma_adc.fragShift);
-               len += sprintf (buf + len, "dma_adc.numFrag = %x\n", 
-                                s->dma_adc.numFrag);
-               len += sprintf (buf + len, "dma_adc.fragTotalSize = %x\n", 
-                                s->dma_adc.fragTotalSize);
-               len += sprintf (buf + len, "dma_adc.nextIn = %x\n", 
-                                s->dma_adc.nextIn);
-               len += sprintf (buf + len, "dma_adc.nextOut = %x\n", 
-                                s->dma_adc.nextOut);
-               len += sprintf (buf + len, "dma_adc.count = %x\n", 
-                                s->dma_adc.count);
-       }
-        
-       /* print out CODEC state */
-       len += sprintf (buf + len, "\nAC97 CODEC registers\n");
-       len += sprintf (buf + len, "----------------------\n");
-       for (cnt=0; cnt <= 0x7e; cnt = cnt +2)
-               len+= sprintf (buf + len, "reg %02x = %04x\n",
-                              cnt, rdcodec(s->codec, cnt));
-
-       if (fpos >=len){
-               *start = buf;
-               *eof =1;
-               return 0;
-       }
-       *start = buf + fpos;
-       if ((len -= fpos) > length)
-               return length;
-       *eof =1;
-       return len;
-
-}
-#endif /* VRC5477_AC97_DEBUG */
-
-/* --------------------------------------------------------------------- */
-
-/* maximum number of devices; only used for command line params */
-#define NR_DEVICE 5
-
-static unsigned int devindex;
-
-MODULE_AUTHOR("Monta Vista Software, jsun@mvista.com or jsun@junsun.net");
-MODULE_DESCRIPTION("NEC Vrc5477 audio (AC97) Driver");
-MODULE_LICENSE("GPL");
-
-static int __devinit vrc5477_ac97_probe(struct pci_dev *pcidev,
-                                       const struct pci_device_id *pciid)
-{
-       struct vrc5477_ac97_state *s;
-#ifdef VRC5477_AC97_DEBUG
-       char proc_str[80];
-#endif
-
-       if (pcidev->irq == 0) 
-               return -1;
-
-       if (!(s = kzalloc(sizeof(struct vrc5477_ac97_state), GFP_KERNEL))) {
-               printk(KERN_ERR PFX "alloc of device struct failed\n");
-               return -1;
-       }
-
-       init_waitqueue_head(&s->dma_adc.wait);
-       init_waitqueue_head(&s->dma_dac.wait);
-       init_waitqueue_head(&s->open_wait);
-       mutex_init(&s->open_mutex);
-       spin_lock_init(&s->lock);
-
-       s->dev = pcidev;
-       s->io = pci_resource_start(pcidev, 0);
-       s->irq = pcidev->irq;
-       
-       s->codec = ac97_alloc_codec();
-
-       s->codec->private_data = s;
-       s->codec->id = 0;
-       s->codec->codec_read = rdcodec;
-       s->codec->codec_write = wrcodec;
-       s->codec->codec_wait = waitcodec;
-
-       /* setting some other default values such as
-        * adcChannels, adcRate is done in open() so that
-         * no persistent state across file opens.
-        */
-
-       /* test if get response from ac97, if not return */
-        if (ac97_codec_not_present(s->codec)) {
-               printk(KERN_ERR PFX "no ac97 codec\n");
-               goto err_region;
-
-        }
-
-       /* test if get response from ac97, if not return */
-        if (ac97_codec_not_present(&(s->codec))) {
-               printk(KERN_ERR PFX "no ac97 codec\n");
-               goto err_region;
-
-        }
-
-       if (!request_region(s->io, pci_resource_len(pcidev,0),
-                           VRC5477_AC97_MODULE_NAME)) {
-               printk(KERN_ERR PFX "io ports %#lx->%#lx in use\n",
-                      s->io, s->io + pci_resource_len(pcidev,0)-1);
-               goto err_region;
-       }
-       if (request_irq(s->irq, vrc5477_ac97_interrupt, IRQF_DISABLED,
-                       VRC5477_AC97_MODULE_NAME, s)) {
-               printk(KERN_ERR PFX "irq %u in use\n", s->irq);
-               goto err_irq;
-       }
-
-       printk(KERN_INFO PFX "IO at %#lx, IRQ %d\n", s->io, s->irq);
-
-       /* register devices */
-       if ((s->dev_audio = register_sound_dsp(&vrc5477_ac97_audio_fops, -1)) < 0)
-               goto err_dev1;
-       if ((s->codec->dev_mixer =
-            register_sound_mixer(&vrc5477_ac97_mixer_fops, -1)) < 0)
-               goto err_dev2;
-
-#ifdef VRC5477_AC97_DEBUG
-       /* initialize the debug proc device */
-       s->ps = create_proc_read_entry(VRC5477_AC97_MODULE_NAME, 0, NULL,
-                                      proc_vrc5477_ac97_dump, NULL);
-#endif /* VRC5477_AC97_DEBUG */
-       
-       /* enable pci io and bus mastering */
-       if (pci_enable_device(pcidev))
-               goto err_dev3;
-       pci_set_master(pcidev);
-
-       /* cold reset the AC97 */
-       outl(VRC5477_ACLINK_CTRL_RST_ON | VRC5477_ACLINK_CTRL_RST_TIME,
-            s->io + VRC5477_ACLINK_CTRL);
-       while (inl(s->io + VRC5477_ACLINK_CTRL) & VRC5477_ACLINK_CTRL_RST_ON);
-
-       /* codec init */
-       if (!ac97_probe_codec(s->codec))
-               goto err_dev3;
-
-#ifdef VRC5477_AC97_DEBUG
-       sprintf(proc_str, "driver/%s/%d/ac97", 
-               VRC5477_AC97_MODULE_NAME, s->codec->id);
-       s->ac97_ps = create_proc_read_entry (proc_str, 0, NULL,
-                                            ac97_read_proc, s->codec);
-       /* TODO : why this proc file does not show up? */
-#endif
-
-       /* Try to enable variable rate audio mode. */
-       wrcodec(s->codec, AC97_EXTENDED_STATUS,
-               rdcodec(s->codec, AC97_EXTENDED_STATUS) | AC97_EXTSTAT_VRA);
-       /* Did we enable it? */
-       if(rdcodec(s->codec, AC97_EXTENDED_STATUS) & AC97_EXTSTAT_VRA)
-               s->extended_status |= AC97_EXTSTAT_VRA;
-       else {
-               s->dacRate = 48000;
-               printk(KERN_INFO PFX "VRA mode not enabled; rate fixed at %d.",
-                       s->dacRate);
-       }
-
-        /* let us get the default volumne louder */
-        wrcodec(s->codec, 0x2, 0x1010);        /* master volume, middle */
-        wrcodec(s->codec, 0xc, 0x10);          /* phone volume, middle */
-        // wrcodec(s->codec, 0xe, 0x10);               /* misc volume, middle */
-       wrcodec(s->codec, 0x10, 0x8000);        /* line-in 2 line-out disable */
-        wrcodec(s->codec, 0x18, 0x0707);       /* PCM out (line out) middle */
-
-
-       /* by default we select line in the input */
-       wrcodec(s->codec, 0x1a, 0x0404);
-       wrcodec(s->codec, 0x1c, 0x0f0f);
-       wrcodec(s->codec, 0x1e, 0x07);
-
-       /* enable the master interrupt but disable all others */
-       outl(VRC5477_INT_MASK_NMASK, s->io + VRC5477_INT_MASK);
-
-       /* store it in the driver field */
-       pci_set_drvdata(pcidev, s);
-       pcidev->dma_mask = 0xffffffff;
-       /* put it into driver list */
-       list_add_tail(&s->devs, &devs);
-       /* increment devindex */
-       if (devindex < NR_DEVICE-1)
-               devindex++;
-       return 0;
-
- err_dev3:
-       unregister_sound_mixer(s->codec->dev_mixer);
- err_dev2:
-       unregister_sound_dsp(s->dev_audio);
- err_dev1:
-       printk(KERN_ERR PFX "cannot register misc device\n");
-       free_irq(s->irq, s);
- err_irq:
-       release_region(s->io, pci_resource_len(pcidev,0));
- err_region:
-       ac97_release_codec(codec);
-       kfree(s);
-       return -1;
-}
-
-static void __devexit vrc5477_ac97_remove(struct pci_dev *dev)
-{
-       struct vrc5477_ac97_state *s = pci_get_drvdata(dev);
-
-       if (!s)
-               return;
-       list_del(&s->devs);
-
-#ifdef VRC5477_AC97_DEBUG
-       if (s->ps)
-               remove_proc_entry(VRC5477_AC97_MODULE_NAME, NULL);
-#endif /* VRC5477_AC97_DEBUG */
-
-       synchronize_irq();
-       free_irq(s->irq, s);
-       release_region(s->io, pci_resource_len(dev,0));
-       unregister_sound_dsp(s->dev_audio);
-       unregister_sound_mixer(s->codec->dev_mixer);
-       ac97_release_codec(s->codec);
-       kfree(s);
-       pci_set_drvdata(dev, NULL);
-}
-
-
-static struct pci_device_id id_table[] = {
-    { PCI_VENDOR_ID_NEC, PCI_DEVICE_ID_NEC_VRC5477_AC97, 
-      PCI_ANY_ID, PCI_ANY_ID, 0, 0 },
-    { 0, }
-};
-
-MODULE_DEVICE_TABLE(pci, id_table);
-
-static struct pci_driver vrc5477_ac97_driver = {
-       .name           = VRC5477_AC97_MODULE_NAME,
-       .id_table       = id_table,
-       .probe          = vrc5477_ac97_probe,
-       .remove         = __devexit_p(vrc5477_ac97_remove)
-};
-
-static int __init init_vrc5477_ac97(void)
-{
-       printk("Vrc5477 AC97 driver: version v0.2 time " __TIME__ " " __DATE__ " by Jun Sun\n");
-       return pci_register_driver(&vrc5477_ac97_driver);
-}
-
-static void __exit cleanup_vrc5477_ac97(void)
-{
-       printk(KERN_INFO PFX "unloading\n");
-       pci_unregister_driver(&vrc5477_ac97_driver);
-}
-
-module_init(init_vrc5477_ac97);
-module_exit(cleanup_vrc5477_ac97);
-
index 6523ba07db963eca79b03126eee27b5244f63576..188c7cf21b8227465fdd248b6286efabc6f373d6 100644 (file)
@@ -781,6 +781,8 @@ static struct pci_device_id snd_bt87x_ids[] = {
        BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_879, 0x0070, 0x13eb, 32000),
        /* Viewcast Osprey 200 */
        BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff01, 44100),
+       /* Viewcast Osprey 440 (rate is configurable via gpio) */
+       BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x0070, 0xff07, 32000),
        /* ATI TV-Wonder */
        BT_DEVICE(PCI_DEVICE_ID_BROOKTREE_878, 0x1002, 0x0001, 32000),
        /* Leadtek Winfast tv 2000xp delux */
index 8c11e3d10a50aa8bc462a51ce43bc6c621f527bf..d098baaa0116c2fc381a5aa5ebe217c74eeceb4a 100644 (file)
@@ -52,7 +52,7 @@
 #define AICA_CHANNEL1_OFFSET 0x21000
 #define CHANNEL_OFFSET 0x10000
 
-#define AICA_DMA_CHANNEL 0
+#define AICA_DMA_CHANNEL 5
 #define AICA_DMA_MODE 5
 
 #define SND_AICA_DRIVER "AICA"
index 129d851b31511fb8516df1b89c50a85248b62a67..dd14abcdf1bd6091d4e3ab3a767866c64405cd84 100644 (file)
@@ -160,9 +160,9 @@ static void pxa2xx_ac97_cold_reset(struct snd_ac97 *ac97)
        gsr_bits = 0;
 #ifdef CONFIG_PXA27x
        /* PXA27x Developers Manual section 13.5.2.2.1 */
-       pxa_set_cken(1 << 31, 1);
+       pxa_set_cken(31, 1);
        udelay(5);
-       pxa_set_cken(1 << 31, 0);
+       pxa_set_cken(31, 0);
        GCR = GCR_COLD_RST;
        udelay(50);
 #else
index dca0344cc1bc393734a06d6eb0e71b8a634238b3..f2950cab74a62d0dabbe3322706753f8e0951300 100644 (file)
@@ -74,7 +74,6 @@ struct cs4231_dma_control {
         void           (*enable)(struct cs4231_dma_control *dma_cont, int on);
         int            (*request)(struct cs4231_dma_control *dma_cont, dma_addr_t bus_addr, size_t len);
         unsigned int   (*address)(struct cs4231_dma_control *dma_cont);
-        void           (*reset)(struct snd_cs4231 *chip); 
         void           (*preallocate)(struct snd_cs4231 *chip, struct snd_pcm *pcm); 
 #ifdef EBUS_SUPPORT
        struct          ebus_dma_info   ebus_info;
@@ -1214,10 +1213,6 @@ static int __init snd_cs4231_probe(struct snd_cs4231 *chip)
 
        spin_lock_irqsave(&chip->lock, flags);
 
-
-       /* Reset DMA engine (sbus only).  */
-       chip->p_dma.reset(chip);
-
        __cs4231_readb(chip, CS4231P(chip, STATUS));    /* clear any pendings IRQ */
        __cs4231_writeb(chip, 0, CS4231P(chip, STATUS));
        mb();
@@ -1861,14 +1856,13 @@ static void sbus_dma_enable(struct cs4231_dma_control *dma_cont, int on)
        if (!on) {
                sbus_writel(0, base->regs + base->dir + APCNC);
                sbus_writel(0, base->regs + base->dir + APCNVA);
-               sbus_writel(0, base->regs + base->dir + APCC);
-               sbus_writel(0, base->regs + base->dir + APCVA);
+               if ( base->dir == APC_PLAY ) {
+                       sbus_writel(0, base->regs + base->dir + APCC);
+                       sbus_writel(0, base->regs + base->dir + APCVA);
+               }
 
-               /* ACK any APC interrupts. */
-               csr = sbus_readl(base->regs + APCCSR);
-               sbus_writel(csr, base->regs + APCCSR);
+               udelay(1200);
        } 
-       udelay(1000);
        csr = sbus_readl(base->regs + APCCSR);
        shift = 0;
        if ( base->dir == APC_PLAY )
@@ -1894,23 +1888,6 @@ static unsigned int sbus_dma_addr(struct cs4231_dma_control *dma_cont)
         return sbus_readl(base->regs + base->dir + APCVA);
 }
 
-static void sbus_dma_reset(struct snd_cs4231 *chip)
-{
-        sbus_writel(APC_CHIP_RESET, chip->port + APCCSR);
-        sbus_writel(0x00, chip->port + APCCSR);
-        sbus_writel(sbus_readl(chip->port + APCCSR) | APC_CDC_RESET,
-                   chip->port + APCCSR);
-  
-        udelay(20);
-  
-        sbus_writel(sbus_readl(chip->port + APCCSR) & ~APC_CDC_RESET,
-                   chip->port + APCCSR);
-        sbus_writel(sbus_readl(chip->port + APCCSR) | (APC_XINT_ENA |
-                      APC_XINT_PENA |
-                      APC_XINT_CENA),
-                      chip->port + APCCSR);
-}
-
 static void sbus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
 {
        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_SBUS,
@@ -1986,14 +1963,12 @@ static int __init snd_cs4231_sbus_create(struct snd_card *card,
        chip->p_dma.enable = sbus_dma_enable;
        chip->p_dma.request = sbus_dma_request;
        chip->p_dma.address = sbus_dma_addr;
-       chip->p_dma.reset = sbus_dma_reset;
        chip->p_dma.preallocate = sbus_dma_preallocate;
 
        chip->c_dma.prepare = sbus_dma_prepare;
        chip->c_dma.enable = sbus_dma_enable;
        chip->c_dma.request = sbus_dma_request;
        chip->c_dma.address = sbus_dma_addr;
-       chip->c_dma.reset = sbus_dma_reset;
        chip->c_dma.preallocate = sbus_dma_preallocate;
 
        if (request_irq(sdev->irqs[0], snd_cs4231_sbus_interrupt,
@@ -2087,11 +2062,6 @@ static unsigned int _ebus_dma_addr(struct cs4231_dma_control *dma_cont)
        return ebus_dma_addr(&dma_cont->ebus_info);
 }
 
-static void _ebus_dma_reset(struct snd_cs4231 *chip)
-{
-       return;
-}
-
 static void _ebus_dma_preallocate(struct snd_cs4231 *chip, struct snd_pcm *pcm)
 {
        snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
@@ -2171,14 +2141,12 @@ static int __init snd_cs4231_ebus_create(struct snd_card *card,
        chip->p_dma.enable = _ebus_dma_enable;
        chip->p_dma.request = _ebus_dma_request;
        chip->p_dma.address = _ebus_dma_addr;
-       chip->p_dma.reset = _ebus_dma_reset;
        chip->p_dma.preallocate = _ebus_dma_preallocate;
 
        chip->c_dma.prepare = _ebus_dma_prepare;
        chip->c_dma.enable = _ebus_dma_enable;
        chip->c_dma.request = _ebus_dma_request;
        chip->c_dma.address = _ebus_dma_addr;
-       chip->c_dma.reset = _ebus_dma_reset;
        chip->c_dma.preallocate = _ebus_dma_preallocate;
 
        chip->port = ioremap(edev->resource[0].start, 0x10);