This commit was manufactured by cvs2svn to create tag before-fedora-2_6_18-1_2260_FC5-vs2_0_3-rc1-netfilter
authorPlanet-Lab Support <support@planet-lab.org>
Tue, 2 Jan 2007 02:12:42 +0000 (02:12 +0000)
committerPlanet-Lab Support <support@planet-lab.org>
Tue, 2 Jan 2007 02:12:42 +0000 (02:12 +0000)
'before-fedora-2_6_18-1_2260_FC5-vs2_0_3-rc1-netfilter'.

1039 files changed:
CVS/Entries [deleted file]
CVS/Repository [deleted file]
CVS/Root [deleted file]
Documentation/BK-usage/CVS/Entries [deleted file]
Documentation/BK-usage/CVS/Repository [deleted file]
Documentation/BK-usage/CVS/Root [deleted file]
Documentation/CVS/Entries [deleted file]
Documentation/CVS/Repository [deleted file]
Documentation/CVS/Root [deleted file]
Documentation/DocBook/CVS/Entries [deleted file]
Documentation/DocBook/CVS/Repository [deleted file]
Documentation/DocBook/CVS/Root [deleted file]
Documentation/DocBook/man/CVS/Entries [deleted file]
Documentation/DocBook/man/CVS/Repository [deleted file]
Documentation/DocBook/man/CVS/Root [deleted file]
Documentation/aoe/mkdevs.sh
Documentation/aoe/udev.txt
Documentation/arm/CVS/Entries [deleted file]
Documentation/arm/CVS/Repository [deleted file]
Documentation/arm/CVS/Root [deleted file]
Documentation/arm/SA1100/CVS/Entries [deleted file]
Documentation/arm/SA1100/CVS/Repository [deleted file]
Documentation/arm/SA1100/CVS/Root [deleted file]
Documentation/arm/Sharp-LH/CVS/Entries [deleted file]
Documentation/arm/Sharp-LH/CVS/Repository [deleted file]
Documentation/arm/Sharp-LH/CVS/Root [deleted file]
Documentation/arm/VFP/CVS/Entries [deleted file]
Documentation/arm/VFP/CVS/Repository [deleted file]
Documentation/arm/VFP/CVS/Root [deleted file]
Documentation/arm/XScale/ADIFCC/CVS/Entries [deleted file]
Documentation/arm/XScale/ADIFCC/CVS/Repository [deleted file]
Documentation/arm/XScale/ADIFCC/CVS/Root [deleted file]
Documentation/arm/XScale/CVS/Entries [deleted file]
Documentation/arm/XScale/CVS/Repository [deleted file]
Documentation/arm/XScale/CVS/Root [deleted file]
Documentation/arm/XScale/IOP3XX/CVS/Entries [deleted file]
Documentation/arm/XScale/IOP3XX/CVS/Repository [deleted file]
Documentation/arm/XScale/IOP3XX/CVS/Root [deleted file]
Documentation/arm/empeg/CVS/Entries [deleted file]
Documentation/arm/empeg/CVS/Repository [deleted file]
Documentation/arm/empeg/CVS/Root [deleted file]
Documentation/arm/nwfpe/CVS/Entries [deleted file]
Documentation/arm/nwfpe/CVS/Repository [deleted file]
Documentation/arm/nwfpe/CVS/Root [deleted file]
Documentation/block/CVS/Entries [deleted file]
Documentation/block/CVS/Repository [deleted file]
Documentation/block/CVS/Root [deleted file]
Documentation/cdrom/CVS/Entries [deleted file]
Documentation/cdrom/CVS/Repository [deleted file]
Documentation/cdrom/CVS/Root [deleted file]
Documentation/cpu-freq/CVS/Entries [deleted file]
Documentation/cpu-freq/CVS/Repository [deleted file]
Documentation/cpu-freq/CVS/Root [deleted file]
Documentation/cpu-freq/cpufreq-stats.txt
Documentation/cris/CVS/Entries [deleted file]
Documentation/cris/CVS/Repository [deleted file]
Documentation/cris/CVS/Root [deleted file]
Documentation/crypto/CVS/Entries [deleted file]
Documentation/crypto/CVS/Repository [deleted file]
Documentation/crypto/CVS/Root [deleted file]
Documentation/device-mapper/CVS/Entries [deleted file]
Documentation/device-mapper/CVS/Repository [deleted file]
Documentation/device-mapper/CVS/Root [deleted file]
Documentation/driver-model/CVS/Entries [deleted file]
Documentation/driver-model/CVS/Repository [deleted file]
Documentation/driver-model/CVS/Root [deleted file]
Documentation/dvb/CVS/Entries [deleted file]
Documentation/dvb/CVS/Repository [deleted file]
Documentation/dvb/CVS/Root [deleted file]
Documentation/dvb/ci.txt
Documentation/early-userspace/CVS/Entries [deleted file]
Documentation/early-userspace/CVS/Repository [deleted file]
Documentation/early-userspace/CVS/Root [deleted file]
Documentation/fb/CVS/Entries [deleted file]
Documentation/fb/CVS/Repository [deleted file]
Documentation/fb/CVS/Root [deleted file]
Documentation/filesystems/CVS/Entries [deleted file]
Documentation/filesystems/CVS/Repository [deleted file]
Documentation/filesystems/CVS/Root [deleted file]
Documentation/filesystems/devfs/CVS/Entries [deleted file]
Documentation/filesystems/devfs/CVS/Repository [deleted file]
Documentation/filesystems/devfs/CVS/Root [deleted file]
Documentation/firmware_class/CVS/Entries [deleted file]
Documentation/firmware_class/CVS/Repository [deleted file]
Documentation/firmware_class/CVS/Root [deleted file]
Documentation/i2c/CVS/Entries [deleted file]
Documentation/i2c/CVS/Repository [deleted file]
Documentation/i2c/CVS/Root [deleted file]
Documentation/i2c/busses/i2c-parport
Documentation/i2c/busses/i2c-viapro
Documentation/i386/CVS/Entries [deleted file]
Documentation/i386/CVS/Repository [deleted file]
Documentation/i386/CVS/Root [deleted file]
Documentation/ia64/CVS/Entries [deleted file]
Documentation/ia64/CVS/Repository [deleted file]
Documentation/ia64/CVS/Root [deleted file]
Documentation/input/CVS/Entries [deleted file]
Documentation/input/CVS/Repository [deleted file]
Documentation/input/CVS/Root [deleted file]
Documentation/isdn/CVS/Entries [deleted file]
Documentation/isdn/CVS/Repository [deleted file]
Documentation/isdn/CVS/Root [deleted file]
Documentation/kbuild/CVS/Entries [deleted file]
Documentation/kbuild/CVS/Repository [deleted file]
Documentation/kbuild/CVS/Root [deleted file]
Documentation/m68k/CVS/Entries [deleted file]
Documentation/m68k/CVS/Repository [deleted file]
Documentation/m68k/CVS/Root [deleted file]
Documentation/mips/CVS/Entries [deleted file]
Documentation/mips/CVS/Repository [deleted file]
Documentation/mips/CVS/Root [deleted file]
Documentation/mips/pci/CVS/Entries [deleted file]
Documentation/mips/pci/CVS/Repository [deleted file]
Documentation/mips/pci/CVS/Root [deleted file]
Documentation/networking/CVS/Entries [deleted file]
Documentation/networking/CVS/Repository [deleted file]
Documentation/networking/CVS/Root [deleted file]
Documentation/networking/README.ipw2100
Documentation/parisc/CVS/Entries [deleted file]
Documentation/parisc/CVS/Repository [deleted file]
Documentation/parisc/CVS/Root [deleted file]
Documentation/power/CVS/Entries [deleted file]
Documentation/power/CVS/Repository [deleted file]
Documentation/power/CVS/Root [deleted file]
Documentation/powerpc/CVS/Entries [deleted file]
Documentation/powerpc/CVS/Repository [deleted file]
Documentation/powerpc/CVS/Root [deleted file]
Documentation/powerpc/eeh-pci-error-recovery.txt
Documentation/powerpc/hvcs.txt
Documentation/s390/CVS/Entries [deleted file]
Documentation/s390/CVS/Repository [deleted file]
Documentation/s390/CVS/Root [deleted file]
Documentation/s390/crypto/CVS/Entries [deleted file]
Documentation/s390/crypto/CVS/Repository [deleted file]
Documentation/s390/crypto/CVS/Root [deleted file]
Documentation/scsi/CVS/Entries [deleted file]
Documentation/scsi/CVS/Repository [deleted file]
Documentation/scsi/CVS/Root [deleted file]
Documentation/serial/CVS/Entries [deleted file]
Documentation/serial/CVS/Repository [deleted file]
Documentation/serial/CVS/Root [deleted file]
Documentation/sh/CVS/Entries [deleted file]
Documentation/sh/CVS/Repository [deleted file]
Documentation/sh/CVS/Root [deleted file]
Documentation/sound/CVS/Entries [deleted file]
Documentation/sound/CVS/Repository [deleted file]
Documentation/sound/CVS/Root [deleted file]
Documentation/sound/alsa/CVS/Entries [deleted file]
Documentation/sound/alsa/CVS/Repository [deleted file]
Documentation/sound/alsa/CVS/Root [deleted file]
Documentation/sound/alsa/DocBook/CVS/Entries [deleted file]
Documentation/sound/alsa/DocBook/CVS/Repository [deleted file]
Documentation/sound/alsa/DocBook/CVS/Root [deleted file]
Documentation/sound/oss/CVS/Entries [deleted file]
Documentation/sound/oss/CVS/Repository [deleted file]
Documentation/sound/oss/CVS/Root [deleted file]
Documentation/sparc/CVS/Entries [deleted file]
Documentation/sparc/CVS/Repository [deleted file]
Documentation/sparc/CVS/Root [deleted file]
Documentation/sysctl/CVS/Entries [deleted file]
Documentation/sysctl/CVS/Repository [deleted file]
Documentation/sysctl/CVS/Root [deleted file]
Documentation/telephony/CVS/Entries [deleted file]
Documentation/telephony/CVS/Repository [deleted file]
Documentation/telephony/CVS/Root [deleted file]
Documentation/uml/CVS/Entries [deleted file]
Documentation/uml/CVS/Repository [deleted file]
Documentation/uml/CVS/Root [deleted file]
Documentation/usb/CVS/Entries [deleted file]
Documentation/usb/CVS/Repository [deleted file]
Documentation/usb/CVS/Root [deleted file]
Documentation/video4linux/CVS/Entries [deleted file]
Documentation/video4linux/CVS/Repository [deleted file]
Documentation/video4linux/CVS/Root [deleted file]
Documentation/video4linux/bttv/CVS/Entries [deleted file]
Documentation/video4linux/bttv/CVS/Repository [deleted file]
Documentation/video4linux/bttv/CVS/Root [deleted file]
Documentation/vm/CVS/Entries [deleted file]
Documentation/vm/CVS/Repository [deleted file]
Documentation/vm/CVS/Root [deleted file]
Documentation/watchdog/CVS/Entries [deleted file]
Documentation/watchdog/CVS/Repository [deleted file]
Documentation/watchdog/CVS/Root [deleted file]
Documentation/x86_64/CVS/Entries [deleted file]
Documentation/x86_64/CVS/Repository [deleted file]
Documentation/x86_64/CVS/Root [deleted file]
arch/CVS/Entries [deleted file]
arch/CVS/Repository [deleted file]
arch/CVS/Root [deleted file]
arch/alpha/CVS/Entries [deleted file]
arch/alpha/CVS/Repository [deleted file]
arch/alpha/CVS/Root [deleted file]
arch/alpha/boot/CVS/Entries [deleted file]
arch/alpha/boot/CVS/Repository [deleted file]
arch/alpha/boot/CVS/Root [deleted file]
arch/alpha/boot/tools/CVS/Entries [deleted file]
arch/alpha/boot/tools/CVS/Repository [deleted file]
arch/alpha/boot/tools/CVS/Root [deleted file]
arch/alpha/kernel/CVS/Entries [deleted file]
arch/alpha/kernel/CVS/Repository [deleted file]
arch/alpha/kernel/CVS/Root [deleted file]
arch/alpha/lib/CVS/Entries [deleted file]
arch/alpha/lib/CVS/Repository [deleted file]
arch/alpha/lib/CVS/Root [deleted file]
arch/alpha/math-emu/CVS/Entries [deleted file]
arch/alpha/math-emu/CVS/Repository [deleted file]
arch/alpha/math-emu/CVS/Root [deleted file]
arch/alpha/mm/CVS/Entries [deleted file]
arch/alpha/mm/CVS/Repository [deleted file]
arch/alpha/mm/CVS/Root [deleted file]
arch/alpha/oprofile/CVS/Entries [deleted file]
arch/alpha/oprofile/CVS/Repository [deleted file]
arch/alpha/oprofile/CVS/Root [deleted file]
arch/arm/CVS/Entries [deleted file]
arch/arm/CVS/Repository [deleted file]
arch/arm/CVS/Root [deleted file]
arch/arm/boot/CVS/Entries [deleted file]
arch/arm/boot/CVS/Repository [deleted file]
arch/arm/boot/CVS/Root [deleted file]
arch/arm/boot/bootp/CVS/Entries [deleted file]
arch/arm/boot/bootp/CVS/Repository [deleted file]
arch/arm/boot/bootp/CVS/Root [deleted file]
arch/arm/boot/compressed/CVS/Entries [deleted file]
arch/arm/boot/compressed/CVS/Repository [deleted file]
arch/arm/boot/compressed/CVS/Root [deleted file]
arch/arm/common/CVS/Entries [deleted file]
arch/arm/common/CVS/Repository [deleted file]
arch/arm/common/CVS/Root [deleted file]
arch/arm/common/scoop.c
arch/arm/configs/CVS/Entries [deleted file]
arch/arm/configs/CVS/Repository [deleted file]
arch/arm/configs/CVS/Root [deleted file]
arch/arm/configs/iq80332_defconfig
arch/arm/configs/ixp4xx_defconfig
arch/arm/configs/mainstone_defconfig
arch/arm/configs/pxa255-idp_defconfig
arch/arm/configs/smdk2410_defconfig
arch/arm/kernel/CVS/Entries [deleted file]
arch/arm/kernel/CVS/Repository [deleted file]
arch/arm/kernel/CVS/Root [deleted file]
arch/arm/lib/CVS/Entries [deleted file]
arch/arm/lib/CVS/Repository [deleted file]
arch/arm/lib/CVS/Root [deleted file]
arch/arm/mach-adifcc/CVS/Entries [deleted file]
arch/arm/mach-adifcc/CVS/Repository [deleted file]
arch/arm/mach-adifcc/CVS/Root [deleted file]
arch/arm/mach-clps711x/CVS/Entries [deleted file]
arch/arm/mach-clps711x/CVS/Repository [deleted file]
arch/arm/mach-clps711x/CVS/Root [deleted file]
arch/arm/mach-clps7500/CVS/Entries [deleted file]
arch/arm/mach-clps7500/CVS/Repository [deleted file]
arch/arm/mach-clps7500/CVS/Root [deleted file]
arch/arm/mach-ebsa110/CVS/Entries [deleted file]
arch/arm/mach-ebsa110/CVS/Repository [deleted file]
arch/arm/mach-ebsa110/CVS/Root [deleted file]
arch/arm/mach-epxa10db/CVS/Entries [deleted file]
arch/arm/mach-epxa10db/CVS/Repository [deleted file]
arch/arm/mach-epxa10db/CVS/Root [deleted file]
arch/arm/mach-footbridge/CVS/Entries [deleted file]
arch/arm/mach-footbridge/CVS/Repository [deleted file]
arch/arm/mach-footbridge/CVS/Root [deleted file]
arch/arm/mach-footbridge/time.c
arch/arm/mach-ftvpci/CVS/Entries [deleted file]
arch/arm/mach-ftvpci/CVS/Repository [deleted file]
arch/arm/mach-ftvpci/CVS/Root [deleted file]
arch/arm/mach-integrator/CVS/Entries [deleted file]
arch/arm/mach-integrator/CVS/Repository [deleted file]
arch/arm/mach-integrator/CVS/Root [deleted file]
arch/arm/mach-iop3xx/CVS/Entries [deleted file]
arch/arm/mach-iop3xx/CVS/Repository [deleted file]
arch/arm/mach-iop3xx/CVS/Root [deleted file]
arch/arm/mach-iop3xx/iq80332-mm.c
arch/arm/mach-iop3xx/iq80332-pci.c
arch/arm/mach-ixp4xx/CVS/Entries [deleted file]
arch/arm/mach-ixp4xx/CVS/Repository [deleted file]
arch/arm/mach-ixp4xx/CVS/Root [deleted file]
arch/arm/mach-l7200/CVS/Entries [deleted file]
arch/arm/mach-l7200/CVS/Repository [deleted file]
arch/arm/mach-l7200/CVS/Root [deleted file]
arch/arm/mach-lh7a40x/CVS/Entries [deleted file]
arch/arm/mach-lh7a40x/CVS/Repository [deleted file]
arch/arm/mach-lh7a40x/CVS/Root [deleted file]
arch/arm/mach-omap/CVS/Entries [deleted file]
arch/arm/mach-omap/CVS/Repository [deleted file]
arch/arm/mach-omap/CVS/Root [deleted file]
arch/arm/mach-pxa/CVS/Entries [deleted file]
arch/arm/mach-pxa/CVS/Repository [deleted file]
arch/arm/mach-pxa/CVS/Root [deleted file]
arch/arm/mach-rpc/CVS/Entries [deleted file]
arch/arm/mach-rpc/CVS/Repository [deleted file]
arch/arm/mach-rpc/CVS/Root [deleted file]
arch/arm/mach-s3c2410/CVS/Entries [deleted file]
arch/arm/mach-s3c2410/CVS/Repository [deleted file]
arch/arm/mach-s3c2410/CVS/Root [deleted file]
arch/arm/mach-s3c2410/gpio.c
arch/arm/mach-s3c2410/mach-n30.c
arch/arm/mach-sa1100/CVS/Entries [deleted file]
arch/arm/mach-sa1100/CVS/Repository [deleted file]
arch/arm/mach-sa1100/CVS/Root [deleted file]
arch/arm/mach-shark/CVS/Entries [deleted file]
arch/arm/mach-shark/CVS/Repository [deleted file]
arch/arm/mach-shark/CVS/Root [deleted file]
arch/arm/mach-tbox/CVS/Entries [deleted file]
arch/arm/mach-tbox/CVS/Repository [deleted file]
arch/arm/mach-tbox/CVS/Root [deleted file]
arch/arm/mach-versatile/CVS/Entries [deleted file]
arch/arm/mach-versatile/CVS/Repository [deleted file]
arch/arm/mach-versatile/CVS/Root [deleted file]
arch/arm/mm/CVS/Entries [deleted file]
arch/arm/mm/CVS/Repository [deleted file]
arch/arm/mm/CVS/Root [deleted file]
arch/arm/nwfpe/CVS/Entries [deleted file]
arch/arm/nwfpe/CVS/Repository [deleted file]
arch/arm/nwfpe/CVS/Root [deleted file]
arch/arm/oprofile/CVS/Entries [deleted file]
arch/arm/oprofile/CVS/Repository [deleted file]
arch/arm/oprofile/CVS/Root [deleted file]
arch/arm/tools/CVS/Entries [deleted file]
arch/arm/tools/CVS/Repository [deleted file]
arch/arm/tools/CVS/Root [deleted file]
arch/arm/vfp/CVS/Entries [deleted file]
arch/arm/vfp/CVS/Repository [deleted file]
arch/arm/vfp/CVS/Root [deleted file]
arch/arm/vfp/entry.S
arch/arm26/CVS/Entries [deleted file]
arch/arm26/CVS/Repository [deleted file]
arch/arm26/CVS/Root [deleted file]
arch/arm26/boot/CVS/Entries [deleted file]
arch/arm26/boot/CVS/Repository [deleted file]
arch/arm26/boot/CVS/Root [deleted file]
arch/arm26/boot/compressed/CVS/Entries [deleted file]
arch/arm26/boot/compressed/CVS/Repository [deleted file]
arch/arm26/boot/compressed/CVS/Root [deleted file]
arch/arm26/kernel/CVS/Entries [deleted file]
arch/arm26/kernel/CVS/Repository [deleted file]
arch/arm26/kernel/CVS/Root [deleted file]
arch/arm26/lib/CVS/Entries [deleted file]
arch/arm26/lib/CVS/Repository [deleted file]
arch/arm26/lib/CVS/Root [deleted file]
arch/arm26/machine/CVS/Entries [deleted file]
arch/arm26/machine/CVS/Repository [deleted file]
arch/arm26/machine/CVS/Root [deleted file]
arch/arm26/mm/CVS/Entries [deleted file]
arch/arm26/mm/CVS/Repository [deleted file]
arch/arm26/mm/CVS/Root [deleted file]
arch/arm26/mm/memc.c
arch/arm26/nwfpe/CVS/Entries [deleted file]
arch/arm26/nwfpe/CVS/Repository [deleted file]
arch/arm26/nwfpe/CVS/Root [deleted file]
arch/cris/CVS/Entries [deleted file]
arch/cris/CVS/Repository [deleted file]
arch/cris/CVS/Root [deleted file]
arch/cris/arch-v10/CVS/Entries [deleted file]
arch/cris/arch-v10/CVS/Repository [deleted file]
arch/cris/arch-v10/CVS/Root [deleted file]
arch/cris/arch-v10/boot/CVS/Entries [deleted file]
arch/cris/arch-v10/boot/CVS/Repository [deleted file]
arch/cris/arch-v10/boot/CVS/Root [deleted file]
arch/cris/arch-v10/boot/compressed/CVS/Entries [deleted file]
arch/cris/arch-v10/boot/compressed/CVS/Repository [deleted file]
arch/cris/arch-v10/boot/compressed/CVS/Root [deleted file]
arch/cris/arch-v10/boot/rescue/CVS/Entries [deleted file]
arch/cris/arch-v10/boot/rescue/CVS/Repository [deleted file]
arch/cris/arch-v10/boot/rescue/CVS/Root [deleted file]
arch/cris/arch-v10/boot/tools/CVS/Entries [deleted file]
arch/cris/arch-v10/boot/tools/CVS/Repository [deleted file]
arch/cris/arch-v10/boot/tools/CVS/Root [deleted file]
arch/cris/arch-v10/drivers/CVS/Entries [deleted file]
arch/cris/arch-v10/drivers/CVS/Repository [deleted file]
arch/cris/arch-v10/drivers/CVS/Root [deleted file]
arch/cris/arch-v10/kernel/CVS/Entries [deleted file]
arch/cris/arch-v10/kernel/CVS/Repository [deleted file]
arch/cris/arch-v10/kernel/CVS/Root [deleted file]
arch/cris/arch-v10/lib/CVS/Entries [deleted file]
arch/cris/arch-v10/lib/CVS/Repository [deleted file]
arch/cris/arch-v10/lib/CVS/Root [deleted file]
arch/cris/arch-v10/mm/CVS/Entries [deleted file]
arch/cris/arch-v10/mm/CVS/Repository [deleted file]
arch/cris/arch-v10/mm/CVS/Root [deleted file]
arch/cris/kernel/CVS/Entries [deleted file]
arch/cris/kernel/CVS/Repository [deleted file]
arch/cris/kernel/CVS/Root [deleted file]
arch/cris/mm/CVS/Entries [deleted file]
arch/cris/mm/CVS/Repository [deleted file]
arch/cris/mm/CVS/Root [deleted file]
arch/frv/Makefile
arch/frv/boot/Makefile
arch/frv/kernel/Makefile
arch/frv/kernel/vmlinux.lds.S
arch/frv/lib/checksum.c
arch/frv/mm/fault.c
arch/frv/mm/pgalloc.c
arch/h8300/CVS/Entries [deleted file]
arch/h8300/CVS/Repository [deleted file]
arch/h8300/CVS/Root [deleted file]
arch/h8300/boot/CVS/Entries [deleted file]
arch/h8300/boot/CVS/Repository [deleted file]
arch/h8300/boot/CVS/Root [deleted file]
arch/h8300/kernel/CVS/Entries [deleted file]
arch/h8300/kernel/CVS/Repository [deleted file]
arch/h8300/kernel/CVS/Root [deleted file]
arch/h8300/lib/CVS/Entries [deleted file]
arch/h8300/lib/CVS/Repository [deleted file]
arch/h8300/lib/CVS/Root [deleted file]
arch/h8300/mm/CVS/Entries [deleted file]
arch/h8300/mm/CVS/Repository [deleted file]
arch/h8300/mm/CVS/Root [deleted file]
arch/h8300/platform/CVS/Entries [deleted file]
arch/h8300/platform/CVS/Repository [deleted file]
arch/h8300/platform/CVS/Root [deleted file]
arch/h8300/platform/h8300h/CVS/Entries [deleted file]
arch/h8300/platform/h8300h/CVS/Repository [deleted file]
arch/h8300/platform/h8300h/CVS/Root [deleted file]
arch/h8300/platform/h8300h/aki3068net/CVS/Entries [deleted file]
arch/h8300/platform/h8300h/aki3068net/CVS/Repository [deleted file]
arch/h8300/platform/h8300h/aki3068net/CVS/Root [deleted file]
arch/h8300/platform/h8300h/generic/CVS/Entries [deleted file]
arch/h8300/platform/h8300h/generic/CVS/Repository [deleted file]
arch/h8300/platform/h8300h/generic/CVS/Root [deleted file]
arch/h8300/platform/h8300h/h8max/CVS/Entries [deleted file]
arch/h8300/platform/h8300h/h8max/CVS/Repository [deleted file]
arch/h8300/platform/h8300h/h8max/CVS/Root [deleted file]
arch/h8300/platform/h8s/CVS/Entries [deleted file]
arch/h8300/platform/h8s/CVS/Repository [deleted file]
arch/h8300/platform/h8s/CVS/Root [deleted file]
arch/h8300/platform/h8s/edosk2674/CVS/Entries [deleted file]
arch/h8300/platform/h8s/edosk2674/CVS/Repository [deleted file]
arch/h8300/platform/h8s/edosk2674/CVS/Root [deleted file]
arch/h8300/platform/h8s/generic/CVS/Entries [deleted file]
arch/h8300/platform/h8s/generic/CVS/Repository [deleted file]
arch/h8300/platform/h8s/generic/CVS/Root [deleted file]
arch/i386/CVS/Entries [deleted file]
arch/i386/CVS/Repository [deleted file]
arch/i386/CVS/Root [deleted file]
arch/i386/boot/CVS/Entries [deleted file]
arch/i386/boot/CVS/Repository [deleted file]
arch/i386/boot/CVS/Root [deleted file]
arch/i386/boot/compressed/CVS/Entries [deleted file]
arch/i386/boot/compressed/CVS/Repository [deleted file]
arch/i386/boot/compressed/CVS/Root [deleted file]
arch/i386/boot/tools/CVS/Entries [deleted file]
arch/i386/boot/tools/CVS/Repository [deleted file]
arch/i386/boot/tools/CVS/Root [deleted file]
arch/i386/boot98/CVS/Entries [deleted file]
arch/i386/boot98/CVS/Repository [deleted file]
arch/i386/boot98/CVS/Root [deleted file]
arch/i386/boot98/compressed/CVS/Entries [deleted file]
arch/i386/boot98/compressed/CVS/Repository [deleted file]
arch/i386/boot98/compressed/CVS/Root [deleted file]
arch/i386/boot98/tools/CVS/Entries [deleted file]
arch/i386/boot98/tools/CVS/Repository [deleted file]
arch/i386/boot98/tools/CVS/Root [deleted file]
arch/i386/crypto/CVS/Entries [deleted file]
arch/i386/crypto/CVS/Repository [deleted file]
arch/i386/crypto/CVS/Root [deleted file]
arch/i386/kernel/CVS/Entries [deleted file]
arch/i386/kernel/CVS/Repository [deleted file]
arch/i386/kernel/CVS/Root [deleted file]
arch/i386/kernel/acpi/CVS/Entries [deleted file]
arch/i386/kernel/acpi/CVS/Repository [deleted file]
arch/i386/kernel/acpi/CVS/Root [deleted file]
arch/i386/kernel/acpi/boot-xen.c
arch/i386/kernel/apic-xen.c
arch/i386/kernel/cpu/CVS/Entries [deleted file]
arch/i386/kernel/cpu/CVS/Repository [deleted file]
arch/i386/kernel/cpu/CVS/Root [deleted file]
arch/i386/kernel/cpu/common-xen.c
arch/i386/kernel/cpu/cpufreq/CVS/Entries [deleted file]
arch/i386/kernel/cpu/cpufreq/CVS/Repository [deleted file]
arch/i386/kernel/cpu/cpufreq/CVS/Root [deleted file]
arch/i386/kernel/cpu/mcheck/CVS/Entries [deleted file]
arch/i386/kernel/cpu/mcheck/CVS/Repository [deleted file]
arch/i386/kernel/cpu/mcheck/CVS/Root [deleted file]
arch/i386/kernel/cpu/mtrr/CVS/Entries [deleted file]
arch/i386/kernel/cpu/mtrr/CVS/Repository [deleted file]
arch/i386/kernel/cpu/mtrr/CVS/Root [deleted file]
arch/i386/kernel/cpu/mtrr/main-xen.c
arch/i386/kernel/entry-xen.S
arch/i386/kernel/fixup.c
arch/i386/kernel/head-xen.S
arch/i386/kernel/io_apic-xen.c
arch/i386/kernel/microcode-xen.c
arch/i386/kernel/mpparse-xen.c
arch/i386/kernel/pci-dma-xen.c
arch/i386/kernel/process-xen.c
arch/i386/kernel/quirks-xen.c
arch/i386/kernel/reboot_fixups.c
arch/i386/kernel/setup-xen.c
arch/i386/kernel/smp-xen.c
arch/i386/kernel/swiotlb.c
arch/i386/kernel/time-xen.c
arch/i386/kernel/timers/CVS/Entries [deleted file]
arch/i386/kernel/timers/CVS/Repository [deleted file]
arch/i386/kernel/timers/CVS/Root [deleted file]
arch/i386/kernel/traps-xen.c
arch/i386/kernel/vsyscall-note-xen.S
arch/i386/lib/CVS/Entries [deleted file]
arch/i386/lib/CVS/Repository [deleted file]
arch/i386/lib/CVS/Root [deleted file]
arch/i386/mach-default/CVS/Entries [deleted file]
arch/i386/mach-default/CVS/Repository [deleted file]
arch/i386/mach-default/CVS/Root [deleted file]
arch/i386/mach-es7000/CVS/Entries [deleted file]
arch/i386/mach-es7000/CVS/Repository [deleted file]
arch/i386/mach-es7000/CVS/Root [deleted file]
arch/i386/mach-es7000/es7000plat.c
arch/i386/mach-generic/CVS/Entries [deleted file]
arch/i386/mach-generic/CVS/Repository [deleted file]
arch/i386/mach-generic/CVS/Root [deleted file]
arch/i386/mach-pc9800/CVS/Entries [deleted file]
arch/i386/mach-pc9800/CVS/Repository [deleted file]
arch/i386/mach-pc9800/CVS/Root [deleted file]
arch/i386/mach-visws/CVS/Entries [deleted file]
arch/i386/mach-visws/CVS/Repository [deleted file]
arch/i386/mach-visws/CVS/Root [deleted file]
arch/i386/mach-voyager/CVS/Entries [deleted file]
arch/i386/mach-voyager/CVS/Repository [deleted file]
arch/i386/mach-voyager/CVS/Root [deleted file]
arch/i386/mach-xen/Makefile
arch/i386/mach-xen/setup.c
arch/i386/math-emu/CVS/Entries [deleted file]
arch/i386/math-emu/CVS/Repository [deleted file]
arch/i386/math-emu/CVS/Root [deleted file]
arch/i386/mm/CVS/Entries [deleted file]
arch/i386/mm/CVS/Repository [deleted file]
arch/i386/mm/CVS/Root [deleted file]
arch/i386/mm/fault-xen.c
arch/i386/mm/hypervisor.c
arch/i386/mm/init-xen.c
arch/i386/mm/ioremap-xen.c
arch/i386/mm/pgtable-xen.c
arch/i386/oprofile/CVS/Entries [deleted file]
arch/i386/oprofile/CVS/Repository [deleted file]
arch/i386/oprofile/CVS/Root [deleted file]
arch/i386/oprofile/xenoprof.c
arch/i386/pci/CVS/Entries [deleted file]
arch/i386/pci/CVS/Repository [deleted file]
arch/i386/pci/CVS/Root [deleted file]
arch/i386/pci/irq-xen.c
arch/i386/power/CVS/Entries [deleted file]
arch/i386/power/CVS/Repository [deleted file]
arch/i386/power/CVS/Root [deleted file]
arch/ia64/CVS/Entries [deleted file]
arch/ia64/CVS/Repository [deleted file]
arch/ia64/CVS/Root [deleted file]
arch/ia64/configs/CVS/Entries [deleted file]
arch/ia64/configs/CVS/Repository [deleted file]
arch/ia64/configs/CVS/Root [deleted file]
arch/ia64/dig/CVS/Entries [deleted file]
arch/ia64/dig/CVS/Repository [deleted file]
arch/ia64/dig/CVS/Root [deleted file]
arch/ia64/hp/CVS/Entries [deleted file]
arch/ia64/hp/CVS/Repository [deleted file]
arch/ia64/hp/CVS/Root [deleted file]
arch/ia64/hp/common/CVS/Entries [deleted file]
arch/ia64/hp/common/CVS/Repository [deleted file]
arch/ia64/hp/common/CVS/Root [deleted file]
arch/ia64/hp/sim/CVS/Entries [deleted file]
arch/ia64/hp/sim/CVS/Repository [deleted file]
arch/ia64/hp/sim/CVS/Root [deleted file]
arch/ia64/hp/sim/boot/CVS/Entries [deleted file]
arch/ia64/hp/sim/boot/CVS/Repository [deleted file]
arch/ia64/hp/sim/boot/CVS/Root [deleted file]
arch/ia64/hp/zx1/CVS/Entries [deleted file]
arch/ia64/hp/zx1/CVS/Repository [deleted file]
arch/ia64/hp/zx1/CVS/Root [deleted file]
arch/ia64/ia32/CVS/Entries [deleted file]
arch/ia64/ia32/CVS/Repository [deleted file]
arch/ia64/ia32/CVS/Root [deleted file]
arch/ia64/kernel/CVS/Entries [deleted file]
arch/ia64/kernel/CVS/Repository [deleted file]
arch/ia64/kernel/CVS/Root [deleted file]
arch/ia64/lib/CVS/Entries [deleted file]
arch/ia64/lib/CVS/Repository [deleted file]
arch/ia64/lib/CVS/Root [deleted file]
arch/ia64/mm/CVS/Entries [deleted file]
arch/ia64/mm/CVS/Repository [deleted file]
arch/ia64/mm/CVS/Root [deleted file]
arch/ia64/oprofile/CVS/Entries [deleted file]
arch/ia64/oprofile/CVS/Repository [deleted file]
arch/ia64/oprofile/CVS/Root [deleted file]
arch/ia64/pci/CVS/Entries [deleted file]
arch/ia64/pci/CVS/Repository [deleted file]
arch/ia64/pci/CVS/Root [deleted file]
arch/ia64/scripts/CVS/Entries [deleted file]
arch/ia64/scripts/CVS/Repository [deleted file]
arch/ia64/scripts/CVS/Root [deleted file]
arch/ia64/sn/CVS/Entries [deleted file]
arch/ia64/sn/CVS/Repository [deleted file]
arch/ia64/sn/CVS/Root [deleted file]
arch/ia64/sn/fakeprom/CVS/Entries [deleted file]
arch/ia64/sn/fakeprom/CVS/Repository [deleted file]
arch/ia64/sn/fakeprom/CVS/Root [deleted file]
arch/ia64/sn/io/CVS/Entries [deleted file]
arch/ia64/sn/io/CVS/Repository [deleted file]
arch/ia64/sn/io/CVS/Root [deleted file]
arch/ia64/sn/io/drivers/CVS/Entries [deleted file]
arch/ia64/sn/io/drivers/CVS/Repository [deleted file]
arch/ia64/sn/io/drivers/CVS/Root [deleted file]
arch/ia64/sn/io/hwgfs/CVS/Entries [deleted file]
arch/ia64/sn/io/hwgfs/CVS/Repository [deleted file]
arch/ia64/sn/io/hwgfs/CVS/Root [deleted file]
arch/ia64/sn/io/machvec/CVS/Entries [deleted file]
arch/ia64/sn/io/machvec/CVS/Repository [deleted file]
arch/ia64/sn/io/machvec/CVS/Root [deleted file]
arch/ia64/sn/io/platform_init/CVS/Entries [deleted file]
arch/ia64/sn/io/platform_init/CVS/Repository [deleted file]
arch/ia64/sn/io/platform_init/CVS/Root [deleted file]
arch/ia64/sn/io/sn2/CVS/Entries [deleted file]
arch/ia64/sn/io/sn2/CVS/Repository [deleted file]
arch/ia64/sn/io/sn2/CVS/Root [deleted file]
arch/ia64/sn/io/sn2/pcibr/CVS/Entries [deleted file]
arch/ia64/sn/io/sn2/pcibr/CVS/Repository [deleted file]
arch/ia64/sn/io/sn2/pcibr/CVS/Root [deleted file]
arch/ia64/sn/kernel/CVS/Entries [deleted file]
arch/ia64/sn/kernel/CVS/Repository [deleted file]
arch/ia64/sn/kernel/CVS/Root [deleted file]
arch/ia64/sn/kernel/iomv.c
arch/ia64/sn/kernel/sn2/CVS/Entries [deleted file]
arch/ia64/sn/kernel/sn2/CVS/Repository [deleted file]
arch/ia64/sn/kernel/sn2/CVS/Root [deleted file]
arch/ia64/sn/kernel/tiocx.c
arch/ia64/sn/pci/pcibr/pcibr_ate.c
arch/ia64/xen/hypervisor.c
arch/m68k/CVS/Entries [deleted file]
arch/m68k/CVS/Repository [deleted file]
arch/m68k/CVS/Root [deleted file]
arch/m68k/amiga/CVS/Entries [deleted file]
arch/m68k/amiga/CVS/Repository [deleted file]
arch/m68k/amiga/CVS/Root [deleted file]
arch/m68k/apollo/CVS/Entries [deleted file]
arch/m68k/apollo/CVS/Repository [deleted file]
arch/m68k/apollo/CVS/Root [deleted file]
arch/m68k/atari/CVS/Entries [deleted file]
arch/m68k/atari/CVS/Repository [deleted file]
arch/m68k/atari/CVS/Root [deleted file]
arch/m68k/bvme6000/CVS/Entries [deleted file]
arch/m68k/bvme6000/CVS/Repository [deleted file]
arch/m68k/bvme6000/CVS/Root [deleted file]
arch/m68k/fpsp040/CVS/Entries [deleted file]
arch/m68k/fpsp040/CVS/Repository [deleted file]
arch/m68k/fpsp040/CVS/Root [deleted file]
arch/m68k/hp300/CVS/Entries [deleted file]
arch/m68k/hp300/CVS/Repository [deleted file]
arch/m68k/hp300/CVS/Root [deleted file]
arch/m68k/ifpsp060/CVS/Entries [deleted file]
arch/m68k/ifpsp060/CVS/Repository [deleted file]
arch/m68k/ifpsp060/CVS/Root [deleted file]
arch/mips/au1000/common/cputable.c
arch/mips/kernel/module.c
arch/mips/mm/dma-ip32.c
arch/mips/oprofile/Makefile
arch/mips/oprofile/op_impl.h
arch/mips/oprofile/op_model_rm9000.c
arch/parisc/lib/iomap.c
arch/ppc/boot/simple/misc-cpci690.c
arch/ppc/boot/simple/misc-radstone_ppc7d.c
arch/ppc/lib/rheap.c
arch/ppc/platforms/4xx/ibm440sp.c
arch/ppc/platforms/85xx/Kconfig
arch/ppc/platforms/chestnut.h
arch/ppc/platforms/cpci690.h
arch/ppc/platforms/hdpu.h
arch/ppc/platforms/katana.h
arch/ppc/platforms/lite5200.h
arch/ppc/platforms/radstone_ppc7d.h
arch/ppc/syslib/ibm440sp_common.h
arch/ppc/syslib/ibm44x_common.h
arch/ppc/syslib/mpc52xx_devices.c
arch/ppc/syslib/mpc52xx_pci.h
arch/ppc/syslib/mpc52xx_sys.c
arch/ppc/syslib/mpc83xx_sys.c
arch/ppc/syslib/mpc85xx_sys.c
arch/ppc/syslib/mv64x60_win.c
arch/ppc/syslib/ppc_sys.c
arch/sh/boards/renesas/rts7751r2d/io.c
arch/sh/drivers/dma/dma-sysfs.c
arch/sh64/Kconfig
arch/sh64/mm/fault.c
arch/sh64/mm/init.c
arch/sparc64/lib/bzero.S
arch/sparc64/prom/cif.S
arch/um/drivers/random.c
arch/um/include/registers.h
arch/um/include/sysdep-x86_64/ptrace.h
arch/um/include/sysdep-x86_64/ptrace_user.h
arch/um/kernel/exec.c
arch/um/os-Linux/elf_aux.c
arch/um/os-Linux/sys-i386/Makefile
arch/um/os-Linux/sys-i386/registers.c
arch/um/os-Linux/sys-x86_64/registers.c
arch/um/sys-i386/signal.c
arch/um/sys-i386/user-offsets.c
arch/um/sys-x86_64/Makefile
arch/um/sys-x86_64/ptrace.c
arch/um/sys-x86_64/signal.c
arch/um/sys-x86_64/user-offsets.c
arch/x86_64/ia32/ia32entry-xen.S
arch/x86_64/ia32/syscall32-xen.c
arch/x86_64/kernel/apic-xen.c
arch/x86_64/kernel/e820-xen.c
arch/x86_64/kernel/early_printk-xen.c
arch/x86_64/kernel/entry-xen.S
arch/x86_64/kernel/genapic-xen.c
arch/x86_64/kernel/genapic_xen.c
arch/x86_64/kernel/head-xen.S
arch/x86_64/kernel/head64-xen.c
arch/x86_64/kernel/io_apic-xen.c
arch/x86_64/kernel/mce_intel.c
arch/x86_64/kernel/mpparse-xen.c
arch/x86_64/kernel/process-xen.c
arch/x86_64/kernel/setup-xen.c
arch/x86_64/kernel/setup64-xen.c
arch/x86_64/kernel/smp-xen.c
arch/x86_64/kernel/traps-xen.c
arch/x86_64/kernel/vsyscall-xen.c
arch/x86_64/mm/fault-xen.c
arch/x86_64/mm/init-xen.c
arch/x86_64/mm/mmap.c
arch/x86_64/mm/pageattr-xen.c
configs/kernel-2.6.18-i586-smp.config
configs/kernel-2.6.18-i586.config
configs/kernel-2.6.18-i686-kdump.config
configs/kernel-2.6.18-i686-smp.config
configs/kernel-2.6.18-i686-xen.config
configs/kernel-2.6.18-i686-xen0.config
configs/kernel-2.6.18-i686-xenU.config
configs/kernel-2.6.18-i686.config
configs/kernel-2.6.18-ia64-xen.config
configs/kernel-2.6.18-ia64.config
configs/kernel-2.6.18-ppc-smp.config
configs/kernel-2.6.18-ppc.config
configs/kernel-2.6.18-ppc64-kdump.config
configs/kernel-2.6.18-ppc64.config
configs/kernel-2.6.18-ppc64iseries.config
configs/kernel-2.6.18-s390.config
configs/kernel-2.6.18-s390x.config
configs/kernel-2.6.18-x86_64-kdump.config
configs/kernel-2.6.18-x86_64-xen.config
configs/kernel-2.6.18-x86_64-xen0.config
configs/kernel-2.6.18-x86_64-xenU.config
configs/kernel-2.6.18-x86_64.config
crypto/mpi/mpi-div.c
crypto/signature/key.h
crypto/signature/ksign-keyring.c
crypto/signature/ksign-parse.c
crypto/signature/ksign-publickey.c
crypto/signature/ksign.c
drivers/block/aoe/aoe.h
drivers/block/aoe/aoeblk.c
drivers/block/aoe/aoecmd.c
drivers/block/aoe/aoedev.c
drivers/block/aoe/aoemain.c
drivers/block/vroot.c
drivers/char/drm/drm_agpsupport.c
drivers/char/drm/drm_auth.c
drivers/char/drm/drm_bufs.c
drivers/char/drm/drm_dma.c
drivers/char/drm/drm_drawable.c
drivers/char/drm/drm_drv.c
drivers/char/drm/drm_fops.c
drivers/char/drm/drm_ioctl.c
drivers/char/drm/drm_lock.c
drivers/char/drm/drm_pci.c
drivers/char/drm/drm_pciids.h
drivers/char/drm/drm_proc.c
drivers/char/drm/drm_stub.c
drivers/char/drm/drm_vm.c
drivers/char/tpm/Kconfig
drivers/char/tpm/Makefile
drivers/char/tpm/tpm.h
drivers/crypto/Kconfig
drivers/crypto/padlock.h
drivers/i2c/algos/i2c-algo-sgi.c
drivers/i2c/busses/i2c-au1550.c
drivers/i2c/busses/i2c-ixp4xx.c
drivers/i2c/busses/i2c-mv64xxx.c
drivers/i2c/busses/i2c-sibyte.c
drivers/i2c/chips/ds1337.c
drivers/infiniband/core/agent.c
drivers/infiniband/core/device.c
drivers/infiniband/core/smi.c
drivers/infiniband/core/smi.h
drivers/infiniband/core/sysfs.c
drivers/infiniband/hw/mthca/Kconfig
drivers/infiniband/hw/mthca/Makefile
drivers/infiniband/hw/mthca/mthca_cmd.h
drivers/infiniband/hw/mthca/mthca_dev.h
drivers/infiniband/hw/mthca/mthca_mcg.c
drivers/infiniband/hw/mthca/mthca_memfree.c
drivers/infiniband/hw/mthca/mthca_memfree.h
drivers/infiniband/hw/mthca/mthca_mr.c
drivers/infiniband/hw/mthca/mthca_pd.c
drivers/infiniband/hw/mthca/mthca_profile.c
drivers/infiniband/hw/mthca/mthca_uar.c
drivers/infiniband/ulp/ipoib/ipoib_vlan.c
drivers/input/keyboard/hil_kbd.c
drivers/input/misc/hp_sdc_rtc.c
drivers/input/mouse/alps.h
drivers/input/mouse/hil_ptr.c
drivers/input/serio/hil_mlc.c
drivers/input/serio/hp_sdc.c
drivers/input/serio/hp_sdc_mlc.c
drivers/input/serio/i8042-x86ia64io.h
drivers/input/touchscreen/elo.c
drivers/input/touchscreen/mk712.c
drivers/isdn/hisax/hfc_usb.h
drivers/md/dm-hw-handler.c
drivers/md/dm-io.c
drivers/md/dm-path-selector.c
drivers/md/dm-snap.h
drivers/media/dvb/b2c2/flexcop-i2c.c
drivers/media/video/ovcamchip/Makefile
drivers/media/video/ovcamchip/ovcamchip_core.c
drivers/media/video/ovcamchip/ovcamchip_priv.h
drivers/media/video/tda8290.c
drivers/mtd/maps/ixp4xx.c
drivers/mtd/maps/sharpsl-flash.c
drivers/net/ne-h8300.c
drivers/net/sk98lin/skethtool.c
drivers/pci/pcie/portdrv.h
drivers/pci/pcie/portdrv_core.c
drivers/pcmcia/pxa2xx_sharpsl.c
drivers/pcmcia/socket_sysfs.c
drivers/s390/net/claw.h
drivers/s390/net/qeth_eddp.h
drivers/scsi/3w-9xxx.h
drivers/scsi/ipr.h
drivers/scsi/qlogicfas408.c
drivers/scsi/qlogicfas408.h
drivers/scsi/sata_promise.h
drivers/serial/jsm/jsm.h
drivers/serial/jsm/jsm_neo.c
drivers/sn/Makefile
drivers/usb/atm/Kconfig
drivers/usb/atm/speedtch.c
drivers/video/au1100fb.h
drivers/video/backlight/backlight.c
drivers/video/backlight/corgi_bl.c
drivers/video/backlight/lcd.c
drivers/video/geode/Kconfig
drivers/video/geode/Makefile
drivers/video/nvidia/nv_accel.c
drivers/video/nvidia/nv_local.h
drivers/video/pxafb.h
drivers/video/w100fb.c
drivers/video/w100fb.h
drivers/xen/Kconfig
drivers/xen/blkback/xenbus.c
drivers/xen/blktap/common.h
drivers/xen/blktap/interface.c
drivers/xen/blktap/xenbus.c
drivers/xen/char/mem.c
drivers/xen/console/xencons_ring.c
drivers/xen/core/cpu_hotplug.c
drivers/xen/core/evtchn.c
drivers/xen/core/gnttab.c
drivers/xen/core/hypervisor_sysfs.c
drivers/xen/core/reboot.c
drivers/xen/core/skbuff.c
drivers/xen/core/smpboot.c
drivers/xen/core/xen_proc.c
drivers/xen/core/xen_sysfs.c
drivers/xen/netback/loopback.c
drivers/xen/netback/xenbus.c
drivers/xen/pciback/xenbus.c
drivers/xen/pcifront/pci_op.c
drivers/xen/pcifront/xenbus.c
drivers/xen/tpmback/common.h
drivers/xen/tpmback/interface.c
drivers/xen/tpmback/tpmback.c
drivers/xen/tpmback/xenbus.c
drivers/xen/util.c
drivers/xen/xenbus/xenbus_backend_client.c
drivers/xen/xenbus/xenbus_client.c
drivers/xen/xenbus/xenbus_comms.c
drivers/xen/xenbus/xenbus_comms.h
drivers/xen/xenbus/xenbus_dev.c
drivers/xen/xenbus/xenbus_probe.c
drivers/xen/xenbus/xenbus_xs.c
fs/cifs/sess.c
fs/fat/fatent.c
fs/nfs/super.c
fs/ntfs/index.c
fs/ntfs/quota.c
fs/proc/nommu.c
fs/reiserfs/xattr_acl.c
fs/squashfs/squashfs.h
fs/squashfs/squashfs2_0.c
fs/xfs/linux-2.6/kmem.c
fs/xfs/linux-2.6/sv.h
fs/xfs/linux-2.6/xfs_export.h
fs/xfs/linux-2.6/xfs_iops.h
include/asm-arm/arch-cl7500/debug-macro.S
include/asm-arm/arch-clps711x/entry-macro.S
include/asm-arm/arch-ebsa110/debug-macro.S
include/asm-arm/arch-ebsa285/debug-macro.S
include/asm-arm/arch-ebsa285/entry-macro.S
include/asm-arm/arch-imx/debug-macro.S
include/asm-arm/arch-integrator/debug-macro.S
include/asm-arm/arch-iop3xx/debug-macro.S
include/asm-arm/arch-iop3xx/entry-macro.S
include/asm-arm/arch-ixp2000/debug-macro.S
include/asm-arm/arch-ixp4xx/debug-macro.S
include/asm-arm/arch-ixp4xx/memory.h
include/asm-arm/arch-ixp4xx/platform.h
include/asm-arm/arch-ixp4xx/uncompress.h
include/asm-arm/arch-omap/aic23.h
include/asm-arm/arch-pxa/audio.h
include/asm-arm/arch-pxa/debug-macro.S
include/asm-arm/arch-pxa/pxafb.h
include/asm-arm/arch-rpc/debug-macro.S
include/asm-arm/arch-sa1100/debug-macro.S
include/asm-arm/arch-versatile/debug-macro.S
include/asm-arm/vfpmacros.h
include/asm-frv/cacheflush.h
include/asm-frv/dma-mapping.h
include/asm-frv/poll.h
include/asm-generic/4level-fixup.h
include/asm-i386/crash.h
include/asm-i386/mach-xen/asm/desc.h
include/asm-i386/mach-xen/asm/dma-mapping.h
include/asm-i386/mach-xen/asm/fixmap.h
include/asm-i386/mach-xen/asm/floppy.h
include/asm-i386/mach-xen/asm/highmem.h
include/asm-i386/mach-xen/asm/hw_irq.h
include/asm-i386/mach-xen/asm/hypercall.h
include/asm-i386/mach-xen/asm/hypervisor.h
include/asm-i386/mach-xen/asm/io.h
include/asm-i386/mach-xen/asm/kmap_types.h
include/asm-i386/mach-xen/asm/mmu.h
include/asm-i386/mach-xen/asm/mmu_context.h
include/asm-i386/mach-xen/asm/page.h
include/asm-i386/mach-xen/asm/param.h
include/asm-i386/mach-xen/asm/pci.h
include/asm-i386/mach-xen/asm/pgalloc.h
include/asm-i386/mach-xen/asm/pgtable-2level.h
include/asm-i386/mach-xen/asm/pgtable-3level.h
include/asm-i386/mach-xen/asm/pgtable.h
include/asm-i386/mach-xen/asm/processor.h
include/asm-i386/mach-xen/asm/setup.h
include/asm-i386/mach-xen/asm/smp.h
include/asm-i386/mach-xen/asm/spinlock.h
include/asm-i386/mach-xen/asm/swiotlb.h
include/asm-i386/mach-xen/asm/synch_bitops.h
include/asm-i386/mach-xen/asm/system.h
include/asm-i386/mach-xen/asm/tlbflush.h
include/asm-i386/mach-xen/asm/vga.h
include/asm-ia64/crash.h
include/asm-ia64/hypervisor.h
include/asm-ia64/sn/l1.h
include/asm-ia64/sn/pcidev.h
include/asm-mips/marvell.h
include/asm-ppc/mpc52xx.h
include/asm-ppc/ppc_sys.h
include/asm-sh64/bitops.h
include/asm-sh64/pgalloc.h
include/asm-sh64/platform.h
include/asm-sh64/poll.h
include/asm-sh64/serial.h
include/asm-um/pgtable-2level.h
include/asm-um/pgtable-3level.h
include/asm-um/processor-x86_64.h
include/asm-um/ptrace-x86_64.h
include/asm-x86_64/crash.h
include/asm-x86_64/mach-xen/asm/dma-mapping.h
include/asm-x86_64/mach-xen/asm/fixmap.h
include/asm-x86_64/mach-xen/asm/floppy.h
include/asm-x86_64/mach-xen/asm/hw_irq.h
include/asm-x86_64/mach-xen/asm/hypercall.h
include/asm-x86_64/mach-xen/asm/io.h
include/asm-x86_64/mach-xen/asm/irq.h
include/asm-x86_64/mach-xen/asm/mmu_context.h
include/asm-x86_64/mach-xen/asm/nmi.h
include/asm-x86_64/mach-xen/asm/page.h
include/asm-x86_64/mach-xen/asm/param.h
include/asm-x86_64/mach-xen/asm/pci.h
include/asm-x86_64/mach-xen/asm/pgalloc.h
include/asm-x86_64/mach-xen/asm/pgtable.h
include/asm-x86_64/mach-xen/asm/processor.h
include/asm-x86_64/mach-xen/asm/smp.h
include/asm-x86_64/mach-xen/asm/system.h
include/asm-x86_64/mach-xen/asm/tlbflush.h
include/asm-x86_64/mach-xen/asm/vga.h
include/linux/backlight.h
include/linux/cpuset.h
include/linux/debugfs.h
include/linux/fsl_devices.h
include/linux/hpet.h
include/linux/libps2.h
include/linux/pci-acpi.h
include/linux/reiserfs_acl.h
include/linux/vserver/dlimit_cmd.h
include/linux/vserver/inode_cmd.h
include/linux/vserver/namespace_cmd.h
include/media/tveeprom.h
include/sound/ak4114.h
include/xen/balloon.h
include/xen/cpu_hotplug.h
include/xen/driver_util.h
include/xen/evtchn.h
include/xen/gnttab.h
include/xen/interface/acm.h
include/xen/interface/acm_ops.h
include/xen/interface/arch-powerpc.h
include/xen/interface/arch-x86_32.h
include/xen/interface/arch-x86_64.h
include/xen/interface/dom0_ops.h
include/xen/interface/io/ring.h
include/xen/interface/xen-compat.h
include/xen/interface/xen.h
include/xen/interface/xenoprof.h
include/xen/pcifront.h
include/xen/public/evtchn.h
include/xen/xen_proc.h
include/xen/xenbus.h
include/xen/xencons.h
kernel/module-verify.h
kernel/vserver/history.c
lib/find_next_bit.c
lib/sha1.c
lib/sort.c
mm/internal.h
mm/thrash.c
net/bridge/br_sysfs_br.c
net/ipv4/netfilter/ipt_addrtype.c
scripts/mkmakefile
scripts/mod/sumversion.c
scripts/modsign/mod-extract.c
scripts/modsign/modsign.sh
scripts/package/Makefile
sound/core/control_compat.c
sound/core/hwdep_compat.c
sound/i2c/other/ak4114.c
sound/pci/emu10k1/p16v.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_local.h
sound/pci/ice1712/phase.c

diff --git a/CVS/Entries b/CVS/Entries
deleted file mode 100644 (file)
index d69e3a6..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/COPYING/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/CREDITS/1.5/Fri Jul 30 14:12:43 2004/-ko/
-/MAINTAINERS/1.4/Tue Jul 20 15:32:59 2004/-ko/
-/Makefile/1.10/Mon Aug  9 21:22:34 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/REPORTING-BUGS/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D/Documentation////
-D/arch////
-D/configs////
-D/crypto////
-D/drivers////
-D/fs////
-D/include////
-D/init////
-D/ipc////
-D/kernel////
-D/lib////
-D/mm////
-D/net////
-D/scripts////
-D/security////
-D/sound////
-D/usr////
diff --git a/CVS/Repository b/CVS/Repository
deleted file mode 100644 (file)
index e629504..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6
diff --git a/CVS/Root b/CVS/Root
deleted file mode 100644 (file)
index 3811072..0000000
--- a/CVS/Root
+++ /dev/null
@@ -1 +0,0 @@
-/cvs
diff --git a/Documentation/BK-usage/CVS/Entries b/Documentation/BK-usage/CVS/Entries
deleted file mode 100644 (file)
index d8842f2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bk-kernel-howto.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bk-make-sum/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bksend/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bz64wrap/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cpcset/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cset-to-linus/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/csets-to-patches/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/gcapatch/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/unbz64wrap/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/BK-usage/CVS/Repository b/Documentation/BK-usage/CVS/Repository
deleted file mode 100644 (file)
index eb441c5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/BK-usage
diff --git a/Documentation/BK-usage/CVS/Root b/Documentation/BK-usage/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/CVS/Entries b/Documentation/CVS/Entries
deleted file mode 100644 (file)
index 1a179ed..0000000
+++ /dev/null
@@ -1,140 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/BUG-HUNTING/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/COPYING.modules/1.1.3.1/Wed Jun  2 19:38:09 2004/-ko/
-/Changes/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/CodingStyle/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/DMA-API.txt/1.2/Tue Jul 20 15:32:59 2004/-ko/
-/DMA-mapping.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/IO-mapping.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/IPMI.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/IRQ-affinity.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/MSI-HOWTO.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/README.DAC960/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/README.moxa/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/SAK.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/SubmittingDrivers/1.3/Tue Jul 20 15:32:59 2004/-ko/
-/SubmittingPatches/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/VGA-softcursor.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/basic_profiling.txt/1.2/Tue Jul 20 15:32:59 2004/-ko/
-/binfmt_misc.txt/1.2/Fri Jul 16 15:16:48 2004/-ko/
-/cachetlb.txt/1.3/Tue Jul 20 15:32:59 2004/-ko/
-/cciss.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/cli-sti-removal.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/computone.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/cpqarray.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/debugging-modules.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/devices.txt/1.2/Tue Jul 20 15:32:59 2004/-ko/
-/digiboard.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/digiepca.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/dnotify.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/eisa.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/exception.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/floppy.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/ftape.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/hayes-esp.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/highuid.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/hpet.txt/1.1.3.2/Mon Jul 19 17:08:18 2004/-ko/
-/hw_random.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/ide.txt/1.1.1.2/Mon Jul 12 21:57:17 2004/-ko/
-/initrd.txt/1.2/Wed Jun  2 20:34:35 2004/-ko/
-/io_ordering.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/ioctl-number.txt/1.2/Fri Jul 16 15:16:48 2004/-ko/
-/iostats.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/isapnp.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/java.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/kernel-doc-nano-HOWTO.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/kernel-docs.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/kernel-parameters.txt/1.2/Tue Jul 20 15:32:59 2004/-ko/
-/kobject.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/laptop-mode.txt/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/ldm.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/locks.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/logo.gif/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/logo.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/magic-number.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mandatory.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mca.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/md.txt/1.2/Wed Jun  2 20:34:36 2004/-ko/
-/memory.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mkdev.cciss/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mkdev.ida/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mono.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/moxa-smartio/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mtrr.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/nbd.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/nfsroot.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/nmi_watchdog.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/numastat.txt/1.1.3.1/Wed Jun  2 19:38:09 2004/-ko/
-/oops-tracing.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/paride.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/parport-lowlevel.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/parport.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/pci.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/pm.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/pnp.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/preempt-locking.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/ramdisk.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/riscom8.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/rocket.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/rpc-cache.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/rtc.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sched-coding.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sched-design.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sched-domains.txt/1.1.3.1/Wed Jun  2 19:38:09 2004/-ko/
-/serial-console.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sgi-visws.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/smart-config.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/smp.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sonypi.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/specialix.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/spinlocks.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/stallion.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/svga.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sx.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sysrq.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/tipar.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/unicode.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/voyager.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/xterm-linux.xpm/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/zorro.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-D/BK-usage////
-D/DocBook////
-D/arm////
-D/block////
-D/cdrom////
-D/cpu-freq////
-D/cris////
-D/crypto////
-D/device-mapper////
-D/driver-model////
-D/dvb////
-D/early-userspace////
-D/fb////
-D/filesystems////
-D/firmware_class////
-D/i2c////
-D/i386////
-D/ia64////
-D/input////
-D/isdn////
-D/kbuild////
-D/m68k////
-D/mips////
-D/networking////
-D/parisc////
-D/power////
-D/powerpc////
-D/s390////
-D/scsi////
-D/serial////
-D/sh////
-D/sound////
-D/sparc////
-D/sysctl////
-D/telephony////
-D/uml////
-D/usb////
-D/video4linux////
-D/vm////
-D/watchdog////
-D/x86_64////
diff --git a/Documentation/CVS/Repository b/Documentation/CVS/Repository
deleted file mode 100644 (file)
index db3cefa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation
diff --git a/Documentation/CVS/Root b/Documentation/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/DocBook/CVS/Entries b/Documentation/DocBook/CVS/Entries
deleted file mode 100644 (file)
index 7b8ee79..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/deviceiobook.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/gadget.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/journal-api.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/kernel-api.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/kernel-hacking.tmpl/1.2/Wed Jun  2 20:34:36 2004/-ko/
-/kernel-locking.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/libata.tmpl/1.2/Wed Jun  2 20:34:36 2004/-ko/
-/lsm.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mcabook.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/mousedrivers.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/procfs-guide.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/procfs_example.c/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/scsidrivers.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/sis900.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/tulip-user.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/usb.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/via-audio.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/videobook.tmpl/1.2/Wed Jun  2 20:34:36 2004/-ko/
-/wanbook.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/writing_usb_driver.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/z8530book.tmpl/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-D/man////
diff --git a/Documentation/DocBook/CVS/Repository b/Documentation/DocBook/CVS/Repository
deleted file mode 100644 (file)
index 54ce833..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/DocBook
diff --git a/Documentation/DocBook/CVS/Root b/Documentation/DocBook/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/DocBook/man/CVS/Entries b/Documentation/DocBook/man/CVS/Entries
deleted file mode 100644 (file)
index 1c82599..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-D
diff --git a/Documentation/DocBook/man/CVS/Repository b/Documentation/DocBook/man/CVS/Repository
deleted file mode 100644 (file)
index 4c6083c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/DocBook/man
diff --git a/Documentation/DocBook/man/CVS/Root b/Documentation/DocBook/man/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index ec5a6de..97374aa 100644 (file)
@@ -27,6 +27,8 @@ rm -f $dir/discover
 mknod -m 0200 $dir/discover c $MAJOR 3
 rm -f $dir/interfaces
 mknod -m 0200 $dir/interfaces c $MAJOR 4
+rm -f $dir/revalidate
+mknod -m 0200 $dir/revalidate c $MAJOR 5
 
 export n_partitions
 mkshelf=`echo $0 | sed 's!mkdevs!mkshelf!'`
index ab39d8b..a7ed1dc 100644 (file)
@@ -18,6 +18,7 @@
 SUBSYSTEM="aoe", KERNEL="discover",    NAME="etherd/%k", GROUP="disk", MODE="0220"
 SUBSYSTEM="aoe", KERNEL="err",         NAME="etherd/%k", GROUP="disk", MODE="0440"
 SUBSYSTEM="aoe", KERNEL="interfaces",  NAME="etherd/%k", GROUP="disk", MODE="0220"
+SUBSYSTEM="aoe", KERNEL="revalidate",  NAME="etherd/%k", GROUP="disk", MODE="0220"
 
 # aoe block devices     
 KERNEL="etherd*",       NAME="%k", GROUP="disk"
diff --git a/Documentation/arm/CVS/Entries b/Documentation/arm/CVS/Entries
deleted file mode 100644 (file)
index 52becca..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Booting/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/IXP4xx/1.1.3.1/Wed Jun  2 19:38:17 2004/-ko/
-/Interrupts/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Netwinder/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Porting/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Setup/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/mem_alignment/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/memory.txt/1.1.1.2/Mon Jul 12 21:57:19 2004/-ko/
-D/SA1100////
-D/Sharp-LH////
-D/VFP////
-D/XScale////
-D/empeg////
-D/nwfpe////
diff --git a/Documentation/arm/CVS/Repository b/Documentation/arm/CVS/Repository
deleted file mode 100644 (file)
index 7be8209..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm
diff --git a/Documentation/arm/CVS/Root b/Documentation/arm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/SA1100/CVS/Entries b/Documentation/arm/SA1100/CVS/Entries
deleted file mode 100644 (file)
index 05d4776..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/ADSBitsy/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Assabet/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Brutus/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/CERF/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/FreeBird/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/GraphicsClient/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/GraphicsMaster/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/HUW_WEBPANEL/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Itsy/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/LART/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/PLEB/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Pangolin/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Tifon/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Victor/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Yopy/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/empeg/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/nanoEngine/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/serial_UART/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/arm/SA1100/CVS/Repository b/Documentation/arm/SA1100/CVS/Repository
deleted file mode 100644 (file)
index 2f89b62..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/SA1100
diff --git a/Documentation/arm/SA1100/CVS/Root b/Documentation/arm/SA1100/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/Sharp-LH/CVS/Entries b/Documentation/arm/Sharp-LH/CVS/Entries
deleted file mode 100644 (file)
index 92b34c3..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/CompactFlash/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/IOBarrier/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/KEV7A400/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/LPD7A400/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/LPD7A40X/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/SDRAM/1.1.3.1/Tue Jul 13 17:49:43 2004/-ko/
-/VectoredInterruptController/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/arm/Sharp-LH/CVS/Repository b/Documentation/arm/Sharp-LH/CVS/Repository
deleted file mode 100644 (file)
index 9c8ebaa..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/Sharp-LH
diff --git a/Documentation/arm/Sharp-LH/CVS/Root b/Documentation/arm/Sharp-LH/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/VFP/CVS/Entries b/Documentation/arm/VFP/CVS/Entries
deleted file mode 100644 (file)
index 538ca49..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/release-notes.txt/1.1.3.1/Tue Jul 13 17:49:43 2004/-ko/
-D
diff --git a/Documentation/arm/VFP/CVS/Repository b/Documentation/arm/VFP/CVS/Repository
deleted file mode 100644 (file)
index 23f74e0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/VFP
diff --git a/Documentation/arm/VFP/CVS/Root b/Documentation/arm/VFP/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/XScale/ADIFCC/CVS/Entries b/Documentation/arm/XScale/ADIFCC/CVS/Entries
deleted file mode 100644 (file)
index 1784810..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D
diff --git a/Documentation/arm/XScale/ADIFCC/CVS/Repository b/Documentation/arm/XScale/ADIFCC/CVS/Repository
deleted file mode 100644 (file)
index 0568ae1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/XScale/ADIFCC
diff --git a/Documentation/arm/XScale/ADIFCC/CVS/Root b/Documentation/arm/XScale/ADIFCC/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/XScale/CVS/Entries b/Documentation/arm/XScale/CVS/Entries
deleted file mode 100644 (file)
index 46f84c4..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-D/ADIFCC////
-D/IOP3XX////
diff --git a/Documentation/arm/XScale/CVS/Repository b/Documentation/arm/XScale/CVS/Repository
deleted file mode 100644 (file)
index 2514d29..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/XScale
diff --git a/Documentation/arm/XScale/CVS/Root b/Documentation/arm/XScale/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/XScale/IOP3XX/CVS/Entries b/Documentation/arm/XScale/IOP3XX/CVS/Entries
deleted file mode 100644 (file)
index 1784810..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D
diff --git a/Documentation/arm/XScale/IOP3XX/CVS/Repository b/Documentation/arm/XScale/IOP3XX/CVS/Repository
deleted file mode 100644 (file)
index 66ae628..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/XScale/IOP3XX
diff --git a/Documentation/arm/XScale/IOP3XX/CVS/Root b/Documentation/arm/XScale/IOP3XX/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/empeg/CVS/Entries b/Documentation/arm/empeg/CVS/Entries
deleted file mode 100644 (file)
index 4831d61..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ir.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/mkdevs/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/arm/empeg/CVS/Repository b/Documentation/arm/empeg/CVS/Repository
deleted file mode 100644 (file)
index 97e1d60..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/empeg
diff --git a/Documentation/arm/empeg/CVS/Root b/Documentation/arm/empeg/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/arm/nwfpe/CVS/Entries b/Documentation/arm/nwfpe/CVS/Entries
deleted file mode 100644 (file)
index 3f432dc..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/NOTES/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.FPE/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/TODO/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/arm/nwfpe/CVS/Repository b/Documentation/arm/nwfpe/CVS/Repository
deleted file mode 100644 (file)
index 85c8655..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/arm/nwfpe
diff --git a/Documentation/arm/nwfpe/CVS/Root b/Documentation/arm/nwfpe/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/block/CVS/Entries b/Documentation/block/CVS/Entries
deleted file mode 100644 (file)
index 5149522..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/as-iosched.txt/1.1.3.1/Mon Jul 19 17:08:21 2004/-ko/
-/biodoc.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/deadline-iosched.txt/1.1.3.1/Mon Jul 19 17:08:21 2004/-ko/
-/request.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/block/CVS/Repository b/Documentation/block/CVS/Repository
deleted file mode 100644 (file)
index 941980c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/block
diff --git a/Documentation/block/CVS/Root b/Documentation/block/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/cdrom/CVS/Entries b/Documentation/cdrom/CVS/Entries
deleted file mode 100644 (file)
index 3feca06..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/aztcd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cdrom-standard.tex/1.2/Wed Jun  2 20:34:37 2004/-ko/
-/cdu31a/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cm206/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/gscd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ide-cd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/isp16/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/mcd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/mcdx/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/optcd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sbpcd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sjcd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sonycd535/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/cdrom/CVS/Repository b/Documentation/cdrom/CVS/Repository
deleted file mode 100644 (file)
index 802c577..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/cdrom
diff --git a/Documentation/cdrom/CVS/Root b/Documentation/cdrom/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/cpu-freq/CVS/Entries b/Documentation/cpu-freq/CVS/Entries
deleted file mode 100644 (file)
index 906440b..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/amd-powernow.txt/1.1.1.1/Mon Jul 12 21:57:20 2004/-ko/
-/core.txt/1.2/Wed Jun  2 20:34:37 2004/-ko/
-/cpu-drivers.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/governors.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/index.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/user-guide.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/cpu-freq/CVS/Repository b/Documentation/cpu-freq/CVS/Repository
deleted file mode 100644 (file)
index 6d285e3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/cpu-freq
diff --git a/Documentation/cpu-freq/CVS/Root b/Documentation/cpu-freq/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index e2d1e76..6a82948 100644 (file)
@@ -36,7 +36,7 @@ cpufreq stats provides following statistics (explained in detail below).
 
 All the statistics will be from the time the stats driver has been inserted 
 to the time when a read of a particular statistic is done. Obviously, stats 
-driver will not have any information about the the frequcny transitions before
+driver will not have any information about the frequency transitions before
 the stats driver insertion.
 
 --------------------------------------------------------------------------------
diff --git a/Documentation/cris/CVS/Entries b/Documentation/cris/CVS/Entries
deleted file mode 100644 (file)
index 8a9997b..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/README/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/cris/CVS/Repository b/Documentation/cris/CVS/Repository
deleted file mode 100644 (file)
index 26e1635..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/cris
diff --git a/Documentation/cris/CVS/Root b/Documentation/cris/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/crypto/CVS/Entries b/Documentation/crypto/CVS/Entries
deleted file mode 100644 (file)
index fea341d..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/api-intro.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/descore-readme.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/crypto/CVS/Repository b/Documentation/crypto/CVS/Repository
deleted file mode 100644 (file)
index 858e4ad..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/crypto
diff --git a/Documentation/crypto/CVS/Root b/Documentation/crypto/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/device-mapper/CVS/Entries b/Documentation/device-mapper/CVS/Entries
deleted file mode 100644 (file)
index 16cda14..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/dm-io.txt/1.1.3.1/Tue Jul 13 17:49:45 2004/-ko/
-/kcopyd.txt/1.1.3.1/Tue Jul 13 17:49:45 2004/-ko/
-/linear.txt/1.1.3.1/Tue Jul 13 17:49:45 2004/-ko/
-/striped.txt/1.1.3.1/Tue Jul 13 17:49:45 2004/-ko/
-/zero.txt/1.1.3.1/Tue Jul 13 17:49:45 2004/-ko/
-D
diff --git a/Documentation/device-mapper/CVS/Repository b/Documentation/device-mapper/CVS/Repository
deleted file mode 100644 (file)
index 8ff8237..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/device-mapper
diff --git a/Documentation/device-mapper/CVS/Root b/Documentation/device-mapper/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/driver-model/CVS/Entries b/Documentation/driver-model/CVS/Entries
deleted file mode 100644 (file)
index f08fa0b..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/binding.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bus.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/class.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/device.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/driver.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/interface.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/overview.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/platform.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/porting.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/driver-model/CVS/Repository b/Documentation/driver-model/CVS/Repository
deleted file mode 100644 (file)
index d45683a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/driver-model
diff --git a/Documentation/driver-model/CVS/Root b/Documentation/driver-model/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/dvb/CVS/Entries b/Documentation/dvb/CVS/Entries
deleted file mode 100644 (file)
index 0aca675..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/avermedia.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bt8xx.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cards.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/contributors.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/faq.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/firmware.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/readme.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ttusb-dec.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/dvb/CVS/Repository b/Documentation/dvb/CVS/Repository
deleted file mode 100644 (file)
index 0acef5e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/dvb
diff --git a/Documentation/dvb/CVS/Root b/Documentation/dvb/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 62e0701..95f0e73 100644 (file)
@@ -23,7 +23,6 @@ This application requires the following to function properly as of now.
          eg: $ szap -c channels.conf -r "TMC" -x
 
        (b) a channels.conf containing a valid PMT PID
-
          eg: TMC:11996:h:0:27500:278:512:650:321
 
          here 278 is a valid PMT PID. the rest of the values are the
@@ -31,13 +30,7 @@ This application requires the following to function properly as of now.
 
        (c) after running a szap, you have to run ca_zap, for the
          descrambler to function,
-
-         eg: $ ca_zap patched_channels.conf "TMC"
-
-         The patched means a patch to apply to scan, such that scan can
-         generate a channels.conf_with pmt, which has this PMT PID info
-         (NOTE: szap cannot use this channels.conf with the PMT_PID)
-
+         eg: $ ca_zap channels.conf "TMC"
 
        (d) Hopeflly Enjoy your favourite subscribed channel as you do with
          a FTA card.
diff --git a/Documentation/early-userspace/CVS/Entries b/Documentation/early-userspace/CVS/Entries
deleted file mode 100644 (file)
index 3f8762a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/README/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/buffer-format.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/early-userspace/CVS/Repository b/Documentation/early-userspace/CVS/Repository
deleted file mode 100644 (file)
index a308489..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/early-userspace
diff --git a/Documentation/early-userspace/CVS/Root b/Documentation/early-userspace/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/fb/CVS/Entries b/Documentation/fb/CVS/Entries
deleted file mode 100644 (file)
index 274dee4..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/aty128fb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cirrusfb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/framebuffer.txt/1.1.1.2/Mon Jul 12 21:57:20 2004/-ko/
-/intel810.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/internals.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/matroxfb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/modedb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/pvr2fb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/pxafb.txt/1.1.3.1/Wed Jun  2 19:38:18 2004/-ko/
-/sa1100fb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sisfb.txt/1.1.3.1/Tue Jul 13 17:49:43 2004/-ko/
-/sstfb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tgafb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tridentfb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/vesafb.txt/1.2/Tue Jun  8 21:22:58 2004/-ko/
-D
diff --git a/Documentation/fb/CVS/Repository b/Documentation/fb/CVS/Repository
deleted file mode 100644 (file)
index 509e31f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/fb
diff --git a/Documentation/fb/CVS/Root b/Documentation/fb/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/filesystems/CVS/Entries b/Documentation/filesystems/CVS/Entries
deleted file mode 100644 (file)
index 5f59386..0000000
+++ /dev/null
@@ -1,36 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Exporting/1.1.1.2/Mon Jul 12 21:57:20 2004/-ko/
-/Locking/1.1.1.2/Mon Jul 12 21:57:20 2004/-ko/
-/adfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/affs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/afs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/automount-support.txt/1.1.3.1/Mon Jul 19 17:08:25 2004/-ko/
-/befs.txt/1.2/Wed Jun  2 20:34:37 2004/-ko/
-/bfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cifs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/coda.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cramfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/directory-locking/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ext2.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ext3.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/hfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/hpfs.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/isofs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/jfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ncpfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ntfs.txt/1.5/Tue Jul 20 15:33:00 2004/-ko/
-/porting/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/proc.txt/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/relayfs.txt/1.1.9.1/Wed Jun 16 18:15:57 2004/-ko/
-/romfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/smbfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sysfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sysv-fs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tmpfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/udf.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ufs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/umsdos.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/vfat.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/vfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/xfs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D/devfs////
diff --git a/Documentation/filesystems/CVS/Repository b/Documentation/filesystems/CVS/Repository
deleted file mode 100644 (file)
index f86b915..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/filesystems
diff --git a/Documentation/filesystems/CVS/Root b/Documentation/filesystems/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/filesystems/devfs/CVS/Entries b/Documentation/filesystems/devfs/CVS/Entries
deleted file mode 100644 (file)
index e019b32..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/ChangeLog/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ToDo/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/boot-options/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/filesystems/devfs/CVS/Repository b/Documentation/filesystems/devfs/CVS/Repository
deleted file mode 100644 (file)
index 1d77cfd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/filesystems/devfs
diff --git a/Documentation/filesystems/devfs/CVS/Root b/Documentation/filesystems/devfs/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/firmware_class/CVS/Entries b/Documentation/firmware_class/CVS/Entries
deleted file mode 100644 (file)
index 03075a8..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/README/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/firmware_sample_driver.c/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/firmware_sample_firmware_class.c/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/hotplug-script/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/firmware_class/CVS/Repository b/Documentation/firmware_class/CVS/Repository
deleted file mode 100644 (file)
index b3a67a3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/firmware_class
diff --git a/Documentation/firmware_class/CVS/Root b/Documentation/firmware_class/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/i2c/CVS/Entries b/Documentation/i2c/CVS/Entries
deleted file mode 100644 (file)
index 9005683..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/dev-interface/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/functionality/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/i2c-old-porting/1.2/Wed Jun  2 20:34:37 2004/-ko/
-/i2c-parport/1.1.3.1/Mon Jul 19 17:08:23 2004/-ko/
-/i2c-protocol/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/porting-clients/1.2/Wed Jun  2 20:34:38 2004/-ko/
-/smbus-protocol/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/summary/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sysfs-interface/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ten-bit-addresses/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/writing-clients/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/i2c/CVS/Repository b/Documentation/i2c/CVS/Repository
deleted file mode 100644 (file)
index e444373..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/i2c
diff --git a/Documentation/i2c/CVS/Root b/Documentation/i2c/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 9f1d008..77b995d 100644 (file)
@@ -12,17 +12,22 @@ meant as a replacement for the older, individual drivers:
                       teletext adapters)
 
 It currently supports the following devices:
- * Philips adapter
- * home brew teletext adapter
- * Velleman K8000 adapter
- * ELV adapter
- * Analog Devices evaluation boards (ADM1025, ADM1030, ADM1031, ADM1032)
+ * (type=0) Philips adapter
+ * (type=1) home brew teletext adapter
+ * (type=2) Velleman K8000 adapter
+ * (type=3) ELV adapter
+ * (type=4) Analog Devices ADM1032 evaluation board
+ * (type=5) Analog Devices evaluation boards: ADM1025, ADM1030, ADM1031
+ * (type=6) Barco LPT->DVI (K5800236) adapter
 
 These devices use different pinout configurations, so you have to tell
 the driver what you have, using the type module parameter. There is no
 way to autodetect the devices. Support for different pinout configurations
 can be easily added when needed.
 
+Earlier kernels defaulted to type=0 (Philips).  But now, if the type
+parameter is missing, the driver will simply fail to initialize.
+
 
 Building your own adapter
 -------------------------
index 702f5ac..1677566 100644 (file)
@@ -4,17 +4,16 @@ Supported adapters:
   * VIA Technologies, Inc. VT82C596A/B
     Datasheet: Sometimes available at the VIA website
 
-  * VIA Technologies, Inc. VT82C686A/B 
+  * VIA Technologies, Inc. VT82C686A/B
     Datasheet: Sometimes available at the VIA website
 
-  * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237
-    Datasheet: available on request from Via
+  * VIA Technologies, Inc. VT8231, VT8233, VT8233A, VT8235, VT8237R
+    Datasheet: available on request from VIA
 
 Authors:
-       Frodo Looijaard <frodol@dds.nl>,  
-       Philip Edelbrock <phil@netroedge.com>, 
-       Kyösti Mälkki <kmalkki@cc.hut.fi>, 
-       Mark D. Studebaker <mdsxyz123@yahoo.com> 
+       Kyösti Mälkki <kmalkki@cc.hut.fi>,
+       Mark D. Studebaker <mdsxyz123@yahoo.com>,
+       Jean Delvare <khali@linux-fr.org>
 
 Module Parameters
 -----------------
@@ -28,20 +27,22 @@ Description
 -----------
 
 i2c-viapro is a true SMBus host driver for motherboards with one of the
-supported VIA southbridges.
+supported VIA south bridges.
 
 Your lspci -n listing must show one of these :
 
- device 1106:3050   (VT82C596 function 3)
- device 1106:3051   (VT82C596 function 3)
+ device 1106:3050   (VT82C596A function 3)
+ device 1106:3051   (VT82C596B function 3)
  device 1106:3057   (VT82C686 function 4)
  device 1106:3074   (VT8233)
  device 1106:3147   (VT8233A)
- device 1106:8235   (VT8231)
- devide 1106:3177   (VT8235)
- devide 1106:3227   (VT8237)
+ device 1106:8235   (VT8231 function 4)
+ device 1106:3177   (VT8235)
+ device 1106:3227   (VT8237R)
 
 If none of these show up, you should look in the BIOS for settings like
 enable ACPI / SMBus or even USB.
 
-
+Except for the oldest chips (VT82C596A/B, VT82C686A and most probably
+VT8231), this driver supports I2C block transactions. Such transactions
+are mainly useful to read from and write to EEPROMs.
diff --git a/Documentation/i386/CVS/Entries b/Documentation/i386/CVS/Entries
deleted file mode 100644 (file)
index e722ac7..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/IO-APIC.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/boot.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/usb-legacy-support.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/zero-page.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/Documentation/i386/CVS/Repository b/Documentation/i386/CVS/Repository
deleted file mode 100644 (file)
index 04c259d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/i386
diff --git a/Documentation/i386/CVS/Root b/Documentation/i386/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/ia64/CVS/Entries b/Documentation/ia64/CVS/Entries
deleted file mode 100644 (file)
index 7ef50ea..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/IRQ-redir.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/efirtc.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/fsys.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/ia64/CVS/Repository b/Documentation/ia64/CVS/Repository
deleted file mode 100644 (file)
index 2994517..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/ia64
diff --git a/Documentation/ia64/CVS/Root b/Documentation/ia64/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/input/CVS/Entries b/Documentation/input/CVS/Entries
deleted file mode 100644 (file)
index 215a413..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/amijoy.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/atarikbd.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cd32.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cs461x.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ff.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/gameport-programming.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/iforce-protocol.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/input-programming.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/input.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/interactive.fig/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/joystick-api.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/joystick-parport.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/joystick.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/shape.fig/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/xpad.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/input/CVS/Repository b/Documentation/input/CVS/Repository
deleted file mode 100644 (file)
index 1800022..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/input
diff --git a/Documentation/input/CVS/Root b/Documentation/input/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/isdn/CVS/Entries b/Documentation/isdn/CVS/Entries
deleted file mode 100644 (file)
index 0f408e1..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/CREDITS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/HiSax.cert/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/INTERFACE/1.2/Wed Jun  2 20:34:38 2004/-ko/
-/INTERFACE.fax/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.FAQ/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.HiSax/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.act2000/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.audio/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.avmb1/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.concap/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.diversion/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.eicon/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.fax/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.hfc-pci/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.hysdn/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.icn/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.pcbit/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.sc/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.syncppp/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.x25/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/syncPPP.FAQ/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/isdn/CVS/Repository b/Documentation/isdn/CVS/Repository
deleted file mode 100644 (file)
index fef5d56..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/isdn
diff --git a/Documentation/isdn/CVS/Root b/Documentation/isdn/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/kbuild/CVS/Entries b/Documentation/kbuild/CVS/Entries
deleted file mode 100644 (file)
index 95f5de9..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/kconfig-language.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/makefiles.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/modules.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/kbuild/CVS/Repository b/Documentation/kbuild/CVS/Repository
deleted file mode 100644 (file)
index 309d652..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/kbuild
diff --git a/Documentation/kbuild/CVS/Root b/Documentation/kbuild/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/m68k/CVS/Entries b/Documentation/m68k/CVS/Entries
deleted file mode 100644 (file)
index 40671b1..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.buddha/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/kernel-options.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/m68k/CVS/Repository b/Documentation/m68k/CVS/Repository
deleted file mode 100644 (file)
index 04bf8de..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/m68k
diff --git a/Documentation/m68k/CVS/Root b/Documentation/m68k/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/mips/CVS/Entries b/Documentation/mips/CVS/Entries
deleted file mode 100644 (file)
index 93e0a53..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/GT64120.README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/time.README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D/pci////
diff --git a/Documentation/mips/CVS/Repository b/Documentation/mips/CVS/Repository
deleted file mode 100644 (file)
index e978b45..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/mips
diff --git a/Documentation/mips/CVS/Root b/Documentation/mips/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/mips/pci/CVS/Entries b/Documentation/mips/pci/CVS/Entries
deleted file mode 100644 (file)
index 5b6c533..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/pci.README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/mips/pci/CVS/Repository b/Documentation/mips/pci/CVS/Repository
deleted file mode 100644 (file)
index 5cd41e0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/mips/pci
diff --git a/Documentation/mips/pci/CVS/Root b/Documentation/mips/pci/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/networking/CVS/Entries b/Documentation/networking/CVS/Entries
deleted file mode 100644 (file)
index ee9333d..0000000
+++ /dev/null
@@ -1,83 +0,0 @@
-/00-INDEX/1.2/Fri Jul 16 15:16:48 2004/-ko/
-/3c359.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/3c505.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/3c509.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/6pack.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Configurable/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/DLINK.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/NAPI_HOWTO.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/PLIP.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.sb1000/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/TODO/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/alias.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/arcnet-hardware.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/arcnet.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/atm.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ax25.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/baycom.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bonding.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bridge.txt/1.2/Wed Jun  2 20:34:38 2004/-ko/
-/comx.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cops.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cs89x0.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/de4x5.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/decnet.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/depca.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/dgrs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/dl2k.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/dmfe.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/driver.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/e100.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/e1000.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/eql.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ethertap.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ewrk3.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/filter.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/fore200e.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/framerelay.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/generic-hdlc.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ifenslave.c/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ip-sysctl.txt/1.3/Fri Jul 16 15:16:48 2004/-ko/
-/ip_dynaddr.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ipddp.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/iphase.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/irda.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ixgb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/lapb-module.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ltpc.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/multicast.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ncsa-telnet/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/net-modules.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/netconsole.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/netdevices.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/netif-msg.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/olympic.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/packet_mmap.txt/1.1.1.2/Mon Jul 12 21:57:19 2004/-ko/
-/pktgen.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/policy-routing.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ppp_generic.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/pt.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ray_cs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/routing.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/s2io.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sctp.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/shaper.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sis900.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sk98lin.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/skfp.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/slicecom.hun/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/slicecom.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/smc9.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/smctr.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tcp.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tlan.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tms380tr.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tuntap.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/vortex.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/wan-router.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/wanpipe.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/wavelan.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/x25-iface.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/x25.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/z8530drv.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/networking/CVS/Repository b/Documentation/networking/CVS/Repository
deleted file mode 100644 (file)
index 57a1791..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/networking
diff --git a/Documentation/networking/CVS/Root b/Documentation/networking/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 93bba8b..f3fcaa4 100644 (file)
 
-Intel PRO/Wireless 2100 802.11b Driver for Linux
-README.ipw2100
+Intel(R) PRO/Wireless 2100 Driver for Linux in support of:
 
-October 13, 2004
+Intel(R) PRO/Wireless 2100 Network Connection
 
+Copyright (C) 2003-2006, Intel Corporation
 
-Release 0.56 Current Features
------------- -----   -----       ----       ---       --         -     
+README.ipw2100
 
-- IBSS and BSS modes
-- 802.11 fragmentation
+Version: git-1.1.5
+Date   : January 25, 2006
+
+Index
+-----------------------------------------------
+0. IMPORTANT INFORMATION BEFORE USING THIS DRIVER
+1. Introduction
+2. Release git-1.1.5 Current Features
+3. Command Line Parameters
+4. Sysfs Helper Files
+5. Radio Kill Switch
+6. Dynamic Firmware
+7. Power Management
+8. Support
+9. License
+
+
+0.   IMPORTANT INFORMATION BEFORE USING THIS DRIVER
+-----------------------------------------------
+
+Important Notice FOR ALL USERS OR DISTRIBUTORS!!!!
+
+Intel wireless LAN adapters are engineered, manufactured, tested, and
+quality checked to ensure that they meet all necessary local and
+governmental regulatory agency requirements for the regions that they
+are designated and/or marked to ship into. Since wireless LANs are
+generally unlicensed devices that share spectrum with radars,
+satellites, and other licensed and unlicensed devices, it is sometimes
+necessary to dynamically detect, avoid, and limit usage to avoid
+interference with these devices. In many instances Intel is required to
+provide test data to prove regional and local compliance to regional and
+governmental regulations before certification or approval to use the
+product is granted. Intel's wireless LAN's EEPROM, firmware, and
+software driver are designed to carefully control parameters that affect
+radio operation and to ensure electromagnetic compliance (EMC). These
+parameters include, without limitation, RF power, spectrum usage,
+channel scanning, and human exposure.
+
+For these reasons Intel cannot permit any manipulation by third parties
+of the software provided in binary format with the wireless WLAN
+adapters (e.g., the EEPROM and firmware). Furthermore, if you use any
+patches, utilities, or code with the Intel wireless LAN adapters that
+have been manipulated by an unauthorized party (i.e., patches,
+utilities, or code (including open source code modifications) which have
+not been validated by Intel), (i) you will be solely responsible for
+ensuring the regulatory compliance of the products, (ii) Intel will bear
+no liability, under any theory of liability for any issues associated
+with the modified products, including without limitation, claims under
+the warranty and/or issues arising from regulatory non-compliance, and
+(iii) Intel will not provide or be required to assist in providing
+support to any third parties for such modified products.
+
+Note: Many regulatory agencies consider Wireless LAN adapters to be
+modules, and accordingly, condition system-level regulatory approval
+upon receipt and review of test data documenting that the antennas and
+system configuration do not cause the EMC and radio operation to be
+non-compliant.
+
+The drivers available for download from SourceForge are provided as a
+part of a development project.  Conformance to local regulatory
+requirements is the responsibility of the individual developer.  As
+such, if you are interested in deploying or shipping a driver as part of
+solution intended to be used for purposes other than development, please
+obtain a tested driver from Intel Customer Support at:
+
+http://support.intel.com/support/notebook/sb/CS-006408.htm
+
+
+1. Introduction
+-----------------------------------------------
+
+This document provides a brief overview of the features supported by the 
+IPW2100 driver project.  The main project website, where the latest 
+development version of the driver can be found, is:
+
+       http://ipw2100.sourceforge.net
+
+There you can find the not only the latest releases, but also information about
+potential fixes and patches, as well as links to the development mailing list
+for the driver project.
+
+
+2. Release git-1.1.5 Current Supported Features
+-----------------------------------------------
+- Managed (BSS) and Ad-Hoc (IBSS)
 - WEP (shared key and open)
-- wireless extension support 
-- 802.1x EAP via xsupplicant
+- Wireless Tools support 
+- 802.1x (tested with XSupplicant 1.0.1)
+
+Enabled (but not supported) features:
 - Monitor/RFMon mode
-- transmit power control
-- long/short preamble support
-- power states support (ACPI)
+- WPA/WPA2
 
-TODO
------------- -----   -----       ----       ---       --         -     
-- Fix bugs...  The biggies:
-  C3 corruption
-  Fragmentation
+The distinction between officially supported and enabled is a reflection
+on the amount of validation and interoperability testing that has been
+performed on a given feature.
 
 
-Command Line Parameters
------------- -----   -----       ----       ---       --         -     
+3. Command Line Parameters
+-----------------------------------------------
 
 If the driver is built as a module, the following optional parameters are used
 by entering them on the command line with the modprobe command using this
@@ -34,54 +114,80 @@ syntax:
 
        modprobe ipw2100 [<option>=<VAL1><,VAL2>...]
 
-For example, to set the interface name for driver, entering:
-
-       modprobe ipw2100 if_name=wlan%d
+For example, to disable the radio on driver loading, enter:
 
-results in the ipw2100 driver defaulting to the wlan prefix, with the system
-assigning a unique number in place of %d.  The default interface name is eth%d.
+       modprobe ipw2100 disable=1
 
 The ipw2100 driver supports the following module parameters:
 
 Name           Value           Example:
 debug          0x0-0xffffffff  debug=1024
-if_name                string          if_name=wlan%d
 mode           0,1,2           mode=1   /* AdHoc */
 channel                int             channel=3 /* Only valid in AdHoc or Monitor */
 associate      boolean         associate=0 /* Do NOT auto associate */
 disable                boolean         disable=1 /* Do not power the HW */
 
 
-Radio Kill Switch
------------- -----   -----       ----       ---       --         -
-Most laptops provide the ability for the user to physically disable the radio.
-Some vendors have implemented this as a physical switch that requires no
-software to turn the radio off and on.  On other laptops, however, the switch
-is controlled through a button being pressed and a software driver then making
-calls to turn the radio off and on.  This is referred to as a "software based
-RF kill switch"
+4. Sysfs Helper Files
+---------------------------     
+-----------------------------------------------
+
+There are several ways to control the behavior of the driver.  Many of the 
+general capabilities are exposed through the Wireless Tools (iwconfig).  There
+are a few capabilities that are exposed through entries in the Linux Sysfs.
 
-To determine if you have such a switch, you can check the contents of:
 
-       /sys/bus/pci/drivers/ipw2100/*/rf_kill
+----- Driver Level ------
+For the driver level files, look in /sys/bus/pci/drivers/ipw2100/
+
+  debug_level  
+       
+       This controls the same global as the 'debug' module parameter.  For 
+        information on the various debugging levels available, run the 'dvals'
+       script found in the driver source directory.
+
+       NOTE:  'debug_level' is only enabled if CONFIG_IPW2100_DEBUG is turn
+              on.
 
-A value of:
+----- Device Level ------
+For the device level files look in
        
-       Radio is {en,dis}abled by RF switch
+       /sys/bus/pci/drivers/ipw2100/{PCI-ID}/
 
-means that you have an RF switch and the radio is in the state 
-described.
+For example:
+       /sys/bus/pci/drivers/ipw2100/0000:02:01.0
 
-A value of:
+For the device level files, see /sys/bus/pci/drivers/ipw2100:
 
-       Your hardware does not have an RF switch
+  rf_kill
+       read - 
+       0 = RF kill not enabled (radio on)
+       1 = SW based RF kill active (radio off)
+       2 = HW based RF kill active (radio off)
+       3 = Both HW and SW RF kill active (radio off)
+       write -
+       0 = If SW based RF kill active, turn the radio back on
+       1 = If radio is on, activate SW based RF kill
 
-is self explanatory.  In this case you should not need to worry about 
-enabling the radio.
+       NOTE: If you enable the SW based RF kill and then toggle the HW
+       based RF kill from ON -> OFF -> ON, the radio will NOT come back on
 
 
-Dynamic Firmware
------------- -----   -----       ----       ---       --         -     
+5. Radio Kill Switch
+-----------------------------------------------
+Most laptops provide the ability for the user to physically disable the radio.
+Some vendors have implemented this as a physical switch that requires no
+software to turn the radio off and on.  On other laptops, however, the switch
+is controlled through a button being pressed and a software driver then making
+calls to turn the radio off and on.  This is referred to as a "software based
+RF kill switch"
+
+See the Sysfs helper file 'rf_kill' for determining the state of the RF switch
+on your system.
+
+
+6. Dynamic Firmware
+-----------------------------------------------
 As the firmware is licensed under a restricted use license, it can not be 
 included within the kernel sources.  To enable the IPW2100 you will need a 
 firmware image to load into the wireless NIC's processors.
@@ -91,8 +197,8 @@ You can obtain these images from <http://ipw2100.sf.net/firmware.php>.
 See INSTALL for instructions on installing the firmware.
 
 
-Power Management
------------- -----   -----       ----       ---       --         -     
+7. Power Management
+-----------------------------------------------
 The IPW2100 supports the configuration of the Power Save Protocol 
 through a private wireless extension interface.  The IPW2100 supports 
 the following different modes:
@@ -144,22 +250,31 @@ xxxx/yyyy will be replaced with 'off' -- the level reported will be the active
 level if `iwconfig eth1 power on` is invoked.
 
 
-Support
------------- -----   -----       ----       ---       --         -     
+8. Support
+-----------------------------------------------
 
-For general information and support, go to:
+For general development information and support,
+go to:
        
     http://ipw2100.sf.net/
 
-License
------------- -----   -----       ----       ---       --         -     
+The ipw2100 1.1.0 driver and firmware can be downloaded from:  
+
+    http://support.intel.com
+
+For installation support on the ipw2100 1.1.0 driver on Linux kernels 
+2.6.8 or greater, email support is available from:  
+
+    http://supportmail.intel.com
+
+9. License
+-----------------------------------------------
 
-  Copyright(c) 2003 - 2004 Intel Corporation. All rights reserved.
+  Copyright(c) 2003 - 2006 Intel Corporation. All rights reserved.
 
   This program is free software; you can redistribute it and/or modify it 
-  under the terms of the GNU General Public License as published by the Free 
-  Software Foundation; either version 2 of the License, or (at your option) 
-  any later version.
+  under the terms of the GNU General Public License (version 2) as 
+  published by the Free Software Foundation.
   
   This program is distributed in the hope that it will be useful, but WITHOUT 
   ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 
@@ -173,7 +288,7 @@ License
   The full GNU General Public License is included in this distribution in the
   file called LICENSE.
   
-  Contact Information:
+  License Contact Information:
   James P. Ketrenos <ipw2100-admin@linux.intel.com>
   Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
 
diff --git a/Documentation/parisc/CVS/Entries b/Documentation/parisc/CVS/Entries
deleted file mode 100644 (file)
index 98844d9..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/debugging/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/registers/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/parisc/CVS/Repository b/Documentation/parisc/CVS/Repository
deleted file mode 100644 (file)
index d5bdd5f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/parisc
diff --git a/Documentation/parisc/CVS/Root b/Documentation/parisc/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/power/CVS/Entries b/Documentation/power/CVS/Entries
deleted file mode 100644 (file)
index fcc1338..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/devices.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/interface.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/pci.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/states.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/swsusp.txt/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/tricks.txt/1.2/Wed Jun  2 20:34:39 2004/-ko/
-/video.txt/1.3/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/Documentation/power/CVS/Repository b/Documentation/power/CVS/Repository
deleted file mode 100644 (file)
index 4ca7fce..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/power
diff --git a/Documentation/power/CVS/Root b/Documentation/power/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/powerpc/CVS/Entries b/Documentation/powerpc/CVS/Entries
deleted file mode 100644 (file)
index bdf5777..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/00-INDEX/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/SBC8260_memory_mapping.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/hvcs.txt/1.1.3.1/Wed Sep 15 03:52:34 2004/-ko/
-/mpc52xx.txt/1.1.3.1/Wed Sep 15 03:52:34 2004/-ko/
-/ppc_htab.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/smp.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sound.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/zImage_layout.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/powerpc/CVS/Repository b/Documentation/powerpc/CVS/Repository
deleted file mode 100644 (file)
index 46f0c04..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/powerpc
diff --git a/Documentation/powerpc/CVS/Root b/Documentation/powerpc/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 2bfe71b..3764dd4 100644 (file)
@@ -115,13 +115,13 @@ Current PPC64 Linux EEH Implementation
 At this time, a generic EEH recovery mechanism has been implemented,
 so that individual device drivers do not need to be modified to support
 EEH recovery.  This generic mechanism piggy-backs on the PCI hotplug
-infrastructure,  and percolates events up through the hotplug/udev
+infrastructure,  and percolates events up through the userspace/udev
 infrastructure.  Followiing is a detailed description of how this is
 accomplished.
 
 EEH must be enabled in the PHB's very early during the boot process,
 and if a PCI slot is hot-plugged. The former is performed by
-eeh_init() in arch/ppc64/kernel/eeh.c, and the later by
+eeh_init() in arch/powerpc/platforms/pseries/eeh.c, and the later by
 drivers/pci/hotplug/pSeries_pci.c calling in to the eeh.c code.
 EEH must be enabled before a PCI scan of the device can proceed.
 Current Power5 hardware will not work unless EEH is enabled;
@@ -133,8 +133,8 @@ error.  Given an arbitrary address, the routine
 pci_get_device_by_addr() will find the pci device associated
 with that address (if any).
 
-The default include/asm-ppc64/io.h macros readb(), inb(), insb(),
-etc. include a check to see if the the i/o read returned all-0xff's.
+The default include/asm-powerpc/io.h macros readb(), inb(), insb(),
+etc. include a check to see if the i/o read returned all-0xff's.
 If so, these make a call to eeh_dn_check_failure(), which in turn
 asks the firmware if the all-ff's value is the sign of a true EEH
 error.  If it is not, processing continues as normal.  The grand
@@ -143,11 +143,12 @@ seen in /proc/ppc64/eeh (subject to change).  Normally, almost
 all of these occur during boot, when the PCI bus is scanned, where
 a large number of 0xff reads are part of the bus scan procedure.
 
-If a frozen slot is detected, code in arch/ppc64/kernel/eeh.c will
-print a stack trace to syslog (/var/log/messages).  This stack trace
-has proven to be very useful to device-driver authors for finding
-out at what point the EEH error was detected, as the error itself
-usually occurs slightly beforehand.
+If a frozen slot is detected, code in 
+arch/powerpc/platforms/pseries/eeh.c will print a stack trace to 
+syslog (/var/log/messages).  This stack trace has proven to be very 
+useful to device-driver authors for finding out at what point the EEH 
+error was detected, as the error itself usually occurs slightly 
+beforehand.
 
 Next, it uses the Linux kernel notifier chain/work queue mechanism to
 allow any interested parties to find out about the failure.  Device
@@ -172,7 +173,7 @@ A handler for the EEH notifier_block events is implemented in
 drivers/pci/hotplug/pSeries_pci.c, called handle_eeh_events().
 It saves the device BAR's and then calls rpaphp_unconfig_pci_adapter().
 This last call causes the device driver for the card to be stopped,
-which causes hotplug events to go out to user space. This triggers
+which causes uevents to go out to user space. This triggers
 user-space scripts that might issue commands such as "ifdown eth0"
 for ethernet cards, and so on.  This handler then sleeps for 5 seconds,
 hoping to give the user-space scripts enough time to complete.
@@ -258,29 +259,30 @@ rpa_php_unconfig_pci_adapter() {             // in rpaphp_pci.c
     calls
     pci_destroy_dev (struct pci_dev *) {
       calls
-      device_unregister (&dev->dev) {      // in /drivers/base/core.c
+      device_unregister (&dev->dev) {        // in /drivers/base/core.c
         calls
-        device_del(struct device * dev) {  // in /drivers/base/core.c
+        device_del(struct device * dev) {    // in /drivers/base/core.c
           calls
-          kobject_del() {                  //in /libs/kobject.c
+          kobject_del() {                    //in /libs/kobject.c
             calls
-            kobject_hotplug() {            // in /libs/kobject.c
+            kobject_uevent() {               // in /libs/kobject.c
               calls
-              kset_hotplug() {             // in /lib/kobject.c
+              kset_uevent() {                // in /lib/kobject.c
                 calls
-                kset->hotplug_ops->hotplug() which is really just
+                kset->uevent_ops->uevent()   // which is really just
                 a call to
-                dev_hotplug() {           // in /drivers/base/core.c
+                dev_uevent() {               // in /drivers/base/core.c
                   calls
-                  dev->bus->hotplug() which is really just a call to
-                  pci_hotplug () {      // in drivers/pci/hotplug.c
+                  dev->bus->uevent() which is really just a call to
+                  pci_uevent () {            // in drivers/pci/hotplug.c
                     which prints device name, etc....
                  }
                }
-               then kset_hotplug() calls
-                call_usermodehelper () with
-                   argv[0]=hotplug_path[] which is "/sbin/hotplug"
-             --> event to userspace,
+               then kobject_uevent() sends a netlink uevent to userspace
+               --> userspace uevent
+               (during early boot, nobody listens to netlink events and
+               kobject_uevent() executes uevent_helper[], which runs the
+               event process /sbin/hotplug)
            }
          }
          kobject_del() then calls sysfs_remove_dir(), which would
index dca75cb..1e38166 100644 (file)
@@ -558,9 +558,9 @@ partitions.
 
 The proper channel for reporting bugs is either through the Linux OS
 distribution company that provided your OS or by posting issues to the
-ppc64 development mailing list at:
+PowerPC development mailing list at:
 
-linuxppc64-dev@lists.linuxppc.org
+linuxppc-dev@ozlabs.org
 
 This request is to provide a documented and searchable public exchange
 of the problems and solutions surrounding this driver for the benefit of
diff --git a/Documentation/s390/CVS/Entries b/Documentation/s390/CVS/Entries
deleted file mode 100644 (file)
index fa8e9e2..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/3270.ChangeLog/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/3270.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/CommonIO/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/DASD/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Debugging390.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/TAPE/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cds.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/config3270.sh/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/driver-model.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/s390dbf.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D/crypto////
diff --git a/Documentation/s390/CVS/Repository b/Documentation/s390/CVS/Repository
deleted file mode 100644 (file)
index a65dd3b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/s390
diff --git a/Documentation/s390/CVS/Root b/Documentation/s390/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/s390/crypto/CVS/Entries b/Documentation/s390/crypto/CVS/Entries
deleted file mode 100644 (file)
index 6ded71e..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/crypto-API.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/s390/crypto/CVS/Repository b/Documentation/s390/crypto/CVS/Repository
deleted file mode 100644 (file)
index 862a63f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/s390/crypto
diff --git a/Documentation/s390/crypto/CVS/Root b/Documentation/s390/crypto/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/scsi/CVS/Entries b/Documentation/scsi/CVS/Entries
deleted file mode 100644 (file)
index 181024f..0000000
+++ /dev/null
@@ -1,39 +0,0 @@
-/00-INDEX/1.2/Wed Jun  2 20:34:39 2004/-ko/
-/53c700.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/BusLogic.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog.ips/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog.megaraid/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog.ncr53c8xx/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog.sym53c8xx/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog.sym53c8xx_2/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/FlashPoint.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/LICENSE.FlashPoint/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Mylex.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/NinjaSCSI.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/aha152x.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/aic79xx.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/aic7xxx.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/aic7xxx_old.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cpqfc.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/dc395x.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/dpti.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/dtc3x80.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/g_NCR5380.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ibmmca.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/in2000.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ncr53c7xx.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ncr53c8xx.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/osst.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ppa.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/qla2xxx.revision.notes/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/qlogicfas.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/qlogicisp.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/scsi-generic.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/scsi.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/scsi_mid_low_api.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/st.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sym53c500_cs.txt/1.1.3.1/Wed Jun  2 19:38:12 2004/-ko/
-/sym53c8xx_2.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/tmscsim.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/scsi/CVS/Repository b/Documentation/scsi/CVS/Repository
deleted file mode 100644 (file)
index 43ba7b3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/scsi
diff --git a/Documentation/scsi/CVS/Root b/Documentation/scsi/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/serial/CVS/Entries b/Documentation/serial/CVS/Entries
deleted file mode 100644 (file)
index e3fca3f..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/driver/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/serial/CVS/Repository b/Documentation/serial/CVS/Repository
deleted file mode 100644 (file)
index fe8fcf5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/serial
diff --git a/Documentation/serial/CVS/Root b/Documentation/serial/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/sh/CVS/Entries b/Documentation/sh/CVS/Entries
deleted file mode 100644 (file)
index cdd1d22..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/kgdb.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/new-machine.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/Documentation/sh/CVS/Repository b/Documentation/sh/CVS/Repository
deleted file mode 100644 (file)
index 8a29c86..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/sh
diff --git a/Documentation/sh/CVS/Root b/Documentation/sh/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/sound/CVS/Entries b/Documentation/sound/CVS/Entries
deleted file mode 100644 (file)
index 6faff42..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-D/alsa////
-D/oss////
diff --git a/Documentation/sound/CVS/Repository b/Documentation/sound/CVS/Repository
deleted file mode 100644 (file)
index da102a8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/sound
diff --git a/Documentation/sound/CVS/Root b/Documentation/sound/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/sound/alsa/CVS/Entries b/Documentation/sound/alsa/CVS/Entries
deleted file mode 100644 (file)
index c0262bc..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/ALSA-Configuration.txt/1.2/Wed Jun  2 20:34:39 2004/-ko/
-/Audigy-mixer.txt/1.1.3.1/Wed Jun  2 19:38:16 2004/-ko/
-/CMIPCI.txt/1.2/Wed Jun  2 20:34:39 2004/-ko/
-/ControlNames.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Joystick.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/MIXART.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/OSS-Emulation.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Procfile.txt/1.2/Wed Jun  2 20:34:39 2004/-ko/
-/SB-Live-mixer.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/seq_oss.html/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/serial-u16550.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D/DocBook////
diff --git a/Documentation/sound/alsa/CVS/Repository b/Documentation/sound/alsa/CVS/Repository
deleted file mode 100644 (file)
index 9c76416..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/sound/alsa
diff --git a/Documentation/sound/alsa/CVS/Root b/Documentation/sound/alsa/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/sound/alsa/DocBook/CVS/Entries b/Documentation/sound/alsa/DocBook/CVS/Entries
deleted file mode 100644 (file)
index 147242b..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/alsa-driver-api.tmpl/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/writing-an-alsa-driver.tmpl/1.2/Wed Jun  2 20:34:39 2004/-ko/
-D
diff --git a/Documentation/sound/alsa/DocBook/CVS/Repository b/Documentation/sound/alsa/DocBook/CVS/Repository
deleted file mode 100644 (file)
index 4e5e4ee..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/sound/alsa/DocBook
diff --git a/Documentation/sound/alsa/DocBook/CVS/Root b/Documentation/sound/alsa/DocBook/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/sound/oss/CVS/Entries b/Documentation/sound/oss/CVS/Entries
deleted file mode 100644 (file)
index c3f87e9..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/AD1816/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ALS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/AWE32/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/AudioExcelDSP16/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/CMI8330/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/CMI8338/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/CS4232/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog.awe/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ChangeLog.multisound/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ESS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ESS1868/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/INSTALL.awe/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Introduction/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/MAD16/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Maestro/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Maestro3/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/MultiSound/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/NEWS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/NM256/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/OPL3/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/OPL3-SA/1.2/Wed Jun  2 20:34:40 2004/-ko/
-/OPL3-SA2/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Opti/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/PAS16/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/PSS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/PSS-updates/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.OSS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.awe/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.modules/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.ymfsb/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/SoundPro/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Soundblaster/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Tropez+/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/VIA-chipset/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/VIBRA16/1.2/Wed Jun  2 20:34:40 2004/-ko/
-/WaveArtist/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Wavefront/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/btaudio/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/cs46xx/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/es1370/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/es1371/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/mwave/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/rme96xx/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/solo1/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sonicvibes/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ultrasound/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/vwsnd/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/sound/oss/CVS/Repository b/Documentation/sound/oss/CVS/Repository
deleted file mode 100644 (file)
index 3f9197b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/sound/oss
diff --git a/Documentation/sound/oss/CVS/Root b/Documentation/sound/oss/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/sparc/CVS/Entries b/Documentation/sparc/CVS/Entries
deleted file mode 100644 (file)
index d5e6d7a..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/README-2.5/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/sbus_drivers.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/sparc/CVS/Repository b/Documentation/sparc/CVS/Repository
deleted file mode 100644 (file)
index d5e35f7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/sparc
diff --git a/Documentation/sparc/CVS/Root b/Documentation/sparc/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/sysctl/CVS/Entries b/Documentation/sysctl/CVS/Entries
deleted file mode 100644 (file)
index d5fa6a3..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/abi.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/fs.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/kernel.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sunrpc.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/vm.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/Documentation/sysctl/CVS/Repository b/Documentation/sysctl/CVS/Repository
deleted file mode 100644 (file)
index a018e38..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/sysctl
diff --git a/Documentation/sysctl/CVS/Root b/Documentation/sysctl/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/telephony/CVS/Entries b/Documentation/telephony/CVS/Entries
deleted file mode 100644 (file)
index 9fdb129..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/ixj.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/telephony/CVS/Repository b/Documentation/telephony/CVS/Repository
deleted file mode 100644 (file)
index b34ea2c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/telephony
diff --git a/Documentation/telephony/CVS/Root b/Documentation/telephony/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/uml/CVS/Entries b/Documentation/uml/CVS/Entries
deleted file mode 100644 (file)
index 5710dfd..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/UserModeLinux-HOWTO.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/uml/CVS/Repository b/Documentation/uml/CVS/Repository
deleted file mode 100644 (file)
index dfceea6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/uml
diff --git a/Documentation/uml/CVS/Root b/Documentation/uml/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/usb/CVS/Entries b/Documentation/usb/CVS/Entries
deleted file mode 100644 (file)
index 6b0f6bc..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/CREDITS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/URB.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/acm.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/auerswald.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/bluetooth.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/dma.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ehci.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/error-codes.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/hiddev.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/hotplug.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ibmcam.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/linux.inf/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/mtouchusb.txt/1.2/Wed Jun  2 20:34:40 2004/-ko/
-/ohci.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ov511.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/philips.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/proc_usb_info.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/rio.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/se401.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/silverlink.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/sn9c102.txt/1.1.3.1/Mon Jul 19 17:08:20 2004/-ko/
-/stv680.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/uhci.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/usb-help.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/usb-serial.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/w9968cf.txt/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/Documentation/usb/CVS/Repository b/Documentation/usb/CVS/Repository
deleted file mode 100644 (file)
index 65069d1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/usb
diff --git a/Documentation/usb/CVS/Root b/Documentation/usb/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/video4linux/CVS/Entries b/Documentation/video4linux/CVS/Entries
deleted file mode 100644 (file)
index 4ba5e95..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/API.html/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/CARDLIST.bttv/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/CARDLIST.saa7134/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/CARDLIST.tuner/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/CQcam.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/README.cpia/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/README.cx88/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/README.ir/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/README.saa7134/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/Zoran/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/meye.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/radiotrack.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/w9966.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-/zr36120.txt/1.1.1.1/Wed Jun  2 19:23:32 2004/-ko/
-D/bttv////
diff --git a/Documentation/video4linux/CVS/Repository b/Documentation/video4linux/CVS/Repository
deleted file mode 100644 (file)
index 3cd2fda..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/video4linux
diff --git a/Documentation/video4linux/CVS/Root b/Documentation/video4linux/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/video4linux/bttv/CVS/Entries b/Documentation/video4linux/bttv/CVS/Entries
deleted file mode 100644 (file)
index b8308e5..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/CONTRIBUTORS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Cards/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/ICs/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Insmod-options/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/MAKEDEV/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Modprobe.conf/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Modules.conf/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/PROBLEMS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.WINVIEW/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.freeze/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/README.quirks/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Sound-FAQ/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Specs/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/THANKS/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/Tuners/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/video4linux/bttv/CVS/Repository b/Documentation/video4linux/bttv/CVS/Repository
deleted file mode 100644 (file)
index 4cf79f0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/video4linux/bttv
diff --git a/Documentation/video4linux/bttv/CVS/Root b/Documentation/video4linux/bttv/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/vm/CVS/Entries b/Documentation/vm/CVS/Entries
deleted file mode 100644 (file)
index 61a0a2a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/balance/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/hugetlbpage.txt/1.2/Fri Jul 30 14:12:43 2004/-ko/
-/locking/1.2/Wed Jun  2 20:34:40 2004/-ko/
-/numa/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/overcommit-accounting/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/vm/CVS/Repository b/Documentation/vm/CVS/Repository
deleted file mode 100644 (file)
index 936520e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/vm
diff --git a/Documentation/vm/CVS/Root b/Documentation/vm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/watchdog/CVS/Entries b/Documentation/watchdog/CVS/Entries
deleted file mode 100644 (file)
index 59c6021..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/pcwd-watchdog.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/watchdog-api.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-/watchdog.txt/1.1.1.1/Wed Jun  2 19:23:33 2004/-ko/
-D
diff --git a/Documentation/watchdog/CVS/Repository b/Documentation/watchdog/CVS/Repository
deleted file mode 100644 (file)
index 43ea6c0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/watchdog
diff --git a/Documentation/watchdog/CVS/Root b/Documentation/watchdog/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/Documentation/x86_64/CVS/Entries b/Documentation/x86_64/CVS/Entries
deleted file mode 100644 (file)
index c3f3877..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/boot-options.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-/mm.txt/1.1.1.1/Wed Jun  2 19:23:34 2004/-ko/
-D
diff --git a/Documentation/x86_64/CVS/Repository b/Documentation/x86_64/CVS/Repository
deleted file mode 100644 (file)
index 89826a3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/Documentation/x86_64
diff --git a/Documentation/x86_64/CVS/Root b/Documentation/x86_64/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/CVS/Entries b/arch/CVS/Entries
deleted file mode 100644 (file)
index 6b2068f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-D/alpha////
-D/arm////
-D/arm26////
-D/cris////
-D/h8300////
-D/i386////
-D/ia64////
-D/m68k////
-D/m68knommu////
-D/mips////
-D/parisc////
-D/ppc////
-D/ppc64////
-D/s390////
-D/sh////
-D/sh64////
-D/sparc////
-D/sparc64////
-D/um////
-D/v850////
-D/x86_64////
diff --git a/arch/CVS/Repository b/arch/CVS/Repository
deleted file mode 100644 (file)
index 4207414..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch
diff --git a/arch/CVS/Root b/arch/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/CVS/Entries b/arch/alpha/CVS/Entries
deleted file mode 100644 (file)
index 45395ed..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Kconfig/1.3/Thu Jun  3 22:32:16 2004/-ko/
-/Makefile/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/defconfig/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D/boot////
-D/kernel////
-D/lib////
-D/math-emu////
-D/mm////
-D/oprofile////
diff --git a/arch/alpha/CVS/Repository b/arch/alpha/CVS/Repository
deleted file mode 100644 (file)
index ec09f66..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha
diff --git a/arch/alpha/CVS/Root b/arch/alpha/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/boot/CVS/Entries b/arch/alpha/boot/CVS/Entries
deleted file mode 100644 (file)
index d624d2a..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/bootloader.lds/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/bootp.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/bootpz.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/main.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/misc.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D/tools////
diff --git a/arch/alpha/boot/CVS/Repository b/arch/alpha/boot/CVS/Repository
deleted file mode 100644 (file)
index a9f2c07..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha/boot
diff --git a/arch/alpha/boot/CVS/Root b/arch/alpha/boot/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/boot/tools/CVS/Entries b/arch/alpha/boot/tools/CVS/Entries
deleted file mode 100644 (file)
index 0288def..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/mkbb.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/objstrip.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/alpha/boot/tools/CVS/Repository b/arch/alpha/boot/tools/CVS/Repository
deleted file mode 100644 (file)
index c1a2466..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha/boot/tools
diff --git a/arch/alpha/boot/tools/CVS/Root b/arch/alpha/boot/tools/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/kernel/CVS/Entries b/arch/alpha/kernel/CVS/Entries
deleted file mode 100644 (file)
index 3f97802..0000000
+++ /dev/null
@@ -1,76 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/alpha_ksyms.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/asm-offsets.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/console.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/core_apecs.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/core_cia.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/core_irongate.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/core_lca.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/core_marvel.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/core_mcpcia.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/core_polaris.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/core_t2.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/core_titan.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/core_tsunami.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/core_wildfire.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/entry.S/1.2/Fri Jul 30 14:12:43 2004/-ko/
-/err_common.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/err_ev6.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/err_ev7.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/err_impl.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/err_marvel.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/err_titan.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/es1888.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/gct.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/init_task.c/1.2/Fri Jul 16 15:16:48 2004/-ko/
-/irq.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/irq_alpha.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/irq_i8259.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/irq_impl.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/irq_pyxis.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/irq_srm.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/machvec_impl.h/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/module.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/ns87312.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/osf_sys.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/pci-noop.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pci.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pci_impl.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pci_iommu.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/process.c/1.4/Fri Jul 30 14:12:43 2004/-ko/
-/proto.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ptrace.c/1.2/Thu Jun  3 22:32:16 2004/-ko/
-/semaphore.c/1.2/Wed Jun  2 20:34:41 2004/-ko/
-/setup.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/signal.c/1.4/Fri Jul 30 14:12:43 2004/-ko/
-/smc37c669.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/smc37c93x.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/smp.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/srm_env.c/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/srmcons.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_alcor.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_cabriolet.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_dp264.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/sys_eb64p.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_eiger.c/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/sys_jensen.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_marvel.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_miata.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_mikasa.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_nautilus.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_noritake.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_rawhide.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_ruffian.c/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/sys_rx164.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_sable.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_sio.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_sx164.c/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/sys_takara.c/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/sys_titan.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sys_wildfire.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/systbls.S/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/time.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/traps.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/vmlinux.lds.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/alpha/kernel/CVS/Repository b/arch/alpha/kernel/CVS/Repository
deleted file mode 100644 (file)
index 1fa1fd4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha/kernel
diff --git a/arch/alpha/kernel/CVS/Root b/arch/alpha/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/lib/CVS/Entries b/arch/alpha/lib/CVS/Entries
deleted file mode 100644 (file)
index ec604bb..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/callback_srm.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/checksum.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/clear_page.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/clear_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/copy_page.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/copy_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/csum_ipv6_magic.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/csum_partial_copy.c/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/dbg_current.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/dbg_stackcheck.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/dbg_stackkill.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/dec_and_lock.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/divide.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-clear_page.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-clear_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-copy_page.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-copy_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-csum_ipv6_magic.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-divide.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-memchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-memcpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-memset.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-strncpy_from_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-stxcpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev6-stxncpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev67-strcat.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev67-strchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev67-strlen.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev67-strlen_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev67-strncat.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ev67-strrchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fpreg.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memcpy.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memmove.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memset.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/srm_printk.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/srm_puts.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/stacktrace.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strcasecmp.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strcat.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strcpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strlen.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strlen_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strncat.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strncpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strncpy_from_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strrchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/stxcpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/stxncpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/udelay.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/alpha/lib/CVS/Repository b/arch/alpha/lib/CVS/Repository
deleted file mode 100644 (file)
index 1374c59..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha/lib
diff --git a/arch/alpha/lib/CVS/Root b/arch/alpha/lib/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/math-emu/CVS/Entries b/arch/alpha/math-emu/CVS/Entries
deleted file mode 100644 (file)
index c33a43e..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/math.c/1.2/Wed Jun  2 20:34:42 2004/-ko/
-/qrnnd.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sfp-util.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/alpha/math-emu/CVS/Repository b/arch/alpha/math-emu/CVS/Repository
deleted file mode 100644 (file)
index ff90b25..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha/math-emu
diff --git a/arch/alpha/math-emu/CVS/Root b/arch/alpha/math-emu/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/mm/CVS/Entries b/arch/alpha/mm/CVS/Entries
deleted file mode 100644 (file)
index ad5d02e..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/extable.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fault.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/init.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/numa.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/remap.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/alpha/mm/CVS/Repository b/arch/alpha/mm/CVS/Repository
deleted file mode 100644 (file)
index c20a00b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha/mm
diff --git a/arch/alpha/mm/CVS/Root b/arch/alpha/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/alpha/oprofile/CVS/Entries b/arch/alpha/oprofile/CVS/Entries
deleted file mode 100644 (file)
index 49d9a72..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Kconfig/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/common.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/op_impl.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/op_model_ev4.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/op_model_ev5.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/op_model_ev6.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/op_model_ev67.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/alpha/oprofile/CVS/Repository b/arch/alpha/oprofile/CVS/Repository
deleted file mode 100644 (file)
index 5d56455..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/alpha/oprofile
diff --git a/arch/alpha/oprofile/CVS/Root b/arch/alpha/oprofile/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/CVS/Entries b/arch/arm/CVS/Entries
deleted file mode 100644 (file)
index cfb7656..0000000
+++ /dev/null
@@ -1,33 +0,0 @@
-/Kconfig/1.5/Tue Jul 20 15:33:00 2004/-ko/
-/Makefile/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/defconfig/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D/boot////
-D/common////
-D/configs////
-D/kernel////
-D/lib////
-D/mach-adifcc////
-D/mach-clps711x////
-D/mach-clps7500////
-D/mach-ebsa110////
-D/mach-epxa10db////
-D/mach-footbridge////
-D/mach-ftvpci////
-D/mach-integrator////
-D/mach-iop3xx////
-D/mach-ixp4xx////
-D/mach-l7200////
-D/mach-lh7a40x////
-D/mach-omap////
-D/mach-pxa////
-D/mach-rpc////
-D/mach-s3c2410////
-D/mach-sa1100////
-D/mach-shark////
-D/mach-tbox////
-D/mach-versatile////
-D/mm////
-D/nwfpe////
-D/oprofile////
-D/tools////
-D/vfp////
diff --git a/arch/arm/CVS/Repository b/arch/arm/CVS/Repository
deleted file mode 100644 (file)
index 40a4391..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm
diff --git a/arch/arm/CVS/Root b/arch/arm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/boot/CVS/Entries b/arch/arm/boot/CVS/Entries
deleted file mode 100644 (file)
index 5e92794..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/install.sh/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D/bootp////
-D/compressed////
diff --git a/arch/arm/boot/CVS/Repository b/arch/arm/boot/CVS/Repository
deleted file mode 100644 (file)
index d392d50..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/boot
diff --git a/arch/arm/boot/CVS/Root b/arch/arm/boot/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/boot/bootp/CVS/Entries b/arch/arm/boot/bootp/CVS/Entries
deleted file mode 100644 (file)
index c1b9614..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/bootp.lds/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/init.S/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/initrd.S/1.1.3.1/Mon Jul 19 17:05:44 2004/-ko/
-/kernel.S/1.1.3.1/Mon Jul 19 17:05:44 2004/-ko/
-D
diff --git a/arch/arm/boot/bootp/CVS/Repository b/arch/arm/boot/bootp/CVS/Repository
deleted file mode 100644 (file)
index a32dc78..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/boot/bootp
diff --git a/arch/arm/boot/bootp/CVS/Root b/arch/arm/boot/bootp/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/boot/compressed/CVS/Entries b/arch/arm/boot/compressed/CVS/Entries
deleted file mode 100644 (file)
index d70483a..0000000
+++ /dev/null
@@ -1,17 +0,0 @@
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/Makefile.debug/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/head-clps7500.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/head-epxa10db.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/head-l7200.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/head-sa1100.S/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/head-shark.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/head-xscale.S/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/head.S/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/hw-bse.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ice-dcc.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ll_char_wr.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/misc.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ofw-shark.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/piggy.S/1.1.3.1/Mon Jul 19 17:05:44 2004/-ko/
-/vmlinux.lds.in/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/arch/arm/boot/compressed/CVS/Repository b/arch/arm/boot/compressed/CVS/Repository
deleted file mode 100644 (file)
index 68ce805..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/boot/compressed
diff --git a/arch/arm/boot/compressed/CVS/Root b/arch/arm/boot/compressed/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/common/CVS/Entries b/arch/arm/common/CVS/Entries
deleted file mode 100644 (file)
index c93a16a..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/amba.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/dmabounce.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/icst525.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/locomo.c/1.1.3.1/Mon Jul 19 17:05:46 2004/-ko/
-/sa1111.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/time-acorn.c/1.1.3.1/Mon Jul 19 17:05:46 2004/-ko/
-/via82c505.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/common/CVS/Repository b/arch/arm/common/CVS/Repository
deleted file mode 100644 (file)
index 66a2211..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/common
diff --git a/arch/arm/common/CVS/Root b/arch/arm/common/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index cfd0d3e..314ebd3 100644 (file)
  */
 
 #include <linux/device.h>
+#include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/platform_device.h>
 #include <asm/io.h>
 #include <asm/hardware/scoop.h>
 
+/* PCMCIA to Scoop linkage
+
+   There is no easy way to link multiple scoop devices into one
+   single entity for the pxa2xx_pcmcia device so this structure
+   is used which is setup by the platform code.
+
+   This file is never modular so this symbol is always
+   accessile to the board support files.
+*/
+struct scoop_pcmcia_config *platform_scoop_config;
+EXPORT_SYMBOL(platform_scoop_config);
+
 #define SCOOP_REG(d,adr) (*(volatile unsigned short*)(d +(adr)))
 
 struct  scoop_dev {
        void  *base;
        spinlock_t scoop_lock;
+       unsigned short suspend_clr;
+       unsigned short suspend_set;
        u32 scoop_gpwr;
 };
 
@@ -29,7 +46,6 @@ void reset_scoop(struct device *dev)
 
        SCOOP_REG(sdev->base,SCOOP_MCR) = 0x0100;  // 00
        SCOOP_REG(sdev->base,SCOOP_CDR) = 0x0000;  // 04
-       SCOOP_REG(sdev->base,SCOOP_CPR) = 0x0000;  // 0C
        SCOOP_REG(sdev->base,SCOOP_CCR) = 0x0000;  // 10
        SCOOP_REG(sdev->base,SCOOP_IMR) = 0x0000;  // 18
        SCOOP_REG(sdev->base,SCOOP_IRM) = 0x00FF;  // 14
@@ -84,25 +100,34 @@ EXPORT_SYMBOL(reset_scoop);
 EXPORT_SYMBOL(read_scoop_reg);
 EXPORT_SYMBOL(write_scoop_reg);
 
+static void check_scoop_reg(struct scoop_dev *sdev)
+{
+       unsigned short mcr;
+
+       mcr = SCOOP_REG(sdev->base, SCOOP_MCR);
+       if ((mcr & 0x100) == 0)
+               SCOOP_REG(sdev->base, SCOOP_MCR) = 0x0101;
+}
+
 #ifdef CONFIG_PM
-static int scoop_suspend(struct device *dev, uint32_t state, uint32_t level)
+static int scoop_suspend(struct platform_device *dev, pm_message_t state)
 {
-       if (level == SUSPEND_POWER_DOWN) {
-               struct scoop_dev *sdev = dev_get_drvdata(dev);
+       struct scoop_dev *sdev = platform_get_drvdata(dev);
+
+       check_scoop_reg(sdev);
+       sdev->scoop_gpwr = SCOOP_REG(sdev->base, SCOOP_GPWR);
+       SCOOP_REG(sdev->base, SCOOP_GPWR) = (sdev->scoop_gpwr & ~sdev->suspend_clr) | sdev->suspend_set;
 
-               sdev->scoop_gpwr = SCOOP_REG(sdev->base,SCOOP_GPWR);
-               SCOOP_REG(sdev->base,SCOOP_GPWR) = 0;
-       }
        return 0;
 }
 
-static int scoop_resume(struct device *dev, uint32_t level)
+static int scoop_resume(struct platform_device *dev)
 {
-       if (level == RESUME_POWER_ON) {
-               struct scoop_dev *sdev = dev_get_drvdata(dev);
+       struct scoop_dev *sdev = platform_get_drvdata(dev);
+
+       check_scoop_reg(sdev);
+       SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
 
-               SCOOP_REG(sdev->base,SCOOP_GPWR) = sdev->scoop_gpwr;
-       }
        return 0;
 }
 #else
@@ -110,25 +135,22 @@ static int scoop_resume(struct device *dev, uint32_t level)
 #define scoop_resume   NULL
 #endif
 
-int __init scoop_probe(struct device *dev)
+int __init scoop_probe(struct platform_device *pdev)
 {
        struct scoop_dev *devptr;
        struct scoop_config *inf;
-       struct platform_device *pdev = to_platform_device(dev);
        struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
 
        if (!mem)
                return -EINVAL;
 
-       devptr = kmalloc(sizeof(struct scoop_dev), GFP_KERNEL);
-
+       devptr = kzalloc(sizeof(struct scoop_dev), GFP_KERNEL);
        if (!devptr)
-               return  -ENOMEM;
+               return -ENOMEM;
 
-       memset(devptr, 0, sizeof(struct scoop_dev));
        spin_lock_init(&devptr->scoop_lock);
 
-       inf = dev->platform_data;
+       inf = pdev->dev.platform_data;
        devptr->base = ioremap(mem->start, mem->end - mem->start + 1);
 
        if (!devptr->base) {
@@ -136,41 +158,46 @@ int __init scoop_probe(struct device *dev)
                return -ENOMEM;
        }
 
-       dev_set_drvdata(dev, devptr);
+       platform_set_drvdata(pdev, devptr);
 
        printk("Sharp Scoop Device found at 0x%08x -> 0x%08x\n",(unsigned int)mem->start,(unsigned int)devptr->base);
 
        SCOOP_REG(devptr->base, SCOOP_MCR) = 0x0140;
-       reset_scoop(dev);
+       reset_scoop(&pdev->dev);
+       SCOOP_REG(devptr->base, SCOOP_CPR) = 0x0000;
        SCOOP_REG(devptr->base, SCOOP_GPCR) = inf->io_dir & 0xffff;
        SCOOP_REG(devptr->base, SCOOP_GPWR) = inf->io_out & 0xffff;
 
+       devptr->suspend_clr = inf->suspend_clr;
+       devptr->suspend_set = inf->suspend_set;
+
        return 0;
 }
 
-static int scoop_remove(struct device *dev)
+static int scoop_remove(struct platform_device *pdev)
 {
-       struct scoop_dev *sdev = dev_get_drvdata(dev);
+       struct scoop_dev *sdev = platform_get_drvdata(pdev);
        if (sdev) {
                iounmap(sdev->base);
                kfree(sdev);
-               dev_set_drvdata(dev, NULL);
+               platform_set_drvdata(pdev, NULL);
        }
        return 0;
 }
 
-static struct device_driver scoop_driver = {
-       .name           = "sharp-scoop",
-       .bus            = &platform_bus_type,
+static struct platform_driver scoop_driver = {
        .probe          = scoop_probe,
        .remove         = scoop_remove,
        .suspend        = scoop_suspend,
        .resume         = scoop_resume,
+       .driver         = {
+               .name   = "sharp-scoop",
+       },
 };
 
 int __init scoop_init(void)
 {
-       return driver_register(&scoop_driver);
+       return platform_driver_register(&scoop_driver);
 }
 
 subsys_initcall(scoop_init);
diff --git a/arch/arm/configs/CVS/Entries b/arch/arm/configs/CVS/Entries
deleted file mode 100644 (file)
index 6785a6f..0000000
+++ /dev/null
@@ -1,53 +0,0 @@
-/a5k_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/adsbitsy_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/assabet_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/badge4_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/bast_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/brutus_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/cerfcube_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/clps7500_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ebsa110_defconfig/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/edb7211_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/empeg_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/epxa10db_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/flexanet_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/footbridge_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fortunet_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/freebird_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/freebird_new_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/graphicsclient_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/graphicsmaster_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/h3600_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/hackkit_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/huw_webpanel_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/integrator_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/iq80310_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/iq80321_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ixp4xx_defconfig/1.1.3.1/Wed Jun  2 19:33:20 2004/-ko/
-/jornada720_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/lart_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/lpd7a400_defconfig/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/lpd7a404_defconfig/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/lubbock_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/lusl7200_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mainstone_defconfig/1.1.3.2/Mon Jul 19 17:05:46 2004/-ko/
-/neponset_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/netwinder_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/omnimeter_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pangolin_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pfs168_mqtft_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pfs168_mqvga_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pfs168_sastn_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pfs168_satft_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pleb_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/rpc_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/s3c2410_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/shannon_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/shark_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/sherman_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/smdk2410_defconfig/1.1.3.1/Wed Jun  2 19:33:20 2004/-ko/
-/stork_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/system3_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/trizeps_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/versatile_defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/configs/CVS/Repository b/arch/arm/configs/CVS/Repository
deleted file mode 100644 (file)
index c34e93b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/configs
diff --git a/arch/arm/configs/CVS/Root b/arch/arm/configs/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 305f01f..11959b7 100644 (file)
@@ -64,7 +64,6 @@ CONFIG_KMOD=y
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
 # CONFIG_ARCH_EBSA110 is not set
-# CONFIG_ARCH_CAMELOT is not set
 # CONFIG_ARCH_FOOTBRIDGE is not set
 # CONFIG_ARCH_INTEGRATOR is not set
 CONFIG_ARCH_IOP3XX=y
@@ -497,6 +496,7 @@ CONFIG_NETDEVICES=y
 # CONFIG_DL2K is not set
 CONFIG_E1000=y
 CONFIG_E1000_NAPI=y
+# CONFIG_E1000_DISABLE_PACKET_SPLIT is not set
 # CONFIG_NS83820 is not set
 # CONFIG_HAMACHI is not set
 # CONFIG_YELLOWFIN is not set
index 94aafec..4975b91 100644 (file)
@@ -1,14 +1,13 @@
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.12-rc1-bk2
-# Sun Mar 27 22:53:40 2005
+# Linux kernel version: 2.6.15
+# Tue Jan  3 03:20:40 2006
 #
 CONFIG_ARM=y
 CONFIG_MMU=y
 CONFIG_UID16=y
 CONFIG_RWSEM_GENERIC_SPINLOCK=y
 CONFIG_GENERIC_CALIBRATE_DELAY=y
-CONFIG_GENERIC_IOMAP=y
 
 #
 # Code maturity level options
@@ -16,11 +15,13 @@ CONFIG_GENERIC_IOMAP=y
 CONFIG_EXPERIMENTAL=y
 CONFIG_CLEAN_COMPILE=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_POSIX_MQUEUE is not set
@@ -31,14 +32,17 @@ CONFIG_SYSCTL=y
 # CONFIG_HOTPLUG is not set
 CONFIG_KOBJECT_UEVENT=y
 # CONFIG_IKCONFIG is not set
+CONFIG_INITRAMFS_SOURCE=""
+CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_EMBEDDED=y
 CONFIG_KALLSYMS=y
 # CONFIG_KALLSYMS_ALL is not set
 # CONFIG_KALLSYMS_EXTRA_PASS is not set
+CONFIG_PRINTK=y
+CONFIG_BUG=y
 CONFIG_BASE_FULL=y
 CONFIG_FUTEX=y
 CONFIG_EPOLL=y
-CONFIG_CC_OPTIMIZE_FOR_SIZE=y
 CONFIG_SHMEM=y
 CONFIG_CC_ALIGN_FUNCTIONS=0
 CONFIG_CC_ALIGN_LABELS=0
@@ -57,6 +61,23 @@ CONFIG_MODVERSIONS=y
 # CONFIG_MODULE_SRCVERSION_ALL is not set
 CONFIG_KMOD=y
 
+#
+# Block layer
+#
+
+#
+# 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"
+
 #
 # System Type
 #
@@ -64,7 +85,6 @@ CONFIG_KMOD=y
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
 # CONFIG_ARCH_EBSA110 is not set
-# CONFIG_ARCH_CAMELOT is not set
 # CONFIG_ARCH_FOOTBRIDGE is not set
 # CONFIG_ARCH_INTEGRATOR is not set
 # CONFIG_ARCH_IOP3XX is not set
@@ -79,8 +99,10 @@ CONFIG_ARCH_IXP4XX=y
 # CONFIG_ARCH_LH7A40X is not set
 # CONFIG_ARCH_OMAP is not set
 # CONFIG_ARCH_VERSATILE is not set
+# CONFIG_ARCH_REALVIEW is not set
 # CONFIG_ARCH_IMX is not set
 # CONFIG_ARCH_H720X is not set
+# CONFIG_ARCH_AAEC2000 is not set
 CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
 
 #
@@ -90,14 +112,16 @@ CONFIG_ARCH_SUPPORTS_BIG_ENDIAN=y
 #
 # IXP4xx Platforms
 #
-# CONFIG_ARCH_AVILA is not set
+CONFIG_ARCH_AVILA=y
 CONFIG_ARCH_ADI_COYOTE=y
 CONFIG_ARCH_IXDP425=y
-# CONFIG_MACH_IXDPG425 is not set
-# CONFIG_MACH_IXDP465 is not set
+CONFIG_MACH_IXDPG425=y
+CONFIG_MACH_IXDP465=y
 CONFIG_ARCH_IXCDP1100=y
 CONFIG_ARCH_PRPMC1100=y
+CONFIG_MACH_NAS100D=y
 CONFIG_ARCH_IXDP4XX=y
+CONFIG_CPU_IXP46X=y
 # CONFIG_MACH_GTWX5715 is not set
 
 #
@@ -114,7 +138,6 @@ CONFIG_CPU_32v5=y
 CONFIG_CPU_ABRT_EV5T=y
 CONFIG_CPU_CACHE_VIVT=y
 CONFIG_CPU_TLB_V4WBI=y
-CONFIG_CPU_MINICACHE=y
 
 #
 # Processor Features
@@ -127,9 +150,10 @@ CONFIG_DMABOUNCE=y
 #
 # Bus support
 #
+CONFIG_ISA_DMA_API=y
 CONFIG_PCI=y
 CONFIG_PCI_LEGACY_PROC=y
-CONFIG_PCI_NAMES=y
+# CONFIG_PCI_DEBUG is not set
 
 #
 # PCCARD (PCMCIA/CardBus) support
@@ -140,6 +164,16 @@ CONFIG_PCI_NAMES=y
 # Kernel Features
 #
 # CONFIG_PREEMPT is not set
+# CONFIG_NO_IDLE_HZ 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_ALIGNMENT_TRAP=y
 
 #
@@ -158,6 +192,7 @@ CONFIG_CMDLINE="console=ttyS0,115200 ip=bootp root=/dev/nfs"
 # At least one emulation must be selected
 #
 CONFIG_FPE_NWFPE=y
+# CONFIG_FPE_NWFPE_XP is not set
 # CONFIG_FPE_FASTFPE is not set
 
 #
@@ -172,226 +207,12 @@ CONFIG_BINFMT_ELF=y
 # Power management options
 #
 CONFIG_PM=y
+CONFIG_PM_LEGACY=y
+# CONFIG_PM_DEBUG is not set
 CONFIG_APM=y
 
 #
-# Device Drivers
-#
-
-#
-# Generic Driver Options
-#
-CONFIG_STANDALONE=y
-CONFIG_PREVENT_FIRMWARE_BUILD=y
-# CONFIG_FW_LOADER is not set
-# CONFIG_DEBUG_DRIVER is not set
-
-#
-# Memory Technology Devices (MTD)
-#
-CONFIG_MTD=y
-# CONFIG_MTD_DEBUG is not set
-# CONFIG_MTD_CONCAT is not set
-CONFIG_MTD_PARTITIONS=y
-CONFIG_MTD_REDBOOT_PARTS=y
-CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
-# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
-# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
-# CONFIG_MTD_CMDLINE_PARTS is not set
-# CONFIG_MTD_AFS_PARTS is not set
-
-#
-# User Modules And Translation Layers
-#
-CONFIG_MTD_CHAR=y
-CONFIG_MTD_BLOCK=y
-# CONFIG_FTL is not set
-# CONFIG_NFTL is not set
-# CONFIG_INFTL 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 is not set
-CONFIG_MTD_MAP_BANK_WIDTH_1=y
-CONFIG_MTD_MAP_BANK_WIDTH_2=y
-CONFIG_MTD_MAP_BANK_WIDTH_4=y
-# 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=y
-# CONFIG_MTD_CFI_I4 is not set
-# CONFIG_MTD_CFI_I8 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 is not set
-# CONFIG_MTD_ROM is not set
-# CONFIG_MTD_ABSENT is not set
-# CONFIG_MTD_XIP is not set
-
-#
-# Mapping drivers for chip access
-#
-CONFIG_MTD_COMPLEX_MAPPINGS=y
-# CONFIG_MTD_PHYSMAP is not set
-# CONFIG_MTD_ARM_INTEGRATOR is not set
-CONFIG_MTD_IXP4XX=y
-# CONFIG_MTD_EDB7312 is not set
-# CONFIG_MTD_PCI is not set
-
-#
-# 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_BLKMTD 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
-
-#
-# NAND Flash Device Drivers
-#
-CONFIG_MTD_NAND=m
-# CONFIG_MTD_NAND_VERIFY_WRITE is not set
-CONFIG_MTD_NAND_IDS=m
-# CONFIG_MTD_NAND_DISKONCHIP is not set
-# CONFIG_MTD_NAND_NANDSIM is not set
-
-#
-# Parallel port support
-#
-# CONFIG_PARPORT is not set
-
-#
-# Plug and Play support
-#
-
-#
-# Block devices
-#
-# 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
-# CONFIG_BLK_DEV_COW_COMMON is not set
-CONFIG_BLK_DEV_LOOP=y
-# CONFIG_BLK_DEV_CRYPTOLOOP is not set
-# CONFIG_BLK_DEV_NBD is not set
-# CONFIG_BLK_DEV_SX8 is not set
-CONFIG_BLK_DEV_RAM=y
-CONFIG_BLK_DEV_RAM_COUNT=16
-CONFIG_BLK_DEV_RAM_SIZE=8192
-CONFIG_BLK_DEV_INITRD=y
-CONFIG_INITRAMFS_SOURCE=""
-# 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
-
-#
-# 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 is not set
-# CONFIG_BLK_DEV_IDECD is not set
-# CONFIG_BLK_DEV_IDETAPE is not set
-# CONFIG_BLK_DEV_IDEFLOPPY is not set
-# CONFIG_IDE_TASK_IOCTL is not set
-
-#
-# IDE chipset support/bugfixes
-#
-CONFIG_IDE_GENERIC=y
-CONFIG_BLK_DEV_IDEPCI=y
-# CONFIG_IDEPCI_SHARE_IRQ is not set
-# CONFIG_BLK_DEV_OFFBOARD is not set
-# CONFIG_BLK_DEV_GENERIC is not set
-# CONFIG_BLK_DEV_OPTI621 is not set
-# CONFIG_BLK_DEV_SL82C105 is not set
-CONFIG_BLK_DEV_IDEDMA_PCI=y
-# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
-# CONFIG_IDEDMA_PCI_AUTO is not set
-# CONFIG_BLK_DEV_AEC62XX is not set
-# CONFIG_BLK_DEV_ALI15X3 is not set
-# CONFIG_BLK_DEV_AMD74XX is not set
-CONFIG_BLK_DEV_CMD64X=y
-# CONFIG_BLK_DEV_TRIFLEX is not set
-# CONFIG_BLK_DEV_CY82C693 is not set
-# CONFIG_BLK_DEV_CS5520 is not set
-# CONFIG_BLK_DEV_CS5530 is not set
-# CONFIG_BLK_DEV_HPT34X is not set
-CONFIG_BLK_DEV_HPT366=y
-# CONFIG_BLK_DEV_SC1200 is not set
-# CONFIG_BLK_DEV_PIIX is not set
-# CONFIG_BLK_DEV_NS87415 is not set
-# CONFIG_BLK_DEV_PDC202XX_OLD is not set
-CONFIG_BLK_DEV_PDC202XX_NEW=y
-# CONFIG_PDC202XX_FORCE is not set
-# CONFIG_BLK_DEV_SVWKS is not set
-# CONFIG_BLK_DEV_SIIMAGE is not set
-# CONFIG_BLK_DEV_SLC90E66 is not set
-# CONFIG_BLK_DEV_TRM290 is not set
-# CONFIG_BLK_DEV_VIA82CXXX is not set
-# CONFIG_IDE_ARM is not set
-CONFIG_BLK_DEV_IDEDMA=y
-# CONFIG_IDEDMA_IVB is not set
-# CONFIG_IDEDMA_AUTO is not set
-# CONFIG_BLK_DEV_HD is not set
-
-#
-# SCSI device support
-#
-# CONFIG_SCSI is not set
-
-#
-# Multi-device support (RAID and LVM)
-#
-# CONFIG_MD is not set
-
-#
-# Fusion MPT device support
-#
-
-#
-# IEEE 1394 (FireWire) support
-#
-# CONFIG_IEEE1394 is not set
-
-#
-# I2O device support
-#
-# CONFIG_I2O is not set
-
-#
-# Networking support
+# Networking
 #
 CONFIG_NET=y
 
@@ -400,12 +221,16 @@ CONFIG_NET=y
 #
 CONFIG_PACKET=m
 CONFIG_PACKET_MMAP=y
-CONFIG_NETLINK_DEV=m
 CONFIG_UNIX=y
+CONFIG_XFRM=y
+# CONFIG_XFRM_USER is not set
 # CONFIG_NET_KEY is not set
 CONFIG_INET=y
 CONFIG_IP_MULTICAST=y
 CONFIG_IP_ADVANCED_ROUTER=y
+CONFIG_ASK_IP_FIB_HASH=y
+# CONFIG_IP_FIB_TRIE is not set
+CONFIG_IP_FIB_HASH=y
 CONFIG_IP_MULTIPLE_TABLES=y
 CONFIG_IP_ROUTE_FWMARK=y
 CONFIG_IP_ROUTE_MULTIPATH=y
@@ -427,8 +252,10 @@ CONFIG_SYN_COOKIES=y
 # CONFIG_INET_ESP is not set
 # CONFIG_INET_IPCOMP is not set
 CONFIG_INET_TUNNEL=m
-# CONFIG_IP_TCPDIAG is not set
-# CONFIG_IP_TCPDIAG_IPV6 is not set
+CONFIG_INET_DIAG=y
+CONFIG_INET_TCP_DIAG=y
+# CONFIG_TCP_CONG_ADVANCED is not set
+CONFIG_TCP_CONG_BIC=y
 
 #
 # IP: Virtual Server Configuration
@@ -467,17 +294,25 @@ CONFIG_NETFILTER=y
 # CONFIG_NETFILTER_DEBUG is not set
 CONFIG_BRIDGE_NETFILTER=y
 
+#
+# Core Netfilter Configuration
+#
+# CONFIG_NETFILTER_NETLINK is not set
+
 #
 # IP: Netfilter Configuration
 #
 CONFIG_IP_NF_CONNTRACK=m
 # CONFIG_IP_NF_CT_ACCT is not set
 # CONFIG_IP_NF_CONNTRACK_MARK is not set
+# CONFIG_IP_NF_CONNTRACK_EVENTS is not set
 # CONFIG_IP_NF_CT_PROTO_SCTP is not set
 CONFIG_IP_NF_FTP=m
 CONFIG_IP_NF_IRC=m
+# CONFIG_IP_NF_NETBIOS_NS is not set
 # CONFIG_IP_NF_TFTP is not set
 # CONFIG_IP_NF_AMANDA is not set
+# CONFIG_IP_NF_PPTP is not set
 CONFIG_IP_NF_QUEUE=m
 CONFIG_IP_NF_IPTABLES=m
 CONFIG_IP_NF_MATCH_LIMIT=m
@@ -502,13 +337,16 @@ CONFIG_IP_NF_MATCH_OWNER=m
 # CONFIG_IP_NF_MATCH_ADDRTYPE is not set
 # CONFIG_IP_NF_MATCH_REALM is not set
 # CONFIG_IP_NF_MATCH_SCTP is not set
+# CONFIG_IP_NF_MATCH_DCCP is not set
 # CONFIG_IP_NF_MATCH_COMMENT is not set
 # CONFIG_IP_NF_MATCH_HASHLIMIT is not set
+# CONFIG_IP_NF_MATCH_STRING is not set
 CONFIG_IP_NF_FILTER=m
 CONFIG_IP_NF_TARGET_REJECT=m
 CONFIG_IP_NF_TARGET_LOG=m
 CONFIG_IP_NF_TARGET_ULOG=m
 CONFIG_IP_NF_TARGET_TCPMSS=m
+# CONFIG_IP_NF_TARGET_NFQUEUE is not set
 CONFIG_IP_NF_NAT=m
 CONFIG_IP_NF_NAT_NEEDED=y
 CONFIG_IP_NF_TARGET_MASQUERADE=m
@@ -524,6 +362,7 @@ CONFIG_IP_NF_TARGET_TOS=m
 # CONFIG_IP_NF_TARGET_DSCP is not set
 CONFIG_IP_NF_TARGET_MARK=m
 # CONFIG_IP_NF_TARGET_CLASSIFY is not set
+# CONFIG_IP_NF_TARGET_TTL is not set
 # CONFIG_IP_NF_RAW is not set
 CONFIG_IP_NF_ARPTABLES=m
 CONFIG_IP_NF_ARPFILTER=m
@@ -533,8 +372,11 @@ CONFIG_IP_NF_ARPFILTER=m
 # Bridge: Netfilter Configuration
 #
 # CONFIG_BRIDGE_NF_EBTABLES is not set
-CONFIG_XFRM=y
-# CONFIG_XFRM_USER is not set
+
+#
+# DCCP Configuration (EXPERIMENTAL)
+#
+# CONFIG_IP_DCCP is not set
 
 #
 # SCTP Configuration (EXPERIMENTAL)
@@ -574,6 +416,10 @@ CONFIG_NET_SCHED=y
 CONFIG_NET_SCH_CLK_JIFFIES=y
 # CONFIG_NET_SCH_CLK_GETTIMEOFDAY is not set
 # CONFIG_NET_SCH_CLK_CPU is not set
+
+#
+# Queueing/Scheduling
+#
 CONFIG_NET_SCH_CBQ=m
 CONFIG_NET_SCH_HTB=m
 # CONFIG_NET_SCH_HFSC is not set
@@ -587,8 +433,10 @@ CONFIG_NET_SCH_GRED=m
 CONFIG_NET_SCH_DSMARK=m
 # CONFIG_NET_SCH_NETEM is not set
 CONFIG_NET_SCH_INGRESS=m
-CONFIG_NET_QOS=y
-CONFIG_NET_ESTIMATOR=y
+
+#
+# Classification
+#
 CONFIG_NET_CLS=y
 # CONFIG_NET_CLS_BASIC is not set
 CONFIG_NET_CLS_TCINDEX=m
@@ -597,35 +445,263 @@ CONFIG_NET_CLS_ROUTE=y
 CONFIG_NET_CLS_FW=m
 CONFIG_NET_CLS_U32=m
 # CONFIG_CLS_U32_PERF is not set
-# CONFIG_NET_CLS_IND is not set
 # CONFIG_CLS_U32_MARK is not set
 CONFIG_NET_CLS_RSVP=m
 CONFIG_NET_CLS_RSVP6=m
 # CONFIG_NET_EMATCH is not set
 # CONFIG_NET_CLS_ACT is not set
 CONFIG_NET_CLS_POLICE=y
+# CONFIG_NET_CLS_IND is not set
+CONFIG_NET_ESTIMATOR=y
 
 #
 # Network testing
 #
 CONFIG_NET_PKTGEN=m
-# 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_IEEE80211 is not set
+
+#
+# Device Drivers
+#
+
+#
+# Generic Driver Options
+#
+CONFIG_STANDALONE=y
+CONFIG_PREVENT_FIRMWARE_BUILD=y
+# CONFIG_FW_LOADER is not set
+# CONFIG_DEBUG_DRIVER 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
+CONFIG_MTD_PARTITIONS=y
+CONFIG_MTD_REDBOOT_PARTS=y
+CONFIG_MTD_REDBOOT_DIRECTORY_BLOCK=-1
+# CONFIG_MTD_REDBOOT_PARTS_UNALLOCATED is not set
+# CONFIG_MTD_REDBOOT_PARTS_READONLY is not set
+# CONFIG_MTD_CMDLINE_PARTS is not set
+# CONFIG_MTD_AFS_PARTS is not set
+
+#
+# User Modules And Translation Layers
+#
+CONFIG_MTD_CHAR=y
+CONFIG_MTD_BLOCK=y
+# CONFIG_FTL is not set
+# CONFIG_NFTL is not set
+# CONFIG_INFTL is not set
+# CONFIG_RFD_FTL 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 is not set
+CONFIG_MTD_MAP_BANK_WIDTH_1=y
+CONFIG_MTD_MAP_BANK_WIDTH_2=y
+CONFIG_MTD_MAP_BANK_WIDTH_4=y
+# 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=y
+# CONFIG_MTD_CFI_I4 is not set
+# CONFIG_MTD_CFI_I8 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 is not set
+# CONFIG_MTD_ROM is not set
+# CONFIG_MTD_ABSENT is not set
+# CONFIG_MTD_XIP is not set
+
+#
+# Mapping drivers for chip access
+#
+CONFIG_MTD_COMPLEX_MAPPINGS=y
+# CONFIG_MTD_PHYSMAP is not set
+# CONFIG_MTD_ARM_INTEGRATOR is not set
+CONFIG_MTD_IXP4XX=y
+# CONFIG_MTD_PCI is not set
+# CONFIG_MTD_PLATRAM is not set
+
+#
+# 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_BLKMTD 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
+
+#
+# NAND Flash Device Drivers
+#
+CONFIG_MTD_NAND=m
+# CONFIG_MTD_NAND_VERIFY_WRITE is not set
+CONFIG_MTD_NAND_IDS=m
+# CONFIG_MTD_NAND_DISKONCHIP is not set
+# CONFIG_MTD_NAND_NANDSIM is not set
+
+#
+# OneNAND Flash Device Drivers
+#
+# CONFIG_MTD_ONENAND is not set
+
+#
+# Parallel port support
+#
+# CONFIG_PARPORT is not set
+
+#
+# Plug and Play support
+#
+
+#
+# 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=y
+# CONFIG_BLK_DEV_CRYPTOLOOP is not set
+# CONFIG_BLK_DEV_NBD is not set
+# CONFIG_BLK_DEV_SX8 is not set
+CONFIG_BLK_DEV_RAM=y
+CONFIG_BLK_DEV_RAM_COUNT=16
+CONFIG_BLK_DEV_RAM_SIZE=8192
+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=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 is not set
+# CONFIG_BLK_DEV_IDECD is not set
+# CONFIG_BLK_DEV_IDETAPE is not set
+# CONFIG_BLK_DEV_IDEFLOPPY is not set
+# CONFIG_IDE_TASK_IOCTL is not set
+
+#
+# IDE chipset support/bugfixes
+#
+CONFIG_IDE_GENERIC=y
+CONFIG_BLK_DEV_IDEPCI=y
+# CONFIG_IDEPCI_SHARE_IRQ is not set
+# CONFIG_BLK_DEV_OFFBOARD is not set
+# CONFIG_BLK_DEV_GENERIC is not set
+# CONFIG_BLK_DEV_OPTI621 is not set
+# CONFIG_BLK_DEV_SL82C105 is not set
+CONFIG_BLK_DEV_IDEDMA_PCI=y
+# CONFIG_BLK_DEV_IDEDMA_FORCED is not set
+# CONFIG_IDEDMA_PCI_AUTO is not set
+# CONFIG_BLK_DEV_AEC62XX is not set
+# CONFIG_BLK_DEV_ALI15X3 is not set
+# CONFIG_BLK_DEV_AMD74XX is not set
+CONFIG_BLK_DEV_CMD64X=y
+# CONFIG_BLK_DEV_TRIFLEX is not set
+# CONFIG_BLK_DEV_CY82C693 is not set
+# CONFIG_BLK_DEV_CS5520 is not set
+# CONFIG_BLK_DEV_CS5530 is not set
+# CONFIG_BLK_DEV_HPT34X is not set
+CONFIG_BLK_DEV_HPT366=y
+# CONFIG_BLK_DEV_SC1200 is not set
+# CONFIG_BLK_DEV_PIIX is not set
+# CONFIG_BLK_DEV_IT821X is not set
+# CONFIG_BLK_DEV_NS87415 is not set
+# CONFIG_BLK_DEV_PDC202XX_OLD is not set
+CONFIG_BLK_DEV_PDC202XX_NEW=y
+# CONFIG_PDC202XX_FORCE is not set
+# CONFIG_BLK_DEV_SVWKS is not set
+# CONFIG_BLK_DEV_SIIMAGE is not set
+# CONFIG_BLK_DEV_SLC90E66 is not set
+# CONFIG_BLK_DEV_TRM290 is not set
+# CONFIG_BLK_DEV_VIA82CXXX is not set
+# CONFIG_IDE_ARM is not set
+CONFIG_BLK_DEV_IDEDMA=y
+# CONFIG_IDEDMA_IVB is not set
+# CONFIG_IDEDMA_AUTO is not set
+# CONFIG_BLK_DEV_HD is not set
+
+#
+# SCSI device support
+#
+# CONFIG_RAID_ATTRS is not set
+# CONFIG_SCSI 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=y
 # CONFIG_BONDING is not set
 # CONFIG_EQUALIZER is not set
 # CONFIG_TUN is not set
-# CONFIG_ETHERTAP is not set
 
 #
 # ARCnet devices
 #
 # CONFIG_ARCNET is not set
 
+#
+# PHY device support
+#
+# CONFIG_PHYLIB is not set
+
 #
 # Ethernet (10 or 100Mbit)
 #
@@ -633,8 +709,10 @@ 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_SMC91X is not set
+# CONFIG_DM9000 is not set
 
 #
 # Tulip family network device support
@@ -671,13 +749,17 @@ CONFIG_EEPRO100=y
 # 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_SK98LIN is not set
 # CONFIG_VIA_VELOCITY is not set
 # CONFIG_TIGON3 is not set
+# CONFIG_BNX2 is not set
 
 #
 # Ethernet (10000 Mbit)
 #
+# CONFIG_CHELSIO_T1 is not set
 # CONFIG_IXGB is not set
 # CONFIG_S2IO is not set
 
@@ -699,9 +781,11 @@ CONFIG_NET_RADIO=y
 #
 # Wireless 802.11b ISA/PCI cards support
 #
+# CONFIG_AIRO is not set
 CONFIG_HERMES=y
 # CONFIG_PLX_HERMES is not set
 # CONFIG_TMD_HERMES is not set
+# CONFIG_NORTEL_HERMES is not set
 CONFIG_PCI_HERMES=y
 # CONFIG_ATMEL is not set
 
@@ -709,6 +793,7 @@ CONFIG_PCI_HERMES=y
 # Prism GT/Duette 802.11(a/b/g) PCI/Cardbus support
 #
 # CONFIG_PRISM54 is not set
+# CONFIG_HOSTAP is not set
 CONFIG_NET_WIRELESS=y
 
 #
@@ -740,6 +825,7 @@ CONFIG_WAN_ROUTER_DRIVERS=y
 #
 # ATM drivers
 #
+# CONFIG_ATM_DUMMY is not set
 CONFIG_ATM_TCP=m
 # CONFIG_ATM_LANAI is not set
 # CONFIG_ATM_ENI is not set
@@ -758,6 +844,8 @@ CONFIG_ATM_TCP=m
 # 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
@@ -795,7 +883,6 @@ CONFIG_INPUT_MOUSEDEV_SCREEN_Y=768
 #
 # CONFIG_SERIO is not set
 # CONFIG_GAMEPORT is not set
-CONFIG_SOUND_GAMEPORT=y
 
 #
 # Character devices
@@ -816,6 +903,7 @@ CONFIG_SERIAL_8250_NR_UARTS=2
 #
 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
@@ -858,6 +946,7 @@ CONFIG_IXP4XX_WATCHDOG=y
 # TPM devices
 #
 # CONFIG_TCG_TPM is not set
+# CONFIG_TELCLOCK is not set
 
 #
 # I2C support
@@ -882,12 +971,11 @@ CONFIG_I2C_ALGOBIT=y
 # CONFIG_I2C_AMD8111 is not set
 # CONFIG_I2C_I801 is not set
 # CONFIG_I2C_I810 is not set
+# CONFIG_I2C_PIIX4 is not set
 # CONFIG_I2C_IOP3XX is not set
-# CONFIG_I2C_ISA is not set
 CONFIG_I2C_IXP4XX=y
 # CONFIG_I2C_NFORCE2 is not set
 # CONFIG_I2C_PARPORT_LIGHT is not set
-# CONFIG_I2C_PIIX4 is not set
 # CONFIG_I2C_PROSAVAGE is not set
 # CONFIG_I2C_SAVAGE4 is not set
 # CONFIG_SCx200_ACB is not set
@@ -901,14 +989,34 @@ CONFIG_I2C_IXP4XX=y
 # CONFIG_I2C_PCA_ISA is not set
 
 #
-# Hardware Sensors Chip support
+# Miscellaneous I2C Chip support
+#
+# CONFIG_SENSORS_DS1337 is not set
+# CONFIG_SENSORS_DS1374 is not set
+CONFIG_SENSORS_EEPROM=y
+# 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_RTC_X1205_I2C 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
+
+#
+# Hardware Monitoring support
 #
-CONFIG_I2C_SENSOR=y
+CONFIG_HWMON=y
+# CONFIG_HWMON_VID 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_ADM9240 is not set
 # CONFIG_SENSORS_ASB100 is not set
+# CONFIG_SENSORS_ATXP1 is not set
 # CONFIG_SENSORS_DS1621 is not set
 # CONFIG_SENSORS_FSCHER is not set
 # CONFIG_SENSORS_FSCPOS is not set
@@ -924,30 +1032,26 @@ CONFIG_I2C_SENSOR=y
 # CONFIG_SENSORS_LM85 is not set
 # CONFIG_SENSORS_LM87 is not set
 # CONFIG_SENSORS_LM90 is not set
+# CONFIG_SENSORS_LM92 is not set
 # CONFIG_SENSORS_MAX1619 is not set
 # CONFIG_SENSORS_PC87360 is not set
-# CONFIG_SENSORS_SMSC47B397 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_W83781D is not set
+# CONFIG_SENSORS_W83792D is not set
 # CONFIG_SENSORS_W83L785TS is not set
 # CONFIG_SENSORS_W83627HF is not set
+# CONFIG_SENSORS_W83627EHF is not set
+# CONFIG_HWMON_DEBUG_CHIP is not set
 
 #
-# Other I2C Chip support
+# Misc devices
 #
-CONFIG_SENSORS_EEPROM=y
-# CONFIG_SENSORS_PCF8574 is not set
-# CONFIG_SENSORS_PCF8591 is not set
-# CONFIG_SENSORS_RTC8564 is not set
-# CONFIG_I2C_DEBUG_CORE is not set
-# CONFIG_I2C_DEBUG_ALGO is not set
-# CONFIG_I2C_DEBUG_BUS is not set
-# CONFIG_I2C_DEBUG_CHIP is not set
 
 #
-# Misc devices
+# Multimedia Capabilities Port drivers
 #
 
 #
@@ -977,6 +1081,10 @@ CONFIG_USB_ARCH_HAS_HCD=y
 CONFIG_USB_ARCH_HAS_OHCI=y
 # CONFIG_USB is not set
 
+#
+# NOTE: USB_STORAGE enables SCSI, and 'SCSI disk support'
+#
+
 #
 # USB Gadget Support
 #
@@ -994,6 +1102,7 @@ CONFIG_EXT2_FS=y
 CONFIG_EXT2_FS_XATTR=y
 CONFIG_EXT2_FS_POSIX_ACL=y
 # CONFIG_EXT2_FS_SECURITY is not set
+# CONFIG_EXT2_FS_XIP is not set
 CONFIG_EXT3_FS=y
 CONFIG_EXT3_FS_XATTR=y
 CONFIG_EXT3_FS_POSIX_ACL=y
@@ -1004,17 +1113,15 @@ CONFIG_FS_MBCACHE=y
 # CONFIG_REISERFS_FS is not set
 # CONFIG_JFS_FS is not set
 CONFIG_FS_POSIX_ACL=y
-
-#
-# XFS support
-#
 # CONFIG_XFS_FS is not set
 # CONFIG_MINIX_FS is not set
 # CONFIG_ROMFS_FS is not set
+CONFIG_INOTIFY=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
@@ -1034,12 +1141,10 @@ CONFIG_DNOTIFY=y
 #
 CONFIG_PROC_FS=y
 CONFIG_SYSFS=y
-# CONFIG_DEVFS_FS is not set
-# CONFIG_DEVPTS_FS_XATTR is not set
 CONFIG_TMPFS=y
-# CONFIG_TMPFS_XATTR is not set
 # CONFIG_HUGETLB_PAGE is not set
 CONFIG_RAMFS=y
+# CONFIG_RELAYFS_FS is not set
 
 #
 # Miscellaneous filesystems
@@ -1054,8 +1159,8 @@ CONFIG_RAMFS=y
 # CONFIG_JFFS_FS is not set
 CONFIG_JFFS2_FS=y
 CONFIG_JFFS2_FS_DEBUG=0
-# CONFIG_JFFS2_FS_NAND is not set
-# CONFIG_JFFS2_FS_NOR_ECC is not set
+CONFIG_JFFS2_FS_WRITEBUFFER=y
+# CONFIG_JFFS2_SUMMARY is not set
 # CONFIG_JFFS2_COMPRESSION_OPTIONS is not set
 CONFIG_JFFS2_ZLIB=y
 CONFIG_JFFS2_RTIME=y
@@ -1072,12 +1177,14 @@ CONFIG_JFFS2_RTIME=y
 #
 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_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
@@ -1086,6 +1193,7 @@ 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
@@ -1124,6 +1232,7 @@ CONFIG_MSDOS_PARTITION=y
 CONFIG_DEBUG_KERNEL=y
 CONFIG_MAGIC_SYSRQ=y
 CONFIG_LOG_BUF_SHIFT=14
+CONFIG_DETECT_SOFTLOCKUP=y
 # CONFIG_SCHEDSTATS is not set
 # CONFIG_DEBUG_SLAB is not set
 # CONFIG_DEBUG_SPINLOCK is not set
@@ -1132,7 +1241,9 @@ CONFIG_LOG_BUF_SHIFT=14
 CONFIG_DEBUG_BUGVERBOSE=y
 # CONFIG_DEBUG_INFO is not set
 # CONFIG_DEBUG_FS is not set
+# CONFIG_DEBUG_VM is not set
 CONFIG_FRAME_POINTER=y
+# CONFIG_RCU_TORTURE_TEST is not set
 # CONFIG_DEBUG_USER is not set
 # CONFIG_DEBUG_WAITQ is not set
 CONFIG_DEBUG_ERRORS=y
@@ -1158,6 +1269,7 @@ CONFIG_DEBUG_LL=y
 # Library routines
 #
 # CONFIG_CRC_CCITT is not set
+# CONFIG_CRC16 is not set
 CONFIG_CRC32=y
 # CONFIG_LIBCRC32C is not set
 CONFIG_ZLIB_INFLATE=y
index 153d685..b112bd7 100644 (file)
@@ -63,7 +63,6 @@ CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
 # CONFIG_ARCH_EBSA110 is not set
-# CONFIG_ARCH_CAMELOT is not set
 # CONFIG_ARCH_FOOTBRIDGE is not set
 # CONFIG_ARCH_INTEGRATOR is not set
 # CONFIG_ARCH_IOP3XX is not set
index 21c3278..b71d31a 100644 (file)
@@ -63,7 +63,6 @@ CONFIG_OBSOLETE_MODPARM=y
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
 # CONFIG_ARCH_EBSA110 is not set
-# CONFIG_ARCH_CAMELOT is not set
 # CONFIG_ARCH_FOOTBRIDGE is not set
 # CONFIG_ARCH_INTEGRATOR is not set
 # CONFIG_ARCH_IOP3XX is not set
index 2c60865..4d123d3 100644 (file)
@@ -58,7 +58,6 @@ CONFIG_BASE_SMALL=0
 # CONFIG_ARCH_CLPS711X is not set
 # CONFIG_ARCH_CO285 is not set
 # CONFIG_ARCH_EBSA110 is not set
-# CONFIG_ARCH_CAMELOT is not set
 # CONFIG_ARCH_FOOTBRIDGE is not set
 # CONFIG_ARCH_INTEGRATOR is not set
 # CONFIG_ARCH_IOP3XX is not set
diff --git a/arch/arm/kernel/CVS/Entries b/arch/arm/kernel/CVS/Entries
deleted file mode 100644 (file)
index da7e9d7..0000000
+++ /dev/null
@@ -1,34 +0,0 @@
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/apm.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/arch.c/1.2/Wed Jun  2 20:34:43 2004/-ko/
-/armksyms.c/1.2/Wed Jun  2 20:34:43 2004/-ko/
-/arthur.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/asm-offsets.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/bios32.c/1.2/Wed Jun  2 20:34:43 2004/-ko/
-/calls.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/compat.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/debug.S/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/dma-isa.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ecard.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/entry-armv.S/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/entry-common.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/entry-header.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fiq.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/head.S/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/init_task.c/1.2/Fri Jul 16 15:16:48 2004/-ko/
-/io.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/irq.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/isa.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/module.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/process.c/1.3/Fri Jul 16 15:16:48 2004/-ko/
-/ptrace.c/1.3/Thu Jun  3 22:32:16 2004/-ko/
-/ptrace.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/semaphore.c/1.2/Wed Jun  2 20:34:44 2004/-ko/
-/setup.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/signal.c/1.3/Fri Jul 16 15:16:48 2004/-ko/
-/sys_arm.c/1.2/Wed Jun  2 20:34:44 2004/-ko/
-/time.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/traps.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/vmlinux.lds.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/arm/kernel/CVS/Repository b/arch/arm/kernel/CVS/Repository
deleted file mode 100644 (file)
index 49abf1c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/kernel
diff --git a/arch/arm/kernel/CVS/Root b/arch/arm/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/lib/CVS/Entries b/arch/arm/lib/CVS/Entries
deleted file mode 100644 (file)
index e0fe5cf..0000000
+++ /dev/null
@@ -1,51 +0,0 @@
-/Makefile/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/ashldi3.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ashrdi3.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/backtrace.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/changebit.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/clearbit.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/copy_page.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/csumipv6.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/csumpartial.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/csumpartialcopy.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/csumpartialcopygeneric.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/csumpartialcopyuser.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/delay.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/div64.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ecard.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/findbit.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/floppydma.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/gcclib.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/getuser.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/io-acorn.S/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/io-readsb.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/io-readsl-armv3.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/io-readsl-armv4.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/io-readsw-armv3.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io-readsw-armv4.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io-shark.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io-writesb.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/io-writesl.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io-writesw-armv3.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io-writesw-armv4.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/lib1funcs.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/longlong.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/lshrdi3.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/memchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memcpy.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/memset.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memzero.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/muldi3.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/putuser.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/setbit.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/strchr.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/strncpy_from_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strnlen_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strrchr.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/testchangebit.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/testclearbit.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/testsetbit.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/uaccess.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ucmpdi2.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/udivdi3.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/arm/lib/CVS/Repository b/arch/arm/lib/CVS/Repository
deleted file mode 100644 (file)
index d08702f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/lib
diff --git a/arch/arm/lib/CVS/Root b/arch/arm/lib/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-adifcc/CVS/Entries b/arch/arm/mach-adifcc/CVS/Entries
deleted file mode 100644 (file)
index 1784810..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D
diff --git a/arch/arm/mach-adifcc/CVS/Repository b/arch/arm/mach-adifcc/CVS/Repository
deleted file mode 100644 (file)
index 22aa25b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-adifcc
diff --git a/arch/arm/mach-adifcc/CVS/Root b/arch/arm/mach-adifcc/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-clps711x/CVS/Entries b/arch/arm/mach-clps711x/CVS/Entries
deleted file mode 100644 (file)
index 0ca8142..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/Kconfig/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/autcpu12.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/cdb89712.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/ceiva.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/clep7312.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/edb7211-arch.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/edb7211-mm.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fortunet.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mm.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/p720t-leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/p720t.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/time.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/arch/arm/mach-clps711x/CVS/Repository b/arch/arm/mach-clps711x/CVS/Repository
deleted file mode 100644 (file)
index daf9c36..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-clps711x
diff --git a/arch/arm/mach-clps711x/CVS/Root b/arch/arm/mach-clps711x/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-clps7500/CVS/Entries b/arch/arm/mach-clps7500/CVS/Entries
deleted file mode 100644 (file)
index 407ba9c..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/core.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/arch/arm/mach-clps7500/CVS/Repository b/arch/arm/mach-clps7500/CVS/Repository
deleted file mode 100644 (file)
index c84d390..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-clps7500
diff --git a/arch/arm/mach-clps7500/CVS/Root b/arch/arm/mach-clps7500/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-ebsa110/CVS/Entries b/arch/arm/mach-ebsa110/CVS/Entries
deleted file mode 100644 (file)
index 23c9421..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/core.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/io.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/mach-ebsa110/CVS/Repository b/arch/arm/mach-ebsa110/CVS/Repository
deleted file mode 100644 (file)
index e236ca0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-ebsa110
diff --git a/arch/arm/mach-ebsa110/CVS/Root b/arch/arm/mach-ebsa110/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-epxa10db/CVS/Entries b/arch/arm/mach-epxa10db/CVS/Entries
deleted file mode 100644 (file)
index 0aa592b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/Kconfig/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/arch.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mm.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/time.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/arch/arm/mach-epxa10db/CVS/Repository b/arch/arm/mach-epxa10db/CVS/Repository
deleted file mode 100644 (file)
index 02e4e3f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-epxa10db
diff --git a/arch/arm/mach-epxa10db/CVS/Root b/arch/arm/mach-epxa10db/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-footbridge/CVS/Entries b/arch/arm/mach-footbridge/CVS/Entries
deleted file mode 100644 (file)
index a84f85c..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/Kconfig/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/arch.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/cats-hw.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/cats-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/dc21285.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ebsa285-leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ebsa285-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/isa-irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mm.c/1.2/Wed Jun  2 20:34:44 2004/-ko/
-/netwinder-hw.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/netwinder-leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/netwinder-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/personal-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/time.c/1.1.3.1/Mon Jul 19 17:05:42 2004/-ko/
-D
diff --git a/arch/arm/mach-footbridge/CVS/Repository b/arch/arm/mach-footbridge/CVS/Repository
deleted file mode 100644 (file)
index 2471325..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-footbridge
diff --git a/arch/arm/mach-footbridge/CVS/Root b/arch/arm/mach-footbridge/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 2c64a0b..5d02e95 100644 (file)
@@ -34,27 +34,12 @@ static int rtc_base;
 static unsigned long __init get_isa_cmos_time(void)
 {
        unsigned int year, mon, day, hour, min, sec;
-       int i;
 
        // check to see if the RTC makes sense.....
        if ((CMOS_READ(RTC_VALID) & RTC_VRT) == 0)
                return mktime(1970, 1, 1, 0, 0, 0);
 
-       /* The Linux interpretation of the CMOS clock register contents:
-        * When the Update-In-Progress (UIP) flag goes from 1 to 0, the
-        * RTC registers show the second which has precisely just started.
-        * Let's hope other operating systems interpret the RTC the same way.
-        */
-       /* read RTC exactly on falling edge of update flag */
-       for (i = 0 ; i < 1000000 ; i++) /* may take up to 1 second... */
-               if (CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP)
-                       break;
-
-       for (i = 0 ; i < 1000000 ; i++) /* must try at least 2.228 ms */
-               if (!(CMOS_READ(RTC_FREQ_SELECT) & RTC_UIP))
-                       break;
-
-       do { /* Isn't this overkill ? UIP above should guarantee consistency */
+       do {
                sec  = CMOS_READ(RTC_SECONDS);
                min  = CMOS_READ(RTC_MINUTES);
                hour = CMOS_READ(RTC_HOURS);
diff --git a/arch/arm/mach-ftvpci/CVS/Entries b/arch/arm/mach-ftvpci/CVS/Entries
deleted file mode 100644 (file)
index 1784810..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D
diff --git a/arch/arm/mach-ftvpci/CVS/Repository b/arch/arm/mach-ftvpci/CVS/Repository
deleted file mode 100644 (file)
index 29c1d69..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-ftvpci
diff --git a/arch/arm/mach-ftvpci/CVS/Root b/arch/arm/mach-ftvpci/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-integrator/CVS/Entries b/arch/arm/mach-integrator/CVS/Entries
deleted file mode 100644 (file)
index a7afe4e..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/Kconfig/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/Makefile/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/clock.c/1.1.3.1/Tue Jul 13 17:47:12 2004/-ko/
-/clock.h/1.1.3.1/Tue Jul 13 17:47:12 2004/-ko/
-/core.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/cpu.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/impd1.c/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/integrator_ap.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/integrator_cp.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/lm.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pci_v3.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/time.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/mach-integrator/CVS/Repository b/arch/arm/mach-integrator/CVS/Repository
deleted file mode 100644 (file)
index 659ff24..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-integrator
diff --git a/arch/arm/mach-integrator/CVS/Root b/arch/arm/mach-integrator/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-iop3xx/CVS/Entries b/arch/arm/mach-iop3xx/CVS/Entries
deleted file mode 100644 (file)
index 5141068..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/Kconfig/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/arch.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/iop310-irq.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-/iop310-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/iop321-irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/iop321-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/iop321-time.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/iq80310-irq.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-/iq80310-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/iq80310-time.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-/iq80321-pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mm-321.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-/mm.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-/xs80200-irq.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-D
diff --git a/arch/arm/mach-iop3xx/CVS/Repository b/arch/arm/mach-iop3xx/CVS/Repository
deleted file mode 100644 (file)
index de3a2df..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-iop3xx
diff --git a/arch/arm/mach-iop3xx/CVS/Root b/arch/arm/mach-iop3xx/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 084afcd..2feaf75 100644 (file)
@@ -21,7 +21,6 @@
 #include <asm/page.h>
 
 #include <asm/mach/map.h>
-#include <asm/mach-types.h>
 
 
 /*
index b9807aa..afc0676 100644 (file)
@@ -13,6 +13,8 @@
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/init.h>
+#include <linux/string.h>
+#include <linux/slab.h>
 
 #include <asm/hardware.h>
 #include <asm/irq.h>
@@ -68,12 +70,10 @@ static int iq80332_setup(int nr, struct pci_sys_data *sys)
        if(nr != 0)
                return 0;
 
-       res = kmalloc(sizeof(struct resource) * 2, GFP_KERNEL);
+       res = kzalloc(sizeof(struct resource) * 2, GFP_KERNEL);
        if (!res)
                panic("PCI: unable to alloc resources");
 
-       memset(res, 0, sizeof(struct resource) * 2);
-
        res[0].start = IOP331_PCI_LOWER_IO_VA;
        res[0].end   = IOP331_PCI_UPPER_IO_VA;
        res[0].name  = "IQ80332 PCI I/O Space";
diff --git a/arch/arm/mach-ixp4xx/CVS/Entries b/arch/arm/mach-ixp4xx/CVS/Entries
deleted file mode 100644 (file)
index 90e7cc4..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/Kconfig/1.1.3.2/Tue Jul 13 17:47:11 2004/-ko/
-/Makefile/1.1.3.1/Wed Jun  2 19:33:29 2004/-ko/
-/common-pci.c/1.1.3.2/Wed Sep 15 03:52:49 2004/-ko/
-/common.c/1.1.3.2/Mon Jul 19 17:05:41 2004/-ko/
-/coyote-pci.c/1.1.3.1/Wed Jun  2 19:33:29 2004/-ko/
-/coyote-setup.c/1.1.3.3/Wed Sep 15 03:52:49 2004/-ko/
-/ixdp425-pci.c/1.1.3.1/Wed Jun  2 19:33:29 2004/-ko/
-/ixdp425-setup.c/1.1.3.3/Wed Sep 15 03:52:49 2004/-ko/
-/prpmc1100-pci.c/1.1.3.1/Wed Jun  2 19:33:29 2004/-ko/
-/prpmc1100-setup.c/1.1.3.3/Wed Sep 15 03:52:49 2004/-ko/
-D
diff --git a/arch/arm/mach-ixp4xx/CVS/Repository b/arch/arm/mach-ixp4xx/CVS/Repository
deleted file mode 100644 (file)
index 903576c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-ixp4xx
diff --git a/arch/arm/mach-ixp4xx/CVS/Root b/arch/arm/mach-ixp4xx/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-l7200/CVS/Entries b/arch/arm/mach-l7200/CVS/Entries
deleted file mode 100644 (file)
index 68988e8..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/core.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/mach-l7200/CVS/Repository b/arch/arm/mach-l7200/CVS/Repository
deleted file mode 100644 (file)
index 9dc7a7e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-l7200
diff --git a/arch/arm/mach-l7200/CVS/Root b/arch/arm/mach-l7200/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-lh7a40x/CVS/Entries b/arch/arm/mach-lh7a40x/CVS/Entries
deleted file mode 100644 (file)
index 5fef233..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/Kconfig/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/arch-kev7a400.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/arch-lpd7a40x.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/fiq.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ide-lpd7a40x.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq-kev7a400.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq-lh7a400.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq-lh7a404.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq-lpd7a40x.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/time.c/1.1.3.1/Mon Jul 19 17:05:45 2004/-ko/
-D
diff --git a/arch/arm/mach-lh7a40x/CVS/Repository b/arch/arm/mach-lh7a40x/CVS/Repository
deleted file mode 100644 (file)
index d6b9866..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-lh7a40x
diff --git a/arch/arm/mach-lh7a40x/CVS/Root b/arch/arm/mach-lh7a40x/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-omap/CVS/Entries b/arch/arm/mach-omap/CVS/Entries
deleted file mode 100644 (file)
index d521935..0000000
+++ /dev/null
@@ -1,22 +0,0 @@
-/Kconfig/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/board-generic.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/board-innovator.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/board-osk.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/board-perseus2.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/bus.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/clocks.c/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/common.c/1.1.1.2/Mon Jul 12 21:55:40 2004/-ko/
-/common.h/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/dma.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/fpga.c/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/gpio.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/irq.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/leds-innovator.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-perseus2.c/1.2/Wed Jun  2 20:34:45 2004/-ko/
-/leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mux.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ocpi.c/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/time.c/1.1.3.1/Mon Jul 19 17:05:44 2004/-ko/
-D
diff --git a/arch/arm/mach-omap/CVS/Repository b/arch/arm/mach-omap/CVS/Repository
deleted file mode 100644 (file)
index dff327f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-omap
diff --git a/arch/arm/mach-omap/CVS/Root b/arch/arm/mach-omap/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-pxa/CVS/Entries b/arch/arm/mach-pxa/CVS/Entries
deleted file mode 100644 (file)
index 822c5a4..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/Kconfig/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/Makefile/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/dma.c/1.2/Wed Jun  2 20:34:46 2004/-ko/
-/generic.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/generic.h/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/idp.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/leds-idp.c/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/leds-lubbock.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/leds-mainstone.c/1.1.3.2/Tue Jul 13 17:47:12 2004/-ko/
-/leds.c/1.2/Wed Jun  2 20:34:46 2004/-ko/
-/leds.h/1.2/Wed Jun  2 20:34:46 2004/-ko/
-/lubbock.c/1.4/Tue Jul 20 15:33:00 2004/-ko/
-/mainstone.c/1.1.3.3/Mon Jul 19 17:05:42 2004/-ko/
-/pm.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/pxa25x.c/1.1.3.2/Tue Jun  8 17:10:27 2004/-ko/
-/pxa27x.c/1.1.3.2/Tue Jun  8 17:10:27 2004/-ko/
-/sleep.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/time.c/1.1.3.1/Mon Jul 19 17:05:42 2004/-ko/
-D
diff --git a/arch/arm/mach-pxa/CVS/Repository b/arch/arm/mach-pxa/CVS/Repository
deleted file mode 100644 (file)
index 28387bf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-pxa
diff --git a/arch/arm/mach-pxa/CVS/Root b/arch/arm/mach-pxa/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-rpc/CVS/Entries b/arch/arm/mach-rpc/CVS/Entries
deleted file mode 100644 (file)
index 614819f..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/riscpc.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/arch/arm/mach-rpc/CVS/Repository b/arch/arm/mach-rpc/CVS/Repository
deleted file mode 100644 (file)
index b85025f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-rpc
diff --git a/arch/arm/mach-rpc/CVS/Root b/arch/arm/mach-rpc/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-s3c2410/CVS/Entries b/arch/arm/mach-s3c2410/CVS/Entries
deleted file mode 100644 (file)
index 68a4e33..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/Kconfig/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/Makefile/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/bast-irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/bast.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/gpio.c/1.1.3.1/Wed Sep 15 03:52:50 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mach-bast.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/mach-h1940.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/mach-smdk2410.c/1.1.3.3/Wed Sep 15 03:52:50 2004/-ko/
-/mach-vr1000.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/s3c2410.c/1.2/Wed Jun  2 20:34:46 2004/-ko/
-/s3c2410.h/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/time.c/1.1.3.1/Mon Jul 19 17:05:42 2004/-ko/
-D
diff --git a/arch/arm/mach-s3c2410/CVS/Repository b/arch/arm/mach-s3c2410/CVS/Repository
deleted file mode 100644 (file)
index 6eaf6cd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-s3c2410
diff --git a/arch/arm/mach-s3c2410/CVS/Root b/arch/arm/mach-s3c2410/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 94f1776..cd39e86 100644 (file)
@@ -30,6 +30,8 @@
  *     04-Oct-2004  BJD  Added irq filter controls for GPIO
  *     05-Nov-2004  BJD  EXPORT_SYMBOL() added for all code
  *     13-Mar-2005  BJD  Updates for __iomem
+ *     26-Oct-2005  BJD  Added generic configuration types
+ *     15-Jan-2006  LCVR Added support for the S3C2400
  */
 
 
@@ -47,7 +49,7 @@
 
 void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function)
 {
-       void __iomem *base = S3C2410_GPIO_BASE(pin);
+       void __iomem *base = S3C24XX_GPIO_BASE(pin);
        unsigned long mask;
        unsigned long con;
        unsigned long flags;
@@ -58,6 +60,27 @@ void s3c2410_gpio_cfgpin(unsigned int pin, unsigned int function)
                mask = 3 << S3C2410_GPIO_OFFSET(pin)*2;
        }
 
+       switch (function) {
+       case S3C2410_GPIO_LEAVE:
+               mask = 0;
+               function = 0;
+               break;
+
+       case S3C2410_GPIO_INPUT:
+       case S3C2410_GPIO_OUTPUT:
+       case S3C2410_GPIO_SFN2:
+       case S3C2410_GPIO_SFN3:
+               if (pin < S3C2410_GPIO_BANKB) {
+                       function &= 1;
+                       function <<= S3C2410_GPIO_OFFSET(pin);
+               } else {
+                       function &= 3;
+                       function <<= S3C2410_GPIO_OFFSET(pin)*2;
+               }
+       }
+
+       /* modify the specified register wwith IRQs off */
+
        local_irq_save(flags);
 
        con  = __raw_readl(base + 0x00);
@@ -73,7 +96,7 @@ EXPORT_SYMBOL(s3c2410_gpio_cfgpin);
 
 unsigned int s3c2410_gpio_getcfg(unsigned int pin)
 {
-       void __iomem *base = S3C2410_GPIO_BASE(pin);
+       void __iomem *base = S3C24XX_GPIO_BASE(pin);
        unsigned long mask;
 
        if (pin < S3C2410_GPIO_BANKB) {
@@ -89,7 +112,7 @@ EXPORT_SYMBOL(s3c2410_gpio_getcfg);
 
 void s3c2410_gpio_pullup(unsigned int pin, unsigned int to)
 {
-       void __iomem *base = S3C2410_GPIO_BASE(pin);
+       void __iomem *base = S3C24XX_GPIO_BASE(pin);
        unsigned long offs = S3C2410_GPIO_OFFSET(pin);
        unsigned long flags;
        unsigned long up;
@@ -111,7 +134,7 @@ EXPORT_SYMBOL(s3c2410_gpio_pullup);
 
 void s3c2410_gpio_setpin(unsigned int pin, unsigned int to)
 {
-       void __iomem *base = S3C2410_GPIO_BASE(pin);
+       void __iomem *base = S3C24XX_GPIO_BASE(pin);
        unsigned long offs = S3C2410_GPIO_OFFSET(pin);
        unsigned long flags;
        unsigned long dat;
@@ -130,7 +153,7 @@ EXPORT_SYMBOL(s3c2410_gpio_setpin);
 
 unsigned int s3c2410_gpio_getpin(unsigned int pin)
 {
-       void __iomem *base = S3C2410_GPIO_BASE(pin);
+       void __iomem *base = S3C24XX_GPIO_BASE(pin);
        unsigned long offs = S3C2410_GPIO_OFFSET(pin);
 
        return __raw_readl(base + 0x04) & (1<< offs);
@@ -144,70 +167,13 @@ unsigned int s3c2410_modify_misccr(unsigned int clear, unsigned int change)
        unsigned long misccr;
 
        local_irq_save(flags);
-       misccr = __raw_readl(S3C2410_MISCCR);
+       misccr = __raw_readl(S3C24XX_MISCCR);
        misccr &= ~clear;
        misccr ^= change;
-       __raw_writel(misccr, S3C2410_MISCCR);
+       __raw_writel(misccr, S3C24XX_MISCCR);
        local_irq_restore(flags);
 
        return misccr;
 }
 
 EXPORT_SYMBOL(s3c2410_modify_misccr);
-
-int s3c2410_gpio_getirq(unsigned int pin)
-{
-       if (pin < S3C2410_GPF0 || pin > S3C2410_GPG15_EINT23)
-               return -1;      /* not valid interrupts */
-
-       if (pin < S3C2410_GPG0 && pin > S3C2410_GPF7)
-               return -1;      /* not valid pin */
-
-       if (pin < S3C2410_GPF4)
-               return (pin - S3C2410_GPF0) + IRQ_EINT0;
-
-       if (pin < S3C2410_GPG0)
-               return (pin - S3C2410_GPF4) + IRQ_EINT4;
-
-       return (pin - S3C2410_GPG0) + IRQ_EINT8;
-}
-
-EXPORT_SYMBOL(s3c2410_gpio_getirq);
-
-int s3c2410_gpio_irqfilter(unsigned int pin, unsigned int on,
-                          unsigned int config)
-{
-       void __iomem *reg = S3C2410_EINFLT0;
-       unsigned long flags;
-       unsigned long val;
-
-       if (pin < S3C2410_GPG8 || pin > S3C2410_GPG15)
-               return -1;
-
-       config &= 0xff;
-
-       pin -= S3C2410_GPG8_EINT16;
-       reg += pin & ~3;
-
-       local_irq_save(flags);
-
-       /* update filter width and clock source */
-
-       val = __raw_readl(reg);
-       val &= ~(0xff << ((pin & 3) * 8));
-       val |= config << ((pin & 3) * 8);
-       __raw_writel(val, reg);
-
-       /* update filter enable */
-
-       val = __raw_readl(S3C2410_EXTINT2);
-       val &= ~(1 << ((pin * 4) + 3));
-       val |= on << ((pin * 4) + 3);
-       __raw_writel(val, S3C2410_EXTINT2);
-
-       local_irq_restore(flags);
-
-       return 0;
-}
-
-EXPORT_SYMBOL(s3c2410_gpio_irqfilter);
index bd15998..116ac31 100644 (file)
@@ -20,7 +20,7 @@
 #include <linux/timer.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/kthread.h>
 
 #include <asm/mach/arch.h>
@@ -97,7 +97,7 @@ static struct s3c24xx_board n30_board __initdata = {
        .devices_count = ARRAY_SIZE(n30_devices)
 };
 
-void __init n30_map_io(void)
+static void __init n30_map_io(void)
 {
        s3c24xx_init_io(n30_iodesc, ARRAY_SIZE(n30_iodesc));
        s3c24xx_init_clocks(0);
@@ -105,42 +105,32 @@ void __init n30_map_io(void)
        s3c24xx_set_board(&n30_board);
 }
 
-void __init n30_init_irq(void)
+static void __init n30_init_irq(void)
 {
        s3c24xx_init_irq();
 }
 
+/* GPB3 is the line that controls the pull-up for the USB D+ line */
 
-static int n30_usbstart_thread(void *unused)
+static void __init n30_init(void)
 {
+       s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
+
        /* Turn off suspend on both USB ports, and switch the
         * selectable USB port to USB device mode. */
-       writel(readl(S3C2410_MISCCR) & ~0x00003008, S3C2410_MISCCR);
-
-       /* Turn off the D+ pull up for 3 seconds so that the USB host
-        * at the other end will do a rescan of the USB bus.  */
-       s3c2410_gpio_setpin(S3C2410_GPB3, 0);
-
-       msleep_interruptible(3*HZ);
-
-       s3c2410_gpio_setpin(S3C2410_GPB3, 1);
-
-       return 0;
-}
-
-
-void __init n30_init(void)
-{
-       s3c_device_i2c.dev.platform_data = &n30_i2ccfg;
 
-       kthread_run(n30_usbstart_thread, NULL, "n30_usbstart");
+       s3c2410_modify_misccr(S3C2410_MISCCR_USBHOST |
+                             S3C2410_MISCCR_USBSUSPND0 |
+                             S3C2410_MISCCR_USBSUSPND1, 0x0);
 }
 
 MACHINE_START(N30, "Acer-N30")
-     MAINTAINER("Christer Weinigel <christer@weinigel.se>, Ben Dooks <ben-linux@fluff.org>")
-     BOOT_MEM(S3C2410_SDRAM_PA, S3C2410_PA_UART, (u32)S3C24XX_VA_UART)
-     BOOT_PARAMS(S3C2410_SDRAM_PA + 0x100)
-
+       /* Maintainer: Christer Weinigel <christer@weinigel.se>,
+                               Ben Dooks <ben-linux@fluff.org>
+       */
+       .phys_io        = S3C2410_PA_UART,
+       .io_pg_offst    = (((u32)S3C24XX_VA_UART) >> 18) & 0xfffc,
+       .boot_params    = S3C2410_SDRAM_PA + 0x100,
        .timer          = &s3c24xx_timer,
        .init_machine   = n30_init,
        .init_irq       = n30_init_irq,
diff --git a/arch/arm/mach-sa1100/CVS/Entries b/arch/arm/mach-sa1100/CVS/Entries
deleted file mode 100644 (file)
index 2d2c311..0000000
+++ /dev/null
@@ -1,59 +0,0 @@
-/Kconfig/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/Makefile/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/adsbitsy.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/assabet.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/badge4.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/brutus.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/cerf.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/collie.c/1.1.3.2/Wed Sep 15 03:52:50 2004/-ko/
-/cpu-sa1100.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/cpu-sa1110.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/empeg.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/flexanet.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/freebird.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/generic.c/1.2/Wed Jun  2 20:34:46 2004/-ko/
-/generic.h/1.3/Tue Jul 20 15:33:00 2004/-ko/
-/graphicsclient.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/graphicsmaster.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/h3600.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/hackkit.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/huw_webpanel.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/itsy.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/jornada720.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/lart.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/leds-adsbitsy.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-assabet.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-badge4.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-brutus.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-cerf.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-flexanet.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-graphicsclient.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-graphicsmaster.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-hackkit.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-lart.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-pfs168.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-simpad.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds-system3.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/nanoengine.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/neponset.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/omnimeter.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/pangolin.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/pfs168.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/pleb.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/pm.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/shannon.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/sherman.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/simpad.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/sleep.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ssp.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/stork.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/system3.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/time.c/1.1.3.1/Mon Jul 19 17:05:42 2004/-ko/
-/trizeps.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/xp860.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/yopy.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/arch/arm/mach-sa1100/CVS/Repository b/arch/arm/mach-sa1100/CVS/Repository
deleted file mode 100644 (file)
index df53917..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-sa1100
diff --git a/arch/arm/mach-sa1100/CVS/Root b/arch/arm/mach-sa1100/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-shark/CVS/Entries b/arch/arm/mach-shark/CVS/Entries
deleted file mode 100644 (file)
index 04af3a8..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/core.c/1.2/Tue Jul 20 15:33:00 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/leds.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/pci.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/mach-shark/CVS/Repository b/arch/arm/mach-shark/CVS/Repository
deleted file mode 100644 (file)
index 4e92d0e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-shark
diff --git a/arch/arm/mach-shark/CVS/Root b/arch/arm/mach-shark/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-tbox/CVS/Entries b/arch/arm/mach-tbox/CVS/Entries
deleted file mode 100644 (file)
index 1784810..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D
diff --git a/arch/arm/mach-tbox/CVS/Repository b/arch/arm/mach-tbox/CVS/Repository
deleted file mode 100644 (file)
index cab1a50..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-tbox
diff --git a/arch/arm/mach-tbox/CVS/Root b/arch/arm/mach-tbox/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mach-versatile/CVS/Entries b/arch/arm/mach-versatile/CVS/Entries
deleted file mode 100644 (file)
index 0d6fb7a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/clock.c/1.1.3.2/Mon Jul 19 17:05:46 2004/-ko/
-/clock.h/1.1.3.1/Tue Jul 13 17:47:14 2004/-ko/
-/core.c/1.3/Tue Jul 20 15:33:00 2004/-ko/
-D
diff --git a/arch/arm/mach-versatile/CVS/Repository b/arch/arm/mach-versatile/CVS/Repository
deleted file mode 100644 (file)
index 6fc6034..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mach-versatile
diff --git a/arch/arm/mach-versatile/CVS/Root b/arch/arm/mach-versatile/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/mm/CVS/Entries b/arch/arm/mm/CVS/Entries
deleted file mode 100644 (file)
index deef0fa..0000000
+++ /dev/null
@@ -1,55 +0,0 @@
-/Kconfig/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/abort-ev4.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/abort-ev4t.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/abort-ev5t.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/abort-ev5tj.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/abort-ev6.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/abort-lv4t.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/alignment.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/blockops.c/1.2/Wed Jun  2 20:34:47 2004/-ko/
-/cache-v3.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/cache-v4.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/cache-v4wb.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/cache-v4wt.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/cache-v6.S/1.2/Wed Jun  2 20:34:47 2004/-ko/
-/consistent.c/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/copypage-v3.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/copypage-v4mc.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/copypage-v4wb.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/copypage-v4wt.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/copypage-v6.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/copypage-xscale.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/discontig.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/extable.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fault-armv.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/fault.c/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/fault.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/init.c/1.4/Tue Jul 20 15:33:01 2004/-ko/
-/ioremap.c/1.2/Wed Jun  2 20:34:48 2004/-ko/
-/minicache.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mm-armv.c/1.2/Wed Jun  2 20:34:48 2004/-ko/
-/mmap.c/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/mmu.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm1020.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm1020e.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm1022.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm1026.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm6_7.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm720.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm920.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm922.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm925.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-arm926.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-macros.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-sa110.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-sa1100.S/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/proc-syms.c/1.1.1.2/Mon Jul 12 21:55:39 2004/-ko/
-/proc-v6.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/proc-xscale.S/1.2/Wed Jun  2 20:34:48 2004/-ko/
-/tlb-v3.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/tlb-v4.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/tlb-v4wb.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/tlb-v4wbi.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/tlb-v6.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/mm/CVS/Repository b/arch/arm/mm/CVS/Repository
deleted file mode 100644 (file)
index 495a6db..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/mm
diff --git a/arch/arm/mm/CVS/Root b/arch/arm/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/nwfpe/CVS/Entries b/arch/arm/nwfpe/CVS/Entries
deleted file mode 100644 (file)
index 08afc0c..0000000
+++ /dev/null
@@ -1,26 +0,0 @@
-/ARM-gcc.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ChangeLog/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/double_cpdo.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/entry.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/entry26.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/extended_cpdo.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpa11.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpa11.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpa11.inl/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpa11_cpdo.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpa11_cpdt.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpa11_cprt.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpmodule.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpmodule.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpmodule.inl/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpopcode.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpopcode.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fpsr.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/milieu.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/single_cpdo.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/softfloat-macros/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/softfloat-specialize/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/softfloat.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/softfloat.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/nwfpe/CVS/Repository b/arch/arm/nwfpe/CVS/Repository
deleted file mode 100644 (file)
index 13443df..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/nwfpe
diff --git a/arch/arm/nwfpe/CVS/Root b/arch/arm/nwfpe/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/oprofile/CVS/Entries b/arch/arm/oprofile/CVS/Entries
deleted file mode 100644 (file)
index dee9862..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/Kconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/common.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/init.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/op_arm_model.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/op_counter.h/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/op_model_xscale.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/arm/oprofile/CVS/Repository b/arch/arm/oprofile/CVS/Repository
deleted file mode 100644 (file)
index 9636285..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/oprofile
diff --git a/arch/arm/oprofile/CVS/Root b/arch/arm/oprofile/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/tools/CVS/Entries b/arch/arm/tools/CVS/Entries
deleted file mode 100644 (file)
index 8dd3ba4..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/gen-mach-types/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/mach-types/1.2/Tue Jul 20 15:33:01 2004/-ko/
-D
diff --git a/arch/arm/tools/CVS/Repository b/arch/arm/tools/CVS/Repository
deleted file mode 100644 (file)
index 4989dec..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/tools
diff --git a/arch/arm/tools/CVS/Root b/arch/arm/tools/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm/vfp/CVS/Entries b/arch/arm/vfp/CVS/Entries
deleted file mode 100644 (file)
index 955b65b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-/entry.S/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-/vfp.h/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-/vfpdouble.c/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-/vfphw.S/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-/vfpinstr.h/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-/vfpmodule.c/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-/vfpsingle.c/1.1.3.1/Tue Jul 13 17:47:15 2004/-ko/
-D
diff --git a/arch/arm/vfp/CVS/Repository b/arch/arm/vfp/CVS/Repository
deleted file mode 100644 (file)
index 6588e3d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm/vfp
diff --git a/arch/arm/vfp/CVS/Root b/arch/arm/vfp/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index e73c8de..7b59554 100644 (file)
  */
 #include <linux/linkage.h>
 #include <linux/init.h>
-#include <asm/constants.h>
+#include <asm/asm-offsets.h>
+#include <asm/assembler.h>
 #include <asm/vfpmacros.h>
 
        .globl  do_vfp
 do_vfp:
+       enable_irq
        ldr     r4, .LCvfp
        add     r10, r10, #TI_VFPSTATE  @ r10 = workspace
        ldr     pc, [r4]                @ call VFP entry point
diff --git a/arch/arm26/CVS/Entries b/arch/arm26/CVS/Entries
deleted file mode 100644 (file)
index ea5f930..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/ACKNOWLEDGEMENTS/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/Kconfig/1.2/Thu Jun  3 22:32:16 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/defconfig/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D/boot////
-D/kernel////
-D/lib////
-D/machine////
-D/mm////
-D/nwfpe////
diff --git a/arch/arm26/CVS/Repository b/arch/arm26/CVS/Repository
deleted file mode 100644 (file)
index 9804469..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26
diff --git a/arch/arm26/CVS/Root b/arch/arm26/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm26/boot/CVS/Entries b/arch/arm26/boot/CVS/Entries
deleted file mode 100644 (file)
index 9aabed7..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/install.sh/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D/compressed////
diff --git a/arch/arm26/boot/CVS/Repository b/arch/arm26/boot/CVS/Repository
deleted file mode 100644 (file)
index 2c84d75..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26/boot
diff --git a/arch/arm26/boot/CVS/Root b/arch/arm26/boot/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm26/boot/compressed/CVS/Entries b/arch/arm26/boot/compressed/CVS/Entries
deleted file mode 100644 (file)
index e6c4aff..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/hw-bse.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ll_char_wr.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/misc.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ofw-shark.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/uncompress.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/vmlinux.lds.in/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/arm26/boot/compressed/CVS/Repository b/arch/arm26/boot/compressed/CVS/Repository
deleted file mode 100644 (file)
index a723a25..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26/boot/compressed
diff --git a/arch/arm26/boot/compressed/CVS/Root b/arch/arm26/boot/compressed/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm26/kernel/CVS/Entries b/arch/arm26/kernel/CVS/Entries
deleted file mode 100644 (file)
index 21b2415..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/armksyms.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/asm-offsets.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/compat.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ecard.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/entry.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fiq.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/init_task.c/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/irq.c/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/process.c/1.2/Wed Jun  2 20:34:48 2004/-ko/
-/ptrace.c/1.2/Thu Jun  3 22:32:16 2004/-ko/
-/ptrace.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/semaphore.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/setup.c/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/signal.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/sys_arm.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/time-acorn.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/time.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/traps.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/vmlinux-arm26-xip.lds.in/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/vmlinux-arm26.lds.in/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/vmlinux.lds.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/arm26/kernel/CVS/Repository b/arch/arm26/kernel/CVS/Repository
deleted file mode 100644 (file)
index 1e4e1c7..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26/kernel
diff --git a/arch/arm26/kernel/CVS/Root b/arch/arm26/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm26/lib/CVS/Entries b/arch/arm26/lib/CVS/Entries
deleted file mode 100644 (file)
index 3d58621..0000000
+++ /dev/null
@@ -1,46 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ashldi3.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ashrdi3.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/backtrace.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/changebit.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/clearbit.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/copy_page.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/csumipv6.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/csumpartial.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/csumpartialcopy.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/csumpartialcopygeneric.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/csumpartialcopyuser.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/delay.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ecard.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/findbit.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/floppydma.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/gcclib.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/getuser.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/io-acorn.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/io-readsb.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/io-readsl-armv3.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/io-readsw-armv3.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/io-writesb.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/io-writesl.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/io-writesw-armv3.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/kbd.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/lib1funcs.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/longlong.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/lshrdi3.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/memchr.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/memcpy.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/memset.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/memzero.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/muldi3.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/putuser.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/setbit.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/strchr.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/strrchr.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/testchangebit.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/testclearbit.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/testsetbit.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/uaccess-kernel.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/uaccess-user.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ucmpdi2.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/udivdi3.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/arm26/lib/CVS/Repository b/arch/arm26/lib/CVS/Repository
deleted file mode 100644 (file)
index c327be4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26/lib
diff --git a/arch/arm26/lib/CVS/Root b/arch/arm26/lib/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm26/machine/CVS/Entries b/arch/arm26/machine/CVS/Entries
deleted file mode 100644 (file)
index 2fc6ea2..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/dma.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/oldlatches.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/small_page.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/arm26/machine/CVS/Repository b/arch/arm26/machine/CVS/Repository
deleted file mode 100644 (file)
index 973e134..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26/machine
diff --git a/arch/arm26/machine/CVS/Root b/arch/arm26/machine/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/arm26/mm/CVS/Entries b/arch/arm26/mm/CVS/Entries
deleted file mode 100644 (file)
index e7b1602..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/extable.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fault.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fault.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/init.c/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/mm-memc.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/proc-funcs.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/arm26/mm/CVS/Repository b/arch/arm26/mm/CVS/Repository
deleted file mode 100644 (file)
index accb4c8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26/mm
diff --git a/arch/arm26/mm/CVS/Root b/arch/arm26/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 8e8a2bb..34def63 100644 (file)
@@ -78,12 +78,6 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
        if (!new_pgd)
                goto no_pgd;
 
-       /*
-        * This lock is here just to satisfy pmd_alloc and pte_lock
-         * FIXME: I bet we could avoid taking it pretty much altogether
-        */
-       spin_lock(&mm->page_table_lock);
-
        /*
         * On ARM, first page must always be allocated since it contains
         * the machine vectors.
@@ -92,7 +86,7 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
        if (!new_pmd)
                goto no_pmd;
 
-       new_pte = pte_alloc_kernel(mm, new_pmd, 0);
+       new_pte = pte_alloc_map(mm, new_pmd, 0);
        if (!new_pte)
                goto no_pte;
 
@@ -101,6 +95,7 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
        init_pte = pte_offset(init_pmd, 0);
 
        set_pte(new_pte, *init_pte);
+       pte_unmap(new_pte);
 
        /*
         * the page table entries are zeroed
@@ -112,23 +107,14 @@ pgd_t *get_pgd_slow(struct mm_struct *mm)
        memcpy(new_pgd + FIRST_KERNEL_PGD_NR, init_pgd + FIRST_KERNEL_PGD_NR,
                (PTRS_PER_PGD - FIRST_KERNEL_PGD_NR) * sizeof(pgd_t));
 
-       spin_unlock(&mm->page_table_lock);
-
        /* update MEMC tables */
        cpu_memc_update_all(new_pgd);
        return new_pgd;
 
 no_pte:
-       spin_unlock(&mm->page_table_lock);
        pmd_free(new_pmd);
-       free_pgd_slow(new_pgd);
-       return NULL;
-
 no_pmd:
-       spin_unlock(&mm->page_table_lock);
        free_pgd_slow(new_pgd);
-       return NULL;
-
 no_pgd:
        return NULL;
 }
diff --git a/arch/arm26/nwfpe/CVS/Entries b/arch/arm26/nwfpe/CVS/Entries
deleted file mode 100644 (file)
index d7df09f..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-/ARM-gcc.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ChangeLog/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/double_cpdo.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/entry.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/extended_cpdo.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpa11.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpa11.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpa11.inl/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpa11_cpdo.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpa11_cpdt.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpa11_cprt.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpmodule.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpmodule.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpmodule.inl/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpopcode.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpopcode.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpsr.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/milieu.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/single_cpdo.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/softfloat-macros/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/softfloat-specialize/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/softfloat.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/softfloat.h/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/arm26/nwfpe/CVS/Repository b/arch/arm26/nwfpe/CVS/Repository
deleted file mode 100644 (file)
index 816c0c2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/arm26/nwfpe
diff --git a/arch/arm26/nwfpe/CVS/Root b/arch/arm26/nwfpe/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/CVS/Entries b/arch/cris/CVS/Entries
deleted file mode 100644 (file)
index 50c74c2..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Kconfig/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/Makefile/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/defconfig/1.2/Tue Jun  8 21:22:58 2004/-ko/
-D/arch-v10////
-D/kernel////
-D/mm////
diff --git a/arch/cris/CVS/Repository b/arch/cris/CVS/Repository
deleted file mode 100644 (file)
index fb40250..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris
diff --git a/arch/cris/CVS/Root b/arch/cris/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/CVS/Entries b/arch/cris/arch-v10/CVS/Entries
deleted file mode 100644 (file)
index af43773..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/Kconfig/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/README.mm/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/defconfig/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/output_arch.ld/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/vmlinux.lds.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D/boot////
-D/drivers////
-D/kernel////
-D/lib////
-D/mm////
diff --git a/arch/cris/arch-v10/CVS/Repository b/arch/cris/arch-v10/CVS/Repository
deleted file mode 100644 (file)
index e395077..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10
diff --git a/arch/cris/arch-v10/CVS/Root b/arch/cris/arch-v10/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/boot/CVS/Entries b/arch/cris/arch-v10/boot/CVS/Entries
deleted file mode 100644 (file)
index b8f96dd..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D/compressed////
-D/rescue////
-D/tools////
diff --git a/arch/cris/arch-v10/boot/CVS/Repository b/arch/cris/arch-v10/boot/CVS/Repository
deleted file mode 100644 (file)
index 7c67c8b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/boot
diff --git a/arch/cris/arch-v10/boot/CVS/Root b/arch/cris/arch-v10/boot/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/boot/compressed/CVS/Entries b/arch/cris/arch-v10/boot/compressed/CVS/Entries
deleted file mode 100644 (file)
index a7c880a..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/decompress.ld/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/misc.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-D
diff --git a/arch/cris/arch-v10/boot/compressed/CVS/Repository b/arch/cris/arch-v10/boot/compressed/CVS/Repository
deleted file mode 100644 (file)
index 4a682a1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/boot/compressed
diff --git a/arch/cris/arch-v10/boot/compressed/CVS/Root b/arch/cris/arch-v10/boot/compressed/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/boot/rescue/CVS/Entries b/arch/cris/arch-v10/boot/rescue/CVS/Entries
deleted file mode 100644 (file)
index aa4e433..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/kimagerescue.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/rescue.ld/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/testrescue.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/cris/arch-v10/boot/rescue/CVS/Repository b/arch/cris/arch-v10/boot/rescue/CVS/Repository
deleted file mode 100644 (file)
index edda05a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/boot/rescue
diff --git a/arch/cris/arch-v10/boot/rescue/CVS/Root b/arch/cris/arch-v10/boot/rescue/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/boot/tools/CVS/Entries b/arch/cris/arch-v10/boot/tools/CVS/Entries
deleted file mode 100644 (file)
index 007ace7..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/build.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/cris/arch-v10/boot/tools/CVS/Repository b/arch/cris/arch-v10/boot/tools/CVS/Repository
deleted file mode 100644 (file)
index 59501d6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/boot/tools
diff --git a/arch/cris/arch-v10/boot/tools/CVS/Root b/arch/cris/arch-v10/boot/tools/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/drivers/CVS/Entries b/arch/cris/arch-v10/drivers/CVS/Entries
deleted file mode 100644 (file)
index 207d865..0000000
+++ /dev/null
@@ -1,14 +0,0 @@
-/Kconfig/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/Makefile/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/axisflashmap.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/ds1302.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/eeprom.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/ethernet.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/gpio.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/i2c.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/i2c.h/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/ide.c/1.1.3.1/Tue Jun  8 17:10:01 2004/-ko/
-/pcf8563.c/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/serial.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/serial.h/1.2/Tue Jun  8 21:22:58 2004/-ko/
-D
diff --git a/arch/cris/arch-v10/drivers/CVS/Repository b/arch/cris/arch-v10/drivers/CVS/Repository
deleted file mode 100644 (file)
index 7bd21a2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/drivers
diff --git a/arch/cris/arch-v10/drivers/CVS/Root b/arch/cris/arch-v10/drivers/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/kernel/CVS/Entries b/arch/cris/arch-v10/kernel/CVS/Entries
deleted file mode 100644 (file)
index 7107cc5..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/asm-offsets.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/debugport.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/entry.S/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/fasttimer.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/head.S/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/irq.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/kgdb.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/process.c/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/ptrace.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/setup.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/shadows.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/signal.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/time.c/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/traps.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/cris/arch-v10/kernel/CVS/Repository b/arch/cris/arch-v10/kernel/CVS/Repository
deleted file mode 100644 (file)
index 0c1368a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/kernel
diff --git a/arch/cris/arch-v10/kernel/CVS/Root b/arch/cris/arch-v10/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/lib/CVS/Entries b/arch/cris/arch-v10/lib/CVS/Entries
deleted file mode 100644 (file)
index 5d6f120..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/checksum.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/checksumcopy.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/csumcpfruser.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/dmacopy.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/dram_init.S/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/hw_settings.S/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/memset.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/old_checksum.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/string.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/usercopy.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/cris/arch-v10/lib/CVS/Repository b/arch/cris/arch-v10/lib/CVS/Repository
deleted file mode 100644 (file)
index d89d473..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/lib
diff --git a/arch/cris/arch-v10/lib/CVS/Root b/arch/cris/arch-v10/lib/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/arch-v10/mm/CVS/Entries b/arch/cris/arch-v10/mm/CVS/Entries
deleted file mode 100644 (file)
index df962dd..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fault.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/init.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/tlb.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-D
diff --git a/arch/cris/arch-v10/mm/CVS/Repository b/arch/cris/arch-v10/mm/CVS/Repository
deleted file mode 100644 (file)
index 429e886..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/arch-v10/mm
diff --git a/arch/cris/arch-v10/mm/CVS/Root b/arch/cris/arch-v10/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/kernel/CVS/Entries b/arch/cris/kernel/CVS/Entries
deleted file mode 100644 (file)
index 7c7e6e3..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/Makefile/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/crisksyms.c/1.1.3.1/Tue Jun  8 17:10:02 2004//
-/irq.c/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/module.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/process.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/ptrace.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/semaphore.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/setup.c/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/sys_cris.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/time.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/traps.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-D
diff --git a/arch/cris/kernel/CVS/Repository b/arch/cris/kernel/CVS/Repository
deleted file mode 100644 (file)
index 6a08208..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/kernel
diff --git a/arch/cris/kernel/CVS/Root b/arch/cris/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/cris/mm/CVS/Entries b/arch/cris/mm/CVS/Entries
deleted file mode 100644 (file)
index 588114f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fault.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/init.c/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/ioremap.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/tlb.c/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D
diff --git a/arch/cris/mm/CVS/Repository b/arch/cris/mm/CVS/Repository
deleted file mode 100644 (file)
index 3ca278e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/cris/mm
diff --git a/arch/cris/mm/CVS/Root b/arch/cris/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 54046d2..d163747 100644 (file)
@@ -81,7 +81,7 @@ endif
 # - reserve CC3 for use with atomic ops
 # - all the extra registers are dealt with only at context switch time
 CFLAGS         += -mno-fdpic -mgpr-32 -msoft-float -mno-media
-CFLAGS         += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15
+CFLAGS         += -ffixed-fcc3 -ffixed-cc3 -ffixed-gr15 -ffixed-icc2
 AFLAGS         += -mno-fdpic
 ASFLAGS                += -mno-fdpic
 
@@ -109,10 +109,10 @@ bootstrap:
        $(Q)$(MAKEBOOT) bootstrap
 
 archmrproper:
-       $(Q)$(MAKE) -C arch/frv/boot mrproper
+       $(Q)$(MAKE) $(build)=arch/frv/boot mrproper
 
 archclean:
-       $(Q)$(MAKE) -C arch/frv/boot clean
+       $(Q)$(MAKE) $(build)=arch/frv/boot clean
 
 archdep: scripts/mkdep symlinks
-       $(Q)$(MAKE) -C arch/frv/boot dep
+       $(Q)$(MAKE) $(build)=arch/frv/boot dep
index d75e0d7..5dfc93f 100644 (file)
@@ -57,10 +57,10 @@ initrd:
 # installation
 #
 install: $(CONFIGURE) Image
-       sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
+       sh ./install.sh $(KERNELRELEASE) Image $(TOPDIR)/System.map "$(INSTALL_PATH)"
 
 zinstall: $(CONFIGURE) zImage
-       sh ./install.sh $(VERSION).$(PATCHLEVEL).$(SUBLEVEL)$(EXTRAVERSION) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
+       sh ./install.sh $(KERNELRELEASE) zImage $(TOPDIR)/System.map "$(INSTALL_PATH)"
 
 #
 # miscellany
index 981c2c7..5a827b3 100644 (file)
@@ -20,3 +20,5 @@ obj-$(CONFIG_FUJITSU_MB93493) += irq-mb93493.o
 obj-$(CONFIG_PM)               += pm.o cmode.o
 obj-$(CONFIG_MB93093_PDK)      += pm-mb93093.o
 obj-$(CONFIG_SYSCTL)           += sysctl.o
+obj-$(CONFIG_FUTEX)            += futex.o
+obj-$(CONFIG_MODULES)          += module.o
index fceafd2..f474534 100644 (file)
@@ -112,6 +112,7 @@ SECTIONS
 #endif
        )
        SCHED_TEXT
+       LOCK_TEXT
        *(.fixup)
        *(.gnu.warning)
        *(.exitcall.exit)
index 7bf5bd6..20e7dfc 100644 (file)
@@ -33,6 +33,7 @@
 
 #include <net/checksum.h>
 #include <asm/checksum.h>
+#include <linux/module.h>
 
 static inline unsigned short from32to16(unsigned long x)
 {
@@ -115,34 +116,52 @@ unsigned int csum_partial(const unsigned char * buff, int len, unsigned int sum)
        return result;
 }
 
+EXPORT_SYMBOL(csum_partial);
+
 /*
  * this routine is used for miscellaneous IP-like checksums, mainly
  * in icmp.c
  */
 unsigned short ip_compute_csum(const unsigned char * buff, int len)
 {
-       return ~do_csum(buff,len);
+       return ~do_csum(buff, len);
 }
 
+EXPORT_SYMBOL(ip_compute_csum);
+
 /*
  * copy from fs while checksumming, otherwise like csum_partial
  */
-
 unsigned int
-csum_partial_copy_from_user(const char *src, char *dst, int len, int sum, int *csum_err)
+csum_partial_copy_from_user(const char __user *src, char *dst,
+                           int len, int sum, int *csum_err)
 {
-       if (csum_err) *csum_err = 0;
-       memcpy(dst, src, len);
+       int rem;
+
+       if (csum_err)
+               *csum_err = 0;
+
+       rem = copy_from_user(dst, src, len);
+       if (rem != 0) {
+               if (csum_err)
+                       *csum_err = -EFAULT;
+               memset(dst + len - rem, 0, rem);
+               len = rem;
+       }
+
        return csum_partial(dst, len, sum);
 }
 
+EXPORT_SYMBOL(csum_partial_copy_from_user);
+
 /*
  * copy from ds while checksumming, otherwise like csum_partial
  */
-
 unsigned int
 csum_partial_copy(const char *src, char *dst, int len, int sum)
 {
        memcpy(dst, src, len);
        return csum_partial(dst, len, sum);
 }
+
+EXPORT_SYMBOL(csum_partial_copy);
index 41d02ac..8b3eb50 100644 (file)
@@ -163,13 +163,13 @@ asmlinkage void do_page_fault(int datammu, unsigned long esr0, unsigned long ear
         * the fault.
         */
        switch (handle_mm_fault(mm, vma, ear0, write)) {
-       case 1:
+       case VM_FAULT_MINOR:
                current->min_flt++;
                break;
-       case 2:
+       case VM_FAULT_MAJOR:
                current->maj_flt++;
                break;
-       case 0:
+       case VM_FAULT_SIGBUS:
                goto do_sigbus;
        default:
                goto out_of_memory;
index 4eaec0f..f76dd03 100644 (file)
@@ -85,19 +85,19 @@ static inline void pgd_list_add(pgd_t *pgd)
        struct page *page = virt_to_page(pgd);
        page->index = (unsigned long) pgd_list;
        if (pgd_list)
-               pgd_list->private = (unsigned long) &page->index;
+               set_page_private(pgd_list, (unsigned long) &page->index);
        pgd_list = page;
-       page->private = (unsigned long) &pgd_list;
+       set_page_private(page, (unsigned long)&pgd_list);
 }
 
 static inline void pgd_list_del(pgd_t *pgd)
 {
        struct page *next, **pprev, *page = virt_to_page(pgd);
        next = (struct page *) page->index;
-       pprev = (struct page **) page->private;
+       pprev = (struct page **) page_private(page);
        *pprev = next;
        if (next)
-               next->private = (unsigned long) pprev;
+               set_page_private(next, (unsigned long) pprev);
 }
 
 void pgd_ctor(void *pgd, kmem_cache_t *cache, unsigned long unused)
diff --git a/arch/h8300/CVS/Entries b/arch/h8300/CVS/Entries
deleted file mode 100644 (file)
index 1f6bca8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/Kconfig/1.4/Fri Jul 16 15:16:49 2004/-ko/
-/Kconfig.cpu/1.1.3.1/Wed Jun  2 19:33:35 2004/-ko/
-/Kconfig.ide/1.2/Wed Jun  2 20:34:49 2004/-ko/
-/Makefile/1.2/Wed Jun  2 20:34:49 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/defconfig/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D/boot////
-D/kernel////
-D/lib////
-D/mm////
-D/platform////
diff --git a/arch/h8300/CVS/Repository b/arch/h8300/CVS/Repository
deleted file mode 100644 (file)
index f2013d3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300
diff --git a/arch/h8300/CVS/Root b/arch/h8300/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/boot/CVS/Entries b/arch/h8300/boot/CVS/Entries
deleted file mode 100644 (file)
index d9eb10d..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/h8300/boot/CVS/Repository b/arch/h8300/boot/CVS/Repository
deleted file mode 100644 (file)
index 4a7cf07..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/boot
diff --git a/arch/h8300/boot/CVS/Root b/arch/h8300/boot/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/kernel/CVS/Entries b/arch/h8300/kernel/CVS/Entries
deleted file mode 100644 (file)
index d2fbcca..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-/Makefile/1.2/Wed Jun  2 20:34:49 2004/-ko/
-/asm-offsets.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/gpio.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/h8300_ksyms.c/1.2/Wed Jun  2 20:34:49 2004/-ko/
-/init_task.c/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/ints.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/module.c/1.1.3.1/Wed Jun  2 19:33:37 2004/-ko/
-/process.c/1.2/Wed Jun  2 20:34:49 2004/-ko/
-/ptrace.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/semaphore.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/setup.c/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/signal.c/1.2/Wed Jun  2 20:34:50 2004/-ko/
-/sys_h8300.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/syscalls.S/1.2/Wed Jun  2 20:34:50 2004/-ko/
-/time.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/traps.c/1.2/Wed Jun  2 20:34:50 2004/-ko/
-/vmlinux.lds.S/1.2/Wed Jun  2 20:34:50 2004/-ko/
-D
diff --git a/arch/h8300/kernel/CVS/Repository b/arch/h8300/kernel/CVS/Repository
deleted file mode 100644 (file)
index 946cf9d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/kernel
diff --git a/arch/h8300/kernel/CVS/Root b/arch/h8300/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/lib/CVS/Entries b/arch/h8300/lib/CVS/Entries
deleted file mode 100644 (file)
index 92b965b..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/abs.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ashrdi3.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/checksum.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/memcpy.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/memset.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/romfs.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/h8300/lib/CVS/Repository b/arch/h8300/lib/CVS/Repository
deleted file mode 100644 (file)
index 497836b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/lib
diff --git a/arch/h8300/lib/CVS/Root b/arch/h8300/lib/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/mm/CVS/Entries b/arch/h8300/mm/CVS/Entries
deleted file mode 100644 (file)
index 211ab5f..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/fault.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/init.c/1.2/Wed Jun  2 20:34:50 2004/-ko/
-/kmap.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/memory.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-D
diff --git a/arch/h8300/mm/CVS/Repository b/arch/h8300/mm/CVS/Repository
deleted file mode 100644 (file)
index 52e7563..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/mm
diff --git a/arch/h8300/mm/CVS/Root b/arch/h8300/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/CVS/Entries b/arch/h8300/platform/CVS/Entries
deleted file mode 100644 (file)
index 4909ba3..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-D/h8300h////
-D/h8s////
diff --git a/arch/h8300/platform/CVS/Repository b/arch/h8300/platform/CVS/Repository
deleted file mode 100644 (file)
index 608e69b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform
diff --git a/arch/h8300/platform/CVS/Root b/arch/h8300/platform/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/h8300h/CVS/Entries b/arch/h8300/platform/h8300h/CVS/Entries
deleted file mode 100644 (file)
index 271fae1..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/entry.S/1.2/Wed Jun  2 20:34:50 2004/-ko/
-/ints_h8300h.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ptrace_h8300h.c/1.2/Wed Jun  2 20:34:50 2004/-ko/
-D/aki3068net////
-D/generic////
-D/h8max////
diff --git a/arch/h8300/platform/h8300h/CVS/Repository b/arch/h8300/platform/h8300h/CVS/Repository
deleted file mode 100644 (file)
index ef66fd4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform/h8300h
diff --git a/arch/h8300/platform/h8300h/CVS/Root b/arch/h8300/platform/h8300h/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/h8300h/aki3068net/CVS/Entries b/arch/h8300/platform/h8300h/aki3068net/CVS/Entries
deleted file mode 100644 (file)
index d7dcd4b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_ram.S/1.2/Wed Jun  2 20:34:50 2004/-ko/
-/ram.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/timer.c/1.2/Wed Jun  2 20:34:50 2004/-ko/
-D
diff --git a/arch/h8300/platform/h8300h/aki3068net/CVS/Repository b/arch/h8300/platform/h8300h/aki3068net/CVS/Repository
deleted file mode 100644 (file)
index c01c647..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform/h8300h/aki3068net
diff --git a/arch/h8300/platform/h8300h/aki3068net/CVS/Root b/arch/h8300/platform/h8300h/aki3068net/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/h8300h/generic/CVS/Entries b/arch/h8300/platform/h8300h/generic/CVS/Entries
deleted file mode 100644 (file)
index 5d8e02c..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_ram.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_rom.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ram.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/rom.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/timer.c/1.2/Wed Jun  2 20:34:50 2004/-ko/
-D
diff --git a/arch/h8300/platform/h8300h/generic/CVS/Repository b/arch/h8300/platform/h8300h/generic/CVS/Repository
deleted file mode 100644 (file)
index ad206ab..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform/h8300h/generic
diff --git a/arch/h8300/platform/h8300h/generic/CVS/Root b/arch/h8300/platform/h8300h/generic/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/h8300h/h8max/CVS/Entries b/arch/h8300/platform/h8300h/h8max/CVS/Entries
deleted file mode 100644 (file)
index d7dcd4b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_ram.S/1.2/Wed Jun  2 20:34:50 2004/-ko/
-/ram.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/timer.c/1.2/Wed Jun  2 20:34:50 2004/-ko/
-D
diff --git a/arch/h8300/platform/h8300h/h8max/CVS/Repository b/arch/h8300/platform/h8300h/h8max/CVS/Repository
deleted file mode 100644 (file)
index e385d30..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform/h8300h/h8max
diff --git a/arch/h8300/platform/h8300h/h8max/CVS/Root b/arch/h8300/platform/h8300h/h8max/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/h8s/CVS/Entries b/arch/h8300/platform/h8s/CVS/Entries
deleted file mode 100644 (file)
index 411f4d5..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/entry.S/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/ints.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ints_h8s.c/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ptrace_h8s.c/1.2/Fri Jul 16 15:16:49 2004/-ko/
-D/edosk2674////
-D/generic////
diff --git a/arch/h8300/platform/h8s/CVS/Repository b/arch/h8300/platform/h8s/CVS/Repository
deleted file mode 100644 (file)
index 96a9435..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform/h8s
diff --git a/arch/h8300/platform/h8s/CVS/Root b/arch/h8300/platform/h8s/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/h8s/edosk2674/CVS/Entries b/arch/h8300/platform/h8s/edosk2674/CVS/Entries
deleted file mode 100644 (file)
index a9f3a53..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_ram.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_rom.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ram.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/rom.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/timer.c/1.2/Wed Jun  2 20:34:51 2004/-ko/
-D
diff --git a/arch/h8300/platform/h8s/edosk2674/CVS/Repository b/arch/h8300/platform/h8s/edosk2674/CVS/Repository
deleted file mode 100644 (file)
index 133c9e9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform/h8s/edosk2674
diff --git a/arch/h8300/platform/h8s/edosk2674/CVS/Root b/arch/h8300/platform/h8s/edosk2674/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/h8300/platform/h8s/generic/CVS/Entries b/arch/h8300/platform/h8s/generic/CVS/Entries
deleted file mode 100644 (file)
index a9f3a53..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_ram.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/crt0_rom.S/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/ram.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/rom.ld/1.1.1.1/Wed Jun  2 19:22:52 2004/-ko/
-/timer.c/1.2/Wed Jun  2 20:34:51 2004/-ko/
-D
diff --git a/arch/h8300/platform/h8s/generic/CVS/Repository b/arch/h8300/platform/h8s/generic/CVS/Repository
deleted file mode 100644 (file)
index 4eba11c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/h8300/platform/h8s/generic
diff --git a/arch/h8300/platform/h8s/generic/CVS/Root b/arch/h8300/platform/h8s/generic/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/CVS/Entries b/arch/i386/CVS/Entries
deleted file mode 100644 (file)
index 1bbad8d..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/Kconfig/1.6/Sun Sep 12 03:11:13 2004/-ko/
-/Makefile/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/defconfig/1.2/Tue Jul 20 15:33:01 2004/-ko/
-D/boot////
-D/boot98////
-D/crypto////
-D/kernel////
-D/lib////
-D/mach-default////
-D/mach-es7000////
-D/mach-generic////
-D/mach-pc9800////
-D/mach-visws////
-D/mach-voyager////
-D/math-emu////
-D/mm////
-D/oprofile////
-D/pci////
-D/power////
diff --git a/arch/i386/CVS/Repository b/arch/i386/CVS/Repository
deleted file mode 100644 (file)
index e6d7a5e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386
diff --git a/arch/i386/CVS/Root b/arch/i386/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/boot/CVS/Entries b/arch/i386/boot/CVS/Entries
deleted file mode 100644 (file)
index c4fdb41..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile/1.2/Sun Sep 12 03:11:13 2004/-ko/
-/bootsect.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/edd.S/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/install.sh/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/mtools.conf.in/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/setup.S/1.2/Wed Jun  2 20:34:51 2004/-ko/
-/video.S/1.2/Wed Jun  2 20:34:51 2004/-ko/
-D/compressed////
-D/tools////
diff --git a/arch/i386/boot/CVS/Repository b/arch/i386/boot/CVS/Repository
deleted file mode 100644 (file)
index 40e7488..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/boot
diff --git a/arch/i386/boot/CVS/Root b/arch/i386/boot/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/boot/compressed/CVS/Entries b/arch/i386/boot/compressed/CVS/Entries
deleted file mode 100644 (file)
index 6726d6b..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/misc.c/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/vmlinux.scr/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/boot/compressed/CVS/Repository b/arch/i386/boot/compressed/CVS/Repository
deleted file mode 100644 (file)
index a94d0a8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/boot/compressed
diff --git a/arch/i386/boot/compressed/CVS/Root b/arch/i386/boot/compressed/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/boot/tools/CVS/Entries b/arch/i386/boot/tools/CVS/Entries
deleted file mode 100644 (file)
index 4c047d1..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/build.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/boot/tools/CVS/Repository b/arch/i386/boot/tools/CVS/Repository
deleted file mode 100644 (file)
index eeeee71..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/boot/tools
diff --git a/arch/i386/boot/tools/CVS/Root b/arch/i386/boot/tools/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/boot98/CVS/Entries b/arch/i386/boot98/CVS/Entries
deleted file mode 100644 (file)
index 0d1b8f0..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-D/compressed////
-D/tools////
diff --git a/arch/i386/boot98/CVS/Repository b/arch/i386/boot98/CVS/Repository
deleted file mode 100644 (file)
index 5e57620..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/boot98
diff --git a/arch/i386/boot98/CVS/Root b/arch/i386/boot98/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/boot98/compressed/CVS/Entries b/arch/i386/boot98/compressed/CVS/Entries
deleted file mode 100644 (file)
index 2acbba0..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/head.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/misc.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/vmlinux.scr/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/boot98/compressed/CVS/Repository b/arch/i386/boot98/compressed/CVS/Repository
deleted file mode 100644 (file)
index 6a35ec8..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/boot98/compressed
diff --git a/arch/i386/boot98/compressed/CVS/Root b/arch/i386/boot98/compressed/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/boot98/tools/CVS/Entries b/arch/i386/boot98/tools/CVS/Entries
deleted file mode 100644 (file)
index 4c047d1..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-/build.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/boot98/tools/CVS/Repository b/arch/i386/boot98/tools/CVS/Repository
deleted file mode 100644 (file)
index a89485e..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/boot98/tools
diff --git a/arch/i386/boot98/tools/CVS/Root b/arch/i386/boot98/tools/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/crypto/CVS/Entries b/arch/i386/crypto/CVS/Entries
deleted file mode 100644 (file)
index 4a7d980..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile/1.1.3.1/Wed Sep 15 03:52:57 2004/-ko/
-/aes-i586-asm.S/1.1.3.1/Wed Sep 15 03:52:57 2004/-ko/
-/aes.c/1.1.3.1/Wed Sep 15 03:52:57 2004/-ko/
-D
diff --git a/arch/i386/crypto/CVS/Repository b/arch/i386/crypto/CVS/Repository
deleted file mode 100644 (file)
index 8bf5ec1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/crypto
diff --git a/arch/i386/crypto/CVS/Root b/arch/i386/crypto/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/kernel/CVS/Entries b/arch/i386/kernel/CVS/Entries
deleted file mode 100644 (file)
index bf22562..0000000
+++ /dev/null
@@ -1,58 +0,0 @@
-/Makefile/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/apic.c/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/apm.c/1.2/Tue Jul 20 15:33:01 2004/-ko/
-/asm-offsets.c/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/bootflag.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/cpuid.c/1.3/Tue Jul 20 15:33:01 2004/-ko/
-/dmi_scan.c/1.4/Tue Jul 20 15:33:01 2004/-ko/
-/doublefault.c/1.2/Wed Jun  2 20:34:51 2004/-ko/
-/early_printk.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/efi.c/1.2/Fri Jul 16 15:16:49 2004/-ko/
-/efi_stub.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/entry.S/1.4/Tue Jul 20 15:33:01 2004/-ko/
-/entry_trampoline.c/1.1.3.2/Tue Jun  8 17:09:24 2004/-ko/
-/head.S/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/i386_ksyms.c/1.5/Sun Sep 12 03:11:13 2004/-ko/
-/i387.c/1.2/Wed Jun  2 20:34:51 2004/-ko/
-/i8259.c/1.3/Tue Jul 20 15:33:02 2004/-ko/
-/init_task.c/1.3/Fri Jul 16 15:16:49 2004/-ko/
-/io_apic.c/1.4/Tue Jul 20 15:33:02 2004/-ko/
-/ioport.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/irq.c/1.4/Tue Jul 20 15:33:02 2004/-ko/
-/ldt.c/1.3/Tue Jul 20 15:33:02 2004/-ko/
-/mca.c/1.2/Wed Jun  2 20:34:51 2004/-ko/
-/microcode.c/1.3/Tue Jul 20 15:33:02 2004/-ko/
-/module.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/mpparse.c/1.4/Tue Jul 20 15:33:02 2004/-ko/
-/msr.c/1.3/Tue Jul 20 15:33:02 2004/-ko/
-/nmi.c/1.4/Sun Sep 12 03:11:13 2004/-ko/
-/numaq.c/1.2/Tue Jul 20 15:33:02 2004/-ko/
-/pci-dma.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/process.c/1.4/Tue Jul 20 15:33:02 2004/-ko/
-/ptrace.c/1.3/Thu Jun  3 22:32:16 2004/-ko/
-/reboot.c/1.3/Tue Jul 20 15:33:02 2004/-ko/
-/scx200.c/1.3/Tue Jul 20 15:33:02 2004/-ko/
-/semaphore.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/setup.c/1.5/Sun Sep 12 03:11:13 2004/-ko/
-/sigframe.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/signal.c/1.4/Tue Jul 20 15:33:02 2004/-ko/
-/smp.c/1.5/Sun Sep 12 03:11:13 2004/-ko/
-/smpboot.c/1.4/Tue Jul 20 15:33:02 2004/-ko/
-/srat.c/1.2/Tue Jul 20 15:33:02 2004/-ko/
-/summit.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/sys_i386.c/1.4/Fri Jul 16 15:16:50 2004/-ko/
-/sysenter.c/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/time.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/time_hpet.c/1.3/Tue Jul 20 15:33:02 2004/-ko/
-/trampoline.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/traps.c/1.5/Sun Sep 12 03:11:13 2004/-ko/
-/vm86.c/1.4/Tue Jul 20 15:33:02 2004/-ko/
-/vmlinux.lds.S/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/vsyscall-int80.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/vsyscall-sigreturn.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/vsyscall-sysenter.S/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/vsyscall.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/vsyscall.lds/1.2/Wed Jun  2 20:34:52 2004/-ko/
-D/acpi////
-D/cpu////
-D/timers////
diff --git a/arch/i386/kernel/CVS/Repository b/arch/i386/kernel/CVS/Repository
deleted file mode 100644 (file)
index 02c6c03..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/kernel
diff --git a/arch/i386/kernel/CVS/Root b/arch/i386/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/kernel/acpi/CVS/Entries b/arch/i386/kernel/acpi/CVS/Entries
deleted file mode 100644 (file)
index 31132f6..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/boot.c/1.4/Tue Jul 20 15:33:03 2004/-ko/
-/sleep.c/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/wakeup.S/1.3/Tue Jun  8 21:22:58 2004/-ko/
-D
diff --git a/arch/i386/kernel/acpi/CVS/Repository b/arch/i386/kernel/acpi/CVS/Repository
deleted file mode 100644 (file)
index 4a35832..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/kernel/acpi
diff --git a/arch/i386/kernel/acpi/CVS/Root b/arch/i386/kernel/acpi/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 6bd4b79..13be515 100644 (file)
@@ -24,7 +24,6 @@
  */
 
 #include <linux/init.h>
-#include <linux/config.h>
 #include <linux/acpi.h>
 #include <linux/efi.h>
 #include <linux/module.h>
@@ -60,7 +59,7 @@ static inline int gsi_irq_sharing(int gsi) { return gsi; }
 
 #define BAD_MADT_ENTRY(entry, end) (                                       \
                (!entry) || (unsigned long)entry + sizeof(*entry) > end ||  \
-               ((acpi_table_entry_header *)entry)->length != sizeof(*entry))
+               ((acpi_table_entry_header *)entry)->length < sizeof(*entry))
 
 #define PREFIX                 "ACPI: "
 
@@ -204,6 +203,8 @@ int __init acpi_parse_mcfg(unsigned long phys_addr, unsigned long size)
                if (mcfg->config[i].base_reserved) {
                        printk(KERN_ERR PREFIX
                               "MMCONFIG not in low 4GB of memory\n");
+                       kfree(pci_mmcfg_config);
+                       pci_mmcfg_config_num = 0;
                        return -ENODEV;
                }
        }
@@ -217,7 +218,7 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
 {
        struct acpi_table_madt *madt = NULL;
 
-       if (!phys_addr || !size)
+       if (!phys_addr || !size || !cpu_has_apic)
                return -EINVAL;
 
        madt = (struct acpi_table_madt *)__acpi_map_table(phys_addr, size);
@@ -233,9 +234,8 @@ static int __init acpi_parse_madt(unsigned long phys_addr, unsigned long size)
                       madt->lapic_address);
        }
 
-#ifndef CONFIG_X86_64
        acpi_madt_oem_check(madt->header.oem_id, madt->header.oem_table_id);
-#endif
+
        return 0;
 }
 
@@ -625,9 +625,9 @@ extern u32 pmtmr_ioport;
 
 static int __init acpi_parse_fadt(unsigned long phys, unsigned long size)
 {
-       struct fadt_descriptor_rev2 *fadt = NULL;
+       struct fadt_descriptor *fadt = NULL;
 
-       fadt = (struct fadt_descriptor_rev2 *)__acpi_map_table(phys, size);
+       fadt = (struct fadt_descriptor *)__acpi_map_table(phys, size);
        if (!fadt) {
                printk(KERN_WARNING PREFIX "Unable to map FADT\n");
                return 0;
@@ -758,7 +758,7 @@ static int __init acpi_parse_madt_ioapic_entries(void)
                return -ENODEV;
        }
 
-       if (!cpu_has_apic)
+       if (!cpu_has_apic) 
                return -ENODEV;
 
        /*
index ecd4b69..d7bff41 100644 (file)
@@ -14,7 +14,6 @@
  *     Mikael Pettersson       :       PM converted to driver model.
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 
 #include <linux/mm.h>
@@ -36,6 +35,7 @@
 #include <asm/arch_hooks.h>
 #include <asm/hpet.h>
 #include <asm/i8253.h>
+#include <asm/nmi.h>
 
 #include <mach_apic.h>
 #include <mach_apicdef.h>
@@ -61,7 +61,7 @@ int enable_local_apic __initdata = 0; /* -1=force-disable, +1=force-enable */
  */
 int apic_verbosity;
 
-int modern_apic(void)
+static int modern_apic(void)
 {
 #ifndef CONFIG_XEN
        unsigned int lvr, version;
diff --git a/arch/i386/kernel/cpu/CVS/Entries b/arch/i386/kernel/cpu/CVS/Entries
deleted file mode 100644 (file)
index bf0b64a..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/amd.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/centaur.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/changelog/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/common.c/1.3/Tue Jul 20 15:33:03 2004/-ko/
-/cpu.h/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/cyrix.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/intel.c/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/nexgen.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/proc.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/rise.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/transmeta.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/umc.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D/cpufreq////
-D/mcheck////
-D/mtrr////
diff --git a/arch/i386/kernel/cpu/CVS/Repository b/arch/i386/kernel/cpu/CVS/Repository
deleted file mode 100644 (file)
index 397ff6b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/kernel/cpu
diff --git a/arch/i386/kernel/cpu/CVS/Root b/arch/i386/kernel/cpu/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 50a235a..1dc3163 100644 (file)
@@ -11,6 +11,8 @@
 #include <asm/msr.h>
 #include <asm/io.h>
 #include <asm/mmu_context.h>
+#include <asm/mtrr.h>
+#include <asm/mce.h>
 #ifdef CONFIG_X86_LOCAL_APIC
 #include <asm/mpspec.h>
 #include <asm/apic.h>
@@ -295,7 +297,7 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c)
                        if (c->x86 >= 0x6)
                                c->x86_model += ((tfms >> 16) & 0xF) << 4;
                        c->x86_mask = tfms & 15;
-#if defined(CONFIG_SMP) && defined(CONFIG_X86_LOCAL_APIC)
+#ifdef CONFIG_X86_HT
                        c->apicid = phys_pkg_id((ebx >> 24) & 0xFF, 0);
 #else
                        c->apicid = (ebx >> 24) & 0xFF;
@@ -320,7 +322,7 @@ void __cpuinit generic_identify(struct cpuinfo_x86 * c)
        early_intel_workaround(c);
 
 #ifdef CONFIG_X86_HT
-       phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
+       c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
 #endif
 }
 
@@ -429,6 +431,13 @@ void __cpuinit identify_cpu(struct cpuinfo_x86 *c)
        if (disable_pse)
                clear_bit(X86_FEATURE_PSE, c->x86_capability);
 
+       if (exec_shield != 0) {
+#ifdef CONFIG_HIGHMEM64G   /* NX implies PAE */
+               if (!test_bit(X86_FEATURE_NX, c->x86_capability))
+#endif
+               clear_bit(X86_FEATURE_SEP, c->x86_capability);
+       }
+
        /* If the model name is still unset, do table lookup. */
        if ( !c->x86_model_id[0] ) {
                char *p;
@@ -478,11 +487,9 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 {
        u32     eax, ebx, ecx, edx;
        int     index_msb, core_bits;
-       int     cpu = smp_processor_id();
 
        cpuid(1, &eax, &ebx, &ecx, &edx);
 
-
        if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
                return;
 
@@ -493,16 +500,17 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
        } else if (smp_num_siblings > 1 ) {
 
                if (smp_num_siblings > NR_CPUS) {
-                       printk(KERN_WARNING "CPU: Unsupported number of the siblings %d", smp_num_siblings);
+                       printk(KERN_WARNING "CPU: Unsupported number of the "
+                                       "siblings %d", smp_num_siblings);
                        smp_num_siblings = 1;
                        return;
                }
 
                index_msb = get_count_order(smp_num_siblings);
-               phys_proc_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb);
+               c->phys_proc_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb);
 
                printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
-                      phys_proc_id[cpu]);
+                      c->phys_proc_id);
 
                smp_num_siblings = smp_num_siblings / c->x86_max_cores;
 
@@ -510,12 +518,12 @@ void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 
                core_bits = get_count_order(c->x86_max_cores);
 
-               cpu_core_id[cpu] = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) &
+               c->cpu_core_id = phys_pkg_id((ebx >> 24) & 0xFF, index_msb) &
                                               ((1 << core_bits) - 1);
 
                if (c->x86_max_cores > 1)
                        printk(KERN_INFO  "CPU: Processor Core ID: %d\n",
-                              cpu_core_id[cpu]);
+                              c->cpu_core_id);
        }
 }
 #endif
@@ -624,7 +632,7 @@ void __cpuinit cpu_init(void)
        }
        printk(KERN_INFO "Initializing CPU#%d\n", cpu);
 
-       if (cpu_has_vme || cpu_has_de)
+       if (cpu_has_vme || cpu_has_tsc || cpu_has_de)
                clear_in_cr4(X86_CR4_VME|X86_CR4_PVI|X86_CR4_TSD|X86_CR4_DE);
        if (tsc_disable && cpu_has_tsc) {
                printk(KERN_NOTICE "Disabling TSC...\n");
@@ -634,6 +642,12 @@ void __cpuinit cpu_init(void)
        }
 
 #ifndef CONFIG_XEN
+       /* The CPU hotplug case */
+       if (cpu_gdt_descr->address) {
+               gdt = (struct desc_struct *)cpu_gdt_descr->address;
+               memset(gdt, 0, PAGE_SIZE);
+               goto old_gdt;
+       }
        /*
         * This is a horrible hack to allocate the GDT.  The problem
         * is that cpu_init() is called really early for the boot CPU
@@ -652,7 +666,7 @@ void __cpuinit cpu_init(void)
                                local_irq_enable();
                }
        }
-
+old_gdt:
        /*
         * Initialize the per-CPU GDT with the boot GDT,
         * and set up the GDT descriptor:
diff --git a/arch/i386/kernel/cpu/cpufreq/CVS/Entries b/arch/i386/kernel/cpu/cpufreq/CVS/Entries
deleted file mode 100644 (file)
index 8bed947..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/Kconfig/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/Makefile/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/acpi.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/elanfreq.c/1.3/Fri Jul 16 15:16:50 2004/-ko/
-/gx-suspmod.c/1.4/Fri Jul 16 15:16:50 2004/-ko/
-/longhaul.c/1.4/Fri Jul 16 15:16:50 2004/-ko/
-/longhaul.h/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/longrun.c/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/p4-clockmod.c/1.4/Fri Jul 16 15:16:50 2004/-ko/
-/powernow-k6.c/1.2/Wed Jun  2 20:34:52 2004/-ko/
-/powernow-k7.c/1.5/Tue Jul 20 15:33:03 2004/-ko/
-/powernow-k7.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/powernow-k8.c/1.4/Fri Jul 16 15:16:50 2004/-ko/
-/powernow-k8.h/1.2/Wed Jun  2 20:34:53 2004/-ko/
-/speedstep-centrino.c/1.3/Tue Jul 20 15:33:03 2004/-ko/
-/speedstep-ich.c/1.3/Fri Jul 16 15:16:50 2004/-ko/
-/speedstep-lib.c/1.1.1.2/Mon Jul 12 21:55:55 2004/-ko/
-/speedstep-lib.h/1.1.1.2/Mon Jul 12 21:55:55 2004/-ko/
-/speedstep-smi.c/1.3/Fri Jul 16 15:16:50 2004/-ko/
-D
diff --git a/arch/i386/kernel/cpu/cpufreq/CVS/Repository b/arch/i386/kernel/cpu/cpufreq/CVS/Repository
deleted file mode 100644 (file)
index 73096e2..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/kernel/cpu/cpufreq
diff --git a/arch/i386/kernel/cpu/cpufreq/CVS/Root b/arch/i386/kernel/cpu/cpufreq/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/kernel/cpu/mcheck/CVS/Entries b/arch/i386/kernel/cpu/mcheck/CVS/Entries
deleted file mode 100644 (file)
index 0bb2ab9..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/k7.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/mce.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/mce.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/non-fatal.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/p4.c/1.2/Wed Jun  2 20:34:53 2004/-ko/
-/p5.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/p6.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/winchip.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/kernel/cpu/mcheck/CVS/Repository b/arch/i386/kernel/cpu/mcheck/CVS/Repository
deleted file mode 100644 (file)
index b96837f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/kernel/cpu/mcheck
diff --git a/arch/i386/kernel/cpu/mcheck/CVS/Root b/arch/i386/kernel/cpu/mcheck/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/kernel/cpu/mtrr/CVS/Entries b/arch/i386/kernel/cpu/mtrr/CVS/Entries
deleted file mode 100644 (file)
index bed044e..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/amd.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/centaur.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/changelog/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/cyrix.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/generic.c/1.2/Tue Jul 20 15:33:03 2004/-ko/
-/if.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/main.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/mtrr.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/state.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/kernel/cpu/mtrr/CVS/Repository b/arch/i386/kernel/cpu/mtrr/CVS/Repository
deleted file mode 100644 (file)
index 22ea0dc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/kernel/cpu/mtrr
diff --git a/arch/i386/kernel/cpu/mtrr/CVS/Root b/arch/i386/kernel/cpu/mtrr/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 9d68dac..4c65427 100644 (file)
@@ -179,7 +179,7 @@ static int __init mtrr_init(void)
 {
        struct cpuinfo_x86 *c = &boot_cpu_data;
 
-       if (!(xen_start_info->flags & SIF_PRIVILEGED))
+       if (!is_initial_xendomain())
                return -ENODEV;
 
        if ((!cpu_has(c, X86_FEATURE_MTRR)) &&
index 1f3c30a..45b7f74 100644 (file)
  * "current" is in register %ebx during any slow entries.
  */
 
-#include <linux/config.h>
 #include <linux/linkage.h>
 #include <asm/thread_info.h>
+#include <asm/irqflags.h>
 #include <asm/errno.h>
 #include <asm/segment.h>
 #include <asm/smp.h>
 #include <asm/page.h>
 #include <asm/desc.h>
+#include <asm/dwarf2.h>
 #include "irq_vectors.h"
 #include <xen/interface/xen.h>
 
@@ -106,40 +107,91 @@ NMI_MASK  = 0x80000000
 #endif
 
 #ifdef CONFIG_PREEMPT
-#define preempt_stop           cli
+#define preempt_stop           cli; TRACE_IRQS_OFF
 #else
 #define preempt_stop
 #define resume_kernel          restore_nocheck
 #endif
 
+.macro TRACE_IRQS_IRET
+#ifdef CONFIG_TRACE_IRQFLAGS
+       testl $IF_MASK,EFLAGS(%esp)     # interrupts off?
+       jz 1f
+       TRACE_IRQS_ON
+1:
+#endif
+.endm
+
+#ifdef CONFIG_VM86
+#define resume_userspace_sig   check_userspace
+#else
+#define resume_userspace_sig   resume_userspace
+#endif
+
 #define SAVE_ALL \
        cld; \
        pushl %es; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       /*CFI_REL_OFFSET es, 0;*/\
        pushl %ds; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       /*CFI_REL_OFFSET ds, 0;*/\
        pushl %eax; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       CFI_REL_OFFSET eax, 0;\
        pushl %ebp; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       CFI_REL_OFFSET ebp, 0;\
        pushl %edi; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       CFI_REL_OFFSET edi, 0;\
        pushl %esi; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       CFI_REL_OFFSET esi, 0;\
        pushl %edx; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       CFI_REL_OFFSET edx, 0;\
        pushl %ecx; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       CFI_REL_OFFSET ecx, 0;\
        pushl %ebx; \
+       CFI_ADJUST_CFA_OFFSET 4;\
+       CFI_REL_OFFSET ebx, 0;\
        movl $(__USER_DS), %edx; \
        movl %edx, %ds; \
        movl %edx, %es;
 
 #define RESTORE_INT_REGS \
        popl %ebx;      \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       CFI_RESTORE ebx;\
        popl %ecx;      \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       CFI_RESTORE ecx;\
        popl %edx;      \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       CFI_RESTORE edx;\
        popl %esi;      \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       CFI_RESTORE esi;\
        popl %edi;      \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       CFI_RESTORE edi;\
        popl %ebp;      \
-       popl %eax
+       CFI_ADJUST_CFA_OFFSET -4;\
+       CFI_RESTORE ebp;\
+       popl %eax;      \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       CFI_RESTORE eax
 
 #define RESTORE_REGS   \
        RESTORE_INT_REGS; \
 1:     popl %ds;       \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       /*CFI_RESTORE ds;*/\
 2:     popl %es;       \
+       CFI_ADJUST_CFA_OFFSET -4;\
+       /*CFI_RESTORE es;*/\
 .section .fixup,"ax";  \
 3:     movl $0,(%esp); \
        jmp 1b;         \
@@ -152,13 +204,47 @@ NMI_MASK  = 0x80000000
        .long 2b,4b;    \
 .previous
 
+#define RING0_INT_FRAME \
+       CFI_STARTPROC simple;\
+       CFI_DEF_CFA esp, 3*4;\
+       /*CFI_OFFSET cs, -2*4;*/\
+       CFI_OFFSET eip, -3*4
+
+#define RING0_EC_FRAME \
+       CFI_STARTPROC simple;\
+       CFI_DEF_CFA esp, 4*4;\
+       /*CFI_OFFSET cs, -2*4;*/\
+       CFI_OFFSET eip, -3*4
+
+#define RING0_PTREGS_FRAME \
+       CFI_STARTPROC simple;\
+       CFI_DEF_CFA esp, OLDESP-EBX;\
+       /*CFI_OFFSET cs, CS-OLDESP;*/\
+       CFI_OFFSET eip, EIP-OLDESP;\
+       /*CFI_OFFSET es, ES-OLDESP;*/\
+       /*CFI_OFFSET ds, DS-OLDESP;*/\
+       CFI_OFFSET eax, EAX-OLDESP;\
+       CFI_OFFSET ebp, EBP-OLDESP;\
+       CFI_OFFSET edi, EDI-OLDESP;\
+       CFI_OFFSET esi, ESI-OLDESP;\
+       CFI_OFFSET edx, EDX-OLDESP;\
+       CFI_OFFSET ecx, ECX-OLDESP;\
+       CFI_OFFSET ebx, EBX-OLDESP
 
 ENTRY(ret_from_fork)
+       CFI_STARTPROC
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        call schedule_tail
        GET_THREAD_INFO(%ebp)
        popl %eax
+       CFI_ADJUST_CFA_OFFSET -4
+       pushl $0x0202                   # Reset kernel eflags
+       CFI_ADJUST_CFA_OFFSET 4
+       popfl
+       CFI_ADJUST_CFA_OFFSET -4
        jmp syscall_exit
+       CFI_ENDPROC
 
 /*
  * Return to user mode is not as complex as all this looks,
@@ -169,10 +255,12 @@ ENTRY(ret_from_fork)
 
        # userspace resumption stub bypassing syscall exit tracing
        ALIGN
+       RING0_PTREGS_FRAME
 ret_from_exception:
        preempt_stop
 ret_from_intr:
        GET_THREAD_INFO(%ebp)
+check_userspace:
        movl EFLAGS(%esp), %eax         # mix EFLAGS and CS
        movb CS(%esp), %al
        testl $(VM_MASK | 2), %eax
@@ -201,25 +289,43 @@ need_resched:
        call preempt_schedule_irq
        jmp need_resched
 #endif
+       CFI_ENDPROC
 
 /* SYSENTER_RETURN points to after the "sysenter" instruction in
    the vsyscall page.  See vsyscall-sysentry.S, which defines the symbol.  */
 
        # sysenter call handler stub
 ENTRY(sysenter_entry)
+       CFI_STARTPROC simple
+       CFI_DEF_CFA esp, 0
+       CFI_REGISTER esp, ebp
        movl SYSENTER_stack_esp0(%esp),%esp
 sysenter_past_esp:
+       /*
+        * No need to follow this irqs on/off section: the syscall
+        * disabled irqs and here we enable it straight after entry:
+        */
        sti
        pushl $(__USER_DS)
+       CFI_ADJUST_CFA_OFFSET 4
+       /*CFI_REL_OFFSET ss, 0*/
        pushl %ebp
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET esp, 0
        pushfl
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $(__USER_CS)
+       CFI_ADJUST_CFA_OFFSET 4
+       /*CFI_REL_OFFSET cs, 0*/
        /*
         * Push current_thread_info()->sysenter_return to the stack.
         * A tiny bit of offset fixup is necessary - 4*4 means the 4 words
         * pushed above; +8 corresponds to copy_thread's esp0 setting.
         */
        pushl (TI_sysenter_return-THREAD_SIZE+8+4*4)(%esp)
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET eip, 0
+
 /*
  * Load the potential sixth argument from user stack.
  * Careful about security.
@@ -233,6 +339,7 @@ sysenter_past_esp:
 .previous
 
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        GET_THREAD_INFO(%ebp)
 
@@ -244,6 +351,7 @@ sysenter_past_esp:
        call *sys_call_table(,%eax,4)
        movl %eax,EAX(%esp)
        DISABLE_INTERRUPTS
+       TRACE_IRQS_OFF
        movl TI_flags(%ebp), %ecx
        testw $_TIF_ALLWORK_MASK, %cx
        jne syscall_exit_work
@@ -251,6 +359,7 @@ sysenter_past_esp:
        movl EIP(%esp), %edx
        movl OLDESP(%esp), %ecx
        xorl %ebp,%ebp
+       TRACE_IRQS_ON
 #ifdef CONFIG_XEN
        __ENABLE_INTERRUPTS
 sysexit_scrit: /**** START OF SYSEXIT CRITICAL REGION ****/
@@ -261,18 +370,23 @@ sysexit_scrit:    /**** START OF SYSEXIT CRITICAL REGION ****/
 14:    __DISABLE_INTERRUPTS
 sysexit_ecrit: /**** END OF SYSEXIT CRITICAL REGION ****/
        push %esp
+       CFI_ADJUST_CFA_OFFSET 4
        call evtchn_do_upcall
        add  $4,%esp
+       CFI_ADJUST_CFA_OFFSET -4
        jmp  ret_from_intr
 #else
        sti
        sysexit
 #endif /* !CONFIG_XEN */
+       CFI_ENDPROC
 
 
        # system call handler stub
 ENTRY(system_call)
+       RING0_INT_FRAME                 # can't unwind into user space anyway
        pushl %eax                      # save orig_eax
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        GET_THREAD_INFO(%ebp)
        testl $TF_MASK,EFLAGS(%esp)
@@ -292,6 +406,7 @@ syscall_exit:
        DISABLE_INTERRUPTS              # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
                                        # between sampling and the iret
+       TRACE_IRQS_OFF
        movl TI_flags(%ebp), %ecx
        testw $_TIF_ALLWORK_MASK, %cx   # current->work
        jne syscall_exit_work
@@ -319,12 +434,17 @@ restore_nocheck:
        andb $1,%al                     # EAX[0] == IRET_EFLAGS.IF & event_mask
        jnz restore_all_enable_events   #        != 0 => enable event delivery
 #endif
+       TRACE_IRQS_IRET
+       CFI_REMEMBER_STATE
+restore_nocheck_notrace:
        RESTORE_REGS
        addl $4, %esp
+       CFI_ADJUST_CFA_OFFSET -4
 1:     iret
 .section .fixup,"ax"
 iret_exc:
 #ifndef CONFIG_XEN
+       TRACE_IRQS_ON
        sti
 #endif
        pushl $0                        # no error code
@@ -336,6 +456,7 @@ iret_exc:
        .long 1b,iret_exc
 .previous
 
+       CFI_RESTORE_STATE
 #ifndef CONFIG_XEN
 ldt_ss:
        larl OLDSS(%esp), %eax
@@ -349,11 +470,15 @@ ldt_ss:
         * CPUs, which we can try to work around to make
         * dosemu and wine happy. */
        subl $8, %esp           # reserve space for switch16 pointer
+       CFI_ADJUST_CFA_OFFSET 8
        cli
+       TRACE_IRQS_OFF
        movl %esp, %eax
        /* Set up the 16bit stack frame with switch32 pointer on top,
         * and a switch16 pointer on top of the current frame. */
        call setup_x86_bogus_stack
+       CFI_ADJUST_CFA_OFFSET -8        # frame has moved
+       TRACE_IRQS_IRET
        RESTORE_REGS
        lss 20+4(%esp), %esp    # switch to 16bit stack
 1:     iret
@@ -368,9 +493,11 @@ hypervisor_iret:
        addl $4, %esp
        jmp  hypercall_page + (__HYPERVISOR_iret * 32)
 #endif
+       CFI_ENDPROC
 
        # perform work that needs to be done immediately before resumption
        ALIGN
+       RING0_PTREGS_FRAME              # can't unwind into user space anyway
 work_pending:
        testb $_TIF_NEED_RESCHED, %cl
        jz work_notifysig
@@ -379,6 +506,7 @@ work_resched:
        DISABLE_INTERRUPTS              # make sure we don't miss an interrupt
                                        # setting need_resched or sigpending
                                        # between sampling and the iret
+       TRACE_IRQS_OFF
        movl TI_flags(%ebp), %ecx
        andl $_TIF_WORK_MASK, %ecx      # is there any work to be done other
                                        # than syscall tracing?
@@ -394,18 +522,20 @@ work_notifysig:                           # deal with pending signals and
                                        # vm86-space
        xorl %edx, %edx
        call do_notify_resume
-       jmp resume_userspace
+       jmp resume_userspace_sig
 
        ALIGN
 work_notifysig_v86:
 #ifdef CONFIG_VM86
        pushl %ecx                      # save ti_flags for do_notify_resume
+       CFI_ADJUST_CFA_OFFSET 4
        call save_v86_state             # %eax contains pt_regs pointer
        popl %ecx
+       CFI_ADJUST_CFA_OFFSET -4
        movl %eax, %esp
        xorl %edx, %edx
        call do_notify_resume
-       jmp resume_userspace
+       jmp resume_userspace_sig
 #endif
 
        # perform syscall exit tracing
@@ -428,25 +558,28 @@ syscall_trace_entry:
 syscall_exit_work:
        testb $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP), %cl
        jz work_pending
+       TRACE_IRQS_ON
        ENABLE_INTERRUPTS               # could let do_syscall_trace() call
                                        # schedule() instead
        movl %esp, %eax
        movl $1, %edx
        call do_syscall_trace
        jmp resume_userspace
+       CFI_ENDPROC
 
-       ALIGN
+       RING0_INT_FRAME                 # can't unwind into user space anyway
 syscall_fault:
        pushl %eax                      # save orig_eax
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        GET_THREAD_INFO(%ebp)
        movl $-EFAULT,EAX(%esp)
        jmp resume_userspace
 
-       ALIGN
 syscall_badsys:
        movl $-ENOSYS,EAX(%esp)
        jmp resume_userspace
+       CFI_ENDPROC
 
 #ifndef CONFIG_XEN
 #define FIXUP_ESPFIX_STACK \
@@ -459,16 +592,21 @@ syscall_badsys:
        movl %eax, %esp;
 #define UNWIND_ESPFIX_STACK \
        pushl %eax; \
+       CFI_ADJUST_CFA_OFFSET 4; \
        movl %ss, %eax; \
        /* see if on 16bit stack */ \
        cmpw $__ESPFIX_SS, %ax; \
-       jne 28f; \
-       movl $__KERNEL_DS, %edx; \
-       movl %edx, %ds; \
-       movl %edx, %es; \
+       je 28f; \
+27:    popl %eax; \
+       CFI_ADJUST_CFA_OFFSET -4; \
+.section .fixup,"ax"; \
+28:    movl $__KERNEL_DS, %eax; \
+       movl %eax, %ds; \
+       movl %eax, %es; \
        /* switch to 32bit stack */ \
-       FIXUP_ESPFIX_STACK \
-28:    popl %eax;
+       FIXUP_ESPFIX_STACK; \
+       jmp 27b; \
+.previous
 
 /*
  * Build the entry stubs and pointer table with
@@ -480,9 +618,14 @@ ENTRY(interrupt)
 
 vector=0
 ENTRY(irq_entries_start)
+       RING0_INT_FRAME
 .rept NR_IRQS
        ALIGN
+ .if vector
+       CFI_ADJUST_CFA_OFFSET -4
+ .endif
 1:     pushl $~(vector)
+       CFI_ADJUST_CFA_OFFSET 4
        jmp common_interrupt
 .data
        .long 1b
@@ -490,20 +633,31 @@ ENTRY(irq_entries_start)
 vector=vector+1
 .endr
 
+/*
+ * the CPU automatically disables interrupts when executing an IRQ vector,
+ * so IRQ-flags tracing has to follow that:
+ */
        ALIGN
 common_interrupt:
        SAVE_ALL
+       TRACE_IRQS_OFF
        movl %esp,%eax
        call do_IRQ
        jmp ret_from_intr
+       CFI_ENDPROC
 
 #define BUILD_INTERRUPT(name, nr)      \
 ENTRY(name)                            \
-       pushl $~(nr);                   \
        SAVE_ALL                        \
+       RING0_INT_FRAME;                \
+       pushl $~(nr);                   \
+       CFI_ADJUST_CFA_OFFSET 4;        \
+       SAVE_ALL;                       \
+       TRACE_IRQS_OFF                  \
        movl %esp,%eax;                 \
        call smp_/**/name;              \
-       jmp ret_from_intr;
+       jmp ret_from_intr;              \
+       CFI_ENDPROC
 
 /* The include is where all of the SMP etc. interrupts come from */
 #include "entry_arch.h"
@@ -512,34 +666,59 @@ ENTRY(name)                               \
 #endif
 
 ENTRY(divide_error)
+       RING0_INT_FRAME
        pushl $0                        # no error code
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $do_divide_error
+       CFI_ADJUST_CFA_OFFSET 4
        ALIGN
 error_code:
        pushl %ds
+       CFI_ADJUST_CFA_OFFSET 4
+       /*CFI_REL_OFFSET ds, 0*/
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET eax, 0
        xorl %eax, %eax
        pushl %ebp
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET ebp, 0
        pushl %edi
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET edi, 0
        pushl %esi
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET esi, 0
        pushl %edx
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET edx, 0
        decl %eax                       # eax = -1
        pushl %ecx
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET ecx, 0
        pushl %ebx
+       CFI_ADJUST_CFA_OFFSET 4
+       CFI_REL_OFFSET ebx, 0
        cld
        pushl %es
+       CFI_ADJUST_CFA_OFFSET 4
+       /*CFI_REL_OFFSET es, 0*/
        UNWIND_ESPFIX_STACK
        popl %ecx
+       CFI_ADJUST_CFA_OFFSET -4
+       /*CFI_REGISTER es, ecx*/
        movl ES(%esp), %edi             # get the function address
        movl ORIG_EAX(%esp), %edx       # get the error code
        movl %eax, ORIG_EAX(%esp)
        movl %ecx, ES(%esp)
+       /*CFI_REL_OFFSET es, ES*/
        movl $(__USER_DS), %ecx
        movl %ecx, %ds
        movl %ecx, %es
        movl %esp,%eax                  # pt_regs pointer
        call *%edi
        jmp ret_from_exception
+       CFI_ENDPROC
 
 #ifdef CONFIG_XEN
 # A note on the "critical region" in our callback handler.
@@ -559,7 +738,9 @@ error_code:
 # critical region we know that the entire frame is present and correct
 # so we can simply throw away the new one.
 ENTRY(hypervisor_callback)
+       RING0_INT_FRAME
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        movl EIP(%esp),%eax
        cmpl $scrit,%eax
@@ -570,10 +751,15 @@ ENTRY(hypervisor_callback)
        jb   11f
        cmpl $sysexit_ecrit,%eax
        ja   11f
+       # interrupted in sysexit critical
        addl $0x34,%esp                 # Remove cs...ebx from stack frame.
+       # this popped off new frame to reuse the old one, therefore no 
+       # CFI_ADJUST_CFA_OFFSET here
 11:    push %esp
+       CFI_ADJUST_CFA_OFFSET 4
        call evtchn_do_upcall
        add  $4,%esp
+       CFI_ADJUST_CFA_OFFSET -4
        jmp  ret_from_intr
 
         ALIGN
@@ -584,6 +770,7 @@ scrit:      /**** START OF CRITICAL REGION ****/
        jnz  14f                        # process more events if necessary...
        RESTORE_REGS
        addl $4, %esp
+       CFI_ADJUST_CFA_OFFSET -4
 1:     iret
 .section __ex_table,"a"
        .align 4
@@ -619,7 +806,10 @@ critical_region_fixup:
        movl %eax,(%edi)
        loop 16b
 17:    movl %edi,%esp                  # final %edi is top of merged stack
+       # this popped off new frame to reuse the old one, therefore no 
+       # CFI_DEF_CFA_OFFSET here
        jmp  11b
+       CFI_ENDPROC
 
 critical_fixup_table:
        .byte 0xff,0xff,0xff            # testb $0xff,(%esi) = __TEST_PENDING
@@ -649,7 +839,9 @@ critical_fixup_table:
 # to pop the stack frame we end up in an infinite loop of failsafe callbacks.
 # We distinguish between categories by maintaining a status value in EAX.
 ENTRY(failsafe_callback)
+       RING0_INT_FRAME
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        movl $1,%eax
 1:     mov 4(%esp),%ds
 2:     mov 8(%esp),%es
@@ -657,11 +849,16 @@ ENTRY(failsafe_callback)
 4:     mov 16(%esp),%gs
        testl %eax,%eax
        popl %eax
+       CFI_ADJUST_CFA_OFFSET -4
        jz 5f
        addl $16,%esp           # EAX != 0 => Category 2 (Bad IRET)
+       CFI_ADJUST_CFA_OFFSET -16
        jmp iret_exc
+       CFI_ADJUST_CFA_OFFSET 16
 5:     addl $16,%esp           # EAX == 0 => Category 1 (Bad segment)
+       CFI_ADJUST_CFA_OFFSET -16
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        jmp ret_from_exception
 .section .fixup,"ax";          \
@@ -685,34 +882,48 @@ ENTRY(failsafe_callback)
        .long 3b,8b;            \
        .long 4b,9b;            \
 .previous
+       CFI_ENDPROC
 #endif
 
 ENTRY(coprocessor_error)
+       RING0_INT_FRAME
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $do_coprocessor_error
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(simd_coprocessor_error)
+       RING0_INT_FRAME
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $do_simd_coprocessor_error
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(device_not_available)
+       RING0_INT_FRAME
        pushl $-1                       # mark this as an int
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
 #ifndef CONFIG_XEN
        movl %cr0, %eax
        testl $0x4, %eax                # EM (math emulation bit)
        je device_available_emulate
        pushl $0                        # temporary storage for ORIG_EIP
+       CFI_ADJUST_CFA_OFFSET 4
        call math_emulate
        addl $4, %esp
+       CFI_ADJUST_CFA_OFFSET -4
        jmp ret_from_exception
 device_available_emulate:
 #endif
        preempt_stop
        call math_state_restore
        jmp ret_from_exception
+       CFI_ENDPROC
 
 #ifndef CONFIG_XEN
 /*
@@ -739,6 +950,7 @@ label:                                              \
 #endif /* CONFIG_XEN */
 
 KPROBE_ENTRY(debug)
+       RING0_INT_FRAME
 #ifndef CONFIG_XEN
        cmpl $sysenter_entry,(%esp)
        jne debug_stack_correct
@@ -746,11 +958,13 @@ KPROBE_ENTRY(debug)
 debug_stack_correct:
 #endif /* !CONFIG_XEN */
        pushl $-1                       # mark this as an int
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        xorl %edx,%edx                  # error code 0
        movl %esp,%eax                  # pt_regs pointer
        call do_debug
        jmp ret_from_exception
+       CFI_ENDPROC
        .previous .text
 
 #ifndef CONFIG_XEN
@@ -763,14 +977,18 @@ debug_stack_correct:
  * fault happened on the sysenter path.
  */
 ENTRY(nmi)
+       RING0_INT_FRAME
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        movl %ss, %eax
        cmpw $__ESPFIX_SS, %ax
        popl %eax
+       CFI_ADJUST_CFA_OFFSET -4
        je nmi_16bit_stack
        cmpl $sysenter_entry,(%esp)
        je nmi_stack_fixup
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        movl %esp,%eax
        /* Do not access memory above the end of our stack page,
         * it might not exist.
@@ -778,16 +996,19 @@ ENTRY(nmi)
        andl $(THREAD_SIZE-1),%eax
        cmpl $(THREAD_SIZE-20),%eax
        popl %eax
+       CFI_ADJUST_CFA_OFFSET -4
        jae nmi_stack_correct
        cmpl $sysenter_entry,12(%esp)
        je nmi_debug_stack_check
 nmi_stack_correct:
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        xorl %edx,%edx          # zero error code
        movl %esp,%eax          # pt_regs pointer
        call do_nmi
-       jmp restore_all
+       jmp restore_nocheck_notrace
+       CFI_ENDPROC
 
 nmi_stack_fixup:
        FIX_STACK(12,nmi_stack_correct, 1)
@@ -803,103 +1024,188 @@ nmi_debug_stack_check:
        jmp nmi_stack_correct
 
 nmi_16bit_stack:
+       RING0_INT_FRAME
        /* create the pointer to lss back */
        pushl %ss
+       CFI_ADJUST_CFA_OFFSET 4
        pushl %esp
+       CFI_ADJUST_CFA_OFFSET 4
        movzwl %sp, %esp
        addw $4, (%esp)
        /* copy the iret frame of 12 bytes */
        .rept 3
        pushl 16(%esp)
+       CFI_ADJUST_CFA_OFFSET 4
        .endr
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        FIXUP_ESPFIX_STACK              # %eax == %esp
+       CFI_ADJUST_CFA_OFFSET -20       # the frame has now moved
        xorl %edx,%edx                  # zero error code
        call do_nmi
        RESTORE_REGS
        lss 12+4(%esp), %esp            # back to 16bit stack
 1:     iret
+       CFI_ENDPROC
 .section __ex_table,"a"
        .align 4
        .long 1b,iret_exc
 .previous
 #else
 ENTRY(nmi)
+       RING0_INT_FRAME
        pushl %eax
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        xorl %edx,%edx          # zero error code
        movl %esp,%eax          # pt_regs pointer
        call do_nmi
        orl  $NMI_MASK, EFLAGS(%esp)
        jmp restore_all
+       CFI_ENDPROC
 #endif
 
 KPROBE_ENTRY(int3)
+       RING0_INT_FRAME
        pushl $-1                       # mark this as an int
+       CFI_ADJUST_CFA_OFFSET 4
        SAVE_ALL
        xorl %edx,%edx          # zero error code
        movl %esp,%eax          # pt_regs pointer
        call do_int3
        jmp ret_from_exception
+       CFI_ENDPROC
        .previous .text
 
 ENTRY(overflow)
+       RING0_INT_FRAME
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $do_overflow
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(bounds)
+       RING0_INT_FRAME
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $do_bounds
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(invalid_op)
+       RING0_INT_FRAME
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $do_invalid_op
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(coprocessor_segment_overrun)
+       RING0_INT_FRAME
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        pushl $do_coprocessor_segment_overrun
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(invalid_TSS)
+       RING0_EC_FRAME
        pushl $do_invalid_TSS
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(segment_not_present)
+       RING0_EC_FRAME
        pushl $do_segment_not_present
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 ENTRY(stack_segment)
+       RING0_EC_FRAME
        pushl $do_stack_segment
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 KPROBE_ENTRY(general_protection)
+       RING0_EC_FRAME
        pushl $do_general_protection
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
        .previous .text
 
 ENTRY(alignment_check)
+       RING0_EC_FRAME
        pushl $do_alignment_check
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 
 KPROBE_ENTRY(page_fault)
+       RING0_EC_FRAME
        pushl $do_page_fault
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
        .previous .text
 
 #ifdef CONFIG_X86_MCE
 ENTRY(machine_check)
+       RING0_INT_FRAME
        pushl $0
+       CFI_ADJUST_CFA_OFFSET 4
        pushl machine_check_vector
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
 #endif
 
 ENTRY(fixup_4gb_segment)
+       RING0_INT_FRAME
        pushl $do_fixup_4gb_segment
+       CFI_ADJUST_CFA_OFFSET 4
        jmp error_code
+       CFI_ENDPROC
+
+#ifdef CONFIG_STACK_UNWIND
+ENTRY(arch_unwind_init_running)
+       CFI_STARTPROC
+       movl    4(%esp), %edx
+       movl    (%esp), %ecx
+       leal    4(%esp), %eax
+       movl    %ebx, EBX(%edx)
+       xorl    %ebx, %ebx
+       movl    %ebx, ECX(%edx)
+       movl    %ebx, EDX(%edx)
+       movl    %esi, ESI(%edx)
+       movl    %edi, EDI(%edx)
+       movl    %ebp, EBP(%edx)
+       movl    %ebx, EAX(%edx)
+       movl    $__USER_DS, DS(%edx)
+       movl    $__USER_DS, ES(%edx)
+       movl    %ebx, ORIG_EAX(%edx)
+       movl    %ecx, EIP(%edx)
+       movl    12(%esp), %ecx
+       movl    $__KERNEL_CS, CS(%edx)
+       movl    %ebx, EFLAGS(%edx)
+       movl    %eax, OLDESP(%edx)
+       movl    8(%esp), %eax
+       movl    %ecx, 8(%esp)
+       movl    EBX(%edx), %ebx
+       movl    $__KERNEL_DS, OLDSS(%edx)
+       jmpl    *%eax
+       CFI_ENDPROC
+ENDPROC(arch_unwind_init_running)
+#endif
 
 .section .rodata,"a"
 #include "syscall_table.S"
index 15a8f20..b58bf15 100644 (file)
@@ -27,7 +27,6 @@
  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/sched.h>
 #include <linux/slab.h>
@@ -39,7 +38,8 @@
 
 fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code)
 {
-       static unsigned long printed = 1;
+#if 0
+       static unsigned long printed = 0;
        char info[100];
        int i;
 
@@ -75,6 +75,12 @@ fastcall void do_fixup_4gb_segment(struct pt_regs *regs, long error_code)
        }
 
        printk("Continuing...\n\n");
+#else
+       if (printk_ratelimit())
+               printk(KERN_WARNING
+                      "4gb seg fixup, process %s (pid %d), cs:ip %02x:%08lx\n",
+                      current->comm, current->tgid, regs->xcs, regs->eip);
+#endif
 }
 
 static int __init fixup_init(void)
index 25ce032..ddfa0c5 100644 (file)
@@ -1,7 +1,7 @@
 
 
 .text
-#include <linux/config.h>
+#include <linux/elfnote.h>
 #include <linux/threads.h>
 #include <linux/linkage.h>
 #include <asm/segment.h>
@@ -9,6 +9,7 @@
 #include <asm/thread_info.h>
 #include <asm/asm-offsets.h>
 #include <xen/interface/arch-x86_32.h>
+#include <xen/interface/elfnote.h>
 
 /*
  * References to members of the new_cpu_data structure.
@@ -138,6 +139,7 @@ ENTRY(cpu_gdt_table)
        .quad 0x0000000000000000        /* 0xf0 - unused */
        .quad 0x0000000000000000        /* 0xf8 - GDT entry 31: double-fault TSS */
 
+#ifdef CONFIG_XEN_COMPAT_030002
 /*
  * __xen_guest information
  */
@@ -157,12 +159,8 @@ ENTRY(cpu_gdt_table)
        .ascii  ",XEN_VER=xen-3.0"
        .ascii  ",VIRT_BASE=0x"
                utoa __PAGE_OFFSET
-#ifdef CONFIG_XEN_COMPAT_030002
        .ascii  ",ELF_PADDR_OFFSET=0x"
                utoa __PAGE_OFFSET
-#else
-       .ascii  ",ELF_PADDR_OFFSET=0x0"
-#endif /* !CONFIG_XEN_COMPAT_030002 */
        .ascii  ",VIRT_ENTRY=0x"
                utoa (__PAGE_OFFSET + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
        .ascii  ",HYPERCALL_PAGE=0x"
@@ -179,3 +177,24 @@ ENTRY(cpu_gdt_table)
 #endif
        .ascii  ",LOADER=generic"
        .byte   0
+#endif /* CONFIG_XEN_COMPAT_030002 */
+
+
+       ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz, "linux")       
+       ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz, "2.6")
+       ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz, "xen-3.0")
+       ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      .long,  __PAGE_OFFSET)
+#ifdef CONFIG_XEN_COMPAT_030002
+       ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .long,  __PAGE_OFFSET)
+#else
+       ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .long,  0)
+#endif /* !CONFIG_XEN_COMPAT_030002 */
+       ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .long,  startup_32)
+       ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .long,  hypercall_page)
+       ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
+#ifdef CONFIG_X86_PAE
+       ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "yes")
+#else
+       ELFNOTE(Xen, XEN_ELFNOTE_PAE_MODE,       .asciz, "no")
+#endif
+       ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
index 49e3ff8..f25eb9b 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
-#include <linux/config.h>
 #include <linux/smp_lock.h>
 #include <linux/mc146818rtc.h>
 #include <linux/compiler.h>
@@ -38,6 +37,7 @@
 #include <asm/desc.h>
 #include <asm/timer.h>
 #include <asm/i8259.h>
+#include <asm/nmi.h>
 
 #include <mach_apic.h>
 
@@ -90,6 +90,7 @@ atomic_t irq_mis_count;
 static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
 
 static DEFINE_SPINLOCK(ioapic_lock);
+static DEFINE_SPINLOCK(vector_lock);
 
 int timer_over_8254 __initdata = 1;
 
@@ -310,7 +311,7 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
 # include <linux/slab.h>               /* kmalloc() */
 # include <linux/timer.h>      /* time_after() */
  
-# ifdef CONFIG_BALANCED_IRQ_DEBUG
+#ifdef CONFIG_BALANCED_IRQ_DEBUG
 #  define TDprintk(x...) do { printk("<%ld:%s:%d>: ", jiffies, __FILE__, __LINE__); printk(x); } while (0)
 #  define Dprintk(x...) do { TDprintk(x); } while (0)
 # else
@@ -318,10 +319,15 @@ static void set_ioapic_affinity_irq(unsigned int irq, cpumask_t cpumask)
 #  define Dprintk(x...) 
 # endif
 
-
 #define IRQBALANCE_CHECK_ARCH -999
-static int irqbalance_disabled = IRQBALANCE_CHECK_ARCH;
-static int physical_balance = 0;
+#define MAX_BALANCED_IRQ_INTERVAL      (5*HZ)
+#define MIN_BALANCED_IRQ_INTERVAL      (HZ/2)
+#define BALANCED_IRQ_MORE_DELTA                (HZ/10)
+#define BALANCED_IRQ_LESS_DELTA                (HZ)
+
+static int irqbalance_disabled __read_mostly = IRQBALANCE_CHECK_ARCH;
+static int physical_balance __read_mostly;
+static long balanced_irq_interval __read_mostly = MAX_BALANCED_IRQ_INTERVAL;
 
 static struct irq_cpu_info {
        unsigned long * last_irq;
@@ -340,12 +346,14 @@ static struct irq_cpu_info {
 
 #define CPU_TO_PACKAGEINDEX(i) (first_cpu(cpu_sibling_map[i]))
 
-#define MAX_BALANCED_IRQ_INTERVAL      (5*HZ)
-#define MIN_BALANCED_IRQ_INTERVAL      (HZ/2)
-#define BALANCED_IRQ_MORE_DELTA                (HZ/10)
-#define BALANCED_IRQ_LESS_DELTA                (HZ)
+static cpumask_t balance_irq_affinity[NR_IRQS] = {
+       [0 ... NR_IRQS-1] = CPU_MASK_ALL
+};
 
-static long balanced_irq_interval = MAX_BALANCED_IRQ_INTERVAL;
+void set_balance_irq_affinity(unsigned int irq, cpumask_t mask)
+{
+       balance_irq_affinity[irq] = mask;
+}
 
 static unsigned long move(int curr_cpu, cpumask_t allowed_mask,
                        unsigned long now, int direction)
@@ -383,7 +391,7 @@ static inline void balance_irq(int cpu, int irq)
        if (irqbalance_disabled)
                return; 
 
-       cpus_and(allowed_mask, cpu_online_map, irq_affinity[irq]);
+       cpus_and(allowed_mask, cpu_online_map, balance_irq_affinity[irq]);
        new_cpu = move(cpu, allowed_mask, now, 1);
        if (cpu != new_cpu) {
                set_pending_irq(irq, cpumask_of_cpu(new_cpu));
@@ -572,7 +580,9 @@ tryanotherirq:
                }
        }
 
-       cpus_and(allowed_mask, cpu_online_map, irq_affinity[selected_irq]);
+       cpus_and(allowed_mask,
+                cpu_online_map,
+                balance_irq_affinity[selected_irq]);
        target_cpu_mask = cpumask_of_cpu(min_loaded);
        cpus_and(tmp, target_cpu_mask, allowed_mask);
 
@@ -613,7 +623,7 @@ static int balanced_irq(void *unused)
        
        /* push everything to CPU 0 to give us a starting point.  */
        for (i = 0 ; i < NR_IRQS ; i++) {
-               pending_irq_cpumask[i] = cpumask_of_cpu(0);
+               irq_desc[i].pending_mask[i] = cpumask_of_cpu(0);
                set_pending_irq(i, cpumask_of_cpu(0));
        }
 
@@ -1200,11 +1210,16 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mostly; /* = { FIRST_DEVICE_VECTOR , 0 }; *
 int assign_irq_vector(int irq)
 {
        struct physdev_irq irq_op;
+       unsigned long flags;
 
-       BUG_ON(irq >= NR_IRQ_VECTORS);
-       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
-               return IO_APIC_VECTOR(irq);
+       BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
+
+       spin_lock_irqsave(&vector_lock, flags);
 
+       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
+               spin_unlock_irqrestore(&vector_lock, flags);
+               return IO_APIC_VECTOR(irq);
+       }
        irq_op.irq = irq;
        if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
                return -ENOSPC;
@@ -1213,6 +1228,8 @@ int assign_irq_vector(int irq)
        if (irq != AUTO_ASSIGN)
                IO_APIC_VECTOR(irq) = irq_op.vector;
 
+       spin_unlock_irqrestore(&vector_lock, flags);
+
        return irq_op.vector;
 }
 
@@ -1224,23 +1241,18 @@ static struct hw_interrupt_type ioapic_edge_type;
 #define IOAPIC_EDGE    0
 #define IOAPIC_LEVEL   1
 
-static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger)
+static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 {
-       if (use_pci_vector() && !platform_legacy_irq(irq)) {
-               if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-                               trigger == IOAPIC_LEVEL)
-                       irq_desc[vector].handler = &ioapic_level_type;
-               else
-                       irq_desc[vector].handler = &ioapic_edge_type;
-               set_intr_gate(vector, interrupt[vector]);
-       } else  {
-               if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-                               trigger == IOAPIC_LEVEL)
-                       irq_desc[irq].handler = &ioapic_level_type;
-               else
-                       irq_desc[irq].handler = &ioapic_edge_type;
-               set_intr_gate(vector, interrupt[irq]);
-       }
+       unsigned idx;
+
+       idx = use_pci_vector() && !platform_legacy_irq(irq) ? vector : irq;
+
+       if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
+                       trigger == IOAPIC_LEVEL)
+               irq_desc[idx].chip = &ioapic_level_type;
+       else
+               irq_desc[idx].chip = &ioapic_edge_type;
+       set_intr_gate(vector, interrupt[idx]);
 }
 #else
 #define ioapic_register_intr(_irq,_vector,_trigger) ((void)0)
@@ -1355,7 +1367,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
         * The timer IRQ doesn't have to know that behind the
         * scene we have a 8259A-master in AEOI mode ...
         */
-       irq_desc[0].handler = &ioapic_edge_type;
+       irq_desc[0].chip = &ioapic_edge_type;
 
        /*
         * Add it to the IO-APIC irq-routing table:
@@ -2106,6 +2118,13 @@ static void set_ioapic_affinity_vector (unsigned int vector,
 #endif
 #endif
 
+static int ioapic_retrigger(unsigned int irq)
+{
+       send_IPI_self(IO_APIC_VECTOR(irq));
+
+       return 1;
+}
+
 /*
  * Level and edge triggered IO-APIC interrupts need different handling,
  * so we use two separate IRQ descriptors. Edge triggered IRQs can be
@@ -2125,6 +2144,7 @@ static struct hw_interrupt_type ioapic_edge_type __read_mostly = {
 #ifdef CONFIG_SMP
        .set_affinity   = set_ioapic_affinity,
 #endif
+       .retrigger      = ioapic_retrigger,
 };
 
 static struct hw_interrupt_type ioapic_level_type __read_mostly = {
@@ -2138,6 +2158,7 @@ static struct hw_interrupt_type ioapic_level_type __read_mostly = {
 #ifdef CONFIG_SMP
        .set_affinity   = set_ioapic_affinity,
 #endif
+       .retrigger      = ioapic_retrigger,
 };
 #endif /* !CONFIG_XEN */
 
@@ -2174,12 +2195,14 @@ static inline void init_IO_APIC_traps(void)
 #ifndef CONFIG_XEN
                        else
                                /* Strange. Oh, well.. */
-                               irq_desc[irq].handler = &no_irq_type;
+                               irq_desc[irq].chip = &no_irq_type;
 #endif
                }
        }
 }
 
+int timer_uses_ioapic_pin_0;
+
 #ifndef CONFIG_XEN
 static void enable_lapic_irq (unsigned int irq)
 {
@@ -2295,8 +2318,6 @@ static inline void unlock_ExtINT_logic(void)
        spin_unlock_irqrestore(&ioapic_lock, flags);
 }
 
-int timer_uses_ioapic_pin_0;
-
 /*
  * This code may look a bit paranoid, but it's supposed to cooperate with
  * a wide range of boards and BIOS bugs.  Fortunately only the timer IRQ
@@ -2392,7 +2413,7 @@ static inline void check_timer(void)
        printk(KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
 
        disable_8259A_irq(0);
-       irq_desc[0].handler = &lapic_irq_type;
+       irq_desc[0].chip = &lapic_irq_type;
        apic_write_around(APIC_LVT0, APIC_DM_FIXED | vector);   /* Fixed mode */
        enable_8259A_irq(0);
 
@@ -2421,7 +2442,6 @@ static inline void check_timer(void)
                "report.  Then try booting with the 'noapic' option");
 }
 #else
-int timer_uses_ioapic_pin_0;
 #define check_timer() ((void)0)
 #endif
 
@@ -2483,7 +2503,7 @@ static int __init io_apic_bug_finalize(void)
 {
        if(sis_apic_bug == -1)
                sis_apic_bug = 0;
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                dom0_op_t op = { .cmd = DOM0_PLATFORM_QUIRK };
                op.u.platform_quirk.quirk_id = sis_apic_bug ?
                        QUIRK_IOAPIC_BAD_REGSEL : QUIRK_IOAPIC_GOOD_REGSEL;
index 082324f..f010a90 100644 (file)
@@ -84,11 +84,6 @@ static ssize_t microcode_write (struct file *file, const char __user *buf, size_
 {
        ssize_t ret;
 
-       if (len < DEFAULT_UCODE_TOTALSIZE) {
-               printk(KERN_ERR "microcode: not enough data\n"); 
-               return -EINVAL;
-       }
-
        if ((len >> PAGE_SHIFT) > num_physpages) {
                printk(KERN_ERR "microcode: too much data (max %ld pages)\n", num_physpages);
                return -EINVAL;
@@ -117,7 +112,6 @@ static struct file_operations microcode_fops = {
 static struct miscdevice microcode_dev = {
        .minor          = MICROCODE_MINOR,
        .name           = "microcode",
-       .devfs_name     = "cpu/microcode",
        .fops           = &microcode_fops,
 };
 
index 48e0bc0..3e15788 100644 (file)
@@ -17,7 +17,6 @@
 #include <linux/init.h>
 #include <linux/acpi.h>
 #include <linux/delay.h>
-#include <linux/config.h>
 #include <linux/bootmem.h>
 #include <linux/smp_lock.h>
 #include <linux/kernel_stat.h>
index 5c32dd0..29fddf6 100644 (file)
@@ -31,6 +31,41 @@ EXPORT_SYMBOL(bad_dma_address);
 int iommu_bio_merge __read_mostly = 0;
 EXPORT_SYMBOL(iommu_bio_merge);
 
+int iommu_sac_force __read_mostly = 0;
+EXPORT_SYMBOL(iommu_sac_force);
+
+int no_iommu __read_mostly;
+#ifdef CONFIG_IOMMU_DEBUG
+int panic_on_overflow __read_mostly = 1;
+int force_iommu __read_mostly = 1;
+#else
+int panic_on_overflow __read_mostly = 0;
+int force_iommu __read_mostly= 0;
+#endif
+
+/* Set this to 1 if there is a HW IOMMU in the system */
+int iommu_detected __read_mostly = 0;
+
+void __init pci_iommu_alloc(void)
+{
+       /*
+        * The order of these functions is important for
+        * fall-back/fail-over reasons
+        */
+#ifdef CONFIG_IOMMU
+       iommu_hole_init();
+#endif
+
+#ifdef CONFIG_CALGARY_IOMMU
+#include <asm/calgary.h>
+       detect_calgary();
+#endif
+
+#ifdef CONFIG_SWIOTLB
+       pci_swiotlb_init();
+#endif
+}
+
 __init int iommu_setup(char *p)
 {
     return 1;
index 0c2fdcc..a9508f6 100644 (file)
@@ -28,7 +28,6 @@
 #include <linux/user.h>
 #include <linux/a.out.h>
 #include <linux/interrupt.h>
-#include <linux/config.h>
 #include <linux/utsname.h>
 #include <linux/delay.h>
 #include <linux/reboot.h>
@@ -61,9 +60,6 @@
 #include <asm/tlbflush.h>
 #include <asm/cpu.h>
 
-#include <asm/tlbflush.h>
-#include <asm/cpu.h>
-
 asmlinkage void ret_from_fork(void) __asm__("ret_from_fork");
 
 static int hlt_counter;
@@ -108,10 +104,10 @@ void xen_idle(void)
        if (need_resched())
                local_irq_enable();
        else {
-               clear_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status &= ~TS_POLLING;
                smp_mb__after_clear_bit();
                safe_halt();
-               set_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status |= TS_POLLING;
        }
 }
 #ifdef CONFIG_APM_MODULE
@@ -146,7 +142,8 @@ void cpu_idle(void)
 {
        int cpu = smp_processor_id();
 
-       set_thread_flag(TIF_POLLING_NRFLAG);
+       current_thread_info()->status |= TS_POLLING;
+
 
        /* endless idle loop with no priority at all */
        while (1) {
@@ -228,7 +225,7 @@ void show_regs(struct pt_regs * regs)
        cr3 = read_cr3();
        cr4 = read_cr4_safe();
        printk("CR0: %08lx CR2: %08lx CR3: %08lx CR4: %08lx\n", cr0, cr2, cr3, cr4);
-       show_trace(NULL, &regs->esp);
+       show_trace(NULL, regs, &regs->esp);
 }
 
 /*
@@ -276,15 +273,16 @@ EXPORT_SYMBOL(kernel_thread);
  */
 void exit_thread(void)
 {
-       struct task_struct *tsk = current;
-       struct thread_struct *t = &tsk->thread;
-
        /* The process may have allocated an io port bitmap... nuke it. */
-       if (unlikely(NULL != t->io_bitmap_ptr)) {
+       if (unlikely(test_thread_flag(TIF_IO_BITMAP))) {
+               struct task_struct *tsk = current;
+               struct thread_struct *t = &tsk->thread;
+
                struct physdev_set_iobitmap set_iobitmap = { 0 };
                HYPERVISOR_physdev_op(PHYSDEVOP_set_iobitmap, &set_iobitmap);
                kfree(t->io_bitmap_ptr);
                t->io_bitmap_ptr = NULL;
+               clear_thread_flag(TIF_IO_BITMAP);
        }
 }
 
@@ -294,6 +292,7 @@ void flush_thread(void)
 
        memset(tsk->thread.debugreg, 0, sizeof(unsigned long)*8);
        memset(tsk->thread.tls_array, 0, sizeof(tsk->thread.tls_array));        
+       clear_tsk_thread_flag(tsk, TIF_DEBUG);
        /*
         * Forget coprocessor state..
         */
@@ -338,7 +337,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
        savesegment(gs,p->thread.gs);
 
        tsk = current;
-       if (unlikely(NULL != tsk->thread.io_bitmap_ptr)) {
+       if (unlikely(test_tsk_thread_flag(tsk, TIF_IO_BITMAP))) {
                p->thread.io_bitmap_ptr = kmalloc(IO_BITMAP_BYTES, GFP_KERNEL);
                if (!p->thread.io_bitmap_ptr) {
                        p->thread.io_bitmap_max = 0;
@@ -346,6 +345,7 @@ int copy_thread(int nr, unsigned long clone_flags, unsigned long esp,
                }
                memcpy(p->thread.io_bitmap_ptr, tsk->thread.io_bitmap_ptr,
                        IO_BITMAP_BYTES);
+               set_tsk_thread_flag(p, TIF_IO_BITMAP);
        }
 
        /*
@@ -524,6 +524,7 @@ struct task_struct fastcall * __switch_to(struct task_struct *prev_p, struct tas
 #if 0 /* lazy fpu sanity check */
        else BUG_ON(!(read_cr0() & 8));
 #endif
+
        if (next_p->mm)
                load_user_cs_desc(cpu, next_p->mm);
 
@@ -825,6 +826,7 @@ void arch_add_exec_range(struct mm_struct *mm, unsigned long limit)
                }
        }
 }
+
 void arch_remove_exec_range(struct mm_struct *mm, unsigned long old_end)
 {
        struct vm_area_struct *vma;
index 7e44d81..26b3534 100644 (file)
@@ -1,7 +1,6 @@
 /*
  * This file contains work-arounds for x86 and x86_64 platform bugs.
  */
-#include <linux/config.h>
 #include <linux/pci.h>
 #include <linux/irq.h>
 
index 1b183b3..99aab41 100644 (file)
@@ -10,6 +10,7 @@
 
 #include <asm/delay.h>
 #include <linux/pci.h>
+#include <linux/reboot_fixups.h>
 
 static void cs5530a_warm_reset(struct pci_dev *dev)
 {
@@ -42,15 +43,13 @@ void mach_reboot_fixups(void)
        struct pci_dev *dev;
        int i;
 
-       for (i=0; i < (sizeof(fixups_table)/sizeof(fixups_table[0])); i++) {
+       for (i=0; i < ARRAY_SIZE(fixups_table); i++) {
                cur = &(fixups_table[i]);
-               dev = pci_get_device(cur->vendor, cur->device, 0);
+               dev = pci_get_device(cur->vendor, cur->device, NULL);
                if (!dev)
                        continue;
 
                cur->reboot_fixup(dev);
        }
-
-       printk(KERN_WARNING "No reboot fixup found for your hardware\n");
 }
 
index 3508a88..be4e01c 100644 (file)
  * This file handles the architecture-dependent parts of initialization
  */
 
-#include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/mmzone.h>
-#include <linux/tty.h>
+#include <linux/screen_info.h>
 #include <linux/ioport.h>
 #include <linux/acpi.h>
 #include <linux/apm_bios.h>
@@ -67,7 +66,8 @@
 #include <xen/interface/physdev.h>
 #include <xen/interface/memory.h>
 #include <xen/features.h>
-#include "setup_arch_pre.h"
+#include <xen/xencons.h>
+#include "setup_arch.h"
 #include <bios_ebda.h>
 
 /* Forward Declaration. */
@@ -157,6 +157,10 @@ struct ist_info ist_info;
 EXPORT_SYMBOL(ist_info);
 #endif
 struct e820map e820;
+static void __init e820_setup_gap(struct e820entry *e820, int nr_map);
+#ifdef CONFIG_XEN
+struct e820map machine_e820;
+#endif
 
 extern void early_cpu_init(void);
 extern void generic_apic_probe(char *);
@@ -186,7 +190,6 @@ static struct resource code_resource = {
        .flags  = IORESOURCE_BUSY | IORESOURCE_MEM
 };
 
-#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 static struct resource system_rom_resource = {
        .name   = "System ROM",
        .start  = 0xf0000,
@@ -242,7 +245,6 @@ static struct resource video_rom_resource = {
        .end    = 0xc7fff,
        .flags  = IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM
 };
-#endif
 
 static struct resource video_ram_resource = {
        .name   = "Video RAM area",
@@ -301,7 +303,6 @@ static struct resource standard_io_resources[] = { {
 #define STANDARD_IO_RESOURCES \
        (sizeof standard_io_resources / sizeof standard_io_resources[0])
 
-#ifdef CONFIG_XEN_PRIVILEGED_GUEST
 #define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
 
 static int __init romchecksum(unsigned char *rom, unsigned long length)
@@ -319,9 +320,11 @@ static void __init probe_roms(void)
        unsigned char *rom;
        int           i;
 
+#ifdef CONFIG_XEN
        /* Nothing to do if not running in dom0. */
-       if (!(xen_start_info->flags & SIF_INITDOMAIN))
+       if (!is_initial_xendomain())
                return;
+#endif
 
        /* video rom */
        upper = adapter_rom_resources[0].start;
@@ -338,8 +341,6 @@ static void __init probe_roms(void)
                /* if checksum okay, trust length byte */
                if (length && romchecksum(rom, length))
                        video_rom_resource.end = start + length - 1;
-
-               request_resource(&iomem_resource, &video_rom_resource);
                break;
        }
 
@@ -381,7 +382,6 @@ static void __init probe_roms(void)
                start = adapter_rom_resources[i++].end & ~2047UL;
        }
 }
-#endif
 
 /*
  * Point at the empty zero page to start with. We map the real shared_info
@@ -398,7 +398,7 @@ EXPORT_SYMBOL(phys_to_machine_mapping);
 start_info_t *xen_start_info;
 EXPORT_SYMBOL(xen_start_info);
 
-static void __init add_memory_region(unsigned long long start,
+void __init add_memory_region(unsigned long long start,
                                   unsigned long long size, int type)
 {
        int x;
@@ -520,7 +520,7 @@ static struct change_member *change_point[2*E820MAX] __initdata;
 static struct e820entry *overlap_list[E820MAX] __initdata;
 static struct e820entry new_bios[E820MAX] __initdata;
 
-static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
+int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
 {
        struct change_member *change_tmp;
        unsigned long current_type, last_type;
@@ -689,7 +689,7 @@ static int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map)
  * thinkpad 560x, for example, does not cooperate with the memory
  * detection code.)
  */
-static int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
+int __init copy_e820_map(struct e820entry * biosmap, int nr_map)
 {
 #ifndef CONFIG_XEN
        /* Only one memory region (or negative)? Ignore it */
@@ -753,12 +753,6 @@ static inline void copy_edd(void)
 }
 #endif
 
-/*
- * Do NOT EVER look at the BIOS memory size location.
- * It does not work on many machines.
- */
-#define LOWMEMSIZE()   (0x9f000)
-
 static void __init parse_cmdline_early (char ** cmdline_p)
 {
        char c = ' ', *to = command_line, *from = saved_command_line;
@@ -1147,10 +1141,10 @@ static int __init
 free_available_memory(unsigned long start, unsigned long end, void *arg)
 {
        /* check max_low_pfn */
-       if (start >= ((max_low_pfn + 1) << PAGE_SHIFT))
+       if (start >= (max_low_pfn << PAGE_SHIFT))
                return 0;
-       if (end >= ((max_low_pfn + 1) << PAGE_SHIFT))
-               end = (max_low_pfn + 1) << PAGE_SHIFT;
+       if (end >= (max_low_pfn << PAGE_SHIFT))
+               end = max_low_pfn << PAGE_SHIFT;
        if (start < end)
                free_bootmem(start, end - start);
 
@@ -1387,39 +1381,56 @@ void __init remapped_pgdat_init(void)
  * and also for regions reported as reserved by the e820.
  */
 static void __init
-legacy_init_iomem_resources(struct e820entry *e820, int nr_map,
-                           struct resource *code_resource,
-                           struct resource *data_resource)
+legacy_init_iomem_resources(struct resource *code_resource, struct resource *data_resource)
 {
        int i;
+       struct e820entry *map = e820.map;
+       int nr_map = e820.nr_map;
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+       struct xen_memory_map memmap;
 
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
-       probe_roms();
+       map = machine_e820.map;
+       memmap.nr_entries = E820MAX;
+
+       set_xen_guest_handle(memmap.buffer, map);
+
+       if(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
+               BUG();
+       machine_e820.nr_map = memmap.nr_entries;
+       nr_map = memmap.nr_entries;
+       e820_setup_gap(map, memmap.nr_entries);
 #endif
 
+       probe_roms();
+
        for (i = 0; i < nr_map; i++) {
                struct resource *res;
-               if (e820[i].addr + e820[i].size > 0x100000000ULL)
+               if (map[i].addr + map[i].size > 0x100000000ULL)
                        continue;
-               res = alloc_bootmem_low(sizeof(struct resource));
-               switch (e820[i].type) {
+               res = kzalloc(sizeof(struct resource), GFP_ATOMIC);
+               switch (map[i].type) {
                case E820_RAM:  res->name = "System RAM"; break;
                case E820_ACPI: res->name = "ACPI Tables"; break;
                case E820_NVS:  res->name = "ACPI Non-volatile Storage"; break;
                default:        res->name = "reserved";
                }
-               res->start = e820[i].addr;
-               res->end = res->start + e820[i].size - 1;
+               res->start = map[i].addr;
+               res->end = res->start + map[i].size - 1;
                res->flags = IORESOURCE_MEM | IORESOURCE_BUSY;
-               request_resource(&iomem_resource, res);
-               if (e820[i].type == E820_RAM) {
+               if (request_resource(&iomem_resource, res)) {
+                       kfree(res);
+                       continue;
+               }
+               if (map[i].type == E820_RAM) {
                        /*
                         *  We don't know which RAM region contains kernel data,
                         *  so we try it repeatedly and let the resource manager
                         *  test it.
                         */
+#ifndef CONFIG_XEN
                        request_resource(res, code_resource);
                        request_resource(res, data_resource);
+#endif
 #ifdef CONFIG_KEXEC
                        request_resource(res, &crashk_res);
 #endif
@@ -1427,6 +1438,37 @@ legacy_init_iomem_resources(struct e820entry *e820, int nr_map,
        }
 }
 
+/*
+ * Request address space for all standard resources
+ *
+ * This is called just before pcibios_init(), which is also a
+ * subsys_initcall, but is linked in later (in arch/i386/pci/common.c).
+ */
+static int __init request_standard_resources(void)
+{
+       int i;
+
+       /* Nothing to do if not running in dom0. */
+       if (!is_initial_xendomain())
+               return 0;
+
+       printk("Setting up standard PCI resources\n");
+       if (efi_enabled)
+               efi_initialize_iomem_resources(&code_resource, &data_resource);
+       else
+               legacy_init_iomem_resources(&code_resource, &data_resource);
+
+       /* EFI systems may still have VGA */
+       request_resource(&iomem_resource, &video_ram_resource);
+
+       /* request I/O space for devices used on all i[345]86 PCs */
+       for (i = 0; i < STANDARD_IO_RESOURCES; i++)
+               request_resource(&ioport_resource, &standard_io_resources[i]);
+       return 0;
+}
+
+subsys_initcall(request_standard_resources);
+
 /*
  * Locate a unused range of the physical address space below 4G which
  * can be used for PCI mappings.
@@ -1480,59 +1522,13 @@ e820_setup_gap(struct e820entry *e820, int nr_map)
                pci_mem_start, gapstart, gapsize);
 }
 
-/*
- * Request address space for all standard resources
- */
 static void __init register_memory(void)
 {
-#ifdef CONFIG_XEN
-       struct e820entry *machine_e820;
-       struct xen_memory_map memmap;
-#endif
-       int           i;
-
-       /* Nothing to do if not running in dom0. */
-       if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
-               legacy_init_iomem_resources(e820.map, e820.nr_map,
-                                           &code_resource, &data_resource);
-               return;
-       }
-
-#ifdef CONFIG_XEN
-       machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
-
-       memmap.nr_entries = E820MAX;
-       set_xen_guest_handle(memmap.buffer, machine_e820);
-
-       BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap));
-
-       legacy_init_iomem_resources(machine_e820, memmap.nr_entries,
-                                   &code_resource, &data_resource);
-#else
-       if (efi_enabled)
-               efi_initialize_iomem_resources(&code_resource, &data_resource);
-       else
-               legacy_init_iomem_resources(e820.map, e820.nr_map,
-                                           &code_resource, &data_resource);
-#endif
-
-       /* EFI systems may still have VGA */
-       request_resource(&iomem_resource, &video_ram_resource);
-
-       /* request I/O space for devices used on all i[345]86 PCs */
-       for (i = 0; i < STANDARD_IO_RESOURCES; i++)
-               request_resource(&ioport_resource, &standard_io_resources[i]);
-
-#ifdef CONFIG_XEN
-       e820_setup_gap(machine_e820, memmap.nr_entries);
-       free_bootmem(__pa(machine_e820), PAGE_SIZE);
-#else
+#ifndef CONFIG_XEN
        e820_setup_gap(e820.map, e820.nr_map);
 #endif
 }
 
-static char * __init machine_specific_memory_setup(void);
-
 #ifdef CONFIG_MCA
 static void set_mca_bus(int x)
 {
@@ -1557,7 +1553,7 @@ void __init setup_arch(char **cmdline_p)
 
        /* Force a quick death if the kernel panics (not domain 0). */
        extern int panic_timeout;
-       if (!panic_timeout && !(xen_start_info->flags & SIF_INITDOMAIN))
+       if (!panic_timeout && !is_initial_xendomain())
                panic_timeout = 1;
 
        /* Register a call for panic conditions. */
@@ -1601,7 +1597,7 @@ void __init setup_arch(char **cmdline_p)
        }
        bootloader_type = LOADER_TYPE;
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                /* This is drawn from a dump from vgacon:startup in
                 * standard Linux. */
                screen_info.orig_video_mode = 3; 
@@ -1610,6 +1606,17 @@ void __init setup_arch(char **cmdline_p)
                screen_info.orig_video_cols = 80;
                screen_info.orig_video_ega_bx = 3;
                screen_info.orig_video_points = 16;
+               screen_info.orig_y = screen_info.orig_video_lines - 1;
+               if (xen_start_info->console.dom0.info_size >=
+                   sizeof(struct dom0_vga_console_info)) {
+                       const struct dom0_vga_console_info *info =
+                               (struct dom0_vga_console_info *)(
+                                       (char *)xen_start_info +
+                                       xen_start_info->console.dom0.info_off);
+                       dom0_init_screen_info(info);
+               }
+               xen_start_info->console.domU.mfn = 0;
+               xen_start_info->console.domU.evtchn = 0;
        } else
                screen_info.orig_video_isVGA = 0;
 
@@ -1726,7 +1733,7 @@ void __init setup_arch(char **cmdline_p)
         * NOTE: at this point the bootmem allocator is fully available.
         */
 
-       if (xen_start_info->flags & SIF_INITDOMAIN)
+       if (is_initial_xendomain())
                dmi_scan_machine();
 
 #ifdef CONFIG_X86_GENERICARCH
@@ -1738,12 +1745,8 @@ void __init setup_arch(char **cmdline_p)
        set_iopl.iopl = 1;
        HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
 
-#ifdef CONFIG_X86_IO_APIC
-       check_acpi_pci();       /* Checks more than just ACPI actually */
-#endif
-
 #ifdef CONFIG_ACPI
-       if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
+       if (!is_initial_xendomain()) {
                printk(KERN_INFO "ACPI in unprivileged domain disabled\n");
                acpi_disabled = 1;
                acpi_ht = 0;
@@ -1753,6 +1756,13 @@ void __init setup_arch(char **cmdline_p)
         * Parse the ACPI tables for possible boot-time SMP configuration.
         */
        acpi_boot_table_init();
+#endif
+
+#ifdef CONFIG_X86_IO_APIC
+       check_acpi_pci();       /* Checks more than just ACPI actually */
+#endif
+
+#ifdef CONFIG_ACPI
        acpi_boot_init();
 
 #if defined(CONFIG_SMP) && defined(CONFIG_X86_PC)
@@ -1772,11 +1782,7 @@ void __init setup_arch(char **cmdline_p)
 
        register_memory();
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
-               if (!(xen_start_info->flags & SIF_PRIVILEGED))
-                       panic("Xen granted us console access "
-                             "but not privileged status");
-
+       if (is_initial_xendomain()) {
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
                if (!efi_enabled ||
@@ -1787,9 +1793,13 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif
        } else {
-               extern int console_use_vt;
-               console_use_vt = 0;
+#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
+               conswitchp = &dummy_con;
+#endif
        }
+#ifdef CONFIG_X86_TSC
+       tsc_init();
+#endif
 }
 
 static int
@@ -1817,7 +1827,6 @@ static __init int add_pcspkr(void)
 }
 device_initcall(add_pcspkr);
 
-#include "setup_arch_post.h"
 /*
  * Local Variables:
  * mode:c
index 78e3784..0079ba6 100644 (file)
@@ -118,7 +118,17 @@ DEFINE_PER_CPU(struct tlb_state, cpu_tlbstate) ____cacheline_aligned = { &init_m
 
 static inline int __prepare_ICR (unsigned int shortcut, int vector)
 {
-       return APIC_DM_FIXED | shortcut | vector | APIC_DEST_LOGICAL;
+       unsigned int icr = shortcut | APIC_DEST_LOGICAL;
+
+       switch (vector) {
+       default:
+               icr |= APIC_DM_FIXED | vector;
+               break;
+       case NMI_VECTOR:
+               icr |= APIC_DM_NMI;
+               break;
+       }
+       return icr;
 }
 
 static inline int __prepare_ICR2 (unsigned int mask)
index 733799b..7ae10ad 100644 (file)
@@ -50,7 +50,7 @@ EXPORT_SYMBOL(swiotlb);
 /* Width of DMA addresses in the IO TLB. 31 bits is an aacraid limitation. */
 #define IO_TLB_DMA_BITS 31
 
-static int swiotlb_force;
+int swiotlb_force;
 static char *iotlb_virt_start;
 static unsigned long iotlb_nslabs;
 
@@ -199,7 +199,7 @@ swiotlb_init(void)
                swiotlb = 1;
        } else if ((swiotlb_force != -1) &&
                   is_running_on_xen() &&
-                  (xen_start_info->flags & SIF_INITDOMAIN)) {
+                  is_initial_xendomain()) {
                /* Domain 0 always has a swiotlb. */
                ram_end = HYPERVISOR_memory_op(XENMEM_maximum_ram_page, NULL);
                if (ram_end <= 0x7ffff)
index 504d27d..adfc8fc 100644 (file)
@@ -65,7 +65,6 @@
 #include "mach_time.h"
 
 #include <linux/timex.h>
-#include <linux/config.h>
 
 #include <asm/hpet.h>
 
@@ -89,6 +88,13 @@ struct timespec __xtime __section_xtime;
 struct timezone __sys_tz __section_sys_tz;
 #endif
 
+#define USEC_PER_TICK (USEC_PER_SEC / HZ)
+#define NSEC_PER_TICK (NSEC_PER_SEC / HZ)
+#define FSEC_PER_TICK (FSEC_PER_SEC / HZ)
+
+#define NS_SCALE       10 /* 2^10, carefully chosen */
+#define US_SCALE       32 /* 2^32, arbitralrily chosen */
+
 unsigned int cpu_khz;  /* Detected as we calibrate the TSC */
 EXPORT_SYMBOL(cpu_khz);
 
@@ -97,17 +103,9 @@ extern unsigned long wall_jiffies;
 DEFINE_SPINLOCK(rtc_lock);
 EXPORT_SYMBOL(rtc_lock);
 
-#if defined (__i386__)
-#include <asm/i8253.h>
-#endif
-
-DEFINE_SPINLOCK(i8253_lock);
-EXPORT_SYMBOL(i8253_lock);
-
 extern struct init_timer_opts timer_tsc_init;
 extern struct timer_opts timer_tsc;
 #define timer_none timer_tsc
-struct timer_opts *cur_timer __read_mostly = &timer_tsc;
 
 /* These are peridically updated in shared_info, and then copied here. */
 struct shadow_time_info {
@@ -166,7 +164,9 @@ static int __init __permitted_clock_jitter(char *str)
 }
 __setup("permitted_clock_jitter=", __permitted_clock_jitter);
 
+#ifndef CONFIG_X86
 int tsc_disable __devinitdata = 0;
+#endif
 
 static void delay_tsc(unsigned long loops)
 {
@@ -210,7 +210,7 @@ static inline u64 scale_delta(u64 delta, u32 mul_frac, int shift)
                "add  %4,%%eax ; "
                "adc  %5,%%edx ; "
                : "=A" (product), "=r" (tmp1), "=r" (tmp2)
-               : "a" ((u32)delta), "1" ((u32)(delta >> 32)), "2" (mul_frac) );
+               : "a" ((u32)delta), "1" ((u32)(delta >> US_SCALE)), "2" (mul_frac) );
 #else
        __asm__ (
                "mul %%rdx ; shrd $32,%%rdx,%%rax"
@@ -230,7 +230,7 @@ int read_current_timer(unsigned long *timer_val)
 
 void init_cpu_khz(void)
 {
-       u64 __cpu_khz = 1000000ULL << 32;
+       u64 __cpu_khz = 1000000ULL << US_SCALE;
        struct vcpu_time_info *info;
        info = &HYPERVISOR_shared_info->vcpu_info[0].time;
        do_div(__cpu_khz, info->tsc_to_system_mul);
@@ -470,8 +470,7 @@ int do_settimeofday(struct timespec *tv)
        sec = tv->tv_sec;
        __normalize_time(&sec, &nsec);
 
-       if ((xen_start_info->flags & SIF_INITDOMAIN) &&
-           !independent_wallclock) {
+       if (is_initial_xendomain() && !independent_wallclock) {
                op.cmd = DOM0_SETTIME;
                op.u.settime.secs        = sec;
                op.u.settime.nsecs       = nsec;
@@ -502,8 +501,7 @@ static void sync_xen_wallclock(unsigned long dummy)
        s64 nsec;
        dom0_op_t op;
 
-       if (!ntp_synced() || independent_wallclock ||
-           !(xen_start_info->flags & SIF_INITDOMAIN))
+       if (!ntp_synced() || independent_wallclock || !is_initial_xendomain())
                return;
 
        write_seqlock_irq(&xtime_lock);
@@ -529,19 +527,18 @@ static void sync_xen_wallclock(unsigned long dummy)
 static int set_rtc_mmss(unsigned long nowtime)
 {
        int retval;
+       unsigned long flags;
 
-       WARN_ON(irqs_disabled());
-
-       if (independent_wallclock || !(xen_start_info->flags & SIF_INITDOMAIN))
+       if (independent_wallclock || !is_initial_xendomain())
                return 0;
 
        /* gets recalled with irq locally disabled */
-       spin_lock_irq(&rtc_lock);
+       spin_lock_irqsave(&rtc_lock, flags);
        if (efi_enabled)
                retval = efi_set_rtc_mmss(nowtime);
        else
                retval = mach_set_rtc_mmss(nowtime);
-       spin_unlock_irq(&rtc_lock);
+       spin_unlock_irqrestore(&rtc_lock, flags);
 
        return retval;
 }
@@ -589,7 +586,7 @@ unsigned long profile_pc(struct pt_regs *regs)
           is just accounted to the spinlock function.
           Better would be to write these functions in assembler again
           and check exactly. */
-       if (in_lock_functions(pc)) {
+       if (!user_mode_vm(regs) && in_lock_functions(pc)) {
                char *v = *(char **)regs->rsp;
                if ((v >= _stext && v <= _etext) ||
                        (v >= _sinittext && v <= _einittext) ||
@@ -598,7 +595,7 @@ unsigned long profile_pc(struct pt_regs *regs)
                return ((unsigned long *)regs->rsp)[1];
        }
 #else
-       if (in_lock_functions(pc))
+       if (!user_mode_vm(regs) && in_lock_functions(pc))
                return *(unsigned long *)(regs->ebp + 4);
 #endif
 
@@ -743,15 +740,16 @@ static void init_missing_ticks_accounting(int cpu)
 unsigned long get_cmos_time(void)
 {
        unsigned long retval;
+       unsigned long flags;
 
-       spin_lock(&rtc_lock);
+       spin_lock_irqsave(&rtc_lock, flags);
 
        if (efi_enabled)
                retval = efi_get_time();
        else
                retval = mach_get_cmos_time();
 
-       spin_unlock(&rtc_lock);
+       spin_unlock_irqrestore(&rtc_lock, flags);
 
        return retval;
 }
@@ -809,7 +807,6 @@ void notify_arch_cmos_timer(void)
 
 static long clock_cmos_diff, sleep_start;
 
-static struct timer_opts *last_timer;
 static int timer_suspend(struct sys_device *dev, pm_message_t state)
 {
        /*
@@ -818,10 +815,6 @@ static int timer_suspend(struct sys_device *dev, pm_message_t state)
        clock_cmos_diff = -get_cmos_time();
        clock_cmos_diff += get_seconds();
        sleep_start = get_cmos_time();
-       last_timer = cur_timer;
-       cur_timer = &timer_none;
-       if (last_timer->suspend)
-               last_timer->suspend(state);
        return 0;
 }
 
@@ -843,10 +836,6 @@ static int timer_resume(struct sys_device *dev)
        jiffies_64 += sleep_length;
        wall_jiffies += sleep_length;
        write_sequnlock_irqrestore(&xtime_lock, flags);
-       if (last_timer->resume)
-               last_timer->resume();
-       cur_timer = last_timer;
-       last_timer = NULL;
        touch_softlockup_watchdog();
        return 0;
 }
@@ -887,10 +876,6 @@ static void __init hpet_time_init(void)
        if ((hpet_enable() >= 0) && hpet_use_timer) {
                printk("Using HPET for base-timer\n");
        }
-
-       cur_timer = select_timer();
-       printk(KERN_INFO "Using %s for high-res timesource\n",cur_timer->name);
-
        time_init_hook();
 }
 #endif
@@ -938,8 +923,8 @@ void __init time_init(void)
 
 #if defined(__x86_64__)
        vxtime.mode = VXTIME_TSC;
-       vxtime.quot = (1000000L << 32) / vxtime_hz;
-       vxtime.tsc_quot = (1000L << 32) / cpu_khz;
+       vxtime.quot = (1000000L << US_SCALE) / vxtime_hz;
+       vxtime.tsc_quot = (1000L << US_SCALE) / cpu_khz;
        sync_core();
        rdtscll(vxtime.last_tsc);
 #endif
@@ -1011,14 +996,14 @@ static void start_hz_timer(void)
        cpu_clear(smp_processor_id(), nohz_cpu_mask);
 }
 
-void safe_halt(void)
+void raw_safe_halt(void)
 {
        stop_hz_timer();
        /* Blocking includes an implicit local_irq_enable(). */
        HYPERVISOR_block();
        start_hz_timer();
 }
-EXPORT_SYMBOL(safe_halt);
+EXPORT_SYMBOL(raw_safe_halt);
 
 void halt(void)
 {
diff --git a/arch/i386/kernel/timers/CVS/Entries b/arch/i386/kernel/timers/CVS/Entries
deleted file mode 100644 (file)
index 8669aef..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/common.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/timer.c/1.2/Wed Jun  2 20:34:53 2004/-ko/
-/timer_cyclone.c/1.1.1.2/Mon Jul 12 21:55:55 2004/-ko/
-/timer_hpet.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/timer_none.c/1.2/Tue Jul 20 15:33:03 2004/-ko/
-/timer_pit.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/timer_pm.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/timer_tsc.c/1.3/Tue Jul 20 15:33:03 2004/-ko/
-D
diff --git a/arch/i386/kernel/timers/CVS/Repository b/arch/i386/kernel/timers/CVS/Repository
deleted file mode 100644 (file)
index 54d35f1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/kernel/timers
diff --git a/arch/i386/kernel/timers/CVS/Root b/arch/i386/kernel/timers/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index b9053d3..310efa2 100644 (file)
@@ -11,7 +11,6 @@
  * 'Traps.c' handles hardware traps and faults after we have saved some
  * state in 'asm.s'.
  */
-#include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -28,6 +27,7 @@
 #include <linux/utsname.h>
 #include <linux/kprobes.h>
 #include <linux/kexec.h>
+#include <linux/unwind.h>
 
 #ifdef CONFIG_EISA
 #include <linux/ioport.h>
 #include <asm/desc.h>
 #include <asm/i387.h>
 #include <asm/nmi.h>
-
+#include <asm/unwind.h>
 #include <asm/smp.h>
 #include <asm/arch_hooks.h>
 #include <asm/kdebug.h>
+#include <asm/stacktrace.h>
 
 #include <linux/module.h>
+#include <linux/vserver/debug.h>
 
 #include "mach_traps.h"
 
@@ -98,20 +100,27 @@ asmlinkage void fixup_4gb_segment(void);
 asmlinkage void machine_check(void);
 
 static int kstack_depth_to_print = 24;
+#ifdef CONFIG_STACK_UNWIND
+static int call_trace = 1;
+#else
+#define call_trace (-1)
+#endif
 ATOMIC_NOTIFIER_HEAD(i386die_chain);
 
+extern char last_sysfs_file[];
+
 int register_die_notifier(struct notifier_block *nb)
 {
        vmalloc_sync_all();
        return atomic_notifier_chain_register(&i386die_chain, nb);
 }
-EXPORT_SYMBOL(register_die_notifier);
+EXPORT_SYMBOL(register_die_notifier); /* used modular by kdb */
 
 int unregister_die_notifier(struct notifier_block *nb)
 {
        return atomic_notifier_chain_unregister(&i386die_chain, nb);
 }
-EXPORT_SYMBOL(unregister_die_notifier);
+EXPORT_SYMBOL(unregister_die_notifier); /* used modular by kdb */
 
 static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
 {
@@ -119,65 +128,100 @@ static inline int valid_stack_ptr(struct thread_info *tinfo, void *p)
                p < (void *)tinfo + THREAD_SIZE - 3;
 }
 
-/*
- * Print CONFIG_STACK_BACKTRACE_COLS address/symbol entries per line.
- */
-static inline int print_addr_and_symbol(unsigned long addr, char *log_lvl,
-                                       int printed)
-{
-       if (!printed)
-               printk(log_lvl);
-
-#if CONFIG_STACK_BACKTRACE_COLS == 1
-       printk(" [<%08lx>] ", addr);
-#else
-       printk(" <%08lx> ", addr);
-#endif
-       print_symbol("%s", addr);
-
-       printed = (printed + 1) % CONFIG_STACK_BACKTRACE_COLS;
-       if (printed)
-               printk(" ");
-       else
-               printk("\n");
-
-       return printed;
-}
-
 static inline unsigned long print_context_stack(struct thread_info *tinfo,
                                unsigned long *stack, unsigned long ebp,
-                               char *log_lvl)
+                               struct stacktrace_ops *ops, void *data)
 {
        unsigned long addr;
-       int printed = 0; /* nr of entries already printed on current line */
 
 #ifdef CONFIG_FRAME_POINTER
        while (valid_stack_ptr(tinfo, (void *)ebp)) {
                addr = *(unsigned long *)(ebp + 4);
-               printed = print_addr_and_symbol(addr, log_lvl, printed);
+               ops->address(data, addr);
+               /*
+                * break out of recursive entries (such as
+                * end_of_stack_stop_unwind_function):
+                */
+               if (ebp == *(unsigned long *)ebp)
+                       break;
                ebp = *(unsigned long *)ebp;
        }
 #else
        while (valid_stack_ptr(tinfo, stack)) {
                addr = *stack++;
                if (__kernel_text_address(addr))
-                       printed = print_addr_and_symbol(addr, log_lvl, printed);
+                       ops->address(data, addr);
        }
 #endif
-       if (printed)
-               printk("\n");
-
        return ebp;
 }
 
-static void show_trace_log_lvl(struct task_struct *task,
-                              unsigned long *stack, char *log_lvl)
+struct ops_and_data {
+       struct stacktrace_ops *ops;
+       void *data;
+};
+
+static asmlinkage int
+dump_trace_unwind(struct unwind_frame_info *info, void *data)
+{
+       struct ops_and_data *oad = (struct ops_and_data *)data;
+       int n = 0;
+
+       while (unwind(info) == 0 && UNW_PC(info)) {
+               n++;
+               oad->ops->address(oad->data, UNW_PC(info));
+               if (arch_unw_user_mode(info))
+                       break;
+       }
+       return n;
+}
+
+void dump_trace(struct task_struct *task, struct pt_regs *regs,
+       unsigned long *stack,
+       struct stacktrace_ops *ops, void *data)
 {
        unsigned long ebp;
 
        if (!task)
                task = current;
 
+       if (call_trace >= 0) {
+               int unw_ret = 0;
+               struct unwind_frame_info info;
+               struct ops_and_data oad = { .ops = ops, .data = data };
+
+               if (regs) {
+                       if (unwind_init_frame_info(&info, task, regs) == 0)
+                               unw_ret = dump_trace_unwind(&info, &oad);
+               } else if (task == current)
+                       unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad);
+               else {
+                       if (unwind_init_blocked(&info, task) == 0)
+                               unw_ret = dump_trace_unwind(&info, &oad);
+               }
+               if (unw_ret > 0) {
+                       if (call_trace == 1 && !arch_unw_user_mode(&info)) {
+                               ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n",
+                                            UNW_PC(&info));
+                               if (UNW_SP(&info) >= PAGE_OFFSET) {
+                                       ops->warning(data, "Leftover inexact backtrace:\n");
+                                       stack = (void *)UNW_SP(&info);
+                               } else
+                                       ops->warning(data, "Full inexact backtrace again:\n");
+                       } else if (call_trace >= 1)
+                               return;
+                       else
+                               ops->warning(data, "Full inexact backtrace again:\n");
+               } else
+                       ops->warning(data, "Inexact backtrace:\n");
+
+       } else if (!stack) {
+               unsigned long dummy;
+               stack = &dummy;
+               if (task && task != current)
+                       stack = (unsigned long *)task->thread.esp;
+       }
+
        if (task == current) {
                /* Grab ebp right from our regs */
                asm ("movl %%ebp, %0" : "=r" (ebp) : );
@@ -190,21 +234,70 @@ static void show_trace_log_lvl(struct task_struct *task,
                struct thread_info *context;
                context = (struct thread_info *)
                        ((unsigned long)stack & (~(THREAD_SIZE - 1)));
-               ebp = print_context_stack(context, stack, ebp, log_lvl);
+               ebp = print_context_stack(context, stack, ebp, ops, data);
+               /* Should be after the line below, but somewhere
+                  in early boot context comes out corrupted and we
+                  can't reference it -AK */
+               if (ops->stack(data, "IRQ") < 0)
+                       break;
                stack = (unsigned long*)context->previous_esp;
                if (!stack)
                        break;
-               printk("%s =======================\n", log_lvl);
        }
 }
 
-void show_trace(struct task_struct *task, unsigned long * stack)
+EXPORT_SYMBOL(dump_trace);
+
+static void
+print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
+{
+       printk(data);
+       print_symbol(msg, symbol);
+       printk("\n");
+}
+
+static void print_trace_warning(void *data, char *msg)
+{
+       printk("%s%s\n", (char *)data, msg);
+}
+
+static int print_trace_stack(void *data, char *name)
+{
+       return 0;
+}
+
+/*
+ * Print one address/symbol entries per line.
+ */
+static void print_trace_address(void *data, unsigned long addr)
+{
+       printk("%s [<%08lx>] ", (char *)data, addr);
+       print_symbol("%s\n", addr);
+}
+
+static struct stacktrace_ops print_trace_ops = {
+       .warning = print_trace_warning,
+       .warning_symbol = print_trace_warning_symbol,
+       .stack = print_trace_stack,
+       .address = print_trace_address,
+};
+
+static void
+show_trace_log_lvl(struct task_struct *task, struct pt_regs *regs,
+       unsigned long * stack, char *log_lvl)
 {
-       show_trace_log_lvl(task, stack, "");
+       dump_trace(task, regs, stack, &print_trace_ops, log_lvl);
+       printk("%s =======================\n", log_lvl);
 }
 
-static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp,
-                              char *log_lvl)
+void show_trace(struct task_struct *task, struct pt_regs *regs,
+               unsigned long * stack)
+{
+       show_trace_log_lvl(task, regs, stack, "");
+}
+
+static void show_stack_log_lvl(struct task_struct *task, struct pt_regs *regs,
+                              unsigned long *esp, char *log_lvl)
 {
        unsigned long *stack;
        int i;
@@ -217,7 +310,6 @@ static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp,
        }
 
        stack = esp;
-       printk(log_lvl);
        for(i = 0; i < kstack_depth_to_print; i++) {
                if (kstack_end(stack))
                        break;
@@ -226,13 +318,13 @@ static void show_stack_log_lvl(struct task_struct *task, unsigned long *esp,
                printk("%08lx ", *stack++);
        }
        printk("\n%sCall Trace:\n", log_lvl);
-       show_trace_log_lvl(task, esp, log_lvl);
+       show_trace_log_lvl(task, regs, esp, log_lvl);
 }
 
 void show_stack(struct task_struct *task, unsigned long *esp)
 {
        printk("       ");
-       show_stack_log_lvl(task, esp, "");
+       show_stack_log_lvl(task, NULL, esp, "");
 }
 
 /*
@@ -242,7 +334,7 @@ void dump_stack(void)
 {
        unsigned long stack;
 
-       show_trace(current, &stack);
+       show_trace(current, NULL, &stack);
 }
 
 EXPORT_SYMBOL(dump_stack);
@@ -275,8 +367,9 @@ void show_registers(struct pt_regs *regs)
                regs->esi, regs->edi, regs->ebp, esp);
        printk(KERN_EMERG "ds: %04x   es: %04x   ss: %04x\n",
                regs->xds & 0xffff, regs->xes & 0xffff, ss);
-       printk(KERN_EMERG "Process %s (pid: %d, threadinfo=%p task=%p)",
-               current->comm, current->pid, current_thread_info(), current);
+       printk(KERN_EMERG "Process %.*s (pid: %d[#%u], ti=%p task=%p task.ti=%p)",
+               TASK_COMM_LEN, current->comm, current->pid, current->xid,
+               current_thread_info(), current, current->thread_info);
        /*
         * When in-kernel, we also print out the stack and code at the
         * time of the fault..
@@ -285,7 +378,7 @@ void show_registers(struct pt_regs *regs)
                u8 __user *eip;
 
                printk("\n" KERN_EMERG "Stack: ");
-               show_stack_log_lvl(NULL, (unsigned long *)esp, KERN_EMERG);
+               show_stack_log_lvl(NULL, regs, (unsigned long *)esp, KERN_EMERG);
 
                printk(KERN_EMERG "Code: ");
 
@@ -308,35 +401,34 @@ void show_registers(struct pt_regs *regs)
 
 static void handle_BUG(struct pt_regs *regs)
 {
+       unsigned long eip = regs->eip;
        unsigned short ud2;
-       unsigned short line;
-       char *file;
-       char c;
-       unsigned long eip;
-
-       eip = regs->eip;
 
        if (eip < PAGE_OFFSET)
-               goto no_bug;
+               return;
        if (__get_user(ud2, (unsigned short __user *)eip))
-               goto no_bug;
+               return;
        if (ud2 != 0x0b0f)
-               goto no_bug;
-       if (__get_user(line, (unsigned short __user *)(eip + 2)))
-               goto bug;
-       if (__get_user(file, (char * __user *)(eip + 4)) ||
-               (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
-               file = "<bad filename>";
+               return;
 
        printk(KERN_EMERG "------------[ cut here ]------------\n");
-       printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
+#ifdef CONFIG_DEBUG_BUGVERBOSE
+       do {
+               unsigned short line;
+               char *file;
+               char c;
 
-no_bug:
-       return;
+               if (__get_user(line, (unsigned short __user *)(eip + 2)))
+                       break;
+               if (__get_user(file, (char * __user *)(eip + 4)) ||
+                   (unsigned long)file < PAGE_OFFSET || __get_user(c, file))
+                       file = "<bad filename>";
 
-       /* Here we know it was a BUG but file-n-line is unavailable */
-bug:
-       printk(KERN_EMERG "Kernel BUG\n");
+               printk(KERN_EMERG "kernel BUG at %s:%d!\n", file, line);
+               return;
+       } while (0);
+#endif
+       printk(KERN_EMERG "Kernel BUG at [verbose debug info unavailable]\n");
 }
 
 /* This is gone through when something in the kernel
@@ -358,6 +450,8 @@ void die(const char * str, struct pt_regs * regs, long err)
 
        oops_enter();
 
+       vxh_throw_oops();
+
        if (die.lock_owner != raw_smp_processor_id()) {
                console_verbose();
                spin_lock_irqsave(&die.lock, flags);
@@ -393,10 +487,13 @@ void die(const char * str, struct pt_regs * regs, long err)
 #endif
                if (nl)
                        printk("\n");
+#ifdef CONFIG_SYSFS
+               printk(KERN_ALERT "last sysfs file: %s\n", last_sysfs_file);
+#endif
                if (notify_die(DIE_OOPS, str, regs, err,
-                                       current->thread.trap_no, SIGSEGV) !=
-                               NOTIFY_STOP) {
+                       current->thread.trap_no, SIGSEGV) != NOTIFY_STOP) {
                        show_registers(regs);
+                       vxh_dump_history();
                        /* Executive summary in case the oops scrolled away */
                        esp = (unsigned long) (&regs->esp);
                        savesegment(ss, ss);
@@ -426,11 +523,9 @@ void die(const char * str, struct pt_regs * regs, long err)
        if (in_interrupt())
                panic("Fatal exception in interrupt");
 
-       if (panic_on_oops) {
-               printk(KERN_EMERG "Fatal exception: panic in 5 seconds\n");
-               ssleep(5);
+       if (panic_on_oops)
                panic("Fatal exception");
-       }
+
        oops_exit();
        do_exit(SIGSEGV);
 }
@@ -570,7 +665,7 @@ check_lazy_exec_limit(int cpu, struct pt_regs *regs, long error_code)
        set_user_cs(&current->mm->context.user_cs, limit);
 
        desc1 = &current->mm->context.user_cs;
-       desc2 = &get_cpu_gdt_table(cpu)[GDT_ENTRY_DEFAULT_USER_CS];
+       desc2 = get_cpu_gdt_table(cpu) + GDT_ENTRY_DEFAULT_USER_CS;
 
        if (desc1->a != desc2->a || desc1->b != desc2->b) {
                /*
@@ -620,7 +715,17 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs,
        int cpu = get_cpu();
        int ok;
 
+       current->thread.error_code = error_code;
+       current->thread.trap_no = 13;
+
+       if (regs->eflags & VM_MASK)
+               goto gp_in_vm86;
+
+       if (!user_mode(regs))
+               goto gp_in_kernel;
+
        ok = check_lazy_exec_limit(cpu, regs, error_code);
+
        put_cpu();
 
        if (ok)
@@ -631,23 +736,19 @@ fastcall void __kprobes do_general_protection(struct pt_regs * regs,
                printk(" exec_limit: %08lx, user_cs: %08lx/%08lx.\n", current->mm->context.exec_limit, current->mm->context.user_cs.a, current->mm->context.user_cs.b);
        }
 
-       if (regs->eflags & VM_MASK)
-               goto gp_in_vm86;
-
-       if (!user_mode(regs))
-               goto gp_in_kernel;
-
        current->thread.error_code = error_code;
        current->thread.trap_no = 13;
        force_sig(SIGSEGV, current);
        return;
 
 gp_in_vm86:
+       put_cpu();
        local_irq_enable();
        handle_vm86_fault((struct kernel_vm86_regs *) regs, error_code);
        return;
 
 gp_in_kernel:
+       put_cpu();
        if (!fixup_exception(regs)) {
                if (notify_die(DIE_GPF, "general protection fault", regs,
                                error_code, 13, SIGSEGV) == NOTIFY_STOP)
@@ -1220,3 +1321,19 @@ static int __init kstack_setup(char *s)
        return 1;
 }
 __setup("kstack=", kstack_setup);
+
+#ifdef CONFIG_STACK_UNWIND
+static int __init call_trace_setup(char *s)
+{
+       if (strcmp(s, "old") == 0)
+               call_trace = -1;
+       else if (strcmp(s, "both") == 0)
+               call_trace = 0;
+       else if (strcmp(s, "newfallback") == 0)
+               call_trace = 1;
+       else if (strcmp(s, "new") == 2)
+               call_trace = 2;
+       return 1;
+}
+__setup("call_trace=", call_trace_setup);
+#endif
index 019d9af..c2d6dbf 100644 (file)
@@ -28,5 +28,5 @@
 #define NOTE_KERNELCAP_END ASM_ELF_NOTE_END
 
 NOTE_KERNELCAP_BEGIN(1, 1)
-NOTE_KERNELCAP(0, "nosegneg")
+NOTE_KERNELCAP(1, "nosegneg")  /* Change 1 back to 0 when glibc is fixed! */
 NOTE_KERNELCAP_END
diff --git a/arch/i386/lib/CVS/Entries b/arch/i386/lib/CVS/Entries
deleted file mode 100644 (file)
index 00b3e65..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/Makefile/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/bitops.c/1.1.3.1/Tue Jul 13 17:47:45 2004/-ko/
-/checksum.S/1.2/Wed Jun  2 20:34:53 2004/-ko/
-/dec_and_lock.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/delay.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/getuser.S/1.3/Tue Jun  8 21:22:58 2004/-ko/
-/memcpy.c/1.2/Tue Jul 20 15:33:03 2004/-ko/
-/mmx.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/strstr.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/usercopy.c/1.3/Tue Jul 20 15:33:03 2004/-ko/
-D
diff --git a/arch/i386/lib/CVS/Repository b/arch/i386/lib/CVS/Repository
deleted file mode 100644 (file)
index 31558bd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/lib
diff --git a/arch/i386/lib/CVS/Root b/arch/i386/lib/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/mach-default/CVS/Entries b/arch/i386/mach-default/CVS/Entries
deleted file mode 100644 (file)
index 330a6ce..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/setup.c/1.2/Tue Jul 20 15:33:03 2004/-ko/
-/topology.c/1.2/Wed Jun  2 20:34:54 2004/-ko/
-D
diff --git a/arch/i386/mach-default/CVS/Repository b/arch/i386/mach-default/CVS/Repository
deleted file mode 100644 (file)
index 08fc83a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/mach-default
diff --git a/arch/i386/mach-default/CVS/Root b/arch/i386/mach-default/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/mach-es7000/CVS/Entries b/arch/i386/mach-es7000/CVS/Entries
deleted file mode 100644 (file)
index cabb737..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile/1.2/Wed Jun  2 20:34:54 2004/-ko/
-/es7000.h/1.2/Wed Jun  2 20:34:54 2004/-ko/
-/es7000plat.c/1.1.3.2/Tue Jul 13 17:47:45 2004/-ko/
-D
diff --git a/arch/i386/mach-es7000/CVS/Repository b/arch/i386/mach-es7000/CVS/Repository
deleted file mode 100644 (file)
index f7677c5..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/mach-es7000
diff --git a/arch/i386/mach-es7000/CVS/Root b/arch/i386/mach-es7000/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index d5936d5..3d0fc85 100644 (file)
@@ -51,8 +51,6 @@ struct mip_reg                *host_reg;
 int                    mip_port;
 unsigned long          mip_addr, host_addr;
 
-#if defined(CONFIG_X86_IO_APIC) && (defined(CONFIG_ACPI_INTERPRETER) || defined(CONFIG_ACPI_BOOT))
-
 /*
  * GSI override for ES7000 platforms.
  */
@@ -62,6 +60,9 @@ static unsigned int base;
 static int
 es7000_rename_gsi(int ioapic, int gsi)
 {
+       if (es7000_plat == ES7000_ZORRO)
+               return gsi;
+
        if (!base) {
                int i;
                for (i = 0; i < nr_ioapics; i++)
@@ -73,14 +74,29 @@ es7000_rename_gsi(int ioapic, int gsi)
        return gsi;
 }
 
-#endif // (CONFIG_X86_IO_APIC) && (CONFIG_ACPI_INTERPRETER || CONFIG_ACPI_BOOT)
+void __init
+setup_unisys(void)
+{
+       /*
+        * Determine the generation of the ES7000 currently running.
+        *
+        * es7000_plat = 1 if the machine is a 5xx ES7000 box
+        * es7000_plat = 2 if the machine is a x86_64 ES7000 box
+        *
+        */
+       if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
+               es7000_plat = ES7000_ZORRO;
+       else
+               es7000_plat = ES7000_CLASSIC;
+       ioapic_renumber_irq = es7000_rename_gsi;
+}
 
 /*
  * Parse the OEM Table
  */
 
 int __init
-parse_unisys_oem (char *oemptr, int oem_entries)
+parse_unisys_oem (char *oemptr)
 {
        int                     i;
        int                     success = 0;
@@ -95,7 +111,7 @@ parse_unisys_oem (char *oemptr, int oem_entries)
 
        tp += 8;
 
-       for (i=0; i <= oem_entries; i++) {
+       for (i=0; i <= 6; i++) {
                type = *tp++;
                size = *tp++;
                tp -= 2;
@@ -130,34 +146,19 @@ parse_unisys_oem (char *oemptr, int oem_entries)
                default:
                        break;
                }
-               if (i == 6) break;
                tp += size;
        }
 
        if (success < 2) {
-               es7000_plat = 0;
-       } else {
-               printk("\nEnabling ES7000 specific features...\n");
-               /*
-                * Determine the generation of the ES7000 currently running.
-                *
-                * es7000_plat = 0 if the machine is NOT a Unisys ES7000 box
-                * es7000_plat = 1 if the machine is a 5xx ES7000 box
-                * es7000_plat = 2 if the machine is a x86_64 ES7000 box
-                *
-                */
-               if (!(boot_cpu_data.x86 <= 15 && boot_cpu_data.x86_model <= 2))
-                       es7000_plat = 2;
-               else
-                       es7000_plat = 1;
-
-               ioapic_renumber_irq = es7000_rename_gsi;
-       }
+               es7000_plat = NON_UNISYS;
+       } else
+               setup_unisys();
        return es7000_plat;
 }
 
+#ifdef CONFIG_ACPI
 int __init
-find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length)
+find_unisys_acpi_oem_table(unsigned long *oem_addr)
 {
        struct acpi_table_rsdp          *rsdp = NULL;
        unsigned long                   rsdp_phys = 0;
@@ -201,15 +202,14 @@ find_unisys_acpi_oem_table(unsigned long *oem_addr, int *length)
                                acpi_table_print(header, sdt.entry[i].pa);
                                t = (struct oem_table *) __acpi_map_table(sdt.entry[i].pa, header->length);
                                addr = (void *) __acpi_map_table(t->OEMTableAddr, t->OEMTableSize);
-                               *length = header->length;
                                *oem_addr = (unsigned long) addr;
                                return 0;
                        }
                }
        }
-       Dprintk("ES7000: did not find Unisys ACPI OEM table!\n");
        return -1;
 }
+#endif
 
 static void
 es7000_spin(int n)
diff --git a/arch/i386/mach-generic/CVS/Entries b/arch/i386/mach-generic/CVS/Entries
deleted file mode 100644 (file)
index d705dab..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.2/Wed Jun  2 20:34:54 2004/-ko/
-/bigsmp.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/default.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/es7000.c/1.1.3.1/Wed Jun  2 19:32:18 2004/-ko/
-/probe.c/1.2/Wed Jun  2 20:34:54 2004/-ko/
-/summit.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/mach-generic/CVS/Repository b/arch/i386/mach-generic/CVS/Repository
deleted file mode 100644 (file)
index c8b2fd4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/mach-generic
diff --git a/arch/i386/mach-generic/CVS/Root b/arch/i386/mach-generic/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/mach-pc9800/CVS/Entries b/arch/i386/mach-pc9800/CVS/Entries
deleted file mode 100644 (file)
index 1784810..0000000
+++ /dev/null
@@ -1 +0,0 @@
-D
diff --git a/arch/i386/mach-pc9800/CVS/Repository b/arch/i386/mach-pc9800/CVS/Repository
deleted file mode 100644 (file)
index 0549412..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/mach-pc9800
diff --git a/arch/i386/mach-pc9800/CVS/Root b/arch/i386/mach-pc9800/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/mach-visws/CVS/Entries b/arch/i386/mach-visws/CVS/Entries
deleted file mode 100644 (file)
index b6f67aa..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/mpparse.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/reboot.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/setup.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/traps.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/visws_apic.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/mach-visws/CVS/Repository b/arch/i386/mach-visws/CVS/Repository
deleted file mode 100644 (file)
index 390e388..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/mach-visws
diff --git a/arch/i386/mach-visws/CVS/Root b/arch/i386/mach-visws/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/mach-voyager/CVS/Entries b/arch/i386/mach-voyager/CVS/Entries
deleted file mode 100644 (file)
index e6f5779..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/setup.c/1.2/Tue Jul 20 15:33:03 2004/-ko/
-/voyager_basic.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/voyager_cat.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/voyager_smp.c/1.4/Tue Jul 20 15:33:03 2004/-ko/
-/voyager_thread.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-D
diff --git a/arch/i386/mach-voyager/CVS/Repository b/arch/i386/mach-voyager/CVS/Repository
deleted file mode 100644 (file)
index 6577cfc..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/mach-voyager
diff --git a/arch/i386/mach-voyager/CVS/Root b/arch/i386/mach-voyager/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 012fe34..e8036c6 100644 (file)
@@ -2,4 +2,4 @@
 # Makefile for the linux kernel.
 #
 
-obj-y                          := setup.o
+obj-y                          := setup.o irqflags.o
index e4a1c05..4a89ab1 100644 (file)
@@ -2,12 +2,18 @@
  *     Machine specific setup for generic
  */
 
-#include <linux/config.h>
 #include <linux/smp.h>
 #include <linux/init.h>
 #include <linux/interrupt.h>
+#include <linux/module.h>
 #include <asm/acpi.h>
 #include <asm/arch_hooks.h>
+#include <asm/e820.h>
+#include <asm/setup.h>
+#include <asm/fixmap.h>
+
+#include <xen/interface/callback.h>
+#include <xen/interface/memory.h>
 
 #ifdef CONFIG_HOTPLUG_CPU
 #define DEFAULT_SEND_IPI       (1)
@@ -36,6 +42,105 @@ static int __init print_ipi_mode(void)
 
 late_initcall(print_ipi_mode);
 
+/**
+ * machine_specific_memory_setup - Hook for machine specific memory setup.
+ *
+ * Description:
+ *     This is included late in kernel/setup.c so that it can make
+ *     use of all of the static functions.
+ **/
+
+char * __init machine_specific_memory_setup(void)
+{
+       int rc;
+       struct xen_memory_map memmap;
+       /*
+        * This is rather large for a stack variable but this early in
+        * the boot process we know we have plenty slack space.
+        */
+       struct e820entry map[E820MAX];
+
+       memmap.nr_entries = E820MAX;
+       set_xen_guest_handle(memmap.buffer, map);
+
+       rc = HYPERVISOR_memory_op(XENMEM_memory_map, &memmap);
+       if ( rc == -ENOSYS ) {
+               memmap.nr_entries = 1;
+               map[0].addr = 0ULL;
+               map[0].size = PFN_PHYS(xen_start_info->nr_pages);
+               /* 8MB slack (to balance backend allocations). */
+               map[0].size += 8ULL << 20;
+               map[0].type = E820_RAM;
+               rc = 0;
+       }
+       BUG_ON(rc);
+
+       sanitize_e820_map(map, (char *)&memmap.nr_entries);
+
+       BUG_ON(copy_e820_map(map, (char)memmap.nr_entries) < 0);
+
+       return "Xen";
+}
+
+extern void hypervisor_callback(void);
+extern void failsafe_callback(void);
+extern void nmi(void);
+
+unsigned long *machine_to_phys_mapping;
+EXPORT_SYMBOL(machine_to_phys_mapping);
+unsigned int machine_to_phys_order;
+EXPORT_SYMBOL(machine_to_phys_order);
+
+void __init machine_specific_arch_setup(void)
+{
+       int ret;
+       struct xen_machphys_mapping mapping;
+       unsigned long machine_to_phys_nr_ents;
+       struct xen_platform_parameters pp;
+       struct callback_register event = {
+               .type = CALLBACKTYPE_event,
+               .address = { __KERNEL_CS, (unsigned long)hypervisor_callback },
+       };
+       struct callback_register failsafe = {
+               .type = CALLBACKTYPE_failsafe,
+               .address = { __KERNEL_CS, (unsigned long)failsafe_callback },
+       };
+       struct callback_register nmi_cb = {
+               .type = CALLBACKTYPE_nmi,
+               .address = { __KERNEL_CS, (unsigned long)nmi },
+       };
+
+       ret = HYPERVISOR_callback_op(CALLBACKOP_register, &event);
+       if (ret == 0)
+               ret = HYPERVISOR_callback_op(CALLBACKOP_register, &failsafe);
+       if (ret == -ENOSYS)
+               ret = HYPERVISOR_set_callbacks(
+                       event.address.cs, event.address.eip,
+                       failsafe.address.cs, failsafe.address.eip);
+       BUG_ON(ret);
+
+       ret = HYPERVISOR_callback_op(CALLBACKOP_register, &nmi_cb);
+       if (ret == -ENOSYS) {
+               struct xennmi_callback cb;
+
+               cb.handler_address = nmi_cb.address.eip;
+               HYPERVISOR_nmi_op(XENNMI_register_callback, &cb);
+       }
+
+       if (HYPERVISOR_xen_version(XENVER_platform_parameters,
+                                  &pp) == 0)
+               set_fixaddr_top(pp.virt_start - PAGE_SIZE);
+
+       machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
+       machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
+       if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
+               machine_to_phys_mapping = (unsigned long *)mapping.v_start;
+               machine_to_phys_nr_ents = mapping.max_mfn + 1;
+       }
+       while ((1UL << machine_to_phys_order) < machine_to_phys_nr_ents )
+               machine_to_phys_order++;
+}
+
 /**
  * pre_setup_arch_hook - hook called prior to any setup_arch() execution
  *
diff --git a/arch/i386/math-emu/CVS/Entries b/arch/i386/math-emu/CVS/Entries
deleted file mode 100644 (file)
index b1d5c1a..0000000
+++ /dev/null
@@ -1,48 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/control_w.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/div_Xsig.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/div_small.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/errors.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/exception.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/fpu_arith.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/fpu_asm.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/fpu_aux.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/fpu_emu.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/fpu_entry.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/fpu_etc.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/fpu_proto.h/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/fpu_system.h/1.3/Fri Jul 16 15:16:50 2004/-ko/
-/fpu_tags.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/fpu_trig.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/get_address.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/load_store.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/mul_Xsig.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/poly.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/poly_2xm1.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/poly_atan.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/poly_l2.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/poly_sin.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/poly_tan.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/polynom_Xsig.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_add_sub.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_compare.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/reg_constant.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_constant.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_convert.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_divide.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_ld_str.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/reg_mul.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_norm.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_round.S/1.2/Tue Jul 20 15:33:03 2004/-ko/
-/reg_u_add.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_u_div.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_u_mul.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/reg_u_sub.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/round_Xsig.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/shr_Xsig.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/status_w.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/version.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/wm_shrx.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/wm_sqrt.S/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/math-emu/CVS/Repository b/arch/i386/math-emu/CVS/Repository
deleted file mode 100644 (file)
index 0935cfe..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/math-emu
diff --git a/arch/i386/math-emu/CVS/Root b/arch/i386/math-emu/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/i386/mm/CVS/Entries b/arch/i386/mm/CVS/Entries
deleted file mode 100644 (file)
index 4f71f07..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/boot_ioremap.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/discontig.c/1.2/Tue Jul 20 15:33:04 2004/-ko/
-/extable.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/fault.c/1.5/Tue Jul 20 15:33:04 2004/-ko/
-/highmem.c/1.2/Tue Jun  8 21:22:58 2004/-ko/
-/hugetlbpage.c/1.5/Tue Jul 20 15:33:04 2004/-ko/
-/init.c/1.6/Sun Sep 12 03:11:13 2004/-ko/
-/ioremap.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/mmap.c/1.1.3.1/Wed Sep 15 03:53:00 2004/-ko/
-/pageattr.c/1.3/Tue Jul 20 15:33:04 2004/-ko/
-/pgtable.c/1.3/Tue Jul 20 15:33:04 2004/-ko/
-D
diff --git a/arch/i386/mm/CVS/Repository b/arch/i386/mm/CVS/Repository
deleted file mode 100644 (file)
index 61658a9..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/mm
diff --git a/arch/i386/mm/CVS/Root b/arch/i386/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 3bff39e..9561f24 100644 (file)
 
 extern void die(const char *,struct pt_regs *,long);
 
+#ifdef CONFIG_KPROBES
+ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
+int register_page_fault_notifier(struct notifier_block *nb)
+{
+       vmalloc_sync_all();
+       return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
+}
+
+int unregister_page_fault_notifier(struct notifier_block *nb)
+{
+       return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
+}
+
+static inline int notify_page_fault(enum die_val val, const char *str,
+                       struct pt_regs *regs, long err, int trap, int sig)
+{
+       struct die_args args = {
+               .regs = regs,
+               .str = str,
+               .err = err,
+               .trapnr = trap,
+               .signr = sig
+       };
+       return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
+}
+#else
+static inline int notify_page_fault(enum die_val val, const char *str,
+                       struct pt_regs *regs, long err, int trap, int sig)
+{
+       return NOTIFY_DONE;
+}
+#endif
+
 /*
  * Unlock any spinlocks which will prevent us from getting the
  * message out 
@@ -77,13 +110,16 @@ static inline unsigned long get_segment_eip(struct pt_regs *regs,
        unsigned seg = regs->xcs & 0xffff;
        u32 seg_ar, seg_limit, base, *desc;
 
+       /* Unlikely, but must come before segment checks. */
+       if (unlikely(regs->eflags & VM_MASK)) {
+               base = seg << 4;
+               *eip_limit = base + 0xffff;
+               return base + (eip & 0xffff);
+       }
+
        /* The standard kernel/user address space limit. */
        *eip_limit = (seg & 2) ? USER_DS.seg : KERNEL_DS.seg;
 
-       /* Unlikely, but must come before segment checks. */
-       if (unlikely((regs->eflags & VM_MASK) != 0))
-               return eip + (seg << 4);
-       
        /* By far the most common cases. */
        if (likely(seg == __USER_CS || seg == GET_KERNEL_CS()))
                return eip;
@@ -446,7 +482,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
                /* Can take a spurious fault if mapping changes R/O -> R/W. */
                if (spurious_fault(regs, address, error_code))
                        return;
-               if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
+               if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
                                                SIGSEGV) == NOTIFY_STOP)
                        return;
                /*
@@ -456,7 +492,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
                goto bad_area_nosemaphore;
        }
 
-       if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
+       if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
                                        SIGSEGV) == NOTIFY_STOP)
                return;
 
@@ -477,7 +513,7 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
        /* When running in the kernel we expect faults to occur only to
         * addresses in user space.  All other faults represent errors in the
         * kernel and should generate an OOPS.  Unfortunatly, in the case of an
-        * erroneous fault occuring in a code path which already holds mmap_sem
+        * erroneous fault occurring in a code path which already holds mmap_sem
         * we will deadlock attempting to validate the fault against the
         * address space.  Luckily the kernel only validly references user
         * space from well defined areas of code, which are listed in the
@@ -505,12 +541,12 @@ fastcall void __kprobes do_page_fault(struct pt_regs *regs,
                goto bad_area;
        if (error_code & 4) {
                /*
-                * accessing the stack below %esp is always a bug.
-                * The "+ 32" is there due to some instructions (like
-                * pusha) doing post-decrement on the stack and that
-                * doesn't show up until later..
+                * Accessing the stack below %esp is always a bug.
+                * The large cushion allows instructions like enter
+                * and pusha to work.  ("enter $65535,$31" pushes
+                * 32 pointers and then decrements %esp by 65535.)
                 */
-               if (address + 32 < regs->esp)
+               if (address + 65536 + 32 * sizeof(unsigned long) < regs->esp)
                        goto bad_area;
        }
        if (expand_stack(vma, address))
index 5dc6646..e9af618 100644 (file)
@@ -30,7 +30,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
index 5d2ec3f..6c10b40 100644 (file)
@@ -6,7 +6,6 @@
  *  Support of BIGMEM added by Gerhard Wichert, Siemens AG, July 1999
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/init.h>
 #include <linux/highmem.h>
 #include <linux/pagemap.h>
+#include <linux/poison.h>
 #include <linux/bootmem.h>
 #include <linux/slab.h>
 #include <linux/proc_fs.h>
 #include <linux/efi.h>
 #include <linux/memory_hotplug.h>
 #include <linux/initrd.h>
+#include <linux/cpumask.h>
 #include <linux/dma-mapping.h>
 #include <linux/scatterlist.h>
 
@@ -274,7 +275,18 @@ int page_is_ram(unsigned long pagenr)
        }
        return 0;
 }
+EXPORT_SYMBOL_GPL(page_is_ram);
 
+/*
+ * devmem_is_allowed() checks to see if /dev/mem access to a certain address is
+ * valid. The argument is a physical page number.
+ *
+ *
+ * On x86, access has to be given to the first megabyte of ram because that area
+ * contains bios code and data regions used by X and dosemu and similar apps.
+ * Access has to be given to non-kernel-ram areas as well, these contain the PCI
+ * mmio resources as well as potential bios/acpi data regions.
+ */
 int devmem_is_allowed(unsigned long pagenr)
 {
    if (pagenr <= 256)
@@ -284,8 +296,6 @@ int devmem_is_allowed(unsigned long pagenr)
    return 0;
 }
 
-EXPORT_SYMBOL_GPL(page_is_ram);
-
 #ifdef CONFIG_HIGHMEM
 pte_t *kmap_pte;
 pgprot_t kmap_prot;
@@ -426,7 +436,7 @@ static void __init pagetable_init (void)
        permanent_kmaps_init(pgd_base);
 }
 
-#ifdef CONFIG_SOFTWARE_SUSPEND
+#if defined(CONFIG_SOFTWARE_SUSPEND) || defined(CONFIG_ACPI_SLEEP)
 /*
  * Swap suspend & friends need this for resume because things like the intel-agp
  * driver might have split up a kernel 4MB mapping.
@@ -581,7 +591,7 @@ void __init paging_init(void)
 
        /* Setup mapping of lower 1st MB */
        for (i = 0; i < NR_FIX_ISAMAPS; i++)
-               if (xen_start_info->flags & SIF_PRIVILEGED)
+               if (is_initial_xendomain())
                        set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
                else
                        __set_fixmap(FIX_ISAMAP_BEGIN - i,
@@ -738,7 +748,7 @@ void __init mem_init(void)
  */
 #ifdef CONFIG_MEMORY_HOTPLUG
 #ifndef CONFIG_NEED_MULTIPLE_NODES
-int add_memory(u64 start, u64 size)
+int arch_add_memory(u64 start, u64 size)
 {
        struct pglist_data *pgdata = &contig_page_data;
        struct zone *zone = pgdata->node_zones + MAX_NR_ZONES-1;
@@ -814,16 +824,16 @@ static int noinline do_test_wp_bit(void)
 
 #ifdef CONFIG_DEBUG_RODATA
 
-extern char __start_rodata, __end_rodata;
 void mark_rodata_ro(void)
 {
-       unsigned long addr = (unsigned long)&__start_rodata;
+       unsigned long addr = (unsigned long)__start_rodata;
 
-       for (; addr < (unsigned long)&__end_rodata; addr += PAGE_SIZE)
+       for (; addr < (unsigned long)__end_rodata; addr += PAGE_SIZE)
                change_page_attr(virt_to_page(addr), 1, PAGE_KERNEL_RO);
 
-       printk ("Write protecting the kernel read-only data: %luk\n",
-                       (unsigned long)(&__end_rodata - &__start_rodata) >> 10);
+       printk("Write protecting the kernel read-only data: %uk\n",
+                       (__end_rodata - __start_rodata) >> 10);
+
 
        /*
         * change_page_attr() requires a global_flush_tlb() call after it.
@@ -842,7 +852,7 @@ void free_init_pages(char *what, unsigned long begin, unsigned long end)
        for (addr = begin; addr < end; addr += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(addr));
                init_page_count(virt_to_page(addr));
-               memset((void *)addr, 0xcc, PAGE_SIZE);
+               memset((void *)addr, POISON_FREE_INITMEM, PAGE_SIZE);
                free_page(addr);
                totalram_pages++;
        }
index 3a1c84d..ccb421f 100644 (file)
 #define ISA_START_ADDRESS      0x0
 #define ISA_END_ADDRESS                0x100000
 
-#if 0 /* not PAE safe */
-/* These hacky macros avoid phys->machine translations. */
-#define __direct_pte(x) ((pte_t) { (x) } )
-#define __direct_mk_pte(page_nr,pgprot) \
-  __direct_pte(((page_nr) << PAGE_SHIFT) | pgprot_val(pgprot))
-#define direct_mk_pte_phys(physpage, pgprot) \
-  __direct_mk_pte((physpage) >> PAGE_SHIFT, pgprot)
-#endif
-
 static int direct_remap_area_pte_fn(pte_t *pte, 
                                    struct page *pmd_page,
                                    unsigned long address, 
@@ -38,6 +29,8 @@ static int direct_remap_area_pte_fn(pte_t *pte,
 {
        mmu_update_t **v = (mmu_update_t **)data;
 
+       BUG_ON(!pte_none(*pte));
+
        (*v)->ptr = ((u64)pfn_to_mfn(page_to_pfn(pmd_page)) <<
                     PAGE_SHIFT) | ((unsigned long)pte & ~PAGE_MASK);
        (*v)++;
@@ -66,17 +59,16 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
 
        for (i = 0; i < size; i += PAGE_SIZE) {
                if ((v - u) == (PAGE_SIZE / sizeof(mmu_update_t))) {
-                       /* Fill in the PTE pointers. */
+                       /* Flush a full batch after filling in the PTE ptrs. */
                        rc = apply_to_page_range(mm, start_address, 
                                                 address - start_address,
                                                 direct_remap_area_pte_fn, &w);
                        if (rc)
                                goto out;
-                       w = u;
                        rc = -EFAULT;
                        if (HYPERVISOR_mmu_update(u, v - u, NULL, domid) < 0)
                                goto out;
-                       v = u;
+                       v = w = u;
                        start_address = address;
                }
 
@@ -92,7 +84,7 @@ static int __direct_remap_pfn_range(struct mm_struct *mm,
        }
 
        if (v != u) {
-               /* get the ptep's filled in */
+               /* Final batch. */
                rc = apply_to_page_range(mm, start_address,
                                         address - start_address,
                                         direct_remap_area_pte_fn, &w);
@@ -120,12 +112,14 @@ int direct_remap_pfn_range(struct vm_area_struct *vma,
                           pgprot_t prot,
                           domid_t  domid)
 {
-       /* Same as remap_pfn_range(). */
-       vma->vm_flags |= VM_IO | VM_RESERVED | VM_PFNMAP;
+       if (xen_feature(XENFEAT_auto_translated_physmap))
+               return remap_pfn_range(vma, address, mfn, size, prot);
 
        if (domid == DOMID_SELF)
                return -EINVAL;
 
+       vma->vm_flags |= VM_IO | VM_RESERVED;
+
        vma->vm_mm->context.has_foreign_mappings = 1;
 
        return __direct_remap_pfn_range(
@@ -179,32 +173,6 @@ int touch_pte_range(struct mm_struct *mm,
 
 EXPORT_SYMBOL(touch_pte_range);
 
-void *vm_map_xen_pages (unsigned long maddr, int vm_size, pgprot_t prot)
-{
-       int error;
-       
-       struct vm_struct *vma;
-       vma = get_vm_area (vm_size, VM_IOREMAP);
-      
-       if (vma == NULL) {
-               printk ("ioremap.c,vm_map_xen_pages(): "
-                       "Failed to get VMA area\n");
-               return NULL;
-       }
-
-       error = direct_kernel_remap_pfn_range((unsigned long) vma->addr,
-                                             maddr >> PAGE_SHIFT, vm_size,
-                                             prot, DOMID_SELF );
-       if (error == 0) {
-               return vma->addr;
-       } else {
-               printk ("ioremap.c,vm_map_xen_pages(): "
-                       "Failed to map xen shared pages into kernel space\n");
-               return NULL;
-       }
-}
-EXPORT_SYMBOL(vm_map_xen_pages);
-
 /*
  * Does @address reside within a non-highmem page that is local to this virtual
  * machine (i.e., not an I/O page, nor a memory page belonging to another VM).
@@ -245,7 +213,7 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
        /*
         * Don't remap the low PCI/ISA area, it's always mapped..
         */
-       if (xen_start_info->flags & SIF_PRIVILEGED &&
+       if (is_initial_xendomain() &&
            phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
                return (void __iomem *) isa_bus_to_virt(phys_addr);
 
@@ -282,9 +250,6 @@ void __iomem * __ioremap(unsigned long phys_addr, unsigned long size, unsigned l
        area->phys_addr = phys_addr;
        addr = (void __iomem *) area->addr;
        flags |= _PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED;
-#ifdef __x86_64__
-       flags |= _PAGE_USER;
-#endif
        if (__direct_remap_pfn_range(&init_mm, (unsigned long)addr,
                                     phys_addr>>PAGE_SHIFT,
                                     size, __pgprot(flags), domid)) {
@@ -423,7 +388,7 @@ void __init *bt_ioremap(unsigned long phys_addr, unsigned long size)
        /*
         * Don't remap the low PCI/ISA area, it's always mapped..
         */
-       if (xen_start_info->flags & SIF_PRIVILEGED &&
+       if (is_initial_xendomain() &&
            phys_addr >= ISA_START_ADDRESS && last_addr < ISA_END_ADDRESS)
                return isa_bus_to_virt(phys_addr);
 
index 8c4af8c..9d8e4cb 100644 (file)
@@ -2,7 +2,6 @@
  *  linux/arch/i386/mm/pgtable.c
  */
 
-#include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
@@ -39,7 +38,6 @@ void show_mem(void)
        struct page *page;
        pg_data_t *pgdat;
        unsigned long i;
-       struct page_state ps;
        unsigned long flags;
 
        printk(KERN_INFO "Mem-info:\n");
@@ -67,12 +65,13 @@ void show_mem(void)
        printk(KERN_INFO "%d pages shared\n", shared);
        printk(KERN_INFO "%d pages swap cached\n", cached);
 
-       get_page_state(&ps);
-       printk(KERN_INFO "%lu pages dirty\n", ps.nr_dirty);
-       printk(KERN_INFO "%lu pages writeback\n", ps.nr_writeback);
-       printk(KERN_INFO "%lu pages mapped\n", ps.nr_mapped);
-       printk(KERN_INFO "%lu pages slab\n", ps.nr_slab);
-       printk(KERN_INFO "%lu pages pagetables\n", ps.nr_page_table_pages);
+       printk(KERN_INFO "%lu pages dirty\n", global_page_state(NR_FILE_DIRTY));
+       printk(KERN_INFO "%lu pages writeback\n",
+                                       global_page_state(NR_WRITEBACK));
+       printk(KERN_INFO "%lu pages mapped\n", global_page_state(NR_FILE_MAPPED));
+       printk(KERN_INFO "%lu pages slab\n", global_page_state(NR_SLAB));
+       printk(KERN_INFO "%lu pages pagetables\n",
+                                       global_page_state(NR_PAGETABLE));
 }
 
 /*
@@ -199,7 +198,6 @@ void __set_fixmap (enum fixed_addresses idx, maddr_t phys, pgprot_t flags)
        }
        switch (idx) {
        case FIX_WP_TEST:
-       case FIX_VSYSCALL:
 #ifdef CONFIG_X86_F00F_BUG
        case FIX_F00F_IDT:
 #endif
diff --git a/arch/i386/oprofile/CVS/Entries b/arch/i386/oprofile/CVS/Entries
deleted file mode 100644 (file)
index 4524f6c..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/Kconfig/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/init.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/nmi_int.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/nmi_timer_int.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/op_counter.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/op_model_athlon.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/op_model_p4.c/1.3/Tue Jul 20 15:33:04 2004/-ko/
-/op_model_ppro.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/op_x86_model.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-D
diff --git a/arch/i386/oprofile/CVS/Repository b/arch/i386/oprofile/CVS/Repository
deleted file mode 100644 (file)
index ddaaae1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/oprofile
diff --git a/arch/i386/oprofile/CVS/Root b/arch/i386/oprofile/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 613c50c..71d0a3c 100644 (file)
 #include <xen/evtchn.h>
 #include "op_counter.h"
 
+#include <xen/driver_util.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/xenoprof.h>
 #include <../../../drivers/oprofile/cpu_buffer.h>
 #include <../../../drivers/oprofile/event_buffer.h>
 
+#define MAX_XENOPROF_SAMPLES 16
+
 static int xenoprof_start(void);
 static void xenoprof_stop(void);
 
-void * vm_map_xen_pages(unsigned long maddr, int vm_size, pgprot_t prot);
-
 static int xenoprof_enabled = 0;
 static unsigned int num_events = 0;
 static int is_primary = 0;
@@ -44,7 +45,7 @@ static int active_defined;
 /* sample buffers shared with Xen */
 xenoprof_buf_t * xenoprof_buf[MAX_VIRT_CPUS];
 /* Shared buffer area */
-char * shared_buffer;
+char * shared_buffer = NULL;
 /* Number of buffers in shared area (one per VCPU) */
 int nbuf;
 /* Mappings of VIRQ_XENOPROF to irq number (per cpu) */
@@ -153,26 +154,26 @@ static void xenoprof_handle_passive(void)
 {
        int i, j;
        int flag_domain, flag_switch = 0;
-
+       
        for (i = 0; i < pdomains; i++) {
                flag_domain = 0;
                for (j = 0; j < passive_domains[i].nbuf; j++) {
                        xenoprof_buf_t *buf = p_xenoprof_buf[i][j];
                        if (buf->event_head == buf->event_tail)
                                continue;
-                        if (!flag_domain) {
-                               if (!oprofile_add_domain_switch(passive_domains[i].domain_id))
+                       if (!flag_domain) {
+                               if (!oprofile_add_domain_switch(passive_domains[i].
+                                                               domain_id))
                                        goto done;
                                flag_domain = 1;
-                        }
-                        xenoprof_add_pc(buf, 1);
-                        flag_switch = 1;
+                       }
+                       xenoprof_add_pc(buf, 1);
+                       flag_switch = 1;
                }
        }
- done:
-        if (flag_switch)
-                oprofile_add_domain_switch(COORDINATOR_DOMAIN);
-
+done:
+       if (flag_switch)
+               oprofile_add_domain_switch(COORDINATOR_DOMAIN);
 }
 
 static irqreturn_t 
@@ -189,6 +190,7 @@ xenoprof_ovf_interrupt(int irq, void * dev_id, struct pt_regs * regs)
 
        if (is_primary && !test_and_set_bit(0, &flag)) {
                xenoprof_handle_passive();
+               smp_mb__before_clear_bit();
                clear_bit(0, &flag);
        }
 
@@ -200,7 +202,7 @@ static void unbind_virq(void)
 {
        int i;
 
-       for_each_cpu(i) {
+       for_each_possible_cpu(i) {
                if (ovf_irq[i] >= 0) {
                        unbind_from_irqhandler(ovf_irq[i], NULL);
                        ovf_irq[i] = -1;
@@ -213,7 +215,7 @@ static int bind_virq(void)
 {
        int i, result;
 
-       for_each_cpu(i) {
+       for_each_possible_cpu(i) {
                result = bind_virq_to_irqhandler(VIRQ_XENOPROF,
                                                 i,
                                                 xenoprof_ovf_interrupt,
@@ -233,13 +235,57 @@ static int bind_virq(void)
 }
 
 
+static int map_xenoprof_buffer(int max_samples)
+{
+       struct xenoprof_get_buffer get_buffer;
+       struct xenoprof_buf *buf;
+       int npages, ret, i;
+       struct vm_struct *area;
+
+       if ( shared_buffer )
+               return 0;
+
+       get_buffer.max_samples = max_samples;
+
+       if ( (ret = HYPERVISOR_xenoprof_op(XENOPROF_get_buffer, &get_buffer)) )
+               return ret;
+
+       nbuf = get_buffer.nbuf;
+       npages = (get_buffer.bufsize * nbuf - 1) / PAGE_SIZE + 1;
+
+       area = alloc_vm_area(npages * PAGE_SIZE);
+       if (area == NULL)
+               return -ENOMEM;
+
+       if ( (ret = direct_kernel_remap_pfn_range(
+                     (unsigned long)area->addr,
+                     get_buffer.buf_maddr >> PAGE_SHIFT,
+                     npages * PAGE_SIZE, __pgprot(_KERNPG_TABLE), DOMID_SELF)) ) {
+               vunmap(area->addr);
+               return ret;
+       }
+
+       shared_buffer = area->addr;
+       for (i=0; i< nbuf; i++) {
+               buf = (struct xenoprof_buf*) 
+                       &shared_buffer[i * get_buffer.bufsize];
+               BUG_ON(buf->vcpu_id >= MAX_VIRT_CPUS);
+               xenoprof_buf[buf->vcpu_id] = buf;
+       }
+
+       return 0;
+}
+
+
 static int xenoprof_setup(void)
 {
        int ret;
        int i;
 
-       ret = bind_virq();
-       if (ret)
+       if ( (ret = map_xenoprof_buffer(MAX_XENOPROF_SAMPLES)) )
+               return ret;
+
+       if ( (ret = bind_virq()) )
                return ret;
 
        if (is_primary) {
@@ -372,9 +418,9 @@ static int xenoprof_set_passive(int * p_domains,
 {
        int ret;
        int i, j;
-       int vm_size;
        int npages;
        struct xenoprof_buf *buf;
+       struct vm_struct *area;
        pgprot_t prot = __pgprot(_KERNPG_TABLE);
 
        if (!is_primary)
@@ -390,20 +436,30 @@ static int xenoprof_set_passive(int * p_domains,
        for (i = 0; i < pdoms; i++) {
                passive_domains[i].domain_id = p_domains[i];
                passive_domains[i].max_samples = 2048;
-               ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive, &passive_domains[i]);
+               ret = HYPERVISOR_xenoprof_op(XENOPROF_set_passive,
+                                            &passive_domains[i]);
                if (ret)
-                       return ret;
+                       goto out;
 
                npages = (passive_domains[i].bufsize * passive_domains[i].nbuf - 1) / PAGE_SIZE + 1;
-               vm_size = npages * PAGE_SIZE;
 
-               p_shared_buffer[i] = (char *)vm_map_xen_pages(passive_domains[i].buf_maddr,
-                                                             vm_size, prot);
-               if (!p_shared_buffer[i]) {
+               area = alloc_vm_area(npages * PAGE_SIZE);
+               if (area == NULL) {
                        ret = -ENOMEM;
                        goto out;
                }
 
+               ret = direct_kernel_remap_pfn_range(
+                       (unsigned long)area->addr,
+                       passive_domains[i].buf_maddr >> PAGE_SHIFT,
+                       npages * PAGE_SIZE, prot, DOMID_SELF);
+               if (ret) {
+                       vunmap(area->addr);
+                       goto out;
+               }
+
+               p_shared_buffer[i] = area->addr;
+
                for (j = 0; j < passive_domains[i].nbuf; j++) {
                        buf = (struct xenoprof_buf *)
                                &p_shared_buffer[i][j * passive_domains[i].bufsize];
@@ -472,44 +528,19 @@ static int using_xenoprof;
 int __init oprofile_arch_init(struct oprofile_operations * ops)
 {
        struct xenoprof_init init;
-       struct xenoprof_buf * buf;
-       int vm_size;
-       int npages;
-       int ret;
-       int i;
+       int ret, i;
 
-       init.max_samples = 16;
        ret = HYPERVISOR_xenoprof_op(XENOPROF_init, &init);
 
        if (!ret) {
-               pgprot_t prot = __pgprot(_KERNPG_TABLE);
-
                num_events = init.num_events;
                is_primary = init.is_primary;
-               nbuf = init.nbuf;
 
                /* just in case - make sure we do not overflow event list 
-                   (i.e. counter_config list) */
+                  (i.e. counter_config list) */
                if (num_events > OP_MAX_COUNTER)
                        num_events = OP_MAX_COUNTER;
 
-               npages = (init.bufsize * nbuf - 1) / PAGE_SIZE + 1;
-               vm_size = npages * PAGE_SIZE;
-
-               shared_buffer = (char *)vm_map_xen_pages(init.buf_maddr,
-                                                        vm_size, prot);
-               if (!shared_buffer) {
-                       ret = -ENOMEM;
-                       goto out;
-               }
-
-               for (i=0; i< nbuf; i++) {
-                       buf = (struct xenoprof_buf*) 
-                               &shared_buffer[i * init.bufsize];
-                       BUG_ON(buf->vcpu_id >= MAX_VIRT_CPUS);
-                       xenoprof_buf[buf->vcpu_id] = buf;
-               }
-
                /*  cpu_type is detected by Xen */
                cpu_type[XENOPROF_CPU_TYPE_SIZE-1] = 0;
                strncpy(cpu_type, init.cpu_type, XENOPROF_CPU_TYPE_SIZE - 1);
@@ -524,7 +555,6 @@ int __init oprofile_arch_init(struct oprofile_operations * ops)
 
                active_defined = 0;
        }
- out:
        printk(KERN_INFO "oprofile_arch_init: ret %d, events %d, "
               "is_primary %d\n", ret, num_events, is_primary);
        return ret;
diff --git a/arch/i386/pci/CVS/Entries b/arch/i386/pci/CVS/Entries
deleted file mode 100644 (file)
index a6e7ea0..0000000
+++ /dev/null
@@ -1,15 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/acpi.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/changelog/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/common.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/direct.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/fixup.c/1.3/Fri Jul 16 15:16:50 2004/-ko/
-/i386.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/irq.c/1.3/Tue Jul 20 15:33:04 2004/-ko/
-/legacy.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/mmconfig.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/numa.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/pcbios.c/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/pci.h/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/visws.c/1.2/Tue Jul 20 15:33:04 2004/-ko/
-D
diff --git a/arch/i386/pci/CVS/Repository b/arch/i386/pci/CVS/Repository
deleted file mode 100644 (file)
index 8059524..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/pci
diff --git a/arch/i386/pci/CVS/Root b/arch/i386/pci/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index 382af42..68e7e66 100644 (file)
@@ -4,7 +4,6 @@
  *     (c) 1999--2000 Martin Mares <mj@ucw.cz>
  */
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/pci.h>
@@ -95,7 +94,10 @@ static struct irq_routing_table * __init pirq_find_routing_table(void)
        u8 *addr;
        struct irq_routing_table *rt;
 
-#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+#ifdef CONFIG_XEN
+       if (!is_initial_xendomain())
+               return NULL;
+#endif
        if (pirq_table_addr) {
                rt = pirq_check_routing_table((u8 *) isa_bus_to_virt(pirq_table_addr));
                if (rt)
@@ -107,7 +109,6 @@ static struct irq_routing_table * __init pirq_find_routing_table(void)
                if (rt)
                        return rt;
        }
-#endif
        
        return NULL;
 }
@@ -201,14 +202,14 @@ static void write_config_nybble(struct pci_dev *router, unsigned offset, unsigne
  */
 static int pirq_ali_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
 {
-       static unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 };
+       static const unsigned char irqmap[16] = { 0, 9, 3, 10, 4, 5, 7, 6, 1, 11, 0, 12, 0, 14, 0, 15 };
 
        return irqmap[read_config_nybble(router, 0x48, pirq-1)];
 }
 
 static int pirq_ali_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
 {
-       static unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 };
+       static const unsigned char irqmap[16] = { 0, 8, 0, 2, 4, 5, 7, 6, 0, 1, 3, 9, 11, 0, 13, 15 };
        unsigned int val = irqmap[irq];
                
        if (val) {
@@ -259,13 +260,13 @@ static int pirq_via_set(struct pci_dev *router, struct pci_dev *dev, int pirq, i
  */
 static int pirq_via586_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
 {
-       static unsigned int pirqmap[4] = { 3, 2, 5, 1 };
+       static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 };
        return read_config_nybble(router, 0x55, pirqmap[pirq-1]);
 }
 
 static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
 {
-       static unsigned int pirqmap[4] = { 3, 2, 5, 1 };
+       static const unsigned int pirqmap[5] = { 3, 2, 5, 1, 1 };
        write_config_nybble(router, 0x55, pirqmap[pirq-1], irq);
        return 1;
 }
@@ -277,13 +278,13 @@ static int pirq_via586_set(struct pci_dev *router, struct pci_dev *dev, int pirq
  */
 static int pirq_ite_get(struct pci_dev *router, struct pci_dev *dev, int pirq)
 {
-       static unsigned char pirqmap[4] = { 1, 0, 2, 3 };
+       static const unsigned char pirqmap[4] = { 1, 0, 2, 3 };
        return read_config_nybble(router,0x43, pirqmap[pirq-1]);
 }
 
 static int pirq_ite_set(struct pci_dev *router, struct pci_dev *dev, int pirq, int irq)
 {
-       static unsigned char pirqmap[4] = { 1, 0, 2, 3 };
+       static const unsigned char pirqmap[4] = { 1, 0, 2, 3 };
        write_config_nybble(router, 0x43, pirqmap[pirq-1], irq);
        return 1;
 }
@@ -508,7 +509,7 @@ static int pirq_bios_set(struct pci_dev *router, struct pci_dev *dev, int pirq,
 
 static __init int intel_router_probe(struct irq_router *r, struct pci_dev *router, u16 device)
 {
-       static struct pci_device_id pirq_440gx[] = {
+       static struct pci_device_id __initdata pirq_440gx[] = {
                { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_0) },
                { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82443GX_2) },
                { },
@@ -868,7 +869,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
                for (i = 0; i < 16; i++) {
                        if (!(mask & (1 << i)))
                                continue;
-                       if (pirq_penalty[i] < pirq_penalty[newirq] && can_request_irq(i, SA_SHIRQ))
+                       if (pirq_penalty[i] < pirq_penalty[newirq] && can_request_irq(i, IRQF_SHARED))
                                newirq = i;
                }
        }
@@ -883,6 +884,7 @@ static int pcibios_lookup_irq(struct pci_dev *dev, int assign)
        ((!(pci_probe & PCI_USE_PIRQ_MASK)) || ((1 << irq) & mask)) ) {
                DBG(" -> got IRQ %d\n", irq);
                msg = "Found";
+               eisa_set_level_irq(irq);
        } else if (newirq && r->set && (dev->class >> 8) != PCI_CLASS_DISPLAY_VGA) {
                DBG(" -> assigning IRQ %d", newirq);
                if (r->set(pirq_router_dev, dev, pirq, newirq)) {
diff --git a/arch/i386/power/CVS/Entries b/arch/i386/power/CVS/Entries
deleted file mode 100644 (file)
index 71e1f7a..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:46 2004/-ko/
-/cpu.c/1.3/Tue Jul 20 15:33:04 2004/-ko/
-/pmdisk.S/1.2/Wed Jun  2 20:34:56 2004/-ko/
-/swsusp.S/1.3/Tue Jul 20 15:33:04 2004/-ko/
-D
diff --git a/arch/i386/power/CVS/Repository b/arch/i386/power/CVS/Repository
deleted file mode 100644 (file)
index 472f04b..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/i386/power
diff --git a/arch/i386/power/CVS/Root b/arch/i386/power/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/CVS/Entries b/arch/ia64/CVS/Entries
deleted file mode 100644 (file)
index 2d1c2de..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-/Kconfig/1.5/Tue Jul 20 15:33:04 2004/-ko/
-/Makefile/1.3/Tue Jul 20 15:33:04 2004/-ko/
-/defconfig/1.3/Tue Jul 20 15:33:04 2004/-ko/
-/install.sh/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/module.lds/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D/configs////
-D/dig////
-D/hp////
-D/ia32////
-D/kernel////
-D/lib////
-D/mm////
-D/oprofile////
-D/pci////
-D/scripts////
-D/sn////
diff --git a/arch/ia64/CVS/Repository b/arch/ia64/CVS/Repository
deleted file mode 100644 (file)
index 3fdbdd4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64
diff --git a/arch/ia64/CVS/Root b/arch/ia64/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/configs/CVS/Entries b/arch/ia64/configs/CVS/Entries
deleted file mode 100644 (file)
index 7ab5e85..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/generic_defconfig/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sim_defconfig/1.1.1.1/Mon Jul 12 21:55:45 2004/-ko/
-/sn2_defconfig/1.2/Tue Jul 20 15:33:04 2004/-ko/
-/zx1_defconfig/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/configs/CVS/Repository b/arch/ia64/configs/CVS/Repository
deleted file mode 100644 (file)
index 151afc6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/configs
diff --git a/arch/ia64/configs/CVS/Root b/arch/ia64/configs/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/dig/CVS/Entries b/arch/ia64/dig/CVS/Entries
deleted file mode 100644 (file)
index f32da85..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.2/Wed Jun  2 20:34:57 2004/-ko/
-/machvec.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/setup.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/topology.c/1.1.3.1/Wed Jun  2 19:33:09 2004/-ko/
-D
diff --git a/arch/ia64/dig/CVS/Repository b/arch/ia64/dig/CVS/Repository
deleted file mode 100644 (file)
index 51acdd6..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/dig
diff --git a/arch/ia64/dig/CVS/Root b/arch/ia64/dig/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/hp/CVS/Entries b/arch/ia64/hp/CVS/Entries
deleted file mode 100644 (file)
index 6feb242..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-D/common////
-D/sim////
-D/zx1////
diff --git a/arch/ia64/hp/CVS/Repository b/arch/ia64/hp/CVS/Repository
deleted file mode 100644 (file)
index 0f82242..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/hp
diff --git a/arch/ia64/hp/CVS/Root b/arch/ia64/hp/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/hp/common/CVS/Entries b/arch/ia64/hp/common/CVS/Entries
deleted file mode 100644 (file)
index 31015dd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sba_iommu.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/hp/common/CVS/Repository b/arch/ia64/hp/common/CVS/Repository
deleted file mode 100644 (file)
index 583a4ef..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/hp/common
diff --git a/arch/ia64/hp/common/CVS/Root b/arch/ia64/hp/common/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/hp/sim/CVS/Entries b/arch/ia64/hp/sim/CVS/Entries
deleted file mode 100644 (file)
index e07b748..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/Kconfig/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hpsim.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hpsim_console.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hpsim_irq.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hpsim_machvec.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hpsim_setup.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hpsim_ssc.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/simeth.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/simscsi.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/simserial.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D/boot////
diff --git a/arch/ia64/hp/sim/CVS/Repository b/arch/ia64/hp/sim/CVS/Repository
deleted file mode 100644 (file)
index 74d1e7f..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/hp/sim
diff --git a/arch/ia64/hp/sim/CVS/Root b/arch/ia64/hp/sim/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/hp/sim/boot/CVS/Entries b/arch/ia64/hp/sim/boot/CVS/Entries
deleted file mode 100644 (file)
index 35d7b76..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/boot_head.S/1.2/Wed Jun  2 20:34:57 2004/-ko/
-/bootloader.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/bootloader.lds/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fw-emu.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ssc.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/hp/sim/boot/CVS/Repository b/arch/ia64/hp/sim/boot/CVS/Repository
deleted file mode 100644 (file)
index de0e0e1..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/hp/sim/boot
diff --git a/arch/ia64/hp/sim/boot/CVS/Root b/arch/ia64/hp/sim/boot/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/hp/zx1/CVS/Entries b/arch/ia64/hp/zx1/CVS/Entries
deleted file mode 100644 (file)
index 7b8a0ff..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hpzx1_machvec.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/hp/zx1/CVS/Repository b/arch/ia64/hp/zx1/CVS/Repository
deleted file mode 100644 (file)
index 0513de3..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/hp/zx1
diff --git a/arch/ia64/hp/zx1/CVS/Root b/arch/ia64/hp/zx1/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/ia32/CVS/Entries b/arch/ia64/ia32/CVS/Entries
deleted file mode 100644 (file)
index a7964f4..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/Makefile/1.2/Wed Jun  2 20:34:58 2004/-ko/
-/binfmt_elf32.c/1.5/Tue Jul 20 15:33:04 2004/-ko/
-/elfcore32.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ia32_entry.S/1.4/Tue Jul 20 15:33:04 2004/-ko/
-/ia32_ioctl.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ia32_ldt.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ia32_signal.c/1.2/Wed Jun  2 20:34:58 2004/-ko/
-/ia32_support.c/1.2/Tue Jul 20 15:33:04 2004/-ko/
-/ia32_traps.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ia32priv.h/1.2/Tue Jul 20 15:33:04 2004/-ko/
-/sys_ia32.c/1.3/Tue Jul 20 15:33:04 2004/-ko/
-D
diff --git a/arch/ia64/ia32/CVS/Repository b/arch/ia64/ia32/CVS/Repository
deleted file mode 100644 (file)
index faea104..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/ia32
diff --git a/arch/ia64/ia32/CVS/Root b/arch/ia64/ia32/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/kernel/CVS/Entries b/arch/ia64/kernel/CVS/Entries
deleted file mode 100644 (file)
index dd06169..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-/Makefile/1.2/Wed Jun  2 20:34:58 2004/-ko/
-/acpi-ext.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/acpi.c/1.3/Fri Jul 16 15:16:50 2004/-ko/
-/asm-offsets.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/brl_emu.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/cyclone.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/efi.c/1.3/Tue Jul 20 15:33:04 2004/-ko/
-/efi_stub.S/1.2/Tue Jul 20 15:33:04 2004/-ko/
-/entry.S/1.5/Fri Jul 30 14:12:43 2004/-ko/
-/entry.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fsys.S/1.4/Tue Jul 20 15:33:04 2004/-ko/
-/gate-data.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/gate.S/1.1.1.2/Mon Jul 12 21:55:44 2004/-ko/
-/gate.lds.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/head.S/1.4/Tue Jul 20 15:33:05 2004/-ko/
-/ia64_ksyms.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/init_task.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-/iosapic.c/1.4/Tue Jul 20 15:33:05 2004/-ko/
-/irq.c/1.4/Tue Jul 20 15:33:05 2004/-ko/
-/irq_ia64.c/1.2/Wed Jun  2 20:34:59 2004/-ko/
-/irq_lsapic.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ivt.S/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/machvec.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/mca.c/1.2/Tue Jul 20 15:33:05 2004/-ko/
-/mca_asm.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/minstate.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/module.c/1.2/Tue Jul 20 15:33:05 2004/-ko/
-/pal.S/1.2/Tue Jul 20 15:33:05 2004/-ko/
-/palinfo.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/patch.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/perfmon.c/1.4/Tue Jul 20 15:33:05 2004/-ko/
-/perfmon_default_smpl.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/perfmon_generic.h/1.2/Wed Jun  2 20:34:59 2004/-ko/
-/perfmon_itanium.h/1.2/Wed Jun  2 20:34:59 2004/-ko/
-/perfmon_mckinley.h/1.2/Wed Jun  2 20:34:59 2004/-ko/
-/process.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/ptrace.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/sal.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/salinfo.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/semaphore.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/setup.c/1.4/Tue Jul 20 15:33:05 2004/-ko/
-/sigframe.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/signal.c/1.2/Wed Jun  2 20:35:00 2004/-ko/
-/smp.c/1.2/Wed Jun  2 20:35:00 2004/-ko/
-/smpboot.c/1.3/Fri Jul 16 15:16:50 2004/-ko/
-/sys_ia64.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/time.c/1.3/Fri Jul 16 15:16:50 2004/-ko/
-/traps.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/unaligned.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/unwind.c/1.3/Tue Jul 20 15:33:05 2004/-ko/
-/unwind_decoder.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/unwind_i.h/1.2/Wed Jun  2 20:35:01 2004/-ko/
-/vmlinux.lds.S/1.1.1.2/Mon Jul 12 21:55:44 2004/-ko/
-D
diff --git a/arch/ia64/kernel/CVS/Repository b/arch/ia64/kernel/CVS/Repository
deleted file mode 100644 (file)
index c765996..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/kernel
diff --git a/arch/ia64/kernel/CVS/Root b/arch/ia64/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/lib/CVS/Entries b/arch/ia64/lib/CVS/Entries
deleted file mode 100644 (file)
index 494cff5..0000000
+++ /dev/null
@@ -1,27 +0,0 @@
-/Makefile/1.1.1.2/Mon Jul 12 21:55:45 2004/-ko/
-/bitop.c/1.1.1.1/Mon Jul 12 21:55:45 2004/-ko/
-/carta_random.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/checksum.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/clear_page.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/clear_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/copy_page.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/copy_page_mck.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/copy_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/csum_partial_copy.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/dec_and_lock.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/do_csum.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/flush.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/idiv32.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/idiv64.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ip_fast_csum.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memcpy.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memcpy_mck.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/memset.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strlen.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strlen_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strncpy_from_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/strnlen_user.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/swiotlb.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/xor.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/lib/CVS/Repository b/arch/ia64/lib/CVS/Repository
deleted file mode 100644 (file)
index d8f4329..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/lib
diff --git a/arch/ia64/lib/CVS/Root b/arch/ia64/lib/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/mm/CVS/Entries b/arch/ia64/mm/CVS/Entries
deleted file mode 100644 (file)
index 2df56d1..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/contig.c/1.2/Tue Jul 20 15:33:05 2004/-ko/
-/discontig.c/1.2/Tue Jul 20 15:33:05 2004/-ko/
-/extable.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fault.c/1.3/Fri Jul 30 14:12:43 2004/-ko/
-/hugetlbpage.c/1.4/Tue Jul 20 15:33:05 2004/-ko/
-/init.c/1.2/Wed Jun  2 20:35:01 2004/-ko/
-/numa.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/tlb.c/1.2/Wed Jun  2 20:35:01 2004/-ko/
-D
diff --git a/arch/ia64/mm/CVS/Repository b/arch/ia64/mm/CVS/Repository
deleted file mode 100644 (file)
index db7b094..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/mm
diff --git a/arch/ia64/mm/CVS/Root b/arch/ia64/mm/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/oprofile/CVS/Entries b/arch/ia64/oprofile/CVS/Entries
deleted file mode 100644 (file)
index b38d160..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Kconfig/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/init.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/oprofile/CVS/Repository b/arch/ia64/oprofile/CVS/Repository
deleted file mode 100644 (file)
index 65f6e5a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/oprofile
diff --git a/arch/ia64/oprofile/CVS/Root b/arch/ia64/oprofile/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/pci/CVS/Entries b/arch/ia64/pci/CVS/Entries
deleted file mode 100644 (file)
index 014f6cb..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pci.c/1.2/Fri Jul 16 15:16:50 2004/-ko/
-D
diff --git a/arch/ia64/pci/CVS/Repository b/arch/ia64/pci/CVS/Repository
deleted file mode 100644 (file)
index 13d3d1c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/pci
diff --git a/arch/ia64/pci/CVS/Root b/arch/ia64/pci/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/scripts/CVS/Entries b/arch/ia64/scripts/CVS/Entries
deleted file mode 100644 (file)
index 650e632..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/check-gas/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/check-gas-asm.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/check-model.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/check-segrel.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/check-segrel.lds/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/check-serialize.S/1.1.3.1/Wed Jun  2 19:33:09 2004/-ko/
-/check-text-align.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/toolchain-flags/1.2/Wed Jun  2 20:35:01 2004/-ko/
-/unwcheck.py/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/scripts/CVS/Repository b/arch/ia64/scripts/CVS/Repository
deleted file mode 100644 (file)
index 8bf3542..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/scripts
diff --git a/arch/ia64/scripts/CVS/Root b/arch/ia64/scripts/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/CVS/Entries b/arch/ia64/sn/CVS/Entries
deleted file mode 100644 (file)
index b2857a6..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D/fakeprom////
-D/io////
-D/kernel////
diff --git a/arch/ia64/sn/CVS/Repository b/arch/ia64/sn/CVS/Repository
deleted file mode 100644 (file)
index 2932216..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn
diff --git a/arch/ia64/sn/CVS/Root b/arch/ia64/sn/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/fakeprom/CVS/Entries b/arch/ia64/sn/fakeprom/CVS/Entries
deleted file mode 100644 (file)
index 98a4010..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/README/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fpmem.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fpmem.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fprom.lds/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fpromasm.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/fw-emu.c/1.2/Tue Jul 20 15:33:05 2004/-ko/
-/klgraph_init.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/main.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/make_textsym/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/runsim/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/sn/fakeprom/CVS/Repository b/arch/ia64/sn/fakeprom/CVS/Repository
deleted file mode 100644 (file)
index f885050..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/fakeprom
diff --git a/arch/ia64/sn/fakeprom/CVS/Root b/arch/ia64/sn/fakeprom/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/io/CVS/Entries b/arch/ia64/sn/io/CVS/Entries
deleted file mode 100644 (file)
index d8c429c..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/cdl.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io.c/1.2/Wed Jun  2 20:35:01 2004/-ko/
-/snia_if.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/xswitch.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D/drivers////
-D/hwgfs////
-D/machvec////
-D/platform_init////
-D/sn2////
diff --git a/arch/ia64/sn/io/CVS/Repository b/arch/ia64/sn/io/CVS/Repository
deleted file mode 100644 (file)
index 76413d0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/io
diff --git a/arch/ia64/sn/io/CVS/Root b/arch/ia64/sn/io/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/io/drivers/CVS/Entries b/arch/ia64/sn/io/drivers/CVS/Entries
deleted file mode 100644 (file)
index f32e0fd..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ioconfig_bus.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/sn/io/drivers/CVS/Repository b/arch/ia64/sn/io/drivers/CVS/Repository
deleted file mode 100644 (file)
index abb63f0..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/io/drivers
diff --git a/arch/ia64/sn/io/drivers/CVS/Root b/arch/ia64/sn/io/drivers/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/io/hwgfs/CVS/Entries b/arch/ia64/sn/io/hwgfs/CVS/Entries
deleted file mode 100644 (file)
index 6febe83..0000000
+++ /dev/null
@@ -1,7 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hcl.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hcl_util.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/interface.c/1.2/Wed Jun  2 20:35:02 2004/-ko/
-/labelcl.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ramfs.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/sn/io/hwgfs/CVS/Repository b/arch/ia64/sn/io/hwgfs/CVS/Repository
deleted file mode 100644 (file)
index 6828d90..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/io/hwgfs
diff --git a/arch/ia64/sn/io/hwgfs/CVS/Root b/arch/ia64/sn/io/hwgfs/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/io/machvec/CVS/Entries b/arch/ia64/sn/io/machvec/CVS/Entries
deleted file mode 100644 (file)
index a08f78d..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/iomv.c/1.1.1.2/Mon Jul 12 21:55:44 2004/-ko/
-/pci.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pci_bus_cvlink.c/1.3/Tue Jul 20 15:33:06 2004/-ko/
-/pci_dma.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/sn/io/machvec/CVS/Repository b/arch/ia64/sn/io/machvec/CVS/Repository
deleted file mode 100644 (file)
index 333c247..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/io/machvec
diff --git a/arch/ia64/sn/io/machvec/CVS/Root b/arch/ia64/sn/io/machvec/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/io/platform_init/CVS/Entries b/arch/ia64/sn/io/platform_init/CVS/Entries
deleted file mode 100644 (file)
index 41455fa..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sgi_io_init.c/1.2/Wed Jun  2 20:35:02 2004/-ko/
-D
diff --git a/arch/ia64/sn/io/platform_init/CVS/Repository b/arch/ia64/sn/io/platform_init/CVS/Repository
deleted file mode 100644 (file)
index 09491fd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/io/platform_init
diff --git a/arch/ia64/sn/io/platform_init/CVS/Root b/arch/ia64/sn/io/platform_init/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/io/sn2/CVS/Entries b/arch/ia64/sn/io/sn2/CVS/Entries
deleted file mode 100644 (file)
index a738f64..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/bte_error.c/1.2/Tue Jul 20 15:33:06 2004/-ko/
-/geo_op.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/klconflib.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/klgraph.c/1.3/Tue Jul 20 15:33:06 2004/-ko/
-/l1_command.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ml_SN_init.c/1.2/Wed Jun  2 20:35:02 2004/-ko/
-/ml_SN_intr.c/1.2/Wed Jun  2 20:35:02 2004/-ko/
-/ml_iograph.c/1.3/Tue Jul 20 15:33:06 2004/-ko/
-/module.c/1.3/Tue Jul 20 15:33:06 2004/-ko/
-/pciio.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pic.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/shub.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/shub_intr.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/shuberror.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/shubio.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/xbow.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/xtalk.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D/pcibr////
diff --git a/arch/ia64/sn/io/sn2/CVS/Repository b/arch/ia64/sn/io/sn2/CVS/Repository
deleted file mode 100644 (file)
index e5e363c..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/io/sn2
diff --git a/arch/ia64/sn/io/sn2/CVS/Root b/arch/ia64/sn/io/sn2/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/io/sn2/pcibr/CVS/Entries b/arch/ia64/sn/io/sn2/pcibr/CVS/Entries
deleted file mode 100644 (file)
index b82a793..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_ate.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_config.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_dvr.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/pcibr_error.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_hints.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_intr.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_reg.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_rrb.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/pcibr_slot.c/1.1.1.2/Mon Jul 12 21:55:44 2004/-ko/
-D
diff --git a/arch/ia64/sn/io/sn2/pcibr/CVS/Repository b/arch/ia64/sn/io/sn2/pcibr/CVS/Repository
deleted file mode 100644 (file)
index e292d87..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/io/sn2/pcibr
diff --git a/arch/ia64/sn/io/sn2/pcibr/CVS/Root b/arch/ia64/sn/io/sn2/pcibr/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/ia64/sn/kernel/CVS/Entries b/arch/ia64/sn/kernel/CVS/Entries
deleted file mode 100644 (file)
index 7dd62b3..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/bte.c/1.2/Tue Jul 20 15:33:06 2004/-ko/
-/idle.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/irq.c/1.2/Tue Jul 20 15:33:06 2004/-ko/
-/machvec.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/mca.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/probe.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/setup.c/1.3/Tue Jul 20 15:33:06 2004/-ko/
-D/sn2////
diff --git a/arch/ia64/sn/kernel/CVS/Repository b/arch/ia64/sn/kernel/CVS/Repository
deleted file mode 100644 (file)
index 8181ac4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/kernel
diff --git a/arch/ia64/sn/kernel/CVS/Root b/arch/ia64/sn/kernel/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index fec6d8b..7ce3cda 100644 (file)
@@ -9,12 +9,16 @@
 #include <linux/module.h>
 #include <asm/io.h>
 #include <asm/delay.h>
+#include <asm/vga.h>
 #include <asm/sn/nodepda.h>
 #include <asm/sn/simulator.h>
 #include <asm/sn/pda.h>
 #include <asm/sn/sn_cpuid.h>
 #include <asm/sn/shub_mmr.h>
 
+#define IS_LEGACY_VGA_IOPORT(p) \
+       (((p) >= 0x3b0 && (p) <= 0x3bb) || ((p) >= 0x3c0 && (p) <= 0x3df))
+
 /**
  * sn_io_addr - convert an in/out port to an i/o address
  * @port: port to convert
@@ -26,6 +30,8 @@
 void *sn_io_addr(unsigned long port)
 {
        if (!IS_RUNNING_ON_SIMULATOR()) {
+               if (IS_LEGACY_VGA_IOPORT(port))
+                       port += vga_console_iobase;
                /* On sn2, legacy I/O ports don't point at anything */
                if (port < (64 * 1024))
                        return NULL;
diff --git a/arch/ia64/sn/kernel/sn2/CVS/Entries b/arch/ia64/sn/kernel/sn2/CVS/Entries
deleted file mode 100644 (file)
index ef2256f..0000000
+++ /dev/null
@@ -1,10 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/cache.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/io.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/prominfo_proc.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/ptc_deadlock.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/sn2_smp.c/1.2/Tue Jul 20 15:33:06 2004/-ko/
-/sn_proc_fs.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/timer.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/timer_interrupt.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/ia64/sn/kernel/sn2/CVS/Repository b/arch/ia64/sn/kernel/sn2/CVS/Repository
deleted file mode 100644 (file)
index 73f2fcd..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/ia64/sn/kernel/sn2
diff --git a/arch/ia64/sn/kernel/sn2/CVS/Root b/arch/ia64/sn/kernel/sn2/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index ab9b5f3..feaf1a6 100644 (file)
@@ -8,12 +8,13 @@
 
 #include <linux/module.h>
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/slab.h>
 #include <linux/spinlock.h>
 #include <linux/proc_fs.h>
+#include <linux/capability.h>
 #include <linux/device.h>
 #include <linux/delay.h>
+#include <asm/system.h>
 #include <asm/uaccess.h>
 #include <asm/sn/sn_sal.h>
 #include <asm/sn/addrs.h>
@@ -65,7 +66,7 @@ static int tiocx_match(struct device *dev, struct device_driver *drv)
 
 }
 
-static int tiocx_hotplug(struct device *dev, char **envp, int num_envp,
+static int tiocx_uevent(struct device *dev, char **envp, int num_envp,
                         char *buffer, int buffer_size)
 {
        return -ENODEV;
@@ -76,12 +77,6 @@ static void tiocx_bus_release(struct device *dev)
        kfree(to_cx_dev(dev));
 }
 
-struct bus_type tiocx_bus_type = {
-       .name = "tiocx",
-       .match = tiocx_match,
-       .hotplug = tiocx_hotplug,
-};
-
 /**
  * cx_device_match - Find cx_device in the id table.
  * @ids: id table from driver
@@ -148,6 +143,14 @@ static int cx_driver_remove(struct device *dev)
        return 0;
 }
 
+struct bus_type tiocx_bus_type = {
+       .name = "tiocx",
+       .match = tiocx_match,
+       .uevent = tiocx_uevent,
+       .probe = cx_device_probe,
+       .remove = cx_driver_remove,
+};
+
 /**
  * cx_driver_register - Register the driver.
  * @cx_driver: driver table (cx_drv struct) from driver
@@ -161,8 +164,6 @@ int cx_driver_register(struct cx_drv *cx_driver)
 {
        cx_driver->driver.name = cx_driver->name;
        cx_driver->driver.bus = &tiocx_bus_type;
-       cx_driver->driver.probe = cx_device_probe;
-       cx_driver->driver.remove = cx_driver_remove;
 
        return driver_register(&cx_driver->driver);
 }
@@ -183,15 +184,16 @@ int cx_driver_unregister(struct cx_drv *cx_driver)
  * @part_num: device's part number
  * @mfg_num: device's manufacturer number
  * @hubdev: hub info associated with this device
+ * @bt: board type of the device
  *
  */
 int
 cx_device_register(nasid_t nasid, int part_num, int mfg_num,
-                  struct hubdev_info *hubdev)
+                  struct hubdev_info *hubdev, int bt)
 {
        struct cx_dev *cx_dev;
 
-       cx_dev = kcalloc(1, sizeof(struct cx_dev), GFP_KERNEL);
+       cx_dev = kzalloc(sizeof(struct cx_dev), GFP_KERNEL);
        DBG("cx_dev= 0x%p\n", cx_dev);
        if (cx_dev == NULL)
                return -ENOMEM;
@@ -200,12 +202,13 @@ cx_device_register(nasid_t nasid, int part_num, int mfg_num,
        cx_dev->cx_id.mfg_num = mfg_num;
        cx_dev->cx_id.nasid = nasid;
        cx_dev->hubdev = hubdev;
+       cx_dev->bt = bt;
 
        cx_dev->dev.parent = NULL;
        cx_dev->dev.bus = &tiocx_bus_type;
        cx_dev->dev.release = tiocx_bus_release;
-       snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d.0x%x",
-                cx_dev->cx_id.nasid, cx_dev->cx_id.part_num);
+       snprintf(cx_dev->dev.bus_id, BUS_ID_SIZE, "%d",
+                cx_dev->cx_id.nasid);
        device_register(&cx_dev->dev);
        get_device(&cx_dev->dev);
 
@@ -236,13 +239,13 @@ int cx_device_unregister(struct cx_dev *cx_dev)
  */
 static int cx_device_reload(struct cx_dev *cx_dev)
 {
-       device_remove_file(&cx_dev->dev, &dev_attr_cxdev_control);
        cx_device_unregister(cx_dev);
        return cx_device_register(cx_dev->cx_id.nasid, cx_dev->cx_id.part_num,
-                                 cx_dev->cx_id.mfg_num, cx_dev->hubdev);
+                                 cx_dev->cx_id.mfg_num, cx_dev->hubdev,
+                                 cx_dev->bt);
 }
 
-static inline uint64_t tiocx_intr_alloc(nasid_t nasid, int widget,
+static inline u64 tiocx_intr_alloc(nasid_t nasid, int widget,
                                        u64 sn_irq_info,
                                        int req_irq, nasid_t req_nasid,
                                        int req_slice)
@@ -281,12 +284,10 @@ struct sn_irq_info *tiocx_irq_alloc(nasid_t nasid, int widget, int irq,
        if ((nasid & 1) == 0)
                return NULL;
 
-       sn_irq_info = kmalloc(sn_irq_size, GFP_KERNEL);
+       sn_irq_info = kzalloc(sn_irq_size, GFP_KERNEL);
        if (sn_irq_info == NULL)
                return NULL;
 
-       memset(sn_irq_info, 0x0, sn_irq_size);
-
        status = tiocx_intr_alloc(nasid, widget, __pa(sn_irq_info), irq,
                                  req_nasid, slice);
        if (status) {
@@ -299,7 +300,7 @@ struct sn_irq_info *tiocx_irq_alloc(nasid_t nasid, int widget, int irq,
 
 void tiocx_irq_free(struct sn_irq_info *sn_irq_info)
 {
-       uint64_t bridge = (uint64_t) sn_irq_info->irq_bridge;
+       u64 bridge = (u64) sn_irq_info->irq_bridge;
        nasid_t nasid = NASID_GET(bridge);
        int widget;
 
@@ -310,12 +311,12 @@ void tiocx_irq_free(struct sn_irq_info *sn_irq_info)
        }
 }
 
-uint64_t tiocx_dma_addr(uint64_t addr)
+u64 tiocx_dma_addr(u64 addr)
 {
        return PHYS_TO_TIODMA(addr);
 }
 
-uint64_t tiocx_swin_base(int nasid)
+u64 tiocx_swin_base(int nasid)
 {
        return TIO_SWIN_BASE(nasid, TIOCX_CORELET);
 }
@@ -332,8 +333,8 @@ EXPORT_SYMBOL(tiocx_swin_base);
 
 static void tio_conveyor_set(nasid_t nasid, int enable_flag)
 {
-       uint64_t ice_frz;
-       uint64_t disable_cb = (1ull << 61);
+       u64 ice_frz;
+       u64 disable_cb = (1ull << 61);
 
        if (!(nasid & 1))
                return;
@@ -366,31 +367,32 @@ static void tio_corelet_reset(nasid_t nasid, int corelet)
        udelay(2000);
 }
 
-static int tiocx_btchar_get(int nasid)
+static int is_fpga_tio(int nasid, int *bt)
 {
-       moduleid_t module_id;
-       geoid_t geoid;
-       int cnodeid;
-
-       cnodeid = nasid_to_cnodeid(nasid);
-       geoid = cnodeid_get_geoid(cnodeid);
-       module_id = geo_module(geoid);
-       return MODULE_GET_BTCHAR(module_id);
-}
+       u16 ioboard_type;
+       s64 rc;
 
-static int is_fpga_brick(int nasid)
-{
-       switch (tiocx_btchar_get(nasid)) {
+       rc = ia64_sn_sysctl_ioboard_get(nasid, &ioboard_type);
+       if (rc) {
+               printk(KERN_WARNING "ia64_sn_sysctl_ioboard_get failed: %ld\n",
+                      rc);
+               return 0;
+       }
+
+       switch (ioboard_type) {
        case L1_BRICKTYPE_SA:
        case L1_BRICKTYPE_ATHENA:
+       case L1_BOARDTYPE_DAYTONA:
+               *bt = ioboard_type;
                return 1;
        }
+
        return 0;
 }
 
 static int bitstream_loaded(nasid_t nasid)
 {
-       uint64_t cx_credits;
+       u64 cx_credits;
 
        cx_credits = REMOTE_HUB_L(nasid, TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3);
        cx_credits &= TIO_ICE_PMI_TX_DYN_CREDIT_STAT_CB3_CREDIT_CNT_MASK;
@@ -406,17 +408,23 @@ static int tiocx_reload(struct cx_dev *cx_dev)
        nasid_t nasid = cx_dev->cx_id.nasid;
 
        if (bitstream_loaded(nasid)) {
-               uint64_t cx_id;
-
-               cx_id =
-                   *(volatile int32_t *)(TIO_SWIN_BASE(nasid, TIOCX_CORELET) +
+               u64 cx_id;
+               int rv;
+
+               rv = ia64_sn_sysctl_tio_clock_reset(nasid);
+               if (rv) {
+                       printk(KERN_ALERT "CX port JTAG reset failed.\n");
+               } else {
+                       cx_id = *(volatile u64 *)
+                               (TIO_SWIN_BASE(nasid, TIOCX_CORELET) +
                                          WIDGET_ID);
-               part_num = XWIDGET_PART_NUM(cx_id);
-               mfg_num = XWIDGET_MFG_NUM(cx_id);
-               DBG("part= 0x%x, mfg= 0x%x\n", part_num, mfg_num);
-               /* just ignore it if it's a CE */
-               if (part_num == TIO_CE_ASIC_PARTNUM)
-                       return 0;
+                       part_num = XWIDGET_PART_NUM(cx_id);
+                       mfg_num = XWIDGET_MFG_NUM(cx_id);
+                       DBG("part= 0x%x, mfg= 0x%x\n", part_num, mfg_num);
+                       /* just ignore it if it's a CE */
+                       if (part_num == TIO_CE_ASIC_PARTNUM)
+                               return 0;
+               }
        }
 
        cx_dev->cx_id.part_num = part_num;
@@ -432,17 +440,17 @@ static int tiocx_reload(struct cx_dev *cx_dev)
        return cx_device_reload(cx_dev);
 }
 
-static ssize_t show_cxdev_control(struct device *dev, char *buf)
+static ssize_t show_cxdev_control(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct cx_dev *cx_dev = to_cx_dev(dev);
 
-       return sprintf(buf, "0x%x 0x%x 0x%x %d\n",
+       return sprintf(buf, "0x%x 0x%x 0x%x 0x%x\n",
                       cx_dev->cx_id.nasid,
                       cx_dev->cx_id.part_num, cx_dev->cx_id.mfg_num,
-                      tiocx_btchar_get(cx_dev->cx_id.nasid));
+                      cx_dev->bt);
 }
 
-static ssize_t store_cxdev_control(struct device *dev, const char *buf,
+static ssize_t store_cxdev_control(struct device *dev, struct device_attribute *attr, const char *buf,
                                   size_t count)
 {
        int n;
@@ -458,6 +466,10 @@ static ssize_t store_cxdev_control(struct device *dev, const char *buf,
 
        switch (n) {
        case 1:
+               tio_corelet_reset(cx_dev->cx_id.nasid, TIOCX_CORELET);
+               tiocx_reload(cx_dev);
+               break;
+       case 2:
                tiocx_reload(cx_dev);
                break;
        case 3:
@@ -477,15 +489,18 @@ static int __init tiocx_init(void)
        cnodeid_t cnodeid;
        int found_tiocx_device = 0;
 
+       if (!ia64_platform_is("sn2"))
+               return 0;
+
        bus_register(&tiocx_bus_type);
 
-       for (cnodeid = 0; cnodeid < MAX_COMPACT_NODES; cnodeid++) {
+       for (cnodeid = 0; cnodeid < num_cnodes; cnodeid++) {
                nasid_t nasid;
+               int bt;
 
-               if ((nasid = cnodeid_to_nasid(cnodeid)) < 0)
-                       break;  /* No more nasids .. bail out of loop */
+               nasid = cnodeid_to_nasid(cnodeid);
 
-               if ((nasid & 0x1) && is_fpga_brick(nasid)) {
+               if ((nasid & 0x1) && is_fpga_tio(nasid, &bt)) {
                        struct hubdev_info *hubdev;
                        struct xwidget_info *widgetp;
 
@@ -505,7 +520,7 @@ static int __init tiocx_init(void)
 
                        if (cx_device_register
                            (nasid, widgetp->xwi_hwid.part_num,
-                            widgetp->xwi_hwid.mfg_num, hubdev) < 0)
+                            widgetp->xwi_hwid.mfg_num, hubdev, bt) < 0)
                                return -ENXIO;
                        else
                                found_tiocx_device++;
@@ -518,29 +533,26 @@ static int __init tiocx_init(void)
        return 0;
 }
 
-static void __exit tiocx_exit(void)
+static int cx_remove_device(struct device * dev, void * data)
 {
-       struct device *dev;
-       struct device *tdev;
+       struct cx_dev *cx_dev = to_cx_dev(dev);
+       device_remove_file(dev, &dev_attr_cxdev_control);
+       cx_device_unregister(cx_dev);
+       return 0;
+}
 
+static void __exit tiocx_exit(void)
+{
        DBG("tiocx_exit\n");
 
        /*
         * Unregister devices.
         */
-       list_for_each_entry_safe(dev, tdev, &tiocx_bus_type.devices.list,
-                                bus_list) {
-               if (dev) {
-                       struct cx_dev *cx_dev = to_cx_dev(dev);
-                       device_remove_file(dev, &dev_attr_cxdev_control);
-                       cx_device_unregister(cx_dev);
-               }
-       }
-
+       bus_for_each_dev(&tiocx_bus_type, NULL, NULL, cx_remove_device);
        bus_unregister(&tiocx_bus_type);
 }
 
-module_init(tiocx_init);
+subsys_initcall(tiocx_init);
 module_exit(tiocx_exit);
 
 /************************************************************************
index 0e47bce..1f0253b 100644 (file)
@@ -3,31 +3,29 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 2001-2004 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 2001-2006 Silicon Graphics, Inc. All rights reserved.
  */
 
 #include <linux/types.h>
 #include <asm/sn/sn_sal.h>
+#include <asm/sn/pcibr_provider.h>
 #include <asm/sn/pcibus_provider_defs.h>
 #include <asm/sn/pcidev.h>
-#include "pci/pcibr_provider.h"
 
-int pcibr_invalidate_ate = 0;  /* by default don't invalidate ATE on free */
+int pcibr_invalidate_ate;      /* by default don't invalidate ATE on free */
 
 /*
  * mark_ate: Mark the ate as either free or inuse.
  */
 static void mark_ate(struct ate_resource *ate_resource, int start, int number,
-                    uint64_t value)
+                    u64 value)
 {
-
-       uint64_t *ate = ate_resource->ate;
+       u64 *ate = ate_resource->ate;
        int index;
        int length = 0;
 
        for (index = start; length < number; index++, length++)
                ate[index] = value;
-
 }
 
 /*
@@ -37,8 +35,7 @@ static void mark_ate(struct ate_resource *ate_resource, int start, int number,
 static int find_free_ate(struct ate_resource *ate_resource, int start,
                         int count)
 {
-
-       uint64_t *ate = ate_resource->ate;
+       u64 *ate = ate_resource->ate;
        int index;
        int start_free;
 
@@ -70,12 +67,10 @@ static int find_free_ate(struct ate_resource *ate_resource, int start,
 static inline void free_ate_resource(struct ate_resource *ate_resource,
                                     int start)
 {
-
        mark_ate(ate_resource, start, ate_resource->ate[start], 0);
        if ((ate_resource->lowest_free_index > start) ||
            (ate_resource->lowest_free_index < 0))
                ate_resource->lowest_free_index = start;
-
 }
 
 /*
@@ -84,7 +79,6 @@ static inline void free_ate_resource(struct ate_resource *ate_resource,
 static inline int alloc_ate_resource(struct ate_resource *ate_resource,
                                     int ate_needed)
 {
-
        int start_index;
 
        /*
@@ -118,19 +112,12 @@ static inline int alloc_ate_resource(struct ate_resource *ate_resource,
  */
 int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
 {
-       int status = 0;
-       uint64_t flag;
+       int status;
+       unsigned long flags;
 
-       flag = pcibr_lock(pcibus_info);
+       spin_lock_irqsave(&pcibus_info->pbi_lock, flags);
        status = alloc_ate_resource(&pcibus_info->pbi_int_ate_resource, count);
-
-       if (status < 0) {
-               /* Failed to allocate */
-               pcibr_unlock(pcibus_info, flag);
-               return -1;
-       }
-
-       pcibr_unlock(pcibus_info, flag);
+       spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags);
 
        return status;
 }
@@ -139,7 +126,7 @@ int pcibr_ate_alloc(struct pcibus_info *pcibus_info, int count)
  * Setup an Address Translation Entry as specified.  Use either the Bridge
  * internal maps or the external map RAM, as appropriate.
  */
-static inline uint64_t *pcibr_ate_addr(struct pcibus_info *pcibus_info,
+static inline u64 *pcibr_ate_addr(struct pcibus_info *pcibus_info,
                                       int ate_index)
 {
        if (ate_index < pcibus_info->pbi_int_ate_size) {
@@ -153,7 +140,7 @@ static inline uint64_t *pcibr_ate_addr(struct pcibus_info *pcibus_info,
  */
 void inline
 ate_write(struct pcibus_info *pcibus_info, int ate_index, int count,
-         volatile uint64_t ate)
+         volatile u64 ate)
 {
        while (count-- > 0) {
                if (ate_index < pcibus_info->pbi_int_ate_size) {
@@ -171,9 +158,9 @@ ate_write(struct pcibus_info *pcibus_info, int ate_index, int count,
 void pcibr_ate_free(struct pcibus_info *pcibus_info, int index)
 {
 
-       volatile uint64_t ate;
+       volatile u64 ate;
        int count;
-       uint64_t flags;
+       u64 flags;
 
        if (pcibr_invalidate_ate) {
                /* For debugging purposes, clear the valid bit in the ATE */
@@ -182,7 +169,7 @@ void pcibr_ate_free(struct pcibus_info *pcibus_info, int index)
                ate_write(pcibus_info, index, count, (ate & ~PCI32_ATE_V));
        }
 
-       flags = pcibr_lock(pcibus_info);
+       spin_lock_irqsave(&pcibus_info->pbi_lock, flags);
        free_ate_resource(&pcibus_info->pbi_int_ate_resource, index);
-       pcibr_unlock(pcibus_info, flags);
+       spin_unlock_irqrestore(&pcibus_info->pbi_lock, flags);
 }
index 0b28604..93de465 100644 (file)
@@ -546,6 +546,7 @@ struct xen_ia64_privcmd_range {
 };
 
 struct xen_ia64_privcmd_vma {
+       int                             is_privcmd_mmapped;
        struct xen_ia64_privcmd_range*  range;
 
        unsigned long                   num_entries;
@@ -684,12 +685,15 @@ __xen_ia64_privcmd_vma_open(struct vm_area_struct* vma,
 static void
 xen_ia64_privcmd_vma_open(struct vm_area_struct* vma)
 {
+       struct xen_ia64_privcmd_vma* old_privcmd_vma = (struct xen_ia64_privcmd_vma*)vma->vm_private_data;
        struct xen_ia64_privcmd_vma* privcmd_vma = (struct xen_ia64_privcmd_vma*)vma->vm_private_data;
        struct xen_ia64_privcmd_range* privcmd_range = privcmd_vma->range;
 
        atomic_inc(&privcmd_range->ref_count);
        // vm_op->open() can't fail.
        privcmd_vma = kmalloc(sizeof(*privcmd_vma), GFP_KERNEL | __GFP_NOFAIL);
+       // copy original value if necessary
+       privcmd_vma->is_privcmd_mmapped = old_privcmd_vma->is_privcmd_mmapped;
 
        __xen_ia64_privcmd_vma_open(vma, privcmd_vma, privcmd_range);
 }
@@ -724,6 +728,14 @@ xen_ia64_privcmd_vma_close(struct vm_area_struct* vma)
        }
 }
 
+int
+privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma)
+{
+       struct xen_ia64_privcmd_vma* privcmd_vma =
+               (struct xen_ia64_privcmd_vma *)vma->vm_private_data;
+       return (xchg(&privcmd_vma->is_privcmd_mmapped, 1) == 0);
+}
+
 int
 privcmd_mmap(struct file * file, struct vm_area_struct * vma)
 {
@@ -749,6 +761,8 @@ privcmd_mmap(struct file * file, struct vm_area_struct * vma)
        if (privcmd_vma == NULL) {
                goto out_enomem1;
        }
+       privcmd_vma->is_privcmd_mmapped = 0;
+
        res = kzalloc(sizeof(*res), GFP_KERNEL);
        if (res == NULL) {
                goto out_enomem1;
diff --git a/arch/m68k/CVS/Entries b/arch/m68k/CVS/Entries
deleted file mode 100644 (file)
index 66fdb7f..0000000
+++ /dev/null
@@ -1,21 +0,0 @@
-/Kconfig/1.3/Thu Jun  3 22:32:16 2004/-ko/
-/Makefile/1.3/Tue Jul 20 15:33:06 2004/-ko/
-/defconfig/1.2/Wed Jun  2 20:35:03 2004/-ko/
-D/amiga////
-D/apollo////
-D/atari////
-D/bvme6000////
-D/fpsp040////
-D/hp300////
-D/ifpsp060////
-D/kernel////
-D/lib////
-D/mac////
-D/math-emu////
-D/mm////
-D/mvme147////
-D/mvme16x////
-D/q40////
-D/sun3////
-D/sun3x////
-D/tools////
diff --git a/arch/m68k/CVS/Repository b/arch/m68k/CVS/Repository
deleted file mode 100644 (file)
index 35ba7a4..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k
diff --git a/arch/m68k/CVS/Root b/arch/m68k/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/m68k/amiga/CVS/Entries b/arch/m68k/amiga/CVS/Entries
deleted file mode 100644 (file)
index 5e32a5b..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/amiga_ksyms.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/amiints.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/amisound.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/chipram.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/cia.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/config.c/1.2/Wed Jun  2 20:35:03 2004/-ko/
-/pcmcia.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/m68k/amiga/CVS/Repository b/arch/m68k/amiga/CVS/Repository
deleted file mode 100644 (file)
index b29790a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k/amiga
diff --git a/arch/m68k/amiga/CVS/Root b/arch/m68k/amiga/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/m68k/apollo/CVS/Entries b/arch/m68k/apollo/CVS/Entries
deleted file mode 100644 (file)
index 92c52d1..0000000
+++ /dev/null
@@ -1,6 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/config.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/dma.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/dn_debug.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/dn_ints.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-D
diff --git a/arch/m68k/apollo/CVS/Repository b/arch/m68k/apollo/CVS/Repository
deleted file mode 100644 (file)
index 3325aaf..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k/apollo
diff --git a/arch/m68k/apollo/CVS/Root b/arch/m68k/apollo/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/m68k/atari/CVS/Entries b/arch/m68k/atari/CVS/Entries
deleted file mode 100644 (file)
index fb4d0d0..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ataints.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/atari_ksyms.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/atasound.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/atasound.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/config.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/debug.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/hades-pci.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/stdma.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/stram.c/1.4/Tue Jul 20 15:33:06 2004/-ko/
-/time.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-D
diff --git a/arch/m68k/atari/CVS/Repository b/arch/m68k/atari/CVS/Repository
deleted file mode 100644 (file)
index 5402051..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k/atari
diff --git a/arch/m68k/atari/CVS/Root b/arch/m68k/atari/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/m68k/bvme6000/CVS/Entries b/arch/m68k/bvme6000/CVS/Entries
deleted file mode 100644 (file)
index 553b199..0000000
+++ /dev/null
@@ -1,5 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/bvmeints.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/config.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/rtc.c/1.2/Wed Jun  2 20:35:04 2004/-ko/
-D
diff --git a/arch/m68k/bvme6000/CVS/Repository b/arch/m68k/bvme6000/CVS/Repository
deleted file mode 100644 (file)
index 4c5c195..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k/bvme6000
diff --git a/arch/m68k/bvme6000/CVS/Root b/arch/m68k/bvme6000/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/m68k/fpsp040/CVS/Entries b/arch/m68k/fpsp040/CVS/Entries
deleted file mode 100644 (file)
index 60e6ed3..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/README/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/bindec.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/binstr.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/bugfix.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/decbin.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/do_func.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/fpsp.h/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/gen_except.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/get_op.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/kernel_ex.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/res_func.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/round.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/sacos.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/sasin.S/1.2/Wed Jun  2 20:35:04 2004/-ko/
-/satan.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/satanh.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/scale.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/scosh.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/setox.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/sgetem.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/sint.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/skeleton.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/slog2.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/slogn.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/smovecr.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/srem_mod.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/ssin.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/ssinh.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/stan.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/stanh.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/sto_res.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/stwotox.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/tbldo.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/util.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_bsun.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_fline.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_operr.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_ovfl.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_snan.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_store.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_unfl.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_unimp.S/1.2/Wed Jun  2 20:35:05 2004/-ko/
-/x_unsupp.S/1.2/Wed Jun  2 20:35:06 2004/-ko/
-D
diff --git a/arch/m68k/fpsp040/CVS/Repository b/arch/m68k/fpsp040/CVS/Repository
deleted file mode 100644 (file)
index 6913cbb..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k/fpsp040
diff --git a/arch/m68k/fpsp040/CVS/Root b/arch/m68k/fpsp040/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/m68k/hp300/CVS/Entries b/arch/m68k/hp300/CVS/Entries
deleted file mode 100644 (file)
index 1c05b32..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/Makefile/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/README.hp300/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/config.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/hp300map.map/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/ints.c/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/ints.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/ksyms.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/reboot.S/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/time.c/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-/time.h/1.1.1.1/Wed Jun  2 19:22:51 2004/-ko/
-D
diff --git a/arch/m68k/hp300/CVS/Repository b/arch/m68k/hp300/CVS/Repository
deleted file mode 100644 (file)
index c3e0c6d..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k/hp300
diff --git a/arch/m68k/hp300/CVS/Root b/arch/m68k/hp300/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
diff --git a/arch/m68k/ifpsp060/CVS/Entries b/arch/m68k/ifpsp060/CVS/Entries
deleted file mode 100644 (file)
index ccc2393..0000000
+++ /dev/null
@@ -1,20 +0,0 @@
-/CHANGES/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/MISC/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/Makefile/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/README/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/TEST.DOC/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/fplsp.doc/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/fplsp.sa/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fpsp.doc/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/fpsp.sa/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/fskeleton.S/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/ftest.sa/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/ilsp.doc/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/ilsp.sa/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/iskeleton.S/1.3/Tue Jul 20 15:33:06 2004/-ko/
-/isp.doc/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/isp.sa/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/itest.sa/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-/os.S/1.2/Wed Jun  2 20:35:06 2004/-ko/
-/pfpsp.sa/1.1.1.1/Wed Jun  2 19:22:50 2004/-ko/
-D/src////
diff --git a/arch/m68k/ifpsp060/CVS/Repository b/arch/m68k/ifpsp060/CVS/Repository
deleted file mode 100644 (file)
index 5cba135..0000000
+++ /dev/null
@@ -1 +0,0 @@
-linux-2.6/arch/m68k/ifpsp060
diff --git a/arch/m68k/ifpsp060/CVS/Root b/arch/m68k/ifpsp060/CVS/Root
deleted file mode 100644 (file)
index b47fb2a..0000000
+++ /dev/null
@@ -1 +0,0 @@
-/home/mef/projects/cvs
index f5521df..d8df5fd 100644 (file)
@@ -37,7 +37,8 @@ struct cpu_spec       cpu_specs[] = {
     { 0xffffffff, 0x02030203, "Au1100 BD", 0, 1 },
     { 0xffffffff, 0x02030204, "Au1100 BE", 0, 1 },
     { 0xffffffff, 0x03030200, "Au1550 AA", 0, 1 },
-    { 0xffffffff, 0x04030200, "Au1200 AA", 0, 1 },
+    { 0xffffffff, 0x04030200, "Au1200 AB", 0, 0 },
+    { 0xffffffff, 0x04030201, "Au1200 AC", 1, 0 },
     { 0x00000000, 0x00000000, "Unknown Au1xxx", 1, 0 },
 };
 
index 458af3c..d7bf021 100644 (file)
@@ -1,9 +1,351 @@
+/*
+ *  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
+ *
+ *  Copyright (C) 2001 Rusty Russell.
+ *  Copyright (C) 2003, 2004 Ralf Baechle (ralf@linux-mips.org)
+ *  Copyright (C) 2005 Thiemo Seufer
+ */
+
+#undef DEBUG
+
+#include <linux/moduleloader.h>
+#include <linux/elf.h>
+#include <linux/vmalloc.h>
+#include <linux/slab.h>
+#include <linux/fs.h>
+#include <linux/string.h>
+#include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/spinlock.h>
 
+struct mips_hi16 {
+       struct mips_hi16 *next;
+       Elf_Addr *addr;
+       Elf_Addr value;
+};
+
+static struct mips_hi16 *mips_hi16_list;
+
 static LIST_HEAD(dbe_list);
 static DEFINE_SPINLOCK(dbe_lock);
 
+void *module_alloc(unsigned long size)
+{
+       if (size == 0)
+               return NULL;
+       return vmalloc(size);
+}
+
+/* Free memory returned from module_alloc */
+void module_free(struct module *mod, void *module_region)
+{
+       vfree(module_region);
+       /* FIXME: If module_region == mod->init_region, trim exception
+           table entries. */
+}
+
+int module_frob_arch_sections(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
+                             char *secstrings, struct module *mod)
+{
+       return 0;
+}
+
+static int apply_r_mips_none(struct module *me, u32 *location, Elf_Addr v)
+{
+       return 0;
+}
+
+static int apply_r_mips_32_rel(struct module *me, u32 *location, Elf_Addr v)
+{
+       *location += v;
+
+       return 0;
+}
+
+static int apply_r_mips_32_rela(struct module *me, u32 *location, Elf_Addr v)
+{
+       *location = v;
+
+       return 0;
+}
+
+static int apply_r_mips_26_rel(struct module *me, u32 *location, Elf_Addr v)
+{
+       if (v % 4) {
+               printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
+               return -ENOEXEC;
+       }
+
+       if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
+               printk(KERN_ERR
+                      "module %s: relocation overflow\n",
+                      me->name);
+               return -ENOEXEC;
+       }
+
+       *location = (*location & ~0x03ffffff) |
+                   ((*location + (v >> 2)) & 0x03ffffff);
+
+       return 0;
+}
+
+static int apply_r_mips_26_rela(struct module *me, u32 *location, Elf_Addr v)
+{
+       if (v % 4) {
+               printk(KERN_ERR "module %s: dangerous relocation\n", me->name);
+               return -ENOEXEC;
+       }
+
+       if ((v & 0xf0000000) != (((unsigned long)location + 4) & 0xf0000000)) {
+               printk(KERN_ERR
+                      "module %s: relocation overflow\n",
+                      me->name);
+               return -ENOEXEC;
+       }
+
+       *location = (*location & ~0x03ffffff) | ((v >> 2) & 0x03ffffff);
+
+       return 0;
+}
+
+static int apply_r_mips_hi16_rel(struct module *me, u32 *location, Elf_Addr v)
+{
+       struct mips_hi16 *n;
+
+       /*
+        * We cannot relocate this one now because we don't know the value of
+        * the carry we need to add.  Save the information, and let LO16 do the
+        * actual relocation.
+        */
+       n = kmalloc(sizeof *n, GFP_KERNEL);
+       if (!n)
+               return -ENOMEM;
+
+       n->addr = (Elf_Addr *)location;
+       n->value = v;
+       n->next = mips_hi16_list;
+       mips_hi16_list = n;
+
+       return 0;
+}
+
+static int apply_r_mips_hi16_rela(struct module *me, u32 *location, Elf_Addr v)
+{
+       *location = (*location & 0xffff0000) |
+                   ((((long long) v + 0x8000LL) >> 16) & 0xffff);
+
+       return 0;
+}
+
+static int apply_r_mips_lo16_rel(struct module *me, u32 *location, Elf_Addr v)
+{
+       unsigned long insnlo = *location;
+       Elf_Addr val, vallo;
+
+       /* Sign extend the addend we extract from the lo insn.  */
+       vallo = ((insnlo & 0xffff) ^ 0x8000) - 0x8000;
+
+       if (mips_hi16_list != NULL) {
+               struct mips_hi16 *l;
+
+               l = mips_hi16_list;
+               while (l != NULL) {
+                       struct mips_hi16 *next;
+                       unsigned long insn;
+
+                       /*
+                        * The value for the HI16 had best be the same.
+                        */
+                       if (v != l->value)
+                               goto out_danger;
+
+                       /*
+                        * Do the HI16 relocation.  Note that we actually don't
+                        * need to know anything about the LO16 itself, except
+                        * where to find the low 16 bits of the addend needed
+                        * by the LO16.
+                        */
+                       insn = *l->addr;
+                       val = ((insn & 0xffff) << 16) + vallo;
+                       val += v;
+
+                       /*
+                        * Account for the sign extension that will happen in
+                        * the low bits.
+                        */
+                       val = ((val >> 16) + ((val & 0x8000) != 0)) & 0xffff;
+
+                       insn = (insn & ~0xffff) | val;
+                       *l->addr = insn;
+
+                       next = l->next;
+                       kfree(l);
+                       l = next;
+               }
+
+               mips_hi16_list = NULL;
+       }
+
+       /*
+        * Ok, we're done with the HI16 relocs.  Now deal with the LO16.
+        */
+       val = v + vallo;
+       insnlo = (insnlo & ~0xffff) | (val & 0xffff);
+       *location = insnlo;
+
+       return 0;
+
+out_danger:
+       printk(KERN_ERR "module %s: dangerous " "relocation\n", me->name);
+
+       return -ENOEXEC;
+}
+
+static int apply_r_mips_lo16_rela(struct module *me, u32 *location, Elf_Addr v)
+{
+       *location = (*location & 0xffff0000) | (v & 0xffff);
+
+       return 0;
+}
+
+static int apply_r_mips_64_rela(struct module *me, u32 *location, Elf_Addr v)
+{
+       *(Elf_Addr *)location = v;
+
+       return 0;
+}
+
+static int apply_r_mips_higher_rela(struct module *me, u32 *location,
+                                   Elf_Addr v)
+{
+       *location = (*location & 0xffff0000) |
+                   ((((long long) v + 0x80008000LL) >> 32) & 0xffff);
+
+       return 0;
+}
+
+static int apply_r_mips_highest_rela(struct module *me, u32 *location,
+                                    Elf_Addr v)
+{
+       *location = (*location & 0xffff0000) |
+                   ((((long long) v + 0x800080008000LL) >> 48) & 0xffff);
+
+       return 0;
+}
+
+static int (*reloc_handlers_rel[]) (struct module *me, u32 *location,
+                               Elf_Addr v) = {
+       [R_MIPS_NONE]           = apply_r_mips_none,
+       [R_MIPS_32]             = apply_r_mips_32_rel,
+       [R_MIPS_26]             = apply_r_mips_26_rel,
+       [R_MIPS_HI16]           = apply_r_mips_hi16_rel,
+       [R_MIPS_LO16]           = apply_r_mips_lo16_rel
+};
+
+static int (*reloc_handlers_rela[]) (struct module *me, u32 *location,
+                               Elf_Addr v) = {
+       [R_MIPS_NONE]           = apply_r_mips_none,
+       [R_MIPS_32]             = apply_r_mips_32_rela,
+       [R_MIPS_26]             = apply_r_mips_26_rela,
+       [R_MIPS_HI16]           = apply_r_mips_hi16_rela,
+       [R_MIPS_LO16]           = apply_r_mips_lo16_rela,
+       [R_MIPS_64]             = apply_r_mips_64_rela,
+       [R_MIPS_HIGHER]         = apply_r_mips_higher_rela,
+       [R_MIPS_HIGHEST]        = apply_r_mips_highest_rela
+};
+
+int apply_relocate(Elf_Shdr *sechdrs, const char *strtab,
+                  unsigned int symindex, unsigned int relsec,
+                  struct module *me)
+{
+       Elf_Mips_Rel *rel = (void *) sechdrs[relsec].sh_addr;
+       Elf_Sym *sym;
+       u32 *location;
+       unsigned int i;
+       Elf_Addr v;
+       int res;
+
+       pr_debug("Applying relocate section %u to %u\n", relsec,
+              sechdrs[relsec].sh_info);
+
+       for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
+               /* This is where to make the change */
+               location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+                       + rel[i].r_offset;
+               /* This is the symbol it is referring to */
+               sym = (Elf_Sym *)sechdrs[symindex].sh_addr
+                       + ELF_MIPS_R_SYM(rel[i]);
+               if (!sym->st_value) {
+                       /* Ignore unresolved weak symbol */
+                       if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
+                               continue;
+                       printk(KERN_WARNING "%s: Unknown symbol %s\n",
+                              me->name, strtab + sym->st_name);
+                       return -ENOENT;
+               }
+
+               v = sym->st_value;
+
+               res = reloc_handlers_rel[ELF_MIPS_R_TYPE(rel[i])](me, location, v);
+               if (res)
+                       return res;
+       }
+
+       return 0;
+}
+
+int apply_relocate_add(Elf_Shdr *sechdrs, const char *strtab,
+                      unsigned int symindex, unsigned int relsec,
+                      struct module *me)
+{
+       Elf_Mips_Rela *rel = (void *) sechdrs[relsec].sh_addr;
+       Elf_Sym *sym;
+       u32 *location;
+       unsigned int i;
+       Elf_Addr v;
+       int res;
+
+       pr_debug("Applying relocate section %u to %u\n", relsec,
+              sechdrs[relsec].sh_info);
+
+       for (i = 0; i < sechdrs[relsec].sh_size / sizeof(*rel); i++) {
+               /* This is where to make the change */
+               location = (void *)sechdrs[sechdrs[relsec].sh_info].sh_addr
+                       + rel[i].r_offset;
+               /* This is the symbol it is referring to */
+               sym = (Elf_Sym *)sechdrs[symindex].sh_addr
+                       + ELF_MIPS_R_SYM(rel[i]);
+               if (!sym->st_value) {
+                       /* Ignore unresolved weak symbol */
+                       if (ELF_ST_BIND(sym->st_info) == STB_WEAK)
+                               continue;
+                       printk(KERN_WARNING "%s: Unknown symbol %s\n",
+                              me->name, strtab + sym->st_name);
+                       return -ENOENT;
+               }
+
+               v = sym->st_value + rel[i].r_addend;
+
+               res = reloc_handlers_rela[ELF_MIPS_R_TYPE(rel[i])](me, location, v);
+               if (res)
+                       return res;
+       }
+
+       return 0;
+}
+
 /* Given an address, look for it in the module exception tables. */
 const struct exception_table_entry *search_module_dbetables(unsigned long addr)
 {
index 2cbe196..ec54ed0 100644 (file)
@@ -37,7 +37,7 @@
 #define RAM_OFFSET_MASK        0x3fffffff
 
 void *dma_alloc_noncoherent(struct device *dev, size_t size,
-       dma_addr_t * dma_handle, int gfp)
+       dma_addr_t * dma_handle, gfp_t gfp)
 {
        void *ret;
        /* ignore region specifiers */
@@ -61,7 +61,7 @@ void *dma_alloc_noncoherent(struct device *dev, size_t size,
 EXPORT_SYMBOL(dma_alloc_noncoherent);
 
 void *dma_alloc_coherent(struct device *dev, size_t size,
-       dma_addr_t * dma_handle, int gfp)
+       dma_addr_t * dma_handle, gfp_t gfp)
 {
        void *ret;
 
@@ -138,7 +138,7 @@ dma_addr_t dma_map_single(struct device *dev, void *ptr, size_t size,
                BUG();
        }
 
-       addr = virt_to_phys(ptr)&RAM_OFFSET_MASK;;
+       addr = virt_to_phys(ptr)&RAM_OFFSET_MASK;
        if(dev == NULL)
            addr+=CRIME_HI_MEM_BASE;
        return (dma_addr_t)addr;
@@ -179,7 +179,7 @@ int dma_map_sg(struct device *dev, struct scatterlist *sg, int nents,
                addr = (unsigned long) page_address(sg->page)+sg->offset;
                if (addr)
                        __dma_sync(addr, sg->length, direction);
-               addr = __pa(addr)&RAM_OFFSET_MASK;;
+               addr = __pa(addr)&RAM_OFFSET_MASK;
                if(dev == NULL)
                        addr +=  CRIME_HI_MEM_BASE;
                sg->dma_address = (dma_addr_t)addr;
@@ -199,7 +199,7 @@ dma_addr_t dma_map_page(struct device *dev, struct page *page,
 
        addr = (unsigned long) page_address(page) + offset;
        dma_cache_wback_inv(addr, size);
-       addr = __pa(addr)&RAM_OFFSET_MASK;;
+       addr = __pa(addr)&RAM_OFFSET_MASK;
        if(dev == NULL)
                addr +=  CRIME_HI_MEM_BASE;
 
index 354261d..0a50aad 100644 (file)
@@ -12,4 +12,5 @@ oprofile-y                            := $(DRIVER_OBJS) common.o
 
 oprofile-$(CONFIG_CPU_MIPS32)          += op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_MIPS64)          += op_model_mipsxx.o
+oprofile-$(CONFIG_CPU_SB1)             += op_model_mipsxx.o
 oprofile-$(CONFIG_CPU_RM9000)          += op_model_rm9000.o
index 9f5cdff..5cfce7d 100644 (file)
 #ifndef OP_IMPL_H
 #define OP_IMPL_H 1
 
+struct pt_regs;
+
+extern int null_perf_irq(struct pt_regs *regs);
+extern int (*perf_irq)(struct pt_regs *regs);
+
 /* Per-counter configuration as set via oprofilefs.  */
 struct op_counter_config {
        unsigned long enabled;
index bee4779..b7063fe 100644 (file)
@@ -5,6 +5,7 @@
  *
  * Copyright (C) 2004 by Ralf Baechle
  */
+#include <linux/init.h>
 #include <linux/oprofile.h>
 #include <linux/interrupt.h>
 #include <linux/smp.h>
@@ -114,7 +115,7 @@ static irqreturn_t rm9000_perfcount_handler(int irq, void * dev_id,
        return IRQ_HANDLED;
 }
 
-static int rm9000_init(void)
+static int __init rm9000_init(void)
 {
        return request_irq(rm9000_perfcount_irq, rm9000_perfcount_handler,
                           0, "Perfcounter", NULL);
@@ -125,7 +126,7 @@ static void rm9000_exit(void)
        free_irq(rm9000_perfcount_irq, NULL);
 }
 
-struct op_mips_model op_model_rm9000 = {
+struct op_mips_model op_model_rm9000_ops = {
        .reg_setup      = rm9000_reg_setup,
        .cpu_setup      = rm9000_cpu_setup,
        .init           = rm9000_init,
index 01bec8f..f4a8116 100644 (file)
@@ -263,11 +263,7 @@ static const struct iomap_ops iomem_ops = {
 
 const struct iomap_ops *iomap_ops[8] = {
        [0] = &ioport_ops,
-#ifdef CONFIG_DEBUG_IOREMAP
-       [6] = &iomem_ops,
-#else
        [7] = &iomem_ops
-#endif
 };
 
 
index ef08e86..8a8614d 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/boot/simple/misc-cpci690.c
- *
  * Add birec data for Force CPCI690 board.
  *
  * Author: Mark A. Greer <source@mvista.com>
  */
 
 #include <linux/types.h>
+#include <asm/io.h>
 #include <platforms/cpci690.h>
 
+#define        KB      (1024UL)
+#define        MB      (1024UL*KB)
+#define        GB      (1024UL*MB)
+
 extern u32 mv64x60_console_baud;
 extern u32 mv64x60_mpsc_clk_src;
 extern u32 mv64x60_mpsc_clk_freq;
 
+u32 mag = 0xffff;
+
+unsigned long
+get_mem_size(void)
+{
+       u32     size;
+
+       switch (in_8(((void __iomem *)CPCI690_BR_BASE + CPCI690_BR_MEM_CTLR))
+                       & 0x07) {
+       case 0x01:
+               size = 256*MB;
+               break;
+       case 0x02:
+               size = 512*MB;
+               break;
+       case 0x03:
+               size = 768*MB;
+               break;
+       case 0x04:
+               size = 1*GB;
+               break;
+       case 0x05:
+               size = 1*GB + 512*MB;
+               break;
+       case 0x06:
+               size = 2*GB;
+               break;
+       default:
+               size = 0;
+       }
+
+       return size;
+}
+
 void
 mv64x60_board_init(void __iomem *old_base, void __iomem *new_base)
 {
        mv64x60_console_baud = CPCI690_MPSC_BAUD;
        mv64x60_mpsc_clk_src = CPCI690_MPSC_CLK_SRC;
-       mv64x60_mpsc_clk_freq = CPCI690_BUS_FREQ;
+       mv64x60_mpsc_clk_freq =
+               (get_mem_size() >= (1*GB)) ? 100000000 : 133333333;
 }
index 569e0d4..0f302ea 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/boot/simple/misc-radstone_ppc7d.c
- *
  * Misc data for Radstone PPC7D board.
  *
  * Author: James Chapman <jchapman@katalix.com>
index 42c5de2..31e5118 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/syslib/rheap.c
- *
  * A Remote Heap.  Remote means that we don't touch the memory that the
  * heap points to. Normal heap implementations use the memory they manage
  * to place their list. We cannot do that because the memory we manage may
index a203efb..de8f7ac 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/platforms/4xx/ibm440sp.c
- *
  * PPC440SP I/O descriptions
  *
  * Matt Porter <mporter@kernel.crashing.org>
@@ -31,18 +29,18 @@ static struct ocp_func_emac_data ibm440sp_emac0_def = {
        .wol_irq        = 61,           /* WOL interrupt number */
        .mdio_idx       = -1,           /* No shared MDIO */
        .tah_idx        = -1,           /* No TAH */
-       .jumbo          = 1,            /* Jumbo frames supported */
 };
 OCP_SYSFS_EMAC_DATA()
 
 static struct ocp_func_mal_data ibm440sp_mal0_def = {
-       .num_tx_chans   = 4,            /* Number of TX channels */
-       .num_rx_chans   = 4,            /* Number of RX channels */
+       .num_tx_chans   = 1,            /* Number of TX channels */
+       .num_rx_chans   = 1,            /* Number of RX channels */
        .txeob_irq      = 38,           /* TX End Of Buffer IRQ  */
        .rxeob_irq      = 39,           /* RX End Of Buffer IRQ  */
        .txde_irq       = 34,           /* TX Descriptor Error IRQ */
        .rxde_irq       = 35,           /* RX Descriptor Error IRQ */
        .serr_irq       = 33,           /* MAL System Error IRQ    */
+       .dcr_base       = DCRN_MAL_BASE /* MAL0_CFG DCR number */
 };
 OCP_SYSFS_MAL_DATA()
 
index ff92e38..7ddd331 100644 (file)
@@ -21,6 +21,11 @@ config MPC8540_ADS
        help
          This option enables support for the MPC 8540 ADS evaluation board.
 
+config MPC8548_CDS
+       bool "Freescale MPC8548 CDS"
+       help
+         This option enablese support for the MPC8548 CDS evaluation board.
+
 config MPC8555_CDS
        bool "Freescale MPC8555 CDS"
        help
@@ -34,7 +39,7 @@ config MPC8560_ADS
 config SBC8560
        bool "WindRiver PowerQUICC III SBC8560"
        help
-         This option enables support for the WindRiver PowerQUICC III 
+         This option enables support for the WindRiver PowerQUICC III
          SBC8560 board.
 
 config STX_GP3
@@ -43,6 +48,26 @@ config STX_GP3
          This option enables support for the Silicon Turnkey Express GP3
          board.
 
+config TQM8540
+       bool "TQ Components TQM8540"
+       help
+         This option enablese support for the TQ Components TQM8540 board.
+
+config TQM8541
+       bool "TQ Components TQM8541"
+       help
+         This option enablese support for the TQ Components TQM8541 board.
+
+config TQM8555
+       bool "TQ Components TQM8555"
+       help
+         This option enablese support for the TQ Components TQM8555 board.
+
+config TQM8560
+       bool "TQ Components TQM8560"
+       help
+         This option enablese support for the TQ Components TQM8560 board.
+
 endchoice
 
 # It's often necessary to know the specific 85xx processor type.
@@ -50,17 +75,22 @@ endchoice
 # don't need to ask more redundant questions.
 config MPC8540
        bool
-       depends on MPC8540_ADS
+       depends on MPC8540_ADS || TQM8540
+       default y
+
+config MPC8548
+       bool
+       depends on MPC8548_CDS
        default y
 
 config MPC8555
        bool
-       depends on MPC8555_CDS
+       depends on MPC8555_CDS || TQM8541 || TQM8555
        default y
 
 config MPC8560
        bool
-       depends on SBC8560 || MPC8560_ADS || STX_GP3
+       depends on SBC8560 || MPC8560_ADS || STX_GP3 || TQM8560
        default y
 
 config 85xx_PCI2
index 0400b2b..e00fd9f 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/platforms/chestnut.h
- *
  * Definitions for IBM 750FXGX Eval (Chestnut)
  *
  * Author: <source@mvista.com>
index 36cd267..0fa5a4c 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/platforms/cpci690.h
- *
  * Definitions for Force CPCI690
  *
  * Author: Mark A. Greer <mgreer@mvista.com>
@@ -73,6 +71,4 @@ typedef struct board_info {
 #define        CPCI690_MPSC_BAUD                       9600
 #define        CPCI690_MPSC_CLK_SRC                    8 /* TCLK */
 
-#define        CPCI690_BUS_FREQ                        133333333
-
 #endif /* __PPC_PLATFORMS_CPCI690_H */
index 07c3cff..f9e020b 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/platforms/hdpu.h
- *
  * Definitions for Sky Computers HDPU board.
  *
  * Brian Waite <waite@skycomputers.com>
index b82ed81..0a9b036 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/platforms/katana.h
- *
  * Definitions for Artesyn Katana750i/3750 board.
  *
  * Author: Tim Montgomery <timm@artesyncp.com>
 #define KATANA_PCI1_IO_SIZE                     0x04000000 /* 64 MB */
 
 /* Board-specific IRQ info */
-#define  KATANA_PCI_INTA_IRQ_3750              64+8
-#define  KATANA_PCI_INTB_IRQ_3750              64+9
-#define  KATANA_PCI_INTC_IRQ_3750              64+10
-
-#define  KATANA_PCI_INTA_IRQ_750i              64+8
-#define  KATANA_PCI_INTB_IRQ_750i              64+9
-#define  KATANA_PCI_INTC_IRQ_750i              64+10
-#define  KATANA_PCI_INTD_IRQ_750i              64+14
+#define  KATANA_PCI_INTA_IRQ_3750              (64+8)
+#define  KATANA_PCI_INTB_IRQ_3750              (64+9)
+#define  KATANA_PCI_INTC_IRQ_3750              (64+10)
+
+#define  KATANA_PCI_INTA_IRQ_750i              (64+8)
+#define  KATANA_PCI_INTB_IRQ_750i              (64+9)
+#define  KATANA_PCI_INTC_IRQ_750i              (64+10)
+#define  KATANA_PCI_INTD_IRQ_750i              (64+14)
 
 #define KATANA_CPLD_RST_EVENT                  0x00000000
 #define KATANA_CPLD_RST_CMD                    0x00001000
index c1de2aa..852a18e 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/platforms/lite5200.h
- * 
  * Definitions for Freescale LITE5200 : MPC52xx Standard Development
  * Platform board support
  * 
index 9383755..2bb093a 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/platforms/radstone_ppc7d.h
- *
  * Board definitions for the Radstone PPC7D boards.
  *
  * Author: James Chapman <jchapman@katalix.com>
index a21a990..8077bf8 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/syslib/ibm440sp_common.h
- *
  * PPC440SP system library
  *
  * Matt Porter <mporter@kernel.crashing.org>
index b14eb60..f179db8 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/kernel/ibm44x_common.h
- *
  * PPC44x system library
  *
  * Eugene Surovegin <eugene.surovegin@zultys.com> or <ebs@ebshome.net>
@@ -29,10 +27,15 @@ struct ibm44x_clocks {
        unsigned int ebc;       /* PerClk */
        unsigned int uart0;
        unsigned int uart1;
+#ifdef CONFIG_440EP
+       unsigned int uart2;
+       unsigned int uart3;
+#endif
 };
 
 /* common 44x platform init */
-void ibm44x_platform_init(void) __init;
+void ibm44x_platform_init(unsigned long r3, unsigned long r4, unsigned long r5,
+                         unsigned long r6, unsigned long r7) __init;
 
 /* initialize decrementer and tick-related variables */
 void ibm44x_calibrate_decr(unsigned int freq) __init;
index ad5182e..7487539 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/syslib/mpc52xx_devices.c
- *
  * Freescale MPC52xx device descriptions
  *
  *
@@ -15,6 +13,7 @@
 
 #include <linux/fsl_devices.h>
 #include <linux/resource.h>
+#include <linux/platform_device.h>
 #include <asm/mpc52xx.h>
 #include <asm/ppc_sys.h>
 
index 04b509a..77d47db 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/syslib/mpc52xx_pci.h
- *
  * PCI Include file the Freescale MPC52xx embedded cpu chips
  *
  *
index 9a0f90a..b4e6f97 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/syslib/mpc52xx_sys.c
- *
  * Freescale MPC52xx system descriptions
  *
  *
index 29aa633..0498ae7 100644 (file)
@@ -1,9 +1,7 @@
 /*
- * arch/ppc/platforms/83xx/mpc83xx_sys.c
- *
  * MPC83xx System descriptions
  *
- * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ * Maintainer: Kumar Gala <galak@kernel.crashing.org>
  *
  * Copyright 2005 Freescale Semiconductor Inc.
  *
@@ -24,72 +22,96 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                .ppc_sys_name   = "8349E",
                .mask           = 0xFFFF0000,
                .value          = 0x80500000,
-               .num_devices    = 8,
+               .num_devices    = 9,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
                        MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
-                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
                },
        },
        {
                .ppc_sys_name   = "8349",
                .mask           = 0xFFFF0000,
                .value          = 0x80510000,
-               .num_devices    = 7,
+               .num_devices    = 8,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
                        MPC83xx_IIC2, MPC83xx_DUART,
-                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
                },
        },
        {
                .ppc_sys_name   = "8347E",
                .mask           = 0xFFFF0000,
                .value          = 0x80520000,
-               .num_devices    = 8,
+               .num_devices    = 9,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
                        MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
-                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
                },
        },
        {
                .ppc_sys_name   = "8347",
                .mask           = 0xFFFF0000,
                .value          = 0x80530000,
-               .num_devices    = 7,
+               .num_devices    = 8,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
                        MPC83xx_IIC2, MPC83xx_DUART,
-                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH
+                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
                },
        },
        {
-               .ppc_sys_name   = "8343E",
+               .ppc_sys_name   = "8347E",
                .mask           = 0xFFFF0000,
                .value          = 0x80540000,
-               .num_devices    = 7,
+               .num_devices    = 9,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
                        MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
-                       MPC83xx_USB2_DR,
+                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
                },
        },
        {
-               .ppc_sys_name   = "8343",
+               .ppc_sys_name   = "8347",
                .mask           = 0xFFFF0000,
                .value          = 0x80550000,
-               .num_devices    = 6,
+               .num_devices    = 8,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+                       MPC83xx_IIC2, MPC83xx_DUART,
+                       MPC83xx_USB2_DR, MPC83xx_USB2_MPH, MPC83xx_MDIO
+               },
+       },
+       {
+               .ppc_sys_name   = "8343E",
+               .mask           = 0xFFFF0000,
+               .value          = 0x80560000,
+               .num_devices    = 8,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
+                       MPC83xx_IIC2, MPC83xx_DUART, MPC83xx_SEC2,
+                       MPC83xx_USB2_DR, MPC83xx_MDIO
+               },
+       },
+       {
+               .ppc_sys_name   = "8343",
+               .mask           = 0xFFFF0000,
+               .value          = 0x80570000,
+               .num_devices    = 7,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC83xx_TSEC1, MPC83xx_TSEC2, MPC83xx_IIC1,
                        MPC83xx_IIC2, MPC83xx_DUART,
-                       MPC83xx_USB2_DR,
+                       MPC83xx_USB2_DR, MPC83xx_MDIO
                },
        },
        {       /* default match */
index d806a92..d96a93d 100644 (file)
@@ -1,9 +1,7 @@
 /*
- * arch/ppc/platforms/85xx/mpc85xx_sys.c
- *
  * MPC85xx System descriptions
  *
- * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ * Maintainer: Kumar Gala <galak@kernel.crashing.org>
  *
  * Copyright 2005 Freescale Semiconductor Inc.
  *
@@ -24,19 +22,19 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                .ppc_sys_name   = "8540",
                .mask           = 0xFFFF0000,
                .value          = 0x80300000,
-               .num_devices    = 10,
+               .num_devices    = 11,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_FEC, MPC85xx_IIC1,
                        MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
-                       MPC85xx_PERFMON, MPC85xx_DUART,
+                       MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_MDIO,
                },
        },
        {
                .ppc_sys_name   = "8560",
                .mask           = 0xFFFF0000,
                .value          = 0x80700000,
-               .num_devices    = 19,
+               .num_devices    = 20,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -45,14 +43,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                        MPC85xx_CPM_SPI, MPC85xx_CPM_I2C, MPC85xx_CPM_SCC1,
                        MPC85xx_CPM_SCC2, MPC85xx_CPM_SCC3, MPC85xx_CPM_SCC4,
                        MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2, MPC85xx_CPM_FCC3,
-                       MPC85xx_CPM_MCC1, MPC85xx_CPM_MCC2,
+                       MPC85xx_CPM_MCC1, MPC85xx_CPM_MCC2, MPC85xx_MDIO,
                },
        },
        {
                .ppc_sys_name   = "8541",
                .mask           = 0xFFFF0000,
                .value          = 0x80720000,
-               .num_devices    = 13,
+               .num_devices    = 14,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -60,13 +58,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                        MPC85xx_PERFMON, MPC85xx_DUART,
                        MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
                        MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
+                       MPC85xx_MDIO,
                },
        },
        {
                .ppc_sys_name   = "8541E",
                .mask           = 0xFFFF0000,
                .value          = 0x807A0000,
-               .num_devices    = 14,
+               .num_devices    = 15,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -74,13 +73,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                        MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
                        MPC85xx_CPM_SPI, MPC85xx_CPM_I2C,
                        MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
+                       MPC85xx_MDIO,
                },
        },
        {
                .ppc_sys_name   = "8555",
                .mask           = 0xFFFF0000,
                .value          = 0x80710000,
-               .num_devices    = 19,
+               .num_devices    = 20,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -91,13 +91,14 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                        MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
                        MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
                        MPC85xx_CPM_USB,
+                       MPC85xx_MDIO,
                },
        },
        {
                .ppc_sys_name   = "8555E",
                .mask           = 0xFFFF0000,
                .value          = 0x80790000,
-               .num_devices    = 20,
+               .num_devices    = 21,
                .device_list    = (enum ppc_sys_devices[])
                {
                        MPC85xx_TSEC1, MPC85xx_TSEC2, MPC85xx_IIC1,
@@ -108,6 +109,120 @@ struct ppc_sys_spec ppc_sys_specs[] = {
                        MPC85xx_CPM_FCC1, MPC85xx_CPM_FCC2,
                        MPC85xx_CPM_SMC1, MPC85xx_CPM_SMC2,
                        MPC85xx_CPM_USB,
+                       MPC85xx_MDIO,
+               },
+       },
+       /* SVRs on 8548 rev1.0 matches for 8548/8547/8545 */
+       {
+               .ppc_sys_name   = "8548E",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x80390010,
+               .num_devices    = 14,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
+                       MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+                       MPC85xx_MDIO,
+               },
+       },
+       {
+               .ppc_sys_name   = "8548",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x80310010,
+               .num_devices    = 13,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
+                       MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART,
+                       MPC85xx_MDIO,
+               },
+       },
+       {
+               .ppc_sys_name   = "8547E",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x80390010,
+               .num_devices    = 14,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
+                       MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+                       MPC85xx_MDIO,
+               },
+       },
+       {
+               .ppc_sys_name   = "8547",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x80310010,
+               .num_devices    = 13,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2, MPC85xx_eTSEC3,
+                       MPC85xx_eTSEC4, MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART,
+                       MPC85xx_MDIO,
+               },
+       },
+       {
+               .ppc_sys_name   = "8545E",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x80390010,
+               .num_devices    = 12,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2,
+                       MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+                       MPC85xx_MDIO,
+               },
+       },
+       {
+               .ppc_sys_name   = "8545",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x80310010,
+               .num_devices    = 11,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2,
+                       MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART,
+                       MPC85xx_MDIO,
+               },
+       },
+       {
+               .ppc_sys_name   = "8543E",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x803A0010,
+               .num_devices    = 12,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2,
+                       MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART, MPC85xx_SEC2,
+                       MPC85xx_MDIO,
+               },
+       },
+       {
+               .ppc_sys_name   = "8543",
+               .mask           = 0xFFFF00F0,
+               .value          = 0x80320010,
+               .num_devices    = 11,
+               .device_list    = (enum ppc_sys_devices[])
+               {
+                       MPC85xx_eTSEC1, MPC85xx_eTSEC2,
+                       MPC85xx_IIC1, MPC85xx_IIC2,
+                       MPC85xx_DMA0, MPC85xx_DMA1, MPC85xx_DMA2, MPC85xx_DMA3,
+                       MPC85xx_PERFMON, MPC85xx_DUART,
+                       MPC85xx_MDIO,
                },
        },
        {       /* default match */
index b6f0f5d..4bf1ad1 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * arch/ppc/syslib/mv64x60_win.c
- *
  * Tables with info on how to manipulate the 32 & 64 bit windows on the
  * various types of Marvell bridge chips.
  *
@@ -17,7 +15,6 @@
 #include <linux/slab.h>
 #include <linux/module.h>
 #include <linux/string.h>
-#include <linux/bootmem.h>
 #include <linux/mv643xx.h>
 
 #include <asm/byteorder.h>
index 8792023..2d48018 100644 (file)
@@ -1,11 +1,10 @@
 /*
- * arch/ppc/syslib/ppc_sys.c
- *
  * PPC System library functions
  *
- * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ * Maintainer: Kumar Gala <galak@kernel.crashing.org>
  *
  * Copyright 2005 Freescale Semiconductor Inc.
+ * Copyright 2005 MontaVista, Inc. by Vitaly Bordug <vbordug@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
  * option) any later version.
  */
 
+#include <linux/string.h>
+#include <linux/bootmem.h>
 #include <asm/ppc_sys.h>
 
 int (*ppc_sys_device_fixup) (struct platform_device * pdev);
 
 static int ppc_sys_inited;
+static int ppc_sys_func_inited;
+
+static const char *ppc_sys_func_names[] = {
+       [PPC_SYS_FUNC_DUMMY] = "dummy",
+       [PPC_SYS_FUNC_ETH] = "eth",
+       [PPC_SYS_FUNC_UART] = "uart",
+       [PPC_SYS_FUNC_HLDC] = "hldc",
+       [PPC_SYS_FUNC_USB] = "usb",
+       [PPC_SYS_FUNC_IRDA] = "irda",
+};
 
 void __init identify_ppc_sys_by_id(u32 id)
 {
@@ -35,10 +46,62 @@ void __init identify_ppc_sys_by_id(u32 id)
 
 void __init identify_ppc_sys_by_name(char *name)
 {
-       /* TODO */
+       unsigned int i = 0;
+       while (ppc_sys_specs[i].ppc_sys_name[0]) {
+               if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name))
+                       break;
+               i++;
+       }
+       cur_ppc_sys_spec = &ppc_sys_specs[i];
+
        return;
 }
 
+static int __init count_sys_specs(void)
+{
+       int i = 0;
+       while (ppc_sys_specs[i].ppc_sys_name[0])
+               i++;
+       return i;
+}
+
+static int __init find_chip_by_name_and_id(char *name, u32 id)
+{
+       int ret = -1;
+       unsigned int i = 0;
+       unsigned int j = 0;
+       unsigned int dups = 0;
+
+       unsigned char matched[count_sys_specs()];
+
+       while (ppc_sys_specs[i].ppc_sys_name[0]) {
+               if (!strcmp(ppc_sys_specs[i].ppc_sys_name, name))
+                       matched[j++] = i;
+               i++;
+       }
+
+       ret = i;
+
+       if (j != 0) {
+               for (i = 0; i < j; i++) {
+                       if ((ppc_sys_specs[matched[i]].mask & id) ==
+                           ppc_sys_specs[matched[i]].value) {
+                               ret = matched[i];
+                               dups++;
+                       }
+               }
+               ret = (dups == 1) ? ret : (-1 * dups);
+       }
+       return ret;
+}
+
+void __init identify_ppc_sys_by_name_and_id(char *name, u32 id)
+{
+       int i = find_chip_by_name_and_id(name, id);
+       BUG_ON(i < 0);
+       cur_ppc_sys_spec = &ppc_sys_specs[i];
+}
+
 /* Update all memory resources by paddr, call before platform_device_register */
 void __init
 ppc_sys_fixup_mem_resource(struct platform_device *pdev, phys_addr_t paddr)
@@ -46,9 +109,11 @@ ppc_sys_fixup_mem_resource(struct platform_device *pdev, phys_addr_t paddr)
        int i;
        for (i = 0; i < pdev->num_resources; i++) {
                struct resource *r = &pdev->resource[i];
-               if ((r->flags & IORESOURCE_MEM) == IORESOURCE_MEM) {
+               if (((r->flags & IORESOURCE_MEM) == IORESOURCE_MEM) && 
+                       ((r->flags & PPC_SYS_IORESOURCE_FIXUPPED) != PPC_SYS_IORESOURCE_FIXUPPED)) {
                        r->start += paddr;
                        r->end += paddr;
+                       r->flags |= PPC_SYS_IORESOURCE_FIXUPPED;
                }
        }
 }
@@ -74,6 +139,166 @@ void ppc_sys_device_remove(enum ppc_sys_devices dev)
        }
 }
 
+/* Platform-notify mapping
+ * Helper function for BSP code to assign board-specific platfom-divice bits
+ */
+
+void platform_notify_map(const struct platform_notify_dev_map *map,
+                        struct device *dev)
+{
+       struct platform_device *pdev;
+       int len, idx;
+       const char *s;
+
+       /* do nothing if no device or no bus_id */
+       if (!dev || !dev->bus_id)
+               return;
+
+       /* call per device map */
+       while (map->bus_id != NULL) {
+               idx = -1;
+               s = strrchr(dev->bus_id, '.');
+               if (s != NULL) {
+                       idx = (int)simple_strtol(s + 1, NULL, 10);
+                       len = s - dev->bus_id;
+               } else {
+                       s = dev->bus_id;
+                       len = strlen(dev->bus_id);
+               }
+
+               if (!strncmp(dev->bus_id, map->bus_id, len)) {
+                       pdev = container_of(dev, struct platform_device, dev);
+                       map->rtn(pdev, idx);
+               }
+               map++;
+       }
+}
+
+/*
+   Function assignment stuff.
+ Intended to work as follows:
+ the device name defined in foo_devices.c will be concatenated with :"func",
+ where func is string map of respective function from platfom_device_func enum
+
+ The PPC_SYS_FUNC_DUMMY function is intended to remove all assignments, making the device to appear
+ in platform bus with unmodified name.
+ */
+
+/*
+   Here we'll replace .name pointers with fixed-lenght strings
+   Hereby, this should be called *before* any func stuff triggeded.
+ */
+void ppc_sys_device_initfunc(void)
+{
+       int i;
+       const char *name;
+       static char new_names[NUM_PPC_SYS_DEVS][BUS_ID_SIZE];
+       enum ppc_sys_devices cur_dev;
+
+       /* If inited yet, do nothing */
+       if (ppc_sys_func_inited)
+               return;
+
+       for (i = 0; i < cur_ppc_sys_spec->num_devices; i++) {
+               if ((cur_dev = cur_ppc_sys_spec->device_list[i]) < 0)
+                       continue;
+
+               if (ppc_sys_platform_devices[cur_dev].name) {
+                       /*backup name */
+                       name = ppc_sys_platform_devices[cur_dev].name;
+                       strlcpy(new_names[i], name, BUS_ID_SIZE);
+                       ppc_sys_platform_devices[cur_dev].name = new_names[i];
+               }
+       }
+
+       ppc_sys_func_inited = 1;
+}
+
+/*The "engine" of the func stuff. Here we either concat specified function string description
+ to the name, or remove it if PPC_SYS_FUNC_DUMMY parameter is passed here*/
+void ppc_sys_device_setfunc(enum ppc_sys_devices dev,
+                           enum platform_device_func func)
+{
+       char *s;
+       char *name = (char *)ppc_sys_platform_devices[dev].name;
+       char tmp[BUS_ID_SIZE];
+
+       if (!ppc_sys_func_inited) {
+               printk(KERN_ERR "Unable to alter function - not inited!\n");
+               return;
+       }
+
+       if (ppc_sys_inited) {
+               platform_device_unregister(&ppc_sys_platform_devices[dev]);
+       }
+
+       if ((s = (char *)strchr(name, ':')) != NULL) {  /* reassign */
+               /* Either change the name after ':' or remove func modifications */
+               if (func != PPC_SYS_FUNC_DUMMY)
+                       strlcpy(s + 1, ppc_sys_func_names[func], BUS_ID_SIZE);
+               else
+                       *s = 0;
+       } else if (func != PPC_SYS_FUNC_DUMMY) {
+               /* do assignment if it is not just "clear"  request */
+               sprintf(tmp, "%s:%s", name, ppc_sys_func_names[func]);
+               strlcpy(name, tmp, BUS_ID_SIZE);
+       }
+
+       if (ppc_sys_inited) {
+               platform_device_register(&ppc_sys_platform_devices[dev]);
+       }
+}
+
+void ppc_sys_device_disable(enum ppc_sys_devices dev)
+{
+       BUG_ON(cur_ppc_sys_spec == NULL);
+
+       /*Check if it is enabled*/
+       if(!(cur_ppc_sys_spec->config[dev] & PPC_SYS_CONFIG_DISABLED)) {
+               if (ppc_sys_inited) {
+                       platform_device_unregister(&ppc_sys_platform_devices[dev]);
+               }
+               cur_ppc_sys_spec->config[dev] |= PPC_SYS_CONFIG_DISABLED;
+       }
+}
+
+void ppc_sys_device_enable(enum ppc_sys_devices dev)
+{
+       BUG_ON(cur_ppc_sys_spec == NULL);
+
+       /*Check if it is disabled*/
+       if(cur_ppc_sys_spec->config[dev] & PPC_SYS_CONFIG_DISABLED) {
+               if (ppc_sys_inited) {
+                       platform_device_register(&ppc_sys_platform_devices[dev]);
+               }
+               cur_ppc_sys_spec->config[dev] &= ~PPC_SYS_CONFIG_DISABLED;
+       }
+
+}
+
+void ppc_sys_device_enable_all(void)
+{
+       enum ppc_sys_devices cur_dev;
+       int i;
+
+       for (i = 0; i < cur_ppc_sys_spec->num_devices; i++) {
+               cur_dev = cur_ppc_sys_spec->device_list[i];
+               ppc_sys_device_enable(cur_dev);
+       }
+}
+
+void ppc_sys_device_disable_all(void)
+{
+       enum ppc_sys_devices cur_dev;
+       int i;
+
+       for (i = 0; i < cur_ppc_sys_spec->num_devices; i++) {
+               cur_dev = cur_ppc_sys_spec->device_list[i];
+               ppc_sys_device_disable(cur_dev);
+       }
+}
+
+
 static int __init ppc_sys_init(void)
 {
        unsigned int i, dev_id, ret = 0;
@@ -82,7 +307,8 @@ static int __init ppc_sys_init(void)
 
        for (i = 0; i < cur_ppc_sys_spec->num_devices; i++) {
                dev_id = cur_ppc_sys_spec->device_list[i];
-               if (dev_id != -1) {
+               if ((dev_id != -1) &&
+               !(cur_ppc_sys_spec->config[dev_id] & PPC_SYS_CONFIG_DISABLED)) {
                        if (ppc_sys_device_fixup != NULL)
                                ppc_sys_device_fixup(&ppc_sys_platform_devices
                                                     [dev_id]);
index c46f915..123abbb 100644 (file)
@@ -216,24 +216,26 @@ void rts7751r2d_insb(unsigned long port, void *addr, unsigned long count)
 {
        volatile __u8 *bp;
        volatile __u16 *p;
+       unsigned char *s = addr;
 
        if (CHECK_AX88796L_PORT(port)) {
                p = (volatile unsigned short *)port88796l(port, 0);
-               while (count--) *((unsigned char *) addr)++ = *p & 0xff;
+               while (count--) *s++ = *p & 0xff;
        } else if (PXSEG(port))
-               while (count--) *((unsigned char *) addr)++ = *(volatile unsigned char *)port;
+               while (count--) *s++ = *(volatile unsigned char *)port;
        else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
                bp = (__u8 *)PCI_IOMAP(port);
-               while (count--) *((volatile unsigned char *) addr)++ = *bp;
+               while (count--) *s++ = *bp;
        } else {
                p = (volatile unsigned short *)port2adr(port);
-               while (count--) *((unsigned char *) addr)++ = *p & 0xff;
+               while (count--) *s++ = *p & 0xff;
        }
 }
 
 void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
 {
        volatile __u16 *p;
+       __u16 *s = addr;
 
        if (CHECK_AX88796L_PORT(port))
                p = (volatile unsigned short *)port88796l(port, 1);
@@ -243,7 +245,7 @@ void rts7751r2d_insw(unsigned long port, void *addr, unsigned long count)
                p = (volatile unsigned short *)PCI_IOMAP(port);
        else
                p = (volatile unsigned short *)port2adr(port);
-       while (count--) *((__u16 *) addr)++ = *p;
+       while (count--) *s++ = *p;
 }
 
 void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
@@ -252,8 +254,9 @@ void rts7751r2d_insl(unsigned long port, void *addr, unsigned long count)
                maybebadio(insl, port);
        else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
                volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
+               __u32 *s = addr;
 
-               while (count--) *((__u32 *) addr)++ = *p;
+               while (count--) *s++ = *p;
        } else
                maybebadio(insl, port);
 }
@@ -262,24 +265,26 @@ void rts7751r2d_outsb(unsigned long port, const void *addr, unsigned long count)
 {
        volatile __u8 *bp;
        volatile __u16 *p;
+       const __u8 *s = addr;
 
        if (CHECK_AX88796L_PORT(port)) {
                p = (volatile unsigned short *)port88796l(port, 0);
-               while (count--) *p = *((unsigned char *) addr)++;
+               while (count--) *p = *s++;
        } else if (PXSEG(port))
-               while (count--) *(volatile unsigned char *)port = *((unsigned char *) addr)++;
+               while (count--) *(volatile unsigned char *)port = *s++;
        else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
                bp = (__u8 *)PCI_IOMAP(port);
-               while (count--) *bp = *((volatile unsigned char *) addr)++;
+               while (count--) *bp = *s++;
        } else {
                p = (volatile unsigned short *)port2adr(port);
-               while (count--) *p = *((unsigned char *) addr)++;
+               while (count--) *p = *s++;
        }
 }
 
 void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
 {
        volatile __u16 *p;
+       const __u16 *s = addr;
 
        if (CHECK_AX88796L_PORT(port))
                p = (volatile unsigned short *)port88796l(port, 1);
@@ -289,7 +294,7 @@ void rts7751r2d_outsw(unsigned long port, const void *addr, unsigned long count)
                p = (volatile unsigned short *)PCI_IOMAP(port);
        else
                p = (volatile unsigned short *)port2adr(port);
-       while (count--) *p = *((__u16 *) addr)++;
+       while (count--) *p = *s++;
 }
 
 void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
@@ -298,8 +303,9 @@ void rts7751r2d_outsl(unsigned long port, const void *addr, unsigned long count)
                maybebadio(outsl, port);
        else if (CHECK_SH7751_PCIIO(port) || shifted_port(port)) {
                volatile __u32 *p = (__u32 *)PCI_IOMAP(port);
+               const __u32 *s = addr;
 
-               while (count--) *p = *((__u32 *) addr)++;
+               while (count--) *p = *s++;
        } else
                maybebadio(outsl, port);
 }
index 71a6d4e..70a5d82 100644 (file)
@@ -3,7 +3,7 @@
  *
  * sysfs interface for SH DMA API
  *
- * Copyright (C) 2004  Paul Mundt
+ * Copyright (C) 2004, 2005  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
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/sysdev.h>
+#include <linux/platform_device.h>
 #include <linux/module.h>
+#include <linux/err.h>
+#include <linux/string.h>
 #include <asm/dma.h>
 
 static struct sysdev_class dma_sysclass = {
@@ -76,7 +79,7 @@ static ssize_t dma_store_config(struct sys_device *dev,
        unsigned long config;
 
        config = simple_strtoul(buf, NULL, 0);
-       dma_configure_channel(channel->chan, config);
+       dma_configure_channel(channel->vchan, config);
 
        return count;
 }
@@ -110,12 +113,13 @@ static SYSDEV_ATTR(field, S_IRUGO, dma_show_##field, NULL);
 dma_ro_attr(count, "0x%08x\n");
 dma_ro_attr(flags, "0x%08lx\n");
 
-int __init dma_create_sysfs_files(struct dma_channel *chan)
+int dma_create_sysfs_files(struct dma_channel *chan, struct dma_info *info)
 {
        struct sys_device *dev = &chan->dev;
+       char name[16];
        int ret;
 
-       dev->id  = chan->chan;
+       dev->id  = chan->vchan;
        dev->cls = &dma_sysclass;
 
        ret = sysdev_register(dev);
@@ -128,6 +132,24 @@ int __init dma_create_sysfs_files(struct dma_channel *chan)
        sysdev_create_file(dev, &attr_flags);
        sysdev_create_file(dev, &attr_config);
 
-       return 0;
+       snprintf(name, sizeof(name), "dma%d", chan->chan);
+       return sysfs_create_link(&info->pdev->dev.kobj, &dev->kobj, name);
+}
+
+void dma_remove_sysfs_files(struct dma_channel *chan, struct dma_info *info)
+{
+       struct sys_device *dev = &chan->dev;
+       char name[16];
+
+       sysdev_remove_file(dev, &attr_dev_id);
+       sysdev_remove_file(dev, &attr_count);
+       sysdev_remove_file(dev, &attr_mode);
+       sysdev_remove_file(dev, &attr_flags);
+       sysdev_remove_file(dev, &attr_config);
+
+       snprintf(name, sizeof(name), "dma%d", chan->chan);
+       sysfs_remove_link(&info->pdev->dev.kobj, name);
+
+       sysdev_unregister(dev);
 }
 
index 76eb81f..58c678e 100644 (file)
@@ -17,21 +17,21 @@ config MMU
        bool
        default y
 
-config UID16
+config RWSEM_GENERIC_SPINLOCK
        bool
        default y
 
-config RWSEM_GENERIC_SPINLOCK
+config GENERIC_FIND_NEXT_BIT
        bool
        default y
 
-config GENERIC_CALIBRATE_DELAY
+config GENERIC_HWEIGHT
        bool
        default y
 
-config LOG_BUF_SHIFT
-       int
-       default 14
+config GENERIC_CALIBRATE_DELAY
+       bool
+       default y
 
 config RWSEM_XCHGADD_ALGORITHM
        bool
@@ -217,6 +217,8 @@ config PREEMPT
        bool "Preemptible Kernel (EXPERIMENTAL)"
        depends on EXPERIMENTAL
 
+source "mm/Kconfig"
+
 endmenu
 
 menu "Bus options (PCI, PCMCIA, EISA, MCA, ISA)"
@@ -266,6 +268,8 @@ source "fs/Kconfig.binfmt"
 
 endmenu
 
+source "net/Kconfig"
+
 source "drivers/Kconfig"
 
 source "fs/Kconfig"
index a249328..f08d0ea 100644 (file)
@@ -223,13 +223,13 @@ good_area:
         */
 survive:
        switch (handle_mm_fault(mm, vma, address, writeaccess)) {
-       case 1:
+       case VM_FAULT_MINOR:
                tsk->min_flt++;
                break;
-       case 2:
+       case VM_FAULT_MAJOR:
                tsk->maj_flt++;
                break;
-       case 0:
+       case VM_FAULT_SIGBUS:
                goto do_sigbus;
        default:
                goto out_of_memory;
index a65e8bb..1169757 100644 (file)
@@ -173,7 +173,7 @@ void free_initmem(void)
        addr = (unsigned long)(&__init_begin);
        for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(addr));
-               set_page_count(virt_to_page(addr), 1);
+               init_page_count(virt_to_page(addr));
                free_page(addr);
                totalram_pages++;
        }
@@ -186,7 +186,7 @@ void free_initrd_mem(unsigned long start, unsigned long end)
        unsigned long p;
        for (p = start; p < end; p += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(p));
-               set_page_count(virt_to_page(p), 1);
+               init_page_count(virt_to_page(p));
                free_page(p);
                totalram_pages++;
        }
index 21a933f..c7bbae8 100644 (file)
@@ -92,18 +92,18 @@ __bzero_done:
        .align 4;               \
 99:    retl;                   \
         mov    %o1, %o0;       \
-       .section __ex_table;    \
+       .section __ex_table,"a";\
        .align 4;               \
        .word 98b, 99b;         \
        .text;                  \
        .align 4;
 
-       .globl  __bzero_noasi
-       .type   __bzero_noasi, #function
-__bzero_noasi:         /* %o0=buf, %o1=len */
-       brz,pn          %o1, __bzero_noasi_done
+       .globl  __clear_user
+       .type   __clear_user, #function
+__clear_user:          /* %o0=buf, %o1=len */
+       brz,pn          %o1, __clear_user_done
         cmp            %o1, 16
-       bl,pn           %icc, __bzero_noasi_tiny
+       bl,pn           %icc, __clear_user_tiny
         EX_ST(prefetcha [%o0 + 0x00] %asi, #n_writes)
        andcc           %o0, 0x3, %g0
        be,pt           %icc, 2f
@@ -145,14 +145,14 @@ __bzero_noasi:            /* %o0=buf, %o1=len */
        subcc           %g1, 8, %g1
        bne,pt          %icc, 5b
         add            %o0, 0x8, %o0
-6:     brz,pt          %o1, __bzero_noasi_done
+6:     brz,pt          %o1, __clear_user_done
         nop
-__bzero_noasi_tiny:
+__clear_user_tiny:
 1:     EX_ST(stba      %g0, [%o0 + 0x00] %asi)
        subcc           %o1, 1, %o1
        bne,pt          %icc, 1b
         add            %o0, 1, %o0
-__bzero_noasi_done:
+__clear_user_done:
        retl
         clr            %o0
-       .size           __bzero_noasi, .-__bzero_noasi
+       .size           __clear_user, .-__clear_user
index 29d0ae7..5f27ad7 100644 (file)
@@ -1,10 +1,12 @@
 /* cif.S: PROM entry/exit assembler trampolines.
  *
- * Copyright (C) 1996,1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
- * Copyright (C) 2005 David S. Miller <davem@davemloft.net>
+ * Copyright (C) 1996, 1997 Jakub Jelinek (jj@sunsite.mff.cuni.cz)
+ * Copyright (C) 2005, 2006 David S. Miller <davem@davemloft.net>
  */
 
 #include <asm/pstate.h>
+#include <asm/cpudata.h>
+#include <asm/thread_info.h>
 
        .text
        .globl  prom_cif_interface
@@ -12,78 +14,16 @@ prom_cif_interface:
        sethi   %hi(p1275buf), %o0
        or      %o0, %lo(p1275buf), %o0
        ldx     [%o0 + 0x010], %o1      ! prom_cif_stack
-       save    %o1, -0x190, %sp
+       save    %o1, -192, %sp
        ldx     [%i0 + 0x008], %l2      ! prom_cif_handler
-       rdpr    %pstate, %l4
-       wrpr    %g0, 0x15, %pstate      ! save alternate globals
-       stx     %g1, [%sp + 2047 + 0x0b0]
-       stx     %g2, [%sp + 2047 + 0x0b8]
-       stx     %g3, [%sp + 2047 + 0x0c0]
-       stx     %g4, [%sp + 2047 + 0x0c8]
-       stx     %g5, [%sp + 2047 + 0x0d0]
-       stx     %g6, [%sp + 2047 + 0x0d8]
-       stx     %g7, [%sp + 2047 + 0x0e0]
-       wrpr    %g0, 0x814, %pstate     ! save interrupt globals
-       stx     %g1, [%sp + 2047 + 0x0e8]
-       stx     %g2, [%sp + 2047 + 0x0f0]
-       stx     %g3, [%sp + 2047 + 0x0f8]
-       stx     %g4, [%sp + 2047 + 0x100]
-       stx     %g5, [%sp + 2047 + 0x108]
-       stx     %g6, [%sp + 2047 + 0x110]
-       stx     %g7, [%sp + 2047 + 0x118]
-       wrpr    %g0, 0x14, %pstate      ! save normal globals
-       stx     %g1, [%sp + 2047 + 0x120]
-       stx     %g2, [%sp + 2047 + 0x128]
-       stx     %g3, [%sp + 2047 + 0x130]
-       stx     %g4, [%sp + 2047 + 0x138]
-       stx     %g5, [%sp + 2047 + 0x140]
-       stx     %g6, [%sp + 2047 + 0x148]
-       stx     %g7, [%sp + 2047 + 0x150]
-       wrpr    %g0, 0x414, %pstate     ! save mmu globals
-       stx     %g1, [%sp + 2047 + 0x158]
-       stx     %g2, [%sp + 2047 + 0x160]
-       stx     %g3, [%sp + 2047 + 0x168]
-       stx     %g4, [%sp + 2047 + 0x170]
-       stx     %g5, [%sp + 2047 + 0x178]
-       stx     %g6, [%sp + 2047 + 0x180]
-       stx     %g7, [%sp + 2047 + 0x188]
-       mov     %g1, %l0                ! also save to locals, so we can handle
-       mov     %g2, %l1                ! tlb faults later on, when accessing
-       mov     %g3, %l3                ! the stack.
-       mov     %g7, %l5
-       wrpr    %l4, PSTATE_IE, %pstate ! turn off interrupts
+       mov     %g4, %l0
+       mov     %g5, %l1
+       mov     %g6, %l3
        call    %l2
         add    %i0, 0x018, %o0         ! prom_args
-       wrpr    %g0, 0x414, %pstate     ! restore mmu globals
-       mov     %l0, %g1
-       mov     %l1, %g2
-       mov     %l3, %g3
-       mov     %l5, %g7
-       wrpr    %g0, 0x14, %pstate      ! restore normal globals
-       ldx     [%sp + 2047 + 0x120], %g1
-       ldx     [%sp + 2047 + 0x128], %g2
-       ldx     [%sp + 2047 + 0x130], %g3
-       ldx     [%sp + 2047 + 0x138], %g4
-       ldx     [%sp + 2047 + 0x140], %g5
-       ldx     [%sp + 2047 + 0x148], %g6
-       ldx     [%sp + 2047 + 0x150], %g7
-       wrpr    %g0, 0x814, %pstate     ! restore interrupt globals
-       ldx     [%sp + 2047 + 0x0e8], %g1
-       ldx     [%sp + 2047 + 0x0f0], %g2
-       ldx     [%sp + 2047 + 0x0f8], %g3
-       ldx     [%sp + 2047 + 0x100], %g4
-       ldx     [%sp + 2047 + 0x108], %g5
-       ldx     [%sp + 2047 + 0x110], %g6
-       ldx     [%sp + 2047 + 0x118], %g7
-       wrpr    %g0, 0x15, %pstate      ! restore alternate globals
-       ldx     [%sp + 2047 + 0x0b0], %g1
-       ldx     [%sp + 2047 + 0x0b8], %g2
-       ldx     [%sp + 2047 + 0x0c0], %g3
-       ldx     [%sp + 2047 + 0x0c8], %g4
-       ldx     [%sp + 2047 + 0x0d0], %g5
-       ldx     [%sp + 2047 + 0x0d8], %g6
-       ldx     [%sp + 2047 + 0x0e0], %g7
-       wrpr    %l4, 0, %pstate ! restore original pstate
+       mov     %l0, %g4
+       mov     %l1, %g5
+       mov     %l3, %g6
        ret
         restore
 
@@ -91,135 +31,18 @@ prom_cif_interface:
 prom_cif_callback:
        sethi   %hi(p1275buf), %o1
        or      %o1, %lo(p1275buf), %o1
-       save    %sp, -0x270, %sp
-       rdpr    %pstate, %l4
-       wrpr    %g0, 0x15, %pstate      ! save PROM alternate globals
-       stx     %g1, [%sp + 2047 + 0x0b0]
-       stx     %g2, [%sp + 2047 + 0x0b8]
-       stx     %g3, [%sp + 2047 + 0x0c0]
-       stx     %g4, [%sp + 2047 + 0x0c8]
-       stx     %g5, [%sp + 2047 + 0x0d0]
-       stx     %g6, [%sp + 2047 + 0x0d8]
-       stx     %g7, [%sp + 2047 + 0x0e0]
-                                       ! restore Linux alternate globals
-       ldx     [%sp + 2047 + 0x190], %g1
-       ldx     [%sp + 2047 + 0x198], %g2
-       ldx     [%sp + 2047 + 0x1a0], %g3
-       ldx     [%sp + 2047 + 0x1a8], %g4
-       ldx     [%sp + 2047 + 0x1b0], %g5
-       ldx     [%sp + 2047 + 0x1b8], %g6
-       ldx     [%sp + 2047 + 0x1c0], %g7
-       wrpr    %g0, 0x814, %pstate     ! save PROM interrupt globals
-       stx     %g1, [%sp + 2047 + 0x0e8]
-       stx     %g2, [%sp + 2047 + 0x0f0]
-       stx     %g3, [%sp + 2047 + 0x0f8]
-       stx     %g4, [%sp + 2047 + 0x100]
-       stx     %g5, [%sp + 2047 + 0x108]
-       stx     %g6, [%sp + 2047 + 0x110]
-       stx     %g7, [%sp + 2047 + 0x118]
-                                       ! restore Linux interrupt globals
-       ldx     [%sp + 2047 + 0x1c8], %g1
-       ldx     [%sp + 2047 + 0x1d0], %g2
-       ldx     [%sp + 2047 + 0x1d8], %g3
-       ldx     [%sp + 2047 + 0x1e0], %g4
-       ldx     [%sp + 2047 + 0x1e8], %g5
-       ldx     [%sp + 2047 + 0x1f0], %g6
-       ldx     [%sp + 2047 + 0x1f8], %g7
-       wrpr    %g0, 0x14, %pstate      ! save PROM normal globals
-       stx     %g1, [%sp + 2047 + 0x120]
-       stx     %g2, [%sp + 2047 + 0x128]
-       stx     %g3, [%sp + 2047 + 0x130]
-       stx     %g4, [%sp + 2047 + 0x138]
-       stx     %g5, [%sp + 2047 + 0x140]
-       stx     %g6, [%sp + 2047 + 0x148]
-       stx     %g7, [%sp + 2047 + 0x150]
-                                       ! restore Linux normal globals
-       ldx     [%sp + 2047 + 0x200], %g1
-       ldx     [%sp + 2047 + 0x208], %g2
-       ldx     [%sp + 2047 + 0x210], %g3
-       ldx     [%sp + 2047 + 0x218], %g4
-       ldx     [%sp + 2047 + 0x220], %g5
-       ldx     [%sp + 2047 + 0x228], %g6
-       ldx     [%sp + 2047 + 0x230], %g7
-       wrpr    %g0, 0x414, %pstate     ! save PROM mmu globals
-       stx     %g1, [%sp + 2047 + 0x158]
-       stx     %g2, [%sp + 2047 + 0x160]
-       stx     %g3, [%sp + 2047 + 0x168]
-       stx     %g4, [%sp + 2047 + 0x170]
-       stx     %g5, [%sp + 2047 + 0x178]
-       stx     %g6, [%sp + 2047 + 0x180]
-       stx     %g7, [%sp + 2047 + 0x188]
-                                       ! restore Linux mmu globals
-       ldx     [%sp + 2047 + 0x238], %o0
-       ldx     [%sp + 2047 + 0x240], %o1
-       ldx     [%sp + 2047 + 0x248], %l2
-       ldx     [%sp + 2047 + 0x250], %l3
-       ldx     [%sp + 2047 + 0x258], %l5
-       ldx     [%sp + 2047 + 0x260], %l6
-       ldx     [%sp + 2047 + 0x268], %l7
-                                       ! switch to Linux tba
-       sethi   %hi(sparc64_ttable_tl0), %l1
-       rdpr    %tba, %l0               ! save PROM tba
-       mov     %o0, %g1
-       mov     %o1, %g2
-       mov     %l2, %g3
-       mov     %l3, %g4
-       mov     %l5, %g5
-       mov     %l6, %g6
-       mov     %l7, %g7
-       wrpr    %l1, %tba               ! install Linux tba
-       wrpr    %l4, 0, %pstate         ! restore PSTATE
+       save    %sp, -192, %sp
+       TRAP_LOAD_THREAD_REG(%g6, %g1)
+       LOAD_PER_CPU_BASE(%g5, %g6, %g4, %g3, %o0)
+       ldx     [%g6 + TI_TASK], %g4
        call    prom_world
-        mov    %g0, %o0
+        mov    0, %o0
        ldx     [%i1 + 0x000], %l2
        call    %l2
         mov    %i0, %o0
        mov     %o0, %l1
        call    prom_world
-        or     %g0, 1, %o0
-       wrpr    %g0, 0x14, %pstate      ! interrupts off
-                                       ! restore PROM mmu globals
-       ldx     [%sp + 2047 + 0x158], %o0
-       ldx     [%sp + 2047 + 0x160], %o1
-       ldx     [%sp + 2047 + 0x168], %l2
-       ldx     [%sp + 2047 + 0x170], %l3
-       ldx     [%sp + 2047 + 0x178], %l5
-       ldx     [%sp + 2047 + 0x180], %l6
-       ldx     [%sp + 2047 + 0x188], %l7
-       wrpr    %g0, 0x414, %pstate     ! restore PROM mmu globals
-       mov     %o0, %g1
-       mov     %o1, %g2
-       mov     %l2, %g3
-       mov     %l3, %g4
-       mov     %l5, %g5
-       mov     %l6, %g6
-       mov     %l7, %g7
-       wrpr    %l0, %tba               ! restore PROM tba
-       wrpr    %g0, 0x14, %pstate      ! restore PROM normal globals
-       ldx     [%sp + 2047 + 0x120], %g1
-       ldx     [%sp + 2047 + 0x128], %g2
-       ldx     [%sp + 2047 + 0x130], %g3
-       ldx     [%sp + 2047 + 0x138], %g4
-       ldx     [%sp + 2047 + 0x140], %g5
-       ldx     [%sp + 2047 + 0x148], %g6
-       ldx     [%sp + 2047 + 0x150], %g7
-       wrpr    %g0, 0x814, %pstate     ! restore PROM interrupt globals
-       ldx     [%sp + 2047 + 0x0e8], %g1
-       ldx     [%sp + 2047 + 0x0f0], %g2
-       ldx     [%sp + 2047 + 0x0f8], %g3
-       ldx     [%sp + 2047 + 0x100], %g4
-       ldx     [%sp + 2047 + 0x108], %g5
-       ldx     [%sp + 2047 + 0x110], %g6
-       ldx     [%sp + 2047 + 0x118], %g7
-       wrpr    %g0, 0x15, %pstate      ! restore PROM alternate globals
-       ldx     [%sp + 2047 + 0x0b0], %g1
-       ldx     [%sp + 2047 + 0x0b8], %g2
-       ldx     [%sp + 2047 + 0x0c0], %g3
-       ldx     [%sp + 2047 + 0x0c8], %g4
-       ldx     [%sp + 2047 + 0x0d0], %g5
-       ldx     [%sp + 2047 + 0x0d8], %g6
-       ldx     [%sp + 2047 + 0x0e0], %g7
-       wrpr    %l4, 0, %pstate
+        mov    1, %o0
        ret
         restore %l1, 0, %o0
 
index f9e2219..ba471f5 100644 (file)
@@ -58,10 +58,8 @@ static ssize_t rng_dev_read (struct file *filp, char __user *buf, size_t size,
                         if (filp->f_flags & O_NONBLOCK)
                                 return ret ? : -EAGAIN;
 
-                        if(need_resched()){
-                                current->state = TASK_INTERRUPTIBLE;
-                                schedule_timeout(1);
-                        }
+                        if(need_resched())
+                                schedule_timeout_interruptible(1);
                 }
                 else return n;
                if (signal_pending (current))
index 8744abb..83b688c 100644 (file)
@@ -14,16 +14,7 @@ extern int restore_fp_registers(int pid, unsigned long *fp_regs);
 extern void save_registers(int pid, union uml_pt_regs *regs);
 extern void restore_registers(int pid, union uml_pt_regs *regs);
 extern void init_registers(int pid);
+extern void get_safe_registers(unsigned long * regs, unsigned long * fp_regs);
+extern void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer);
 
 #endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
index be8acd5..8d353f0 100644 (file)
@@ -183,10 +183,6 @@ struct syscall_args {
                 case RBP: val = UPT_RBP(regs); break; \
                 case ORIG_RAX: val = UPT_ORIG_RAX(regs); break; \
                 case CS: val = UPT_CS(regs); break; \
-                case DS: val = UPT_DS(regs); break; \
-                case ES: val = UPT_ES(regs); break; \
-                case FS: val = UPT_FS(regs); break; \
-                case GS: val = UPT_GS(regs); break; \
                 case EFLAGS: val = UPT_EFLAGS(regs); break; \
                 default :  \
                         panic("Bad register in UPT_REG : %d\n", reg);  \
@@ -218,16 +214,12 @@ struct syscall_args {
                 case RBP: UPT_RBP(regs) = __upt_val; break; \
                 case ORIG_RAX: UPT_ORIG_RAX(regs) = __upt_val; break; \
                 case CS: UPT_CS(regs) = __upt_val; break; \
-                case DS: UPT_DS(regs) = __upt_val; break; \
-                case ES: UPT_ES(regs) = __upt_val; break; \
-                case FS: UPT_FS(regs) = __upt_val; break; \
-                case GS: UPT_GS(regs) = __upt_val; break; \
                 case EFLAGS: UPT_EFLAGS(regs) = __upt_val; break; \
                 default :  \
                         panic("Bad register in UPT_SET : %d\n", reg);  \
                        break; \
                 } \
-                val; \
+                __upt_val; \
         })
 
 #define UPT_SET_SYSCALL_RETURN(r, res) \
index 3172997..128faf0 100644 (file)
 #define PTRACE_OLDSETOPTIONS 21
 #endif
 
+/* These are before the system call, so the the system call number is RAX
+ * rather than ORIG_RAX, and arg4 is R10 rather than RCX
+ */
+#define REGS_SYSCALL_NR PT_INDEX(RAX)
+#define REGS_SYSCALL_ARG1 PT_INDEX(RDI)
+#define REGS_SYSCALL_ARG2 PT_INDEX(RSI)
+#define REGS_SYSCALL_ARG3 PT_INDEX(RDX)
+#define REGS_SYSCALL_ARG4 PT_INDEX(R10)
+#define REGS_SYSCALL_ARG5 PT_INDEX(R8)
+#define REGS_SYSCALL_ARG6 PT_INDEX(R9)
+
+#define REGS_IP_INDEX PT_INDEX(RIP)
+#define REGS_SP_INDEX PT_INDEX(RSP)
+
 #endif
 
 /*
index fc38a6d..8d56ec6 100644 (file)
@@ -39,11 +39,14 @@ static long execve1(char *file, char __user * __user *argv,
                    char __user *__user *env)
 {
         long error;
+       struct tty_struct *tty;
 
 #ifdef CONFIG_TTY_LOG
-       task_lock(current);
-       log_exec(argv, current->signal->tty);
-       task_unlock(current);
+       mutex_lock(&tty_mutex);
+       tty = get_current_tty();
+       if (tty)
+               log_exec(argv, tty);
+       mutex_unlock(&tty_mutex);
 #endif
         error = do_execve(file, argv, env, &current->thread.regs);
         if (error == 0){
index f0d6060..5a99dd3 100644 (file)
 #include <stddef.h>
 #include "init.h"
 #include "elf_user.h"
+#include "mem_user.h"
+#include <kern_constants.h>
 
-#if ELF_CLASS == ELFCLASS32
+/* Use the one from the kernel - the host may miss it, if having old headers. */
+#if UM_ELF_CLASS == UM_ELFCLASS32
 typedef Elf32_auxv_t elf_auxv_t;
 #else
 typedef Elf64_auxv_t elf_auxv_t;
@@ -40,6 +43,9 @@ __init void scan_elf_aux( char **envp)
                                break;
                        case AT_SYSINFO_EHDR:
                                vsyscall_ehdr = auxv->a_un.a_val;
+                               /* See if the page is under TASK_SIZE */
+                               if (vsyscall_ehdr < (unsigned long) envp)
+                                       vsyscall_ehdr = 0;
                                break;
                        case AT_HWCAP:
                                elf_aux_hwcap = auxv->a_un.a_val;
@@ -49,7 +55,8 @@ __init void scan_elf_aux( char **envp)
                                  * a_un, so we have to use a_val, which is
                                  * all that's left.
                                  */
-                               elf_aux_platform = (char *) auxv->a_un.a_val;
+                               elf_aux_platform =
+                                       (char *) (long) auxv->a_un.a_val;
                                break;
                        case AT_PAGESZ:
                                page_size = auxv->a_un.a_val;
index 340ef26..b321361 100644 (file)
@@ -3,7 +3,7 @@
 # Licensed under the GPL
 #
 
-obj-$(CONFIG_MODE_SKAS) = registers.o
+obj-$(CONFIG_MODE_SKAS) = registers.o tls.o
 
 USER_OBJS := $(obj-y)
 
index 9a0ad09..516f66d 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <errno.h>
 #include <string.h>
+#include <setjmp.h>
 #include "sysdep/ptrace_user.h"
 #include "sysdep/ptrace.h"
 #include "uml-config.h"
@@ -103,7 +104,7 @@ void init_registers(int pid)
        err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
        if(err)
                panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
-                     err);
+                     errno);
 
        errno = 0;
        err = ptrace(PTRACE_GETFPXREGS, pid, 0, exec_fpx_regs);
@@ -118,16 +119,22 @@ void init_registers(int pid)
        err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
        if(err)
                panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
-                     err);
+                     errno);
 }
 
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
+void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
+{
+       memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
+       if(fp_regs != NULL)
+               memcpy(fp_regs, exec_fp_regs,
+                      HOST_FP_SIZE * sizeof(unsigned long));
+}
+
+void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
+{
+       struct __jmp_buf_tag *jmpbuf = buffer;
+
+       UPT_SET(uml_regs, EIP, jmpbuf->__jmpbuf[JB_PC]);
+       UPT_SET(uml_regs, UESP, jmpbuf->__jmpbuf[JB_SP]);
+       UPT_SET(uml_regs, EBP, jmpbuf->__jmpbuf[JB_BP]);
+}
index 6286c97..becd898 100644 (file)
@@ -5,6 +5,7 @@
 
 #include <errno.h>
 #include <string.h>
+#include <setjmp.h>
 #include "ptrace_user.h"
 #include "uml-config.h"
 #include "skas_ptregs.h"
@@ -61,21 +62,27 @@ void init_registers(int pid)
        err = ptrace(PTRACE_GETREGS, pid, 0, exec_regs);
        if(err)
                panic("check_ptrace : PTRACE_GETREGS failed, errno = %d",
-                     err);
+                     errno);
 
        err = ptrace(PTRACE_GETFPREGS, pid, 0, exec_fp_regs);
        if(err)
                panic("check_ptrace : PTRACE_GETFPREGS failed, errno = %d",
-                     err);
+                     errno);
 }
 
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
+void get_safe_registers(unsigned long *regs, unsigned long *fp_regs)
+{
+       memcpy(regs, exec_regs, HOST_FRAME_SIZE * sizeof(unsigned long));
+       if(fp_regs != NULL)
+               memcpy(fp_regs, exec_fp_regs,
+                      HOST_FP_SIZE * sizeof(unsigned long));
+}
+
+void get_thread_regs(union uml_pt_regs *uml_regs, void *buffer)
+{
+       struct __jmp_buf_tag *jmpbuf = buffer;
+
+       UPT_SET(uml_regs, RIP, jmpbuf->__jmpbuf[JB_PC]);
+       UPT_SET(uml_regs, RSP, jmpbuf->__jmpbuf[JB_RSP]);
+       UPT_SET(uml_regs, RBP, jmpbuf->__jmpbuf[JB_RBP]);
+}
index 03913ca..0709fc6 100644 (file)
@@ -10,7 +10,6 @@
 #include "asm/uaccess.h"
 #include "asm/unistd.h"
 #include "frame_kern.h"
-#include "signal_user.h"
 #include "sigcontext.h"
 #include "registers.h"
 #include "mode.h"
@@ -20,7 +19,7 @@
 #include "skas.h"
 
 static int copy_sc_from_user_skas(struct pt_regs *regs,
-                                 struct sigcontext *from)
+                                 struct sigcontext __user *from)
 {
        struct sigcontext sc;
        unsigned long fpregs[HOST_FP_SIZE];
@@ -58,8 +57,8 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
        return(0);
 }
 
-int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
-                         struct pt_regs *regs)
+int copy_sc_to_user_skas(struct sigcontext __user *to, struct _fpstate __user *to_fp,
+                         struct pt_regs *regs, unsigned long sp)
 {
        struct sigcontext sc;
        unsigned long fpregs[HOST_FP_SIZE];
@@ -73,7 +72,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
        sc.edi = REGS_EDI(regs->regs.skas.regs);
        sc.esi = REGS_ESI(regs->regs.skas.regs);
        sc.ebp = REGS_EBP(regs->regs.skas.regs);
-       sc.esp = REGS_SP(regs->regs.skas.regs);
+       sc.esp = sp;
        sc.ebx = REGS_EBX(regs->regs.skas.regs);
        sc.edx = REGS_EDX(regs->regs.skas.regs);
        sc.ecx = REGS_ECX(regs->regs.skas.regs);
@@ -93,7 +92,7 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
                       "errno = %d\n", err);
                return(1);
        }
-       to_fp = (to_fp ? to_fp : (struct _fpstate *) (to + 1));
+       to_fp = (to_fp ? to_fp : (struct _fpstate __user *) (to + 1));
        sc.fpstate = to_fp;
 
        if(err)
@@ -114,17 +113,18 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
  * saved pointer is in the kernel, but the sigcontext is in userspace, so we
  * copy_to_user it.
  */
-int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
+int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from,
                         int fpsize)
 {
-       struct _fpstate *to_fp, *from_fp;
+       struct _fpstate *to_fp;
+       struct _fpstate __user *from_fp;
        unsigned long sigs;
        int err;
 
        to_fp = to->fpstate;
-       from_fp = from->fpstate;
        sigs = to->oldmask;
        err = copy_from_user(to, from, sizeof(*to));
+       from_fp = to->fpstate;
        to->oldmask = sigs;
        to->fpstate = to_fp;
        if(to_fp != NULL)
@@ -132,20 +132,28 @@ int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
        return(err);
 }
 
-int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
-                      struct sigcontext *from, int fpsize)
+int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp,
+                      struct sigcontext *from, int fpsize, unsigned long sp)
 {
-       struct _fpstate *to_fp, *from_fp;
+       struct _fpstate __user *to_fp;
+       struct _fpstate *from_fp;
        int err;
 
-       to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
+       to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1));
        from_fp = from->fpstate;
        err = copy_to_user(to, from, sizeof(*to));
+
+       /* The SP in the sigcontext is the updated one for the signal
+        * delivery.  The sp passed in is the original, and this needs
+        * to be restored, so we stick it in separately.
+        */
+       err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp));
+
        if(from_fp != NULL){
                err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
                err |= copy_to_user(to_fp, from_fp, fpsize);
        }
-       return(err);
+       return err;
 }
 #endif
 
@@ -159,15 +167,15 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
        return(ret);
 }
 
-static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
-                          struct pt_regs *from)
+static int copy_sc_to_user(struct sigcontext __user *to, struct _fpstate __user *fp,
+                          struct pt_regs *from, unsigned long sp)
 {
        return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
-                                             sizeof(*fp)),
-                           copy_sc_to_user_skas(to, fp, from)));
+                                             sizeof(*fp), sp),
+                           copy_sc_to_user_skas(to, fp, from, sp)));
 }
 
-static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
+static int copy_ucontext_to_user(struct ucontext __user *uc, struct _fpstate __user *fp,
                                 sigset_t *set, unsigned long sp)
 {
        int err = 0;
@@ -175,14 +183,14 @@ static int copy_ucontext_to_user(struct ucontext *uc, struct _fpstate *fp,
        err |= put_user(current->sas_ss_sp, &uc->uc_stack.ss_sp);
        err |= put_user(sas_ss_flags(sp), &uc->uc_stack.ss_flags);
        err |= put_user(current->sas_ss_size, &uc->uc_stack.ss_size);
-       err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs);
+       err |= copy_sc_to_user(&uc->uc_mcontext, fp, &current->thread.regs, sp);
        err |= copy_to_user(&uc->uc_sigmask, set, sizeof(*set));
        return(err);
 }
 
 struct sigframe
 {
-       char *pretcode;
+       char __user *pretcode;
        int sig;
        struct sigcontext sc;
        struct _fpstate fpstate;
@@ -192,10 +200,10 @@ struct sigframe
 
 struct rt_sigframe
 {
-       char *pretcode;
+       char __user *pretcode;
        int sig;
-       struct siginfo *pinfo;
-       void *puc;
+       struct siginfo __user *pinfo;
+       void __user *puc;
        struct siginfo info;
        struct ucontext uc;
        struct _fpstate fpstate;
@@ -207,21 +215,32 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
                          sigset_t *mask)
 {
        struct sigframe __user *frame;
-       void *restorer;
+       void __user *restorer;
+       unsigned long save_sp = PT_REGS_SP(regs);
        int err = 0;
 
        stack_top &= -8UL;
-       frame = (struct sigframe *) stack_top - 1;
+       frame = (struct sigframe __user *) stack_top - 1;
        if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
                return 1;
 
-       restorer = (void *) frame->retcode;
+       restorer = frame->retcode;
        if(ka->sa.sa_flags & SA_RESTORER)
                restorer = ka->sa.sa_restorer;
 
+       /* Update SP now because the page fault handler refuses to extend
+        * the stack if the faulting address is too far below the current
+        * SP, which frame now certainly is.  If there's an error, the original
+        * value is restored on the way out.
+        * When writing the sigcontext to the stack, we have to write the
+        * original value, so that's passed to copy_sc_to_user, which does
+        * the right thing with it.
+        */
+       PT_REGS_SP(regs) = (unsigned long) frame;
+
        err |= __put_user(restorer, &frame->pretcode);
        err |= __put_user(sig, &frame->sig);
-       err |= copy_sc_to_user(&frame->sc, NULL, regs);
+       err |= copy_sc_to_user(&frame->sc, NULL, regs, save_sp);
        err |= __put_user(mask->sig[0], &frame->sc.oldmask);
        if (_NSIG_WORDS > 1)
                err |= __copy_to_user(&frame->extramask, &mask->sig[1],
@@ -239,7 +258,7 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
        err |= __put_user(0x80cd, (short __user *)(frame->retcode+6));
 
        if(err)
-               return(err);
+               goto err;
 
        PT_REGS_SP(regs) = (unsigned long) frame;
        PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
@@ -249,7 +268,11 @@ int setup_signal_stack_sc(unsigned long stack_top, int sig,
 
        if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
                ptrace_notify(SIGTRAP);
-       return(0);
+       return 0;
+
+err:
+       PT_REGS_SP(regs) = save_sp;
+       return err;
 }
 
 int setup_signal_stack_si(unsigned long stack_top, int sig,
@@ -257,25 +280,29 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
                          siginfo_t *info, sigset_t *mask)
 {
        struct rt_sigframe __user *frame;
-       void *restorer;
+       void __user *restorer;
+       unsigned long save_sp = PT_REGS_SP(regs);
        int err = 0;
 
        stack_top &= -8UL;
-       frame = (struct rt_sigframe *) stack_top - 1;
+       frame = (struct rt_sigframe __user *) stack_top - 1;
        if (!access_ok(VERIFY_WRITE, frame, sizeof(*frame)))
                return 1;
 
-       restorer = (void *) frame->retcode;
+       restorer = frame->retcode;
        if(ka->sa.sa_flags & SA_RESTORER)
                restorer = ka->sa.sa_restorer;
 
+       /* See comment above about why this is here */
+       PT_REGS_SP(regs) = (unsigned long) frame;
+
        err |= __put_user(restorer, &frame->pretcode);
        err |= __put_user(sig, &frame->sig);
        err |= __put_user(&frame->info, &frame->pinfo);
        err |= __put_user(&frame->uc, &frame->puc);
        err |= copy_siginfo_to_user(&frame->info, info);
        err |= copy_ucontext_to_user(&frame->uc, &frame->fpstate, mask,
-                                    PT_REGS_SP(regs));
+                                    save_sp);
 
        /*
         * This is movl $,%eax ; int $0x80
@@ -289,9 +316,8 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
        err |= __put_user(0x80cd, (short __user *)(frame->retcode+5));
 
        if(err)
-               return(err);
+               goto err;
 
-       PT_REGS_SP(regs) = (unsigned long) frame;
        PT_REGS_IP(regs) = (unsigned long) ka->sa.sa_handler;
        PT_REGS_EAX(regs) = (unsigned long) sig;
        PT_REGS_EDX(regs) = (unsigned long) &frame->info;
@@ -299,20 +325,24 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
 
        if ((current->ptrace & PT_DTRACE) && (current->ptrace & PT_PTRACED))
                ptrace_notify(SIGTRAP);
-       return(0);
+       return 0;
+
+err:
+       PT_REGS_SP(regs) = save_sp;
+       return err;
 }
 
 long sys_sigreturn(struct pt_regs regs)
 {
        unsigned long sp = PT_REGS_SP(&current->thread.regs);
-       struct sigframe __user *frame = (struct sigframe *)(sp - 8);
+       struct sigframe __user *frame = (struct sigframe __user *)(sp - 8);
        sigset_t set;
        struct sigcontext __user *sc = &frame->sc;
        unsigned long __user *oldmask = &sc->oldmask;
        unsigned long __user *extramask = frame->extramask;
        int sig_size = (_NSIG_WORDS - 1) * sizeof(unsigned long);
 
-       if(copy_from_user(&set.sig[0], oldmask, sizeof(&set.sig[0])) ||
+       if(copy_from_user(&set.sig[0], oldmask, sizeof(set.sig[0])) ||
           copy_from_user(&set.sig[1], extramask, sig_size))
                goto segfault;
 
@@ -337,8 +367,8 @@ long sys_sigreturn(struct pt_regs regs)
 
 long sys_rt_sigreturn(struct pt_regs regs)
 {
-       unsigned long __user sp = PT_REGS_SP(&current->thread.regs);
-       struct rt_sigframe __user *frame = (struct rt_sigframe *) (sp - 4);
+       unsigned long sp = PT_REGS_SP(&current->thread.regs);
+       struct rt_sigframe __user *frame = (struct rt_sigframe __user *) (sp - 4);
        sigset_t set;
        struct ucontext __user *uc = &frame->uc;
        int sig_size = _NSIG_WORDS * sizeof(unsigned long);
index 3ceaabc..6f4ef2b 100644 (file)
@@ -3,51 +3,53 @@
 #include <asm/ptrace.h>
 #include <asm/user.h>
 #include <linux/stddef.h>
+#include <sys/poll.h>
 
 #define DEFINE(sym, val) \
-        asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+       asm volatile("\n->" #sym " %0 " #val : : "i" (val))
+
+#define DEFINE_LONGS(sym, val) \
+       asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
 
 #define OFFSET(sym, str, mem) \
        DEFINE(sym, offsetof(struct str, mem));
 
 void foo(void)
 {
-       OFFSET(SC_IP, sigcontext, eip);
-       OFFSET(SC_SP, sigcontext, esp);
-       OFFSET(SC_FS, sigcontext, fs);
-       OFFSET(SC_GS, sigcontext, gs);
-       OFFSET(SC_DS, sigcontext, ds);
-       OFFSET(SC_ES, sigcontext, es);
-       OFFSET(SC_SS, sigcontext, ss);
-       OFFSET(SC_CS, sigcontext, cs);
-       OFFSET(SC_EFLAGS, sigcontext, eflags);
-       OFFSET(SC_EAX, sigcontext, eax);
-       OFFSET(SC_EBX, sigcontext, ebx);
-       OFFSET(SC_ECX, sigcontext, ecx);
-       OFFSET(SC_EDX, sigcontext, edx);
-       OFFSET(SC_EDI, sigcontext, edi);
-       OFFSET(SC_ESI, sigcontext, esi);
-       OFFSET(SC_EBP, sigcontext, ebp);
-       OFFSET(SC_TRAPNO, sigcontext, trapno);
-       OFFSET(SC_ERR, sigcontext, err);
-       OFFSET(SC_CR2, sigcontext, cr2);
-       OFFSET(SC_FPSTATE, sigcontext, fpstate);
-       OFFSET(SC_SIGMASK, sigcontext, oldmask);
-       OFFSET(SC_FP_CW, _fpstate, cw);
-       OFFSET(SC_FP_SW, _fpstate, sw);
-       OFFSET(SC_FP_TAG, _fpstate, tag);
-       OFFSET(SC_FP_IPOFF, _fpstate, ipoff);
-       OFFSET(SC_FP_CSSEL, _fpstate, cssel);
-       OFFSET(SC_FP_DATAOFF, _fpstate, dataoff);
-       OFFSET(SC_FP_DATASEL, _fpstate, datasel);
-       OFFSET(SC_FP_ST, _fpstate, _st);
-       OFFSET(SC_FXSR_ENV, _fpstate, _fxsr_env);
+       OFFSET(HOST_SC_IP, sigcontext, eip);
+       OFFSET(HOST_SC_SP, sigcontext, esp);
+       OFFSET(HOST_SC_FS, sigcontext, fs);
+       OFFSET(HOST_SC_GS, sigcontext, gs);
+       OFFSET(HOST_SC_DS, sigcontext, ds);
+       OFFSET(HOST_SC_ES, sigcontext, es);
+       OFFSET(HOST_SC_SS, sigcontext, ss);
+       OFFSET(HOST_SC_CS, sigcontext, cs);
+       OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
+       OFFSET(HOST_SC_EAX, sigcontext, eax);
+       OFFSET(HOST_SC_EBX, sigcontext, ebx);
+       OFFSET(HOST_SC_ECX, sigcontext, ecx);
+       OFFSET(HOST_SC_EDX, sigcontext, edx);
+       OFFSET(HOST_SC_EDI, sigcontext, edi);
+       OFFSET(HOST_SC_ESI, sigcontext, esi);
+       OFFSET(HOST_SC_EBP, sigcontext, ebp);
+       OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
+       OFFSET(HOST_SC_ERR, sigcontext, err);
+       OFFSET(HOST_SC_CR2, sigcontext, cr2);
+       OFFSET(HOST_SC_FPSTATE, sigcontext, fpstate);
+       OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
+       OFFSET(HOST_SC_FP_CW, _fpstate, cw);
+       OFFSET(HOST_SC_FP_SW, _fpstate, sw);
+       OFFSET(HOST_SC_FP_TAG, _fpstate, tag);
+       OFFSET(HOST_SC_FP_IPOFF, _fpstate, ipoff);
+       OFFSET(HOST_SC_FP_CSSEL, _fpstate, cssel);
+       OFFSET(HOST_SC_FP_DATAOFF, _fpstate, dataoff);
+       OFFSET(HOST_SC_FP_DATASEL, _fpstate, datasel);
+       OFFSET(HOST_SC_FP_ST, _fpstate, _st);
+       OFFSET(HOST_SC_FXSR_ENV, _fpstate, _fxsr_env);
 
        DEFINE(HOST_FRAME_SIZE, FRAME_SIZE);
-       DEFINE(HOST_FP_SIZE,
-               sizeof(struct user_i387_struct) / sizeof(unsigned long));
-       DEFINE(HOST_XFP_SIZE,
-              sizeof(struct user_fxsr_struct) / sizeof(unsigned long));
+       DEFINE_LONGS(HOST_FP_SIZE, sizeof(struct user_i387_struct));
+       DEFINE_LONGS(HOST_XFP_SIZE, sizeof(struct user_fxsr_struct));
 
        DEFINE(HOST_IP, EIP);
        DEFINE(HOST_SP, UESP);
@@ -65,5 +67,10 @@ void foo(void)
        DEFINE(HOST_FS, FS);
        DEFINE(HOST_ES, ES);
        DEFINE(HOST_GS, GS);
-       DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct));
+       DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
+
+       /* XXX Duplicated between i386 and x86_64 */
+       DEFINE(UM_POLLIN, POLLIN);
+       DEFINE(UM_POLLPRI, POLLPRI);
+       DEFINE(UM_POLLOUT, POLLOUT);
 }
index 608466a..c19794d 100644 (file)
@@ -4,28 +4,28 @@
 # Licensed under the GPL
 #
 
-#XXX: why into lib-y?
-lib-y = bitops.o bugs.o csum-partial.o delay.o fault.o mem.o memcpy.o \
-       ptrace.o ptrace_user.o semaphore.o sigcontext.o signal.o \
-       syscalls.o sysrq.o thunk.o syscall_table.o
+obj-y = bugs.o delay.o fault.o ldt.o mem.o ptrace.o ptrace_user.o \
+       sigcontext.o signal.o syscalls.o syscall_table.o sysrq.o ksyms.o \
+       tls.o
 
-obj-y := ksyms.o
-obj-$(CONFIG_MODULES) += module.o um_module.o
+obj-$(CONFIG_MODE_SKAS) += stub.o stub_segv.o
+obj-$(CONFIG_MODULES) += um_module.o
+
+subarch-obj-y = lib/bitops.o lib/csum-partial.o lib/memcpy.o lib/thunk.o
+subarch-obj-$(CONFIG_MODULES) += kernel/module.o
+
+ldt-y = ../sys-i386/ldt.o
 
 USER_OBJS := ptrace_user.o sigcontext.o
 
-SYMLINKS = bitops.c csum-copy.S csum-partial.c csum-wrappers.c memcpy.S \
-       semaphore.c thunk.S module.c
+USER_OBJS += user-offsets.s
+extra-y += user-offsets.s
 
-include arch/um/scripts/Makefile.rules
+extra-$(CONFIG_MODE_TT) += unmap.o
 
-bitops.c-dir = lib
-csum-copy.S-dir = lib
-csum-partial.c-dir = lib
-csum-wrappers.c-dir = lib
-memcpy.S-dir = lib
-semaphore.c-dir = kernel
-thunk.S-dir = lib
-module.c-dir = kernel
+UNPROFILE_OBJS := stub_segv.o
+CFLAGS_stub_segv.o := $(CFLAGS_NO_HARDENING)
+
+include arch/um/scripts/Makefile.rules
 
-subdir- := util
+$(obj)/unmap.%: _c_flags = $(call unprofile,$(CFLAGS))
index 74eee5c..147bbf0 100644 (file)
@@ -8,6 +8,7 @@
 #include <asm/ptrace.h>
 #include <linux/sched.h>
 #include <linux/errno.h>
+#include <linux/mm.h>
 #include <asm/uaccess.h>
 #include <asm/elf.h>
 
@@ -136,9 +137,28 @@ void arch_switch(void)
 */
 }
 
+/* XXX Mostly copied from sys-i386 */
 int is_syscall(unsigned long addr)
 {
-       panic("is_syscall");
+       unsigned short instr;
+       int n;
+
+       n = copy_from_user(&instr, (void __user *) addr, sizeof(instr));
+       if(n){
+               /* access_process_vm() grants access to vsyscall and stub,
+                * while copy_from_user doesn't. Maybe access_process_vm is
+                * slow, but that doesn't matter, since it will be called only
+                * in case of singlestepping, if copy_from_user failed.
+                */
+               n = access_process_vm(current, addr, &instr, sizeof(instr), 0);
+               if(n != sizeof(instr)) {
+                       printk("is_syscall : failed to read instruction from "
+                              "0x%lx\n", addr);
+                       return(1);
+               }
+       }
+       /* sysenter */
+       return(instr == 0x050f);
 }
 
 int dump_fpu(struct pt_regs *regs, elf_fpregset_t *fpu )
index 73a7926..9edf114 100644 (file)
@@ -21,7 +21,7 @@
 #include "skas.h"
 
 static int copy_sc_from_user_skas(struct pt_regs *regs,
-                                 struct sigcontext *from)
+                                 struct sigcontext __user *from)
 {
        int err = 0;
 
@@ -54,8 +54,10 @@ static int copy_sc_from_user_skas(struct pt_regs *regs,
        return(err);
 }
 
-int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
-                        struct pt_regs *regs, unsigned long mask)
+int copy_sc_to_user_skas(struct sigcontext __user *to,
+                        struct _fpstate __user *to_fp,
+                        struct pt_regs *regs, unsigned long mask,
+                        unsigned long sp)
 {
         struct faultinfo * fi = &current->thread.arch.faultinfo;
        int err = 0;
@@ -70,7 +72,11 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
        err |= PUTREG(regs, RDI, to, rdi);
        err |= PUTREG(regs, RSI, to, rsi);
        err |= PUTREG(regs, RBP, to, rbp);
-       err |= PUTREG(regs, RSP, to, rsp);
+        /* Must use orignal RSP, which is passed in, rather than what's in
+         * the pt_regs, because that's already been updated to point at the
+         * signal frame.
+         */
+       err |= __put_user(sp, &to->rsp);
        err |= PUTREG(regs, RBX, to, rbx);
        err |= PUTREG(regs, RDX, to, rdx);
        err |= PUTREG(regs, RCX, to, rcx);
@@ -101,31 +107,46 @@ int copy_sc_to_user_skas(struct sigcontext *to, struct _fpstate *to_fp,
 #endif
 
 #ifdef CONFIG_MODE_TT
-int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext *from,
-                        int fpsize)
+int copy_sc_from_user_tt(struct sigcontext *to, struct sigcontext __user *from,
+                        int fpsize)
 {
-       struct _fpstate *to_fp, *from_fp;
-       unsigned long sigs;
-       int err;
-
-       to_fp = to->fpstate;
-       from_fp = from->fpstate;
-       sigs = to->oldmask;
-       err = copy_from_user(to, from, sizeof(*to));
-       to->oldmask = sigs;
-       return(err);
+       struct _fpstate *to_fp;
+       struct _fpstate __user *from_fp;
+       unsigned long sigs;
+       int err;
+
+       to_fp = to->fpstate;
+       sigs = to->oldmask;
+       err = copy_from_user(to, from, sizeof(*to));
+       from_fp = to->fpstate;
+       to->fpstate = to_fp;
+       to->oldmask = sigs;
+       if(to_fp != NULL)
+               err |= copy_from_user(to_fp, from_fp, fpsize);
+       return(err);
 }
 
-int copy_sc_to_user_tt(struct sigcontext *to, struct _fpstate *fp,
-                      struct sigcontext *from, int fpsize)
+int copy_sc_to_user_tt(struct sigcontext __user *to, struct _fpstate __user *fp,
+                      struct sigcontext *from, int fpsize, unsigned long sp)
 {
-       struct _fpstate *to_fp, *from_fp;
-       int err;
-
-       to_fp = (fp ? fp : (struct _fpstate *) (to + 1));
-       from_fp = from->fpstate;
-       err = copy_to_user(to, from, sizeof(*to));
-       return(err);
+       struct _fpstate __user *to_fp;
+       struct _fpstate *from_fp;
+       int err;
+
+       to_fp = (fp ? fp : (struct _fpstate __user *) (to + 1));
+       from_fp = from->fpstate;
+       err = copy_to_user(to, from, sizeof(*to));
+       /* The SP in the sigcontext is the updated one for the signal
+        * delivery.  The sp passed in is the original, and this needs
+        * to be restored, so we stick it in separately.
+        */
+       err |= copy_to_user(&SC_SP(to), &sp, sizeof(sp));
+
+       if(from_fp != NULL){
+               err |= copy_to_user(&to->fpstate, &to_fp, sizeof(to->fpstate));
+               err |= copy_to_user(to_fp, from_fp, fpsize);
+       }
+       return err;
 }
 
 #endif
@@ -140,17 +161,19 @@ static int copy_sc_from_user(struct pt_regs *to, void __user *from)
        return(ret);
 }
 
-static int copy_sc_to_user(struct sigcontext *to, struct _fpstate *fp,
-                          struct pt_regs *from, unsigned long mask)
+static int copy_sc_to_user(struct sigcontext __user *to,
+                          struct _fpstate __user *fp,
+                          struct pt_regs *from, unsigned long mask,
+                          unsigned long sp)
 {
        return(CHOOSE_MODE(copy_sc_to_user_tt(to, fp, UPT_SC(&from->regs),
-                                             sizeof(*fp)),
-                          copy_sc_to_user_skas(to, fp, from, mask)));
+                                             sizeof(*fp), sp),
+                          copy_sc_to_user_skas(to, fp, from, mask, sp)));
 }
 
 struct rt_sigframe
 {
-       char *pretcode;
+       char __user *pretcode;
        struct ucontext uc;
        struct siginfo info;
 };
@@ -163,12 +186,13 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
 {
        struct rt_sigframe __user *frame;
        struct _fpstate __user *fp = NULL;
+       unsigned long save_sp = PT_REGS_RSP(regs);
        int err = 0;
        struct task_struct *me = current;
 
        frame = (struct rt_sigframe __user *)
                round_down(stack_top - sizeof(struct rt_sigframe), 16) - 8;
-       ((unsigned char *) frame) -= 128;
+        frame = (struct rt_sigframe __user *) ((unsigned long) frame - 128);
 
        if (!access_ok(VERIFY_WRITE, fp, sizeof(struct _fpstate)))
                goto out;
@@ -186,14 +210,25 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
                        goto out;
        }
 
+       /* Update SP now because the page fault handler refuses to extend
+        * the stack if the faulting address is too far below the current
+        * SP, which frame now certainly is.  If there's an error, the original
+        * value is restored on the way out.
+        * When writing the sigcontext to the stack, we have to write the
+        * original value, so that's passed to copy_sc_to_user, which does
+        * the right thing with it.
+        */
+       PT_REGS_RSP(regs) = (unsigned long) frame;
+
        /* Create the ucontext.  */
        err |= __put_user(0, &frame->uc.uc_flags);
        err |= __put_user(0, &frame->uc.uc_link);
        err |= __put_user(me->sas_ss_sp, &frame->uc.uc_stack.ss_sp);
-       err |= __put_user(sas_ss_flags(PT_REGS_SP(regs)),
+       err |= __put_user(sas_ss_flags(save_sp),
                          &frame->uc.uc_stack.ss_flags);
        err |= __put_user(me->sas_ss_size, &frame->uc.uc_stack.ss_size);
-       err |= copy_sc_to_user(&frame->uc.uc_mcontext, fp, regs, set->sig[0]);
+       err |= copy_sc_to_user(&frame->uc.uc_mcontext, fp, regs, set->sig[0],
+               save_sp);
        err |= __put_user(fp, &frame->uc.uc_mcontext.fpstate);
        if (sizeof(*set) == 16) {
                __put_user(set->sig[0], &frame->uc.uc_sigmask.sig[0]);
@@ -210,10 +245,10 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
                err |= __put_user(ka->sa.sa_restorer, &frame->pretcode);
        else
                /* could use a vstub here */
-               goto out;
+               goto restore_sp;
 
        if (err)
-               goto out;
+               goto restore_sp;
 
        /* Set up registers for signal handler */
        {
@@ -231,10 +266,12 @@ int setup_signal_stack_si(unsigned long stack_top, int sig,
        PT_REGS_RSI(regs) = (unsigned long) &frame->info;
        PT_REGS_RDX(regs) = (unsigned long) &frame->uc;
        PT_REGS_RIP(regs) = (unsigned long) ka->sa.sa_handler;
-
-       PT_REGS_RSP(regs) = (unsigned long) frame;
  out:
-       return(err);
+       return err;
+
+restore_sp:
+       PT_REGS_RSP(regs) = save_sp;
+       return err;
 }
 
 long sys_rt_sigreturn(struct pt_regs *regs)
index 513d17c..899cebb 100644 (file)
@@ -1,6 +1,7 @@
 #include <stdio.h>
 #include <stddef.h>
 #include <signal.h>
+#include <sys/poll.h>
 #define __FRAME_OFFSETS
 #include <asm/ptrace.h>
 #include <asm/types.h>
@@ -16,71 +17,81 @@ typedef __u32 u32;
 #define DEFINE(sym, val) \
         asm volatile("\n->" #sym " %0 " #val : : "i" (val))
 
+#define DEFINE_LONGS(sym, val) \
+        asm volatile("\n->" #sym " %0 " #val : : "i" (val/sizeof(unsigned long)))
+
 #define OFFSET(sym, str, mem) \
        DEFINE(sym, offsetof(struct str, mem));
 
 void foo(void)
 {
-       OFFSET(SC_RBX, sigcontext, rbx);
-       OFFSET(SC_RCX, sigcontext, rcx);
-       OFFSET(SC_RDX, sigcontext, rdx);
-       OFFSET(SC_RSI, sigcontext, rsi);
-       OFFSET(SC_RDI, sigcontext, rdi);
-       OFFSET(SC_RBP, sigcontext, rbp);
-       OFFSET(SC_RAX, sigcontext, rax);
-       OFFSET(SC_R8, sigcontext, r8);
-       OFFSET(SC_R9, sigcontext, r9);
-       OFFSET(SC_R10, sigcontext, r10);
-       OFFSET(SC_R11, sigcontext, r11);
-       OFFSET(SC_R12, sigcontext, r12);
-       OFFSET(SC_R13, sigcontext, r13);
-       OFFSET(SC_R14, sigcontext, r14);
-       OFFSET(SC_R15, sigcontext, r15);
-       OFFSET(SC_IP, sigcontext, rip);
-       OFFSET(SC_SP, sigcontext, rsp);
-       OFFSET(SC_CR2, sigcontext, cr2);
-       OFFSET(SC_ERR, sigcontext, err);
-       OFFSET(SC_TRAPNO, sigcontext, trapno);
-       OFFSET(SC_CS, sigcontext, cs);
-       OFFSET(SC_FS, sigcontext, fs);
-       OFFSET(SC_GS, sigcontext, gs);
-       OFFSET(SC_EFLAGS, sigcontext, eflags);
-       OFFSET(SC_SIGMASK, sigcontext, oldmask);
+       OFFSET(HOST_SC_RBX, sigcontext, rbx);
+       OFFSET(HOST_SC_RCX, sigcontext, rcx);
+       OFFSET(HOST_SC_RDX, sigcontext, rdx);
+       OFFSET(HOST_SC_RSI, sigcontext, rsi);
+       OFFSET(HOST_SC_RDI, sigcontext, rdi);
+       OFFSET(HOST_SC_RBP, sigcontext, rbp);
+       OFFSET(HOST_SC_RAX, sigcontext, rax);
+       OFFSET(HOST_SC_R8, sigcontext, r8);
+       OFFSET(HOST_SC_R9, sigcontext, r9);
+       OFFSET(HOST_SC_R10, sigcontext, r10);
+       OFFSET(HOST_SC_R11, sigcontext, r11);
+       OFFSET(HOST_SC_R12, sigcontext, r12);
+       OFFSET(HOST_SC_R13, sigcontext, r13);
+       OFFSET(HOST_SC_R14, sigcontext, r14);
+       OFFSET(HOST_SC_R15, sigcontext, r15);
+       OFFSET(HOST_SC_IP, sigcontext, rip);
+       OFFSET(HOST_SC_SP, sigcontext, rsp);
+       OFFSET(HOST_SC_CR2, sigcontext, cr2);
+       OFFSET(HOST_SC_ERR, sigcontext, err);
+       OFFSET(HOST_SC_TRAPNO, sigcontext, trapno);
+       OFFSET(HOST_SC_CS, sigcontext, cs);
+       OFFSET(HOST_SC_FS, sigcontext, fs);
+       OFFSET(HOST_SC_GS, sigcontext, gs);
+       OFFSET(HOST_SC_EFLAGS, sigcontext, eflags);
+       OFFSET(HOST_SC_SIGMASK, sigcontext, oldmask);
 #if 0
-       OFFSET(SC_ORIG_RAX, sigcontext, orig_rax);
-       OFFSET(SC_DS, sigcontext, ds);
-       OFFSET(SC_ES, sigcontext, es);
-       OFFSET(SC_SS, sigcontext, ss);
+       OFFSET(HOST_SC_ORIG_RAX, sigcontext, orig_rax);
+       OFFSET(HOST_SC_DS, sigcontext, ds);
+       OFFSET(HOST_SC_ES, sigcontext, es);
+       OFFSET(HOST_SC_SS, sigcontext, ss);
 #endif
 
-       DEFINE(HOST_FRAME_SIZE, FRAME_SIZE);
-       DEFINE(HOST_RBX, RBX);
-       DEFINE(HOST_RCX, RCX);
-       DEFINE(HOST_RDI, RDI);
-       DEFINE(HOST_RSI, RSI);
-       DEFINE(HOST_RDX, RDX);
-       DEFINE(HOST_RBP, RBP);
-       DEFINE(HOST_RAX, RAX);
-       DEFINE(HOST_R8, R8);
-       DEFINE(HOST_R9, R9);
-       DEFINE(HOST_R10, R10);
-       DEFINE(HOST_R11, R11);
-       DEFINE(HOST_R12, R12);
-       DEFINE(HOST_R13, R13);
-       DEFINE(HOST_R14, R14);
-       DEFINE(HOST_R15, R15);
-       DEFINE(HOST_ORIG_RAX, ORIG_RAX);
-       DEFINE(HOST_CS, CS);
-       DEFINE(HOST_SS, SS);
-       DEFINE(HOST_EFLAGS, EFLAGS);
+       DEFINE_LONGS(HOST_FRAME_SIZE, FRAME_SIZE);
+       DEFINE(HOST_FP_SIZE, sizeof(struct _fpstate) / sizeof(unsigned long));
+       DEFINE(HOST_XFP_SIZE, 0);
+       DEFINE_LONGS(HOST_RBX, RBX);
+       DEFINE_LONGS(HOST_RCX, RCX);
+       DEFINE_LONGS(HOST_RDI, RDI);
+       DEFINE_LONGS(HOST_RSI, RSI);
+       DEFINE_LONGS(HOST_RDX, RDX);
+       DEFINE_LONGS(HOST_RBP, RBP);
+       DEFINE_LONGS(HOST_RAX, RAX);
+       DEFINE_LONGS(HOST_R8, R8);
+       DEFINE_LONGS(HOST_R9, R9);
+       DEFINE_LONGS(HOST_R10, R10);
+       DEFINE_LONGS(HOST_R11, R11);
+       DEFINE_LONGS(HOST_R12, R12);
+       DEFINE_LONGS(HOST_R13, R13);
+       DEFINE_LONGS(HOST_R14, R14);
+       DEFINE_LONGS(HOST_R15, R15);
+       DEFINE_LONGS(HOST_ORIG_RAX, ORIG_RAX);
+       DEFINE_LONGS(HOST_CS, CS);
+       DEFINE_LONGS(HOST_SS, SS);
+       DEFINE_LONGS(HOST_EFLAGS, EFLAGS);
 #if 0
-       DEFINE(HOST_FS, FS);
-       DEFINE(HOST_GS, GS);
-       DEFINE(HOST_DS, DS);
-       DEFINE(HOST_ES, ES);
+       DEFINE_LONGS(HOST_FS, FS);
+       DEFINE_LONGS(HOST_GS, GS);
+       DEFINE_LONGS(HOST_DS, DS);
+       DEFINE_LONGS(HOST_ES, ES);
 #endif
 
-       DEFINE(HOST_IP, RIP);
-       DEFINE(HOST_SP, RSP);
-       DEFINE(__UM_FRAME_SIZE, sizeof(struct user_regs_struct));
+       DEFINE_LONGS(HOST_IP, RIP);
+       DEFINE_LONGS(HOST_SP, RSP);
+       DEFINE(UM_FRAME_SIZE, sizeof(struct user_regs_struct));
+
+       /* XXX Duplicated between i386 and x86_64 */
+       DEFINE(UM_POLLIN, POLLIN);
+       DEFINE(UM_POLLPRI, POLLPRI);
+       DEFINE(UM_POLLOUT, POLLOUT);
 }
index d9530e4..cc1afeb 100644 (file)
@@ -13,6 +13,7 @@
 #include <asm/thread_info.h>   
 #include <asm/segment.h>
 #include <asm/vsyscall32.h>
+#include <asm/irqflags.h>
 #include <linux/linkage.h>
 
 #define __XEN_X86_64 1
@@ -92,6 +93,10 @@ ENTRY(ia32_sysenter_target)
        __swapgs 
        movq    %gs:pda_kernelstack, %rsp
        addq    $(PDA_STACKOFFSET),%rsp
+       /*
+        * No need to follow this irqs on/off section: the syscall
+        * disabled irqs, here we enable it straight after entry:
+        */
        XEN_UNBLOCK_EVENTS(%r11)        
        __sti
        movl    %ebp,%ebp               /* zero extension */
@@ -116,7 +121,7 @@ ENTRY(ia32_sysenter_target)
        pushq   %rax
        CFI_ADJUST_CFA_OFFSET 8
        cld
-       SAVE_ARGS 0,0,1
+       SAVE_ARGS 0,0,0
        /* no need to do an access_ok check here because rbp has been
           32bit zero extended */ 
 1:     movl    (%rbp),%r9d
@@ -137,6 +142,7 @@ sysenter_do_call:
        GET_THREAD_INFO(%r10)
        XEN_BLOCK_EVENTS(%r11)  
        __cli
+       TRACE_IRQS_OFF
        testl   $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
        jnz     int_ret_from_sys_call
        andl    $~TS_COMPAT,threadinfo_status(%r10)
@@ -151,6 +157,7 @@ sysenter_do_call:
        CFI_REGISTER rsp,rcx
        movl    $VSYSCALL32_SYSEXIT,%edx        /* User %eip */
        CFI_REGISTER rip,rdx
+       TRACE_IRQS_ON
        __swapgs
        XEN_UNBLOCK_EVENTS(%r11)                
        __sti           /* sti only takes effect after the next instruction */
@@ -175,6 +182,7 @@ sysenter_tracesys:
        .previous
        jmp     sysenter_do_call
        CFI_ENDPROC
+ENDPROC(ia32_sysenter_target)
 
 /*
  * 32bit SYSCALL instruction entry.
@@ -198,13 +206,17 @@ sysenter_tracesys:
  */    
 ENTRY(ia32_cstar_target)
        CFI_STARTPROC32 simple
-       CFI_DEF_CFA     rsp,0
+       CFI_DEF_CFA     rsp,PDA_STACKOFFSET
        CFI_REGISTER    rip,rcx
        /*CFI_REGISTER  rflags,r11*/
        __swapgs
        movl    %esp,%r8d
        CFI_REGISTER    rsp,r8
        movq    %gs:pda_kernelstack,%rsp
+       /*
+        * No need to follow this irqs on/off section: the syscall
+        * disabled irqs and here we enable it straight after entry:
+        */
        XEN_UNBLOCK_EVENTS(%r11)        
        __sti
        SAVE_ARGS 8,1,1
@@ -241,6 +253,7 @@ cstar_do_call:
        GET_THREAD_INFO(%r10)
        XEN_BLOCK_EVENTS(%r11)          
        __cli
+       TRACE_IRQS_OFF
        testl $_TIF_ALLWORK_MASK,threadinfo_flags(%r10)
        jnz  int_ret_from_sys_call
        andl $~TS_COMPAT,threadinfo_status(%r10)
@@ -249,6 +262,7 @@ cstar_do_call:
        CFI_REGISTER rip,rcx
        movl EFLAGS-ARGOFFSET(%rsp),%r11d       
        /*CFI_REGISTER rflags,r11*/
+       TRACE_IRQS_ON
        movl RSP-ARGOFFSET(%rsp),%esp
        CFI_RESTORE rsp
        __swapgs
@@ -271,6 +285,7 @@ cstar_tracesys:
        .quad 1b,ia32_badarg
        .previous
        jmp cstar_do_call
+END(ia32_cstar_target)
                                
 ia32_badarg:
        movq $-EFAULT,%rax
@@ -307,6 +322,10 @@ ENTRY(ia32_syscall)
        /*CFI_REL_OFFSET        cs,CS-RIP*/
        CFI_REL_OFFSET  rip,RIP-RIP
        __swapgs
+       /*
+        * No need to follow this irqs on/off section: the syscall
+        * disabled irqs and here we enable it straight after entry:
+        */
        XEN_UNBLOCK_EVENTS(%r11)
        __sti
        movq (%rsp),%rcx
@@ -341,16 +360,13 @@ ia32_tracesys:
        LOAD_ARGS ARGOFFSET  /* reload args from stack in case ptrace changed it */
        RESTORE_REST
        jmp ia32_do_syscall
+END(ia32_syscall)
 
 ia32_badsys:
        movq $0,ORIG_RAX-ARGOFFSET(%rsp)
        movq $-ENOSYS,RAX-ARGOFFSET(%rsp)
        jmp int_ret_from_sys_call
 
-ni_syscall:
-       movq %rax,%rdi
-       jmp  sys32_ni_syscall                   
-
 quiet_ni_syscall:
        movq $-ENOSYS,%rax
        ret
@@ -397,10 +413,10 @@ ENTRY(ia32_ptregs_common)
        RESTORE_REST
        jmp  ia32_sysret        /* misbalances the return cache */
        CFI_ENDPROC
+END(ia32_ptregs_common)
 
        .section .rodata,"a"
        .align 8
-       .globl ia32_sys_call_table
 ia32_sys_call_table:
        .quad sys_restart_syscall
        .quad sys_exit
@@ -458,7 +474,15 @@ ia32_sys_call_table:
        .quad quiet_ni_syscall                  /* old lock syscall holder */
        .quad compat_sys_ioctl
        .quad compat_sys_fcntl64                /* 55 */
-       .quad quiet_ni_syscall                  /* old mpx syscall holder */
+#ifdef CONFIG_TUX
+       .quad __sys_tux
+#else
+# ifdef CONFIG_TUX_MODULE
+       .quad sys_tux
+# else
+       .quad quiet_ni_syscall
+# endif
+#endif
        .quad sys_setpgid
        .quad quiet_ni_syscall                  /* old ulimit syscall holder */
        .quad sys32_olduname
@@ -679,7 +703,7 @@ ia32_sys_call_table:
        .quad sys_tgkill                /* 270 */
        .quad compat_sys_utimes
        .quad sys32_fadvise64_64
-       .quad quiet_ni_syscall  /* sys_vserver */
+       .quad sys32_vserver
        .quad sys_mbind
        .quad compat_sys_get_mempolicy  /* 275 */
        .quad sys_set_mempolicy
@@ -714,8 +738,8 @@ ia32_sys_call_table:
        .quad sys_readlinkat            /* 305 */
        .quad sys_fchmodat
        .quad sys_faccessat
-       .quad quiet_ni_syscall          /* pselect6 for now */
-       .quad quiet_ni_syscall          /* ppoll for now */
+       .quad compat_sys_pselect6
+       .quad compat_sys_ppoll
        .quad sys_unshare               /* 310 */
        .quad compat_sys_set_robust_list
        .quad compat_sys_get_robust_list
@@ -723,4 +747,5 @@ ia32_sys_call_table:
        .quad sys_sync_file_range
        .quad sys_tee
        .quad compat_sys_vmsplice
+       .quad compat_sys_move_pages
 ia32_syscall_end:              
index e99a6f7..9c416f0 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/init.h>
 #include <linux/stringify.h>
 #include <linux/security.h>
+#include <linux/vs_memory.h>
 #include <asm/proto.h>
 #include <asm/tlbflush.h>
 #include <asm/ia32_unistd.h>
@@ -47,7 +48,9 @@ static struct vm_operations_struct syscall32_vm_ops = {
 struct linux_binprm;
 
 /* Setup a VMA at program startup for the vsyscall page */
-int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
+int syscall32_setup_pages(struct linux_binprm *bprm, int exstack,
+                         unsigned long start_code,
+                         unsigned long interp_map_address)
 {
        int npages = (VSYSCALL32_END - VSYSCALL32_BASE) >> PAGE_SHIFT;
        struct vm_area_struct *vma;
@@ -75,7 +78,7 @@ int syscall32_setup_pages(struct linux_binprm *bprm, int exstack)
                kmem_cache_free(vm_area_cachep, vma);
                return ret;
        }
-       mm->total_vm += npages;
+       vx_vmpages_add(mm, npages);
        up_write(&mm->mmap_sem);
        return 0;
 }
index a805584..40f9fc1 100644 (file)
@@ -14,7 +14,6 @@
  *     Mikael Pettersson       :       PM converted to driver model.
  */
 
-#include <linux/config.h>
 #include <linux/init.h>
 
 #include <linux/mm.h>
@@ -175,7 +174,8 @@ asmlinkage void smp_error_interrupt(void)
           6: Received illegal vector
           7: Illegal register address
        */
-       printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
+       if (num_online_cpus() > 1)
+               printk (KERN_DEBUG "APIC error on CPU%d: %02x(%02x)\n",
                smp_processor_id(), v , v1);
        irq_exit();
 }
index 1e0b67b..8aed131 100644 (file)
@@ -1,7 +1,6 @@
 /* 
  * Handle the memory map.
  * The functions here do the job until bootmem takes over.
- * $Id: e820.c,v 1.4 2002/09/19 19:25:32 ak Exp $
  *
  *  Getting sanitize_e820_map() in sync with i386 version by applying change:
  *  -  Provisions for empty E820 memory regions (reported by certain BIOSes).
@@ -9,7 +8,6 @@
  *  Venkatesh Pallipadi <venkatesh.pallipadi@intel.com>
  *
  */
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <linux/init.h>
@@ -19,6 +17,7 @@
 #include <linux/kexec.h>
 #include <linux/module.h>
 
+#include <asm/pgtable.h>
 #include <asm/page.h>
 #include <asm/e820.h>
 #include <asm/proto.h>
@@ -74,7 +73,11 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
 #endif
        /* kernel code + 640k memory hole (later should not be needed, but 
           be paranoid for now) */
-       if (last >= 640*1024 && addr < __pa_symbol(&_end)) { 
+       if (last >= 640*1024 && addr < 1024*1024) {
+               *addrp = 1024*1024;
+               return 1;
+       }
+       if (last >= __pa_symbol(&_text) && last < __pa_symbol(&_end)) {
                *addrp = __pa_symbol(&_end);
                return 1;
        }
@@ -94,7 +97,6 @@ static inline int bad_addr(unsigned long *addrp, unsigned long size)
        return 0;
 } 
 
-#ifndef CONFIG_XEN
 /*
  * This function checks if any part of the range <start,end> is mapped
  * with type.
@@ -113,7 +115,6 @@ e820_any_mapped(unsigned long start, unsigned long end, unsigned type)
        } 
        return 0;
 }
-#endif
 
 /*
  * This function checks if the entire range <start,end> is mapped with type.
@@ -159,7 +160,7 @@ unsigned long __init find_e820_area(unsigned long start, unsigned long end, unsi
                        addr = start;
                if (addr > ei->addr + ei->size) 
                        continue; 
-               while (bad_addr(&addr, size) && addr+size < ei->addr + ei->size)
+               while (bad_addr(&addr, size) && addr+size <= ei->addr+ei->size)
                        ;
                last = addr + size;
                if (last > ei->addr + ei->size)
@@ -295,8 +296,10 @@ void __init e820_reserve_resources(struct e820entry *e820, int nr_map)
                         *  so we try it repeatedly and let the resource manager
                         *  test it.
                         */
+#ifndef CONFIG_XEN
                        request_resource(res, &code_resource);
                        request_resource(res, &data_resource);
+#endif
 #ifdef CONFIG_KEXEC
                        request_resource(res, &crashk_res);
 #endif
@@ -693,6 +696,7 @@ void __init parse_memmapopt(char *p, char **from)
 }
 
 unsigned long pci_mem_start = 0xaeedbabe;
+EXPORT_SYMBOL(pci_mem_start);
 
 /*
  * Search for the biggest gap in the low 32 bits of the e820
index f1c987f..bbbc199 100644 (file)
@@ -1,9 +1,9 @@
-#include <linux/config.h>
+
 #include <linux/console.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
 #include <linux/string.h>
-#include <linux/tty.h>
+#include <linux/screen_info.h>
 #include <asm/io.h>
 #include <asm/processor.h>
 #include <asm/fcntl.h>
index 05e7ce0..250d661 100644 (file)
@@ -32,7 +32,6 @@
  */
 
 #define ASSEMBLY 1
-#include <linux/config.h>
 #ifdef CONFIG_DEBUG_INFO
 #undef CONFIG_DEBUG_INFO
 #endif
@@ -49,6 +48,7 @@
 #include <asm/thread_info.h>
 #include <asm/hw_irq.h>
 #include <asm/page.h>
+#include <asm/irqflags.h>
 #include <asm/errno.h>
 #include <xen/interface/arch-x86_64.h>
 #include <xen/interface/features.h>
 #define retint_kernel retint_restore_args
 #endif 
 
+
+.macro TRACE_IRQS_IRETQ offset=ARGOFFSET
+#ifdef CONFIG_TRACE_IRQFLAGS
+       bt   $9,EFLAGS-\offset(%rsp)    /* interrupts off? */
+       jnc  1f
+       TRACE_IRQS_ON
+1:
+#endif
+.endm
+
 NMI_MASK = 0x80000000
        
 /*
@@ -195,6 +205,7 @@ rff_trace:
        GET_THREAD_INFO(%rcx)   
        jmp rff_action
        CFI_ENDPROC
+END(ret_from_fork)
 
 /*
  * System call entry. Upto 6 arguments in registers are supported.
@@ -229,11 +240,15 @@ rff_trace:
 
 ENTRY(system_call)
        CFI_STARTPROC   simple
-       CFI_DEF_CFA     rsp,0
+       CFI_DEF_CFA     rsp,PDA_STACKOFFSET
        CFI_REGISTER    rip,rcx
        /*CFI_REGISTER  rflags,r11*/
        SAVE_ARGS -8,0
        movq  %rax,ORIG_RAX-ARGOFFSET(%rsp) 
+       /*
+        * No need to follow this irqs off/on section - it's straight
+        * and short:
+        */
         XEN_UNBLOCK_EVENTS(%r11)        
        GET_THREAD_INFO(%rcx)
        testl $(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SECCOMP),threadinfo_flags(%rcx)
@@ -255,10 +270,15 @@ ret_from_sys_call:
 sysret_check:          
        GET_THREAD_INFO(%rcx)
         XEN_BLOCK_EVENTS(%rsi)        
+       TRACE_IRQS_OFF
        movl threadinfo_flags(%rcx),%edx
        andl %edi,%edx
        CFI_REMEMBER_STATE
        jnz  sysret_careful 
+       /*
+        * sysretq will re-enable interrupts:
+        */
+       TRACE_IRQS_ON
         XEN_UNBLOCK_EVENTS(%rsi)                
        CFI_REGISTER    rip,rcx
        RESTORE_ARGS 0,8,0
@@ -271,7 +291,8 @@ sysret_careful:
        CFI_RESTORE_STATE
        bt $TIF_NEED_RESCHED,%edx
        jnc sysret_signal
-        XEN_BLOCK_EVENTS(%rsi)        
+       TRACE_IRQS_ON
+        XEN_UNBLOCK_EVENTS(%rsi)        
        pushq %rdi
        CFI_ADJUST_CFA_OFFSET 8
        call schedule
@@ -281,6 +302,7 @@ sysret_careful:
 
        /* Handle a signal */ 
 sysret_signal:
+       TRACE_IRQS_ON
 /*     sti */
         XEN_UNBLOCK_EVENTS(%rsi)        
        testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
@@ -296,6 +318,7 @@ sysret_signal:
        /* Use IRET because user could have changed frame. This
           works because ptregscall_common has called FIXUP_TOP_OF_STACK. */
        cli
+       TRACE_IRQS_OFF
        jmp int_with_check
        
 badsys:
@@ -316,15 +339,11 @@ tracesys:
        ja  1f
        movq %r10,%rcx  /* fixup for C */
        call *sys_call_table(,%rax,8)
-       movq %rax,RAX-ARGOFFSET(%rsp)
-1:     SAVE_REST
-       movq %rsp,%rdi
-       call syscall_trace_leave
-       RESTORE_TOP_OF_STACK %rbx
-       RESTORE_REST
+1:     movq %rax,RAX-ARGOFFSET(%rsp)
        /* Use IRET because user could have changed frame */
        jmp int_ret_from_sys_call
        CFI_ENDPROC
+END(system_call)
                
 /* 
  * Syscall return path ending with IRET.
@@ -348,6 +367,7 @@ ENTRY(int_ret_from_sys_call)
        CFI_REL_OFFSET  r10,R10-ARGOFFSET
        CFI_REL_OFFSET  r11,R11-ARGOFFSET
         XEN_BLOCK_EVENTS(%rsi)
+       TRACE_IRQS_OFF
        testb $3,CS-ARGOFFSET(%rsp)
         jnz 1f
         /* Need to set the proper %ss (not NULL) for ring 3 iretq */
@@ -370,6 +390,7 @@ int_with_check:
 int_careful:
        bt $TIF_NEED_RESCHED,%edx
        jnc  int_very_careful
+       TRACE_IRQS_ON
 /*     sti */
         XEN_UNBLOCK_EVENTS(%rsi)
        pushq %rdi
@@ -377,11 +398,13 @@ int_careful:
        call schedule
        popq %rdi
        CFI_ADJUST_CFA_OFFSET -8
-       cli
+       XEN_BLOCK_EVENTS(%rsi)
+       TRACE_IRQS_OFF
        jmp int_with_check
 
        /* handle signals and tracing -- both require a full stack frame */
 int_very_careful:
+       TRACE_IRQS_ON
 /*     sti */
         XEN_UNBLOCK_EVENTS(%rsi)
        SAVE_REST
@@ -395,7 +418,8 @@ int_very_careful:
        popq %rdi
        CFI_ADJUST_CFA_OFFSET -8
        andl $~(_TIF_SYSCALL_TRACE|_TIF_SYSCALL_AUDIT|_TIF_SINGLESTEP),%edi
-       cli
+       XEN_BLOCK_EVENTS(%rsi)
+       TRACE_IRQS_OFF
        jmp int_restore_rest
        
 int_signal:
@@ -407,9 +431,11 @@ int_signal:
 1:     movl $_TIF_NEED_RESCHED,%edi    
 int_restore_rest:
        RESTORE_REST
-       cli
+       XEN_BLOCK_EVENTS(%rsi)
+       TRACE_IRQS_OFF
        jmp int_with_check
        CFI_ENDPROC
+END(int_ret_from_sys_call)
                
 /* 
  * Certain special system calls that need to save a complete full stack frame.
@@ -421,6 +447,7 @@ int_restore_rest:
        leaq    \func(%rip),%rax
        leaq    -ARGOFFSET+8(%rsp),\arg /* 8 for return address */
        jmp     ptregscall_common
+END(\label)
        .endm
 
        CFI_STARTPROC
@@ -450,6 +477,7 @@ ENTRY(ptregscall_common)
        CFI_REL_OFFSET rip, 0
        ret
        CFI_ENDPROC
+END(ptregscall_common)
        
 ENTRY(stub_execve)
        CFI_STARTPROC
@@ -464,6 +492,7 @@ ENTRY(stub_execve)
        RESTORE_REST
        jmp int_ret_from_sys_call
        CFI_ENDPROC
+END(stub_execve)
        
 /*
  * sigreturn is special because it needs to restore all registers on return.
@@ -481,6 +510,7 @@ ENTRY(stub_rt_sigreturn)
        RESTORE_REST
        jmp int_ret_from_sys_call
        CFI_ENDPROC
+END(stub_rt_sigreturn)
 
 /*
  * initial frame state for interrupts and exceptions
@@ -519,7 +549,7 @@ retint_restore_args:
        andb $1,%al                     # EAX[0] == IRET_EFLAGS.IF & event_mask
        jnz restore_all_enable_events   #        != 0 => enable event delivery
        XEN_PUT_VCPU_INFO(%rsi)
-               
+       TRACE_IRQS_IRETQ
        RESTORE_ARGS 0,8,0
        HYPERVISOR_IRET 0
        
@@ -528,6 +558,7 @@ retint_careful:
        CFI_RESTORE_STATE
        bt    $TIF_NEED_RESCHED,%edx
        jnc   retint_signal
+       TRACE_IRQS_ON
        XEN_UNBLOCK_EVENTS(%rsi)
 /*     sti */        
        pushq %rdi
@@ -535,14 +566,16 @@ retint_careful:
        call  schedule
        popq %rdi               
        CFI_ADJUST_CFA_OFFSET   -8
-       XEN_BLOCK_EVENTS(%rsi)          
        GET_THREAD_INFO(%rcx)
+       XEN_BLOCK_EVENTS(%rsi)          
+       TRACE_IRQS_OFF
 /*     cli */
        jmp retint_check
        
 retint_signal:
        testl $(_TIF_SIGPENDING|_TIF_NOTIFY_RESUME|_TIF_SINGLESTEP),%edx
        jz    retint_restore_args
+       TRACE_IRQS_ON
         XEN_UNBLOCK_EVENTS(%rsi)
        SAVE_REST
        movq $-1,ORIG_RAX(%rsp)                         
@@ -551,6 +584,7 @@ retint_signal:
        call do_notify_resume
        RESTORE_REST
         XEN_BLOCK_EVENTS(%rsi)         
+       TRACE_IRQS_OFF
        movl $_TIF_NEED_RESCHED,%edi
        GET_THREAD_INFO(%rcx)
        jmp retint_check
@@ -569,7 +603,9 @@ retint_kernel:
        call preempt_schedule_irq
        jmp retint_kernel       /* check again */
 #endif 
+
        CFI_ENDPROC
+END(common_interrupt)
        
 /*
  * APIC interrupts.
@@ -586,17 +622,21 @@ retint_kernel:
 #ifndef CONFIG_XEN
 ENTRY(thermal_interrupt)
        apicinterrupt THERMAL_APIC_VECTOR,smp_thermal_interrupt
+END(thermal_interrupt)
 
 ENTRY(threshold_interrupt)
        apicinterrupt THRESHOLD_APIC_VECTOR,mce_threshold_interrupt
+END(threshold_interrupt)
 
 #ifdef CONFIG_SMP      
 ENTRY(reschedule_interrupt)
        apicinterrupt RESCHEDULE_VECTOR,smp_reschedule_interrupt
+END(reschedule_interrupt)
 
        .macro INVALIDATE_ENTRY num
 ENTRY(invalidate_interrupt\num)
        apicinterrupt INVALIDATE_TLB_VECTOR_START+\num,smp_invalidate_interrupt 
+END(invalidate_interrupt\num)
        .endm
 
        INVALIDATE_ENTRY 0
@@ -610,17 +650,21 @@ ENTRY(invalidate_interrupt\num)
 
 ENTRY(call_function_interrupt)
        apicinterrupt CALL_FUNCTION_VECTOR,smp_call_function_interrupt
+END(call_function_interrupt)
 #endif
 
 #ifdef CONFIG_X86_LOCAL_APIC   
 ENTRY(apic_timer_interrupt)
        apicinterrupt LOCAL_TIMER_VECTOR,smp_apic_timer_interrupt
+END(apic_timer_interrupt)
 
 ENTRY(error_interrupt)
        apicinterrupt ERROR_APIC_VECTOR,smp_error_interrupt
+END(error_interrupt)
 
 ENTRY(spurious_interrupt)
        apicinterrupt SPURIOUS_APIC_VECTOR,smp_spurious_interrupt
+END(spurious_interrupt)
 #endif
 #endif /* !CONFIG_XEN */
                                
@@ -686,6 +730,7 @@ ENTRY(spurious_interrupt)
        addq    $EXCEPTION_STKSZ, per_cpu__init_tss + TSS_ist + (\ist - 1) * 8(%rbp)
        .endif
 /*     cli */
+       TRACE_IRQS_OFF
        XEN_BLOCK_EVENTS(%rsi)          
        .endm
 #endif
@@ -743,11 +788,12 @@ error_exit:
        RESTORE_REST
 /*     cli */
        XEN_BLOCK_EVENTS(%rsi)          
+       TRACE_IRQS_OFF
        GET_THREAD_INFO(%rcx)   
        testb $3,CS-ARGOFFSET(%rsp)
        jz retint_kernel
        movl  threadinfo_flags(%rcx),%edx
-       movl  $_TIF_WORK_MASK,%edi      
+       movl  $_TIF_WORK_MASK,%edi
        andl  %edi,%edx
        jnz   retint_careful
        jmp   retint_restore_args
@@ -777,7 +823,8 @@ error_kernelspace:
         je   error_swapgs
        jmp  error_sti
 #endif        
-       
+END(error_entry)
+               
 ENTRY(hypervisor_callback)
        zeroentry do_hypervisor_callback
         
@@ -936,9 +983,11 @@ ENTRY(kernel_thread)
        UNFAKE_STACK_FRAME
        ret
        CFI_ENDPROC
-
+ENDPROC(kernel_thread)
        
 child_rip:
+       pushq $0                # fake return address
+       CFI_STARTPROC
        /*
         * Here we are in the child and the registers are set as they were
         * at kernel_thread() invocation in the parent.
@@ -949,6 +998,8 @@ child_rip:
        # exit
        xorl %edi, %edi
        call do_exit
+       CFI_ENDPROC
+ENDPROC(child_rip)
 
 /*
  * execve(). This function needs to use IRET, not SYSRET, to set up all state properly.
@@ -979,19 +1030,24 @@ ENTRY(execve)
        UNFAKE_STACK_FRAME
        ret
        CFI_ENDPROC
+ENDPROC(execve)
 
 KPROBE_ENTRY(page_fault)
        errorentry do_page_fault
+END(page_fault)
        .previous .text
 
 ENTRY(coprocessor_error)
        zeroentry do_coprocessor_error
+END(coprocessor_error)
 
 ENTRY(simd_coprocessor_error)
        zeroentry do_simd_coprocessor_error     
+END(simd_coprocessor_error)
 
 ENTRY(device_not_available)
        zeroentry math_state_restore
+END(device_not_available)
 
        /* runs on exception stack */
 KPROBE_ENTRY(debug)
@@ -1001,6 +1057,7 @@ KPROBE_ENTRY(debug)
        zeroentry do_debug
 /*     jmp paranoid_exit */
        CFI_ENDPROC
+END(debug)
        .previous .text
 
 #if 0
@@ -1009,49 +1066,14 @@ KPROBE_ENTRY(nmi)
        INTR_FRAME
        pushq $-1
        CFI_ADJUST_CFA_OFFSET 8
-       paranoidentry do_nmi
-       /*
-        * "Paranoid" exit path from exception stack.
-        * Paranoid because this is used by NMIs and cannot take
-        * any kernel state for granted.
-        * We don't do kernel preemption checks here, because only
-        * NMI should be common and it does not enable IRQs and
-        * cannot get reschedule ticks.
-        */
-       /* ebx: no swapgs flag */
-paranoid_exit:
-       testl %ebx,%ebx                         /* swapgs needed? */
-       jnz paranoid_restore
-       testl $3,CS(%rsp)
-       jnz   paranoid_userspace
-paranoid_swapgs:       
-       swapgs
-paranoid_restore:      
-       RESTORE_ALL 8
-       iretq
-paranoid_userspace:    
-       GET_THREAD_INFO(%rcx)
-       movl threadinfo_flags(%rcx),%ebx
-       andl $_TIF_WORK_MASK,%ebx
-       jz paranoid_swapgs
-       movq %rsp,%rdi                  /* &pt_regs */
-       call sync_regs
-       movq %rax,%rsp                  /* switch stack for scheduling */
-       testl $_TIF_NEED_RESCHED,%ebx
-       jnz paranoid_schedule
-       movl %ebx,%edx                  /* arg3: thread flags */
-       sti
-       xorl %esi,%esi                  /* arg2: oldset */
-       movq %rsp,%rdi                  /* arg1: &pt_regs */
-       call do_notify_resume
-       cli
-       jmp paranoid_userspace
-paranoid_schedule:
-       sti
-       call schedule
-       cli
-       jmp paranoid_userspace
-       CFI_ENDPROC
+       paranoidentry do_nmi, 0, 0
+#ifdef CONFIG_TRACE_IRQFLAGS
+       paranoidexit 0
+#else
+       jmp paranoid_exit1
+       CFI_ENDPROC
+#endif
+END(nmi)
        .previous .text
 #endif        
 
@@ -1062,56 +1084,69 @@ KPROBE_ENTRY(int3)
        zeroentry do_int3
 /*     jmp paranoid_exit */
        CFI_ENDPROC
+END(int3)
        .previous .text
 
 ENTRY(overflow)
        zeroentry do_overflow
+END(overflow)
 
 ENTRY(bounds)
        zeroentry do_bounds
+END(bounds)
 
 ENTRY(invalid_op)
        zeroentry do_invalid_op 
+END(invalid_op)
 
 ENTRY(coprocessor_segment_overrun)
        zeroentry do_coprocessor_segment_overrun
+END(coprocessor_segment_overrun)
 
 ENTRY(reserved)
        zeroentry do_reserved
+END(reserved)
 
 #if 0
        /* runs on exception stack */
 ENTRY(double_fault)
        XCPT_FRAME
        paranoidentry do_double_fault
-       jmp paranoid_exit
+       jmp paranoid_exit1
        CFI_ENDPROC
+END(double_fault)
 #endif
 
 ENTRY(invalid_TSS)
        errorentry do_invalid_TSS
+END(invalid_TSS)
 
 ENTRY(segment_not_present)
        errorentry do_segment_not_present
-
+END(segment_not_present)
        /* runs on exception stack */
 ENTRY(stack_segment)
        XCPT_FRAME
        errorentry do_stack_segment
        CFI_ENDPROC
+END(stack_segment)
 
 KPROBE_ENTRY(general_protection)
        errorentry do_general_protection
+END(general_protection)
        .previous .text
 
 ENTRY(alignment_check)
        errorentry do_alignment_check
+END(alignment_check)
 
 ENTRY(divide_error)
        zeroentry do_divide_error
+END(divide_error)
 
 ENTRY(spurious_interrupt_bug)
        zeroentry do_spurious_interrupt_bug
+END(spurious_interrupt_bug)
 
 #ifdef CONFIG_X86_MCE
        /* runs on exception stack */
@@ -1120,22 +1155,59 @@ ENTRY(machine_check)
        pushq $0
        CFI_ADJUST_CFA_OFFSET 8 
        paranoidentry do_machine_check
-       jmp paranoid_exit
+       jmp paranoid_exit1
        CFI_ENDPROC
+END(machine_check)
 #endif
 
 ENTRY(call_softirq)
        CFI_STARTPROC
-       movq %gs:pda_irqstackptr,%rax
-       movq %rsp,%rdx
-       CFI_DEF_CFA_REGISTER    rdx
+       push %rbp
+       CFI_ADJUST_CFA_OFFSET   8
+       CFI_REL_OFFSET rbp,0
+       mov  %rsp,%rbp
+       CFI_DEF_CFA_REGISTER rbp
        incl %gs:pda_irqcount
-       cmove %rax,%rsp
-       pushq %rdx
-       /*todo CFI_DEF_CFA_EXPRESSION ...*/
+       cmove %gs:pda_irqstackptr,%rsp
+       push  %rbp                      # backlink for old unwinder
        call __do_softirq
-       popq %rsp
+       leaveq
        CFI_DEF_CFA_REGISTER    rsp
+       CFI_ADJUST_CFA_OFFSET   -8
        decl %gs:pda_irqcount
        ret
        CFI_ENDPROC
+ENDPROC(call_softirq)
+
+#ifdef CONFIG_STACK_UNWIND
+ENTRY(arch_unwind_init_running)
+       CFI_STARTPROC
+       movq    %r15, R15(%rdi)
+       movq    %r14, R14(%rdi)
+       xchgq   %rsi, %rdx
+       movq    %r13, R13(%rdi)
+       movq    %r12, R12(%rdi)
+       xorl    %eax, %eax
+       movq    %rbp, RBP(%rdi)
+       movq    %rbx, RBX(%rdi)
+       movq    (%rsp), %rcx
+       movq    %rax, R11(%rdi)
+       movq    %rax, R10(%rdi)
+       movq    %rax, R9(%rdi)
+       movq    %rax, R8(%rdi)
+       movq    %rax, RAX(%rdi)
+       movq    %rax, RCX(%rdi)
+       movq    %rax, RDX(%rdi)
+       movq    %rax, RSI(%rdi)
+       movq    %rax, RDI(%rdi)
+       movq    %rax, ORIG_RAX(%rdi)
+       movq    %rcx, RIP(%rdi)
+       leaq    8(%rsp), %rcx
+       movq    $__KERNEL_CS, CS(%rdi)
+       movq    %rax, EFLAGS(%rdi)
+       movq    %rcx, RSP(%rdi)
+       movq    $__KERNEL_DS, SS(%rdi)
+       jmpq    *%rdx
+       CFI_ENDPROC
+ENDPROC(arch_unwind_init_running)
+#endif
index 1903a5c..c04ae58 100644 (file)
@@ -8,7 +8,6 @@
  * Martin Bligh, Andi Kleen, James Bottomley, John Stultz, and
  * James Cleverdon.
  */
-#include <linux/config.h>
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <linux/string.h>
index 711c823..3079d64 100644 (file)
@@ -10,7 +10,6 @@
  *
  * Hacked to pieces for Xen by Chris Wright.
  */
-#include <linux/config.h>
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <linux/string.h>
@@ -82,24 +81,6 @@ static void xen_init_apic_ldr(void)
        return;
 }
 
-static void xen_send_IPI_allbutself(int vector)
-{
-       /*
-        * if there are no other CPUs in the system then
-        * we get an APIC send error if we try to broadcast.
-        * thus we have to avoid sending IPIs in this case.
-        */
-       Dprintk("%s\n", __FUNCTION__);
-       if (num_online_cpus() > 1)
-               xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
-}
-
-static void xen_send_IPI_all(int vector)
-{
-       Dprintk("%s\n", __FUNCTION__);
-       xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
-}
-
 static void xen_send_IPI_mask(cpumask_t cpumask, int vector)
 {
        unsigned long mask = cpus_addr(cpumask)[0];
@@ -118,6 +99,40 @@ static void xen_send_IPI_mask(cpumask_t cpumask, int vector)
        local_irq_restore(flags);
 }
 
+static void xen_send_IPI_allbutself(int vector)
+{
+#ifdef CONFIG_HOTPLUG_CPU
+       int hotplug = 1;
+#else
+       int hotplug = 0;
+#endif
+       /*
+        * if there are no other CPUs in the system then
+        * we get an APIC send error if we try to broadcast.
+        * thus we have to avoid sending IPIs in this case.
+        */
+       Dprintk("%s\n", __FUNCTION__);
+       if (hotplug || vector == NMI_VECTOR) {
+               cpumask_t allbutme = cpu_online_map;
+
+               cpu_clear(smp_processor_id(), allbutme);
+
+               if (!cpus_empty(allbutme))
+                       xen_send_IPI_mask(allbutme, vector);
+       } else if (num_online_cpus() > 1) {
+               xen_send_IPI_shortcut(APIC_DEST_ALLBUT, vector, APIC_DEST_LOGICAL);
+       }
+}
+
+static void xen_send_IPI_all(int vector)
+{
+       Dprintk("%s\n", __FUNCTION__);
+       if (vector == NMI_VECTOR)
+               xen_send_IPI_mask(cpu_online_map, vector);
+       else
+               xen_send_IPI_shortcut(APIC_DEST_ALLINC, vector, APIC_DEST_LOGICAL);
+}
+
 #ifdef CONFIG_XEN_PRIVILEGED_GUEST
 static int xen_apic_id_registered(void)
 {
@@ -135,8 +150,7 @@ static unsigned int xen_cpu_mask_to_apicid(cpumask_t cpumask)
 
 static unsigned int phys_pkg_id(int index_msb)
 {
-       u32 ebx;
-
+       int ebx;
        Dprintk("%s\n", __FUNCTION__);
        ebx = cpuid_ebx(1);
        return ((ebx >> 24) & 0xFF) >> index_msb;
index 17ef607..02fad59 100644 (file)
 #include <linux/linkage.h>
 #include <linux/threads.h>
 #include <linux/init.h>
+#include <linux/elfnote.h>
 #include <asm/desc.h>
 #include <asm/segment.h>
 #include <asm/page.h>
 #include <asm/msr.h>
 #include <asm/cache.h>
 
+#include <xen/interface/elfnote.h>
+
        .text
        .section .bootstrap.text
        .code64
@@ -139,6 +142,7 @@ ENTRY(idt_table)
 ENTRY(empty_zero_page)
        .skip PAGE_SIZE
 
+#ifdef CONFIG_XEN_COMPAT_030002
 /*
  * __xen_guest information
  */
@@ -158,12 +162,8 @@ ENTRY(empty_zero_page)
        .ascii  ",XEN_VER=xen-3.0"
        .ascii  ",VIRT_BASE=0x"
                utoh __START_KERNEL_map
-#ifdef CONFIG_XEN_COMPAT_030002
        .ascii  ",ELF_PADDR_OFFSET=0x"
                utoh __START_KERNEL_map
-#else
-       .ascii  ",ELF_PADDR_OFFSET=0x0"
-#endif /* !CONFIG_XEN_COMPAT_030002 */
        .ascii  ",VIRT_ENTRY=0x"
                utoh (__START_KERNEL_map + __PHYSICAL_START + VIRT_ENTRY_OFFSET)
        .ascii  ",HYPERCALL_PAGE=0x"
@@ -174,3 +174,18 @@ ENTRY(empty_zero_page)
        .ascii           "|supervisor_mode_kernel"
        .ascii  ",LOADER=generic"
        .byte   0
+#endif /* CONFIG_XEN_COMPAT_030002 */
+       
+       ELFNOTE(Xen, XEN_ELFNOTE_GUEST_OS,       .asciz, "linux")
+       ELFNOTE(Xen, XEN_ELFNOTE_GUEST_VERSION,  .asciz, "2.6")
+       ELFNOTE(Xen, XEN_ELFNOTE_XEN_VERSION,    .asciz, "xen-3.0")
+       ELFNOTE(Xen, XEN_ELFNOTE_VIRT_BASE,      .quad,  __START_KERNEL_map)
+#ifdef CONFIG_XEN_COMPAT_030002
+       ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .quad,  __START_KERNEL_map)
+#else
+       ELFNOTE(Xen, XEN_ELFNOTE_PADDR_OFFSET,   .quad,  0)
+#endif /* !CONFIG_XEN_COMPAT_030002 */
+       ELFNOTE(Xen, XEN_ELFNOTE_ENTRY,          .quad,  startup_64)
+       ELFNOTE(Xen, XEN_ELFNOTE_HYPERCALL_PAGE, .quad,  hypercall_page)
+       ELFNOTE(Xen, XEN_ELFNOTE_FEATURES,       .asciz, "writable_page_tables|writable_descriptor_tables|auto_translated_physmap|pae_pgdir_above_4gb|supervisor_mode_kernel")
+       ELFNOTE(Xen, XEN_ELFNOTE_LOADER,         .asciz, "generic")
index de53871..28587d2 100644 (file)
@@ -3,8 +3,6 @@
  *
  *  Copyright (C) 2000 Andrea Arcangeli <andrea@suse.de> SuSE
  *
- *  $Id: head64.c,v 1.22 2001/07/06 14:28:20 ak Exp $
- *
  *  Jun Nakajima <jun.nakajima@intel.com>
  *     Modified for Xen.
  */
@@ -114,7 +112,6 @@ void __init x86_64_start_kernel(char * real_mode_data)
                        xen_start_info->nr_pt_frames;
        }
 
-
        machine_to_phys_mapping = (unsigned long *)MACH2PHYS_VIRT_START;
        machine_to_phys_nr_ents = MACH2PHYS_NR_ENTRIES;
        if (HYPERVISOR_memory_op(XENMEM_machphys_mapping, &mapping) == 0) {
@@ -130,6 +127,11 @@ void __init x86_64_start_kernel(char * real_mode_data)
        asm volatile("lidt %0" :: "m" (idt_descr));
 #endif
 
+       /*
+        * This must be called really, really early:
+        */
+       lockdep_init();
+
        for (i = 0; i < NR_CPUS; i++)
                cpu_pda(i) = &boot_cpu_pda[i];
 
index a6ba277..9ba203b 100644 (file)
@@ -25,7 +25,6 @@
 #include <linux/init.h>
 #include <linux/delay.h>
 #include <linux/sched.h>
-#include <linux/config.h>
 #include <linux/smp_lock.h>
 #include <linux/mc146818rtc.h>
 #include <linux/acpi.h>
@@ -41,6 +40,7 @@
 #include <asm/mach_apic.h>
 #include <asm/acpi.h>
 #include <asm/dma.h>
+#include <asm/nmi.h>
 
 #define __apicdebuginit  __init
 
@@ -58,6 +58,7 @@ static struct { int pin, apic; } ioapic_i8259 = { -1, -1 };
 #endif
 
 static DEFINE_SPINLOCK(ioapic_lock);
+static DEFINE_SPINLOCK(vector_lock);
 
 /*
  * # of IRQ routing registers
@@ -321,6 +322,18 @@ __setup("enable_8254_timer", setup_enable_8254_timer);
 #include <linux/pci_ids.h>
 #include <linux/pci.h>
 
+
+#ifdef CONFIG_ACPI
+
+static int nvidia_hpet_detected __initdata;
+
+static int __init nvidia_hpet_check(unsigned long phys, unsigned long size)
+{
+       nvidia_hpet_detected = 1;
+       return 0;
+}
+#endif
+
 /* Temporary Hack. Nvidia and VIA boards currently only work with IO-APIC
    off. Check for an Nvidia or VIA PCI bridge and turn it off.
    Use pci direct infrastructure because this runs before the PCI subsystem. 
@@ -355,7 +368,7 @@ void __init check_ioapic(void)
                                vendor &= 0xffff;
                                switch (vendor) { 
                                case PCI_VENDOR_ID_VIA:
-#ifdef CONFIG_GART_IOMMU
+#ifdef CONFIG_IOMMU
                                        if ((end_pfn > MAX_DMA32_PFN ||
                                             force_iommu) &&
                                            !iommu_aperture_allowed) {
@@ -367,11 +380,19 @@ void __init check_ioapic(void)
                                        return;
                                case PCI_VENDOR_ID_NVIDIA:
 #ifdef CONFIG_ACPI
-                                       /* All timer overrides on Nvidia
-                                          seem to be wrong. Skip them. */
-                                       acpi_skip_timer_override = 1;
-                                       printk(KERN_INFO 
-            "Nvidia board detected. Ignoring ACPI timer override.\n");
+                                       /*
+                                        * All timer overrides on Nvidia are
+                                        * wrong unless HPET is enabled.
+                                        */
+                                       nvidia_hpet_detected = 0;
+                                       acpi_table_parse(ACPI_HPET,
+                                                       nvidia_hpet_check);
+                                       if (nvidia_hpet_detected == 0) {
+                                               acpi_skip_timer_override = 1;
+                                               printk(KERN_INFO "Nvidia board "
+                                                   "detected. Ignoring ACPI "
+                                                   "timer override.\n");
+                                       }
 #endif
                                        /* RED-PEN skip them on mptables too? */
                                        return;
@@ -868,11 +889,16 @@ u8 irq_vector[NR_IRQ_VECTORS] __read_mostly;
 int assign_irq_vector(int irq)
 {
        struct physdev_irq irq_op;
-  
+       unsigned long flags;
+
        BUG_ON(irq != AUTO_ASSIGN && (unsigned)irq >= NR_IRQ_VECTORS);
-       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0)
-               return IO_APIC_VECTOR(irq);
 
+       spin_lock_irqsave(&vector_lock, flags);
+
+       if (irq != AUTO_ASSIGN && IO_APIC_VECTOR(irq) > 0) {
+               spin_unlock_irqrestore(&vector_lock, flags);
+               return IO_APIC_VECTOR(irq);
+       }
        irq_op.irq = irq;
        if (HYPERVISOR_physdev_op(PHYSDEVOP_alloc_irq_vector, &irq_op))
                return -ENOSPC;
@@ -881,6 +907,7 @@ int assign_irq_vector(int irq)
        if (irq != AUTO_ASSIGN)
                IO_APIC_VECTOR(irq) = irq_op.vector;
 
+       spin_unlock_irqrestore(&vector_lock, flags);
        return irq_op.vector;
 }
 
@@ -893,23 +920,18 @@ static struct hw_interrupt_type ioapic_edge_type;
 #define IOAPIC_EDGE    0
 #define IOAPIC_LEVEL   1
 
-static inline void ioapic_register_intr(int irq, int vector, unsigned long trigger)
+static void ioapic_register_intr(int irq, int vector, unsigned long trigger)
 {
-       if (use_pci_vector() && !platform_legacy_irq(irq)) {
-               if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-                               trigger == IOAPIC_LEVEL)
-                       irq_desc[vector].handler = &ioapic_level_type;
-               else
-                       irq_desc[vector].handler = &ioapic_edge_type;
-               set_intr_gate(vector, interrupt[vector]);
-       } else  {
-               if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
-                               trigger == IOAPIC_LEVEL)
-                       irq_desc[irq].handler = &ioapic_level_type;
-               else
-                       irq_desc[irq].handler = &ioapic_edge_type;
-               set_intr_gate(vector, interrupt[irq]);
-       }
+       unsigned idx;
+
+       idx = use_pci_vector() && !platform_legacy_irq(irq) ? vector : irq;
+
+       if ((trigger == IOAPIC_AUTO && IO_APIC_irq_trigger(irq)) ||
+                       trigger == IOAPIC_LEVEL)
+               irq_desc[idx].chip = &ioapic_level_type;
+       else
+               irq_desc[idx].chip = &ioapic_edge_type;
+       set_intr_gate(vector, interrupt[idx]);
 }
 #else
 #define ioapic_register_intr(_irq,_vector,_trigger) ((void)0)
@@ -1014,7 +1036,7 @@ static void __init setup_ExtINT_IRQ0_pin(unsigned int apic, unsigned int pin, in
         * The timer IRQ doesn't have to know that behind the
         * scene we have a 8259A-master in AEOI mode ...
         */
-       irq_desc[0].handler = &ioapic_edge_type;
+       irq_desc[0].chip = &ioapic_edge_type;
 
        /*
         * Add it to the IO-APIC irq-routing table:
@@ -1659,6 +1681,13 @@ static void set_ioapic_affinity_vector (unsigned int vector,
 #endif // CONFIG_SMP
 #endif // CONFIG_PCI_MSI
 
+static int ioapic_retrigger(unsigned int irq)
+{
+       send_IPI_self(IO_APIC_VECTOR(irq));
+
+       return 1;
+}
+
 /*
  * Level and edge triggered IO-APIC interrupts need different handling,
  * so we use two separate IRQ descriptors. Edge triggered IRQs can be
@@ -1679,6 +1708,7 @@ static struct hw_interrupt_type ioapic_edge_type __read_mostly = {
 #ifdef CONFIG_SMP
        .set_affinity = set_ioapic_affinity,
 #endif
+       .retrigger      = ioapic_retrigger,
 };
 
 static struct hw_interrupt_type ioapic_level_type __read_mostly = {
@@ -1692,6 +1722,7 @@ static struct hw_interrupt_type ioapic_level_type __read_mostly = {
 #ifdef CONFIG_SMP
        .set_affinity = set_ioapic_affinity,
 #endif
+       .retrigger      = ioapic_retrigger,
 };
 #endif /* !CONFIG_XEN */
 
@@ -1728,7 +1759,7 @@ static inline void init_IO_APIC_traps(void)
 #ifndef CONFIG_XEN
                        else
                                /* Strange. Oh, well.. */
-                               irq_desc[irq].handler = &no_irq_type;
+                               irq_desc[irq].chip = &no_irq_type;
 #endif
                }
        }
@@ -1947,7 +1978,7 @@ static inline void check_timer(void)
        apic_printk(APIC_VERBOSE, KERN_INFO "...trying to set up timer as Virtual Wire IRQ...");
 
        disable_8259A_irq(0);
-       irq_desc[0].handler = &lapic_irq_type;
+       irq_desc[0].chip = &lapic_irq_type;
        apic_write(APIC_LVT0, APIC_DM_FIXED | vector);  /* Fixed mode */
        enable_8259A_irq(0);
 
index 4db9a64..8f533d2 100644 (file)
@@ -10,6 +10,7 @@
 #include <asm/msr.h>
 #include <asm/mce.h>
 #include <asm/hw_irq.h>
+#include <asm/idle.h>
 
 static DEFINE_PER_CPU(unsigned long, next_check);
 
@@ -19,6 +20,7 @@ asmlinkage void smp_thermal_interrupt(void)
 
        ack_APIC_irq();
 
+       exit_idle();
        irq_enter();
        if (time_before(jiffies, __get_cpu_var(next_check)))
                goto done;
@@ -42,7 +44,7 @@ done:
        irq_exit();
 }
 
-static void __init intel_init_thermal(struct cpuinfo_x86 *c)
+static void __cpuinit intel_init_thermal(struct cpuinfo_x86 *c)
 {
        u32 l, h;
        int tm2 = 0;
@@ -78,7 +80,7 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c)
 
        h = THERMAL_APIC_VECTOR;
        h |= (APIC_DM_FIXED | APIC_LVT_MASKED);
-       apic_write_around(APIC_LVTTHMR, h);
+       apic_write(APIC_LVTTHMR, h);
 
        rdmsr(MSR_IA32_THERM_INTERRUPT, l, h);
        wrmsr(MSR_IA32_THERM_INTERRUPT, l | 0x03, h);
@@ -87,13 +89,13 @@ static void __init intel_init_thermal(struct cpuinfo_x86 *c)
        wrmsr(MSR_IA32_MISC_ENABLE, l | (1 << 3), h);
 
        l = apic_read(APIC_LVTTHMR);
-       apic_write_around(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
+       apic_write(APIC_LVTTHMR, l & ~APIC_LVT_MASKED);
        printk(KERN_INFO "CPU%d: Thermal monitoring enabled (%s)\n",
                cpu, tm2 ? "TM2" : "TM1");
        return;
 }
 
-void __init mce_intel_feature_init(struct cpuinfo_x86 *c)
+void __cpuinit mce_intel_feature_init(struct cpuinfo_x86 *c)
 {
        intel_init_thermal(c);
 }
index a43ca1e..57a8244 100644 (file)
@@ -16,7 +16,6 @@
 #include <linux/mm.h>
 #include <linux/init.h>
 #include <linux/delay.h>
-#include <linux/config.h>
 #include <linux/bootmem.h>
 #include <linux/smp_lock.h>
 #include <linux/kernel_stat.h>
index 910bb1b..a89ff91 100644 (file)
@@ -10,7 +10,6 @@
  *     Andi Kleen.
  *
  *     CPU hotplug support - ashok.raj@intel.com
- *  $Id: process.c,v 1.38 2002/01/15 10:08:03 ak Exp $
  * 
  *  Jun Nakajima <jun.nakajima@intel.com> 
  *     Modified for Xen
@@ -120,10 +119,10 @@ void xen_idle(void)
        if (need_resched())
                local_irq_enable();
        else {
-               clear_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status &= ~TS_POLLING;
                smp_mb__after_clear_bit();
                safe_halt();
-               set_thread_flag(TIF_POLLING_NRFLAG);
+               current_thread_info()->status |= TS_POLLING;
        }
 }
 
@@ -152,8 +151,7 @@ static inline void play_dead(void)
  */
 void cpu_idle (void)
 {
-       set_thread_flag(TIF_POLLING_NRFLAG);
-
+       current_thread_info()->status |= TS_POLLING;
        /* endless idle loop with no priority at all */
        while (1) {
                while (!need_resched()) {
@@ -223,7 +221,7 @@ void __show_regs(struct pt_regs * regs)
                system_utsname.version);
        printk("RIP: %04lx:[<%016lx>] ", regs->cs & 0xffff, regs->rip);
        printk_address(regs->rip); 
-       printk("\nRSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss, regs->rsp,
+       printk("RSP: %04lx:%016lx  EFLAGS: %08lx\n", regs->ss, regs->rsp,
                regs->eflags);
        printk("RAX: %016lx RBX: %016lx RCX: %016lx\n",
               regs->rax, regs->rbx, regs->rcx);
@@ -256,7 +254,7 @@ void show_regs(struct pt_regs *regs)
 {
        printk("CPU %d:", smp_processor_id());
        __show_regs(regs);
-       show_trace(&regs->rsp);
+       show_trace(NULL, regs, &regs->rsp);
 }
 
 /*
@@ -301,8 +299,12 @@ void flush_thread(void)
        struct task_struct *tsk = current;
        struct thread_info *t = current_thread_info();
 
-       if (t->flags & _TIF_ABI_PENDING)
+       if (t->flags & _TIF_ABI_PENDING) {
                t->flags ^= (_TIF_ABI_PENDING | _TIF_IA32);
+               if (t->flags & _TIF_IA32)
+                       current_thread_info()->status |= TS_COMPAT;
+       }
+
 
        tsk->thread.debugreg0 = 0;
        tsk->thread.debugreg1 = 0;
@@ -336,7 +338,6 @@ static inline void set_32bit_tls(struct task_struct *t, int tls, u32 addr)
        struct user_desc ud = { 
                .base_addr = addr,
                .limit = 0xfffff,
-               .contents = (3 << 3), /* user */
                .seg_32bit = 1,
                .limit_in_pages = 1,
                .useable = 1,
@@ -459,18 +460,6 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
        struct physdev_set_iobitmap iobmp_op;
        multicall_entry_t _mcl[8], *mcl = _mcl;
 
-       /*
-        * This is basically '__unlazy_fpu', except that we queue a
-        * multicall to indicate FPU task switch, rather than
-        * synchronously trapping to Xen.
-        */
-       if (prev_p->thread_info->status & TS_USEDFPU) {
-               __save_init_fpu(prev_p); /* _not_ save_init_fpu() */
-               mcl->op      = __HYPERVISOR_fpu_taskswitch;
-               mcl->args[0] = 1;
-               mcl++;
-       }
-
        /*
         * Reload esp0, LDT and the page table pointer:
         */
@@ -538,12 +527,19 @@ __switch_to(struct task_struct *prev_p, struct task_struct *next_p)
        if (next->gs)
                HYPERVISOR_set_segment_base(SEGBASE_GS_USER, next->gs); 
 
+       /* Must be after DS reload */
+       if (prev_p->thread_info->status & TS_USEDFPU) {
+               __save_init_fpu(prev_p); /* _not_ save_init_fpu() */
+               HYPERVISOR_fpu_taskswitch(1);
+       }
+
        /* 
-        * Switch the PDA.
+        * Switch the PDA and FPU contexts.
         */
        prev->userrsp = read_pda(oldrsp); 
        write_pda(oldrsp, next->userrsp); 
        write_pda(pcurrent, next_p); 
+
        write_pda(kernelstack,
                  task_stack_page(next_p) + THREAD_SIZE - PDA_STACKOFFSET);
 
index 8b09fb2..501ef70 100644 (file)
@@ -5,8 +5,6 @@
  *
  *  Nov 2001 Dave Jones <davej@suse.de>
  *  Forked from i386 setup code.
- *
- *  $Id$
  */
 
 /*
 #include <linux/slab.h>
 #include <linux/user.h>
 #include <linux/a.out.h>
-#include <linux/tty.h>
+#include <linux/screen_info.h>
 #include <linux/ioport.h>
 #include <linux/delay.h>
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/initrd.h>
 #include <linux/highmem.h>
 #include <asm/setup.h>
 #include <asm/mach_apic.h>
 #include <asm/numa.h>
-#include <asm/swiotlb.h>
 #include <asm/sections.h>
-#include <asm/gart-mapping.h>
 #include <asm/dmi.h>
 #ifdef CONFIG_XEN
 #include <linux/percpu.h>
+#include <linux/pfn.h>
 #include <xen/interface/physdev.h>
 #include "setup_arch_pre.h"
 #include <asm/hypervisor.h>
 #include <xen/interface/nmi.h>
 #include <xen/features.h>
-#define PFN_UP(x)       (((x) + PAGE_SIZE-1) >> PAGE_SHIFT)
-#define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
+#include <xen/xencons.h>
 #include <asm/mach-xen/setup_arch_post.h>
 #include <xen/interface/memory.h>
 
 extern unsigned long start_pfn;
 extern struct edid_info edid_info;
+EXPORT_SYMBOL_GPL(edid_info);
 
 shared_info_t *HYPERVISOR_shared_info = (shared_info_t *)empty_zero_page;
 EXPORT_SYMBOL(HYPERVISOR_shared_info);
@@ -116,6 +112,7 @@ EXPORT_SYMBOL(xen_start_info);
  */
 
 struct cpuinfo_x86 boot_cpu_data __read_mostly;
+EXPORT_SYMBOL(boot_cpu_data);
 
 unsigned long mmu_cr4_features;
 
@@ -144,6 +141,7 @@ char dmi_alloc_data[DMI_MAX_DATA];
  * Setup options
  */
 struct screen_info screen_info;
+EXPORT_SYMBOL(screen_info);
 struct sys_desc_table_struct {
        unsigned short length;
        unsigned char table[0];
@@ -151,6 +149,9 @@ struct sys_desc_table_struct {
 
 struct edid_info edid_info;
 struct e820map e820;
+#ifdef CONFIG_XEN
+struct e820map machine_e820;
+#endif
 
 extern int root_mountflags;
 
@@ -197,7 +198,6 @@ struct resource code_resource = {
 
 #define IORESOURCE_ROM (IORESOURCE_BUSY | IORESOURCE_READONLY | IORESOURCE_MEM)
 
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
 static struct resource system_rom_resource = {
        .name = "System ROM",
        .start = 0xf0000,
@@ -226,19 +226,16 @@ static struct resource adapter_rom_resources[] = {
        { .name = "Adapter ROM", .start = 0, .end = 0,
                .flags = IORESOURCE_ROM }
 };
-#endif
 
 #define ADAPTER_ROM_RESOURCES \
        (sizeof adapter_rom_resources / sizeof adapter_rom_resources[0])
 
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
 static struct resource video_rom_resource = {
        .name = "Video ROM",
        .start = 0xc0000,
        .end = 0xc7fff,
        .flags = IORESOURCE_ROM,
 };
-#endif
 
 static struct resource video_ram_resource = {
        .name = "Video RAM area",
@@ -247,7 +244,6 @@ static struct resource video_ram_resource = {
        .flags = IORESOURCE_RAM,
 };
 
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST) || !defined(CONFIG_XEN)
 #define romsignature(x) (*(unsigned short *)(x) == 0xaa55)
 
 static int __init romchecksum(unsigned char *rom, unsigned long length)
@@ -265,6 +261,12 @@ static void __init probe_roms(void)
        unsigned char *rom;
        int           i;
 
+#ifdef CONFIG_XEN
+       /* Nothing to do if not running in dom0. */
+       if (!is_initial_xendomain())
+               return;
+#endif
+
        /* video rom */
        upper = adapter_rom_resources[0].start;
        for (start = video_rom_resource.start; start < upper; start += 2048) {
@@ -323,7 +325,6 @@ static void __init probe_roms(void)
                start = adapter_rom_resources[i++].end & ~2047UL;
        }
 }
-#endif
 
 /* Check for full argument with no trailing characters */
 static int fullarg(char *p, char *arg)
@@ -526,80 +527,6 @@ contig_initmem_init(unsigned long start_pfn, unsigned long end_pfn)
 } 
 #endif
 
-/* Use inline assembly to define this because the nops are defined 
-   as inline assembly strings in the include files and we cannot 
-   get them easily into strings. */
-asm("\t.data\nk8nops: " 
-    K8_NOP1 K8_NOP2 K8_NOP3 K8_NOP4 K8_NOP5 K8_NOP6
-    K8_NOP7 K8_NOP8); 
-    
-extern unsigned char k8nops[];
-static unsigned char *k8_nops[ASM_NOP_MAX+1] = { 
-     NULL,
-     k8nops,
-     k8nops + 1,
-     k8nops + 1 + 2,
-     k8nops + 1 + 2 + 3,
-     k8nops + 1 + 2 + 3 + 4,
-     k8nops + 1 + 2 + 3 + 4 + 5,
-     k8nops + 1 + 2 + 3 + 4 + 5 + 6,
-     k8nops + 1 + 2 + 3 + 4 + 5 + 6 + 7,
-}; 
-
-extern char __vsyscall_0;
-
-/* Replace instructions with better alternatives for this CPU type.
-
-   This runs before SMP is initialized to avoid SMP problems with
-   self modifying code. This implies that assymetric systems where
-   APs have less capabilities than the boot processor are not handled. 
-   In this case boot with "noreplacement". */ 
-void apply_alternatives(void *start, void *end) 
-{ 
-       struct alt_instr *a; 
-       int diff, i, k;
-       for (a = start; (void *)a < end; a++) { 
-               u8 *instr;
-
-               if (!boot_cpu_has(a->cpuid))
-                       continue;
-
-               BUG_ON(a->replacementlen > a->instrlen); 
-               instr = a->instr;
-               /* vsyscall code is not mapped yet. resolve it manually. */
-               if (instr >= (u8 *)VSYSCALL_START && instr < (u8*)VSYSCALL_END)
-                       instr -= VSYSCALL_START - (unsigned long)&__vsyscall_0;
-               __inline_memcpy(instr, a->replacement, a->replacementlen);
-               diff = a->instrlen - a->replacementlen; 
-
-               /* Pad the rest with nops */
-               for (i = a->replacementlen; diff > 0; diff -= k, i += k) {
-                       k = diff;
-                       if (k > ASM_NOP_MAX)
-                               k = ASM_NOP_MAX;
-                       __inline_memcpy(instr + i, k8_nops[k], k);
-               } 
-       }
-} 
-
-static int no_replacement __initdata = 0; 
-void __init alternative_instructions(void)
-{
-       extern struct alt_instr __alt_instructions[], __alt_instructions_end[];
-       if (no_replacement) 
-               return;
-       apply_alternatives(__alt_instructions, __alt_instructions_end);
-}
-
-static int __init noreplacement_setup(char *s)
-{ 
-     no_replacement = 1; 
-     return 1;
-} 
-
-__setup("noreplacement", noreplacement_setup); 
-
 #if defined(CONFIG_EDD) || defined(CONFIG_EDD_MODULE)
 struct edd edd;
 #ifdef CONFIG_EDD_MODULE
@@ -652,22 +579,16 @@ static void discover_ebda(void)
 
 void __init setup_arch(char **cmdline_p)
 {
-       unsigned long kernel_end;
-
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
-       struct e820entry *machine_e820;
        struct xen_memory_map memmap;
-#endif
 
 #ifdef CONFIG_XEN
        /* Register a call for panic conditions. */
        atomic_notifier_chain_register(&panic_notifier_list, &xen_panic_block);
 
        ROOT_DEV = MKDEV(RAMDISK_MAJOR,0); 
-       kernel_end = 0;         /* dummy */
        screen_info = SCREEN_INFO;
 
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
+       if (is_initial_xendomain()) {
                /* This is drawn from a dump from vgacon:startup in
                 * standard Linux. */
                screen_info.orig_video_mode = 3;
@@ -676,6 +597,17 @@ void __init setup_arch(char **cmdline_p)
                screen_info.orig_video_cols = 80;
                screen_info.orig_video_ega_bx = 3;
                screen_info.orig_video_points = 16;
+               screen_info.orig_y = screen_info.orig_video_lines - 1;
+               if (xen_start_info->console.dom0.info_size >=
+                   sizeof(struct dom0_vga_console_info)) {
+                       const struct dom0_vga_console_info *info =
+                               (struct dom0_vga_console_info *)(
+                                       (char *)xen_start_info +
+                                       xen_start_info->console.dom0.info_off);
+                       dom0_init_screen_info(info);
+               }
+               xen_start_info->console.domU.mfn = 0;
+               xen_start_info->console.domU.evtchn = 0;
        } else
                screen_info.orig_video_isVGA = 0;
 
@@ -762,12 +694,12 @@ void __init setup_arch(char **cmdline_p)
                                (table_end - table_start) << PAGE_SHIFT);
 
        /* reserve kernel */
-       kernel_end = round_up(__pa_symbol(&_end),PAGE_SIZE);
-       reserve_bootmem_generic(HIGH_MEMORY, kernel_end - HIGH_MEMORY);
+       reserve_bootmem_generic(__pa_symbol(&_text),
+                               __pa_symbol(&_end) - __pa_symbol(&_text));
 
 #ifdef CONFIG_XEN
        /* reserve physmap, start info and initial page tables */
-       reserve_bootmem(kernel_end, (table_start<<PAGE_SHIFT)-kernel_end);
+       reserve_bootmem(__pa_symbol(&_end), (table_start<<PAGE_SHIFT)-__pa_symbol(&_end));
 #else
        /*
         * reserve physical page 0 - it's a special BIOS page on many boxes,
@@ -836,7 +768,7 @@ void __init setup_arch(char **cmdline_p)
 #endif /* !CONFIG_XEN */
 #ifdef CONFIG_KEXEC
        if (crashk_res.start != crashk_res.end) {
-               reserve_bootmem(crashk_res.start,
+               reserve_bootmem_generic(crashk_res.start,
                        crashk_res.end - crashk_res.start + 1);
        }
 #endif
@@ -854,7 +786,7 @@ void __init setup_arch(char **cmdline_p)
 
                if (!xen_feature(XENFEAT_auto_translated_physmap)) {
                        /* Make sure we have a large enough P->M table. */
-                       phys_to_machine_mapping = alloc_bootmem(
+                       phys_to_machine_mapping = alloc_bootmem_pages(
                                end_pfn * sizeof(unsigned long));
                        memset(phys_to_machine_mapping, ~0,
                               end_pfn * sizeof(unsigned long));
@@ -871,7 +803,7 @@ void __init setup_arch(char **cmdline_p)
                         * list of frames that make up the p2m table. Used by
                          * save/restore.
                         */
-                       pfn_to_mfn_frame_list_list = alloc_bootmem(PAGE_SIZE);
+                       pfn_to_mfn_frame_list_list = alloc_bootmem_pages(PAGE_SIZE);
                        HYPERVISOR_shared_info->arch.pfn_to_mfn_frame_list_list =
                                virt_to_mfn(pfn_to_mfn_frame_list_list);
 
@@ -881,7 +813,7 @@ void __init setup_arch(char **cmdline_p)
                                        k++;
                                        BUG_ON(k>=fpp);
                                        pfn_to_mfn_frame_list[k] =
-                                               alloc_bootmem(PAGE_SIZE);
+                                               alloc_bootmem_pages(PAGE_SIZE);
                                        pfn_to_mfn_frame_list_list[k] =
                                                virt_to_mfn(pfn_to_mfn_frame_list[k]);
                                        j=0;
@@ -894,11 +826,10 @@ void __init setup_arch(char **cmdline_p)
 
        }
 
-       if (xen_start_info->flags & SIF_INITDOMAIN)
+       if (is_initial_xendomain())
                dmi_scan_machine();
 
-       if ( ! (xen_start_info->flags & SIF_INITDOMAIN))
-       {
+       if (!is_initial_xendomain()) {
                acpi_disabled = 1;
 #ifdef  CONFIG_ACPI
                acpi_ht = 0;
@@ -951,23 +882,19 @@ void __init setup_arch(char **cmdline_p)
         * Request address space for all standard RAM and ROM resources
         * and also for regions reported as reserved by the e820.
         */
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
        probe_roms();
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
-               machine_e820 = alloc_bootmem_low_pages(PAGE_SIZE);
-
+#ifdef CONFIG_XEN
+       if (is_initial_xendomain()) {
                memmap.nr_entries = E820MAX;
-               set_xen_guest_handle(memmap.buffer, machine_e820);
+               set_xen_guest_handle(memmap.buffer, machine_e820.map);
 
-               BUG_ON(HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap));
+               if (HYPERVISOR_memory_op(XENMEM_machine_memory_map, &memmap))
+                       BUG();
+               machine_e820.nr_map = memmap.nr_entries;
 
-               e820_reserve_resources(machine_e820, memmap.nr_entries);
-       } else if (!(xen_start_info->flags & SIF_INITDOMAIN))
-               e820_reserve_resources(e820.map, e820.nr_map);
-#elif defined(CONFIG_XEN)
-       e820_reserve_resources(e820.map, e820.nr_map);
+               e820_reserve_resources(machine_e820.map, machine_e820.nr_map);
+       }
 #else
-       probe_roms();
        e820_reserve_resources(e820.map, e820.nr_map);
 #endif
 
@@ -980,19 +907,13 @@ void __init setup_arch(char **cmdline_p)
                request_resource(&ioport_resource, &standard_io_resources[i]);
        }
 
-#if defined(CONFIG_XEN_PRIVILEGED_GUEST)
-       if (xen_start_info->flags & SIF_INITDOMAIN) {
-               e820_setup_gap(machine_e820, memmap.nr_entries);
-               free_bootmem(__pa(machine_e820), PAGE_SIZE);
-       }
-#elif !defined(CONFIG_XEN)
+#ifdef CONFIG_XEN
+       if (is_initial_xendomain())
+               e820_setup_gap(machine_e820.map, machine_e820.nr_map);
+#else
        e820_setup_gap(e820.map, e820.nr_map);
 #endif
 
-#ifdef CONFIG_GART_IOMMU
-       iommu_hole_init();
-#endif
-
 #ifdef CONFIG_XEN
        {
                struct physdev_set_iopl set_iopl;
@@ -1000,11 +921,7 @@ void __init setup_arch(char **cmdline_p)
                set_iopl.iopl = 1;
                HYPERVISOR_physdev_op(PHYSDEVOP_set_iopl, &set_iopl);
 
-               if (xen_start_info->flags & SIF_INITDOMAIN) {
-                       if (!(xen_start_info->flags & SIF_PRIVILEGED))
-                               panic("Xen granted us console access "
-                                     "but not privileged status");
-                      
+               if (is_initial_xendomain()) {
 #ifdef CONFIG_VT
 #if defined(CONFIG_VGA_CONSOLE)
                        conswitchp = &vga_con;
@@ -1013,9 +930,10 @@ void __init setup_arch(char **cmdline_p)
 #endif
 #endif
                } else {
-                       extern int console_use_vt;
-                       console_use_vt = 0;
-               }
+#if defined(CONFIG_VT) && defined(CONFIG_DUMMY_CONSOLE)
+                    conswitchp = &dummy_con;
+#endif
+                }
        }
 #else  /* CONFIG_XEN */
 
@@ -1116,24 +1034,32 @@ static int nearby_node(int apicid)
 static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
 {
 #ifdef CONFIG_SMP
-       int cpu = smp_processor_id();
        unsigned bits;
 #ifdef CONFIG_NUMA
+       int cpu = smp_processor_id();
        int node = 0;
        unsigned apicid = hard_smp_processor_id();
 #endif
+       unsigned ecx = cpuid_ecx(0x80000008);
 
-       bits = 0;
-       while ((1 << bits) < c->x86_max_cores)
-               bits++;
+       c->x86_max_cores = (ecx & 0xff) + 1;
+
+       /* CPU telling us the core id bits shift? */
+       bits = (ecx >> 12) & 0xF;
+
+       /* Otherwise recompute */
+       if (bits == 0) {
+               while ((1 << bits) < c->x86_max_cores)
+                       bits++;
+       }
 
        /* Low order bits define the core id (index of core in socket) */
-       cpu_core_id[cpu] = phys_proc_id[cpu] & ((1 << bits)-1);
+       c->cpu_core_id = c->phys_proc_id & ((1 << bits)-1);
        /* Convert the APIC ID into the socket ID */
-       phys_proc_id[cpu] = phys_pkg_id(bits);
+       c->phys_proc_id = phys_pkg_id(bits);
 
 #ifdef CONFIG_NUMA
-       node = phys_proc_id[cpu];
+       node = c->phys_proc_id;
        if (apicid_to_node[apicid] != NUMA_NO_NODE)
                node = apicid_to_node[apicid];
        if (!node_online(node)) {
@@ -1146,7 +1072,7 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
                   but in the same order as the HT nodeids.
                   If that doesn't result in a usable node fall back to the
                   path for the previous case.  */
-               int ht_nodeid = apicid - (phys_proc_id[0] << bits);
+               int ht_nodeid = apicid - (cpu_data[0].phys_proc_id << bits);
                if (ht_nodeid >= 0 &&
                    apicid_to_node[ht_nodeid] != NUMA_NO_NODE)
                        node = apicid_to_node[ht_nodeid];
@@ -1156,15 +1082,13 @@ static void __init amd_detect_cmp(struct cpuinfo_x86 *c)
        }
        numa_set_node(cpu, node);
 
-       printk(KERN_INFO "CPU %d/%x(%d) -> Node %d -> Core %d\n",
-                       cpu, apicid, c->x86_max_cores, node, cpu_core_id[cpu]);
+       printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
 #endif
 #endif
 }
 
-static int __init init_amd(struct cpuinfo_x86 *c)
+static void __init init_amd(struct cpuinfo_x86 *c)
 {
-       int r;
        unsigned level;
 
 #ifdef CONFIG_SMP
@@ -1197,8 +1121,8 @@ static int __init init_amd(struct cpuinfo_x86 *c)
        if (c->x86 >= 6)
                set_bit(X86_FEATURE_FXSAVE_LEAK, &c->x86_capability);
 
-       r = get_model_name(c);
-       if (!r) { 
+       level = get_model_name(c);
+       if (!level) { 
                switch (c->x86) { 
                case 15:
                        /* Should distinguish Models here, but this is only
@@ -1213,13 +1137,12 @@ static int __init init_amd(struct cpuinfo_x86 *c)
        if (c->x86_power & (1<<8))
                set_bit(X86_FEATURE_CONSTANT_TSC, &c->x86_capability);
 
-       if (c->extended_cpuid_level >= 0x80000008) {
-               c->x86_max_cores = (cpuid_ecx(0x80000008) & 0xff) + 1;
-
+       /* Multi core CPU? */
+       if (c->extended_cpuid_level >= 0x80000008)
                amd_detect_cmp(c);
-       }
 
-       return r;
+       /* Fix cpuid4 emulation for more */
+       num_cache_leaves = 3;
 }
 
 static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
@@ -1232,8 +1155,10 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
        cpuid(1, &eax, &ebx, &ecx, &edx);
 
 
-       if (!cpu_has(c, X86_FEATURE_HT) || cpu_has(c, X86_FEATURE_CMP_LEGACY))
+       if (!cpu_has(c, X86_FEATURE_HT))
                return;
+       if (cpu_has(c, X86_FEATURE_CMP_LEGACY))
+               goto out;
 
        smp_num_siblings = (ebx & 0xff0000) >> 16;
 
@@ -1248,10 +1173,7 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
                }
 
                index_msb = get_count_order(smp_num_siblings);
-               phys_proc_id[cpu] = phys_pkg_id(index_msb);
-
-               printk(KERN_INFO  "CPU: Physical Processor ID: %d\n",
-                      phys_proc_id[cpu]);
+               c->phys_proc_id = phys_pkg_id(index_msb);
 
                smp_num_siblings = smp_num_siblings / c->x86_max_cores;
 
@@ -1259,12 +1181,13 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
 
                core_bits = get_count_order(c->x86_max_cores);
 
-               cpu_core_id[cpu] = phys_pkg_id(index_msb) &
+               c->cpu_core_id = phys_pkg_id(index_msb) &
                                               ((1 << core_bits) - 1);
-
-               if (c->x86_max_cores > 1)
-                       printk(KERN_INFO  "CPU: Processor Core ID: %d\n",
-                              cpu_core_id[cpu]);
+       }
+out:
+       if ((c->x86_max_cores * smp_num_siblings) > 1) {
+               printk(KERN_INFO  "CPU: Physical Processor ID: %d\n", c->phys_proc_id);
+               printk(KERN_INFO  "CPU: Processor Core ID: %d\n", c->cpu_core_id);
        }
 #endif
 }
@@ -1274,15 +1197,12 @@ static void __cpuinit detect_ht(struct cpuinfo_x86 *c)
  */
 static int __cpuinit intel_num_cpu_cores(struct cpuinfo_x86 *c)
 {
-       unsigned int eax;
+       unsigned int eax, t;
 
        if (c->cpuid_level < 4)
                return 1;
 
-       __asm__("cpuid"
-               : "=a" (eax)
-               : "0" (4), "c" (0)
-               : "bx", "dx");
+       cpuid_count(4, 0, &eax, &t, &t, &t);
 
        if (eax & 0x1f)
                return ((eax >> 26) + 1);
@@ -1295,16 +1215,17 @@ static void srat_detect_node(void)
 #ifdef CONFIG_NUMA
        unsigned node;
        int cpu = smp_processor_id();
+       int apicid = hard_smp_processor_id();
 
        /* Don't do the funky fallback heuristics the AMD version employs
           for now. */
-       node = apicid_to_node[hard_smp_processor_id()];
+       node = apicid_to_node[apicid];
        if (node == NUMA_NO_NODE)
-               node = 0;
+               node = first_node(node_online_map);
        numa_set_node(cpu, node);
 
        if (acpi_numa > 0)
-               printk(KERN_INFO "CPU %d -> Node %d\n", cpu, node);
+               printk(KERN_INFO "CPU %d/%x -> Node %d\n", cpu, apicid, node);
 #endif
 }
 
@@ -1314,6 +1235,13 @@ static void __cpuinit init_intel(struct cpuinfo_x86 *c)
        unsigned n;
 
        init_intel_cacheinfo(c);
+       if (c->cpuid_level > 9 ) {
+               unsigned eax = cpuid_eax(10);
+               /* Check for version and the number of counters */
+               if ((eax & 0xff) && (((eax>>8) & 0xff) > 1))
+                       set_bit(X86_FEATURE_ARCH_PERFMON, &c->x86_capability);
+       }
+
        n = c->extended_cpuid_level;
        if (n >= 0x80000008) {
                unsigned eax = cpuid_eax(0x80000008);
@@ -1405,7 +1333,7 @@ void __cpuinit early_identify_cpu(struct cpuinfo_x86 *c)
        }
 
 #ifdef CONFIG_SMP
-       phys_proc_id[smp_processor_id()] = (cpuid_ebx(1) >> 24) & 0xff;
+       c->phys_proc_id = (cpuid_ebx(1) >> 24) & 0xff;
 #endif
 }
 
@@ -1532,7 +1460,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, "syscall", NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, "nx", NULL, "mmxext", NULL,
-               NULL, "fxsr_opt", "rdtscp", NULL, NULL, "lm", "3dnowext", "3dnow",
+               NULL, "fxsr_opt", NULL, "rdtscp", NULL, "lm", "3dnowext", "3dnow",
 
                /* Transmeta-defined */
                "recovery", "longrun", NULL, "lrti", NULL, NULL, NULL, NULL,
@@ -1544,7 +1472,7 @@ static int show_cpuinfo(struct seq_file *m, void *v)
                "cxmmx", NULL, "cyrix_arr", "centaur_mcr", NULL,
                "constant_tsc", NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+               "up", NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
 
                /* Intel-defined (#2) */
@@ -1613,9 +1541,9 @@ static int show_cpuinfo(struct seq_file *m, void *v)
 #ifdef CONFIG_SMP
        if (smp_num_siblings * c->x86_max_cores > 1) {
                int cpu = c - cpu_data;
-               seq_printf(m, "physical id\t: %d\n", phys_proc_id[cpu]);
+               seq_printf(m, "physical id\t: %d\n", c->phys_proc_id);
                seq_printf(m, "siblings\t: %d\n", cpus_weight(cpu_core_map[cpu]));
-               seq_printf(m, "core id\t\t: %d\n", cpu_core_id[cpu]);
+               seq_printf(m, "core id\t\t: %d\n", c->cpu_core_id);
                seq_printf(m, "cpu cores\t: %d\n", c->booted_cores);
        }
 #endif 
index 53c333a..ed98f5e 100644 (file)
@@ -3,13 +3,11 @@
  * Copyright (C) 1995  Linus Torvalds
  * Copyright 2001, 2002, 2003 SuSE Labs / Andi Kleen.
  * See setup.c for older changelog.
- * $Id: setup64.c,v 1.12 2002/03/21 10:09:17 ak Exp $
  *
  * Jun Nakajima <jun.nakajima@intel.com> 
  *   Modified for Xen
  *
  */ 
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -38,6 +36,7 @@ char x86_boot_params[BOOT_PARAM_SIZE] __initdata = {0,};
 cpumask_t cpu_initialized __cpuinitdata = CPU_MASK_NONE;
 
 struct x8664_pda *_cpu_pda[NR_CPUS] __read_mostly;
+EXPORT_SYMBOL(_cpu_pda);
 struct x8664_pda boot_cpu_pda[NR_CPUS] __cacheline_aligned;
 
 #ifndef CONFIG_X86_NO_IDT
@@ -47,6 +46,7 @@ struct desc_ptr idt_descr = { 256 * 16 - 1, (unsigned long) idt_table };
 char boot_cpu_stack[IRQSTACKSIZE] __attribute__((section(".bss.page_aligned")));
 
 unsigned long __supported_pte_mask __read_mostly = ~0UL;
+EXPORT_SYMBOL(__supported_pte_mask);
 static int do_not_nx __cpuinitdata = 0;
 
 /* noexec=on|off
@@ -55,7 +55,7 @@ Control non executable mappings for 64bit processes.
 on     Enable(default)
 off    Disable
 */ 
-void __init nonx_setup(const char *str)
+void __init nonx_setup(char *str)
 {
        if (!strncmp(str, "on", 2)) {
                 __supported_pte_mask |= _PAGE_NX; 
@@ -64,8 +64,8 @@ void __init nonx_setup(const char *str)
                do_not_nx = 1;
                __supported_pte_mask &= ~_PAGE_NX;
         }
-       return 1;
-} 
+}
+
 /*
  * Great future plan:
  * Declare PDA itself and support (irqstack,tss,pgd) as per cpu data.
@@ -225,6 +225,7 @@ void __cpuinit cpu_init (void)
        int cpu = stack_smp_processor_id();
 #ifndef CONFIG_X86_NO_TSS
        struct tss_struct *t = &per_cpu(init_tss, cpu);
+       struct orig_ist *orig_ist = &per_cpu(orig_ist, cpu);
        unsigned long v; 
        char *estacks = NULL; 
        unsigned i;
@@ -298,7 +299,7 @@ void __cpuinit cpu_init (void)
                        estacks += EXCEPTION_STKSZ;
                        break;
                }
-               t->ist[v] = (unsigned long)estacks;
+               orig_ist->ist[v] = t->ist[v] = (unsigned long)estacks;
        }
 
        t->io_bitmap_base = offsetof(struct tss_struct, io_bitmap);
index 1b9fad1..e1de0ab 100644 (file)
@@ -209,7 +209,7 @@ int __cpuinit init_smp_flush(void)
 {
        int i;
        for_each_cpu_mask(i, cpu_possible_map) {
-               spin_lock_init(&per_cpu(flush_state.tlbstate_lock, i));
+               spin_lock_init(&per_cpu(flush_state, i).tlbstate_lock);
        }
        return 0;
 }
@@ -230,6 +230,7 @@ void flush_tlb_current_task(void)
                flush_tlb_others(cpu_mask, mm, FLUSH_ALL);
        preempt_enable();
 }
+EXPORT_SYMBOL(flush_tlb_current_task);
 
 void flush_tlb_mm (struct mm_struct * mm)
 {
@@ -250,6 +251,7 @@ void flush_tlb_mm (struct mm_struct * mm)
 
        preempt_enable();
 }
+EXPORT_SYMBOL(flush_tlb_mm);
 
 void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
 {
@@ -272,6 +274,7 @@ void flush_tlb_page(struct vm_area_struct * vma, unsigned long va)
 
        preempt_enable();
 }
+EXPORT_SYMBOL(flush_tlb_page);
 
 static void do_flush_tlb_all(void* info)
 {
@@ -469,6 +472,7 @@ int smp_call_function (void (*func) (void *info), void *info, int nonatomic,
        spin_unlock(&call_lock);
        return 0;
 }
+EXPORT_SYMBOL(smp_call_function);
 
 void smp_stop_cpu(void)
 {
@@ -500,7 +504,7 @@ void smp_send_stop(void)
 #endif
        /* Don't deadlock on the call lock in panic */
        if (!spin_trylock(&call_lock)) {
-               /* ignore locking because we have paniced anyways */
+               /* ignore locking because we have panicked anyways */
                nolock = 1;
        }
        __smp_call_function(smp_really_stop_cpu, NULL, 0, 0);
@@ -572,13 +576,13 @@ int safe_smp_processor_id(void)
 #ifdef CONFIG_XEN
        return smp_processor_id();
 #else
-       int apicid, i;
+       unsigned apicid, i;
 
        if (disable_apic)
                return 0;
 
        apicid = hard_smp_processor_id();
-       if (x86_cpu_to_apicid[apicid] == apicid)
+       if (apicid < NR_CPUS && x86_cpu_to_apicid[apicid] == apicid)
                return apicid;
 
        for (i = 0; i < NR_CPUS; ++i) {
index 457a276..13c6d3d 100644 (file)
@@ -6,15 +6,12 @@
  *
  *  Pentium III FXSR, SSE support
  *     Gareth Hughes <gareth@valinux.com>, May 2000
- *
- *  $Id: traps.c,v 1.36 2002/03/24 11:09:10 ak Exp $
  */
 
 /*
  * 'Traps.c' handles hardware traps and faults after we have saved some
  * state in 'entry.S'.
  */
-#include <linux/config.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
@@ -31,6 +28,7 @@
 #include <linux/nmi.h>
 #include <linux/kprobes.h>
 #include <linux/kexec.h>
+#include <linux/unwind.h>
 
 #include <asm/system.h>
 #include <asm/uaccess.h>
 #include <asm/i387.h>
 #include <asm/kdebug.h>
 #include <asm/processor.h>
-
+#include <asm/unwind.h>
 #include <asm/smp.h>
 #include <asm/pgalloc.h>
 #include <asm/pda.h>
 #include <asm/proto.h>
 #include <asm/nmi.h>
+#include <asm/stacktrace.h>
 
 asmlinkage void divide_error(void);
 asmlinkage void debug(void);
@@ -72,18 +71,20 @@ asmlinkage void spurious_interrupt_bug(void);
 
 ATOMIC_NOTIFIER_HEAD(die_chain);
 
+extern char last_sysfs_file[];
+
 int register_die_notifier(struct notifier_block *nb)
 {
        vmalloc_sync_all();
        return atomic_notifier_chain_register(&die_chain, nb);
 }
-EXPORT_SYMBOL(register_die_notifier);
+EXPORT_SYMBOL(register_die_notifier); /* used modular by kdb */
 
 int unregister_die_notifier(struct notifier_block *nb)
 {
        return atomic_notifier_chain_unregister(&die_chain, nb);
 }
-EXPORT_SYMBOL(unregister_die_notifier);
+EXPORT_SYMBOL(unregister_die_notifier); /* used modular by kdb */
 
 static inline void conditional_sti(struct pt_regs *regs)
 {
@@ -102,38 +103,48 @@ static inline void preempt_conditional_cli(struct pt_regs *regs)
 {
        if (regs->eflags & X86_EFLAGS_IF)
                local_irq_disable();
+       /* Make sure to not schedule here because we could be running
+          on an exception stack. */
        preempt_enable_no_resched();
 }
 
 static int kstack_depth_to_print = 10;
+#ifdef CONFIG_STACK_UNWIND
+static int call_trace = 1;
+#else
+#define call_trace (-1)
+#endif
 
 #ifdef CONFIG_KALLSYMS
-#include <linux/kallsyms.h> 
-int printk_address(unsigned long address)
-{ 
+# include <linux/kallsyms.h>
+void printk_address(unsigned long address)
+{
        unsigned long offset = 0, symsize;
        const char *symname;
        char *modname;
-       char *delim = ":"; 
+       char *delim = ":";
        char namebuf[128];
 
-       symname = kallsyms_lookup(address, &symsize, &offset, &modname, namebuf); 
-       if (!symname) 
-               return printk("[<%016lx>]", address);
-       if (!modname) 
+       symname = kallsyms_lookup(address, &symsize, &offset,
+                                       &modname, namebuf);
+       if (!symname) {
+               printk(" [<%016lx>]\n", address);
+               return;
+       }
+       if (!modname)
                modname = delim = "";           
-        return printk("<%016lx>{%s%s%s%s%+ld}",
-                     address, delim, modname, delim, symname, offset); 
-} 
+       printk(" [<%016lx>] %s%s%s%s+0x%lx/0x%lx\n",
+               address, delim, modname, delim, symname, offset, symsize);
+}
 #else
-int printk_address(unsigned long address)
-{ 
-       return printk("[<%016lx>]", address);
-} 
+void printk_address(unsigned long address)
+{
+       printk(" [<%016lx>]\n", address);
+}
 #endif
 
 static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
-                                       unsigned *usedp, const char **idp)
+                                       unsigned *usedp, char **idp)
 {
 #ifndef CONFIG_X86_NO_TSS
        static char ids[][8] = {
@@ -148,32 +159,68 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
        };
        unsigned k;
 
+       /*
+        * Iterate over all exception stacks, and figure out whether
+        * 'stack' is in one of them:
+        */
        for (k = 0; k < N_EXCEPTION_STACKS; k++) {
                unsigned long end;
 
+               /*
+                * set 'end' to the end of the exception stack.
+                */
                switch (k + 1) {
+               /*
+                * TODO: this block is not needed i think, because
+                * setup64.c:cpu_init() sets up t->ist[DEBUG_STACK]
+                * properly too.
+                */
 #if DEBUG_STKSZ > EXCEPTION_STKSZ
                case DEBUG_STACK:
                        end = cpu_pda(cpu)->debugstack + DEBUG_STKSZ;
                        break;
 #endif
                default:
-                       end = per_cpu(init_tss, cpu).ist[k];
+                       end = per_cpu(orig_ist, cpu).ist[k];
                        break;
                }
+               /*
+                * Is 'stack' above this exception frame's end?
+                * If yes then skip to the next frame.
+                */
                if (stack >= end)
                        continue;
+               /*
+                * Is 'stack' above this exception frame's start address?
+                * If yes then we found the right frame.
+                */
                if (stack >= end - EXCEPTION_STKSZ) {
+                       /*
+                        * Make sure we only iterate through an exception
+                        * stack once. If it comes up for the second time
+                        * then there's something wrong going on - just
+                        * break out and return NULL:
+                        */
                        if (*usedp & (1U << k))
                                break;
                        *usedp |= 1U << k;
                        *idp = ids[k];
                        return (unsigned long *)end;
                }
+               /*
+                * If this is a debug stack, and if it has a larger size than
+                * the usual exception stacks, then 'stack' might still
+                * be within the lower portion of the debug stack:
+                */
 #if DEBUG_STKSZ > EXCEPTION_STKSZ
                if (k == DEBUG_STACK - 1 && stack >= end - DEBUG_STKSZ) {
                        unsigned j = N_EXCEPTION_STACKS - 1;
 
+                       /*
+                        * Black magic. A large debug stack is composed of
+                        * multiple exception stack entries, which we
+                        * iterate through now. Dont look:
+                        */
                        do {
                                ++j;
                                end -= EXCEPTION_STKSZ;
@@ -191,6 +238,25 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
        return NULL;
 }
 
+struct ops_and_data {
+       struct stacktrace_ops *ops;
+       void *data;
+};
+
+static int dump_trace_unwind(struct unwind_frame_info *info, void *context)
+{
+       struct ops_and_data *oad = (struct ops_and_data *)context;
+       int n = 0;
+
+       while (unwind(info) == 0 && UNW_PC(info)) {
+               if (arch_unw_user_mode(info))
+                       break;
+               n++;
+               oad->ops->address(oad->data, UNW_PC(info));
+       }
+       return n;
+}
+
 /*
  * x86-64 can have upto three kernel stacks: 
  * process stack
@@ -198,25 +264,62 @@ static unsigned long *in_exception_stack(unsigned cpu, unsigned long stack,
  * severe exception (double fault, nmi, stack fault, debug, mce) hardware stack
  */
 
-void show_trace(unsigned long *stack)
+void dump_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long * stack,
+       struct stacktrace_ops *ops, void *data)
 {
        const unsigned cpu = safe_smp_processor_id();
        unsigned long *irqstack_end = (unsigned long *)cpu_pda(cpu)->irqstackptr;
-       int i;
        unsigned used = 0;
 
-       printk("\nCall Trace:");
+       if (!tsk)
+               tsk = current;
+
+       if (call_trace >= 0) {
+               int unw_ret = 0;
+               struct unwind_frame_info info;
+               struct ops_and_data oad = { .ops = ops, .data = data };
+
+               if (regs) {
+                       if (unwind_init_frame_info(&info, tsk, regs) == 0)
+                               unw_ret = dump_trace_unwind(&info, &oad);
+               } else if (tsk == current)
+                       unw_ret = unwind_init_running(&info, dump_trace_unwind, &oad);
+               else {
+                       if (unwind_init_blocked(&info, tsk) == 0)
+                               unw_ret = dump_trace_unwind(&info, &oad);
+               }
+               if (unw_ret > 0) {
+                       if (call_trace == 1 && !arch_unw_user_mode(&info)) {
+                               ops->warning_symbol(data, "DWARF2 unwinder stuck at %s\n",
+                                            UNW_PC(&info));
+                               if ((long)UNW_SP(&info) < 0) {
+                                       ops->warning(data, "Leftover inexact backtrace:\n");
+                                       stack = (unsigned long *)UNW_SP(&info);
+                               } else
+                                       ops->warning(data, "Full inexact backtrace again:\n");
+                       } else if (call_trace >= 1)
+                               return;
+                       else
+                               ops->warning(data, "Full inexact backtrace again:\n");
+               } else
+                       ops->warning(data, "Inexact backtrace:\n");
+       }
+       if (!stack) {
+               unsigned long dummy;
+               stack = &dummy;
+               if (tsk && tsk != current)
+                       stack = (unsigned long *)tsk->thread.rsp;
+       }
 
+       /*
+        * Print function call entries within a stack. 'cond' is the
+        * "end of stackframe" condition, that the 'stack++'
+        * iteration will eventually trigger.
+        */
 #define HANDLE_STACK(cond) \
        do while (cond) { \
                unsigned long addr = *stack++; \
                if (kernel_text_address(addr)) { \
-                       if (i > 50) { \
-                               printk("\n       "); \
-                               i = 0; \
-                       } \
-                       else \
-                               i += printk(" "); \
                        /* \
                         * If the address is either in the text segment of the \
                         * kernel, or in the region which contains vmalloc'ed \
@@ -225,20 +328,31 @@ void show_trace(unsigned long *stack)
                         * down the cause of the crash will be able to figure \
                         * out the call path that was taken. \
                         */ \
-                       i += printk_address(addr); \
+                       ops->address(data, addr); \
                } \
        } while (0)
 
-       for(i = 11; ; ) {
-               const char *id;
+       /*
+        * Print function call entries in all stacks, starting at the
+        * current stack address. If the stacks consist of nested
+        * exceptions
+        */
+       for (;;) {
+               char *id;
                unsigned long *estack_end;
                estack_end = in_exception_stack(cpu, (unsigned long)stack,
                                                &used, &id);
 
                if (estack_end) {
-                       i += printk(" <%s>", id);
+                       if (ops->stack(data, id) < 0)
+                                break;
                        HANDLE_STACK (stack < estack_end);
-                       i += printk(" <EOE>");
+                       ops->stack(data, "<EOE>");
+                       /*
+                        * We link to the next stack via the
+                        * second-to-last pointer (index -2 to end) in the
+                        * exception stack:
+                        */
                        stack = (unsigned long *) estack_end[-2];
                        continue;
                }
@@ -248,23 +362,71 @@ void show_trace(unsigned long *stack)
                                (IRQSTACKSIZE - 64) / sizeof(*irqstack);
 
                        if (stack >= irqstack && stack < irqstack_end) {
-                               i += printk(" <IRQ>");
+                               if (ops->stack(data, "IRQ") < 0)
+                                       break;
                                HANDLE_STACK (stack < irqstack_end);
+                               /*
+                                * We link to the next stack (which would be
+                                * the process stack normally) the last
+                                * pointer (index -1 to end) in the IRQ stack:
+                                */
                                stack = (unsigned long *) (irqstack_end[-1]);
                                irqstack_end = NULL;
-                               i += printk(" <EOI>");
+                               ops->stack(data, "EOI");
                                continue;
                        }
                }
                break;
        }
 
+       /*
+        * This handles the process stack:
+        */
        HANDLE_STACK (((long) stack & (THREAD_SIZE-1)) != 0);
 #undef HANDLE_STACK
+}
+EXPORT_SYMBOL(dump_trace);
+
+static void
+print_trace_warning_symbol(void *data, char *msg, unsigned long symbol)
+{
+       print_symbol(msg, symbol);
        printk("\n");
 }
 
-void show_stack(struct task_struct *tsk, unsigned long * rsp)
+static void print_trace_warning(void *data, char *msg)
+{
+       printk("%s\n", msg);
+}
+
+static int print_trace_stack(void *data, char *name)
+{
+       printk(" <%s> ", name);
+       return 0;
+}
+
+static void print_trace_address(void *data, unsigned long addr)
+{
+       printk_address(addr);
+}
+
+static struct stacktrace_ops print_trace_ops = {
+       .warning = print_trace_warning,
+       .warning_symbol = print_trace_warning_symbol,
+       .stack = print_trace_stack,
+       .address = print_trace_address,
+};
+
+void
+show_trace(struct task_struct *tsk, struct pt_regs *regs, unsigned long *stack)
+{
+       printk("\nCall Trace:\n");
+       dump_trace(tsk, regs, stack, &print_trace_ops, NULL);
+       printk("\n");
+}
+
+static void
+_show_stack(struct task_struct *tsk, struct pt_regs *regs, unsigned long *rsp)
 {
        unsigned long *stack;
        int i;
@@ -294,11 +456,16 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
                        break;
                }
                if (i && ((i % 4) == 0))
-                       printk("\n       ");
-               printk("%016lx ", *stack++);
+                       printk("\n");
+               printk(" %016lx ", *stack++);
                touch_nmi_watchdog();
        }
-       show_trace((unsigned long *)rsp);
+       show_trace(tsk, regs, rsp);
+}
+
+void show_stack(struct task_struct *tsk, unsigned long * rsp)
+{
+       _show_stack(tsk, NULL, rsp);
 }
 
 /*
@@ -307,7 +474,7 @@ void show_stack(struct task_struct *tsk, unsigned long * rsp)
 void dump_stack(void)
 {
        unsigned long dummy;
-       show_trace(&dummy);
+       show_trace(NULL, NULL, &dummy);
 }
 
 EXPORT_SYMBOL(dump_stack);
@@ -324,8 +491,9 @@ void show_registers(struct pt_regs *regs)
 
        printk("CPU %d ", cpu);
        __show_regs(regs);
-       printk("Process %s (pid: %d, threadinfo %p, task %p)\n",
-               cur->comm, cur->pid, task_thread_info(cur), cur);
+       printk("Process %s (pid: %d[#%u], threadinfo %p, task %p)\n",
+               cur->comm, cur->pid, cur->xid,
+               task_thread_info(cur), cur);
 
        /*
         * When in-kernel, we also print out the stack and code at the
@@ -334,7 +502,7 @@ void show_registers(struct pt_regs *regs)
        if (in_kernel) {
 
                printk("Stack: ");
-               show_stack(NULL, (unsigned long*)rsp);
+               _show_stack(NULL, regs, (unsigned long*)rsp);
 
                printk("\nCode: ");
                if (regs->rip < PAGE_OFFSET)
@@ -421,7 +589,7 @@ void __kprobes oops_end(unsigned long flags)
                /* Nest count reaches zero, release the lock. */
                spin_unlock_irqrestore(&die_lock, flags);
        if (panic_on_oops)
-               panic("Oops");
+               panic("Fatal exception");
 }
 
 void __kprobes __die(const char * str, struct pt_regs * regs, long err)
@@ -438,6 +606,9 @@ void __kprobes __die(const char * str, struct pt_regs * regs, long err)
        printk("DEBUG_PAGEALLOC");
 #endif
        printk("\n");
+#ifdef CONFIG_SYSFS
+       printk(KERN_ALERT "last sysfs file: %s\n", last_sysfs_file);
+#endif
        notify_die(DIE_OOPS, str, regs, err, current->thread.trap_no, SIGSEGV);
        show_registers(regs);
        /* Executive summary in case the oops scrolled away */
@@ -487,8 +658,6 @@ static void __kprobes do_trap(int trapnr, int signr, char *str,
 {
        struct task_struct *tsk = current;
 
-       conditional_sti(regs);
-
        tsk->thread.error_code = error_code;
        tsk->thread.trap_no = trapnr;
 
@@ -525,6 +694,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
        if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
                                                        == NOTIFY_STOP) \
                return; \
+       conditional_sti(regs);                                          \
        do_trap(trapnr, signr, str, regs, error_code, NULL); \
 }
 
@@ -539,6 +709,7 @@ asmlinkage void do_##name(struct pt_regs * regs, long error_code) \
        if (notify_die(DIE_TRAP, str, regs, error_code, trapnr, signr) \
                                                        == NOTIFY_STOP) \
                return; \
+       conditional_sti(regs);                                          \
        do_trap(trapnr, signr, str, regs, error_code, &info); \
 }
 
@@ -552,7 +723,17 @@ DO_ERROR(10, SIGSEGV, "invalid TSS", invalid_TSS)
 DO_ERROR(11, SIGBUS,  "segment not present", segment_not_present)
 DO_ERROR_INFO(17, SIGBUS, "alignment check", alignment_check, BUS_ADRALN, 0)
 DO_ERROR(18, SIGSEGV, "reserved", reserved)
-DO_ERROR(12, SIGBUS,  "stack segment", stack_segment)
+
+/* Runs on IST stack */
+asmlinkage void do_stack_segment(struct pt_regs *regs, long error_code)
+{
+       if (notify_die(DIE_TRAP, "stack segment", regs, error_code,
+                       12, SIGBUS) == NOTIFY_STOP)
+               return;
+       preempt_conditional_sti(regs);
+       do_trap(12, SIGBUS, "stack segment", regs, error_code, NULL);
+       preempt_conditional_cli(regs);
+}
 
 asmlinkage void do_double_fault(struct pt_regs * regs, long error_code)
 {
@@ -690,8 +871,9 @@ asmlinkage void __kprobes do_int3(struct pt_regs * regs, long error_code)
        if (notify_die(DIE_INT3, "int3", regs, error_code, 3, SIGTRAP) == NOTIFY_STOP) {
                return;
        }
+       preempt_conditional_sti(regs);
        do_trap(3, SIGTRAP, "int3", regs, error_code, NULL);
-       return;
+       preempt_conditional_cli(regs);
 }
 
 /* Help handler running on IST stack to switch back to user stack
@@ -1033,3 +1215,18 @@ static int __init kstack_setup(char *s)
 }
 __setup("kstack=", kstack_setup);
 
+#ifdef CONFIG_STACK_UNWIND
+static int __init call_trace_setup(char *s)
+{
+       if (strcmp(s, "old") == 0)
+               call_trace = -1;
+       else if (strcmp(s, "both") == 0)
+               call_trace = 0;
+       else if (strcmp(s, "newfallback") == 0)
+               call_trace = 1;
+       else if (strcmp(s, "new") == 0)
+               call_trace = 2;
+       return 1;
+}
+__setup("call_trace=", call_trace_setup);
+#endif
index 190834b..ed452ce 100644 (file)
@@ -107,7 +107,7 @@ static __always_inline long time_syscall(long *t)
 
 int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)
 {
-       if (unlikely(!__sysctl_vsyscall))
+       if (!__sysctl_vsyscall)
                return gettimeofday(tv,tz);
        if (tv)
                do_vgettimeofday(tv);
@@ -120,7 +120,7 @@ int __vsyscall(0) vgettimeofday(struct timeval * tv, struct timezone * tz)
  * unlikely */
 time_t __vsyscall(1) vtime(time_t *t)
 {
-       if (unlikely(!__sysctl_vsyscall))
+       if (!__sysctl_vsyscall)
                return time_syscall(t);
        else if (t)
                *t = __xtime.tv_sec;            
index f8904b9..3693d5d 100644 (file)
@@ -5,7 +5,6 @@
  *  Copyright (C) 2001,2002 Andi Kleen, SuSE Labs.
  */
 
-#include <linux/config.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
 #define PF_RSVD        (1<<3)
 #define PF_INSTR       (1<<4)
 
+#ifdef CONFIG_KPROBES
+ATOMIC_NOTIFIER_HEAD(notify_page_fault_chain);
+
+/* Hook to register for page fault notifications */
+int register_page_fault_notifier(struct notifier_block *nb)
+{
+       vmalloc_sync_all();
+       return atomic_notifier_chain_register(&notify_page_fault_chain, nb);
+}
+
+int unregister_page_fault_notifier(struct notifier_block *nb)
+{
+       return atomic_notifier_chain_unregister(&notify_page_fault_chain, nb);
+}
+
+static inline int notify_page_fault(enum die_val val, const char *str,
+                       struct pt_regs *regs, long err, int trap, int sig)
+{
+       struct die_args args = {
+               .regs = regs,
+               .str = str,
+               .err = err,
+               .trapnr = trap,
+               .signr = sig
+       };
+       return atomic_notifier_call_chain(&notify_page_fault_chain, val, &args);
+}
+#else
+static inline int notify_page_fault(enum die_val val, const char *str,
+                       struct pt_regs *regs, long err, int trap, int sig)
+{
+       return NOTIFY_DONE;
+}
+#endif
+
 void bust_spinlocks(int yes)
 {
        int loglevel_save = console_loglevel;
@@ -158,7 +192,7 @@ void dump_pagetable(unsigned long address)
        printk("PGD %lx ", pgd_val(*pgd));
        if (!pgd_present(*pgd)) goto ret; 
 
-       pud = __pud_offset_k((pud_t *)pgd_page(*pgd), address);
+       pud = pud_offset(pgd, address);
        if (bad_address(pud)) goto bad;
        printk("PUD %lx ", pud_val(*pud));
        if (!pud_present(*pud)) goto ret;
@@ -403,11 +437,11 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
                 * kernel text. Only vmalloc may need PML4 syncups.
                 */
                if (!(error_code & (PF_RSVD|PF_USER|PF_PROT)) &&
-                   address >= PAGE_OFFSET) {
+                     ((address >= VMALLOC_START && address < VMALLOC_END))) {
                        if (vmalloc_fault(address) >= 0)
                                return;
                }
-               if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
+               if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
                                                SIGSEGV) == NOTIFY_STOP)
                        return;
                /* Can take a spurious fault if mapping changes R/O -> R/W. */
@@ -420,7 +454,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
                goto bad_area_nosemaphore;
        }
 
-       if (notify_die(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
+       if (notify_page_fault(DIE_PAGE_FAULT, "page fault", regs, error_code, 14,
                                        SIGSEGV) == NOTIFY_STOP)
                return;
 
@@ -445,7 +479,7 @@ asmlinkage void __kprobes do_page_fault(struct pt_regs *regs,
        /* When running in the kernel we expect faults to occur only to
         * addresses in user space.  All other faults represent errors in the
         * kernel and should generate an OOPS.  Unfortunatly, in the case of an
-        * erroneous fault occuring in a code path which already holds mmap_sem
+        * erroneous fault occurring in a code path which already holds mmap_sem
         * we will deadlock attempting to validate the fault against the
         * address space.  Luckily the kernel only validly references user
         * space from well defined areas of code, which are listed in the
@@ -596,7 +630,6 @@ no_context:
                printk(KERN_ALERT "Unable to handle kernel paging request");
        printk(" at %016lx RIP: \n" KERN_ALERT,address);
        printk_address(regs->rip);
-       printk("\n");
        dump_pagetable(address);
        tsk->thread.cr2 = address;
        tsk->thread.trap_no = 14;
index b19248d..07a11ff 100644 (file)
@@ -9,7 +9,6 @@
  *     Modified for Xen.
  */
 
-#include <linux/config.h>
 #include <linux/signal.h>
 #include <linux/sched.h>
 #include <linux/kernel.h>
@@ -26,6 +25,7 @@
 #include <linux/bootmem.h>
 #include <linux/proc_fs.h>
 #include <linux/pci.h>
+#include <linux/poison.h>
 #include <linux/dma-mapping.h>
 #include <linux/module.h>
 #include <linux/memory_hotplug.h>
@@ -44,8 +44,6 @@
 #include <asm/proto.h>
 #include <asm/smp.h>
 #include <asm/sections.h>
-#include <asm/dma-mapping.h>
-#include <asm/swiotlb.h>
 
 #include <xen/features.h>
 
@@ -198,8 +196,6 @@ void show_mem(void)
        printk(KERN_INFO "%lu pages swap cached\n",cached);
 }
 
-/* References to section boundaries */
-
 int after_bootmem;
 
 static __init void *spp_getpage(void)
@@ -485,8 +481,9 @@ phys_pmd_init(pmd_t *pmd, unsigned long address, unsigned long end)
                pte_t *pte, *pte_save;
 
                if (address >= end) {
-                       for (; i < PTRS_PER_PMD; i++, pmd++)
-                               set_pmd(pmd, __pmd(0));
+                       if (!after_bootmem)
+                               for (; i < PTRS_PER_PMD; i++, pmd++)
+                                       set_pmd(pmd, __pmd(0));
                        break;
                }
                pte = alloc_static_page(&pte_phys);
@@ -573,7 +570,7 @@ void __init xen_init_pt(void)
                mk_kernel_pgd(__pa_symbol(level3_kernel_pgt));
        level3_kernel_pgt[pud_index(__START_KERNEL_map)] = 
                __pud(__pa_symbol(level2_kernel_pgt) |
-                     _KERNPG_TABLE | _PAGE_USER);
+                     _KERNPG_TABLE);
        memcpy((void *)level2_kernel_pgt, page, PAGE_SIZE);
 
        early_make_page_readonly(init_level4_pgt,
@@ -622,7 +619,7 @@ void __init extend_init_mapping(unsigned long tables_space)
                        pte_page = alloc_static_page(&phys);
                        early_make_page_readonly(
                                pte_page, XENFEAT_writable_page_tables);
-                       set_pmd(pmd, __pmd(phys | _KERNPG_TABLE | _PAGE_USER));
+                       set_pmd(pmd, __pmd(phys | _KERNPG_TABLE));
                } else {
                        addr = page[pmd_index(va)];
                        addr_to_page(addr, pte_page);
@@ -631,7 +628,7 @@ void __init extend_init_mapping(unsigned long tables_space)
                if (pte_none(*pte)) {
                        new_pte = pfn_pte(
                                (va - __START_KERNEL_map) >> PAGE_SHIFT, 
-                               __pgprot(_KERNPG_TABLE | _PAGE_USER));
+                               __pgprot(_KERNPG_TABLE));
                        xen_l1_entry_update(pte, new_pte);
                }
                va += PAGE_SIZE;
@@ -665,7 +662,8 @@ static void __init find_early_table_space(unsigned long end)
        table_end = table_start + (tables>>PAGE_SHIFT);
 
        early_printk("kernel direct mapping tables up to %lx @ %lx-%lx\n",
-               end, table_start << PAGE_SHIFT, table_end << PAGE_SHIFT);
+               end, table_start << PAGE_SHIFT,
+                    (table_end << PAGE_SHIFT) + tables);
 }
 
 /* Setup the direct mapping of the physical memory at PAGE_OFFSET.
@@ -695,7 +693,7 @@ void __meminit init_memory_mapping(unsigned long start, unsigned long end)
                pud_t *pud;
 
                if (after_bootmem) {
-                       pud = pud_offset_k(pgd, start & PGDIR_MASK);
+                       pud = pud_offset(pgd, start & PGDIR_MASK);
                        make_page_readonly(pud, XENFEAT_writable_page_tables);
                        pud_phys = __pa(pud);
                } else {
@@ -833,7 +831,7 @@ void __init paging_init(void)
 
        /* Setup mapping of lower 1st MB */
        for (i = 0; i < NR_FIX_ISAMAPS; i++)
-               if (xen_start_info->flags & SIF_PRIVILEGED)
+               if (is_initial_xendomain())
                        set_fixmap(FIX_ISAMAP_BEGIN - i, i * PAGE_SIZE);
                else
                        __set_fixmap(FIX_ISAMAP_BEGIN - i,
@@ -876,15 +874,9 @@ void __init clear_kernel_mapping(unsigned long address, unsigned long size)
        __flush_tlb_all();
 } 
 
-int page_is_ram (unsigned long pagenr)
-{
-       return 1;
-}
-
 /*
  * Memory hotplug specific functions
  */
-#if defined(CONFIG_ACPI_HOTPLUG_MEMORY) || defined(CONFIG_ACPI_HOTPLUG_MEMORY_MODULE)
 
 void online_page(struct page *page)
 {
@@ -895,31 +887,17 @@ void online_page(struct page *page)
        num_physpages++;
 }
 
-#ifndef CONFIG_MEMORY_HOTPLUG
+#ifdef CONFIG_MEMORY_HOTPLUG
 /*
- * Memory Hotadd without sparsemem. The mem_maps have been allocated in advance,
- * just online the pages.
+ * XXX: memory_add_physaddr_to_nid() is to find node id from physical address
+ *     via probe interface of sysfs. If acpi notifies hot-add event, then it
+ *     can tell node id by searching dsdt. But, probe interface doesn't have
+ *     node id. So, return 0 as node id at this time.
  */
-int __add_pages(struct zone *z, unsigned long start_pfn, unsigned long nr_pages)
+#ifdef CONFIG_NUMA
+int memory_add_physaddr_to_nid(u64 start)
 {
-       int err = -EIO;
-       unsigned long pfn;
-       unsigned long total = 0, mem = 0;
-       for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) {
-               if (pfn_valid(pfn)) {
-                       online_page(pfn_to_page(pfn));
-                       err = 0;
-                       mem++;
-               }
-               total++;
-       }
-       if (!err) {
-               z->spanned_pages += total;
-               z->present_pages += mem;
-               z->zone_pgdat->node_spanned_pages += total;
-               z->zone_pgdat->node_present_pages += mem;
-       }
-       return err;
+       return 0;
 }
 #endif
 
@@ -927,9 +905,9 @@ int __add_pages(struct zone *z, unsigned long start_pfn, unsigned long nr_pages)
  * Memory is added always to NORMAL zone. This means you will never get
  * additional DMA/DMA32 memory.
  */
-int add_memory(u64 start, u64 size)
+int arch_add_memory(int nid, u64 start, u64 size)
 {
-       struct pglist_data *pgdat = NODE_DATA(0);
+       struct pglist_data *pgdat = NODE_DATA(nid);
        struct zone *zone = pgdat->node_zones + MAX_NR_ZONES-2;
        unsigned long start_pfn = start >> PAGE_SHIFT;
        unsigned long nr_pages = size >> PAGE_SHIFT;
@@ -946,7 +924,7 @@ error:
        printk("%s: Problem encountered in __add_pages!\n", __func__);
        return ret;
 }
-EXPORT_SYMBOL_GPL(add_memory);
+EXPORT_SYMBOL_GPL(arch_add_memory);
 
 int remove_memory(u64 start, u64 size)
 {
@@ -954,7 +932,39 @@ int remove_memory(u64 start, u64 size)
 }
 EXPORT_SYMBOL_GPL(remove_memory);
 
-#endif
+#else /* CONFIG_MEMORY_HOTPLUG */
+/*
+ * Memory Hotadd without sparsemem. The mem_maps have been allocated in advance,
+ * just online the pages.
+ */
+int __add_pages(struct zone *z, unsigned long start_pfn, unsigned long nr_pages)
+{
+       int err = -EIO;
+       unsigned long pfn;
+       unsigned long total = 0, mem = 0;
+       for (pfn = start_pfn; pfn < start_pfn + nr_pages; pfn++) {
+               if (pfn_valid(pfn)) {
+                       online_page(pfn_to_page(pfn));
+                       err = 0;
+                       mem++;
+               }
+               total++;
+       }
+       if (!err) {
+               z->spanned_pages += total;
+               z->present_pages += mem;
+               z->zone_pgdat->node_spanned_pages += total;
+               z->zone_pgdat->node_present_pages += mem;
+       }
+       return err;
+}
+#endif /* CONFIG_MEMORY_HOTPLUG */
+
+static inline int page_is_ram (unsigned long pagenr)
+{
+       return 1;
+}
+EXPORT_SYMBOL_GPL(page_is_ram);
 
 /*
  * devmem_is_allowed() checks to see if /dev/mem access to a certain address is
@@ -976,8 +986,6 @@ int devmem_is_allowed(unsigned long pagenr)
 }
 
 
-EXPORT_SYMBOL_GPL(page_is_ram);
-
 static struct kcore_list kcore_mem, kcore_vmalloc, kcore_kernel, kcore_modules,
                         kcore_vsyscall;
 
@@ -991,10 +999,7 @@ void __init mem_init(void)
        BUG_ON(!contiguous_bitmap);
        memset(contiguous_bitmap, 0, (end_pfn + 2*BITS_PER_LONG) >> 3);
 
-#if defined(CONFIG_SWIOTLB)
-       pci_swiotlb_init();     
-#endif
-       no_iommu_init();
+       pci_iommu_alloc();
 
        /* How many end-of-memory variables you have, grandma! */
        max_low_pfn = end_pfn;
@@ -1056,48 +1061,48 @@ void __init mem_init(void)
 #endif
 }
 
-void free_initmem(void)
+void free_init_pages(char *what, unsigned long begin, unsigned long end)
 {
 #ifdef __DO_LATER__
-       /*
-        * Some pages can be pinned, but some are not. Unpinning such pages 
-        * triggers BUG(). 
-        */
        unsigned long addr;
 
-       addr = (unsigned long)(&__init_begin);
-       for (; addr < (unsigned long)(&__init_end); addr += PAGE_SIZE) {
+       if (begin >= end)
+               return;
+
+       printk(KERN_INFO "Freeing %s: %ldk freed\n", what, (end - begin) >> 10);
+       for (addr = begin; addr < end; addr += PAGE_SIZE) {
                ClearPageReserved(virt_to_page(addr));
                init_page_count(virt_to_page(addr));
-               memset((void *)(addr & ~(PAGE_SIZE-1)), 0xcc, PAGE_SIZE); 
-               make_page_writable(
-                       __va(__pa(addr)), XENFEAT_writable_page_tables);
-               /*
-                * Make pages from __PAGE_OFFSET address as well
-                */
-               make_page_writable(
-                       (void *)addr, XENFEAT_writable_page_tables);
+               memset((void *)(addr & ~(PAGE_SIZE-1)),
+                       POISON_FREE_INITMEM, PAGE_SIZE);
                free_page(addr);
                totalram_pages++;
        }
-       memset(__initdata_begin, 0xba, __initdata_end - __initdata_begin);
-       printk ("Freeing unused kernel memory: %luk freed\n", (__init_end - __init_begin) >> 10);
+#endif
+}
+
+void free_initmem(void)
+{
+#ifdef __DO_LATER__
+       memset(__initdata_begin, POISON_FREE_INITDATA,
+              __initdata_end - __initdata_begin);
+       free_init_pages("unused kernel memory",
+                       (unsigned long)(&__init_begin),
+                       (unsigned long)(&__init_end));
 #endif
 }
 
 #ifdef CONFIG_DEBUG_RODATA
 
-extern char __start_rodata, __end_rodata;
 void mark_rodata_ro(void)
 {
-       unsigned long addr = (unsigned long)&__start_rodata;
+       unsigned long addr = (unsigned long)__start_rodata;
 
-       for (; addr < (unsigned long)&__end_rodata; addr += PAGE_SIZE)
+       for (; addr < (unsigned long)__end_rodata; addr += PAGE_SIZE)
                change_page_attr_addr(addr, 1, PAGE_KERNEL_RO);
 
        printk ("Write protecting the kernel read-only data: %luk\n",
-                       (&__end_rodata - &__start_rodata) >> 10);
-
+                       (__end_rodata - __start_rodata) >> 10);
        /*
         * change_page_attr_addr() requires a global_flush_tlb() call after it.
         * We do this after the printk so that if something went wrong in the
@@ -1111,15 +1116,7 @@ void mark_rodata_ro(void)
 #ifdef CONFIG_BLK_DEV_INITRD
 void free_initrd_mem(unsigned long start, unsigned long end)
 {
-       if (start >= end)
-               return;
-       printk ("Freeing initrd memory: %ldk freed\n", (end - start) >> 10);
-       for (; start < end; start += PAGE_SIZE) {
-               ClearPageReserved(virt_to_page(start));
-               init_page_count(virt_to_page(start));
-               free_page(start);
-               totalram_pages++;
-       }
+       free_init_pages("initrd memory", start, end);
 }
 #endif
 
index 011bb4c..432d2aa 100644 (file)
@@ -26,6 +26,7 @@
 
 #include <linux/personality.h>
 #include <linux/mm.h>
+#include <linux/random.h>
 
 /*
  * Top of mmap area (just below the process stack).
@@ -37,7 +38,7 @@
 
 static inline unsigned long mmap_base(void)
 {
-       unsigned long gap = current->rlim[RLIMIT_STACK].rlim_cur;
+       unsigned long gap = current->signal->rlim[RLIMIT_STACK].rlim_cur;
 
        if (gap < MIN_GAP)
                gap = MIN_GAP;
@@ -54,13 +55,13 @@ static inline int mmap_is_legacy(void)
         */
        if (!test_thread_flag(TIF_IA32))
                return 1;
-               
-       if (current->personality & ADDR_COMPAT_LAYOUT) 
+
+       if (current->personality & ADDR_COMPAT_LAYOUT)
                return 1;
-       
-       if (current->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
+
+       if (current->signal->rlim[RLIMIT_STACK].rlim_cur == RLIM_INFINITY)
                return 1;
-               
+
        return sysctl_legacy_va_layout;
 }
 
@@ -81,7 +82,6 @@ void arch_pick_mmap_layout(struct mm_struct *mm)
        } else {
                mm->mmap_base = mmap_base();
                mm->get_unmapped_area = arch_get_unmapped_area_topdown;
-               mm->get_unmapped_exec_area = arch_get_unmapped_exec_area;
                mm->unmap_area = arch_unmap_area_topdown;
        }
 }
index df074a0..c57cc62 100644 (file)
@@ -3,7 +3,6 @@
  * Thanks to Ben LaHaise for precious feedback.
  */ 
 
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <linux/sched.h>
 #include <linux/highmem.h>
@@ -322,11 +321,13 @@ __change_page_attr(unsigned long address, unsigned long pfn, pgprot_t prot,
         */
 #ifndef CONFIG_XEN
        BUG_ON(PageReserved(kpte_page));
+#else
+       if(!PageReserved(kpte_page))
 #endif
-       if (page_private(kpte_page) == 0) {
-               save_page(kpte_page);
-               revert_page(address, ref_prot);
-       }
+               if (page_private(kpte_page) == 0) {
+                       save_page(kpte_page);
+                       revert_page(address, ref_prot);
+               }
        return 0;
 } 
 
index 224fc97..9b8e0f0 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:39 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:21 2006
 #
 CONFIG_X86_32=y
 CONFIG_GENERIC_TIME=y
@@ -78,12 +78,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -165,7 +159,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
 CONFIG_PREEMPT_BKL=y
 CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_APIC_AUTO=y
 CONFIG_X86_IO_APIC=y
 CONFIG_X86_MCE=y
 # CONFIG_X86_MCE_NONFATAL is not set
@@ -212,9 +205,9 @@ CONFIG_BOOT_IOREMAP=y
 CONFIG_REGPARM=y
 # CONFIG_SECCOMP is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_KEXEC=y
 # CONFIG_CRASH_DUMP is not set
 CONFIG_PHYSICAL_START=0x400000
@@ -1911,7 +1904,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
index 906c52b..96022d6 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:39 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:21 2006
 #
 CONFIG_X86_32=y
 CONFIG_GENERIC_TIME=y
@@ -76,12 +76,6 @@ CONFIG_MODULE_SIG=y
 # CONFIG_MODULE_SIG_FORCE is not set
 CONFIG_KMOD=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -202,9 +196,9 @@ CONFIG_BOOT_IOREMAP=y
 CONFIG_REGPARM=y
 # CONFIG_SECCOMP is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_KEXEC=y
 # CONFIG_CRASH_DUMP is not set
 CONFIG_PHYSICAL_START=0x400000
@@ -1903,7 +1897,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -2019,7 +2013,7 @@ CONFIG_RTC=y
 # CONFIG_DTLK is not set
 # CONFIG_R3964 is not set
 # CONFIG_APPLICOM is not set
-# CONFIG_SONYPI is not set
+CONFIG_SONYPI=m
 
 #
 # Ftape, the floppy tape device driver
@@ -2234,6 +2228,7 @@ CONFIG_VIDEO_ZORAN_DC30=m
 CONFIG_VIDEO_ZORAN_LML33=m
 CONFIG_VIDEO_ZORAN_LML33R10=m
 CONFIG_VIDEO_ZORAN_AVS6EYES=m
+CONFIG_VIDEO_MEYE=m
 CONFIG_VIDEO_SAA7134=m
 CONFIG_VIDEO_SAA7134_ALSA=m
 CONFIG_VIDEO_SAA7134_DVB=m
index 8e2ca42..f524425 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:39 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:22 2006
 #
 CONFIG_X86_32=y
 CONFIG_GENERIC_TIME=y
@@ -76,12 +76,6 @@ CONFIG_MODULE_SIG=y
 # CONFIG_MODULE_SIG_FORCE is not set
 CONFIG_KMOD=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -162,7 +156,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_X86_UP_APIC=y
 CONFIG_X86_UP_IOAPIC=y
 CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_APIC_AUTO=y
 CONFIG_X86_IO_APIC=y
 CONFIG_X86_MCE=y
 # CONFIG_X86_MCE_NONFATAL is not set
@@ -209,9 +202,9 @@ CONFIG_BOOT_IOREMAP=y
 CONFIG_REGPARM=y
 # CONFIG_SECCOMP is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_KEXEC=y
 CONFIG_CRASH_DUMP=y
 CONFIG_PHYSICAL_START=0x1000000
@@ -1928,7 +1921,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -2171,23 +2164,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index 00cc6b4..002f396 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:40 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:22 2006
 #
 CONFIG_X86_32=y
 CONFIG_GENERIC_TIME=y
@@ -78,12 +78,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -167,7 +161,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
 CONFIG_PREEMPT_BKL=y
 CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_APIC_AUTO=y
 CONFIG_X86_IO_APIC=y
 CONFIG_X86_MCE=y
 # CONFIG_X86_MCE_NONFATAL is not set
@@ -213,9 +206,9 @@ CONFIG_BOOT_IOREMAP=y
 CONFIG_REGPARM=y
 # CONFIG_SECCOMP is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_KEXEC=y
 # CONFIG_CRASH_DUMP is not set
 CONFIG_PHYSICAL_START=0x400000
@@ -1929,7 +1922,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -2169,23 +2162,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index b6af801..3d888fc 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:40 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:22 2006
 #
 CONFIG_X86_32=y
 CONFIG_LOCKDEP_SUPPORT=y
@@ -77,12 +77,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -160,7 +154,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
 CONFIG_PREEMPT_BKL=y
 CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_APIC_AUTO=y
 CONFIG_X86_IO_APIC=y
 CONFIG_VM86=y
 CONFIG_TOSHIBA=m
@@ -1801,7 +1794,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -2023,23 +2016,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
@@ -3213,8 +3190,8 @@ CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=m
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
+# CONFIG_XEN_FRAMEBUFFER is not set
+# CONFIG_XEN_KEYBOARD is not set
 CONFIG_XEN_SCRUB_PAGES=y
 # CONFIG_XEN_DISABLE_SERIAL is not set
 CONFIG_XEN_SYSFS=y
index c6fe1ef..c37defd 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:40 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:23 2006
 #
 CONFIG_X86_32=y
 CONFIG_LOCKDEP_SUPPORT=y
@@ -77,12 +77,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -160,7 +154,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
 CONFIG_PREEMPT_BKL=y
 CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_APIC_AUTO=y
 CONFIG_X86_IO_APIC=y
 CONFIG_VM86=y
 CONFIG_TOSHIBA=m
@@ -1799,7 +1792,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -2021,23 +2014,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
@@ -3211,8 +3188,8 @@ CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=m
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
+# CONFIG_XEN_FRAMEBUFFER is not set
+# CONFIG_XEN_KEYBOARD is not set
 CONFIG_XEN_SCRUB_PAGES=y
 # CONFIG_XEN_DISABLE_SERIAL is not set
 CONFIG_XEN_SYSFS=y
index 309644b..ce59cd9 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:40 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:23 2006
 #
 CONFIG_X86_32=y
 CONFIG_LOCKDEP_SUPPORT=y
@@ -77,12 +77,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -980,7 +974,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1094,7 +1088,6 @@ CONFIG_HANGCHECK_TIMER=m
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
 
 #
 # Digital Video Broadcasting Devices
@@ -1590,8 +1583,8 @@ CONFIG_XEN_BLKDEV_TAP=m
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=y
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
+# CONFIG_XEN_FRAMEBUFFER is not set
+# CONFIG_XEN_KEYBOARD is not set
 CONFIG_XEN_SCRUB_PAGES=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
index 96690dc..a9f030d 100644 (file)
@@ -1,8 +1,8 @@
 # i386
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:41 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:23 2006
 #
 CONFIG_X86_32=y
 CONFIG_GENERIC_TIME=y
@@ -76,12 +76,6 @@ CONFIG_MODULE_SIG=y
 # CONFIG_MODULE_SIG_FORCE is not set
 CONFIG_KMOD=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -162,7 +156,6 @@ CONFIG_PREEMPT_VOLUNTARY=y
 CONFIG_X86_UP_APIC=y
 CONFIG_X86_UP_IOAPIC=y
 CONFIG_X86_LOCAL_APIC=y
-CONFIG_X86_APIC_AUTO=y
 CONFIG_X86_IO_APIC=y
 CONFIG_X86_MCE=y
 # CONFIG_X86_MCE_NONFATAL is not set
@@ -208,9 +201,9 @@ CONFIG_BOOT_IOREMAP=y
 CONFIG_REGPARM=y
 # CONFIG_SECCOMP is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_KEXEC=y
 # CONFIG_CRASH_DUMP is not set
 CONFIG_PHYSICAL_START=0x400000
@@ -1928,7 +1921,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -2171,23 +2164,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index 7fea409..339709b 100644 (file)
@@ -1,8 +1,8 @@
 # ia64
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:41 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:24 2006
 #
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
@@ -65,12 +65,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -1551,7 +1545,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1718,23 +1712,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
@@ -2019,9 +1997,9 @@ CONFIG_USB_DABUSB=m
 #
 # CONFIG_FIRMWARE_EDID is not set
 CONFIG_FB=y
-CONFIG_FB_CFB_FILLRECT=y
-CONFIG_FB_CFB_COPYAREA=y
-CONFIG_FB_CFB_IMAGEBLIT=y
+CONFIG_FB_CFB_FILLRECT=m
+CONFIG_FB_CFB_COPYAREA=m
+CONFIG_FB_CFB_IMAGEBLIT=m
 # CONFIG_FB_MACMODES is not set
 # CONFIG_FB_BACKLIGHT is not set
 CONFIG_FB_MODE_HELPERS=y
@@ -2871,8 +2849,8 @@ CONFIG_XEN_NETDEV_LOOPBACK=m
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=m
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
+# CONFIG_XEN_FRAMEBUFFER is not set
+# CONFIG_XEN_KEYBOARD is not set
 CONFIG_XEN_SCRUB_PAGES=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
index e6c8653..d811a1b 100644 (file)
@@ -1,8 +1,8 @@
 # ia64
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:41 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:24 2006
 #
 CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
 
@@ -65,12 +65,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -123,9 +117,9 @@ CONFIG_IA64_PAGE_SIZE_16KB=y
 CONFIG_PGTABLE_3=y
 # CONFIG_PGTABLE_4 is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_IA64_L1_CACHE_SHIFT=7
 CONFIG_IA64_CYCLONE=y
 CONFIG_IOSAPIC=y
@@ -1571,7 +1565,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1763,23 +1757,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index 66147ea..7ecb586 100644 (file)
@@ -1,8 +1,8 @@
 # powerpc
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:41 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:24 2006
 #
 # CONFIG_PPC64 is not set
 CONFIG_PPC32=y
@@ -106,12 +106,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -176,9 +170,9 @@ CONFIG_MPIC=y
 #
 CONFIG_HIGHMEM=y
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
@@ -1793,7 +1787,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1993,23 +1987,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index 1db169f..3b93fba 100644 (file)
@@ -1,8 +1,8 @@
 # powerpc
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:41 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:25 2006
 #
 # CONFIG_PPC64 is not set
 CONFIG_PPC32=y
@@ -103,12 +103,6 @@ CONFIG_MODULE_SIG=y
 # CONFIG_MODULE_SIG_FORCE is not set
 CONFIG_KMOD=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -173,9 +167,9 @@ CONFIG_MPIC=y
 #
 CONFIG_HIGHMEM=y
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
@@ -1795,7 +1789,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1997,23 +1991,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index aba7827..fe9012c 100644 (file)
@@ -1,8 +1,8 @@
 # powerpc
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:42 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:25 2006
 #
 CONFIG_PPC64=y
 CONFIG_64BIT=y
@@ -99,12 +99,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -181,9 +175,9 @@ CONFIG_CBE_RAS=y
 # Kernel options
 #
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
@@ -1699,7 +1693,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1887,23 +1881,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index 7b31ef8..35c0c63 100644 (file)
@@ -1,8 +1,8 @@
 # powerpc
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:42 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:25 2006
 #
 CONFIG_PPC64=y
 CONFIG_64BIT=y
@@ -99,12 +99,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -181,9 +175,9 @@ CONFIG_CBE_RAS=y
 # Kernel options
 #
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
@@ -1699,7 +1693,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1887,23 +1881,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index ffeabee..2fdbeb8 100644 (file)
@@ -1,8 +1,8 @@
 # powerpc
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:42 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:25 2006
 #
 CONFIG_PPC64=y
 CONFIG_64BIT=y
@@ -99,12 +99,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -147,9 +141,9 @@ CONFIG_IBMVIO=y
 # Kernel options
 #
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 # CONFIG_PREEMPT_NONE is not set
 CONFIG_PREEMPT_VOLUNTARY=y
 # CONFIG_PREEMPT is not set
@@ -1029,7 +1023,7 @@ CONFIG_GAMEPORT_FM801=m
 #
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1134,7 +1128,6 @@ CONFIG_TCG_ATMEL=m
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
 
 #
 # Digital Video Broadcasting Devices
index 971ecd1..d73b915 100644 (file)
@@ -1,8 +1,8 @@
 # s390
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:42 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:26 2006
 #
 CONFIG_MMU=y
 CONFIG_LOCKDEP_SUPPORT=y
@@ -73,12 +73,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
index 6340b1b..56508ef 100644 (file)
@@ -1,8 +1,8 @@
 # s390
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:42 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:26 2006
 #
 CONFIG_MMU=y
 CONFIG_LOCKDEP_SUPPORT=y
@@ -72,12 +72,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
index e62073e..da14891 100644 (file)
@@ -1,8 +1,8 @@
 # x86_64
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:42 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:27 2006
 #
 CONFIG_X86_64=y
 CONFIG_64BIT=y
@@ -81,12 +81,6 @@ CONFIG_MODULE_SIG=y
 # CONFIG_MODULE_SIG_FORCE is not set
 CONFIG_KMOD=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -161,9 +155,9 @@ CONFIG_CRASH_DUMP=y
 CONFIG_PHYSICAL_START=0x1000000
 # CONFIG_SECCOMP is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_REORDER=y
 CONFIG_K8_NB=y
 CONFIG_GENERIC_HARDIRQS=y
@@ -1741,7 +1735,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1961,23 +1955,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index b4a0c30..6fad8ff 100644 (file)
@@ -1,8 +1,8 @@
 # x86_64
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:43 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:27 2006
 #
 CONFIG_X86_64=y
 CONFIG_64BIT=y
@@ -82,12 +82,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -1723,7 +1717,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1935,23 +1929,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
@@ -3107,8 +3085,8 @@ CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=m
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
+# CONFIG_XEN_FRAMEBUFFER is not set
+# CONFIG_XEN_KEYBOARD is not set
 CONFIG_XEN_SCRUB_PAGES=y
 # CONFIG_XEN_DISABLE_SERIAL is not set
 CONFIG_XEN_SYSFS=y
index 25d6f90..51a5b78 100644 (file)
@@ -1,8 +1,8 @@
 # x86_64
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:43 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:27 2006
 #
 CONFIG_X86_64=y
 CONFIG_64BIT=y
@@ -82,12 +82,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -1723,7 +1717,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1935,23 +1929,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
@@ -3107,8 +3085,8 @@ CONFIG_XEN_PCIDEV_BACKEND_VPCI=y
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=m
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
+# CONFIG_XEN_FRAMEBUFFER is not set
+# CONFIG_XEN_KEYBOARD is not set
 CONFIG_XEN_SCRUB_PAGES=y
 # CONFIG_XEN_DISABLE_SERIAL is not set
 CONFIG_XEN_SYSFS=y
index 78ffb64..2fcae4e 100644 (file)
@@ -1,8 +1,8 @@
 # x86_64
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:43 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:27 2006
 #
 CONFIG_X86_64=y
 CONFIG_64BIT=y
@@ -82,12 +82,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -942,7 +936,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1054,7 +1048,6 @@ CONFIG_HANGCHECK_TIMER=m
 # Multimedia devices
 #
 # CONFIG_VIDEO_DEV is not set
-CONFIG_VIDEO_V4L2=y
 
 #
 # Digital Video Broadcasting Devices
@@ -1546,8 +1539,8 @@ CONFIG_XEN_BLKDEV_TAP=m
 # CONFIG_XEN_TPMDEV_BACKEND is not set
 CONFIG_XEN_BLKDEV_FRONTEND=y
 CONFIG_XEN_NETDEV_FRONTEND=m
-CONFIG_XEN_FRAMEBUFFER=y
-CONFIG_XEN_KEYBOARD=y
+# CONFIG_XEN_FRAMEBUFFER is not set
+# CONFIG_XEN_KEYBOARD is not set
 CONFIG_XEN_SCRUB_PAGES=y
 CONFIG_XEN_DISABLE_SERIAL=y
 CONFIG_XEN_SYSFS=y
index 16135f6..6c935d9 100644 (file)
@@ -1,8 +1,8 @@
 # x86_64
 #
 # Automatically generated make config: don't edit
-# Linux kernel version: 2.6.18.2-rc1
-# Mon Nov 13 09:44:43 2006
+# Linux kernel version: 2.6.18.6
+# Thu Dec 28 22:01:27 2006
 #
 CONFIG_X86_64=y
 CONFIG_64BIT=y
@@ -83,12 +83,6 @@ CONFIG_MODULE_SIG=y
 CONFIG_KMOD=y
 CONFIG_STOP_MACHINE=y
 
-#
-# Process debugging support
-#
-CONFIG_UTRACE=y
-CONFIG_PTRACE=y
-
 #
 # Block layer
 #
@@ -162,7 +156,7 @@ CONFIG_SPLIT_PTLOCK_CPUS=4
 CONFIG_MIGRATION=y
 CONFIG_RESOURCES_64BIT=y
 CONFIG_HAVE_ARCH_EARLY_PFN_TO_NID=y
-CONFIG_NR_CPUS=255
+CONFIG_NR_CPUS=64
 CONFIG_HOTPLUG_CPU=y
 CONFIG_ARCH_ENABLE_MEMORY_HOTPLUG=y
 CONFIG_HPET_TIMER=y
@@ -178,9 +172,9 @@ CONFIG_KEXEC=y
 CONFIG_PHYSICAL_START=0x200000
 # CONFIG_SECCOMP is not set
 # CONFIG_HZ_100 is not set
-CONFIG_HZ_250=y
-# CONFIG_HZ_1000 is not set
-CONFIG_HZ=250
+# CONFIG_HZ_250 is not set
+CONFIG_HZ_1000=y
+CONFIG_HZ=1000
 CONFIG_REORDER=y
 CONFIG_K8_NB=y
 CONFIG_GENERIC_HARDIRQS=y
@@ -1756,7 +1750,7 @@ CONFIG_HW_CONSOLE=y
 CONFIG_VT_HW_CONSOLE_BINDING=y
 CONFIG_SERIAL_NONSTANDARD=y
 # CONFIG_COMPUTONE is not set
-# CONFIG_ROCKETPORT is not set
+CONFIG_ROCKETPORT=m
 CONFIG_CYCLADES=m
 # CONFIG_CYZ_INTR is not set
 # CONFIG_DIGIEPCA is not set
@@ -1974,23 +1968,7 @@ CONFIG_SENSORS_MAX6875=m
 #
 # Dallas's 1-wire bus
 #
-CONFIG_W1=m
-CONFIG_W1_CON=y
-
-#
-# 1-wire Bus Masters
-#
-CONFIG_W1_MASTER_MATROX=m
-CONFIG_W1_MASTER_DS2490=m
-CONFIG_W1_MASTER_DS2482=m
-
-#
-# 1-wire Slaves
-#
-CONFIG_W1_SLAVE_THERM=m
-CONFIG_W1_SLAVE_SMEM=m
-CONFIG_W1_SLAVE_DS2433=m
-CONFIG_W1_SLAVE_DS2433_CRC=y
+# CONFIG_W1 is not set
 
 #
 # Hardware Monitoring support
index dee9146..530d627 100644 (file)
@@ -101,8 +101,8 @@ mpi_fdiv_qr( MPI quot, MPI rem, MPI dividend, MPI divisor )
     MPI temp_divisor = NULL;
 
     if( quot == divisor || rem == divisor ) {
-       if (mpi_copy( &temp_divisor, divisor ) < 0);
-       return -ENOMEM;
+       if (mpi_copy( &temp_divisor, divisor ) < 0)
+               return -ENOMEM;
        divisor = temp_divisor;
     }
 
index a1ecccb..7297968 100644 (file)
@@ -1,7 +1,7 @@
-
+const int ksign_def_public_key_size = 0;
 /* automatically generated by bin2hex */
 static unsigned char ksign_def_public_key[] __initdata =
 {
-       0x00, 0x09, 0x00, 0x00, 0x00, 0x00
+       0x00, 0x00, 0x00, 0x00, 0x00, 0x00
 };
 
index a1bbd85..610cd98 100644 (file)
@@ -85,6 +85,8 @@ struct ksign_public_key *ksign_get_public_key(const uint32_t *keyid)
                }
        }
 
+       pk = NULL;
+
  found:
        up_read(&keyring_sem);
 
index acc2d1f..45b671e 100644 (file)
@@ -447,7 +447,7 @@ static int ksign_parse_signature(const uint8_t *datap, const uint8_t *endp,
        }
 
        for (i = 0; i < DSA_NSIG; i++) {
-               size_t remaining = endp - datap;
+               unsigned remaining = endp - datap;
                sig->data[i] = mpi_read_from_buffer(datap, &remaining);
                datap += remaining;
        }
index 762e2a8..276be07 100644 (file)
@@ -9,7 +9,7 @@ static int __init ksign_init(void)
        printk("ksign: Installing public key data\n");
 
        rc = ksign_load_keyring_from_buffer(ksign_def_public_key,
-                                           sizeof(ksign_def_public_key));
+                                           ksign_def_public_key_size);
        if (rc < 0)
                printk("Unable to load default keyring: error=%d\n", -rc);
 
index 32b0b63..b4adcfb 100644 (file)
@@ -29,7 +29,7 @@ static int ksign_signature_check(const struct ksign_signature *sig,
        struct ksign_public_key *pk;
        uint8_t sha1[SHA1_DIGEST_SIZE];
        MPI result = NULL;
-       int rc = 0, i;
+       int rc = 0;
 
        pk = ksign_get_public_key(sig->keyid);
        if (!pk) {
index 721ba80..6eebcb7 100644 (file)
@@ -1,5 +1,5 @@
 /* Copyright (c) 2004 Coraid, Inc.  See COPYING for GPL terms. */
-#define VERSION "10"
+#define VERSION "22"
 #define AOE_MAJOR 152
 #define DEVICE_NAME "aoe"
 
@@ -7,12 +7,12 @@
  * default is 16, which is 15 partitions plus the whole disk
  */
 #ifndef AOE_PARTITIONS
-#define AOE_PARTITIONS 16
+#define AOE_PARTITIONS (16)
 #endif
 
-#define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * 10 + (aoeminor))
-#define AOEMAJOR(sysminor) ((sysminor) / 10)
-#define AOEMINOR(sysminor) ((sysminor) % 10)
+#define SYSMINOR(aoemajor, aoeminor) ((aoemajor) * NPERSHELF + (aoeminor))
+#define AOEMAJOR(sysminor) ((sysminor) / NPERSHELF)
+#define AOEMINOR(sysminor) ((sysminor) % NPERSHELF)
 #define WHITESPACE " \t\v\f\n"
 
 enum {
@@ -75,15 +75,16 @@ enum {
        DEVFL_TKILL = (1<<1),   /* flag for timer to know when to kill self */
        DEVFL_EXT = (1<<2),     /* device accepts lba48 commands */
        DEVFL_CLOSEWAIT = (1<<3), /* device is waiting for all closes to revalidate */
-       DEVFL_WC_UPDATE = (1<<4), /* this device needs to update write cache status */
-       DEVFL_WORKON = (1<<4),
+       DEVFL_GDALLOC = (1<<4), /* need to alloc gendisk */
+       DEVFL_PAUSE = (1<<5),
+       DEVFL_NEWSIZE = (1<<6), /* need to update dev size in block layer */
 
        BUFFL_FAIL = 1,
 };
 
 enum {
        MAXATADATA = 1024,
-       NPERSHELF = 10,
+       NPERSHELF = 16,         /* number of slots per shelf address */
        FREETAG = -1,
        MIN_BUFS = 8,
 };
@@ -152,16 +153,17 @@ void aoechr_exit(void);
 void aoechr_error(char *);
 
 void aoecmd_work(struct aoedev *d);
-void aoecmd_cfg(ushort, unsigned char);
+void aoecmd_cfg(ushort aoemajor, unsigned char aoeminor);
 void aoecmd_ata_rsp(struct sk_buff *);
 void aoecmd_cfg_rsp(struct sk_buff *);
+void aoecmd_sleepwork(void *vp);
 
 int aoedev_init(void);
 void aoedev_exit(void);
 struct aoedev *aoedev_by_aoeaddr(int maj, int min);
+struct aoedev *aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt);
 void aoedev_downdev(struct aoedev *d);
-struct aoedev *aoedev_set(ulong, unsigned char *, struct net_device *, ulong);
-int aoedev_busy(void);
+int aoedev_isbusy(struct aoedev *d);
 
 int aoenet_init(void);
 void aoenet_exit(void);
index 0e97fcb..393b86a 100644 (file)
@@ -22,7 +22,9 @@ static ssize_t aoedisk_show_state(struct gendisk * disk, char *page)
        return snprintf(page, PAGE_SIZE,
                        "%s%s\n",
                        (d->flags & DEVFL_UP) ? "up" : "down",
-                       (d->flags & DEVFL_CLOSEWAIT) ? ",closewait" : "");
+                       (d->flags & DEVFL_PAUSE) ? ",paused" :
+                       (d->nopen && !(d->flags & DEVFL_UP)) ? ",closewait" : "");
+       /* I'd rather see nopen exported so we can ditch closewait */
 }
 static ssize_t aoedisk_show_mac(struct gendisk * disk, char *page)
 {
@@ -107,8 +109,7 @@ aoeblk_release(struct inode *inode, struct file *filp)
 
        spin_lock_irqsave(&d->lock, flags);
 
-       if (--d->nopen == 0 && (d->flags & DEVFL_CLOSEWAIT)) {
-               d->flags &= ~DEVFL_CLOSEWAIT;
+       if (--d->nopen == 0) {
                spin_unlock_irqrestore(&d->lock, flags);
                aoecmd_cfg(d->aoemajor, d->aoeminor);
                return 0;
@@ -158,49 +159,37 @@ aoeblk_make_request(request_queue_t *q, struct bio *bio)
        }
 
        list_add_tail(&buf->bufs, &d->bufq);
-       aoecmd_work(d);
 
+       aoecmd_work(d);
        sl = d->sendq_hd;
        d->sendq_hd = d->sendq_tl = NULL;
 
        spin_unlock_irqrestore(&d->lock, flags);
-
        aoenet_xmit(sl);
+
        return 0;
 }
 
-/* This ioctl implementation expects userland to have the device node
- * permissions set so that only priviledged users can open an aoe
- * block device directly.
- */
 static int
-aoeblk_ioctl(struct inode *inode, struct file *filp, uint cmd, ulong arg)
+aoeblk_getgeo(struct block_device *bdev, struct hd_geometry *geo)
 {
-       struct aoedev *d;
-
-       if (!arg)
-               return -EINVAL;
+       struct aoedev *d = bdev->bd_disk->private_data;
 
-       d = inode->i_bdev->bd_disk->private_data;
        if ((d->flags & DEVFL_UP) == 0) {
                printk(KERN_ERR "aoe: aoeblk_ioctl: disk not up\n");
                return -ENODEV;
        }
 
-       if (cmd == HDIO_GETGEO) {
-               d->geo.start = get_start_sect(inode->i_bdev);
-               if (!copy_to_user((void __user *) arg, &d->geo, sizeof d->geo))
-                       return 0;
-               return -EFAULT;
-       }
-       printk(KERN_INFO "aoe: aoeblk_ioctl: unknown ioctl %d\n", cmd);
-       return -EINVAL;
+       geo->cylinders = d->geo.cylinders;
+       geo->heads = d->geo.heads;
+       geo->sectors = d->geo.sectors;
+       return 0;
 }
 
 static struct block_device_operations aoe_bdops = {
        .open = aoeblk_open,
        .release = aoeblk_release,
-       .ioctl = aoeblk_ioctl,
+       .getgeo = aoeblk_getgeo,
        .owner = THIS_MODULE,
 };
 
@@ -217,20 +206,18 @@ aoeblk_gdalloc(void *vp)
                printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate disk "
                        "structure for %ld.%ld\n", d->aoemajor, d->aoeminor);
                spin_lock_irqsave(&d->lock, flags);
-               d->flags &= ~DEVFL_WORKON;
+               d->flags &= ~DEVFL_GDALLOC;
                spin_unlock_irqrestore(&d->lock, flags);
                return;
        }
 
-       d->bufpool = mempool_create(MIN_BUFS,
-                                   mempool_alloc_slab, mempool_free_slab,
-                                   buf_pool_cache);
+       d->bufpool = mempool_create_slab_pool(MIN_BUFS, buf_pool_cache);
        if (d->bufpool == NULL) {
                printk(KERN_ERR "aoe: aoeblk_gdalloc: cannot allocate bufpool "
                        "for %ld.%ld\n", d->aoemajor, d->aoeminor);
                put_disk(gd);
                spin_lock_irqsave(&d->lock, flags);
-               d->flags &= ~DEVFL_WORKON;
+               d->flags &= ~DEVFL_GDALLOC;
                spin_unlock_irqrestore(&d->lock, flags);
                return;
        }
@@ -247,18 +234,13 @@ aoeblk_gdalloc(void *vp)
 
        gd->queue = &d->blkq;
        d->gd = gd;
-       d->flags &= ~DEVFL_WORKON;
+       d->flags &= ~DEVFL_GDALLOC;
        d->flags |= DEVFL_UP;
 
        spin_unlock_irqrestore(&d->lock, flags);
 
        add_disk(gd);
        aoedisk_add_sysfs(d);
-       
-       printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu "
-               "sectors\n", (unsigned long long)mac_addr(d->addr),
-               d->aoemajor, d->aoeminor,
-               d->fw_ver, (long long)d->ssize);
 }
 
 void
index b5be4b7..39da28d 100644 (file)
@@ -8,6 +8,8 @@
 #include <linux/blkdev.h>
 #include <linux/skbuff.h>
 #include <linux/netdevice.h>
+#include <linux/genhd.h>
+#include <asm/unaligned.h>
 #include "aoe.h"
 
 #define TIMERTICK (HZ / 10)
@@ -27,6 +29,7 @@ new_skb(struct net_device *if_dev, ulong len)
                skb->protocol = __constant_htons(ETH_P_AOE);
                skb->priority = 0;
                skb_put(skb, len);
+               memset(skb->head, 0, len);
                skb->next = skb->prev = NULL;
 
                /* tell the network layer not to perform IP checksums
@@ -187,12 +190,67 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f)
        }
 }
 
+/* some callers cannot sleep, and they can call this function,
+ * transmitting the packets later, when interrupts are on
+ */
+static struct sk_buff *
+aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail)
+{
+       struct aoe_hdr *h;
+       struct aoe_cfghdr *ch;
+       struct sk_buff *skb, *sl, *sl_tail;
+       struct net_device *ifp;
+
+       sl = sl_tail = NULL;
+
+       read_lock(&dev_base_lock);
+       for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp->next) {
+               dev_hold(ifp);
+               if (!is_aoe_netif(ifp))
+                       continue;
+
+               skb = new_skb(ifp, sizeof *h + sizeof *ch);
+               if (skb == NULL) {
+                       printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n");
+                       continue;
+               }
+               if (sl_tail == NULL)
+                       sl_tail = skb;
+               h = (struct aoe_hdr *) skb->mac.raw;
+               memset(h, 0, sizeof *h + sizeof *ch);
+
+               memset(h->dst, 0xff, sizeof h->dst);
+               memcpy(h->src, ifp->dev_addr, sizeof h->src);
+               h->type = __constant_cpu_to_be16(ETH_P_AOE);
+               h->verfl = AOE_HVER;
+               h->major = cpu_to_be16(aoemajor);
+               h->minor = aoeminor;
+               h->cmd = AOECMD_CFG;
+
+               skb->next = sl;
+               sl = skb;
+       }
+       read_unlock(&dev_base_lock);
+
+       if (tail != NULL)
+               *tail = sl_tail;
+       return sl;
+}
+
 /* enters with d->lock held */
 void
 aoecmd_work(struct aoedev *d)
 {
        struct frame *f;
        struct buf *buf;
+
+       if (d->flags & DEVFL_PAUSE) {
+               if (!aoedev_isbusy(d))
+                       d->sendq_hd = aoecmd_cfg_pkts(d->aoemajor,
+                                               d->aoeminor, &d->sendq_tl);
+               return;
+       }
+
 loop:
        f = getframe(d, FREETAG);
        if (f == NULL)
@@ -228,6 +286,8 @@ rexmit(struct aoedev *d, struct frame *f)
        h = (struct aoe_hdr *) f->data;
        f->tag = n;
        h->tag = cpu_to_be32(n);
+       memcpy(h->dst, d->addr, sizeof h->dst);
+       memcpy(h->src, d->ifp->dev_addr, sizeof h->src);
 
        skb = skb_prepare(d, f);
        if (skb) {
@@ -271,7 +331,7 @@ rexmit_timer(ulong vp)
        spin_lock_irqsave(&d->lock, flags);
 
        if (d->flags & DEVFL_TKILL) {
-tdie:          spin_unlock_irqrestore(&d->lock, flags);
+               spin_unlock_irqrestore(&d->lock, flags);
                return;
        }
        f = d->frames;
@@ -282,7 +342,7 @@ tdie:               spin_unlock_irqrestore(&d->lock, flags);
                        n /= HZ;
                        if (n > MAXWAIT) { /* waited too long.  device failure. */
                                aoedev_downdev(d);
-                               goto tdie;
+                               break;
                        }
                        rexmit(d, f);
                }
@@ -304,6 +364,37 @@ tdie:              spin_unlock_irqrestore(&d->lock, flags);
        aoenet_xmit(sl);
 }
 
+/* this function performs work that has been deferred until sleeping is OK
+ */
+void
+aoecmd_sleepwork(void *vp)
+{
+       struct aoedev *d = (struct aoedev *) vp;
+
+       if (d->flags & DEVFL_GDALLOC)
+               aoeblk_gdalloc(d);
+
+       if (d->flags & DEVFL_NEWSIZE) {
+               struct block_device *bd;
+               unsigned long flags;
+               u64 ssize;
+
+               ssize = d->gd->capacity;
+               bd = bdget_disk(d->gd, 0);
+
+               if (bd) {
+                       mutex_lock(&bd->bd_inode->i_mutex);
+                       i_size_write(bd->bd_inode, (loff_t)ssize<<9);
+                       mutex_unlock(&bd->bd_inode->i_mutex);
+                       bdput(bd);
+               }
+               spin_lock_irqsave(&d->lock, flags);
+               d->flags |= DEVFL_UP;
+               d->flags &= ~DEVFL_NEWSIZE;
+               spin_unlock_irqrestore(&d->lock, flags);
+       }
+}
+
 static void
 ataid_complete(struct aoedev *d, unsigned char *id)
 {
@@ -311,16 +402,16 @@ ataid_complete(struct aoedev *d, unsigned char *id)
        u16 n;
 
        /* word 83: command set supported */
-       n = le16_to_cpup((__le16 *) &id[83<<1]);
+       n = le16_to_cpu(get_unaligned((__le16 *) &id[83<<1]));
 
        /* word 86: command set/feature enabled */
-       n |= le16_to_cpup((__le16 *) &id[86<<1]);
+       n |= le16_to_cpu(get_unaligned((__le16 *) &id[86<<1]));
 
        if (n & (1<<10)) {      /* bit 10: LBA 48 */
                d->flags |= DEVFL_EXT;
 
                /* word 100: number lba48 sectors */
-               ssize = le64_to_cpup((__le64 *) &id[100<<1]);
+               ssize = le64_to_cpu(get_unaligned((__le64 *) &id[100<<1]));
 
                /* set as in ide-disk.c:init_idedisk_capacity */
                d->geo.cylinders = ssize;
@@ -331,28 +422,36 @@ ataid_complete(struct aoedev *d, unsigned char *id)
                d->flags &= ~DEVFL_EXT;
 
                /* number lba28 sectors */
-               ssize = le32_to_cpup((__le32 *) &id[60<<1]);
+               ssize = le32_to_cpu(get_unaligned((__le32 *) &id[60<<1]));
 
                /* NOTE: obsolete in ATA 6 */
-               d->geo.cylinders = le16_to_cpup((__le16 *) &id[54<<1]);
-               d->geo.heads = le16_to_cpup((__le16 *) &id[55<<1]);
-               d->geo.sectors = le16_to_cpup((__le16 *) &id[56<<1]);
+               d->geo.cylinders = le16_to_cpu(get_unaligned((__le16 *) &id[54<<1]));
+               d->geo.heads = le16_to_cpu(get_unaligned((__le16 *) &id[55<<1]));
+               d->geo.sectors = le16_to_cpu(get_unaligned((__le16 *) &id[56<<1]));
        }
+
+       if (d->ssize != ssize)
+               printk(KERN_INFO "aoe: %012llx e%lu.%lu v%04x has %llu "
+                       "sectors\n", (unsigned long long)mac_addr(d->addr),
+                       d->aoemajor, d->aoeminor,
+                       d->fw_ver, (long long)ssize);
        d->ssize = ssize;
        d->geo.start = 0;
        if (d->gd != NULL) {
                d->gd->capacity = ssize;
-               d->flags |= DEVFL_UP;
-               return;
-       }
-       if (d->flags & DEVFL_WORKON) {
-               printk(KERN_INFO "aoe: ataid_complete: can't schedule work, it's already on!  "
-                       "(This really shouldn't happen).\n");
-               return;
+               d->flags |= DEVFL_NEWSIZE;
+       } else {
+               if (d->flags & DEVFL_GDALLOC) {
+                       printk(KERN_INFO "aoe: %s: %s e%lu.%lu, %s\n",
+                              __FUNCTION__,
+                              "can't schedule work for",
+                              d->aoemajor, d->aoeminor,
+                              "it's already on! (This really shouldn't happen).\n");
+                       return;
+               }
+               d->flags |= DEVFL_GDALLOC;
        }
-       INIT_WORK(&d->work, aoeblk_gdalloc, d);
        schedule_work(&d->work);
-       d->flags |= DEVFL_WORKON;
 }
 
 static void
@@ -418,6 +517,8 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        ahout = (struct aoe_atahdr *) (f->data + sizeof(struct aoe_hdr));
        buf = f->buf;
 
+       if (ahout->cmdstat == WIN_IDENTIFY)
+               d->flags &= ~DEVFL_PAUSE;
        if (ahin->cmdstat & 0xa9) {     /* these bits cleared on success */
                printk(KERN_CRIT "aoe: aoecmd_ata_rsp: ata error cmd=%2.2Xh "
                        "stat=%2.2Xh from e%ld.%ld\n", 
@@ -450,7 +551,6 @@ aoecmd_ata_rsp(struct sk_buff *skb)
                                return;
                        }
                        ataid_complete(d, (char *) (ahin+1));
-                       /* d->flags |= DEVFL_WC_UPDATE; */
                        break;
                default:
                        printk(KERN_INFO "aoe: aoecmd_ata_rsp: unrecognized "
@@ -467,16 +567,11 @@ aoecmd_ata_rsp(struct sk_buff *skb)
                        unsigned long duration = jiffies - buf->start_time;
                        unsigned long n_sect = buf->bio->bi_size >> 9;
                        struct gendisk *disk = d->gd;
+                       const int rw = bio_data_dir(buf->bio);
 
-                       if (bio_data_dir(buf->bio) == WRITE) {
-                               disk_stat_inc(disk, writes);
-                               disk_stat_add(disk, write_ticks, duration);
-                               disk_stat_add(disk, write_sectors, n_sect);
-                       } else {
-                               disk_stat_inc(disk, reads);
-                               disk_stat_add(disk, read_ticks, duration);
-                               disk_stat_add(disk, read_sectors, n_sect);
-                       }
+                       disk_stat_inc(disk, ios[rw]);
+                       disk_stat_add(disk, ticks[rw], duration);
+                       disk_stat_add(disk, sectors[rw], n_sect);
                        disk_stat_add(disk, io_ticks, duration);
                        n = (buf->flags & BUFFL_FAIL) ? -EIO : 0;
                        bio_endio(buf->bio, buf->bio->bi_size, n);
@@ -488,51 +583,19 @@ aoecmd_ata_rsp(struct sk_buff *skb)
        f->tag = FREETAG;
 
        aoecmd_work(d);
-
        sl = d->sendq_hd;
        d->sendq_hd = d->sendq_tl = NULL;
 
        spin_unlock_irqrestore(&d->lock, flags);
-
        aoenet_xmit(sl);
 }
 
 void
 aoecmd_cfg(ushort aoemajor, unsigned char aoeminor)
 {
-       struct aoe_hdr *h;
-       struct aoe_cfghdr *ch;
-       struct sk_buff *skb, *sl;
-       struct net_device *ifp;
-
-       sl = NULL;
-
-       read_lock(&dev_base_lock);
-       for (ifp = dev_base; ifp; dev_put(ifp), ifp = ifp->next) {
-               dev_hold(ifp);
-               if (!is_aoe_netif(ifp))
-                       continue;
-
-               skb = new_skb(ifp, sizeof *h + sizeof *ch);
-               if (skb == NULL) {
-                       printk(KERN_INFO "aoe: aoecmd_cfg: skb alloc failure\n");
-                       continue;
-               }
-               h = (struct aoe_hdr *) skb->mac.raw;
-               memset(h, 0, sizeof *h + sizeof *ch);
-
-               memset(h->dst, 0xff, sizeof h->dst);
-               memcpy(h->src, ifp->dev_addr, sizeof h->src);
-               h->type = __constant_cpu_to_be16(ETH_P_AOE);
-               h->verfl = AOE_HVER;
-               h->major = cpu_to_be16(aoemajor);
-               h->minor = aoeminor;
-               h->cmd = AOECMD_CFG;
+       struct sk_buff *sl;
 
-               skb->next = sl;
-               sl = skb;
-       }
-       read_unlock(&dev_base_lock);
+       sl = aoecmd_cfg_pkts(aoemajor, aoeminor, NULL);
 
        aoenet_xmit(sl);
 }
@@ -565,9 +628,6 @@ aoecmd_ata_id(struct aoedev *d)
        f->waited = 0;
        f->writedatalen = 0;
 
-       /* this message initializes the device, so we reset the rttavg */
-       d->rttavg = MAXTIMER;
-
        /* set up ata header */
        ah->scnt = 1;
        ah->cmdstat = WIN_IDENTIFY;
@@ -575,12 +635,8 @@ aoecmd_ata_id(struct aoedev *d)
 
        skb = skb_prepare(d, f);
 
-       /* we now want to start the rexmit tracking */
-       d->flags &= ~DEVFL_TKILL;
-       d->timer.data = (ulong) d;
+       d->rttavg = MAXTIMER;
        d->timer.function = rexmit_timer;
-       d->timer.expires = jiffies + TIMERTICK;
-       add_timer(&d->timer);
 
        return skb;
 }
@@ -594,7 +650,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        ulong flags, sysminor, aoemajor;
        u16 bufcnt;
        struct sk_buff *sl;
-       enum { MAXFRAMES = 8 };
+       enum { MAXFRAMES = 16 };
 
        h = (struct aoe_hdr *) skb->mac.raw;
        ch = (struct aoe_cfghdr *) (h+1);
@@ -622,23 +678,28 @@ aoecmd_cfg_rsp(struct sk_buff *skb)
        if (bufcnt > MAXFRAMES) /* keep it reasonable */
                bufcnt = MAXFRAMES;
 
-       d = aoedev_set(sysminor, h->src, skb->dev, bufcnt);
+       d = aoedev_by_sysminor_m(sysminor, bufcnt);
        if (d == NULL) {
-               printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device set failure\n");
+               printk(KERN_INFO "aoe: aoecmd_cfg_rsp: device sysminor_m failure\n");
                return;
        }
 
        spin_lock_irqsave(&d->lock, flags);
 
-       if (d->flags & (DEVFL_UP | DEVFL_CLOSEWAIT)) {
+       /* permit device to migrate mac and network interface */
+       d->ifp = skb->dev;
+       memcpy(d->addr, h->src, sizeof d->addr);
+
+       /* don't change users' perspective */
+       if (d->nopen && !(d->flags & DEVFL_PAUSE)) {
                spin_unlock_irqrestore(&d->lock, flags);
                return;
        }
-
+       d->flags |= DEVFL_PAUSE;        /* force pause */
        d->fw_ver = be16_to_cpu(ch->fwver);
 
-       /* we get here only if the device is new */
-       sl = aoecmd_ata_id(d);
+       /* check for already outstanding ataid */
+       sl = aoedev_isbusy(d) == 0 ? aoecmd_ata_id(d) : NULL;
 
        spin_unlock_irqrestore(&d->lock, flags);
 
index 6e231c5..ed4258a 100644 (file)
 static struct aoedev *devlist;
 static spinlock_t devlist_lock;
 
+int
+aoedev_isbusy(struct aoedev *d)
+{
+       struct frame *f, *e;
+
+       f = d->frames;
+       e = f + d->nframes;
+       do {
+               if (f->tag != FREETAG) {
+                       printk(KERN_DEBUG "aoe: %ld.%ld isbusy\n",
+                               d->aoemajor, d->aoeminor);
+                       return 1;
+               }
+       } while (++f < e);
+
+       return 0;
+}
+
 struct aoedev *
 aoedev_by_aoeaddr(int maj, int min)
 {
@@ -28,6 +46,18 @@ aoedev_by_aoeaddr(int maj, int min)
        return d;
 }
 
+static void
+dummy_timer(ulong vp)
+{
+       struct aoedev *d;
+
+       d = (struct aoedev *)vp;
+       if (d->flags & DEVFL_TKILL)
+               return;
+       d->timer.expires = jiffies + HZ;
+       add_timer(&d->timer);
+}
+
 /* called with devlist lock held */
 static struct aoedev *
 aoedev_newdev(ulong nframes)
@@ -35,7 +65,7 @@ aoedev_newdev(ulong nframes)
        struct aoedev *d;
        struct frame *f, *e;
 
-       d = kcalloc(1, sizeof *d, GFP_ATOMIC);
+       d = kzalloc(sizeof *d, GFP_ATOMIC);
        if (d == NULL)
                return NULL;
        f = kcalloc(nframes, sizeof *f, GFP_ATOMIC);
@@ -44,6 +74,8 @@ aoedev_newdev(ulong nframes)
                return NULL;
        }
 
+       INIT_WORK(&d->work, aoecmd_sleepwork, d);
+
        d->nframes = nframes;
        d->frames = f;
        e = f + nframes;
@@ -52,6 +84,10 @@ aoedev_newdev(ulong nframes)
 
        spin_lock_init(&d->lock);
        init_timer(&d->timer);
+       d->timer.data = (ulong) d;
+       d->timer.function = dummy_timer;
+       d->timer.expires = jiffies + HZ;
+       add_timer(&d->timer);
        d->bufpool = NULL;      /* defer to aoeblk_gdalloc */
        INIT_LIST_HEAD(&d->bufq);
        d->next = devlist;
@@ -67,9 +103,6 @@ aoedev_downdev(struct aoedev *d)
        struct buf *buf;
        struct bio *bio;
 
-       d->flags |= DEVFL_TKILL;
-       del_timer(&d->timer);
-
        f = d->frames;
        e = f + d->nframes;
        for (; f<e; f->tag = FREETAG, f->buf = NULL, f++) {
@@ -92,16 +125,15 @@ aoedev_downdev(struct aoedev *d)
                bio_endio(bio, bio->bi_size, -EIO);
        }
 
-       if (d->nopen)
-               d->flags |= DEVFL_CLOSEWAIT;
        if (d->gd)
                d->gd->capacity = 0;
 
-       d->flags &= ~DEVFL_UP;
+       d->flags &= ~(DEVFL_UP | DEVFL_PAUSE);
 }
 
+/* find it or malloc it */
 struct aoedev *
-aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bufcnt)
+aoedev_by_sysminor_m(ulong sysminor, ulong bufcnt)
 {
        struct aoedev *d;
        ulong flags;
@@ -112,25 +144,19 @@ aoedev_set(ulong sysminor, unsigned char *addr, struct net_device *ifp, ulong bu
                if (d->sysminor == sysminor)
                        break;
 
-       if (d == NULL && (d = aoedev_newdev(bufcnt)) == NULL) {
-               spin_unlock_irqrestore(&devlist_lock, flags);
-               printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n");
-               return NULL;
-       } /* if newdev, (d->flags & DEVFL_UP) == 0 for below */
-
-       spin_unlock_irqrestore(&devlist_lock, flags);
-       spin_lock_irqsave(&d->lock, flags);
-
-       d->ifp = ifp;
-       memcpy(d->addr, addr, sizeof d->addr);
-       if ((d->flags & DEVFL_UP) == 0) {
-               aoedev_downdev(d); /* flushes outstanding frames */
+       if (d == NULL) {
+               d = aoedev_newdev(bufcnt);
+               if (d == NULL) {
+                       spin_unlock_irqrestore(&devlist_lock, flags);
+                       printk(KERN_INFO "aoe: aoedev_set: aoedev_newdev failure.\n");
+                       return NULL;
+               }
                d->sysminor = sysminor;
                d->aoemajor = AOEMAJOR(sysminor);
                d->aoeminor = AOEMINOR(sysminor);
        }
 
-       spin_unlock_irqrestore(&d->lock, flags);
+       spin_unlock_irqrestore(&devlist_lock, flags);
        return d;
 }
 
@@ -161,6 +187,7 @@ aoedev_exit(void)
 
                spin_lock_irqsave(&d->lock, flags);
                aoedev_downdev(d);
+               d->flags |= DEVFL_TKILL;
                spin_unlock_irqrestore(&d->lock, flags);
 
                del_timer_sync(&d->timer);
index 387588a..de08491 100644 (file)
@@ -11,7 +11,7 @@
 
 MODULE_LICENSE("GPL");
 MODULE_AUTHOR("Sam Hopkins <sah@coraid.com>");
-MODULE_DESCRIPTION("AoE block/char driver for 2.6.[0-9]+");
+MODULE_DESCRIPTION("AoE block/char driver for 2.6.2 and newer 2.6 kernels");
 MODULE_VERSION(VERSION);
 
 enum { TINIT, TRUN, TKILL };
@@ -89,7 +89,7 @@ aoe_init(void)
        }
 
        printk(KERN_INFO
-              "aoe: aoe_init: AoE v2.6-%s initialised.\n",
+              "aoe: aoe_init: AoE v%s initialised.\n",
               VERSION);
        discover_timer(TINIT);
        return 0;
index 4587cbf..e5eff75 100644 (file)
@@ -6,21 +6,20 @@
  *
  *  based on the loop.c code by Theodore Ts'o.
  *
- * Copyright (C) 2002-2005 by Herbert Pötzl.
+ * Copyright (C) 2002-2006 by Herbert Pötzl.
  * Redistribution of this file is permitted under the
  * GNU General Public License.
  *
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/moduleparam.h>
 #include <linux/file.h>
 #include <linux/major.h>
 #include <linux/blkdev.h>
-#include <linux/devfs_fs_kernel.h>
 
 #include <linux/vroot.h>
+#include <linux/vserver/debug.h>
 
 
 static int max_vroot = 8;
@@ -60,9 +59,9 @@ static int vroot_set_dev(
        } else
                goto out_fput;
 
-       printk(KERN_INFO "vroot[%d]_set_dev: dev=%p[%d,%d]\n",
-               vr->vr_number, real_bdev,
-               imajor(real_bdev->bd_inode), iminor(real_bdev->bd_inode));
+       vxdprintk(VXD_CBIT(misc, 0),
+               "vroot[%d]_set_dev: dev=" VXF_DEV,
+               vr->vr_number, VXD_DEV(real_bdev));
 
        vr->vr_state = Vr_bound;
        error = 0;
@@ -87,9 +86,9 @@ static int vroot_clr_dev(
 
        real_bdev = vr->vr_device;
 
-       printk(KERN_INFO "vroot[%d]_clr_dev: dev=%p[%d,%d]\n",
-               vr->vr_number, real_bdev,
-               imajor(real_bdev->bd_inode), iminor(real_bdev->bd_inode));
+       vxdprintk(VXD_CBIT(misc, 0),
+               "vroot[%d]_clr_dev: dev=" VXF_DEV,
+               vr->vr_number, VXD_DEV(real_bdev));
 
        bdput(real_bdev);
        vr->vr_state = Vr_unbound;
@@ -147,7 +146,7 @@ static struct block_device_operations vr_fops = {
        .ioctl =        vr_ioctl,
 };
 
-struct block_device *vroot_get_real_bdev(struct block_device *bdev)
+struct block_device *__vroot_get_real_bdev(struct block_device *bdev)
 {
        struct inode *inode = bdev->bd_inode;
        struct vroot_device *vr;
@@ -157,9 +156,9 @@ struct block_device *vroot_get_real_bdev(struct block_device *bdev)
        vr = &vroot_dev[minor];
        real_bdev = vr->vr_device;
 
-       printk(KERN_INFO "vroot[%d]_get_real_bdev: dev=%p[%p,%d,%d]\n",
-               vr->vr_number, real_bdev, real_bdev->bd_inode,
-               imajor(real_bdev->bd_inode), iminor(real_bdev->bd_inode));
+       vxdprintk(VXD_CBIT(misc, 0),
+               "vroot[%d]_get_real_bdev: dev=" VXF_DEV,
+               vr->vr_number, VXD_DEV(real_bdev));
 
        if (vr->vr_state != Vr_bound)
                return ERR_PTR(-ENXIO);
@@ -184,7 +183,7 @@ MODULE_DESCRIPTION ("Virtual Root Device Mapper");
 
 int __init vroot_init(void)
 {
-       int     i;
+       int err, i;
 
        if (max_vroot < 1 || max_vroot > 256) {
                max_vroot = MAX_VROOT_DEFAULT;
@@ -196,6 +195,7 @@ int __init vroot_init(void)
        if (register_blkdev(VROOT_MAJOR, "vroot"))
                return -EIO;
 
+       err = -ENOMEM;
        vroot_dev = kmalloc(max_vroot * sizeof(struct vroot_device), GFP_KERNEL);
        if (!vroot_dev)
                goto out_mem1;
@@ -211,8 +211,6 @@ int __init vroot_init(void)
                        goto out_mem3;
        }
 
-       devfs_mk_dir("vroot");
-
        for (i = 0; i < max_vroot; i++) {
                struct vroot_device *vr = &vroot_dev[i];
                struct gendisk *disk = disks[i];
@@ -224,10 +222,13 @@ int __init vroot_init(void)
                disk->first_minor = i;
                disk->fops = &vr_fops;
                sprintf(disk->disk_name, "vroot%d", i);
-               sprintf(disk->devfs_name, "vroot/%d", i);
                disk->private_data = vr;
        }
 
+       err = register_vroot_grb(&__vroot_get_real_bdev);
+       if (err)
+               goto out_mem3;
+
        for (i = 0; i < max_vroot; i++)
                add_disk(disks[i]);
        printk(KERN_INFO "vroot: loaded (max %d devices)\n", max_vroot);
@@ -242,18 +243,20 @@ out_mem2:
 out_mem1:
        unregister_blkdev(VROOT_MAJOR, "vroot");
        printk(KERN_ERR "vroot: ran out of memory\n");
-       return -ENOMEM;
+       return err;
 }
 
 void vroot_exit(void)
 {
        int i;
 
+       if (unregister_vroot_grb(&__vroot_get_real_bdev))
+               printk(KERN_WARNING "vroot: cannot unregister grb\n");
+
        for (i = 0; i < max_vroot; i++) {
                del_gendisk(disks[i]);
                put_disk(disks[i]);
        }
-       devfs_remove("vroot");
        if (unregister_blkdev(VROOT_MAJOR, "vroot"))
                printk(KERN_WARNING "vroot: cannot unregister blkdev\n");
 
@@ -264,3 +267,15 @@ void vroot_exit(void)
 module_init(vroot_init);
 module_exit(vroot_exit);
 
+#ifndef MODULE
+
+static int __init max_vroot_setup(char *str)
+{
+       max_vroot = simple_strtol(str, NULL, 0);
+       return 1;
+}
+
+__setup("max_vroot=", max_vroot_setup);
+
+#endif
+
index 8d94c0b..40bfd9b 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * \file drm_agpsupport.
+ * \file drm_agpsupport.c
  * DRM support for AGP/GART backend
- *    
+ *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
  * \author Gareth Hughes <gareth@valinux.com>
  */
@@ -37,7 +37,7 @@
 #if __OS_HAS_AGP
 
 /**
- * AGP information ioctl.
+ * Get AGP information.
  *
  * \param inode device inode.
  * \param filp file pointer.
  * Verifies the AGP device has been initialized and acquired and fills in the
  * drm_agp_info structure with the information in drm_agp_head::agp_info.
  */
-int drm_agp_info(struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long arg)
+int drm_agp_info(drm_device_t * dev, drm_agp_info_t * info)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-       DRM_AGP_KERN     *kern;
-       drm_agp_info_t   info;
+       DRM_AGP_KERN *kern;
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
 
-       kern                   = &dev->agp->agp_info;
-       info.agp_version_major = kern->version.major;
-       info.agp_version_minor = kern->version.minor;
-       info.mode              = kern->mode;
-       info.aperture_base     = kern->aper_base;
-       info.aperture_size     = kern->aper_size * 1024 * 1024;
-       info.memory_allowed    = kern->max_memory << PAGE_SHIFT;
-       info.memory_used       = kern->current_memory << PAGE_SHIFT;
-       info.id_vendor         = kern->device->vendor;
-       info.id_device         = kern->device->device;
-
-       if (copy_to_user((drm_agp_info_t __user *)arg, &info, sizeof(info)))
+       kern = &dev->agp->agp_info;
+       info->agp_version_major = kern->version.major;
+       info->agp_version_minor = kern->version.minor;
+       info->mode = kern->mode;
+       info->aperture_base = kern->aper_base;
+       info->aperture_size = kern->aper_size * 1024 * 1024;
+       info->memory_allowed = kern->max_memory << PAGE_SHIFT;
+       info->memory_used = kern->current_memory << PAGE_SHIFT;
+       info->id_vendor = kern->device->vendor;
+       info->id_device = kern->device->device;
+
+       return 0;
+}
+
+EXPORT_SYMBOL(drm_agp_info);
+
+int drm_agp_info_ioctl(struct inode *inode, struct file *filp,
+                      unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_agp_info_t info;
+       int err;
+
+       err = drm_agp_info(dev, &info);
+       if (err)
+               return err;
+
+       if (copy_to_user((drm_agp_info_t __user *) arg, &info, sizeof(info)))
                return -EFAULT;
        return 0;
 }
 
 /**
- * Acquire the AGP device (ioctl).
+ * Acquire the AGP device.
  *
- * \param inode device inode.
- * \param filp file pointer.
- * \param cmd command.
- * \param arg user argument.
- * \return zero on success or a negative number on failure. 
+ * \param dev DRM device that is to acquire AGP.
+ * \return zero on success or a negative number on failure.
  *
  * Verifies the AGP device hasn't been acquired before and calls
- * agp_acquire().
+ * \c agp_backend_acquire.
  */
-int drm_agp_acquire(struct inode *inode, struct file *filp,
-                    unsigned int cmd, unsigned long arg)
+int drm_agp_acquire(drm_device_t * dev)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-
        if (!dev->agp)
                return -ENODEV;
        if (dev->agp->acquired)
@@ -103,8 +109,10 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
        return 0;
 }
 
+EXPORT_SYMBOL(drm_agp_acquire);
+
 /**
- * Release the AGP device (ioctl).
+ * Acquire the AGP device (ioctl).
  *
  * \param inode device inode.
  * \param filp file pointer.
@@ -112,64 +120,81 @@ int drm_agp_acquire(struct inode *inode, struct file *filp,
  * \param arg user argument.
  * \return zero on success or a negative number on failure.
  *
- * Verifies the AGP device has been acquired and calls agp_backend_release().
+ * Verifies the AGP device hasn't been acquired before and calls
+ * \c agp_backend_acquire.
  */
-int drm_agp_release(struct inode *inode, struct file *filp,
-                    unsigned int cmd, unsigned long arg)
+int drm_agp_acquire_ioctl(struct inode *inode, struct file *filp,
+                         unsigned int cmd, unsigned long arg)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
+       drm_file_t *priv = filp->private_data;
 
+       return drm_agp_acquire((drm_device_t *) priv->head->dev);
+}
+
+/**
+ * Release the AGP device.
+ *
+ * \param dev DRM device that is to release AGP.
+ * \return zero on success or a negative number on failure.
+ *
+ * Verifies the AGP device has been acquired and calls \c agp_backend_release.
+ */
+int drm_agp_release(drm_device_t * dev)
+{
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
        agp_backend_release(dev->agp->bridge);
        dev->agp->acquired = 0;
        return 0;
-
 }
+EXPORT_SYMBOL(drm_agp_release);
 
-/**
- * Release the AGP device.
- *
- * Calls agp_backend_release().
- */
-void drm_agp_do_release(drm_device_t *dev)
+int drm_agp_release_ioctl(struct inode *inode, struct file *filp,
+                         unsigned int cmd, unsigned long arg)
 {
-  agp_backend_release(dev->agp->bridge);
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+
+       return drm_agp_release(dev);
 }
 
 /**
  * Enable the AGP bus.
- * 
- * \param inode device inode.
- * \param filp file pointer.
- * \param cmd command.
- * \param arg pointer to a drm_agp_mode structure.
+ *
+ * \param dev DRM device that has previously acquired AGP.
+ * \param mode Requested AGP mode.
  * \return zero on success or a negative number on failure.
  *
  * Verifies the AGP device has been acquired but not enabled, and calls
- * agp_enable().
+ * \c agp_enable.
  */
-int drm_agp_enable(struct inode *inode, struct file *filp,
-                   unsigned int cmd, unsigned long arg)
+int drm_agp_enable(drm_device_t * dev, drm_agp_mode_t mode)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-       drm_agp_mode_t   mode;
-
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
 
-       if (copy_from_user(&mode, (drm_agp_mode_t __user *)arg, sizeof(mode)))
-               return -EFAULT;
-
-       dev->agp->mode    = mode.mode;
+       dev->agp->mode = mode.mode;
        agp_enable(dev->agp->bridge, mode.mode);
-       dev->agp->base    = dev->agp->agp_info.aper_base;
+       dev->agp->base = dev->agp->agp_info.aper_base;
        dev->agp->enabled = 1;
        return 0;
 }
 
+EXPORT_SYMBOL(drm_agp_enable);
+
+int drm_agp_enable_ioctl(struct inode *inode, struct file *filp,
+                        unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_agp_mode_t mode;
+
+       if (copy_from_user(&mode, (drm_agp_mode_t __user *) arg, sizeof(mode)))
+               return -EFAULT;
+
+       return drm_agp_enable(dev, mode);
+}
+
 /**
  * Allocate AGP memory.
  *
@@ -178,59 +203,74 @@ int drm_agp_enable(struct inode *inode, struct file *filp,
  * \param cmd command.
  * \param arg pointer to a drm_agp_buffer structure.
  * \return zero on success or a negative number on failure.
- * 
+ *
  * Verifies the AGP device is present and has been acquired, allocates the
  * memory via alloc_agp() and creates a drm_agp_mem entry for it.
  */
-int drm_agp_alloc(struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg)
+int drm_agp_alloc(drm_device_t *dev, drm_agp_buffer_t *request)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-       drm_agp_buffer_t request;
-       drm_agp_mem_t    *entry;
-       DRM_AGP_MEM      *memory;
-       unsigned long    pages;
-       u32              type;
-       drm_agp_buffer_t __user *argp = (void __user *)arg;
+       drm_agp_mem_t *entry;
+       DRM_AGP_MEM *memory;
+       unsigned long pages;
+       u32 type;
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
-       if (copy_from_user(&request, argp, sizeof(request)))
-               return -EFAULT;
        if (!(entry = drm_alloc(sizeof(*entry), DRM_MEM_AGPLISTS)))
                return -ENOMEM;
 
-       memset(entry, 0, sizeof(*entry));
+       memset(entry, 0, sizeof(*entry));
 
-       pages = (request.size + PAGE_SIZE - 1) / PAGE_SIZE;
-       type = (u32) request.type;
-
-       if (!(memory = drm_alloc_agp(dev->agp->bridge, pages, type))) {
+       pages = (request->size + PAGE_SIZE - 1) / PAGE_SIZE;
+       type = (u32) request->type;
+       if (!(memory = drm_alloc_agp(dev, pages, type))) {
                drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
                return -ENOMEM;
        }
 
-       entry->handle    = (unsigned long)memory->key + 1;
-       entry->memory    = memory;
-       entry->bound     = 0;
-       entry->pages     = pages;
-       entry->prev      = NULL;
-       entry->next      = dev->agp->memory;
+       entry->handle = (unsigned long)memory->key + 1;
+       entry->memory = memory;
+       entry->bound = 0;
+       entry->pages = pages;
+       entry->prev = NULL;
+       entry->next = dev->agp->memory;
        if (dev->agp->memory)
                dev->agp->memory->prev = entry;
        dev->agp->memory = entry;
 
-       request.handle   = entry->handle;
-       request.physical = memory->physical;
+       request->handle = entry->handle;
+       request->physical = memory->physical;
+
+       return 0;
+}
+EXPORT_SYMBOL(drm_agp_alloc);
+
+int drm_agp_alloc_ioctl(struct inode *inode, struct file *filp,
+                       unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_agp_buffer_t request;
+       drm_agp_buffer_t __user *argp = (void __user *)arg;
+       int err;
+
+       if (copy_from_user(&request, argp, sizeof(request)))
+               return -EFAULT;
+
+       err = drm_agp_alloc(dev, &request);
+       if (err)
+               return err;
 
        if (copy_to_user(argp, &request, sizeof(request))) {
-               dev->agp->memory       = entry->next;
+               drm_agp_mem_t *entry = dev->agp->memory;
+
+               dev->agp->memory = entry->next;
                dev->agp->memory->prev = NULL;
-               drm_free_agp(memory, pages);
+               drm_free_agp(entry->memory, entry->pages);
                drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
                return -EFAULT;
        }
+
        return 0;
 }
 
@@ -240,11 +280,11 @@ int drm_agp_alloc(struct inode *inode, struct file *filp,
  * \param dev DRM device structure.
  * \param handle AGP memory handle.
  * \return pointer to the drm_agp_mem structure associated with \p handle.
- * 
+ *
  * Walks through drm_agp_head::memory until finding a matching handle.
  */
-static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t *dev,
-                                           unsigned long handle)
+static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t * dev,
+                                          unsigned long handle)
 {
        drm_agp_mem_t *entry;
 
@@ -267,28 +307,37 @@ static drm_agp_mem_t *drm_agp_lookup_entry(drm_device_t *dev,
  * Verifies the AGP device is present and acquired, looks-up the AGP memory
  * entry and passes it to the unbind_agp() function.
  */
-int drm_agp_unbind(struct inode *inode, struct file *filp,
-                   unsigned int cmd, unsigned long arg)
+int drm_agp_unbind(drm_device_t *dev, drm_agp_binding_t *request)
 {
-       drm_file_t        *priv  = filp->private_data;
-       drm_device_t      *dev   = priv->head->dev;
-       drm_agp_binding_t request;
-       drm_agp_mem_t     *entry;
+       drm_agp_mem_t *entry;
        int ret;
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
-       if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request)))
-               return -EFAULT;
-       if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
+       if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
                return -EINVAL;
        if (!entry->bound)
                return -EINVAL;
        ret = drm_unbind_agp(entry->memory);
        if (ret == 0)
-           entry->bound = 0;
+               entry->bound = 0;
        return ret;
 }
+EXPORT_SYMBOL(drm_agp_unbind);
+
+int drm_agp_unbind_ioctl(struct inode *inode, struct file *filp,
+                        unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_agp_binding_t request;
+
+       if (copy_from_user
+           (&request, (drm_agp_binding_t __user *) arg, sizeof(request)))
+               return -EFAULT;
+
+       return drm_agp_unbind(dev, &request);
+}
 
 /**
  * Bind AGP memory into the GATT (ioctl)
@@ -303,25 +352,19 @@ int drm_agp_unbind(struct inode *inode, struct file *filp,
  * is currently bound into the GATT. Looks-up the AGP memory entry and passes
  * it to bind_agp() function.
  */
-int drm_agp_bind(struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long arg)
+int drm_agp_bind(drm_device_t *dev, drm_agp_binding_t *request)
 {
-       drm_file_t        *priv  = filp->private_data;
-       drm_device_t      *dev   = priv->head->dev;
-       drm_agp_binding_t request;
-       drm_agp_mem_t     *entry;
-       int               retcode;
-       int               page;
+       drm_agp_mem_t *entry;
+       int retcode;
+       int page;
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
-       if (copy_from_user(&request, (drm_agp_binding_t __user *)arg, sizeof(request)))
-               return -EFAULT;
-       if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
+       if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
                return -EINVAL;
        if (entry->bound)
                return -EINVAL;
-       page = (request.offset + PAGE_SIZE - 1) / PAGE_SIZE;
+       page = (request->offset + PAGE_SIZE - 1) / PAGE_SIZE;
        if ((retcode = drm_bind_agp(entry->memory, page)))
                return retcode;
        entry->bound = dev->agp->base + (page << PAGE_SHIFT);
@@ -329,6 +372,21 @@ int drm_agp_bind(struct inode *inode, struct file *filp,
                  dev->agp->base, entry->bound);
        return 0;
 }
+EXPORT_SYMBOL(drm_agp_bind);
+
+int drm_agp_bind_ioctl(struct inode *inode, struct file *filp,
+                      unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_agp_binding_t request;
+
+       if (copy_from_user
+           (&request, (drm_agp_binding_t __user *) arg, sizeof(request)))
+               return -EFAULT;
+
+       return drm_agp_bind(dev, &request);
+}
 
 /**
  * Free AGP memory (ioctl).
@@ -344,19 +402,13 @@ int drm_agp_bind(struct inode *inode, struct file *filp,
  * unbind_agp(). Frees it via free_agp() as well as the entry itself
  * and unlinks from the doubly linked list it's inserted in.
  */
-int drm_agp_free(struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long arg)
+int drm_agp_free(drm_device_t *dev, drm_agp_buffer_t *request)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-       drm_agp_buffer_t request;
-       drm_agp_mem_t    *entry;
+       drm_agp_mem_t *entry;
 
        if (!dev->agp || !dev->agp->acquired)
                return -EINVAL;
-       if (copy_from_user(&request, (drm_agp_buffer_t __user *)arg, sizeof(request)))
-               return -EFAULT;
-       if (!(entry = drm_agp_lookup_entry(dev, request.handle)))
+       if (!(entry = drm_agp_lookup_entry(dev, request->handle)))
                return -EINVAL;
        if (entry->bound)
                drm_unbind_agp(entry->memory);
@@ -373,16 +425,34 @@ int drm_agp_free(struct inode *inode, struct file *filp,
        drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
        return 0;
 }
+EXPORT_SYMBOL(drm_agp_free);
+
+int drm_agp_free_ioctl(struct inode *inode, struct file *filp,
+                      unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_agp_buffer_t request;
+
+       if (copy_from_user
+           (&request, (drm_agp_buffer_t __user *) arg, sizeof(request)))
+               return -EFAULT;
+
+       return drm_agp_free(dev, &request);
+}
 
 /**
  * Initialize the AGP resources.
  *
  * \return pointer to a drm_agp_head structure.
  *
+ * Gets the drm_agp_t structure which is made available by the agpgart module
+ * via the inter_module_* functions. Creates and initializes a drm_agp_head
+ * structure.
  */
-drm_agp_head_t *drm_agp_init(drm_device_t *dev)
+drm_agp_head_t *drm_agp_init(drm_device_t * dev)
 {
-       drm_agp_head_t *head         = NULL;
+       drm_agp_head_t *head = NULL;
 
        if (!(head = drm_alloc(sizeof(*head), DRM_MEM_AGPLISTS)))
                return NULL;
@@ -403,25 +473,21 @@ drm_agp_head_t *drm_agp_init(drm_device_t *dev)
                return NULL;
        }
        head->memory = NULL;
-#if LINUX_VERSION_CODE <= 0x020408
-       head->cant_use_aperture = 0;
-       head->page_mask = ~(0xfff);
-#else
        head->cant_use_aperture = head->agp_info.cant_use_aperture;
        head->page_mask = head->agp_info.page_mask;
-#endif
 
        return head;
 }
 
 /** Calls agp_allocate_memory() */
-DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data *bridge, size_t pages, u32 type)
+DRM_AGP_MEM *drm_agp_allocate_memory(struct agp_bridge_data * bridge,
+                                    size_t pages, u32 type)
 {
        return agp_allocate_memory(bridge, pages, type);
 }
 
 /** Calls agp_free_memory() */
-int drm_agp_free_memory(DRM_AGP_MEM *handle)
+int drm_agp_free_memory(DRM_AGP_MEM * handle)
 {
        if (!handle)
                return 0;
@@ -430,7 +496,7 @@ int drm_agp_free_memory(DRM_AGP_MEM *handle)
 }
 
 /** Calls agp_bind_memory() */
-int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start)
+int drm_agp_bind_memory(DRM_AGP_MEM * handle, off_t start)
 {
        if (!handle)
                return -EINVAL;
@@ -438,11 +504,11 @@ int drm_agp_bind_memory(DRM_AGP_MEM *handle, off_t start)
 }
 
 /** Calls agp_unbind_memory() */
-int drm_agp_unbind_memory(DRM_AGP_MEM *handle)
+int drm_agp_unbind_memory(DRM_AGP_MEM * handle)
 {
        if (!handle)
                return -EINVAL;
        return agp_unbind_memory(handle);
 }
 
-#endif /* __OS_HAS_AGP */
+#endif                         /* __OS_HAS_AGP */
index b428761..2a37586 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file drm_auth.
+ * \file drm_auth.c
  * IOCTLs for authentication
  *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
@@ -46,7 +46,7 @@
  */
 static int drm_hash_magic(drm_magic_t magic)
 {
-       return magic & (DRM_HASH_SIZE-1);
+       return magic & (DRM_HASH_SIZE - 1);
 }
 
 /**
@@ -56,85 +56,86 @@ static int drm_hash_magic(drm_magic_t magic)
  * \param magic magic number.
  *
  * Searches in drm_device::magiclist within all files with the same hash key
- * the one with matching magic number, while holding the drm_device::struct_sem
+ * the one with matching magic number, while holding the drm_device::struct_mutex
  * lock.
  */
-static drm_file_t *drm_find_file(drm_device_t *dev, drm_magic_t magic)
+static drm_file_t *drm_find_file(drm_device_t * dev, drm_magic_t magic)
 {
-       drm_file_t        *retval = NULL;
+       drm_file_t *retval = NULL;
        drm_magic_entry_t *pt;
-       int               hash    = drm_hash_magic(magic);
+       int hash = drm_hash_magic(magic);
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        for (pt = dev->magiclist[hash].head; pt; pt = pt->next) {
                if (pt->magic == magic) {
                        retval = pt->priv;
                        break;
                }
        }
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
        return retval;
 }
 
 /**
  * Adds a magic number.
- * 
+ *
  * \param dev DRM device.
  * \param priv file private data.
  * \param magic magic number.
  *
  * Creates a drm_magic_entry structure and appends to the linked list
  * associated the magic number hash key in drm_device::magiclist, while holding
- * the drm_device::struct_sem lock.
+ * the drm_device::struct_mutex lock.
  */
-int drm_add_magic(drm_device_t *dev, drm_file_t *priv, drm_magic_t magic)
+static int drm_add_magic(drm_device_t * dev, drm_file_t * priv,
+                        drm_magic_t magic)
 {
-       int               hash;
+       int hash;
        drm_magic_entry_t *entry;
 
        DRM_DEBUG("%d\n", magic);
 
-       hash         = drm_hash_magic(magic);
-       entry        = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC);
-       if (!entry) return -ENOMEM;
+       hash = drm_hash_magic(magic);
+       entry = drm_alloc(sizeof(*entry), DRM_MEM_MAGIC);
+       if (!entry)
+               return -ENOMEM;
        memset(entry, 0, sizeof(*entry));
        entry->magic = magic;
-       entry->priv  = priv;
-       entry->next  = NULL;
+       entry->priv = priv;
+       entry->next = NULL;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        if (dev->magiclist[hash].tail) {
                dev->magiclist[hash].tail->next = entry;
-               dev->magiclist[hash].tail       = entry;
+               dev->magiclist[hash].tail = entry;
        } else {
-               dev->magiclist[hash].head       = entry;
-               dev->magiclist[hash].tail       = entry;
+               dev->magiclist[hash].head = entry;
+               dev->magiclist[hash].tail = entry;
        }
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
 
        return 0;
 }
 
 /**
  * Remove a magic number.
- * 
+ *
  * \param dev DRM device.
  * \param magic magic number.
  *
  * Searches and unlinks the entry in drm_device::magiclist with the magic
- * number hash key, while holding the drm_device::struct_sem lock.
+ * number hash key, while holding the drm_device::struct_mutex lock.
  */
-int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
+static int drm_remove_magic(drm_device_t * dev, drm_magic_t magic)
 {
        drm_magic_entry_t *prev = NULL;
        drm_magic_entry_t *pt;
-       int               hash;
-
+       int hash;
 
        DRM_DEBUG("%d\n", magic);
        hash = drm_hash_magic(magic);
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        for (pt = dev->magiclist[hash].head; pt; prev = pt, pt = pt->next) {
                if (pt->magic == magic) {
                        if (dev->magiclist[hash].head == pt) {
@@ -146,11 +147,11 @@ int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
                        if (prev) {
                                prev->next = pt->next;
                        }
-                       up(&dev->struct_sem);
+                       mutex_unlock(&dev->struct_mutex);
                        return 0;
                }
        }
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
 
        drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
 
@@ -171,21 +172,22 @@ int drm_remove_magic(drm_device_t *dev, drm_magic_t magic)
  * filp.
  */
 int drm_getmagic(struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long arg)
+                unsigned int cmd, unsigned long arg)
 {
        static drm_magic_t sequence = 0;
        static DEFINE_SPINLOCK(lock);
-       drm_file_t         *priv    = filp->private_data;
-       drm_device_t       *dev     = priv->head->dev;
-       drm_auth_t         auth;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_auth_t auth;
 
-                               /* Find unique magic */
+       /* Find unique magic */
        if (priv->magic) {
                auth.magic = priv->magic;
        } else {
                do {
                        spin_lock(&lock);
-                       if (!sequence) ++sequence; /* reserve 0 */
+                       if (!sequence)
+                               ++sequence;     /* reserve 0 */
                        auth.magic = sequence++;
                        spin_unlock(&lock);
                } while (drm_find_file(dev, auth.magic));
@@ -194,7 +196,7 @@ int drm_getmagic(struct inode *inode, struct file *filp,
        }
 
        DRM_DEBUG("%u\n", auth.magic);
-       if (copy_to_user((drm_auth_t __user *)arg, &auth, sizeof(auth)))
+       if (copy_to_user((drm_auth_t __user *) arg, &auth, sizeof(auth)))
                return -EFAULT;
        return 0;
 }
@@ -211,14 +213,14 @@ int drm_getmagic(struct inode *inode, struct file *filp,
  * Checks if \p filp is associated with the magic number passed in \arg.
  */
 int drm_authmagic(struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg)
+                 unsigned int cmd, unsigned long arg)
 {
-       drm_file_t         *priv    = filp->private_data;
-       drm_device_t       *dev     = priv->head->dev;
-       drm_auth_t         auth;
-       drm_file_t         *file;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_auth_t auth;
+       drm_file_t *file;
 
-       if (copy_from_user(&auth, (drm_auth_t __user *)arg, sizeof(auth)))
+       if (copy_from_user(&auth, (drm_auth_t __user *) arg, sizeof(auth)))
                return -EFAULT;
        DRM_DEBUG("%u\n", auth.magic);
        if ((file = drm_find_file(dev, auth.magic))) {
index 4113bcb..006b06d 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * \file drm_bufs.
+ * \file drm_bufs.c
  * Generic buffer template
- * 
+ *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
  * \author Gareth Hughes <gareth@valinux.com>
  */
 #include <linux/vmalloc.h>
 #include "drmP.h"
 
-/**
- * Compute size order.  Returns the exponent of the smaller power of two which
- * is greater or equal to given number.
- * 
- * \param size size.
- * \return order.
- *
- * \todo Can be made faster.
- */
-int drm_order( unsigned long size )
+unsigned long drm_get_resource_start(drm_device_t *dev, unsigned int resource)
 {
-       int order;
-       unsigned long tmp;
+       return pci_resource_start(dev->pdev, resource);
+}
+EXPORT_SYMBOL(drm_get_resource_start);
 
-       for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++)
-               ;
+unsigned long drm_get_resource_len(drm_device_t *dev, unsigned int resource)
+{
+       return pci_resource_len(dev->pdev, resource);
+}
 
-       if (size & (size - 1))
-               ++order;
+EXPORT_SYMBOL(drm_get_resource_len);
 
-       return order;
+static drm_map_list_t *drm_find_matching_map(drm_device_t *dev,
+                                            drm_local_map_t *map)
+{
+       struct list_head *list;
+
+       list_for_each(list, &dev->maplist->head) {
+               drm_map_list_t *entry = list_entry(list, drm_map_list_t, head);
+               if (entry->map && map->type == entry->map->type &&
+                   entry->map->offset == map->offset) {
+                       return entry;
+               }
+       }
+
+       return NULL;
 }
-EXPORT_SYMBOL(drm_order);
+
+/*
+ * Used to allocate 32-bit handles for mappings.
+ */
+#define START_RANGE 0x10000000
+#define END_RANGE 0x40000000
+
+#ifdef _LP64
+static __inline__ unsigned int HandleID(unsigned long lhandle,
+                                       drm_device_t *dev)
+{
+       static unsigned int map32_handle = START_RANGE;
+       unsigned int hash;
+
+       if (lhandle & 0xffffffff00000000) {
+               hash = map32_handle;
+               map32_handle += PAGE_SIZE;
+               if (map32_handle > END_RANGE)
+                       map32_handle = START_RANGE;
+       } else
+               hash = lhandle;
+
+       while (1) {
+               drm_map_list_t *_entry;
+               list_for_each_entry(_entry, &dev->maplist->head, head) {
+                       if (_entry->user_token == hash)
+                               break;
+               }
+               if (&_entry->head == &dev->maplist->head)
+                       return hash;
+
+               hash += PAGE_SIZE;
+               map32_handle += PAGE_SIZE;
+       }
+}
+#else
+# define HandleID(x,dev) (unsigned int)(x)
+#endif
 
 /**
  * Ioctl to specify a range of memory that is available for mapping by a non-root process.
@@ -73,86 +116,100 @@ EXPORT_SYMBOL(drm_order);
  * type.  Adds the map to the map list drm_device::maplist. Adds MTRR's where
  * applicable and if supported by the kernel.
  */
-int drm_addmap( struct inode *inode, struct file *filp,
-                unsigned int cmd, unsigned long arg )
+static int drm_addmap_core(drm_device_t * dev, unsigned int offset,
+                          unsigned int size, drm_map_type_t type,
+                          drm_map_flags_t flags, drm_map_list_t ** maplist)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
        drm_map_t *map;
-       drm_map_t __user *argp = (void __user *)arg;
        drm_map_list_t *list;
+       drm_dma_handle_t *dmah;
 
-       if ( !(filp->f_mode & 3) ) return -EACCES; /* Require read/write */
-
-       map = drm_alloc( sizeof(*map), DRM_MEM_MAPS );
-       if ( !map )
+       map = drm_alloc(sizeof(*map), DRM_MEM_MAPS);
+       if (!map)
                return -ENOMEM;
 
-       if ( copy_from_user( map, argp, sizeof(*map) ) ) {
-               drm_free( map, sizeof(*map), DRM_MEM_MAPS );
-               return -EFAULT;
-       }
+       map->offset = offset;
+       map->size = size;
+       map->flags = flags;
+       map->type = type;
 
        /* Only allow shared memory to be removable since we only keep enough
         * book keeping information about shared memory to allow for removal
         * when processes fork.
         */
-       if ( (map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM ) {
-               drm_free( map, sizeof(*map), DRM_MEM_MAPS );
+       if ((map->flags & _DRM_REMOVABLE) && map->type != _DRM_SHM) {
+               drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                return -EINVAL;
        }
-       DRM_DEBUG( "offset = 0x%08lx, size = 0x%08lx, type = %d\n",
-                  map->offset, map->size, map->type );
-       if ( (map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK)) ) {
-               drm_free( map, sizeof(*map), DRM_MEM_MAPS );
+       DRM_DEBUG("offset = 0x%08lx, size = 0x%08lx, type = %d\n",
+                 map->offset, map->size, map->type);
+       if ((map->offset & (~PAGE_MASK)) || (map->size & (~PAGE_MASK))) {
+               drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                return -EINVAL;
        }
-       map->mtrr   = -1;
+       map->mtrr = -1;
        map->handle = NULL;
 
-       switch ( map->type ) {
+       switch (map->type) {
        case _DRM_REGISTERS:
        case _DRM_FRAME_BUFFER:
-#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__)
-               if ( map->offset + map->size < map->offset ||
-                    map->offset < virt_to_phys(high_memory) ) {
-                       drm_free( map, sizeof(*map), DRM_MEM_MAPS );
+#if !defined(__sparc__) && !defined(__alpha__) && !defined(__ia64__) && !defined(__powerpc64__) && !defined(__x86_64__)
+               if (map->offset + (map->size-1) < map->offset ||
+                   map->offset < virt_to_phys(high_memory)) {
+                       drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                        return -EINVAL;
                }
 #endif
 #ifdef __alpha__
                map->offset += dev->hose->mem_space->start;
 #endif
+               /* Some drivers preinitialize some maps, without the X Server
+                * needing to be aware of it.  Therefore, we just return success
+                * when the server tries to create a duplicate map.
+                */
+               list = drm_find_matching_map(dev, map);
+               if (list != NULL) {
+                       if (list->map->size != map->size) {
+                               DRM_DEBUG("Matching maps of type %d with "
+                                         "mismatched sizes, (%ld vs %ld)\n",
+                                         map->type, map->size,
+                                         list->map->size);
+                               list->map->size = map->size;
+                       }
+
+                       drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+                       *maplist = list;
+                       return 0;
+               }
+
                if (drm_core_has_MTRR(dev)) {
-                       if ( map->type == _DRM_FRAME_BUFFER ||
-                            (map->flags & _DRM_WRITE_COMBINING) ) {
-                               map->mtrr = mtrr_add( map->offset, map->size,
-                                                     MTRR_TYPE_WRCOMB, 1 );
+                       if (map->type == _DRM_FRAME_BUFFER ||
+                           (map->flags & _DRM_WRITE_COMBINING)) {
+                               map->mtrr = mtrr_add(map->offset, map->size,
+                                                    MTRR_TYPE_WRCOMB, 1);
                        }
                }
                if (map->type == _DRM_REGISTERS)
-                       map->handle = drm_ioremap( map->offset, map->size,
-                                                   dev );
+                       map->handle = drm_ioremap(map->offset, map->size, dev);
                break;
 
        case _DRM_SHM:
                map->handle = vmalloc_32(map->size);
-               DRM_DEBUG( "%lu %d %p\n",
-                          map->size, drm_order( map->size ), map->handle );
-               if ( !map->handle ) {
-                       drm_free( map, sizeof(*map), DRM_MEM_MAPS );
+               DRM_DEBUG("%lu %d %p\n",
+                         map->size, drm_order(map->size), map->handle);
+               if (!map->handle) {
+                       drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                        return -ENOMEM;
                }
                map->offset = (unsigned long)map->handle;
-               if ( map->flags & _DRM_CONTAINS_LOCK ) {
+               if (map->flags & _DRM_CONTAINS_LOCK) {
                        /* Prevent a 2nd X Server from creating a 2nd lock */
                        if (dev->lock.hw_lock != NULL) {
-                               vfree( map->handle );
-                               drm_free( map, sizeof(*map), DRM_MEM_MAPS );
+                               vfree(map->handle);
+                               drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                                return -EBUSY;
                        }
-                       dev->sigdata.lock =
-                       dev->lock.hw_lock = map->handle; /* Pointer to lock */
+                       dev->sigdata.lock = dev->lock.hw_lock = map->handle;    /* Pointer to lock */
                }
                break;
        case _DRM_AGP:
@@ -161,7 +218,7 @@ int drm_addmap( struct inode *inode, struct file *filp,
                        map->offset += dev->hose->mem_space->start;
 #endif
                        map->offset += dev->agp->base;
-                       map->mtrr   = dev->agp->agp_mtrr; /* for getmap */
+                       map->mtrr = dev->agp->agp_mtrr; /* for getmap */
                }
                break;
        case _DRM_SCATTER_GATHER:
@@ -169,38 +226,98 @@ int drm_addmap( struct inode *inode, struct file *filp,
                        drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                        return -EINVAL;
                }
-               map->offset += dev->sg->handle;
+               map->offset += (unsigned long)dev->sg->virtual;
+               break;
+       case _DRM_CONSISTENT:
+               /* dma_addr_t is 64bit on i386 with CONFIG_HIGHMEM64G,
+                * As we're limiting the address to 2^32-1 (or less),
+                * casting it down to 32 bits is no problem, but we
+                * need to point to a 64bit variable first. */
+               dmah = drm_pci_alloc(dev, map->size, map->size, 0xffffffffUL);
+               if (!dmah) {
+                       drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+                       return -ENOMEM;
+               }
+               map->handle = dmah->vaddr;
+               map->offset = (unsigned long)dmah->busaddr;
+               kfree(dmah);
                break;
-
        default:
-               drm_free( map, sizeof(*map), DRM_MEM_MAPS );
+               drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                return -EINVAL;
        }
 
        list = drm_alloc(sizeof(*list), DRM_MEM_MAPS);
-       if(!list) {
+       if (!list) {
                drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                return -EINVAL;
        }
        memset(list, 0, sizeof(*list));
        list->map = map;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        list_add(&list->head, &dev->maplist->head);
-       up(&dev->struct_sem);
+       /* Assign a 32-bit handle */
+       /* We do it here so that dev->struct_mutex protects the increment */
+       list->user_token = HandleID(map->type == _DRM_SHM
+                                   ? (unsigned long)map->handle
+                                   : map->offset, dev);
+       mutex_unlock(&dev->struct_mutex);
+
+       *maplist = list;
+       return 0;
+}
+
+int drm_addmap(drm_device_t * dev, unsigned int offset,
+              unsigned int size, drm_map_type_t type,
+              drm_map_flags_t flags, drm_local_map_t ** map_ptr)
+{
+       drm_map_list_t *list;
+       int rc;
+
+       rc = drm_addmap_core(dev, offset, size, type, flags, &list);
+       if (!rc)
+               *map_ptr = list->map;
+       return rc;
+}
+
+EXPORT_SYMBOL(drm_addmap);
+
+int drm_addmap_ioctl(struct inode *inode, struct file *filp,
+                    unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_map_t map;
+       drm_map_list_t *maplist;
+       drm_map_t __user *argp = (void __user *)arg;
+       int err;
 
-       if ( copy_to_user( argp, map, sizeof(*map) ) )
+       if (!(filp->f_mode & 3))
+               return -EACCES; /* Require read/write */
+
+       if (copy_from_user(&map, argp, sizeof(map))) {
                return -EFAULT;
-       if ( map->type != _DRM_SHM ) {
-               if ( copy_to_user( &argp->handle,
-                                  &map->offset,
-                                  sizeof(map->offset) ) )
-                       return -EFAULT;
        }
+
+       if (!(capable(CAP_SYS_ADMIN) || map.type == _DRM_AGP))
+               return -EPERM;
+
+       err = drm_addmap_core(dev, map.offset, map.size, map.type, map.flags,
+                             &maplist);
+
+       if (err)
+               return err;
+
+       if (copy_to_user(argp, maplist->map, sizeof(drm_map_t)))
+               return -EFAULT;
+
+       /* avoid a warning on 64-bit, this casting isn't very nice, but the API is set so too late */
+       if (put_user((void *)(unsigned long)maplist->user_token, &argp->handle))
+               return -EFAULT;
        return 0;
 }
 
-
 /**
  * Remove a map private from list and deallocate resources if the mapping
  * isn't in use.
@@ -215,117 +332,167 @@ int drm_addmap( struct inode *inode, struct file *filp,
  * its being used, and free any associate resource (such as MTRR's) if it's not
  * being on use.
  *
- * \sa addmap().
+ * \sa drm_addmap
  */
-int drm_rmmap(struct inode *inode, struct file *filp,
-              unsigned int cmd, unsigned long arg)
+int drm_rmmap_locked(drm_device_t *dev, drm_local_map_t *map)
 {
-       drm_file_t      *priv   = filp->private_data;
-       drm_device_t    *dev    = priv->head->dev;
        struct list_head *list;
        drm_map_list_t *r_list = NULL;
-       drm_vma_entry_t *pt, *prev;
-       drm_map_t *map;
+       drm_dma_handle_t dmah;
+
+       /* Find the list entry for the map and remove it */
+       list_for_each(list, &dev->maplist->head) {
+               r_list = list_entry(list, drm_map_list_t, head);
+
+               if (r_list->map == map) {
+                       list_del(list);
+                       drm_free(list, sizeof(*list), DRM_MEM_MAPS);
+                       break;
+               }
+       }
+
+       /* List has wrapped around to the head pointer, or it's empty and we
+        * didn't find anything.
+        */
+       if (list == (&dev->maplist->head)) {
+               return -EINVAL;
+       }
+
+       switch (map->type) {
+       case _DRM_REGISTERS:
+               drm_ioremapfree(map->handle, map->size, dev);
+               /* FALLTHROUGH */
+       case _DRM_FRAME_BUFFER:
+               if (drm_core_has_MTRR(dev) && map->mtrr >= 0) {
+                       int retcode;
+                       retcode = mtrr_del(map->mtrr, map->offset, map->size);
+                       DRM_DEBUG("mtrr_del=%d\n", retcode);
+               }
+               break;
+       case _DRM_SHM:
+               vfree(map->handle);
+               break;
+       case _DRM_AGP:
+       case _DRM_SCATTER_GATHER:
+               break;
+       case _DRM_CONSISTENT:
+               dmah.vaddr = map->handle;
+               dmah.busaddr = map->offset;
+               dmah.size = map->size;
+               __drm_pci_free(dev, &dmah);
+               break;
+       }
+       drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+
+       return 0;
+}
+
+int drm_rmmap(drm_device_t *dev, drm_local_map_t *map)
+{
+       int ret;
+
+       mutex_lock(&dev->struct_mutex);
+       ret = drm_rmmap_locked(dev, map);
+       mutex_unlock(&dev->struct_mutex);
+
+       return ret;
+}
+
+/* The rmmap ioctl appears to be unnecessary.  All mappings are torn down on
+ * the last close of the device, and this is necessary for cleanup when things
+ * exit uncleanly.  Therefore, having userland manually remove mappings seems
+ * like a pointless exercise since they're going away anyway.
+ *
+ * One use case might be after addmap is allowed for normal users for SHM and
+ * gets used by drivers that the server doesn't need to care about.  This seems
+ * unlikely.
+ */
+int drm_rmmap_ioctl(struct inode *inode, struct file *filp,
+                   unsigned int cmd, unsigned long arg)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
        drm_map_t request;
-       int found_maps = 0;
+       drm_local_map_t *map = NULL;
+       struct list_head *list;
+       int ret;
 
-       if (copy_from_user(&request, (drm_map_t __user *)arg,
-                          sizeof(request))) {
+       if (copy_from_user(&request, (drm_map_t __user *) arg, sizeof(request))) {
                return -EFAULT;
        }
 
-       down(&dev->struct_sem);
-       list = &dev->maplist->head;
+       mutex_lock(&dev->struct_mutex);
        list_for_each(list, &dev->maplist->head) {
-               r_list = list_entry(list, drm_map_list_t, head);
+               drm_map_list_t *r_list = list_entry(list, drm_map_list_t, head);
 
-               if(r_list->map &&
-                  r_list->map->handle == request.handle &&
-                  r_list->map->flags & _DRM_REMOVABLE) break;
+               if (r_list->map &&
+                   r_list->user_token == (unsigned long)request.handle &&
+                   r_list->map->flags & _DRM_REMOVABLE) {
+                       map = r_list->map;
+                       break;
+               }
        }
 
        /* List has wrapped around to the head pointer, or its empty we didn't
         * find anything.
         */
-       if(list == (&dev->maplist->head)) {
-               up(&dev->struct_sem);
+       if (list == (&dev->maplist->head)) {
+               mutex_unlock(&dev->struct_mutex);
                return -EINVAL;
        }
-       map = r_list->map;
-       list_del(list);
-       drm_free(list, sizeof(*list), DRM_MEM_MAPS);
 
-       for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
-               if (pt->vma->vm_private_data == map) found_maps++;
-       }
+       if (!map)
+               return -EINVAL;
 
-       if(!found_maps) {
-               switch (map->type) {
-               case _DRM_REGISTERS:
-               case _DRM_FRAME_BUFFER:
-                 if (drm_core_has_MTRR(dev)) {
-                               if (map->mtrr >= 0) {
-                                       int retcode;
-                                       retcode = mtrr_del(map->mtrr,
-                                                          map->offset,
-                                                          map->size);
-                                       DRM_DEBUG("mtrr_del = %d\n", retcode);
-                               }
-                       }
-                       drm_ioremapfree(map->handle, map->size, dev);
-                       break;
-               case _DRM_SHM:
-                       vfree(map->handle);
-                       break;
-               case _DRM_AGP:
-               case _DRM_SCATTER_GATHER:
-                       break;
-               }
-               drm_free(map, sizeof(*map), DRM_MEM_MAPS);
+       /* Register and framebuffer maps are permanent */
+       if ((map->type == _DRM_REGISTERS) || (map->type == _DRM_FRAME_BUFFER)) {
+               mutex_unlock(&dev->struct_mutex);
+               return 0;
        }
-       up(&dev->struct_sem);
-       return 0;
+
+       ret = drm_rmmap_locked(dev, map);
+
+       mutex_unlock(&dev->struct_mutex);
+
+       return ret;
 }
 
 /**
  * Cleanup after an error on one of the addbufs() functions.
  *
+ * \param dev DRM device.
  * \param entry buffer entry where the error occurred.
  *
  * Frees any pages and buffers associated with the given entry.
  */
-static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry)
+static void drm_cleanup_buf_error(drm_device_t * dev, drm_buf_entry_t * entry)
 {
        int i;
 
        if (entry->seg_count) {
                for (i = 0; i < entry->seg_count; i++) {
                        if (entry->seglist[i]) {
-                               drm_free_pages(entry->seglist[i],
-                                               entry->page_order,
-                                               DRM_MEM_DMA);
+                               drm_pci_free(dev, entry->seglist[i]);
                        }
                }
                drm_free(entry->seglist,
-                         entry->seg_count *
-                         sizeof(*entry->seglist),
-                         DRM_MEM_SEGS);
+                        entry->seg_count *
+                        sizeof(*entry->seglist), DRM_MEM_SEGS);
 
                entry->seg_count = 0;
        }
 
-       if (entry->buf_count) {
-               for (i = 0; i < entry->buf_count; i++) {
+       if (entry->buf_count) {
+               for (i = 0; i < entry->buf_count; i++) {
                        if (entry->buflist[i].dev_private) {
                                drm_free(entry->buflist[i].dev_private,
-                                         entry->buflist[i].dev_priv_size,
-                                         DRM_MEM_BUFS);
+                                        entry->buflist[i].dev_priv_size,
+                                        DRM_MEM_BUFS);
                        }
                }
                drm_free(entry->buflist,
-                         entry->buf_count *
-                         sizeof(*entry->buflist),
-                         DRM_MEM_BUFS);
+                        entry->buf_count *
+                        sizeof(*entry->buflist), DRM_MEM_BUFS);
 
                entry->buf_count = 0;
        }
@@ -333,25 +500,19 @@ static void drm_cleanup_buf_error(drm_device_t *dev, drm_buf_entry_t *entry)
 
 #if __OS_HAS_AGP
 /**
- * Add AGP buffers for DMA transfers (ioctl).
+ * Add AGP buffers for DMA transfers.
  *
- * \param inode device inode.
- * \param filp file pointer.
- * \param cmd command.
- * \param arg pointer to a drm_buf_desc_t request.
+ * \param dev drm_device_t to which the buffers are to be added.
+ * \param request pointer to a drm_buf_desc_t describing the request.
  * \return zero on success or a negative number on failure.
- * 
+ *
  * After some sanity checks creates a drm_buf structure for each buffer and
  * reallocates the buffer list of the same size order to accommodate the new
  * buffers.
  */
-int drm_addbufs_agp( struct inode *inode, struct file *filp,
-                     unsigned int cmd, unsigned long arg )
+int drm_addbufs_agp(drm_device_t * dev, drm_buf_desc_t * request)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
        drm_device_dma_t *dma = dev->dma;
-       drm_buf_desc_t request;
        drm_buf_entry_t *entry;
        drm_buf_t *buf;
        unsigned long offset;
@@ -365,165 +526,156 @@ int drm_addbufs_agp( struct inode *inode, struct file *filp,
        int byte_count;
        int i;
        drm_buf_t **temp_buflist;
-       drm_buf_desc_t __user *argp = (void __user *)arg;
-
-       if ( !dma ) return -EINVAL;
 
-       if ( copy_from_user( &request, argp,
-                            sizeof(request) ) )
-               return -EFAULT;
+       if (!dma)
+               return -EINVAL;
 
-       count = request.count;
-       order = drm_order( request.size );
+       count = request->count;
+       order = drm_order(request->size);
        size = 1 << order;
 
-       alignment  = (request.flags & _DRM_PAGE_ALIGN)
-               ? PAGE_ALIGN(size) : size;
+       alignment = (request->flags & _DRM_PAGE_ALIGN)
+           ? PAGE_ALIGN(size) : size;
        page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
        total = PAGE_SIZE << page_order;
 
        byte_count = 0;
-       agp_offset = dev->agp->base + request.agp_start;
-
-       DRM_DEBUG( "count:      %d\n",  count );
-       DRM_DEBUG( "order:      %d\n",  order );
-       DRM_DEBUG( "size:       %d\n",  size );
-       DRM_DEBUG( "agp_offset: %lu\n", agp_offset );
-       DRM_DEBUG( "alignment:  %d\n",  alignment );
-       DRM_DEBUG( "page_order: %d\n",  page_order );
-       DRM_DEBUG( "total:      %d\n",  total );
-
-       if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL;
-       if ( dev->queue_count ) return -EBUSY; /* Not while in use */
-
-       spin_lock( &dev->count_lock );
-       if ( dev->buf_use ) {
-               spin_unlock( &dev->count_lock );
+       agp_offset = dev->agp->base + request->agp_start;
+
+       DRM_DEBUG("count:      %d\n", count);
+       DRM_DEBUG("order:      %d\n", order);
+       DRM_DEBUG("size:       %d\n", size);
+       DRM_DEBUG("agp_offset: %lx\n", agp_offset);
+       DRM_DEBUG("alignment:  %d\n", alignment);
+       DRM_DEBUG("page_order: %d\n", page_order);
+       DRM_DEBUG("total:      %d\n", total);
+
+       if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
+               return -EINVAL;
+       if (dev->queue_count)
+               return -EBUSY;  /* Not while in use */
+
+       spin_lock(&dev->count_lock);
+       if (dev->buf_use) {
+               spin_unlock(&dev->count_lock);
                return -EBUSY;
        }
-       atomic_inc( &dev->buf_alloc );
-       spin_unlock( &dev->count_lock );
+       atomic_inc(&dev->buf_alloc);
+       spin_unlock(&dev->count_lock);
 
-       down( &dev->struct_sem );
+       mutex_lock(&dev->struct_mutex);
        entry = &dma->bufs[order];
-       if ( entry->buf_count ) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
-               return -ENOMEM; /* May only call once for each order */
+       if (entry->buf_count) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
+               return -ENOMEM; /* May only call once for each order */
        }
 
        if (count < 0 || count > 4096) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -EINVAL;
        }
 
-       entry->buflist = drm_alloc( count * sizeof(*entry->buflist),
-                                   DRM_MEM_BUFS );
-       if ( !entry->buflist ) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+       entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+                                  DRM_MEM_BUFS);
+       if (!entry->buflist) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
-       memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
+       memset(entry->buflist, 0, count * sizeof(*entry->buflist));
 
        entry->buf_size = size;
        entry->page_order = page_order;
 
        offset = 0;
 
-       while ( entry->buf_count < count ) {
-               buf          = &entry->buflist[entry->buf_count];
-               buf->idx     = dma->buf_count + entry->buf_count;
-               buf->total   = alignment;
-               buf->order   = order;
-               buf->used    = 0;
+       while (entry->buf_count < count) {
+               buf = &entry->buflist[entry->buf_count];
+               buf->idx = dma->buf_count + entry->buf_count;
+               buf->total = alignment;
+               buf->order = order;
+               buf->used = 0;
 
-               buf->offset  = (dma->byte_count + offset);
+               buf->offset = (dma->byte_count + offset);
                buf->bus_address = agp_offset + offset;
                buf->address = (void *)(agp_offset + offset);
-               buf->next    = NULL;
+               buf->next = NULL;
                buf->waiting = 0;
                buf->pending = 0;
-               init_waitqueue_head( &buf->dma_wait );
-               buf->filp    = NULL;
+               init_waitqueue_head(&buf->dma_wait);
+               buf->filp = NULL;
 
                buf->dev_priv_size = dev->driver->dev_priv_size;
-               buf->dev_private = drm_alloc( buf->dev_priv_size,
-                                              DRM_MEM_BUFS );
-               if(!buf->dev_private) {
+               buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
+               if (!buf->dev_private) {
                        /* Set count correctly so we free the proper amount. */
                        entry->buf_count = count;
-                       drm_cleanup_buf_error(dev,entry);
-                       up( &dev->struct_sem );
-                       atomic_dec( &dev->buf_alloc );
+                       drm_cleanup_buf_error(dev, entry);
+                       mutex_unlock(&dev->struct_mutex);
+                       atomic_dec(&dev->buf_alloc);
                        return -ENOMEM;
                }
-               memset( buf->dev_private, 0, buf->dev_priv_size );
+               memset(buf->dev_private, 0, buf->dev_priv_size);
 
-               DRM_DEBUG( "buffer %d @ %p\n",
-                          entry->buf_count, buf->address );
+               DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
 
                offset += alignment;
                entry->buf_count++;
                byte_count += PAGE_SIZE << page_order;
        }
 
-       DRM_DEBUG( "byte_count: %d\n", byte_count );
+       DRM_DEBUG("byte_count: %d\n", byte_count);
 
-       temp_buflist = drm_realloc( dma->buflist,
-                                    dma->buf_count * sizeof(*dma->buflist),
-                                    (dma->buf_count + entry->buf_count)
-                                    * sizeof(*dma->buflist),
-                                    DRM_MEM_BUFS );
-       if(!temp_buflist) {
+       temp_buflist = drm_realloc(dma->buflist,
+                                  dma->buf_count * sizeof(*dma->buflist),
+                                  (dma->buf_count + entry->buf_count)
+                                  * sizeof(*dma->buflist), DRM_MEM_BUFS);
+       if (!temp_buflist) {
                /* Free the entry because it isn't valid */
-               drm_cleanup_buf_error(dev,entry);
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+               drm_cleanup_buf_error(dev, entry);
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
        dma->buflist = temp_buflist;
 
-       for ( i = 0 ; i < entry->buf_count ; i++ ) {
+       for (i = 0; i < entry->buf_count; i++) {
                dma->buflist[i + dma->buf_count] = &entry->buflist[i];
        }
 
        dma->buf_count += entry->buf_count;
+       dma->seg_count += entry->seg_count;
+       dma->page_count += byte_count >> PAGE_SHIFT;
        dma->byte_count += byte_count;
 
-       DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
-       DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
+       DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
+       DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
 
-       up( &dev->struct_sem );
+       mutex_unlock(&dev->struct_mutex);
 
-       request.count = entry->buf_count;
-       request.size = size;
-
-       if ( copy_to_user( argp, &request, sizeof(request) ) )
-               return -EFAULT;
+       request->count = entry->buf_count;
+       request->size = size;
 
        dma->flags = _DRM_DMA_USE_AGP;
 
-       atomic_dec( &dev->buf_alloc );
+       atomic_dec(&dev->buf_alloc);
        return 0;
 }
-#endif /* __OS_HAS_AGP */
+EXPORT_SYMBOL(drm_addbufs_agp);
+#endif                         /* __OS_HAS_AGP */
 
-int drm_addbufs_pci( struct inode *inode, struct file *filp,
-                     unsigned int cmd, unsigned long arg )
+int drm_addbufs_pci(drm_device_t * dev, drm_buf_desc_t * request)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
        drm_device_dma_t *dma = dev->dma;
-       drm_buf_desc_t request;
        int count;
        int order;
        int size;
        int total;
        int page_order;
        drm_buf_entry_t *entry;
-       unsigned long page;
+       drm_dma_handle_t *dmah;
        drm_buf_t *buf;
        int alignment;
        unsigned long offset;
@@ -532,183 +684,182 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp,
        int page_count;
        unsigned long *temp_pagelist;
        drm_buf_t **temp_buflist;
-       drm_buf_desc_t __user *argp = (void __user *)arg;
 
-       if (!drm_core_check_feature(dev, DRIVER_PCI_DMA)) return -EINVAL;
-       if ( !dma ) return -EINVAL;
+       if (!drm_core_check_feature(dev, DRIVER_PCI_DMA))
+               return -EINVAL;
 
-       if ( copy_from_user( &request, argp, sizeof(request) ) )
-               return -EFAULT;
+       if (!dma)
+               return -EINVAL;
+
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
 
-       count = request.count;
-       order = drm_order( request.size );
+       count = request->count;
+       order = drm_order(request->size);
        size = 1 << order;
 
-       DRM_DEBUG( "count=%d, size=%d (%d), order=%d, queue_count=%d\n",
-                  request.count, request.size, size,
-                  order, dev->queue_count );
+       DRM_DEBUG("count=%d, size=%d (%d), order=%d, queue_count=%d\n",
+                 request->count, request->size, size, order, dev->queue_count);
 
-       if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL;
-       if ( dev->queue_count ) return -EBUSY; /* Not while in use */
+       if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
+               return -EINVAL;
+       if (dev->queue_count)
+               return -EBUSY;  /* Not while in use */
 
-       alignment = (request.flags & _DRM_PAGE_ALIGN)
-               ? PAGE_ALIGN(size) : size;
+       alignment = (request->flags & _DRM_PAGE_ALIGN)
+           ? PAGE_ALIGN(size) : size;
        page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
        total = PAGE_SIZE << page_order;
 
-       spin_lock( &dev->count_lock );
-       if ( dev->buf_use ) {
-               spin_unlock( &dev->count_lock );
+       spin_lock(&dev->count_lock);
+       if (dev->buf_use) {
+               spin_unlock(&dev->count_lock);
                return -EBUSY;
        }
-       atomic_inc( &dev->buf_alloc );
-       spin_unlock( &dev->count_lock );
+       atomic_inc(&dev->buf_alloc);
+       spin_unlock(&dev->count_lock);
 
-       down( &dev->struct_sem );
+       mutex_lock(&dev->struct_mutex);
        entry = &dma->bufs[order];
-       if ( entry->buf_count ) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+       if (entry->buf_count) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM; /* May only call once for each order */
        }
 
        if (count < 0 || count > 4096) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -EINVAL;
        }
 
-       entry->buflist = drm_alloc( count * sizeof(*entry->buflist),
-                                   DRM_MEM_BUFS );
-       if ( !entry->buflist ) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+       entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+                                  DRM_MEM_BUFS);
+       if (!entry->buflist) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
-       memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
-
-       entry->seglist = drm_alloc( count * sizeof(*entry->seglist),
-                                   DRM_MEM_SEGS );
-       if ( !entry->seglist ) {
-               drm_free( entry->buflist,
-                         count * sizeof(*entry->buflist),
-                         DRM_MEM_BUFS );
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+       memset(entry->buflist, 0, count * sizeof(*entry->buflist));
+
+       entry->seglist = drm_alloc(count * sizeof(*entry->seglist),
+                                  DRM_MEM_SEGS);
+       if (!entry->seglist) {
+               drm_free(entry->buflist,
+                        count * sizeof(*entry->buflist), DRM_MEM_BUFS);
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
-       memset( entry->seglist, 0, count * sizeof(*entry->seglist) );
+       memset(entry->seglist, 0, count * sizeof(*entry->seglist));
 
        /* Keep the original pagelist until we know all the allocations
         * have succeeded
         */
-       temp_pagelist = drm_alloc( (dma->page_count + (count << page_order))
-                                   * sizeof(*dma->pagelist),
-                                   DRM_MEM_PAGES );
+       temp_pagelist = drm_alloc((dma->page_count + (count << page_order))
+                                 * sizeof(*dma->pagelist), DRM_MEM_PAGES);
        if (!temp_pagelist) {
-               drm_free( entry->buflist,
-                          count * sizeof(*entry->buflist),
-                          DRM_MEM_BUFS );
-               drm_free( entry->seglist,
-                          count * sizeof(*entry->seglist),
-                          DRM_MEM_SEGS );
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+               drm_free(entry->buflist,
+                        count * sizeof(*entry->buflist), DRM_MEM_BUFS);
+               drm_free(entry->seglist,
+                        count * sizeof(*entry->seglist), DRM_MEM_SEGS);
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
        memcpy(temp_pagelist,
-              dma->pagelist,
-              dma->page_count * sizeof(*dma->pagelist));
-       DRM_DEBUG( "pagelist: %d entries\n",
-                  dma->page_count + (count << page_order) );
+              dma->pagelist, dma->page_count * sizeof(*dma->pagelist));
+       DRM_DEBUG("pagelist: %d entries\n",
+                 dma->page_count + (count << page_order));
 
-       entry->buf_size = size;
+       entry->buf_size = size;
        entry->page_order = page_order;
        byte_count = 0;
        page_count = 0;
 
-       while ( entry->buf_count < count ) {
-               page = drm_alloc_pages( page_order, DRM_MEM_DMA );
-               if ( !page ) {
+       while (entry->buf_count < count) {
+               
+               dmah = drm_pci_alloc(dev, PAGE_SIZE << page_order, 0x1000, 0xfffffffful);
+               
+               if (!dmah) {
                        /* Set count correctly so we free the proper amount. */
                        entry->buf_count = count;
                        entry->seg_count = count;
                        drm_cleanup_buf_error(dev, entry);
-                       drm_free( temp_pagelist,
-                                  (dma->page_count + (count << page_order))
-                                  * sizeof(*dma->pagelist),
-                                  DRM_MEM_PAGES );
-                       up( &dev->struct_sem );
-                       atomic_dec( &dev->buf_alloc );
+                       drm_free(temp_pagelist,
+                                (dma->page_count + (count << page_order))
+                                * sizeof(*dma->pagelist), DRM_MEM_PAGES);
+                       mutex_unlock(&dev->struct_mutex);
+                       atomic_dec(&dev->buf_alloc);
                        return -ENOMEM;
                }
-               entry->seglist[entry->seg_count++] = page;
-               for ( i = 0 ; i < (1 << page_order) ; i++ ) {
-                       DRM_DEBUG( "page %d @ 0x%08lx\n",
-                                  dma->page_count + page_count,
-                                  page + PAGE_SIZE * i );
+               entry->seglist[entry->seg_count++] = dmah;
+               for (i = 0; i < (1 << page_order); i++) {
+                       DRM_DEBUG("page %d @ 0x%08lx\n",
+                                 dma->page_count + page_count,
+                                 (unsigned long)dmah->vaddr + PAGE_SIZE * i);
                        temp_pagelist[dma->page_count + page_count++]
-                               = page + PAGE_SIZE * i;
+                               = (unsigned long)dmah->vaddr + PAGE_SIZE * i;
                }
-               for ( offset = 0 ;
-                     offset + size <= total && entry->buf_count < count ;
-                     offset += alignment, ++entry->buf_count ) {
-                       buf          = &entry->buflist[entry->buf_count];
-                       buf->idx     = dma->buf_count + entry->buf_count;
-                       buf->total   = alignment;
-                       buf->order   = order;
-                       buf->used    = 0;
-                       buf->offset  = (dma->byte_count + byte_count + offset);
-                       buf->address = (void *)(page + offset);
-                       buf->next    = NULL;
+               for (offset = 0;
+                    offset + size <= total && entry->buf_count < count;
+                    offset += alignment, ++entry->buf_count) {
+                       buf = &entry->buflist[entry->buf_count];
+                       buf->idx = dma->buf_count + entry->buf_count;
+                       buf->total = alignment;
+                       buf->order = order;
+                       buf->used = 0;
+                       buf->offset = (dma->byte_count + byte_count + offset);
+                       buf->address = (void *)(dmah->vaddr + offset);
+                       buf->bus_address = dmah->busaddr + offset;
+                       buf->next = NULL;
                        buf->waiting = 0;
                        buf->pending = 0;
-                       init_waitqueue_head( &buf->dma_wait );
-                       buf->filp    = NULL;
+                       init_waitqueue_head(&buf->dma_wait);
+                       buf->filp = NULL;
 
                        buf->dev_priv_size = dev->driver->dev_priv_size;
-                       buf->dev_private = drm_alloc( buf->dev_priv_size,
-                                                      DRM_MEM_BUFS );
-                       if(!buf->dev_private) {
+                       buf->dev_private = drm_alloc(buf->dev_priv_size,
+                                                    DRM_MEM_BUFS);
+                       if (!buf->dev_private) {
                                /* Set count correctly so we free the proper amount. */
                                entry->buf_count = count;
                                entry->seg_count = count;
-                               drm_cleanup_buf_error(dev,entry);
-                               drm_free( temp_pagelist,
-                                          (dma->page_count + (count << page_order))
-                                          * sizeof(*dma->pagelist),
-                                          DRM_MEM_PAGES );
-                               up( &dev->struct_sem );
-                               atomic_dec( &dev->buf_alloc );
+                               drm_cleanup_buf_error(dev, entry);
+                               drm_free(temp_pagelist,
+                                        (dma->page_count +
+                                         (count << page_order))
+                                        * sizeof(*dma->pagelist),
+                                        DRM_MEM_PAGES);
+                               mutex_unlock(&dev->struct_mutex);
+                               atomic_dec(&dev->buf_alloc);
                                return -ENOMEM;
                        }
-                       memset( buf->dev_private, 0, buf->dev_priv_size );
+                       memset(buf->dev_private, 0, buf->dev_priv_size);
 
-                       DRM_DEBUG( "buffer %d @ %p\n",
-                                  entry->buf_count, buf->address );
+                       DRM_DEBUG("buffer %d @ %p\n",
+                                 entry->buf_count, buf->address);
                }
                byte_count += PAGE_SIZE << page_order;
        }
 
-       temp_buflist = drm_realloc( dma->buflist,
-                                    dma->buf_count * sizeof(*dma->buflist),
-                                    (dma->buf_count + entry->buf_count)
-                                    * sizeof(*dma->buflist),
-                                    DRM_MEM_BUFS );
+       temp_buflist = drm_realloc(dma->buflist,
+                                  dma->buf_count * sizeof(*dma->buflist),
+                                  (dma->buf_count + entry->buf_count)
+                                  * sizeof(*dma->buflist), DRM_MEM_BUFS);
        if (!temp_buflist) {
                /* Free the entry because it isn't valid */
-               drm_cleanup_buf_error(dev,entry);
-               drm_free( temp_pagelist,
-                          (dma->page_count + (count << page_order))
-                          * sizeof(*dma->pagelist),
-                          DRM_MEM_PAGES );
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+               drm_cleanup_buf_error(dev, entry);
+               drm_free(temp_pagelist,
+                        (dma->page_count + (count << page_order))
+                        * sizeof(*dma->pagelist), DRM_MEM_PAGES);
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
        dma->buflist = temp_buflist;
 
-       for ( i = 0 ; i < entry->buf_count ; i++ ) {
+       for (i = 0; i < entry->buf_count; i++) {
                dma->buflist[i + dma->buf_count] = &entry->buflist[i];
        }
 
@@ -717,8 +868,8 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp,
         */
        if (dma->page_count) {
                drm_free(dma->pagelist,
-                         dma->page_count * sizeof(*dma->pagelist),
-                         DRM_MEM_PAGES);
+                        dma->page_count * sizeof(*dma->pagelist),
+                        DRM_MEM_PAGES);
        }
        dma->pagelist = temp_pagelist;
 
@@ -727,27 +878,20 @@ int drm_addbufs_pci( struct inode *inode, struct file *filp,
        dma->page_count += entry->seg_count << page_order;
        dma->byte_count += PAGE_SIZE * (entry->seg_count << page_order);
 
-       up( &dev->struct_sem );
+       mutex_unlock(&dev->struct_mutex);
 
-       request.count = entry->buf_count;
-       request.size = size;
-
-       if ( copy_to_user( argp, &request, sizeof(request) ) )
-               return -EFAULT;
+       request->count = entry->buf_count;
+       request->size = size;
 
-       atomic_dec( &dev->buf_alloc );
+       atomic_dec(&dev->buf_alloc);
        return 0;
 
 }
+EXPORT_SYMBOL(drm_addbufs_pci);
 
-int drm_addbufs_sg( struct inode *inode, struct file *filp,
-                     unsigned int cmd, unsigned long arg )
+static int drm_addbufs_sg(drm_device_t * dev, drm_buf_desc_t * request)
 {
-       drm_file_t *priv = filp->private_data;
-       drm_device_t *dev = priv->head->dev;
        drm_device_dma_t *dma = dev->dma;
-       drm_buf_desc_t __user *argp = (void __user *)arg;
-       drm_buf_desc_t request;
        drm_buf_entry_t *entry;
        drm_buf_t *buf;
        unsigned long offset;
@@ -762,150 +906,312 @@ int drm_addbufs_sg( struct inode *inode, struct file *filp,
        int i;
        drm_buf_t **temp_buflist;
 
-       if (!drm_core_check_feature(dev, DRIVER_SG)) return -EINVAL;
-       
-       if ( !dma ) return -EINVAL;
+       if (!drm_core_check_feature(dev, DRIVER_SG))
+               return -EINVAL;
 
-       if ( copy_from_user( &request, argp, sizeof(request) ) )
-               return -EFAULT;
+       if (!dma)
+               return -EINVAL;
+
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
 
-       count = request.count;
-       order = drm_order( request.size );
+       count = request->count;
+       order = drm_order(request->size);
        size = 1 << order;
 
-       alignment  = (request.flags & _DRM_PAGE_ALIGN)
-                       ? PAGE_ALIGN(size) : size;
+       alignment = (request->flags & _DRM_PAGE_ALIGN)
+           ? PAGE_ALIGN(size) : size;
        page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
        total = PAGE_SIZE << page_order;
 
        byte_count = 0;
-       agp_offset = request.agp_start;
-
-       DRM_DEBUG( "count:      %d\n",  count );
-       DRM_DEBUG( "order:      %d\n",  order );
-       DRM_DEBUG( "size:       %d\n",  size );
-       DRM_DEBUG( "agp_offset: %lu\n", agp_offset );
-       DRM_DEBUG( "alignment:  %d\n",  alignment );
-       DRM_DEBUG( "page_order: %d\n",  page_order );
-       DRM_DEBUG( "total:      %d\n",  total );
-
-       if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL;
-       if ( dev->queue_count ) return -EBUSY; /* Not while in use */
-
-       spin_lock( &dev->count_lock );
-       if ( dev->buf_use ) {
-               spin_unlock( &dev->count_lock );
+       agp_offset = request->agp_start;
+
+       DRM_DEBUG("count:      %d\n", count);
+       DRM_DEBUG("order:      %d\n", order);
+       DRM_DEBUG("size:       %d\n", size);
+       DRM_DEBUG("agp_offset: %lu\n", agp_offset);
+       DRM_DEBUG("alignment:  %d\n", alignment);
+       DRM_DEBUG("page_order: %d\n", page_order);
+       DRM_DEBUG("total:      %d\n", total);
+
+       if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
+               return -EINVAL;
+       if (dev->queue_count)
+               return -EBUSY;  /* Not while in use */
+
+       spin_lock(&dev->count_lock);
+       if (dev->buf_use) {
+               spin_unlock(&dev->count_lock);
                return -EBUSY;
        }
-       atomic_inc( &dev->buf_alloc );
-       spin_unlock( &dev->count_lock );
+       atomic_inc(&dev->buf_alloc);
+       spin_unlock(&dev->count_lock);
 
-       down( &dev->struct_sem );
+       mutex_lock(&dev->struct_mutex);
        entry = &dma->bufs[order];
-       if ( entry->buf_count ) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
-               return -ENOMEM; /* May only call once for each order */
+       if (entry->buf_count) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
+               return -ENOMEM; /* May only call once for each order */
        }
 
        if (count < 0 || count > 4096) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -EINVAL;
        }
 
-       entry->buflist = drm_alloc( count * sizeof(*entry->buflist),
-                                    DRM_MEM_BUFS );
-       if ( !entry->buflist ) {
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+       entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+                                  DRM_MEM_BUFS);
+       if (!entry->buflist) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
-       memset( entry->buflist, 0, count * sizeof(*entry->buflist) );
+       memset(entry->buflist, 0, count * sizeof(*entry->buflist));
 
        entry->buf_size = size;
        entry->page_order = page_order;
 
        offset = 0;
 
-       while ( entry->buf_count < count ) {
-               buf          = &entry->buflist[entry->buf_count];
-               buf->idx     = dma->buf_count + entry->buf_count;
-               buf->total   = alignment;
-               buf->order   = order;
-               buf->used    = 0;
+       while (entry->buf_count < count) {
+               buf = &entry->buflist[entry->buf_count];
+               buf->idx = dma->buf_count + entry->buf_count;
+               buf->total = alignment;
+               buf->order = order;
+               buf->used = 0;
 
-               buf->offset  = (dma->byte_count + offset);
+               buf->offset = (dma->byte_count + offset);
                buf->bus_address = agp_offset + offset;
-               buf->address = (void *)(agp_offset + offset + dev->sg->handle);
-               buf->next    = NULL;
+               buf->address = (void *)(agp_offset + offset
+                                       + (unsigned long)dev->sg->virtual);
+               buf->next = NULL;
                buf->waiting = 0;
                buf->pending = 0;
-               init_waitqueue_head( &buf->dma_wait );
-               buf->filp    = NULL;
+               init_waitqueue_head(&buf->dma_wait);
+               buf->filp = NULL;
 
                buf->dev_priv_size = dev->driver->dev_priv_size;
-               buf->dev_private = drm_alloc( buf->dev_priv_size,
-                                              DRM_MEM_BUFS );
-               if(!buf->dev_private) {
+               buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
+               if (!buf->dev_private) {
                        /* Set count correctly so we free the proper amount. */
                        entry->buf_count = count;
-                       drm_cleanup_buf_error(dev,entry);
-                       up( &dev->struct_sem );
-                       atomic_dec( &dev->buf_alloc );
+                       drm_cleanup_buf_error(dev, entry);
+                       mutex_unlock(&dev->struct_mutex);
+                       atomic_dec(&dev->buf_alloc);
                        return -ENOMEM;
                }
 
-               memset( buf->dev_private, 0, buf->dev_priv_size );
+               memset(buf->dev_private, 0, buf->dev_priv_size);
 
-               DRM_DEBUG( "buffer %d @ %p\n",
-                          entry->buf_count, buf->address );
+               DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
 
                offset += alignment;
                entry->buf_count++;
                byte_count += PAGE_SIZE << page_order;
        }
 
-       DRM_DEBUG( "byte_count: %d\n", byte_count );
+       DRM_DEBUG("byte_count: %d\n", byte_count);
 
-       temp_buflist = drm_realloc( dma->buflist,
-                                    dma->buf_count * sizeof(*dma->buflist),
-                                    (dma->buf_count + entry->buf_count)
-                                    * sizeof(*dma->buflist),
-                                    DRM_MEM_BUFS );
-       if(!temp_buflist) {
+       temp_buflist = drm_realloc(dma->buflist,
+                                  dma->buf_count * sizeof(*dma->buflist),
+                                  (dma->buf_count + entry->buf_count)
+                                  * sizeof(*dma->buflist), DRM_MEM_BUFS);
+       if (!temp_buflist) {
                /* Free the entry because it isn't valid */
-               drm_cleanup_buf_error(dev,entry);
-               up( &dev->struct_sem );
-               atomic_dec( &dev->buf_alloc );
+               drm_cleanup_buf_error(dev, entry);
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
                return -ENOMEM;
        }
        dma->buflist = temp_buflist;
 
-       for ( i = 0 ; i < entry->buf_count ; i++ ) {
+       for (i = 0; i < entry->buf_count; i++) {
                dma->buflist[i + dma->buf_count] = &entry->buflist[i];
        }
 
        dma->buf_count += entry->buf_count;
+       dma->seg_count += entry->seg_count;
+       dma->page_count += byte_count >> PAGE_SHIFT;
        dma->byte_count += byte_count;
 
-       DRM_DEBUG( "dma->buf_count : %d\n", dma->buf_count );
-       DRM_DEBUG( "entry->buf_count : %d\n", entry->buf_count );
+       DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
+       DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
 
-       up( &dev->struct_sem );
+       mutex_unlock(&dev->struct_mutex);
 
-       request.count = entry->buf_count;
-       request.size = size;
-
-       if ( copy_to_user( argp, &request, sizeof(request) ) )
-               return -EFAULT;
+       request->count = entry->buf_count;
+       request->size = size;
 
        dma->flags = _DRM_DMA_USE_SG;
 
-       atomic_dec( &dev->buf_alloc );
+       atomic_dec(&dev->buf_alloc);
        return 0;
 }
 
+static int drm_addbufs_fb(drm_device_t * dev, drm_buf_desc_t * request)
+{
+       drm_device_dma_t *dma = dev->dma;
+       drm_buf_entry_t *entry;
+       drm_buf_t *buf;
+       unsigned long offset;
+       unsigned long agp_offset;
+       int count;
+       int order;
+       int size;
+       int alignment;
+       int page_order;
+       int total;
+       int byte_count;
+       int i;
+       drm_buf_t **temp_buflist;
+
+       if (!drm_core_check_feature(dev, DRIVER_FB_DMA))
+               return -EINVAL;
+
+       if (!dma)
+               return -EINVAL;
+
+       if (!capable(CAP_SYS_ADMIN))
+               return -EPERM;
+
+       count = request->count;
+       order = drm_order(request->size);
+       size = 1 << order;
+
+       alignment = (request->flags & _DRM_PAGE_ALIGN)
+           ? PAGE_ALIGN(size) : size;
+       page_order = order - PAGE_SHIFT > 0 ? order - PAGE_SHIFT : 0;
+       total = PAGE_SIZE << page_order;
+
+       byte_count = 0;
+       agp_offset = request->agp_start;
+
+       DRM_DEBUG("count:      %d\n", count);
+       DRM_DEBUG("order:      %d\n", order);
+       DRM_DEBUG("size:       %d\n", size);
+       DRM_DEBUG("agp_offset: %lu\n", agp_offset);
+       DRM_DEBUG("alignment:  %d\n", alignment);
+       DRM_DEBUG("page_order: %d\n", page_order);
+       DRM_DEBUG("total:      %d\n", total);
+
+       if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
+               return -EINVAL;
+       if (dev->queue_count)
+               return -EBUSY;  /* Not while in use */
+
+       spin_lock(&dev->count_lock);
+       if (dev->buf_use) {
+               spin_unlock(&dev->count_lock);
+               return -EBUSY;
+       }
+       atomic_inc(&dev->buf_alloc);
+       spin_unlock(&dev->count_lock);
+
+       mutex_lock(&dev->struct_mutex);
+       entry = &dma->bufs[order];
+       if (entry->buf_count) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
+               return -ENOMEM; /* May only call once for each order */
+       }
+
+       if (count < 0 || count > 4096) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
+               return -EINVAL;
+       }
+
+       entry->buflist = drm_alloc(count * sizeof(*entry->buflist),
+                                  DRM_MEM_BUFS);
+       if (!entry->buflist) {
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
+               return -ENOMEM;
+       }
+       memset(entry->buflist, 0, count * sizeof(*entry->buflist));
+
+       entry->buf_size = size;
+       entry->page_order = page_order;
+
+       offset = 0;
+
+       while (entry->buf_count < count) {
+               buf = &entry->buflist[entry->buf_count];
+               buf->idx = dma->buf_count + entry->buf_count;
+               buf->total = alignment;
+               buf->order = order;
+               buf->used = 0;
+
+               buf->offset = (dma->byte_count + offset);
+               buf->bus_address = agp_offset + offset;
+               buf->address = (void *)(agp_offset + offset);
+               buf->next = NULL;
+               buf->waiting = 0;
+               buf->pending = 0;
+               init_waitqueue_head(&buf->dma_wait);
+               buf->filp = NULL;
+
+               buf->dev_priv_size = dev->driver->dev_priv_size;
+               buf->dev_private = drm_alloc(buf->dev_priv_size, DRM_MEM_BUFS);
+               if (!buf->dev_private) {
+                       /* Set count correctly so we free the proper amount. */
+                       entry->buf_count = count;
+                       drm_cleanup_buf_error(dev, entry);
+                       mutex_unlock(&dev->struct_mutex);
+                       atomic_dec(&dev->buf_alloc);
+                       return -ENOMEM;
+               }
+               memset(buf->dev_private, 0, buf->dev_priv_size);
+
+               DRM_DEBUG("buffer %d @ %p\n", entry->buf_count, buf->address);
+
+               offset += alignment;
+               entry->buf_count++;
+               byte_count += PAGE_SIZE << page_order;
+       }
+
+       DRM_DEBUG("byte_count: %d\n", byte_count);
+
+       temp_buflist = drm_realloc(dma->buflist,
+                                  dma->buf_count * sizeof(*dma->buflist),
+                                  (dma->buf_count + entry->buf_count)
+                                  * sizeof(*dma->buflist), DRM_MEM_BUFS);
+       if (!temp_buflist) {
+               /* Free the entry because it isn't valid */
+               drm_cleanup_buf_error(dev, entry);
+               mutex_unlock(&dev->struct_mutex);
+               atomic_dec(&dev->buf_alloc);
+               return -ENOMEM;
+       }
+       dma->buflist = temp_buflist;
+
+       for (i = 0; i < entry->buf_count; i++) {
+               dma->buflist[i + dma->buf_count] = &entry->buflist[i];
+       }
+
+       dma->buf_count += entry->buf_count;
+       dma->seg_count += entry->seg_count;
+       dma->page_count += byte_count >> PAGE_SHIFT;
+       dma->byte_count += byte_count;
+
+       DRM_DEBUG("dma->buf_count : %d\n", dma->buf_count);
+       DRM_DEBUG("entry->buf_count : %d\n", entry->buf_count);
+
+       mutex_unlock(&dev->struct_mutex);
+
+       request->count = entry->buf_count;
+       request->size = size;
+
+       dma->flags = _DRM_DMA_USE_FB;
+
+       atomic_dec(&dev->buf_alloc);
+       return 0;
+}
+
+
 /**
  * Add buffers for DMA transfers (ioctl).
  *
@@ -920,31 +1226,40 @@ int drm_addbufs_sg( struct inode *inode, struct file *filp,
  * addbufs_sg() or addbufs_pci() for AGP, scatter-gather or consistent
  * PCI memory respectively.
  */
-int drm_addbufs( struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long arg )
+int drm_addbufs(struct inode *inode, struct file *filp,
+               unsigned int cmd, unsigned long arg)
 {
        drm_buf_desc_t request;
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
-       
+       int ret;
+
        if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
                return -EINVAL;
 
-       if ( copy_from_user( &request, (drm_buf_desc_t __user *)arg,
-                            sizeof(request) ) )
+       if (copy_from_user(&request, (drm_buf_desc_t __user *) arg,
+                          sizeof(request)))
                return -EFAULT;
 
 #if __OS_HAS_AGP
-       if ( request.flags & _DRM_AGP_BUFFER )
-               return drm_addbufs_agp( inode, filp, cmd, arg );
+       if (request.flags & _DRM_AGP_BUFFER)
+               ret = drm_addbufs_agp(dev, &request);
        else
 #endif
-       if ( request.flags & _DRM_SG_BUFFER )
-               return drm_addbufs_sg( inode, filp, cmd, arg );
+       if (request.flags & _DRM_SG_BUFFER)
+               ret = drm_addbufs_sg(dev, &request);
+       else if (request.flags & _DRM_FB_BUFFER)
+               ret = drm_addbufs_fb(dev, &request);
        else
-               return drm_addbufs_pci( inode, filp, cmd, arg );
-}
+               ret = drm_addbufs_pci(dev, &request);
 
+       if (ret == 0) {
+               if (copy_to_user((void __user *)arg, &request, sizeof(request))) {
+                       ret = -EFAULT;
+               }
+       }
+       return ret;
+}
 
 /**
  * Get information about the buffer mappings.
@@ -963,8 +1278,8 @@ int drm_addbufs( struct inode *inode, struct file *filp,
  * lock, preventing of allocating more buffers after this call. Information
  * about each requested buffer is then copied into user space.
  */
-int drm_infobufs( struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg )
+int drm_infobufs(struct inode *inode, struct file *filp,
+                unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
@@ -977,58 +1292,61 @@ int drm_infobufs( struct inode *inode, struct file *filp,
        if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
                return -EINVAL;
 
-       if ( !dma ) return -EINVAL;
+       if (!dma)
+               return -EINVAL;
 
-       spin_lock( &dev->count_lock );
-       if ( atomic_read( &dev->buf_alloc ) ) {
-               spin_unlock( &dev->count_lock );
+       spin_lock(&dev->count_lock);
+       if (atomic_read(&dev->buf_alloc)) {
+               spin_unlock(&dev->count_lock);
                return -EBUSY;
        }
        ++dev->buf_use;         /* Can't allocate more after this call */
-       spin_unlock( &dev->count_lock );
+       spin_unlock(&dev->count_lock);
 
-       if ( copy_from_user( &request, argp, sizeof(request) ) )
+       if (copy_from_user(&request, argp, sizeof(request)))
                return -EFAULT;
 
-       for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) {
-               if ( dma->bufs[i].buf_count ) ++count;
+       for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
+               if (dma->bufs[i].buf_count)
+                       ++count;
        }
 
-       DRM_DEBUG( "count = %d\n", count );
+       DRM_DEBUG("count = %d\n", count);
 
-       if ( request.count >= count ) {
-               for ( i = 0, count = 0 ; i < DRM_MAX_ORDER + 1 ; i++ ) {
-                       if ( dma->bufs[i].buf_count ) {
-                               drm_buf_desc_t __user *to = &request.list[count];
+       if (request.count >= count) {
+               for (i = 0, count = 0; i < DRM_MAX_ORDER + 1; i++) {
+                       if (dma->bufs[i].buf_count) {
+                               drm_buf_desc_t __user *to =
+                                   &request.list[count];
                                drm_buf_entry_t *from = &dma->bufs[i];
                                drm_freelist_t *list = &dma->bufs[i].freelist;
-                               if ( copy_to_user( &to->count,
-                                                  &from->buf_count,
-                                                  sizeof(from->buf_count) ) ||
-                                    copy_to_user( &to->size,
-                                                  &from->buf_size,
-                                                  sizeof(from->buf_size) ) ||
-                                    copy_to_user( &to->low_mark,
-                                                  &list->low_mark,
-                                                  sizeof(list->low_mark) ) ||
-                                    copy_to_user( &to->high_mark,
-                                                  &list->high_mark,
-                                                  sizeof(list->high_mark) ) )
+                               if (copy_to_user(&to->count,
+                                                &from->buf_count,
+                                                sizeof(from->buf_count)) ||
+                                   copy_to_user(&to->size,
+                                                &from->buf_size,
+                                                sizeof(from->buf_size)) ||
+                                   copy_to_user(&to->low_mark,
+                                                &list->low_mark,
+                                                sizeof(list->low_mark)) ||
+                                   copy_to_user(&to->high_mark,
+                                                &list->high_mark,
+                                                sizeof(list->high_mark)))
                                        return -EFAULT;
 
-                               DRM_DEBUG( "%d %d %d %d %d\n",
-                                          i,
-                                          dma->bufs[i].buf_count,
-                                          dma->bufs[i].buf_size,
-                                          dma->bufs[i].freelist.low_mark,
-                                          dma->bufs[i].freelist.high_mark );
+                               DRM_DEBUG("%d %d %d %d %d\n",
+                                         i,
+                                         dma->bufs[i].buf_count,
+                                         dma->bufs[i].buf_size,
+                                         dma->bufs[i].freelist.low_mark,
+                                         dma->bufs[i].freelist.high_mark);
                                ++count;
                        }
                }
        }
        request.count = count;
 
-       if ( copy_to_user( argp, &request, sizeof(request) ) )
+       if (copy_to_user(argp, &request, sizeof(request)))
                return -EFAULT;
 
        return 0;
@@ -1048,8 +1366,8 @@ int drm_infobufs( struct inode *inode, struct file *filp,
  *
  * \note This ioctl is deprecated and mostly never used.
  */
-int drm_markbufs( struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg )
+int drm_markbufs(struct inode *inode, struct file *filp,
+                unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
@@ -1061,44 +1379,45 @@ int drm_markbufs( struct inode *inode, struct file *filp,
        if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
                return -EINVAL;
 
-       if ( !dma ) return -EINVAL;
+       if (!dma)
+               return -EINVAL;
 
-       if ( copy_from_user( &request,
-                            (drm_buf_desc_t __user *)arg,
-                            sizeof(request) ) )
+       if (copy_from_user(&request,
+                          (drm_buf_desc_t __user *) arg, sizeof(request)))
                return -EFAULT;
 
-       DRM_DEBUG( "%d, %d, %d\n",
-                  request.size, request.low_mark, request.high_mark );
-       order = drm_order( request.size );
-       if ( order < DRM_MIN_ORDER || order > DRM_MAX_ORDER ) return -EINVAL;
+       DRM_DEBUG("%d, %d, %d\n",
+                 request.size, request.low_mark, request.high_mark);
+       order = drm_order(request.size);
+       if (order < DRM_MIN_ORDER || order > DRM_MAX_ORDER)
+               return -EINVAL;
        entry = &dma->bufs[order];
 
-       if ( request.low_mark < 0 || request.low_mark > entry->buf_count )
+       if (request.low_mark < 0 || request.low_mark > entry->buf_count)
                return -EINVAL;
-       if ( request.high_mark < 0 || request.high_mark > entry->buf_count )
+       if (request.high_mark < 0 || request.high_mark > entry->buf_count)
                return -EINVAL;
 
-       entry->freelist.low_mark  = request.low_mark;
+       entry->freelist.low_mark = request.low_mark;
        entry->freelist.high_mark = request.high_mark;
 
        return 0;
 }
 
 /**
- * Unreserve the buffers in list, previously reserved using drmDMA. 
+ * Unreserve the buffers in list, previously reserved using drmDMA.
  *
  * \param inode device inode.
  * \param filp file pointer.
  * \param cmd command.
  * \param arg pointer to a drm_buf_free structure.
  * \return zero on success or a negative number on failure.
- * 
+ *
  * Calls free_buffer() for each used buffer.
  * This function is primarily used for debugging.
  */
-int drm_freebufs( struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg )
+int drm_freebufs(struct inode *inode, struct file *filp,
+                unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
@@ -1111,31 +1430,29 @@ int drm_freebufs( struct inode *inode, struct file *filp,
        if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
                return -EINVAL;
 
-       if ( !dma ) return -EINVAL;
+       if (!dma)
+               return -EINVAL;
 
-       if ( copy_from_user( &request,
-                            (drm_buf_free_t __user *)arg,
-                            sizeof(request) ) )
+       if (copy_from_user(&request,
+                          (drm_buf_free_t __user *) arg, sizeof(request)))
                return -EFAULT;
 
-       DRM_DEBUG( "%d\n", request.count );
-       for ( i = 0 ; i < request.count ; i++ ) {
-               if ( copy_from_user( &idx,
-                                    &request.list[i],
-                                    sizeof(idx) ) )
+       DRM_DEBUG("%d\n", request.count);
+       for (i = 0; i < request.count; i++) {
+               if (copy_from_user(&idx, &request.list[i], sizeof(idx)))
                        return -EFAULT;
-               if ( idx < 0 || idx >= dma->buf_count ) {
-                       DRM_ERROR( "Index %d (of %d max)\n",
-                                  idx, dma->buf_count - 1 );
+               if (idx < 0 || idx >= dma->buf_count) {
+                       DRM_ERROR("Index %d (of %d max)\n",
+                                 idx, dma->buf_count - 1);
                        return -EINVAL;
                }
                buf = dma->buflist[idx];
-               if ( buf->filp != filp ) {
-                       DRM_ERROR( "Process %d freeing buffer not owned\n",
-                                  current->pid );
+               if (buf->filp != filp) {
+                       DRM_ERROR("Process %d freeing buffer not owned\n",
+                                 current->pid);
                        return -EINVAL;
                }
-               drm_free_buffer( dev, buf );
+               drm_free_buffer(dev, buf);
        }
 
        return 0;
@@ -1154,8 +1471,8 @@ int drm_freebufs( struct inode *inode, struct file *filp,
  * about each buffer into user space. The PCI buffers are already mapped on the
  * addbufs_pci() call.
  */
-int drm_mapbufs( struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long arg )
+int drm_mapbufs(struct inode *inode, struct file *filp,
+               unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
@@ -1171,100 +1488,110 @@ int drm_mapbufs( struct inode *inode, struct file *filp,
        if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
                return -EINVAL;
 
-       if ( !dma ) return -EINVAL;
+       if (!dma)
+               return -EINVAL;
 
-       spin_lock( &dev->count_lock );
-       if ( atomic_read( &dev->buf_alloc ) ) {
-               spin_unlock( &dev->count_lock );
+       spin_lock(&dev->count_lock);
+       if (atomic_read(&dev->buf_alloc)) {
+               spin_unlock(&dev->count_lock);
                return -EBUSY;
        }
        dev->buf_use++;         /* Can't allocate more after this call */
-       spin_unlock( &dev->count_lock );
+       spin_unlock(&dev->count_lock);
 
-       if ( copy_from_user( &request, argp, sizeof(request) ) )
+       if (copy_from_user(&request, argp, sizeof(request)))
                return -EFAULT;
 
-       if ( request.count >= dma->buf_count ) {
-               if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP)) ||
-                   (drm_core_check_feature(dev, DRIVER_SG) && (dma->flags & _DRM_DMA_USE_SG)) ) {
+       if (request.count >= dma->buf_count) {
+               if ((drm_core_has_AGP(dev) && (dma->flags & _DRM_DMA_USE_AGP))
+                   || (drm_core_check_feature(dev, DRIVER_SG)
+                       && (dma->flags & _DRM_DMA_USE_SG))
+                   || (drm_core_check_feature(dev, DRIVER_FB_DMA)
+                       && (dma->flags & _DRM_DMA_USE_FB))) {
                        drm_map_t *map = dev->agp_buffer_map;
+                       unsigned long token = dev->agp_buffer_token;
 
-                       if ( !map ) {
+                       if (!map) {
                                retcode = -EINVAL;
                                goto done;
                        }
 
-#if LINUX_VERSION_CODE <= 0x020402
-                       down( &current->mm->mmap_sem );
-#else
-                       down_write( &current->mm->mmap_sem );
-#endif
-                       virtual = do_mmap( filp, 0, map->size,
-                                          PROT_READ | PROT_WRITE,
-                                          MAP_SHARED,
-                                          (unsigned long)map->offset );
-#if LINUX_VERSION_CODE <= 0x020402
-                       up( &current->mm->mmap_sem );
-#else
-                       up_write( &current->mm->mmap_sem );
-#endif
+                       down_write(&current->mm->mmap_sem);
+                       virtual = do_mmap(filp, 0, map->size,
+                                         PROT_READ | PROT_WRITE,
+                                         MAP_SHARED, token);
+                       up_write(&current->mm->mmap_sem);
                } else {
-#if LINUX_VERSION_CODE <= 0x020402
-                       down( &current->mm->mmap_sem );
-#else
-                       down_write( &current->mm->mmap_sem );
-#endif
-                       virtual = do_mmap( filp, 0, dma->byte_count,
-                                          PROT_READ | PROT_WRITE,
-                                          MAP_SHARED, 0 );
-#if LINUX_VERSION_CODE <= 0x020402
-                       up( &current->mm->mmap_sem );
-#else
-                       up_write( &current->mm->mmap_sem );
-#endif
+                       down_write(&current->mm->mmap_sem);
+                       virtual = do_mmap(filp, 0, dma->byte_count,
+                                         PROT_READ | PROT_WRITE,
+                                         MAP_SHARED, 0);
+                       up_write(&current->mm->mmap_sem);
                }
-               if ( virtual > -1024UL ) {
+               if (virtual > -1024UL) {
                        /* Real error */
                        retcode = (signed long)virtual;
                        goto done;
                }
                request.virtual = (void __user *)virtual;
 
-               for ( i = 0 ; i < dma->buf_count ; i++ ) {
-                       if ( copy_to_user( &request.list[i].idx,
-                                          &dma->buflist[i]->idx,
-                                          sizeof(request.list[0].idx) ) ) {
+               for (i = 0; i < dma->buf_count; i++) {
+                       if (copy_to_user(&request.list[i].idx,
+                                        &dma->buflist[i]->idx,
+                                        sizeof(request.list[0].idx))) {
                                retcode = -EFAULT;
                                goto done;
                        }
-                       if ( copy_to_user( &request.list[i].total,
-                                          &dma->buflist[i]->total,
-                                          sizeof(request.list[0].total) ) ) {
+                       if (copy_to_user(&request.list[i].total,
+                                        &dma->buflist[i]->total,
+                                        sizeof(request.list[0].total))) {
                                retcode = -EFAULT;
                                goto done;
                        }
-                       if ( copy_to_user( &request.list[i].used,
-                                          &zero,
-                                          sizeof(zero) ) ) {
+                       if (copy_to_user(&request.list[i].used,
+                                        &zero, sizeof(zero))) {
                                retcode = -EFAULT;
                                goto done;
                        }
-                       address = virtual + dma->buflist[i]->offset; /* *** */
-                       if ( copy_to_user( &request.list[i].address,
-                                          &address,
-                                          sizeof(address) ) ) {
+                       address = virtual + dma->buflist[i]->offset;    /* *** */
+                       if (copy_to_user(&request.list[i].address,
+                                        &address, sizeof(address))) {
                                retcode = -EFAULT;
                                goto done;
                        }
                }
        }
- done:
     done:
        request.count = dma->buf_count;
-       DRM_DEBUG( "%d buffers, retcode = %d\n", request.count, retcode );
+       DRM_DEBUG("%d buffers, retcode = %d\n", request.count, retcode);
 
-       if ( copy_to_user( argp, &request, sizeof(request) ) )
+       if (copy_to_user(argp, &request, sizeof(request)))
                return -EFAULT;
 
        return retcode;
 }
 
+/**
+ * Compute size order.  Returns the exponent of the smaller power of two which
+ * is greater or equal to given number.
+ *
+ * \param size size.
+ * \return order.
+ *
+ * \todo Can be made faster.
+ */
+int drm_order(unsigned long size)
+{
+       int order;
+       unsigned long tmp;
+
+       for (order = 0, tmp = size >> 1; tmp; tmp >>= 1, order++) ;
+
+       if (size & (size - 1))
+               ++order;
+
+       return order;
+}
+EXPORT_SYMBOL(drm_order);
+
+
index 4a28c05..892db70 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file drm_dma.
+ * \file drm_dma.c
  * DMA IOCTL and function support
  *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
 
 /**
  * Initialize the DMA data.
- * 
+ *
  * \param dev DRM device.
  * \return zero on success or a negative value on failure.
  *
  * Allocate and initialize a drm_device_dma structure.
  */
-int drm_dma_setup( drm_device_t *dev )
+int drm_dma_setup(drm_device_t * dev)
 {
        int i;
 
-       dev->dma = drm_alloc( sizeof(*dev->dma), DRM_MEM_DRIVER );
-       if ( !dev->dma )
+       dev->dma = drm_alloc(sizeof(*dev->dma), DRM_MEM_DRIVER);
+       if (!dev->dma)
                return -ENOMEM;
 
-       memset( dev->dma, 0, sizeof(*dev->dma) );
+       memset(dev->dma, 0, sizeof(*dev->dma));
 
-       for ( i = 0 ; i <= DRM_MAX_ORDER ; i++ )
+       for (i = 0; i <= DRM_MAX_ORDER; i++)
                memset(&dev->dma->bufs[i], 0, sizeof(dev->dma->bufs[0]));
 
        return 0;
@@ -67,14 +67,15 @@ int drm_dma_setup( drm_device_t *dev )
  * Free all pages associated with DMA buffers, the buffers and pages lists, and
  * finally the the drm_device::dma structure itself.
  */
-void drm_dma_takedown(drm_device_t *dev)
+void drm_dma_takedown(drm_device_t * dev)
 {
-       drm_device_dma_t  *dma = dev->dma;
-       int               i, j;
+       drm_device_dma_t *dma = dev->dma;
+       int i, j;
 
-       if (!dma) return;
+       if (!dma)
+               return;
 
-                               /* Clear dma buffers */
+       /* Clear dma buffers */
        for (i = 0; i <= DRM_MAX_ORDER; i++) {
                if (dma->bufs[i].seg_count) {
                        DRM_DEBUG("order %d: buf_count = %d,"
@@ -84,65 +85,62 @@ void drm_dma_takedown(drm_device_t *dev)
                                  dma->bufs[i].seg_count);
                        for (j = 0; j < dma->bufs[i].seg_count; j++) {
                                if (dma->bufs[i].seglist[j]) {
-                                       drm_free_pages(dma->bufs[i].seglist[j],
-                                                       dma->bufs[i].page_order,
-                                                       DRM_MEM_DMA);
+                                       drm_pci_free(dev, dma->bufs[i].seglist[j]);
                                }
                        }
                        drm_free(dma->bufs[i].seglist,
-                                 dma->bufs[i].seg_count
-                                 * sizeof(*dma->bufs[0].seglist),
-                                 DRM_MEM_SEGS);
+                                dma->bufs[i].seg_count
+                                * sizeof(*dma->bufs[0].seglist), DRM_MEM_SEGS);
                }
-               if (dma->bufs[i].buf_count) {
-                       for (j = 0; j < dma->bufs[i].buf_count; j++) {
+               if (dma->bufs[i].buf_count) {
+                       for (j = 0; j < dma->bufs[i].buf_count; j++) {
                                if (dma->bufs[i].buflist[j].dev_private) {
-                                       drm_free(dma->bufs[i].buflist[j].dev_private,
-                                                 dma->bufs[i].buflist[j].dev_priv_size,
-                                                 DRM_MEM_BUFS);
+                                       drm_free(dma->bufs[i].buflist[j].
+                                                dev_private,
+                                                dma->bufs[i].buflist[j].
+                                                dev_priv_size, DRM_MEM_BUFS);
                                }
                        }
-                       drm_free(dma->bufs[i].buflist,
-                                 dma->bufs[i].buf_count *
-                                 sizeof(*dma->bufs[0].buflist),
-                                 DRM_MEM_BUFS);
+                       drm_free(dma->bufs[i].buflist,
+                                dma->bufs[i].buf_count *
+                                sizeof(*dma->bufs[0].buflist), DRM_MEM_BUFS);
                }
        }
 
        if (dma->buflist) {
                drm_free(dma->buflist,
-                         dma->buf_count * sizeof(*dma->buflist),
-                         DRM_MEM_BUFS);
+                        dma->buf_count * sizeof(*dma->buflist), DRM_MEM_BUFS);
        }
 
        if (dma->pagelist) {
                drm_free(dma->pagelist,
-                         dma->page_count * sizeof(*dma->pagelist),
-                         DRM_MEM_PAGES);
+                        dma->page_count * sizeof(*dma->pagelist),
+                        DRM_MEM_PAGES);
        }
        drm_free(dev->dma, sizeof(*dev->dma), DRM_MEM_DRIVER);
        dev->dma = NULL;
 }
 
-
 /**
  * Free a buffer.
  *
  * \param dev DRM device.
  * \param buf buffer to free.
- * 
+ *
  * Resets the fields of \p buf.
  */
-void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)
+void drm_free_buffer(drm_device_t * dev, drm_buf_t * buf)
 {
-       if (!buf) return;
+       if (!buf)
+               return;
 
-       buf->waiting  = 0;
-       buf->pending  = 0;
-       buf->filp     = NULL;
-       buf->used     = 0;
+       buf->waiting = 0;
+       buf->pending = 0;
+       buf->filp = NULL;
+       buf->used = 0;
 
-       if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && waitqueue_active(&buf->dma_wait)) {
+       if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE)
+           && waitqueue_active(&buf->dma_wait)) {
                wake_up_interruptible(&buf->dma_wait);
        }
 }
@@ -154,12 +152,13 @@ void drm_free_buffer(drm_device_t *dev, drm_buf_t *buf)
  *
  * Frees each buffer associated with \p filp not already on the hardware.
  */
-void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp)
+void drm_core_reclaim_buffers(drm_device_t * dev, struct file *filp)
 {
        drm_device_dma_t *dma = dev->dma;
-       int              i;
+       int i;
 
-       if (!dma) return;
+       if (!dma)
+               return;
        for (i = 0; i < dma->buf_count; i++) {
                if (dma->buflist[i]->filp == filp) {
                        switch (dma->buflist[i]->list) {
@@ -176,5 +175,5 @@ void drm_core_reclaim_buffers(drm_device_t *dev, struct file *filp)
                }
        }
 }
-EXPORT_SYMBOL(drm_core_reclaim_buffers);
 
+EXPORT_SYMBOL(drm_core_reclaim_buffers);
index e8e8e42..7857453 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file drm_drawable.
+ * \file drm_drawable.c
  * IOCTLs for drawables
  *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
 
 /** No-op. */
 int drm_adddraw(struct inode *inode, struct file *filp,
-                unsigned int cmd, unsigned long arg)
+               unsigned int cmd, unsigned long arg)
 {
        drm_draw_t draw;
 
        draw.handle = 0;        /* NOOP */
        DRM_DEBUG("%d\n", draw.handle);
-       if (copy_to_user((drm_draw_t __user *)arg, &draw, sizeof(draw)))
+       if (copy_to_user((drm_draw_t __user *) arg, &draw, sizeof(draw)))
                return -EFAULT;
        return 0;
 }
 
 /** No-op. */
 int drm_rmdraw(struct inode *inode, struct file *filp,
-               unsigned int cmd, unsigned long arg)
+              unsigned int cmd, unsigned long arg)
 {
        return 0;               /* NOOP */
 }
index 1e37ed0..3c0b882 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file drm_drv.
+ * \file drm_drv.c
  * Generic driver template
  *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
 #include "drmP.h"
 #include "drm_core.h"
 
+static int drm_version(struct inode *inode, struct file *filp,
+                      unsigned int cmd, unsigned long arg);
+
 /** Ioctl table */
-drm_ioctl_desc_t                 drm_ioctls[] = {
-       [DRM_IOCTL_NR(DRM_IOCTL_VERSION)]       = { drm_version,     0, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)]    = { drm_getunique,   0, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)]     = { drm_getmagic,    0, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)]     = { drm_irq_by_busid, 0, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)]       = { drm_getmap,      0, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)]    = { drm_getclient,   0, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)]     = { drm_getstats,    0, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)]   = { drm_setversion,  0, 1 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)]    = { drm_setunique,   1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)]         = { drm_noop,        1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)]       = { drm_noop,        1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)]    = { drm_authmagic,   1, 1 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)]       = { drm_addmap,      1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)]        = { drm_rmmap,       1, 0 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = { drm_setsareactx, 1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = { drm_getsareactx, 1, 0 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)]       = { drm_addctx,      1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)]        = { drm_rmctx,       1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)]       = { drm_modctx,      1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)]       = { drm_getctx,      1, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)]    = { drm_switchctx,   1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)]       = { drm_newctx,      1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)]       = { drm_resctx,      1, 0 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)]      = { drm_adddraw,     1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)]       = { drm_rmdraw,      1, 1 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_LOCK)]          = { drm_lock,        1, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)]        = { drm_unlock,      1, 0 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_FINISH)]        = { drm_noop,      1, 0 },
-
-       [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)]      = { drm_addbufs,     1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)]     = { drm_markbufs,    1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)]     = { drm_infobufs,    1, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)]      = { drm_mapbufs,     1, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)]     = { drm_freebufs,    1, 0 },
+static drm_ioctl_desc_t drm_ioctls[] = {
+       [DRM_IOCTL_NR(DRM_IOCTL_VERSION)] = {drm_version, 0},
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_UNIQUE)] = {drm_getunique, 0},
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_MAGIC)] = {drm_getmagic, 0},
+       [DRM_IOCTL_NR(DRM_IOCTL_IRQ_BUSID)] = {drm_irq_by_busid, DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_MAP)] = {drm_getmap, 0},
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_CLIENT)] = {drm_getclient, 0},
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_STATS)] = {drm_getstats, 0},
+       [DRM_IOCTL_NR(DRM_IOCTL_SET_VERSION)] = {drm_setversion, DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_SET_UNIQUE)] = {drm_setunique, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_BLOCK)] = {drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_UNBLOCK)] = {drm_noop, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_AUTH_MAGIC)] = {drm_authmagic, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+
+       [DRM_IOCTL_NR(DRM_IOCTL_ADD_MAP)] = {drm_addmap_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_RM_MAP)] = {drm_rmmap_ioctl, DRM_AUTH},
+
+       [DRM_IOCTL_NR(DRM_IOCTL_SET_SAREA_CTX)] = {drm_setsareactx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_SAREA_CTX)] = {drm_getsareactx, DRM_AUTH},
+
+       [DRM_IOCTL_NR(DRM_IOCTL_ADD_CTX)] = {drm_addctx, DRM_AUTH|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_RM_CTX)] = {drm_rmctx, DRM_AUTH|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_MOD_CTX)] = {drm_modctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_GET_CTX)] = {drm_getctx, DRM_AUTH},
+       [DRM_IOCTL_NR(DRM_IOCTL_SWITCH_CTX)] = {drm_switchctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_NEW_CTX)] = {drm_newctx, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_RES_CTX)] = {drm_resctx, DRM_AUTH},
+
+       [DRM_IOCTL_NR(DRM_IOCTL_ADD_DRAW)] = {drm_adddraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_RM_DRAW)] = {drm_rmdraw, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+
+       [DRM_IOCTL_NR(DRM_IOCTL_LOCK)] = {drm_lock, DRM_AUTH},
+       [DRM_IOCTL_NR(DRM_IOCTL_UNLOCK)] = {drm_unlock, DRM_AUTH},
+
+       [DRM_IOCTL_NR(DRM_IOCTL_FINISH)] = {drm_noop, DRM_AUTH},
+
+       [DRM_IOCTL_NR(DRM_IOCTL_ADD_BUFS)] = {drm_addbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_MARK_BUFS)] = {drm_markbufs, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_INFO_BUFS)] = {drm_infobufs, DRM_AUTH},
+       [DRM_IOCTL_NR(DRM_IOCTL_MAP_BUFS)] = {drm_mapbufs, DRM_AUTH},
+       [DRM_IOCTL_NR(DRM_IOCTL_FREE_BUFS)] = {drm_freebufs, DRM_AUTH},
        /* The DRM_IOCTL_DMA ioctl should be defined by the driver. */
+       [DRM_IOCTL_NR(DRM_IOCTL_DMA)] = {NULL, DRM_AUTH},
 
-       [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)]       = { drm_control,     1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_CONTROL)] = {drm_control, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
 
 #if __OS_HAS_AGP
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)]   = { drm_agp_acquire, 1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)]   = { drm_agp_release, 1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)]    = { drm_agp_enable,  1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)]      = { drm_agp_info,    1, 0 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)]     = { drm_agp_alloc,   1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)]      = { drm_agp_free,    1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)]      = { drm_agp_bind,    1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)]    = { drm_agp_unbind,  1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_ACQUIRE)] = {drm_agp_acquire_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_RELEASE)] = {drm_agp_release_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_ENABLE)] = {drm_agp_enable_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_INFO)] = {drm_agp_info_ioctl, DRM_AUTH},
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_ALLOC)] = {drm_agp_alloc_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_FREE)] = {drm_agp_free_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_BIND)] = {drm_agp_bind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_AGP_UNBIND)] = {drm_agp_unbind_ioctl, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
 #endif
 
-       [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)]      = { drm_sg_alloc,    1, 1 },
-       [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)]       = { drm_sg_free,     1, 1 },
+       [DRM_IOCTL_NR(DRM_IOCTL_SG_ALLOC)] = {drm_sg_alloc, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
+       [DRM_IOCTL_NR(DRM_IOCTL_SG_FREE)] = {drm_sg_free, DRM_AUTH|DRM_MASTER|DRM_ROOT_ONLY},
 
-       [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)]   = { drm_wait_vblank, 0, 0 },
+       [DRM_IOCTL_NR(DRM_IOCTL_WAIT_VBLANK)] = {drm_wait_vblank, 0},
 };
 
 #define DRIVER_IOCTL_COUNT     DRM_ARRAY_SIZE( drm_ioctls )
@@ -124,21 +127,20 @@ drm_ioctl_desc_t            drm_ioctls[] = {
  *
  * Frees every resource in \p dev.
  *
- * \sa drm_device and setup().
+ * \sa drm_device
  */
-int drm_takedown( drm_device_t *dev )
+int drm_lastclose(drm_device_t * dev)
 {
        drm_magic_entry_t *pt, *next;
-       drm_map_t *map;
        drm_map_list_t *r_list;
-       struct list_head *list, *list_next;
        drm_vma_entry_t *vma, *vma_next;
        int i;
 
-       DRM_DEBUG( "\n" );
+       DRM_DEBUG("\n");
 
-       if (dev->driver->pretakedown)
-         dev->driver->pretakedown(dev);
+       if (dev->driver->lastclose)
+               dev->driver->lastclose(dev);
+       DRM_DEBUG("driver lastclose completed\n");
 
        if (dev->unique) {
                drm_free(dev->unique, strlen(dev->unique) + 1, DRM_MEM_DRIVER);
@@ -146,126 +148,95 @@ int drm_takedown( drm_device_t *dev )
                dev->unique_len = 0;
        }
 
-       if ( dev->irq_enabled ) drm_irq_uninstall( dev );
+       if (dev->irq_enabled)
+               drm_irq_uninstall(dev);
 
-       down( &dev->struct_sem );
-       del_timer( &dev->timer );
+       mutex_lock(&dev->struct_mutex);
+       del_timer(&dev->timer);
 
-                               /* Clear pid list */
-       for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) {
-               for ( pt = dev->magiclist[i].head ; pt ; pt = next ) {
+       /* Clear pid list */
+       for (i = 0; i < DRM_HASH_SIZE; i++) {
+               for (pt = dev->magiclist[i].head; pt; pt = next) {
                        next = pt->next;
-                       drm_free( pt, sizeof(*pt), DRM_MEM_MAGIC );
+                       drm_free(pt, sizeof(*pt), DRM_MEM_MAGIC);
                }
                dev->magiclist[i].head = dev->magiclist[i].tail = NULL;
        }
 
-                               /* Clear AGP information */
+       /* Clear AGP information */
        if (drm_core_has_AGP(dev) && dev->agp) {
                drm_agp_mem_t *entry;
                drm_agp_mem_t *nexte;
 
-                               /* Remove AGP resources, but leave dev->agp
-                                   intact until drv_cleanup is called. */
-               for ( entry = dev->agp->memory ; entry ; entry = nexte ) {
+               /* Remove AGP resources, but leave dev->agp
+                  intact until drv_cleanup is called. */
+               for (entry = dev->agp->memory; entry; entry = nexte) {
                        nexte = entry->next;
-                       if ( entry->bound ) drm_unbind_agp( entry->memory );
-                       drm_free_agp( entry->memory, entry->pages );
-                       drm_free( entry, sizeof(*entry), DRM_MEM_AGPLISTS );
+                       if (entry->bound)
+                               drm_unbind_agp(entry->memory);
+                       drm_free_agp(entry->memory, entry->pages);
+                       drm_free(entry, sizeof(*entry), DRM_MEM_AGPLISTS);
                }
                dev->agp->memory = NULL;
 
-               if ( dev->agp->acquired ) drm_agp_do_release(dev);
+               if (dev->agp->acquired)
+                       drm_agp_release(dev);
 
                dev->agp->acquired = 0;
-               dev->agp->enabled  = 0;
+               dev->agp->enabled = 0;
+       }
+       if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg) {
+               drm_sg_cleanup(dev->sg);
+               dev->sg = NULL;
        }
 
-                               /* Clear vma list (only built for debugging) */
-       if ( dev->vmalist ) {
-               for ( vma = dev->vmalist ; vma ; vma = vma_next ) {
+       /* Clear vma list (only built for debugging) */
+       if (dev->vmalist) {
+               for (vma = dev->vmalist; vma; vma = vma_next) {
                        vma_next = vma->next;
-                       drm_free( vma, sizeof(*vma), DRM_MEM_VMAS );
+                       drm_free(vma, sizeof(*vma), DRM_MEM_VMAS);
                }
                dev->vmalist = NULL;
        }
 
-       if( dev->maplist ) {
-               list_for_each_safe( list, list_next, &dev->maplist->head ) {
-                       r_list = (drm_map_list_t *)list;
-
-                       if ( ( map = r_list->map ) ) {
-                               switch ( map->type ) {
-                               case _DRM_REGISTERS:
-                               case _DRM_FRAME_BUFFER:
-                                       if (drm_core_has_MTRR(dev)) {
-                                               if ( map->mtrr >= 0 ) {
-                                                       int retcode;
-                                                       retcode = mtrr_del( map->mtrr,
-                                                                           map->offset,
-                                                                           map->size );
-                                                       DRM_DEBUG( "mtrr_del=%d\n", retcode );
-                                               }
-                                       }
-                                       drm_ioremapfree( map->handle, map->size, dev );
-                                       break;
-                               case _DRM_SHM:
-                                       vfree(map->handle);
-                                       break;
-
-                               case _DRM_AGP:
-                                       /* Do nothing here, because this is all
-                                        * handled in the AGP/GART driver.
-                                        */
-                                       break;
-                               case _DRM_SCATTER_GATHER:
-                                       /* Handle it */
-                                       if (drm_core_check_feature(dev, DRIVER_SG) && dev->sg) {
-                                               drm_sg_cleanup(dev->sg);
-                                               dev->sg = NULL;
-                                       }
-                                       break;
-                               }
-                               drm_free(map, sizeof(*map), DRM_MEM_MAPS);
-                       }
-                       list_del( list );
-                       drm_free(r_list, sizeof(*r_list), DRM_MEM_MAPS);
-               }
-               drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
-               dev->maplist = NULL;
-       }
-
-       if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist ) {
-               for ( i = 0 ; i < dev->queue_count ; i++ ) {
-                       if ( dev->queuelist[i] ) {
-                               drm_free( dev->queuelist[i],
-                                         sizeof(*dev->queuelist[0]),
-                                         DRM_MEM_QUEUES );
+       if (dev->maplist) {
+               while (!list_empty(&dev->maplist->head)) {
+                       struct list_head *list = dev->maplist->head.next;
+                       r_list = list_entry(list, drm_map_list_t, head);
+                       drm_rmmap_locked(dev, r_list->map);
+               }
+       }
+
+       if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE) && dev->queuelist) {
+               for (i = 0; i < dev->queue_count; i++) {
+                       if (dev->queuelist[i]) {
+                               drm_free(dev->queuelist[i],
+                                        sizeof(*dev->queuelist[0]),
+                                        DRM_MEM_QUEUES);
                                dev->queuelist[i] = NULL;
                        }
                }
-               drm_free( dev->queuelist,
-                         dev->queue_slots * sizeof(*dev->queuelist),
-                         DRM_MEM_QUEUES );
+               drm_free(dev->queuelist,
+                        dev->queue_slots * sizeof(*dev->queuelist),
+                        DRM_MEM_QUEUES);
                dev->queuelist = NULL;
        }
        dev->queue_count = 0;
 
        if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
-               drm_dma_takedown( dev );
+               drm_dma_takedown(dev);
 
-       if ( dev->lock.hw_lock ) {
-               dev->sigdata.lock = dev->lock.hw_lock = NULL; /* SHM removed */
+       if (dev->lock.hw_lock) {
+               dev->sigdata.lock = dev->lock.hw_lock = NULL;   /* SHM removed */
                dev->lock.filp = NULL;
-               wake_up_interruptible( &dev->lock.lock_queue );
+               wake_up_interruptible(&dev->lock.lock_queue);
        }
-       up( &dev->struct_sem );
+       mutex_unlock(&dev->struct_mutex);
 
+       DRM_DEBUG("lastclose completed\n");
        return 0;
 }
 
-
-
 /**
  * Module initialization. Called via init_module at module load time, or via
  * linux/init/main.c (this is not currently supported).
@@ -275,26 +246,28 @@ int drm_takedown( drm_device_t *dev )
  * Initializes an array of drm_device structures, and attempts to
  * initialize all available devices, using consecutive minors, registering the
  * stubs and initializing the AGP device.
- * 
+ *
  * Expands the \c DRIVER_PREINIT and \c DRIVER_POST_INIT macros before and
  * after the initialization for driver customization.
  */
-int drm_init( struct drm_driver *driver )
+int drm_init(struct drm_driver *driver)
 {
        struct pci_dev *pdev = NULL;
        struct pci_device_id *pid;
        int i;
 
-       DRM_DEBUG( "\n" );
+       DRM_DEBUG("\n");
 
        drm_mem_init();
 
-       for (i=0; driver->pci_driver.id_table[i].vendor != 0; i++) {
+       for (i = 0; driver->pci_driver.id_table[i].vendor != 0; i++) {
                pid = (struct pci_device_id *)&driver->pci_driver.id_table[i];
-               
-               pdev=NULL;
-               /* pass back in pdev to account for multiple identical cards */         
-               while ((pdev = pci_get_subsys(pid->vendor, pid->device, pid->subvendor, pid->subdevice, pdev)) != NULL) {
+
+               pdev = NULL;
+               /* pass back in pdev to account for multiple identical cards */
+               while ((pdev =
+                       pci_get_subsys(pid->vendor, pid->device, pid->subvendor,
+                                      pid->subdevice, pdev)) != NULL) {
                        /* stealth mode requires a manual probe */
                        pci_dev_get(pdev);
                        drm_get_dev(pdev, pid, driver);
@@ -302,57 +275,63 @@ int drm_init( struct drm_driver *driver )
        }
        return 0;
 }
+
 EXPORT_SYMBOL(drm_init);
 
 /**
  * Called via cleanup_module() at module unload time.
  *
- * Cleans up all DRM device, calling takedown().
- * 
- * \sa drm_init().
+ * Cleans up all DRM device, calling drm_lastclose().
+ *
+ * \sa drm_init
  */
-static void drm_cleanup( drm_device_t *dev )
+static void drm_cleanup(drm_device_t * dev)
 {
-       DRM_DEBUG( "\n" );
+       DRM_DEBUG("\n");
 
        if (!dev) {
                DRM_ERROR("cleanup called no dev\n");
                return;
        }
 
-       drm_takedown( dev );    
+       drm_lastclose(dev);
+
+       if (dev->maplist) {
+               drm_free(dev->maplist, sizeof(*dev->maplist), DRM_MEM_MAPS);
+               dev->maplist = NULL;
+       }
+
+       drm_ctxbitmap_cleanup(dev);
 
-       drm_ctxbitmap_cleanup( dev );
-       
        if (drm_core_has_MTRR(dev) && drm_core_has_AGP(dev) &&
            dev->agp && dev->agp->agp_mtrr >= 0) {
                int retval;
-               retval = mtrr_del( dev->agp->agp_mtrr,
-                                  dev->agp->agp_info.aper_base,
-                                  dev->agp->agp_info.aper_size*1024*1024 );
-               DRM_DEBUG( "mtrr_del=%d\n", retval );
+               retval = mtrr_del(dev->agp->agp_mtrr,
+                                 dev->agp->agp_info.aper_base,
+                                 dev->agp->agp_info.aper_size * 1024 * 1024);
+               DRM_DEBUG("mtrr_del=%d\n", retval);
        }
-       
-       if (drm_core_has_AGP(dev) && dev->agp ) {
-               drm_free( dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS );
+
+       if (drm_core_has_AGP(dev) && dev->agp) {
+               drm_free(dev->agp, sizeof(*dev->agp), DRM_MEM_AGPLISTS);
                dev->agp = NULL;
        }
 
-       if (dev->driver->postcleanup)
-               dev->driver->postcleanup(dev);
-       
+       if (dev->driver->unload)
+               dev->driver->unload(dev);
+
        drm_put_head(&dev->primary);
-       if ( drm_put_dev(dev) )
-               DRM_ERROR( "Cannot unload module\n" );
+       if (drm_put_dev(dev))
+               DRM_ERROR("Cannot unload module\n");
 }
 
-void drm_exit (struct drm_driver *driver)
+void drm_exit(struct drm_driver *driver)
 {
        int i;
        drm_device_t *dev = NULL;
        drm_head_t *head;
-       
-       DRM_DEBUG( "\n" );
+
+       DRM_DEBUG("\n");
 
        for (i = 0; i < drm_cards_limit; i++) {
                head = drm_heads[i];
@@ -360,81 +339,80 @@ void drm_exit (struct drm_driver *driver)
                        continue;
                if (!head->dev)
                        continue;
-               if (head->dev->driver!=driver)
+               if (head->dev->driver != driver)
                        continue;
-               dev=head->dev;
-       }
-       if (dev) {
-               /* release the pci driver */
-               if (dev->pdev)
-                       pci_dev_put(dev->pdev);
-               drm_cleanup(dev);
+               dev = head->dev;
+               if (dev) {
+                       /* release the pci driver */
+                       if (dev->pdev)
+                               pci_dev_put(dev->pdev);
+                       drm_cleanup(dev);
+               }
        }
-       DRM_INFO( "Module unloaded\n" );
+       DRM_INFO("Module unloaded\n");
 }
+
 EXPORT_SYMBOL(drm_exit);
 
 /** File operations structure */
 static struct file_operations drm_stub_fops = {
        .owner = THIS_MODULE,
-       .open  = drm_stub_open
+       .open = drm_stub_open
 };
 
 static int __init drm_core_init(void)
 {
        int ret = -ENOMEM;
-       
-       drm_cards_limit = (drm_cards_limit < DRM_MAX_MINOR + 1 ? drm_cards_limit : DRM_MAX_MINOR + 1);
-       drm_heads = drm_calloc(drm_cards_limit,
-                               sizeof(*drm_heads), DRM_MEM_STUB);
-       if(!drm_heads) 
+
+       drm_cards_limit =
+           (drm_cards_limit <
+            DRM_MAX_MINOR + 1 ? drm_cards_limit : DRM_MAX_MINOR + 1);
+       drm_heads =
+           drm_calloc(drm_cards_limit, sizeof(*drm_heads), DRM_MEM_STUB);
+       if (!drm_heads)
                goto err_p1;
-       
+
        if (register_chrdev(DRM_MAJOR, "drm", &drm_stub_fops))
                goto err_p1;
-       
+
        drm_class = drm_sysfs_create(THIS_MODULE, "drm");
        if (IS_ERR(drm_class)) {
-               printk (KERN_ERR "DRM: Error creating drm class.\n");
+               printk(KERN_ERR "DRM: Error creating drm class.\n");
                ret = PTR_ERR(drm_class);
                goto err_p2;
        }
 
-       drm_proc_root = create_proc_entry("dri", S_IFDIR, NULL);
+       drm_proc_root = proc_mkdir("dri", NULL);
        if (!drm_proc_root) {
                DRM_ERROR("Cannot create /proc/dri\n");
                ret = -1;
                goto err_p3;
        }
-               
-       DRM_INFO( "Initialized %s %d.%d.%d %s\n",
-               CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL,
-               CORE_DATE);
+
+       DRM_INFO("Initialized %s %d.%d.%d %s\n",
+                CORE_NAME, CORE_MAJOR, CORE_MINOR, CORE_PATCHLEVEL, CORE_DATE);
        return 0;
-err_p3:
+      err_p3:
        drm_sysfs_destroy(drm_class);
-err_p2:
+      err_p2:
        unregister_chrdev(DRM_MAJOR, "drm");
        drm_free(drm_heads, sizeof(*drm_heads) * drm_cards_limit, DRM_MEM_STUB);
-err_p1:        
+      err_p1:
        return ret;
 }
 
-static void __exit drm_core_exit (void)
+static void __exit drm_core_exit(void)
 {
        remove_proc_entry("dri", NULL);
        drm_sysfs_destroy(drm_class);
 
        unregister_chrdev(DRM_MAJOR, "drm");
 
-       drm_free(drm_heads, sizeof(*drm_heads) *
-                               drm_cards_limit, DRM_MEM_STUB);
+       drm_free(drm_heads, sizeof(*drm_heads) * drm_cards_limit, DRM_MEM_STUB);
 }
 
-
-module_init( drm_core_init );
-module_exit( drm_core_exit );
-
+module_init(drm_core_init);
+module_exit(drm_core_exit);
 
 /**
  * Get version information
@@ -447,30 +425,31 @@ module_exit( drm_core_exit );
  *
  * Fills in the version information in \p arg.
  */
-int drm_version( struct inode *inode, struct file *filp,
-                 unsigned int cmd, unsigned long arg )
+static int drm_version(struct inode *inode, struct file *filp,
+                      unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
        drm_version_t __user *argp = (void __user *)arg;
        drm_version_t version;
-       int ret;
+       int len;
 
-       if ( copy_from_user( &version, argp, sizeof(version) ) )
+       if (copy_from_user(&version, argp, sizeof(version)))
                return -EFAULT;
 
-       /* version is a required function to return the personality module version */
-       if ((ret = dev->driver->version(&version)))
-               return ret;
-               
-       if ( copy_to_user( argp, &version, sizeof(version) ) )
+       version.version_major = dev->driver->major;
+       version.version_minor = dev->driver->minor;
+       version.version_patchlevel = dev->driver->patchlevel;
+       DRM_COPY(version.name, dev->driver->name);
+       DRM_COPY(version.date, dev->driver->date);
+       DRM_COPY(version.desc, dev->driver->desc);
+
+       if (copy_to_user(argp, &version, sizeof(version)))
                return -EFAULT;
        return 0;
 }
 
-
-
-/** 
+/**
  * Called whenever a process performs an ioctl on /dev/drm.
  *
  * \param inode device inode.
@@ -482,8 +461,8 @@ int drm_version( struct inode *inode, struct file *filp,
  * Looks up the ioctl function in the ::ioctls table, checking for root
  * previleges if so required, and dispatches to the respective function.
  */
-int drm_ioctl( struct inode *inode, struct file *filp,
-               unsigned int cmd, unsigned long arg )
+int drm_ioctl(struct inode *inode, struct file *filp,
+             unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
@@ -492,40 +471,44 @@ int drm_ioctl( struct inode *inode, struct file *filp,
        unsigned int nr = DRM_IOCTL_NR(cmd);
        int retcode = -EINVAL;
 
-       atomic_inc( &dev->ioctl_count );
-       atomic_inc( &dev->counts[_DRM_STAT_IOCTLS] );
+       atomic_inc(&dev->ioctl_count);
+       atomic_inc(&dev->counts[_DRM_STAT_IOCTLS]);
        ++priv->ioctl_count;
 
-       DRM_DEBUG( "pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
-                  current->pid, cmd, nr, (long)old_encode_dev(priv->head->device), 
-                  priv->authenticated );
-       
+       DRM_DEBUG("pid=%d, cmd=0x%02x, nr=0x%02x, dev 0x%lx, auth=%d\n",
+                 current->pid, cmd, nr,
+                 (long)old_encode_dev(priv->head->device),
+                 priv->authenticated);
+
        if (nr < DRIVER_IOCTL_COUNT)
                ioctl = &drm_ioctls[nr];
-       else if ((nr >= DRM_COMMAND_BASE) && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls))
+       else if ((nr >= DRM_COMMAND_BASE)
+                && (nr < DRM_COMMAND_BASE + dev->driver->num_ioctls))
                ioctl = &dev->driver->ioctls[nr - DRM_COMMAND_BASE];
        else
                goto err_i1;
-       
+
        func = ioctl->func;
        /* is there a local override? */
        if ((nr == DRM_IOCTL_NR(DRM_IOCTL_DMA)) && dev->driver->dma_ioctl)
                func = dev->driver->dma_ioctl;
-       
-       if ( !func ) {
-               DRM_DEBUG( "no function\n" );
+
+       if (!func) {
+               DRM_DEBUG("no function\n");
                retcode = -EINVAL;
-       } else if ( ( ioctl->root_only && !capable( CAP_SYS_ADMIN ) )||
-                   ( ioctl->auth_needed && !priv->authenticated ) ) {
+       } else if (((ioctl->flags & DRM_ROOT_ONLY) && !capable(CAP_SYS_ADMIN)) ||
+                  ((ioctl->flags & DRM_AUTH) && !priv->authenticated) ||
+                  ((ioctl->flags & DRM_MASTER) && !priv->master)) {
                retcode = -EACCES;
        } else {
-               retcode = func( inode, filp, cmd, arg );
+               retcode = func(inode, filp, cmd, arg);
        }
-       
-err_i1:
-       atomic_dec( &dev->ioctl_count );
-       if (retcode) DRM_DEBUG( "ret = %x\n", retcode);
+
+      err_i1:
+       atomic_dec(&dev->ioctl_count);
+       if (retcode)
+               DRM_DEBUG("ret = %x\n", retcode);
        return retcode;
 }
-EXPORT_SYMBOL(drm_ioctl);
 
+EXPORT_SYMBOL(drm_ioctl);
index 9067942..b7f7951 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * \file drm_fops.
+ * \file drm_fops.c
  * File operations for DRM
- * 
+ *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
  * \author Daryll Strauss <daryll@valinux.com>
  * \author Gareth Hughes <gareth@valinux.com>
  */
 
 #include "drmP.h"
+#include "drm_sarea.h"
 #include <linux/poll.h>
 
-static int drm_setup( drm_device_t *dev )
+static int drm_open_helper(struct inode *inode, struct file *filp,
+                          drm_device_t * dev);
+
+static int drm_setup(drm_device_t * dev)
 {
+       drm_local_map_t *map;
        int i;
        int ret;
 
-       if (dev->driver->presetup)
-       {
-               ret=dev->driver->presetup(dev);
-               if (ret!=0) 
+       if (dev->driver->firstopen) {
+               ret = dev->driver->firstopen(dev);
+               if (ret != 0)
                        return ret;
        }
 
-       atomic_set( &dev->ioctl_count, 0 );
-       atomic_set( &dev->vma_count, 0 );
+       /* prebuild the SAREA */
+       i = drm_addmap(dev, 0, SAREA_MAX, _DRM_SHM, _DRM_CONTAINS_LOCK, &map);
+       if (i != 0)
+               return i;
+
+       atomic_set(&dev->ioctl_count, 0);
+       atomic_set(&dev->vma_count, 0);
        dev->buf_use = 0;
-       atomic_set( &dev->buf_alloc, 0 );
+       atomic_set(&dev->buf_alloc, 0);
 
-       if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
-       {
-               i = drm_dma_setup( dev );
-               if ( i < 0 )
+       if (drm_core_check_feature(dev, DRIVER_HAVE_DMA)) {
+               i = drm_dma_setup(dev);
+               if (i < 0)
                        return i;
        }
 
-       for ( i = 0 ; i < DRM_ARRAY_SIZE(dev->counts) ; i++ )
-               atomic_set( &dev->counts[i], 0 );
+       for (i = 0; i < DRM_ARRAY_SIZE(dev->counts); i++)
+               atomic_set(&dev->counts[i], 0);
 
-       for ( i = 0 ; i < DRM_HASH_SIZE ; i++ ) {
+       for (i = 0; i < DRM_HASH_SIZE; i++) {
                dev->magiclist[i].head = NULL;
                dev->magiclist[i].tail = NULL;
        }
 
-       dev->maplist = drm_alloc(sizeof(*dev->maplist),
-                                 DRM_MEM_MAPS);
-       if(dev->maplist == NULL) return -ENOMEM;
-       memset(dev->maplist, 0, sizeof(*dev->maplist));
-       INIT_LIST_HEAD(&dev->maplist->head);
-
-       dev->ctxlist = drm_alloc(sizeof(*dev->ctxlist),
-                                 DRM_MEM_CTXLIST);
-       if(dev->ctxlist == NULL) return -ENOMEM;
+       dev->ctxlist = drm_alloc(sizeof(*dev->ctxlist), DRM_MEM_CTXLIST);
+       if (dev->ctxlist == NULL)
+               return -ENOMEM;
        memset(dev->ctxlist, 0, sizeof(*dev->ctxlist));
        INIT_LIST_HEAD(&dev->ctxlist->head);
 
        dev->vmalist = NULL;
        dev->sigdata.lock = dev->lock.hw_lock = NULL;
-       init_waitqueue_head( &dev->lock.lock_queue );
+       init_waitqueue_head(&dev->lock.lock_queue);
        dev->queue_count = 0;
        dev->queue_reserved = 0;
        dev->queue_slots = 0;
@@ -95,37 +97,32 @@ static int drm_setup( drm_device_t *dev )
        dev->last_context = 0;
        dev->last_switch = 0;
        dev->last_checked = 0;
-       init_waitqueue_head( &dev->context_wait );
+       init_waitqueue_head(&dev->context_wait);
        dev->if_version = 0;
 
        dev->ctx_start = 0;
        dev->lck_start = 0;
 
-       dev->buf_rp = dev->buf;
-       dev->buf_wp = dev->buf;
-       dev->buf_end = dev->buf + DRM_BSZ;
        dev->buf_async = NULL;
-       init_waitqueue_head( &dev->buf_readers );
-       init_waitqueue_head( &dev->buf_writers );
+       init_waitqueue_head(&dev->buf_readers);
+       init_waitqueue_head(&dev->buf_writers);
 
-       DRM_DEBUG( "\n" );
+       DRM_DEBUG("\n");
 
        /*
         * The kernel's context could be created here, but is now created
-        * in drm_dma_enqueue.  This is more resource-efficient for
+        * in drm_dma_enqueue.  This is more resource-efficient for
         * hardware that does not do DMA, but may mean that
         * drm_select_queue fails between the time the interrupt is
         * initialized and the time the queues are initialized.
         */
-       if (dev->driver->postsetup)
-               dev->driver->postsetup(dev);
 
        return 0;
 }
 
 /**
  * Open file.
- * 
+ *
  * \param inode device inode
  * \param filp file pointer.
  * \return zero on success or a negative number on failure.
@@ -134,7 +131,7 @@ static int drm_setup( drm_device_t *dev )
  * increments the device open count. If the open count was previous at zero,
  * i.e., it's the first that the device is open, then calls setup().
  */
-int drm_open( struct inode *inode, struct file *filp )
+int drm_open(struct inode *inode, struct file *filp)
 {
        drm_device_t *dev = NULL;
        int minor = iminor(inode);
@@ -142,28 +139,187 @@ int drm_open( struct inode *inode, struct file *filp )
 
        if (!((minor >= 0) && (minor < drm_cards_limit)))
                return -ENODEV;
-               
+
        if (!drm_heads[minor])
                return -ENODEV;
 
        if (!(dev = drm_heads[minor]->dev))
                return -ENODEV;
-       
-       retcode = drm_open_helper( inode, filp, dev );
-       if ( !retcode ) {
-               atomic_inc( &dev->counts[_DRM_STAT_OPENS] );
-               spin_lock( &dev->count_lock );
-               if ( !dev->open_count++ ) {
-                       spin_unlock( &dev->count_lock );
-                       return drm_setup( dev );
+
+       retcode = drm_open_helper(inode, filp, dev);
+       if (!retcode) {
+               atomic_inc(&dev->counts[_DRM_STAT_OPENS]);
+               spin_lock(&dev->count_lock);
+               if (!dev->open_count++) {
+                       spin_unlock(&dev->count_lock);
+                       return drm_setup(dev);
                }
-               spin_unlock( &dev->count_lock );
+               spin_unlock(&dev->count_lock);
        }
 
        return retcode;
 }
 EXPORT_SYMBOL(drm_open);
 
+/**
+ * File \c open operation.
+ *
+ * \param inode device inode.
+ * \param filp file pointer.
+ *
+ * Puts the dev->fops corresponding to the device minor number into
+ * \p filp, call the \c open method, and restore the file operations.
+ */
+int drm_stub_open(struct inode *inode, struct file *filp)
+{
+       drm_device_t *dev = NULL;
+       int minor = iminor(inode);
+       int err = -ENODEV;
+       const struct file_operations *old_fops;
+
+       DRM_DEBUG("\n");
+
+       if (!((minor >= 0) && (minor < drm_cards_limit)))
+               return -ENODEV;
+
+       if (!drm_heads[minor])
+               return -ENODEV;
+
+       if (!(dev = drm_heads[minor]->dev))
+               return -ENODEV;
+
+       old_fops = filp->f_op;
+       filp->f_op = fops_get(&dev->driver->fops);
+       if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) {
+               fops_put(filp->f_op);
+               filp->f_op = fops_get(old_fops);
+       }
+       fops_put(old_fops);
+
+       return err;
+}
+
+/**
+ * Check whether DRI will run on this CPU.
+ *
+ * \return non-zero if the DRI will run on this CPU, or zero otherwise.
+ */
+static int drm_cpu_valid(void)
+{
+#if defined(__i386__)
+       if (boot_cpu_data.x86 == 3)
+               return 0;       /* No cmpxchg on a 386 */
+#endif
+#if defined(__sparc__) && !defined(__sparc_v9__)
+       return 0;               /* No cmpxchg before v9 sparc. */
+#endif
+       return 1;
+}
+
+/**
+ * Called whenever a process opens /dev/drm.
+ *
+ * \param inode device inode.
+ * \param filp file pointer.
+ * \param dev device.
+ * \return zero on success or a negative number on failure.
+ *
+ * Creates and initializes a drm_file structure for the file private data in \p
+ * filp and add it into the double linked list in \p dev.
+ */
+static int drm_open_helper(struct inode *inode, struct file *filp,
+                          drm_device_t * dev)
+{
+       int minor = iminor(inode);
+       drm_file_t *priv;
+       int ret;
+
+       if (filp->f_flags & O_EXCL)
+               return -EBUSY;  /* No exclusive opens */
+       if (!drm_cpu_valid())
+               return -EINVAL;
+
+       DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);
+
+       priv = drm_alloc(sizeof(*priv), DRM_MEM_FILES);
+       if (!priv)
+               return -ENOMEM;
+
+       memset(priv, 0, sizeof(*priv));
+       filp->private_data = priv;
+       priv->uid = current->euid;
+       priv->pid = current->pid;
+       priv->minor = minor;
+       priv->head = drm_heads[minor];
+       priv->ioctl_count = 0;
+       /* for compatibility root is always authenticated */
+       priv->authenticated = capable(CAP_SYS_ADMIN);
+       priv->lock_count = 0;
+
+       if (dev->driver->open) {
+               ret = dev->driver->open(dev, priv);
+               if (ret < 0)
+                       goto out_free;
+       }
+
+       mutex_lock(&dev->struct_mutex);
+       if (!dev->file_last) {
+               priv->next = NULL;
+               priv->prev = NULL;
+               dev->file_first = priv;
+               dev->file_last = priv;
+               /* first opener automatically becomes master */
+               priv->master = 1;
+       } else {
+               priv->next = NULL;
+               priv->prev = dev->file_last;
+               dev->file_last->next = priv;
+               dev->file_last = priv;
+       }
+       mutex_unlock(&dev->struct_mutex);
+
+#ifdef __alpha__
+       /*
+        * Default the hose
+        */
+       if (!dev->hose) {
+               struct pci_dev *pci_dev;
+               pci_dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, NULL);
+               if (pci_dev) {
+                       dev->hose = pci_dev->sysdata;
+                       pci_dev_put(pci_dev);
+               }
+               if (!dev->hose) {
+                       struct pci_bus *b = pci_bus_b(pci_root_buses.next);
+                       if (b)
+                               dev->hose = b->sysdata;
+               }
+       }
+#endif
+
+       return 0;
+      out_free:
+       drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
+       filp->private_data = NULL;
+       return ret;
+}
+
+/** No-op. */
+int drm_fasync(int fd, struct file *filp, int on)
+{
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       int retcode;
+
+       DRM_DEBUG("fd = %d, device = 0x%lx\n", fd,
+                 (long)old_encode_dev(priv->head->device));
+       retcode = fasync_helper(fd, filp, on, &dev->buf_async);
+       if (retcode < 0)
+               return retcode;
+       return 0;
+}
+EXPORT_SYMBOL(drm_fasync);
+
 /**
  * Release file.
  *
@@ -174,9 +330,9 @@ EXPORT_SYMBOL(drm_open);
  * If the hardware lock is held then free it, and take it again for the kernel
  * context since it's necessary to reclaim buffers. Unlink the file private
  * data from its list and free it. Decreases the open count and if it reaches
- * zero calls takedown().
+ * zero calls drm_lastclose().
  */
-int drm_release( struct inode *inode, struct file *filp )
+int drm_release(struct inode *inode, struct file *filp)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev;
@@ -185,144 +341,142 @@ int drm_release( struct inode *inode, struct file *filp )
        lock_kernel();
        dev = priv->head->dev;
 
-       DRM_DEBUG( "open_count = %d\n", dev->open_count );
+       DRM_DEBUG("open_count = %d\n", dev->open_count);
 
-       if (dev->driver->prerelease)
-               dev->driver->prerelease(dev, filp);
+       if (dev->driver->preclose)
+               dev->driver->preclose(dev, filp);
 
        /* ========================================================
         * Begin inline drm_release
         */
 
-       DRM_DEBUG( "pid = %d, device = 0x%lx, open_count = %d\n",
-                  current->pid, (long)old_encode_dev(priv->head->device), dev->open_count );
-
-       if ( priv->lock_count && dev->lock.hw_lock &&
-            _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
-            dev->lock.filp == filp ) {
-               DRM_DEBUG( "File %p released, freeing lock for context %d\n",
-                       filp,
-                       _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );
-               
-               if (dev->driver->release)
-                       dev->driver->release(dev, filp);
-
-               drm_lock_free( dev, &dev->lock.hw_lock->lock,
-                               _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock) );
-
-                               /* FIXME: may require heavy-handed reset of
-                                   hardware at this point, possibly
-                                   processed via a callback to the X
-                                   server. */
-       }
-       else if ( dev->driver->release && priv->lock_count && dev->lock.hw_lock ) {
+       DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
+                 current->pid, (long)old_encode_dev(priv->head->device),
+                 dev->open_count);
+
+       if (priv->lock_count && dev->lock.hw_lock &&
+           _DRM_LOCK_IS_HELD(dev->lock.hw_lock->lock) &&
+           dev->lock.filp == filp) {
+               DRM_DEBUG("File %p released, freeing lock for context %d\n",
+                         filp, _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
+
+               if (dev->driver->reclaim_buffers_locked)
+                       dev->driver->reclaim_buffers_locked(dev, filp);
+
+               drm_lock_free(dev, &dev->lock.hw_lock->lock,
+                             _DRM_LOCKING_CONTEXT(dev->lock.hw_lock->lock));
+
+               /* FIXME: may require heavy-handed reset of
+                  hardware at this point, possibly
+                  processed via a callback to the X
+                  server. */
+       } else if (dev->driver->reclaim_buffers_locked && priv->lock_count
+                  && dev->lock.hw_lock) {
                /* The lock is required to reclaim buffers */
-               DECLARE_WAITQUEUE( entry, current );
+               DECLARE_WAITQUEUE(entry, current);
 
-               add_wait_queue( &dev->lock.lock_queue, &entry );
+               add_wait_queue(&dev->lock.lock_queue, &entry);
                for (;;) {
                        __set_current_state(TASK_INTERRUPTIBLE);
-                       if ( !dev->lock.hw_lock ) {
+                       if (!dev->lock.hw_lock) {
                                /* Device has been unregistered */
                                retcode = -EINTR;
                                break;
                        }
-                       if ( drm_lock_take( &dev->lock.hw_lock->lock,
-                                            DRM_KERNEL_CONTEXT ) ) {
-                               dev->lock.filp      = filp;
+                       if (drm_lock_take(&dev->lock.hw_lock->lock,
+                                         DRM_KERNEL_CONTEXT)) {
+                               dev->lock.filp = filp;
                                dev->lock.lock_time = jiffies;
-                                atomic_inc( &dev->counts[_DRM_STAT_LOCKS] );
+                               atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
                                break;  /* Got lock */
                        }
-                               /* Contention */
+                       /* Contention */
                        schedule();
-                       if ( signal_pending( current ) ) {
+                       if (signal_pending(current)) {
                                retcode = -ERESTARTSYS;
                                break;
                        }
                }
                __set_current_state(TASK_RUNNING);
-               remove_wait_queue( &dev->lock.lock_queue, &entry );
-               if( !retcode ) {
-                       if (dev->driver->release)
-                               dev->driver->release(dev, filp);
-                       drm_lock_free( dev, &dev->lock.hw_lock->lock,
-                                       DRM_KERNEL_CONTEXT );
+               remove_wait_queue(&dev->lock.lock_queue, &entry);
+               if (!retcode) {
+                       dev->driver->reclaim_buffers_locked(dev, filp);
+                       drm_lock_free(dev, &dev->lock.hw_lock->lock,
+                                     DRM_KERNEL_CONTEXT);
                }
        }
-       
-       if (drm_core_check_feature(dev, DRIVER_HAVE_DMA))
-       {
+
+       if (drm_core_check_feature(dev, DRIVER_HAVE_DMA) &&
+           !dev->driver->reclaim_buffers_locked) {
                dev->driver->reclaim_buffers(dev, filp);
        }
 
-       drm_fasync( -1, filp, 0 );
+       drm_fasync(-1, filp, 0);
 
-       down( &dev->ctxlist_sem );
-       if ( !list_empty( &dev->ctxlist->head ) ) {
+       mutex_lock(&dev->ctxlist_mutex);
+       if (dev->ctxlist && (!list_empty(&dev->ctxlist->head))) {
                drm_ctx_list_t *pos, *n;
 
-               list_for_each_entry_safe( pos, n, &dev->ctxlist->head, head ) {
-                       if ( pos->tag == priv &&
-                            pos->handle != DRM_KERNEL_CONTEXT ) {
+               list_for_each_entry_safe(pos, n, &dev->ctxlist->head, head) {
+                       if (pos->tag == priv &&
+                           pos->handle != DRM_KERNEL_CONTEXT) {
                                if (dev->driver->context_dtor)
-                                       dev->driver->context_dtor(dev, pos->handle);
+                                       dev->driver->context_dtor(dev,
+                                                                 pos->handle);
 
-                               drm_ctxbitmap_free( dev, pos->handle );
+                               drm_ctxbitmap_free(dev, pos->handle);
 
-                               list_del( &pos->head );
-                               drm_free( pos, sizeof(*pos), DRM_MEM_CTXLIST );
+                               list_del(&pos->head);
+                               drm_free(pos, sizeof(*pos), DRM_MEM_CTXLIST);
                                --dev->ctx_count;
                        }
                }
        }
-       up( &dev->ctxlist_sem );
+       mutex_unlock(&dev->ctxlist_mutex);
 
-       down( &dev->struct_sem );
-       if ( priv->remove_auth_on_close == 1 ) {
+       mutex_lock(&dev->struct_mutex);
+       if (priv->remove_auth_on_close == 1) {
                drm_file_t *temp = dev->file_first;
-               while ( temp ) {
+               while (temp) {
                        temp->authenticated = 0;
                        temp = temp->next;
                }
        }
-       if ( priv->prev ) {
+       if (priv->prev) {
                priv->prev->next = priv->next;
        } else {
-               dev->file_first  = priv->next;
+               dev->file_first = priv->next;
        }
-       if ( priv->next ) {
+       if (priv->next) {
                priv->next->prev = priv->prev;
        } else {
-               dev->file_last   = priv->prev;
+               dev->file_last = priv->prev;
        }
-       up( &dev->struct_sem );
-       
-       if (dev->driver->free_filp_priv)
-               dev->driver->free_filp_priv(dev, priv);
+       mutex_unlock(&dev->struct_mutex);
 
-       drm_free( priv, sizeof(*priv), DRM_MEM_FILES );
+       if (dev->driver->postclose)
+               dev->driver->postclose(dev, priv);
+       drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
 
        /* ========================================================
         * End inline drm_release
         */
 
-       atomic_inc( &dev->counts[_DRM_STAT_CLOSES] );
-       spin_lock( &dev->count_lock );
-       if ( !--dev->open_count ) {
-               if ( atomic_read( &dev->ioctl_count ) || dev->blocked ) {
-                       DRM_ERROR( "Device busy: %d %d\n",
-                                  atomic_read( &dev->ioctl_count ),
-                                  dev->blocked );
-                       spin_unlock( &dev->count_lock );
+       atomic_inc(&dev->counts[_DRM_STAT_CLOSES]);
+       spin_lock(&dev->count_lock);
+       if (!--dev->open_count) {
+               if (atomic_read(&dev->ioctl_count) || dev->blocked) {
+                       DRM_ERROR("Device busy: %d %d\n",
+                                 atomic_read(&dev->ioctl_count), dev->blocked);
+                       spin_unlock(&dev->count_lock);
                        unlock_kernel();
                        return -EBUSY;
                }
-               spin_unlock( &dev->count_lock );
+               spin_unlock(&dev->count_lock);
                unlock_kernel();
-               return drm_takedown( dev );
+               return drm_lastclose(dev);
        }
-       spin_unlock( &dev->count_lock );
+       spin_unlock(&dev->count_lock);
 
        unlock_kernel();
 
@@ -330,122 +484,9 @@ int drm_release( struct inode *inode, struct file *filp )
 }
 EXPORT_SYMBOL(drm_release);
 
-/**
- * Called whenever a process opens /dev/drm. 
- *
- * \param inode device inode.
- * \param filp file pointer.
- * \param dev device.
- * \return zero on success or a negative number on failure.
- * 
- * Creates and initializes a drm_file structure for the file private data in \p
- * filp and add it into the double linked list in \p dev.
- */
-int drm_open_helper(struct inode *inode, struct file *filp, drm_device_t *dev)
-{
-       int          minor = iminor(inode);
-       drm_file_t   *priv;
-       int ret;
-
-       if (filp->f_flags & O_EXCL)   return -EBUSY; /* No exclusive opens */
-       if (!drm_cpu_valid())        return -EINVAL;
-
-       DRM_DEBUG("pid = %d, minor = %d\n", current->pid, minor);
-
-       priv                = drm_alloc(sizeof(*priv), DRM_MEM_FILES);
-       if(!priv) return -ENOMEM;
-
-       memset(priv, 0, sizeof(*priv));
-       filp->private_data  = priv;
-       priv->uid           = current->euid;
-       priv->pid           = current->pid;
-       priv->minor         = minor;
-       priv->head          = drm_heads[minor];
-       priv->ioctl_count   = 0;
-       priv->authenticated = capable(CAP_SYS_ADMIN);
-       priv->lock_count    = 0;
-
-       if (dev->driver->open_helper) {
-               ret=dev->driver->open_helper(dev, priv);
-               if (ret < 0)
-                       goto out_free;
-       }
-
-       down(&dev->struct_sem);
-       if (!dev->file_last) {
-               priv->next      = NULL;
-               priv->prev      = NULL;
-               dev->file_first = priv;
-               dev->file_last  = priv;
-       } else {
-               priv->next           = NULL;
-               priv->prev           = dev->file_last;
-               dev->file_last->next = priv;
-               dev->file_last       = priv;
-       }
-       up(&dev->struct_sem);
-
-#ifdef __alpha__
-       /*
-        * Default the hose
-        */
-       if (!dev->hose) {
-               struct pci_dev *pci_dev;
-               pci_dev = pci_get_class(PCI_CLASS_DISPLAY_VGA << 8, NULL);
-               if (pci_dev) {
-                       dev->hose = pci_dev->sysdata;
-                       pci_dev_put(pci_dev);
-               }
-               if (!dev->hose) {
-                       struct pci_bus *b = pci_bus_b(pci_root_buses.next);
-                       if (b) dev->hose = b->sysdata;
-               }
-       }
-#endif
-
-       return 0;
-out_free:
-       drm_free(priv, sizeof(*priv), DRM_MEM_FILES);
-       filp->private_data=NULL;
-       return ret;
-}
-
-/** No-op. */
-int drm_flush(struct file *filp)
-{
-       drm_file_t    *priv   = filp->private_data;
-       drm_device_t  *dev    = priv->head->dev;
-
-       DRM_DEBUG("pid = %d, device = 0x%lx, open_count = %d\n",
-                 current->pid, (long)old_encode_dev(priv->head->device), dev->open_count);
-       return 0;
-}
-EXPORT_SYMBOL(drm_flush);
-
-/** No-op. */
-int drm_fasync(int fd, struct file *filp, int on)
-{
-       drm_file_t    *priv   = filp->private_data;
-       drm_device_t  *dev    = priv->head->dev;
-       int           retcode;
-
-       DRM_DEBUG("fd = %d, device = 0x%lx\n", fd, (long)old_encode_dev(priv->head->device));
-       retcode = fasync_helper(fd, filp, on, &dev->buf_async);
-       if (retcode < 0) return retcode;
-       return 0;
-}
-EXPORT_SYMBOL(drm_fasync);
-
 /** No-op. */
 unsigned int drm_poll(struct file *filp, struct poll_table_struct *wait)
 {
        return 0;
 }
 EXPORT_SYMBOL(drm_poll);
-
-
-/** No-op. */
-ssize_t drm_read(struct file *filp, char __user *buf, size_t count, loff_t *off)
-{
-       return 0;
-}
index 39afda0..555f323 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file drm_ioctl.
+ * \file drm_ioctl.c
  * IOCTL processing for DRM
  *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
@@ -40,7 +40,7 @@
 
 /**
  * Get the bus id.
- * 
+ *
  * \param inode device inode.
  * \param filp file pointer.
  * \param cmd command.
  * Copies the bus id from drm_device::unique into user space.
  */
 int drm_getunique(struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg)
+                 unsigned int cmd, unsigned long arg)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-       drm_unique_t     __user *argp = (void __user *)arg;
-       drm_unique_t     u;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_unique_t __user *argp = (void __user *)arg;
+       drm_unique_t u;
 
        if (copy_from_user(&u, argp, sizeof(u)))
                return -EFAULT;
@@ -71,7 +71,7 @@ int drm_getunique(struct inode *inode, struct file *filp,
 
 /**
  * Set the bus id.
- * 
+ *
  * \param inode device inode.
  * \param filp file pointer.
  * \param cmd command.
@@ -84,34 +84,39 @@ int drm_getunique(struct inode *inode, struct file *filp,
  * version 1.1 or greater.
  */
 int drm_setunique(struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg)
+                 unsigned int cmd, unsigned long arg)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-       drm_unique_t     u;
-       int              domain, bus, slot, func, ret;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_unique_t u;
+       int domain, bus, slot, func, ret;
 
-       if (dev->unique_len || dev->unique) return -EBUSY;
+       if (dev->unique_len || dev->unique)
+               return -EBUSY;
 
-       if (copy_from_user(&u, (drm_unique_t __user *)arg, sizeof(u)))
+       if (copy_from_user(&u, (drm_unique_t __user *) arg, sizeof(u)))
                return -EFAULT;
 
-       if (!u.unique_len || u.unique_len > 1024) return -EINVAL;
+       if (!u.unique_len || u.unique_len > 1024)
+               return -EINVAL;
 
        dev->unique_len = u.unique_len;
-       dev->unique     = drm_alloc(u.unique_len + 1, DRM_MEM_DRIVER);
-       if(!dev->unique) return -ENOMEM;
+       dev->unique = drm_alloc(u.unique_len + 1, DRM_MEM_DRIVER);
+       if (!dev->unique)
+               return -ENOMEM;
        if (copy_from_user(dev->unique, u.unique, dev->unique_len))
                return -EFAULT;
 
        dev->unique[dev->unique_len] = '\0';
 
-       dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + strlen(dev->unique) + 2,
-                                 DRM_MEM_DRIVER);
+       dev->devname =
+           drm_alloc(strlen(dev->driver->pci_driver.name) +
+                     strlen(dev->unique) + 2, DRM_MEM_DRIVER);
        if (!dev->devname)
                return -ENOMEM;
 
-       sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique);
+       sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name,
+               dev->unique);
 
        /* Return error if the busid submitted doesn't match the device's actual
         * busid.
@@ -121,41 +126,45 @@ int drm_setunique(struct inode *inode, struct file *filp,
                return DRM_ERR(EINVAL);
        domain = bus >> 8;
        bus &= 0xff;
-       
+
        if ((domain != dev->pci_domain) ||
            (bus != dev->pci_bus) ||
-           (slot != dev->pci_slot) ||
-           (func != dev->pci_func))
+           (slot != dev->pci_slot) || (func != dev->pci_func))
                return -EINVAL;
 
        return 0;
 }
 
-static int
-drm_set_busid(drm_device_t *dev)
+static int drm_set_busid(drm_device_t * dev)
 {
+       int len;
+
        if (dev->unique != NULL)
                return EBUSY;
 
-       dev->unique_len = 20;
+       dev->unique_len = 40;
        dev->unique = drm_alloc(dev->unique_len + 1, DRM_MEM_DRIVER);
        if (dev->unique == NULL)
                return ENOMEM;
 
-       snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
-               dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func);
+       len = snprintf(dev->unique, dev->unique_len, "pci:%04x:%02x:%02x.%d",
+                dev->pci_domain, dev->pci_bus, dev->pci_slot, dev->pci_func);
+
+       if (len > dev->unique_len)
+               DRM_ERROR("Unique buffer overflowed\n");
 
-       dev->devname = drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len + 2,
-                               DRM_MEM_DRIVER);
+       dev->devname =
+           drm_alloc(strlen(dev->driver->pci_driver.name) + dev->unique_len +
+                     2, DRM_MEM_DRIVER);
        if (dev->devname == NULL)
                return ENOMEM;
 
-       sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name, dev->unique);
+       sprintf(dev->devname, "%s@%s", dev->driver->pci_driver.name,
+               dev->unique);
 
        return 0;
 }
 
-
 /**
  * Get a mapping information.
  *
@@ -163,56 +172,57 @@ drm_set_busid(drm_device_t *dev)
  * \param filp file pointer.
  * \param cmd command.
  * \param arg user argument, pointing to a drm_map structure.
- * 
+ *
  * \return zero on success or a negative number on failure.
  *
  * Searches for the mapping with the specified offset and copies its information
  * into userspace
  */
-int drm_getmap( struct inode *inode, struct file *filp,
-                unsigned int cmd, unsigned long arg )
+int drm_getmap(struct inode *inode, struct file *filp,
+              unsigned int cmd, unsigned long arg)
 {
-       drm_file_t   *priv = filp->private_data;
-       drm_device_t *dev  = priv->head->dev;
-       drm_map_t    __user *argp = (void __user *)arg;
-       drm_map_t    map;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_map_t __user *argp = (void __user *)arg;
+       drm_map_t map;
        drm_map_list_t *r_list = NULL;
        struct list_head *list;
-       int          idx;
-       int          i;
+       int idx;
+       int i;
 
        if (copy_from_user(&map, argp, sizeof(map)))
                return -EFAULT;
        idx = map.offset;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        if (idx < 0) {
-               up(&dev->struct_sem);
+               mutex_unlock(&dev->struct_mutex);
                return -EINVAL;
        }
 
        i = 0;
        list_for_each(list, &dev->maplist->head) {
-               if(i == idx) {
+               if (i == idx) {
                        r_list = list_entry(list, drm_map_list_t, head);
                        break;
                }
                i++;
        }
-       if(!r_list || !r_list->map) {
-               up(&dev->struct_sem);
+       if (!r_list || !r_list->map) {
+               mutex_unlock(&dev->struct_mutex);
                return -EINVAL;
        }
 
        map.offset = r_list->map->offset;
-       map.size   = r_list->map->size;
-       map.type   = r_list->map->type;
-       map.flags  = r_list->map->flags;
-       map.handle = r_list->map->handle;
-       map.mtrr   = r_list->map->mtrr;
-       up(&dev->struct_sem);
-
-       if (copy_to_user(argp, &map, sizeof(map))) return -EFAULT;
+       map.size = r_list->map->size;
+       map.type = r_list->map->type;
+       map.flags = r_list->map->flags;
+       map.handle = (void *)(unsigned long)r_list->user_token;
+       map.mtrr = r_list->map->mtrr;
+       mutex_unlock(&dev->struct_mutex);
+
+       if (copy_to_user(argp, &map, sizeof(map)))
+               return -EFAULT;
        return 0;
 }
 
@@ -223,83 +233,81 @@ int drm_getmap( struct inode *inode, struct file *filp,
  * \param filp file pointer.
  * \param cmd command.
  * \param arg user argument, pointing to a drm_client structure.
- * 
+ *
  * \return zero on success or a negative number on failure.
  *
  * Searches for the client with the specified index and copies its information
  * into userspace
  */
-int drm_getclient( struct inode *inode, struct file *filp,
-                   unsigned int cmd, unsigned long arg )
+int drm_getclient(struct inode *inode, struct file *filp,
+                 unsigned int cmd, unsigned long arg)
 {
-       drm_file_t   *priv = filp->private_data;
-       drm_device_t *dev  = priv->head->dev;
-       drm_client_t __user *argp = (void __user *)arg;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_client_t __user *argp = (drm_client_t __user *)arg;
        drm_client_t client;
-       drm_file_t   *pt;
-       int          idx;
-       int          i;
+       drm_file_t *pt;
+       int idx;
+       int i;
 
        if (copy_from_user(&client, argp, sizeof(client)))
                return -EFAULT;
        idx = client.idx;
-       down(&dev->struct_sem);
-       for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next)
-               ;
+       mutex_lock(&dev->struct_mutex);
+       for (i = 0, pt = dev->file_first; i < idx && pt; i++, pt = pt->next) ;
 
        if (!pt) {
-               up(&dev->struct_sem);
+               mutex_unlock(&dev->struct_mutex);
                return -EINVAL;
        }
-       client.auth  = pt->authenticated;
-       client.pid   = pt->pid;
-       client.uid   = pt->uid;
+       client.auth = pt->authenticated;
+       client.pid = pt->pid;
+       client.uid = pt->uid;
        client.magic = pt->magic;
-       client.iocs  = pt->ioctl_count;
-       up(&dev->struct_sem);
+       client.iocs = pt->ioctl_count;
+       mutex_unlock(&dev->struct_mutex);
 
-       if (copy_to_user((drm_client_t __user *)arg, &client, sizeof(client)))
+       if (copy_to_user(argp, &client, sizeof(client)))
                return -EFAULT;
        return 0;
 }
 
-/** 
- * Get statistics information. 
- * 
+/**
+ * Get statistics information.
+ *
  * \param inode device inode.
  * \param filp file pointer.
  * \param cmd command.
  * \param arg user argument, pointing to a drm_stats structure.
- * 
+ *
  * \return zero on success or a negative number on failure.
  */
-int drm_getstats( struct inode *inode, struct file *filp,
-                  unsigned int cmd, unsigned long arg )
+int drm_getstats(struct inode *inode, struct file *filp,
+                unsigned int cmd, unsigned long arg)
 {
-       drm_file_t   *priv = filp->private_data;
-       drm_device_t *dev  = priv->head->dev;
-       drm_stats_t  stats;
-       int          i;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_stats_t stats;
+       int i;
 
        memset(&stats, 0, sizeof(stats));
-       
-       down(&dev->struct_sem);
+
+       mutex_lock(&dev->struct_mutex);
 
        for (i = 0; i < dev->counters; i++) {
                if (dev->types[i] == _DRM_STAT_LOCK)
                        stats.data[i].value
-                               = (dev->lock.hw_lock
-                                  ? dev->lock.hw_lock->lock : 0);
-               else 
+                           = (dev->lock.hw_lock ? dev->lock.hw_lock->lock : 0);
+               else
                        stats.data[i].value = atomic_read(&dev->counts[i]);
-               stats.data[i].type  = dev->types[i];
+               stats.data[i].type = dev->types[i];
        }
-       
+
        stats.count = dev->counters;
 
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
 
-       if (copy_to_user((drm_stats_t __user *)arg, &stats, sizeof(stats)))
+       if (copy_to_user((drm_stats_t __user *) arg, &stats, sizeof(stats)))
                return -EFAULT;
        return 0;
 }
@@ -322,17 +330,13 @@ int drm_setversion(DRM_IOCTL_ARGS)
        drm_set_version_t retv;
        int if_version;
        drm_set_version_t __user *argp = (void __user *)data;
-       drm_version_t version;
 
        DRM_COPY_FROM_USER_IOCTL(sv, argp, sizeof(sv));
 
-       memset(&version, 0, sizeof(version));
-
-       dev->driver->version(&version);
        retv.drm_di_major = DRM_IF_MAJOR;
        retv.drm_di_minor = DRM_IF_MINOR;
-       retv.drm_dd_major = version.version_major;
-       retv.drm_dd_minor = version.version_minor;
+       retv.drm_dd_major = dev->driver->major;
+       retv.drm_dd_minor = dev->driver->minor;
 
        DRM_COPY_TO_USER_IOCTL(argp, retv, sizeof(sv));
 
@@ -340,7 +344,7 @@ int drm_setversion(DRM_IOCTL_ARGS)
                if (sv.drm_di_major != DRM_IF_MAJOR ||
                    sv.drm_di_minor < 0 || sv.drm_di_minor > DRM_IF_MINOR)
                        return EINVAL;
-               if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_dd_minor);
+               if_version = DRM_IF_VERSION(sv.drm_di_major, sv.drm_di_minor);
                dev->if_version = DRM_MAX(if_version, dev->if_version);
                if (sv.drm_di_minor >= 1) {
                        /*
@@ -351,8 +355,9 @@ int drm_setversion(DRM_IOCTL_ARGS)
        }
 
        if (sv.drm_dd_major != -1) {
-               if (sv.drm_dd_major != version.version_major ||
-                   sv.drm_dd_minor < 0 || sv.drm_dd_minor > version.version_minor)
+               if (sv.drm_dd_major != dev->driver->major ||
+                   sv.drm_dd_minor < 0
+                   || sv.drm_dd_minor > dev->driver->minor)
                        return EINVAL;
 
                if (dev->driver->set_version)
@@ -363,7 +368,7 @@ int drm_setversion(DRM_IOCTL_ARGS)
 
 /** No-op ioctl. */
 int drm_noop(struct inode *inode, struct file *filp, unsigned int cmd,
-              unsigned long arg)
+            unsigned long arg)
 {
        DRM_DEBUG("\n");
        return 0;
index d0d6fc6..f9e4530 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * \file drm_lock.
+ * \file drm_lock.c
  * IOCTLs for locking
- * 
+ *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
  * \author Gareth Hughes <gareth@valinux.com>
  */
 
 #include "drmP.h"
 
-/** 
+static int drm_lock_transfer(drm_device_t * dev,
+                            __volatile__ unsigned int *lock,
+                            unsigned int context);
+static int drm_notifier(void *priv);
+
+/**
  * Lock ioctl.
  *
  * \param inode device inode.
  *
  * Add the current task to the lock wait queue, and attempt to take to lock.
  */
-int drm_lock( struct inode *inode, struct file *filp,
-              unsigned int cmd, unsigned long arg )
+int drm_lock(struct inode *inode, struct file *filp,
+            unsigned int cmd, unsigned long arg)
 {
-        drm_file_t *priv = filp->private_data;
-        drm_device_t *dev = priv->head->dev;
-        DECLARE_WAITQUEUE( entry, current );
-        drm_lock_t lock;
-        int ret = 0;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       DECLARE_WAITQUEUE(entry, current);
+       drm_lock_t lock;
+       int ret = 0;
 
        ++priv->lock_count;
 
-        if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) )
+       if (copy_from_user(&lock, (drm_lock_t __user *) arg, sizeof(lock)))
                return -EFAULT;
 
-        if ( lock.context == DRM_KERNEL_CONTEXT ) {
-                DRM_ERROR( "Process %d using kernel context %d\n",
-                          current->pid, lock.context );
-                return -EINVAL;
-        }
+       if (lock.context == DRM_KERNEL_CONTEXT) {
+               DRM_ERROR("Process %d using kernel context %d\n",
+                         current->pid, lock.context);
+               return -EINVAL;
+       }
 
-        DRM_DEBUG( "%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
-                  lock.context, current->pid,
-                  dev->lock.hw_lock->lock, lock.flags );
+       DRM_DEBUG("%d (pid %d) requests lock (0x%08x), flags = 0x%08x\n",
+                 lock.context, current->pid,
+                 dev->lock.hw_lock->lock, lock.flags);
 
        if (drm_core_check_feature(dev, DRIVER_DMA_QUEUE))
-               if ( lock.context < 0 )
+               if (lock.context < 0)
                        return -EINVAL;
 
-       add_wait_queue( &dev->lock.lock_queue, &entry );
+       add_wait_queue(&dev->lock.lock_queue, &entry);
        for (;;) {
                __set_current_state(TASK_INTERRUPTIBLE);
-               if ( !dev->lock.hw_lock ) {
+               if (!dev->lock.hw_lock) {
                        /* Device has been unregistered */
                        ret = -EINTR;
                        break;
                }
-               if ( drm_lock_take( &dev->lock.hw_lock->lock,
-                                    lock.context ) ) {
-                       dev->lock.filp      = filp;
+               if (drm_lock_take(&dev->lock.hw_lock->lock, lock.context)) {
+                       dev->lock.filp = filp;
                        dev->lock.lock_time = jiffies;
-                       atomic_inc( &dev->counts[_DRM_STAT_LOCKS] );
-                       break;  /* Got lock */
+                       atomic_inc(&dev->counts[_DRM_STAT_LOCKS]);
+                       break;  /* Got lock */
                }
-               
+
                /* Contention */
                schedule();
-               if ( signal_pending( current ) ) {
+               if (signal_pending(current)) {
                        ret = -ERESTARTSYS;
                        break;
                }
        }
        __set_current_state(TASK_RUNNING);
-       remove_wait_queue( &dev->lock.lock_queue, &entry );
+       remove_wait_queue(&dev->lock.lock_queue, &entry);
 
-       sigemptyset( &dev->sigmask );
-       sigaddset( &dev->sigmask, SIGSTOP );
-       sigaddset( &dev->sigmask, SIGTSTP );
-       sigaddset( &dev->sigmask, SIGTTIN );
-       sigaddset( &dev->sigmask, SIGTTOU );
+       DRM_DEBUG("%d %s\n", lock.context, ret ? "interrupted" : "has lock");
+       if (ret)
+               return ret;
+
+       sigemptyset(&dev->sigmask);
+       sigaddset(&dev->sigmask, SIGSTOP);
+       sigaddset(&dev->sigmask, SIGTSTP);
+       sigaddset(&dev->sigmask, SIGTTIN);
+       sigaddset(&dev->sigmask, SIGTTOU);
        dev->sigdata.context = lock.context;
-       dev->sigdata.lock    = dev->lock.hw_lock;
-       block_all_signals( drm_notifier,
-                          &dev->sigdata, &dev->sigmask );
-       
+       dev->sigdata.lock = dev->lock.hw_lock;
+       block_all_signals(drm_notifier, &dev->sigdata, &dev->sigmask);
+
        if (dev->driver->dma_ready && (lock.flags & _DRM_LOCK_READY))
                dev->driver->dma_ready(dev);
-       
-       if ( dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT ))
-               return dev->driver->dma_quiescent(dev);
-       
-       /* dev->driver->kernel_context_switch isn't used by any of the x86 
+
+       if (dev->driver->dma_quiescent && (lock.flags & _DRM_LOCK_QUIESCENT)) {
+               if (dev->driver->dma_quiescent(dev)) {
+                       DRM_DEBUG("%d waiting for DMA quiescent\n", lock.context);
+                       return DRM_ERR(EBUSY);
+               }
+       }
+
+       /* dev->driver->kernel_context_switch isn't used by any of the x86
         *  drivers but is used by the Sparc driver.
         */
-       
-       if (dev->driver->kernel_context_switch && 
+       if (dev->driver->kernel_context_switch &&
            dev->last_context != lock.context) {
-         dev->driver->kernel_context_switch(dev, dev->last_context, 
-                                           lock.context);
+               dev->driver->kernel_context_switch(dev, dev->last_context,
+                                                  lock.context);
        }
-        DRM_DEBUG( "%d %s\n", lock.context, ret ? "interrupted" : "has lock" );
-
-        return ret;
+       return 0;
 }
 
-/** 
+/**
  * Unlock ioctl.
  *
  * \param inode device inode.
@@ -141,23 +149,23 @@ int drm_lock( struct inode *inode, struct file *filp,
  *
  * Transfer and free the lock.
  */
-int drm_unlock( struct inode *inode, struct file *filp,
-                unsigned int cmd, unsigned long arg )
+int drm_unlock(struct inode *inode, struct file *filp,
+              unsigned int cmd, unsigned long arg)
 {
        drm_file_t *priv = filp->private_data;
        drm_device_t *dev = priv->head->dev;
        drm_lock_t lock;
 
-       if ( copy_from_user( &lock, (drm_lock_t __user *)arg, sizeof(lock) ) )
+       if (copy_from_user(&lock, (drm_lock_t __user *) arg, sizeof(lock)))
                return -EFAULT;
 
-       if ( lock.context == DRM_KERNEL_CONTEXT ) {
-               DRM_ERROR( "Process %d using kernel context %d\n",
-                          current->pid, lock.context );
+       if (lock.context == DRM_KERNEL_CONTEXT) {
+               DRM_ERROR("Process %d using kernel context %d\n",
+                         current->pid, lock.context);
                return -EINVAL;
        }
 
-       atomic_inc( &dev->counts[_DRM_STAT_UNLOCKS] );
+       atomic_inc(&dev->counts[_DRM_STAT_UNLOCKS]);
 
        /* kernel_context_switch isn't used by any of the x86 drm
         * modules but is required by the Sparc driver.
@@ -165,12 +173,12 @@ int drm_unlock( struct inode *inode, struct file *filp,
        if (dev->driver->kernel_context_switch_unlock)
                dev->driver->kernel_context_switch_unlock(dev, &lock);
        else {
-               drm_lock_transfer( dev, &dev->lock.hw_lock->lock, 
-                                   DRM_KERNEL_CONTEXT );
-               
-               if ( drm_lock_free( dev, &dev->lock.hw_lock->lock,
-                                    DRM_KERNEL_CONTEXT ) ) {
-                       DRM_ERROR( "\n" );
+               drm_lock_transfer(dev, &dev->lock.hw_lock->lock,
+                                 DRM_KERNEL_CONTEXT);
+
+               if (drm_lock_free(dev, &dev->lock.hw_lock->lock,
+                                 DRM_KERNEL_CONTEXT)) {
+                       DRM_ERROR("\n");
                }
        }
 
@@ -193,8 +201,10 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
 
        do {
                old = *lock;
-               if (old & _DRM_LOCK_HELD) new = old | _DRM_LOCK_CONT;
-               else                      new = context | _DRM_LOCK_HELD;
+               if (old & _DRM_LOCK_HELD)
+                       new = old | _DRM_LOCK_CONT;
+               else
+                       new = context | _DRM_LOCK_HELD;
                prev = cmpxchg(lock, old, new);
        } while (prev != old);
        if (_DRM_LOCKING_CONTEXT(old) == context) {
@@ -207,7 +217,7 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
                }
        }
        if (new == (context | _DRM_LOCK_HELD)) {
-                               /* Have lock */
+               /* Have lock */
                return 1;
        }
        return 0;
@@ -215,8 +225,8 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
 
 /**
  * This takes a lock forcibly and hands it to context. Should ONLY be used
- * inside *_unlock to give lock to kernel before calling *_dma_schedule. 
- * 
+ * inside *_unlock to give lock to kernel before calling *_dma_schedule.
+ *
  * \param dev DRM device.
  * \param lock lock pointer.
  * \param context locking context.
@@ -225,15 +235,16 @@ int drm_lock_take(__volatile__ unsigned int *lock, unsigned int context)
  * Resets the lock file pointer.
  * Marks the lock as held by the given context, via the \p cmpxchg instruction.
  */
-int drm_lock_transfer(drm_device_t *dev,
-                      __volatile__ unsigned int *lock, unsigned int context)
+static int drm_lock_transfer(drm_device_t * dev,
+                            __volatile__ unsigned int *lock,
+                            unsigned int context)
 {
        unsigned int old, new, prev;
 
        dev->lock.filp = NULL;
        do {
-               old  = *lock;
-               new  = context | _DRM_LOCK_HELD;
+               old = *lock;
+               new = context | _DRM_LOCK_HELD;
                prev = cmpxchg(lock, old, new);
        } while (prev != old);
        return 1;
@@ -241,30 +252,29 @@ int drm_lock_transfer(drm_device_t *dev,
 
 /**
  * Free lock.
- * 
+ *
  * \param dev DRM device.
  * \param lock lock.
  * \param context context.
- * 
+ *
  * Resets the lock file pointer.
  * Marks the lock as not held, via the \p cmpxchg instruction. Wakes any task
  * waiting on the lock queue.
  */
-int drm_lock_free(drm_device_t *dev,
-                  __volatile__ unsigned int *lock, unsigned int context)
+int drm_lock_free(drm_device_t * dev,
+                 __volatile__ unsigned int *lock, unsigned int context)
 {
        unsigned int old, new, prev;
 
        dev->lock.filp = NULL;
        do {
-               old  = *lock;
-               new  = 0;
+               old = *lock;
+               new = 0;
                prev = cmpxchg(lock, old, new);
        } while (prev != old);
        if (_DRM_LOCK_IS_HELD(old) && _DRM_LOCKING_CONTEXT(old) != context) {
                DRM_ERROR("%d freed heavyweight lock held by %d\n",
-                         context,
-                         _DRM_LOCKING_CONTEXT(old));
+                         context, _DRM_LOCKING_CONTEXT(old));
                return 1;
        }
        wake_up_interruptible(&dev->lock.lock_queue);
@@ -282,21 +292,21 @@ int drm_lock_free(drm_device_t *dev,
  * \return one if the signal should be delivered normally, or zero if the
  * signal should be blocked.
  */
-int drm_notifier(void *priv)
+static int drm_notifier(void *priv)
 {
-       drm_sigdata_t *s = (drm_sigdata_t *)priv;
-       unsigned int  old, new, prev;
-
+       drm_sigdata_t *s = (drm_sigdata_t *) priv;
+       unsigned int old, new, prev;
 
-                               /* Allow signal delivery if lock isn't held */
+       /* Allow signal delivery if lock isn't held */
        if (!s->lock || !_DRM_LOCK_IS_HELD(s->lock->lock)
-           || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context) return 1;
+           || _DRM_LOCKING_CONTEXT(s->lock->lock) != s->context)
+               return 1;
 
-                               /* Otherwise, set flag to force call to
-                                   drmUnlock */
+       /* Otherwise, set flag to force call to
+          drmUnlock */
        do {
-               old  = s->lock->lock;
-               new  = old | _DRM_LOCK_CONT;
+               old = s->lock->lock;
+               new = old | _DRM_LOCK_CONT;
                prev = cmpxchg(&s->lock->lock, old, new);
        } while (prev != old);
        return 0;
index 192e876..86a0f1c 100644 (file)
@@ -37,6 +37,7 @@
  */
 
 #include <linux/pci.h>
+#include <linux/dma-mapping.h>
 #include "drmP.h"
 
 /**********************************************************************/
 /**
  * \brief Allocate a PCI consistent memory block, for DMA.
  */
-void *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align,
-                   dma_addr_t maxaddr, dma_addr_t * busaddr)
+drm_dma_handle_t *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align,
+                               dma_addr_t maxaddr)
 {
-       void *address;
-#if DRM_DEBUG_MEMORY
+       drm_dma_handle_t *dmah;
+#if 1
+       unsigned long addr;
+       size_t sz;
+#endif
+#ifdef DRM_DEBUG_MEMORY
        int area = DRM_MEM_DMA;
 
        spin_lock(&drm_mem_lock);
@@ -74,13 +79,19 @@ void *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align,
                return NULL;
        }
 
-       address = pci_alloc_consistent(dev->pdev, size, busaddr);
+       dmah = kmalloc(sizeof(drm_dma_handle_t), GFP_KERNEL);
+       if (!dmah)
+               return NULL;
+
+       dmah->size = size;
+       dmah->vaddr = dma_alloc_coherent(&dev->pdev->dev, size, &dmah->busaddr, GFP_KERNEL | __GFP_COMP);
 
-#if DRM_DEBUG_MEMORY
-       if (address == NULL) {
+#ifdef DRM_DEBUG_MEMORY
+       if (dmah->vaddr == NULL) {
                spin_lock(&drm_mem_lock);
                ++drm_mem_stats[area].fail_count;
                spin_unlock(&drm_mem_lock);
+               kfree(dmah);
                return NULL;
        }
 
@@ -90,37 +101,59 @@ void *drm_pci_alloc(drm_device_t * dev, size_t size, size_t align,
        drm_ram_used += size;
        spin_unlock(&drm_mem_lock);
 #else
-       if (address == NULL)
+       if (dmah->vaddr == NULL) {
+               kfree(dmah);
                return NULL;
+       }
 #endif
 
-       memset(address, 0, size);
+       memset(dmah->vaddr, 0, size);
 
-       return address;
+       /* XXX - Is virt_to_page() legal for consistent mem? */
+       /* Reserve */
+       for (addr = (unsigned long)dmah->vaddr, sz = size;
+            sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+               SetPageReserved(virt_to_page(addr));
+       }
+
+       return dmah;
 }
+
 EXPORT_SYMBOL(drm_pci_alloc);
 
 /**
- * \brief Free a PCI consistent memory block.
+ * \brief Free a PCI consistent memory block without freeing its descriptor.
+ *
+ * This function is for internal use in the Linux-specific DRM core code.
  */
-void
-drm_pci_free(drm_device_t * dev, size_t size, void *vaddr, dma_addr_t busaddr)
+void __drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah)
 {
-#if DRM_DEBUG_MEMORY
+#if 1
+       unsigned long addr;
+       size_t sz;
+#endif
+#ifdef DRM_DEBUG_MEMORY
        int area = DRM_MEM_DMA;
        int alloc_count;
        int free_count;
 #endif
 
-       if (!vaddr) {
-#if DRM_DEBUG_MEMORY
+       if (!dmah->vaddr) {
+#ifdef DRM_DEBUG_MEMORY
                DRM_MEM_ERROR(area, "Attempt to free address 0\n");
 #endif
        } else {
-               pci_free_consistent(dev->pdev, size, vaddr, busaddr);
+               /* XXX - Is virt_to_page() legal for consistent mem? */
+               /* Unreserve */
+               for (addr = (unsigned long)dmah->vaddr, sz = dmah->size;
+                    sz > 0; addr += PAGE_SIZE, sz -= PAGE_SIZE) {
+                       ClearPageReserved(virt_to_page(addr));
+               }
+               dma_free_coherent(&dev->pdev->dev, dmah->size, dmah->vaddr,
+                                 dmah->busaddr);
        }
 
-#if DRM_DEBUG_MEMORY
+#ifdef DRM_DEBUG_MEMORY
        spin_lock(&drm_mem_lock);
        free_count = ++drm_mem_stats[area].free_count;
        alloc_count = drm_mem_stats[area].succeed_count;
@@ -135,6 +168,16 @@ drm_pci_free(drm_device_t * dev, size_t size, void *vaddr, dma_addr_t busaddr)
 #endif
 
 }
+
+/**
+ * \brief Free a PCI consistent memory block
+ */
+void drm_pci_free(drm_device_t * dev, drm_dma_handle_t * dmah)
+{
+       __drm_pci_free(dev, dmah);
+       kfree(dmah);
+}
+
 EXPORT_SYMBOL(drm_pci_free);
 
 /*@}*/
index 11c6950..b1bb3c7 100644 (file)
    Please contact dri-devel@lists.sf.net to add new cards to this list
 */
 #define radeon_PCI_IDS \
+       {0x1002, 0x3150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x3152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x3154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x3E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x3E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_NEW_MEMMAP}, \
        {0x1002, 0x4136, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|CHIP_IS_IGP}, \
        {0x1002, 0x4137, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|CHIP_IS_IGP}, \
        {0x1002, 0x4144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
        {0x1002, 0x4145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
        {0x1002, 0x4146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
        {0x1002, 0x4147, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
+       {0x1002, 0x4148, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
+       {0x1002, 0x4149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
+       {0x1002, 0x414A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
+       {0x1002, 0x414B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
        {0x1002, 0x4150, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
        {0x1002, 0x4151, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
        {0x1002, 0x4152, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
        {0x1002, 0x4153, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
        {0x1002, 0x4154, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
+       {0x1002, 0x4155, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
        {0x1002, 0x4156, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350}, \
-       {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS250|CHIP_IS_IGP}, \
+       {0x1002, 0x4237, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|CHIP_IS_IGP}, \
        {0x1002, 0x4242, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
        {0x1002, 0x4243, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
        {0x1002, 0x4336, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS100|CHIP_IS_IGP|CHIP_IS_MOBILITY}, \
        {0x1002, 0x4337, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|CHIP_IS_IGP|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS250|CHIP_IS_IGP|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x4964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250}, \
-       {0x1002, 0x4965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250}, \
-       {0x1002, 0x4966, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250}, \
-       {0x1002, 0x4967, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250}, \
+       {0x1002, 0x4437, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS200|CHIP_IS_IGP|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4966, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250}, \
+       {0x1002, 0x4967, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250}, \
+       {0x1002, 0x4A48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A4A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A4B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A4C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A4D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A4E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A4F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4A54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4B49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4B4A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4B4B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x4B4C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
        {0x1002, 0x4C57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV200|CHIP_IS_MOBILITY}, \
        {0x1002, 0x4C58, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV200|CHIP_IS_MOBILITY}, \
        {0x1002, 0x4C59, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100|CHIP_IS_MOBILITY}, \
        {0x1002, 0x4C5A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x4C65, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R250|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4C64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4C66, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4C67, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV250|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4E44, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
+       {0x1002, 0x4E45, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
+       {0x1002, 0x4E46, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
+       {0x1002, 0x4E47, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R300}, \
+       {0x1002, 0x4E48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
+       {0x1002, 0x4E49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
+       {0x1002, 0x4E4A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
+       {0x1002, 0x4E4B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R350}, \
        {0x1002, 0x4E50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4E51, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4E52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4E53, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4E54, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x4E56, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV350|CHIP_IS_MOBILITY}, \
        {0x1002, 0x5144, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \
        {0x1002, 0x5145, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \
        {0x1002, 0x5146, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \
        {0x1002, 0x5147, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R100|CHIP_SINGLE_CRTC}, \
        {0x1002, 0x5148, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x5149, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x514A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x514B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
        {0x1002, 0x514C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
        {0x1002, 0x514D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x514E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x514F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
        {0x1002, 0x5157, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV200}, \
        {0x1002, 0x5158, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV200}, \
        {0x1002, 0x5159, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
        {0x1002, 0x515A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
        {0x1002, 0x515E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
-       {0x1002, 0x5168, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x5169, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x516A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x516B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
-       {0x1002, 0x516C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R200}, \
+       {0x1002, 0x5460, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x5462, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x5464, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_IS_MOBILITY}, \
+       {0x1002, 0x5548, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5549, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x554A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x554B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x554C, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x554D, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x554E, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x554F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5550, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5551, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5552, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5554, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x564A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x564B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x564F, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5652, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5653, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
        {0x1002, 0x5834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP}, \
        {0x1002, 0x5835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x5836, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP}, \
-       {0x1002, 0x5837, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP}, \
        {0x1002, 0x5960, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
        {0x1002, 0x5961, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
        {0x1002, 0x5962, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
-       {0x1002, 0x5963, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
        {0x1002, 0x5964, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
-       {0x1002, 0x5968, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
+       {0x1002, 0x5965, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
        {0x1002, 0x5969, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV100}, \
-       {0x1002, 0x596A, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
-       {0x1002, 0x596B, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
+       {0x1002, 0x5b60, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5b62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5b63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5b64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5b65, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV380|CHIP_NEW_MEMMAP}, \
        {0x1002, 0x5c61, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x5c62, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
        {0x1002, 0x5c63, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280|CHIP_IS_MOBILITY}, \
-       {0x1002, 0x5c64, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV280}, \
+       {0x1002, 0x5d48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d49, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d4e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d50, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d52, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5d57, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_R420|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5e48, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5e4a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5e4b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5e4c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5e4d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x5e4f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RV410|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x7834, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP|CHIP_NEW_MEMMAP}, \
+       {0x1002, 0x7835, PCI_ANY_ID, PCI_ANY_ID, 0, 0, CHIP_RS300|CHIP_IS_IGP|CHIP_IS_MOBILITY|CHIP_NEW_MEMMAP}, \
        {0, 0, 0}
 
 #define r128_PCI_IDS \
        {0, 0, 0}
 
 #define mga_PCI_IDS \
-       {0x102b, 0x0521, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x102b, 0x0525, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x102b, 0x2527, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x102b, 0x0520, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MGA_CARD_TYPE_G200}, \
+       {0x102b, 0x0521, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MGA_CARD_TYPE_G200}, \
+       {0x102b, 0x0525, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MGA_CARD_TYPE_G400}, \
+       {0x102b, 0x2527, PCI_ANY_ID, PCI_ANY_ID, 0, 0, MGA_CARD_TYPE_G550}, \
        {0, 0, 0}
 
 #define mach64_PCI_IDS \
 
 #define viadrv_PCI_IDS \
        {0x1106, 0x3022, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x1106, 0x3118, PCI_ANY_ID, PCI_ANY_ID, 0, 0, VIA_PRO_GROUP_A}, \
        {0x1106, 0x3122, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x1106, 0x7205, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x1106, 0x7204, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x1106, 0x3108, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0, 0, 0}
 
 #define i810_PCI_IDS \
        {0, 0, 0}
 
 #define savage_PCI_IDS \
-       {0x5333, 0x8a22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8a23, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c11, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c13, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c24, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c2a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c2b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c2c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8c2f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8a25, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8d01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8d02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
-       {0x5333, 0x8d04, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x5333, 0x8a20, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \
+       {0x5333, 0x8a21, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE3D}, \
+       {0x5333, 0x8a22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE4}, \
+       {0x5333, 0x8a23, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE4}, \
+       {0x5333, 0x8c10, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE_MX}, \
+       {0x5333, 0x8c11, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE_MX}, \
+       {0x5333, 0x8c12, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE_MX}, \
+       {0x5333, 0x8c13, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SAVAGE_MX}, \
+       {0x5333, 0x8c22, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c24, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c2a, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c2b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c2c, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c2d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c2e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8c2f, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_SUPERSAVAGE}, \
+       {0x5333, 0x8a25, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGE}, \
+       {0x5333, 0x8a26, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGE}, \
+       {0x5333, 0x8d01, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_TWISTER}, \
+       {0x5333, 0x8d02, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_TWISTER}, \
+       {0x5333, 0x8d03, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGEDDR}, \
+       {0x5333, 0x8d04, PCI_ANY_ID, PCI_ANY_ID, 0, 0, S3_PROSAVAGEDDR}, \
        {0, 0, 0}
 
 #define ffb_PCI_IDS \
        {0x8086, 0x2582, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x2592, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0x8086, 0x2772, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
+       {0x8086, 0x27a2, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, \
        {0, 0, 0}
 
index 6e06e8c..362a270 100644 (file)
@@ -1,5 +1,5 @@
 /**
- * \file drm_proc.
+ * \file drm_proc.c
  * /proc support for DRM
  *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
 
 #include "drmP.h"
 
-static int        drm_name_info(char *buf, char **start, off_t offset,
-                                 int request, int *eof, void *data);
-static int        drm_vm_info(char *buf, char **start, off_t offset,
-                               int request, int *eof, void *data);
-static int        drm_clients_info(char *buf, char **start, off_t offset,
-                                    int request, int *eof, void *data);
-static int        drm_queues_info(char *buf, char **start, off_t offset,
-                                   int request, int *eof, void *data);
-static int        drm_bufs_info(char *buf, char **start, off_t offset,
-                                 int request, int *eof, void *data);
+static int drm_name_info(char *buf, char **start, off_t offset,
+                        int request, int *eof, void *data);
+static int drm_vm_info(char *buf, char **start, off_t offset,
+                      int request, int *eof, void *data);
+static int drm_clients_info(char *buf, char **start, off_t offset,
+                           int request, int *eof, void *data);
+static int drm_queues_info(char *buf, char **start, off_t offset,
+                          int request, int *eof, void *data);
+static int drm_bufs_info(char *buf, char **start, off_t offset,
+                        int request, int *eof, void *data);
 #if DRM_DEBUG_CODE
-static int        drm_vma_info(char *buf, char **start, off_t offset,
-                                int request, int *eof, void *data);
+static int drm_vma_info(char *buf, char **start, off_t offset,
+                       int request, int *eof, void *data);
 #endif
 
 /**
  * Proc file list.
  */
-struct drm_proc_list {
+static struct drm_proc_list {
        const char *name;       /**< file name */
-       int        (*f)(char *, char **, off_t, int, int *, void *);    /**< proc callback*/
+       int (*f) (char *, char **, off_t, int, int *, void *);          /**< proc callback*/
 } drm_proc_list[] = {
-       { "name",    drm_name_info    },
-       { "mem",     drm_mem_info     },
-       { "vm",      drm_vm_info      },
-       { "clients", drm_clients_info },
-       { "queues",  drm_queues_info  },
-       { "bufs",    drm_bufs_info    },
+       {"name", drm_name_info},
+       {"mem", drm_mem_info},
+       {"vm", drm_vm_info},
+       {"clients", drm_clients_info},
+       {"queues", drm_queues_info},
+       {"bufs", drm_bufs_info},
 #if DRM_DEBUG_CODE
-       { "vma",     drm_vma_info     },
+       {"vma", drm_vma_info},
 #endif
 };
+
 #define DRM_PROC_ENTRIES (sizeof(drm_proc_list)/sizeof(drm_proc_list[0]))
 
 /**
@@ -81,21 +82,20 @@ struct drm_proc_list {
  * \param root DRI proc dir entry.
  * \param dev_root resulting DRI device proc dir entry.
  * \return root entry pointer on success, or NULL on failure.
- * 
+ *
  * Create the DRI proc root entry "/proc/dri", the device proc root entry
  * "/proc/dri/%minor%/", and each entry in proc_list as
  * "/proc/dri/%minor%/%name%".
  */
-int drm_proc_init(drm_device_t *dev, int minor,
-                   struct proc_dir_entry *root,
-                   struct proc_dir_entry **dev_root)
+int drm_proc_init(drm_device_t * dev, int minor,
+                 struct proc_dir_entry *root, struct proc_dir_entry **dev_root)
 {
        struct proc_dir_entry *ent;
-       int                   i, j;
-       char                  name[64];
+       int i, j;
+       char name[64];
 
        sprintf(name, "%d", minor);
-       *dev_root = create_proc_entry(name, S_IFDIR, root);
+       *dev_root = proc_mkdir(name, root);
        if (!*dev_root) {
                DRM_ERROR("Cannot create /proc/dri/%s\n", name);
                return -1;
@@ -103,7 +103,7 @@ int drm_proc_init(drm_device_t *dev, int minor,
 
        for (i = 0; i < DRM_PROC_ENTRIES; i++) {
                ent = create_proc_entry(drm_proc_list[i].name,
-                                       S_IFREG|S_IRUGO, *dev_root);
+                                       S_IFREG | S_IRUGO, *dev_root);
                if (!ent) {
                        DRM_ERROR("Cannot create /proc/dri/%s/%s\n",
                                  name, drm_proc_list[i].name);
@@ -114,13 +114,12 @@ int drm_proc_init(drm_device_t *dev, int minor,
                        return -1;
                }
                ent->read_proc = drm_proc_list[i].f;
-               ent->data      = dev;
+               ent->data = dev;
        }
 
        return 0;
 }
 
-
 /**
  * Cleanup the proc filesystem resources.
  *
@@ -132,12 +131,13 @@ int drm_proc_init(drm_device_t *dev, int minor,
  * Remove all proc entries created by proc_init().
  */
 int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
-                     struct proc_dir_entry *dev_root)
+                    struct proc_dir_entry *dev_root)
 {
-       int  i;
+       int i;
        char name[64];
 
-       if (!root || !dev_root) return 0;
+       if (!root || !dev_root)
+               return 0;
 
        for (i = 0; i < DRM_PROC_ENTRIES; i++)
                remove_proc_entry(drm_proc_list[i].name, dev_root);
@@ -149,7 +149,7 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
 
 /**
  * Called when "/proc/dri/.../name" is read.
- * 
+ *
  * \param buf output buffer.
  * \param start start of output data.
  * \param offset requested start offset.
@@ -157,14 +157,14 @@ int drm_proc_cleanup(int minor, struct proc_dir_entry *root,
  * \param eof whether there is no more data to return.
  * \param data private data.
  * \return number of written bytes.
- * 
+ *
  * Prints the device name together with the bus id if available.
  */
 static int drm_name_info(char *buf, char **start, off_t offset, int request,
-                         int *eof, void *data)
+                        int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          len  = 0;
+       drm_device_t *dev = (drm_device_t *) data;
+       int len = 0;
 
        if (offset > DRM_PROC_LIMIT) {
                *eof = 1;
@@ -172,23 +172,26 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
        }
 
        *start = &buf[offset];
-       *eof   = 0;
+       *eof = 0;
 
        if (dev->unique) {
                DRM_PROC_PRINT("%s %s %s\n",
-                              dev->driver->pci_driver.name, pci_name(dev->pdev), dev->unique);
+                              dev->driver->pci_driver.name,
+                              pci_name(dev->pdev), dev->unique);
        } else {
-               DRM_PROC_PRINT("%s %s\n", dev->driver->pci_driver.name, pci_name(dev->pdev));
+               DRM_PROC_PRINT("%s %s\n", dev->driver->pci_driver.name,
+                              pci_name(dev->pdev));
        }
 
-       if (len > request + offset) return request;
+       if (len > request + offset)
+               return request;
        *eof = 1;
        return len - offset;
 }
 
 /**
  * Called when "/proc/dri/.../vm" is read.
- * 
+ *
  * \param buf output buffer.
  * \param start start of output data.
  * \param offset requested start offset.
@@ -196,24 +199,24 @@ static int drm_name_info(char *buf, char **start, off_t offset, int request,
  * \param eof whether there is no more data to return.
  * \param data private data.
  * \return number of written bytes.
- * 
+ *
  * Prints information about all mappings in drm_device::maplist.
  */
 static int drm__vm_info(char *buf, char **start, off_t offset, int request,
-                        int *eof, void *data)
+                       int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          len  = 0;
-       drm_map_t    *map;
+       drm_device_t *dev = (drm_device_t *) data;
+       int len = 0;
+       drm_map_t *map;
        drm_map_list_t *r_list;
        struct list_head *list;
 
-                               /* Hardcoded from _DRM_FRAME_BUFFER,
-                                   _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and
-                                   _DRM_SCATTER_GATHER. */
-       const char   *types[] = { "FB", "REG", "SHM", "AGP", "SG" };
-       const char   *type;
-       int          i;
+       /* Hardcoded from _DRM_FRAME_BUFFER,
+          _DRM_REGISTERS, _DRM_SHM, _DRM_AGP, and
+          _DRM_SCATTER_GATHER and _DRM_CONSISTENT */
+       const char *types[] = { "FB", "REG", "SHM", "AGP", "SG", "PCI" };
+       const char *type;
+       int i;
 
        if (offset > DRM_PROC_LIMIT) {
                *eof = 1;
@@ -221,55 +224,57 @@ static int drm__vm_info(char *buf, char **start, off_t offset, int request,
        }
 
        *start = &buf[offset];
-       *eof   = 0;
+       *eof = 0;
 
        DRM_PROC_PRINT("slot     offset       size type flags    "
                       "address mtrr\n\n");
        i = 0;
-       if (dev->maplist != NULL) list_for_each(list, &dev->maplist->head) {
+       if (dev->maplist != NULL)
+               list_for_each(list, &dev->maplist->head) {
                r_list = list_entry(list, drm_map_list_t, head);
                map = r_list->map;
-               if(!map) continue;
-               if (map->type < 0 || map->type > 4) type = "??";
-               else                                type = types[map->type];
-               DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s  0x%02x 0x%08lx ",
+               if (!map)
+                       continue;
+               if (map->type < 0 || map->type > 5)
+                       type = "??";
+               else
+                       type = types[map->type];
+               DRM_PROC_PRINT("%4d 0x%08lx 0x%08lx %4.4s  0x%02x 0x%08x ",
                               i,
                               map->offset,
-                              map->size,
-                              type,
-                              map->flags,
-                              (unsigned long)map->handle);
+                              map->size, type, map->flags, r_list->user_token);
                if (map->mtrr < 0) {
                        DRM_PROC_PRINT("none\n");
                } else {
                        DRM_PROC_PRINT("%4d\n", map->mtrr);
                }
                i++;
-       }
+               }
 
-       if (len > request + offset) return request;
+       if (len > request + offset)
+               return request;
        *eof = 1;
        return len - offset;
 }
 
 /**
- * Simply calls _vm_info() while holding the drm_device::struct_sem lock.
+ * Simply calls _vm_info() while holding the drm_device::struct_mutex lock.
  */
 static int drm_vm_info(char *buf, char **start, off_t offset, int request,
-                       int *eof, void *data)
+                      int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          ret;
+       drm_device_t *dev = (drm_device_t *) data;
+       int ret;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        ret = drm__vm_info(buf, start, offset, request, eof, data);
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
        return ret;
 }
 
 /**
  * Called when "/proc/dri/.../queues" is read.
- * 
+ *
  * \param buf output buffer.
  * \param start start of output data.
  * \param offset requested start offset.
@@ -279,12 +284,12 @@ static int drm_vm_info(char *buf, char **start, off_t offset, int request,
  * \return number of written bytes.
  */
 static int drm__queues_info(char *buf, char **start, off_t offset,
-                            int request, int *eof, void *data)
+                           int request, int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          len  = 0;
-       int          i;
-       drm_queue_t  *q;
+       drm_device_t *dev = (drm_device_t *) data;
+       int len = 0;
+       int i;
+       drm_queue_t *q;
 
        if (offset > DRM_PROC_LIMIT) {
                *eof = 1;
@@ -292,7 +297,7 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
        }
 
        *start = &buf[offset];
-       *eof   = 0;
+       *eof = 0;
 
        DRM_PROC_PRINT("  ctx/flags   use   fin"
                       "   blk/rw/rwf  wait    flushed     queued"
@@ -310,36 +315,39 @@ static int drm__queues_info(char *buf, char **start, off_t offset,
                                   atomic_read(&q->block_count),
                                   atomic_read(&q->block_read) ? 'r' : '-',
                                   atomic_read(&q->block_write) ? 'w' : '-',
-                                  waitqueue_active(&q->read_queue) ? 'r':'-',
-                                  waitqueue_active(&q->write_queue) ? 'w':'-',
-                                  waitqueue_active(&q->flush_queue) ? 'f':'-',
+                                  waitqueue_active(&q->read_queue) ? 'r' : '-',
+                                  waitqueue_active(&q->
+                                                   write_queue) ? 'w' : '-',
+                                  waitqueue_active(&q->
+                                                   flush_queue) ? 'f' : '-',
                                   DRM_BUFCOUNT(&q->waitlist));
                atomic_dec(&q->use_count);
        }
 
-       if (len > request + offset) return request;
+       if (len > request + offset)
+               return request;
        *eof = 1;
        return len - offset;
 }
 
 /**
- * Simply calls _queues_info() while holding the drm_device::struct_sem lock.
+ * Simply calls _queues_info() while holding the drm_device::struct_mutex lock.
  */
 static int drm_queues_info(char *buf, char **start, off_t offset, int request,
-                           int *eof, void *data)
+                          int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          ret;
+       drm_device_t *dev = (drm_device_t *) data;
+       int ret;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        ret = drm__queues_info(buf, start, offset, request, eof, data);
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
        return ret;
 }
 
 /**
  * Called when "/proc/dri/.../bufs" is read.
- * 
+ *
  * \param buf output buffer.
  * \param start start of output data.
  * \param offset requested start offset.
@@ -349,12 +357,12 @@ static int drm_queues_info(char *buf, char **start, off_t offset, int request,
  * \return number of written bytes.
  */
 static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
-                          int *eof, void *data)
+                         int *eof, void *data)
 {
-       drm_device_t     *dev = (drm_device_t *)data;
-       int              len  = 0;
+       drm_device_t *dev = (drm_device_t *) data;
+       int len = 0;
        drm_device_dma_t *dma = dev->dma;
-       int              i;
+       int i;
 
        if (!dma || offset > DRM_PROC_LIMIT) {
                *eof = 1;
@@ -362,7 +370,7 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
        }
 
        *start = &buf[offset];
-       *eof   = 0;
+       *eof = 0;
 
        DRM_PROC_PRINT(" o     size count  free  segs pages    kB\n\n");
        for (i = 0; i <= DRM_MAX_ORDER; i++) {
@@ -375,41 +383,43 @@ static int drm__bufs_info(char *buf, char **start, off_t offset, int request,
                                                   .freelist.count),
                                       dma->bufs[i].seg_count,
                                       dma->bufs[i].seg_count
-                                      *(1 << dma->bufs[i].page_order),
+                                      * (1 << dma->bufs[i].page_order),
                                       (dma->bufs[i].seg_count
                                        * (1 << dma->bufs[i].page_order))
                                       * PAGE_SIZE / 1024);
        }
        DRM_PROC_PRINT("\n");
        for (i = 0; i < dma->buf_count; i++) {
-               if (i && !(i%32)) DRM_PROC_PRINT("\n");
+               if (i && !(i % 32))
+                       DRM_PROC_PRINT("\n");
                DRM_PROC_PRINT(" %d", dma->buflist[i]->list);
        }
        DRM_PROC_PRINT("\n");
 
-       if (len > request + offset) return request;
+       if (len > request + offset)
+               return request;
        *eof = 1;
        return len - offset;
 }
 
 /**
- * Simply calls _bufs_info() while holding the drm_device::struct_sem lock.
+ * Simply calls _bufs_info() while holding the drm_device::struct_mutex lock.
  */
 static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
-                         int *eof, void *data)
+                        int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          ret;
+       drm_device_t *dev = (drm_device_t *) data;
+       int ret;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        ret = drm__bufs_info(buf, start, offset, request, eof, data);
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
        return ret;
 }
 
 /**
  * Called when "/proc/dri/.../clients" is read.
- * 
+ *
  * \param buf output buffer.
  * \param start start of output data.
  * \param offset requested start offset.
@@ -419,11 +429,11 @@ static int drm_bufs_info(char *buf, char **start, off_t offset, int request,
  * \return number of written bytes.
  */
 static int drm__clients_info(char *buf, char **start, off_t offset,
-                             int request, int *eof, void *data)
+                            int request, int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          len  = 0;
-       drm_file_t   *priv;
+       drm_device_t *dev = (drm_device_t *) data;
+       int len = 0;
+       drm_file_t *priv;
 
        if (offset > DRM_PROC_LIMIT) {
                *eof = 1;
@@ -431,7 +441,7 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
        }
 
        *start = &buf[offset];
-       *eof   = 0;
+       *eof = 0;
 
        DRM_PROC_PRINT("a dev   pid    uid      magic     ioctls\n\n");
        for (priv = dev->file_first; priv; priv = priv->next) {
@@ -439,42 +449,41 @@ static int drm__clients_info(char *buf, char **start, off_t offset,
                               priv->authenticated ? 'y' : 'n',
                               priv->minor,
                               priv->pid,
-                              priv->uid,
-                              priv->magic,
-                              priv->ioctl_count);
+                              priv->uid, priv->magic, priv->ioctl_count);
        }
 
-       if (len > request + offset) return request;
+       if (len > request + offset)
+               return request;
        *eof = 1;
        return len - offset;
 }
 
 /**
- * Simply calls _clients_info() while holding the drm_device::struct_sem lock.
+ * Simply calls _clients_info() while holding the drm_device::struct_mutex lock.
  */
 static int drm_clients_info(char *buf, char **start, off_t offset,
-                            int request, int *eof, void *data)
+                           int request, int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          ret;
+       drm_device_t *dev = (drm_device_t *) data;
+       int ret;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        ret = drm__clients_info(buf, start, offset, request, eof, data);
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
        return ret;
 }
 
 #if DRM_DEBUG_CODE
 
 static int drm__vma_info(char *buf, char **start, off_t offset, int request,
-                         int *eof, void *data)
+                        int *eof, void *data)
 {
-       drm_device_t          *dev = (drm_device_t *)data;
-       int                   len  = 0;
-       drm_vma_entry_t       *pt;
+       drm_device_t *dev = (drm_device_t *) data;
+       int len = 0;
+       drm_vma_entry_t *pt;
        struct vm_area_struct *vma;
 #if defined(__i386__)
-       unsigned int          pgprot;
+       unsigned int pgprot;
 #endif
 
        if (offset > DRM_PROC_LIMIT) {
@@ -483,57 +492,57 @@ static int drm__vma_info(char *buf, char **start, off_t offset, int request,
        }
 
        *start = &buf[offset];
-       *eof   = 0;
+       *eof = 0;
 
        DRM_PROC_PRINT("vma use count: %d, high_memory = %p, 0x%08lx\n",
                       atomic_read(&dev->vma_count),
                       high_memory, virt_to_phys(high_memory));
        for (pt = dev->vmalist; pt; pt = pt->next) {
-               if (!(vma = pt->vma)) continue;
+               if (!(vma = pt->vma))
+                       continue;
                DRM_PROC_PRINT("\n%5d 0x%08lx-0x%08lx %c%c%c%c%c%c 0x%08lx",
                               pt->pid,
                               vma->vm_start,
                               vma->vm_end,
-                              vma->vm_flags & VM_READ     ? 'r' : '-',
-                              vma->vm_flags & VM_WRITE    ? 'w' : '-',
-                              vma->vm_flags & VM_EXEC     ? 'x' : '-',
+                              vma->vm_flags & VM_READ ? 'r' : '-',
+                              vma->vm_flags & VM_WRITE ? 'w' : '-',
+                              vma->vm_flags & VM_EXEC ? 'x' : '-',
                               vma->vm_flags & VM_MAYSHARE ? 's' : 'p',
-                              vma->vm_flags & VM_LOCKED   ? 'l' : '-',
-                              vma->vm_flags & VM_IO       ? 'i' : '-',
+                              vma->vm_flags & VM_LOCKED ? 'l' : '-',
+                              vma->vm_flags & VM_IO ? 'i' : '-',
                               VM_OFFSET(vma));
 
 #if defined(__i386__)
                pgprot = pgprot_val(vma->vm_page_prot);
                DRM_PROC_PRINT(" %c%c%c%c%c%c%c%c%c",
-                              pgprot & _PAGE_PRESENT  ? 'p' : '-',
-                              pgprot & _PAGE_RW       ? 'w' : 'r',
-                              pgprot & _PAGE_USER     ? 'u' : 's',
-                              pgprot & _PAGE_PWT      ? 't' : 'b',
-                              pgprot & _PAGE_PCD      ? 'u' : 'c',
+                              pgprot & _PAGE_PRESENT ? 'p' : '-',
+                              pgprot & _PAGE_RW ? 'w' : 'r',
+                              pgprot & _PAGE_USER ? 'u' : 's',
+                              pgprot & _PAGE_PWT ? 't' : 'b',
+                              pgprot & _PAGE_PCD ? 'u' : 'c',
                               pgprot & _PAGE_ACCESSED ? 'a' : '-',
-                              pgprot & _PAGE_DIRTY    ? 'd' : '-',
-                              pgprot & _PAGE_PSE      ? 'm' : 'k',
-                              pgprot & _PAGE_GLOBAL   ? 'g' : 'l' );
+                              pgprot & _PAGE_DIRTY ? 'd' : '-',
+                              pgprot & _PAGE_PSE ? 'm' : 'k',
+                              pgprot & _PAGE_GLOBAL ? 'g' : 'l');
 #endif
                DRM_PROC_PRINT("\n");
        }
 
-       if (len > request + offset) return request;
+       if (len > request + offset)
+               return request;
        *eof = 1;
        return len - offset;
 }
 
 static int drm_vma_info(char *buf, char **start, off_t offset, int request,
-                        int *eof, void *data)
+                       int *eof, void *data)
 {
-       drm_device_t *dev = (drm_device_t *)data;
-       int          ret;
+       drm_device_t *dev = (drm_device_t *) data;
+       int ret;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        ret = drm__vma_info(buf, start, offset, request, eof, data);
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
        return ret;
 }
 #endif
-
-
index 8ccbdef..9a842a3 100644 (file)
 #include "drm_core.h"
 
 unsigned int drm_cards_limit = 16;     /* Enough for one machine */
-unsigned int drm_debug = 0;            /* 1 to enable debug output */
+unsigned int drm_debug = 0;    /* 1 to enable debug output */
 EXPORT_SYMBOL(drm_debug);
 
-MODULE_AUTHOR( CORE_AUTHOR );
-MODULE_DESCRIPTION( CORE_DESC );
+MODULE_AUTHOR(CORE_AUTHOR);
+MODULE_DESCRIPTION(CORE_DESC);
 MODULE_LICENSE("GPL and additional rights");
 MODULE_PARM_DESC(cards_limit, "Maximum number of graphics cards");
 MODULE_PARM_DESC(debug, "Enable debug output");
 
 module_param_named(cards_limit, drm_cards_limit, int, 0444);
-module_param_named(debug, drm_debug, int, 0666);
+module_param_named(debug, drm_debug, int, 0600);
 
 drm_head_t **drm_heads;
-struct drm_sysfs_class *drm_class;
+struct class *drm_class;
 struct proc_dir_entry *drm_proc_root;
 
-static int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct pci_device_id *ent, struct drm_driver *driver)
+static int drm_fill_in_dev(drm_device_t * dev, struct pci_dev *pdev,
+                          const struct pci_device_id *ent,
+                          struct drm_driver *driver)
 {
        int retcode;
 
        spin_lock_init(&dev->count_lock);
-       init_timer( &dev->timer );
-       sema_init( &dev->struct_sem, 1 );
-       sema_init( &dev->ctxlist_sem, 1 );
+       init_timer(&dev->timer);
+       mutex_init(&dev->struct_mutex);
+       mutex_init(&dev->ctxlist_mutex);
 
-       dev->pdev   = pdev;
+       dev->pdev = pdev;
 
 #ifdef __alpha__
-       dev->hose   = pdev->sysdata;
+       dev->hose = pdev->sysdata;
        dev->pci_domain = dev->hose->bus->number;
 #else
        dev->pci_domain = 0;
@@ -75,88 +77,114 @@ static int drm_fill_in_dev(drm_device_t *dev, struct pci_dev *pdev, const struct
        dev->pci_func = PCI_FUNC(pdev->devfn);
        dev->irq = pdev->irq;
 
+       dev->maplist = drm_calloc(1, sizeof(*dev->maplist), DRM_MEM_MAPS);
+       if (dev->maplist == NULL)
+               return -ENOMEM;
+       INIT_LIST_HEAD(&dev->maplist->head);
+
        /* the DRM has 6 basic counters */
        dev->counters = 6;
-       dev->types[0]  = _DRM_STAT_LOCK;
-       dev->types[1]  = _DRM_STAT_OPENS;
-       dev->types[2]  = _DRM_STAT_CLOSES;
-       dev->types[3]  = _DRM_STAT_IOCTLS;
-       dev->types[4]  = _DRM_STAT_LOCKS;
-       dev->types[5]  = _DRM_STAT_UNLOCKS;
+       dev->types[0] = _DRM_STAT_LOCK;
+       dev->types[1] = _DRM_STAT_OPENS;
+       dev->types[2] = _DRM_STAT_CLOSES;
+       dev->types[3] = _DRM_STAT_IOCTLS;
+       dev->types[4] = _DRM_STAT_LOCKS;
+       dev->types[5] = _DRM_STAT_UNLOCKS;
 
        dev->driver = driver;
-       
-       if (dev->driver->preinit)
-               if ((retcode = dev->driver->preinit(dev, ent->driver_data)))
+
+       if (dev->driver->load)
+               if ((retcode = dev->driver->load(dev, ent->driver_data)))
                        goto error_out_unreg;
 
        if (drm_core_has_AGP(dev)) {
-               dev->agp = drm_agp_init(dev);
-               if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP) && (dev->agp == NULL)) {
-                       DRM_ERROR( "Cannot initialize the agpgart module.\n" );
+               if (drm_device_is_agp(dev))
+                       dev->agp = drm_agp_init(dev);
+               if (drm_core_check_feature(dev, DRIVER_REQUIRE_AGP)
+                   && (dev->agp == NULL)) {
+                       DRM_ERROR("Cannot initialize the agpgart module.\n");
                        retcode = -EINVAL;
                        goto error_out_unreg;
                }
                if (drm_core_has_MTRR(dev)) {
                        if (dev->agp)
-                               dev->agp->agp_mtrr = mtrr_add( dev->agp->agp_info.aper_base,
-                                                              dev->agp->agp_info.aper_size*1024*1024,
-                                                              MTRR_TYPE_WRCOMB,
-                                                              1 );
+                               dev->agp->agp_mtrr =
+                                   mtrr_add(dev->agp->agp_info.aper_base,
+                                            dev->agp->agp_info.aper_size *
+                                            1024 * 1024, MTRR_TYPE_WRCOMB, 1);
                }
        }
 
-       retcode = drm_ctxbitmap_init( dev );
-       if( retcode ) {
-               DRM_ERROR( "Cannot allocate memory for context bitmap.\n" );
+       retcode = drm_ctxbitmap_init(dev);
+       if (retcode) {
+               DRM_ERROR("Cannot allocate memory for context bitmap.\n");
                goto error_out_unreg;
        }
 
        return 0;
-       
-error_out_unreg:
-       drm_takedown(dev);
+
+      error_out_unreg:
+       drm_lastclose(dev);
        return retcode;
 }
 
+
 /**
- * File \c open operation.
+ * Get a secondary minor number.
  *
- * \param inode device inode.
- * \param filp file pointer.
+ * \param dev device data structure
+ * \param sec-minor structure to hold the assigned minor
+ * \return negative number on failure.
  *
- * Puts the dev->fops corresponding to the device minor number into
- * \p filp, call the \c open method, and restore the file operations.
+ * Search an empty entry and initialize it to the given parameters, and
+ * create the proc init entry via proc_init(). This routines assigns
+ * minor numbers to secondary heads of multi-headed cards
  */
-int drm_stub_open(struct inode *inode, struct file *filp)
+static int drm_get_head(drm_device_t * dev, drm_head_t * head)
 {
-       drm_device_t *dev = NULL;
-       int minor = iminor(inode);
-       int err = -ENODEV;
-       struct file_operations *old_fops;
-       
+       drm_head_t **heads = drm_heads;
+       int ret;
+       int minor;
+
        DRM_DEBUG("\n");
 
-       if (!((minor >= 0) && (minor < drm_cards_limit)))
-               return -ENODEV;
+       for (minor = 0; minor < drm_cards_limit; minor++, heads++) {
+               if (!*heads) {
 
-       if (!drm_heads[minor])
-               return -ENODEV;
-       
-       if (!(dev = drm_heads[minor]->dev))
-               return -ENODEV;
-
-       old_fops = filp->f_op;
-       filp->f_op = fops_get(&dev->driver->fops);
-       if (filp->f_op->open && (err = filp->f_op->open(inode, filp))) {
-               fops_put(filp->f_op);
-               filp->f_op = fops_get(old_fops);
-       }
-       fops_put(old_fops);
+                       *head = (drm_head_t) {
+                       .dev = dev,.device =
+                                   MKDEV(DRM_MAJOR, minor),.minor = minor,};
+
+                       if ((ret =
+                            drm_proc_init(dev, minor, drm_proc_root,
+                                          &head->dev_root))) {
+                               printk(KERN_ERR
+                                      "DRM: Failed to initialize /proc/dri.\n");
+                               goto err_g1;
+                       }
 
-       return err;
-}
+                       head->dev_class = drm_sysfs_device_add(drm_class, head);
+                       if (IS_ERR(head->dev_class)) {
+                               printk(KERN_ERR
+                                      "DRM: Error sysfs_device_add.\n");
+                               ret = PTR_ERR(head->dev_class);
+                               goto err_g2;
+                       }
+                       *heads = head;
 
+                       DRM_DEBUG("new minor assigned %d\n", minor);
+                       return 0;
+               }
+       }
+       DRM_ERROR("out of minors\n");
+       return -ENOMEM;
+      err_g2:
+       drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
+      err_g1:
+       *head = (drm_head_t) {
+       .dev = NULL};
+       return ret;
+}
 
 /**
  * Register.
@@ -170,7 +198,7 @@ int drm_stub_open(struct inode *inode, struct file *filp)
  * Try and register, if we fail to register, backout previous work.
  */
 int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
-             struct drm_driver *driver)
+               struct drm_driver *driver)
 {
        drm_device_t *dev;
        int ret;
@@ -189,79 +217,17 @@ int drm_get_dev(struct pci_dev *pdev, const struct pci_device_id *ent,
        }
        if ((ret = drm_get_head(dev, &dev->primary)))
                goto err_g1;
-
-       /* postinit is a required function to display the signon banner */
-       /* drivers add secondary heads here if needed */
-       if ((ret = dev->driver->postinit(dev, ent->driver_data)))
-               goto err_g1;
+       
+       DRM_INFO("Initialized %s %d.%d.%d %s on minor %d\n",
+                driver->name, driver->major, driver->minor, driver->patchlevel,
+                driver->date, dev->primary.minor);
 
        return 0;
 
-err_g1:
+      err_g1:
        drm_free(dev, sizeof(*dev), DRM_MEM_STUB);
        return ret;
 }
-EXPORT_SYMBOL(drm_get_dev);
-
-/**
- * Get a secondary minor number.
- *
- * \param dev device data structure
- * \param sec-minor structure to hold the assigned minor
- * \return negative number on failure.
- *
- * Search an empty entry and initialize it to the given parameters, and
- * create the proc init entry via proc_init(). This routines assigns
- * minor numbers to secondary heads of multi-headed cards
- */
-int drm_get_head(drm_device_t *dev, drm_head_t *head)
-{
-       drm_head_t **heads = drm_heads;
-       int ret;
-       int minor;
-
-       DRM_DEBUG("\n");
-
-       for (minor = 0; minor < drm_cards_limit; minor++, heads++) {
-               if (!*heads) {
-                       
-                       *head = (drm_head_t) {
-                               .dev = dev,
-                               .device = MKDEV(DRM_MAJOR, minor),
-                               .minor = minor,
-                       };
-                       
-                       if ((ret = drm_proc_init(dev, minor, drm_proc_root, &head->dev_root))) {
-                               printk (KERN_ERR "DRM: Failed to initialize /proc/dri.\n");
-                               goto err_g1;
-                       }
-
-                       
-                       head->dev_class = drm_sysfs_device_add(drm_class,
-                                                              MKDEV(DRM_MAJOR,
-                                                                    minor),
-                                                              &dev->pdev->dev,
-                                                              "card%d", minor);
-                       if (IS_ERR(head->dev_class)) {
-                               printk(KERN_ERR "DRM: Error sysfs_device_add.\n");
-                               ret = PTR_ERR(head->dev_class);
-                               goto err_g2;
-                       }
-                       *heads = head;
-
-                       DRM_DEBUG("new minor assigned %d\n", minor);
-                       return 0;
-               }
-       }
-       DRM_ERROR("out of minors\n");
-       return -ENOMEM;
-err_g2:
-       drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
-err_g1:
-       *head = (drm_head_t) {.dev = NULL};
-       return ret;
-}
-               
 
 /**
  * Put a device minor number.
@@ -301,19 +267,18 @@ int drm_put_dev(drm_device_t * dev)
  * last minor released.
  *
  */
-int drm_put_head(drm_head_t *head)
+int drm_put_head(drm_head_t * head)
 {
        int minor = head->minor;
-       
+
        DRM_DEBUG("release secondary minor %d\n", minor);
-       
+
        drm_proc_cleanup(minor, drm_proc_root, head->dev_root);
-       drm_sysfs_device_remove(MKDEV(DRM_MAJOR, head->minor));
-       
-       *head = (drm_head_t){.dev = NULL};
+       drm_sysfs_device_remove(head->dev_class);
+
+       *head = (drm_head_t) {.dev = NULL};
 
        drm_heads[minor] = NULL;
-       
+
        return 0;
 }
-
index fc72f30..ffd0800 100644 (file)
@@ -1,7 +1,7 @@
 /**
- * \file drm_vm.h
+ * \file drm_vm.c
  * Memory mapping for DRM
- * 
+ *
  * \author Rickard E. (Rik) Faith <faith@valinux.com>
  * \author Gareth Hughes <gareth@valinux.com>
  */
@@ -38,6 +38,8 @@
 #include <linux/efi.h>
 #endif
 
+static void drm_vm_open(struct vm_area_struct *vma);
+static void drm_vm_close(struct vm_area_struct *vma);
 
 /**
  * \c nopage method for AGP virtual memory.
  * \param vma virtual memory area.
  * \param address access address.
  * \return pointer to the page structure.
- * 
+ *
  * Find the right map and if it's AGP memory find the real physical page to
  * map, get the page, increment the use count and return it.
  */
 #if __OS_HAS_AGP
 static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
-                                                unsigned long address)
+                                               unsigned long address)
 {
-       drm_file_t *priv  = vma->vm_file->private_data;
+       drm_file_t *priv = vma->vm_file->private_data;
        drm_device_t *dev = priv->head->dev;
-       drm_map_t *map    = NULL;
-       drm_map_list_t  *r_list;
+       drm_map_t *map = NULL;
+       drm_map_list_t *r_list;
        struct list_head *list;
 
        /*
-         * Find the right map
-         */
+        * Find the right map
+        */
        if (!drm_core_has_AGP(dev))
                goto vm_nopage_error;
 
-       if(!dev->agp || !dev->agp->cant_use_aperture) goto vm_nopage_error;
+       if (!dev->agp || !dev->agp->cant_use_aperture)
+               goto vm_nopage_error;
 
        list_for_each(list, &dev->maplist->head) {
                r_list = list_entry(list, drm_map_list_t, head);
                map = r_list->map;
-               if (!map) continue;
-               if (map->offset == VM_OFFSET(vma)) break;
+               if (!map)
+                       continue;
+               if (r_list->user_token == VM_OFFSET(vma))
+                       break;
        }
 
        if (map && map->type == _DRM_AGP) {
                unsigned long offset = address - vma->vm_start;
-               unsigned long baddr = VM_OFFSET(vma) + offset;
+               unsigned long baddr = map->offset + offset;
                struct drm_agp_mem *agpmem;
                struct page *page;
 
 #ifdef __alpha__
                /*
-                 * Adjust to a bus-relative address
-                 */
+                * Adjust to a bus-relative address
+                */
                baddr -= dev->hose->mem_space->start;
 #endif
 
                /*
-                 * It's AGP memory - find the real physical page to map
-                 */
-               for(agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) {
+                * It's AGP memory - find the real physical page to map
+                */
+               for (agpmem = dev->agp->memory; agpmem; agpmem = agpmem->next) {
                        if (agpmem->bound <= baddr &&
-                           agpmem->bound + agpmem->pages * PAGE_SIZE > baddr) 
+                           agpmem->bound + agpmem->pages * PAGE_SIZE > baddr)
                                break;
                }
 
-               if (!agpmem) goto vm_nopage_error;
+               if (!agpmem)
+                       goto vm_nopage_error;
 
                /*
-                 * Get the page, inc the use count, and return it
-                 */
+                * Get the page, inc the use count, and return it
+                */
                offset = (baddr - agpmem->bound) >> PAGE_SHIFT;
                page = virt_to_page(__va(agpmem->memory->memory[offset]));
                get_page(page);
 
-               DRM_DEBUG("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n",
-                         baddr, __va(agpmem->memory->memory[offset]), offset,
-                         page_count(page));
+               DRM_DEBUG
+                   ("baddr = 0x%lx page = 0x%p, offset = 0x%lx, count=%d\n",
+                    baddr, __va(agpmem->memory->memory[offset]), offset,
+                    page_count(page));
 
                return page;
-        }
-vm_nopage_error:
-       return NOPAGE_SIGBUS;           /* Disallow mremap */
+       }
+      vm_nopage_error:
+       return NOPAGE_SIGBUS;   /* Disallow mremap */
 }
-#else /* __OS_HAS_AGP */
+#else                          /* __OS_HAS_AGP */
 static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
-                                                unsigned long address)
+                                               unsigned long address)
 {
        return NOPAGE_SIGBUS;
 }
-#endif /* __OS_HAS_AGP */
+#endif                         /* __OS_HAS_AGP */
 
 /**
  * \c nopage method for shared virtual memory.
@@ -128,24 +135,27 @@ static __inline__ struct page *drm_do_vm_nopage(struct vm_area_struct *vma,
  * \param vma virtual memory area.
  * \param address access address.
  * \return pointer to the page structure.
- * 
+ *
  * Get the the mapping, find the real physical page to map, get the page, and
  * return it.
  */
 static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
-                                                    unsigned long address)
+                                                   unsigned long address)
 {
-       drm_map_t        *map    = (drm_map_t *)vma->vm_private_data;
-       unsigned long    offset;
-       unsigned long    i;
-       struct page      *page;
+       drm_map_t *map = (drm_map_t *) vma->vm_private_data;
+       unsigned long offset;
+       unsigned long i;
+       struct page *page;
 
-       if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
-       if (!map)                  return NOPAGE_OOM;  /* Nothing allocated */
+       if (address > vma->vm_end)
+               return NOPAGE_SIGBUS;   /* Disallow mremap */
+       if (!map)
+               return NOPAGE_OOM;      /* Nothing allocated */
 
-       offset   = address - vma->vm_start;
+       offset = address - vma->vm_start;
        i = (unsigned long)map->handle + offset;
-       page = vmalloc_to_page((void *)i);
+       page = (map->type == _DRM_CONSISTENT) ?
+               virt_to_page((void *)i) : vmalloc_to_page((void *)i);
        if (!page)
                return NOPAGE_OOM;
        get_page(page);
@@ -154,19 +164,18 @@ static __inline__ struct page *drm_do_vm_shm_nopage(struct vm_area_struct *vma,
        return page;
 }
 
-
 /**
  * \c close method for shared virtual memory.
- * 
+ *
  * \param vma virtual memory area.
- * 
+ *
  * Deletes map information if we are the last
  * person to close a mapping and it's not in the global maplist.
  */
-void drm_vm_shm_close(struct vm_area_struct *vma)
+static void drm_vm_shm_close(struct vm_area_struct *vma)
 {
-       drm_file_t      *priv   = vma->vm_file->private_data;
-       drm_device_t    *dev    = priv->head->dev;
+       drm_file_t *priv = vma->vm_file->private_data;
+       drm_device_t *dev = priv->head->dev;
        drm_vma_entry_t *pt, *prev, *next;
        drm_map_t *map;
        drm_map_list_t *r_list;
@@ -179,10 +188,11 @@ void drm_vm_shm_close(struct vm_area_struct *vma)
 
        map = vma->vm_private_data;
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        for (pt = dev->vmalist, prev = NULL; pt; pt = next) {
                next = pt->next;
-               if (pt->vma->vm_private_data == map) found_maps++;
+               if (pt->vma->vm_private_data == map)
+                       found_maps++;
                if (pt->vma == vma) {
                        if (prev) {
                                prev->next = pt->next;
@@ -195,8 +205,7 @@ void drm_vm_shm_close(struct vm_area_struct *vma)
                }
        }
        /* We were the only map that was found */
-       if(found_maps == 1 &&
-          map->flags & _DRM_REMOVABLE) {
+       if (found_maps == 1 && map->flags & _DRM_REMOVABLE) {
                /* Check to see if we are in the maplist, if we are not, then
                 * we delete this mappings information.
                 */
@@ -204,10 +213,13 @@ void drm_vm_shm_close(struct vm_area_struct *vma)
                list = &dev->maplist->head;
                list_for_each(list, &dev->maplist->head) {
                        r_list = list_entry(list, drm_map_list_t, head);
-                       if (r_list->map == map) found_maps++;
+                       if (r_list->map == map)
+                               found_maps++;
                }
 
-               if(!found_maps) {
+               if (!found_maps) {
+                       drm_dma_handle_t dmah;
+
                        switch (map->type) {
                        case _DRM_REGISTERS:
                        case _DRM_FRAME_BUFFER:
@@ -226,11 +238,17 @@ void drm_vm_shm_close(struct vm_area_struct *vma)
                        case _DRM_AGP:
                        case _DRM_SCATTER_GATHER:
                                break;
+                       case _DRM_CONSISTENT:
+                               dmah.vaddr = map->handle;
+                               dmah.busaddr = map->offset;
+                               dmah.size = map->size;
+                               __drm_pci_free(dev, &dmah);
+                               break;
                        }
                        drm_free(map, sizeof(*map), DRM_MEM_MAPS);
                }
        }
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
 }
 
 /**
@@ -239,27 +257,29 @@ void drm_vm_shm_close(struct vm_area_struct *vma)
  * \param vma virtual memory area.
  * \param address access address.
  * \return pointer to the page structure.
- * 
+ *
  * Determine the page number from the page offset and get it from drm_device_dma::pagelist.
  */
 static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
-                                                    unsigned long address)
+                                                   unsigned long address)
 {
-       drm_file_t       *priv   = vma->vm_file->private_data;
-       drm_device_t     *dev    = priv->head->dev;
-       drm_device_dma_t *dma    = dev->dma;
-       unsigned long    offset;
-       unsigned long    page_nr;
-       struct page      *page;
-
-       if (!dma)                  return NOPAGE_SIGBUS; /* Error */
-       if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
-       if (!dma->pagelist)        return NOPAGE_OOM ; /* Nothing allocated */
-
-       offset   = address - vma->vm_start; /* vm_[pg]off[set] should be 0 */
-       page_nr  = offset >> PAGE_SHIFT;
-       page = virt_to_page((dma->pagelist[page_nr] + 
-                            (offset & (~PAGE_MASK))));
+       drm_file_t *priv = vma->vm_file->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_device_dma_t *dma = dev->dma;
+       unsigned long offset;
+       unsigned long page_nr;
+       struct page *page;
+
+       if (!dma)
+               return NOPAGE_SIGBUS;   /* Error */
+       if (address > vma->vm_end)
+               return NOPAGE_SIGBUS;   /* Disallow mremap */
+       if (!dma->pagelist)
+               return NOPAGE_OOM;      /* Nothing allocated */
+
+       offset = address - vma->vm_start;       /* vm_[pg]off[set] should be 0 */
+       page_nr = offset >> PAGE_SHIFT;
+       page = virt_to_page((dma->pagelist[page_nr] + (offset & (~PAGE_MASK))));
 
        get_page(page);
 
@@ -273,13 +293,13 @@ static __inline__ struct page *drm_do_vm_dma_nopage(struct vm_area_struct *vma,
  * \param vma virtual memory area.
  * \param address access address.
  * \return pointer to the page structure.
- * 
+ *
  * Determine the map offset from the page offset and get it from drm_sg_mem::pagelist.
  */
 static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
-                                                   unsigned long address)
+                                                  unsigned long address)
 {
-       drm_map_t        *map    = (drm_map_t *)vma->vm_private_data;
+       drm_map_t *map = (drm_map_t *) vma->vm_private_data;
        drm_file_t *priv = vma->vm_file->private_data;
        drm_device_t *dev = priv->head->dev;
        drm_sg_mem_t *entry = dev->sg;
@@ -288,13 +308,15 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
        unsigned long page_offset;
        struct page *page;
 
-       if (!entry)                return NOPAGE_SIGBUS; /* Error */
-       if (address > vma->vm_end) return NOPAGE_SIGBUS; /* Disallow mremap */
-       if (!entry->pagelist)      return NOPAGE_OOM ;  /* Nothing allocated */
-
+       if (!entry)
+               return NOPAGE_SIGBUS;   /* Error */
+       if (address > vma->vm_end)
+               return NOPAGE_SIGBUS;   /* Disallow mremap */
+       if (!entry->pagelist)
+               return NOPAGE_OOM;      /* Nothing allocated */
 
        offset = address - vma->vm_start;
-       map_offset = map->offset - dev->sg->handle;
+       map_offset = map->offset - (unsigned long)dev->sg->virtual;
        page_offset = (offset >> PAGE_SHIFT) + (map_offset >> PAGE_SHIFT);
        page = entry->pagelist[page_offset];
        get_page(page);
@@ -302,107 +324,78 @@ static __inline__ struct page *drm_do_vm_sg_nopage(struct vm_area_struct *vma,
        return page;
 }
 
-
-#if LINUX_VERSION_CODE > KERNEL_VERSION(2,6,0)
-
 static struct page *drm_vm_nopage(struct vm_area_struct *vma,
-                                  unsigned long address,
-                                  int *type) {
-       if (type) *type = VM_FAULT_MINOR;
-       return drm_do_vm_nopage(vma, address);
-}
-
-static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
-                                      unsigned long address,
-                                      int *type) {
-       if (type) *type = VM_FAULT_MINOR;
-       return drm_do_vm_shm_nopage(vma, address);
-}
-
-static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
-                                      unsigned long address,
-                                      int *type) {
-       if (type) *type = VM_FAULT_MINOR;
-       return drm_do_vm_dma_nopage(vma, address);
-}
-
-static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma,
-                                     unsigned long address,
-                                     int *type) {
-       if (type) *type = VM_FAULT_MINOR;
-       return drm_do_vm_sg_nopage(vma, address);
-}
-
-#else  /* LINUX_VERSION_CODE <= KERNEL_VERSION(2,6,0) */
-
-static struct page *drm_vm_nopage(struct vm_area_struct *vma,
-                                  unsigned long address,
-                                  int unused) {
+                                 unsigned long address, int *type)
+{
+       if (type)
+               *type = VM_FAULT_MINOR;
        return drm_do_vm_nopage(vma, address);
 }
 
 static struct page *drm_vm_shm_nopage(struct vm_area_struct *vma,
-                                      unsigned long address,
-                                      int unused) {
+                                     unsigned long address, int *type)
+{
+       if (type)
+               *type = VM_FAULT_MINOR;
        return drm_do_vm_shm_nopage(vma, address);
 }
 
 static struct page *drm_vm_dma_nopage(struct vm_area_struct *vma,
-                                      unsigned long address,
-                                      int unused) {
+                                     unsigned long address, int *type)
+{
+       if (type)
+               *type = VM_FAULT_MINOR;
        return drm_do_vm_dma_nopage(vma, address);
 }
 
 static struct page *drm_vm_sg_nopage(struct vm_area_struct *vma,
-                                     unsigned long address,
-                                     int unused) {
+                                    unsigned long address, int *type)
+{
+       if (type)
+               *type = VM_FAULT_MINOR;
        return drm_do_vm_sg_nopage(vma, address);
 }
 
-#endif
-
-
 /** AGP virtual memory operations */
-static struct vm_operations_struct   drm_vm_ops = {
+static struct vm_operations_struct drm_vm_ops = {
        .nopage = drm_vm_nopage,
-       .open   = drm_vm_open,
-       .close  = drm_vm_close,
+       .open = drm_vm_open,
+       .close = drm_vm_close,
 };
 
 /** Shared virtual memory operations */
-static struct vm_operations_struct   drm_vm_shm_ops = {
+static struct vm_operations_struct drm_vm_shm_ops = {
        .nopage = drm_vm_shm_nopage,
-       .open   = drm_vm_open,
-       .close  = drm_vm_shm_close,
+       .open = drm_vm_open,
+       .close = drm_vm_shm_close,
 };
 
 /** DMA virtual memory operations */
-static struct vm_operations_struct   drm_vm_dma_ops = {
+static struct vm_operations_struct drm_vm_dma_ops = {
        .nopage = drm_vm_dma_nopage,
-       .open   = drm_vm_open,
-       .close  = drm_vm_close,
+       .open = drm_vm_open,
+       .close = drm_vm_close,
 };
 
 /** Scatter-gather virtual memory operations */
-static struct vm_operations_struct   drm_vm_sg_ops = {
+static struct vm_operations_struct drm_vm_sg_ops = {
        .nopage = drm_vm_sg_nopage,
-       .open   = drm_vm_open,
-       .close  = drm_vm_close,
+       .open = drm_vm_open,
+       .close = drm_vm_close,
 };
 
-
 /**
  * \c open method for shared virtual memory.
- * 
+ *
  * \param vma virtual memory area.
- * 
+ *
  * Create a new drm_vma_entry structure as the \p vma private data entry and
  * add it to drm_device::vmalist.
  */
-void drm_vm_open(struct vm_area_struct *vma)
+static void drm_vm_open(struct vm_area_struct *vma)
 {
-       drm_file_t      *priv   = vma->vm_file->private_data;
-       drm_device_t    *dev    = priv->head->dev;
+       drm_file_t *priv = vma->vm_file->private_data;
+       drm_device_t *dev = priv->head->dev;
        drm_vma_entry_t *vma_entry;
 
        DRM_DEBUG("0x%08lx,0x%08lx\n",
@@ -411,34 +404,34 @@ void drm_vm_open(struct vm_area_struct *vma)
 
        vma_entry = drm_alloc(sizeof(*vma_entry), DRM_MEM_VMAS);
        if (vma_entry) {
-               down(&dev->struct_sem);
-               vma_entry->vma  = vma;
+               mutex_lock(&dev->struct_mutex);
+               vma_entry->vma = vma;
                vma_entry->next = dev->vmalist;
-               vma_entry->pid  = current->pid;
-               dev->vmalist    = vma_entry;
-               up(&dev->struct_sem);
+               vma_entry->pid = current->pid;
+               dev->vmalist = vma_entry;
+               mutex_unlock(&dev->struct_mutex);
        }
 }
 
 /**
  * \c close method for all virtual memory types.
- * 
+ *
  * \param vma virtual memory area.
- * 
+ *
  * Search the \p vma private data entry in drm_device::vmalist, unlink it, and
  * free it.
  */
-void drm_vm_close(struct vm_area_struct *vma)
+static void drm_vm_close(struct vm_area_struct *vma)
 {
-       drm_file_t      *priv   = vma->vm_file->private_data;
-       drm_device_t    *dev    = priv->head->dev;
+       drm_file_t *priv = vma->vm_file->private_data;
+       drm_device_t *dev = priv->head->dev;
        drm_vma_entry_t *pt, *prev;
 
        DRM_DEBUG("0x%08lx,0x%08lx\n",
                  vma->vm_start, vma->vm_end - vma->vm_start);
        atomic_dec(&dev->vma_count);
 
-       down(&dev->struct_sem);
+       mutex_lock(&dev->struct_mutex);
        for (pt = dev->vmalist, prev = NULL; pt; prev = pt, pt = pt->next) {
                if (pt->vma == vma) {
                        if (prev) {
@@ -450,7 +443,7 @@ void drm_vm_close(struct vm_area_struct *vma)
                        break;
                }
        }
-       up(&dev->struct_sem);
+       mutex_unlock(&dev->struct_mutex);
 }
 
 /**
@@ -459,47 +452,44 @@ void drm_vm_close(struct vm_area_struct *vma)
  * \param filp file pointer.
  * \param vma virtual memory area.
  * \return zero on success or a negative number on failure.
- * 
+ *
  * Sets the virtual memory area operations structure to vm_dma_ops, the file
  * pointer, and calls vm_open().
  */
-int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
+static int drm_mmap_dma(struct file *filp, struct vm_area_struct *vma)
 {
-       drm_file_t       *priv   = filp->private_data;
-       drm_device_t     *dev;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev;
        drm_device_dma_t *dma;
-       unsigned long    length  = vma->vm_end - vma->vm_start;
+       unsigned long length = vma->vm_end - vma->vm_start;
 
        lock_kernel();
-       dev      = priv->head->dev;
-       dma      = dev->dma;
+       dev = priv->head->dev;
+       dma = dev->dma;
        DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
                  vma->vm_start, vma->vm_end, VM_OFFSET(vma));
 
-                               /* Length must match exact page count */
+       /* Length must match exact page count */
        if (!dma || (length >> PAGE_SHIFT) != dma->page_count) {
                unlock_kernel();
                return -EINVAL;
        }
        unlock_kernel();
 
-       vma->vm_ops   = &drm_vm_dma_ops;
+       vma->vm_ops = &drm_vm_dma_ops;
 
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
-       vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
-#else
-       vma->vm_flags |= VM_RESERVED; /* Don't swap */
-#endif
+       vma->vm_flags |= VM_RESERVED;   /* Don't swap */
 
-       vma->vm_file  =  filp;  /* Needed for drm_vm_open() */
+       vma->vm_file = filp;    /* Needed for drm_vm_open() */
        drm_vm_open(vma);
        return 0;
 }
 
-unsigned long drm_core_get_map_ofs(drm_map_t *map)
+unsigned long drm_core_get_map_ofs(drm_map_t * map)
 {
        return map->offset;
 }
+
 EXPORT_SYMBOL(drm_core_get_map_ofs);
 
 unsigned long drm_core_get_reg_ofs(struct drm_device *dev)
@@ -510,6 +500,7 @@ unsigned long drm_core_get_reg_ofs(struct drm_device *dev)
        return 0;
 #endif
 }
+
 EXPORT_SYMBOL(drm_core_get_reg_ofs);
 
 /**
@@ -518,7 +509,7 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
  * \param filp file pointer.
  * \param vma virtual memory area.
  * \return zero on success or a negative number on failure.
- * 
+ *
  * If the virtual memory area has no offset associated with it then it's a DMA
  * area, so calls mmap_dma(). Otherwise searches the map in drm_device::maplist,
  * checks that the restricted flag is not set, sets the virtual memory operations
@@ -527,17 +518,18 @@ EXPORT_SYMBOL(drm_core_get_reg_ofs);
  */
 int drm_mmap(struct file *filp, struct vm_area_struct *vma)
 {
-       drm_file_t      *priv   = filp->private_data;
-       drm_device_t    *dev    = priv->head->dev;
-       drm_map_t       *map    = NULL;
-       drm_map_list_t  *r_list;
-       unsigned long   offset  = 0;
+       drm_file_t *priv = filp->private_data;
+       drm_device_t *dev = priv->head->dev;
+       drm_map_t *map = NULL;
+       drm_map_list_t *r_list;
+       unsigned long offset = 0;
        struct list_head *list;
 
        DRM_DEBUG("start = 0x%lx, end = 0x%lx, offset = 0x%lx\n",
                  vma->vm_start, vma->vm_end, VM_OFFSET(vma));
 
-       if ( !priv->authenticated ) return -EACCES;
+       if (!priv->authenticated)
+               return -EACCES;
 
        /* We check for "dma". On Apple's UniNorth, it's valid to have
         * the AGP mapped at physical address 0
@@ -545,134 +537,129 @@ int drm_mmap(struct file *filp, struct vm_area_struct *vma)
         */
        if (!VM_OFFSET(vma)
 #if __OS_HAS_AGP
-           && (!dev->agp || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
+           && (!dev->agp
+               || dev->agp->agp_info.device->vendor != PCI_VENDOR_ID_APPLE)
 #endif
            )
                return drm_mmap_dma(filp, vma);
 
-                               /* A sequential search of a linked list is
-                                  fine here because: 1) there will only be
-                                  about 5-10 entries in the list and, 2) a
-                                  DRI client only has to do this mapping
-                                  once, so it doesn't have to be optimized
-                                  for performance, even if the list was a
-                                  bit longer. */
+       /* A sequential search of a linked list is
+          fine here because: 1) there will only be
+          about 5-10 entries in the list and, 2) a
+          DRI client only has to do this mapping
+          once, so it doesn't have to be optimized
+          for performance, even if the list was a
+          bit longer. */
        list_for_each(list, &dev->maplist->head) {
-               unsigned long off;
 
                r_list = list_entry(list, drm_map_list_t, head);
                map = r_list->map;
-               if (!map) continue;
-               off = dev->driver->get_map_ofs(map);
-               if (off == VM_OFFSET(vma)) break;
+               if (!map)
+                       continue;
+               if (r_list->user_token == VM_OFFSET(vma))
+                       break;
        }
 
-       if (!map || ((map->flags&_DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
+       if (!map || ((map->flags & _DRM_RESTRICTED) && !capable(CAP_SYS_ADMIN)))
                return -EPERM;
 
-                               /* Check for valid size. */
-       if (map->size != vma->vm_end - vma->vm_start) return -EINVAL;
+       /* Check for valid size. */
+       if (map->size != vma->vm_end - vma->vm_start)
+               return -EINVAL;
 
        if (!capable(CAP_SYS_ADMIN) && (map->flags & _DRM_READ_ONLY)) {
                vma->vm_flags &= ~(VM_WRITE | VM_MAYWRITE);
 #if defined(__i386__) || defined(__x86_64__)
                pgprot_val(vma->vm_page_prot) &= ~_PAGE_RW;
 #else
-                               /* Ye gads this is ugly.  With more thought
-                                   we could move this up higher and use
-                                   `protection_map' instead.  */
-               vma->vm_page_prot = __pgprot(pte_val(pte_wrprotect(
-                       __pte(pgprot_val(vma->vm_page_prot)))));
+               /* Ye gads this is ugly.  With more thought
+                  we could move this up higher and use
+                  `protection_map' instead.  */
+               vma->vm_page_prot =
+                   __pgprot(pte_val
+                            (pte_wrprotect
+                             (__pte(pgprot_val(vma->vm_page_prot)))));
 #endif
        }
 
        switch (map->type) {
-        case _DRM_AGP:
-         if (drm_core_has_AGP(dev) && dev->agp->cant_use_aperture) {
-                /*
-                 * On some platforms we can't talk to bus dma address from the CPU, so for
-                 * memory of type DRM_AGP, we'll deal with sorting out the real physical
-                 * pages and mappings in nopage()
-                 */
+       case _DRM_AGP:
+               if (drm_core_has_AGP(dev) && dev->agp->cant_use_aperture) {
+                       /*
+                        * On some platforms we can't talk to bus dma address from the CPU, so for
+                        * memory of type DRM_AGP, we'll deal with sorting out the real physical
+                        * pages and mappings in nopage()
+                        */
 #if defined(__powerpc__)
-               pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
+                       pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
 #endif
-                vma->vm_ops = &drm_vm_ops;
-                break;
-         }
-                /* fall through to _DRM_FRAME_BUFFER... */        
+                       vma->vm_ops = &drm_vm_ops;
+                       break;
+               }
+               /* fall through to _DRM_FRAME_BUFFER... */
        case _DRM_FRAME_BUFFER:
        case _DRM_REGISTERS:
-               if (VM_OFFSET(vma) >= __pa(high_memory)) {
 #if defined(__i386__) || defined(__x86_64__)
-                       if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) {
-                               pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
-                               pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
-                       }
+               if (boot_cpu_data.x86 > 3 && map->type != _DRM_AGP) {
+                       pgprot_val(vma->vm_page_prot) |= _PAGE_PCD;
+                       pgprot_val(vma->vm_page_prot) &= ~_PAGE_PWT;
+               }
 #elif defined(__powerpc__)
-                       pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE | _PAGE_GUARDED;
+               pgprot_val(vma->vm_page_prot) |= _PAGE_NO_CACHE;
+               if (map->type == _DRM_REGISTERS)
+                       pgprot_val(vma->vm_page_prot) |= _PAGE_GUARDED;
 #endif
-                       vma->vm_flags |= VM_IO; /* not in core dump */
-               }
+               vma->vm_flags |= VM_IO; /* not in core dump */
 #if defined(__ia64__)
-               if (efi_range_is_wc(vma->vm_start, vma->vm_end -
-                                   vma->vm_start))
+               if (efi_range_is_wc(vma->vm_start, vma->vm_end - vma->vm_start))
                        vma->vm_page_prot =
-                               pgprot_writecombine(vma->vm_page_prot);
+                           pgprot_writecombine(vma->vm_page_prot);
                else
-                       vma->vm_page_prot =
-                               pgprot_noncached(vma->vm_page_prot);
+                       vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
 #endif
                offset = dev->driver->get_reg_ofs(dev);
 #ifdef __sparc__
+               vma->vm_page_prot = pgprot_noncached(vma->vm_page_prot);
                if (io_remap_pfn_range(DRM_RPR_ARG(vma) vma->vm_start,
-                                       (VM_OFFSET(vma) + offset) >> PAGE_SHIFT,
-                                       vma->vm_end - vma->vm_start,
-                                       vma->vm_page_prot))
+                                      (map->offset + offset) >> PAGE_SHIFT,
+                                      vma->vm_end - vma->vm_start,
+                                      vma->vm_page_prot))
 #else
                if (io_remap_pfn_range(vma, vma->vm_start,
-                                    (VM_OFFSET(vma) + offset) >> PAGE_SHIFT,
-                                    vma->vm_end - vma->vm_start,
-                                    vma->vm_page_prot))
+                                      (map->offset + offset) >> PAGE_SHIFT,
+                                      vma->vm_end - vma->vm_start,
+                                      vma->vm_page_prot))
 #endif
-                               return -EAGAIN;
+                       return -EAGAIN;
                DRM_DEBUG("   Type = %d; start = 0x%lx, end = 0x%lx,"
                          " offset = 0x%lx\n",
                          map->type,
-                         vma->vm_start, vma->vm_end, VM_OFFSET(vma) + offset);
+                         vma->vm_start, vma->vm_end, map->offset + offset);
                vma->vm_ops = &drm_vm_ops;
                break;
        case _DRM_SHM:
+       case _DRM_CONSISTENT:
+               /* Consistent memory is really like shared memory. It's only
+                * allocate in a different way */
                vma->vm_ops = &drm_vm_shm_ops;
                vma->vm_private_data = (void *)map;
-                               /* Don't let this area swap.  Change when
-                                  DRM_KERNEL advisory is supported. */
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
-               vma->vm_flags |= VM_LOCKED;
-#else
+               /* Don't let this area swap.  Change when
+                  DRM_KERNEL advisory is supported. */
                vma->vm_flags |= VM_RESERVED;
-#endif
                break;
        case _DRM_SCATTER_GATHER:
                vma->vm_ops = &drm_vm_sg_ops;
                vma->vm_private_data = (void *)map;
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
-               vma->vm_flags |= VM_LOCKED;
-#else
                vma->vm_flags |= VM_RESERVED;
-#endif
-                break;
+               break;
        default:
                return -EINVAL; /* This should never happen. */
        }
-#if LINUX_VERSION_CODE <= 0x02040e /* KERNEL_VERSION(2,4,14) */
-       vma->vm_flags |= VM_LOCKED | VM_SHM; /* Don't swap */
-#else
-       vma->vm_flags |= VM_RESERVED; /* Don't swap */
-#endif
+       vma->vm_flags |= VM_RESERVED;   /* Don't swap */
 
-       vma->vm_file  =  filp;  /* Needed for drm_vm_open() */
+       vma->vm_file = filp;    /* Needed for drm_vm_open() */
        drm_vm_open(vma);
        return 0;
 }
+
 EXPORT_SYMBOL(drm_mmap);
index 7a96977..fe00c7d 100644 (file)
@@ -6,7 +6,7 @@ menu "TPM devices"
 
 config TCG_TPM
        tristate "TPM Hardware Support"
-       depends on EXPERIMENTAL && PCI
+       depends on EXPERIMENTAL
        ---help---
          If you have a TPM security chip in your system, which
          implements the Trusted Computing Group's specification,
@@ -17,10 +17,21 @@ config TCG_TPM
          obtained at: <http://sourceforge.net/projects/trousers>.  To 
          compile this driver as a module, choose M here; the module 
          will be called tpm. If unsure, say N.
+         Note: For more TPM drivers enable CONFIG_PNP, CONFIG_ACPI
+         and CONFIG_PNPACPI.
+
+config TCG_TIS
+       tristate "TPM Interface Specification 1.2 Interface"
+       depends on TCG_TPM && PNPACPI
+       ---help---
+         If you have a TPM security chip that is compliant with the
+         TCG TIS 1.2 TPM specification say Yes and it will be accessible
+         from within Linux.  To compile this driver as a module, choose
+         M here; the module will be called tpm_tis.
 
 config TCG_NSC
        tristate "National Semiconductor TPM Interface"
-       depends on TCG_TPM
+       depends on TCG_TPM && PNPACPI
        ---help---
          If you have a TPM security chip from National Semicondutor 
          say Yes and it will be accessible from within Linux.  To 
@@ -35,5 +46,17 @@ config TCG_ATMEL
          will be accessible from within Linux.  To compile this driver 
          as a module, choose M here; the module will be called tpm_atmel.
 
+config TCG_INFINEON
+       tristate "Infineon Technologies TPM Interface"
+       depends on TCG_TPM && PNPACPI
+       ---help---
+         If you have a TPM security chip from Infineon Technologies
+         (either SLD 9630 TT 1.1 or SLB 9635 TT 1.2) say Yes and it
+         will be accessible from within Linux.
+         To compile this driver as a module, choose M here; the module
+         will be called tpm_infineon.
+         Further information on this driver and the supported hardware
+         can be found at http://www.prosec.rub.de/tpm
+
 endmenu
 
index 736d3df..ea3a1e0 100644 (file)
@@ -2,6 +2,10 @@
 # Makefile for the kernel tpm device drivers.
 #
 obj-$(CONFIG_TCG_TPM) += tpm.o
+ifdef CONFIG_ACPI
+       obj-$(CONFIG_TCG_TPM) += tpm_bios.o
+endif
+obj-$(CONFIG_TCG_TIS) += tpm_tis.o
 obj-$(CONFIG_TCG_NSC) += tpm_nsc.o
 obj-$(CONFIG_TCG_ATMEL) += tpm_atmel.o
-
+obj-$(CONFIG_TCG_INFINEON) += tpm_infineon.o
index de0c796..050ced2 100644 (file)
  * 
  */
 #include <linux/module.h>
-#include <linux/version.h>
 #include <linux/pci.h>
 #include <linux/delay.h>
 #include <linux/fs.h>
 #include <linux/miscdevice.h>
+#include <linux/platform_device.h>
+#include <linux/io.h>
 
-#define TPM_TIMEOUT msecs_to_jiffies(5)
+enum tpm_timeout {
+       TPM_TIMEOUT = 5,        /* msecs */
+};
 
 /* TPM addresses */
-#define        TPM_ADDR                        0x4E
-#define        TPM_DATA                        0x4F
+enum tpm_addr {
+       TPM_SUPERIO_ADDR = 0x2E,
+       TPM_ADDR = 0x4E,
+};
+
+extern ssize_t tpm_show_pubek(struct device *, struct device_attribute *attr,
+                               char *);
+extern ssize_t tpm_show_pcrs(struct device *, struct device_attribute *attr,
+                               char *);
+extern ssize_t tpm_show_caps(struct device *, struct device_attribute *attr,
+                               char *);
+extern ssize_t tpm_show_caps_1_2(struct device *, struct device_attribute *attr,
+                               char *);
+extern ssize_t tpm_store_cancel(struct device *, struct device_attribute *attr,
+                               const char *, size_t);
+extern ssize_t tpm_show_enabled(struct device *, struct device_attribute *attr,
+                               char *);
+extern ssize_t tpm_show_active(struct device *, struct device_attribute *attr,
+                               char *);
+extern ssize_t tpm_show_owned(struct device *, struct device_attribute *attr,
+                               char *);
+extern ssize_t tpm_show_temp_deactivated(struct device *,
+                                        struct device_attribute *attr, char *);
 
 struct tpm_chip;
 
 struct tpm_vendor_specific {
-       u8 req_complete_mask;
-       u8 req_complete_val;
-       u16 base;               /* TPM base address */
+       const u8 req_complete_mask;
+       const u8 req_complete_val;
+       const u8 req_canceled;
+       void __iomem *iobase;           /* ioremapped address */
+       unsigned long base;             /* TPM base address */
+
+       int irq;
+
+       int region_size;
+       int have_region;
 
        int (*recv) (struct tpm_chip *, u8 *, size_t);
        int (*send) (struct tpm_chip *, u8 *, size_t);
        void (*cancel) (struct tpm_chip *);
+       u8 (*status) (struct tpm_chip *);
        struct miscdevice miscdev;
+       struct attribute_group *attr_group;
+       struct list_head list;
+       int locality;
+       unsigned long timeout_a, timeout_b, timeout_c, timeout_d; /* jiffies */
+       unsigned long duration[3]; /* jiffies */
+
+       wait_queue_head_t read_queue;
+       wait_queue_head_t int_queue;
 };
 
 struct tpm_chip {
-       struct pci_dev *pci_dev;        /* PCI device stuff */
+       struct device *dev;     /* Device stuff */
 
        int dev_num;            /* /dev/tpm# */
        int num_opens;          /* only one allowed */
@@ -57,37 +97,54 @@ struct tpm_chip {
        struct semaphore buffer_mutex;
 
        struct timer_list user_read_timer;      /* user needs to claim result */
+       struct work_struct work;
        struct semaphore tpm_mutex;     /* tpm is processing */
-       struct timer_list device_timer; /* tpm is processing */
-       struct semaphore timer_manipulation_mutex;
 
-       struct tpm_vendor_specific *vendor;
+       struct tpm_vendor_specific vendor;
+
+       struct dentry **bios_dir;
 
        struct list_head list;
 };
 
-static inline int tpm_read_index(int index)
+#define to_tpm_chip(n) container_of(n, struct tpm_chip, vendor)
+
+static inline int tpm_read_index(int base, int index)
 {
-       outb(index, TPM_ADDR);
-       return inb(TPM_DATA) & 0xFF;
+       outb(index, base);
+       return inb(base+1) & 0xFF;
 }
 
-static inline void tpm_write_index(int index, int value)
+static inline void tpm_write_index(int base, int index, int value)
 {
-       outb(index, TPM_ADDR);
-       outb(value & 0xFF, TPM_DATA);
+       outb(index, base);
+       outb(value & 0xFF, base+1);
 }
 
-extern void tpm_time_expired(unsigned long);
-extern int tpm_lpc_bus_init(struct pci_dev *, u16);
-
-extern int tpm_register_hardware(struct pci_dev *,
-                                struct tpm_vendor_specific *);
+extern void tpm_get_timeouts(struct tpm_chip *);
+extern void tpm_gen_interrupt(struct tpm_chip *);
+extern void tpm_continue_selftest(struct tpm_chip *);
+extern unsigned long tpm_calc_ordinal_duration(struct tpm_chip *, u32);
+extern struct tpm_chip* tpm_register_hardware(struct device *,
+                                const struct tpm_vendor_specific *);
 extern int tpm_open(struct inode *, struct file *);
 extern int tpm_release(struct inode *, struct file *);
 extern ssize_t tpm_write(struct file *, const char __user *, size_t,
                         loff_t *);
 extern ssize_t tpm_read(struct file *, char __user *, size_t, loff_t *);
-extern void __devexit tpm_remove(struct pci_dev *);
-extern int tpm_pm_suspend(struct pci_dev *, pm_message_t);
-extern int tpm_pm_resume(struct pci_dev *);
+extern void tpm_remove_hardware(struct device *);
+extern int tpm_pm_suspend(struct device *, pm_message_t);
+extern int tpm_pm_resume(struct device *);
+
+#ifdef CONFIG_ACPI
+extern struct dentry ** tpm_bios_log_setup(char *);
+extern void tpm_bios_log_teardown(struct dentry **);
+#else
+static inline struct dentry ** tpm_bios_log_setup(char *name)
+{
+       return NULL;
+}
+static inline void tpm_bios_log_teardown(struct dentry **dir)
+{
+}
+#endif
index 094835c..4263935 100644 (file)
@@ -2,7 +2,7 @@ menu "Hardware crypto devices"
 
 config CRYPTO_DEV_PADLOCK
        tristate "Support for VIA PadLock ACE"
-       depends on CRYPTO && X86 && !X86_64
+       depends on CRYPTO && X86_32
        help
          Some VIA processors come with an integrated crypto engine
          (so called VIA PadLock ACE, Advanced Cryptography Engine)
index 7a50060..b78489b 100644 (file)
 #ifndef _CRYPTO_PADLOCK_H
 #define _CRYPTO_PADLOCK_H
 
+#define PADLOCK_ALIGNMENT 16
+
 /* Control word. */
-union cword {
-       uint32_t cword[4];
-       struct {
-               int rounds:4;
-               int algo:3;
-               int keygen:1;
-               int interm:1;
-               int encdec:1;
-               int ksize:2;
-       } b;
-};
+struct cword {
+       unsigned int __attribute__ ((__packed__))
+               rounds:4,
+               algo:3,
+               keygen:1,
+               interm:1,
+               encdec:1,
+               ksize:2;
+} __attribute__ ((__aligned__(PADLOCK_ALIGNMENT)));
 
 #define PFX    "padlock: "
 
index 422721b..932c4fa 100644 (file)
@@ -149,7 +149,7 @@ static int sgi_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg *msgs,
                        err = i2c_write(adap, p->buf, p->len);
        }
 
-       return err;
+       return (err < 0) ? err : i;
 }
 
 static u32 sgi_func(struct i2c_adapter *adap)
@@ -158,8 +158,6 @@ static u32 sgi_func(struct i2c_adapter *adap)
 }
 
 static struct i2c_algorithm sgi_algo = {
-       .name           = "SGI algorithm",
-       .id             = I2C_ALGO_SGI,
        .master_xfer    = sgi_xfer,
        .functionality  = sgi_func,
 };
@@ -169,7 +167,6 @@ static struct i2c_algorithm sgi_algo = {
  */
 int i2c_sgi_add_bus(struct i2c_adapter *adap)
 {
-       adap->id |= sgi_algo.id;
        adap->algo = &sgi_algo;
 
        return i2c_add_adapter(adap);
index 75831a2..d06edce 100644 (file)
@@ -27,7 +27,6 @@
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include <linux/config.h>
 #include <linux/delay.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
@@ -284,8 +283,6 @@ au1550_func(struct i2c_adapter *adap)
 }
 
 static struct i2c_algorithm au1550_algo = {
-       .name           = "Au1550 algorithm",
-       .id             = I2C_ALGO_AU1550,
        .master_xfer    = au1550_xfer,
        .functionality  = au1550_func,
 };
index 8c55eaf..2ed0711 100644 (file)
  *       that is passed as the platform_data to this driver.
  */
 
-#include <linux/config.h>
-#ifdef CONFIG_I2C_DEBUG_BUS
-#define DEBUG  1
-#endif
-
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/module.h>
 #include <linux/i2c.h>
 #include <linux/i2c-algo-bit.h>
@@ -90,12 +85,11 @@ struct ixp4xx_i2c_data {
        struct i2c_algo_bit_data algo_data;
 };
 
-static int ixp4xx_i2c_remove(struct device *dev)
+static int ixp4xx_i2c_remove(struct platform_device *plat_dev)
 {
-       struct platform_device *plat_dev = to_platform_device(dev);
-       struct ixp4xx_i2c_data *drv_data = dev_get_drvdata(&plat_dev->dev);
+       struct ixp4xx_i2c_data *drv_data = platform_get_drvdata(plat_dev);
 
-       dev_set_drvdata(&plat_dev->dev, NULL);
+       platform_set_drvdata(plat_dev, NULL);
 
        i2c_bit_del_bus(&drv_data->adapter);
 
@@ -104,18 +98,16 @@ static int ixp4xx_i2c_remove(struct device *dev)
        return 0;
 }
 
-static int ixp4xx_i2c_probe(struct device *dev)
+static int ixp4xx_i2c_probe(struct platform_device *plat_dev)
 {
        int err;
-       struct platform_device *plat_dev = to_platform_device(dev);
        struct ixp4xx_i2c_pins *gpio = plat_dev->dev.platform_data;
        struct ixp4xx_i2c_data *drv_data = 
-               kmalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
+               kzalloc(sizeof(struct ixp4xx_i2c_data), GFP_KERNEL);
 
        if(!drv_data)
                return -ENOMEM;
 
-       memzero(drv_data, sizeof(struct ixp4xx_i2c_data));
        drv_data->gpio_pins = gpio;
 
        /*
@@ -134,6 +126,9 @@ static int ixp4xx_i2c_probe(struct device *dev)
        drv_data->algo_data.timeout = 100;
 
        drv_data->adapter.id = I2C_HW_B_IXP4XX;
+       drv_data->adapter.class = I2C_CLASS_HWMON;
+       strlcpy(drv_data->adapter.name, plat_dev->dev.driver->name,
+               I2C_NAME_SIZE);
        drv_data->adapter.algo_data = &drv_data->algo_data;
 
        drv_data->adapter.dev.parent = &plat_dev->dev;
@@ -144,32 +139,34 @@ static int ixp4xx_i2c_probe(struct device *dev)
        gpio_line_set(gpio->sda_pin, 0);
 
        if ((err = i2c_bit_add_bus(&drv_data->adapter) != 0)) {
-               printk(KERN_ERR "ERROR: Could not install %s\n", dev->bus_id);
+               printk(KERN_ERR "ERROR: Could not install %s\n", plat_dev->dev.bus_id);
 
                kfree(drv_data);
                return err;
        }
 
-       dev_set_drvdata(&plat_dev->dev, drv_data);
+       platform_set_drvdata(plat_dev, drv_data);
 
        return 0;
 }
 
-static struct device_driver ixp4xx_i2c_driver = {
-       .name           = "IXP4XX-I2C",
-       .bus            = &platform_bus_type,
+static struct platform_driver ixp4xx_i2c_driver = {
        .probe          = ixp4xx_i2c_probe,
        .remove         = ixp4xx_i2c_remove,
+       .driver         = {
+               .name   = "IXP4XX-I2C",
+               .owner  = THIS_MODULE,
+       },
 };
 
 static int __init ixp4xx_i2c_init(void)
 {
-       return driver_register(&ixp4xx_i2c_driver);
+       return platform_driver_register(&ixp4xx_i2c_driver);
 }
 
 static void __exit ixp4xx_i2c_exit(void)
 {
-       driver_unregister(&ixp4xx_i2c_driver);
+       platform_driver_unregister(&ixp4xx_i2c_driver);
 }
 
 module_init(ixp4xx_i2c_init);
index 5b85278..ac5cde1 100644 (file)
@@ -1,6 +1,4 @@
 /*
- * drivers/i2c/busses/i2c-mv64xxx.c
- * 
  * Driver for the i2c controller on the Marvell line of host bridges for MIPS
  * and PPC (e.g, gt642[46]0, mv643[46]0, mv644[46]0).
  *
@@ -17,6 +15,8 @@
 #include <linux/i2c.h>
 #include <linux/interrupt.h>
 #include <linux/mv643xx.h>
+#include <linux/platform_device.h>
+
 #include <asm/io.h>
 
 /* Register defines */
@@ -63,7 +63,6 @@ enum {
        MV64XXX_I2C_STATE_WAITING_FOR_ADDR_2_ACK,
        MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK,
        MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA,
-       MV64XXX_I2C_STATE_ABORTING,
 };
 
 /* Driver actions */
@@ -83,6 +82,7 @@ struct mv64xxx_i2c_data {
        int                     irq;
        u32                     state;
        u32                     action;
+       u32                     aborting;
        u32                     cntl_bits;
        void __iomem            *reg_base;
        u32                     reg_base_p;
@@ -120,12 +120,6 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
                return;
        }
 
-       if (drv_data->state == MV64XXX_I2C_STATE_ABORTING) {
-               drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
-               drv_data->state = MV64XXX_I2C_STATE_IDLE;
-               return;
-       }
-
        /* The status from the ctlr [mostly] tells us what to do next */
        switch (status) {
        /* Start condition interrupt */
@@ -146,14 +140,16 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
                /* FALLTHRU */
        case MV64XXX_I2C_STATUS_MAST_WR_ADDR_2_ACK: /* 0xd0 */
        case MV64XXX_I2C_STATUS_MAST_WR_ACK: /* 0x28 */
-               if (drv_data->bytes_left > 0) {
+               if ((drv_data->bytes_left == 0)
+                               || (drv_data->aborting
+                                       && (drv_data->byte_posn != 0))) {
+                       drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
+                       drv_data->state = MV64XXX_I2C_STATE_IDLE;
+               } else {
                        drv_data->action = MV64XXX_I2C_ACTION_SEND_DATA;
                        drv_data->state =
                                MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_ACK;
                        drv_data->bytes_left--;
-               } else {
-                       drv_data->action = MV64XXX_I2C_ACTION_SEND_STOP;
-                       drv_data->state = MV64XXX_I2C_STATE_IDLE;
                }
                break;
 
@@ -182,7 +178,7 @@ mv64xxx_i2c_fsm(struct mv64xxx_i2c_data *drv_data, u32 status)
                }
                drv_data->state = MV64XXX_I2C_STATE_WAITING_FOR_SLAVE_DATA;
 
-               if (drv_data->bytes_left == 1)
+               if ((drv_data->bytes_left == 1) || drv_data->aborting)
                        drv_data->cntl_bits &= ~MV64XXX_I2C_REG_CONTROL_ACK;
                break;
 
@@ -318,6 +314,7 @@ mv64xxx_i2c_prepare_for_io(struct mv64xxx_i2c_data *drv_data,
        drv_data->msg = msg;
        drv_data->byte_posn = 0;
        drv_data->bytes_left = msg->len;
+       drv_data->aborting = 0;
        drv_data->rc = 0;
        drv_data->cntl_bits = MV64XXX_I2C_REG_CONTROL_ACK |
                MV64XXX_I2C_REG_CONTROL_INTEN | MV64XXX_I2C_REG_CONTROL_TWSIEN;
@@ -357,17 +354,19 @@ mv64xxx_i2c_wait_for_completion(struct mv64xxx_i2c_data *drv_data)
        }
 
        if (abort && drv_data->block) {
-               drv_data->state = MV64XXX_I2C_STATE_ABORTING;
+               drv_data->aborting = 1;
                spin_unlock_irqrestore(&drv_data->lock, flags);
 
                time_left = wait_event_timeout(drv_data->waitq,
                        !drv_data->block,
                        msecs_to_jiffies(drv_data->adapter.timeout));
 
-               if (time_left <= 0) {
+               if ((time_left <= 0) && drv_data->block) {
                        drv_data->state = MV64XXX_I2C_STATE_IDLE;
                        dev_err(&drv_data->adapter.dev,
-                               "mv64xxx: I2C bus locked\n");
+                               "mv64xxx: I2C bus locked, block: %d, "
+                               "time_left: %d\n", drv_data->block,
+                               (int)time_left);
                }
        } else
                spin_unlock_irqrestore(&drv_data->lock, flags);
@@ -423,18 +422,16 @@ static int
 mv64xxx_i2c_xfer(struct i2c_adapter *adap, struct i2c_msg msgs[], int num)
 {
        struct mv64xxx_i2c_data *drv_data = i2c_get_adapdata(adap);
-       int     i, rc = 0;
+       int     i, rc;
 
        for (i=0; i<num; i++)
-               if ((rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[i])) != 0)
-                       break;
+               if ((rc = mv64xxx_i2c_execute_msg(drv_data, &msgs[i])) < 0)
+                       return rc;
 
-       return rc;
+       return num;
 }
 
 static struct i2c_algorithm mv64xxx_i2c_algo = {
-       .name = MV64XXX_I2C_CTLR_NAME " algorithm",
-       .id = I2C_ALGO_MV64XXX,
        .master_xfer = mv64xxx_i2c_xfer,
        .functionality = mv64xxx_i2c_functionality,
 };
@@ -492,29 +489,25 @@ mv64xxx_i2c_unmap_regs(struct mv64xxx_i2c_data *drv_data)
 }
 
 static int __devinit
-mv64xxx_i2c_probe(struct device *dev)
+mv64xxx_i2c_probe(struct platform_device *pd)
 {
-       struct platform_device          *pd = to_platform_device(dev);
        struct mv64xxx_i2c_data         *drv_data;
-       struct mv64xxx_i2c_pdata        *pdata = dev->platform_data;
+       struct mv64xxx_i2c_pdata        *pdata = pd->dev.platform_data;
        int     rc;
 
        if ((pd->id != 0) || !pdata)
                return -ENODEV;
 
-       drv_data = kmalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL);
-
+       drv_data = kzalloc(sizeof(struct mv64xxx_i2c_data), GFP_KERNEL);
        if (!drv_data)
                return -ENOMEM;
 
-       memset(drv_data, 0, sizeof(struct mv64xxx_i2c_data));
-
        if (mv64xxx_i2c_map_regs(pd, drv_data)) {
                rc = -ENODEV;
                goto exit_kfree;
        }
 
-       strncpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter",
+       strlcpy(drv_data->adapter.name, MV64XXX_I2C_CTLR_NAME " adapter",
                I2C_NAME_SIZE);
 
        init_waitqueue_head(&drv_data->waitq);
@@ -523,24 +516,29 @@ mv64xxx_i2c_probe(struct device *dev)
        drv_data->freq_m = pdata->freq_m;
        drv_data->freq_n = pdata->freq_n;
        drv_data->irq = platform_get_irq(pd, 0);
-       drv_data->adapter.id = I2C_ALGO_MV64XXX | I2C_HW_MV64XXX;
+       if (drv_data->irq < 0) {
+               rc = -ENXIO;
+               goto exit_unmap_regs;
+       }
+       drv_data->adapter.id = I2C_HW_MV64XXX;
        drv_data->adapter.algo = &mv64xxx_i2c_algo;
        drv_data->adapter.owner = THIS_MODULE;
        drv_data->adapter.class = I2C_CLASS_HWMON;
        drv_data->adapter.timeout = pdata->timeout;
        drv_data->adapter.retries = pdata->retries;
-       dev_set_drvdata(dev, drv_data);
+       platform_set_drvdata(pd, drv_data);
        i2c_set_adapdata(&drv_data->adapter, drv_data);
 
        if (request_irq(drv_data->irq, mv64xxx_i2c_intr, 0,
-               MV64XXX_I2C_CTLR_NAME, drv_data)) {
-
-               dev_err(dev, "mv64xxx: Can't register intr handler "
-                       "irq: %d\n", drv_data->irq);
+                       MV64XXX_I2C_CTLR_NAME, drv_data)) {
+               dev_err(&drv_data->adapter.dev,
+                       "mv64xxx: Can't register intr handler irq: %d\n",
+                       drv_data->irq);
                rc = -EINVAL;
                goto exit_unmap_regs;
        } else if ((rc = i2c_add_adapter(&drv_data->adapter)) != 0) {
-               dev_err(dev, "mv64xxx: Can't add i2c adapter, rc: %d\n", -rc);
+               dev_err(&drv_data->adapter.dev,
+                       "mv64xxx: Can't add i2c adapter, rc: %d\n", -rc);
                goto exit_free_irq;
        }
 
@@ -558,9 +556,9 @@ mv64xxx_i2c_probe(struct device *dev)
 }
 
 static int __devexit
-mv64xxx_i2c_remove(struct device *dev)
+mv64xxx_i2c_remove(struct platform_device *dev)
 {
-       struct mv64xxx_i2c_data         *drv_data = dev_get_drvdata(dev);
+       struct mv64xxx_i2c_data         *drv_data = platform_get_drvdata(dev);
        int     rc;
 
        rc = i2c_del_adapter(&drv_data->adapter);
@@ -571,23 +569,25 @@ mv64xxx_i2c_remove(struct device *dev)
        return rc;
 }
 
-static struct device_driver mv64xxx_i2c_driver = {
-       .name   = MV64XXX_I2C_CTLR_NAME,
-       .bus    = &platform_bus_type,
+static struct platform_driver mv64xxx_i2c_driver = {
        .probe  = mv64xxx_i2c_probe,
        .remove = mv64xxx_i2c_remove,
+       .driver = {
+               .owner  = THIS_MODULE,
+               .name   = MV64XXX_I2C_CTLR_NAME,
+       },
 };
 
 static int __init
 mv64xxx_i2c_init(void)
 {
-       return driver_register(&mv64xxx_i2c_driver);
+       return platform_driver_register(&mv64xxx_i2c_driver);
 }
 
 static void __exit
 mv64xxx_i2c_exit(void)
 {
-       driver_unregister(&mv64xxx_i2c_driver);
+       platform_driver_unregister(&mv64xxx_i2c_driver);
 }
 
 module_init(mv64xxx_i2c_init);
index e5dd90b..fa503ed 100644 (file)
  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/i2c-algo-sibyte.h>
 #include <asm/sibyte/sb1250_regs.h>
 #include <asm/sibyte/sb1250_smbus.h>
 
 static struct i2c_algo_sibyte_data sibyte_board_data[2] = {
-       { NULL, 0, (void *) (KSEG1+A_SMB_BASE(0)) },
-       { NULL, 1, (void *) (KSEG1+A_SMB_BASE(1)) }
+       { NULL, 0, (void *) (CKSEG1+A_SMB_BASE(0)) },
+       { NULL, 1, (void *) (CKSEG1+A_SMB_BASE(1)) }
 };
 
 static struct i2c_adapter sibyte_board_adapter[2] = {
index 07f16c3..93d483b 100644 (file)
@@ -3,22 +3,20 @@
  *
  *  Copyright (C) 2005 James Chapman <jchapman@katalix.com>
  *
- *     based on linux/drivers/acron/char/pcf8583.c
+ *     based on linux/drivers/acorn/char/pcf8583.c
  *  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.
  *
- * Driver for Dallas Semiconductor DS1337 real time clock chip
+ * Driver for Dallas Semiconductor DS1337 and DS1339 real time clock chip
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/slab.h>
 #include <linux/i2c.h>
-#include <linux/i2c-sensor.h>
 #include <linux/string.h>
 #include <linux/rtc.h>         /* get the user-level API */
 #include <linux/bcd.h>
@@ -40,9 +38,8 @@
  * Functions declaration
  */
 static unsigned short normal_i2c[] = { 0x68, I2C_CLIENT_END };
-static unsigned int normal_isa[] = { I2C_CLIENT_ISA_END };
 
-SENSORS_INSMOD_1(ds1337);
+I2C_CLIENT_INSMOD_1(ds1337);
 
 static int ds1337_attach_adapter(struct i2c_adapter *adapter);
 static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind);
@@ -55,9 +52,9 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd,
  * Driver data (common to all clients)
  */
 static struct i2c_driver ds1337_driver = {
-       .owner          = THIS_MODULE,
-       .name           = "ds1337",
-       .flags          = I2C_DF_NOTIFY,
+       .driver = {
+               .name   = "ds1337",
+       },
        .attach_adapter = ds1337_attach_adapter,
        .detach_client  = ds1337_detach_client,
        .command        = ds1337_command,
@@ -69,13 +66,11 @@ static struct i2c_driver ds1337_driver = {
 struct ds1337_data {
        struct i2c_client client;
        struct list_head list;
-       int id;
 };
 
 /*
  * Internal variables
  */
-static int ds1337_id;
 static LIST_HEAD(ds1337_clients);
 
 static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
@@ -95,7 +90,6 @@ static inline int ds1337_read(struct i2c_client *client, u8 reg, u8 *value)
  */
 static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
 {
-       struct ds1337_data *data = i2c_get_clientdata(client);
        int result;
        u8 buf[7];
        u8 val;
@@ -103,9 +97,7 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
        u8 offs = 0;
 
        if (!dt) {
-               dev_dbg(&client->adapter->dev, "%s: EINVAL: dt=NULL\n",
-                       __FUNCTION__);
-
+               dev_dbg(&client->dev, "%s: EINVAL: dt=NULL\n", __FUNCTION__);
                return -EINVAL;
        }
 
@@ -119,98 +111,86 @@ static int ds1337_get_datetime(struct i2c_client *client, struct rtc_time *dt)
        msg[1].len = sizeof(buf);
        msg[1].buf = &buf[0];
 
-       result = client->adapter->algo->master_xfer(client->adapter,
-                                                   &msg[0], 2);
+       result = i2c_transfer(client->adapter, msg, 2);
 
-       dev_dbg(&client->adapter->dev,
-               "%s: [%d] %02x %02x %02x %02x %02x %02x %02x\n",
+       dev_dbg(&client->dev, "%s: [%d] %02x %02x %02x %02x %02x %02x %02x\n",
                __FUNCTION__, result, buf[0], buf[1], buf[2], buf[3],
                buf[4], buf[5], buf[6]);
 
-       if (result >= 0) {
-               dt->tm_sec = BCD_TO_BIN(buf[0]);
-               dt->tm_min = BCD_TO_BIN(buf[1]);
+       if (result == 2) {
+               dt->tm_sec = BCD2BIN(buf[0]);
+               dt->tm_min = BCD2BIN(buf[1]);
                val = buf[2] & 0x3f;
-               dt->tm_hour = BCD_TO_BIN(val);
-               dt->tm_wday = BCD_TO_BIN(buf[3]) - 1;
-               dt->tm_mday = BCD_TO_BIN(buf[4]);
+               dt->tm_hour = BCD2BIN(val);
+               dt->tm_wday = BCD2BIN(buf[3]) - 1;
+               dt->tm_mday = BCD2BIN(buf[4]);
                val = buf[5] & 0x7f;
-               dt->tm_mon = BCD_TO_BIN(val);
-               dt->tm_year = 1900 + BCD_TO_BIN(buf[6]);
+               dt->tm_mon = BCD2BIN(val) - 1;
+               dt->tm_year = BCD2BIN(buf[6]);
                if (buf[5] & 0x80)
                        dt->tm_year += 100;
 
-               dev_dbg(&client->adapter->dev, "%s: secs=%d, mins=%d, "
+               dev_dbg(&client->dev, "%s: secs=%d, mins=%d, "
                        "hours=%d, mday=%d, mon=%d, year=%d, wday=%d\n",
                        __FUNCTION__, dt->tm_sec, dt->tm_min,
                        dt->tm_hour, dt->tm_mday,
                        dt->tm_mon, dt->tm_year, dt->tm_wday);
-       } else {
-               dev_err(&client->adapter->dev, "ds1337[%d]: error reading "
-                       "data! %d\n", data->id, result);
-               result = -EIO;
+
+               return 0;
        }
 
-       return result;
+       dev_err(&client->dev, "error reading data! %d\n", result);
+       return -EIO;
 }
 
 static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt)
 {
-       struct ds1337_data *data = i2c_get_clientdata(client);
        int result;
        u8 buf[8];
        u8 val;
        struct i2c_msg msg[1];
 
        if (!dt) {
-               dev_dbg(&client->adapter->dev, "%s: EINVAL: dt=NULL\n",
-                       __FUNCTION__);
-
+               dev_dbg(&client->dev, "%s: EINVAL: dt=NULL\n", __FUNCTION__);
                return -EINVAL;
        }
 
-       dev_dbg(&client->adapter->dev, "%s: secs=%d, mins=%d, hours=%d, "
+       dev_dbg(&client->dev, "%s: secs=%d, mins=%d, hours=%d, "
                "mday=%d, mon=%d, year=%d, wday=%d\n", __FUNCTION__,
                dt->tm_sec, dt->tm_min, dt->tm_hour,
                dt->tm_mday, dt->tm_mon, dt->tm_year, dt->tm_wday);
 
        buf[0] = 0;             /* reg offset */
-       buf[1] = BIN_TO_BCD(dt->tm_sec);
-       buf[2] = BIN_TO_BCD(dt->tm_min);
-       buf[3] = BIN_TO_BCD(dt->tm_hour) | (1 << 6);
-       buf[4] = BIN_TO_BCD(dt->tm_wday) + 1;
-       buf[5] = BIN_TO_BCD(dt->tm_mday);
-       buf[6] = BIN_TO_BCD(dt->tm_mon);
-       if (dt->tm_year >= 2000) {
-               val = dt->tm_year - 2000;
+       buf[1] = BIN2BCD(dt->tm_sec);
+       buf[2] = BIN2BCD(dt->tm_min);
+       buf[3] = BIN2BCD(dt->tm_hour);
+       buf[4] = BIN2BCD(dt->tm_wday + 1);
+       buf[5] = BIN2BCD(dt->tm_mday);
+       buf[6] = BIN2BCD(dt->tm_mon + 1);
+       val = dt->tm_year;
+       if (val >= 100) {
+               val -= 100;
                buf[6] |= (1 << 7);
-       } else {
-               val = dt->tm_year - 1900;
        }
-       buf[7] = BIN_TO_BCD(val);
+       buf[7] = BIN2BCD(val);
 
        msg[0].addr = client->addr;
        msg[0].flags = 0;
        msg[0].len = sizeof(buf);
        msg[0].buf = &buf[0];
 
-       result = client->adapter->algo->master_xfer(client->adapter,
-                                                   &msg[0], 1);
-       if (result < 0) {
-               dev_err(&client->adapter->dev, "ds1337[%d]: error "
-                       "writing data! %d\n", data->id, result);
-               result = -EIO;
-       } else {
-               result = 0;
-       }
+       result = i2c_transfer(client->adapter, msg, 1);
+       if (result == 1)
+               return 0;
 
-       return result;
+       dev_err(&client->dev, "error writing data! %d\n", result);
+       return -EIO;
 }
 
 static int ds1337_command(struct i2c_client *client, unsigned int cmd,
                          void *arg)
 {
-       dev_dbg(&client->adapter->dev, "%s: cmd=%d\n", __FUNCTION__, cmd);
+       dev_dbg(&client->dev, "%s: cmd=%d\n", __FUNCTION__, cmd);
 
        switch (cmd) {
        case DS1337_GET_DATE:
@@ -228,7 +208,7 @@ static int ds1337_command(struct i2c_client *client, unsigned int cmd,
  * Public API for access to specific device. Useful for low-level
  * RTC access from kernel code.
  */
-int ds1337_do_command(int id, int cmd, void *arg)
+int ds1337_do_command(int bus, int cmd, void *arg)
 {
        struct list_head *walk;
        struct list_head *tmp;
@@ -236,7 +216,7 @@ int ds1337_do_command(int id, int cmd, void *arg)
 
        list_for_each_safe(walk, tmp, &ds1337_clients) {
                data = list_entry(walk, struct ds1337_data, list);
-               if (data->id == id)
+               if (data->client.adapter->nr == bus)
                        return ds1337_command(&data->client, cmd, arg);
        }
 
@@ -245,7 +225,7 @@ int ds1337_do_command(int id, int cmd, void *arg)
 
 static int ds1337_attach_adapter(struct i2c_adapter *adapter)
 {
-       return i2c_detect(adapter, &addr_data, ds1337_detect);
+       return i2c_probe(adapter, &addr_data, ds1337_detect);
 }
 
 /*
@@ -263,11 +243,10 @@ static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind)
                                     I2C_FUNC_I2C))
                goto exit;
 
-       if (!(data = kmalloc(sizeof(struct ds1337_data), GFP_KERNEL))) {
+       if (!(data = kzalloc(sizeof(struct ds1337_data), GFP_KERNEL))) {
                err = -ENOMEM;
                goto exit;
        }
-       memset(data, 0, sizeof(struct ds1337_data));
        INIT_LIST_HEAD(&data->list);
 
        /* The common I2C client data is placed right before the
@@ -346,7 +325,6 @@ static int ds1337_detect(struct i2c_adapter *adapter, int address, int kind)
        ds1337_init_client(new_client);
 
        /* Add client to local list */
-       data->id = ds1337_id++;
        list_add(&data->list, &ds1337_clients);
 
        return 0;
@@ -359,13 +337,38 @@ exit:
 
 static void ds1337_init_client(struct i2c_client *client)
 {
-       s32 val;
+       u8 status, control;
 
-       /* Ensure that device is set in 24-hour mode */
-       val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR);
-       if ((val >= 0) && (val & (1 << 6)) == 0)
-               i2c_smbus_write_byte_data(client, DS1337_REG_HOUR,
-                                         val | (1 << 6));
+       /* On some boards, the RTC isn't configured by boot firmware.
+        * Handle that case by starting/configuring the RTC now.
+        */
+       status = i2c_smbus_read_byte_data(client, DS1337_REG_STATUS);
+       control = i2c_smbus_read_byte_data(client, DS1337_REG_CONTROL);
+
+       if ((status & 0x80) || (control & 0x80)) {
+               /* RTC not running */
+               u8 buf[16];
+               struct i2c_msg msg[1];
+
+               dev_dbg(&client->dev, "%s: RTC not running!\n", __FUNCTION__);
+
+               /* Initialize all, including STATUS and CONTROL to zero */
+               memset(buf, 0, sizeof(buf));
+               msg[0].addr = client->addr;
+               msg[0].flags = 0;
+               msg[0].len = sizeof(buf);
+               msg[0].buf = &buf[0];
+
+               i2c_transfer(client->adapter, msg, 1);
+       } else {
+               /* Running: ensure that device is set in 24-hour mode */
+               s32 val;
+
+               val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR);
+               if ((val >= 0) && (val & (1 << 6)))
+                       i2c_smbus_write_byte_data(client, DS1337_REG_HOUR,
+                                                 val & 0x3f);
+       }
 }
 
 static int ds1337_detach_client(struct i2c_client *client)
@@ -373,11 +376,8 @@ static int ds1337_detach_client(struct i2c_client *client)
        int err;
        struct ds1337_data *data = i2c_get_clientdata(client);
 
-       if ((err = i2c_detach_client(client))) {
-               dev_err(&client->dev, "Client deregistration failed, "
-                       "client not detached.\n");
+       if ((err = i2c_detach_client(client)))
                return err;
-       }
 
        list_del(&data->list);
        kfree(data);
@@ -398,5 +398,7 @@ MODULE_AUTHOR("James Chapman <jchapman@katalix.com>");
 MODULE_DESCRIPTION("DS1337 RTC driver");
 MODULE_LICENSE("GPL");
 
+EXPORT_SYMBOL_GPL(ds1337_do_command);
+
 module_init(ds1337_init);
 module_exit(ds1337_exit);
index 23d1957..ecd1a30 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
- * Copyright (c) 2004 Infinicon Corporation.  All rights reserved.
- * Copyright (c) 2004 Intel Corporation.  All rights reserved.
- * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
- * Copyright (c) 2004 Voltaire Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2004, 2005 Infinicon Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Topspin Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Voltaire Corporation.  All rights reserved.
+ * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
  * $Id: agent.c 1389 2004-12-27 22:56:47Z roland $
  */
 
-#include <linux/dma-mapping.h>
+#include <linux/slab.h>
+#include <linux/string.h>
 
-#include <asm/bug.h>
+#include "agent.h"
+#include "smi.h"
 
-#include <ib_smi.h>
+#define SPFX "ib_agent: "
 
-#include "smi.h"
-#include "agent_priv.h"
-#include "mad_priv.h"
-#include "agent.h"
+struct ib_agent_port_private {
+       struct list_head port_list;
+       struct ib_mad_agent *agent[2];
+};
 
-spinlock_t ib_agent_port_list_lock;
+static DEFINE_SPINLOCK(ib_agent_port_list_lock);
 static LIST_HEAD(ib_agent_port_list);
 
-/*
- * Caller must hold ib_agent_port_list_lock
- */
-static inline struct ib_agent_port_private *
-__ib_get_agent_port(struct ib_device *device, int port_num,
-                   struct ib_mad_agent *mad_agent)
+static struct ib_agent_port_private *
+__ib_get_agent_port(struct ib_device *device, int port_num)
 {
        struct ib_agent_port_private *entry;
 
-       BUG_ON(!(!!device ^ !!mad_agent));  /* Exactly one MUST be (!NULL) */
-
-       if (device) {
-               list_for_each_entry(entry, &ib_agent_port_list, port_list) {
-                       if (entry->smp_agent->device == device &&
-                           entry->port_num == port_num)
-                               return entry;
-               }
-       } else {
-               list_for_each_entry(entry, &ib_agent_port_list, port_list) {
-                       if ((entry->smp_agent == mad_agent) ||
-                           (entry->perf_mgmt_agent == mad_agent))
-                               return entry;
-               }
+       list_for_each_entry(entry, &ib_agent_port_list, port_list) {
+               if (entry->agent[0]->device == device &&
+                   entry->agent[0]->port_num == port_num)
+                       return entry;
        }
        return NULL;
 }
 
-static inline struct ib_agent_port_private *
-ib_get_agent_port(struct ib_device *device, int port_num,
-                 struct ib_mad_agent *mad_agent)
+static struct ib_agent_port_private *
+ib_get_agent_port(struct ib_device *device, int port_num)
 {
        struct ib_agent_port_private *entry;
        unsigned long flags;
 
        spin_lock_irqsave(&ib_agent_port_list_lock, flags);
-       entry = __ib_get_agent_port(device, port_num, mad_agent);
+       entry = __ib_get_agent_port(device, port_num);
        spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
-
        return entry;
 }
 
-int smi_check_local_dr_smp(struct ib_smp *smp,
-                          struct ib_device *device,
-                          int port_num)
+int agent_send_response(struct ib_mad *mad, struct ib_grh *grh,
+                       struct ib_wc *wc, struct ib_device *device,
+                       int port_num, int qpn)
 {
        struct ib_agent_port_private *port_priv;
+       struct ib_mad_agent *agent;
+       struct ib_mad_send_buf *send_buf;
+       struct ib_ah *ah;
+       int ret;
 
-       if (smp->mgmt_class != IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE)
-               return 1;
-       port_priv = ib_get_agent_port(device, port_num, NULL);
+       port_priv = ib_get_agent_port(device, port_num);
        if (!port_priv) {
-               printk(KERN_DEBUG SPFX "smi_check_local_dr_smp %s port %d "
-                      "not open\n",
-                      device->name, port_num);
-               return 1;
-       }
-
-       return smi_check_local_smp(port_priv->smp_agent, smp);
-}
-
-static int agent_mad_send(struct ib_mad_agent *mad_agent,
-                         struct ib_agent_port_private *port_priv,
-                         struct ib_mad_private *mad_priv,
-                         struct ib_grh *grh,
-                         struct ib_wc *wc)
-{
-       struct ib_agent_send_wr *agent_send_wr;
-       struct ib_sge gather_list;
-       struct ib_send_wr send_wr;
-       struct ib_send_wr *bad_send_wr;
-       struct ib_ah_attr ah_attr;
-       unsigned long flags;
-       int ret = 1;
-
-       agent_send_wr = kmalloc(sizeof(*agent_send_wr), GFP_KERNEL);
-       if (!agent_send_wr)
-               goto out;
-       agent_send_wr->mad = mad_priv;
-
-       gather_list.addr = dma_map_single(mad_agent->device->dma_device,
-                                         &mad_priv->mad,
-                                         sizeof(mad_priv->mad),
-                                         DMA_TO_DEVICE);
-       gather_list.length = sizeof(mad_priv->mad);
-       gather_list.lkey = (*port_priv->mr).lkey;
-
-       send_wr.next = NULL;
-       send_wr.opcode = IB_WR_SEND;
-       send_wr.sg_list = &gather_list;
-       send_wr.num_sge = 1;
-       send_wr.wr.ud.remote_qpn = wc->src_qp; /* DQPN */
-       send_wr.wr.ud.timeout_ms = 0;
-       send_wr.send_flags = IB_SEND_SIGNALED | IB_SEND_SOLICITED;
-
-       ah_attr.dlid = wc->slid;
-       ah_attr.port_num = mad_agent->port_num;
-       ah_attr.src_path_bits = wc->dlid_path_bits;
-       ah_attr.sl = wc->sl;
-       ah_attr.static_rate = 0;
-       ah_attr.ah_flags = 0; /* No GRH */
-       if (mad_priv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {
-               if (wc->wc_flags & IB_WC_GRH) {
-                       ah_attr.ah_flags = IB_AH_GRH;
-                       /* Should sgid be looked up ? */
-                       ah_attr.grh.sgid_index = 0;
-                       ah_attr.grh.hop_limit = grh->hop_limit;
-                       ah_attr.grh.flow_label = be32_to_cpup(
-                               &grh->version_tclass_flow)  & 0xfffff;
-                       ah_attr.grh.traffic_class = (be32_to_cpup(
-                               &grh->version_tclass_flow) >> 20) & 0xff;
-                       memcpy(ah_attr.grh.dgid.raw,
-                              grh->sgid.raw,
-                              sizeof(ah_attr.grh.dgid));
-               }
+               printk(KERN_ERR SPFX "Unable to find port agent\n");
+               return -ENODEV;
        }
 
-       agent_send_wr->ah = ib_create_ah(mad_agent->qp->pd, &ah_attr);
-       if (IS_ERR(agent_send_wr->ah)) {
-               printk(KERN_ERR SPFX "No memory for address handle\n");
-               kfree(agent_send_wr);
-               goto out;
+       agent = port_priv->agent[qpn];
+       ah = ib_create_ah_from_wc(agent->qp->pd, wc, grh, port_num);
+       if (IS_ERR(ah)) {
+               ret = PTR_ERR(ah);
+               printk(KERN_ERR SPFX "ib_create_ah_from_wc error:%d\n", ret);
+               return ret;
        }
 
-       send_wr.wr.ud.ah = agent_send_wr->ah;
-       if (mad_priv->mad.mad.mad_hdr.mgmt_class == IB_MGMT_CLASS_PERF_MGMT) {
-               send_wr.wr.ud.pkey_index = wc->pkey_index;
-               send_wr.wr.ud.remote_qkey = IB_QP1_QKEY;
-       } else {        /* for SMPs */
-               send_wr.wr.ud.pkey_index = 0;
-               send_wr.wr.ud.remote_qkey = 0;
+       send_buf = ib_create_send_mad(agent, wc->src_qp, wc->pkey_index, 0,
+                                     IB_MGMT_MAD_HDR, IB_MGMT_MAD_DATA,
+                                     GFP_KERNEL);
+       if (IS_ERR(send_buf)) {
+               ret = PTR_ERR(send_buf);
+               printk(KERN_ERR SPFX "ib_create_send_mad error:%d\n", ret);
+               goto err1;
        }
-       send_wr.wr.ud.mad_hdr = &mad_priv->mad.mad.mad_hdr;
-       send_wr.wr_id = (unsigned long)agent_send_wr;
 
-       pci_unmap_addr_set(agent_send_wr, mapping, gather_list.addr);
-
-       /* Send */
-       spin_lock_irqsave(&port_priv->send_list_lock, flags);
-       if (ib_post_send_mad(mad_agent, &send_wr, &bad_send_wr)) {
-               spin_unlock_irqrestore(&port_priv->send_list_lock, flags);
-               dma_unmap_single(mad_agent->device->dma_device,
-                                pci_unmap_addr(agent_send_wr, mapping),
-                                sizeof(mad_priv->mad),
-                                DMA_TO_DEVICE);
-               ib_destroy_ah(agent_send_wr->ah);
-               kfree(agent_send_wr);
-       } else {
-               list_add_tail(&agent_send_wr->send_list,
-                             &port_priv->send_posted_list);
-               spin_unlock_irqrestore(&port_priv->send_list_lock, flags);
-               ret = 0;
+       memcpy(send_buf->mad, mad, sizeof *mad);
+       send_buf->ah = ah;
+       if ((ret = ib_post_send_mad(send_buf, NULL))) {
+               printk(KERN_ERR SPFX "ib_post_send_mad error:%d\n", ret);
+               goto err2;
        }
-
-out:
+       return 0;
+err2:
+       ib_free_send_mad(send_buf);
+err1:
+       ib_destroy_ah(ah);
        return ret;
 }
 
-int agent_send(struct ib_mad_private *mad,
-              struct ib_grh *grh,
-              struct ib_wc *wc,
-              struct ib_device *device,
-              int port_num)
-{
-       struct ib_agent_port_private *port_priv;
-       struct ib_mad_agent *mad_agent;
-
-       port_priv = ib_get_agent_port(device, port_num, NULL);
-       if (!port_priv) {
-               printk(KERN_DEBUG SPFX "agent_send %s port %d not open\n",
-                      device->name, port_num);
-               return 1;
-       }
-
-       /* Get mad agent based on mgmt_class in MAD */
-       switch (mad->mad.mad.mad_hdr.mgmt_class) {
-               case IB_MGMT_CLASS_SUBN_DIRECTED_ROUTE:
-               case IB_MGMT_CLASS_SUBN_LID_ROUTED:
-                       mad_agent = port_priv->smp_agent;
-                       break;
-               case IB_MGMT_CLASS_PERF_MGMT:
-                       mad_agent = port_priv->perf_mgmt_agent;
-                       break;
-               default:
-                       return 1;
-       }
-
-       return agent_mad_send(mad_agent, port_priv, mad, grh, wc);
-}
-
 static void agent_send_handler(struct ib_mad_agent *mad_agent,
                               struct ib_mad_send_wc *mad_send_wc)
 {
-       struct ib_agent_port_private    *port_priv;
-       struct ib_agent_send_wr         *agent_send_wr;
-       unsigned long                   flags;
-
-       /* Find matching MAD agent */
-       port_priv = ib_get_agent_port(NULL, 0, mad_agent);
-       if (!port_priv) {
-               printk(KERN_ERR SPFX "agent_send_handler: no matching MAD "
-                      "agent %p\n", mad_agent);
-               return;
-       }
-
-       agent_send_wr = (struct ib_agent_send_wr *)(unsigned long)mad_send_wc->wr_id;
-       spin_lock_irqsave(&port_priv->send_list_lock, flags);
-       /* Remove completed send from posted send MAD list */
-       list_del(&agent_send_wr->send_list);
-       spin_unlock_irqrestore(&port_priv->send_list_lock, flags);
-
-       dma_unmap_single(mad_agent->device->dma_device,
-                        pci_unmap_addr(agent_send_wr, mapping),
-                        sizeof(agent_send_wr->mad->mad),
-                        DMA_TO_DEVICE);
-
-       ib_destroy_ah(agent_send_wr->ah);
-
-       /* Release allocated memory */
-       kmem_cache_free(ib_mad_cache, agent_send_wr->mad);
-       kfree(agent_send_wr);
+       ib_destroy_ah(mad_send_wc->send_buf->ah);
+       ib_free_send_mad(mad_send_wc->send_buf);
 }
 
 int ib_agent_port_open(struct ib_device *device, int port_num)
 {
-       int ret;
        struct ib_agent_port_private *port_priv;
        unsigned long flags;
-
-       /* First, check if port already open for SMI */
-       port_priv = ib_get_agent_port(device, port_num, NULL);
-       if (port_priv) {
-               printk(KERN_DEBUG SPFX "%s port %d already open\n",
-                      device->name, port_num);
-               return 0;
-       }
+       int ret;
 
        /* Create new device info */
-       port_priv = kmalloc(sizeof *port_priv, GFP_KERNEL);
+       port_priv = kzalloc(sizeof *port_priv, GFP_KERNEL);
        if (!port_priv) {
                printk(KERN_ERR SPFX "No memory for ib_agent_port_private\n");
                ret = -ENOMEM;
                goto error1;
        }
 
-       memset(port_priv, 0, sizeof *port_priv);
-       port_priv->port_num = port_num;
-       spin_lock_init(&port_priv->send_list_lock);
-       INIT_LIST_HEAD(&port_priv->send_posted_list);
-
-       /* Obtain send only MAD agent for SM class (SMI QP) */
-       port_priv->smp_agent = ib_register_mad_agent(device, port_num,
-                                                    IB_QPT_SMI,
-                                                    NULL, 0,
+       /* Obtain send only MAD agent for SMI QP */
+       port_priv->agent[0] = ib_register_mad_agent(device, port_num,
+                                                   IB_QPT_SMI, NULL, 0,
                                                    &agent_send_handler,
-                                                    NULL, NULL);
-
-       if (IS_ERR(port_priv->smp_agent)) {
-               ret = PTR_ERR(port_priv->smp_agent);
+                                                   NULL, NULL);
+       if (IS_ERR(port_priv->agent[0])) {
+               ret = PTR_ERR(port_priv->agent[0]);
                goto error2;
        }
 
-       /* Obtain send only MAD agent for PerfMgmt class (GSI QP) */
-       port_priv->perf_mgmt_agent = ib_register_mad_agent(device, port_num,
-                                                          IB_QPT_GSI,
-                                                          NULL, 0,
-                                                         &agent_send_handler,
-                                                          NULL, NULL);
-       if (IS_ERR(port_priv->perf_mgmt_agent)) {
-               ret = PTR_ERR(port_priv->perf_mgmt_agent);
+       /* Obtain send only MAD agent for GSI QP */
+       port_priv->agent[1] = ib_register_mad_agent(device, port_num,
+                                                   IB_QPT_GSI, NULL, 0,
+                                                   &agent_send_handler,
+                                                   NULL, NULL);
+       if (IS_ERR(port_priv->agent[1])) {
+               ret = PTR_ERR(port_priv->agent[1]);
                goto error3;
        }
 
-       port_priv->mr = ib_get_dma_mr(port_priv->smp_agent->qp->pd,
-                                     IB_ACCESS_LOCAL_WRITE);
-       if (IS_ERR(port_priv->mr)) {
-               printk(KERN_ERR SPFX "Couldn't get DMA MR\n");
-               ret = PTR_ERR(port_priv->mr);
-               goto error4;
-       }
-
        spin_lock_irqsave(&ib_agent_port_list_lock, flags);
        list_add_tail(&port_priv->port_list, &ib_agent_port_list);
        spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
 
        return 0;
 
-error4:
-       ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
 error3:
-       ib_unregister_mad_agent(port_priv->smp_agent);
+       ib_unregister_mad_agent(port_priv->agent[0]);
 error2:
        kfree(port_priv);
 error1:
@@ -352,7 +186,7 @@ int ib_agent_port_close(struct ib_device *device, int port_num)
        unsigned long flags;
 
        spin_lock_irqsave(&ib_agent_port_list_lock, flags);
-       port_priv = __ib_get_agent_port(device, port_num, NULL);
+       port_priv = __ib_get_agent_port(device, port_num);
        if (port_priv == NULL) {
                spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
                printk(KERN_ERR SPFX "Port %d not found\n", port_num);
@@ -361,11 +195,8 @@ int ib_agent_port_close(struct ib_device *device, int port_num)
        list_del(&port_priv->port_list);
        spin_unlock_irqrestore(&ib_agent_port_list_lock, flags);
 
-       ib_dereg_mr(port_priv->mr);
-
-       ib_unregister_mad_agent(port_priv->perf_mgmt_agent);
-       ib_unregister_mad_agent(port_priv->smp_agent);
+       ib_unregister_mad_agent(port_priv->agent[1]);
+       ib_unregister_mad_agent(port_priv->agent[0]);
        kfree(port_priv);
-
        return 0;
 }
index 9197e92..b2f3cb9 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -37,8 +38,7 @@
 #include <linux/errno.h>
 #include <linux/slab.h>
 #include <linux/init.h>
-
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
 
 #include "core_priv.h"
 
@@ -56,13 +56,13 @@ static LIST_HEAD(device_list);
 static LIST_HEAD(client_list);
 
 /*
- * device_sem protects access to both device_list and client_list.
+ * device_mutex protects access to both device_list and client_list.
  * There's no real point to using multiple locks or something fancier
  * like an rwsem: we always access both lists, and we're always
  * modifying one list or the other list.  In any case this is not a
  * hot path so there's no point in trying to optimize.
  */
-static DECLARE_MUTEX(device_sem);
+static DEFINE_MUTEX(device_mutex);
 
 static int ib_device_check_mandatory(struct ib_device *device)
 {
@@ -160,17 +160,9 @@ static int alloc_name(char *name)
  */
 struct ib_device *ib_alloc_device(size_t size)
 {
-       void *dev;
-
        BUG_ON(size < sizeof (struct ib_device));
 
-       dev = kmalloc(size, GFP_KERNEL);
-       if (!dev)
-               return NULL;
-
-       memset(dev, 0, size);
-
-       return dev;
+       return kzalloc(size, GFP_KERNEL);
 }
 EXPORT_SYMBOL(ib_alloc_device);
 
@@ -228,7 +220,7 @@ int ib_register_device(struct ib_device *device)
 {
        int ret;
 
-       down(&device_sem);
+       mutex_lock(&device_mutex);
 
        if (strchr(device->name, '%')) {
                ret = alloc_name(device->name);
@@ -266,7 +258,7 @@ int ib_register_device(struct ib_device *device)
        }
 
  out:
-       up(&device_sem);
+       mutex_unlock(&device_mutex);
        return ret;
 }
 EXPORT_SYMBOL(ib_register_device);
@@ -283,7 +275,7 @@ void ib_unregister_device(struct ib_device *device)
        struct ib_client_data *context, *tmp;
        unsigned long flags;
 
-       down(&device_sem);
+       mutex_lock(&device_mutex);
 
        list_for_each_entry_reverse(client, &client_list, list)
                if (client->remove)
@@ -291,7 +283,7 @@ void ib_unregister_device(struct ib_device *device)
 
        list_del(&device->core_list);
 
-       up(&device_sem);
+       mutex_unlock(&device_mutex);
 
        spin_lock_irqsave(&device->client_data_lock, flags);
        list_for_each_entry_safe(context, tmp, &device->client_data_list, list)
@@ -319,14 +311,14 @@ int ib_register_client(struct ib_client *client)
 {
        struct ib_device *device;
 
-       down(&device_sem);
+       mutex_lock(&device_mutex);
 
        list_add_tail(&client->list, &client_list);
        list_for_each_entry(device, &device_list, core_list)
                if (client->add && !add_client_context(device, client))
                        client->add(device);
 
-       up(&device_sem);
+       mutex_unlock(&device_mutex);
 
        return 0;
 }
@@ -346,7 +338,7 @@ void ib_unregister_client(struct ib_client *client)
        struct ib_device *device;
        unsigned long flags;
 
-       down(&device_sem);
+       mutex_lock(&device_mutex);
 
        list_for_each_entry(device, &device_list, core_list) {
                if (client->remove)
@@ -362,7 +354,7 @@ void ib_unregister_client(struct ib_client *client)
        }
        list_del(&client->list);
 
-       up(&device_sem);
+       mutex_unlock(&device_mutex);
 }
 EXPORT_SYMBOL(ib_unregister_client);
 
@@ -513,6 +505,12 @@ int ib_query_port(struct ib_device *device,
                  u8 port_num,
                  struct ib_port_attr *port_attr)
 {
+       if (device->node_type == IB_NODE_SWITCH) {
+               if (port_num)
+                       return -EINVAL;
+       } else if (port_num < 1 || port_num > device->phys_port_cnt)
+               return -EINVAL;
+
        return device->query_port(device, port_num, port_attr);
 }
 EXPORT_SYMBOL(ib_query_port);
@@ -582,6 +580,12 @@ int ib_modify_port(struct ib_device *device,
                   u8 port_num, int port_modify_mask,
                   struct ib_port_modify *port_modify)
 {
+       if (device->node_type == IB_NODE_SWITCH) {
+               if (port_num)
+                       return -EINVAL;
+       } else if (port_num < 1 || port_num > device->phys_port_cnt)
+               return -EINVAL;
+
        return device->modify_port(device, port_num, port_modify_mask,
                                   port_modify);
 }
index b4b2843..35852e7 100644 (file)
@@ -1,9 +1,10 @@
 /*
- * Copyright (c) 2004 Mellanox Technologies Ltd.  All rights reserved.
- * Copyright (c) 2004 Infinicon Corporation.  All rights reserved.
- * Copyright (c) 2004 Intel Corporation.  All rights reserved.
- * Copyright (c) 2004 Topspin Corporation.  All rights reserved.
- * Copyright (c) 2004 Voltaire Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2004, 2005 Infinicon Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Intel Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Topspin Corporation.  All rights reserved.
+ * Copyright (c) 2004, 2005 Voltaire Corporation.  All rights reserved.
+ * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -36,7 +37,7 @@
  * $Id: smi.c 1389 2004-12-27 22:56:47Z roland $
  */
 
-#include <ib_smi.h>
+#include <rdma/ib_smi.h>
 #include "smi.h"
 
 /*
index db25503..3011bfd 100644 (file)
@@ -39,6 +39,8 @@
 #ifndef __SMI_H_
 #define __SMI_H_
 
+#include <rdma/ib_smi.h>
+
 int smi_handle_dr_smp_recv(struct ib_smp *smp,
                           u8 node_type,
                           int port_num,
@@ -47,19 +49,16 @@ extern int smi_check_forward_dr_smp(struct ib_smp *smp);
 extern int smi_handle_dr_smp_send(struct ib_smp *smp,
                                  u8 node_type,
                                  int port_num);
-extern int smi_check_local_dr_smp(struct ib_smp *smp,
-                                 struct ib_device *device,
-                                 int port_num);
 
 /*
  * Return 1 if the SMP should be handled by the local SMA/SM via process_mad
  */
-static inline int smi_check_local_smp(struct ib_mad_agent *mad_agent,
-                                     struct ib_smp *smp)
+static inline int smi_check_local_smp(struct ib_smp *smp,
+                                     struct ib_device *device)
 {
        /* C14-9:3 -- We're at the end of the DR segment of path */
        /* C14-9:4 -- Hop Pointer = Hop Count + 1 -> give to SMA/SM */
-       return ((mad_agent->device->process_mad &&
+       return ((device->process_mad &&
                !ib_get_smp_direction(smp) &&
                (smp->hop_ptr == smp->hop_cnt + 1)));
 }
index 3a413f7..21f9282 100644 (file)
@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies Ltd.  All rights reserved.
+ * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
 
 #include "core_priv.h"
 
-#include <ib_mad.h>
+#include <linux/slab.h>
+#include <linux/string.h>
+
+#include <rdma/ib_mad.h>
 
 struct ib_port {
        struct kobject         kobj;
        struct ib_device      *ibdev;
        struct attribute_group gid_group;
-       struct attribute     **gid_attr;
        struct attribute_group pkey_group;
-       struct attribute     **pkey_attr;
        u8                     port_num;
 };
 
@@ -60,10 +63,16 @@ struct port_attribute port_attr_##_name = __ATTR(_name, _mode, _show, _store)
 struct port_attribute port_attr_##_name = __ATTR_RO(_name)
 
 struct port_table_attribute {
-       struct port_attribute attr;
-       int                   index;
+       struct port_attribute   attr;
+       char                    name[8];
+       int                     index;
 };
 
+static inline int ibdev_is_alive(const struct ib_device *dev) 
+{
+       return dev->reg_state == IB_DEV_REGISTERED;
+}
+
 static ssize_t port_attr_show(struct kobject *kobj,
                              struct attribute *attr, char *buf)
 {
@@ -72,7 +81,9 @@ static ssize_t port_attr_show(struct kobject *kobj,
        struct ib_port *p = container_of(kobj, struct ib_port, kobj);
 
        if (!port_attr->show)
-               return 0;
+               return -EIO;
+       if (!ibdev_is_alive(p->ibdev))
+               return -ENODEV;
 
        return port_attr->show(p, port_attr, buf);
 }
@@ -101,7 +112,7 @@ static ssize_t state_show(struct ib_port *p, struct port_attribute *unused,
                return ret;
 
        return sprintf(buf, "%d: %s\n", attr.state,
-                      attr.state >= 0 && attr.state <= ARRAY_SIZE(state_name) ?
+                      attr.state >= 0 && attr.state < ARRAY_SIZE(state_name) ?
                       state_name[attr.state] : "UNKNOWN");
 }
 
@@ -254,14 +265,14 @@ static ssize_t show_port_gid(struct ib_port *p, struct port_attribute *attr,
                return ret;
 
        return sprintf(buf, "%04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x\n",
-                      be16_to_cpu(((u16 *) gid.raw)[0]),
-                      be16_to_cpu(((u16 *) gid.raw)[1]),
-                      be16_to_cpu(((u16 *) gid.raw)[2]),
-                      be16_to_cpu(((u16 *) gid.raw)[3]),
-                      be16_to_cpu(((u16 *) gid.raw)[4]),
-                      be16_to_cpu(((u16 *) gid.raw)[5]),
-                      be16_to_cpu(((u16 *) gid.raw)[6]),
-                      be16_to_cpu(((u16 *) gid.raw)[7]));
+                      be16_to_cpu(((__be16 *) gid.raw)[0]),
+                      be16_to_cpu(((__be16 *) gid.raw)[1]),
+                      be16_to_cpu(((__be16 *) gid.raw)[2]),
+                      be16_to_cpu(((__be16 *) gid.raw)[3]),
+                      be16_to_cpu(((__be16 *) gid.raw)[4]),
+                      be16_to_cpu(((__be16 *) gid.raw)[5]),
+                      be16_to_cpu(((__be16 *) gid.raw)[6]),
+                      be16_to_cpu(((__be16 *) gid.raw)[7]));
 }
 
 static ssize_t show_port_pkey(struct ib_port *p, struct port_attribute *attr,
@@ -299,14 +310,13 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
        if (!p->ibdev->process_mad)
                return sprintf(buf, "N/A (no PMA)\n");
 
-       in_mad  = kmalloc(sizeof *in_mad, GFP_KERNEL);
+       in_mad  = kzalloc(sizeof *in_mad, GFP_KERNEL);
        out_mad = kmalloc(sizeof *in_mad, GFP_KERNEL);
        if (!in_mad || !out_mad) {
                ret = -ENOMEM;
                goto out;
        }
 
-       memset(in_mad, 0, sizeof *in_mad);
        in_mad->mad_hdr.base_version  = 1;
        in_mad->mad_hdr.mgmt_class    = IB_MGMT_CLASS_PERF_MGMT;
        in_mad->mad_hdr.class_version = 1;
@@ -326,18 +336,18 @@ static ssize_t show_pma_counter(struct ib_port *p, struct port_attribute *attr,
        switch (width) {
        case 4:
                ret = sprintf(buf, "%u\n", (out_mad->data[40 + offset / 8] >>
-                                           (offset % 4)) & 0xf);
+                                           (4 - (offset % 8))) & 0xf);
                break;
        case 8:
                ret = sprintf(buf, "%u\n", out_mad->data[40 + offset / 8]);
                break;
        case 16:
                ret = sprintf(buf, "%u\n",
-                             be16_to_cpup((u16 *)(out_mad->data + 40 + offset / 8)));
+                             be16_to_cpup((__be16 *)(out_mad->data + 40 + offset / 8)));
                break;
        case 32:
                ret = sprintf(buf, "%u\n",
-                             be32_to_cpup((u32 *)(out_mad->data + 40 + offset / 8)));
+                             be32_to_cpup((__be32 *)(out_mad->data + 40 + offset / 8)));
                break;
        default:
                ret = 0;
@@ -398,17 +408,16 @@ static void ib_port_release(struct kobject *kobj)
        struct attribute *a;
        int i;
 
-       for (i = 0; (a = p->gid_attr[i]); ++i) {
-               kfree(a->name);
+       for (i = 0; (a = p->gid_group.attrs[i]); ++i)
                kfree(a);
-       }
 
-       for (i = 0; (a = p->pkey_attr[i]); ++i) {
-               kfree(a->name);
+       kfree(p->gid_group.attrs);
+
+       for (i = 0; (a = p->pkey_group.attrs[i]); ++i)
                kfree(a);
-       }
 
-       kfree(p->gid_attr);
+       kfree(p->pkey_group.attrs);
+
        kfree(p);
 }
 
@@ -425,82 +434,65 @@ static void ib_device_release(struct class_device *cdev)
        kfree(dev);
 }
 
-static int ib_device_hotplug(struct class_device *cdev, char **envp,
-                            int num_envp, char *buf, int size)
+static int ib_device_uevent(struct class_device *cdev, char **envp,
+                           int num_envp, char *buf, int size)
 {
        struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
        int i = 0, len = 0;
 
-       if (add_hotplug_env_var(envp, num_envp, &i, buf, size, &len,
-                               "NAME=%s", dev->name))
+       if (add_uevent_var(envp, num_envp, &i, buf, size, &len,
+                          "NAME=%s", dev->name))
                return -ENOMEM;
 
        /*
-        * It might be nice to pass the node GUID to hotplug, but
-        * right now the only way to get it is to query the device
-        * provider, and this can crash during device removal because
-        * we are will be running after driver removal has started.
-        * We could add a node_guid field to struct ib_device, or we
-        * could just let the hotplug script read the node GUID from
-        * sysfs when devices are added.
+        * It would be nice to pass the node GUID with the event...
         */
 
        envp[i] = NULL;
        return 0;
 }
 
-static int alloc_group(struct attribute ***attr,
-                      ssize_t (*show)(struct ib_port *,
-                                      struct port_attribute *, char *buf),
-                      int len)
+static struct attribute **
+alloc_group_attrs(ssize_t (*show)(struct ib_port *,
+                                 struct port_attribute *, char *buf),
+                 int len)
 {
-       struct port_table_attribute ***tab_attr =
-               (struct port_table_attribute ***) attr;
+       struct attribute **tab_attr;
+       struct port_table_attribute *element;
        int i;
-       int ret;
-
-       *tab_attr = kmalloc((1 + len) * sizeof *tab_attr, GFP_KERNEL);
-       if (!*tab_attr)
-               return -ENOMEM;
 
-       memset(*tab_attr, 0, (1 + len) * sizeof *tab_attr);
+       tab_attr = kcalloc(1 + len, sizeof(struct attribute *), GFP_KERNEL);
+       if (!tab_attr)
+               return NULL;
 
-       for (i = 0; i < len; ++i) {
-               (*tab_attr)[i] = kmalloc(sizeof *(*tab_attr)[i], GFP_KERNEL);
-               if (!(*tab_attr)[i]) {
-                       ret = -ENOMEM;
-                       goto err;
-               }
-               memset((*tab_attr)[i], 0, sizeof *(*tab_attr)[i]);
-               (*tab_attr)[i]->attr.attr.name = kmalloc(8, GFP_KERNEL);
-               if (!(*tab_attr)[i]->attr.attr.name) {
-                       ret = -ENOMEM;
+       for (i = 0; i < len; i++) {
+               element = kzalloc(sizeof(struct port_table_attribute),
+                                 GFP_KERNEL);
+               if (!element)
                        goto err;
-               }
 
-               if (snprintf((*tab_attr)[i]->attr.attr.name, 8, "%d", i) >= 8) {
-                       ret = -ENOMEM;
+               if (snprintf(element->name, sizeof(element->name),
+                            "%d", i) >= sizeof(element->name)) {
+                       kfree(element);
                        goto err;
                }
 
-               (*tab_attr)[i]->attr.attr.mode  = S_IRUGO;
-               (*tab_attr)[i]->attr.attr.owner = THIS_MODULE;
-               (*tab_attr)[i]->attr.show       = show;
-               (*tab_attr)[i]->index           = i;
-       }
-
-       return 0;
+               element->attr.attr.name  = element->name;
+               element->attr.attr.mode  = S_IRUGO;
+               element->attr.attr.owner = THIS_MODULE;
+               element->attr.show       = show;
+               element->index           = i;
 
-err:
-       for (i = 0; i < len; ++i) {
-               if ((*tab_attr)[i])
-                       kfree((*tab_attr)[i]->attr.attr.name);
-               kfree((*tab_attr)[i]);
+               tab_attr[i] = &element->attr.attr;
        }
 
-       kfree(*tab_attr);
+       return tab_attr;
 
-       return ret;
+err:
+       while (--i >= 0)
+               kfree(tab_attr[i]);
+       kfree(tab_attr);
+       return NULL;
 }
 
 static int add_port(struct ib_device *device, int port_num)
@@ -514,10 +506,9 @@ static int add_port(struct ib_device *device, int port_num)
        if (ret)
                return ret;
 
-       p = kmalloc(sizeof *p, GFP_KERNEL);
+       p = kzalloc(sizeof *p, GFP_KERNEL);
        if (!p)
                return -ENOMEM;
-       memset(p, 0, sizeof *p);
 
        p->ibdev      = device;
        p->port_num   = port_num;
@@ -541,23 +532,20 @@ static int add_port(struct ib_device *device, int port_num)
        if (ret)
                goto err_put;
 
-       ret = alloc_group(&p->gid_attr, show_port_gid, attr.gid_tbl_len);
-       if (ret)
-               goto err_remove_pma;
-
        p->gid_group.name  = "gids";
-       p->gid_group.attrs = p->gid_attr;
+       p->gid_group.attrs = alloc_group_attrs(show_port_gid, attr.gid_tbl_len);
+       if (!p->gid_group.attrs)
+               goto err_remove_pma;
 
        ret = sysfs_create_group(&p->kobj, &p->gid_group);
        if (ret)
                goto err_free_gid;
 
-       ret = alloc_group(&p->pkey_attr, show_port_pkey, attr.pkey_tbl_len);
-       if (ret)
-               goto err_remove_gid;
-
        p->pkey_group.name  = "pkeys";
-       p->pkey_group.attrs = p->pkey_attr;
+       p->pkey_group.attrs = alloc_group_attrs(show_port_pkey,
+                                               attr.pkey_tbl_len);
+       if (!p->pkey_group.attrs)
+               goto err_remove_gid;
 
        ret = sysfs_create_group(&p->kobj, &p->pkey_group);
        if (ret)
@@ -568,23 +556,19 @@ static int add_port(struct ib_device *device, int port_num)
        return 0;
 
 err_free_pkey:
-       for (i = 0; i < attr.pkey_tbl_len; ++i) {
-               kfree(p->pkey_attr[i]->name);
-               kfree(p->pkey_attr[i]);
-       }
+       for (i = 0; i < attr.pkey_tbl_len; ++i)
+               kfree(p->pkey_group.attrs[i]);
 
-       kfree(p->pkey_attr);
+       kfree(p->pkey_group.attrs);
 
 err_remove_gid:
        sysfs_remove_group(&p->kobj, &p->gid_group);
 
 err_free_gid:
-       for (i = 0; i < attr.gid_tbl_len; ++i) {
-               kfree(p->gid_attr[i]->name);
-               kfree(p->gid_attr[i]);
-       }
+       for (i = 0; i < attr.gid_tbl_len; ++i)
+               kfree(p->gid_group.attrs[i]);
 
-       kfree(p->gid_attr);
+       kfree(p->gid_group.attrs);
 
 err_remove_pma:
        sysfs_remove_group(&p->kobj, &pma_group);
@@ -601,6 +585,9 @@ static ssize_t show_node_type(struct class_device *cdev, char *buf)
 {
        struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
 
+       if (!ibdev_is_alive(dev))
+               return -ENODEV;
+
        switch (dev->node_type) {
        case IB_NODE_CA:     return sprintf(buf, "%d: CA\n", dev->node_type);
        case IB_NODE_SWITCH: return sprintf(buf, "%d: switch\n", dev->node_type);
@@ -615,48 +602,76 @@ static ssize_t show_sys_image_guid(struct class_device *cdev, char *buf)
        struct ib_device_attr attr;
        ssize_t ret;
 
+       if (!ibdev_is_alive(dev))
+               return -ENODEV;
+
        ret = ib_query_device(dev, &attr);
        if (ret)
                return ret;
 
        return sprintf(buf, "%04x:%04x:%04x:%04x\n",
-                      be16_to_cpu(((u16 *) &attr.sys_image_guid)[0]),
-                      be16_to_cpu(((u16 *) &attr.sys_image_guid)[1]),
-                      be16_to_cpu(((u16 *) &attr.sys_image_guid)[2]),
-                      be16_to_cpu(((u16 *) &attr.sys_image_guid)[3]));
+                      be16_to_cpu(((__be16 *) &attr.sys_image_guid)[0]),
+                      be16_to_cpu(((__be16 *) &attr.sys_image_guid)[1]),
+                      be16_to_cpu(((__be16 *) &attr.sys_image_guid)[2]),
+                      be16_to_cpu(((__be16 *) &attr.sys_image_guid)[3]));
 }
 
 static ssize_t show_node_guid(struct class_device *cdev, char *buf)
 {
        struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
-       struct ib_device_attr attr;
-       ssize_t ret;
 
-       ret = ib_query_device(dev, &attr);
+       if (!ibdev_is_alive(dev))
+               return -ENODEV;
+
+       return sprintf(buf, "%04x:%04x:%04x:%04x\n",
+                      be16_to_cpu(((__be16 *) &dev->node_guid)[0]),
+                      be16_to_cpu(((__be16 *) &dev->node_guid)[1]),
+                      be16_to_cpu(((__be16 *) &dev->node_guid)[2]),
+                      be16_to_cpu(((__be16 *) &dev->node_guid)[3]));
+}
+
+static ssize_t show_node_desc(struct class_device *cdev, char *buf)
+{
+       struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
+
+       return sprintf(buf, "%.64s\n", dev->node_desc);
+}
+
+static ssize_t set_node_desc(struct class_device *cdev, const char *buf,
+                             size_t count)
+{
+       struct ib_device *dev = container_of(cdev, struct ib_device, class_dev);
+       struct ib_device_modify desc = {};
+       int ret;
+
+       if (!dev->modify_device)
+               return -EIO;
+
+       memcpy(desc.node_desc, buf, min_t(int, count, 64));
+       ret = ib_modify_device(dev, IB_DEVICE_MODIFY_NODE_DESC, &desc);
        if (ret)
                return ret;
 
-       return sprintf(buf, "%04x:%04x:%04x:%04x\n",
-                      be16_to_cpu(((u16 *) &attr.node_guid)[0]),
-                      be16_to_cpu(((u16 *) &attr.node_guid)[1]),
-                      be16_to_cpu(((u16 *) &attr.node_guid)[2]),
-                      be16_to_cpu(((u16 *) &attr.node_guid)[3]));
+       return count;
 }
 
 static CLASS_DEVICE_ATTR(node_type, S_IRUGO, show_node_type, NULL);
 static CLASS_DEVICE_ATTR(sys_image_guid, S_IRUGO, show_sys_image_guid, NULL);
 static CLASS_DEVICE_ATTR(node_guid, S_IRUGO, show_node_guid, NULL);
+static CLASS_DEVICE_ATTR(node_desc, S_IRUGO | S_IWUSR, show_node_desc,
+                        set_node_desc);
 
 static struct class_device_attribute *ib_class_attributes[] = {
        &class_device_attr_node_type,
        &class_device_attr_sys_image_guid,
-       &class_device_attr_node_guid
+       &class_device_attr_node_guid,
+       &class_device_attr_node_desc
 };
 
 static struct class ib_class = {
        .name    = "infiniband",
        .release = ib_device_release,
-       .hotplug = ib_device_hotplug,
+       .uevent = ib_device_uevent,
 };
 
 int ib_device_register_sysfs(struct ib_device *device)
index e88be85..9aa5a44 100644 (file)
@@ -7,10 +7,11 @@ config INFINIBAND_MTHCA
          ("Tavor") and the MT25208 PCI Express HCA ("Arbel").
 
 config INFINIBAND_MTHCA_DEBUG
-       bool "Verbose debugging output"
+       bool "Verbose debugging output" if EMBEDDED
        depends on INFINIBAND_MTHCA
-       default n
+       default y
        ---help---
-         This option causes the mthca driver produce a bunch of debug
-         messages.  Select this is you are developing the driver or
-         trying to diagnose a problem.
+         This option causes debugging code to be compiled into the
+         mthca driver.  The output can be turned on via the
+         debug_level module parameter (which can also be set after
+         the driver is loaded through sysfs).
index 5dcbd43..e388d95 100644 (file)
@@ -1,12 +1,7 @@
-EXTRA_CFLAGS += -Idrivers/infiniband/include
-
-ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
-EXTRA_CFLAGS += -DDEBUG
-endif
-
 obj-$(CONFIG_INFINIBAND_MTHCA) += ib_mthca.o
 
 ib_mthca-y :=  mthca_main.o mthca_cmd.o mthca_profile.o mthca_reset.o \
                mthca_allocator.o mthca_eq.o mthca_pd.o mthca_cq.o \
                mthca_mr.o mthca_qp.o mthca_av.o mthca_mcg.o mthca_mad.o \
-               mthca_provider.o mthca_memfree.o mthca_uar.o
+               mthca_provider.o mthca_memfree.o mthca_uar.o mthca_srq.o \
+               mthca_catas.o
index adf039b..2f976f2 100644 (file)
@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2006 Cisco Systems.  All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
 #ifndef MTHCA_CMD_H
 #define MTHCA_CMD_H
 
-#include <ib_verbs.h>
+#include <rdma/ib_verbs.h>
 
-#define MTHCA_CMD_MAILBOX_ALIGN 16UL
-#define MTHCA_CMD_MAILBOX_EXTRA (MTHCA_CMD_MAILBOX_ALIGN - 1)
+#define MTHCA_MAILBOX_SIZE 4096
 
 enum {
        /* command completed successfully: */
@@ -73,9 +74,9 @@ enum {
        MTHCA_CMD_STAT_REG_BOUND      = 0x21,
        /* HCA local attached memory not present: */
        MTHCA_CMD_STAT_LAM_NOT_PRE    = 0x22,
-        /* Bad management packet (silently discarded): */
+       /* Bad management packet (silently discarded): */
        MTHCA_CMD_STAT_BAD_PKT        = 0x30,
-        /* More outstanding CQEs in CQ than new CQ size: */
+       /* More outstanding CQEs in CQ than new CQ size: */
        MTHCA_CMD_STAT_BAD_SIZE       = 0x40
 };
 
@@ -112,6 +113,11 @@ enum {
        DEV_LIM_FLAG_UD_MULTI           = 1 << 21,
 };
 
+struct mthca_mailbox {
+       dma_addr_t dma;
+       void      *buf;
+};
+
 struct mthca_dev_lim {
        int max_srq_sz;
        int max_qp_sz;
@@ -140,6 +146,7 @@ struct mthca_dev_lim {
        int max_vl;
        int num_ports;
        int max_gids;
+       u16 stat_rate_support;
        int max_pkeys;
        u32 flags;
        int reserved_uars;
@@ -179,10 +186,11 @@ struct mthca_dev_lim {
 };
 
 struct mthca_adapter {
-       u32 vendor_id;
-       u32 device_id;
-       u32 revision_id;
-       u8  inta_pin;
+       u32  vendor_id;
+       u32  device_id;
+       u32  revision_id;
+       char board_id[MTHCA_BOARD_ID_LEN];
+       u8   inta_pin;
 };
 
 struct mthca_init_hca_param {
@@ -214,8 +222,7 @@ struct mthca_init_hca_param {
 };
 
 struct mthca_init_ib_param {
-       int enable_1x;
-       int enable_4x;
+       int port_width;
        int vl_cap;
        int mtu_cap;
        u16 gid_cap;
@@ -235,11 +242,17 @@ struct mthca_set_ib_param {
        u32 cap_mask;
 };
 
+int mthca_cmd_init(struct mthca_dev *dev);
+void mthca_cmd_cleanup(struct mthca_dev *dev);
 int mthca_cmd_use_events(struct mthca_dev *dev);
 void mthca_cmd_use_polling(struct mthca_dev *dev);
 void mthca_cmd_event(struct mthca_dev *dev, u16 token,
                     u8  status, u64 out_param);
 
+struct mthca_mailbox *mthca_alloc_mailbox(struct mthca_dev *dev,
+                                         gfp_t gfp_mask);
+void mthca_free_mailbox(struct mthca_dev *dev, struct mthca_mailbox *mailbox);
+
 int mthca_SYS_EN(struct mthca_dev *dev, u8 *status);
 int mthca_SYS_DIS(struct mthca_dev *dev, u8 *status);
 int mthca_MAP_FA(struct mthca_dev *dev, struct mthca_icm *icm, u8 *status);
@@ -270,41 +283,49 @@ int mthca_MAP_ICM_AUX(struct mthca_dev *dev, struct mthca_icm *icm, u8 *status);
 int mthca_UNMAP_ICM_AUX(struct mthca_dev *dev, u8 *status);
 int mthca_SET_ICM_SIZE(struct mthca_dev *dev, u64 icm_size, u64 *aux_pages,
                       u8 *status);
-int mthca_SW2HW_MPT(struct mthca_dev *dev, void *mpt_entry,
+int mthca_SW2HW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
                    int mpt_index, u8 *status);
-int mthca_HW2SW_MPT(struct mthca_dev *dev, void *mpt_entry,
+int mthca_HW2SW_MPT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
                    int mpt_index, u8 *status);
-int mthca_WRITE_MTT(struct mthca_dev *dev, u64 *mtt_entry,
+int mthca_WRITE_MTT(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
                    int num_mtt, u8 *status);
 int mthca_SYNC_TPT(struct mthca_dev *dev, u8 *status);
 int mthca_MAP_EQ(struct mthca_dev *dev, u64 event_mask, int unmap,
                 int eq_num, u8 *status);
-int mthca_SW2HW_EQ(struct mthca_dev *dev, void *eq_context,
+int mthca_SW2HW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
                   int eq_num, u8 *status);
-int mthca_HW2SW_EQ(struct mthca_dev *dev, void *eq_context,
+int mthca_HW2SW_EQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
                   int eq_num, u8 *status);
-int mthca_SW2HW_CQ(struct mthca_dev *dev, void *cq_context,
+int mthca_SW2HW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
                   int cq_num, u8 *status);
-int mthca_HW2SW_CQ(struct mthca_dev *dev, void *cq_context,
+int mthca_HW2SW_CQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
                   int cq_num, u8 *status);
-int mthca_MODIFY_QP(struct mthca_dev *dev, int trans, u32 num,
-                   int is_ee, void *qp_context, u32 optmask,
+int mthca_RESIZE_CQ(struct mthca_dev *dev, int cq_num, u32 lkey, u8 log_size,
+                   u8 *status);
+int mthca_SW2HW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
+                   int srq_num, u8 *status);
+int mthca_HW2SW_SRQ(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
+                   int srq_num, u8 *status);
+int mthca_QUERY_SRQ(struct mthca_dev *dev, u32 num,
+                   struct mthca_mailbox *mailbox, u8 *status);
+int mthca_ARM_SRQ(struct mthca_dev *dev, int srq_num, int limit, u8 *status);
+int mthca_MODIFY_QP(struct mthca_dev *dev, enum ib_qp_state cur,
+                   enum ib_qp_state next, u32 num, int is_ee,
+                   struct mthca_mailbox *mailbox, u32 optmask,
                    u8 *status);
 int mthca_QUERY_QP(struct mthca_dev *dev, u32 num, int is_ee,
-                  void *qp_context, u8 *status);
+                  struct mthca_mailbox *mailbox, u8 *status);
 int mthca_CONF_SPECIAL_QP(struct mthca_dev *dev, int type, u32 qpn,
                          u8 *status);
 int mthca_MAD_IFC(struct mthca_dev *dev, int ignore_mkey, int ignore_bkey,
-                 int port, struct ib_wc* in_wc, struct ib_grh* in_grh,
+                 int port, struct ib_wc *in_wc, struct ib_grh *in_grh,
                  void *in_mad, void *response_mad, u8 *status);
-int mthca_READ_MGM(struct mthca_dev *dev, int index, void *mgm,
-                  u8 *status);
-int mthca_WRITE_MGM(struct mthca_dev *dev, int index, void *mgm,
-                   u8 *status);
-int mthca_MGID_HASH(struct mthca_dev *dev, void *gid, u16 *hash,
-                   u8 *status);
+int mthca_READ_MGM(struct mthca_dev *dev, int index,
+                  struct mthca_mailbox *mailbox, u8 *status);
+int mthca_WRITE_MGM(struct mthca_dev *dev, int index,
+                   struct mthca_mailbox *mailbox, u8 *status);
+int mthca_MGID_HASH(struct mthca_dev *dev, struct mthca_mailbox *mailbox,
+                   u16 *hash, u8 *status);
 int mthca_NOP(struct mthca_dev *dev, u8 *status);
 
-#define MAILBOX_ALIGN(x) ((void *) ALIGN((unsigned long) (x), MTHCA_CMD_MAILBOX_ALIGN))
-
 #endif /* MTHCA_CMD_H */
index e3d79e2..f8160b8 100644 (file)
@@ -1,5 +1,9 @@
 /*
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Sun Microsystems, Inc. All rights reserved.
+ * Copyright (c) 2005, 2006 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
+ * Copyright (c) 2004 Voltaire, Inc. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -39,6 +43,9 @@
 #include <linux/kernel.h>
 #include <linux/pci.h>
 #include <linux/dma-mapping.h>
+#include <linux/timer.h>
+#include <linux/mutex.h>
+
 #include <asm/semaphore.h>
 
 #include "mthca_provider.h"
@@ -46,8 +53,8 @@
 
 #define DRV_NAME       "ib_mthca"
 #define PFX            DRV_NAME ": "
-#define DRV_VERSION    "0.06-pre"
-#define DRV_RELDATE    "November 8, 2004"
+#define DRV_VERSION    "0.08"
+#define DRV_RELDATE    "February 14, 2006"
 
 enum {
        MTHCA_FLAG_DDR_HIDDEN = 1 << 1,
@@ -57,13 +64,18 @@ enum {
        MTHCA_FLAG_NO_LAM     = 1 << 5,
        MTHCA_FLAG_FMR        = 1 << 6,
        MTHCA_FLAG_MEMFREE    = 1 << 7,
-       MTHCA_FLAG_PCIE       = 1 << 8
+       MTHCA_FLAG_PCIE       = 1 << 8,
+       MTHCA_FLAG_SINAI_OPT  = 1 << 9
 };
 
 enum {
        MTHCA_MAX_PORTS = 2
 };
 
+enum {
+       MTHCA_BOARD_ID_LEN = 64
+};
+
 enum {
        MTHCA_EQ_CONTEXT_SIZE =  0x40,
        MTHCA_CQ_CONTEXT_SIZE =  0x40,
@@ -75,6 +87,8 @@ enum {
        /* Arbel FW gives us these, but we need them for Tavor */
        MTHCA_MPT_ENTRY_SIZE  =  0x40,
        MTHCA_MTT_SEG_SIZE    =  0x40,
+
+       MTHCA_QP_PER_MGM      = 4 * (MTHCA_MGM_ENTRY_SIZE / 16 - 2)
 };
 
 enum {
@@ -97,9 +111,18 @@ enum {
        MTHCA_OPCODE_INVALID        = 0xff
 };
 
+enum {
+       MTHCA_CMD_USE_EVENTS         = 1 << 0,
+       MTHCA_CMD_POST_DOORBELLS     = 1 << 1
+};
+
+enum {
+       MTHCA_CMD_NUM_DBELL_DWORDS = 8
+};
+
 struct mthca_cmd {
-       int                       use_events;
-       struct semaphore          hcr_sem;
+       struct pci_pool          *pool;
+       struct mutex              hcr_mutex;
        struct semaphore          poll_sem;
        struct semaphore          event_sem;
        int                       max_cmds;
@@ -107,6 +130,9 @@ struct mthca_cmd {
        int                       free_head;
        struct mthca_cmd_context *context;
        u16                       token_mask;
+       u32                       flags;
+       void __iomem             *dbell_map;
+       u16                       dbell_offsets[MTHCA_CMD_NUM_DBELL_DWORDS];
 };
 
 struct mthca_limits {
@@ -119,12 +145,18 @@ struct mthca_limits {
        int      num_uars;
        int      max_sg;
        int      num_qps;
+       int      max_wqes;
+       int      max_desc_sz;
+       int      max_qp_init_rdma;
        int      reserved_qps;
        int      num_srqs;
+       int      max_srq_wqes;
+       int      max_srq_sge;
        int      reserved_srqs;
        int      num_eecs;
        int      reserved_eecs;
        int      num_cqs;
+       int      max_cqes;
        int      reserved_cqs;
        int      num_eqs;
        int      reserved_eqs;
@@ -139,6 +171,10 @@ struct mthca_limits {
        int      reserved_mcgs;
        int      num_pds;
        int      reserved_pds;
+       u32      page_size_cap;
+       u32      flags;
+       u16      stat_rate_support;
+       u8       port_width_cap;
 };
 
 struct mthca_alloc {
@@ -208,6 +244,13 @@ struct mthca_cq_table {
        struct mthca_icm_table *table;
 };
 
+struct mthca_srq_table {
+       struct mthca_alloc      alloc;
+       spinlock_t              lock;
+       struct mthca_array      srq;
+       struct mthca_icm_table *table;
+};
+
 struct mthca_qp_table {
        struct mthca_alloc      alloc;
        u32                     rdb_base;
@@ -229,11 +272,19 @@ struct mthca_av_table {
 };
 
 struct mthca_mcg_table {
-       struct semaphore        sem;
+       struct mutex            mutex;
        struct mthca_alloc      alloc;
        struct mthca_icm_table *table;
 };
 
+struct mthca_catas_err {
+       u64                     addr;
+       u32 __iomem            *map;
+       unsigned long           stop;
+       u32                     size;
+       struct timer_list       timer;
+};
+
 struct mthca_dev {
        struct ib_device  ib_dev;
        struct pci_dev   *pdev;
@@ -243,6 +294,7 @@ struct mthca_dev {
        unsigned long    device_cap_flags;
 
        u32              rev_id;
+       char             board_id[MTHCA_BOARD_ID_LEN];
 
        /* firmware info */
        u64              fw_ver;
@@ -265,7 +317,7 @@ struct mthca_dev {
        u64              ddr_end;
 
        MTHCA_DECLARE_DOORBELL_LOCK(doorbell_lock)
-       struct semaphore cap_mask_mutex;
+       struct mutex cap_mask_mutex;
 
        void __iomem    *hcr;
        void __iomem    *kar;
@@ -288,10 +340,13 @@ struct mthca_dev {
        struct mthca_mr_table  mr_table;
        struct mthca_eq_table  eq_table;
        struct mthca_cq_table  cq_table;
+       struct mthca_srq_table srq_table;
        struct mthca_qp_table  qp_table;
        struct mthca_av_table  av_table;
        struct mthca_mcg_table mcg_table;
 
+       struct mthca_catas_err catas_err;
+
        struct mthca_uar       driver_uar;
        struct mthca_db_table *db_tab;
        struct mthca_pd        driver_pd;
@@ -300,10 +355,24 @@ struct mthca_dev {
        struct ib_mad_agent  *send_agent[MTHCA_MAX_PORTS][2];
        struct ib_ah         *sm_ah[MTHCA_MAX_PORTS];
        spinlock_t            sm_lock;
+       u8                    rate[MTHCA_MAX_PORTS];
 };
 
-#define mthca_dbg(mdev, format, arg...) \
-       dev_dbg(&mdev->pdev->dev, format, ## arg)
+#ifdef CONFIG_INFINIBAND_MTHCA_DEBUG
+extern int mthca_debug_level;
+
+#define mthca_dbg(mdev, format, arg...)                                        \
+       do {                                                            \
+               if (mthca_debug_level)                                  \
+                       dev_printk(KERN_DEBUG, &mdev->pdev->dev, format, ## arg); \
+       } while (0)
+
+#else /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
+#define mthca_dbg(mdev, format, arg...) do { (void) mdev; } while (0)
+
+#endif /* CONFIG_INFINIBAND_MTHCA_DEBUG */
+
 #define mthca_err(mdev, format, arg...) \
        dev_err(&mdev->pdev->dev, format, ## arg)
 #define mthca_info(mdev, format, arg...) \
@@ -328,14 +397,13 @@ extern void __buggy_use_of_MTHCA_PUT(void);
 
 #define MTHCA_PUT(dest, source, offset)                               \
        do {                                                          \
-               __typeof__(source) *__p =                             \
-                       (__typeof__(source) *) ((char *) (dest) + (offset)); \
+               void *__d = ((char *) (dest) + (offset));             \
                switch (sizeof(source)) {                             \
-                       case 1: *__p = (source);            break;    \
-                       case 2: *__p = cpu_to_be16(source); break;    \
-                       case 4: *__p = cpu_to_be32(source); break;    \
-                       case 8: *__p = cpu_to_be64(source); break;    \
-                       default: __buggy_use_of_MTHCA_PUT();          \
+               case 1: *(u8 *) __d = (source);                break; \
+               case 2: *(__be16 *) __d = cpu_to_be16(source); break; \
+               case 4: *(__be32 *) __d = cpu_to_be32(source); break; \
+               case 8: *(__be64 *) __d = cpu_to_be64(source); break; \
+               default: __buggy_use_of_MTHCA_PUT();                  \
                }                                                     \
        } while (0)
 
@@ -351,12 +419,18 @@ int mthca_array_set(struct mthca_array *array, int index, void *value);
 void mthca_array_clear(struct mthca_array *array, int index);
 int mthca_array_init(struct mthca_array *array, int nent);
 void mthca_array_cleanup(struct mthca_array *array, int nent);
+int mthca_buf_alloc(struct mthca_dev *dev, int size, int max_direct,
+                   union mthca_buf *buf, int *is_direct, struct mthca_pd *pd,
+                   int hca_write, struct mthca_mr *mr);
+void mthca_buf_free(struct mthca_dev *dev, int size, union mthca_buf *buf,
+                   int is_direct, struct mthca_mr *mr);
 
 int mthca_init_uar_table(struct mthca_dev *dev);
 int mthca_init_pd_table(struct mthca_dev *dev);
 int mthca_init_mr_table(struct mthca_dev *dev);
 int mthca_init_eq_table(struct mthca_dev *dev);
 int mthca_init_cq_table(struct mthca_dev *dev);
+int mthca_init_srq_table(struct mthca_dev *dev);
 int mthca_init_qp_table(struct mthca_dev *dev);
 int mthca_init_av_table(struct mthca_dev *dev);
 int mthca_init_mcg_table(struct mthca_dev *dev);
@@ -366,6 +440,7 @@ void mthca_cleanup_pd_table(struct mthca_dev *dev);
 void mthca_cleanup_mr_table(struct mthca_dev *dev);
 void mthca_cleanup_eq_table(struct mthca_dev *dev);
 void mthca_cleanup_cq_table(struct mthca_dev *dev);
+void mthca_cleanup_srq_table(struct mthca_dev *dev);
 void mthca_cleanup_qp_table(struct mthca_dev *dev);
 void mthca_cleanup_av_table(struct mthca_dev *dev);
 void mthca_cleanup_mcg_table(struct mthca_dev *dev);
@@ -373,12 +448,21 @@ void mthca_cleanup_mcg_table(struct mthca_dev *dev);
 int mthca_register_device(struct mthca_dev *dev);
 void mthca_unregister_device(struct mthca_dev *dev);
 
+void mthca_start_catas_poll(struct mthca_dev *dev);
+void mthca_stop_catas_poll(struct mthca_dev *dev);
+
 int mthca_uar_alloc(struct mthca_dev *dev, struct mthca_uar *uar);
 void mthca_uar_free(struct mthca_dev *dev, struct mthca_uar *uar);
 
-int mthca_pd_alloc(struct mthca_dev *dev, struct mthca_pd *pd);
+int mthca_pd_alloc(struct mthca_dev *dev, int privileged, struct mthca_pd *pd);
 void mthca_pd_free(struct mthca_dev *dev, struct mthca_pd *pd);
 
+struct mthca_mtt *mthca_alloc_mtt(struct mthca_dev *dev, int size);
+void mthca_free_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt);
+int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt,
+                   int start_index, u64 *buffer_list, int list_len);
+int mthca_mr_alloc(struct mthca_dev *dev, u32 pd, int buffer_size_shift,
+                  u64 iova, u64 total_size, u32 access, struct mthca_mr *mr);
 int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd,
                           u32 access, struct mthca_mr *mr);
 int mthca_mr_alloc_phys(struct mthca_dev *dev, u32 pd,
@@ -405,14 +489,38 @@ int mthca_poll_cq(struct ib_cq *ibcq, int num_entries,
 int mthca_tavor_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify);
 int mthca_arbel_arm_cq(struct ib_cq *cq, enum ib_cq_notify notify);
 int mthca_init_cq(struct mthca_dev *dev, int nent,
+                 struct mthca_ucontext *ctx, u32 pdn,
                  struct mthca_cq *cq);
 void mthca_free_cq(struct mthca_dev *dev,
                   struct mthca_cq *cq);
-void mthca_cq_event(struct mthca_dev *dev, u32 cqn);
-void mthca_cq_clean(struct mthca_dev *dev, u32 cqn, u32 qpn);
+void mthca_cq_completion(struct mthca_dev *dev, u32 cqn);
+void mthca_cq_event(struct mthca_dev *dev, u32 cqn,
+                   enum ib_event_type event_type);
+void mthca_cq_clean(struct mthca_dev *dev, struct mthca_cq *cq, u32 qpn,
+                   struct mthca_srq *srq);
+void mthca_cq_resize_copy_cqes(struct mthca_cq *cq);
+int mthca_alloc_cq_buf(struct mthca_dev *dev, struct mthca_cq_buf *buf, int nent);
+void mthca_free_cq_buf(struct mthca_dev *dev, struct mthca_cq_buf *buf, int cqe);
+
+int mthca_alloc_srq(struct mthca_dev *dev, struct mthca_pd *pd,
+                   struct ib_srq_attr *attr, struct mthca_srq *srq);
+void mthca_free_srq(struct mthca_dev *dev, struct mthca_srq *srq);
+int mthca_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr,
+                    enum ib_srq_attr_mask attr_mask);
+int mthca_query_srq(struct ib_srq *srq, struct ib_srq_attr *srq_attr);
+int mthca_max_srq_sge(struct mthca_dev *dev);
+void mthca_srq_event(struct mthca_dev *dev, u32 srqn,
+                    enum ib_event_type event_type);
+void mthca_free_srq_wqe(struct mthca_srq *srq, u32 wqe_addr);
+int mthca_tavor_post_srq_recv(struct ib_srq *srq, struct ib_recv_wr *wr,
+                             struct ib_recv_wr **bad_wr);
+int mthca_arbel_post_srq_recv(struct ib_srq *srq, struct ib_recv_wr *wr,
+                             struct ib_recv_wr **bad_wr);
 
 void mthca_qp_event(struct mthca_dev *dev, u32 qpn,
                    enum ib_event_type event_type);
+int mthca_query_qp(struct ib_qp *ibqp, struct ib_qp_attr *qp_attr, int qp_attr_mask,
+                  struct ib_qp_init_attr *qp_init_attr);
 int mthca_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, int attr_mask);
 int mthca_tavor_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
                          struct ib_send_wr **bad_wr);
@@ -422,20 +530,22 @@ int mthca_arbel_post_send(struct ib_qp *ibqp, struct ib_send_wr *wr,
                          struct ib_send_wr **bad_wr);
 int mthca_arbel_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr,
                             struct ib_recv_wr **bad_wr);
-int mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
-                      int index, int *dbd, u32 *new_wqe);
+void mthca_free_err_wqe(struct mthca_dev *dev, struct mthca_qp *qp, int is_send,
+                       int index, int *dbd, __be32 *new_wqe);
 int mthca_alloc_qp(struct mthca_dev *dev,
                   struct mthca_pd *pd,
                   struct mthca_cq *send_cq,
                   struct mthca_cq *recv_cq,
                   enum ib_qp_type type,
                   enum ib_sig_type send_policy,
+                  struct ib_qp_cap *cap,
                   struct mthca_qp *qp);
 int mthca_alloc_sqp(struct mthca_dev *dev,
                    struct mthca_pd *pd,
                    struct mthca_cq *send_cq,
                    struct mthca_cq *recv_cq,
                    enum ib_sig_type send_policy,
+                   struct ib_qp_cap *cap,
                    int qpn,
                    int port,
                    struct mthca_sqp *sqp);
@@ -447,6 +557,10 @@ int mthca_create_ah(struct mthca_dev *dev,
 int mthca_destroy_ah(struct mthca_dev *dev, struct mthca_ah *ah);
 int mthca_read_ah(struct mthca_dev *dev, struct mthca_ah *ah,
                  struct ib_ud_header *header);
+int mthca_ah_query(struct ib_ah *ibah, struct ib_ah_attr *attr);
+int mthca_ah_grh_present(struct mthca_ah *ah);
+u8 mthca_get_rate(struct mthca_dev *dev, int static_rate, u8 port);
+enum ib_rate mthca_rate_to_ib(struct mthca_dev *dev, u8 mthca_rate, u8 port);
 
 int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
 int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid);
index 70a6553..47ca8a9 100644 (file)
  */
 
 #include <linux/init.h>
+#include <linux/string.h>
+#include <linux/slab.h>
 
 #include "mthca_dev.h"
 #include "mthca_cmd.h"
 
-enum {
-       MTHCA_QP_PER_MGM = 4 * (MTHCA_MGM_ENTRY_SIZE / 16 - 2)
-};
-
 struct mthca_mgm {
-       u32 next_gid_index;
-       u32 reserved[3];
-       u8  gid[16];
-       u32 qp[MTHCA_QP_PER_MGM];
+       __be32 next_gid_index;
+       u32    reserved[3];
+       u8     gid[16];
+       __be32 qp[MTHCA_QP_PER_MGM];
 };
 
 static const u8 zero_gid[16];  /* automatically initialized to 0 */
@@ -66,22 +64,23 @@ static const u8 zero_gid[16];       /* automatically initialized to 0 */
  * entry in hash chain and *mgm holds end of hash chain.
  */
 static int find_mgm(struct mthca_dev *dev,
-                   u8 *gid, struct mthca_mgm *mgm,
+                   u8 *gid, struct mthca_mailbox *mgm_mailbox,
                    u16 *hash, int *prev, int *index)
 {
-       void *mailbox;
+       struct mthca_mailbox *mailbox;
+       struct mthca_mgm *mgm = mgm_mailbox->buf;
        u8 *mgid;
        int err;
        u8 status;
 
-       mailbox = kmalloc(16 + MTHCA_CMD_MAILBOX_EXTRA, GFP_KERNEL);
-       if (!mailbox)
+       mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
+       if (IS_ERR(mailbox))
                return -ENOMEM;
-       mgid = MAILBOX_ALIGN(mailbox);
+       mgid = mailbox->buf;
 
        memcpy(mgid, gid, 16);
 
-       err = mthca_MGID_HASH(dev, mgid, hash, &status);
+       err = mthca_MGID_HASH(dev, mailbox, hash, &status);
        if (err)
                goto out;
        if (status) {
@@ -93,22 +92,27 @@ static int find_mgm(struct mthca_dev *dev,
        if (0)
                mthca_dbg(dev, "Hash for %04x:%04x:%04x:%04x:"
                          "%04x:%04x:%04x:%04x is %04x\n",
-                         be16_to_cpu(((u16 *) gid)[0]), be16_to_cpu(((u16 *) gid)[1]),
-                         be16_to_cpu(((u16 *) gid)[2]), be16_to_cpu(((u16 *) gid)[3]),
-                         be16_to_cpu(((u16 *) gid)[4]), be16_to_cpu(((u16 *) gid)[5]),
-                         be16_to_cpu(((u16 *) gid)[6]), be16_to_cpu(((u16 *) gid)[7]),
+                         be16_to_cpu(((__be16 *) gid)[0]),
+                         be16_to_cpu(((__be16 *) gid)[1]),
+                         be16_to_cpu(((__be16 *) gid)[2]),
+                         be16_to_cpu(((__be16 *) gid)[3]),
+                         be16_to_cpu(((__be16 *) gid)[4]),
+                         be16_to_cpu(((__be16 *) gid)[5]),
+                         be16_to_cpu(((__be16 *) gid)[6]),
+                         be16_to_cpu(((__be16 *) gid)[7]),
                          *hash);
 
        *index = *hash;
        *prev  = -1;
 
        do {
-               err = mthca_READ_MGM(dev, *index, mgm, &status);
+               err = mthca_READ_MGM(dev, *index, mgm_mailbox, &status);
                if (err)
                        goto out;
                if (status) {
                        mthca_err(dev, "READ_MGM returned status %02x\n", status);
-                       return -EINVAL;
+                       err = -EINVAL;
+                       goto out;
                }
 
                if (!memcmp(mgm->gid, zero_gid, 16)) {
@@ -123,20 +127,20 @@ static int find_mgm(struct mthca_dev *dev,
                        goto out;
 
                *prev = *index;
-               *index = be32_to_cpu(mgm->next_gid_index) >> 5;
+               *index = be32_to_cpu(mgm->next_gid_index) >> 6;
        } while (*index);
 
        *index = -1;
 
  out:
-       kfree(mailbox);
+       mthca_free_mailbox(dev, mailbox);
        return err;
 }
 
 int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 {
        struct mthca_dev *dev = to_mdev(ibqp->device);
-       void *mailbox;
+       struct mthca_mailbox *mailbox;
        struct mthca_mgm *mgm;
        u16 hash;
        int index, prev;
@@ -145,15 +149,14 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
        int err;
        u8 status;
 
-       mailbox = kmalloc(sizeof *mgm + MTHCA_CMD_MAILBOX_EXTRA, GFP_KERNEL);
-       if (!mailbox)
-               return -ENOMEM;
-       mgm = MAILBOX_ALIGN(mailbox);
+       mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
+       if (IS_ERR(mailbox))
+               return PTR_ERR(mailbox);
+       mgm = mailbox->buf;
 
-       if (down_interruptible(&dev->mcg_table.sem))
-               return -EINTR;
+       mutex_lock(&dev->mcg_table.mutex);
 
-       err = find_mgm(dev, gid->raw, mgm, &hash, &prev, &index);
+       err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index);
        if (err)
                goto out;
 
@@ -170,7 +173,7 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                        goto out;
                }
 
-               err = mthca_READ_MGM(dev, index, mgm, &status);
+               err = mthca_READ_MGM(dev, index, mailbox, &status);
                if (err)
                        goto out;
                if (status) {
@@ -178,13 +181,17 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                        err = -EINVAL;
                        goto out;
                }
-
+               memset(mgm, 0, sizeof *mgm);
                memcpy(mgm->gid, gid->raw, 16);
-               mgm->next_gid_index = 0;
        }
 
        for (i = 0; i < MTHCA_QP_PER_MGM; ++i)
-               if (!(mgm->qp[i] & cpu_to_be32(1 << 31))) {
+               if (mgm->qp[i] == cpu_to_be32(ibqp->qp_num | (1 << 31))) {
+                       mthca_dbg(dev, "QP %06x already a member of MGM\n",
+                                 ibqp->qp_num);
+                       err = 0;
+                       goto out;
+               } else if (!(mgm->qp[i] & cpu_to_be32(1 << 31))) {
                        mgm->qp[i] = cpu_to_be32(ibqp->qp_num | (1 << 31));
                        break;
                }
@@ -195,18 +202,19 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                goto out;
        }
 
-       err = mthca_WRITE_MGM(dev, index, mgm, &status);
+       err = mthca_WRITE_MGM(dev, index, mailbox, &status);
        if (err)
                goto out;
        if (status) {
                mthca_err(dev, "WRITE_MGM returned status %02x\n", status);
                err = -EINVAL;
+               goto out;
        }
 
        if (!link)
                goto out;
 
-       err = mthca_READ_MGM(dev, prev, mgm, &status);
+       err = mthca_READ_MGM(dev, prev, mailbox, &status);
        if (err)
                goto out;
        if (status) {
@@ -215,9 +223,9 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                goto out;
        }
 
-       mgm->next_gid_index = cpu_to_be32(index << 5);
+       mgm->next_gid_index = cpu_to_be32(index << 6);
 
-       err = mthca_WRITE_MGM(dev, prev, mgm, &status);
+       err = mthca_WRITE_MGM(dev, prev, mailbox, &status);
        if (err)
                goto out;
        if (status) {
@@ -226,15 +234,20 @@ int mthca_multicast_attach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
        }
 
  out:
-       up(&dev->mcg_table.sem);
-       kfree(mailbox);
+       if (err && link && index != -1) {
+               BUG_ON(index < dev->limits.num_mgms);
+               mthca_free(&dev->mcg_table.alloc, index);
+       }
+       mutex_unlock(&dev->mcg_table.mutex);
+
+       mthca_free_mailbox(dev, mailbox);
        return err;
 }
 
 int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
 {
        struct mthca_dev *dev = to_mdev(ibqp->device);
-       void *mailbox;
+       struct mthca_mailbox *mailbox;
        struct mthca_mgm *mgm;
        u16 hash;
        int prev, index;
@@ -242,29 +255,28 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
        int err;
        u8 status;
 
-       mailbox = kmalloc(sizeof *mgm + MTHCA_CMD_MAILBOX_EXTRA, GFP_KERNEL);
-       if (!mailbox)
-               return -ENOMEM;
-       mgm = MAILBOX_ALIGN(mailbox);
+       mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
+       if (IS_ERR(mailbox))
+               return PTR_ERR(mailbox);
+       mgm = mailbox->buf;
 
-       if (down_interruptible(&dev->mcg_table.sem))
-               return -EINTR;
+       mutex_lock(&dev->mcg_table.mutex);
 
-       err = find_mgm(dev, gid->raw, mgm, &hash, &prev, &index);
+       err = find_mgm(dev, gid->raw, mailbox, &hash, &prev, &index);
        if (err)
                goto out;
 
        if (index == -1) {
                mthca_err(dev, "MGID %04x:%04x:%04x:%04x:%04x:%04x:%04x:%04x "
                          "not found\n",
-                         be16_to_cpu(((u16 *) gid->raw)[0]),
-                         be16_to_cpu(((u16 *) gid->raw)[1]),
-                         be16_to_cpu(((u16 *) gid->raw)[2]),
-                         be16_to_cpu(((u16 *) gid->raw)[3]),
-                         be16_to_cpu(((u16 *) gid->raw)[4]),
-                         be16_to_cpu(((u16 *) gid->raw)[5]),
-                         be16_to_cpu(((u16 *) gid->raw)[6]),
-                         be16_to_cpu(((u16 *) gid->raw)[7]));
+                         be16_to_cpu(((__be16 *) gid->raw)[0]),
+                         be16_to_cpu(((__be16 *) gid->raw)[1]),
+                         be16_to_cpu(((__be16 *) gid->raw)[2]),
+                         be16_to_cpu(((__be16 *) gid->raw)[3]),
+                         be16_to_cpu(((__be16 *) gid->raw)[4]),
+                         be16_to_cpu(((__be16 *) gid->raw)[5]),
+                         be16_to_cpu(((__be16 *) gid->raw)[6]),
+                         be16_to_cpu(((__be16 *) gid->raw)[7]));
                err = -EINVAL;
                goto out;
        }
@@ -285,7 +297,7 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
        mgm->qp[loc]   = mgm->qp[i - 1];
        mgm->qp[i - 1] = 0;
 
-       err = mthca_WRITE_MGM(dev, index, mgm, &status);
+       err = mthca_WRITE_MGM(dev, index, mailbox, &status);
        if (err)
                goto out;
        if (status) {
@@ -297,14 +309,12 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
        if (i != 1)
                goto out;
 
-       goto out;
-
        if (prev == -1) {
                /* Remove entry from MGM */
-               if (be32_to_cpu(mgm->next_gid_index) >> 5) {
-                       err = mthca_READ_MGM(dev,
-                                            be32_to_cpu(mgm->next_gid_index) >> 5,
-                                            mgm, &status);
+               int amgm_index_to_free = be32_to_cpu(mgm->next_gid_index) >> 6;
+               if (amgm_index_to_free) {
+                       err = mthca_READ_MGM(dev, amgm_index_to_free,
+                                            mailbox, &status);
                        if (err)
                                goto out;
                        if (status) {
@@ -316,7 +326,7 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                } else
                        memset(mgm->gid, 0, 16);
 
-               err = mthca_WRITE_MGM(dev, index, mgm, &status);
+               err = mthca_WRITE_MGM(dev, index, mailbox, &status);
                if (err)
                        goto out;
                if (status) {
@@ -324,10 +334,14 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                        err = -EINVAL;
                        goto out;
                }
+               if (amgm_index_to_free) {
+                       BUG_ON(amgm_index_to_free < dev->limits.num_mgms);
+                       mthca_free(&dev->mcg_table.alloc, amgm_index_to_free);
+               }
        } else {
                /* Remove entry from AMGM */
-               index = be32_to_cpu(mgm->next_gid_index) >> 5;
-               err = mthca_READ_MGM(dev, prev, mgm, &status);
+               int curr_next_index = be32_to_cpu(mgm->next_gid_index) >> 6;
+               err = mthca_READ_MGM(dev, prev, mailbox, &status);
                if (err)
                        goto out;
                if (status) {
@@ -336,9 +350,9 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                        goto out;
                }
 
-               mgm->next_gid_index = cpu_to_be32(index << 5);
+               mgm->next_gid_index = cpu_to_be32(curr_next_index << 6);
 
-               err = mthca_WRITE_MGM(dev, prev, mgm, &status);
+               err = mthca_WRITE_MGM(dev, prev, mailbox, &status);
                if (err)
                        goto out;
                if (status) {
@@ -346,31 +360,35 @@ int mthca_multicast_detach(struct ib_qp *ibqp, union ib_gid *gid, u16 lid)
                        err = -EINVAL;
                        goto out;
                }
+               BUG_ON(index < dev->limits.num_mgms);
+               mthca_free(&dev->mcg_table.alloc, index);
        }
 
  out:
-       up(&dev->mcg_table.sem);
-       kfree(mailbox);
+       mutex_unlock(&dev->mcg_table.mutex);
+
+       mthca_free_mailbox(dev, mailbox);
        return err;
 }
 
 int __devinit mthca_init_mcg_table(struct mthca_dev *dev)
 {
        int err;
+       int table_size = dev->limits.num_mgms + dev->limits.num_amgms;
 
        err = mthca_alloc_init(&dev->mcg_table.alloc,
-                              dev->limits.num_amgms,
-                              dev->limits.num_amgms - 1,
-                              0);
+                              table_size,
+                              table_size - 1,
+                              dev->limits.num_mgms);
        if (err)
                return err;
 
-       init_MUTEX(&dev->mcg_table.sem);
+       mutex_init(&dev->mcg_table.mutex);
 
        return 0;
 }
 
-void __devexit mthca_cleanup_mcg_table(struct mthca_dev *dev)
+void mthca_cleanup_mcg_table(struct mthca_dev *dev)
 {
        mthca_alloc_cleanup(&dev->mcg_table.alloc);
 }
index 637b30e..15cc2f6 100644 (file)
@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -47,6 +49,15 @@ enum {
        MTHCA_TABLE_CHUNK_SIZE = 1 << 18
 };
 
+struct mthca_user_db_table {
+       struct mutex mutex;
+       struct {
+               u64                uvirt;
+               struct scatterlist mem;
+               int                refcount;
+       }                page[0];
+};
+
 void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm)
 {
        struct mthca_icm_chunk *chunk, *tmp;
@@ -71,7 +82,7 @@ void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm)
 }
 
 struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages,
-                                 unsigned int gfp_mask)
+                                 gfp_t gfp_mask)
 {
        struct mthca_icm *icm;
        struct mthca_icm_chunk *chunk = NULL;
@@ -147,7 +158,7 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob
        int ret = 0;
        u8 status;
 
-       down(&table->mutex);
+       mutex_lock(&table->mutex);
 
        if (table->icm[i]) {
                ++table->icm[i]->refcount;
@@ -173,25 +184,31 @@ int mthca_table_get(struct mthca_dev *dev, struct mthca_icm_table *table, int ob
        ++table->icm[i]->refcount;
 
 out:
-       up(&table->mutex);
+       mutex_unlock(&table->mutex);
        return ret;
 }
 
 void mthca_table_put(struct mthca_dev *dev, struct mthca_icm_table *table, int obj)
 {
-       int i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE;
+       int i;
        u8 status;
 
-       down(&table->mutex);
+       if (!mthca_is_memfree(dev))
+               return;
+
+       i = (obj & (table->num_obj - 1)) * table->obj_size / MTHCA_TABLE_CHUNK_SIZE;
+
+       mutex_lock(&table->mutex);
 
        if (--table->icm[i]->refcount == 0) {
                mthca_UNMAP_ICM(dev, table->virt + i * MTHCA_TABLE_CHUNK_SIZE,
-                               MTHCA_TABLE_CHUNK_SIZE >> 12, &status);
+                               MTHCA_TABLE_CHUNK_SIZE / MTHCA_ICM_PAGE_SIZE,
+                               &status);
                mthca_free_icm(dev, table->icm[i]);
                table->icm[i] = NULL;
        }
 
-       up(&table->mutex);
+       mutex_unlock(&table->mutex);
 }
 
 void *mthca_table_find(struct mthca_icm_table *table, int obj)
@@ -204,7 +221,7 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj)
        if (!table->lowmem)
                return NULL;
 
-       down(&table->mutex);
+       mutex_lock(&table->mutex);
 
        idx = (obj & (table->num_obj - 1)) * table->obj_size;
        icm = table->icm[idx / MTHCA_TABLE_CHUNK_SIZE];
@@ -217,14 +234,14 @@ void *mthca_table_find(struct mthca_icm_table *table, int obj)
                for (i = 0; i < chunk->npages; ++i) {
                        if (chunk->mem[i].length >= offset) {
                                page = chunk->mem[i].page;
-                               break;
+                               goto out;
                        }
                        offset -= chunk->mem[i].length;
                }
        }
 
 out:
-       up(&table->mutex);
+       mutex_unlock(&table->mutex);
        return page ? lowmem_page_address(page) + offset : NULL;
 }
 
@@ -256,6 +273,9 @@ void mthca_table_put_range(struct mthca_dev *dev, struct mthca_icm_table *table,
 {
        int i;
 
+       if (!mthca_is_memfree(dev))
+               return;
+
        for (i = start; i <= end; i += MTHCA_TABLE_CHUNK_SIZE / table->obj_size)
                mthca_table_put(dev, table, i);
 }
@@ -267,10 +287,11 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
 {
        struct mthca_icm_table *table;
        int num_icm;
+       unsigned chunk_size;
        int i;
        u8 status;
 
-       num_icm = obj_size * nobj / MTHCA_TABLE_CHUNK_SIZE;
+       num_icm = (obj_size * nobj + MTHCA_TABLE_CHUNK_SIZE - 1) / MTHCA_TABLE_CHUNK_SIZE;
 
        table = kmalloc(sizeof *table + num_icm * sizeof *table->icm, GFP_KERNEL);
        if (!table)
@@ -281,13 +302,17 @@ struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
        table->num_obj  = nobj;
        table->obj_size = obj_size;
        table->lowmem   = use_lowmem;
-       init_MUTEX(&table->mutex);
+       mutex_init(&table->mutex);
 
        for (i = 0; i < num_icm; ++i)
                table->icm[i] = NULL;
 
        for (i = 0; i * MTHCA_TABLE_CHUNK_SIZE < reserved * obj_size; ++i) {
-               table->icm[i] = mthca_alloc_icm(dev, MTHCA_TABLE_CHUNK_SIZE >> PAGE_SHIFT,
+               chunk_size = MTHCA_TABLE_CHUNK_SIZE;
+               if ((i + 1) * MTHCA_TABLE_CHUNK_SIZE > nobj * obj_size)
+                       chunk_size = nobj * obj_size - i * MTHCA_TABLE_CHUNK_SIZE;
+
+               table->icm[i] = mthca_alloc_icm(dev, chunk_size >> PAGE_SHIFT,
                                                (use_lowmem ? GFP_KERNEL : GFP_HIGHUSER) |
                                                __GFP_NOWARN);
                if (!table->icm[i])
@@ -312,7 +337,8 @@ err:
        for (i = 0; i < num_icm; ++i)
                if (table->icm[i]) {
                        mthca_UNMAP_ICM(dev, virt + i * MTHCA_TABLE_CHUNK_SIZE,
-                                       MTHCA_TABLE_CHUNK_SIZE >> 12, &status);
+                                       MTHCA_TABLE_CHUNK_SIZE / MTHCA_ICM_PAGE_SIZE,
+                                       &status);
                        mthca_free_icm(dev, table->icm[i]);
                }
 
@@ -329,21 +355,145 @@ void mthca_free_icm_table(struct mthca_dev *dev, struct mthca_icm_table *table)
        for (i = 0; i < table->num_icm; ++i)
                if (table->icm[i]) {
                        mthca_UNMAP_ICM(dev, table->virt + i * MTHCA_TABLE_CHUNK_SIZE,
-                                       MTHCA_TABLE_CHUNK_SIZE >> 12, &status);
+                                       MTHCA_TABLE_CHUNK_SIZE / MTHCA_ICM_PAGE_SIZE,
+                                       &status);
                        mthca_free_icm(dev, table->icm[i]);
                }
 
        kfree(table);
 }
 
-static u64 mthca_uarc_virt(struct mthca_dev *dev, int page)
+static u64 mthca_uarc_virt(struct mthca_dev *dev, struct mthca_uar *uar, int page)
 {
        return dev->uar_table.uarc_base +
-               dev->driver_uar.index * dev->uar_table.uarc_size +
-               page * 4096;
+               uar->index * dev->uar_table.uarc_size +
+               page * MTHCA_ICM_PAGE_SIZE;
+}
+
+int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
+                     struct mthca_user_db_table *db_tab, int index, u64 uaddr)
+{
+       int ret = 0;
+       u8 status;
+       int i;
+
+       if (!mthca_is_memfree(dev))
+               return 0;
+
+       if (index < 0 || index > dev->uar_table.uarc_size / 8)
+               return -EINVAL;
+
+       mutex_lock(&db_tab->mutex);
+
+       i = index / MTHCA_DB_REC_PER_PAGE;
+
+       if ((db_tab->page[i].refcount >= MTHCA_DB_REC_PER_PAGE)       ||
+           (db_tab->page[i].uvirt && db_tab->page[i].uvirt != uaddr) ||
+           (uaddr & 4095)) {
+               ret = -EINVAL;
+               goto out;
+       }
+
+       if (db_tab->page[i].refcount) {
+               ++db_tab->page[i].refcount;
+               goto out;
+       }
+
+       ret = get_user_pages(current, current->mm, uaddr & PAGE_MASK, 1, 1, 0,
+                            &db_tab->page[i].mem.page, NULL);
+       if (ret < 0)
+               goto out;
+
+       db_tab->page[i].mem.length = MTHCA_ICM_PAGE_SIZE;
+       db_tab->page[i].mem.offset = uaddr & ~PAGE_MASK;
+
+       ret = pci_map_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
+       if (ret < 0) {
+               put_page(db_tab->page[i].mem.page);
+               goto out;
+       }
+
+       ret = mthca_MAP_ICM_page(dev, sg_dma_address(&db_tab->page[i].mem),
+                                mthca_uarc_virt(dev, uar, i), &status);
+       if (!ret && status)
+               ret = -EINVAL;
+       if (ret) {
+               pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
+               put_page(db_tab->page[i].mem.page);
+               goto out;
+       }
+
+       db_tab->page[i].uvirt    = uaddr;
+       db_tab->page[i].refcount = 1;
+
+out:
+       mutex_unlock(&db_tab->mutex);
+       return ret;
 }
 
-int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db)
+void mthca_unmap_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
+                        struct mthca_user_db_table *db_tab, int index)
+{
+       if (!mthca_is_memfree(dev))
+               return;
+
+       /*
+        * To make our bookkeeping simpler, we don't unmap DB
+        * pages until we clean up the whole db table.
+        */
+
+       mutex_lock(&db_tab->mutex);
+
+       --db_tab->page[index / MTHCA_DB_REC_PER_PAGE].refcount;
+
+       mutex_unlock(&db_tab->mutex);
+}
+
+struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev)
+{
+       struct mthca_user_db_table *db_tab;
+       int npages;
+       int i;
+
+       if (!mthca_is_memfree(dev))
+               return NULL;
+
+       npages = dev->uar_table.uarc_size / MTHCA_ICM_PAGE_SIZE;
+       db_tab = kmalloc(sizeof *db_tab + npages * sizeof *db_tab->page, GFP_KERNEL);
+       if (!db_tab)
+               return ERR_PTR(-ENOMEM);
+
+       mutex_init(&db_tab->mutex);
+       for (i = 0; i < npages; ++i) {
+               db_tab->page[i].refcount = 0;
+               db_tab->page[i].uvirt    = 0;
+       }
+
+       return db_tab;
+}
+
+void mthca_cleanup_user_db_tab(struct mthca_dev *dev, struct mthca_uar *uar,
+                              struct mthca_user_db_table *db_tab)
+{
+       int i;
+       u8 status;
+
+       if (!mthca_is_memfree(dev))
+               return;
+
+       for (i = 0; i < dev->uar_table.uarc_size / MTHCA_ICM_PAGE_SIZE; ++i) {
+               if (db_tab->page[i].uvirt) {
+                       mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, uar, i), 1, &status);
+                       pci_unmap_sg(dev->pdev, &db_tab->page[i].mem, 1, PCI_DMA_TODEVICE);
+                       put_page(db_tab->page[i].mem.page);
+               }
+       }
+
+       kfree(db_tab);
+}
+
+int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
+                  u32 qn, __be32 **db)
 {
        int group;
        int start, end, dir;
@@ -352,7 +502,7 @@ int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db)
        int ret = 0;
        u8 status;
 
-       down(&dev->db_tab->mutex);
+       mutex_lock(&dev->db_tab->mutex);
 
        switch (type) {
        case MTHCA_DB_TYPE_CQ_ARM:
@@ -385,34 +535,44 @@ int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db)
                        goto found;
                }
 
+       for (i = start; i != end; i += dir)
+               if (!dev->db_tab->page[i].db_rec) {
+                       page = dev->db_tab->page + i;
+                       goto alloc;
+               }
+
        if (dev->db_tab->max_group1 >= dev->db_tab->min_group2 - 1) {
                ret = -ENOMEM;
                goto out;
        }
 
+       if (group == 0)
+               ++dev->db_tab->max_group1;
+       else
+               --dev->db_tab->min_group2;
+
        page = dev->db_tab->page + end;
-       page->db_rec = dma_alloc_coherent(&dev->pdev->dev, 4096,
+
+alloc:
+       page->db_rec = dma_alloc_coherent(&dev->pdev->dev, MTHCA_ICM_PAGE_SIZE,
                                          &page->mapping, GFP_KERNEL);
        if (!page->db_rec) {
                ret = -ENOMEM;
                goto out;
        }
-       memset(page->db_rec, 0, 4096);
+       memset(page->db_rec, 0, MTHCA_ICM_PAGE_SIZE);
 
-       ret = mthca_MAP_ICM_page(dev, page->mapping, mthca_uarc_virt(dev, i), &status);
+       ret = mthca_MAP_ICM_page(dev, page->mapping,
+                                mthca_uarc_virt(dev, &dev->driver_uar, i), &status);
        if (!ret && status)
                ret = -EINVAL;
        if (ret) {
-               dma_free_coherent(&dev->pdev->dev, 4096,
+               dma_free_coherent(&dev->pdev->dev, MTHCA_ICM_PAGE_SIZE,
                                  page->db_rec, page->mapping);
                goto out;
        }
 
        bitmap_zero(page->used, MTHCA_DB_REC_PER_PAGE);
-       if (group == 0)
-               ++dev->db_tab->max_group1;
-       else
-               --dev->db_tab->min_group2;
 
 found:
        j = find_first_zero_bit(page->used, MTHCA_DB_REC_PER_PAGE);
@@ -425,10 +585,10 @@ found:
 
        page->db_rec[j] = cpu_to_be64((qn << 8) | (type << 5));
 
-       *db = (u32 *) &page->db_rec[j];
+       *db = (__be32 *) &page->db_rec[j];
 
 out:
-       up(&dev->db_tab->mutex);
+       mutex_unlock(&dev->db_tab->mutex);
 
        return ret;
 }
@@ -444,7 +604,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
 
        page = dev->db_tab->page + i;
 
-       down(&dev->db_tab->mutex);
+       mutex_lock(&dev->db_tab->mutex);
 
        page->db_rec[j] = 0;
        if (i >= dev->db_tab->min_group2)
@@ -453,9 +613,9 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
 
        if (bitmap_empty(page->used, MTHCA_DB_REC_PER_PAGE) &&
            i >= dev->db_tab->max_group1 - 1) {
-               mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, i), 1, &status);
+               mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, &dev->driver_uar, i), 1, &status);
 
-               dma_free_coherent(&dev->pdev->dev, 4096,
+               dma_free_coherent(&dev->pdev->dev, MTHCA_ICM_PAGE_SIZE,
                                  page->db_rec, page->mapping);
                page->db_rec = NULL;
 
@@ -467,7 +627,7 @@ void mthca_free_db(struct mthca_dev *dev, int type, int db_index)
                        ++dev->db_tab->min_group2;
        }
 
-       up(&dev->db_tab->mutex);
+       mutex_unlock(&dev->db_tab->mutex);
 }
 
 int mthca_init_db_tab(struct mthca_dev *dev)
@@ -481,9 +641,9 @@ int mthca_init_db_tab(struct mthca_dev *dev)
        if (!dev->db_tab)
                return -ENOMEM;
 
-       init_MUTEX(&dev->db_tab->mutex);
+       mutex_init(&dev->db_tab->mutex);
 
-       dev->db_tab->npages     = dev->uar_table.uarc_size / 4096;
+       dev->db_tab->npages     = dev->uar_table.uarc_size / MTHCA_ICM_PAGE_SIZE;
        dev->db_tab->max_group1 = 0;
        dev->db_tab->min_group2 = dev->db_tab->npages - 1;
 
@@ -522,9 +682,9 @@ void mthca_cleanup_db_tab(struct mthca_dev *dev)
                if (!bitmap_empty(dev->db_tab->page[i].used, MTHCA_DB_REC_PER_PAGE))
                        mthca_warn(dev, "Kernel UARC page %d not empty\n", i);
 
-               mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, i), 1, &status);
+               mthca_UNMAP_ICM(dev, mthca_uarc_virt(dev, &dev->driver_uar, i), 1, &status);
 
-               dma_free_coherent(&dev->pdev->dev, 4096,
+               dma_free_coherent(&dev->pdev->dev, MTHCA_ICM_PAGE_SIZE,
                                  dev->db_tab->page[i].db_rec,
                                  dev->db_tab->page[i].mapping);
        }
index fe7be2a..6d42947 100644 (file)
@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
 
 #include <linux/list.h>
 #include <linux/pci.h>
-
-#include <asm/semaphore.h>
+#include <linux/mutex.h>
 
 #define MTHCA_ICM_CHUNK_LEN \
        ((256 - sizeof (struct list_head) - 2 * sizeof (int)) /         \
         (sizeof (struct scatterlist)))
 
+enum {
+       MTHCA_ICM_PAGE_SHIFT    = 12,
+       MTHCA_ICM_PAGE_SIZE     = 1 << MTHCA_ICM_PAGE_SHIFT,
+       MTHCA_DB_REC_PER_PAGE   = MTHCA_ICM_PAGE_SIZE / 8
+};
+
 struct mthca_icm_chunk {
        struct list_head   list;
        int                npages;
@@ -62,7 +69,7 @@ struct mthca_icm_table {
        int               num_obj;
        int               obj_size;
        int               lowmem;
-       struct semaphore  mutex;
+       struct mutex      mutex;
        struct mthca_icm *icm[0];
 };
 
@@ -75,7 +82,7 @@ struct mthca_icm_iter {
 struct mthca_dev;
 
 struct mthca_icm *mthca_alloc_icm(struct mthca_dev *dev, int npages,
-                                 unsigned int gfp_mask);
+                                 gfp_t gfp_mask);
 void mthca_free_icm(struct mthca_dev *dev, struct mthca_icm *icm);
 
 struct mthca_icm_table *mthca_alloc_icm_table(struct mthca_dev *dev,
@@ -130,13 +137,9 @@ static inline unsigned long mthca_icm_size(struct mthca_icm_iter *iter)
        return sg_dma_len(&iter->chunk->mem[iter->page_idx]);
 }
 
-enum {
-       MTHCA_DB_REC_PER_PAGE = 4096 / 8
-};
-
 struct mthca_db_page {
        DECLARE_BITMAP(used, MTHCA_DB_REC_PER_PAGE);
-       u64       *db_rec;
+       __be64    *db_rec;
        dma_addr_t mapping;
 };
 
@@ -145,10 +148,10 @@ struct mthca_db_table {
        int                   max_group1;
        int                   min_group2;
        struct mthca_db_page *page;
-       struct semaphore      mutex;
+       struct mutex          mutex;
 };
 
-enum {
+enum mthca_db_type {
        MTHCA_DB_TYPE_INVALID   = 0x0,
        MTHCA_DB_TYPE_CQ_SET_CI = 0x1,
        MTHCA_DB_TYPE_CQ_ARM    = 0x2,
@@ -158,9 +161,21 @@ enum {
        MTHCA_DB_TYPE_GROUP_SEP = 0x7
 };
 
+struct mthca_user_db_table;
+struct mthca_uar;
+
+int mthca_map_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
+                     struct mthca_user_db_table *db_tab, int index, u64 uaddr);
+void mthca_unmap_user_db(struct mthca_dev *dev, struct mthca_uar *uar,
+                        struct mthca_user_db_table *db_tab, int index);
+struct mthca_user_db_table *mthca_init_user_db_tab(struct mthca_dev *dev);
+void mthca_cleanup_user_db_tab(struct mthca_dev *dev, struct mthca_uar *uar,
+                              struct mthca_user_db_table *db_tab);
+
 int mthca_init_db_tab(struct mthca_dev *dev);
 void mthca_cleanup_db_tab(struct mthca_dev *dev);
-int mthca_alloc_db(struct mthca_dev *dev, int type, u32 qn, u32 **db);
+int mthca_alloc_db(struct mthca_dev *dev, enum mthca_db_type type,
+                  u32 qn, __be32 **db);
 void mthca_free_db(struct mthca_dev *dev, int type, int db_index);
 
 #endif /* MTHCA_MEMFREE_H */
index 8960fc2..a486dec 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
 #include "mthca_cmd.h"
 #include "mthca_memfree.h"
 
+struct mthca_mtt {
+       struct mthca_buddy *buddy;
+       int                 order;
+       u32                 first_seg;
+};
+
 /*
  * Must be packed because mtt_seg is 64 bits but only aligned to 32 bits.
  */
 struct mthca_mpt_entry {
-       u32 flags;
-       u32 page_size;
-       u32 key;
-       u32 pd;
-       u64 start;
-       u64 length;
-       u32 lkey;
-       u32 window_count;
-       u32 window_count_limit;
-       u64 mtt_seg;
-       u32 mtt_sz;             /* Arbel only */
-       u32 reserved[2];
+       __be32 flags;
+       __be32 page_size;
+       __be32 key;
+       __be32 pd;
+       __be64 start;
+       __be64 length;
+       __be32 lkey;
+       __be32 window_count;
+       __be32 window_count_limit;
+       __be64 mtt_seg;
+       __be32 mtt_sz;          /* Arbel only */
+       u32    reserved[2];
 } __attribute__((packed));
 
 #define MTHCA_MPT_FLAG_SW_OWNS       (0xfUL << 28)
@@ -69,6 +76,8 @@ struct mthca_mpt_entry {
 #define MTHCA_MPT_STATUS_SW 0xF0
 #define MTHCA_MPT_STATUS_HW 0x00
 
+#define SINAI_FMR_KEY_INC 0x1000000
+
 /*
  * Buddy allocator for MTT segments (currently not very efficient
  * since it doesn't keep a free list and just searches linearly
@@ -133,13 +142,11 @@ static int __devinit mthca_buddy_init(struct mthca_buddy *buddy, int max_order)
        buddy->max_order = max_order;
        spin_lock_init(&buddy->lock);
 
-       buddy->bits = kmalloc((buddy->max_order + 1) * sizeof (long *),
+       buddy->bits = kzalloc((buddy->max_order + 1) * sizeof (long *),
                              GFP_KERNEL);
        if (!buddy->bits)
                goto err_out;
 
-       memset(buddy->bits, 0, (buddy->max_order + 1) * sizeof (long *));
-
        for (i = 0; i <= buddy->max_order; ++i) {
                s = BITS_TO_LONGS(1 << (buddy->max_order - i));
                buddy->bits[i] = kmalloc(s * sizeof (long), GFP_KERNEL);
@@ -163,7 +170,7 @@ err_out:
        return -ENOMEM;
 }
 
-static void __devexit mthca_buddy_cleanup(struct mthca_buddy *buddy)
+static void mthca_buddy_cleanup(struct mthca_buddy *buddy)
 {
        int i;
 
@@ -173,8 +180,8 @@ static void __devexit mthca_buddy_cleanup(struct mthca_buddy *buddy)
        kfree(buddy->bits);
 }
 
-static u32 mthca_alloc_mtt(struct mthca_dev *dev, int order,
-                          struct mthca_buddy *buddy)
+static u32 mthca_alloc_mtt_range(struct mthca_dev *dev, int order,
+                                struct mthca_buddy *buddy)
 {
        u32 seg = mthca_buddy_alloc(buddy, order);
 
@@ -191,14 +198,102 @@ static u32 mthca_alloc_mtt(struct mthca_dev *dev, int order,
        return seg;
 }
 
-static void mthca_free_mtt(struct mthca_dev *dev, u32 seg, int order,
-                          struct mthca_buddy* buddy)
+static struct mthca_mtt *__mthca_alloc_mtt(struct mthca_dev *dev, int size,
+                                          struct mthca_buddy *buddy)
 {
-       mthca_buddy_free(buddy, seg, order);
+       struct mthca_mtt *mtt;
+       int i;
 
-       if (mthca_is_memfree(dev))
-               mthca_table_put_range(dev, dev->mr_table.mtt_table, seg,
-                                     seg + (1 << order) - 1);
+       if (size <= 0)
+               return ERR_PTR(-EINVAL);
+
+       mtt = kmalloc(sizeof *mtt, GFP_KERNEL);
+       if (!mtt)
+               return ERR_PTR(-ENOMEM);
+
+       mtt->buddy = buddy;
+       mtt->order = 0;
+       for (i = MTHCA_MTT_SEG_SIZE / 8; i < size; i <<= 1)
+               ++mtt->order;
+
+       mtt->first_seg = mthca_alloc_mtt_range(dev, mtt->order, buddy);
+       if (mtt->first_seg == -1) {
+               kfree(mtt);
+               return ERR_PTR(-ENOMEM);
+       }
+
+       return mtt;
+}
+
+struct mthca_mtt *mthca_alloc_mtt(struct mthca_dev *dev, int size)
+{
+       return __mthca_alloc_mtt(dev, size, &dev->mr_table.mtt_buddy);
+}
+
+void mthca_free_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt)
+{
+       if (!mtt)
+               return;
+
+       mthca_buddy_free(mtt->buddy, mtt->first_seg, mtt->order);
+
+       mthca_table_put_range(dev, dev->mr_table.mtt_table,
+                             mtt->first_seg,
+                             mtt->first_seg + (1 << mtt->order) - 1);
+
+       kfree(mtt);
+}
+
+int mthca_write_mtt(struct mthca_dev *dev, struct mthca_mtt *mtt,
+                   int start_index, u64 *buffer_list, int list_len)
+{
+       struct mthca_mailbox *mailbox;
+       __be64 *mtt_entry;
+       int err = 0;
+       u8 status;
+       int i;
+
+       mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
+       if (IS_ERR(mailbox))
+               return PTR_ERR(mailbox);
+       mtt_entry = mailbox->buf;
+
+       while (list_len > 0) {
+               mtt_entry[0] = cpu_to_be64(dev->mr_table.mtt_base +
+                                          mtt->first_seg * MTHCA_MTT_SEG_SIZE +
+                                          start_index * 8);
+               mtt_entry[1] = 0;
+               for (i = 0; i < list_len && i < MTHCA_MAILBOX_SIZE / 8 - 2; ++i)
+                       mtt_entry[i + 2] = cpu_to_be64(buffer_list[i] |
+                                                      MTHCA_MTT_FLAG_PRESENT);
+
+               /*
+                * If we have an odd number of entries to write, add
+                * one more dummy entry for firmware efficiency.
+                */
+               if (i & 1)
+                       mtt_entry[i + 2] = 0;
+
+               err = mthca_WRITE_MTT(dev, mailbox, (i + 1) & ~1, &status);
+               if (err) {
+                       mthca_warn(dev, "WRITE_MTT failed (%d)\n", err);
+                       goto out;
+               }
+               if (status) {
+                       mthca_warn(dev, "WRITE_MTT returned status 0x%02x\n",
+                                  status);
+                       err = -EINVAL;
+                       goto out;
+               }
+
+               list_len    -= i;
+               start_index += i;
+               buffer_list += i;
+       }
+
+out:
+       mthca_free_mailbox(dev, mailbox);
+       return err;
 }
 
 static inline u32 tavor_hw_index_to_key(u32 ind)
@@ -237,96 +332,30 @@ static inline u32 key_to_hw_index(struct mthca_dev *dev, u32 key)
                return tavor_key_to_hw_index(key);
 }
 
-int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd,
-                          u32 access, struct mthca_mr *mr)
+static inline u32 adjust_key(struct mthca_dev *dev, u32 key)
 {
-       void *mailbox = NULL;
-       struct mthca_mpt_entry *mpt_entry;
-       u32 key;
-       int err;
-       u8 status;
-
-       might_sleep();
-
-       mr->order = -1;
-       key = mthca_alloc(&dev->mr_table.mpt_alloc);
-       if (key == -1)
-               return -ENOMEM;
-       mr->ibmr.rkey = mr->ibmr.lkey = hw_index_to_key(dev, key);
-
-       if (mthca_is_memfree(dev)) {
-               err = mthca_table_get(dev, dev->mr_table.mpt_table, key);
-               if (err)
-                       goto err_out_mpt_free;
-       }
-
-       mailbox = kmalloc(sizeof *mpt_entry + MTHCA_CMD_MAILBOX_EXTRA,
-                         GFP_KERNEL);
-       if (!mailbox) {
-               err = -ENOMEM;
-               goto err_out_table;
-       }
-       mpt_entry = MAILBOX_ALIGN(mailbox);
-
-       mpt_entry->flags = cpu_to_be32(MTHCA_MPT_FLAG_SW_OWNS     |
-                                      MTHCA_MPT_FLAG_MIO         |
-                                      MTHCA_MPT_FLAG_PHYSICAL    |
-                                      MTHCA_MPT_FLAG_REGION      |
-                                      access);
-       mpt_entry->page_size = 0;
-       mpt_entry->key       = cpu_to_be32(key);
-       mpt_entry->pd        = cpu_to_be32(pd);
-       mpt_entry->start     = 0;
-       mpt_entry->length    = ~0ULL;
-
-       memset(&mpt_entry->lkey, 0,
-              sizeof *mpt_entry - offsetof(struct mthca_mpt_entry, lkey));
-
-       err = mthca_SW2HW_MPT(dev, mpt_entry,
-                             key & (dev->limits.num_mpts - 1),
-                             &status);
-       if (err) {
-               mthca_warn(dev, "SW2HW_MPT failed (%d)\n", err);
-               goto err_out_table;
-       } else if (status) {
-               mthca_warn(dev, "SW2HW_MPT returned status 0x%02x\n",
-                          status);
-               err = -EINVAL;
-               goto err_out_table;
-       }
-
-       kfree(mailbox);
-       return err;
-
-err_out_table:
-       if (mthca_is_memfree(dev))
-               mthca_table_put(dev, dev->mr_table.mpt_table, key);
-
-err_out_mpt_free:
-       mthca_free(&dev->mr_table.mpt_alloc, key);
-       kfree(mailbox);
-       return err;
+       if (dev->mthca_flags & MTHCA_FLAG_SINAI_OPT)
+               return ((key << 20) & 0x800000) | (key & 0x7fffff);
+       else
+               return key;
 }
 
-int mthca_mr_alloc_phys(struct mthca_dev *dev, u32 pd,
-                       u64 *buffer_list, int buffer_size_shift,
-                       int list_len, u64 iova, u64 total_size,
-                       u32 access, struct mthca_mr *mr)
+int mthca_mr_alloc(struct mthca_dev *dev, u32 pd, int buffer_size_shift,
+                  u64 iova, u64 total_size, u32 access, struct mthca_mr *mr)
 {
-       void *mailbox;
-       u64 *mtt_entry;
+       struct mthca_mailbox *mailbox;
        struct mthca_mpt_entry *mpt_entry;
        u32 key;
-       int err = -ENOMEM;
-       u8 status;
        int i;
+       int err;
+       u8 status;
 
-       might_sleep();
        WARN_ON(buffer_size_shift >= 32);
 
        key = mthca_alloc(&dev->mr_table.mpt_alloc);
        if (key == -1)
                return -ENOMEM;
+       key = adjust_key(dev, key);
        mr->ibmr.rkey = mr->ibmr.lkey = hw_index_to_key(dev, key);
 
        if (mthca_is_memfree(dev)) {
@@ -335,126 +364,109 @@ int mthca_mr_alloc_phys(struct mthca_dev *dev, u32 pd,
                        goto err_out_mpt_free;
        }
 
-       for (i = MTHCA_MTT_SEG_SIZE / 8, mr->order = 0;
-            i < list_len;
-            i <<= 1, ++mr->order)
-               ; /* nothing */
-
-       mr->first_seg = mthca_alloc_mtt(dev, mr->order,
-                                       &dev->mr_table.mtt_buddy);
-       if (mr->first_seg == -1)
+       mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
+       if (IS_ERR(mailbox)) {
+               err = PTR_ERR(mailbox);
                goto err_out_table;
-
-       /*
-        * If list_len is odd, we add one more dummy entry for
-        * firmware efficiency.
-        */
-       mailbox = kmalloc(max(sizeof *mpt_entry,
-                             (size_t) 8 * (list_len + (list_len & 1) + 2)) +
-                         MTHCA_CMD_MAILBOX_EXTRA,
-                         GFP_KERNEL);
-       if (!mailbox)
-               goto err_out_free_mtt;
-
-       mtt_entry = MAILBOX_ALIGN(mailbox);
-
-       mtt_entry[0] = cpu_to_be64(dev->mr_table.mtt_base +
-                                  mr->first_seg * MTHCA_MTT_SEG_SIZE);
-       mtt_entry[1] = 0;
-       for (i = 0; i < list_len; ++i)
-               mtt_entry[i + 2] = cpu_to_be64(buffer_list[i] |
-                                              MTHCA_MTT_FLAG_PRESENT);
-       if (list_len & 1) {
-               mtt_entry[i + 2] = 0;
-               ++list_len;
-       }
-
-       if (0) {
-               mthca_dbg(dev, "Dumping MPT entry\n");
-               for (i = 0; i < list_len + 2; ++i)
-                       printk(KERN_ERR "[%2d] %016llx\n",
-                              i, (unsigned long long) be64_to_cpu(mtt_entry[i]));
-       }
-
-       err = mthca_WRITE_MTT(dev, mtt_entry, list_len, &status);
-       if (err) {
-               mthca_warn(dev, "WRITE_MTT failed (%d)\n", err);
-               goto err_out_mailbox_free;
-       }
-       if (status) {
-               mthca_warn(dev, "WRITE_MTT returned status 0x%02x\n",
-                          status);
-               err = -EINVAL;
-               goto err_out_mailbox_free;
        }
-
-       mpt_entry = MAILBOX_ALIGN(mailbox);
+       mpt_entry = mailbox->buf;
 
        mpt_entry->flags = cpu_to_be32(MTHCA_MPT_FLAG_SW_OWNS     |
                                       MTHCA_MPT_FLAG_MIO         |
                                       MTHCA_MPT_FLAG_REGION      |
                                       access);
+       if (!mr->mtt)
+               mpt_entry->flags |= cpu_to_be32(MTHCA_MPT_FLAG_PHYSICAL);
 
        mpt_entry->page_size = cpu_to_be32(buffer_size_shift - 12);
        mpt_entry->key       = cpu_to_be32(key);
        mpt_entry->pd        = cpu_to_be32(pd);
        mpt_entry->start     = cpu_to_be64(iova);
        mpt_entry->length    = cpu_to_be64(total_size);
+
        memset(&mpt_entry->lkey, 0,
               sizeof *mpt_entry - offsetof(struct mthca_mpt_entry, lkey));
-       mpt_entry->mtt_seg   = cpu_to_be64(dev->mr_table.mtt_base +
-                                          mr->first_seg * MTHCA_MTT_SEG_SIZE);
+
+       if (mr->mtt)
+               mpt_entry->mtt_seg =
+                       cpu_to_be64(dev->mr_table.mtt_base +
+                                   mr->mtt->first_seg * MTHCA_MTT_SEG_SIZE);
 
        if (0) {
                mthca_dbg(dev, "Dumping MPT entry %08x:\n", mr->ibmr.lkey);
                for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; ++i) {
                        if (i % 4 == 0)
                                printk("[%02x] ", i * 4);
-                       printk(" %08x", be32_to_cpu(((u32 *) mpt_entry)[i]));
+                       printk(" %08x", be32_to_cpu(((__be32 *) mpt_entry)[i]));
                        if ((i + 1) % 4 == 0)
                                printk("\n");
                }
        }
 
-       err = mthca_SW2HW_MPT(dev, mpt_entry,
+       err = mthca_SW2HW_MPT(dev, mailbox,
                              key & (dev->limits.num_mpts - 1),
                              &status);
-       if (err)
+       if (err) {
                mthca_warn(dev, "SW2HW_MPT failed (%d)\n", err);
-       else if (status) {
+               goto err_out_mailbox;
+       } else if (status) {
                mthca_warn(dev, "SW2HW_MPT returned status 0x%02x\n",
                           status);
                err = -EINVAL;
+               goto err_out_mailbox;
        }
 
-       kfree(mailbox);
+       mthca_free_mailbox(dev, mailbox);
        return err;
 
-err_out_mailbox_free:
-       kfree(mailbox);
-
-err_out_free_mtt:
-       mthca_free_mtt(dev, mr->first_seg, mr->order, &dev->mr_table.mtt_buddy);
+err_out_mailbox:
+       mthca_free_mailbox(dev, mailbox);
 
 err_out_table:
-       if (mthca_is_memfree(dev))
-               mthca_table_put(dev, dev->mr_table.mpt_table, key);
+       mthca_table_put(dev, dev->mr_table.mpt_table, key);
 
 err_out_mpt_free:
        mthca_free(&dev->mr_table.mpt_alloc, key);
        return err;
 }
 
-/* Free mr or fmr */
-static void mthca_free_region(struct mthca_dev *dev, u32 lkey, int order,
-                             u32 first_seg, struct mthca_buddy *buddy)
+int mthca_mr_alloc_notrans(struct mthca_dev *dev, u32 pd,
+                          u32 access, struct mthca_mr *mr)
 {
-       if (order >= 0)
-               mthca_free_mtt(dev, first_seg, order, buddy);
+       mr->mtt = NULL;
+       return mthca_mr_alloc(dev, pd, 12, 0, ~0ULL, access, mr);
+}
 
-       if (mthca_is_memfree(dev))
-               mthca_table_put(dev, dev->mr_table.mpt_table,
-                               arbel_key_to_hw_index(lkey));
+int mthca_mr_alloc_phys(struct mthca_dev *dev, u32 pd,
+                       u64 *buffer_list, int buffer_size_shift,
+                       int list_len, u64 iova, u64 total_size,
+                       u32 access, struct mthca_mr *mr)
+{
+       int err;
+
+       mr->mtt = mthca_alloc_mtt(dev, list_len);
+       if (IS_ERR(mr->mtt))
+               return PTR_ERR(mr->mtt);
+
+       err = mthca_write_mtt(dev, mr->mtt, 0, buffer_list, list_len);
+       if (err) {
+               mthca_free_mtt(dev, mr->mtt);
+               return err;
+       }
+
+       err = mthca_mr_alloc(dev, pd, buffer_size_shift, iova,
+                            total_size, access, mr);
+       if (err)
+               mthca_free_mtt(dev, mr->mtt);
+
+       return err;
+}
+
+/* Free mr or fmr */
+static void mthca_free_region(struct mthca_dev *dev, u32 lkey)
+{
+       mthca_table_put(dev, dev->mr_table.mpt_table,
+                       key_to_hw_index(dev, lkey));
 
        mthca_free(&dev->mr_table.mpt_alloc, key_to_hw_index(dev, lkey));
 }
@@ -464,8 +476,6 @@ void mthca_free_mr(struct mthca_dev *dev, struct mthca_mr *mr)
        int err;
        u8 status;
 
-       might_sleep();
-
        err = mthca_HW2SW_MPT(dev, NULL,
                              key_to_hw_index(dev, mr->ibmr.lkey) &
                              (dev->limits.num_mpts - 1),
@@ -476,15 +486,15 @@ void mthca_free_mr(struct mthca_dev *dev, struct mthca_mr *mr)
                mthca_warn(dev, "HW2SW_MPT returned status 0x%02x\n",
                           status);
 
-       mthca_free_region(dev, mr->ibmr.lkey, mr->order, mr->first_seg,
-                         &dev->mr_table.mtt_buddy);
+       mthca_free_region(dev, mr->ibmr.lkey);
+       mthca_free_mtt(dev, mr->mtt);
 }
 
 int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
                    u32 access, struct mthca_fmr *mr)
 {
        struct mthca_mpt_entry *mpt_entry;
-       void *mailbox;
+       struct mthca_mailbox *mailbox;
        u64 mtt_seg;
        u32 key, idx;
        u8 status;
@@ -492,9 +502,7 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
        int err = -ENOMEM;
        int i;
 
-       might_sleep();
-
-       if (mr->attr.page_size < 12 || mr->attr.page_size >= 32)
+       if (mr->attr.page_shift < 12 || mr->attr.page_shift >= 32)
                return -EINVAL;
 
        /* For Arbel, all MTTs must fit in the same page. */
@@ -507,6 +515,7 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
        key = mthca_alloc(&dev->mr_table.mpt_alloc);
        if (key == -1)
                return -ENOMEM;
+       key = adjust_key(dev, key);
 
        idx = key & (dev->limits.num_mpts - 1);
        mr->ibmr.rkey = mr->ibmr.lkey = hw_index_to_key(dev, key);
@@ -520,40 +529,33 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
                BUG_ON(!mr->mem.arbel.mpt);
        } else
                mr->mem.tavor.mpt = dev->mr_table.tavor_fmr.mpt_base +
-                       sizeof *(mr->mem.tavor.mpt) * idx;
-
-       for (i = MTHCA_MTT_SEG_SIZE / 8, mr->order = 0;
-            i < list_len;
-            i <<= 1, ++mr->order)
-               ; /* nothing */
+                       sizeof *(mr->mem.tavor.mpt) * idx;
 
-       mr->first_seg = mthca_alloc_mtt(dev, mr->order,
-                                       dev->mr_table.fmr_mtt_buddy);
-       if (mr->first_seg == -1)
+       mr->mtt = __mthca_alloc_mtt(dev, list_len, dev->mr_table.fmr_mtt_buddy);
+       if (IS_ERR(mr->mtt))
                goto err_out_table;
 
-       mtt_seg = mr->first_seg * MTHCA_MTT_SEG_SIZE;
+       mtt_seg = mr->mtt->first_seg * MTHCA_MTT_SEG_SIZE;
 
        if (mthca_is_memfree(dev)) {
                mr->mem.arbel.mtts = mthca_table_find(dev->mr_table.mtt_table,
-                                                     mr->first_seg);
+                                                     mr->mtt->first_seg);
                BUG_ON(!mr->mem.arbel.mtts);
        } else
                mr->mem.tavor.mtts = dev->mr_table.tavor_fmr.mtt_base + mtt_seg;
 
-       mailbox = kmalloc(sizeof *mpt_entry + MTHCA_CMD_MAILBOX_EXTRA,
-                         GFP_KERNEL);
-       if (!mailbox)
+       mailbox = mthca_alloc_mailbox(dev, GFP_KERNEL);
+       if (IS_ERR(mailbox))
                goto err_out_free_mtt;
 
-       mpt_entry = MAILBOX_ALIGN(mailbox);
+       mpt_entry = mailbox->buf;
 
        mpt_entry->flags = cpu_to_be32(MTHCA_MPT_FLAG_SW_OWNS     |
                                       MTHCA_MPT_FLAG_MIO         |
                                       MTHCA_MPT_FLAG_REGION      |
                                       access);
 
-       mpt_entry->page_size = cpu_to_be32(mr->attr.page_size - 12);
+       mpt_entry->page_size = cpu_to_be32(mr->attr.page_shift - 12);
        mpt_entry->key       = cpu_to_be32(key);
        mpt_entry->pd        = cpu_to_be32(pd);
        memset(&mpt_entry->start, 0,
@@ -565,13 +567,13 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
                for (i = 0; i < sizeof (struct mthca_mpt_entry) / 4; ++i) {
                        if (i % 4 == 0)
                                printk("[%02x] ", i * 4);
-                       printk(" %08x", be32_to_cpu(((u32 *) mpt_entry)[i]));
+                       printk(" %08x", be32_to_cpu(((__be32 *) mpt_entry)[i]));
                        if ((i + 1) % 4 == 0)
                                printk("\n");
                }
        }
 
-       err = mthca_SW2HW_MPT(dev, mpt_entry,
+       err = mthca_SW2HW_MPT(dev, mailbox,
                              key & (dev->limits.num_mpts - 1),
                              &status);
        if (err) {
@@ -585,19 +587,17 @@ int mthca_fmr_alloc(struct mthca_dev *dev, u32 pd,
                goto err_out_mailbox_free;
        }
 
-       kfree(mailbox);
+       mthca_free_mailbox(dev, mailbox);
        return 0;
 
 err_out_mailbox_free:
-       kfree(mailbox);
+       mthca_free_mailbox(dev, mailbox);
 
 err_out_free_mtt:
-       mthca_free_mtt(dev, mr->first_seg, mr->order,
-                      dev->mr_table.fmr_mtt_buddy);
+       mthca_free_mtt(dev, mr->mtt);
 
 err_out_table:
-       if (mthca_is_memfree(dev))
-               mthca_table_put(dev, dev->mr_table.mpt_table, key);
+       mthca_table_put(dev, dev->mr_table.mpt_table, key);
 
 err_out_mpt_free:
        mthca_free(&dev->mr_table.mpt_alloc, mr->ibmr.lkey);
@@ -609,8 +609,9 @@ int mthca_free_fmr(struct mthca_dev *dev, struct mthca_fmr *fmr)
        if (fmr->maps)
                return -EBUSY;
 
-       mthca_free_region(dev, fmr->ibmr.lkey, fmr->order, fmr->first_seg,
-                         dev->mr_table.fmr_mtt_buddy);
+       mthca_free_region(dev, fmr->ibmr.lkey);
+       mthca_free_mtt(dev, fmr->mtt);
+
        return 0;
 }
 
@@ -622,7 +623,7 @@ static inline int mthca_check_fmr(struct mthca_fmr *fmr, u64 *page_list,
        if (list_len > fmr->attr.max_pages)
                return -EINVAL;
 
-       page_mask = (1 << fmr->attr.page_size) - 1;
+       page_mask = (1 << fmr->attr.page_shift) - 1;
 
        /* We are getting page lists, so va must be page aligned. */
        if (iova & page_mask)
@@ -670,10 +671,10 @@ int mthca_tavor_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
        }
 
        mpt_entry.lkey   = cpu_to_be32(key);
-       mpt_entry.length = cpu_to_be64(list_len * (1ull << fmr->attr.page_size));
+       mpt_entry.length = cpu_to_be64(list_len * (1ull << fmr->attr.page_shift));
        mpt_entry.start  = cpu_to_be64(iova);
 
-       writel(mpt_entry.lkey, &fmr->mem.tavor.mpt->key);
+       __raw_writel((__force u32) mpt_entry.lkey, &fmr->mem.tavor.mpt->key);
        memcpy_toio(&fmr->mem.tavor.mpt->start, &mpt_entry.start,
                    offsetof(struct mthca_mpt_entry, window_count) -
                    offsetof(struct mthca_mpt_entry, start));
@@ -698,7 +699,10 @@ int mthca_arbel_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
        ++fmr->maps;
 
        key = arbel_key_to_hw_index(fmr->ibmr.lkey);
-       key += dev->limits.num_mpts;
+       if (dev->mthca_flags & MTHCA_FLAG_SINAI_OPT)
+               key += SINAI_FMR_KEY_INC;
+       else
+               key += dev->limits.num_mpts;
        fmr->ibmr.lkey = fmr->ibmr.rkey = arbel_hw_index_to_key(key);
 
        *(u8 *) fmr->mem.arbel.mpt = MTHCA_MPT_STATUS_SW;
@@ -711,7 +715,7 @@ int mthca_arbel_map_phys_fmr(struct ib_fmr *ibfmr, u64 *page_list,
 
        fmr->mem.arbel.mpt->key    = cpu_to_be32(key);
        fmr->mem.arbel.mpt->lkey   = cpu_to_be32(key);
-       fmr->mem.arbel.mpt->length = cpu_to_be64(list_len * (1ull << fmr->attr.page_size));
+       fmr->mem.arbel.mpt->length = cpu_to_be64(list_len * (1ull << fmr->attr.page_shift));
        fmr->mem.arbel.mpt->start  = cpu_to_be64(iova);
 
        wmb();
@@ -757,6 +761,7 @@ void mthca_arbel_fmr_unmap(struct mthca_dev *dev, struct mthca_fmr *fmr)
 
 int __devinit mthca_init_mr_table(struct mthca_dev *dev)
 {
+       unsigned long addr;
        int err, i;
 
        err = mthca_alloc_init(&dev->mr_table.mpt_alloc,
@@ -771,6 +776,9 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
        else
                dev->mthca_flags |= MTHCA_FLAG_FMR;
 
+       if (dev->mthca_flags & MTHCA_FLAG_SINAI_OPT)
+               mthca_dbg(dev, "Memory key throughput optimization activated.\n");
+
        err = mthca_buddy_init(&dev->mr_table.mtt_buddy,
                               fls(dev->limits.num_mtt_segs - 1));
 
@@ -789,9 +797,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
                        goto err_fmr_mpt;
                }
 
+               addr = pci_resource_start(dev->pdev, 4) +
+                       ((pci_resource_len(dev->pdev, 4) - 1) &
+                        dev->mr_table.mpt_base);
+
                dev->mr_table.tavor_fmr.mpt_base =
-                       ioremap(dev->mr_table.mpt_base,
-                               (1 << i) * sizeof (struct mthca_mpt_entry));
+                       ioremap(addr, (1 << i) * sizeof(struct mthca_mpt_entry));
 
                if (!dev->mr_table.tavor_fmr.mpt_base) {
                        mthca_warn(dev, "MPT ioremap for FMR failed.\n");
@@ -799,9 +810,12 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
                        goto err_fmr_mpt;
                }
 
+               addr = pci_resource_start(dev->pdev, 4) +
+                       ((pci_resource_len(dev->pdev, 4) - 1) &
+                        dev->mr_table.mtt_base);
+
                dev->mr_table.tavor_fmr.mtt_base =
-                       ioremap(dev->mr_table.mtt_base,
-                               (1 << i) * MTHCA_MTT_SEG_SIZE);
+                       ioremap(addr, (1 << i) * MTHCA_MTT_SEG_SIZE);
                if (!dev->mr_table.tavor_fmr.mtt_base) {
                        mthca_warn(dev, "MTT ioremap for FMR failed.\n");
                        err = -ENOMEM;
@@ -818,7 +832,7 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
                        goto err_reserve_fmr;
 
                dev->mr_table.fmr_mtt_buddy =
-                       &dev->mr_table.tavor_fmr.mtt_buddy;
+                       &dev->mr_table.tavor_fmr.mtt_buddy;
        } else
                dev->mr_table.fmr_mtt_buddy = &dev->mr_table.mtt_buddy;
 
@@ -826,7 +840,8 @@ int __devinit mthca_init_mr_table(struct mthca_dev *dev)
        if (dev->limits.reserved_mtts) {
                i = fls(dev->limits.reserved_mtts - 1);
 
-               if (mthca_alloc_mtt(dev, i, dev->mr_table.fmr_mtt_buddy) == -1) {
+               if (mthca_alloc_mtt_range(dev, i,
+                                         dev->mr_table.fmr_mtt_buddy) == -1) {
                        mthca_warn(dev, "MTT table of order %d is too small.\n",
                                  dev->mr_table.fmr_mtt_buddy->max_order);
                        err = -ENOMEM;
@@ -858,7 +873,7 @@ err_mtt_buddy:
        return err;
 }
 
-void __devexit mthca_cleanup_mr_table(struct mthca_dev *dev)
+void mthca_cleanup_mr_table(struct mthca_dev *dev)
 {
        /* XXX check if any MRs are still allocated? */
        if (dev->limits.fmr_reserved_mtts)
index ea66847..59df516 100644 (file)
@@ -1,5 +1,7 @@
 /*
  * Copyright (c) 2004 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Cisco Systems.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
 
 #include "mthca_dev.h"
 
-int mthca_pd_alloc(struct mthca_dev *dev, struct mthca_pd *pd)
+int mthca_pd_alloc(struct mthca_dev *dev, int privileged, struct mthca_pd *pd)
 {
-       int err;
+       int err = 0;
 
-       might_sleep();
+       pd->privileged = privileged;
 
        atomic_set(&pd->sqp_count, 0);
        pd->pd_num = mthca_alloc(&dev->pd_table.alloc);
        if (pd->pd_num == -1)
                return -ENOMEM;
 
-       err = mthca_mr_alloc_notrans(dev, pd->pd_num,
-                                    MTHCA_MPT_FLAG_LOCAL_READ |
-                                    MTHCA_MPT_FLAG_LOCAL_WRITE,
-                                    &pd->ntmr);
-       if (err)
-               mthca_free(&dev->pd_table.alloc, pd->pd_num);
+       if (privileged) {
+               err = mthca_mr_alloc_notrans(dev, pd->pd_num,
+                                            MTHCA_MPT_FLAG_LOCAL_READ |
+                                            MTHCA_MPT_FLAG_LOCAL_WRITE,
+                                            &pd->ntmr);
+               if (err)
+                       mthca_free(&dev->pd_table.alloc, pd->pd_num);
+       }
 
        return err;
 }
 
 void mthca_pd_free(struct mthca_dev *dev, struct mthca_pd *pd)
 {
-       might_sleep();
-       mthca_free_mr(dev, &pd->ntmr);
+       if (pd->privileged)
+               mthca_free_mr(dev, &pd->ntmr);
        mthca_free(&dev->pd_table.alloc, pd->pd_num);
 }
 
@@ -73,7 +77,7 @@ int __devinit mthca_init_pd_table(struct mthca_dev *dev)
                                dev->limits.reserved_pds);
 }
 
-void __devexit mthca_cleanup_pd_table(struct mthca_dev *dev)
+void mthca_cleanup_pd_table(struct mthca_dev *dev)
 {
        /* XXX check if any PDs are still allocated? */
        mthca_alloc_cleanup(&dev->pd_table.alloc);
index 4fedc32..58d44aa 100644 (file)
@@ -1,5 +1,6 @@
 /*
  * Copyright (c) 2004, 2005 Topspin Communications.  All rights reserved.
+ * Copyright (c) 2005 Mellanox Technologies. All rights reserved.
  *
  * This software is available to you under a choice of one of two
  * licenses.  You may choose to be licensed under the terms of the GNU
@@ -34,6 +35,8 @@
 
 #include <linux/module.h>
 #include <linux/moduleparam.h>
+#include <linux/string.h>
+#include <linux/slab.h>
 
 #include "mthca_profile.h"
 
@@ -79,12 +82,10 @@ u64 mthca_make_profile(struct mthca_dev *dev,
        struct mthca_resource tmp;
        int i, j;
 
-       profile = kmalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
+       profile = kzalloc(MTHCA_RES_NUM * sizeof *profile, GFP_KERNEL);
        if (!profile)
                return -ENOMEM;
 
-       memset(profile, 0, MTHCA_RES_NUM * sizeof *profile);
-
        profile[MTHCA_RES_QP].size   = dev_lim->qpc_entry_sz;
        profile[MTHCA_RES_EEC].size  = dev_lim->eec_entry_sz;
        profile[MTHCA_RES_SRQ].size  = dev_lim->srq_entry_sz;
@@ -101,6 +102,7 @@ u64 mthca_make_profile(struct mthca_dev *dev,
        profile[MTHCA_RES_UARC].size = request->uarc_size;
 
        profile[MTHCA_RES_QP].num    = request->num_qp;
+       profile[MTHCA_RES_SRQ].num   = request->num_srq;
        profile[MTHCA_RES_EQP].num   = request->num_qp;
        profile[MTHCA_RES_RDB].num   = request->num_qp * request->rdb_per_qp;
        profile[MTHCA_RES_CQ].num    = request->num_cq;
@@ -150,7 +152,7 @@ u64 mthca_make_profile(struct mthca_dev *dev,
                }
                if (total_size > mem_avail) {
                        mthca_err(dev, "Profile requires 0x%llx bytes; "
-                                 "won't in 0x%llx bytes of context memory.\n",
+                                 "won't fit in 0x%llx bytes of context memory.\n",
                                  (unsigned long long) total_size,
                                  (unsigned long long) mem_avail);
                        kfree(profile);
@@ -260,6 +262,14 @@ u64 mthca_make_profile(struct mthca_dev *dev,
         */
        dev->limits.num_pds = MTHCA_NUM_PDS;
 
+       if (dev->mthca_flags & MTHCA_FLAG_SINAI_OPT &&
+           init_hca->log_mpt_sz > 23) {
+               mthca_warn(dev, "MPT table too large (requested size 2^%d >= 2^24)\n",
+                          init_hca->log_mpt_sz);
+               mthca_warn(dev, "Disabling memory key throughput optimization.\n");
+               dev->mthca_flags &= ~MTHCA_FLAG_SINAI_OPT;
+       }
+
        /*
         * For Tavor, FMRs use ioremapped PCI memory. For 32 bit
         * systems it may use too much vmalloc space to map all MTT
index 1c8791d..8e92198 100644 (file)
@@ -32,6 +32,8 @@
  * $Id$
  */
 
+#include <asm/page.h>          /* PAGE_SHIFT */
+
 #include "mthca_dev.h"
 #include "mthca_memfree.h"
 
index 94b8ea8..f887780 100644 (file)
@@ -32,7 +32,6 @@
  * $Id: ipoib_vlan.c 1349 2004-12-16 21:09:43Z roland $
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 
 #include <linux/init.h>
@@ -64,7 +63,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 
        ppriv = netdev_priv(pdev);
 
-       down(&ppriv->vlan_mutex);
+       mutex_lock(&ppriv->vlan_mutex);
 
        /*
         * First ensure this isn't a duplicate. We check the parent device and
@@ -114,8 +113,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 
        priv->parent = ppriv->dev;
 
-       if (ipoib_create_debug_file(priv->dev))
-               goto debug_failed;
+       ipoib_create_debug_files(priv->dev);
 
        if (ipoib_add_pkey_attr(priv->dev))
                goto sysfs_failed;
@@ -126,14 +124,12 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 
        list_add_tail(&priv->list, &ppriv->child_intfs);
 
-       up(&ppriv->vlan_mutex);
+       mutex_unlock(&ppriv->vlan_mutex);
 
        return 0;
 
 sysfs_failed:
-       ipoib_delete_debug_file(priv->dev);
-
-debug_failed:
+       ipoib_delete_debug_files(priv->dev);
        unregister_netdev(priv->dev);
 
 register_failed:
@@ -143,7 +139,7 @@ device_init_failed:
        free_netdev(priv->dev);
 
 err:
-       up(&ppriv->vlan_mutex);
+       mutex_unlock(&ppriv->vlan_mutex);
        return result;
 }
 
@@ -157,21 +153,19 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
 
        ppriv = netdev_priv(pdev);
 
-       down(&ppriv->vlan_mutex);
+       mutex_lock(&ppriv->vlan_mutex);
        list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
                if (priv->pkey == pkey) {
                        unregister_netdev(priv->dev);
                        ipoib_dev_cleanup(priv->dev);
-
                        list_del(&priv->list);
-
-                       kfree(priv);
+                       free_netdev(priv->dev);
 
                        ret = 0;
                        break;
                }
        }
-       up(&ppriv->vlan_mutex);
+       mutex_unlock(&ppriv->vlan_mutex);
 
        return ret;
 }
index ef78bff..2e4abdc 100644 (file)
@@ -66,7 +66,7 @@ static unsigned int hil_kbd_set3[HIL_KEYCODES_SET3_TBLSIZE] =
 static char hil_language[][16] = { HIL_LOCALE_MAP };
 
 struct hil_kbd {
-       struct input_dev dev;
+       struct input_dev *dev;
        struct serio *serio;
 
        /* Input buffer and index for packets from HIL bus. */
@@ -86,7 +86,7 @@ struct hil_kbd {
 /* Process a complete packet after transfer from the HIL */
 static void hil_kbd_process_record(struct hil_kbd *kbd)
 {
-       struct input_dev *dev = &kbd->dev;
+       struct input_dev *dev = kbd->dev;
        hil_packet *data = kbd->data;
        hil_packet p;
        int idx, i, cnt;
@@ -204,7 +204,7 @@ static irqreturn_t hil_kbd_interrupt(struct serio *serio,
        hil_packet packet;
        int idx;
 
-       kbd = (struct hil_kbd *)serio->private;
+       kbd = serio_get_drvdata(serio);
        if (kbd == NULL) {
                BUG();
                return IRQ_HANDLED;
@@ -234,33 +234,38 @@ static void hil_kbd_disconnect(struct serio *serio)
 {
        struct hil_kbd *kbd;
 
-       kbd = (struct hil_kbd *)serio->private;
+       kbd = serio_get_drvdata(serio);
        if (kbd == NULL) {
                BUG();
                return;
        }
 
-       input_unregister_device(&kbd->dev);
        serio_close(serio);
+       input_unregister_device(kbd->dev);
        kfree(kbd);
 }
 
-static void hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
+static int hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
 {
        struct hil_kbd  *kbd;
        uint8_t         did, *idd;
        int             i;
-       
-       if (serio->type != (SERIO_HIL_MLC | SERIO_HIL)) return;
 
-       if (!(kbd = kmalloc(sizeof(struct hil_kbd), GFP_KERNEL))) return;
-       memset(kbd, 0, sizeof(struct hil_kbd));
+       kbd = kzalloc(sizeof(*kbd), GFP_KERNEL);
+       if (!kbd)
+               return -ENOMEM;
 
-       if (serio_open(serio, drv)) goto bail0;
+       kbd->dev = input_allocate_device();
+       if (!kbd->dev)
+               goto bail0;
 
-       serio->private = kbd;
+       kbd->dev->private = kbd;
+
+       if (serio_open(serio, drv))
+               goto bail1;
+
+       serio_set_drvdata(serio, kbd);
        kbd->serio = serio;
-       kbd->dev.private = kbd;
 
        init_MUTEX_LOCKED(&(kbd->sem));
 
@@ -302,38 +307,38 @@ static void hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
                        did, hil_language[did & HIL_IDD_DID_TYPE_KB_LANG_MASK]);
                break;
        default:
-               goto bail1;
+               goto bail2;
        }
 
        if(HIL_IDD_NUM_BUTTONS(idd) || HIL_IDD_NUM_AXES_PER_SET(*idd)) {
                printk(KERN_INFO PREFIX "keyboards only, no combo devices supported.\n");
-               goto bail1;
+               goto bail2;
        }
 
 
-       kbd->dev.evbit[0]       = BIT(EV_KEY) | BIT(EV_REP);
-       kbd->dev.ledbit[0]      = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL);
-       kbd->dev.keycodemax     = HIL_KEYCODES_SET1_TBLSIZE;
-       kbd->dev.keycodesize    = sizeof(hil_kbd_set1[0]);
-       kbd->dev.keycode        = hil_kbd_set1;
-       kbd->dev.name           = strlen(kbd->rnm) ? kbd->rnm : HIL_GENERIC_NAME;
-       kbd->dev.phys           = "hpkbd/input0";       /* XXX */
+       kbd->dev->evbit[0]      = BIT(EV_KEY) | BIT(EV_REP);
+       kbd->dev->ledbit[0]     = BIT(LED_NUML) | BIT(LED_CAPSL) | BIT(LED_SCROLLL);
+       kbd->dev->keycodemax    = HIL_KEYCODES_SET1_TBLSIZE;
+       kbd->dev->keycodesize   = sizeof(hil_kbd_set1[0]);
+       kbd->dev->keycode       = hil_kbd_set1;
+       kbd->dev->name          = strlen(kbd->rnm) ? kbd->rnm : HIL_GENERIC_NAME;
+       kbd->dev->phys          = "hpkbd/input0";       /* XXX */
 
-       kbd->dev.id.bustype     = BUS_HIL;
-       kbd->dev.id.vendor      = PCI_VENDOR_ID_HP;
-       kbd->dev.id.product     = 0x0001; /* TODO: get from kbd->rsc */
-       kbd->dev.id.version     = 0x0100; /* TODO: get from kbd->rsc */
-       kbd->dev.dev            = &serio->dev;
+       kbd->dev->id.bustype    = BUS_HIL;
+       kbd->dev->id.vendor     = PCI_VENDOR_ID_HP;
+       kbd->dev->id.product    = 0x0001; /* TODO: get from kbd->rsc */
+       kbd->dev->id.version    = 0x0100; /* TODO: get from kbd->rsc */
+       kbd->dev->dev           = &serio->dev;
 
        for (i = 0; i < 128; i++) {
-               set_bit(hil_kbd_set1[i], kbd->dev.keybit);
-               set_bit(hil_kbd_set3[i], kbd->dev.keybit);
+               set_bit(hil_kbd_set1[i], kbd->dev->keybit);
+               set_bit(hil_kbd_set3[i], kbd->dev->keybit);
        }
-       clear_bit(0, kbd->dev.keybit);
+       clear_bit(0, kbd->dev->keybit);
 
-       input_register_device(&kbd->dev);
+       input_register_device(kbd->dev);
        printk(KERN_INFO "input: %s, ID: %d\n",
-               kbd->dev.name, did);
+               kbd->dev->name, did);
 
        serio->write(serio, 0);
        serio->write(serio, 0);
@@ -342,19 +347,33 @@ static void hil_kbd_connect(struct serio *serio, struct serio_driver *drv)
        down(&(kbd->sem));
        up(&(kbd->sem));
 
-       return;
- bail1:
+       return 0;
+ bail2:
        serio_close(serio);
+       serio_set_drvdata(serio, NULL);
+ bail1:
+       input_free_device(kbd->dev);
  bail0:
        kfree(kbd);
+       return -EIO;
 }
 
+static struct serio_device_id hil_kbd_ids[] = {
+       {
+               .type = SERIO_HIL_MLC,
+               .proto = SERIO_HIL,
+               .id = SERIO_ANY,
+               .extra = SERIO_ANY,
+       },
+       { 0 }
+};
 
 struct serio_driver hil_kbd_serio_drv = {
        .driver         = {
                .name   = "hil_kbd",
        },
        .description    = "HP HIL keyboard driver",
+       .id_table       = hil_kbd_ids,
        .connect        = hil_kbd_connect,
        .disconnect     = hil_kbd_disconnect,
        .interrupt      = hil_kbd_interrupt
index 1cd7657..1be9639 100644 (file)
@@ -60,8 +60,6 @@ static struct fasync_struct *hp_sdc_rtc_async_queue;
 
 static DECLARE_WAIT_QUEUE_HEAD(hp_sdc_rtc_wait);
 
-static loff_t hp_sdc_rtc_llseek(struct file *file, loff_t offset, int origin);
-
 static ssize_t hp_sdc_rtc_read(struct file *file, char *buf,
                               size_t count, loff_t *ppos);
 
@@ -387,11 +385,6 @@ static int hp_sdc_rtc_set_i8042timer (struct timeval *setto, uint8_t setcmd)
        return 0;
 }
 
-static loff_t hp_sdc_rtc_llseek(struct file *file, loff_t offset, int origin)
-{
-        return -ESPIPE;
-}
-
 static ssize_t hp_sdc_rtc_read(struct file *file, char *buf,
                               size_t count, loff_t *ppos) {
        ssize_t retval;
@@ -679,7 +672,7 @@ static int hp_sdc_rtc_ioctl(struct inode *inode, struct file *file,
 
 static struct file_operations hp_sdc_rtc_fops = {
         .owner =       THIS_MODULE,
-        .llseek =      hp_sdc_rtc_llseek,
+        .llseek =      no_llseek,
         .read =                hp_sdc_rtc_read,
         .poll =                hp_sdc_rtc_poll,
         .ioctl =       hp_sdc_rtc_ioctl,
index aba103d..e428f8d 100644 (file)
@@ -22,7 +22,7 @@ struct alps_model_info {
 };
 
 struct alps_data {
-       struct input_dev dev2;          /* Relative device */
+       struct input_dev *dev2;         /* Relative device */
        char name[32];                  /* Name */
        char phys[32];                  /* Phys */
        struct alps_model_info *i;      /* Info */
index bc22849..69f0217 100644 (file)
@@ -55,7 +55,7 @@ MODULE_LICENSE("Dual BSD/GPL");
 #define HIL_PTR_MAX_LENGTH 16
 
 struct hil_ptr {
-       struct input_dev dev;
+       struct input_dev *dev;
        struct serio *serio;
 
        /* Input buffer and index for packets from HIL bus. */
@@ -79,7 +79,7 @@ struct hil_ptr {
 /* Process a complete packet after transfer from the HIL */
 static void hil_ptr_process_record(struct hil_ptr *ptr)
 {
-       struct input_dev *dev = &ptr->dev;
+       struct input_dev *dev = ptr->dev;
        hil_packet *data = ptr->data;
        hil_packet p;
        int idx, i, cnt, laxis;
@@ -148,12 +148,12 @@ static void hil_ptr_process_record(struct hil_ptr *ptr)
                if (absdev) {
                        val = lo + (hi<<8);
 #ifdef TABLET_AUTOADJUST
-                       if (val < ptr->dev.absmin[ABS_X + i])
-                               ptr->dev.absmin[ABS_X + i] = val;
-                       if (val > ptr->dev.absmax[ABS_X + i])
-                               ptr->dev.absmax[ABS_X + i] = val;
+                       if (val < dev->absmin[ABS_X + i])
+                               dev->absmin[ABS_X + i] = val;
+                       if (val > dev->absmax[ABS_X + i])
+                               dev->absmax[ABS_X + i] = val;
 #endif
-                       if (i%3) val = ptr->dev.absmax[ABS_X + i] - val;
+                       if (i%3) val = dev->absmax[ABS_X + i] - val;
                        input_report_abs(dev, ABS_X + i, val);
                } else {
                        val = (int) (((int8_t)lo) | ((int8_t)hi<<8));
@@ -196,7 +196,7 @@ static irqreturn_t hil_ptr_interrupt(struct serio *serio,
        hil_packet packet;
        int idx;
 
-       ptr = (struct hil_ptr *)serio->private;
+       ptr = serio_get_drvdata(serio);
        if (ptr == NULL) {
                BUG();
                return IRQ_HANDLED;
@@ -227,34 +227,38 @@ static void hil_ptr_disconnect(struct serio *serio)
 {
        struct hil_ptr *ptr;
 
-       ptr = (struct hil_ptr *)serio->private;
+       ptr = serio_get_drvdata(serio);
        if (ptr == NULL) {
                BUG();
                return;
        }
 
-       input_unregister_device(&ptr->dev);
        serio_close(serio);
+       input_unregister_device(ptr->dev);
        kfree(ptr);
 }
 
-static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
+static int hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
 {
-       struct hil_ptr  *ptr;
-       char            *txt;
-       unsigned int    i, naxsets, btntype;
-       uint8_t         did, *idd;
+       struct hil_ptr   *ptr;
+       char             *txt;
+       unsigned int     i, naxsets, btntype;
+       uint8_t          did, *idd;
 
-       if (serio->type != (SERIO_HIL_MLC | SERIO_HIL)) return;
+       if (!(ptr = kzalloc(sizeof(struct hil_ptr), GFP_KERNEL)))
+               return -ENOMEM;
 
-       if (!(ptr = kmalloc(sizeof(struct hil_ptr), GFP_KERNEL))) return;
-       memset(ptr, 0, sizeof(struct hil_ptr));
+       ptr->dev = input_allocate_device();
+       if (!ptr->dev)
+               goto bail0;
 
-       if (serio_open(serio, driver)) goto bail0;
+       ptr->dev->private = ptr;
 
-       serio->private = ptr;
+       if (serio_open(serio, driver))
+               goto bail1;
+
+       serio_set_drvdata(serio, ptr);
        ptr->serio = serio;
-       ptr->dev.private = ptr;
 
        init_MUTEX_LOCKED(&(ptr->sem));
 
@@ -285,25 +289,24 @@ static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
 
        up(&(ptr->sem));
 
-       init_input_dev(&ptr->dev);
        did = ptr->idd[0];
        idd = ptr->idd + 1;
        txt = "unknown";
        if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {
-               ptr->dev.evbit[0] = BIT(EV_REL);
+               ptr->dev->evbit[0] = BIT(EV_REL);
                txt = "relative";
        }
 
        if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_ABS) {
-               ptr->dev.evbit[0] = BIT(EV_ABS);
+               ptr->dev->evbit[0] = BIT(EV_ABS);
                txt = "absolute";
        }
-       if (!ptr->dev.evbit[0]) {
-               goto bail1;
+       if (!ptr->dev->evbit[0]) {
+               goto bail2;
        }
 
        ptr->nbtn = HIL_IDD_NUM_BUTTONS(idd);
-       if (ptr->nbtn) ptr->dev.evbit[0] |= BIT(EV_KEY);
+       if (ptr->nbtn) ptr->dev->evbit[0] |= BIT(EV_KEY);
 
        naxsets = HIL_IDD_NUM_AXSETS(*idd);
        ptr->naxes = HIL_IDD_NUM_AXES_PER_SET(*idd);
@@ -327,7 +330,7 @@ static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
                btntype = BTN_MOUSE;
 
        for (i = 0; i < ptr->nbtn; i++) {
-               set_bit(btntype | i, ptr->dev.keybit);
+               set_bit(btntype | i, ptr->dev->keybit);
                ptr->btnmap[i] = btntype | i;
        }
 
@@ -339,64 +342,77 @@ static void hil_ptr_connect(struct serio *serio, struct serio_driver *driver)
 
        if ((did & HIL_IDD_DID_TYPE_MASK) == HIL_IDD_DID_TYPE_REL) {
                for (i = 0; i < ptr->naxes; i++) {
-                       set_bit(REL_X + i, ptr->dev.relbit);
+                       set_bit(REL_X + i, ptr->dev->relbit);
                }
                for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++) {
-                       set_bit(REL_X + i, ptr->dev.relbit);
+                       set_bit(REL_X + i, ptr->dev->relbit);
                }
        } else {
                for (i = 0; i < ptr->naxes; i++) {
-                       set_bit(ABS_X + i, ptr->dev.absbit);
-                       ptr->dev.absmin[ABS_X + i] = 0;
-                       ptr->dev.absmax[ABS_X + i] = 
+                       set_bit(ABS_X + i, ptr->dev->absbit);
+                       ptr->dev->absmin[ABS_X + i] = 0;
+                       ptr->dev->absmax[ABS_X + i] =
                                HIL_IDD_AXIS_MAX((ptr->idd + 1), i);
                }
                for (i = 3; (i < ptr->naxes + 3) && (naxsets > 1); i++) {
-                       set_bit(ABS_X + i, ptr->dev.absbit);
-                       ptr->dev.absmin[ABS_X + i] = 0;
-                       ptr->dev.absmax[ABS_X + i] = 
+                       set_bit(ABS_X + i, ptr->dev->absbit);
+                       ptr->dev->absmin[ABS_X + i] = 0;
+                       ptr->dev->absmax[ABS_X + i] =
                                HIL_IDD_AXIS_MAX((ptr->idd + 1), (i - 3));
                }
 #ifdef TABLET_AUTOADJUST
                for (i = 0; i < ABS_MAX; i++) {
-                       int diff = ptr->dev.absmax[ABS_X + i] / 10;
-                       ptr->dev.absmin[ABS_X + i] += diff;
-                       ptr->dev.absmax[ABS_X + i] -= diff;
+                       int diff = ptr->dev->absmax[ABS_X + i] / 10;
+                       ptr->dev->absmin[ABS_X + i] += diff;
+                       ptr->dev->absmax[ABS_X + i] -= diff;
                }
 #endif
        }
 
-       ptr->dev.name = strlen(ptr->rnm) ? ptr->rnm : HIL_GENERIC_NAME;
+       ptr->dev->name = strlen(ptr->rnm) ? ptr->rnm : HIL_GENERIC_NAME;
 
-       ptr->dev.id.bustype     = BUS_HIL;
-       ptr->dev.id.vendor      = PCI_VENDOR_ID_HP;
-       ptr->dev.id.product     = 0x0001; /* TODO: get from ptr->rsc */
-       ptr->dev.id.version     = 0x0100; /* TODO: get from ptr->rsc */
-       ptr->dev.dev            = &serio->dev;
+       ptr->dev->id.bustype    = BUS_HIL;
+       ptr->dev->id.vendor     = PCI_VENDOR_ID_HP;
+       ptr->dev->id.product    = 0x0001; /* TODO: get from ptr->rsc */
+       ptr->dev->id.version    = 0x0100; /* TODO: get from ptr->rsc */
+       ptr->dev->dev           = &serio->dev;
 
-       input_register_device(&ptr->dev);
+       input_register_device(ptr->dev);
        printk(KERN_INFO "input: %s (%s), ID: %d\n",
-                ptr->dev.name, 
+               ptr->dev->name,
                (btntype == BTN_MOUSE) ? "HIL mouse":"HIL tablet or touchpad",
                did);
 
-       return;
- bail1:
+       return 0;
+ bail2:
        serio_close(serio);
+ bail1:
+       input_free_device(ptr->dev);
  bail0:
        kfree(ptr);
-       return;
+       serio_set_drvdata(serio, NULL);
+       return -ENODEV;
 }
 
+static struct serio_device_id hil_ptr_ids[] = {
+       {
+               .type = SERIO_HIL_MLC,
+               .proto = SERIO_HIL,
+               .id = SERIO_ANY,
+               .extra = SERIO_ANY,
+       },
+       { 0 }
+};
 
 static struct serio_driver hil_ptr_serio_driver = {
        .driver         = {
                .name   = "hil_ptr",
        },
        .description    = "HP HIL mouse/tablet driver",
-       .connect =      hil_ptr_connect,
-       .disconnect =   hil_ptr_disconnect,
-       .interrupt =    hil_ptr_interrupt
+       .id_table       = hil_ptr_ids,
+       .connect        = hil_ptr_connect,
+       .disconnect     = hil_ptr_disconnect,
+       .interrupt      = hil_ptr_interrupt
 };
 
 static int __init hil_ptr_init(void)
index c243cb6..bbbe15e 100644 (file)
@@ -556,7 +556,7 @@ static inline void hilse_setup_input(hil_mlc *mlc, struct hilse_node *node) {
        do_gettimeofday(&(mlc->instart));
        mlc->icount = 15;
        memset(mlc->ipacket, 0, 16 * sizeof(hil_packet));
-       if (down_trylock(&(mlc->isem))) BUG();
+       BUG_ON(down_trylock(&(mlc->isem)));
 
        return;
 }
@@ -801,7 +801,8 @@ static int hil_mlc_serio_open(struct serio *serio) {
        struct hil_mlc_serio_map *map;
        struct hil_mlc *mlc;
 
-       if (serio->private != NULL) return -EBUSY;
+       if (serio_get_drvdata(serio) != NULL)
+               return -EBUSY;
 
        map = serio->port_data;
        if (map == NULL) {
@@ -832,11 +833,18 @@ static void hil_mlc_serio_close(struct serio *serio) {
                return;
        }
 
-       serio->private = NULL;
+       serio_set_drvdata(serio, NULL);
        serio->drv = NULL;
        /* TODO wake up interruptable */
 }
 
+static struct serio_device_id hil_mlc_serio_id = {
+       .type = SERIO_HIL_MLC,
+       .proto = SERIO_HIL,
+       .extra = SERIO_ANY,
+       .id = SERIO_ANY,
+};
+
 int hil_mlc_register(hil_mlc *mlc) {
        int i;
         unsigned long flags;
@@ -864,10 +872,9 @@ int hil_mlc_register(hil_mlc *mlc) {
        for (i = 0; i < HIL_MLC_DEVMEM; i++) {
                struct serio *mlc_serio;
                hil_mlc_copy_di_scratch(mlc, i);
-               mlc_serio = kmalloc(sizeof(*mlc_serio), GFP_KERNEL);
+               mlc_serio = kzalloc(sizeof(*mlc_serio), GFP_KERNEL);
                mlc->serio[i] = mlc_serio;
-               memset(mlc_serio, 0, sizeof(*mlc_serio));
-               mlc_serio->type                 = SERIO_HIL | SERIO_HIL_MLC;
+               mlc_serio->id                   = hil_mlc_serio_id;
                mlc_serio->write                = hil_mlc_serio_write;
                mlc_serio->open                 = hil_mlc_serio_open;
                mlc_serio->close                = hil_mlc_serio_close;
index 7629452..a10348b 100644 (file)
@@ -764,7 +764,7 @@ MODULE_DEVICE_TABLE(parisc, hp_sdc_tbl);
 static int __init hp_sdc_init_hppa(struct parisc_device *d);
 
 static struct parisc_driver hp_sdc_driver = {
-       .name =         "HP SDC",
+       .name =         "hp_sdc",
        .id_table =     hp_sdc_tbl,
        .probe =        hp_sdc_init_hppa,
 };
@@ -875,9 +875,9 @@ static int __init hp_sdc_init_hppa(struct parisc_device *d)
        hp_sdc.dev              = d;
        hp_sdc.irq              = d->irq;
        hp_sdc.nmi              = d->aux_irq;
-       hp_sdc.base_io          = d->hpa;
-       hp_sdc.data_io          = d->hpa + 0x800;
-       hp_sdc.status_io        = d->hpa + 0x801;
+       hp_sdc.base_io          = d->hpa.start;
+       hp_sdc.data_io          = d->hpa.start + 0x800;
+       hp_sdc.status_io        = d->hpa.start + 0x801;
 
        return hp_sdc_init();
 }
index e3c44ff..aa4a8a4 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/string.h>
+#include <asm/semaphore.h>
 
 #define PREFIX "HP SDC MLC: "
 
@@ -269,9 +270,10 @@ static void hp_sdc_mlc_out (hil_mlc *mlc) {
 
  do_control:
        priv->emtestmode = mlc->opacket & HIL_CTRL_TEST;
-       if ((mlc->opacket & (HIL_CTRL_APE | HIL_CTRL_IPF)) == HIL_CTRL_APE) {
-               BUG(); /* we cannot emulate this, it should not be used. */
-       }
+       
+       /* we cannot emulate this, it should not be used. */
+       BUG_ON((mlc->opacket & (HIL_CTRL_APE | HIL_CTRL_IPF)) == HIL_CTRL_APE);
+       
        if ((mlc->opacket & HIL_CTRL_ONLY) == HIL_CTRL_ONLY) goto control_only;
        if (mlc->opacket & HIL_CTRL_APE) { 
                BUG(); /* Should not send command/data after engaging APE */
index 0487ecb..f606e96 100644 (file)
@@ -84,6 +84,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = {
                        DMI_MATCH(DMI_PRODUCT_VERSION, "DL760"),
                },
        },
+       {
+               .ident = "OQO Model 01",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "OQO"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "ZEPTO"),
+                       DMI_MATCH(DMI_PRODUCT_VERSION, "00"),
+               },
+       },
        { }
 };
 
@@ -130,6 +138,20 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "FMVLT70H"),
                },
        },
+       {
+               .ident = "Fujitsu-Siemens Lifebook T3010",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"),
+               },
+       },
+       {
+               .ident = "Fujitsu-Siemens Lifebook E4010",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK E4010"),
+               },
+       },
        {
                .ident = "Toshiba P10",
                .matches = {
@@ -137,6 +159,27 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"),
                },
        },
+       {
+               .ident = "Alienware Sentia",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"),
+               },
+       },
+       {
+               .ident = "Sharp Actius MM20",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "SHARP"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "PC-MM20 Series"),
+               },
+       },
+       {
+               .ident = "Sony Vaio FS-115b",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FS115B"),
+               },
+       },
        { }
 };
 
@@ -149,7 +192,9 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = {
 #include <linux/pnp.h>
 
 static int i8042_pnp_kbd_registered;
+static unsigned int i8042_pnp_kbd_devices;
 static int i8042_pnp_aux_registered;
+static unsigned int i8042_pnp_aux_devices;
 
 static int i8042_pnp_command_reg;
 static int i8042_pnp_data_reg;
@@ -176,6 +221,7 @@ static int i8042_pnp_kbd_probe(struct pnp_dev *dev, const struct pnp_device_id *
                strncat(i8042_pnp_kbd_name, pnp_dev_name(dev), sizeof(i8042_pnp_kbd_name));
        }
 
+       i8042_pnp_kbd_devices++;
        return 0;
 }
 
@@ -196,6 +242,7 @@ static int i8042_pnp_aux_probe(struct pnp_dev *dev, const struct pnp_device_id *
                strncat(i8042_pnp_aux_name, pnp_dev_name(dev), sizeof(i8042_pnp_aux_name));
        }
 
+       i8042_pnp_aux_devices++;
        return 0;
 }
 
@@ -242,21 +289,25 @@ static void i8042_pnp_exit(void)
        }
 }
 
-static int i8042_pnp_init(void)
+static int __init i8042_pnp_init(void)
 {
-       int result_kbd, result_aux;
+       char kbd_irq_str[4] = { 0 }, aux_irq_str[4] = { 0 };
+       int err;
 
        if (i8042_nopnp) {
                printk(KERN_INFO "i8042: PNP detection disabled\n");
                return 0;
        }
 
-       if ((result_kbd = pnp_register_driver(&i8042_pnp_kbd_driver)) >= 0)
+       err = pnp_register_driver(&i8042_pnp_kbd_driver);
+       if (!err)
                i8042_pnp_kbd_registered = 1;
-       if ((result_aux = pnp_register_driver(&i8042_pnp_aux_driver)) >= 0)
+
+       err = pnp_register_driver(&i8042_pnp_aux_driver);
+       if (!err)
                i8042_pnp_aux_registered = 1;
 
-       if (result_kbd <= 0 && result_aux <= 0) {
+       if (!i8042_pnp_kbd_devices && !i8042_pnp_aux_devices) {
                i8042_pnp_exit();
 #if defined(__ia64__)
                return -ENODEV;
@@ -266,6 +317,27 @@ static int i8042_pnp_init(void)
 #endif
        }
 
+       if (i8042_pnp_kbd_devices)
+               snprintf(kbd_irq_str, sizeof(kbd_irq_str),
+                       "%d", i8042_pnp_kbd_irq);
+       if (i8042_pnp_aux_devices)
+               snprintf(aux_irq_str, sizeof(aux_irq_str),
+                       "%d", i8042_pnp_aux_irq);
+
+       printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %s%s%s\n",
+               i8042_pnp_kbd_name, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
+               i8042_pnp_aux_name,
+               i8042_pnp_data_reg, i8042_pnp_command_reg,
+               kbd_irq_str, (i8042_pnp_kbd_devices && i8042_pnp_aux_devices) ? "," : "",
+               aux_irq_str);
+
+#if defined(__ia64__)
+       if (!i8042_pnp_kbd_devices)
+               i8042_nokbd = 1;
+       if (!i8042_pnp_aux_devices)
+               i8042_noaux = 1;
+#endif
+
        if (((i8042_pnp_data_reg & ~0xf) == (i8042_data_reg & ~0xf) &&
              i8042_pnp_data_reg != i8042_data_reg) || !i8042_pnp_data_reg) {
                printk(KERN_WARNING "PNP: PS/2 controller has invalid data port %#x; using default %#x\n",
@@ -280,53 +352,47 @@ static int i8042_pnp_init(void)
                i8042_pnp_command_reg = i8042_command_reg;
        }
 
-       if (!i8042_pnp_kbd_irq) {
-               printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %#x\n", i8042_kbd_irq);
+       if (!i8042_nokbd && !i8042_pnp_kbd_irq) {
+               printk(KERN_WARNING "PNP: PS/2 controller doesn't have KBD irq; using default %d\n", i8042_kbd_irq);
                i8042_pnp_kbd_irq = i8042_kbd_irq;
        }
 
-       if (!i8042_pnp_aux_irq) {
-               printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %#x\n", i8042_aux_irq);
+       if (!i8042_noaux && !i8042_pnp_aux_irq) {
+               printk(KERN_WARNING "PNP: PS/2 controller doesn't have AUX irq; using default %d\n", i8042_aux_irq);
                i8042_pnp_aux_irq = i8042_aux_irq;
        }
 
-#if defined(__ia64__)
-       if (result_aux <= 0)
-               i8042_noaux = 1;
-#endif
-
        i8042_data_reg = i8042_pnp_data_reg;
        i8042_command_reg = i8042_pnp_command_reg;
        i8042_kbd_irq = i8042_pnp_kbd_irq;
        i8042_aux_irq = i8042_pnp_aux_irq;
 
-       printk(KERN_INFO "PNP: PS/2 Controller [%s%s%s] at %#x,%#x irq %d%s%d\n",
-               i8042_pnp_kbd_name, (result_kbd > 0 && result_aux > 0) ? "," : "", i8042_pnp_aux_name,
-               i8042_data_reg, i8042_command_reg, i8042_kbd_irq,
-               (result_aux > 0) ? "," : "", i8042_aux_irq);
-
        return 0;
 }
 
+#else
+static inline int i8042_pnp_init(void) { return 0; }
+static inline void i8042_pnp_exit(void) { }
 #endif
 
-static inline int i8042_platform_init(void)
+static int __init i8042_platform_init(void)
 {
+       int retval;
+
 /*
  * On ix86 platforms touching the i8042 data register region can do really
  * bad things. Because of this the region is always reserved on ix86 boxes.
  *
  *     if (!request_region(I8042_DATA_REG, 16, "i8042"))
- *             return -1;
+ *             return -EBUSY;
  */
 
        i8042_kbd_irq = I8042_MAP_IRQ(1);
        i8042_aux_irq = I8042_MAP_IRQ(12);
 
-#ifdef CONFIG_PNP
-       if (i8042_pnp_init())
-               return -1;
-#endif
+       retval = i8042_pnp_init();
+       if (retval)
+               return retval;
 
 #if defined(__ia64__)
         i8042_reset = 1;
@@ -340,14 +406,12 @@ static inline int i8042_platform_init(void)
                i8042_nomux = 1;
 #endif
 
-       return 0;
+       return retval;
 }
 
 static inline void i8042_platform_exit(void)
 {
-#ifdef CONFIG_PNP
        i8042_pnp_exit();
-#endif
 }
 
 #endif /* _I8042_X86IA64IO_H */
index 546ce59..c86a2eb 100644 (file)
@@ -36,14 +36,12 @@ MODULE_LICENSE("GPL");
 
 #define        ELO_MAX_LENGTH  10
 
-static char *elo_name = "Elo Serial TouchScreen";
-
 /*
  * Per-touchscreen data.
  */
 
 struct elo {
-       struct input_dev dev;
+       struct input_dev *dev;
        struct serio *serio;
        int id;
        int idx;
@@ -54,7 +52,7 @@ struct elo {
 
 static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_regs *regs)
 {
-       struct input_dev *dev = &elo->dev;
+       struct input_dev *dev = elo->dev;
 
        elo->csum += elo->data[elo->idx] = data;
 
@@ -80,7 +78,7 @@ static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_r
                                input_report_abs(dev, ABS_X, (elo->data[4] << 8) | elo->data[3]);
                                input_report_abs(dev, ABS_Y, (elo->data[6] << 8) | elo->data[5]);
                                input_report_abs(dev, ABS_PRESSURE, (elo->data[8] << 8) | elo->data[7]);
-                               input_report_key(dev, BTN_TOUCH, elo->data[2] & 3);
+                               input_report_key(dev, BTN_TOUCH, elo->data[8] || elo->data[7]);
                                input_sync(dev);
                        }
                        elo->idx = 0;
@@ -91,7 +89,7 @@ static void elo_process_data_10(struct elo* elo, unsigned char data, struct pt_r
 
 static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_regs *regs)
 {
-       struct input_dev *dev = &elo->dev;
+       struct input_dev *dev = elo->dev;
 
        elo->data[elo->idx] = data;
 
@@ -129,7 +127,7 @@ static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_re
                case 5:
                        if ((data & 0xf0) == 0) {
                                input_report_abs(dev, ABS_PRESSURE, elo->data[5]);
-                               input_report_key(dev, BTN_TOUCH, elo->data[5]);
+                               input_report_key(dev, BTN_TOUCH, !!elo->data[5]);
                        }
                        input_sync(dev);
                        elo->idx = 0;
@@ -139,7 +137,7 @@ static void elo_process_data_6(struct elo* elo, unsigned char data, struct pt_re
 
 static void elo_process_data_3(struct elo* elo, unsigned char data, struct pt_regs *regs)
 {
-       struct input_dev *dev = &elo->dev;
+       struct input_dev *dev = elo->dev;
 
        elo->data[elo->idx] = data;
 
@@ -191,7 +189,7 @@ static void elo_disconnect(struct serio *serio)
 {
        struct elo* elo = serio_get_drvdata(serio);
 
-       input_unregister_device(&elo->dev);
+       input_unregister_device(elo->dev);
        serio_close(serio);
        serio_set_drvdata(serio, NULL);
        kfree(elo);
@@ -206,67 +204,68 @@ static void elo_disconnect(struct serio *serio)
 static int elo_connect(struct serio *serio, struct serio_driver *drv)
 {
        struct elo *elo;
+       struct input_dev *input_dev;
        int err;
 
-       if (!(elo = kmalloc(sizeof(struct elo), GFP_KERNEL)))
-               return -ENOMEM;
+       elo = kzalloc(sizeof(struct elo), GFP_KERNEL);
+       input_dev = input_allocate_device();
+       if (!elo || !input_dev) {
+               err = -ENOMEM;
+               goto fail;
+       }
 
-       memset(elo, 0, sizeof(struct elo));
+       elo->serio = serio;
+       elo->id = serio->id.id;
+       elo->dev = input_dev;
+       snprintf(elo->phys, sizeof(elo->phys), "%s/input0", serio->phys);
 
-       init_input_dev(&elo->dev);
-       elo->dev.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
-       elo->dev.keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+       input_dev->private = elo;
+       input_dev->name = "Elo Serial TouchScreen";
+       input_dev->phys = elo->phys;
+       input_dev->id.bustype = BUS_RS232;
+       input_dev->id.vendor = SERIO_ELO;
+       input_dev->id.product = elo->id;
+       input_dev->id.version = 0x0100;
+       input_dev->cdev.dev = &serio->dev;
 
-       elo->id = serio->id.id;
+       input_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
+       input_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
 
        switch (elo->id) {
 
                case 0: /* 10-byte protocol */
-                       input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0);
-                       input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0);
-                       input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 255, 0, 0);
+                       input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
+                       input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
+                       input_set_abs_params(input_dev, ABS_PRESSURE, 0, 255, 0, 0);
                        break;
-               
+
                case 1: /* 6-byte protocol */
-                       input_set_abs_params(&elo->dev, ABS_PRESSURE, 0, 15, 0, 0);
+                       input_set_abs_params(input_dev, ABS_PRESSURE, 0, 15, 0, 0);
 
                case 2: /* 4-byte protocol */
-                       input_set_abs_params(&elo->dev, ABS_X, 96, 4000, 0, 0);
-                       input_set_abs_params(&elo->dev, ABS_Y, 96, 4000, 0, 0);
+                       input_set_abs_params(input_dev, ABS_X, 96, 4000, 0, 0);
+                       input_set_abs_params(input_dev, ABS_Y, 96, 4000, 0, 0);
                        break;
 
                case 3: /* 3-byte protocol */
-                       input_set_abs_params(&elo->dev, ABS_X, 0, 255, 0, 0);
-                       input_set_abs_params(&elo->dev, ABS_Y, 0, 255, 0, 0);
+                       input_set_abs_params(input_dev, ABS_X, 0, 255, 0, 0);
+                       input_set_abs_params(input_dev, ABS_Y, 0, 255, 0, 0);
                        break;
        }
 
-       elo->serio = serio;
-
-       sprintf(elo->phys, "%s/input0", serio->phys);
-
-       elo->dev.private = elo;
-       elo->dev.name = elo_name;
-       elo->dev.phys = elo->phys;
-       elo->dev.id.bustype = BUS_RS232;
-       elo->dev.id.vendor = SERIO_ELO;
-       elo->dev.id.product = elo->id;
-       elo->dev.id.version = 0x0100;
-
        serio_set_drvdata(serio, elo);
 
        err = serio_open(serio, drv);
-       if (err) {
-               serio_set_drvdata(serio, NULL);
-               kfree(elo);
-               return err;
-       }
-
-       input_register_device(&elo->dev);
-
-       printk(KERN_INFO "input: %s on %s\n", elo_name, serio->phys);
+       if (err)
+               goto fail;
 
+       input_register_device(elo->dev);
        return 0;
+
+ fail: serio_set_drvdata(serio, NULL);
+       input_free_device(input_dev);
+       kfree(elo);
+       return err;
 }
 
 /*
index 2d14a57..3226830 100644 (file)
@@ -17,7 +17,7 @@
  * found in Gateway AOL Connected Touchpad computers.
  *
  * Documentation for ICS MK712 can be found at:
- *     http://www.icst.com/pdf/mk712.pdf
+ *     http://www.icst.com/pdf/mk712.pdf
  */
 
 /*
@@ -77,8 +77,7 @@ MODULE_PARM_DESC(irq, "IRQ of MK712 touchscreen controller");
 #define MK712_READ_ONE_POINT                   0x20
 #define MK712_POWERUP                          0x40
 
-static int mk712_used = 0;
-static struct input_dev mk712_dev;
+static struct input_dev *mk712_dev;
 static DEFINE_SPINLOCK(mk712_lock);
 
 static irqreturn_t mk712_interrupt(int irq, void *dev_id, struct pt_regs *regs)
@@ -89,7 +88,7 @@ static irqreturn_t mk712_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        static unsigned short last_y;
 
        spin_lock(&mk712_lock);
-       input_regs(&mk712_dev, regs);
+       input_regs(mk712_dev, regs);
 
        status = inb(mk712_io + MK712_STATUS);
 
@@ -101,7 +100,7 @@ static irqreturn_t mk712_interrupt(int irq, void *dev_id, struct pt_regs *regs)
        if (~status & MK712_STATUS_TOUCH)
        {
                debounce = 1;
-               input_report_key(&mk712_dev, BTN_TOUCH, 0);
+               input_report_key(mk712_dev, BTN_TOUCH, 0);
                goto end;
        }
 
@@ -111,15 +110,15 @@ static irqreturn_t mk712_interrupt(int irq, void *dev_id, struct pt_regs *regs)
                goto end;
        }
 
-       input_report_key(&mk712_dev, BTN_TOUCH, 1);
-       input_report_abs(&mk712_dev, ABS_X, last_x);
-       input_report_abs(&mk712_dev, ABS_Y, last_y);
+       input_report_key(mk712_dev, BTN_TOUCH, 1);
+       input_report_abs(mk712_dev, ABS_X, last_x);
+       input_report_abs(mk712_dev, ABS_Y, last_y);
 
 end:
 
        last_x = inw(mk712_io + MK712_X) & 0x0fff;
        last_y = inw(mk712_io + MK712_Y) & 0x0fff;
-       input_sync(&mk712_dev);
+       input_sync(mk712_dev);
        spin_unlock(&mk712_lock);
        return IRQ_HANDLED;
 }
@@ -130,17 +129,14 @@ static int mk712_open(struct input_dev *dev)
 
        spin_lock_irqsave(&mk712_lock, flags);
 
-       if (!mk712_used++) {
+       outb(0, mk712_io + MK712_CONTROL); /* Reset */
 
-               outb(0, mk712_io + MK712_CONTROL); /* Reset */
+       outb(MK712_ENABLE_INT | MK712_INT_ON_CONVERSION_COMPLETE |
+               MK712_INT_ON_CHANGE_IN_TOUCH_STATUS |
+               MK712_ENABLE_PERIODIC_CONVERSIONS |
+               MK712_POWERUP, mk712_io + MK712_CONTROL);
 
-               outb(MK712_ENABLE_INT | MK712_INT_ON_CONVERSION_COMPLETE |
-                       MK712_INT_ON_CHANGE_IN_TOUCH_STATUS |
-                       MK712_ENABLE_PERIODIC_CONVERSIONS |
-                       MK712_POWERUP, mk712_io + MK712_CONTROL);
-
-               outb(10, mk712_io + MK712_RATE); /* 187 points per second */
-       }
+       outb(10, mk712_io + MK712_RATE); /* 187 points per second */
 
        spin_unlock_irqrestore(&mk712_lock, flags);
 
@@ -153,36 +149,16 @@ static void mk712_close(struct input_dev *dev)
 
        spin_lock_irqsave(&mk712_lock, flags);
 
-       if (!--mk712_used)
-               outb(0, mk712_io + MK712_CONTROL);
+       outb(0, mk712_io + MK712_CONTROL);
 
        spin_unlock_irqrestore(&mk712_lock, flags);
 }
 
-static struct input_dev mk712_dev = {
-       .evbit   = { BIT(EV_KEY) | BIT(EV_ABS) },
-       .keybit  = { [LONG(BTN_TOUCH)] = BIT(BTN_TOUCH) },
-       .absbit  = { BIT(ABS_X) | BIT(ABS_Y) },
-       .open    = mk712_open,
-       .close   = mk712_close,
-       .name    = "ICS MicroClock MK712 TouchScreen",
-       .phys    = "isa0260/input0",
-       .absmin  = { [ABS_X] = 0, [ABS_Y] = 0 },
-       .absmax  = { [ABS_X] = 0xfff, [ABS_Y] = 0xfff },
-       .absfuzz = { [ABS_X] = 88, [ABS_Y] = 88 },
-       .id      = {
-               .bustype = BUS_ISA,
-               .vendor  = 0x0005,
-               .product = 0x0001,
-               .version = 0x0100,
-       },
-};
-
-int __init mk712_init(void)
+static int __init mk712_init(void)
 {
+       int err;
 
-       if(!request_region(mk712_io, 8, "mk712"))
-       {
+       if (!request_region(mk712_io, 8, "mk712")) {
                printk(KERN_WARNING "mk712: unable to get IO region\n");
                return -ENODEV;
        }
@@ -193,28 +169,49 @@ int __init mk712_init(void)
            (inw(mk712_io + MK712_Y) & 0xf000) ||
            (inw(mk712_io + MK712_STATUS) & 0xf333)) {
                printk(KERN_WARNING "mk712: device not present\n");
-               release_region(mk712_io, 8);
-               return -ENODEV;
+               err = -ENODEV;
+               goto fail;
        }
 
-       if(request_irq(mk712_irq, mk712_interrupt, 0, "mk712", &mk712_dev))
-       {
-               printk(KERN_WARNING "mk712: unable to get IRQ\n");
-               release_region(mk712_io, 8);
-               return -EBUSY;
+       if (!(mk712_dev = input_allocate_device())) {
+               printk(KERN_ERR "mk712: not enough memory\n");
+               err = -ENOMEM;
+               goto fail;
        }
 
-       input_register_device(&mk712_dev);
+       mk712_dev->name = "ICS MicroClock MK712 TouchScreen";
+       mk712_dev->phys = "isa0260/input0";
+       mk712_dev->id.bustype = BUS_ISA;
+       mk712_dev->id.vendor  = 0x0005;
+       mk712_dev->id.product = 0x0001;
+       mk712_dev->id.version = 0x0100;
 
-       printk(KERN_INFO "input: ICS MicroClock MK712 TouchScreen at %#x irq %d\n", mk712_io, mk712_irq);
+       mk712_dev->open    = mk712_open;
+       mk712_dev->close   = mk712_close;
 
+       mk712_dev->evbit[0] = BIT(EV_KEY) | BIT(EV_ABS);
+       mk712_dev->keybit[LONG(BTN_TOUCH)] = BIT(BTN_TOUCH);
+       input_set_abs_params(mk712_dev, ABS_X, 0, 0xfff, 88, 0);
+       input_set_abs_params(mk712_dev, ABS_Y, 0, 0xfff, 88, 0);
+
+       if (request_irq(mk712_irq, mk712_interrupt, 0, "mk712", mk712_dev)) {
+               printk(KERN_WARNING "mk712: unable to get IRQ\n");
+               err = -EBUSY;
+               goto fail;
+       }
+
+       input_register_device(mk712_dev);
        return 0;
+
+ fail: input_free_device(mk712_dev);
+       release_region(mk712_io, 8);
+       return err;
 }
 
 static void __exit mk712_exit(void)
 {
-       input_unregister_device(&mk712_dev);
-       free_irq(mk712_irq, &mk712_dev);
+       input_unregister_device(mk712_dev);
+       free_irq(mk712_irq, mk712_dev);
        release_region(mk712_io, 8);
 }
 
index b171600..ec52c1a 100644 (file)
@@ -1,7 +1,7 @@
 /*
 * hfc_usb.h
 *
-* $Id: hfc_usb.h,v 4.1 2005/01/26 17:25:53 martinb1 Exp $
+* $Id: hfc_usb.h,v 4.2 2005/04/07 15:27:17 martinb1 Exp $
 */
 
 #ifndef __HFC_USB_H__
@@ -91,7 +91,7 @@
 /**********/
 /* macros */
 /**********/
-#define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),0,0,HFC_CTRL_TIMEOUT)
+#define write_usb(a,b,c)usb_control_msg((a)->dev,(a)->ctrl_out_pipe,0,0x40,(c),(b),NULL,0,HFC_CTRL_TIMEOUT)
 #define read_usb(a,b,c) usb_control_msg((a)->dev,(a)->ctrl_in_pipe,1,0xC0,0,(b),(c),1,HFC_CTRL_TIMEOUT)
 
 
@@ -168,7 +168,7 @@ static struct hfcusb_symbolic_list urb_errlist[] = {
 * 3 entries are the configuration number, the minimum interval for
 * Interrupt endpoints & boolean if E-channel logging possible
 */
-int validconf[][19] = {
+static int validconf[][19] = {
        // INT in, ISO out config
        {EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NUL, EP_INT, EP_NOP, EP_INT,
         EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_ISO, EP_NUL, EP_NUL, EP_NUL,
@@ -186,13 +186,15 @@ int validconf[][19] = {
        {0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0}        // EOL element
 };
 
+#ifdef CONFIG_HISAX_DEBUG
 // string description of chosen config
-char *conf_str[] = {
+static char *conf_str[] = {
        "4 Interrupt IN + 3 Isochron OUT",
        "3 Interrupt IN + 3 Isochron OUT",
        "4 Isochron IN + 3 Isochron OUT",
        "3 Isochron IN + 3 Isochron OUT"
 };
+#endif
 
 
 typedef struct {
index 4cc0010..baafaab 100644 (file)
@@ -83,8 +83,7 @@ void dm_put_hw_handler(struct hw_handler_type *hwht)
        if (--hwhi->use == 0)
                module_put(hwhi->hwht.module);
 
-       if (hwhi->use < 0)
-               BUG();
+       BUG_ON(hwhi->use < 0);
 
       out:
        up_read(&_hwh_lock);
index 45754bb..da663d2 100644 (file)
@@ -32,16 +32,6 @@ struct io {
 static unsigned _num_ios;
 static mempool_t *_io_pool;
 
-static void *alloc_io(unsigned int __nocast gfp_mask, void *pool_data)
-{
-       return kmalloc(sizeof(struct io), gfp_mask);
-}
-
-static void free_io(void *element, void *pool_data)
-{
-       kfree(element);
-}
-
 static unsigned int pages_to_ios(unsigned int pages)
 {
        return 4 * pages;       /* too many ? */
@@ -65,7 +55,8 @@ static int resize_pool(unsigned int new_ios)
 
        } else {
                /* create new pool */
-               _io_pool = mempool_create(new_ios, alloc_io, free_io, NULL);
+               _io_pool = mempool_create_kmalloc_pool(new_ios,
+                                                      sizeof(struct io));
                if (!_io_pool)
                        return -ENOMEM;
 
@@ -239,6 +230,11 @@ static void vm_dp_init(struct dpages *dp, void *data)
        dp->context_ptr = data;
 }
 
+static void dm_bio_destructor(struct bio *bio)
+{
+       bio_free(bio, _bios);
+}
+
 /*-----------------------------------------------------------------
  * IO routines that accept a list of pages.
  *---------------------------------------------------------------*/
@@ -263,6 +259,7 @@ static void do_region(int rw, unsigned int region, struct io_region *where,
                bio->bi_bdev = where->bdev;
                bio->bi_end_io = endio;
                bio->bi_private = io;
+               bio->bi_destructor = dm_bio_destructor;
                bio_set_region(bio, region);
 
                /*
index a28c1c2..f10a0c8 100644 (file)
@@ -86,8 +86,7 @@ void dm_put_path_selector(struct path_selector_type *pst)
        if (--psi->use == 0)
                module_put(psi->pst.module);
 
-       if (psi->use < 0)
-               BUG();
+       BUG_ON(psi->use < 0);
 
 out:
        up_read(&_ps_lock);
index 375aa24..fdec1e2 100644 (file)
@@ -99,7 +99,9 @@ struct dm_snapshot {
 
        /* You can't use a snapshot if this is 0 (e.g. if full) */
        int valid;
-       int have_metadata;
+
+       /* Origin writes don't trigger exceptions until this is set */
+       int active;
 
        /* Used for display of table */
        char type;
index be4266d..e0bd2d8 100644 (file)
@@ -135,7 +135,7 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
        struct flexcop_device *fc = i2c_get_adapdata(i2c_adap);
        int i, ret = 0;
 
-       if (down_interruptible(&fc->i2c_sem))
+       if (mutex_lock_interruptible(&fc->i2c_mutex))
                return -ERESTARTSYS;
 
        /* reading */
@@ -161,7 +161,7 @@ static int flexcop_master_xfer(struct i2c_adapter *i2c_adap, struct i2c_msg msgs
        else
                ret = num;
 
-       up(&fc->i2c_sem);
+       mutex_unlock(&fc->i2c_mutex);
 
        return ret;
 }
@@ -172,8 +172,6 @@ static u32 flexcop_i2c_func(struct i2c_adapter *adapter)
 }
 
 static struct i2c_algorithm flexcop_algo = {
-       .name                   = "FlexCop I2C algorithm",
-       .id                             = I2C_ALGO_BIT,
        .master_xfer    = flexcop_master_xfer,
        .functionality  = flexcop_i2c_func,
 };
@@ -182,7 +180,7 @@ int flexcop_i2c_init(struct flexcop_device *fc)
 {
        int ret;
 
-       sema_init(&fc->i2c_sem,1);
+       mutex_init(&fc->i2c_mutex);
 
        memset(&fc->i2c_adap, 0, sizeof(struct i2c_adapter));
        strncpy(fc->i2c_adap.name, "B2C2 FlexCop device",I2C_NAME_SIZE);
@@ -192,7 +190,6 @@ int flexcop_i2c_init(struct flexcop_device *fc)
        fc->i2c_adap.class          = I2C_CLASS_TV_DIGITAL;
        fc->i2c_adap.algo       = &flexcop_algo;
        fc->i2c_adap.algo_data  = NULL;
-       fc->i2c_adap.id         = I2C_ALGO_BIT;
 
        if ((ret = i2c_add_adapter(&fc->i2c_adap)) < 0)
                return ret;
index bca41ad..cba4cdf 100644 (file)
@@ -1,4 +1,4 @@
 ovcamchip-objs     := ovcamchip_core.o ov6x20.o ov6x30.o ov7x10.o ov7x20.o \
-                      ov76be.o
+                     ov76be.o
 
 obj-$(CONFIG_VIDEO_OVCAMCHIP) += ovcamchip.o
index 54dd561..3fe9fa0 100644 (file)
@@ -266,17 +266,17 @@ static int ovcamchip_detect(struct i2c_client *c)
                PDEBUG(3, "Testing for 0V6xx0");
                c->addr = OV6xx0_SID;
                if (init_camchip(c) < 0) {
-                       return -ENODEV;
+                       return -ENODEV;
                } else {
                        if (ov6xx0_detect(c) < 0) {
                                PERROR("Failed to init OV6xx0");
-                               return -EIO;
+                               return -EIO;
                        }
                }
        } else {
                if (ov7xx0_detect(c) < 0) {
                        PERROR("Failed to init OV7xx0");
-                       return -EIO;
+                       return -EIO;
                }
        }
 
@@ -296,10 +296,10 @@ static int ovcamchip_attach(struct i2c_adapter *adap)
         * attach to adapters that are known to contain OV camera chips. */
 
        switch (adap->id) {
-       case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV511):
-       case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OV518):
-       case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_OVFX2):
-       case (I2C_ALGO_SMBUS | I2C_HW_SMBUS_W9968CF):
+       case I2C_HW_SMBUS_OV511:
+       case I2C_HW_SMBUS_OV518:
+       case I2C_HW_SMBUS_OVFX2:
+       case I2C_HW_SMBUS_W9968CF:
                PDEBUG(1, "Adapter ID 0x%06x accepted", adap->id);
                break;
        default:
@@ -314,21 +314,20 @@ static int ovcamchip_attach(struct i2c_adapter *adap)
        }
        memcpy(c, &client_template, sizeof *c);
        c->adapter = adap;
-       strcpy(i2c_clientname(c), "OV????");
+       strcpy(c->name, "OV????");
 
-       ov = kmalloc(sizeof *ov, GFP_KERNEL);
+       ov = kzalloc(sizeof *ov, GFP_KERNEL);
        if (!ov) {
                rc = -ENOMEM;
                goto no_ov;
        }
-       memset(ov, 0, sizeof *ov);
        i2c_set_clientdata(c, ov);
 
        rc = ovcamchip_detect(c);
        if (rc < 0)
                goto error;
 
-       strcpy(i2c_clientname(c), chip_names[ov->subtype]);
+       strcpy(c->name, chip_names[ov->subtype]);
 
        PDEBUG(1, "Camera chip detection complete");
 
@@ -410,18 +409,18 @@ static int ovcamchip_command(struct i2c_client *c, unsigned int cmd, void *arg)
 /* ----------------------------------------------------------------------- */
 
 static struct i2c_driver driver = {
-       .owner =                THIS_MODULE,
-       .name =                 "ovcamchip",
+       .driver = {
+               .name =         "ovcamchip",
+       },
        .id =                   I2C_DRIVERID_OVCAMCHIP,
        .class =                I2C_CLASS_CAM_DIGITAL,
-       .flags =                I2C_DF_NOTIFY,
        .attach_adapter =       ovcamchip_attach,
        .detach_client =        ovcamchip_detach,
        .command =              ovcamchip_command,
 };
 
 static struct i2c_client client_template = {
-       I2C_DEVNAME("(unset)"),
+       .name =         "(unset)",
        .driver =       &driver,
 };
 
index 575e612..1231335 100644 (file)
@@ -82,6 +82,6 @@ extern int ov_write_regvals(struct i2c_client *c,
                            struct ovcamchip_regvals *rvals);
 
 extern int ov_write_mask(struct i2c_client *c, unsigned char reg,
-                        unsigned char value, unsigned char mask);
+                        unsigned char value, unsigned char mask);
 
 #endif
index b27cc34..027c8a0 100644 (file)
@@ -1,9 +1,23 @@
 /*
- * $Id: tda8290.c,v 1.7 2005/03/07 12:01:51 kraxel Exp $
- *
- * i2c tv tuner chip device driver
- * controls the philips tda8290+75 tuner chip combo.
- */
+
+   i2c tv tuner chip device driver
+   controls the philips tda8290+75 tuner chip combo.
+
+   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/i2c.h>
 #include <linux/videodev.h>
 #include <linux/delay.h>
 
 /* ---------------------------------------------------------------------- */
 
-struct freq_entry {
-       u16     freq;
-       u8      value;
+struct tda827x_data {
+       u32 lomax;
+       u8  spd;
+       u8  bs;
+       u8  bp;
+       u8  cp;
+       u8  gc3;
+       u8 div1p5;
 };
 
-static struct freq_entry band_table[] = {
-       { 0x2DF4, 0x1C },
-       { 0x2574, 0x14 },
-       { 0x22B4, 0x0C },
-       { 0x20D4, 0x0B },
-       { 0x1E74, 0x3B },
-       { 0x1C34, 0x33 },
-       { 0x16F4, 0x5B },
-       { 0x1454, 0x53 },
-       { 0x12D4, 0x52 },
-       { 0x1034, 0x4A },
-       { 0x0EE4, 0x7A },
-       { 0x0D34, 0x72 },
-       { 0x0B54, 0x9A },
-       { 0x0914, 0x91 },
-       { 0x07F4, 0x89 },
-       { 0x0774, 0xB9 },
-       { 0x067B, 0xB1 },
-       { 0x0634, 0xD9 },
-       { 0x05A4, 0xD8 },       // FM radio
-       { 0x0494, 0xD0 },
-       { 0x03BC, 0xC8 },
-       { 0x0394, 0xF8 },       // 57250000 Hz
-       { 0x0000, 0xF0 },       // 0
-};
+     /* Note lomax entry is lo / 62500 */
 
-static struct freq_entry div_table[] = {
-       { 0x1C34, 3 },
-       { 0x0D34, 2 },
-       { 0x067B, 1 },
-        { 0x0000, 0 },
+static struct tda827x_data tda827x_analog[] = {
+       { .lomax =   992, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, /*  62 MHz */
+       { .lomax =  1056, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 1}, /*  66 MHz */
+       { .lomax =  1216, .spd = 3, .bs = 1, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, /*  76 MHz */
+       { .lomax =  1344, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 3, .div1p5 = 0}, /*  84 MHz */
+       { .lomax =  1488, .spd = 3, .bs = 2, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, /*  93 MHz */
+       { .lomax =  1568, .spd = 3, .bs = 3, .bp = 0, .cp = 0, .gc3 = 1, .div1p5 = 0}, /*  98 MHz */
+       { .lomax =  1744, .spd = 3, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 109 MHz */
+       { .lomax =  1968, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 123 MHz */
+       { .lomax =  2128, .spd = 2, .bs = 3, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 133 MHz */
+       { .lomax =  2416, .spd = 2, .bs = 1, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 151 MHz */
+       { .lomax =  2464, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 154 MHz */
+       { .lomax =  2896, .spd = 2, .bs = 2, .bp = 1, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 181 MHz */
+       { .lomax =  2960, .spd = 2, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 185 MHz */
+       { .lomax =  3472, .spd = 2, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 217 MHz */
+       { .lomax =  3904, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 244 MHz */
+       { .lomax =  4240, .spd = 1, .bs = 3, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 265 MHz */
+       { .lomax =  4832, .spd = 1, .bs = 1, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 302 MHz */
+       { .lomax =  5184, .spd = 1, .bs = 2, .bp = 2, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 324 MHz */
+       { .lomax =  5920, .spd = 1, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 370 MHz */
+       { .lomax =  7264, .spd = 1, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 454 MHz */
+       { .lomax =  7888, .spd = 0, .bs = 2, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 493 MHz */
+       { .lomax =  8480, .spd = 0, .bs = 3, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 1}, /* 530 MHz */
+       { .lomax =  8864, .spd = 0, .bs = 1, .bp = 3, .cp = 0, .gc3 = 1, .div1p5 = 0}, /* 554 MHz */
+       { .lomax =  9664, .spd = 0, .bs = 1, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 604 MHz */
+       { .lomax = 11088, .spd = 0, .bs = 2, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 696 MHz */
+       { .lomax = 11840, .spd = 0, .bs = 2, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, /* 740 MHz */
+       { .lomax = 13120, .spd = 0, .bs = 3, .bp = 4, .cp = 0, .gc3 = 0, .div1p5 = 0}, /* 820 MHz */
+       { .lomax = 13840, .spd = 0, .bs = 3, .bp = 4, .cp = 1, .gc3 = 0, .div1p5 = 0}, /* 865 MHz */
+       { .lomax =     0, .spd = 0, .bs = 0, .bp = 0, .cp = 0, .gc3 = 0, .div1p5 = 0}  /* End      */
 };
 
-static struct freq_entry agc_table[] = {
-       { 0x22B4, 0x8F },
-       { 0x0B54, 0x9F },
-       { 0x09A4, 0x8F },
-       { 0x0554, 0x9F },
-       { 0x0000, 0xBF },
-};
+static void tda827x_tune(struct i2c_client *c, u16 ifc, unsigned int freq)
+{
+       unsigned char tuner_reg[8];
+       unsigned char reg2[2];
+       u32 N;
+       int i;
+       struct tuner *t = i2c_get_clientdata(c);
+       struct i2c_msg msg = {.addr = t->tda827x_addr, .flags = 0};
+
+       if (t->mode == V4L2_TUNER_RADIO)
+               freq = freq / 1000;
 
-static __u8 get_freq_entry( struct freq_entry* table, __u16 freq)
+       N = freq + ifc;
+       i = 0;
+       while (tda827x_analog[i].lomax < N) {
+               if(tda827x_analog[i + 1].lomax == 0)
+                       break;
+               i++;
+       }
+
+       N = N << tda827x_analog[i].spd;
+
+       tuner_reg[0] = 0;
+       tuner_reg[1] = (unsigned char)(N>>8);
+       tuner_reg[2] = (unsigned char) N;
+       tuner_reg[3] = 0x40;
+       tuner_reg[4] = 0x52 + (t->tda827x_lpsel << 5);
+       tuner_reg[5] = (tda827x_analog[i].spd   << 6) + (tda827x_analog[i].div1p5 <<5) +
+                      (tda827x_analog[i].bs     <<3) +  tda827x_analog[i].bp;
+       tuner_reg[6] = 0x8f + (tda827x_analog[i].gc3 << 4);
+       tuner_reg[7] = 0x8f;
+
+       msg.buf = tuner_reg;
+       msg.len = 8;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       msg.buf= reg2;
+       msg.len = 2;
+       reg2[0] = 0x80;
+       reg2[1] = 0;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0x60;
+       reg2[1] = 0xbf;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0x30;
+       reg2[1] = tuner_reg[4] + 0x80;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       msleep(1);
+       reg2[0] = 0x30;
+       reg2[1] = tuner_reg[4] + 4;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       msleep(1);
+       reg2[0] = 0x30;
+       reg2[1] = tuner_reg[4];
+       i2c_transfer(c->adapter, &msg, 1);
+
+       msleep(550);
+       reg2[0] = 0x30;
+       reg2[1] = (tuner_reg[4] & 0xfc) + tda827x_analog[i].cp ;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0x60;
+       reg2[1] = 0x3f;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0x80;
+       reg2[1] = 0x08;   // Vsync en
+       i2c_transfer(c->adapter, &msg, 1);
+}
+
+static void tda827x_agcf(struct i2c_client *c)
 {
-       while(table->freq && table->freq > freq)
-               table++;
-       return table->value;
+       struct tuner *t = i2c_get_clientdata(c);
+       unsigned char data[] = {0x80, 0x0c};
+       struct i2c_msg msg = {.addr = t->tda827x_addr, .buf = data,
+                             .flags = 0, .len = 2};
+       i2c_transfer(c->adapter, &msg, 1);
 }
 
 /* ---------------------------------------------------------------------- */
 
-static unsigned char i2c_enable_bridge[2] =    { 0x21, 0xC0 };
-static unsigned char i2c_disable_bridge[2] =   { 0x21, 0x80 };
-static unsigned char i2c_init_tda8275[14] =    { 0x00, 0x00, 0x00, 0x00,
-                                                 0x7C, 0x04, 0xA3, 0x3F,
-                                                 0x2A, 0x04, 0xFF, 0x00,
-                                                 0x00, 0x40 };
-static unsigned char i2c_set_VS[2] =           { 0x30, 0x6F };
-static unsigned char i2c_set_GP01_CF[2] =      { 0x20, 0x0B };
-static unsigned char i2c_tda8290_reset[2] =    { 0x00, 0x00 };
-static unsigned char i2c_gainset_off[2] =      { 0x28, 0x14 };
-static unsigned char i2c_gainset_on[2] =       { 0x28, 0x54 };
-static unsigned char i2c_agc3_00[2] =          { 0x80, 0x00 };
-static unsigned char i2c_agc2_BF[2] =          { 0x60, 0xBF };
-static unsigned char i2c_cb1_D2[2] =           { 0x30, 0xD2 };
-static unsigned char i2c_cb1_56[2] =           { 0x30, 0x56 };
-static unsigned char i2c_cb1_52[2] =           { 0x30, 0x52 };
-static unsigned char i2c_cb1_50[2] =           { 0x30, 0x50 };
-static unsigned char i2c_agc2_7F[2] =          { 0x60, 0x7F };
-static unsigned char i2c_agc3_08[2] =          { 0x80, 0x08 };
-
-static struct i2c_msg i2c_msg_init[] = {
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_init_tda8275), i2c_init_tda8275 },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_set_VS), i2c_set_VS },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_set_GP01_CF), i2c_set_GP01_CF },
+struct tda827xa_data {
+       u32 lomax;
+       u8  svco;
+       u8  spd;
+       u8  scr;
+       u8  sbs;
+       u8  gc3;
 };
 
-static struct i2c_msg i2c_msg_prolog[] = {
-//     { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_easy_mode), i2c_easy_mode },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_off), i2c_gainset_off },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_tda8290_reset), i2c_tda8290_reset },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_enable_bridge), i2c_enable_bridge },
+static struct tda827xa_data tda827xa_analog[] = {
+       { .lomax =   910, .svco = 3, .spd = 4, .scr = 0, .sbs = 0, .gc3 = 3},  /*  56.875 MHz */
+       { .lomax =  1076, .svco = 0, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3},  /*  67.25 MHz */
+       { .lomax =  1300, .svco = 1, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3},  /*  81.25 MHz */
+       { .lomax =  1560, .svco = 2, .spd = 3, .scr = 0, .sbs = 0, .gc3 = 3},  /*  97.5  MHz */
+       { .lomax =  1820, .svco = 3, .spd = 3, .scr = 0, .sbs = 1, .gc3 = 1},  /* 113.75 MHz */
+       { .lomax =  2152, .svco = 0, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},  /* 134.5 MHz */
+       { .lomax =  2464, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},  /* 154   MHz */
+       { .lomax =  2600, .svco = 1, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},  /* 162.5 MHz */
+       { .lomax =  2928, .svco = 2, .spd = 2, .scr = 0, .sbs = 1, .gc3 = 1},  /* 183   MHz */
+       { .lomax =  3120, .svco = 2, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 1},  /* 195   MHz */
+       { .lomax =  3640, .svco = 3, .spd = 2, .scr = 0, .sbs = 2, .gc3 = 3},  /* 227.5 MHz */
+       { .lomax =  4304, .svco = 0, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 3},  /* 269   MHz */
+       { .lomax =  5200, .svco = 1, .spd = 1, .scr = 0, .sbs = 2, .gc3 = 1},  /* 325   MHz */
+       { .lomax =  6240, .svco = 2, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 3},  /* 390   MHz */
+       { .lomax =  7280, .svco = 3, .spd = 1, .scr = 0, .sbs = 3, .gc3 = 3},  /* 455   MHz */
+       { .lomax =  8320, .svco = 0, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},  /* 520   MHz */
+       { .lomax =  8608, .svco = 0, .spd = 0, .scr = 1, .sbs = 3, .gc3 = 1},  /* 538   MHz */
+       { .lomax =  8864, .svco = 1, .spd = 0, .scr = 0, .sbs = 3, .gc3 = 1},  /* 554   MHz */
+       { .lomax =  9920, .svco = 1, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},  /* 620   MHz */
+       { .lomax = 10400, .svco = 1, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},  /* 650   MHz */
+       { .lomax = 11200, .svco = 2, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},  /* 700   MHz */
+       { .lomax = 12480, .svco = 2, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},  /* 780   MHz */
+       { .lomax = 13120, .svco = 3, .spd = 0, .scr = 0, .sbs = 4, .gc3 = 0},  /* 820   MHz */
+       { .lomax = 13920, .svco = 3, .spd = 0, .scr = 1, .sbs = 4, .gc3 = 0},  /* 870   MHz */
+       { .lomax = 14576, .svco = 3, .spd = 0, .scr = 2, .sbs = 4, .gc3 = 0},  /* 911   MHz */
+       { .lomax =     0, .svco = 0, .spd = 0, .scr = 0, .sbs = 0, .gc3 = 0}   /* End */
 };
 
-static struct i2c_msg i2c_msg_config[] = {
-//     { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_set_freq), i2c_set_freq },
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc3_00), i2c_agc3_00 },
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc2_BF), i2c_agc2_BF },
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_D2), i2c_cb1_D2 },
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_56), i2c_cb1_56 },
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_52), i2c_cb1_52 },
-};
-
-static struct i2c_msg i2c_msg_epilog[] = {
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_cb1_50), i2c_cb1_50 },
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc2_7F), i2c_agc2_7F },
-       { I2C_ADDR_TDA8275, 0, ARRAY_SIZE(i2c_agc3_08), i2c_agc3_08 },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_disable_bridge), i2c_disable_bridge },
-       { I2C_ADDR_TDA8290, 0, ARRAY_SIZE(i2c_gainset_on), i2c_gainset_on },
-};
-
-static int tda8290_tune(struct i2c_client *c)
+static void tda827xa_tune(struct i2c_client *c, u16 ifc, unsigned int freq)
 {
+       unsigned char tuner_reg[14];
+       unsigned char reg2[2];
+       u32 N;
+       int i;
        struct tuner *t = i2c_get_clientdata(c);
-       struct i2c_msg easy_mode =
-               { I2C_ADDR_TDA8290, 0, 2, t->i2c_easy_mode };
-       struct i2c_msg set_freq =
-               { I2C_ADDR_TDA8275, 0, 8, t->i2c_set_freq  };
+       struct i2c_msg msg = {.addr = t->tda827x_addr, .flags = 0};
+
+       if (t->mode == V4L2_TUNER_RADIO)
+               freq = freq / 1000;
 
-       i2c_transfer(c->adapter, &easy_mode,      1);
-       i2c_transfer(c->adapter, i2c_msg_prolog, ARRAY_SIZE(i2c_msg_prolog));
+       N = freq + ifc;
+       i = 0;
+       while (tda827xa_analog[i].lomax < N) {
+               if(tda827xa_analog[i + 1].lomax == 0)
+                       break;
+               i++;
+       }
 
-       i2c_transfer(c->adapter, &set_freq,       1);
-       i2c_transfer(c->adapter, i2c_msg_config, ARRAY_SIZE(i2c_msg_config));
+       N = N << tda827xa_analog[i].spd;
+
+       tuner_reg[0] = 0;
+       tuner_reg[1] = (unsigned char)(N>>8);
+       tuner_reg[2] = (unsigned char) N;
+       tuner_reg[3] = 0;
+       tuner_reg[4] = 0x16;
+       tuner_reg[5] = (tda827xa_analog[i].spd << 5) + (tda827xa_analog[i].svco << 3) +
+                       tda827xa_analog[i].sbs;
+       tuner_reg[6] = 0x8b + (tda827xa_analog[i].gc3 << 4);
+       tuner_reg[7] = 0x0c;
+       tuner_reg[8] = 4;
+       tuner_reg[9] = 0x20;
+       tuner_reg[10] = 0xff;
+       tuner_reg[11] = 0xe0;
+       tuner_reg[12] = 0;
+       tuner_reg[13] = 0x39 + (t->tda827x_lpsel << 1);
+
+       msg.buf = tuner_reg;
+       msg.len = 14;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       msg.buf= reg2;
+       msg.len = 2;
+       reg2[0] = 0x60;
+       reg2[1] = 0x3c;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0xa0;
+       reg2[1] = 0xc0;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       msleep(2);
+       reg2[0] = 0x30;
+       reg2[1] = 0x10 + tda827xa_analog[i].scr;
+       i2c_transfer(c->adapter, &msg, 1);
 
        msleep(550);
-       i2c_transfer(c->adapter, i2c_msg_epilog, ARRAY_SIZE(i2c_msg_epilog));
-       return 0;
+       reg2[0] = 0x50;
+       reg2[1] = 0x8f + (tda827xa_analog[i].gc3 << 4);
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0x80;
+       reg2[1] = 0x28;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0xb0;
+       reg2[1] = 0x01;
+       i2c_transfer(c->adapter, &msg, 1);
+
+       reg2[0] = 0xc0;
+       reg2[1] = 0x19 + (t->tda827x_lpsel << 1);
+       i2c_transfer(c->adapter, &msg, 1);
 }
 
-static void set_frequency(struct tuner *t, u16 ifc)
+static void tda827xa_agcf(struct i2c_client *c)
 {
-       u32 N = (((t->freq<<3)+ifc)&0x3fffc);
-
-       N = N >> get_freq_entry(div_table, t->freq);
-       t->i2c_set_freq[0] = 0;
-       t->i2c_set_freq[1] = (unsigned char)(N>>8);
-       t->i2c_set_freq[2] = (unsigned char) N;
-       t->i2c_set_freq[3] = 0x40;
-       t->i2c_set_freq[4] = 0x52;
-       t->i2c_set_freq[5] = get_freq_entry(band_table, t->freq);
-       t->i2c_set_freq[6] = get_freq_entry(agc_table,  t->freq);
-       t->i2c_set_freq[7] = 0x8f;
+       struct tuner *t = i2c_get_clientdata(c);
+       unsigned char data[] = {0x80, 0x2c};
+       struct i2c_msg msg = {.addr = t->tda827x_addr, .buf = data,
+                             .flags = 0, .len = 2};
+       i2c_transfer(c->adapter, &msg, 1);
 }
 
-#define V4L2_STD_MN    (V4L2_STD_PAL_M|V4L2_STD_PAL_N|V4L2_STD_PAL_Nc|V4L2_STD_NTSC)
-#define V4L2_STD_B     (V4L2_STD_PAL_B|V4L2_STD_PAL_B1|V4L2_STD_SECAM_B)
-#define V4L2_STD_GH    (V4L2_STD_PAL_G|V4L2_STD_PAL_H|V4L2_STD_SECAM_G|V4L2_STD_SECAM_H)
-#define V4L2_STD_DK    (V4L2_STD_PAL_DK|V4L2_STD_SECAM_DK)
+/*---------------------------------------------------------------------*/
+
+static void tda8290_i2c_bridge(struct i2c_client *c, int close)
+{
+       unsigned char  enable[2] = { 0x21, 0xC0 };
+       unsigned char disable[2] = { 0x21, 0x00 };
+       unsigned char *msg;
+       if(close) {
+               msg = enable;
+               i2c_master_send(c, msg, 2);
+               /* let the bridge stabilize */
+               msleep(20);
+       } else {
+               msg = disable;
+               i2c_master_send(c, msg, 2);
+       }
+}
+
+/*---------------------------------------------------------------------*/
+
+static int tda8290_tune(struct i2c_client *c, u16 ifc, unsigned int freq)
+{
+       struct tuner *t = i2c_get_clientdata(c);
+       unsigned char soft_reset[]  = { 0x00, 0x00 };
+       unsigned char easy_mode[]   = { 0x01, t->tda8290_easy_mode };
+       unsigned char expert_mode[] = { 0x01, 0x80 };
+       unsigned char agc_out_on[]  = { 0x02, 0x00 };
+       unsigned char gainset_off[] = { 0x28, 0x14 };
+       unsigned char if_agc_spd[]  = { 0x0f, 0x88 };
+       unsigned char adc_head_6[]  = { 0x05, 0x04 };
+       unsigned char adc_head_9[]  = { 0x05, 0x02 };
+       unsigned char adc_head_12[] = { 0x05, 0x01 };
+       unsigned char pll_bw_nom[]  = { 0x0d, 0x47 };
+       unsigned char pll_bw_low[]  = { 0x0d, 0x27 };
+       unsigned char gainset_2[]   = { 0x28, 0x64 };
+       unsigned char agc_rst_on[]  = { 0x0e, 0x0b };
+       unsigned char agc_rst_off[] = { 0x0e, 0x09 };
+       unsigned char if_agc_set[]  = { 0x0f, 0x81 };
+       unsigned char addr_adc_sat  = 0x1a;
+       unsigned char addr_agc_stat = 0x1d;
+       unsigned char addr_pll_stat = 0x1b;
+       unsigned char adc_sat, agc_stat,
+                     pll_stat;
+
+       i2c_master_send(c, easy_mode, 2);
+       i2c_master_send(c, agc_out_on, 2);
+       i2c_master_send(c, soft_reset, 2);
+       msleep(1);
+
+       expert_mode[1] = t->tda8290_easy_mode + 0x80;
+       i2c_master_send(c, expert_mode, 2);
+       i2c_master_send(c, gainset_off, 2);
+       i2c_master_send(c, if_agc_spd, 2);
+       if (t->tda8290_easy_mode & 0x60)
+               i2c_master_send(c, adc_head_9, 2);
+       else
+               i2c_master_send(c, adc_head_6, 2);
+       i2c_master_send(c, pll_bw_nom, 2);
+
+       tda8290_i2c_bridge(c, 1);
+       if (t->tda827x_ver != 0)
+               tda827xa_tune(c, ifc, freq);
+       else
+               tda827x_tune(c, ifc, freq);
+       /* adjust headroom resp. gain */
+       i2c_master_send(c, &addr_adc_sat, 1);
+       i2c_master_recv(c, &adc_sat, 1);
+       i2c_master_send(c, &addr_agc_stat, 1);
+       i2c_master_recv(c, &agc_stat, 1);
+       i2c_master_send(c, &addr_pll_stat, 1);
+       i2c_master_recv(c, &pll_stat, 1);
+       if (pll_stat & 0x80)
+               tuner_dbg("tda8290 is locked, AGC: %d\n", agc_stat);
+       else
+               tuner_dbg("tda8290 not locked, no signal?\n");
+       if ((agc_stat > 115) || (!(pll_stat & 0x80) && (adc_sat < 20))) {
+               tuner_dbg("adjust gain, step 1. Agc: %d, ADC stat: %d, lock: %d\n",
+                          agc_stat, adc_sat, pll_stat & 0x80);
+               i2c_master_send(c, gainset_2, 2);
+               msleep(100);
+               i2c_master_send(c, &addr_agc_stat, 1);
+               i2c_master_recv(c, &agc_stat, 1);
+               i2c_master_send(c, &addr_pll_stat, 1);
+               i2c_master_recv(c, &pll_stat, 1);
+               if ((agc_stat > 115) || !(pll_stat & 0x80)) {
+                       tuner_dbg("adjust gain, step 2. Agc: %d, lock: %d\n",
+                                  agc_stat, pll_stat & 0x80);
+                       if (t->tda827x_ver != 0)
+                               tda827xa_agcf(c);
+                       else
+                               tda827x_agcf(c);
+                       msleep(100);
+                       i2c_master_send(c, &addr_agc_stat, 1);
+                       i2c_master_recv(c, &agc_stat, 1);
+                       i2c_master_send(c, &addr_pll_stat, 1);
+                       i2c_master_recv(c, &pll_stat, 1);
+                       if((agc_stat > 115) || !(pll_stat & 0x80)) {
+                               tuner_dbg("adjust gain, step 3. Agc: %d\n", agc_stat);
+                               i2c_master_send(c, adc_head_12, 2);
+                               i2c_master_send(c, pll_bw_low, 2);
+                               msleep(100);
+                       }
+               }
+       }
+
+       /* l/ l' deadlock? */
+       if(t->tda8290_easy_mode & 0x60) {
+               i2c_master_send(c, &addr_adc_sat, 1);
+               i2c_master_recv(c, &adc_sat, 1);
+               i2c_master_send(c, &addr_pll_stat, 1);
+               i2c_master_recv(c, &pll_stat, 1);
+               if ((adc_sat > 20) || !(pll_stat & 0x80)) {
+                       tuner_dbg("trying to resolve SECAM L deadlock\n");
+                       i2c_master_send(c, agc_rst_on, 2);
+                       msleep(40);
+                       i2c_master_send(c, agc_rst_off, 2);
+               }
+       }
+
+       tda8290_i2c_bridge(c, 0);
+       i2c_master_send(c, if_agc_set, 2);
+       return 0;
+}
+
+/*---------------------------------------------------------------------*/
 
 static void set_audio(struct tuner *t)
 {
-       t->i2c_easy_mode[0] = 0x01;
-
-       if (t->std & V4L2_STD_MN)
-               t->i2c_easy_mode[1] = 0x01;
-       else if (t->std & V4L2_STD_B)
-               t->i2c_easy_mode[1] = 0x02;
-       else if (t->std & V4L2_STD_GH)
-               t->i2c_easy_mode[1] = 0x04;
-       else if (t->std & V4L2_STD_PAL_I)
-               t->i2c_easy_mode[1] = 0x08;
-       else if (t->std & V4L2_STD_DK)
-               t->i2c_easy_mode[1] = 0x10;
-       else if (t->std & V4L2_STD_SECAM_L)
-               t->i2c_easy_mode[1] = 0x20;
+       char* mode;
+
+       t->tda827x_lpsel = 0;
+       mode = "xx";
+       if (t->std & V4L2_STD_MN) {
+               t->sgIF = 92;
+               t->tda8290_easy_mode = 0x01;
+               t->tda827x_lpsel = 1;
+               mode = "MN";
+       } else if (t->std & V4L2_STD_B) {
+               t->sgIF = 108;
+               t->tda8290_easy_mode = 0x02;
+               mode = "B";
+       } else if (t->std & V4L2_STD_GH) {
+               t->sgIF = 124;
+               t->tda8290_easy_mode = 0x04;
+               mode = "GH";
+       } else if (t->std & V4L2_STD_PAL_I) {
+               t->sgIF = 124;
+               t->tda8290_easy_mode = 0x08;
+               mode = "I";
+       } else if (t->std & V4L2_STD_DK) {
+               t->sgIF = 124;
+               t->tda8290_easy_mode = 0x10;
+               mode = "DK";
+       } else if (t->std & V4L2_STD_SECAM_L) {
+               t->sgIF = 124;
+               t->tda8290_easy_mode = 0x20;
+               mode = "L";
+       } else if (t->std & V4L2_STD_SECAM_LC) {
+               t->sgIF = 20;
+               t->tda8290_easy_mode = 0x40;
+               mode = "LC";
+       }
+    tuner_dbg("setting tda8290 to system %s\n", mode);
 }
 
 static void set_tv_freq(struct i2c_client *c, unsigned int freq)
@@ -179,15 +446,13 @@ static void set_tv_freq(struct i2c_client *c, unsigned int freq)
        struct tuner *t = i2c_get_clientdata(c);
 
        set_audio(t);
-       set_frequency(t, 864);
-       tda8290_tune(c);
+       tda8290_tune(c, t->sgIF, freq);
 }
 
 static void set_radio_freq(struct i2c_client *c, unsigned int freq)
 {
-       struct tuner *t = i2c_get_clientdata(c);
-       set_frequency(t, 704);
-       tda8290_tune(c);
+       /* if frequency is 5.5 MHz */
+       tda8290_tune(c, 88, freq);
 }
 
 static int has_signal(struct i2c_client *c)
@@ -200,21 +465,149 @@ static int has_signal(struct i2c_client *c)
        return (afc & 0x80)? 65535:0;
 }
 
+/*---------------------------------------------------------------------*/
+
+static void standby(struct i2c_client *c)
+{
+       struct tuner *t = i2c_get_clientdata(c);
+       unsigned char cb1[] = { 0x30, 0xD0 };
+       unsigned char tda8290_standby[] = { 0x00, 0x02 };
+       unsigned char tda8290_agc_tri[] = { 0x02, 0x20 };
+       struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0, .buf=cb1, .len = 2};
+
+       tda8290_i2c_bridge(c, 1);
+       if (t->tda827x_ver != 0)
+               cb1[1] = 0x90;
+       i2c_transfer(c->adapter, &msg, 1);
+       tda8290_i2c_bridge(c, 0);
+       i2c_master_send(c, tda8290_agc_tri, 2);
+       i2c_master_send(c, tda8290_standby, 2);
+}
+
+
+static void tda8290_init_if(struct i2c_client *c)
+{
+       unsigned char set_VS[] = { 0x30, 0x6F };
+       unsigned char set_GP01_CF[] = { 0x20, 0x0B };
+
+       i2c_master_send(c, set_VS, 2);
+       i2c_master_send(c, set_GP01_CF, 2);
+}
+
+static void tda8290_init_tuner(struct i2c_client *c)
+{
+       struct tuner *t = i2c_get_clientdata(c);
+       unsigned char tda8275_init[]  = { 0x00, 0x00, 0x00, 0x40, 0xdC, 0x04, 0xAf,
+                                         0x3F, 0x2A, 0x04, 0xFF, 0x00, 0x00, 0x40 };
+       unsigned char tda8275a_init[] = { 0x00, 0x00, 0x00, 0x00, 0xdC, 0x05, 0x8b,
+                                         0x0c, 0x04, 0x20, 0xFF, 0x00, 0x00, 0x4b };
+       struct i2c_msg msg = {.addr = t->tda827x_addr, .flags=0,
+                             .buf=tda8275_init, .len = 14};
+       if (t->tda827x_ver != 0)
+               msg.buf = tda8275a_init;
+
+       tda8290_i2c_bridge(c, 1);
+       i2c_transfer(c->adapter, &msg, 1);
+       tda8290_i2c_bridge(c, 0);
+}
+
+/*---------------------------------------------------------------------*/
+
 int tda8290_init(struct i2c_client *c)
 {
        struct tuner *t = i2c_get_clientdata(c);
+       u8 data;
+       int i, ret, tuners_found;
+       u32 tuner_addrs;
+       struct i2c_msg msg = {.flags=I2C_M_RD, .buf=&data, .len = 1};
+
+       tda8290_i2c_bridge(c, 1);
+       /* probe for tuner chip */
+       tuners_found = 0;
+       tuner_addrs = 0;
+       for (i=0x60; i<= 0x63; i++) {
+               msg.addr = i;
+               ret = i2c_transfer(c->adapter, &msg, 1);
+               if (ret == 1) {
+                       tuners_found++;
+                       tuner_addrs = (tuner_addrs << 8) + i;
+               }
+       }
+       /* if there is more than one tuner, we expect the right one is
+          behind the bridge and we choose the highest address that doesn't
+          give a response now
+        */
+       tda8290_i2c_bridge(c, 0);
+       if(tuners_found > 1)
+               for (i = 0; i < tuners_found; i++) {
+                       msg.addr = tuner_addrs  & 0xff;
+                       ret = i2c_transfer(c->adapter, &msg, 1);
+                       if(ret == 1)
+                               tuner_addrs = tuner_addrs >> 8;
+                       else
+                               break;
+               }
+       if (tuner_addrs == 0) {
+               tuner_addrs = 0x61;
+               tuner_info ("could not clearly identify tuner address, defaulting to %x\n",
+                            tuner_addrs);
+       } else {
+               tuner_addrs = tuner_addrs & 0xff;
+               tuner_info ("setting tuner address to %x\n", tuner_addrs);
+       }
+       t->tda827x_addr = tuner_addrs;
+       msg.addr = tuner_addrs;
 
-       strlcpy(c->name, "tda8290+75", sizeof(c->name));
-       tuner_info("tuner: type set to %s\n", c->name);
-       t->tv_freq    = set_tv_freq;
-       t->radio_freq = set_radio_freq;
+       tda8290_i2c_bridge(c, 1);
+       ret = i2c_transfer(c->adapter, &msg, 1);
+       if( ret != 1)
+               tuner_warn ("TDA827x access failed!\n");
+       if ((data & 0x3c) == 0) {
+               strlcpy(c->name, "tda8290+75", sizeof(c->name));
+               t->tda827x_ver = 0;
+       } else {
+               strlcpy(c->name, "tda8290+75a", sizeof(c->name));
+               t->tda827x_ver = 2;
+       }
+       tuner_info("type set to %s\n", c->name);
+
+       t->set_tv_freq    = set_tv_freq;
+       t->set_radio_freq = set_radio_freq;
        t->has_signal = has_signal;
+       t->standby = standby;
+       t->tda827x_lpsel = 0;
 
-       i2c_master_send(c, i2c_enable_bridge, ARRAY_SIZE(i2c_enable_bridge));
-       i2c_transfer(c->adapter, i2c_msg_init, ARRAY_SIZE(i2c_msg_init));
+       tda8290_init_tuner(c);
+       tda8290_init_if(c);
        return 0;
 }
 
+int tda8290_probe(struct i2c_client *c)
+{
+       unsigned char soft_reset[]   = { 0x00, 0x00 };
+       unsigned char easy_mode_b[]  = { 0x01, 0x02 };
+       unsigned char easy_mode_g[]  = { 0x01, 0x04 };
+       unsigned char restore_9886[] = { 0x00, 0xd6, 0x30 };
+       unsigned char addr_dto_lsb = 0x07;
+       unsigned char data;
+
+       i2c_master_send(c, easy_mode_b, 2);
+       i2c_master_send(c, soft_reset, 2);
+       i2c_master_send(c, &addr_dto_lsb, 1);
+       i2c_master_recv(c, &data, 1);
+       if (data == 0) {
+               i2c_master_send(c, easy_mode_g, 2);
+               i2c_master_send(c, soft_reset, 2);
+               i2c_master_send(c, &addr_dto_lsb, 1);
+               i2c_master_recv(c, &data, 1);
+               if (data == 0x7b) {
+                       return 0;
+               }
+       }
+       i2c_master_send(c, restore_9886, 3);
+       return -1;
+}
+
 /*
  * Overrides for Emacs so that we follow Linus's tabbing style.
  * ---------------------------------------------------------------------------
index 5afe660..986c586 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ixp4xx.c,v 1.7 2004/11/04 13:24:15 gleixner Exp $
+ * $Id: ixp4xx.c,v 1.13 2005/11/16 16:23:21 dvrabel Exp $
  *
  * drivers/mtd/maps/ixp4xx.c
  *
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/string.h>
+#include <linux/slab.h>
+#include <linux/ioport.h>
+#include <linux/device.h>
+#include <linux/platform_device.h>
+
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
-#include <linux/ioport.h>
-#include <linux/device.h>
+
 #include <asm/io.h>
-#include <asm/mach-types.h>
 #include <asm/mach/flash.h>
 
 #include <linux/reboot.h>
 
+/*
+ * Read/write a 16 bit word from flash address 'addr'.
+ *
+ * When the cpu is in little-endian mode it swizzles the address lines
+ * ('address coherency') so we need to undo the swizzling to ensure commands
+ * and the like end up on the correct flash address.
+ *
+ * To further complicate matters, due to the way the expansion bus controller
+ * handles 32 bit reads, the byte stream ABCD is stored on the flash as:
+ *     D15    D0
+ *     +---+---+
+ *     | A | B | 0
+ *     +---+---+
+ *     | C | D | 2
+ *     +---+---+
+ * This means that on LE systems each 16 bit word must be swapped. Note that
+ * this requires CONFIG_MTD_CFI_BE_BYTE_SWAP to be enabled to 'unswap' the CFI
+ * data and other flash commands which are always in D7-D0.
+ */
 #ifndef __ARMEB__
+#ifndef CONFIG_MTD_CFI_BE_BYTE_SWAP
+#  error CONFIG_MTD_CFI_BE_BYTE_SWAP required
+#endif
+
+static inline u16 flash_read16(void __iomem *addr)
+{
+       return be16_to_cpu(__raw_readw((void __iomem *)((unsigned long)addr ^ 0x2)));
+}
+
+static inline void flash_write16(u16 d, void __iomem *addr)
+{
+       __raw_writew(cpu_to_be16(d), (void __iomem *)((unsigned long)addr ^ 0x2));
+}
+
 #define        BYTE0(h)        ((h) & 0xFF)
 #define        BYTE1(h)        (((h) >> 8) & 0xFF)
+
 #else
+
+static inline u16 flash_read16(const void __iomem *addr)
+{
+       return __raw_readw(addr);
+}
+
+static inline void flash_write16(u16 d, void __iomem *addr)
+{
+       __raw_writew(d, addr);
+}
+
 #define        BYTE0(h)        (((h) >> 8) & 0xFF)
 #define        BYTE1(h)        ((h) & 0xFF)
 #endif
@@ -42,7 +90,7 @@
 static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
 {
        map_word val;
-       val.x[0] = *(__u16 *) (map->map_priv_1 + ofs);
+       val.x[0] = flash_read16(map->virt + ofs);
        return val;
 }
 
@@ -54,37 +102,46 @@ static map_word ixp4xx_read16(struct map_info *map, unsigned long ofs)
 static void ixp4xx_copy_from(struct map_info *map, void *to,
                             unsigned long from, ssize_t len)
 {
-       int i;
        u8 *dest = (u8 *) to;
-       u16 *src = (u16 *) (map->map_priv_1 + from);
-       u16 data;
+       void __iomem *src = map->virt + from;
+
+       if (len <= 0)
+               return;
 
-       for (i = 0; i < (len / 2); i++) {
-               data = src[i];
-               dest[i * 2] = BYTE0(data);
-               dest[i * 2 + 1] = BYTE1(data);
+       if (from & 1) {
+               *dest++ = BYTE1(flash_read16(src));
+                src++;
+               --len;
        }
 
-       if (len & 1)
-               dest[len - 1] = BYTE0(src[i]);
+       while (len >= 2) {
+               u16 data = flash_read16(src);
+               *dest++ = BYTE0(data);
+               *dest++ = BYTE1(data);
+               src += 2;
+               len -= 2;
+        }
+
+       if (len > 0)
+               *dest++ = BYTE0(flash_read16(src));
 }
 
-/* 
+/*
  * Unaligned writes are ignored, causing the 8-bit
  * probe to fail and proceed to the 16-bit probe (which succeeds).
  */
 static void ixp4xx_probe_write16(struct map_info *map, map_word d, unsigned long adr)
 {
        if (!(adr & 1))
-              *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
+               flash_write16(d.x[0], map->virt + adr);
 }
 
-/* 
+/*
  * Fast write16 function without the probing check above
  */
 static void ixp4xx_write16(struct map_info *map, map_word d, unsigned long adr)
 {
-       *(__u16 *) (map->map_priv_1 + adr) = d.x[0];
+       flash_write16(d.x[0], map->virt + adr);
 }
 
 struct ixp4xx_flash_info {
@@ -96,33 +153,24 @@ struct ixp4xx_flash_info {
 
 static const char *probes[] = { "RedBoot", "cmdlinepart", NULL };
 
-static int ixp4xx_flash_remove(struct device *_dev)
+static int ixp4xx_flash_remove(struct platform_device *dev)
 {
-       struct platform_device *dev = to_platform_device(_dev);
        struct flash_platform_data *plat = dev->dev.platform_data;
-       struct ixp4xx_flash_info *info = dev_get_drvdata(&dev->dev);
-       map_word d;
+       struct ixp4xx_flash_info *info = platform_get_drvdata(dev);
 
-       dev_set_drvdata(&dev->dev, NULL);
+       platform_set_drvdata(dev, NULL);
 
        if(!info)
                return 0;
 
-       /*
-        * This is required for a soft reboot to work.
-        */
-       d.x[0] = 0xff;
-       ixp4xx_write16(&info->map, d, 0x55 * 0x2);
-
        if (info->mtd) {
                del_mtd_partitions(info->mtd);
                map_destroy(info->mtd);
        }
-       if (info->map.map_priv_1)
-               iounmap((void *) info->map.map_priv_1);
+       if (info->map.virt)
+               iounmap(info->map.virt);
 
-       if (info->partitions)
-               kfree(info->partitions);
+       kfree(info->partitions);
 
        if (info->res) {
                release_resource(info->res);
@@ -132,15 +180,11 @@ static int ixp4xx_flash_remove(struct device *_dev)
        if (plat->exit)
                plat->exit();
 
-       /* Disable flash write */
-       *IXP4XX_EXP_CS0 &= ~IXP4XX_FLASH_WRITABLE;
-
        return 0;
 }
 
-static int ixp4xx_flash_probe(struct device *_dev)
+static int ixp4xx_flash_probe(struct platform_device *dev)
 {
-       struct platform_device *dev = to_platform_device(_dev);
        struct flash_platform_data *plat = dev->dev.platform_data;
        struct ixp4xx_flash_info *info;
        int err = -1;
@@ -158,16 +202,10 @@ static int ixp4xx_flash_probe(struct device *_dev)
        if(!info) {
                err = -ENOMEM;
                goto Error;
-       }       
+       }
        memzero(info, sizeof(struct ixp4xx_flash_info));
 
-       dev_set_drvdata(&dev->dev, info);
-
-       /* 
-        * Enable flash write 
-        * TODO: Move this out to board specific code
-        */
-       *IXP4XX_EXP_CS0 |= IXP4XX_FLASH_WRITABLE;
+       platform_set_drvdata(dev, info);
 
        /*
         * Tell the MTD layer we're not 1:1 mapped so that it does
@@ -187,8 +225,8 @@ static int ixp4xx_flash_probe(struct device *_dev)
        info->map.write = ixp4xx_probe_write16,
        info->map.copy_from = ixp4xx_copy_from,
 
-       info->res = request_mem_region(dev->resource->start, 
-                       dev->resource->end - dev->resource->start + 1, 
+       info->res = request_mem_region(dev->resource->start,
+                       dev->resource->end - dev->resource->start + 1,
                        "IXP4XXFlash");
        if (!info->res) {
                printk(KERN_ERR "IXP4XXFlash: Could not reserve memory region\n");
@@ -196,9 +234,9 @@ static int ixp4xx_flash_probe(struct device *_dev)
                goto Error;
        }
 
-       info->map.map_priv_1 = ioremap(dev->resource->start,
-                           dev->resource->end - dev->resource->start + 1);
-       if (!info->map.map_priv_1) {
+       info->map.virt = ioremap(dev->resource->start,
+                                dev->resource->end - dev->resource->start + 1);
+       if (!info->map.virt) {
                printk(KERN_ERR "IXP4XXFlash: Failed to ioremap region\n");
                err = -EIO;
                goto Error;
@@ -211,7 +249,7 @@ static int ixp4xx_flash_probe(struct device *_dev)
                goto Error;
        }
        info->mtd->owner = THIS_MODULE;
-       
+
        /* Use the fast version */
        info->map.write = ixp4xx_write16,
 
@@ -228,25 +266,26 @@ static int ixp4xx_flash_probe(struct device *_dev)
        return 0;
 
 Error:
-       ixp4xx_flash_remove(_dev);
+       ixp4xx_flash_remove(dev);
        return err;
 }
 
-static struct device_driver ixp4xx_flash_driver = {
-       .name           = "IXP4XX-Flash",
-       .bus            = &platform_bus_type,
+static struct platform_driver ixp4xx_flash_driver = {
        .probe          = ixp4xx_flash_probe,
        .remove         = ixp4xx_flash_remove,
+       .driver         = {
+               .name   = "IXP4XX-Flash",
+       },
 };
 
 static int __init ixp4xx_flash_init(void)
 {
-       return driver_register(&ixp4xx_flash_driver);
+       return platform_driver_register(&ixp4xx_flash_driver);
 }
 
 static void __exit ixp4xx_flash_exit(void)
 {
-       driver_unregister(&ixp4xx_flash_driver);
+       platform_driver_unregister(&ixp4xx_flash_driver);
 }
 
 
@@ -254,6 +293,5 @@ module_init(ixp4xx_flash_init);
 module_exit(ixp4xx_flash_exit);
 
 MODULE_LICENSE("GPL");
-MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems")
+MODULE_DESCRIPTION("MTD map driver for Intel IXP4xx systems");
 MODULE_AUTHOR("Deepak Saxena");
-
index b3b39cb..12fe53c 100644 (file)
@@ -1,10 +1,10 @@
 /*
  * sharpsl-flash.c
- * 
+ *
  * Copyright (C) 2001 Lineo Japan, Inc.
  * Copyright (C) 2002  SHARP
  *
- * $Id: sharpsl-flash.c,v 1.2 2004/11/24 20:38:06 rpurdie Exp $
+ * $Id: sharpsl-flash.c,v 1.7 2005/11/07 11:14:28 gleixner Exp $
  *
  * based on rpxlite.c,v 1.15 2001/10/02 15:05:14 dwmw2 Exp
  *          Handle mapping of the flash on the RPX Lite and CLLF boards
 #include <linux/module.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
-#include <asm/io.h>
 #include <linux/mtd/mtd.h>
 #include <linux/mtd/map.h>
 #include <linux/mtd/partitions.h>
+#include <asm/io.h>
+#include <asm/mach-types.h>
 
 #define WINDOW_ADDR 0x00000000
-#define WINDOW_SIZE 0x01000000
+#define WINDOW_SIZE 0x00800000
 #define BANK_WIDTH 2
 
 static struct mtd_info *mymtd;
@@ -44,26 +45,26 @@ struct map_info sharpsl_map = {
 
 static struct mtd_partition sharpsl_partitions[1] = {
        {
-               name:           "Filesystem",
-               size:           0x006d0000,
-               offset:         0x00120000
+               name:           "Boot PROM Filesystem",
        }
 };
 
-#define NB_OF(x)  (sizeof(x)/sizeof(x[0]))
-
 int __init init_sharpsl(void)
 {
        struct mtd_partition *parts;
        int nb_parts = 0;
        char *part_type = "static";
 
-       printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n", WINDOW_SIZE, WINDOW_ADDR);
+       printk(KERN_NOTICE "Sharp SL series flash device: %x at %x\n",
+               WINDOW_SIZE, WINDOW_ADDR);
        sharpsl_map.virt = ioremap(WINDOW_ADDR, WINDOW_SIZE);
        if (!sharpsl_map.virt) {
                printk("Failed to ioremap\n");
                return -EIO;
        }
+
+       simple_map_init(&sharpsl_map);
+
        mymtd = do_map_probe("map_rom", &sharpsl_map);
        if (!mymtd) {
                iounmap(sharpsl_map.virt);
@@ -72,8 +73,24 @@ int __init init_sharpsl(void)
 
        mymtd->owner = THIS_MODULE;
 
+       if (machine_is_corgi() || machine_is_shepherd() || machine_is_husky()
+               || machine_is_poodle()) {
+               sharpsl_partitions[0].size=0x006d0000;
+               sharpsl_partitions[0].offset=0x00120000;
+       } else if (machine_is_tosa()) {
+               sharpsl_partitions[0].size=0x006a0000;
+               sharpsl_partitions[0].offset=0x00160000;
+       } else if (machine_is_spitz() || machine_is_akita() || machine_is_borzoi()) {
+               sharpsl_partitions[0].size=0x006b0000;
+               sharpsl_partitions[0].offset=0x00140000;
+       } else {
+               map_destroy(mymtd);
+               iounmap(sharpsl_map.virt);
+               return -ENODEV;
+       }
+
        parts = sharpsl_partitions;
-       nb_parts = NB_OF(sharpsl_partitions);
+       nb_parts = ARRAY_SIZE(sharpsl_partitions);
 
        printk(KERN_NOTICE "Using %s partision definition\n", part_type);
        add_mtd_partitions(mymtd, parts, nb_parts);
index 84e291e..7ea3d59 100644 (file)
@@ -27,6 +27,7 @@ static const char version1[] =
 #include <linux/delay.h>
 #include <linux/netdevice.h>
 #include <linux/etherdevice.h>
+#include <linux/jiffies.h>
 
 #include <asm/system.h>
 #include <asm/io.h>
@@ -180,12 +181,7 @@ struct net_device * __init ne_probe(int unit)
        err = do_ne_probe(dev);
        if (err)
                goto out;
-       err = register_netdev(dev);
-       if (err)
-               goto out1;
        return dev;
-out1:
-       cleanup_card(dev);
 out:
        free_netdev(dev);
        return ERR_PTR(err);
@@ -325,8 +321,13 @@ static int __init ne_probe1(struct net_device *dev, int ioaddr)
        dev->poll_controller = ei_poll;
 #endif
        NS8390_init(dev, 0);
-       return 0;
 
+       ret = register_netdev(dev);
+       if (ret)
+               goto out_irq;
+       return 0;
+out_irq:
+       free_irq(dev->irq, dev);
 err_out:
        release_region(ioaddr, NE_IO_EXTENT);
        return ret;
@@ -365,7 +366,7 @@ static void ne_reset_8390(struct net_device *dev)
 
        /* This check _should_not_ be necessary, omit eventually. */
        while ((inb_p(NE_BASE+EN0_ISR) & ENISR_RESET) == 0)
-               if (jiffies - reset_start_time > 2*HZ/100) {
+               if (time_after(jiffies, reset_start_time + 2*HZ/100)) {
                        printk(KERN_WARNING "%s: ne_reset_8390() did not complete.\n", dev->name);
                        break;
                }
@@ -580,7 +581,7 @@ retry:
 #endif
 
        while ((inb_p(NE_BASE + EN0_ISR) & ENISR_RDC) == 0)
-               if (jiffies - dma_start > 2*HZ/100) {           /* 20ms */
+               if (time_after(jiffies, dma_start + 2*HZ/100)) {                /* 20ms */
                        printk(KERN_WARNING "%s: timeout waiting for Tx RDC.\n", dev->name);
                        ne_reset_8390(dev);
                        NS8390_init(dev,1);
@@ -600,9 +601,9 @@ static int io[MAX_NE_CARDS];
 static int irq[MAX_NE_CARDS];
 static int bad[MAX_NE_CARDS];  /* 0xbad = bad sig or no reset ack */
 
-MODULE_PARM(io, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(irq, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
-MODULE_PARM(bad, "1-" __MODULE_STRING(MAX_NE_CARDS) "i");
+module_param_array(io, int, NULL, 0);
+module_param_array(irq, int, NULL, 0);
+module_param_array(bad, int, NULL, 0);
 MODULE_PARM_DESC(io, "I/O base address(es)");
 MODULE_PARM_DESC(irq, "IRQ number(s)");
 MODULE_DESCRIPTION("H8/300 NE2000 Ethernet driver");
@@ -633,11 +634,8 @@ int init_module(void)
                err = init_reg_offset(dev, dev->base_addr);
                if (!err) {
                        if (do_ne_probe(dev) == 0) {
-                               if (register_netdev(dev) == 0) {
-                                       dev_ne[found++] = dev;
-                                       continue;
-                               }
-                               cleanup_card(dev);
+                               dev_ne[found++] = dev;
+                               continue;
                        }
                }
                free_netdev(dev);
index fb63995..4265ed9 100644 (file)
@@ -539,6 +539,48 @@ static int setPauseParams(struct net_device *dev , struct ethtool_pauseparam *ep
         return ret ? -EIO : 0;
 }
 
+/* Only Yukon supports checksum offload. */
+static int setScatterGather(struct net_device *dev, u32 data)
+{
+       DEV_NET *pNet = netdev_priv(dev);
+       SK_AC *pAC = pNet->pAC;
+
+       if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
+               return -EOPNOTSUPP;
+       return ethtool_op_set_sg(dev, data);
+}
+
+static int setTxCsum(struct net_device *dev, u32 data)
+{
+       DEV_NET *pNet = netdev_priv(dev);
+       SK_AC *pAC = pNet->pAC;
+
+       if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
+               return -EOPNOTSUPP;
+
+       return ethtool_op_set_tx_csum(dev, data);
+}
+
+static u32 getRxCsum(struct net_device *dev)
+{
+       DEV_NET *pNet = netdev_priv(dev);
+       SK_AC *pAC = pNet->pAC;
+
+       return pAC->RxPort[pNet->PortNr].RxCsum;
+}
+
+static int setRxCsum(struct net_device *dev, u32 data)
+{
+       DEV_NET *pNet = netdev_priv(dev);
+       SK_AC *pAC = pNet->pAC;
+
+       if (pAC->GIni.GIChipId == CHIP_ID_GENESIS)
+               return -EOPNOTSUPP;
+
+       pAC->RxPort[pNet->PortNr].RxCsum = data != 0;
+       return 0;
+}
+
 struct ethtool_ops SkGeEthtoolOps = {
        .get_settings           = getSettings,
        .set_settings           = setSettings,
@@ -549,4 +591,12 @@ struct ethtool_ops SkGeEthtoolOps = {
        .phys_id                = locateDevice,
        .get_pauseparam         = getPauseParams,
        .set_pauseparam         = setPauseParams,
+       .get_link               = ethtool_op_get_link,
+       .get_perm_addr          = ethtool_op_get_perm_addr,
+       .get_sg                 = ethtool_op_get_sg,
+       .set_sg                 = setScatterGather,
+       .get_tx_csum            = ethtool_op_get_tx_csum,
+       .set_tx_csum            = setTxCsum,
+       .get_rx_csum            = getRxCsum,
+       .set_rx_csum            = setRxCsum,
 };
index 537b372..1d317d2 100644 (file)
 
 #define get_descriptor_id(type, service) (((type - 4) << 4) | service)
 
+struct pcie_port_device_ext {
+       int interrupt_mode;     /* [0:INTx | 1:MSI | 2:MSI-X] */
+};
+
 extern struct bus_type pcie_port_bus_type;
 extern int pcie_port_device_probe(struct pci_dev *dev);
 extern int pcie_port_device_register(struct pci_dev *dev);
index 5762857..55c6622 100644 (file)
@@ -11,6 +11,8 @@
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/pm.h>
+#include <linux/string.h>
+#include <linux/slab.h>
 #include <linux/pcieport_if.h>
 
 #include "portdrv.h"
@@ -61,7 +63,7 @@ static int pcie_port_remove_service(struct device *dev)
 
 static void pcie_port_shutdown_service(struct device *dev) {}
 
-static int pcie_port_suspend_service(struct device *dev, pm_message_t state, u32 level)
+static int pcie_port_suspend_service(struct device *dev, pm_message_t state)
 {
        struct pcie_device *pciedev;
        struct pcie_port_service_driver *driver;
@@ -76,7 +78,7 @@ static int pcie_port_suspend_service(struct device *dev, pm_message_t state, u32
        return 0;
 }
 
-static int pcie_port_resume_service(struct device *dev, u32 level)
+static int pcie_port_resume_service(struct device *dev)
 {
        struct pcie_device *pciedev;
        struct pcie_port_service_driver *driver;
@@ -232,28 +234,24 @@ static void pcie_device_init(struct pci_dev *parent, struct pcie_device *dev,
        /* Initialize generic device interface */
        device = &dev->device;
        memset(device, 0, sizeof(struct device));
-       INIT_LIST_HEAD(&device->node);
-       INIT_LIST_HEAD(&device->children);
-       INIT_LIST_HEAD(&device->bus_list);
        device->bus = &pcie_port_bus_type;
        device->driver = NULL;
-       device->driver_data = NULL; 
+       device->driver_data = NULL;
        device->release = release_pcie_device;  /* callback to free pcie dev */
-       sprintf(&device->bus_id[0], "pcie%02x", 
-               get_descriptor_id(port_type, service_type));
+       snprintf(device->bus_id, sizeof(device->bus_id), "%s:pcie%02x",
+                pci_name(parent), get_descriptor_id(port_type, service_type));
        device->parent = &parent->dev;
 }
 
-static struct pcie_device* alloc_pcie_device(struct pci_dev *parent, 
+static struct pcie_device* alloc_pcie_device(struct pci_dev *parent,
        int port_type, int service_type, int irq, int irq_mode)
 {
        struct pcie_device *device;
 
-       device = kmalloc(sizeof(struct pcie_device), GFP_KERNEL);
+       device = kzalloc(sizeof(struct pcie_device), GFP_KERNEL);
        if (!device)
                return NULL;
 
-       memset(device, 0, sizeof(struct pcie_device));
        pcie_device_init(parent, device, port_type, service_type, irq,irq_mode);
        printk(KERN_DEBUG "Allocate Port Service[%s]\n", device->device.bus_id);
        return device;
@@ -270,27 +268,35 @@ int pcie_port_device_probe(struct pci_dev *dev)
        pci_read_config_word(dev, pos + PCIE_CAPABILITIES_REG, &reg);
        type = (reg >> 4) & PORT_TYPE_MASK;
        if (    type == PCIE_RC_PORT || type == PCIE_SW_UPSTREAM_PORT ||
-               type == PCIE_SW_DOWNSTREAM_PORT )  
+               type == PCIE_SW_DOWNSTREAM_PORT )
                return 0;
+
        return -ENODEV;
 }
 
 int pcie_port_device_register(struct pci_dev *dev)
 {
+       struct pcie_port_device_ext *p_ext;
        int status, type, capabilities, irq_mode, i;
        int vectors[PCIE_PORT_DEVICE_MAXSERVICES];
        u16 reg16;
 
+       /* Allocate port device extension */
+       if (!(p_ext = kmalloc(sizeof(struct pcie_port_device_ext), GFP_KERNEL)))
+               return -ENOMEM;
+
+       pci_set_drvdata(dev, p_ext);
+
        /* Get port type */
-       pci_read_config_word(dev, 
-               pci_find_capability(dev, PCI_CAP_ID_EXP) + 
+       pci_read_config_word(dev,
+               pci_find_capability(dev, PCI_CAP_ID_EXP) +
                PCIE_CAPABILITIES_REG, &reg16);
        type = (reg16 >> 4) & PORT_TYPE_MASK;
 
        /* Now get port services */
        capabilities = get_port_device_capability(dev);
        irq_mode = assign_interrupt_mode(dev, vectors, capabilities);
+       p_ext->interrupt_mode = irq_mode;
 
        /* Allocate child services if any */
        for (i = 0; i < PCIE_PORT_DEVICE_MAXSERVICES; i++) {
@@ -299,11 +305,11 @@ int pcie_port_device_register(struct pci_dev *dev)
                if (capabilities & (1 << i)) {
                        child = alloc_pcie_device(
                                dev,            /* parent */
-                               type,           /* port type */ 
+                               type,           /* port type */
                                i,              /* service type */
                                vectors[i],     /* irq */
                                irq_mode        /* interrupt mode */);
-                       if (child) { 
+                       if (child) {
                                status = device_register(&child->device);
                                if (status) {
                                        kfree(child);
@@ -317,84 +323,78 @@ int pcie_port_device_register(struct pci_dev *dev)
 }
 
 #ifdef CONFIG_PM
-int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state)
+static int suspend_iter(struct device *dev, void *data)
 {
-       struct list_head                *head, *tmp;
-       struct device                   *parent, *child;
-       struct device_driver            *driver;
        struct pcie_port_service_driver *service_driver;
+       pm_message_t state = * (pm_message_t *) data;
+
+       if ((dev->bus == &pcie_port_bus_type) &&
+           (dev->driver)) {
+               service_driver = to_service_driver(dev->driver);
+               if (service_driver->suspend)
+                       service_driver->suspend(to_pcie_device(dev), state);
+       }
+       return 0;
+}
 
-       parent = &dev->dev;
-       head = &parent->children;
-       tmp = head->next;
-       while (head != tmp) {
-               child = container_of(tmp, struct device, node);
-               tmp = tmp->next;
-               if (child->bus != &pcie_port_bus_type)
-                       continue;
-               driver = child->driver;
-               if (!driver)
-                       continue;
-               service_driver = to_service_driver(driver);
-               if (service_driver->suspend)  
-                       service_driver->suspend(to_pcie_device(child), state);
-       }
-       return 0; 
+int pcie_port_device_suspend(struct pci_dev *dev, pm_message_t state)
+{
+       device_for_each_child(&dev->dev, &state, suspend_iter);
+       return 0;
 }
 
-int pcie_port_device_resume(struct pci_dev *dev) 
-{ 
-       struct list_head                *head, *tmp;
-       struct device                   *parent, *child;
-       struct device_driver            *driver;
+static int resume_iter(struct device *dev, void *data)
+{
        struct pcie_port_service_driver *service_driver;
 
-       parent = &dev->dev;
-       head = &parent->children;
-       tmp = head->next;
-       while (head != tmp) {
-               child = container_of(tmp, struct device, node);
-               tmp = tmp->next;
-               if (child->bus != &pcie_port_bus_type)
-                       continue;
-               driver = child->driver;
-               if (!driver)
-                       continue;
-               service_driver = to_service_driver(driver);
-               if (service_driver->resume)  
-                       service_driver->resume(to_pcie_device(child));
+       if ((dev->bus == &pcie_port_bus_type) &&
+           (dev->driver)) {
+               service_driver = to_service_driver(dev->driver);
+               if (service_driver->resume)
+                       service_driver->resume(to_pcie_device(dev));
        }
-       return 0; 
+       return 0;
+}
 
+int pcie_port_device_resume(struct pci_dev *dev)
+{
+       device_for_each_child(&dev->dev, NULL, resume_iter);
+       return 0;
 }
 #endif
 
-void pcie_port_device_remove(struct pci_dev *dev)
+static int remove_iter(struct device *dev, void *data)
 {
-       struct list_head                *head, *tmp;
-       struct device                   *parent, *child;
-       struct device_driver            *driver;
        struct pcie_port_service_driver *service_driver;
-       int interrupt_mode = PCIE_PORT_INTx_MODE;
 
-       parent = &dev->dev;
-       head = &parent->children;
-       tmp = head->next;
-       while (head != tmp) {
-               child = container_of(tmp, struct device, node);
-               tmp = tmp->next;
-               if (child->bus != &pcie_port_bus_type)
-                       continue;
-               driver = child->driver;
-               if (driver) { 
-                       service_driver = to_service_driver(driver);
-                       if (service_driver->remove)  
-                               service_driver->remove(to_pcie_device(child));
+       if (dev->bus == &pcie_port_bus_type) {
+               if (dev->driver) {
+                       service_driver = to_service_driver(dev->driver);
+                       if (service_driver->remove)
+                               service_driver->remove(to_pcie_device(dev));
                }
-               interrupt_mode = (to_pcie_device(child))->interrupt_mode;
-               put_device(child);
-               device_unregister(child);
+               *(unsigned long*)data = (unsigned long)dev;
+               return 1;
        }
+       return 0;
+}
+
+void pcie_port_device_remove(struct pci_dev *dev)
+{
+       struct device *device;
+       unsigned long device_addr;
+       int interrupt_mode = PCIE_PORT_INTx_MODE;
+       int status;
+
+       do {
+               status = device_for_each_child(&dev->dev, &device_addr, remove_iter);
+               if (status) {
+                       device = (struct device*)device_addr;
+                       interrupt_mode = (to_pcie_device(device))->interrupt_mode;
+                       put_device(device);
+                       device_unregister(device);
+               }
+       } while (status);
        /* Switch to INTx by default if MSI enabled */
        if (interrupt_mode == PCIE_PORT_MSIX_MODE)
                pci_disable_msix(dev);
@@ -423,7 +423,7 @@ int pcie_port_service_register(struct pcie_port_service_driver *new)
        new->driver.resume = pcie_port_resume_service;
 
        return driver_register(&new->driver);
-} 
+}
 
 void pcie_port_service_unregister(struct pcie_port_service_driver *new)
 {
index 42efe21..b7b9e14 100644 (file)
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/interrupt.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 
+#include <asm/mach-types.h>
 #include <asm/hardware.h>
 #include <asm/irq.h>
-
 #include <asm/hardware/scoop.h>
-#include <asm/arch/corgi.h>
-#include <asm/arch/pxa-regs.h>
 
 #include "soc_common.h"
 
 #define        NO_KEEP_VS 0x0001
+#define SCOOP_DEV platform_scoop_config->devs
 
-static unsigned char keep_vs;
-static unsigned char keep_rd;
+static void sharpsl_pcmcia_init_reset(struct soc_pcmcia_socket *skt)
+{
+       struct scoop_pcmcia_dev *scoopdev = &SCOOP_DEV[skt->nr];
 
-static struct pcmcia_irqs irqs[] = {
-       { 0, CORGI_IRQ_GPIO_CF_CD, "PCMCIA0 CD"},
-};
+       reset_scoop(scoopdev->dev);
 
-static void sharpsl_pcmcia_init_reset(void)
-{
-       reset_scoop(&corgiscoop_device.dev);
-       keep_vs = NO_KEEP_VS;
-       keep_rd = 0;
+       /* Shared power controls need to be handled carefully */
+       if (platform_scoop_config->power_ctrl)
+               platform_scoop_config->power_ctrl(scoopdev->dev, 0x0000, skt->nr);
+       else
+               write_scoop_reg(scoopdev->dev, SCOOP_CPR, 0x0000);
+
+       scoopdev->keep_vs = NO_KEEP_VS;
+       scoopdev->keep_rd = 0;
 }
 
 static int sharpsl_pcmcia_hw_init(struct soc_pcmcia_socket *skt)
 {
        int ret;
 
-       /*
-        * Setup default state of GPIO outputs
-        * before we enable them as outputs.
-        */
-       GPSR(GPIO48_nPOE) =
-               GPIO_bit(GPIO48_nPOE) |
-               GPIO_bit(GPIO49_nPWE) |
-               GPIO_bit(GPIO50_nPIOR) |
-               GPIO_bit(GPIO51_nPIOW) |
-               GPIO_bit(GPIO52_nPCE_1) |
-               GPIO_bit(GPIO53_nPCE_2);
-
-       pxa_gpio_mode(GPIO48_nPOE_MD);
-       pxa_gpio_mode(GPIO49_nPWE_MD);
-       pxa_gpio_mode(GPIO50_nPIOR_MD);
-       pxa_gpio_mode(GPIO51_nPIOW_MD);
-       pxa_gpio_mode(GPIO52_nPCE_1_MD);
-       pxa_gpio_mode(GPIO53_nPCE_2_MD);
-       pxa_gpio_mode(GPIO54_pSKTSEL_MD);
-       pxa_gpio_mode(GPIO55_nPREG_MD);
-       pxa_gpio_mode(GPIO56_nPWAIT_MD);
-       pxa_gpio_mode(GPIO57_nIOIS16_MD);
+       if (platform_scoop_config->pcmcia_init)
+               platform_scoop_config->pcmcia_init();
 
        /* Register interrupts */
-       ret = soc_pcmcia_request_irqs(skt, irqs, ARRAY_SIZE(irqs));
-
-       if (ret) {
-               printk(KERN_ERR "Request for Compact Flash IRQ failed\n");
-               return ret;
+       if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
+               struct pcmcia_irqs cd_irq;
+
+               cd_irq.sock = skt->nr;
+               cd_irq.irq  = SCOOP_DEV[skt->nr].cd_irq;
+               cd_irq.str  = SCOOP_DEV[skt->nr].cd_irq_str;
+               ret = soc_pcmcia_request_irqs(skt, &cd_irq, 1);
+
+               if (ret) {
+                       printk(KERN_ERR "Request for Compact Flash IRQ failed\n");
+                       return ret;
+               }
        }
 
-       /* Enable interrupt */
-       write_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR, 0x00C0);
-       write_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR, 0x0101);
-       keep_vs = NO_KEEP_VS;
-
-       skt->irq = CORGI_IRQ_GPIO_CF_IRQ;
+       skt->irq = SCOOP_DEV[skt->nr].irq;
 
        return 0;
 }
 
 static void sharpsl_pcmcia_hw_shutdown(struct soc_pcmcia_socket *skt)
 {
-       soc_pcmcia_free_irqs(skt, irqs, ARRAY_SIZE(irqs));
+       if (SCOOP_DEV[skt->nr].cd_irq >= 0) {
+               struct pcmcia_irqs cd_irq;
 
-       /* CF_BUS_OFF */
-       sharpsl_pcmcia_init_reset();
+               cd_irq.sock = skt->nr;
+               cd_irq.irq  = SCOOP_DEV[skt->nr].cd_irq;
+               cd_irq.str  = SCOOP_DEV[skt->nr].cd_irq_str;
+               soc_pcmcia_free_irqs(skt, &cd_irq, 1);
+       }
 }
 
 
@@ -101,31 +88,36 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
                                    struct pcmcia_state *state)
 {
        unsigned short cpr, csr;
+       struct device *scoop = SCOOP_DEV[skt->nr].dev;
 
-       cpr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR);
+       cpr = read_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_CPR);
 
-       write_scoop_reg(&corgiscoop_device.dev, SCOOP_IRM, 0x00FF);
-       write_scoop_reg(&corgiscoop_device.dev, SCOOP_ISR, 0x0000);
-       write_scoop_reg(&corgiscoop_device.dev, SCOOP_IRM, 0x0000);
-       csr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CSR);
+       write_scoop_reg(scoop, SCOOP_IRM, 0x00FF);
+       write_scoop_reg(scoop, SCOOP_ISR, 0x0000);
+       write_scoop_reg(scoop, SCOOP_IRM, 0x0000);
+       csr = read_scoop_reg(scoop, SCOOP_CSR);
        if (csr & 0x0004) {
                /* card eject */
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000);
-               keep_vs = NO_KEEP_VS;
+               write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
+               SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
        }
-       else if (!(keep_vs & NO_KEEP_VS)) {
+       else if (!(SCOOP_DEV[skt->nr].keep_vs & NO_KEEP_VS)) {
                /* keep vs1,vs2 */
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000);
-               csr |= keep_vs;
+               write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
+               csr |= SCOOP_DEV[skt->nr].keep_vs;
        }
        else if (cpr & 0x0003) {
                /* power on */
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0000);
-               keep_vs = (csr & 0x00C0);
+               write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
+               SCOOP_DEV[skt->nr].keep_vs = (csr & 0x00C0);
        }
        else {
                /* card detect */
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_CDR, 0x0002);
+               if ((machine_is_spitz() || machine_is_borzoi()) && skt->nr == 1) {
+                       write_scoop_reg(scoop, SCOOP_CDR, 0x0000);
+               } else {
+                       write_scoop_reg(scoop, SCOOP_CDR, 0x0002);
+               }
        }
 
        state->detect = (csr & 0x0004) ? 0 : 1;
@@ -139,7 +131,6 @@ static void sharpsl_pcmcia_socket_state(struct soc_pcmcia_socket *skt,
        if ((cpr & 0x0080) && ((cpr & 0x8040) != 0x8040)) {
                printk(KERN_ERR "sharpsl_pcmcia_socket_state(): CPR=%04X, Low voltage!\n", cpr);
        }
-
 }
 
 
@@ -147,6 +138,7 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
                                       const socket_state_t *state)
 {
        unsigned long flags;
+       struct device *scoop = SCOOP_DEV[skt->nr].dev;
 
        unsigned short cpr, ncpr, ccr, nccr, mcr, nmcr, imr, nimr;
 
@@ -166,13 +158,18 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 
        local_irq_save(flags);
 
-       nmcr = (mcr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR)) & ~0x0010;
-       ncpr = (cpr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR)) & ~0x0083;
-       nccr = (ccr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_CCR)) & ~0x0080;
-       nimr = (imr = read_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR)) & ~0x003E;
-
-       ncpr |= (state->Vcc == 33) ? 0x0001 :
-                               (state->Vcc == 50) ? 0x0002 : 0;
+       nmcr = (mcr = read_scoop_reg(scoop, SCOOP_MCR)) & ~0x0010;
+       ncpr = (cpr = read_scoop_reg(scoop, SCOOP_CPR)) & ~0x0083;
+       nccr = (ccr = read_scoop_reg(scoop, SCOOP_CCR)) & ~0x0080;
+       nimr = (imr = read_scoop_reg(scoop, SCOOP_IMR)) & ~0x003E;
+
+       if ((machine_is_spitz() || machine_is_borzoi() || machine_is_akita()) && skt->nr == 0) {
+               ncpr |= (state->Vcc == 33) ? 0x0002 :
+                       (state->Vcc == 50) ? 0x0002 : 0;
+       } else {
+               ncpr |= (state->Vcc == 33) ? 0x0001 :
+                       (state->Vcc == 50) ? 0x0002 : 0;
+       }
        nmcr |= (state->flags&SS_IOCARD) ? 0x0010 : 0;
        ncpr |= (state->flags&SS_OUTPUT_ENA) ? 0x0080 : 0;
        nccr |= (state->flags&SS_RESET)? 0x0080: 0;
@@ -184,22 +181,26 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
                        ((skt->status&SS_WRPROT) ? 0x0008 : 0);
 
        if (!(ncpr & 0x0003)) {
-               keep_rd = 0;
-       } else if (!keep_rd) {
+               SCOOP_DEV[skt->nr].keep_rd = 0;
+       } else if (!SCOOP_DEV[skt->nr].keep_rd) {
                if (nccr & 0x0080)
-                       keep_rd = 1;
+                       SCOOP_DEV[skt->nr].keep_rd = 1;
                else
                        nccr |= 0x0080;
        }
 
        if (mcr != nmcr)
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_MCR, nmcr);
-       if (cpr != ncpr)
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_CPR, ncpr);
+               write_scoop_reg(scoop, SCOOP_MCR, nmcr);
+       if (cpr != ncpr) {
+               if (platform_scoop_config->power_ctrl)
+                       platform_scoop_config->power_ctrl(scoop, ncpr , skt->nr);
+               else
+                       write_scoop_reg(scoop, SCOOP_CPR, ncpr);
+       }
        if (ccr != nccr)
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_CCR, nccr);
+               write_scoop_reg(scoop, SCOOP_CCR, nccr);
        if (imr != nimr)
-               write_scoop_reg(&corgiscoop_device.dev, SCOOP_IMR, nimr);
+               write_scoop_reg(scoop, SCOOP_IMR, nimr);
 
        local_irq_restore(flags);
 
@@ -208,57 +209,77 @@ static int sharpsl_pcmcia_configure_socket(struct soc_pcmcia_socket *skt,
 
 static void sharpsl_pcmcia_socket_init(struct soc_pcmcia_socket *skt)
 {
+       sharpsl_pcmcia_init_reset(skt);
+
+       /* Enable interrupt */
+       write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_IMR, 0x00C0);
+       write_scoop_reg(SCOOP_DEV[skt->nr].dev, SCOOP_MCR, 0x0101);
+       SCOOP_DEV[skt->nr].keep_vs = NO_KEEP_VS;
 }
 
 static void sharpsl_pcmcia_socket_suspend(struct soc_pcmcia_socket *skt)
 {
+       sharpsl_pcmcia_init_reset(skt);
 }
 
 static struct pcmcia_low_level sharpsl_pcmcia_ops = {
-       .owner                          = THIS_MODULE,
-       .hw_init                        = sharpsl_pcmcia_hw_init,
-       .hw_shutdown            = sharpsl_pcmcia_hw_shutdown,
-       .socket_state           = sharpsl_pcmcia_socket_state,
-       .configure_socket       = sharpsl_pcmcia_configure_socket,
-       .socket_init            = sharpsl_pcmcia_socket_init,
-       .socket_suspend         = sharpsl_pcmcia_socket_suspend,
-       .first                          = 0,
-       .nr                                     = 1,
+       .owner                  = THIS_MODULE,
+       .hw_init                = sharpsl_pcmcia_hw_init,
+       .hw_shutdown            = sharpsl_pcmcia_hw_shutdown,
+       .socket_state           = sharpsl_pcmcia_socket_state,
+       .configure_socket       = sharpsl_pcmcia_configure_socket,
+       .socket_init            = sharpsl_pcmcia_socket_init,
+       .socket_suspend         = sharpsl_pcmcia_socket_suspend,
+       .first                  = 0,
+       .nr                     = 0,
 };
 
+#ifdef CONFIG_SA1100_COLLIE
+#include "sa11xx_base.h"
+
+int __init pcmcia_collie_init(struct device *dev)
+{
+       int ret = -ENODEV;
+
+       if (machine_is_collie())
+               ret = sa11xx_drv_pcmcia_probe(dev, &sharpsl_pcmcia_ops, 0, 1);
+
+       return ret;
+}
+
+#else
+
 static struct platform_device *sharpsl_pcmcia_device;
 
 static int __init sharpsl_pcmcia_init(void)
 {
        int ret;
 
-       sharpsl_pcmcia_device = kmalloc(sizeof(*sharpsl_pcmcia_device), GFP_KERNEL);
+       sharpsl_pcmcia_ops.nr = platform_scoop_config->num_devs;
+       sharpsl_pcmcia_device = platform_device_alloc("pxa2xx-pcmcia", -1);
+
        if (!sharpsl_pcmcia_device)
                return -ENOMEM;
-       memset(sharpsl_pcmcia_device, 0, sizeof(*sharpsl_pcmcia_device));
-       sharpsl_pcmcia_device->name = "pxa2xx-pcmcia";
+
        sharpsl_pcmcia_device->dev.platform_data = &sharpsl_pcmcia_ops;
+       sharpsl_pcmcia_device->dev.parent = platform_scoop_config->devs[0].dev;
+
+       ret = platform_device_add(sharpsl_pcmcia_device);
 
-       ret = platform_device_register(sharpsl_pcmcia_device);
        if (ret)
-               kfree(sharpsl_pcmcia_device);
+               platform_device_put(sharpsl_pcmcia_device);
 
        return ret;
 }
 
 static void __exit sharpsl_pcmcia_exit(void)
 {
-       /*
-        * This call is supposed to free our sharpsl_pcmcia_device.
-        * Unfortunately platform_device don't have a free method, and
-        * we can't assume it's free of any reference at this point so we
-        * can't free it either.
-        */
        platform_device_unregister(sharpsl_pcmcia_device);
 }
 
-module_init(sharpsl_pcmcia_init);
+fs_initcall(sharpsl_pcmcia_init);
 module_exit(sharpsl_pcmcia_exit);
+#endif
 
 MODULE_DESCRIPTION("Sharp SL Series PCMCIA Support");
 MODULE_LICENSE("GPL");
index 8eed039..c5d7476 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/moduleparam.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/config.h>
 #include <linux/string.h>
 #include <linux/major.h>
 #include <linux/errno.h>
 #include <linux/pm.h>
 #include <linux/pci.h>
 #include <linux/device.h>
+#include <linux/mutex.h>
 #include <asm/system.h>
 #include <asm/irq.h>
 
 #define IN_CARD_SERVICES
-#include <pcmcia/version.h>
 #include <pcmcia/cs_types.h>
 #include <pcmcia/ss.h>
 #include <pcmcia/cs.h>
 
 static ssize_t pccard_show_type(struct class_device *dev, char *buf)
 {
-       int val;
        struct pcmcia_socket *s = to_socket(dev);
 
        if (!(s->state & SOCKET_PRESENT))
                return -ENODEV;
-       s->ops->get_status(s, &val);
-       if (val & SS_CARDBUS)
+       if (s->state & SOCKET_CARDBUS)
                return sprintf(buf, "32-bit\n");
-       if (val & SS_DETECT)
-               return sprintf(buf, "16-bit\n");
-       return sprintf(buf, "invalid\n");
+       return sprintf(buf, "16-bit\n");
 }
-static CLASS_DEVICE_ATTR(card_type, 0400, pccard_show_type, NULL);
+static CLASS_DEVICE_ATTR(card_type, 0444, pccard_show_type, NULL);
 
 static ssize_t pccard_show_voltage(struct class_device *dev, char *buf)
 {
-       int val;
        struct pcmcia_socket *s = to_socket(dev);
 
        if (!(s->state & SOCKET_PRESENT))
                return -ENODEV;
-       s->ops->get_status(s, &val);
-       if (val & SS_3VCARD)
-               return sprintf(buf, "3.3V\n");
-       if (val & SS_XVCARD)
-               return sprintf(buf, "X.XV\n");
-       return sprintf(buf, "5.0V\n");
+       if (s->socket.Vcc)
+               return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10,
+                              s->socket.Vcc % 10);
+       return sprintf(buf, "X.XV\n");
 }
-static CLASS_DEVICE_ATTR(card_voltage, 0400, pccard_show_voltage, NULL);
+static CLASS_DEVICE_ATTR(card_voltage, 0444, pccard_show_voltage, NULL);
 
 static ssize_t pccard_show_vpp(struct class_device *dev, char *buf)
 {
@@ -80,7 +72,7 @@ static ssize_t pccard_show_vpp(struct class_device *dev, char *buf)
                return -ENODEV;
        return sprintf(buf, "%d.%dV\n", s->socket.Vpp / 10, s->socket.Vpp % 10);
 }
-static CLASS_DEVICE_ATTR(card_vpp, 0400, pccard_show_vpp, NULL);
+static CLASS_DEVICE_ATTR(card_vpp, 0444, pccard_show_vpp, NULL);
 
 static ssize_t pccard_show_vcc(struct class_device *dev, char *buf)
 {
@@ -89,7 +81,7 @@ static ssize_t pccard_show_vcc(struct class_device *dev, char *buf)
                return -ENODEV;
        return sprintf(buf, "%d.%dV\n", s->socket.Vcc / 10, s->socket.Vcc % 10);
 }
-static CLASS_DEVICE_ATTR(card_vcc, 0400, pccard_show_vcc, NULL);
+static CLASS_DEVICE_ATTR(card_vcc, 0444, pccard_show_vcc, NULL);
 
 
 static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, size_t count)
@@ -106,6 +98,30 @@ static ssize_t pccard_store_insert(struct class_device *dev, const char *buf, si
 }
 static CLASS_DEVICE_ATTR(card_insert, 0200, NULL, pccard_store_insert);
 
+
+static ssize_t pccard_show_card_pm_state(struct class_device *dev, char *buf)
+{
+       struct pcmcia_socket *s = to_socket(dev);
+       return sprintf(buf, "%s\n", s->state & SOCKET_SUSPEND ? "off" : "on");
+}
+
+static ssize_t pccard_store_card_pm_state(struct class_device *dev, const char *buf, size_t count)
+{
+       ssize_t ret = -EINVAL;
+       struct pcmcia_socket *s = to_socket(dev);
+
+       if (!count)
+               return -EINVAL;
+
+       if (!(s->state & SOCKET_SUSPEND) && !strncmp(buf, "off", 3))
+               ret = pcmcia_suspend_card(s);
+       else if ((s->state & SOCKET_SUSPEND) && !strncmp(buf, "on", 2))
+               ret = pcmcia_resume_card(s);
+
+       return ret ? -ENODEV : count;
+}
+static CLASS_DEVICE_ATTR(card_pm_state, 0644, pccard_show_card_pm_state, pccard_store_card_pm_state);
+
 static ssize_t pccard_store_eject(struct class_device *dev, const char *buf, size_t count)
 {
        ssize_t ret;
@@ -163,28 +179,163 @@ static ssize_t pccard_store_resource(struct class_device *dev, const char *buf,
                return -EINVAL;
 
        spin_lock_irqsave(&s->lock, flags);
-       if (!s->resource_setup_done) {
+       if (!s->resource_setup_done)
                s->resource_setup_done = 1;
-               spin_unlock_irqrestore(&s->lock, flags);
+       spin_unlock_irqrestore(&s->lock, flags);
+
+       mutex_lock(&s->skt_mutex);
+       if ((s->callback) &&
+           (s->state & SOCKET_PRESENT) &&
+           !(s->state & SOCKET_CARDBUS)) {
+               if (try_module_get(s->callback->owner)) {
+                       s->callback->requery(s);
+                       module_put(s->callback->owner);
+               }
+       }
+       mutex_unlock(&s->skt_mutex);
+
+       return count;
+}
+static CLASS_DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource);
+
+
+static ssize_t pccard_extract_cis(struct pcmcia_socket *s, char *buf, loff_t off, size_t count)
+{
+       tuple_t tuple;
+       int status, i;
+       loff_t pointer = 0;
+       ssize_t ret = 0;
+       u_char *tuplebuffer;
+       u_char *tempbuffer;
+
+       tuplebuffer = kmalloc(sizeof(u_char) * 256, GFP_KERNEL);
+       if (!tuplebuffer)
+               return -ENOMEM;
+
+       tempbuffer = kmalloc(sizeof(u_char) * 258, GFP_KERNEL);
+       if (!tempbuffer) {
+               ret = -ENOMEM;
+               goto free_tuple;
+       }
+
+       memset(&tuple, 0, sizeof(tuple_t));
+
+       tuple.Attributes = TUPLE_RETURN_LINK | TUPLE_RETURN_COMMON;
+       tuple.DesiredTuple = RETURN_FIRST_TUPLE;
+       tuple.TupleOffset = 0;
+
+       status = pccard_get_first_tuple(s, BIND_FN_ALL, &tuple);
+       while (!status) {
+               tuple.TupleData = tuplebuffer;
+               tuple.TupleDataMax = 255;
+               memset(tuplebuffer, 0, sizeof(u_char) * 255);
+
+               status = pccard_get_tuple_data(s, &tuple);
+               if (status)
+                       break;
+
+               if (off < (pointer + 2 + tuple.TupleDataLen)) {
+                       tempbuffer[0] = tuple.TupleCode & 0xff;
+                       tempbuffer[1] = tuple.TupleLink & 0xff;
+                       for (i = 0; i < tuple.TupleDataLen; i++)
+                               tempbuffer[i + 2] = tuplebuffer[i] & 0xff;
+
+                       for (i = 0; i < (2 + tuple.TupleDataLen); i++) {
+                               if (((i + pointer) >= off) &&
+                                   (i + pointer) < (off + count)) {
+                                       buf[ret] = tempbuffer[i];
+                                       ret++;
+                               }
+                       }
+               }
+
+               pointer += 2 + tuple.TupleDataLen;
+
+               if (pointer >= (off + count))
+                       break;
 
-               down(&s->skt_sem);
-               if ((s->callback) &&
-                   (s->state & SOCKET_PRESENT) &&
+               if (tuple.TupleCode == CISTPL_END)
+                       break;
+               status = pccard_get_next_tuple(s, BIND_FN_ALL, &tuple);
+       }
+
+       kfree(tempbuffer);
+ free_tuple:
+       kfree(tuplebuffer);
+
+       return (ret);
+}
+
+static ssize_t pccard_show_cis(struct kobject *kobj, char *buf, loff_t off, size_t count)
+{
+       unsigned int size = 0x200;
+
+       if (off >= size)
+               count = 0;
+       else {
+               struct pcmcia_socket *s;
+               cisinfo_t cisinfo;
+
+               if (off + count > size)
+                       count = size - off;
+
+               s = to_socket(container_of(kobj, struct class_device, kobj));
+
+               if (!(s->state & SOCKET_PRESENT))
+                       return -ENODEV;
+               if (pccard_validate_cis(s, BIND_FN_ALL, &cisinfo))
+                       return -EIO;
+               if (!cisinfo.Chains)
+                       return -ENODATA;
+
+               count = pccard_extract_cis(s, buf, off, count);
+       }
+
+       return (count);
+}
+
+static ssize_t pccard_store_cis(struct kobject *kobj, char *buf, loff_t off, size_t count)
+{
+       struct pcmcia_socket *s = to_socket(container_of(kobj, struct class_device, kobj));
+       cisdump_t *cis;
+       ssize_t ret = count;
+
+       if (off)
+               return -EINVAL;
+
+       if (count >= 0x200)
+               return -EINVAL;
+
+       if (!(s->state & SOCKET_PRESENT))
+               return -ENODEV;
+
+       cis = kzalloc(sizeof(cisdump_t), GFP_KERNEL);
+       if (!cis)
+               return -ENOMEM;
+
+       cis->Length = count + 1;
+       memcpy(cis->Data, buf, count);
+
+       if (pcmcia_replace_cis(s, cis))
+               ret  = -EIO;
+
+       kfree(cis);
+
+       if (!ret) {
+               mutex_lock(&s->skt_mutex);
+               if ((s->callback) && (s->state & SOCKET_PRESENT) &&
                    !(s->state & SOCKET_CARDBUS)) {
                        if (try_module_get(s->callback->owner)) {
-                               s->callback->resources_done(s);
+                               s->callback->requery(s);
                                module_put(s->callback->owner);
                        }
                }
-               up(&s->skt_sem);
-
-               return count;
+               mutex_unlock(&s->skt_mutex);
        }
-       spin_unlock_irqrestore(&s->lock, flags);
 
-       return count;
+
+       return (ret);
 }
-static CLASS_DEVICE_ATTR(available_resources_setup_done, 0600, pccard_show_resource, pccard_store_resource);
 
 
 static struct class_device_attribute *pccard_socket_attributes[] = {
@@ -193,13 +344,22 @@ static struct class_device_attribute *pccard_socket_attributes[] = {
        &class_device_attr_card_vpp,
        &class_device_attr_card_vcc,
        &class_device_attr_card_insert,
+       &class_device_attr_card_pm_state,
        &class_device_attr_card_eject,
        &class_device_attr_card_irq_mask,
        &class_device_attr_available_resources_setup_done,
        NULL,
 };
 
-static int __devinit pccard_sysfs_add_socket(struct class_device *class_dev)
+static struct bin_attribute pccard_cis_attr = {
+       .attr = { .name = "cis", .mode = S_IRUGO | S_IWUSR, .owner = THIS_MODULE},
+       .size = 0x200,
+       .read = pccard_show_cis,
+       .write = pccard_store_cis,
+};
+
+static int __devinit pccard_sysfs_add_socket(struct class_device *class_dev,
+                                            struct class_interface *class_intf)
 {
        struct class_device_attribute **attr;
        int ret = 0;
@@ -209,14 +369,18 @@ static int __devinit pccard_sysfs_add_socket(struct class_device *class_dev)
                if (ret)
                        break;
        }
+       if (!ret)
+               ret = sysfs_create_bin_file(&class_dev->kobj, &pccard_cis_attr);
 
        return ret;
 }
 
-static void __devexit pccard_sysfs_remove_socket(struct class_device *class_dev)
+static void __devexit pccard_sysfs_remove_socket(struct class_device *class_dev,
+                                                struct class_interface *class_intf)
 {
        struct class_device_attribute **attr;
 
+       sysfs_remove_bin_file(&class_dev->kobj, &pccard_cis_attr);
        for (attr = pccard_socket_attributes; *attr; attr++)
                class_device_remove_file(class_dev, *attr);
 }
index 3df7197..969be46 100644 (file)
@@ -2,7 +2,7 @@
 *  Define constants                                    *
 *                                                      *
 ********************************************************/
-#define VERSION_CLAW_H "$Revision: 1.6 $"
+
 /*-----------------------------------------------------*
 *     CCW command codes for CLAW protocol              *
 *------------------------------------------------------*/
index e1b5186..cae9ba2 100644 (file)
@@ -1,14 +1,12 @@
 /*
- * linux/drivers/s390/net/qeth_eddp.c ($Revision: 1.5 $)
+ * linux/drivers/s390/net/qeth_eddp.h
  *
- * Header file for qeth enhanced device driver pakcing.
+ * Header file for qeth enhanced device driver packing.
  *
  * Copyright 2004 IBM Corporation
  *
  *    Author(s): Thomas Spatzier <tspat@de.ibm.com>
  *
- *    $Revision: 1.5 $  $Date: 2005/03/24 09:04:18 $
- *
  */
 #ifndef __QETH_EDDP_H__
 #define __QETH_EDDP_H__
index 8c8ecbe..e5685be 100644 (file)
@@ -2,8 +2,9 @@
    3w-9xxx.h -- 3ware 9000 Storage Controller device driver for Linux.
 
    Written By: Adam Radford <linuxraid@amcc.com>
+   Modifications By: Tom Couch <linuxraid@amcc.com>
 
-   Copyright (C) 2004-2005 Applied Micro Circuits Corporation.
+   Copyright (C) 2004-2006 Applied Micro Circuits 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
@@ -267,7 +268,6 @@ static twa_message_type twa_error_table[] = {
 #define TW_CONTROL_CLEAR_PARITY_ERROR          0x00800000
 #define TW_CONTROL_CLEAR_QUEUE_ERROR           0x00400000
 #define TW_CONTROL_CLEAR_PCI_ABORT             0x00100000
-#define TW_CONTROL_CLEAR_SBUF_WRITE_ERROR      0x00000008
 
 /* Status register bit definitions */
 #define TW_STATUS_MAJOR_VERSION_MASK          0xF0000000
@@ -285,12 +285,8 @@ static twa_message_type twa_error_table[] = {
 #define TW_STATUS_MICROCONTROLLER_READY               0x00002000
 #define TW_STATUS_COMMAND_QUEUE_EMPTY         0x00001000
 #define TW_STATUS_EXPECTED_BITS                       0x00002000
-#define TW_STATUS_UNEXPECTED_BITS             0x00F00008
-#define TW_STATUS_SBUF_WRITE_ERROR             0x00000008
-#define TW_STATUS_VALID_INTERRUPT              0x00DF0008
-
-/* RESPONSE QUEUE BIT DEFINITIONS */
-#define TW_RESPONSE_ID_MASK                   0x00000FF0
+#define TW_STATUS_UNEXPECTED_BITS             0x00F00000
+#define TW_STATUS_VALID_INTERRUPT              0x00DF0000
 
 /* PCI related defines */
 #define TW_NUMDEVICES 1
@@ -324,9 +320,9 @@ static twa_message_type twa_error_table[] = {
 
 /* Compatibility defines */
 #define TW_9000_ARCH_ID 0x5
-#define TW_CURRENT_DRIVER_SRL 28
-#define TW_CURRENT_DRIVER_BUILD 9
-#define TW_CURRENT_DRIVER_BRANCH 4
+#define TW_CURRENT_DRIVER_SRL 30
+#define TW_CURRENT_DRIVER_BUILD 80
+#define TW_CURRENT_DRIVER_BRANCH 0
 
 /* Phase defines */
 #define TW_PHASE_INITIAL 0
@@ -334,6 +330,7 @@ static twa_message_type twa_error_table[] = {
 #define TW_PHASE_SGLIST  2
 
 /* Misc defines */
+#define TW_9550SX_DRAIN_COMPLETED            0xFFFF
 #define TW_SECTOR_SIZE                        512
 #define TW_ALIGNMENT_9000                     4  /* 4 bytes */
 #define TW_ALIGNMENT_9000_SGL                 0x3
@@ -417,6 +414,9 @@ static twa_message_type twa_error_table[] = {
 #ifndef PCI_DEVICE_ID_3WARE_9000
 #define PCI_DEVICE_ID_3WARE_9000 0x1002
 #endif
+#ifndef PCI_DEVICE_ID_3WARE_9550SX
+#define PCI_DEVICE_ID_3WARE_9550SX 0x1003
+#endif
 
 /* Bitmask macros to eliminate bitfields */
 
@@ -443,6 +443,7 @@ static twa_message_type twa_error_table[] = {
 #define TW_STATUS_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0x4)
 #define TW_COMMAND_QUEUE_REG_ADDR(x) (sizeof(dma_addr_t) > 4 ? ((unsigned char __iomem *)x->base_addr + 0x20) : ((unsigned char __iomem *)x->base_addr + 0x8))
 #define TW_RESPONSE_QUEUE_REG_ADDR(x) ((unsigned char __iomem *)x->base_addr + 0xC)
+#define TW_RESPONSE_QUEUE_REG_ADDR_LARGE(x) ((unsigned char __iomem *)x->base_addr + 0x30)
 #define TW_CLEAR_ALL_INTERRUPTS(x) (writel(TW_STATUS_VALID_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
 #define TW_CLEAR_ATTENTION_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_ATTENTION_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
 #define TW_CLEAR_HOST_INTERRUPT(x) (writel(TW_CONTROL_CLEAR_HOST_INTERRUPT, TW_CONTROL_REG_ADDR(x)))
@@ -468,6 +469,7 @@ printk(KERN_WARNING "3w-9xxx: ERROR: (0x%02X:0x%04X): %s.\n",a,b,c); \
 #define TW_APACHE_MAX_SGL_LENGTH (sizeof(dma_addr_t) > 4 ? 72 : 109)
 #define TW_ESCALADE_MAX_SGL_LENGTH (sizeof(dma_addr_t) > 4 ? 41 : 62)
 #define TW_PADDING_LENGTH (sizeof(dma_addr_t) > 4 ? 8 : 0)
+#define TW_CPU_TO_SGL(x) (sizeof(dma_addr_t) > 4 ? cpu_to_le64(x) : cpu_to_le32(x))
 
 #pragma pack(1)
 
@@ -611,13 +613,6 @@ typedef union TAG_TW_Response_Queue {
        u32 value;
 } TW_Response_Queue;
 
-typedef struct TAG_TW_Info {
-       char *buffer;
-       int length;
-       int offset;
-       int position;
-} TW_Info;
-
 /* Compatibility information structure */
 typedef struct TAG_TW_Compatibility_Info
 {
@@ -633,6 +628,8 @@ typedef struct TAG_TW_Compatibility_Info
        unsigned short driver_build_low;
 } TW_Compatibility_Info;
 
+#pragma pack()
+
 typedef struct TAG_TW_Device_Extension {
        u32                     __iomem *base_addr;
        unsigned long           *generic_buffer_virt[TW_Q_LENGTH];
@@ -669,14 +666,12 @@ typedef struct TAG_TW_Device_Extension {
        u32                     ioctl_msec;
        int                     chrdev_request_id;
        wait_queue_head_t       ioctl_wqueue;
-       struct semaphore        ioctl_sem;
+       struct mutex            ioctl_lock;
        char                    aen_clobber;
        unsigned short          working_srl;
        unsigned short          working_branch;
        unsigned short          working_build;
 } TW_Device_Extension;
 
-#pragma pack()
-
 #endif /* _3W_9XXX_H */
 
index 446f425..1ad24df 100644 (file)
 /*
  * Literals
  */
-#define IPR_DRIVER_VERSION "2.0.13"
-#define IPR_DRIVER_DATE "(February 21, 2005)"
-
-/*
- * IPR_DBG_TRACE: Setting this to 1 will turn on some general function tracing
- *                     resulting in a bunch of extra debugging printks to the console
- *
- * IPR_DEBUG:  Setting this to 1 will turn on some error path tracing.
- *                     Enables the ipr_trace macro.
- */
-#ifdef IPR_DEBUG_ALL
-#define IPR_DEBUG                              1
-#define IPR_DBG_TRACE                  1
-#else
-#define IPR_DEBUG                              0
-#define IPR_DBG_TRACE                  0
-#endif
+#define IPR_DRIVER_VERSION "2.1.3"
+#define IPR_DRIVER_DATE "(March 29, 2006)"
 
 /*
  * IPR_MAX_CMD_PER_LUN: This defines the maximum number of outstanding
 #define IPR_SUBS_DEV_ID_571A   0x02C0
 #define IPR_SUBS_DEV_ID_571B   0x02BE
 #define IPR_SUBS_DEV_ID_571E  0x02BF
+#define IPR_SUBS_DEV_ID_571F   0x02D5
+#define IPR_SUBS_DEV_ID_572A   0x02C1
+#define IPR_SUBS_DEV_ID_572B   0x02C2
+#define IPR_SUBS_DEV_ID_575B   0x030D
 
 #define IPR_NAME                               "ipr"
 
 #define IPR_IOASC_HW_DEV_BUS_STATUS                    0x04448500
 #define        IPR_IOASC_IOASC_MASK                    0xFFFFFF00
 #define        IPR_IOASC_SCSI_STATUS_MASK              0x000000FF
+#define IPR_IOASC_IR_INVALID_REQ_TYPE_OR_PKT   0x05240000
 #define IPR_IOASC_IR_RESOURCE_HANDLE           0x05250000
+#define IPR_IOASC_IR_NO_CMDS_TO_2ND_IOA                0x05258100
+#define IPR_IOASA_IR_DUAL_IOA_DISABLED         0x052C8000
 #define IPR_IOASC_BUS_WAS_RESET                        0x06290000
 #define IPR_IOASC_BUS_WAS_RESET_BY_OTHER               0x06298000
 #define IPR_IOASC_ABORTED_CMD_TERM_BY_HOST     0x0B5A0000
 #define IPR_NUM_LOG_HCAMS                              2
 #define IPR_NUM_CFG_CHG_HCAMS                          2
 #define IPR_NUM_HCAMS  (IPR_NUM_LOG_HCAMS + IPR_NUM_CFG_CHG_HCAMS)
-#define IPR_MAX_NUM_TARGETS_PER_BUS                    0x10
+#define IPR_MAX_NUM_TARGETS_PER_BUS                    256
 #define IPR_MAX_NUM_LUNS_PER_TARGET                    256
 #define IPR_MAX_NUM_VSET_LUNS_PER_TARGET       8
 #define IPR_VSET_BUS                                   0xff
 #define IPR_IOA_BUS                                            0xff
 #define IPR_IOA_TARGET                                 0xff
 #define IPR_IOA_LUN                                            0xff
-#define IPR_MAX_NUM_BUSES                              4
+#define IPR_MAX_NUM_BUSES                              8
 #define IPR_MAX_BUS_TO_SCAN                            IPR_MAX_NUM_BUSES
 
 #define IPR_NUM_RESET_RELOAD_RETRIES           3
 #define IPR_MAX_SCSI_RATE(width) ((320 * 10) / ((width) / 8))
 
 #define IPR_IOA_RES_HANDLE                             0xffffffff
+#define IPR_INVALID_RES_HANDLE                 0
 #define IPR_IOA_RES_ADDR                               0x00ffffff
 
 /*
 #define IPR_SDT_FMT2_EXP_ROM_SEL                       0x8
 #define IPR_FMT2_SDT_READY_TO_USE                      0xC4D4E3F2
 #define IPR_DOORBELL                                   0x82800000
+#define IPR_RUNTIME_RESET                              0x40000000
 
 #define IPR_PCII_IOA_TRANS_TO_OPER                     (0x80000000 >> 0)
 #define IPR_PCII_IOARCB_XFER_FAILED                    (0x80000000 >> 3)
@@ -261,6 +255,16 @@ struct ipr_std_inq_vpids {
        u8 product_id[IPR_PROD_ID_LEN];
 }__attribute__((packed));
 
+struct ipr_vpd {
+       struct ipr_std_inq_vpids vpids;
+       u8 sn[IPR_SERIAL_NUM_LEN];
+}__attribute__((packed));
+
+struct ipr_ext_vpd {
+       struct ipr_vpd vpd;
+       __be32 wwid[2];
+}__attribute__((packed));
+
 struct ipr_std_inq_data {
        u8 peri_qual_dev_type;
 #define IPR_STD_INQ_PERI_QUAL(peri) ((peri) >> 5)
@@ -304,6 +308,10 @@ struct ipr_config_table_entry {
 #define IPR_SUBTYPE_GENERIC_SCSI       1
 #define IPR_SUBTYPE_VOLUME_SET         2
 
+#define IPR_QUEUEING_MODEL(res)        ((((res)->cfgte.flags) & 0x70) >> 4)
+#define IPR_QUEUE_FROZEN_MODEL 0
+#define IPR_QUEUE_NACA_MODEL           1
+
        struct ipr_res_addr res_addr;
        __be32 res_handle;
        __be32 reserved4[2];
@@ -410,23 +418,26 @@ struct ipr_ioadl_desc {
 struct ipr_ioasa_vset {
        __be32 failing_lba_hi;
        __be32 failing_lba_lo;
-       __be32 ioa_data[22];
+       __be32 reserved;
 }__attribute__((packed, aligned (4)));
 
 struct ipr_ioasa_af_dasd {
        __be32 failing_lba;
+       __be32 reserved[2];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_ioasa_gpdd {
        u8 end_state;
        u8 bus_phase;
        __be16 reserved;
-       __be32 ioa_data[23];
+       __be32 ioa_data[2];
 }__attribute__((packed, aligned (4)));
 
-struct ipr_ioasa_raw {
-       __be32 ioa_data[24];
-}__attribute__((packed, aligned (4)));
+struct ipr_auto_sense {
+       __be16 auto_sense_len;
+       __be16 ioa_data_len;
+       __be32 data[SCSI_SENSE_BUFFERSIZE/sizeof(__be32)];
+};
 
 struct ipr_ioasa {
        __be32 ioasc;
@@ -453,6 +464,8 @@ struct ipr_ioasa {
        __be32 fd_res_handle;
 
        __be32 ioasc_specific;  /* status code specific field */
+#define IPR_ADDITIONAL_STATUS_FMT              0x80000000
+#define IPR_AUTOSENSE_VALID                    0x40000000
 #define IPR_IOASC_SPECIFIC_MASK                0x00ffffff
 #define IPR_FIELD_POINTER_VALID                (0x80000000 >> 8)
 #define IPR_FIELD_POINTER_MASK         0x0000ffff
@@ -461,8 +474,9 @@ struct ipr_ioasa {
                struct ipr_ioasa_vset vset;
                struct ipr_ioasa_af_dasd dasd;
                struct ipr_ioasa_gpdd gpdd;
-               struct ipr_ioasa_raw raw;
        } u;
+
+       struct ipr_auto_sense auto_sense;
 }__attribute__((packed, aligned (4)));
 
 struct ipr_mode_parm_hdr {
@@ -536,28 +550,49 @@ struct ipr_inquiry_page3 {
        u8 patch_number[4];
 }__attribute__((packed));
 
+#define IPR_INQUIRY_PAGE0_ENTRIES 20
+struct ipr_inquiry_page0 {
+       u8 peri_qual_dev_type;
+       u8 page_code;
+       u8 reserved1;
+       u8 len;
+       u8 page[IPR_INQUIRY_PAGE0_ENTRIES];
+}__attribute__((packed));
+
 struct ipr_hostrcb_device_data_entry {
-       struct ipr_std_inq_vpids dev_vpids;
-       u8 dev_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd vpd;
        struct ipr_res_addr dev_res_addr;
-       struct ipr_std_inq_vpids new_dev_vpids;
-       u8 new_dev_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids ioa_last_with_dev_vpids;
-       u8 ioa_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_last_with_dev_vpids;
-       u8 cfc_last_with_dev_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd new_vpd;
+       struct ipr_vpd ioa_last_with_dev_vpd;
+       struct ipr_vpd cfc_last_with_dev_vpd;
        __be32 ioa_data[5];
 }__attribute__((packed, aligned (4)));
 
+struct ipr_hostrcb_device_data_entry_enhanced {
+       struct ipr_ext_vpd vpd;
+       u8 ccin[4];
+       struct ipr_res_addr dev_res_addr;
+       struct ipr_ext_vpd new_vpd;
+       u8 new_ccin[4];
+       struct ipr_ext_vpd ioa_last_with_dev_vpd;
+       struct ipr_ext_vpd cfc_last_with_dev_vpd;
+}__attribute__((packed, aligned (4)));
+
 struct ipr_hostrcb_array_data_entry {
-       struct ipr_std_inq_vpids vpids;
-       u8 serial_num[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd vpd;
+       struct ipr_res_addr expected_dev_res_addr;
+       struct ipr_res_addr dev_res_addr;
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_array_data_entry_enhanced {
+       struct ipr_ext_vpd vpd;
+       u8 ccin[4];
        struct ipr_res_addr expected_dev_res_addr;
        struct ipr_res_addr dev_res_addr;
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_ff_error {
-       __be32 ioa_data[246];
+       __be32 ioa_data[502];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_01_error {
@@ -568,47 +603,75 @@ struct ipr_hostrcb_type_01_error {
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_02_error {
-       struct ipr_std_inq_vpids ioa_vpids;
-       u8 ioa_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_vpids;
-       u8 cfc_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids ioa_last_attached_to_cfc_vpids;
-       u8 ioa_last_attached_to_cfc_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_last_attached_to_ioa_vpids;
-       u8 cfc_last_attached_to_ioa_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd ioa_vpd;
+       struct ipr_vpd cfc_vpd;
+       struct ipr_vpd ioa_last_attached_to_cfc_vpd;
+       struct ipr_vpd cfc_last_attached_to_ioa_vpd;
+       __be32 ioa_data[3];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_12_error {
+       struct ipr_ext_vpd ioa_vpd;
+       struct ipr_ext_vpd cfc_vpd;
+       struct ipr_ext_vpd ioa_last_attached_to_cfc_vpd;
+       struct ipr_ext_vpd cfc_last_attached_to_ioa_vpd;
        __be32 ioa_data[3];
-       u8 reserved[844];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_03_error {
-       struct ipr_std_inq_vpids ioa_vpids;
-       u8 ioa_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_vpids;
-       u8 cfc_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd ioa_vpd;
+       struct ipr_vpd cfc_vpd;
        __be32 errors_detected;
        __be32 errors_logged;
        u8 ioa_data[12];
-       struct ipr_hostrcb_device_data_entry dev_entry[3];
-       u8 reserved[444];
+       struct ipr_hostrcb_device_data_entry dev[3];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_13_error {
+       struct ipr_ext_vpd ioa_vpd;
+       struct ipr_ext_vpd cfc_vpd;
+       __be32 errors_detected;
+       __be32 errors_logged;
+       struct ipr_hostrcb_device_data_entry_enhanced dev[3];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_type_04_error {
-       struct ipr_std_inq_vpids ioa_vpids;
-       u8 ioa_sn[IPR_SERIAL_NUM_LEN];
-       struct ipr_std_inq_vpids cfc_vpids;
-       u8 cfc_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd ioa_vpd;
+       struct ipr_vpd cfc_vpd;
        u8 ioa_data[12];
        struct ipr_hostrcb_array_data_entry array_member[10];
        __be32 exposed_mode_adn;
        __be32 array_id;
-       struct ipr_std_inq_vpids incomp_dev_vpids;
-       u8 incomp_dev_sn[IPR_SERIAL_NUM_LEN];
+       struct ipr_vpd incomp_dev_vpd;
        __be32 ioa_data2;
        struct ipr_hostrcb_array_data_entry array_member2[8];
        struct ipr_res_addr last_func_vset_res_addr;
        u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
        u8 protection_level[8];
-       u8 reserved[124];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_14_error {
+       struct ipr_ext_vpd ioa_vpd;
+       struct ipr_ext_vpd cfc_vpd;
+       __be32 exposed_mode_adn;
+       __be32 array_id;
+       struct ipr_res_addr last_func_vset_res_addr;
+       u8 vset_serial_num[IPR_SERIAL_NUM_LEN];
+       u8 protection_level[8];
+       __be32 num_entries;
+       struct ipr_hostrcb_array_data_entry_enhanced array_member[18];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_07_error {
+       u8 failure_reason[64];
+       struct ipr_vpd vpd;
+       u32 data[222];
+}__attribute__((packed, aligned (4)));
+
+struct ipr_hostrcb_type_17_error {
+       u8 failure_reason[64];
+       struct ipr_ext_vpd vpd;
+       u32 data[476];
 }__attribute__((packed, aligned (4)));
 
 struct ipr_hostrcb_error {
@@ -622,6 +685,11 @@ struct ipr_hostrcb_error {
                struct ipr_hostrcb_type_02_error type_02_error;
                struct ipr_hostrcb_type_03_error type_03_error;
                struct ipr_hostrcb_type_04_error type_04_error;
+               struct ipr_hostrcb_type_07_error type_07_error;
+               struct ipr_hostrcb_type_12_error type_12_error;
+               struct ipr_hostrcb_type_13_error type_13_error;
+               struct ipr_hostrcb_type_14_error type_14_error;
+               struct ipr_hostrcb_type_17_error type_17_error;
        } u;
 }__attribute__((packed, aligned (4)));
 
@@ -655,6 +723,12 @@ struct ipr_hcam {
 #define IPR_HOST_RCB_OVERLAY_ID_3                              0x03
 #define IPR_HOST_RCB_OVERLAY_ID_4                              0x04
 #define IPR_HOST_RCB_OVERLAY_ID_6                              0x06
+#define IPR_HOST_RCB_OVERLAY_ID_7                              0x07
+#define IPR_HOST_RCB_OVERLAY_ID_12                             0x12
+#define IPR_HOST_RCB_OVERLAY_ID_13                             0x13
+#define IPR_HOST_RCB_OVERLAY_ID_14                             0x14
+#define IPR_HOST_RCB_OVERLAY_ID_16                             0x16
+#define IPR_HOST_RCB_OVERLAY_ID_17                             0x17
 #define IPR_HOST_RCB_OVERLAY_ID_DEFAULT                        0xFF
 
        u8 reserved1[3];
@@ -743,6 +817,7 @@ struct ipr_resource_table {
 
 struct ipr_misc_cbs {
        struct ipr_ioa_vpd ioa_vpd;
+       struct ipr_inquiry_page0 page0_data;
        struct ipr_inquiry_page3 page3_data;
        struct ipr_mode_pages mode_pages;
        struct ipr_supported_device supp_dev;
@@ -813,6 +888,7 @@ struct ipr_trace_entry {
 struct ipr_sglist {
        u32 order;
        u32 num_sg;
+       u32 num_dma_sg;
        u32 buffer_len;
        struct scatterlist scatterlist[1];
 };
@@ -825,6 +901,13 @@ enum ipr_sdt_state {
        DUMP_OBTAINED
 };
 
+enum ipr_cache_state {
+       CACHE_NONE,
+       CACHE_DISABLED,
+       CACHE_ENABLED,
+       CACHE_INVALID
+};
+
 /* Per-controller data */
 struct ipr_ioa_cfg {
        char eye_catcher[8];
@@ -840,7 +923,9 @@ struct ipr_ioa_cfg {
        u8 dump_taken:1;
        u8 allow_cmds:1;
        u8 allow_ml_add_del:1;
+       u8 needs_hard_reset:1;
 
+       enum ipr_cache_state cache_state;
        u16 type; /* CCIN of the card */
 
        u8 log_level;
@@ -911,11 +996,11 @@ struct ipr_ioa_cfg {
        u16 reset_retries;
 
        u32 errors_logged;
+       u32 doorbell;
 
        struct Scsi_Host *host;
        struct pci_dev *pdev;
        struct ipr_sglist *ucode_sglist;
-       struct ipr_mode_pages *saved_mode_pages;
        u8 saved_mode_page_len;
 
        struct work_struct work_q;
@@ -948,6 +1033,7 @@ struct ipr_cmnd {
        struct timer_list timer;
        void (*done) (struct ipr_cmnd *);
        int (*job_step) (struct ipr_cmnd *);
+       int (*job_step_failed) (struct ipr_cmnd *);
        u16 cmd_index;
        u8 sense_buffer[SCSI_SENSE_BUFFERSIZE];
        dma_addr_t sense_buffer_dma;
@@ -1083,11 +1169,7 @@ struct ipr_ucode_image_header {
 /*
  * Macros
  */
-#if IPR_DEBUG
-#define IPR_DBG_CMD(CMD) do { CMD; } while (0)
-#else
-#define IPR_DBG_CMD(CMD)
-#endif
+#define IPR_DBG_CMD(CMD) if (ipr_debug) { CMD; }
 
 #ifdef CONFIG_SCSI_IPR_TRACE
 #define ipr_create_trace_file(kobj, attr) sysfs_create_bin_file(kobj, attr)
@@ -1110,42 +1192,34 @@ struct ipr_ucode_image_header {
  */
 #define ipr_err(...) printk(KERN_ERR IPR_NAME ": "__VA_ARGS__)
 #define ipr_info(...) printk(KERN_INFO IPR_NAME ": "__VA_ARGS__)
-#define ipr_crit(...) printk(KERN_CRIT IPR_NAME ": "__VA_ARGS__)
-#define ipr_warn(...) printk(KERN_WARNING IPR_NAME": "__VA_ARGS__)
 #define ipr_dbg(...) IPR_DBG_CMD(printk(KERN_INFO IPR_NAME ": "__VA_ARGS__))
 
-#define ipr_sdev_printk(level, sdev, fmt, ...) \
-       printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, sdev->host->host_no, \
-               sdev->channel, sdev->id, sdev->lun, ##__VA_ARGS__)
-
-#define ipr_sdev_err(sdev, fmt, ...) \
-       ipr_sdev_printk(KERN_ERR, sdev, fmt, ##__VA_ARGS__)
-
-#define ipr_sdev_info(sdev, fmt, ...) \
-       ipr_sdev_printk(KERN_INFO, sdev, fmt, ##__VA_ARGS__)
+#define ipr_ra_printk(level, ioa_cfg, ra, fmt, ...) \
+       printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, (ioa_cfg)->host->host_no, \
+               (ra).bus, (ra).target, (ra).lun, ##__VA_ARGS__)
 
-#define ipr_sdev_dbg(sdev, fmt, ...) \
-       IPR_DBG_CMD(ipr_sdev_printk(KERN_INFO, sdev, fmt, ##__VA_ARGS__))
-
-#define ipr_res_printk(level, ioa_cfg, res, fmt, ...) \
-       printk(level IPR_NAME ": %d:%d:%d:%d: " fmt, ioa_cfg->host->host_no, \
-               res.bus, res.target, res.lun, ##__VA_ARGS__)
+#define ipr_ra_err(ioa_cfg, ra, fmt, ...) \
+       ipr_ra_printk(KERN_ERR, ioa_cfg, ra, fmt, ##__VA_ARGS__)
 
 #define ipr_res_err(ioa_cfg, res, fmt, ...) \
-       ipr_res_printk(KERN_ERR, ioa_cfg, res, fmt, ##__VA_ARGS__)
-#define ipr_res_dbg(ioa_cfg, res, fmt, ...) \
-       IPR_DBG_CMD(ipr_res_printk(KERN_INFO, ioa_cfg, res, fmt, ##__VA_ARGS__))
+       ipr_ra_err(ioa_cfg, (res)->cfgte.res_addr, fmt, ##__VA_ARGS__)
+
+#define ipr_phys_res_err(ioa_cfg, res, fmt, ...)                       \
+{                                                                      \
+       if ((res).bus >= IPR_MAX_NUM_BUSES) {                           \
+               ipr_err(fmt": unknown\n", ##__VA_ARGS__);               \
+       } else {                                                        \
+               ipr_err(fmt": %d:%d:%d:%d\n",                           \
+                       ##__VA_ARGS__, (ioa_cfg)->host->host_no,        \
+                       (res).bus, (res).target, (res).lun);            \
+       }                                                               \
+}
 
 #define ipr_trace ipr_dbg("%s: %s: Line: %d\n",\
        __FILE__, __FUNCTION__, __LINE__)
 
-#if IPR_DBG_TRACE
-#define ENTER printk(KERN_INFO IPR_NAME": Entering %s\n", __FUNCTION__)
-#define LEAVE printk(KERN_INFO IPR_NAME": Leaving %s\n", __FUNCTION__)
-#else
-#define ENTER
-#define LEAVE
-#endif
+#define ENTER IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Entering %s\n", __FUNCTION__))
+#define LEAVE IPR_DBG_CMD(printk(KERN_INFO IPR_NAME": Leaving %s\n", __FUNCTION__))
 
 #define ipr_err_separator \
 ipr_err("----------------------------------------------------------\n")
@@ -1217,6 +1291,36 @@ static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
                return 0;
 }
 
+/**
+ * ipr_is_scsi_disk - Determine if a resource is a SCSI disk
+ * @res:       resource entry struct
+ *
+ * Return value:
+ *     1 if SCSI disk / 0 if not SCSI disk
+ **/
+static inline int ipr_is_scsi_disk(struct ipr_resource_entry *res)
+{
+       if (ipr_is_af_dasd_device(res) ||
+           (ipr_is_gscsi(res) && IPR_IS_DASD_DEVICE(res->cfgte.std_inq_data)))
+               return 1;
+       else
+               return 0;
+}
+
+/**
+ * ipr_is_naca_model - Determine if a resource is using NACA queueing model
+ * @res:       resource entry struct
+ *
+ * Return value:
+ *     1 if NACA queueing model / 0 if not NACA queueing model
+ **/
+static inline int ipr_is_naca_model(struct ipr_resource_entry *res)
+{
+       if (ipr_is_gscsi(res) && IPR_QUEUEING_MODEL(res) == IPR_QUEUE_NACA_MODEL)
+               return 1;
+       return 0;
+}
+
 /**
  * ipr_is_device - Determine if resource address is that of a device
  * @res_addr:  resource address struct
@@ -1227,7 +1331,7 @@ static inline int ipr_is_gscsi(struct ipr_resource_entry *res)
 static inline int ipr_is_device(struct ipr_res_addr *res_addr)
 {
        if ((res_addr->bus < IPR_MAX_NUM_BUSES) &&
-           (res_addr->target < IPR_MAX_NUM_TARGETS_PER_BUS))
+           (res_addr->target < (IPR_MAX_NUM_TARGETS_PER_BUS - 1)))
                return 1;
 
        return 0;
index 5b6ce0a..52fb2ec 100644 (file)
@@ -243,7 +243,7 @@ static void ql_icmd(Scsi_Cmnd * cmd)
         /**/ outb(qlcfg5, qbase + 5);  /* select timer */
        outb(qlcfg9 & 7, qbase + 9);    /* prescaler */
 /*     outb(0x99, qbase + 5);  */
-       outb(cmd->device->id, qbase + 4);
+       outb(scmd_id(cmd), qbase + 4);
 
        for (i = 0; i < cmd->cmd_len; i++)
                outb(cmd->cmnd[i], qbase + 2);
@@ -450,7 +450,7 @@ irqreturn_t qlogicfas408_ihandl(int irq, void *dev_id, struct pt_regs *regs)
 int qlogicfas408_queuecommand(Scsi_Cmnd * cmd, void (*done) (Scsi_Cmnd *))
 {
        struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
-       if (cmd->device->id == priv->qinitid) {
+       if (scmd_id(cmd) == priv->qinitid) {
                cmd->result = DID_BAD_TARGET << 16;
                done(cmd);
                return 0;
@@ -511,27 +511,15 @@ int qlogicfas408_abort(Scsi_Cmnd * cmd)
 int qlogicfas408_bus_reset(Scsi_Cmnd * cmd)
 {
        struct qlogicfas408_priv *priv = get_priv_by_cmd(cmd);
-       priv->qabort = 2;
-       ql_zap(priv);
-       return SUCCESS;
-}
-
-/* 
- *     Reset SCSI host controller
- */
+       unsigned long flags;
 
-int qlogicfas408_host_reset(Scsi_Cmnd * cmd)
-{
-       return FAILED;
-}
+       priv->qabort = 2;
 
-/* 
- *     Reset SCSI device
- */
+       spin_lock_irqsave(cmd->device->host->host_lock, flags);
+       ql_zap(priv);
+       spin_unlock_irqrestore(cmd->device->host->host_lock, flags);
 
-int qlogicfas408_device_reset(Scsi_Cmnd * cmd)
-{
-       return FAILED;
+       return SUCCESS;
 }
 
 /*
@@ -626,8 +614,6 @@ EXPORT_SYMBOL(qlogicfas408_info);
 EXPORT_SYMBOL(qlogicfas408_queuecommand);
 EXPORT_SYMBOL(qlogicfas408_abort);
 EXPORT_SYMBOL(qlogicfas408_bus_reset);
-EXPORT_SYMBOL(qlogicfas408_device_reset);
-EXPORT_SYMBOL(qlogicfas408_host_reset);
 EXPORT_SYMBOL(qlogicfas408_biosparam);
 EXPORT_SYMBOL(qlogicfas408_ihandl);
 EXPORT_SYMBOL(qlogicfas408_get_chip_type);
index f01cbd6..4b3df20 100644 (file)
@@ -109,8 +109,6 @@ int qlogicfas408_biosparam(struct scsi_device * disk,
                        sector_t capacity, int ip[]);
 int qlogicfas408_abort(Scsi_Cmnd * cmd);
 int qlogicfas408_bus_reset(Scsi_Cmnd * cmd);
-int qlogicfas408_host_reset(Scsi_Cmnd * cmd);
-int qlogicfas408_device_reset(Scsi_Cmnd * cmd);
 const char *qlogicfas408_info(struct Scsi_Host *host);
 int qlogicfas408_get_chip_type(int qbase, int int_type);
 void qlogicfas408_setup(int qbase, int id, int int_type);
index 6e7e96b..6ee5e19 100644 (file)
@@ -3,21 +3,24 @@
  *
  *  Copyright 2003-2004 Red Hat, Inc.
  *
- *  The contents of this file are subject to the Open
- *  Software License version 1.1 that can be found at
- *  http://www.opensource.org/licenses/osl-1.1.txt and is included herein
- *  by reference.
  *
- *  Alternatively, the contents of this file may be used under the terms
- *  of the GNU General Public License version 2 (the "GPL") as distributed
- *  in the kernel source COPYING file, in which case the provisions of
- *  the GPL are applicable instead of the above.  If you wish to allow
- *  the use of your version of this file only under the terms of the
- *  GPL and not to allow others to use your version of this file under
- *  the OSL, indicate your decision by deleting the provisions above and
- *  replace them with the notice and other provisions required by the GPL.
- *  If you do not delete the provisions above, a recipient may use your
- *  version of this file under either the OSL or the GPL.
+ *  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, 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; see the file COPYING.  If not, write to
+ *  the Free Software Foundation, 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ *
+ *  libata documentation is available via 'make {ps|pdf}docs',
+ *  as Documentation/DocBook/libata.*
  *
  */
 
index 777829f..043f50b 100644 (file)
@@ -20,7 +20,7 @@
  *
  * Contact Information:
  * Scott H Kilau <Scott_Kilau@digi.com>
- * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ * Wendy Xiong   <wendyx@us.ibm.com>
  *
  ***********************************************************************/
 
@@ -28,7 +28,6 @@
 #define __JSM_DRIVER_H
 
 #include <linux/kernel.h>
-#include <linux/version.h>
 #include <linux/types.h>       /* To pick up the varions Linux types */
 #include <linux/tty.h>
 #include <linux/serial_core.h>
@@ -90,7 +89,7 @@ enum {
 #define WRITEBUFLEN    ((4096) + 4)
 #define MYFLIPLEN      N_TTY_BUF_SIZE
 
-#define JSM_VERSION    "jsm: 1.1-1-INKERNEL"
+#define JSM_VERSION    "jsm: 1.2-1-INKERNEL"
 #define JSM_PARTNUM    "40002438_A-INKERNEL"
 
 struct jsm_board;
@@ -381,7 +380,6 @@ struct neo_uart_struct {
 extern struct  uart_driver jsm_uart_driver;
 extern struct  board_ops jsm_neo_ops;
 extern int     jsm_debug;
-extern int     jsm_rawreadok;
 
 /*************************************************************************
  *
index 3a11a69..a5fc589 100644 (file)
@@ -20,7 +20,7 @@
  *
  * Contact Information:
  * Scott H Kilau <Scott_Kilau@digi.com>
- * Wendy Xiong   <wendyx@us.ltcfwd.linux.ibm.com>
+ * Wendy Xiong   <wendyx@us.ibm.com>
  *
  ***********************************************************************/
 #include <linux/delay.h>       /* For udelay */
@@ -48,8 +48,9 @@ static inline void neo_pci_posting_flush(struct jsm_board *bd)
 
 static void neo_set_cts_flow_control(struct jsm_channel *ch)
 {
-       u8 ier = readb(&ch->ch_neo_uart->ier);
-       u8 efr = readb(&ch->ch_neo_uart->efr);
+       u8 ier, efr;
+       ier = readb(&ch->ch_neo_uart->ier);
+       efr = readb(&ch->ch_neo_uart->efr);
 
        jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting CTSFLOW\n");
 
@@ -78,8 +79,9 @@ static void neo_set_cts_flow_control(struct jsm_channel *ch)
 
 static void neo_set_rts_flow_control(struct jsm_channel *ch)
 {
-       u8 ier = readb(&ch->ch_neo_uart->ier);
-       u8 efr = readb(&ch->ch_neo_uart->efr);
+       u8 ier, efr;
+       ier = readb(&ch->ch_neo_uart->ier);
+       efr = readb(&ch->ch_neo_uart->efr);
 
        jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting RTSFLOW\n");
 
@@ -117,8 +119,9 @@ static void neo_set_rts_flow_control(struct jsm_channel *ch)
 
 static void neo_set_ixon_flow_control(struct jsm_channel *ch)
 {
-       u8 ier = readb(&ch->ch_neo_uart->ier);
-       u8 efr = readb(&ch->ch_neo_uart->efr);
+       u8 ier, efr;
+       ier = readb(&ch->ch_neo_uart->ier);
+       efr = readb(&ch->ch_neo_uart->efr);
 
        jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting IXON FLOW\n");
 
@@ -153,8 +156,9 @@ static void neo_set_ixon_flow_control(struct jsm_channel *ch)
 
 static void neo_set_ixoff_flow_control(struct jsm_channel *ch)
 {
-       u8 ier = readb(&ch->ch_neo_uart->ier);
-       u8 efr = readb(&ch->ch_neo_uart->efr);
+       u8 ier, efr;
+       ier = readb(&ch->ch_neo_uart->ier);
+       efr = readb(&ch->ch_neo_uart->efr);
 
        jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Setting IXOFF FLOW\n");
 
@@ -190,8 +194,9 @@ static void neo_set_ixoff_flow_control(struct jsm_channel *ch)
 
 static void neo_set_no_input_flow_control(struct jsm_channel *ch)
 {
-       u8 ier = readb(&ch->ch_neo_uart->ier);
-       u8 efr = readb(&ch->ch_neo_uart->efr);
+       u8 ier, efr;
+       ier = readb(&ch->ch_neo_uart->ier);
+       efr = readb(&ch->ch_neo_uart->efr);
 
        jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Unsetting Input FLOW\n");
 
@@ -228,8 +233,9 @@ static void neo_set_no_input_flow_control(struct jsm_channel *ch)
 
 static void neo_set_no_output_flow_control(struct jsm_channel *ch)
 {
-       u8 ier = readb(&ch->ch_neo_uart->ier);
-       u8 efr = readb(&ch->ch_neo_uart->efr);
+       u8 ier, efr;
+       ier = readb(&ch->ch_neo_uart->ier);
+       efr = readb(&ch->ch_neo_uart->efr);
 
        jsm_printk(PARAM, INFO, &ch->ch_bd->pci_dev, "Unsetting Output FLOW\n");
 
@@ -959,56 +965,47 @@ static void neo_param(struct jsm_channel *ch)
                        baud = ch->ch_custom_speed;
                        if (ch->ch_flags & CH_BAUD0)
                                ch->ch_flags &= ~(CH_BAUD0);
-               } else {
-                       int iindex = 0;
-                       int jindex = 0;
-
-                       const u64 bauds[4][16] = {
-                               {
-                                       0,      50,     75,     110,
-                                       134,    150,    200,    300,
-                                       600,    1200,   1800,   2400,
-                                       4800,   9600,   19200,  38400 },
-                               {
-                                       0,      57600,  115200, 230400,
-                                       460800, 150,    200,    921600,
-                                       600,    1200,   1800,   2400,
-                                       4800,   9600,   19200,  38400 },
-                               {
-                                       0,      57600,  76800, 115200,
-                                       131657, 153600, 230400, 460800,
-                                       921600, 1200,   1800,   2400,
-                                       4800,   9600,   19200,  38400 },
-                               {
-                                       0,      57600,  115200, 230400,
-                                       460800, 150,    200,    921600,
-                                       600,    1200,   1800,   2400,
-                                       4800,   9600,   19200,  38400 }
-                       };
-
-                       baud = C_BAUD(ch->uart_port.info->tty) & 0xff;
-
-                       if (ch->ch_c_cflag & CBAUDEX)
-                               iindex = 1;
-
-                       jindex = baud;
-
-                       if ((iindex >= 0) && (iindex < 4) && (jindex >= 0) && (jindex < 16))
-                               baud = bauds[iindex][jindex];
-                       else {
-                               jsm_printk(IOCTL, DEBUG, &ch->ch_bd->pci_dev,
-                                       "baud indices were out of range (%d)(%d)",
-                               iindex, jindex);
-                               baud = 0;
+       } else {
+               int i;
+               unsigned int cflag;
+               static struct {
+                       unsigned int rate;
+                       unsigned int cflag;
+               } baud_rates[] = {
+                       { 921600, B921600 },
+                       { 460800, B460800 },
+                       { 230400, B230400 },
+                       { 115200, B115200 },
+                       {  57600, B57600  },
+                       {  38400, B38400  },
+                       {  19200, B19200  },
+                       {   9600, B9600   },
+                       {   4800, B4800   },
+                       {   2400, B2400   },
+                       {   1200, B1200   },
+                       {    600, B600    },
+                       {    300, B300    },
+                       {    200, B200    },
+                       {    150, B150    },
+                       {    134, B134    },
+                       {    110, B110    },
+                       {     75, B75     },
+                       {     50, B50     },
+               };
+
+               cflag = C_BAUD(ch->uart_port.info->tty);
+               baud = 9600;
+               for (i = 0; i < ARRAY_SIZE(baud_rates); i++) {
+                       if (baud_rates[i].cflag == cflag) {
+                               baud = baud_rates[i].rate;
+                               break;
                        }
-
-                       if (baud == 0)
-                               baud = 9600;
-
-                       if (ch->ch_flags & CH_BAUD0)
-                               ch->ch_flags &= ~(CH_BAUD0);
                }
 
+               if (ch->ch_flags & CH_BAUD0)
+                       ch->ch_flags &= ~(CH_BAUD0);
+       }
+
        if (ch->ch_c_cflag & PARENB)
                lcr |= UART_LCR_PARITY;
 
index 631e549..2cda011 100644 (file)
@@ -3,4 +3,5 @@
 #
 #
 
-obj-$(CONFIG_BLK_DEV_SGIIOC4) += ioc4.o
+obj-$(CONFIG_SGI_IOC4) += ioc4.o
+obj-$(CONFIG_SGI_IOC3) += ioc3.o
index 0d9f537..550ddfa 100644 (file)
@@ -1,30 +1,73 @@
 #
-# USB ATM driver configuration
+# USB/ATM DSL configuration
 #
-comment "USB ATM/DSL drivers"
+
+menu "USB DSL modem support"
        depends on USB
 
 config USB_ATM
-       tristate "Generic USB ATM/DSL core I/O support"
+       tristate "USB DSL modem support"
        depends on USB && ATM
        select CRC32
        default n
        help
-         This provides a library which is used for packet I/O by USB DSL
-         modems, such as the SpeedTouch driver below. 
+         Say Y here if you want to connect a USB Digital Subscriber Line (DSL)
+         modem to your computer's USB port.  You will then need to choose your
+         modem from the list below.
 
          To compile this driver as a module, choose M here: the
-         module will be called usb_atm.
+         module will be called usbatm.
 
 config USB_SPEEDTOUCH
-       tristate "Alcatel Speedtouch USB support"
-       depends on USB && ATM
-       select USB_ATM
+       tristate "Speedtouch USB support"
+       depends on USB_ATM
+       select FW_LOADER
        help
-         Say Y here if you have an Alcatel SpeedTouch USB or SpeedTouch 330
+         Say Y here if you have an SpeedTouch USB or SpeedTouch 330
          modem.  In order to use your modem you will need to install the 
          two parts of the firmware, extracted by the user space tools; see
          <http://www.linux-usb.org/SpeedTouch/> for details.
 
          To compile this driver as a module, choose M here: the
          module will be called speedtch.
+
+config USB_CXACRU
+       tristate "Conexant AccessRunner USB support"
+       depends on USB_ATM
+       select FW_LOADER
+       help
+         Say Y here if you have an ADSL USB modem based on the Conexant
+         AccessRunner chipset.  In order to use your modem you will need to
+         install the firmware, extracted by the user space tools; see
+         <http://accessrunner.sourceforge.net/> for details.
+
+         To compile this driver as a module, choose M here: the
+         module will be called cxacru.
+
+config USB_UEAGLEATM
+       tristate "ADI 930 and eagle USB DSL modem"
+       depends on USB_ATM
+       select FW_LOADER
+       help
+         Say Y here if you have an ADSL USB modem based on the ADI 930
+         or eagle chipset. In order to use your modem you will need to
+         install firmwares and CMV (Command Management Variables); see
+         <https://gna.org/projects/ueagleatm/> for details.
+
+         To compile this driver as a module, choose M here: the
+         module will be called ueagle-atm.
+
+config USB_XUSBATM
+       tristate "Other USB DSL modem support"
+       depends on USB_ATM
+       help
+         Say Y here if you have a DSL USB modem not explicitly supported by
+         another USB DSL drivers.  In order to use your modem you will need to
+         pass the vendor ID, product ID, and endpoint numbers for transmission
+         and reception as module parameters.  You may need to initialize the
+         the modem using a user space utility (a firmware loader for example).
+
+         To compile this driver as a module, choose M here: the
+         module will be called xusbatm.
+
+endmenu
index 2a1697b..956b7a1 100644 (file)
@@ -5,6 +5,8 @@
  *  Copyright (C) 2003, Duncan Sands
  *  Copyright (C) 2004, David Woodhouse
  *
+ *  Based on "modem_run.c", copyright (C) 2001, Benoit Papillault
+ *
  *  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)
  *
  ******************************************************************************/
 
-#include <linux/module.h>
-#include <linux/moduleparam.h>
+#include <asm/page.h>
+#include <linux/device.h>
+#include <linux/errno.h>
+#include <linux/firmware.h>
 #include <linux/gfp.h>
+#include <linux/init.h>
 #include <linux/kernel.h>
-#include <linux/sched.h>
-#include <linux/timer.h>
-#include <linux/errno.h>
-#include <linux/proc_fs.h>
+#include <linux/module.h>
+#include <linux/moduleparam.h>
 #include <linux/slab.h>
-#include <linux/wait.h>
-#include <linux/list.h>
-#include <asm/processor.h>
-#include <asm/uaccess.h>
-#include <linux/smp_lock.h>
-#include <linux/interrupt.h>
-#include <linux/atm.h>
-#include <linux/atmdev.h>
-#include <linux/crc32.h>
-#include <linux/init.h>
-#include <linux/firmware.h>
-
-#include "usb_atm.h"
+#include <linux/stat.h>
+#include <linux/timer.h>
+#include <linux/types.h>
+#include <linux/usb_ch9.h>
+#include <linux/workqueue.h>
 
-#if defined(CONFIG_FW_LOADER) || defined(CONFIG_FW_LOADER_MODULE)
-#      define USE_FW_LOADER
-#endif
+#include "usbatm.h"
 
 #define DRIVER_AUTHOR  "Johan Verrept, Duncan Sands <duncan.sands@free.fr>"
-#define DRIVER_VERSION "1.8"
+#define DRIVER_VERSION "1.10"
 #define DRIVER_DESC    "Alcatel SpeedTouch USB driver version " DRIVER_VERSION
 
 static const char speedtch_driver_name[] = "speedtch";
 
-#define SPEEDTOUCH_VENDORID            0x06b9
-#define SPEEDTOUCH_PRODUCTID           0x4061
-
-/* Timeout in jiffies */
-#define CTRL_TIMEOUT 2000
-#define DATA_TIMEOUT 2000
-
-#define OFFSET_7  0            /* size 1 */
-#define OFFSET_b  1            /* size 8 */
-#define OFFSET_d  9            /* size 4 */
-#define OFFSET_e 13            /* size 1 */
-#define OFFSET_f 14            /* size 1 */
-#define TOTAL    15
-
-#define SIZE_7 1
-#define SIZE_b 8
-#define SIZE_d 4
-#define SIZE_e 1
-#define SIZE_f 1
+#define CTRL_TIMEOUT 2000      /* milliseconds */
+#define DATA_TIMEOUT 2000      /* milliseconds */
+
+#define OFFSET_7       0               /* size 1 */
+#define OFFSET_b       1               /* size 8 */
+#define OFFSET_d       9               /* size 4 */
+#define OFFSET_e       13              /* size 1 */
+#define OFFSET_f       14              /* size 1 */
+#define TOTAL          15
+
+#define SIZE_7         1
+#define SIZE_b         8
+#define SIZE_d         4
+#define SIZE_e         1
+#define SIZE_f         1
+
+#define MIN_POLL_DELAY         5000    /* milliseconds */
+#define MAX_POLL_DELAY         60000   /* milliseconds */
+
+#define RESUBMIT_DELAY         1000    /* milliseconds */
+
+#define DEFAULT_BULK_ALTSETTING        1
+#define DEFAULT_ISOC_ALTSETTING        3
+#define DEFAULT_DL_512_FIRST   0
+#define DEFAULT_ENABLE_ISOC    0
+#define DEFAULT_SW_BUFFERING   0
+
+static unsigned int altsetting = 0; /* zero means: use the default */
+static int dl_512_first = DEFAULT_DL_512_FIRST;
+static int enable_isoc = DEFAULT_ENABLE_ISOC;
+static int sw_buffering = DEFAULT_SW_BUFFERING;
+
+module_param(altsetting, uint, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(altsetting,
+               "Alternative setting for data interface (bulk_default: "
+               __MODULE_STRING(DEFAULT_BULK_ALTSETTING) "; isoc_default: "
+               __MODULE_STRING(DEFAULT_ISOC_ALTSETTING) ")");
+
+module_param(dl_512_first, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(dl_512_first,
+                "Read 512 bytes before sending firmware (default: "
+                __MODULE_STRING(DEFAULT_DL_512_FIRST) ")");
+
+module_param(enable_isoc, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(enable_isoc,
+               "Use isochronous transfers if available (default: "
+               __MODULE_STRING(DEFAULT_ENABLE_ISOC) ")");
+
+module_param(sw_buffering, bool, S_IRUGO | S_IWUSR);
+MODULE_PARM_DESC(sw_buffering,
+                "Enable software buffering (default: "
+                __MODULE_STRING(DEFAULT_SW_BUFFERING) ")");
+
+#define INTERFACE_DATA         1
+#define ENDPOINT_INT           0x81
+#define ENDPOINT_BULK_DATA     0x07
+#define ENDPOINT_ISOC_DATA     0x07
+#define ENDPOINT_FIRMWARE      0x05
 
-static int dl_512_first = 0;
-static int sw_buffering = 0;
-
-module_param(dl_512_first, bool, 0444);
-MODULE_PARM_DESC(dl_512_first, "Read 512 bytes before sending firmware");
-
-module_param(sw_buffering, uint, 0444);
-MODULE_PARM_DESC(sw_buffering, "Enable software buffering");
-
-#define UDSL_IOCTL_LINE_UP             1
-#define UDSL_IOCTL_LINE_DOWN           2
+#define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) )
 
-#define SPEEDTCH_ENDPOINT_INT          0x81
-#define SPEEDTCH_ENDPOINT_DATA         0x07
-#define SPEEDTCH_ENDPOINT_FIRMWARE     0x05
+struct speedtch_instance_data {
+       struct usbatm_data *usbatm;
 
-#define hex2int(c) ( (c >= '0') && (c <= '9') ? (c - '0') : ((c & 0xf) + 9) )
+       unsigned int altsetting;
 
-static struct usb_device_id speedtch_usb_ids[] = {
-       {USB_DEVICE(SPEEDTOUCH_VENDORID, SPEEDTOUCH_PRODUCTID)},
-       {}
-};
+       struct work_struct status_checker;
 
-MODULE_DEVICE_TABLE(usb, speedtch_usb_ids);
+       unsigned char last_status;
 
-struct speedtch_instance_data {
-       struct udsl_instance_data u;
+       int poll_delay; /* milliseconds */
 
-       /* Status */
+       struct timer_list resubmit_timer;
        struct urb *int_urb;
        unsigned char int_data[16];
-       struct work_struct poll_work;
-       struct timer_list poll_timer;
-};
-/* USB */
 
-static int speedtch_usb_probe(struct usb_interface *intf,
-                             const struct usb_device_id *id);
-static void speedtch_usb_disconnect(struct usb_interface *intf);
-static int speedtch_usb_ioctl(struct usb_interface *intf, unsigned int code,
-                             void *user_data);
-static void speedtch_handle_int(struct urb *urb, struct pt_regs *regs);
-static void speedtch_poll_status(struct speedtch_instance_data *instance);
-
-static struct usb_driver speedtch_usb_driver = {
-       .owner          = THIS_MODULE,
-       .name           = speedtch_driver_name,
-       .probe          = speedtch_usb_probe,
-       .disconnect     = speedtch_usb_disconnect,
-       .ioctl          = speedtch_usb_ioctl,
-       .id_table       = speedtch_usb_ids,
+       unsigned char scratch_buffer[TOTAL];
 };
 
 /***************
 **  firmware  **
 ***************/
 
-static void speedtch_got_firmware(struct speedtch_instance_data *instance,
-                                 int got_it)
+static void speedtch_set_swbuff(struct speedtch_instance_data *instance, int state)
 {
-       int err;
-       struct usb_interface *intf;
-
-       down(&instance->u.serialize);   /* vs self, speedtch_firmware_start */
-       if (instance->u.status == UDSL_LOADED_FIRMWARE)
-               goto out;
-       if (!got_it) {
-               instance->u.status = UDSL_NO_FIRMWARE;
-               goto out;
-       }
-       if ((err = usb_set_interface(instance->u.usb_dev, 1, 1)) < 0) {
-               dbg("speedtch_got_firmware: usb_set_interface returned %d!", err);
-               instance->u.status = UDSL_NO_FIRMWARE;
-               goto out;
-       }
-
-       /* Set up interrupt endpoint */
-       intf = usb_ifnum_to_if(instance->u.usb_dev, 0);
-       if (intf && !usb_driver_claim_interface(&speedtch_usb_driver, intf, NULL)) {
-
-               instance->int_urb = usb_alloc_urb(0, GFP_KERNEL);
-               if (instance->int_urb) {
-
-                       usb_fill_int_urb(instance->int_urb, instance->u.usb_dev,
-                                        usb_rcvintpipe(instance->u.usb_dev, SPEEDTCH_ENDPOINT_INT),
-                                        instance->int_data,
-                                        sizeof(instance->int_data),
-                                        speedtch_handle_int, instance, 50);
-                       err = usb_submit_urb(instance->int_urb, GFP_KERNEL);
-                       if (err) {
-                               /* Doesn't matter; we'll poll anyway */
-                               dbg("speedtch_got_firmware: Submission of interrupt URB failed %d", err);
-                               usb_free_urb(instance->int_urb);
-                               instance->int_urb = NULL;
-                               usb_driver_release_interface(&speedtch_usb_driver, intf);
-                       }
-               }
-       }
-       /* Start status polling */
-       mod_timer(&instance->poll_timer, jiffies + (1 * HZ));
-
-       instance->u.status = UDSL_LOADED_FIRMWARE;
-       tasklet_schedule(&instance->u.receive_tasklet);
- out:
-       up(&instance->u.serialize);
-       wake_up_interruptible(&instance->u.firmware_waiters);
-}
-
-static int speedtch_set_swbuff(struct speedtch_instance_data *instance,
-                              int state)
-{
-       struct usb_device *dev = instance->u.usb_dev;
+       struct usbatm_data *usbatm = instance->usbatm;
+       struct usb_device *usb_dev = usbatm->usb_dev;
        int ret;
 
-       ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-                             0x32, 0x40, state ? 0x01 : 0x00,
-                             0x00, NULL, 0, 100);
-       if (ret < 0) {
-               printk("Warning: %sabling SW buffering: usb_control_msg returned %d\n",
-                    state ? "En" : "Dis", ret);
-               return ret;
-       }
-
-       dbg("speedtch_set_swbuff: %sbled SW buffering", state ? "En" : "Dis");
-       return 0;
+       ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
+                             0x32, 0x40, state ? 0x01 : 0x00, 0x00, NULL, 0, CTRL_TIMEOUT);
+       if (ret < 0)
+               usb_warn(usbatm,
+                        "%sabling SW buffering: usb_control_msg returned %d\n",
+                        state ? "En" : "Dis", ret);
+       else
+               dbg("speedtch_set_swbuff: %sbled SW buffering", state ? "En" : "Dis");
 }
 
 static void speedtch_test_sequence(struct speedtch_instance_data *instance)
 {
-       struct usb_device *dev = instance->u.usb_dev;
-       unsigned char buf[10];
+       struct usbatm_data *usbatm = instance->usbatm;
+       struct usb_device *usb_dev = usbatm->usb_dev;
+       unsigned char *buf = instance->scratch_buffer;
        int ret;
 
        /* URB 147 */
        buf[0] = 0x1c;
        buf[1] = 0x50;
-       ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-                             0x01, 0x40, 0x0b, 0x00, buf, 2, 100);
+       ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
+                             0x01, 0x40, 0x0b, 0x00, buf, 2, CTRL_TIMEOUT);
        if (ret < 0)
-               printk(KERN_WARNING "%s failed on URB147: %d\n", __func__, ret);
+               usb_warn(usbatm, "%s failed on URB147: %d\n", __func__, ret);
 
        /* URB 148 */
        buf[0] = 0x32;
        buf[1] = 0x00;
-       ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-                             0x01, 0x40, 0x02, 0x00, buf, 2, 100);
+       ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
+                             0x01, 0x40, 0x02, 0x00, buf, 2, CTRL_TIMEOUT);
        if (ret < 0)
-               printk(KERN_WARNING "%s failed on URB148: %d\n", __func__, ret);
+               usb_warn(usbatm, "%s failed on URB148: %d\n", __func__, ret);
 
        /* URB 149 */
        buf[0] = 0x01;
        buf[1] = 0x00;
        buf[2] = 0x01;
-       ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-                             0x01, 0x40, 0x03, 0x00, buf, 3, 100);
+       ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
+                             0x01, 0x40, 0x03, 0x00, buf, 3, CTRL_TIMEOUT);
        if (ret < 0)
-               printk(KERN_WARNING "%s failed on URB149: %d\n", __func__, ret);
+               usb_warn(usbatm, "%s failed on URB149: %d\n", __func__, ret);
 
        /* URB 150 */
        buf[0] = 0x01;
        buf[1] = 0x00;
        buf[2] = 0x01;
-       ret = usb_control_msg(dev, usb_sndctrlpipe(dev, 0),
-                             0x01, 0x40, 0x04, 0x00, buf, 3, 100);
+       ret = usb_control_msg(usb_dev, usb_sndctrlpipe(usb_dev, 0),
+                             0x01, 0x40, 0x04, 0x00, buf, 3, CTRL_TIMEOUT);
        if (ret < 0)
-               printk(KERN_WARNING "%s failed on URB150: %d\n", __func__, ret);
-}
-
-static int speedtch_start_synchro(struct speedtch_instance_data *instance)
-{
-       struct usb_device *dev = instance->u.usb_dev;
-       unsigned char buf[2];
-       int ret;
-
-       ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                             0x12, 0xc0, 0x04, 0x00,
-                             buf, sizeof(buf), CTRL_TIMEOUT);
-       if (ret < 0) {
-               printk(KERN_WARNING "SpeedTouch: Failed to start ADSL synchronisation: %d\n", ret);
-               return ret;
-       }
-
-       dbg("speedtch_start_synchro: modem prodded. %d Bytes returned: %02x %02x", ret, buf[0], buf[1]);
-       return 0;
-}
-
-static void speedtch_handle_int(struct urb *urb, struct pt_regs *regs)
-{
-       struct speedtch_instance_data *instance = urb->context;
-       unsigned int count = urb->actual_length;
-       int ret;
-
-       /* The magic interrupt for "up state" */
-       const static unsigned char up_int[6]   = { 0xa1, 0x00, 0x01, 0x00, 0x00, 0x00 };
-       /* The magic interrupt for "down state" */
-       const static unsigned char down_int[6] = { 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00 };
-
-       switch (urb->status) {
-       case 0:
-               /* success */
-               break;
-       case -ECONNRESET:
-       case -ENOENT:
-       case -ESHUTDOWN:
-               /* this urb is terminated; clean up */
-               dbg("%s - urb shutting down with status: %d", __func__, urb->status);
-               return;
-       default:
-               dbg("%s - nonzero urb status received: %d", __func__, urb->status);
-               goto exit;
-       }
-
-       if (count < 6) {
-               dbg("%s - int packet too short", __func__);
-               goto exit;
-       }
-
-       if (!memcmp(up_int, instance->int_data, 6)) {
-               del_timer(&instance->poll_timer);
-               printk(KERN_NOTICE "DSL line goes up\n");
-       } else if (!memcmp(down_int, instance->int_data, 6)) {
-               printk(KERN_NOTICE "DSL line goes down\n");
-       } else {
-               int i;
-
-               printk(KERN_DEBUG "Unknown interrupt packet of %d bytes:", count);
-               for (i = 0; i < count; i++)
-                       printk(" %02x", instance->int_data[i]);
-               printk("\n");
-       }
-       schedule_work(&instance->poll_work);
-
- exit:
-       rmb();
-       if (!instance->int_urb)
-               return;
-
-       ret = usb_submit_urb(urb, GFP_ATOMIC);
-       if (ret)
-               err("%s - usb_submit_urb failed with result %d", __func__, ret);
-}
-
-static int speedtch_get_status(struct speedtch_instance_data *instance,
-                              unsigned char *buf)
-{
-       struct usb_device *dev = instance->u.usb_dev;
-       int ret;
-
-       memset(buf, 0, TOTAL);
-
-       ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                             0x12, 0xc0, 0x07, 0x00, buf + OFFSET_7, SIZE_7,
-                             CTRL_TIMEOUT);
-       if (ret < 0) {
-               dbg("MSG 7 failed");
-               return ret;
-       }
-
-       ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                             0x12, 0xc0, 0x0b, 0x00, buf + OFFSET_b, SIZE_b,
-                             CTRL_TIMEOUT);
-       if (ret < 0) {
-               dbg("MSG B failed");
-               return ret;
-       }
-
-       ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                             0x12, 0xc0, 0x0d, 0x00, buf + OFFSET_d, SIZE_d,
-                             CTRL_TIMEOUT);
-       if (ret < 0) {
-               dbg("MSG D failed");
-               return ret;
-       }
-
-       ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                             0x01, 0xc0, 0x0e, 0x00, buf + OFFSET_e, SIZE_e,
-                             CTRL_TIMEOUT);
-       if (ret < 0) {
-               dbg("MSG E failed");
-               return ret;
-       }
-
-       ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                             0x01, 0xc0, 0x0f, 0x00, buf + OFFSET_f, SIZE_f,
-                             CTRL_TIMEOUT);
-       if (ret < 0) {
-               dbg("MSG F failed");
-               return ret;
-       }
-
-       return 0;
+               usb_warn(usbatm, "%s failed on URB150: %d\n", __func__, ret);
 }
 
-static void speedtch_poll_status(struct speedtch_instance_data *instance)
-{
-       unsigned char buf[TOTAL];
-       int ret;
-
-       ret = speedtch_get_status(instance, buf);
-       if (ret) {
-               printk(KERN_WARNING
-                      "SpeedTouch: Error %d fetching device status\n", ret);
-               return;
-       }
-
-       dbg("Line state %02x", buf[OFFSET_7]);
-
-       switch (buf[OFFSET_7]) {
-       case 0:
-               if (instance->u.atm_dev->signal != ATM_PHY_SIG_LOST) {
-                       instance->u.atm_dev->signal = ATM_PHY_SIG_LOST;
-                       printk(KERN_NOTICE "ADSL line is down\n");
-                       /* It'll never resync again unless we ask it to... */
-                       speedtch_start_synchro(instance);
-               }
-               break;
-
-       case 0x08:
-               if (instance->u.atm_dev->signal != ATM_PHY_SIG_UNKNOWN) {
-                       instance->u.atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
-                       printk(KERN_NOTICE "ADSL line is blocked?\n");
-               }
-               break;
-
-       case 0x10:
-               if (instance->u.atm_dev->signal != ATM_PHY_SIG_LOST) {
-                       instance->u.atm_dev->signal = ATM_PHY_SIG_LOST;
-                       printk(KERN_NOTICE "ADSL line is synchronising\n");
-               }
-               break;
-
-       case 0x20:
-               if (instance->u.atm_dev->signal != ATM_PHY_SIG_FOUND) {
-                       int down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8)
-                               | (buf[OFFSET_b + 2] << 16) | (buf[OFFSET_b + 3] << 24);
-                       int up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8)
-                               | (buf[OFFSET_b + 6] << 16) | (buf[OFFSET_b + 7] << 24);
-
-                       if (!(down_speed & 0x0000ffff) &&
-                           !(up_speed & 0x0000ffff)) {
-                               down_speed >>= 16;
-                               up_speed >>= 16;
-                       }
-                       instance->u.atm_dev->link_rate = down_speed * 1000 / 424;
-                       instance->u.atm_dev->signal = ATM_PHY_SIG_FOUND;
-
-                       printk(KERN_NOTICE
-                              "ADSL line is up (%d Kib/s down | %d Kib/s up)\n",
-                              down_speed, up_speed);
-               }
-               break;
-
-       default:
-               if (instance->u.atm_dev->signal != ATM_PHY_SIG_UNKNOWN) {
-                       instance->u.atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
-                       printk(KERN_NOTICE "Unknown line state %02x\n", buf[OFFSET_7]);
-               }
-               break;
-       }
-}
-
-static void speedtch_timer_poll(unsigned long data)
-{
-       struct speedtch_instance_data *instance = (void *)data;
-
-       schedule_work(&instance->poll_work);
-       mod_timer(&instance->poll_timer, jiffies + (5 * HZ));
-}
-
-#ifdef USE_FW_LOADER
-static void speedtch_upload_firmware(struct speedtch_instance_data *instance,
+static int speedtch_upload_firmware(struct speedtch_instance_data *instance,
                                     const struct firmware *fw1,
                                     const struct firmware *fw2)
 {
        unsigned char *buffer;
-       struct usb_device *usb_dev = instance->u.usb_dev;
+       struct usbatm_data *usbatm = instance->usbatm;
        struct usb_interface *intf;
-       int actual_length, ret;
+       struct usb_device *usb_dev = usbatm->usb_dev;
+       int actual_length;
+       int ret = 0;
        int offset;
 
-       dbg("speedtch_upload_firmware");
-
-       if (!(intf = usb_ifnum_to_if(usb_dev, 2))) {
-               dbg("speedtch_upload_firmware: interface not found!");
-               goto fail;
-       }
+       usb_dbg(usbatm, "%s entered\n", __func__);
 
        if (!(buffer = (unsigned char *)__get_free_page(GFP_KERNEL))) {
-               dbg("speedtch_upload_firmware: no memory for buffer!");
-               goto fail;
+               ret = -ENOMEM;
+               usb_dbg(usbatm, "%s: no memory for buffer!\n", __func__);
+               goto out;
        }
 
-       /* A user-space firmware loader may already have claimed interface #2 */
-       if ((ret =
-            usb_driver_claim_interface(&speedtch_usb_driver, intf, NULL)) < 0) {
-               dbg("speedtch_upload_firmware: interface in use (%d)!", ret);
-               goto fail_free;
+       if (!(intf = usb_ifnum_to_if(usb_dev, 2))) {
+               ret = -ENODEV;
+               usb_dbg(usbatm, "%s: interface not found!\n", __func__);
+               goto out_free;
        }
 
        /* URB 7 */
        if (dl_512_first) {     /* some modems need a read before writing the firmware */
-               ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, SPEEDTCH_ENDPOINT_FIRMWARE),
+               ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
                                   buffer, 0x200, &actual_length, 2000);
 
                if (ret < 0 && ret != -ETIMEDOUT)
-                       dbg("speedtch_upload_firmware: read BLOCK0 from modem failed (%d)!", ret);
+                       usb_warn(usbatm, "%s: read BLOCK0 from modem failed (%d)!\n", __func__, ret);
                else
-                       dbg("speedtch_upload_firmware: BLOCK0 downloaded (%d bytes)", ret);
+                       usb_dbg(usbatm, "%s: BLOCK0 downloaded (%d bytes)\n", __func__, ret);
        }
 
        /* URB 8 : both leds are static green */
@@ -489,60 +230,65 @@ static void speedtch_upload_firmware(struct speedtch_instance_data *instance,
                int thislen = min_t(int, PAGE_SIZE, fw1->size - offset);
                memcpy(buffer, fw1->data + offset, thislen);
 
-               ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, SPEEDTCH_ENDPOINT_FIRMWARE),
+               ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
                                   buffer, thislen, &actual_length, DATA_TIMEOUT);
 
                if (ret < 0) {
-                       dbg("speedtch_upload_firmware: write BLOCK1 to modem failed (%d)!", ret);
-                       goto fail_release;
+                       usb_err(usbatm, "%s: write BLOCK1 to modem failed (%d)!\n", __func__, ret);
+                       goto out_free;
                }
-               dbg("speedtch_upload_firmware: BLOCK1 uploaded (%zu bytes)", fw1->size);
+               usb_dbg(usbatm, "%s: BLOCK1 uploaded (%zu bytes)\n", __func__, fw1->size);
        }
 
        /* USB led blinking green, ADSL led off */
 
        /* URB 11 */
-       ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, SPEEDTCH_ENDPOINT_FIRMWARE),
+       ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
                           buffer, 0x200, &actual_length, DATA_TIMEOUT);
 
        if (ret < 0) {
-               dbg("speedtch_upload_firmware: read BLOCK2 from modem failed (%d)!", ret);
-               goto fail_release;
+               usb_err(usbatm, "%s: read BLOCK2 from modem failed (%d)!\n", __func__, ret);
+               goto out_free;
        }
-       dbg("speedtch_upload_firmware: BLOCK2 downloaded (%d bytes)", actual_length);
+       usb_dbg(usbatm, "%s: BLOCK2 downloaded (%d bytes)\n", __func__, actual_length);
 
        /* URBs 12 to 139 - USB led blinking green, ADSL led off */
        for (offset = 0; offset < fw2->size; offset += PAGE_SIZE) {
                int thislen = min_t(int, PAGE_SIZE, fw2->size - offset);
                memcpy(buffer, fw2->data + offset, thislen);
 
-               ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, SPEEDTCH_ENDPOINT_FIRMWARE),
+               ret = usb_bulk_msg(usb_dev, usb_sndbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
                                   buffer, thislen, &actual_length, DATA_TIMEOUT);
 
                if (ret < 0) {
-                       dbg("speedtch_upload_firmware: write BLOCK3 to modem failed (%d)!", ret);
-                       goto fail_release;
+                       usb_err(usbatm, "%s: write BLOCK3 to modem failed (%d)!\n", __func__, ret);
+                       goto out_free;
                }
        }
-       dbg("speedtch_upload_firmware: BLOCK3 uploaded (%zu bytes)", fw2->size);
+       usb_dbg(usbatm, "%s: BLOCK3 uploaded (%zu bytes)\n", __func__, fw2->size);
 
        /* USB led static green, ADSL led static red */
 
        /* URB 142 */
-       ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, SPEEDTCH_ENDPOINT_FIRMWARE),
+       ret = usb_bulk_msg(usb_dev, usb_rcvbulkpipe(usb_dev, ENDPOINT_FIRMWARE),
                           buffer, 0x200, &actual_length, DATA_TIMEOUT);
 
        if (ret < 0) {
-               dbg("speedtch_upload_firmware: read BLOCK4 from modem failed (%d)!", ret);
-               goto fail_release;
+               usb_err(usbatm, "%s: read BLOCK4 from modem failed (%d)!\n", __func__, ret);
+               goto out_free;
        }
 
        /* success */
-       dbg("speedtch_upload_firmware: BLOCK4 downloaded (%d bytes)", actual_length);
+       usb_dbg(usbatm, "%s: BLOCK4 downloaded (%d bytes)\n", __func__, actual_length);
 
        /* Delay to allow firmware to start up. We can do this here
           because we're in our own kernel thread anyway. */
-       msleep(1000);
+       msleep_interruptible(1000);
+
+       if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) {
+               usb_err(usbatm, "%s: setting interface to %d failed (%d)!\n", __func__, instance->altsetting, ret);
+               goto out_free;
+       }
 
        /* Enable software buffering, if requested */
        if (sw_buffering)
@@ -551,291 +297,595 @@ static void speedtch_upload_firmware(struct speedtch_instance_data *instance,
        /* Magic spell; don't ask us what this does */
        speedtch_test_sequence(instance);
 
-       /* Start modem synchronisation */
-       if (speedtch_start_synchro(instance))
-               dbg("speedtch_start_synchro: failed");
-
-       speedtch_got_firmware(instance, 1);
+       ret = 0;
 
+out_free:
        free_page((unsigned long)buffer);
-       return;
-
- fail_release:
-       /* Only release interface #2 if uploading failed; we don't release it
-          we succeeded.  This prevents the userspace tools from trying to load
-          the firmware themselves */
-       usb_driver_release_interface(&speedtch_usb_driver, intf);
- fail_free:
-       free_page((unsigned long)buffer);
- fail:
-       speedtch_got_firmware(instance, 0);
+out:
+       return ret;
 }
 
-static int speedtch_find_firmware(struct speedtch_instance_data
-                                 *instance, int phase,
-                                 const struct firmware **fw_p)
+static int speedtch_find_firmware(struct usbatm_data *usbatm, struct usb_interface *intf,
+                                 int phase, const struct firmware **fw_p)
 {
-       char buf[24];
-       const u16 bcdDevice = le16_to_cpu(instance->u.usb_dev->descriptor.bcdDevice);
+       struct device *dev = &intf->dev;
+       const u16 bcdDevice = le16_to_cpu(interface_to_usbdev(intf)->descriptor.bcdDevice);
        const u8 major_revision = bcdDevice >> 8;
        const u8 minor_revision = bcdDevice & 0xff;
+       char buf[24];
 
        sprintf(buf, "speedtch-%d.bin.%x.%02x", phase, major_revision, minor_revision);
-       dbg("speedtch_find_firmware: looking for %s", buf);
+       usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf);
 
-       if (request_firmware(fw_p, buf, &instance->u.usb_dev->dev)) {
+       if (request_firmware(fw_p, buf, dev)) {
                sprintf(buf, "speedtch-%d.bin.%x", phase, major_revision);
-               dbg("speedtch_find_firmware: looking for %s", buf);
+               usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf);
 
-               if (request_firmware(fw_p, buf, &instance->u.usb_dev->dev)) {
+               if (request_firmware(fw_p, buf, dev)) {
                        sprintf(buf, "speedtch-%d.bin", phase);
-                       dbg("speedtch_find_firmware: looking for %s", buf);
+                       usb_dbg(usbatm, "%s: looking for %s\n", __func__, buf);
 
-                       if (request_firmware(fw_p, buf, &instance->u.usb_dev->dev)) {
-                               dev_warn(&instance->u.usb_dev->dev, "no stage %d firmware found!", phase);
+                       if (request_firmware(fw_p, buf, dev)) {
+                               usb_err(usbatm, "%s: no stage %d firmware found!\n", __func__, phase);
                                return -ENOENT;
                        }
                }
        }
 
-       dev_info(&instance->u.usb_dev->dev, "found stage %d firmware %s\n", phase, buf);
+       usb_info(usbatm, "found stage %d firmware %s\n", phase, buf);
 
        return 0;
 }
 
-static int speedtch_load_firmware(void *arg)
+static int speedtch_heavy_init(struct usbatm_data *usbatm, struct usb_interface *intf)
 {
        const struct firmware *fw1, *fw2;
-       struct speedtch_instance_data *instance = arg;
-
-       BUG_ON(!instance);
+       struct speedtch_instance_data *instance = usbatm->driver_data;
+       int ret;
 
-       daemonize("firmware/speedtch");
+       if ((ret = speedtch_find_firmware(usbatm, intf, 1, &fw1)) < 0)
+               return ret;
 
-       if (!speedtch_find_firmware(instance, 1, &fw1)) {
-               if (!speedtch_find_firmware(instance, 2, &fw2)) {
-                       speedtch_upload_firmware(instance, fw1, fw2);
-                       release_firmware(fw2);
-               }
+       if ((ret = speedtch_find_firmware(usbatm, intf, 2, &fw2)) < 0) {
                release_firmware(fw1);
+               return ret;
        }
 
-       /* In case we failed, set state back to NO_FIRMWARE so that
-          another later attempt may work. Otherwise, we never actually
-          manage to recover if, for example, the firmware is on /usr and
-          we look for it too early. */
-       speedtch_got_firmware(instance, 0);
+       if ((ret = speedtch_upload_firmware(instance, fw1, fw2)) < 0)
+               usb_err(usbatm, "%s: firmware upload failed (%d)!\n", __func__, ret);
 
-       module_put(THIS_MODULE);
-       udsl_put_instance(&instance->u);
-       return 0;
+       release_firmware(fw2);
+       release_firmware(fw1);
+
+       return ret;
 }
-#endif /* USE_FW_LOADER */
 
-static void speedtch_firmware_start(struct speedtch_instance_data *instance)
+
+/**********
+**  ATM  **
+**********/
+
+static int speedtch_read_status(struct speedtch_instance_data *instance)
 {
-#ifdef USE_FW_LOADER
+       struct usbatm_data *usbatm = instance->usbatm;
+       struct usb_device *usb_dev = usbatm->usb_dev;
+       unsigned char *buf = instance->scratch_buffer;
        int ret;
-#endif
 
-       dbg("speedtch_firmware_start");
+       memset(buf, 0, TOTAL);
 
-       down(&instance->u.serialize);   /* vs self, speedtch_got_firmware */
+       ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
+                             0x12, 0xc0, 0x07, 0x00, buf + OFFSET_7, SIZE_7,
+                             CTRL_TIMEOUT);
+       if (ret < 0) {
+               atm_dbg(usbatm, "%s: MSG 7 failed\n", __func__);
+               return ret;
+       }
 
-       if (instance->u.status >= UDSL_LOADING_FIRMWARE) {
-               up(&instance->u.serialize);
-               return;
+       ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
+                             0x12, 0xc0, 0x0b, 0x00, buf + OFFSET_b, SIZE_b,
+                             CTRL_TIMEOUT);
+       if (ret < 0) {
+               atm_dbg(usbatm, "%s: MSG B failed\n", __func__);
+               return ret;
+       }
+
+       ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
+                             0x12, 0xc0, 0x0d, 0x00, buf + OFFSET_d, SIZE_d,
+                             CTRL_TIMEOUT);
+       if (ret < 0) {
+               atm_dbg(usbatm, "%s: MSG D failed\n", __func__);
+               return ret;
+       }
+
+       ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
+                             0x01, 0xc0, 0x0e, 0x00, buf + OFFSET_e, SIZE_e,
+                             CTRL_TIMEOUT);
+       if (ret < 0) {
+               atm_dbg(usbatm, "%s: MSG E failed\n", __func__);
+               return ret;
+       }
+
+       ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
+                             0x01, 0xc0, 0x0f, 0x00, buf + OFFSET_f, SIZE_f,
+                             CTRL_TIMEOUT);
+       if (ret < 0) {
+               atm_dbg(usbatm, "%s: MSG F failed\n", __func__);
+               return ret;
        }
 
-       instance->u.status = UDSL_LOADING_FIRMWARE;
-       up(&instance->u.serialize);
+       return 0;
+}
 
-#ifdef USE_FW_LOADER
-       udsl_get_instance(&instance->u);
-       try_module_get(THIS_MODULE);
+static int speedtch_start_synchro(struct speedtch_instance_data *instance)
+{
+       struct usbatm_data *usbatm = instance->usbatm;
+       struct usb_device *usb_dev = usbatm->usb_dev;
+       unsigned char *buf = instance->scratch_buffer;
+       int ret;
 
-       ret = kernel_thread(speedtch_load_firmware, instance,
-                           CLONE_FS | CLONE_FILES);
+       atm_dbg(usbatm, "%s entered\n", __func__);
 
-       if (ret >= 0)
-               return;         /* OK */
+       memset(buf, 0, 2);
 
-       dbg("speedtch_firmware_start: kernel_thread failed (%d)!", ret);
+       ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
+                             0x12, 0xc0, 0x04, 0x00,
+                             buf, 2, CTRL_TIMEOUT);
 
-       module_put(THIS_MODULE);
-       udsl_put_instance(&instance->u);
-       /* Just pretend it never happened... hope modem_run happens */
-#endif                         /* USE_FW_LOADER */
+       if (ret < 0)
+               atm_warn(usbatm, "failed to start ADSL synchronisation: %d\n", ret);
+       else
+               atm_dbg(usbatm, "%s: modem prodded. %d bytes returned: %02x %02x\n",
+                       __func__, ret, buf[0], buf[1]);
 
-       speedtch_got_firmware(instance, 0);
+       return ret;
 }
 
-static int speedtch_firmware_wait(struct udsl_instance_data *instance)
+static void speedtch_check_status(struct speedtch_instance_data *instance)
 {
-       speedtch_firmware_start((void *)instance);
+       struct usbatm_data *usbatm = instance->usbatm;
+       struct atm_dev *atm_dev = usbatm->atm_dev;
+       unsigned char *buf = instance->scratch_buffer;
+       int down_speed, up_speed, ret;
+       unsigned char status;
+
+#ifdef VERBOSE_DEBUG
+       atm_dbg(usbatm, "%s entered\n", __func__);
+#endif
 
-       if (wait_event_interruptible(instance->firmware_waiters, instance->status != UDSL_LOADING_FIRMWARE) < 0)
-               return -ERESTARTSYS;
+       ret = speedtch_read_status(instance);
+       if (ret < 0) {
+               atm_warn(usbatm, "error %d fetching device status\n", ret);
+               instance->poll_delay = min(2 * instance->poll_delay, MAX_POLL_DELAY);
+               return;
+       }
 
-       return (instance->status == UDSL_LOADED_FIRMWARE) ? 0 : -EAGAIN;
-}
+       instance->poll_delay = max(instance->poll_delay / 2, MIN_POLL_DELAY);
 
-/**********
-**  USB  **
-**********/
+       status = buf[OFFSET_7];
 
-static int speedtch_usb_ioctl(struct usb_interface *intf, unsigned int code,
-                             void *user_data)
-{
-       struct speedtch_instance_data *instance = usb_get_intfdata(intf);
+       if ((status != instance->last_status) || !status) {
+               atm_dbg(usbatm, "%s: line state 0x%02x\n", __func__, status);
 
-       dbg("speedtch_usb_ioctl entered");
+               switch (status) {
+               case 0:
+                       atm_dev->signal = ATM_PHY_SIG_LOST;
+                       if (instance->last_status)
+                               atm_info(usbatm, "ADSL line is down\n");
+                       /* It may never resync again unless we ask it to... */
+                       ret = speedtch_start_synchro(instance);
+                       break;
 
-       if (!instance) {
-               dbg("speedtch_usb_ioctl: NULL instance!");
-               return -ENODEV;
-       }
+               case 0x08:
+                       atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+                       atm_info(usbatm, "ADSL line is blocked?\n");
+                       break;
 
-       switch (code) {
-       case UDSL_IOCTL_LINE_UP:
-               instance->u.atm_dev->signal = ATM_PHY_SIG_FOUND;
-               speedtch_got_firmware(instance, 1);
-               return (instance->u.status == UDSL_LOADED_FIRMWARE) ? 0 : -EIO;
-       case UDSL_IOCTL_LINE_DOWN:
-               instance->u.atm_dev->signal = ATM_PHY_SIG_LOST;
-               return 0;
-       default:
-               return -ENOTTY;
+               case 0x10:
+                       atm_dev->signal = ATM_PHY_SIG_LOST;
+                       atm_info(usbatm, "ADSL line is synchronising\n");
+                       break;
+
+               case 0x20:
+                       down_speed = buf[OFFSET_b] | (buf[OFFSET_b + 1] << 8)
+                               | (buf[OFFSET_b + 2] << 16) | (buf[OFFSET_b + 3] << 24);
+                       up_speed = buf[OFFSET_b + 4] | (buf[OFFSET_b + 5] << 8)
+                               | (buf[OFFSET_b + 6] << 16) | (buf[OFFSET_b + 7] << 24);
+
+                       if (!(down_speed & 0x0000ffff) && !(up_speed & 0x0000ffff)) {
+                               down_speed >>= 16;
+                               up_speed >>= 16;
+                       }
+
+                       atm_dev->link_rate = down_speed * 1000 / 424;
+                       atm_dev->signal = ATM_PHY_SIG_FOUND;
+
+                       atm_info(usbatm,
+                                "ADSL line is up (%d kb/s down | %d kb/s up)\n",
+                                down_speed, up_speed);
+                       break;
+
+               default:
+                       atm_dev->signal = ATM_PHY_SIG_UNKNOWN;
+                       atm_info(usbatm, "unknown line state %02x\n", status);
+                       break;
+               }
+
+               instance->last_status = status;
        }
 }
 
-static int speedtch_usb_probe(struct usb_interface *intf,
-                             const struct usb_device_id *id)
+static void speedtch_status_poll(unsigned long data)
 {
-       struct usb_device *dev = interface_to_usbdev(intf);
-       int ifnum = intf->altsetting->desc.bInterfaceNumber;
-       struct speedtch_instance_data *instance;
-       unsigned char mac_str[13];
-       int ret, i;
-       char buf7[SIZE_7];
+       struct speedtch_instance_data *instance = (void *)data;
 
-       dbg("speedtch_usb_probe: trying device with vendor=0x%x, product=0x%x, ifnum %d",
-           le16_to_cpu(dev->descriptor.idVendor),
-           le16_to_cpu(dev->descriptor.idProduct), ifnum);
+       schedule_work(&instance->status_checker);
 
-       if ((dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) || 
-           (ifnum != 1))
-               return -ENODEV;
+       /* The following check is racy, but the race is harmless */
+       if (instance->poll_delay < MAX_POLL_DELAY)
+               mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(instance->poll_delay));
+       else
+               atm_warn(instance->usbatm, "Too many failures - disabling line status polling\n");
+}
 
-       dbg("speedtch_usb_probe: device accepted");
+static void speedtch_resubmit_int(unsigned long data)
+{
+       struct speedtch_instance_data *instance = (void *)data;
+       struct urb *int_urb = instance->int_urb;
+       int ret;
 
-       /* instance init */
-       instance = kmalloc(sizeof(*instance), GFP_KERNEL);
-       if (!instance) {
-               dbg("speedtch_usb_probe: no memory for instance data!");
-               return -ENOMEM;
+       atm_dbg(instance->usbatm, "%s entered\n", __func__);
+
+       if (int_urb) {
+               ret = usb_submit_urb(int_urb, GFP_ATOMIC);
+               if (!ret)
+                       schedule_work(&instance->status_checker);
+               else {
+                       atm_dbg(instance->usbatm, "%s: usb_submit_urb failed with result %d\n", __func__, ret);
+                       mod_timer(&instance->resubmit_timer, jiffies + msecs_to_jiffies(RESUBMIT_DELAY));
+               }
        }
+}
 
-       memset(instance, 0, sizeof(struct speedtch_instance_data));
+static void speedtch_handle_int(struct urb *int_urb, struct pt_regs *regs)
+{
+       struct speedtch_instance_data *instance = int_urb->context;
+       struct usbatm_data *usbatm = instance->usbatm;
+       unsigned int count = int_urb->actual_length;
+       int ret = int_urb->status;
 
-       if ((ret = usb_set_interface(dev, 0, 0)) < 0)
-               goto fail;
+       /* The magic interrupt for "up state" */
+       static const unsigned char up_int[6]   = { 0xa1, 0x00, 0x01, 0x00, 0x00, 0x00 };
+       /* The magic interrupt for "down state" */
+       static const unsigned char down_int[6] = { 0xa1, 0x00, 0x00, 0x00, 0x00, 0x00 };
+
+       atm_dbg(usbatm, "%s entered\n", __func__);
 
-       if ((ret = usb_set_interface(dev, 2, 0)) < 0)
+       if (ret < 0) {
+               atm_dbg(usbatm, "%s: nonzero urb status %d!\n", __func__, ret);
                goto fail;
+       }
 
-       instance->u.data_endpoint = SPEEDTCH_ENDPOINT_DATA;
-       instance->u.firmware_wait = speedtch_firmware_wait;
-       instance->u.driver_name = speedtch_driver_name;
+       if ((count == 6) && !memcmp(up_int, instance->int_data, 6)) {
+               del_timer(&instance->status_checker.timer);
+               atm_info(usbatm, "DSL line goes up\n");
+       } else if ((count == 6) && !memcmp(down_int, instance->int_data, 6)) {
+               atm_info(usbatm, "DSL line goes down\n");
+       } else {
+               int i;
 
-       ret = udsl_instance_setup(dev, &instance->u);
-       if (ret)
+               atm_dbg(usbatm, "%s: unknown interrupt packet of length %d:", __func__, count);
+               for (i = 0; i < count; i++)
+                       printk(" %02x", instance->int_data[i]);
+               printk("\n");
                goto fail;
+       }
 
-       init_timer(&instance->poll_timer);
-       instance->poll_timer.function = speedtch_timer_poll;
-       instance->poll_timer.data = (unsigned long)instance;
+       if ((int_urb = instance->int_urb)) {
+               ret = usb_submit_urb(int_urb, GFP_ATOMIC);
+               schedule_work(&instance->status_checker);
+               if (ret < 0) {
+                       atm_dbg(usbatm, "%s: usb_submit_urb failed with result %d\n", __func__, ret);
+                       goto fail;
+               }
+       }
 
-       INIT_WORK(&instance->poll_work, (void *)speedtch_poll_status, instance);
+       return;
+
+fail:
+       if ((int_urb = instance->int_urb))
+               mod_timer(&instance->resubmit_timer, jiffies + msecs_to_jiffies(RESUBMIT_DELAY));
+}
+
+static int speedtch_atm_start(struct usbatm_data *usbatm, struct atm_dev *atm_dev)
+{
+       struct usb_device *usb_dev = usbatm->usb_dev;
+       struct speedtch_instance_data *instance = usbatm->driver_data;
+       int i, ret;
+       unsigned char mac_str[13];
 
-       /* set MAC address, it is stored in the serial number */
-       memset(instance->u.atm_dev->esi, 0, sizeof(instance->u.atm_dev->esi));
-       if (usb_string(dev, dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) {
+       atm_dbg(usbatm, "%s entered\n", __func__);
+
+       /* Set MAC address, it is stored in the serial number */
+       memset(atm_dev->esi, 0, sizeof(atm_dev->esi));
+       if (usb_string(usb_dev, usb_dev->descriptor.iSerialNumber, mac_str, sizeof(mac_str)) == 12) {
                for (i = 0; i < 6; i++)
-                       instance->u.atm_dev->esi[i] =
-                               (hex2int(mac_str[i * 2]) * 16) + (hex2int(mac_str[i * 2 + 1]));
+                       atm_dev->esi[i] = (hex2int(mac_str[i * 2]) * 16) + (hex2int(mac_str[i * 2 + 1]));
        }
 
-       /* First check whether the modem already seems to be alive */
-       ret = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0),
-                             0x12, 0xc0, 0x07, 0x00, buf7, SIZE_7, 500);
+       /* Start modem synchronisation */
+       ret = speedtch_start_synchro(instance);
 
-       if (ret == SIZE_7) {
-               dbg("firmware appears to be already loaded");
-               speedtch_got_firmware(instance, 1);
-               speedtch_poll_status(instance);
-       } else {
-               speedtch_firmware_start(instance);
+       /* Set up interrupt endpoint */
+       if (instance->int_urb) {
+               ret = usb_submit_urb(instance->int_urb, GFP_KERNEL);
+               if (ret < 0) {
+                       /* Doesn't matter; we'll poll anyway */
+                       atm_dbg(usbatm, "%s: submission of interrupt URB failed (%d)!\n", __func__, ret);
+                       usb_free_urb(instance->int_urb);
+                       instance->int_urb = NULL;
+               }
        }
 
-       usb_set_intfdata(intf, instance);
+       /* Start status polling */
+       mod_timer(&instance->status_checker.timer, jiffies + msecs_to_jiffies(1000));
 
        return 0;
+}
 
- fail:
-       kfree(instance);
+static void speedtch_atm_stop(struct usbatm_data *usbatm, struct atm_dev *atm_dev)
+{
+       struct speedtch_instance_data *instance = usbatm->driver_data;
+       struct urb *int_urb = instance->int_urb;
+
+       atm_dbg(usbatm, "%s entered\n", __func__);
+
+       del_timer_sync(&instance->status_checker.timer);
+
+       /*
+        * Since resubmit_timer and int_urb can schedule themselves and
+        * each other, shutting them down correctly takes some care
+        */
+       instance->int_urb = NULL; /* signal shutdown */
+       mb();
+       usb_kill_urb(int_urb);
+       del_timer_sync(&instance->resubmit_timer);
+       /*
+        * At this point, speedtch_handle_int and speedtch_resubmit_int
+        * can run or be running, but instance->int_urb == NULL means that
+        * they will not reschedule
+        */
+       usb_kill_urb(int_urb);
+       del_timer_sync(&instance->resubmit_timer);
+       usb_free_urb(int_urb);
 
-       return -ENOMEM;
+       flush_scheduled_work();
 }
 
-static void speedtch_usb_disconnect(struct usb_interface *intf)
+
+/**********
+**  USB  **
+**********/
+
+static struct usb_device_id speedtch_usb_ids[] = {
+       {USB_DEVICE(0x06b9, 0x4061)},
+       {}
+};
+
+MODULE_DEVICE_TABLE(usb, speedtch_usb_ids);
+
+static int speedtch_usb_probe(struct usb_interface *, const struct usb_device_id *);
+
+static struct usb_driver speedtch_usb_driver = {
+       .name           = speedtch_driver_name,
+       .probe          = speedtch_usb_probe,
+       .disconnect     = usbatm_usb_disconnect,
+       .id_table       = speedtch_usb_ids
+};
+
+static void speedtch_release_interfaces(struct usb_device *usb_dev, int num_interfaces) {
+       struct usb_interface *cur_intf;
+       int i;
+
+       for(i = 0; i < num_interfaces; i++)
+               if ((cur_intf = usb_ifnum_to_if(usb_dev, i))) {
+                       usb_set_intfdata(cur_intf, NULL);
+                       usb_driver_release_interface(&speedtch_usb_driver, cur_intf);
+               }
+}
+
+static int speedtch_bind(struct usbatm_data *usbatm,
+                        struct usb_interface *intf,
+                        const struct usb_device_id *id)
 {
-       struct speedtch_instance_data *instance = usb_get_intfdata(intf);
+       struct usb_device *usb_dev = interface_to_usbdev(intf);
+       struct usb_interface *cur_intf, *data_intf;
+       struct speedtch_instance_data *instance;
+       int ifnum = intf->altsetting->desc.bInterfaceNumber;
+       int num_interfaces = usb_dev->actconfig->desc.bNumInterfaces;
+       int i, ret;
+       int use_isoc;
+
+       usb_dbg(usbatm, "%s entered\n", __func__);
+
+       /* sanity checks */
+
+       if (usb_dev->descriptor.bDeviceClass != USB_CLASS_VENDOR_SPEC) {
+               usb_err(usbatm, "%s: wrong device class %d\n", __func__, usb_dev->descriptor.bDeviceClass);
+               return -ENODEV;
+       }
+
+       if (!(data_intf = usb_ifnum_to_if(usb_dev, INTERFACE_DATA))) {
+               usb_err(usbatm, "%s: data interface not found!\n", __func__);
+               return -ENODEV;
+       }
+
+       /* claim all interfaces */
+
+       for (i=0; i < num_interfaces; i++) {
+               cur_intf = usb_ifnum_to_if(usb_dev, i);
+
+               if ((i != ifnum) && cur_intf) {
+                       ret = usb_driver_claim_interface(&speedtch_usb_driver, cur_intf, usbatm);
+
+                       if (ret < 0) {
+                               usb_err(usbatm, "%s: failed to claim interface %2d (%d)!\n", __func__, i, ret);
+                               speedtch_release_interfaces(usb_dev, i);
+                               return ret;
+                       }
+               }
+       }
 
-       dbg("speedtch_usb_disconnect entered");
+       instance = kzalloc(sizeof(*instance), GFP_KERNEL);
 
        if (!instance) {
-               dbg("speedtch_usb_disconnect: NULL instance!");
-               return;
+               usb_err(usbatm, "%s: no memory for instance data!\n", __func__);
+               ret = -ENOMEM;
+               goto fail_release;
        }
 
-/*QQ need to handle disconnects on interface #2 while uploading firmware */
-/*QQ and what about interface #1? */
+       instance->usbatm = usbatm;
 
-       if (instance->int_urb) {
-               struct urb *int_urb = instance->int_urb;
-               instance->int_urb = NULL;
-               wmb();
-               usb_unlink_urb(int_urb);
-               usb_free_urb(int_urb);
+       /* altsetting and enable_isoc may change at any moment, so take a snapshot */
+       instance->altsetting = altsetting;
+       use_isoc = enable_isoc;
+
+       if (instance->altsetting)
+               if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, instance->altsetting)) < 0) {
+                       usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, instance->altsetting, ret);
+                       instance->altsetting = 0; /* fall back to default */
+               }
+
+       if (!instance->altsetting && use_isoc)
+               if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_ISOC_ALTSETTING)) < 0) {
+                       usb_dbg(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_ISOC_ALTSETTING, ret);
+                       use_isoc = 0; /* fall back to bulk */
+               }
+
+       if (use_isoc) {
+               const struct usb_host_interface *desc = data_intf->cur_altsetting;
+               const __u8 target_address = USB_DIR_IN | usbatm->driver->isoc_in;
+               int i;
+
+               use_isoc = 0; /* fall back to bulk if endpoint not found */
+
+               for (i=0; i<desc->desc.bNumEndpoints; i++) {
+                       const struct usb_endpoint_descriptor *endpoint_desc = &desc->endpoint[i].desc;
+
+                       if ((endpoint_desc->bEndpointAddress == target_address)) {
+                               use_isoc = (endpoint_desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
+                                       USB_ENDPOINT_XFER_ISOC;
+                               break;
+                       }
+               }
+
+               if (!use_isoc)
+                       usb_info(usbatm, "isochronous transfer not supported - using bulk\n");
        }
 
-       instance->int_data[0] = 1;
-       del_timer_sync(&instance->poll_timer);
-       wmb();
-       flush_scheduled_work();
+       if (!use_isoc && !instance->altsetting)
+               if ((ret = usb_set_interface(usb_dev, INTERFACE_DATA, DEFAULT_BULK_ALTSETTING)) < 0) {
+                       usb_err(usbatm, "%s: setting interface to %2d failed (%d)!\n", __func__, DEFAULT_BULK_ALTSETTING, ret);
+                       goto fail_free;
+               }
+
+       if (!instance->altsetting)
+               instance->altsetting = use_isoc ? DEFAULT_ISOC_ALTSETTING : DEFAULT_BULK_ALTSETTING;
+
+       usbatm->flags |= (use_isoc ? UDSL_USE_ISOC : 0);
+
+       INIT_WORK(&instance->status_checker, (void *)speedtch_check_status, instance);
+
+       instance->status_checker.timer.function = speedtch_status_poll;
+       instance->status_checker.timer.data = (unsigned long)instance;
+       instance->last_status = 0xff;
+       instance->poll_delay = MIN_POLL_DELAY;
 
-       udsl_instance_disconnect(&instance->u);
+       init_timer(&instance->resubmit_timer);
+       instance->resubmit_timer.function = speedtch_resubmit_int;
+       instance->resubmit_timer.data = (unsigned long)instance;
 
-       /* clean up */
-       usb_set_intfdata(intf, NULL);
-       udsl_put_instance(&instance->u);
+       instance->int_urb = usb_alloc_urb(0, GFP_KERNEL);
+
+       if (instance->int_urb)
+               usb_fill_int_urb(instance->int_urb, usb_dev,
+                                usb_rcvintpipe(usb_dev, ENDPOINT_INT),
+                                instance->int_data, sizeof(instance->int_data),
+                                speedtch_handle_int, instance, 50);
+       else
+               usb_dbg(usbatm, "%s: no memory for interrupt urb!\n", __func__);
+
+       /* check whether the modem already seems to be alive */
+       ret = usb_control_msg(usb_dev, usb_rcvctrlpipe(usb_dev, 0),
+                             0x12, 0xc0, 0x07, 0x00,
+                             instance->scratch_buffer + OFFSET_7, SIZE_7, 500);
+
+       usbatm->flags |= (ret == SIZE_7 ? UDSL_SKIP_HEAVY_INIT : 0);
+
+       usb_dbg(usbatm, "%s: firmware %s loaded\n", __func__, usbatm->flags & UDSL_SKIP_HEAVY_INIT ? "already" : "not");
+
+       if (!(usbatm->flags & UDSL_SKIP_HEAVY_INIT))
+               if ((ret = usb_reset_device(usb_dev)) < 0) {
+                       usb_err(usbatm, "%s: device reset failed (%d)!\n", __func__, ret);
+                       goto fail_free;
+               }
+
+        usbatm->driver_data = instance;
+
+       return 0;
+
+fail_free:
+       usb_free_urb(instance->int_urb);
+       kfree(instance);
+fail_release:
+       speedtch_release_interfaces(usb_dev, num_interfaces);
+       return ret;
 }
 
+static void speedtch_unbind(struct usbatm_data *usbatm, struct usb_interface *intf)
+{
+       struct usb_device *usb_dev = interface_to_usbdev(intf);
+       struct speedtch_instance_data *instance = usbatm->driver_data;
+
+       usb_dbg(usbatm, "%s entered\n", __func__);
+
+       speedtch_release_interfaces(usb_dev, usb_dev->actconfig->desc.bNumInterfaces);
+       usb_free_urb(instance->int_urb);
+       kfree(instance);
+}
+
+
 /***********
 **  init  **
 ***********/
 
+static struct usbatm_driver speedtch_usbatm_driver = {
+       .driver_name    = speedtch_driver_name,
+       .bind           = speedtch_bind,
+       .heavy_init     = speedtch_heavy_init,
+       .unbind         = speedtch_unbind,
+       .atm_start      = speedtch_atm_start,
+       .atm_stop       = speedtch_atm_stop,
+       .bulk_in        = ENDPOINT_BULK_DATA,
+       .bulk_out       = ENDPOINT_BULK_DATA,
+       .isoc_in        = ENDPOINT_ISOC_DATA
+};
+
+static int speedtch_usb_probe(struct usb_interface *intf, const struct usb_device_id *id)
+{
+       return usbatm_usb_probe(intf, id, &speedtch_usbatm_driver);
+}
+
 static int __init speedtch_usb_init(void)
 {
-       dbg("speedtch_usb_init: driver version " DRIVER_VERSION);
+       dbg("%s: driver version %s", __func__, DRIVER_VERSION);
 
        return usb_register(&speedtch_usb_driver);
 }
 
 static void __exit speedtch_usb_cleanup(void)
 {
-       dbg("speedtch_usb_cleanup entered");
+       dbg("%s", __func__);
 
        usb_deregister(&speedtch_usb_driver);
 }
index 657c560..2855534 100644 (file)
 #ifndef _AU1100LCD_H
 #define _AU1100LCD_H
 
+#include <asm/mach-au1x00/au1000.h>
+
+#define print_err(f, arg...) printk(KERN_ERR DRIVER_NAME ": " f "\n", ## arg)
+#define print_warn(f, arg...) printk(KERN_WARNING DRIVER_NAME ": " f "\n", ## arg)
+#define print_info(f, arg...) printk(KERN_INFO DRIVER_NAME ": " f "\n", ## arg)
+
+#if DEBUG
+#define print_dbg(f, arg...) printk(__FILE__ ": " f "\n", ## arg)
+#else
+#define print_dbg(f, arg...) do {} while (0)
+#endif
+
+#if defined(__BIG_ENDIAN)
+#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_11
+#else
+#define LCD_CONTROL_DEFAULT_PO LCD_CONTROL_PO_00
+#endif
+#define LCD_CONTROL_DEFAULT_SBPPF LCD_CONTROL_SBPPF_565
+
 /********************************************************************/
-#define uint32 unsigned long
-typedef volatile struct
-{
-       uint32  lcd_control;
-       uint32  lcd_intstatus;
-       uint32  lcd_intenable;
-       uint32  lcd_horztiming;
-       uint32  lcd_verttiming;
-       uint32  lcd_clkcontrol;
-       uint32  lcd_dmaaddr0;
-       uint32  lcd_dmaaddr1;
-       uint32  lcd_words;
-       uint32  lcd_pwmdiv;
-       uint32  lcd_pwmhi;
-       uint32  reserved[(0x0400-0x002C)/4];
-       uint32  lcd_pallettebase[256];
-
-} AU1100_LCD;
+
+/* LCD controller restrictions */
+#define AU1100_LCD_MAX_XRES    800
+#define AU1100_LCD_MAX_YRES    600
+#define AU1100_LCD_MAX_BPP     16
+#define AU1100_LCD_MAX_CLK     48000000
+#define AU1100_LCD_NBR_PALETTE_ENTRIES 256
+
+/* Default number of visible screen buffer to allocate */
+#define AU1100FB_NBR_VIDEO_BUFFERS 4
 
 /********************************************************************/
 
-#define AU1100_LCD_ADDR                0xB5000000
+struct au1100fb_panel
+{
+       const char name[25];            /* Full name <vendor>_<model> */
 
-/*
- * Register bit definitions
- */
+       u32     control_base;           /* Mode-independent control values */
+       u32     clkcontrol_base;        /* Panel pixclock preferences */
 
-/* lcd_control */
-#define LCD_CONTROL_SBPPF              (7<<18)
-#define LCD_CONTROL_SBPPF_655  (0<<18)
-#define LCD_CONTROL_SBPPF_565  (1<<18)
-#define LCD_CONTROL_SBPPF_556  (2<<18)
-#define LCD_CONTROL_SBPPF_1555 (3<<18)
-#define LCD_CONTROL_SBPPF_5551 (4<<18)
-#define LCD_CONTROL_WP                 (1<<17)
-#define LCD_CONTROL_WD                 (1<<16)
-#define LCD_CONTROL_C                  (1<<15)
-#define LCD_CONTROL_SM                 (3<<13)
-#define LCD_CONTROL_SM_0               (0<<13)
-#define LCD_CONTROL_SM_90              (1<<13)
-#define LCD_CONTROL_SM_180             (2<<13)
-#define LCD_CONTROL_SM_270             (3<<13)
-#define LCD_CONTROL_DB                 (1<<12)
-#define LCD_CONTROL_CCO                        (1<<11)
-#define LCD_CONTROL_DP                 (1<<10)
-#define LCD_CONTROL_PO                 (3<<8)
-#define LCD_CONTROL_PO_00              (0<<8)
-#define LCD_CONTROL_PO_01              (1<<8)
-#define LCD_CONTROL_PO_10              (2<<8)
-#define LCD_CONTROL_PO_11              (3<<8)
-#define LCD_CONTROL_MPI                        (1<<7)
-#define LCD_CONTROL_PT                 (1<<6)
-#define LCD_CONTROL_PC                 (1<<5)
-#define LCD_CONTROL_BPP                        (7<<1)
-#define LCD_CONTROL_BPP_1              (0<<1)
-#define LCD_CONTROL_BPP_2              (1<<1)
-#define LCD_CONTROL_BPP_4              (2<<1)
-#define LCD_CONTROL_BPP_8              (3<<1)
-#define LCD_CONTROL_BPP_12             (4<<1)
-#define LCD_CONTROL_BPP_16             (5<<1)
-#define LCD_CONTROL_GO                 (1<<0)
-
-/* lcd_intstatus, lcd_intenable */
-#define LCD_INT_SD                             (1<<7)
-#define LCD_INT_OF                             (1<<6)
-#define LCD_INT_UF                             (1<<5)
-#define LCD_INT_SA                             (1<<3)
-#define LCD_INT_SS                             (1<<2)
-#define LCD_INT_S1                             (1<<1)
-#define LCD_INT_S0                             (1<<0)
-
-/* lcd_horztiming */
-#define LCD_HORZTIMING_HN2             (255<<24)
-#define LCD_HORZTIMING_HN2_N(N)        (((N)-1)<<24)
-#define LCD_HORZTIMING_HN1             (255<<16)
-#define LCD_HORZTIMING_HN1_N(N)        (((N)-1)<<16)
-#define LCD_HORZTIMING_HPW             (63<<10)
-#define LCD_HORZTIMING_HPW_N(N)        (((N)-1)<<10)
-#define LCD_HORZTIMING_PPL             (1023<<0)
-#define LCD_HORZTIMING_PPL_N(N)        (((N)-1)<<0)
-
-/* lcd_verttiming */
-#define LCD_VERTTIMING_VN2             (255<<24)
-#define LCD_VERTTIMING_VN2_N(N)        (((N)-1)<<24)
-#define LCD_VERTTIMING_VN1             (255<<16)
-#define LCD_VERTTIMING_VN1_N(N)        (((N)-1)<<16)
-#define LCD_VERTTIMING_VPW             (63<<10)
-#define LCD_VERTTIMING_VPW_N(N)        (((N)-1)<<10)
-#define LCD_VERTTIMING_LPP             (1023<<0)
-#define LCD_VERTTIMING_LPP_N(N)        (((N)-1)<<0)
-
-/* lcd_clkcontrol */
-#define LCD_CLKCONTROL_IB              (1<<18)
-#define LCD_CLKCONTROL_IC              (1<<17)
-#define LCD_CLKCONTROL_IH              (1<<16)
-#define LCD_CLKCONTROL_IV              (1<<15)
-#define LCD_CLKCONTROL_BF              (31<<10)
-#define LCD_CLKCONTROL_BF_N(N) (((N)-1)<<10)
-#define LCD_CLKCONTROL_PCD             (1023<<0)
-#define LCD_CLKCONTROL_PCD_N(N)        ((N)<<0)
-
-/* lcd_pwmdiv */
-#define LCD_PWMDIV_EN                  (1<<12)
-#define LCD_PWMDIV_PWMDIV              (2047<<0)
-#define LCD_PWMDIV_PWMDIV_N(N) (((N)-1)<<0)
-
-/* lcd_pwmhi */
-#define LCD_PWMHI_PWMHI1               (2047<<12)
-#define LCD_PWMHI_PWMHI1_N(N)  ((N)<<12)
-#define LCD_PWMHI_PWMHI0               (2047<<0)
-#define LCD_PWMHI_PWMHI0_N(N)  ((N)<<0)
-
-/* lcd_pallettebase - MONOCHROME */
-#define LCD_PALLETTE_MONO_MI           (15<<0)
-#define LCD_PALLETTE_MONO_MI_N(N)      ((N)<<0)
-
-/* lcd_pallettebase - COLOR */
-#define LCD_PALLETTE_COLOR_BI          (15<<8)
-#define LCD_PALLETTE_COLOR_BI_N(N)     ((N)<<8)
-#define LCD_PALLETTE_COLOR_GI          (15<<4)
-#define LCD_PALLETTE_COLOR_GI_N(N)     ((N)<<4)
-#define LCD_PALLETTE_COLOR_RI          (15<<0)
-#define LCD_PALLETTE_COLOR_RI_N(N)     ((N)<<0)
-
-/* lcd_palletebase - COLOR TFT PALLETIZED */
-#define LCD_PALLETTE_TFT_DC                    (65535<<0)
-#define LCD_PALLETTE_TFT_DC_N(N)       ((N)<<0)
+       u32     horztiming;
+       u32     verttiming;
 
-/********************************************************************/
+       u32     xres;           /* Maximum horizontal resolution */
+       u32     yres;           /* Maximum vertical resolution */
+       u32     bpp;            /* Maximum depth supported */
+};
 
-struct known_lcd_panels
+struct au1100fb_regs
 {
-       uint32 xres;
-       uint32 yres;
-       uint32 bpp;
-       unsigned char  panel_name[256];
-       uint32 mode_control;
-       uint32 mode_horztiming;
-       uint32 mode_verttiming;
-       uint32 mode_clkcontrol;
-       uint32 mode_pwmdiv;
-       uint32 mode_pwmhi;
-       uint32 mode_toyclksrc;
-       uint32 mode_backlight;
+       u32  lcd_control;
+       u32  lcd_intstatus;
+       u32  lcd_intenable;
+       u32  lcd_horztiming;
+       u32  lcd_verttiming;
+       u32  lcd_clkcontrol;
+       u32  lcd_dmaaddr0;
+       u32  lcd_dmaaddr1;
+       u32  lcd_words;
+       u32  lcd_pwmdiv;
+       u32  lcd_pwmhi;
+       u32  reserved[(0x0400-0x002C)/4];
+       u32  lcd_pallettebase[256];
+};
+
+struct au1100fb_device {
+
+       struct fb_info info;                    /* FB driver info record */
 
+       struct au1100fb_panel   *panel;         /* Panel connected to this device */
+
+       struct au1100fb_regs*   regs;           /* Registers memory map */
+       size_t                  regs_len;
+       unsigned int            regs_phys;
+
+       unsigned char*          fb_mem;         /* FrameBuffer memory map */
+       size_t                  fb_len;
+       dma_addr_t              fb_phys;
 };
 
-#if defined(__BIG_ENDIAN)
-#define LCD_DEFAULT_PIX_FORMAT LCD_CONTROL_PO_11
-#else
-#define LCD_DEFAULT_PIX_FORMAT LCD_CONTROL_PO_00
-#endif
+/********************************************************************/
 
-/*
- * The fb driver assumes that AUX PLL is at 48MHz.  That can
- * cover up to 800x600 resolution; if you need higher resolution,
- * you should modify the driver as needed, not just this structure.
+#define LCD_CONTROL                (AU1100_LCD_BASE + 0x0)
+  #define LCD_CONTROL_SBB_BIT      21
+  #define LCD_CONTROL_SBB_MASK     (0x3 << LCD_CONTROL_SBB_BIT)
+    #define LCD_CONTROL_SBB_1        (0 << LCD_CONTROL_SBB_BIT)
+    #define LCD_CONTROL_SBB_2        (1 << LCD_CONTROL_SBB_BIT)
+    #define LCD_CONTROL_SBB_3        (2 << LCD_CONTROL_SBB_BIT)
+    #define LCD_CONTROL_SBB_4        (3 << LCD_CONTROL_SBB_BIT)
+  #define LCD_CONTROL_SBPPF_BIT    18
+  #define LCD_CONTROL_SBPPF_MASK   (0x7 << LCD_CONTROL_SBPPF_BIT)
+    #define LCD_CONTROL_SBPPF_655    (0 << LCD_CONTROL_SBPPF_BIT)
+    #define LCD_CONTROL_SBPPF_565    (1 << LCD_CONTROL_SBPPF_BIT)
+    #define LCD_CONTROL_SBPPF_556    (2 << LCD_CONTROL_SBPPF_BIT)
+    #define LCD_CONTROL_SBPPF_1555   (3 << LCD_CONTROL_SBPPF_BIT)
+    #define LCD_CONTROL_SBPPF_5551   (4 << LCD_CONTROL_SBPPF_BIT)
+  #define LCD_CONTROL_WP           (1<<17)
+  #define LCD_CONTROL_WD           (1<<16)
+  #define LCD_CONTROL_C            (1<<15)
+  #define LCD_CONTROL_SM_BIT       13
+  #define LCD_CONTROL_SM_MASK      (0x3 << LCD_CONTROL_SM_BIT)
+    #define LCD_CONTROL_SM_0         (0 << LCD_CONTROL_SM_BIT)
+    #define LCD_CONTROL_SM_90        (1 << LCD_CONTROL_SM_BIT)
+    #define LCD_CONTROL_SM_180       (2 << LCD_CONTROL_SM_BIT)
+    #define LCD_CONTROL_SM_270       (3 << LCD_CONTROL_SM_BIT)
+  #define LCD_CONTROL_DB           (1<<12)
+  #define LCD_CONTROL_CCO          (1<<11)
+  #define LCD_CONTROL_DP           (1<<10)
+  #define LCD_CONTROL_PO_BIT       8
+  #define LCD_CONTROL_PO_MASK      (0x3 << LCD_CONTROL_PO_BIT)
+    #define LCD_CONTROL_PO_00        (0 << LCD_CONTROL_PO_BIT)
+    #define LCD_CONTROL_PO_01        (1 << LCD_CONTROL_PO_BIT)
+    #define LCD_CONTROL_PO_10        (2 << LCD_CONTROL_PO_BIT)
+    #define LCD_CONTROL_PO_11        (3 << LCD_CONTROL_PO_BIT)
+  #define LCD_CONTROL_MPI          (1<<7)
+  #define LCD_CONTROL_PT           (1<<6)
+  #define LCD_CONTROL_PC           (1<<5)
+  #define LCD_CONTROL_BPP_BIT      1
+  #define LCD_CONTROL_BPP_MASK     (0x7 << LCD_CONTROL_BPP_BIT)
+    #define LCD_CONTROL_BPP_1        (0 << LCD_CONTROL_BPP_BIT)
+    #define LCD_CONTROL_BPP_2        (1 << LCD_CONTROL_BPP_BIT)
+    #define LCD_CONTROL_BPP_4        (2 << LCD_CONTROL_BPP_BIT)
+    #define LCD_CONTROL_BPP_8        (3 << LCD_CONTROL_BPP_BIT)
+    #define LCD_CONTROL_BPP_12       (4 << LCD_CONTROL_BPP_BIT)
+    #define LCD_CONTROL_BPP_16       (5 << LCD_CONTROL_BPP_BIT)
+  #define LCD_CONTROL_GO           (1<<0)
+
+#define LCD_INTSTATUS              (AU1100_LCD_BASE + 0x4)
+#define LCD_INTENABLE              (AU1100_LCD_BASE + 0x8)
+  #define LCD_INT_SD               (1<<7)
+  #define LCD_INT_OF               (1<<6)
+  #define LCD_INT_UF               (1<<5)
+  #define LCD_INT_SA               (1<<3)
+  #define LCD_INT_SS               (1<<2)
+  #define LCD_INT_S1               (1<<1)
+  #define LCD_INT_S0               (1<<0)
+
+#define LCD_HORZTIMING             (AU1100_LCD_BASE + 0xC)
+  #define LCD_HORZTIMING_HN2_BIT   24
+  #define LCD_HORZTIMING_HN2_MASK  (0xFF << LCD_HORZTIMING_HN2_BIT)
+  #define LCD_HORZTIMING_HN2_N(N)  ((((N)-1) << LCD_HORZTIMING_HN2_BIT) & LCD_HORZTIMING_HN2_MASK)
+  #define LCD_HORZTIMING_HN1_BIT   16
+  #define LCD_HORZTIMING_HN1_MASK  (0xFF << LCD_HORZTIMING_HN1_BIT)
+  #define LCD_HORZTIMING_HN1_N(N)  ((((N)-1) << LCD_HORZTIMING_HN1_BIT) & LCD_HORZTIMING_HN1_MASK)
+  #define LCD_HORZTIMING_HPW_BIT   10
+  #define LCD_HORZTIMING_HPW_MASK  (0x3F << LCD_HORZTIMING_HPW_BIT)
+  #define LCD_HORZTIMING_HPW_N(N)  ((((N)-1) << LCD_HORZTIMING_HPW_BIT) & LCD_HORZTIMING_HPW_MASK)
+  #define LCD_HORZTIMING_PPL_BIT   0
+  #define LCD_HORZTIMING_PPL_MASK  (0x3FF << LCD_HORZTIMING_PPL_BIT)
+  #define LCD_HORZTIMING_PPL_N(N)  ((((N)-1) << LCD_HORZTIMING_PPL_BIT) & LCD_HORZTIMING_PPL_MASK)
+
+#define LCD_VERTTIMING             (AU1100_LCD_BASE + 0x10)
+  #define LCD_VERTTIMING_VN2_BIT   24
+  #define LCD_VERTTIMING_VN2_MASK  (0xFF << LCD_VERTTIMING_VN2_BIT)
+  #define LCD_VERTTIMING_VN2_N(N)  ((((N)-1) << LCD_VERTTIMING_VN2_BIT) & LCD_VERTTIMING_VN2_MASK)
+  #define LCD_VERTTIMING_VN1_BIT   16
+  #define LCD_VERTTIMING_VN1_MASK  (0xFF << LCD_VERTTIMING_VN1_BIT)
+  #define LCD_VERTTIMING_VN1_N(N)  ((((N)-1) << LCD_VERTTIMING_VN1_BIT) & LCD_VERTTIMING_VN1_MASK)
+  #define LCD_VERTTIMING_VPW_BIT   10
+  #define LCD_VERTTIMING_VPW_MASK  (0x3F << LCD_VERTTIMING_VPW_BIT)
+  #define LCD_VERTTIMING_VPW_N(N)  ((((N)-1) << LCD_VERTTIMING_VPW_BIT) & LCD_VERTTIMING_VPW_MASK)
+  #define LCD_VERTTIMING_LPP_BIT   0
+  #define LCD_VERTTIMING_LPP_MASK  (0x3FF << LCD_VERTTIMING_LPP_BIT)
+  #define LCD_VERTTIMING_LPP_N(N)  ((((N)-1) << LCD_VERTTIMING_LPP_BIT) & LCD_VERTTIMING_LPP_MASK)
+
+#define LCD_CLKCONTROL             (AU1100_LCD_BASE + 0x14)
+  #define LCD_CLKCONTROL_IB        (1<<18)
+  #define LCD_CLKCONTROL_IC        (1<<17)
+  #define LCD_CLKCONTROL_IH        (1<<16)
+  #define LCD_CLKCONTROL_IV        (1<<15)
+  #define LCD_CLKCONTROL_BF_BIT    10
+  #define LCD_CLKCONTROL_BF_MASK   (0x1F << LCD_CLKCONTROL_BF_BIT)
+  #define LCD_CLKCONTROL_BF_N(N)   ((((N)-1) << LCD_CLKCONTROL_BF_BIT) & LCD_CLKCONTROL_BF_MASK)
+  #define LCD_CLKCONTROL_PCD_BIT   0
+  #define LCD_CLKCONTROL_PCD_MASK  (0x3FF << LCD_CLKCONTROL_PCD_BIT)
+  #define LCD_CLKCONTROL_PCD_N(N)  (((N) << LCD_CLKCONTROL_PCD_BIT) & LCD_CLKCONTROL_PCD_MASK)
+
+#define LCD_DMAADDR0               (AU1100_LCD_BASE + 0x18)
+#define LCD_DMAADDR1               (AU1100_LCD_BASE + 0x1C)
+  #define LCD_DMA_SA_BIT           5
+  #define LCD_DMA_SA_MASK          (0x7FFFFFF << LCD_DMA_SA_BIT)
+  #define LCD_DMA_SA_N(N)          ((N) & LCD_DMA_SA_MASK)
+
+#define LCD_WORDS                  (AU1100_LCD_BASE + 0x20)
+  #define LCD_WRD_WRDS_BIT         0
+  #define LCD_WRD_WRDS_MASK        (0xFFFFFFFF << LCD_WRD_WRDS_BIT)
+  #define LCD_WRD_WRDS_N(N)        ((((N)-1) << LCD_WRD_WRDS_BIT) & LCD_WRD_WRDS_MASK)
+
+#define LCD_PWMDIV                 (AU1100_LCD_BASE + 0x24)
+  #define LCD_PWMDIV_EN            (1<<12)
+  #define LCD_PWMDIV_PWMDIV_BIT    0
+  #define LCD_PWMDIV_PWMDIV_MASK   (0xFFF << LCD_PWMDIV_PWMDIV_BIT)
+  #define LCD_PWMDIV_PWMDIV_N(N)   ((((N)-1) << LCD_PWMDIV_PWMDIV_BIT) & LCD_PWMDIV_PWMDIV_MASK)
+
+#define LCD_PWMHI                  (AU1100_LCD_BASE + 0x28)
+  #define LCD_PWMHI_PWMHI1_BIT     12
+  #define LCD_PWMHI_PWMHI1_MASK    (0xFFF << LCD_PWMHI_PWMHI1_BIT)
+  #define LCD_PWMHI_PWMHI1_N(N)    (((N) << LCD_PWMHI_PWMHI1_BIT) & LCD_PWMHI_PWMHI1_MASK)
+  #define LCD_PWMHI_PWMHI0_BIT     0
+  #define LCD_PWMHI_PWMHI0_MASK    (0xFFF << LCD_PWMHI_PWMHI0_BIT)
+  #define LCD_PWMHI_PWMHI0_N(N)    (((N) << LCD_PWMHI_PWMHI0_BIT) & LCD_PWMHI_PWMHI0_MASK)
+
+#define LCD_PALLETTEBASE                (AU1100_LCD_BASE + 0x400)
+  #define LCD_PALLETTE_MONO_MI_BIT      0
+  #define LCD_PALLETTE_MONO_MI_MASK     (0xF << LCD_PALLETTE_MONO_MI_BIT)
+  #define LCD_PALLETTE_MONO_MI_N(N)     (((N)<< LCD_PALLETTE_MONO_MI_BIT) & LCD_PALLETTE_MONO_MI_MASK)
+
+  #define LCD_PALLETTE_COLOR_RI_BIT     8
+  #define LCD_PALLETTE_COLOR_RI_MASK    (0xF << LCD_PALLETTE_COLOR_RI_BIT)
+  #define LCD_PALLETTE_COLOR_RI_N(N)    (((N)<< LCD_PALLETTE_COLOR_RI_BIT) & LCD_PALLETTE_COLOR_RI_MASK)
+  #define LCD_PALLETTE_COLOR_GI_BIT     4
+  #define LCD_PALLETTE_COLOR_GI_MASK    (0xF << LCD_PALLETTE_COLOR_GI_BIT)
+  #define LCD_PALLETTE_COLOR_GI_N(N)    (((N)<< LCD_PALLETTE_COLOR_GI_BIT) & LCD_PALLETTE_COLOR_GI_MASK)
+  #define LCD_PALLETTE_COLOR_BI_BIT     0
+  #define LCD_PALLETTE_COLOR_BI_MASK    (0xF << LCD_PALLETTE_COLOR_BI_BIT)
+  #define LCD_PALLETTE_COLOR_BI_N(N)    (((N)<< LCD_PALLETTE_COLOR_BI_BIT) & LCD_PALLETTE_COLOR_BI_MASK)
+
+  #define LCD_PALLETTE_TFT_DC_BIT       0
+  #define LCD_PALLETTE_TFT_DC_MASK      (0xFFFF << LCD_PALLETTE_TFT_DC_BIT)
+  #define LCD_PALLETTE_TFT_DC_N(N)      (((N)<< LCD_PALLETTE_TFT_DC_BIT) & LCD_PALLETTE_TFT_DC_MASK)
+
+/********************************************************************/
+
+/* List of panels known to work with the AU1100 LCD controller.
+ * To add a new panel, enter the same specifications as the
+ * Generic_TFT one, and MAKE SURE that it doesn't conflicts
+ * with the controller restrictions. Restrictions are:
+ *
+ * STN color panels: max_bpp <= 12
+ * STN mono panels: max_bpp <= 4
+ * TFT panels: max_bpp <= 16
+ * max_xres <= 800
+ * max_yres <= 600
  */
-struct known_lcd_panels panels[] =
+static struct au1100fb_panel known_lcd_panels[] =
 {
-       { /* 0: Pb1100 LCDA: Sharp 320x240 TFT panel */
-               320, /* xres */
-               240, /* yres */
-               16,  /* bpp  */
-
-               "Sharp_320x240_16",
-               /* mode_control */
+       /* 800x600x16bpp CRT */
+       [0] = {
+               .name = "CRT_800x600_16",
+               .xres = 800,
+               .yres = 600,
+               .bpp = 16,
+               .control_base = 0x0004886A |
+                       LCD_CONTROL_DEFAULT_PO | LCD_CONTROL_DEFAULT_SBPPF |
+                       LCD_CONTROL_BPP_16,
+               .clkcontrol_base = 0x00020000,
+               .horztiming = 0x005aff1f,
+               .verttiming = 0x16000e57,
+       },
+       /* just the standard LCD */
+       [1] = {
+               .name = "WWPC LCD",
+               .xres = 240,
+               .yres = 320,
+               .bpp = 16,
+               .control_base = 0x0006806A,
+               .horztiming = 0x0A1010EF,
+               .verttiming = 0x0301013F,
+               .clkcontrol_base = 0x00018001,
+       },
+       /* Sharp 320x240 TFT panel */
+       [2] = {
+               .name = "Sharp_LQ038Q5DR01",
+               .xres = 320,
+               .yres = 240,
+               .bpp = 16,
+               .control_base =
                ( LCD_CONTROL_SBPPF_565
-               /*LCD_CONTROL_WP*/
-               /*LCD_CONTROL_WD*/
                | LCD_CONTROL_C
                | LCD_CONTROL_SM_0
-               /*LCD_CONTROL_DB*/
-               /*LCD_CONTROL_CCO*/
-               /*LCD_CONTROL_DP*/
-               | LCD_DEFAULT_PIX_FORMAT
-               /*LCD_CONTROL_MPI*/
+                       | LCD_CONTROL_DEFAULT_PO
                | LCD_CONTROL_PT
                | LCD_CONTROL_PC
                | LCD_CONTROL_BPP_16 ),
-
-               /* mode_horztiming */
+               .horztiming =
                ( LCD_HORZTIMING_HN2_N(8)
                | LCD_HORZTIMING_HN1_N(60)
                | LCD_HORZTIMING_HPW_N(12)
                | LCD_HORZTIMING_PPL_N(320) ),
-
-               /* mode_verttiming */
+               .verttiming =
                ( LCD_VERTTIMING_VN2_N(5)
                | LCD_VERTTIMING_VN1_N(17)
                | LCD_VERTTIMING_VPW_N(1)
                | LCD_VERTTIMING_LPP_N(240) ),
-
-               /* mode_clkcontrol */
-               ( 0
-               /*LCD_CLKCONTROL_IB*/
-               /*LCD_CLKCONTROL_IC*/
-               /*LCD_CLKCONTROL_IH*/
-               /*LCD_CLKCONTROL_IV*/
-               | LCD_CLKCONTROL_PCD_N(1) ),
-
-               /* mode_pwmdiv */
-               0,
-
-               /* mode_pwmhi */
-               0,
-
-               /* mode_toyclksrc */
-               ((1<<7) | (1<<6) | (1<<5)),
-
-               /* mode_backlight */
-               6
+               .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1),
        },
 
-       { /* 1: Pb1100 LCDC 640x480 TFT panel */
-               640, /* xres */
-               480, /* yres */
-               16,  /* bpp  */
-
-               "Generic_640x480_16",
-
-               /* mode_control */
-               0x004806a | LCD_DEFAULT_PIX_FORMAT,
-
-               /* mode_horztiming */
-               0x3434d67f,
-
-               /* mode_verttiming */
-               0x0e0e39df,
-
-               /* mode_clkcontrol */
-               ( 0
-               /*LCD_CLKCONTROL_IB*/
-               /*LCD_CLKCONTROL_IC*/
-               /*LCD_CLKCONTROL_IH*/
-               /*LCD_CLKCONTROL_IV*/
-               | LCD_CLKCONTROL_PCD_N(1) ),
-
-               /* mode_pwmdiv */
-               0,
-
-               /* mode_pwmhi */
-               0,
-
-               /* mode_toyclksrc */
-               ((1<<7) | (1<<6) | (0<<5)),
-
-               /* mode_backlight */
-               7
+       /* Hitachi SP14Q005 and possibly others */
+       [3] = {
+               .name = "Hitachi_SP14Qxxx",
+               .xres = 320,
+               .yres = 240,
+               .bpp = 4,
+               .control_base =
+                       ( LCD_CONTROL_C
+                       | LCD_CONTROL_BPP_4 ),
+               .horztiming =
+                       ( LCD_HORZTIMING_HN2_N(1)
+                       | LCD_HORZTIMING_HN1_N(1)
+                       | LCD_HORZTIMING_HPW_N(1)
+                       | LCD_HORZTIMING_PPL_N(320) ),
+               .verttiming =
+                       ( LCD_VERTTIMING_VN2_N(1)
+                       | LCD_VERTTIMING_VN1_N(1)
+                       | LCD_VERTTIMING_VPW_N(1)
+                       | LCD_VERTTIMING_LPP_N(240) ),
+               .clkcontrol_base = LCD_CLKCONTROL_PCD_N(4),
        },
 
-       { /* 2: Pb1100 LCDB 640x480 PrimeView TFT panel */
-               640, /* xres */
-               480, /* yres */
-               16,  /* bpp  */
-
-               "PrimeView_640x480_16",
-
-               /* mode_control */
-               0x0004886a | LCD_DEFAULT_PIX_FORMAT,
-
-               /* mode_horztiming */
-               0x0e4bfe7f,
-
-               /* mode_verttiming */
-               0x210805df,
-
-               /* mode_clkcontrol */
-               0x00038001,
-
-               /* mode_pwmdiv */
-               0,
-
-               /* mode_pwmhi */
-               0,
-
-               /* mode_toyclksrc */
-               ((1<<7) | (1<<6) | (0<<5)),
-
-               /* mode_backlight */
-               7
+       /* Generic 640x480 TFT panel */
+       [4] = {
+               .name = "TFT_640x480_16",
+               .xres = 640,
+               .yres = 480,
+               .bpp = 16,
+               .control_base = 0x004806a | LCD_CONTROL_DEFAULT_PO,
+               .horztiming = 0x3434d67f,
+               .verttiming = 0x0e0e39df,
+               .clkcontrol_base = LCD_CLKCONTROL_PCD_N(1),
        },
 
-       { /* 3: Pb1100 800x600x16bpp NEON CRT */
-               800, /* xres */
-               600, /* yres */
-               16,  /* bpp */
-
-               "NEON_800x600_16",
-
-               /* mode_control */
-               0x0004886A | LCD_DEFAULT_PIX_FORMAT,
-
-               /* mode_horztiming */
-               0x005AFF1F,
-
-               /* mode_verttiming */
-               0x16000E57,
-
-               /* mode_clkcontrol */
-               0x00020000,
-
-               /* mode_pwmdiv */
-               0,
-
-               /* mode_pwmhi */
-               0,
-
-               /* mode_toyclksrc */
-               ((1<<7) | (1<<6) | (0<<5)),
-
-               /* mode_backlight */
-               7
+        /* Pb1100 LCDB 640x480 PrimeView TFT panel */
+       [5] = {
+               .name = "PrimeView_640x480_16",
+               .xres = 640,
+               .yres = 480,
+               .bpp = 16,
+               .control_base = 0x0004886a | LCD_CONTROL_DEFAULT_PO,
+               .horztiming = 0x0e4bfe7f,
+               .verttiming = 0x210805df,
+               .clkcontrol_base = 0x00038001,
        },
+};
 
-       { /* 4: Pb1100 640x480x16bpp NEON CRT */
-               640, /* xres */
-               480, /* yres */
-               16,  /* bpp */
-
-               "NEON_640x480_16",
-
-               /* mode_control */
-               0x0004886A | LCD_DEFAULT_PIX_FORMAT,
-
-               /* mode_horztiming */
-               0x0052E27F,
-
-               /* mode_verttiming */
-               0x18000DDF,
-
-               /* mode_clkcontrol */
-               0x00020000,
+struct au1100fb_drv_info {
+       int     panel_idx;
+       char    *opt_mode;
+};
 
-               /* mode_pwmdiv */
-               0,
+/********************************************************************/
 
-               /* mode_pwmhi */
-               0,
+/* Inline helpers */
 
-               /* mode_toyclksrc */
-               ((1<<7) | (1<<6) | (0<<5)),
+#define panel_is_dual(panel)  (panel->control_base & LCD_CONTROL_DP)
+#define panel_is_active(panel)(panel->control_base & LCD_CONTROL_PT)
+#define panel_is_color(panel) (panel->control_base & LCD_CONTROL_PC)
+#define panel_swap_rgb(panel) (panel->control_base & LCD_CONTROL_CCO)
 
-               /* mode_backlight */
-               7
-       },
-};
 #endif /* _AU1100LCD_H */
index acc81cb..27597c5 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/device.h>
 #include <linux/ctype.h>
 #include <linux/err.h>
 #include <linux/fb.h>
-#include <asm/bug.h>
 
 static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
 {
-       int rc;
+       int rc = -ENXIO;
        struct backlight_device *bd = to_backlight_device(cdev);
 
        down(&bd->sem);
-       if (likely(bd->props && bd->props->get_power))
-               rc = sprintf(buf, "%d\n", bd->props->get_power(bd));
-       else
-               rc = -ENXIO;
+       if (likely(bd->props))
+               rc = sprintf(buf, "%d\n", bd->props->power);
        up(&bd->sem);
 
        return rc;
@@ -33,21 +29,25 @@ static ssize_t backlight_show_power(struct class_device *cdev, char *buf)
 
 static ssize_t backlight_store_power(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc, power;
+       int rc = -ENXIO;
        char *endp;
        struct backlight_device *bd = to_backlight_device(cdev);
+       int power = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       power = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&bd->sem);
-       if (likely(bd->props && bd->props->set_power)) {
+       if (likely(bd->props)) {
                pr_debug("backlight: set power to %d\n", power);
-               bd->props->set_power(bd, power);
+               bd->props->power = power;
+               if (likely(bd->props->update_status))
+                       bd->props->update_status(bd);
                rc = count;
-       } else
-               rc = -ENXIO;
+       }
        up(&bd->sem);
 
        return rc;
@@ -55,14 +55,12 @@ static ssize_t backlight_store_power(struct class_device *cdev, const char *buf,
 
 static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf)
 {
-       int rc;
+       int rc = -ENXIO;
        struct backlight_device *bd = to_backlight_device(cdev);
 
        down(&bd->sem);
-       if (likely(bd->props && bd->props->get_brightness))
-               rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd));
-       else
-               rc = -ENXIO;
+       if (likely(bd->props))
+               rc = sprintf(buf, "%d\n", bd->props->brightness);
        up(&bd->sem);
 
        return rc;
@@ -70,21 +68,30 @@ static ssize_t backlight_show_brightness(struct class_device *cdev, char *buf)
 
 static ssize_t backlight_store_brightness(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc, brightness;
+       int rc = -ENXIO;
        char *endp;
        struct backlight_device *bd = to_backlight_device(cdev);
+       int brightness = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       brightness = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&bd->sem);
-       if (likely(bd->props && bd->props->set_brightness)) {
-               pr_debug("backlight: set brightness to %d\n", brightness);
-               bd->props->set_brightness(bd, brightness);
-               rc = count;
-       } else
-               rc = -ENXIO;
+       if (likely(bd->props)) {
+               if (brightness > bd->props->max_brightness)
+                       rc = -EINVAL;
+               else {
+                       pr_debug("backlight: set brightness to %d\n",
+                                brightness);
+                       bd->props->brightness = brightness;
+                       if (likely(bd->props->update_status))
+                               bd->props->update_status(bd);
+                       rc = count;
+               }
+       }
        up(&bd->sem);
 
        return rc;
@@ -92,14 +99,26 @@ static ssize_t backlight_store_brightness(struct class_device *cdev, const char
 
 static ssize_t backlight_show_max_brightness(struct class_device *cdev, char *buf)
 {
-       int rc;
+       int rc = -ENXIO;
        struct backlight_device *bd = to_backlight_device(cdev);
 
        down(&bd->sem);
        if (likely(bd->props))
                rc = sprintf(buf, "%d\n", bd->props->max_brightness);
-       else
-               rc = -ENXIO;
+       up(&bd->sem);
+
+       return rc;
+}
+
+static ssize_t backlight_show_actual_brightness(struct class_device *cdev,
+                                               char *buf)
+{
+       int rc = -ENXIO;
+       struct backlight_device *bd = to_backlight_device(cdev);
+
+       down(&bd->sem);
+       if (likely(bd->props && bd->props->get_brightness))
+               rc = sprintf(buf, "%d\n", bd->props->get_brightness(bd));
        up(&bd->sem);
 
        return rc;
@@ -125,7 +144,10 @@ static struct class backlight_class = {
 
 static struct class_device_attribute bl_class_device_attributes[] = {
        DECLARE_ATTR(power, 0644, backlight_show_power, backlight_store_power),
-       DECLARE_ATTR(brightness, 0644, backlight_show_brightness, backlight_store_brightness),
+       DECLARE_ATTR(brightness, 0644, backlight_show_brightness,
+                    backlight_store_brightness),
+       DECLARE_ATTR(actual_brightness, 0444, backlight_show_actual_brightness,
+                    NULL),
        DECLARE_ATTR(max_brightness, 0444, backlight_show_max_brightness, NULL),
 };
 
@@ -146,8 +168,12 @@ static int fb_notifier_callback(struct notifier_block *self,
        bd = container_of(self, struct backlight_device, fb_notif);
        down(&bd->sem);
        if (bd->props)
-               if (!bd->props->check_fb || bd->props->check_fb(evdata->info))
-                       bd->props->set_power(bd, *(int *)evdata->data);
+               if (!bd->props->check_fb ||
+                   bd->props->check_fb(evdata->info)) {
+                       bd->props->fb_blank = *(int *)evdata->data;
+                       if (likely(bd->props && bd->props->update_status))
+                               bd->props->update_status(bd);
+               }
        up(&bd->sem);
        return 0;
 }
@@ -174,7 +200,7 @@ struct backlight_device *backlight_device_register(const char *name, void *devda
 
        new_bd = kmalloc(sizeof(struct backlight_device), GFP_KERNEL);
        if (unlikely(!new_bd))
-               return ERR_PTR(ENOMEM);
+               return ERR_PTR(-ENOMEM);
 
        init_MUTEX(&new_bd->sem);
        new_bd->props = bp;
@@ -233,6 +259,12 @@ void backlight_device_unregister(struct backlight_device *bd)
                                         &bl_class_device_attributes[i]);
 
        down(&bd->sem);
+       if (likely(bd->props && bd->props->update_status)) {
+               bd->props->brightness = 0;
+               bd->props->power = 0;
+               bd->props->update_status(bd);
+       }
+
        bd->props = NULL;
        up(&bd->sem);
 
index 353cb3f..2ebbfd9 100644 (file)
@@ -1,7 +1,7 @@
 /*
- *  Backlight Driver for Sharp Corgi
+ *  Backlight Driver for Sharp Zaurus Handhelds (various models)
  *
- *  Copyright (c) 2004-2005 Richard Purdie
+ *  Copyright (c) 2004-2006 Richard Purdie
  *
  *  Based on Sharp's 2.4 Backlight Driver
  *
 #include <linux/module.h>
 #include <linux/kernel.h>
 #include <linux/init.h>
-#include <linux/device.h>
-#include <linux/spinlock.h>
+#include <linux/platform_device.h>
+#include <linux/mutex.h>
 #include <linux/fb.h>
 #include <linux/backlight.h>
+#include <asm/arch/sharpsl.h>
+#include <asm/hardware/sharpsl_pm.h>
 
-#include <asm/arch-pxa/corgi.h>
-#include <asm/hardware/scoop.h>
-
-#define CORGI_MAX_INTENSITY            0x3e
-#define CORGI_DEFAULT_INTENSITY                0x1f
-#define CORGI_LIMIT_MASK                       0x0b
+static int corgibl_intensity;
+static DEFINE_MUTEX(bl_mutex);
+static struct backlight_properties corgibl_data;
+static struct backlight_device *corgi_backlight_device;
+static struct corgibl_machinfo *bl_machinfo;
 
-static int corgibl_powermode = FB_BLANK_UNBLANK;
-static int current_intensity = 0;
-static int corgibl_limit = 0;
-static spinlock_t bl_lock = SPIN_LOCK_UNLOCKED;
+static unsigned long corgibl_flags;
+#define CORGIBL_SUSPENDED     0x01
+#define CORGIBL_BATTLOW       0x02
 
-static void corgibl_send_intensity(int intensity)
+static int corgibl_send_intensity(struct backlight_device *bd)
 {
-       unsigned long flags;
        void (*corgi_kick_batt)(void);
+       int intensity = bd->props->brightness;
 
-       if (corgibl_powermode != FB_BLANK_UNBLANK) {
+       if (bd->props->power != FB_BLANK_UNBLANK)
                intensity = 0;
-       } else {
-               if (corgibl_limit)
-                       intensity &= CORGI_LIMIT_MASK;
-       }
-
-       /* Skip 0x20 as it will blank the display */
-       if (intensity >= 0x20)
-               intensity++;
-
-       spin_lock_irqsave(&bl_lock, flags);
-       /* Bits 0-4 are accessed via the SSP interface */
-       corgi_ssp_blduty_set(intensity & 0x1f);
-       /* Bit 5 is via SCOOP */
-       if (intensity & 0x0020)
-               set_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
-       else
-               reset_scoop_gpio(&corgiscoop_device.dev, CORGI_SCP_BACKLIGHT_CONT);
-       spin_unlock_irqrestore(&bl_lock, flags);
-}
+       if (bd->props->fb_blank != FB_BLANK_UNBLANK)
+               intensity = 0;
+       if (corgibl_flags & CORGIBL_SUSPENDED)
+               intensity = 0;
+       if (corgibl_flags & CORGIBL_BATTLOW)
+               intensity &= bl_machinfo->limit_mask;
 
-static void corgibl_blank(int blank)
-{
-       switch(blank) {
-
-       case FB_BLANK_NORMAL:
-       case FB_BLANK_VSYNC_SUSPEND:
-       case FB_BLANK_HSYNC_SUSPEND:
-       case FB_BLANK_POWERDOWN:
-               if (corgibl_powermode == FB_BLANK_UNBLANK) {
-                       corgibl_send_intensity(0);
-                       corgibl_powermode = blank;
-               }
-               break;
-       case FB_BLANK_UNBLANK:
-               if (corgibl_powermode != FB_BLANK_UNBLANK) {
-                       corgibl_powermode = blank;
-                       corgibl_send_intensity(current_intensity);
-               }
-               break;
-       }
+       mutex_lock(&bl_mutex);
+       bl_machinfo->set_bl_intensity(intensity);
+       mutex_unlock(&bl_mutex);
+
+       corgibl_intensity = intensity;
+
+       corgi_kick_batt = symbol_get(sharpsl_battery_kick);
+       if (corgi_kick_batt) {
+               corgi_kick_batt();
+               symbol_put(sharpsl_battery_kick);
+       }
+
+       return 0;
 }
 
 #ifdef CONFIG_PM
-static int corgibl_suspend(struct device *dev, pm_message_t state, u32 level)
+static int corgibl_suspend(struct platform_device *dev, pm_message_t state)
 {
-       if (level == SUSPEND_POWER_DOWN)
-               corgibl_blank(FB_BLANK_POWERDOWN);
+       corgibl_flags |= CORGIBL_SUSPENDED;
+       corgibl_send_intensity(corgi_backlight_device);
        return 0;
 }
 
-static int corgibl_resume(struct device *dev, u32 level)
+static int corgibl_resume(struct platform_device *dev)
 {
-       if (level == RESUME_POWER_ON)
-               corgibl_blank(FB_BLANK_UNBLANK);
+       corgibl_flags &= ~CORGIBL_SUSPENDED;
+       corgibl_send_intensity(corgi_backlight_device);
        return 0;
 }
 #else
@@ -99,95 +79,86 @@ static int corgibl_resume(struct device *dev, u32 level)
 #define corgibl_resume NULL
 #endif
 
-
-static int corgibl_set_power(struct backlight_device *bd, int state)
-{
-       corgibl_blank(state);
-       return 0;
-}
-
-static int corgibl_get_power(struct backlight_device *bd)
+static int corgibl_get_intensity(struct backlight_device *bd)
 {
-       return corgibl_powermode;
+       return corgibl_intensity;
 }
 
-static int corgibl_set_intensity(struct backlight_device *bd, int intensity)
+static int corgibl_set_intensity(struct backlight_device *bd)
 {
-       if (intensity > CORGI_MAX_INTENSITY)
-               intensity = CORGI_MAX_INTENSITY;
-       corgibl_send_intensity(intensity);
-       current_intensity=intensity;
+       corgibl_send_intensity(corgi_backlight_device);
        return 0;
 }
 
-static int corgibl_get_intensity(struct backlight_device *bd)
-{
-       return current_intensity;
-}
-
 /*
  * Called when the battery is low to limit the backlight intensity.
  * If limit==0 clear any limit, otherwise limit the intensity
  */
 void corgibl_limit_intensity(int limit)
 {
-       corgibl_limit = (limit ? 1 : 0);
-       corgibl_send_intensity(current_intensity);
+       if (limit)
+               corgibl_flags |= CORGIBL_BATTLOW;
+       else
+               corgibl_flags &= ~CORGIBL_BATTLOW;
+       corgibl_send_intensity(corgi_backlight_device);
 }
 EXPORT_SYMBOL(corgibl_limit_intensity);
 
 
 static struct backlight_properties corgibl_data = {
-       .owner          = THIS_MODULE,
-       .get_power      = corgibl_get_power,
-       .set_power      = corgibl_set_power,
-       .max_brightness = CORGI_MAX_INTENSITY,
+       .owner          = THIS_MODULE,
        .get_brightness = corgibl_get_intensity,
-       .set_brightness = corgibl_set_intensity,
+       .update_status  = corgibl_set_intensity,
 };
 
-static struct backlight_device *corgi_backlight_device;
-
-static int __init corgibl_probe(struct device *dev)
+static int __init corgibl_probe(struct platform_device *pdev)
 {
+       struct corgibl_machinfo *machinfo = pdev->dev.platform_data;
+
+       bl_machinfo = machinfo;
+       corgibl_data.max_brightness = machinfo->max_intensity;
+       if (!machinfo->limit_mask)
+               machinfo->limit_mask = -1;
+
        corgi_backlight_device = backlight_device_register ("corgi-bl",
                NULL, &corgibl_data);
        if (IS_ERR (corgi_backlight_device))
                return PTR_ERR (corgi_backlight_device);
 
-       corgibl_set_intensity(NULL, CORGI_DEFAULT_INTENSITY);
+       corgibl_data.power = FB_BLANK_UNBLANK;
+       corgibl_data.brightness = machinfo->default_intensity;
+       corgibl_send_intensity(corgi_backlight_device);
 
        printk("Corgi Backlight Driver Initialized.\n");
        return 0;
 }
 
-static int corgibl_remove(struct device *dev)
+static int corgibl_remove(struct platform_device *dev)
 {
        backlight_device_unregister(corgi_backlight_device);
 
-       corgibl_set_intensity(NULL, 0);
-
        printk("Corgi Backlight Driver Unloaded\n");
        return 0;
 }
 
-static struct device_driver corgibl_driver = {
-       .name           = "corgi-bl",
-       .bus            = &platform_bus_type,
+static struct platform_driver corgibl_driver = {
        .probe          = corgibl_probe,
        .remove         = corgibl_remove,
        .suspend        = corgibl_suspend,
        .resume         = corgibl_resume,
+       .driver         = {
+               .name   = "corgi-bl",
+       },
 };
 
 static int __init corgibl_init(void)
 {
-       return driver_register(&corgibl_driver);
+       return platform_driver_register(&corgibl_driver);
 }
 
 static void __exit corgibl_exit(void)
 {
-       driver_unregister(&corgibl_driver);
+       platform_driver_unregister(&corgibl_driver);
 }
 
 module_init(corgibl_init);
index 470e6f0..bc8ab00 100644 (file)
@@ -5,7 +5,6 @@
  *
  */
 
-#include <linux/version.h>
 #include <linux/module.h>
 #include <linux/init.h>
 #include <linux/device.h>
@@ -14,7 +13,6 @@
 #include <linux/ctype.h>
 #include <linux/err.h>
 #include <linux/fb.h>
-#include <asm/bug.h>
 
 static ssize_t lcd_show_power(struct class_device *cdev, char *buf)
 {
@@ -33,12 +31,15 @@ static ssize_t lcd_show_power(struct class_device *cdev, char *buf)
 
 static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc, power;
+       int rc = -ENXIO;
        char *endp;
        struct lcd_device *ld = to_lcd_device(cdev);
+       int power = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       power = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&ld->sem);
@@ -46,8 +47,7 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_
                pr_debug("lcd: set power to %d\n", power);
                ld->props->set_power(ld, power);
                rc = count;
-       } else
-               rc = -ENXIO;
+       }
        up(&ld->sem);
 
        return rc;
@@ -55,14 +55,12 @@ static ssize_t lcd_store_power(struct class_device *cdev, const char *buf, size_
 
 static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
 {
-       int rc;
+       int rc = -ENXIO;
        struct lcd_device *ld = to_lcd_device(cdev);
 
        down(&ld->sem);
        if (likely(ld->props && ld->props->get_contrast))
                rc = sprintf(buf, "%d\n", ld->props->get_contrast(ld));
-       else
-               rc = -ENXIO;
        up(&ld->sem);
 
        return rc;
@@ -70,12 +68,15 @@ static ssize_t lcd_show_contrast(struct class_device *cdev, char *buf)
 
 static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, size_t count)
 {
-       int rc, contrast;
+       int rc = -ENXIO;
        char *endp;
        struct lcd_device *ld = to_lcd_device(cdev);
+       int contrast = simple_strtoul(buf, &endp, 0);
+       size_t size = endp - buf;
 
-       contrast = simple_strtoul(buf, &endp, 0);
-       if (*endp && !isspace(*endp))
+       if (*endp && isspace(*endp))
+               size++;
+       if (size != count)
                return -EINVAL;
 
        down(&ld->sem);
@@ -83,8 +84,7 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si
                pr_debug("lcd: set contrast to %d\n", contrast);
                ld->props->set_contrast(ld, contrast);
                rc = count;
-       } else
-               rc = -ENXIO;
+       }
        up(&ld->sem);
 
        return rc;
@@ -92,14 +92,12 @@ static ssize_t lcd_store_contrast(struct class_device *cdev, const char *buf, si
 
 static ssize_t lcd_show_max_contrast(struct class_device *cdev, char *buf)
 {
-       int rc;
+       int rc = -ENXIO;
        struct lcd_device *ld = to_lcd_device(cdev);
 
        down(&ld->sem);
        if (likely(ld->props))
                rc = sprintf(buf, "%d\n", ld->props->max_contrast);
-       else
-               rc = -ENXIO;
        up(&ld->sem);
 
        return rc;
@@ -173,7 +171,7 @@ struct lcd_device *lcd_device_register(const char *name, void *devdata,
 
        new_ld = kmalloc(sizeof(struct lcd_device), GFP_KERNEL);
        if (unlikely(!new_ld))
-               return ERR_PTR(ENOMEM);
+               return ERR_PTR(-ENOMEM);
 
        init_MUTEX(&new_ld->sem);
        new_ld->props = lp;
index b075fd0..4e173ef 100644 (file)
@@ -3,27 +3,37 @@
 #
 config FB_GEODE
        bool "AMD Geode family framebuffer support (EXPERIMENTAL)"
-       default n
-       depends on FB && EXPERIMENTAL && X86
+       depends on FB && PCI && EXPERIMENTAL && X86
        ---help---
          Say 'Y' here to allow you to select framebuffer drivers for
          the AMD Geode family of processors.
 
+config FB_GEODE_GX
+       tristate "AMD Geode GX framebuffer support (EXPERIMENTAL)"
+       depends on FB && FB_GEODE && EXPERIMENTAL
+       select FB_CFB_FILLRECT
+       select FB_CFB_COPYAREA
+       select FB_CFB_IMAGEBLIT
+       ---help---
+         Framebuffer driver for the display controller integrated into the
+         AMD Geode GX processors.
+
+         To compile this driver as a module, choose M here: the module will be
+         called gxfb.
+
+         If unsure, say N.
+
 config FB_GEODE_GX1
        tristate "AMD Geode GX1 framebuffer support (EXPERIMENTAL)"
-       default n
-       depends on FB_GEODE && EXPERIMENTAL
+       depends on FB && FB_GEODE && EXPERIMENTAL
        select FB_CFB_FILLRECT
        select FB_CFB_COPYAREA
        select FB_CFB_IMAGEBLIT
-       select FB_SOFT_CURSOR
        ---help---
          Framebuffer driver for the display controller integrated into the
          AMD Geode GX1 processor.
 
-         This driver is also available as a module ( = code which can be
-         inserted and removed from the running kernel whenever you want). The
-         module will be called gx1fb. If you want to compile it as a module,
-         say M here and read <file:Documentation/modules.txt>.
+         To compile this driver as a module, choose M here: the module will be
+         called gx1fb.
 
          If unsure, say N.
index 13ad501..f896565 100644 (file)
@@ -1,5 +1,7 @@
 # Makefile for the Geode family framebuffer drivers
 
 obj-$(CONFIG_FB_GEODE_GX1) += gx1fb.o
+obj-$(CONFIG_FB_GEODE_GX)  += gxfb.o
 
-gx1fb-objs             := gx1fb_core.o display_gx1.o video_cs5530.o
+gx1fb-objs := gx1fb_core.o display_gx1.o video_cs5530.o
+gxfb-objs  := gxfb_core.o display_gx.o video_gx.o
index f377a29..4aefb8f 100644 (file)
@@ -300,6 +300,9 @@ int nvidiafb_sync(struct fb_info *info)
 {
        struct nvidia_par *par = info->par;
 
+       if (info->state != FBINFO_STATE_RUNNING)
+               return 0;
+
        if (!par->lockup)
                NVFlush(par);
 
@@ -313,6 +316,9 @@ void nvidiafb_copyarea(struct fb_info *info, const struct fb_copyarea *region)
 {
        struct nvidia_par *par = info->par;
 
+       if (info->state != FBINFO_STATE_RUNNING)
+               return;
+
        if (par->lockup)
                return cfb_copyarea(info, region);
 
@@ -329,6 +335,9 @@ void nvidiafb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
        struct nvidia_par *par = info->par;
        u32 color;
 
+       if (info->state != FBINFO_STATE_RUNNING)
+               return;
+
        if (par->lockup)
                return cfb_fillrect(info, rect);
 
@@ -412,6 +421,9 @@ void nvidiafb_imageblit(struct fb_info *info, const struct fb_image *image)
 {
        struct nvidia_par *par = info->par;
 
+       if (info->state != FBINFO_STATE_RUNNING)
+               return;
+
        if (image->depth == 1 && !par->lockup)
                nvidiafb_mono_color_expand(info, image);
        else
index 9da3209..4243d7f 100644 (file)
@@ -95,6 +95,7 @@
 
 #define READ_GET(par) (NV_RD32(&(par)->FIFO[0x0011], 0) >> 2)
 
+#ifdef __LITTLE_ENDIAN
 #define reverse_order(l)        \
 do {                            \
        u8 *a = (u8 *)(l);      \
@@ -103,5 +104,8 @@ do {                            \
        *a = byte_rev[*a], a++; \
        *a = byte_rev[*a];      \
 } while(0)
+#else
+#define reverse_order(l) do { } while(0)
+#endif                          /* __LITTLE_ENDIAN */
 
 #endif                         /* __NV_LOCAL_H__ */
index de15fec..47f41f7 100644 (file)
@@ -83,6 +83,8 @@ struct pxafb_info {
        u_int                   reg_lccr2;
        u_int                   reg_lccr3;
 
+       unsigned long   hsync_time;
+
        volatile u_char         state;
        volatile u_char         task_state;
        struct semaphore        ctrlr_sem;
@@ -111,15 +113,6 @@ struct pxafb_info {
 
 #define PXA_NAME       "PXA"
 
-/*
- *  Debug macros
- */
-#if DEBUG
-#  define DPRINTK(fmt, args...)        printk("%s: " fmt, __FUNCTION__ , ## args)
-#else
-#  define DPRINTK(fmt, args...)
-#endif
-
 /*
  * Minimum X and Y resolutions
  */
index 58cd2ad..5fc86ea 100644 (file)
@@ -4,10 +4,20 @@
  * Frame Buffer Device for ATI Imageon w100 (Wallaby)
  *
  * Copyright (C) 2002, ATI Corp.
- * Copyright (C) 2004-2005 Richard Purdie
+ * Copyright (C) 2004-2006 Richard Purdie
+ * Copyright (c) 2005 Ian Molton
+ * Copyright (c) 2006 Alberto Mardegan
  *
  * Rewritten for 2.6 by Richard Purdie <rpurdie@rpsys.net>
  *
+ * Generic platform support by Ian Molton <spyro@f2s.com>
+ * and Richard Purdie <rpurdie@rpsys.net>
+ *
+ * w32xx support by Ian Molton
+ *
+ * Hardware acceleration support by Alberto Mardegan
+ * <mardy@users.sourceforge.net>
+ *
  * 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.
@@ -19,9 +29,9 @@
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/string.h>
-#include <linux/proc_fs.h>
+#include <linux/vmalloc.h>
 #include <asm/io.h>
 #include <asm/uaccess.h>
 #include <video/w100fb.h>
 /*
  * Prototypes
  */
-static void w100fb_save_buffer(void);
-static void w100fb_clear_buffer(void);
-static void w100fb_restore_buffer(void);
-static void w100fb_clear_screen(u32 mode, long int offset);
-static void w100_resume(void);
 static void w100_suspend(u32 mode);
-static void w100_init_qvga_rotation(u16 deg);
-static void w100_init_vga_rotation(u16 deg);
 static void w100_vsync(void);
-static void w100_init_sharp_lcd(u32 mode);
-static void w100_pwm_setup(void);
-static void w100_InitExtMem(u32 mode);
-static void w100_hw_init(void);
-static u16 w100_set_fastsysclk(u16 Freq);
-
-static void lcdtg_hw_init(u32 mode);
-static void lcdtg_lcd_change(u32 mode);
-static void lcdtg_resume(void);
-static void lcdtg_suspend(void);
-
-
-/* Register offsets & lengths */
-#define REMAPPED_FB_LEN   0x15ffff
-
-#define BITS_PER_PIXEL    16
+static void w100_hw_init(struct w100fb_par*);
+static void w100_pwm_setup(struct w100fb_par*);
+static void w100_init_clocks(struct w100fb_par*);
+static void w100_setup_memory(struct w100fb_par*);
+static void w100_init_lcd(struct w100fb_par*);
+static void w100_set_dispregs(struct w100fb_par*);
+static void w100_update_enable(void);
+static void w100_update_disable(void);
+static void calc_hsync(struct w100fb_par *par);
+static void w100_init_graphic_engine(struct w100fb_par *par);
+struct w100_pll_info *w100_get_xtal_table(unsigned int freq);
 
 /* Pseudo palette size */
 #define MAX_PALETTES      16
 
-/* for resolution change */
-#define LCD_MODE_INIT (-1)
-#define LCD_MODE_480    0
-#define LCD_MODE_320    1
-#define LCD_MODE_240    2
-#define LCD_MODE_640    3
-
-#define LCD_SHARP_QVGA 0
-#define LCD_SHARP_VGA  1
-
-#define LCD_MODE_PORTRAIT      0
-#define LCD_MODE_LANDSCAPE     1
-
 #define W100_SUSPEND_EXTMEM 0
 #define W100_SUSPEND_ALL    1
 
-/* General frame buffer data structures */
-struct w100fb_par {
-       u32 xres;
-       u32 yres;
-       int fastsysclk_mode;
-       int lcdMode;
-       int rotation_flag;
-       int blanking_flag;
-       int comadj;
-       int phadadj;
-};
-
-static struct w100fb_par *current_par;
+#define BITS_PER_PIXEL    16
 
 /* Remapped addresses for base cfg, memmapped regs and the frame buffer itself */
 static void *remapped_base;
 static void *remapped_regs;
 static void *remapped_fbuf;
 
-/* External Function */
-static void(*w100fb_ssp_send)(u8 adrs, u8 data);
+#define REMAPPED_FB_LEN   0x15ffff
+
+/* This is the offset in the w100's address space we map the current
+   framebuffer memory to. We use the position of external memory as
+   we can remap internal memory to there if external isn't present. */
+#define W100_FB_BASE MEM_EXT_BASE_VALUE
+
 
 /*
  * Sysfs functions
  */
-
-static ssize_t rotation_show(struct device *dev, char *buf)
+static ssize_t flip_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct fb_info *info = dev_get_drvdata(dev);
        struct w100fb_par *par=info->par;
 
-       return sprintf(buf, "%d\n",par->rotation_flag);
+       return sprintf(buf, "%d\n",par->flip);
 }
 
-static ssize_t rotation_store(struct device *dev, const char *buf, size_t count)
+static ssize_t flip_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
-       unsigned int rotate;
+       unsigned int flip;
        struct fb_info *info = dev_get_drvdata(dev);
        struct w100fb_par *par=info->par;
 
-       rotate = simple_strtoul(buf, NULL, 10);
+       flip = simple_strtoul(buf, NULL, 10);
 
-       if (rotate > 0) par->rotation_flag = 1;
-       else par->rotation_flag = 0;
+       if (flip > 0)
+               par->flip = 1;
+       else
+               par->flip = 0;
+
+       w100_update_disable();
+       w100_set_dispregs(par);
+       w100_update_enable();
 
-       if (par->lcdMode == LCD_MODE_320)
-               w100_init_qvga_rotation(par->rotation_flag ? 270 : 90);
-       else if (par->lcdMode == LCD_MODE_240)
-               w100_init_qvga_rotation(par->rotation_flag ? 180 : 0);
-       else if (par->lcdMode == LCD_MODE_640)
-               w100_init_vga_rotation(par->rotation_flag ? 270 : 90);
-       else if (par->lcdMode == LCD_MODE_480)
-               w100_init_vga_rotation(par->rotation_flag ? 180 : 0);
+       calc_hsync(par);
 
        return count;
 }
 
-static DEVICE_ATTR(rotation, 0644, rotation_show, rotation_store);
+static DEVICE_ATTR(flip, 0644, flip_show, flip_store);
 
-static ssize_t w100fb_reg_read(struct device *dev, const char *buf, size_t count)
+static ssize_t w100fb_reg_read(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
-       unsigned long param;
-       unsigned long regs;
+       unsigned long regs, param;
        regs = simple_strtoul(buf, NULL, 16);
        param = readl(remapped_regs + regs);
        printk("Read Register 0x%08lX: 0x%08lX\n", regs, param);
@@ -146,10 +121,9 @@ static ssize_t w100fb_reg_read(struct device *dev, const char *buf, size_t count
 
 static DEVICE_ATTR(reg_read, 0200, NULL, w100fb_reg_read);
 
-static ssize_t w100fb_reg_write(struct device *dev, const char *buf, size_t count)
+static ssize_t w100fb_reg_write(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
-       unsigned long regs;
-       unsigned long param;
+       unsigned long regs, param;
        sscanf(buf, "%lx %lx", &regs, &param);
 
        if (regs <= 0x2000) {
@@ -163,54 +137,56 @@ static ssize_t w100fb_reg_write(struct device *dev, const char *buf, size_t coun
 static DEVICE_ATTR(reg_write, 0200, NULL, w100fb_reg_write);
 
 
-static ssize_t fastsysclk_show(struct device *dev, char *buf)
+static ssize_t fastpllclk_show(struct device *dev, struct device_attribute *attr, char *buf)
 {
        struct fb_info *info = dev_get_drvdata(dev);
        struct w100fb_par *par=info->par;
 
-       return sprintf(buf, "%d\n",par->fastsysclk_mode);
+       return sprintf(buf, "%d\n",par->fastpll_mode);
 }
 
-static ssize_t fastsysclk_store(struct device *dev, const char *buf, size_t count)
+static ssize_t fastpllclk_store(struct device *dev, struct device_attribute *attr, const char *buf, size_t count)
 {
-       int param;
        struct fb_info *info = dev_get_drvdata(dev);
        struct w100fb_par *par=info->par;
 
-       param = simple_strtoul(buf, NULL, 10);
-
-       if (param == 75) {
-               printk("Set fastsysclk %d\n", param);
-               par->fastsysclk_mode = param;
-               w100_set_fastsysclk(par->fastsysclk_mode);
-       } else if (param == 100) {
-               printk("Set fastsysclk %d\n", param);
-               par->fastsysclk_mode = param;
-               w100_set_fastsysclk(par->fastsysclk_mode);
+       if (simple_strtoul(buf, NULL, 10) > 0) {
+               par->fastpll_mode=1;
+               printk("w100fb: Using fast system clock (if possible)\n");
+       } else {
+               par->fastpll_mode=0;
+               printk("w100fb: Using normal system clock\n");
        }
+
+       w100_init_clocks(par);
+       calc_hsync(par);
+
        return count;
 }
 
-static DEVICE_ATTR(fastsysclk, 0644, fastsysclk_show, fastsysclk_store);
+static DEVICE_ATTR(fastpllclk, 0644, fastpllclk_show, fastpllclk_store);
 
 /*
- * The touchscreen on this device needs certain information
- * from the video driver to function correctly. We export it here.
+ * Some touchscreens need hsync information from the video driver to
+ * function correctly. We export it here.
  */
-int w100fb_get_xres(void) {
-       return current_par->xres;
-}
+unsigned long w100fb_get_hsynclen(struct device *dev)
+{
+       struct fb_info *info = dev_get_drvdata(dev);
+       struct w100fb_par *par=info->par;
 
-int w100fb_get_blanking(void) {
-       return current_par->blanking_flag;
+       /* If display is blanked/suspended, hsync isn't active */
+       if (par->blanked)
+               return 0;
+       else
+               return par->hsync_len;
 }
+EXPORT_SYMBOL(w100fb_get_hsynclen);
 
-int w100fb_get_fastsysclk(void) {
-       return current_par->fastsysclk_mode;
+static void w100fb_clear_screen(struct w100fb_par *par)
+{
+       memset_io(remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), 0, (par->xres * par->yres * BITS_PER_PIXEL/8));
 }
-EXPORT_SYMBOL(w100fb_get_xres);
-EXPORT_SYMBOL(w100fb_get_blanking);
-EXPORT_SYMBOL(w100fb_get_fastsysclk);
 
 
 /*
@@ -234,7 +210,6 @@ static int w100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
         * according to the RGB bitfield information.
         */
        if (regno < MAX_PALETTES) {
-
                u32 *pal = info->pseudo_palette;
 
                val = (red & 0xf800) | ((green & 0xfc00) >> 5) | ((blue & 0xf800) >> 11);
@@ -250,115 +225,237 @@ static int w100fb_setcolreg(u_int regno, u_int red, u_int green, u_int blue,
  */
 static int w100fb_blank(int blank_mode, struct fb_info *info)
 {
-       struct w100fb_par *par;
-       par=info->par;
+       struct w100fb_par *par = info->par;
+       struct w100_tg_info *tg = par->mach->tg;
 
        switch(blank_mode) {
 
-       case FB_BLANK_NORMAL: /* Normal blanking */
-       case FB_BLANK_VSYNC_SUSPEND: /* VESA blank (vsync off) */
-       case FB_BLANK_HSYNC_SUSPEND: /* VESA blank (hsync off) */
-       case FB_BLANK_POWERDOWN: /* Poweroff */
-               if (par->blanking_flag == 0) {
-                       w100fb_save_buffer();
-                       lcdtg_suspend();
-                       par->blanking_flag = 1;
+       case FB_BLANK_NORMAL:         /* Normal blanking */
+       case FB_BLANK_VSYNC_SUSPEND:  /* VESA blank (vsync off) */
+       case FB_BLANK_HSYNC_SUSPEND:  /* VESA blank (hsync off) */
+       case FB_BLANK_POWERDOWN:      /* Poweroff */
+               if (par->blanked == 0) {
+                       if(tg && tg->suspend)
+                               tg->suspend(par);
+                       par->blanked = 1;
                }
                break;
 
        case FB_BLANK_UNBLANK: /* Unblanking */
-               if (par->blanking_flag != 0) {
-                       w100fb_restore_buffer();
-                       lcdtg_resume();
-                       par->blanking_flag = 0;
+               if (par->blanked != 0) {
+                       if(tg && tg->resume)
+                               tg->resume(par);
+                       par->blanked = 0;
                }
                break;
        }
        return 0;
 }
 
-/*
- *  Change the resolution by calling the appropriate hardware functions
- */
-static void w100fb_changeres(int rotate_mode, u32 mode)
+
+static void w100_fifo_wait(int entries)
 {
-       u16 rotation=0;
-
-       switch(rotate_mode) {
-       case LCD_MODE_LANDSCAPE:
-               rotation=(current_par->rotation_flag ? 270 : 90);
-               break;
-       case LCD_MODE_PORTRAIT:
-               rotation=(current_par->rotation_flag ? 180 : 0);
-               break;
+       union rbbm_status_u status;
+       int i;
+
+       for (i = 0; i < 2000000; i++) {
+               status.val = readl(remapped_regs + mmRBBM_STATUS);
+               if (status.f.cmdfifo_avail >= entries)
+                       return;
+               udelay(1);
        }
+       printk(KERN_ERR "w100fb: FIFO Timeout!\n");
+}
 
-       w100_pwm_setup();
-       switch(mode) {
-       case LCD_SHARP_QVGA:
-               w100_vsync();
-               w100_suspend(W100_SUSPEND_EXTMEM);
-               w100_init_sharp_lcd(LCD_SHARP_QVGA);
-               w100_init_qvga_rotation(rotation);
-               w100_InitExtMem(LCD_SHARP_QVGA);
-               w100fb_clear_screen(LCD_SHARP_QVGA, 0);
-               lcdtg_lcd_change(LCD_SHARP_QVGA);
-               break;
-       case LCD_SHARP_VGA:
-               w100fb_clear_screen(LCD_SHARP_QVGA, 0);
-               writel(0xBFFFA000, remapped_regs + mmMC_EXT_MEM_LOCATION);
-               w100_InitExtMem(LCD_SHARP_VGA);
-               w100fb_clear_screen(LCD_SHARP_VGA, 0x200000);
-               w100_vsync();
-               w100_init_sharp_lcd(LCD_SHARP_VGA);
-               if (rotation != 0)
-                       w100_init_vga_rotation(rotation);
-               lcdtg_lcd_change(LCD_SHARP_VGA);
-               break;
+
+static int w100fb_sync(struct fb_info *info)
+{
+       union rbbm_status_u status;
+       int i;
+
+       for (i = 0; i < 2000000; i++) {
+               status.val = readl(remapped_regs + mmRBBM_STATUS);
+               if (!status.f.gui_active)
+                       return 0;
+               udelay(1);
        }
+       printk(KERN_ERR "w100fb: Graphic engine timeout!\n");
+       return -EBUSY;
+}
+
+
+static void w100_init_graphic_engine(struct w100fb_par *par)
+{
+       union dp_gui_master_cntl_u gmc;
+       union dp_mix_u dp_mix;
+       union dp_datatype_u dp_datatype;
+       union dp_cntl_u dp_cntl;
+
+       w100_fifo_wait(4);
+       writel(W100_FB_BASE, remapped_regs + mmDST_OFFSET);
+       writel(par->xres, remapped_regs + mmDST_PITCH);
+       writel(W100_FB_BASE, remapped_regs + mmSRC_OFFSET);
+       writel(par->xres, remapped_regs + mmSRC_PITCH);
+
+       w100_fifo_wait(3);
+       writel(0, remapped_regs + mmSC_TOP_LEFT);
+       writel((par->yres << 16) | par->xres, remapped_regs + mmSC_BOTTOM_RIGHT);
+       writel(0x1fff1fff, remapped_regs + mmSRC_SC_BOTTOM_RIGHT);
+
+       w100_fifo_wait(4);
+       dp_cntl.val = 0;
+       dp_cntl.f.dst_x_dir = 1;
+       dp_cntl.f.dst_y_dir = 1;
+       dp_cntl.f.src_x_dir = 1;
+       dp_cntl.f.src_y_dir = 1;
+       dp_cntl.f.dst_major_x = 1;
+       dp_cntl.f.src_major_x = 1;
+       writel(dp_cntl.val, remapped_regs + mmDP_CNTL);
+
+       gmc.val = 0;
+       gmc.f.gmc_src_pitch_offset_cntl = 1;
+       gmc.f.gmc_dst_pitch_offset_cntl = 1;
+       gmc.f.gmc_src_clipping = 1;
+       gmc.f.gmc_dst_clipping = 1;
+       gmc.f.gmc_brush_datatype = GMC_BRUSH_NONE;
+       gmc.f.gmc_dst_datatype = 3; /* from DstType_16Bpp_444 */
+       gmc.f.gmc_src_datatype = SRC_DATATYPE_EQU_DST;
+       gmc.f.gmc_byte_pix_order = 1;
+       gmc.f.gmc_default_sel = 0;
+       gmc.f.gmc_rop3 = ROP3_SRCCOPY;
+       gmc.f.gmc_dp_src_source = DP_SRC_MEM_RECTANGULAR;
+       gmc.f.gmc_clr_cmp_fcn_dis = 1;
+       gmc.f.gmc_wr_msk_dis = 1;
+       gmc.f.gmc_dp_op = DP_OP_ROP;
+       writel(gmc.val, remapped_regs + mmDP_GUI_MASTER_CNTL);
+
+       dp_datatype.val = dp_mix.val = 0;
+       dp_datatype.f.dp_dst_datatype = gmc.f.gmc_dst_datatype;
+       dp_datatype.f.dp_brush_datatype = gmc.f.gmc_brush_datatype;
+       dp_datatype.f.dp_src2_type = 0;
+       dp_datatype.f.dp_src2_datatype = gmc.f.gmc_src_datatype;
+       dp_datatype.f.dp_src_datatype = gmc.f.gmc_src_datatype;
+       dp_datatype.f.dp_byte_pix_order = gmc.f.gmc_byte_pix_order;
+       writel(dp_datatype.val, remapped_regs + mmDP_DATATYPE);
+
+       dp_mix.f.dp_src_source = gmc.f.gmc_dp_src_source;
+       dp_mix.f.dp_src2_source = 1;
+       dp_mix.f.dp_rop3 = gmc.f.gmc_rop3;
+       dp_mix.f.dp_op = gmc.f.gmc_dp_op;
+       writel(dp_mix.val, remapped_regs + mmDP_MIX);
 }
 
+
+static void w100fb_fillrect(struct fb_info *info,
+                            const struct fb_fillrect *rect)
+{
+       union dp_gui_master_cntl_u gmc;
+
+       if (info->state != FBINFO_STATE_RUNNING)
+               return;
+       if (info->flags & FBINFO_HWACCEL_DISABLED) {
+               cfb_fillrect(info, rect);
+               return;
+       }
+
+       gmc.val = readl(remapped_regs + mmDP_GUI_MASTER_CNTL);
+       gmc.f.gmc_rop3 = ROP3_PATCOPY;
+       gmc.f.gmc_brush_datatype = GMC_BRUSH_SOLID_COLOR;
+       w100_fifo_wait(2);
+       writel(gmc.val, remapped_regs + mmDP_GUI_MASTER_CNTL);
+       writel(rect->color, remapped_regs + mmDP_BRUSH_FRGD_CLR);
+
+       w100_fifo_wait(2);
+       writel((rect->dy << 16) | (rect->dx & 0xffff), remapped_regs + mmDST_Y_X);
+       writel((rect->width << 16) | (rect->height & 0xffff),
+              remapped_regs + mmDST_WIDTH_HEIGHT);
+}
+
+
+static void w100fb_copyarea(struct fb_info *info,
+                            const struct fb_copyarea *area)
+{
+       u32 dx = area->dx, dy = area->dy, sx = area->sx, sy = area->sy;
+       u32 h = area->height, w = area->width;
+       union dp_gui_master_cntl_u gmc;
+
+       if (info->state != FBINFO_STATE_RUNNING)
+               return;
+       if (info->flags & FBINFO_HWACCEL_DISABLED) {
+               cfb_copyarea(info, area);
+               return;
+       }
+
+       gmc.val = readl(remapped_regs + mmDP_GUI_MASTER_CNTL);
+       gmc.f.gmc_rop3 = ROP3_SRCCOPY;
+       gmc.f.gmc_brush_datatype = GMC_BRUSH_NONE;
+       w100_fifo_wait(1);
+       writel(gmc.val, remapped_regs + mmDP_GUI_MASTER_CNTL);
+
+       w100_fifo_wait(3);
+       writel((sy << 16) | (sx & 0xffff), remapped_regs + mmSRC_Y_X);
+       writel((dy << 16) | (dx & 0xffff), remapped_regs + mmDST_Y_X);
+       writel((w << 16) | (h & 0xffff), remapped_regs + mmDST_WIDTH_HEIGHT);
+}
+
+
 /*
- * Set up the display for the fb subsystem
+ *  Change the resolution by calling the appropriate hardware functions
  */
-static void w100fb_activate_var(struct fb_info *info)
+static void w100fb_activate_var(struct w100fb_par *par)
 {
-       u32 temp32;
-       struct w100fb_par *par=info->par;
-       struct fb_var_screeninfo *var = &info->var;
+       struct w100_tg_info *tg = par->mach->tg;
 
-       /* Set the hardware to 565 */
-       temp32 = readl(remapped_regs + mmDISP_DEBUG2);
-       temp32 &= 0xff7fffff;
-       temp32 |= 0x00800000;
-       writel(temp32, remapped_regs + mmDISP_DEBUG2);
+       w100_pwm_setup(par);
+       w100_setup_memory(par);
+       w100_init_clocks(par);
+       w100fb_clear_screen(par);
+       w100_vsync();
 
-       if (par->lcdMode == LCD_MODE_INIT) {
-               w100_init_sharp_lcd(LCD_SHARP_VGA);
-               w100_init_vga_rotation(par->rotation_flag ? 270 : 90);
-               par->lcdMode = LCD_MODE_640;
-               lcdtg_hw_init(LCD_SHARP_VGA);
-       } else if (var->xres == 320 && var->yres == 240) {
-               if (par->lcdMode != LCD_MODE_320) {
-                       w100fb_changeres(LCD_MODE_LANDSCAPE, LCD_SHARP_QVGA);
-                       par->lcdMode = LCD_MODE_320;
-               }
-       } else if (var->xres == 240 && var->yres == 320) {
-               if (par->lcdMode != LCD_MODE_240) {
-                       w100fb_changeres(LCD_MODE_PORTRAIT, LCD_SHARP_QVGA);
-                       par->lcdMode = LCD_MODE_240;
-               }
-       } else if (var->xres == 640 && var->yres == 480) {
-               if (par->lcdMode != LCD_MODE_640) {
-                       w100fb_changeres(LCD_MODE_LANDSCAPE, LCD_SHARP_VGA);
-                       par->lcdMode = LCD_MODE_640;
-               }
-       } else if (var->xres == 480 && var->yres == 640) {
-               if (par->lcdMode != LCD_MODE_480) {
-                       w100fb_changeres(LCD_MODE_PORTRAIT, LCD_SHARP_VGA);
-                       par->lcdMode = LCD_MODE_480;
+       w100_update_disable();
+       w100_init_lcd(par);
+       w100_set_dispregs(par);
+       w100_update_enable();
+       w100_init_graphic_engine(par);
+
+       calc_hsync(par);
+
+       if (!par->blanked && tg && tg->change)
+               tg->change(par);
+}
+
+
+/* Select the smallest mode that allows the desired resolution to be
+ * displayed. If desired, the x and y parameters can be rounded up to
+ * match the selected mode.
+ */
+static struct w100_mode *w100fb_get_mode(struct w100fb_par *par, unsigned int *x, unsigned int *y, int saveval)
+{
+       struct w100_mode *mode = NULL;
+       struct w100_mode *modelist = par->mach->modelist;
+       unsigned int best_x = 0xffffffff, best_y = 0xffffffff;
+       unsigned int i;
+
+       for (i = 0 ; i < par->mach->num_modes ; i++) {
+               if (modelist[i].xres >= *x && modelist[i].yres >= *y &&
+                               modelist[i].xres < best_x && modelist[i].yres < best_y) {
+                       best_x = modelist[i].xres;
+                       best_y = modelist[i].yres;
+                       mode = &modelist[i];
+               } else if(modelist[i].xres >= *y && modelist[i].yres >= *x &&
+                       modelist[i].xres < best_y && modelist[i].yres < best_x) {
+                       best_x = modelist[i].yres;
+                       best_y = modelist[i].xres;
+                       mode = &modelist[i];
                }
-       } else printk(KERN_ERR "W100FB: Resolution error!\n");
+       }
+
+       if (mode && saveval) {
+               *x = best_x;
+               *y = best_y;
+       }
+
+       return mode;
 }
 
 
@@ -366,31 +463,19 @@ static void w100fb_activate_var(struct fb_info *info)
  *  w100fb_check_var():
  *  Get the video params out of 'var'. If a value doesn't fit, round it up,
  *  if it's too big, return -EINVAL.
- *
  */
 static int w100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
 {
-       if (var->xres < var->yres) { /* Portrait mode */
-               if ((var->xres > 480) || (var->yres > 640)) {
-                       return -EINVAL;
-               } else if ((var->xres > 240) || (var->yres > 320)) {
-                       var->xres = 480;
-                       var->yres = 640;
-               } else {
-                       var->xres = 240;
-                       var->yres = 320;
-               }
-       } else { /* Landscape mode */
-               if ((var->xres > 640) || (var->yres > 480)) {
-                       return -EINVAL;
-               } else if ((var->xres > 320) || (var->yres > 240)) {
-                       var->xres = 640;
-                       var->yres = 480;
-               } else {
-                       var->xres = 320;
-                       var->yres = 240;
-               }
-       }
+       struct w100fb_par *par=info->par;
+
+       if(!w100fb_get_mode(par, &var->xres, &var->yres, 1))
+               return -EINVAL;
+
+       if (par->mach->mem && ((var->xres*var->yres*BITS_PER_PIXEL/8) > (par->mach->mem->size+1)))
+               return -EINVAL;
+
+       if (!par->mach->mem && ((var->xres*var->yres*BITS_PER_PIXEL/8) > (MEM_INT_SIZE+1)))
+               return -EINVAL;
 
        var->xres_virtual = max(var->xres_virtual, var->xres);
        var->yres_virtual = max(var->yres_virtual, var->yres);
@@ -409,13 +494,11 @@ static int w100fb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
        var->transp.offset = var->transp.length = 0;
 
        var->nonstd = 0;
-
        var->height = -1;
        var->width = -1;
        var->vmode = FB_VMODE_NONINTERLACED;
-
        var->sync = 0;
-       var->pixclock = 0x04;   /* 171521; */
+       var->pixclock = 0x04;  /* 171521; */
 
        return 0;
 }
@@ -430,274 +513,284 @@ static int w100fb_set_par(struct fb_info *info)
 {
        struct w100fb_par *par=info->par;
 
-       par->xres = info->var.xres;
-       par->yres = info->var.yres;
-
-       info->fix.visual = FB_VISUAL_TRUECOLOR;
-
-       info->fix.ypanstep = 0;
-       info->fix.ywrapstep = 0;
+       if (par->xres != info->var.xres || par->yres != info->var.yres) {
+               par->xres = info->var.xres;
+               par->yres = info->var.yres;
+               par->mode = w100fb_get_mode(par, &par->xres, &par->yres, 0);
 
-       if (par->blanking_flag)
-               w100fb_clear_buffer();
+               info->fix.visual = FB_VISUAL_TRUECOLOR;
+               info->fix.ypanstep = 0;
+               info->fix.ywrapstep = 0;
+               info->fix.line_length = par->xres * BITS_PER_PIXEL / 8;
 
-       w100fb_activate_var(info);
+               if ((par->xres*par->yres*BITS_PER_PIXEL/8) > (MEM_INT_SIZE+1)) {
+                       par->extmem_active = 1;
+                       info->fix.smem_len = par->mach->mem->size+1;
+               } else {
+                       par->extmem_active = 0;
+                       info->fix.smem_len = MEM_INT_SIZE+1;
+               }
 
-       if (par->lcdMode == LCD_MODE_480) {
-               info->fix.line_length = (480 * BITS_PER_PIXEL) / 8;
-               info->fix.smem_len = 0x200000;
-       } else if (par->lcdMode == LCD_MODE_320) {
-               info->fix.line_length = (320 * BITS_PER_PIXEL) / 8;
-               info->fix.smem_len = 0x60000;
-       } else if (par->lcdMode == LCD_MODE_240) {
-               info->fix.line_length = (240 * BITS_PER_PIXEL) / 8;
-               info->fix.smem_len = 0x60000;
-       } else if (par->lcdMode == LCD_MODE_INIT || par->lcdMode == LCD_MODE_640) {
-               info->fix.line_length = (640 * BITS_PER_PIXEL) / 8;
-               info->fix.smem_len = 0x200000;
+               w100fb_activate_var(par);
        }
-
        return 0;
 }
 
 
 /*
- *      Frame buffer operations
+ *  Frame buffer operations
  */
 static struct fb_ops w100fb_ops = {
-       .owner = THIS_MODULE,
+       .owner        = THIS_MODULE,
        .fb_check_var = w100fb_check_var,
-       .fb_set_par = w100fb_set_par,
+       .fb_set_par   = w100fb_set_par,
        .fb_setcolreg = w100fb_setcolreg,
-       .fb_blank = w100fb_blank,
-       .fb_fillrect = cfb_fillrect,
-       .fb_copyarea = cfb_copyarea,
+       .fb_blank     = w100fb_blank,
+       .fb_fillrect  = w100fb_fillrect,
+       .fb_copyarea  = w100fb_copyarea,
        .fb_imageblit = cfb_imageblit,
-       .fb_cursor = soft_cursor,
+       .fb_sync      = w100fb_sync,
 };
 
-
-static void w100fb_clear_screen(u32 mode, long int offset)
+#ifdef CONFIG_PM
+static void w100fb_save_vidmem(struct w100fb_par *par)
 {
-       int i, numPix = 0;
-
-       if (mode == LCD_SHARP_VGA)
-               numPix = 640 * 480;
-       else if (mode == LCD_SHARP_QVGA)
-               numPix = 320 * 240;
-
-       for (i = 0; i < numPix; i++)
-               writew(0xffff, remapped_fbuf + offset + (2*i));
-}
-
-
-/* Need to split up the buffers to stay within the limits of kmalloc */
-#define W100_BUF_NUM   6
-static uint32_t *gSaveImagePtr[W100_BUF_NUM] = { NULL };
+       int memsize;
 
-static void w100fb_save_buffer(void)
-{
-       int i, j, bufsize;
-
-       bufsize=(current_par->xres * current_par->yres * BITS_PER_PIXEL / 8) / W100_BUF_NUM;
-       for (i = 0; i < W100_BUF_NUM; i++) {
-               if (gSaveImagePtr[i] == NULL)
-                       gSaveImagePtr[i] = kmalloc(bufsize, GFP_KERNEL);
-               if (gSaveImagePtr[i] == NULL) {
-                       w100fb_clear_buffer();
-                       printk(KERN_WARNING "can't alloc pre-off image buffer %d\n", i);
-                       break;
-               }
-               for (j = 0; j < bufsize/4; j++)
-                       *(gSaveImagePtr[i] + j) = readl(remapped_fbuf + (bufsize*i) + j*4);
+       if (par->extmem_active) {
+               memsize=par->mach->mem->size;
+               par->saved_extmem = vmalloc(memsize);
+               if (par->saved_extmem)
+                       memcpy_fromio(par->saved_extmem, remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), memsize);
        }
+       memsize=MEM_INT_SIZE;
+       par->saved_intmem = vmalloc(memsize);
+       if (par->saved_intmem && par->extmem_active)
+               memcpy_fromio(par->saved_intmem, remapped_fbuf + (W100_FB_BASE-MEM_INT_BASE_VALUE), memsize);
+       else if (par->saved_intmem)
+               memcpy_fromio(par->saved_intmem, remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), memsize);
 }
 
-
-static void w100fb_restore_buffer(void)
+static void w100fb_restore_vidmem(struct w100fb_par *par)
 {
-       int i, j, bufsize;
+       int memsize;
 
-       bufsize=(current_par->xres * current_par->yres * BITS_PER_PIXEL / 8) / W100_BUF_NUM;
-       for (i = 0; i < W100_BUF_NUM; i++) {
-               if (gSaveImagePtr[i] == NULL) {
-                       printk(KERN_WARNING "can't find pre-off image buffer %d\n", i);
-                       w100fb_clear_buffer();
-                       break;
-               }
-               for (j = 0; j < (bufsize/4); j++)
-                       writel(*(gSaveImagePtr[i] + j),remapped_fbuf + (bufsize*i) + (j*4));
-               kfree(gSaveImagePtr[i]);
-               gSaveImagePtr[i] = NULL;
+       if (par->extmem_active && par->saved_extmem) {
+               memsize=par->mach->mem->size;
+               memcpy_toio(remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), par->saved_extmem, memsize);
+               vfree(par->saved_extmem);
+       }
+       if (par->saved_intmem) {
+               memsize=MEM_INT_SIZE;
+               if (par->extmem_active)
+                       memcpy_toio(remapped_fbuf + (W100_FB_BASE-MEM_INT_BASE_VALUE), par->saved_intmem, memsize);
+               else
+                       memcpy_toio(remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE), par->saved_intmem, memsize);
+               vfree(par->saved_intmem);
        }
 }
 
-
-static void w100fb_clear_buffer(void)
+static int w100fb_suspend(struct platform_device *dev, pm_message_t state)
 {
-       int i;
-       for (i = 0; i < W100_BUF_NUM; i++) {
-               kfree(gSaveImagePtr[i]);
-               gSaveImagePtr[i] = NULL;
-       }
-}
+       struct fb_info *info = platform_get_drvdata(dev);
+       struct w100fb_par *par=info->par;
+       struct w100_tg_info *tg = par->mach->tg;
 
+       w100fb_save_vidmem(par);
+       if(tg && tg->suspend)
+               tg->suspend(par);
+       w100_suspend(W100_SUSPEND_ALL);
+       par->blanked = 1;
 
-#ifdef CONFIG_PM
-static int w100fb_suspend(struct device *dev, pm_message_t state, u32 level)
-{
-       if (level == SUSPEND_POWER_DOWN) {
-               struct fb_info *info = dev_get_drvdata(dev);
-               struct w100fb_par *par=info->par;
-
-               w100fb_save_buffer();
-               lcdtg_suspend();
-               w100_suspend(W100_SUSPEND_ALL);
-               par->blanking_flag = 1;
-       }
        return 0;
 }
 
-static int w100fb_resume(struct device *dev, u32 level)
+static int w100fb_resume(struct platform_device *dev)
 {
-       if (level == RESUME_POWER_ON) {
-               struct fb_info *info = dev_get_drvdata(dev);
-               struct w100fb_par *par=info->par;
-
-               w100_resume();
-               w100fb_restore_buffer();
-               lcdtg_resume();
-               par->blanking_flag = 0;
-       }
+       struct fb_info *info = platform_get_drvdata(dev);
+       struct w100fb_par *par=info->par;
+       struct w100_tg_info *tg = par->mach->tg;
+
+       w100_hw_init(par);
+       w100fb_activate_var(par);
+       w100fb_restore_vidmem(par);
+       if(tg && tg->resume)
+               tg->resume(par);
+       par->blanked = 0;
+
        return 0;
 }
 #else
-#define w100fb_suspend NULL
-#define w100fb_resume  NULL
+#define w100fb_suspend  NULL
+#define w100fb_resume   NULL
 #endif
 
 
-int __init w100fb_probe(struct device *dev)
+int __init w100fb_probe(struct platform_device *pdev)
 {
+       int err = -EIO;
        struct w100fb_mach_info *inf;
-       struct fb_info *info;
+       struct fb_info *info = NULL;
        struct w100fb_par *par;
-       struct platform_device *pdev = to_platform_device(dev);
        struct resource *mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
+       unsigned int chip_id;
 
        if (!mem)
                return -EINVAL;
 
-       /* remap the areas we're going to use */
+       /* Remap the chip base address */
        remapped_base = ioremap_nocache(mem->start+W100_CFG_BASE, W100_CFG_LEN);
        if (remapped_base == NULL)
-               return -EIO;
+               goto out;
 
+       /* Map the register space */
        remapped_regs = ioremap_nocache(mem->start+W100_REG_BASE, W100_REG_LEN);
-       if (remapped_regs == NULL) {
-               iounmap(remapped_base);
-               return -EIO;
+       if (remapped_regs == NULL)
+               goto out;
+
+       /* Identify the chip */
+       printk("Found ");
+       chip_id = readl(remapped_regs + mmCHIP_ID);
+       switch(chip_id) {
+               case CHIP_ID_W100:  printk("w100");  break;
+               case CHIP_ID_W3200: printk("w3200"); break;
+               case CHIP_ID_W3220: printk("w3220"); break;
+               default:
+                       printk("Unknown imageon chip ID\n");
+                       err = -ENODEV;
+                       goto out;
        }
+       printk(" at 0x%08lx.\n", mem->start+W100_CFG_BASE);
 
-       remapped_fbuf = ioremap_nocache(mem->start+MEM_EXT_BASE_VALUE, REMAPPED_FB_LEN);
-       if (remapped_fbuf == NULL) {
-               iounmap(remapped_base);
-               iounmap(remapped_regs);
-               return -EIO;
-       }
+       /* Remap the framebuffer */
+       remapped_fbuf = ioremap_nocache(mem->start+MEM_WINDOW_BASE, MEM_WINDOW_SIZE);
+       if (remapped_fbuf == NULL)
+               goto out;
 
-       info=framebuffer_alloc(sizeof(struct w100fb_par), dev);
+       info=framebuffer_alloc(sizeof(struct w100fb_par), &pdev->dev);
        if (!info) {
-               iounmap(remapped_base);
-               iounmap(remapped_regs);
-               iounmap(remapped_fbuf);
-               return -ENOMEM;
+               err = -ENOMEM;
+               goto out;
        }
 
-       info->device=dev;
        par = info->par;
-       current_par=info->par;
-       dev_set_drvdata(dev, info);
-
-       inf = dev->platform_data;
-       par->phadadj = inf->phadadj;
-       par->comadj = inf->comadj;
-       par->fastsysclk_mode = 75;
-       par->lcdMode = LCD_MODE_INIT;
-       par->rotation_flag=0;
-       par->blanking_flag=0;
-       w100fb_ssp_send = inf->w100fb_ssp_send;
-
-       w100_hw_init();
-       w100_pwm_setup();
+       platform_set_drvdata(pdev, info);
+
+       inf = pdev->dev.platform_data;
+       par->chip_id = chip_id;
+       par->mach = inf;
+       par->fastpll_mode = 0;
+       par->blanked = 0;
+
+       par->pll_table=w100_get_xtal_table(inf->xtal_freq);
+       if (!par->pll_table) {
+               printk(KERN_ERR "No matching Xtal definition found\n");
+               err = -EINVAL;
+               goto out;
+       }
 
        info->pseudo_palette = kmalloc(sizeof (u32) * MAX_PALETTES, GFP_KERNEL);
        if (!info->pseudo_palette) {
-               iounmap(remapped_base);
-               iounmap(remapped_regs);
-               iounmap(remapped_fbuf);
-               return -ENOMEM;
+               err = -ENOMEM;
+               goto out;
        }
 
        info->fbops = &w100fb_ops;
-       info->flags = FBINFO_DEFAULT;
+       info->flags = FBINFO_DEFAULT | FBINFO_HWACCEL_COPYAREA |
+               FBINFO_HWACCEL_FILLRECT;
        info->node = -1;
-       info->screen_base = remapped_fbuf;
+       info->screen_base = remapped_fbuf + (W100_FB_BASE-MEM_WINDOW_BASE);
        info->screen_size = REMAPPED_FB_LEN;
 
-       info->var.xres = 640;
+       strcpy(info->fix.id, "w100fb");
+       info->fix.type = FB_TYPE_PACKED_PIXELS;
+       info->fix.type_aux = 0;
+       info->fix.accel = FB_ACCEL_NONE;
+       info->fix.smem_start = mem->start+W100_FB_BASE;
+       info->fix.mmio_start = mem->start+W100_REG_BASE;
+       info->fix.mmio_len = W100_REG_LEN;
+
+       if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
+               err = -ENOMEM;
+               goto out;
+       }
+
+       par->mode = &inf->modelist[0];
+       if(inf->init_mode & INIT_MODE_ROTATED) {
+               info->var.xres = par->mode->yres;
+               info->var.yres = par->mode->xres;
+       }
+       else {
+               info->var.xres = par->mode->xres;
+               info->var.yres = par->mode->yres;
+       }
+
+       if(inf->init_mode &= INIT_MODE_FLIPPED)
+               par->flip = 1;
+       else
+               par->flip = 0;
+
        info->var.xres_virtual = info->var.xres;
-       info->var.yres = 480;
        info->var.yres_virtual = info->var.yres;
-       info->var.pixclock = 0x04;      /* 171521; */
+       info->var.pixclock = 0x04;  /* 171521; */
        info->var.sync = 0;
        info->var.grayscale = 0;
        info->var.xoffset = info->var.yoffset = 0;
        info->var.accel_flags = 0;
        info->var.activate = FB_ACTIVATE_NOW;
 
-       strcpy(info->fix.id, "w100fb");
-       info->fix.type = FB_TYPE_PACKED_PIXELS;
-       info->fix.type_aux = 0;
-       info->fix.accel = FB_ACCEL_NONE;
-       info->fix.smem_start = mem->start+MEM_EXT_BASE_VALUE;
-       info->fix.mmio_start = mem->start+W100_REG_BASE;
-       info->fix.mmio_len = W100_REG_LEN;
+       w100_hw_init(par);
+
+       if (w100fb_check_var(&info->var, info) < 0) {
+               err = -EINVAL;
+               goto out;
+       }
 
-       w100fb_check_var(&info->var, info);
        w100fb_set_par(info);
 
        if (register_framebuffer(info) < 0) {
-               kfree(info->pseudo_palette);
-               iounmap(remapped_base);
-               iounmap(remapped_regs);
-               iounmap(remapped_fbuf);
-               return -EINVAL;
+               err = -EINVAL;
+               goto out;
        }
 
-       device_create_file(dev, &dev_attr_fastsysclk);
-       device_create_file(dev, &dev_attr_reg_read);
-       device_create_file(dev, &dev_attr_reg_write);
-       device_create_file(dev, &dev_attr_rotation);
+       device_create_file(&pdev->dev, &dev_attr_fastpllclk);
+       device_create_file(&pdev->dev, &dev_attr_reg_read);
+       device_create_file(&pdev->dev, &dev_attr_reg_write);
+       device_create_file(&pdev->dev, &dev_attr_flip);
 
        printk(KERN_INFO "fb%d: %s frame buffer device\n", info->node, info->fix.id);
        return 0;
+out:
+       fb_dealloc_cmap(&info->cmap);
+       kfree(info->pseudo_palette);
+       if (remapped_fbuf != NULL)
+               iounmap(remapped_fbuf);
+       if (remapped_regs != NULL)
+               iounmap(remapped_regs);
+       if (remapped_base != NULL)
+               iounmap(remapped_base);
+       if (info)
+               framebuffer_release(info);
+       return err;
 }
 
 
-static int w100fb_remove(struct device *dev)
+static int w100fb_remove(struct platform_device *pdev)
 {
-       struct fb_info *info = dev_get_drvdata(dev);
+       struct fb_info *info = platform_get_drvdata(pdev);
+       struct w100fb_par *par=info->par;
 
-       device_remove_file(dev, &dev_attr_fastsysclk);
-       device_remove_file(dev, &dev_attr_reg_read);
-       device_remove_file(dev, &dev_attr_reg_write);
-       device_remove_file(dev, &dev_attr_rotation);
+       device_remove_file(&pdev->dev, &dev_attr_fastpllclk);
+       device_remove_file(&pdev->dev, &dev_attr_reg_read);
+       device_remove_file(&pdev->dev, &dev_attr_reg_write);
+       device_remove_file(&pdev->dev, &dev_attr_flip);
 
        unregister_framebuffer(info);
 
-       w100fb_clear_buffer();
+       vfree(par->saved_intmem);
+       vfree(par->saved_extmem);
        kfree(info->pseudo_palette);
+       fb_dealloc_cmap(&info->cmap);
 
        iounmap(remapped_base);
        iounmap(remapped_regs);
@@ -721,10 +814,54 @@ static void w100_soft_reset(void)
        udelay(100);
 }
 
+static void w100_update_disable(void)
+{
+       union disp_db_buf_cntl_wr_u disp_db_buf_wr_cntl;
+
+       /* Prevent display updates */
+       disp_db_buf_wr_cntl.f.db_buf_cntl = 0x1e;
+       disp_db_buf_wr_cntl.f.update_db_buf = 0;
+       disp_db_buf_wr_cntl.f.en_db_buf = 0;
+       writel((u32) (disp_db_buf_wr_cntl.val), remapped_regs + mmDISP_DB_BUF_CNTL);
+}
+
+static void w100_update_enable(void)
+{
+       union disp_db_buf_cntl_wr_u disp_db_buf_wr_cntl;
+
+       /* Enable display updates */
+       disp_db_buf_wr_cntl.f.db_buf_cntl = 0x1e;
+       disp_db_buf_wr_cntl.f.update_db_buf = 1;
+       disp_db_buf_wr_cntl.f.en_db_buf = 1;
+       writel((u32) (disp_db_buf_wr_cntl.val), remapped_regs + mmDISP_DB_BUF_CNTL);
+}
+
+unsigned long w100fb_gpio_read(int port)
+{
+       unsigned long value;
+
+       if (port==W100_GPIO_PORT_A)
+               value = readl(remapped_regs + mmGPIO_DATA);
+       else
+               value = readl(remapped_regs + mmGPIO_DATA2);
+
+       return value;
+}
+
+void w100fb_gpio_write(int port, unsigned long value)
+{
+       if (port==W100_GPIO_PORT_A)
+               value = writel(value, remapped_regs + mmGPIO_DATA);
+       else
+               value = writel(value, remapped_regs + mmGPIO_DATA2);
+}
+EXPORT_SYMBOL(w100fb_gpio_read);
+EXPORT_SYMBOL(w100fb_gpio_write);
+
 /*
  * Initialization of critical w100 hardware
  */
-static void w100_hw_init(void)
+static void w100_hw_init(struct w100fb_par *par)
 {
        u32 temp32;
        union cif_cntl_u cif_cntl;
@@ -735,8 +872,8 @@ static void w100_hw_init(void)
        union cpu_defaults_u cpu_default;
        union cif_write_dbg_u cif_write_dbg;
        union wrap_start_dir_u wrap_start_dir;
-       union mc_ext_mem_location_u mc_ext_mem_loc;
        union cif_io_u cif_io;
+       struct w100_gpio_regs *gpio = par->mach->gpio;
 
        w100_soft_reset();
 
@@ -791,19 +928,6 @@ static void w100_hw_init(void)
        cfgreg_base.f.cfgreg_base = W100_CFG_BASE;
        writel((u32) (cfgreg_base.val), remapped_regs + mmCFGREG_BASE);
 
-       /* This location is relative to internal w100 addresses */
-       writel(0x15FF1000, remapped_regs + mmMC_FB_LOCATION);
-
-       mc_ext_mem_loc.val = defMC_EXT_MEM_LOCATION;
-       mc_ext_mem_loc.f.mc_ext_mem_start = MEM_EXT_BASE_VALUE >> 8;
-       mc_ext_mem_loc.f.mc_ext_mem_top = MEM_EXT_TOP_VALUE >> 8;
-       writel((u32) (mc_ext_mem_loc.val), remapped_regs + mmMC_EXT_MEM_LOCATION);
-
-       if ((current_par->lcdMode == LCD_MODE_240) || (current_par->lcdMode == LCD_MODE_320))
-               w100_InitExtMem(LCD_SHARP_QVGA);
-       else
-               w100_InitExtMem(LCD_SHARP_VGA);
-
        wrap_start_dir.val = defWRAP_START_DIR;
        wrap_start_dir.f.start_addr = WRAP_BUF_BASE_VALUE >> 1;
        writel((u32) (wrap_start_dir.val), remapped_regs + mmWRAP_START_DIR);
@@ -813,21 +937,24 @@ static void w100_hw_init(void)
        writel((u32) (wrap_top_dir.val), remapped_regs + mmWRAP_TOP_DIR);
 
        writel((u32) 0x2440, remapped_regs + mmRBBM_CNTL);
-}
 
+       /* Set the hardware to 565 colour */
+       temp32 = readl(remapped_regs + mmDISP_DEBUG2);
+       temp32 &= 0xff7fffff;
+       temp32 |= 0x00800000;
+       writel(temp32, remapped_regs + mmDISP_DEBUG2);
 
-/*
- * Types
- */
+       /* Initialise the GPIO lines */
+       if (gpio) {
+               writel(gpio->init_data1, remapped_regs + mmGPIO_DATA);
+               writel(gpio->init_data2, remapped_regs + mmGPIO_DATA2);
+               writel(gpio->gpio_dir1,  remapped_regs + mmGPIO_CNTL1);
+               writel(gpio->gpio_oe1,   remapped_regs + mmGPIO_CNTL2);
+               writel(gpio->gpio_dir2,  remapped_regs + mmGPIO_CNTL3);
+               writel(gpio->gpio_oe2,   remapped_regs + mmGPIO_CNTL4);
+       }
+}
 
-struct pll_parm {
-       u16 freq;               /* desired Fout for PLL */
-       u8 M;
-       u8 N_int;
-       u8 N_fac;
-       u8 tfgoal;
-       u8 lock_time;
-};
 
 struct power_state {
        union clk_pin_cntl_u clk_pin_cntl;
@@ -835,317 +962,275 @@ struct power_state {
        union pll_cntl_u pll_cntl;
        union sclk_cntl_u sclk_cntl;
        union pclk_cntl_u pclk_cntl;
-       union clk_test_cntl_u clk_test_cntl;
        union pwrmgt_cntl_u pwrmgt_cntl;
-       u32 freq;               /* Fout for PLL calibration */
-       u8 tf100;               /* for pll calibration */
-       u8 tf80;                /* for pll calibration */
-       u8 tf20;                /* for pll calibration */
-       u8 M;                   /* for pll calibration */
-       u8 N_int;               /* for pll calibration */
-       u8 N_fac;               /* for pll calibration */
-       u8 lock_time;   /* for pll calibration */
-       u8 tfgoal;              /* for pll calibration */
-       u8 auto_mode;   /* hardware auto switch? */
-       u8 pwm_mode;            /* 0 fast, 1 normal/slow */
-       u16 fast_sclk;  /* fast clk freq */
-       u16 norm_sclk;  /* slow clk freq */
+       int auto_mode;  /* system clock auto changing? */
 };
 
 
-/*
- * Global state variables
- */
-
 static struct power_state w100_pwr_state;
 
-/* This table is specific for 12.5MHz ref crystal.  */
-static struct pll_parm gPLLTable[] = {
-    /*freq     M   N_int    N_fac  tfgoal  lock_time */
-    { 50,      0,   1,       0,     0xE0,        56}, /*  50.00 MHz */
-    { 75,      0,   5,       0,     0xDE,           37}, /*  75.00 MHz */
-    {100,      0,   7,       0,     0xE0,        28}, /* 100.00 MHz */
-    {125,      0,   9,       0,     0xE0,        22}, /* 125.00 MHz */
-    {150,      0,   11,      0,     0xE0,        17}, /* 150.00 MHz */
-    {  0,      0,   0,       0,        0,         0}  /* Terminator */
+/* The PLL Fout is determined by (XtalFreq/(M+1)) * ((N_int+1) + (N_fac/8)) */
+
+/* 12.5MHz Crystal PLL Table */
+static struct w100_pll_info xtal_12500000[] = {
+       /*freq     M   N_int    N_fac  tfgoal  lock_time */
+       { 50,      0,   1,       0,     0xe0,        56},  /*  50.00 MHz */
+       { 75,      0,   5,       0,     0xde,        37},  /*  75.00 MHz */
+       {100,      0,   7,       0,     0xe0,        28},  /* 100.00 MHz */
+       {125,      0,   9,       0,     0xe0,        22},  /* 125.00 MHz */
+       {150,      0,   11,      0,     0xe0,        17},  /* 150.00 MHz */
+       {  0,      0,   0,       0,        0,         0},  /* Terminator */
 };
 
+/* 14.318MHz Crystal PLL Table */
+static struct w100_pll_info xtal_14318000[] = {
+       /*freq     M   N_int    N_fac  tfgoal  lock_time */
+       { 40,      4,   13,      0,     0xe0,        80}, /* tfgoal guessed */
+       { 50,      1,   6,       0,     0xe0,        64}, /*  50.05 MHz */
+       { 57,      2,   11,      0,     0xe0,        53}, /* tfgoal guessed */
+       { 75,      0,   4,       3,     0xe0,        43}, /*  75.08 MHz */
+       {100,      0,   6,       0,     0xe0,        32}, /* 100.10 MHz */
+       {  0,      0,   0,       0,        0,         0},
+};
 
-static u8 w100_pll_get_testcount(u8 testclk_sel)
+/* 16MHz Crystal PLL Table */
+static struct w100_pll_info xtal_16000000[] = {
+       /*freq     M   N_int    N_fac  tfgoal  lock_time */
+       { 72,      1,   8,       0,     0xe0,        48}, /* tfgoal guessed */
+       { 95,      1,   10,      7,     0xe0,        38}, /* tfgoal guessed */
+       { 96,      1,   11,      0,     0xe0,        36}, /* tfgoal guessed */
+       {  0,      0,   0,       0,        0,         0},
+};
+
+static struct pll_entries {
+       int xtal_freq;
+       struct w100_pll_info *pll_table;
+} w100_pll_tables[] = {
+       { 12500000, &xtal_12500000[0] },
+       { 14318000, &xtal_14318000[0] },
+       { 16000000, &xtal_16000000[0] },
+       { 0 },
+};
+
+struct w100_pll_info *w100_get_xtal_table(unsigned int freq)
 {
+       struct pll_entries *pll_entry = w100_pll_tables;
+
+       do {
+               if (freq == pll_entry->xtal_freq)
+                       return pll_entry->pll_table;
+               pll_entry++;
+       } while (pll_entry->xtal_freq);
+       return 0;
+}
+
+
+static unsigned int w100_get_testcount(unsigned int testclk_sel)
+{
+       union clk_test_cntl_u clk_test_cntl;
+
        udelay(5);
 
-       w100_pwr_state.clk_test_cntl.f.start_check_freq = 0x0;
-       w100_pwr_state.clk_test_cntl.f.testclk_sel = testclk_sel;
-       w100_pwr_state.clk_test_cntl.f.tstcount_rst = 0x1;      /*reset test count */
-       writel((u32) (w100_pwr_state.clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
-       w100_pwr_state.clk_test_cntl.f.tstcount_rst = 0x0;
-       writel((u32) (w100_pwr_state.clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
+       /* Select the test clock source and reset */
+       clk_test_cntl.f.start_check_freq = 0x0;
+       clk_test_cntl.f.testclk_sel = testclk_sel;
+       clk_test_cntl.f.tstcount_rst = 0x1; /* set reset */
+       writel((u32) (clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
 
-       w100_pwr_state.clk_test_cntl.f.start_check_freq = 0x1;
-       writel((u32) (w100_pwr_state.clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
+       clk_test_cntl.f.tstcount_rst = 0x0; /* clear reset */
+       writel((u32) (clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
 
+       /* Run clock test */
+       clk_test_cntl.f.start_check_freq = 0x1;
+       writel((u32) (clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
+
+       /* Give the test time to complete */
        udelay(20);
 
-       w100_pwr_state.clk_test_cntl.val = readl(remapped_regs + mmCLK_TEST_CNTL);
-       w100_pwr_state.clk_test_cntl.f.start_check_freq = 0x0;
-       writel((u32) (w100_pwr_state.clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
+       /* Return the result */
+       clk_test_cntl.val = readl(remapped_regs + mmCLK_TEST_CNTL);
+       clk_test_cntl.f.start_check_freq = 0x0;
+       writel((u32) (clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
 
-       return w100_pwr_state.clk_test_cntl.f.test_count;
+       return clk_test_cntl.f.test_count;
 }
 
 
-static u8 w100_pll_adjust(void)
+static int w100_pll_adjust(struct w100_pll_info *pll)
 {
+       unsigned int tf80;
+       unsigned int tf20;
+
+       /* Initial Settings */
+       w100_pwr_state.pll_cntl.f.pll_pwdn = 0x0;     /* power down */
+       w100_pwr_state.pll_cntl.f.pll_reset = 0x0;    /* not reset */
+       w100_pwr_state.pll_cntl.f.pll_tcpoff = 0x1;   /* Hi-Z */
+       w100_pwr_state.pll_cntl.f.pll_pvg = 0x0;      /* VCO gain = 0 */
+       w100_pwr_state.pll_cntl.f.pll_vcofr = 0x0;    /* VCO frequency range control = off */
+       w100_pwr_state.pll_cntl.f.pll_ioffset = 0x0;  /* current offset inside VCO = 0 */
+       w100_pwr_state.pll_cntl.f.pll_ring_off = 0x0;
+
+       /* Wai Ming 80 percent of VDD 1.3V gives 1.04V, minimum operating voltage is 1.08V
+        * therefore, commented out the following lines
+        * tf80 meant tf100
+        */
        do {
-               /* Wai Ming 80 percent of VDD 1.3V gives 1.04V, minimum operating voltage is 1.08V
-                * therefore, commented out the following lines
-                * tf80 meant tf100
-                * set VCO input = 0.8 * VDD
-                */
+               /* set VCO input = 0.8 * VDD */
                w100_pwr_state.pll_cntl.f.pll_dactal = 0xd;
                writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
 
-               w100_pwr_state.tf80 = w100_pll_get_testcount(0x1);      /* PLLCLK */
-               if (w100_pwr_state.tf80 >= (w100_pwr_state.tfgoal)) {
+               tf80 = w100_get_testcount(TESTCLK_SRC_PLL);
+               if (tf80 >= (pll->tfgoal)) {
                        /* set VCO input = 0.2 * VDD */
                        w100_pwr_state.pll_cntl.f.pll_dactal = 0x7;
                        writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
 
-                       w100_pwr_state.tf20 = w100_pll_get_testcount(0x1);      /* PLLCLK */
-                       if (w100_pwr_state.tf20 <= (w100_pwr_state.tfgoal))
-                               return 1; // Success
+                       tf20 = w100_get_testcount(TESTCLK_SRC_PLL);
+                       if (tf20 <= (pll->tfgoal))
+                               return 1;  /* Success */
 
                        if ((w100_pwr_state.pll_cntl.f.pll_vcofr == 0x0) &&
-                           ((w100_pwr_state.pll_cntl.f.pll_pvg == 0x7) ||
-                            (w100_pwr_state.pll_cntl.f.pll_ioffset == 0x0))) {
+                               ((w100_pwr_state.pll_cntl.f.pll_pvg == 0x7) ||
+                               (w100_pwr_state.pll_cntl.f.pll_ioffset == 0x0))) {
                                /* slow VCO config */
                                w100_pwr_state.pll_cntl.f.pll_vcofr = 0x1;
                                w100_pwr_state.pll_cntl.f.pll_pvg = 0x0;
                                w100_pwr_state.pll_cntl.f.pll_ioffset = 0x0;
-                               writel((u32) (w100_pwr_state.pll_cntl.val),
-                                       remapped_regs + mmPLL_CNTL);
                                continue;
                        }
                }
                if ((w100_pwr_state.pll_cntl.f.pll_ioffset) < 0x3) {
                        w100_pwr_state.pll_cntl.f.pll_ioffset += 0x1;
-                       writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
-                       continue;
-               }
-               if ((w100_pwr_state.pll_cntl.f.pll_pvg) < 0x7) {
+               } else if ((w100_pwr_state.pll_cntl.f.pll_pvg) < 0x7) {
                        w100_pwr_state.pll_cntl.f.pll_ioffset = 0x0;
                        w100_pwr_state.pll_cntl.f.pll_pvg += 0x1;
-                       writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
-                       continue;
+               } else {
+                       return 0;  /* Error */
                }
-               return 0; // error
        } while(1);
 }
 
 
 /*
  * w100_pll_calibration
- *                freq = target frequency of the PLL
- *                (note: crystal = 14.3MHz)
  */
-static u8 w100_pll_calibration(u32 freq)
+static int w100_pll_calibration(struct w100_pll_info *pll)
 {
-       u8 status;
-
-       /* initial setting */
-       w100_pwr_state.pll_cntl.f.pll_pwdn = 0x0;               /* power down */
-       w100_pwr_state.pll_cntl.f.pll_reset = 0x0;              /* not reset */
-       w100_pwr_state.pll_cntl.f.pll_tcpoff = 0x1;     /* Hi-Z */
-       w100_pwr_state.pll_cntl.f.pll_pvg = 0x0;                /* VCO gain = 0 */
-       w100_pwr_state.pll_cntl.f.pll_vcofr = 0x0;              /* VCO frequency range control = off */
-       w100_pwr_state.pll_cntl.f.pll_ioffset = 0x0;    /* current offset inside VCO = 0 */
-       w100_pwr_state.pll_cntl.f.pll_ring_off = 0x0;
-       writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
+       int status;
 
-       /* check for (tf80 >= tfgoal) && (tf20 =< tfgoal) */
-       if ((w100_pwr_state.tf80 < w100_pwr_state.tfgoal) || (w100_pwr_state.tf20 > w100_pwr_state.tfgoal)) {
-               status=w100_pll_adjust();
-       }
-       /* PLL Reset And Lock */
+       status = w100_pll_adjust(pll);
 
+       /* PLL Reset And Lock */
        /* set VCO input = 0.5 * VDD */
        w100_pwr_state.pll_cntl.f.pll_dactal = 0xa;
        writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
 
-       /* reset time */
-       udelay(1);
+       udelay(1);  /* reset time */
 
        /* enable charge pump */
-       w100_pwr_state.pll_cntl.f.pll_tcpoff = 0x0;     /* normal */
+       w100_pwr_state.pll_cntl.f.pll_tcpoff = 0x0;  /* normal */
        writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
 
-       /* set VCO input = Hi-Z */
-       /* disable DAC */
+       /* set VCO input = Hi-Z, disable DAC */
        w100_pwr_state.pll_cntl.f.pll_dactal = 0x0;
        writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
 
-       /* lock time */
-       udelay(400);    /* delay 400 us */
+       udelay(400);  /* lock time */
 
        /* PLL locked */
 
-       w100_pwr_state.sclk_cntl.f.sclk_src_sel = 0x1;  /* PLL clock */
-       writel((u32) (w100_pwr_state.sclk_cntl.val), remapped_regs + mmSCLK_CNTL);
-
-       w100_pwr_state.tf100 = w100_pll_get_testcount(0x1);     /* PLLCLK */
-
        return status;
 }
 
 
-static u8 w100_pll_set_clk(void)
+static int w100_pll_set_clk(struct w100_pll_info *pll)
 {
-       u8 status;
+       int status;
 
-       if (w100_pwr_state.auto_mode == 1)      /* auto mode */
+       if (w100_pwr_state.auto_mode == 1)  /* auto mode */
        {
-               w100_pwr_state.pwrmgt_cntl.f.pwm_fast_noml_hw_en = 0x0; /* disable fast to normal */
-               w100_pwr_state.pwrmgt_cntl.f.pwm_noml_fast_hw_en = 0x0; /* disable normal to fast */
+               w100_pwr_state.pwrmgt_cntl.f.pwm_fast_noml_hw_en = 0x0;  /* disable fast to normal */
+               w100_pwr_state.pwrmgt_cntl.f.pwm_noml_fast_hw_en = 0x0;  /* disable normal to fast */
                writel((u32) (w100_pwr_state.pwrmgt_cntl.val), remapped_regs + mmPWRMGT_CNTL);
        }
 
-       w100_pwr_state.sclk_cntl.f.sclk_src_sel = 0x0;  /* crystal clock */
+       /* Set system clock source to XTAL whilst adjusting the PLL! */
+       w100_pwr_state.sclk_cntl.f.sclk_src_sel = CLK_SRC_XTAL;
        writel((u32) (w100_pwr_state.sclk_cntl.val), remapped_regs + mmSCLK_CNTL);
 
-       w100_pwr_state.pll_ref_fb_div.f.pll_ref_div = w100_pwr_state.M;
-       w100_pwr_state.pll_ref_fb_div.f.pll_fb_div_int = w100_pwr_state.N_int;
-       w100_pwr_state.pll_ref_fb_div.f.pll_fb_div_frac = w100_pwr_state.N_fac;
-       w100_pwr_state.pll_ref_fb_div.f.pll_lock_time = w100_pwr_state.lock_time;
+       w100_pwr_state.pll_ref_fb_div.f.pll_ref_div = pll->M;
+       w100_pwr_state.pll_ref_fb_div.f.pll_fb_div_int = pll->N_int;
+       w100_pwr_state.pll_ref_fb_div.f.pll_fb_div_frac = pll->N_fac;
+       w100_pwr_state.pll_ref_fb_div.f.pll_lock_time = pll->lock_time;
        writel((u32) (w100_pwr_state.pll_ref_fb_div.val), remapped_regs + mmPLL_REF_FB_DIV);
 
        w100_pwr_state.pwrmgt_cntl.f.pwm_mode_req = 0;
        writel((u32) (w100_pwr_state.pwrmgt_cntl.val), remapped_regs + mmPWRMGT_CNTL);
 
-       status = w100_pll_calibration (w100_pwr_state.freq);
+       status = w100_pll_calibration(pll);
 
-       if (w100_pwr_state.auto_mode == 1)      /* auto mode */
+       if (w100_pwr_state.auto_mode == 1)  /* auto mode */
        {
-               w100_pwr_state.pwrmgt_cntl.f.pwm_fast_noml_hw_en = 0x1; /* reenable fast to normal */
-               w100_pwr_state.pwrmgt_cntl.f.pwm_noml_fast_hw_en = 0x1; /* reenable normal to fast  */
+               w100_pwr_state.pwrmgt_cntl.f.pwm_fast_noml_hw_en = 0x1;  /* reenable fast to normal */
+               w100_pwr_state.pwrmgt_cntl.f.pwm_noml_fast_hw_en = 0x1;  /* reenable normal to fast  */
                writel((u32) (w100_pwr_state.pwrmgt_cntl.val), remapped_regs + mmPWRMGT_CNTL);
        }
        return status;
 }
 
-
-/* assume reference crystal clk is 12.5MHz,
- * and that doubling is not enabled.
- *
- * Freq = 12 == 12.5MHz.
- */
-static u16 w100_set_slowsysclk(u16 freq)
-{
-       if (w100_pwr_state.norm_sclk == freq)
-               return freq;
-
-       if (w100_pwr_state.auto_mode == 1)      /* auto mode */
-               return 0;
-
-       if (freq == 12) {
-               w100_pwr_state.norm_sclk = freq;
-               w100_pwr_state.sclk_cntl.f.sclk_post_div_slow = 0x0;    /* Pslow = 1 */
-               w100_pwr_state.sclk_cntl.f.sclk_src_sel = 0x0;  /* crystal src */
-
-               writel((u32) (w100_pwr_state.sclk_cntl.val), remapped_regs + mmSCLK_CNTL);
-
-               w100_pwr_state.clk_pin_cntl.f.xtalin_pm_en = 0x1;
-               writel((u32) (w100_pwr_state.clk_pin_cntl.val), remapped_regs + mmCLK_PIN_CNTL);
-
-               w100_pwr_state.pwrmgt_cntl.f.pwm_enable = 0x1;
-               w100_pwr_state.pwrmgt_cntl.f.pwm_mode_req = 0x1;
-               writel((u32) (w100_pwr_state.pwrmgt_cntl.val), remapped_regs + mmPWRMGT_CNTL);
-               w100_pwr_state.pwm_mode = 1;    /* normal mode */
-               return freq;
-       } else
-               return 0;
-}
-
-
-static u16 w100_set_fastsysclk(u16 freq)
+/* freq = target frequency of the PLL */
+static int w100_set_pll_freq(struct w100fb_par *par, unsigned int freq)
 {
-       u16 pll_freq;
-       int i;
-
-       while(1) {
-               pll_freq = (u16) (freq * (w100_pwr_state.sclk_cntl.f.sclk_post_div_fast + 1));
-               i = 0;
-               do {
-                       if (pll_freq == gPLLTable[i].freq) {
-                               w100_pwr_state.freq = gPLLTable[i].freq * 1000000;
-                               w100_pwr_state.M = gPLLTable[i].M;
-                               w100_pwr_state.N_int = gPLLTable[i].N_int;
-                               w100_pwr_state.N_fac = gPLLTable[i].N_fac;
-                               w100_pwr_state.tfgoal = gPLLTable[i].tfgoal;
-                               w100_pwr_state.lock_time = gPLLTable[i].lock_time;
-                               w100_pwr_state.tf20 = 0xff;     /* set highest */
-                               w100_pwr_state.tf80 = 0x00;     /* set lowest */
-
-                               w100_pll_set_clk();
-                               w100_pwr_state.pwm_mode = 0;    /* fast mode */
-                               w100_pwr_state.fast_sclk = freq;
-                               return freq;
-                       }
-                       i++;
-               } while(gPLLTable[i].freq);
-
-               if (w100_pwr_state.auto_mode == 1)
-                       break;
-
-               if (w100_pwr_state.sclk_cntl.f.sclk_post_div_fast == 0)
-                       break;
+       struct w100_pll_info *pll = par->pll_table;
 
-               w100_pwr_state.sclk_cntl.f.sclk_post_div_fast -= 1;
-               writel((u32) (w100_pwr_state.sclk_cntl.val), remapped_regs + mmSCLK_CNTL);
-       }
+       do {
+               if (freq == pll->freq) {
+                       return w100_pll_set_clk(pll);
+               }
+               pll++;
+       } while(pll->freq);
        return 0;
 }
 
-
 /* Set up an initial state.  Some values/fields set
    here will be overwritten. */
-static void w100_pwm_setup(void)
+static void w100_pwm_setup(struct w100fb_par *par)
 {
        w100_pwr_state.clk_pin_cntl.f.osc_en = 0x1;
        w100_pwr_state.clk_pin_cntl.f.osc_gain = 0x1f;
        w100_pwr_state.clk_pin_cntl.f.dont_use_xtalin = 0x0;
        w100_pwr_state.clk_pin_cntl.f.xtalin_pm_en = 0x0;
-       w100_pwr_state.clk_pin_cntl.f.xtalin_dbl_en = 0x0;      /* no freq doubling */
+       w100_pwr_state.clk_pin_cntl.f.xtalin_dbl_en = par->mach->xtal_dbl ? 1 : 0;
        w100_pwr_state.clk_pin_cntl.f.cg_debug = 0x0;
        writel((u32) (w100_pwr_state.clk_pin_cntl.val), remapped_regs + mmCLK_PIN_CNTL);
 
-       w100_pwr_state.sclk_cntl.f.sclk_src_sel = 0x0;  /* Crystal Clk */
-       w100_pwr_state.sclk_cntl.f.sclk_post_div_fast = 0x0;    /* Pfast = 1 */
+       w100_pwr_state.sclk_cntl.f.sclk_src_sel = CLK_SRC_XTAL;
+       w100_pwr_state.sclk_cntl.f.sclk_post_div_fast = 0x0;  /* Pfast = 1 */
        w100_pwr_state.sclk_cntl.f.sclk_clkon_hys = 0x3;
-       w100_pwr_state.sclk_cntl.f.sclk_post_div_slow = 0x0;    /* Pslow = 1 */
+       w100_pwr_state.sclk_cntl.f.sclk_post_div_slow = 0x0;  /* Pslow = 1 */
        w100_pwr_state.sclk_cntl.f.disp_cg_ok2switch_en = 0x0;
-       w100_pwr_state.sclk_cntl.f.sclk_force_reg = 0x0;        /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_disp = 0x0;       /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_mc = 0x0; /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_extmc = 0x0;      /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_cp = 0x0; /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_e2 = 0x0; /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_e3 = 0x0; /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_idct = 0x0;       /* Dynamic */
-       w100_pwr_state.sclk_cntl.f.sclk_force_bist = 0x0;       /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_reg = 0x0;    /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_disp = 0x0;   /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_mc = 0x0;     /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_extmc = 0x0;  /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_cp = 0x0;     /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_e2 = 0x0;     /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_e3 = 0x0;     /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_idct = 0x0;   /* Dynamic */
+       w100_pwr_state.sclk_cntl.f.sclk_force_bist = 0x0;   /* Dynamic */
        w100_pwr_state.sclk_cntl.f.busy_extend_cp = 0x0;
        w100_pwr_state.sclk_cntl.f.busy_extend_e2 = 0x0;
        w100_pwr_state.sclk_cntl.f.busy_extend_e3 = 0x0;
        w100_pwr_state.sclk_cntl.f.busy_extend_idct = 0x0;
        writel((u32) (w100_pwr_state.sclk_cntl.val), remapped_regs + mmSCLK_CNTL);
 
-       w100_pwr_state.pclk_cntl.f.pclk_src_sel = 0x0;  /* Crystal Clk */
-       w100_pwr_state.pclk_cntl.f.pclk_post_div = 0x1; /* P = 2 */
-       w100_pwr_state.pclk_cntl.f.pclk_force_disp = 0x0;       /* Dynamic */
+       w100_pwr_state.pclk_cntl.f.pclk_src_sel = CLK_SRC_XTAL;
+       w100_pwr_state.pclk_cntl.f.pclk_post_div = 0x1;    /* P = 2 */
+       w100_pwr_state.pclk_cntl.f.pclk_force_disp = 0x0;  /* Dynamic */
        writel((u32) (w100_pwr_state.pclk_cntl.val), remapped_regs + mmPCLK_CNTL);
 
-       w100_pwr_state.pll_ref_fb_div.f.pll_ref_div = 0x0;      /* M = 1 */
-       w100_pwr_state.pll_ref_fb_div.f.pll_fb_div_int = 0x0;   /* N = 1.0 */
+       w100_pwr_state.pll_ref_fb_div.f.pll_ref_div = 0x0;     /* M = 1 */
+       w100_pwr_state.pll_ref_fb_div.f.pll_fb_div_int = 0x0;  /* N = 1.0 */
        w100_pwr_state.pll_ref_fb_div.f.pll_fb_div_frac = 0x0;
        w100_pwr_state.pll_ref_fb_div.f.pll_reset_time = 0x5;
        w100_pwr_state.pll_ref_fb_div.f.pll_lock_time = 0xff;
@@ -1154,7 +1239,7 @@ static void w100_pwm_setup(void)
        w100_pwr_state.pll_cntl.f.pll_pwdn = 0x1;
        w100_pwr_state.pll_cntl.f.pll_reset = 0x1;
        w100_pwr_state.pll_cntl.f.pll_pm_en = 0x0;
-       w100_pwr_state.pll_cntl.f.pll_mode = 0x0;       /* uses VCO clock */
+       w100_pwr_state.pll_cntl.f.pll_mode = 0x0;  /* uses VCO clock */
        w100_pwr_state.pll_cntl.f.pll_refclk_sel = 0x0;
        w100_pwr_state.pll_cntl.f.pll_fbclk_sel = 0x0;
        w100_pwr_state.pll_cntl.f.pll_tcpoff = 0x0;
@@ -1164,220 +1249,275 @@ static void w100_pwm_setup(void)
        w100_pwr_state.pll_cntl.f.pll_ioffset = 0x0;
        w100_pwr_state.pll_cntl.f.pll_pecc_mode = 0x0;
        w100_pwr_state.pll_cntl.f.pll_pecc_scon = 0x0;
-       w100_pwr_state.pll_cntl.f.pll_dactal = 0x0;     /* Hi-Z */
+       w100_pwr_state.pll_cntl.f.pll_dactal = 0x0;  /* Hi-Z */
        w100_pwr_state.pll_cntl.f.pll_cp_clip = 0x3;
        w100_pwr_state.pll_cntl.f.pll_conf = 0x2;
        w100_pwr_state.pll_cntl.f.pll_mbctrl = 0x2;
        w100_pwr_state.pll_cntl.f.pll_ring_off = 0x0;
        writel((u32) (w100_pwr_state.pll_cntl.val), remapped_regs + mmPLL_CNTL);
 
-       w100_pwr_state.clk_test_cntl.f.testclk_sel = 0x1;       /* PLLCLK (for testing) */
-       w100_pwr_state.clk_test_cntl.f.start_check_freq = 0x0;
-       w100_pwr_state.clk_test_cntl.f.tstcount_rst = 0x0;
-       writel((u32) (w100_pwr_state.clk_test_cntl.val), remapped_regs + mmCLK_TEST_CNTL);
-
        w100_pwr_state.pwrmgt_cntl.f.pwm_enable = 0x0;
-       w100_pwr_state.pwrmgt_cntl.f.pwm_mode_req = 0x1;        /* normal mode (0, 1, 3) */
+       w100_pwr_state.pwrmgt_cntl.f.pwm_mode_req = 0x1;  /* normal mode (0, 1, 3) */
        w100_pwr_state.pwrmgt_cntl.f.pwm_wakeup_cond = 0x0;
        w100_pwr_state.pwrmgt_cntl.f.pwm_fast_noml_hw_en = 0x0;
        w100_pwr_state.pwrmgt_cntl.f.pwm_noml_fast_hw_en = 0x0;
-       w100_pwr_state.pwrmgt_cntl.f.pwm_fast_noml_cond = 0x1;  /* PM4,ENG */
-       w100_pwr_state.pwrmgt_cntl.f.pwm_noml_fast_cond = 0x1;  /* PM4,ENG */
+       w100_pwr_state.pwrmgt_cntl.f.pwm_fast_noml_cond = 0x1;  /* PM4,ENG */
+       w100_pwr_state.pwrmgt_cntl.f.pwm_noml_fast_cond = 0x1;  /* PM4,ENG */
        w100_pwr_state.pwrmgt_cntl.f.pwm_idle_timer = 0xFF;
        w100_pwr_state.pwrmgt_cntl.f.pwm_busy_timer = 0xFF;
        writel((u32) (w100_pwr_state.pwrmgt_cntl.val), remapped_regs + mmPWRMGT_CNTL);
 
-       w100_pwr_state.auto_mode = 0;   /* manual mode */
-       w100_pwr_state.pwm_mode = 1;    /* normal mode (0, 1, 2) */
-       w100_pwr_state.freq = 50000000; /* 50 MHz */
-       w100_pwr_state.M = 3;   /* M = 4 */
-       w100_pwr_state.N_int = 6;       /* N = 7.0 */
-       w100_pwr_state.N_fac = 0;
-       w100_pwr_state.tfgoal = 0xE0;
-       w100_pwr_state.lock_time = 56;
-       w100_pwr_state.tf20 = 0xff;     /* set highest */
-       w100_pwr_state.tf80 = 0x00;     /* set lowest */
-       w100_pwr_state.tf100 = 0x00;    /* set lowest */
-       w100_pwr_state.fast_sclk = 50;  /* 50.0 MHz */
-       w100_pwr_state.norm_sclk = 12;  /* 12.5 MHz */
+       w100_pwr_state.auto_mode = 0;  /* manual mode */
 }
 
 
-static void w100_init_sharp_lcd(u32 mode)
+/*
+ * Setup the w100 clocks for the specified mode
+ */
+static void w100_init_clocks(struct w100fb_par *par)
 {
-       u32 temp32;
-       union disp_db_buf_cntl_wr_u disp_db_buf_wr_cntl;
+       struct w100_mode *mode = par->mode;
 
-       /* Prevent display updates */
-       disp_db_buf_wr_cntl.f.db_buf_cntl = 0x1e;
-       disp_db_buf_wr_cntl.f.update_db_buf = 0;
-       disp_db_buf_wr_cntl.f.en_db_buf = 0;
-       writel((u32) (disp_db_buf_wr_cntl.val), remapped_regs + mmDISP_DB_BUF_CNTL);
+       if (mode->pixclk_src == CLK_SRC_PLL || mode->sysclk_src == CLK_SRC_PLL)
+               w100_set_pll_freq(par, (par->fastpll_mode && mode->fast_pll_freq) ? mode->fast_pll_freq : mode->pll_freq);
 
-       switch(mode) {
-       case LCD_SHARP_QVGA:
-               w100_set_slowsysclk(12);        /* use crystal -- 12.5MHz */
-               /* not use PLL */
-
-               writel(0x7FFF8000, remapped_regs + mmMC_EXT_MEM_LOCATION);
-               writel(0x85FF8000, remapped_regs + mmMC_FB_LOCATION);
-               writel(0x00000003, remapped_regs + mmLCD_FORMAT);
-               writel(0x00CF1C06, remapped_regs + mmGRAPHIC_CTRL);
-               writel(0x01410145, remapped_regs + mmCRTC_TOTAL);
-               writel(0x01170027, remapped_regs + mmACTIVE_H_DISP);
-               writel(0x01410001, remapped_regs + mmACTIVE_V_DISP);
-               writel(0x01170027, remapped_regs + mmGRAPHIC_H_DISP);
-               writel(0x01410001, remapped_regs + mmGRAPHIC_V_DISP);
-               writel(0x81170027, remapped_regs + mmCRTC_SS);
-               writel(0xA0140000, remapped_regs + mmCRTC_LS);
-               writel(0x00400008, remapped_regs + mmCRTC_REV);
-               writel(0xA0000000, remapped_regs + mmCRTC_DCLK);
-               writel(0xC0140014, remapped_regs + mmCRTC_GS);
-               writel(0x00010141, remapped_regs + mmCRTC_VPOS_GS);
-               writel(0x8015010F, remapped_regs + mmCRTC_GCLK);
-               writel(0x80100110, remapped_regs + mmCRTC_GOE);
-               writel(0x00000000, remapped_regs + mmCRTC_FRAME);
-               writel(0x00000000, remapped_regs + mmCRTC_FRAME_VPOS);
-               writel(0x01CC0000, remapped_regs + mmLCDD_CNTL1);
-               writel(0x0003FFFF, remapped_regs + mmLCDD_CNTL2);
-               writel(0x00FFFF0D, remapped_regs + mmGENLCD_CNTL1);
-               writel(0x003F3003, remapped_regs + mmGENLCD_CNTL2);
-               writel(0x00000000, remapped_regs + mmCRTC_DEFAULT_COUNT);
-               writel(0x0000FF00, remapped_regs + mmLCD_BACKGROUND_COLOR);
-               writel(0x000102aa, remapped_regs + mmGENLCD_CNTL3);
-               writel(0x00800000, remapped_regs + mmGRAPHIC_OFFSET);
-               writel(0x000001e0, remapped_regs + mmGRAPHIC_PITCH);
-               writel(0x000000bf, remapped_regs + mmGPIO_DATA);
-               writel(0x03c0feff, remapped_regs + mmGPIO_CNTL2);
-               writel(0x00000000, remapped_regs + mmGPIO_CNTL1);
-               writel(0x41060010, remapped_regs + mmCRTC_PS1_ACTIVE);
-               break;
-       case LCD_SHARP_VGA:
-               w100_set_slowsysclk(12);        /* use crystal -- 12.5MHz */
-               w100_set_fastsysclk(current_par->fastsysclk_mode);      /* use PLL -- 75.0MHz */
-               w100_pwr_state.pclk_cntl.f.pclk_src_sel = 0x1;
-               w100_pwr_state.pclk_cntl.f.pclk_post_div = 0x2;
-               writel((u32) (w100_pwr_state.pclk_cntl.val), remapped_regs + mmPCLK_CNTL);
-               writel(0x15FF1000, remapped_regs + mmMC_FB_LOCATION);
-               writel(0x9FFF8000, remapped_regs + mmMC_EXT_MEM_LOCATION);
-               writel(0x00000003, remapped_regs + mmLCD_FORMAT);
-               writel(0x00DE1D66, remapped_regs + mmGRAPHIC_CTRL);
-
-               writel(0x0283028B, remapped_regs + mmCRTC_TOTAL);
-               writel(0x02360056, remapped_regs + mmACTIVE_H_DISP);
-               writel(0x02830003, remapped_regs + mmACTIVE_V_DISP);
-               writel(0x02360056, remapped_regs + mmGRAPHIC_H_DISP);
-               writel(0x02830003, remapped_regs + mmGRAPHIC_V_DISP);
-               writel(0x82360056, remapped_regs + mmCRTC_SS);
-               writel(0xA0280000, remapped_regs + mmCRTC_LS);
-               writel(0x00400008, remapped_regs + mmCRTC_REV);
-               writel(0xA0000000, remapped_regs + mmCRTC_DCLK);
-               writel(0x80280028, remapped_regs + mmCRTC_GS);
-               writel(0x02830002, remapped_regs + mmCRTC_VPOS_GS);
-               writel(0x8015010F, remapped_regs + mmCRTC_GCLK);
-               writel(0x80100110, remapped_regs + mmCRTC_GOE);
-               writel(0x00000000, remapped_regs + mmCRTC_FRAME);
-               writel(0x00000000, remapped_regs + mmCRTC_FRAME_VPOS);
-               writel(0x01CC0000, remapped_regs + mmLCDD_CNTL1);
-               writel(0x0003FFFF, remapped_regs + mmLCDD_CNTL2);
-               writel(0x00FFFF0D, remapped_regs + mmGENLCD_CNTL1);
-               writel(0x003F3003, remapped_regs + mmGENLCD_CNTL2);
-               writel(0x00000000, remapped_regs + mmCRTC_DEFAULT_COUNT);
-               writel(0x0000FF00, remapped_regs + mmLCD_BACKGROUND_COLOR);
-               writel(0x000102aa, remapped_regs + mmGENLCD_CNTL3);
-               writel(0x00800000, remapped_regs + mmGRAPHIC_OFFSET);
-               writel(0x000003C0, remapped_regs + mmGRAPHIC_PITCH);
-               writel(0x000000bf, remapped_regs + mmGPIO_DATA);
-               writel(0x03c0feff, remapped_regs + mmGPIO_CNTL2);
-               writel(0x00000000, remapped_regs + mmGPIO_CNTL1);
-               writel(0x41060010, remapped_regs + mmCRTC_PS1_ACTIVE);
-               break;
-       default:
-               break;
-       }
+       w100_pwr_state.sclk_cntl.f.sclk_src_sel = mode->sysclk_src;
+       w100_pwr_state.sclk_cntl.f.sclk_post_div_fast = mode->sysclk_divider;
+       w100_pwr_state.sclk_cntl.f.sclk_post_div_slow = mode->sysclk_divider;
+       writel((u32) (w100_pwr_state.sclk_cntl.val), remapped_regs + mmSCLK_CNTL);
+}
+
+static void w100_init_lcd(struct w100fb_par *par)
+{
+       u32 temp32;
+       struct w100_mode *mode = par->mode;
+       struct w100_gen_regs *regs = par->mach->regs;
+       union active_h_disp_u active_h_disp;
+       union active_v_disp_u active_v_disp;
+       union graphic_h_disp_u graphic_h_disp;
+       union graphic_v_disp_u graphic_v_disp;
+       union crtc_total_u crtc_total;
+
+       /* w3200 doesnt like undefined bits being set so zero register values first */
+
+       active_h_disp.val = 0;
+       active_h_disp.f.active_h_start=mode->left_margin;
+       active_h_disp.f.active_h_end=mode->left_margin + mode->xres;
+       writel(active_h_disp.val, remapped_regs + mmACTIVE_H_DISP);
+
+       active_v_disp.val = 0;
+       active_v_disp.f.active_v_start=mode->upper_margin;
+       active_v_disp.f.active_v_end=mode->upper_margin + mode->yres;
+       writel(active_v_disp.val, remapped_regs + mmACTIVE_V_DISP);
+
+       graphic_h_disp.val = 0;
+       graphic_h_disp.f.graphic_h_start=mode->left_margin;
+       graphic_h_disp.f.graphic_h_end=mode->left_margin + mode->xres;
+       writel(graphic_h_disp.val, remapped_regs + mmGRAPHIC_H_DISP);
+
+       graphic_v_disp.val = 0;
+       graphic_v_disp.f.graphic_v_start=mode->upper_margin;
+       graphic_v_disp.f.graphic_v_end=mode->upper_margin + mode->yres;
+       writel(graphic_v_disp.val, remapped_regs + mmGRAPHIC_V_DISP);
+
+       crtc_total.val = 0;
+       crtc_total.f.crtc_h_total=mode->left_margin  + mode->xres + mode->right_margin;
+       crtc_total.f.crtc_v_total=mode->upper_margin + mode->yres + mode->lower_margin;
+       writel(crtc_total.val, remapped_regs + mmCRTC_TOTAL);
+
+       writel(mode->crtc_ss, remapped_regs + mmCRTC_SS);
+       writel(mode->crtc_ls, remapped_regs + mmCRTC_LS);
+       writel(mode->crtc_gs, remapped_regs + mmCRTC_GS);
+       writel(mode->crtc_vpos_gs, remapped_regs + mmCRTC_VPOS_GS);
+       writel(mode->crtc_rev, remapped_regs + mmCRTC_REV);
+       writel(mode->crtc_dclk, remapped_regs + mmCRTC_DCLK);
+       writel(mode->crtc_gclk, remapped_regs + mmCRTC_GCLK);
+       writel(mode->crtc_goe, remapped_regs + mmCRTC_GOE);
+       writel(mode->crtc_ps1_active, remapped_regs + mmCRTC_PS1_ACTIVE);
+
+       writel(regs->lcd_format, remapped_regs + mmLCD_FORMAT);
+       writel(regs->lcdd_cntl1, remapped_regs + mmLCDD_CNTL1);
+       writel(regs->lcdd_cntl2, remapped_regs + mmLCDD_CNTL2);
+       writel(regs->genlcd_cntl1, remapped_regs + mmGENLCD_CNTL1);
+       writel(regs->genlcd_cntl2, remapped_regs + mmGENLCD_CNTL2);
+       writel(regs->genlcd_cntl3, remapped_regs + mmGENLCD_CNTL3);
+
+       writel(0x00000000, remapped_regs + mmCRTC_FRAME);
+       writel(0x00000000, remapped_regs + mmCRTC_FRAME_VPOS);
+       writel(0x00000000, remapped_regs + mmCRTC_DEFAULT_COUNT);
+       writel(0x0000FF00, remapped_regs + mmLCD_BACKGROUND_COLOR);
 
        /* Hack for overlay in ext memory */
        temp32 = readl(remapped_regs + mmDISP_DEBUG2);
        temp32 |= 0xc0000000;
        writel(temp32, remapped_regs + mmDISP_DEBUG2);
-
-       /* Re-enable display updates */
-       disp_db_buf_wr_cntl.f.db_buf_cntl = 0x1e;
-       disp_db_buf_wr_cntl.f.update_db_buf = 1;
-       disp_db_buf_wr_cntl.f.en_db_buf = 1;
-       writel((u32) (disp_db_buf_wr_cntl.val), remapped_regs + mmDISP_DB_BUF_CNTL);
 }
 
 
-static void w100_set_vga_rotation_regs(u16 divider, unsigned long ctrl, unsigned long offset, unsigned long pitch)
+static void w100_setup_memory(struct w100fb_par *par)
 {
-       w100_pwr_state.pclk_cntl.f.pclk_src_sel = 0x1;
-       w100_pwr_state.pclk_cntl.f.pclk_post_div = divider;
-       writel((u32) (w100_pwr_state.pclk_cntl.val), remapped_regs + mmPCLK_CNTL);
+       union mc_ext_mem_location_u extmem_location;
+       union mc_fb_location_u intmem_location;
+       struct w100_mem_info *mem = par->mach->mem;
+       struct w100_bm_mem_info *bm_mem = par->mach->bm_mem;
 
-       writel(ctrl, remapped_regs + mmGRAPHIC_CTRL);
-       writel(offset, remapped_regs + mmGRAPHIC_OFFSET);
-       writel(pitch, remapped_regs + mmGRAPHIC_PITCH);
+       if (!par->extmem_active) {
+               w100_suspend(W100_SUSPEND_EXTMEM);
 
-       /* Re-enable display updates */
-       writel(0x0000007b, remapped_regs + mmDISP_DB_BUF_CNTL);
-}
+               /* Map Internal Memory at FB Base */
+               intmem_location.f.mc_fb_start = W100_FB_BASE >> 8;
+               intmem_location.f.mc_fb_top = (W100_FB_BASE+MEM_INT_SIZE) >> 8;
+               writel((u32) (intmem_location.val), remapped_regs + mmMC_FB_LOCATION);
 
+               /* Unmap External Memory - value is *probably* irrelevant but may have meaning
+                  to acceleration libraries */
+               extmem_location.f.mc_ext_mem_start = MEM_EXT_BASE_VALUE >> 8;
+               extmem_location.f.mc_ext_mem_top = (MEM_EXT_BASE_VALUE-1) >> 8;
+               writel((u32) (extmem_location.val), remapped_regs + mmMC_EXT_MEM_LOCATION);
+       } else {
+               /* Map Internal Memory to its default location */
+               intmem_location.f.mc_fb_start = MEM_INT_BASE_VALUE >> 8;
+               intmem_location.f.mc_fb_top = (MEM_INT_BASE_VALUE+MEM_INT_SIZE) >> 8;
+               writel((u32) (intmem_location.val), remapped_regs + mmMC_FB_LOCATION);
 
-static void w100_init_vga_rotation(u16 deg)
-{
-       switch(deg) {
-       case 0:
-               w100_set_vga_rotation_regs(0x02, 0x00DE1D66, 0x00800000, 0x000003c0);
-               break;
-       case 90:
-               w100_set_vga_rotation_regs(0x06, 0x00DE1D0e, 0x00895b00, 0x00000500);
-               break;
-       case 180:
-               w100_set_vga_rotation_regs(0x02, 0x00DE1D7e, 0x00895ffc, 0x000003c0);
-               break;
-       case 270:
-               w100_set_vga_rotation_regs(0x06, 0x00DE1D16, 0x008004fc, 0x00000500);
-               break;
-       default:
-               /* not-support */
-               break;
+               /* Map External Memory at FB Base */
+               extmem_location.f.mc_ext_mem_start = W100_FB_BASE >> 8;
+               extmem_location.f.mc_ext_mem_top = (W100_FB_BASE+par->mach->mem->size) >> 8;
+               writel((u32) (extmem_location.val), remapped_regs + mmMC_EXT_MEM_LOCATION);
+
+               writel(0x00007800, remapped_regs + mmMC_BIST_CTRL);
+               writel(mem->ext_cntl, remapped_regs + mmMEM_EXT_CNTL);
+               writel(0x00200021, remapped_regs + mmMEM_SDRAM_MODE_REG);
+               udelay(100);
+               writel(0x80200021, remapped_regs + mmMEM_SDRAM_MODE_REG);
+               udelay(100);
+               writel(mem->sdram_mode_reg, remapped_regs + mmMEM_SDRAM_MODE_REG);
+               udelay(100);
+               writel(mem->ext_timing_cntl, remapped_regs + mmMEM_EXT_TIMING_CNTL);
+               writel(mem->io_cntl, remapped_regs + mmMEM_IO_CNTL);
+               if (bm_mem) {
+                       writel(bm_mem->ext_mem_bw, remapped_regs + mmBM_EXT_MEM_BANDWIDTH);
+                       writel(bm_mem->offset, remapped_regs + mmBM_OFFSET);
+                       writel(bm_mem->ext_timing_ctl, remapped_regs + mmBM_MEM_EXT_TIMING_CNTL);
+                       writel(bm_mem->ext_cntl, remapped_regs + mmBM_MEM_EXT_CNTL);
+                       writel(bm_mem->mode_reg, remapped_regs + mmBM_MEM_MODE_REG);
+                       writel(bm_mem->io_cntl, remapped_regs + mmBM_MEM_IO_CNTL);
+                       writel(bm_mem->config, remapped_regs + mmBM_CONFIG);
+               }
        }
 }
 
-
-static void w100_set_qvga_rotation_regs(unsigned long ctrl, unsigned long offset, unsigned long pitch)
+static void w100_set_dispregs(struct w100fb_par *par)
 {
-       writel(ctrl, remapped_regs + mmGRAPHIC_CTRL);
-       writel(offset, remapped_regs + mmGRAPHIC_OFFSET);
-       writel(pitch, remapped_regs + mmGRAPHIC_PITCH);
+       unsigned long rot=0, divider, offset=0;
+       union graphic_ctrl_u graphic_ctrl;
+
+       /* See if the mode has been rotated */
+       if (par->xres == par->mode->xres) {
+               if (par->flip) {
+                       rot=3; /* 180 degree */
+                       offset=(par->xres * par->yres) - 1;
+               } /* else 0 degree */
+               divider = par->mode->pixclk_divider;
+       } else {
+               if (par->flip) {
+                       rot=2; /* 270 degree */
+                       offset=par->xres - 1;
+               } else {
+                       rot=1; /* 90 degree */
+                       offset=par->xres * (par->yres - 1);
+               }
+               divider = par->mode->pixclk_divider_rotated;
+       }
+
+       graphic_ctrl.val = 0; /* w32xx doesn't like undefined bits */
+       switch (par->chip_id) {
+               case CHIP_ID_W100:
+                       graphic_ctrl.f_w100.color_depth=6;
+                       graphic_ctrl.f_w100.en_crtc=1;
+                       graphic_ctrl.f_w100.en_graphic_req=1;
+                       graphic_ctrl.f_w100.en_graphic_crtc=1;
+                       graphic_ctrl.f_w100.lcd_pclk_on=1;
+                       graphic_ctrl.f_w100.lcd_sclk_on=1;
+                       graphic_ctrl.f_w100.low_power_on=0;
+                       graphic_ctrl.f_w100.req_freq=0;
+                       graphic_ctrl.f_w100.portrait_mode=rot;
+
+                       /* Zaurus needs this */
+                       switch(par->xres) {
+                               case 240:
+                               case 320:
+                               default:
+                                       graphic_ctrl.f_w100.total_req_graphic=0xa0;
+                                       break;
+                               case 480:
+                               case 640:
+                                       switch(rot) {
+                                               case 0:  /* 0 */
+                                               case 3:  /* 180 */
+                                                       graphic_ctrl.f_w100.low_power_on=1;
+                                                       graphic_ctrl.f_w100.req_freq=5;
+                                               break;
+                                               case 1:  /* 90 */
+                                               case 2:  /* 270 */
+                                                       graphic_ctrl.f_w100.req_freq=4;
+                                                       break;
+                                               default:
+                                                       break;
+                                       }
+                                       graphic_ctrl.f_w100.total_req_graphic=0xf0;
+                                       break;
+                       }
+                       break;
+               case CHIP_ID_W3200:
+               case CHIP_ID_W3220:
+                       graphic_ctrl.f_w32xx.color_depth=6;
+                       graphic_ctrl.f_w32xx.en_crtc=1;
+                       graphic_ctrl.f_w32xx.en_graphic_req=1;
+                       graphic_ctrl.f_w32xx.en_graphic_crtc=1;
+                       graphic_ctrl.f_w32xx.lcd_pclk_on=1;
+                       graphic_ctrl.f_w32xx.lcd_sclk_on=1;
+                       graphic_ctrl.f_w32xx.low_power_on=0;
+                       graphic_ctrl.f_w32xx.req_freq=0;
+                       graphic_ctrl.f_w32xx.total_req_graphic=par->mode->xres >> 1; /* panel xres, not mode */
+                       graphic_ctrl.f_w32xx.portrait_mode=rot;
+                       break;
+       }
+
+       /* Set the pixel clock source and divider */
+       w100_pwr_state.pclk_cntl.f.pclk_src_sel = par->mode->pixclk_src;
+       w100_pwr_state.pclk_cntl.f.pclk_post_div = divider;
+       writel((u32) (w100_pwr_state.pclk_cntl.val), remapped_regs + mmPCLK_CNTL);
 
-       /* Re-enable display updates */
-       writel(0x0000007b, remapped_regs + mmDISP_DB_BUF_CNTL);
+       writel(graphic_ctrl.val, remapped_regs + mmGRAPHIC_CTRL);
+       writel(W100_FB_BASE + ((offset * BITS_PER_PIXEL/8)&~0x03UL), remapped_regs + mmGRAPHIC_OFFSET);
+       writel((par->xres*BITS_PER_PIXEL/8), remapped_regs + mmGRAPHIC_PITCH);
 }
 
 
-static void w100_init_qvga_rotation(u16 deg)
+/*
+ * Work out how long the sync pulse lasts
+ * Value is 1/(time in seconds)
+ */
+static void calc_hsync(struct w100fb_par *par)
 {
-       switch(deg) {
-       case 0:
-               w100_set_qvga_rotation_regs(0x00d41c06, 0x00800000, 0x000001e0);
-               break;
-       case 90:
-               w100_set_qvga_rotation_regs(0x00d41c0E, 0x00825580, 0x00000280);
-               break;
-       case 180:
-               w100_set_qvga_rotation_regs(0x00d41c1e, 0x008257fc, 0x000001e0);
-               break;
-       case 270:
-               w100_set_qvga_rotation_regs(0x00d41c16, 0x0080027c, 0x00000280);
-               break;
-       default:
-               /* not-support */
-               break;
-       }
-}
+       unsigned long hsync;
+       struct w100_mode *mode = par->mode;
+       union crtc_ss_u crtc_ss;
+
+       if (mode->pixclk_src == CLK_SRC_XTAL)
+               hsync=par->mach->xtal_freq;
+       else
+               hsync=((par->fastpll_mode && mode->fast_pll_freq) ? mode->fast_pll_freq : mode->pll_freq)*100000;
+
+       hsync /= (w100_pwr_state.pclk_cntl.f.pclk_post_div + 1);
 
+       crtc_ss.val = readl(remapped_regs + mmCRTC_SS);
+       if (crtc_ss.val)
+               par->hsync_len = hsync / (crtc_ss.f.ss_end-crtc_ss.f.ss_start);
+       else
+               par->hsync_len = 0;
+}
 
 static void w100_suspend(u32 mode)
 {
@@ -1387,30 +1527,28 @@ static void w100_suspend(u32 mode)
        writel(0x00FF0000, remapped_regs + mmMC_PERF_MON_CNTL);
 
        val = readl(remapped_regs + mmMEM_EXT_TIMING_CNTL);
-       val &= ~(0x00100000);   /* bit20=0 */
-       val |= 0xFF000000;      /* bit31:24=0xff */
+       val &= ~(0x00100000);  /* bit20=0 */
+       val |= 0xFF000000;     /* bit31:24=0xff */
        writel(val, remapped_regs + mmMEM_EXT_TIMING_CNTL);
 
        val = readl(remapped_regs + mmMEM_EXT_CNTL);
-       val &= ~(0x00040000);   /* bit18=0 */
-       val |= 0x00080000;      /* bit19=1 */
+       val &= ~(0x00040000);  /* bit18=0 */
+       val |= 0x00080000;     /* bit19=1 */
        writel(val, remapped_regs + mmMEM_EXT_CNTL);
 
-       udelay(1);              /* wait 1us */
+       udelay(1);  /* wait 1us */
 
        if (mode == W100_SUSPEND_EXTMEM) {
-
                /* CKE: Tri-State */
                val = readl(remapped_regs + mmMEM_EXT_CNTL);
-               val |= 0x40000000;      /* bit30=1 */
+               val |= 0x40000000;  /* bit30=1 */
                writel(val, remapped_regs + mmMEM_EXT_CNTL);
 
                /* CLK: Stop */
                val = readl(remapped_regs + mmMEM_EXT_CNTL);
-               val &= ~(0x00000001);   /* bit0=0 */
+               val &= ~(0x00000001);  /* bit0=0 */
                writel(val, remapped_regs + mmMEM_EXT_CNTL);
        } else {
-
                writel(0x00000000, remapped_regs + mmSCLK_CNTL);
                writel(0x000000BF, remapped_regs + mmCLK_PIN_CNTL);
                writel(0x00000015, remapped_regs + mmPWRMGT_CNTL);
@@ -1418,43 +1556,16 @@ static void w100_suspend(u32 mode)
                udelay(5);
 
                val = readl(remapped_regs + mmPLL_CNTL);
-               val |= 0x00000004;      /* bit2=1 */
+               val |= 0x00000004;  /* bit2=1 */
                writel(val, remapped_regs + mmPLL_CNTL);
                writel(0x0000001d, remapped_regs + mmPWRMGT_CNTL);
        }
 }
 
-
-static void w100_resume(void)
-{
-       u32 temp32;
-
-       w100_hw_init();
-       w100_pwm_setup();
-
-       temp32 = readl(remapped_regs + mmDISP_DEBUG2);
-       temp32 &= 0xff7fffff;
-       temp32 |= 0x00800000;
-       writel(temp32, remapped_regs + mmDISP_DEBUG2);
-
-       if (current_par->lcdMode == LCD_MODE_480 || current_par->lcdMode == LCD_MODE_640) {
-               w100_init_sharp_lcd(LCD_SHARP_VGA);
-               if (current_par->lcdMode == LCD_MODE_640) {
-                       w100_init_vga_rotation(current_par->rotation_flag ? 270 : 90);
-               }
-       } else {
-               w100_init_sharp_lcd(LCD_SHARP_QVGA);
-               if (current_par->lcdMode == LCD_MODE_320) {
-                       w100_init_qvga_rotation(current_par->rotation_flag ? 270 : 90);
-               }
-       }
-}
-
-
 static void w100_vsync(void)
 {
        u32 tmp;
-       int timeout = 30000; /* VSync timeout = 30[ms] > 16.8[ms] */
+       int timeout = 30000;  /* VSync timeout = 30[ms] > 16.8[ms] */
 
        tmp = readl(remapped_regs + mmACTIVE_V_DISP);
 
@@ -1490,384 +1601,28 @@ static void w100_vsync(void)
        writel(0x00000002, remapped_regs + mmGEN_INT_STATUS);
 }
 
-
-static void w100_InitExtMem(u32 mode)
-{
-       switch(mode) {
-       case LCD_SHARP_QVGA:
-               /* QVGA doesn't use external memory
-                  nothing to do, really. */
-               break;
-       case LCD_SHARP_VGA:
-               writel(0x00007800, remapped_regs + mmMC_BIST_CTRL);
-               writel(0x00040003, remapped_regs + mmMEM_EXT_CNTL);
-               writel(0x00200021, remapped_regs + mmMEM_SDRAM_MODE_REG);
-               udelay(100);
-               writel(0x80200021, remapped_regs + mmMEM_SDRAM_MODE_REG);
-               udelay(100);
-               writel(0x00650021, remapped_regs + mmMEM_SDRAM_MODE_REG);
-               udelay(100);
-               writel(0x10002a4a, remapped_regs + mmMEM_EXT_TIMING_CNTL);
-               writel(0x7ff87012, remapped_regs + mmMEM_IO_CNTL);
-               break;
-       default:
-               break;
-       }
-}
-
-
-#define RESCTL_ADRS     0x00
-#define PHACTRL_ADRS   0x01
-#define DUTYCTRL_ADRS  0x02
-#define POWERREG0_ADRS 0x03
-#define POWERREG1_ADRS 0x04
-#define GPOR3_ADRS             0x05
-#define PICTRL_ADRS     0x06
-#define POLCTRL_ADRS    0x07
-
-#define RESCTL_QVGA     0x01
-#define RESCTL_VGA      0x00
-
-#define POWER1_VW_ON   0x01    /* VW Supply FET ON */
-#define POWER1_GVSS_ON 0x02    /* GVSS(-8V) Power Supply ON */
-#define POWER1_VDD_ON  0x04    /* VDD(8V),SVSS(-4V) Power Supply ON */
-
-#define POWER1_VW_OFF  0x00    /* VW Supply FET OFF */
-#define POWER1_GVSS_OFF        0x00    /* GVSS(-8V) Power Supply OFF */
-#define POWER1_VDD_OFF 0x00    /* VDD(8V),SVSS(-4V) Power Supply OFF */
-
-#define POWER0_COM_DCLK        0x01    /* COM Voltage DC Bias DAC Serial Data Clock */
-#define POWER0_COM_DOUT        0x02    /* COM Voltage DC Bias DAC Serial Data Out */
-#define POWER0_DAC_ON  0x04    /* DAC Power Supply ON */
-#define POWER0_COM_ON  0x08    /* COM Powewr Supply ON */
-#define POWER0_VCC5_ON 0x10    /* VCC5 Power Supply ON */
-
-#define POWER0_DAC_OFF 0x00    /* DAC Power Supply OFF */
-#define POWER0_COM_OFF 0x00    /* COM Powewr Supply OFF */
-#define POWER0_VCC5_OFF        0x00    /* VCC5 Power Supply OFF */
-
-#define PICTRL_INIT_STATE      0x01
-#define PICTRL_INIOFF          0x02
-#define PICTRL_POWER_DOWN      0x04
-#define PICTRL_COM_SIGNAL_OFF  0x08
-#define PICTRL_DAC_SIGNAL_OFF  0x10
-
-#define PICTRL_POWER_ACTIVE    (0)
-
-#define POLCTRL_SYNC_POL_FALL  0x01
-#define POLCTRL_EN_POL_FALL    0x02
-#define POLCTRL_DATA_POL_FALL  0x04
-#define POLCTRL_SYNC_ACT_H     0x08
-#define POLCTRL_EN_ACT_L       0x10
-
-#define POLCTRL_SYNC_POL_RISE  0x00
-#define POLCTRL_EN_POL_RISE    0x00
-#define POLCTRL_DATA_POL_RISE  0x00
-#define POLCTRL_SYNC_ACT_L     0x00
-#define POLCTRL_EN_ACT_H       0x00
-
-#define PHACTRL_PHASE_MANUAL   0x01
-
-#define PHAD_QVGA_DEFAULT_VAL (9)
-#define COMADJ_DEFAULT        (125)
-
-static void lcdtg_ssp_send(u8 adrs, u8 data)
-{
-       w100fb_ssp_send(adrs,data);
-}
-
-/*
- * This is only a psuedo I2C interface. We can't use the standard kernel
- * routines as the interface is write only. We just assume the data is acked...
- */
-static void lcdtg_ssp_i2c_send(u8 data)
-{
-       lcdtg_ssp_send(POWERREG0_ADRS, data);
-       udelay(10);
-}
-
-static void lcdtg_i2c_send_bit(u8 data)
-{
-       lcdtg_ssp_i2c_send(data);
-       lcdtg_ssp_i2c_send(data | POWER0_COM_DCLK);
-       lcdtg_ssp_i2c_send(data);
-}
-
-static void lcdtg_i2c_send_start(u8 base)
-{
-       lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK | POWER0_COM_DOUT);
-       lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK);
-       lcdtg_ssp_i2c_send(base);
-}
-
-static void lcdtg_i2c_send_stop(u8 base)
-{
-       lcdtg_ssp_i2c_send(base);
-       lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK);
-       lcdtg_ssp_i2c_send(base | POWER0_COM_DCLK | POWER0_COM_DOUT);
-}
-
-static void lcdtg_i2c_send_byte(u8 base, u8 data)
-{
-       int i;
-       for (i = 0; i < 8; i++) {
-               if (data & 0x80)
-                       lcdtg_i2c_send_bit(base | POWER0_COM_DOUT);
-               else
-                       lcdtg_i2c_send_bit(base);
-               data <<= 1;
-       }
-}
-
-static void lcdtg_i2c_wait_ack(u8 base)
-{
-       lcdtg_i2c_send_bit(base);
-}
-
-static void lcdtg_set_common_voltage(u8 base_data, u8 data)
-{
-       /* Set Common Voltage to M62332FP via I2C */
-       lcdtg_i2c_send_start(base_data);
-       lcdtg_i2c_send_byte(base_data, 0x9c);
-       lcdtg_i2c_wait_ack(base_data);
-       lcdtg_i2c_send_byte(base_data, 0x00);
-       lcdtg_i2c_wait_ack(base_data);
-       lcdtg_i2c_send_byte(base_data, data);
-       lcdtg_i2c_wait_ack(base_data);
-       lcdtg_i2c_send_stop(base_data);
-}
-
-static struct lcdtg_register_setting {
-       u8 adrs;
-       u8 data;
-       u32 wait;
-} lcdtg_power_on_table[] = {
-
-    /* Initialize Internal Logic & Port */
-    { PICTRL_ADRS,
-      PICTRL_POWER_DOWN | PICTRL_INIOFF | PICTRL_INIT_STATE |
-      PICTRL_COM_SIGNAL_OFF | PICTRL_DAC_SIGNAL_OFF,
-      0 },
-
-    { POWERREG0_ADRS,
-      POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_OFF | POWER0_COM_OFF |
-      POWER0_VCC5_OFF,
-      0 },
-
-    { POWERREG1_ADRS,
-      POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF,
-      0 },
-
-    /* VDD(+8V),SVSS(-4V) ON */
-    { POWERREG1_ADRS,
-      POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_ON /* VDD ON */,
-      3000 },
-
-    /* DAC ON */
-    { POWERREG0_ADRS,
-      POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_ON /* DAC ON */ |
-      POWER0_COM_OFF | POWER0_VCC5_OFF,
-      0 },
-
-    /* INIB = H, INI = L  */
-    { PICTRL_ADRS,
-      /* PICTL[0] = H , PICTL[1] = PICTL[2] = PICTL[4] = L */
-      PICTRL_INIT_STATE | PICTRL_COM_SIGNAL_OFF,
-      0 },
-
-    /* Set Common Voltage */
-    { 0xfe, 0, 0 },
-
-    /* VCC5 ON */
-    { POWERREG0_ADRS,
-      POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_ON /* DAC ON */ |
-      POWER0_COM_OFF | POWER0_VCC5_ON /* VCC5 ON */,
-      0 },
-
-    /* GVSS(-8V) ON */
-    { POWERREG1_ADRS,
-      POWER1_VW_OFF | POWER1_GVSS_ON /* GVSS ON */ |
-      POWER1_VDD_ON /* VDD ON */,
-      2000 },
-
-    /* COM SIGNAL ON (PICTL[3] = L) */
-    { PICTRL_ADRS,
-      PICTRL_INIT_STATE,
-      0 },
-
-    /* COM ON */
-    { POWERREG0_ADRS,
-      POWER0_COM_DCLK | POWER0_COM_DOUT | POWER0_DAC_ON /* DAC ON */ |
-      POWER0_COM_ON /* COM ON */ | POWER0_VCC5_ON /* VCC5_ON */,
-      0 },
-
-    /* VW ON */
-    { POWERREG1_ADRS,
-      POWER1_VW_ON /* VW ON */ | POWER1_GVSS_ON /* GVSS ON */ |
-      POWER1_VDD_ON /* VDD ON */,
-      0 /* Wait 100ms */ },
-
-    /* Signals output enable */
-    { PICTRL_ADRS,
-      0 /* Signals output enable */,
-      0 },
-
-    { PHACTRL_ADRS,
-      PHACTRL_PHASE_MANUAL,
-      0 },
-
-    /* Initialize for Input Signals from ATI */
-    { POLCTRL_ADRS,
-      POLCTRL_SYNC_POL_RISE | POLCTRL_EN_POL_RISE | POLCTRL_DATA_POL_RISE |
-      POLCTRL_SYNC_ACT_L | POLCTRL_EN_ACT_H,
-      1000 /*100000*/ /* Wait 100ms */ },
-
-    /* end mark */
-    { 0xff, 0, 0 }
-};
-
-static void lcdtg_resume(void)
-{
-       if (current_par->lcdMode == LCD_MODE_480 || current_par->lcdMode == LCD_MODE_640) {
-               lcdtg_hw_init(LCD_SHARP_VGA);
-       } else {
-               lcdtg_hw_init(LCD_SHARP_QVGA);
-       }
-}
-
-static void lcdtg_suspend(void)
-{
-       int i;
-
-       for (i = 0; i < (current_par->xres * current_par->yres); i++) {
-               writew(0xffff, remapped_fbuf + (2*i));
-       }
-
-       /* 60Hz x 2 frame = 16.7msec x 2 = 33.4 msec */
-       mdelay(34);
-
-       /* (1)VW OFF */
-       lcdtg_ssp_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_ON | POWER1_VDD_ON);
-
-       /* (2)COM OFF */
-       lcdtg_ssp_send(PICTRL_ADRS, PICTRL_COM_SIGNAL_OFF);
-       lcdtg_ssp_send(POWERREG0_ADRS, POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_ON);
-
-       /* (3)Set Common Voltage Bias 0V */
-       lcdtg_set_common_voltage(POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_ON, 0);
-
-       /* (4)GVSS OFF */
-       lcdtg_ssp_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_ON);
-
-       /* (5)VCC5 OFF */
-       lcdtg_ssp_send(POWERREG0_ADRS, POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_OFF);
-
-       /* (6)Set PDWN, INIOFF, DACOFF */
-       lcdtg_ssp_send(PICTRL_ADRS, PICTRL_INIOFF | PICTRL_DAC_SIGNAL_OFF |
-                       PICTRL_POWER_DOWN | PICTRL_COM_SIGNAL_OFF);
-
-       /* (7)DAC OFF */
-       lcdtg_ssp_send(POWERREG0_ADRS, POWER0_DAC_OFF | POWER0_COM_OFF | POWER0_VCC5_OFF);
-
-       /* (8)VDD OFF */
-       lcdtg_ssp_send(POWERREG1_ADRS, POWER1_VW_OFF | POWER1_GVSS_OFF | POWER1_VDD_OFF);
-
-}
-
-static void lcdtg_set_phadadj(u32 mode)
-{
-       int adj;
-
-       if (mode == LCD_SHARP_VGA) {
-               /* Setting for VGA */
-               adj = current_par->phadadj;
-               if (adj < 0) {
-                       adj = PHACTRL_PHASE_MANUAL;
-               } else {
-                       adj = ((adj & 0x0f) << 1) | PHACTRL_PHASE_MANUAL;
-               }
-       } else {
-               /* Setting for QVGA */
-               adj = (PHAD_QVGA_DEFAULT_VAL << 1) | PHACTRL_PHASE_MANUAL;
-       }
-       lcdtg_ssp_send(PHACTRL_ADRS, adj);
-}
-
-static void lcdtg_hw_init(u32 mode)
-{
-       int i;
-       int comadj;
-
-       i = 0;
-       while(lcdtg_power_on_table[i].adrs != 0xff) {
-               if (lcdtg_power_on_table[i].adrs == 0xfe) {
-                       /* Set Common Voltage */
-                       comadj = current_par->comadj;
-                       if (comadj < 0) {
-                               comadj = COMADJ_DEFAULT;
-                       }
-                       lcdtg_set_common_voltage((POWER0_DAC_ON | POWER0_COM_OFF | POWER0_VCC5_OFF), comadj);
-               } else if (lcdtg_power_on_table[i].adrs == PHACTRL_ADRS) {
-                       /* Set Phase Adjuct */
-                       lcdtg_set_phadadj(mode);
-               } else {
-                       /* Other */
-                       lcdtg_ssp_send(lcdtg_power_on_table[i].adrs, lcdtg_power_on_table[i].data);
-               }
-               if (lcdtg_power_on_table[i].wait != 0)
-                       udelay(lcdtg_power_on_table[i].wait);
-               i++;
-       }
-
-       switch(mode) {
-       case LCD_SHARP_QVGA:
-               /* Set Lcd Resolution (QVGA) */
-               lcdtg_ssp_send(RESCTL_ADRS, RESCTL_QVGA);
-               break;
-       case LCD_SHARP_VGA:
-               /* Set Lcd Resolution (VGA) */
-               lcdtg_ssp_send(RESCTL_ADRS, RESCTL_VGA);
-               break;
-       default:
-               break;
-       }
-}
-
-static void lcdtg_lcd_change(u32 mode)
-{
-       /* Set Phase Adjuct */
-       lcdtg_set_phadadj(mode);
-
-       if (mode == LCD_SHARP_VGA)
-               /* Set Lcd Resolution (VGA) */
-               lcdtg_ssp_send(RESCTL_ADRS, RESCTL_VGA);
-       else if (mode == LCD_SHARP_QVGA)
-               /* Set Lcd Resolution (QVGA) */
-               lcdtg_ssp_send(RESCTL_ADRS, RESCTL_QVGA);
-}
-
-
-static struct device_driver w100fb_driver = {
-       .name           = "w100fb",
-       .bus            = &platform_bus_type,
+static struct platform_driver w100fb_driver = {
        .probe          = w100fb_probe,
        .remove         = w100fb_remove,
        .suspend        = w100fb_suspend,
        .resume         = w100fb_resume,
+       .driver         = {
+               .name   = "w100fb",
+       },
 };
 
 int __devinit w100fb_init(void)
 {
-       return driver_register(&w100fb_driver);
+       return platform_driver_register(&w100fb_driver);
 }
 
 void __exit w100fb_cleanup(void)
 {
-       driver_unregister(&w100fb_driver);
+       platform_driver_unregister(&w100fb_driver);
 }
 
 module_init(w100fb_init);
 module_exit(w100fb_cleanup);
 
 MODULE_DESCRIPTION("ATI Imageon w100 framebuffer driver");
-MODULE_LICENSE("GPLv2");
+MODULE_LICENSE("GPL");
index 41624f9..fffae7b 100644 (file)
@@ -5,9 +5,12 @@
  *
  * Copyright (C) 2002, ATI Corp.
  * Copyright (C) 2004-2005 Richard Purdie
+ * Copyright (c) 2005 Ian Molton <spyro@f2s.com>
  *
  * Modified to work with 2.6 by Richard Purdie <rpurdie@rpsys.net>
  *
+ * w32xx support 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.
@@ -19,7 +22,7 @@
 
 /* Block CIF Start: */
 #define mmCHIP_ID           0x0000
-#define mmREVISION_ID          0x0004
+#define mmREVISION_ID       0x0004
 #define mmWRAP_BUF_A        0x0008
 #define mmWRAP_BUF_B        0x000C
 #define mmWRAP_TOP_DIR      0x0010
@@ -88,7 +91,7 @@
 #define mmDISP_DEBUG        0x04D4
 #define mmDISP_DB_BUF_CNTL  0x04D8
 #define mmDISP_CRC_SIG      0x04DC
-#define mmCRTC_DEFAULT_COUNT   0x04E0
+#define mmCRTC_DEFAULT_COUNT    0x04E0
 #define mmLCD_BACKGROUND_COLOR  0x04E4
 #define mmCRTC_PS2          0x04E8
 #define mmCRTC_PS2_VPOS     0x04EC
 /* Block DISPLAY End: */
 
 /* Block GFX Start: */
-#define mmBRUSH_OFFSET      0x108C
-#define mmBRUSH_Y_X         0x1074
-#define mmDEFAULT_PITCH_OFFSET         0x10A0
-#define mmDEFAULT_SC_BOTTOM_RIGHT      0x10A8
-#define mmDEFAULT2_SC_BOTTOM_RIGHT     0x10AC
-#define mmGLOBAL_ALPHA      0x1210
-#define mmFILTER_COEF       0x1214
-#define mmMVC_CNTL_START    0x11E0
-#define mmE2_ARITHMETIC_CNTL   0x1220
-#define mmENG_CNTL          0x13E8
-#define mmENG_PERF_CNT      0x13F0
+#define mmDST_OFFSET          0x1004
+#define mmDST_PITCH           0x1008
+#define mmDST_Y_X             0x1038
+#define mmDST_WIDTH_HEIGHT    0x1198
+#define mmDP_GUI_MASTER_CNTL  0x106C
+#define mmBRUSH_OFFSET        0x108C
+#define mmBRUSH_Y_X           0x1074
+#define mmDP_BRUSH_FRGD_CLR   0x107C
+#define mmSRC_OFFSET          0x11AC
+#define mmSRC_PITCH           0x11B0
+#define mmSRC_Y_X             0x1034
+#define mmDEFAULT_PITCH_OFFSET      0x10A0
+#define mmDEFAULT_SC_BOTTOM_RIGHT   0x10A8
+#define mmDEFAULT2_SC_BOTTOM_RIGHT  0x10AC
+#define mmSC_TOP_LEFT         0x11BC
+#define mmSC_BOTTOM_RIGHT     0x11C0
+#define mmSRC_SC_BOTTOM_RIGHT 0x11C4
+#define mmGLOBAL_ALPHA        0x1210
+#define mmFILTER_COEF         0x1214
+#define mmMVC_CNTL_START      0x11E0
+#define mmE2_ARITHMETIC_CNTL  0x1220
+#define mmDP_CNTL             0x11C8
+#define mmDP_CNTL_DST_DIR     0x11CC
+#define mmDP_DATATYPE         0x12C4
+#define mmDP_MIX              0x12C8
+#define mmDP_WRITE_MSK        0x12CC
+#define mmENG_CNTL            0x13E8
+#define mmENG_PERF_CNT        0x13F0
 /* Block GFX End: */
 
 /* Block IDCT Start: */
 /* Block IDCT End: */
 
 /* Block MC Start: */
-#define mmMEM_CNTL          0x0180
-#define mmMEM_ARB           0x0184
-#define mmMC_FB_LOCATION    0x0188
-#define mmMEM_EXT_CNTL      0x018C
-#define mmMC_EXT_MEM_LOCATION   0x0190
-#define mmMEM_EXT_TIMING_CNTL   0x0194
-#define mmMEM_SDRAM_MODE_REG   0x0198
-#define mmMEM_IO_CNTL       0x019C
-#define mmMC_DEBUG          0x01A0
-#define mmMC_BIST_CTRL      0x01A4
-#define mmMC_BIST_COLLAR_READ          0x01A8
-#define mmTC_MISMATCH       0x01AC
-#define mmMC_PERF_MON_CNTL  0x01B0
-#define mmMC_PERF_COUNTERS  0x01B4
+#define mmMEM_CNTL             0x0180
+#define mmMEM_ARB              0x0184
+#define mmMC_FB_LOCATION       0x0188
+#define mmMEM_EXT_CNTL         0x018C
+#define mmMC_EXT_MEM_LOCATION  0x0190
+#define mmMEM_EXT_TIMING_CNTL  0x0194
+#define mmMEM_SDRAM_MODE_REG   0x0198
+#define mmMEM_IO_CNTL          0x019C
+#define mmMC_DEBUG             0x01A0
+#define mmMC_BIST_CTRL         0x01A4
+#define mmMC_BIST_COLLAR_READ  0x01A8
+#define mmTC_MISMATCH          0x01AC
+#define mmMC_PERF_MON_CNTL     0x01B0
+#define mmMC_PERF_COUNTERS     0x01B4
 /* Block MC End: */
 
+/* Block BM Start: */
+#define mmBM_EXT_MEM_BANDWIDTH    0x0A00
+#define mmBM_OFFSET               0x0A04
+#define mmBM_MEM_EXT_TIMING_CNTL  0x0A08
+#define mmBM_MEM_EXT_CNTL         0x0A0C
+#define mmBM_MEM_MODE_REG         0x0A10
+#define mmBM_MEM_IO_CNTL          0x0A18
+#define mmBM_CONFIG               0x0A1C
+#define mmBM_STATUS               0x0A20
+#define mmBM_DEBUG                0x0A24
+#define mmBM_PERF_MON_CNTL        0x0A28
+#define mmBM_PERF_COUNTERS        0x0A2C
+#define mmBM_PERF2_MON_CNTL       0x0A30
+#define mmBM_PERF2_COUNTERS       0x0A34
+/* Block BM End: */
+
 /* Block RBBM Start: */
 #define mmWAIT_UNTIL        0x1400
 #define mmISYNC_CNTL        0x1404
+#define mmRBBM_STATUS       0x0140
 #define mmRBBM_CNTL         0x0144
 #define mmNQWAIT_UNTIL      0x0150
 /* Block RBBM End: */
 /* Block CG End: */
 
 /* default value definitions */
-#define defWRAP_TOP_DIR     0x00000000
-#define defWRAP_START_DIR      0x00000000
-#define defCFGREG_BASE      0x00000000
-#define defCIF_IO           0x000C0902
-#define defINTF_CNTL        0x00000011
-#define defCPU_DEFAULTS     0x00000006
-#define defHW_INT           0x00000000
-#define defMC_EXT_MEM_LOCATION            0x07ff0000
-#define defTC_MISMATCH      0x00000000
+#define defWRAP_TOP_DIR        0x00000000
+#define defWRAP_START_DIR      0x00000000
+#define defCFGREG_BASE         0x00000000
+#define defCIF_IO              0x000C0902
+#define defINTF_CNTL           0x00000011
+#define defCPU_DEFAULTS        0x00000006
+#define defHW_INT              0x00000000
+#define defMC_EXT_MEM_LOCATION 0x07ff0000
+#define defTC_MISMATCH         0x00000000
 
 #define W100_CFG_BASE          0x0
 #define W100_CFG_LEN           0x10
 #define W100_REG_BASE          0x10000
 #define W100_REG_LEN           0x2000
 #define MEM_INT_BASE_VALUE     0x100000
-#define MEM_INT_TOP_VALUE_W100 0x15ffff
 #define MEM_EXT_BASE_VALUE     0x800000
-#define MEM_EXT_TOP_VALUE      0x9fffff
+#define MEM_INT_SIZE           0x05ffff
+#define MEM_WINDOW_BASE        0x100000
+#define MEM_WINDOW_SIZE        0xf00000
+
 #define WRAP_BUF_BASE_VALUE    0x80000
 #define WRAP_BUF_TOP_VALUE     0xbffff
 
+#define CHIP_ID_W100           0x57411002
+#define CHIP_ID_W3200          0x56441002
+#define CHIP_ID_W3220          0x57441002
 
-/* data structure definitions */
+/* Register structure definitions */
 
 struct wrap_top_dir_t {
-     unsigned long top_addr         : 23;
-     unsigned long                             : 9;
+       u32 top_addr  : 23;
+       u32           : 9;
 } __attribute__((packed));
 
 union wrap_top_dir_u {
-     unsigned long val : 32;
-     struct wrap_top_dir_t f;
+       u32 val : 32;
+       struct wrap_top_dir_t f;
 } __attribute__((packed));
 
 struct wrap_start_dir_t {
-     unsigned long start_addr       : 23;
-     unsigned long                             : 9;
+       u32 start_addr : 23;
+       u32            : 9;
 } __attribute__((packed));
 
 union wrap_start_dir_u {
-     unsigned long val : 32;
-     struct wrap_start_dir_t f;
+       u32 val : 32;
+       struct wrap_start_dir_t f;
 } __attribute__((packed));
 
 struct cif_cntl_t {
-     unsigned long swap_reg                    : 2;
-     unsigned long swap_fbuf_1                 : 2;
-     unsigned long swap_fbuf_2                 : 2;
-     unsigned long swap_fbuf_3                 : 2;
-     unsigned long pmi_int_disable             : 1;
-     unsigned long pmi_schmen_disable       : 1;
-     unsigned long intb_oe                     : 1;
-     unsigned long en_wait_to_compensate_dq_prop_dly : 1;
-     unsigned long compensate_wait_rd_size  : 2;
-     unsigned long wait_asserted_timeout_val      : 2;
-     unsigned long wait_masked_val             : 2;
-     unsigned long en_wait_timeout             : 1;
-     unsigned long en_one_clk_setup_before_wait   : 1;
-     unsigned long interrupt_active_high    : 1;
-     unsigned long en_overwrite_straps      : 1;
-     unsigned long strap_wait_active_hi     : 1;
-     unsigned long lat_busy_count              : 2;
-     unsigned long lat_rd_pm4_sclk_busy     : 1;
-     unsigned long dis_system_bits             : 1;
-     unsigned long dis_mr                      : 1;
-     unsigned long cif_spare_1                 : 4;
+       u32 swap_reg                 : 2;
+       u32 swap_fbuf_1              : 2;
+       u32 swap_fbuf_2              : 2;
+       u32 swap_fbuf_3              : 2;
+       u32 pmi_int_disable          : 1;
+       u32 pmi_schmen_disable       : 1;
+       u32 intb_oe                  : 1;
+       u32 en_wait_to_compensate_dq_prop_dly  : 1;
+       u32 compensate_wait_rd_size  : 2;
+       u32 wait_asserted_timeout_val  : 2;
+       u32 wait_masked_val          : 2;
+       u32 en_wait_timeout          : 1;
+       u32 en_one_clk_setup_before_wait  : 1;
+       u32 interrupt_active_high    : 1;
+       u32 en_overwrite_straps      : 1;
+       u32 strap_wait_active_hi     : 1;
+       u32 lat_busy_count           : 2;
+       u32 lat_rd_pm4_sclk_busy     : 1;
+       u32 dis_system_bits          : 1;
+       u32 dis_mr                   : 1;
+       u32 cif_spare_1              : 4;
 } __attribute__((packed));
 
 union cif_cntl_u {
-     unsigned long val : 32;
-     struct cif_cntl_t f;
+       u32 val : 32;
+       struct cif_cntl_t f;
 } __attribute__((packed));
 
 struct cfgreg_base_t {
-     unsigned long cfgreg_base      : 24;
-     unsigned long                             : 8;
+       u32 cfgreg_base  : 24;
+       u32              : 8;
 } __attribute__((packed));
 
 union cfgreg_base_u {
-     unsigned long val : 32;
-     struct cfgreg_base_t f;
+       u32 val : 32;
+       struct cfgreg_base_t f;
 } __attribute__((packed));
 
 struct cif_io_t {
-     unsigned long dq_srp           : 1;
-     unsigned long dq_srn           : 1;
-     unsigned long dq_sp            : 4;
-     unsigned long dq_sn            : 4;
-     unsigned long waitb_srp        : 1;
-     unsigned long waitb_srn        : 1;
-     unsigned long waitb_sp         : 4;
-     unsigned long waitb_sn         : 4;
-     unsigned long intb_srp         : 1;
-     unsigned long intb_srn         : 1;
-     unsigned long intb_sp          : 4;
-     unsigned long intb_sn          : 4;
-     unsigned long                             : 2;
+       u32 dq_srp     : 1;
+       u32 dq_srn     : 1;
+       u32 dq_sp      : 4;
+       u32 dq_sn      : 4;
+       u32 waitb_srp  : 1;
+       u32 waitb_srn  : 1;
+       u32 waitb_sp   : 4;
+       u32 waitb_sn   : 4;
+       u32 intb_srp   : 1;
+       u32 intb_srn   : 1;
+       u32 intb_sp    : 4;
+       u32 intb_sn    : 4;
+       u32            : 2;
 } __attribute__((packed));
 
 union cif_io_u {
-     unsigned long val : 32;
-     struct cif_io_t f;
+       u32 val : 32;
+       struct cif_io_t f;
 } __attribute__((packed));
 
 struct cif_read_dbg_t {
-     unsigned long unpacker_pre_fetch_trig_gen  : 2;
-     unsigned long dly_second_rd_fetch_trig     : 1;
-     unsigned long rst_rd_burst_id                     : 1;
-     unsigned long dis_rd_burst_id                     : 1;
-     unsigned long en_block_rd_when_packer_is_not_emp : 1;
-     unsigned long dis_pre_fetch_cntl_sm        : 1;
-     unsigned long rbbm_chrncy_dis                     : 1;
-     unsigned long rbbm_rd_after_wr_lat         : 2;
-     unsigned long dis_be_during_rd                    : 1;
-     unsigned long one_clk_invalidate_pulse     : 1;
-     unsigned long dis_chnl_priority                   : 1;
-     unsigned long rst_read_path_a_pls          : 1;
-     unsigned long rst_read_path_b_pls          : 1;
-     unsigned long dis_reg_rd_fetch_trig        : 1;
-     unsigned long dis_rd_fetch_trig_from_ind_addr : 1;
-     unsigned long dis_rd_same_byte_to_trig_fetch : 1;
-     unsigned long dis_dir_wrap                        : 1;
-     unsigned long dis_ring_buf_to_force_dec    : 1;
-     unsigned long dis_addr_comp_in_16bit       : 1;
-     unsigned long clr_w                               : 1;
-     unsigned long err_rd_tag_is_3                     : 1;
-     unsigned long err_load_when_ful_a          : 1;
-     unsigned long err_load_when_ful_b          : 1;
-     unsigned long                                                     : 7;
+       u32 unpacker_pre_fetch_trig_gen  : 2;
+       u32 dly_second_rd_fetch_trig     : 1;
+       u32 rst_rd_burst_id              : 1;
+       u32 dis_rd_burst_id              : 1;
+       u32 en_block_rd_when_packer_is_not_emp : 1;
+       u32 dis_pre_fetch_cntl_sm        : 1;
+       u32 rbbm_chrncy_dis              : 1;
+       u32 rbbm_rd_after_wr_lat         : 2;
+       u32 dis_be_during_rd             : 1;
+       u32 one_clk_invalidate_pulse     : 1;
+       u32 dis_chnl_priority            : 1;
+       u32 rst_read_path_a_pls          : 1;
+       u32 rst_read_path_b_pls          : 1;
+       u32 dis_reg_rd_fetch_trig        : 1;
+       u32 dis_rd_fetch_trig_from_ind_addr : 1;
+       u32 dis_rd_same_byte_to_trig_fetch : 1;
+       u32 dis_dir_wrap                 : 1;
+       u32 dis_ring_buf_to_force_dec    : 1;
+       u32 dis_addr_comp_in_16bit       : 1;
+       u32 clr_w                        : 1;
+       u32 err_rd_tag_is_3              : 1;
+       u32 err_load_when_ful_a          : 1;
+       u32 err_load_when_ful_b          : 1;
+       u32                              : 7;
 } __attribute__((packed));
 
 union cif_read_dbg_u {
-     unsigned long val : 32;
-     struct cif_read_dbg_t f;
+       u32 val : 32;
+       struct cif_read_dbg_t f;
 } __attribute__((packed));
 
 struct cif_write_dbg_t {
-     unsigned long packer_timeout_count           : 2;
-     unsigned long en_upper_load_cond             : 1;
-     unsigned long en_chnl_change_cond            : 1;
-     unsigned long dis_addr_comp_cond             : 1;
-     unsigned long dis_load_same_byte_addr_cond   : 1;
-     unsigned long dis_timeout_cond                      : 1;
-     unsigned long dis_timeout_during_rbbm        : 1;
-     unsigned long dis_packer_ful_during_rbbm_timeout : 1;
-     unsigned long en_dword_split_to_rbbm         : 1;
-     unsigned long en_dummy_val                          : 1;
-     unsigned long dummy_val_sel                         : 1;
-     unsigned long mask_pm4_wrptr_dec             : 1;
-     unsigned long dis_mc_clean_cond                     : 1;
-     unsigned long err_two_reqi_during_ful        : 1;
-     unsigned long err_reqi_during_idle_clk       : 1;
-     unsigned long err_global                            : 1;
-     unsigned long en_wr_buf_dbg_load             : 1;
-     unsigned long en_wr_buf_dbg_path             : 1;
-     unsigned long sel_wr_buf_byte                       : 3;
-     unsigned long dis_rd_flush_wr                       : 1;
-     unsigned long dis_packer_ful_cond            : 1;
-     unsigned long dis_invalidate_by_ops_chnl     : 1;
-     unsigned long en_halt_when_reqi_err          : 1;
-     unsigned long cif_spare_2                           : 5;
-     unsigned long                                                       : 1;
+       u32 packer_timeout_count          : 2;
+       u32 en_upper_load_cond            : 1;
+       u32 en_chnl_change_cond           : 1;
+       u32 dis_addr_comp_cond            : 1;
+       u32 dis_load_same_byte_addr_cond  : 1;
+       u32 dis_timeout_cond              : 1;
+       u32 dis_timeout_during_rbbm       : 1;
+       u32 dis_packer_ful_during_rbbm_timeout : 1;
+       u32 en_dword_split_to_rbbm        : 1;
+       u32 en_dummy_val                  : 1;
+       u32 dummy_val_sel                 : 1;
+       u32 mask_pm4_wrptr_dec            : 1;
+       u32 dis_mc_clean_cond             : 1;
+       u32 err_two_reqi_during_ful       : 1;
+       u32 err_reqi_during_idle_clk      : 1;
+       u32 err_global                    : 1;
+       u32 en_wr_buf_dbg_load            : 1;
+       u32 en_wr_buf_dbg_path            : 1;
+       u32 sel_wr_buf_byte               : 3;
+       u32 dis_rd_flush_wr               : 1;
+       u32 dis_packer_ful_cond           : 1;
+       u32 dis_invalidate_by_ops_chnl    : 1;
+       u32 en_halt_when_reqi_err         : 1;
+       u32 cif_spare_2                   : 5;
+       u32                               : 1;
 } __attribute__((packed));
 
 union cif_write_dbg_u {
-     unsigned long val : 32;
-     struct cif_write_dbg_t f;
+       u32 val : 32;
+       struct cif_write_dbg_t f;
 } __attribute__((packed));
 
 
 struct intf_cntl_t {
-     unsigned char ad_inc_a            : 1;
-     unsigned char ring_buf_a          : 1;
-     unsigned char rd_fetch_trigger_a  : 1;
-     unsigned char rd_data_rdy_a       : 1;
-     unsigned char ad_inc_b            : 1;
-     unsigned char ring_buf_b          : 1;
-     unsigned char rd_fetch_trigger_b  : 1;
-     unsigned char rd_data_rdy_b       : 1;
+       unsigned char ad_inc_a            : 1;
+       unsigned char ring_buf_a          : 1;
+       unsigned char rd_fetch_trigger_a  : 1;
+       unsigned char rd_data_rdy_a       : 1;
+       unsigned char ad_inc_b            : 1;
+       unsigned char ring_buf_b          : 1;
+       unsigned char rd_fetch_trigger_b  : 1;
+       unsigned char rd_data_rdy_b       : 1;
 } __attribute__((packed));
 
 union intf_cntl_u {
-     unsigned char val : 8;
-     struct intf_cntl_t f;
+       unsigned char val : 8;
+       struct intf_cntl_t f;
 } __attribute__((packed));
 
 struct cpu_defaults_t {
-     unsigned char unpack_rd_data   : 1;
-     unsigned char access_ind_addr_a: 1;
-     unsigned char access_ind_addr_b: 1;
-     unsigned char access_scratch_reg             : 1;
-     unsigned char pack_wr_data     : 1;
-     unsigned char transition_size  : 1;
-     unsigned char en_read_buf_mode : 1;
-     unsigned char rd_fetch_scratch : 1;
+       unsigned char unpack_rd_data     : 1;
+       unsigned char access_ind_addr_a  : 1;
+       unsigned char access_ind_addr_b  : 1;
+       unsigned char access_scratch_reg : 1;
+       unsigned char pack_wr_data       : 1;
+       unsigned char transition_size    : 1;
+       unsigned char en_read_buf_mode   : 1;
+       unsigned char rd_fetch_scratch   : 1;
 } __attribute__((packed));
 
 union cpu_defaults_u {
-     unsigned char val : 8;
-     struct cpu_defaults_t f;
+       unsigned char val : 8;
+       struct cpu_defaults_t f;
+} __attribute__((packed));
+
+struct crtc_total_t {
+       u32 crtc_h_total : 10;
+       u32              : 6;
+       u32 crtc_v_total : 10;
+       u32              : 6;
+} __attribute__((packed));
+
+union crtc_total_u {
+       u32 val : 32;
+       struct crtc_total_t f;
+} __attribute__((packed));
+
+struct crtc_ss_t {
+       u32 ss_start    : 10;
+       u32             : 6;
+       u32 ss_end      : 10;
+       u32             : 2;
+       u32 ss_align    : 1;
+       u32 ss_pol      : 1;
+       u32 ss_run_mode : 1;
+       u32 ss_en       : 1;
+} __attribute__((packed));
+
+union crtc_ss_u {
+       u32 val : 32;
+       struct crtc_ss_t f;
+} __attribute__((packed));
+
+struct active_h_disp_t {
+       u32 active_h_start  : 10;
+       u32                 : 6;
+       u32 active_h_end    : 10;
+       u32                 : 6;
+} __attribute__((packed));
+
+union active_h_disp_u {
+       u32 val : 32;
+       struct active_h_disp_t f;
+} __attribute__((packed));
+
+struct active_v_disp_t {
+       u32 active_v_start  : 10;
+       u32                 : 6;
+       u32 active_v_end    : 10;
+       u32                 : 6;
+} __attribute__((packed));
+
+union active_v_disp_u {
+       u32 val : 32;
+       struct active_v_disp_t f;
+} __attribute__((packed));
+
+struct graphic_h_disp_t {
+       u32 graphic_h_start : 10;
+       u32                 : 6;
+       u32 graphic_h_end   : 10;
+       u32                 : 6;
+} __attribute__((packed));
+
+union graphic_h_disp_u {
+       u32 val : 32;
+       struct graphic_h_disp_t f;
+} __attribute__((packed));
+
+struct graphic_v_disp_t {
+       u32 graphic_v_start : 10;
+       u32                 : 6;
+       u32 graphic_v_end   : 10;
+       u32                 : 6;
+} __attribute__((packed));
+
+union graphic_v_disp_u{
+       u32 val : 32;
+       struct graphic_v_disp_t f;
+} __attribute__((packed));
+
+struct graphic_ctrl_t_w100 {
+       u32 color_depth       : 3;
+       u32 portrait_mode     : 2;
+       u32 low_power_on      : 1;
+       u32 req_freq          : 4;
+       u32 en_crtc           : 1;
+       u32 en_graphic_req    : 1;
+       u32 en_graphic_crtc   : 1;
+       u32 total_req_graphic : 9;
+       u32 lcd_pclk_on       : 1;
+       u32 lcd_sclk_on       : 1;
+       u32 pclk_running      : 1;
+       u32 sclk_running      : 1;
+       u32                   : 6;
+} __attribute__((packed));
+
+struct graphic_ctrl_t_w32xx {
+       u32 color_depth       : 3;
+       u32 portrait_mode     : 2;
+       u32 low_power_on      : 1;
+       u32 req_freq          : 4;
+       u32 en_crtc           : 1;
+       u32 en_graphic_req    : 1;
+       u32 en_graphic_crtc   : 1;
+       u32 total_req_graphic : 10;
+       u32 lcd_pclk_on       : 1;
+       u32 lcd_sclk_on       : 1;
+       u32 pclk_running      : 1;
+       u32 sclk_running      : 1;
+       u32                   : 5;
+} __attribute__((packed));
+
+union graphic_ctrl_u {
+       u32 val : 32;
+       struct graphic_ctrl_t_w100 f_w100;
+       struct graphic_ctrl_t_w32xx f_w32xx;
 } __attribute__((packed));
 
 struct video_ctrl_t {
-     unsigned long video_mode       : 1;
-     unsigned long keyer_en         : 1;
-     unsigned long en_video_req     : 1;
-     unsigned long en_graphic_req_video           : 1;
-     unsigned long en_video_crtc    : 1;
-     unsigned long video_hor_exp    : 2;
-     unsigned long video_ver_exp    : 2;
-     unsigned long uv_combine       : 1;
-     unsigned long total_req_video  : 9;
-     unsigned long video_ch_sel     : 1;
-     unsigned long video_portrait   : 2;
-     unsigned long yuv2rgb_en       : 1;
-     unsigned long yuv2rgb_option   : 1;
-     unsigned long video_inv_hor    : 1;
-     unsigned long video_inv_ver    : 1;
-     unsigned long gamma_sel        : 2;
-     unsigned long dis_limit        : 1;
-     unsigned long en_uv_hblend     : 1;
-     unsigned long rgb_gamma_sel    : 2;
+       u32 video_mode       : 1;
+       u32 keyer_en         : 1;
+       u32 en_video_req     : 1;
+       u32 en_graphic_req_video  : 1;
+       u32 en_video_crtc    : 1;
+       u32 video_hor_exp    : 2;
+       u32 video_ver_exp    : 2;
+       u32 uv_combine       : 1;
+       u32 total_req_video  : 9;
+       u32 video_ch_sel     : 1;
+       u32 video_portrait   : 2;
+       u32 yuv2rgb_en       : 1;
+       u32 yuv2rgb_option   : 1;
+       u32 video_inv_hor    : 1;
+       u32 video_inv_ver    : 1;
+       u32 gamma_sel        : 2;
+       u32 dis_limit        : 1;
+       u32 en_uv_hblend     : 1;
+       u32 rgb_gamma_sel    : 2;
 } __attribute__((packed));
 
 union video_ctrl_u {
-     unsigned long val : 32;
-     struct video_ctrl_t f;
+       u32 val : 32;
+       struct video_ctrl_t f;
 } __attribute__((packed));
 
 struct disp_db_buf_cntl_rd_t {
-     unsigned long en_db_buf           : 1;
-     unsigned long update_db_buf_done   : 1;
-     unsigned long db_buf_cntl         : 6;
-     unsigned long                                     : 24;
+       u32 en_db_buf           : 1;
+       u32 update_db_buf_done  : 1;
+       u32 db_buf_cntl         : 6;
+       u32                     : 24;
 } __attribute__((packed));
 
 union disp_db_buf_cntl_rd_u {
-     unsigned long val : 32;
-     struct disp_db_buf_cntl_rd_t f;
+       u32 val : 32;
+       struct disp_db_buf_cntl_rd_t f;
 } __attribute__((packed));
 
 struct disp_db_buf_cntl_wr_t {
-     unsigned long en_db_buf        : 1;
-     unsigned long update_db_buf    : 1;
-     unsigned long db_buf_cntl      : 6;
-     unsigned long    : 24;
+       u32 en_db_buf      : 1;
+       u32 update_db_buf  : 1;
+       u32 db_buf_cntl    : 6;
+       u32                : 24;
 } __attribute__((packed));
 
 union disp_db_buf_cntl_wr_u {
-     unsigned long val : 32;
-     struct disp_db_buf_cntl_wr_t f;
+       u32 val : 32;
+       struct disp_db_buf_cntl_wr_t f;
 } __attribute__((packed));
 
 struct gamma_value1_t {
-     unsigned long gamma1           : 8;
-     unsigned long gamma2           : 8;
-     unsigned long gamma3           : 8;
-     unsigned long gamma4           : 8;
+       u32 gamma1   : 8;
+       u32 gamma2   : 8;
+       u32 gamma3   : 8;
+       u32 gamma4   : 8;
 } __attribute__((packed));
 
 union gamma_value1_u {
-     unsigned long val : 32;
-     struct gamma_value1_t f;
+       u32 val : 32;
+       struct gamma_value1_t f;
 } __attribute__((packed));
 
 struct gamma_value2_t {
-     unsigned long gamma5           : 8;
-     unsigned long gamma6           : 8;
-     unsigned long gamma7           : 8;
-     unsigned long gamma8           : 8;
+       u32 gamma5   : 8;
+       u32 gamma6   : 8;
+       u32 gamma7   : 8;
+       u32 gamma8   : 8;
 } __attribute__((packed));
 
 union gamma_value2_u {
-     unsigned long val : 32;
-     struct gamma_value2_t f;
+       u32 val : 32;
+       struct gamma_value2_t f;
 } __attribute__((packed));
 
 struct gamma_slope_t {
-     unsigned long slope1           : 3;
-     unsigned long slope2           : 3;
-     unsigned long slope3           : 3;
-     unsigned long slope4           : 3;
-     unsigned long slope5           : 3;
-     unsigned long slope6           : 3;
-     unsigned long slope7           : 3;
-     unsigned long slope8           : 3;
-     unsigned long                             : 8;
+       u32 slope1   : 3;
+       u32 slope2   : 3;
+       u32 slope3   : 3;
+       u32 slope4   : 3;
+       u32 slope5   : 3;
+       u32 slope6   : 3;
+       u32 slope7   : 3;
+       u32 slope8   : 3;
+       u32          : 8;
 } __attribute__((packed));
 
 union gamma_slope_u {
-     unsigned long val : 32;
-     struct gamma_slope_t f;
+       u32 val : 32;
+       struct gamma_slope_t f;
 } __attribute__((packed));
 
 struct mc_ext_mem_location_t {
-     unsigned long mc_ext_mem_start : 16;
-     unsigned long mc_ext_mem_top   : 16;
+       u32 mc_ext_mem_start : 16;
+       u32 mc_ext_mem_top   : 16;
 } __attribute__((packed));
 
 union mc_ext_mem_location_u {
-     unsigned long val : 32;
-     struct mc_ext_mem_location_t f;
+       u32 val : 32;
+       struct mc_ext_mem_location_t f;
+} __attribute__((packed));
+
+struct mc_fb_location_t {
+       u32 mc_fb_start      : 16;
+       u32 mc_fb_top        : 16;
+} __attribute__((packed));
+
+union mc_fb_location_u {
+       u32 val : 32;
+       struct mc_fb_location_t f;
 } __attribute__((packed));
 
 struct clk_pin_cntl_t {
-     unsigned long osc_en           : 1;
-     unsigned long osc_gain         : 5;
-     unsigned long dont_use_xtalin  : 1;
-     unsigned long xtalin_pm_en     : 1;
-     unsigned long xtalin_dbl_en    : 1;
-     unsigned long                             : 7;
-     unsigned long cg_debug         : 16;
+       u32 osc_en           : 1;
+       u32 osc_gain         : 5;
+       u32 dont_use_xtalin  : 1;
+       u32 xtalin_pm_en     : 1;
+       u32 xtalin_dbl_en    : 1;
+       u32                  : 7;
+       u32 cg_debug         : 16;
 } __attribute__((packed));
 
 union clk_pin_cntl_u {
-     unsigned long val : 32;
-     struct clk_pin_cntl_t f;
+       u32 val : 32;
+       struct clk_pin_cntl_t f;
 } __attribute__((packed));
 
 struct pll_ref_fb_div_t {
-     unsigned long pll_ref_div      : 4;
-     unsigned long                             : 4;
-     unsigned long pll_fb_div_int   : 6;
-     unsigned long                             : 2;
-     unsigned long pll_fb_div_frac  : 3;
-     unsigned long                             : 1;
-     unsigned long pll_reset_time   : 4;
-     unsigned long pll_lock_time    : 8;
+       u32 pll_ref_div      : 4;
+       u32                  : 4;
+       u32 pll_fb_div_int   : 6;
+       u32                  : 2;
+       u32 pll_fb_div_frac  : 3;
+       u32                  : 1;
+       u32 pll_reset_time   : 4;
+       u32 pll_lock_time    : 8;
 } __attribute__((packed));
 
 union pll_ref_fb_div_u {
-     unsigned long val : 32;
-     struct pll_ref_fb_div_t f;
+       u32 val : 32;
+       struct pll_ref_fb_div_t f;
 } __attribute__((packed));
 
 struct pll_cntl_t {
-     unsigned long pll_pwdn         : 1;
-     unsigned long pll_reset        : 1;
-     unsigned long pll_pm_en        : 1;
-     unsigned long pll_mode         : 1;
-     unsigned long pll_refclk_sel   : 1;
-     unsigned long pll_fbclk_sel    : 1;
-     unsigned long pll_tcpoff       : 1;
-     unsigned long pll_pcp          : 3;
-     unsigned long pll_pvg          : 3;
-     unsigned long pll_vcofr        : 1;
-     unsigned long pll_ioffset      : 2;
-     unsigned long pll_pecc_mode    : 2;
-     unsigned long pll_pecc_scon    : 2;
-     unsigned long pll_dactal       : 4;
-     unsigned long pll_cp_clip      : 2;
-     unsigned long pll_conf         : 3;
-     unsigned long pll_mbctrl       : 2;
-     unsigned long pll_ring_off     : 1;
+       u32 pll_pwdn        : 1;
+       u32 pll_reset       : 1;
+       u32 pll_pm_en       : 1;
+       u32 pll_mode        : 1;
+       u32 pll_refclk_sel  : 1;
+       u32 pll_fbclk_sel   : 1;
+       u32 pll_tcpoff      : 1;
+       u32 pll_pcp         : 3;
+       u32 pll_pvg         : 3;
+       u32 pll_vcofr       : 1;
+       u32 pll_ioffset     : 2;
+       u32 pll_pecc_mode   : 2;
+       u32 pll_pecc_scon   : 2;
+       u32 pll_dactal      : 4;
+       u32 pll_cp_clip     : 2;
+       u32 pll_conf        : 3;
+       u32 pll_mbctrl      : 2;
+       u32 pll_ring_off    : 1;
 } __attribute__((packed));
 
 union pll_cntl_u {
-     unsigned long val : 32;
-     struct pll_cntl_t f;
+       u32 val : 32;
+       struct pll_cntl_t f;
 } __attribute__((packed));
 
 struct sclk_cntl_t {
-     unsigned long sclk_src_sel        : 2;
-     unsigned long                                     : 2;
-     unsigned long sclk_post_div_fast   : 4;
-     unsigned long sclk_clkon_hys      : 3;
-     unsigned long sclk_post_div_slow   : 4;
-     unsigned long disp_cg_ok2switch_en : 1;
-     unsigned long sclk_force_reg      : 1;
-     unsigned long sclk_force_disp     : 1;
-     unsigned long sclk_force_mc       : 1;
-     unsigned long sclk_force_extmc    : 1;
-     unsigned long sclk_force_cp       : 1;
-     unsigned long sclk_force_e2       : 1;
-     unsigned long sclk_force_e3       : 1;
-     unsigned long sclk_force_idct     : 1;
-     unsigned long sclk_force_bist     : 1;
-     unsigned long busy_extend_cp      : 1;
-     unsigned long busy_extend_e2      : 1;
-     unsigned long busy_extend_e3      : 1;
-     unsigned long busy_extend_idct    : 1;
-     unsigned long                                     : 3;
+       u32 sclk_src_sel         : 2;
+       u32                      : 2;
+       u32 sclk_post_div_fast   : 4;
+       u32 sclk_clkon_hys       : 3;
+       u32 sclk_post_div_slow   : 4;
+       u32 disp_cg_ok2switch_en : 1;
+       u32 sclk_force_reg       : 1;
+       u32 sclk_force_disp      : 1;
+       u32 sclk_force_mc        : 1;
+       u32 sclk_force_extmc     : 1;
+       u32 sclk_force_cp        : 1;
+       u32 sclk_force_e2        : 1;
+       u32 sclk_force_e3        : 1;
+       u32 sclk_force_idct      : 1;
+       u32 sclk_force_bist      : 1;
+       u32 busy_extend_cp       : 1;
+       u32 busy_extend_e2       : 1;
+       u32 busy_extend_e3       : 1;
+       u32 busy_extend_idct     : 1;
+       u32                      : 3;
 } __attribute__((packed));
 
 union sclk_cntl_u {
-     unsigned long val : 32;
-     struct sclk_cntl_t f;
+       u32 val : 32;
+       struct sclk_cntl_t f;
 } __attribute__((packed));
 
 struct pclk_cntl_t {
-     unsigned long pclk_src_sel     : 2;
-     unsigned long                             : 2;
-     unsigned long pclk_post_div    : 4;
-     unsigned long                             : 8;
-     unsigned long pclk_force_disp  : 1;
-     unsigned long                             : 15;
+       u32 pclk_src_sel     : 2;
+       u32                  : 2;
+       u32 pclk_post_div    : 4;
+       u32                  : 8;
+       u32 pclk_force_disp  : 1;
+       u32                  : 15;
 } __attribute__((packed));
 
 union pclk_cntl_u {
-     unsigned long val : 32;
-     struct pclk_cntl_t f;
+       u32 val : 32;
+       struct pclk_cntl_t f;
 } __attribute__((packed));
 
+
+#define TESTCLK_SRC_PLL   0x01
+#define TESTCLK_SRC_SCLK  0x02
+#define TESTCLK_SRC_PCLK  0x03
+/* 4 and 5 seem to by XTAL/M */
+#define TESTCLK_SRC_XTAL  0x06
+
 struct clk_test_cntl_t {
-     unsigned long testclk_sel      : 4;
-     unsigned long                             : 3;
-     unsigned long start_check_freq : 1;
-     unsigned long tstcount_rst     : 1;
-     unsigned long                             : 15;
-     unsigned long test_count       : 8;
+       u32 testclk_sel      : 4;
+       u32                  : 3;
+       u32 start_check_freq : 1;
+       u32 tstcount_rst     : 1;
+       u32                  : 15;
+       u32 test_count       : 8;
 } __attribute__((packed));
 
 union clk_test_cntl_u {
-     unsigned long val : 32;
-     struct clk_test_cntl_t f;
+       u32 val : 32;
+       struct clk_test_cntl_t f;
 } __attribute__((packed));
 
 struct pwrmgt_cntl_t {
-     unsigned long pwm_enable          : 1;
-     unsigned long                                     : 1;
-     unsigned long pwm_mode_req         : 2;
-     unsigned long pwm_wakeup_cond      : 2;
-     unsigned long pwm_fast_noml_hw_en  : 1;
-     unsigned long pwm_noml_fast_hw_en  : 1;
-     unsigned long pwm_fast_noml_cond   : 4;
-     unsigned long pwm_noml_fast_cond   : 4;
-     unsigned long pwm_idle_timer      : 8;
-     unsigned long pwm_busy_timer      : 8;
+       u32 pwm_enable           : 1;
+       u32                      : 1;
+       u32 pwm_mode_req         : 2;
+       u32 pwm_wakeup_cond      : 2;
+       u32 pwm_fast_noml_hw_en  : 1;
+       u32 pwm_noml_fast_hw_en  : 1;
+       u32 pwm_fast_noml_cond   : 4;
+       u32 pwm_noml_fast_cond   : 4;
+       u32 pwm_idle_timer       : 8;
+       u32 pwm_busy_timer       : 8;
 } __attribute__((packed));
 
 union pwrmgt_cntl_u {
-     unsigned long val : 32;
-     struct pwrmgt_cntl_t f;
+       u32 val : 32;
+       struct pwrmgt_cntl_t f;
+} __attribute__((packed));
+
+#define SRC_DATATYPE_EQU_DST   3
+
+#define ROP3_SRCCOPY   0xcc
+#define ROP3_PATCOPY   0xf0
+
+#define GMC_BRUSH_SOLID_COLOR  13
+#define GMC_BRUSH_NONE                 15
+
+#define DP_SRC_MEM_RECTANGULAR 2
+
+#define DP_OP_ROP      0
+
+struct dp_gui_master_cntl_t {
+       u32 gmc_src_pitch_offset_cntl : 1;
+       u32 gmc_dst_pitch_offset_cntl : 1;
+       u32 gmc_src_clipping          : 1;
+       u32 gmc_dst_clipping          : 1;
+       u32 gmc_brush_datatype        : 4;
+       u32 gmc_dst_datatype          : 4;
+       u32 gmc_src_datatype          : 3;
+       u32 gmc_byte_pix_order        : 1;
+       u32 gmc_default_sel           : 1;
+       u32 gmc_rop3                  : 8;
+       u32 gmc_dp_src_source         : 3;
+       u32 gmc_clr_cmp_fcn_dis       : 1;
+       u32                           : 1;
+       u32 gmc_wr_msk_dis            : 1;
+       u32 gmc_dp_op                 : 1;
+} __attribute__((packed));
+
+union dp_gui_master_cntl_u {
+       u32 val : 32;
+       struct dp_gui_master_cntl_t f;
+} __attribute__((packed));
+
+struct rbbm_status_t {
+       u32 cmdfifo_avail   : 7;
+       u32                 : 1;
+       u32 hirq_on_rbb     : 1;
+       u32 cprq_on_rbb     : 1;
+       u32 cfrq_on_rbb     : 1;
+       u32 hirq_in_rtbuf   : 1;
+       u32 cprq_in_rtbuf   : 1;
+       u32 cfrq_in_rtbuf   : 1;
+       u32 cf_pipe_busy    : 1;
+       u32 eng_ev_busy     : 1;
+       u32 cp_cmdstrm_busy : 1;
+       u32 e2_busy         : 1;
+       u32 rb2d_busy       : 1;
+       u32 rb3d_busy       : 1;
+       u32 se_busy         : 1;
+       u32 re_busy         : 1;
+       u32 tam_busy        : 1;
+       u32 tdm_busy        : 1;
+       u32 pb_busy         : 1;
+       u32                 : 6;
+       u32 gui_active      : 1;
+} __attribute__((packed));
+
+union rbbm_status_u {
+       u32 val : 32;
+       struct rbbm_status_t f;
+} __attribute__((packed));
+
+struct dp_datatype_t {
+       u32 dp_dst_datatype   : 4;
+       u32                   : 4;
+       u32 dp_brush_datatype : 4;
+       u32 dp_src2_type      : 1;
+       u32 dp_src2_datatype  : 3;
+       u32 dp_src_datatype   : 3;
+       u32                   : 11;
+       u32 dp_byte_pix_order : 1;
+       u32                   : 1;
+} __attribute__((packed));
+
+union dp_datatype_u {
+       u32 val : 32;
+       struct dp_datatype_t f;
+} __attribute__((packed));
+
+struct dp_mix_t {
+       u32                : 8;
+       u32 dp_src_source  : 3;
+       u32 dp_src2_source : 3;
+       u32                : 2;
+       u32 dp_rop3        : 8;
+       u32 dp_op          : 1;
+       u32                : 7;
+} __attribute__((packed));
+
+union dp_mix_u {
+       u32 val : 32;
+       struct dp_mix_t f;
+} __attribute__((packed));
+
+struct eng_cntl_t {
+       u32 erc_reg_rd_ws            : 1;
+       u32 erc_reg_wr_ws            : 1;
+       u32 erc_idle_reg_wr          : 1;
+       u32 dis_engine_triggers      : 1;
+       u32 dis_rop_src_uses_dst_w_h : 1;
+       u32 dis_src_uses_dst_dirmaj  : 1;
+       u32                          : 6;
+       u32 force_3dclk_when_2dclk   : 1;
+       u32                          : 19;
+} __attribute__((packed));
+
+union eng_cntl_u {
+       u32 val : 32;
+       struct eng_cntl_t f;
+} __attribute__((packed));
+
+struct dp_cntl_t {
+       u32 dst_x_dir   : 1;
+       u32 dst_y_dir   : 1;
+       u32 src_x_dir   : 1;
+       u32 src_y_dir   : 1;
+       u32 dst_major_x : 1;
+       u32 src_major_x : 1;
+       u32             : 26;
+} __attribute__((packed));
+
+union dp_cntl_u {
+       u32 val : 32;
+       struct dp_cntl_t f;
+} __attribute__((packed));
+
+struct dp_cntl_dst_dir_t {
+       u32           : 15;
+       u32 dst_y_dir : 1;
+       u32           : 15;
+       u32 dst_x_dir : 1;
+} __attribute__((packed));
+
+union dp_cntl_dst_dir_u {
+       u32 val : 32;
+       struct dp_cntl_dst_dir_t f;
 } __attribute__((packed));
 
 #endif
index da25eee..fba33c7 100644 (file)
@@ -13,7 +13,7 @@ config XEN
 if XEN
 config XEN_INTERFACE_VERSION
        hex
-       default 0x00030202
+       default 0x00030203
 
 menu "XEN"
 
@@ -172,6 +172,29 @@ config XEN_NETDEV_FRONTEND
          dedicated device-driver domain, or your master control domain
          (domain 0), then you almost certainly want to say Y here.
 
+config XEN_FRAMEBUFFER
+       tristate "Framebuffer-device frontend driver"
+       depends on XEN && FB
+       select FB_CFB_FILLRECT
+       select FB_CFB_COPYAREA
+       select FB_CFB_IMAGEBLIT
+       default y
+       help
+         The framebuffer-device frontend drivers allows the kernel to create a
+         virtual framebuffer.  This framebuffer can be viewed in another
+         domain.  Unless this domain has access to a real video card, you
+         probably want to say Y here.
+
+config XEN_KEYBOARD
+       tristate "Keyboard-device frontend driver"
+       depends on XEN
+       default y
+       help
+         The keyboard-device frontend driver allows the kernel to create a
+         virtual keyboard.  This keyboard can then be driven by another
+         domain.  If you've said Y to CONFIG_XEN_FRAMEBUFFER, you probably
+         want to say Y here.
+
 config XEN_SCRUB_PAGES
        bool "Scrub memory before freeing it to Xen"
        default y
index 59d9324..02f90a6 100644 (file)
@@ -194,7 +194,7 @@ static int blkback_probe(struct xenbus_device *dev,
        }
 
        /* setup back pointer */
-       be->blkif->be = be; 
+       be->blkif->be = be;
 
        err = xenbus_watch_path2(dev, dev->nodename, "physical-device",
                                 &be->backend_watch, backend_changed);
@@ -287,7 +287,7 @@ static void backend_changed(struct xenbus_watch *watch,
                }
 
                /* We're potentially connected now */
-               update_blkif_status(be->blkif); 
+               update_blkif_status(be->blkif);
        }
 }
 
@@ -301,10 +301,15 @@ static void frontend_changed(struct xenbus_device *dev,
        struct backend_info *be = dev->dev.driver_data;
        int err;
 
-       DPRINTK("");
+       DPRINTK("%s", xenbus_strstate(frontend_state));
 
        switch (frontend_state) {
        case XenbusStateInitialising:
+               if (dev->state == XenbusStateClosed) {
+                       printk("%s: %s: prepare for reconnect\n",
+                              __FUNCTION__, dev->nodename);
+                       xenbus_switch_state(dev, XenbusStateInitWait);
+               }
                break;
 
        case XenbusStateInitialised:
@@ -327,11 +332,14 @@ static void frontend_changed(struct xenbus_device *dev,
                break;
 
        case XenbusStateClosed:
+               xenbus_switch_state(dev, XenbusStateClosed);
+               if (xenbus_dev_is_online(dev))
+                       break;
+               /* fall through if not online */
+       case XenbusStateUnknown:
                device_unregister(&dev->dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
                                 frontend_state);
index 975674f..c969078 100644 (file)
@@ -27,7 +27,6 @@
 #ifndef __BLKIF__BACKEND__COMMON_H__
 #define __BLKIF__BACKEND__COMMON_H__
 
-#include <linux/config.h>
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -49,7 +48,7 @@
 
 #define WPRINTK(fmt, args...) printk(KERN_WARNING "blk_tap: " fmt, ##args)
 
-struct backend_info; 
+struct backend_info;
 
 typedef struct blkif_st {
        /* Unique identifier for this interface. */
@@ -62,7 +61,7 @@ typedef struct blkif_st {
        blkif_back_ring_t blk_ring;
        struct vm_struct *blk_ring_area;
        /* Back pointer to the backend_info. */
-       struct backend_info *be; 
+       struct backend_info *be;
        /* Private fields. */
        spinlock_t       blk_ring_lock;
        atomic_t         refcnt;
@@ -91,6 +90,7 @@ blkif_t *tap_alloc_blkif(domid_t domid);
 void tap_blkif_free(blkif_t *blkif);
 int tap_blkif_map(blkif_t *blkif, unsigned long shared_page, 
                  unsigned int evtchn);
+void tap_blkif_unmap(blkif_t *blkif);
 
 #define blkif_get(_b) (atomic_inc(&(_b)->refcnt))
 #define blkif_put(_b)                                  \
index 19e0eda..b0eccf4 100644 (file)
@@ -135,20 +135,25 @@ int tap_blkif_map(blkif_t *blkif, unsigned long shared_page,
        return 0;
 }
 
-void tap_blkif_free(blkif_t *blkif)
+void tap_blkif_unmap(blkif_t *blkif)
 {
-       atomic_dec(&blkif->refcnt);
-       wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
-
-       /* Already disconnected? */
-       if (blkif->irq)
+       if (blkif->irq) {
                unbind_from_irqhandler(blkif->irq, blkif);
-
+               blkif->irq = 0;
+       }
        if (blkif->blk_ring.sring) {
                unmap_frontend_page(blkif);
                free_vm_area(blkif->blk_ring_area);
+               blkif->blk_ring.sring = NULL;
        }
+}
+
+void tap_blkif_free(blkif_t *blkif)
+{
+       atomic_dec(&blkif->refcnt);
+       wait_event(blkif->waiting_to_free, atomic_read(&blkif->refcnt) == 0);
 
+       tap_blkif_unmap(blkif);
        kmem_cache_free(blkif_cachep, blkif);
 }
 
index b1ad47b..b08e1dc 100644 (file)
@@ -174,7 +174,7 @@ static int blktap_probe(struct xenbus_device *dev,
        }
 
        /* setup back pointer */
-       be->blkif->be = be; 
+       be->blkif->be = be;
        be->blkif->sectors = 0;
 
        /* set a watch on disk info, waiting for userspace to update details*/
@@ -247,6 +247,11 @@ static void tap_frontend_changed(struct xenbus_device *dev,
 
        switch (frontend_state) {
        case XenbusStateInitialising:
+               if (dev->state == XenbusStateClosed) {
+                       printk("%s: %s: prepare for reconnect\n",
+                              __FUNCTION__, dev->nodename);
+                       xenbus_switch_state(dev, XenbusStateInitWait);
+               }
                break;
 
        case XenbusStateInitialised:
@@ -264,15 +269,22 @@ static void tap_frontend_changed(struct xenbus_device *dev,
                break;
 
        case XenbusStateClosing:
+               if (be->blkif->xenblkd) {
+                       kthread_stop(be->blkif->xenblkd);
+                       be->blkif->xenblkd = NULL;
+               }
                xenbus_switch_state(dev, XenbusStateClosing);
                break;
 
        case XenbusStateClosed:
+               xenbus_switch_state(dev, XenbusStateClosed);
+               if (xenbus_dev_is_online(dev))
+                       break;
+               /* fall through if not online */
+       case XenbusStateUnknown:
                device_unregister(&dev->dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
                                 frontend_state);
index 6576135..eaf4ea6 100644 (file)
@@ -8,7 +8,6 @@
  *  Shared /dev/zero mmaping support, Feb 2000, Kanoj Sarcar <kanoj@sgi.com>
  */
 
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <linux/miscdevice.h>
 #include <linux/slab.h>
@@ -20,7 +19,6 @@
 #include <linux/tty.h>
 #include <linux/capability.h>
 #include <linux/smp_lock.h>
-#include <linux/devfs_fs_kernel.h>
 #include <linux/ptrace.h>
 #include <linux/device.h>
 #include <asm/pgalloc.h>
index 454fe42..a39a22a 100644 (file)
@@ -52,13 +52,13 @@ static int xencons_irq;
 
 static inline struct xencons_interface *xencons_interface(void)
 {
-       return mfn_to_virt(xen_start_info->console_mfn);
+       return mfn_to_virt(xen_start_info->console.domU.mfn);
 }
 
 static inline void notify_daemon(void)
 {
        /* Use evtchn: this is called early, before irq is set up. */
-       notify_remote_via_evtchn(xen_start_info->console_evtchn);
+       notify_remote_via_evtchn(xen_start_info->console.domU.evtchn);
 }
 
 int xencons_ring_send(const char *data, unsigned len)
@@ -110,24 +110,26 @@ static irqreturn_t handle_input(int irq, void *unused, struct pt_regs *regs)
 
 int xencons_ring_init(void)
 {
-       int err;
+       int irq;
 
        if (xencons_irq)
                unbind_from_irqhandler(xencons_irq, NULL);
        xencons_irq = 0;
 
-       if (!xen_start_info->console_evtchn)
-               return 0;
+       if (!is_running_on_xen() ||
+           is_initial_xendomain() ||
+           !xen_start_info->console.domU.evtchn)
+               return -ENODEV;
 
-       err = bind_evtchn_to_irqhandler(
-               xen_start_info->console_evtchn,
+       irq = bind_evtchn_to_irqhandler(
+               xen_start_info->console.domU.evtchn,
                handle_input, 0, "xencons", NULL);
-       if (err <= 0) {
-               printk(KERN_ERR "XEN console request irq failed %i\n", err);
-               return err;
+       if (irq < 0) {
+               printk(KERN_ERR "XEN console request irq failed %i\n", irq);
+               return irq;
        }
 
-       xencons_irq = err;
+       xencons_irq = irq;
 
        /* In case we have in-flight data after save/restore... */
        notify_daemon();
index 0969e21..f4eeedd 100644 (file)
@@ -1,4 +1,4 @@
-#include <linux/config.h>
+
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/sched.h>
@@ -92,8 +92,8 @@ static int setup_cpu_watcher(struct notifier_block *notifier,
                .flags = XBWF_new_thread };
        (void)register_xenbus_watch(&cpu_watch);
 
-       if (!(xen_start_info->flags & SIF_INITDOMAIN)) {
-               for_each_cpu(i)
+       if (!is_initial_xendomain()) {
+               for_each_possible_cpu(i)
                        vcpu_hotplug(i);
                printk(KERN_INFO "Brought up %ld CPUs\n",
                       (long)num_online_cpus());
@@ -139,7 +139,7 @@ int smp_suspend(void)
                        if (err) {
                                printk(KERN_CRIT "Failed to take all CPUs "
                                       "down: %d.\n", err);
-                               for_each_cpu(i)
+                               for_each_possible_cpu(i)
                                        vcpu_hotplug(i);
                                return err;
                        }
@@ -154,12 +154,12 @@ void smp_resume(void)
 {
        int cpu;
 
-       for_each_cpu(cpu)
+       for_each_possible_cpu(cpu)
                cpu_initialize_context(cpu);
 
        unlock_cpu_hotplug();
 
-       for_each_cpu(cpu)
+       for_each_possible_cpu(cpu)
                vcpu_hotplug(cpu);
 }
 
index 69541c6..77ca1bf 100644 (file)
@@ -30,7 +30,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/irq.h>
 #include <linux/interrupt.h>
@@ -473,6 +472,16 @@ static void set_affinity_irq(unsigned irq, cpumask_t dest)
        rebind_irq_to_cpu(irq, tcpu);
 }
 
+static int retrigger(unsigned int irq)
+{
+       int evtchn = evtchn_from_irq(irq);
+       shared_info_t *s = HYPERVISOR_shared_info;
+       if (!VALID_EVTCHN(evtchn))
+               return 1;
+       synch_set_bit(evtchn, &s->evtchn_pending[0]);
+       return 1;
+}
+
 /*
  * Interface to generic handling in irq.c
  */
@@ -531,14 +540,17 @@ static void end_dynirq(unsigned int irq)
 }
 
 static struct hw_interrupt_type dynirq_type = {
-       "Dynamic-irq",
-       startup_dynirq,
-       shutdown_dynirq,
-       enable_dynirq,
-       disable_dynirq,
-       ack_dynirq,
-       end_dynirq,
-       set_affinity_irq
+       .typename       = "Dynamic-irq",
+       .startup        = startup_dynirq,
+       .shutdown       = shutdown_dynirq,
+       .enable         = enable_dynirq,
+       .disable        = disable_dynirq,
+       .ack            = ack_dynirq,
+       .end            = end_dynirq,
+#ifdef CONFIG_SMP
+       .set_affinity   = set_affinity_irq,
+#endif
+       .retrigger      = retrigger,
 };
 
 static inline void pirq_unmask_notify(int pirq)
@@ -656,14 +668,17 @@ static void end_pirq(unsigned int irq)
 }
 
 static struct hw_interrupt_type pirq_type = {
-       "Phys-irq",
-       startup_pirq,
-       shutdown_pirq,
-       enable_pirq,
-       disable_pirq,
-       ack_pirq,
-       end_pirq,
-       set_affinity_irq
+       .typename       = "Phys-irq",
+       .startup        = startup_pirq,
+       .shutdown       = shutdown_pirq,
+       .enable         = enable_pirq,
+       .disable        = disable_pirq,
+       .ack            = ack_pirq,
+       .end            = end_pirq,
+#ifdef CONFIG_SMP
+       .set_affinity   = set_affinity_irq,
+#endif
+       .retrigger      = retrigger,
 };
 
 int irq_ignore_unhandled(unsigned int irq)
@@ -677,7 +692,7 @@ int irq_ignore_unhandled(unsigned int irq)
        return !!(irq_status.flags & XENIRQSTAT_shared);
 }
 
-void resend_irq_on_evtchn(struct hw_interrupt_type *h, unsigned int i)
+void resend_irq_on_evtchn(unsigned int i)
 {
        int evtchn = evtchn_from_irq(i);
        shared_info_t *s = HYPERVISOR_shared_info;
@@ -831,7 +846,7 @@ void __init xen_init_IRQ(void)
                irq_desc[dynirq_to_irq(i)].status  = IRQ_DISABLED;
                irq_desc[dynirq_to_irq(i)].action  = NULL;
                irq_desc[dynirq_to_irq(i)].depth   = 1;
-               irq_desc[dynirq_to_irq(i)].handler = &dynirq_type;
+               irq_desc[dynirq_to_irq(i)].chip    = &dynirq_type;
        }
 
        /* Phys IRQ space is statically bound (1:1 mapping). Nail refcnts. */
@@ -840,14 +855,13 @@ void __init xen_init_IRQ(void)
 
 #ifdef RTC_IRQ
                /* If not domain 0, force our RTC driver to fail its probe. */
-               if ((i == RTC_IRQ) &&
-                   !(xen_start_info->flags & SIF_INITDOMAIN))
+               if ((i == RTC_IRQ) && !is_initial_xendomain())
                        continue;
 #endif
 
                irq_desc[pirq_to_irq(i)].status  = IRQ_DISABLED;
                irq_desc[pirq_to_irq(i)].action  = NULL;
                irq_desc[pirq_to_irq(i)].depth   = 1;
-               irq_desc[pirq_to_irq(i)].handler = &pirq_type;
+               irq_desc[pirq_to_irq(i)].chip    = &pirq_type;
        }
 }
index a8dc712..66c9802 100644 (file)
@@ -31,7 +31,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/sched.h>
 #include <linux/mm.h>
@@ -41,6 +40,8 @@
 #include <asm/pgtable.h>
 #include <asm/uaccess.h>
 #include <asm/synch_bitops.h>
+#include <asm/io.h>
+#include <xen/interface/memory.h>
 
 /* External tools reserve first few grant table entries. */
 #define NR_RESERVED_ENTRIES 8
@@ -350,6 +351,8 @@ void gnttab_cancel_free_callback(struct gnttab_free_callback *callback)
 }
 EXPORT_SYMBOL_GPL(gnttab_cancel_free_callback);
 
+#ifdef CONFIG_XEN
+
 #ifndef __ia64__
 static int map_pte_fn(pte_t *pte, struct page *pmd_page,
                      unsigned long addr, void *data)
@@ -410,17 +413,53 @@ int gnttab_resume(void)
 
 int gnttab_suspend(void)
 {
-
 #ifndef __ia64__
        apply_to_page_range(&init_mm, (unsigned long)shared,
                            PAGE_SIZE * NR_GRANT_FRAMES,
                            unmap_pte_fn, NULL);
 #endif
+       return 0;
+}
+
+#else /* !CONFIG_XEN */
+
+#include <platform-pci.h>
 
+int gnttab_resume(void)
+{
+       unsigned long frames;
+       struct xen_add_to_physmap xatp;
+       unsigned int i;
+
+       frames = alloc_xen_mmio(PAGE_SIZE * NR_GRANT_FRAMES);
+
+       for (i = 0; i < NR_GRANT_FRAMES; i++) {
+               xatp.domid = DOMID_SELF;
+               xatp.idx = i;
+               xatp.space = XENMAPSPACE_grant_table;
+               xatp.gpfn = (frames >> PAGE_SHIFT) + i;
+               if (HYPERVISOR_memory_op(XENMEM_add_to_physmap, &xatp))
+                       BUG();
+       }
+
+       shared = ioremap(frames, PAGE_SIZE * NR_GRANT_FRAMES);
+       if (shared == NULL) {
+               printk("error to ioremap gnttab share frames\n");
+               return -1;
+       }
+
+       return 0;
+}
+
+int gnttab_suspend(void)
+{
+       iounmap(shared);
        return 0;
 }
 
-static int __init gnttab_init(void)
+#endif /* !CONFIG_XEN */
+
+int __init gnttab_init(void)
 {
        int i;
 
@@ -439,4 +478,6 @@ static int __init gnttab_init(void)
        return 0;
 }
 
+#ifdef CONFIG_XEN
 core_initcall(gnttab_init);
+#endif
index 42ee6a8..ab3ce04 100644 (file)
@@ -7,7 +7,6 @@
  *  published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
 #include <linux/kobject.h>
index bcb2ea1..34c3930 100644 (file)
@@ -106,7 +106,8 @@ static void pre_suspend(void)
        clear_fixmap(FIX_SHARED_INFO);
 
        xen_start_info->store_mfn = mfn_to_pfn(xen_start_info->store_mfn);
-       xen_start_info->console_mfn = mfn_to_pfn(xen_start_info->console_mfn);
+       xen_start_info->console.domU.mfn =
+               mfn_to_pfn(xen_start_info->console.domU.mfn);
 }
 
 static void post_suspend(void)
index f38f3cf..37b8e4c 100644 (file)
@@ -1,5 +1,4 @@
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/version.h>
 #include <linux/kernel.h>
 /*static*/ kmem_cache_t *skbuff_cachep;
 EXPORT_SYMBOL(skbuff_cachep);
 
-#define MAX_SKBUFF_ORDER 4
+/* Allow up to 64kB or page-sized packets (whichever is greater). */
+#if PAGE_SHIFT < 16
+#define MAX_SKBUFF_ORDER (16 - PAGE_SHIFT)
+#else
+#define MAX_SKBUFF_ORDER 0
+#endif
 static kmem_cache_t *skbuff_order_cachep[MAX_SKBUFF_ORDER + 1];
 
 static struct {
@@ -121,8 +125,7 @@ static int __init skbuff_init(void)
        for (order = 0; order <= MAX_SKBUFF_ORDER; order++) {
                size = PAGE_SIZE << order;
                sprintf(name[order], "xen-skb-%lu", size);
-               if (is_running_on_xen() &&
-                   (xen_start_info->flags & SIF_PRIVILEGED))
+               if (is_running_on_xen() && is_initial_xendomain())
                        skbuff_order_cachep[order] = kmem_cache_create(
                                name[order], size, size, 0,
                                skbuff_ctor, skbuff_dtor);
index 03edea6..eb87707 100644 (file)
@@ -6,7 +6,6 @@
  */
 
 #include <linux/module.h>
-#include <linux/config.h>
 #include <linux/init.h>
 #include <linux/kernel.h>
 #include <linux/mm.h>
@@ -39,15 +38,13 @@ extern void smp_trap_init(trap_info_t *);
 
 /* Number of siblings per CPU package */
 int smp_num_siblings = 1;
-int phys_proc_id[NR_CPUS]; /* Package ID of each logical CPU */
-EXPORT_SYMBOL(phys_proc_id);
-int cpu_core_id[NR_CPUS]; /* Core ID of each logical CPU */
-EXPORT_SYMBOL(cpu_core_id);
+EXPORT_SYMBOL(smp_num_siblings);
 #if defined(__i386__)
 int cpu_llc_id[NR_CPUS] __cpuinitdata = {[0 ... NR_CPUS-1] = BAD_APICID};
 #elif defined(__x86_64__)
 u8 cpu_llc_id[NR_CPUS] __cpuinitdata  = {[0 ... NR_CPUS-1] = BAD_APICID};
 #endif
+EXPORT_SYMBOL(cpu_llc_id);
 
 cpumask_t cpu_online_map;
 EXPORT_SYMBOL(cpu_online_map);
@@ -71,6 +68,7 @@ u8 cpu_2_logical_apicid[NR_CPUS] = { [0 ... NR_CPUS-1] = BAD_APICID };
 void *xquad_portio;
 
 cpumask_t cpu_sibling_map[NR_CPUS] __cacheline_aligned;
+EXPORT_SYMBOL(cpu_sibling_map);
 cpumask_t cpu_core_map[NR_CPUS] __cacheline_aligned;
 EXPORT_SYMBOL(cpu_core_map);
 
@@ -99,8 +97,8 @@ void __init smp_alloc_memory(void)
 static inline void
 set_cpu_sibling_map(int cpu)
 {
-       phys_proc_id[cpu] = cpu;
-       cpu_core_id[cpu]  = 0;
+       cpu_data[cpu].phys_proc_id = cpu;
+       cpu_data[cpu].cpu_core_id = 0;
 
        cpu_sibling_map[cpu] = cpumask_of_cpu(cpu);
        cpu_core_map[cpu]    = cpumask_of_cpu(cpu);
@@ -253,7 +251,14 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 
        xen_smp_intr_init(0);
 
-       for_each_cpu_mask (cpu, cpu_possible_map) {
+       /* Restrict the possible_map according to max_cpus. */
+       while ((num_possible_cpus() > 1) && (num_possible_cpus() > max_cpus)) {
+               for (cpu = NR_CPUS-1; !cpu_isset(cpu, cpu_possible_map); cpu--)
+                       continue;
+               cpu_clear(cpu, cpu_possible_map);
+       }
+
+       for_each_possible_cpu (cpu) {
                if (cpu == 0)
                        continue;
 
@@ -264,7 +269,8 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 #endif
                gdt_descr->address = get_zeroed_page(GFP_KERNEL);
                if (unlikely(!gdt_descr->address)) {
-                       printk(KERN_CRIT "CPU%d failed to allocate GDT\n", cpu);
+                       printk(KERN_CRIT "CPU%d failed to allocate GDT\n",
+                              cpu);
                        continue;
                }
                gdt_descr->size = GDT_SIZE;
@@ -292,7 +298,7 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
                irq_ctx_init(cpu);
 
 #ifdef CONFIG_HOTPLUG_CPU
-               if (xen_start_info->flags & SIF_INITDOMAIN)
+               if (is_initial_xendomain())
                        cpu_set(cpu, cpu_present_map);
 #else
                cpu_set(cpu, cpu_present_map);
@@ -303,12 +309,6 @@ void __init smp_prepare_cpus(unsigned int max_cpus)
 
        init_xenbus_allowed_cpumask();
 
-       /* Currently, Xen gives no dynamic NUMA/HT info. */
-       for (cpu = 1; cpu < NR_CPUS; cpu++) {
-               cpu_sibling_map[cpu] = cpumask_of_cpu(cpu);
-               cpu_core_map[cpu]    = cpumask_of_cpu(cpu);
-       }
-
 #ifdef CONFIG_X86_IO_APIC
        /*
         * Here we can be sure that there is an IO-APIC in the system. Let's
@@ -340,8 +340,8 @@ core_initcall(initialize_cpu_present_map);
 static void
 remove_siblinginfo(int cpu)
 {
-       phys_proc_id[cpu] = BAD_APICID;
-       cpu_core_id[cpu]  = BAD_APICID;
+       cpu_data[cpu].phys_proc_id = BAD_APICID;
+       cpu_data[cpu].cpu_core_id = BAD_APICID;
 
        cpus_clear(cpu_sibling_map[cpu]);
        cpus_clear(cpu_core_map[cpu]);
@@ -375,10 +375,8 @@ void __cpu_die(unsigned int cpu)
 
        xen_smp_intr_exit(cpu);
 
-#ifdef __i386__
        if (num_online_cpus() == 1)
                alternatives_smp_switch(0);
-#endif
 }
 
 #else /* !CONFIG_HOTPLUG_CPU */
@@ -403,10 +401,8 @@ int __devinit __cpu_up(unsigned int cpu)
        if (rc)
                return rc;
 
-#ifdef __i386__
        if (num_online_cpus() == 1)
                alternatives_smp_switch(1);
-#endif
 
        /* This must be done before setting cpu_online_map */
        set_cpu_sibling_map(cpu);
index f00cd81..fe9311b 100644 (file)
@@ -1,5 +1,4 @@
 
-#include <linux/config.h>
 #include <linux/proc_fs.h>
 #include <xen/xen_proc.h>
 
index b58cbe9..fd8bfdb 100644 (file)
@@ -7,7 +7,6 @@
  *  published by the Free Software Foundation.
  */
 
-#include <linux/config.h>
 #include <linux/err.h>
 #include <linux/kernel.h>
 #include <linux/module.h>
index e4e438b..8f7c890 100644 (file)
@@ -45,7 +45,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/config.h>
 #include <linux/module.h>
 #include <linux/netdevice.h>
 #include <linux/inetdevice.h>
 #include <linux/skbuff.h>
 #include <linux/ethtool.h>
 #include <net/dst.h>
+#include <net/xfrm.h>          /* secpath_reset() */
+#include <asm/hypervisor.h>    /* is_initial_xendomain() */
 
-static int nloopbacks = 8;
+static int nloopbacks = -1;
 module_param(nloopbacks, int, 0);
 MODULE_PARM_DESC(nloopbacks, "Number of netback-loopback devices to create");
 
@@ -77,10 +78,60 @@ static int loopback_close(struct net_device *dev)
        return 0;
 }
 
+#ifdef CONFIG_X86
+static int is_foreign(unsigned long pfn)
+{
+       /* NB. Play it safe for auto-translation mode. */
+       return (xen_feature(XENFEAT_auto_translated_physmap) ||
+               (phys_to_machine_mapping[pfn] & FOREIGN_FRAME_BIT));
+}
+#else
+/* How to detect a foreign mapping? Play it safe. */
+#define is_foreign(pfn)        (1)
+#endif
+
+static int skb_remove_foreign_references(struct sk_buff *skb)
+{
+       struct page *page;
+       unsigned long pfn;
+       int i, off;
+       char *vaddr;
+
+       BUG_ON(skb_shinfo(skb)->frag_list);
+
+       for (i = 0; i < skb_shinfo(skb)->nr_frags; i++) {
+               pfn = page_to_pfn(skb_shinfo(skb)->frags[i].page);
+               if (!is_foreign(pfn))
+                       continue;
+               
+               page = alloc_page(GFP_ATOMIC | __GFP_NOWARN);
+               if (unlikely(!page))
+                       return 0;
+
+               vaddr = kmap_skb_frag(&skb_shinfo(skb)->frags[i]);
+               off = skb_shinfo(skb)->frags[i].page_offset;
+               memcpy(page_address(page) + off,
+                      vaddr + off,
+                      skb_shinfo(skb)->frags[i].size);
+               kunmap_skb_frag(vaddr);
+
+               put_page(skb_shinfo(skb)->frags[i].page);
+               skb_shinfo(skb)->frags[i].page = page;
+       }
+
+       return 1;
+}
+
 static int loopback_start_xmit(struct sk_buff *skb, struct net_device *dev)
 {
        struct net_private *np = netdev_priv(dev);
 
+       if (!skb_remove_foreign_references(skb)) {
+               np->stats.tx_dropped++;
+               dev_kfree_skb(skb);
+               return 0;
+       }
+
        dst_release(skb->dst);
        skb->dst = NULL;
 
@@ -110,6 +161,11 @@ static int loopback_start_xmit(struct sk_buff *skb, struct net_device *dev)
        skb->protocol = eth_type_trans(skb, dev);
        skb->dev      = dev;
        dev->last_rx  = jiffies;
+
+       /* Flush netfilter context: rx'ed skbuffs not expected to have any. */
+       nf_reset(skb);
+       secpath_reset(skb);
+
        netif_rx(skb);
 
        return 0;
@@ -218,7 +274,7 @@ static int __init make_loopback(int i)
        return err;
 }
 
-static void __init clean_loopback(int i)
+static void __exit clean_loopback(int i)
 {
        struct net_device *dev1, *dev2;
        char dev_name[IFNAMSIZ];
@@ -239,6 +295,9 @@ static int __init loopback_init(void)
 {
        int i, err = 0;
 
+       if (nloopbacks == -1)
+               nloopbacks = is_initial_xendomain() ? 4 : 0;
+
        for (i = 0; i < nloopbacks; i++)
                if ((err = make_loopback(i)) != 0)
                        break;
index 0d34bc8..c61821c 100644 (file)
     printk("netback/xenbus (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
 #endif
 
-struct backend_info
-{
+struct backend_info {
        struct xenbus_device *dev;
        netif_t *netif;
-       struct xenbus_watch backend_watch;
        enum xenbus_state frontend_state;
 };
 
 static int connect_rings(struct backend_info *);
 static void connect(struct backend_info *);
-static void maybe_connect(struct backend_info *);
-static void backend_changed(struct xenbus_watch *, const char **,
-                           unsigned int);
+static void backend_create_netif(struct backend_info *be);
 
 static int netback_remove(struct xenbus_device *dev)
 {
        struct backend_info *be = dev->dev.driver_data;
 
-       if (be->backend_watch.node) {
-               unregister_xenbus_watch(&be->backend_watch);
-               kfree(be->backend_watch.node);
-               be->backend_watch.node = NULL;
-       }
        if (be->netif) {
                netif_disconnect(be->netif);
                be->netif = NULL;
@@ -63,8 +54,7 @@ static int netback_remove(struct xenbus_device *dev)
 
 /**
  * Entry point to this code when a new device is created.  Allocate the basic
- * structures, and watch the store waiting for the hotplug scripts to tell us
- * the device's handle.  Switch to InitWait.
+ * structures and switch to InitWait.
  */
 static int netback_probe(struct xenbus_device *dev,
                         const struct xenbus_device_id *id)
@@ -83,11 +73,6 @@ static int netback_probe(struct xenbus_device *dev,
        be->dev = dev;
        dev->dev.driver_data = be;
 
-       err = xenbus_watch_path2(dev, dev->nodename, "handle",
-                                &be->backend_watch, backend_changed);
-       if (err)
-               goto fail;
-
        do {
                err = xenbus_transaction_start(&xbt);
                if (err) {
@@ -108,6 +93,13 @@ static int netback_probe(struct xenbus_device *dev,
                        goto abort_transaction;
                }
 
+               err = xenbus_printf(xbt, dev->nodename,
+                                   "feature-rx-copy", "%d", 1);
+               if (err) {
+                       message = "writing feature-copying";
+                       goto abort_transaction;
+               }
+
                err = xenbus_transaction_end(xbt, 0);
        } while (err == -EAGAIN);
 
@@ -117,9 +109,11 @@ static int netback_probe(struct xenbus_device *dev,
        }
 
        err = xenbus_switch_state(dev, XenbusStateInitWait);
-       if (err) {
+       if (err)
                goto fail;
-       }
+
+       /* This kicks hotplug scripts, so do it immediately. */
+       backend_create_netif(be);
 
        return 0;
 
@@ -169,48 +163,30 @@ static int netback_uevent(struct xenbus_device *xdev, char **envp,
 }
 
 
-/**
- * Callback received when the hotplug scripts have placed the handle node.
- * Read it, and create a netif structure.  If the frontend is ready, connect.
- */
-static void backend_changed(struct xenbus_watch *watch,
-                           const char **vec, unsigned int len)
+static void backend_create_netif(struct backend_info *be)
 {
        int err;
        long handle;
-       struct backend_info *be
-               = container_of(watch, struct backend_info, backend_watch);
        struct xenbus_device *dev = be->dev;
 
-       DPRINTK("");
+       if (be->netif != NULL)
+               return;
 
        err = xenbus_scanf(XBT_NIL, dev->nodename, "handle", "%li", &handle);
-       if (XENBUS_EXIST_ERR(err)) {
-               /* Since this watch will fire once immediately after it is
-                  registered, we expect this.  Ignore it, and wait for the
-                  hotplug scripts. */
-               return;
-       }
        if (err != 1) {
                xenbus_dev_fatal(dev, err, "reading handle");
                return;
        }
 
-       if (be->netif == NULL) {
-               u8 be_mac[ETH_ALEN] = { 0, 0, 0, 0, 0, 0 };
-
-               be->netif = netif_alloc(dev->otherend_id, handle, be_mac);
-               if (IS_ERR(be->netif)) {
-                       err = PTR_ERR(be->netif);
-                       be->netif = NULL;
-                       xenbus_dev_fatal(dev, err, "creating interface");
-                       return;
-               }
-
-               kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
-
-               maybe_connect(be);
+       be->netif = netif_alloc(dev->otherend_id, handle);
+       if (IS_ERR(be->netif)) {
+               err = PTR_ERR(be->netif);
+               be->netif = NULL;
+               xenbus_dev_fatal(dev, err, "creating interface");
+               return;
        }
+
+       kobject_uevent(&dev->dev.kobj, KOBJ_ONLINE);
 }
 
 
@@ -222,17 +198,30 @@ static void frontend_changed(struct xenbus_device *dev,
 {
        struct backend_info *be = dev->dev.driver_data;
 
-       DPRINTK("");
+       DPRINTK("%s", xenbus_strstate(frontend_state));
 
        be->frontend_state = frontend_state;
 
        switch (frontend_state) {
        case XenbusStateInitialising:
+               if (dev->state == XenbusStateClosed) {
+                       printk("%s: %s: prepare for reconnect\n",
+                              __FUNCTION__, dev->nodename);
+                       if (be->netif) {
+                               netif_disconnect(be->netif);
+                               be->netif = NULL;
+                       }
+                       xenbus_switch_state(dev, XenbusStateInitWait);
+               }
+               break;
+
        case XenbusStateInitialised:
                break;
 
        case XenbusStateConnected:
-               maybe_connect(be);
+               backend_create_netif(be);
+               if (be->netif)
+                       connect(be);
                break;
 
        case XenbusStateClosing:
@@ -240,13 +229,16 @@ static void frontend_changed(struct xenbus_device *dev,
                break;
 
        case XenbusStateClosed:
+               xenbus_switch_state(dev, XenbusStateClosed);
+               if (xenbus_dev_is_online(dev))
+                       break;
+               /* fall through if not online */
+       case XenbusStateUnknown:
                if (be->netif != NULL)
                        kobject_uevent(&dev->dev.kobj, KOBJ_OFFLINE);
                device_unregister(&dev->dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL, "saw state %d at frontend",
                                 frontend_state);
@@ -255,15 +247,6 @@ static void frontend_changed(struct xenbus_device *dev,
 }
 
 
-/* ** Connection ** */
-
-
-static void maybe_connect(struct backend_info *be)
-{
-       if (be->netif && (be->frontend_state == XenbusStateConnected))
-               connect(be);
-}
-
 static void xen_net_read_rate(struct xenbus_device *dev,
                              unsigned long *bytes, unsigned long *usec)
 {
@@ -342,6 +325,10 @@ static void connect(struct backend_info *be)
        be->netif->remaining_credit = be->netif->credit_bytes;
 
        xenbus_switch_state(dev, XenbusStateConnected);
+
+       /* May not get a kick from the frontend, so start the tx_queue now. */
+       if (!netbk_can_queue(be->netif->dev))
+               netif_start_queue(be->netif->dev);
 }
 
 
@@ -349,7 +336,7 @@ static int connect_rings(struct backend_info *be)
 {
        struct xenbus_device *dev = be->dev;
        unsigned long tx_ring_ref, rx_ring_ref;
-       unsigned int evtchn;
+       unsigned int evtchn, rx_copy;
        int err;
        int val;
 
@@ -366,14 +353,29 @@ static int connect_rings(struct backend_info *be)
                return err;
        }
 
-       if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-rx-notify", "%d",
-                        &val) < 0)
-               val = 0;
-       if (val)
-               be->netif->can_queue = 1;
-       else
-               /* Must be non-zero for pfifo_fast to work. */
-               be->netif->dev->tx_queue_len = 1;
+       err = xenbus_scanf(XBT_NIL, dev->otherend, "request-rx-copy", "%u",
+                          &rx_copy);
+       if (err == -ENOENT) {
+               err = 0;
+               rx_copy = 0;
+       }
+       if (err < 0) {
+               xenbus_dev_fatal(dev, err, "reading %s/request-rx-copy",
+                                dev->otherend);
+               return err;
+       }
+       be->netif->copying_receiver = !!rx_copy;
+
+       if (be->netif->dev->tx_queue_len != 0) {
+               if (xenbus_scanf(XBT_NIL, dev->otherend,
+                                "feature-rx-notify", "%d", &val) < 0)
+                       val = 0;
+               if (val)
+                       be->netif->can_queue = 1;
+               else
+                       /* Must be non-zero for pfifo_fast to work. */
+                       be->netif->dev->tx_queue_len = 1;
+       }
 
        if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-sg", "%d", &val) < 0)
                val = 0;
@@ -390,6 +392,14 @@ static int connect_rings(struct backend_info *be)
                be->netif->dev->features |= NETIF_F_TSO;
        }
 
+       if (xenbus_scanf(XBT_NIL, dev->otherend, "feature-no-csum-offload",
+                        "%d", &val) < 0)
+               val = 0;
+       if (val) {
+               be->netif->features &= ~NETIF_F_IP_CSUM;
+               be->netif->dev->features &= ~NETIF_F_IP_CSUM;
+       }
+
        /* Map the shared frame, irq etc. */
        err = netif_map(be->netif, tx_ring_ref, rx_ring_ref, evtchn);
        if (err) {
index 86223a3..0026753 100644 (file)
@@ -181,6 +181,7 @@ static void pciback_frontend_changed(struct xenbus_device *xdev,
                xenbus_switch_state(xdev, XenbusStateClosing);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                dev_dbg(&xdev->dev, "frontend is gone! unregister device\n");
                device_unregister(&xdev->dev);
index 94015f5..7619ccf 100644 (file)
@@ -239,17 +239,17 @@ static void free_root_bus_devs(struct pci_bus *bus)
 {
        struct pci_dev *dev;
 
-       spin_lock(&pci_bus_lock);
+       down_write(&pci_bus_sem);
        while (!list_empty(&bus->devices)) {
                dev = container_of(bus->devices.next, struct pci_dev, bus_list);
-               spin_unlock(&pci_bus_lock);
+               up_write(&pci_bus_sem);
 
                dev_dbg(&dev->dev, "removing device\n");
                pci_remove_bus_device(dev);
 
-               spin_lock(&pci_bus_lock);
+               down_write(&pci_bus_sem);
        }
-       spin_unlock(&pci_bus_lock);
+       up_write(&pci_bus_sem);
 }
 
 void pcifront_free_roots(struct pcifront_device *pdev)
index 4fd9262..c5fca76 100644 (file)
@@ -225,6 +225,7 @@ static void pcifront_backend_changed(struct xenbus_device *xdev,
                pcifront_try_disconnect(pdev);
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                dev_warn(&xdev->dev, "backend went away!\n");
                pcifront_try_disconnect(pdev);
index 27b8fd2..c6e09cd 100644 (file)
@@ -5,7 +5,6 @@
 #ifndef __NETIF__BACKEND__COMMON_H__
 #define __NETIF__BACKEND__COMMON_H__
 
-#include <linux/config.h>
 #include <linux/version.h>
 #include <linux/module.h>
 #include <linux/interrupt.h>
@@ -46,11 +45,10 @@ typedef struct tpmif_st {
        atomic_t refcnt;
 
        struct backend_info *bi;
-       unsigned long mmap_vstart;
 
        grant_handle_t shmem_handle;
        grant_ref_t shmem_ref;
-       struct page *pagerange;
+       struct page **mmap_pages;
 
        char devname[20];
 } tpmif_t;
@@ -80,6 +78,9 @@ int vtpm_release_packets(tpmif_t * tpmif, int send_msgs);
 
 extern int num_frontends;
 
-#define MMAP_VADDR(t,_req) ((t)->mmap_vstart + ((_req) * PAGE_SIZE))
+static inline unsigned long idx_to_kaddr(tpmif_t *t, unsigned int idx)
+{
+       return (unsigned long)pfn_to_kaddr(page_to_pfn(t->mmap_pages[idx]));
+}
 
 #endif /* __TPMIF__BACKEND__COMMON_H__ */
index 0105bd9..2614aa5 100644 (file)
@@ -25,8 +25,8 @@ static tpmif_t *alloc_tpmif(domid_t domid, struct backend_info *bi)
        tpmif_t *tpmif;
 
        tpmif = kmem_cache_alloc(tpmif_cachep, GFP_KERNEL);
-       if (!tpmif)
-               return ERR_PTR(-ENOMEM);
+       if (tpmif == NULL)
+               goto out_of_memory;
 
        memset(tpmif, 0, sizeof (*tpmif));
        tpmif->domid = domid;
@@ -35,22 +35,27 @@ static tpmif_t *alloc_tpmif(domid_t domid, struct backend_info *bi)
        snprintf(tpmif->devname, sizeof(tpmif->devname), "tpmif%d", domid);
        atomic_set(&tpmif->refcnt, 1);
 
-       tpmif->pagerange = balloon_alloc_empty_page_range(TPMIF_TX_RING_SIZE);
-       BUG_ON(tpmif->pagerange == NULL);
-       tpmif->mmap_vstart = (unsigned long)pfn_to_kaddr(
-                                           page_to_pfn(tpmif->pagerange));
+       tpmif->mmap_pages = alloc_empty_pages_and_pagevec(TPMIF_TX_RING_SIZE);
+       if (tpmif->mmap_pages == NULL)
+               goto out_of_memory;
 
        list_add(&tpmif->tpmif_list, &tpmif_list);
        num_frontends++;
 
        return tpmif;
+
+ out_of_memory:
+       if (tpmif != NULL)
+               kmem_cache_free(tpmif_cachep, tpmif);
+       printk("%s: out of memory\n", __FUNCTION__);
+       return ERR_PTR(-ENOMEM);
 }
 
 static void free_tpmif(tpmif_t * tpmif)
 {
        num_frontends--;
        list_del(&tpmif->tpmif_list);
-       balloon_dealloc_empty_page_range(tpmif->pagerange, TPMIF_TX_RING_SIZE);
+       free_empty_pages_and_pagevec(tpmif->mmap_pages, TPMIF_TX_RING_SIZE);
        kmem_cache_free(tpmif_cachep, tpmif);
 }
 
index 466c3ee..701a5ad 100644 (file)
@@ -253,7 +253,7 @@ int _packet_write(struct packet *pak,
                        return 0;
                }
 
-               gnttab_set_map_op(&map_op, MMAP_VADDR(tpmif, i),
+               gnttab_set_map_op(&map_op, idx_to_kaddr(tpmif, i),
                                  GNTMAP_host_map, tx->ref, tpmif->domid);
 
                if (unlikely(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
@@ -270,7 +270,7 @@ int _packet_write(struct packet *pak,
 
                tocopy = min_t(size_t, size - offset, PAGE_SIZE);
 
-               if (copy_from_buffer((void *)(MMAP_VADDR(tpmif, i) |
+               if (copy_from_buffer((void *)(idx_to_kaddr(tpmif, i) |
                                              (tx->addr & ~PAGE_MASK)),
                                     &data[offset], tocopy, isuserbuffer)) {
                        tpmif_put(tpmif);
@@ -278,7 +278,7 @@ int _packet_write(struct packet *pak,
                }
                tx->size = tocopy;
 
-               gnttab_set_unmap_op(&unmap_op, MMAP_VADDR(tpmif, i),
+               gnttab_set_unmap_op(&unmap_op, idx_to_kaddr(tpmif, i),
                                    GNTMAP_host_map, handle);
 
                if (unlikely
@@ -391,7 +391,7 @@ static int packet_read_shmem(struct packet *pak,
 
                tx = &tpmif->tx->ring[i].req;
 
-               gnttab_set_map_op(&map_op, MMAP_VADDR(tpmif, i),
+               gnttab_set_map_op(&map_op, idx_to_kaddr(tpmif, i),
                                  GNTMAP_host_map, tx->ref, tpmif->domid);
 
                if (unlikely(HYPERVISOR_grant_table_op(GNTTABOP_map_grant_ref,
@@ -414,10 +414,10 @@ static int packet_read_shmem(struct packet *pak,
                }
 
                DPRINTK("Copying from mapped memory at %08lx\n",
-                       (unsigned long)(MMAP_VADDR(tpmif, i) |
+                       (unsigned long)(idx_to_kaddr(tpmif, i) |
                                        (tx->addr & ~PAGE_MASK)));
 
-               src = (void *)(MMAP_VADDR(tpmif, i) |
+               src = (void *)(idx_to_kaddr(tpmif, i) |
                               ((tx->addr & ~PAGE_MASK) + pg_offset));
                if (copy_to_buffer(&buffer[offset],
                                   src, to_copy, isuserbuffer)) {
@@ -428,7 +428,7 @@ static int packet_read_shmem(struct packet *pak,
                        tpmif->domid, buffer[offset], buffer[offset + 1],
                        buffer[offset + 2], buffer[offset + 3]);
 
-               gnttab_set_unmap_op(&unmap_op, MMAP_VADDR(tpmif, i),
+               gnttab_set_unmap_op(&unmap_op, idx_to_kaddr(tpmif, i),
                                    GNTMAP_host_map, handle);
 
                if (unlikely
index cb72a2e..4ee5c5b 100644 (file)
@@ -34,7 +34,6 @@ struct backend_info
 
        /* watch front end for changes */
        struct xenbus_watch backend_watch;
-       enum xenbus_state frontend_state;
 };
 
 static void maybe_connect(struct backend_info *be);
@@ -143,8 +142,6 @@ static void frontend_changed(struct xenbus_device *dev,
        struct backend_info *be = dev->dev.driver_data;
        int err;
 
-       be->frontend_state = frontend_state;
-
        switch (frontend_state) {
        case XenbusStateInitialising:
        case XenbusStateInitialised:
@@ -162,13 +159,12 @@ static void frontend_changed(struct xenbus_device *dev,
                be->instance = -1;
                break;
 
+       case XenbusStateUnknown:
        case XenbusStateClosed:
                device_unregister(&be->dev->dev);
                tpmback_remove(dev);
                break;
 
-       case XenbusStateUnknown:
-       case XenbusStateInitWait:
        default:
                xenbus_dev_fatal(dev, -EINVAL,
                                 "saw state %d at frontend",
index 7fd108b..da2fea3 100644 (file)
@@ -1,4 +1,4 @@
-#include <linux/config.h>
+
 #include <linux/mm.h>
 #include <linux/module.h>
 #include <linux/slab.h>
index b99991c..cd8ba02 100644 (file)
@@ -132,4 +132,16 @@ int xenbus_unmap_ring(struct xenbus_device *dev,
 }
 EXPORT_SYMBOL_GPL(xenbus_unmap_ring);
 
+int xenbus_dev_is_online(struct xenbus_device *dev)
+{
+       int rc, val;
+
+       rc = xenbus_scanf(XBT_NIL, dev->nodename, "online", "%d", &val);
+       if (rc != 1)
+               val = 0; /* no online node present */
+
+       return val;
+}
+EXPORT_SYMBOL_GPL(xenbus_dev_is_online);
+
 MODULE_LICENSE("Dual BSD/GPL");
index 24661a8..d167970 100644 (file)
 #include <xen/xenbus.h>
 #include <xen/driver_util.h>
 
-/* xenbus_probe.c */
-extern char *kasprintf(const char *fmt, ...);
-
 #define DPRINTK(fmt, args...) \
     pr_debug("xenbus_client (%s:%d) " fmt ".\n", __FUNCTION__, __LINE__, ##args)
 
+char *xenbus_strstate(enum xenbus_state state)
+{
+       static char *name[] = {
+               [ XenbusStateUnknown      ] = "Unknown",
+               [ XenbusStateInitialising ] = "Initialising",
+               [ XenbusStateInitWait     ] = "InitWait",
+               [ XenbusStateInitialised  ] = "Initialised",
+               [ XenbusStateConnected    ] = "Connected",
+               [ XenbusStateClosing      ] = "Closing",
+               [ XenbusStateClosed       ] = "Closed",
+       };
+       return (state < ARRAY_SIZE(name)) ? name[state] : "INVALID";
+}
+
 int xenbus_watch_path(struct xenbus_device *dev, const char *path,
                      struct xenbus_watch *watch,
                      void (*callback)(struct xenbus_watch *,
@@ -70,7 +81,7 @@ int xenbus_watch_path2(struct xenbus_device *dev, const char *path,
                                        const char **, unsigned int))
 {
        int err;
-       char *state = kasprintf("%s/%s", path, path2);
+       char *state = kasprintf(GFP_KERNEL, "%s/%s", path, path2);
        if (!state) {
                xenbus_dev_fatal(dev, -ENOMEM, "allocating path for watch");
                return -ENOMEM;
@@ -124,6 +135,13 @@ int xenbus_switch_state(struct xenbus_device *dev, enum xenbus_state state)
 }
 EXPORT_SYMBOL_GPL(xenbus_switch_state);
 
+int xenbus_frontend_closed(struct xenbus_device *dev)
+{
+       xenbus_switch_state(dev, XenbusStateClosed);
+       complete(&dev->down);
+       return 0;
+}
+EXPORT_SYMBOL_GPL(xenbus_frontend_closed);
 
 /**
  * Return the path to the error node for the given device, or NULL on failure.
@@ -131,7 +149,7 @@ EXPORT_SYMBOL_GPL(xenbus_switch_state);
  */
 static char *error_path(struct xenbus_device *dev)
 {
-       return kasprintf("error/%s", dev->nodename);
+       return kasprintf(GFP_KERNEL, "error/%s", dev->nodename);
 }
 
 
@@ -274,7 +292,7 @@ enum xenbus_state xenbus_read_driver_state(const char *path)
        enum xenbus_state result;
        int err = xenbus_gather(XBT_NIL, path, "state", "%d", &result, NULL);
        if (err)
-               result = XenbusStateClosed;
+               result = XenbusStateUnknown;
 
        return result;
 }
index c1c1ef8..38da320 100644 (file)
@@ -47,11 +47,6 @@ static DECLARE_WORK(probe_work, xenbus_probe, NULL);
 
 DECLARE_WAIT_QUEUE_HEAD(xb_waitq);
 
-static inline struct xenstore_domain_interface *xenstore_domain_interface(void)
-{
-       return mfn_to_virt(xen_start_info->store_mfn);
-}
-
 static irqreturn_t wake_waiting(int irq, void *unused, struct pt_regs *regs)
 {
        if (unlikely(xenstored_ready == 0)) {
@@ -90,7 +85,7 @@ static const void *get_input_chunk(XENSTORE_RING_IDX cons,
 
 int xb_write(const void *data, unsigned len)
 {
-       struct xenstore_domain_interface *intf = xenstore_domain_interface();
+       struct xenstore_domain_interface *intf = xen_store_interface;
        XENSTORE_RING_IDX cons, prod;
        int rc;
 
@@ -129,7 +124,7 @@ int xb_write(const void *data, unsigned len)
                intf->req_prod += avail;
 
                /* This implies mb() before other side sees interrupt. */
-               notify_remote_via_evtchn(xen_start_info->store_evtchn);
+               notify_remote_via_evtchn(xen_store_evtchn);
        }
 
        return 0;
@@ -137,7 +132,7 @@ int xb_write(const void *data, unsigned len)
 
 int xb_read(void *data, unsigned len)
 {
-       struct xenstore_domain_interface *intf = xenstore_domain_interface();
+       struct xenstore_domain_interface *intf = xen_store_interface;
        XENSTORE_RING_IDX cons, prod;
        int rc;
 
@@ -180,7 +175,7 @@ int xb_read(void *data, unsigned len)
                pr_debug("Finished read of %i bytes (%i to go)\n", avail, len);
 
                /* Implies mb(): they will see new header. */
-               notify_remote_via_evtchn(xen_start_info->store_evtchn);
+               notify_remote_via_evtchn(xen_store_evtchn);
        }
 
        return 0;
@@ -195,7 +190,7 @@ int xb_init_comms(void)
                unbind_from_irqhandler(xenbus_irq, &xb_waitq);
 
        err = bind_evtchn_to_irqhandler(
-               xen_start_info->store_evtchn, wake_waiting,
+               xen_store_evtchn, wake_waiting,
                0, "xenbus", &xb_waitq);
        if (err <= 0) {
                printk(KERN_ERR "XENBUS request irq failed %i\n", err);
index 42f97f5..9599d03 100644 (file)
@@ -39,5 +39,7 @@ int xb_write(const void *data, unsigned len);
 int xb_read(void *data, unsigned len);
 int xs_input_avail(void);
 extern wait_queue_head_t xb_waitq;
+extern struct xenstore_domain_interface *xen_store_interface;
+extern int xen_store_evtchn;
 
 #endif /* _XENBUS_COMMS_H */
index 02d3b46..c95c48b 100644 (file)
@@ -32,7 +32,6 @@
  * IN THE SOFTWARE.
  */
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/errno.h>
 #include <linux/uio.h>
@@ -285,7 +284,7 @@ static int xenbus_dev_open(struct inode *inode, struct file *filp)
 {
        struct xenbus_dev_data *u;
 
-       if (xen_start_info->store_evtchn == 0)
+       if (xen_store_evtchn == 0)
                return -ENOENT;
 
        nonseekable_open(inode, filp);
@@ -346,7 +345,7 @@ static struct file_operations xenbus_dev_file_ops = {
        .poll = xenbus_dev_poll,
 };
 
-static int __init
+int __init
 xenbus_dev_init(void)
 {
        xenbus_dev_intf = create_xen_proc_entry("xenbus", 0400);
@@ -355,5 +354,3 @@ xenbus_dev_init(void)
 
        return 0;
 }
-
-__initcall(xenbus_dev_init);
index a920722..733c5d9 100644 (file)
 
 #include <asm/io.h>
 #include <asm/page.h>
+#include <asm/maddr.h>
 #include <asm/pgtable.h>
 #include <asm/hypervisor.h>
 #include <xen/xenbus.h>
 #include <xen/xen_proc.h>
 #include <xen/evtchn.h>
 #include <xen/features.h>
+#include <xen/hvm.h>
 
 #include "xenbus_comms.h"
 
+int xen_store_evtchn;
+struct xenstore_domain_interface *xen_store_interface;
+static unsigned long xen_store_mfn;
+
 extern struct mutex xenwatch_mutex;
 
 static BLOCKING_NOTIFIER_HEAD(xenstore_notifier_list);
 
 static void wait_for_devices(struct xenbus_driver *xendrv);
 
+static int xenbus_probe_frontend(const char *type, const char *name);
+static int xenbus_uevent_backend(struct device *dev, char **envp,
+                                int num_envp, char *buffer, int buffer_size);
+static int xenbus_probe_backend(const char *type, const char *domid);
+
+static int xenbus_dev_probe(struct device *_dev);
+static int xenbus_dev_remove(struct device *_dev);
+static void xenbus_dev_shutdown(struct device *_dev);
+
 /* If something in array of ids matches this device, return it. */
 static const struct xenbus_device_id *
 match_device(const struct xenbus_device_id *arr, struct xenbus_device *dev)
@@ -168,15 +183,17 @@ static int read_frontend_details(struct xenbus_device *xendev)
 
 
 /* Bus type for frontend drivers. */
-static int xenbus_probe_frontend(const char *type, const char *name);
 static struct xen_bus_type xenbus_frontend = {
        .root = "device",
        .levels = 2,            /* device/type/<id> */
        .get_bus_id = frontend_bus_id,
        .probe = xenbus_probe_frontend,
        .bus = {
-               .name  = "xen",
-               .match = xenbus_match,
+               .name     = "xen",
+               .match    = xenbus_match,
+               .probe    = xenbus_dev_probe,
+               .remove   = xenbus_dev_remove,
+               .shutdown = xenbus_dev_shutdown,
        },
        .dev = {
                .bus_id = "xen",
@@ -221,18 +238,18 @@ static int backend_bus_id(char bus_id[BUS_ID_SIZE], const char *nodename)
        return 0;
 }
 
-static int xenbus_uevent_backend(struct device *dev, char **envp,
-                                int num_envp, char *buffer, int buffer_size);
-static int xenbus_probe_backend(const char *type, const char *domid);
 static struct xen_bus_type xenbus_backend = {
        .root = "backend",
        .levels = 3,            /* backend/type/<frontend>/<id> */
        .get_bus_id = backend_bus_id,
        .probe = xenbus_probe_backend,
        .bus = {
-               .name  = "xen-backend",
-               .match = xenbus_match,
-               .uevent = xenbus_uevent_backend,
+               .name     = "xen-backend",
+               .match    = xenbus_match,
+               .probe    = xenbus_dev_probe,
+               .remove   = xenbus_dev_remove,
+//             .shutdown = xenbus_dev_shutdown,
+               .uevent   = xenbus_uevent_backend,
        },
        .dev = {
                .bus_id = "xen-backend",
@@ -302,8 +319,23 @@ static void otherend_changed(struct xenbus_watch *watch,
 
        state = xenbus_read_driver_state(dev->otherend);
 
-       DPRINTK("state is %d, %s, %s",
-               state, dev->otherend_watch.node, vec[XS_WATCH_PATH]);
+       DPRINTK("state is %d (%s), %s, %s", state, xenbus_strstate(state),
+               dev->otherend_watch.node, vec[XS_WATCH_PATH]);
+
+       /*
+        * Ignore xenbus transitions during shutdown. This prevents us doing
+        * work that can fail e.g., when the rootfs is gone.
+        */
+       if (system_state > SYSTEM_RUNNING) {
+               struct xen_bus_type *bus = bus;
+               bus = container_of(dev->dev.bus, struct xen_bus_type, bus);
+               /* If we're frontend, drive the state machine to Closed. */
+               /* This should cause the backend to release our resources. */
+               if ((bus == &xenbus_frontend) && (state == XenbusStateClosing))
+                       xenbus_frontend_closed(dev);
+               return;
+       }
+
        if (drv->otherend_changed)
                drv->otherend_changed(dev, state);
 }
@@ -334,7 +366,7 @@ static int xenbus_dev_probe(struct device *_dev)
        const struct xenbus_device_id *id;
        int err;
 
-       DPRINTK("");
+       DPRINTK("%s", dev->nodename);
 
        if (!drv->probe) {
                err = -ENODEV;
@@ -379,7 +411,7 @@ static int xenbus_dev_remove(struct device *_dev)
        struct xenbus_device *dev = to_xenbus_device(_dev);
        struct xenbus_driver *drv = to_xenbus_driver(_dev->driver);
 
-       DPRINTK("");
+       DPRINTK("%s", dev->nodename);
 
        free_otherend_watch(dev);
        free_otherend_details(dev);
@@ -391,6 +423,27 @@ static int xenbus_dev_remove(struct device *_dev)
        return 0;
 }
 
+static void xenbus_dev_shutdown(struct device *_dev)
+{
+       struct xenbus_device *dev = to_xenbus_device(_dev);
+       unsigned long timeout = 5*HZ;
+
+       DPRINTK("%s", dev->nodename);
+
+       get_device(&dev->dev);
+       if (dev->state != XenbusStateConnected) {
+               printk("%s: %s: %s != Connected, skipping\n", __FUNCTION__,
+                      dev->nodename, xenbus_strstate(dev->state));
+               goto out;
+       }
+       xenbus_switch_state(dev, XenbusStateClosing);
+       timeout = wait_for_completion_timeout(&dev->down, timeout);
+       if (!timeout)
+               printk("%s: %s timeout closing device\n", __FUNCTION__, dev->nodename);
+ out:
+       put_device(&dev->dev);
+}
+
 static int xenbus_register_driver_common(struct xenbus_driver *drv,
                                         struct xen_bus_type *bus)
 {
@@ -399,8 +452,6 @@ static int xenbus_register_driver_common(struct xenbus_driver *drv,
        drv->driver.name = drv->name;
        drv->driver.bus = &bus->bus;
        drv->driver.owner = drv->owner;
-       drv->driver.probe = xenbus_dev_probe;
-       drv->driver.remove = xenbus_dev_remove;
 
        mutex_lock(&xenwatch_mutex);
        ret = driver_register(&drv->driver);
@@ -508,27 +559,6 @@ static void xenbus_dev_release(struct device *dev)
                kfree(to_xenbus_device(dev));
 }
 
-/* Simplified asprintf. */
-char *kasprintf(const char *fmt, ...)
-{
-       va_list ap;
-       unsigned int len;
-       char *p, dummy[1];
-
-       va_start(ap, fmt);
-       /* FIXME: vsnprintf has a bug, NULL should work */
-       len = vsnprintf(dummy, 0, fmt, ap);
-       va_end(ap);
-
-       p = kmalloc(len + 1, GFP_KERNEL);
-       if (!p)
-               return NULL;
-       va_start(ap, fmt);
-       vsprintf(p, fmt, ap);
-       va_end(ap);
-       return p;
-}
-
 static ssize_t xendev_show_nodename(struct device *dev,
                                    struct device_attribute *attr, char *buf)
 {
@@ -575,6 +605,7 @@ static int xenbus_probe_node(struct xen_bus_type *bus,
        tmpstring += strlen(tmpstring) + 1;
        strcpy(tmpstring, type);
        xendev->devicetype = tmpstring;
+       init_completion(&xendev->down);
 
        xendev->dev.parent = &bus->dev;
        xendev->dev.bus = &bus->bus;
@@ -604,7 +635,7 @@ static int xenbus_probe_frontend(const char *type, const char *name)
        char *nodename;
        int err;
 
-       nodename = kasprintf("%s/%s/%s", xenbus_frontend.root, type, name);
+       nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_frontend.root, type, name);
        if (!nodename)
                return -ENOMEM;
 
@@ -623,7 +654,7 @@ static int xenbus_probe_backend_unit(const char *dir,
        char *nodename;
        int err;
 
-       nodename = kasprintf("%s/%s", dir, name);
+       nodename = kasprintf(GFP_KERNEL, "%s/%s", dir, name);
        if (!nodename)
                return -ENOMEM;
 
@@ -644,7 +675,7 @@ static int xenbus_probe_backend(const char *type, const char *domid)
 
        DPRINTK("");
 
-       nodename = kasprintf("%s/%s/%s", xenbus_backend.root, type, domid);
+       nodename = kasprintf(GFP_KERNEL, "%s/%s/%s", xenbus_backend.root, type, domid);
        if (!nodename)
                return -ENOMEM;
 
@@ -750,7 +781,7 @@ static void dev_changed(const char *node, struct xen_bus_type *bus)
        rootlen = strsep_len(node, '/', bus->levels);
        if (rootlen < 0)
                return;
-       root = kasprintf("%.*s", rootlen, node);
+       root = kasprintf(GFP_KERNEL, "%.*s", rootlen, node);
        if (!root)
                return;
 
@@ -840,7 +871,7 @@ static int resume_dev(struct device *dev, void *data)
                        printk(KERN_WARNING
                               "xenbus: resume %s failed: %i\n", 
                               dev->bus_id, err);
-                       return err; 
+                       return err;
                }
        }
 
@@ -852,7 +883,7 @@ static int resume_dev(struct device *dev, void *data)
                return err;
        }
 
-       return 0; 
+       return 0;
 }
 
 void xenbus_suspend(void)
@@ -928,8 +959,7 @@ static int xsd_kva_mmap(struct file *file, struct vm_area_struct *vma)
        if ((size > PAGE_SIZE) || (vma->vm_pgoff != 0))
                return -EINVAL;
 
-       if (remap_pfn_range(vma, vma->vm_start,
-                           mfn_to_pfn(xen_start_info->store_mfn),
+       if (remap_pfn_range(vma, vma->vm_start, mfn_to_pfn(xen_store_mfn),
                            size, vma->vm_page_prot))
                return -EAGAIN;
 
@@ -941,7 +971,7 @@ static int xsd_kva_read(char *page, char **start, off_t off,
 {
        int len;
 
-       len  = sprintf(page, "0x%p", mfn_to_virt(xen_start_info->store_mfn));
+       len  = sprintf(page, "0x%p", xen_store_interface);
        *eof = 1;
        return len;
 }
@@ -951,16 +981,15 @@ static int xsd_port_read(char *page, char **start, off_t off,
 {
        int len;
 
-       len  = sprintf(page, "%d", xen_start_info->store_evtchn);
+       len  = sprintf(page, "%d", xen_store_evtchn);
        *eof = 1;
        return len;
 }
 #endif
 
-
 static int __init xenbus_probe_init(void)
 {
-       int err = 0, dom0;
+       int err = 0;
        unsigned long page = 0;
 
        DPRINTK("");
@@ -975,9 +1004,7 @@ static int __init xenbus_probe_init(void)
        /*
         * Domain0 doesn't have a store_evtchn or store_mfn yet.
         */
-       dom0 = (xen_start_info->store_evtchn == 0);
-
-       if (dom0) {
+       if (is_initial_xendomain()) {
                struct evtchn_alloc_unbound alloc_unbound;
 
                /* Allocate page. */
@@ -985,7 +1012,7 @@ static int __init xenbus_probe_init(void)
                if (!page)
                        return -ENOMEM;
 
-               xen_start_info->store_mfn =
+               xen_store_mfn = xen_start_info->store_mfn =
                        pfn_to_mfn(virt_to_phys((void *)page) >>
                                   PAGE_SHIFT);
 
@@ -998,7 +1025,8 @@ static int __init xenbus_probe_init(void)
                if (err == -ENOSYS)
                        goto err;
                BUG_ON(err);
-               xen_start_info->store_evtchn = alloc_unbound.port;
+               xen_store_evtchn = xen_start_info->store_evtchn =
+                       alloc_unbound.port;
 
 #ifdef CONFIG_PROC_FS
                /* And finally publish the above info in /proc/xen */
@@ -1014,8 +1042,23 @@ static int __init xenbus_probe_init(void)
                if (xsd_port_intf)
                        xsd_port_intf->read_proc = xsd_port_read;
 #endif
-       } else
+               xen_store_interface = mfn_to_virt(xen_store_mfn);
+       } else {
                xenstored_ready = 1;
+#ifdef CONFIG_XEN
+               xen_store_evtchn = xen_start_info->store_evtchn;
+               xen_store_mfn = xen_start_info->store_mfn;
+               xen_store_interface = mfn_to_virt(xen_store_mfn);
+#else
+               xen_store_evtchn = hvm_get_parameter(HVM_PARAM_STORE_EVTCHN);
+               xen_store_mfn = hvm_get_parameter(HVM_PARAM_STORE_PFN);
+               xen_store_interface = ioremap(xen_store_mfn << PAGE_SHIFT,
+                                             PAGE_SIZE);
+#endif
+       }
+
+
+       xenbus_dev_init();
 
        /* Initialize the interface to xenstore. */
        err = xs_init();
@@ -1029,7 +1072,7 @@ static int __init xenbus_probe_init(void)
        device_register(&xenbus_frontend.dev);
        device_register(&xenbus_backend.dev);
 
-       if (!dom0)
+       if (!is_initial_xendomain())
                xenbus_probe(NULL);
 
        return 0;
@@ -1049,6 +1092,8 @@ static int __init xenbus_probe_init(void)
 
 postcore_initcall(xenbus_probe_init);
 
+MODULE_LICENSE("Dual BSD/GPL");
+
 
 static int is_disconnected_device(struct device *dev, void *data)
 {
@@ -1132,6 +1177,7 @@ static void wait_for_devices(struct xenbus_driver *xendrv)
                         print_device_status);
 }
 
+#ifndef MODULE
 static int __init boot_wait_for_devices(void)
 {
        ready_to_wait_for_devices = 1;
@@ -1140,3 +1186,4 @@ static int __init boot_wait_for_devices(void)
 }
 
 late_initcall(boot_wait_for_devices);
+#endif
index d7f6793..26b9829 100644 (file)
@@ -45,9 +45,6 @@
 #include <xen/xenbus.h>
 #include "xenbus_comms.h"
 
-/* xenbus_probe.c */
-extern char *kasprintf(const char *fmt, ...);
-
 struct xs_stored_msg {
        struct list_head list;
 
@@ -289,9 +286,9 @@ static char *join(const char *dir, const char *name)
        char *buffer;
 
        if (strlen(name) == 0)
-               buffer = kasprintf("%s", dir);
+               buffer = kasprintf(GFP_KERNEL, "%s", dir);
        else
-               buffer = kasprintf("%s/%s", dir, name);
+               buffer = kasprintf(GFP_KERNEL, "%s/%s", dir, name);
        return (!buffer) ? ERR_PTR(-ENOMEM) : buffer;
 }
 
@@ -665,7 +662,17 @@ EXPORT_SYMBOL_GPL(unregister_xenbus_watch);
 
 void xs_suspend(void)
 {
+       struct xenbus_watch *watch;
+       char token[sizeof(watch) * 2 + 1];
+
        down_write(&xs_state.suspend_mutex);
+
+       /* No need for watches_lock: the suspend_mutex is sufficient. */
+       list_for_each_entry(watch, &watches, list) {
+               sprintf(token, "%lX", (long)watch);
+               xs_unwatch(watch->node, token);
+       }
+
        mutex_lock(&xs_state.request_mutex);
 }
 
index d1705ab..d6d3efc 100644 (file)
@@ -90,7 +90,9 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
        } */
        /* copy user */
        if(ses->userName == NULL) {
-               /* BB what about null user mounts - check that we do this BB */
+               /* null user mount */
+               *bcc_ptr = 0;
+               *(bcc_ptr+1) = 0;
        } else { /* 300 should be long enough for any conceivable user name */
                bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->userName,
                                          300, nls_cp);
@@ -98,10 +100,13 @@ static void unicode_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
        bcc_ptr += 2 * bytes_ret;
        bcc_ptr += 2; /* account for null termination */
        /* copy domain */
-       if(ses->domainName == NULL)
-               bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr,
-                                         "CIFS_LINUX_DOM", 32, nls_cp);
-       else
+       if(ses->domainName == NULL) {
+               /* Sending null domain better than using a bogus domain name (as
+               we did briefly in 2.6.18) since server will use its default */
+               *bcc_ptr = 0;
+               *(bcc_ptr+1) = 0;
+               bytes_ret = 0;
+       } else
                bytes_ret = cifs_strtoUCS((__le16 *) bcc_ptr, ses->domainName, 
                                          256, nls_cp);
        bcc_ptr += 2 * bytes_ret;
@@ -144,13 +149,11 @@ static void ascii_ssetup_strings(char ** pbcc_area, struct cifsSesInfo *ses,
 
         /* copy domain */
        
-        if(ses->domainName == NULL) {
-                strcpy(bcc_ptr, "CIFS_LINUX_DOM");
-               bcc_ptr += 14;  /* strlen(CIFS_LINUX_DOM) */
-       } else {
+        if(ses->domainName != NULL) {
                 strncpy(bcc_ptr, ses->domainName, 256); 
                bcc_ptr += strnlen(ses->domainName, 256);
-       }
+       } /* else we will send a null domain name 
+            so the server will default to its own domain */
        *bcc_ptr = 0;
        bcc_ptr++;
 
index 4164cd5..ab171ea 100644 (file)
@@ -267,19 +267,19 @@ static struct fatent_operations fat32_ops = {
 
 static inline void lock_fat(struct msdos_sb_info *sbi)
 {
-       down(&sbi->fat_lock);
+       mutex_lock(&sbi->fat_lock);
 }
 
 static inline void unlock_fat(struct msdos_sb_info *sbi)
 {
-       up(&sbi->fat_lock);
+       mutex_unlock(&sbi->fat_lock);
 }
 
 void fat_ent_access_init(struct super_block *sb)
 {
        struct msdos_sb_info *sbi = MSDOS_SB(sb);
 
-       init_MUTEX(&sbi->fat_lock);
+       mutex_init(&sbi->fat_lock);
 
        switch (sbi->fat_bits) {
        case 32:
@@ -476,6 +476,7 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
                                sbi->prev_free = entry;
                                if (sbi->free_clusters != -1)
                                        sbi->free_clusters--;
+                               sb->s_dirt = 1;
 
                                cluster[idx_clus] = entry;
                                idx_clus++;
@@ -496,6 +497,7 @@ int fat_alloc_clusters(struct inode *inode, int *cluster, int nr_cluster)
 
        /* Couldn't allocate the free entries */
        sbi->free_clusters = 0;
+       sb->s_dirt = 1;
        err = -ENOSPC;
 
 out:
@@ -509,7 +511,6 @@ out:
        }
        for (i = 0; i < nr_bhs; i++)
                brelse(bhs[i]);
-       fat_clusters_flush(sb);
 
        if (err && idx_clus)
                fat_free_clusters(inode, cluster[0]);
@@ -542,8 +543,10 @@ int fat_free_clusters(struct inode *inode, int cluster)
                }
 
                ops->ent_put(&fatent, FAT_ENT_FREE);
-               if (sbi->free_clusters != -1)
+               if (sbi->free_clusters != -1) {
                        sbi->free_clusters++;
+                       sb->s_dirt = 1;
+               }
 
                if (nr_bhs + fatent.nr_bhs > MAX_BUF_PER_PAGE) {
                        if (sb->s_flags & MS_SYNCHRONOUS) {
@@ -578,7 +581,7 @@ error:
        return err;
 }
 
-EXPORT_SYMBOL(fat_free_clusters);
+EXPORT_SYMBOL_GPL(fat_free_clusters);
 
 int fat_count_free_clusters(struct super_block *sb)
 {
@@ -605,6 +608,7 @@ int fat_count_free_clusters(struct super_block *sb)
                } while (fat_ent_next(sbi, &fatent));
        }
        sbi->free_clusters = free;
+       sb->s_dirt = 1;
        fatent_brelse(&fatent);
 out:
        unlock_fat(sbi);
index 62e627b..97a9375 100644 (file)
@@ -287,7 +287,7 @@ static void nfs_show_mount_options(struct seq_file *m, struct nfs_server *nfss,
                { NFS_MOUNT_NONLM, ",nolock", "" },
                { NFS_MOUNT_NOACL, ",noacl", "" },
                { NFS_MOUNT_FSCACHE, ",fsc", "" },
-               { NFS_MOUNT_TAGXID, ",tagxid", "" },
+               { NFS_MOUNT_TAGXID, ",tagxid", ""},
                { 0, NULL, NULL }
        };
        const struct proc_nfs_info *nfs_infop;
@@ -527,6 +527,7 @@ static inline void nfs_initialise_sb(struct super_block *sb)
 
        if (server->flags & NFS_MOUNT_NOAC)
                sb->s_flags |= MS_SYNCHRONOUS;
+
        if (server->flags & NFS_MOUNT_TAGXID)
                sb->s_flags |= MS_TAGXID;
 
index 71bd2cd..9f5427c 100644 (file)
@@ -1,7 +1,7 @@
 /*
  * index.c - NTFS kernel index handling.  Part of the Linux-NTFS project.
  *
- * Copyright (c) 2004 Anton Altaparmakov
+ * Copyright (c) 2004-2005 Anton Altaparmakov
  *
  * This program/include file is free software; you can redistribute it and/or
  * modify it under the terms of the GNU General Public License as published
  * Allocate a new index context, initialize it with @idx_ni and return it.
  * Return NULL if allocation failed.
  *
- * Locking:  Caller must hold i_sem on the index inode.
+ * Locking:  Caller must hold i_mutex on the index inode.
  */
 ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *idx_ni)
 {
        ntfs_index_context *ictx;
 
        ictx = kmem_cache_alloc(ntfs_index_ctx_cache, SLAB_NOFS);
-       if (ictx) {
-               ictx->idx_ni = idx_ni;
-               ictx->entry = NULL;
-               ictx->data = NULL;
-               ictx->data_len = 0;
-               ictx->is_in_root = 0;
-               ictx->ir = NULL;
-               ictx->actx = NULL;
-               ictx->base_ni = NULL;
-               ictx->ia = NULL;
-               ictx->page = NULL;
-       }
+       if (ictx)
+               *ictx = (ntfs_index_context){ .idx_ni = idx_ni };
        return ictx;
 }
 
@@ -60,7 +50,7 @@ ntfs_index_context *ntfs_index_ctx_get(ntfs_inode *idx_ni)
  *
  * Release the index context @ictx, releasing all associated resources.
  *
- * Locking:  Caller must hold i_sem on the index inode.
+ * Locking:  Caller must hold i_mutex on the index inode.
  */
 void ntfs_index_ctx_put(ntfs_index_context *ictx)
 {
@@ -116,7 +106,7 @@ void ntfs_index_ctx_put(ntfs_index_context *ictx)
  * or ntfs_index_entry_write() before the call to ntfs_index_ctx_put() to
  * ensure that the changes are written to disk.
  *
- * Locking:  - Caller must hold i_sem on the index inode.
+ * Locking:  - Caller must hold i_mutex on the index inode.
  *          - Each page cache page in the index allocation mapping must be
  *            locked whilst being accessed otherwise we may find a corrupt
  *            page due to it being under ->writepage at the moment which
@@ -215,6 +205,7 @@ int ntfs_index_lookup(const void *key, const int key_len,
                                &ie->key, key_len)) {
 ir_done:
                        ictx->is_in_root = TRUE;
+                       ictx->ir = ir;
                        ictx->actx = actx;
                        ictx->base_ni = base_ni;
                        ictx->ia = NULL;
index 833df2a..d0ef418 100644 (file)
@@ -48,7 +48,7 @@ BOOL ntfs_mark_quotas_out_of_date(ntfs_volume *vol)
                ntfs_error(vol->sb, "Quota inodes are not open.");
                return FALSE;
        }
-       down(&vol->quota_q_ino->i_sem);
+       mutex_lock(&vol->quota_q_ino->i_mutex);
        ictx = ntfs_index_ctx_get(NTFS_I(vol->quota_q_ino));
        if (!ictx) {
                ntfs_error(vol->sb, "Failed to get index context.");
@@ -98,7 +98,7 @@ BOOL ntfs_mark_quotas_out_of_date(ntfs_volume *vol)
        ntfs_index_entry_mark_dirty(ictx);
 set_done:
        ntfs_index_ctx_put(ictx);
-       up(&vol->quota_q_ino->i_sem);
+       mutex_unlock(&vol->quota_q_ino->i_mutex);
        /*
         * We set the flag so we do not try to mark the quotas out of date
         * again on remount.
@@ -110,7 +110,7 @@ done:
 err_out:
        if (ictx)
                ntfs_index_ctx_put(ictx);
-       up(&vol->quota_q_ino->i_sem);
+       mutex_unlock(&vol->quota_q_ino->i_mutex);
        return FALSE;
 }
 
index f3bf016..cff10ab 100644 (file)
@@ -91,6 +91,7 @@ static void *nommu_vma_list_start(struct seq_file *m, loff_t *_pos)
                        next = _rb;
                        break;
                }
+               pos--;
        }
 
        return next;
index e302071..97ae1b9 100644 (file)
@@ -1,15 +1,17 @@
+#include <linux/capability.h>
 #include <linux/fs.h>
 #include <linux/posix_acl.h>
 #include <linux/reiserfs_fs.h>
 #include <linux/errno.h>
 #include <linux/pagemap.h>
 #include <linux/xattr.h>
-#include <linux/xattr_acl.h>
+#include <linux/posix_acl_xattr.h>
 #include <linux/reiserfs_xattr.h>
 #include <linux/reiserfs_acl.h>
 #include <asm/uaccess.h>
 
-static int reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl);
+static int reiserfs_set_acl(struct inode *inode, int type,
+                           struct posix_acl *acl);
 
 static int
 xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
@@ -34,14 +36,13 @@ xattr_set_acl(struct inode *inode, int type, const void *value, size_t size)
        } else
                acl = NULL;
 
-       error = reiserfs_set_acl (inode, type, acl);
+       error = reiserfs_set_acl(inode, type, acl);
 
-release_and_out:
+      release_and_out:
        posix_acl_release(acl);
        return error;
 }
 
-
 static int
 xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
 {
@@ -51,7 +52,7 @@ xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
        if (!reiserfs_posixacl(inode->i_sb))
                return -EOPNOTSUPP;
 
-       acl = reiserfs_get_acl (inode, type);
+       acl = reiserfs_get_acl(inode, type);
        if (IS_ERR(acl))
                return PTR_ERR(acl);
        if (acl == NULL)
@@ -62,12 +63,10 @@ xattr_get_acl(struct inode *inode, int type, void *buffer, size_t size)
        return error;
 }
 
-
 /*
  * Convert from filesystem to in-memory representation.
  */
-static struct posix_acl *
-posix_acl_from_disk(const void *value, size_t size)
+static struct posix_acl *posix_acl_from_disk(const void *value, size_t size)
 {
        const char *end = (char *)value + size;
        int n, count;
@@ -76,8 +75,8 @@ posix_acl_from_disk(const void *value, size_t size)
        if (!value)
                return NULL;
        if (size < sizeof(reiserfs_acl_header))
-                return ERR_PTR(-EINVAL);
-       if (((reiserfs_acl_header *)value)->a_version !=
+               return ERR_PTR(-EINVAL);
+       if (((reiserfs_acl_header *) value)->a_version !=
            cpu_to_le32(REISERFS_ACL_VERSION))
                return ERR_PTR(-EINVAL);
        value = (char *)value + sizeof(reiserfs_acl_header);
@@ -89,41 +88,39 @@ posix_acl_from_disk(const void *value, size_t size)
        acl = posix_acl_alloc(count, GFP_NOFS);
        if (!acl)
                return ERR_PTR(-ENOMEM);
-       for (n=0; n < count; n++) {
-               reiserfs_acl_entry *entry =
-                       (reiserfs_acl_entry *)value;
+       for (n = 0; n < count; n++) {
+               reiserfs_acl_entry *entry = (reiserfs_acl_entry *) value;
                if ((char *)value + sizeof(reiserfs_acl_entry_short) > end)
                        goto fail;
-               acl->a_entries[n].e_tag  = le16_to_cpu(entry->e_tag);
+               acl->a_entries[n].e_tag = le16_to_cpu(entry->e_tag);
                acl->a_entries[n].e_perm = le16_to_cpu(entry->e_perm);
-               switch(acl->a_entries[n].e_tag) {
-                       case ACL_USER_OBJ:
-                       case ACL_GROUP_OBJ:
-                       case ACL_MASK:
-                       case ACL_OTHER:
-                               value = (char *)value +
-                                       sizeof(reiserfs_acl_entry_short);
-                               acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
-                               break;
-
-                       case ACL_USER:
-                       case ACL_GROUP:
-                               value = (char *)value + sizeof(reiserfs_acl_entry);
-                               if ((char *)value > end)
-                                       goto fail;
-                               acl->a_entries[n].e_id =
-                                       le32_to_cpu(entry->e_id);
-                               break;
-
-                       default:
+               switch (acl->a_entries[n].e_tag) {
+               case ACL_USER_OBJ:
+               case ACL_GROUP_OBJ:
+               case ACL_MASK:
+               case ACL_OTHER:
+                       value = (char *)value +
+                           sizeof(reiserfs_acl_entry_short);
+                       acl->a_entries[n].e_id = ACL_UNDEFINED_ID;
+                       break;
+
+               case ACL_USER:
+               case ACL_GROUP:
+                       value = (char *)value + sizeof(reiserfs_acl_entry);
+                       if ((char *)value > end)
                                goto fail;
+                       acl->a_entries[n].e_id = le32_to_cpu(entry->e_id);
+                       break;
+
+               default:
+                       goto fail;
                }
        }
        if (value != end)
                goto fail;
        return acl;
 
-fail:
+      fail:
        posix_acl_release(acl);
        return ERR_PTR(-EINVAL);
 }
@@ -131,46 +128,46 @@ fail:
 /*
  * Convert from in-memory to filesystem representation.
  */
-static void *
-posix_acl_to_disk(const struct posix_acl *acl, size_t *size)
+static void *posix_acl_to_disk(const struct posix_acl *acl, size_t * size)
 {
        reiserfs_acl_header *ext_acl;
        char *e;
        int n;
 
        *size = reiserfs_acl_size(acl->a_count);
-       ext_acl = (reiserfs_acl_header *)kmalloc(sizeof(reiserfs_acl_header) +
-               acl->a_count * sizeof(reiserfs_acl_entry), GFP_NOFS);
+       ext_acl = (reiserfs_acl_header *) kmalloc(sizeof(reiserfs_acl_header) +
+                                                 acl->a_count *
+                                                 sizeof(reiserfs_acl_entry),
+                                                 GFP_NOFS);
        if (!ext_acl)
                return ERR_PTR(-ENOMEM);
        ext_acl->a_version = cpu_to_le32(REISERFS_ACL_VERSION);
        e = (char *)ext_acl + sizeof(reiserfs_acl_header);
-       for (n=0; n < acl->a_count; n++) {
-               reiserfs_acl_entry *entry = (reiserfs_acl_entry *)e;
-               entry->e_tag  = cpu_to_le16(acl->a_entries[n].e_tag);
+       for (n = 0; n < acl->a_count; n++) {
+               reiserfs_acl_entry *entry = (reiserfs_acl_entry *) e;
+               entry->e_tag = cpu_to_le16(acl->a_entries[n].e_tag);
                entry->e_perm = cpu_to_le16(acl->a_entries[n].e_perm);
-               switch(acl->a_entries[n].e_tag) {
-                       case ACL_USER:
-                       case ACL_GROUP:
-                               entry->e_id =
-                                       cpu_to_le32(acl->a_entries[n].e_id);
-                               e += sizeof(reiserfs_acl_entry);
-                               break;
-
-                       case ACL_USER_OBJ:
-                       case ACL_GROUP_OBJ:
-                       case ACL_MASK:
-                       case ACL_OTHER:
-                               e += sizeof(reiserfs_acl_entry_short);
-                               break;
-
-                       default:
-                               goto fail;
+               switch (acl->a_entries[n].e_tag) {
+               case ACL_USER:
+               case ACL_GROUP:
+                       entry->e_id = cpu_to_le32(acl->a_entries[n].e_id);
+                       e += sizeof(reiserfs_acl_entry);
+                       break;
+
+               case ACL_USER_OBJ:
+               case ACL_GROUP_OBJ:
+               case ACL_MASK:
+               case ACL_OTHER:
+                       e += sizeof(reiserfs_acl_entry_short);
+                       break;
+
+               default:
+                       goto fail;
                }
        }
        return (char *)ext_acl;
 
-fail:
+      fail:
        kfree(ext_acl);
        return ERR_PTR(-EINVAL);
 }
@@ -178,62 +175,62 @@ fail:
 /*
  * Inode operation get_posix_acl().
  *
- * inode->i_sem: down
+ * inode->i_mutex: down
  * BKL held [before 2.5.x]
  */
-struct posix_acl *
-reiserfs_get_acl(struct inode *inode, int type)
+struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
 {
        char *name, *value;
        struct posix_acl *acl, **p_acl;
-       size_t size;
+       int size;
        int retval;
-        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
-
-        switch (type) {
-            case ACL_TYPE_ACCESS:
-                name = XATTR_NAME_ACL_ACCESS;
-                p_acl = &reiserfs_i->i_acl_access;
-                break;
-            case ACL_TYPE_DEFAULT:
-                name = XATTR_NAME_ACL_DEFAULT;
-                p_acl = &reiserfs_i->i_acl_default;
-                break;
-            default:
-                return ERR_PTR (-EINVAL);
-        }
-
-        if (IS_ERR (*p_acl)) {
-            if (PTR_ERR (*p_acl) == -ENODATA)
-                return NULL;
-        } else if (*p_acl != NULL)
-            return posix_acl_dup (*p_acl);
-
-        size = reiserfs_xattr_get (inode, name, NULL, 0);
-        if ((int)size < 0) {
-            if (size == -ENODATA || size == -ENOSYS) {
-               *p_acl = ERR_PTR (-ENODATA);
-               return NULL;
-            }
-            return ERR_PTR (size);
-        }
+       struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+
+       switch (type) {
+       case ACL_TYPE_ACCESS:
+               name = POSIX_ACL_XATTR_ACCESS;
+               p_acl = &reiserfs_i->i_acl_access;
+               break;
+       case ACL_TYPE_DEFAULT:
+               name = POSIX_ACL_XATTR_DEFAULT;
+               p_acl = &reiserfs_i->i_acl_default;
+               break;
+       default:
+               return ERR_PTR(-EINVAL);
+       }
+
+       if (IS_ERR(*p_acl)) {
+               if (PTR_ERR(*p_acl) == -ENODATA)
+                       return NULL;
+       } else if (*p_acl != NULL)
+               return posix_acl_dup(*p_acl);
+
+       size = reiserfs_xattr_get(inode, name, NULL, 0);
+       if (size < 0) {
+               if (size == -ENODATA || size == -ENOSYS) {
+                       *p_acl = ERR_PTR(-ENODATA);
+                       return NULL;
+               }
+               return ERR_PTR(size);
+       }
 
-        value = kmalloc (size, GFP_NOFS);
-        if (!value)
-            return ERR_PTR (-ENOMEM);
+       value = kmalloc(size, GFP_NOFS);
+       if (!value)
+               return ERR_PTR(-ENOMEM);
 
        retval = reiserfs_xattr_get(inode, name, value, size);
        if (retval == -ENODATA || retval == -ENOSYS) {
                /* This shouldn't actually happen as it should have
                   been caught above.. but just in case */
                acl = NULL;
-               *p_acl = ERR_PTR (-ENODATA);
-        } else if (retval < 0) {
+               *p_acl = ERR_PTR(-ENODATA);
+       } else if (retval < 0) {
                acl = ERR_PTR(retval);
        } else {
                acl = posix_acl_from_disk(value, retval);
-               *p_acl = posix_acl_dup (acl);
-        }
+               if (!IS_ERR(acl))
+                       *p_acl = posix_acl_dup(acl);
+       }
 
        kfree(value);
        return acl;
@@ -242,275 +239,273 @@ reiserfs_get_acl(struct inode *inode, int type)
 /*
  * Inode operation set_posix_acl().
  *
- * inode->i_sem: down
+ * inode->i_mutex: down
  * BKL held [before 2.5.x]
  */
 static int
 reiserfs_set_acl(struct inode *inode, int type, struct posix_acl *acl)
 {
-        char *name;
+       char *name;
        void *value = NULL;
        struct posix_acl **p_acl;
        size_t size;
        int error;
-        struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+       struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
 
        if (S_ISLNK(inode->i_mode))
                return -EOPNOTSUPP;
 
-        switch (type) {
-            case ACL_TYPE_ACCESS:
-                name = XATTR_NAME_ACL_ACCESS;
-                p_acl = &reiserfs_i->i_acl_access;
-                if (acl) {
-                    mode_t mode = inode->i_mode;
-                    error = posix_acl_equiv_mode (acl, &mode);
-                    if (error < 0)
-                        return error;
-                    else {
-                        inode->i_mode = mode;
-                        if (error == 0)
-                            acl = NULL;
-                    }
-                }
-                break;
-            case ACL_TYPE_DEFAULT:
-                name = XATTR_NAME_ACL_DEFAULT;
-                p_acl = &reiserfs_i->i_acl_default;
-                if (!S_ISDIR (inode->i_mode))
-                    return acl ? -EACCES : 0;
-                break;
-            default:
-                return -EINVAL;
-        }
-
-       if (acl) {
-            value = posix_acl_to_disk(acl, &size);
-            if (IS_ERR(value))
-                return (int)PTR_ERR(value);
-            error = reiserfs_xattr_set(inode, name, value, size, 0);
+       switch (type) {
+       case ACL_TYPE_ACCESS:
+               name = POSIX_ACL_XATTR_ACCESS;
+               p_acl = &reiserfs_i->i_acl_access;
+               if (acl) {
+                       mode_t mode = inode->i_mode;
+                       error = posix_acl_equiv_mode(acl, &mode);
+                       if (error < 0)
+                               return error;
+                       else {
+                               inode->i_mode = mode;
+                               if (error == 0)
+                                       acl = NULL;
+                       }
+               }
+               break;
+       case ACL_TYPE_DEFAULT:
+               name = POSIX_ACL_XATTR_DEFAULT;
+               p_acl = &reiserfs_i->i_acl_default;
+               if (!S_ISDIR(inode->i_mode))
+                       return acl ? -EACCES : 0;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       if (acl) {
+               value = posix_acl_to_disk(acl, &size);
+               if (IS_ERR(value))
+                       return (int)PTR_ERR(value);
+               error = reiserfs_xattr_set(inode, name, value, size, 0);
        } else {
-            error = reiserfs_xattr_del (inode, name);
-            if (error == -ENODATA) {
-                /* This may seem odd here, but it means that the ACL was set
-                 * with a value representable with mode bits. If there was
-                 * an ACL before, reiserfs_xattr_del already dirtied the inode.
-                 */
-                mark_inode_dirty (inode);
-                error = 0;
-            }
-        }
-
-       if (value)
-               kfree(value);
-
-        if (!error) {
-            /* Release the old one */
-            if (!IS_ERR (*p_acl) && *p_acl)
-                posix_acl_release (*p_acl);
-
-            if (acl == NULL)
-                *p_acl = ERR_PTR (-ENODATA);
-            else
-                *p_acl = posix_acl_dup (acl);
-        }
+               error = reiserfs_xattr_del(inode, name);
+               if (error == -ENODATA) {
+                       /* This may seem odd here, but it means that the ACL was set
+                        * with a value representable with mode bits. If there was
+                        * an ACL before, reiserfs_xattr_del already dirtied the inode.
+                        */
+                       mark_inode_dirty(inode);
+                       error = 0;
+               }
+       }
+
+       kfree(value);
+
+       if (!error) {
+               /* Release the old one */
+               if (!IS_ERR(*p_acl) && *p_acl)
+                       posix_acl_release(*p_acl);
+
+               if (acl == NULL)
+                       *p_acl = ERR_PTR(-ENODATA);
+               else
+                       *p_acl = posix_acl_dup(acl);
+       }
 
        return error;
 }
 
-/* dir->i_sem: down,
+/* dir->i_mutex: locked,
  * inode is new and not released into the wild yet */
 int
-reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode)
+reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
+                            struct inode *inode)
 {
-    struct posix_acl *acl;
-    int err = 0;
-
-    /* ACLs only get applied to files and directories */
-    if (S_ISLNK (inode->i_mode))
-        return 0;
-
-    /* ACLs can only be used on "new" objects, so if it's an old object
-     * there is nothing to inherit from */
-    if (get_inode_sd_version (dir) == STAT_DATA_V1)
-        goto apply_umask;
-
-    /* Don't apply ACLs to objects in the .reiserfs_priv tree.. This
-     * would be useless since permissions are ignored, and a pain because
-     * it introduces locking cycles */
-    if (is_reiserfs_priv_object (dir)) {
-        reiserfs_mark_inode_private (inode);
-        goto apply_umask;
-    }
-
-    acl = reiserfs_get_acl (dir, ACL_TYPE_DEFAULT);
-    if (IS_ERR (acl)) {
-        if (PTR_ERR (acl) == -ENODATA)
-            goto apply_umask;
-        return PTR_ERR (acl);
-    }
-
-    if (acl) {
-        struct posix_acl *acl_copy;
-        mode_t mode = inode->i_mode;
-        int need_acl;
-
-        /* Copy the default ACL to the default ACL of a new directory */
-        if (S_ISDIR (inode->i_mode)) {
-            err = reiserfs_set_acl (inode, ACL_TYPE_DEFAULT, acl);
-            if (err)
-                goto cleanup;
-        }
-
-        /* Now we reconcile the new ACL and the mode,
-           potentially modifying both */
-        acl_copy = posix_acl_clone (acl, GFP_NOFS);
-        if (!acl_copy) {
-            err = -ENOMEM;
-            goto cleanup;
-        }
-
-
-        need_acl = posix_acl_create_masq (acl_copy, &mode);
-        if (need_acl >= 0) {
-            if (mode != inode->i_mode) {
-                inode->i_mode = mode;
-            }
-
-            /* If we need an ACL.. */
-            if (need_acl > 0) {
-                err = reiserfs_set_acl (inode, ACL_TYPE_ACCESS, acl_copy);
-                if (err)
-                    goto cleanup_copy;
-            }
-        }
-cleanup_copy:
-        posix_acl_release (acl_copy);
-cleanup:
-        posix_acl_release (acl);
-    } else {
-apply_umask:
-        /* no ACL, apply umask */
-        inode->i_mode &= ~current->fs->umask;
-    }
-
-    return err;
+       struct posix_acl *acl;
+       int err = 0;
+
+       /* ACLs only get applied to files and directories */
+       if (S_ISLNK(inode->i_mode))
+               return 0;
+
+       /* ACLs can only be used on "new" objects, so if it's an old object
+        * there is nothing to inherit from */
+       if (get_inode_sd_version(dir) == STAT_DATA_V1)
+               goto apply_umask;
+
+       /* Don't apply ACLs to objects in the .reiserfs_priv tree.. This
+        * would be useless since permissions are ignored, and a pain because
+        * it introduces locking cycles */
+       if (is_reiserfs_priv_object(dir)) {
+               reiserfs_mark_inode_private(inode);
+               goto apply_umask;
+       }
+
+       acl = reiserfs_get_acl(dir, ACL_TYPE_DEFAULT);
+       if (IS_ERR(acl)) {
+               if (PTR_ERR(acl) == -ENODATA)
+                       goto apply_umask;
+               return PTR_ERR(acl);
+       }
+
+       if (acl) {
+               struct posix_acl *acl_copy;
+               mode_t mode = inode->i_mode;
+               int need_acl;
+
+               /* Copy the default ACL to the default ACL of a new directory */
+               if (S_ISDIR(inode->i_mode)) {
+                       err = reiserfs_set_acl(inode, ACL_TYPE_DEFAULT, acl);
+                       if (err)
+                               goto cleanup;
+               }
+
+               /* Now we reconcile the new ACL and the mode,
+                  potentially modifying both */
+               acl_copy = posix_acl_clone(acl, GFP_NOFS);
+               if (!acl_copy) {
+                       err = -ENOMEM;
+                       goto cleanup;
+               }
+
+               need_acl = posix_acl_create_masq(acl_copy, &mode);
+               if (need_acl >= 0) {
+                       if (mode != inode->i_mode) {
+                               inode->i_mode = mode;
+                       }
+
+                       /* If we need an ACL.. */
+                       if (need_acl > 0) {
+                               err =
+                                   reiserfs_set_acl(inode, ACL_TYPE_ACCESS,
+                                                    acl_copy);
+                               if (err)
+                                       goto cleanup_copy;
+                       }
+               }
+             cleanup_copy:
+               posix_acl_release(acl_copy);
+             cleanup:
+               posix_acl_release(acl);
+       } else {
+             apply_umask:
+               /* no ACL, apply umask */
+               inode->i_mode &= ~current->fs->umask;
+       }
+
+       return err;
 }
 
 /* Looks up and caches the result of the default ACL.
  * We do this so that we don't need to carry the xattr_sem into
  * reiserfs_new_inode if we don't need to */
-int
-reiserfs_cache_default_acl (struct inode *inode)
+int reiserfs_cache_default_acl(struct inode *inode)
 {
-    int ret = 0;
-    if (reiserfs_posixacl (inode->i_sb) &&
-        !is_reiserfs_priv_object (inode)) {
-        struct posix_acl *acl;
-        reiserfs_read_lock_xattr_i (inode);
-        reiserfs_read_lock_xattrs (inode->i_sb);
-        acl = reiserfs_get_acl (inode, ACL_TYPE_DEFAULT);
-        reiserfs_read_unlock_xattrs (inode->i_sb);
-        reiserfs_read_unlock_xattr_i (inode);
-        ret = acl ? 1 : 0;
-        posix_acl_release (acl);
-    }
-
-    return ret;
+       int ret = 0;
+       if (reiserfs_posixacl(inode->i_sb) && !is_reiserfs_priv_object(inode)) {
+               struct posix_acl *acl;
+               reiserfs_read_lock_xattr_i(inode);
+               reiserfs_read_lock_xattrs(inode->i_sb);
+               acl = reiserfs_get_acl(inode, ACL_TYPE_DEFAULT);
+               reiserfs_read_unlock_xattrs(inode->i_sb);
+               reiserfs_read_unlock_xattr_i(inode);
+               ret = (acl && !IS_ERR(acl));
+               if (ret)
+                       posix_acl_release(acl);
+       }
+
+       return ret;
 }
 
-int
-reiserfs_acl_chmod (struct inode *inode)
+int reiserfs_acl_chmod(struct inode *inode)
 {
-        struct posix_acl *acl, *clone;
-        int error;
+       struct posix_acl *acl, *clone;
+       int error;
 
-        if (S_ISLNK(inode->i_mode))
-                return -EOPNOTSUPP;
+       if (S_ISLNK(inode->i_mode))
+               return -EOPNOTSUPP;
 
-       if (get_inode_sd_version (inode) == STAT_DATA_V1 ||
-           !reiserfs_posixacl(inode->i_sb))
-        {
-           return 0;
+       if (get_inode_sd_version(inode) == STAT_DATA_V1 ||
+           !reiserfs_posixacl(inode->i_sb)) {
+               return 0;
        }
 
-        reiserfs_read_lock_xattrs (inode->i_sb);
-        acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
-        reiserfs_read_unlock_xattrs (inode->i_sb);
-        if (!acl)
-                return 0;
-        if (IS_ERR(acl))
-                return PTR_ERR(acl);
-        clone = posix_acl_clone(acl, GFP_NOFS);
-        posix_acl_release(acl);
-        if (!clone)
-                return -ENOMEM;
-        error = posix_acl_chmod_masq(clone, inode->i_mode);
-        if (!error) {
-                int lock = !has_xattr_dir (inode);
-                reiserfs_write_lock_xattr_i (inode);
-                if (lock)
-                    reiserfs_write_lock_xattrs (inode->i_sb);
-                else
-                    reiserfs_read_lock_xattrs (inode->i_sb);
-                error = reiserfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
-                if (lock)
-                    reiserfs_write_unlock_xattrs (inode->i_sb);
-                else
-                    reiserfs_read_unlock_xattrs (inode->i_sb);
-                reiserfs_write_unlock_xattr_i (inode);
-        }
-        posix_acl_release(clone);
-        return error;
+       reiserfs_read_lock_xattrs(inode->i_sb);
+       acl = reiserfs_get_acl(inode, ACL_TYPE_ACCESS);
+       reiserfs_read_unlock_xattrs(inode->i_sb);
+       if (!acl)
+               return 0;
+       if (IS_ERR(acl))
+               return PTR_ERR(acl);
+       clone = posix_acl_clone(acl, GFP_NOFS);
+       posix_acl_release(acl);
+       if (!clone)
+               return -ENOMEM;
+       error = posix_acl_chmod_masq(clone, inode->i_mode);
+       if (!error) {
+               int lock = !has_xattr_dir(inode);
+               reiserfs_write_lock_xattr_i(inode);
+               if (lock)
+                       reiserfs_write_lock_xattrs(inode->i_sb);
+               else
+                       reiserfs_read_lock_xattrs(inode->i_sb);
+               error = reiserfs_set_acl(inode, ACL_TYPE_ACCESS, clone);
+               if (lock)
+                       reiserfs_write_unlock_xattrs(inode->i_sb);
+               else
+                       reiserfs_read_unlock_xattrs(inode->i_sb);
+               reiserfs_write_unlock_xattr_i(inode);
+       }
+       posix_acl_release(clone);
+       return error;
 }
 
 static int
 posix_acl_access_get(struct inode *inode, const char *name,
-                         void *buffer, size_t size)
+                    void *buffer, size_t size)
 {
-       if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1)
+       if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1)
                return -EINVAL;
        return xattr_get_acl(inode, ACL_TYPE_ACCESS, buffer, size);
 }
 
 static int
 posix_acl_access_set(struct inode *inode, const char *name,
-                         const void *value, size_t size, int flags)
+                    const void *value, size_t size, int flags)
 {
-       if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1)
+       if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1)
                return -EINVAL;
        return xattr_set_acl(inode, ACL_TYPE_ACCESS, value, size);
 }
 
-static int
-posix_acl_access_del (struct inode *inode, const char *name)
+static int posix_acl_access_del(struct inode *inode, const char *name)
 {
-    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
-    struct posix_acl **acl = &reiserfs_i->i_acl_access;
-    if (strlen(name) != sizeof(XATTR_NAME_ACL_ACCESS)-1)
-       return -EINVAL;
-    if (!IS_ERR (*acl) && *acl) {
-        posix_acl_release (*acl);
-        *acl = ERR_PTR (-ENODATA);
-    }
-
-    return 0;
+       struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+       struct posix_acl **acl = &reiserfs_i->i_acl_access;
+       if (strlen(name) != sizeof(POSIX_ACL_XATTR_ACCESS) - 1)
+               return -EINVAL;
+       if (!IS_ERR(*acl) && *acl) {
+               posix_acl_release(*acl);
+               *acl = ERR_PTR(-ENODATA);
+       }
+
+       return 0;
 }
 
 static int
-posix_acl_access_list (struct inode *inode, const char *name, int namelen, char *out)
+posix_acl_access_list(struct inode *inode, const char *name, int namelen,
+                     char *out)
 {
-    int len = namelen;
-    if (!reiserfs_posixacl (inode->i_sb))
-        return 0;
-    if (out)
-        memcpy (out, name, len);
+       int len = namelen;
+       if (!reiserfs_posixacl(inode->i_sb))
+               return 0;
+       if (out)
+               memcpy(out, name, len);
 
-    return len;
+       return len;
 }
 
 struct reiserfs_xattr_handler posix_acl_access_handler = {
-       .prefix = XATTR_NAME_ACL_ACCESS,
+       .prefix = POSIX_ACL_XATTR_ACCESS,
        .get = posix_acl_access_get,
        .set = posix_acl_access_set,
        .del = posix_acl_access_del,
@@ -518,52 +513,52 @@ struct reiserfs_xattr_handler posix_acl_access_handler = {
 };
 
 static int
-posix_acl_default_get (struct inode *inode, const char *name,
-                          void *buffer, size_t size)
+posix_acl_default_get(struct inode *inode, const char *name,
+                     void *buffer, size_t size)
 {
-       if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1)
+       if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
                return -EINVAL;
        return xattr_get_acl(inode, ACL_TYPE_DEFAULT, buffer, size);
 }
 
 static int
 posix_acl_default_set(struct inode *inode, const char *name,
-                          const void *value, size_t size, int flags)
+                     const void *value, size_t size, int flags)
 {
-       if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1)
+       if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
                return -EINVAL;
        return xattr_set_acl(inode, ACL_TYPE_DEFAULT, value, size);
 }
 
-static int
-posix_acl_default_del (struct inode *inode, const char *name)
+static int posix_acl_default_del(struct inode *inode, const char *name)
 {
-    struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
-    struct posix_acl **acl = &reiserfs_i->i_acl_default;
-    if (strlen(name) != sizeof(XATTR_NAME_ACL_DEFAULT)-1)
-       return -EINVAL;
-    if (!IS_ERR (*acl) && *acl) {
-        posix_acl_release (*acl);
-        *acl = ERR_PTR (-ENODATA);
-    }
-
-    return 0;
+       struct reiserfs_inode_info *reiserfs_i = REISERFS_I(inode);
+       struct posix_acl **acl = &reiserfs_i->i_acl_default;
+       if (strlen(name) != sizeof(POSIX_ACL_XATTR_DEFAULT) - 1)
+               return -EINVAL;
+       if (!IS_ERR(*acl) && *acl) {
+               posix_acl_release(*acl);
+               *acl = ERR_PTR(-ENODATA);
+       }
+
+       return 0;
 }
 
 static int
-posix_acl_default_list (struct inode *inode, const char *name, int namelen, char *out)
+posix_acl_default_list(struct inode *inode, const char *name, int namelen,
+                      char *out)
 {
-    int len = namelen;
-    if (!reiserfs_posixacl (inode->i_sb))
-        return 0;
-    if (out)
-        memcpy (out, name, len);
+       int len = namelen;
+       if (!reiserfs_posixacl(inode->i_sb))
+               return 0;
+       if (out)
+               memcpy(out, name, len);
 
-    return len;
+       return len;
 }
 
 struct reiserfs_xattr_handler posix_acl_default_handler = {
-       .prefix = XATTR_NAME_ACL_DEFAULT,
+       .prefix = POSIX_ACL_XATTR_DEFAULT,
        .get = posix_acl_default_get,
        .set = posix_acl_default_set,
        .del = posix_acl_default_del,
index dcbef0d..8ce7730 100644 (file)
@@ -31,7 +31,7 @@
 #define TRACE(s, args...)      {}
 #endif
 
-#define ERROR(s, args...)      printk(KERN_ERR "SQUASHFS error: "s, ## args)
+#define ERROR(s, args...)      printk(KERN_NOTICE "SQUASHFS error: "s, ## args)
 
 #define SERROR(s, args...)     do { \
                                if (!silent) \
@@ -49,7 +49,7 @@ static inline struct squashfs_inode_info *SQUASHFS_I(struct inode *inode)
 #define SQSH_EXTERN
 extern unsigned int squashfs_read_data(struct super_block *s, char *buffer,
                                long long index, unsigned int length,
-                               long long *next_index);
+                               long long *next_index, int srclength);
 extern int squashfs_get_cached_block(struct super_block *s, char *buffer,
                                long long block, unsigned int offset,
                                int length, long long *next_block,
@@ -59,6 +59,7 @@ extern void release_cached_fragment(struct squashfs_sb_info *msblk, struct
 extern struct squashfs_fragment_cache *get_cached_fragment(struct super_block
                                        *s, long long start_block,
                                        int length);
+extern struct inode *squashfs_iget(struct super_block *s, squashfs_inode_t inode, unsigned int inode_number);
 extern struct address_space_operations squashfs_symlink_aops;
 extern struct address_space_operations squashfs_aops;
 extern struct address_space_operations squashfs_aops_4K;
index 53ce95e..38ee736 100644 (file)
@@ -78,7 +78,7 @@ static int read_fragment_index_table_2(struct super_block *s)
                                        sblk->fragment_table_start,
                                        SQUASHFS_FRAGMENT_INDEX_BYTES_2
                                        (sblk->fragments) |
-                                       SQUASHFS_COMPRESSED_BIT_BLOCK, NULL)) {
+                                       SQUASHFS_COMPRESSED_BIT_BLOCK, NULL, SQUASHFS_FRAGMENT_INDEX_BYTES_2(sblk->fragments))) {
                ERROR("unable to read fragment index table\n");
                return 0;
        }
@@ -135,42 +135,35 @@ out:
 }
 
 
-static struct inode *squashfs_new_inode(struct super_block *s,
+static void squashfs_new_inode(struct squashfs_sb_info *msblk, struct inode *i,
                struct squashfs_base_inode_header_2 *inodeb, unsigned int ino)
 {
-       struct squashfs_sb_info *msblk = s->s_fs_info;
        struct squashfs_super_block *sblk = &msblk->sblk;
-       struct inode *i = new_inode(s);
-
-       if (i) {
-               i->i_ino = ino;
-               i->i_mtime.tv_sec = sblk->mkfs_time;
-               i->i_atime.tv_sec = sblk->mkfs_time;
-               i->i_ctime.tv_sec = sblk->mkfs_time;
-               i->i_uid = msblk->uid[inodeb->uid];
-               i->i_mode = inodeb->mode;
-               i->i_nlink = 1;
-               i->i_size = 0;
-               if (inodeb->guid == SQUASHFS_GUIDS)
-                       i->i_gid = i->i_uid;
-               else
-                       i->i_gid = msblk->guid[inodeb->guid];
-       }
 
-       return i;
+       i->i_ino = ino;
+       i->i_mtime.tv_sec = sblk->mkfs_time;
+       i->i_atime.tv_sec = sblk->mkfs_time;
+       i->i_ctime.tv_sec = sblk->mkfs_time;
+       i->i_uid = msblk->uid[inodeb->uid];
+       i->i_mode = inodeb->mode;
+       i->i_nlink = 1;
+       i->i_size = 0;
+       if (inodeb->guid == SQUASHFS_GUIDS)
+               i->i_gid = i->i_uid;
+       else
+               i->i_gid = msblk->guid[inodeb->guid];
 }
 
 
-static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t inode)
+static int squashfs_read_inode_2(struct inode *i, squashfs_inode_t inode)
 {
-       struct inode *i;
+       struct super_block *s = i->i_sb;
        struct squashfs_sb_info *msblk = s->s_fs_info;
        struct squashfs_super_block *sblk = &msblk->sblk;
        unsigned int block = SQUASHFS_INODE_BLK(inode) +
                sblk->inode_table_start;
        unsigned int offset = SQUASHFS_INODE_OFFSET(inode);
-       unsigned int ino = SQUASHFS_MK_VFS_INODE(block
-               - sblk->inode_table_start, offset);
+       unsigned int ino = i->i_ino;
        long long next_block;
        unsigned int next_offset;
        union squashfs_inode_header_2 id, sid;
@@ -192,6 +185,8 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                                        &next_offset))
                        goto failed_read;
 
+       squashfs_new_inode(msblk, i, inodeb, ino);
+
        switch(inodeb->inode_type) {
                case SQUASHFS_FILE_TYPE: {
                        struct squashfs_reg_inode_header_2 *inodep = &id.reg;
@@ -219,9 +214,6 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                                        inodep->fragment, &frag_blk, &frag_size))
                                goto failed_read;
                                
-                       if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-                               goto failed_read1;
-
                        i->i_size = inodep->file_size;
                        i->i_fop = &generic_ro_fops;
                        i->i_mode |= S_IFREG;
@@ -265,9 +257,6 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                                                &next_offset))
                                        goto failed_read;
 
-                       if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-                               goto failed_read1;
-
                        i->i_size = inodep->file_size;
                        i->i_op = &squashfs_dir_inode_ops_2;
                        i->i_fop = &squashfs_dir_ops_2;
@@ -305,9 +294,6 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                                                &next_offset))
                                        goto failed_read;
 
-                       if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-                               goto failed_read1;
-
                        i->i_size = inodep->file_size;
                        i->i_op = &squashfs_dir_inode_ops_2;
                        i->i_fop = &squashfs_dir_ops_2;
@@ -351,9 +337,6 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                                                &next_offset))
                                        goto failed_read;
 
-                       if((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-                               goto failed_read1;
-
                        i->i_size = inodep->symlink_size;
                        i->i_op = &page_symlink_inode_operations;
                        i->i_data.a_ops = &squashfs_symlink_aops;
@@ -386,9 +369,6 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                                                &next_offset))
                                        goto failed_read;
 
-                       if ((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-                               goto failed_read1;
-
                        i->i_mode |= (inodeb->inode_type ==
                                        SQUASHFS_CHRDEV_TYPE) ?  S_IFCHR :
                                        S_IFBLK;
@@ -402,8 +382,6 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                 }
                 case SQUASHFS_FIFO_TYPE:
                 case SQUASHFS_SOCKET_TYPE: {
-                       if ((i = squashfs_new_inode(s, inodeb, ino)) == NULL)
-                               goto failed_read1;
 
                        i->i_mode |= (inodeb->inode_type == SQUASHFS_FIFO_TYPE)
                                                        ? S_IFIFO : S_IFSOCK;
@@ -416,14 +394,13 @@ static struct inode *squashfs_iget_2(struct super_block *s, squashfs_inode_t ino
                        goto failed_read1;
        }
        
-       insert_inode_hash(i);
-       return i;
+       return 1;
 
 failed_read:
        ERROR("Unable to read inode [%x:%x]\n", block, offset);
 
 failed_read1:
-       return NULL;
+       return 0;
 }
 
 
@@ -485,12 +462,18 @@ static int get_dir_index_using_name(struct super_block *s, long long
        struct squashfs_sb_info *msblk = s->s_fs_info;
        struct squashfs_super_block *sblk = &msblk->sblk;
        int i, length = 0;
-       char buffer[sizeof(struct squashfs_dir_index_2) + SQUASHFS_NAME_LEN + 1];
-       struct squashfs_dir_index_2 *index = (struct squashfs_dir_index_2 *) buffer;
-       char str[SQUASHFS_NAME_LEN + 1];
+       struct squashfs_dir_index_2 *index;
+       char *str;
 
        TRACE("Entered get_dir_index_using_name, i_count %d\n", i_count);
 
+       if (!(str = kmalloc(sizeof(struct squashfs_dir_index) +
+               (SQUASHFS_NAME_LEN + 1) * 2, GFP_KERNEL))) {
+               ERROR("Failed to allocate squashfs_dir_index\n");
+               goto failure;
+       }
+
+       index = (struct squashfs_dir_index_2 *) (str + SQUASHFS_NAME_LEN + 1);
        strncpy(str, name, size);
        str[size] = '\0';
 
@@ -522,6 +505,8 @@ static int get_dir_index_using_name(struct super_block *s, long long
        }
 
        *next_offset = (length + *next_offset) % SQUASHFS_METADATA_SIZE;
+       kfree(str);
+failure:
        return length;
 }
 
@@ -533,14 +518,19 @@ static int squashfs_readdir_2(struct file *file, void *dirent, filldir_t filldir
        struct squashfs_super_block *sblk = &msblk->sblk;
        long long next_block = SQUASHFS_I(i)->start_block +
                sblk->directory_table_start;
-       int next_offset = SQUASHFS_I(i)->offset, length = 0, dirs_read = 0,
+       int next_offset = SQUASHFS_I(i)->offset, length = 0,
                dir_count;
        struct squashfs_dir_header_2 dirh;
-       char buffer[sizeof(struct squashfs_dir_entry_2) + SQUASHFS_NAME_LEN + 1];
-       struct squashfs_dir_entry_2 *dire = (struct squashfs_dir_entry_2 *) buffer;
+       struct squashfs_dir_entry_2 *dire;
 
        TRACE("Entered squashfs_readdir_2 [%llx:%x]\n", next_block, next_offset);
 
+       if (!(dire = kmalloc(sizeof(struct squashfs_dir_entry) +
+               SQUASHFS_NAME_LEN + 1, GFP_KERNEL))) {
+               ERROR("Failed to allocate squashfs_dir_entry\n");
+               goto finish;
+       }
+
        length = get_dir_index_using_offset(i->i_sb, &next_block, &next_offset,
                                SQUASHFS_I(i)->u.s2.directory_index_start,
                                SQUASHFS_I(i)->u.s2.directory_index_offset,
@@ -618,16 +608,17 @@ static int squashfs_readdir_2(struct file *file, void *dirent, filldir_t filldir
                                goto finish;
                        }
                        file->f_pos = length;
-                       dirs_read++;
                }
        }
 
 finish:
-       return dirs_read;
+       kfree(dire);
+       return 0;
 
 failed_read:
        ERROR("Unable to read directory block [%llx:%x]\n", next_block,
                next_offset);
+       kfree(dire);
        return 0;
 }
 
@@ -645,11 +636,16 @@ static struct dentry *squashfs_lookup_2(struct inode *i, struct dentry *dentry,
        int next_offset = SQUASHFS_I(i)->offset, length = 0,
                                dir_count;
        struct squashfs_dir_header_2 dirh;
-       char buffer[sizeof(struct squashfs_dir_entry_2) + SQUASHFS_NAME_LEN];
-       struct squashfs_dir_entry_2 *dire = (struct squashfs_dir_entry_2 *) buffer;
+       struct squashfs_dir_entry_2 *dire;
        int sorted = sblk->s_major == 2 && sblk->s_minor >= 1;
 
-       TRACE("Entered squashfs_lookup [%llx:%x]\n", next_block, next_offset);
+       TRACE("Entered squashfs_lookup_2 [%llx:%x]\n", next_block, next_offset);
+
+       if (!(dire = kmalloc(sizeof(struct squashfs_dir_entry) +
+               SQUASHFS_NAME_LEN + 1, GFP_KERNEL))) {
+               ERROR("Failed to allocate squashfs_dir_entry\n");
+               goto exit_loop;
+       }
 
        if (len > SQUASHFS_NAME_LEN)
                goto exit_loop;
@@ -717,12 +713,14 @@ static struct dentry *squashfs_lookup_2(struct inode *i, struct dentry *dentry,
                                squashfs_inode_t ino =
                                        SQUASHFS_MKINODE(dirh.start_block,
                                        dire->offset);
+                               unsigned int inode_number = SQUASHFS_MK_VFS_INODE(dirh.start_block,
+                                       dire->offset);
 
                                TRACE("calling squashfs_iget for directory "
                                        "entry %s, inode %x:%x, %lld\n", name,
                                        dirh.start_block, dire->offset, ino);
 
-                               inode = (msblk->iget)(i->i_sb, ino);
+                               inode = squashfs_iget(i->i_sb, ino, inode_number);
 
                                goto exit_loop;
                        }
@@ -730,6 +728,7 @@ static struct dentry *squashfs_lookup_2(struct inode *i, struct dentry *dentry,
        }
 
 exit_loop:
+       kfree(dire);
        d_add(dentry, inode);
        return ERR_PTR(0);
 
@@ -744,7 +743,7 @@ int squashfs_2_0_supported(struct squashfs_sb_info *msblk)
 {
        struct squashfs_super_block *sblk = &msblk->sblk;
 
-       msblk->iget = squashfs_iget_2;
+       msblk->read_inode = squashfs_read_inode_2;
        msblk->read_fragment_index_table = read_fragment_index_table_2;
 
        sblk->bytes_used = sblk->bytes_used_2;
index 364ea8c..aba7fcf 100644 (file)
@@ -1,54 +1,37 @@
 /*
- * Copyright (c) 2000-2004 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * 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.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would 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.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
-
 #include <linux/sched.h>
 #include <linux/mm.h>
 #include <linux/vmalloc.h>
 #include <linux/highmem.h>
 #include <linux/swap.h>
 #include <linux/blkdev.h>
-
 #include "time.h"
 #include "kmem.h"
 
 #define MAX_VMALLOCS   6
 #define MAX_SLAB_SIZE  0x20000
 
-
 void *
-kmem_alloc(size_t size, int flags)
+kmem_alloc(size_t size, unsigned int __nocast flags)
 {
        int     retries = 0;
-       int     lflags = kmem_flags_convert(flags);
+       gfp_t   lflags = kmem_flags_convert(flags);
        void    *ptr;
 
        do {
@@ -67,7 +50,7 @@ kmem_alloc(size_t size, int flags)
 }
 
 void *
-kmem_zalloc(size_t size, int flags)
+kmem_zalloc(size_t size, unsigned int __nocast flags)
 {
        void    *ptr;
 
@@ -89,7 +72,8 @@ kmem_free(void *ptr, size_t size)
 }
 
 void *
-kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags)
+kmem_realloc(void *ptr, size_t newsize, size_t oldsize,
+            unsigned int __nocast flags)
 {
        void    *new;
 
@@ -104,10 +88,10 @@ kmem_realloc(void *ptr, size_t newsize, size_t oldsize, int flags)
 }
 
 void *
-kmem_zone_alloc(kmem_zone_t *zone, int flags)
+kmem_zone_alloc(kmem_zone_t *zone, unsigned int __nocast flags)
 {
        int     retries = 0;
-       int     lflags = kmem_flags_convert(flags);
+       gfp_t   lflags = kmem_flags_convert(flags);
        void    *ptr;
 
        do {
@@ -123,7 +107,7 @@ kmem_zone_alloc(kmem_zone_t *zone, int flags)
 }
 
 void *
-kmem_zone_zalloc(kmem_zone_t *zone, int flags)
+kmem_zone_zalloc(kmem_zone_t *zone, unsigned int __nocast flags)
 {
        void    *ptr;
 
index 821d316..9a8ad48 100644 (file)
@@ -1,33 +1,19 @@
 /*
- * Copyright (c) 2000-2002 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2002,2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * 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.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would 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.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef __XFS_SUPPORT_SV_H__
 #define __XFS_SUPPORT_SV_H__
index 60b2aba..e794ca4 100644 (file)
@@ -1,33 +1,19 @@
 /*
- * Copyright (c) 2005 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * 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.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would 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.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef __XFS_EXPORT_H__
 #define __XFS_EXPORT_H__
@@ -68,7 +54,7 @@
  * Note, the NFS filehandle also includes an fsid portion which
  * may have an inode number in it.  That number is hardcoded to
  * 32bits and there is no way for XFS to intercept it.  In
- * practice this means when exporting an XFS filesytem with 64bit
+ * practice this means when exporting an XFS filesystem with 64bit
  * inodes you should either export the mountpoint (rather than
  * a subdirectory) or use the "fsid" export option.
  */
index 6a69a62..ad6173d 100644 (file)
@@ -1,51 +1,36 @@
 /*
- * Copyright (c) 2000-2003 Silicon Graphics, Inc.  All Rights Reserved.
+ * Copyright (c) 2000-2003,2005 Silicon Graphics, Inc.
+ * All Rights Reserved.
  *
- * This program is free software; you can redistribute it and/or modify it
- * under the terms of version 2 of the GNU General Public License as
+ * 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.
  *
- * This program is distributed in the hope that it would be useful, but
- * WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
+ * This program is distributed in the hope that it would 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.
  *
- * Further, this software is distributed without any warranty that it is
- * free of the rightful claim of any third person regarding infringement
- * or the like.  Any license provided herein, whether implied or
- * otherwise, applies only to this software file.  Patent licenses, if
- * any, provided herein do not apply to combinations of this program with
- * other software, or any other product whatsoever.
- *
- * You should have received a copy of the GNU General Public License along
- * with this program; if not, write the Free Software Foundation, Inc., 59
- * Temple Place - Suite 330, Boston MA 02111-1307, USA.
- *
- * Contact information: Silicon Graphics, Inc., 1600 Amphitheatre Pkwy,
- * Mountain View, CA  94043, or:
- *
- * http://www.sgi.com
- *
- * For further information regarding this notice, see:
- *
- * http://oss.sgi.com/projects/GenInfo/SGIGPLNoticeExplan/
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write the Free Software Foundation,
+ * Inc.,  51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
  */
 #ifndef __XFS_IOPS_H__
 #define __XFS_IOPS_H__
 
-extern struct inode_operations linvfs_file_inode_operations;
-extern struct inode_operations linvfs_dir_inode_operations;
-extern struct inode_operations linvfs_symlink_inode_operations;
-
-extern struct file_operations linvfs_file_operations;
-extern struct file_operations linvfs_invis_file_operations;
-extern struct file_operations linvfs_dir_operations;
+extern struct inode_operations xfs_inode_operations;
+extern struct inode_operations xfs_dir_inode_operations;
+extern struct inode_operations xfs_symlink_inode_operations;
 
-extern struct address_space_operations linvfs_aops;
-
-extern int linvfs_get_block(struct inode *, sector_t, struct buffer_head *, int);
-extern void linvfs_unwritten_done(struct buffer_head *, int);
+extern const struct file_operations xfs_file_operations;
+extern const struct file_operations xfs_dir_file_operations;
+extern const struct file_operations xfs_invis_file_operations;
 
 extern int xfs_ioctl(struct bhv_desc *, struct inode *, struct file *,
                         int, unsigned int, void __user *);
 
+struct xfs_inode;
+extern void xfs_ichgtime(struct xfs_inode *, int);
+extern void xfs_ichgtime_fast(struct xfs_inode *, struct inode *, int);
+
 #endif /* __XFS_IOPS_H__ */
index a5d489d..9a2b67d 100644 (file)
                orr     \rx, \rx, #0x00000be0
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x14]
-               tst     \rd, #0x20
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#include <asm/hardware/debug-8250.S>
index b31079a..21f6ee4 100644 (file)
@@ -7,6 +7,7 @@
  * License version 2. This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
+#include <asm/hardware.h>
 #include <asm/hardware/clps7111.h>
 
                .macro  disable_fiq
index dcd03a4..9213bfe 100644 (file)
                orr     \rx, \rx, #0x00000be0
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-1002:          ldrb    \rd, [\rx, #0x14]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1002b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x18]
-               tst     \rd, #0x10
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#define FLOW_CONTROL
+#include <asm/hardware/debug-8250.S>
index 97d15fc..b48cec4 100644 (file)
                orr     \rx, \rx, #0x000003f8
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
+#define UART_SHIFT     0
+#define FLOW_CONTROL
+#include <asm/hardware/debug-8250.S>
 
-               .macro  busyuart,rd,rx
-1002:          ldrb    \rd, [\rx, #0x5]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1002b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x6]
-               tst     \rd, #0x10
-               beq     1001b
-               .endm
 #else
        /* For EBSA285 debugging */
                .equ    dc21285_high, ARMCSR_BASE & 0xff000000
index db5729f..cf10ac9 100644 (file)
@@ -7,6 +7,8 @@
  * License version 2. This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
+#include <asm/hardware.h>
+#include <asm/arch/irqs.h>
 #include <asm/hardware/dec21285.h>
 
                .macro  disable_fiq
index 83f552f..c611871 100644 (file)
@@ -16,7 +16,7 @@
                tst     \rx, #1                 @ MMU enabled?
                moveq   \rx, #0x00000000        @ physical
                movne   \rx, #0xe0000000        @ virtual
-               orr     \rx, \rx, #0x00200000
+               orreq   \rx, \rx, #0x00200000   @ physical
                orr     \rx, \rx, #0x00006000   @ UART1 offset
                .endm
 
index 484a1aa..85b327c 100644 (file)
@@ -11,8 +11,6 @@
  *
 */
 
-#include <asm/hardware/amba_serial.h>
-
                .macro  addruart,rx
                mrc     p15, 0, \rx, c1, c0
                tst     \rx, #1                 @ MMU enabled?
                addne   \rx, \rx, #0x16000000 >> 4
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx, #UART01x_DR]
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldr     \rd, [\rx, #0x18]       @ UARTFLG
-               tst     \rd, #1 << 5            @ UARTFLGUTXFF - 1 when full
-               bne     1001b
-               .endm
-
-               .macro  busyuart,rd,rx
-1001:          ldr     \rd, [\rx, #0x18]       @ UARTFLG
-               tst     \rd, #1 << 3            @ UARTFLGUBUSY - 1 when busy
-               bne     1001b
-               .endm
+#include <asm/hardware/debug-pl01x.S>
index cc15f80..ce007e5 100644 (file)
 #endif
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-1002:          ldrb    \rd, [\rx, #0x5]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1002b
-               .endm
-
-               .macro  waituart,rd,rx
 #if !defined(CONFIG_ARCH_IQ80321) || !defined(CONFIG_ARCH_IQ31244) || !defined(CONFIG_ARCH_IQ80331)
-1001:          ldrb    \rd, [\rx, #0x6]
-               tst     \rd, #0x10
-               beq     1001b
+#define FLOW_CONTROL
 #endif
-               .endm
+#define UART_SHIFT     0
+#include <asm/hardware/debug-8250.S>
index e2ce7f5..926668c 100644 (file)
@@ -7,6 +7,7 @@
  * License version 2. This program is licensed "as is" without any
  * warranty of any kind, whether express or implied.
  */
+#include <asm/arch/irqs.h>
 
 #if defined(CONFIG_ARCH_IOP321)
                .macro  disable_fiq
index 5631e08..bc8b396 100644 (file)
 #endif
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-1002:          ldrb    \rd, [\rx, #0x14]
-               tst     \rd, #0x20
-               beq     1002b
-               .endm
-
-               .macro  waituart,rd,rx
-               nop
-               nop
-               nop
-               .endm
+#define UART_SHIFT     2
+#include <asm/hardware/debug-8250.S>
index 4499ae8..37bc8ef 100644 (file)
                 tst     \rx, #1                 @ MMU enabled?
                 moveq   \rx, #0xc8000000
                 movne   \rx, #0xff000000
+               orrne   \rx, \rx, #0x00b00000
                 add     \rx,\rx,#3              @ Uart regs are at off set of 3 if
                                                @ byte writes used - Big Endian.
                 .endm
 
-               .macro  senduart,rd,rx
-                strb    \rd, [\rx]
-                .endm
-
-                .macro  waituart,rd,rx
-1002:           ldrb    \rd, [\rx, #0x14]
-                and     \rd, \rd, #0x60                @ check THRE and TEMT bits
-                teq     \rd, #0x60
-                bne     1002b
-                .endm
-
-                .macro  busyuart,rd,rx
-                .endm
+#define UART_SHIFT     2
+#include <asm/hardware/debug-8250.S>
index d348548..af9667b 100644 (file)
 /*
  * Physical DRAM offset.
  */
-#define PHYS_OFFSET    (0x00000000UL)
+#define PHYS_OFFSET    UL(0x00000000)
 
-#ifndef __ASSEMBLY__
+#if !defined(__ASSEMBLY__) && defined(CONFIG_PCI)
 
-/*
- * Only first 64MB of memory can be accessed via PCI.
- * We use GFP_DMA to allocate safe buffers to do map/unmap.
- * This is really ugly and we need a better way of specifying
- * DMA-capable regions of memory.
- */
-static inline void __arch_adjust_zones(int node, unsigned long *zone_size, 
-       unsigned long *zhole_size) 
-{
-       unsigned int sz = SZ_64M >> PAGE_SHIFT;
-
-       /*
-        * Only adjust if > 64M on current system
-        */
-       if (node || (zone_size[0] <= sz))
-               return;
-
-       zone_size[1] = zone_size[0] - sz;
-       zone_size[0] = sz;
-       zhole_size[1] = zhole_size[0];
-       zhole_size[0] = 0;
-}
+void ixp4xx_adjust_zones(int node, unsigned long *size, unsigned long *holes);
 
 #define arch_adjust_zones(node, size, holes) \
-       __arch_adjust_zones(node, size, holes)
+       ixp4xx_adjust_zones(node, size, holes)
 
 #define ISA_DMA_THRESHOLD (SZ_64M - 1)
 
index 3a626c0..13aee17 100644 (file)
  */
 #define IXP4XX_EXP_BUS_BASE_PHYS       (0x50000000)
 
-#define        IXP4XX_EXP_BUS_CSX_REGION_SIZE  (0x01000000)
+/*
+ * The expansion bus on the IXP4xx can be configured for either 16 or
+ * 32MB windows and the CS offset for each region changes based on the
+ * current configuration. This means that we cannot simply hardcode
+ * each offset. ixp4xx_sys_init() looks at the expansion bus configuration
+ * as setup by the bootloader to determine our window size.
+ */
+extern unsigned long ixp4xx_exp_bus_size;
 
-#define IXP4XX_EXP_BUS_CS0_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x00000000)
-#define IXP4XX_EXP_BUS_CS1_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x01000000)
-#define IXP4XX_EXP_BUS_CS2_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x02000000)
-#define IXP4XX_EXP_BUS_CS3_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x03000000)
-#define IXP4XX_EXP_BUS_CS4_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x04000000)
-#define IXP4XX_EXP_BUS_CS5_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x05000000)
-#define IXP4XX_EXP_BUS_CS6_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x06000000)
-#define IXP4XX_EXP_BUS_CS7_BASE_PHYS   (IXP4XX_EXP_BUS_BASE_PHYS + 0x07000000)
+#define        IXP4XX_EXP_BUS_BASE(region)\
+               (IXP4XX_EXP_BUS_BASE_PHYS + ((region) * ixp4xx_exp_bus_size))
+
+#define IXP4XX_EXP_BUS_END(region)\
+               (IXP4XX_EXP_BUS_BASE(region) + ixp4xx_exp_bus_size - 1)
+
+/* Those macros can be used to adjust timing and configure
+ * other features for each region.
+ */
+
+#define IXP4XX_EXP_BUS_RECOVERY_T(x)   (((x) & 0x0f) << 16)
+#define IXP4XX_EXP_BUS_HOLD_T(x)       (((x) & 0x03) << 20)
+#define IXP4XX_EXP_BUS_STROBE_T(x)     (((x) & 0x0f) << 22)
+#define IXP4XX_EXP_BUS_SETUP_T(x)      (((x) & 0x03) << 26)
+#define IXP4XX_EXP_BUS_ADDR_T(x)       (((x) & 0x03) << 28)
+#define IXP4XX_EXP_BUS_SIZE(x)         (((x) & 0x0f) << 10)
+#define IXP4XX_EXP_BUS_CYCLES(x)       (((x) & 0x03) << 14)
+
+#define IXP4XX_EXP_BUS_CS_EN           (1L << 31)
+#define IXP4XX_EXP_BUS_BYTE_RD16       (1L << 6)
+#define IXP4XX_EXP_BUS_HRDY_POL                (1L << 5)
+#define IXP4XX_EXP_BUS_MUX_EN          (1L << 4)
+#define IXP4XX_EXP_BUS_SPLT_EN         (1L << 3)
+#define IXP4XX_EXP_BUS_WR_EN           (1L << 1)
+#define IXP4XX_EXP_BUS_BYTE_EN         (1L << 0)
+
+#define IXP4XX_EXP_BUS_CYCLES_INTEL    0x00
+#define IXP4XX_EXP_BUS_CYCLES_MOTOROLA 0x01
+#define IXP4XX_EXP_BUS_CYCLES_HPI      0x02
 
 #define IXP4XX_FLASH_WRITABLE  (0x2)
 #define IXP4XX_FLASH_DEFAULT   (0xbcd23c40)
@@ -83,17 +111,6 @@ extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
 #define IXP4XX_GPIO_OUT                0x1
 #define IXP4XX_GPIO_IN                 0x2
 
-#define IXP4XX_GPIO_INTSTYLE_MASK      0x7C  /* Bits [6:2] define interrupt style */
-
-/* 
- * GPIO interrupt types.
- */
-#define IXP4XX_GPIO_ACTIVE_HIGH                0x4 /* Default */
-#define IXP4XX_GPIO_ACTIVE_LOW         0x8
-#define IXP4XX_GPIO_RISING_EDGE                0x10
-#define IXP4XX_GPIO_FALLING_EDGE       0x20
-#define IXP4XX_GPIO_TRANSITIONAL       0x40
-
 /* GPIO signal types */
 #define IXP4XX_GPIO_LOW                        0
 #define IXP4XX_GPIO_HIGH               1
@@ -102,7 +119,13 @@ extern struct pci_bus *ixp4xx_scan_bus(int nr, struct pci_sys_data *sys);
 #define IXP4XX_GPIO_CLK_0              14
 #define IXP4XX_GPIO_CLK_1              15
 
-extern void gpio_line_config(u8 line, u32 style);
+static inline void gpio_line_config(u8 line, u32 direction)
+{
+       if (direction == IXP4XX_GPIO_IN)
+               *IXP4XX_GPIO_GPOER |= (1 << line);
+       else
+               *IXP4XX_GPIO_GPOER &= ~(1 << line);
+}
 
 static inline void gpio_line_get(u8 line, int *value)
 {
@@ -117,10 +140,5 @@ static inline void gpio_line_set(u8 line, int value)
            *IXP4XX_GPIO_GPOUTR &= ~(1 << line);
 }
 
-static inline void gpio_line_isr_clear(u8 line)
-{
-       *IXP4XX_GPIO_GPISR = (1 << line);
-}
-
 #endif // __ASSEMBLY__
 
index 960c358..09ae6c9 100644 (file)
 
 static volatile u32* uart_base;
 
-static __inline__ void putc(char c)
+static inline void putc(int c)
 {
        /* Check THRE and TEMT bits before we transmit the character.
         */
-       while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE); 
+       while ((uart_base[UART_LSR] & TX_DONE) != TX_DONE)
+               barrier();
+
        *uart_base = c;
 }
 
-/*
- * This does not append a newline
- */
-static void putstr(const char *s)
+static void flush(void)
 {
-       while (*s)
-       {
-               putc(*s);
-               if (*s == '\n')
-                       putc('\r');
-               s++;
-       }
 }
 
 static __inline__ void __arch_decomp_setup(unsigned long arch_id)
index 590bac2..6513065 100644 (file)
@@ -57,6 +57,7 @@
 #define LHV_MIN                                0x0000
 
 // Analog audio path control register
+#define STA_REG(x)                     ((x)<<6)
 #define STE_ENABLED                    0x0020
 #define DAC_SELECTED                   0x0010
 #define BYPASS_ON                      0x0008
 #define TLV320AIC23ID1                  (0x1a) // cs low
 #define TLV320AIC23ID2                  (0x1b) // cs high
 
+void tlv320aic23_power_up(void);
+void tlv320aic23_power_down(void);
+
 #endif /* __ASM_ARCH_AIC23_H */
index 60976f8..17eccd7 100644 (file)
@@ -6,8 +6,8 @@
 #include <sound/pcm.h>
 
 typedef struct {
-       int (*startup)(snd_pcm_substream_t *, void *);
-       void (*shutdown)(snd_pcm_substream_t *, void *);
+       int (*startup)(struct snd_pcm_substream *, void *);
+       void (*shutdown)(struct snd_pcm_substream *, void *);
        void (*suspend)(void *);
        void (*resume)(void *);
        void *priv;
index f288e74..9012cbc 100644 (file)
@@ -11,6 +11,8 @@
  *
 */
 
+#include "hardware.h"
+
                .macro  addruart,rx
                mrc     p15, 0, \rx, c1, c0
                tst     \rx, #1                 @ MMU enabled?
                orr     \rx, \rx, #0x00100000
                .endm
 
-               .macro  senduart,rd,rx
-               str     \rd, [\rx, #0]
-               .endm
-
-               .macro  busyuart,rd,rx
-1002:          ldr     \rd, [\rx, #0x14]
-               tst     \rd, #(1 << 6)
-               beq     1002b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldr     \rd, [\rx, #0x14]
-               tst     \rd, #(1 << 5)
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#include <asm/hardware/debug-8250.S>
index 27d71e9..aba9b30 100644 (file)
@@ -66,3 +66,5 @@ struct pxafb_mach_info {
 
 };
 void set_pxa_fb_info(struct pxafb_mach_info *hard_pxa_fb_info);
+void set_pxa_fb_parent(struct device *parent_dev);
+unsigned long pxafb_get_hsync_time(struct device *dev);
index 456d3d7..c634c8d 100644 (file)
                orr     \rx, \rx, #0x00000fe0
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx]
-               .endm
-
-               .macro  busyuart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x14]
-               and     \rd, \rd, #0x60
-               teq     \rd, #0x60
-               bne     1001b
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldrb    \rd, [\rx, #0x18]
-               tst     \rd, #0x10
-               beq     1001b
-               .endm
+#define UART_SHIFT     2
+#define FLOW_CONTROL
+#include <asm/hardware/debug-8250.S>
index 755fa34..267c317 100644 (file)
@@ -10,6 +10,7 @@
  * published by the Free Software Foundation.
  *
 */
+#include <asm/hardware.h>
 
                .macro  addruart,rx
                mrc     p15, 0, \rx, c1, c0
index 89e38ac..fe106d1 100644 (file)
@@ -11,8 +11,6 @@
  *
 */
 
-#include <asm/hardware/amba_serial.h>
-
                .macro  addruart,rx
                mrc     p15, 0, \rx, c1, c0
                tst     \rx, #1                 @ MMU enabled?
                orr     \rx, \rx, #0x00001000
                .endm
 
-               .macro  senduart,rd,rx
-               strb    \rd, [\rx, #UART01x_DR]
-               .endm
-
-               .macro  waituart,rd,rx
-1001:          ldr     \rd, [\rx, #0x18]       @ UARTFLG
-               tst     \rd, #1 << 5            @ UARTFLGUTXFF - 1 when full
-               bne     1001b
-               .endm
-
-               .macro  busyuart,rd,rx
-1001:          ldr     \rd, [\rx, #0x18]       @ UARTFLG
-               tst     \rd, #1 << 3            @ UARTFLGUBUSY - 1 when busy
-               bne     1001b
-               .endm
+#include <asm/hardware/debug-pl01x.S>
index 15bd6e7..27fe028 100644 (file)
 
        @ read all the working registers back into the VFP
        .macro  VFPFLDMIA, base
+#if __LINUX_ARM_ARCH__ < 6
        LDC     p11, cr0, [\base],#33*4             @ FLDMIAX \base!, {d0-d15}
+#else
+       LDC     p11, cr0, [\base],#32*4             @ FLDMIAD \base!, {d0-d15}
+#endif
        .endm
 
        @ write all the working registers out of the VFP
        .macro  VFPFSTMIA, base
+#if __LINUX_ARM_ARCH__ < 6
        STC     p11, cr0, [\base],#33*4             @ FSTMIAX \base!, {d0-d15}
+#else
+       STC     p11, cr0, [\base],#32*4             @ FSTMIAD \base!, {d0-d15}
+#endif
        .endm
index 3007dec..eaa5826 100644 (file)
@@ -87,5 +87,17 @@ static inline void flush_icache_page(struct vm_area_struct *vma, struct page *pa
        flush_icache_user_range(vma, page, page_to_phys(page), PAGE_SIZE);
 }
 
+/*
+ * permit ptrace to access another process's address space through the icache
+ * and the dcache
+ */
+#define copy_to_user_page(vma, page, vaddr, dst, src, len)     \
+do {                                                           \
+       memcpy((dst), (src), (len));                            \
+       flush_icache_user_range((vma), (page), (vaddr), (len)); \
+} while(0)
+
+#define copy_from_user_page(vma, page, vaddr, dst, src, len)   \
+       memcpy((dst), (src), (len))
 
 #endif /* _ASM_CACHEFLUSH_H */
index 0206ab3..e9fc1d4 100644 (file)
@@ -13,7 +13,7 @@
 extern unsigned long __nongprelbss dma_coherent_mem_start;
 extern unsigned long __nongprelbss dma_coherent_mem_end;
 
-void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, int gfp);
+void *dma_alloc_coherent(struct device *dev, size_t size, dma_addr_t *dma_handle, gfp_t gfp);
 void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t dma_handle);
 
 /*
@@ -23,7 +23,7 @@ void dma_free_coherent(struct device *dev, size_t size, void *vaddr, dma_addr_t
  * returns, or alternatively stop on the first sg_dma_len(sg) which
  * is 0.
  */
-#define sg_dma_address(sg)     ((unsigned long) (page_to_phys((sg)->page) + (sg)->offset))
+#define sg_dma_address(sg)     ((sg)->dma_address)
 #define sg_dma_len(sg)         ((sg)->length)
 
 /*
index 8cbcd60..c8fe880 100644 (file)
@@ -12,6 +12,7 @@
 #define POLLRDBAND     128
 #define POLLWRBAND     256
 #define POLLMSG                0x0400
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index c20ec25..68c6fea 100644 (file)
 
 #define pud_t                          pgd_t
 
-#define pmd_alloc(mm, pud, address)                    \
-({     pmd_t *ret;                                     \
-       if (pgd_none(*pud))                             \
-               ret = __pmd_alloc(mm, pud, address);    \
-       else                                            \
-               ret = pmd_offset(pud, address);         \
-       ret;                                            \
-})
+#define pmd_alloc(mm, pud, address) \
+       ((unlikely(pgd_none(*(pud))) && __pmd_alloc(mm, pud, address))? \
+               NULL: pmd_offset(pud, address))
 
 #define pud_alloc(mm, pgd, address)    (pgd)
 #define pud_offset(pgd, start)         (pgd)
index b6ae4f3..dfcc006 100644 (file)
@@ -37,12 +37,12 @@ map_virtual(u64 offset, struct page **pp)
        unsigned long pfn;
        void *vaddr;
 
-        pfn = (unsigned long)(offset >> PAGE_SHIFT);
+       pfn = (unsigned long)(offset >> PAGE_SHIFT);
 
-        if (!page_is_ram(pfn)) {
+       if (!page_is_ram(pfn)) {
                printk(KERN_INFO
                    "crash memory driver: !page_is_ram(pfn: %lx)\n", pfn);
-                return NULL;
+               return NULL;
        }
 
        if (!pfn_valid(pfn)) {
index 30d1aa1..65a04dd 100644 (file)
@@ -167,7 +167,7 @@ static inline void set_user_cs(struct desc_struct *desc, unsigned long limit)
 }
 
 #define load_user_cs_desc(cpu, mm) \
-       HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_DEFAULT_USER_CS]), (u64)(mm)->context.user_cs.a | ((u64)(mm)->context.user_cs.b) << 32);
+        HYPERVISOR_update_descriptor(virt_to_machine(&get_cpu_gdt_table(cpu)[GDT_ENTRY_DEFAULT_USER_CS]), (u64)(mm)->context.user_cs.a | ((u64)(mm)->context.user_cs.b) << 32);
 
 extern void arch_add_exec_range(struct mm_struct *mm, unsigned long limit);
 extern void arch_remove_exec_range(struct mm_struct *mm, unsigned long limit);
index 17ef0c2..580b144 100644 (file)
@@ -6,7 +6,6 @@
  * documentation.
  */
 
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <asm/cache.h>
 #include <asm/io.h>
index 82a0122..d368de3 100644 (file)
@@ -13,7 +13,6 @@
 #ifndef _ASM_FIXMAP_H
 #define _ASM_FIXMAP_H
 
-#include <linux/config.h>
 
 /* used by vmalloc.c, vsyscall.lds.S.
  *
@@ -53,7 +52,7 @@ extern unsigned long __FIXADDR_TOP;
  */
 enum fixed_addresses {
        FIX_HOLE,
-       FIX_VSYSCALL,
+       FIX_VDSO,
 #ifdef CONFIG_X86_LOCAL_APIC
        FIX_APIC_BASE,  /* local (CPU) APIC) -- required for SMP or not */
 #endif
@@ -123,14 +122,6 @@ extern void set_fixaddr_top(unsigned long top);
 #define __fix_to_virt(x)       (FIXADDR_TOP - ((x) << PAGE_SHIFT))
 #define __virt_to_fix(x)       ((FIXADDR_TOP - ((x)&PAGE_MASK)) >> PAGE_SHIFT)
 
-/*
- * This is the range that is readable by user mode, and things
- * acting like user mode such as get_user_pages.
- */
-#define FIXADDR_USER_START     (__fix_to_virt(FIX_VSYSCALL))
-#define FIXADDR_USER_END       (FIXADDR_USER_START + PAGE_SIZE)
-
-
 extern void __this_fixmap_does_not_exist(void);
 
 /*
index 2d5dd22..1396559 100644 (file)
@@ -88,8 +88,8 @@ static void fd_disable_dma(void)
 
 static int fd_request_irq(void)
 {
-       return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
-                                          "floppy", NULL);
+       return request_irq(FLOPPY_IRQ, floppy_hardint,
+                          IRQF_DISABLED, "floppy", NULL);
 }
 
 static int vdma_dma_setup(char *addr, unsigned long size, int mode, int io)
index e13b5a4..d379186 100644 (file)
@@ -20,7 +20,6 @@
 
 #ifdef __KERNEL__
 
-#include <linux/config.h>
 #include <linux/interrupt.h>
 #include <linux/threads.h>
 #include <asm/kmap_types.h>
index eecc6b6..87e5a35 100644 (file)
@@ -12,7 +12,6 @@
  *     <tomsoft@informatik.tu-chemnitz.de>
  */
 
-#include <linux/config.h>
 #include <linux/profile.h>
 #include <asm/atomic.h>
 #include <asm/irq.h>
@@ -20,6 +19,8 @@
 
 struct hw_interrupt_type;
 
+#define NMI_VECTOR             0x02
+
 /*
  * Various low-level irq details needed by irq.c, process.c,
  * time.c, io_apic.c and smp.c
@@ -68,10 +69,4 @@ extern atomic_t irq_mis_count;
 
 #define IO_APIC_IRQ(x) (((x) >= 16) || ((1<<(x)) & io_apic_irqs))
 
-extern void resend_irq_on_evtchn(struct hw_interrupt_type *h, unsigned int i);
-static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
-{
-       resend_irq_on_evtchn(h, i);
-}
-
 #endif /* _ASM_HW_IRQ_H */
index 7de1013..2e6d1fa 100644 (file)
 #define __STR(x) #x
 #define STR(x) __STR(x)
 
+#ifdef CONFIG_XEN
+#define HYPERCALL_STR(name)                                    \
+       "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
+#else
+#define HYPERCALL_STR(name)                                    \
+       "mov hypercall_stubs,%%eax; "                           \
+       "add $("STR(__HYPERVISOR_##name)" * 32),%%eax; "        \
+       "call *%%eax"
+#endif
+
 #define _hypercall0(type, name)                        \
 ({                                             \
        long __res;                             \
        asm volatile (                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)             \
                : "=a" (__res)                  \
                :                               \
                : "memory" );                   \
@@ -57,7 +67,7 @@
 ({                                                             \
        long __res, __ign1;                                     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1)                   \
                : "1" ((long)(a1))                              \
                : "memory" );                                   \
@@ -68,7 +78,7 @@
 ({                                                             \
        long __res, __ign1, __ign2;                             \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2)    \
                : "1" ((long)(a1)), "2" ((long)(a2))            \
                : "memory" );                                   \
@@ -79,7 +89,7 @@
 ({                                                             \
        long __res, __ign1, __ign2, __ign3;                     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
                "=d" (__ign3)                                   \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
 ({                                                             \
        long __res, __ign1, __ign2, __ign3, __ign4;             \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
                "=d" (__ign3), "=S" (__ign4)                    \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
 ({                                                             \
        long __res, __ign1, __ign2, __ign3, __ign4, __ign5;     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=b" (__ign1), "=c" (__ign2),   \
                "=d" (__ign3), "=S" (__ign4), "=D" (__ign5)     \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
@@ -354,6 +364,13 @@ HYPERVISOR_nmi_op(
        return _hypercall2(int, nmi_op, op, arg);
 }
 
+static inline unsigned long
+HYPERVISOR_hvm_op(
+    int op, void *arg)
+{
+    return _hypercall2(unsigned long, hvm_op, op, arg);
+}
+
 static inline int
 HYPERVISOR_callback_op(
        int cmd, void *arg)
index 3837855..2e22141 100644 (file)
@@ -33,7 +33,6 @@
 #ifndef __HYPERVISOR_H__
 #define __HYPERVISOR_H__
 
-#include <linux/config.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #include <linux/version.h>
@@ -58,6 +57,11 @@ extern shared_info_t *HYPERVISOR_shared_info;
 
 /* arch/xen/i386/kernel/setup.c */
 extern start_info_t *xen_start_info;
+#ifdef CONFIG_XEN_PRIVILEGED_GUEST
+#define is_initial_xendomain() (xen_start_info->flags & SIF_INITDOMAIN)
+#else
+#define is_initial_xendomain() 0
+#endif
 
 /* arch/xen/kernel/evtchn.c */
 /* Force a proper event-channel callback from Xen. */
@@ -197,6 +201,16 @@ MULTI_update_va_mapping(
     mcl->args[MULTI_UVMFLAGS_INDEX] = flags;
 }
 
+static inline void
+MULTI_grant_table_op(multicall_entry_t *mcl, unsigned int cmd,
+                    void *uop, unsigned int count)
+{
+    mcl->op = __HYPERVISOR_grant_table_op;
+    mcl->args[0] = cmd;
+    mcl->args[1] = (unsigned long)uop;
+    mcl->args[2] = count;
+}
+
 static inline void
 MULTI_update_va_mapping_otherdomain(
     multicall_entry_t *mcl, unsigned long va,
index 7c3fafd..a27f56b 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _ASM_IO_H
 #define _ASM_IO_H
 
-#include <linux/config.h>
 #include <linux/string.h>
 #include <linux/compiler.h>
 
index 7a660e8..1783b70 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _ASM_KMAP_TYPES_H
 #define _ASM_KMAP_TYPES_H
 
-#include <linux/config.h>
 
 #ifdef CONFIG_DEBUG_HIGHMEM
 # define D(n) __KM_FENCE_##n ,
index 05e69ad..d91892d 100644 (file)
@@ -7,7 +7,6 @@
  * we put the segment information here.
  *
  * cpu_vm_mask is used to optimize ldt flushing.
- +
  * exec_limit is used to track the range PROT_EXEC
  * mappings span.
  */
@@ -15,9 +14,9 @@ typedef struct {
        int size;
        struct semaphore sem;
        void *ldt;
-       struct desc_struct user_cs;
-       unsigned long exec_limit;
-       void *vdso;
+       struct desc_struct user_cs;
+       unsigned long exec_limit;
+       void *vdso;
 #ifdef CONFIG_XEN
        int has_foreign_mappings;
 #endif
index 317d597..d3b50f7 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __I386_SCHED_H
 #define __I386_SCHED_H
 
-#include <linux/config.h>
 #include <asm/desc.h>
 #include <asm/atomic.h>
 #include <asm/pgalloc.h>
index 4f16618..5b09592 100644 (file)
@@ -12,7 +12,6 @@
 #ifdef __KERNEL__
 #ifndef __ASSEMBLY__
 
-#include <linux/config.h>
 #include <linux/string.h>
 #include <linux/types.h>
 #include <linux/kernel.h>
 #define clear_user_page(page, vaddr, pg)       clear_page(page)
 #define copy_user_page(to, from, vaddr, pg)    copy_page(to, from)
 
-/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
-#define INVALID_P2M_ENTRY      (~0UL)
-#define FOREIGN_FRAME_BIT      (1UL<<31)
-#define FOREIGN_FRAME(m)       ((m) | FOREIGN_FRAME_BIT)
-
-extern unsigned long *phys_to_machine_mapping;
-
-#undef machine_to_phys_mapping
-extern unsigned long *machine_to_phys_mapping;
-extern unsigned int   machine_to_phys_order;
-
-static inline unsigned long pfn_to_mfn(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return pfn;
-       return phys_to_machine_mapping[(unsigned int)(pfn)] &
-               ~FOREIGN_FRAME_BIT;
-}
-
-static inline int phys_to_machine_mapping_valid(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return 1;
-       return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
-}
-
-static inline unsigned long mfn_to_pfn(unsigned long mfn)
-{
-       extern unsigned long max_mapnr;
-       unsigned long pfn;
-
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return mfn;
-
-       if (unlikely((mfn >> machine_to_phys_order) != 0))
-               return max_mapnr;
-
-       /* The array access can fail (e.g., device space beyond end of RAM). */
-       asm (
-               "1:     movl %1,%0\n"
-               "2:\n"
-               ".section .fixup,\"ax\"\n"
-               "3:     movl %2,%0\n"
-               "       jmp  2b\n"
-               ".previous\n"
-               ".section __ex_table,\"a\"\n"
-               "       .align 4\n"
-               "       .long 1b,3b\n"
-               ".previous"
-               : "=r" (pfn)
-               : "m" (machine_to_phys_mapping[mfn]), "m" (max_mapnr) );
-
-       return pfn;
-}
-
-/*
- * We detect special mappings in one of two ways:
- *  1. If the MFN is an I/O page then Xen will set the m2p entry
- *     to be outside our maximum possible pseudophys range.
- *  2. If the MFN belongs to a different domain then we will certainly
- *     not have MFN in our p2m table. Conversely, if the page is ours,
- *     then we'll have p2m(m2p(MFN))==MFN.
- * If we detect a special mapping then it doesn't have a 'struct page'.
- * We force !pfn_valid() by returning an out-of-range pointer.
- *
- * NB. These checks require that, for any MFN that is not in our reservation,
- * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
- * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
- * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
- *
- * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
- *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
- *      require. In all the cases we care about, the FOREIGN_FRAME bit is
- *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
- */
-static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
-{
-       extern unsigned long max_mapnr;
-       unsigned long pfn = mfn_to_pfn(mfn);
-       if ((pfn < max_mapnr)
-           && !xen_feature(XENFEAT_auto_translated_physmap)
-           && (phys_to_machine_mapping[pfn] != mfn))
-               return max_mapnr; /* force !pfn_valid() */
-       return pfn;
-}
-
-static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap)) {
-               BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
-               return;
-       }
-       phys_to_machine_mapping[pfn] = mfn;
-}
-
-/* Definitions for machine and pseudophysical addresses. */
-#ifdef CONFIG_X86_PAE
-typedef unsigned long long paddr_t;
-typedef unsigned long long maddr_t;
-#else
-typedef unsigned long paddr_t;
-typedef unsigned long maddr_t;
-#endif
-
-static inline maddr_t phys_to_machine(paddr_t phys)
-{
-       maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT);
-       machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK);
-       return machine;
-}
-static inline paddr_t machine_to_phys(maddr_t machine)
-{
-       paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT);
-       phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
-       return phys;
-}
-
 /*
  * These are used to make use of C type-checking..
  */
@@ -187,6 +69,8 @@ typedef struct { unsigned long pte_low, pte_high; } pte_t;
 typedef struct { unsigned long long pmd; } pmd_t;
 typedef struct { unsigned long long pgd; } pgd_t;
 typedef struct { unsigned long long pgprot; } pgprot_t;
+#define pgprot_val(x)  ((x).pgprot)
+#include <asm/maddr.h>
 #define __pte(x) ({ unsigned long long _x = (x);        \
     if (_x & 1) _x = phys_to_machine(_x);               \
     ((pte_t) {(unsigned long)(_x), (unsigned long)(_x>>32)}); })
@@ -227,6 +111,8 @@ static inline unsigned long long pte_val_ma(pte_t x)
 typedef struct { unsigned long pte_low; } pte_t;
 typedef struct { unsigned long pgd; } pgd_t;
 typedef struct { unsigned long pgprot; } pgprot_t;
+#define pgprot_val(x)  ((x).pgprot)
+#include <asm/maddr.h>
 #define boot_pte_t pte_t /* or would you rather have a typedef */
 #define pte_val(x)     (((x).pte_low & 1) ? machine_to_phys((x).pte_low) : \
                         (x).pte_low)
@@ -252,9 +138,6 @@ static inline unsigned long pgd_val(pgd_t x)
 #define HAVE_ARCH_HUGETLB_UNMAPPED_AREA
 #endif
 
-#define pgprot_val(x)  ((x).pgprot)
-
-#define __pte_ma(x)    ((pte_t) { (x) } )
 #define __pgprot(x)    ((pgprot_t) { (x) } )
 
 #endif /* !__ASSEMBLY__ */
@@ -277,6 +160,8 @@ static inline unsigned long pgd_val(pgd_t x)
 
 #ifndef __ASSEMBLY__
 
+struct vm_area_struct;
+
 /*
  * This much address space is reserved for vmalloc() and iomap()
  * as well as fixmap mappings.
@@ -286,6 +171,7 @@ extern unsigned int __VMALLOC_RESERVE;
 extern int sysctl_legacy_va_layout;
 
 extern int devmem_is_allowed(unsigned long pagenr);
+
 extern int page_is_ram(unsigned long pagenr);
 
 #endif /* __ASSEMBLY__ */
@@ -327,9 +213,10 @@ extern int page_is_ram(unsigned long pagenr);
 #define virt_to_mfn(v)         (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
 #define mfn_to_virt(m)         (__va(mfn_to_pfn(m) << PAGE_SHIFT))
 
-#endif /* __KERNEL__ */
-
 #include <asm-generic/memory_model.h>
 #include <asm-generic/page.h>
 
+#define __HAVE_ARCH_GATE_AREA 1
+#endif /* __KERNEL__ */
+
 #endif /* _I386_PAGE_H */
index 095580f..745dc5b 100644 (file)
@@ -2,7 +2,6 @@
 #define _ASMi386_PARAM_H
 
 #ifdef __KERNEL__
-# include <linux/config.h>
 # define HZ            CONFIG_HZ       /* Internal kernel timer frequency */
 # define USER_HZ       100             /* .. some user interfaces are in "ticks" */
 # define CLOCKS_PER_SEC                (USER_HZ)       /* like times() */
index 1ec4470..584f65e 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __i386_PCI_H
 #define __i386_PCI_H
 
-#include <linux/config.h>
 
 #ifdef __KERNEL__
 #include <linux/mm.h>          /* for struct page */
index 726396a..ff78aca 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _I386_PGALLOC_H
 #define _I386_PGALLOC_H
 
-#include <linux/config.h>
 #include <asm/fixmap.h>
 #include <asm/desc.h>
 #include <linux/threads.h>
index 0d74a5a..34cb67f 100644 (file)
@@ -45,7 +45,6 @@
 
 #define pte_none(x)            (!(x).pte_low)
 #define pfn_pte(pfn, prot)     __pte(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
-#define pfn_pte_ma(pfn, prot)  __pte_ma(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
 #define pfn_pmd(pfn, prot)     __pmd(((pfn) << PAGE_SHIFT) | pgprot_val(prot))
 
 /*
index f41b15b..7c3c36b 100644 (file)
@@ -119,7 +119,7 @@ static inline void pte_clear(struct mm_struct *mm, unsigned long addr, pte_t *pt
        ptep->pte_high = 0;
 }
 
-#define pmd_clear(xp)do { set_pmd(xp, __pmd(0)); } while (0)
+#define pmd_clear(xp)  do { set_pmd(xp, __pmd(0)); } while (0)
 
 static inline pte_t ptep_get_and_clear(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
 {
@@ -151,18 +151,6 @@ static inline int pte_none(pte_t pte)
 
 extern unsigned long long __supported_pte_mask;
 
-static inline pte_t pfn_pte_ma(unsigned long page_nr, pgprot_t pgprot)
-{
-       pte_t pte;
-
-       pte.pte_high = (page_nr >> (32 - PAGE_SHIFT)) | \
-                                       (pgprot_val(pgprot) >> 32);
-       pte.pte_high &= (__supported_pte_mask >> 32);
-       pte.pte_low = ((page_nr << PAGE_SHIFT) | pgprot_val(pgprot)) & \
-                                                       __supported_pte_mask;
-       return pte;
-}
-
 static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
 {
        return pfn_pte_ma(pfn_to_mfn(page_nr), pgprot);
index b4a967e..388a5ba 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _I386_PGTABLE_H
 #define _I386_PGTABLE_H
 
-#include <linux/config.h>
 #include <asm/hypervisor.h>
 
 /*
index 99a8d73..d8a4b7b 100644 (file)
@@ -17,7 +17,6 @@
 #include <asm/msr.h>
 #include <asm/system.h>
 #include <linux/cache.h>
-#include <linux/config.h>
 #include <linux/threads.h>
 #include <asm/percpu.h>
 #include <linux/cpumask.h>
@@ -73,8 +72,12 @@ struct cpuinfo_x86 {
        cpumask_t llc_shared_map;       /* cpus sharing the last level cache */
 #endif
        unsigned char x86_max_cores;    /* cpuid returned max cores value */
-       unsigned char booted_cores;     /* number of cores as seen by OS */
        unsigned char apicid;
+#ifdef CONFIG_SMP
+       unsigned char booted_cores;     /* number of cores as seen by OS */
+       __u8 phys_proc_id;              /* Physical processor id. */
+       __u8 cpu_core_id;               /* Core id */
+#endif
 } __attribute__((__aligned__(SMP_CACHE_BYTES)));
 
 #define X86_VENDOR_INTEL 0
@@ -108,14 +111,13 @@ extern struct cpuinfo_x86 cpu_data[];
 #define current_cpu_data boot_cpu_data
 #endif
 
-extern int phys_proc_id[NR_CPUS];
-extern int cpu_core_id[NR_CPUS];
 extern int cpu_llc_id[NR_CPUS];
 extern char ignore_fpu_irq;
 
 extern void identify_cpu(struct cpuinfo_x86 *);
 extern void print_cpu_info(struct cpuinfo_x86 *);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
+extern unsigned short num_cache_leaves;
 
 #ifdef CONFIG_X86_HT
 extern void detect_ht(struct cpuinfo_x86 *c);
@@ -334,6 +336,7 @@ extern int bootloader_type;
 #define TASK_UNMAPPED_BASE     PAGE_ALIGN(TASK_SIZE/3)
 
 #define __HAVE_ARCH_ALIGN_STACK
+extern unsigned long arch_align_stack(unsigned long sp);
 
 #define HAVE_ARCH_PICK_MMAP_LAYOUT
 
@@ -567,7 +570,7 @@ extern void prepare_to_copy(struct task_struct *tsk);
 extern int kernel_thread(int (*fn)(void *), void * arg, unsigned long flags);
 
 extern unsigned long thread_saved_pc(struct task_struct *tsk);
-void show_trace(struct task_struct *task, unsigned long *stack);
+void show_trace(struct task_struct *task, struct pt_regs *regs, unsigned long *stack);
 
 unsigned long get_wchan(struct task_struct *p);
 
@@ -741,18 +744,4 @@ extern unsigned long boot_option_idle_override;
 extern void enable_sep_cpu(void);
 extern int sysenter_setup(void);
 
-#ifdef CONFIG_MTRR
-extern void mtrr_ap_init(void);
-extern void mtrr_bp_init(void);
-#else
-#define mtrr_ap_init() do {} while (0)
-#define mtrr_bp_init() do {} while (0)
-#endif
-
-#ifdef CONFIG_X86_MCE
-extern void mcheck_init(struct cpuinfo_x86 *c);
-#else
-#define mcheck_init(c) do {} while(0)
-#endif
-
 #endif /* __ASM_I386_PROCESSOR_H */
index de9577a..c729454 100644 (file)
@@ -6,6 +6,7 @@
 #ifndef _i386_SETUP_H
 #define _i386_SETUP_H
 
+#ifdef __KERNEL__
 #include <linux/pfn.h>
 
 /*
@@ -13,6 +14,7 @@
  */
 #define MAXMEM_PFN     PFN_DOWN(MAXMEM)
 #define MAX_NONPAE_PFN (1 << 20)
+#endif
 
 #define PARAM_SIZE 4096
 #define COMMAND_LINE_SIZE 256
@@ -59,6 +61,21 @@ extern unsigned char boot_params[PARAM_SIZE];
 #define EDD_MBR_SIGNATURE ((unsigned int *) (PARAM+EDD_MBR_SIG_BUF))
 #define EDD_BUF     ((struct edd_info *) (PARAM+EDDBUF))
 
+/*
+ * Do NOT EVER look at the BIOS memory size location.
+ * It does not work on many machines.
+ */
+#define LOWMEMSIZE()   (0x9f000)
+
+struct e820entry;
+
+char * __init machine_specific_memory_setup(void);
+
+int __init copy_e820_map(struct e820entry * biosmap, int nr_map);
+int __init sanitize_e820_map(struct e820entry * biosmap, char * pnr_map);
+void __init add_memory_region(unsigned long long start,
+                             unsigned long long size, int type);
+
 #endif /* __ASSEMBLY__ */
 
 #endif /* _i386_SETUP_H */
index 4d32919..9b59e50 100644 (file)
@@ -5,7 +5,6 @@
  * We need the APIC definitions automatically as part of 'smp.h'
  */
 #ifndef __ASSEMBLY__
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/threads.h>
 #include <linux/cpumask.h>
index 20742a6..d05f078 100644 (file)
@@ -4,7 +4,6 @@
 #include <asm/atomic.h>
 #include <asm/rwlock.h>
 #include <asm/page.h>
-#include <linux/config.h>
 #include <linux/compiler.h>
 
 /*
@@ -23,7 +22,7 @@
 
 #define __raw_spin_lock_string \
        "\n1:\t" \
-       "lock ; decb %0\n\t" \
+       LOCK_PREFIX " ; decb %0\n\t" \
        "jns 3f\n" \
        "2:\t" \
        "rep;nop\n\t" \
        "jmp 1b\n" \
        "3:\n\t"
 
+/*
+ * NOTE: there's an irqs-on section here, which normally would have to be
+ * irq-traced, but on CONFIG_TRACE_IRQFLAGS we never use
+ * __raw_spin_lock_string_flags().
+ */
 #define __raw_spin_lock_string_flags \
        "\n1:\t" \
-       "lock ; decb %0\n\t" \
+       LOCK_PREFIX " ; decb %0\n\t" \
        "jns 5f\n" \
        "2:\t" \
        "testl $0x200, %1\n\t" \
        "jmp 4b\n" \
        "5:\n\t"
 
-#define __raw_spin_lock_string_up \
-       "\n\tdecb %0"
-
 static inline void __raw_spin_lock(raw_spinlock_t *lock)
 {
-       alternative_smp(
-               __raw_spin_lock_string,
-               __raw_spin_lock_string_up,
-               "=m" (lock->slock) : : "memory");
+       asm(__raw_spin_lock_string : "+m" (lock->slock) : : "memory");
 }
 
+/*
+ * It is easier for the lock validator if interrupts are not re-enabled
+ * in the middle of a lock-acquire. This is a performance feature anyway
+ * so we turn it off:
+ */
+#ifndef CONFIG_PROVE_LOCKING
 static inline void __raw_spin_lock_flags(raw_spinlock_t *lock, unsigned long flags)
 {
-       alternative_smp(
-               __raw_spin_lock_string_flags,
-               __raw_spin_lock_string_up,
-               "=m" (lock->slock) : "r" (flags) : "memory");
+       asm(__raw_spin_lock_string_flags : "+m" (lock->slock) : "r" (flags) : "memory");
 }
+#endif
 
 static inline int __raw_spin_trylock(raw_spinlock_t *lock)
 {
        char oldval;
        __asm__ __volatile__(
                "xchgb %b0,%1"
-               :"=q" (oldval), "=m" (lock->slock)
+               :"=q" (oldval), "+m" (lock->slock)
                :"0" (0) : "memory");
        return oldval > 0;
 }
@@ -93,7 +95,7 @@ static inline int __raw_spin_trylock(raw_spinlock_t *lock)
 
 #define __raw_spin_unlock_string \
        "movb $1,%0" \
-               :"=m" (lock->slock) : : "memory"
+               :"+m" (lock->slock) : : "memory"
 
 
 static inline void __raw_spin_unlock(raw_spinlock_t *lock)
@@ -107,7 +109,7 @@ static inline void __raw_spin_unlock(raw_spinlock_t *lock)
 
 #define __raw_spin_unlock_string \
        "xchgb %b0, %1" \
-               :"=q" (oldval), "=m" (lock->slock) \
+               :"=q" (oldval), "+m" (lock->slock) \
                :"0" (oldval) : "memory"
 
 static inline void __raw_spin_unlock(raw_spinlock_t *lock)
@@ -188,13 +190,13 @@ static inline int __raw_write_trylock(raw_rwlock_t *lock)
 
 static inline void __raw_read_unlock(raw_rwlock_t *rw)
 {
-       asm volatile(LOCK_PREFIX "incl %0" :"=m" (rw->lock) : : "memory");
+       asm volatile(LOCK_PREFIX "incl %0" :"+m" (rw->lock) : : "memory");
 }
 
 static inline void __raw_write_unlock(raw_rwlock_t *rw)
 {
        asm volatile(LOCK_PREFIX "addl $" RW_LOCK_BIAS_STR ", %0"
-                                : "=m" (rw->lock) : : "memory");
+                                : "+m" (rw->lock) : : "memory");
 }
 
 #endif /* __ASM_SPINLOCK_H */
index 9a36815..c9afcbb 100644 (file)
@@ -1,9 +1,6 @@
 #ifndef _ASM_SWIOTLB_H
 #define _ASM_SWIOTLB_H 1
 
-#include <linux/config.h>
-#include <asm/scatterlist.h>
-
 /* SWIOTLB interface */
 
 extern dma_addr_t swiotlb_map_single(struct device *hwdev, void *ptr, size_t size,
index 6a4e5e4..036eb12 100644 (file)
@@ -7,8 +7,6 @@
  * when communicating with Xen or other guest OSes running on other CPUs.
  */
 
-#include <linux/config.h>
-
 #define ADDR (*(volatile long *) addr)
 
 static __inline__ void synch_set_bit(int nr, volatile void * addr)
index 812e7bc..b126e23 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __ASM_SYSTEM_H
 #define __ASM_SYSTEM_H
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <asm/segment.h>
 #include <asm/cpufeature.h>
 struct task_struct;    /* one of the stranger aspects of C forward declarations.. */
 extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struct task_struct *next));
 
+/*
+ * Saving eflags is important. It switches not only IOPL between tasks,
+ * it also protects other tasks from NT leaking through sysenter etc.
+ */
 #define switch_to(prev,next,last) do {                                 \
        unsigned long esi,edi;                                          \
-       asm volatile("pushl %%ebp\n\t"                                  \
+       asm volatile("pushfl\n\t"               /* Save flags */        \
+                    "pushl %%ebp\n\t"                                  \
                     "movl %%esp,%0\n\t"        /* save ESP */          \
                     "movl %5,%%esp\n\t"        /* restore ESP */       \
                     "movl $1f,%1\n\t"          /* save EIP */          \
@@ -30,6 +34,7 @@ extern struct task_struct * FASTCALL(__switch_to(struct task_struct *prev, struc
                     "jmp __switch_to\n"                                \
                     "1:\t"                                             \
                     "popl %%ebp\n\t"                                   \
+                    "popfl"                                            \
                     :"=m" (prev->thread.esp),"=m" (prev->thread.eip),  \
                      "=a" (last),"=S" (esi),"=D" (edi)                 \
                     :"m" (next->thread.esp),"m" (next->thread.eip),    \
@@ -91,10 +96,6 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
 #define savesegment(seg, value) \
        asm volatile("mov %%" #seg ",%0":"=rm" (value))
 
-/*
- * Clear and set 'TS' bit respectively
- */
-#define clts() (HYPERVISOR_fpu_taskswitch(0))
 #define read_cr0() ({ \
        unsigned int __dummy; \
        __asm__ __volatile__( \
@@ -103,12 +104,12 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
        __dummy; \
 })
 #define write_cr0(x) \
-       __asm__ __volatile__("movl %0,%%cr0": :"r" (x));
+       __asm__ __volatile__("movl %0,%%cr0": :"r" (x))
 
 #define read_cr2() \
        (HYPERVISOR_shared_info->vcpu_info[smp_processor_id()].arch.cr2)
 #define write_cr2(x) \
-       __asm__ __volatile__("movl %0,%%cr2": :"r" (x));
+       __asm__ __volatile__("movl %0,%%cr2": :"r" (x))
 
 #define read_cr3() ({ \
        unsigned int __dummy; \
@@ -131,7 +132,6 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
                :"=r" (__dummy)); \
        __dummy; \
 })
-
 #define read_cr4_safe() ({                           \
        unsigned int __dummy;                         \
        /* This could fault if %cr4 does not exist */ \
@@ -145,13 +145,17 @@ __asm__ __volatile__ ("movw %%dx,%1\n\t" \
 })
 
 #define write_cr4(x) \
-       __asm__ __volatile__("movl %0,%%cr4": :"r" (x));
+       __asm__ __volatile__("movl %0,%%cr4": :"r" (x))
+/*
+ * Clear and set 'TS' bit respectively
+ */
+#define clts() (HYPERVISOR_fpu_taskswitch(0))
 #define stts() (HYPERVISOR_fpu_taskswitch(1))
 
 #endif /* __KERNEL__ */
 
 #define wbinvd() \
-       __asm__ __volatile__ ("wbinvd": : :"memory");
+       __asm__ __volatile__ ("wbinvd": : :"memory")
 
 static inline unsigned long get_limit(unsigned long segment)
 {
@@ -435,7 +439,7 @@ static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long l
  * does not enforce ordering, since there is no data dependency between
  * the read of "a" and the read of "b".  Therefore, on some CPUs, such
  * as Alpha, "y" could be set to 3 and "x" to 0.  Use rmb()
- * in cases like thiswhere there are no data dependencies.
+ * in cases like this where there are no data dependencies.
  **/
 
 #define read_barrier_depends() do { } while(0)
@@ -462,94 +466,7 @@ static inline unsigned long long __cmpxchg64(volatile void *ptr, unsigned long l
 #define set_mb(var, value) do { var = value; barrier(); } while (0)
 #endif
 
-#define set_wmb(var, value) do { var = value; wmb(); } while (0)
-
-/* interrupt control.. */
-
-/* 
- * The use of 'barrier' in the following reflects their use as local-lock
- * operations. Reentrancy must be prevented (e.g., __cli()) /before/ following
- * critical operations are executed. All critical operations must complete
- * /before/ reentrancy is permitted (e.g., __sti()). Alpha architecture also
- * includes these barriers, for example.
- */
-
-#define __cli()                                                                \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       _vcpu->evtchn_upcall_mask = 1;                                  \
-       preempt_enable_no_resched();                                    \
-       barrier();                                                      \
-} while (0)
-
-#define __sti()                                                                \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       barrier();                                                      \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       _vcpu->evtchn_upcall_mask = 0;                                  \
-       barrier(); /* unmask then check (avoid races) */                \
-       if (unlikely(_vcpu->evtchn_upcall_pending))                     \
-               force_evtchn_callback();                                \
-       preempt_enable();                                               \
-} while (0)
-
-#define __save_flags(x)                                                        \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       (x) = _vcpu->evtchn_upcall_mask;                                \
-       preempt_enable();                                               \
-} while (0)
-
-#define __restore_flags(x)                                             \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       barrier();                                                      \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {                   \
-               barrier(); /* unmask then check (avoid races) */        \
-               if (unlikely(_vcpu->evtchn_upcall_pending))             \
-                       force_evtchn_callback();                        \
-               preempt_enable();                                       \
-       } else                                                          \
-               preempt_enable_no_resched();                            \
-} while (0)
-
-void safe_halt(void);
-void halt(void);
-
-#define __save_and_cli(x)                                              \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       (x) = _vcpu->evtchn_upcall_mask;                                \
-       _vcpu->evtchn_upcall_mask = 1;                                  \
-       preempt_enable_no_resched();                                    \
-       barrier();                                                      \
-} while (0)
-
-#define local_irq_save(x)      __save_and_cli(x)
-#define local_irq_restore(x)   __restore_flags(x)
-#define local_save_flags(x)    __save_flags(x)
-#define local_irq_disable()    __cli()
-#define local_irq_enable()     __sti()
-
-/* Cannot use preempt_enable() here as we would recurse in preempt_sched(). */
-#define irqs_disabled()                                                        \
-({     int ___x;                                                       \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       ___x = (_vcpu->evtchn_upcall_mask != 0);                        \
-       preempt_enable_no_resched();                                    \
-       ___x; })
+#include <linux/irqflags.h>
 
 /*
  * disable hlt during certain critical i/o operations
index 4d13a65..259f0be 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _I386_TLBFLUSH_H
 #define _I386_TLBFLUSH_H
 
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <asm/processor.h>
 
index 14b8209..ffec7fa 100644 (file)
@@ -12,7 +12,7 @@
  *     access the videoram directly without any black magic.
  */
 
-#define VGA_MAP_MEM(x) (unsigned long)isa_bus_to_virt(x)
+#define VGA_MAP_MEM(x,s) (unsigned long)isa_bus_to_virt(x)
 
 #define vga_readb(x) (*(x))
 #define vga_writeb(x,y) (*(y) = (x))
index f51e828..541af84 100644 (file)
@@ -38,7 +38,7 @@ map_virtual(u64 offset, struct page **pp)
        if (REGION_NUMBER(offset) == 5) {
                char byte;
 
-               if (__get_user(byte, (char *)offset) == 0)
+               if (__get_user(byte, (char *)offset) == 0)
                        return (void *)offset;
                else
                        return NULL;
@@ -62,11 +62,11 @@ map_virtual(u64 offset, struct page **pp)
 
        pfn = offset >> PAGE_SHIFT;
 
-        if (!pfn_valid(pfn)) {
-                printk(KERN_INFO
-                    "crash memory driver: invalid pfn: %lx )\n", pfn);
-                return NULL;
-        }
+       if (!pfn_valid(pfn)) {
+               printk(KERN_INFO
+                       "crash memory driver: invalid pfn: %lx )\n", pfn);
+               return NULL;
+       }
 
        page = pfn_to_page(pfn);
 
index 3c190ae..3ba9bcb 100644 (file)
@@ -139,6 +139,7 @@ int direct_remap_pfn_range(struct vm_area_struct *vma,
                           pgprot_t prot,
                           domid_t  domid);
 struct file;
+int privcmd_enforce_singleshot_mapping(struct vm_area_struct *vma);
 int privcmd_mmap(struct file * file, struct vm_area_struct * vma);
 #define HAVE_ARCH_PRIVCMD_MMAP
 
index 08050d3..344bf44 100644 (file)
 #define L1_BRICKTYPE_PA                0x6a            /* j */
 #define L1_BRICKTYPE_IA                0x6b            /* k */
 #define L1_BRICKTYPE_ATHENA    0x2b            /* + */
+#define L1_BRICKTYPE_DAYTONA   0x7a            /* z */
+#define L1_BRICKTYPE_1932      0x2c            /* . */
+#define L1_BRICKTYPE_191010    0x2e            /* , */
+
+/* board type response codes */
+#define L1_BOARDTYPE_IP69       0x0100          /* CA */
+#define L1_BOARDTYPE_IP63       0x0200          /* CB */
+#define L1_BOARDTYPE_BASEIO     0x0300          /* IB */
+#define L1_BOARDTYPE_PCIE2SLOT  0x0400          /* IC */
+#define L1_BOARDTYPE_PCIX3SLOT  0x0500          /* ID */
+#define L1_BOARDTYPE_PCIXPCIE4SLOT 0x0600       /* IE */
+#define L1_BOARDTYPE_ABACUS     0x0700          /* AB */
+#define L1_BOARDTYPE_DAYTONA    0x0800          /* AD */
+#define L1_BOARDTYPE_INVAL      (-1)            /* invalid brick type */
 
 #endif /* _ASM_IA64_SN_L1_H */
index ed4031d..eac3561 100644 (file)
@@ -3,18 +3,30 @@
  * License.  See the file "COPYING" in the main directory of this archive
  * for more details.
  *
- * Copyright (C) 1992 - 1997, 2000-2004 Silicon Graphics, Inc. All rights reserved.
+ * Copyright (C) 1992 - 1997, 2000-2005 Silicon Graphics, Inc. All rights reserved.
  */
 #ifndef _ASM_IA64_SN_PCI_PCIDEV_H
 #define _ASM_IA64_SN_PCI_PCIDEV_H
 
 #include <linux/pci.h>
 
-extern struct sn_irq_info **sn_irq;
+/*
+ * In ia64, pci_dev->sysdata must be a *pci_controller. To provide access to
+ * the pcidev_info structs for all devices under a controller, we extend the
+ * definition of pci_controller, via sn_pci_controller, to include a list
+ * of pcidev_info.
+ */
+struct sn_pci_controller {
+       struct pci_controller pci_controller;
+       struct list_head pcidev_info;
+};
 
-#define SN_PCIDEV_INFO(pci_dev) \
-        ((struct pcidev_info *)(pci_dev)->sysdata)
+#define SN_PCI_CONTROLLER(dev) ((struct sn_pci_controller *) dev->sysdata)
 
+#define SN_PCIDEV_INFO(dev)    sn_pcidev_info_get(dev)
+
+#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
+       (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
 /*
  * Given a pci_bus, return the sn pcibus_bussoft struct.  Note that
  * this only works for root busses, not for busses represented by PPB's.
@@ -23,6 +35,8 @@ extern struct sn_irq_info **sn_irq;
 #define SN_PCIBUS_BUSSOFT(pci_bus) \
         ((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
 
+#define SN_PCIBUS_BUSSOFT_INFO(pci_bus) \
+       (struct pcibus_info *)((struct pcibus_bussoft *)(PCI_CONTROLLER((pci_bus))->platform_data))
 /*
  * Given a struct pci_dev, return the sn pcibus_bussoft struct.  Note
  * that this is not equivalent to SN_PCIBUS_BUSSOFT(pci_dev->bus) due
@@ -41,8 +55,8 @@ extern struct sn_irq_info **sn_irq;
 #define PCIIO_VENDOR_ID_NONE   (-1)
 
 struct pcidev_info {
-       uint64_t                pdi_pio_mapped_addr[7]; /* 6 BARs PLUS 1 ROM */
-       uint64_t                pdi_slot_host_handle;   /* Bus and devfn Host pci_dev */
+       u64             pdi_pio_mapped_addr[7]; /* 6 BARs PLUS 1 ROM */
+       u64             pdi_slot_host_handle;   /* Bus and devfn Host pci_dev */
 
        struct pcibus_bussoft   *pdi_pcibus_info;       /* Kernel common bus soft */
        struct pcidev_info      *pdi_host_pcidev_info;  /* Kernel Host pci_dev */
@@ -50,9 +64,20 @@ struct pcidev_info {
 
        struct sn_irq_info      *pdi_sn_irq_info;
        struct sn_pcibus_provider *pdi_provider;        /* sn pci ops */
+       struct pci_dev          *host_pci_dev;          /* host bus link */
+       struct list_head        pdi_list;               /* List of pcidev_info */
 };
 
 extern void sn_irq_fixup(struct pci_dev *pci_dev,
                         struct sn_irq_info *sn_irq_info);
-
+extern void sn_irq_unfixup(struct pci_dev *pci_dev);
+extern struct pcidev_info * sn_pcidev_info_get(struct pci_dev *);
+extern void sn_pci_controller_fixup(int segment, int busnum,
+                                   struct pci_bus *bus);
+extern void sn_bus_store_sysdata(struct pci_dev *dev);
+extern void sn_bus_free_sysdata(void);
+extern void sn_generate_path(struct pci_bus *pci_bus, char *address);
+extern void sn_pci_fixup_slot(struct pci_dev *dev);
+extern void sn_pci_unfixup_slot(struct pci_dev *dev);
+extern void sn_irq_lh_init(void);
 #endif                         /* _ASM_IA64_SN_PCI_PCIDEV_H */
index 9225b33..6bb2125 100644 (file)
@@ -53,4 +53,6 @@ struct mv_pci_controller {
        unsigned long   config_vreg;
 };
 
+extern void ll_mv64340_irq(struct pt_regs *regs);
+
 #endif /* __ASM_MIPS_MARVELL_H */
index e5f80c2..7e98428 100644 (file)
@@ -29,6 +29,17 @@ struct pt_regs;
 #endif /* __ASSEMBLY__ */
 
 
+#ifdef CONFIG_PCI
+#define _IO_BASE       isa_io_base
+#define _ISA_MEM_BASE  isa_mem_base
+#define PCI_DRAM_OFFSET        pci_dram_offset
+#else
+#define _IO_BASE       0
+#define _ISA_MEM_BASE  0
+#define PCI_DRAM_OFFSET        0
+#endif
+
+
 /* ======================================================================== */
 /* PPC Sys devices definition                                               */
 /* ======================================================================== */
@@ -49,6 +60,7 @@ enum ppc_sys_devices {
        MPC52xx_ATA,
        MPC52xx_I2C1,
        MPC52xx_I2C2,
+       NUM_PPC_SYS_DEVS,
 };
 
 
@@ -107,7 +119,7 @@ enum ppc_sys_devices {
 #define MPC52xx_SDMA_IRQ_NUM   17
 #define MPC52xx_PERP_IRQ_NUM   23
 
-#define MPC52xx_CRIT_IRQ_BASE  0
+#define MPC52xx_CRIT_IRQ_BASE  1
 #define MPC52xx_MAIN_IRQ_BASE  (MPC52xx_CRIT_IRQ_BASE + MPC52xx_CRIT_IRQ_NUM)
 #define MPC52xx_SDMA_IRQ_BASE  (MPC52xx_MAIN_IRQ_BASE + MPC52xx_MAIN_IRQ_NUM)
 #define MPC52xx_PERP_IRQ_BASE  (MPC52xx_SDMA_IRQ_BASE + MPC52xx_SDMA_IRQ_NUM)
@@ -343,6 +355,7 @@ struct mpc52xx_xlb {
        u32     snoop_window;           /* XLB + 0x70 */
 };
 
+#define MPC52xx_XLB_CFG_PLDIS          (1 << 31)
 #define MPC52xx_XLB_CFG_SNOOP          (1 << 15)
 
 /* Clock Distribution control */
@@ -415,6 +428,9 @@ extern void mpc52xx_calibrate_decr(void);
 
 extern void mpc52xx_find_bridges(void);
 
+extern void mpc52xx_setup_cpu(void);
+
+
 
        /* Matching of PSC function */
 struct mpc52xx_psc_func {
index 24b991c..40f197a 100644 (file)
@@ -3,7 +3,7 @@
  *
  * PPC system definitions and library functions
  *
- * Maintainer: Kumar Gala <kumar.gala@freescale.com>
+ * Maintainer: Kumar Gala <galak@kernel.crashing.org>
  *
  * Copyright 2005 Freescale Semiconductor, Inc
  *
 #define __ASM_PPC_SYS_H
 
 #include <linux/init.h>
-#include <linux/device.h>
+#include <linux/platform_device.h>
 #include <linux/types.h>
 
-#if defined(CONFIG_83xx)
+#if defined(CONFIG_8260)
+#include <asm/mpc8260.h>
+#elif defined(CONFIG_83xx)
 #include <asm/mpc83xx.h>
 #elif defined(CONFIG_85xx)
 #include <asm/mpc85xx.h>
+#elif defined(CONFIG_8xx)
+#include <asm/mpc8xx.h>
 #elif defined(CONFIG_PPC_MPC52xx)
 #include <asm/mpc52xx.h>
+#elif defined(CONFIG_MPC10X_BRIDGE)
+#include <asm/mpc10x.h>
+#elif defined(CONFIG_XILINX_VIRTEX)
+#include <platforms/4xx/virtex.h>
 #else
 #error "need definition of ppc_sys_devices"
 #endif
 
+#define PPC_SYS_IORESOURCE_FIXUPPED    0x00000001      
+
 struct ppc_sys_spec {
        /* PPC sys is matched via (ID & mask) == value, id could be
         * PVR, SVR, IMMR, * etc. */
@@ -38,9 +48,26 @@ struct ppc_sys_spec {
        u32                     value;
        u32                     num_devices;
        char                    *ppc_sys_name;
+       u8                      config[NUM_PPC_SYS_DEVS];
        enum ppc_sys_devices    *device_list;
 };
 
+struct platform_notify_dev_map {
+       const char *bus_id;
+       void (*rtn)(struct platform_device * pdev, int idx);
+};
+
+enum platform_device_func {
+       PPC_SYS_FUNC_DUMMY = 0,
+       PPC_SYS_FUNC_ETH = 1,
+       PPC_SYS_FUNC_UART = 2,
+       PPC_SYS_FUNC_HLDC = 3,
+       PPC_SYS_FUNC_USB = 4,
+       PPC_SYS_FUNC_IRDA = 5,
+};
+
+#define PPC_SYS_CONFIG_DISABLED                1
+
 /* describes all specific chips and which devices they have on them */
 extern struct ppc_sys_spec ppc_sys_specs[];
 extern struct ppc_sys_spec *cur_ppc_sys_spec;
@@ -48,6 +75,7 @@ extern struct ppc_sys_spec *cur_ppc_sys_spec;
 /* determine which specific SOC we are */
 extern void identify_ppc_sys_by_id(u32 id) __init;
 extern void identify_ppc_sys_by_name(char *name) __init;
+extern void identify_ppc_sys_by_name_and_id(char *name, u32 id) __init;
 
 /* describes all devices that may exist in a given family of processors */
 extern struct platform_device ppc_sys_platform_devices[];
@@ -65,5 +93,20 @@ extern void *ppc_sys_get_pdata(enum ppc_sys_devices dev) __init;
 /* remove a device from the system */
 extern void ppc_sys_device_remove(enum ppc_sys_devices dev);
 
+/* Function assignment stuff */
+void ppc_sys_device_initfunc(void);
+void ppc_sys_device_setfunc(enum ppc_sys_devices dev,
+                           enum platform_device_func func);
+void ppc_sys_device_set_func_all(enum platform_device_func func);
+
+void platform_notify_map(const struct platform_notify_dev_map *map,
+                        struct device *dev);
+
+/* Enable / disable stuff */
+void ppc_sys_device_disable(enum ppc_sys_devices dev);
+void ppc_sys_device_enable(enum ppc_sys_devices dev);
+void ppc_sys_device_enable_all(void);
+void ppc_sys_device_disable_all(void);
+
 #endif                         /* __ASM_PPC_SYS_H */
 #endif                         /* __KERNEL__ */
index e1ff63e..f3bdcdb 100644 (file)
@@ -31,16 +31,6 @@ static __inline__ void set_bit(int nr, volatile void * addr)
        local_irq_restore(flags);
 }
 
-static inline void __set_bit(int nr, void *addr)
-{
-       int     mask;
-       unsigned int *a = addr;
-
-       a += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       *a |= mask;
-}
-
 /*
  * clear_bit() doesn't provide any barrier for the compiler.
  */
@@ -58,15 +48,6 @@ static inline void clear_bit(int nr, volatile unsigned long *a)
        local_irq_restore(flags);
 }
 
-static inline void __clear_bit(int nr, volatile unsigned long *a)
-{
-       int     mask;
-
-       a += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       *a &= ~mask;
-}
-
 static __inline__ void change_bit(int nr, volatile void * addr)
 {
        int     mask;
@@ -80,16 +61,6 @@ static __inline__ void change_bit(int nr, volatile void * addr)
        local_irq_restore(flags);
 }
 
-static __inline__ void __change_bit(int nr, volatile void * addr)
-{
-       int     mask;
-       volatile unsigned int *a = addr;
-
-       a += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       *a ^= mask;
-}
-
 static __inline__ int test_and_set_bit(int nr, volatile void * addr)
 {
        int     mask, retval;
@@ -106,19 +77,6 @@ static __inline__ int test_and_set_bit(int nr, volatile void * addr)
        return retval;
 }
 
-static __inline__ int __test_and_set_bit(int nr, volatile void * addr)
-{
-       int     mask, retval;
-       volatile unsigned int *a = addr;
-
-       a += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       retval = (mask & *a) != 0;
-       *a |= mask;
-
-       return retval;
-}
-
 static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
 {
        int     mask, retval;
@@ -135,19 +93,6 @@ static __inline__ int test_and_clear_bit(int nr, volatile void * addr)
        return retval;
 }
 
-static __inline__ int __test_and_clear_bit(int nr, volatile void * addr)
-{
-       int     mask, retval;
-       volatile unsigned int *a = addr;
-
-       a += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       retval = (mask & *a) != 0;
-       *a &= ~mask;
-
-       return retval;
-}
-
 static __inline__ int test_and_change_bit(int nr, volatile void * addr)
 {
        int     mask, retval;
@@ -164,23 +109,7 @@ static __inline__ int test_and_change_bit(int nr, volatile void * addr)
        return retval;
 }
 
-static __inline__ int __test_and_change_bit(int nr, volatile void * addr)
-{
-       int     mask, retval;
-       volatile unsigned int *a = addr;
-
-       a += nr >> 5;
-       mask = 1 << (nr & 0x1f);
-       retval = (mask & *a) != 0;
-       *a ^= mask;
-
-       return retval;
-}
-
-static __inline__ int test_bit(int nr, const volatile void *addr)
-{
-       return 1UL & (((const volatile unsigned int *) addr)[nr >> 5] >> (nr & 31));
-}
+#include <asm-generic/bitops/non-atomic.h>
 
 static __inline__ unsigned long ffz(unsigned long word)
 {
@@ -204,312 +133,16 @@ static __inline__ unsigned long ffz(unsigned long word)
        return result;
 }
 
-/**
- * __ffs - find first bit in word
- * @word: The word to search
- *
- * Undefined if no bit exists, so code should check against 0 first.
- */
-static inline unsigned long __ffs(unsigned long word)
-{
-       int r = 0;
-
-       if (!word)
-               return 0;
-       if (!(word & 0xffff)) {
-               word >>= 16;
-               r += 16;
-       }
-       if (!(word & 0xff)) {
-               word >>= 8;
-               r += 8;
-       }
-       if (!(word & 0xf)) {
-               word >>= 4;
-               r += 4;
-       }
-       if (!(word & 3)) {
-               word >>= 2;
-               r += 2;
-       }
-       if (!(word & 1)) {
-               word >>= 1;
-               r += 1;
-       }
-       return r;
-}
-
-/**
- * find_next_bit - find the next set bit in a memory region
- * @addr: The address to base the search on
- * @offset: The bitnumber to start searching at
- * @size: The maximum size to search
- */
-static inline unsigned long find_next_bit(const unsigned long *addr,
-       unsigned long size, unsigned long offset)
-{
-       unsigned int *p = ((unsigned int *) addr) + (offset >> 5);
-       unsigned int result = offset & ~31UL;
-       unsigned int tmp;
-
-       if (offset >= size)
-               return size;
-       size -= result;
-       offset &= 31UL;
-       if (offset) {
-               tmp = *p++;
-               tmp &= ~0UL << offset;
-               if (size < 32)
-                       goto found_first;
-               if (tmp)
-                       goto found_middle;
-               size -= 32;
-               result += 32;
-       }
-       while (size >= 32) {
-               if ((tmp = *p++) != 0)
-                       goto found_middle;
-               result += 32;
-               size -= 32;
-       }
-       if (!size)
-               return result;
-       tmp = *p;
-
-found_first:
-       tmp &= ~0UL >> (32 - size);
-       if (tmp == 0UL)        /* Are any bits set? */
-               return result + size; /* Nope. */
-found_middle:
-       return result + __ffs(tmp);
-}
-
-/**
- * find_first_bit - find the first set bit in a memory region
- * @addr: The address to start the search at
- * @size: The maximum size to search
- *
- * Returns the bit-number of the first set bit, not the number of the byte
- * containing a bit.
- */
-#define find_first_bit(addr, size) \
-       find_next_bit((addr), (size), 0)
-
-
-static inline int find_next_zero_bit(void *addr, int size, int offset)
-{
-       unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
-       unsigned long result = offset & ~31UL;
-       unsigned long tmp;
-
-       if (offset >= size)
-               return size;
-       size -= result;
-       offset &= 31UL;
-       if (offset) {
-               tmp = *(p++);
-               tmp |= ~0UL >> (32-offset);
-               if (size < 32)
-                       goto found_first;
-               if (~tmp)
-                       goto found_middle;
-               size -= 32;
-               result += 32;
-       }
-       while (size & ~31UL) {
-               if (~(tmp = *(p++)))
-                       goto found_middle;
-               result += 32;
-               size -= 32;
-       }
-       if (!size)
-               return result;
-       tmp = *p;
-
-found_first:
-       tmp |= ~0UL << size;
-found_middle:
-       return result + ffz(tmp);
-}
-
-#define find_first_zero_bit(addr, size) \
-        find_next_zero_bit((addr), (size), 0)
-
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-
-#define hweight32(x)   generic_hweight32(x)
-#define hweight16(x)   generic_hweight16(x)
-#define hweight8(x)    generic_hweight8(x)
-
-/*
- * Every architecture must define this function. It's the fastest
- * way of searching a 140-bit bitmap where the first 100 bits are
- * unlikely to be set. It's guaranteed that at least one of the 140
- * bits is cleared.
- */
-
-static inline int sched_find_first_bit(unsigned long *b)
-{
-       if (unlikely(b[0]))
-               return __ffs(b[0]);
-       if (unlikely(b[1]))
-               return __ffs(b[1]) + 32;
-       if (unlikely(b[2]))
-               return __ffs(b[2]) + 64;
-       if (b[3])
-               return __ffs(b[3]) + 96;
-       return __ffs(b[4]) + 128;
-}
-
-/*
- * ffs: find first bit set. This is defined the same way as
- * the libc and compiler builtin ffs routines, therefore
- * differs in spirit from the above ffz (man ffs).
- */
-
-#define ffs(x) generic_ffs(x)
-
-/*
- * hweightN: returns the hamming weight (i.e. the number
- * of bits set) of a N-bit word
- */
-
-#define hweight32(x) generic_hweight32(x)
-#define hweight16(x) generic_hweight16(x)
-#define hweight8(x) generic_hweight8(x)
-
-#ifdef __LITTLE_ENDIAN__
-#define ext2_set_bit(nr, addr) test_and_set_bit((nr), (addr))
-#define ext2_clear_bit(nr, addr) test_and_clear_bit((nr), (addr))
-#define ext2_test_bit(nr, addr) test_bit((nr), (addr))
-#define ext2_find_first_zero_bit(addr, size) find_first_zero_bit((addr), (size))
-#define ext2_find_next_zero_bit(addr, size, offset) \
-                find_next_zero_bit((addr), (size), (offset))
-#else
-static __inline__ int ext2_set_bit(int nr, volatile void * addr)
-{
-       int             mask, retval;
-       unsigned long   flags;
-       volatile unsigned char  *ADDR = (unsigned char *) addr;
-
-       ADDR += nr >> 3;
-       mask = 1 << (nr & 0x07);
-       local_irq_save(flags);
-       retval = (mask & *ADDR) != 0;
-       *ADDR |= mask;
-       local_irq_restore(flags);
-       return retval;
-}
-
-static __inline__ int ext2_clear_bit(int nr, volatile void * addr)
-{
-       int             mask, retval;
-       unsigned long   flags;
-       volatile unsigned char  *ADDR = (unsigned char *) addr;
-
-       ADDR += nr >> 3;
-       mask = 1 << (nr & 0x07);
-       local_irq_save(flags);
-       retval = (mask & *ADDR) != 0;
-       *ADDR &= ~mask;
-       local_irq_restore(flags);
-       return retval;
-}
-
-static __inline__ int ext2_test_bit(int nr, const volatile void * addr)
-{
-       int                     mask;
-       const volatile unsigned char    *ADDR = (const unsigned char *) addr;
-
-       ADDR += nr >> 3;
-       mask = 1 << (nr & 0x07);
-       return ((mask & *ADDR) != 0);
-}
-
-#define ext2_find_first_zero_bit(addr, size) \
-        ext2_find_next_zero_bit((addr), (size), 0)
-
-static __inline__ unsigned long ext2_find_next_zero_bit(void *addr, unsigned long size, unsigned long offset)
-{
-       unsigned long *p = ((unsigned long *) addr) + (offset >> 5);
-       unsigned long result = offset & ~31UL;
-       unsigned long tmp;
-
-       if (offset >= size)
-               return size;
-       size -= result;
-       offset &= 31UL;
-       if(offset) {
-               /* We hold the little endian value in tmp, but then the
-                * shift is illegal. So we could keep a big endian value
-                * in tmp, like this:
-                *
-                * tmp = __swab32(*(p++));
-                * tmp |= ~0UL >> (32-offset);
-                *
-                * but this would decrease preformance, so we change the
-                * shift:
-                */
-               tmp = *(p++);
-               tmp |= __swab32(~0UL >> (32-offset));
-               if(size < 32)
-                       goto found_first;
-               if(~tmp)
-                       goto found_middle;
-               size -= 32;
-               result += 32;
-       }
-       while(size & ~31UL) {
-               if(~(tmp = *(p++)))
-                       goto found_middle;
-               result += 32;
-               size -= 32;
-       }
-       if(!size)
-               return result;
-       tmp = *p;
-
-found_first:
-       /* tmp is little endian, so we would have to swab the shift,
-        * see above. But then we have to swab tmp below for ffz, so
-        * we might as well do this here.
-        */
-       return result + ffz(__swab32(tmp) | (~0UL << size));
-found_middle:
-       return result + ffz(__swab32(tmp));
-}
-#endif
-
-#define ext2_set_bit_atomic(lock, nr, addr)            \
-       ({                                              \
-               int ret;                                \
-               spin_lock(lock);                        \
-               ret = ext2_set_bit((nr), (addr));       \
-               spin_unlock(lock);                      \
-               ret;                                    \
-       })
-
-#define ext2_clear_bit_atomic(lock, nr, addr)          \
-       ({                                              \
-               int ret;                                \
-               spin_lock(lock);                        \
-               ret = ext2_clear_bit((nr), (addr));     \
-               spin_unlock(lock);                      \
-               ret;                                    \
-       })
-
-/* Bitmap functions for the minix filesystem.  */
-#define minix_test_and_set_bit(nr,addr) test_and_set_bit(nr,addr)
-#define minix_set_bit(nr,addr) set_bit(nr,addr)
-#define minix_test_and_clear_bit(nr,addr) test_and_clear_bit(nr,addr)
-#define minix_test_bit(nr,addr) test_bit(nr,addr)
-#define minix_find_first_zero_bit(addr,size) find_first_zero_bit(addr,size)
-
-#define ffs(x) generic_ffs(x)
-#define fls(x) generic_fls(x)
+#include <asm-generic/bitops/__ffs.h>
+#include <asm-generic/bitops/find.h>
+#include <asm-generic/bitops/hweight.h>
+#include <asm-generic/bitops/sched.h>
+#include <asm-generic/bitops/ffs.h>
+#include <asm-generic/bitops/ext2-non-atomic.h>
+#include <asm-generic/bitops/ext2-atomic.h>
+#include <asm-generic/bitops/minix.h>
+#include <asm-generic/bitops/fls.h>
+#include <asm-generic/bitops/fls64.h>
 
 #endif /* __KERNEL__ */
 
index b25f5df..b29dd46 100644 (file)
@@ -38,14 +38,14 @@ static inline void pgd_init(unsigned long page)
  * if any.
  */
 
-extern __inline__ pgd_t *get_pgd_slow(void)
+static inline pgd_t *get_pgd_slow(void)
 {
        unsigned int pgd_size = (USER_PTRS_PER_PGD * sizeof(pgd_t));
        pgd_t *ret = (pgd_t *)kmalloc(pgd_size, GFP_KERNEL);
        return ret;
 }
 
-extern __inline__ pgd_t *get_pgd_fast(void)
+static inline pgd_t *get_pgd_fast(void)
 {
        unsigned long *ret;
 
@@ -62,14 +62,14 @@ extern __inline__ pgd_t *get_pgd_fast(void)
        return (pgd_t *)ret;
 }
 
-extern __inline__ void free_pgd_fast(pgd_t *pgd)
+static inline void free_pgd_fast(pgd_t *pgd)
 {
        *(unsigned long *)pgd = (unsigned long) pgd_quicklist;
        pgd_quicklist = (unsigned long *) pgd;
        pgtable_cache_size++;
 }
 
-extern __inline__ void free_pgd_slow(pgd_t *pgd)
+static inline void free_pgd_slow(pgd_t *pgd)
 {
        kfree((void *)pgd);
 }
@@ -77,7 +77,7 @@ extern __inline__ void free_pgd_slow(pgd_t *pgd)
 extern pte_t *get_pte_slow(pmd_t *pmd, unsigned long address_preadjusted);
 extern pte_t *get_pte_kernel_slow(pmd_t *pmd, unsigned long address_preadjusted);
 
-extern __inline__ pte_t *get_pte_fast(void)
+static inline pte_t *get_pte_fast(void)
 {
        unsigned long *ret;
 
@@ -89,7 +89,7 @@ extern __inline__ pte_t *get_pte_fast(void)
        return (pte_t *)ret;
 }
 
-extern __inline__ void free_pte_fast(pte_t *pte)
+static inline void free_pte_fast(pte_t *pte)
 {
        *(unsigned long *)pte = (unsigned long) pte_quicklist;
        pte_quicklist = (unsigned long *) pte;
@@ -167,22 +167,6 @@ static __inline__ void pmd_free(pmd_t *pmd)
 
 extern int do_check_pgt_cache(int, int);
 
-extern inline void set_pgdir(unsigned long address, pgd_t entry)
-{
-       struct task_struct * p;
-       pgd_t *pgd;
-
-       read_lock(&tasklist_lock);
-       for_each_process(p) {
-               if (!p->mm)
-                       continue;
-               *pgd_offset(p->mm,address) = entry;
-       }
-       read_unlock(&tasklist_lock);
-       for (pgd = (pgd_t *)pgd_quicklist; pgd; pgd = (pgd_t *)*(unsigned long *)pgd)
-               pgd[address >> PGDIR_SHIFT] = entry;
-}
-
 #define pmd_populate_kernel(mm, pmd, pte) \
        set_pmd(pmd, __pmd(_PAGE_TABLE + (unsigned long) (pte)))
 
index 7046a90..bd0d9c4 100644 (file)
@@ -61,9 +61,4 @@ extern int platform_int_priority[NR_INTC_IRQS];
 #define code_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 2])
 #define data_resource (platform_parms.kram_res_p[STANDARD_KRAM_RESOURCES - 1])
 
-/* Be prepared to 64-bit sign extensions */
-#define PFN_UP(x)       ((((x) + PAGE_SIZE-1) >> PAGE_SHIFT) & 0x000fffff)
-#define PFN_DOWN(x)     (((x) >> PAGE_SHIFT) & 0x000fffff)
-#define PFN_PHYS(x)     ((x) << PAGE_SHIFT)
-
 #endif /* __ASM_SH64_PLATFORM_H */
index a420d14..3a6cbad 100644 (file)
@@ -26,6 +26,7 @@
 #define POLLWRNORM     0x0100
 #define POLLWRBAND     0x0200
 #define POLLMSG                0x0400
+#define POLLRDHUP       0x2000
 
 struct pollfd {
        int fd;
index 8e39b4e..29c9be1 100644 (file)
 
 #define STD_COM_FLAGS (ASYNC_BOOT_AUTOCONF | ASYNC_SKIP_TEST)
 
-#define STD_SERIAL_PORT_DEFNS                  \
+#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 */
 
-#define SERIAL_PORT_DFNS STD_SERIAL_PORT_DEFNS
-
 /* XXX: This should be moved ino irq.h */
 #define irq_cannonicalize(x) (x)
 
index 9b3abc0..ffe017f 100644 (file)
 static inline int pgd_newpage(pgd_t pgd)       { return 0; }
 static inline void pgd_mkuptodate(pgd_t pgd)   { }
 
-#define pte_present(x) (pte_val(x) & (_PAGE_PRESENT | _PAGE_PROTNONE))
-
-static inline pte_t pte_mknewprot(pte_t pte)
-{
-       pte_val(pte) |= _PAGE_NEWPROT;
-       return(pte);
-}
-
-static inline pte_t pte_mknewpage(pte_t pte)
-{
-       pte_val(pte) |= _PAGE_NEWPAGE;
-       return(pte);
-}
-
-static inline void set_pte(pte_t *pteptr, pte_t pteval)
-{
-       /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so
-        * fix_range knows to unmap it.  _PAGE_NEWPROT is specific to
-        * mapped pages.
-        */
-       *pteptr = pte_mknewpage(pteval);
-       if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
-}
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
-
 #define set_pmd(pmdptr, pmdval) (*(pmdptr) = (pmdval))
 
-#define pte_page(x) pfn_to_page(pte_pfn(x))
-#define pte_none(x) !(pte_val(x) & ~_PAGE_NEWPAGE)
 #define pte_pfn(x) phys_to_pfn(pte_val(x))
 #define pfn_pte(pfn, prot) __pte(pfn_to_phys(pfn) | pgprot_val(prot))
 #define pfn_pmd(pfn, prot) __pmd(pfn_to_phys(pfn) | pgprot_val(prot))
index 65e8bfc..786c257 100644 (file)
@@ -57,35 +57,6 @@ static inline int pgd_newpage(pgd_t pgd)
 
 static inline void pgd_mkuptodate(pgd_t pgd) { pgd_val(pgd) &= ~_PAGE_NEWPAGE; }
 
-
-#define pte_present(x) pte_get_bits(x, (_PAGE_PRESENT | _PAGE_PROTNONE))
-
-static inline pte_t pte_mknewprot(pte_t pte)
-{
-        pte_set_bits(pte, _PAGE_NEWPROT);
-       return(pte);
-}
-
-static inline pte_t pte_mknewpage(pte_t pte)
-{
-       pte_set_bits(pte, _PAGE_NEWPAGE);
-       return(pte);
-}
-
-static inline void set_pte(pte_t *pteptr, pte_t pteval)
-{
-       pte_copy(*pteptr, pteval);
-
-       /* If it's a swap entry, it needs to be marked _PAGE_NEWPAGE so
-        * fix_range knows to unmap it.  _PAGE_NEWPROT is specific to
-        * mapped pages.
-        */
-
-       *pteptr = pte_mknewpage(*pteptr);
-       if(pte_present(*pteptr)) *pteptr = pte_mknewprot(*pteptr);
-}
-#define set_pte_at(mm,addr,ptep,pteval) set_pte(ptep,pteval)
-
 #define set_pmd(pmdptr, pmdval) set_64bit((phys_t *) (pmdptr), pmd_val(pmdval))
 
 static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
@@ -98,14 +69,11 @@ static inline pmd_t *pmd_alloc_one(struct mm_struct *mm, unsigned long address)
         return pmd;
 }
 
-static inline void pmd_free(pmd_t *pmd){
-       free_page((unsigned long) pmd);
+extern inline void pud_clear (pud_t *pud)
+{
+        set_pud(pud, __pud(0));
 }
 
-#define __pmd_free_tlb(tlb,x)   do { } while (0)
-
-static inline void pud_clear (pud_t * pud) { }
-
 #define pud_page(pud) \
        ((struct page *) __va(pud_val(pud) & PAGE_MASK))
 
@@ -113,13 +81,6 @@ static inline void pud_clear (pud_t * pud) { }
 #define pmd_offset(pud, address) ((pmd_t *) pud_page(*(pud)) + \
                        pmd_index(address))
 
-#define pte_page(x) pfn_to_page(pte_pfn(x))
-
-static inline int pte_none(pte_t pte)
-{
-       return pte_is_zero(pte);
-}
-
 static inline unsigned long pte_pfn(pte_t pte)
 {
        return phys_to_pfn(pte_val(pte));
index 0beb9a4..10609af 100644 (file)
@@ -28,6 +28,15 @@ extern inline void rep_nop(void)
                            .debugregs_seq      = 0, \
                            .faultinfo          = { 0, 0, 0 } }
 
+static inline void arch_flush_thread(struct arch_thread *thread)
+{
+}
+
+static inline void arch_copy_thread(struct arch_thread *from,
+                                    struct arch_thread *to)
+{
+}
+
 #include "asm/arch/user.h"
 
 #define current_text_addr() \
@@ -36,17 +45,9 @@ extern inline void rep_nop(void)
 #define ARCH_IS_STACKGROW(address) \
         (address + 128 >= UPT_SP(&current->thread.regs.regs))
 
+#define KSTK_EIP(tsk) KSTK_REG(tsk, RIP)
+#define KSTK_ESP(tsk) KSTK_REG(tsk, RSP)
+
 #include "asm/processor-generic.h"
 
 #endif
-
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
index be51219..c894e68 100644 (file)
@@ -8,6 +8,8 @@
 #define __UM_PTRACE_X86_64_H
 
 #include "linux/compiler.h"
+#include "asm/errno.h"
+#include "asm/host_ldt.h"
 
 #define signal_fault signal_fault_x86_64
 #define __FRAME_OFFSETS /* Needed to get the R* macros */
@@ -63,15 +65,26 @@ void signal_fault(struct pt_regs_subarch *regs, void *frame, char *where);
 
 #define profile_pc(regs) PT_REGS_IP(regs)
 
-#endif
+static inline int ptrace_get_thread_area(struct task_struct *child, int idx,
+                                         struct user_desc __user *user_desc)
+{
+        return -ENOSYS;
+}
 
-/*
- * Overrides for Emacs so that we follow Linus's tabbing style.
- * Emacs will notice this stuff at the end of the file and automatically
- * adjust the settings for this buffer only.  This must remain at the end
- * of the file.
- * ---------------------------------------------------------------------------
- * Local variables:
- * c-file-style: "linux"
- * End:
- */
+static inline int ptrace_set_thread_area(struct task_struct *child, int idx,
+                                         struct user_desc __user *user_desc)
+{
+        return -ENOSYS;
+}
+
+static inline void arch_switch_to_tt(struct task_struct *from,
+                                     struct task_struct *to)
+{
+}
+
+static inline void arch_switch_to_skas(struct task_struct *from,
+                                       struct task_struct *to)
+{
+}
+
+#endif
index 389654f..f80cb95 100644 (file)
@@ -37,12 +37,12 @@ map_virtual(u64 offset, struct page **pp)
        unsigned long pfn;
        void *vaddr;
 
-        pfn = (unsigned long)(offset >> PAGE_SHIFT);
+       pfn = (unsigned long)(offset >> PAGE_SHIFT);
 
-        if (!page_is_ram(pfn)) {
+       if (!page_is_ram(pfn)) {
                printk(KERN_INFO
                    "crash memory driver: !page_is_ram(pfn: %lx)\n", pfn);
-                return NULL;
+               return NULL;
        }
 
        if (!pfn_valid(pfn)) {
index 58b5d99..843deab 100644 (file)
@@ -6,7 +6,6 @@
  * documentation.
  */
 
-#include <linux/config.h>
 
 #include <asm/scatterlist.h>
 #include <asm/io.h>
@@ -57,6 +56,13 @@ extern struct dma_mapping_ops* dma_ops;
 extern int iommu_merge;
 
 #if 0
+static inline int valid_dma_direction(int dma_direction)
+{
+       return ((dma_direction == DMA_BIDIRECTIONAL) ||
+               (dma_direction == DMA_TO_DEVICE) ||
+               (dma_direction == DMA_FROM_DEVICE));
+}
+
 static inline int dma_mapping_error(dma_addr_t dma_addr)
 {
        if (dma_ops->mapping_error)
@@ -74,6 +80,7 @@ static inline dma_addr_t
 dma_map_single(struct device *hwdev, void *ptr, size_t size,
               int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        return dma_ops->map_single(hwdev, ptr, size, direction);
 }
 
@@ -81,6 +88,7 @@ static inline void
 dma_unmap_single(struct device *dev, dma_addr_t addr,size_t size,
                 int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        dma_ops->unmap_single(dev, addr, size, direction);
 }
 
@@ -93,6 +101,7 @@ static inline void
 dma_sync_single_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
                        size_t size, int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        if (dma_ops->sync_single_for_cpu)
                dma_ops->sync_single_for_cpu(hwdev, dma_handle, size,
                                             direction);
@@ -103,6 +112,7 @@ static inline void
 dma_sync_single_for_device(struct device *hwdev, dma_addr_t dma_handle,
                           size_t size, int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        if (dma_ops->sync_single_for_device)
                dma_ops->sync_single_for_device(hwdev, dma_handle, size,
                                                direction);
@@ -113,6 +123,7 @@ static inline void
 dma_sync_single_range_for_cpu(struct device *hwdev, dma_addr_t dma_handle,
                              unsigned long offset, size_t size, int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        if (dma_ops->sync_single_range_for_cpu) {
                dma_ops->sync_single_range_for_cpu(hwdev, dma_handle, offset, size, direction);
        }
@@ -124,6 +135,7 @@ static inline void
 dma_sync_single_range_for_device(struct device *hwdev, dma_addr_t dma_handle,
                                 unsigned long offset, size_t size, int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        if (dma_ops->sync_single_range_for_device)
                dma_ops->sync_single_range_for_device(hwdev, dma_handle,
                                                      offset, size, direction);
@@ -135,6 +147,7 @@ static inline void
 dma_sync_sg_for_cpu(struct device *hwdev, struct scatterlist *sg,
                    int nelems, int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        if (dma_ops->sync_sg_for_cpu)
                dma_ops->sync_sg_for_cpu(hwdev, sg, nelems, direction);
        flush_write_buffers();
@@ -144,6 +157,7 @@ static inline void
 dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
                       int nelems, int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        if (dma_ops->sync_sg_for_device) {
                dma_ops->sync_sg_for_device(hwdev, sg, nelems, direction);
        }
@@ -154,6 +168,7 @@ dma_sync_sg_for_device(struct device *hwdev, struct scatterlist *sg,
 static inline int
 dma_map_sg(struct device *hwdev, struct scatterlist *sg, int nents, int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        return dma_ops->map_sg(hwdev, sg, nents, direction);
 }
 
@@ -161,6 +176,7 @@ static inline void
 dma_unmap_sg(struct device *hwdev, struct scatterlist *sg, int nents,
             int direction)
 {
+       BUG_ON(!valid_dma_direction(direction));
        dma_ops->unmap_sg(hwdev, sg, nents, direction);
 }
 
@@ -183,8 +199,8 @@ dma_cache_sync(void *vaddr, size_t size, enum dma_data_direction dir)
 }
 
 extern struct device fallback_dev;
-extern int panic_on_overflow;
 #endif
+extern int panic_on_overflow;
 
 #endif /* _X8664_DMA_MAPPING_H */
 
index 860ce83..0239abf 100644 (file)
@@ -11,7 +11,6 @@
 #ifndef _ASM_FIXMAP_H
 #define _ASM_FIXMAP_H
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <asm/apicdef.h>
 #include <xen/gnttab.h>
index d1027d8..e7893c5 100644 (file)
@@ -134,8 +134,8 @@ static int vdma_get_dma_residue(unsigned int dummy)
 
 static int fd_request_irq(void)
 {
-       return request_irq(FLOPPY_IRQ, floppy_hardint,SA_INTERRUPT,
-                                          "floppy", NULL);
+       return request_irq(FLOPPY_IRQ, floppy_hardint,
+                          IRQF_DISABLED, "floppy", NULL);
 }
 
 #if 0
index f331082..ae438de 100644 (file)
  *     <tomsoft@informatik.tu-chemnitz.de>
  *
  *     hacked by Andi Kleen for x86-64.
- * 
- *  $Id: hw_irq.h,v 1.24 2001/09/14 20:55:03 vojtech Exp $
  */
 
 #ifndef __ASSEMBLY__
-#include <linux/config.h>
 #include <asm/atomic.h>
 #include <asm/irq.h>
 #include <linux/profile.h>
@@ -132,12 +129,6 @@ __asm__( \
        "push $" #nr "-256 ; " \
        "jmp common_interrupt");
 
-extern void resend_irq_on_evtchn(struct hw_interrupt_type *h, unsigned int i);
-static inline void hw_resend_irq(struct hw_interrupt_type *h, unsigned int i)
-{
-       resend_irq_on_evtchn(h, i);
-}
-
 #define platform_legacy_irq(irq)       ((irq) < 16)
 
 #endif
index 1bcc790..14fb01d 100644 (file)
 #define __STR(x) #x
 #define STR(x) __STR(x)
 
+#ifdef CONFIG_XEN
+#define HYPERCALL_STR(name)                                    \
+       "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"
+#else
+#define HYPERCALL_STR(name)                                    \
+       "mov hypercall_stubs,%%rax; "                           \
+       "add $("STR(__HYPERVISOR_##name)" * 32),%%rax; "        \
+       "call *%%rax"
+#endif
+
 #define _hypercall0(type, name)                        \
 ({                                             \
        long __res;                             \
        asm volatile (                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)             \
                : "=a" (__res)                  \
                :                               \
                : "memory" );                   \
@@ -61,7 +71,7 @@
 ({                                                             \
        long __res, __ign1;                                     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1)                   \
                : "1" ((long)(a1))                              \
                : "memory" );                                   \
@@ -72,7 +82,7 @@
 ({                                                             \
        long __res, __ign1, __ign2;                             \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1), "=S" (__ign2)    \
                : "1" ((long)(a1)), "2" ((long)(a2))            \
                : "memory" );                                   \
@@ -83,7 +93,7 @@
 ({                                                             \
        long __res, __ign1, __ign2, __ign3;                     \
        asm volatile (                                          \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1), "=S" (__ign2),   \
                "=d" (__ign3)                                   \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
        long __res, __ign1, __ign2, __ign3;                     \
        asm volatile (                                          \
                "movq %7,%%r10; "                               \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1), "=S" (__ign2),   \
                "=d" (__ign3)                                   \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
        long __res, __ign1, __ign2, __ign3;                     \
        asm volatile (                                          \
                "movq %7,%%r10; movq %8,%%r8; "                 \
-               "call hypercall_page + ("STR(__HYPERVISOR_##name)" * 32)"\
+               HYPERCALL_STR(name)                             \
                : "=a" (__res), "=D" (__ign1), "=S" (__ign2),   \
                "=d" (__ign3)                                   \
                : "1" ((long)(a1)), "2" ((long)(a2)),           \
@@ -355,6 +365,13 @@ HYPERVISOR_nmi_op(
        return _hypercall2(int, nmi_op, op, arg);
 }
 
+static inline unsigned long
+HYPERVISOR_hvm_op(
+    int op, void *arg)
+{
+    return _hypercall2(unsigned long, hvm_op, op, arg);
+}
+
 static inline int
 HYPERVISOR_callback_op(
        int cmd, void *arg)
index 182e4b3..1456a3e 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _ASM_IO_H
 #define _ASM_IO_H
 
-#include <linux/config.h>
 #include <asm/fixmap.h>
 
 /*
index e52fab7..f489bf5 100644 (file)
@@ -10,7 +10,6 @@
  *     <tomsoft@informatik.tu-chemnitz.de>
  */
 
-#include <linux/config.h>
 #include <linux/sched.h>
 /* include comes from machine specific directory */
 #include "irq_vectors.h"
index 6676cb9..b6afab4 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __X86_64_MMU_CONTEXT_H
 #define __X86_64_MMU_CONTEXT_H
 
-#include <linux/config.h>
 #include <asm/desc.h>
 #include <asm/atomic.h>
 #include <asm/pgalloc.h>
index 545a192..8fff33f 100644 (file)
@@ -5,28 +5,29 @@
 #define ASM_NMI_H
 
 #include <linux/pm.h>
+#include <asm/io.h>
 
 #include <xen/interface/nmi.h>
 
 struct pt_regs;
+
 typedef int (*nmi_callback_t)(struct pt_regs * regs, int cpu);
-/** 
+
+/**
  * set_nmi_callback
  *
  * Set a handler for an NMI. Only one handler may be
  * set. Return 1 if the NMI was handled.
  */
 void set_nmi_callback(nmi_callback_t callback);
-/** 
+
+/**
  * unset_nmi_callback
  *
  * Remove the handler previously set.
  */
 void unset_nmi_callback(void);
+
 #ifdef CONFIG_PM
  
 /** Replace the PM callback routine for NMI. */
@@ -72,4 +73,21 @@ extern int unknown_nmi_panic;
 
 extern int check_nmi_watchdog(void);
  
+extern void setup_apic_nmi_watchdog (void);
+extern int reserve_lapic_nmi(void);
+extern void release_lapic_nmi(void);
+extern void disable_timer_nmi_watchdog(void);
+extern void enable_timer_nmi_watchdog(void);
+extern void nmi_watchdog_tick (struct pt_regs * regs, unsigned reason);
+
+extern void nmi_watchdog_default(void);
+extern int setup_nmi_watchdog(char *);
+
+extern unsigned int nmi_watchdog;
+#define NMI_DEFAULT    -1
+#define NMI_NONE       0
+#define NMI_IO_APIC    1
+#define NMI_LOCAL_APIC 2
+#define NMI_INVALID    3
+
 #endif /* ASM_NMI_H */
index fe7f7e6..8aba44c 100644 (file)
@@ -1,13 +1,11 @@
 #ifndef _X86_64_PAGE_H
 #define _X86_64_PAGE_H
 
-#include <linux/config.h>
 /* #include <linux/string.h> */
 #ifndef __ASSEMBLY__
 #include <linux/kernel.h>
 #include <linux/types.h>
 #include <asm/bug.h>
-#include <xen/features.h>
 #endif
 #include <xen/interface/xen.h> 
 #include <xen/foreign_page.h>
@@ -43,7 +41,7 @@
 #define EXCEPTION_STACK_ORDER 0
 #define EXCEPTION_STKSZ (PAGE_SIZE << EXCEPTION_STACK_ORDER)
 
-#define DEBUG_STACK_ORDER EXCEPTION_STACK_ORDER
+#define DEBUG_STACK_ORDER (EXCEPTION_STACK_ORDER + 1)
 #define DEBUG_STKSZ (PAGE_SIZE << DEBUG_STACK_ORDER)
 
 #define IRQSTACK_ORDER 2
@@ -69,6 +67,8 @@
 
 extern unsigned long end_pfn;
 
+#include <asm/maddr.h>
+
 void clear_page(void *);
 void copy_page(void *, void *);
 
@@ -78,118 +78,6 @@ void copy_page(void *, void *);
 #define alloc_zeroed_user_highpage(vma, vaddr) alloc_page_vma(GFP_HIGHUSER | __GFP_ZERO, vma, vaddr)
 #define __HAVE_ARCH_ALLOC_ZEROED_USER_HIGHPAGE
 
-/**** MACHINE <-> PHYSICAL CONVERSION MACROS ****/
-#define INVALID_P2M_ENTRY      (~0UL)
-#define FOREIGN_FRAME_BIT      (1UL<<63)
-#define FOREIGN_FRAME(m)       ((m) | FOREIGN_FRAME_BIT)
-
-extern unsigned long *phys_to_machine_mapping;
-
-#undef machine_to_phys_mapping
-extern unsigned long *machine_to_phys_mapping;
-extern unsigned int   machine_to_phys_order;
-
-static inline unsigned long pfn_to_mfn(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return pfn;
-       return phys_to_machine_mapping[(unsigned int)(pfn)] &
-               ~FOREIGN_FRAME_BIT;
-}
-
-static inline int phys_to_machine_mapping_valid(unsigned long pfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return 1;
-       return (phys_to_machine_mapping[pfn] != INVALID_P2M_ENTRY);
-}
-
-static inline unsigned long mfn_to_pfn(unsigned long mfn)
-{
-       unsigned long pfn;
-
-       if (xen_feature(XENFEAT_auto_translated_physmap))
-               return mfn;
-
-       if (unlikely((mfn >> machine_to_phys_order) != 0))
-               return end_pfn;
-
-       /* The array access can fail (e.g., device space beyond end of RAM). */
-       asm (
-               "1:     movq %1,%0\n"
-               "2:\n"
-               ".section .fixup,\"ax\"\n"
-               "3:     movq %2,%0\n"
-               "       jmp  2b\n"
-               ".previous\n"
-               ".section __ex_table,\"a\"\n"
-               "       .align 8\n"
-               "       .quad 1b,3b\n"
-               ".previous"
-               : "=r" (pfn)
-               : "m" (machine_to_phys_mapping[mfn]), "m" (end_pfn) );
-
-       return pfn;
-}
-
-/*
- * We detect special mappings in one of two ways:
- *  1. If the MFN is an I/O page then Xen will set the m2p entry
- *     to be outside our maximum possible pseudophys range.
- *  2. If the MFN belongs to a different domain then we will certainly
- *     not have MFN in our p2m table. Conversely, if the page is ours,
- *     then we'll have p2m(m2p(MFN))==MFN.
- * If we detect a special mapping then it doesn't have a 'struct page'.
- * We force !pfn_valid() by returning an out-of-range pointer.
- *
- * NB. These checks require that, for any MFN that is not in our reservation,
- * there is no PFN such that p2m(PFN) == MFN. Otherwise we can get confused if
- * we are foreign-mapping the MFN, and the other domain as m2p(MFN) == PFN.
- * Yikes! Various places must poke in INVALID_P2M_ENTRY for safety.
- *
- * NB2. When deliberately mapping foreign pages into the p2m table, you *must*
- *      use FOREIGN_FRAME(). This will cause pte_pfn() to choke on it, as we
- *      require. In all the cases we care about, the FOREIGN_FRAME bit is
- *      masked (e.g., pfn_to_mfn()) so behaviour there is correct.
- */
-static inline unsigned long mfn_to_local_pfn(unsigned long mfn)
-{
-       unsigned long pfn = mfn_to_pfn(mfn);
-       if ((pfn < end_pfn)
-           && !xen_feature(XENFEAT_auto_translated_physmap)
-           && (phys_to_machine_mapping[pfn] != mfn))
-               return end_pfn; /* force !pfn_valid() */
-       return pfn;
-}
-
-
-static inline void set_phys_to_machine(unsigned long pfn, unsigned long mfn)
-{
-       if (xen_feature(XENFEAT_auto_translated_physmap)) {
-               BUG_ON(pfn != mfn && mfn != INVALID_P2M_ENTRY);
-               return;
-       }
-       phys_to_machine_mapping[pfn] = mfn;
-}
-
-/* Definitions for machine and pseudophysical addresses. */
-typedef unsigned long paddr_t;
-typedef unsigned long maddr_t;
-
-static inline maddr_t phys_to_machine(paddr_t phys)
-{
-       maddr_t machine = pfn_to_mfn(phys >> PAGE_SHIFT);
-       machine = (machine << PAGE_SHIFT) | (phys & ~PAGE_MASK);
-       return machine;
-}
-
-static inline paddr_t machine_to_phys(maddr_t machine)
-{
-       paddr_t phys = mfn_to_pfn(machine >> PAGE_SHIFT);
-       phys = (phys << PAGE_SHIFT) | (machine & ~PAGE_MASK);
-       return phys;
-}
-
 /*
  * These are used to make use of C type-checking..
  */
@@ -228,8 +116,6 @@ static inline unsigned long pgd_val(pgd_t x)
 
 #define pgprot_val(x)  ((x).pgprot)
 
-#define __pte_ma(x)     ((pte_t) { (x) } )
-
 static inline pte_t __pte(unsigned long x)
 {
        if (x & 1) x = phys_to_machine(x);
@@ -308,24 +194,19 @@ static inline pgd_t __pgd(unsigned long x)
 #define virt_addr_valid(kaddr) pfn_valid(__pa(kaddr) >> PAGE_SHIFT)
 #define pfn_to_kaddr(pfn)      __va((pfn) << PAGE_SHIFT)
 
-/* VIRT <-> MACHINE conversion */
-#define virt_to_machine(v)     (phys_to_machine(__pa(v)))
-#define virt_to_mfn(v)         (pfn_to_mfn(__pa(v) >> PAGE_SHIFT))
-#define mfn_to_virt(m)         (__va(mfn_to_pfn(m) << PAGE_SHIFT))
-
 #define VM_DATA_DEFAULT_FLAGS \
        (((current->personality & READ_IMPLIES_EXEC) ? VM_EXEC : 0 ) | \
         VM_READ | VM_WRITE | VM_MAYREAD | VM_MAYWRITE | VM_MAYEXEC)
 
 #define __HAVE_ARCH_GATE_AREA 1        
 
+#include <asm-generic/memory_model.h>
+#include <asm-generic/page.h>
+
 #ifndef __ASSEMBLY__
 extern int devmem_is_allowed(unsigned long pagenr);
 #endif
 
 #endif /* __KERNEL__ */
 
-#include <asm-generic/memory_model.h>
-#include <asm-generic/page.h>
-
 #endif /* _X86_64_PAGE_H */
index 8d29464..3c8287c 100644 (file)
@@ -2,7 +2,6 @@
 #define _ASMx86_64_PARAM_H
 
 #ifdef __KERNEL__
-# include <linux/config.h>
 # define HZ            CONFIG_HZ       /* Internal kernel timer frequency */
 # define USER_HZ       100             /* .. some user interfaces are in "ticks */
 # define CLOCKS_PER_SEC                (USER_HZ)       /* like times() */
index 8f4d95f..8ec15d9 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __x8664_PCI_H
 #define __x8664_PCI_H
 
-#include <linux/config.h>
 #include <asm/io.h>
 
 #ifdef __KERNEL__
@@ -40,8 +39,8 @@ int pcibios_set_irq_routing(struct pci_dev *dev, int pin, int irq);
 #include <asm/scatterlist.h>
 #include <linux/string.h>
 #include <asm/page.h>
-#include <linux/dma-mapping.h> /* for have_iommu */
 
+extern void pci_iommu_alloc(void);
 extern int iommu_setup(char *opt);
 
 /* The PCI address space does equal the physical memory
@@ -53,7 +52,7 @@ extern int iommu_setup(char *opt);
  */
 #define PCI_DMA_BUS_IS_PHYS (dma_ops->is_phys)
 
-#ifdef CONFIG_GART_IOMMU
+#if defined(CONFIG_IOMMU) || defined(CONFIG_CALGARY_IOMMU)
 
 /*
  * x86-64 always supports DAC, but sometimes it is useful to force
index e97b532..e0126be 100644 (file)
@@ -7,6 +7,8 @@
 #include <linux/mm.h>
 #include <asm/io.h>            /* for phys_to_virt and page_to_pseudophys */
 
+#include <xen/features.h>
+
 #define arch_add_exec_range(mm, limit) \
                do { (void)(mm), (void)(limit); } while (0)
 #define arch_flush_exec_range(mm) \
@@ -14,7 +16,6 @@
 #define arch_remove_exec_range(mm, limit) \
                do { (void)(mm), (void)(limit); } while (0)
 
-#include <xen/features.h>
 void make_page_readonly(void *va, unsigned int feature);
 void make_page_writable(void *va, unsigned int feature);
 void make_pages_readonly(void *va, unsigned int nr, unsigned int feature);
index cd756bf..51323d9 100644 (file)
@@ -44,7 +44,7 @@ extern unsigned long __supported_pte_mask;
 
 #define swapper_pg_dir init_level4_pgt
 
-extern void nonx_setup(const char *str);
+extern void nonx_setup(char *str);
 extern void paging_init(void);
 extern void clear_kernel_mapping(unsigned long addr, unsigned long size);
 
@@ -206,7 +206,7 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
 #define _PAGE_NX        (1UL<<_PAGE_BIT_NX)
 
 #define _PAGE_TABLE    (_PAGE_PRESENT | _PAGE_RW | _PAGE_USER | _PAGE_ACCESSED | _PAGE_DIRTY)
-#define _KERNPG_TABLE  _PAGE_TABLE
+#define _KERNPG_TABLE  (_PAGE_PRESENT | _PAGE_RW | _PAGE_ACCESSED | _PAGE_DIRTY)
 
 #define _PAGE_CHG_MASK (PTE_MASK | _PAGE_ACCESSED | _PAGE_DIRTY)
 
@@ -219,22 +219,21 @@ static inline pte_t ptep_get_and_clear_full(struct mm_struct *mm, unsigned long
 #define PAGE_READONLY  __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_NX)
 #define PAGE_READONLY_EXEC __pgprot(_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
 #define __PAGE_KERNEL \
-       (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX | _PAGE_USER )
+       (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX)
 #define __PAGE_KERNEL_EXEC \
-       (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_USER )
+       (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_ACCESSED)
 #define __PAGE_KERNEL_NOCACHE \
-       (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED | _PAGE_NX | _PAGE_USER )
+       (_PAGE_PRESENT | _PAGE_RW | _PAGE_DIRTY | _PAGE_PCD | _PAGE_ACCESSED | _PAGE_NX)
 #define __PAGE_KERNEL_RO \
-       (_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX | _PAGE_USER )
+       (_PAGE_PRESENT | _PAGE_DIRTY | _PAGE_ACCESSED | _PAGE_NX)
 #define __PAGE_KERNEL_VSYSCALL \
-       (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_USER )
+       (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED)
 #define __PAGE_KERNEL_VSYSCALL_NOCACHE \
-       (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD | _PAGE_USER )
+       (_PAGE_PRESENT | _PAGE_USER | _PAGE_ACCESSED | _PAGE_PCD)
 #define __PAGE_KERNEL_LARGE \
-       (__PAGE_KERNEL | _PAGE_PSE | _PAGE_USER )
+       (__PAGE_KERNEL | _PAGE_PSE)
 #define __PAGE_KERNEL_LARGE_EXEC \
-       (__PAGE_KERNEL_EXEC | _PAGE_PSE | _PAGE_USER )
-
+       (__PAGE_KERNEL_EXEC | _PAGE_PSE)
 
 /*
  * We don't support GLOBAL page in xenolinux64
@@ -312,7 +311,6 @@ static inline pte_t pfn_pte(unsigned long page_nr, pgprot_t pgprot)
        return pte;
 }
 
-#define pfn_pte_ma(pfn, prot)  __pte_ma((((pfn) << PAGE_SHIFT) | pgprot_val(prot)) & __supported_pte_mask)
 /*
  * The following only work if pte_present() is true.
  * Undefined behaviour if not..
@@ -398,10 +396,6 @@ static inline int pmd_large(pmd_t pte) {
 /* to find an entry in a page-table-directory. */
 #define pud_index(address) (((address) >> PUD_SHIFT) & (PTRS_PER_PUD-1))
 #define pud_offset(pgd, address) ((pud_t *) pgd_page(*(pgd)) + pud_index(address))
-static inline pud_t *__pud_offset_k(pud_t *pud, unsigned long address)
-{ 
-       return pud + pud_index(address);
-} 
 
 /* Find correct pud via the hidden fourth level page level: */
 
@@ -424,7 +418,7 @@ static inline pud_t *pud_offset_k(pgd_t *pgd, unsigned long address)
    can temporarily clear it. */
 #define pmd_present(x) (pmd_val(x))
 #define pmd_clear(xp)  do { set_pmd(xp, __pmd(0)); } while (0)
-#define        pmd_bad(x)      ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_PRESENT)) != (_KERNPG_TABLE & ~_PAGE_PRESENT))
+#define        pmd_bad(x)      ((pmd_val(x) & (~PAGE_MASK & ~_PAGE_USER & ~_PAGE_PRESENT)) != (_KERNPG_TABLE & ~_PAGE_PRESENT))
 #define pfn_pmd(nr,prot) (__pmd(((nr) << PAGE_SHIFT) | pgprot_val(prot)))
 #define pmd_pfn(x)  ((pmd_val(x) & __PHYSICAL_MASK) >> PAGE_SHIFT)
 
index 35ce5e6..be43d34 100644 (file)
@@ -12,7 +12,6 @@
 #include <asm/types.h>
 #include <asm/sigcontext.h>
 #include <asm/cpufeature.h>
-#include <linux/config.h>
 #include <linux/threads.h>
 #include <asm/msr.h>
 #include <asm/current.h>
@@ -70,7 +69,11 @@ struct cpuinfo_x86 {
        cpumask_t llc_shared_map;       /* cpus sharing the last level cache */
 #endif
        __u8    apicid;
+#ifdef CONFIG_SMP
        __u8    booted_cores;   /* number of cores as seen by OS */
+       __u8    phys_proc_id;   /* Physical Processor id. */
+       __u8    cpu_core_id;    /* Core id. */
+#endif
 } ____cacheline_aligned;
 
 #define X86_VENDOR_INTEL 0
@@ -97,6 +100,7 @@ extern char ignore_irq13;
 extern void identify_cpu(struct cpuinfo_x86 *);
 extern void print_cpu_info(struct cpuinfo_x86 *);
 extern unsigned int init_intel_cacheinfo(struct cpuinfo_x86 *c);
+extern unsigned short num_cache_leaves;
 
 /*
  * EFLAGS bits
@@ -174,8 +178,6 @@ static inline void clear_in_cr4 (unsigned long mask)
  */
 #define TASK_SIZE64    (0x800000000000UL - 4096)
 
-#define __HAVE_ARCH_ALIGN_STACK
-
 /* This decides where the kernel will search for a free chunk of vm
  * space during mmap's.
  */
@@ -240,9 +242,14 @@ struct tss_struct {
 } __attribute__((packed)) ____cacheline_aligned;
 
 DECLARE_PER_CPU(struct tss_struct,init_tss);
+/* Save the original ist values for checking stack pointers during debugging */
 #endif
 
 extern struct cpuinfo_x86 boot_cpu_data;
+struct orig_ist {
+       unsigned long ist[7];
+};
+DECLARE_PER_CPU(struct orig_ist, orig_ist);
 
 #ifdef CONFIG_X86_VSMP
 #define ARCH_MIN_TASKALIGN     (1 << INTERNODE_CACHE_SHIFT)
index d02c9fb..33b0fbe 100644 (file)
@@ -5,7 +5,6 @@
  * We need the APIC definitions automatically as part of 'smp.h'
  */
 #ifndef __ASSEMBLY__
-#include <linux/config.h>
 #include <linux/threads.h>
 #include <linux/cpumask.h>
 #include <linux/bitops.h>
@@ -53,8 +52,6 @@ extern int smp_call_function_single(int cpuid, void (*func) (void *info),
 
 extern cpumask_t cpu_sibling_map[NR_CPUS];
 extern cpumask_t cpu_core_map[NR_CPUS];
-extern int phys_proc_id[NR_CPUS];
-extern int cpu_core_id[NR_CPUS];
 extern u8 cpu_llc_id[NR_CPUS];
 
 #define SMP_TRAMPOLINE_BASE 0x6000
index 2088f61..7d8b882 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __ASM_SYSTEM_H
 #define __ASM_SYSTEM_H
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <asm/segment.h>
 #include <asm/synch_bitops.h>
 #define __vcpu_id 0
 #endif
 
-#ifdef CONFIG_SMP
-#define LOCK_PREFIX "lock ; "
-#else
-#define LOCK_PREFIX ""
-#endif
-
 #define __STR(x) #x
 #define STR(x) __STR(x)
 
@@ -44,7 +37,7 @@
                     "thread_return:\n\t"                                           \
                     "movq %%gs:%P[pda_pcurrent],%%rsi\n\t"                       \
                     "movq %P[thread_info](%%rsi),%%r8\n\t"                       \
-                    LOCK "btr  %[tif_fork],%P[ti_flags](%%r8)\n\t"               \
+                    LOCK_PREFIX "btr  %[tif_fork],%P[ti_flags](%%r8)\n\t"        \
                     "movq %%rax,%%rdi\n\t"                                       \
                     "jc   ret_from_fork\n\t"                                     \
                     RESTORE_CONTEXT                                                \
@@ -80,82 +73,6 @@ extern void load_gs_index(unsigned);
                ".previous"                     \
                : :"r" (value), "r" (0))
 
-#ifdef __KERNEL__
-struct alt_instr { 
-       __u8 *instr;            /* original instruction */
-       __u8 *replacement;
-       __u8  cpuid;            /* cpuid bit set for replacement */
-       __u8  instrlen;         /* length of original instruction */
-       __u8  replacementlen;   /* length of new instruction, <= instrlen */ 
-       __u8  pad[5];
-}; 
-#endif
-
-/*
- * Alternative instructions for different CPU types or capabilities.
- * 
- * This allows to use optimized instructions even on generic binary
- * kernels.
- * 
- * length of oldinstr must be longer or equal the length of newinstr
- * It can be padded with nops as needed.
- * 
- * For non barrier like inlines please define new variants
- * without volatile and memory clobber.
- */
-#define alternative(oldinstr, newinstr, feature)       \
-       asm volatile ("661:\n\t" oldinstr "\n662:\n"                 \
-                     ".section .altinstructions,\"a\"\n"            \
-                     "  .align 8\n"                                   \
-                     "  .quad 661b\n"            /* label */          \
-                     "  .quad 663f\n"            /* new instruction */ \
-                     "  .byte %c0\n"             /* feature bit */    \
-                     "  .byte 662b-661b\n"       /* sourcelen */      \
-                     "  .byte 664f-663f\n"       /* replacementlen */ \
-                     ".previous\n"                                     \
-                     ".section .altinstr_replacement,\"ax\"\n"         \
-                     "663:\n\t" newinstr "\n664:\n"   /* replacement */ \
-                     ".previous" :: "i" (feature) : "memory")  
-
-/*
- * Alternative inline assembly with input.
- * 
- * Peculiarities:
- * No memory clobber here. 
- * Argument numbers start with 1.
- * Best is to use constraints that are fixed size (like (%1) ... "r")
- * If you use variable sized constraints like "m" or "g" in the 
- * replacement make sure to pad to the worst case length.
- */
-#define alternative_input(oldinstr, newinstr, feature, input...)       \
-       asm volatile ("661:\n\t" oldinstr "\n662:\n"                    \
-                     ".section .altinstructions,\"a\"\n"               \
-                     "  .align 8\n"                                    \
-                     "  .quad 661b\n"            /* label */           \
-                     "  .quad 663f\n"            /* new instruction */ \
-                     "  .byte %c0\n"             /* feature bit */     \
-                     "  .byte 662b-661b\n"       /* sourcelen */       \
-                     "  .byte 664f-663f\n"       /* replacementlen */  \
-                     ".previous\n"                                     \
-                     ".section .altinstr_replacement,\"ax\"\n"         \
-                     "663:\n\t" newinstr "\n664:\n"   /* replacement */ \
-                     ".previous" :: "i" (feature), ##input)
-
-/* Like alternative_input, but with a single output argument */
-#define alternative_io(oldinstr, newinstr, feature, output, input...) \
-       asm volatile ("661:\n\t" oldinstr "\n662:\n"                    \
-                     ".section .altinstructions,\"a\"\n"               \
-                     "  .align 8\n"                                    \
-                     "  .quad 661b\n"            /* label */           \
-                     "  .quad 663f\n"            /* new instruction */ \
-                     "  .byte %c[feat]\n"        /* feature bit */     \
-                     "  .byte 662b-661b\n"       /* sourcelen */       \
-                     "  .byte 664f-663f\n"       /* replacementlen */  \
-                     ".previous\n"                                     \
-                     ".section .altinstr_replacement,\"ax\"\n"         \
-                     "663:\n\t" newinstr "\n664:\n"   /* replacement */ \
-                     ".previous" : output : [feat] "i" (feature), ##input)
-
 /*
  * Clear and set 'TS' bit respectively
  */
@@ -331,98 +248,17 @@ static inline unsigned long __cmpxchg(volatile void *ptr, unsigned long old,
 #endif
 #define read_barrier_depends() do {} while(0)
 #define set_mb(var, value) do { (void) xchg(&var, value); } while (0)
-#define set_wmb(var, value) do { var = value; wmb(); } while (0)
 
 #define warn_if_not_ulong(x) do { unsigned long foo; (void) (&(x) == &foo); } while (0)
 
-
-/* 
- * The use of 'barrier' in the following reflects their use as local-lock
- * operations. Reentrancy must be prevented (e.g., __cli()) /before/ following
- * critical operations are executed. All critical operations must complete
- * /before/ reentrancy is permitted (e.g., __sti()). Alpha architecture also
- * includes these barriers, for example.
- */
-
-#define __cli()                                                                \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       _vcpu->evtchn_upcall_mask = 1;                                  \
-       preempt_enable_no_resched();                                    \
-       barrier();                                                      \
-} while (0)
-
-#define __sti()                                                                \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       barrier();                                                      \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       _vcpu->evtchn_upcall_mask = 0;                                  \
-       barrier(); /* unmask then check (avoid races) */                \
-       if ( unlikely(_vcpu->evtchn_upcall_pending) )                   \
-               force_evtchn_callback();                                \
-       preempt_enable();                                               \
-} while (0)
-
-#define __save_flags(x)                                                        \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       (x) = _vcpu->evtchn_upcall_mask;                                \
-       preempt_enable();                                               \
-} while (0)
-
-#define __restore_flags(x)                                             \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       barrier();                                                      \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       if ((_vcpu->evtchn_upcall_mask = (x)) == 0) {                   \
-               barrier(); /* unmask then check (avoid races) */        \
-               if ( unlikely(_vcpu->evtchn_upcall_pending) )           \
-                       force_evtchn_callback();                        \
-               preempt_enable();                                       \
-       } else                                                          \
-               preempt_enable_no_resched();                            \
-} while (0)
-
-#define __save_and_cli(x)                                              \
-do {                                                                   \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       (x) = _vcpu->evtchn_upcall_mask;                                \
-       _vcpu->evtchn_upcall_mask = 1;                                  \
-       preempt_enable_no_resched();                                    \
-       barrier();                                                      \
-} while (0)
-
-#define local_irq_save(x)      __save_and_cli(x)
-#define local_irq_restore(x)   __restore_flags(x)
-#define local_save_flags(x)    __save_flags(x)
-#define local_irq_disable()    __cli()
-#define local_irq_enable()     __sti()
-
-/* Cannot use preempt_enable() here as we would recurse in preempt_sched(). */
-#define irqs_disabled()                                                        \
-({     int ___x;                                                       \
-       vcpu_info_t *_vcpu;                                             \
-       preempt_disable();                                              \
-       _vcpu = &HYPERVISOR_shared_info->vcpu_info[__vcpu_id];          \
-       ___x = (_vcpu->evtchn_upcall_mask != 0);                        \
-       preempt_enable_no_resched();                                    \
-       ___x; })
-
 void safe_halt(void);
 void halt(void);
 
+#include <linux/irqflags.h>
+
 void cpu_idle_wait(void);
 
 extern unsigned long arch_align_stack(unsigned long sp);
+extern void free_init_pages(char *what, unsigned long begin, unsigned long end);
 
 #endif
index 0fc67b4..3a81774 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef _X8664_TLBFLUSH_H
 #define _X8664_TLBFLUSH_H
 
-#include <linux/config.h>
 #include <linux/mm.h>
 #include <asm/processor.h>
 
index 14b8209..ffec7fa 100644 (file)
@@ -12,7 +12,7 @@
  *     access the videoram directly without any black magic.
  */
 
-#define VGA_MAP_MEM(x) (unsigned long)isa_bus_to_virt(x)
+#define VGA_MAP_MEM(x,s) (unsigned long)isa_bus_to_virt(x)
 
 #define vga_readb(x) (*(x))
 #define vga_writeb(x,y) (*(y) = (x))
index bb9e543..75e91f5 100644 (file)
@@ -19,20 +19,25 @@ struct fb_info;
 struct backlight_properties {
        /* Owner module */
        struct module *owner;
-       /* Get the backlight power status (0: full on, 1..3: power saving
-          modes; 4: full off), see FB_BLANK_XXX */
-       int (*get_power)(struct backlight_device *);
-       /* Enable or disable power to the LCD (0: on; 4: off, see FB_BLANK_XXX) */
-       int (*set_power)(struct backlight_device *, int power);
-       /* Maximal value for brightness (read-only) */
-       int max_brightness;
-       /* Get current backlight brightness */
+
+       /* Notify the backlight driver some property has changed */
+       int (*update_status)(struct backlight_device *);
+       /* Return the current backlight brightness (accounting for power,
+          fb_blank etc.) */
        int (*get_brightness)(struct backlight_device *);
-       /* Set backlight brightness (0..max_brightness) */
-       int (*set_brightness)(struct backlight_device *, int brightness);
        /* Check if given framebuffer device is the one bound to this backlight;
           return 0 if not, !=0 if it is. If NULL, backlight always matches the fb. */
        int (*check_fb)(struct fb_info *);
+
+       /* Current User requested brightness (0 - max_brightness) */
+       int brightness;
+       /* Maximal value for brightness (read-only) */
+       int max_brightness;
+       /* Current FB Power mode (0: full on, 1..3: power saving
+          modes; 4: full off), see FB_BLANK_XXX */
+       int power;
+       /* FB Blanking active? (values as for power) */
+       int fb_blank;
 };
 
 struct backlight_device {
index 3438233..9354722 100644 (file)
@@ -4,7 +4,7 @@
  *  cpuset interface
  *
  *  Copyright (C) 2003 BULL SA
- *  Copyright (C) 2004 Silicon Graphics, Inc.
+ *  Copyright (C) 2004-2006 Silicon Graphics, Inc.
  *
  */
 
 
 #ifdef CONFIG_CPUSETS
 
+extern int number_of_cpusets;  /* How many cpusets are defined in system? */
+
+extern int cpuset_init_early(void);
 extern int cpuset_init(void);
 extern void cpuset_init_smp(void);
 extern void cpuset_fork(struct task_struct *p);
 extern void cpuset_exit(struct task_struct *p);
-extern cpumask_t cpuset_cpus_allowed(const struct task_struct *p);
+extern cpumask_t cpuset_cpus_allowed(struct task_struct *p);
+extern nodemask_t cpuset_mems_allowed(struct task_struct *p);
 void cpuset_init_current_mems_allowed(void);
-void cpuset_update_current_mems_allowed(void);
-void cpuset_restrict_to_mems_allowed(unsigned long *nodes);
+void cpuset_update_task_memory_state(void);
+#define cpuset_nodes_subset_current_mems_allowed(nodes) \
+               nodes_subset((nodes), current->mems_allowed)
 int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl);
-int cpuset_zone_allowed(struct zone *z);
+
+extern int __cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask);
+static int inline cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
+{
+       return number_of_cpusets <= 1 || __cpuset_zone_allowed(z, gfp_mask);
+}
+
+extern int cpuset_excl_nodes_overlap(const struct task_struct *p);
+
+#define cpuset_memory_pressure_bump()                          \
+       do {                                                    \
+               if (cpuset_memory_pressure_enabled)             \
+                       __cpuset_memory_pressure_bump();        \
+       } while (0)
+extern int cpuset_memory_pressure_enabled;
+extern void __cpuset_memory_pressure_bump(void);
+
 extern struct file_operations proc_cpuset_operations;
 extern char *cpuset_task_status_allowed(struct task_struct *task, char *buffer);
 
+extern void cpuset_lock(void);
+extern void cpuset_unlock(void);
+
+extern int cpuset_mem_spread_node(void);
+
+static inline int cpuset_do_page_mem_spread(void)
+{
+       return current->flags & PF_SPREAD_PAGE;
+}
+
+static inline int cpuset_do_slab_mem_spread(void)
+{
+       return current->flags & PF_SPREAD_SLAB;
+}
+
 #else /* !CONFIG_CPUSETS */
 
+static inline int cpuset_init_early(void) { return 0; }
 static inline int cpuset_init(void) { return 0; }
 static inline void cpuset_init_smp(void) {}
 static inline void cpuset_fork(struct task_struct *p) {}
@@ -39,26 +76,56 @@ static inline cpumask_t cpuset_cpus_allowed(struct task_struct *p)
        return cpu_possible_map;
 }
 
+static inline nodemask_t cpuset_mems_allowed(struct task_struct *p)
+{
+       return node_possible_map;
+}
+
 static inline void cpuset_init_current_mems_allowed(void) {}
-static inline void cpuset_update_current_mems_allowed(void) {}
-static inline void cpuset_restrict_to_mems_allowed(unsigned long *nodes) {}
+static inline void cpuset_update_task_memory_state(void) {}
+#define cpuset_nodes_subset_current_mems_allowed(nodes) (1)
 
 static inline int cpuset_zonelist_valid_mems_allowed(struct zonelist *zl)
 {
        return 1;
 }
 
-static inline int cpuset_zone_allowed(struct zone *z)
+static inline int cpuset_zone_allowed(struct zone *z, gfp_t gfp_mask)
+{
+       return 1;
+}
+
+static inline int cpuset_excl_nodes_overlap(const struct task_struct *p)
 {
        return 1;
 }
 
+static inline void cpuset_memory_pressure_bump(void) {}
+
 static inline char *cpuset_task_status_allowed(struct task_struct *task,
                                                        char *buffer)
 {
        return buffer;
 }
 
+static inline void cpuset_lock(void) {}
+static inline void cpuset_unlock(void) {}
+
+static inline int cpuset_mem_spread_node(void)
+{
+       return 0;
+}
+
+static inline int cpuset_do_page_mem_spread(void)
+{
+       return 0;
+}
+
+static inline int cpuset_do_slab_mem_spread(void)
+{
+       return 0;
+}
+
 #endif /* !CONFIG_CPUSETS */
 
 #endif /* _LINUX_CPUSET_H */
index a5fa6a6..047567d 100644 (file)
 
 struct file_operations;
 
+struct debugfs_blob_wrapper {
+       void *data;
+       unsigned long size;
+};
+
 #if defined(CONFIG_DEBUG_FS)
 struct dentry *debugfs_create_file(const char *name, mode_t mode,
                                   struct dentry *parent, void *data,
-                                  struct file_operations *fops);
+                                  const struct file_operations *fops);
 
 struct dentry *debugfs_create_dir(const char *name, struct dentry *parent);
 
@@ -39,6 +44,9 @@ struct dentry *debugfs_create_u32(const char *name, mode_t mode,
 struct dentry *debugfs_create_bool(const char *name, mode_t mode,
                                  struct dentry *parent, u32 *value);
 
+struct dentry *debugfs_create_blob(const char *name, mode_t mode,
+                                 struct dentry *parent,
+                                 struct debugfs_blob_wrapper *blob);
 #else
 
 #include <linux/err.h>
@@ -50,9 +58,8 @@ struct dentry *debugfs_create_bool(const char *name, mode_t mode,
  */
 
 static inline struct dentry *debugfs_create_file(const char *name, mode_t mode,
-                                                struct dentry *parent,
-                                                void *data,
-                                                struct file_operations *fops)
+                                       struct dentry *parent, void *data,
+                                       const struct file_operations *fops)
 {
        return ERR_PTR(-ENODEV);
 }
@@ -94,6 +101,13 @@ static inline struct dentry *debugfs_create_bool(const char *name, mode_t mode,
        return ERR_PTR(-ENODEV);
 }
 
+static inline struct dentry *debugfs_create_blob(const char *name, mode_t mode,
+                                 struct dentry *parent,
+                                 struct debugfs_blob_wrapper *blob)
+{
+       return ERR_PTR(-ENODEV);
+}
+
 #endif
 
 #endif
index faaff4c..16fbe59 100644 (file)
@@ -4,7 +4,7 @@
  * Definitions for any platform device related flags or structures for
  * Freescale processor devices
  *
- * Maintainer: Kumar Gala (kumar.gala@freescale.com)
+ * Maintainer: Kumar Gala <galak@kernel.crashing.org>
  *
  * Copyright 2004 Freescale Semiconductor, Inc
  *
 struct gianfar_platform_data {
        /* device specific information */
        u32 device_flags;
-       u32 phy_reg_addr;
 
        /* board specific information */
        u32 board_flags;
-       u32 phyid;
-       u32 interruptPHY;
+       u32 bus_id;
+       u32 phy_id;
        u8 mac_addr[6];
 };
 
+struct gianfar_mdio_data {
+       /* board specific information */
+       int irq[32];
+};
+
 /* Flags related to gianfar device features */
 #define FSL_GIANFAR_DEV_HAS_GIGABIT            0x00000001
 #define FSL_GIANFAR_DEV_HAS_COALESCE           0x00000002
 #define FSL_GIANFAR_DEV_HAS_RMON               0x00000004
 #define FSL_GIANFAR_DEV_HAS_MULTI_INTR         0x00000008
+#define FSL_GIANFAR_DEV_HAS_CSUM               0x00000010
+#define FSL_GIANFAR_DEV_HAS_VLAN               0x00000020
+#define FSL_GIANFAR_DEV_HAS_EXTENDED_HASH      0x00000040
+#define FSL_GIANFAR_DEV_HAS_PADDING            0x00000080
 
 /* Flags in gianfar_platform_data */
-#define FSL_GIANFAR_BRD_HAS_PHY_INTR   0x00000001      /* if not set use a timer */
+#define FSL_GIANFAR_BRD_HAS_PHY_INTR   0x00000001 /* set or use a timer */
+#define FSL_GIANFAR_BRD_IS_REDUCED     0x00000002 /* Set if RGMII, RMII */
 
 struct fsl_i2c_platform_data {
        /* device specific information */
@@ -74,5 +83,43 @@ struct fsl_i2c_platform_data {
 #define FSL_I2C_DEV_SEPARATE_DFSRR     0x00000001
 #define FSL_I2C_DEV_CLOCK_5200         0x00000002
 
+
+enum fsl_usb2_operating_modes {
+       FSL_USB2_MPH_HOST,
+       FSL_USB2_DR_HOST,
+       FSL_USB2_DR_DEVICE,
+       FSL_USB2_DR_OTG,
+};
+
+enum fsl_usb2_phy_modes {
+       FSL_USB2_PHY_NONE,
+       FSL_USB2_PHY_ULPI,
+       FSL_USB2_PHY_UTMI,
+       FSL_USB2_PHY_UTMI_WIDE,
+       FSL_USB2_PHY_SERIAL,
+};
+
+struct fsl_usb2_platform_data {
+       /* board specific information */
+       enum fsl_usb2_operating_modes operating_mode;
+       enum fsl_usb2_phy_modes phy_mode;
+       unsigned int port_enables;
+};
+
+/* Flags in fsl_usb2_mph_platform_data */
+#define FSL_USB2_PORT0_ENABLED 0x00000001
+#define FSL_USB2_PORT1_ENABLED 0x00000002
+
+struct fsl_spi_platform_data {
+       u32     initial_spmode; /* initial SPMODE value */
+       u16     bus_num;
+
+       /* board specific information */
+       u16     max_chipselect;
+       void    (*activate_cs)(u8 cs, u8 polarity);
+       void    (*deactivate_cs)(u8 cs, u8 polarity);
+       u32     sysclk;
+};
+
 #endif                         /* _FSL_DEVICE_H_ */
 #endif                         /* __KERNEL__ */
index 2723819..707f7cb 100644 (file)
@@ -3,6 +3,8 @@
 
 #include <linux/compiler.h>
 
+#ifdef __KERNEL__
+
 /*
  * Offsets into HPET Registers
  */
@@ -85,22 +87,6 @@ struct hpet {
 #define        Tn_FSB_INT_ADDR_SHIFT           (32UL)
 #define        Tn_FSB_INT_VAL_MASK             (0x00000000ffffffffULL)
 
-struct hpet_info {
-       unsigned long hi_ireqfreq;      /* Hz */
-       unsigned long hi_flags; /* information */
-       unsigned short hi_hpet;
-       unsigned short hi_timer;
-};
-
-#define        HPET_INFO_PERIODIC      0x0001  /* timer is periodic */
-
-#define        HPET_IE_ON      _IO('h', 0x01)  /* interrupt on */
-#define        HPET_IE_OFF     _IO('h', 0x02)  /* interrupt off */
-#define        HPET_INFO       _IOR('h', 0x03, struct hpet_info)
-#define        HPET_EPI        _IO('h', 0x04)  /* enable periodic */
-#define        HPET_DPI        _IO('h', 0x05)  /* disable periodic */
-#define        HPET_IRQFREQ    _IOW('h', 0x6, unsigned long)   /* IRQFREQ usec */
-
 /*
  * exported interfaces
  */
@@ -133,4 +119,22 @@ int hpet_register(struct hpet_task *, int);
 int hpet_unregister(struct hpet_task *);
 int hpet_control(struct hpet_task *, unsigned int, unsigned long);
 
+#endif /* __KERNEL__ */
+
+struct hpet_info {
+       unsigned long hi_ireqfreq;      /* Hz */
+       unsigned long hi_flags; /* information */
+       unsigned short hi_hpet;
+       unsigned short hi_timer;
+};
+
+#define        HPET_INFO_PERIODIC      0x0001  /* timer is periodic */
+
+#define        HPET_IE_ON      _IO('h', 0x01)  /* interrupt on */
+#define        HPET_IE_OFF     _IO('h', 0x02)  /* interrupt off */
+#define        HPET_INFO       _IOR('h', 0x03, struct hpet_info)
+#define        HPET_EPI        _IO('h', 0x04)  /* enable periodic */
+#define        HPET_DPI        _IO('h', 0x05)  /* disable periodic */
+#define        HPET_IRQFREQ    _IOW('h', 0x6, unsigned long)   /* IRQFREQ usec */
+
 #endif                         /* !__HPET__ */
index 923bdbc..08a450a 100644 (file)
@@ -28,7 +28,7 @@ struct ps2dev {
        struct serio *serio;
 
        /* Ensures that only one command is executing at a time */
-       struct semaphore cmd_sem;
+       struct mutex cmd_mutex;
 
        /* Used to signal completion from interrupt handler */
        wait_queue_head_t wait;
@@ -41,6 +41,7 @@ struct ps2dev {
 
 void ps2_init(struct ps2dev *ps2dev, struct serio *serio);
 int ps2_sendbyte(struct ps2dev *ps2dev, unsigned char byte, int timeout);
+void ps2_drain(struct ps2dev *ps2dev, int maxbytes, int timeout);
 int ps2_command(struct ps2dev *ps2dev, unsigned char *param, int command);
 int ps2_schedule_command(struct ps2dev *ps2dev, unsigned char *param, int command);
 int ps2_handle_ack(struct ps2dev *ps2dev, unsigned char data);
index 857126a..936ef82 100644 (file)
                                OSC_PCI_EXPRESS_CAP_STRUCTURE_CONTROL)
 
 #ifdef CONFIG_ACPI
-extern acpi_status pci_osc_control_set(u32 flags);
+extern acpi_status pci_osc_control_set(acpi_handle handle, u32 flags);
 extern acpi_status pci_osc_support_set(u32 flags);
 #else
-#if !defined(acpi_status)
+#if !defined(AE_ERROR)
 typedef u32            acpi_status;
 #define AE_ERROR       (acpi_status) (0x0001)
 #endif    
-static inline acpi_status pci_osc_control_set(u32 flags) {return AE_ERROR;}
+static inline acpi_status pci_osc_control_set(acpi_handle handle, u32 flags)
+{return AE_ERROR;}
 static inline acpi_status pci_osc_support_set(u32 flags) {return AE_ERROR;} 
 #endif
 
index 2aef9c3..806ec5b 100644 (file)
@@ -1,33 +1,32 @@
 #include <linux/init.h>
 #include <linux/posix_acl.h>
-#include <linux/xattr_acl.h>
 
 #define REISERFS_ACL_VERSION   0x0001
 
 typedef struct {
-       __le16          e_tag;
-       __le16          e_perm;
-       __le32          e_id;
+       __le16 e_tag;
+       __le16 e_perm;
+       __le32 e_id;
 } reiserfs_acl_entry;
 
 typedef struct {
-       __le16          e_tag;
-       __le16          e_perm;
+       __le16 e_tag;
+       __le16 e_perm;
 } reiserfs_acl_entry_short;
 
 typedef struct {
-       __le32          a_version;
+       __le32 a_version;
 } reiserfs_acl_header;
 
 static inline size_t reiserfs_acl_size(int count)
 {
        if (count <= 4) {
                return sizeof(reiserfs_acl_header) +
-                      count * sizeof(reiserfs_acl_entry_short);
+                   count * sizeof(reiserfs_acl_entry_short);
        } else {
                return sizeof(reiserfs_acl_header) +
-                      4 * sizeof(reiserfs_acl_entry_short) +
-                      (count - 4) * sizeof(reiserfs_acl_entry);
+                   4 * sizeof(reiserfs_acl_entry_short) +
+                   (count - 4) * sizeof(reiserfs_acl_entry);
        }
 }
 
@@ -47,43 +46,45 @@ static inline int reiserfs_acl_count(size_t size)
        }
 }
 
-
 #ifdef CONFIG_REISERFS_FS_POSIX_ACL
-struct posix_acl * reiserfs_get_acl(struct inode *inode, int type);
-int reiserfs_acl_chmod (struct inode *inode);
-int reiserfs_inherit_default_acl (struct inode *dir, struct dentry *dentry, struct inode *inode);
-int reiserfs_cache_default_acl (struct inode *dir);
-extern int reiserfs_xattr_posix_acl_init (void) __init;
-extern int reiserfs_xattr_posix_acl_exit (void);
+struct posix_acl *reiserfs_get_acl(struct inode *inode, int type);
+int reiserfs_acl_chmod(struct inode *inode);
+int reiserfs_inherit_default_acl(struct inode *dir, struct dentry *dentry,
+                                struct inode *inode);
+int reiserfs_cache_default_acl(struct inode *dir);
+extern int reiserfs_xattr_posix_acl_init(void) __init;
+extern int reiserfs_xattr_posix_acl_exit(void);
 extern struct reiserfs_xattr_handler posix_acl_default_handler;
 extern struct reiserfs_xattr_handler posix_acl_access_handler;
 #else
 
-#define reiserfs_get_acl NULL
 #define reiserfs_cache_default_acl(inode) 0
 
-static inline int
-reiserfs_xattr_posix_acl_init (void)
+static inline struct posix_acl *reiserfs_get_acl(struct inode *inode, int type)
 {
-    return 0;
+       return NULL;
 }
 
-static inline int
-reiserfs_xattr_posix_acl_exit (void)
+static inline int reiserfs_xattr_posix_acl_init(void)
 {
-    return 0;
+       return 0;
 }
 
-static inline int
-reiserfs_acl_chmod (struct inode *inode)
+static inline int reiserfs_xattr_posix_acl_exit(void)
+{
+       return 0;
+}
+
+static inline int reiserfs_acl_chmod(struct inode *inode)
 {
-    return 0;
+       return 0;
 }
 
 static inline int
-reiserfs_inherit_default_acl (const struct inode *dir, struct dentry *dentry, struct inode *inode)
+reiserfs_inherit_default_acl(const struct inode *dir, struct dentry *dentry,
+                            struct inode *inode)
 {
-    return 0;
+       return 0;
 }
 
 #endif
index b91a946..b45488f 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _VX_DLIMIT_CMD_H
 #define _VX_DLIMIT_CMD_H
 
+
 /*  dlimit vserver commands */
 
 #define VCMD_add_dlimit                VC_CMD(DLIMIT, 1, 0)
@@ -29,6 +30,8 @@ struct        vcmd_ctx_dlimit_v0 {
 
 #ifdef CONFIG_COMPAT
 
+#include <asm/compat.h>
+
 struct vcmd_ctx_dlimit_base_v0_x32 {
        compat_uptr_t name_ptr;
        uint32_t flags;
index 2b6afea..2fb3ad1 100644 (file)
@@ -1,6 +1,7 @@
 #ifndef _VX_INODE_CMD_H
 #define _VX_INODE_CMD_H
 
+
 /*  inode vserver commands */
 
 #define VCMD_get_iattr_v0      VC_CMD(INODE, 1, 0)
@@ -27,6 +28,20 @@ struct       vcmd_ctx_iattr_v1 {
 
 #ifdef __KERNEL__
 
+
+#ifdef CONFIG_COMPAT
+
+#include <asm/compat.h>
+
+struct vcmd_ctx_iattr_v1_x32 {
+       compat_uptr_t name_ptr;
+       uint32_t xid;
+       uint32_t flags;
+       uint32_t mask;
+};
+
+#endif /* CONFIG_COMPAT */
+
 #include <linux/compiler.h>
 
 extern int vc_get_iattr_v0(uint32_t, void __user *);
@@ -35,5 +50,12 @@ extern int vc_set_iattr_v0(uint32_t, void __user *);
 extern int vc_get_iattr(uint32_t, void __user *);
 extern int vc_set_iattr(uint32_t, void __user *);
 
+#ifdef CONFIG_COMPAT
+
+extern int vc_get_iattr_x32(uint32_t, void __user *);
+extern int vc_set_iattr_x32(uint32_t, void __user *);
+
+#endif /* CONFIG_COMPAT */
+
 #endif /* __KERNEL__ */
 #endif /* _VX_INODE_CMD_H */
index 7533100..6229cbc 100644 (file)
@@ -1,15 +1,16 @@
 #ifndef _VX_NAMESPACE_CMD_H
 #define _VX_NAMESPACE_CMD_H
 
+
 #define VCMD_enter_namespace   VC_CMD(PROCALT, 1, 0)
-#define VCMD_cleanup_namespace VC_CMD(PROCALT, 2, 0)
-#define VCMD_set_namespace     VC_CMD(PROCALT, 3, 0)
+
+#define VCMD_set_namespace_v0  VC_CMD(PROCALT, 3, 0)
+#define VCMD_set_namespace     VC_CMD(PROCALT, 3, 1)
 
 
 #ifdef __KERNEL__
 
 extern int vc_enter_namespace(uint32_t, void __user *);
-extern int vc_cleanup_namespace(uint32_t, void __user *);
 extern int vc_set_namespace(uint32_t, void __user *);
 
 #endif /* __KERNEL__ */
index 627603e..e9fc1a7 100644 (file)
@@ -1,23 +1,33 @@
+/*
+ */
+
 struct tveeprom {
        u32 has_radio;
+       u32 has_ir;     /* 0: no IR, 1: IR present, 2: unknown */
+       u32 has_MAC_address; /* 0: no MAC, 1: MAC present, 2: unknown */
 
        u32 tuner_type;
        u32 tuner_formats;
+       u32 tuner_hauppauge_model;
+
+       u32 tuner2_type;
+       u32 tuner2_formats;
+       u32 tuner2_hauppauge_model;
 
        u32 digitizer;
        u32 digitizer_formats;
 
        u32 audio_processor;
-       /* a_p_fmts? */
+       u32 decoder_processor;
 
        u32 model;
        u32 revision;
        u32 serial_number;
        char rev_str[5];
+       u8 MAC_address[6];
 };
 
-void tveeprom_hauppauge_analog(struct tveeprom *tvee,
+void tveeprom_hauppauge_analog(struct i2c_client *c, struct tveeprom *tvee,
                               unsigned char *eeprom_data);
 
 int tveeprom_read(struct i2c_client *c, unsigned char *eedata, int len);
-int tveeprom_dump(unsigned char *eedata, int len);
index f3f2c3e..11702aa 100644 (file)
 typedef void (ak4114_write_t)(void *private_data, unsigned char addr, unsigned char data);
 typedef unsigned char (ak4114_read_t)(void *private_data, unsigned char addr);
 
-typedef struct ak4114 ak4114_t;
-
 struct ak4114 {
-       snd_card_t * card;
+       struct snd_card *card;
        ak4114_write_t * write;
        ak4114_read_t * read;
        void * private_data;
@@ -174,9 +172,9 @@ struct ak4114 {
        spinlock_t lock;
        unsigned char regmap[7];
        unsigned char txcsb[5];
-       snd_kcontrol_t *kctls[AK4114_CONTROLS];
-       snd_pcm_substream_t *playback_substream;
-       snd_pcm_substream_t *capture_substream;
+       struct snd_kcontrol *kctls[AK4114_CONTROLS];
+       struct snd_pcm_substream *playback_substream;
+       struct snd_pcm_substream *capture_substream;
        unsigned long parity_errors;
        unsigned long v_bit_errors;
        unsigned long qcrc_errors;
@@ -186,20 +184,20 @@ struct ak4114 {
        struct workqueue_struct *workqueue;
        struct work_struct work;
        void *change_callback_private;
-       void (*change_callback)(ak4114_t *ak4114, unsigned char c0, unsigned char c1);
+       void (*change_callback)(struct ak4114 *ak4114, unsigned char c0, unsigned char c1);
 };
 
-int snd_ak4114_create(snd_card_t *card,
+int snd_ak4114_create(struct snd_card *card,
                      ak4114_read_t *read, ak4114_write_t *write,
                      unsigned char pgm[7], unsigned char txcsb[5],
-                     void *private_data, ak4114_t **r_ak4114);
-void snd_ak4114_reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char mask, unsigned char val);
-void snd_ak4114_reinit(ak4114_t *ak4114);
-int snd_ak4114_build(ak4114_t *ak4114,
-                    snd_pcm_substream_t *playback_substream,
-                     snd_pcm_substream_t *capture_substream);
-int snd_ak4114_external_rate(ak4114_t *ak4114);
-int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags);
+                     void *private_data, struct ak4114 **r_ak4114);
+void snd_ak4114_reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char mask, unsigned char val);
+void snd_ak4114_reinit(struct ak4114 *ak4114);
+int snd_ak4114_build(struct ak4114 *ak4114,
+                    struct snd_pcm_substream *playback_substream,
+                     struct snd_pcm_substream *capture_substream);
+int snd_ak4114_external_rate(struct ak4114 *ak4114);
+int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags);
 
 #endif /* __SOUND_AK4114_H */
 
index 84a5e71..d26c62b 100644 (file)
  * Inform the balloon driver that it should allow some slop for device-driver
  * memory activities.
  */
-extern void
-balloon_update_driver_allowance(
-       long delta);
+void balloon_update_driver_allowance(long delta);
 
-/* Allocate an empty low-memory page range. */
-extern struct page *
-balloon_alloc_empty_page_range(
-       unsigned long nr_pages);
+/* Allocate/free a set of empty pages in low memory (i.e., no RAM mapped). */
+struct page **alloc_empty_pages_and_pagevec(int nr_pages);
+void free_empty_pages_and_pagevec(struct page **pagevec, int nr_pages);
 
-/* Deallocate an empty page range, adding to the balloon. */
-extern void
-balloon_dealloc_empty_page_range(
-       struct page *page, unsigned long nr_pages);
+void balloon_release_driver_page(struct page *page);
 
 /*
  * Prevent the balloon driver from changing the memory reservation during
index fad14d8..10ff259 100644 (file)
@@ -1,7 +1,6 @@
 #ifndef __XEN_CPU_HOTPLUG_H__
 #define __XEN_CPU_HOTPLUG_H__
 
-#include <linux/config.h>
 #include <linux/kernel.h>
 #include <linux/cpumask.h>
 
index 4e70b93..6c986bf 100644 (file)
@@ -2,7 +2,6 @@
 #ifndef __ASM_XEN_DRIVER_UTIL_H__
 #define __ASM_XEN_DRIVER_UTIL_H__
 
-#include <linux/config.h>
 #include <linux/vmalloc.h>
 
 /* Allocate/destroy a 'vmalloc' VM area. */
index 4f111ae..bfe32fe 100644 (file)
@@ -34,7 +34,6 @@
 #ifndef __ASM_EVTCHN_H__
 #define __ASM_EVTCHN_H__
 
-#include <linux/config.h>
 #include <linux/interrupt.h>
 #include <asm/hypervisor.h>
 #include <asm/ptrace.h>
index 676fca5..8df0168 100644 (file)
@@ -37,7 +37,6 @@
 #ifndef __ASM_GNTTAB_H__
 #define __ASM_GNTTAB_H__
 
-#include <linux/config.h>
 #include <asm/hypervisor.h>
 #include <xen/interface/grant_table.h>
 #include <xen/features.h>
index b00b841..d53bc6b 100644 (file)
@@ -9,7 +9,6 @@
 #define _XEN_PUBLIC_ACM_H
 
 #include "xen.h"
-#include "sched_ctl.h"
 
 /* if ACM_DEBUG defined, all hooks should
  * print a short trace message (comment it out
index 7c7a2f9..4a1c3b4 100644 (file)
@@ -9,7 +9,6 @@
 #define __XEN_PUBLIC_ACM_OPS_H__
 
 #include "xen.h"
-#include "sched_ctl.h"
 #include "acm.h"
 
 /*
index 139b945..5172563 100644 (file)
 #ifndef __XEN_PUBLIC_ARCH_PPC_64_H__
 #define __XEN_PUBLIC_ARCH_PPC_64_H__
 
-#if !(defined(__XEN__) || defined(__XEN_TOOLS__))
-/* not sure how this is supposed to get asserted */
-#define __XEN_INTERFACE_VERSION__ 0x00030202
-#endif
-
 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
     typedef struct { \
         int __pad[(sizeof (long long) - sizeof (void *)) / sizeof (int)]; \
index 9eece83..90bc460 100644 (file)
@@ -9,8 +9,32 @@
 #ifndef __XEN_PUBLIC_ARCH_X86_32_H__
 #define __XEN_PUBLIC_ARCH_X86_32_H__
 
+/*
+ * Hypercall interface:
+ *  Input:  %ebx, %ecx, %edx, %esi, %edi (arguments 1-5)
+ *  Output: %eax
+ * Access is via hypercall page (set up by guest loader or via a Xen MSR):
+ *  call hypercall_page + hypercall-number * 32
+ * Clobbered: Argument registers (e.g., 2-arg hypercall clobbers %ebx,%ecx)
+ */
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030203
+/*
+ * Legacy hypercall interface:
+ * As above, except the entry sequence to the hypervisor is:
+ *  mov $hypercall-number*32,%eax ; int $0x82
+ */
+#define TRAP_INSTR "int $0x82"
+#endif
+
+/* Structural guest handles introduced in 0x00030201. */
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
     typedef struct { type *p; } __guest_handle_ ## name
+#else
+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+    typedef type * __guest_handle_ ## name
+#endif
 
 #define DEFINE_XEN_GUEST_HANDLE(name)   __DEFINE_XEN_GUEST_HANDLE(name, name)
 #define XEN_GUEST_HANDLE(name)          __guest_handle_ ## name
@@ -65,9 +89,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define FLAT_USER_DS    FLAT_RING3_DS
 #define FLAT_USER_SS    FLAT_RING3_SS
 
-/* And the trap vector is... */
-#define TRAP_INSTR "int $0x82"
-
 /*
  * Virtual addresses beyond this are not modifiable by guest OSes. The 
  * machine->physical mapping table starts at this address, read-only.
index a92387f..2891cfa 100644 (file)
@@ -9,8 +9,33 @@
 #ifndef __XEN_PUBLIC_ARCH_X86_64_H__
 #define __XEN_PUBLIC_ARCH_X86_64_H__
 
+/*
+ * Hypercall interface:
+ *  Input:  %rdi, %rsi, %rdx, %r10, %r8 (arguments 1-5)
+ *  Output: %rax
+ * Access is via hypercall page (set up by guest loader or via a Xen MSR):
+ *  call hypercall_page + hypercall-number * 32
+ * Clobbered: argument registers (e.g., 2-arg hypercall clobbers %rdi,%rsi)
+ */
+
+#if __XEN_INTERFACE_VERSION__ < 0x00030203
+/*
+ * Legacy hypercall interface:
+ * As above, except the entry sequence to the hypervisor is:
+ *  mov $hypercall-number*32,%eax ; syscall
+ * Clobbered: %rcx, %r11, argument registers (as above)
+ */
+#define TRAP_INSTR "syscall"
+#endif
+
+/* Structural guest handles introduced in 0x00030201. */
+#if __XEN_INTERFACE_VERSION__ >= 0x00030201
 #define __DEFINE_XEN_GUEST_HANDLE(name, type) \
     typedef struct { type *p; } __guest_handle_ ## name
+#else
+#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
+    typedef type * __guest_handle_ ## name
+#endif
 
 #define DEFINE_XEN_GUEST_HANDLE(name)   __DEFINE_XEN_GUEST_HANDLE(name, name)
 #define XEN_GUEST_HANDLE(name)          __guest_handle_ ## name
@@ -80,9 +105,6 @@ DEFINE_XEN_GUEST_HANDLE(xen_pfn_t);
 #define FLAT_USER_SS32 FLAT_RING3_SS32
 #define FLAT_USER_SS   FLAT_USER_SS64
 
-/* And the trap vector is... */
-#define TRAP_INSTR "syscall"
-
 #define __HYPERVISOR_VIRT_START 0xFFFF800000000000
 #define __HYPERVISOR_VIRT_END   0xFFFF880000000000
 #define __MACH2PHYS_VIRT_START  0xFFFF800000000000
index d211ca1..b03a7ce 100644 (file)
  * Process command requests from domain-0 guest OS.
  * 
  * Copyright (c) 2002-2003, B Dragovic
- * Copyright (c) 2002-2004, K Fraser
+ * Copyright (c) 2002-2006, K Fraser
  */
 
-
 #ifndef __XEN_PUBLIC_DOM0_OPS_H__
 #define __XEN_PUBLIC_DOM0_OPS_H__
 
 #include "xen.h"
-#include "sched_ctl.h"
-
-/*
- * Make sure you increment the interface version whenever you modify this file!
- * This makes sure that old versions of dom0 tools will stop working in a
- * well-defined way (rather than crashing the machine, for instance).
- */
-#define DOM0_INTERFACE_VERSION   0x03000001
+#include "platform.h"
 
-/************************************************************************/
-
-#define DOM0_GETMEMLIST        2
-struct dom0_getmemlist {
-    /* IN variables. */
-    domid_t       domain;
-    uint64_t max_pfns;
-    XEN_GUEST_HANDLE(xen_pfn_t) buffer;
-    /* OUT variables. */
-    uint64_t num_pfns;
-};
-typedef struct dom0_getmemlist dom0_getmemlist_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_getmemlist_t);
+#if __XEN_INTERFACE_VERSION__ >= 0x00030204
+#error "dom0_ops.h is a compatibility interface only"
+#endif
 
-#define DOM0_SCHEDCTL          6
- /* struct sched_ctl_cmd is from sched-ctl.h   */
-typedef struct sched_ctl_cmd dom0_schedctl_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_schedctl_t);
+#define DOM0_INTERFACE_VERSION XENPF_INTERFACE_VERSION
 
-#define DOM0_ADJUSTDOM         7
-/* struct sched_adjdom_cmd is from sched-ctl.h */
-typedef struct sched_adjdom_cmd dom0_adjustdom_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_adjustdom_t);
+#define DOM0_SETTIME          XENPF_settime
+#define dom0_settime          xenpf_settime
+#define dom0_settime_t        xenpf_settime_t
 
-#define DOM0_CREATEDOMAIN      8
-struct dom0_createdomain {
-    /* IN parameters */
-    uint32_t ssidref;
-    xen_domain_handle_t handle;
-    /* IN/OUT parameters. */
-    /* Identifier for new domain (auto-allocate if zero is specified). */
-    domid_t domain;
-};
-typedef struct dom0_createdomain dom0_createdomain_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_createdomain_t);
+#define DOM0_ADD_MEMTYPE      XENPF_add_memtype
+#define dom0_add_memtype      xenpf_add_memtype
+#define dom0_add_memtype_t    xenpf_add_memtype_t
 
-#define DOM0_DESTROYDOMAIN     9
-struct dom0_destroydomain {
-    /* IN variables. */
-    domid_t domain;
-};
-typedef struct dom0_destroydomain dom0_destroydomain_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_destroydomain_t);
+#define DOM0_DEL_MEMTYPE      XENPF_del_memtype
+#define dom0_del_memtype      xenpf_del_memtype
+#define dom0_del_memtype_t    xenpf_del_memtype_t
 
-#define DOM0_PAUSEDOMAIN      10
-struct dom0_pausedomain {
-    /* IN parameters. */
-    domid_t domain;
-};
-typedef struct dom0_pausedomain dom0_pausedomain_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_pausedomain_t);
+#define DOM0_READ_MEMTYPE     XENPF_read_memtype
+#define dom0_read_memtype     xenpf_read_memtype
+#define dom0_read_memtype_t   xenpf_read_memtype_t
 
-#define DOM0_UNPAUSEDOMAIN    11
-struct dom0_unpausedomain {
-    /* IN parameters. */
-    domid_t domain;
-};
-typedef struct dom0_unpausedomain dom0_unpausedomain_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_unpausedomain_t);
+#define DOM0_MICROCODE        XENPF_microcode_update
+#define dom0_microcode        xenpf_microcode_update
+#define dom0_microcode_t      xenpf_microcode_update_t
 
-#define DOM0_GETDOMAININFO    12
-struct dom0_getdomaininfo {
-    /* IN variables. */
-    domid_t  domain;                  /* NB. IN/OUT variable. */
-    /* OUT variables. */
-#define DOMFLAGS_DYING     (1<<0) /* Domain is scheduled to die.             */
-#define DOMFLAGS_SHUTDOWN  (1<<2) /* The guest OS has shut down.             */
-#define DOMFLAGS_PAUSED    (1<<3) /* Currently paused by control software.   */
-#define DOMFLAGS_BLOCKED   (1<<4) /* Currently blocked pending an event.     */
-#define DOMFLAGS_RUNNING   (1<<5) /* Domain is currently running.            */
-#define DOMFLAGS_CPUMASK      255 /* CPU to which this domain is bound.      */
-#define DOMFLAGS_CPUSHIFT       8
-#define DOMFLAGS_SHUTDOWNMASK 255 /* DOMFLAGS_SHUTDOWN guest-supplied code.  */
-#define DOMFLAGS_SHUTDOWNSHIFT 16
-    uint32_t flags;
-    uint64_t tot_pages;
-    uint64_t max_pages;
-    xen_pfn_t shared_info_frame;  /* MFN of shared_info struct */
-    uint64_t cpu_time;
-    uint32_t nr_online_vcpus;     /* Number of VCPUs currently online. */
-    uint32_t max_vcpu_id;         /* Maximum VCPUID in use by this domain. */
-    uint32_t ssidref;
-    xen_domain_handle_t handle;
-};
-typedef struct dom0_getdomaininfo dom0_getdomaininfo_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfo_t);
+#define DOM0_PLATFORM_QUIRK   XENPF_platform_quirk
+#define dom0_platform_quirk   xenpf_platform_quirk
+#define dom0_platform_quirk_t xenpf_platform_quirk_t
 
-#define DOM0_SETVCPUCONTEXT   13
-struct dom0_setvcpucontext {
-    /* IN variables. */
-    domid_t               domain;
-    uint32_t              vcpu;
-    /* IN/OUT parameters */
-    XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt;
-};
-typedef struct dom0_setvcpucontext dom0_setvcpucontext_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_setvcpucontext_t);
+typedef uint64_t cpumap_t;
 
-#define DOM0_MSR              15
+/* Unsupported legacy operation -- defined for API compatibility. */
+#define DOM0_MSR                 15
 struct dom0_msr {
     /* IN variables. */
     uint32_t write;
@@ -134,321 +61,8 @@ struct dom0_msr {
 typedef struct dom0_msr dom0_msr_t;
 DEFINE_XEN_GUEST_HANDLE(dom0_msr_t);
 
-/*
- * Set clock such that it would read <secs,nsecs> after 00:00:00 UTC,
- * 1 January, 1970 if the current system time was <system_time>.
- */
-#define DOM0_SETTIME          17
-struct dom0_settime {
-    /* IN variables. */
-    uint32_t secs;
-    uint32_t nsecs;
-    uint64_t system_time;
-};
-typedef struct dom0_settime dom0_settime_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_settime_t);
-
-#define DOM0_GETPAGEFRAMEINFO 18
-#define LTAB_SHIFT 28
-#define NOTAB 0         /* normal page */
-#define L1TAB (1<<LTAB_SHIFT)
-#define L2TAB (2<<LTAB_SHIFT)
-#define L3TAB (3<<LTAB_SHIFT)
-#define L4TAB (4<<LTAB_SHIFT)
-#define LPINTAB  (1<<31)
-#define XTAB  (0xf<<LTAB_SHIFT) /* invalid page */
-#define LTAB_MASK XTAB
-#define LTABTYPE_MASK (0x7<<LTAB_SHIFT)
-
-struct dom0_getpageframeinfo {
-    /* IN variables. */
-    xen_pfn_t gmfn;        /* GMFN to query.                            */
-    domid_t domain;        /* To which domain does the frame belong?    */
-    /* OUT variables. */
-    /* Is the page PINNED to a type? */
-    uint32_t type;         /* see above type defs */
-};
-typedef struct dom0_getpageframeinfo dom0_getpageframeinfo_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo_t);
-
-/*
- * Read console content from Xen buffer ring.
- */
-#define DOM0_READCONSOLE      19
-struct dom0_readconsole {
-    /* IN variables. */
-    uint32_t clear;                /* Non-zero -> clear after reading. */
-    XEN_GUEST_HANDLE(char) buffer; /* Buffer start */
-    /* IN/OUT variables. */
-    uint32_t count;            /* In: Buffer size;  Out: Used buffer size  */
-};
-typedef struct dom0_readconsole dom0_readconsole_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_readconsole_t);
-
-/*
- * Set which physical cpus a vcpu can execute on.
- */
-#define DOM0_SETVCPUAFFINITY  20
-struct dom0_setvcpuaffinity {
-    /* IN variables. */
-    domid_t   domain;
-    uint32_t  vcpu;
-    cpumap_t  cpumap;
-};
-typedef struct dom0_setvcpuaffinity dom0_setvcpuaffinity_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_setvcpuaffinity_t);
-
-/* Get trace buffers machine base address */
-#define DOM0_TBUFCONTROL       21
-struct dom0_tbufcontrol {
-    /* IN variables */
-#define DOM0_TBUF_GET_INFO     0
-#define DOM0_TBUF_SET_CPU_MASK 1
-#define DOM0_TBUF_SET_EVT_MASK 2
-#define DOM0_TBUF_SET_SIZE     3
-#define DOM0_TBUF_ENABLE       4
-#define DOM0_TBUF_DISABLE      5
-    uint32_t      op;
-    /* IN/OUT variables */
-    cpumap_t      cpu_mask;
-    uint32_t      evt_mask;
-    /* OUT variables */
-    xen_pfn_t buffer_mfn;
-    uint32_t size;
-};
-typedef struct dom0_tbufcontrol dom0_tbufcontrol_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_tbufcontrol_t);
-
-/*
- * Get physical information about the host machine
- */
-#define DOM0_PHYSINFO         22
-struct dom0_physinfo {
-    uint32_t threads_per_core;
-    uint32_t cores_per_socket;
-    uint32_t sockets_per_node;
-    uint32_t nr_nodes;
-    uint32_t cpu_khz;
-    uint64_t total_pages;
-    uint64_t free_pages;
-    uint64_t scrub_pages;
-    uint32_t hw_cap[8];
-};
-typedef struct dom0_physinfo dom0_physinfo_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_physinfo_t);
-
-/*
- * Get the ID of the current scheduler.
- */
-#define DOM0_SCHED_ID        24
-struct dom0_sched_id {
-    /* OUT variable */
-    uint32_t sched_id;
-};
-typedef struct dom0_physinfo dom0_sched_id_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_sched_id_t);
-
-/*
- * Control shadow pagetables operation
- */
-#define DOM0_SHADOW_CONTROL  25
-
-#define DOM0_SHADOW_CONTROL_OP_OFF         0
-#define DOM0_SHADOW_CONTROL_OP_ENABLE_TEST 1
-#define DOM0_SHADOW_CONTROL_OP_ENABLE_LOGDIRTY 2
-#define DOM0_SHADOW_CONTROL_OP_ENABLE_TRANSLATE 3
-
-#define DOM0_SHADOW_CONTROL_OP_FLUSH       10     /* table ops */
-#define DOM0_SHADOW_CONTROL_OP_CLEAN       11
-#define DOM0_SHADOW_CONTROL_OP_PEEK        12
-
-struct dom0_shadow_control_stats {
-    uint32_t fault_count;
-    uint32_t dirty_count;
-    uint32_t dirty_net_count;
-    uint32_t dirty_block_count;
-};
-typedef struct dom0_shadow_control_stats dom0_shadow_control_stats_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_stats_t);
-
-struct dom0_shadow_control {
-    /* IN variables. */
-    domid_t        domain;
-    uint32_t       op;
-    XEN_GUEST_HANDLE(ulong) dirty_bitmap;
-    /* IN/OUT variables. */
-    uint64_t       pages;        /* size of buffer, updated with actual size */
-    /* OUT variables. */
-    struct dom0_shadow_control_stats stats;
-};
-typedef struct dom0_shadow_control dom0_shadow_control_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_shadow_control_t);
-
-#define DOM0_SETDOMAINMAXMEM   28
-struct dom0_setdomainmaxmem {
-    /* IN variables. */
-    domid_t  domain;
-    uint64_t max_memkb;
-};
-typedef struct dom0_setdomainmaxmem dom0_setdomainmaxmem_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_setdomainmaxmem_t);
-
-#define DOM0_GETPAGEFRAMEINFO2 29   /* batched interface */
-struct dom0_getpageframeinfo2 {
-    /* IN variables. */
-    domid_t  domain;
-    uint64_t num;
-    /* IN/OUT variables. */
-    XEN_GUEST_HANDLE(ulong) array;
-};
-typedef struct dom0_getpageframeinfo2 dom0_getpageframeinfo2_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_getpageframeinfo2_t);
-
-/*
- * Request memory range (@mfn, @mfn+@nr_mfns-1) to have type @type.
- * On x86, @type is an architecture-defined MTRR memory type.
- * On success, returns the MTRR that was used (@reg) and a handle that can
- * be passed to DOM0_DEL_MEMTYPE to accurately tear down the new setting.
- * (x86-specific).
- */
-#define DOM0_ADD_MEMTYPE         31
-struct dom0_add_memtype {
-    /* IN variables. */
-    xen_pfn_t mfn;
-    uint64_t nr_mfns;
-    uint32_t type;
-    /* OUT variables. */
-    uint32_t handle;
-    uint32_t reg;
-};
-typedef struct dom0_add_memtype dom0_add_memtype_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_add_memtype_t);
-
-/*
- * Tear down an existing memory-range type. If @handle is remembered then it
- * should be passed in to accurately tear down the correct setting (in case
- * of overlapping memory regions with differing types). If it is not known
- * then @handle should be set to zero. In all cases @reg must be set.
- * (x86-specific).
- */
-#define DOM0_DEL_MEMTYPE         32
-struct dom0_del_memtype {
-    /* IN variables. */
-    uint32_t handle;
-    uint32_t reg;
-};
-typedef struct dom0_del_memtype dom0_del_memtype_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_del_memtype_t);
-
-/* Read current type of an MTRR (x86-specific). */
-#define DOM0_READ_MEMTYPE        33
-struct dom0_read_memtype {
-    /* IN variables. */
-    uint32_t reg;
-    /* OUT variables. */
-    xen_pfn_t mfn;
-    uint64_t nr_mfns;
-    uint32_t type;
-};
-typedef struct dom0_read_memtype dom0_read_memtype_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_read_memtype_t);
-
-/* Interface for controlling Xen software performance counters. */
-#define DOM0_PERFCCONTROL        34
-/* Sub-operations: */
-#define DOM0_PERFCCONTROL_OP_RESET 1   /* Reset all counters to zero. */
-#define DOM0_PERFCCONTROL_OP_QUERY 2   /* Get perfctr information. */
-struct dom0_perfc_desc {
-    char         name[80];             /* name of perf counter */
-    uint32_t     nr_vals;              /* number of values for this counter */
-};
-typedef struct dom0_perfc_desc dom0_perfc_desc_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_perfc_desc_t);
-typedef uint32_t dom0_perfc_val_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_perfc_val_t);
-
-struct dom0_perfccontrol {
-    /* IN variables. */
-    uint32_t       op;                /*  DOM0_PERFCCONTROL_OP_??? */
-    /* OUT variables. */
-    uint32_t       nr_counters;       /*  number of counters description  */
-    uint32_t       nr_vals;                      /*  number of values  */
-    XEN_GUEST_HANDLE(dom0_perfc_desc_t) desc; /*  counter information (or NULL) */
-    XEN_GUEST_HANDLE(dom0_perfc_val_t) val;   /*  counter values (or NULL)  */
-};
-typedef struct dom0_perfccontrol dom0_perfccontrol_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_perfccontrol_t);
-
-#define DOM0_MICROCODE           35
-struct dom0_microcode {
-    /* IN variables. */
-    XEN_GUEST_HANDLE(void) data;          /* Pointer to microcode data */
-    uint32_t length;                  /* Length of microcode data. */
-};
-typedef struct dom0_microcode dom0_microcode_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_microcode_t);
-
-#define DOM0_IOPORT_PERMISSION   36
-struct dom0_ioport_permission {
-    domid_t  domain;                  /* domain to be affected */
-    uint32_t first_port;              /* first port int range */
-    uint32_t nr_ports;                /* size of port range */
-    uint8_t  allow_access;            /* allow or deny access to range? */
-};
-typedef struct dom0_ioport_permission dom0_ioport_permission_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_ioport_permission_t);
-
-#define DOM0_GETVCPUCONTEXT      37
-struct dom0_getvcpucontext {
-    /* IN variables. */
-    domid_t  domain;                  /* domain to be affected */
-    uint32_t vcpu;                    /* vcpu # */
-    /* OUT variables. */
-    XEN_GUEST_HANDLE(vcpu_guest_context_t) ctxt;
-};
-typedef struct dom0_getvcpucontext dom0_getvcpucontext_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_getvcpucontext_t);
-
-#define DOM0_GETVCPUINFO         43
-struct dom0_getvcpuinfo {
-    /* IN variables. */
-    domid_t  domain;                  /* domain to be affected */
-    uint32_t vcpu;                    /* vcpu # */
-    /* OUT variables. */
-    uint8_t  online;                  /* currently online (not hotplugged)? */
-    uint8_t  blocked;                 /* blocked waiting for an event? */
-    uint8_t  running;                 /* currently scheduled on its CPU? */
-    uint64_t cpu_time;                /* total cpu time consumed (ns) */
-    uint32_t cpu;                     /* current mapping   */
-    cpumap_t cpumap;                  /* allowable mapping */
-};
-typedef struct dom0_getvcpuinfo dom0_getvcpuinfo_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_getvcpuinfo_t);
-
-#define DOM0_GETDOMAININFOLIST   38
-struct dom0_getdomaininfolist {
-    /* IN variables. */
-    domid_t               first_domain;
-    uint32_t              max_domains;
-    XEN_GUEST_HANDLE(dom0_getdomaininfo_t) buffer;
-    /* OUT variables. */
-    uint32_t              num_domains;
-};
-typedef struct dom0_getdomaininfolist dom0_getdomaininfolist_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_getdomaininfolist_t);
-
-#define DOM0_PLATFORM_QUIRK      39
-#define QUIRK_NOIRQBALANCING      1 /* Do not restrict IO-APIC RTE targets */
-#define QUIRK_IOAPIC_BAD_REGSEL   2 /* IO-APIC REGSEL forgets its value    */
-#define QUIRK_IOAPIC_GOOD_REGSEL  3 /* IO-APIC REGSEL behaves properly     */
-struct dom0_platform_quirk {
-    /* IN variables. */
-    uint32_t quirk_id;
-};
-typedef struct dom0_platform_quirk dom0_platform_quirk_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_platform_quirk_t);
-
-#define DOM0_PHYSICAL_MEMORY_MAP 40   /* Unimplemented from 3.0.3 onwards */
+/* Unsupported legacy operation -- defined for API compatibility. */
+#define DOM0_PHYSICAL_MEMORY_MAP 40
 struct dom0_memory_map_entry {
     uint64_t start, end;
     uint32_t flags; /* reserved */
@@ -457,135 +71,18 @@ struct dom0_memory_map_entry {
 typedef struct dom0_memory_map_entry dom0_memory_map_entry_t;
 DEFINE_XEN_GUEST_HANDLE(dom0_memory_map_entry_t);
 
-struct dom0_physical_memory_map {
-    /* IN variables. */
-    uint32_t max_map_entries;
-    /* OUT variables. */
-    uint32_t nr_map_entries;
-    XEN_GUEST_HANDLE(dom0_memory_map_entry_t) memory_map;
-};
-typedef struct dom0_physical_memory_map dom0_physical_memory_map_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_physical_memory_map_t);
-
-#define DOM0_MAX_VCPUS 41
-struct dom0_max_vcpus {
-    domid_t  domain;        /* domain to be affected */
-    uint32_t max;           /* maximum number of vcpus */
-};
-typedef struct dom0_max_vcpus dom0_max_vcpus_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_max_vcpus_t);
-
-#define DOM0_SETDOMAINHANDLE 44
-struct dom0_setdomainhandle {
-    domid_t domain;
-    xen_domain_handle_t handle;
-};
-typedef struct dom0_setdomainhandle dom0_setdomainhandle_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_setdomainhandle_t);
-
-#define DOM0_SETDEBUGGING 45
-struct dom0_setdebugging {
-    domid_t domain;
-    uint8_t enable;
-};
-typedef struct dom0_setdebugging dom0_setdebugging_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_setdebugging_t);
-
-#define DOM0_IRQ_PERMISSION 46
-struct dom0_irq_permission {
-    domid_t domain;          /* domain to be affected */
-    uint8_t pirq;
-    uint8_t allow_access;    /* flag to specify enable/disable of IRQ access */
-};
-typedef struct dom0_irq_permission dom0_irq_permission_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_irq_permission_t);
-
-#define DOM0_IOMEM_PERMISSION 47
-struct dom0_iomem_permission {
-    domid_t  domain;          /* domain to be affected */
-    xen_pfn_t first_mfn;      /* first page (physical page number) in range */
-    uint64_t nr_mfns;         /* number of pages in range (>0) */
-    uint8_t allow_access;     /* allow (!0) or deny (0) access to range? */
-};
-typedef struct dom0_iomem_permission dom0_iomem_permission_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_iomem_permission_t);
-
-#define DOM0_HYPERCALL_INIT   48
-struct dom0_hypercall_init {
-    domid_t   domain;          /* domain to be affected */
-    xen_pfn_t gmfn;            /* GMFN to be initialised */
-};
-typedef struct dom0_hypercall_init dom0_hypercall_init_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_hypercall_init_t);
-
-#define DOM0_DOMAIN_SETUP     49
-#define _XEN_DOMAINSETUP_hvm_guest 0
-#define XEN_DOMAINSETUP_hvm_guest  (1UL<<_XEN_DOMAINSETUP_hvm_guest)
-#define _XEN_DOMAINSETUP_query 1       /* Get parameters (for save)  */
-#define XEN_DOMAINSETUP_query  (1UL<<_XEN_DOMAINSETUP_query)
-typedef struct dom0_domain_setup {
-    domid_t  domain;          /* domain to be affected */
-    unsigned long flags;      /* XEN_DOMAINSETUP_* */
-#ifdef __ia64__
-    unsigned long bp;         /* mpaddr of boot param area */
-    unsigned long maxmem;        /* Highest memory address for MDT.  */
-    unsigned long xsi_va;     /* Xen shared_info area virtual address.  */
-    unsigned int hypercall_imm;        /* Break imm for Xen hypercalls.  */
-#endif
-} dom0_domain_setup_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_domain_setup_t);
-
-#define DOM0_SETTIMEOFFSET    50
-struct dom0_settimeoffset {
-    domid_t  domain;
-    int32_t  time_offset_seconds; /* applied to domain wallclock time */
-};
-typedef struct dom0_settimeoffset dom0_settimeoffset_t;
-DEFINE_XEN_GUEST_HANDLE(dom0_settimeoffset_t);
-
 struct dom0_op {
     uint32_t cmd;
     uint32_t interface_version; /* DOM0_INTERFACE_VERSION */
     union {
-        struct dom0_createdomain      createdomain;
-        struct dom0_pausedomain       pausedomain;
-        struct dom0_unpausedomain     unpausedomain;
-        struct dom0_destroydomain     destroydomain;
-        struct dom0_getmemlist        getmemlist;
-        struct sched_ctl_cmd          schedctl;
-        struct sched_adjdom_cmd       adjustdom;
-        struct dom0_setvcpucontext    setvcpucontext;
-        struct dom0_getdomaininfo     getdomaininfo;
-        struct dom0_getpageframeinfo  getpageframeinfo;
         struct dom0_msr               msr;
         struct dom0_settime           settime;
-        struct dom0_readconsole       readconsole;
-        struct dom0_setvcpuaffinity   setvcpuaffinity;
-        struct dom0_tbufcontrol       tbufcontrol;
-        struct dom0_physinfo          physinfo;
-        struct dom0_sched_id          sched_id;
-        struct dom0_shadow_control    shadow_control;
-        struct dom0_setdomainmaxmem   setdomainmaxmem;
-        struct dom0_getpageframeinfo2 getpageframeinfo2;
         struct dom0_add_memtype       add_memtype;
         struct dom0_del_memtype       del_memtype;
         struct dom0_read_memtype      read_memtype;
-        struct dom0_perfccontrol      perfccontrol;
         struct dom0_microcode         microcode;
-        struct dom0_ioport_permission ioport_permission;
-        struct dom0_getvcpucontext    getvcpucontext;
-        struct dom0_getvcpuinfo       getvcpuinfo;
-        struct dom0_getdomaininfolist getdomaininfolist;
         struct dom0_platform_quirk    platform_quirk;
-        struct dom0_physical_memory_map physical_memory_map;
-        struct dom0_max_vcpus         max_vcpus;
-        struct dom0_setdomainhandle   setdomainhandle;
-        struct dom0_setdebugging      setdebugging;
-        struct dom0_irq_permission    irq_permission;
-        struct dom0_iomem_permission  iomem_permission;
-        struct dom0_hypercall_init    hypercall_init;
-        struct dom0_domain_setup      domain_setup;
-        struct dom0_settimeoffset     settimeoffset;
+        struct dom0_memory_map_entry  physical_memory_map;
         uint8_t                       pad[128];
     } u;
 };
index 3723ef3..6b56dc3 100644 (file)
@@ -25,7 +25,7 @@ typedef unsigned int RING_IDX;
  * power of two (so we can mask with (size-1) to loop around).
  */
 #define __RING_SIZE(_s, _sz) \
-    (__RD32(((_sz) - (long)&(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
+    (__RD32(((_sz) - (long)(_s)->ring + (long)(_s)) / sizeof((_s)->ring[0])))
 
 /*
  * Macros to make the correct C datatypes for a new kind of ring.
index 65cd744..89f7bd4 100644 (file)
@@ -9,7 +9,7 @@
 #ifndef __XEN_PUBLIC_XEN_COMPAT_H__
 #define __XEN_PUBLIC_XEN_COMPAT_H__
 
-#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030202
+#define __XEN_LATEST_INTERFACE_VERSION__ 0x00030204
 
 #if defined(__XEN__) || defined(__XEN_TOOLS__)
 /* Xen is built with matching headers and implements the latest interface. */
 #error "These header files do not support the requested interface version."
 #endif
 
-/* New sched_op hypercall introduced in 0x00030101. */
-#if __XEN_INTERFACE_VERSION__ < 0x00030101
-#undef __HYPERVISOR_sched_op
-#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
-#endif
-
-/* Structural guest handles introduced in 0x00030201. */
-#if __XEN_INTERFACE_VERSION__ < 0x00030201
-#undef __DEFINE_XEN_GUEST_HANDLE
-#define __DEFINE_XEN_GUEST_HANDLE(name, type) \
-    typedef type * __guest_handle_ ## name
-#endif
-
-/* New event-channel and physdev hypercalls introduced in 0x00030202. */
-#if __XEN_INTERFACE_VERSION__ < 0x00030202
-#undef __HYPERVISOR_event_channel_op
-#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
-#undef __HYPERVISOR_physdev_op
-#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
-#endif
-
 #endif /* __XEN_PUBLIC_XEN_COMPAT_H__ */
index 6cc0ee9..dd56fc1 100644 (file)
@@ -9,6 +9,8 @@
 #ifndef __XEN_PUBLIC_XEN_H__
 #define __XEN_PUBLIC_XEN_H__
 
+#include "xen-compat.h"
+
 #if defined(__i386__)
 #include "arch-x86_32.h"
 #elif defined(__x86_64__)
 #endif
 
 /*
- * XEN "SYSTEM CALLS" (a.k.a. HYPERCALLS).
+ * HYPERCALLS
  */
 
-/*
- * x86_32: EAX = vector; EBX, ECX, EDX, ESI, EDI = args 1, 2, 3, 4, 5.
- *         EAX = return value
- *         (argument registers may be clobbered on return)
- * x86_64: RAX = vector; RDI, RSI, RDX, R10, R8, R9 = args 1, 2, 3, 4, 5, 6. 
- *         RAX = return value
- *         (argument registers not clobbered on return; RCX, R11 are)
- */
 #define __HYPERVISOR_set_trap_table        0
 #define __HYPERVISOR_mmu_update            1
 #define __HYPERVISOR_set_gdt               2
@@ -40,7 +34,7 @@
 #define __HYPERVISOR_set_callbacks         4
 #define __HYPERVISOR_fpu_taskswitch        5
 #define __HYPERVISOR_sched_op_compat       6 /* compat since 0x00030101 */
-#define __HYPERVISOR_dom0_op               7
+#define __HYPERVISOR_platform_op           7
 #define __HYPERVISOR_set_debugreg          8
 #define __HYPERVISOR_get_debugreg          9
 #define __HYPERVISOR_update_descriptor    10
@@ -67,6 +61,9 @@
 #define __HYPERVISOR_event_channel_op     32
 #define __HYPERVISOR_physdev_op           33
 #define __HYPERVISOR_hvm_op               34
+#define __HYPERVISOR_sysctl               35
+#define __HYPERVISOR_domctl               36
+#define __HYPERVISOR_kexec_op             37
 
 /* Architecture-specific hypercall definitions. */
 #define __HYPERVISOR_arch_0               48
 #define __HYPERVISOR_arch_6               54
 #define __HYPERVISOR_arch_7               55
 
+/*
+ * HYPERCALL COMPATIBILITY.
+ */
+
+/* New sched_op hypercall introduced in 0x00030101. */
+#if __XEN_INTERFACE_VERSION__ < 0x00030101
+#undef __HYPERVISOR_sched_op
+#define __HYPERVISOR_sched_op __HYPERVISOR_sched_op_compat
+#endif
+
+/* New event-channel and physdev hypercalls introduced in 0x00030202. */
+#if __XEN_INTERFACE_VERSION__ < 0x00030202
+#undef __HYPERVISOR_event_channel_op
+#define __HYPERVISOR_event_channel_op __HYPERVISOR_event_channel_op_compat
+#undef __HYPERVISOR_physdev_op
+#define __HYPERVISOR_physdev_op __HYPERVISOR_physdev_op_compat
+#endif
+
+/* New platform_op hypercall introduced in 0x00030204. */
+#if __XEN_INTERFACE_VERSION__ < 0x00030204
+#define __HYPERVISOR_dom0_op __HYPERVISOR_platform_op
+#endif
+
 /* 
  * VIRTUAL INTERRUPTS
  * 
@@ -466,8 +486,16 @@ struct start_info {
     uint32_t flags;             /* SIF_xxx flags.                         */
     xen_pfn_t store_mfn;        /* MACHINE page number of shared page.    */
     uint32_t store_evtchn;      /* Event channel for store communication. */
-    xen_pfn_t console_mfn;      /* MACHINE page number of console page.   */
-    uint32_t console_evtchn;    /* Event channel for console messages.    */
+    union {
+        struct {
+            xen_pfn_t mfn;      /* MACHINE page number of console page.   */
+            uint32_t  evtchn;   /* Event channel for console page.        */
+        } domU;
+        struct {
+            uint32_t info_off;  /* Offset of console_info struct.         */
+            uint32_t info_size; /* Size of console_info struct from start.*/
+        } dom0;
+    } console;
     /* THE FOLLOWING ARE ONLY FILLED IN ON INITIAL BOOT (NOT RESUME).     */
     unsigned long pt_base;      /* VIRTUAL address of page directory.     */
     unsigned long nr_pt_frames; /* Number of bootstrap p.t. frames.       */
@@ -478,11 +506,49 @@ struct start_info {
 };
 typedef struct start_info start_info_t;
 
+/* New console union for dom0 introduced in 0x00030203. */
+#if __XEN_INTERFACE_VERSION__ < 0x00030203
+#define console_mfn    console.domU.mfn
+#define console_evtchn console.domU.evtchn
+#endif
+
 /* These flags are passed in the 'flags' field of start_info_t. */
 #define SIF_PRIVILEGED    (1<<0)  /* Is the domain privileged? */
 #define SIF_INITDOMAIN    (1<<1)  /* Is this the initial control domain? */
 
-typedef uint64_t cpumap_t;
+typedef struct dom0_vga_console_info {
+    uint8_t video_type; /* DOM0_VGA_CONSOLE_??? */
+#define XEN_VGATYPE_TEXT_MODE_3 0x03
+#define XEN_VGATYPE_VESA_LFB    0x23
+
+    union {
+        struct {
+            /* Font height, in pixels. */
+            uint16_t font_height;
+            /* Cursor location (column, row). */
+            uint16_t cursor_x, cursor_y;
+            /* Number of rows and columns (dimensions in characters). */
+            uint16_t rows, columns;
+        } text_mode_3;
+
+        struct {
+            /* Width and height, in pixels. */
+            uint16_t width, height;
+            /* Bytes per scan line. */
+            uint16_t bytes_per_line;
+            /* Bits per pixel. */
+            uint16_t bits_per_pixel;
+            /* LFB physical address, and size (in units of 64kB). */
+            uint32_t lfb_base;
+            uint32_t lfb_size;
+            /* RGB mask offsets and sizes, as defined by VBE 1.2+ */
+            uint8_t  red_pos, red_size;
+            uint8_t  green_pos, green_size;
+            uint8_t  blue_pos, blue_size;
+            uint8_t  rsvd_pos, rsvd_size;
+        } vesa_lfb;
+    } u;
+} dom0_vga_console_info_t;
 
 typedef uint8_t xen_domain_handle_t[16];
 
@@ -490,6 +556,11 @@ typedef uint8_t xen_domain_handle_t[16];
 #define __mk_unsigned_long(x) x ## UL
 #define mk_unsigned_long(x) __mk_unsigned_long(x)
 
+DEFINE_XEN_GUEST_HANDLE(uint8_t);
+DEFINE_XEN_GUEST_HANDLE(uint16_t);
+DEFINE_XEN_GUEST_HANDLE(uint32_t);
+DEFINE_XEN_GUEST_HANDLE(uint64_t);
+
 #else /* __ASSEMBLY__ */
 
 /* In assembly code we cannot use C numeric constant suffixes. */
@@ -497,8 +568,6 @@ typedef uint8_t xen_domain_handle_t[16];
 
 #endif /* !__ASSEMBLY__ */
 
-#include "xen-compat.h"
-
 #endif /* __XEN_PUBLIC_XEN_H__ */
 
 /*
index a0bdd56..a788c36 100644 (file)
@@ -28,6 +28,8 @@
 #define XENOPROF_disable_virq       11
 #define XENOPROF_release_counters   12
 #define XENOPROF_shutdown           13
+#define XENOPROF_get_buffer         14
+#define XENOPROF_last_op            14
 
 #define MAX_OPROF_EVENTS    32
 #define MAX_OPROF_DOMAINS   25 
@@ -56,17 +58,22 @@ typedef struct xenoprof_buf xenoprof_buf_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_buf_t);
 
 struct xenoprof_init {
-    int32_t  max_samples;
     int32_t  num_events;
     int32_t  is_primary;
-    int32_t  nbuf;
-    int32_t  bufsize;
-    uint64_t buf_maddr;
     char cpu_type[XENOPROF_CPU_TYPE_SIZE];
 };
 typedef struct xenoprof_init xenoprof_init_t;
 DEFINE_XEN_GUEST_HANDLE(xenoprof_init_t);
 
+struct xenoprof_get_buffer {
+    int32_t  max_samples;
+    int32_t  nbuf;
+    int32_t  bufsize;
+    uint64_t buf_maddr;
+};
+typedef struct xenoprof_get_buffer xenoprof_get_buffer_t;
+DEFINE_XEN_GUEST_HANDLE(xenoprof_get_buffer_t);
+
 struct xenoprof_counter {
     uint32_t ind;
     uint64_t count;
index 17c843a..50d76fe 100644 (file)
@@ -6,7 +6,6 @@
 #ifndef __XEN_ASM_PCIFRONT_H__
 #define __XEN_ASM_PCIFRONT_H__
 
-#include <linux/config.h>
 #include <linux/spinlock.h>
 
 #ifdef __KERNEL__
@@ -70,7 +69,7 @@ static inline void pcifront_init_sd(struct pcifront_sd *sd, int domain,
 
 #endif /* __ia64__ */
 
-extern spinlock_t pci_bus_lock;
+extern struct rw_semaphore pci_bus_sem;
 
 #endif /* __KERNEL__ */
 
index 99e2948..938d4da 100644 (file)
@@ -33,9 +33,6 @@
 #ifndef __LINUX_PUBLIC_EVTCHN_H__
 #define __LINUX_PUBLIC_EVTCHN_H__
 
-/* /dev/xen/evtchn resides at device number major=10, minor=201 */
-#define EVTCHN_MINOR 201
-
 /*
  * Bind a fresh port to VIRQ @virq.
  * Return allocated port.
index f17d61a..44af17c 100644 (file)
@@ -2,7 +2,6 @@
 #ifndef __ASM_XEN_PROC_H__
 #define __ASM_XEN_PROC_H__
 
-#include <linux/config.h>
 #include <linux/proc_fs.h>
 
 extern struct proc_dir_entry *create_xen_proc_entry(
index f65dc9b..8e259ce 100644 (file)
@@ -37,6 +37,7 @@
 #include <linux/device.h>
 #include <linux/notifier.h>
 #include <linux/mutex.h>
+#include <linux/completion.h>
 #include <xen/interface/xen.h>
 #include <xen/interface/grant_table.h>
 #include <xen/interface/io/xenbus.h>
@@ -74,6 +75,7 @@ struct xenbus_device {
        struct xenbus_watch otherend_watch;
        struct device dev;
        enum xenbus_state state;
+       struct completion down;
 };
 
 static inline struct xenbus_device *to_xenbus_device(struct device *dev)
@@ -274,7 +276,7 @@ int xenbus_free_evtchn(struct xenbus_device *dev, int port);
 
 /**
  * Return the state of the driver rooted at the given store path, or
- * XenbusStateClosed if no state can be read.
+ * XenbusStateUnknown if no state can be read.
  */
 enum xenbus_state xenbus_read_driver_state(const char *path);
 
@@ -295,5 +297,10 @@ void xenbus_dev_error(struct xenbus_device *dev, int err, const char *fmt,
 void xenbus_dev_fatal(struct xenbus_device *dev, int err, const char *fmt,
                      ...);
 
+int __init xenbus_dev_init(void);
+
+char *xenbus_strstate(enum xenbus_state state);
+int xenbus_dev_is_online(struct xenbus_device *dev);
+int xenbus_frontend_closed(struct xenbus_device *dev);
 
 #endif /* _XEN_XENBUS_H */
index fa2160d..ae87374 100644 (file)
@@ -1,6 +1,9 @@
 #ifndef __ASM_XENCONS_H__
 #define __ASM_XENCONS_H__
 
+struct dom0_vga_console_info;
+void dom0_init_screen_info(const struct dom0_vga_console_info *info);
+
 void xencons_force_flush(void);
 void xencons_resume(void);
 
index 10efab8..fadbf9e 100644 (file)
@@ -9,7 +9,29 @@
  * 2 of the License, or (at your option) any later version.
  */
 
-#ifdef CONFIG_MODULE_SIG
-extern int module_verify_sig(Elf_Ehdr *hdr, Elf_Shdr *sechdrs,
-                            const char *secstrings, struct module *mod);
-#endif
+#include <linux/types.h>
+#include <asm/module.h>
+
+struct module_verify_data {
+       struct crypto_tfm       *digest;        /* module signature digest */
+       const void              *buffer;        /* module buffer */
+       const Elf_Ehdr          *hdr;           /* ELF header */
+       const Elf_Shdr          *sections;      /* ELF section table */
+       const Elf_Sym           *symbols;       /* ELF symbol table */
+       const char              *secstrings;    /* ELF section string table */
+       const char              *strings;       /* ELF string table */
+       size_t                  *secsizes;      /* section size list */
+       size_t                  size;           /* module object size */
+       size_t                  nsects;         /* number of sections */
+       size_t                  nsyms;          /* number of symbols */
+       size_t                  nstrings;       /* size of strings section */
+       size_t                  signed_size;    /* count of bytes contributed to digest */
+       int                     *canonlist;     /* list of canonicalised sections */
+       int                     *canonmap;      /* section canonicalisation map */
+       int                     sig_index;      /* module signature section index */
+       uint8_t                 xcsum;          /* checksum of bytes contributed to digest */
+       uint8_t                 csum;           /* checksum of bytes representing a section */
+};
+
+extern int module_verify(const Elf_Ehdr *hdr, size_t size);
+extern int module_verify_signature(struct module_verify_data *mvdata);
index 79610c0..f1e3e6c 100644 (file)
@@ -11,7 +11,6 @@
  *
  */
 
-#include <linux/config.h>
 #include <linux/errno.h>
 #include <linux/module.h>
 #include <linux/types.h>
@@ -139,19 +138,19 @@ void      vxh_dump_entry(struct _vx_hist_entry *e, unsigned cpu)
 
 static void __vxh_dump_history(void)
 {
-       unsigned int i,j;
+       unsigned int i, cpu;
 
        printk("History:\tSEQ: %8x\tNR_CPUS: %d\n",
                atomic_read(&sequence), NR_CPUS);
 
        for (i=0; i < VXH_SIZE; i++) {
-               for (j=0; j < NR_CPUS; j++) {
+               for_each_online_cpu(cpu) {
                        struct _vx_history *hist =
-                               &per_cpu(vx_history_buffer, j);
+                               &per_cpu(vx_history_buffer, cpu);
                        unsigned int index = (hist->counter-i) % VXH_SIZE;
                        struct _vx_hist_entry *entry = &hist->entry[index];
 
-                       vxh_dump_entry(entry, j);
+                       vxh_dump_entry(entry, cpu);
                }
        }
 }
index d08302d..bda0d71 100644 (file)
  */
 
 #include <linux/bitops.h>
+#include <linux/module.h>
+#include <asm/types.h>
+#include <asm/byteorder.h>
 
-int find_next_bit(const unsigned long *addr, int size, int offset)
+#define BITOP_WORD(nr)         ((nr) / BITS_PER_LONG)
+
+/**
+ * find_next_bit - find the next set bit in a memory region
+ * @addr: The address to base the search on
+ * @offset: The bitnumber to start searching at
+ * @size: The maximum size to search
+ */
+unsigned long find_next_bit(const unsigned long *addr, unsigned long size,
+               unsigned long offset)
 {
-       const unsigned long *base;
-       const int NBITS = sizeof(*addr) * 8;
+       const unsigned long *p = addr + BITOP_WORD(offset);
+       unsigned long result = offset & ~(BITS_PER_LONG-1);
        unsigned long tmp;
 
-       base = addr;
+       if (offset >= size)
+               return size;
+       size -= result;
+       offset %= BITS_PER_LONG;
        if (offset) {
-               int suboffset;
+               tmp = *(p++);
+               tmp &= (~0UL << offset);
+               if (size < BITS_PER_LONG)
+                       goto found_first;
+               if (tmp)
+                       goto found_middle;
+               size -= BITS_PER_LONG;
+               result += BITS_PER_LONG;
+       }
+       while (size & ~(BITS_PER_LONG-1)) {
+               if ((tmp = *(p++)))
+                       goto found_middle;
+               result += BITS_PER_LONG;
+               size -= BITS_PER_LONG;
+       }
+       if (!size)
+               return result;
+       tmp = *p;
 
-               addr += offset / NBITS;
+found_first:
+       tmp &= (~0UL >> (BITS_PER_LONG - size));
+       if (tmp == 0UL)         /* Are any bits set? */
+               return result + size;   /* Nope. */
+found_middle:
+       return result + __ffs(tmp);
+}
 
-               suboffset = offset % NBITS;
-               if (suboffset) {
-                       tmp = *addr;
-                       tmp >>= suboffset;
-                       if (tmp)
-                               goto finish;
-               }
+EXPORT_SYMBOL(find_next_bit);
 
-               addr++;
+/*
+ * This implementation of find_{first,next}_zero_bit was stolen from
+ * Linus' asm-alpha/bitops.h.
+ */
+unsigned long find_next_zero_bit(const unsigned long *addr, unsigned long size,
+               unsigned long offset)
+{
+       const unsigned long *p = addr + BITOP_WORD(offset);
+       unsigned long result = offset & ~(BITS_PER_LONG-1);
+       unsigned long tmp;
+
+       if (offset >= size)
+               return size;
+       size -= result;
+       offset %= BITS_PER_LONG;
+       if (offset) {
+               tmp = *(p++);
+               tmp |= ~0UL >> (BITS_PER_LONG - offset);
+               if (size < BITS_PER_LONG)
+                       goto found_first;
+               if (~tmp)
+                       goto found_middle;
+               size -= BITS_PER_LONG;
+               result += BITS_PER_LONG;
        }
+       while (size & ~(BITS_PER_LONG-1)) {
+               if (~(tmp = *(p++)))
+                       goto found_middle;
+               result += BITS_PER_LONG;
+               size -= BITS_PER_LONG;
+       }
+       if (!size)
+               return result;
+       tmp = *p;
+
+found_first:
+       tmp |= ~0UL << size;
+       if (tmp == ~0UL)        /* Are any bits zero? */
+               return result + size;   /* Nope. */
+found_middle:
+       return result + ffz(tmp);
+}
 
-       while ((tmp = *addr) == 0)
-               addr++;
+EXPORT_SYMBOL(find_next_zero_bit);
 
-       offset = (addr - base) * NBITS;
+#ifdef __BIG_ENDIAN
 
- finish:
-       /* count the remaining bits without using __ffs() since that takes a 32-bit arg */
-       while (!(tmp & 0xff)) {
-               offset += 8;
-               tmp >>= 8;
+/* include/linux/byteorder does not support "unsigned long" type */
+static inline unsigned long ext2_swabp(const unsigned long * x)
+{
+#if BITS_PER_LONG == 64
+       return (unsigned long) __swab64p((u64 *) x);
+#elif BITS_PER_LONG == 32
+       return (unsigned long) __swab32p((u32 *) x);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+/* include/linux/byteorder doesn't support "unsigned long" type */
+static inline unsigned long ext2_swab(const unsigned long y)
+{
+#if BITS_PER_LONG == 64
+       return (unsigned long) __swab64((u64) y);
+#elif BITS_PER_LONG == 32
+       return (unsigned long) __swab32((u32) y);
+#else
+#error BITS_PER_LONG not defined
+#endif
+}
+
+unsigned long generic_find_next_zero_le_bit(const unsigned long *addr, unsigned
+               long size, unsigned long offset)
+{
+       const unsigned long *p = addr + BITOP_WORD(offset);
+       unsigned long result = offset & ~(BITS_PER_LONG - 1);
+       unsigned long tmp;
+
+       if (offset >= size)
+               return size;
+       size -= result;
+       offset &= (BITS_PER_LONG - 1UL);
+       if (offset) {
+               tmp = ext2_swabp(p++);
+               tmp |= (~0UL >> (BITS_PER_LONG - offset));
+               if (size < BITS_PER_LONG)
+                       goto found_first;
+               if (~tmp)
+                       goto found_middle;
+               size -= BITS_PER_LONG;
+               result += BITS_PER_LONG;
        }
 
-       while (!(tmp & 1)) {
-               offset++;
-               tmp >>= 1;
+       while (size & ~(BITS_PER_LONG - 1)) {
+               if (~(tmp = *(p++)))
+                       goto found_middle_swap;
+               result += BITS_PER_LONG;
+               size -= BITS_PER_LONG;
        }
+       if (!size)
+               return result;
+       tmp = ext2_swabp(p);
+found_first:
+       tmp |= ~0UL << size;
+       if (tmp == ~0UL)        /* Are any bits zero? */
+               return result + size; /* Nope. Skip ffz */
+found_middle:
+       return result + ffz(tmp);
 
-       return offset;
+found_middle_swap:
+       return result + ffz(ext2_swab(tmp));
 }
+
+EXPORT_SYMBOL(generic_find_next_zero_le_bit);
+
+#endif /* __BIG_ENDIAN */
index 2f7f114..1cdabe3 100644 (file)
@@ -41,7 +41,7 @@ void sha_transform(__u32 *digest, const char *in, __u32 *W)
        __u32 a, b, c, d, e, t, i;
 
        for (i = 0; i < 16; i++)
-               W[i] = be32_to_cpu(((const __u32 *)in)[i]);
+               W[i] = be32_to_cpu(((const __be32 *)in)[i]);
 
        for (i = 0; i < 64; i++)
                W[i+16] = rol32(W[i+13] ^ W[i+8] ^ W[i+2] ^ W[i], 1);
index b73dbb0..5f3b51f 100644 (file)
@@ -6,15 +6,17 @@
 
 #include <linux/kernel.h>
 #include <linux/module.h>
+#include <linux/sort.h>
+#include <linux/slab.h>
 
-void u32_swap(void *a, void *b, int size)
+static void u32_swap(void *a, void *b, int size)
 {
        u32 t = *(u32 *)a;
        *(u32 *)a = *(u32 *)b;
        *(u32 *)b = t;
 }
 
-void generic_swap(void *a, void *b, int size)
+static void generic_swap(void *a, void *b, int size)
 {
        char t;
 
index 6bf134e..d20e3cc 100644 (file)
@@ -8,6 +8,33 @@
  * as published by the Free Software Foundation; either version
  * 2 of the License, or (at your option) any later version.
  */
+#ifndef __MM_INTERNAL_H
+#define __MM_INTERNAL_H
 
-/* page_alloc.c */
-extern void set_page_refs(struct page *page, int order);
+#include <linux/mm.h>
+
+static inline void set_page_count(struct page *page, int v)
+{
+       atomic_set(&page->_count, v);
+}
+
+/*
+ * Turn a non-refcounted page (->_count == 0) into refcounted with
+ * a count of one.
+ */
+static inline void set_page_refcounted(struct page *page)
+{
+       BUG_ON(PageCompound(page) && page_private(page) != (unsigned long)page);
+       BUG_ON(atomic_read(&page->_count));
+       set_page_count(page, 1);
+}
+
+static inline void __put_page(struct page *page)
+{
+       atomic_dec(&page->_count);
+}
+
+extern void fastcall __init __free_pages_bootmem(struct page *page,
+                                               unsigned int order);
+
+#endif
index 11461f7..f4c560b 100644 (file)
@@ -19,7 +19,7 @@ static unsigned long swap_token_check;
 struct mm_struct * swap_token_mm = &init_mm;
 
 #define SWAP_TOKEN_CHECK_INTERVAL (HZ * 2)
-#define SWAP_TOKEN_TIMEOUT     0
+#define SWAP_TOKEN_TIMEOUT     (300 * HZ)
 /*
  * Currently disabled; Needs further code to work at HZ * 300.
  */
@@ -57,14 +57,17 @@ void grab_swap_token(void)
        /* We have the token. Let others know we still need it. */
        if (has_swap_token(current->mm)) {
                current->mm->recent_pagein = 1;
+               if (unlikely(!swap_token_default_timeout))
+                       disable_swap_token();
                return;
        }
 
        if (time_after(jiffies, swap_token_check)) {
 
-               /* Can't get swapout protection if we exceed our RSS limit. */
-               // if (current->mm->rss > current->mm->rlimit_rss)
-               //      return;
+               if (!swap_token_default_timeout) {
+                       swap_token_check = jiffies + SWAP_TOKEN_CHECK_INTERVAL;
+                       return;
+               }
 
                /* ... or if we recently held the token. */
                if (time_before(jiffies, current->mm->swap_token_time))
@@ -95,6 +98,7 @@ void __put_swap_token(struct mm_struct *mm)
 {
        spin_lock(&swap_token_lock);
        if (likely(mm == swap_token_mm)) {
+               mm->swap_token_time = jiffies + SWAP_TOKEN_CHECK_INTERVAL;
                swap_token_mm = &init_mm;
                swap_token_check = jiffies;
        }
index 98cf53c..96bcb2f 100644 (file)
@@ -11,6 +11,7 @@
  *     2 of the License, or (at your option) any later version.
  */
 
+#include <linux/capability.h>
 #include <linux/kernel.h>
 #include <linux/netdevice.h>
 #include <linux/if_bridge.h>
@@ -241,6 +242,54 @@ static ssize_t show_gc_timer(struct class_device *cd, char *buf)
 }
 static CLASS_DEVICE_ATTR(gc_timer, S_IRUGO, show_gc_timer, NULL);
 
+static ssize_t show_group_addr(struct class_device *cd, char *buf)
+{
+       struct net_bridge *br = to_bridge(cd);
+       return sprintf(buf, "%x:%x:%x:%x:%x:%x\n",
+                      br->group_addr[0], br->group_addr[1],
+                      br->group_addr[2], br->group_addr[3],
+                      br->group_addr[4], br->group_addr[5]);
+}
+
+static ssize_t store_group_addr(struct class_device *cd, const char *buf,
+                                   size_t len)
+{
+       struct net_bridge *br = to_bridge(cd);
+       unsigned new_addr[6];
+       int i;
+
+       if (!capable(CAP_NET_ADMIN))
+               return -EPERM;
+
+       if (sscanf(buf, "%x:%x:%x:%x:%x:%x",
+                  &new_addr[0], &new_addr[1], &new_addr[2],
+                  &new_addr[3], &new_addr[4], &new_addr[5]) != 6)
+               return -EINVAL;
+
+       /* Must be 01:80:c2:00:00:0X */
+       for (i = 0; i < 5; i++)
+               if (new_addr[i] != br_group_address[i])
+                       return -EINVAL;
+
+       if (new_addr[5] & ~0xf)
+               return -EINVAL;
+
+       if (new_addr[5] == 1    /* 802.3x Pause address */
+           || new_addr[5] == 2 /* 802.3ad Slow protocols */
+           || new_addr[5] == 3) /* 802.1X PAE address */
+               return -EINVAL;
+
+       spin_lock_bh(&br->lock);
+       for (i = 0; i < 6; i++)
+               br->group_addr[i] = new_addr[i];
+       spin_unlock_bh(&br->lock);
+       return len;
+}
+
+static CLASS_DEVICE_ATTR(group_addr, S_IRUGO | S_IWUSR,
+                        show_group_addr, store_group_addr);
+
+
 static struct attribute *bridge_attrs[] = {
        &class_device_attr_forward_delay.attr,
        &class_device_attr_hello_time.attr,
@@ -258,6 +307,7 @@ static struct attribute *bridge_attrs[] = {
        &class_device_attr_tcn_timer.attr,
        &class_device_attr_topology_change_timer.attr,
        &class_device_attr_gc_timer.attr,
+       &class_device_attr_group_addr.attr,
        NULL
 };
 
index f5909a4..893dae2 100644 (file)
@@ -27,9 +27,10 @@ static inline int match_type(u_int32_t addr, u_int16_t mask)
        return !!(mask & (1 << inet_addr_type(addr)));
 }
 
-static int match(const struct sk_buff *skb, const struct net_device *in,
-                const struct net_device *out, const void *matchinfo,
-                int offset, int *hotdrop)
+static int match(const struct sk_buff *skb,
+                const struct net_device *in, const struct net_device *out,
+                const struct xt_match *match, const void *matchinfo,
+                int offset, unsigned int protoff, int *hotdrop)
 {
        const struct ipt_addrtype_info *info = matchinfo;
        const struct iphdr *iph = skb->nh.iph;
@@ -43,35 +44,22 @@ static int match(const struct sk_buff *skb, const struct net_device *in,
        return ret;
 }
 
-static int checkentry(const char *tablename, const struct ipt_ip *ip,
-                     void *matchinfo, unsigned int matchsize,
-                     unsigned int hook_mask)
-{
-       if (matchsize != IPT_ALIGN(sizeof(struct ipt_addrtype_info))) {
-               printk(KERN_ERR "ipt_addrtype: invalid size (%u != %Zu)\n.",
-                      matchsize, IPT_ALIGN(sizeof(struct ipt_addrtype_info)));
-               return 0;
-       }
-
-       return 1;
-}
-
 static struct ipt_match addrtype_match = {
        .name           = "addrtype",
        .match          = match,
-       .checkentry     = checkentry,
+       .matchsize      = sizeof(struct ipt_addrtype_info),
        .me             = THIS_MODULE
 };
 
-static int __init init(void)
+static int __init ipt_addrtype_init(void)
 {
        return ipt_register_match(&addrtype_match);
 }
 
-static void __exit fini(void)
+static void __exit ipt_addrtype_fini(void)
 {
        ipt_unregister_match(&addrtype_match);
 }
 
-module_init(init);
-module_exit(fini);
+module_init(ipt_addrtype_init);
+module_exit(ipt_addrtype_fini);
index c4d621b..7f9d544 100644 (file)
 # $4 - patchlevel
 
 
-cat << EOF
+test ! -r $2/Makefile -o -O $2/Makefile || exit 0
+echo "  GEN     $2/Makefile"
+
+cat << EOF > $2/Makefile
 # Automatically generated by $0: don't edit
 
 VERSION = $3
@@ -21,11 +24,13 @@ KERNELOUTPUT := $2
 
 MAKEFLAGS += --no-print-directory
 
+.PHONY: all \$(MAKECMDGOALS)
+
 all:
        \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT)
 
-%::
-       \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
+Makefile:;
 
+\$(filter-out all Makefile,\$(MAKECMDGOALS)) %/:
+       \$(MAKE) -C \$(KERNELSRC) O=\$(KERNELOUTPUT) \$@
 EOF
-
index 1112347..8a28756 100644 (file)
@@ -252,9 +252,9 @@ static int parse_comment(const char *file, unsigned long len)
 }
 
 /* FIXME: Handle .s files differently (eg. # starts comments) --RR */
-static int parse_file(const signed char *fname, struct md4_ctx *md)
+static int parse_file(const char *fname, struct md4_ctx *md)
 {
-       signed char *file;
+       char *file;
        unsigned long i, len;
 
        file = grab_file(fname, &len);
@@ -316,8 +316,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
 
        file = grab_file(cmd, &flen);
        if (!file) {
-               fprintf(stderr, "Warning: could not find %s for %s\n",
-                       cmd, objfile);
+               warn("could not find %s for %s\n", cmd, objfile);
                goto out;
        }
 
@@ -332,7 +331,7 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
           Sum all files in the same dir or subdirs.
        */
        while ((line = get_next_line(&pos, file, flen)) != NULL) {
-               signed char* p = line;
+               char* p = line;
                if (strncmp(line, "deps_", sizeof("deps_")-1) == 0) {
                        check_files = 1;
                        continue;
@@ -355,9 +354,8 @@ static int parse_source_files(const char *objfile, struct md4_ctx *md)
                /* Check if this file is in same dir as objfile */
                if ((strstr(line, dir)+strlen(dir)-1) == strrchr(line, '/')) {
                        if (!parse_file(line, md)) {
-                               fprintf(stderr,
-                                       "Warning: could not open %s: %s\n",
-                                       line, strerror(errno));
+                               warn("could not open %s: %s\n",
+                                    line, strerror(errno));
                                goto out_file;
                        }
 
@@ -383,8 +381,11 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
        struct md4_ctx md;
        char *sources, *end, *fname;
        const char *basename;
-       char filelist[strlen(getenv("MODVERDIR")) + strlen("/") +
-                     strlen(modname) - strlen(".o") + strlen(".mod") + 1 ];
+       char filelist[PATH_MAX + 1];
+       char *modverdir = getenv("MODVERDIR");
+
+       if (!modverdir)
+               modverdir = ".";
 
        /* Source files for module are in .tmp_versions/modname.mod,
           after the first line. */
@@ -392,28 +393,25 @@ void get_src_version(const char *modname, char sum[], unsigned sumlen)
                basename = strrchr(modname, '/') + 1;
        else
                basename = modname;
-       sprintf(filelist, "%s/%.*s.mod", getenv("MODVERDIR"),
+       sprintf(filelist, "%s/%.*s.mod", modverdir,
                (int) strlen(basename) - 2, basename);
 
        file = grab_file(filelist, &len);
        if (!file) {
-               fprintf(stderr, "Warning: could not find versions for %s\n",
-                       filelist);
+               warn("could not find versions for %s\n", filelist);
                return;
        }
 
        sources = strchr(file, '\n');
        if (!sources) {
-               fprintf(stderr, "Warning: malformed versions file for %s\n",
-                       modname);
+               warn("malformed versions file for %s\n", modname);
                goto release;
        }
 
        sources++;
        end = strchr(sources, '\n');
        if (!end) {
-               fprintf(stderr, "Warning: bad ending versions file for %s\n",
-                       modname);
+               warn("bad ending versions file for %s\n", modname);
                goto release;
        }
        *end = '\0';
@@ -438,19 +436,19 @@ static void write_version(const char *filename, const char *sum,
 
        fd = open(filename, O_RDWR);
        if (fd < 0) {
-               fprintf(stderr, "Warning: changing sum in %s failed: %s\n",
+               warn("changing sum in %s failed: %s\n",
                        filename, strerror(errno));
                return;
        }
 
        if (lseek(fd, offset, SEEK_SET) == (off_t)-1) {
-               fprintf(stderr, "Warning: changing sum in %s:%lu failed: %s\n",
+               warn("changing sum in %s:%lu failed: %s\n",
                        filename, offset, strerror(errno));
                goto out;
        }
 
        if (write(fd, sum, strlen(sum)+1) != strlen(sum)+1) {
-               fprintf(stderr, "Warning: writing sum in %s failed: %s\n",
+               warn("writing sum in %s failed: %s\n",
                        filename, strerror(errno));
                goto out;
        }
@@ -458,7 +456,7 @@ out:
        close(fd);
 }
 
-static int strip_rcs_crap(signed char *version)
+static int strip_rcs_crap(char *version)
 {
        unsigned int len, full_len;
 
index f8502e7..cbb77c1 100644 (file)
+/* mod-extract.c: module extractor for signing
+ *
+ * Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
+ * Written by David Howells (dhowells@redhat.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 <errno.h>
-#include <error.h>
-#include <fcntl.h>
-#include <stdlib.h>
 #include <stdio.h>
+#include <stdlib.h>
+#include <stdint.h>
+#include <stdarg.h>
 #include <string.h>
-#include <bfd.h>
+#include <unistd.h>
+#include <fcntl.h>
+#include <sys/mman.h>
+#include <sys/stat.h>
+#include <elf.h>
+#include <asm/byteorder.h>
 
-/* This should be set in a Makefile somehow */
-#define TARGET "i686-pc-linux-gnu"
+void extract_elf64(void *buffer, size_t size, Elf64_Ehdr *hdr);
+void extract_elf32(void *buffer, size_t size, Elf32_Ehdr *hdr);
 
-static FILE *out;
+struct byteorder {
+       uint16_t (*get16)(const uint16_t *);
+       uint32_t (*get32)(const uint32_t *);
+       uint64_t (*get64)(const uint64_t *);
+       void (*set16)(uint16_t *, uint16_t);
+       void (*set32)(uint32_t *, uint32_t);
+       void (*set64)(uint64_t *, uint64_t);
+};
 
-static void dump_data(bfd *abfd)
-{
-       asection *section;
-       bfd_byte *data = 0;
-       bfd_size_type size;
-       bfd_size_type addr_offset;
-       bfd_size_type stop_offset;
-       unsigned int opb = bfd_octets_per_byte(abfd);
-       unsigned int cksum;
+uint16_t get16_le(const uint16_t *p) { return __le16_to_cpu(*p); }
+uint32_t get32_le(const uint32_t *p) { return __le32_to_cpu(*p); }
+uint64_t get64_le(const uint64_t *p) { return __le64_to_cpu(*p); }
+uint16_t get16_be(const uint16_t *p) { return __be16_to_cpu(*p); }
+uint32_t get32_be(const uint32_t *p) { return __be32_to_cpu(*p); }
+uint64_t get64_be(const uint64_t *p) { return __be64_to_cpu(*p); }
 
-       for (section = abfd->sections; section != NULL; section = section->next) {
-               if (section->flags & SEC_HAS_CONTENTS) {
-                       if (bfd_section_size(abfd, section) == 0)
-                               continue;
+void set16_le(uint16_t *p, uint16_t n) { *p = __cpu_to_le16(n); }
+void set32_le(uint32_t *p, uint32_t n) { *p = __cpu_to_le32(n); }
+void set64_le(uint64_t *p, uint64_t n) { *p = __cpu_to_le64(n); }
+void set16_be(uint16_t *p, uint16_t n) { *p = __cpu_to_be16(n); }
+void set32_be(uint32_t *p, uint32_t n) { *p = __cpu_to_be32(n); }
+void set64_be(uint64_t *p, uint64_t n) { *p = __cpu_to_be64(n); }
 
-                       /* We only care about sections with "text" or "data" in their names */
-                       if ((strstr(section->name, "text") == NULL) &&
-                           (strstr(section->name, "data") == NULL))
-                               continue;
+const struct byteorder byteorder_le = {
+       get16_le, get32_le, get64_le,
+       set16_le, set32_le, set64_le
+};
+const struct byteorder byteorder_be = {
+       get16_be, get32_be, get64_be,
+       set16_be, set32_be, set64_be
+};
+const struct byteorder *order;
 
-                       cksum = 0;
+uint16_t get16(const uint16_t *p) { return order->get16(p); }
+uint32_t get32(const uint32_t *p) { return order->get32(p); }
+uint64_t get64(const uint64_t *p) { return order->get64(p); }
+void set16(uint16_t *p, uint16_t n) { order->set16(p, n); }
+void set32(uint32_t *p, uint32_t n) { order->set32(p, n); }
+void set64(uint64_t *p, uint64_t n) { order->set64(p, n); }
 
-                       size = bfd_section_size(abfd, section) / opb;
+FILE *outfd;
+uint8_t csum, xcsum;
 
-                       printf("Contents of section %s size %lu", section->name, size);
+void write_out(const void *data, size_t size)
+{
+       const uint8_t *p = data;
+       size_t loop;
 
-                       data = (bfd_byte *) malloc(size);
+       for (loop = 0; loop < size; loop++) {
+               csum += p[loop];
+               xcsum += p[loop];
+       }
 
-                       bfd_get_section_contents(abfd, section, (PTR) data, 0, size);
+       if (fwrite(data, 1, size, outfd) != size) {
+               perror("write");
+               exit(1);
+       }
+}
 
-                       stop_offset = size;
+#define write_out_val(VAL) write_out(&(VAL), sizeof(VAL))
 
-                       printf(" idata %02x%02x%02x%02x", data[0], data[1], data[2], data[3]);
+int is_verbose;
 
-                       for (addr_offset = 0; addr_offset < stop_offset; ++addr_offset) {
-                               cksum += (unsigned int) data[addr_offset];
-                               fputc(data[addr_offset], out);
-                       }
-                       free (data);
+void verbose(const char *fmt, ...) __attribute__((format(printf,1,2)));
+void verbose(const char *fmt, ...)
+{
+       va_list va;
 
-                       printf(" checksum %08x\n", cksum);
-               }
+       if (is_verbose) {
+               va_start(va, fmt);
+               vprintf(fmt, va);
+               va_end(va);
        }
 }
 
-void set_default_bfd_target(void)
+void usage(void) __attribute__((noreturn));
+void usage(void)
 {
-       const char *target = TARGET;
-
-       if (!bfd_set_default_target(target))
-               fprintf(stderr, "can't set BFD default target to `%s': %s", target, bfd_errmsg (bfd_get_error ()));
+       fprintf(stderr, "Usage: mod-extract [-v] <modulefile> <extractfile>\n");
+       exit(2);
 }
 
-int main (int argc, char *argv[])
+/*****************************************************************************/
+/*
+ *
+ */
+int main(int argc, char **argv)
 {
-       char *in_file;
-       char *out_file;
-       bfd *file;
-       char **matching;
+       struct stat st;
+       Elf32_Ehdr *hdr32;
+       Elf64_Ehdr *hdr64;
+       size_t len;
+       void *buffer;
+       int fd, be, b64;
 
-       if (argc != 3) {
-               fprintf(stderr, "%s [infile] [outfile]\n", argv[0]);
-               exit(1);
+       while (argc > 1 && strcmp("-v", argv[1]) == 0) {
+               argv++;
+               argc--;
+               is_verbose++;
        }
 
-       in_file = argv[1];
-       out_file = argv[2];
+       if (argc != 3)
+               usage();
 
-       bfd_init();
-       set_default_bfd_target();
+       /* map the module into memory */
+       fd = open(argv[1], O_RDONLY);
+       if (fd < 0) {
+               perror("open input");
+               exit(1);
+       }
 
+       if (fstat(fd, &st) < 0) {
+               perror("fstat");
+               exit(1);
+       }
 
-//     file = bfd_openr(in_file, "elf32-i386");
-       file = bfd_openr(in_file, NULL);
-       if (file == NULL) {
-               fprintf(stderr, "error \"%s\" trying to open %s\n", strerror(errno), in_file);
+       len = st.st_size;
+
+       buffer = mmap(NULL, len, PROT_READ|PROT_WRITE, MAP_PRIVATE, fd, 0);
+       if (buffer == MAP_FAILED) {
+               perror("mmap");
                exit(1);
        }
 
-       out = fopen(out_file, "w");
-       if (out == NULL) {
-               fprintf(stderr, "error \"%s\" trying to create %s\n", strerror(errno), out_file);
+       if (close(fd) < 0) {
+               perror("close input");
                exit(1);
        }
 
-       if (bfd_check_format_matches(file, bfd_object, &matching)) {
-               dump_data (file);
+       /* check it's an ELF object */
+       hdr32 = buffer;
+       hdr64 = buffer;
+
+       if (hdr32->e_ident[EI_MAG0] != ELFMAG0 ||
+           hdr32->e_ident[EI_MAG1] != ELFMAG1 ||
+           hdr32->e_ident[EI_MAG2] != ELFMAG2 ||
+           hdr32->e_ident[EI_MAG3] != ELFMAG3
+           ) {
+               fprintf(stderr, "Module does not appear to be ELF\n");
+               exit(3);
        }
 
-       fclose(out);
+       /* determine endianness and word size */
+       b64 = (hdr32->e_ident[EI_CLASS] == ELFCLASS64);
+       be = (hdr32->e_ident[EI_DATA] == ELFDATA2MSB);
+       order = be ? &byteorder_be : &byteorder_le;
+
+       verbose("Module is %s-bit %s-endian\n",
+               b64 ? "64" : "32",
+               be ? "big" : "little");
+
+       /* open the output file */
+       outfd = fopen(argv[2], "w");
+       if (!outfd) {
+               perror("open output");
+               exit(1);
+       }
+
+       /* perform the extraction */
+       if (b64)
+               extract_elf64(buffer, len, hdr64);
+       else
+               extract_elf32(buffer, len, hdr32);
+
+       /* done */
+       if (fclose(outfd) == EOF) {
+               perror("close output");
+               exit(1);
+       }
 
        return 0;
-}
+
+} /* end main() */
+
+/*****************************************************************************/
+/*
+ * extract a RELA table
+ * - need to canonicalise the entries in case section addition/removal has
+ *   rearranged the symbol table and the section table
+ */
+void extract_elf64_rela(const void *buffer, int secix, int targetix,
+                       const Elf64_Rela *relatab, size_t nrels,
+                       const Elf64_Sym *symbols, size_t nsyms,
+                       const Elf64_Shdr *sections, size_t nsects, int *canonmap,
+                       const char *strings, size_t nstrings,
+                       const char *sh_name)
+{
+       struct {
+               uint64_t        r_offset;
+               uint64_t        r_addend;
+               uint64_t        st_value;
+               uint64_t        st_size;
+               uint32_t        r_type;
+               uint16_t        st_shndx;
+               uint8_t         st_info;
+               uint8_t         st_other;
+
+       } __attribute__((packed)) relocation;
+
+       const Elf64_Sym *symbol;
+       size_t loop;
+
+       /* contribute the relevant bits from a join of { RELA, SYMBOL, SECTION } */
+       for (loop = 0; loop < nrels; loop++) {
+               Elf64_Section st_shndx;
+               Elf64_Xword r_info;
+
+               /* decode the relocation */
+               r_info = get64(&relatab[loop].r_info);
+               relocation.r_offset = relatab[loop].r_offset;
+               relocation.r_addend = relatab[loop].r_addend;
+               set32(&relocation.r_type, ELF64_R_TYPE(r_info));
+
+               if (ELF64_R_SYM(r_info) >= nsyms) {
+                       fprintf(stderr, "Invalid symbol ID %lx in relocation %zu\n",
+                               ELF64_R_SYM(r_info), loop);
+                       exit(1);
+               }
+
+               /* decode the symbol referenced by the relocation */
+               symbol = &symbols[ELF64_R_SYM(r_info)];
+               relocation.st_info = symbol->st_info;
+               relocation.st_other = symbol->st_other;
+               relocation.st_value = symbol->st_value;
+               relocation.st_size = symbol->st_size;
+               relocation.st_shndx = symbol->st_shndx;
+               st_shndx = get16(&symbol->st_shndx);
+
+               /* canonicalise the section used by the symbol */
+               if (st_shndx > SHN_UNDEF && st_shndx < nsects)
+                       set16(&relocation.st_shndx, canonmap[st_shndx]);
+
+               write_out_val(relocation);
+
+               /* undefined symbols must be named if referenced */
+               if (st_shndx == SHN_UNDEF) {
+                       const char *name = strings + get32(&symbol->st_name);
+                       write_out(name, strlen(name) + 1);
+               }
+       }
+
+       verbose("%02x %4d %s [canon]\n", csum, secix, sh_name);
+
+} /* end extract_elf64_rela() */
+
+/*****************************************************************************/
+/*
+ * extract a REL table
+ * - need to canonicalise the entries in case section addition/removal has
+ *   rearranged the symbol table and the section table
+ */
+void extract_elf64_rel(const void *buffer, int secix, int targetix,
+                      const Elf64_Rel *relatab, size_t nrels,
+                      const Elf64_Sym *symbols, size_t nsyms,
+                      const Elf64_Shdr *sections, size_t nsects, int *canonmap,
+                      const char *strings, size_t nstrings,
+                      const char *sh_name)
+{
+       struct {
+               uint64_t        r_offset;
+               uint64_t        st_value;
+               uint64_t        st_size;
+               uint32_t        r_type;
+               uint16_t        st_shndx;
+               uint8_t         st_info;
+               uint8_t         st_other;
+
+       } __attribute__((packed)) relocation;
+
+       const Elf64_Sym *symbol;
+       size_t loop;
+
+       /* contribute the relevant bits from a join of { RELA, SYMBOL, SECTION } */
+       for (loop = 0; loop < nrels; loop++) {
+               Elf64_Section st_shndx;
+               Elf64_Xword r_info;
+
+               /* decode the relocation */
+               r_info = get64(&relatab[loop].r_info);
+               relocation.r_offset = relatab[loop].r_offset;
+               set32(&relocation.r_type, ELF64_R_TYPE(r_info));
+
+               if (ELF64_R_SYM(r_info) >= nsyms) {
+                       fprintf(stderr, "Invalid symbol ID %lx in relocation %zi\n",
+                               ELF64_R_SYM(r_info), loop);
+                       exit(1);
+               }
+
+               /* decode the symbol referenced by the relocation */
+               symbol = &symbols[ELF64_R_SYM(r_info)];
+               relocation.st_info = symbol->st_info;
+               relocation.st_other = symbol->st_other;
+               relocation.st_value = symbol->st_value;
+               relocation.st_size = symbol->st_size;
+               relocation.st_shndx = symbol->st_shndx;
+               st_shndx = get16(&symbol->st_shndx);
+
+               /* canonicalise the section used by the symbol */
+               if (st_shndx > SHN_UNDEF && st_shndx < nsects)
+                       set16(&relocation.st_shndx, canonmap[st_shndx]);
+
+               write_out_val(relocation);
+
+               /* undefined symbols must be named if referenced */
+               if (st_shndx == SHN_UNDEF) {
+                       const char *name = strings + get32(&symbol->st_name);
+                       write_out(name, strlen(name) + 1);
+               }
+       }
+
+       verbose("%02x %4d %s [canon]\n", csum, secix, sh_name);
+
+} /* end extract_elf64_rel() */
+
+/*****************************************************************************/
+/*
+ * extract the data from a 64-bit module
+ */
+void extract_elf64(void *buffer, size_t len, Elf64_Ehdr *hdr)
+{
+       const Elf64_Sym *symbols;
+       Elf64_Shdr *sections;
+       const char *secstrings, *strings;
+       size_t nsyms, nstrings;
+       int loop, shnum, *canonlist, *canonmap, canon, changed, tmp;
+
+       sections = buffer + get64(&hdr->e_shoff);
+       secstrings = buffer + get64(&sections[get16(&hdr->e_shstrndx)].sh_offset);
+       shnum = get16(&hdr->e_shnum);
+
+       /* find the symbol table and the string table and produce a list of
+        * index numbers of sections that contribute to the kernel's module
+        * image
+        */
+       canonlist = calloc(sizeof(int), shnum * 2);
+       if (!canonlist) {
+               perror("calloc");
+               exit(1);
+       }
+       canonmap = canonlist + shnum;
+       canon = 0;
+
+       symbols = NULL;
+       strings = NULL;
+
+       for (loop = 1; loop < shnum; loop++) {
+               const char *sh_name = secstrings + get32(&sections[loop].sh_name);
+               Elf64_Word  sh_type     = get32(&sections[loop].sh_type);
+               Elf64_Xword sh_size     = get64(&sections[loop].sh_size);
+               Elf64_Xword sh_flags    = get64(&sections[loop].sh_flags);
+               Elf64_Off   sh_offset   = get64(&sections[loop].sh_offset);
+               void *data = buffer + sh_offset;
+
+               /* quick sanity check */
+               if (sh_type != SHT_NOBITS && len < sh_offset + sh_size) {
+                       fprintf(stderr, "Section goes beyond EOF\n");
+                       exit(3);
+               }
+
+               /* we only need to canonicalise allocatable sections */
+               if (sh_flags & SHF_ALLOC)
+                       canonlist[canon++] = loop;
+
+               /* keep track of certain special sections */
+               switch (sh_type) {
+               case SHT_SYMTAB:
+                       if (strcmp(sh_name, ".symtab") == 0) {
+                               symbols = data;
+                               nsyms = sh_size / sizeof(Elf64_Sym);
+                       }
+                       break;
+
+               case SHT_STRTAB:
+                       if (strcmp(sh_name, ".strtab") == 0) {
+                               strings = data;
+                               nstrings = sh_size;
+                       }
+                       break;
+
+               default:
+                       break;
+               }
+       }
+
+       if (!symbols) {
+               fprintf(stderr, "Couldn't locate symbol table\n");
+               exit(3);
+       }
+
+       if (!strings) {
+               fprintf(stderr, "Couldn't locate strings table\n");
+               exit(3);
+       }
+
+       /* canonicalise the index numbers of the contributing section */
+       do {
+               changed = 0;
+
+               for (loop = 0; loop < canon - 1; loop++) {
+                       const char *x = secstrings + get32(&sections[canonlist[loop + 0]].sh_name);
+                       const char *y = secstrings + get32(&sections[canonlist[loop + 1]].sh_name);
+                       if (strcmp(x, y) > 0) {
+                               tmp = canonlist[loop + 0];
+                               canonlist[loop + 0] = canonlist[loop + 1];
+                               canonlist[loop + 1] = tmp;
+                               changed = 1;
+                       }
+               }
+
+       } while(changed);
+
+       for (loop = 0; loop < canon; loop++)
+               canonmap[canonlist[loop]] = loop + 1;
+
+       if (is_verbose > 1) {
+               printf("\nSection canonicalisation map:\n");
+               for (loop = 1; loop < shnum; loop++) {
+                       const char *x = secstrings + get32(&sections[loop].sh_name);
+                       printf("%4d %s\n", canonmap[loop], x);
+               }
+
+               printf("\nAllocated section list in canonical order:\n");
+               for (loop = 0; loop < canon; loop++) {
+                       const char *x = secstrings + get32(&sections[canonlist[loop]].sh_name);
+                       printf("%4d %s\n", canonlist[loop], x);
+               }
+       }
+
+       memset(canonlist, 0, sizeof(int) * shnum);
+
+       /* iterate through the section table looking for sections we want to
+        * contribute to the signature */
+       verbose("\n");
+       verbose("FILE POS CS SECT NAME\n");
+       verbose("======== == ==== ==============================\n");
+
+       for (loop = 1; loop < shnum; loop++) {
+               const char *sh_name = secstrings + get32(&sections[loop].sh_name);
+               Elf64_Word  sh_type     = get32(&sections[loop].sh_type);
+               Elf64_Xword sh_size     = get64(&sections[loop].sh_size);
+               Elf64_Xword sh_flags    = get64(&sections[loop].sh_flags);
+               Elf64_Word  sh_info     = get32(&sections[loop].sh_info);
+               Elf64_Off   sh_offset   = get64(&sections[loop].sh_offset);
+               void *data = buffer + sh_offset;
+
+               csum = 0;
+
+               /* include canonicalised relocation sections */
+               if (sh_type == SHT_REL || sh_type == SHT_RELA) {
+                       if (sh_info <= 0 && sh_info >= hdr->e_shnum) {
+                               fprintf(stderr,
+                                       "Invalid ELF - REL/RELA sh_info does"
+                                       " not refer to a valid section\n");
+                               exit(3);
+                       }
+
+                       if (canonlist[sh_info]) {
+                               Elf32_Word xsh_info;
+
+                               verbose("%08lx ", ftell(outfd));
+
+                               set32(&xsh_info, canonmap[sh_info]);
+
+                               /* write out selected portions of the section
+                                * header */
+                               write_out(sh_name, strlen(sh_name));
+                               write_out_val(sections[loop].sh_type);
+                               write_out_val(sections[loop].sh_flags);
+                               write_out_val(sections[loop].sh_size);
+                               write_out_val(sections[loop].sh_addralign);
+                               write_out_val(xsh_info);
+
+                               if (sh_type == SHT_RELA)
+                                       extract_elf64_rela(buffer, loop, sh_info,
+                                                          data, sh_size / sizeof(Elf64_Rela),
+                                                          symbols, nsyms,
+                                                          sections, shnum, canonmap,
+                                                          strings, nstrings,
+                                                          sh_name);
+                               else
+                                       extract_elf64_rel(buffer, loop, sh_info,
+                                                         data, sh_size / sizeof(Elf64_Rel),
+                                                         symbols, nsyms,
+                                                         sections, shnum, canonmap,
+                                                         strings, nstrings,
+                                                         sh_name);
+                       }
+
+                       continue;
+               }
+
+               /* include allocatable loadable sections */
+               if (sh_type != SHT_NOBITS && sh_flags & SHF_ALLOC)
+                       goto include_section;
+
+               /* not this section */
+               continue;
+
+       include_section:
+               verbose("%08lx ", ftell(outfd));
+
+               /* write out selected portions of the section header */
+               write_out(sh_name, strlen(sh_name));
+               write_out_val(sections[loop].sh_type);
+               write_out_val(sections[loop].sh_flags);
+               write_out_val(sections[loop].sh_size);
+               write_out_val(sections[loop].sh_addralign);
+
+               /* write out the section data */
+               write_out(data, sh_size);
+
+               verbose("%02x %4d %s\n", csum, loop, sh_name);
+
+               /* note the section has been written */
+               canonlist[loop] = 1;
+       }
+
+       verbose("%08lx         (%lu bytes csum 0x%02x)\n",
+               ftell(outfd), ftell(outfd), xcsum);
+
+} /* end extract_elf64() */
+
+/*****************************************************************************/
+/*
+ * extract a RELA table
+ * - need to canonicalise the entries in case section addition/removal has
+ *   rearranged the symbol table and the section table
+ */
+void extract_elf32_rela(const void *buffer, int secix, int targetix,
+                       const Elf32_Rela *relatab, size_t nrels,
+                       const Elf32_Sym *symbols, size_t nsyms,
+                       const Elf32_Shdr *sections, size_t nsects, int *canonmap,
+                       const char *strings, size_t nstrings,
+                       const char *sh_name)
+{
+       struct {
+               uint32_t        r_offset;
+               uint32_t        r_addend;
+               uint32_t        st_value;
+               uint32_t        st_size;
+               uint16_t        st_shndx;
+               uint8_t         r_type;
+               uint8_t         st_info;
+               uint8_t         st_other;
+
+       } __attribute__((packed)) relocation;
+
+       const Elf32_Sym *symbol;
+       size_t loop;
+
+       /* contribute the relevant bits from a join of { RELA, SYMBOL, SECTION } */
+       for (loop = 0; loop < nrels; loop++) {
+               Elf32_Section st_shndx;
+               Elf32_Word r_info;
+
+               /* decode the relocation */
+               r_info = get32(&relatab[loop].r_info);
+               relocation.r_offset = relatab[loop].r_offset;
+               relocation.r_addend = relatab[loop].r_addend;
+               relocation.r_type = ELF32_R_TYPE(r_info);
+
+               if (ELF32_R_SYM(r_info) >= nsyms) {
+                       fprintf(stderr, "Invalid symbol ID %x in relocation %zu\n",
+                               ELF32_R_SYM(r_info), loop);
+                       exit(1);
+               }
+
+               /* decode the symbol referenced by the relocation */
+               symbol = &symbols[ELF32_R_SYM(r_info)];
+               relocation.st_info = symbol->st_info;
+               relocation.st_other = symbol->st_other;
+               relocation.st_value = symbol->st_value;
+               relocation.st_size = symbol->st_size;
+               relocation.st_shndx = symbol->st_shndx;
+               st_shndx = get16(&symbol->st_shndx);
+
+               /* canonicalise the section used by the symbol */
+               if (st_shndx > SHN_UNDEF && st_shndx < nsects)
+                       set16(&relocation.st_shndx, canonmap[st_shndx]);
+
+               write_out_val(relocation);
+
+               /* undefined symbols must be named if referenced */
+               if (st_shndx == SHN_UNDEF) {
+                       const char *name = strings + get32(&symbol->st_name);
+                       write_out(name, strlen(name) + 1);
+               }
+       }
+
+       verbose("%02x %4d %s [canon]\n", csum, secix, sh_name);
+
+} /* end extract_elf32_rela() */
+
+/*****************************************************************************/
+/*
+ * extract a REL table
+ * - need to canonicalise the entries in case section addition/removal has
+ *   rearranged the symbol table and the section table
+ */
+void extract_elf32_rel(const void *buffer, int secix, int targetix,
+                      const Elf32_Rel *relatab, size_t nrels,
+                      const Elf32_Sym *symbols, size_t nsyms,
+                      const Elf32_Shdr *sections, size_t nsects, int *canonmap,
+                      const char *strings, size_t nstrings,
+                      const char *sh_name)
+{
+       struct {
+               uint32_t        r_offset;
+               uint32_t        st_value;
+               uint32_t        st_size;
+               uint16_t        st_shndx;
+               uint8_t         r_type;
+               uint8_t         st_info;
+               uint8_t         st_other;
+
+       } __attribute__((packed)) relocation;
+
+       const Elf32_Sym *symbol;
+       size_t loop;
+
+       /* contribute the relevant bits from a join of { RELA, SYMBOL, SECTION } */
+       for (loop = 0; loop < nrels; loop++) {
+               Elf32_Section st_shndx;
+               Elf32_Word r_info;
+
+               /* decode the relocation */
+               r_info = get32(&relatab[loop].r_info);
+               relocation.r_offset = relatab[loop].r_offset;
+               relocation.r_type = ELF32_R_TYPE(r_info);
+
+               if (ELF32_R_SYM(r_info) >= nsyms) {
+                       fprintf(stderr, "Invalid symbol ID %x in relocation %zu\n",
+                               ELF32_R_SYM(r_info), loop);
+                       exit(1);
+               }
+
+               /* decode the symbol referenced by the relocation */
+               symbol = &symbols[ELF32_R_SYM(r_info)];
+               relocation.st_info = symbol->st_info;
+               relocation.st_other = symbol->st_other;
+               relocation.st_value = symbol->st_value;
+               relocation.st_size = symbol->st_size;
+               relocation.st_shndx = symbol->st_shndx;
+               st_shndx = get16(&symbol->st_shndx);
+
+               /* canonicalise the section used by the symbol */
+               if (st_shndx > SHN_UNDEF && st_shndx < nsects)
+                       set16(&relocation.st_shndx, canonmap[st_shndx]);
+               
+               write_out_val(relocation);
+
+               /* undefined symbols must be named if referenced */
+               if (st_shndx == SHN_UNDEF) {
+                       const char *name = strings + get32(&symbol->st_name);
+                       write_out(name, strlen(name) + 1);
+               }
+       }
+
+       verbose("%02x %4d %s [canon]\n", csum, secix, sh_name);
+
+} /* end extract_elf32_rel() */
+
+/*****************************************************************************/
+/*
+ * extract the data from a 32-bit module
+ */
+void extract_elf32(void *buffer, size_t len, Elf32_Ehdr *hdr)
+{
+       const Elf32_Sym *symbols;
+       Elf32_Shdr *sections;
+       const char *secstrings, *strings;
+       size_t nsyms, nstrings;
+       int loop, shnum, *canonlist, *canonmap, canon, changed, tmp;
+
+       sections = buffer + get32(&hdr->e_shoff);
+       secstrings = buffer + get32(&sections[get16(&hdr->e_shstrndx)].sh_offset);
+       shnum = get16(&hdr->e_shnum);
+
+       /* find the symbol table and the string table and produce a list of
+        * index numbers of sections that contribute to the kernel's module
+        * image
+        */
+       canonlist = calloc(sizeof(int), shnum * 2);
+       if (!canonlist) {
+               perror("calloc");
+               exit(1);
+       }
+       canonmap = canonlist + shnum;
+       canon = 0;
+
+       symbols = NULL;
+       strings = NULL;
+
+       for (loop = 1; loop < shnum; loop++) {
+               const char *sh_name = secstrings + get32(&sections[loop].sh_name);
+               Elf32_Word  sh_type     = get32(&sections[loop].sh_type);
+               Elf32_Xword sh_size     = get32(&sections[loop].sh_size);
+               Elf32_Xword sh_flags    = get32(&sections[loop].sh_flags);
+               Elf32_Off   sh_offset   = get32(&sections[loop].sh_offset);
+               void *data = buffer + sh_offset;
+
+               /* quick sanity check */
+               if (sh_type != SHT_NOBITS && len < sh_offset + sh_size) {
+                       fprintf(stderr, "Section goes beyond EOF\n");
+                       exit(3);
+               }
+
+               /* we only need to canonicalise allocatable sections */
+               if (sh_flags & SHF_ALLOC)
+                       canonlist[canon++] = loop;
+
+               /* keep track of certain special sections */
+               switch (sh_type) {
+               case SHT_SYMTAB:
+                       if (strcmp(sh_name, ".symtab") == 0) {
+                               symbols = data;
+                               nsyms = sh_size / sizeof(Elf32_Sym);
+                       }
+                       break;
+
+               case SHT_STRTAB:
+                       if (strcmp(sh_name, ".strtab") == 0) {
+                               strings = data;
+                               nstrings = sh_size;
+                       }
+                       break;
+
+               default:
+                       break;
+               }
+       }
+
+       if (!symbols) {
+               fprintf(stderr, "Couldn't locate symbol table\n");
+               exit(3);
+       }
+
+       if (!strings) {
+               fprintf(stderr, "Couldn't locate strings table\n");
+               exit(3);
+       }
+
+       /* canonicalise the index numbers of the contributing section */
+       do {
+               changed = 0;
+
+               for (loop = 0; loop < canon - 1; loop++) {
+                       const char *x = secstrings + get32(&sections[canonlist[loop + 0]].sh_name);
+                       const char *y = secstrings + get32(&sections[canonlist[loop + 1]].sh_name);
+                       if (strcmp(x, y) > 0) {
+                               tmp = canonlist[loop + 0];
+                               canonlist[loop + 0] = canonlist[loop + 1];
+                               canonlist[loop + 1] = tmp;
+                               changed = 1;
+                       }
+               }
+
+       } while(changed);
+
+       for (loop = 0; loop < canon; loop++)
+               canonmap[canonlist[loop]] = loop + 1;
+
+       if (is_verbose > 1) {
+               printf("\nSection canonicalisation map:\n");
+               for (loop = 1; loop < shnum; loop++) {
+                       const char *x = secstrings + get32(&sections[loop].sh_name);
+                       printf("%4d %s\n", canonmap[loop], x);
+               }
+
+               printf("\nAllocated section list in canonical order:\n");
+               for (loop = 0; loop < canon; loop++) {
+                       const char *x = secstrings + get32(&sections[canonlist[loop]].sh_name);
+                       printf("%4d %s\n", canonlist[loop], x);
+               }
+       }
+
+       memset(canonlist, 0, sizeof(int) * shnum);
+
+       /* iterate through the section table looking for sections we want to
+        * contribute to the signature */
+       verbose("\n");
+       verbose("FILE POS CS SECT NAME\n");
+       verbose("======== == ==== ==============================\n");
+
+       for (loop = 1; loop < shnum; loop++) {
+               const char *sh_name = secstrings + get32(&sections[loop].sh_name);
+               Elf32_Word  sh_type     = get32(&sections[loop].sh_type);
+               Elf32_Xword sh_size     = get32(&sections[loop].sh_size);
+               Elf32_Xword sh_flags    = get32(&sections[loop].sh_flags);
+               Elf32_Word  sh_info     = get32(&sections[loop].sh_info);
+               Elf32_Off   sh_offset   = get32(&sections[loop].sh_offset);
+               void *data = buffer + sh_offset;
+
+               csum = 0;
+
+               /* quick sanity check */
+               if (sh_type != SHT_NOBITS && len < sh_offset + sh_size) {
+                       fprintf(stderr, "section goes beyond EOF\n");
+                       exit(3);
+               }
+
+               /* include canonicalised relocation sections */
+               if (sh_type == SHT_REL || sh_type == SHT_RELA) {
+                       if (sh_info <= 0 && sh_info >= hdr->e_shnum) {
+                               fprintf(stderr,
+                                       "Invalid ELF - REL/RELA sh_info does"
+                                       " not refer to a valid section\n");
+                               exit(3);
+                       }
+
+                       if (canonlist[sh_info]) {
+                               Elf32_Word xsh_info;
+
+                               verbose("%08lx ", ftell(outfd));
+
+                               set32(&xsh_info, canonmap[sh_info]);
+
+                               /* write out selected portions of the section header */
+                               write_out(sh_name, strlen(sh_name));
+                               write_out_val(sections[loop].sh_type);
+                               write_out_val(sections[loop].sh_flags);
+                               write_out_val(sections[loop].sh_size);
+                               write_out_val(sections[loop].sh_addralign);
+                               write_out_val(xsh_info);
+
+                               if (sh_type == SHT_RELA)
+                                       extract_elf32_rela(buffer, loop, sh_info,
+                                                          data, sh_size / sizeof(Elf32_Rela),
+                                                          symbols, nsyms,
+                                                          sections, shnum, canonmap,
+                                                          strings, nstrings,
+                                                          sh_name);
+                               else
+                                       extract_elf32_rel(buffer, loop, sh_info,
+                                                         data, sh_size / sizeof(Elf32_Rel),
+                                                         symbols, nsyms,
+                                                         sections, shnum, canonmap,
+                                                         strings, nstrings,
+                                                         sh_name);
+                       }
+
+                       continue;
+               }
+
+               /* include allocatable loadable sections */
+               if (sh_type != SHT_NOBITS && sh_flags & SHF_ALLOC)
+                       goto include_section;
+
+               /* not this section */
+               continue;
+
+       include_section:
+               verbose("%08lx ", ftell(outfd));
+
+               /* write out selected portions of the section header */
+               write_out(sh_name, strlen(sh_name));
+               write_out_val(sections[loop].sh_type);
+               write_out_val(sections[loop].sh_flags);
+               write_out_val(sections[loop].sh_size);
+               write_out_val(sections[loop].sh_addralign);
+
+               /* write out the section data */
+               write_out(data, sh_size);
+
+               verbose("%02x %4d %s\n", csum, loop, sh_name);
+
+               /* note the section has been written */
+               canonlist[loop] = 1;
+       }
+
+       verbose("%08lx         (%lu bytes csum 0x%02x)\n",
+               ftell(outfd), ftell(outfd), xcsum);
+
+} /* end extract_elf32() */
index 4d3eaa2..588cac0 100644 (file)
@@ -1,35 +1,57 @@
 #!/bin/bash
+###############################################################################
+#
+# Copyright (C) 2004 Red Hat, Inc. All Rights Reserved.
+# Written by David Howells (dhowells@redhat.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.
+#
+###############################################################################
 
+verbose=
+
+if [ $# -gt 1 -a "x$1" = "x-v" ]
+    then
+    verbose=-v
+    shift
+fi
 
-if [ $# = "0" ] ; then
+if [ $# = 0 ]
+    then
        echo
-#      echo "usage: $0 <module_to_sign> <key_name>"
-       echo "usage: $0 <module_to_sign>"
+       echo "usage: $0 [-v] <module_to_sign> [<key_name>]"
        echo
        exit 1
 fi
 
 module=$1
-#key=$2
+
+if [ -z "$KEYFLAGS" ]
+    then
+    KEYFLAGS="--no-default-keyring --secret-keyring ../kernel.sec --keyring ../kernel.pub"
+fi
+
+if [ $# -eq 2 ]
+    then
+    KEYFLAGS="$KEYFLAGS --default-key $2"
+fi
 
 # strip out only the sections that we care about
-sh scripts/modsign/mod-extract.sh $module $module.out
+scripts/modsign/mod-extract $verbose $module $module.out || exit $?
 
 # sign the sections
-#gpg --no-greeting --default-key $key -b $module.out
-gpg --no-greeting --no-default-keyring --secret-keyring ../kernel.sec --keyring ../kernel.pub -b $module.out
+gpg --no-greeting $KEYFLAGS -b $module.out || exit $?
 
 # check the signature
 #gpg --verify rxrpc.ko.out.sig rxrpc.ko.out
 
 ## sha1 the sections
 #sha1sum $module.out | awk "{print \$1}" > $module.sha1
-#
-## encrypt the sections
-#gpg --no-greeting -e -o - -r $key $module.sha1 > $module.crypt
 
 # add the encrypted data to the module
-#objcopy --add-section module_sig=$module.crypt $module $module.signed
-objcopy --add-section module_sig=$module.out.sig $module $module.signed
-objcopy --set-section-flags module_sig=alloc $module.signed
+objcopy --add-section .module_sig=$module.out.sig $module $module.signed || exit $?
+objcopy --set-section-flags .module_sig=alloc $module.signed || exit $?
 rm -f $module.out*
index 3b1f2ef..7c434e0 100644 (file)
@@ -32,12 +32,11 @@ MKSPEC     := $(srctree)/scripts/package/mkspec
 PREV       := set -e; cd ..;
 
 # rpm-pkg
-.PHONY: rpm-pkg rpm
-
+# ---------------------------------------------------------------------------
 $(objtree)/kernel.spec: $(MKSPEC) $(srctree)/Makefile
        $(CONFIG_SHELL) $(MKSPEC) > $@
 
-rpm-pkg rpm: $(objtree)/kernel.spec
+rpm-pkg rpm: $(objtree)/kernel.spec FORCE
        $(MAKE) clean
        $(PREV) ln -sf $(srctree) $(KERNELPATH)
        $(PREV) tar -cz $(RCS_TAR_IGNORE) -f $(KERNELPATH).tar.gz $(KERNELPATH)/.
@@ -54,12 +53,12 @@ rpm-pkg rpm: $(objtree)/kernel.spec
 clean-files := $(objtree)/kernel.spec
 
 # binrpm-pkg
-.PHONY: binrpm-pkg
+# ---------------------------------------------------------------------------
 $(objtree)/binkernel.spec: $(MKSPEC) $(srctree)/Makefile
        $(CONFIG_SHELL) $(MKSPEC) prebuilt > $@
-       
-binrpm-pkg: $(objtree)/binkernel.spec
-       $(MAKE)
+
+binrpm-pkg: $(objtree)/binkernel.spec FORCE
+       $(MAKE) KBUILD_SRC=
        set -e; \
        $(CONFIG_SHELL) $(srctree)/scripts/mkversion > $(objtree)/.tmp_version
        set -e; \
@@ -71,19 +70,30 @@ clean-files += $(objtree)/binkernel.spec
 
 # Deb target
 # ---------------------------------------------------------------------------
-#
-.PHONY: deb-pkg
-deb-pkg:
-       $(MAKE)
+deb-pkg: FORCE
+       $(MAKE) KBUILD_SRC=
        $(CONFIG_SHELL) $(srctree)/scripts/package/builddeb
 
 clean-dirs += $(objtree)/debian/
 
 
+# tarball targets
+# ---------------------------------------------------------------------------
+tar%pkg: FORCE
+       $(MAKE) KBUILD_SRC=
+       $(CONFIG_SHELL) $(srctree)/scripts/package/buildtar $@
+
+clean-dirs += $(objtree)/tar-install/
+
+
 # Help text displayed when executing 'make help'
 # ---------------------------------------------------------------------------
-help:
-       @echo  '  rpm-pkg         - Build the kernel as an RPM package'
-       @echo  '  binrpm-pkg      - Build an rpm package containing the compiled kernel & modules'
-       @echo  '  deb-pkg         - Build the kernel as an deb package'
+help: FORCE
+       @echo '  rpm-pkg         - Build the kernel as an RPM package'
+       @echo '  binrpm-pkg      - Build an rpm package containing the compiled kernel'
+       @echo '                    and modules'
+       @echo '  deb-pkg         - Build the kernel as an deb package'
+       @echo '  tar-pkg         - Build the kernel as an uncompressed tarball'
+       @echo '  targz-pkg       - Build the kernel as a gzip compressed tarball'
+       @echo '  tarbz2-pkg      - Build the kernel as a bzip2 compressed tarball'
 
index 7fdabea..3c0161b 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <linux/compat.h>
 
-struct sndrv_ctl_elem_list32 {
+struct snd_ctl_elem_list32 {
        u32 offset;
        u32 space;
        u32 used;
@@ -31,9 +31,10 @@ struct sndrv_ctl_elem_list32 {
        unsigned char reserved[50];
 } /* don't set packed attribute here */;
 
-static int snd_ctl_elem_list_compat(snd_card_t *card, struct sndrv_ctl_elem_list32 __user *data32)
+static int snd_ctl_elem_list_compat(struct snd_card *card,
+                                   struct snd_ctl_elem_list32 __user *data32)
 {
-       struct sndrv_ctl_elem_list __user *data;
+       struct snd_ctl_elem_list __user *data;
        compat_caddr_t ptr;
        int err;
 
@@ -60,8 +61,8 @@ static int snd_ctl_elem_list_compat(snd_card_t *card, struct sndrv_ctl_elem_list
  * it uses union, so the things are not easy..
  */
 
-struct sndrv_ctl_elem_info32 {
-       struct sndrv_ctl_elem_id id; // the size of struct is same
+struct snd_ctl_elem_info32 {
+       struct snd_ctl_elem_id id; // the size of struct is same
        s32 type;
        u32 access;
        u32 count;
@@ -87,12 +88,13 @@ struct sndrv_ctl_elem_info32 {
        unsigned char reserved[64];
 } __attribute__((packed));
 
-static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_info32 __user *data32)
+static int snd_ctl_elem_info_compat(struct snd_ctl_file *ctl,
+                                   struct snd_ctl_elem_info32 __user *data32)
 {
-       struct sndrv_ctl_elem_info *data;
+       struct snd_ctl_elem_info *data;
        int err;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (! data)
                return -ENOMEM;
 
@@ -105,7 +107,13 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i
         */
        if (get_user(data->value.enumerated.item, &data32->value.enumerated.item))
                goto error;
-       err = snd_ctl_elem_info(ctl, data);
+
+       snd_power_lock(ctl->card);
+       err = snd_power_wait(ctl->card, SNDRV_CTL_POWER_D0);
+       if (err >= 0)
+               err = snd_ctl_elem_info(ctl, data);
+       snd_power_unlock(ctl->card);
+
        if (err < 0)
                goto error;
        /* restore info to 32bit */
@@ -146,8 +154,8 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i
 }
 
 /* read / write */
-struct sndrv_ctl_elem_value32 {
-       struct sndrv_ctl_elem_id id;
+struct snd_ctl_elem_value32 {
+       struct snd_ctl_elem_id id;
        unsigned int indirect;  /* bit-field causes misalignment */
         union {
                s32 integer[128];
@@ -161,10 +169,11 @@ struct sndrv_ctl_elem_value32 {
 
 
 /* get the value type and count of the control */
-static int get_ctl_type(snd_card_t *card, snd_ctl_elem_id_t *id, int *countp)
+static int get_ctl_type(struct snd_card *card, struct snd_ctl_elem_id *id,
+                       int *countp)
 {
-       snd_kcontrol_t *kctl;
-       snd_ctl_elem_info_t info;
+       struct snd_kcontrol *kctl;
+       struct snd_ctl_elem_info *info;
        int err;
 
        down_read(&card->controls_rwsem);
@@ -173,13 +182,19 @@ static int get_ctl_type(snd_card_t *card, snd_ctl_elem_id_t *id, int *countp)
                up_read(&card->controls_rwsem);
                return -ENXIO;
        }
-       info.id = *id;
-       err = kctl->info(kctl, &info);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
+       if (info == NULL) {
+               up_read(&card->controls_rwsem);
+               return -ENOMEM;
+       }
+       info->id = *id;
+       err = kctl->info(kctl, info);
        up_read(&card->controls_rwsem);
        if (err >= 0) {
-               err = info.type;
-               *countp = info.count;
+               err = info->type;
+               *countp = info->count;
        }
+       kfree(info);
        return err;
 }
 
@@ -193,15 +208,15 @@ static int get_elem_size(int type, int count)
        case SNDRV_CTL_ELEM_TYPE_BYTES:
                return 512;
        case SNDRV_CTL_ELEM_TYPE_IEC958:
-               return sizeof(struct sndrv_aes_iec958);
+               return sizeof(struct snd_aes_iec958);
        default:
                return -1;
        }
 }
 
-static int copy_ctl_value_from_user(snd_card_t *card,
-                                   struct sndrv_ctl_elem_value *data,
-                                   struct sndrv_ctl_elem_value32 __user *data32,
+static int copy_ctl_value_from_user(struct snd_card *card,
+                                   struct snd_ctl_elem_value *data,
+                                   struct snd_ctl_elem_value32 __user *data32,
                                    int *typep, int *countp)
 {
        int i, type, count, size;
@@ -242,8 +257,8 @@ static int copy_ctl_value_from_user(snd_card_t *card,
 }
 
 /* restore the value to 32bit */
-static int copy_ctl_value_to_user(struct sndrv_ctl_elem_value32 __user *data32,
-                                 struct sndrv_ctl_elem_value *data,
+static int copy_ctl_value_to_user(struct snd_ctl_elem_value32 __user *data32,
+                                 struct snd_ctl_elem_value *data,
                                  int type, int count)
 {
        int i, size;
@@ -265,55 +280,66 @@ static int copy_ctl_value_to_user(struct sndrv_ctl_elem_value32 __user *data32,
        return 0;
 }
 
-static int snd_ctl_elem_read_user_compat(snd_card_t *card, 
-                                        struct sndrv_ctl_elem_value32 __user *data32)
+static int snd_ctl_elem_read_user_compat(struct snd_card *card, 
+                                        struct snd_ctl_elem_value32 __user *data32)
 {
-       struct sndrv_ctl_elem_value *data;
+       struct snd_ctl_elem_value *data;
        int err, type, count;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
        if ((err = copy_ctl_value_from_user(card, data, data32, &type, &count)) < 0)
                goto error;
-       if ((err = snd_ctl_elem_read(card, data)) < 0)
-               goto error;
-       err = copy_ctl_value_to_user(data32, data, type, count);
+
+       snd_power_lock(card);
+       err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
+       if (err >= 0)
+               err = snd_ctl_elem_read(card, data);
+       snd_power_unlock(card);
+       if (err >= 0)
+               err = copy_ctl_value_to_user(data32, data, type, count);
  error:
        kfree(data);
        return err;
 }
 
-static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file,
-                                         struct sndrv_ctl_elem_value32 __user *data32)
+static int snd_ctl_elem_write_user_compat(struct snd_ctl_file *file,
+                                         struct snd_ctl_elem_value32 __user *data32)
 {
-       struct sndrv_ctl_elem_value *data;
+       struct snd_ctl_elem_value *data;
+       struct snd_card *card = file->card;
        int err, type, count;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
-       if ((err = copy_ctl_value_from_user(file->card, data, data32, &type, &count)) < 0)
-               goto error;
-       if ((err = snd_ctl_elem_write(file->card, file, data)) < 0)
+       if ((err = copy_ctl_value_from_user(card, data, data32, &type, &count)) < 0)
                goto error;
-       err = copy_ctl_value_to_user(data32, data, type, count);
+
+       snd_power_lock(card);
+       err = snd_power_wait(card, SNDRV_CTL_POWER_D0);
+       if (err >= 0)
+               err = snd_ctl_elem_write(card, file, data);
+       snd_power_unlock(card);
+       if (err >= 0)
+               err = copy_ctl_value_to_user(data32, data, type, count);
  error:
        kfree(data);
        return err;
 }
 
 /* add or replace a user control */
-static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
-                                  struct sndrv_ctl_elem_info32 __user *data32,
+static int snd_ctl_elem_add_compat(struct snd_ctl_file *file,
+                                  struct snd_ctl_elem_info32 __user *data32,
                                   int replace)
 {
-       struct sndrv_ctl_elem_info *data;
+       struct snd_ctl_elem_info *data;
        int err;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (! data)
                return -ENOMEM;
 
@@ -355,17 +381,17 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
 }  
 
 enum {
-       SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct sndrv_ctl_elem_list32),
-       SNDRV_CTL_IOCTL_ELEM_INFO32 = _IOWR('U', 0x11, struct sndrv_ctl_elem_info32),
-       SNDRV_CTL_IOCTL_ELEM_READ32 = _IOWR('U', 0x12, struct sndrv_ctl_elem_value32),
-       SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct sndrv_ctl_elem_value32),
-       SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct sndrv_ctl_elem_info32),
-       SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct sndrv_ctl_elem_info32),
+       SNDRV_CTL_IOCTL_ELEM_LIST32 = _IOWR('U', 0x10, struct snd_ctl_elem_list32),
+       SNDRV_CTL_IOCTL_ELEM_INFO32 = _IOWR('U', 0x11, struct snd_ctl_elem_info32),
+       SNDRV_CTL_IOCTL_ELEM_READ32 = _IOWR('U', 0x12, struct snd_ctl_elem_value32),
+       SNDRV_CTL_IOCTL_ELEM_WRITE32 = _IOWR('U', 0x13, struct snd_ctl_elem_value32),
+       SNDRV_CTL_IOCTL_ELEM_ADD32 = _IOWR('U', 0x17, struct snd_ctl_elem_info32),
+       SNDRV_CTL_IOCTL_ELEM_REPLACE32 = _IOWR('U', 0x18, struct snd_ctl_elem_info32),
 };
 
 static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, unsigned long arg)
 {
-       snd_ctl_file_t *ctl;
+       struct snd_ctl_file *ctl;
        struct list_head *list;
        void __user *argp = compat_ptr(arg);
        int err;
@@ -398,7 +424,7 @@ static inline long snd_ctl_ioctl_compat(struct file *file, unsigned int cmd, uns
 
        down_read(&snd_ioctl_rwsem);
        list_for_each(list, &snd_control_compat_ioctls) {
-               snd_kctl_ioctl_t *p = list_entry(list, snd_kctl_ioctl_t, list);
+               struct snd_kctl_ioctl *p = list_entry(list, struct snd_kctl_ioctl, list);
                if (p->fioctl) {
                        err = p->fioctl(ctl->card, ctl, cmd, arg);
                        if (err != -ENOIOCTLCMD) {
index 6866f42..938f775 100644 (file)
@@ -22,7 +22,7 @@
 
 #include <linux/compat.h>
 
-struct sndrv_hwdep_dsp_image32 {
+struct snd_hwdep_dsp_image32 {
        u32 index;
        unsigned char name[64];
        u32 image;      /* pointer */
@@ -30,10 +30,10 @@ struct sndrv_hwdep_dsp_image32 {
        u32 driver_data;
 } /* don't set packed attribute here */;
 
-static int snd_hwdep_dsp_load_compat(snd_hwdep_t *hw,
-                                    struct sndrv_hwdep_dsp_image32 __user *src)
+static int snd_hwdep_dsp_load_compat(struct snd_hwdep *hw,
+                                    struct snd_hwdep_dsp_image32 __user *src)
 {
-       struct sndrv_hwdep_dsp_image *dst;
+       struct snd_hwdep_dsp_image *dst;
        compat_caddr_t ptr;
        u32 val;
 
@@ -56,12 +56,13 @@ static int snd_hwdep_dsp_load_compat(snd_hwdep_t *hw,
 }
 
 enum {
-       SNDRV_HWDEP_IOCTL_DSP_LOAD32   = _IOW('H', 0x03, struct sndrv_hwdep_dsp_image32)
+       SNDRV_HWDEP_IOCTL_DSP_LOAD32   = _IOW('H', 0x03, struct snd_hwdep_dsp_image32)
 };
 
-static long snd_hwdep_ioctl_compat(struct file * file, unsigned int cmd, unsigned long arg)
+static long snd_hwdep_ioctl_compat(struct file * file, unsigned int cmd,
+                                  unsigned long arg)
 {
-       snd_hwdep_t *hw = file->private_data;
+       struct snd_hwdep *hw = file->private_data;
        void __user *argp = compat_ptr(arg);
        switch (cmd) {
        case SNDRV_HWDEP_IOCTL_PVERSION:
index f5e6018..12ffffc 100644 (file)
@@ -37,7 +37,7 @@ MODULE_LICENSE("GPL");
 
 static void ak4114_stats(void *);
 
-static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char val)
+static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char val)
 {
        ak4114->write(ak4114->private_data, reg, val);
        if (reg <= AK4114_REG_INT1_MASK)
@@ -46,23 +46,23 @@ static void reg_write(ak4114_t *ak4114, unsigned char reg, unsigned char val)
                ak4114->txcsb[reg-AK4114_REG_RXCSB0] = val;
 }
 
-static inline unsigned char reg_read(ak4114_t *ak4114, unsigned char reg)
+static inline unsigned char reg_read(struct ak4114 *ak4114, unsigned char reg)
 {
        return ak4114->read(ak4114->private_data, reg);
 }
 
 #if 0
-static void reg_dump(ak4114_t *ak4114)
+static void reg_dump(struct ak4114 *ak4114)
 {
        int i;
 
-       printk("AK4114 REG DUMP:\n");
+       printk(KERN_DEBUG "AK4114 REG DUMP:\n");
        for (i = 0; i < 0x20; i++)
-               printk("reg[%02x] = %02x (%02x)\n", i, reg_read(ak4114, i), i < sizeof(ak4114->regmap) ? ak4114->regmap[i] : 0);
+               printk(KERN_DEBUG "reg[%02x] = %02x (%02x)\n", i, reg_read(ak4114, i), i < sizeof(ak4114->regmap) ? ak4114->regmap[i] : 0);
 }
 #endif
 
-static void snd_ak4114_free(ak4114_t *chip)
+static void snd_ak4114_free(struct ak4114 *chip)
 {
        chip->init = 1; /* don't schedule new work */
        mb();
@@ -73,26 +73,26 @@ static void snd_ak4114_free(ak4114_t *chip)
        kfree(chip);
 }
 
-static int snd_ak4114_dev_free(snd_device_t *device)
+static int snd_ak4114_dev_free(struct snd_device *device)
 {
-       ak4114_t *chip = device->device_data;
+       struct ak4114 *chip = device->device_data;
        snd_ak4114_free(chip);
        return 0;
 }
 
-int snd_ak4114_create(snd_card_t *card,
+int snd_ak4114_create(struct snd_card *card,
                      ak4114_read_t *read, ak4114_write_t *write,
                      unsigned char pgm[7], unsigned char txcsb[5],
-                     void *private_data, ak4114_t **r_ak4114)
+                     void *private_data, struct ak4114 **r_ak4114)
 {
-       ak4114_t *chip;
+       struct ak4114 *chip;
        int err = 0;
        unsigned char reg;
-       static snd_device_ops_t ops = {
+       static struct snd_device_ops ops = {
                .dev_free =     snd_ak4114_dev_free,
        };
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        spin_lock_init(&chip->lock);
@@ -129,7 +129,7 @@ int snd_ak4114_create(snd_card_t *card,
        return err < 0 ? err : -EIO;
 }
 
-void snd_ak4114_reg_write(ak4114_t *chip, unsigned char reg, unsigned char mask, unsigned char val)
+void snd_ak4114_reg_write(struct ak4114 *chip, unsigned char reg, unsigned char mask, unsigned char val)
 {
        if (reg <= AK4114_REG_INT1_MASK)
                reg_write(chip, reg, (chip->regmap[reg] & ~mask) | val);
@@ -137,7 +137,7 @@ void snd_ak4114_reg_write(ak4114_t *chip, unsigned char reg, unsigned char mask,
                reg_write(chip, reg, (chip->txcsb[reg] & ~mask) | val);
 }
 
-void snd_ak4114_reinit(ak4114_t *chip)
+void snd_ak4114_reinit(struct ak4114 *chip)
 {
        unsigned char old = chip->regmap[AK4114_REG_PWRDN], reg;
 
@@ -176,8 +176,8 @@ static unsigned int external_rate(unsigned char rcs1)
        }
 }
 
-static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol,
-                                   snd_ctl_elem_info_t *uinfo)
+static int snd_ak4114_in_error_info(struct snd_kcontrol *kcontrol,
+                                   struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 1;
@@ -186,10 +186,10 @@ static int snd_ak4114_in_error_info(snd_kcontrol_t *kcontrol,
        return 0;
 }
 
-static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol,
-                                  snd_ctl_elem_value_t *ucontrol)
+static int snd_ak4114_in_error_get(struct snd_kcontrol *kcontrol,
+                                  struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
        long *ptr;
 
        spin_lock_irq(&chip->lock);
@@ -200,8 +200,8 @@ static int snd_ak4114_in_error_get(snd_kcontrol_t *kcontrol,
        return 0;
 }
 
-static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol,
-                                 snd_ctl_elem_info_t *uinfo)
+static int snd_ak4114_in_bit_info(struct snd_kcontrol *kcontrol,
+                                 struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
        uinfo->count = 1;
@@ -210,10 +210,10 @@ static int snd_ak4114_in_bit_info(snd_kcontrol_t *kcontrol,
        return 0;
 }
 
-static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol,
-                                snd_ctl_elem_value_t *ucontrol)
+static int snd_ak4114_in_bit_get(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
        unsigned char reg = kcontrol->private_value & 0xff;
        unsigned char bit = (kcontrol->private_value >> 8) & 0xff;
        unsigned char inv = (kcontrol->private_value >> 31) & 1;
@@ -222,8 +222,8 @@ static int snd_ak4114_in_bit_get(snd_kcontrol_t *kcontrol,
        return 0;
 }
 
-static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol,
-                               snd_ctl_elem_info_t *uinfo)
+static int snd_ak4114_rate_info(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->count = 1;
@@ -232,26 +232,26 @@ static int snd_ak4114_rate_info(snd_kcontrol_t *kcontrol,
        return 0;
 }
 
-static int snd_ak4114_rate_get(snd_kcontrol_t *kcontrol,
-                              snd_ctl_elem_value_t *ucontrol)
+static int snd_ak4114_rate_get(struct snd_kcontrol *kcontrol,
+                              struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
 
        ucontrol->value.integer.value[0] = external_rate(reg_read(chip, AK4114_REG_RCS1));
        return 0;
 }
 
-static int snd_ak4114_spdif_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ak4114_spdif_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
        uinfo->count = 1;
        return 0;
 }
 
-static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol,
-                               snd_ctl_elem_value_t * ucontrol)
+static int snd_ak4114_spdif_get(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
        unsigned i;
 
        for (i = 0; i < AK4114_REG_RXCSB_SIZE; i++)
@@ -259,10 +259,10 @@ static int snd_ak4114_spdif_get(snd_kcontrol_t * kcontrol,
        return 0;
 }
 
-static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol,
-                                        snd_ctl_elem_value_t * ucontrol)
+static int snd_ak4114_spdif_playback_get(struct snd_kcontrol *kcontrol,
+                                        struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
        unsigned i;
 
        for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++)
@@ -270,10 +270,10 @@ static int snd_ak4114_spdif_playback_get(snd_kcontrol_t * kcontrol,
        return 0;
 }
 
-static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol,
-                                        snd_ctl_elem_value_t * ucontrol)
+static int snd_ak4114_spdif_playback_put(struct snd_kcontrol *kcontrol,
+                                        struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
        unsigned i;
 
        for (i = 0; i < AK4114_REG_TXCSB_SIZE; i++)
@@ -281,21 +281,21 @@ static int snd_ak4114_spdif_playback_put(snd_kcontrol_t * kcontrol,
        return 0;
 }
 
-static int snd_ak4114_spdif_mask_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ak4114_spdif_mask_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_IEC958;
        uinfo->count = 1;
        return 0;
 }
 
-static int snd_ak4114_spdif_mask_get(snd_kcontrol_t * kcontrol,
-                                     snd_ctl_elem_value_t * ucontrol)
+static int snd_ak4114_spdif_mask_get(struct snd_kcontrol *kcontrol,
+                                     struct snd_ctl_elem_value *ucontrol)
 {
        memset(ucontrol->value.iec958.status, 0xff, AK4114_REG_RXCSB_SIZE);
        return 0;
 }
 
-static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ak4114_spdif_pinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
        uinfo->value.integer.min = 0;
@@ -304,10 +304,10 @@ static int snd_ak4114_spdif_pinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t
        return 0;
 }
 
-static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol,
-                                snd_ctl_elem_value_t * ucontrol)
+static int snd_ak4114_spdif_pget(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
        unsigned short tmp;
 
        ucontrol->value.integer.value[0] = 0xf8f2;
@@ -319,17 +319,17 @@ static int snd_ak4114_spdif_pget(snd_kcontrol_t * kcontrol,
        return 0;
 }
 
-static int snd_ak4114_spdif_qinfo(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_ak4114_spdif_qinfo(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        uinfo->type = SNDRV_CTL_ELEM_TYPE_BYTES;
        uinfo->count = AK4114_REG_QSUB_SIZE;
        return 0;
 }
 
-static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol,
-                                snd_ctl_elem_value_t * ucontrol)
+static int snd_ak4114_spdif_qget(struct snd_kcontrol *kcontrol,
+                                struct snd_ctl_elem_value *ucontrol)
 {
-       ak4114_t *chip = snd_kcontrol_chip(kcontrol);
+       struct ak4114 *chip = snd_kcontrol_chip(kcontrol);
        unsigned i;
 
        for (i = 0; i < AK4114_REG_QSUB_SIZE; i++)
@@ -338,14 +338,14 @@ static int snd_ak4114_spdif_qget(snd_kcontrol_t * kcontrol,
 }
 
 /* Don't forget to change AK4114_CONTROLS define!!! */
-static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
+static struct snd_kcontrol_new snd_ak4114_iec958_controls[] = {
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
        .name =         "IEC958 Parity Errors",
        .access =       SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
        .info =         snd_ak4114_in_error_info,
        .get =          snd_ak4114_in_error_get,
-       .private_value = offsetof(ak4114_t, parity_errors),
+       .private_value = offsetof(struct ak4114, parity_errors),
 },
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
@@ -353,7 +353,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
        .access =       SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
        .info =         snd_ak4114_in_error_info,
        .get =          snd_ak4114_in_error_get,
-       .private_value = offsetof(ak4114_t, v_bit_errors),
+       .private_value = offsetof(struct ak4114, v_bit_errors),
 },
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
@@ -361,7 +361,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
        .access =       SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
        .info =         snd_ak4114_in_error_info,
        .get =          snd_ak4114_in_error_get,
-       .private_value = offsetof(ak4114_t, ccrc_errors),
+       .private_value = offsetof(struct ak4114, ccrc_errors),
 },
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
@@ -369,7 +369,7 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
        .access =       SNDRV_CTL_ELEM_ACCESS_READ | SNDRV_CTL_ELEM_ACCESS_VOLATILE,
        .info =         snd_ak4114_in_error_info,
        .get =          snd_ak4114_in_error_get,
-       .private_value = offsetof(ak4114_t, qcrc_errors),
+       .private_value = offsetof(struct ak4114, qcrc_errors),
 },
 {
        .iface =        SNDRV_CTL_ELEM_IFACE_PCM,
@@ -447,11 +447,11 @@ static snd_kcontrol_new_t snd_ak4114_iec958_controls[] = {
 }
 };
 
-int snd_ak4114_build(ak4114_t *ak4114,
-                    snd_pcm_substream_t *ply_substream,
-                    snd_pcm_substream_t *cap_substream)
+int snd_ak4114_build(struct ak4114 *ak4114,
+                    struct snd_pcm_substream *ply_substream,
+                    struct snd_pcm_substream *cap_substream)
 {
-       snd_kcontrol_t *kctl;
+       struct snd_kcontrol *kctl;
        unsigned int idx;
        int err;
 
@@ -482,7 +482,7 @@ int snd_ak4114_build(ak4114_t *ak4114,
        return 0;
 }
 
-int snd_ak4114_external_rate(ak4114_t *ak4114)
+int snd_ak4114_external_rate(struct ak4114 *ak4114)
 {
        unsigned char rcs1;
 
@@ -490,9 +490,9 @@ int snd_ak4114_external_rate(ak4114_t *ak4114)
        return external_rate(rcs1);
 }
 
-int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags)
+int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags)
 {
-       snd_pcm_runtime_t *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL;
+       struct snd_pcm_runtime *runtime = ak4114->capture_substream ? ak4114->capture_substream->runtime : NULL;
        unsigned long _flags;
        int res = 0;
        unsigned char rcs0, rcs1;
@@ -552,9 +552,8 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags)
        if (!(flags & AK4114_CHECK_NO_RATE) && runtime && runtime->rate != res) {
                snd_pcm_stream_lock_irqsave(ak4114->capture_substream, _flags);
                if (snd_pcm_running(ak4114->capture_substream)) {
-                       // printk("rate changed (%i <- %i)\n", runtime->rate, res);
+                       // printk(KERN_DEBUG "rate changed (%i <- %i)\n", runtime->rate, res);
                        snd_pcm_stop(ak4114->capture_substream, SNDRV_PCM_STATE_DRAINING);
-                       wake_up(&runtime->sleep);
                        res = 1;
                }
                snd_pcm_stream_unlock_irqrestore(ak4114->capture_substream, _flags);
@@ -564,7 +563,7 @@ int snd_ak4114_check_rate_and_errors(ak4114_t *ak4114, unsigned int flags)
 
 static void ak4114_stats(void *data)
 {
-       ak4114_t *chip = (ak4114_t *)data;
+       struct ak4114 *chip = (struct ak4114 *)data;
 
        if (chip->init)
                return;
index d03cb2f..9905651 100644 (file)
@@ -1,7 +1,7 @@
 /*
  *  Copyright (c) by James Courtier-Dutton <James@superbug.demon.co.uk>
  *  Driver p16v chips
- *  Version: 0.22
+ *  Version: 0.25
  *
  *  FEATURES currently supported:
  *    Output fixed at S32_LE, 2 channel to hw:0,0
  *    Integrated with snd-emu10k1 driver.
  *  0.22
  *    Removed #if 0 ... #endif
- *
+ *  0.23
+ *    Implement different capture rates.
+ *  0.24
+ *    Implement different capture source channels.
+ *    e.g. When HD Capture source is set to SPDIF,
+ *    setting HD Capture channel to 0 captures from CDROM digital input.
+ *    setting HD Capture channel to 1 captures from SPDIF in.
+ *  0.25
+ *    Include capture buffer sizes.
  *
  *  BUGS:
  *    Some stability problems when unloading the snd-p16v kernel module.
@@ -85,6 +93,7 @@
 #include <linux/interrupt.h>
 #include <linux/pci.h>
 #include <linux/slab.h>
+#include <linux/vmalloc.h>
 #include <linux/moduleparam.h>
 #include <sound/core.h>
 #include <sound/initval.h>
 #define PCM_FRONT_CHANNEL 0
 #define PCM_REAR_CHANNEL 1
 #define PCM_CENTER_LFE_CHANNEL 2
-#define PCM_UNKNOWN_CHANNEL 3
+#define PCM_SIDE_CHANNEL 3
 #define CONTROL_FRONT_CHANNEL 0
 #define CONTROL_REAR_CHANNEL 3
 #define CONTROL_CENTER_LFE_CHANNEL 1
-#define CONTROL_UNKNOWN_CHANNEL 2
+#define CONTROL_SIDE_CHANNEL 2
 
 /* Card IDs:
  * Class 0401: 1102:0004 (rev 04) Subsystem: 1102:2002 -> Audigy2 ZS 7.1 Model:SB0350
  */
 
  /* hardware definition */
-static snd_pcm_hardware_t snd_p16v_playback_hw = {
+static struct snd_pcm_hardware snd_p16v_playback_hw = {
        .info =                 (SNDRV_PCM_INFO_MMAP | 
                                 SNDRV_PCM_INFO_INTERLEAVED |
                                 SNDRV_PCM_INFO_BLOCK_TRANSFER |
+                                SNDRV_PCM_INFO_RESUME |
                                 SNDRV_PCM_INFO_MMAP_VALID),
        .formats =              SNDRV_PCM_FMTBIT_S32_LE, /* Only supports 24-bit samples padded to 32 bits. */
-       .rates =                SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 ,
-       .rate_min =             48000,
+       .rates =                SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100, 
+       .rate_min =             44100,
        .rate_max =             192000,
        .channels_min =         8, 
        .channels_max =         8,
-       .buffer_bytes_max =     (32*1024),
+       .buffer_bytes_max =     ((65536 - 64) * 8),
        .period_bytes_min =     64,
-       .period_bytes_max =     (16*1024),
+       .period_bytes_max =     (65536 - 64),
        .periods_min =          2,
        .periods_max =          8,
        .fifo_size =            0,
 };
 
-static void snd_p16v_pcm_free_substream(snd_pcm_runtime_t *runtime)
+static struct snd_pcm_hardware snd_p16v_capture_hw = {
+       .info =                 (SNDRV_PCM_INFO_MMAP |
+                                SNDRV_PCM_INFO_INTERLEAVED |
+                                SNDRV_PCM_INFO_BLOCK_TRANSFER |
+                                SNDRV_PCM_INFO_RESUME |
+                                SNDRV_PCM_INFO_MMAP_VALID),
+       .formats =              SNDRV_PCM_FMTBIT_S32_LE,
+       .rates =                SNDRV_PCM_RATE_192000 | SNDRV_PCM_RATE_96000 | SNDRV_PCM_RATE_48000 | SNDRV_PCM_RATE_44100, 
+       .rate_min =             44100,
+       .rate_max =             192000,
+       .channels_min =         2,
+       .channels_max =         2,
+       .buffer_bytes_max =     (65536 - 64),
+       .period_bytes_min =     64,
+       .period_bytes_max =     (65536 - 128) >> 1,  /* size has to be N*64 bytes */
+       .periods_min =          2,
+       .periods_max =          2,
+       .fifo_size =            0,
+};
+
+static void snd_p16v_pcm_free_substream(struct snd_pcm_runtime *runtime)
 {
-       snd_pcm_t *epcm = runtime->private_data;
+       struct snd_emu10k1_pcm *epcm = runtime->private_data;
   
        if (epcm) {
                //snd_printk("epcm free: %p\n", epcm);
@@ -143,15 +173,15 @@ static void snd_p16v_pcm_free_substream(snd_pcm_runtime_t *runtime)
 }
 
 /* open_playback callback */
-static int snd_p16v_pcm_open_playback_channel(snd_pcm_substream_t *substream, int channel_id)
+static int snd_p16v_pcm_open_playback_channel(struct snd_pcm_substream *substream, int channel_id)
 {
-       emu10k1_t *emu = snd_pcm_substream_chip(substream);
-        emu10k1_voice_t *channel = &(emu->p16v_voices[channel_id]);
-       emu10k1_pcm_t *epcm;
-       snd_pcm_runtime_t *runtime = substream->runtime;
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+        struct snd_emu10k1_voice *channel = &(emu->p16v_voices[channel_id]);
+       struct snd_emu10k1_pcm *epcm;
+       struct snd_pcm_runtime *runtime = substream->runtime;
        int err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
         //snd_printk("epcm kcalloc: %p\n", epcm);
 
        if (epcm == NULL)
@@ -178,53 +208,120 @@ static int snd_p16v_pcm_open_playback_channel(snd_pcm_substream_t *substream, in
 
        return 0;
 }
+/* open_capture callback */
+static int snd_p16v_pcm_open_capture_channel(struct snd_pcm_substream *substream, int channel_id)
+{
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       struct snd_emu10k1_voice *channel = &(emu->p16v_capture_voice);
+       struct snd_emu10k1_pcm *epcm;
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       int err;
+
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
+       //snd_printk("epcm kcalloc: %p\n", epcm);
+
+       if (epcm == NULL)
+               return -ENOMEM;
+       epcm->emu = emu;
+       epcm->substream = substream;
+       //snd_printk("epcm device=%d, channel_id=%d\n", substream->pcm->device, channel_id);
+
+       runtime->private_data = epcm;
+       runtime->private_free = snd_p16v_pcm_free_substream;
+  
+       runtime->hw = snd_p16v_capture_hw;
+
+       channel->emu = emu;
+       channel->number = channel_id;
+
+       channel->use=1;
+       //snd_printk("p16v: open channel_id=%d, channel=%p, use=0x%x\n", channel_id, channel, channel->use);
+       //printk("open:channel_id=%d, chip=%p, channel=%p\n",channel_id, chip, channel);
+       //channel->interrupt = snd_p16v_pcm_channel_interrupt;
+       channel->epcm=epcm;
+       if ((err = snd_pcm_hw_constraint_integer(runtime, SNDRV_PCM_HW_PARAM_PERIODS)) < 0)
+               return err;
+
+       return 0;
+}
+
+
+/* close callback */
+static int snd_p16v_pcm_close_playback(struct snd_pcm_substream *substream)
+{
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       //struct snd_pcm_runtime *runtime = substream->runtime;
+       //struct snd_emu10k1_pcm *epcm = runtime->private_data;
+       emu->p16v_voices[substream->pcm->device - emu->p16v_device_offset].use=0;
+       /* FIXME: maybe zero others */
+       return 0;
+}
 
 /* close callback */
-static int snd_p16v_pcm_close_playback(snd_pcm_substream_t *substream)
+static int snd_p16v_pcm_close_capture(struct snd_pcm_substream *substream)
 {
-       emu10k1_t *emu = snd_pcm_substream_chip(substream);
-       //snd_pcm_runtime_t *runtime = substream->runtime;
-        //emu10k1_pcm_t *epcm = runtime->private_data;
-        emu->p16v_voices[substream->pcm->device - emu->p16v_device_offset].use=0;
-/* FIXME: maybe zero others */
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       //struct snd_pcm_runtime *runtime = substream->runtime;
+       //struct snd_emu10k1_pcm *epcm = runtime->private_data;
+       emu->p16v_capture_voice.use=0;
+       /* FIXME: maybe zero others */
        return 0;
 }
 
-static int snd_p16v_pcm_open_playback_front(snd_pcm_substream_t *substream)
+static int snd_p16v_pcm_open_playback_front(struct snd_pcm_substream *substream)
 {
        return snd_p16v_pcm_open_playback_channel(substream, PCM_FRONT_CHANNEL);
 }
 
+static int snd_p16v_pcm_open_capture(struct snd_pcm_substream *substream)
+{
+       // Only using channel 0 for now, but the card has 2 channels.
+       return snd_p16v_pcm_open_capture_channel(substream, 0);
+}
+
+/* hw_params callback */
+static int snd_p16v_pcm_hw_params_playback(struct snd_pcm_substream *substream,
+                                     struct snd_pcm_hw_params *hw_params)
+{
+       int result;
+       result = snd_pcm_lib_malloc_pages(substream,
+                                       params_buffer_bytes(hw_params));
+       return result;
+}
+
 /* hw_params callback */
-static int snd_p16v_pcm_hw_params_playback(snd_pcm_substream_t *substream,
-                                     snd_pcm_hw_params_t * hw_params)
+static int snd_p16v_pcm_hw_params_capture(struct snd_pcm_substream *substream,
+                                     struct snd_pcm_hw_params *hw_params)
 {
        int result;
-        //snd_printk("hw_params alloc: substream=%p\n", substream);
        result = snd_pcm_lib_malloc_pages(substream,
                                        params_buffer_bytes(hw_params));
-        //snd_printk("hw_params alloc: result=%d\n", result);
-       //dump_stack();
+       return result;
+}
+
+
+/* hw_free callback */
+static int snd_p16v_pcm_hw_free_playback(struct snd_pcm_substream *substream)
+{
+       int result;
+       result = snd_pcm_lib_free_pages(substream);
        return result;
 }
 
 /* hw_free callback */
-static int snd_p16v_pcm_hw_free_playback(snd_pcm_substream_t *substream)
+static int snd_p16v_pcm_hw_free_capture(struct snd_pcm_substream *substream)
 {
        int result;
-        //snd_printk("hw_params free: substream=%p\n", substream);
        result = snd_pcm_lib_free_pages(substream);
-        //snd_printk("hw_params free: result=%d\n", result);
-       //dump_stack();
        return result;
 }
 
+
 /* prepare playback callback */
-static int snd_p16v_pcm_prepare_playback(snd_pcm_substream_t *substream)
+static int snd_p16v_pcm_prepare_playback(struct snd_pcm_substream *substream)
 {
-       emu10k1_t *emu = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
-       //emu10k1_pcm_t *epcm = runtime->private_data;
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
        int channel = substream->pcm->device - emu->p16v_device_offset;
        u32 *table_base = (u32 *)(emu->p16v_buffer.area+(8*16*channel));
        u32 period_size_bytes = frames_to_bytes(runtime, runtime->period_size);
@@ -237,23 +334,21 @@ static int snd_p16v_pcm_prepare_playback(snd_pcm_substream_t *substream)
        tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);
         switch (runtime->rate) {
        case 44100:
-         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe000) | 0x8000); /* FIXME: This will change the capture rate as well! */
-         break;
-       case 48000:
-         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe000) | 0x0000); /* FIXME: This will change the capture rate as well! */
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x8080);
          break;
        case 96000:
-         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe000) | 0x4000); /* FIXME: This will change the capture rate as well! */
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x4040);
          break;
        case 192000:
-         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe000) | 0x2000); /* FIXME: This will change the capture rate as well! */
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x2020);
          break;
+       case 48000:
        default:
-         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, 0x0000); /* FIXME: This will change the capture rate as well! */
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0xe0e0) | 0x0000);
          break;
        }
        /* FIXME: Check emu->buffer.size before actually writing to it. */
-        for(i=0; i < runtime->periods; i++) {
+       for(i=0; i < runtime->periods; i++) {
                table_base[i*2]=runtime->dma_addr+(i*period_size_bytes);
                table_base[(i*2)+1]=period_size_bytes<<16;
        }
@@ -262,7 +357,8 @@ static int snd_p16v_pcm_prepare_playback(snd_pcm_substream_t *substream)
        snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_SIZE, channel, (runtime->periods - 1) << 19);
        snd_emu10k1_ptr20_write(emu, PLAYBACK_LIST_PTR, channel, 0);
        snd_emu10k1_ptr20_write(emu, PLAYBACK_DMA_ADDR, channel, runtime->dma_addr);
-       snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, frames_to_bytes(runtime, runtime->period_size)<<16); // buffer size in bytes
+       //snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, frames_to_bytes(runtime, runtime->period_size)<<16); // buffer size in bytes
+       snd_emu10k1_ptr20_write(emu, PLAYBACK_PERIOD_SIZE, channel, 0); // buffer size in bytes
        snd_emu10k1_ptr20_write(emu, PLAYBACK_POINTER, channel, 0);
        snd_emu10k1_ptr20_write(emu, 0x07, channel, 0x0);
        snd_emu10k1_ptr20_write(emu, 0x08, channel, 0);
@@ -270,7 +366,42 @@ static int snd_p16v_pcm_prepare_playback(snd_pcm_substream_t *substream)
        return 0;
 }
 
-static void snd_p16v_intr_enable(emu10k1_t *emu, unsigned int intrenb)
+/* prepare capture callback */
+static int snd_p16v_pcm_prepare_capture(struct snd_pcm_substream *substream)
+{
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       int channel = substream->pcm->device - emu->p16v_device_offset;
+       u32 tmp;
+       //printk("prepare capture:channel_number=%d, rate=%d, format=0x%x, channels=%d, buffer_size=%ld, period_size=%ld, frames_to_bytes=%d\n",channel, runtime->rate, runtime->format, runtime->channels, runtime->buffer_size, runtime->period_size,  frames_to_bytes(runtime, 1));
+       tmp = snd_emu10k1_ptr_read(emu, A_SPDIF_SAMPLERATE, channel);
+        switch (runtime->rate) {
+       case 44100:
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0800);
+         break;
+       case 96000:
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0400);
+         break;
+       case 192000:
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0200);
+         break;
+       case 48000:
+       default:
+         snd_emu10k1_ptr_write(emu, A_SPDIF_SAMPLERATE, channel, (tmp & ~0x0e00) | 0x0000);
+         break;
+       }
+       /* FIXME: Check emu->buffer.size before actually writing to it. */
+       snd_emu10k1_ptr20_write(emu, 0x13, channel, 0);
+       snd_emu10k1_ptr20_write(emu, CAPTURE_DMA_ADDR, channel, runtime->dma_addr);
+       snd_emu10k1_ptr20_write(emu, CAPTURE_BUFFER_SIZE, channel, frames_to_bytes(runtime, runtime->buffer_size)<<16); // buffer size in bytes
+       snd_emu10k1_ptr20_write(emu, CAPTURE_POINTER, channel, 0);
+       //snd_emu10k1_ptr20_write(emu, CAPTURE_SOURCE, 0x0, 0x333300e4); /* Select MIC or Line in */
+       //snd_emu10k1_ptr20_write(emu, EXTENDED_INT_MASK, 0, snd_emu10k1_ptr20_read(emu, EXTENDED_INT_MASK, 0) | (0x110000<<channel));
+
+       return 0;
+}
+
+static void snd_p16v_intr_enable(struct snd_emu10k1 *emu, unsigned int intrenb)
 {
        unsigned long flags;
        unsigned int enable;
@@ -281,7 +412,7 @@ static void snd_p16v_intr_enable(emu10k1_t *emu, unsigned int intrenb)
        spin_unlock_irqrestore(&emu->emu_lock, flags);
 }
 
-static void snd_p16v_intr_disable(emu10k1_t *emu, unsigned int intrenb)
+static void snd_p16v_intr_disable(struct snd_emu10k1 *emu, unsigned int intrenb)
 {
        unsigned long flags;
        unsigned int disable;
@@ -293,16 +424,16 @@ static void snd_p16v_intr_disable(emu10k1_t *emu, unsigned int intrenb)
 }
 
 /* trigger_playback callback */
-static int snd_p16v_pcm_trigger_playback(snd_pcm_substream_t *substream,
+static int snd_p16v_pcm_trigger_playback(struct snd_pcm_substream *substream,
                                    int cmd)
 {
-       emu10k1_t *emu = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime;
-       emu10k1_pcm_t *epcm;
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime;
+       struct snd_emu10k1_pcm *epcm;
        int channel;
        int result = 0;
        struct list_head *pos;
-        snd_pcm_substream_t *s;
+        struct snd_pcm_substream *s;
        u32 basic = 0;
        u32 inte = 0;
        int running=0;
@@ -345,13 +476,43 @@ static int snd_p16v_pcm_trigger_playback(snd_pcm_substream_t *substream,
        return result;
 }
 
+/* trigger_capture callback */
+static int snd_p16v_pcm_trigger_capture(struct snd_pcm_substream *substream,
+                                   int cmd)
+{
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct snd_emu10k1_pcm *epcm = runtime->private_data;
+       int channel = 0;
+       int result = 0;
+       u32 inte = INTE2_CAPTURE_CH_0_LOOP | INTE2_CAPTURE_CH_0_HALF_LOOP;
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_START:
+               snd_p16v_intr_enable(emu, inte);
+               snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0)|(0x100<<channel));
+               epcm->running = 1;
+               break;
+       case SNDRV_PCM_TRIGGER_STOP:
+               snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & ~(0x100<<channel));
+               snd_p16v_intr_disable(emu, inte);
+               //snd_emu10k1_ptr20_write(emu, EXTENDED_INT_MASK, 0, snd_emu10k1_ptr20_read(emu, EXTENDED_INT_MASK, 0) & ~(0x110000<<channel));
+               epcm->running = 0;
+               break;
+       default:
+               result = -EINVAL;
+               break;
+       }
+       return result;
+}
+
 /* pointer_playback callback */
 static snd_pcm_uframes_t
-snd_p16v_pcm_pointer_playback(snd_pcm_substream_t *substream)
+snd_p16v_pcm_pointer_playback(struct snd_pcm_substream *substream)
 {
-       emu10k1_t *emu = snd_pcm_substream_chip(substream);
-       snd_pcm_runtime_t *runtime = substream->runtime;
-       emu10k1_pcm_t *epcm = runtime->private_data;
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct snd_emu10k1_pcm *epcm = runtime->private_data;
        snd_pcm_uframes_t ptr, ptr1, ptr2,ptr3,ptr4 = 0;
        int channel = substream->pcm->device - emu->p16v_device_offset;
        if (!epcm->running)
@@ -370,8 +531,33 @@ snd_p16v_pcm_pointer_playback(snd_pcm_substream_t *substream)
        return ptr;
 }
 
+/* pointer_capture callback */
+static snd_pcm_uframes_t
+snd_p16v_pcm_pointer_capture(struct snd_pcm_substream *substream)
+{
+       struct snd_emu10k1 *emu = snd_pcm_substream_chip(substream);
+       struct snd_pcm_runtime *runtime = substream->runtime;
+       struct snd_emu10k1_pcm *epcm = runtime->private_data;
+       snd_pcm_uframes_t ptr, ptr1, ptr2 = 0;
+       int channel = 0;
+
+       if (!epcm->running)
+               return 0;
+
+       ptr1 = snd_emu10k1_ptr20_read(emu, CAPTURE_POINTER, channel);
+       ptr2 = bytes_to_frames(runtime, ptr1);
+       ptr=ptr2;
+       if (ptr >= runtime->buffer_size) {
+               ptr -= runtime->buffer_size;
+               printk(KERN_WARNING "buffer capture limited!\n");
+       }
+       //printk("ptr1 = 0x%lx, ptr2=0x%lx, ptr=0x%lx, buffer_size = 0x%x, period_size = 0x%x, bits=%d, rate=%d\n", ptr1, ptr2, ptr, (int)runtime->buffer_size, (int)runtime->period_size, (int)runtime->frame_bits, (int)runtime->rate);
+
+       return ptr;
+}
+
 /* operators */
-static snd_pcm_ops_t snd_p16v_playback_front_ops = {
+static struct snd_pcm_ops snd_p16v_playback_front_ops = {
        .open =        snd_p16v_pcm_open_playback_front,
        .close =       snd_p16v_pcm_close_playback,
        .ioctl =       snd_pcm_lib_ioctl,
@@ -382,7 +568,19 @@ static snd_pcm_ops_t snd_p16v_playback_front_ops = {
        .pointer =     snd_p16v_pcm_pointer_playback,
 };
 
-int snd_p16v_free(emu10k1_t *chip)
+static struct snd_pcm_ops snd_p16v_capture_ops = {
+       .open =        snd_p16v_pcm_open_capture,
+       .close =       snd_p16v_pcm_close_capture,
+       .ioctl =       snd_pcm_lib_ioctl,
+       .hw_params =   snd_p16v_pcm_hw_params_capture,
+       .hw_free =     snd_p16v_pcm_hw_free_capture,
+       .prepare =     snd_p16v_pcm_prepare_capture,
+       .trigger =     snd_p16v_pcm_trigger_capture,
+       .pointer =     snd_p16v_pcm_pointer_capture,
+};
+
+
+int snd_p16v_free(struct snd_emu10k1 *chip)
 {
        // release the data
        if (chip->p16v_buffer.area) {
@@ -392,38 +590,31 @@ int snd_p16v_free(emu10k1_t *chip)
        return 0;
 }
 
-static void snd_p16v_pcm_free(snd_pcm_t *pcm)
+int __devinit snd_p16v_pcm(struct snd_emu10k1 *emu, int device, struct snd_pcm **rpcm)
 {
-       emu10k1_t *emu = pcm->private_data;
-       //snd_printk("snd_p16v_pcm_free pcm: called\n");
-       snd_pcm_lib_preallocate_free_for_all(pcm);
-       emu->pcm = NULL;
-}
-
-int snd_p16v_pcm(emu10k1_t *emu, int device, snd_pcm_t **rpcm)
-{
-       snd_pcm_t *pcm;
-       snd_pcm_substream_t *substream;
+       struct snd_pcm *pcm;
+       struct snd_pcm_substream *substream;
        int err;
-        int capture=0;
+        int capture=1;
   
        //snd_printk("snd_p16v_pcm called. device=%d\n", device);
        emu->p16v_device_offset = device;
        if (rpcm)
                *rpcm = NULL;
-        //if (device == 0) capture=1; 
+
        if ((err = snd_pcm_new(emu->card, "p16v", device, 1, capture, &pcm)) < 0)
                return err;
   
        pcm->private_data = emu;
-       pcm->private_free = snd_p16v_pcm_free;
-
+       // Single playback 8 channel device.
+       // Single capture 2 channel device.
        snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, &snd_p16v_playback_front_ops);
+       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE, &snd_p16v_capture_ops);
 
        pcm->info_flags = 0;
        pcm->dev_subclass = SNDRV_PCM_SUBCLASS_GENERIC_MIX;
        strcpy(pcm->name, "p16v");
-       emu->pcm = pcm;
+       emu->pcm_p16v = pcm;
 
        for(substream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; 
            substream; 
@@ -431,7 +622,7 @@ int snd_p16v_pcm(emu10k1_t *emu, int device, snd_pcm_t **rpcm)
                if ((err = snd_pcm_lib_preallocate_pages(substream, 
                                                         SNDRV_DMA_TYPE_DEV, 
                                                         snd_dma_pci_data(emu->pci), 
-                                                        64*1024, 64*1024)) < 0) /* FIXME: 32*1024 for sound buffer, between 32and64 for Periods table. */
+                                                        ((65536 - 64) * 8), ((65536 - 64) * 8))) < 0) 
                        return err;
                //snd_printk("preallocate playback substream: err=%d\n", err);
        }
@@ -442,7 +633,7 @@ int snd_p16v_pcm(emu10k1_t *emu, int device, snd_pcm_t **rpcm)
                if ((err = snd_pcm_lib_preallocate_pages(substream, 
                                                   SNDRV_DMA_TYPE_DEV, 
                                                   snd_dma_pci_data(emu->pci), 
-                                                  64*1024, 64*1024)) < 0)
+                                                  65536 - 64, 65536 - 64)) < 0)
                        return err;
                //snd_printk("preallocate capture substream: err=%d\n", err);
        }
@@ -453,7 +644,8 @@ int snd_p16v_pcm(emu10k1_t *emu, int device, snd_pcm_t **rpcm)
        return 0;
 }
 
-static int snd_p16v_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t * uinfo)
+static int snd_p16v_volume_info(struct snd_kcontrol *kcontrol,
+                               struct snd_ctl_elem_info *uinfo)
 {
         uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
         uinfo->count = 2;
@@ -462,275 +654,220 @@ static int snd_p16v_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *
         return 0;
 }
 
-static int snd_p16v_volume_get(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol, int reg, int high_low)
+static int snd_p16v_volume_get(struct snd_kcontrol *kcontrol,
+                              struct snd_ctl_elem_value *ucontrol)
 {
-        emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
-        u32 value;
+        struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
+       int high_low = (kcontrol->private_value >> 8) & 0xff;
+       int reg = kcontrol->private_value & 0xff;
+       u32 value;
 
-        value = snd_emu10k1_ptr20_read(emu, reg, high_low);
-       if (high_low == 1) {
-               ucontrol->value.integer.value[0] = 0xff - ((value >> 24) & 0xff); /* Left */
-               ucontrol->value.integer.value[1] = 0xff - ((value >> 16) & 0xff); /* Right */
+       value = snd_emu10k1_ptr20_read(emu, reg, high_low);
+       if (high_low) {
+               ucontrol->value.integer.value[0] = 0xff - ((value >> 24) & 0xff); /* Left */
+               ucontrol->value.integer.value[1] = 0xff - ((value >> 16) & 0xff); /* Right */
        } else {
-               ucontrol->value.integer.value[0] = 0xff - ((value >> 8) & 0xff); /* Left */
-               ucontrol->value.integer.value[1] = 0xff - ((value >> 0) & 0xff); /* Right */
+               ucontrol->value.integer.value[0] = 0xff - ((value >> 8) & 0xff); /* Left */
+               ucontrol->value.integer.value[1] = 0xff - ((value >> 0) & 0xff); /* Right */
        }
-        return 0;
-}
-
-static int snd_p16v_volume_get_spdif_front(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER7;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
-}
-
-static int snd_p16v_volume_get_spdif_center_lfe(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER7;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
-}
-static int snd_p16v_volume_get_spdif_unknown(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER8;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
-}
-static int snd_p16v_volume_get_spdif_rear(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER8;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
-}
-
-static int snd_p16v_volume_get_analog_front(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER9;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
-}
-
-static int snd_p16v_volume_get_analog_center_lfe(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER9;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
-}
-static int snd_p16v_volume_get_analog_rear(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER10;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
+       return 0;
 }
 
-static int snd_p16v_volume_get_analog_unknown(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_p16v_volume_put(struct snd_kcontrol *kcontrol,
+                              struct snd_ctl_elem_value *ucontrol)
 {
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER10;
-        return snd_p16v_volume_get(kcontrol, ucontrol, reg, high_low);
-}
+        struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
+       int high_low = (kcontrol->private_value >> 8) & 0xff;
+       int reg = kcontrol->private_value & 0xff;
+        u32 value, oval;
 
-static int snd_p16v_volume_put(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol, int reg, int high_low)
-{
-        emu10k1_t *emu = snd_kcontrol_chip(kcontrol);
-        u32 value;
-        value = snd_emu10k1_ptr20_read(emu, reg, 0);
-        //value = value & 0xffff;
+       oval = value = snd_emu10k1_ptr20_read(emu, reg, 0);
        if (high_low == 1) {
                value &= 0xffff;
-               value = value | ((0xff - ucontrol->value.integer.value[0]) << 24) | ((0xff - ucontrol->value.integer.value[1]) << 16);
+               value |= ((0xff - ucontrol->value.integer.value[0]) << 24) |
+                       ((0xff - ucontrol->value.integer.value[1]) << 16);
        } else {
                value &= 0xffff0000;
-               value = value | ((0xff - ucontrol->value.integer.value[0]) << 8) | ((0xff - ucontrol->value.integer.value[1]) );
+               value |= ((0xff - ucontrol->value.integer.value[0]) << 8) |
+                       ((0xff - ucontrol->value.integer.value[1]) );
+       }
+       if (value != oval) {
+               snd_emu10k1_ptr20_write(emu, reg, 0, value);
+               return 1;
        }
-               snd_emu10k1_ptr20_write(emu, reg, 0, value);
-        return 1;
+       return 0;
 }
 
-static int snd_p16v_volume_put_spdif_front(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_p16v_capture_source_info(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_info *uinfo)
 {
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER7;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
-}
+       static char *texts[8] = {
+               "SPDIF", "I2S", "SRC48", "SRCMulti_SPDIF", "SRCMulti_I2S",
+               "CDIF", "FX", "AC97"
+       };
 
-static int snd_p16v_volume_put_spdif_center_lfe(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER7;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+       uinfo->count = 1;
+       uinfo->value.enumerated.items = 8;
+       if (uinfo->value.enumerated.item > 7)
+                uinfo->value.enumerated.item = 7;
+       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+       return 0;
 }
 
-static int snd_p16v_volume_put_spdif_unknown(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_p16v_capture_source_get(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER8;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
-}
+       struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
 
-static int snd_p16v_volume_put_spdif_rear(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER8;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
+       ucontrol->value.enumerated.item[0] = emu->p16v_capture_source;
+       return 0;
 }
 
-static int snd_p16v_volume_put_analog_front(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_p16v_capture_source_put(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER9;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
-}
+       struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
+       unsigned int val;
+       int change = 0;
+       u32 mask;
+       u32 source;
 
-static int snd_p16v_volume_put_analog_center_lfe(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
-{
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER9;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
+       val = ucontrol->value.enumerated.item[0] ;
+       change = (emu->p16v_capture_source != val);
+       if (change) {
+               emu->p16v_capture_source = val;
+               source = (val << 28) | (val << 24) | (val << 20) | (val << 16);
+               mask = snd_emu10k1_ptr20_read(emu, BASIC_INTERRUPT, 0) & 0xffff;
+               snd_emu10k1_ptr20_write(emu, BASIC_INTERRUPT, 0, source | mask);
+       }
+        return change;
 }
 
-static int snd_p16v_volume_put_analog_rear(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_p16v_capture_channel_info(struct snd_kcontrol *kcontrol,
+                                        struct snd_ctl_elem_info *uinfo)
 {
-       int high_low = 1;
-       int reg = PLAYBACK_VOLUME_MIXER10;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
+       static char *texts[4] = { "0", "1", "2", "3",  };
+
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+       uinfo->count = 1;
+       uinfo->value.enumerated.items = 4;
+       if (uinfo->value.enumerated.item > 3)
+                uinfo->value.enumerated.item = 3;
+       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+       return 0;
 }
 
-static int snd_p16v_volume_put_analog_unknown(snd_kcontrol_t * kcontrol,
-                                       snd_ctl_elem_value_t * ucontrol)
+static int snd_p16v_capture_channel_get(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-       int high_low = 0;
-       int reg = PLAYBACK_VOLUME_MIXER10;
-        return snd_p16v_volume_put(kcontrol, ucontrol, reg, high_low);
+       struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
+
+       ucontrol->value.enumerated.item[0] = emu->p16v_capture_channel;
+       return 0;
 }
 
-static snd_kcontrol_new_t snd_p16v_volume_control_analog_front =
+static int snd_p16v_capture_channel_put(struct snd_kcontrol *kcontrol,
+                                       struct snd_ctl_elem_value *ucontrol)
 {
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD Analog Front Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_analog_front,
-        .put =          snd_p16v_volume_put_analog_front
-};
+       struct snd_emu10k1 *emu = snd_kcontrol_chip(kcontrol);
+       unsigned int val;
+       int change = 0;
+       u32 tmp;
 
-static snd_kcontrol_new_t snd_p16v_volume_control_analog_center_lfe =
-{
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD Analog Center/LFE Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_analog_center_lfe,
-        .put =          snd_p16v_volume_put_analog_center_lfe
+       val = ucontrol->value.enumerated.item[0] ;
+       change = (emu->p16v_capture_channel != val);
+       if (change) {
+               emu->p16v_capture_channel = val;
+               tmp = snd_emu10k1_ptr20_read(emu, CAPTURE_P16V_SOURCE, 0) & 0xfffc;
+               snd_emu10k1_ptr20_write(emu, CAPTURE_P16V_SOURCE, 0, tmp | val);
+       }
+        return change;
+}
+
+#define P16V_VOL(xname,xreg,xhl) { \
+       .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, \
+       .info = snd_p16v_volume_info, \
+       .get = snd_p16v_volume_get, \
+       .put = snd_p16v_volume_put, \
+       .private_value = ((xreg) | ((xhl) << 8)) \
+}
+
+static struct snd_kcontrol_new p16v_mixer_controls[] __devinitdata = {
+       P16V_VOL("HD Analog Front Playback Volume", PLAYBACK_VOLUME_MIXER9, 0),
+       P16V_VOL("HD Analog Rear Playback Volume", PLAYBACK_VOLUME_MIXER10, 1),
+       P16V_VOL("HD Analog Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER9, 1),
+       P16V_VOL("HD Analog Side Playback Volume", PLAYBACK_VOLUME_MIXER10, 0),
+       P16V_VOL("HD SPDIF Front Playback Volume", PLAYBACK_VOLUME_MIXER7, 0),
+       P16V_VOL("HD SPDIF Rear Playback Volume", PLAYBACK_VOLUME_MIXER8, 1),
+       P16V_VOL("HD SPDIF Center/LFE Playback Volume", PLAYBACK_VOLUME_MIXER7, 1),
+       P16V_VOL("HD SPDIF Side Playback Volume", PLAYBACK_VOLUME_MIXER8, 0),
+       {
+               .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name =         "HD source Capture",
+               .info =         snd_p16v_capture_source_info,
+               .get =          snd_p16v_capture_source_get,
+               .put =          snd_p16v_capture_source_put
+       },
+       {
+               .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name =         "HD channel Capture",
+               .info =         snd_p16v_capture_channel_info,
+               .get =          snd_p16v_capture_channel_get,
+               .put =          snd_p16v_capture_channel_put
+       },
 };
 
-static snd_kcontrol_new_t snd_p16v_volume_control_analog_unknown =
-{
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD Analog Unknown Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_analog_unknown,
-        .put =          snd_p16v_volume_put_analog_unknown
-};
 
-static snd_kcontrol_new_t snd_p16v_volume_control_analog_rear =
+int __devinit snd_p16v_mixer(struct snd_emu10k1 *emu)
 {
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD Analog Rear Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_analog_rear,
-        .put =          snd_p16v_volume_put_analog_rear
-};
+       int i, err;
+        struct snd_card *card = emu->card;
 
-static snd_kcontrol_new_t snd_p16v_volume_control_spdif_front =
-{
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD SPDIF Front Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_spdif_front,
-        .put =          snd_p16v_volume_put_spdif_front
-};
+       for (i = 0; i < ARRAY_SIZE(p16v_mixer_controls); i++) {
+               if ((err = snd_ctl_add(card, snd_ctl_new1(&p16v_mixer_controls[i],
+                                                         emu))) < 0)
+                       return err;
+       }
+        return 0;
+}
 
-static snd_kcontrol_new_t snd_p16v_volume_control_spdif_center_lfe =
-{
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD SPDIF Center/LFE Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_spdif_center_lfe,
-        .put =          snd_p16v_volume_put_spdif_center_lfe
-};
+#ifdef CONFIG_PM
+
+#define NUM_CHS        1       /* up to 4, but only first channel is used */
 
-static snd_kcontrol_new_t snd_p16v_volume_control_spdif_unknown =
+int __devinit snd_p16v_alloc_pm_buffer(struct snd_emu10k1 *emu)
 {
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD SPDIF Unknown Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_spdif_unknown,
-        .put =          snd_p16v_volume_put_spdif_unknown
-};
+       emu->p16v_saved = vmalloc(NUM_CHS * 4 * 0x80);
+       if (! emu->p16v_saved)
+               return -ENOMEM;
+       return 0;
+}
 
-static snd_kcontrol_new_t snd_p16v_volume_control_spdif_rear =
+void snd_p16v_free_pm_buffer(struct snd_emu10k1 *emu)
 {
-        .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "HD SPDIF Rear Volume",
-        .info =         snd_p16v_volume_info,
-        .get =          snd_p16v_volume_get_spdif_rear,
-        .put =          snd_p16v_volume_put_spdif_rear
-};
+       vfree(emu->p16v_saved);
+}
 
-int snd_p16v_mixer(emu10k1_t *emu)
+void snd_p16v_suspend(struct snd_emu10k1 *emu)
 {
-        int err;
-        snd_kcontrol_t *kctl;
-        snd_card_t *card = emu->card;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_front, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_rear, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_center_lfe, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_analog_unknown, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_front, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_rear, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_center_lfe, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        if ((kctl = snd_ctl_new1(&snd_p16v_volume_control_spdif_unknown, emu)) == NULL)
-                return -ENOMEM;
-        if ((err = snd_ctl_add(card, kctl)))
-                return err;
-        return 0;
+       int i, ch;
+       unsigned int *val;
+
+       val = emu->p16v_saved;
+       for (ch = 0; ch < NUM_CHS; ch++)
+               for (i = 0; i < 0x80; i++, val++)
+                       *val = snd_emu10k1_ptr20_read(emu, i, ch);
 }
 
+void snd_p16v_resume(struct snd_emu10k1 *emu)
+{
+       int i, ch;
+       unsigned int *val;
+
+       val = emu->p16v_saved;
+       for (ch = 0; ch < NUM_CHS; ch++)
+               for (i = 0; i < 0x80; i++, val++)
+                       snd_emu10k1_ptr20_write(emu, i, ch, *val);
+}
+#endif
index c9e9dc9..40520e9 100644 (file)
@@ -75,7 +75,12 @@ enum {
 #define AC_VERB_GET_DIGI_CONVERT               0x0f0d
 #define AC_VERB_GET_VOLUME_KNOB_CONTROL                0x0f0f
 /* f10-f1a: GPIO */
+#define AC_VERB_GET_GPIO_DATA                  0x0f15
+#define AC_VERB_GET_GPIO_MASK                  0x0f16
+#define AC_VERB_GET_GPIO_DIRECTION             0x0f17
 #define AC_VERB_GET_CONFIG_DEFAULT             0x0f1c
+/* f20: AFG/MFG */
+#define AC_VERB_GET_SUBSYSTEM_ID               0x0f20
 
 /*
  * SET verbs
@@ -93,10 +98,13 @@ enum {
 #define AC_VERB_SET_UNSOLICITED_ENABLE         0x708
 #define AC_VERB_SET_PIN_SENSE                  0x709
 #define AC_VERB_SET_BEEP_CONTROL               0x70a
-#define AC_VERB_SET_EAPD_BTLENALBE             0x70c
+#define AC_VERB_SET_EAPD_BTLENABLE             0x70c
 #define AC_VERB_SET_DIGI_CONVERT_1             0x70d
 #define AC_VERB_SET_DIGI_CONVERT_2             0x70e
 #define AC_VERB_SET_VOLUME_KNOB_CONTROL                0x70f
+#define AC_VERB_SET_GPIO_DATA                  0x715
+#define AC_VERB_SET_GPIO_MASK                  0x716
+#define AC_VERB_SET_GPIO_DIRECTION             0x717
 #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_0     0x71c
 #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_1     0x71d
 #define AC_VERB_SET_CONFIG_DEFAULT_BYTES_2     0x71e
@@ -176,16 +184,15 @@ enum {
 #define AC_PINCAP_OUT                  (1<<4)  /* output capable */
 #define AC_PINCAP_IN                   (1<<5)  /* input capable */
 #define AC_PINCAP_BALANCE              (1<<6)  /* balanced I/O capable */
-#define AC_PINCAP_VREF                 (7<<8)
+#define AC_PINCAP_VREF                 (0x37<<8)
 #define AC_PINCAP_VREF_SHIFT           8
 #define AC_PINCAP_EAPD                 (1<<16) /* EAPD capable */
-/* Vref status (used in pin cap and pin ctl) */
-#define AC_PIN_VREF_HIZ                        (1<<0)  /* Hi-Z */
-#define AC_PIN_VREF_50                 (1<<1)  /* 50% */
-#define AC_PIN_VREF_GRD                        (1<<2)  /* ground */
-#define AC_PIN_VREF_80                 (1<<4)  /* 80% */
-#define AC_PIN_VREF_100                        (1<<5)  /* 100% */
-
+/* Vref status (used in pin cap) */
+#define AC_PINCAP_VREF_HIZ             (1<<0)  /* Hi-Z */
+#define AC_PINCAP_VREF_50              (1<<1)  /* 50% */
+#define AC_PINCAP_VREF_GRD             (1<<2)  /* ground */
+#define AC_PINCAP_VREF_80              (1<<4)  /* 80% */
+#define AC_PINCAP_VREF_100             (1<<5)  /* 100% */
 
 /* Amplifier capabilities */
 #define AC_AMPCAP_OFFSET               (0x7f<<0)  /* 0dB offset */
@@ -207,6 +214,12 @@ enum {
 #define AC_PWRST_D2SUP                 (1<<2)
 #define AC_PWRST_D3SUP                 (1<<3)
 
+/* Power state values */
+#define AC_PWRST_D0                    0x00
+#define AC_PWRST_D1                    0x01
+#define AC_PWRST_D2                    0x02
+#define AC_PWRST_D3                    0x03
+
 /* Processing capabilies */
 #define AC_PCAP_BENIGN                 (1<<0)
 #define AC_PCAP_NUM_COEF               (0xff<<8)
@@ -248,14 +261,24 @@ enum {
 
 /* Pin widget control - 8bit */
 #define AC_PINCTL_VREFEN               (0x7<<0)
+#define AC_PINCTL_VREF_HIZ             0       /* Hi-Z */
+#define AC_PINCTL_VREF_50              1       /* 50% */
+#define AC_PINCTL_VREF_GRD             2       /* ground */
+#define AC_PINCTL_VREF_80              4       /* 80% */
+#define AC_PINCTL_VREF_100             5       /* 100% */
 #define AC_PINCTL_IN_EN                        (1<<5)
 #define AC_PINCTL_OUT_EN               (1<<6)
 #define AC_PINCTL_HP_EN                        (1<<7)
 
+/* Unsolicited response - 8bit */
+#define AC_USRSP_EN                    (1<<7)
+
 /* configuration default - 32bit */
 #define AC_DEFCFG_SEQUENCE             (0xf<<0)
 #define AC_DEFCFG_DEF_ASSOC            (0xf<<4)
+#define AC_DEFCFG_ASSOC_SHIFT          4
 #define AC_DEFCFG_MISC                 (0xf<<8)
+#define AC_DEFCFG_MISC_SHIFT           8
 #define AC_DEFCFG_COLOR                        (0xf<<12)
 #define AC_DEFCFG_COLOR_SHIFT          12
 #define AC_DEFCFG_CONN_TYPE            (0xf<<16)
@@ -359,7 +382,7 @@ enum {
 };
 
 /* max. connections to a widget */
-#define HDA_MAX_CONNECTIONS    16
+#define HDA_MAX_CONNECTIONS    32
 
 /* max. codec address */
 #define HDA_MAX_CODEC_ADDRESS  0x0f
@@ -403,7 +426,7 @@ struct hda_bus_template {
  * A hda_bus contains several codecs in the list codec_list.
  */
 struct hda_bus {
-       snd_card_t *card;
+       struct snd_card *card;
 
        /* copied from template */
        void *private_data;
@@ -413,14 +436,14 @@ struct hda_bus {
 
        /* codec linked list */
        struct list_head codec_list;
-       struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS]; /* caddr -> codec */
+       struct hda_codec *caddr_tbl[HDA_MAX_CODEC_ADDRESS + 1]; /* caddr -> codec */
 
-       struct semaphore cmd_mutex;
+       struct mutex cmd_mutex;
 
        /* unsolicited event queue */
        struct hda_bus_unsolicited *unsol;
 
-       snd_info_entry_t *proc;
+       struct snd_info_entry *proc;
 };
 
 /*
@@ -464,14 +487,14 @@ struct hda_amp_info {
 /* PCM callbacks */
 struct hda_pcm_ops {
        int (*open)(struct hda_pcm_stream *info, struct hda_codec *codec,
-                   snd_pcm_substream_t *substream);
+                   struct snd_pcm_substream *substream);
        int (*close)(struct hda_pcm_stream *info, struct hda_codec *codec,
-                    snd_pcm_substream_t *substream);
+                    struct snd_pcm_substream *substream);
        int (*prepare)(struct hda_pcm_stream *info, struct hda_codec *codec,
                       unsigned int stream_tag, unsigned int format,
-                      snd_pcm_substream_t *substream);
+                      struct snd_pcm_substream *substream);
        int (*cleanup)(struct hda_pcm_stream *info, struct hda_codec *codec,
-                      snd_pcm_substream_t *substream);
+                      struct snd_pcm_substream *substream);
 };
 
 /* PCM information for each substream */
@@ -490,6 +513,7 @@ struct hda_pcm_stream {
 struct hda_pcm {
        char *name;
        struct hda_pcm_stream stream[2];
+       unsigned int is_modem;  /* modem codec? */
 };
 
 /* codec information */
@@ -499,6 +523,7 @@ struct hda_codec {
        struct list_head list;  /* list point */
 
        hda_nid_t afg;  /* AFG node id */
+       hda_nid_t mfg;  /* MFG node id */
 
        /* ids */
        u32 vendor_id;
@@ -523,12 +548,18 @@ struct hda_codec {
        /* codec specific info */
        void *spec;
 
+       /* widget capabilities cache */
+       unsigned int num_nodes;
+       hda_nid_t start_nid;
+       u32 *wcaps;
+
        /* hash for amp access */
        u16 amp_hash[32];
        int num_amp_entries;
-       struct hda_amp_info amp_info[128]; /* big enough? */
+       int amp_info_size;
+       struct hda_amp_info *amp_info;
 
-       struct semaphore spdif_mutex;
+       struct mutex spdif_mutex;
        unsigned int spdif_status;      /* IEC958 status bits */
        unsigned short spdif_ctls;      /* SPDIF control bits */
        unsigned int spdif_in_enable;   /* SPDIF input enable? */
@@ -543,7 +574,7 @@ enum {
 /*
  * constructors
  */
-int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp,
+int snd_hda_bus_new(struct snd_card *card, const struct hda_bus_template *temp,
                    struct hda_bus **busp);
 int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
                      struct hda_codec **codecp);
index 69f7b6c..85ad164 100644 (file)
@@ -32,7 +32,8 @@
 struct hda_gnode {
        hda_nid_t nid;          /* NID of this widget */
        unsigned short nconns;  /* number of input connections */
-       hda_nid_t conn_list[HDA_MAX_CONNECTIONS]; /* input connections */
+       hda_nid_t *conn_list;
+       hda_nid_t slist[2];     /* temporay list */
        unsigned int wid_caps;  /* widget capabilities */
        unsigned char type;     /* widget type */
        unsigned char pin_ctl;  /* pin controls */
@@ -44,12 +45,12 @@ struct hda_gnode {
        struct list_head list;
 };
 
-/* pathc-specific record */
+/* patch-specific record */
 struct hda_gspec {
-       struct hda_gnode *dac_node;     /* DAC node */
-       struct hda_gnode *out_pin_node; /* Output pin (Line-Out) node */
-       struct hda_gnode *pcm_vol_node; /* Node for PCM volume */
-       unsigned int pcm_vol_index;     /* connection of PCM volume */
+       struct hda_gnode *dac_node[2];  /* DAC node */
+       struct hda_gnode *out_pin_node[2];      /* Output pin (Line-Out) node */
+       struct hda_gnode *pcm_vol_node[2];      /* Node for PCM volume */
+       unsigned int pcm_vol_index[2];  /* connection of PCM volume */
 
        struct hda_gnode *adc_node;     /* ADC node */
        struct hda_gnode *cap_vol_node; /* Node for capture volume */
@@ -68,8 +69,12 @@ struct hda_gspec {
 /*
  * retrieve the default device type from the default config value
  */
-#define get_defcfg_type(node) (((node)->def_cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT)
-#define get_defcfg_location(node) (((node)->def_cfg & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT)
+#define defcfg_type(node) (((node)->def_cfg & AC_DEFCFG_DEVICE) >> \
+                          AC_DEFCFG_DEVICE_SHIFT)
+#define defcfg_location(node) (((node)->def_cfg & AC_DEFCFG_LOCATION) >> \
+                              AC_DEFCFG_LOCATION_SHIFT)
+#define defcfg_port_conn(node) (((node)->def_cfg & AC_DEFCFG_PORT_CONN) >> \
+                               AC_DEFCFG_PORT_CONN_SHIFT)
 
 /*
  * destructor
@@ -84,6 +89,8 @@ static void snd_hda_generic_free(struct hda_codec *codec)
        /* free all widgets */
        list_for_each_safe(p, n, &spec->nid_list) {
                struct hda_gnode *node = list_entry(p, struct hda_gnode, list);
+               if (node->conn_list != node->slist)
+                       kfree(node->conn_list);
                kfree(node);
        }
        kfree(spec);
@@ -97,18 +104,32 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
 {
        struct hda_gnode *node;
        int nconns;
+       hda_nid_t conn_list[HDA_MAX_CONNECTIONS];
 
-       node = kcalloc(1, sizeof(*node), GFP_KERNEL);
+       node = kzalloc(sizeof(*node), GFP_KERNEL);
        if (node == NULL)
                return -ENOMEM;
        node->nid = nid;
-       nconns = snd_hda_get_connections(codec, nid, node->conn_list, HDA_MAX_CONNECTIONS);
+       nconns = snd_hda_get_connections(codec, nid, conn_list,
+                                        HDA_MAX_CONNECTIONS);
        if (nconns < 0) {
                kfree(node);
                return nconns;
        }
+       if (nconns <= ARRAY_SIZE(node->slist))
+               node->conn_list = node->slist;
+       else {
+               node->conn_list = kmalloc(sizeof(hda_nid_t) * nconns,
+                                         GFP_KERNEL);
+               if (! node->conn_list) {
+                       snd_printk(KERN_ERR "hda-generic: cannot malloc\n");
+                       kfree(node);
+                       return -ENOMEM;
+               }
+       }
+       memcpy(node->conn_list, conn_list, nconns);
        node->nconns = nconns;
-       node->wid_caps = snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
+       node->wid_caps = get_wcaps(codec, nid);
        node->type = (node->wid_caps & AC_WCAP_TYPE) >> AC_WCAP_TYPE_SHIFT;
 
        if (node->type == AC_WID_PIN) {
@@ -244,7 +265,7 @@ static void clear_check_flags(struct hda_gspec *spec)
  * returns 0 if not found, 1 if found, or a negative error code.
  */
 static int parse_output_path(struct hda_codec *codec, struct hda_gspec *spec,
-                            struct hda_gnode *node)
+                            struct hda_gnode *node, int dac_idx)
 {
        int i, err;
        struct hda_gnode *child;
@@ -259,14 +280,14 @@ static int parse_output_path(struct hda_codec *codec, struct hda_gspec *spec,
                        return 0;
                }
                snd_printdd("AUD_OUT found %x\n", node->nid);
-               if (spec->dac_node) {
+               if (spec->dac_node[dac_idx]) {
                        /* already DAC node is assigned, just unmute & connect */
-                       return node == spec->dac_node;
+                       return node == spec->dac_node[dac_idx];
                }
-               spec->dac_node = node;
+               spec->dac_node[dac_idx] = node;
                if (node->wid_caps & AC_WCAP_OUT_AMP) {
-                       spec->pcm_vol_node = node;
-                       spec->pcm_vol_index = 0;
+                       spec->pcm_vol_node[dac_idx] = node;
+                       spec->pcm_vol_index[dac_idx] = 0;
                }
                return 1; /* found */
        }
@@ -275,7 +296,7 @@ static int parse_output_path(struct hda_codec *codec, struct hda_gspec *spec,
                child = hda_get_node(spec, node->conn_list[i]);
                if (! child)
                        continue;
-               err = parse_output_path(codec, spec, child);
+               err = parse_output_path(codec, spec, child, dac_idx);
                if (err < 0)
                        return err;
                else if (err > 0) {
@@ -286,13 +307,13 @@ static int parse_output_path(struct hda_codec *codec, struct hda_gspec *spec,
                                select_input_connection(codec, node, i);
                        unmute_input(codec, node, i);
                        unmute_output(codec, node);
-                       if (! spec->pcm_vol_node) {
+                       if (! spec->pcm_vol_node[dac_idx]) {
                                if (node->wid_caps & AC_WCAP_IN_AMP) {
-                                       spec->pcm_vol_node = node;
-                                       spec->pcm_vol_index = i;
+                                       spec->pcm_vol_node[dac_idx] = node;
+                                       spec->pcm_vol_index[dac_idx] = i;
                                } else if (node->wid_caps & AC_WCAP_OUT_AMP) {
-                                       spec->pcm_vol_node = node;
-                                       spec->pcm_vol_index = 0;
+                                       spec->pcm_vol_node[dac_idx] = node;
+                                       spec->pcm_vol_index[dac_idx] = 0;
                                }
                        }
                        return 1;
@@ -322,8 +343,10 @@ static struct hda_gnode *parse_output_jack(struct hda_codec *codec,
                /* output capable? */
                if (! (node->pin_caps & AC_PINCAP_OUT))
                        continue;
+               if (defcfg_port_conn(node) == AC_JACK_PORT_NONE)
+                       continue; /* unconnected */
                if (jack_type >= 0) {
-                       if (jack_type != get_defcfg_type(node))
+                       if (jack_type != defcfg_type(node))
                                continue;
                        if (node->wid_caps & AC_WCAP_DIGITAL)
                                continue; /* skip SPDIF */
@@ -333,10 +356,15 @@ static struct hda_gnode *parse_output_jack(struct hda_codec *codec,
                                continue;
                }
                clear_check_flags(spec);
-               err = parse_output_path(codec, spec, node);
+               err = parse_output_path(codec, spec, node, 0);
                if (err < 0)
                        return NULL;
-               else if (err > 0) {
+               if (! err && spec->out_pin_node[0]) {
+                       err = parse_output_path(codec, spec, node, 1);
+                       if (err < 0)
+                               return NULL;
+               }
+               if (err > 0) {
                        /* unmute the PIN output */
                        unmute_output(codec, node);
                        /* set PIN-Out enable */
@@ -364,20 +392,28 @@ static int parse_output(struct hda_codec *codec)
        /* first, look for the line-out pin */
        node = parse_output_jack(codec, spec, AC_JACK_LINE_OUT);
        if (node) /* found, remember the PIN node */
-               spec->out_pin_node = node;
+               spec->out_pin_node[0] = node;
+       else {
+               /* if no line-out is found, try speaker out */
+               node = parse_output_jack(codec, spec, AC_JACK_SPEAKER);
+               if (node)
+                       spec->out_pin_node[0] = node;
+       }
        /* look for the HP-out pin */
        node = parse_output_jack(codec, spec, AC_JACK_HP_OUT);
        if (node) {
-               if (! spec->out_pin_node)
-                       spec->out_pin_node = node;
+               if (! spec->out_pin_node[0])
+                       spec->out_pin_node[0] = node;
+               else
+                       spec->out_pin_node[1] = node;
        }
 
-       if (! spec->out_pin_node) {
+       if (! spec->out_pin_node[0]) {
                /* no line-out or HP pins found,
                 * then choose for the first output pin
                 */
-               spec->out_pin_node = parse_output_jack(codec, spec, -1);
-               if (! spec->out_pin_node)
+               spec->out_pin_node[0] = parse_output_jack(codec, spec, -1);
+               if (! spec->out_pin_node[0])
                        snd_printd("hda_generic: no proper output path found\n");
        }
 
@@ -389,14 +425,14 @@ static int parse_output(struct hda_codec *codec)
  */
 
 /* control callbacks */
-static int capture_source_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo)
+static int capture_source_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct hda_gspec *spec = codec->spec;
        return snd_hda_input_mux_info(&spec->input_mux, uinfo);
 }
 
-static int capture_source_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int capture_source_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct hda_gspec *spec = codec->spec;
@@ -405,7 +441,7 @@ static int capture_source_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
        return 0;
 }
 
-static int capture_source_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol)
+static int capture_source_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
 {
        struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
        struct hda_gspec *spec = codec->spec;
@@ -418,15 +454,15 @@ static int capture_source_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *uc
  */
 static const char *get_input_type(struct hda_gnode *node, unsigned int *pinctl)
 {
-       unsigned int location = get_defcfg_location(node);
-       switch (get_defcfg_type(node)) {
+       unsigned int location = defcfg_location(node);
+       switch (defcfg_type(node)) {
        case AC_JACK_LINE_IN:
                if ((location & 0x0f) == AC_JACK_LOC_FRONT)
                        return "Front Line";
                return "Line";
        case AC_JACK_CD:
                if (pinctl)
-                       *pinctl |= AC_PIN_VREF_GRD;
+                       *pinctl |= AC_PINCTL_VREF_GRD;
                return "CD";
        case AC_JACK_AUX:
                if ((location & 0x0f) == AC_JACK_LOC_FRONT)
@@ -488,6 +524,9 @@ static int parse_adc_sub_nodes(struct hda_codec *codec, struct hda_gspec *spec,
        if (! (node->pin_caps & AC_PINCAP_IN))
                return 0;
 
+       if (defcfg_port_conn(node) == AC_JACK_PORT_NONE)
+               return 0; /* unconnected */
+
        if (node->wid_caps & AC_WCAP_DIGITAL)
                return 0; /* skip SPDIF */
 
@@ -617,7 +656,7 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
        char name[32];
        int err;
        int created = 0;
-       snd_kcontrol_new_t knew;
+       struct snd_kcontrol_new knew;
 
        if (type)
                sprintf(name, "%s %s Switch", type, dir_sfx);
@@ -625,14 +664,14 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
                sprintf(name, "%s Switch", dir_sfx);
        if ((node->wid_caps & AC_WCAP_IN_AMP) &&
            (node->amp_in_caps & AC_AMPCAP_MUTE)) {
-               knew = (snd_kcontrol_new_t)HDA_CODEC_MUTE(name, node->nid, index, HDA_INPUT);
+               knew = (struct snd_kcontrol_new)HDA_CODEC_MUTE(name, node->nid, index, HDA_INPUT);
                snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index);
                if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
                        return err;
                created = 1;
        } else if ((node->wid_caps & AC_WCAP_OUT_AMP) &&
                   (node->amp_out_caps & AC_AMPCAP_MUTE)) {
-               knew = (snd_kcontrol_new_t)HDA_CODEC_MUTE(name, node->nid, 0, HDA_OUTPUT);
+               knew = (struct snd_kcontrol_new)HDA_CODEC_MUTE(name, node->nid, 0, HDA_OUTPUT);
                snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid);
                if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
                        return err;
@@ -645,14 +684,14 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
                sprintf(name, "%s Volume", dir_sfx);
        if ((node->wid_caps & AC_WCAP_IN_AMP) &&
            (node->amp_in_caps & AC_AMPCAP_NUM_STEPS)) {
-               knew = (snd_kcontrol_new_t)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT);
+               knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, index, HDA_INPUT);
                snd_printdd("[%s] NID=0x%x, DIR=IN, IDX=0x%x\n", name, node->nid, index);
                if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
                        return err;
                created = 1;
        } else if ((node->wid_caps & AC_WCAP_OUT_AMP) &&
                   (node->amp_out_caps & AC_AMPCAP_NUM_STEPS)) {
-               knew = (snd_kcontrol_new_t)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT);
+               knew = (struct snd_kcontrol_new)HDA_CODEC_VOLUME(name, node->nid, 0, HDA_OUTPUT);
                snd_printdd("[%s] NID=0x%x, DIR=OUT\n", name, node->nid);
                if ((err = snd_ctl_add(codec->bus->card, snd_ctl_new1(&knew, codec))) < 0)
                        return err;
@@ -667,7 +706,7 @@ static int create_mixer(struct hda_codec *codec, struct hda_gnode *node,
  */
 static int check_existing_control(struct hda_codec *codec, const char *type, const char *dir)
 {
-       snd_ctl_elem_id_t id;
+       struct snd_ctl_elem_id id;
        memset(&id, 0, sizeof(id));
        sprintf(id.name, "%s %s Volume", type, dir);
        id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
@@ -686,12 +725,16 @@ static int check_existing_control(struct hda_codec *codec, const char *type, con
 static int build_output_controls(struct hda_codec *codec)
 {
        struct hda_gspec *spec = codec->spec;
-       int err;
+       static const char *types[2] = { "Master", "Headphone" };
+       int i, err;
 
-       err = create_mixer(codec, spec->pcm_vol_node, spec->pcm_vol_index,
-                          "PCM", "Playback");
-       if (err < 0)
-               return err;
+       for (i = 0; i < 2 && spec->pcm_vol_node[i]; i++) {
+               err = create_mixer(codec, spec->pcm_vol_node[i],
+                                  spec->pcm_vol_index[i],
+                                  types[i], "Playback");
+               if (err < 0)
+                       return err;
+       }
        return 0;
 }
 
@@ -710,7 +753,7 @@ static int build_input_controls(struct hda_codec *codec)
 
        /* create input MUX if multiple sources are available */
        if (spec->input_mux.num_items > 1) {
-               static snd_kcontrol_new_t cap_sel = {
+               static struct snd_kcontrol_new cap_sel = {
                        .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
                        .name = "Capture Source",
                        .info = capture_source_info,
@@ -788,7 +831,7 @@ static int build_loopback_controls(struct hda_codec *codec)
        int err;
        const char *type;
 
-       if (! spec->out_pin_node)
+       if (! spec->out_pin_node[0])
                return 0;
 
        list_for_each(p, &spec->nid_list) {
@@ -803,7 +846,8 @@ static int build_loopback_controls(struct hda_codec *codec)
                        if (check_existing_control(codec, type, "Playback"))
                                continue;
                        clear_check_flags(spec);
-                       err = parse_loopback_path(codec, spec, spec->out_pin_node,
+                       err = parse_loopback_path(codec, spec,
+                                                 spec->out_pin_node[0],
                                                  node, type);
                        if (err < 0)
                                return err;
@@ -838,12 +882,37 @@ static struct hda_pcm_stream generic_pcm_playback = {
        .channels_max = 2,
 };
 
+static int generic_pcm2_prepare(struct hda_pcm_stream *hinfo,
+                               struct hda_codec *codec,
+                               unsigned int stream_tag,
+                               unsigned int format,
+                               struct snd_pcm_substream *substream)
+{
+       struct hda_gspec *spec = codec->spec;
+
+       snd_hda_codec_setup_stream(codec, hinfo->nid, stream_tag, 0, format);
+       snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid,
+                                  stream_tag, 0, format);
+       return 0;
+}
+
+static int generic_pcm2_cleanup(struct hda_pcm_stream *hinfo,
+                               struct hda_codec *codec,
+                               struct snd_pcm_substream *substream)
+{
+       struct hda_gspec *spec = codec->spec;
+
+       snd_hda_codec_setup_stream(codec, hinfo->nid, 0, 0, 0);
+       snd_hda_codec_setup_stream(codec, spec->dac_node[1]->nid, 0, 0, 0);
+       return 0;
+}
+
 static int build_generic_pcms(struct hda_codec *codec)
 {
        struct hda_gspec *spec = codec->spec;
        struct hda_pcm *info = &spec->pcm_rec;
 
-       if (! spec->dac_node && ! spec->adc_node) {
+       if (! spec->dac_node[0] && ! spec->adc_node) {
                snd_printd("hda_generic: no PCM found\n");
                return 0;
        }
@@ -852,9 +921,13 @@ static int build_generic_pcms(struct hda_codec *codec)
        codec->pcm_info = info;
 
        info->name = "HDA Generic";
-       if (spec->dac_node) {
+       if (spec->dac_node[0]) {
                info->stream[0] = generic_pcm_playback;
-               info->stream[0].nid = spec->dac_node->nid;
+               info->stream[0].nid = spec->dac_node[0]->nid;
+               if (spec->dac_node[1]) {
+                       info->stream[0].ops.prepare = generic_pcm2_prepare;
+                       info->stream[0].ops.cleanup = generic_pcm2_cleanup;
+               }
        }
        if (spec->adc_node) {
                info->stream[1] = generic_pcm_playback;
@@ -881,7 +954,10 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
        struct hda_gspec *spec;
        int err;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       if(!codec->afg)
+               return 0;
+
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL) {
                printk(KERN_ERR "hda_generic: can't allocate spec\n");
                return -ENOMEM;
index 7c7b849..14e8aa2 100644 (file)
  * for mixer controls
  */
 #define HDA_COMPOSE_AMP_VAL(nid,chs,idx,dir) ((nid) | ((chs)<<16) | ((dir)<<18) | ((idx)<<19))
+/* mono volume with index (index=0,1,...) (channel=1,2) */
 #define HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
        { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx,  \
          .info = snd_hda_mixer_amp_volume_info, \
          .get = snd_hda_mixer_amp_volume_get, \
          .put = snd_hda_mixer_amp_volume_put, \
          .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
+/* stereo volume with index */
 #define HDA_CODEC_VOLUME_IDX(xname, xcidx, nid, xindex, direction) \
        HDA_CODEC_VOLUME_MONO_IDX(xname, xcidx, nid, 3, xindex, direction)
+/* mono volume */
 #define HDA_CODEC_VOLUME_MONO(xname, nid, channel, xindex, direction) \
        HDA_CODEC_VOLUME_MONO_IDX(xname, 0, nid, channel, xindex, direction)
+/* stereo volume */
 #define HDA_CODEC_VOLUME(xname, nid, xindex, direction) \
        HDA_CODEC_VOLUME_MONO(xname, nid, 3, xindex, direction)
+/* mono mute switch with index (index=0,1,...) (channel=1,2) */
 #define HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, channel, xindex, direction) \
        { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = xcidx, \
          .info = snd_hda_mixer_amp_switch_info, \
          .get = snd_hda_mixer_amp_switch_get, \
          .put = snd_hda_mixer_amp_switch_put, \
          .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, xindex, direction) }
+/* stereo mute switch with index */
 #define HDA_CODEC_MUTE_IDX(xname, xcidx, nid, xindex, direction) \
        HDA_CODEC_MUTE_MONO_IDX(xname, xcidx, nid, 3, xindex, direction)
+/* mono mute switch */
 #define HDA_CODEC_MUTE_MONO(xname, nid, channel, xindex, direction) \
        HDA_CODEC_MUTE_MONO_IDX(xname, 0, nid, channel, xindex, direction)
+/* stereo mute switch */
 #define HDA_CODEC_MUTE(xname, nid, xindex, direction) \
        HDA_CODEC_MUTE_MONO(xname, nid, 3, xindex, direction)
 
-int snd_hda_mixer_amp_volume_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo);
-int snd_hda_mixer_amp_volume_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol);
-int snd_hda_mixer_amp_volume_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol);
-int snd_hda_mixer_amp_switch_info(snd_kcontrol_t *kcontrol, snd_ctl_elem_info_t *uinfo);
-int snd_hda_mixer_amp_switch_get(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol);
-int snd_hda_mixer_amp_switch_put(snd_kcontrol_t *kcontrol, snd_ctl_elem_value_t *ucontrol);
+int snd_hda_mixer_amp_volume_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
+int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
+int snd_hda_mixer_amp_volume_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
+int snd_hda_mixer_amp_switch_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo);
+int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
+int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
+/* lowlevel accessor with caching; use carefully */
+int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch,
+                          int direction, int index);
+int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
+                            int direction, int idx, int mask, int val);
+
+/* mono switch binding multiple inputs */
+#define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \
+       { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0,  \
+         .info = snd_hda_mixer_amp_switch_info, \
+         .get = snd_hda_mixer_bind_switch_get, \
+         .put = snd_hda_mixer_bind_switch_put, \
+         .private_value = HDA_COMPOSE_AMP_VAL(nid, channel, indices, direction) }
+
+/* stereo switch binding multiple inputs */
+#define HDA_BIND_MUTE(xname,nid,indices,dir) HDA_BIND_MUTE_MONO(xname,nid,3,indices,dir)
+
+int snd_hda_mixer_bind_switch_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
+int snd_hda_mixer_bind_switch_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol);
 
 int snd_hda_create_spdif_out_ctls(struct hda_codec *codec, hda_nid_t nid);
 int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid);
@@ -65,7 +92,7 @@ int snd_hda_create_spdif_in_ctls(struct hda_codec *codec, hda_nid_t nid);
 /*
  * input MUX helper
  */
-#define HDA_MAX_NUM_INPUTS     8
+#define HDA_MAX_NUM_INPUTS     16
 struct hda_input_mux_item {
        const char *label;
        unsigned int index;
@@ -75,11 +102,28 @@ struct hda_input_mux {
        struct hda_input_mux_item items[HDA_MAX_NUM_INPUTS];
 };
 
-int snd_hda_input_mux_info(const struct hda_input_mux *imux, snd_ctl_elem_info_t *uinfo);
+int snd_hda_input_mux_info(const struct hda_input_mux *imux, struct snd_ctl_elem_info *uinfo);
 int snd_hda_input_mux_put(struct hda_codec *codec, const struct hda_input_mux *imux,
-                         snd_ctl_elem_value_t *ucontrol, hda_nid_t nid,
+                         struct snd_ctl_elem_value *ucontrol, hda_nid_t nid,
                          unsigned int *cur_val);
 
+/*
+ * Channel mode helper
+ */
+struct hda_channel_mode {
+       int channels;
+       const struct hda_verb *sequence;
+};
+
+int snd_hda_ch_mode_info(struct hda_codec *codec, struct snd_ctl_elem_info *uinfo,
+                        const struct hda_channel_mode *chmode, int num_chmodes);
+int snd_hda_ch_mode_get(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol,
+                       const struct hda_channel_mode *chmode, int num_chmodes,
+                       int max_channels);
+int snd_hda_ch_mode_put(struct hda_codec *codec, struct snd_ctl_elem_value *ucontrol,
+                       const struct hda_channel_mode *chmode, int num_chmodes,
+                       int *max_channelsp);
+
 /*
  * Multi-channel / digital-out PCM helper
  */
@@ -91,6 +135,7 @@ struct hda_multi_out {
        int num_dacs;           /* # of DACs, must be more than 1 */
        hda_nid_t *dac_nids;    /* DAC list */
        hda_nid_t hp_nid;       /* optional DAC for HP, 0 when not exists */
+       hda_nid_t extra_out_nid[3];     /* optional DACs, 0 when not exists */
        hda_nid_t dig_out_nid;  /* digital out audio widget */
        int max_channels;       /* currently supported analog channels */
        int dig_out_used;       /* current usage of digital out (HDA_DIG_XXX) */
@@ -99,11 +144,11 @@ struct hda_multi_out {
 int snd_hda_multi_out_dig_open(struct hda_codec *codec, struct hda_multi_out *mout);
 int snd_hda_multi_out_dig_close(struct hda_codec *codec, struct hda_multi_out *mout);
 int snd_hda_multi_out_analog_open(struct hda_codec *codec, struct hda_multi_out *mout,
-                                 snd_pcm_substream_t *substream);
+                                 struct snd_pcm_substream *substream);
 int snd_hda_multi_out_analog_prepare(struct hda_codec *codec, struct hda_multi_out *mout,
                                     unsigned int stream_tag,
                                     unsigned int format,
-                                    snd_pcm_substream_t *substream);
+                                    struct snd_pcm_substream *substream);
 int snd_hda_multi_out_analog_cleanup(struct hda_codec *codec, struct hda_multi_out *mout);
 
 /*
@@ -126,18 +171,18 @@ static inline int snd_hda_codec_proc_new(struct hda_codec *codec) { return 0; }
 struct hda_board_config {
        const char *modelname;
        int config;
-       unsigned short pci_vendor;
-       unsigned short pci_device;
+       unsigned short pci_subvendor;
+       unsigned short pci_subdevice;
 };
 
-int snd_hda_check_board_config(struct hda_codec *codec, struct hda_board_config *tbl);
-int snd_hda_add_new_ctls(struct hda_codec *codec, snd_kcontrol_new_t *knew);
+int snd_hda_check_board_config(struct hda_codec *codec, const struct hda_board_config *tbl);
+int snd_hda_add_new_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew);
 
 /*
  * power management
  */
 #ifdef CONFIG_PM
-int snd_hda_resume_ctls(struct hda_codec *codec, snd_kcontrol_new_t *knew);
+int snd_hda_resume_ctls(struct hda_codec *codec, struct snd_kcontrol_new *knew);
 int snd_hda_resume_spdif_out(struct hda_codec *codec);
 int snd_hda_resume_spdif_in(struct hda_codec *codec);
 #endif
@@ -158,4 +203,66 @@ struct hda_bus_unsolicited {
        struct work_struct work;
 };
 
+/*
+ * Helper for automatic ping configuration
+ */
+
+enum {
+       AUTO_PIN_MIC,
+       AUTO_PIN_FRONT_MIC,
+       AUTO_PIN_LINE,
+       AUTO_PIN_FRONT_LINE,
+       AUTO_PIN_CD,
+       AUTO_PIN_AUX,
+       AUTO_PIN_LAST
+};
+
+extern const char *auto_pin_cfg_labels[AUTO_PIN_LAST];
+
+struct auto_pin_cfg {
+       int line_outs;
+       hda_nid_t line_out_pins[5]; /* sorted in the order of Front/Surr/CLFE/Side */
+       int speaker_outs;
+       hda_nid_t speaker_pins[5];
+       hda_nid_t hp_pin;
+       hda_nid_t input_pins[AUTO_PIN_LAST];
+       hda_nid_t dig_out_pin;
+       hda_nid_t dig_in_pin;
+};
+
+#define get_defcfg_connect(cfg) ((cfg & AC_DEFCFG_PORT_CONN) >> AC_DEFCFG_PORT_CONN_SHIFT)
+#define get_defcfg_association(cfg) ((cfg & AC_DEFCFG_DEF_ASSOC) >> AC_DEFCFG_ASSOC_SHIFT)
+#define get_defcfg_location(cfg) ((cfg & AC_DEFCFG_LOCATION) >> AC_DEFCFG_LOCATION_SHIFT)
+#define get_defcfg_sequence(cfg) (cfg & AC_DEFCFG_SEQUENCE)
+#define get_defcfg_device(cfg) ((cfg & AC_DEFCFG_DEVICE) >> AC_DEFCFG_DEVICE_SHIFT)
+
+int snd_hda_parse_pin_def_config(struct hda_codec *codec, struct auto_pin_cfg *cfg,
+                                hda_nid_t *ignore_nids);
+
+/* amp values */
+#define AMP_IN_MUTE(idx)       (0x7080 | ((idx)<<8))
+#define AMP_IN_UNMUTE(idx)     (0x7000 | ((idx)<<8))
+#define AMP_OUT_MUTE   0xb080
+#define AMP_OUT_UNMUTE 0xb000
+#define AMP_OUT_ZERO   0xb000
+/* pinctl values */
+#define PIN_IN         0x20
+#define PIN_VREF80     0x24
+#define PIN_VREF50     0x21
+#define PIN_OUT                0x40
+#define PIN_HP         0xc0
+#define PIN_HP_AMP     0x80
+
+/*
+ * get widget capabilities
+ */
+static inline u32 get_wcaps(struct hda_codec *codec, hda_nid_t nid)
+{
+       if (nid < codec->start_nid ||
+           nid >= codec->start_nid + codec->num_nodes)
+               return snd_hda_param_read(codec, nid, AC_PAR_AUDIO_WIDGET_CAP);
+       return codec->wcaps[nid - codec->start_nid];
+}
+
+
 #endif /* __SOUND_HDA_LOCAL_H */
index d1f9083..502da1c 100644 (file)
 #include <linux/interrupt.h>
 #include <linux/init.h>
 #include <linux/slab.h>
+#include <linux/mutex.h>
+
 #include <sound/core.h>
 
 #include "ice1712.h"
 #include "envy24ht.h"
 #include "phase.h"
 
-static akm4xxx_t akm_phase22 __devinitdata = {
+/* WM8770 registers */
+#define WM_DAC_ATTEN           0x00    /* DAC1-8 analog attenuation */
+#define WM_DAC_MASTER_ATTEN    0x08    /* DAC master analog attenuation */
+#define WM_DAC_DIG_ATTEN       0x09    /* DAC1-8 digital attenuation */
+#define WM_DAC_DIG_MASTER_ATTEN        0x11    /* DAC master digital attenuation */
+#define WM_PHASE_SWAP          0x12    /* DAC phase */
+#define WM_DAC_CTRL1           0x13    /* DAC control bits */
+#define WM_MUTE                        0x14    /* mute controls */
+#define WM_DAC_CTRL2           0x15    /* de-emphasis and zefo-flag */
+#define WM_INT_CTRL            0x16    /* interface control */
+#define WM_MASTER              0x17    /* master clock and mode */
+#define WM_POWERDOWN           0x18    /* power-down controls */
+#define WM_ADC_GAIN            0x19    /* ADC gain L(19)/R(1a) */
+#define WM_ADC_MUX             0x1b    /* input MUX */
+#define WM_OUT_MUX1            0x1c    /* output MUX */
+#define WM_OUT_MUX2            0x1e    /* output MUX */
+#define WM_RESET               0x1f    /* software reset */
+
+
+/*
+ * Logarithmic volume values for WM8770
+ * Computed as 20 * Log10(255 / x)
+ */
+static unsigned char wm_vol[256] = {
+       127, 48, 42, 39, 36, 34, 33, 31, 30, 29, 28, 27, 27, 26, 25, 25, 24, 24, 23,
+       23, 22, 22, 21, 21, 21, 20, 20, 20, 19, 19, 19, 18, 18, 18, 18, 17, 17, 17,
+       17, 16, 16, 16, 16, 15, 15, 15, 15, 15, 15, 14, 14, 14, 14, 14, 13, 13, 13,
+       13, 13, 13, 13, 12, 12, 12, 12, 12, 12, 12, 11, 11, 11, 11, 11, 11, 11, 11,
+       11, 10, 10, 10, 10, 10, 10, 10, 10, 10, 9, 9, 9, 9, 9, 9, 9, 9, 9, 9, 8, 8,
+       8, 8, 8, 8, 8, 8, 8, 8, 8, 8, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 7, 6, 6, 6,
+       6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 6, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5, 5,
+       5, 5, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 4, 3, 3, 3, 3, 3,
+       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, 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
+};
+
+#define WM_VOL_MAX     (sizeof(wm_vol) - 1)
+#define WM_VOL_MUTE    0x8000
+
+static struct snd_akm4xxx akm_phase22 __devinitdata = {
        .type = SND_AK4524,
        .num_dacs = 2,
        .num_adcs = 2,
@@ -63,9 +106,9 @@ static struct snd_ak4xxx_private akm_phase22_priv __devinitdata = {
        .mask_flags =   0,
 };
 
-static int __devinit phase22_init(ice1712_t *ice)
+static int __devinit phase22_init(struct snd_ice1712 *ice)
 {
-       akm4xxx_t *ak;
+       struct snd_akm4xxx *ak;
        int err;
 
        // Configure DAC/ADC description for generic part of ice1724
@@ -81,7 +124,7 @@ static int __devinit phase22_init(ice1712_t *ice)
        }
 
        // Initialize analog chips
-       ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL);
+       ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
        if (! ak)
                return -ENOMEM;
        ice->akm_codecs = 1;
@@ -95,7 +138,7 @@ static int __devinit phase22_init(ice1712_t *ice)
        return 0;
 }
 
-static int __devinit phase22_add_controls(ice1712_t *ice)
+static int __devinit phase22_add_controls(struct snd_ice1712 *ice)
 {
        int err = 0;
 
@@ -124,6 +167,684 @@ static unsigned char phase22_eeprom[] __devinitdata = {
        0x00,   /* GPIO_STATE2 */
 };
 
+static unsigned char phase28_eeprom[] __devinitdata = {
+       0x0b,   /* SYSCONF: clock 512, spdif-in/ADC, 4DACs */
+       0x80,   /* ACLINK: I2S */
+       0xfc,   /* I2S: vol, 96k, 24bit, 192k */
+       0xc3,   /* SPDIF: out-en, out-int, spdif-in */
+       0xff,   /* GPIO_DIR */
+       0xff,   /* GPIO_DIR1 */
+       0x5f,   /* GPIO_DIR2 */
+       0x00,   /* GPIO_MASK */
+       0x00,   /* GPIO_MASK1 */
+       0x00,   /* GPIO_MASK2 */
+       0x00,   /* GPIO_STATE */
+       0x00,   /* GPIO_STATE1 */
+       0x00,   /* GPIO_STATE2 */
+};
+
+/*
+ * write data in the SPI mode
+ */
+static void phase28_spi_write(struct snd_ice1712 *ice, unsigned int cs, unsigned int data, int bits)
+{
+       unsigned int tmp;
+       int i;
+
+       tmp = snd_ice1712_gpio_read(ice);
+
+       snd_ice1712_gpio_set_mask(ice, ~(PHASE28_WM_RW|PHASE28_SPI_MOSI|PHASE28_SPI_CLK|
+                                        PHASE28_WM_CS));
+       tmp |= PHASE28_WM_RW;
+       tmp &= ~cs;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(1);
+
+       for (i = bits - 1; i >= 0; i--) {
+               tmp &= ~PHASE28_SPI_CLK;
+               snd_ice1712_gpio_write(ice, tmp);
+               udelay(1);
+               if (data & (1 << i))
+                       tmp |= PHASE28_SPI_MOSI;
+               else
+                       tmp &= ~PHASE28_SPI_MOSI;
+               snd_ice1712_gpio_write(ice, tmp);
+               udelay(1);
+               tmp |= PHASE28_SPI_CLK;
+               snd_ice1712_gpio_write(ice, tmp);
+               udelay(1);
+       }
+
+       tmp &= ~PHASE28_SPI_CLK;
+       tmp |= cs;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(1);
+       tmp |= PHASE28_SPI_CLK;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(1);
+}
+
+/*
+ * get the current register value of WM codec
+ */
+static unsigned short wm_get(struct snd_ice1712 *ice, int reg)
+{
+       reg <<= 1;
+       return ((unsigned short)ice->akm[0].images[reg] << 8) |
+               ice->akm[0].images[reg + 1];
+}
+
+/*
+ * set the register value of WM codec
+ */
+static void wm_put_nocache(struct snd_ice1712 *ice, int reg, unsigned short val)
+{
+       phase28_spi_write(ice, PHASE28_WM_CS, (reg << 9) | (val & 0x1ff), 16);
+}
+
+/*
+ * set the register value of WM codec and remember it
+ */
+static void wm_put(struct snd_ice1712 *ice, int reg, unsigned short val)
+{
+       wm_put_nocache(ice, reg, val);
+       reg <<= 1;
+       ice->akm[0].images[reg] = val >> 8;
+       ice->akm[0].images[reg + 1] = val;
+}
+
+static void wm_set_vol(struct snd_ice1712 *ice, unsigned int index, unsigned short vol, unsigned short master)
+{
+       unsigned char nvol;
+
+       if ((master & WM_VOL_MUTE) || (vol & WM_VOL_MUTE))
+               nvol = 0;
+       else
+               nvol = 127 - wm_vol[(((vol & ~WM_VOL_MUTE) * (master & ~WM_VOL_MUTE)) / 127) & WM_VOL_MAX];
+
+       wm_put(ice, index, nvol);
+       wm_put_nocache(ice, index, 0x180 | nvol);
+}
+
+/*
+ * DAC mute control
+ */
+#define wm_pcm_mute_info       phase28_mono_bool_info
+
+static int wm_pcm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+
+       mutex_lock(&ice->gpio_mutex);
+       ucontrol->value.integer.value[0] = (wm_get(ice, WM_MUTE) & 0x10) ? 0 : 1;
+       mutex_unlock(&ice->gpio_mutex);
+       return 0;
+}
+
+static int wm_pcm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       unsigned short nval, oval;
+       int change;
+
+       snd_ice1712_save_gpio_status(ice);
+       oval = wm_get(ice, WM_MUTE);
+       nval = (oval & ~0x10) | (ucontrol->value.integer.value[0] ? 0 : 0x10);
+       if ((change = (nval != oval)))
+               wm_put(ice, WM_MUTE, nval);
+       snd_ice1712_restore_gpio_status(ice);
+
+       return change;
+}
+
+/*
+ * Master volume attenuation mixer control
+ */
+static int wm_master_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = 2;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = WM_VOL_MAX;
+       return 0;
+}
+
+static int wm_master_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int i;
+       for (i=0; i<2; i++)
+               ucontrol->value.integer.value[i] = ice->spec.phase28.master[i] & ~WM_VOL_MUTE;
+       return 0;
+}
+
+static int wm_master_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int ch, change = 0;
+
+       snd_ice1712_save_gpio_status(ice);
+       for (ch = 0; ch < 2; ch++) {
+               if (ucontrol->value.integer.value[ch] != ice->spec.phase28.master[ch]) {
+                       int dac;
+                       ice->spec.phase28.master[ch] &= WM_VOL_MUTE;
+                       ice->spec.phase28.master[ch] |= ucontrol->value.integer.value[ch];
+                       for (dac = 0; dac < ice->num_total_dacs; dac += 2)
+                               wm_set_vol(ice, WM_DAC_ATTEN + dac + ch,
+                                          ice->spec.phase28.vol[dac + ch],
+                                          ice->spec.phase28.master[ch]);
+                       change = 1;
+               }
+       }
+       snd_ice1712_restore_gpio_status(ice);
+       return change;
+}
+
+static int __devinit phase28_init(struct snd_ice1712 *ice)
+{
+       static unsigned short wm_inits_phase28[] = {
+               /* These come first to reduce init pop noise */
+               0x1b, 0x044,            /* ADC Mux (AC'97 source) */
+               0x1c, 0x00B,            /* Out Mux1 (VOUT1 = DAC+AUX, VOUT2 = DAC) */
+               0x1d, 0x009,            /* Out Mux2 (VOUT2 = DAC, VOUT3 = DAC) */
+
+               0x18, 0x000,            /* All power-up */
+
+               0x16, 0x122,            /* I2S, normal polarity, 24bit */
+               0x17, 0x022,            /* 256fs, slave mode */
+               0x00, 0,                /* DAC1 analog mute */
+               0x01, 0,                /* DAC2 analog mute */
+               0x02, 0,                /* DAC3 analog mute */
+               0x03, 0,                /* DAC4 analog mute */
+               0x04, 0,                /* DAC5 analog mute */
+               0x05, 0,                /* DAC6 analog mute */
+               0x06, 0,                /* DAC7 analog mute */
+               0x07, 0,                /* DAC8 analog mute */
+               0x08, 0x100,            /* master analog mute */
+               0x09, 0xff,             /* DAC1 digital full */
+               0x0a, 0xff,             /* DAC2 digital full */
+               0x0b, 0xff,             /* DAC3 digital full */
+               0x0c, 0xff,             /* DAC4 digital full */
+               0x0d, 0xff,             /* DAC5 digital full */
+               0x0e, 0xff,             /* DAC6 digital full */
+               0x0f, 0xff,             /* DAC7 digital full */
+               0x10, 0xff,             /* DAC8 digital full */
+               0x11, 0x1ff,            /* master digital full */
+               0x12, 0x000,            /* phase normal */
+               0x13, 0x090,            /* unmute DAC L/R */
+               0x14, 0x000,            /* all unmute */
+               0x15, 0x000,            /* no deemphasis, no ZFLG */
+               0x19, 0x000,            /* -12dB ADC/L */
+               0x1a, 0x000,            /* -12dB ADC/R */
+               (unsigned short)-1
+       };
+
+       unsigned int tmp;
+       struct snd_akm4xxx *ak;
+       unsigned short *p;
+       int i;
+
+       ice->num_total_dacs = 8;
+       ice->num_total_adcs = 2;
+
+       // Initialize analog chips
+       ak = ice->akm = kzalloc(sizeof(struct snd_akm4xxx), GFP_KERNEL);
+       if (!ak)
+               return -ENOMEM;
+       ice->akm_codecs = 1;
+
+       snd_ice1712_gpio_set_dir(ice, 0x5fffff); /* fix this for the time being */
+
+       /* reset the wm codec as the SPI mode */
+       snd_ice1712_save_gpio_status(ice);
+       snd_ice1712_gpio_set_mask(ice, ~(PHASE28_WM_RESET|PHASE28_WM_CS|PHASE28_HP_SEL));
+
+       tmp = snd_ice1712_gpio_read(ice);
+       tmp &= ~PHASE28_WM_RESET;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(1);
+       tmp |= PHASE28_WM_CS;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(1);
+       tmp |= PHASE28_WM_RESET;
+       snd_ice1712_gpio_write(ice, tmp);
+       udelay(1);
+
+       p = wm_inits_phase28;
+       for (; *p != (unsigned short)-1; p += 2)
+               wm_put(ice, p[0], p[1]);
+
+       snd_ice1712_restore_gpio_status(ice);
+
+       ice->spec.phase28.master[0] = WM_VOL_MUTE;
+       ice->spec.phase28.master[1] = WM_VOL_MUTE;
+       for (i = 0; i < ice->num_total_dacs; i++) {
+               ice->spec.phase28.vol[i] = WM_VOL_MUTE;
+               wm_set_vol(ice, i, ice->spec.phase28.vol[i], ice->spec.phase28.master[i % 2]);
+       }
+
+       return 0;
+}
+
+/*
+ * DAC volume attenuation mixer control
+ */
+static int wm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
+{
+       int voices = kcontrol->private_value >> 8;
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = voices;
+       uinfo->value.integer.min = 0;           /* mute (-101dB) */
+       uinfo->value.integer.max = 0x7F;        /* 0dB */
+       return 0;
+}
+
+static int wm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int i, ofs, voices;
+
+       voices = kcontrol->private_value >> 8;
+       ofs = kcontrol->private_value & 0xff;
+       for (i = 0; i < voices; i++)
+               ucontrol->value.integer.value[i] = ice->spec.phase28.vol[ofs+i] & ~WM_VOL_MUTE;
+       return 0;
+}
+
+static int wm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int i, idx, ofs, voices;
+       int change = 0;
+
+       voices = kcontrol->private_value >> 8;
+       ofs = kcontrol->private_value & 0xff;
+       snd_ice1712_save_gpio_status(ice);
+       for (i = 0; i < voices; i++) {
+               idx  = WM_DAC_ATTEN + ofs + i;
+               if (ucontrol->value.integer.value[i] != ice->spec.phase28.vol[ofs+i]) {
+                       ice->spec.phase28.vol[ofs+i] &= WM_VOL_MUTE;
+                       ice->spec.phase28.vol[ofs+i] |= ucontrol->value.integer.value[i];
+                       wm_set_vol(ice, idx, ice->spec.phase28.vol[ofs+i],
+                                  ice->spec.phase28.master[i]);
+                       change = 1;
+               }
+       }
+       snd_ice1712_restore_gpio_status(ice);
+       return change;
+}
+
+/*
+ * WM8770 mute control
+ */
+static int wm_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+       uinfo->count = kcontrol->private_value >> 8;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 1;
+       return 0;
+}
+
+static int wm_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int voices, ofs, i;
+
+       voices = kcontrol->private_value >> 8;
+       ofs = kcontrol->private_value & 0xFF;
+
+       for (i = 0; i < voices; i++)
+               ucontrol->value.integer.value[i] = (ice->spec.phase28.vol[ofs+i] & WM_VOL_MUTE) ? 0 : 1;
+       return 0;
+}
+
+static int wm_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int change = 0, voices, ofs, i;
+
+       voices = kcontrol->private_value >> 8;
+       ofs = kcontrol->private_value & 0xFF;
+
+       snd_ice1712_save_gpio_status(ice);
+       for (i = 0; i < voices; i++) {
+               int val = (ice->spec.phase28.vol[ofs + i] & WM_VOL_MUTE) ? 0 : 1;
+               if (ucontrol->value.integer.value[i] != val) {
+                       ice->spec.phase28.vol[ofs + i] &= ~WM_VOL_MUTE;
+                       ice->spec.phase28.vol[ofs + i] |=
+                               ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE;
+                       wm_set_vol(ice, ofs + i, ice->spec.phase28.vol[ofs + i],
+                                  ice->spec.phase28.master[i]);
+                       change = 1;
+               }
+       }
+       snd_ice1712_restore_gpio_status(ice);
+
+       return change;
+}
+
+/*
+ * WM8770 master mute control
+ */
+static int wm_master_mute_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo) {
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+       uinfo->count = 2;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 1;
+       return 0;
+}
+
+static int wm_master_mute_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+
+       ucontrol->value.integer.value[0] = (ice->spec.phase28.master[0] & WM_VOL_MUTE) ? 0 : 1;
+       ucontrol->value.integer.value[1] = (ice->spec.phase28.master[1] & WM_VOL_MUTE) ? 0 : 1;
+       return 0;
+}
+
+static int wm_master_mute_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int change = 0, i;
+
+       snd_ice1712_save_gpio_status(ice);
+       for (i = 0; i < 2; i++) {
+               int val = (ice->spec.phase28.master[i] & WM_VOL_MUTE) ? 0 : 1;
+               if (ucontrol->value.integer.value[i] != val) {
+                       int dac;
+                       ice->spec.phase28.master[i] &= ~WM_VOL_MUTE;
+                       ice->spec.phase28.master[i] |=
+                               ucontrol->value.integer.value[i] ? 0 : WM_VOL_MUTE;
+                       for (dac = 0; dac < ice->num_total_dacs; dac += 2)
+                               wm_set_vol(ice, WM_DAC_ATTEN + dac + i,
+                                          ice->spec.phase28.vol[dac + i],
+                                          ice->spec.phase28.master[i]);
+                       change = 1;
+               }
+       }
+       snd_ice1712_restore_gpio_status(ice);
+
+       return change;
+}
+
+/* digital master volume */
+#define PCM_0dB 0xff
+#define PCM_RES 128    /* -64dB */
+#define PCM_MIN (PCM_0dB - PCM_RES)
+static int wm_pcm_vol_info(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_info *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
+       uinfo->count = 1;
+       uinfo->value.integer.min = 0;           /* mute (-64dB) */
+       uinfo->value.integer.max = PCM_RES;     /* 0dB */
+       return 0;
+}
+
+static int wm_pcm_vol_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       unsigned short val;
+
+       mutex_lock(&ice->gpio_mutex);
+       val = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
+       val = val > PCM_MIN ? (val - PCM_MIN) : 0;
+       ucontrol->value.integer.value[0] = val;
+       mutex_unlock(&ice->gpio_mutex);
+       return 0;
+}
+
+static int wm_pcm_vol_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       unsigned short ovol, nvol;
+       int change = 0;
+
+       snd_ice1712_save_gpio_status(ice);
+       nvol = ucontrol->value.integer.value[0];
+       nvol = (nvol ? (nvol + PCM_MIN) : 0) & 0xff;
+       ovol = wm_get(ice, WM_DAC_DIG_MASTER_ATTEN) & 0xff;
+       if (ovol != nvol) {
+               wm_put(ice, WM_DAC_DIG_MASTER_ATTEN, nvol); /* prelatch */
+               wm_put_nocache(ice, WM_DAC_DIG_MASTER_ATTEN, nvol | 0x100); /* update */
+               change = 1;
+       }
+       snd_ice1712_restore_gpio_status(ice);
+       return change;
+}
+
+/*
+ */
+static int phase28_mono_bool_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo)
+{
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
+       uinfo->count = 1;
+       uinfo->value.integer.min = 0;
+       uinfo->value.integer.max = 1;
+       return 0;
+}
+
+/*
+ * Deemphasis
+ */
+#define phase28_deemp_info     phase28_mono_bool_info
+
+static int phase28_deemp_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       ucontrol->value.integer.value[0] = (wm_get(ice, WM_DAC_CTRL2) & 0xf) == 0xf;
+       return 0;
+}
+
+static int phase28_deemp_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       int temp, temp2;
+       temp2 = temp = wm_get(ice, WM_DAC_CTRL2);
+       if (ucontrol->value.integer.value[0])
+               temp |= 0xf;
+       else
+               temp &= ~0xf;
+       if (temp != temp2) {
+               wm_put(ice, WM_DAC_CTRL2, temp);
+               return 1;
+       }
+       return 0;
+}
+
+/*
+ * ADC Oversampling
+ */
+static int phase28_oversampling_info(struct snd_kcontrol *k, struct snd_ctl_elem_info *uinfo)
+{
+       static char *texts[2] = { "128x", "64x" };
+
+       uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
+       uinfo->count = 1;
+       uinfo->value.enumerated.items = 2;
+
+       if (uinfo->value.enumerated.item >= uinfo->value.enumerated.items)
+               uinfo->value.enumerated.item = uinfo->value.enumerated.items - 1;
+       strcpy(uinfo->value.enumerated.name, texts[uinfo->value.enumerated.item]);
+
+        return 0;
+}
+
+static int phase28_oversampling_get(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+       ucontrol->value.enumerated.item[0] = (wm_get(ice, WM_MASTER) & 0x8) == 0x8;
+       return 0;
+}
+
+static int phase28_oversampling_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol)
+{
+       int temp, temp2;
+       struct snd_ice1712 *ice = snd_kcontrol_chip(kcontrol);
+
+       temp2 = temp = wm_get(ice, WM_MASTER);
+
+       if (ucontrol->value.enumerated.item[0])
+               temp |= 0x8;
+       else
+               temp &= ~0x8;
+
+       if (temp != temp2) {
+               wm_put(ice, WM_MASTER, temp);
+               return 1;
+       }
+       return 0;
+}
+
+static struct snd_kcontrol_new phase28_dac_controls[] __devinitdata = {
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Master Playback Switch",
+               .info = wm_master_mute_info,
+               .get = wm_master_mute_get,
+               .put = wm_master_mute_put
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Master Playback Volume",
+               .info = wm_master_vol_info,
+               .get = wm_master_vol_get,
+               .put = wm_master_vol_put
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Front Playback Switch",
+               .info = wm_mute_info,
+               .get = wm_mute_get,
+               .put = wm_mute_put,
+               .private_value = (2 << 8) | 0
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Front Playback Volume",
+               .info = wm_vol_info,
+               .get = wm_vol_get,
+               .put = wm_vol_put,
+               .private_value = (2 << 8) | 0
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Rear Playback Switch",
+               .info = wm_mute_info,
+               .get = wm_mute_get,
+               .put = wm_mute_put,
+               .private_value = (2 << 8) | 2
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Rear Playback Volume",
+               .info = wm_vol_info,
+               .get = wm_vol_get,
+               .put = wm_vol_put,
+               .private_value = (2 << 8) | 2
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Center Playback Switch",
+               .info = wm_mute_info,
+               .get = wm_mute_get,
+               .put = wm_mute_put,
+               .private_value = (1 << 8) | 4
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Center Playback Volume",
+               .info = wm_vol_info,
+               .get = wm_vol_get,
+               .put = wm_vol_put,
+               .private_value = (1 << 8) | 4
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "LFE Playback Switch",
+               .info = wm_mute_info,
+               .get = wm_mute_get,
+               .put = wm_mute_put,
+               .private_value = (1 << 8) | 5
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "LFE Playback Volume",
+               .info = wm_vol_info,
+               .get = wm_vol_get,
+               .put = wm_vol_put,
+               .private_value = (1 << 8) | 5
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Side Playback Switch",
+               .info = wm_mute_info,
+               .get = wm_mute_get,
+               .put = wm_mute_put,
+               .private_value = (2 << 8) | 6
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "Side Playback Volume",
+               .info = wm_vol_info,
+               .get = wm_vol_get,
+               .put = wm_vol_put,
+               .private_value = (2 << 8) | 6
+       }
+};
+
+static struct snd_kcontrol_new wm_controls[] __devinitdata = {
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "PCM Playback Switch",
+               .info = wm_pcm_mute_info,
+               .get = wm_pcm_mute_get,
+               .put = wm_pcm_mute_put
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "PCM Playback Volume",
+               .info = wm_pcm_vol_info,
+               .get = wm_pcm_vol_get,
+               .put = wm_pcm_vol_put
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "DAC Deemphasis Switch",
+               .info = phase28_deemp_info,
+               .get = phase28_deemp_get,
+               .put = phase28_deemp_put
+       },
+       {
+               .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
+               .name = "ADC Oversampling",
+               .info = phase28_oversampling_info,
+               .get = phase28_oversampling_get,
+               .put = phase28_oversampling_put
+       }
+};
+
+static int __devinit phase28_add_controls(struct snd_ice1712 *ice)
+{
+       unsigned int i, counts;
+       int err;
+
+       counts = ARRAY_SIZE(phase28_dac_controls);
+       for (i = 0; i < counts; i++) {
+               err = snd_ctl_add(ice->card, snd_ctl_new1(&phase28_dac_controls[i], ice));
+               if (err < 0)
+                       return err;
+       }
+
+       for (i = 0; i < ARRAY_SIZE(wm_controls); i++) {
+               err = snd_ctl_add(ice->card, snd_ctl_new1(&wm_controls[i], ice));
+               if (err < 0)
+                       return err;
+       }
+
+       return 0;
+}
+
 struct snd_ice1712_card_info snd_vt1724_phase_cards[] __devinitdata = {
        {
                .subvendor = VT1724_SUBDEVICE_PHASE22,
@@ -134,5 +855,14 @@ struct snd_ice1712_card_info snd_vt1724_phase_cards[] __devinitdata = {
                .eeprom_size = sizeof(phase22_eeprom),
                .eeprom_data = phase22_eeprom,
        },
+       {
+               .subvendor = VT1724_SUBDEVICE_PHASE28,
+               .name = "Terratec PHASE 28",
+               .model = "phase28",
+               .chip_init = phase28_init,
+               .build_controls = phase28_add_controls,
+               .eeprom_size = sizeof(phase28_eeprom),
+               .eeprom_data = phase28_eeprom,
+       },
        { } /* terminator */
 };